vendor: 4,723 bytes, lines 1-17
1var cE=Object.defineProperty;var uE=(t,e,i)=>e in t?cE(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i;var Y=(t,e,i)=>uE(t,typeof e!="symbol"?e+"":e,i);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))n(o);new MutationObserver(o=>{for(const d of o)if(d.type==="childList")for(const p of d.addedNodes)p.tagName==="LINK"&&p.rel==="modulepreload"&&n(p)}).observe(document,{childList:!0,subtree:!0});function i(o){const d={};return o.integrity&&(d.integrity=o.integrity),o.referrerPolicy&&(d.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?d.credentials="include":o.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function n(o){if(o.ep)return;o.ep=!0;const d=i(o);fetch(o.href,d)}})();function tS(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Iv={exports:{}},Lm={};/** 2 * @license React 3 * react-jsx-runtime.production.js 4 * 5 * Copyright (c) Meta Platforms, Inc. and 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 zx;function hE(){if(zx)return Lm;zx=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function i(n,o,d){var p=null;if(d!==void 0&&(p=""+d),o.key!==void 0&&(p=""+o.key),"key"in o){d={};for(var h in o)h!=="key"&&(d[h]=o[h])}else d=o;return o=d.ref,{$$typeof:t,type:n,key:p,ref:o!==void 0?o:null,props:d}}return Lm.Fragment=e,Lm.jsx=i,Lm.jsxs=i,Lm}var Lx;function dE(){return Lx||(Lx=1,Iv.exports=hE()),Iv.exports}var j=dE(),Dv={exports:{}},Ai={};/** 10 * @license React 11 * react.production.js 12 * 13 * Copyright (c) Meta Platforms, Inc. and affiliates. 14 * 15 * This source code is licensed under the MIT license found in the 16 * LICENSE file in the root directory of this source tree. 17 */var Fx;function fE(){if(Fx)return Ai;Fx=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),d=Symbol.for("react.consumer"),p=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),A=Symbol.for("react.suspense"),R=Symbol.for("react.memo"),B=Symbol.for("react.lazy"),N=Symbol.for("react.activity"),F=Symbol.iterator;function Q(oe){return oe===null||typeof oe!="object"?null:(oe=F&&oe[F]||oe["@@iterator"],typeof oe=="function"?oe:null)}var re={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},se=Object.assign,ae={};function me(oe,Ue,ut){this.props=oe,this.context=Ue,this.refs=ae,this.updater=ut||re}me.prototype.isReactComponent={},me.prototype.setState=function(oe,Ue){if(typeof oe!="object"&&typeof oe!="function"&&oe!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,oe,Ue,"setState")},me.prototype.forceUpdate=function(oe){this.updater.enqueueForceUpdate(this,oe,"forceUpdate")};function we(){}we.prototype=me.prototype;function ve(oe,Ue,ut){this.props=oe,this.context=Ue,this.refs=ae,this.updater=ut||re}var Oe=ve.prototype=new we;Oe.constructor=ve,se(Oe,me.prototype),Oe.isPureReactComponent=!0;var Te=Array.isArray;function Re(){}var Ee={H:null,A:null,T:null,S:null},Je=Object.prototype.hasOwnProperty;function rt(oe,Ue,ut){var Tt=ut.ref;return{$$typeof:t,type:oe,key:Ue,ref:Tt!==void 0?Tt:null,props:ut}}function Ke(oe,Ue){return rt(oe.type,Ue,oe.props)}function Qe(oe){return typeof oe=="object"&&oe!==null&&oe.$$typeof===t}function ht(oe){var Ue={"=":"=0",":":"=2"};return"$"+oe.replace(/[=:]/g,function(ut){return Ue[ut]})}var At=/\/+/g;function Fe(oe,Ue){return typeof oe=="object"&&oe!==null&&oe.key!=null?ht(""+oe.key):Ue.toString(36)}function Dt(oe){switch(oe.status){case"fulfilled":return oe.value;case"rejected":throw oe.reason;default:switch(typeof oe.status=="string"?oe.then(Re,Re):(oe.status="pending",oe.then(function(Ue){oe.status==="pending"&&(oe.status="fulfilled",oe.value=Ue)},function(Ue){oe.status==="pending"&&(oe.status="rejected",oe.reason=Ue)})),oe.status){case"fulfilled":return oe.value;case"rejected":throw oe.reason}}throw oe}function Le(oe,Ue,ut,Tt,$t){var qt=typeof oe;(qt==="undefined"||qt==="boolean")&&(oe=null);var ti=!1;if(oe===null)ti=!0;else switch(qt){case"bigint":case"string":case"number":ti=!0;break;case"object":switch(oe.$$typeof){case t:case e:ti=!0;break;case B:return ti=oe._init,Le(ti(oe._payload),Ue,ut,Tt,$t)}}if(ti)return $t=$t(oe),ti=Tt===""?"."+Fe(oe,0):Tt,Te($t)?(ut="",ti!=null&&(ut
vendor: 14,386 bytes, lines 17-41
17=ti.replace(At,"$&/")+"/"),Le($t,Ue,ut,"",function(Er){return Er})):$t!=null&&(Qe($t)&&($t=Ke($t,ut+($t.key==null||oe&&oe.key===$t.key?"":(""+$t.key).replace(At,"$&/")+"/")+ti)),Ue.push($t)),1;ti=0;var Li=Tt===""?".":Tt+":";if(Te(oe))for(var ki=0;ki<oe.length;ki++)Tt=oe[ki],qt=Li+Fe(Tt,ki),ti+=Le(Tt,Ue,ut,qt,$t);else if(ki=Q(oe),typeof ki=="function")for(oe=ki.call(oe),ki=0;!(Tt=oe.next()).done;)Tt=Tt.value,qt=Li+Fe(Tt,ki++),ti+=Le(Tt,Ue,ut,qt,$t);else if(qt==="object"){if(typeof oe.then=="function")return Le(Dt(oe),Ue,ut,Tt,$t);throw Ue=String(oe),Error("Objects are not valid as a React child (found: "+(Ue==="[object Object]"?"object with keys {"+Object.keys(oe).join(", ")+"}":Ue)+"). If you meant to render a collection of children, use an array instead.")}return ti}function nt(oe,Ue,ut){if(oe==null)return oe;var Tt=[],$t=0;return Le(oe,Tt,"","",function(qt){return Ue.call(ut,qt,$t++)}),Tt}function mt(oe){if(oe._status===-1){var Ue=oe._result;Ue=Ue(),Ue.then(function(ut){(oe._status===0||oe._status===-1)&&(oe._status=1,oe._result=ut)},function(ut){(oe._status===0||oe._status===-1)&&(oe._status=2,oe._result=ut)}),oe._status===-1&&(oe._status=0,oe._result=Ue)}if(oe._status===1)return oe._result.default;throw oe._result}var ei=typeof reportError=="function"?reportError:function(oe){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Ue=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof oe=="object"&&oe!==null&&typeof oe.message=="string"?String(oe.message):String(oe),error:oe});if(!window.dispatchEvent(Ue))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",oe);return}console.error(oe)},ai={map:nt,forEach:function(oe,Ue,ut){nt(oe,function(){Ue.apply(this,arguments)},ut)},count:function(oe){var Ue=0;return nt(oe,function(){Ue++}),Ue},toArray:function(oe){return nt(oe,function(Ue){return Ue})||[]},only:function(oe){if(!Qe(oe))throw Error("React.Children.only expected to receive a single React element child.");return oe}};return Ai.Activity=N,Ai.Children=ai,Ai.Component=me,Ai.Fragment=i,Ai.Profiler=o,Ai.PureComponent=ve,Ai.StrictMode=n,Ai.Suspense=A,Ai.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Ee,Ai.__COMPILER_RUNTIME={__proto__:null,c:function(oe){return Ee.H.useMemoCache(oe)}},Ai.cache=function(oe){return function(){return oe.apply(null,arguments)}},Ai.cacheSignal=function(){return null},Ai.cloneElement=function(oe,Ue,ut){if(oe==null)throw Error("The argument must be a React element, but you passed "+oe+".");var Tt=se({},oe.props),$t=oe.key;if(Ue!=null)for(qt in Ue.key!==void 0&&($t=""+Ue.key),Ue)!Je.call(Ue,qt)||qt==="key"||qt==="__self"||qt==="__source"||qt==="ref"&&Ue.ref===void 0||(Tt[qt]=Ue[qt]);var qt=arguments.length-2;if(qt===1)Tt.children=ut;else if(1<qt){for(var ti=Array(qt),Li=0;Li<qt;Li++)ti[Li]=arguments[Li+2];Tt.children=ti}return rt(oe.type,$t,Tt)},Ai.createContext=function(oe){return oe={$$typeof:p,_currentValue:oe,_currentValue2:oe,_threadCount:0,Provider:null,Consumer:null},oe.Provider=oe,oe.Consumer={$$typeof:d,_context:oe},oe},Ai.createElement=function(oe,Ue,ut){var Tt,$t={},qt=null;if(Ue!=null)for(Tt in Ue.key!==void 0&&(qt=""+Ue.key),Ue)Je.call(Ue,Tt)&&Tt!=="key"&&Tt!=="__self"&&Tt!=="__source"&&($t[Tt]=Ue[Tt]);var ti=arguments.length-2;if(ti===1)$t.children=ut;else if(1<ti){for(var Li=Array(ti),ki=0;ki<ti;ki++)Li[ki]=arguments[ki+2];$t.children=Li}if(oe&&oe.defaultProps)for(Tt in ti=oe.defaultProps,ti)$t[Tt]===void 0&&($t[Tt]=ti[Tt]);return rt(oe,qt,$t)},Ai.createRef=function(){return{current:null}},Ai.forwardRef=function(oe){return{$$typeof:h,render:oe}},Ai.isValidElement=Qe,Ai.lazy=function(oe){return{$$typeof:B,_payload:{_status:-1,_result:oe},_init:mt}},Ai.memo=function(oe,Ue){return{$$typeof:R,type:oe,compare:Ue===void 0?null:Ue}},Ai.startTransition=function(oe){var Ue=Ee.T,ut={};Ee.T=ut;try{var Tt=oe(),$t=Ee.S;$t!==null&&$t(ut,Tt),typeof Tt=="object"&&Tt!==null&&typeof Tt.then=="function"&&Tt.then(Re,ei)}catch(qt){ei(qt)}finally{Ue!==null&&ut.types!==null&&(Ue.types=ut.types),Ee.T=Ue}},Ai.unstable_useCacheRefresh=function(){return Ee.H.useCacheRefresh()},Ai.use=function(oe){return Ee.H.use(oe)},Ai.useActionState=function(oe,Ue,ut){return Ee.H.useActionState(oe,Ue,ut)},Ai.useCallback=function(oe,Ue){return Ee.H.useCallback(oe,Ue)},Ai.useContext=function(oe){return Ee.H.useContext(oe)},Ai.useDebugValue=function(){},Ai.useDeferredValue=function(oe,Ue){return Ee.H.useDeferredValue(oe,Ue)},Ai.useEffect=function(oe,Ue){return Ee.H.useEffect(oe,Ue)},Ai.useEffectEvent=function(oe){return Ee.H.useEffectEvent(oe)},Ai.useId=function(){return Ee.H.useId()},Ai.useImperativeHandle=function(oe,Ue,ut){return Ee.H.useImperativeHandle(oe,Ue,ut)},Ai.useInsertionEffect=function(oe,Ue){return Ee.H.useInsertionEffect(oe,Ue)},Ai.useLayoutEffect=function(oe,Ue){return Ee.H.useLayoutEffect(oe,Ue)},Ai.useMemo=function(oe,Ue){return Ee.H.useMemo(oe,Ue)},Ai.useOptimistic=function(oe,Ue){return Ee.H.useOptimistic(oe,Ue)},Ai.useReducer=function(oe,Ue,ut){return Ee.H.useReducer(oe,Ue,ut)},Ai.useRef=function(oe){return Ee.H.useRef(oe)},Ai.useState=function(oe){return Ee.H.useState(oe)},Ai.useSyncExternalStore=function(oe,Ue,ut){return Ee.H.useSyncExternalStore(oe,Ue,ut)},Ai.useTransition=function(){return Ee.H.useTransition()},Ai.version="19.2.8",Ai}var Ux;function W0(){return Ux||(Ux=1,Dv.exports=fE()),Dv.exports}var He=W0();const R_=tS(He);var Ov={exports:{}},Fm={},kv={exports:{}},Bv={};/** 18 * @license React 19 * scheduler.production.js 20 * 21 * Copyright (c) Meta Platforms, Inc. and affiliates. 22 * 23 * This source code is licensed under the MIT license found in the 24 * LICENSE file in the root directory of this source tree. 25 */var jx;function pE(){return jx||(jx=1,(function(t){function e(Le,nt){var mt=Le.length;Le.push(nt);e:for(;0<mt;){var ei=mt-1>>>1,ai=Le[ei];if(0<o(ai,nt))Le[ei]=nt,Le[mt]=ai,mt=ei;else break e}}function i(Le){return Le.length===0?null:Le[0]}function n(Le){if(Le.length===0)return null;var nt=Le[0],mt=Le.pop();if(mt!==nt){Le[0]=mt;e:for(var ei=0,ai=Le.length,oe=ai>>>1;ei<oe;){var Ue=2*(ei+1)-1,ut=Le[Ue],Tt=Ue+1,$t=Le[Tt];if(0>o(ut,mt))Tt<ai&&0>o($t,ut)?(Le[ei]=$t,Le[Tt]=mt,ei=Tt):(Le[ei]=ut,Le[Ue]=mt,ei=Ue);else if(Tt<ai&&0>o($t,mt))Le[ei]=$t,Le[Tt]=mt,ei=Tt;else break e}}return nt}function o(Le,nt){var mt=Le.sortIndex-nt.sortIndex;return mt!==0?mt:Le.id-nt.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;t.unstable_now=function(){return d.now()}}else{var p=Date,h=p.now();t.unstable_now=function(){return p.now()-h}}var A=[],R=[],B=1,N=null,F=3,Q=!1,re=!1,se=!1,ae=!1,me=typeof setTimeout=="function"?setTimeout:null,we=typeof clearTimeout=="function"?clearTimeout:null,ve=typeof setImmediate<"u"?setImmediate:null;function Oe(Le){for(var nt=i(R);nt!==null;){if(nt.callback===null)n(R);else if(nt.startTime<=Le)n(R),nt.sortIndex=nt.expirationTime,e(A,nt);else break;nt=i(R)}}function Te(Le){if(se=!1,Oe(Le),!re)if(i(A)!==null)re=!0,Re||(Re=!0,ht());else{var nt=i(R);nt!==null&&Dt(Te,nt.startTime-Le)}}var Re=!1,Ee=-1,Je=5,rt=-1;function Ke(){return ae?!0:!(t.unstable_now()-rt<Je)}function Qe(){if(ae=!1,Re){var Le=t.unstable_now();rt=Le;var nt=!0;try{e:{re=!1,se&&(se=!1,we(Ee),Ee=-1),Q=!0;var mt=F;try{t:{for(Oe(Le),N=i(A);N!==null&&!(N.expirationTime>Le&&Ke());){var ei=N.callback;if(typeof ei=="function"){N.callback=null,F=N.priorityLevel;var ai=ei(N.expirationTime<=Le);if(Le=t.unstable_now(),typeof ai=="function"){N.callback=ai,Oe(Le),nt=!0;break t}N===i(A)&&n(A),Oe(Le)}else n(A);N=i(A)}if(N!==null)nt=!0;else{var oe=i(R);oe!==null&&Dt(Te,oe.startTime-Le),nt=!1}}break e}finally{N=null,F=mt,Q=!1}nt=void 0}}finally{nt?ht():Re=!1}}}var ht;if(typeof ve=="function")ht=function(){ve(Qe)};else if(typeof MessageChannel<"u"){var At=new MessageChannel,Fe=At.port2;At.port1.onmessage=Qe,ht=function(){Fe.postMessage(null)}}else ht=function(){me(Qe,0)};function Dt(Le,nt){Ee=me(function(){Le(t.unstable_now())},nt)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(Le){Le.callback=null},t.unstable_forceFrameRate=function(Le){0>Le||125<Le?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Je=0<Le?Math.floor(1e3/Le):5},t.unstable_getCurrentPriorityLevel=function(){return F},t.unstable_next=function(Le){switch(F){case 1:case 2:case 3:var nt=3;break;default:nt=F}var mt=F;F=nt;try{return Le()}finally{F=mt}},t.unstable_requestPaint=function(){ae=!0},t.unstable_runWithPriority=function(Le,nt){switch(Le){case 1:case 2:case 3:case 4:case 5:break;default:Le=3}var mt=F;F=Le;try{return nt()}finally{F=mt}},t.unstable_scheduleCallback=function(Le,nt,mt){var ei=t.unstable_now();switch(typeof mt=="object"&&mt!==null?(mt=mt.delay,mt=typeof mt=="number"&&0<mt?ei+mt:ei):mt=ei,Le){case 1:var ai=-1;break;case 2:ai=250;break;case 5:ai=1073741823;break;case 4:ai=1e4;break;default:ai=5e3}return ai=mt+ai,Le={id:B++,callback:nt,priorityLevel:Le,startTime:mt,expirationTime:ai,sortIndex:-1},mt>ei?(Le.sortIndex=mt,e(R,Le),i(A)===null&&Le===i(R)&&(se?(we(Ee),Ee=-1):se=!0,Dt(Te,mt-ei))):(Le.sortIndex=ai,e(A,Le),re||Q||(re=!0,Re||(Re=!0,ht()))),Le},t.unstable_shouldYield=Ke,t.unstable_wrapCallback=function(Le){var nt=F;return function(){var mt=F;F=nt;try{return Le.apply(this,arguments)}finally{F=mt}}}})(Bv)),Bv}var Vx;function mE(){return Vx||(Vx=1,kv.exports=pE()),kv.exports}var Nv={exports:{}},$s={};/** 26 * @license React 27 * react-dom.production.js 28 * 29 * Copyright (c) Meta Platforms, Inc. and affiliates. 30 * 31 * This source code is licensed under the MIT license found in the 32 * LICENSE file in the root directory of this source tree. 33 */var $x;function gE(){if($x)return $s;$x=1;var t=W0();function e(A){var R="https://react.dev/errors/"+A;if(1<arguments.length){R+="?args[]="+encodeURIComponent(arguments[1]);for(var B=2;B<arguments.length;B++)R+="&args[]="+encodeURIComponent(arguments[B])}return"Minified React error #"+A+"; visit "+R+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var n={d:{f:i,r:function(){throw Error(e(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},o=Symbol.for("react.portal");function d(A,R,B){var N=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:N==null?null:""+N,children:A,containerInfo:R,implementation:B}}var p=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(A,R){if(A==="font")return"";if(typeof R=="string")return R==="use-credentials"?R:""}return $s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=n,$s.createPortal=function(A,R){var B=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!R||R.nodeType!==1&&R.nodeType!==9&&R.nodeType!==11)throw Error(e(299));return d(A,R,null,B)},$s.flushSync=function(A){var R=p.T,B=n.p;try{if(p.T=null,n.p=2,A)return A()}finally{p.T=R,n.p=B,n.d.f()}},$s.preconnect=function(A,R){typeof A=="string"&&(R?(R=R.crossOrigin,R=typeof R=="string"?R==="use-credentials"?R:"":void 0):R=null,n.d.C(A,R))},$s.prefetchDNS=function(A){typeof A=="string"&&n.d.D(A)},$s.preinit=function(A,R){if(typeof A=="string"&&R&&typeof R.as=="string"){var B=R.as,N=h(B,R.crossOrigin),F=typeof R.integrity=="string"?R.integrity:void 0,Q=typeof R.fetchPriority=="string"?R.fetchPriority:void 0;B==="style"?n.d.S(A,typeof R.precedence=="string"?R.precedence:void 0,{crossOrigin:N,integrity:F,fetchPriority:Q}):B==="script"&&n.d.X(A,{crossOrigin:N,integrity:F,fetchPriority:Q,nonce:typeof R.nonce=="string"?R.nonce:void 0})}},$s.preinitModule=function(A,R){if(typeof A=="string")if(typeof R=="object"&&R!==null){if(R.as==null||R.as==="script"){var B=h(R.as,R.crossOrigin);n.d.M(A,{crossOrigin:B,integrity:typeof R.integrity=="string"?R.integrity:void 0,nonce:typeof R.nonce=="string"?R.nonce:void 0})}}else R==null&&n.d.M(A)},$s.preload=function(A,R){if(typeof A=="string"&&typeof R=="object"&&R!==null&&typeof R.as=="string"){var B=R.as,N=h(B,R.crossOrigin);n.d.L(A,B,{crossOrigin:N,integrity:typeof R.integrity=="string"?R.integrity:void 0,nonce:typeof R.nonce=="string"?R.nonce:void 0,type:typeof R.type=="string"?R.type:void 0,fetchPriority:typeof R.fetchPriority=="string"?R.fetchPriority:void 0,referrerPolicy:typeof R.referrerPolicy=="string"?R.referrerPolicy:void 0,imageSrcSet:typeof R.imageSrcSet=="string"?R.imageSrcSet:void 0,imageSizes:typeof R.imageSizes=="string"?R.imageSizes:void 0,media:typeof R.media=="string"?R.media:void 0})}},$s.preloadModule=function(A,R){if(typeof A=="string")if(R){var B=h(R.as,R.crossOrigin);n.d.m(A,{as:typeof R.as=="string"&&R.as!=="script"?R.as:void 0,crossOrigin:B,integrity:typeof R.integrity=="string"?R.integrity:void 0})}else n.d.m(A)},$s.requestFormReset=function(A){n.d.r(A)},$s.unstable_batchedUpdates=function(A,R){return A(R)},$s.useFormState=function(A,R,B){return p.H.useFormState(A,R,B)},$s.useFormStatus=function(){return p.H.useHostTransitionStatus()},$s.version="19.2.8",$s}var Hx;function _E(){if(Hx)return Nv.exports;Hx=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),Nv.exports=gE(),Nv.exports}/** 34 * @license React 35 * react-dom-client.production.js 36 * 37 * Copyright (c) Meta Platforms, Inc. and affiliates. 38 * 39 * This source code is licensed under the MIT license found in the 40 * LICENSE file in the root directory of this source tree. 41 */var Wx;function yE(){if(Wx)return Fm;Wx=1;var t=mE(),e=W0(),i=_E();function n(a){var c="https://react.dev/errors/"+a;if(1<arguments.length){c+="?args[]="+encodeURIComponent(arguments[1]);for(var m=2;m<arguments.length;m++)c+="&args[]="+encodeURIComponent(arguments[m])}return"Minified React error #"+a+"; visit "+c+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(a){return!(!a||a.nodeType!==1&&a.nodeType!==9&&a.nodeType!==11)}function d(a){var c=a,m=a;if(a.alternate)for(;c.return;)c=c.return;else{a=c;do c=a,(c.flags&4098)!==0&&(m=c.return),a=c.return;while(a)}return c.tag===3?m:null}
vendor: 12,841 bytes, lines 41-48
41function p(a){if(a.tag===13){var c=a.memoizedState;if(c===null&&(a=a.alternate,a!==null&&(c=a.memoizedState)),c!==null)return c.dehydrated}return null}function h(a){if(a.tag===31){var c=a.memoizedState;if(c===null&&(a=a.alternate,a!==null&&(c=a.memoizedState)),c!==null)return c.dehydrated}return null}function A(a){if(d(a)!==a)throw Error(n(188))}function R(a){var c=a.alternate;if(!c){if(c=d(a),c===null)throw Error(n(188));return c!==a?null:a}for(var m=a,b=c;;){var E=m.return;if(E===null)break;var I=E.alternate;if(I===null){if(b=E.return,b!==null){m=b;continue}break}if(E.child===I.child){for(I=E.child;I;){if(I===m)return A(E),a;if(I===b)return A(E),c;I=I.sibling}throw Error(n(188))}if(m.return!==b.return)m=E,b=I;else{for(var V=!1,te=E.child;te;){if(te===m){V=!0,m=E,b=I;break}if(te===b){V=!0,b=E,m=I;break}te=te.sibling}if(!V){for(te=I.child;te;){if(te===m){V=!0,m=I,b=E;break}if(te===b){V=!0,b=I,m=E;break}te=te.sibling}if(!V)throw Error(n(189))}}if(m.alternate!==b)throw Error(n(190))}if(m.tag!==3)throw Error(n(188));return m.stateNode.current===m?a:c}function B(a){var c=a.tag;if(c===5||c===26||c===27||c===6)return a;for(a=a.child;a!==null;){if(c=B(a),c!==null)return c;a=a.sibling}return null}var N=Object.assign,F=Symbol.for("react.element"),Q=Symbol.for("react.transitional.element"),re=Symbol.for("react.portal"),se=Symbol.for("react.fragment"),ae=Symbol.for("react.strict_mode"),me=Symbol.for("react.profiler"),we=Symbol.for("react.consumer"),ve=Symbol.for("react.context"),Oe=Symbol.for("react.forward_ref"),Te=Symbol.for("react.suspense"),Re=Symbol.for("react.suspense_list"),Ee=Symbol.for("react.memo"),Je=Symbol.for("react.lazy"),rt=Symbol.for("react.activity"),Ke=Symbol.for("react.memo_cache_sentinel"),Qe=Symbol.iterator;function ht(a){return a===null||typeof a!="object"?null:(a=Qe&&a[Qe]||a["@@iterator"],typeof a=="function"?a:null)}var At=Symbol.for("react.client.reference");function Fe(a){if(a==null)return null;if(typeof a=="function")return a.$$typeof===At?null:a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case se:return"Fragment";case me:return"Profiler";case ae:return"StrictMode";case Te:return"Suspense";case Re:return"SuspenseList";case rt:return"Activity"}if(typeof a=="object")switch(a.$$typeof){case re:return"Portal";case ve:return a.displayName||"Context";case we:return(a._context.displayName||"Context")+".Consumer";case Oe:var c=a.render;return a=a.displayName,a||(a=c.displayName||c.name||"",a=a!==""?"ForwardRef("+a+")":"ForwardRef"),a;case Ee:return c=a.displayName||null,c!==null?c:Fe(a.type)||"Memo";case Je:c=a._payload,a=a._init;try{return Fe(a(c))}catch{}}return null}var Dt=Array.isArray,Le=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,nt=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,mt={pending:!1,data:null,method:null,action:null},ei=[],ai=-1;function oe(a){return{current:a}}function Ue(a){0>ai||(a.current=ei[ai],ei[ai]=null,ai--)}function ut(a,c){ai++,ei[ai]=a.current,a.current=c}var Tt=oe(null),$t=oe(null),qt=oe(null),ti=oe(null);function Li(a,c){switch(ut(qt,c),ut($t,a),ut(Tt,null),c.nodeType){case 9:case 11:a=(a=c.documentElement)&&(a=a.namespaceURI)?T(a):0;break;default:if(a=c.tagName,c=c.namespaceURI)c=T(c),a=S(c,a);else switch(a){case"svg":a=1;break;case"math":a=2;break;default:a=0}}Ue(Tt),ut(Tt,a)}function ki(){Ue(Tt),Ue($t),Ue(qt)}function Er(a){a.memoizedState!==null&&ut(ti,a);var c=Tt.current,m=S(c,a.type);c!==m&&(ut($t,a),ut(Tt,m))}function Ts(a){$t.current===a&&(Ue(Tt),Ue($t)),ti.current===a&&(Ue(ti),Ju._currentValue=mt)}var ot,si;function pi(a){if(ot===void 0)try{throw Error()}catch(m){var c=m.stack.trim().match(/\n( *(at )?)/);ot=c&&c[1]||"",si=-1<m.stack.indexOf(` 42 at`)?" (<anonymous>)":-1<m.stack.indexOf("@")?"@unknown:0:0":""}return` 43`+ot+a+si}var Cn=!1;function _e(a,c){if(!a||Cn)return"";Cn=!0;var m=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var b={DetermineComponentFrameRoot:function(){try{if(c){var st=function(){throw Error()};if(Object.defineProperty(st.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(st,[])}catch(Ze){var We=Ze}Reflect.construct(a,[],st)}else{try{st.call()}catch(Ze){We=Ze}a.call(st.prototype)}}else{try{throw Error()}catch(Ze){We=Ze}(st=a())&&typeof st.catch=="function"&&st.catch(function(){})}}catch(Ze){if(Ze&&We&&typeof Ze.stack=="string")return[Ze.stack,We.stack]}return[null,null]}};b.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var E=Object.getOwnPropertyDescriptor(b.DetermineComponentFrameRoot,"name");E&&E.configurable&&Object.defineProperty(b.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var I=b.DetermineComponentFrameRoot(),V=I[0],te=I[1];if(V&&te){var xe=V.split(` 44`),$e=te.split(` 45`);for(E=b=0;b<xe.length&&!xe[b].includes("DetermineComponentFrameRoot");)b++;for(;E<$e.length&&!$e[E].includes("DetermineComponentFrameRoot");)E++;if(b===xe.length||E===$e.length)for(b=xe.length-1,E=$e.length-1;1<=b&&0<=E&&xe[b]!==$e[E];)E--;for(;1<=b&&0<=E;b--,E--)if(xe[b]!==$e[E]){if(b!==1||E!==1)do if(b--,E--,0>E||xe[b]!==$e[E]){var et=` 46`+xe[b].replace(" at new "," at ");return a.displayName&&et.includes("<anonymous>")&&(et=et.replace("<anonymous>",a.displayName)),et}while(1<=b&&0<=E);break}}}finally{Cn=!1,Error.prepareStackTrace=m}return(m=a?a.displayName||a.name:"")?pi(m):""}function Pt(a,c){switch(a.tag){case 26:case 27:case 5:return pi(a.type);case 16:return pi("Lazy");case 13:return a.child!==c&&c!==null?pi("Suspense Fallback"):pi("Suspense");case 19:return pi("SuspenseList");case 0:case 15:return _e(a.type,!1);case 11:return _e(a.type.render,!1);case 1:return _e(a.type,!0);case 31:return pi("Activity");default:return""}}function gt(a){try{var c="",m=null;do c+=Pt(a,m),m=a,a=a.return;while(a);return c}catch(b){return` 47Error generating stack: `+b.message+` 48`+b.stack}}var Ut=Object.prototype.hasOwnProperty,Ri=t.unstable_scheduleCallback,Gi=t.unstable_cancelCallback,or=t.unstable_shouldYield,vn=t.unstable_requestPaint,sn=t.unstable_now,bn=t.unstable_getCurrentPriorityLevel,lr=t.unstable_ImmediatePriority,Ss=t.unstable_UserBlockingPriority,pt=t.unstable_NormalPriority,oa=t.unstable_LowPriority,Ir=t.unstable_IdlePriority,la=t.log,Za=t.unstable_setDisableYieldValue,bt=null,ii=null;function Wt(a){if(typeof la=="function"&&Za(a),ii&&typeof ii.setStrictMode=="function")try{ii.setStrictMode(bt,a)}catch{}}var xn=Math.clz32?Math.clz32:ca,Ws=Math.log,ui=Math.LN2;function ca(a){return a>>>=0,a===0?32:31-(Ws(a)/ui|0)|0}var As=256,Xs=262144,ps=4194304;function de(a){var c=a&42;if(c!==0)return c;switch(a&-a){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return a&261888;case 262144:case 524288:case 1048576:case 2097152:return a&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return a&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return a}}function q(a,c,m){var b=a.pendingLanes;if(b===0)return 0;var E=0,I=a.suspendedLanes,V=a.pingedLanes;a=a.warmLanes;var te=b&134217727;return te!==0?(b=te&~I,b!==0?E=de(b):(V&=te,V!==0?E=de(V):m||(m=te&~a,m!==0&&(E=de(m))))):(te=b&~I,te!==0?E=de(te):V!==0?E=de(V):m||(m=b&~a,m!==0&&(E=de(m)))),E===0?0:c!==0&&c!==E&&(c&I)===0&&(I=E&-E,m=c&-c,I>=m||I===32&&(m&4194048)!==0)?c:E}function X(a,c){return(a.pendingLanes&~(a.suspendedLanes&~a.pingedLanes)&c)===0}function ie(a,c){switch(a){case 1:case 2:case 4:case 8:case 64:return c+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return c+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ue(){var a=ps;return ps<<=1,(ps&62914560)===0&&(ps=4194304),a}function Se(a){for(var c=[],m=0;31>m;m++)c.push(a);return c}function Me(a,c){a.pendingLanes|=c,c!==268435456&&(a.suspendedLanes=0,a.pingedLanes=0,a.warmLanes=0)}function ke(a,c,m,b,E,I){var V=a.pendingLanes;a.pendingLanes=m,a.suspendedLanes=0,a.pingedLanes=0,a.warmLanes=0,a.expiredLanes&=m,a.entangledLanes&=m,a.errorRecoveryDisabledLanes&=m,a.shellSuspendCounter=0;var te=a.entanglements,xe=a.expirationTimes,$e=a.hiddenUpdates;for(m=V&~m;0<m;){var et=31-xn(m),st=1<<et;te[et]=0,xe[et]=-1;var We=$e[et];if(We!==null)for($e[et]=null,et=0;et<We.length;et++){var Ze=We[et];Ze!==null&&(Ze.lane&=-536870913)}m&=~st}b!==0&&ye(a,b,0),I!==0&&E===0&&a.tag!==0&&(a.suspendedLanes|=I&~(V&~c))}function ye(a,c,m){a.pendingLanes|=c,a.suspendedLanes&=~c;var b=31-xn(c);a.entangledLanes|=c,a.entanglements[b]=a.entanglements[b]|1073741824|m&261930}function qe(a,c){var m=a.entangledLanes|=c;for(a=a.entanglements;m;){var b=31-xn(m),E=1<<b;E&c|a[b]&c&&(a[b]|=c),m&=~E}}function tt(a,c){var m=c&-c;return m=(m&42)!==0?1:je(m),(m&(a.suspendedLanes|c))!==0?0:m}function je(a){switch(a){case 2:a=1;break;case 8:a=4;break;case 32:a=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:a=128;break;case 268435456:a=134217728;break;default:a=0}return a}function yt(a){return a&=-a,2<a?8<a?(a&134217727)!==0?32:268435456:8:2}function jt(){var a=nt.p;return a!==0?a:(a=window.event,a===void 0?32:jr(a.type))}function Xt(a,c){var m=nt.p;try{return nt.p=a,c()}finally{nt.p=m}}var yi=Math.random().toString(36).slice(2),Vt="__reactFiber$"+yi,hi="__reactProps$"+yi,gi="__reactContainer$"+yi,$n="__reactEvents$"+yi,kn="__reactListeners$"+yi,vi="__reactHandles$"+yi,qi="__reactResources$"+yi,Ji="__reactMarker$"+yi;function tr(a){delete a[Vt],delete a[hi],delete a[$n],delete a[kn],delete a[vi]}function Hn(a){var c=a[Vt];if(c)return c;for(var m=a.parentNode;m;){if(c=m[gi]||m[Vt]){if(m=c.alternate,c.child!==null||m!==null&&m.child!==null)for(a=Bt(a);a!==null;){if(m=a[Vt])return m;a=Bt(a)}return c}a=m,m=a.parentNode}return null}function ir(a){if(a=a[Vt]||a[gi]){var c=a.tag;if(c===5||c===6||c===13||c===31||c===26||c===27||c===3)return a}return null}function ua(a){var c=a.tag;if(c===5||c===26||c===27||c===6)return a.stateNode;throw Error(n(33))}function Fi(a){var c=a[qi];return c||(c=a[qi]={hoistableStyles:new Map,hoistableScripts:new Map}),c}function nr(a){a[Ji]=!0}var Xc=new Set,ts={};function cr(a,c){cl(a,c),cl(a+"Capture",c)}function cl(a,c){for(ts[a]=c,a=0;a<c.length;a++)Xc.add(c[a])}var Es=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),is={},bo={};function xo(a){return Ut.call(bo,a)?!0:Ut.call(is,a)?!1:Es.test(a)?bo[a]=!0:(is[a]=!0,!1)}function Bn(a,c,m){if(xo(c))if(m===null)a.removeAttribute(c);else{switch(typeof m){case"undefined":case"function":case"symbol":a.removeAttribute(c);return;case"boolean":var b=c.toLowerCase().slice(0,5);if(b!=="data-"&&b!=="aria-"){a.removeAttribute(c);return}}a.setAttribute(c,""+m)}}function Ya(a,c,m){if(m===null)a.removeAttribute(c);else{switch(typeof m){case"undefined":case"function":case"symbol":case"boolean":a.removeAttribute(c);return}a.setAttribute(c,""+m)}}function ur(a,c,m,b){if(b===null)a.removeAttribute(m);else{switch(typeof b){case"undefined":case"function":case"symbol":case"boolean":a.removeAttribute(m);return}a.setAttributeNS(c,m,""+b)}}function Hi(a){switch(typeof a){case"bigint":case"boolean":case"number":case"string":case"undefined":return a;case"object":return a;default:return""}}function rc(a){var c=a.type;return(a=a.nodeName)&&a.toLowerCase()==="input"&&(c==="checkbox"||c==="radio")}function qs(a,c,m){var b=Object.getOwnPropertyDescriptor(a.constructor.prototype,c);if(!a.hasOwnProperty(c)&&typeof b<"u"&&typeof b.get=="function"&&typeof b.set=="function"){var E=b.get,I=b.set;return Object.defineProperty(a,c,{configurable:!0,get:function(){return E.call(this)},set:function(V){m=""+V,I.call(this,V)}}),Object.defineProperty(a,c,{enumerable:b.enumerable}),{getValue:function(){return m},setValue:function(V){m=""+V},stopTracking:function(){a._valueTracker=null,delete a[c]}}}}function sc(a){if(!a._valueTracker){var c=rc(a)?"checked":"value";a._valueTracker=qs(a,c,""+a[c])}}
vendor: 4,829 bytes, line 48
48function Cs(a){if(!a)return!1;var c=a._valueTracker;if(!c)return!0;var m=c.getValue(),b="";return a&&(b=rc(a)?a.checked?"true":"false":a.value),a=b,a!==m?(c.setValue(a),!0):!1}function qc(a){if(a=a||(typeof document<"u"?document:void 0),typeof a>"u")return null;try{return a.activeElement||a.body}catch{return a.body}}var Zc=/[\n"\\]/g;function mr(a){return a.replace(Zc,function(c){return"\\"+c.charCodeAt(0).toString(16)+" "})}function ha(a,c,m,b,E,I,V,te){a.name="",V!=null&&typeof V!="function"&&typeof V!="symbol"&&typeof V!="boolean"?a.type=V:a.removeAttribute("type"),c!=null?V==="number"?(c===0&&a.value===""||a.value!=c)&&(a.value=""+Hi(c)):a.value!==""+Hi(c)&&(a.value=""+Hi(c)):V!=="submit"&&V!=="reset"||a.removeAttribute("value"),c!=null?ac(a,V,Hi(c)):m!=null?ac(a,V,Hi(m)):b!=null&&a.removeAttribute("value"),E==null&&I!=null&&(a.defaultChecked=!!I),E!=null&&(a.checked=E&&typeof E!="function"&&typeof E!="symbol"),te!=null&&typeof te!="function"&&typeof te!="symbol"&&typeof te!="boolean"?a.name=""+Hi(te):a.removeAttribute("name")}function ji(a,c,m,b,E,I,V,te){if(I!=null&&typeof I!="function"&&typeof I!="symbol"&&typeof I!="boolean"&&(a.type=I),c!=null||m!=null){if(!(I!=="submit"&&I!=="reset"||c!=null)){sc(a);return}m=m!=null?""+Hi(m):"",c=c!=null?""+Hi(c):m,te||c===a.value||(a.value=c),a.defaultValue=c}b=b??E,b=typeof b!="function"&&typeof b!="symbol"&&!!b,a.checked=te?a.checked:!!b,a.defaultChecked=!!b,V!=null&&typeof V!="function"&&typeof V!="symbol"&&typeof V!="boolean"&&(a.name=V),sc(a)}function ac(a,c,m){c==="number"&&qc(a.ownerDocument)===a||a.defaultValue===""+m||(a.defaultValue=""+m)}function Ga(a,c,m,b){if(a=a.options,c){c={};for(var E=0;E<m.length;E++)c["$"+m[E]]=!0;for(m=0;m<a.length;m++)E=c.hasOwnProperty("$"+a[m].value),a[m].selected!==E&&(a[m].selected=E),E&&b&&(a[m].defaultSelected=!0)}else{for(m=""+Hi(m),c=null,E=0;E<a.length;E++){if(a[E].value===m){a[E].selected=!0,b&&(a[E].defaultSelected=!0);return}c!==null||a[E].disabled||(c=a[E])}c!==null&&(c.selected=!0)}}function wo(a,c,m){if(c!=null&&(c=""+Hi(c),c!==a.value&&(a.value=c),m==null)){a.defaultValue!==c&&(a.defaultValue=c);return}a.defaultValue=m!=null?""+Hi(m):""}function Yc(a,c,m,b){if(c==null){if(b!=null){if(m!=null)throw Error(n(92));if(Dt(b)){if(1<b.length)throw Error(n(93));b=b[0]}m=b}m==null&&(m=""),c=m}m=Hi(c),a.defaultValue=m,b=a.textContent,b===m&&b!==""&&b!==null&&(a.value=b),sc(a)}function Ta(a,c){if(c){var m=a.firstChild;if(m&&m===a.lastChild&&m.nodeType===3){m.nodeValue=c;return}}a.textContent=c}var oc=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function lc(a,c,m){var b=c.indexOf("--")===0;m==null||typeof m=="boolean"||m===""?b?a.setProperty(c,""):c==="float"?a.cssFloat="":a[c]="":b?a.setProperty(c,m):typeof m!="number"||m===0||oc.has(c)?c==="float"?a.cssFloat=m:a[c]=(""+m).trim():a[c]=m+"px"}function To(a,c,m){if(c!=null&&typeof c!="object")throw Error(n(62));if(a=a.style,m!=null){for(var b in m)!m.hasOwnProperty(b)||c!=null&&c.hasOwnProperty(b)||(b.indexOf("--")===0?a.setProperty(b,""):b==="float"?a.cssFloat="":a[b]="");for(var E in c)b=c[E],c.hasOwnProperty(E)&&m[E]!==b&&lc(a,E,b)}else for(var I in c)c.hasOwnProperty(I)&&lc(a,I,c[I])}function Gc(a){if(a.indexOf("-")===-1)return!1;switch(a){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Rp=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRen
48dering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),jd=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Kc(a){return jd.test(""+a)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":a}function Xr(){}var So=null;function Dr(a){return a=a.target||a.srcElement||window,a.correspondingUseElement&&(a=a.correspondingUseElement),a.nodeType===3?a.parentNode:a}var hr=null,Sa=null;function cc(a){var c=ir(a);if(c&&(a=c.stateNode)){var m=a[hi]||null;e:switch(a=c.stateNode,c.type){case"input":if(ha(a,m.value,m.defaultValue,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name),c=m.name,m.type==="radio"&&c!=null){for(m=a;m.parentNode;)m=m.parentNode;for(m=m.querySelectorAll('input[name="'+mr(""+c)+'"][type="radio"]'),c=0;c<m.length;c++){var b=m[c];if(b!==a&&b.form===a.form){var E=b[hi]||null;if(!E)throw Error(n(90));ha(b,E.value,E.defaultValue,E.defaultValue,E.checked,E.defaultChecked,E.type,E.name)}}for(c=0;c<m.length;c++)b=m[c],b.form===a.form&&Cs(b)}break e;case"textarea":wo(a,m.value,m.defaultValue);break e;case"select":c=m.value,c!=null&&Ga(a,!!m.multiple,c,!1)}}}var ul=!1;function bh(a,c,m){if(ul)return a(c,m);ul=!0;try{var b=a(c);return b}finally{if(ul=!1,(hr!==null||Sa!==null)&&(ad(),hr&&(c=hr,a=Sa,Sa=hr=null,cc(c),a)))for(c=0;c<a.length;c++)cc(a[c])}}function da(a,c){var m=a.stateNode;if(m===null)return null;var b=m[hi]||null;if(b===null)return null;m=b[c];e:switch(c){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(b=!b.disabled)||(a=a.type,b=!(a==="button"||a==="input"||a==="select"||a==="textarea")),a=!b;break e;default:a=!1}if(a)return null;if(m&&typeof m!="function")throw Error(n(231,c,typeof m));return m}var Aa=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Qc=!1;if(Aa)try{var hl={};Object.defineProperty(hl,"passive",{get:function(){Qc=!0}}),window.addEventListener("test",hl,hl),window.removeEventListener("test",hl,hl)}catch{Qc=!1}var Ka=null,xh=null,uc=null;function dl(){if(uc)return uc;var a,c=xh,m=c.length,b,E="value"in Ka?Ka.value:Ka.textContent,I=E.length;for(a=0;a<m&&c[a]===E[a];a++);var V=m-a;for(b=1;b<=V&&c[m-b]===E[I-b];b++);return uc=E.slice(a,1<b?1-b:void 0)}function fl(a){var c=a.keyCode;
vendor: 2,826 bytes, line 48
48return"charCode"in a?(a=a.charCode,a===0&&c===13&&(a=13)):a=c,a===10&&(a=13),32<=a||a===13?a:0}function Ao(){return!0}function Jc(){return!1}function Or(a){function c(m,b,E,I,V){this._reactName=m,this._targetInst=E,this.type=b,this.nativeEvent=I,this.target=V,this.currentTarget=null;for(var te in a)a.hasOwnProperty(te)&&(m=a[te],this[te]=m?m(I):I[te]);return this.isDefaultPrevented=(I.defaultPrevented!=null?I.defaultPrevented:I.returnValue===!1)?Ao:Jc,this.isPropagationStopped=Jc,this}return N(c.prototype,{preventDefault:function(){this.defaultPrevented=!0;var m=this.nativeEvent;m&&(m.preventDefault?m.preventDefault():typeof m.returnValue!="unknown"&&(m.returnValue=!1),this.isDefaultPrevented=Ao)},stopPropagation:function(){var m=this.nativeEvent;m&&(m.stopPropagation?m.stopPropagation():typeof m.cancelBubble!="unknown"&&(m.cancelBubble=!0),this.isPropagationStopped=Ao)},persist:function(){},isPersistent:Ao}),c}var kr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(a){return a.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},eu=Or(kr),Eo=N({},kr,{view:0,detail:0}),Co=Or(Eo),fa,Vi,Qa,tu=N({},Eo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Th,button:0,buttons:0,relatedTarget:function(a){return a.relatedTarget===void 0?a.fromElement===a.srcElement?a.toElement:a.fromElement:a.relatedTarget},movementX:function(a){return"movementX"in a?a.movementX:(a!==Qa&&(Qa&&a.type==="mousemove"?(fa=a.screenX-Qa.screenX,Vi=a.screenY-Qa.screenY):Vi=fa=0,Qa=a),fa)},movementY:function(a){return"movementY"in a?a.movementY:Vi}}),Ro=Or(tu),Mp=N({},tu,{dataTransfer:0}),Vd=Or(Mp),Pp=N({},Eo,{relatedTarget:0}),iu=Or(Pp),wh=N({},kr,{animationName:0,elapsedTime:0,pseudoElement:0}),$d=Or(wh),Hd=N({},kr,{clipboardData:function(a){return"clipboardData"in a?a.clipboardData:window.clipboardData}}),Wd=Or(Hd),Xd=N({},kr,{data:0}),Ja=Or(Xd),qd={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Ip={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Zd={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function hc(a){var c=this.nativeEvent;return c.getModifierState?c.getModifierState(a):(a=Zd[a])?!!c[a]:!1}function Th(){return hc}var nu=N({},Eo,{key:function(a){if(a.key){var c=qd[a.key]||a.key;if(c!=="Unidentified")return c}
vendor: 5,186 bytes, line 48
48return a.type==="keypress"?(a=fl(a),a===13?"Enter":String.fromCharCode(a)):a.type==="keydown"||a.type==="keyup"?Ip[a.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Th,charCode:function(a){return a.type==="keypress"?fl(a):0},keyCode:function(a){return a.type==="keydown"||a.type==="keyup"?a.keyCode:0},which:function(a){return a.type==="keypress"?fl(a):a.type==="keydown"||a.type==="keyup"?a.keyCode:0}}),Dp=Or(nu),Op=N({},tu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Sh=Or(Op),Yd=N({},Eo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Th}),Gd=Or(Yd),Ah=N({},kr,{propertyName:0,elapsedTime:0,pseudoElement:0}),Kd=Or(Ah),ru=N({},tu,{deltaX:function(a){return"deltaX"in a?a.deltaX:"wheelDeltaX"in a?-a.wheelDeltaX:0},deltaY:function(a){return"deltaY"in a?a.deltaY:"wheelDeltaY"in a?-a.wheelDeltaY:"wheelDelta"in a?-a.wheelDelta:0},deltaZ:0,deltaMode:0}),Ea=Or(ru),Eh=N({},kr,{newState:0,oldState:0}),Ch=Or(Eh),Rh=[9,13,27,32],pl=Aa&&"CompositionEvent"in window,Mo=null;Aa&&"documentMode"in document&&(Mo=document.documentMode);var Po=Aa&&"TextEvent"in window&&!Mo,su=Aa&&(!pl||Mo&&8<Mo&&11>=Mo),Qd=" ",Nn=!1;function Jd(a,c){switch(a){case"keyup":return Rh.indexOf(c.keyCode)!==-1;case"keydown":return c.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function bi(a){return a=a.detail,typeof a=="object"&&"data"in a?a.data:null}var Ca=!1;function fn(a,c){switch(a){case"compositionend":return bi(c);case"keypress":return c.which!==32?null:(Nn=!0,Qd);case"textInput":return a=c.data,a===Qd&&Nn?null:a;default:return null}}function en(a,c){if(Ca)return a==="compositionend"||!pl&&Jd(a,c)?(a=dl(),uc=xh=Ka=null,Ca=!1,a):null;switch(a){case"paste":return null;case"keypress":if(!(c.ctrlKey||c.altKey||c.metaKey)||c.ctrlKey&&c.altKey){if(c.char&&1<c.char.length)return c.char;if(c.which)return String.fromCharCode(c.which)}return null;case"compositionend":return su&&c.locale!=="ko"?null:c.data;default:return null}}var Io={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function ml(a){var c=a&&a.nodeName&&a.nodeName.toLowerCase();return c==="input"?!!Io[a.type]:c==="textarea"}function gl(a,c,m,b){hr?Sa?Sa.push(b):Sa=[b]:hr=b,c=fd(c,"onChange"),0<c.length&&(m=new eu("onChange","change",null,m,b),a.push({event:m,listeners:c}))}var Do=null,Zs=null;function _l(a){Of(a,0)}function qr(a){var c=ua(a);if(Cs(c))return a}function au(a,c){if(a==="change")return c}var ou=!1;if(Aa){var dc;if(Aa){var Ra="oninput"in document;if(!Ra){var yl=document.createElement("div");yl.setAttribute("oninput","return;"),Ra=typeof yl.oninput=="function"}dc=Ra}else dc=!1;ou=dc&&(!document.documentMode||9<document.documentMode)}function vl(){Do&&(Do.detachEvent("onpropertychange",Oo),Zs=Do=null)}function Oo(a){if(a.propertyName==="value"&&qr(Zs)){var c=[];gl(c,Zs,a,Dr(a)),bh(_l,c)}}function fc(a,c,m){a==="focusin"?(vl(),Do=c,Zs=m,Do.attachEvent("onpropertychange",Oo)):a==="focusout"&&vl()}function lu(a){if(a==="selectionchange"||a==="keyup"||a==="keydown")return qr(Zs)}function bl(a,c){if(a==="click")return qr(c)}function xl(a,c){if(a==="input"||a==="change")return qr(c)}function ef(a,c){return a===c&&(a!==0||1/a===1/c)||a!==a&&c!==c}var Zr=typeof Object.is=="function"?Object.is:ef;function Di(a,c){if(Zr(a,c))return!0;if(typeof a!="object"||a===null||typeof c!="object"||c===null)return!1;var m=Object.keys(a),b=Object.keys(c);if(m.length!==b.length)return!1;for(b=0;b<m.length;b++){var E=m[b];if(!Ut.call(c,E)||!Zr(a[E],c[E]))return!1}return!0}function pc(a){for(;a&&a.firstChild;)a=a.firstChild;return a}function tf(a,c){var m=pc(a);a=0;for(var b;m;){if(m.nodeType===3){if(b=a+m.textContent.length,a<=c&&b>=c)return{node:m,offset:c-a};a=b}e:{for(;m;){if(m.nextSibling){m=m.nextSibling;break e}m=m.parentNode}m=void 0}m=pc(m)}}function Mh(a,c){return a&&c?a===c?!0:a&&a.nodeType===3?!1:c&&c.nodeType===3?Mh(a,c.parentNode):"contains"in a?a.contains(c):a.compareDocumentPosition?!!(a.compareDocumentPosition(c)&16):!1:!1}function ko(a){a=a!=null&&a.ownerDocument!=null&&a.ownerDocument.defaultView!=null?a.ownerDocument.defaultView:window;for(var c=qc(a.document);c instanceof a.HTMLIFrameElement;){try{var m=typeof c.contentWindow.location.href=="string"}catch{m=!1}if(m)a=c.contentWindow;else break;c=qc(a.document)}return c}function cu(a){var c=a&&a.nodeName&&a.nodeName.toLowerCase();return c&&(c==="input"&&(a.type==="text"||a.type==="search"||a.type==="tel"||a.type==="url"||a.type==="password")||c==="textarea"||a.contentEditable==="true")}var uu=Aa&&"documentMode"in document&&11>=document.documentMode,Bo=null,hu=null,eo=null,wl=!1;function No(a,c,m){var b=m.window===m?m.document:m.nodeType===9?m:m.ownerDocument;wl||Bo==null||Bo!==qc(b)||(b=Bo,"selectionStart"in b&&cu(b)?b={start:b.selectionStart,end:b.selectionEnd}:(b=(b.ownerDocument&&b.ownerDocument.defaultView||window).getSelection(),b={anchorNode:b.anchorNode,anchorOffset:b.anchorOffset,focu
vendor: 22,898 bytes, line 48
48sNode:b.focusNode,focusOffset:b.focusOffset}),eo&&Di(eo,b)||(eo=b,b=fd(hu,"onSelect"),0<b.length&&(c=new eu("onSelect","select",null,c,m),a.push({event:c,listeners:b}),c.target=Bo)))}function Rs(a,c){var m={};return m[a.toLowerCase()]=c.toLowerCase(),m["Webkit"+a]="webkit"+c,m["Moz"+a]="moz"+c,m}var Ys={animationend:Rs("Animation","AnimationEnd"),animationiteration:Rs("Animation","AnimationIteration"),animationstart:Rs("Animation","AnimationStart"),transitionrun:Rs("Transition","TransitionRun"),transitionstart:Rs("Transition","TransitionStart"),transitioncancel:Rs("Transition","TransitionCancel"),transitionend:Rs("Transition","TransitionEnd")},mc={},zo={};Aa&&(zo=document.createElement("div").style,"AnimationEvent"in window||(delete Ys.animationend.animation,delete Ys.animationiteration.animation,delete Ys.animationstart.animation),"TransitionEvent"in window||delete Ys.transitionend.transition);function Gs(a){if(mc[a])return mc[a];if(!Ys[a])return a;var c=Ys[a],m;for(m in c)if(c.hasOwnProperty(m)&&m in zo)return mc[a]=c[m];return a}var gc=Gs("animationend"),_c=Gs("animationiteration"),du=Gs("animationstart"),kp=Gs("transitionrun"),nf=Gs("transitionstart"),fu=Gs("transitioncancel"),pu=Gs("transitionend"),Tl=new Map,Lo="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Lo.push("scrollEnd");function wn(a,c){Tl.set(a,c),cr(c,[a])}var pa=typeof reportError=="function"?reportError:function(a){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var c=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof a=="object"&&a!==null&&typeof a.message=="string"?String(a.message):String(a),error:a});if(!window.dispatchEvent(c))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",a);return}console.error(a)},ms=[],Fo=0,Rn=0;function ns(){for(var a=Fo,c=Rn=Fo=0;c<a;){var m=ms[c];ms[c++]=null;var b=ms[c];ms[c++]=null;var E=ms[c];ms[c++]=null;var I=ms[c];if(ms[c++]=null,b!==null&&E!==null){var V=b.pending;V===null?E.next=E:(E.next=V.next,V.next=E),b.pending=E}I!==0&&yc(m,E,I)}}function Br(a,c,m,b){ms[Fo++]=a,ms[Fo++]=c,ms[Fo++]=m,ms[Fo++]=b,Rn|=b,a.lanes|=b,a=a.alternate,a!==null&&(a.lanes|=b)}function Uo(a,c,m,b){return Br(a,c,m,b),Pa(a)}function Ma(a,c){return Br(a,null,null,c),Pa(a)}function yc(a,c,m){a.lanes|=m;var b=a.alternate;b!==null&&(b.lanes|=m);for(var E=!1,I=a.return;I!==null;)I.childLanes|=m,b=I.alternate,b!==null&&(b.childLanes|=m),I.tag===22&&(a=I.stateNode,a===null||a._visibility&1||(E=!0)),a=I,I=I.return;return a.tag===3?(I=a.stateNode,E&&c!==null&&(E=31-xn(m),a=I.hiddenUpdates,b=a[E],b===null?a[E]=[c]:b.push(c),c.lane=m|536870912),I):null}function Pa(a){if(50<Hl)throw Hl=0,sd=null,Error(n(185));for(var c=a.return;c!==null;)a=c,c=a.return;return a.tag===3?a.stateNode:null}var rs={};function Ph(a,c,m,b){this.tag=a,this.key=m,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=c,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=b,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Nr(a,c,m,b){return new Ph(a,c,m,b)}function vc(a){return a=a.prototype,!(!a||!a.isReactComponent)}function Ms(a,c){var m=a.alternate;return m===null?(m=Nr(a.tag,c,a.key,a.mode),m.elementType=a.elementType,m.type=a.type,m.stateNode=a.stateNode,m.alternate=a,a.alternate=m):(m.pendingProps=c,m.type=a.type,m.flags=0,m.subtreeFlags=0,m.deletions=null),m.flags=a.flags&65011712,m.childLanes=a.childLanes,m.lanes=a.lanes,m.child=a.child,m.memoizedProps=a.memoizedProps,m.memoizedState=a.memoizedState,m.updateQueue=a.updateQueue,c=a.dependencies,m.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext},m.sibling=a.sibling,m.index=a.index,m.ref=a.ref,m.refCleanup=a.refCleanup,m}function mu(a,c){a.flags&=65011714;var m=a.alternate;return m===null?(a.childLanes=0,a.lanes=c,a.child=null,a.subtreeFlags=0,a.memoizedProps=null,a.memoizedState=null,a.updateQueue=null,a.dependencies=null,a.stateNode=null):(a.childLanes=m.childLanes,a.lanes=m.lanes,a.child=m.child,a.subtreeFlags=0,a.deletions=null,a.memoizedProps=m.memoizedProps,a.memoizedState=m.memoizedState,a.updateQueue=m.updateQueue,a.type=m.type,c=m.dependencies,a.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext}),a}function Sl(a,c,m,b,E,I){var V=0;if(b=a,typeof a=="function")vc(a)&&(V=1);else if(typeof a=="string")V=sa(a,m,Tt.current)?26:a==="html"||a==="head"||a==="body"?27:5;else e:switch(a){case rt:return a=Nr(31,m,c,E),a.elementType=rt,a.lanes=I,a;case se:return gs(m.children,E,I,c);case ae:V=8,E|=24;break;case me:return a=Nr(12,m,c,E|2),a.elementType=me,a.lanes=I,a;case Te:return a=Nr(13,m,c,E),a.elementType=Te,a.lanes=I,a;case Re:return a=Nr(19,m,c,E),a.elementType=Re,a.lanes=I,a;default:if(typeof a=="object"&&a!==null)switch(a.$$typeof){case ve:V=10;break e;case we:V=9;break e;case Oe:V=11;break e;case Ee:V=14;break e;case Je:V=16,b=null;break e}V=29,m=Error(n(130,a===null?"null":typeof a,"")),b=null}return c=Nr(V,m,c,E),c.elementType=a,c.type=b,c.lanes=I,c}function gs(a,c,m,b){return a=Nr(7,a,b,c),a.lanes=m,a}function Al(a,c,m){return a=Nr(6,a,null,c),a.lanes=m,a}function El(a){var c=Nr(18,null,null,0);return c.stateNode=a,c}function bc(a,c,m){return c=Nr(4,a.children!==null?a.children:[],a.key,c),c.lanes=m,c.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation},c}var gu=new WeakMap;function ss(a,c){if(typeof a=="object"&&a!==null){var m=gu.get(a);return m!==void 0?m:(c={value:a,source:c,stack:gt(c)},gu.set(a,c),c)}return{value:a,source:c,stack:gt(c)}}var to=[],Ia=0,io=null,Cl=0,zn=[],Gn=0,ma=null,rr=1,zr="";function Da(a,c){to[Ia++]=Cl,to[Ia++]=io,io=a,Cl=c}function rf(a,c,m){zn[Gn++]=rr,zn[Gn++]=zr,zn[Gn++]=ma,ma=a;var b=rr;a=zr;var E=32-xn(b)-1;b&=~(1<<E),m+=1;var I=32-xn(c)+E;if(30<I){var V=E-E%5;I=(b&(1<<V)-1).toString(32),b>>=V,E-=V,rr=1<<32-xn(c)+E|m<<E|b,zr=I+a}else rr=1<<I|m<<E|b,zr=a}function _u(a){a.return!==null&&(Da(a,1),rf(a,1,0))}function yu(a){for(;a===io;)io=to[--Ia],to[Ia]=null,Cl=to[--Ia],to[Ia]=null;for(;a===ma;)ma=zn[--Gn],zn[Gn]=null,zr=zn[--Gn],zn[Gn]=null,rr=zn[--Gn],zn[Gn]=null}function vu(a,c){zn[Gn++]=rr,zn[Gn++]=zr,zn[Gn++]=ma,rr=c.id,zr=c.overflow,ma=a}var Wn=null,Bi=null,lt=!1,Ks=null,as=!1,bu=Error(n(519));function _s(a){var c=Error(n(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Vo(ss(c,a)),bu}function jo(a){var c=a.stateNode,m=a.type,b=a.memoizedProps;switch(c[Vt]=a,c[hi]=b,m){case"dialog":Ui("cancel",c),Ui("close",c);break;case"iframe":case"object":case"embed":Ui("load",c);break;case"video":case"audio":for(m=0;m<Yu.length;m++)Ui(Yu[m],c);break;case"source":Ui("error",c);break;case"img":case"image":case"link":Ui("error",c),Ui("load",c);break;case"details":Ui("toggle",c);break;case"input":Ui("invalid",c),ji(c,b.value,b.defaultValue,b.checked,b.defaultChecked,b.type,b.name,!0);break;case"select":Ui("invalid",c);break;case"textarea":Ui("invalid",c),Yc(c,b.value,b.defaultValue,b.children)}m=b.children,typeof m!="string"&&typeof m!="number"&&typeof m!="bigint"||c.textContent===""+m||b.suppressHydrationWarning===!0||Gu(c.textContent,m)?(b.popover!=null&&(Ui("beforetoggle",c),Ui("toggle",c)),b.onScroll!=null&&Ui("scroll",c),b.onScrollEnd!=null&&Ui("scrollend",c),b.onClick!=null&&(c.onclick=Xr),c=!0):c=!1,c||_s(a,!0)}function xu(a){for(Wn=a.return;Wn;)switch(Wn.tag){case 5:case 31:case 13:as=!1;return;case 27:case 3:as=!0;return;default:Wn=Wn.return}}function _i(a){if(a!==Wn)return!1;if(!lt)return xu(a),lt=!0,!1;var c=a.tag,m;if((m=c!==3&&c!==27)&&((m=c===5)&&(m=a.type,m=!(m!=="form"&&m!=="button")||C(a.type,a.memoizedProps)),m=!m),m&&Bi&&_s(a),xu(a),c===13){if(a=a.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(n(317));Bi=Lt(a)}else if(c===31){if(a=a.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(n(317));Bi=Lt(a)}else c===27?(c=Bi,J(a.type)?(a=St,St=null,Bi=a):Bi=c):Bi=Wn?_t(a.stateNode.nextSibling):null;return!0}function Oa(){Bi=Wn=null,lt=!1}function Ih(){var a=Ks;return a!==null&&(vs===null?vs=a:vs.push.apply(vs,a),Ks=null),a}function Vo(a){Ks===null?Ks=[a]:Ks.push(a)}var Dh=oe(null),Ps=null,ga=null;function _a(a,c,m){ut(Dh,c._currentValue),c._currentValue=m}function ya(a){a._currentValue=Dh.current,Ue(Dh)}function Oh(a,c,m){for(;a!==null;){var b=a.alternate;if((a.childLanes&c)!==c?(a.childLanes|=c,b!==null&&(b.childLanes|=c)):b!==null&&(b.childLanes&c)!==c&&(b.childLanes|=c),a===m)break;a=a.return}}function xc(a,c,m,b){var E=a.child;for(E!==null&&(E.return=a);E!==null;){var I=E.dependencies;if(I!==null){var V=E.child;I=I.firstContext;e:for(;I!==null;){var te=I;I=E;for(var xe=0;xe<c.length;xe++)if(te.context===c[xe]){I.lanes|=m,te=I.alternate,te!==null&&(te.lanes|=m),Oh(I.return,m,a),b||(V=null);break e}I=te.next}}else if(E.tag===18){if(V=E.return,V===null)throw Error(n(341));V.lanes|=m,I=V.alternate,I!==null&&(I.lanes|=m),Oh(V,m,a),V=null}else V=E.child;if(V!==null)V.return=E;else for(V=E;V!==null;){if(V===a){V=null;break}if(E=V.sibling,E!==null){E.return=V.return,V=E;break}V=V.return}E=V}}function Rl(a,c,m,b){a=null;for(var E=c,I=!1;E!==null;){if(!I){if((E.flags&524288)!==0)I=!0;else if((E.flags&262144)!==0)break}if(E.tag===10){var V=E.alternate;if(V===null)throw Error(n(387));if(V=V.memoizedProps,V!==null){var te=E.type;Zr(E.pendingProps.value,V.value)||(a!==null?a.push(te):a=[te])}}else if(E===ti.current){if(V=E.alternate,V===null)throw Error(n(387));V.memoizedState.memoizedState!==E.memoizedState.memoizedState&&(a!==null?a.push(Ju):a=[Ju])}E=E.return}a!==null&&xc(c,a,m,b),c.flags|=262144}function wu(a){for(a=a.firstContext;a!==null;){if(!Zr(a.context._currentValue,a.memoizedValue))return!0;a=a.next}return!1}function dr(a){Ps=a,ga=null,a=a.dependencies,a!==null&&(a.firstContext=null)}function xi(a){return wc(Ps,a)}function ka(a,c){return Ps===null&&dr(a),wc(a,c)}function wc(a,c){var m=c._currentValue;if(c={context:c,memoizedValue:m,next:null},ga===null){if(a===null)throw Error(n(308));ga=c,a.dependencies={lanes:0,firstContext:c},a.flags|=524288}else ga=ga.next=c;return m}var Tu=typeof AbortController<"u"?AbortController:function(){var a=[],c=this.signal={aborted:!1,addEventListener:function(m,b){a.push(b)}};this.abort=function(){c.aborted=!0,a.forEach(function(m){return m()})}},sf=t.unstable_scheduleCallback,Tc=t.unstable_NormalPriority,Mn={$$typeof:ve,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Is(){return{controller:new Tu,data:new Map,refCount:0}}function Ba(a){a.refCount--,a.refCount===0&&sf(Tc,function(){a.controller.abort()})}var Nt=null,Zt=0,Na=0,za=null;function kh(a,c){if(Nt===null){var m=Nt=[];Zt=0,Na=Zu(),za={status:"pending",value:void 0,then:function(b){m.push(b)}}}return Zt++,c.then(w,w),c}function w(){if(--Zt===0&&Nt!==null){za!==null&&(za.status="fulfilled");var a=Nt;Nt=null,Na=0,za=null;for(var c=0;c<a.length;c++)(0,a[c])()}}function r(a,c){var m=[],b={status:"pending",value:null,reason:null,then:function(E){m.push(E)}};return a.then(function(){b.status="fulfilled",b.value=c;for(var E=0;E<m.length;E++)(0,m[E])(c)},function(E){for(b.status="rejected",b.reason=E,E=0;E<m.length;E++)(0,m[E])(void 0)}),b}var f=Le.S;Le.S=function(a,c){i_=sn(),typeof c=="object"&&c!==null&&typeof c.then=="function"&&kh(a,c),f!==null&&f(a,c)};var _=oe(null);function y(){var a=_.current;return a!==null?a:Sn.pooledCache}function x(a,c){c===null?ut(_,_.current):ut(_,c.pool)}function M(){var a=y();return a===null?null:{parent:Mn._currentValue,pool:a}}var D=Error(n(460)),O=Error(n(474)),L=Error(n(542)),$={then:function(){}};function H(a){return a=a.status,a==="fulfilled"||a==="rejected"}function G(a,c,m){switch(m=a[m],m===void 0?a.push(c):m!==c&&(c.then(Xr,Xr),c=m),c.status){case"fulfilled":return c.value;case"rejected":throw a=c.reason,pe(a),a;default:if(typeof c.status=="string")c.then(Xr,Xr);else{if(a=Sn,a!==null&&100<a.shellSuspendCounter)throw Error(n(482));a=c,a.status="pending",a.then(function(b){if(c.status==="pending"){var E=c;E.status="fulfilled",E.value=b}},function(b){if(c.status==="pending"){var E=c;E.status="rejected",E.reason=b}})}switch(c.status){case"fulfilled":return c.value;case"rejected":throw a=c.reason,pe(a),a}throw ne=c,D}}function ee(a){try{var c=a._init;return c(a._payload)}catch(m){throw m!==null&&typeof m=="object"&&typeof m.then=="function"?(ne=m,D):m}}var ne=null;function he(){if(ne===null)throw Error(n(459));var a=ne;return ne=null,a}function pe(a){if(a===D||a===L)throw Error(n(483))}var ge=null,be=0;function le(a){var c=be;return be+=1,ge===null&&(ge=[]),G(ge,a,c)}function Ce(a,c){c=c.props.ref,a.ref=c!==void 0?c:null}function Ie(a,c){throw c.$$typeof===F?Error(n(525)):(a=Object.prototype.toString.call(c),Error(n(31,a==="[object Object]"?"object with keys {"+Object.keys(c).join(", ")+"}":a)))}function ze(a){function c(Ne,Pe){if(a){var Ve=Ne.deletions;Ve===null?(Ne.deletions=[Pe],Ne.flags|=16):Ve.push(Pe)}}function m(Ne,Pe){if(!a)return null;for(;Pe!==null;)c(Ne,Pe),Pe=Pe.sibling;return null}function b(Ne){for(var Pe=new Map;Ne!==null;)Ne.key!==null?Pe.set(Ne.key,Ne):Pe.set(Ne.index,Ne),Ne=Ne.sibling;return Pe}function E(Ne,Pe){return Ne=Ms(Ne,Pe),Ne.index=0,Ne.sibling=null,Ne}function I(Ne,Pe,Ve){return Ne.index=Ve,a?(Ve=Ne.alternate,Ve!==null?(Ve=Ve.index,Ve<Pe?(Ne.flags|=67108866,Pe):Ve):(Ne.flags|=67108866,Pe)):(Ne.flags|=1048576,Pe)}function V(Ne){return a&&Ne.alternate===null&&(Ne.flags|=67108866),Ne}function te(Ne,Pe,Ve,it){return Pe===null||Pe.tag!==6?(Pe=Al(Ve,Ne.mode,it),Pe.return=Ne,Pe):(Pe=E(Pe,Ve),Pe.return=Ne,Pe)}function xe(Ne,Pe,Ve,it){var li=Ve.type;return li===se?et(Ne,Pe,Ve.props.children,it,Ve.key):Pe!==null&&(Pe.elementType===li||typeof li=="object"&&li!==null&&li.$$typeof===Je&&ee(li)===Pe.type)?(Pe=E(Pe,Ve.props),Ce(Pe,Ve),Pe.return=Ne,Pe):(Pe=Sl(Ve.type,Ve.key,Ve.props,null,Ne.mode,it),Ce(Pe,Ve),Pe.return=Ne,Pe)}function $e(Ne,Pe,Ve,it){return Pe===null||Pe.tag!==4||Pe.stateNode.containerInfo!==Ve.containerInfo||Pe.stateNode.implementation!==Ve.implementation?(Pe=bc(Ve,Ne.mode,it),Pe.return=Ne,Pe):(Pe=E(Pe,Ve.children||[]),Pe.return=Ne,Pe)}function et(Ne,Pe,Ve,it,li){return Pe===null||Pe.tag!==7?(Pe=gs(Ve,Ne.mode,it,li),Pe.return=Ne,Pe):(Pe=E(Pe,Ve),Pe.return=Ne,Pe)}function st(Ne,Pe,Ve){if(typeof Pe=="string"&&Pe!==""||typeof Pe=="number"||typeof Pe=="bigint")return Pe=Al(""+Pe,Ne.mode,Ve),Pe.return=Ne,Pe;if(typeof Pe=="object"&&Pe!==null){switch(Pe.$$typeof){case Q:return Ve=Sl(Pe.type,Pe.key,Pe.props,null,Ne.mode,Ve),Ce(Ve,Pe),Ve.return=Ne,Ve;case re:return Pe=bc(Pe,Ne.mode,Ve),Pe.return=Ne,Pe;case Je:return Pe=ee(Pe),st(Ne,Pe,Ve)}if(Dt(Pe)||ht(Pe))return Pe=gs(Pe,Ne.mode,Ve,null),Pe.return=Ne,Pe;if(typeof Pe.then=="function")return st(Ne,le(Pe),Ve);if(Pe.$$typeof===ve)return st(Ne,ka(Ne,Pe),Ve);Ie(Ne,Pe)}return null}function We(Ne,Pe,Ve,it){var li=Pe!==null?Pe.key:null;if(typeof Ve=="string"&&Ve!==""||typeof Ve=="number"||typeof Ve=="bigint")return li!==null?null:te(Ne,Pe,""+Ve,it);if(typeof Ve=="object"&&Ve!==null){switch(Ve.$$typeof){case Q:return Ve.key===li?xe(Ne,Pe,Ve,it):null;case re:return Ve.key===li?$e(Ne,Pe,Ve,it):null;case Je:return Ve=ee(Ve),We(Ne,Pe,Ve,it)}if(Dt(Ve)||ht(Ve))return li!==null?null:et(Ne,Pe,Ve,it,null);if(typeof Ve.then=="function")return We(Ne,Pe,le(Ve),it);if(Ve.$$typeof===ve)return We(Ne,Pe,ka(Ne,Ve),it);Ie(Ne,Ve)}return null}function Ze(Ne,Pe,Ve,it,li){if(typeof it=="string"&&it!==""||typeof it=="number"||typeof it=="bigint")return Ne=Ne.get(Ve)||null,te(Pe,Ne,""+it,li);if(typeof it=="object"&&it!==null){switch(it.$$typeof){case Q:return Ne=Ne.get(it.key===null?Ve:it.key)||null,xe(Pe,Ne,it,li);case re:return Ne=Ne.get(it.key===null?Ve:it.key)||null,$e(Pe,Ne,it,li);case Je:return it=ee(it),Ze(Ne,Pe,Ve,it,li)}if(Dt(it)||ht(it))return Ne=Ne.get(Ve)||null,et(Pe,Ne,it,li,null);if(typeof it.then=="function")return Ze(Ne,Pe,Ve,le(it),li);if(it.$$typeof===ve)return Ze(Ne,Pe,Ve,ka(Pe,it),li);Ie(Pe,it)}return null}function Ht(Ne,Pe,Ve,it){for(var li=null,un=null,Kt=Pe,Oi=Pe=0,Xi=null;Kt!==null&&Oi<Ve.length;Oi++){Kt.index>Oi?(Xi=Kt,Kt=null):Xi=Kt.sibling;var hn=We(Ne,Kt,Ve[Oi],it);if(hn===null){Kt===null&&(Kt=Xi);break}a&&Kt&&hn.alternate===null&&c(Ne,Kt),Pe=I(hn,Pe,Oi),un===null?li=hn:un.sibling=hn,un=hn,Kt=Xi}if(Oi===Ve.length)return m(Ne,Kt),lt&&Da(Ne,Oi),li;if(Kt===null){for(;Oi<Ve.length;Oi++)Kt=st(Ne,Ve[Oi],it),Kt!==null&&(Pe=I(Kt,Pe,Oi),un===null?li=Kt:un.sibling=Kt,un=Kt);return lt&&Da(Ne,Oi),li}for(Kt=b(Kt);Oi<Ve.length;Oi++)Xi=Ze(Kt,Ne,Oi,Ve[Oi],it),Xi!==null&&(a&&Xi.alternate!==null&&Kt.delete(Xi.key===null?Oi:Xi.key),Pe=I(Xi,Pe,Oi),un===null?li=Xi:un.sibling=Xi,un=Xi);return a&&Kt.forEach(function(th){return c(Ne,th)}),lt&&Da(Ne,Oi),li}function fi(Ne,Pe,Ve,it){if(Ve==null)throw Error(n(151));for(var li=null,un=null,Kt=Pe,Oi=Pe=0,Xi=null,hn=Ve.next();Kt!==null&&!hn.done;Oi++,hn=Ve.next()){Kt.index>Oi?(Xi=Kt,Kt=null):Xi=Kt.sibling;var th=We(Ne,Kt,hn.value,it);if(th===null){Kt===null&&(Kt=Xi);break}a&&Kt&&th.alternate===null&&c(Ne,Kt),Pe=I(th,Pe,Oi),un===null?li=th:un.sibling=th,un=th,Kt=Xi}if(hn.done)return m(Ne,Kt),lt&&Da(Ne,Oi),li;if(Kt===null){for(;!hn.done;Oi++,hn=Ve.next())hn=st(Ne,hn.value,it),hn!==null&&(Pe=I(hn,Pe,Oi),un===null?li=hn:un.sibling=hn,un=hn);return lt&&Da(Ne,Oi),li}for(Kt=b(Kt);!hn.done;Oi++,hn=Ve.next())hn=Ze(Kt,Ne,Oi,hn.value,it),hn!==null&&(a&&hn.alternate!==null&&Kt.delete(hn.key===null?Oi:hn.key),Pe=I(hn,Pe,Oi),un===null?li=hn:un.sibling=hn,un=hn);return a&&Kt.forEach(function(lE){return c(Ne,lE)}),lt&&Da(Ne,Oi),li}function Pn(Ne,Pe,Ve,it){if(typeof Ve=="object"&&Ve!==null&&Ve.type===se&&Ve.key===null&&(Ve=Ve.props.children),typeof Ve=="object"&&Ve!==null){switch(Ve.$$typeof){case Q:e:{for(var li=Ve.key;Pe!==null;){if(Pe.key===li){if(li=Ve.type,li===se){if(Pe.tag===7){m(Ne,Pe.sibling),it=E(Pe,Ve.props.children),it.return=Ne,Ne=it;break e}}else if(Pe.elementType===li||typeof li=="object"&&li!==null&&li.$$typeof===Je&&ee(li)===Pe.type){m(Ne,Pe.sibling),it=E(Pe,Ve.props),Ce(it,Ve),it.return=Ne,Ne=it;break e}m(Ne,Pe);break}else c(Ne,Pe);Pe=Pe.sibling}Ve.type===se?(it=gs(Ve.props.children,Ne.mode,it,Ve.key),it.return=Ne,Ne=it):(it=Sl(Ve.type,Ve.key,Ve.props,null,Ne.mode,it),Ce(it,Ve),it.return=Ne,Ne=it)}return V(Ne);case re:e:{for(li=Ve.key;Pe!==null;){if(Pe.key===li)if(Pe.tag===4&&Pe.stateNode.containerInfo===Ve.containerInfo&&Pe.stateNode.implementation===Ve.implementation){m(Ne,Pe.sibling),it=E(Pe,Ve.children||[]),it.return=Ne,Ne=it;break e}else{m(Ne,Pe);break}else c(Ne,Pe);Pe=Pe.sibling}it=bc(Ve,Ne.mode,it),it.return=Ne,Ne=it}return V(Ne);case Je:return Ve=ee(Ve),Pn(Ne,Pe,Ve,it)}if(Dt(Ve))return Ht(Ne,Pe,Ve,it);if(ht(Ve)){if(li=ht(Ve),typeof li!="function")throw Error(n(150));return Ve=li.call(Ve),fi(Ne,Pe,Ve,it)}if(typeof Ve.then=="function")return Pn(Ne,Pe,le(Ve),it);if(Ve.$$typeof===ve)return Pn(Ne,Pe,ka(Ne,Ve),it);Ie(Ne,Ve)}return typeof Ve=="string"&&Ve!==""||typeof Ve=="number"||typeof Ve=="bigint"?(Ve=""+Ve,Pe!==null&&Pe.tag===6?(m(Ne,Pe.sibling),it=E(Pe,Ve),it.return=Ne,Ne=it):(m(Ne,Pe),it=Al(Ve,Ne.mode,it),it.return=Ne,Ne=it),V(Ne)):m(Ne,Pe)}return function(Ne,Pe,Ve,it){try{be=0;var li=Pn(Ne,Pe,Ve,it);return ge=null,li}catch(Kt){if(Kt===D||Kt===L)throw Kt;var un=Nr(29,Kt,null,Ne.mode);return un.lanes=it,un.return=Ne,un}finally{}}}var Ge=ze(!0),dt=ze(!1),vt=!1;function Mt(a){a.updateQueue={baseState:a.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function xt(a,c){a=a.updateQueue,c.updateQueue===a&&(c.updateQueue={baseState:a.baseState,firstBaseUpdate:a.firstBaseUpdate,lastBaseUpdate:a.lastBaseUpdate,shared:a.shared,callbacks:null})}function ft(a){return{lane:a,tag:0,payload:null,callback:null,next:null}}function Ot(a,c,m){var b=a.updateQueue;if(b===null)return null;if(b=b.shared,(Qi&2)!==0){var E=b.pending;return E===null?c.next=c:(c.next=E.next,E.next=c),b.pending=c,c=Pa(a),yc(a,null,m),c}return Br(a,b,c,m),Pa(a)}function ni(a,c,m){if(c=c.updateQueue,c!==null&&(c=c.shared,(m&4194048)!==0)){var b=c.lanes;b&=a.pendingLanes,m|=b,c.lanes=m,qe(a,m)}}function wt(a,c){var m=a.updateQueue,b=a.alternate;if(b!==null&&(b=b.updateQueue,m===b)){var E=null,I=null;if(m=m.firstBaseUpdate,m!==null){do{var V={lane:m.lane,tag:m.tag,payload:m.payload,callback:null,next:null};I===null?E=I=V:I=I.next=V,m=m.next}while(m!==null);I===null?E=I=c:I=I.next=c}else E=I=c;m={baseState:b.baseState,firstBaseUpdate:E,lastBaseUpdate:I,shared:b.shared,callbacks:b.callbacks},a.updateQueue=m;return}a=m.lastBaseUpdate,a===null?m.firstBaseUpdate=c:a.next=c,m.lastBaseUpdate=c}var Ct=!1;function Qt(){if(Ct){var a=za;if(a!==null)throw a}}function Ki(a,c,m,b){Ct=!1;var E=a.updateQueue;vt=!1;var I=E.firstBaseUpdate,V=E.lastBaseUpdate,te=E.shared.pending;if(te!==null){E.shared.pending=null;var xe=te,$e=xe.next;xe.next=null,V===null?I=$e:V.next=$e,V=xe;var et=a.alternate;et!==null&&(et=et.updateQueue,te=et.lastBaseUpdate,te!==V&&(te===null?et.firstBaseUpdate=$e:te.next=$e,et.lastBaseUpdate=xe))}if(I!==null){var st=E.baseState;V=0,et=$e=xe=null,te=I;do{var We=te.lane&-536870913,Ze=We!==te.lane;if(Ze?(Ni&We)===We:(b&We)===We){We!==0&&We===Na&&(Ct=!0),et!==null&&(et=et.next={lane:0,tag:te.tag,payload:te.payload,callback:null,next:null});e:{var Ht=a,fi=te;We=c;var Pn=m;switch(fi.tag){case 1:if(Ht=fi.payload,typeof Ht=="function"){st=Ht.call(Pn,st,We);break e}st=Ht;break e;case 3:Ht.flags=Ht.flags&-65537|128;case 0:if(Ht=fi.payload,We=typeof Ht=="function"?Ht.call(Pn,st,We):Ht,We==null)break e;st=N({},st,We);break e;case 2:vt=!0}}We=te.callback,We!==null&&(a.flags|=64,Ze&&(a.flags|=8192),Ze=E.callbacks,Ze===null?E.callbacks=[We]:Ze.push(We))}else Ze={lane:We,tag:te.tag,payload:te.payload,callback:te.callback,next:null},et===null?($e=et=Ze,xe=st):et=et.next=Ze,V|=We;if(te=te.next,te===null){if(te=E.shared.pending,te===null)break;Ze=te,te=Ze.next,Ze.next=null,E.lastBaseUpdate=Ze,E.shared.pending=null}}while(!0);et===null&&(xe=st),E.baseState=xe,E.firstBaseUpdate=$e,E.lastBaseUpdate=et,I===null&&(E.shared.lanes=0),$l|=V,a.lanes=V,a.memoizedState=st}}function mi(a,c){if(typeof a!="function")throw Error(n(191,a));a.call(c)}function Si(a,c){var m=a.callbacks;
vendor: 5,055 bytes, line 48
48if(m!==null)for(a.callbacks=null,a=0;a<m.length;a++)mi(m[a],c)}var Zi=oe(null),fr=oe(0);function Ds(a,c){a=wa,ut(fr,a),ut(Zi,c),wa=a|c.baseLanes}function an(){ut(fr,wa),ut(Zi,Zi.current)}function Lr(){wa=fr.current,Ue(Zi),Ue(fr)}var pn=oe(null),mn=null;function Xn(a){var c=a.alternate;ut(Wi,Wi.current&1),ut(pn,a),mn===null&&(c===null||Zi.current!==null||c.memoizedState!==null)&&(mn=a)}function Os(a){ut(Wi,Wi.current),ut(pn,a),mn===null&&(mn=a)}function $o(a){a.tag===22?(ut(Wi,Wi.current),ut(pn,a),mn===null&&(mn=a)):Qs()}function Qs(){ut(Wi,Wi.current),ut(pn,pn.current)}function gr(a){Ue(pn),mn===a&&(mn=null),Ue(Wi)}var Wi=oe(0);function Ho(a){for(var c=a;c!==null;){if(c.tag===13){var m=c.memoizedState;if(m!==null&&(m=m.dehydrated,m===null||ct(m)||Rt(m)))return c}else if(c.tag===19&&(c.memoizedProps.revealOrder==="forwards"||c.memoizedProps.revealOrder==="backwards"||c.memoizedProps.revealOrder==="unstable_legacy-backwards"||c.memoizedProps.revealOrder==="together")){if((c.flags&128)!==0)return c}else if(c.child!==null){c.child.return=c,c=c.child;continue}if(c===a)break;for(;c.sibling===null;){if(c.return===null||c.return===a)return null;c=c.return}c.sibling.return=c.return,c=c.sibling}return null}var Js=0,oi=null,Mi=null,gn=null,os=!1,qn=!1,Zn=!1,Fr=0,wi=0,ks=null,Ml=0;function _n(){throw Error(n(321))}function Su(a,c){if(c===null)return!1;for(var m=0;m<c.length&&m<a.length;m++)if(!Zr(a[m],c[m]))return!1;return!0}function Bh(a,c,m,b,E,I){return Js=I,oi=c,c.memoizedState=null,c.updateQueue=null,c.lanes=0,Le.H=a===null||a.memoizedState===null?Og:Kp,Zn=!1,I=m(b,E),Zn=!1,qn&&(I=La(c,m,b,E)),Nh(a),I}function Nh(a){Le.H=$h;var c=Mi!==null&&Mi.next!==null;if(Js=0,gn=Mi=oi=null,os=!1,wi=0,ks=null,c)throw Error(n(300));a===null||Qn||(a=a.dependencies,a!==null&&wu(a)&&(Qn=!0))}function La(a,c,m,b){oi=a;var E=0;do{if(qn&&(ks=null),wi=0,qn=!1,25<=E)throw Error(n(301));if(E+=1,gn=Mi=null,a.updateQueue!=null){var I=a.updateQueue;I.lastEffect=null,I.events=null,I.stores=null,I.memoCache!=null&&(I.memoCache.index=0)}Le.H=Qp,I=c(m,b)}while(qn);return I}function af(){var a=Le.H,c=a.useState()[0];return c=typeof c.then=="function"?Dl(c):c,a=a.useState()[0],(Mi!==null?Mi.memoizedState:null)!==a&&(oi.flags|=1024),c}function Pl(){var a=Fr!==0;return Fr=0,a}function Wo(a,c,m){c.updateQueue=a.updateQueue,c.flags&=-2053,a.lanes&=~m}function Il(a){if(os){for(a=a.memoizedState;a!==null;){var c=a.queue;c!==null&&(c.pending=null),a=a.next}os=!1}Js=0,gn=Mi=oi=null,qn=!1,wi=Fr=0,ks=null}function _r(){var a={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return gn===null?oi.memoizedState=gn=a:gn=gn.next=a,gn}function Tn(){if(Mi===null){var a=oi.alternate;a=a!==null?a.memoizedState:null}else a=Mi.next;var c=gn===null?oi.memoizedState:gn.next;if(c!==null)gn=c,Mi=a;else{if(a===null)throw oi.alternate===null?Error(n(467)):Error(n(310));Mi=a,a={memoizedState:Mi.memoizedState,baseState:Mi.baseState,baseQueue:Mi.baseQueue,queue:Mi.queue,next:null},gn===null?oi.memoizedState=gn=a:gn=gn.next=a}return gn}function no(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Dl(a){var c=wi;return wi+=1,ks===null&&(ks=[]),a=G(ks,a,c),c=oi,(gn===null?c.memoizedState:gn.next)===null&&(c=c.alternate,Le.H=c===null||c.memoizedState===null?Og:Kp),a}function zh(a){if(a!==null&&typeof a=="object"){if(typeof a.then=="function")return Dl(a);if(a.$$typeof===ve)return xi(a)}throw Error(n(438,String(a)))}function of(a){var c=null,m=oi.updateQueue;if(m!==null&&(c=m.memoCache),c==null){var b=oi.alternate;b!==null&&(b=b.updateQueue,b!==null&&(b=b.memoCache,b!=null&&(c={data:b.data.map(function(E){return E.slice()}),index:0})))}if(c==null&&(c={data:[],index:0}),m===null&&(m=no(),oi.updateQueue=m),m.memoCache=c,m=c.data[c.index],m===void 0)for(m=c.data[c.index]=Array(a),b=0;b<a;b++)m[b]=Ke;return c.index++,m}function Xo(a,c){return typeof c=="function"?c(a):c}function Au(a){var c=Tn();return Sc(c,Mi,a)}function Sc(a,c,m){var b=a.queue;if(b===null)throw Error(n(311));b.lastRenderedReducer=m;var E=a.baseQueue,I=b.pending;if(I!==null){if(E!==null){var V=E.next;E.next=I.next,I.next=V}c.baseQueue=E=I,b.pending=null}if(I=a.baseState,E===null)a.memoizedState=I;else{c=E.next;var te=V=null,xe=null,$e=c,et=!1;do{var st=$e.lane&-536870913;if(st!==$e.lane?(Ni&st)===st:(Js&st)===st){var We=$e.revertLane;if(We===0)xe!==null&&(xe=xe.next={lane:0,revertLane:0,gesture:null,action:$e.action,hasEagerState:$e.hasEagerState,eagerState:$e.eagerState,next:null}),st===Na&&(et=!0);else if((Js&We)===We){$e=$e.next,We===Na&&(et=!0);continue}else st={lane:0,revertLane:$e.revertLane,gesture:null,action:$e.action,hasEagerState:$e.hasEagerState,eagerState:$e.eagerState,next:null},xe===null?(te=xe=st,V=I):xe=xe.next=st,oi.lanes|=We,$l|=We;st=$e.action,Zn&&m(I,st),I=$e.hasEagerState?$e.eagerState:m(I,st)}else We={lane:st,revertLane:$e.revertLane,gesture:$e.gesture,action:$e.action,hasEagerState:$e.hasEagerState,eagerState:$e.eagerState,next:null},xe===null?(te=xe=We,V=I):xe=xe.next=We,oi.lanes|=st,$l|=st;$e=$e.next}
vendor: 8,564 bytes, line 48
48while($e!==null&&$e!==c);if(xe===null?V=I:xe.next=te,!Zr(I,a.memoizedState)&&(Qn=!0,et&&(m=za,m!==null)))throw m;a.memoizedState=I,a.baseState=V,a.baseQueue=xe,b.lastRenderedState=I}return E===null&&(b.lanes=0),[a.memoizedState,b.dispatch]}function Ol(a){var c=Tn(),m=c.queue;if(m===null)throw Error(n(311));m.lastRenderedReducer=a;var b=m.dispatch,E=m.pending,I=c.memoizedState;if(E!==null){m.pending=null;var V=E=E.next;do I=a(I,V.action),V=V.next;while(V!==E);Zr(I,c.memoizedState)||(Qn=!0),c.memoizedState=I,c.baseQueue===null&&(c.baseState=I),m.lastRenderedState=I}return[I,b]}function ro(a,c,m){var b=oi,E=Tn(),I=lt;if(I){if(m===void 0)throw Error(n(407));m=m()}else m=c();var V=!Zr((Mi||E).memoizedState,m);if(V&&(E.memoizedState=m,Qn=!0),E=E.queue,Ac(Bp.bind(null,b,E,a),[a]),E.getSnapshot!==c||V||gn!==null&&gn.memoizedState.tag&1){if(b.flags|=2048,zl(9,{destroy:void 0},qo.bind(null,b,E,m,c),null),Sn===null)throw Error(n(349));I||(Js&127)!==0||va(b,c,m)}return m}function va(a,c,m){a.flags|=16384,a={getSnapshot:c,value:m},c=oi.updateQueue,c===null?(c=no(),oi.updateQueue=c,c.stores=[a]):(m=c.stores,m===null?c.stores=[a]:m.push(a))}function qo(a,c,m,b){c.value=m,c.getSnapshot=b,kl(c)&&Ag(a)}function Bp(a,c,m){return m(function(){kl(c)&&Ag(a)})}function kl(a){var c=a.getSnapshot;a=a.value;try{var m=c();return!Zr(a,m)}catch{return!0}}function Ag(a){var c=Ma(a,2);c!==null&&ls(c,a,2)}function lf(a){var c=_r();if(typeof a=="function"){var m=a;if(a=m(),Zn){Wt(!0);try{m()}finally{Wt(!1)}}}return c.memoizedState=c.baseState=a,c.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xo,lastRenderedState:a},c}function Kn(a,c,m,b){return a.baseState=m,Sc(a,Mi,typeof b=="function"?b:Xo)}function Np(a,c,m,b,E){if(pf(a))throw Error(n(485));if(a=c.action,a!==null){var I={payload:E,action:a,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(V){I.listeners.push(V)}};Le.T!==null?m(!0):I.isTransition=!1,b(I),m=c.pending,m===null?(I.next=c.pending=I,zp(c,I)):(I.next=m.next,c.pending=m.next=I)}}function zp(a,c){var m=c.action,b=c.payload,E=a.state;if(c.isTransition){var I=Le.T,V={};Le.T=V;try{var te=m(E,b),xe=Le.S;xe!==null&&xe(V,te),Bl(a,c,te)}catch($e){Eu(a,c,$e)}finally{I!==null&&V.types!==null&&(I.types=V.types),Le.T=I}}else try{I=m(E,b),Bl(a,c,I)}catch($e){Eu(a,c,$e)}}function Bl(a,c,m){m!==null&&typeof m=="object"&&typeof m.then=="function"?m.then(function(b){Nl(a,c,b)},function(b){return Eu(a,c,b)}):Nl(a,c,m)}function Nl(a,c,m){c.status="fulfilled",c.value=m,cf(c),a.state=m,c=a.pending,c!==null&&(m=c.next,m===c?a.pending=null:(m=m.next,c.next=m,zp(a,m)))}function Eu(a,c,m){var b=a.pending;if(a.pending=null,b!==null){b=b.next;do c.status="rejected",c.reason=m,cf(c),c=c.next;while(c!==b)}a.action=null}function cf(a){a=a.listeners;for(var c=0;c<a.length;c++)(0,a[c])()}function Lp(a,c){return c}function Eg(a,c){if(lt){var m=Sn.formState;if(m!==null){e:{var b=oi;if(lt){if(Bi){t:{for(var E=Bi,I=as;E.nodeType!==8;){if(!I){E=null;break t}if(E=_t(E.nextSibling),E===null){E=null;break t}}I=E.data,E=I==="F!"||I==="F"?E:null}if(E){Bi=_t(E.nextSibling),b=E.data==="F!";break e}}_s(b)}b=!1}b&&(c=m[0])}}return m=_r(),m.memoizedState=m.baseState=c,b={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Lp,lastRenderedState:c},m.queue=b,m=Bs.bind(null,oi,b),b.dispatch=m,b=lf(!1),I=Vh.bind(null,oi,!1,b.queue),b=_r(),E={state:c,dispatch:null,action:a,pending:null},b.queue=E,m=Np.bind(null,oi,E,I,m),E.dispatch=m,b.memoizedState=a,[c,m,!1]}function Fp(a){var c=Tn();return Cg(c,Mi,a)}function Cg(a,c,m){if(c=Sc(a,c,Lp)[0],a=Au(Xo)[0],typeof c=="object"&&c!==null&&typeof c.then=="function")try{var b=Dl(c)}catch(V){throw V===D?L:V}else b=c;c=Tn();var E=c.queue,I=E.dispatch;return m!==c.memoizedState&&(oi.flags|=2048,zl(9,{destroy:void 0},Up.bind(null,E,m),null)),[b,I,a]}function Up(a,c){a.action=c}function Rg(a){var c=Tn(),m=Mi;if(m!==null)return Cg(c,m,a);Tn(),c=c.memoizedState,m=Tn();var b=m.queue.dispatch;return m.memoizedState=a,[c,b,!1]}function zl(a,c,m,b){return a={tag:a,create:m,deps:b,inst:c,next:null},c=oi.updateQueue,c===null&&(c=no(),oi.updateQueue=c),m=c.lastEffect,m===null?c.lastEffect=a.next=a:(b=m.next,m.next=a,a.next=b,c.lastEffect=a),a}function jp(){return Tn().memoizedState}function Lh(a,c,m,b){var E=_r();oi.flags|=a,E.memoizedState=zl(1|c,{destroy:void 0},m,b===void 0?null:b)}function Zo(a,c,m,b){var E=Tn();b=b===void 0?null:b;var I=E.memoizedState.inst;Mi!==null&&b!==null&&Su(b,Mi.memoizedState.deps)?E.memoizedState=zl(c,I,m,b):(oi.flags|=a,E.memoizedState=zl(1|c,I,m,b))}function Mg(a,c){Lh(8390656,8,a,c)}function Ac(a,c){Zo(2048,8,a,c)}function uf(a){oi.flags|=4;var c=oi.updateQueue;if(c===null)c=no(),oi.updateQueue=c,c.events=[a];else{var m=c.events;m===null?c.events=[a]:m.push(a)}}function Fh(a){var c=Tn().memoizedState;return uf({ref:c,nextImpl:a}),function(){if((Qi&2)!==0)throw Error(n(440));return c.impl.apply(void 0,arguments)}}function Vp(a,c){return Zo(4,2,a,c)}function $p(a,c){return Zo(4,4,a,c)}function Pg(a,c){if(typeof c=="function"){a=a();var m=c(a);return function(){typeof m=="function"?m():c(null)}}if(c!=null)return a=a(),c.current=a,function(){c.current=null}}function Yr(a,c,m){m=m!=null?m.concat([a]):null,Zo(4,4,Pg.bind(null,c,a),m)}function Ll(){}function hf(a,c){var m=Tn();c=c===void 0?null:c;var b=m.memoizedState;return c!==null&&Su(c,b[1])?b[0]:(m.memoizedState=[a,c],a)}function Hp(a,c){var m=Tn();c=c===void 0?null:c;var b=m.memoizedState;if(c!==null&&Su(c,b[1]))return b[0];if(b=a(),Zn){Wt(!0);try{a()}finally{Wt(!1)}}return m.memoizedState=[b,c],b}function Ec(a,c,m){return m===void 0||(Js&1073741824)!==0&&(Ni&261930)===0?a.memoizedState=c:(a.memoizedState=m,a=Af(),oi.lanes|=a,$l|=a,m)}function Ig(a,c,m,b){return Zr(m,c)?m:Zi.current!==null?(a=Ec(a,m,b),Zr(a,c)||(Qn=!0),a):(Js&42)===0||(Js&1073741824)!==0&&(Ni&261930)===0?(Qn=!0,a.memoizedState=m):(a=Af(),oi.lanes|=a,$l|=a,c)}function Uh(a,c,m,b,E){var I=nt.p;nt.p=I!==0&&8>I?I:8;var V=Le.T,te={};Le.T=te,Vh(a,!1,c,m);try{var xe=E(),$e=Le.S;if($e!==null&&$e(te,xe),xe!==null&&typeof xe=="object"&&typeof xe.then=="function"){var et=r(xe,b);Cu(a,c,et,ia(a))}else Cu(a,c,b,ia(a))}catch(st){Cu(a,c,{then:function(){},status:"rejected",reason:st},ia())}finally{nt.p=I,V!==null&&te.types!==null&&(V.types=te.types),Le.T=V}}function vv(){}function df(a,c,m,b){if(a.tag!==5)throw Error(n(476));var E=Wp(a).queue;Uh(a,E,c,mt,m===null?vv:function(){return Xp(a),m(b)})}function Wp(a){var c=a.memoizedState;if(c!==null)return c;c={memoizedState:mt,baseState:mt,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xo,lastRenderedState:mt},next:null};var m={};return c.next={memoizedState:m,baseState:m,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xo,lastRenderedState:m},next:null},a.memoizedState=c,a=a.alternate,a!==null&&(a.memoizedState=c),c}function Xp(a){var c=Wp(a);c.next===null&&(c=a.alternate.memoizedState),Cu(a,c.next.queue,{},ia())}function qp(){return xi(Ju)}function ff(){return Tn().memoizedState}function Zp(){return Tn().memoizedState}function Yp(a){for(var c=a.return;c!==null;){switch(c.tag){case 24:case 3:var m=ia();a=ft(m);var b=Ot(c,a,m);b!==null&&(ls(b,c,m),ni(b,c,m)),c={cache:Is()},a.payload=c;return}c=c.return}}function jh(a,c,m){var b=ia();m={lane:b,revertLane:0,gesture:null,action:m,hasEagerState:!1,eagerState:null,next:null},pf(a)?Gp(c,m):(m=Uo(a,c,m,b),m!==null&&(ls(m,a,b),Dg(m,c,b)))}function Bs(a,c,m){var b=ia();Cu(a,c,m,b)}function Cu(a,c,m,b){var E={lane:b,revertLane:0,gesture:null,action:m,hasEagerState:!1,eagerState:null,next:null};if(pf(a))Gp(c,E);else{var I=a.alternate;if(a.lanes===0&&(I===null||I.lanes===0)&&(I=c.lastRenderedReducer,I!==null))try{var V=c.lastRenderedState,te=I(V,m);if(E.hasEagerState=!0,E.eagerState=te,Zr(te,V))return Br(a,c,E,0),Sn===null&&ns(),!1}catch{}finally{}if(m=Uo(a,c,E,b),m!==null)return ls(m,a,b),Dg(m,c,b),!0}return!1}function Vh(a,c,m,b){if(b={lane:2,revertLane:Zu(),gesture:null,action:b,hasEagerState:!1,eagerState:null,next:null},pf(a)){if(c)throw Error(n(479))}else c=Uo(a,m,b,2),c!==null&&ls(c,a,2)}function pf(a){var c=a.alternate;return a===oi||c!==null&&c===oi}function Gp(a,c){qn=os=!0;var m=a.pending;m===null?c.next=c:(c.next=m.next,m.next=c),a.pending=c}function Dg(a,c,m){if((m&4194048)!==0){var b=c.lanes;b&=a.pendingLanes,m|=b,c.lanes=m,qe(a,m)}}var $h={readContext:xi,use:zh,useCallback:_n,useContext:_n,useEffect:_n,useImperativeHandle:_n,useLayoutEffect:_n,useInsertionEffect:_n,useMemo:_n,useReducer:_n,useRef
vendor: 5,425 bytes, line 48
48:_n,useState:_n,useDebugValue:_n,useDeferredValue:_n,useTransition:_n,useSyncExternalStore:_n,useId:_n,useHostTransitionStatus:_n,useFormState:_n,useActionState:_n,useOptimistic:_n,useMemoCache:_n,useCacheRefresh:_n};$h.useEffectEvent=_n;var Og={readContext:xi,use:zh,useCallback:function(a,c){return _r().memoizedState=[a,c===void 0?null:c],a},useContext:xi,useEffect:Mg,useImperativeHandle:function(a,c,m){m=m!=null?m.concat([a]):null,Lh(4194308,4,Pg.bind(null,c,a),m)},useLayoutEffect:function(a,c){return Lh(4194308,4,a,c)},useInsertionEffect:function(a,c){Lh(4,2,a,c)},useMemo:function(a,c){var m=_r();c=c===void 0?null:c;var b=a();if(Zn){Wt(!0);try{a()}finally{Wt(!1)}}return m.memoizedState=[b,c],b},useReducer:function(a,c,m){var b=_r();if(m!==void 0){var E=m(c);if(Zn){Wt(!0);try{m(c)}finally{Wt(!1)}}}else E=c;return b.memoizedState=b.baseState=E,a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:E},b.queue=a,a=a.dispatch=jh.bind(null,oi,a),[b.memoizedState,a]},useRef:function(a){var c=_r();return a={current:a},c.memoizedState=a},useState:function(a){a=lf(a);var c=a.queue,m=Bs.bind(null,oi,c);return c.dispatch=m,[a.memoizedState,m]},useDebugValue:Ll,useDeferredValue:function(a,c){var m=_r();return Ec(m,a,c)},useTransition:function(){var a=lf(!1);return a=Uh.bind(null,oi,a.queue,!0,!1),_r().memoizedState=a,[!1,a]},useSyncExternalStore:function(a,c,m){var b=oi,E=_r();if(lt){if(m===void 0)throw Error(n(407));m=m()}else{if(m=c(),Sn===null)throw Error(n(349));(Ni&127)!==0||va(b,c,m)}E.memoizedState=m;var I={value:m,getSnapshot:c};return E.queue=I,Mg(Bp.bind(null,b,I,a),[a]),b.flags|=2048,zl(9,{destroy:void 0},qo.bind(null,b,I,m,c),null),m},useId:function(){var a=_r(),c=Sn.identifierPrefix;if(lt){var m=zr,b=rr;m=(b&~(1<<32-xn(b)-1)).toString(32)+m,c="_"+c+"R_"+m,m=Fr++,0<m&&(c+="H"+m.toString(32)),c+="_"}else m=Ml++,c="_"+c+"r_"+m.toString(32)+"_";return a.memoizedState=c},useHostTransitionStatus:qp,useFormState:Eg,useActionState:Eg,useOptimistic:function(a){var c=_r();c.memoizedState=c.baseState=a;var m={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return c.queue=m,c=Vh.bind(null,oi,!0,m),m.dispatch=c,[a,c]},useMemoCache:of,useCacheRefresh:function(){return _r().memoizedState=Yp.bind(null,oi)},useEffectEvent:function(a){var c=_r(),m={impl:a};return c.memoizedState=m,function(){if((Qi&2)!==0)throw Error(n(440));return m.impl.apply(void 0,arguments)}}},Kp={readContext:xi,use:zh,useCallback:hf,useContext:xi,useEffect:Ac,useImperativeHandle:Yr,useInsertionEffect:Vp,useLayoutEffect:$p,useMemo:Hp,useReducer:Au,useRef:jp,useState:function(){return Au(Xo)},useDebugValue:Ll,useDeferredValue:function(a,c){var m=Tn();return Ig(m,Mi.memoizedState,a,c)},useTransition:function(){var a=Au(Xo)[0],c=Tn().memoizedState;return[typeof a=="boolean"?a:Dl(a),c]},useSyncExternalStore:ro,useId:ff,useHostTransitionStatus:qp,useFormState:Fp,useActionState:Fp,useOptimistic:function(a,c){var m=Tn();return Kn(m,Mi,a,c)},useMemoCache:of,useCacheRefresh:Zp};Kp.useEffectEvent=Fh;var Qp={readContext:xi,use:zh,useCallback:hf,useContext:xi,useEffect:Ac,useImperativeHandle:Yr,useInsertionEffect:Vp,useLayoutEffect:$p,useMemo:Hp,useReducer:Ol,useRef:jp,useState:function(){return Ol(Xo)},useDebugValue:Ll,useDeferredValue:function(a,c){var m=Tn();return Mi===null?Ec(m,a,c):Ig(m,Mi.memoizedState,a,c)},useTransition:function(){var a=Ol(Xo)[0],c=Tn().memoizedState;return[typeof a=="boolean"?a:Dl(a),c]},useSyncExternalStore:ro,useId:ff,useHostTransitionStatus:qp,useFormState:Rg,useActionState:Rg,useOptimistic:function(a,c){var m=Tn();return Mi!==null?Kn(m,Mi,a,c):(m.baseState=a,[a,m.queue.dispatch])},useMemoCache:of,useCacheRefresh:Zp};Qp.useEffectEvent=Fh;function mf(a,c,m,b){c=a.memoizedState,m=m(b,c),m=m==null?c:N({},c,m),a.memoizedState=m,a.lanes===0&&(a.updateQueue.baseState=m)}var Yo={enqueueSetState:function(a,c,m){a=a._reactInternals;var b=ia(),E=ft(b);E.payload=c,m!=null&&(E.callback=m),c=Ot(a,E,b),c!==null&&(ls(c,a,b),ni(c,a,b))},enqueueReplaceState:function(a,c,m){a=a._reactInternals;var b=ia(),E=ft(b);E.tag=1,E.payload=c,m!=null&&(E.callback=m),c=Ot(a,E,b),c!==null&&(ls(c,a,b),ni(c,a,b))},enqueueForceUpdate:function(a,c){a=a._reactInternals;var m=ia(),b=ft(m);b.tag=2,c!=null&&(b.callback=c),c=Ot(a,b,m),c!==null&&(ls(c,a,m),ni(c,a,m))}};function Ru(a,c,m,b,E,I,V){return a=a.stateNode,typeof a.shouldComponentUpdate=="function"?a.shouldComponentUpdate(b,I,V):c.prototype&&c.prototype.isPureReactComponent?!Di(m,b)||!Di(E,I):!0}function kg(a,c,m,b){a=c.state,typeof c.componentWillReceiveProps=="function"&&c.componentWillReceiveProps(m,b),typeof c.UNSAFE_componentWillReceiveProps=="function"&&c.UNSAFE_componentWillReceiveProps(m,b),c.state!==a&&Yo.enqueueReplaceState(c,c.state,null)}function Cc(a,c){var m=c;if("ref"in c){m={};for(var b in c)b!=="ref"&&(m[b]=c[b])}if(a=a.defaultProps){m===c&&(m=N({},m));for(var E in a)m[E]===void 0&&(m[E]=a[E])}return m}function Bg(a){pa(a)}function Ng(a){console.error(a)}function zg(a){pa(a)}function gf(a,c){try{var m=a.onUncaughtError;m(c.value,{componentStack:c.stack})}catch(b){setTimeout(function(){throw b})}}function Lg(a,c,m){try{var b=a.onCaughtError;b(m.value,{componentStack:m.stack,errorBoundary:c.tag===1?c.stateNode:null})}catch(E){setTimeout(function(){throw E})}}function Hh(a,c,m){return m=ft(m),m.tag=3,m.payload={element:null},m.callback=function(){gf(a,c)},m}
vendor: 15,238 bytes, line 48
48function Fg(a){return a=ft(a),a.tag=3,a}function Rc(a,c,m,b){var E=m.type.getDerivedStateFromError;if(typeof E=="function"){var I=b.value;a.payload=function(){return E(I)},a.callback=function(){Lg(c,m,b)}}var V=m.stateNode;V!==null&&typeof V.componentDidCatch=="function"&&(a.callback=function(){Lg(c,m,b),typeof E!="function"&&(el===null?el=new Set([this]):el.add(this));var te=b.stack;this.componentDidCatch(b.value,{componentStack:te!==null?te:""})})}function bv(a,c,m,b,E){if(m.flags|=32768,b!==null&&typeof b=="object"&&typeof b.then=="function"){if(c=m.alternate,c!==null&&Rl(c,m,E,!0),m=pn.current,m!==null){switch(m.tag){case 31:case 13:return mn===null?Ef():m.alternate===null&&jn===0&&(jn=3),m.flags&=-257,m.flags|=65536,m.lanes=E,b===$?m.flags|=16384:(c=m.updateQueue,c===null?m.updateQueue=new Set([b]):c.add(b),Mf(a,b,E)),!1;case 22:return m.flags|=65536,b===$?m.flags|=16384:(c=m.updateQueue,c===null?(c={transitions:null,markerInstances:null,retryQueue:new Set([b])},m.updateQueue=c):(m=c.retryQueue,m===null?c.retryQueue=new Set([b]):m.add(b)),Mf(a,b,E)),!1}throw Error(n(435,m.tag))}return Mf(a,b,E),Ef(),!1}if(lt)return c=pn.current,c!==null?((c.flags&65536)===0&&(c.flags|=256),c.flags|=65536,c.lanes=E,b!==bu&&(a=Error(n(422),{cause:b}),Vo(ss(a,m)))):(b!==bu&&(c=Error(n(423),{cause:b}),Vo(ss(c,m))),a=a.current.alternate,a.flags|=65536,E&=-E,a.lanes|=E,b=ss(b,m),E=Hh(a.stateNode,b,E),wt(a,E),jn!==4&&(jn=2)),!1;var I=Error(n(520),{cause:b});if(I=ss(I,m),ju===null?ju=[I]:ju.push(I),jn!==4&&(jn=2),c===null)return!0;b=ss(b,m),m=c;do{switch(m.tag){case 3:return m.flags|=65536,a=E&-E,m.lanes|=a,a=Hh(m.stateNode,b,a),wt(m,a),!1;case 1:if(c=m.type,I=m.stateNode,(m.flags&128)===0&&(typeof c.getDerivedStateFromError=="function"||I!==null&&typeof I.componentDidCatch=="function"&&(el===null||!el.has(I))))return m.flags|=65536,E&=-E,m.lanes|=E,E=Fg(E),Rc(E,a,m,b),wt(m,E),!1}m=m.return}while(m!==null);return!1}var Ln=Error(n(461)),Qn=!1;function Ur(a,c,m,b){c.child=a===null?dt(c,null,m,b):Ge(c,a.child,m,b)}function Wh(a,c,m,b,E){m=m.render;var I=c.ref;if("ref"in b){var V={};for(var te in b)te!=="ref"&&(V[te]=b[te])}else V=b;return dr(c),b=Bh(a,c,m,V,I,E),te=Pl(),a!==null&&!Qn?(Wo(a,c,E),so(a,c,E)):(lt&&te&&_u(c),c.flags|=1,Ur(a,c,b,E),c.child)}function Xh(a,c,m,b,E){if(a===null){var I=m.type;return typeof I=="function"&&!vc(I)&&I.defaultProps===void 0&&m.compare===null?(c.tag=15,c.type=I,Mu(a,c,I,b,E)):(a=Sl(m.type,null,b,c,c.mode,E),a.ref=c.ref,a.return=c,c.child=a)}if(I=a.child,!vf(a,E)){var V=I.memoizedProps;if(m=m.compare,m=m!==null?m:Di,m(V,b)&&a.ref===c.ref)return so(a,c,E)}return c.flags|=1,a=Ms(I,b),a.ref=c.ref,a.return=c,c.child=a}function Mu(a,c,m,b,E){if(a!==null){var I=a.memoizedProps;if(Di(I,b)&&a.ref===c.ref)if(Qn=!1,c.pendingProps=b=I,vf(a,E))(a.flags&131072)!==0&&(Qn=!0);else return c.lanes=a.lanes,so(a,c,E)}return yf(a,c,m,b,E)}function Jp(a,c,m,b){var E=b.children,I=a!==null?a.memoizedState:null;if(a===null&&c.stateNode===null&&(c.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),b.mode==="hidden"){if((c.flags&128)!==0){if(I=I!==null?I.baseLanes|m:m,a!==null){for(b=c.child=a.child,E=0;b!==null;)E=E|b.lanes|b.childLanes,b=b.sibling;b=E&~I}else b=0,c.child=null;return Iu(a,c,I,m,b)}if((m&536870912)!==0)c.memoizedState={baseLanes:0,cachePool:null},a!==null&&x(c,I!==null?I.cachePool:null),I!==null?Ds(c,I):an(),$o(c);else return b=c.lanes=536870912,Iu(a,c,I!==null?I.baseLanes|m:m,m,b)}else I!==null?(x(c,I.cachePool),Ds(c,I),Qs(),c.memoizedState=null):(a!==null&&x(c,null),an(),Qs());return Ur(a,c,E,m),c.child}function Pu(a,c){return a!==null&&a.tag===22||c.stateNode!==null||(c.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),c.sibling}function Iu(a,c,m,b,E){var I=y();return I=I===null?null:{parent:Mn._currentValue,pool:I},c.memoizedState={baseLanes:m,cachePool:I},a!==null&&x(c,null),an(),$o(c),a!==null&&Rl(a,c,b,!0),c.childLanes=E,null}function Du(a,c){return c=qh({mode:c.mode,children:c.children},a.mode),c.ref=a.ref,a.child=c,c.return=a,c}function _f(a,c,m){return Ge(c,a.child,null,m),a=Du(c,c.pendingProps),a.flags|=2,gr(c),c.memoizedState=null,a}function em(a,c,m){var b=c.pendingProps,E=(c.flags&128)!==0;if(c.flags&=-129,a===null){if(lt){if(b.mode==="hidden")return a=Du(c,b),c.lanes=536870912,Pu(null,a);if(Os(c),(a=Bi)?(a=Xe(a,as),a=a!==null&&a.data==="&"?a:null,a!==null&&(c.memoizedState={dehydrated:a,treeContext:ma!==null?{id:rr,overflow:zr}:null,retryLane:536870912,hydrationErrors:null},m=El(a),m.return=c,c.child=m,Wn=c,Bi=null)):a=null,a===null)throw _s(c);return c.lanes=536870912,null}return Du(c,b)}var I=a.memoizedState;if(I!==null){var V=I.dehydrated;if(Os(c),E)if(c.flags&256)c.flags&=-257,c=_f(a,c,m);else if(c.memoizedState!==null)c.child=a.child,c.flags|=128,c=null;else throw Error(n(558));else if(Qn||Rl(a,c,m,!1),E=(m&a.childLanes)!==0,Qn||E){if(b=Sn,b!==null&&(V=tt(b,m),V!==0&&V!==I.retryLane))throw I.retryLane=V,Ma(a,V),ls(b,a,V),Ln;Ef(),c=_f(a,c,m)}else a=I.treeContext,Bi=_t(V.nextSibling),Wn=c,lt=!0,Ks=null,as=!1,a!==null&&vu(c,a),c=Du(c,b),c.flags|=4096;return c}return a=Ms(a.child,{mode:b.mode,children:b.children}),a.ref=c.ref,c.child=a,a.return=c,a}function Ou(a,c){var m=c.ref;if(m===null)a!==null&&a.ref!==null&&(c.flags|=4194816);else{if(typeof m!="function"&&typeof m!="object")throw Error(n(284));(a===null||a.ref!==m)&&(c.flags|=4194816)}}function yf(a,c,m,b,E){return dr(c),m=Bh(a,c,m,b,void 0,E),b=Pl(),a!==null&&!Qn?(Wo(a,c,E),so(a,c,E)):(lt&&b&&_u(c),c.flags|=1,Ur(a,c,m,E),c.child)}function tm(a,c,m,b,E,I){return dr(c),c.updateQueue=null,m=La(c,b,m,E),Nh(a),b=Pl(),a!==null&&!Qn?(Wo(a,c,I),so(a,c,I)):(lt&&b&&_u(c),c.flags|=1,Ur(a,c,m,I),c.child)}function Ug(a,c,m,b,E){if(dr(c),c.stateNode===null){var I=rs,V=m.contextType;typeof V=="object"&&V!==null&&(I=xi(V)),I=new m(b,I),c.memoizedState=I.state!==null&&I.state!==void 0?I.state:null,I.updater=Yo,c.stateNode=I,I._reactInternals=c,I=c.stateNode,I.props=b,I.state=c.memoizedState,I.refs={},Mt(c),V=m.contextType,I.context=typeof V=="object"&&V!==null?xi(V):rs,I.state=c.memoizedState,V=m.getDerivedStateFromProps,typeof V=="function"&&(mf(c,m,V,b),I.state=c.memoizedState),typeof m.getDerivedStateFromProps=="function"||typeof I.getSnapshotBeforeUpdate=="function"||typeof I.UNSAFE_componentWillMount!="function"&&typeof I.componentWillMount!="function"||(V=I.state,typeof I.componentWillMount=="function"&&I.componentWillMount(),typeof I.UNSAFE_componentWillMount=="function"&&I.UNSAFE_componentWillMount(),V!==I.state&&Yo.enqueueReplaceState(I,I.state,null),Ki(c,b,I,E),Qt(),I.state=c.memoizedState),typeof I.componentDidMount=="function"&&(c.flags|=4194308),b=!0}else if(a===null){I=c.stateNode;var te=c.memoizedProps,xe=Cc(m,te);I.props=xe;var $e=I.context,et=m.contextType;V=rs,typeof et=="object"&&et!==null&&(V=xi(et));var st=m.getDerivedStateFromProps;et=typeof st=="function"||typeof I.getSnapshotBeforeUpdate=="function",te=c.pendingProps!==te,et||typeof I.UNSAFE_componentWillReceiveProps!="function"&&typeof I.componentWillReceiveProps!="function"||(te||$e!==V)&&kg(c,I,b,V),vt=!1;var We=c.memoizedState;I.state=We,Ki(c,b,I,E),Qt(),$e=c.memoizedState,te||We!==$e||vt?(typeof st=="function"&&(mf(c,m,st,b),$e=c.memoizedState),(xe=vt||Ru(c,m,xe,b,We,$e,V))?(et||typeof I.UNSAFE_componentWillMount!="function"&&typeof I.componentWillMount!="function"||(typeof I.componentWillMount=="function"&&I.componentWillMount(),typeof I.UNSAFE_componentWillMount=="function"&&I.UNSAFE_componentWillMount()),typeof I.componentDidMount=="function"&&(c.flags|=4194308)):(typeof I.componentDidMount=="function"&&(c.flags|=4194308),c.memoizedProps=b,c.memoizedState=$e),I.props=b,I.state=$e,I.context=V,b=xe):(typeof I.componentDidMount=="function"&&(c.flags|=4194308),b=!1)}else{I=c.stateNode,xt(a,c),V=c.memoizedProps,et=Cc(m,V),I.props=et,st=c.pendingProps,We=I.context,$e=m.contextType,xe=rs,typeof $e=="object"&&$e!==null&&(xe=xi($e)),te=m.getDerivedStateFromProps,($e=typeof te=="function"||typeof I.getSnapshotBeforeUpdate=="function")||typeof I.UNSAFE_componentWillReceiveProps!="function"&&typeof I.componentWillReceiveProps!="function"||(V!==st||We!==xe)&&kg(c,I,b,xe),vt=!1,We=c.memoizedState,I.state=We,Ki(c,b,I,E),Qt();var Ze=c.memoizedState;V!==st||We!==Ze||vt||a!==null&&a.dependencies!==null&&wu(a.dependencies)?(typeof te=="function"&&(mf(c,m,te,b),Ze=c.memoizedState),(et=vt||Ru(c,m,et,b,We,Ze,xe)||a!==null&&a.dependencies!==null&&wu(a.dependencies))?($e||typeof I.UNSAFE_componentWillUpdate!="function"&&typeof I.componentWillUpdate!="function"||(typeof I.componentWillUpdate=="function"&&I.componentWillUpdate(b,Ze,xe),typeof I.UNSAFE_componentWillUpdate=="function"&&I.UNSAFE_componentWillUpdate(b,Ze,xe)),typeof I.componentDidUpdate=="function"&&(c.flags|=4),typeof I.getSnapshotBeforeUpdate=="function"&&(c.flags|=1024)):(typeof I.componentDidUpdate!="function"||V===a.memoizedProps&&We===a.memoizedState||(c.flags|=4),typeof I.getSnapshotBeforeUpdate!="function"||V===a.memoizedProps&&We===a.memoizedState||(c.flags|=1024),c.memoizedProps=b,c.memoizedState=Ze),I.props=b,I.state=Ze,I.context=xe,b=et):(typeof I.componentDidUpdate!="function"||V===a.memoizedProps&&We===a.memoizedState||(c.flags|=4),typeof I.getSnapshotBeforeUpdate!="function"||V===a.memoizedProps&&We===a.memoizedState||(c.flags|=1024),b=!1)}return I=b,Ou(a,c),b=(c.flags&128)!==0,I||b?(I=c.stateNode,m=b&&typeof m.getDerivedStateFromError!="function"?null:I.render(),c.flags|=1,a!==null&&b?(c.child=Ge(c,a.child,null,E),c.child=Ge(c,null,m,E)):Ur(a,c,m,E),c.memoizedState=I.state,a=c.child):a=so(a,c,E),a}function jg(a,c,m,b){return Oa(),c.flags|=256,Ur(a,c,m,b),c.child}var im={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function nm(a){return{baseLanes:a,cachePool:M()}}function rm(a,c,m){return a=a!==null?a.childLanes&~m:0,c&&(a|=Ls),a}function Go(a,c,m){var b=c.pendingProps,E=!1,I=(c.flags&128)!==0,V;if((V=I)||(V=a!==null&&a.memoizedState===null?!1:(Wi.current&2)!==0),V&&(E=!0,c.flags&=-129),V=(c.flags&32)!==0,c.flags&=-33,a===null){if(lt){if(E?Xn(c):Qs(),(a=Bi)?(a=Xe(a,as),a=a!==null&&a.data!=="&"?a:null,a!==null&&(c.memoizedState={dehydrated:a,treeContext:ma!==null?{id:rr,overflow:zr}:null,retryLane:536870912,hydrationErrors:null},m=El(a),m.return=c,c.child=m,Wn=c,Bi=null)):a=null,a===null)throw _s(c);return Rt(a)?c.lanes=32:c.lanes=536870912,null}var te=b.children;return b=b.fallback,E?(Qs(),E=c.mode,te=qh({mode:"hidden",children:te},E),b=gs(b,E,m,null),te.return=c,b.return=c,te.sibling=b,c.child=te,b=c.child,b.memoizedState=nm(m),b.childLanes=rm(a,V,m),c.memoizedState=im,Pu(null,b)):(Xn(c),sm(c,te))}var xe=a.memoizedState;if(xe!==null&&(te=xe.dehydrated,te!==null)){if(I)c.flags&256?(Xn(c),c.flags&=-257,c=Fl(a,c,m)):c.memoizedState!==null?(Qs(),c.child=a.child,c.flags|=128,c=null):(Qs(),te=b.fallback,E=c.mode,b=qh({mode:"visible",children:b.children},E),te=gs(te,E,m,null),te.flags|=2,b.return=c,te.return=c,b.sibling=te,c.child=b,Ge(c,a.child,null,m),b=c.child,b.memoizedState=nm(m),b.childLanes=rm(a,V,m),c.memoizedState=im,c=Pu(null,b));else if(Xn(c),Rt(te)){if(V=te.nextSibling&&te.nextSibling.dataset,V)var $e=V.dgst;V=$e,b=Error(n(419)),b.stack="",b.digest=V,Vo({value:b,source:null,stack:null}),c=Fl(a,c,m)}else if(Qn||Rl(a,c,m,!1),V=(m&a.childLanes)!==0,Qn||V){if(V=Sn,V!==null&&(b=tt(V,m),b!==0&&b!==xe.retryLane))throw xe.retryLane=b,Ma(a,b),ls(V,a,b),Ln;ct(te)||Ef(),c=Fl(a,c,m)}else ct(te)?(c.flags|=192,c.child=a.child,c=null):(a=xe.treeContext,Bi=_t(te.nextSibling),Wn=c,lt=!0,Ks=null,as=!1,a!==null&&vu(c,a),c=sm(c,b.children),c.flags|=4096);return c}return E?(Qs(),te=b.fallback,E=c.mode,xe=a.child,$e=xe.sibling,b=Ms(xe,{mode:"hidden",children:b.children}),b.subtreeFlags=xe.subtreeFlags&65011712,$e!==null?te=Ms($e,te):(te=gs(te,E,m,null),te.flags|=2),te.return=c,b.return=c,b.sibling=te,c.child=b,Pu(null,b),b=c.child,te=a.child.memoizedState,te===null?te=nm(m):(E=te.cachePool,E!==null?(xe=Mn._currentValue,E=E.parent!==xe?{parent:xe,pool:xe}:E):E=M(),te={baseLanes:te.baseLanes|m,cachePool:E}),b.memoizedState=te,b.childLanes=rm(a,V,m),c.memoizedState=im,Pu(a.child,b)):(Xn(c),m=a.child,a=m.sibling,m=Ms(m,{mode:"visible",children:b.children}),m.return=c,m.sibling=null,a!==null&&(V=c.deletions,V===null?(c.deletions=[a],c.flags|=16):V.push(a)),c.child=m,c.memoizedState=null,m)}function sm(a,c){return c=qh({mode:"visible",children:c},a.mode),c.return=a,a.child=c}function qh(a,c){return a=Nr(22,a,null,c),a.lanes=0,a}function Fl(a,c,m){return Ge(c,a.child,null,m),a=sm(c,c.pendingProps.children),a.flags|=2,c.memoizedState=null,a}function Vg(a,c,m){a.lanes|=c;var b=a.alternate;b!==null&&(b.lanes|=c),Oh(a.return,c,m)}function am(a,c,m,b,E,I){var V=a.memoizedState;V===null?a.memoizedState={isBackwards:c,rendering:null,renderingStartTime:0,last:b,tail:m,tailMode:E,treeForkCount:I}:(V.isBackwards=c,V.rendering=null,V.renderingStartTime=0,V.last=b,V.tail=m,V.tailMode=E,V.treeForkCount=I)}function $g(a,c,m){var b=c.pendingProps,E=b.revealOrder,I=b.tail;b=b.children;var V=Wi.current,te=(V&2)!==0;if(te?(V=V&1|2,c.flags|=128):V&=1,ut(Wi,V),Ur(a,c,b,m),b=lt?Cl:0,!te&&a!==null&&(a.flags&128)!==0)e:for(a=c.child;a!==null;){if(a.tag===13)a.memoizedState!==null&&Vg(a,m,c);else if(a.tag===19)Vg(a,m,c);else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===c)break e;for(;a.sibling===null;){if(a.return===null||a.return===c)break e;a=a.return}a.sibling.return=a.return,a=a.sibling}switch(E){case"forwards":for(m=c.child,E=null;m!==null;)a=m.alternate,a!==null&&Ho(a)===null&&(E=m),m=m.sibling;m=E,m===null?(E=c.child,c.child=null):(E=m.sibling,m.sibling=null),am(c,!1,E,m,I,b);break;case"backwards":case"unstable_legacy-backwards":for(m=null,E=c.child,c.child=null;E!==null;){if(a=E.alternate,a!==null&&Ho(a)===null){c.child=E;break}a=E.sibling,E.sibling=m,m=E,E=a}am(c,!0,m,null,I,b);break;case"together":am(c,!1,null,null,void 0,b);break;default:c.memoizedState=null}return c.child}function so(a,c,m){if(a!==null&&(c.dependencies=a.dependencies),$l|=c.lanes,(m&c.childLanes)===0)if(a!==null){if(Rl(a,c,m,!1),(m&c.childLanes)===0)return null}else return null;if(a!==null&&c.child!==a.child)throw Error(n(153));if(c.child!==null){for(a=c.child,m=Ms(a,a.pendingProps),c.child=m,m.return=c;a.sibling!==null;)a=a.sibling,m=m.sibling=Ms(a,a.pendingProps),m.return=c;m.sibling=null}return c.child}function vf(a,c){return(a.lanes&c)!==0?!0:(a=a.dependencies,!!(a!==null&&wu(a)))}function xv(a,c,m){switch(c.tag){case 3:Li(c,c.stateNode.containerInfo),_a(c,Mn,a.memoizedState.cache),Oa();break;case 27:case 5:Er(c);break;case 4:Li(c,c.stateNode.containerInfo);break;case 10:_a(c,c.type,c.memoizedProps.value);break;case 31:if(c.memoizedState!==null)return c.flags|=128,Os(c),null;break;case 13:var b=c.memoizedState;if(b!==null)return b.dehydrated!==null?(Xn(c),c.flags|=128,null):(m&c.child.childLanes)!==0?Go(a,c,m):(Xn(c),a=so(a,c,m),a!==null?a.sibling:null);Xn(c);break;case 19:var E=(a.flags&128)!==0;if(b=(m&c.childLanes)!==0,b||(Rl(a,c,m,!1),b=(m&c.childLanes)!==0),E){if(b)return $g(a,c,m);c.flags|=128}if(E=c.memoizedState,E!==null&&(E.rendering=null,E.tail=null,E.lastEffect=null),ut(Wi,Wi.current),b)break;return null;
vendor: 4,313 bytes, line 48
48case 22:return c.lanes=0,Jp(a,c,m,c.pendingProps);case 24:_a(c,Mn,a.memoizedState.cache)}return so(a,c,m)}function Hg(a,c,m){if(a!==null)if(a.memoizedProps!==c.pendingProps)Qn=!0;else{if(!vf(a,m)&&(c.flags&128)===0)return Qn=!1,xv(a,c,m);Qn=(a.flags&131072)!==0}else Qn=!1,lt&&(c.flags&1048576)!==0&&rf(c,Cl,c.index);switch(c.lanes=0,c.tag){case 16:e:{var b=c.pendingProps;if(a=ee(c.elementType),c.type=a,typeof a=="function")vc(a)?(b=Cc(a,b),c.tag=1,c=Ug(null,c,a,b,m)):(c.tag=0,c=yf(null,c,a,b,m));else{if(a!=null){var E=a.$$typeof;if(E===Oe){c.tag=11,c=Wh(null,c,a,b,m);break e}else if(E===Ee){c.tag=14,c=Xh(null,c,a,b,m);break e}}throw c=Fe(a)||a,Error(n(306,c,""))}}return c;case 0:return yf(a,c,c.type,c.pendingProps,m);case 1:return b=c.type,E=Cc(b,c.pendingProps),Ug(a,c,b,E,m);case 3:e:{if(Li(c,c.stateNode.containerInfo),a===null)throw Error(n(387));b=c.pendingProps;var I=c.memoizedState;E=I.element,xt(a,c),Ki(c,b,null,m);var V=c.memoizedState;if(b=V.cache,_a(c,Mn,b),b!==I.cache&&xc(c,[Mn],m,!0),Qt(),b=V.element,I.isDehydrated)if(I={element:b,isDehydrated:!1,cache:V.cache},c.updateQueue.baseState=I,c.memoizedState=I,c.flags&256){c=jg(a,c,b,m);break e}else if(b!==E){E=ss(Error(n(424)),c),Vo(E),c=jg(a,c,b,m);break e}else{switch(a=c.stateNode.containerInfo,a.nodeType){case 9:a=a.body;break;default:a=a.nodeName==="HTML"?a.ownerDocument.body:a}for(Bi=_t(a.firstChild),Wn=c,lt=!0,Ks=null,as=!0,m=dt(c,null,b,m),c.child=m;m;)m.flags=m.flags&-3|4096,m=m.sibling}else{if(Oa(),b===E){c=so(a,c,m);break e}Ur(a,c,b,m)}c=c.child}return c;case 26:return Ou(a,c),a===null?(m=Pr(c.type,null,c.pendingProps,null))?c.memoizedState=m:lt||(m=c.type,a=c.pendingProps,b=v(qt.current).createElement(m),b[Vt]=c,b[hi]=a,Rr(b,m,a),nr(b),c.stateNode=b):c.memoizedState=Pr(c.type,a.memoizedProps,c.pendingProps,a.memoizedState),null;case 27:return Er(c),a===null&<&&(b=c.stateNode=It(c.type,c.pendingProps,qt.current),Wn=c,as=!0,E=Bi,J(c.type)?(St=E,Bi=_t(b.firstChild)):Bi=E),Ur(a,c,c.pendingProps.children,m),Ou(a,c),a===null&&(c.flags|=4194304),c.child;case 5:return a===null&<&&((E=b=Bi)&&(b=Ae(b,c.type,c.pendingProps,as),b!==null?(c.stateNode=b,Wn=c,Bi=_t(b.firstChild),as=!1,E=!0):E=!1),E||_s(c)),Er(c),E=c.type,I=c.pendingProps,V=a!==null?a.memoizedProps:null,b=I.children,C(E,I)?b=null:V!==null&&C(E,V)&&(c.flags|=32),c.memoizedState!==null&&(E=Bh(a,c,af,null,null,m),Ju._currentValue=E),Ou(a,c),Ur(a,c,b,m),c.child;case 6:return a===null&<&&((a=m=Bi)&&(m=De(m,c.pendingProps,as),m!==null?(c.stateNode=m,Wn=c,Bi=null,a=!0):a=!1),a||_s(c)),null;case 13:return Go(a,c,m);case 4:return Li(c,c.stateNode.containerInfo),b=c.pendingProps,a===null?c.child=Ge(c,null,b,m):Ur(a,c,b,m),c.child;case 11:return Wh(a,c,c.type,c.pendingProps,m);case 7:return Ur(a,c,c.pendingProps,m),c.child;case 8:return Ur(a,c,c.pendingProps.children,m),c.child;case 12:return Ur(a,c,c.pendingProps.children,m),c.child;case 10:return b=c.pendingProps,_a(c,c.type,b.value),Ur(a,c,b.children,m),c.child;case 9:return E=c.type._context,b=c.pendingProps.children,dr(c),E=xi(E),b=b(E),c.flags|=1,Ur(a,c,b,m),c.child;case 14:return Xh(a,c,c.type,c.pendingProps,m);case 15:return Mu(a,c,c.type,c.pendingProps,m);case 19:return $g(a,c,m);case 31:return em(a,c,m);case 22:return Jp(a,c,m,c.pendingProps);case 24:return dr(c),b=xi(Mn),a===null?(E=y(),E===null&&(E=Sn,I=Is(),E.pooledCache=I,I.refCount++,I!==null&&(E.pooledCacheLanes|=m),E=I),c.memoizedState={parent:b,cache:E},Mt(c),_a(c,Mn,E)):((a.lanes&m)!==0&&(xt(a,c),Ki(c,null,null,m),Qt()),E=a.memoizedState,I=c.memoizedState,E.parent!==b?(E={parent:b,cache:b},c.memoizedState=E,c.lanes===0&&(c.memoizedState=c.updateQueue.baseState=E),_a(c,Mn,b)):(b=I.cache,_a(c,Mn,b),b!==E.cache&&xc(c,[Mn],m,!0))),Ur(a,c,c.pendingProps.children,m),c.child;case 29:throw c.pendingProps}throw Error(n(156,c.tag))}function Ko(a){a.flags|=4}function om(a,c,m,b,E){if((c=(a.mode&32)!==0)&&(c=!1),c){if(a.flags|=16777216,(E&335544128)===E)if(a.stateNode.complete)a.flags|=8192;else if(a_())a.flags|=8192;else throw ne=$,O}else a.flags&=-16777217}function bf(a,c){if(c.type!=="stylesheet"||(c.state.loading&4)!==0)a.flags&=-16777217;else if(a.flags|=16777216,!Sr(c))if(a_())a.flags|=8192;else throw ne=$,O}function Ul(a,c){c!==null&&(a.flags|=4),a.flags&16384&&(c=a.tag!==22?ue():536870912,a.lanes|=c,Uu|=c)}
vendor: 4,987 bytes, line 48
48function Mc(a,c){if(!lt)switch(a.tailMode){case"hidden":c=a.tail;for(var m=null;c!==null;)c.alternate!==null&&(m=c),c=c.sibling;m===null?a.tail=null:m.sibling=null;break;case"collapsed":m=a.tail;for(var b=null;m!==null;)m.alternate!==null&&(b=m),m=m.sibling;b===null?c||a.tail===null?a.tail=null:a.tail.sibling=null:b.sibling=null}}function Fn(a){var c=a.alternate!==null&&a.alternate.child===a.child,m=0,b=0;if(c)for(var E=a.child;E!==null;)m|=E.lanes|E.childLanes,b|=E.subtreeFlags&65011712,b|=E.flags&65011712,E.return=a,E=E.sibling;else for(E=a.child;E!==null;)m|=E.lanes|E.childLanes,b|=E.subtreeFlags,b|=E.flags,E.return=a,E=E.sibling;return a.subtreeFlags|=b,a.childLanes=m,c}function wv(a,c,m){var b=c.pendingProps;switch(yu(c),c.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Fn(c),null;case 1:return Fn(c),null;case 3:return m=c.stateNode,b=null,a!==null&&(b=a.memoizedState.cache),c.memoizedState.cache!==b&&(c.flags|=2048),ya(Mn),ki(),m.pendingContext&&(m.context=m.pendingContext,m.pendingContext=null),(a===null||a.child===null)&&(_i(c)?Ko(c):a===null||a.memoizedState.isDehydrated&&(c.flags&256)===0||(c.flags|=1024,Ih())),Fn(c),null;case 26:var E=c.type,I=c.memoizedState;return a===null?(Ko(c),I!==null?(Fn(c),bf(c,I)):(Fn(c),om(c,E,null,b,m))):I?I!==a.memoizedState?(Ko(c),Fn(c),bf(c,I)):(Fn(c),c.flags&=-16777217):(a=a.memoizedProps,a!==b&&Ko(c),Fn(c),om(c,E,a,b,m)),null;case 27:if(Ts(c),m=qt.current,E=c.type,a!==null&&c.stateNode!=null)a.memoizedProps!==b&&Ko(c);else{if(!b){if(c.stateNode===null)throw Error(n(166));return Fn(c),null}a=Tt.current,_i(c)?jo(c):(a=It(E,b,m),c.stateNode=a,Ko(c))}return Fn(c),null;case 5:if(Ts(c),E=c.type,a!==null&&c.stateNode!=null)a.memoizedProps!==b&&Ko(c);else{if(!b){if(c.stateNode===null)throw Error(n(166));return Fn(c),null}if(I=Tt.current,_i(c))jo(c);else{var V=v(qt.current);switch(I){case 1:I=V.createElementNS("http://www.w3.org/2000/svg",E);break;case 2:I=V.createElementNS("http://www.w3.org/1998/Math/MathML",E);break;default:switch(E){case"svg":I=V.createElementNS("http://www.w3.org/2000/svg",E);break;case"math":I=V.createElementNS("http://www.w3.org/1998/Math/MathML",E);break;case"script":I=V.createElement("div"),I.innerHTML="<script><\/script>",I=I.removeChild(I.firstChild);break;case"select":I=typeof b.is=="string"?V.createElement("select",{is:b.is}):V.createElement("select"),b.multiple?I.multiple=!0:b.size&&(I.size=b.size);break;default:I=typeof b.is=="string"?V.createElement(E,{is:b.is}):V.createElement(E)}}I[Vt]=c,I[hi]=b;e:for(V=c.child;V!==null;){if(V.tag===5||V.tag===6)I.appendChild(V.stateNode);else if(V.tag!==4&&V.tag!==27&&V.child!==null){V.child.return=V,V=V.child;continue}if(V===c)break e;for(;V.sibling===null;){if(V.return===null||V.return===c)break e;V=V.return}V.sibling.return=V.return,V=V.sibling}c.stateNode=I;e:switch(Rr(I,E,b),E){case"button":case"input":case"select":case"textarea":b=!!b.autoFocus;break e;case"img":b=!0;break e;default:b=!1}b&&Ko(c)}}return Fn(c),om(c,c.type,a===null?null:a.memoizedProps,c.pendingProps,m),null;case 6:if(a&&c.stateNode!=null)a.memoizedProps!==b&&Ko(c);else{if(typeof b!="string"&&c.stateNode===null)throw Error(n(166));if(a=qt.current,_i(c)){if(a=c.stateNode,m=c.memoizedProps,b=null,E=Wn,E!==null)switch(E.tag){case 27:case 5:b=E.memoizedProps}a[Vt]=c,a=!!(a.nodeValue===m||b!==null&&b.suppressHydrationWarning===!0||Gu(a.nodeValue,m)),a||_s(c,!0)}else a=v(a).createTextNode(b),a[Vt]=c,c.stateNode=a}return Fn(c),null;case 31:if(m=c.memoizedState,a===null||a.memoizedState!==null){if(b=_i(c),m!==null){if(a===null){if(!b)throw Error(n(318));if(a=c.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(n(557));a[Vt]=c}else Oa(),(c.flags&128)===0&&(c.memoizedState=null),c.flags|=4;Fn(c),a=!1}else m=Ih(),a!==null&&a.memoizedState!==null&&(a.memoizedState.hydrationErrors=m),a=!0;if(!a)return c.flags&256?(gr(c),c):(gr(c),null);if((c.flags&128)!==0)throw Error(n(558))}return Fn(c),null;case 13:if(b=c.memoizedState,a===null||a.memoizedState!==null&&a.memoizedState.dehydrated!==null){if(E=_i(c),b!==null&&b.dehydrated!==null){if(a===null){if(!E)throw Error(n(318));if(E=c.memoizedState,E=E!==null?E.dehydrated:null,!E)throw Error(n(317));E[Vt]=c}else Oa(),(c.flags&128)===0&&(c.memoizedState=null),c.flags|=4;Fn(c),E=!1}else E=Ih(),a!==null&&a.memoizedState!==null&&(a.memoizedState.hydrationErrors=E),E=!0;if(!E)return c.flags&256?(gr(c),c):(gr(c),null)}return gr(c),(c.flags&128)!==0?(c.lanes=m,c):(m=b!==null,a=a!==null&&a.memoizedState!==null,m&&(b=c.child,E=null,b.alternate!==null&&b.alternate.memoizedState!==null&&b.alternate.memoizedState.cachePool!==null&&(E=b.alternate.memoizedState.cachePool.pool),I=null,b.memoizedState!==null&&b.memoizedState.cachePool!==null&&(I=b.memoizedState.cachePool.pool),I!==E&&(b.flags|=2048)),m!==a&&m&&(c.child.flags|=8192),Ul(c,c.updateQueue),Fn(c),null);case 4:return ki(),a===null&&Pm(c.stateNode.containerInfo),Fn(c),null;case 10:return ya(c.type),Fn(c),null;
vendor: 20,418 bytes, line 48
48case 19:if(Ue(Wi),b=c.memoizedState,b===null)return Fn(c),null;if(E=(c.flags&128)!==0,I=b.rendering,I===null)if(E)Mc(b,!1);else{if(jn!==0||a!==null&&(a.flags&128)!==0)for(a=c.child;a!==null;){if(I=Ho(a),I!==null){for(c.flags|=128,Mc(b,!1),a=I.updateQueue,c.updateQueue=a,Ul(c,a),c.subtreeFlags=0,a=m,m=c.child;m!==null;)mu(m,a),m=m.sibling;return ut(Wi,Wi.current&1|2),lt&&Da(c,b.treeForkCount),c.child}a=a.sibling}b.tail!==null&&sn()>Sf&&(c.flags|=128,E=!0,Mc(b,!1),c.lanes=4194304)}else{if(!E)if(a=Ho(I),a!==null){if(c.flags|=128,E=!0,a=a.updateQueue,c.updateQueue=a,Ul(c,a),Mc(b,!0),b.tail===null&&b.tailMode==="hidden"&&!I.alternate&&!lt)return Fn(c),null}else 2*sn()-b.renderingStartTime>Sf&&m!==536870912&&(c.flags|=128,E=!0,Mc(b,!1),c.lanes=4194304);b.isBackwards?(I.sibling=c.child,c.child=I):(a=b.last,a!==null?a.sibling=I:c.child=I,b.last=I)}return b.tail!==null?(a=b.tail,b.rendering=a,b.tail=a.sibling,b.renderingStartTime=sn(),a.sibling=null,m=Wi.current,ut(Wi,E?m&1|2:m&1),lt&&Da(c,b.treeForkCount),a):(Fn(c),null);case 22:case 23:return gr(c),Lr(),b=c.memoizedState!==null,a!==null?a.memoizedState!==null!==b&&(c.flags|=8192):b&&(c.flags|=8192),b?(m&536870912)!==0&&(c.flags&128)===0&&(Fn(c),c.subtreeFlags&6&&(c.flags|=8192)):Fn(c),m=c.updateQueue,m!==null&&Ul(c,m.retryQueue),m=null,a!==null&&a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(m=a.memoizedState.cachePool.pool),b=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(b=c.memoizedState.cachePool.pool),b!==m&&(c.flags|=2048),a!==null&&Ue(_),null;case 24:return m=null,a!==null&&(m=a.memoizedState.cache),c.memoizedState.cache!==m&&(c.flags|=2048),ya(Mn),Fn(c),null;case 25:return null;case 30:return null}throw Error(n(156,c.tag))}function Wg(a,c){switch(yu(c),c.tag){case 1:return a=c.flags,a&65536?(c.flags=a&-65537|128,c):null;case 3:return ya(Mn),ki(),a=c.flags,(a&65536)!==0&&(a&128)===0?(c.flags=a&-65537|128,c):null;case 26:case 27:case 5:return Ts(c),null;case 31:if(c.memoizedState!==null){if(gr(c),c.alternate===null)throw Error(n(340));Oa()}return a=c.flags,a&65536?(c.flags=a&-65537|128,c):null;case 13:if(gr(c),a=c.memoizedState,a!==null&&a.dehydrated!==null){if(c.alternate===null)throw Error(n(340));Oa()}return a=c.flags,a&65536?(c.flags=a&-65537|128,c):null;case 19:return Ue(Wi),null;case 4:return ki(),null;case 10:return ya(c.type),null;case 22:case 23:return gr(c),Lr(),a!==null&&Ue(_),a=c.flags,a&65536?(c.flags=a&-65537|128,c):null;case 24:return ya(Mn),null;case 25:return null;default:return null}}function Xg(a,c){switch(yu(c),c.tag){case 3:ya(Mn),ki();break;case 26:case 27:case 5:Ts(c);break;case 4:ki();break;case 31:c.memoizedState!==null&&gr(c);break;case 13:gr(c);break;case 19:Ue(Wi);break;case 10:ya(c.type);break;case 22:case 23:gr(c),Lr(),a!==null&&Ue(_);break;case 24:ya(Mn)}}function Zh(a,c){try{var m=c.updateQueue,b=m!==null?m.lastEffect:null;if(b!==null){var E=b.next;m=E;do{if((m.tag&a)===a){b=void 0;var I=m.create,V=m.inst;b=I(),V.destroy=b}m=m.next}while(m!==E)}}catch(te){ln(c,c.return,te)}}function ba(a,c,m){try{var b=c.updateQueue,E=b!==null?b.lastEffect:null;if(E!==null){var I=E.next;b=I;do{if((b.tag&a)===a){var V=b.inst,te=V.destroy;if(te!==void 0){V.destroy=void 0,E=c;var xe=m,$e=te;try{$e()}catch(et){ln(E,xe,et)}}}b=b.next}while(b!==I)}}catch(et){ln(c,c.return,et)}}function lm(a){var c=a.updateQueue;if(c!==null){var m=a.stateNode;try{Si(c,m)}catch(b){ln(a,a.return,b)}}}function qg(a,c,m){m.props=Cc(a.type,a.memoizedProps),m.state=a.memoizedState;try{m.componentWillUnmount()}catch(b){ln(a,c,b)}}function Yh(a,c){try{var m=a.ref;if(m!==null){switch(a.tag){case 26:case 27:case 5:var b=a.stateNode;break;case 30:b=a.stateNode;break;default:b=a.stateNode}typeof m=="function"?a.refCleanup=m(b):m.current=b}}catch(E){ln(a,c,E)}}function ao(a,c){var m=a.ref,b=a.refCleanup;if(m!==null)if(typeof b=="function")try{b()}catch(E){ln(a,c,E)}finally{a.refCleanup=null,a=a.alternate,a!=null&&(a.refCleanup=null)}else if(typeof m=="function")try{m(null)}catch(E){ln(a,c,E)}else m.current=null}function Zg(a){var c=a.type,m=a.memoizedProps,b=a.stateNode;try{e:switch(c){case"button":case"input":case"select":case"textarea":m.autoFocus&&b.focus();break e;case"img":m.src?b.src=m.src:m.srcSet&&(b.srcset=m.srcSet)}}catch(E){ln(a,a.return,E)}}function cm(a,c,m){try{var b=a.stateNode;Mv(b,a.type,m,c),b[hi]=c}catch(E){ln(a,a.return,E)}}function Yg(a){return a.tag===5||a.tag===3||a.tag===26||a.tag===27&&J(a.type)||a.tag===4}function xf(a){e:for(;;){for(;a.sibling===null;){if(a.return===null||Yg(a.return))return null;a=a.return}for(a.sibling.return=a.return,a=a.sibling;a.tag!==5&&a.tag!==6&&a.tag!==18;){if(a.tag===27&&J(a.type)||a.flags&2||a.child===null||a.tag===4)continue e;a.child.return=a,a=a.child}if(!(a.flags&2))return a.stateNode}}function Gh(a,c,m){var b=a.tag;if(b===5||b===6)a=a.stateNode,c?(m.nodeType===9?m.body:m.nodeName==="HTML"?m.ownerDocument.body:m).insertBefore(a,c):(c=m.nodeType===9?m.body:m.nodeName==="HTML"?m.ownerDocument.body:m,c.appendChild(a),m=m._reactRootContainer,m!=null||c.onclick!==null||(c.onclick=Xr));else if(b!==4&&(b===27&&J(a.type)&&(m=a.stateNode,c=null),a=a.child,a!==null))for(Gh(a,c,m),a=a.sibling;a!==null;)Gh(a,c,m),a=a.sibling}function Kh(a,c,m){var b=a.tag;if(b===5||b===6)a=a.stateNode,c?m.insertBefore(a,c):m.appendChild(a);else if(b!==4&&(b===27&&J(a.type)&&(m=a.stateNode),a=a.child,a!==null))for(Kh(a,c,m),a=a.sibling;a!==null;)Kh(a,c,m),a=a.sibling}function um(a){var c=a.stateNode,m=a.memoizedProps;try{for(var b=a.type,E=c.attributes;E.length;)c.removeAttributeNode(E[0]);Rr(c,b,m),c[Vt]=a,c[hi]=m}catch(I){ln(a,a.return,I)}}var oo=!1,yr=!1,ku=!1,Gg=typeof WeakSet=="function"?WeakSet:Set,Cr=null;function Tv(a,c){if(a=a.containerInfo,u=Nf,a=ko(a),cu(a)){if("selectionStart"in a)var m={start:a.selectionStart,end:a.selectionEnd};else e:{m=(m=a.ownerDocument)&&m.defaultView||window;var b=m.getSelection&&m.getSelection();if(b&&b.rangeCount!==0){m=b.anchorNode;var E=b.anchorOffset,I=b.focusNode;b=b.focusOffset;try{m.nodeType,I.nodeType}catch{m=null;break e}var V=0,te=-1,xe=-1,$e=0,et=0,st=a,We=null;t:for(;;){for(var Ze;st!==m||E!==0&&st.nodeType!==3||(te=V+E),st!==I||b!==0&&st.nodeType!==3||(xe=V+b),st.nodeType===3&&(V+=st.nodeValue.length),(Ze=st.firstChild)!==null;)We=st,st=Ze;for(;;){if(st===a)break t;if(We===m&&++$e===E&&(te=V),We===I&&++et===b&&(xe=V),(Ze=st.nextSibling)!==null)break;st=We,We=st.parentNode}st=Ze}m=te===-1||xe===-1?null:{start:te,end:xe}}else m=null}m=m||{start:0,end:0}}else m=null;for(g={focusedElem:a,selectionRange:m},Nf=!1,Cr=c;Cr!==null;)if(c=Cr,a=c.child,(c.subtreeFlags&1028)!==0&&a!==null)a.return=c,Cr=a;else for(;Cr!==null;){switch(c=Cr,I=c.alternate,a=c.flags,c.tag){case 0:if((a&4)!==0&&(a=c.updateQueue,a=a!==null?a.events:null,a!==null))for(m=0;m<a.length;m++)E=a[m],E.ref.impl=E.nextImpl;break;case 11:case 15:break;case 1:if((a&1024)!==0&&I!==null){a=void 0,m=c,E=I.memoizedProps,I=I.memoizedState,b=m.stateNode;try{var Ht=Cc(m.type,E);a=b.getSnapshotBeforeUpdate(Ht,I),b.__reactInternalSnapshotBeforeUpdate=a}catch(fi){ln(m,m.return,fi)}}break;case 3:if((a&1024)!==0){if(a=c.stateNode.containerInfo,m=a.nodeType,m===9)Be(a);else if(m===1)switch(a.nodeName){case"HEAD":case"HTML":case"BODY":Be(a);break;default:a.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((a&1024)!==0)throw Error(n(163))}if(a=c.sibling,a!==null){a.return=c.return,Cr=a;break}Cr=c.return}}function Kg(a,c,m){var b=m.flags;switch(m.tag){case 0:case 11:case 15:zs(a,m),b&4&&Zh(5,m);break;case 1:if(zs(a,m),b&4)if(a=m.stateNode,c===null)try{a.componentDidMount()}catch(V){ln(m,m.return,V)}else{var E=Cc(m.type,c.memoizedProps);c=c.memoizedState;try{a.componentDidUpdate(E,c,a.__reactInternalSnapshotBeforeUpdate)}catch(V){ln(m,m.return,V)}}b&64&&lm(m),b&512&&Yh(m,m.return);break;case 3:if(zs(a,m),b&64&&(a=m.updateQueue,a!==null)){if(c=null,m.child!==null)switch(m.child.tag){case 27:case 5:c=m.child.stateNode;break;case 1:c=m.child.stateNode}try{Si(a,c)}catch(V){ln(m,m.return,V)}}break;case 27:c===null&&b&4&&um(m);case 26:case 5:zs(a,m),c===null&&b&4&&Zg(m),b&512&&Yh(m,m.return);break;case 12:zs(a,m);break;case 31:zs(a,m),b&4&&sr(a,m);break;case 13:zs(a,m),b&4&&hm(a,m),b&64&&(a=m.memoizedState,a!==null&&(a=a.dehydrated,a!==null&&(m=c_.bind(null,m),Yt(a,m))));break;case 22:if(b=m.memoizedState!==null||oo,!b){c=c!==null&&c.memoizedState!==null||yr,E=oo;var I=yr;oo=b,(yr=c)&&!I?Jo(a,m,(m.subtreeFlags&8772)!==0):zs(a,m),oo=E,yr=I}break;case 30:break;default:zs(a,m)}}function Qg(a){var c=a.alternate;c!==null&&(a.alternate=null,Qg(c)),a.child=null,a.deletions=null,a.sibling=null,a.tag===5&&(c=a.stateNode,c!==null&&tr(c)),a.stateNode=null,a.return=null,a.dependencies=null,a.memoizedProps=null,a.memoizedState=null,a.pendingProps=null,a.stateNode=null,a.updateQueue=null}var Un=null,Ns=!1;function Qo(a,c,m){for(m=m.child;m!==null;)Bu(a,c,m),m=m.sibling}function Bu(a,c,m){if(ii&&typeof ii.onCommitFiberUnmount=="function")try{ii.onCommitFiberUnmount(bt,m)}catch{}switch(m.tag){case 26:yr||ao(m,c),Qo(a,c,m),m.memoizedState?m.memoizedState.count--:m.stateNode&&(m=m.stateNode,m.parentNode.removeChild(m));break;case 27:yr||ao(m,c);var b=Un,E=Ns;J(m.type)&&(Un=m.stateNode,Ns=!1),Qo(a,c,m),Ye(m.stateNode),Un=b,Ns=E;break;case 5:yr||ao(m,c);case 6:if(b=Un,E=Ns,Un=null,Qo(a,c,m),Un=b,Ns=E,Un!==null)if(Ns)try{(Un.nodeType===9?Un.body:Un.nodeName==="HTML"?Un.ownerDocument.body:Un).removeChild(m.stateNode)}catch(I){ln(m,c,I)}else try{Un.removeChild(m.stateNode)}catch(I){ln(m,c,I)}break;case 18:Un!==null&&(Ns?(a=Un,ce(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,m.stateNode),Uf(a)):ce(Un,m.stateNode));break;case 4:b=Un,E=Ns,Un=m.stateNode.containerInfo,Ns=!0,Qo(a,c,m),Un=b,Ns=E;break;case 0:case 11:case 14:case 15:ba(2,m,c),yr||ba(4,m,c),Qo(a,c,m);break;case 1:yr||(ao(m,c),b=m.stateNode,typeof b.componentWillUnmount=="function"&&qg(m,c,b)),Qo(a,c,m);break;case 21:Qo(a,c,m);break;case 22:yr=(b=yr)||m.memoizedState!==null,Qo(a,c,m),yr=b;break;default:Qo(a,c,m)}}function sr(a,c){if(c.memoizedState===null&&(a=c.alternate,a!==null&&(a=a.memoizedState,a!==null))){a=a.dehydrated;try{Uf(a)}catch(m){ln(c,c.return,m)}}}function hm(a,c){if(c.memoizedState===null&&(a=c.alternate,a!==null&&(a=a.memoizedState,a!==null&&(a=a.dehydrated,a!==null))))try{Uf(a)}catch(m){ln(c,c.return,m)}}function Jg(a){switch(a.tag){case 31:case 13:case 19:var c=a.stateNode;return c===null&&(c=a.stateNode=new Gg),c;case 22:return a=a.stateNode,c=a._retryCache,c===null&&(c=a._retryCache=new Gg),c;default:throw Error(n(435,a.tag))}}function Qh(a,c){var m=Jg(a);c.forEach(function(b){if(!m.has(b)){m.add(b);var E=Cv.bind(null,a,b);b.then(E,E)}})}function Ti(a,c){var m=c.deletions;if(m!==null)for(var b=0;b<m.length;b++){var E=m[b],I=a,V=c,te=V;e:for(;te!==null;){switch(te.tag){case 27:if(J(te.type)){Un=te.stateNode,Ns=!1;break e}break;case 5:Un=te.stateNode,Ns=!1;break e;case 3:case 4:Un=te.stateNode.containerInfo,Ns=!0;break e}te=te.return}if(Un===null)throw Error(n(160));Bu(I,V,E),Un=null,Ns=!1,I=E.alternate,I!==null&&(I.return=null),E.return=null}if(c.subtreeFlags&13886)for(c=c.child;c!==null;)dm(c,a),c=c.sibling}var ea=null;function dm(a,c){var m=a.alternate,b=a.flags;switch(a.tag){case 0:case 11:case 14:case 15:Ti(c,a),ys(a),b&4&&(ba(3,a,a.return),Zh(3,a),ba(5,a,a.return));break;case 1:Ti(c,a),ys(a),b&512&&(yr||m===null||ao(m,m.return)),b&64&&oo&&(a=a.updateQueue,a!==null&&(b=a.callbacks,b!==null&&(m=a.shared.hiddenCallbacks,a.shared.hiddenCallbacks=m===null?b:m.concat(b))));break;case 26:var E=ea;if(Ti(c,a),ys(a),b&512&&(yr||m===null||ao(m,m.return)),b&4){var I=m!==null?m.memoizedState:null;if(b=a.memoizedState,m===null)if(b===null)if(a.stateNode===null){e:{b=a.type,m=a.memoizedProps,E=E.ownerDocument||E;t:switch(b){case"title":I=E.getElementsByTagName("title")[0],(!I||I[Ji]||I[Vt]||I.namespaceURI==="http://www.w3.org/2000/svg"||I.hasAttribute("itemprop"))&&(I=E.createElement(b),E.head.insertBefore(I,E.querySelector("head > title"))),Rr(I,b,m),I[Vt]=a,nr(I),b=I;break e;case"link":var V=ja("link","href",E).get(b+(m.href||""));if(V){for(var te=0;te<V.length;te++)if(I=V[te],I.getAttribute("href")===(m.href==null||m.href===""?null:m.href)&&I.getAttribute("rel")===(m.rel==null?null:m.rel)&&I.getAttribute("title")===(m.title==null?null:m.title)&&I.getAttribute("crossorigin")===(m.crossOrigin==null?null:m.crossOrigin)){V.splice(te,1);break t}}I=E.createElement(b),Rr(I,b,m),E.head.appendChild(I);break;case"meta":if(V=ja("meta","content",E).get(b+(m.content||""))){for(te=0;te<V.length;te++)if(I=V[te],I.getAttribute("content")===(m.content==null?null:""+m.content)&&I.getAttribute("name")===(m.name==null?null:m.name)&&I.getAttribute("property")===(m.property==null?null:m.property)&&I.getAttribute("http-equiv")===(m.httpEquiv==null?null:m.httpEquiv)&&I.getAttribute("charset")===(m.charSet==null?null:m.charSet)){V.splice(te,1);break t}}I=E.createElement(b),Rr(I,b,m),E.head.appendChild(I);break;default:throw Error(n(468,b))}I[Vt]=a,nr(I),b=I}a.stateNode=b}else ra(E,a.type,a.stateNode);else a.stateNode=yn(E,b,a.memoizedProps);else I!==b?(I===null?m.stateNode!==null&&(m=m.stateNode,m.parentNode.removeChild(m)):I.count--,b===null?ra(E,a.type,a.stateNode):yn(E,b,a.memoizedProps)):b===null&&a.stateNode!==null&&cm(a,a.memoizedProps,m.memoizedProps)}break;case 27:Ti(c,a),ys(a),b&512&&(yr||m===null||ao(m,m.return)),m!==null&&b&4&&cm(a,a.memoizedProps,m.memoizedProps);break;case 5:if(Ti(c,a),ys(a),b&512&&(yr||m===null||ao(m,m.return)),a.flags&32){E=a.stateNode;try{Ta(E,"")}catch(Ht){ln(a,a.return,Ht)}}b&4&&a.stateNode!=null&&(E=a.memoizedProps,cm(a,E,m!==null?m.memoizedProps:E)),b&1024&&(ku=!0);break;case 6:if(Ti(c,a),ys(a),b&4){if(a.stateNode===null)throw Error(n(162));b=a.memoizedProps,m=a.stateNode;try{m.nodeValue=b}catch(Ht){ln(a,a.return,Ht)}}break;case 3:if(na=null,E=ea,ea=ri(c.containerInfo),Ti(c,a),ea=E,ys(a),b&4&&m!==null&&m.memoizedState.isDehydrated)try{Uf(c.containerInfo)}catch(Ht){ln(a,a.return,Ht)}ku&&(ku=!1,lo(a));break;case 4:b=ea,ea=ri(a.stateNode.containerInfo),Ti(c,a),ys(a),ea=b;break;case 12:Ti(c,a),ys(a);break;case 31:Ti(c,a),ys(a),b&4&&(b=a.updateQueue,b!==null&&(a.updateQueue=null,Qh(a,b)));break;case 13:Ti(c,a),ys(a),a.child.flags&8192&&a.memoizedState!==null!=(m!==null&&m.memoizedState!==null)&&(Vu=sn()),b&4&&(b=a.updateQueue,b!==null&&(a.updateQueue=null,Qh(a,b)));break;case 22:E=a.memoizedState!==null;var xe=m!==null&&m.memoizedState!==null,$e=oo,et=yr;if(oo=$e||E,yr=et||xe,Ti(c,a),yr=et,oo=$e,ys(a),b&8192)e:for(c=a.stateNode,c._visibility=E?c._visibility&-2:c._visibility|1,E&&(m===null||xe||oo||yr||jl(a)),m=null,c=a;;){if(c.tag===5||c.tag===26){if(m===null){xe=m=c;try{if(I=xe.stateNode,E)V=I.style,typeof V.setProperty=="function"?V.setProperty("display","none","important"):V.display="none";else{te=xe.stateNode;var st=xe.memoizedProps.style,We=st!=null&&st.hasOwnProperty("display")?st.display:null;te.style.display=We==null||typeof We=="boolean"?"":(""+We).trim()}}catch(Ht){ln(xe,xe.return,Ht)}}}else if(c.tag===6){if(m===null){xe=c;try{xe.stateNode.nodeValue=E?"":xe.memoizedProps}catch(Ht){ln(xe,xe.return,Ht)}}}else if(c.tag===18){if(m===null){xe=c;try{var Ze=xe.stateNode;E?fe(Ze,!0):fe(xe.stateNode,!1)}catch(Ht){ln(xe,xe.return,Ht)}}}else if((c.tag!==22&&c.tag!==23||c.memoizedState===null||c===a)&&c.child!==null){c.child.return=c,c=c.child;continue}if(c===a)break e;for(;c.sibling===null;){if(c.return===null||c.return===a)break e;m===c&&(m=null),c=c.return}m===c&&(m=null),c.sibling.return=c.return,c=c.sibling}b&4&&(b=a.updateQueue,b!==null&&(m=b.retryQueue,m!==null&&(b.retryQueue=null,Qh(a,m))));break;case 19:Ti(c,a),ys(a),b&4&&(b=a.updateQueue,b!==null&&(a.updateQueue=null,Qh(a,b)));break;case 30:break;case 21:break;default:Ti(c,a),ys(a)}}function ys(a){var c=a.flags;if(c&2){try{for(var m,b=a.return;b!==null;){if(Yg(b)){m=b;break}b=b.return}if(m==null)throw Error(n(160));switch(m.tag){case 27:var E=m.stateNode,I=xf(a);Kh(a,I,E);break;case 5:var V=m.stateNode;m.flags&32&&(Ta(V,""),m.flags&=-33);var te=xf(a);Kh(a,te,V);break;case 3:case 4:var xe=m.stateNode.containerInfo,$e=xf(a);Gh(a,$e,xe);break;default:throw Error(n(161))}}catch(et){ln(a,a.return,et)}a.flags&=-3}c&4096&&(a.flags&=-4097)}function lo(a){if(a.subtreeFlags&1024)for(a=a.child;a!==null;){var c=a;lo(c),c.tag===5&&c.flags&1024&&c.stateNode.reset(),a=a.sibling}}function zs(a,c){if(c.subtreeFlags&8772)for(c=c.child;c!==null;)Kg(a,c.alternate,c),c=c.sibling}function jl(a){for(a=a.child;a!==null;){var c=a;switch(c.tag){case 0:case 11:case 14:case 15:ba(4,c,c.return),jl(c);break;case 1:ao(c,c.return);var m=c.stateNode;typeof m.componentWillUnmount=="function"&&qg(c,c.return,m),jl(c);break;case 27:Ye(c.stateNode);case 26:case 5:ao(c,c.return),jl(c);break;case 22:c.memoizedState===null&&jl(c);break;case 30:jl(c);break;default:jl(c)}a=a.sibling}}function Jo(a,c,m){for(m=m&&(c.subtreeFlags&8772)!==0,c=c.child;c!==null;){var b=c.alternate,E=a,I=c,V=I.flags;switch(I.tag){case 0:case 11:case 15:Jo(E,I,m),Zh(4,I);break;case 1:if(Jo(E,I,m),b=I,E=b.stateNode,typeof E.componentDidMount=="function")try{E.componentDidMount()}catch($e){ln(b,b.return,$e)}if(b=I,E=b.updateQueue,E!==null){var te=b.stateNode;try{var xe=E.shared.hiddenCallbacks;if(xe!==null)for(E.shared.hiddenCallbacks=null,E=0;E<xe.length;E++)mi(xe[E],te)}catch($e){ln(b,b.return,$e)}}m&&V&64&&lm(I),Yh(I,I.return);break;case 27:um(I);case 26:case 5:Jo(E,I,m),m&&b===null&&V&4&&Zg(I),Yh(I,I.return);break;case 12:Jo(E,I,m);break;case 31:Jo(E,I,m),m&&V&4&&sr(E,I);break;case 13:Jo(E,I,m),m&&V&4&&hm(E,I);break;case 22:I.memoizedState===null&&Jo(E,I,m),Yh(I,I.return);break;case 30:break;default:Jo(E,I,m)}c=c.sibling}}function fm(a,c){var m=null;a!==null&&a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(m=a.memoizedState.cachePool.pool),a=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(a=c.memoizedState.cachePool.pool),a!==m&&(a!=null&&a.refCount++,m!=null&&Ba(m))}function pm(a,c){a=null,c.alternate!==null&&(a=c.alternate.memoizedState.cache),c=c.memoizedState.cache,c!==a&&(c.refCount++,a!=null&&Ba(a))}function Fa(a,c,m,b){if(c.subtreeFlags&10256)for(c=c.child;c!==null;)e_(a,c,m,b),c=c.sibling}function e_(a,c,m,b){var E=c.flags;switch(c.tag){case 0:case 11:case 15:Fa(a,c,m,b),E&2048&&Zh(9,c);break;case 1:Fa(a,c,m,b);break;case 3:Fa(a,c,m,b),E&2048&&(a=null,c.alternate!==null&&(a=c.alternate.memoizedState.cache),c=c.memoizedState.cache,c!==a&&(c.refCount++,a!=null&&Ba(a)));break;case 12:if(E&2048){Fa(a,c,m,b),a=c.stateNode;try{var I=c.memoizedProps,V=I.id,te=I.onPostCommit;typeof te=="function"&&te(V,c.alternate===null?"mount":"update",a.passiveEffectDuration,-0)}catch(xe){ln(c,c.return,xe)}}else Fa(a,c,m,b);break;case 31:Fa(a,c,m,b);break;case 13:Fa(a,c,m,b);break;case 23:break;case 22:I=c.stateNode,V=c.alternate,c.memoizedState!==null?I._visibility&2?Fa(a,c,m,b):Jh(a,c):I._visibility&2?Fa(a,c,m,b):(I._visibility|=2,Nu(a,c,m,b,(c.subtreeFlags&10256)!==0||!1)),E&2048&&fm(V,c);break;case 24:Fa(a,c,m,b),E&2048&&pm(c.alternate,c);break;default:Fa(a,c,m,b)}}function Nu(a,c,m,b,E){for(E=E&&((c.subtreeFlags&10256)!==0||!1),c=c.child;c!==null;){var I=a,V=c,te=m,xe=b,$e=V.flags;switch(V.tag){case 0:case 11:case 15:Nu(I,V,te,xe,E),Zh(8,V);break;case 23:break;case 22:var et=V.stateNode;V.memoizedState!==null?et._visibility&2?Nu(I,V,te,xe,E):Jh(I,V):(et._visibility|=2,Nu(I,V,te,xe,E)),E&&$e&2048&&fm(V.alternate,V);break;case 24:Nu(I,V,te,xe,E),E&&$e&2048&&pm(V.alternate,V);break;default:Nu(I,V,te,xe,E)}c=c.sibling}}function Jh(a,c){if(c.subtreeFlags&10256)for(c=c.child;c!==null;){var m=a,b=c,E=b.flags;switch(b.tag){case 22:Jh(m,b),E&2048&&fm(b.alternate,b);break;case 24:Jh(m,b),E&2048&&pm(b.alternate,b);break;default:Jh(m,b)}c=c.sibling}}var ed=8192;function zu(a,c,m){if(a.subtreeFlags&ed)for(a=a.child;a!==null;)td(a,c,m),a=a.sibling}function td(a,c,m){switch(a.tag){case 26:zu(a,c,m),a.flags&ed&&a.memoizedState!==null&&tl(m,ea,a.memoizedState,a.memoizedProps);break;case 5:zu(a,c,m);break;case 3:case 4:var b=ea;ea=ri(a.stateNode.containerInfo),zu(a,c,m),ea=b;break;case 22:a.memoizedState===null&&(b=a.alternate,b!==null&&b.memoizedState!==null?(b=ed,ed=16777216,zu(a,c,m),ed=b):zu(a,c,m));break;default:zu(a,c,m)}}function Pc(a){var c=a.alternate;if(c!==null&&(a=c.child,a!==null)){c.child=null;do c=a.sibling,a.sibling=null,a=c;while(a!==null)}}
vendor: 38,880 bytes, lines 48-49
48function Lu(a){var c=a.deletions;if((a.flags&16)!==0){if(c!==null)for(var m=0;m<c.length;m++){var b=c[m];Cr=b,t_(b,a)}Pc(a)}if(a.subtreeFlags&10256)for(a=a.child;a!==null;)wf(a),a=a.sibling}function wf(a){switch(a.tag){case 0:case 11:case 15:Lu(a),a.flags&2048&&ba(9,a,a.return);break;case 3:Lu(a);break;case 12:Lu(a);break;case 22:var c=a.stateNode;a.memoizedState!==null&&c._visibility&2&&(a.return===null||a.return.tag!==13)?(c._visibility&=-3,Fu(a)):Lu(a);break;default:Lu(a)}}function Fu(a){var c=a.deletions;if((a.flags&16)!==0){if(c!==null)for(var m=0;m<c.length;m++){var b=c[m];Cr=b,t_(b,a)}Pc(a)}for(a=a.child;a!==null;){switch(c=a,c.tag){case 0:case 11:case 15:ba(8,c,c.return),Fu(c);break;case 22:m=c.stateNode,m._visibility&2&&(m._visibility&=-3,Fu(c));break;default:Fu(c)}a=a.sibling}}function t_(a,c){for(;Cr!==null;){var m=Cr;switch(m.tag){case 0:case 11:case 15:ba(8,m,c);break;case 23:case 22:if(m.memoizedState!==null&&m.memoizedState.cachePool!==null){var b=m.memoizedState.cachePool.pool;b!=null&&b.refCount++}break;case 24:Ba(m.memoizedState.cache)}if(b=m.child,b!==null)b.return=m,Cr=b;else e:for(m=a;Cr!==null;){b=Cr;var E=b.sibling,I=b.return;if(Qg(b),b===m){Cr=null;break e}if(E!==null){E.return=I,Cr=E;break e}Cr=I}}}var Sv={getCacheForType:function(a){var c=xi(Mn),m=c.data.get(a);return m===void 0&&(m=a(),c.data.set(a,m)),m},cacheSignal:function(){return xi(Mn).controller.signal}},Av=typeof WeakMap=="function"?WeakMap:Map,Qi=0,Sn=null,ci=null,Ni=0,on=0,vr=null,xa=!1,co=!1,Vl=!1,wa=0,jn=0,$l=0,Ic=0,Tf=0,Ls=0,Uu=0,ju=null,vs=null,id=!1,Vu=0,i_=0,Sf=1/0,nd=null,el=null,Jn=0,Gr=null,ta=null,uo=0,rd=0,mm=null,n_=null,Hl=0,sd=null;function ia(){return(Qi&2)!==0&&Ni!==0?Ni&-Ni:Le.T!==null?Zu():jt()}function Af(){if(Ls===0)if((Ni&536870912)===0||lt){var a=Xs;Xs<<=1,(Xs&3932160)===0&&(Xs=262144),Ls=a}else Ls=536870912;return a=pn.current,a!==null&&(a.flags|=32),Ls}function ls(a,c,m){(a===Sn&&(on===2||on===9)||a.cancelPendingCommit!==null)&&(Oc(a,0),ho(a,Ni,Ls,!1)),Me(a,m),((Qi&2)===0||a!==Sn)&&(a===Sn&&((Qi&2)===0&&(Ic|=m),jn===4&&ho(a,Ni,Ls,!1)),fo(a))}function Dc(a,c,m){if((Qi&6)!==0)throw Error(n(327));var b=!m&&(c&127)===0&&(c&a.expiredLanes)===0||X(a,c),E=b?vm(a,c):ym(a,c,!0),I=b;do{if(E===0){co&&!b&&ho(a,c,0,!1);break}else{if(m=a.current.alternate,I&&!r_(m)){E=ym(a,c,!1),I=!1;continue}if(E===2){if(I=c,a.errorRecoveryDisabledLanes&I)var V=0;else V=a.pendingLanes&-536870913,V=V!==0?V:V&536870912?536870912:0;if(V!==0){c=V;e:{var te=a;E=ju;var xe=te.current.memoizedState.isDehydrated;if(xe&&(Oc(te,V).flags|=256),V=ym(te,V,!1),V!==2){if(Vl&&!xe){te.errorRecoveryDisabledLanes|=I,Ic|=I,E=4;break e}I=vs,vs=E,I!==null&&(vs===null?vs=I:vs.push.apply(vs,I))}E=V}if(I=!1,E!==2)continue}}if(E===1){Oc(a,0),ho(a,c,0,!0);break}e:{switch(b=a,I=E,I){case 0:case 1:throw Error(n(345));case 4:if((c&4194048)!==c)break;case 6:ho(b,c,Ls,!xa);break e;case 2:vs=null;break;case 3:case 5:break;default:throw Error(n(329))}if((c&62914560)===c&&(E=Vu+300-sn(),10<E)){if(ho(b,c,Ls,!xa),q(b,0,!0)!==0)break e;uo=c,b.timeoutHandle=z(gm.bind(null,b,m,vs,nd,id,c,Ls,Ic,Uu,xa,I,"Throttled",-0,0),E);break e}gm(b,m,vs,nd,id,c,Ls,Ic,Uu,xa,I,null,-0,0)}}break}while(!0);fo(a)}function gm(a,c,m,b,E,I,V,te,xe,$e,et,st,We,Ze){if(a.timeoutHandle=-1,st=c.subtreeFlags,st&8192||(st&16785408)===16785408){st={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Xr},td(c,I,st);var Ht=(I&62914560)===I?Vu-sn():(I&4194048)===I?i_-sn():0;if(Ht=m_(st,Ht),Ht!==null){uo=I,a.cancelPendingCommit=Ht(Cf.bind(null,a,c,I,m,b,E,V,te,xe,et,st,null,We,Ze)),ho(a,I,V,!$e);return}}Cf(a,c,I,m,b,E,V,te,xe)}function r_(a){for(var c=a;;){var m=c.tag;if((m===0||m===11||m===15)&&c.flags&16384&&(m=c.updateQueue,m!==null&&(m=m.stores,m!==null)))for(var b=0;b<m.length;b++){var E=m[b],I=E.getSnapshot;E=E.value;try{if(!Zr(I(),E))return!1}catch{return!1}}if(m=c.child,c.subtreeFlags&16384&&m!==null)m.return=c,c=m;else{if(c===a)break;for(;c.sibling===null;){if(c.return===null||c.return===a)return!0;c=c.return}c.sibling.return=c.return,c=c.sibling}}return!0}function ho(a,c,m,b){c&=~Tf,c&=~Ic,a.suspendedLanes|=c,a.pingedLanes&=~c,b&&(a.warmLanes|=c),b=a.expirationTimes;for(var E=c;0<E;){var I=31-xn(E),V=1<<I;b[I]=-1,E&=~V}m!==0&&ye(a,m,c)}function ad(){return(Qi&6)===0?(Xu(0),!1):!0}function $u(){if(ci!==null){if(on===0)var a=ci.return;else a=ci,ga=Ps=null,Il(a),ge=null,be=0,a=ci;for(;a!==null;)Xg(a.alternate,a),a=a.return;ci=null}}function Oc(a,c){var m=a.timeoutHandle;m!==-1&&(a.timeoutHandle=-1,U(m)),m=a.cancelPendingCommit,m!==null&&(a.cancelPendingCommit=null,m()),uo=0,$u(),Sn=a,ci=m=Ms(a.current,null),Ni=c,on=0,vr=null,xa=!1,co=X(a,c),Vl=!1,Uu=Ls=Tf=Ic=$l=jn=0,vs=ju=null,id=!1,(c&8)!==0&&(c|=c&32);var b=a.entangledLanes;if(b!==0)for(a=a.entanglements,b&=c;0<b;){var E=31-xn(b),I=1<<E;c|=a[E],b&=~I}return wa=c,ns(),m}function s_(a,c){oi=null,Le.H=$h,c===D||c===L?(c=he(),on=3):c===O?(c=he(),on=4):on=c===Ln?8:c!==null&&typeof c=="object"&&typeof c.then=="function"?6:1,vr=c,ci===null&&(jn=1,gf(a,ss(c,a.current)))}function a_(){var a=pn.current;return a===null?!0:(Ni&4194048)===Ni?mn===null:(Ni&62914560)===Ni||(Ni&536870912)!==0?a===mn:!1}function _m(){var a=Le.H;return Le.H=$h,a===null?$h:a}function o_(){var a=Le.A;return Le.A=Sv,a}function Ef(){jn=4,xa||(Ni&4194048)!==Ni&&pn.current!==null||(co=!0),($l&134217727)===0&&(Ic&134217727)===0||Sn===null||ho(Sn,Ni,Ls,!1)}function ym(a,c,m){var b=Qi;Qi|=2;var E=_m(),I=o_();(Sn!==a||Ni!==c)&&(nd=null,Oc(a,c)),c=!1;var V=jn;e:do try{if(on!==0&&ci!==null){var te=ci,xe=vr;switch(on){case 8:$u(),V=6;break e;case 3:case 2:case 9:case 6:pn.current===null&&(c=!0);var $e=on;if(on=0,vr=null,kc(a,te,xe,$e),m&&co){V=0;break e}break;default:$e=on,on=0,vr=null,kc(a,te,xe,$e)}}Ev(),V=jn;break}catch(et){s_(a,et)}while(!0);return c&&a.shellSuspendCounter++,ga=Ps=null,Qi=b,Le.H=E,Le.A=I,ci===null&&(Sn=null,Ni=0,ns()),V}function Ev(){for(;ci!==null;)bm(ci)}function vm(a,c){var m=Qi;Qi|=2;var b=_m(),E=o_();Sn!==a||Ni!==c?(nd=null,Sf=sn()+500,Oc(a,c)):co=X(a,c);e:do try{if(on!==0&&ci!==null){c=ci;var I=vr;t:switch(on){case 1:on=0,vr=null,kc(a,c,I,1);break;case 2:case 9:if(H(I)){on=0,vr=null,xm(c);break}c=function(){on!==2&&on!==9||Sn!==a||(on=7),fo(a)},I.then(c,c);break e;case 3:on=7;break e;case 4:on=5;break e;case 7:H(I)?(on=0,vr=null,xm(c)):(on=0,vr=null,kc(a,c,I,7));break;case 5:var V=null;switch(ci.tag){case 26:V=ci.memoizedState;case 5:case 27:var te=ci;if(V?Sr(V):te.stateNode.complete){on=0,vr=null;var xe=te.sibling;if(xe!==null)ci=xe;else{var $e=te.return;$e!==null?(ci=$e,od($e)):ci=null}break t}}on=0,vr=null,kc(a,c,I,5);break;case 6:on=0,vr=null,kc(a,c,I,6);break;case 8:$u(),jn=6;break e;default:throw Error(n(462))}}Wl();break}catch(et){s_(a,et)}while(!0);return ga=Ps=null,Le.H=b,Le.A=E,Qi=m,ci!==null?0:(Sn=null,Ni=0,ns(),jn)}function Wl(){for(;ci!==null&&!or();)bm(ci)}function bm(a){var c=Hg(a.alternate,a,wa);a.memoizedProps=a.pendingProps,c===null?od(a):ci=c}function xm(a){var c=a,m=c.alternate;switch(c.tag){case 15:case 0:c=tm(m,c,c.pendingProps,c.type,void 0,Ni);break;case 11:c=tm(m,c,c.pendingProps,c.type.render,c.ref,Ni);break;case 5:Il(c);default:Xg(m,c),c=ci=mu(c,wa),c=Hg(m,c,wa)}a.memoizedProps=a.pendingProps,c===null?od(a):ci=c}function kc(a,c,m,b){ga=Ps=null,Il(c),ge=null,be=0;var E=c.return;try{if(bv(a,E,c,m,Ni)){jn=1,gf(a,ss(m,a.current)),ci=null;return}}catch(I){if(E!==null)throw ci=E,I;jn=1,gf(a,ss(m,a.current)),ci=null;return}c.flags&32768?(lt||b===1?a=!0:co||(Ni&536870912)!==0?a=!1:(xa=a=!0,(b===2||b===9||b===3||b===6)&&(b=pn.current,b!==null&&b.tag===13&&(b.flags|=16384))),wm(c,a)):od(c)}function od(a){var c=a;do{if((c.flags&32768)!==0){wm(c,xa);return}a=c.return;var m=wv(c.alternate,c,wa);if(m!==null){ci=m;return}if(c=c.sibling,c!==null){ci=c;return}ci=c=a}while(c!==null);jn===0&&(jn=5)}function wm(a,c){do{var m=Wg(a.alternate,a);if(m!==null){m.flags&=32767,ci=m;return}if(m=a.return,m!==null&&(m.flags|=32768,m.subtreeFlags=0,m.deletions=null),!c&&(a=a.sibling,a!==null)){ci=a;return}ci=a=m}while(a!==null);jn=6,ci=null}function Cf(a,c,m,b,E,I,V,te,xe){a.cancelPendingCommit=null;do cs();while(Jn!==0);if((Qi&6)!==0)throw Error(n(327));if(c!==null){if(c===a.current)throw Error(n(177));if(I=c.lanes|c.childLanes,I|=Rn,ke(a,m,I,V,te,xe),a===Sn&&(ci=Sn=null,Ni=0),ta=c,Gr=a,uo=m,rd=I,mm=E,n_=b,(c.subtreeFlags&10256)!==0||(c.flags&10256)!==0?(a.callbackNode=null,a.callbackPriority=0,u_(pt,function(){return Wu(),null})):(a.callbackNode=null,a.callbackPriority=0),b=(c.flags&13878)!==0,(c.subtreeFlags&13878)!==0||b){b=Le.T,Le.T=null,E=nt.p,nt.p=2,V=Qi,Qi|=4;try{Tv(a,c,m)}finally{Qi=V,nt.p=E,Le.T=b}}Jn=1,Hu(),Tm(),Rf()}}function Hu(){if(Jn===1){Jn=0;var a=Gr,c=ta,m=(c.flags&13878)!==0;if((c.subtreeFlags&13878)!==0||m){m=Le.T,Le.T=null;var b=nt.p;nt.p=2;var E=Qi;Qi|=4;try{dm(c,a);var I=g,V=ko(a.containerInfo),te=I.focusedElem,xe=I.selectionRange;if(V!==te&&te&&te.ownerDocument&&Mh(te.ownerDocument.documentElement,te)){if(xe!==null&&cu(te)){var $e=xe.start,et=xe.end;if(et===void 0&&(et=$e),"selectionStart"in te)te.selectionStart=$e,te.selectionEnd=Math.min(et,te.value.length);else{var st=te.ownerDocument||document,We=st&&st.defaultView||window;if(We.getSelection){var Ze=We.getSelection(),Ht=te.textContent.length,fi=Math.min(xe.start,Ht),Pn=xe.end===void 0?fi:Math.min(xe.end,Ht);!Ze.extend&&fi>Pn&&(V=Pn,Pn=fi,fi=V);var Ne=tf(te,fi),Pe=tf(te,Pn);if(Ne&&Pe&&(Ze.rangeCount!==1||Ze.anchorNode!==Ne.node||Ze.anchorOffset!==Ne.offset||Ze.focusNode!==Pe.node||Ze.focusOffset!==Pe.offset)){var Ve=st.createRange();Ve.setStart(Ne.node,Ne.offset),Ze.removeAllRanges(),fi>Pn?(Ze.addRange(Ve),Ze.extend(Pe.node,Pe.offset)):(Ve.setEnd(Pe.node,Pe.offset),Ze.addRange(Ve))}}}}for(st=[],Ze=te;Ze=Ze.parentNode;)Ze.nodeType===1&&st.push({element:Ze,left:Ze.scrollLeft,top:Ze.scrollTop});for(typeof te.focus=="function"&&te.focus(),te=0;te<st.length;te++){var it=st[te];it.element.scrollLeft=it.left,it.element.scrollTop=it.top}}Nf=!!u,g=u=null}finally{Qi=E,nt.p=b,Le.T=m}}a.current=c,Jn=2}}function Tm(){if(Jn===2){Jn=0;var a=Gr,c=ta,m=(c.flags&8772)!==0;if((c.subtreeFlags&8772)!==0||m){m=Le.T,Le.T=null;var b=nt.p;nt.p=2;var E=Qi;Qi|=4;try{Kg(a,c.alternate,c)}finally{Qi=E,nt.p=b,Le.T=m}}Jn=3}}function Rf(){if(Jn===4||Jn===3){Jn=0,vn();var a=Gr,c=ta,m=uo,b=n_;(c.subtreeFlags&10256)!==0||(c.flags&10256)!==0?Jn=5:(Jn=0,ta=Gr=null,Sm(a,a.pendingLanes));var E=a.pendingLanes;if(E===0&&(el=null),yt(m),c=c.stateNode,ii&&typeof ii.onCommitFiberRoot=="function")try{ii.onCommitFiberRoot(bt,c,void 0,(c.current.flags&128)===128)}catch{}if(b!==null){c=Le.T,E=nt.p,nt.p=2,Le.T=null;try{for(var I=a.onRecoverableError,V=0;V<b.length;V++){var te=b[V];I(te.value,{componentStack:te.stack})}}finally{Le.T=c,nt.p=E}}(uo&3)!==0&&cs(),fo(a),E=a.pendingLanes,(m&261930)!==0&&(E&42)!==0?a===sd?Hl++:(Hl=0,sd=a):Hl=0,Xu(0)}}function Sm(a,c){(a.pooledCacheLanes&=c)===0&&(c=a.pooledCache,c!=null&&(a.pooledCache=null,Ba(c)))}function cs(){return Hu(),Tm(),Rf(),Wu()}function Wu(){if(Jn!==5)return!1;var a=Gr,c=rd;rd=0;var m=yt(uo),b=Le.T,E=nt.p;try{nt.p=32>m?32:m,Le.T=null,m=mm,mm=null;var I=Gr,V=uo;if(Jn=0,ta=Gr=null,uo=0,(Qi&6)!==0)throw Error(n(331));var te=Qi;if(Qi|=4,wf(I.current),e_(I,I.current,V,m),Qi=te,Xu(0,!1),ii&&typeof ii.onPostCommitFiberRoot=="function")try{ii.onPostCommitFiberRoot(bt,I)}catch{}return!0}finally{nt.p=E,Le.T=b,Sm(a,c)}}function Am(a,c,m){c=ss(m,c),c=Hh(a.stateNode,c,2),a=Ot(a,c,2),a!==null&&(Me(a,2),fo(a))}function ln(a,c,m){if(a.tag===3)Am(a,a,m);else for(;c!==null;){if(c.tag===3){Am(c,a,m);break}else if(c.tag===1){var b=c.stateNode;if(typeof c.type.getDerivedStateFromError=="function"||typeof b.componentDidCatch=="function"&&(el===null||!el.has(b))){a=ss(m,a),m=Fg(2),b=Ot(c,m,2),b!==null&&(Rc(m,b,c,a),Me(b,2),fo(b));break}}c=c.return}}function Mf(a,c,m){var b=a.pingCache;if(b===null){b=a.pingCache=new Av;var E=new Set;b.set(c,E)}else E=b.get(c),E===void 0&&(E=new Set,b.set(c,E));E.has(m)||(Vl=!0,E.add(m),a=l_.bind(null,a,c,m),c.then(a,a))}function l_(a,c,m){var b=a.pingCache;b!==null&&b.delete(c),a.pingedLanes|=a.suspendedLanes&m,a.warmLanes&=~m,Sn===a&&(Ni&m)===m&&(jn===4||jn===3&&(Ni&62914560)===Ni&&300>sn()-Vu?(Qi&2)===0&&Oc(a,0):Tf|=m,Uu===Ni&&(Uu=0)),fo(a)}function Em(a,c){c===0&&(c=ue()),a=Ma(a,c),a!==null&&(Me(a,c),fo(a))}function c_(a){var c=a.memoizedState,m=0;c!==null&&(m=c.retryLane),Em(a,m)}function Cv(a,c){var m=0;switch(a.tag){case 31:case 13:var b=a.stateNode,E=a.memoizedState;E!==null&&(m=E.retryLane);break;case 19:b=a.stateNode;break;case 22:b=a.stateNode._retryCache;break;default:throw Error(n(314))}b!==null&&b.delete(c),Em(a,m)}function u_(a,c){return Ri(a,c)}var Ua=null,Bc=null,Pf=!1,ld=!1,If=!1,Xl=0;function fo(a){a!==Bc&&a.next===null&&(Bc===null?Ua=Bc=a:Bc=Bc.next=a),ld=!0,Pf||(Pf=!0,Df())}function Xu(a,c){if(!If&&ld){If=!0;do for(var m=!1,b=Ua;b!==null;){if(a!==0){var E=b.pendingLanes;if(E===0)var I=0;else{var V=b.suspendedLanes,te=b.pingedLanes;I=(1<<31-xn(42|a)+1)-1,I&=E&~(V&~te),I=I&201326741?I&201326741|1:I?I|2:0}I!==0&&(m=!0,ud(b,I))}else I=Ni,I=q(b,b===Sn?I:0,b.cancelPendingCommit!==null||b.timeoutHandle!==-1),(I&3)===0||X(b,I)||(m=!0,ud(b,I));b=b.next}while(m);If=!1}}function qu(){Cm()}function Cm(){ld=Pf=!1;var a=0;Xl!==0&&k()&&(a=Xl);for(var c=sn(),m=null,b=Ua;b!==null;){var E=b.next,I=cd(b,c);I===0?(b.next=null,m===null?Ua=E:m.next=E,E===null&&(Bc=m)):(m=b,(a!==0||(I&3)!==0)&&(ld=!0)),b=E}Jn!==0&&Jn!==5||Xu(a),Xl!==0&&(Xl=0)}function cd(a,c){for(var m=a.suspendedLanes,b=a.pingedLanes,E=a.expirationTimes,I=a.pendingLanes&-62914561;0<I;){var V=31-xn(I),te=1<<V,xe=E[V];xe===-1?((te&m)===0||(te&b)!==0)&&(E[V]=ie(te,c)):xe<=c&&(a.expiredLanes|=te),I&=~te}if(c=Sn,m=Ni,m=q(a,a===c?m:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),b=a.callbackNode,m===0||a===c&&(on===2||on===9)||a.cancelPendingCommit!==null)return b!==null&&b!==null&&Gi(b),a.callbackNode=null,a.callbackPriority=0;if((m&3)===0||X(a,m)){if(c=m&-m,c===a.callbackPriority)return c;switch(b!==null&&Gi(b),yt(m)){case 2:case 8:m=Ss;break;case 32:m=pt;break;case 268435456:m=Ir;break;default:m=pt}return b=Rm.bind(null,a),m=Ri(m,b),a.callbackPriority=c,a.callbackNode=m,c}return b!==null&&b!==null&&Gi(b),a.callbackPriority=2,a.callbackNode=null,2}function Rm(a,c){if(Jn!==0&&Jn!==5)return a.callbackNode=null,a.callbackPriority=0,null;var m=a.callbackNode;if(cs()&&a.callbackNode!==m)return null;var b=Ni;return b=q(a,a===Sn?b:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),b===0?null:(Dc(a,b,c),cd(a,sn()),a.callbackNode!=null&&a.callbackNode===m?Rm.bind(null,a):null)}function ud(a,c){if(cs())return null;Dc(a,c,!0)}function Df(){Z(function(){(Qi&6)!==0?Ri(lr,qu):Cm()})}function Zu(){if(Xl===0){var a=Na;a===0&&(a=As,As<<=1,(As&261888)===0&&(As=256)),Xl=a}return Xl}function h_(a){return a==null||typeof a=="symbol"||typeof a=="boolean"?null:typeof a=="function"?a:Kc(""+a)}function d_(a,c){var m=c.ownerDocument.createElement("input");return m.name=c.name,m.value=c.value,a.id&&m.setAttribute("form",a.id),c.parentNode.insertBefore(m,c),a=new FormData(a),m.parentNode.removeChild(m),a}function Rv(a,c,m,b,E){if(c==="submit"&&m&&m.stateNode===E){var I=h_((E[hi]||null).action),V=b.submitter;V&&(c=(c=V[hi]||null)?h_(c.formAction):V.getAttribute("formAction"),c!==null&&(I=c,V=null));var te=new eu("action","action",null,b,E);a.push({event:te,listeners:[{instance:null,listener:function(){if(b.defaultPrevented){if(Xl!==0){var xe=V?d_(E,V):new FormData(E);df(m,{pending:!0,data:xe,method:E.method,action:I},null,xe)}}else typeof I=="function"&&(te.preventDefault(),xe=V?d_(E,V):new FormData(E),df(m,{pending:!0,data:xe,method:E.method,action:I},I,xe))},currentTarget:E}]})}}for(var ql=0;ql<Lo.length;ql++){var br=Lo[ql],Zl=br.toLowerCase(),Mm=br[0].toUpperCase()+br.slice(1);wn(Zl,"on"+Mm)}wn(gc,"onAnimationEnd"),wn(_c,"onAnimationIteration"),wn(du,"onAnimationStart"),wn("dblclick","onDoubleClick"),wn("focusin","onFocus"),wn("focusout","onBlur"),wn(kp,"onTransitionRun"),wn(nf,"onTransitionStart"),wn(fu,"onTransitionCancel"),wn(pu,"onTransitionEnd"),cl("onMouseEnter",["mouseout","mouseover"]),cl("onMouseLeave",["mouseout","mouseover"]),cl("onPointerEnter",["pointerout","pointerover"]),cl("onPointerLeave",["pointerout","pointerover"]),cr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),cr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),cr("onBeforeInput",["compositionend","keypress","textInput","paste"]),cr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),cr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),cr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Yu="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),f_=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Yu));function Of(a,c){c=(c&4)!==0;for(var m=0;m<a.length;m++){var b=a[m],E=b.event;b=b.listeners;e:{var I=void 0;if(c)for(var V=b.length-1;0<=V;V--){var te=b[V],xe=te.instance,$e=te.currentTarget;if(te=te.listener,xe!==I&&E.isPropagationStopped())break e;I=te,E.currentTarget=$e;try{I(E)}catch(et){pa(et)}E.currentTarget=null,I=xe}else for(V=0;V<b.length;V++){if(te=b[V],xe=te.instance,$e=te.currentTarget,te=te.listener,xe!==I&&E.isPropagationStopped())break e;I=te,E.currentTarget=$e;try{I(E)}catch(et){pa(et)}E.currentTarget=null,I=xe}}}}function Ui(a,c){var m=c[$n];m===void 0&&(m=c[$n]=new Set);var b=a+"__bubble";m.has(b)||(Im(c,a,2,!1),m.add(b))}function kf(a,c,m){var b=0;c&&(b|=4),Im(m,a,b,c)}var hd="_reactListening"+Math.random().toString(36).slice(2);function Pm(a){if(!a[hd]){a[hd]=!0,Xc.forEach(function(m){m!=="selectionchange"&&(f_.has(m)||kf(m,!1,a),kf(m,!0,a))});var c=a.nodeType===9?a:a.ownerDocument;c===null||c[hd]||(c[hd]=!0,kf("selectionchange",!1,c))}}function Im(a,c,m,b){switch(jr(c)){case 2:var E=Va;break;case 8:E=zf;break;default:E=Lf}m=E.bind(null,c,m,a),E=void 0,!Qc||c!=="touchstart"&&c!=="touchmove"&&c!=="wheel"||(E=!0),b?E!==void 0?a.addEventListener(c,m,{capture:!0,passive:E}):a.addEventListener(c,m,!0):E!==void 0?a.addEventListener(c,m,{passive:E}):a.addEventListener(c,m,!1)}function dd(a,c,m,b,E){var I=b;if((c&1)===0&&(c&2)===0&&b!==null)e:for(;;){if(b===null)return;var V=b.tag;if(V===3||V===4){var te=b.stateNode.containerInfo;if(te===E)break;if(V===4)for(V=b.return;V!==null;){var xe=V.tag;if((xe===3||xe===4)&&V.stateNode.containerInfo===E)return;V=V.return}for(;te!==null;){if(V=Hn(te),V===null)return;if(xe=V.tag,xe===5||xe===6||xe===26||xe===27){b=I=V;continue e}te=te.parentNode}}b=b.return}bh(function(){var $e=I,et=Dr(m),st=[];e:{var We=Tl.get(a);if(We!==void 0){var Ze=eu,Ht=a;switch(a){case"keypress":if(fl(m)===0)break e;case"keydown":case"keyup":Ze=Dp;break;case"focusin":Ht="focus",Ze=iu;break;case"focusout":Ht="blur",Ze=iu;break;case"beforeblur":case"afterblur":Ze=iu;break;case"click":if(m.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Ze=Ro;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ze=Vd;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ze=Gd;break;case gc:case _c:case du:Ze=$d;break;case pu:Ze=Kd;break;case"scroll":case"scrollend":Ze=Co;break;case"wheel":Ze=Ea;break;case"copy":case"cut":case"paste":Ze=Wd;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ze=Sh;break;case"toggle":case"beforetoggle":Ze=Ch}var fi=(c&4)!==0,Pn=!fi&&(a==="scroll"||a==="scrollend"),Ne=fi?We!==null?We+"Capture":null:We;fi=[];for(var Pe=$e,Ve;Pe!==null;){var it=Pe;if(Ve=it.stateNode,it=it.tag,it!==5&&it!==26&&it!==27||Ve===null||Ne===null||(it=da(Pe,Ne),it!=null&&fi.push(Nc(Pe,it,Ve))),Pn)break;Pe=Pe.return}0<fi.length&&(We=new Ze(We,Ht,null,m,et),st.push({event:We,listeners:fi}))}}if((c&7)===0){e:{if(We=a==="mouseover"||a==="pointerover",Ze=a==="mouseout"||a==="pointerout",We&&m!==So&&(Ht=m.relatedTarget||m.fromElement)&&(Hn(Ht)||Ht[gi]))break e;if((Ze||We)&&(We=et.window===et?et:(We=et.ownerDocument)?We.defaultView||We.parentWindow:window,Ze?(Ht=m.relatedTarget||m.toElement,Ze=$e,Ht=Ht?Hn(Ht):null,Ht!==null&&(Pn=d(Ht),fi=Ht.tag,Ht!==Pn||fi!==5&&fi!==27&&fi!==6)&&(Ht=null)):(Ze=null,Ht=$e),Ze!==Ht)){if(fi=Ro,it="onMouseLeave",Ne="onMouseEnter",Pe="mouse",(a==="pointerout"||a==="pointerover")&&(fi=Sh,it="onPointerLeave",Ne="onPointerEnter",Pe="pointer"),Pn=Ze==null?We:ua(Ze),Ve=Ht==null?We:ua(Ht),We=new fi(it,Pe+"leave",Ze,m,et),We.target=Pn,We.relatedTarget=Ve,it=null,Hn(et)===$e&&(fi=new fi(Ne,Pe+"enter",Ht,m,et),fi.target=Ve,fi.relatedTarget=Pn,it=fi),Pn=it,Ze&&Ht)t:{for(fi=pd,Ne=Ze,Pe=Ht,Ve=0,it=Ne;it;it=fi(it))Ve++;it=0;for(var li=Pe;li;li=fi(li))it++;for(;0<Ve-it;)Ne=fi(Ne),Ve--;for(;0<it-Ve;)Pe=fi(Pe),it--;for(;Ve--;){if(Ne===Pe||Pe!==null&&Ne===Pe.alternate){fi=Ne;break t}Ne=fi(Ne),Pe=fi(Pe)}fi=null}else fi=null;Ze!==null&&Bf(st,We,Ze,fi,!1),Ht!==null&&Pn!==null&&Bf(st,Pn,Ht,fi,!0)}}e:{if(We=$e?ua($e):window,Ze=We.nodeName&&We.nodeName.toLowerCase(),Ze==="select"||Ze==="input"&&We.type==="file")var un=au;else if(ml(We))if(ou)un=xl;else{un=lu;var Kt=fc}else Ze=We.nodeName,!Ze||Ze.toLowerCase()!=="input"||We.type!=="checkbox"&&We.type!=="radio"?$e&&Gc($e.elementType)&&(un=au):un=bl;if(un&&(un=un(a,$e))){gl(st,un,m,et);break e}Kt&&Kt(a,We,$e),a==="focusout"&&$e&&We.type==="number"&&$e.memoizedProps.value!=null&&ac(We,"number",We.value)}switch(Kt=$e?ua($e):window,a){case"focusin":(ml(Kt)||Kt.contentEditable==="true")&&(Bo=Kt,hu=$e,eo=null);break;case"focusout":eo=hu=Bo=null;break;case"mousedown":wl=!0;break;case"contextmenu":case"mouseup":case"dragend":wl=!1,No(st,m,et);break;case"selectionchange":if(uu)break;case"keydown":case"keyup":No(st,m,et)}var Oi;if(pl)e:{switch(a){case"compositionstart":var Xi="onCompositionStart";break e;case"compositionend":Xi="onCompositionEnd";break e;case"compositionupdate":Xi="onCompositionUpdate";break e}Xi=void 0}else Ca?Jd(a,m)&&(Xi="onCompositionEnd"):a==="keydown"&&m.keyCode===229&&(Xi="onCompositionStart");Xi&&(su&&m.locale!=="ko"&&(Ca||Xi!=="onCompositionStart"?Xi==="onCompositionEnd"&&Ca&&(Oi=dl()):(Ka=et,xh="value"in Ka?Ka.value:Ka.textContent,Ca=!0)),Kt=fd($e,Xi),0<Kt.length&&(Xi=new Ja(Xi,a,null,m,et),st.push({event:Xi,listeners:Kt}),Oi?Xi.data=Oi:(Oi=bi(m),Oi!==null&&(Xi.data=Oi)))),(Oi=Po?fn(a,m):en(a,m))&&(Xi=fd($e,"onBeforeInput"),0<Xi.length&&(Kt=new Ja("onBeforeInput","beforeinput",null,m,et),st.push({event:Kt,listeners:Xi}),Kt.data=Oi)),Rv(st,a,$e,m,et)}Of(st,c)})}function Nc(a,c,m){return{instance:a,listener:c,currentTarget:m}}function fd(a,c){for(var m=c+"Capture",b=[];a!==null;){var E=a,I=E.stateNode;if(E=E.tag,E!==5&&E!==26&&E!==27||I===null||(E=da(a,m),E!=null&&b.unshift(Nc(a,E,I)),E=da(a,c),E!=null&&b.push(Nc(a,E,I))),a.tag===3)return b;a=a.return}return[]}function pd(a){if(a===null)return null;do a=a.return;while(a&&a.tag!==5&&a.tag!==27);return a||null}function Bf(a,c,m,b,E){for(var I=c._reactName,V=[];m!==null&&m!==b;){var te=m,xe=te.alternate,$e=te.stateNode;if(te=te.tag,xe!==null&&xe===b)break;te!==5&&te!==26&&te!==27||$e===null||(xe=$e,E?($e=da(m,I),$e!=null&&V.unshift(Nc(m,$e,xe))):E||($e=da(m,I),$e!=null&&V.push(Nc(m,$e,xe)))),m=m.return}V.length!==0&&a.push({event:c,listeners:V})}var p_=/\r\n?/g,Dm=/\u0000|\uFFFD/g;function md(a){return(typeof a=="string"?a:""+a).replace(p_,` 49`).replace(Dm,"")}function Gu(a,c){return c=md(c),md(a)===c}function cn(a,c,m,b,E,I){switch(m){case"children":typeof b=="string"?c==="body"||c==="textarea"&&b===""||Ta(a,b):(typeof b=="number"||typeof b=="bigint")&&c!=="body"&&Ta(a,""+b);break;case"className":Ya(a,"class",b);break;case"tabIndex":Ya(a,"tabindex",b);break;case"dir":case"role":case"viewBox":case"width":case"height":Ya(a,m,b);break;case"style":To(a,b,I);break;case"data":if(c!=="object"){Ya(a,"data",b);break}case"src":case"href":if(b===""&&(c!=="a"||m!=="href")){a.removeAttribute(m);break}if(b==null||typeof b=="function"||typeof b=="symbol"||typeof b=="boolean"){a.removeAttribute(m);break}b=Kc(""+b),a.setAttribute(m,b);break;case"action":case"formAction":if(typeof b=="function"){a.setAttribute(m,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof I=="function"&&(m==="formAction"?(c!=="input"&&cn(a,c,"name",E.name,E,null),cn(a,c,"formEncType",E.formEncType,E,null),cn(a,c,"formMethod",E.formMethod,E,null),cn(a,c,"formTarget",E.formTarget,E,null)):(cn(a,c,"encType",E.encType,E,null),cn(a,c,"method",E.method,E,null),cn(a,c,"target",E.target,E,null)));if(b==null||typeof b=="symbol"||typeof b=="boolean"){a.removeAttribute(m);break}b=Kc(""+b),a.setAttribute(m,b);break;case"onClick":b!=null&&(a.onclick=Xr);break;case"onScroll":b!=null&&Ui("scroll",a);break;case"onScrollEnd":b!=null&&Ui("scrollend",a);break;case"dangerouslySetInnerHTML":if(b!=null){if(typeof b!="object"||!("__html"in b))throw Error(n(61));if(m=b.__html,m!=null){if(E.children!=null)throw Error(n(60));a.innerHTML=m}}break;case"multiple":a.multiple=b&&typeof b!="function"&&typeof b!="symbol";break;case"muted":a.muted=b&&typeof b!="function"&&typeof b!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(b==null||typeof b=="function"||typeof b=="boolean"||typeof b=="symbol"){a.removeAttribute("xlink:href");break}m=Kc(""+b),a.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",m);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":b!=null&&typeof b!="function"&&typeof b!="symbol"?a.setAttribute(m,""+b):a.removeAttribute(m);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":b&&typeof b!="function"&&typeof b!="symbol"?a.setAttribute(m,""):a.removeAttribute(m);break;case"capture":case"download":b===!0?a.setAttribute(m,""):b!==!1&&b!=null&&typeof b!="function"&&typeof b!="symbol"?a.setAttribute(m,b):a.removeAttribute(m);break;case"cols":case"rows":case"size":case"span":b!=null&&typeof b!="function"&&typeof b!="symbol"&&!isNaN(b)&&1<=b?a.setAttribute(m,b):a.removeAttribute(m);break;case"rowSpan":case"start":b==null||typeof b=="function"||typeof b=="symbol"||isNaN(b)?a.removeAttribute(m):a.setAttribute(m,b);break;case"popover":Ui("beforetoggle",a),Ui("toggle",a),Bn(a,"popover",b);break;case"xlinkActuate":ur(a,"http://www.w3.org/1999/xlink","xlink:actuate",b);break;case"xlinkArcrole":ur(a,"http://www.w3.org/1999/xlink","xlink:arcrole",b);break;case"xlinkRole":ur(a,"http://www.w3.org/1999/xlink","xlink:role",b);break;case"xlinkShow":ur(a,"http://www.w3.org/1999/xlink","xlink:show",b);break;case"xlinkTitle":ur(a,"http://www.w3.org/1999/xlink","xlink:title",b);break;case"xlinkType":ur(a,"http://www.w3.org/1999/xlink","xlink:type",b);break;case"xmlBase":ur(a,"http://www.w3.org/XML/1998/namespace","xml:base",b);break;case"xmlLang":ur(a,"http://www.w3.org/XML/1998/namespace","xml:lang",b);break;case"xmlSpace":ur(a,"http://www.w3.org/XML/1998/namespace","xml:space",b);break;case"is":Bn(a,"is",b);break;case"innerText":case"textContent":break;default:(!(2<m.length)||m[0]!=="o"&&m[0]!=="O"||m[1]!=="n"&&m[1]!=="N")&&(m=Rp.get(m)||m,Bn(a,m,b))}}function gd(a,c,m,b,E,I){switch(m){case"style":To(a,b,I);break;case"dangerouslySetInnerHTML":if(b!=null){if(typeof b!="object"||!("__html"in b))throw Error(n(61));if(m=b.__html,m!=null){if(E.children!=null)throw Error(n(60));a.innerHTML=m}}break;case"children":typeof b=="string"?Ta(a,b):(typeof b=="number"||typeof b=="bigint")&&Ta(a,""+b);break;case"onScroll":b!=null&&Ui("scroll",a);break;case"onScrollEnd":b!=null&&Ui("scrollend",a);break;case"onClick":b!=null&&(a.onclick=Xr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!ts.hasOwnProperty(m))e:{if(m[0]==="o"&&m[1]==="n"&&(E=m.endsWith("Capture"),c=m.slice(2,E?m.length-7:void 0),I=a[hi]||null,I=I!=null?I[m]:null,typeof I=="function"&&a.removeEventListener(c,I,E),typeof b=="function")){typeof I!="function"&&I!==null&&(m in a?a[m]=null:a.hasAttribute(m)&&a.removeAttribute(m)),a.addEventListener(c,b,E);break e}m in a?a[m]=b:b===!0?a.setAttribute(m,""):Bn(a,m,b)}}}function Rr(a,c,m){switch(c){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ui("error",a),Ui("load",a);var b=!1,E=!1,I;for(I in m)if(m.hasOwnProperty(I)){var V=m[I];if(V!=null)switch(I){case"src":b=!0;break;case"srcSet":E=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(n(137,c));default:cn(a,c,I,V,m,null)}}E&&cn(a,c,"srcSet",m.srcSet,m,null),b&&cn(a,c,"src",m.src,m,null);return;case"input":Ui("invalid",a);var te=I=V=E=null,xe=null,$e=null;for(b in m)if(m.hasOwnProperty(b)){var et=m[b];if(et!=null)switch(b){case"name":E=et;break;case"type":V=et;break;case"checked":xe=et;break;case"defaultChecked":$e=et;break;case"value":I=et;break;case"defaultValue":te=et;break;case"children":case"dangerouslySetInnerHTML":if(et!=null)throw Error(n(137,c));break;default:cn(a,c,b,et,m,null)}}ji(a,I,te,xe,$e,V,E,!1);return;case"select":Ui("invalid",a),b=V=I=null;for(E in m)if(m.hasOwnProperty(E)&&(te=m[E],te!=null))switch(E){case"value":I=te;break;case"defaultValue":V=te;break;case"multiple":b=te;default:cn(a,c,E,te,m,null)}c=I,m=V,a.multiple=!!b,c!=null?Ga(a,!!b,c,!1):m!=null&&Ga(a,!!b,m,!0);return;case"textarea":Ui("invalid",a),I=E=b=null;for(V in m)if(m.hasOwnProperty(V)&&(te=m[V],te!=null))switch(V){case"value":b=te;break;case"defaultValue":E=te;break;case"children":I=te;break;case"dangerouslySetInnerHTML":if(te!=null)throw Error(n(91));break;default:cn(a,c,V,te,m,null)}Yc(a,b,E,I);return;case"option":for(xe in m)if(m.hasOwnProperty(xe)&&(b=m[xe],b!=null))switch(xe){case"selected":a.selected=b&&typeof b!="function"&&typeof b!="symbol";break;default:cn(a,c,xe,b,m,null)}return;case"dialog":Ui("beforetoggle",a),Ui("toggle",a),Ui("cancel",a),Ui("close",a);break;case"iframe":case"object":Ui("load",a);break;case"video":case"audio":for(b=0;b<Yu.length;b++)Ui(Yu[b],a);break;case"image":Ui("error",a),Ui("load",a);break;case"details":Ui("toggle",a);break;case"embed":case"source":case"link":Ui("error",a),Ui("load",a);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for($e in m)if(m.hasOwnProperty($e)&&(b=m[$e],b!=null))switch($e){case"children":case"dangerouslySetInnerHTML":throw Error(n(137,c));default:cn(a,c,$e,b,m,null)}return;default:if(Gc(c)){for(et in m)m.hasOwnProperty(et)&&(b=m[et],b!==void 0&&gd(a,c,et,b,m,void 0));return}}for(te in m)m.hasOwnProperty(te)&&(b=m[te],b!=null&&cn(a,c,te,b,m,null))}function Mv(a,c,m,b){switch(c){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var E=null,I=null,V=null,te=null,xe=null,$e=null,et=null;for(Ze in m){var st=m[Ze];if(m.hasOwnProperty(Ze)&&st!=null)switch(Ze){case"checked":break;case"value":break;case"defaultValue":xe=st;default:b.hasOwnProperty(Ze)||cn(a,c,Ze,null,b,st)}}for(var We in b){var Ze=b[We];if(st=m[We],b.hasOwnProperty(We)&&(Ze!=null||st!=null))switch(We){case"type":I=Ze;break;case"name":E=Ze;break;case"checked":$e=Ze;break;case"defaultChecked":et=Ze;break;case"value":V=Ze;break;case"defaultValue":te=Ze;break;case"children":case"dangerouslySetInnerHTML":if(Ze!=null)throw Error(n(137,c));break;default:Ze!==st&&cn(a,c,We,Ze,b,st)}}ha(a,V,te,xe,$e,et,I,E);return;case"select":Ze=V=te=We=null;for(I in m)if(xe=m[I],m.hasOwnProperty(I)&&xe!=null)switch(I){case"value":break;case"multiple":Ze=xe;default:b.hasOwnProperty(I)||cn(a,c,I,null,b,xe)}for(E in b)if(I=b[E],xe=m[E],b.hasOwnProperty(E)&&(I!=null||xe!=null))switch(E){case"value":We=I;break;case"defaultValue":te=I;break;case"multiple":V=I;default:I!==xe&&cn(a,c,E,I,b,xe)}c=te,m=V,b=Ze,We!=null?Ga(a,!!m,We,!1):!!b!=!!m&&(c!=null?Ga(a,!!m,c,!0):Ga(a,!!m,m?[]:"",!1));return;case"textarea":Ze=We=null;for(te in m)if(E=m[te],m.hasOwnProperty(te)&&E!=null&&!b.hasOwnProperty(te))switch(te){case"value":break;case"children":break;default:cn(a,c,te,null,b,E)}for(V in b)if(E=b[V],I=m[V],b.hasOwnProperty(V)&&(E!=null||I!=null))switch(V){case"value":We=E;break;case"defaultValue":Ze=E;break;case"children":break;case"dangerouslySetInnerHTML":if(E!=null)throw Error(n(91));break;default:E!==I&&cn(a,c,V,E,b,I)}wo(a,We,Ze);return;case"option":for(var Ht in m)if(We=m[Ht],m.hasOwnProperty(Ht)&&We!=null&&!b.hasOwnProperty(Ht))switch(Ht){case"selected":a.selected=!1;break;default:cn(a,c,Ht,null,b,We)}for(xe in b)if(We=b[xe],Ze=m[xe],b.hasOwnProperty(xe)&&We!==Ze&&(We!=null||Ze!=null))switch(xe){case"selected":a.selected=We&&typeof We!="function"&&typeof We!="symbol";break;default:cn(a,c,xe,We,b,Ze)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var fi in m)We=m[fi],m.hasOwnProperty(fi)&&We!=null&&!b.hasOwnProperty(fi)&&cn(a,c,fi,null,b,We);for($e in b)if(We=b[$e],Ze=m[$e],b.hasOwnProperty($e)&&We!==Ze&&(We!=null||Ze!=null))switch($e){case"children":case"dangerouslySetInnerHTML":if(We!=null)throw Error(n(137,c));break;default:cn(a,c,$e,We,b,Ze)}return;default:if(Gc(c)){for(var Pn in m)We=m[Pn],m.hasOwnProperty(Pn)&&We!==void 0&&!b.hasOwnProperty(Pn)&&gd(a,c,Pn,void 0,b,We);for(et in b)We=b[et],Ze=m[et],!b.hasOwnProperty(et)||We===Ze||We===void 0&&Ze===void 0||gd(a,c,et,We,b,Ze);return}}for(var Ne in m)We=m[Ne],m.hasOwnProperty(Ne)&&We!=null&&!b.hasOwnProperty(Ne)&&cn(a,c,Ne,null,b,We);for(st in b)We=b[st],Ze=m[st],!b.hasOwnProperty(st)||We===Ze||We==null&&Ze==null||cn(a,c,st,We,b,Ze)}function l(a){switch(a){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function s(){if(typeof performance.getEntriesByType=="function"){for(var a=0,c=0,m=performance.getEntriesByType("resource"),b=0;b<m.length;b++){var E=m[b],I=E.transferSize,V=E.initiatorType,te=E.duration;if(I&&te&&l(V)){for(V=0,te=E.responseEnd,b+=1;b<m.length;b++){var xe=m[b],$e=xe.startTime;if($e>te)break;var et=xe.transferSize,st=xe.initiatorType;et&&l(st)&&(xe=xe.responseEnd,V+=et*(xe<te?1:(te-$e)/(xe-$e)))}if(--b,c+=8*(I+V)/(E.duration/1e3),a++,10<a)break}}if(0<a)return c/a/1e6}return navigator.connection&&(a=navigator.connection.downlink,typeof a=="number")?a:5}var u=null,g=null;function v(a){return a.nodeType===9?a:a.ownerDocument}function T(a){switch(a){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function S(a,c){if(a===0)switch(c){case"svg":return 1;case"math":return 2;default:return 0}return a===1&&c==="foreignObject"?0:a}function C(a,c){return a==="textarea"||a==="noscript"||typeof c.children=="string"||typeof c.children=="number"||typeof c.children=="bigint"||typeof c.dangerouslySetInnerHTML=="object"&&c.dangerouslySetInnerHTML!==null&&c.dangerouslySetInnerHTML.__html!=null}var P=null;function k(){var a=window.event;return a&&a.type==="popstate"?a===P?!1:(P=a,!0):(P=null,!1)}var z=typeof setTimeout=="function"?setTimeout:void 0,U=typeof clearTimeout=="function"?clearTimeout:void 0,W=typeof Promise=="function"?Promise:void 0,Z=typeof queueMicrotask=="function"?queueMicrotask:typeof W<"u"?function(a){return W.resolve(null).then(a).catch(K)}:z;function K(a){setTimeout(function(){throw a})}function J(a){return a==="head"}function ce(a,c){var m=c,b=0;do{var E=m.nextSibling;if(a.removeChild(m),E&&E.nodeType===8)if(m=E.data,m==="/$"||m==="/&"){if(b===0){a.removeChild(E),Uf(c);return}b--}else if(m==="$"||m==="$?"||m==="$~"||m==="$!"||m==="&")b++;else if(m==="html")Ye(a.ownerDocument.documentElement);else if(m==="head"){m=a.ownerDocument.head,Ye(m);for(var I=m.firstChild;I;){var V=I.nextSibling,te=I.nodeName;I[Ji]||te==="SCRIPT"||te==="STYLE"||te==="LINK"&&I.rel.toLowerCase()==="stylesheet"||m.removeChild(I),I=V}}else m==="body"&&Ye(a.ownerDocument.body);m=E}while(m);Uf(c)}function fe(a,c){var m=a;a=0;do{var b=m.nextSibling;if(m.nodeType===1?c?(m._stashedDisplay=m.style.display,m.style.display="none"):(m.style.display=m._stashedDisplay||"",m.getAttribute("style")===""&&m.removeAttribute("style")):m.nodeType===3&&(c?(m._stashedText=m.nodeValue,m.nodeValue=""):m.nodeValue=m._stashedText||""),b&&b.nodeType===8)if(m=b.data,m==="/$"){if(a===0)break;a--}else m!=="$"&&m!=="$?"&&m!=="$~"&&m!=="$!"||a++;m=b}while(m)}function Be(a){var c=a.firstChild;for(c&&c.nodeType===10&&(c=c.nextSibling);c;){var m=c;switch(c=c.nextSibling,m.nodeName){case"HTML":case"HEAD":case"BODY":Be(m),tr(m);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(m.rel.toLowerCase()==="stylesheet")continue}a.removeChild(m)}}function Ae(a,c,m,b){for(;a.nodeType===1;){var E=m;if(a.nodeName.toLowerCase()!==c.toLowerCase()){if(!b&&(a.nodeName!=="INPUT"||a.type!=="hidden"))break}else if(b){if(!a[Ji])switch(c){case"meta":if(!a.hasAttribute("itemprop"))break;return a;case"link":if(I=a.getAttribute("rel"),I==="stylesheet"&&a.hasAttribute("data-precedence"))break;if(I!==E.rel||a.getAttribute("href")!==(E.href==null||E.href===""?null:E.href)||a.getAttribute("crossorigin")!==(E.crossOrigin==null?null:E.crossOrigin)||a.getAttribute("title")!==(E.title==null?null:E.title))break;return a;case"style":if(a.hasAttribute("data-precedence"))break;return a;case"script":if(I=a.getAttribute("src"),(I!==(E.src==null?null:E.src)||a.getAttribute("type")!==(E.type==null?null:E.type)||a.getAttribute("crossorigin")!==(E.crossOrigin==null?null:E.crossOrigin))&&I&&a.hasAttribute("async")&&!a.hasAttribute("itemprop"))break;return a;default:return a}}else if(c==="input"&&a.type==="hidden"){var I=E.name==null?null:""+E.name;if(E.type==="hidden"&&a.getAttribute("name")===I)return a}else return a;
vendor: 9,806 bytes, line 49
49if(a=_t(a.nextSibling),a===null)break}return null}function De(a,c,m){if(c==="")return null;for(;a.nodeType!==3;)if((a.nodeType!==1||a.nodeName!=="INPUT"||a.type!=="hidden")&&!m||(a=_t(a.nextSibling),a===null))return null;return a}function Xe(a,c){for(;a.nodeType!==8;)if((a.nodeType!==1||a.nodeName!=="INPUT"||a.type!=="hidden")&&!c||(a=_t(a.nextSibling),a===null))return null;return a}function ct(a){return a.data==="$?"||a.data==="$~"}function Rt(a){return a.data==="$!"||a.data==="$?"&&a.ownerDocument.readyState!=="loading"}function Yt(a,c){var m=a.ownerDocument;if(a.data==="$~")a._reactRetry=c;else if(a.data!=="$?"||m.readyState!=="loading")c();else{var b=function(){c(),m.removeEventListener("DOMContentLoaded",b)};m.addEventListener("DOMContentLoaded",b),a._reactRetry=b}}function _t(a){for(;a!=null;a=a.nextSibling){var c=a.nodeType;if(c===1||c===3)break;if(c===8){if(c=a.data,c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"||c==="F!"||c==="F")break;if(c==="/$"||c==="/&")return null}}return a}var St=null;function Lt(a){a=a.nextSibling;for(var c=0;a;){if(a.nodeType===8){var m=a.data;if(m==="/$"||m==="/&"){if(c===0)return _t(a.nextSibling);c--}else m!=="$"&&m!=="$!"&&m!=="$?"&&m!=="$~"&&m!=="&"||c++}a=a.nextSibling}return null}function Bt(a){a=a.previousSibling;for(var c=0;a;){if(a.nodeType===8){var m=a.data;if(m==="$"||m==="$!"||m==="$?"||m==="$~"||m==="&"){if(c===0)return a;c--}else m!=="/$"&&m!=="/&"||c++}a=a.previousSibling}return null}function It(a,c,m){switch(c=v(m),a){case"html":if(a=c.documentElement,!a)throw Error(n(452));return a;case"head":if(a=c.head,!a)throw Error(n(453));return a;case"body":if(a=c.body,!a)throw Error(n(454));return a;default:throw Error(n(451))}}function Ye(a){for(var c=a.attributes;c.length;)a.removeAttributeNode(c[0]);tr(a)}var kt=new Map,zt=new Set;function ri(a){return typeof a.getRootNode=="function"?a.getRootNode():a.nodeType===9?a:a.ownerDocument}var zi=nt.d;nt.d={f:tn,r:xr,D:wr,C:us,L:hs,m:ds,X:Tr,S:Yn,M:Qr};function tn(){var a=zi.f(),c=ad();return a||c}function xr(a){var c=ir(a);c!==null&&c.tag===5&&c.type==="form"?Xp(c):zi.r(a)}var Kr=typeof document>"u"?null:document;function Mr(a,c,m){var b=Kr;if(b&&typeof c=="string"&&c){var E=mr(c);E='link[rel="'+a+'"][href="'+E+'"]',typeof m=="string"&&(E+='[crossorigin="'+m+'"]'),zt.has(E)||(zt.add(E),a={rel:a,crossOrigin:m,href:c},b.querySelector(E)===null&&(c=b.createElement("link"),Rr(c,"link",a),nr(c),b.head.appendChild(c)))}}function wr(a){zi.D(a),Mr("dns-prefetch",a,null)}function us(a,c){zi.C(a,c),Mr("preconnect",a,c)}function hs(a,c,m){zi.L(a,c,m);var b=Kr;if(b&&a&&c){var E='link[rel="preload"][as="'+mr(c)+'"]';c==="image"&&m&&m.imageSrcSet?(E+='[imagesrcset="'+mr(m.imageSrcSet)+'"]',typeof m.imageSizes=="string"&&(E+='[imagesizes="'+mr(m.imageSizes)+'"]')):E+='[href="'+mr(a)+'"]';var I=E;switch(c){case"style":I=pr(a);break;case"script":I=Pi(a)}kt.has(I)||(a=N({rel:"preload",href:c==="image"&&m&&m.imageSrcSet?void 0:a,as:c},m),kt.set(I,a),b.querySelector(E)!==null||c==="style"&&b.querySelector(ar(I))||c==="script"&&b.querySelector(Yi(I))||(c=b.createElement("link"),Rr(c,"link",a),nr(c),b.head.appendChild(c)))}}function ds(a,c){zi.m(a,c);var m=Kr;if(m&&a){var b=c&&typeof c.as=="string"?c.as:"script",E='link[rel="modulepreload"][as="'+mr(b)+'"][href="'+mr(a)+'"]',I=E;switch(b){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":I=Pi(a)}if(!kt.has(I)&&(a=N({rel:"modulepreload",href:a},c),kt.set(I,a),m.querySelector(E)===null)){switch(b){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(m.querySelector(Yi(I)))return}b=m.createElement("link"),Rr(b,"link",a),nr(b),m.head.appendChild(b)}}}function Yn(a,c,m){zi.S(a,c,m);var b=Kr;if(b&&a){var E=Fi(b).hoistableStyles,I=pr(a);c=c||"default";var V=E.get(I);if(!V){var te={loading:0,preload:null};if(V=b.querySelector(ar(I)))te.loading=5;else{a=N({rel:"stylesheet",href:a,"data-precedence":c},m),(m=kt.get(I))&&An(a,m);var xe=V=b.createElement("link");nr(xe),Rr(xe,"link",a),xe._p=new Promise(function($e,et){xe.onload=$e,xe.onerror=et}),xe.addEventListener("load",function(){te.loading|=1}),xe.addEventListener("error",function(){te.loading|=2}),te.loading|=4,Jr(V,c,b)}V={type:"stylesheet",instance:V,count:1,state:te},E.set(I,V)}}}function Tr(a,c){zi.X(a,c);var m=Kr;if(m&&a){var b=Fi(m).hoistableScripts,E=Pi(a),I=b.get(E);I||(I=m.querySelector(Yi(E)),I||(a=N({src:a,async:!0},c),(c=kt.get(E))&&Yl(a,c),I=m.createElement("script"),nr(I),Rr(I,"link",a),m.head.appendChild(I)),I={type:"script",instance:I,count:1,state:null},b.set(E,I))}}function Qr(a,c){zi.M(a,c);var m=Kr;if(m&&a){var b=Fi(m).hoistableScripts,E=Pi(a),I=b.get(E);I||(I=m.querySelector(Yi(E)),I||(a=N({src:a,async:!0,type:"module"},c),(c=kt.get(E))&&Yl(a,c),I=m.createElement("script"),nr(I),Rr(I,"link",a),m.head.appendChild(I)),I={type:"script",instance:I,count:1,state:null},b.set(E,I))}}function Pr(a,c,m,b){var E=(E=qt.current)?ri(E):null;if(!E)throw Error(n(446));switch(a){case"meta":case"title":return null;case"style":return typeof m.precedence=="string"&&typeof m.href=="string"?(c=pr(m.href),m=Fi(E).hoistableStyles,b=m.get(c),b||(b={type:"style",instance:null,count:0,state:null},m.set(c,b)),b):{type:"void",instance:null,count:0,state:null};case"link":if(m.rel==="stylesheet"&&typeof m.href=="string"&&typeof m.precedence=="string"){a=pr(m.href);var I=Fi(E).hoistableStyles,V=I.get(a);if(V||(E=E.ownerDocument||E,V={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},I.set(a,V),(I=E.querySelector(ar(a)))&&!I._p&&(V.instance=I,V.state.loading=5),kt.has(a)||(m={rel:"preload",as:"style",href:m.href,crossOrigin:m.crossOrigin,integrity:m.integrity,media:m.media,hrefLang:m.hrefLang,referrerPolicy:m.referrerPolicy},kt.set(a,m),I||bs(E,a,m,V.state))),c&&b===null)throw Error(n(528,""));return V}if(c&&b!==null)throw Error(n(529,""));return null;case"script":return c=m.async,m=m.src,typeof m=="string"&&c&&typeof c!="function"&&typeof c!="symbol"?(c=Pi(m),m=Fi(E).hoistableScripts,b=m.get(c),b||(b={type:"script",instance:null,count:0,state:null},m.set(c,b)),b):{type:"void",instance:null,count:0,state:null};default:throw Error(n(444,a))}}function pr(a){return'href="'+mr(a)+'"'}function ar(a){return'link[rel="stylesheet"]['+a+"]"}function Fs(a){return N({},a,{"data-precedence":a.precedence,precedence:null})}function bs(a,c,m,b){a.querySelector('link[rel="preload"][as="style"]['+c+"]")?b.loading=1:(c=a.createElement("link"),b.preload=c,c.addEventListener("load",function(){return b.loading|=1}),c.addEventListener("error",function(){return b.loading|=2}),Rr(c,"link",m),nr(c),a.head.appendChild(c))}function Pi(a){return'[src="'+mr(a)+'"]'}function Yi(a){return"script[async]"+a}function yn(a,c,m){if(c.count++,c.instance===null)switch(c.type){case"style":var b=a.querySelector('style[data-href~="'+mr(m.href)+'"]');if(b)return c.instance=b,nr(b),b;var E=N({},m,{"data-href":m.href,"data-precedence":m.precedence,href:null,precedence:null});return b=(a.ownerDocument||a).createElement("style"),nr(b),Rr(b,"style",E),Jr(b,m.precedence,a),c.instance=b;case"stylesheet":E=pr(m.href);var I=a.querySelector(ar(E));if(I)return c.state.loading|=4,c.instance=I,nr(I),I;b=Fs(m),(E=kt.get(E))&&An(b,E),I=(a.ownerDocument||a).createElement("link"),nr(I);var V=I;return V._p=new Promise(function(te,xe){V.onload=te,V.onerror=xe}),Rr(I,"link",b),c.state.loading|=4,Jr(I,m.precedence,a),c.instance=I;case"script":return I=Pi(m.src),(E=a.querySelector(Yi(I)))?(c.instance=E,nr(E),E):(b=m,(E=kt.get(I))&&(b=N({},m),Yl(b,E)),a=a.ownerDocument||a,E=a.createElement("script"),nr(E),Rr(E,"link",b),a.head.appendChild(E),c.instance=E);case"void":return null;default:throw Error(n(443,c.type))}else c.type==="stylesheet"&&(c.state.loading&4)===0&&(b=c.instance,c.state.loading|=4,Jr(b,m.precedence,a));return c.instance}function Jr(a,c,m){for(var b=m.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),E=b.length?b[b.length-1]:null,I=E,V=0;V<b.length;V++){var te=b[V];if(te.dataset.precedence===c)I=te;else if(I!==E)break}I?I.parentNode.insertBefore(a,I.nextSibling):(c=m.nodeType===9?m.head:m,c.insertBefore(a,c.firstChild))}function An(a,c){a.crossOrigin==null&&(a.crossOrigin=c.crossOrigin),a.referrerPolicy==null&&(a.referrerPolicy=c.referrerPolicy),a.title==null&&(a.title=c.title)}function Yl(a,c){a.crossOrigin==null&&(a.crossOrigin=c.crossOrigin),a.referrerPolicy==null&&(a.referrerPolicy=c.referrerPolicy),a.integrity==null&&(a.integrity=c.integrity)}var na=null;function ja(a,c,m){if(na===null){var b=new Map,E=na=new Map;E.set(m,b)}else E=na,b=E.get(m),b||(b=new Map,E.set(m,b));if(b.has(a))return b;for(b.set(a,null),m=m.getElementsByTagName(a),E=0;E<m.length;E++){var I=m[E];if(!(I[Ji]||I[Vt]||a==="link"&&I.getAttribute("rel")==="stylesheet")&&I.namespaceURI!=="http://www.w3.org/2000/svg"){var V=I.getAttribute(c)||"";V=a+V;var te=b.get(V);te?te.push(I):b.set(V,[I])}}return b}function ra(a,c,m){a=a.ownerDocument||a,a.head.insertBefore(m,c==="title"?a.querySelector("head > title"):null)}function sa(a,c,m){if(m===1||c.itemProp!=null)return!1;switch(a){case"meta":case"title":return!0;case"style":if(typeof c.precedence!="string"||typeof c.href!="string"||c.href==="")break;return!0;case"link":if(typeof c.rel!="string"||typeof c.href!="string"||c.href===""||c.onLoad||c.onError)break;switch(c.rel){case"stylesheet":return a=c.disabled,typeof c.precedence=="string"&&a==null;default:return!0}case"script":if(c.async&&typeof c.async!="function"&&typeof c.async!="symbol"&&!c.onLoad&&!c.onError&&c.src&&typeof c.src=="string")return!0}return!1}function Sr(a){return!(a.type==="stylesheet"&&(a.state.loading&3)===0)}function tl(a,c,m,b){if(m.type==="stylesheet"&&(typeof b.media!="str
49ing"||matchMedia(b.media).matches!==!1)&&(m.state.loading&4)===0){if(m.instance===null){var E=pr(b.href),I=c.querySelector(ar(E));if(I){c=I._p,c!==null&&typeof c=="object"&&typeof c.then=="function"&&(a.count++,a=_d.bind(a),c.then(a,a)),m.state.loading|=4,m.instance=I,nr(I);return}I=c.ownerDocument||c,b=Fs(b),(E=kt.get(E))&&An(b,E),I=I.createElement("link"),nr(I);var V=I;V._p=new Promise(function(te,xe){V.onload=te,V.onerror=xe}),Rr(I,"link",b),m.instance=I}a.stylesheets===null&&(a.stylesheets=new Map),a.stylesheets.set(m,c),(c=m.state.preload)&&(m.state.loading&3)===0&&(a.count++,m=_d.bind(a),c.addEventListener("load",m),c.addEventListener("error",m))}}var zc=0;function m_(a,c){return a.stylesheets&&a.count===0&&Qu(a,a.stylesheets),0<a.count||0<a.imgCount?function(m){var b=setTimeout(function(){if(a.stylesheets&&Qu(a,a.stylesheets),a.unsuspend){var I=a.unsuspend;a.unsuspend=null,I()}},6e4+c);0<a.imgBytes&&zc===0&&(zc=62500*s());var E=setTimeout(function(){if(a.waitingForImages=!1,a.count===0&&(a.stylesheets&&Qu(a,a.stylesheets),a.unsuspend)){var I=a.unsuspend;a.unsuspend=null,I()}},(a.imgBytes>zc?50:800)+c);return a.unsuspend=m,function(){a.unsuspend=null,clearTimeout(b),clearTimeout(E)}}:null}function _d(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Qu(this,this.stylesheets);else if(this.unsuspend){var a=this.unsuspend;this.unsuspend=null,a()}}}var Ku=null;function Qu(a,c){a.stylesheets=null,a.unsuspend!==null&&(a.count++,Ku=new Map,c.forEach(il,a),Ku=null,_d.call(a))}function il(a,c){if(!(c.state.loading&4)){var m=Ku.get(a);if(m)var b=m.get(null);else{m=new Map,Ku.set(a,m);for(var E=a.querySelectorAll("link[data-precedence],style[data-precedence]"),I=0;I<E.length;I++){var V=E[I];(V.nodeName==="LINK"||V.getAttribute("media")!=="not all")&&(m.set(V.dataset.precedence,V),b=V)}b&&m.set(null,b)}E=c.instance,V=E.getAttribute("data-precedence"),I=m.get(V)||b,I===b&&m.set(null,E),m.set(V,E),this.count++,b=_d.bind(this),E.addEventListener("load",b),E.addEventListener("error",b),I?I.parentNode.insertBefore(E,I.nextSibling):(a=a.nodeType===9?a.head:a,a.insertBefore(E,a.firstChild)),c.state.loading|=4}}var Ju={$$typeof:ve,Provider:null,Consumer:null,_currentValue:mt,_currentValue2:mt,_threadCount:0};function g_(a,c,m,b,E,I,V,te,xe){this.tag=1,this.containerInfo=a,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Se(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Se(0),this.hiddenUpdates=Se(null),this.identifierPrefix=b,this.onUncaughtError=E,this.onCaughtError=I,this.onRecoverableError=V,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=xe,this.incompleteTransitions=new Map}function __(a,c,m,b,E,I,V,te,xe,$e,et,st){return a=new g_(a,c,m,V,xe,$e,et,st,te),c=1,I===!0&&(c|=24),I=Nr(3,null,null,c),a.current=I,I.stateNode=a,c=Is(),c.refCount++,a.pooledCache=c,c.refCount++,I.memoizedState={element:b,isDehydrated:m,cache:c},Mt(I),a}function y_(a){return a?(a=rs,a):rs}function v_(a,c,m,b,E,I){E=y_(E),b.context===null?b.context=E:b.pendingContext=E,b=ft(c),b.payload={element:m},I=I===void 0?null:I,I!==null&&(b.callback=I),m=Ot(a,b,c),m!==null&&(ls(m,a,c),ni(m,a,c))}function b_(a,c){if(a=a.memoizedState,a!==null&&a.dehydrated!==null){var m=a.retryLane;a.retryLane=m!==0&&m<c?m:c}}function Om(a,c){b_(a,c),(a=a.alternate)&&b_(a,c)}function x_(a){if(a.tag===13||a.tag===31){var c=Ma(a,67108864);c!==null&&ls(c,a,67108864),Om(a,67108864)}}function w_(a){if(a.tag===13||a.tag===31){var c=ia();c=je(c);var m=Ma(a,c);m!==null&&ls(m,a,c),Om(a,c)}}var Nf=!0;function Va(a,c,m,b){var E=Le.T;Le.T=null;var I=nt.p;try{nt.p=2,Lf(a,c,m,b)}finally{nt.p=I,Le.T=E}}function zf(a,c,m,b){var E=Le.T;Le.T=null;var I=nt.p;try{nt.p=8,Lf(a,c,m,b)}finally{nt.p=I,Le.T=E}}function Lf(a,c,m,b){if(Nf){var E=km(b);if(E===null)dd(a,c,b,Ff,m),Ix(a,b);else if(sE(E,a,c,m,b))b.stopPropagation();else if(Ix(a,b),c&4&&-1<rE.indexOf(a)){for(;E!==null;){var I=ir(E);if(I!==null)switch(I.tag){case 3:if(I=I.stateNode,I.current.memoizedState.isDehydrated){var V=de(I.pendingLanes);if(V!==0){var te=I;for(te.pendingLanes|=2,te.entangledLanes|=2;V;){var xe=1<<31-xn(V);te.entanglements[1]|=xe,V&=~xe}fo(I),(Qi&6)===0&&(Sf=sn()+500,Xu(0))}}break;case 31:case 13:te=Ma(I,2),te!==null&&ls(te,I,2),ad(),Om(I,2)}if(I=km(b),I===null&&dd(a,c,b,Ff,m),I===E)break;E=I}E!==null&&b.stopPropagation()}else dd(a,c,b,null,m)}}function km(a){return a=Dr(a),Bm(a)}var Ff=null;function Bm(a){if(Ff=null,a=Hn(a),a!==null){var c=d(a);if(c===null)a=null;else{var m=c.tag;if(m===13){if(a=p(c),a!==null)return a;a=null}else if(m===31){if(a=h(c),a!==null)return a;a=null}else if(m===3){if(c.stateNode.current.memoizedState.isDehydrated)return c.tag===3?c.stateNode.containerInfo:null;a=null}else c!==a&&(a=null)}}return Ff=a,null}
vendor: 4,647 bytes, line 49
49function jr(a){switch(a){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(bn()){case lr:return 2;case Ss:return 8;case pt:case oa:return 32;case Ir:return 268435456;default:return 32}default:return 32}}var xs=!1,Us=null,Vr=null,js=null,Vs=new Map,Nm=new Map,eh=[],rE="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Ix(a,c){switch(a){case"focusin":case"focusout":Us=null;break;case"dragenter":case"dragleave":Vr=null;break;case"mouseover":case"mouseout":js=null;break;case"pointerover":case"pointerout":Vs.delete(c.pointerId);break;case"gotpointercapture":case"lostpointercapture":Nm.delete(c.pointerId)}}function zm(a,c,m,b,E,I){return a===null||a.nativeEvent!==I?(a={blockedOn:c,domEventName:m,eventSystemFlags:b,nativeEvent:I,targetContainers:[E]},c!==null&&(c=ir(c),c!==null&&x_(c)),a):(a.eventSystemFlags|=b,c=a.targetContainers,E!==null&&c.indexOf(E)===-1&&c.push(E),a)}function sE(a,c,m,b,E){switch(c){case"focusin":return Us=zm(Us,a,c,m,b,E),!0;case"dragenter":return Vr=zm(Vr,a,c,m,b,E),!0;case"mouseover":return js=zm(js,a,c,m,b,E),!0;case"pointerover":var I=E.pointerId;return Vs.set(I,zm(Vs.get(I)||null,a,c,m,b,E)),!0;case"gotpointercapture":return I=E.pointerId,Nm.set(I,zm(Nm.get(I)||null,a,c,m,b,E)),!0}return!1}function Dx(a){var c=Hn(a.target);if(c!==null){var m=d(c);if(m!==null){if(c=m.tag,c===13){if(c=p(m),c!==null){a.blockedOn=c,Xt(a.priority,function(){w_(m)});return}}else if(c===31){if(c=h(m),c!==null){a.blockedOn=c,Xt(a.priority,function(){w_(m)});return}}else if(c===3&&m.stateNode.current.memoizedState.isDehydrated){a.blockedOn=m.tag===3?m.stateNode.containerInfo:null;return}}}a.blockedOn=null}function T_(a){if(a.blockedOn!==null)return!1;for(var c=a.targetContainers;0<c.length;){var m=km(a.nativeEvent);if(m===null){m=a.nativeEvent;var b=new m.constructor(m.type,m);So=b,m.target.dispatchEvent(b),So=null}else return c=ir(m),c!==null&&x_(c),a.blockedOn=m,!1;c.shift()}return!0}function Ox(a,c,m){T_(a)&&m.delete(c)}function aE(){xs=!1,Us!==null&&T_(Us)&&(Us=null),Vr!==null&&T_(Vr)&&(Vr=null),js!==null&&T_(js)&&(js=null),Vs.forEach(Ox),Nm.forEach(Ox)}function S_(a,c){a.blockedOn===c&&(a.blockedOn=null,xs||(xs=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,aE)))}var A_=null;function kx(a){A_!==a&&(A_=a,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){A_===a&&(A_=null);for(var c=0;c<a.length;c+=3){var m=a[c],b=a[c+1],E=a[c+2];if(typeof b!="function"){if(Bm(b||m)===null)continue;break}var I=ir(m);I!==null&&(a.splice(c,3),c-=3,df(I,{pending:!0,data:E,method:m.method,action:b},b,E))}}))}function Uf(a){function c(xe){return S_(xe,a)}Us!==null&&S_(Us,a),Vr!==null&&S_(Vr,a),js!==null&&S_(js,a),Vs.forEach(c),Nm.forEach(c);for(var m=0;m<eh.length;m++){var b=eh[m];b.blockedOn===a&&(b.blockedOn=null)}for(;0<eh.length&&(m=eh[0],m.blockedOn===null);)Dx(m),m.blockedOn===null&&eh.shift();if(m=(a.ownerDocument||a).$$reactFormReplay,m!=null)for(b=0;b<m.length;b+=3){var E=m[b],I=m[b+1],V=E[hi]||null;if(typeof I=="function")V||kx(m);else if(V){var te=null;if(I&&I.hasAttribute("formAction")){if(E=I,V=I[hi]||null)te=V.formAction;else if(Bm(E)!==null)continue}else te=V.action;typeof te=="function"?m[b+1]=te:(m.splice(b,3),b-=3),kx(m)}}}function Bx(){function a(I){I.canIntercept&&I.info==="react-transition"&&I.intercept({handler:function(){return new Promise(function(V){return E=V}
49)},focusReset:"manual",scroll:"manual"})}function c(){E!==null&&(E(),E=null),b||setTimeout(m,20)}function m(){if(!b&&!navigation.transition){var I=navigation.currentEntry;I&&I.url!=null&&navigation.navigate(I.url,{state:I.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var b=!1,E=null;return navigation.addEventListener("navigate",a),navigation.addEventListener("navigatesuccess",c),navigation.addEventListener("navigateerror",c),setTimeout(m,100),function(){b=!0,navigation.removeEventListener("navigate",a),navigation.removeEventListener("navigatesuccess",c),navigation.removeEventListener("navigateerror",c),E!==null&&(E(),E=null)}}}function Pv(a){this._internalRoot=a}E_.prototype.render=Pv.prototype.render=function(a){var c=this._internalRoot;if(c===null)throw Error(n(409));var m=c.current,b=ia();v_(m,b,a,c,null,null)},E_.prototype.unmount=Pv.prototype.unmount=function(){var a=this._internalRoot;if(a!==null){this._internalRoot=null;var c=a.containerInfo;v_(a.current,2,null,a,null,null),ad(),c[gi]=null}};function E_(a){this._internalRoot=a}E_.prototype.unstable_scheduleHydration=function(a){if(a){var c=jt();a={blockedOn:null,target:a,priority:c};for(var m=0;m<eh.length&&c!==0&&c<eh[m].priority;m++);eh.splice(m,0,a),m===0&&Dx(a)}};var Nx=e.version;if(Nx!=="19.2.8")throw Error(n(527,Nx,"19.2.8"));nt.findDOMNode=function(a){var c=a._reactInternals;if(c===void 0)throw typeof a.render=="function"?Error(n(188)):(a=Object.keys(a).join(","),Error(n(268,a)));return a=R(c),a=a!==null?B(a):null,a=a===null?null:a.stateNode,a};var oE={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:Le,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var C_=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!C_.isDisabled&&C_.supportsFiber)try{bt=C_.inject(oE),ii=C_}catch{}}return Fm.createRoot=function(a,c){if(!o(a))throw Error(n(299));var m=!1,b="",E=Bg,I=Ng,V=zg;return c!=null&&(c.unstable_strictMode===!0&&(m=!0),c.identifierPrefix!==void 0&&(b=c.identifierPrefix),c.onUncaughtError!==void 0&&(E=c.onUncaughtError),c.onCaughtError!==void 0&&(I=c.onCaughtError),c.onRecoverableError!==void 0&&(V=c.onRecoverableError)),c=__(a,1,!1,null,null,m,b,null,E,I,V,Bx),a[gi]=c.current,Pm(a),new Pv(c)},Fm.hydrateRoot=function(a,c,m){if(!o(a))throw Error(n(299));var b=!1,E="",I=Bg,V=Ng,te=zg,xe=null;return m!=null&&(m.unstable_strictMode===!0&&(b=!0),m.identifierPrefix!==void 0&&(E=m.identifierPrefix),m.onUncaughtError!==void 0&&(I=m.onUncaughtError),m.onCaughtError!==void 0&&(V=m.onCaughtError),m.onRecoverableError!==void 0&&(te=m.onRecoverableError),m.formState!==void 0&&(xe=m.formState)),c=__(a,1,!0,c,m??null,b,E,xe,I,V,te,Bx),c.context=y_(null),m=c.current,b=ia(),b=je(b),E=ft(b),E.callback=null,Ot(m,E,b),m=b,c.current.lanes=m,Me(c,m),fo(c),a[gi]=c.current,Pm(a),new E_(c)},Fm.version="19.2.8",Fm}var Xx;function vE(){if(Xx)return Ov.exports;Xx=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),Ov.exports=yE(),Ov.exports}var bE=vE();const xE=Object.freeze({RESAMPLE_M:8,R_REP:20,R_NEW:30,BEARING_TOL:45,BEARING_BASELINE_SAMPLES:2,GUARD_ALONG:50,L_MIN:24,GAP_SPLIT_M:60,GAP_SPLIT_S:60,STATION_S:90,STATION_D:24,ALT_GATE:10,CELL_MERC:64,FOLDBACK_RATIO:.4,uTurnDedup:!0,offsetDetector:!0,OFFSET_MIN_RUN:200,OFFSET_SEARCH:50,OFFSET_MIN_FRAC:.8,OFFSET_MAX_IQR:8,OFFSET_DIR_TOL:30});function wE(t){const e=Object.keys(t).sort();return JSON.stringify(e.map(i=>[i,t[i]]))}function TE(t){const e=wE(t);let i=2166136261;for(let n=0;n<e.length;n++)i^=e.charCodeAt(n),i=Math.imul(i,16777619)>>>0;return`fnv1a:${i.toString(16).padStart(8,"0")}`}TE(xE);const nv=6378137,rv=Math.PI/180;function qx(t){return t*rv*nv}function Zx(t){return Math.log(Math.tan(Math.PI/4+t*rv/2))*nv}function zv(t){return t/nv/rv}function Lv(t){return(2*Math.atan(Math.exp(t/nv))-Math.PI/2)/rv}var iy={exports:{}};/** 50 * MapLibre GL JS 51 * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v4.7.1/LICENSE.txt 52 */var SE=iy.exports,Yx;function AE(){return Yx||(Yx=1,(function(t,e){(function(i,n){t.exports=n()})(SE,(function(){var i={},n={};function o(p,h,A){if(n[p]=A,p==="index"){var R="var sharedModule = {}; ("+n.shared+")(sharedModule); ("+n.worker+")(sharedModule);",B={};return n.shared(B),n.index(i,B),typeof window<"u"&&i.setWorkerUrl(window.URL.createObjectURL(new Blob([R],{type:"text/javascript"}))),i}}o("shared",["exports"],(function(p){function h(l,s,u,g){return new(u||(u=Promise))((function(v,T){function S(k){try{P(g.next(k))}catch(z){T(z)}}function C(k){try{P(g.throw(k))}catch(z){T(z)}}function P(k){var z;k.done?v(k.value):(z=k.value,z instanceof u?z:new u((function(U){U(z)}))).then(S,C)}P((g=g.apply(l,s||[])).next())}))}
vendor: 9,970 bytes, line 52
52function A(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}typeof SuppressedError=="function"&&SuppressedError;var R=B;function B(l,s){this.x=l,this.y=s}B.prototype={clone:function(){return new B(this.x,this.y)},add:function(l){return this.clone()._add(l)},sub:function(l){return this.clone()._sub(l)},multByPoint:function(l){return this.clone()._multByPoint(l)},divByPoint:function(l){return this.clone()._divByPoint(l)},mult:function(l){return this.clone()._mult(l)},div:function(l){return this.clone()._div(l)},rotate:function(l){return this.clone()._rotate(l)},rotateAround:function(l,s){return this.clone()._rotateAround(l,s)},matMult:function(l){return this.clone()._matMult(l)},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(l){return this.x===l.x&&this.y===l.y},dist:function(l){return Math.sqrt(this.distSqr(l))},distSqr:function(l){var s=l.x-this.x,u=l.y-this.y;return s*s+u*u},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(l){return Math.atan2(this.y-l.y,this.x-l.x)},angleWith:function(l){return this.angleWithSep(l.x,l.y)},angleWithSep:function(l,s){return Math.atan2(this.x*s-this.y*l,this.x*l+this.y*s)},_matMult:function(l){var s=l[2]*this.x+l[3]*this.y;return this.x=l[0]*this.x+l[1]*this.y,this.y=s,this},_add:function(l){return this.x+=l.x,this.y+=l.y,this},_sub:function(l){return this.x-=l.x,this.y-=l.y,this},_mult:function(l){return this.x*=l,this.y*=l,this},_div:function(l){return this.x/=l,this.y/=l,this},_multByPoint:function(l){return this.x*=l.x,this.y*=l.y,this},_divByPoint:function(l){return this.x/=l.x,this.y/=l.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var l=this.y;return this.y=this.x,this.x=-l,this},_rotate:function(l){var s=Math.cos(l),u=Math.sin(l),g=u*this.x+s*this.y;return this.x=s*this.x-u*this.y,this.y=g,this},_rotateAround:function(l,s){var u=Math.cos(l),g=Math.sin(l),v=s.y+g*(this.x-s.x)+u*(this.y-s.y);return this.x=s.x+u*(this.x-s.x)-g*(this.y-s.y),this.y=v,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},B.convert=function(l){return l instanceof B?l:Array.isArray(l)?new B(l[0],l[1]):l};var N=A(R),F=Q;function Q(l,s,u,g){this.cx=3*l,this.bx=3*(u-l)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*s,this.by=3*(g-s)-this.cy,this.ay=1-this.cy-this.by,this.p1x=l,this.p1y=s,this.p2x=u,this.p2y=g}Q.prototype={sampleCurveX:function(l){return((this.ax*l+this.bx)*l+this.cx)*l},sampleCurveY:function(l){return((this.ay*l+this.by)*l+this.cy)*l},sampleCurveDerivativeX:function(l){return(3*this.ax*l+2*this.bx)*l+this.cx},solveCurveX:function(l,s){if(s===void 0&&(s=1e-6),l<0)return 0;if(l>1)return 1;for(var u=l,g=0;g<8;g++){var v=this.sampleCurveX(u)-l;if(Math.abs(v)<s)return u;var T=this.sampleCurveDerivativeX(u);if(Math.abs(T)<1e-6)break;u-=v/T}var S=0,C=1;for(u=l,g=0;g<20&&(v=this.sampleCurveX(u),!(Math.abs(v-l)<s));g++)l>v?S=u:C=u,u=.5*(C-S)+S;return u},solve:function(l,s){return this.sampleCurveY(this.solveCurveX(l,s))}};var re=A(F);let se,ae;function me(){return se==null&&(se=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),se}function we(){if(ae==null&&(ae=!1,me())){const s=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(s){for(let g=0;g<25;g++){const v=4*g;s.fillStyle=`rgb(${v},${v+1},${v+2})`,s.fillRect(g%5,Math.floor(g/5),1,1)}const u=s.getImageData(0,0,5,5).data;for(let g=0;g<100;g++)if(g%4!=3&&u[g]!==g){ae=!0;break}}}return ae||!1}function ve(l,s,u,g){const v=new re(l,s,u,g);return T=>v.solve(T)}const Oe=ve(.25,.1,.25,1);function Te(l,s,u){return Math.min(u,Math.max(s,l))}function Re(l,s,u){const g=u-s,v=((l-s)%g+g)%g+s;return v===s?u:v}function Ee(l,...s){for(const u of s)for(const g in u)l[g]=u[g];return l}let Je=1;function rt(l,s,u){const g={};for(const v in l)g[v]=s.call(this,l[v],v,l);return g}function Ke(l,s,u){const g={};for(const v in l)s.call(this,l[v],v,l)&&(g[v]=l[v]);return g}function Qe(l){return Array.isArray(l)?l.map(Qe):typeof l=="object"&&l?rt(l,Qe):l}const ht={};function At(l){ht[l]||(typeof console<"u"&&console.warn(l),ht[l]=!0)}function Fe(l,s,u){return(u.y-l.y)*(s.x-l.x)>(s.y-l.y)*(u.x-l.x)}function Dt(l){return typeof WorkerGlobalScope<"u"&&l!==void 0&&l instanceof WorkerGlobalScope}let Le=null;function nt(l){return typeof ImageBitmap<"u"&&l instanceof ImageBitmap}const mt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function ei(l,s,u,g,v){return h(this,void 0,void 0,(function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const T=new VideoFrame(l,{timestamp:0});try{const S=T==null?void 0:T.format;if(!S||!S.startsWith("BGR")&&!S.startsWith("RGB"))throw new Error(`Unrecognized format ${S}`);const C=S.startsWith("BGR"),P=new Uint8ClampedArray(g*v*4);if(yield T.copyTo(P,(function(k,z,U,W,Z){const K=4*Math.max(-z,0),J=(Math.max(0,U)-U)*W*4+K,ce=4*W,fe=Math.max(0,z),Be=Math.max(0,U);return{rect:{x:fe,y:Be,width:Math.min(k.width,z+W)-fe,height:Math.min(k.height,U+Z)-Be},layout:[{offset:J,stride:ce}]}})(l,s,u,g,v)),C)for(let k=0;k<P.length;k+=4){const z=P[k];P[k]=P[k+2],P[k+2]=z}return P}finally{T.close()}}))}let ai,oe;const Ue="AbortError";function ut(){return new Error(Ue)}const Tt={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function $t(l){return Tt.REGISTERED_PROTOCOLS[l.substring(0,l.indexOf("://"))]}const qt="global-dispatcher";class ti extends Error{constructor(s,u,g,v){super(`AJAXError: ${u} (${s}): ${g}`),this.status=s,this.statusText=u,this.url=g,this.body=v}}const Li=()=>Dt(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,ki=function(l,s){if(/:\/\//.test(l.url)&&!/^https?:|^file:/.test(l.url)){const g=$t(l.url);if(g)return g(l,s);if(Dt(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:l,targetMapId:qt},s)}if(!(/^file:/.test(u=l.url)||/^file:/.test(Li())&&!/^\w+:/.test(u))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return(function(g,v){return h(this,void 0,void 0,(function*(){const T=new Request(g.url,{method:g.method||"GET",body:g.body,credentials:g.credentials,headers:g.headers,cache:g.cache,referrer:Li(),signal:v.signal});g.type!=="json"||T.headers.has("Accept")||T.headers.set("Accept","application/json");const S=yield fetch(T);if(!S.ok){const k=yield S.blob();throw new ti(S.status,S.statusText,g.url,k)}let C;C=g.type==="arrayBuffer"||g.type==="image"?S.arrayBuffer():g.type==="json"?S.json():S.text();const P=yield C;if(v.signal.aborted)throw ut();return{data:P,cacheControl:S.headers.get("Cache-Control"),expires:S.headers.get("Expires")}}))})(l,s);if(Dt(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:l,mustQueue:!0,targetMapId:qt},s)}var u;return(function(g,v){return new Promise(((T,S)=>{var C;const P=new XMLHttpRequest;P.open(g.method||"GET",g.url,!0),g.type!=="arrayBuffer"&&g.type!=="image"||(P.responseType="arraybuffer");for(const k in g.headers)P.setRequestHeader(k,g.headers[k]);g.type==="json"&&(P.responseType="text",!((C=g.headers)===null||C===void 0)&&C.Accept||P.setRequestHeader("Accept","application/json")),P.withCredentials=g.credentials==="include",P.onerror=()=>{S(new Error(P.statusText))},P.onload=()=>{if(!v.signal.aborted)if((P.status>=200&&P.status<300||P.status===0)&&P.response!==null){let k=P.response;if(g.type==="json")try{k=JSON.parse(P.response)}catch(z){return void S(z)}T({data:k,cacheControl:P.getResponseHeader("Cache-Control"),expires:P.getResponseHeader("Expires")})}else{const k=new Blob([P.response],{type:P.getResponseHeader("Content-Type")});S(new ti(P.status,P.statusText,g.url,k))}},v.signal.addEventListener("abort",(()=>{P.abort(),S(ut())})),P.send(g.body)}))})(l,s)};function Er(l){if(!l||l.indexOf("://")<=0||l.indexOf("data:image/")===0||l.indexOf("blob:")===0)return!0;const s=new URL(l),u=window.location;return s.protocol===u.protocol&&s.host===u.host}function Ts(l,s,u){u[l]&&u[l].indexOf(s)!==-1||(u[l]=u[l]||[],u[l].push(s))}function ot(l,s,u){if(u&&u[l]){const g=u[l].indexOf(s);g!==-1&&u[l].splice(g,1)}}class si{constructor(s,u={}){Ee(this,u),this.type=s}}class pi extends si{constructor(s,u={}){super("error",Ee({error:s},u))}}class Cn{on(s,u){return this._listeners=this._listeners||{},Ts(s,u,this._listeners),this}off(s,u){return ot(s,u,this._listeners),ot(s,u,this._oneTimeListeners),this}once(s,u){return u?(this._oneTimeListeners=this._oneTimeListeners||{},Ts(s,u,this._oneTimeListeners),this):new Promise((g=>this.once(s,g)))}fire(s,u){typeof s=="string"&&(s=new si(s,u||{}));const g=s.type;if(this.listens(g)){s.target=this;const v=this._listeners&&this._listeners[g]?this._listeners[g].slice():[];for(const C of v)C.call(this,s);const T=this._oneTimeListeners&&this._oneTimeListeners[g]?this._oneTimeListeners[g].slice():[];for(const C of T)ot(g,C,this._oneTimeListeners),C.call(this,s);const S=this._eventedParent;S&&(Ee(s,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),S.fire(s))}else s instanceof pi&&console.error(s.error);return this}listens(s){return this._listeners&&this._listeners[s]&&this._listeners[s].length>0||this._oneTimeListeners&&this._oneTimeListeners[s]&&this._oneTimeListeners[s].length>0||this._eventedParent&&this._eventedParent.listens(s)}setEventedParent(s,u){return this._eventedParent=s,this._eventedParentData=u,this}}var _e={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"}
vendor: 3,574 bytes, line 52
52,bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},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:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},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
vendor: 8,509 bytes, line 52
52","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-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}
vendor: 8,873 bytes, line 52
52,"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":{}}},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}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"enum",default:"mercator",values:{mercator:{},globe:{}}}},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"}
vendor: 9,830 bytes, line 52
52,"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"}}};const
vendor: 65,365 bytes, line 52
52Pt=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function gt(l,s){const u={};for(const g in l)g!=="ref"&&(u[g]=l[g]);return Pt.forEach((g=>{g in s&&(u[g]=s[g])})),u}function Ut(l,s){if(Array.isArray(l)){if(!Array.isArray(s)||l.length!==s.length)return!1;for(let u=0;u<l.length;u++)if(!Ut(l[u],s[u]))return!1;return!0}if(typeof l=="object"&&l!==null&&s!==null){if(typeof s!="object"||Object.keys(l).length!==Object.keys(s).length)return!1;for(const u in l)if(!Ut(l[u],s[u]))return!1;return!0}return l===s}function Ri(l,s){l.push(s)}function Gi(l,s,u){Ri(u,{command:"addSource",args:[l,s[l]]})}function or(l,s,u){Ri(s,{command:"removeSource",args:[l]}),u[l]=!0}function vn(l,s,u,g){or(l,u,g),Gi(l,s,u)}function sn(l,s,u){let g;for(g in l[u])if(Object.prototype.hasOwnProperty.call(l[u],g)&&g!=="data"&&!Ut(l[u][g],s[u][g]))return!1;for(g in s[u])if(Object.prototype.hasOwnProperty.call(s[u],g)&&g!=="data"&&!Ut(l[u][g],s[u][g]))return!1;return!0}function bn(l,s,u,g,v,T){l=l||{},s=s||{};for(const S in l)Object.prototype.hasOwnProperty.call(l,S)&&(Ut(l[S],s[S])||u.push({command:T,args:[g,S,s[S],v]}));for(const S in s)Object.prototype.hasOwnProperty.call(s,S)&&!Object.prototype.hasOwnProperty.call(l,S)&&(Ut(l[S],s[S])||u.push({command:T,args:[g,S,s[S],v]}))}function lr(l){return l.id}function Ss(l,s){return l[s.id]=s,l}class pt{constructor(s,u,g,v){this.message=(s?`${s}: `:"")+g,v&&(this.identifier=v),u!=null&&u.__line__&&(this.line=u.__line__)}}function oa(l,...s){for(const u of s)for(const g in u)l[g]=u[g];return l}class Ir extends Error{constructor(s,u){super(u),this.message=u,this.key=s}}class la{constructor(s,u=[]){this.parent=s,this.bindings={};for(const[g,v]of u)this.bindings[g]=v}concat(s){return new la(this,s)}get(s){if(this.bindings[s])return this.bindings[s];if(this.parent)return this.parent.get(s);throw new Error(`${s} not found in scope.`)}has(s){return!!this.bindings[s]||!!this.parent&&this.parent.has(s)}}const Za={kind:"null"},bt={kind:"number"},ii={kind:"string"},Wt={kind:"boolean"},xn={kind:"color"},Ws={kind:"object"},ui={kind:"value"},ca={kind:"collator"},As={kind:"formatted"},Xs={kind:"padding"},ps={kind:"resolvedImage"},de={kind:"variableAnchorOffsetCollection"};function q(l,s){return{kind:"array",itemType:l,N:s}}function X(l){if(l.kind==="array"){const s=X(l.itemType);return typeof l.N=="number"?`array<${s}, ${l.N}>`:l.itemType.kind==="value"?"array":`array<${s}>`}return l.kind}const ie=[Za,bt,ii,Wt,xn,As,Ws,q(ui),Xs,ps,de];function ue(l,s){if(s.kind==="error")return null;if(l.kind==="array"){if(s.kind==="array"&&(s.N===0&&s.itemType.kind==="value"||!ue(l.itemType,s.itemType))&&(typeof l.N!="number"||l.N===s.N))return null}else{if(l.kind===s.kind)return null;if(l.kind==="value"){for(const u of ie)if(!ue(u,s))return null}}return`Expected ${X(l)} but found ${X(s)} instead.`}function Se(l,s){return s.some((u=>u.kind===l.kind))}function Me(l,s){return s.some((u=>u==="null"?l===null:u==="array"?Array.isArray(l):u==="object"?l&&!Array.isArray(l)&&typeof l=="object":u===typeof l))}function ke(l,s){return l.kind==="array"&&s.kind==="array"?l.itemType.kind===s.itemType.kind&&typeof l.N=="number":l.kind===s.kind}const ye=.96422,qe=.82521,tt=4/29,je=6/29,yt=3*je*je,jt=je*je*je,Xt=Math.PI/180,yi=180/Math.PI;function Vt(l){return(l%=360)<0&&(l+=360),l}function hi([l,s,u,g]){let v,T;const S=$n((.2225045*(l=gi(l))+.7168786*(s=gi(s))+.0606169*(u=gi(u)))/1);l===s&&s===u?v=T=S:(v=$n((.4360747*l+.3850649*s+.1430804*u)/ye),T=$n((.0139322*l+.0971045*s+.7141733*u)/qe));const C=116*S-16;return[C<0?0:C,500*(v-S),200*(S-T),g]}function gi(l){return l<=.04045?l/12.92:Math.pow((l+.055)/1.055,2.4)}function $n(l){return l>jt?Math.pow(l,1/3):l/yt+tt}function kn([l,s,u,g]){let v=(l+16)/116,T=isNaN(s)?v:v+s/500,S=isNaN(u)?v:v-u/200;return v=1*qi(v),T=ye*qi(T),S=qe*qi(S),[vi(3.1338561*T-1.6168667*v-.4906146*S),vi(-.9787684*T+1.9161415*v+.033454*S),vi(.0719453*T-.2289914*v+1.4052427*S),g]}function vi(l){return(l=l<=.00304?12.92*l:1.055*Math.pow(l,1/2.4)-.055)<0?0:l>1?1:l}function qi(l){return l>je?l*l*l:yt*(l-tt)}function Ji(l){return parseInt(l.padEnd(2,l),16)/255}function tr(l,s){return Hn(s?l/100:l,0,1)}function Hn(l,s,u){return Math.min(Math.max(s,l),u)}function ir(l){return!l.some(Number.isNaN)}const ua={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};class Fi{constructor(s,u,g,v=1,T=!0){this.r=s,this.g=u,this.b=g,this.a=v,T||(this.r*=v,this.g*=v,this.b*=v,v||this.overwriteGetter("rgb",[s,u,g,v]))}static parse(s){if(s instanceof Fi)return s;if(typeof s!="string")return;const u=(function(g){if((g=g.toLowerCase().trim())==="transparent")return[0,0,0,0];const v=ua[g];if(v){const[S,C,P]=v;return[S/255,C/255,P/255,1]}if(g.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(g)){const S=g.length<6?1:2;let C=1;return[Ji(g.slice(C,C+=S)),Ji(g.slice(C,C+=S)),Ji(g.slice(C,C+=S)),Ji(g.slice(C,C+S)||"ff")]}if(g.startsWith("rgb")){const S=g.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(S){const[C,P,k,z,U,W,Z,K,J,ce,fe,Be]=S,Ae=[z||" ",Z||" ",ce].join("");if(Ae===" "||Ae===" /"||Ae===",,"||Ae===",,,"){const De=[k,W,J].join(""),Xe=De==="%%%"?100:De===""?255:0;if(Xe){const ct=[Hn(+P/Xe,0,1),Hn(+U/Xe,0,1),Hn(+K/Xe,0,1),fe?tr(+fe,Be):1];if(ir(ct))return ct}}return}}const T=g.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(T){const[S,C,P,k,z,U,W,Z,K]=T,J=[P||" ",z||" ",W].join("");if(J===" "||J===" /"||J===",,"||J===",,,"){const ce=[+C,Hn(+k,0,100),Hn(+U,0,100),Z?tr(+Z,K):1];if(ir(ce))return(function([fe,Be,Ae,De]){function Xe(ct){const Rt=(ct+fe/30)%12,Yt=Be*Math.min(Ae,1-Ae);return Ae-Yt*Math.max(-1,Math.min(Rt-3,9-Rt,1))}return fe=Vt(fe),Be/=100,Ae/=100,[Xe(0),Xe(8),Xe(4),De]})(ce)}}})(s);return u?new Fi(...u,!1):void 0}get rgb(){const{r:s,g:u,b:g,a:v}=this,T=v||1/0;return this.overwriteGetter("rgb",[s/T,u/T,g/T,v])}get hcl(){return this.overwriteGetter("hcl",(function(s){const[u,g,v,T]=hi(s),S=Math.sqrt(g*g+v*v);return[Math.round(1e4*S)?Vt(Math.atan2(v,g)*yi):NaN,S,u,T]})(this.rgb))}get lab(){return this.overwriteGetter("lab",hi(this.rgb))}overwriteGetter(s,u){return Object.defineProperty(this,s,{value:u}),u}toString(){const[s,u,g,v]=this.rgb;return`rgba(${[s,u,g].map((T=>Math.round(255*T))).join(",")},${v})`}}Fi.black=new Fi(0,0,0,1),Fi.white=new Fi(1,1,1,1),Fi.transparent=new Fi(0,0,0,0),Fi.red=new Fi(1,0,0,1);class nr{constructor(s,u,g){this.sensitivity=s?u?"variant":"case":u?"accent":"base",this.locale=g,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(s,u){return this.collator.compare(s,u)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Xc{constructor(s,u,g,v,T){this.text=s,this.image=u,this.scale=g,this.fontStack=v,this.textColor=T}}class ts{constructor(s){this.sections=s}static fromString(s){return new ts([new Xc(s,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some((s=>s.text.length!==0||s.image&&s.image.name.length!==0))}static factory(s){return s instanceof ts?s:ts.fromString(s)}toString(){return this.sections.length===0?"":this.sections.map((s=>s.text)).join("")}}class cr{constructor(s){this.values=s.slice()}static parse(s){if(s instanceof cr)return s;if(typeof s=="number")return new cr([s,s,s,s]);if(Array.isArray(s)&&!(s.length<1||s.length>4)){for(const u of s)if(typeof u!="number")return;switch(s.length){case 1:s=[s[0],s[0],s[0],s[0]];break;case 2:s=[s[0],s[1],s[0],s[1]];break;case 3:s=[s[0],s[1],s[2],s[1]]}return new cr(s)}}toString(){return JSON.stringify(this.values)}}const cl=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Es{constructor(s){this.values=s.slice()}static parse(s){if(s instanceof Es)return s;if(Array.isArray(s)&&!(s.length<1)&&s.length%2==0){for(let u=0;u<s.length;u+=2){const g=s[u],v=s[u+1];if(typeof g!="string"||!cl.has(g)||!Array.isArray(v)||v.length!==2||typeof v[0]!="number"||typeof v[1]!="number")return}return new Es(s)}}toString(){return JSON.stringify(this.values)}}class is{constructor(s){this.name=s.name,this.available=s.available}toString(){return this.name}static fromString(s){return s?new is({name:s,available:!1}):null}}function bo(l,s,u,g){return typeof l=="number"&&l>=0&&l<=255&&typeof s=="number"&&s>=0&&s<=255&&typeof u=="number"&&u>=0&&u<=255?g===void 0||typeof g=="number"&&g>=0&&g<=1?null:`Invalid rgba value [${[l,s,u,g].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof g=="number"?[l,s,u,g]:[l,s,u]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function xo(l){if(l===null||typeof l=="string"||typeof l=="boolean"||typeof l=="number"||l instanceof Fi||l instanceof nr||l instanceof ts||l instanceof cr||l instanceof Es||l instanceof is)return!0;if(Array.isArray(l)){for(const s of l)if(!xo(s))return!1;return!0}if(typeof l=="object"){for(const s in l)if(!xo(l[s]))return!1;return!0}return!1}function Bn(l){if(l===null)return Za;if(typeof l=="string")return ii;if(typeof l=="boolean")return Wt;if(typeof l=="number")return bt;if(l instanceof Fi)return xn;if(l instanceof nr)return ca;if(l instanceof ts)return As;if(l instanceof cr)return Xs;if(l instanceof Es)return de;if(l instanceof is)return ps;if(Array.isArray(l)){const s=l.length;let u;for(const g of l){const v=Bn(g);if(u){if(u===v)continue;u=ui;break}u=v}return q(u||ui,s)}return Ws}function Ya(l){const s=typeof l;return l===null?"":s==="string"||s==="number"||s==="boolean"?String(l):l instanceof Fi||l instanceof ts||l instanceof cr||l instanceof Es||l instanceof is?l.toString():JSON.stringify(l)}class ur{constructor(s,u){this.type=s,this.value=u}static parse(s,u){if(s.length!==2)return u.error(`'literal' expression requires exactly one argument, but found ${s.length-1} instead.`);if(!xo(s[1]))return u.error("invalid value");const g=s[1];let v=Bn(g);const T=u.expectedType;return v.kind!=="array"||v.N!==0||!T||T.kind!=="array"||typeof T.N=="number"&&T.N!==0||(v=T),new ur(v,g)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class Hi{constructor(s){this.name="ExpressionEvaluationError",this.message=s}toJSON(){return this.message}}const rc={string:ii,number:bt,boolean:Wt,object:Ws};class qs{constructor(s,u){this.type=s,this.args=u}static parse(s,u){if(s.length<2)return u.error("Expected at least one argument.");let g,v=1;const T=s[0];if(T==="array"){let C,P;if(s.length>2){const k=s[1];if(typeof k!="string"||!(k in rc)||k==="object")return u.error('The item type argument of "array" must be one of string, number, boolean',1);C=rc[k],v++}else C=ui;if(s.length>3){if(s[2]!==null&&(typeof s[2]!="number"||s[2]<0||s[2]!==Math.floor(s[2])))return u.error('The length argument to "array" must be a positive integer literal',2);P=s[2],v++}g=q(C,P)}else{if(!rc[T])throw new Error(`Types doesn't contain name = ${T}`);g=rc[T]}const S=[];for(;v<s.length;v++){const C=u.parse(s[v],v,ui);if(!C)return null;S.push(C)}return new qs(g,S)}evaluate(s){for(let u=0;u<this.args.length;u++){const g=this.args[u].evaluate(s);if(!ue(this.type,Bn(g)))return g;if(u===this.args.length-1)throw new Hi(`Expected value to be of type ${X(this.type)}, but found ${X(Bn(g))} instead.`)}throw new Error}eachChild(s){this.args.forEach(s)}outputDefined(){return this.args.every((s=>s.outputDefined()))}}const sc={"to-boolean":Wt,"to-color":xn,"to-number":bt,"to-string":ii};class Cs{constructor(s,u){this.type=s,this.args=u}static parse(s,u){if(s.length<2)return u.error("Expected at least one argument.");const g=s[0];if(!sc[g])throw new Error(`Can't parse ${g} as it is not part of the known types`);if((g==="to-boolean"||g==="to-string")&&s.length!==2)return u.error("Expected one argument.");const v=sc[g],T=[];for(let S=1;S<s.length;S++){const C=u.parse(s[S],S,ui);if(!C)return null;T.push(C)}return new Cs(v,T)}evaluate(s){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(s);case"color":{let u,g;for(const v of this.args){if(u=v.evaluate(s),g=null,u instanceof Fi)return u;if(typeof u=="string"){const T=s.parseColor(u);if(T)return T}else if(Array.isArray(u)&&(g=u.length<3||u.length>4?`Invalid rbga value ${JSON.stringify(u)}: expected an array containing either three or four numeric values.`:bo(u[0],u[1],u[2],u[3]),!g))return new Fi(u[0]/255,u[1]/255,u[2]/255,u[3])}throw new Hi(g||`Could not parse color from value '${typeof u=="string"?u:JSON.stringify(u)}'`)}case"padding":{let u;for(const g of this.args){u=g.evaluate(s);const v=cr.parse(u);if(v)return v}throw new Hi(`Could not parse padding from value '${typeof u=="string"?u:JSON.stringify(u)}'`)}case"variableAnchorOffsetCollection":{let u;for(const g of this.args){u=g.evaluate(s);const v=Es.parse(u);if(v)return v}throw new Hi(`Could not parse variableAnchorOffsetCollection from value '${typeof u=="string"?u:JSON.stringify(u)}'`)}case"number":{let u=null;for(const g of this.args){if(u=g.evaluate(s),u===null)return 0;const v=Number(u);if(!isNaN(v))return v}throw new Hi(`Could not convert ${JSON.stringify(u)} to number.`)}case"formatted":return ts.fromString(Ya(this.args[0].evaluate(s)));case"resolvedImage":return is.fromString(Ya(this.args[0].evaluate(s)));default:return Ya(this.args[0].evaluate(s))}}eachChild(s){this.args.forEach(s)}outputDefined(){return this.args.every((s=>s.outputDefined()))}}const qc=["Unknown","Point","LineString","Polygon"];class Zc{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"?qc[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(s){let u=this._parseColorCache[s];return u||(u=this._parseColorCache[s]=Fi.parse(s)),u}}class mr{constructor(s,u,g=[],v,T=new la,S=[]){this.registry=s,this.path=g,this.key=g.map((C=>`[${C}]`)).join(""),this.scope=T,this.errors=S,this.expectedType=v,this._isConstant=u}parse(s,u,g,v,T={}){return u?this.concat(u,g,v)._parse(s,T):this._parse(s,T)}_parse(s,u){function g(v,T,S){return S==="assert"?new qs(T,[v]):S==="coerce"?new Cs(T,[v]):v}if(s!==null&&typeof s!="string"&&typeof s!="boolean"&&typeof s!="number"||(s=["literal",s]),Array.isArray(s)){if(s.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const v=s[0];if(typeof v!="string")return this.error(`Expression name must be a string, but found ${typeof v} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const T=this.registry[v];if(T){let S=T.parse(s,this);if(!S)return null;if(this.expectedType){const C=this.expectedType,P=S.type;if(C.kind!=="string"&&C.kind!=="number"&&C.kind!=="boolean"&&C.kind!=="object"&&C.kind!=="array"||P.kind!=="value")if(C.kind!=="color"&&C.kind!=="formatted"&&C.kind!=="resolvedImage"||P.kind!=="value"&&P.kind!=="string")if(C.kind!=="padding"||P.kind!=="value"&&P.kind!=="number"&&P.kind!=="array")if(C.kind!=="variableAnchorOffsetCollection"||P.kind!=="value"&&P.kind!=="array"){if(this.checkSubtype(C,P))return null}else S=g(S,C,u.typeAnnotation||"coerce");else S=g(S,C,u.typeAnnotation||"coerce");else S=g(S,C,u.typeAnnotation||"coerce");else S=g(S,C,u.typeAnnotation||"assert")}if(!(S instanceof ur)&&S.type.kind!=="resolvedImage"&&this._isConstant(S)){const C=new Zc;try{S=new ur(S.type,S.evaluate(C))}catch(P){return this.error(P.message),null}}return S}return this.error(`Unknown expression "${v}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(s===void 0?"'undefined' value invalid. Use null instead.":typeof s=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof s} instead.`)}concat(s,u,g){const v=typeof s=="number"?this.path.concat(s):this.path,T=g?this.scope.concat(g):this.scope;return new mr(this.registry,this._isConstant,v,u||null,T,this.errors)}error(s,...u){const g=`${this.key}${u.map((v=>`[${v}]`)).join("")}`;this.errors.push(new Ir(g,s))}checkSubtype(s,u){const g=ue(s,u);return g&&this.error(g),g}}class ha{constructor(s,u){this.type=u.type,this.bindings=[].concat(s),this.result=u}evaluate(s){return this.result.evaluate(s)}eachChild(s){for(const u of this.bindings)s(u[1]);s(this.result)}static parse(s,u){if(s.length<4)return u.error(`Expected at least 3 arguments, but found ${s.length-1} instead.`);const g=[];for(let T=1;T<s.length-1;T+=2){const S=s[T];if(typeof S!="string")return u.error(`Expected string, but found ${typeof S} instead.`,T);if(/[^a-zA-Z0-9_]/.test(S))return u.error("Variable names must contain only alphanumeric characters or '_'.",T);const C=u.parse(s[T+1],T+1);if(!C)return null;g.push([S,C])}const v=u.parse(s[s.length-1],s.length-1,u.expectedType,g);return v?new ha(g,v):null}outputDefined(){return this.result.outputDefined()}}class ji{constructor(s,u){this.type=u.type,this.name=s,this.boundExpression=u}static parse(s,u){if(s.length!==2||typeof s[1]!="string")return u.error("'var' expression requires exactly one string literal argument.");const g=s[1];return u.scope.has(g)?new ji(g,u.scope.get(g)):u.error(`Unknown variable "${g}". Make sure "${g}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(s){return this.boundExpression.evaluate(s)}eachChild(){}outputDefined(){return!1}}class ac{constructor(s,u,g){this.type=s,this.index=u,this.input=g}static parse(s,u){if(s.length!==3)return u.error(`Expected 2 arguments, but found ${s.length-1} instead.`);const g=u.parse(s[1],1,bt),v=u.parse(s[2],2,q(u.expectedType||ui));return g&&v?new ac(v.type.itemType,g,v):null}evaluate(s){const u=this.index.evaluate(s),g=this.input.evaluate(s);if(u<0)throw new Hi(`Array index out of bounds: ${u} < 0.`);if(u>=g.length)throw new Hi(`Array index out of bounds: ${u} > ${g.length-1}.`);if(u!==Math.floor(u))throw new Hi(`Array index must be an integer, but found ${u} instead.`);return g[u]}eachChild(s){s(this.index),s(this.input)}outputDefined(){return!1}}class Ga{constructor(s,u){this.type=Wt,this.needle=s,this.haystack=u}static parse(s,u){if(s.length!==3)return u.error(`Expected 2 arguments, but found ${s.length-1} instead.`);const g=u.parse(s[1],1,ui),v=u.parse(s[2],2,ui);return g&&v?Se(g.type,[Wt,ii,bt,Za,ui])?new Ga(g,v):u.error(`Expected first argument to be of type boolean, string, number or null, but found ${X(g.type)} instead`):null}evaluate(s){const u=this.needle.evaluate(s),g=this.haystack.evaluate(s);if(!g)return!1;if(!Me(u,["boolean","string","number","null"]))throw new Hi(`Expected first argument to be of type boolean, string, number or null, but found ${X(Bn(u))} instead.`);if(!Me(g,["string","array"]))throw new Hi(`Expected second argument to be of type array or string, but found ${X(Bn(g))} instead.`);return g.indexOf(u)>=0}eachChild(s){s(this.needle),s(this.haystack)}outputDefined(){return!0}}class wo{constructor(s,u,g){this.type=bt,this.needle=s,this.haystack=u,this.fromIndex=g}static parse(s,u){if(s.length<=2||s.length>=5)return u.error(`Expected 3 or 4 arguments, but found ${s.length-1} instead.`);const g=u.parse(s[1],1,ui),v=u.parse(s[2],2,ui);if(!g||!v)return null;if(!Se(g.type,[Wt,ii,bt,Za,ui]))return u.error(`Expected first argument to be of type boolean, string, number or null, but found ${X(g.type)} instead`);if(s.length===4){const T=u.parse(s[3],3,bt);return T?new wo(g,v,T):null}return new wo(g,v)}evaluate(s){const u=this.needle.evaluate(s),g=this.haystack.evaluate(s);if(!Me(u,["boolean","string","number","null"]))throw new Hi(`Expected first argument to be of type boolean, string, number or null, but found ${X(Bn(u))} instead.`);let v;if(this.fromIndex&&(v=this.fromIndex.evaluate(s)),Me(g,["string"])){const T=g.indexOf(u,v);return T===-1?-1:[...g.slice(0,T)].length}if(Me(g,["array"]))return g.indexOf(u,v);throw new Hi(`Expected second argument to be of type array or string, but found ${X(Bn(g))} instead.`)}eachChild(s){s(this.needle),s(this.haystack),this.fromIndex&&s(this.fromIndex)}outputDefined(){return!1}}class Yc{constructor(s,u,g,v,T,S){this.inputType=s,this.type=u,this.input=g,this.cases=v,this.outputs=T,this.otherwise=S}static parse(s,u){if(s.length<5)return u.error(`Expected at least 4 arguments, but found only ${s.length-1}.`);if(s.length%2!=1)return u.error("Expected an even number of arguments.");let g,v;u.expectedType&&u.expectedType.kind!=="value"&&(v=u.expectedType);const T={},S=[];for(let k=2;k<s.length-1;k+=2){let z=s[k];const U=s[k+1];Array.isArray(z)||(z=[z]);const W=u.concat(k);if(z.length===0)return W.error("Expected at least one branch label.");for(const K of z){if(typeof K!="number"&&typeof K!="string")return W.error("Branch labels must be numbers or strings.");if(typeof K=="number"&&Math.abs(K)>Number.MAX_SAFE_INTEGER)return W.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof K=="number"&&Math.floor(K)!==K)return W.error("Numeric branch labels must be integer values.");if(g){if(W.checkSubtype(g,Bn(K)))return null}else g=Bn(K);if(T[String(K)]!==void 0)return W.error("Branch labels must be unique.");T[String(K)]=S.length}const Z=u.parse(U,k,v);if(!Z)return null;v=v||Z.type,S.push(Z)}const C=u.parse(s[1],1,ui);if(!C)return null;const P=u.parse(s[s.length-1],s.length-1,v);return P?C.type.kind!=="value"&&u.concat(1).checkSubtype(g,C.type)?null:new Yc(g,v,C,T,S,P):null}evaluate(s){const u=this.input.evaluate(s);return(Bn(u)===this.inputType&&this.outputs[this.cases[u]]||this.otherwise).evaluate(s)}eachChild(s){s(this.input),this.outputs.forEach(s),s(this.otherwise)}outputDefined(){return this.outputs.every((s=>s.outputDefined()))&&this.otherwise.outputDefined()}}class Ta{constructor(s,u,g){this.type=s,this.branches=u,this.otherwise=g}static parse(s,u){if(s.length<4)return u.error(`Expected at least 3 arguments, but found only ${s.length-1}.`);if(s.length%2!=0)return u.error("Expected an odd number of arguments.");let g;u.expectedType&&u.expectedType.kind!=="value"&&(g=u.expectedType);const v=[];for(let S=1;S<s.length-1;S+=2){const C=u.parse(s[S],S,Wt);if(!C)return null;const P=u.parse(s[S+1],S+1,g);if(!P)return null;v.push([C,P]),g=g||P.type}const T=u.parse(s[s.length-1],s.length-1,g);if(!T)return null;if(!g)throw new Error("Can't infer output type");return new Ta(g,v,T)}evaluate(s){for(const[u,g]of this.branches)if(u.evaluate(s))return g.evaluate(s);return this.otherwise.evaluate(s)}eachChild(s){for(const[u,g]of this.branches)s(u),s(g);s(this.otherwise)}outputDefined(){return this.branches.every((([s,u])=>u.outputDefined()))&&this.otherwise.outputDefined()}}class oc{constructor(s,u,g,v){this.type=s,this.input=u,this.beginIndex=g,this.endIndex=v}static parse(s,u){if(s.length<=2||s.length>=5)return u.error(`Expected 3 or 4 arguments, but found ${s.length-1} instead.`);const g=u.parse(s[1],1,ui),v=u.parse(s[2],2,bt);if(!g||!v)return null;if(!Se(g.type,[q(ui),ii,ui]))return u.error(`Expected first argument to be of type array or string, but found ${X(g.type)} instead`);if(s.length===4){const T=u.parse(s[3],3,bt);return T?new oc(g.type,g,v,T):null}return new oc(g.type,g,v)}evaluate(s){const u=this.input.evaluate(s),g=this.beginIndex.evaluate(s);let v;if(this.endIndex&&(v=this.endIndex.evaluate(s)),Me(u,["string"]))return[...u].slice(g,v).join("");if(Me(u,["array"]))return u.slice(g,v);throw new Hi(`Expected first argument to be of type array or string, but found ${X(Bn(u))} instead.`)}eachChild(s){s(this.input),s(this.beginIndex),this.endIndex&&s(this.endIndex)}outputDefined(){return!1}}function lc(l,s){const u=l.length-1;let g,v,T=0,S=u,C=0;for(;T<=S;)if(C=Math.floor((T+S)/2),g=l[C],v=l[C+1],g<=s){if(C===u||s<v)return C;T=C+1}else{if(!(g>s))throw new Hi("Input is not a number.");S=C-1}return 0}class To{constructor(s,u,g){this.type=s,this.input=u,this.labels=[],this.outputs=[];for(const[v,T]of g)this.labels.push(v),this.outputs.push(T)}static parse(s,u){if(s.length-1<4)return u.error(`Expected at least 4 arguments, but found only ${s.length-1}.`);if((s.length-1)%2!=0)return u.error("Expected an even number of arguments.");const g=u.parse(s[1],1,bt);if(!g)return null;const v=[];let T=null;u.expectedType&&u.expectedType.kind!=="value"&&(T=u.expectedType);for(let S=1;S<s.length;S+=2){const C=S===1?-1/0:s[S],P=s[S+1],k=S,z=S+1;if(typeof C!="number")return u.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',k);if(v.length&&v[v.length-1][0]>=C)return u.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',k);const U=u.parse(P,z,T);if(!U)return null;T=T||U.type,v.push([C,U])}return new To(T,g,v)}evaluate(s){const u=this.labels,g=this.outputs;if(u.length===1)return g[0].evaluate(s);const v=this.input.evaluate(s);if(v<=u[0])return g[0].evaluate(s);const T=u.length;return v>=u[T-1]?g[T-1].evaluate(s):g[lc(u,v)].evaluate(s)}eachChild(s){s(this.input);for(const u of this.outputs)s(u)}outputDefined(){return this.outputs.every((s=>s.outputDefined()))}}function Gc(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var Rp=jd;function jd(l,s,u,g){this.cx=3*l,this.bx=3*(u-l)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*s,this.by=3*(g-s)-this.cy,this.ay=1-this.cy-this.by,this.p1x=l,this.p1y=s,this.p2x=u,this.p2y=g}jd.prototype={sampleCurveX:function(l){return((this.ax*l+this.bx)*l+this.cx)*l},sampleCurveY:function(l){return((this.ay*l+this.by)*l+this.cy)*l},sampleCurveDerivativeX:function(l){return(3*this.ax*l+2*this.bx)*l+this.cx},solveCurveX:function(l,s){if(s===void 0&&(s=1e-6),l<0)return 0;if(l>1)return 1;for(var u=l,g=0;g<8;g++){var v=this.sampleCurveX(u)-l;if(Math.abs(v)<s)return u;var T=this.sampleCurveDerivativeX(u);if(Math.abs(T)<1e-6)break;u-=v/T}var S=0,C=1;for(u=l,g=0;g<20&&(v=this.sampleCurveX(u),!(Math.abs(v-l)<s));g++)l>v?S=u:C=u,u=.5*(C-S)+S;return u},solve:function(l,s){return this.sampleCurveY(this.solveCurveX(l,s))}};var Kc=Gc(Rp);function Xr(l,s,u){return l+u*(s-l)}function So(l,s,u){return l.map(((g,v)=>Xr(g,s[v],u)))}const Dr={number:Xr,color:function(l,s,u,g="rgb"){switch(g){case"rgb":{const[v,T,S,C]=So(l.rgb,s.rgb,u);return new Fi(v,T,S,C,!1)}case"hcl":{const[v,T,S,C]=l.hcl,[P,k,z,U]=s.hcl;let W,Z;if(isNaN(v)||isNaN(P))isNaN(v)?isNaN(P)?W=NaN:(W=P,S!==1&&S!==0||(Z=k)):(W=v,z!==1&&z!==0||(Z=T));else{let Be=P-v;P>v&&Be>180?Be-=360:P<v&&v-P>180&&(Be+=360),W=v+u*Be}const[K,J,ce,fe]=(function([Be,Ae,De,Xe]){return Be=isNaN(Be)?0:Be*Xt,kn([De,Math.cos(Be)*Ae,Math.sin(Be)*Ae,Xe])})([W,Z??Xr(T,k,u),Xr(S,z,u),Xr(C,U,u)]);return new Fi(K,J,ce,fe,!1)}case"lab":{const[v,T,S,C]=kn(So(l.lab,s.lab,u));return new Fi(v,T,S,C,!1)}}},array:So,padding:function(l,s,u){return new cr(So(l.values,s.values,u))},variableAnchorOffsetCollection:function(l,s,u){const g=l.values,v=s.values;if(g.length!==v.length)throw new Hi(`Cannot interpolate values of different length. from: ${l.toString()}, to: ${s.toString()}`);const T=[];for(let S=0;S<g.length;S+=2){if(g[S]!==v[S])throw new Hi(`Cannot interpolate values containing mismatched anchors. from[${S}]: ${g[S]}, to[${S}]: ${v[S]}`);T.push(g[S]);const[C,P]=g[S+1],[k,z]=v[S+1];T.push([Xr(C,k,u),Xr(P,z,u)])}return new Es(T)}};class hr{constructor(s,u,g,v,T){this.type=s,this.operator=u,this.interpolation=g,this.input=v,this.labels=[],this.outputs=[];for(const[S,C]of T)this.labels.push(S),this.outputs.push(C)}static interpolationFactor(s,u,g,v){let T=0;if(s.name==="exponential")T=Sa(u,s.base,g,v);else if(s.name==="linear")T=Sa(u,1,g,v);else if(s.name==="cubic-bezier"){const S=s.controlPoints;T=new Kc(S[0],S[1],S[2],S[3]).solve(Sa(u,1,g,v))}return T}static parse(s,u){let[g,v,T,...S]=s;if(!Array.isArray(v)||v.length===0)return u.error("Expected an interpolation type expression.",1);if(v[0]==="linear")v={name:"linear"};else if(v[0]==="exponential"){const k=v[1];if(typeof k!="number")return u.error("Exponential interpolation requires a numeric base.",1,1);v={name:"exponential",base:k}}else{if(v[0]!=="cubic-bezier")return u.error(`Unknown interpolation type ${String(v[0])}`,1,0);{const k=v.slice(1);if(k.length!==4||k.some((z=>typeof z!="number"||z<0||z>1)))return u.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);v={name:"cubic-bezier",controlPoints:k}}}if(s.length-1<4)return u.error(`Expected at least 4 arguments, but found only ${s.length-1}.`);if((s.length-1)%2!=0)return u.error("Expected an even number of arguments.");if(T=u.parse(T,2,bt),!T)return null;const C=[];let P=null;g==="interpolate-hcl"||g==="interpolate-lab"?P=xn:u.expectedType&&u.expectedType.kind!=="value"&&(P=u.expectedType);for(let k=0;k<S.length;k+=2){const z=S[k],U=S[k+1],W=k+3,Z=k+4;if(typeof z!="number")return u.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',W);if(C.length&&C[C.length-1][0]>=z)return u.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',W);const K=u.parse(U,Z,P);if(!K)return null;P=P||K.type,C.push([z,K])}return ke(P,bt)||ke(P,xn)||ke(P,Xs)||ke(P,de)||ke(P,q(bt))?new hr(P,g,v,T,C):u.error(`Type ${X(P)} is not interpolatable.`)}evaluate(s){const u=this.labels,g=this.outputs;if(u.length===1)return g[0].evaluate(s);const v=this.input.evaluate(s);if(v<=u[0])return g[0].evaluate(s);const T=u.length;if(v>=u[T-1])return g[T-1].evaluate(s);const S=lc(u,v),C=hr.interpolationFactor(this.interpolation,v,u[S],u[S+1]),P=g[S].evaluate(s),k=g[S+1].evaluate(s);switch(this.operator){case"interpolate":return Dr[this.type.kind](P,k,C);case"interpolate-hcl":return Dr.color(P,k,C,"hcl");case"interpolate-lab":return Dr.color(P,k,C,"lab")}}eachChild(s){s(this.input);for(const u of this.outputs)s(u)}outputDefined(){return this.outputs.every((s=>s.outputDefined()))}}function Sa(l,s,u,g){const v=g-u,T=l-u;return v===0?0:s===1?T/v:(Math.pow(s,T)-1)/(Math.pow(s,v)-1)}class cc{constructor(s,u){this.type=s,this.args=u}static parse(s,u){if(s.length<2)return u.error("Expectected at least one argument.");let g=null;const v=u.expectedType;v&&v.kind!=="value"&&(g=v);const T=[];for(const C of s.slice(1)){const P=u.parse(C,1+T.length,g,void 0,{typeAnnotation:"omit"});if(!P)return null;g=g||P.type,T.push(P)}if(!g)throw new Error("No output type");const S=v&&T.some((C=>ue(v,C.type)));return new cc(S?ui:g,T)}evaluate(s){let u,g=null,v=0;for(const T of this.args)if(v++,g=T.evaluate(s),g&&g instanceof is&&!g.available&&(u||(u=g.name),g=null,v===this.args.length&&(g=u)),g!==null)break;return g}eachChild(s){this.args.forEach(s)}outputDefined(){return this.args.every((s=>s.outputDefined()))}}function ul(l,s){return l==="=="||l==="!="?s.kind==="boolean"||s.kind==="string"||s.kind==="number"||s.kind==="null"||s.kind==="value":s.kind==="string"||s.kind==="number"||s.kind==="value"}function bh(l,s,u,g){return g.compare(s,u)===0}function da(l,s,u){const g=l!=="=="&&l!=="!=";return class iS{constructor(T,S,C){this.type=Wt,this.lhs=T,this.rhs=S,this.collator=C,this.hasUntypedArgument=T.type.kind==="value"||S.type.kind==="value"}static parse(T,S){if(T.length!==3&&T.length!==4)return S.error("Expected two or three arguments.");const C=T[0];let P=S.parse(T[1],1,ui);if(!P)return null;if(!ul(C,P.type))return S.concat(1).error(`"${C}" comparisons are not supported for type '${X(P.type)}'.`);let k=S.parse(T[2],2,ui);if(!k)return null;if(!ul(C,k.type))return S.concat(2).error(`"${C}" comparisons are not supported for type '${X(k.type)}'.`);if(P.type.kind!==k.type.kind&&P.type.kind!=="value"&&k.type.kind!=="value")return S.error(`Cannot compare types '${X(P.type)}' and '${X(k.type)}'.`);g&&(P.type.kind==="value"&&k.type.kind!=="value"?P=new qs(k.type,[P]):P.type.kind!=="value"&&k.type.kind==="value"&&(k=new qs(P.type,[k])));let z=null;if(T.length===4){if(P.type.kind!=="string"&&k.type.kind!=="string"&&P.type.kind!=="value"&&k.type.kind!=="value")return S.error("Cannot use collator to compare non-string types.");if(z=S.parse(T[3],3,ca),!z)return null}return new iS(P,k,z)}evaluate(T){const S=this.lhs.evaluate(T),C=this.rhs.evaluate(T);if(g&&this.hasUntypedArgument){const P=Bn(S),k=Bn(C);if(P.kind!==k.kind||P.kind!=="string"&&P.kind!=="number")throw new Hi(`Expected arguments for "${l}" to be (string, string) or (number, number), but found (${P.kind}, ${k.kind}) instead.`)}if(this.collator&&!g&&this.hasUntypedArgument){const P=Bn(S),k=Bn(C);if(P.kind!=="string"||k.kind!=="string")return s(T,S,C)}return this.collator?u(T,S,C,this.collator.evaluate(T)):s(T,S,C)}eachChild(T){T(this.lhs),T(this.rhs),this.collator&&T(this.collator)}outputDefined(){return!0}}}const Aa=da("==",(function(l,s,u){return s===u}),bh),Qc=da("!=",(function(l,s,u){return s!==u}),(function(l,s,u,g){return!bh(0,s,u,g)})),hl=da("<",(function(l,s,u){return s<u}),(function(l,s,u,g){return g.compare(s,u)<0})),Ka=da(">",(function(l,s,u){return s>u}),(function(l,s,u,g){return g.compare(s,u)>0})),xh=da("<=",(function(l,s,u){return s<=u}),(function(l,s,u,g){return g.compare(s,u)<=0})),uc=da(">=",(function(l,s,u){return s>=u}),(function(l,s,u,g){return g.compare(s,u)>=0}));class dl{constructor(s,u,g){this.type=ca,this.locale=g,this.caseSensitive=s,this.diacriticSensitive=u}static parse(s,u){if(s.length!==2)return u.error("Expected one argument.");const g=s[1];if(typeof g!="object"||Array.isArray(g))return u.error("Collator options argument must be an object.");const v=u.parse(g["case-sensitive"]!==void 0&&g["case-sensitive"],1,Wt);if(!v)return null;const T=u.parse(g["diacritic-sensitive"]!==void 0&&g["diacritic-sensitive"],1,Wt);if(!T)return null;let S=null;return g.locale&&(S=u.parse(g.locale,1,ii),!S)?null:new dl(v,T,S)}evaluate(s){return new nr(this.caseSensitive.evaluate(s),this.diacriticSensitive.evaluate(s),this.locale?this.locale.evaluate(s):null)}eachChild(s){s(this.caseSensitive),s(this.diacriticSensitive),this.locale&&s(this.locale)}outputDefined(){return!1}}class fl{constructor(s,u,g,v,T){this.type=ii,this.number=s,this.locale=u,this.currency=g,this.minFractionDigits=v,this.maxFractionDigits=T}static parse(s,u){if(s.length!==3)return u.error("Expected two arguments.");const g=u.parse(s[1],1,bt);if(!g)return null;const v=s[2];if(typeof v!="object"||Array.isArray(v))return u.error("NumberFormat options argument must be an object.");let T=null;if(v.locale&&(T=u.parse(v.locale,1,ii),!T))return null;let S=null;if(v.currency&&(S=u.parse(v.currency,1,ii),!S))return null;let C=null;if(v["min-fraction-digits"]&&(C=u.parse(v["min-fraction-digits"],1,bt),!C))return null;let P=null;return v["max-fraction-digits"]&&(P=u.parse(v["max-fraction-digits"],1,bt),!P)?null:new fl(g,T,S,C,P)}evaluate(s){return new Intl.NumberFormat(this.locale?this.locale.evaluate(s):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(s):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(s):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(s):void 0}).format(this.number.evaluate(s))}eachChild(s){s(this.number),this.locale&&s(this.locale),this.currency&&s(this.currency),this.minFractionDigits&&s(this.minFractionDigits),this.maxFractionDigits&&s(this.maxFractionDigits)}outputDefined(){return!1}}class Ao{constructor(s){this.type=As,this.sections=s}static parse(s,u){if(s.length<2)return u.error("Expected at least one argument.");const g=s[1];if(!Array.isArray(g)&&typeof g=="object")return u.error("First argument must be an image or text section.");const v=[];let T=!1;for(let S=1;S<=s.length-1;++S){const C=s[S];if(T&&typeof C=="object"&&!Array.isArray(C)){T=!1;let P=null;if(C["font-scale"]&&(P=u.parse(C["font-scale"],1,bt),!P))return null;let k=null;if(C["text-font"]&&(k=u.parse(C["text-font"],1,q(ii)),!k))return null;let z=null;if(C["text-color"]&&(z=u.parse(C["text-color"],1,xn),!z))return null;const U=v[v.length-1];U.scale=P,U.font=k,U.textColor=z}else{const P=u.parse(s[S],1,ui);if(!P)return null;const k=P.type.kind;if(k!=="string"&&k!=="value"&&k!=="null"&&k!=="resolvedImage")return u.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");T=!0,v.push({content:P,scale:null,font:null,textColor:null})}}return new Ao(v)}evaluate(s){return new ts(this.sections.map((u=>{const g=u.content.evaluate(s);return Bn(g)===ps?new Xc("",g,null,null,null):new Xc(Ya(g),null,u.scale?u.scale.evaluate(s):null,u.font?u.font.evaluate(s).join(","):null,u.textColor?u.textColor.evaluate(s):null)})))}eachChild(s){for(const u of this.sections)s(u.content),u.scale&&s(u.scale),u.font&&s(u.font),u.textColor&&s(u.textColor)}outputDefined(){return!1}}class Jc{constructor(s){this.type=ps,this.input=s}static parse(s,u){if(s.length!==2)return u.error("Expected two arguments.");const g=u.parse(s[1],1,ii);return g?new Jc(g):u.error("No image name provided.")}evaluate(s){const u=this.input.evaluate(s),g=is.fromString(u);return g&&s.availableImages&&(g.available=s.availableImages.indexOf(u)>-1),g}eachChild(s){s(this.input)}outputDefined(){return!1}}class Or{constructor(s){this.type=bt,this.input=s}static parse(s,u){if(s.length!==2)return u.error(`Expected 1 argument, but found ${s.length-1} instead.`);const g=u.parse(s[1],1);return g?g.type.kind!=="array"&&g.type.kind!=="string"&&g.type.kind!=="value"?u.error(`Expected argument of type string or array, but found ${X(g.type)} instead.`):new Or(g):null}evaluate(s){const u=this.input.evaluate(s);if(typeof u=="string")return[...u].length;if(Array.isArray(u))return u.length;throw new Hi(`Expected value to be of type string or array, but found ${X(Bn(u))} instead.`)}eachChild(s){s(this.input)}outputDefined(){return!1}}const kr=8192;function eu(l,s){const u=(180+l[0])/360,g=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+l[1]*Math.PI/360)))/360,v=Math.pow(2,s.z);return[Math.round(u*v*kr),Math.round(g*v*kr)]}function Eo(l,s){const u=Math.pow(2,s.z);return[(v=(l[0]/kr+s.x)/u,360*v-180),(g=(l[1]/kr+s.y)/u,360/Math.PI*Math.atan(Math.exp((180-360*g)*Math.PI/180))-90)];var g,v}function Co(l,s){l[0]=Math.min(l[0],s[0]),l[1]=Math.min(l[1],s[1]),l[2]=Math.max(l[2],s[0]),l[3]=Math.max(l[3],s[1])}function fa(l,s){return!(l[0]<=s[0]||l[2]>=s[2]||l[1]<=s[1]||l[3]>=s[3])}function Vi(l,s,u){const g=l[0]-s[0],v=l[1]-s[1],T=l[0]-u[0],S=l[1]-u[1];return g*S-T*v==0&&g*T<=0&&v*S<=0}function Qa(l,s,u,g){return(v=[g[0]-u[0],g[1]-u[1]])[0]*(T=[s[0]-l[0],s[1]-l[1]])[1]-v[1]*T[0]!=0&&!(!iu(l,s,u,g)||!iu(u,g,l,s));var v,T}function tu(l,s,u){for(const g of u)for(let v=0;v<g.length-1;++v)if(Qa(l,s,g[v],g[v+1]))return!0;return!1}function Ro(l,s,u=!1){let g=!1;for(const C of s)for(let P=0;P<C.length-1;P++){if(Vi(l,C[P],C[P+1]))return u;(T=C[P])[1]>(v=l)[1]!=(S=C[P+1])[1]>v[1]&&v[0]<(S[0]-T[0])*(v[1]-T[1])/(S[1]-T[1])+T[0]&&(g=!g)}var v,T,S;return g}function Mp(l,s){for(const u of s)if(Ro(l,u))return!0;return!1}function Vd(l,s){for(const u of l)if(!Ro(u,s))return!1;for(let u=0;u<l.length-1;++u)if(tu(l[u],l[u+1],s))return!1;return!0}function Pp(l,s){for(const u of s)if(Vd(l,u))return!0;return!1}function iu(l,s,u,g){const v=g[0]-u[0],T=g[1]-u[1],S=(l[0]-u[0])*T-v*(l[1]-u[1]),C=(s[0]-u[0])*T-v*(s[1]-u[1]);return S>0&&C<0||S<0&&C>0}function wh(l,s,u){const g=[];for(let v=0;v<l.length;v++){const T=[];for(let S=0;S<l[v].length;S++){const C=eu(l[v][S],u);Co(s,C),T.push(C)}g.push(T)}return g}function $d(l,s,u){const g=[];for(let v=0;v<l.length;v++){const T=wh(l[v],s,u);g.push(T)}return g}function Hd(l,s,u,g){if(l[0]<u[0]||l[0]>u[2]){const v=.5*g;let T=l[0]-u[0]>v?-g:u[0]-l[0]>v?g:0;T===0&&(T=l[0]-u[2]>v?-g:u[2]-l[0]>v?g:0),l[0]+=T}Co(s,l)}function Wd(l,s,u,g){const v=Math.pow(2,g.z)*kr,T=[g.x*kr,g.y*kr],S=[];for(const C of l)for(const P of C){const k=[P.x+T[0],P.y+T[1]];Hd(k,s,u,v),S.push(k)}return S}function Xd(l,s,u,g){const v=Math.pow(2,g.z)*kr,T=[g.x*kr,g.y*kr],S=[];for(const P of l){const k=[];for(const z of P){const U=[z.x+T[0],z.y+T[1]];Co(s,U),k.push(U)}S.push(k)}if(s[2]-s[0]<=v/2){(C=s)[0]=C[1]=1/0,C[2]=C[3]=-1/0;for(const P of S)for(const k of P)Hd(k,s,u,v)}var C;return S}class Ja{constructor(s,u){this.type=Wt,this.geojson=s,this.geometries=u}static parse(s,u){if(s.length!==2)return u.error(`'within' expression requires exactly one argument, but found ${s.length-1} instead.`);if(xo(s[1])){const g=s[1];if(g.type==="FeatureCollection"){const v=[];for(const T of g.features){const{type:S,coordinates:C}=T.geometry;S==="Polygon"&&v.push(C),S==="MultiPolygon"&&v.push(...C)}if(v.length)return new Ja(g,{type:"MultiPolygon",coordinates:v})}else if(g.type==="Feature"){const v=g.geometry.type;if(v==="Polygon"||v==="MultiPolygon")return new Ja(g,g.geometry)}else if(g.type==="Polygon"||g.type==="MultiPolygon")return new Ja(g,g)}return u.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(s){if(s.geometry()!=null&&s.canonicalID()!=null){if(s.geometryType()==="Point")return(function(u,g){const v=[1/0,1/0,-1/0,-1/0],T=[1/0,1/0,-1/0,-1/0],S=u.canonicalID();if(g.type==="Polygon"){const C=wh(g.coordinates,T,S),P=Wd(u.geometry(),v,T,S);if(!fa(v,T))return!1;for(const k of P)if(!Ro(k,C))return!1}if(g.type==="MultiPolygon"){const C=$d(g.coordinates,T,S),P=Wd(u.geometry(),v,T,S);if(!fa(v,T))return!1;for(const k of P)if(!Mp(k,C))return!1}return!0})(s,this.geometries);if(s.geometryType()==="LineString")return(function(u,g){const v=[1/0,1/0,-1/0,-1/0],T=[1/0,1/0,-1/0,-1/0],S=u.canonicalID();if(g.type==="Polygon"){const C=wh(g.coordinates,T,S),P=Xd(u.geometry(),v,T,S);if(!fa(v,T))return!1;for(const k of P)if(!Vd(k,C))return!1}if(g.type==="MultiPolygon"){const C=$d(g.coordinates,T,S),P=Xd(u.geometry(),v,T,S);if(!fa(v,T))return!1;for(const k of P)if(!Pp(k,C))return!1}return!0})(s,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let qd=class{constructor(l=[],s=((u,g)=>u<g?-1:u>g?1:0)){if(this.data=l,this.length=this.data.length,this.compare=s,this.length>0)for(let u=(this.length>>1)-1;u>=0;u--)this._down(u)}push(l){this.data.push(l),this._up(this.length++)}pop(){if(this.length===0)return;const l=this.data[0],s=this.data.pop();return--this.length>0&&(this.data[0]=s,this._down(0)),l}peek(){return this.data[0]}_up(l){const{data:s,compare:u}=this,g=s[l];for(;l>0;){const v=l-1>>1,T=s[v];if(u(g,T)>=0)break;s[l]=T,l=v}s[l]=g}_down(l){const{data:s,compare:u}=this,g=this.length>>1,v=s[l];for(;l<g;){let T=1+(l<<1);const S=T+1;if(S<this.length&&u(s[S],s[T])<0&&(T=S),u(s[T],v)>=0)break;s[l]=s[T],l=T}s[l]=v}};function Ip(l,s,u,g,v){Zd(l,s,u,g||l.length-1,v||Th)}function Zd(l,s,u,g,v){for(;g>u;){if(g-u>600){var T=g-u+1,S=s-u+1,C=Math.log(T),P=.5*Math.exp(2*C/3),k=.5*Math.sqrt(C*P*(T-P)/T)*(S-T/2<0?-1:1);Zd(l,s,Math.max(u,Math.floor(s-S*P/T+k)),Math.min(g,Math.floor(s+(T-S)*P/T+k)),v)}var z=l[s],U=u,W=g;for(hc(l,u,s),v(l[g],z)>0&&hc(l,u,g);U<W;){for(hc(l,U,W),U++,W--;v(l[U],z)<0;)U++;for(;v(l[W],z)>0;)W--}v(l[u],z)===0?hc(l,u,W):hc(l,++W,g),W<=s&&(u=W+1),s<=W&&(g=W-1)}}function hc(l,s,u){var g=l[s];l[s]=l[u],l[u]=g}function Th(l,s){return l<s?-1:l>s?1:0}function nu(l,s){if(l.length<=1)return[l];const u=[];let g,v;for(const T of l){const S=Op(T);S!==0&&(T.area=Math.abs(S),v===void 0&&(v=S<0),v===S<0?(g&&u.push(g),g=[T]):g.push(T))}if(g&&u.push(g),s>1)for(let T=0;T<u.length;T++)u[T].length<=s||(Ip(u[T],s,1,u[T].length-1,Dp),u[T]=u[T].slice(0,s));return u}function Dp(l,s){return s.area-l.area}function Op(l){let s=0;for(let u,g,v=0,T=l.length,S=T-1;v<T;S=v++)u=l[v],g=l[S],s+=(g.x-u.x)*(u.y+g.y);return s}const Sh=1/298.257223563,Yd=Sh*(2-Sh),Gd=Math.PI/180;class Ah{constructor(s){const u=6378.137*Gd*1e3,g=Math.cos(s*Gd),v=1/(1-Yd*(1-g*g)),T=Math.sqrt(v);this.kx=u*T*g,this.ky=u*T*v*(1-Yd)}distance(s,u){const g=this.wrap(s[0]-u[0])*this.kx,v=(s[1]-u[1])*this.ky;return Math.sqrt(g*g+v*v)}pointOnLine(s,u){let g,v,T,S,C=1/0;for(let P=0;P<s.length-1;P++){let k=s[P][0],z=s[P][1],U=this.wrap(s[P+1][0]-k)*this.kx,W=(s[P+1][1]-z)*this.ky,Z=0;U===0&&W===0||(Z=(this.wrap(u[0]-k)*this.kx*U+(u[1]-z)*this.ky*W)/(U*U+W*W),Z>1?(k=s[P+1][0],z=s[P+1][1]):Z>0&&(k+=U/this.kx*Z,z+=W/this.ky*Z)),U=this.wrap(u[0]-k)*this.kx,W=(u[1]-z)*this.ky;const K=U*U+W*W;K<C&&(C=K,g=k,v=z,T=P,S=Z)}return{point:[g,v],index:T,t:Math.max(0,Math.min(1,S))}}wrap(s){for(;s<-180;)s+=360;for(;s>180;)s-=360;return s}}function Kd(l,s){return s[0]-l[0]}function ru(l){return l[1]-l[0]+1}function Ea(l,s){return l[1]>=l[0]&&l[1]<s}function Eh(l,s){if(l[0]>l[1])return[null,null];const u=ru(l);if(s){if(u===2)return[l,null];const v=Math.floor(u/2);return[[l[0],l[0]+v],[l[0]+v,l[1]]]}if(u===1)return[l,null];const g=Math.floor(u/2)-1;return[[l[0],l[0]+g],[l[0]+g+1,l[1]]]}function Ch(l,s){if(!Ea(s,l.length))return[1/0,1/0,-1/0,-1/0];const u=[1/0,1/0,-1/0,-1/0];for(let g=s[0];g<=s[1];++g)Co(u,l[g]);return u}function Rh(l){const s=[1/0,1/0,-1/0,-1/0];for(const u of l)for(const g of u)Co(s,g);return s}function pl(l){return l[0]!==-1/0&&l[1]!==-1/0&&l[2]!==1/0&&l[3]!==1/0}function Mo(l,s,u){if(!pl(l)||!pl(s))return NaN;let g=0,v=0;return l[2]<s[0]&&(g=s[0]-l[2]),l[0]>s[2]&&(g=l[0]-s[2]),l[1]>s[3]&&(v=l[1]-s[3]),l[3]<s[1]&&(v=s[1]-l[3]),u.distance([0,0],[g,v])}function Po(l,s,u){const g=u.pointOnLine(s,l);return u.distance(l,g.point)}function su(l,s,u,g,v){const T=Math.min(Po(l,[u,g],v),Po(s,[u,g],v)),S=Math.min(Po(u,[l,s],v),Po(g,[l,s],v));return Math.min(T,S)}function Qd(l,s,u,g,v){if(!Ea(s,l.length)||!Ea(g,u.length))return 1/0;let T=1/0;for(let S=s[0];S<s[1];++S){const C=l[S],P=l[S+1];for(let k=g[0];k<g[1];++k){const z=u[k],U=u[k+1];if(Qa(C,P,z,U))return 0;T=Math.min(T,su(C,P,z,U,v))}}return T}function Nn(l,s,u,g,v){if(!Ea(s,l.length)||!Ea(g,u.length))return NaN;let T=1/0;for(let S=s[0];S<=s[1];++S)for(let C=g[0];C<=g[1];++C)if(T=Math.min(T,v.distance(l[S],u[C])),T===0)return T;return T}function Jd(l,s,u){if(Ro(l,s,!0))return 0;let g=1/0;for(const v of s){const T=v[0],S=v[v.length-1];if(T!==S&&(g=Math.min(g,Po(l,[S,T],u)),g===0))return g;const C=u.pointOnLine(v,l);if(g=Math.min(g,u.distance(l,C.point)),g===0)return g}return g}function bi(l,s,u,g){if(!Ea(s,l.length))return NaN;for(let T=s[0];T<=s[1];++T)if(Ro(l[T],u,!0))return 0;let v=1/0;for(let T=s[0];T<s[1];++T){const S=l[T],C=l[T+1];for(const P of u)for(let k=0,z=P.length,U=z-1;k<z;U=k++){const W=P[U],Z=P[k];if(Qa(S,C,W,Z))return 0;v=Math.min(v,su(S,C,W,Z,g))}}return v}function Ca(l,s){for(const u of l)for(const g of u)if(Ro(g,s,!0))return!0;return!1}function fn(l,s,u,g=1/0){const v=Rh(l),T=Rh(s);if(g!==1/0&&Mo(v,T,u)>=g)return g;if(fa(v,T)){if(Ca(l,s))return 0}else if(Ca(s,l))return 0;let S=1/0;for(const C of l)for(let P=0,k=C.length,z=k-1;P<k;z=P++){const U=C[z],W=C[P];for(const Z of s)for(let K=0,J=Z.length,ce=J-1;K<J;ce=K++){const fe=Z[ce],Be=Z[K];if(Qa(U,W,fe,Be))return 0;S=Math.min(S,su(U,W,fe,Be,u))}}return S}function en(l,s,u,g,v,T){if(!T)return;const S=Mo(Ch(g,T),v,u);S<s&&l.push([S,T,[0,0]])}function Io(l,s,u,g,v,T,S){if(!T||!S)return;const C=Mo(Ch(g,T),Ch(v,S),u);C<s&&l.push([C,T,S])}function ml(l,s,u,g,v=1/0){let T=Math.min(g.distance(l[0],u[0][0]),v);if(T===0)return T;const S=new qd([[0,[0,l.length-1],[0,0]]],Kd),C=Rh(u);for(;S.length>0;){const P=S.pop();if(P[0]>=T)continue;const k=P[1],z=s?50:100;if(ru(k)<=z){if(!Ea(k,l.length))return NaN;if(s){const U=bi(l,k,u,g);if(isNaN(U)||U===0)return U;T=Math.min(T,U)}else for(let U=k[0];U<=k[1];++U){const W=Jd(l[U],u,g);if(T=Math.min(T,W),T===0)return 0}}else{const U=Eh(k,s);en(S,T,g,l,C,U[0]),en(S,T,g,l,C,U[1])}}return T}function gl(l,s,u,g,v,T=1/0){let S=Math.min(T,v.distance(l[0],u[0]));if(S===0)return S;const C=new qd([[0,[0,l.length-1],[0,u.length-1]]],Kd);for(;C.length>0;){const P=C.pop();if(P[0]>=S)continue;const k=P[1],z=P[2],U=s?50:100,W=g?50:100;if(ru(k)<=U&&ru(z)<=W){if(!Ea(k,l.length)&&Ea(z,u.length))return NaN;let Z;if(s&&g)Z=Qd(l,k,u,z,v),S=Math.min(S,Z);else if(s&&!g){const K=l.slice(k[0],k[1]+1);for(let J=z[0];J<=z[1];++J)if(Z=Po(u[J],K,v),S=Math.min(S,Z),S===0)return S}else if(!s&&g){const K=u.slice(z[0],z[1]+1);for(let J=k[0];J<=k[1];++J)if(Z=Po(l[J],K,v),S=Math.min(S,Z),S===0)return S}else Z=Nn(l,k,u,z,v),S=Math.min(S,Z)}else{const Z=Eh(k,s),K=Eh(z,g);Io(C,S,v,l,u,Z[0],K[0]),Io(C,S,v,l,u,Z[0],K[1]),Io(C,S,v,l,u,Z[1],K[0]),Io(C,S,v,l,u,Z[1],K[1])}}return S}function Do(l){return l.type==="MultiPolygon"?l.coordinates.map((s=>({type:"Polygon",coordinates:s}))):l.type==="MultiLineString"?l.coordinates.map((s=>({type:"LineString",coordinates:s}))):l.type==="MultiPoint"?l.coordinates.map((s=>({type:"Point",coordinates:s}))):[l]}class Zs{constructor(s,u){this.type=bt,this.geojson=s,this.geometries=u}static parse(s,u){if(s.length!==2)return u.error(`'distance' expression requires exactly one argument, but found ${s.length-1} instead.`);if(xo(s[1])){const g=s[1];if(g.type==="FeatureCollection")return new Zs(g,g.features.map((v=>Do(v.geometry))).flat());if(g.type==="Feature")return new Zs(g,Do(g.geometry));if("type"in g&&"coordinates"in g)return new Zs(g,Do(g))}return u.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(s){if(s.geometry()!=null&&s.canonicalID()!=null){if(s.geometryType()==="Point")return(function(u,g){const v=u.geometry(),T=v.flat().map((P=>Eo([P.x,P.y],u.canonical)));if(v.length===0)return NaN;const S=new Ah(T[0][1]);let C=1/0;for(const P of g){switch(P.type){case"Point":C=Math.min(C,gl(T,!1,[P.coordinates],!1,S,C));break;case"LineString":C=Math.min(C,gl(T,!1,P.coordinates,!0,S,C));break;case"Polygon":C=Math.min(C,ml(T,!1,P.coordinates,S,C))}if(C===0)return C}return C})(s,this.geometries);if(s.geometryType()==="LineString")return(function(u,g){const v=u.geometry(),T=v.flat().map((P=>Eo([P.x,P.y],u.canonical)));if(v.length===0)return NaN;const S=new Ah(T[0][1]);let C=1/0;for(const P of g){switch(P.type){case"Point":C=Math.min(C,gl(T,!0,[P.coordinates],!1,S,C));break;case"LineString":C=Math.min(C,gl(T,!0,P.coordinates,!0,S,C));break;case"Polygon":C=Math.min(C,ml(T,!0,P.coordinates,S,C))}if(C===0)return C}return C})(s,this.geometries);if(s.geometryType()==="Polygon")return(function(u,g){const v=u.geometry();if(v.length===0||v[0].length===0)return NaN;const T=nu(v,0).map((P=>P.map((k=>k.map((z=>Eo([z.x,z.y],u.canonical))))))),S=new Ah(T[0][0][0][1]);let C=1/0;for(const P of g)for(const k of T){switch(P.type){case"Point":C=Math.min(C,ml([P.coordinates],!1,k,S,C));break;case"LineString":C=Math.min(C,ml(P.coordinates,!0,k,S,C));break;case"Polygon":C=Math.min(C,fn(k,P.coordinates,S,C))}if(C===0)return C}return C})(s,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}const _l={"==":Aa,"!=":Qc,">":Ka,"<":hl,">=":uc,"<=":xh,array:qs,at:ac,boolean:qs,case:Ta,coalesce:cc,collator:dl,format:Ao,image:Jc,in:Ga,"index-of":wo,interpolate:hr,"interpolate-hcl":hr,"interpolate-lab":hr,length:Or,let:ha,literal:ur,match:Yc,number:qs,"number-format":fl,object:qs,slice:oc,step:To,string:qs,"to-boolean":Cs,"to-color":Cs,"to-number":Cs,"to-string":Cs,var:ji,within:Ja,distance:Zs};class qr{constructor(s,u,g,v){this.name=s,this.type=u,this._evaluate=g,this.args=v}evaluate(s){return this._evaluate(s,this.args)}eachChild(s){this.args.forEach(s)}outputDefined(){return!1}static parse(s,u){const g=s[0],v=qr.definitions[g];if(!v)return u.error(`Unknown expression "${g}". If you wanted a literal array, use ["literal", [...]].`,0);const T=Array.isArray(v)?v[0]:v.type,S=Array.isArray(v)?[[v[1],v[2]]]:v.overloads,C=S.filter((([k])=>!Array.isArray(k)||k.length===s.length-1));let P=null;for(const[k,z]of C){P=new mr(u.registry,yl,u.path,null,u.scope);const U=[];let W=!1;for(let Z=1;Z<s.length;Z++){const K=s[Z],J=Array.isArray(k)?k[Z-1]:k.type,ce=P.parse(K,1+U.length,J);if(!ce){W=!0;break}U.push(ce)}if(!W)if(Array.isArray(k)&&k.length!==U.length)P.error(`Expected ${k.length} arguments, but found ${U.length} instead.`);else{for(let Z=0;Z<U.length;Z++){const K=Array.isArray(k)?k[Z]:k.type,J=U[Z];P.concat(Z+1).checkSubtype(K,J.type)}if(P.errors.length===0)return new qr(g,T,z,U)}}if(C.length===1)u.errors.push(...P.errors);else{const k=(C.length?C:S).map((([U])=>{return W=U,Array.isArray(W)?`(${W.map(X).join(", ")})`:`(${X(W.type)}...)`;var W})).join(" | "),z=[];for(let U=1;U<s.length;U++){const W=u.parse(s[U],1+z.length);if(!W)return null;z.push(X(W.type))}u.error(`Expected arguments of type ${k}, but found (${z.join(", ")}) instead.`)}return null}static register(s,u){qr.definitions=u;for(const g in u)s[g]=qr}}function au(l,[s,u,g,v]){s=s.evaluate(l),u=u.evaluate(l),g=g.evaluate(l);const T=v?v.evaluate(l):1,S=bo(s,u,g,T);if(S)throw new Hi(S);return new Fi(s/255,u/255,g/255,T,!1)}function ou(l,s){return l in s}function dc(l,s){const u=s[l];return u===void 0?null:u}function Ra(l){return{type:l}}function yl(l){if(l instanceof ji)return yl(l.boundExpression);if(l instanceof qr&&l.name==="error"||l instanceof dl||l instanceof Ja||l instanceof Zs)return!1;const s=l instanceof Cs||l instanceof qs;let u=!0;return l.eachChild((g=>{u=s?u&&yl(g):u&&g instanceof ur})),!!u&&vl(l)&&fc(l,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function vl(l){if(l instanceof qr&&(l.name==="get"&&l.args.length===1||l.name==="feature-state"||l.name==="has"&&l.args.length===1||l.name==="properties"||l.name==="geometry-type"||l.name==="id"||/^filter-/.test(l.name))||l instanceof Ja||l instanceof Zs)return!1;let s=!0;return l.eachChild((u=>{s&&!vl(u)&&(s=!1)})),s}function Oo(l){if(l instanceof qr&&l.name==="feature-state")return!1;let s=!0;return l.eachChild((u=>{s&&!Oo(u)&&(s=!1)})),s}function fc(l,s){if(l instanceof qr&&s.indexOf(l.name)>=0)return!1;let u=!0;return l.eachChild((g=>{u&&!fc(g,s)&&(u=!1)})),u}function lu(l){return{result:"success",value:l}}function bl(l){return{result:"error",value:l}}function xl(l){return l["property-type"]==="data-driven"||l["property-type"]==="cross-faded-data-driven"}function ef(l){return!!l.expression&&l.expression.parameters.indexOf("zoom")>-1}function Zr(l){return!!l.expression&&l.expression.interpolated}function Di(l){return l instanceof Number?"number":l instanceof String?"string":l instanceof Boolean?"boolean":Array.isArray(l)?"array":l===null?"null":typeof l}function pc(l){return typeof l=="object"&&l!==null&&!Array.isArray(l)}function tf(l){return l}function Mh(l,s){const u=s.type==="color",g=l.stops&&typeof l.stops[0][0]=="object",v=g||!(g||l.property!==void 0),T=l.type||(Zr(s)?"exponential":"interval");if(u||s.type==="padding"){const z=u?Fi.parse:cr.parse;(l=oa({},l)).stops&&(l.stops=l.stops.map((U=>[U[0],z(U[1])]))),l.default=z(l.default?l.default:s.default)}if(l.colorSpace&&(S=l.colorSpace)!=="rgb"&&S!=="hcl"&&S!=="lab")throw new Error(`Unknown color space: "${l.colorSpace}"`);var S;let C,P,k;if(T==="exponential")C=Bo;else if(T==="interval")C=uu;else if(T==="categorical"){C=cu,P=Object.create(null);for(const z of l.stops)P[z[0]]=z[1];k=typeof l.stops[0][0]}else{if(T!=="identity")throw new Error(`Unknown function type "${T}"`);C=hu}if(g){const z={},U=[];for(let K=0;K<l.stops.length;K++){const J=l.stops[K],ce=J[0].zoom;z[ce]===void 0&&(z[ce]={zoom:ce,type:l.type,property:l.property,default:l.default,stops:[]},U.push(ce)),z[ce].stops.push([J[0].value,J[1]])}const W=[];for(const K of U)W.push([z[K].zoom,Mh(z[K],s)]);const Z={name:"linear"};return{kind:"composite",interpolationType:Z,interpolationFactor:hr.interpolationFactor.bind(void 0,Z),zoomStops:W.map((K=>K[0])),evaluate:({zoom:K},J)=>Bo({stops:W,base:l.base},s,K).evaluate(K,J)}}if(v){const z=T==="exponential"?{name:"exponential",base:l.base!==void 0?l.base:1}:null;return{kind:"camera",interpolationType:z,interpolationFactor:hr.interpolationFactor.bind(void 0,z),zoomStops:l.stops.map((U=>U[0])),evaluate:({zoom:U})=>C(l,s,U,P,k)}}return{kind:"source",evaluate(z,U){const W=U&&U.properties?U.properties[l.property]:void 0;return W===void 0?ko(l.default,s.default):C(l,s,W,P,k)}}}function ko(l,s,u){return l!==void 0?l:s!==void 0?s:u!==void 0?u:void 0}function cu(l,s,u,g,v){return ko(typeof u===v?g[u]:void 0,l.default,s.default)}function uu(l,s,u){if(Di(u)!=="number")return ko(l.default,s.default);const g=l.stops.length;if(g===1||u<=l.stops[0][0])return l.stops[0][1];if(u>=l.stops[g-1][0])return l.stops[g-1][1];const v=lc(l.stops.map((T=>T[0])),u);return l.stops[v][1]}function Bo(l,s,u){const g=l.base!==void 0?l.base:1;if(Di(u)!=="number")return ko(l.default,s.default);const v=l.stops.length;if(v===1||u<=l.stops[0][0])return l.stops[0][1];if(u>=l.stops[v-1][0])return l.stops[v-1][1];const T=lc(l.stops.map((z=>z[0])),u),S=(function(z,U,W,Z){const K=Z-W,J=z-W;return K===0?0:U===1?J/K:(Math.pow(U,J)-1)/(Math.pow(U,K)-1)})(u,g,l.stops[T][0],l.stops[T+1][0]),C=l.stops[T][1],P=l.stops[T+1][1],k=Dr[s.type]||tf;return typeof C.evaluate=="function"?{evaluate(...z){const U=C.evaluate.apply(void 0,z),W=P.evaluate.apply(void 0,z);if(U!==void 0&&W!==void 0)return k(U,W,S,l.colorSpace)}}:k(C,P,S,l.colorSpace)}function hu(l,s,u){switch(s.type){case"color":u=Fi.parse(u);break;case"formatted":u=ts.fromString(u.toString());break;case"resolvedImage":u=is.fromString(u.toString());break;case"padding":u=cr.parse(u);break;default:Di(u)===s.type||s.type==="enum"&&s.values[u]||(u=void 0)}return ko(u,l.default,s.default)}qr.register(_l,{error:[{kind:"error"},[ii],(l,[s])=>{throw new Hi(s.evaluate(l))}],typeof:[ii,[ui],(l,[s])=>X(Bn(s.evaluate(l)))],"to-rgba":[q(bt,4),[xn],(l,[s])=>{const[u,g,v,T]=s.evaluate(l).rgb;return[255*u,255*g,255*v,T]}],rgb:[xn,[bt,bt,bt],au],rgba:[xn,[bt,bt,bt,bt],au],has:{type:Wt,overloads:[[[ii],(l,[s])=>ou(s.evaluate(l),l.properties())],[[ii,Ws],(l,[s,u])=>ou(s.evaluate(l),u.evaluate(l))]]},get:{type:ui,overloads:[[[ii],(l,[s])=>dc(s.evaluate(l),l.properties())],[[ii,Ws],(l,[s,u])=>dc(s.evaluate(l),u.evaluate(l))]]},"feature-state":[ui,[ii],(l,[s])=>dc(s.evaluate(l),l.featureState||{})],properties:[Ws,[],l=>l.properties()],"geometry-type":[ii,[],l=>l.geometryType()],id:[ui,[],l=>l.id()],zoom:[bt,[],l=>l.globals.zoom],"heatmap-density":[bt,[],l=>l.globals.heatmapDensity||0],"line-progress":[bt,[],l=>l.globals.lineProgress||0],accumulated:[ui,[],l=>l.globals.accumulated===void 0?null:l.globals.accumulated],"+":[bt,Ra(bt),(l,s)=>{let u=0;for(const g of s)u+=g.evaluate(l);return u}],"*":[bt,Ra(bt),(l,s)=>{let u=1;for(const g of s)u*=g.evaluate(l);return u}],"-":{type:bt,overloads:[[[bt,bt],(l,[s,u])=>s.evaluate(l)-u.evaluate(l)],[[bt],(l,[s])=>-s.evaluate(l)]]},"/":[bt,[bt,bt],(l,[s,u])=>s.evaluate(l)/u.evaluate(l)],"%":[bt,[bt,bt],(l,[s,u])=>s.evaluate(l)%u.evaluate(l)],ln2:[bt,[],()=>Math.LN2],pi:[bt,[],()=>Math.PI],e:[bt,[],()=>Math.E],"^":[bt,[bt,bt],(l,[s,u])=>Math.pow(s.evaluate(l),u.evaluate(l))],sqrt:[bt,[bt],(l,[s])=>Math.sqrt(s.evaluate(l))],log10:[bt,[bt],(l,[s])=>Math.log(s.evaluate(l))/Math.LN10],ln:[bt,[bt],(l,[s])=>Math.log(s.evaluate(l))],log2:[bt,[bt],(l,[s])=>Math.log(s.evaluate(l))/Math.LN2],sin:[bt,[bt],(l,[s])=>Math.sin(s.evaluate(l))],cos:[bt,[bt],(l,[s])=>Math.cos(s.evaluate(l))],tan:[bt,[bt],(l,[s])=>Math.tan(s.evaluate(l))],asin:[bt,[bt],(l,[s])=>Math.asin(s.evaluate(l))],acos:[bt,[bt],(l,[s])=>Math.acos(s.evaluate(l))],atan:[bt,[bt],(l,[s])=>Math.atan(s.evaluate(l))],min:[bt,Ra(bt),(l,s)=>Math.min(...s.map((u=>u.evaluate(l))))],max:[bt,Ra(bt),(l,s)=>Math.max(...s.map((u=>u.evaluate(l))))],abs:[bt,[bt],(l,[s])=>Math.abs(s.evaluate(l))],round:[bt,[bt],(l,[s])=>{const u=s.evaluate(l);return u<0?-Math.round(-u):Math.round(u)}],floor:[bt,[bt],(l,[s])=>Math.floor(s.evaluate(l))],ceil:[bt,[bt],(l,[s])=>Math.ceil(s.evaluate(l))],"filter-==":[Wt,[ii,ui],(l,[s,u])=>l.properties()[s.value]===u.value],"filter-id-==":[Wt,[ui],(l,[s])=>l.id()===s.value],"filter-type-==":[Wt,[ii],(l,[s])=>l.geometryType()===s.value],"filter-<":[Wt,[ii,ui],(l,[s,u])=>{const g=l.properties()[s.value],v=u.value;return typeof g==typeof v&&g<v}],"filter-id-<":[Wt,[ui],(l,[s])=>{const u=l.id(),g=s.value;return typeof u==typeof g&&u<g}],"filter->":[Wt,[ii,ui],(l,[s,u])=>{const g=l.properties()[s.value],v=u.value;return typeof g==typeof v&&g>v}],"filter-id->":[Wt,[ui],(l,[s])=>{const u=l.id(),g=s.value;return typeof u==typeof g&&u>g}],"filter-<=":[Wt,[ii,ui],(l,[s,u])=>{const g=l.properties()[s.value],v=u.value;return typeof g==typeof v&&g<=v}],"filter-id-<=":[Wt,[ui],(l,[s])=>{const u=l.id(),g=s.value;return typeof u==typeof g&&u<=g}],"filter->=":[Wt,[ii,ui],(l,[s,u])=>{const g=l.properties()[s.value],v=u.value;return typeof g==typeof v&&g>=v}],"filter-id->=":[Wt,[ui],(l,[s])=>{const u=l.id(),g=s.value;return typeof u==typeof g&&u>=g}],"filter-has":[Wt,[ui],(l,[s])=>s.value in l.properties()],"filter-has-id":[Wt,[],l=>l.id()!==null&&l.id()!==void 0],"filter-type-in":[Wt,[q(ii)],(l,[s])=>s.value.indexOf(l.geometryType())>=0],"filter-id-in":[Wt,[q(ui)],(l,[s])=>s.value.indexOf(l.id())>=0],"filter-in-small":[Wt,[ii,q(ui)],(l,[s,u])=>u.value.indexOf(l.properties()[s.value])>=0],"filter-in-large":[Wt,[ii,q(ui)],(l,[s,u])=>(function(g,v,T,S){for(;T<=S;){const C=T+S>>1;if(v[C]===g)return!0;v[C]>g?S=C-1:T=C+1}return!1})(l.properties()[s.value],u.value,0,u.value.length-1)],all:{type:Wt,overloads:[[[Wt,Wt],(l,[s,u])=>s.evaluate(l)&&u.evaluate(l)],[Ra(Wt),(l,s)=>{for(const u of s)if(!u.evaluate(l))return!1;return!0}]]},any:{type:Wt,overloads:[[[Wt,Wt],(l,[s,u])=>s.evaluate(l)||u.evaluate(l)],[Ra(Wt),(l,s)=>{for(const u of s)if(u.evaluate(l))return!0;return!1}]]},"!":[Wt,[Wt],(l,[s])=>!s.evaluate(l)],"is-supported-script":[Wt,[ii],(l,[s])=>{const u=l.globals&&l.globals.isSupportedScript;return!u||u(s.evaluate(l))}],upcase:[ii,[ii],(l,[s])=>s.evaluate(l).toUpperCase()],downcase:[ii,[ii],(l,[s])=>s.evaluate(l).toLowerCase()],concat:[ii,Ra(ui),(l,s)=>s.map((u=>
52Ya(u.evaluate(l)))).join("")],"resolved-locale":[ii,[ca],(l,[s])=>s.evaluate(l).resolvedLocale()]});class eo{constructor(s,u){var g;this.expression=s,this._warningHistory={},this._evaluator=new Zc,this._defaultValue=u?(g=u).type==="color"&&pc(g.default)?new Fi(0,0,0,0):g.type==="color"?Fi.parse(g.default)||null:g.type==="padding"?cr.parse(g.default)||null:g.type==="variableAnchorOffsetCollection"?Es.parse(g.default)||null:g.default===void 0?null:g.default:null,this._enumValues=u&&u.type==="enum"?u.values:null}evaluateWithoutErrorHandling(s,u,g,v,T,S){return this._evaluator.globals=s,this._evaluator.feature=u,this._evaluator.featureState=g,this._evaluator.canonical=v,this._evaluator.availableImages=T||null,this._evaluator.formattedSection=S,this.expression.evaluate(this._evaluator)}evaluate(s,u,g,v,T,S){this._evaluator.globals=s,this._evaluator.feature=u||null,this._evaluator.featureState=g||null,this._evaluator.canonical=v,this._evaluator.availableImages=T||null,this._evaluator.formattedSection=S||null;try{const C=this.expression.evaluate(this._evaluator);if(C==null||typeof C=="number"&&C!=C)return this._defaultValue;if(this._enumValues&&!(C in this._enumValues))throw new Hi(`Expected value to be one of ${Object.keys(this._enumValues).map((P=>JSON.stringify(P))).join(", ")}, but found ${JSON.stringify(C)} instead.`);return C}catch(C){return this._warningHistory[C.message]||(this._warningHistory[C.message]=!0,typeof console<"u"&&console.warn(C.message)),this._defaultValue}}}function wl(l){return Array.isArray(l)&&l.length>0&&typeof l[0]=="string"&&l[0]in _l}function No(l,s){const u=new mr(_l,yl,[],s?(function(v){const T={color:xn,string:ii,number:bt,enum:ii,boolean:Wt,formatted:As,padding:Xs,resolvedImage:ps,variableAnchorOffsetCollection:de};return v.type==="array"?q(T[v.value]||ui,v.length):T[v.type]})(s):void 0),g=u.parse(l,void 0,void 0,void 0,s&&s.type==="string"?{typeAnnotation:"coerce"}:void 0);
vendor: 19,130 bytes, lines 52-53
52return g?lu(new eo(g,s)):bl(u.errors)}class Rs{constructor(s,u){this.kind=s,this._styleExpression=u,this.isStateDependent=s!=="constant"&&!Oo(u.expression)}evaluateWithoutErrorHandling(s,u,g,v,T,S){return this._styleExpression.evaluateWithoutErrorHandling(s,u,g,v,T,S)}evaluate(s,u,g,v,T,S){return this._styleExpression.evaluate(s,u,g,v,T,S)}}class Ys{constructor(s,u,g,v){this.kind=s,this.zoomStops=g,this._styleExpression=u,this.isStateDependent=s!=="camera"&&!Oo(u.expression),this.interpolationType=v}evaluateWithoutErrorHandling(s,u,g,v,T,S){return this._styleExpression.evaluateWithoutErrorHandling(s,u,g,v,T,S)}evaluate(s,u,g,v,T,S){return this._styleExpression.evaluate(s,u,g,v,T,S)}interpolationFactor(s,u,g){return this.interpolationType?hr.interpolationFactor(this.interpolationType,s,u,g):0}}function mc(l,s){const u=No(l,s);if(u.result==="error")return u;const g=u.value.expression,v=vl(g);if(!v&&!xl(s))return bl([new Ir("","data expressions not supported")]);const T=fc(g,["zoom"]);if(!T&&!ef(s))return bl([new Ir("","zoom expressions not supported")]);const S=Gs(g);return S||T?S instanceof Ir?bl([S]):S instanceof hr&&!Zr(s)?bl([new Ir("",'"interpolate" expressions cannot be used with this property')]):lu(S?new Ys(v?"camera":"composite",u.value,S.labels,S instanceof hr?S.interpolation:void 0):new Rs(v?"constant":"source",u.value)):bl([new Ir("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class zo{constructor(s,u){this._parameters=s,this._specification=u,oa(this,Mh(this._parameters,this._specification))}static deserialize(s){return new zo(s._parameters,s._specification)}static serialize(s){return{_parameters:s._parameters,_specification:s._specification}}}function Gs(l){let s=null;if(l instanceof ha)s=Gs(l.result);else if(l instanceof cc){for(const u of l.args)if(s=Gs(u),s)break}else(l instanceof To||l instanceof hr)&&l.input instanceof qr&&l.input.name==="zoom"&&(s=l);return s instanceof Ir||l.eachChild((u=>{const g=Gs(u);g instanceof Ir?s=g:!s&&g?s=new Ir("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):s&&g&&s!==g&&(s=new Ir("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),s}function gc(l){if(l===!0||l===!1)return!0;if(!Array.isArray(l)||l.length===0)return!1;switch(l[0]){case"has":return l.length>=2&&l[1]!=="$id"&&l[1]!=="$type";case"in":return l.length>=3&&(typeof l[1]!="string"||Array.isArray(l[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return l.length!==3||Array.isArray(l[1])||Array.isArray(l[2]);case"any":case"all":for(const s of l.slice(1))if(!gc(s)&&typeof s!="boolean")return!1;return!0;default:return!0}}const _c={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function du(l){if(l==null)return{filter:()=>!0,needGeometry:!1};gc(l)||(l=fu(l));const s=No(l,_c);if(s.result==="error")throw new Error(s.value.map((u=>`${u.key}: ${u.message}`)).join(", "));return{filter:(u,g,v)=>s.value.evaluate(u,g,{},v),needGeometry:nf(l)}}function kp(l,s){return l<s?-1:l>s?1:0}function nf(l){if(!Array.isArray(l))return!1;if(l[0]==="within"||l[0]==="distance")return!0;for(let s=1;s<l.length;s++)if(nf(l[s]))return!0;return!1}function fu(l){if(!l)return!0;const s=l[0];return l.length<=1?s!=="any":s==="=="?pu(l[1],l[2],"=="):s==="!="?wn(pu(l[1],l[2],"==")):s==="<"||s===">"||s==="<="||s===">="?pu(l[1],l[2],s):s==="any"?(u=l.slice(1),["any"].concat(u.map(fu))):s==="all"?["all"].concat(l.slice(1).map(fu)):s==="none"?["all"].concat(l.slice(1).map(fu).map(wn)):s==="in"?Tl(l[1],l.slice(2)):s==="!in"?wn(Tl(l[1],l.slice(2))):s==="has"?Lo(l[1]):s!=="!has"||wn(Lo(l[1]));var u}function pu(l,s,u){switch(l){case"$type":return[`filter-type-${u}`,s];case"$id":return[`filter-id-${u}`,s];default:return[`filter-${u}`,l,s]}}function Tl(l,s){if(s.length===0)return!1;switch(l){case"$type":return["filter-type-in",["literal",s]];case"$id":return["filter-id-in",["literal",s]];default:return s.length>200&&!s.some((u=>typeof u!=typeof s[0]))?["filter-in-large",l,["literal",s.sort(kp)]]:["filter-in-small",l,["literal",s]]}}function Lo(l){switch(l){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",l]}}function wn(l){return["!",l]}function pa(l){const s=typeof l;if(s==="number"||s==="boolean"||s==="string"||l==null)return JSON.stringify(l);if(Array.isArray(l)){let v="[";for(const T of l)v+=`${pa(T)},`;return`${v}]`}const u=Object.keys(l).sort();let g="{";for(let v=0;v<u.length;v++)g+=`${JSON.stringify(u[v])}:${pa(l[u[v]])},`;return`${g}}`}function ms(l){let s="";for(const u of Pt)s+=`/${pa(l[u])}`;return s}function Fo(l){const s=l.value;return s?[new pt(l.key,s,"constants have been deprecated as of v8")]:[]}function Rn(l){return l instanceof Number||l instanceof String||l instanceof Boolean?l.valueOf():l}function ns(l){if(Array.isArray(l))return l.map(ns);if(l instanceof Object&&!(l instanceof Number||l instanceof String||l instanceof Boolean)){const s={};for(const u in l)s[u]=ns(l[u]);return s}return Rn(l)}function Br(l){const s=l.key,u=l.value,g=l.valueSpec||{},v=l.objectElementValidators||{},T=l.style,S=l.styleSpec,C=l.validateSpec;let P=[];const k=Di(u);if(k!=="object")return[new pt(s,u,`object expected, ${k} found`)];for(const z in u){const U=z.split(".")[0],W=g[U]||g["*"];let Z;if(v[U])Z=v[U];else if(g[U])Z=C;else if(v["*"])Z=v["*"];else{if(!g["*"]){P.push(new pt(s,u[z],`unknown property "${z}"`));continue}Z=C}P=P.concat(Z({key:(s&&`${s}.`)+z,value:u[z],valueSpec:W,style:T,styleSpec:S,object:u,objectKey:z,validateSpec:C},u))}for(const z in g)v[z]||g[z].required&&g[z].default===void 0&&u[z]===void 0&&P.push(new pt(s,u,`missing required property "${z}"`));return P}function Uo(l){const s=l.value,u=l.valueSpec,g=l.style,v=l.styleSpec,T=l.key,S=l.arrayElementValidator||l.validateSpec;if(Di(s)!=="array")return[new pt(T,s,`array expected, ${Di(s)} found`)];if(u.length&&s.length!==u.length)return[new pt(T,s,`array length ${u.length} expected, length ${s.length} found`)];if(u["min-length"]&&s.length<u["min-length"])return[new pt(T,s,`array length at least ${u["min-length"]} expected, length ${s.length} found`)];let C={type:u.value,values:u.values};v.$version<7&&(C.function=u.function),Di(u.value)==="object"&&(C=u.value);let P=[];for(let k=0;k<s.length;k++)P=P.concat(S({array:s,arrayIndex:k,value:s[k],valueSpec:C,validateSpec:l.validateSpec,style:g,styleSpec:v,key:`${T}[${k}]`}));return P}function Ma(l){const s=l.key,u=l.value,g=l.valueSpec;let v=Di(u);return v==="number"&&u!=u&&(v="NaN"),v!=="number"?[new pt(s,u,`number expected, ${v} found`)]:"minimum"in g&&u<g.minimum?[new pt(s,u,`${u} is less than the minimum value ${g.minimum}`)]:"maximum"in g&&u>g.maximum?[new pt(s,u,`${u} is greater than the maximum value ${g.maximum}`)]:[]}function yc(l){const s=l.valueSpec,u=Rn(l.value.type);let g,v,T,S={};const C=u!=="categorical"&&l.value.property===void 0,P=!C,k=Di(l.value.stops)==="array"&&Di(l.value.stops[0])==="array"&&Di(l.value.stops[0][0])==="object",z=Br({key:l.key,value:l.value,valueSpec:l.styleSpec.function,validateSpec:l.validateSpec,style:l.style,styleSpec:l.styleSpec,objectElementValidators:{stops:function(Z){if(u==="identity")return[new pt(Z.key,Z.value,'identity function may not have a "stops" property')];let K=[];const J=Z.value;return K=K.concat(Uo({key:Z.key,value:J,valueSpec:Z.valueSpec,validateSpec:Z.validateSpec,style:Z.style,styleSpec:Z.styleSpec,arrayElementValidator:U})),Di(J)==="array"&&J.length===0&&K.push(new pt(Z.key,J,"array must have at least one stop")),K},default:function(Z){return Z.validateSpec({key:Z.key,value:Z.value,valueSpec:s,validateSpec:Z.validateSpec,style:Z.style,styleSpec:Z.styleSpec})}}});return u==="identity"&&C&&z.push(new pt(l.key,l.value,'missing required property "property"')),u==="identity"||l.value.stops||z.push(new pt(l.key,l.value,'missing required property "stops"')),u==="exponential"&&l.valueSpec.expression&&!Zr(l.valueSpec)&&z.push(new pt(l.key,l.value,"exponential functions not supported")),l.styleSpec.$version>=8&&(P&&!xl(l.valueSpec)?z.push(new pt(l.key,l.value,"property functions not supported")):C&&!ef(l.valueSpec)&&z.push(new pt(l.key,l.value,"zoom functions not supported"))),u!=="categorical"&&!k||l.value.property!==void 0||z.push(new pt(l.key,l.value,'"property" property is required')),z;function U(Z){let K=[];const J=Z.value,ce=Z.key;if(Di(J)!=="array")return[new pt(ce,J,`array expected, ${Di(J)} found`)];if(J.length!==2)return[new pt(ce,J,`array length 2 expected, length ${J.length} found`)];if(k){if(Di(J[0])!=="object")return[new pt(ce,J,`object expected, ${Di(J[0])} found`)];if(J[0].zoom===void 0)return[new pt(ce,J,"object stop key must have zoom")];if(J[0].value===void 0)return[new pt(ce,J,"object stop key must have value")];if(T&&T>Rn(J[0].zoom))return[new pt(ce,J[0].zoom,"stop zoom values must appear in ascending order")];Rn(J[0].zoom)!==T&&(T=Rn(J[0].zoom),v=void 0,S={}),K=K.concat(Br({key:`${ce}[0]`,value:J[0],valueSpec:{zoom:{}},validateSpec:Z.validateSpec,style:Z.style,styleSpec:Z.styleSpec,objectElementValidators:{zoom:Ma,value:W}}))}else K=K.concat(W({key:`${ce}[0]`,value:J[0],validateSpec:Z.validateSpec,style:Z.style,styleSpec:Z.styleSpec},J));return wl(ns(J[1]))?K.concat([new pt(`${ce}[1]`,J[1],"expressions are not allowed in function stops.")]):K.concat(Z.validateSpec({key:`${ce}[1]`,value:J[1],valueSpec:s,validateSpec:Z.validateSpec,style:Z.style,styleSpec:Z.styleSpec}))}function W(Z,K){const J=Di(Z.value),ce=Rn(Z.value),fe=Z.value!==null?Z.value:K;if(g){if(J!==g)return[new pt(Z.key,fe,`${J} stop domain type must match previous stop domain type ${g}`)]}else g=J;if(J!=="number"&&J!=="string"&&J!=="boolean")return[new pt(Z.key,fe,"stop domain value must be a number, string, or boolean")];if(J!=="number"&&u!=="categorical"){let Be=`number expected, ${J} found`;return xl(s)&&u===void 0&&(Be+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new pt(Z.key,fe,Be)]}return u!=="categorical"||J!=="number"||isFinite(ce)&&Math.floor(ce)===ce?u!=="categorical"&&J==="number"&&v!==void 0&&ce<v?[new pt(Z.key,fe,"stop domain values must appear in ascending order")]:(v=ce,u==="categorical"&&ce in S?[new pt(Z.key,fe,"stop domain values must be unique")]:(S[ce]=!0,[])):[new pt(Z.key,fe,`integer expected, found ${ce}`)]}}function Pa(l){const s=(l.expressionContext==="property"?mc:No)(ns(l.value),l.valueSpec);if(s.result==="error")return s.value.map((g=>new pt(`${l.key}${g.key}`,l.value,g.message)));const u=s.value.expression||s.value._styleExpression.expression;if(l.expressionContext==="property"&&l.propertyKey==="text-font"&&!u.outputDefined())return[new pt(l.key,l.value,`Invalid data expression for "${l.propertyKey}". Output values must be contained as literals within the expression.`)];if(l.expressionContext==="property"&&l.propertyType==="layout"&&!Oo(u))return[new pt(l.key,l.value,'"feature-state" data expressions are not supported with layout properties.')];if(l.expressionContext==="filter"&&!Oo(u))return[new pt(l.key,l.value,'"feature-state" data expressions are not supported with filters.')];if(l.expressionContext&&l.expressionContext.indexOf("cluster")===0){if(!fc(u,["zoom","feature-state"]))return[new pt(l.key,l.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(l.expressionContext==="cluster-initial"&&!vl(u))return[new pt(l.key,l.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function rs(l){const s=l.key,u=l.value,g=l.valueSpec,v=[];return Array.isArray(g.values)?g.values.indexOf(Rn(u))===-1&&v.push(new pt(s,u,`expected one of [${g.values.join(", ")}], ${JSON.stringify(u)} found`)):Object.keys(g.values).indexOf(Rn(u))===-1&&v.push(new pt(s,u,`expected one of [${Object.keys(g.values).join(", ")}], ${JSON.stringify(u)} found`)),v}function Ph(l){return gc(ns(l.value))?Pa(oa({},l,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Nr(l)}function Nr(l){const s=l.value,u=l.key;if(Di(s)!=="array")return[new pt(u,s,`array expected, ${Di(s)} found`)];const g=l.styleSpec;let v,T=[];if(s.length<1)return[new pt(u,s,"filter array must have at least 1 element")];switch(T=T.concat(rs({key:`${u}[0]`,value:s[0],valueSpec:g.filter_operator,style:l.style,styleSpec:l.styleSpec})),Rn(s[0])){case"<":case"<=":case">":case">=":s.length>=2&&Rn(s[1])==="$type"&&T.push(new pt(u,s,`"$type" cannot be use with operator "${s[0]}"`));case"==":case"!=":s.length!==3&&T.push(new pt(u,s,`filter array for operator "${s[0]}" must have 3 elements`));case"in":case"!in":s.length>=2&&(v=Di(s[1]),v!=="string"&&T.push(new pt(`${u}[1]`,s[1],`string expected, ${v} found`)));for(let S=2;S<s.length;S++)v=Di(s[S]),Rn(s[1])==="$type"?T=T.concat(rs({key:`${u}[${S}]`,value:s[S],valueSpec:g.geometry_type,style:l.style,styleSpec:l.styleSpec})):v!=="string"&&v!=="number"&&v!=="boolean"&&T.push(new pt(`${u}[${S}]`,s[S],`string, number, or boolean expected, ${v} found`));break;case"any":case"all":case"none":for(let S=1;S<s.length;S++)T=T.concat(Nr({key:`${u}[${S}]`,value:s[S],style:l.style,styleSpec:l.styleSpec}));break;case"has":case"!has":v=Di(s[1]),s.length!==2?T.push(new pt(u,s,`filter array for "${s[0]}" operator must have 2 elements`)):v!=="string"&&T.push(new pt(`${u}[1]`,s[1],`string expected, ${v} found`))}return T}function vc(l,s){const u=l.key,g=l.validateSpec,v=l.style,T=l.styleSpec,S=l.value,C=l.objectKey,P=T[`${s}_${l.layerType}`];if(!P)return[];const k=C.match(/^(.*)-transition$/);if(s==="paint"&&k&&P[k[1]]&&P[k[1]].transition)return g({key:u,value:S,valueSpec:T.transition,style:v,styleSpec:T});const z=l.valueSpec||P[C];if(!z)return[new pt(u,S,`unknown property "${C}"`)];let U;if(Di(S)==="string"&&xl(z)&&!z.tokens&&(U=/^{([^}]+)}$/.exec(S)))return[new pt(u,S,`"${C}" does not support interpolation syntax 53Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(U[1])} }\`.`)];const W=[];return l.layerType==="symbol"&&(C==="text-field"&&v&&!v.glyphs&&W.push(new pt(u,S,'use of "text-field" requires a style "glyphs" property')),C==="text-font"&&pc(ns(S))&&Rn(S.type)==="identity"&&W.push(new pt(u,S,'"text-font" does not support identity functions'))),W.concat(g({key:l.key,value:S,valueSpec:z,style:v,styleSpec:T,expressionContext:"property",propertyType:s,propertyKey:C}))}function Ms(l){return vc(l,"paint")}function mu(l){return vc(l,"layout")}function Sl(l){let s=[];const u=l.value,g=l.key,v=l.style,T=l.styleSpec;u.type||u.ref||s.push(new pt(g,u,'either "type" or "ref" is required'));let S=Rn(u.type);const C=Rn(u.ref);if(u.id){const P=Rn(u.id);for(let k=0;k<l.arrayIndex;k++){const z=v.layers[k];Rn(z.id)===P&&s.push(new pt(g,u.id,`duplicate layer id "${u.id}", previously used at line ${z.id.__line__}`))}}if("ref"in u){let P;["type","source","source-layer","filter","layout"].forEach((k=>{k in u&&s.push(new pt(g,u[k],`"${k}" is prohibited for ref layers`))})),v.layers.forEach((k=>{Rn(k.id)===C&&(P=k)})),P?P.ref?s.push(new pt(g,u.ref,"ref cannot reference another ref layer")):S=Rn(P.type):s.push(new pt(g,u.ref,`ref layer "${C}" not found`))}else if(S!=="background")if(u.source){const P=v.sources&&v.sources[u.source],k=P&&Rn(P.type);P?k==="vector"&&S==="raster"?s.push(new pt(g,u.source,`layer "${u.id}" requires a raster source`)):k!=="raster-dem"&&S==="hillshade"?s.push(new pt(g,u.source,`layer "${u.id}" requires a raster-dem source`)):k==="raster"&&S!=="raster"?s.push(new pt(g,u.source,`layer "${u.id}" requires a vector source`)):k!=="vector"||u["source-layer"]?k==="raster-dem"&&S!=="hillshade"?s.push(new pt(g,u.source,"raster-dem source can only be used with layer type 'hillshade'.")):S!=="line"||!u.paint||!u.paint["line-gradient"]||k==="geojson"&&P.lineMetrics||s.push(new pt(g,u,`layer "${u.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):s.push(new pt(g,u,`layer "${u.id}" must specify a "source-layer"`)):s.push(new pt(g,u.source,`source "${u.source}" not found`))}else s.push(new pt(g,u,'missing required property "source"'));return s=s.concat(Br({key:g,value:u,valueSpec:T.layer,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*":()=>[],type:()=>l.validateSpec({key:`${g}.type`,value:u.type,valueSpec:T.layer.type,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,object:u,objectKey:"type"}),filter:Ph,layout:P=>Br({layer:u,key:P.key,value:P.value,style:P.style,styleSpec:P.styleSpec,validateSpec:P.validateSpec,objectElementValidators:{"*":k=>mu(oa({layerType:S},k))}}),paint:P=>Br({layer:u,key:P.key,value:P.value,style:P.style,styleSpec:P.styleSpec,validateSpec:P.validateSpec,objectElementValidators:{"*":k=>Ms(oa({layerType:S},k))}})}})),s}function gs(l){const s=l.value,u=l.key,g=Di(s);return g!=="string"?[new pt(u,s,`string expected, ${g} found`)]:[]}const Al={promoteId:function({key:l,value:s}){if(Di(s)==="string")return gs({key:l,value:s});{const u=[];for(const g in s)u.push(...gs({key:`${l}.${g}`,value:s[g]}));return u}}};function El(l){const s=l.value,u=l.key,g=l.styleSpec,v=l.style,T=l.validateSpec;if(!s.type)return[new pt(u,s,'"type" is required')];const S=Rn(s.type);let C;switch(S){case"vector":case"raster":return C=Br({key:u,value:s,valueSpec:g[`source_${S.replace("-","_")}`],style:l.style,styleSpec:g,objectElementValidators:Al,validateSpec:T}),C;case"raster-dem":return C=(function(P){var k;const z=(k=P.sourceName)!==null&&k!==void 0?k:"",U=P.value,W=P.styleSpec,Z=W.source_raster_dem,K=P.style;let J=[];const ce=Di(U);if(U===void 0)return J;if(ce!=="object")return J.push(new pt("source_raster_dem",U,`object expected, ${ce} found`)),J;const fe=Rn(U.encoding)==="custom",Be=["redFactor","greenFactor","blueFactor","baseShift"],Ae=P.value.encoding?`"${P.value.encoding}"`:"Default";for(const De in U)!fe&&Be.includes(De)?J.push(new pt(De,U[De],`In "${z}": "${De}" is only valid when "encoding" is set to "custom". ${Ae} encoding found`)):Z[De]?J=J.concat(P.validateSpec({key:De,value:U[De],valueSpec:Z[De],validateSpec:P.validateSpec,style:K,styleSpec:W})):J.push(new pt(De,U[De],`unknown property "${De}"`));return J})({sourceName:u,value:s,style:l.style,styleSpec:g,validateSpec:T}),C;case"geojson":if(C=Br({key:u,value:s,valueSpec:g.source_geojson,style:v,styleSpec:g,validateSpec:T,objectElementValidators:Al}),s.cluster)for(const P in s.clusterProperties){const[k,z]=s.clusterProperties[P],U=typeof k=="string"?[k,["accumulated"],["get",P]]:k;C.push(...Pa({key:`${u}.${P}.map`,value:z,expressionContext:"cluster-map"})),C.push(...Pa({key:`${u}.${P}.reduce`,value:U,expressionContext:"cluster-reduce"}))}return C;case"video":return Br({key:u,value:s,valueSpec:g.source_video,style:v,validateSpec:T,styleSpec:g});case"image":return Br({key:u,value:s,valueSpec:g.source_image,style:v,validateSpec:T,styleSpec:g});case"canvas":return[new pt(u,null,"Please use runtime APIs to add canvas sources, rather than
53including them in stylesheets.","source.canvas")];default:return rs({key:`${u}.type`,value:s.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function bc(l){const s=l.value,u=l.styleSpec,g=u.light,v=l.style;let T=[];const S=Di(s);if(s===void 0)return T;if(S!=="object")return T=T.concat([new pt("light",s,`object expected, ${S} found`)]),T;for(const C in s){const P=C.match(/^(.*)-transition$/);T=T.concat(P&&g[P[1]]&&g[P[1]].transition?l.validateSpec({key:C,value:s[C],valueSpec:u.transition,validateSpec:l.validateSpec,style:v,styleSpec:u}):g[C]?l.validateSpec({key:C,value:s[C],valueSpec:g[C],validateSpec:l.validateSpec,style:v,styleSpec:u}):[new pt(C,s[C],`unknown property "${C}"`)])}return T}function gu(l){const s=l.value,u=l.styleSpec,g=u.sky,v=l.style,T=Di(s);if(s===void 0)return[];if(T!=="object")return[new pt("sky",s,`object expected, ${T} found`)];let S=[];for(const C in s)S=S.concat(g[C]?l.validateSpec({key:C,value:s[C],valueSpec:g[C],style:v,styleSpec:u}):[new pt(C,s[C],`unknown property "${C}"`)]);return S}function ss(l){const s=l.value,u=l.styleSpec,g=u.terrain,v=l.style;let T=[];const S=Di(s);if(s===void 0)return T;if(S!=="object")return T=T.concat([new pt("terrain",s,`object expected, ${S} found`)]),T;for(const C in s)T=T.concat(g[C]?l.validateSpec({key:C,value:s[C],valueSpec:g[C],validateSpec:l.validateSpec,style:v,styleSpec:u}):[new pt(C,s[C],`unknown property "${C}"`)]);return T}function to(l){let s=[];const u=l.value,g=l.key;if(Array.isArray(u)){const v=[],T=[];for(const S in u)u[S].id&&v.includes(u[S].id)&&s.push(new pt(g,u,`all the sprites' ids must be unique, but ${u[S].id} is duplicated`)),v.push(u[S].id),u[S].url&&T.includes(u[S].url)&&s.push(new pt(g,u,`all the sprites' URLs must be unique, but ${u[S].url} is duplicated`)),T.push(u[S].url),s=s.concat(Br({key:`${g}[${S}]`,value:u[S],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:l.validateSpec}));return s}return gs({key:g,value:u})}const Ia={"*":()=>[],array:Uo,boolean:function(l){const s=l.value,u=l.key,g=Di(s);return g!=="boolean"?[new pt(u,s,`boolean expected, ${g} found`)]:[]},number:Ma,color:function(l){const s=l.key,u=l.value,g=Di(u);return g!=="string"?[new pt(s,u,`color expected, ${g} found`)]:Fi.parse(String(u))?[]:[new pt(s,u,`color expected, "${u}" found`)]},constants:Fo,enum:rs,filter:Ph,function:yc,layer:Sl,object:Br,source:El,light:bc,sky:gu,terrain:ss,projection:function(l){const s=l.value,u=l.styleSpec,g=u.projection,v=l.style,T=Di(s);if(s===void 0)return[];if(T!=="object")return[new pt("projection",s,`object expected, ${T} found`)];let S=[];for(const C in s)S=S.concat(g[C]?l.validateSpec({key:C,value:s[C],valueSpec:g[C],style:v,styleSpec:u}):[new pt(C,s[C],`unknown property "${C}"`)]);return S},string:gs,formatted:function(l){return gs(l).length===0?[]:Pa(l)},resolvedImage:function(l){return gs(l).length===0?[]:Pa(l)},padding:function(l){const s=l.key,u=l.value;if(Di(u)==="array"){if(u.length<1||u.length>4)return[new pt(s,u,`padding requires 1 to 4 values; ${u.length} values found`)];const g={type:"number"};let v=[];for(let T=0;T<u.length;T++)v=v.concat(l.validateSpec({key:`${s}[${T}]`,value:u[T],validateSpec:l.validateSpec,valueSpec:g}));return v}return Ma({key:s,value:u,valueSpec:{}})},variableAnchorOffsetCollection:function(l){const s=l.key,u=l.value,g=Di(u),v=l.styleSpec;if(g!=="array"||u.length<1||u.length%2!=0)return[new pt(s,u,"variableAnchorOffsetCollection requires a non-empty array of even length")];let T=[];for(let S=0;S<u.length;S+=2)T=T.concat(rs({key:`${s}[${S}]`,value:u[S],valueSpec:v.layout_symbol["text-anchor"]})),T=T.concat(Uo({key:`${s}[${S+1}]`,value:u[S+1],valueSpec:{length:2,value:"number"},validateSpec:l.validateSpec,style:l.style,styleSpec:v}));return T},sprite:to};function io(l){const s=l.value,u=l.valueSpec,g=l.styleSpec;return l.validateSpec=io,u.expression&&pc(Rn(s))?yc(l):u.expression&&wl(ns(s))?Pa(l):u.type&&Ia[u.type]?Ia[u.type](l):Br(oa({},l,{valueSpec:u.type?g[u.type]:u}))}function Cl(l){const s=l.value,u=l.key,g=gs(l);return g.length||(s.indexOf("{fontstack}")===-1&&g.push(new pt(u,s,'"glyphs" url must include a "{fontstack}" token')),s.indexOf("{range}")===-1&&g.push(new pt(u,s,'"glyphs" url must include a "{range}" token'))),g}function zn(l,s=_e){let u=[];return u=u.concat(io({key:"",value:l,valueSpec:s.$root,styleSpec:s,style:l,validateSpec:io,objectElementValidators:{glyphs:Cl,"*":()=>[]}})),l.constants&&(u=u.concat(Fo({key:"constants",value:l.constants}))),ma(u)}function Gn(l){return function(s){return l({...s,validateSpec:io})}}function ma(l){return[].concat(l).sort(((s,u)=>s.line-u.line))}function rr(l){return function(...s){return ma(l.apply(this,s))}}zn.source=rr(Gn(El)),zn.sprite=rr(Gn(to)),zn.glyphs=rr(Gn(Cl)),zn.light=rr(Gn(bc)),zn.sky=rr(Gn(gu)),zn.terrain=rr(Gn(ss)),zn.layer=rr(Gn(Sl)),zn.filter=rr(Gn(Ph)),zn.paintProperty=rr(Gn(Ms)),zn.layoutProperty=rr(Gn(mu));const zr=zn,Da=zr.light,rf=zr.sky,_u=zr.paintProperty,yu=zr.layoutProperty;function vu(l,s){let u=!1;if(s&&s.length)for(const g of s)l.fire(new pi(new Error(g.message))),u=!0;return u}class Wn{constructor(s,u,g){const v=this.cells=[];if(s instanceof ArrayBuffer){this.arrayBuffer=s;const S=new Int32Array(this.arrayBuffer);s=S[0],this.d=(u=S[1])+2*(g=S[2]);for(let P=0;P<this.d*this.d;P++){const k=S[3+P],z=S[3+P+1];v.push(k===z?null:S.subarray(k,z))}const C=S[3+v.length+1];this.keys=S.subarray(S[3+v.length],C),this.bboxes=S.subarray(C),this.insert=this._insertReadonly}else{this.d=u+2*g;for(let S=0;S<this.d*this.d;
vendor: 4,677 bytes, line 53
53S++)v.push([]);this.keys=[],this.bboxes=[]}this.n=u,this.extent=s,this.padding=g,this.scale=u/s,this.uid=0;const T=g/u*s;this.min=-T,this.max=s+T}insert(s,u,g,v,T){this._forEachCell(u,g,v,T,this._insertCell,this.uid++,void 0,void 0),this.keys.push(s),this.bboxes.push(u),this.bboxes.push(g),this.bboxes.push(v),this.bboxes.push(T)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(s,u,g,v,T,S){this.cells[T].push(S)}query(s,u,g,v,T){const S=this.min,C=this.max;if(s<=S&&u<=S&&C<=g&&C<=v&&!T)return Array.prototype.slice.call(this.keys);{const P=[];return this._forEachCell(s,u,g,v,this._queryCell,P,{},T),P}}_queryCell(s,u,g,v,T,S,C,P){const k=this.cells[T];if(k!==null){const z=this.keys,U=this.bboxes;for(let W=0;W<k.length;W++){const Z=k[W];if(C[Z]===void 0){const K=4*Z;(P?P(U[K+0],U[K+1],U[K+2],U[K+3]):s<=U[K+2]&&u<=U[K+3]&&g>=U[K+0]&&v>=U[K+1])?(C[Z]=!0,S.push(z[Z])):C[Z]=!1}}}}_forEachCell(s,u,g,v,T,S,C,P){const k=this._convertToCellCoord(s),z=this._convertToCellCoord(u),U=this._convertToCellCoord(g),W=this._convertToCellCoord(v);for(let Z=k;Z<=U;Z++)for(let K=z;K<=W;K++){const J=this.d*K+Z;if((!P||P(this._convertFromCellCoord(Z),this._convertFromCellCoord(K),this._convertFromCellCoord(Z+1),this._convertFromCellCoord(K+1)))&&T.call(this,s,u,g,v,J,S,C,P))return}}_convertFromCellCoord(s){return(s-this.padding)/this.scale}_convertToCellCoord(s){return Math.max(0,Math.min(this.d-1,Math.floor(s*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const s=this.cells,u=3+this.cells.length+1+1;let g=0;for(let S=0;S<this.cells.length;S++)g+=this.cells[S].length;const v=new Int32Array(u+g+this.keys.length+this.bboxes.length);v[0]=this.extent,v[1]=this.n,v[2]=this.padding;let T=u;for(let S=0;S<s.length;S++){const C=s[S];v[3+S]=T,v.set(C,T),T+=C.length}return v[3+s.length]=T,v.set(this.keys,T),T+=this.keys.length,v[3+s.length+1]=T,v.set(this.bboxes,T),T+=this.bboxes.length,v.buffer}static serialize(s,u){const g=s.toArrayBuffer();return u&&u.push(g),{buffer:g}}static deserialize(s){return new Wn(s.buffer)}}const Bi={};function lt(l,s,u={}){if(Bi[l])throw new Error(`${l} is already registered.`);Object.defineProperty(s,"_classRegistryKey",{value:l,writeable:!1}),Bi[l]={klass:s,omit:u.omit||[],shallow:u.shallow||[]}}lt("Object",Object),lt("TransferableGridIndex",Wn),lt("Color",Fi),lt("Error",Error),lt("AJAXError",ti),lt("ResolvedImage",is),lt("StylePropertyFunction",zo),lt("StyleExpression",eo,{omit:["_evaluator"]}),lt("ZoomDependentExpression",Ys),lt("ZoomConstantExpression",Rs),lt("CompoundExpression",qr,{omit:["_evaluate"]});for(const l in _l)_l[l]._classRegistryKey||lt(`Expression_${l}`,_l[l]);function Ks(l){return l&&typeof ArrayBuffer<"u"&&(l instanceof ArrayBuffer||l.constructor&&l.constructor.name==="ArrayBuffer")}function as(l){return l.$name||l.constructor._classRegistryKey}function bu(l){return!(function(s){if(s===null||typeof s!="object")return!1;const u=as(s);return!(!u||u==="Object")})(l)&&(l==null||typeof l=="boolean"||typeof l=="number"||typeof l=="string"||l instanceof Boolean||l instanceof Number||l instanceof String||l instanceof Date||l instanceof RegExp||l instanceof Blob||l instanceof Error||Ks(l)||nt(l)||ArrayBuffer.isView(l)||l instanceof ImageData)}function _s(l,s){if(bu(l))return(Ks(l)||nt(l))&&s&&s.push(l),ArrayBuffer.isView(l)&&s&&s.push(l.buffer),l instanceof ImageData&&s&&s.push(l.data.buffer),l;if(Array.isArray(l)){const T=[];for(const S of l)T.push(_s(S,s));return T}if(typeof l!="object")throw new Error("can't serialize object of type "+typeof l);const u=as(l);if(!u)throw new Error(`can't serialize object of unregistered class ${l.constructor.name}`);if(!Bi[u])throw new Error(`${u} is not registered.`);const{klass:g}=Bi[u],v=g.serialize?g.serialize(l,s):{};if(g.serialize){if(s&&v===s[s.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const T in l){if(!l.hasOwnProperty(T)||Bi[u].omit.indexOf(T)>=0)continue;const S=l[T];v[T]=Bi[u].shallow.indexOf(T)>=0?S:_s(S,s)}l instanceof Error&&(v.message=l.message)}if(v.$name)throw new Error("$name property is reserved for worker serialization logic.");return u!=="Object"&&(v.$name=u),v}function jo(l){if(bu(l))return l;if(Array.isArray(l))return l.map(jo);if(typeof l!="object")throw new Error("can't deserialize object of type "+typeof l);const s=as(l)||"Object";if(!Bi[s])throw new Error(`can't deserialize unregistered class ${s}`);const{klass:u}=Bi[s];if(!u)throw new Error(`can't deserialize unregistered class ${s}`);if(u.deserialize)return u.deserialize(l);const g=Object.create(u.prototype);
53for(const v of Object.keys(l)){if(v==="$name")continue;const T=l[v];g[v]=Bi[s].shallow.indexOf(v)>=0?T:jo(T)}return g}class xu{constructor(){this.first=!0}update(s,u){const g=Math.floor(s);return this.first?(this.first=!1,this.lastIntegerZoom=g,this.lastIntegerZoomTime=0,this.lastZoom=s,this.lastFloorZoom=g,!0):(this.lastFloorZoom>g?(this.lastIntegerZoom=g+1,this.lastIntegerZoomTime=u):this.lastFloorZoom<g&&(this.lastIntegerZoom=g,this.lastIntegerZoomTime=u),s!==this.lastZoom&&(this.lastZoom=s,this.lastFloorZoom=g,!0))}}const _i={"Latin-1 Supplement":l=>l>=128&&l<=255,"Hangul Jamo":l=>l>=4352&&l<=4607,Khmer:l=>l>=6016&&l<=6143,"General Punctuation":l=>l>=8192&&l<=8303,"Letterlike Symbols":l=>l>=8448&&l<=8527,"Number Forms":l=>l>=8528&&l<=8591,"Miscellaneous Technical":l=>l>=8960&&l<=9215,"Control Pictures":l=>l>=9216&&l<=9279,"Optical Character Recognition":l=>l>=9280&&l<=9311,"Enclosed Alphanumerics":l=>l>=9312&&l<=9471,"Geometric Shapes":l=>l>=9632&&l<=9727,"Miscellaneous Symbols":l=>l>=9728&&l<=9983,"Miscellaneous Symbols and Arrows":l=>l>=11008&&l<=11263,"Ideographic Description Characters":l=>l>=12272&&l<=12287,"CJK Symbols and Punctuation":l=>l>=12288&&l<=12351,Katakana:l=>l>=12448&&l<=12543,Kanbun:l=>l>=12688&&l<=12703,"CJK Strokes":l=>l>=12736&&l<=12783,"Enclosed CJK Letters and Months":l=>l>=12800&&l<=13055,"CJK Compatibility":l=>l>=13056&&l<=13311,"Yijing Hexagram Symbols":l=>l>=19904&&l<=19967,"Private Use Area":l=>l>=57344&&l<=63743,"Vertical Forms":l=>l>=65040&&l<=65055,"CJK Compatibility Forms":l=>l>=65072&&l<=65103,"Small Form Variants":l=>l>=65104&&l<=65135,"Halfwidth and Fullwidth Forms":l=>l>=65280&&l<=65519};function Oa(l){for(const s of l)if(_a(s.charCodeAt(0)))return!0;return!1}function Ih(l){for(const s of l)if(!Ps(s.charCodeAt(0)))return!1;return!0}function Vo(l){const s=l.map((u=>{try{return new RegExp(`\\p{sc=${u}}`,"u").source}catch{return null}})).filter((u=>u));return new RegExp(s.join("|"),"u")}const Dh=Vo(["Arab","Dupl","Mong","Ougr","Syrc"]);function Ps(l){return!Dh.test(String.fromCodePoint(l))}const ga=Vo(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function _a(l){return!(l!==746&&l!==747&&(l<4352||!(_i["CJK Compatibility Forms"](l)&&!(l>=65097&&l<=65103)||_i["CJK Compatibility"](l)||_i["CJK Strokes"](l)||!(!_i["CJK Symbols and Punctuation"](l)||l>=12296&&l<=12305||l>=12308&&l<=12319||l===12336)||_i["Enclosed CJK Letters and Months"](l)||_i["Ideographic Description Characters"](l)||_i.Kanbun(l)||_i.Katakana(l)&&l!==12540||!(!_i["Halfwidth and Fullwidth Forms"](l)||l===65288||l===65289||l===65293||l>=65306&&l<=65310||l===65339||l===65341||l===65343||l>=65371&&l<=65503||l===65507||l>=65512&&l<=65519)||!(!_i["Small Form Variants"](l)||l>=65112&&l<=65118||l>=65123&&l<=65126)||_i["Vertical Forms"](l)||_i["Yijing Hexagram Symbols"](l)||new RegExp("\\p{sc=Cans}","u").test(String.fromCodePoint(l))||new RegExp("\\p{sc=Hang}","u").test(String.fromCodePoint(l))||ga.test(String.fromCodePoint(l)))))}function ya(l){return!(_a(l)||(function(s){return!!(_i["Latin-1 Supplement"](s)&&(s===167||s===169||s===174||s===177||s===188||s===189||s===190||s===215||s===247)||_i["General Punctuation"](s)&&(s===8214||s===8224||s===8225||s===8240||s===8241||s===8251||s===8252||s===8258||s===8263||s===8264||s===8265||s===8273)||_i["Letterlike Symbols"](s)||_i["Number Forms"](s)||_i["Miscellaneous Technical"](s)&&(s>=8960&&s<=8967||s>=8972&&s<=8991||s>=8996&&s<=9e3||s===9003||s>=9085&&s<=9114||s>=9150&&s<=9165||s===9167||s>=9169&&s<=9179||s>=9186&&s<=9215)||_i["Control Pictures"](s)&&s!==9251||_i["Optical Character Recognition"](s)||_i["Enclosed Alphanumerics"](s)||_i["Geometric Shapes"](s)||_i["Miscellaneous Symbols"](s)&&!(s>=9754&&s<=9759)||_i["Miscellaneous Symbols and Arrows"](s)&&(s>=11026&&s<=11055||s>=11088&&s<=11097||s>=11192&&s<=11243)||_i["CJK Symbols and Punctuation"](s)||_i.Katakana(s)||_i["Private Use Area"](s)||_i["CJK Compatibility Forms"](s)||_i["Small Form Variants"](s)||_i["Halfwidth and Fullwidth Forms"](s)||s===8734||s===8756||s===8757||s>=9984&&s<=10087||s>=10102&&s<=10131||s===65532||s===65533)})(l))}
vendor: 25,594 bytes, line 53
53const Oh=Vo(["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"]);function xc(l){return Oh.test(String.fromCodePoint(l))}function Rl(l,s){return!(!s&&xc(l)||l>=2304&&l<=3583||l>=3840&&l<=4255||_i.Khmer(l))}function wu(l){for(const s of l)if(xc(s.charCodeAt(0)))return!0;return!1}const dr=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(l){this.pluginStatus=l.pluginStatus,this.pluginURL=l.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(l){this.applyArabicShaping=l.applyArabicShaping,this.processBidirectionalText=l.processBidirectionalText,this.processStyledBidirectionalText=l.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class xi{constructor(s,u){this.zoom=s,u?(this.now=u.now,this.fadeDuration=u.fadeDuration,this.zoomHistory=u.zoomHistory,this.transition=u.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new xu,this.transition={})}isSupportedScript(s){return(function(u,g){for(const v of u)if(!Rl(v.charCodeAt(0),g))return!1;return!0})(s,dr.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const s=this.zoom,u=s-Math.floor(s),g=this.crossFadingFactor();return s>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:u+(1-u)*g}:{fromScale:.5,toScale:1,t:1-(1-g)*u}}}class ka{constructor(s,u){this.property=s,this.value=u,this.expression=(function(g,v){if(pc(g))return new zo(g,v);if(wl(g)){const T=mc(g,v);if(T.result==="error")throw new Error(T.value.map((S=>`${S.key}: ${S.message}`)).join(", "));return T.value}{let T=g;return v.type==="color"&&typeof g=="string"?T=Fi.parse(g):v.type!=="padding"||typeof g!="number"&&!Array.isArray(g)?v.type==="variableAnchorOffsetCollection"&&Array.isArray(g)&&(T=Es.parse(g)):T=cr.parse(g),{kind:"constant",evaluate:()=>T}}})(u===void 0?s.specification.default:u,s.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(s,u,g){return this.property.possiblyEvaluate(this,s,u,g)}}class wc{constructor(s){this.property=s,this.value=new ka(s,void 0)}transitioned(s,u){return new sf(this.property,this.value,u,Ee({},s.transition,this.transition),s.now)}untransitioned(){return new sf(this.property,this.value,null,{},0)}}class Tu{constructor(s){this._properties=s,this._values=Object.create(s.defaultTransitionablePropertyValues)}getValue(s){return Qe(this._values[s].value.value)}setValue(s,u){Object.prototype.hasOwnProperty.call(this._values,s)||(this._values[s]=new wc(this._values[s].property)),this._values[s].value=new ka(this._values[s].property,u===null?void 0:Qe(u))}getTransition(s){return Qe(this._values[s].transition)}setTransition(s,u){Object.prototype.hasOwnProperty.call(this._values,s)||(this._values[s]=new wc(this._values[s].property)),this._values[s].transition=Qe(u)||void 0}serialize(){const s={};for(const u of Object.keys(this._values)){const g=this.getValue(u);g!==void 0&&(s[u]=g);const v=this.getTransition(u);v!==void 0&&(s[`${u}-transition`]=v)}return s}transitioned(s,u){const g=new Tc(this._properties);for(const v of Object.keys(this._values))g._values[v]=this._values[v].transitioned(s,u._values[v]);return g}untransitioned(){const s=new Tc(this._properties);for(const u of Object.keys(this._values))s._values[u]=this._values[u].untransitioned();return s}}class sf{constructor(s,u,g,v,T){this.property=s,this.value=u,this.begin=T+v.delay||0,this.end=this.begin+v.duration||0,s.specification.transition&&(v.delay||v.duration)&&(this.prior=g)}possiblyEvaluate(s,u,g){const v=s.now||0,T=this.value.possiblyEvaluate(s,u,g),S=this.prior;if(S){if(v>this.end)return this.prior=null,T;if(this.value.isDataDriven())return this.prior=null,T;if(v<this.begin)return S.possiblyEvaluate(s,u,g);{const C=(v-this.begin)/(this.end-this.begin);return this.property.interpolate(S.possiblyEvaluate(s,u,g),T,(function(P){if(P<=0)return 0;if(P>=1)return 1;const k=P*P,z=k*P;return 4*(P<.5?z:3*(P-k)+z-.75)})(C))}}return T}}class Tc{constructor(s){this._properties=s,this._values=Object.create(s.defaultTransitioningPropertyValues)}possiblyEvaluate(s,u,g){const v=new Ba(this._properties);for(const T of Object.keys(this._values))v._values[T]=this._values[T].possiblyEvaluate(s,u,g);return v}hasTransition(){for(const s of Object.keys(this._values))if(this._values[s].prior)return!0;return!1}}class Mn{constructor(s){this._properties=s,this._values=Object.create(s.defaultPropertyValues)}hasValue(s){return this._values[s].value!==void 0}getValue(s){return Qe(this._values[s].value)}setValue(s,u){this._values[s]=new ka(this._values[s].property,u===null?void 0:Qe(u))}serialize(){const s={};for(const u of Object.keys(this._values)){const g=this.getValue(u);g!==void 0&&(s[u]=g)}return s}possiblyEvaluate(s,u,g){const v=new Ba(this._properties);for(const T of Object.keys(this._values))v._values[T]=this._values[T].possiblyEvaluate(s,u,g);return v}}class Is{constructor(s,u,g){this.property=s,this.value=u,this.parameters=g}isConstant(){return this.value.kind==="constant"}constantOr(s){return this.value.kind==="constant"?this.value.value:s}evaluate(s,u,g,v){return this.property.evaluate(this.value,this.parameters,s,u,g,v)}}class Ba{constructor(s){this._properties=s,this._values=Object.create(s.defaultPossiblyEvaluatedValues)}get(s){return this._values[s]}}class Nt{constructor(s){this.specification=s}possiblyEvaluate(s,u){if(s.isDataDriven())throw new Error("Value should not be data driven");return s.expression.evaluate(u)}interpolate(s,u,g){const v=Dr[this.specification.type];return v?v(s,u,g):s}}class Zt{constructor(s,u){this.specification=s,this.overrides=u}possiblyEvaluate(s,u,g,v){return new Is(this,s.expression.kind==="constant"||s.expression.kind==="camera"?{kind:"constant",value:s.expression.evaluate(u,null,{},g,v)}:s.expression,u)}interpolate(s,u,g){if(s.value.kind!=="constant"||u.value.kind!=="constant")return s;if(s.value.value===void 0||u.value.value===void 0)return new Is(this,{kind:"constant",value:void 0},s.parameters);const v=Dr[this.specification.type];if(v){const T=v(s.value.value,u.value.value,g);return new Is(this,{kind:"constant",value:T},s.parameters)}return s}evaluate(s,u,g,v,T,S){return s.kind==="constant"?s.value:s.evaluate(u,g,v,T,S)}}class Na extends Zt{possiblyEvaluate(s,u,g,v){if(s.value===void 0)return new Is(this,{kind:"constant",value:void 0},u);if(s.expression.kind==="constant"){const T=s.expression.evaluate(u,null,{},g,v),S=s.property.specification.type==="resolvedImage"&&typeof T!="string"?T.name:T,C=this._calculate(S,S,S,u);return new Is(this,{kind:"constant",value:C},u)}if(s.expression.kind==="camera"){const T=this._calculate(s.expression.evaluate({zoom:u.zoom-1}),s.expression.evaluate({zoom:u.zoom}),s.expression.evaluate({zoom:u.zoom+1}),u);return new Is(this,{kind:"constant",value:T},u)}return new Is(this,s.expression,u)}evaluate(s,u,g,v,T,S){if(s.kind==="source"){const C=s.evaluate(u,g,v,T,S);return this._calculate(C,C,C,u)}return s.kind==="composite"?this._calculate(s.evaluate({zoom:Math.floor(u.zoom)-1},g,v),s.evaluate({zoom:Math.floor(u.zoom)},g,v),s.evaluate({zoom:Math.floor(u.zoom)+1},g,v),u):s.value}_calculate(s,u,g,v){return v.zoom>v.zoomHistory.lastIntegerZoom?{from:s,to:u}:{from:g,to:u}}interpolate(s){return s}}class za{constructor(s){this.specification=s}possiblyEvaluate(s,u,g,v){if(s.value!==void 0){if(s.expression.kind==="constant"){const T=s.expression.evaluate(u,null,{},g,v);return this._calculate(T,T,T,u)}return this._calculate(s.expression.evaluate(new xi(Math.floor(u.zoom-1),u)),s.expression.evaluate(new xi(Math.floor(u.zoom),u)),s.expression.evaluate(new xi(Math.floor(u.zoom+1),u)),u)}}_calculate(s,u,g,v){return v.zoom>v.zoomHistory.lastIntegerZoom?{from:s,to:u}:{from:g,to:u}}interpolate(s){return s}}class kh{constructor(s){this.specification=s}possiblyEvaluate(s,u,g,v){return!!s.expression.evaluate(u,null,{},g,v)}interpolate(){return!1}}class w{constructor(s){this.properties=s,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const u in s){const g=s[u];g.specification.overridable&&this.overridableProperties.push(u);const v=this.defaultPropertyValues[u]=new ka(g,void 0),T=this.defaultTransitionablePropertyValues[u]=new wc(g);this.defaultTransitioningPropertyValues[u]=T.untransitioned(),this.defaultPossiblyEvaluatedValues[u]=v.possiblyEvaluate({})}}}lt("DataDrivenProperty",Zt),lt("DataConstantProperty",Nt),lt("CrossFadedDataDrivenProperty",Na),lt("CrossFadedProperty",za),lt("ColorRampProperty",kh);const r="-transition";class f extends Cn{constructor(s,u){if(super(),this.id=s.id,this.type=s.type,this._featureFilter={filter:()=>!0,needGeometry:!1},s.type!=="custom"&&(this.metadata=s.metadata,this.minzoom=s.minzoom,this.maxzoom=s.maxzoom,s.type!=="background"&&(this.source=s.source,this.sourceLayer=s["source-layer"],this.filter=s.filter),u.layout&&(this._unevaluatedLayout=new Mn(u.layout)),u.paint)){this._transitionablePaint=new Tu(u.paint);for(const g in s.paint)this.setPaintProperty(g,s.paint[g],{validate:!1});for(const g in s.layout)this.setLayoutProperty(g,s.layout[g],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Ba(u.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(s){return s==="visibility"?this.visibility:this._unevaluatedLayout.getValue(s)}setLayoutProperty(s,u,g={}){u!=null&&this._validate(yu,`layers.${this.id}.layout.${s}`,s,u,g)||(s!=="visibility"?this._unevaluatedLayout.setValue(s,u):this.visibility=u)}getPaintProperty(s){return s.endsWith(r)?this._transitionablePaint.getTransition(s.slice(0,-11)):this._transitionablePaint.getValue(s)}setPaintProperty(s,u,g={}){if(u!=null&&this._validate(_u,`layers.${this.id}.paint.${s}`,s,u,g))return!1;if(s.endsWith(r))return this._transitionablePaint.setTransition(s.slice(0,-11),u||void 0),!1;{const v=this._transitionablePaint._values[s],T=v.property.specification["property-type"]==="cross-faded-data-driven",S=v.value.isDataDriven(),C=v.value;this._transitionablePaint.setValue(s,u),this._handleSpecialPaintPropertyUpdate(s);const P=this._transitionablePaint._values[s].value;return P.isDataDriven()||S||T||this._handleOverridablePaintPropertyUpdate(s,C,P)}}_handleSpecialPaintPropertyUpdate(s){}_handleOverridablePaintPropertyUpdate(s,u,g){return!1}isHidden(s){return!!(this.minzoom&&s<this.minzoom)||!!(this.maxzoom&&s>=this.maxzoom)||this.visibility==="none"}updateTransitions(s){this._transitioningPaint=this._transitionablePaint.transitioned(s,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(s,u){s.getCrossfadeParameters&&(this._crossfadeParameters=s.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(s,void 0,u)),this.paint=this._transitioningPaint.possiblyEvaluate(s,void 0,u)}serialize(){const s={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&&(s.layout=s.layout||{},s.layout.visibility=this.visibility),Ke(s,((u,g)=>!(u===void 0||g==="layout"&&!Object.keys(u).length||g==="paint"&&!Object.keys(u).length)))}_validate(s,u,g,v,T={}){return(!T||T.validate!==!1)&&vu(this,s.call(zr,{key:u,layerType:this.type,objectKey:g,value:v,styleSpec:_e,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const s in this.paint._values){const u=this.paint.get(s);if(u instanceof Is&&xl(u.property.specification)&&(u.value.kind==="source"||u.value.kind==="composite")&&u.value.isStateDependent)return!0}return!1}}const _={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class y{constructor(s,u){this._structArray=s,this._pos1=u*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class x{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(s,u){return s._trim(),u&&(s.isTransferred=!0,u.push(s.arrayBuffer)),{length:s.length,arrayBuffer:s.arrayBuffer}}static deserialize(s){const u=Object.create(this.prototype);return u.arrayBuffer=s.arrayBuffer,u.length=s.length,u.capacity=s.arrayBuffer.byteLength/u.bytesPerElement,u._refreshViews(),u}_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(s){this.reserve(s),this.length=s}reserve(s){if(s>this.capacity){this.capacity=Math.max(s,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const u=this.uint8;this._refreshViews(),u&&this.uint8.set(u)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function M(l,s=1){let u=0,g=0;return{members:l.map((v=>{const T=_[v.type].BYTES_PER_ELEMENT,S=u=D(u,Math.max(s,T)),C=v.components||1;return g=Math.max(g,T),u+=T*C,{name:v.name,type:v.type,components:C,offset:S}})),size:D(u,Math.max(g,s)),alignment:s}}function D(l,s){return Math.ceil(l/s)*s}class O extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,u){const g=this.length;return this.resize(g+1),this.emplace(g,s,u)}emplace(s,u,g){const v=2*s;return this.int16[v+0]=u,this.int16[v+1]=g,s}}O.prototype.bytesPerElement=4,lt("StructArrayLayout2i4",O);class L extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,u,g){const v=this.length;return this.resize(v+1),this.emplace(v,s,u,g)}emplace(s,u,g,v){const T=3*s;return this.int16[T+0]=u,this.int16[T+1]=g,this.int16[T+2]=v,s}}L.prototype.bytesPerElement=6,lt("StructArrayLayout3i6",L);class $ extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,u,g,v){const T=this.length;return this.resize(T+1),this.emplace(T,s,u,g,v)}emplace(s,u,g,v,T){const S=4*s;return this.int16[S+0]=u,this.int16[S+1]=g,this.int16[S+2]=v,this.int16[S+3]=T,s}}$.prototype.bytesPerElement=8,lt("StructArrayLayout4i8",$);class H extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,u,g,v,T,S){const C=this.length;return this.resize(C+1),this.emplace(C,s,u,g,v,T,S)}emplace(s,u,g,v,T,S,C){const P=6*s;return this.int16[P+0]=u,this.int16[P+1]=g,this.int16[P+2]=v,this.int16[P+3]=T,this.int16[P+4]=S,this.int16[P+5]=C,s}}H.prototype.bytesPerElement=12,lt("StructArrayLayout2i4i12",H);class G extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,u,g,v,T,S){const C=this.length;return this.resize(C+1),this.emplace(C,s,u,g,v,T,S)}emplace(s,u,g,v,T,S,C){const P=4*s,k=8*s;return this.int16[P+0]=u,this.int16[P+1]=g,this.uint8[k+4]=v,this.uint8[k+5]=T,this.uint8[k+6]=S,this.uint8[k+7]=C,s}}G.prototype.bytesPerElement=8,lt("StructArrayLayout2i4ub8",G);class ee extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s,u){const g=this.length;return this.resize(g+1),this.emplace(g,s,u)}emplace(s,u,g){const v=2*s;return this.float32[v+0]=u,this.float32[v+1]=g,s}}ee.prototype.bytesPerElement=8,lt("StructArrayLayout2f8",ee);class ne extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(s,u,g,v,T,S,C,P,k,z){const U=this.length;return this.resize(U+1),this.emplace(U,s,u,g,v,T,S,C,P,k,z)}emplace(s,u,g,v,T,S,C,P,k,z,U){const W=10*s;return this.uint16[W+0]=u,this.uint16[W+1]=g,this.uint16[W+2]=v,this.uint16[W+3]=T,this.uint16[W+4]=S,this.uint16[W+5]=C,this.uint16[W+6]=P,this.uint16[W+7]=k,this.uint16[W+8]=z,this.uint16[W+9]=U,s}}ne.prototype.bytesPerElement=20,lt("StructArrayLayout10ui20",ne);class he extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(s,u,g,v,T,S,C,P,k,z,U,W){const Z=this.length;return this.resize(Z+1),this.emplace(Z,s,u,g,v,T,S,C,P,k,z,U,W)}emplace(s,u,g,v,T,S,C,P,k,z,U,W,Z){const K=12*s;return this.int16[K+0]=u,this.int16[K+1]=g,this.int16[K+2]=v,this.int16[K+3]=T,this.uint16[K+4]=S,this.uint16[K+5]=C,this.uint16[K+6]=P,this.uint16[K+7]=k,this.int16[K+8]=z,this.int16[K+9]=U,this.int16[K+10]=W,this.int16[K+11]=Z,s}}he.prototype.bytesPerElement=24,lt("StructArrayLayout4i4ui4i24",he);class pe extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s,u,g){const v=this.length;return this.resize(v+1),this.emplace(v,s,u,g)}emplace(s,u,g,v){const T=3*s;return this.float32[T+0]=u,this.float32[T+1]=g,this.float32[T+2]=v,s}}pe.prototype.bytesPerElement=12,lt("StructArrayLayout3f12",pe);class ge extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(s){const u=this.length;return this.resize(u+1),this.emplace(u,s)}emplace(s,u){return this.uint32[1*s+0]=u,s}}ge.prototype.bytesPerElement=4,lt("StructArrayLayout1ul4",ge);class be extends x{_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(s,u,g,v,T,S,C,P,k){const z=this.length;return this.resize(z+1),this.emplace(z,s,u,g,v,T,S,C,P,k)}emplace(s,u,g,v,T,S,C,P,k,z){const U=10*s,W=5*s;return this.int16[U+0]=u,this.int16[U+1]=g,this.int16[U+2]=v,this.int16[U+3]=T,this.int16[U+4]=S,this.int16[U+5]=C,this.uint32[W+3]=P,this.uint16[U+8]=k,this.uint16[U+9]=z,s}}be.prototype.bytesPerElement=20,lt("StructArrayLayout6i1ul2ui20",be);class le extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,u,g,v,T,S){const C=this.length;return this.resize(C+1),this.emplace(C,s,u,g,v,T,S)}emplace(s,u,g,v,T,S,C){const P=6*s;return this.int16[P+0]=u,this.int16[P+1]=g,this.int16[P+2]=v,this.int16[P+3]=T,this.int16[P+4]=S,this.int16[P+5]=C,s}}le.prototype.bytesPerElement=12,lt("StructArrayLayout2i2i2i12",le);class Ce extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,u,g,v,T){const S=this.length;return this.resize(S+1),this.emplace(S,s,u,g,v,T)}emplace(s,u,g,v,T,S){const C=4*s,P=8*s;return this.float32[C+0]=u,this.float32[C+1]=g,this.float32[C+2]=v,this.int16[P+6]=T,this.int16[P+7]=S,s}}Ce.prototype.bytesPerElement=16,lt("StructArrayLayout2f1f2i16",Ce);class Ie extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,u,g,v,T,S){const C=this.length;return this.resize(C+1),this.emplace(C,s,u,g,v,T,S)}emplace(s,u,g,v,T,S,C){const P=16*s,k=4*s,z=8*s;return this.uint8[P+0]=u,this.uint8[P+1]=g,this.float32[k+1]=v,this.float32[k+2]=T,this.int16[z+6]=S,this.int16[z+7]=C,s}}Ie.prototype.bytesPerElement=16,lt("StructArrayLayout2ub2f2i16",Ie);class ze extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(s,u,g){const v=this.length;return this.resize(v+1),this.emplace(v,s,u,g)}emplace(s,u,g,v){const T=3*s;return this.uint16[T+0]=u,this.uint16[T+1]=g,this.uint16[T+2]=v,s}}ze.prototype.bytesPerElement=6,lt("StructArrayLayout3ui6",ze);class Ge extends x{_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(s,u,g,v,T,S,C,P,k,z,U,W,Z,K,J,ce,fe){const Be=this.length;return this.resize(Be+1),this.emplace(Be,s,u,g,v,T,S,C,P,k,z,U,W,Z,K,J,ce,fe)}emplace(s,u,g,v,T,S,C,P,k,z,U,W,Z,K,J,ce,fe,Be){const Ae=24*s,De=12*s,Xe=48*s;return this.int16[Ae+0]=u,this.int16[Ae+1]=g,this.uint16[Ae+2]=v,this.uint16[Ae+3]=T,this.uint32[De+2]=S,this.uint32[De+3]=C,this.uint32[De+4]=P,this.uint16[Ae+10]=k,this.uint16[Ae+11]=z,this.uint16[Ae+12]=U,this.float32[De+7]=W,this.float32[De+8]=Z,this.uint8[Xe+36]=K,this.uint8[Xe+37]=J,this.uint8[Xe+38]=ce,this.uint32[De+10]=fe,this.int16[Ae+22]=Be,s}}Ge.prototype.bytesPerElement=48,lt("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Ge);class dt extends x{_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(s,u,g,v,T,S,C,P,k,z,U,W,Z,K,J,ce,fe,Be,Ae,De,Xe,ct,Rt,Yt,_t,St,Lt,Bt){const It=this.length;return this.resize(It+1),this.emplace(It,s,u,g,v,T,S,C,P,k,z,U,W,Z,K,J,ce,fe,Be,Ae,De,Xe,ct,Rt,Yt,_t,St,Lt,Bt)}emplace(s,u,g,v,T,S,C,P,k,z,U,W,Z,K,J,ce,fe,Be,Ae,De,Xe,ct,Rt,Yt,_t,St,Lt,Bt,It){const Ye=32*s,kt=16*s;return this.int16[Ye+0]=u,this.int16[Ye+1]=g,this.int16[Ye+2]=v,this.int16[Ye+3]=T,this.int16[Ye+4]=S,this.int16[Ye+5]=C,this.int16[Ye+6]=P,this.int16[Ye+7]=k,this.uint16[Ye+8]=z,this.uint16[Ye+9]=U,this.uint16[Ye+10]=W,this.uint16[Ye+11]=Z,this.uint16[Ye+12]=K,this.uint16[Ye+13]=J,this.uint16[Ye+14]=ce,this.uint16[Ye+15]=fe,this.uint16[Ye+16]=Be,this.uint16[Ye+17]=Ae,this.uint16[Ye+18]=De,this.uint16[Ye+19]=Xe,this.uint16[Ye+20]=ct,this.uint16[Ye+21]=Rt,this.uint16[Ye+22]=Yt,this.uint32[kt+12]=_t,this.float32[kt+13]=St,this.float32[kt+14]=Lt,this.uint16[Ye+30]=Bt,this.uint16[Ye+31]=It,s}}dt.prototype.bytesPerElement=64,lt("StructArrayLayout8i15ui1ul2f2ui64",dt);class vt extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s){const u=this.length;return this.resize(u+1),this.emplace(u,s)}emplace(s,u){return this.float32[1*s+0]=u,s}}vt.prototype.bytesPerElement=4,lt("StructArrayLayout1f4",vt);class Mt extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s,u,g){const v=this.length;return this.resize(v+1),this.emplace(v,s,u,g)}emplace(s,u,g,v){const T=3*s;return this.uint16[6*s+0]=u,this.float32[T+1]=g,this.float32[T+2]=v,s}}Mt.prototype.bytesPerElement=12,lt("StructArrayLayout1ui2f12",Mt);class xt extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(s,u,g){const v=this.length;return this.resize(v+1),this.emplace(v,s,u,g)}emplace(s,u,g,v){const T=4*s;return this.uint32[2*s+0]=u,this.uint16[T+2]=g,this.uint16[T+3]=v,s}}xt.prototype.bytesPerElement=8,lt("StructArrayLayout1ul2ui8",xt);class ft extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(s,u){const g=this.length;return this.resize(g+1),this.emplace(g,s,u)}emplace(s,u,g){const v=2*s;return this.uint16[v+0]=u,this.uint16[v+1]=g,s}}ft.prototype.bytesPerElement=4,lt("StructArrayLayout2ui4",ft);class Ot extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(s){const u=this.length;return this.resize(u+1),this.emplace(u,s)}emplace(s,u){return this.uint16[1*s+0]=u,s}}Ot.prototype.bytesPerElement=2,lt("StructArrayLayout1ui2",Ot);class ni extends x{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s,u,g,v){const T=this.length;return this.resize(T+1),this.emplace(T,s,u,g,v)}emplace(s,u,g,v,T){const S=4*s;return this.float32[S+0]=u,this.float32[S+1]=g,this.float32[S+2]=v,this.float32[S+3]=T,s}}ni.prototype.bytesPerElement=16,lt("StructArrayLayout4f16",ni);class wt extends y{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]}
vendor: 5,290 bytes, line 53
53get anchorPoint(){return new N(this.anchorPointX,this.anchorPointY)}}wt.prototype.size=20;class Ct extends be{get(s){return new wt(this,s)}}lt("CollisionBoxArray",Ct);class Qt extends y{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(s){this._structArray.uint8[this._pos1+37]=s}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(s){this._structArray.uint8[this._pos1+38]=s}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(s){this._structArray.uint32[this._pos4+10]=s}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}Qt.prototype.size=48;class Ki extends Ge{get(s){return new Qt(this,s)}}lt("PlacedSymbolArray",Ki);class mi extends y{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(s){this._structArray.uint32[this._pos4+12]=s}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}mi.prototype.size=64;class Si extends dt{get(s){return new mi(this,s)}}lt("SymbolInstanceArray",Si);class Zi extends vt{getoffsetX(s){return this.float32[1*s+0]}}lt("GlyphOffsetArray",Zi);class fr extends L{getx(s){return this.int16[3*s+0]}gety(s){return this.int16[3*s+1]}gettileUnitDistanceFromAnchor(s){return this.int16[3*s+2]}}lt("SymbolLineVertexArray",fr);class Ds extends y{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}Ds.prototype.size=12;class an extends Mt{get(s){return new Ds(this,s)}}lt("TextAnchorOffsetArray",an);class Lr extends y{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]}}Lr.prototype.size=8;class pn extends xt{get(s){return new Lr(this,s)}}lt("FeatureIndexArray",pn);class mn extends O{}class Xn extends O{}class Os extends O{}class $o extends H{}class Qs extends G{}class gr extends ee{}class Wi extends ne{}class Ho extends he{}class Js extends pe{}class oi extends ge{}class Mi extends le{}class gn extends Ie{}class os extends ze{}class qn extends ft{}const Zn=M([{name:"a_pos",components:2,type:"Int16"}],4),{members:Fr}=Zn;class wi{constructor(s=[]){this.segments=s}prepareSegment(s,u,g,v){let T=this.segments[this.segments.length-1];return s>wi.MAX_VERTEX_ARRAY_LENGTH&&At(`Max vertices per segment is ${wi.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${s}
53`),(!T||T.vertexLength+s>wi.MAX_VERTEX_ARRAY_LENGTH||T.sortKey!==v)&&(T={vertexOffset:u.length,primitiveOffset:g.length,vertexLength:0,primitiveLength:0},v!==void 0&&(T.sortKey=v),this.segments.push(T)),T}get(){return this.segments}destroy(){for(const s of this.segments)for(const u in s.vaos)s.vaos[u].destroy()}static simpleSegment(s,u,g,v){return new wi([{vertexOffset:s,primitiveOffset:u,vertexLength:g,primitiveLength:v,vaos:{},sortKey:0}])}}function ks(l,s){return 256*(l=Te(Math.floor(l),0,255))+Te(Math.floor(s),0,255)}wi.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,lt("SegmentVector",wi);const Ml=M([{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 _n={exports:{}},Su={exports:{}};Su.exports=function(l,s){var u,g,v,T,S,C,P,k;for(g=l.length-(u=3&l.length),v=s,S=3432918353,C=461845907,k=0;k<g;)P=255&l.charCodeAt(k)|(255&l.charCodeAt(++k))<<8|(255&l.charCodeAt(++k))<<16|(255&l.charCodeAt(++k))<<24,++k,v=27492+(65535&(T=5*(65535&(v=(v^=P=(65535&(P=(P=(65535&P)*S+(((P>>>16)*S&65535)<<16)&4294967295)<<15|P>>>17))*C+(((P>>>16)*C&65535)<<16)&4294967295)<<13|v>>>19))+((5*(v>>>16)&65535)<<16)&4294967295))+((58964+(T>>>16)&65535)<<16);switch(P=0,u){case 3:P^=(255&l.charCodeAt(k+2))<<16;case 2:P^=(255&l.charCodeAt(k+1))<<8;case 1:v^=P=(65535&(P=(P=(65535&(P^=255&l.charCodeAt(k)))*S+(((P>>>16)*S&65535)<<16)&4294967295)<<15|P>>>17))*C+(((P>>>16)*C&65535)<<16)&4294967295}return v^=l.length,v=2246822507*(65535&(v^=v>>>16))+((2246822507*(v>>>16)&65535)<<16)&4294967295,v=3266489909*(65535&(v^=v>>>13))+((3266489909*(v>>>16)&65535)<<16)&4294967295,(v^=v>>>16)>>>0};var Bh=Su.exports,Nh={exports:{}};Nh.exports=function(l,s){for(var u,g=l.length,v=s^g,T=0;g>=4;)u=1540483477*(65535&(u=255&l.charCodeAt(T)|(255&l.charCodeAt(++T))<<8|(255&l.charCodeAt(++T))<<16|(255&l.charCodeAt(++T))<<24))+((1540483477*(u>>>16)&65535)<<16),v=1540483477*(65535&v)+((1540483477*(v>>>16)&65535)<<16)^(u=1540483477*(65535&(u^=u>>>24))+((1540483477*(u>>>16)&65535)<<16)),g-=4,++T;switch(g){case 3:v^=(255&l.charCodeAt(T+2))<<16;case 2:v^=(255&l.charCodeAt(T+1))<<8;case 1:v=1540483477*(65535&(v^=255&l.charCodeAt(T)))+((1540483477*(v>>>16)&65535)<<16)}return v=1540483477*(65535&(v^=v>>>13))+((1540483477*(v>>>16)&65535)<<16),(v^=v>>>15)>>>0};var La=Bh,af=Nh.exports;_n.exports=La,_n.exports.murmur3=La,_n.exports.murmur2=af;var Pl=A(_n.exports);class Wo{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(s,u,g,v){this.ids.push(Il(s)),this.positions.push(u,g,v)}getPositions(s){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const u=Il(s);let g=0,v=this.ids.length-1;for(;g<v;){const S=g+v>>1;this.ids[S]>=u?v=S:g=S+1}const T=[];for(;this.ids[g]===u;)T.push({index:this.positions[3*g],start:this.positions[3*g+1],end:this.positions[3*g+2]}),g++;return T}static serialize(s,u){const g=new Float64Array(s.ids),v=new Uint32Array(s.positions);return _r(g,v,0,g.length-1),u&&u.push(g.buffer,v.buffer),{ids:g,positions:v}}static deserialize(s){const u=new Wo;return u.ids=s.ids,u.positions=s.positions,u.indexed=!0,u}}function Il(l){const s=+l;return!isNaN(s)&&s<=Number.MAX_SAFE_INTEGER?s:Pl(String(l))}function _r(l,s,u,g){for(;u<g;){const v=l[u+g>>1];let T=u-1,S=g+1;for(;;){do T++;while(l[T]<v);do S--;while(l[S]>v);if(T>=S)break;Tn(l,T,S),Tn(s,3*T,3*S),Tn(s,3*T+1,3*S+1),Tn(s,3*T+2,3*S+2)}S-u<g-S?(_r(l,s,u,S),u=S+1):(_r(l,s,S+1,g),g=S)}}function Tn(l,s,u){const g=l[s];l[s]=l[u],l[u]=g}lt("FeaturePositionMap",Wo);class no{constructor(s,u){this.gl=s.gl,this.location=u}}class Dl extends no{constructor(s,u){super(s,u),this.current=0}set(s){this.current!==s&&(this.current=s,this.gl.uniform1f(this.location,s))}}class zh extends no{constructor(s,u){super(s,u),this.current=[0,0,0,0]}set(s){s[0]===this.current[0]&&s[1]===this.current[1]&&s[2]===this.current[2]&&s[3]===this.current[3]||(this.current=s,this.gl.uniform4f(this.location,s[0],s[1],s[2],s[3]))}}class of extends no{constructor(s,u){super(s,u),this.current=Fi.transparent}set(s){s.r===this.current.r&&s.g===this.current.g&&s.b===this.current.b&&s.a===this.current.a||(this.current=s,this.gl.uniform4f(this.location,s.r,s.g,s.b,s.a))}}const Xo=new Float32Array(16);function Au(l){return[ks(255*l.r,255*l.g),ks(255*l.b,255*l.a)]}class Sc{constructor(s,u,g){this.value=s,this.uniformNames=u.map((v=>`u_${v}`)),this.type=g}setUniform(s,u,g){s.set(g.constantOr(this.value))}getBinding(s,u,g){return this.type==="color"?new of(s,u):new Dl(s,u)}}class Ol{constructor(s,u){this.uniformNames=u.map((g=>`u_${g}`)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(s,u){this.pixelRatioFrom=u.pixelRatio,this.pixelRatioTo=s.pixelRatio,this.patternFrom=u.tlbr,this.patternTo=s.tlbr}setUniform(s,u,g,v){const T=v==="u_pattern_to"?this.patternTo:v==="u_pattern_from"?this.patternFrom:v==="u_pixel_ratio_to"?this.pixelRatioTo:v==="u_pixel_ratio_from"?this.pixelRatioFrom:null;T&&s.set(T)}getBinding(s,u,g){return g.substr(0,9)==="u_pattern"?new zh(s,u):new Dl(s,u)}}class ro{constructor(s,u,g,v){this.expression=s,this.type=g,this.maxValue=0,this.paintVertexAttributes=u.map((T=>({name:`a_${T}`,type:"Float32",components:g==="color"?2:1,offset:0}))),this.paintVertexArray=new v}populatePaintArray(s,u,g,v,T){const S=this.paintVertexArray.length,C=this.expression.evaluate(new xi(0),u,{},v,[],T);this.paintVertexArray.resize(s),this._setPaintValue(S,s,C)}updatePaintArray(s,u,g,v){const T=this.expression.evaluate({zoom:0},g,v);this._setPaintValue(s,u,T)}
vendor: 7,972 bytes, line 53
53_setPaintValue(s,u,g){if(this.type==="color"){const v=Au(g);for(let T=s;T<u;T++)this.paintVertexArray.emplace(T,v[0],v[1])}else{for(let v=s;v<u;v++)this.paintVertexArray.emplace(v,g);this.maxValue=Math.max(this.maxValue,Math.abs(g))}}upload(s){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=s.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class va{constructor(s,u,g,v,T,S){this.expression=s,this.uniformNames=u.map((C=>`u_${C}_t`)),this.type=g,this.useIntegerZoom=v,this.zoom=T,this.maxValue=0,this.paintVertexAttributes=u.map((C=>({name:`a_${C}`,type:"Float32",components:g==="color"?4:2,offset:0}))),this.paintVertexArray=new S}populatePaintArray(s,u,g,v,T){const S=this.expression.evaluate(new xi(this.zoom),u,{},v,[],T),C=this.expression.evaluate(new xi(this.zoom+1),u,{},v,[],T),P=this.paintVertexArray.length;this.paintVertexArray.resize(s),this._setPaintValue(P,s,S,C)}updatePaintArray(s,u,g,v){const T=this.expression.evaluate({zoom:this.zoom},g,v),S=this.expression.evaluate({zoom:this.zoom+1},g,v);this._setPaintValue(s,u,T,S)}_setPaintValue(s,u,g,v){if(this.type==="color"){const T=Au(g),S=Au(v);for(let C=s;C<u;C++)this.paintVertexArray.emplace(C,T[0],T[1],S[0],S[1])}else{for(let T=s;T<u;T++)this.paintVertexArray.emplace(T,g,v);this.maxValue=Math.max(this.maxValue,Math.abs(g),Math.abs(v))}}upload(s){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=s.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(s,u){const g=this.useIntegerZoom?Math.floor(u.zoom):u.zoom,v=Te(this.expression.interpolationFactor(g,this.zoom,this.zoom+1),0,1);s.set(v)}getBinding(s,u,g){return new Dl(s,u)}}class qo{constructor(s,u,g,v,T,S){this.expression=s,this.type=u,this.useIntegerZoom=g,this.zoom=v,this.layerId=S,this.zoomInPaintVertexArray=new T,this.zoomOutPaintVertexArray=new T}populatePaintArray(s,u,g){const v=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(s),this.zoomOutPaintVertexArray.resize(s),this._setPaintValues(v,s,u.patterns&&u.patterns[this.layerId],g)}updatePaintArray(s,u,g,v,T){this._setPaintValues(s,u,g.patterns&&g.patterns[this.layerId],T)}_setPaintValues(s,u,g,v){if(!v||!g)return;const{min:T,mid:S,max:C}=g,P=v[T],k=v[S],z=v[C];if(P&&k&&z)for(let U=s;U<u;U++)this.zoomInPaintVertexArray.emplace(U,k.tl[0],k.tl[1],k.br[0],k.br[1],P.tl[0],P.tl[1],P.br[0],P.br[1],k.pixelRatio,P.pixelRatio),this.zoomOutPaintVertexArray.emplace(U,k.tl[0],k.tl[1],k.br[0],k.br[1],z.tl[0],z.tl[1],z.br[0],z.br[1],k.pixelRatio,z.pixelRatio)}upload(s){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=s.createVertexBuffer(this.zoomInPaintVertexArray,Ml.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=s.createVertexBuffer(this.zoomOutPaintVertexArray,Ml.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class Bp{constructor(s,u,g){this.binders={},this._buffers=[];const v=[];for(const T in s.paint._values){if(!g(T))continue;const S=s.paint.get(T);if(!(S instanceof Is&&xl(S.property.specification)))continue;const C=Ag(T,s.type),P=S.value,k=S.property.specification.type,z=S.property.useIntegerZoom,U=S.property.specification["property-type"],W=U==="cross-faded"||U==="cross-faded-data-driven";if(P.kind==="constant")this.binders[T]=W?new Ol(P.value,C):new Sc(P.value,C,k),v.push(`/u_${T}`);else if(P.kind==="source"||W){const Z=lf(T,k,"source");this.binders[T]=W?new qo(P,k,z,u,Z,s.id):new ro(P,C,k,Z),v.push(`/a_${T}`)}else{const Z=lf(T,k,"composite");this.binders[T]=new va(P,C,k,z,u,Z),v.push(`/z_${T}`)}}this.cacheKey=v.sort().join("")}getMaxValue(s){const u=this.binders[s];return u instanceof ro||u instanceof va?u.maxValue:0}populatePaintArrays(s,u,g,v,T){for(const S in this.binders){const C=this.binders[S];(C instanceof ro||C instanceof va||C instanceof qo)&&C.populatePaintArray(s,u,g,v,T)}}setConstantPatternPositions(s,u){for(const g in this.binders){const v=this.binders[g];v instanceof Ol&&v.setConstantPatternPositions(s,u)}}updatePaintArrays(s,u,g,v,T){let S=!1;for(const C in s){const P=u.getPositions(C);for(const k of P){const z=g.feature(k.index);for(const U in this.binders){const W=this.binders[U];if((W instanceof ro||W instanceof va||W instanceof qo)&&W.expression.isStateDependent===!0){const Z=v.paint.get(U);W.expression=Z.value,W.updatePaintArray(k.start,k.end,z,s[C],T),S=!0}}}}return S}defines(){const s=[];for(const u in this.binders){const g=this.binders[u];(g instanceof Sc||g instanceof Ol)&&s.push(...g.uniformNames.map((v=>`#define HAS_UNIFORM_${v}`)))}return s}getBinderAttributes(){const s=[];for(const u in this.binders){const g=this.binders[u];if(g instanceof ro||g instanceof va)for(let v=0;v<g.paintVertexAttributes.length;v++)s.push(g.paintVertexAttributes[v].name);else if(g instanceof qo)for(let v=0;v<Ml.members.length;v++)s.push(Ml.members[v].name)}return s}getBinderUniforms(){const s=[];for(const u in this.binders){const g=this.binders[u];if(g instanceof Sc||g instanceof Ol||g instanceof va)for(const v of g.uniformNames)s.push(v)}return s}getPaintVertexBuffers(){return this._buffers}getUniforms(s,u){const g=[];for(const v in this.binders){const T=this.binders[v];if(T instanceof Sc||T instanceof Ol||T instanceof va){for(const S of T.uniformNames)if(u[S]){const C=T.getBinding(s,u[S],S);g.push({name:S,property:v,binding:C})}}}return g}setUniforms(s,u,g,v){for(const{name:T,property:S,binding:C}of u)this.binders[S].setUniform(C,v,g.get(S),T)}updatePaintBuffers(s){this._buffers=[];for(const u in this.binders){const g=this.binders[u];if(s&&g instanceof qo){const v=s.fromScale===2?g.zoomInPaintVertexBuffer:g.zoomOutPaintVertexBuffer;v&&this._buffers.push(v)}else(g instanceof ro||g instanceof va)&&g.paintVertexBuffer&&this._buffers.push(g.paintVertexBuffer)}}upload(s){for(const u in this.binders){const g=this.binders[u];(g instanceof ro||g instanceof va||g instanceof qo)&&g.upload(s)}this.updatePaintBuffers()}destroy(){for(const s in this.binders){const u=this.binders[s];(u instanceof ro||u instanceof va||u instanceof qo)&&u.destroy()}}}class kl{constructor(s,u,g=(()=>!0)){this.programConfigurations={};for(const v of s)this.programConfigurations[v.id]=new Bp(v,u,g);this.needsUpload=!1,this._featureMap=new Wo,this._bufferOffset=0}populatePaintArrays(s,u,g,v,T,S){for(const C in this.programConfigurations)this.programConfigurations[C].populatePaintArrays(s,u,v,T,S);u.id!==void 0&&this._featureMap.add(u.id,g,this._bufferOffset,s),this._bufferOffset=s,this.needsUpload=!0}updatePaintArrays(s,u,g,v){for(const T of g)this.needsUpload=this.programConfigurations[T.id].updatePaintArrays(s,this._featureMap,u,T,v)||this.needsUpload}get(s){return this.programConfigurations[s]}upload(s){if(this.needsUpload){for(const u in this.programConfigurations)this.programConfigurations[u].upload(s);this.needsUpload=!1}}destroy(){for(const s in this.programConfigurations)this.programConfigurations[s].destroy()}}function Ag(l,s){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":["ga
53pwidth"],"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"]}[l]||[l.replace(`${s}-`,"").replace(/-/g,"_")]}function lf(l,s,u){const g={color:{source:ee,composite:ni},number:{source:vt,composite:ee}},v=(function(T){return{"line-pattern":{source:Wi,composite:Wi},"fill-pattern":{source:Wi,composite:Wi},"fill-extrusion-pattern":{source:Wi,composite:Wi}}[T]})(l);return v&&v[u]||g[s][u]}lt("ConstantBinder",Sc),lt("CrossFadedConstantBinder",Ol),lt("SourceExpressionBinder",ro),lt("CrossFadedCompositeBinder",qo),lt("CompositeExpressionBinder",va),lt("ProgramConfiguration",Bp,{omit:["_buffers"]}),lt("ProgramConfigurationSet",kl);const Kn=8192,Np=Math.pow(2,14)-1,zp=-Np-1;function Bl(l){const s=Kn/l.extent,u=l.loadGeometry();for(let g=0;g<u.length;g++){const v=u[g];for(let T=0;T<v.length;T++){const S=v[T],C=Math.round(S.x*s),P=Math.round(S.y*s);S.x=Te(C,zp,Np),S.y=Te(P,zp,Np),(C<S.x||C>S.x+1||P<S.y||P>S.y+1)&&At("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return u}function Nl(l,s){return{type:l.type,id:l.id,properties:l.properties,geometry:s?Bl(l):[]}}function Eu(l,s,u,g,v){l.emplaceBack(2*s+(g+1)/2,2*u+(v+1)/2)}class cf{constructor(s){this.zoom=s.zoom,this.overscaling=s.overscaling,this.layers=s.layers,this.layerIds=this.layers.map((u=>u.id)),this.index=s.index,this.hasPattern=!1,this.layoutVertexArray=new Xn,this.indexArray=new os,this.segments=new wi,this.programConfigurations=new kl(s.layers,s.zoom),this.stateDependentLayerIds=this.layers.filter((u=>u.isStateDependent())).map((u=>u.id))}populate(s,u,g){const v=this.layers[0],T=[];let S=null,C=!1;v.type==="circle"&&(S=v.layout.get("circle-sort-key"),C=!S.isConstant());
vendor: 9,213 bytes, line 53
53for(const{feature:P,id:k,index:z,sourceLayerIndex:U}of s){const W=this.layers[0]._featureFilter.needGeometry,Z=Nl(P,W);if(!this.layers[0]._featureFilter.filter(new xi(this.zoom),Z,g))continue;const K=C?S.evaluate(Z,{},g):void 0,J={id:k,properties:P.properties,type:P.type,sourceLayerIndex:U,index:z,geometry:W?Z.geometry:Bl(P),patterns:{},sortKey:K};T.push(J)}C&&T.sort(((P,k)=>P.sortKey-k.sortKey));for(const P of T){const{geometry:k,index:z,sourceLayerIndex:U}=P,W=s[z].feature;this.addFeature(P,k,z,g),u.featureIndex.insert(W,k,z,U,this.index)}}update(s,u,g){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(s,u,this.stateDependentLayers,g)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(s){this.uploaded||(this.layoutVertexBuffer=s.createVertexBuffer(this.layoutVertexArray,Fr),this.indexBuffer=s.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(s),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(s,u,g,v){for(const T of u)for(const S of T){const C=S.x,P=S.y;if(C<0||C>=Kn||P<0||P>=Kn)continue;const k=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,s.sortKey),z=k.vertexLength;Eu(this.layoutVertexArray,C,P,-1,-1),Eu(this.layoutVertexArray,C,P,1,-1),Eu(this.layoutVertexArray,C,P,1,1),Eu(this.layoutVertexArray,C,P,-1,1),this.indexArray.emplaceBack(z,z+1,z+2),this.indexArray.emplaceBack(z,z+3,z+2),k.vertexLength+=4,k.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,s,g,{},v)}}function Lp(l,s){for(let u=0;u<l.length;u++)if(Zo(s,l[u]))return!0;for(let u=0;u<s.length;u++)if(Zo(l,s[u]))return!0;return!!Up(l,s)}function Eg(l,s,u){return!!Zo(l,s)||!!zl(s,l,u)}function Fp(l,s){if(l.length===1)return Lh(s,l[0]);for(let u=0;u<s.length;u++){const g=s[u];for(let v=0;v<g.length;v++)if(Zo(l,g[v]))return!0}for(let u=0;u<l.length;u++)if(Lh(s,l[u]))return!0;for(let u=0;u<s.length;u++)if(Up(l,s[u]))return!0;return!1}function Cg(l,s,u){if(l.length>1){if(Up(l,s))return!0;for(let g=0;g<s.length;g++)if(zl(s[g],l,u))return!0}for(let g=0;g<l.length;g++)if(zl(l[g],s,u))return!0;return!1}function Up(l,s){if(l.length===0||s.length===0)return!1;for(let u=0;u<l.length-1;u++){const g=l[u],v=l[u+1];for(let T=0;T<s.length-1;T++)if(Rg(g,v,s[T],s[T+1]))return!0}return!1}function Rg(l,s,u,g){return Fe(l,u,g)!==Fe(s,u,g)&&Fe(l,s,u)!==Fe(l,s,g)}function zl(l,s,u){const g=u*u;if(s.length===1)return l.distSqr(s[0])<g;for(let v=1;v<s.length;v++)if(jp(l,s[v-1],s[v])<g)return!0;return!1}function jp(l,s,u){const g=s.distSqr(u);if(g===0)return l.distSqr(s);const v=((l.x-s.x)*(u.x-s.x)+(l.y-s.y)*(u.y-s.y))/g;return l.distSqr(v<0?s:v>1?u:u.sub(s)._mult(v)._add(s))}function Lh(l,s){let u,g,v,T=!1;for(let S=0;S<l.length;S++){u=l[S];for(let C=0,P=u.length-1;C<u.length;P=C++)g=u[C],v=u[P],g.y>s.y!=v.y>s.y&&s.x<(v.x-g.x)*(s.y-g.y)/(v.y-g.y)+g.x&&(T=!T)}return T}function Zo(l,s){let u=!1;for(let g=0,v=l.length-1;g<l.length;v=g++){const T=l[g],S=l[v];T.y>s.y!=S.y>s.y&&s.x<(S.x-T.x)*(s.y-T.y)/(S.y-T.y)+T.x&&(u=!u)}return u}function Mg(l,s,u){const g=u[0],v=u[2];if(l.x<g.x&&s.x<g.x||l.x>v.x&&s.x>v.x||l.y<g.y&&s.y<g.y||l.y>v.y&&s.y>v.y)return!1;const T=Fe(l,s,u[0]);return T!==Fe(l,s,u[1])||T!==Fe(l,s,u[2])||T!==Fe(l,s,u[3])}function Ac(l,s,u){const g=s.paint.get(l).value;return g.kind==="constant"?g.value:u.programConfigurations.get(s.id).getMaxValue(l)}function uf(l){return Math.sqrt(l[0]*l[0]+l[1]*l[1])}function Fh(l,s,u,g,v){if(!s[0]&&!s[1])return l;const T=N.convert(s)._mult(v);u==="viewport"&&T._rotate(-g);const S=[];for(let C=0;C<l.length;C++)S.push(l[C].sub(T));return S}let Vp,$p;lt("CircleBucket",cf,{omit:["layers"]});var Pg={get paint(){return $p=$p||new w({"circle-radius":new Zt(_e.paint_circle["circle-radius"]),"circle-color":new Zt(_e.paint_circle["circle-color"]),"circle-blur":new Zt(_e.paint_circle["circle-blur"]),"circle-opacity":new Zt(_e.paint_circle["circle-opacity"]),"circle-translate":new Nt(_e.paint_circle["circle-translate"]),"circle-translate-anchor":new Nt(_e.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Nt(_e.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Nt(_e.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Zt(_e.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Zt(_e.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Zt(_e.paint_circle["circle-stroke-opacity"])})},get layout(){return Vp=Vp||new w({"circle-sort-key":new Zt(_e.layout_circle["circle-sort-key"])})}},Yr=1e-6,Ll=typeof Float32Array<"u"?Float32Array:Array;function hf(l){return l[0]=1,l[1]=0,l[2]=0,l[3]=0,l[4]=0,l[5]=1,l[6]=0,l[7]=0,l[8]=0,l[9]=0,l[10]=1,l[11]=0,l[12]=0,l[13]=0,l[14]=0,l[15]=1,l}function Hp(l,s,u){var g=s[0],v=s[1],T=s[2],S=s[3],C=s[4],P=s[5],k=s[6],z=s[7],U=s[8],W=s[9],Z=s[10],K=s[11],J=s[12],ce=s[13],fe=s[14],Be=s[15],Ae=u[0],De=u[1],Xe=u[2],ct=u[3];return l[0]=Ae*g+De*C+Xe*U+ct*J,l[1]=Ae*v+De*P+Xe*W+ct*ce,l[2]=Ae*T+De*k+Xe*Z+ct*fe,l[3]=Ae*S+De*z+Xe*K+ct*Be,l[4]=(Ae=u[4])*g+(De=u[5])*C+(Xe=u[6])*U+(ct=u[7])*J,l[5]=Ae*v+De*P+Xe*W+ct*ce,l[6]=Ae*T+De*k+Xe*Z+ct*fe,l[7]=Ae*S+De*z+Xe*K+ct*Be,l[8]=(Ae=u[8])*g+(De=u[9])*C+(Xe=u[10])*U+(ct=u[11])*J,l[9]=Ae*v+De*P+Xe*W+ct*ce,l[10]=Ae*T+De*k+Xe*Z+ct*fe,l[11]=Ae*S+De*z+Xe*K+ct*Be,l[12]=(Ae=u[12])*g+(De=u[13])*C+(Xe=u[14])*U+(ct=u[15])*J,l[13]=Ae*v+De*P+Xe*W+ct*ce,l[14]=Ae*T+De*k+Xe*Z+ct*fe,l[15]=Ae*S+De*z+Xe*K+ct*Be,l}Math.hypot||(Math.hypot=function(){for(var l=0,s=arguments.length;s--;)l+=arguments[s]*arguments[s];return Math.sqrt(l)});var Ec,Ig=Hp;function Uh(l,s,u){var g=s[0],v=s[1],T=s[2],S=s[3];return l[0]=u[0]*g+u[4]*v+u[8]*T+u[12]*S,l[1]=u[1]*g+u[5]*v+u[9]*T+u[13]*S,l[2]=u[2]*g+u[6]*v+u[10]*T+u[14]*S,l[3]=u[3]*g+u[7]*v+u[11]*T+u[15]*S,l}Ec=new Ll(4),Ll!=Float32Array&&(Ec[0]=0,Ec[1]=0,Ec[2]=0,Ec[3]=0);class vv extends f{constructor(s){super(s,Pg)}createBucket(s){return new cf(s)}queryRadius(s){const u=s;return Ac("circle-radius",this,u)+Ac("circle-stroke-width",this,u)+uf(this.paint.get("circle-translate"))}queryIntersectsFeature(s,u,g,v,T,S,C,P){const k=Fh(s,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),S.angle,C),z=this.paint.get("circle-radius").evaluate(u,g)+this.paint.get("circle-stroke-width").evaluate(u,g),U=this.paint.get("circle-pitch-alignment")==="map",W=U?k:(function(K,J){return K.map((ce=>df(ce,J)))})(k,P),Z=U?z*C:z;for(const K of v)for(const J of K){const ce=U?J:df(J,P);let fe=Z;const Be=Uh([],[J.x,J.y,0,1],P);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?fe*=Be[3]/S.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(fe*=S.cameraToCenterDistance/Be[3]),Eg(W,ce,fe))return!0}return!1}}function df(l,s){const u=Uh([],[l.x,l.y,0,1],s);return new N(u[0]/u[3],u[1]/u[3])}class Wp extends cf{}let Xp;lt("HeatmapBucket",Wp,{omit:["layers"]});var qp={get paint(){return Xp=Xp||new w({"heatmap-radius":new Zt(_e.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Zt(_e.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Nt(_e.paint_heatmap["heatmap-intensity"]),"heatmap-color":new kh(_e.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Nt(_e.paint_heatmap["heatmap-opacity"])})}};function ff(l,{width:s,height:u},g,v){if(v){if(v instanceof Uint8ClampedArray)v=new Uint8Array(v.buffer);else if(v.length!==s*u*g)throw new RangeError(`mismatched image size. expected: ${v.length} but got: ${s*u*g}`)}else v=new Uint8Array(s*u*g);return l.width=s,l.height=u,l.data=v,l}function Zp(l,{width:s,height:u},g){if(s===l.width&&u===l.height)return;const v=ff({},{width:s,height:u},g);Yp(l,v,{x:0,y:0},{x:0,y:0},{width:Math.min(l.width,s),height:Math.min(l.height,u)},g),l.width=s,l.height=u,l.data=v.data}function Yp(l,s,u,g,v,T){if(v.width===0||v.height===0)return s;if(v.width>l.width||v.height>l.height||u.x>l.width-v.width||u.y>l.height-v.height)throw new RangeError("out of range source coordinates for image copy");if(v.width>s.width||v.height>s.height||g.x>s.width-v.width||g.y>s.height-v.height)throw new RangeError("out of range destination coordinates for image copy");const S=l.data,C=s.data;if(S===C)throw new Error("srcData equals dstData, so image is already copied");for(let P=0;P<v.height;P++){const k=((u.y+P)*l.width+u.x)*T,z=((g.y+P)*s.width+g.x)*T;for(let U=0;U<v.width*T;U++)C[z+U]=S[k+U]}return s}class jh{constructor(s,u){ff(this,s,1,u)}resize(s){Zp(this,s,1)}clone(){return new jh({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(s,u,g,v,T){Yp(s,u,g,v,T,1)}}class Bs{constructor(s,u){ff(this,s,4,u)}resize(s){Zp(this,s,4)}replace(s,u){u?this.data.set(s):this.data=s instanceof Uint8ClampedArray?new Uint8Array(s.buffer):s}clone(){return new Bs({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(s,u,g,v,T){Yp(s,u,g,v,T,4)}}function Cu(l){const s={},u=l.resolution||256,g=l.clips?l.clips.length:1,v=l.image||new Bs({width:u,height:g});
vendor: 5,707 bytes, line 53
53if(Math.log(u)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${u}`);const T=(S,C,P)=>{s[l.evaluationKey]=P;const k=l.expression.evaluate(s);v.data[S+C+0]=Math.floor(255*k.r/k.a),v.data[S+C+1]=Math.floor(255*k.g/k.a),v.data[S+C+2]=Math.floor(255*k.b/k.a),v.data[S+C+3]=Math.floor(255*k.a)};if(l.clips)for(let S=0,C=0;S<g;++S,C+=4*u)for(let P=0,k=0;P<u;P++,k+=4){const z=P/(u-1),{start:U,end:W}=l.clips[S];T(C,k,U*(1-z)+W*z)}else for(let S=0,C=0;S<u;S++,C+=4)T(0,C,S/(u-1));return v}lt("AlphaImage",jh),lt("RGBAImage",Bs);const Vh="big-fb";class pf extends f{createBucket(s){return new Wp(s)}constructor(s){super(s,qp),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(s){s==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Cu({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(Vh)&&this.heatmapFbos.delete(Vh)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}}let Gp;var Dg={get paint(){return Gp=Gp||new w({"hillshade-illumination-direction":new Nt(_e.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Nt(_e.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Nt(_e.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Nt(_e.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Nt(_e.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Nt(_e.paint_hillshade["hillshade-accent-color"])})}};class $h extends f{constructor(s){super(s,Dg)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}}const Og=M([{name:"a_pos",components:2,type:"Int16"}],4),{members:Kp}=Og;function Qp(l,s,u=2){const g=s&&s.length,v=g?s[0]*u:l.length;let T=mf(l,0,v,u,!0);const S=[];if(!T||T.next===T.prev)return S;let C,P,k;if(g&&(T=(function(z,U,W,Z){const K=[];for(let J=0,ce=U.length;J<ce;J++){const fe=mf(z,U[J]*Z,J<ce-1?U[J+1]*Z:z.length,Z,!1);fe===fe.next&&(fe.steiner=!0),K.push(Fg(fe))}K.sort(zg);for(let J=0;J<K.length;J++)W=gf(K[J],W);return W})(l,s,T,u)),l.length>80*u){C=1/0,P=1/0;let z=-1/0,U=-1/0;for(let W=u;W<v;W+=u){const Z=l[W],K=l[W+1];Z<C&&(C=Z),K<P&&(P=K),Z>z&&(z=Z),K>U&&(U=K)}k=Math.max(z-C,U-P),k=k!==0?32767/k:0}return Ru(T,S,u,C,P,k,0),S}function mf(l,s,u,g,v){let T;if(v===(function(S,C,P,k){let z=0;for(let U=C,W=P-k;U<P;U+=k)z+=(S[W]-S[U])*(S[U+1]+S[W+1]),W=U;return z})(l,s,u,g)>0)for(let S=s;S<u;S+=g)T=Pu(S/g|0,l[S],l[S+1],T);else for(let S=u-g;S>=s;S-=g)T=Pu(S/g|0,l[S],l[S+1],T);return T&&Qn(T,T.next)&&(Iu(T),T=T.next),T}function Yo(l,s){if(!l)return l;s||(s=l);let u,g=l;do if(u=!1,g.steiner||!Qn(g,g.next)&&Ln(g.prev,g,g.next)!==0)g=g.next;else{if(Iu(g),g=s=g.prev,g===g.next)break;u=!0}while(u||g!==s);return s}function Ru(l,s,u,g,v,T,S){if(!l)return;!S&&T&&(function(P,k,z,U){let W=P;do W.z===0&&(W.z=Hh(W.x,W.y,k,z,U)),W.prevZ=W.prev,W.nextZ=W.next,W=W.next;while(W!==P);W.prevZ.nextZ=null,W.prevZ=null,(function(Z){let K,J=1;do{let ce,fe=Z;Z=null;let Be=null;for(K=0;fe;){K++;let Ae=fe,De=0;for(let ct=0;ct<J&&(De++,Ae=Ae.nextZ,Ae);ct++);let Xe=J;for(;De>0||Xe>0&&Ae;)De!==0&&(Xe===0||!Ae||fe.z<=Ae.z)?(ce=fe,fe=fe.nextZ,De--):(ce=Ae,Ae=Ae.nextZ,Xe--),Be?Be.nextZ=ce:Z=ce,ce.prevZ=Be,Be=ce;fe=Ae}Be.nextZ=null,J*=2}while(K>1)})(W)})(l,g,v,T);let C=l;for(;l.prev!==l.next;){const P=l.prev,k=l.next;if(T?Cc(l,g,v,T):kg(l))s.push(P.i,l.i,k.i),Iu(l),l=k.next,C=k.next;else if((l=k)===C){S?S===1?Ru(l=Bg(Yo(l),s),s,u,g,v,T,2):S===2&&Ng(l,s,u,g,v,T):Ru(Yo(l),s,u,g,v,T,1);break}}}function kg(l){const s=l.prev,u=l,g=l.next;if(Ln(s,u,g)>=0)return!1;const v=s.x,T=u.x,S=g.x,C=s.y,P=u.y,k=g.y,z=v<T?v<S?v:S:T<S?T:S,U=C<P?C<k?C:k:P<k?P:k,W=v>T?v>S?v:S:T>S?T:S,Z=C>P?C>k?C:k:P>k?P:k;let K=g.next;for(;K!==s;){if(K.x>=z&&K.x<=W&&K.y>=U&&K.y<=Z&&Rc(v,C,T,P,S,k,K.x,K.y)&&Ln(K.prev,K,K.next)>=0)return!1;K=K.next}return!0}function Cc(l,s,u,g){const v=l.prev,T=l,S=l.next;if(Ln(v,T,S)>=0)return!1;const C=v.x,P=T.x,k=S.x,z=v.y,U=T.y,W=S.y,Z=C<P?C<k?C:k:P<k?P:k,K=z<U?z<W?z:W:U<W?U:W,J=C>P?C>k?C:k:P>k?P:k,ce=z>U?z>W?z:W:U>W?U:W,fe=Hh(Z,K,s,u,g),Be=Hh(J,ce,s,u,g);let Ae=l.prevZ,De=l.nextZ;for(;Ae&&Ae.z>=fe&&De&&De.z<=Be;){if(Ae.x>=Z&&Ae.x<=J&&Ae.y>=K&&Ae.y<=ce&&Ae!==v&&Ae!==S&&Rc(C,z,P,U,k,W,Ae.x,Ae.y)&&Ln(Ae.prev,Ae,Ae.next)>=0||(Ae=Ae.prevZ,De.x>=Z&&De.x<=J&&De.y>=K&&De.y<=ce&&De!==v&&De!==S&&Rc(C,z,P,U,k,W,De.x,De.y)&&Ln(De.prev,De,De.next)>=0))return!1;De=De.nextZ}for(;Ae&&Ae.z>=fe;){if(Ae.x>=Z&&Ae.x<=J&&Ae.y>=K&&Ae.y<=ce&&Ae!==v&&Ae!==S&&Rc(C,z,P,U,k,W,Ae.x,Ae.y)&&Ln(Ae.prev,Ae,Ae.next)>=0)return!1;Ae=Ae.prevZ}for(;De&&De.z<=Be;){if(De.x>=Z&&De.x<=J&&De.y>=K&&De.y<=ce&&De!==v&&De!==S&&Rc(C,z,P,U,k,W,De.x,De.y)&&Ln(De.prev,De,De.next)>=0)return!1;De=De.nextZ}return!0}function Bg(l,s){let u=l;do{const g=u.prev,v=u.next.next;!Qn(g,v)&&Ur(g,u,u.next,v)&&Mu(g,v)&&Mu(v,g)&&(s.push(g.i,u.i,v.i),Iu(u),Iu(u.next),u=l=v),u=u.next}while(u!==l);return Yo(u)}function Ng(l,s,u,g,v,T){let S=l;do{let C=S.next.next;for(;C!==S.prev;){if(S.i!==C.i&&bv(S,C)){let P=Jp(S,C);return S=Yo(S,S.next),P=Yo(P,P.next),Ru(S,s,u,g,v,T,0),void Ru(P,s,u,g,v,T,0)}C=C.next}S=S.next}while(S!==l)}function zg(l,s){return l.x-s.x}function gf(l,s){const u=(function(v,T){let S=T;const C=v.x,P=v.y;let k,z=-1/0;do{if(P<=S.y&&P>=S.next.y&&S.next.y!==S.y){const J=S.x+(P-S.y)*(S.next.x-S.x)/(S.next.y-S.y);if(J<=C&&J>z&&(z=J,k=S.x<S.next.x?S:S.next,J===C))return k}S=S.next}while(S!==T);if(!k)return null;const U=k,W=k.x,Z=k.y;let K=1/0;S=k;
vendor: 6,600 bytes, line 53
53do{if(C>=S.x&&S.x>=W&&C!==S.x&&Rc(P<Z?C:z,P,W,Z,P<Z?z:C,P,S.x,S.y)){const J=Math.abs(P-S.y)/(C-S.x);Mu(S,v)&&(J<K||J===K&&(S.x>k.x||S.x===k.x&&Lg(k,S)))&&(k=S,K=J)}S=S.next}while(S!==U);return k})(l,s);if(!u)return s;const g=Jp(u,l);return Yo(g,g.next),Yo(u,u.next)}function Lg(l,s){return Ln(l.prev,l,s.prev)<0&&Ln(s.next,l,l.next)<0}function Hh(l,s,u,g,v){return(l=1431655765&((l=858993459&((l=252645135&((l=16711935&((l=(l-u)*v|0)|l<<8))|l<<4))|l<<2))|l<<1))|(s=1431655765&((s=858993459&((s=252645135&((s=16711935&((s=(s-g)*v|0)|s<<8))|s<<4))|s<<2))|s<<1))<<1}function Fg(l){let s=l,u=l;do(s.x<u.x||s.x===u.x&&s.y<u.y)&&(u=s),s=s.next;while(s!==l);return u}function Rc(l,s,u,g,v,T,S,C){return(v-S)*(s-C)>=(l-S)*(T-C)&&(l-S)*(g-C)>=(u-S)*(s-C)&&(u-S)*(T-C)>=(v-S)*(g-C)}function bv(l,s){return l.next.i!==s.i&&l.prev.i!==s.i&&!(function(u,g){let v=u;do{if(v.i!==u.i&&v.next.i!==u.i&&v.i!==g.i&&v.next.i!==g.i&&Ur(v,v.next,u,g))return!0;v=v.next}while(v!==u);return!1})(l,s)&&(Mu(l,s)&&Mu(s,l)&&(function(u,g){let v=u,T=!1;const S=(u.x+g.x)/2,C=(u.y+g.y)/2;do v.y>C!=v.next.y>C&&v.next.y!==v.y&&S<(v.next.x-v.x)*(C-v.y)/(v.next.y-v.y)+v.x&&(T=!T),v=v.next;while(v!==u);return T})(l,s)&&(Ln(l.prev,l,s.prev)||Ln(l,s.prev,s))||Qn(l,s)&&Ln(l.prev,l,l.next)>0&&Ln(s.prev,s,s.next)>0)}function Ln(l,s,u){return(s.y-l.y)*(u.x-s.x)-(s.x-l.x)*(u.y-s.y)}function Qn(l,s){return l.x===s.x&&l.y===s.y}function Ur(l,s,u,g){const v=Xh(Ln(l,s,u)),T=Xh(Ln(l,s,g)),S=Xh(Ln(u,g,l)),C=Xh(Ln(u,g,s));return v!==T&&S!==C||!(v!==0||!Wh(l,u,s))||!(T!==0||!Wh(l,g,s))||!(S!==0||!Wh(u,l,g))||!(C!==0||!Wh(u,s,g))}function Wh(l,s,u){return s.x<=Math.max(l.x,u.x)&&s.x>=Math.min(l.x,u.x)&&s.y<=Math.max(l.y,u.y)&&s.y>=Math.min(l.y,u.y)}function Xh(l){return l>0?1:l<0?-1:0}function Mu(l,s){return Ln(l.prev,l,l.next)<0?Ln(l,s,l.next)>=0&&Ln(l,l.prev,s)>=0:Ln(l,s,l.prev)<0||Ln(l,l.next,s)<0}function Jp(l,s){const u=Du(l.i,l.x,l.y),g=Du(s.i,s.x,s.y),v=l.next,T=s.prev;return l.next=s,s.prev=l,u.next=v,v.prev=u,g.next=u,u.prev=g,T.next=g,g.prev=T,g}function Pu(l,s,u,g){const v=Du(l,s,u);return g?(v.next=g.next,v.prev=g,g.next.prev=v,g.next=v):(v.prev=v,v.next=v),v}function Iu(l){l.next.prev=l.prev,l.prev.next=l.next,l.prevZ&&(l.prevZ.nextZ=l.nextZ),l.nextZ&&(l.nextZ.prevZ=l.prevZ)}function Du(l,s,u){return{i:l,x:s,y:u,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function _f(l,s,u){const g=u.patternDependencies;let v=!1;for(const T of s){const S=T.paint.get(`${l}-pattern`);S.isConstant()||(v=!0);const C=S.constantOr(null);C&&(v=!0,g[C.to]=!0,g[C.from]=!0)}return v}function em(l,s,u,g,v){const T=v.patternDependencies;for(const S of s){const C=S.paint.get(`${l}-pattern`).value;if(C.kind!=="constant"){let P=C.evaluate({zoom:g-1},u,{},v.availableImages),k=C.evaluate({zoom:g},u,{},v.availableImages),z=C.evaluate({zoom:g+1},u,{},v.availableImages);P=P&&P.name?P.name:P,k=k&&k.name?k.name:k,z=z&&z.name?z.name:z,T[P]=!0,T[k]=!0,T[z]=!0,u.patterns[S.id]={min:P,mid:k,max:z}}}return u}class Ou{constructor(s){this.zoom=s.zoom,this.overscaling=s.overscaling,this.layers=s.layers,this.layerIds=this.layers.map((u=>u.id)),this.index=s.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Os,this.indexArray=new os,this.indexArray2=new qn,this.programConfigurations=new kl(s.layers,s.zoom),this.segments=new wi,this.segments2=new wi,this.stateDependentLayerIds=this.layers.filter((u=>u.isStateDependent())).map((u=>u.id))}populate(s,u,g){this.hasPattern=_f("fill",this.layers,u);const v=this.layers[0].layout.get("fill-sort-key"),T=!v.isConstant(),S=[];for(const{feature:C,id:P,index:k,sourceLayerIndex:z}of s){const U=this.layers[0]._featureFilter.needGeometry,W=Nl(C,U);if(!this.layers[0]._featureFilter.filter(new xi(this.zoom),W,g))continue;const Z=T?v.evaluate(W,{},g,u.availableImages):void 0,K={id:P,properties:C.properties,type:C.type,sourceLayerIndex:z,index:k,geometry:U?W.geometry:Bl(C),patterns:{},sortKey:Z};S.push(K)}T&&S.sort(((C,P)=>C.sortKey-P.sortKey));for(const C of S){const{geometry:P,index:k,sourceLayerIndex:z}=C;if(this.hasPattern){const U=em("fill",this.layers,C,this.zoom,u);this.patternFeatures.push(U)}else this.addFeature(C,P,k,g,{});u.featureIndex.insert(s[k].feature,P,k,z,this.index)}}update(s,u,g){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(s,u,this.stateDependentLayers,g)}addFeatures(s,u,g){for(const v of this.patternFeatures)this.addFeature(v,v.geometry,v.index,u,g)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(s){this.uploaded||(this.layoutVertexBuffer=s.createVertexBuffer(this.layoutVertexArray,Kp),this.indexBuffer=s.createIndexBuffer(this.indexArray),this.indexBuffer2=s.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(s),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(s,u,g,v,T){for(const S of nu(u,500)){let C=0;for(const Z of S)C+=Z.length;const P=this.segments.prepareSegment(C,this.layoutVertexArray,this.indexArray),k=P.vertexLength,z=[],U=[];for(const Z of S){if(Z.length===0)continue;Z!==S[0]&&U.push(z.length/2);const K=this.segments2.prepareSegment(Z.length,this.layoutVertexArray,this.indexArray2),J=K.vertexLength;this.layoutVertexArray.emplaceBack(Z[0].x,Z[0].y),this.indexArray2.emplaceBack(J+Z.length-1,J),z.push(Z[0].x),z.push(Z[0].y);for(let ce=1;ce<Z.length;ce++)this.layoutVertexArray.emplaceBack(Z[ce].x,Z[ce].y),this.indexArray2.emplaceBack(J+ce-1,J+ce),z.push(Z[ce].x),z.push(Z[ce].y);K.vertexLength+=Z.length,K.primitiveLength+=Z.length}const W=Qp(z,U);for(let Z=0;Z<W.length;Z+=3)this.indexArray.emplaceBack(k+W[Z],k+W[Z+1],k+W[Z+2]);P.vertexLength+=C,P.primitiveLength+=W.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,s,g,T,v)}}let yf,tm;lt("FillBucket",Ou,{omit:["layers","patternFeatures"]});var Ug={get paint(){return tm=tm||new w({"fill-antialias":new Nt(_e.paint_fill["fill-antialias"]),"fill-opacity":new Zt(_e.paint_fill["fill-opacity"]),"fill-color":new Zt(_e.paint_fill["fill-color"]),"fill-outline-color":new Zt(_e.paint_fill["fill-outline-color"]),"fill-translate":new Nt(_e.paint_fill["fill-translate"]),"fill-translate-anchor":new Nt(_e.paint_fill["fill-translate-anchor"]),"fill-pattern":new Na(_e.paint_fill["fill-pattern"])})},get layout(){return yf=yf||new w({"fill-sort-key":new Zt(_e.layout_fill["fill-sort-key"])})}};
53class jg extends f{constructor(s){super(s,Ug)}recalculate(s,u){super.recalculate(s,u);const g=this.paint._values["fill-outline-color"];g.value.kind==="constant"&&g.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(s){return new Ou(s)}queryRadius(){return uf(this.paint.get("fill-translate"))}queryIntersectsFeature(s,u,g,v,T,S,C){return Fp(Fh(s,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),S.angle,C),v)}isTileClipped(){return!0}}const im=M([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),nm=M([{name:"a_centroid",components:2,type:"Int16"}],4),{members:rm}=im;var Go={},sm=R,qh=Fl;function Fl(l,s,u,g,v){this.properties={},this.extent=u,this.type=0,this._pbf=l,this._geometry=-1,this._keys=g,this._values=v,l.readFields(Vg,this,s)}function Vg(l,s,u){l==1?s.id=u.readVarint():l==2?(function(g,v){for(var T=g.readVarint()+g.pos;g.pos<T;){var S=v._keys[g.readVarint()],C=v._values[g.readVarint()];v.properties[S]=C}})(u,s):l==3?s.type=u.readVarint():l==4&&(s._geometry=u.pos)}function am(l){for(var s,u,g=0,v=0,T=l.length,S=T-1;v<T;S=v++)g+=((u=l[S]).x-(s=l[v]).x)*(s.y+u.y);return g}Fl.types=["Unknown","Point","LineString","Polygon"],Fl.prototype.loadGeometry=function(){var l=this._pbf;l.pos=this._geometry;for(var s,u=l.readVarint()+l.pos,g=1,v=0,T=0,S=0,C=[];l.pos<u;){if(v<=0){var P=l.readVarint();g=7&P,v=P>>3}if(v--,g===1||g===2)T+=l.readSVarint(),S+=l.readSVarint(),g===1&&(s&&C.push(s),s=[]),s.push(new sm(T,S));else{if(g!==7)throw new Error("unknown command "+g);s&&s.push(s[0].clone())}}return s&&C.push(s),C},Fl.prototype.bbox=function(){var l=this._pbf;l.pos=this._geometry;for(var s=l.readVarint()+l.pos,u=1,g=0,v=0,T=0,S=1/0,C=-1/0,P=1/0,k=-1/0;l.pos<s;){if(g<=0){var z=l.readVarint();u=7&z,g=z>>3}if(g--,u===1||u===2)(v+=l.readSVarint())<S&&(S=v),v>C&&(C=v),(T+=l.readSVarint())<P&&(P=T),T>k&&(k=T);else if(u!==7)throw new Error("unknown command "+u)}return[S,P,C,k]},Fl.prototype.toGeoJSON=function(l,s,u){var g,v,T=this.extent*Math.pow(2,u),S=this.extent*l,C=this.extent*s,P=this.loadGeometry(),k=Fl.types[this.type];function z(Z){for(var K=0;K<Z.length;K++){var J=Z[K];Z[K]=[360*(J.x+S)/T-180,360/Math.PI*Math.atan(Math.exp((180-360*(J.y+C)/T)*Math.PI/180))-90]}}switch(this.type){case 1:var U=[];for(g=0;g<P.length;g++)U[g]=P[g][0];z(P=U);break;case 2:for(g=0;g<P.length;g++)z(P[g]);break;case 3:for(P=(function(Z){var K=Z.length;if(K<=1)return[Z];for(var J,ce,fe=[],Be=0;Be<K;Be++){var Ae=am(Z[Be]);Ae!==0&&(ce===void 0&&(ce=Ae<0),ce===Ae<0?(J&&fe.push(J),J=[Z[Be]]):J.push(Z[Be]))}return J&&fe.push(J),fe})(P),g=0;g<P.length;g++)for(v=0;v<P[g].length;v++)z(P[g][v])}P.length===1?P=P[0]:k="Multi"+k;var W={type:"Feature",geometry:{type:k,coordinates:P},properties:this.properties};return"id"in this&&(W.id=this.id),W};var $g=qh,so=vf;function vf(l,s){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=l,this._keys=[],this._values=[],this._features=[],l.readFields(xv,this,s),this.length=this._features.length}function xv(l,s,u){l===15?s.version=u.readVarint():l===1?s.name=u.readString():l===5?s.extent=u.readVarint():l===2?s._features.push(u.pos):l===3?s._keys.push(u.readString()):l===4&&s._values.push((function(g){for(var v=null,T=g.readVarint()+g.pos;g.pos<T;){var S=g.readVarint()>>3;v=S===1?g.readString():S===2?g.readFloat():S===3?g.readDouble():S===4?g.readVarint64():S===5?g.readVarint():S===6?g.readSVarint():S===7?g.readBoolean():null}return v})(u))}vf.prototype.feature=function(l){if(l<0||l>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[l];var s=this._pbf.readVarint()+this._pbf.pos;return new $g(this._pbf,s,this.extent,this._keys,this._values)};var Hg=so;function Ko(l,s,u){if(l===3){var g=new Hg(u,u.readVarint()+u.pos);g.length&&(s[g.name]=g)}}Go.VectorTile=function(l,s){this.layers=l.readFields(Ko,{},s)},Go.VectorTileFeature=qh,Go.VectorTileLayer=so;const om=Go.VectorTileFeature.types,bf=Math.pow(2,13);function Ul(l,s,u,g,v,T,S,C){l.emplaceBack(s,u,2*Math.floor(g*bf)+S,v*bf*2,T*bf*2,Math.round(C))}class Mc{constructor(s){this.zoom=s.zoom,this.overscaling=s.overscaling,this.layers=s.layers,this.layerIds=this.layers.map((u=>u.id)),this.index=s.index,this.hasPattern=!1,this.layoutVertexArray=new $o,this.centroidVertexArray=new mn,this.indexArray=new os,this.programConfigurations=new kl(s.layers,s.zoom),this.segments=new wi,this.stateDependentLayerIds=this.layers.filter((u=>u.isStateDependent())).map((u=>u.id))}populate(s,u,g){this.features=[],this.hasPattern=_f("fill-extrusion",this.layers,u);for(const{feature:v,id:T,index:S,sourceLayerIndex:C}of s){const P=this.layers[0]._featureFilter.needGeometry,k=Nl(v,P);if(!this.layers[0]._featureFilter.filter(new xi(this.zoom),k,g))continue;const z={id:T,sourceLayerIndex:C,index:S,geometry:P?k.geometry:Bl(v),properties:v.properties,type:v.type,patterns:{}};this.hasPattern?this.features.push(em("fill-extrusion",this.layers,z,this.zoom,u)):this.addFeature(z,z.geometry,S,g,{}),u.featureIndex.insert(v,z.geometry,S,C,this.index,!0)}}addFeatures(s,u,g){for(const v of this.features){const{geometry:T}=v;this.addFeature(v,T,v.index,u,g)}}update(s,u,g){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(s,u,this.stateDependentLayers,g)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(s){this.uploaded||(this.layoutVertexBuffer=s.createVertexBuffer(this.layoutVertexArray,rm),this.centroidVertexBuffer=s.createVertexBuffer(this.centroidVertexArray,nm.members,!0),this.indexBuffer=s.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(s),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(s,u,g,v,T){for(const S of nu(u,500)){const C={x:0,y:0,vertexCount:0};let P=0;for(const K of S)P+=K.length;let k=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const K of S){if(K.length===0||wv(K))continue;let J=0;for(let ce=0;ce<K.length;ce++){const fe=K[ce];if(ce>
vendor: 4,133 bytes, line 53
53=1){const Be=K[ce-1];if(!Fn(fe,Be)){k.vertexLength+4>wi.MAX_VERTEX_ARRAY_LENGTH&&(k=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const Ae=fe.sub(Be)._perp()._unit(),De=Be.dist(fe);J+De>32768&&(J=0),Ul(this.layoutVertexArray,fe.x,fe.y,Ae.x,Ae.y,0,0,J),Ul(this.layoutVertexArray,fe.x,fe.y,Ae.x,Ae.y,0,1,J),C.x+=2*fe.x,C.y+=2*fe.y,C.vertexCount+=2,J+=De,Ul(this.layoutVertexArray,Be.x,Be.y,Ae.x,Ae.y,0,0,J),Ul(this.layoutVertexArray,Be.x,Be.y,Ae.x,Ae.y,0,1,J),C.x+=2*Be.x,C.y+=2*Be.y,C.vertexCount+=2;const Xe=k.vertexLength;this.indexArray.emplaceBack(Xe,Xe+2,Xe+1),this.indexArray.emplaceBack(Xe+1,Xe+2,Xe+3),k.vertexLength+=4,k.primitiveLength+=2}}}}if(k.vertexLength+P>wi.MAX_VERTEX_ARRAY_LENGTH&&(k=this.segments.prepareSegment(P,this.layoutVertexArray,this.indexArray)),om[s.type]!=="Polygon")continue;const z=[],U=[],W=k.vertexLength;for(const K of S)if(K.length!==0){K!==S[0]&&U.push(z.length/2);for(let J=0;J<K.length;J++){const ce=K[J];Ul(this.layoutVertexArray,ce.x,ce.y,0,0,1,1,0),C.x+=ce.x,C.y+=ce.y,C.vertexCount+=1,z.push(ce.x),z.push(ce.y)}}const Z=Qp(z,U);for(let K=0;K<Z.length;K+=3)this.indexArray.emplaceBack(W+Z[K],W+Z[K+2],W+Z[K+1]);k.primitiveLength+=Z.length/3,k.vertexLength+=P;for(let K=0;K<C.vertexCount;K++){const J=Math.floor(C.x/C.vertexCount),ce=Math.floor(C.y/C.vertexCount);this.centroidVertexArray.emplaceBack(J,ce)}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,s,g,T,v)}}function Fn(l,s){return l.x===s.x&&(l.x<0||l.x>Kn)||l.y===s.y&&(l.y<0||l.y>Kn)}function wv(l){return l.every((s=>s.x<0))||l.every((s=>s.x>Kn))||l.every((s=>s.y<0))||l.every((s=>s.y>Kn))}let Wg;lt("FillExtrusionBucket",Mc,{omit:["layers","features"]});var Xg={get paint(){return Wg=Wg||new w({"fill-extrusion-opacity":new Nt(_e["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Zt(_e["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Nt(_e["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Nt(_e["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Na(_e["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Zt(_e["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Zt(_e["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Nt(_e["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class Zh extends f{constructor(s){super(s,Xg)}createBucket(s){return new Mc(s)}queryRadius(){return uf(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(s,u,g,v,T,S,C,P){const k=Fh(s,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),S.angle,C),z=this.paint.get("fill-extrusion-height").evaluate(u,g),U=this.paint.get("fill-extrusion-base").evaluate(u,g),W=(function(K,J,ce,fe){const Be=[];for(const Ae of K){const De=[Ae.x,Ae.y,0,1];Uh(De,De,J),Be.push(new N(De[0]/De[3],De[1]/De[3]))}return Be})(k,P),Z=(function(K,J,ce,fe){const Be=[],Ae=[],De=fe[8]*J,Xe=fe[9]*J,ct=fe[10]*J,Rt=fe[11]*J,Yt=fe[8]*ce,_t=fe[9]*ce,St=fe[10]*ce,Lt=fe[11]*ce;for(const Bt of K){const It=[],Ye=[];for(const kt of Bt){const zt=kt.x,ri=kt.y,zi=fe[0]*zt+fe[4]*ri+fe[12],tn=fe[1]*zt+fe[5]*ri+fe[13],xr=fe[2]*zt+fe[6]*ri+fe[14],Kr=fe[3]*zt+fe[7]*ri+fe[15],Mr=xr+ct,wr=Kr+Rt,us=zi+Yt,hs=tn+_t,ds=xr+St,Yn=Kr+Lt,Tr=new N((zi+De)/wr,(tn+Xe)/wr);Tr.z=Mr/wr,It.push(Tr);const Qr=new N(us/Yn,hs/Yn);Qr.z=ds/Yn,Ye.push(Qr)}Be.push(It),Ae.push(Ye)}return[Be,Ae]})(v,U,z,P);return(function(K,J,ce){let fe=1/0;Fp(ce,J)&&(fe=lm(ce,J[0]));for(let Be=0;Be<J.length;Be++){const Ae=J[Be],De=K[Be];for(let Xe=0;Xe<Ae.length-1;Xe++){const ct=Ae[Xe],Rt=[ct,Ae[Xe+1],De[Xe+1],De[Xe],ct];Lp(ce,Rt)&&(fe=Math.min(fe,lm(ce,Rt)))}}return fe!==1/0&&fe})(Z[0],Z[1],W)}}function ba(l,s){return l.x*s.x+l.y*s.y}function lm(l,s){if(l.length===1){let u=0;const g=s[u++];let v;for(;!v||g.equals(v);)if(v=s[u++],!v)return 1/0;for(;u<s.length;u++){const T=s[u],S=l[0],C=v.sub(g),P=T.sub(g),k=S.sub(g),z=ba(C,C),U=ba(C,P),W=ba(P,P),Z=ba(k,C
vendor: 9,633 bytes, line 53
53),K=ba(k,P),J=z*W-U*U,ce=(W*Z-U*K)/J,fe=(z*K-U*Z)/J,Be=g.z*(1-ce-fe)+v.z*ce+T.z*fe;if(isFinite(Be))return Be}return 1/0}{let u=1/0;for(const g of s)u=Math.min(u,g.z);return u}}const qg=M([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:Yh}=qg,ao=M([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Zg}=ao,cm=Go.VectorTileFeature.types,Yg=Math.cos(Math.PI/180*37.5),xf=Math.pow(2,14)/.5;class Gh{constructor(s){this.zoom=s.zoom,this.overscaling=s.overscaling,this.layers=s.layers,this.layerIds=this.layers.map((u=>u.id)),this.index=s.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((u=>{this.gradients[u.id]={}})),this.layoutVertexArray=new Qs,this.layoutVertexArray2=new gr,this.indexArray=new os,this.programConfigurations=new kl(s.layers,s.zoom),this.segments=new wi,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((u=>u.isStateDependent())).map((u=>u.id))}populate(s,u,g){this.hasPattern=_f("line",this.layers,u);const v=this.layers[0].layout.get("line-sort-key"),T=!v.isConstant(),S=[];for(const{feature:C,id:P,index:k,sourceLayerIndex:z}of s){const U=this.layers[0]._featureFilter.needGeometry,W=Nl(C,U);if(!this.layers[0]._featureFilter.filter(new xi(this.zoom),W,g))continue;const Z=T?v.evaluate(W,{},g):void 0,K={id:P,properties:C.properties,type:C.type,sourceLayerIndex:z,index:k,geometry:U?W.geometry:Bl(C),patterns:{},sortKey:Z};S.push(K)}T&&S.sort(((C,P)=>C.sortKey-P.sortKey));for(const C of S){const{geometry:P,index:k,sourceLayerIndex:z}=C;if(this.hasPattern){const U=em("line",this.layers,C,this.zoom,u);this.patternFeatures.push(U)}else this.addFeature(C,P,k,g,{});u.featureIndex.insert(s[k].feature,P,k,z,this.index)}}update(s,u,g){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(s,u,this.stateDependentLayers,g)}addFeatures(s,u,g){for(const v of this.patternFeatures)this.addFeature(v,v.geometry,v.index,u,g)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(s){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=s.createVertexBuffer(this.layoutVertexArray2,Zg)),this.layoutVertexBuffer=s.createVertexBuffer(this.layoutVertexArray,Yh),this.indexBuffer=s.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(s),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(s){if(s.properties&&Object.prototype.hasOwnProperty.call(s.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(s.properties,"mapbox_clip_end"))return{start:+s.properties.mapbox_clip_start,end:+s.properties.mapbox_clip_end}}addFeature(s,u,g,v,T){const S=this.layers[0].layout,C=S.get("line-join").evaluate(s,{}),P=S.get("line-cap"),k=S.get("line-miter-limit"),z=S.get("line-round-limit");this.lineClips=this.lineFeatureClips(s);for(const U of u)this.addLine(U,s,C,P,k,z);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,s,g,T,v)}addLine(s,u,g,v,T,S){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let fe=0;fe<s.length-1;fe++)this.totalDistance+=s[fe].dist(s[fe+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const C=cm[u.type]==="Polygon";let P=s.length;for(;P>=2&&s[P-1].equals(s[P-2]);)P--;let k=0;for(;k<P-1&&s[k].equals(s[k+1]);)k++;if(P<(C?3:2))return;g==="bevel"&&(T=1.05);const z=this.overscaling<=16?15*Kn/(512*this.overscaling):0,U=this.segments.prepareSegment(10*P,this.layoutVertexArray,this.indexArray);let W,Z,K,J,ce;this.e1=this.e2=-1,C&&(W=s[P-2],ce=s[k].sub(W)._unit()._perp());for(let fe=k;fe<P;fe++){if(K=fe===P-1?C?s[k+1]:void 0:s[fe+1],K&&s[fe].equals(K))continue;ce&&(J=ce),W&&(Z=W),W=s[fe],ce=K?K.sub(W)._unit()._perp():J,J=J||ce;let Be=J.add(ce);Be.x===0&&Be.y===0||Be._unit();const Ae=J.x*ce.x+J.y*ce.y,De=Be.x*ce.x+Be.y*ce.y,Xe=De!==0?1/De:1/0,ct=2*Math.sqrt(2-2*De),Rt=De<Yg&&Z&&K,Yt=J.x*ce.y-J.y*ce.x>0;if(Rt&&fe>k){const Lt=W.dist(Z);if(Lt>2*z){const Bt=W.sub(W.sub(Z)._mult(z/Lt)._round());this.updateDistance(Z,Bt),this.addCurrentVertex(Bt,J,0,0,U),Z=Bt}}const _t=Z&&K;let St=_t?g:C?"butt":v;if(_t&&St==="round"&&(Xe<S?St="miter":Xe<=2&&(St="fakeround")),St==="miter"&&Xe>T&&(St="bevel"),St==="bevel"&&(Xe>2&&(St="flipbevel"),Xe<T&&(St="miter")),Z&&this.updateDistance(Z,W),St==="miter")Be._mult(Xe),this.addCurrentVertex(W,Be,0,0,U);else if(St==="flipbevel"){if(Xe>100)Be=ce.mult(-1);else{const Lt=Xe*J.add(ce).mag()/J.sub(ce).mag();Be._perp()._mult(Lt*(Yt?-1:1))}this.addCurrentVertex(W,Be,0,0,U),this.addCurrentVertex(W,Be.mult(-1),0,0,U)}else if(St==="bevel"||St==="fakeround"){const Lt=-Math.sqrt(Xe*Xe-1),Bt=Yt?Lt:0,It=Yt?0:Lt;if(Z&&this.addCurrentVertex(W,J,Bt,It,U),St==="fakeround"){const Ye=Math.round(180*ct/Math.PI/20);for(let kt=1;kt<Ye;kt++){let zt=kt/Ye;if(zt!==.5){const zi=zt-.5;zt+=zt*zi*(zt-1)*((1.0904+Ae*(Ae*(3.55645-1.43519*Ae)-3.2452))*zi*zi+(.848013+Ae*(.215638*Ae-1.06021)))}const ri=ce.sub(J)._mult(zt)._add(J)._unit()._mult(Yt?-1:1);this.addHalfVertex(W,ri.x,ri.y,!1,Yt,0,U)}}K&&this.addCurrentVertex(W,ce,-Bt,-It,U)}else if(St==="butt")this.addCurrentVertex(W,Be,0,0,U);else if(St==="square"){const Lt=Z?1:-1;this.addCurrentVertex(W,Be,Lt,Lt,U)}else St==="round"&&(Z&&(this.addCurrentVertex(W,J,0,0,U),this.addCurrentVertex(W,J,1,1,U,!0)),K&&(this.addCurrentVertex(W,ce,-1,-1,U,!0),this.addCurrentVertex(W,ce,0,0,U)));if(Rt&&fe<P-1){const Lt=W.dist(K);if(Lt>2*z){const Bt=W.add(K.sub(W)._mult(z/Lt)._round());this.updateDistance(W,Bt),this.addCurrentVertex(Bt,ce,0,0,U),W=Bt}}}}addCurrentVertex(s,u,g,v,T,S=!1){const C=u.y*v-u.x,P=-u.y-u.x*v;this.addHalfVertex(s,u.x+u.y*g,u.y-u.x*g,S,!1,g,T),this.addHalfVertex(s,C,P,S,!0,-v,T),this.distance>xf/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(s,u,g,v,T,S))}addHalfVertex({x:s,y:u},g,v,T,S,C,P){const k=.5*(this.lineClips?this.scaledDistance*(xf-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((s<<1)+(T?1:0),(u<<1)+(S?1:0),Math.round(63*g)+128,Math.round(63*v)+128,1+(C===0?0:C<0?-1:1)|(63&k)<<2,k>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const z=P.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,z),P.primitiveLength++),S?this.e2=z:this.e1=z}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(s,u){this.distance+=s.dist(u),this.updateScaledDistance()}}let Kh,um;lt("LineBucket",Gh,{omit:["layers","patternFeatures"]});var oo={get paint(){return um=um||new w({"line-opacity":new Zt(_e.paint_line["line-opacity"]),"line-color":new Zt(_e.paint_line["line-color"]),"line-translate":new Nt(_e.paint_line["line-translate"]),"line-translate-anchor":new Nt(_e.paint_line["line-translate-anchor"]),"line-width":new Zt(_e.paint_line["line-width"]),"line-gap-width":new Zt(_e.paint_line["line-gap-width"]),"line-offset":new Zt(_e.paint_line["line-offset"]),"line-blur":new Zt(_e.paint_line["line-blur"]),"line-dasharray":new za(_e.paint_line["line-dasharray"]),"line-pattern":new Na(_e.paint_line["line-pattern"]),"line-gradient":new kh(_e.paint_line["line-gradient"])})},get layout(){return Kh=Kh||new w({"line-cap":new Nt(_e.layout_line["line-cap"]),"line-join":new Zt(_e.layout_line["line-join"]),"line-miter-limit":new Nt(_e.layout_line["line-miter-limit"]),"line-round-limit":new Nt(_e.layout_line["line-round-limit"]),"line-sort-key":new Zt(_e.layout_line["line-sort-key"])})}};class yr extends Zt{possiblyEvaluate(s,u){return u=new xi(Math.floor(u.zoom),{now:u.now,fadeDuration:u.fadeDuration,zoomHistory:u.zoomHistory,transition:u.transition}),super.possiblyEvaluate(s,u)}evaluate(s,u,g,v){return u=Ee({},u,{zoom:Math.floor(u.zoom)}),super.evaluate(s,u,g,v)}}let ku;class Gg extends f{constructor(s){super(s,oo),this.gradientVersion=0,ku||(ku=new yr(oo.paint.properties["line-width"].specification),ku.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(s){if(s==="line-gradient"){const u=this.gradientExpression();this.stepInterpolant=!!(function(g){return g._styleExpression!==void 0})(u)&&u._styleExpression.expression instanceof To,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(s,u){super.recalculate(s,u),this.paint._values["line-floorwidth"]=ku.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,s)}createBucket(s){return new Gh(s)}queryRadius(s){const u=s,g=Cr(Ac("line-width",this,u),Ac("line-gap-width",this,u)),v=Ac("line-offset",this,u);return g/2+Math.abs(v)+uf(this.paint.get("line-translate"))}queryIntersectsFeature(s,u,g,v,T,S,C){const P=Fh(s,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),S.angle,C),k=C/2*Cr(this.paint.get("line-width").evaluate(u,g),this.paint.get("line-gap-width").evaluate(u,g)),z=this.paint.get("line-offset").evaluate(u,g);return z&&(v=(function(U,W){const Z=[];for(let K=0;K<U.length;K++){const J=U[K],ce=[];for(let fe=0;fe<J.length;fe++){const Be=J[fe-1],Ae=J[fe],De=J[fe+1],Xe=fe===0?new N(0,0):Ae.sub(
53Be)._unit()._perp(),ct=fe===J.length-1?new N(0,0):De.sub(Ae)._unit()._perp(),Rt=Xe._add(ct)._unit(),Yt=Rt.x*ct.x+Rt.y*ct.y;Yt!==0&&Rt._mult(1/Yt),ce.push(Rt._mult(W)._add(Ae))}Z.push(ce)}return Z})(v,z*C)),(function(U,W,Z){for(let K=0;K<W.length;K++){const J=W[K];if(U.length>=3){for(let ce=0;ce<J.length;ce++)if(Zo(U,J[ce]))return!0}if(Cg(U,J,Z))return!0}return!1})(P,v,k)}isTileClipped(){return!0}}function Cr(l,s){return s>0?s+2*l:l}const Tv=M([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Kg=M([{name:"a_projected_pos",components:3,type:"Float32"}],4);M([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Qg=M([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);M([{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 Un=M([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Ns=M([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Qo(l,s,u){return l.sections.forEach((g=>{g.text=(function(v,T,S){const C=T.layout.get("text-transform").evaluate(S,{});return C==="uppercase"?v=v.toLocaleUpperCase():C==="lowercase"&&(v=v.toLocaleLowerCase()),dr.applyArabicShaping&&(v=dr.applyArabicShaping(v)),v})(g.text,s,u)})),l}M([{name:"triangle",components:3,type:"Uint16"}]),M([{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"}]),M([{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",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),M([{type:"Float32",name:"offsetX"}]),M([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),M([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Bu={"!":"ï¸","#":"ï¼",$:"ï¼","%":"ï¼
","&":"ï¼","(":"︵",")":"︶","*":"ï¼","+":"ï¼",",":"ï¸","-":"︲",".":"ã»","/":"ï¼",":":"ï¸",";":"ï¸","<":"︿","=":"ï¼",">":"ï¹","?":"ï¸","@":"ï¼ ","[":"ï¹","\\":"ï¼¼","]":"ï¹","^":"ï¼¾",_:"︳","`":"ï½","{":"︷","|":"â","}":"︸","~":"ï½","¢":"ï¿ ","£":"ï¿¡","Â¥":"ï¿¥","¦":"¦","¬":"ï¿¢","¯":"ï¿£","â":"︲","â":"︱","â":"ï¹","â":"ï¹","â":"ï¹","â":"ï¹","â¦":"ï¸","â§":"ã»","â©":"₩","ã":"ï¸","ã":"ï¸","ã":"︿","ã":"ï¹","ã":"︽","ã":"︾","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"︻","ã":"︼","ã":"︹","ã":"︺","ã":"ï¸","ã":"ï¸","ï¼":"ï¸","ï¼":"︵","ï¼":"︶","ï¼":"ï¸","ï¼":"︲","ï¼":"ã»","ï¼":"ï¸","ï¼":"ï¸","ï¼":"︿","ï¼":"ï¹","ï¼":"ï¸","ï¼»":"ï¹","ï¼½":"ï¹","_":"︳","ï½":"︷","ï½":"â","ï½":"︸","ï½":"︵","ï½ ":"︶","。":"ï¸","ï½¢":"ï¹","ï½£":"ï¹"};var sr=24,hm=Ti,Jg=function(l,s,u,g,v){var T,S,C=8*v-g-1,P=(1<<C)-1,k=P>>1,z=-7,U=v-1,W=-1,Z=l[s+U];for(U+=W,T=Z&(1<<-z)-1,Z>>=-z,z+=C;z>0;T=256*T+l[s+U],U+=W,z-=8);for(S=T&(1<<-z)-1,T>>=-z,z+=g;z>0;S=256*S+l[s+U],U+=W,z-=8);if(T===0)T=1-k;else{if(T===P)return S?NaN:1/0*(Z?-1:1);S+=Math.pow(2,g),T-=k}
vendor: 4,345 bytes, line 53
53return(Z?-1:1)*S*Math.pow(2,T-g)},Qh=function(l,s,u,g,v,T){var S,C,P,k=8*T-v-1,z=(1<<k)-1,U=z>>1,W=v===23?Math.pow(2,-24)-Math.pow(2,-77):0,Z=0,K=1,J=s<0||s===0&&1/s<0?1:0;for(s=Math.abs(s),isNaN(s)||s===1/0?(C=isNaN(s)?1:0,S=z):(S=Math.floor(Math.log(s)/Math.LN2),s*(P=Math.pow(2,-S))<1&&(S--,P*=2),(s+=S+U>=1?W/P:W*Math.pow(2,1-U))*P>=2&&(S++,P/=2),S+U>=z?(C=0,S=z):S+U>=1?(C=(s*P-1)*Math.pow(2,v),S+=U):(C=s*Math.pow(2,U-1)*Math.pow(2,v),S=0));v>=8;l[u+Z]=255&C,Z+=K,C/=256,v-=8);for(S=S<<v|C,k+=v;k>0;l[u+Z]=255&S,Z+=K,S/=256,k-=8);l[u+Z-K]|=128*J};function Ti(l){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(l)?l:new Uint8Array(l||0),this.pos=0,this.type=0,this.length=this.buf.length}Ti.Varint=0,Ti.Fixed64=1,Ti.Bytes=2,Ti.Fixed32=5;var ea=4294967296,dm=1/ea,ys=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function lo(l){return l.type===Ti.Bytes?l.readVarint()+l.pos:l.pos+1}function zs(l,s,u){return u?4294967296*s+(l>>>0):4294967296*(s>>>0)+(l>>>0)}function jl(l,s,u){var g=s<=16383?1:s<=2097151?2:s<=268435455?3:Math.floor(Math.log(s)/(7*Math.LN2));u.realloc(g);for(var v=u.pos-1;v>=l;v--)u.buf[v+g]=u.buf[v]}function Jo(l,s){for(var u=0;u<l.length;u++)s.writeVarint(l[u])}function fm(l,s){for(var u=0;u<l.length;u++)s.writeSVarint(l[u])}function pm(l,s){for(var u=0;u<l.length;u++)s.writeFloat(l[u])}function Fa(l,s){for(var u=0;u<l.length;u++)s.writeDouble(l[u])}function e_(l,s){for(var u=0;u<l.length;u++)s.writeBoolean(l[u])}function Nu(l,s){for(var u=0;u<l.length;u++)s.writeFixed32(l[u])}function Jh(l,s){for(var u=0;u<l.length;u++)s.writeSFixed32(l[u])}function ed(l,s){for(var u=0;u<l.length;u++)s.writeFixed64(l[u])}function zu(l,s){for(var u=0;u<l.length;u++)s.writeSFixed64(l[u])}function td(l,s){return(l[s]|l[s+1]<<8|l[s+2]<<16)+16777216*l[s+3]}function Pc(l,s,u){l[u]=s,l[u+1]=s>>>8,l[u+2]=s>>>16,l[u+3]=s>>>24}function Lu(l,s){return(l[s]|l[s+1]<<8|l[s+2]<<16)+(l[s+3]<<24)}Ti.prototype={destroy:function(){this.buf=null},readFields:function(l,s,u){for(u=u||this.length;this.pos<u;){var g=this.readVarint(),v=g>>3,T=this.pos;this.type=7&g,l(v,s,this),this.pos===T&&this.skip(g)}return s},readMessage:function(l,s){return this.readFields(l,s,this.readVarint()+this.pos)},readFixed32:function(){var l=td(this.buf,this.pos);return this.pos+=4,l},readSFixed32:function(){var l=Lu(this.buf,this.pos);return this.pos+=4,l},readFixed64:function(){var l=td(this.buf,this.pos)+td(this.buf,this.pos+4)*ea;return this.pos+=8,l},readSFixed64:function(){var l=td(this.buf,this.pos)+Lu(this.buf,this.pos+4)*ea;return this.pos+=8,l},readFloat:function(){var l=Jg(this.buf,this.pos,!0,23,4);return this.pos+=4,l},readDouble:function(){var l=Jg(this.buf,this.pos,!0,52,8);return this.pos+=8,l},readVarint:function(l){var s,u,g=this.buf;return s=127&(u=g[this.pos++]),u<128?s:(s|=(127&(u=g[this.pos++]))<<7,u<128?s:(s|=(127&(u=g[this.pos++]))<<14,u<128?s:(s|=(127&(u=g[this.pos++]))<<21,u<128?s:(function(v,T,S){var C,P,k=S.buf;if(C=(112&(P=k[S.pos++]))>>4,P<128||(C|=(127&(P=k[S.pos++]))<<3,P<128)||(C|=(127&(P=k[S.pos++]))<<10,P<128)||(C|=(127&(P=k[S.pos++]))<<17,P<128)||(C|=(127&(P=k[S.pos++]))<<24,P<128)||(C|=(1&(P=k[S.pos++]))<<31,P<128))return zs(v,C,T);throw new Error("Expected varint not more than 10 bytes")})(s|=(15&(u=g[this.pos]))<<28,l,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var l=this.readVarint();return l%2==1?(l+1)/-2:l/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var l=this.readVarint()+this.pos,s=this.pos;return this.pos=l,l-s>=12&&ys?(function(u,g,v){return ys.decode(u.subarray(g,v))})(this.buf,s,l):(function(u,g,v){for(var T="",S=g;S<v;){var C,P,k,z=u[S],U=null,W=z>239?4:z>223?3:z>191?2:1;if(S+W>v)break;W===1?z<128&&(U=z):W===2?(192&(C=u[S+1]))==128&&(U=(31&z)<<6|63&C)<=127&&(U=null):W===3?(P=u[S+2],(192&(C=u[S+1]))==128&&(192&P)==128&&((U=(15&z)<<12|(63&C)<<6|63&P)<=2047||U>=55296&&U<=57343)&&(U=null)):W===4&&(P=u[S+2],k=u[S+3],(192&(C=u[S+1]))==128&&(192&P)==128&&(192&k)==128&&((U=(15&z)<<18|(63&C)<<12|(63&P)<<6|63&k)<=65535||U>=1114112)&&(U=null)),U===null?(U=65533,W=1):U>65535&&(U-=65536,T+=String.fromCharCode(U>>>10&1023|55296),U=56320|1023&U),T+=String.fromCharCode(U),S+=W}return T})(this.buf,s,l)},readBytes:function(){var l=this.readVarint()+this.pos,s=this.buf.subarray(this.pos,l);return this.pos=l,s}
vendor: 5,635 bytes, line 53
53,readPackedVarint:function(l,s){if(this.type!==Ti.Bytes)return l.push(this.readVarint(s));var u=lo(this);for(l=l||[];this.pos<u;)l.push(this.readVarint(s));return l},readPackedSVarint:function(l){if(this.type!==Ti.Bytes)return l.push(this.readSVarint());var s=lo(this);for(l=l||[];this.pos<s;)l.push(this.readSVarint());return l},readPackedBoolean:function(l){if(this.type!==Ti.Bytes)return l.push(this.readBoolean());var s=lo(this);for(l=l||[];this.pos<s;)l.push(this.readBoolean());return l},readPackedFloat:function(l){if(this.type!==Ti.Bytes)return l.push(this.readFloat());var s=lo(this);for(l=l||[];this.pos<s;)l.push(this.readFloat());return l},readPackedDouble:function(l){if(this.type!==Ti.Bytes)return l.push(this.readDouble());var s=lo(this);for(l=l||[];this.pos<s;)l.push(this.readDouble());return l},readPackedFixed32:function(l){if(this.type!==Ti.Bytes)return l.push(this.readFixed32());var s=lo(this);for(l=l||[];this.pos<s;)l.push(this.readFixed32());return l},readPackedSFixed32:function(l){if(this.type!==Ti.Bytes)return l.push(this.readSFixed32());var s=lo(this);for(l=l||[];this.pos<s;)l.push(this.readSFixed32());return l},readPackedFixed64:function(l){if(this.type!==Ti.Bytes)return l.push(this.readFixed64());var s=lo(this);for(l=l||[];this.pos<s;)l.push(this.readFixed64());return l},readPackedSFixed64:function(l){if(this.type!==Ti.Bytes)return l.push(this.readSFixed64());var s=lo(this);for(l=l||[];this.pos<s;)l.push(this.readSFixed64());return l},skip:function(l){var s=7&l;if(s===Ti.Varint)for(;this.buf[this.pos++]>127;);else if(s===Ti.Bytes)this.pos=this.readVarint()+this.pos;else if(s===Ti.Fixed32)this.pos+=4;else{if(s!==Ti.Fixed64)throw new Error("Unimplemented type: "+s);this.pos+=8}},writeTag:function(l,s){this.writeVarint(l<<3|s)},realloc:function(l){for(var s=this.length||16;s<this.pos+l;)s*=2;if(s!==this.length){var u=new Uint8Array(s);u.set(this.buf),this.buf=u,this.length=s}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(l){this.realloc(4),Pc(this.buf,l,this.pos),this.pos+=4},writeSFixed32:function(l){this.realloc(4),Pc(this.buf,l,this.pos),this.pos+=4},writeFixed64:function(l){this.realloc(8),Pc(this.buf,-1&l,this.pos),Pc(this.buf,Math.floor(l*dm),this.pos+4),this.pos+=8},writeSFixed64:function(l){this.realloc(8),Pc(this.buf,-1&l,this.pos),Pc(this.buf,Math.floor(l*dm),this.pos+4),this.pos+=8},writeVarint:function(l){(l=+l||0)>268435455||l<0?(function(s,u){var g,v;if(s>=0?(g=s%4294967296|0,v=s/4294967296|0):(v=~(-s/4294967296),4294967295^(g=~(-s%4294967296))?g=g+1|0:(g=0,v=v+1|0)),s>=18446744073709552e3||s<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");u.realloc(10),(function(T,S,C){C.buf[C.pos++]=127&T|128,T>>>=7,C.buf[C.pos++]=127&T|128,T>>>=7,C.buf[C.pos++]=127&T|128,T>>>=7,C.buf[C.pos++]=127&T|128,C.buf[C.pos]=127&(T>>>=7)})(g,0,u),(function(T,S){var C=(7&T)<<4;S.buf[S.pos++]|=C|((T>>>=3)?128:0),T&&(S.buf[S.pos++]=127&T|((T>>>=7)?128:0),T&&(S.buf[S.pos++]=127&T|((T>>>=7)?128:0),T&&(S.buf[S.pos++]=127&T|((T>>>=7)?128:0),T&&(S.buf[S.pos++]=127&T|((T>>>=7)?128:0),T&&(S.buf[S.pos++]=127&T)))))})(v,u)})(l,this):(this.realloc(4),this.buf[this.pos++]=127&l|(l>127?128:0),l<=127||(this.buf[this.pos++]=127&(l>>>=7)|(l>127?128:0),l<=127||(this.buf[this.pos++]=127&(l>>>=7)|(l>127?128:0),l<=127||(this.buf[this.pos++]=l>>>7&127))))},writeSVarint:function(l){this.writeVarint(l<0?2*-l-1:2*l)},writeBoolean:function(l){this.writeVarint(!!l)},writeString:function(l){l=String(l),this.realloc(4*l.length),this.pos++;var s=this.pos;this.pos=(function(g,v,T){for(var S,C,P=0;P<v.length;P++){if((S=v.charCodeAt(P))>55295&&S<57344){if(!C){S>56319||P+1===v.length?(g[T++]=239,g[T++]=191,g[T++]=189):C=S;continue}if(S<56320){g[T++]=239,g[T++]=191,g[T++]=189,C=S;continue}S=C-55296<<10|S-56320|65536,C=null}else C&&(g[T++]=239,g[T++]=191,g[T++]=189,C=null);S<128?g[T++]=S:(S<2048?g[T++]=S>>6|192:(S<65536?g[T++]=S>>12|224:(g[T++]=S>>18|240,g[T++]=S>>12&63|128),g[T++]=S>>6&63|128),g[T++]=63&S|128)}return T})(this.buf,l,this.pos);var u=this.pos-s;u>=128&&jl(s,u,this),this.pos=s-1,this.writeVarint(u),this.pos+=u},writeFloat:function(l){this.realloc(4),Qh(this.buf,l,this.pos,!0,23,4),this.pos+=4},writeDouble:function(l){this.realloc(8),Qh(this.buf,l,this.pos,!0,52,8),this.pos+=8},writeBytes:function(l){var s=l.length;this.writeVarint(s),this.realloc(s);for(var u=0;u<s;u++)this.buf[this.pos++]=l[u]},writeRawMessage:function(l,s){this.pos++;var u=this.pos;l(s,this);var g=this.pos-u;g>=128&&jl(u,g,this),this.pos=u-1,this.writeVarint(g),this.pos+=g},writeMessage:function(l,s,u){this.writeTag(l,Ti.Bytes),this.writeRawMessage(s,u)},writePackedVarint:function(l,s){s.length&&this.writeMessage(l,Jo,s)},writePackedSVarint:function(l,s){s.length&&this.writeMessage(l,fm,s)},writePackedBoolean:function(l,s){s.length&&this.writeMessage(l,e_,s)},writePackedFloat:function(l,s){s.length&&this.writeMessage(l,pm,s)},writePackedDouble:function(l,s){s.length&&this.writeMessage(l,Fa,s)},writePackedFixed32:function(l,s){s.length&&this.writeMessage(l,Nu,s)},writePackedSFixed32:function(l,s){s.length&&this.writeMessage(l,Jh,s)},writePackedFixed64:function(l,s){s.length&&this.writeMessage(l,ed,s)},writePackedSFixed64:function(l,s){s.length&&this.writeMessage(l,zu,s)},writeBytesField:function(l,s){this.writeTag(l,Ti.Bytes),this.writeBytes(s)},writeFixed32Field:function(l,s){this.writeTag(l,Ti.Fixed32),this.writeFixed32(s)},writeSFixed32Field:function(l,s){this.writeTag(l,Ti.Fixed32),this.writeSFixed32(s)},writeFixed64Field:function(l,s){this.writeTag(l,Ti.Fixed64),this.writeFixed64
vendor: 11,128 bytes, line 53
53(s)},writeSFixed64Field:function(l,s){this.writeTag(l,Ti.Fixed64),this.writeSFixed64(s)},writeVarintField:function(l,s){this.writeTag(l,Ti.Varint),this.writeVarint(s)},writeSVarintField:function(l,s){this.writeTag(l,Ti.Varint),this.writeSVarint(s)},writeStringField:function(l,s){this.writeTag(l,Ti.Bytes),this.writeString(s)},writeFloatField:function(l,s){this.writeTag(l,Ti.Fixed32),this.writeFloat(s)},writeDoubleField:function(l,s){this.writeTag(l,Ti.Fixed64),this.writeDouble(s)},writeBooleanField:function(l,s){this.writeVarintField(l,!!s)}};var wf=A(hm);const Fu=3;function t_(l,s,u){l===1&&u.readMessage(Sv,s)}function Sv(l,s,u){if(l===3){const{id:g,bitmap:v,width:T,height:S,left:C,top:P,advance:k}=u.readMessage(Av,{});s.push({id:g,bitmap:new jh({width:T+2*Fu,height:S+2*Fu},v),metrics:{width:T,height:S,left:C,top:P,advance:k}})}}function Av(l,s,u){l===1?s.id=u.readVarint():l===2?s.bitmap=u.readBytes():l===3?s.width=u.readVarint():l===4?s.height=u.readVarint():l===5?s.left=u.readSVarint():l===6?s.top=u.readSVarint():l===7&&(s.advance=u.readVarint())}const Qi=Fu;function Sn(l){let s=0,u=0;for(const S of l)s+=S.w*S.h,u=Math.max(u,S.w);l.sort(((S,C)=>C.h-S.h));const g=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(s/.95)),u),h:1/0}];let v=0,T=0;for(const S of l)for(let C=g.length-1;C>=0;C--){const P=g[C];if(!(S.w>P.w||S.h>P.h)){if(S.x=P.x,S.y=P.y,T=Math.max(T,S.y+S.h),v=Math.max(v,S.x+S.w),S.w===P.w&&S.h===P.h){const k=g.pop();C<g.length&&(g[C]=k)}else S.h===P.h?(P.x+=S.w,P.w-=S.w):S.w===P.w?(P.y+=S.h,P.h-=S.h):(g.push({x:P.x+S.w,y:P.y,w:P.w-S.w,h:S.h}),P.y+=S.h,P.h-=S.h);break}}return{w:v,h:T,fill:s/(v*T)||0}}const ci=1;class Ni{constructor(s,{pixelRatio:u,version:g,stretchX:v,stretchY:T,content:S,textFitWidth:C,textFitHeight:P}){this.paddedRect=s,this.pixelRatio=u,this.stretchX=v,this.stretchY=T,this.content=S,this.version=g,this.textFitWidth=C,this.textFitHeight=P}get tl(){return[this.paddedRect.x+ci,this.paddedRect.y+ci]}get br(){return[this.paddedRect.x+this.paddedRect.w-ci,this.paddedRect.y+this.paddedRect.h-ci]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2*ci)/this.pixelRatio,(this.paddedRect.h-2*ci)/this.pixelRatio]}}class on{constructor(s,u){const g={},v={};this.haveRenderCallbacks=[];const T=[];this.addImages(s,g,T),this.addImages(u,v,T);const{w:S,h:C}=Sn(T),P=new Bs({width:S||1,height:C||1});for(const k in s){const z=s[k],U=g[k].paddedRect;Bs.copy(z.data,P,{x:0,y:0},{x:U.x+ci,y:U.y+ci},z.data)}for(const k in u){const z=u[k],U=v[k].paddedRect,W=U.x+ci,Z=U.y+ci,K=z.data.width,J=z.data.height;Bs.copy(z.data,P,{x:0,y:0},{x:W,y:Z},z.data),Bs.copy(z.data,P,{x:0,y:J-1},{x:W,y:Z-1},{width:K,height:1}),Bs.copy(z.data,P,{x:0,y:0},{x:W,y:Z+J},{width:K,height:1}),Bs.copy(z.data,P,{x:K-1,y:0},{x:W-1,y:Z},{width:1,height:J}),Bs.copy(z.data,P,{x:0,y:0},{x:W+K,y:Z},{width:1,height:J})}this.image=P,this.iconPositions=g,this.patternPositions=v}addImages(s,u,g){for(const v in s){const T=s[v],S={x:0,y:0,w:T.data.width+2*ci,h:T.data.height+2*ci};g.push(S),u[v]=new Ni(S,T),T.hasRenderCallback&&this.haveRenderCallbacks.push(v)}}patchUpdatedImages(s,u){s.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const g in s.updatedImages)this.patchUpdatedImage(this.iconPositions[g],s.getImage(g),u),this.patchUpdatedImage(this.patternPositions[g],s.getImage(g),u)}patchUpdatedImage(s,u,g){if(!s||!u||s.version===u.version)return;s.version=u.version;const[v,T]=s.tl;g.update(u.data,void 0,{x:v,y:T})}}var vr;lt("ImagePosition",Ni),lt("ImageAtlas",on),p.ah=void 0,(vr=p.ah||(p.ah={}))[vr.none=0]="none",vr[vr.horizontal=1]="horizontal",vr[vr.vertical=2]="vertical",vr[vr.horizontalOnly=3]="horizontalOnly";const xa=-17;class co{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(s,u){const g=new co;return g.scale=s||1,g.fontStack=u,g}static forImage(s){const u=new co;return u.imageName=s,u}}class Vl{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(s,u){const g=new Vl;for(let v=0;v<s.sections.length;v++){const T=s.sections[v];T.image?g.addImageSection(T):g.addTextSection(T,u)}return g}length(){return this.text.length}getSection(s){return this.sections[this.sectionIndex[s]]}getSectionIndex(s){return this.sectionIndex[s]}getCharCode(s){return this.text.charCodeAt(s)}verticalizePunctuation(){this.text=(function(s){let u="";for(let g=0;g<s.length;g++){const v=s.charCodeAt(g+1)||null,T=s.charCodeAt(g-1)||null;u+=v&&ya(v)&&!Bu[s[g+1]]||T&&ya(T)&&!Bu[s[g-1]]||!Bu[s[g]]?s[g]:Bu[s[g]]}return u})(this.text)}trim(){let s=0;for(let g=0;g<this.text.length&&jn[this.text.charCodeAt(g)];g++)s++;let u=this.text.length;for(let g=this.text.length-1;g>=0&&g>=s&&jn[this.text.charCodeAt(g)];g--)u--;this.text=this.text.substring(s,u),this.sectionIndex=this.sectionIndex.slice(s,u)}substring(s,u){const g=new Vl;return g.text=this.text.substring(s,u),g.sectionIndex=this.sectionIndex.slice(s,u),g.sections=this.sections,g}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((s,u)=>Math.max(s,this.sections[u].scale)),0)}addTextSection(s,u){this.text+=s.text,this.sections.push(co.forText(s.scale,s.fontStack||u));const g=this.sections.length-1;for(let v=0;v<s.text.length;++v)this.sectionIndex.push(g)}addImageSection(s){const u=s.image?s.image.name:"";if(u.length===0)return void At("Can't add FormattedSection with an empty image.");const g=this.getNextImageSectionCharCode();g?(this.text+=String.fromCharCode(g),this.sections.push(co.forImage(u)),this.sectionIndex.push(this.sections.length-1)):At("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function wa(l,s,u,g,v,T,S,C,P,k,z,U,W,Z,K){const J=Vl.fromFeature(l,v);let ce;U===p.ah.vertical&&J.verticalizePunctuation();const{processBidirectionalText:fe,processStyledBidirectionalText:Be}=dr;if(fe&&J.sections.length===1){ce=[];const Xe=fe(J.toString(),id(J,k,T,s,g,Z));for(const ct of Xe){const Rt=new Vl;Rt.text=ct,Rt.sections=J.sections;for(let Yt=0;Yt<ct.length;Yt++)Rt.sectionIndex.push(0);ce.push(Rt)}}else if(Be){ce=[];const Xe=Be(J.text,J.sectionIndex,id(J,k,T,s,g,Z));for(const ct of Xe){const Rt=new Vl;Rt.text=ct[0],Rt.sectionIndex=ct[1],Rt.sections=J.sections,ce.push(Rt)}}else ce=(function(Xe,ct){const Rt=[],Yt=Xe.text;let _t=0;for(const St of ct)Rt.push(Xe.substring(_t,St)),_t=St;return _t<Yt.length&&Rt.push(Xe.substring(_t,Yt.length)),Rt})(J,id(J,k,T,s,g,Z));const Ae=[],De={positionedLines:Ae,text:J.toString(),top:z[1],bottom:z[1],left:z[0],right:z[0],writingMode:U,iconsInText:!1,verticalizable:!1};return(function(Xe,ct,Rt,Yt,_t,St,Lt,Bt,It,Ye,kt,zt){let ri=0,zi=xa,tn=0,xr=0;const Kr=Bt==="right"?1:Bt==="left"?0:.5;let Mr=0;for(const Yn of _t){Yn.trim();const Tr=Yn.getMaxScale(),Qr=(Tr-1)*sr,Pr={positionedGlyphs:[],lineOffset:0};Xe.positionedLines[Mr]=Pr;const pr=Pr.positionedGlyphs;let ar=0;if(!Yn.length()){zi+=St,++Mr;continue}for(let bs=0;bs<Yn.length();bs++){const Pi=Yn.getSection(bs),Yi=Yn.getSectionIndex(bs),yn=Yn.getCharCode(bs);let Jr=0,An=null,Yl=null,na=null,ja=sr;const ra=!(It===p.ah.horizontal||!kt&&!_a(yn)||kt&&(jn[yn]||(wr=yn,new RegExp("\\p{sc=Arab}","u").test(String.fromCodePoint(wr)))));if(Pi.imageName){const sa=Yt[Pi.imageName];if(!sa)continue;na=Pi.imageName,Xe.iconsInText=Xe.iconsInText||!0,Yl=sa.paddedRect;const Sr=sa.displaySize;Pi.scale=Pi.scale*sr/zt,An={width:Sr[0],height:Sr[1],left:ci,top:-Qi,advance:ra?Sr[1]:Sr[0]},Jr=Qr+(sr-Sr[1]*Pi.scale),ja=An.advance;const tl=ra?Sr[0]*Pi.scale-sr*Tr:Sr[1]*Pi.scale-sr*Tr;tl>0&&tl>ar&&(ar=tl)}else{const sa=Rt[Pi.fontStack],Sr=sa&&sa[yn];if(Sr&&Sr.rect)Yl=Sr.rect,An=Sr.metrics;else{const tl=ct[Pi.fontStack],zc=tl&&tl[yn];if(!zc)continue;An=zc.metrics}Jr=(Tr-Pi.scale)*sr}ra?(Xe.verticalizable=!0,pr.push({glyph:yn,imageName:na,x:ri,y:zi+Jr,vertical:ra,scale:Pi.scale,fontStack:Pi.fontStack,sectionIndex:Yi,metrics:An,rect:Yl}),ri+=ja*Pi.scale+Ye):(pr.push({glyph:yn,imageName:na,x:ri,y:zi+Jr,vertical:ra,scale:Pi.scale,fontStack:Pi.fontStack,sectionIndex:Yi,metrics:An,rect:Yl}),ri+=An.advance*Pi.scale+Ye)}pr.length!==0&&(tn=Math.max(ri-Ye,tn),i_(pr,0,pr.length-1,Kr,ar)),ri=0;const Fs=St*Tr+ar;Pr.lineOffset=Math.max(ar,Qr),zi+=Fs,xr=Math.max(Fs,xr),++Mr}var wr;const us=zi-xa,{horizontalAlign:hs,verticalAlign:ds}=Vu(Lt);(function(Yn,Tr,Qr,Pr,pr,ar,Fs,bs,Pi){const Yi=(Tr-Qr)*pr;let yn=0;yn=ar!==Fs?-bs*Pr-xa:(-Pr*Pi+.5)*Fs;for(const Jr of Yn)for(const An of Jr.positionedGlyphs)An.x+=Yi,An.y+=yn})(Xe.positionedLines,Kr,hs,ds,tn,xr,St,us,_t.length),Xe.top+=-ds*us,Xe.bottom=Xe.top+us,Xe.left+=-hs*tn,Xe.right=Xe.left+tn})(De,s,u,g,ce,S,C,P,U,k,W,K),!(function(Xe){for(const ct of Xe)if(ct.positionedGlyphs.length!==0)return!1;return!0})(Ae)&&De}const jn={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},$l={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},Ic={40:!0};function Tf(l,s,u,g,v,T){if(s.imageName){const S=g[s.imageName];return S?S.displaySize[0]*s.scale*sr/T+v:0}{const S=u[s.fontStack],C=S&&S[l];return C?C.metrics.advance*s.scale+v:0}}function Ls(l,s,u,g){const v=Math.pow(l-s,2);return g?l<s?v/2:2*v:v+Math.abs(u)*u}function Uu(l,s,u){let g=0;return l===10&&(g-=1e4),u&&(g+=150),l!==40&&l!==65288||(g+=50),s!==41&&s!==65289||(g+=50),g}function ju(l,s,u,g,v,T){let S=null,C=Ls(s,u,v,T);for(const P of g){const k=Ls(s-P.x,u,v,T)+P.badness;k<=C&&(S=P,C=k)}return{index:l,x:s,priorBreak:S,badness:C}}function vs(l){return l?vs(l.priorBreak).concat(l.index):[]}function id(l,s,u,g,v,T){if(!l)return[];const S=[],C=(function(U,W,Z,K,J,ce){let fe=0;for(let Be=0;Be<U.length();Be++){const Ae=U.getSection(Be);fe+=Tf(U.getCharCode(Be),Ae,K,J,W,ce)}return fe/Math.max(1,Math.ceil(fe/Z))})(l,s,u,g,v,T),P=l.text.indexOf("â")>=0;let k=0;for(let U=0;U<l.length();U++){const W=l.getSection(U),Z=l.getCharCode(U);if(jn[Z]||(k+=Tf(Z,W,g,v,s,T)),U<l.length()-1){const K=!((z=Z)<11904)&&(!!_i["CJK Compatibility Forms"](z)||!!_i["CJK Compatibility"](z)||!!_i["CJK Strokes"](z)||!!_i["CJK Symbols and Punctuation"](z)||!!_i["Enclosed CJK Letters and Months"](z)||!!_i["Halfwidth and Fullwidth Forms"](z)||!!_i["Ideographic Description Characters"](z)||!!_i["Vertical Forms"](z)||ga.test(String.fromCodePoint(z)));($l[Z]||K||W.imageName||U!==l.length()-2&&Ic[l.getCharCode(U+1)])&&S.push(ju(U+1,k,C,S,Uu(Z,l.getCharCode(U+1),K&&P),!1))}}var z;return vs(ju(l.length(),k,C,S,0,!0))}function Vu(l){let s=.5,u=.5;switch(l){case"right":case"top-right":case"bottom-right":s=1;break;case"left":case"top-left":case"bottom-left":s=0}switch(l){case"bottom":case"bottom-right":case"bottom-left":u=1;break;case"top":case"top-right":case"top-left":u=0}return{horizontalAlign:s,verticalAlign:u}}function i_(l,s,u,g,v){if(!g&&!v)return;const T=l[u],S=(l[u].x+T.metrics.advance*T.scale)*g;for(let C=s;C<=u;C++)l[C].x-=S,l[C].y+=v}function Sf(l,s,u){const{horizontalAlign:g,verticalAlign:v}=Vu(u),T=s[0]-l.displaySize[0]*g,S=s[1]-l.displaySize[1]*v;return{image:l,top:S,bottom:S+l.displaySize[1],left:T,right:T+l.displaySize[0]}}
vendor: 10,490 bytes, line 53
53function nd(l){var s,u;let g=l.left,v=l.top,T=l.right-g,S=l.bottom-v;const C=(s=l.image.textFitWidth)!==null&&s!==void 0?s:"stretchOrShrink",P=(u=l.image.textFitHeight)!==null&&u!==void 0?u:"stretchOrShrink",k=(l.image.content[2]-l.image.content[0])/(l.image.content[3]-l.image.content[1]);if(P==="proportional"){if(C==="stretchOnly"&&T/S<k||C==="proportional"){const z=Math.ceil(S*k);g*=z/T,T=z}}else if(C==="proportional"&&P==="stretchOnly"&&k!==0&&T/S>k){const z=Math.ceil(T/k);v*=z/S,S=z}return{x1:g,y1:v,x2:g+T,y2:v+S}}function el(l,s,u,g,v,T){const S=l.image;let C;if(S.content){const ce=S.content,fe=S.pixelRatio||1;C=[ce[0]/fe,ce[1]/fe,S.displaySize[0]-ce[2]/fe,S.displaySize[1]-ce[3]/fe]}const P=s.left*T,k=s.right*T;let z,U,W,Z;u==="width"||u==="both"?(Z=v[0]+P-g[3],U=v[0]+k+g[1]):(Z=v[0]+(P+k-S.displaySize[0])/2,U=Z+S.displaySize[0]);const K=s.top*T,J=s.bottom*T;return u==="height"||u==="both"?(z=v[1]+K-g[0],W=v[1]+J+g[2]):(z=v[1]+(K+J-S.displaySize[1])/2,W=z+S.displaySize[1]),{image:S,top:z,right:U,bottom:W,left:Z,collisionPadding:C}}const Jn=255,Gr=128,ta=Jn*Gr;function uo(l,s){const{expression:u}=s;if(u.kind==="constant")return{kind:"constant",layoutSize:u.evaluate(new xi(l+1))};if(u.kind==="source")return{kind:"source"};{const{zoomStops:g,interpolationType:v}=u;let T=0;for(;T<g.length&&g[T]<=l;)T++;T=Math.max(0,T-1);let S=T;for(;S<g.length&&g[S]<l+1;)S++;S=Math.min(g.length-1,S);const C=g[T],P=g[S];return u.kind==="composite"?{kind:"composite",minZoom:C,maxZoom:P,interpolationType:v}:{kind:"camera",minZoom:C,maxZoom:P,minSize:u.evaluate(new xi(C)),maxSize:u.evaluate(new xi(P)),interpolationType:v}}}function rd(l,s,u){let g="never";const v=l.get(s);return v?g=v:l.get(u)&&(g="always"),g}const mm=Go.VectorTileFeature.types,n_=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Hl(l,s,u,g,v,T,S,C,P,k,z,U,W){const Z=C?Math.min(ta,Math.round(C[0])):0,K=C?Math.min(ta,Math.round(C[1])):0;l.emplaceBack(s,u,Math.round(32*g),Math.round(32*v),T,S,(Z<<1)+(P?1:0),K,16*k,16*z,256*U,256*W)}function sd(l,s,u){l.emplaceBack(s.x,s.y,u),l.emplaceBack(s.x,s.y,u),l.emplaceBack(s.x,s.y,u),l.emplaceBack(s.x,s.y,u)}function ia(l){for(const s of l.sections)if(wu(s.text))return!0;return!1}class Af{constructor(s){this.layoutVertexArray=new Ho,this.indexArray=new os,this.programConfigurations=s,this.segments=new wi,this.dynamicLayoutVertexArray=new Js,this.opacityVertexArray=new oi,this.hasVisibleVertices=!1,this.placedSymbolArray=new Ki}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(s,u,g,v){this.isEmpty()||(g&&(this.layoutVertexBuffer=s.createVertexBuffer(this.layoutVertexArray,Tv.members),this.indexBuffer=s.createIndexBuffer(this.indexArray,u),this.dynamicLayoutVertexBuffer=s.createVertexBuffer(this.dynamicLayoutVertexArray,Kg.members,!0),this.opacityVertexBuffer=s.createVertexBuffer(this.opacityVertexArray,n_,!0),this.opacityVertexBuffer.itemSize=1),(g||v)&&this.programConfigurations.upload(s))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}lt("SymbolBuffers",Af);class ls{constructor(s,u,g){this.layoutVertexArray=new s,this.layoutAttributes=u,this.indexArray=new g,this.segments=new wi,this.collisionVertexArray=new gn}upload(s){this.layoutVertexBuffer=s.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=s.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=s.createVertexBuffer(this.collisionVertexArray,Qg.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}lt("CollisionBuffers",ls);class Dc{constructor(s){this.collisionBoxArray=s.collisionBoxArray,this.zoom=s.zoom,this.overscaling=s.overscaling,this.layers=s.layers,this.layerIds=this.layers.map((S=>S.id)),this.index=s.index,this.pixelRatio=s.pixelRatio,this.sourceLayerIndex=s.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=hf([]),this.placementViewportMatrix=hf([]);const u=this.layers[0]._unevaluatedLayout._values;this.textSizeData=uo(this.zoom,u["text-size"]),this.iconSizeData=uo(this.zoom,u["icon-size"]);const g=this.layers[0].layout,v=g.get("symbol-sort-key"),T=g.get("symbol-z-order");this.canOverlap=rd(g,"text-overlap","text-allow-overlap")!=="never"||rd(g,"icon-overlap","icon-allow-overlap")!=="never"||g.get("text-ignore-placement")||g.get("icon-ignore-placement"),this.sortFeaturesByKey=T!=="viewport-y"&&!v.isConstant(),this.sortFeaturesByY=(T==="viewport-y"||T==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,g.get("symbol-placement")==="point"&&(this.writingModes=g.get("text-writing-mode").map((S=>p.ah[S]))),this.stateDependentLayerIds=this.layers.filter((S=>S.isStateDependent())).map((S=>S.id)),this.sourceID=s.sourceID}createArrays(){this.text=new Af(new kl(this.layers,this.zoom,(s=>/^text/.test(s)))),this.icon=new Af(new kl(this.layers,this.zoom,(s=>/^icon/.test(s)))),this.glyphOffsetArray=new Zi,this.lineVertexArray=new fr,this.symbolInstances=new Si,this.textAnchorOffsets=new an}calculateGlyphDependencies(s,u,g,v,T){for(let S=0;S<s.length;S++)if(u[s.charCodeAt(S)]=!0,(g||v)&&T){const C=Bu[s.charAt(S)];C&&(u[C.charCodeAt(0)]=!0)}}populate(s,u,g){const v=this.layers[0],T=v.layout,S=T.get("text-font"),C=T.get("text-field"),P=T.get("icon-image"),k=(C.value.kind!=="constant"||C.value.value instanceof ts&&!C.value.value.isEmpty()||C.value.value.toString().length>0)&&(S.value.kind!=="constant"||S.value.value.length>0),z=P.value.kind!=="constant"||!!P.value.value||Object.keys(P.parameters).length>0,U=T.get("symbol-sort-key");if(this.features=[],!k&&!z)return;const W=u.iconDependencies,Z=u.glyphDependencies,K=u.availableImages,J=new xi(this.zoom);for(const{feature:ce,id:fe,index:Be,sourceLayerIndex:Ae}of s){const De=v._featureFilter.needGeometry,Xe=Nl(ce,De);if(!v._featureFilter.filter(J,Xe,g))continue;let ct,Rt;if(De||(Xe.geometry=Bl(ce)),k){const _t=v.getValueAndResolveTokens("text-field",Xe,g,K),St=ts.factory(_t),Lt=this.hasRTLText=this.hasRTLText||ia(St);(!Lt||dr.getRTLTextPluginStatus()==="unavailable"||Lt&&dr.isParsed())&&(ct=Qo(St,v,Xe))}if(z){const _t=v.getValueAndResolveTokens("icon-image",Xe,g,K);Rt=_t instanceof is?_t:is.fromString(_t)}if(!ct&&!Rt)continue;const Yt=this.sortFeaturesByKey?U.evaluate(Xe,{},g):void 0;if(this.features.push({id:fe,text:ct,icon:Rt,index:Be,sourceLayerIndex:Ae,geometry:Xe.geometry,properties:ce.properties,type:mm[ce.type],sortKey:Yt}),Rt&&(W[Rt.name]=!0),ct){const _t=S.evaluate(Xe,{},g).join(","),St=T.get("text-rotation-alignment")!=="viewport"&&T.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(p.ah.vertical)>=0;for(const Lt of ct.sections)if(Lt.image)W[Lt.image.name]=!0;else{const Bt=Oa(ct.toString()),It=Lt.fontStack||_t,Ye=Z[It]=Z[It]||{};this.calculateGlyphDependencies(Lt.text,Ye,St,this.allowVerticalPlacement,Bt)}}}T.get("symbol-placement")==="line"&&(this.features=(function(ce){const fe={},Be={},Ae=[];let De=0;function Xe(_t){Ae.push(ce[_t]),De++}function ct(_t,St,Lt){const Bt=Be[_t];return delete Be[_t],Be[St]=Bt,Ae[Bt].geometry[0].pop(),Ae[Bt].geometry[0]=Ae[Bt].geometry[0].concat(Lt[0]),Bt}function Rt(_t,St,Lt){const Bt=fe[St];return delete fe[St],fe[_t]=Bt,Ae[Bt].geometry[0].shift(),Ae[Bt].geometry[0]=Lt[0].concat(Ae[Bt].geometry[0]),Bt}function Yt(_t,St,Lt){const Bt=Lt?St[0][St[0].length-1]:St[0][0];return`${_t}:${Bt.x}:${Bt.y}`}for(let _t=0;_t<ce.length;_t++){const St=ce[_t],Lt=St.geometry,Bt=St.text?St.text.toString():null;if(!Bt){Xe(_t);continue}const It=Yt(Bt,Lt),Ye=Yt(Bt,Lt,!0);if(It in Be&&Ye in fe&&Be[It]!==fe[Ye]){const kt=Rt(It,Ye,Lt),zt=ct(It,Ye,Ae[kt].geometry);delete fe[It],delete Be[Ye],Be[Yt(Bt,Ae[zt].geometry,!0)]=zt,Ae[kt].geometry=null}else It in Be?ct(It,Ye,Lt):Ye in fe?Rt(It,Ye,Lt):(Xe(_t),fe[It]=De-1,Be[Ye]=De-1)}return Ae.filter((_t=>_t.geometry))})(this.features)),this.sortFeaturesByKey&&this.features.sort(((ce,fe)=>ce.sortKey-fe.sortKey))}update(s,u,g){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(s,u,this.layers,g),this.icon.programConfigurations.updatePaintArrays(s,u,this.layers,g))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(s){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(s),this.iconCollisionBox.upload(s)),this.text.upload(s,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(s,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(s,u){const g=this.lineVertexArray.length;if(s.segment!==void 0){let v=s.dist(u[s.segment+1]),T=s.dist(u[s.segment]);const S={};for(let C=s.segment+1;C<u.length;C++)S[C]={x:u[C].x,y:u[C].y,tileUnitDistanceFromAnchor:v},C<u.length-1&&(v+=u[C+1].dist(u[C]));for(let C=s.segment||0;C>=0;C--)S[C]={x:u[C].x,y:u[C].y,tileUnitDistanceFromAnchor:T},C>0&&(T+=u[C-1].dist(u[C]));for(let C=0;C<u.length;C++){const P=S[C];this.lineVertexArray.emplaceBack(P.x,P.y,P.tileUnitDistanceFromAnchor)}}return{lineStartIndex:g,lineLength:this.lineVertexArray.length-g}}addSymbols(s,u,g,v,T,S,C,P,k,z,U,W){const Z=s.indexArray,K=s.layoutVertexArray,J=s.segments.prepareSegment(4*u.length,K,Z,this.canOverlap?S.sortKey:void 0),ce=this.glyphOffsetArray.length,fe=J.vertexLength,Be=this.allowVerticalPlacement&&C===p.ah.vertical?Math.PI/2:0,Ae=S.text&&S.text.sections;for(let De=0;De<u.length;De++){const{tl:Xe,tr:ct,bl:Rt,br:Yt,tex:_t,pixelOffsetTL:St,pixelOffsetBR:Lt,minFontScaleX:Bt,minFontScaleY:It,glyphOffset:Ye,isSDF:kt,sectionIndex:zt}=u[De],ri=J.vertexLength,zi=Ye[1];Hl(K,P.x,P.y,Xe.x,zi+Xe.y,_t.x,_t.y,g,kt,St.x,St.y,Bt,It),Hl(K,P.x,P.y,ct.x,zi+ct.y,_t.x+_t.w,_t.y,g,kt,Lt.x,St.y,Bt,It),Hl(K,P.x,P.y,Rt.x,zi+Rt.y,_t.x,_t.y+_t.h,g,kt,St.x,Lt.y,Bt,It),Hl(K,P.x,P.y,Yt.x,zi+Yt.
vendor: 4,113 bytes, line 53
53y,_t.x+_t.w,_t.y+_t.h,g,kt,Lt.x,Lt.y,Bt,It),sd(s.dynamicLayoutVertexArray,P,Be),Z.emplaceBack(ri,ri+1,ri+2),Z.emplaceBack(ri+1,ri+2,ri+3),J.vertexLength+=4,J.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(Ye[0]),De!==u.length-1&&zt===u[De+1].sectionIndex||s.programConfigurations.populatePaintArrays(K.length,S,S.index,{},W,Ae&&Ae[zt])}s.placedSymbolArray.emplaceBack(P.x,P.y,ce,this.glyphOffsetArray.length-ce,fe,k,z,P.segment,g?g[0]:0,g?g[1]:0,v[0],v[1],C,0,!1,0,U)}_addCollisionDebugVertex(s,u,g,v,T,S){return u.emplaceBack(0,0),s.emplaceBack(g.x,g.y,v,T,Math.round(S.x),Math.round(S.y))}addCollisionDebugVertices(s,u,g,v,T,S,C){const P=T.segments.prepareSegment(4,T.layoutVertexArray,T.indexArray),k=P.vertexLength,z=T.layoutVertexArray,U=T.collisionVertexArray,W=C.anchorX,Z=C.anchorY;this._addCollisionDebugVertex(z,U,S,W,Z,new N(s,u)),this._addCollisionDebugVertex(z,U,S,W,Z,new N(g,u)),this._addCollisionDebugVertex(z,U,S,W,Z,new N(g,v)),this._addCollisionDebugVertex(z,U,S,W,Z,new N(s,v)),P.vertexLength+=4;const K=T.indexArray;K.emplaceBack(k,k+1),K.emplaceBack(k+1,k+2),K.emplaceBack(k+2,k+3),K.emplaceBack(k+3,k),P.primitiveLength+=4}addDebugCollisionBoxes(s,u,g,v){for(let T=s;T<u;T++){const S=this.collisionBoxArray.get(T);this.addCollisionDebugVertices(S.x1,S.y1,S.x2,S.y2,v?this.textCollisionBox:this.iconCollisionBox,S.anchorPoint,g)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new ls(Mi,Un.members,qn),this.iconCollisionBox=new ls(Mi,Un.members,qn);for(let s=0;s<this.symbolInstances.length;s++){const u=this.symbolInstances.get(s);this.addDebugCollisionBoxes(u.textBoxStartIndex,u.textBoxEndIndex,u,!0),this.addDebugCollisionBoxes(u.verticalTextBoxStartIndex,u.verticalTextBoxEndIndex,u,!0),this.addDebugCollisionBoxes(u.iconBoxStartIndex,u.iconBoxEndIndex,u,!1),this.addDebugCollisionBoxes(u.verticalIconBoxStartIndex,u.verticalIconBoxEndIndex,u,!1)}}_deserializeCollisionBoxesForSymbol(s,u,g,v,T,S,C,P,k){const z={};for(let U=u;U<g;U++){const W=s.get(U);z.textBox={x1:W.x1,y1:W.y1,x2:W.x2,y2:W.y2,anchorPointX:W.anchorPointX,anchorPointY:W.anchorPointY},z.textFeatureIndex=W.featureIndex;break}for(let U=v;U<T;U++){const W=s.get(U);z.verticalTextBox={x1:W.x1,y1:W.y1,x2:W.x2,y2:W.y2,anchorPointX:W.anchorPointX,anchorPointY:W.anchorPointY},z.verticalTextFeatureIndex=W.featureIndex;break}for(let U=S;U<C;U++){const W=s.get(U);z.iconBox={x1:W.x1,y1:W.y1,x2:W.x2,y2:W.y2,anchorPointX:W.anchorPointX,anchorPointY:W.anchorPointY},z.iconFeatureIndex=W.featureIndex;break}for(let U=P;U<k;U++){const W=s.get(U);z.verticalIconBox={x1:W.x1,y1:W.y1,x2:W.x2,y2:W.y2,anchorPointX:W.anchorPointX,anchorPointY:W.anchorPointY},z.verticalIconFeatureIndex=W.featureIndex;break}return z}deserializeCollisionBoxes(s){this.collisionArrays=[];for(let u=0;u<this.symbolInstances.length;u++){const g=this.symbolInstances.get(u);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(s,g.textBoxStartIndex,g.textBoxEndIndex,g.verticalTextBoxStartIndex,g.verticalTextBoxEndIndex,g.iconBoxStartIndex,g.iconBoxEndIndex,g.verticalIconBoxStartIndex,g.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(s,u){const g=s.placedSymbolArray.get(u),v=g.vertexStartIndex+4*g.numGlyphs;for(let T=g.vertexStartIndex;T<v;T+=4)s.indexArray.emplaceBack(T,T+1,T+2),s.indexArray.emplaceBack(T+1,T+2,T+3)}getSortedSymbolIndexes(s){if(this.sortedAngle===s&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const u=Math.sin(s),g=Math.cos(s),v=[],T=[],S=[];for(let C=0;C<this.symbolInstances.length;++C){S.push(C);const P=this.symbolInstances.get(C);v.push(0|Math.round(u*P.anchorX+g*P.anchorY)),T.push(P.featureIndex)}return S.sort(((C,P)=>v[C]-v[P]||T[P]-T[C])),S}
vendor: 11,481 bytes, line 53
53addToSortKeyRanges(s,u){const g=this.sortKeyRanges[this.sortKeyRanges.length-1];g&&g.sortKey===u?g.symbolInstanceEnd=s+1:this.sortKeyRanges.push({sortKey:u,symbolInstanceStart:s,symbolInstanceEnd:s+1})}sortFeatures(s){if(this.sortFeaturesByY&&this.sortedAngle!==s&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(s),this.sortedAngle=s,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const u of this.symbolInstanceIndexes){const g=this.symbolInstances.get(u);this.featureSortOrder.push(g.featureIndex),[g.rightJustifiedTextSymbolIndex,g.centerJustifiedTextSymbolIndex,g.leftJustifiedTextSymbolIndex].forEach(((v,T,S)=>{v>=0&&S.indexOf(v)===T&&this.addIndicesForPlacedSymbol(this.text,v)})),g.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,g.verticalPlacedTextSymbolIndex),g.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,g.placedIconSymbolIndex),g.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,g.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let gm,r_;lt("SymbolBucket",Dc,{omit:["layers","collisionBoxArray","features","compareText"]}),Dc.MAX_GLYPHS=65535,Dc.addDynamicAttributes=sd;var ho={get paint(){return r_=r_||new w({"icon-opacity":new Zt(_e.paint_symbol["icon-opacity"]),"icon-color":new Zt(_e.paint_symbol["icon-color"]),"icon-halo-color":new Zt(_e.paint_symbol["icon-halo-color"]),"icon-halo-width":new Zt(_e.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Zt(_e.paint_symbol["icon-halo-blur"]),"icon-translate":new Nt(_e.paint_symbol["icon-translate"]),"icon-translate-anchor":new Nt(_e.paint_symbol["icon-translate-anchor"]),"text-opacity":new Zt(_e.paint_symbol["text-opacity"]),"text-color":new Zt(_e.paint_symbol["text-color"],{runtimeType:xn,getOverride:l=>l.textColor,hasOverride:l=>!!l.textColor}),"text-halo-color":new Zt(_e.paint_symbol["text-halo-color"]),"text-halo-width":new Zt(_e.paint_symbol["text-halo-width"]),"text-halo-blur":new Zt(_e.paint_symbol["text-halo-blur"]),"text-translate":new Nt(_e.paint_symbol["text-translate"]),"text-translate-anchor":new Nt(_e.paint_symbol["text-translate-anchor"])})},get layout(){return gm=gm||new w({"symbol-placement":new Nt(_e.layout_symbol["symbol-placement"]),"symbol-spacing":new Nt(_e.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Nt(_e.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Zt(_e.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Nt(_e.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Nt(_e.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Nt(_e.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Nt(_e.layout_symbol["icon-ignore-placement"]),"icon-optional":new Nt(_e.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Nt(_e.layout_symbol["icon-rotation-alignment"]),"icon-size":new Zt(_e.layout_symbol["icon-size"]),"icon-text-fit":new Nt(_e.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Nt(_e.layout_symbol["icon-text-fit-padding"]),"icon-image":new Zt(_e.layout_symbol["icon-image"]),"icon-rotate":new Zt(_e.layout_symbol["icon-rotate"]),"icon-padding":new Zt(_e.layout_symbol["icon-padding"]),"icon-keep-upright":new Nt(_e.layout_symbol["icon-keep-upright"]),"icon-offset":new Zt(_e.layout_symbol["icon-offset"]),"icon-anchor":new Zt(_e.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Nt(_e.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Nt(_e.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Nt(_e.layout_symbol["text-rotation-alignment"]),"text-field":new Zt(_e.layout_symbol["text-field"]),"text-font":new Zt(_e.layout_symbol["text-font"]),"text-size":new Zt(_e.layout_symbol["text-size"]),"text-max-width":new Zt(_e.layout_symbol["text-max-width"]),"text-line-height":new Nt(_e.layout_symbol["text-line-height"]),"text-letter-spacing":new Zt(_e.layout_symbol["text-letter-spacing"]),"text-justify":new Zt(_e.layout_symbol["text-justify"]),"text-radial-offset":new Zt(_e.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Nt(_e.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Zt(_e.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Zt(_e.layout_symbol["text-anchor"]),"text-max-angle":new Nt(_e.layout_symbol["text-max-angle"]),"text-writing-mode":new Nt(_e.layout_symbol["text-writing-mode"]),"text-rotate":new Zt(_e.layout_symbol["text-rotate"]),"text-padding":new Nt(_e.layout_symbol["text-padding"]),"text-keep-upright":new Nt(_e.layout_symbol["text-keep-upright"]),"text-transform":new Zt(_e.layout_symbol["text-transform"]),"text-offset":new Zt(_e.layout_symbol["text-offset"]),"text-allow-overlap":new Nt(_e.layout_symbol["text-allow-overlap"]),"text-overlap":new Nt(_e.layout_symbol["text-overlap"]),"text-ignore-placement":new Nt(_e.layout_symbol["text-ignore-placement"]),"text-optional":new Nt(_e.layout_symbol["text-optional"])})}};class ad{constructor(s){if(s.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=s.property.overrides?s.property.overrides.runtimeType:Za,this.defaultValue=s}evaluate(s){if(s.formattedSection){const u=this.defaultValue.property.overrides;if(u&&u.hasOverride(s.formattedSection))return u.getOverride(s.formattedSection)}return s.feature&&s.featureState?this.defaultValue.evaluate(s.feature,s.featureState):this.defaultValue.property.specification.default}eachChild(s){this.defaultValue.isConstant()||s(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}lt("FormatSectionOverride",ad,{omit:["defaultValue"]});class $u extends f{constructor(s){super(s,ho)}recalculate(s,u){if(super.recalculate(s,u),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 g=this.layout.get("text-writing-mode");if(g){const v=[];for(const T of g)v.indexOf(T)<0&&v.push(T);this.layout._values["text-writing-mode"]=v}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(s,u,g,v){const T=this.layout.get(s).evaluate(u,{},g,v),S=this._unevaluatedLayout._values[s];return S.isDataDriven()||wl(S.value)||!T?T:(function(C,P){return P.replace(/{([^{}]+)}/g,((k,z)=>C&&z in C?String(C[z]):""))})(u.properties,T)}createBucket(s){return new Dc(s)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const s of ho.paint.overridableProperties){if(!$u.hasPaintOverride(this.layout,s))continue;const u=this.paint.get(s),g=new ad(u),v=new eo(g,u.property.specification);let T=null;T=u.value.kind==="constant"||u.value.kind==="source"?new Rs("source",v):new Ys("composite",v,u.value.zoomStops),this.paint._values[s]=new Is(u.property,T,u.parameters)}}_handleOverridablePaintPropertyUpdate(s,u,g){return!(!this.layout||u.isDataDriven()||g.isDataDriven())&&$u.hasPaintOverride(this.layout,s)}static hasPaintOverride(s,u){const g=s.get("text-field"),v=ho.paint.properties[u];let T=!1;const S=C=>{for(const P of C)if(v.overrides&&v.overrides.hasOverride(P))return void(T=!0)};if(g.value.kind==="constant"&&g.value.value instanceof ts)S(g.value.value.sections);else if(g.value.kind==="source"){const C=k=>{T||(k instanceof ur&&Bn(k.value)===As?S(k.value.sections):k instanceof Ao?S(k.sections):k.eachChild(C))},P=g.value;P._styleExpression&&C(P._styleExpression.expression)}return T}}let Oc;var s_={get paint(){return Oc=Oc||new w({"background-color":new Nt(_e.paint_background["background-color"]),"background-pattern":new za(_e.paint_background["background-pattern"]),"background-opacity":new Nt(_e.paint_background["background-opacity"])})}};class a_ extends f{constructor(s){super(s,s_)}}let _m;var o_={get paint(){return _m=_m||new w({"raster-opacity":new Nt(_e.paint_raster["raster-opacity"]),"raster-hue-rotate":new Nt(_e.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Nt(_e.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Nt(_e.paint_raster["raster-brightness-max"]),"raster-saturation":new Nt(_e.paint_raster["raster-saturation"]),"raster-contrast":new Nt(_e.paint_raster["raster-contrast"]),"raster-resampling":new Nt(_e.paint_raster["raster-resampling"]),"raster-fade-duration":new Nt(_e.paint_raster["raster-fade-duration"])})}};class Ef extends f{constructor(s){super(s,o_)}}class ym extends f{constructor(s){super(s,{}),this.onAdd=u=>{this.implementation.onAdd&&this.implementation.onAdd(u,u.painter.context.gl)},this.onRemove=u=>{this.implementation.onRemove&&this.implementation.onRemove(u,u.painter.context.gl)},this.implementation=s}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")}}class Ev{constructor(s){this._methodToThrottle=s,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout((()=>{this._triggered=!1,this._methodToThrottle()}),0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const vm=63710088e-1;class Wl{constructor(s,u){if(isNaN(s)||isNaN(u))throw new Error(`Invalid LngLat object: (${s}, ${u})`);if(this.lng=+s,this.lat=+u,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Wl(Re(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(s){const u=Math.PI/180,g=this.lat*u,v=s.lat*u,T=Math.sin(g)*Math.sin(v)+Math.cos(g)*Math.cos(v)*Math.cos((s.lng-this.lng)*u);return vm*Math.acos(Math.min(T,1))}static convert(s){if(s instanceof Wl)return s;if(Array.isArray(s)&&(s.length===2||s.length===3))return new Wl(Number(s[0]),Number(s[1]));if(!Array.isArray(s)&&typeof s=="object"&&s!==null)return new Wl(Number("lng"in s?s.lng:s.lon),Number(s.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>]")}}const bm=2*Math.PI*vm;function xm(l){return bm*Math.cos(l*Math.PI/180)}function kc(l){return(180+l)/360}function od(l){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+l*Math.PI/360)))/360}function wm(l,s){return l/xm(s)}function Cf(l){return 360/Math.PI*Math.atan(Math.exp((180-360*l)*Math.PI/180)
vendor: 15,431 bytes, line 53
53)-90}class Hu{constructor(s,u,g=0){this.x=+s,this.y=+u,this.z=+g}static fromLngLat(s,u=0){const g=Wl.convert(s);return new Hu(kc(g.lng),od(g.lat),wm(u,g.lat))}toLngLat(){return new Wl(360*this.x-180,Cf(this.y))}toAltitude(){return this.z*xm(Cf(this.y))}meterInMercatorCoordinateUnits(){return 1/bm*(s=Cf(this.y),1/Math.cos(s*Math.PI/180));var s}}function Tm(l,s,u){var g=2*Math.PI*6378137/256/Math.pow(2,u);return[l*g-2*Math.PI*6378137/2,s*g-2*Math.PI*6378137/2]}class Rf{constructor(s,u,g){if(!(function(v,T,S){return!(v<0||v>25||S<0||S>=Math.pow(2,v)||T<0||T>=Math.pow(2,v))})(s,u,g))throw new Error(`x=${u}, y=${g}, z=${s} outside of bounds. 0<=x<${Math.pow(2,s)}, 0<=y<${Math.pow(2,s)} 0<=z<=25 `);this.z=s,this.x=u,this.y=g,this.key=Wu(0,s,s,u,g)}equals(s){return this.z===s.z&&this.x===s.x&&this.y===s.y}url(s,u,g){const v=(S=this.y,C=this.z,P=Tm(256*(T=this.x),256*(S=Math.pow(2,C)-S-1),C),k=Tm(256*(T+1),256*(S+1),C),P[0]+","+P[1]+","+k[0]+","+k[1]);var T,S,C,P,k;const z=(function(U,W,Z){let K,J="";for(let ce=U;ce>0;ce--)K=1<<ce-1,J+=(W&K?1:0)+(Z&K?2:0);return J})(this.z,this.x,this.y);return s[(this.x+this.y)%s.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(g==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,u>1?"@2x":"").replace(/{quadkey}/g,z).replace(/{bbox-epsg-3857}/g,v)}isChildOf(s){const u=this.z-s.z;return u>0&&s.x===this.x>>u&&s.y===this.y>>u}getTilePoint(s){const u=Math.pow(2,this.z);return new N((s.x*u-this.x)*Kn,(s.y*u-this.y)*Kn)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Sm{constructor(s,u){this.wrap=s,this.canonical=u,this.key=Wu(s,u.z,u.z,u.x,u.y)}}class cs{constructor(s,u,g,v,T){if(s<g)throw new Error(`overscaledZ should be >= z; overscaledZ = ${s}; z = ${g}`);this.overscaledZ=s,this.wrap=u,this.canonical=new Rf(g,+v,+T),this.key=Wu(u,s,g,v,T)}clone(){return new cs(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(s){return this.overscaledZ===s.overscaledZ&&this.wrap===s.wrap&&this.canonical.equals(s.canonical)}scaledTo(s){if(s>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${s}; overscaledZ = ${this.overscaledZ}`);const u=this.canonical.z-s;return s>this.canonical.z?new cs(s,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new cs(s,this.wrap,s,this.canonical.x>>u,this.canonical.y>>u)}calculateScaledKey(s,u){if(s>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${s}; overscaledZ = ${this.overscaledZ}`);const g=this.canonical.z-s;return s>this.canonical.z?Wu(this.wrap*+u,s,this.canonical.z,this.canonical.x,this.canonical.y):Wu(this.wrap*+u,s,s,this.canonical.x>>g,this.canonical.y>>g)}isChildOf(s){if(s.wrap!==this.wrap)return!1;const u=this.canonical.z-s.canonical.z;return s.overscaledZ===0||s.overscaledZ<this.overscaledZ&&s.canonical.x===this.canonical.x>>u&&s.canonical.y===this.canonical.y>>u}children(s){if(this.overscaledZ>=s)return[new cs(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const u=this.canonical.z+1,g=2*this.canonical.x,v=2*this.canonical.y;return[new cs(u,this.wrap,u,g,v),new cs(u,this.wrap,u,g+1,v),new cs(u,this.wrap,u,g,v+1),new cs(u,this.wrap,u,g+1,v+1)]}isLessThan(s){return this.wrap<s.wrap||!(this.wrap>s.wrap)&&(this.overscaledZ<s.overscaledZ||!(this.overscaledZ>s.overscaledZ)&&(this.canonical.x<s.canonical.x||!(this.canonical.x>s.canonical.x)&&this.canonical.y<s.canonical.y))}wrapped(){return new cs(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(s){return new cs(this.overscaledZ,s,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Sm(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(s){return this.canonical.getTilePoint(new Hu(s.x-this.wrap,s.y))}}function Wu(l,s,u,g,v){(l*=2)<0&&(l=-1*l-1);const T=1<<u;return(T*T*l+T*v+g).toString(36)+u.toString(36)+s.toString(36)}lt("CanonicalTileID",Rf),lt("OverscaledTileID",cs,{omit:["posMatrix"]});class Am{constructor(s,u,g,v=1,T=1,S=1,C=0){if(this.uid=s,u.height!==u.width)throw new RangeError("DEM tiles must be square");if(g&&!["mapbox","terrarium","custom"].includes(g))return void At(`"${g}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=u.height;const P=this.dim=u.height-2;switch(this.data=new Uint32Array(u.data.buffer),g){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=v,this.greenFactor=T,this.blueFactor=S,this.baseShift=C;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let k=0;k<P;k++)this.data[this._idx(-1,k)]=this.data[this._idx(0,k)],this.data[this._idx(P,k)]=this.data[this._idx(P-1,k)],this.data[this._idx(k,-1)]=this.data[this._idx(k,0)],this.data[this._idx(k,P)]=this.data[this._idx(k,P-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(P,-1)]=this.data[this._idx(P-1,0)],this.data[this._idx(-1,P)]=this.data[this._idx(0,P-1)],this.data[this._idx(P,P)]=this.data[this._idx(P-1,P-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let k=0;k<P;k++)for(let z=0;z<P;z++){const U=this.get(k,z);U>this.max&&(this.max=U),U<this.min&&(this.min=U)}}get(s,u){const g=new Uint8Array(this.data.buffer),v=4*this._idx(s,u);return this.unpack(g[v],g[v+1],g[v+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(s,u){if(s<-1||s>=this.dim+1||u<-1||u>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(u+1)*this.stride+(s+1)}unpack(s,u,g){return s*this.redFactor+u*this.greenFactor+g*this.blueFactor-this.baseShift}getPixels(){return new Bs({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(s,u,g){if(this.dim!==s.dim)throw new Error("dem dimension mismatch");let v=u*this.dim,T=u*this.dim+this.dim,S=g*this.dim,C=g*this.dim+this.dim;switch(u){case-1:v=T-1;break;case 1:T=v+1}switch(g){case-1:S=C-1;break;case 1:C=S+1}const P=-u*this.dim,k=-g*this.dim;for(let z=S;z<C;z++)for(let U=v;U<T;U++)this.data[this._idx(U,z)]=s.data[this._idx(U+P,z+k)]}}lt("DEMData",Am);class ln{constructor(s){this._stringToNumber={},this._numberToString=[];for(let u=0;u<s.length;u++){const g=s[u];this._stringToNumber[g]=u,this._numberToString[u]=g}}encode(s){return this._stringToNumber[s]}decode(s){if(s>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${s} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[s]}}class Mf{constructor(s,u,g,v,T){this.type="Feature",this._vectorTileFeature=s,s._z=u,s._x=g,s._y=v,this.properties=s.properties,this.id=T}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(s){this._geometry=s}toJSON(){const s={geometry:this.geometry};for(const u in this)u!=="_geometry"&&u!=="_vectorTileFeature"&&(s[u]=this[u]);return s}}class l_{constructor(s,u){this.tileID=s,this.x=s.canonical.x,this.y=s.canonical.y,this.z=s.canonical.z,this.grid=new Wn(Kn,16,0),this.grid3D=new Wn(Kn,16,0),this.featureIndexArray=new pn,this.promoteId=u}insert(s,u,g,v,T,S){const C=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(g,v,T);const P=S?this.grid3D:this.grid;for(let k=0;k<u.length;k++){const z=u[k],U=[1/0,1/0,-1/0,-1/0];for(let W=0;W<z.length;W++){const Z=z[W];U[0]=Math.min(U[0],Z.x),U[1]=Math.min(U[1],Z.y),U[2]=Math.max(U[2],Z.x),U[3]=Math.max(U[3],Z.y)}U[0]<Kn&&U[1]<Kn&&U[2]>=0&&U[3]>=0&&P.insert(C,U[0],U[1],U[2],U[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Go.VectorTile(new wf(this.rawTileData)).layers,this.sourceLayerCoder=new ln(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(s,u,g,v){this.loadVTLayers();const T=s.params||{},S=Kn/s.tileSize/s.scale,C=du(T.filter),P=s.queryGeometry,k=s.queryPadding*S,z=c_(P),U=this.grid.query(z.minX-k,z.minY-k,z.maxX+k,z.maxY+k),W=c_(s.cameraQueryGeometry),Z=this.grid3D.query(W.minX-k,W.minY-k,W.maxX+k,W.maxY+k,((ce,fe,Be,Ae)=>(function(De,Xe,ct,Rt,Yt){for(const St of De)if(Xe<=St.x&&ct<=St.y&&Rt>=St.x&&Yt>=St.y)return!0;const _t=[new N(Xe,ct),new N(Xe,Yt),new N(Rt,Yt),new N(Rt,ct)];if(De.length>2){for(const St of _t)if(Zo(De,St))return!0}for(let St=0;St<De.length-1;St++)if(Mg(De[St],De[St+1],_t))return!0;return!1})(s.cameraQueryGeometry,ce-k,fe-k,Be+k,Ae+k)));for(const ce of Z)U.push(ce);U.sort(Cv);const K={};let J;for(let ce=0;ce<U.length;ce++){const fe=U[ce];if(fe===J)continue;J=fe;const Be=this.featureIndexArray.get(fe);let Ae=null;this.loadMatchingFeature(K,Be.bucketIndex,Be.sourceLayerIndex,Be.featureIndex,C,T.layers,T.availableImages,u,g,v,((De,Xe,ct)=>(Ae||(Ae=Bl(De)),Xe.queryIntersectsFeature(P,De,ct,Ae,this.z,s.transform,S,s.pixelPosMatrix))))}return K}loadMatchingFeature(s,u,g,v,T,S,C,P,k,z,U){const W=this.bucketLayerIDs[u];if(S&&!(function(ce,fe){for(let Be=0;Be<ce.length;Be++)if(fe.indexOf(ce[Be])>=0)return!0;return!1})(S,W))return;const Z=this.sourceLayerCoder.decode(g),K=this.vtLayers[Z].feature(v);if(T.needGeometry){const ce=Nl(K,!0);if(!T.filter(new xi(this.tileID.overscaledZ),ce,this.tileID.canonical))return}else if(!T.filter(new xi(this.tileID.overscaledZ),K))return;const J=this.getId(K,Z);for(let ce=0;ce<W.length;ce++){const fe=W[ce];if(S&&S.indexOf(fe)<0)continue;const Be=P[fe];if(!Be)continue;let Ae={};J&&z&&(Ae=z.getState(Be.sourceLayer||"_geojsonTileLayer",J));const De=Ee({},k[fe]);De.paint=Em(De.paint,Be.paint,K,Ae,C),De.layout=Em(De.layout,Be.layout,K,Ae,C);const Xe=!U||U(K,Be,Ae);if(!Xe)continue;const ct=new Mf(K,this.z,this.x,this.y,J);ct.layer=De;let Rt=s[fe];Rt===void 0&&(Rt=s[fe]=[]),Rt.push({featureIndex:v,feature:ct,intersectionZ:Xe})}}lookupSymbolFeatures(s,u,g,v,T,S,C,P){const k={};this.loadVTLayers();const z=du(T);for(const U of s)this.loadMatchingFeature(k,g,v,U,z,S,C,P,u);return k}hasLayer(s){for(const u of this.bucketLayerIDs)for(const g of u)if(s===g)return!0;return!1}getId(s,u){let g=s.id;return this.promoteId&&(g=s.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[u]],typeof g=="boolean"&&(g=Number(g))),g}}function Em(l,s,u,g,v){return rt(l,((T,S)=>{const C=s instanceof Ba?s.get(S):null;return C&&C.evaluate?C.evaluate(u,g,v):C}))}function c_(l){let s=1/0,u=1/0,g=-1/0,v=-1/0;for(const T of l)s=Math.min(s,T.x),u=Math.min(u,T.y),g=Math.max(g,T.x),v=Math.max(v,T.y);return{minX:s,minY:u,maxX:g,maxY:v}}function Cv(l,s){return s-l}function u_(l,s,u,g,v){const T=[];for(let S=0;S<l.length;S++){const C=l[S];let P;for(let k=0;k<C.length-1;k++){let z=C[k],U=C[k+1];z.x<s&&U.x<s||(z.x<s?z=new N(s,z.y+(s-z.x)/(U.x-z.x)*(U.y-z.y))._round():U.x<s&&(U=new N(s,z.y+(s-z.x)/(U.x-z.x)*(U.y-z.y))._round()),z.y<u&&U.y<u||(z.y<u?z=new N(z.x+(u-z.y)/(U.y-z.y)*(U.x-z.x),u)._round():U.y<u&&(U=new N(z.x+(u-z.y)/(U.y-z.y)*(U.x-z.x),u)._round()),z.x>=g&&U.x>=g||(z.x>=g?z=new N(g,z.y+(g-z.x)/(U.x-z.x)*(U.y-z.y))._round():U.x>=g&&(U=new N(g,z.y+(g-z.x)/(U.x-z.x)*(U.y-z.y))._round()),z.y>=v&&U.y>=v||(z.y>=v?z=new N(z.x+(v-z.y)/(U.y-z.y)*(U.x-z.x),v)._round():U.y>=v&&(U=new N(z.x+(v-z.y)/(U.y-z.y)*(U.x-z.x),v)._round()),P&&z.equals(P[P.length-1])||(P=[z],T.push(P)),P.push(U)))))}}return T}lt("FeatureIndex",l_,{omit:["rawTileData","sourceLayerCoder"]});class Ua extends N{constructor(s,u,g,v){super(s,u),this.angle=g,v!==void 0&&(this.segment=v)}clone(){return new Ua(this.x,this.y,this.angle,this.segment)}}function Bc(l,s,u,g,v){if(s.segment===void 0||u===0)return!0;let T=s,S=s.segment+1,C=0;for(;C>-u/2;){if(S--,S<0)return!1;C-=l[S].dist(T),T=l[S]}C+=l[S].dist(l[S+1]),S++;const P=[];let k=0;for(;C<u/2;){const z=l[S],U=l[S+1];if(!U)return!1;let W=l[S-1].angleTo(z)-z.angleTo(U);for(W=Math.abs((W+3*Math.PI)%(2*Math.PI)-Math.PI),P.push({distance:C,angleDelta:W}),k+=W;C-P[0].distance>g;)k-=P.shift().angleDelta;if(k>v)return!1;S++,C+=z.dist(U)}return!0}function Pf(l){let s=0;for(let u=0;u<l.length-1;u++)s+=l[u].dist(l[u+1]);return s}function ld(l,s,u){return l?.6*s*u:0}function If(l,s){return Math.max(l?l.right-l.left:0,s?s.right-s.left:0)}function Xl(l,s,u,g,v,T){const S=ld(u,v,T),C=If(u,g)*T;let P=0;const k=Pf(l)/2;for(let z=0;z<l.length-1;z++){const U=l[z],W=l[z+1],Z=U.dist(W);if(P+Z>k){const K=(k-P)/Z,J=Dr.number(U.x,W.x,K),ce=Dr.number(U.y,W.y,K),fe=new Ua(J,ce,W.angleTo(U),z);return fe._round(),!S||Bc(l,fe,C,S,s)?fe:void 0}P+=Z}}function fo(l,s,u,g,v,T,S,C,P){const k=ld(g,T,S),z=If(g,v),U=z*S,W=l[0].x===0||l[0].x===P||l[0].y===0||l[0].y===P;return s-U<s/4&&(s=U+s/4),Xu(l,W?s/2*C%s:(z/2+2*T)*S*C%s,s,k,u,U,W,!1,P)}function Xu(l,s,u,g,v,T,S,C,P){const k=T/2,z=Pf(l);let U=0,W=s-u,Z=[];for(let K=0;K<l.length-1;K++){const J=l[K],ce=l[K+1],fe=J.dist(ce),Be=ce.angleTo(J);for(;W+u<U+fe;){W+=u;const Ae=(W-U)/fe,De=Dr.number(J.x,ce.x,Ae),Xe=Dr.number(J.y,ce.y,Ae);if(De>=0&&De<P&&Xe>=0&&Xe<P&&W-k>=0&&W+k<=z){const ct=new Ua(De,Xe,Be,K);ct._round(),g&&!Bc(l,ct,T,g,v)||Z.push(ct)}}U+=fe}return C||Z.length||S||(Z=Xu(l,U/2,u,g,v,T,S,!0,P)),Z}lt("Anchor",Ua);const qu=ci;function Cm(l,s,u,g){const v=[],T=l.image,S=T.pixelRatio,C=T.paddedRect.w-2*qu,P=T.paddedRect.h-2*qu;let k={x1:l.left,y1:l.top,x2:l.right,y2:l.bottom};const z=T.stretchX||[[0,C]],U=T.stretchY||[[0,P]],W=(Ye,kt)=>Ye+kt[1]-kt[0],Z=z.reduce(W,0),K=U.reduce(W,0),J=C-Z,ce=P-K;let fe=0,Be=Z,Ae=0,De=K,Xe=0,ct=J,Rt=0,Yt=ce;if(T.content&&g){const Ye=T.content,kt=Ye[2]-Ye[0],zt=Ye[3]-Ye[1];(T.textFitWidth||T.textFitHeight)&&(k=nd(l)),fe=cd(z,0,Ye[0]),Ae=cd(U,0,Ye[1]),Be=cd(z,Ye[0],Ye[2]),De=cd(U,Ye[1],Ye[3]),Xe=Ye[0]-fe,Rt=Ye[1]-Ae,ct=kt-Be,Yt=zt-De}const _t=k.x1,St=k.y1,Lt=k.x2-_t,Bt=k.y2-St,It=(Ye,kt,zt,ri)=>{const zi=ud(Ye.stretch-fe,Be,Lt,_t),tn=Df(Ye.fixed-Xe,ct,Ye.stretch,Z),xr=ud(kt.stretch-Ae,De,Bt,St),Kr=Df(kt.fixed-Rt,Yt,kt.stretch,K),Mr=ud(zt.stretch-fe,Be,Lt,_t),wr=Df(zt.fixed-Xe,ct,zt.stretch,Z),us=ud(ri.stretch-Ae,De,Bt,St),hs=Df(ri.fixed-Rt,Yt,ri.stretch,K),ds=new N(zi,xr),Yn=new N(Mr,xr),Tr=new N(Mr,us),Qr=new N(zi,us),Pr=new N(tn/S,Kr/S),pr=new N(wr/S,hs/S),ar=s*Math.PI/180;if(ar){const Pi=Math.sin(ar),Yi=Math.cos(ar),yn=[Yi,-Pi,Pi,Yi];ds._matMult(yn),Yn._matMult(yn),Qr._matMult(yn),Tr._matMult(yn)}const Fs=Ye.stretch+Ye.fixed,bs=kt.stretch+kt.fixed;return{tl:ds,tr:Yn,bl:Qr,br:Tr,tex:{x:T.paddedRect.x+qu+Fs,y:T.paddedRect.y+qu+bs,w:zt.stretch+zt.fixed-Fs,h:ri.stretch+ri.fixed-bs},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Pr,pixelOffsetBR:pr,minFontScaleX:ct/S/Lt,minFontScaleY:Yt/S/Bt,isSDF:u}};if(g&&(T.stretchX||T.stretchY)){const Ye=Rm(z,J,Z),kt=Rm(U,ce,K);for(let zt=0;zt<Ye.length-1;zt++){const ri=Ye[zt],zi=Ye[zt+1];for(let tn=0;tn<kt.length-1;tn++)v.push(It(ri,kt[tn],zi,kt[tn+1]))}}else v.push(It({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:C+1},{fixed:0,stretch:P+1}));return v}function cd(l,s,u){let g=0;for(const v of l)g+=Math.max(s,Math.min(u,v[1]))-Math.max(s,Math.min(u,v[0]));return g}function Rm(l,s,u){const g=[{fixed:-qu,stretch:0}];for(const[v,T]of l){const S=g[g.length-1];g.push({fixed:v-S.stretch,stretch:S.stretch}
vendor: 16,053 bytes, line 53
53),g.push({fixed:v-S.stretch,stretch:S.stretch+(T-v)})}return g.push({fixed:s+qu,stretch:u}),g}function ud(l,s,u,g){return l/s*u+g}function Df(l,s,u,g){return l-s*u/g}class Zu{constructor(s,u,g,v,T,S,C,P,k,z){var U;if(this.boxStartIndex=s.length,k){let W=S.top,Z=S.bottom;const K=S.collisionPadding;K&&(W-=K[1],Z+=K[3]);let J=Z-W;J>0&&(J=Math.max(10,J),this.circleDiameter=J)}else{const W=!((U=S.image)===null||U===void 0)&&U.content&&(S.image.textFitWidth||S.image.textFitHeight)?nd(S):{x1:S.left,y1:S.top,x2:S.right,y2:S.bottom};W.y1=W.y1*C-P[0],W.y2=W.y2*C+P[2],W.x1=W.x1*C-P[3],W.x2=W.x2*C+P[1];const Z=S.collisionPadding;if(Z&&(W.x1-=Z[0]*C,W.y1-=Z[1]*C,W.x2+=Z[2]*C,W.y2+=Z[3]*C),z){const K=new N(W.x1,W.y1),J=new N(W.x2,W.y1),ce=new N(W.x1,W.y2),fe=new N(W.x2,W.y2),Be=z*Math.PI/180;K._rotate(Be),J._rotate(Be),ce._rotate(Be),fe._rotate(Be),W.x1=Math.min(K.x,J.x,ce.x,fe.x),W.x2=Math.max(K.x,J.x,ce.x,fe.x),W.y1=Math.min(K.y,J.y,ce.y,fe.y),W.y2=Math.max(K.y,J.y,ce.y,fe.y)}s.emplaceBack(u.x,u.y,W.x1,W.y1,W.x2,W.y2,g,v,T)}this.boxEndIndex=s.length}}class h_{constructor(s=[],u=((g,v)=>g<v?-1:g>v?1:0)){if(this.data=s,this.length=this.data.length,this.compare=u,this.length>0)for(let g=(this.length>>1)-1;g>=0;g--)this._down(g)}push(s){this.data.push(s),this._up(this.length++)}pop(){if(this.length===0)return;const s=this.data[0],u=this.data.pop();return--this.length>0&&(this.data[0]=u,this._down(0)),s}peek(){return this.data[0]}_up(s){const{data:u,compare:g}=this,v=u[s];for(;s>0;){const T=s-1>>1,S=u[T];if(g(v,S)>=0)break;u[s]=S,s=T}u[s]=v}_down(s){const{data:u,compare:g}=this,v=this.length>>1,T=u[s];for(;s<v;){let S=1+(s<<1);const C=S+1;if(C<this.length&&g(u[C],u[S])<0&&(S=C),g(u[S],T)>=0)break;u[s]=u[S],s=S}u[s]=T}}function d_(l,s=1,u=!1){let g=1/0,v=1/0,T=-1/0,S=-1/0;const C=l[0];for(let Z=0;Z<C.length;Z++){const K=C[Z];(!Z||K.x<g)&&(g=K.x),(!Z||K.y<v)&&(v=K.y),(!Z||K.x>T)&&(T=K.x),(!Z||K.y>S)&&(S=K.y)}const P=Math.min(T-g,S-v);let k=P/2;const z=new h_([],Rv);if(P===0)return new N(g,v);for(let Z=g;Z<T;Z+=P)for(let K=v;K<S;K+=P)z.push(new ql(Z+k,K+k,k,l));let U=(function(Z){let K=0,J=0,ce=0;const fe=Z[0];for(let Be=0,Ae=fe.length,De=Ae-1;Be<Ae;De=Be++){const Xe=fe[Be],ct=fe[De],Rt=Xe.x*ct.y-ct.x*Xe.y;J+=(Xe.x+ct.x)*Rt,ce+=(Xe.y+ct.y)*Rt,K+=3*Rt}return new ql(J/K,ce/K,0,Z)})(l),W=z.length;for(;z.length;){const Z=z.pop();(Z.d>U.d||!U.d)&&(U=Z,u&&console.log("found best %d after %d probes",Math.round(1e4*Z.d)/1e4,W)),Z.max-U.d<=s||(k=Z.h/2,z.push(new ql(Z.p.x-k,Z.p.y-k,k,l)),z.push(new ql(Z.p.x+k,Z.p.y-k,k,l)),z.push(new ql(Z.p.x-k,Z.p.y+k,k,l)),z.push(new ql(Z.p.x+k,Z.p.y+k,k,l)),W+=4)}return u&&(console.log(`num probes: ${W}`),console.log(`best distance: ${U.d}`)),U.p}function Rv(l,s){return s.max-l.max}function ql(l,s,u,g){this.p=new N(l,s),this.h=u,this.d=(function(v,T){let S=!1,C=1/0;for(let P=0;P<T.length;P++){const k=T[P];for(let z=0,U=k.length,W=U-1;z<U;W=z++){const Z=k[z],K=k[W];Z.y>v.y!=K.y>v.y&&v.x<(K.x-Z.x)*(v.y-Z.y)/(K.y-Z.y)+Z.x&&(S=!S),C=Math.min(C,jp(v,Z,K))}}return(S?1:-1)*Math.sqrt(C)})(this.p,g),this.max=this.d+this.h*Math.SQRT2}var br;p.aq=void 0,(br=p.aq||(p.aq={}))[br.center=1]="center",br[br.left=2]="left",br[br.right=3]="right",br[br.top=4]="top",br[br.bottom=5]="bottom",br[br["top-left"]=6]="top-left",br[br["top-right"]=7]="top-right",br[br["bottom-left"]=8]="bottom-left",br[br["bottom-right"]=9]="bottom-right";const Zl=7,Mm=Number.POSITIVE_INFINITY;function Yu(l,s){return s[1]!==Mm?(function(u,g,v){let T=0,S=0;switch(g=Math.abs(g),v=Math.abs(v),u){case"top-right":case"top-left":case"top":S=v-Zl;break;case"bottom-right":case"bottom-left":case"bottom":S=-v+Zl}switch(u){case"top-right":case"bottom-right":case"right":T=-g;break;case"top-left":case"bottom-left":case"left":T=g}return[T,S]})(l,s[0],s[1]):(function(u,g){let v=0,T=0;g<0&&(g=0);const S=g/Math.SQRT2;switch(u){case"top-right":case"top-left":T=S-Zl;break;case"bottom-right":case"bottom-left":T=-S+Zl;break;case"bottom":T=-g+Zl;break;case"top":T=g-Zl}switch(u){case"top-right":case"bottom-right":v=-S;break;case"top-left":case"bottom-left":v=S;break;case"left":v=g;break;case"right":v=-g}return[v,T]})(l,s[0])}function f_(l,s,u){var g;const v=l.layout,T=(g=v.get("text-variable-anchor-offset"))===null||g===void 0?void 0:g.evaluate(s,{},u);if(T){const C=T.values,P=[];for(let k=0;k<C.length;k+=2){const z=P[k]=C[k],U=C[k+1].map((W=>W*sr));z.startsWith("top")?U[1]-=Zl:z.startsWith("bottom")&&(U[1]+=Zl),P[k+1]=U}return new Es(P)}const S=v.get("text-variable-anchor");if(S){let C;C=l._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[v.get("text-radial-offset").evaluate(s,{},u)*sr,Mm]:v.get("text-offset").evaluate(s,{},u).map((k=>k*sr));const P=[];for(const k of S)P.push(k,Yu(k,C));return new Es(P)}return null}function Of(l){switch(l){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Ui(l,s,u,g,v,T,S,C,P,k,z){let U=T.textMaxSize.evaluate(s,{});U===void 0&&(U=S);const W=l.layers[0].layout,Z=W.get("icon-offset").evaluate(s,{},z),K=hd(u.horizontal),J=S/24,ce=l.tilePixelRatio*J,fe=l.tilePixelRatio*U/24,Be=l.tilePixelRatio*C,Ae=l.tilePixelRatio*W.get("symbol-spacing"),De=W.get("text-padding")*l.tilePixelRatio,Xe=(function(Ye,kt,zt,ri=1){const zi=Ye.get("icon-padding").evaluate(kt,{},zt),tn=zi&&zi.values;return[tn[0]*ri,tn[1]*ri,tn[2]*ri,tn[3]*ri]})(W,s,z,l.tilePixelRatio),ct=W.get("text-max-angle")/180*Math.PI,Rt=W.get("text-rotation-alignment")!=="viewport"&&W.get("symbol-placement")!=="point",Yt=W.get("icon-rotation-alignment")==="map"&&W.get("symbol-placement")!=="point",_t=W.get("symbol-placement"),St=Ae/2,Lt=W.get("icon-text-fit");let Bt;g&&Lt!=="none"&&(l.allowVerticalPlacement&&u.vertical&&(Bt=el(g,u.vertical,Lt,W.get("icon-text-fit-padding"),Z,J)),K&&(g=el(g,K,Lt,W.get("icon-text-fit-padding"),Z,J)));const It=(Ye,kt)=>{kt.x<0||kt.x>=Kn||kt.y<0||kt.y>=Kn||(function(zt,ri,zi,tn,xr,Kr,Mr,wr,us,hs,ds,Yn,Tr,Qr,Pr,pr,ar,Fs,bs,Pi,Yi,yn,Jr,An,Yl){const na=zt.addToLineVertexArray(ri,zi);let ja,ra,sa,Sr,tl=0,zc=0,m_=0,_d=0,Ku=-1,Qu=-1;const il={};let Ju=Pl("");if(zt.allowVerticalPlacement&&tn.vertical){const jr=wr.layout.get("text-rotate").evaluate(Yi,{},An)+90;sa=new Zu(us,ri,hs,ds,Yn,tn.vertical,Tr,Qr,Pr,jr),Mr&&(Sr=new Zu(us,ri,hs,ds,Yn,Mr,ar,Fs,Pr,jr))}if(xr){const jr=wr.layout.get("icon-rotate").evaluate(Yi,{}),xs=wr.layout.get("icon-text-fit")!=="none",Us=Cm(xr,jr,Jr,xs),Vr=Mr?Cm(Mr,jr,Jr,xs):void 0;ra=new Zu(us,ri,hs,ds,Yn,xr,ar,Fs,!1,jr),tl=4*Us.length;const js=zt.iconSizeData;let Vs=null;js.kind==="source"?(Vs=[Gr*wr.layout.get("icon-size").evaluate(Yi,{})],Vs[0]>ta&&At(`${zt.layerIds[0]}: Value for "icon-size" is >= ${Jn}. Reduce your "icon-size".`)):js.kind==="composite"&&(Vs=[Gr*yn.compositeIconSizes[0].evaluate(Yi,{},An),Gr*yn.compositeIconSizes[1].evaluate(Yi,{},An)],(Vs[0]>ta||Vs[1]>ta)&&At(`${zt.layerIds[0]}: Value for "icon-size" is >= ${Jn}. Reduce your "icon-size".`)),zt.addSymbols(zt.icon,Us,Vs,Pi,bs,Yi,p.ah.none,ri,na.lineStartIndex,na.lineLength,-1,An),Ku=zt.icon.placedSymbolArray.length-1,Vr&&(zc=4*Vr.length,zt.addSymbols(zt.icon,Vr,Vs,Pi,bs,Yi,p.ah.vertical,ri,na.lineStartIndex,na.lineLength,-1,An),Qu=zt.icon.placedSymbolArray.length-1)}const g_=Object.keys(tn.horizontal);for(const jr of g_){const xs=tn.horizontal[jr];if(!ja){Ju=Pl(xs.text);const Vr=wr.layout.get("text-rotate").evaluate(Yi,{},An);ja=new Zu(us,ri,hs,ds,Yn,xs,Tr,Qr,Pr,Vr)}const Us=xs.positionedLines.length===1;if(m_+=kf(zt,ri,xs,Kr,wr,Pr,Yi,pr,na,tn.vertical?p.ah.horizontal:p.ah.horizontalOnly,Us?g_:[jr],il,Ku,yn,An),Us)break}tn.vertical&&(_d+=kf(zt,ri,tn.vertical,Kr,wr,Pr,Yi,pr,na,p.ah.vertical,["vertical"],il,Qu,yn,An));const __=ja?ja.boxStartIndex:zt.collisionBoxArray.length,y_=ja?ja.boxEndIndex:zt.collisionBoxArray.length,v_=sa?sa.boxStartIndex:zt.collisionBoxArray.length,b_=sa?sa.boxEndIndex:zt.collisionBoxArray.length,Om=ra?ra.boxStartIndex:zt.collisionBoxArray.length,x_=ra?ra.boxEndIndex:zt.collisionBoxArray.length,w_=Sr?Sr.boxStartIndex:zt.collisionBoxArray.length,Nf=Sr?Sr.boxEndIndex:zt.collisionBoxArray.length;let Va=-1;const zf=(jr,xs)=>jr&&jr.circleDiameter?Math.max(jr.circleDiameter,xs):xs;Va=zf(ja,Va),Va=zf(sa,Va),Va=zf(ra,Va),Va=zf(Sr,Va);const Lf=Va>-1?1:0;Lf&&(Va*=Yl/sr),zt.glyphOffsetArray.length>=Dc.MAX_GLYPHS&&At("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Yi.sortKey!==void 0&&zt.addToSortKeyRanges(zt.symbolInstances.length,Yi.sortKey);const km=f_(wr,Yi,An),[Ff,Bm]=(function(jr,xs){const Us=jr.length,Vr=xs==null?void 0:xs.values;if((Vr==null?void 0:Vr.length)>0)for(let js=0;js<Vr.length;js+=2){const Vs=Vr[js+1];jr.emplaceBack(p.aq[Vr[js]],Vs[0],Vs[1])}return[Us,jr.length]})(zt.textAnchorOffsets,km);zt.symbolInstances.emplaceBack(ri.x,ri.y,il.right>=0?il.right:-1,il.center>=0?il.center:-1,il.left>=0?il.left:-1,il.vertical||-1,Ku,Qu,Ju,__,y_,v_,b_,Om,x_,w_,Nf,hs,m_,_d,tl,zc,Lf,0,Tr,Va,Ff,Bm)})(l,kt,Ye,u,g,v,Bt,l.layers[0],l.collisionBoxArray,s.index,s.sourceLayerIndex,l.index,ce,[De,De,De,De],Rt,P,Be,Xe,Yt,Z,s,T,k,z,S)};if(_t==="line")for(const Ye of u_(s.geometry,0,0,Kn,Kn)){const kt=fo(Ye,Ae,ct,u.vertical||K,g,24,fe,l.overscaling,Kn);for(const zt of kt)K&&Pm(l,K.text,St,zt)||It(Ye,zt)}else if(_t==="line-center"){for(const Ye of s.geometry)if(Ye.length>1){const kt=Xl(Ye,ct,u.vertical||K,g,24,fe);kt&&It(Ye,kt)}}else if(s.type==="Polygon")for(const Ye of nu(s.geometry,0)){const kt=d_(Ye,16);It(Ye[0],new Ua(kt.x,kt.y,0))}else if(s.type==="LineString")for(const Ye of s.geometry)It(Ye,new Ua(Ye[0].x,Ye[0].y,0));else if(s.type==="Point")for(const Ye of s.geometry)for(const kt of Ye)It([kt],new Ua(kt.x,kt.y,0))}function kf(l,s,u,g,v,T,S,C,P,k,z,U,W,Z,K){const J=(function(Be,Ae,De,Xe,ct,Rt,Yt,_t){const St=Xe.layout.get("text-rotate").evaluate(Rt,{})*Math.PI/180,Lt=[];for(const Bt of Ae.positionedLines)for(const It of Bt.positionedGlyphs){if(!It.rect)continue;const Ye=It.rect||{};let kt=Qi+1,zt=!0,ri=1,zi=0;const tn=(ct||_t)&&It.vertical,xr=It.metrics.advance*It.scale/2;if(_t&&Ae.verticalizable&&(zi=Bt.lineOffset/2-(It.imageName?-(sr-It.metrics.width*It.scale)/2:(It.scale-1)*sr)),It.imageName){const Pi=Yt[It.imageName];zt=Pi.sdf,ri=Pi.pixelRatio,kt=ci/ri}const Kr=ct?[It.x+xr,It.y]:[0,0];let Mr=ct?[0,0]:[It.x+xr+De[0],It.y+De[1]-zi],wr=[0,0];tn&&(wr=Mr,Mr=[0,0]);const us=It.metrics.isDoubleResolution?2:1,hs=(It.metrics.left-kt)*It.scale-xr+Mr[0],ds=(-It.metrics.top-kt)*It.scale+Mr[1],Yn=hs+Ye.w/us*It.scale/ri,Tr=ds+Ye.h/us*It.scale/ri,Qr=new N(hs,ds),Pr=new N(Yn,ds),pr=new N(hs,Tr),ar=new N(Yn,Tr);if(tn){const Pi=new N(-xr,xr-xa),Yi=-Math.PI/2,yn=sr/2-xr,Jr=new N(5-xa-yn,-(It.imageName?yn:0)),An=new N(...wr);Qr._rotateAround(Yi,Pi)._add(Jr)._add(An),Pr._rotateAround(Yi,Pi)._add(Jr)._add(An),pr._rotateAround(Yi,Pi)._add(Jr)._add(An),ar._rotateAround(Yi,Pi)._add(Jr)._add(An)}if(St){const Pi=Math.sin(St),Yi=Math.cos(St),yn=[Yi,-Pi,Pi,Yi];Qr._matMult(yn),Pr._matMult(yn),pr._matMult(yn),ar._matMult(yn)}const Fs=new N(0,0),bs=new N(0,0);Lt.push({tl:Qr,tr:Pr,bl:pr,br:ar,tex:Ye,writingMode:Ae.writingMode,glyphOffset:Kr,sectionIndex:It.sectionIndex,isSDF:zt,pixelOffsetTL:Fs,pixelOffsetBR:bs,minFontScaleX:0,minFontScaleY:0})}return Lt})(0,u,C,v,T,S,g,l.allowVerticalPlacement),ce=l.textSizeData;let fe=null;ce.kind==="source"?(fe=[Gr*v.layout.get("text-size").evaluate(S,{})],fe[0]>ta&&At(`${l.layerIds[0]}: Value for "text-size" is >= ${Jn}. Reduce your "text-size".`)):ce.kind==="composite"&&(fe=[Gr*Z.compositeTextSizes[0].evaluate(S,{},K),Gr*Z.compositeTextSizes[1].evaluate(S,{},K)],(fe[0]>ta||fe[1]>ta)&&At(`${l.layerIds[0]}: Value for "text-size" is >= ${Jn}. Reduce your "text-size".`)),l.addSymbols(l.text,J,fe,C,T,S,k,s,P.lineStartIndex,P.lineLength,W,K);for(const Be of z)U[Be]=l.text.placedSymbolArray.length-1;return 4*J.length}function hd(l){for(const s in l)return l[s];return null}function Pm(l,s,u,g){const v=l.compareText;if(s in v){const T=v[s];for(let S=T.length-1;S>=0;S--)if(g.dist(T[S])<u)return!0}else v[s]=[];return v[s].push(g),!1}const Im=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class dd{static from(s){if(!(s instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[u,g]=new Uint8Array(s,0,2);if(u!==219)throw new Error("Data does not appear to be in a KDBush format.");const v=g>>4;if(v!==1)throw new Error(`Got v${v} data when expected v1.`);const T=Im[15&g];if(!T)throw new Error("Unrecognized array type.");const[S]=new Uint16Array(s,2,1),[C]=new Uint32Array(s,4,1);return new dd(C,S,T,s)}constructor(s,u=64,g=Float64Array,v){if(isNaN(s)||s<0)throw new Error(`Unpexpected numItems value: ${s}.`);this.numItems=+s,this.nodeSize=Math.min(Math.max(+u,2),65535),this.ArrayType=g,this.IndexArrayType=s<65536?Uint16Array:Uint32Array;const T=Im.indexOf(this.ArrayType),S=2*s*this.ArrayType.BYTES_PER_ELEMENT,C=s*this.IndexArrayType.BYTES_PER_ELEMENT,P=(8-C%8)%8;if(T<0)throw new Error(`Unexpected typed array class: ${g}.`);v&&v instanceof ArrayBuffer?(this.data=v,this.ids=new this.IndexArrayType(this.data,8,s),this.coords=new this.ArrayType(this.data,8+C+P,2*s),this._pos=2*s,this._finished=!0):(this.data=new ArrayBuffer(8+S+C+P),this.ids=new this.IndexArrayType(this.data,8,s),this.coords=new this.ArrayType(this.data,8+C+P,2*s),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+T]),new Uint16Array(this.data,2,1)[0]=u,new Uint32Array(this.data,4,1)[0]=s)}add(s,u){const g=this._pos>>1;return this.ids[g]=g,this.coords[this._pos++]=s,this.coords[this._pos++]=u,g}finish(){const s=this._pos>>1;if(s!==this.numItems)throw new Error(`Added ${s} items when expected ${this.numItems}.`);return Nc(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(s,u,g,v){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:T,coords:S,nodeSize:C}=this,P=[0,T.length-1,0],k=[];for(;P.length;){const z=P.pop()||0,U=P.pop()||0,W=P.pop()||0;if(U-W<=C){for(let ce=W;ce<=U;ce++){const fe=S[2*ce],Be=S[2*ce+1];fe>=s&&fe<=g&&Be>=u&&Be<=v&&k.push(T[ce])}continue}const Z=W+U>>1,K=S[2*Z],J=S[2*Z+1];K>=s&&K<=g&&J>=u&&J<=v&&k.push(T[Z]),(z===0?s<=K:u<=J)&&(P.push(W),P.push(Z-1),P.push(1-z)),(z===0?g>=K:v>=J)&&(P.push(Z+1),P.push(U),P.push(1-z))}return k}within(s,u,g){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:v,coords:T,nodeSize:S}=this,C=[0,v.length-1,0],P=[],k=g*g;for(;C.length;){const z=C.pop()||0,U=C.pop()||0,W=C.pop()||0;if(U-W<=S){for(let ce=W;ce<=U;ce++)p_(T[2*ce],T[2*ce+1],s,u)<=k&&P.push(v[ce]);continue}const Z=W+U>>1,K=T[2*Z],J=T[2*Z+1];p_(K,J,s,u)<=k&&P.push(v[Z]),(z===0?s-g<=K:u-g<=J)&&(C.push(W),C.push(Z-1),C.push(1-z)),(z===0?s+g>=K:u+g>=J)&&(C.push(Z+1),C.push(U),C.push(1-z))}return P}}function Nc(l,s,u,g,v,T){if(v-g<=u)return;const S=g+v>>1;fd(l,s,S,g,v,T),Nc(l,s,u,g,S-1,1-T),Nc(l,s,u,S+1,v,1-T)}function fd(l,s,u,g,v,T){for(;v>g;){if(v-g>600){const k=v-g+1,z=u-g+1,U=Math.log(k),W=.5*Math.exp(2*U/3),Z=.5*Math.sqrt(U*W*(k-W)/k)*(z-k/2<0?-1:1);fd(l,s,u,Math.max(g,Math.floor(u-z*W/k+Z)),Math.min(v,Math.floor(u+(k-z)*W/k+Z)),T)}const S=s[2*u+T];let C=g,P=v;for(pd(l,s,g,u),s[2*v+T]>S&&pd(l,s,g,v);C<P;){for(pd(l,s,C,P),C++,P--;s[2*C+T]<S;)C++;for(;s[2*P+T]>S;)P--}s[2*g+T]===S?pd(l,s,g,P):(P++,pd(l,s,P,v)),P<=u&&(g=P+1),u<=P&&(v=P-1)}}function pd(l,s,u,g){Bf(l,u,g),Bf(s,2*u,2*g),Bf(s,2*u+1,2*g+1)}function Bf(l,s,u){const g=l[s];l[s]=l[u],l[u]=g}function p_(l,s,u,g){const v=l-u,T=s-g;return v*v+T*T}var Dm;p.bg=void 0,(Dm=p.bg||(p.bg={})).create="create",Dm.load="load",Dm.fullLoad="fullLoad";let md=null,Gu=[];const cn=1e3/60,gd="loadTime",Rr="fullLoadTime",Mv={mark(l){performance.mark(l)},frame(l){const s=l;md!=null&&Gu.push(s-md),md=s},clearMetrics(){md=null,Gu=[],performance.clearMeasures(gd),performance.clearMeasures(Rr);for(const l in p.bg)performance.clearMarks(p.bg[l])},getPerformanceMetrics(){performance.measure(gd,p.bg.create,p.bg.load),performance.measure(
vendor: 6,613 bytes, line 53
53Rr,p.bg.create,p.bg.fullLoad);const l=performance.getEntriesByName(gd)[0].duration,s=performance.getEntriesByName(Rr)[0].duration,u=Gu.length,g=1/(Gu.reduce(((T,S)=>T+S),0)/u/1e3),v=Gu.filter((T=>T>cn)).reduce(((T,S)=>T+(S-cn)/cn),0);return{loadTime:l,fullLoadTime:s,fps:g,percentDroppedFrames:v/(u+v)*100,totalFrames:u}}};p.$=class extends ${},p.A=Ll,p.B=rf,p.C=function(l){if(Le==null){const s=l.navigator?l.navigator.userAgent:null;Le=!!l.safari||!(!s||!(/\b(iPad|iPhone|iPod)\b/.test(s)||s.match("Safari")&&!s.match("Chrome")))}return Le},p.D=Nt,p.E=Cn,p.F=class{constructor(l,s){this.target=l,this.mapId=s,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Ev((()=>this.process())),this.subscription=(function(u,g,v,T){return u.addEventListener(g,v,!1),{unsubscribe:()=>{u.removeEventListener(g,v,!1)}}})(this.target,"message",(u=>this.receive(u))),this.globalScope=Dt(self)?l:window}registerMessageHandler(l,s){this.messageHandlers[l]=s}sendAsync(l,s){return new Promise(((u,g)=>{const v=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[v]={resolve:u,reject:g},s&&s.signal.addEventListener("abort",(()=>{delete this.resolveRejects[v];const C={id:v,type:"<cancel>",origin:location.origin,targetMapId:l.targetMapId,sourceMapId:this.mapId};this.target.postMessage(C)}),{once:!0});const T=[],S=Object.assign(Object.assign({},l),{id:v,sourceMapId:this.mapId,origin:location.origin,data:_s(l.data,T)});this.target.postMessage(S,{transfer:T})}))}receive(l){const s=l.data,u=s.id;if(!(s.origin!=="file://"&&location.origin!=="file://"&&s.origin!=="resource://android"&&location.origin!=="resource://android"&&s.origin!==location.origin||s.targetMapId&&this.mapId!==s.targetMapId)){if(s.type==="<cancel>"){delete this.tasks[u];const g=this.abortControllers[u];return delete this.abortControllers[u],void(g&&g.abort())}if(Dt(self)||s.mustQueue)return this.tasks[u]=s,this.taskQueue.push(u),void this.invoker.trigger();this.processTask(u,s)}}process(){if(this.taskQueue.length===0)return;const l=this.taskQueue.shift(),s=this.tasks[l];delete this.tasks[l],this.taskQueue.length>0&&this.invoker.trigger(),s&&this.processTask(l,s)}processTask(l,s){return h(this,void 0,void 0,(function*(){if(s.type==="<response>"){const v=this.resolveRejects[l];return delete this.resolveRejects[l],v?void(s.error?v.reject(jo(s.error)):v.resolve(jo(s.data))):void 0}if(!this.messageHandlers[s.type])return void this.completeTask(l,new Error(`Could not find a registered handler for ${s.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const u=jo(s.data),g=new AbortController;this.abortControllers[l]=g;try{const v=yield this.messageHandlers[s.type](s.sourceMapId,u,g);this.completeTask(l,null,v)}catch(v){this.completeTask(l,v)}}))}completeTask(l,s,u){const g=[];delete this.abortControllers[l];const v={id:l,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:s?_s(s):null,data:_s(u,g)};this.target.postMessage(v,{transfer:g})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},p.G=qt,p.H=function(){var l=new Ll(16);return Ll!=Float32Array&&(l[1]=0,l[2]=0,l[3]=0,l[4]=0,l[6]=0,l[7]=0,l[8]=0,l[9]=0,l[11]=0,l[12]=0,l[13]=0,l[14]=0),l[0]=1,l[5]=1,l[10]=1,l[15]=1,l},p.I=Ni,p.J=function(l,s,u){var g,v,T,S,C,P,k,z,U,W,Z,K,J=u[0],ce=u[1],fe=u[2];return s===l?(l[12]=s[0]*J+s[4]*ce+s[8]*fe+s[12],l[13]=s[1]*J+s[5]*ce+s[9]*fe+s[13],l[14]=s[2]*J+s[6]*ce+s[10]*fe+s[14],l[15]=s[3]*J+s[7]*ce+s[11]*fe+s[15]):(v=s[1],T=s[2],S=s[3],C=s[4],P=s[5],k=s[6],z=s[7],U=s[8],W=s[9],Z=s[10],K=s[11],l[0]=g=s[0],l[1]=v,l[2]=T,l[3]=S,l[4]=C,l[5]=P,l[6]=k,l[7]=z,l[8]=U,l[9]=W,l[10]=Z,l[11]=K,l[12]=g*J+C*ce+U*fe+s[12],l[13]=v*J+P*ce+W*fe+s[13],l[14]=T*J+k*ce+Z*fe+s[14],l[15]=S*J+z*ce+K*fe+s[15]),l},p.K=function(l,s,u){var g=u[0],v=u[1],T=u[2];return l[0]=s[0]*g,l[1]=s[1]*g,l[2]=s[2]*g,l[3]=s[3]*g,l[4]=s[4]*v,l[5]=s[5]*v,l[6]=s[6]*v,l[7]=s[7]*v,l[8]=s[8]*T,l[9]=s[9]*T,l[10]=s[10]*T,l[11]=s[11]*T,l[12]=s[12],l[13]=s[13],l[14]=s[14],l[15]=s[15],l},p.L=Hp,p.M=function(l,s){const u={};for(let g=0;g<s.length;g++){const v=s[g];v in l&&(u[v]=l[v])}return u},p.N=Wl,p.O=kc,p.P=N,p.Q=od,p.R=Bs,p.S=cs,p.T=Tu,p.U=me,p.V=we,p.W=ei,p.X=Kn,p.Y=M,p.Z=Hu,p._=h,p.a=Tt,p.a$=function(l,s){var u=l[0],g=l[1],v=l[2],T=l[3],S=l[4],C=l[5],P=l[6],k=l[7],z=l[8],U=l[9],W=l[10],Z=l[11],K=l[12],J=l[13],ce=l[14],fe=l[15],Be=s[0],Ae=s[1],De=s[2],Xe=s[3],ct=s[4],Rt=s[5],Yt=s[6],_t=s[7],St=s[8],Lt=s[9],Bt=s[10],It=s[11],Ye=s[12],kt=s[13],zt=s[14],ri=s[15];return Math.abs(u-Be)<=Yr*Math.max(1,Math.abs(u),Math.abs(Be))&&Math.abs(g-Ae)<=Yr*Math.max(1,Math.abs(g),Math.abs(Ae))&&Math.abs(v-De)<=Yr*Math.max(1,Math.abs(v),Math.abs(De))&&Math.abs(T-Xe)<=Yr*Math.max(1,Math.abs(T),Math.abs(Xe))&&Math.abs(S-ct)<=Yr*Math.max(1,Math.abs(S),Math.abs(ct))&&Math.abs(C-Rt)<=Yr*Math.max(1,Math.abs(C),Math.abs(Rt))&&Math.abs(P-Yt)<=Yr*Math.max(1,Math.abs(P),Math.abs(Yt))&&Math.abs(k-_t)<=Yr*Math.max(1,Math.abs(k),Math.abs(_t))&&Math.abs(z-St)<=Yr*Math.max(1,Math.abs(z),Math.abs(St))&&Math.abs(U-Lt)<=Yr*Math.max(1,Math.abs(U),Math.abs(Lt))&&Math.abs(W-Bt)<=Yr*Math.max(1,Math.abs(W),Math.abs(Bt))&&Math.abs(Z-It)<=Yr*Math.max(1,Math.abs(Z),Math.abs(It))&&Math.abs(K-Ye)<=Yr*Math.max(1,Math.abs(K),Math.abs(Ye))&&Math.abs(J-kt)<=Yr*Math.max(1,Math.abs(J),Math.abs(kt))&&Math.abs(ce-zt)<=Yr*Math.max(1,Math.abs(ce),Math.abs(zt))&&Math.abs(fe-ri)<=Yr*Math.max(1,Math.abs(fe),Math.abs(ri))},p.a0=wi,p.a1=Rf,p.a2=pt,p.a3=l=>{const s=window.document.createElement("video");return s.muted=!0,new Promise((u=>{s.onloadstart=()=>{u(s)};for(const g of l){const v=window.document.createElement("source");Er(g)||(s.crossOrigin="Anonymous"),v.src=g,s.appendChild(v)}}))},p.a4=function(){return Je++},p.a5=Ct,p.a6=Dc,p.a7=du,p.a8=Nl,p.a9=Mf,p.aA=function(l){if(l.type==="custom")return new ym(l);switch(l.type){case"background":return new a_(l);case"circle":return new vv(l);case"fill":return new jg(l);case"fill-extrusion":return new Zh(l);case"heatmap":return new pf(l);case"hillshade":return new $h(l);case"line":return new Gg(l);case"raster":return new Ef(l);case"symbol":return new $u(l)}},p.aB=Qe,p.aC=function(l,s){if(!l)return[{command:"setStyle",args:[s]}];let u=[];try{if(!Ut(l.version,s.version))return[{command:"setStyle",args:[s]}];Ut(l.center,s.center)||u.push({command:"setCenter",args:[s.center]}),Ut(l.zoom,s.zoom)||u.push({command:"setZoom",args:[s.zoom]}),Ut(l.bearing,s.bearing)||u.push({command:"setBearing",args:[s.bearing]}),Ut(l.pitch,s.pitch)||u.push({command:"setPitch",args:[s.pitch]}
vendor: 16,134 bytes, line 53
53),Ut(l.sprite,s.sprite)||u.push({command:"setSprite",args:[s.sprite]}),Ut(l.glyphs,s.glyphs)||u.push({command:"setGlyphs",args:[s.glyphs]}),Ut(l.transition,s.transition)||u.push({command:"setTransition",args:[s.transition]}),Ut(l.light,s.light)||u.push({command:"setLight",args:[s.light]}),Ut(l.terrain,s.terrain)||u.push({command:"setTerrain",args:[s.terrain]}),Ut(l.sky,s.sky)||u.push({command:"setSky",args:[s.sky]}),Ut(l.projection,s.projection)||u.push({command:"setProjection",args:[s.projection]});const g={},v=[];(function(S,C,P,k){let z;for(z in C=C||{},S=S||{})Object.prototype.hasOwnProperty.call(S,z)&&(Object.prototype.hasOwnProperty.call(C,z)||or(z,P,k));for(z in C)Object.prototype.hasOwnProperty.call(C,z)&&(Object.prototype.hasOwnProperty.call(S,z)?Ut(S[z],C[z])||(S[z].type==="geojson"&&C[z].type==="geojson"&&sn(S,C,z)?Ri(P,{command:"setGeoJSONSourceData",args:[z,C[z].data]}):vn(z,C,P,k)):Gi(z,C,P))})(l.sources,s.sources,v,g);const T=[];l.layers&&l.layers.forEach((S=>{"source"in S&&g[S.source]?u.push({command:"removeLayer",args:[S.id]}):T.push(S)})),u=u.concat(v),(function(S,C,P){C=C||[];const k=(S=S||[]).map(lr),z=C.map(lr),U=S.reduce(Ss,{}),W=C.reduce(Ss,{}),Z=k.slice(),K=Object.create(null);let J,ce,fe,Be,Ae;for(let De=0,Xe=0;De<k.length;De++)J=k[De],Object.prototype.hasOwnProperty.call(W,J)?Xe++:(Ri(P,{command:"removeLayer",args:[J]}),Z.splice(Z.indexOf(J,Xe),1));for(let De=0,Xe=0;De<z.length;De++)J=z[z.length-1-De],Z[Z.length-1-De]!==J&&(Object.prototype.hasOwnProperty.call(U,J)?(Ri(P,{command:"removeLayer",args:[J]}),Z.splice(Z.lastIndexOf(J,Z.length-Xe),1)):Xe++,Be=Z[Z.length-De],Ri(P,{command:"addLayer",args:[W[J],Be]}),Z.splice(Z.length-De,0,J),K[J]=!0);for(let De=0;De<z.length;De++)if(J=z[De],ce=U[J],fe=W[J],!K[J]&&!Ut(ce,fe))if(Ut(ce.source,fe.source)&&Ut(ce["source-layer"],fe["source-layer"])&&Ut(ce.type,fe.type)){for(Ae in bn(ce.layout,fe.layout,P,J,null,"setLayoutProperty"),bn(ce.paint,fe.paint,P,J,null,"setPaintProperty"),Ut(ce.filter,fe.filter)||Ri(P,{command:"setFilter",args:[J,fe.filter]}),Ut(ce.minzoom,fe.minzoom)&&Ut(ce.maxzoom,fe.maxzoom)||Ri(P,{command:"setLayerZoomRange",args:[J,fe.minzoom,fe.maxzoom]}),ce)Object.prototype.hasOwnProperty.call(ce,Ae)&&Ae!=="layout"&&Ae!=="paint"&&Ae!=="filter"&&Ae!=="metadata"&&Ae!=="minzoom"&&Ae!=="maxzoom"&&(Ae.indexOf("paint.")===0?bn(ce[Ae],fe[Ae],P,J,Ae.slice(6),"setPaintProperty"):Ut(ce[Ae],fe[Ae])||Ri(P,{command:"setLayerProperty",args:[J,Ae,fe[Ae]]}));for(Ae in fe)Object.prototype.hasOwnProperty.call(fe,Ae)&&!Object.prototype.hasOwnProperty.call(ce,Ae)&&Ae!=="layout"&&Ae!=="paint"&&Ae!=="filter"&&Ae!=="metadata"&&Ae!=="minzoom"&&Ae!=="maxzoom"&&(Ae.indexOf("paint.")===0?bn(ce[Ae],fe[Ae],P,J,Ae.slice(6),"setPaintProperty"):Ut(ce[Ae],fe[Ae])||Ri(P,{command:"setLayerProperty",args:[J,Ae,fe[Ae]]}))}else Ri(P,{command:"removeLayer",args:[J]}),Be=Z[Z.lastIndexOf(J)+1],Ri(P,{command:"addLayer",args:[fe,Be]})})(T,s.layers,u)}catch(g){console.warn("Unable to compute style diff:",g),u=[{command:"setStyle",args:[s]}]}return u},p.aD=function(l){const s=[],u=l.id;return u===void 0&&s.push({message:`layers.${u}: missing required property "id"`}),l.render===void 0&&s.push({message:`layers.${u}: missing required method "render"`}),l.renderingMode&&l.renderingMode!=="2d"&&l.renderingMode!=="3d"&&s.push({message:`layers.${u}: property "renderingMode" must be either "2d" or "3d"`}),s},p.aE=function l(s,u){if(Array.isArray(s)){if(!Array.isArray(u)||s.length!==u.length)return!1;for(let g=0;g<s.length;g++)if(!l(s[g],u[g]))return!1;return!0}if(typeof s=="object"&&s!==null&&u!==null){if(typeof u!="object"||Object.keys(s).length!==Object.keys(u).length)return!1;for(const g in s)if(!l(s[g],u[g]))return!1;return!0}return s===u},p.aF=rt,p.aG=Ke,p.aH=class extends no{constructor(l,s){super(l,s),this.current=0}set(l){this.current!==l&&(this.current=l,this.gl.uniform1i(this.location,l))}},p.aI=Dl,p.aJ=class extends no{constructor(l,s){super(l,s),this.current=Xo}set(l){if(l[12]!==this.current[12]||l[0]!==this.current[0])return this.current=l,void this.gl.uniformMatrix4fv(this.location,!1,l);for(let s=1;s<16;s++)if(l[s]!==this.current[s]){this.current=l,this.gl.uniformMatrix4fv(this.location,!1,l);break}}},p.aK=zh,p.aL=of,p.aM=Fi,p.aN=class extends no{constructor(l,s){super(l,s),this.current=[0,0,0]}set(l){l[0]===this.current[0]&&l[1]===this.current[1]&&l[2]===this.current[2]||(this.current=l,this.gl.uniform3f(this.location,l[0],l[1],l[2]))}},p.aO=class extends no{constructor(l,s){super(l,s),this.current=[0,0]}set(l){l[0]===this.current[0]&&l[1]===this.current[1]||(this.current=l,this.gl.uniform2f(this.location,l[0],l[1]))}},p.aP=function(l,s,u,g,v,T,S){var C=1/(s-u),P=1/(g-v),k=1/(T-S);return l[0]=-2*C,l[1]=0,l[2]=0,l[3]=0,l[4]=0,l[5]=-2*P,l[6]=0,l[7]=0,l[8]=0,l[9]=0,l[10]=2*k,l[11]=0,l[12]=(s+u)*C,l[13]=(v+g)*P,l[14]=(S+T)*k,l[15]=1,l},p.aQ=Ig,p.aR=class extends Ce{},p.aS=Ns,p.aT=class extends ze{},p.aU=Vh,p.aV=function(l){return l<=1?1:Math.pow(2,Math.ceil(Math.log(l)/Math.LN2))},p.aW=Cu,p.aX=mn,p.aY=os,p.aZ=class extends Ot{},p.a_=function(l,s){return l[0]===s[0]&&l[1]===s[1]&&l[2]===s[2]&&l[3]===s[3]&&l[4]===s[4]&&l[5]===s[5]&&l[6]===s[6]&&l[7]===s[7]&&l[8]===s[8]&&l[9]===s[9]&&l[10]===s[10]&&l[11]===s[11]&&l[12]===s[12]&&l[13]===s[13]&&l[14]===s[14]&&l[15]===s[15]},p.aa=function(l){const s={};if(l.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((u,g,v,T)=>{const S=v||T;return s[g]=!S||S.toLowerCase(),""})),s["max-age"]){const u=parseInt(s["max-age"],10);isNaN(u)?delete s["max-age"]:s["max-age"]=u}return s},p.ab=function(l,s){const u=[];for(const g in l)g in s||u.push(g);return u},p.ac=Te,p.ad=function(l,s,u){var g=Math.sin(u),v=Math.cos(u),T=s[0],S=s[1],C=s[2],P=s[3],k=s[4],z=s[5],U=s[6],W=s[7];return s!==l&&(l[8]=s[8],l[9]=s[9],l[10]=s[10],l[11]=s[11],l[12]=s[12],l[13]=s[13],l[14]=s[14],l[15]=s[15]),l[0]=T*v+k*g,l[1]=S*v+z*g,l[2]=C*v+U*g,l[3]=P*v+W*g,l[4]=k*v-T*g,l[5]=z*v-S*g,l[6]=U*v-C*g,l[7]=W*v-P*g,l},p.ae=function(l){var s=new Ll(16);return s[0]=l[0],s[1]=l[1],s[2]=l[2],s[3]=l[3],s[4]=l[4],s[5]=l[5],s[6]=l[6],s[7]=l[7],s[8]=l[8],s[9]=l[9],s[10]=l[10],s[11]=l[11],s[12]=l[12],s[13]=l[13],s[14]=l[14],s[15]=l[15],s},p.af=Uh,p.ag=function(l,s){let u=0,g=0;if(l.kind==="constant")g=l.layoutSize;else if(l.kind!=="source"){const{interpolationType:v,minZoom:T,maxZoom:S}=l,C=v?Te(hr.interpolationFactor(v,s,T,S),0,1):0;l.kind==="camera"?g=Dr.number(l.minSize,l.maxSize,C):u=C}return{uSizeT:u,uSize:g}},p.ai=function(l,{uSize:s,uSizeT:u},{lowerSize:g,upperSize:v}){return l.kind==="source"?g/Gr:l.kind==="composite"?Dr.number(g/Gr,v/Gr,u):s},p.aj=sd,p.ak=function(l,s,u,g){const v=s.y-l.y,T=s.x-l.x,S=g.y-u.y,C=g.x-u.x,P=S*T-C*v;if(P===0)return null;const k=(C*(l.y-u.y)-S*(l.x-u.x))/P;return new N(l.x+k*T,l.y+k*v)},p.al=u_,p.am=Lp,p.an=hf,p.ao=function(l){let s=1/0,u=1/0,g=-1/0,v=-1/0;for(const T of l)s=Math.min(s,T.x),u=Math.min(u,T.y),g=Math.max(g,T.x),v=Math.max(v,T.y);return[s,u,g,v]},p.ap=sr,p.ar=rd,p.as=function(l,s){var u=s[0],g=s[1],v=s[2],T=s[3],S=s[4],C=s[5],P=s[6],k=s[7],z=s[8],U=s[9],W=s[10],Z=s[11],K=s[12],J=s[13],ce=s[14],fe=s[15],Be=u*C-g*S,Ae=u*P-v*S,De=u*k-T*S,Xe=g*P-v*C,ct=g*k-T*C,Rt=v*k-T*P,Yt=z*J-U*K,_t=z*ce-W*K,St=z*fe-Z*K,Lt=U*ce-W*J,Bt=U*fe-Z*J,It=W*fe-Z*ce,Ye=Be*It-Ae*Bt+De*Lt+Xe*St-ct*_t+Rt*Yt;return Ye?(l[0]=(C*It-P*Bt+k*Lt)*(Ye=1/Ye),l[1]=(v*Bt-g*It-T*Lt)*Ye,l[2]=(J*Rt-ce*ct+fe*Xe)*Ye,l[3]=(W*ct-U*Rt-Z*Xe)*Ye,l[4]=(P*St-S*It-k*_t)*Ye,l[5]=(u*It-v*St+T*_t)*Ye,l[6]=(ce*De-K*Rt-fe*Ae)*Ye,l[7]=(z*Rt-W*De+Z*Ae)*Ye,l[8]=(S*Bt-C*St+k*Yt)*Ye,l[9]=(g*St-u*Bt-T*Yt)*Ye,l[10]=(K*ct-J*De+fe*Be)*Ye,l[11]=(U*De-z*ct-Z*Be)*Ye,l[12]=(C*_t-S*Lt-P*Yt)*Ye,l[13]=(u*Lt-g*_t+v*Yt)*Ye,l[14]=(J*Ae-K*Xe-ce*Be)*Ye,l[15]=(z*Xe-U*Ae+W*Be)*Ye,l):null},p.at=Of,p.au=Vu,p.av=dd,p.aw=function(){const l={},s=_e.$version;for(const u in _e.$root){const g=_e.$root[u];if(g.required){let v=null;v=u==="version"?s:g.type==="array"?[]:{},v!=null&&(l[u]=v)}}return l},p.ax=xu,p.ay=Li,p.az=function(l){l=l.slice();const s=Object.create(null);for(let u=0;u<l.length;u++)s[l[u].id]=l[u];for(let u=0;u<l.length;u++)"ref"in l[u]&&(l[u]=gt(l[u],s[l[u].ref]));return l},p.b=nt,p.b0=function(l,s){return l[0]=s[0],l[1]=s[1],l[2]=s[2],l[3]=s[3],l[4]=s[4],l[5]=s[5],l[6]=s[6],l[7]=s[7],l[8]=s[8],l[9]=s[9],l[10]=s[10],l[11]=s[11],l[12]=s[12],l[13]=s[13],l[14]=s[14],l[15]=s[15],l},p.b1=function(l,s,u){return l[0]=s[0]*u[0],l[1]=s[1]*u[1],l[2]=s[2]*u[2],l[3]=s[3]*u[3],l},p.b2=function(l,s){return l[0]*s[0]+l[1]*s[1]+l[2]*s[2]+l[3]*s[3]},p.b3=Re,p.b4=Sm,p.b5=wm,p.b6=function(l,s,u,g,v){var T,S=1/Math.tan(s/2);return l[0]=S/u,l[1]=0,l[2]=0,l[3]=0,l[4]=0,l[5]=S,l[6]=0,l[7]=0,l[8]=0,l[9]=0,l[11]=-1,l[12]=0,l[13]=0,l[15]=0,v!=null&&v!==1/0?(l[10]=(v+g)*(T=1/(g-v)),l[14]=2*v*g*T):(l[10]=-1,l[14]=-2*g),l},p.b7=function(l,s,u){var g=Math.sin(u),v=Math.cos(u),T=s[4],S=s[5],C=s[6],P=s[7],k=s[8],z=s[9],U=s[10],W=s[11];return s!==l&&(l[0]=s[0],l[1]=s[1],l[2]=s[2],l[3]=s[3],l[12]=s[12],l[13]=s[13],l[14]=s[14],l[15]=s[15]),l[4]=T*v+k*g,l[5]=S*v+z*g,l[6]=C*v+U*g,l[7]=P*v+W*g,l[8]=k*v-T*g,l[9]=z*v-S*g,l[10]=U*v-C*g,l[11]=W*v-P*g,l},p.b8=ve,p.b9=Oe,p.bA=hm,p.bB=function(l){return l.message===Ue},p.bC=No,p.bD=dr,p.ba=function(l){return l*Math.PI/180},p.bb=function(l,s){const{x:u,y:g}=Hu.fromLngLat(s);return!(l<0||l>25||g<0||g>=1||u<0||u>=1)},p.bc=function(l,s){return l[0]=s[0],l[1]=0,l[2]=0,l[3]=0,l[4]=0,l[5]=s[1],l[6]=0,l[7]=0,l[8]=0,l[9]=0,l[10]=s[2],l[11]=0,l[12]=0,l[13]=0,l[14]=0,l[15]=1,l},p.bd=class extends L{},p.be=vm,p.bf=Mv,p.bh=ti,p.bi=function(l,s){Tt.REGISTERED_PROTOCOLS[l]=s},p.bj=function(l){delete Tt.REGISTERED_PROTOCOLS[l]},p.bk=function(l,s){const u={};for(let v=0;v<l.length;v++){const T=s&&s[l[v].id]||ms(l[v]);s&&(s[l[v].id]=T);let S=u[T];S||(S=u[T]=[]),S.push(l[v])}const g=[];for(const v in u)g.push(u[v]);return g},p.bl=lt,p.bm=ln,p.bn=l_,p.bo=on,p.bp=function(l){l.bucket.createArrays(),l.bucket.tilePixelRatio=Kn/(512*l.bucket.overscaling),l.bucket.compareText={},l.bucket.iconsNeedLinear=!1;const s=l.bucket.layers[0],u=s.layout,g=s._unevaluatedLayout._values,v={layoutIconSize:g["icon-size"].possiblyEvaluate(new xi(l.bucket.zoom+1),l.canonical),layoutTextSize:g["text-size"].possiblyEvaluate(new xi(l.bucket.zoom+1),l.canonical),textMaxSize:g["text-size"].possiblyEvaluate(new xi(18))};if(l.bucket.textSizeData.kind==="composite"){const{minZoom:k,maxZoom:z}=l.bucket.textSizeData;v.compositeTextSizes=[g["text-size"].possiblyEvaluate(new xi(k),l.canonical),g["text-size"].possiblyEvaluate(new xi(z),l.canonical)]}if(l.bucket.iconSizeData.kind==="composite"){const{minZoom:k,maxZoom:z}=l.bucket.iconSizeData;v.compositeIconSizes=[g["icon-size"].possiblyEvaluate(new xi(k),l.canonical),g["icon-size"].possiblyEvaluate(new xi(z),l.canonical)]}const T=u.get("text-line-height")*sr,S=u.get("text-rotation-alignment")!=="viewport"&&u.get("symbol-placement")!=="point",C=u.get("text-keep-upright"),P=u.get("text-size");for(const k of l.bucket.features){const z=u.get("text-font").evaluate(k,{},l.canonical).join(","),U=P.evaluate(k,{},l.canonical),W=v.layoutTextSize.evaluate(k,{},l.canonical),Z=v.layoutIconSize.evaluate(k,{},l.canonical),K={horizontal:{},vertical:void 0},J=k.text;let ce,fe=[0,0];if(J){const De=J.toString(),Xe=u.get("text-letter-spacing").evaluate(k,{},l.canonical)*sr,ct=Ih(De)?Xe:0,Rt=u.get("text-anchor").evaluate(k,{},l.canonical),Yt=f_(s,k,l.canonical);if(!Yt){const Bt=u.get("text-radial-offset").evaluate(k,{},l.canonical);fe=Bt?Yu(Rt,[Bt*sr,Mm]):u.get("text-offset").evaluate(k,{},l.canonical).map((It=>It*sr))}let _t=S?"center":u.get("text-justify").evaluate(k,{},l.canonical);const St=u.get("symbol-placement")==="point"?u.get("text-max-width").evaluate(k,{},l.canonical)*sr:1/0,Lt=()=>{l.bucket.allowVerticalPlacement&&Oa(De)&&(K.vertical=wa(J,l.glyphMap,l.glyphPositions,l.imagePositions,z,St,T,Rt,"left",ct,fe,p.ah.vertical,!0,W,U))};if(!S&&Yt){const Bt=new Set;if(_t==="auto")for(let Ye=0;Ye<Yt.values.length;Ye+=2)Bt.add(Of(Yt.values[Ye]));else Bt.add(_t);let It=!1;for(const Ye of Bt)if(!K.horizontal[Ye])if(It)K.horizontal[Ye]=K.horizontal[0];else{const kt=wa(J,l.glyphMap,l.glyphPositions,l.imagePositions,z,St,T,"center",Ye,ct,fe,p.ah.horizontal,!1,W,U);kt&&(K.horizontal[Ye]=kt,It=kt.positionedLines.length===1)}Lt()}else{_t==="auto"&&(_t=Of(Rt));const Bt=wa(J,l.glyphMap,l.glyphPositions,l.imagePositions,z,St,T,Rt,_t,ct,fe,p.ah.horizontal,!1,W,U);Bt&&(K.horizontal[_t]=Bt),Lt(),Oa(De)&&S&&C&&(K.vertical=wa(J,l.glyphMap,l.glyphPositions,l.imagePositions,z,St,T,Rt,_t,ct,fe,p.ah.vertical,!1,W,U))}}let Be=!1;if(k.icon&&k.icon.name){const De=l.imageMap[k.icon.name];De&&(ce=Sf(l.imagePositions[k.icon.name],u.get("icon-offset").evaluate(k,{},l.canonical),u.get("icon-anchor").evaluate(k,{},l.canonical)),Be=!!De.sdf,l.bucket.sdfIcons===void 0?l.bucket.sdfIcons=Be:l.bucket.sdfIcons!==Be&&At("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(De.pixelRatio!==l.bucket.pixelRatio||u.get("icon-rotate").constantOr(1)!==0)&&(l.bucket.iconsNeedLinear=!0))}const Ae=hd(K.horizontal)||K.vertical;l.bucket.iconsInText=!!Ae&&Ae.iconsInText,(Ae||ce)&&Ui(l.bucket,k,K,ce,l.imageMap,v,W,Z,fe,Be,l.canonical)}l.showCollisionBoxes&&l.bucket.generateCollisionDebugBuffers()},p.bq=Gh,p.br=Ou,p.bs=Mc,p.bt=Go,p.bu=wf,p.bv=class{constructor(l){this._marks={start:[l.url,"start"].join("#"),end:[l.url,"end"].join("#"),measure:l.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let l=performance.getEntriesByName(this._marks.measure);return l.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),l=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),l}},p.bw=function(l,s,u,g,v){return h(this,void 0,void 0,(function*(){if(we())try{return yield ei(l,s,u,g,v)}catch{}return(function(T,S,C,P,k){const z=T.width,U=T.height;ai&&oe||(ai=new OffscreenCanvas(z,U),oe=ai.getContext("2d",{willReadFrequently:!0})),ai.width=z,ai.height=U,oe.drawImage(T,0,0,z,U);const W=oe.getImageData(S,C,P,k);return oe.clearRect(0,0,z,U),W.data})(l,s,u,g,v)}))},p.bx=Am,p.by=A,p.bz=R,p.c=ut,p.d=l=>h(void 0,void 0,void 0,(function*(){if(l.byteLength===0)return createImageBitmap(new ImageData(1,1));const s=new Blob([new Uint8Array(l)],{type:"image/png"});try{return createImageBitmap(s)}catch(u){throw new Error(`Could not load image because of ${u.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}})),p.e=Ee,p.f=l=>new Promise(((s,u)=>{const g=new Image;g.onload=()=>{s(g),URL.revokeObjectURL(g.src),g.onload=null,window.requestAnimationFrame((()=>{g.src=mt}))},g.onerror=()=>u(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 v=new Blob([new Uint8Array(l)],{type:"image/png"});g.src=l.byteLength?URL.createObjectURL(v):mt})),p.g=$t,p.h=(l,s)=>ki(Ee(l,{type:"json"}),s),p.i=Dt,p.j=pi,p.k=si,p.l=(l,s)=>ki(Ee(l,{type:"arrayBuffer"}),s),p.m=ki,p.n=function(l){return new wf(l).readFields(t_,[])},p.o=jh,p.p=Sn,p.q=w,p.r=Da,p.s=Er,p.t=vu,p.u=zr,p.v=_e,p.w=At,p.x=function([l,s,u]){return s+=90,s*=Math.PI/180,u*=Math.PI/180,{x:l*Math.cos(s)*Math.sin(u),y:l*Math.sin(s)*Math.sin(u),z:l*Math.cos(u)}},p.y=Dr,p.z=xi})),o("worker",["./shared"],(function(p){class h{constructor(q){this.keyCache={},q&&this.replace(q)}replace(q){this._layerConfigs={},this._layers={},this.update(q,[])}update(q,X){for(const ue of q){this._layerConfigs[ue.id]=ue;const Se=this._layers[ue.id]=p.aA(ue);Se._featureFilter=p.a7(Se.filter),this.keyCache[ue.id]&&delete this.keyCache[ue.id]}for(const ue of X)delete this.keyCache[ue],delete this._layerConfigs[ue],delete this._layers[ue];this.familiesBySource={};const ie=p.bk(Object.values(this._layerConfigs),this.keyCache);for(const ue of ie){const Se=ue.map((je=>this._layers[je.id])),Me=Se[0];if(Me.visibility==="none")continue;
vendor: 16,598 bytes, line 53
53const ke=Me.source||"";let ye=this.familiesBySource[ke];ye||(ye=this.familiesBySource[ke]={});const qe=Me.sourceLayer||"_geojsonTileLayer";let tt=ye[qe];tt||(tt=ye[qe]=[]),tt.push(Se)}}}class A{constructor(q){const X={},ie=[];for(const ke in q){const ye=q[ke],qe=X[ke]={};for(const tt in ye){const je=ye[+tt];if(!je||je.bitmap.width===0||je.bitmap.height===0)continue;const yt={x:0,y:0,w:je.bitmap.width+2,h:je.bitmap.height+2};ie.push(yt),qe[tt]={rect:yt,metrics:je.metrics}}}const{w:ue,h:Se}=p.p(ie),Me=new p.o({width:ue||1,height:Se||1});for(const ke in q){const ye=q[ke];for(const qe in ye){const tt=ye[+qe];if(!tt||tt.bitmap.width===0||tt.bitmap.height===0)continue;const je=X[ke][qe].rect;p.o.copy(tt.bitmap,Me,{x:0,y:0},{x:je.x+1,y:je.y+1},tt.bitmap)}}this.image=Me,this.positions=X}}p.bl("GlyphAtlas",A);class R{constructor(q){this.tileID=new p.S(q.tileID.overscaledZ,q.tileID.wrap,q.tileID.canonical.z,q.tileID.canonical.x,q.tileID.canonical.y),this.uid=q.uid,this.zoom=q.zoom,this.pixelRatio=q.pixelRatio,this.tileSize=q.tileSize,this.source=q.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=q.showCollisionBoxes,this.collectResourceTiming=!!q.collectResourceTiming,this.returnDependencies=!!q.returnDependencies,this.promoteId=q.promoteId,this.inFlightDependencies=[]}parse(q,X,ie,ue){return p._(this,void 0,void 0,(function*(){this.status="parsing",this.data=q,this.collisionBoxArray=new p.a5;const Se=new p.bm(Object.keys(q.layers).sort()),Me=new p.bn(this.tileID,this.promoteId);Me.bucketLayerIDs=[];const ke={},ye={featureIndex:Me,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:ie},qe=X.familiesBySource[this.source];for(const vi in qe){const qi=q.layers[vi];if(!qi)continue;qi.version===1&&p.w(`Vector tile source "${this.source}" layer "${vi}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Ji=Se.encode(vi),tr=[];for(let Hn=0;Hn<qi.length;Hn++){const ir=qi.feature(Hn),ua=Me.getId(ir,vi);tr.push({feature:ir,id:ua,index:Hn,sourceLayerIndex:Ji})}for(const Hn of qe[vi]){const ir=Hn[0];ir.source!==this.source&&p.w(`layer.source = ${ir.source} does not equal this.source = ${this.source}`),ir.minzoom&&this.zoom<Math.floor(ir.minzoom)||ir.maxzoom&&this.zoom>=ir.maxzoom||ir.visibility!=="none"&&(B(Hn,this.zoom,ie),(ke[ir.id]=ir.createBucket({index:Me.bucketLayerIDs.length,layers:Hn,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Ji,sourceID:this.source})).populate(tr,ye,this.tileID.canonical),Me.bucketLayerIDs.push(Hn.map((ua=>ua.id))))}}const tt=p.aF(ye.glyphDependencies,(vi=>Object.keys(vi).map(Number)));this.inFlightDependencies.forEach((vi=>vi==null?void 0:vi.abort())),this.inFlightDependencies=[];let je=Promise.resolve({});if(Object.keys(tt).length){const vi=new AbortController;this.inFlightDependencies.push(vi),je=ue.sendAsync({type:"GG",data:{stacks:tt,source:this.source,tileID:this.tileID,type:"glyphs"}},vi)}const yt=Object.keys(ye.iconDependencies);let jt=Promise.resolve({});if(yt.length){const vi=new AbortController;this.inFlightDependencies.push(vi),jt=ue.sendAsync({type:"GI",data:{icons:yt,source:this.source,tileID:this.tileID,type:"icons"}},vi)}const Xt=Object.keys(ye.patternDependencies);let yi=Promise.resolve({});if(Xt.length){const vi=new AbortController;this.inFlightDependencies.push(vi),yi=ue.sendAsync({type:"GI",data:{icons:Xt,source:this.source,tileID:this.tileID,type:"patterns"}},vi)}const[Vt,hi,gi]=yield Promise.all([je,jt,yi]),$n=new A(Vt),kn=new p.bo(hi,gi);for(const vi in ke){const qi=ke[vi];qi instanceof p.a6?(B(qi.layers,this.zoom,ie),p.bp({bucket:qi,glyphMap:Vt,glyphPositions:$n.positions,imageMap:hi,imagePositions:kn.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):qi.hasPattern&&(qi instanceof p.bq||qi instanceof p.br||qi instanceof p.bs)&&(B(qi.layers,this.zoom,ie),qi.addFeatures(ye,this.tileID.canonical,kn.patternPositions))}return this.status="done",{buckets:Object.values(ke).filter((vi=>!vi.isEmpty())),featureIndex:Me,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:$n.image,imageAtlas:kn,glyphMap:this.returnDependencies?Vt:null,iconMap:this.returnDependencies?hi:null,glyphPositions:this.returnDependencies?$n.positions:null}}))}}function B(de,q,X){const ie=new p.z(q);for(const ue of de)ue.recalculate(ie,X)}class N{constructor(q,X,ie){this.actor=q,this.layerIndex=X,this.availableImages=ie,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(q,X){return p._(this,void 0,void 0,(function*(){const ie=yield p.l(q.request,X);try{return{vectorTile:new p.bt.VectorTile(new p.bu(ie.data)),rawData:ie.data,cacheControl:ie.cacheControl,expires:ie.expires}}catch(ue){const Se=new Uint8Array(ie.data);let Me=`Unable to parse the tile at ${q.request.url}, `;throw Me+=Se[0]===31&&Se[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${ue.message}`,new Error(Me)}}))}loadTile(q){return p._(this,void 0,void 0,(function*(){const X=q.uid,ie=!!(q&&q.request&&q.request.collectResourceTiming)&&new p.bv(q.request),ue=new R(q);this.loading[X]=ue;const Se=new AbortController;ue.abort=Se;try{const Me=yield this.loadVectorTile(q,Se);if(delete this.loading[X],!Me)return null;const ke=Me.rawData,ye={};Me.expires&&(ye.expires=Me.expires),Me.cacheControl&&(ye.cacheControl=Me.cacheControl);const qe={};if(ie){const je=ie.finish();je&&(qe.resourceTiming=JSON.parse(JSON.stringify(je)))}ue.vectorTile=Me.vectorTile;const tt=ue.parse(Me.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[X]=ue,this.fetching[X]={rawTileData:ke,cacheControl:ye,resourceTiming:qe};try{const je=yield tt;return p.e({rawTileData:ke.slice(0)},je,ye,qe)}finally{delete this.fetching[X]}}catch(Me){throw delete this.loading[X],ue.status="done",this.loaded[X]=ue,Me}}))}reloadTile(q){return p._(this,void 0,void 0,(function*(){const X=q.uid;if(!this.loaded||!this.loaded[X])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const ie=this.loaded[X];if(ie.showCollisionBoxes=q.showCollisionBoxes,ie.status==="parsing"){const ue=yield ie.parse(ie.vectorTile,this.layerIndex,this.availableImages,this.actor);let Se;if(this.fetching[X]){const{rawTileData:Me,cacheControl:ke,resourceTiming:ye}=this.fetching[X];delete this.fetching[X],Se=p.e({rawTileData:Me.slice(0)},ue,ke,ye)}else Se=ue;return Se}if(ie.status==="done"&&ie.vectorTile)return ie.parse(ie.vectorTile,this.layerIndex,this.availableImages,this.actor)}))}abortTile(q){return p._(this,void 0,void 0,(function*(){const X=this.loading,ie=q.uid;X&&X[ie]&&X[ie].abort&&(X[ie].abort.abort(),delete X[ie])}))}removeTile(q){return p._(this,void 0,void 0,(function*(){this.loaded&&this.loaded[q.uid]&&delete this.loaded[q.uid]}))}}class F{constructor(){this.loaded={}}loadTile(q){return p._(this,void 0,void 0,(function*(){const{uid:X,encoding:ie,rawImageData:ue,redFactor:Se,greenFactor:Me,blueFactor:ke,baseShift:ye}=q,qe=ue.width+2,tt=ue.height+2,je=p.b(ue)?new p.R({width:qe,height:tt},yield p.bw(ue,-1,-1,qe,tt)):ue,yt=new p.bx(X,je,ie,Se,Me,ke,ye);return this.loaded=this.loaded||{},this.loaded[X]=yt,yt}))}removeTile(q){const X=this.loaded,ie=q.uid;X&&X[ie]&&delete X[ie]}}function Q(de,q){if(de.length!==0){re(de[0],q);for(var X=1;X<de.length;X++)re(de[X],!q)}}function re(de,q){for(var X=0,ie=0,ue=0,Se=de.length,Me=Se-1;ue<Se;Me=ue++){var ke=(de[ue][0]-de[Me][0])*(de[Me][1]+de[ue][1]),ye=X+ke;ie+=Math.abs(X)>=Math.abs(ke)?X-ye+ke:ke-ye+X,X=ye}X+ie>=0!=!!q&&de.reverse()}var se=p.by((function de(q,X){var ie,ue=q&&q.type;if(ue==="FeatureCollection")for(ie=0;ie<q.features.length;ie++)de(q.features[ie],X);else if(ue==="GeometryCollection")for(ie=0;ie<q.geometries.length;ie++)de(q.geometries[ie],X);else if(ue==="Feature")de(q.geometry,X);else if(ue==="Polygon")Q(q.coordinates,X);else if(ue==="MultiPolygon")for(ie=0;ie<q.coordinates.length;ie++)Q(q.coordinates[ie],X);return q}));const ae=p.bt.VectorTileFeature.prototype.toGeoJSON;var me={exports:{}},we=p.bz,ve=p.bt.VectorTileFeature,Oe=Te;function Te(de,q){this.options=q||{},this.features=de,this.length=de.length}function Re(de,q){this.id=typeof de.id=="number"?de.id:void 0,this.type=de.type,this.rawGeometry=de.type===1?[de.geometry]:de.geometry,this.properties=de.tags,this.extent=q||4096}Te.prototype.feature=function(de){return new Re(this.features[de],this.options.extent)},Re.prototype.loadGeometry=function(){var de=this.rawGeometry;this.geometry=[];for(var q=0;q<de.length;q++){for(var X=de[q],ie=[],ue=0;ue<X.length;ue++)ie.push(new we(X[ue][0],X[ue][1]));this.geometry.push(ie)}return this.geometry},Re.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var de=this.geometry,q=1/0,X=-1/0,ie=1/0,ue=-1/0,Se=0;Se<de.length;Se++)for(var Me=de[Se],ke=0;ke<Me.length;ke++){var ye=Me[ke];q=Math.min(q,ye.x),X=Math.max(X,ye.x),ie=Math.min(ie,ye.y),ue=Math.max(ue,ye.y)}return[q,ie,X,ue]},Re.prototype.toGeoJSON=ve.prototype.toGeoJSON;var Ee=p.bA,Je=Oe;function rt(de){var q=new Ee;return(function(X,ie){for(var ue in X.layers)ie.writeMessage(3,Ke,X.layers[ue])})(de,q),q.finish()}function Ke(de,q){var X;q.writeVarintField(15,de.version||1),q.writeStringField(1,de.name||""),q.writeVarintField(5,de.extent||4096);var ie={keys:[],values:[],keycache:{},valuecache:{}};for(X=0;X<de.length;X++)ie.feature=de.feature(X),q.writeMessage(2,Qe,ie);var ue=ie.keys;for(X=0;X<ue.length;X++)q.writeStringField(3,ue[X]);var Se=ie.values;for(X=0;X<Se.length;X++)q.writeMessage(4,Le,Se[X])}function Qe(de,q){var X=de.feature;X.id!==void 0&&q.writeVarintField(1,X.id),q.writeMessage(2,ht,de),q.writeVarintField(3,X.type),q.writeMessage(4,Dt,X)}function ht(de,q){var X=de.feature,ie=de.keys,ue=de.values,Se=de.keycache,Me=de.valuecache;for(var ke in X.properties){var ye=X.properties[ke],qe=Se[ke];if(ye!==null){qe===void 0&&(ie.push(ke),Se[ke]=qe=ie.length-1),q.writeVarint(qe);var tt=typeof ye;tt!=="string"&&tt!=="boolean"&&tt!=="number"&&(ye=JSON.stringify(ye));var je=tt+":"+ye,yt=Me[je];yt===void 0&&(ue.push(ye),Me[je]=yt=ue.length-1),q.writeVarint(yt)}}}function At(de,q){return(q<<3)+(7&de)}function Fe(de){return de<<1^de>>31}function Dt(de,q){for(var X=de.loadGeometry(),ie=de.type,ue=0,Se=0,Me=X.length,ke=0;ke<Me;ke++){var ye=X[ke],qe=1;ie===1&&(qe=ye.length),q.writeVarint(At(1,qe));for(var tt=ie===3?ye.length-1:ye.length,je=0;je<tt;je++){je===1&&ie!==1&&q.writeVarint(At(2,tt-1));var yt=ye[je].x-ue,jt=ye[je].y-Se;q.writeVarint(Fe(yt)),q.writeVarint(Fe(jt)),ue+=yt,Se+=jt}ie===3&&q.writeVarint(At(7,1))}}function Le(de,q){var X=typeof de;X==="string"?q.writeStringField(1,de):X==="boolean"?q.writeBooleanField(7,de):X==="number"&&(de%1!=0?q.writeDoubleField(3,de):de<0?q.writeSVarintField(6,de):q.writeVarintField(5,de))}me.exports=rt,me.exports.fromVectorTileJs=rt,me.exports.fromGeojsonVt=function(de,q){q=q||{};var X={};for(var ie in de)X[ie]=new Je(de[ie].features,q),X[ie].name=ie,X[ie].version=q.version,X[ie].extent=q.extent;return rt({layers:X})},me.exports.GeoJSONWrapper=Je;var nt=p.by(me.exports);const mt={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:de=>de},ei=Math.fround||(ai=new Float32Array(1),de=>(ai[0]=+de,ai[0]));var ai;const oe=3,Ue=5,ut=6;class Tt{constructor(q){this.options=Object.assign(Object.create(mt),q),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(q){const{log:X,minZoom:ie,maxZoom:ue}=this.options;X&&console.time("total time");const Se=`prepare ${q.length} points`;X&&console.time(Se),this.points=q;const Me=[];for(let ye=0;ye<q.length;ye++){const qe=q[ye];if(!qe.geometry)continue;const[tt,je]=qe.geometry.coordinates,yt=ei(ti(tt)),jt=ei(Li(je));Me.push(yt,jt,1/0,ye,-1,1),this.options.reduce&&Me.push(0)}let ke=this.trees[ue+1]=this._createTree(Me);X&&console.timeEnd(Se);for(let ye=ue;ye>=ie;ye--){const qe=+Date.now();ke=this.trees[ye]=this._createTree(this._cluster(ke,ye)),X&&console.log("z%d: %d clusters in %dms",ye,ke.numItems,+Date.now()-qe)}return X&&console.timeEnd("total time"),this}getClusters(q,X){let ie=((q[0]+180)%360+360)%360-180;const ue=Math.max(-90,Math.min(90,q[1]));let Se=q[2]===180?180:((q[2]+180)%360+360)%360-180;const Me=Math.max(-90,Math.min(90,q[3]));if(q[2]-q[0]>=360)ie=-180,Se=180;else if(ie>Se){const je=this.getClusters([ie,ue,180,Me],X),yt=this.getClusters([-180,ue,Se,Me],X);return je.concat(yt)}const ke=this.trees[this._limitZoom(X)],ye=ke.range(ti(ie),Li(Me),ti(Se),Li(ue)),qe=ke.data,tt=[];for(const je of ye){const yt=this.stride*je;tt.push(qe[yt+Ue]>1?$t(qe,yt,this.clusterProps):this.points[qe[yt+oe]])}return tt}getChildren(q){const X=this._getOriginId(q),ie=this._getOriginZoom(q),ue="No cluster with the specified id.",Se=this.trees[ie];if(!Se)throw new Error(ue);const Me=Se.data;if(X*this.stride>=Me.length)throw new Error(ue);const ke=this.options.radius/(this.options.extent*Math.pow(2,ie-1)),ye=Se.within(Me[X*this.stride],Me[X*this.stride+1],ke),qe=[];for(const tt of ye){const je=tt*this.stride;Me[je+4]===q&&qe.push(Me[je+Ue]>1?$t(Me,je,this.clusterProps):this.points[Me[je+oe]])}if(qe.length===0)throw new Error(ue);return qe}getLeaves(q,X,ie){const ue=[];return this._appendLeaves(ue,q,X=X||10,ie=ie||0,0),ue}getTile(q,X,ie){const ue=this.trees[this._limitZoom(q)],Se=Math.pow(2,q),{extent:Me,radius:ke}=this.options,ye=ke/Me,qe=(ie-ye)/Se,tt=(ie+1+ye)/Se,je={features:[]};return this._addTileFeatures(ue.range((X-ye)/Se,qe,(X+1+ye)/Se,tt),ue.data,X,ie,Se,je),X===0&&this._addTileFeatures(ue.range(1-ye/Se,qe,1,tt),ue.data,Se,ie,Se,je),X===Se-1&&this._addTileFeatures(ue.range(0,qe,ye/Se,tt),ue.data,-1,ie,Se,je),je.features.length?je:null}getClusterExpansionZoom(q){let X=this._getOriginZoom(q)-1;for(;X<=this.options.maxZoom;){const ie=this.getChildren(q);if(X++,ie.length!==1)break;q=ie[0].properties.cluster_id}return X}_appendLeaves(q,X,ie,ue,Se){const Me=this.getChildren(X);for(const ke of Me){const ye=ke.properties;if(ye&&ye.cluster?Se+ye.point_count<=ue?Se+=ye.point_count:Se=this._appendLeaves(q,ye.cluster_id,ie,ue,Se):Se<ue?Se++:q.push(ke),q.length===ie)break}return Se}_createTree(q){const X=new p.av(q.length/this.stride|0,this.options.nodeSize,Float32Array);for(let ie=0;ie<q.length;ie+=this.stride)X.add(q[ie],q[ie+1]);return X.finish(),X.data=q,X}_addTileFeatures(q,X,ie,ue,Se,Me){for(const ke of q){const ye=ke*this.stride,qe=X[ye+Ue]>1;let tt,je,yt;if(qe)tt=qt(X,ye,this.clusterProps),je=X[ye],yt=X[ye+1];else{const yi=this.points[X[ye+oe]];tt=yi.properties;const[Vt,hi]=yi.geometry.coordinates;je=ti(Vt),yt=Li(hi)}const jt={type:1,geometry:[[Math.round(this.options.extent*(je*Se-ie)),Math.round(this.options.extent*(yt*Se-ue))]],tags:tt};let Xt;Xt=qe||this.options.generateId?X[ye+oe]:this.points[X[ye+oe]].id,Xt!==void 0&&(jt.id=Xt),Me.features.push(jt)}}_limitZoom(q){return Math.max(this.options.minZoom,Math.min(Math.floor(+q),this.options.maxZoom+1))}_cluster(q,X){const{radius:ie,extent:ue,reduce:Se,minPoints:Me}=this.options,ke=ie/(ue*Math.pow(2,X)),ye=q.data,qe=[],tt=this.stride;for(let je=0;je<ye.length;je+=tt){if(ye[je+2]<=X)continue;ye[je+2]=X;const yt=ye[je],jt=ye[je+1],Xt=q.within(ye[je],ye[je+1],ke),yi=ye[je+Ue];let Vt=yi;for(const hi of Xt){const gi=hi*tt;ye[gi+2]>X&&(Vt+=ye[gi+Ue])}if(Vt>yi&&Vt>=Me){let hi,gi=yt*yi,$n=jt*yi,kn=-1;const vi=((je/tt|0)<<5)+(X+1)+this.points.length;for(const qi of Xt){const Ji=qi*tt;if(ye[Ji+2]<=X)continue;ye[Ji+2]=X;const tr=ye[Ji+Ue];gi+=ye[Ji]*tr,$n+=ye[Ji+1]*tr,ye[Ji+4]=vi,Se&&(hi||(hi=this._map(ye,je,!0),kn=this.clusterProps.length,this.clusterProps.push(hi)),Se(hi,this._map(ye,Ji)))}ye[je+4]=vi,qe.push(gi/Vt,$n/Vt,1/0,vi,-1,Vt),Se&&qe.push(kn)}else{for(let hi=0;hi<tt;hi++)qe.push(ye[je+hi]);if(Vt>1)for(const hi of Xt){const gi=hi*tt;if(!(ye[gi+2]<=X)){ye[gi+2]=X;for(let $n=0;$n<tt;$n++)qe.push(ye[gi+$n])}}}}return qe}_getOriginId(q){return q-this.points.length>>5}_getOriginZoom(q){return(q-this.points.length)%32}_map(q,X,ie){if(q[X+Ue]>1){const Me=this.clusterProps[q[X+ut]];return ie?Object.assign({},Me):Me}const ue=this.points[q[X+oe]].properties,Se=this.options.map(ue);return ie&&Se===ue?Object.assign({},Se):Se}}function $t(de,q,X){return{type:"Feature",id:de[q+oe],properties:qt(de,q,X),geometry:{type:"Point",coordinates:[(ie=de[q],360*(ie-.5)),ki(de[q+1])]}};var ie}function qt(de,q,X){const ie=de[q+Ue],ue=ie>=1e4?`${Math.round(ie/1e3)}k`:ie>=1e3?Math.round(ie/100)/10+"k":ie,Se=de[q+ut],Me=Se===-1?{}:Object.assign({}
vendor: 10,746 bytes, line 53
53,X[Se]);return Object.assign(Me,{cluster:!0,cluster_id:de[q+oe],point_count:ie,point_count_abbreviated:ue})}function ti(de){return de/360+.5}function Li(de){const q=Math.sin(de*Math.PI/180),X=.5-.25*Math.log((1+q)/(1-q))/Math.PI;return X<0?0:X>1?1:X}function ki(de){const q=(180-360*de)*Math.PI/180;return 360*Math.atan(Math.exp(q))/Math.PI-90}function Er(de,q,X,ie){let ue=ie;const Se=q+(X-q>>1);let Me,ke=X-q;const ye=de[q],qe=de[q+1],tt=de[X],je=de[X+1];for(let yt=q+3;yt<X;yt+=3){const jt=Ts(de[yt],de[yt+1],ye,qe,tt,je);if(jt>ue)Me=yt,ue=jt;else if(jt===ue){const Xt=Math.abs(yt-Se);Xt<ke&&(Me=yt,ke=Xt)}}ue>ie&&(Me-q>3&&Er(de,q,Me,ie),de[Me+2]=ue,X-Me>3&&Er(de,Me,X,ie))}function Ts(de,q,X,ie,ue,Se){let Me=ue-X,ke=Se-ie;if(Me!==0||ke!==0){const ye=((de-X)*Me+(q-ie)*ke)/(Me*Me+ke*ke);ye>1?(X=ue,ie=Se):ye>0&&(X+=Me*ye,ie+=ke*ye)}return Me=de-X,ke=q-ie,Me*Me+ke*ke}function ot(de,q,X,ie){const ue={id:de??null,type:q,geometry:X,tags:ie,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(q==="Point"||q==="MultiPoint"||q==="LineString")si(ue,X);else if(q==="Polygon")si(ue,X[0]);else if(q==="MultiLineString")for(const Se of X)si(ue,Se);else if(q==="MultiPolygon")for(const Se of X)si(ue,Se[0]);return ue}function si(de,q){for(let X=0;X<q.length;X+=3)de.minX=Math.min(de.minX,q[X]),de.minY=Math.min(de.minY,q[X+1]),de.maxX=Math.max(de.maxX,q[X]),de.maxY=Math.max(de.maxY,q[X+1])}function pi(de,q,X,ie){if(!q.geometry)return;const ue=q.geometry.coordinates;if(ue&&ue.length===0)return;const Se=q.geometry.type,Me=Math.pow(X.tolerance/((1<<X.maxZoom)*X.extent),2);let ke=[],ye=q.id;if(X.promoteId?ye=q.properties[X.promoteId]:X.generateId&&(ye=ie||0),Se==="Point")Cn(ue,ke);else if(Se==="MultiPoint")for(const qe of ue)Cn(qe,ke);else if(Se==="LineString")_e(ue,ke,Me,!1);else if(Se==="MultiLineString"){if(X.lineMetrics){for(const qe of ue)ke=[],_e(qe,ke,Me,!1),de.push(ot(ye,"LineString",ke,q.properties));return}Pt(ue,ke,Me,!1)}else if(Se==="Polygon")Pt(ue,ke,Me,!0);else{if(Se!=="MultiPolygon"){if(Se==="GeometryCollection"){for(const qe of q.geometry.geometries)pi(de,{id:ye,geometry:qe,properties:q.properties},X,ie);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const qe of ue){const tt=[];Pt(qe,tt,Me,!0),ke.push(tt)}}de.push(ot(ye,Se,ke,q.properties))}function Cn(de,q){q.push(gt(de[0]),Ut(de[1]),0)}function _e(de,q,X,ie){let ue,Se,Me=0;for(let ye=0;ye<de.length;ye++){const qe=gt(de[ye][0]),tt=Ut(de[ye][1]);q.push(qe,tt,0),ye>0&&(Me+=ie?(ue*tt-qe*Se)/2:Math.sqrt(Math.pow(qe-ue,2)+Math.pow(tt-Se,2))),ue=qe,Se=tt}const ke=q.length-3;q[2]=1,Er(q,0,ke,X),q[ke+2]=1,q.size=Math.abs(Me),q.start=0,q.end=q.size}function Pt(de,q,X,ie){for(let ue=0;ue<de.length;ue++){const Se=[];_e(de[ue],Se,X,ie),q.push(Se)}}function gt(de){return de/360+.5}function Ut(de){const q=Math.sin(de*Math.PI/180),X=.5-.25*Math.log((1+q)/(1-q))/Math.PI;return X<0?0:X>1?1:X}function Ri(de,q,X,ie,ue,Se,Me,ke){if(ie/=q,Se>=(X/=q)&&Me<ie)return de;if(Me<X||Se>=ie)return null;const ye=[];for(const qe of de){const tt=qe.geometry;let je=qe.type;const yt=ue===0?qe.minX:qe.minY,jt=ue===0?qe.maxX:qe.maxY;if(yt>=X&&jt<ie){ye.push(qe);continue}if(jt<X||yt>=ie)continue;let Xt=[];if(je==="Point"||je==="MultiPoint")Gi(tt,Xt,X,ie,ue);else if(je==="LineString")or(tt,Xt,X,ie,ue,!1,ke.lineMetrics);else if(je==="MultiLineString")sn(tt,Xt,X,ie,ue,!1);else if(je==="Polygon")sn(tt,Xt,X,ie,ue,!0);else if(je==="MultiPolygon")for(const yi of tt){const Vt=[];sn(yi,Vt,X,ie,ue,!0),Vt.length&&Xt.push(Vt)}if(Xt.length){if(ke.lineMetrics&&je==="LineString"){for(const yi of Xt)ye.push(ot(qe.id,je,yi,qe.tags));continue}je!=="LineString"&&je!=="MultiLineString"||(Xt.length===1?(je="LineString",Xt=Xt[0]):je="MultiLineString"),je!=="Point"&&je!=="MultiPoint"||(je=Xt.length===3?"Point":"MultiPoint"),ye.push(ot(qe.id,je,Xt,qe.tags))}}return ye.length?ye:null}function Gi(de,q,X,ie,ue){for(let Se=0;Se<de.length;Se+=3){const Me=de[Se+ue];Me>=X&&Me<=ie&&bn(q,de[Se],de[Se+1],de[Se+2])}}function or(de,q,X,ie,ue,Se,Me){let ke=vn(de);const ye=ue===0?lr:Ss;let qe,tt,je=de.start;for(let Vt=0;Vt<de.length-3;Vt+=3){const hi=de[Vt],gi=de[Vt+1],$n=de[Vt+2],kn=de[Vt+3],vi=de[Vt+4],qi=ue===0?hi:gi,Ji=ue===0?kn:vi;let tr=!1;Me&&(qe=Math.sqrt(Math.pow(hi-kn,2)+Math.pow(gi-vi,2))),qi<X?Ji>X&&(tt=ye(ke,hi,gi,kn,vi,X),Me&&(ke.start=je+qe*tt)):qi>ie?Ji<ie&&(tt=ye(ke,hi,gi,kn,vi,ie),Me&&(ke.start=je+qe*tt)):bn(ke,hi,gi,$n),Ji<X&&qi>=X&&(tt=ye(ke,hi,gi,kn,vi,X),tr=!0),Ji>ie&&qi<=ie&&(tt=ye(ke,hi,gi,kn,vi,ie),tr=!0),!Se&&tr&&(Me&&(ke.end=je+qe*tt),q.push(ke),ke=vn(de)),Me&&(je+=qe)}let yt=de.length-3;const jt=de[yt],Xt=de[yt+1],yi=ue===0?jt:Xt;yi>=X&&yi<=ie&&bn(ke,jt,Xt,de[yt+2]),yt=ke.length-3,Se&&yt>=3&&(ke[yt]!==ke[0]||ke[yt+1]!==ke[1])&&bn(ke,ke[0],ke[1],ke[2]),ke.length&&q.push(ke)}function vn(de){const q=[];return q.size=de.size,q.start=de.start,q.end=de.end,q}function sn(de,q,X,ie,ue,Se){for(const Me of de)or(Me,q,X,ie,ue,Se,!1)}function bn(de,q,X,ie){de.push(q,X,ie)}function lr(de,q,X,ie,ue,Se){const Me=(Se-q)/(ie-q);return bn(de,Se,X+(ue-X)*Me,1),Me}function Ss(de,q,X,ie,ue,Se){const Me=(Se-X)/(ue-X);return bn(de,q+(ie-q)*Me,Se,1),Me}function pt(de,q){const X=[];for(let ie=0;ie<de.length;ie++){const ue=de[ie],Se=ue.type;let Me;if(Se==="Point"||Se==="MultiPoint"||Se==="LineString")Me=oa(ue.geometry,q);else if(Se==="MultiLineString"||Se==="Polygon"){Me=[];for(const ke of ue.geometry)Me.push(oa(ke,q))}else if(Se==="MultiPolygon"){Me=[];for(const ke of ue.geometry){const ye=[];for(const qe of ke)ye.push(oa(qe,q));Me.push(ye)}}X.push(ot(ue.id,Se,Me,ue.tags))}return X}function oa(de,q){const X=[];X.size=de.size,de.start!==void 0&&(X.start=de.start,X.end=de.end);for(let ie=0;ie<de.length;ie+=3)X.push(de[ie]+q,de[ie+1],de[ie+2]);return X}function Ir(de,q){if(de.transformed)return de;const X=1<<de.z,ie=de.x,ue=de.y;for(const Se of de.features){const Me=Se.geometry,ke=Se.type;if(Se.geometry=[],ke===1)for(let ye=0;ye<Me.length;ye+=2)Se.geometry.push(la(Me[ye],Me[ye+1],q,X,ie,ue));else for(let ye=0;ye<Me.length;ye++){const qe=[];for(let tt=0;tt<Me[ye].length;tt+=2)qe.push(la(Me[ye][tt],Me[ye][tt+1],q,X,ie,ue));Se.geometry.push(qe)}}return de.transformed=!0,de}function la(de,q,X,ie,ue,Se){return[Math.round(X*(de*ie-ue)),Math.round(X*(q*ie-Se))]}function Za(de,q,X,ie,ue){const Se=q===ue.maxZoom?0:ue.tolerance/((1<<q)*ue.extent),Me={features:[],numPoints:0,numSimplified:0,numFeatures:de.length,source:null,x:X,y:ie,z:q,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const ke of de)bt(Me,ke,Se,ue);return Me}function bt(de,q,X,ie){const ue=q.geometry,Se=q.type,Me=[];if(de.minX=Math.min(de.minX,q.minX),de.minY=Math.min(de.minY,q.minY),de.maxX=Math.max(de.maxX,q.maxX),de.maxY=Math.max(de.maxY,q.maxY),Se==="Point"||Se==="MultiPoint")for(let ke=0;ke<ue.length;ke+=3)Me.push(ue[ke],ue[ke+1]),de.numPoints++,de.numSimplified++;else if(Se==="LineString")ii(Me,ue,de,X,!1,!1);else if(Se==="MultiLineString"||Se==="Polygon")for(let ke=0;ke<ue.length;ke++)ii(Me,ue[ke],de,X,Se==="Polygon",ke===0);else if(Se==="MultiPolygon")for(let ke=0;ke<ue.length;ke++){const ye=ue[ke];for(let qe=0;qe<ye.length;qe++)ii(Me,ye[qe],de,X,!0,qe===0)}if(Me.length){let ke=q.tags||null;if(Se==="LineString"&&ie.lineMetrics){ke={};for(const qe in q.tags)ke[qe]=q.tags[qe];ke.mapbox_clip_start=ue.start/ue.size,ke.mapbox_clip_end=ue.end/ue.size}const ye={geometry:Me,type:Se==="Polygon"||Se==="MultiPolygon"?3:Se==="LineString"||Se==="MultiLineString"?2:1,tags:ke};q.id!==null&&(ye.id=q.id),de.features.push(ye)}}function ii(de,q,X,ie,ue,Se){const Me=ie*ie;if(ie>0&&q.size<(ue?Me:ie))return void(X.numPoints+=q.length/3);const ke=[];for(let ye=0;ye<q.length;ye+=3)(ie===0||q[ye+2]>Me)&&(X.numSimplified++,ke.push(q[ye],q[ye+1])),X.numPoints++;ue&&(function(ye,qe){let tt=0;for(let je=0,yt=ye.length,jt=yt-2;je<yt;jt=je,je+=2)tt+=(ye[je]-ye[jt])*(ye[je+1]+ye[jt+1]);if(tt>0===qe)for(let je=0,yt=ye.length;je<yt/2;je+=2){const jt=ye[je],Xt=ye[je+1];ye[je]=ye[yt-2-je],ye[je+1]=ye[yt-1-je],ye[yt-2-je]=jt,ye[yt-1-je]=Xt}})(ke,Se),de.push(ke)}const Wt={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class xn{constructor(q,X){const ie=(X=this.options=(function(Se,Me){for(const ke in Me)Se[ke]=Me[ke];return Se})(Object.create(Wt),X)).debug;if(ie&&console.time("preprocess data"),X.maxZoom<0||X.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(X.promoteId&&X.generateId)throw new Error("promoteId and generateId cannot be used together.");let ue=(function(Se,Me){const ke=[];if(Se.type==="FeatureCollection")for(let ye=0;ye<Se.features.length;ye++)pi(ke,Se.features[ye],Me,ye);else pi(ke,Se.type==="Feature"?Se:{geometry:Se},Me);return ke})(q,X);this.tiles={},this.tileCoords=[],ie&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",X.indexMaxZoom,X.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),ue=(function(Se,Me){const ke=Me.buffer/Me.extent;let ye=Se;const qe=Ri(Se,1,-1-ke,ke,0,-1,2,Me),tt=Ri(Se,1,1-ke,2+ke,0,-1,2,Me);return(qe||tt)&&(ye=Ri(Se,1,-ke,1+ke,0,-1,2,Me)||[],qe&&(ye=pt(qe,1).concat(ye)),tt&&(ye=ye.concat(pt(tt,-1)))),ye})(ue,X),ue.length&&this.splitTile(ue,0,0,0),ie&&(ue.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(q,X,ie,ue,Se,Me,ke){const ye=[q,X,ie,ue],qe=this.options,tt=qe.debug;for(;ye.length;){ue=ye.pop(),ie=ye.pop(),X=ye.pop(),q=ye.pop();const je=1<<X,yt=Ws(X,ie,ue);let jt=this.tiles[yt];if(!jt&&(tt>1&&console.time("creation"),jt=this.tiles[yt]=Za(q,X,ie,ue,qe),this.tileCoords.push({z:X,x:ie,y:ue}),tt)){tt>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",X,ie,ue,jt.numFeatures,jt.numPoints,jt.numSimplified),console.timeEnd("creation"));const tr=`z${X}`;this.stats[tr]=(this.stats[tr]||0)+1,this.total++}if(jt.source=q,Se==null){if(X===qe.indexMaxZoom||jt.numPoints<=qe.indexMaxPoints)continue}else{if(X===qe.maxZoom||X===Se)continue;if(Se!=null){const tr=Se-X;if(ie!==Me>>tr||ue!==ke>>tr)continue}}if(jt.source=null,q.length===0)continue;tt>1&&console.time("clipping");const Xt=.5*qe.buffer/qe.extent,yi=.5-Xt,Vt=.5+Xt,hi=1+Xt;let gi=null,$n=null,kn=null,vi=null,qi=Ri(q,je,ie-Xt,ie+Vt,0,jt.minX,jt.maxX,qe),Ji=Ri(q,je,ie+yi,ie+hi,0,jt.minX,jt.maxX,qe);q=null,qi&&(gi=Ri(qi,je,ue-Xt,ue+Vt,1,jt.minY,jt.maxY,qe),$n=Ri(qi,je,ue+yi,ue+hi,1,jt.minY,jt.maxY,qe),qi=null),Ji&&(kn=Ri(Ji,je,ue-Xt,ue+Vt,1,jt.minY,jt.maxY,qe),vi=Ri(Ji,je,ue+yi,ue+hi,1,jt.minY,jt.maxY,qe),Ji=null),tt>1&&console.timeEnd("clipping"),ye.push(gi||[],X+1,2*ie,2*ue),ye.push($n||[],X+1,2*ie,2*ue+1),ye.pu
vendor: 13,595 bytes, line 53
53sh(kn||[],X+1,2*ie+1,2*ue),ye.push(vi||[],X+1,2*ie+1,2*ue+1)}}getTile(q,X,ie){q=+q,X=+X,ie=+ie;const ue=this.options,{extent:Se,debug:Me}=ue;if(q<0||q>24)return null;const ke=1<<q,ye=Ws(q,X=X+ke&ke-1,ie);if(this.tiles[ye])return Ir(this.tiles[ye],Se);Me>1&&console.log("drilling down to z%d-%d-%d",q,X,ie);let qe,tt=q,je=X,yt=ie;for(;!qe&&tt>0;)tt--,je>>=1,yt>>=1,qe=this.tiles[Ws(tt,je,yt)];return qe&&qe.source?(Me>1&&(console.log("found parent tile z%d-%d-%d",tt,je,yt),console.time("drilling down")),this.splitTile(qe.source,tt,je,yt,q,X,ie),Me>1&&console.timeEnd("drilling down"),this.tiles[ye]?Ir(this.tiles[ye],Se):null):null}}function Ws(de,q,X){return 32*((1<<de)*X+q)+de}function ui(de,q){return q?de.properties[q]:de.id}function ca(de,q){if(de==null)return!0;if(de.type==="Feature")return ui(de,q)!=null;if(de.type==="FeatureCollection"){const X=new Set;for(const ie of de.features){const ue=ui(ie,q);if(ue==null||X.has(ue))return!1;X.add(ue)}return!0}return!1}function As(de,q){const X=new Map;if(de!=null)if(de.type==="Feature")X.set(ui(de,q),de);else for(const ie of de.features)X.set(ui(ie,q),ie);return X}class Xs extends N{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(q,X){return p._(this,void 0,void 0,(function*(){const ie=q.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const ue=this._geoJSONIndex.getTile(ie.z,ie.x,ie.y);if(!ue)return null;const Se=new class{constructor(ke){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=p.X,this.length=ke.length,this._features=ke}feature(ke){return new class{constructor(ye){this._feature=ye,this.extent=p.X,this.type=ye.type,this.properties=ye.tags,"id"in ye&&!isNaN(ye.id)&&(this.id=parseInt(ye.id,10))}loadGeometry(){if(this._feature.type===1){const ye=[];for(const qe of this._feature.geometry)ye.push([new p.P(qe[0],qe[1])]);return ye}{const ye=[];for(const qe of this._feature.geometry){const tt=[];for(const je of qe)tt.push(new p.P(je[0],je[1]));ye.push(tt)}return ye}}toGeoJSON(ye,qe,tt){return ae.call(this,ye,qe,tt)}}(this._features[ke])}}(ue.features);let Me=nt(Se);return Me.byteOffset===0&&Me.byteLength===Me.buffer.byteLength||(Me=new Uint8Array(Me)),{vectorTile:Se,rawData:Me.buffer}}))}loadData(q){return p._(this,void 0,void 0,(function*(){var X;(X=this._pendingRequest)===null||X===void 0||X.abort();const ie=!!(q&&q.request&&q.request.collectResourceTiming)&&new p.bv(q.request);this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON(q,this._pendingRequest),this._geoJSONIndex=q.cluster?new Tt((function({superclusterOptions:Me,clusterProperties:ke}){if(!ke||!Me)return Me;const ye={},qe={},tt={accumulated:null,zoom:0},je={properties:null},yt=Object.keys(ke);for(const jt of yt){const[Xt,yi]=ke[jt],Vt=p.bC(yi),hi=p.bC(typeof Xt=="string"?[Xt,["accumulated"],["get",jt]]:Xt);ye[jt]=Vt.value,qe[jt]=hi.value}return Me.map=jt=>{je.properties=jt;const Xt={};for(const yi of yt)Xt[yi]=ye[yi].evaluate(tt,je);return Xt},Me.reduce=(jt,Xt)=>{je.properties=Xt;for(const yi of yt)tt.accumulated=jt[yi],jt[yi]=qe[yi].evaluate(tt,je)},Me})(q)).load((yield this._pendingData).features):(ue=yield this._pendingData,new xn(ue,q.geojsonVtOptions)),this.loaded={};const Se={};if(ie){const Me=ie.finish();Me&&(Se.resourceTiming={},Se.resourceTiming[q.source]=JSON.parse(JSON.stringify(Me)))}return Se}catch(Se){if(delete this._pendingRequest,p.bB(Se))return{abandoned:!0};throw Se}var ue}))}getData(){return p._(this,void 0,void 0,(function*(){return this._pendingData}))}reloadTile(q){const X=this.loaded;return X&&X[q.uid]?super.reloadTile(q):this.loadTile(q)}loadAndProcessGeoJSON(q,X){return p._(this,void 0,void 0,(function*(){let ie=yield this.loadGeoJSON(q,X);if(delete this._pendingRequest,typeof ie!="object")throw new Error(`Input data given to '${q.source}' is not a valid GeoJSON object.`);if(se(ie,!0),q.filter){const ue=p.bC(q.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(ue.result==="error")throw new Error(ue.value.map((Me=>`${Me.key}: ${Me.message}`)).join(", "));ie={type:"FeatureCollection",features:ie.features.filter((Me=>ue.value.evaluate({zoom:0},Me)))}}return ie}))}loadGeoJSON(q,X){return p._(this,void 0,void 0,(function*(){const{promoteId:ie}=q;if(q.request){const ue=yield p.h(q.request,X);return this._dataUpdateable=ca(ue.data,ie)?As(ue.data,ie):void 0,ue.data}if(typeof q.data=="string")try{const ue=JSON.parse(q.data);return this._dataUpdateable=ca(ue,ie)?As(ue,ie):void 0,ue}catch{throw new Error(`Input data given to '${q.source}' is not a valid GeoJSON object.`)}if(!q.dataDiff)throw new Error(`Input data given to '${q.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${q.source}`);return(function(ue,Se,Me){var ke,ye,qe,tt;if(Se.removeAll&&ue.clear(),Se.remove)for(const je of Se.remove)ue.delete(je);if(Se.add)for(const je of Se.add){const yt=ui(je,Me);yt!=null&&ue.set(yt,je)}if(Se.update)for(const je of Se.update){let yt=ue.get(je.id);if(yt==null)continue;const jt=!je.removeAllProperties&&(((ke=je.removeProperties)===null||ke===void 0?void 0:ke.length)>0||((ye=je.addOrUpdateProperties)===null||ye===void 0?void 0:ye.length)>0);if((je.newGeometry||je.removeAllProperties||jt)&&(yt=Object.assign({},yt),ue.set(je.id,yt),jt&&(yt.properties=Object.assign({},yt.properties))),je.newGeometry&&(yt.geometry=je.newGeometry),je.removeAllProperties)yt.properties={};else if(((qe=je.removeProperties)===null||qe===void 0?void 0:qe.length)>0)for(const Xt of je.removeProperties)Object.prototype.hasOwnProperty.call(yt.properties,Xt)&&delete yt.properties[Xt];if(((tt=je.addOrUpdateProperties)===null||tt===void 0?void 0:tt.length)>0)for(const{key:Xt,value:yi}of je.addOrUpdateProperties)yt.properties[Xt]=yi}})(this._dataUpdateable,q.dataDiff,ie),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}}))}removeSource(q){return p._(this,void 0,void 0,(function*(){this._pendingRequest&&this._pendingRequest.abort()}))}getClusterExpansionZoom(q){return this._geoJSONIndex.getClusterExpansionZoom(q.clusterId)}getClusterChildren(q){return this._geoJSONIndex.getChildren(q.clusterId)}getClusterLeaves(q){return this._geoJSONIndex.getLeaves(q.clusterId,q.limit,q.offset)}}class ps{constructor(q){this.self=q,this.actor=new p.F(q),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(X,ie)=>{if(this.externalWorkerSourceTypes[X])throw new Error(`Worker source with name "${X}" already registered.`);this.externalWorkerSourceTypes[X]=ie},this.self.addProtocol=p.bi,this.self.removeProtocol=p.bj,this.self.registerRTLTextPlugin=X=>{if(p.bD.isParsed())throw new Error("RTL text plugin already registered.");p.bD.setMethods(X)},this.actor.registerMessageHandler("LDT",((X,ie)=>this._getDEMWorkerSource(X,ie.source).loadTile(ie))),this.actor.registerMessageHandler("RDT",((X,ie)=>p._(this,void 0,void 0,(function*(){this._getDEMWorkerSource(X,ie.source).removeTile(ie)})))),this.actor.registerMessageHandler("GCEZ",((X,ie)=>p._(this,void 0,void 0,(function*(){return this._getWorkerSource(X,ie.type,ie.source).getClusterExpansionZoom(ie)})))),this.actor.registerMessageHandler("GCC",((X,ie)=>p._(this,void 0,void 0,(function*(){return this._getWorkerSource(X,ie.type,ie.source).getClusterChildren(ie)})))),this.actor.registerMessageHandler("GCL",((X,ie)=>p._(this,void 0,void 0,(function*(){return this._getWorkerSource(X,ie.type,ie.source).getClusterLeaves(ie)})))),this.actor.registerMessageHandler("LD",((X,ie)=>this._getWorkerSource(X,ie.type,ie.source).loadData(ie))),this.actor.registerMessageHandler("GD",((X,ie)=>this._getWorkerSource(X,ie.type,ie.source).getData())),this.actor.registerMessageHandler("LT",((X,ie)=>this._getWorkerSource(X,ie.type,ie.source).loadTile(ie))),this.actor.registerMessageHandler("RT",((X,ie)=>this._getWorkerSource(X,ie.type,ie.source).reloadTile(ie))),this.actor.registerMessageHandler("AT",((X,ie)=>this._getWorkerSource(X,ie.type,ie.source).abortTile(ie))),this.actor.registerMessageHandler("RMT",((X,ie)=>this._getWorkerSource(X,ie.type,ie.source).removeTile(ie))),this.actor.registerMessageHandler("RS",((X,ie)=>p._(this,void 0,void 0,(function*(){if(!this.workerSources[X]||!this.workerSources[X][ie.type]||!this.workerSources[X][ie.type][ie.source])return;const ue=this.workerSources[X][ie.type][ie.source];delete this.workerSources[X][ie.type][ie.source],ue.removeSource!==void 0&&ue.removeSource(ie)})))),this.actor.registerMessageHandler("RM",(X=>p._(this,void 0,void 0,(function*(){delete this.layerIndexes[X],delete this.availableImages[X],delete this.workerSources[X],delete this.demWorkerSources[X]})))),this.actor.registerMessageHandler("SR",((X,ie)=>p._(this,void 0,void 0,(function*(){this.referrer=ie})))),this.actor.registerMessageHandler("SRPS",((X,ie)=>this._syncRTLPluginState(X,ie))),this.actor.registerMessageHandler("IS",((X,ie)=>p._(this,void 0,void 0,(function*(){this.self.importScripts(ie)})))),this.actor.registerMessageHandler("SI",((X,ie)=>this._setImages(X,ie))),this.actor.registerMessageHandler("UL",((X,ie)=>p._(this,void 0,void 0,(function*(){this._getLayerIndex(X).update(ie.layers,ie.removedIds)})))),this.actor.registerMessageHandler("SL",((X,ie)=>p._(this,void 0,void 0,(function*(){this._getLayerIndex(X).replace(ie)}))))}_setImages(q,X){return p._(this,void 0,void 0,(function*(){this.availableImages[q]=X;for(const ie in this.workerSources[q]){const ue=this.workerSources[q][ie];for(const Se in ue)ue[Se].availableImages=X}}))}_syncRTLPluginState(q,X){return p._(this,void 0,void 0,(function*(){if(p.bD.isParsed())return p.bD.getState();if(X.pluginStatus!=="loading")return p.bD.setState(X),X;const ie=X.pluginURL;if(this.self.importScripts(ie),p.bD.isParsed()){const ue={pluginStatus:"loaded",pluginURL:ie};return p.bD.setState(ue),ue}throw p.bD.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${ie}`)}))}_getAvailableImages(q){let X=this.availableImages[q];return X||(X=[]),X}_getLayerIndex(q){let X=this.layerIndexes[q];return X||(X=this.layerIndexes[q]=new h),X}_getWorkerSource(q,X,ie){if(this.workerSources[q]||(this.workerSources[q]={}),this.workerSources[q][X]||(this.workerSources[q][X]={}),!this.workerSources[q][X][ie]){const ue={sendAsync:(Se,Me)=>(Se.targetMapId=q,this.actor.sendAsync(Se,Me))};switch(X){case"vector":this.workerSources[q][X][ie]=new N(ue,this._getLayerIndex(q),this._getAvailableImages(q));break;case"geojson":this.workerSources[q][X][ie]=new Xs(ue,this._getLayerIndex(q),this._getAvailableImages(q));break;default:this.workerSources[q][X][ie]=new this.externalWorkerSourceTypes[X](ue,this._getLayerIndex(q),this._getAvailableImages(q))}}return this.workerSources[q][X][ie]}_getDEMWorkerSource(q,X){return this.demWorkerSources[q]||(this.demWorkerSources[q]={}),this.demWorkerSources[q][X]||(this.demWorkerSources[q][X]=new F),this.demWorkerSources[q][X]}}return p.i(self)&&(self.worker=new ps(self)),ps})),o("index",["exports","./shared"],(function(p,h){var A="4.7.1";let R,B;const N={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:w=>new Promise(((r,f)=>{const _=requestAnimationFrame(r);w.signal.addEventListener("abort",(()=>{cancelAnimationFrame(_),f(h.c())}))})),getImageData(w,r=0){return this.getImageCanvasContext(w).getImageData(-r,-r,w.width+2*r,w.height+2*r)},getImageCanvasContext(w){const r=window.document.createElement("canvas"),f=r.getContext("2d",{willReadFrequently:!0});if(!f)throw new Error("failed to create canvas 2d context");return r.width=w.width,r.height=w.height,f.drawImage(w,0,0,w.width,w.height),f},resolveURL:w=>(R||(R=document.createElement("a")),R.href=w,R.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(B==null&&(B=matchMedia("(prefers-reduced-motion: reduce)")),B.matches)}};class F{static testProp(r){if(!F.docStyle)return r[0];for(let f=0;f<r.length;f++)if(r[f]in F.docStyle)return r[f];return r[0]}static create(r,f,_){const y=window.document.createElement(r);return f!==void 0&&(y.className=f),_&&_.appendChild(y),y}static createNS(r,f){return window.document.createElementNS(r,f)}static disableDrag(){F.docStyle&&F.selectProp&&(F.userSelect=F.docStyle[F.selectProp],F.docStyle[F.selectProp]="none")}static enableDrag(){F.docStyle&&F.selectProp&&(F.docStyle[F.selectProp]=F.userSelect)}static setTransform(r,f){r.style[F.transformProp]=f}static addEventListener(r,f,_,y={}){r.addEventListener(f,_,"passive"in y?y:y.capture)}static removeEventListener(r,f,_,y={}){r.removeEventListener(f,_,"passive"in y?y:y.capture)}static suppressClickInternal(r){r.preventDefault(),r.stopPropagation(),window.removeEventListener("click",F.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",F.suppressClickInternal,!0),window.setTimeout((()=>{window.removeEventListener("click",F.suppressClickInternal,!0)}),0)}static getScale(r){const f=r.getBoundingClientRect();return{x:f.width/r.offsetWidth||1,y:f.height/r.offsetHeight||1,boundingClientRect:f}}static getPoint(r,f,_){const y=f.boundingClientRect;return new h.P((_.clientX-y.left)/f.x-r.clientLeft,(_.clientY-y.top)/f.y-r.clientTop)}static mousePos(r,f){const _=F.getScale(r);return F.getPoint(r,_,f)}static touchPos(r,f){const _=[],y=F.getScale(r);for(let x=0;x<f.length;
vendor: 6,177 bytes, line 53
53x++)_.push(F.getPoint(r,y,f[x]));return _}static mouseButton(r){return r.button}static remove(r){r.parentNode&&r.parentNode.removeChild(r)}}F.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,F.selectProp=F.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),F.transformProp=F.testProp(["transform","WebkitTransform"]);const Q={supported:!1,testSupport:function(w){!ae&&se&&(me?we(w):re=w)}};let re,se,ae=!1,me=!1;function we(w){const r=w.createTexture();w.bindTexture(w.TEXTURE_2D,r);try{if(w.texImage2D(w.TEXTURE_2D,0,w.RGBA,w.RGBA,w.UNSIGNED_BYTE,se),w.isContextLost())return;Q.supported=!0}catch{}w.deleteTexture(r),ae=!0}var ve;typeof document<"u"&&(se=document.createElement("img"),se.onload=()=>{re&&we(re),re=null,me=!0},se.onerror=()=>{ae=!0,re=null},se.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),(function(w){let r,f,_,y;w.resetRequestQueue=()=>{r=[],f=0,_=0,y={}},w.addThrottleControl=O=>{const L=_++;return y[L]=O,L},w.removeThrottleControl=O=>{delete y[O],M()},w.getImage=(O,L,$=!0)=>new Promise(((H,G)=>{Q.supported&&(O.headers||(O.headers={}),O.headers.accept="image/webp,*/*"),h.e(O,{type:"image"}),r.push({abortController:L,requestParameters:O,supportImageRefresh:$,state:"queued",onError:ee=>{G(ee)},onSuccess:ee=>{H(ee)}}),M()}));const x=O=>h._(this,void 0,void 0,(function*(){O.state="running";const{requestParameters:L,supportImageRefresh:$,onError:H,onSuccess:G,abortController:ee}=O,ne=$===!1&&!h.i(self)&&!h.g(L.url)&&(!L.headers||Object.keys(L.headers).reduce(((ge,be)=>ge&&be==="accept"),!0));f++;const he=ne?D(L,ee):h.m(L,ee);try{const ge=yield he;delete O.abortController,O.state="completed",ge.data instanceof HTMLImageElement||h.b(ge.data)?G(ge):ge.data&&G({data:yield(pe=ge.data,typeof createImageBitmap=="function"?h.d(pe):h.f(pe)),cacheControl:ge.cacheControl,expires:ge.expires})}catch(ge){delete O.abortController,H(ge)}finally{f--,M()}var pe})),M=()=>{const O=(()=>{for(const L of Object.keys(y))if(y[L]())return!0;return!1})()?h.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:h.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let L=f;L<O&&r.length>0;L++){const $=r.shift();$.abortController.signal.aborted?L--:x($)}},D=(O,L)=>new Promise((($,H)=>{const G=new Image,ee=O.url,ne=O.credentials;ne&&ne==="include"?G.crossOrigin="use-credentials":(ne&&ne==="same-origin"||!h.s(ee))&&(G.crossOrigin="anonymous"),L.signal.addEventListener("abort",(()=>{G.src="",H(h.c())})),G.fetchPriority="high",G.onload=()=>{G.onerror=G.onload=null,$({data:G})},G.onerror=()=>{G.onerror=G.onload=null,L.signal.aborted||H(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."))},G.src=ee}))})(ve||(ve={})),ve.resetRequestQueue();class Oe{constructor(r){this._transformRequestFn=r}transformRequest(r,f){return this._transformRequestFn&&this._transformRequestFn(r,f)||{url:r}}setTransformRequest(r){this._transformRequestFn=r}}function Te(w){var r=new h.A(3);return r[0]=w[0],r[1]=w[1],r[2]=w[2],r}var Re,Ee=function(w,r,f){return w[0]=r[0]-f[0],w[1]=r[1]-f[1],w[2]=r[2]-f[2],w};Re=new h.A(3),h.A!=Float32Array&&(Re[0]=0,Re[1]=0,Re[2]=0);var Je=function(w){var r=w[0],f=w[1];return r*r+f*f};function rt(w){const r=[];if(typeof w=="string")r.push({id:"default",url:w});else if(w&&w.length>0){const f=[];for(const{id:_,url:y}of w){const x=`${_}${y}`;f.indexOf(x)===-1&&(f.push(x),r.push({id:_,url:y}))}}return r}function Ke(w,r,f){const _=w.split("?");return _[0]+=`${r}${f}`,_.join("?")}(function(){var w=new h.A(2);h.A!=Float32Array&&(w[0]=0,w[1]=0)})();class Qe{constructor(r,f,_,y){this.context=r,this.format=_,this.texture=r.gl.createTexture(),this.update(f,y)}update(r,f,_){const{width:y,height:x}=r,M=!(this.size&&this.size[0]===y&&this.size[1]===x||_),{context:D}=this,{gl:O}=D;if(this.useMipmap=!!(f&&f.useMipmap),O.bindTexture(O.TEXTURE_2D,this.texture),D.pixelStoreUnpackFlipY.set(!1),D.pixelStoreUnpack.set(1),D.pixelStoreUnpackPremultiplyAlpha.set(this.format===O.RGBA&&(!f||f.premultiply!==!1)),M)this.size=[y,x],r instanceof HTMLImageElement||r instanceof HTMLCanvasElement||r instanceof HTMLVideoElement||r instanceof ImageData||h.b(r)?O.texImage2D(O.TEXTURE_2D,0,this.format,this.format,O.UNSIGNED_BYTE,r):O.texImage2D(O.TEXTURE_2D,0,this.format,y,x,0,this.format,O.UNSIGNED_BYTE,r.data);else{const{x:L,y:$}=_||{x:0,y:0};r instanceof HTMLImageElement||r instanceof HTMLCanvasElement||r instanceof HTMLVideoElement||r instanceof ImageData||h.b(r)?O.texSubImage2D(O.TEXTURE_2D,0,L,$,O.RGBA,O.UNSIGNED_BYTE,r):O.texSubImage2D(O.TEXTURE_2D,0,L,$,y,x,O.RGBA,O.UNSIGNED_BYTE,r.data)}this.useMipmap&&this.isSizePowerOfTwo()&&O.generateMipmap(O.TEXTURE_2D)}bind(r,f,_){const{context:y}=this,{gl:x}=y;x.bindTexture(x.TEXTURE_2D,this.texture),_!==x.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(_=x.LINEAR),r!==this.filter&&(x.texParameteri(x.TEXTURE_2D,x.TEXTURE_MAG_FILTER,r),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_MIN_FILTER,_||r),this.filter=r),f!==this.wrap&&(x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_S,f),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_T,f),this.wrap=f)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:r}=this.context;r.deleteTexture(this.texture),this.texture=null}}function ht(w){const{userImage:r}=w;return!!(r&&r.render&&r.render())&&(w.data.replace(new Uint8Array(r.data.buffer)),!0)}class At extends h.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new h.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(r){if(this.loaded!==r&&(this.loaded=r,r)){for(const{ids:f,promiseResolve:_}of this.requestors)_(this._getImagesForIds(f));this.requestors=[]}}getImage(r){const f=this.images[r];if(f&&!f.data&&f.spriteData){const _=f.spriteData;f.data=new h.R({width:_.width,height:_.height},_.context.getImageData(_.x,_.y,_.width,_.height).data),f.spriteData=null}return f}addImage(r,f){if(this.images[r])throw new Error(`Image id ${r} already exist, use updateImage instead`);
vendor: 8,650 bytes, line 53
53this._validate(r,f)&&(this.images[r]=f)}_validate(r,f){let _=!0;const y=f.data||f.spriteData;return this._validateStretch(f.stretchX,y&&y.width)||(this.fire(new h.j(new Error(`Image "${r}" has invalid "stretchX" value`))),_=!1),this._validateStretch(f.stretchY,y&&y.height)||(this.fire(new h.j(new Error(`Image "${r}" has invalid "stretchY" value`))),_=!1),this._validateContent(f.content,f)||(this.fire(new h.j(new Error(`Image "${r}" has invalid "content" value`))),_=!1),_}_validateStretch(r,f){if(!r)return!0;let _=0;for(const y of r){if(y[0]<_||y[1]<y[0]||f<y[1])return!1;_=y[1]}return!0}_validateContent(r,f){if(!r)return!0;if(r.length!==4)return!1;const _=f.spriteData,y=_&&_.width||f.data.width,x=_&&_.height||f.data.height;return!(r[0]<0||y<r[0]||r[1]<0||x<r[1]||r[2]<0||y<r[2]||r[3]<0||x<r[3]||r[2]<r[0]||r[3]<r[1])}updateImage(r,f,_=!0){const y=this.getImage(r);if(_&&(y.data.width!==f.data.width||y.data.height!==f.data.height))throw new Error(`size mismatch between old image (${y.data.width}x${y.data.height}) and new image (${f.data.width}x${f.data.height}).`);f.version=y.version+1,this.images[r]=f,this.updatedImages[r]=!0}removeImage(r){const f=this.images[r];delete this.images[r],delete this.patterns[r],f.userImage&&f.userImage.onRemove&&f.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(r){return new Promise(((f,_)=>{let y=!0;if(!this.isLoaded())for(const x of r)this.images[x]||(y=!1);this.isLoaded()||y?f(this._getImagesForIds(r)):this.requestors.push({ids:r,promiseResolve:f})}))}_getImagesForIds(r){const f={};for(const _ of r){let y=this.getImage(_);y||(this.fire(new h.k("styleimagemissing",{id:_})),y=this.getImage(_)),y?f[_]={data:y.data.clone(),pixelRatio:y.pixelRatio,sdf:y.sdf,version:y.version,stretchX:y.stretchX,stretchY:y.stretchY,content:y.content,textFitWidth:y.textFitWidth,textFitHeight:y.textFitHeight,hasRenderCallback:!!(y.userImage&&y.userImage.render)}:h.w(`Image "${_}" 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.`)}return f}getPixelSize(){const{width:r,height:f}=this.atlasImage;return{width:r,height:f}}getPattern(r){const f=this.patterns[r],_=this.getImage(r);if(!_)return null;if(f&&f.position.version===_.version)return f.position;if(f)f.position.version=_.version;else{const y={w:_.data.width+2,h:_.data.height+2,x:0,y:0},x=new h.I(y,_);this.patterns[r]={bin:y,position:x}}return this._updatePatternAtlas(),this.patterns[r].position}bind(r){const f=r.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new Qe(r,this.atlasImage,f.RGBA),this.atlasTexture.bind(f.LINEAR,f.CLAMP_TO_EDGE)}_updatePatternAtlas(){const r=[];for(const x in this.patterns)r.push(this.patterns[x].bin);const{w:f,h:_}=h.p(r),y=this.atlasImage;y.resize({width:f||1,height:_||1});for(const x in this.patterns){const{bin:M}=this.patterns[x],D=M.x+1,O=M.y+1,L=this.getImage(x).data,$=L.width,H=L.height;h.R.copy(L,y,{x:0,y:0},{x:D,y:O},{width:$,height:H}),h.R.copy(L,y,{x:0,y:H-1},{x:D,y:O-1},{width:$,height:1}),h.R.copy(L,y,{x:0,y:0},{x:D,y:O+H},{width:$,height:1}),h.R.copy(L,y,{x:$-1,y:0},{x:D-1,y:O},{width:1,height:H}),h.R.copy(L,y,{x:0,y:0},{x:D+$,y:O},{width:1,height:H})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(r){for(const f of r){if(this.callbackDispatchedThisFrame[f])continue;this.callbackDispatchedThisFrame[f]=!0;const _=this.getImage(f);_||h.w(`Image with ID: "${f}" was not found`),ht(_)&&this.updateImage(f,_)}}}const Fe=1e20;function Dt(w,r,f,_,y,x,M,D,O){for(let L=r;L<r+_;L++)Le(w,f*x+L,x,y,M,D,O);for(let L=f;L<f+y;L++)Le(w,L*x+r,1,_,M,D,O)}function Le(w,r,f,_,y,x,M){x[0]=0,M[0]=-Fe,M[1]=Fe,y[0]=w[r];for(let D=1,O=0,L=0;D<_;D++){y[D]=w[r+D*f];const $=D*D;do{const H=x[O];L=(y[D]-y[H]+$-H*H)/(D-H)/2}while(L<=M[O]&&--O>-1);O++,x[O]=D,M[O]=L,M[O+1]=Fe}for(let D=0,O=0;D<_;D++){for(;M[O+1]<D;)O++;const L=x[O],$=D-L;w[r+D*f]=y[L]+$*$}}class nt{constructor(r,f){this.requestManager=r,this.localIdeographFontFamily=f,this.entries={}}setURL(r){this.url=r}getGlyphs(r){return h._(this,void 0,void 0,(function*(){const f=[];for(const x in r)for(const M of r[x])f.push(this._getAndCacheGlyphsPromise(x,M));const _=yield Promise.all(f),y={};for(const{stack:x,id:M,glyph:D}of _)y[x]||(y[x]={}),y[x][M]=D&&{id:D.id,bitmap:D.bitmap.clone(),metrics:D.metrics};return y}))}_getAndCacheGlyphsPromise(r,f){return h._(this,void 0,void 0,(function*(){let _=this.entries[r];_||(_=this.entries[r]={glyphs:{},requests:{},ranges:{}});let y=_.glyphs[f];if(y!==void 0)return{stack:r,id:f,glyph:y};if(y=this._tinySDF(_,r,f),y)return _.glyphs[f]=y,{stack:r,id:f,glyph:y};const x=Math.floor(f/256);if(256*x>65535)throw new Error("glyphs > 65535 not supported");if(_.ranges[x])return{stack:r,id:f,glyph:y};if(!this.url)throw new Error("glyphsUrl is not set");if(!_.requests[x]){const D=nt.loadGlyphRange(r,x,this.url,this.requestManager);_.requests[x]=D}const M=yield _.requests[x];for(const D in M)this._doesCharSupportLocalGlyph(+D)||(_.glyphs[+D]=M[+D]);return _.ranges[x]=!0,{stack:r,id:f,glyph:M[f]||null}}))}_doesCharSupportLocalGlyph(r){return!!this.localIdeographFontFamily&&new RegExp("\\p{Ideo}|\\p{sc=Hang}|\\p{sc=Hira}|\\p{sc=Kana}","u").test(String.fromCodePoint(r))}_tinySDF(r,f,_){const y=this.localIdeographFontFamily;if(!y||!this._doesCharSupportLocalGlyph(_))return;let x=r.tinySDF;if(!x){let D="400";/bold/i.test(f)?D="900":/medium/i.test(f)?D="500":/light/i.test(f)&&(D="200"),x=r.tinySDF=new nt.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:y,fontWeight:D})}const M=x.draw(String.fromCharCode(_));return{id:_,bitmap:new h.o({width:M.width||60,height:M.height||60},M.data),metrics:{width:M.glyphWidth/2||24,height:M.glyphHeight/2||24,left:M.glyphLeft/2+.5||0,top:M.glyphTop/2-27.5||-8,advance:M.glyphAdvance/2||24,isDoubleResolution:!0}}}}nt.loadGlyphRange=function(w,r,f,_){return h._(this,void 0,void 0,(function*(){const y=256*r,x=y+255,M=_.transformRequest(f.replace("{fontstack}",w).replace("{range}",`${y}-${x}`),"Glyphs"),D=yield h.l(M,new AbortController);if(!D||!D.data)throw new Error(`Could not load glyph range. range: ${r}, ${y}-${x}`);const O={};for(const L of h.n(D.data))O[L.id]=L;return O}))},nt.TinySDF=class{constructor({fontSize:w=24,buffer:r=3,radius:f=8,cutoff:_=.25,fontFamily:y="sans-serif",fontWeight:x="normal",fontStyle:M="normal"}={}){this.buffer=r,this.cutoff=_,this.radius=f;const D=this.size=w+4*r,O=this._createCanvas(D),L=this.ctx=O.getContext("2d",{willReadFrequently:!0});L.font=`${M} ${x} ${w}px ${y}`,L.textBaseline="alphabetic",L.textAlign="left",L.fillStyle="black",this.gridOuter=new Float64Array(D*D),this.gridInner=new Float64Array(D*D),this.f=new Float64Array(D),this.z=new Float64Array(D+1),this.v=new Uint16Array(D)}_createCanvas(w){const r=document.createElement("canvas");return r.width=r.height=w,r}draw(w){const{width:r,actualBoundingBoxAscent:f,actualBoundingBoxDescent:_,actualBoundingBoxLeft:y,actualBoundingBoxRight:x}=this.ctx.measureText(w),M=Math.ceil(f),D=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(x-y))),O=Math.min(this.size-this.buffer,M+Math.ceil(_)),L=D+2*this.buffer,$=O+2*this.buffer,H=Math.max(L*$,0),G=new Uint8ClampedArray(H),ee={data:G,width:L,height:$,glyphWidth:D,glyphHeight:O,glyphTop:M,glyphLeft:0,glyphAdvance:r};if(D===0||O===0)return ee;const{ctx:ne,buffer:he,gridInner:pe,gridOuter:ge}=this;ne.clearRect(he,he,D,O),ne.fillText(w,he,he+M);const be=ne.getImageData(he,he,D,O);ge.fill(Fe,0,H),pe.fill(0,0,H);for(let le=0;le<O;le++)for(let Ce=0;Ce<D;Ce++){const Ie=be.data[4*(le*D+Ce)+3]/255;if(Ie===0)continue;const ze=(le+he)*L+Ce+he;if(Ie===1)ge[ze]=0,pe[ze]=Fe;else{const Ge=.5-Ie;ge[ze]=Ge>0?Ge*Ge:0,pe[ze]=Ge<0?Ge*Ge:0}}Dt(ge,0,0,L,$,L,this.f,this.v,this.z),Dt(pe,he,he,D,O,L,this.f,this.v,this.z);for(let le=0;le<H;le++){const Ce=Math.sqrt(ge[le])-Math.sqrt(pe[le]);G[le]=Math.round(255-255*(Ce/this.radius+this.cutoff))}return ee}};class mt{constructor(){this.specification=h.v.light.position}possiblyEvaluate(r,f){return h.x(r.expression.evaluate(f))}interpolate(r,f,_){return{x:h.y.number(r.x,f.x,_),y:h.y.number(r.y,f.y,_),z:h.y.number(r.z,f.z,_)}}}let ei;class ai extends h.E{constructor(r){super(),ei=ei||new h.q({anchor:new h.D(h.v.light.anchor),position:new mt,color:new h.D(h.v.light.color),intensity:new h.D(h.v.light.intensity)}),this._transitionable=new h.T(ei),this.setLight(r),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(r,f={}
vendor: 18,503 bytes, line 53
53){if(!this._validate(h.r,r,f))for(const _ in r){const y=r[_];_.endsWith("-transition")?this._transitionable.setTransition(_.slice(0,-11),y):this._transitionable.setValue(_,y)}}updateTransitions(r){this._transitioning=this._transitionable.transitioned(r,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(r){this.properties=this._transitioning.possiblyEvaluate(r)}_validate(r,f,_){return(!_||_.validate!==!1)&&h.t(this,r.call(h.u,{value:f,style:{glyphs:!0,sprite:!0},styleSpec:h.v}))}}const oe=new h.q({"sky-color":new h.D(h.v.sky["sky-color"]),"horizon-color":new h.D(h.v.sky["horizon-color"]),"fog-color":new h.D(h.v.sky["fog-color"]),"fog-ground-blend":new h.D(h.v.sky["fog-ground-blend"]),"horizon-fog-blend":new h.D(h.v.sky["horizon-fog-blend"]),"sky-horizon-blend":new h.D(h.v.sky["sky-horizon-blend"]),"atmosphere-blend":new h.D(h.v.sky["atmosphere-blend"])});class Ue extends h.E{constructor(r){super(),this._transitionable=new h.T(oe),this.setSky(r),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new h.z(0))}setSky(r,f={}){if(!this._validate(h.B,r,f)){r||(r={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(const _ in r){const y=r[_];_.endsWith("-transition")?this._transitionable.setTransition(_.slice(0,-11),y):this._transitionable.setValue(_,y)}}}getSky(){return this._transitionable.serialize()}updateTransitions(r){this._transitioning=this._transitionable.transitioned(r,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(r){this.properties=this._transitioning.possiblyEvaluate(r)}_validate(r,f,_={}){return(_==null?void 0:_.validate)!==!1&&h.t(this,r.call(h.u,h.e({value:f,style:{glyphs:!0,sprite:!0},styleSpec:h.v})))}calculateFogBlendOpacity(r){return r<60?0:r<70?(r-60)/10:1}}class ut{constructor(r,f){this.width=r,this.height=f,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(r,f){const _=r.join(",")+String(f);return this.dashEntry[_]||(this.dashEntry[_]=this.addDash(r,f)),this.dashEntry[_]}getDashRanges(r,f,_){const y=[];let x=r.length%2==1?-r[r.length-1]*_:0,M=r[0]*_,D=!0;y.push({left:x,right:M,isDash:D,zeroLength:r[0]===0});let O=r[0];for(let L=1;L<r.length;L++){D=!D;const $=r[L];x=O*_,O+=$,M=O*_,y.push({left:x,right:M,isDash:D,zeroLength:$===0})}return y}addRoundDash(r,f,_){const y=f/2;for(let x=-_;x<=_;x++){const M=this.width*(this.nextRow+_+x);let D=0,O=r[D];for(let L=0;L<this.width;L++){L/O.right>1&&(O=r[++D]);const $=Math.abs(L-O.left),H=Math.abs(L-O.right),G=Math.min($,H);let ee;const ne=x/_*(y+1);if(O.isDash){const he=y-Math.abs(ne);ee=Math.sqrt(G*G+he*he)}else ee=y-Math.sqrt(G*G+ne*ne);this.data[M+L]=Math.max(0,Math.min(255,ee+128))}}}addRegularDash(r){for(let D=r.length-1;D>=0;--D){const O=r[D],L=r[D+1];O.zeroLength?r.splice(D,1):L&&L.isDash===O.isDash&&(L.left=O.left,r.splice(D,1))}const f=r[0],_=r[r.length-1];f.isDash===_.isDash&&(f.left=_.left-this.width,_.right=f.right+this.width);const y=this.width*this.nextRow;let x=0,M=r[x];for(let D=0;D<this.width;D++){D/M.right>1&&(M=r[++x]);const O=Math.abs(D-M.left),L=Math.abs(D-M.right),$=Math.min(O,L);this.data[y+D]=Math.max(0,Math.min(255,(M.isDash?$:-$)+128))}}addDash(r,f){const _=f?7:0,y=2*_+1;if(this.nextRow+y>this.height)return h.w("LineAtlas out of space"),null;let x=0;for(let D=0;D<r.length;D++)x+=r[D];if(x!==0){const D=this.width/x,O=this.getDashRanges(r,this.width,D);f?this.addRoundDash(O,D,_):this.addRegularDash(O)}const M={y:(this.nextRow+_+.5)/this.height,height:2*_/this.height,width:x};return this.nextRow+=y,this.dirty=!0,M}bind(r){const f=r.gl;this.texture?(f.bindTexture(f.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,f.texSubImage2D(f.TEXTURE_2D,0,0,0,this.width,this.height,f.ALPHA,f.UNSIGNED_BYTE,this.data))):(this.texture=f.createTexture(),f.bindTexture(f.TEXTURE_2D,this.texture),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,f.REPEAT),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,f.REPEAT),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,f.LINEAR),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,f.LINEAR),f.texImage2D(f.TEXTURE_2D,0,f.ALPHA,this.width,this.height,0,f.ALPHA,f.UNSIGNED_BYTE,this.data))}}const Tt="maplibre_preloaded_worker_pool";class $t{constructor(){this.active={}}acquire(r){if(!this.workers)for(this.workers=[];this.workers.length<$t.workerCount;)this.workers.push(new Worker(h.a.WORKER_URL));return this.active[r]=!0,this.workers.slice()}release(r){delete this.active[r],this.numActive()===0&&(this.workers.forEach((f=>{f.terminate()})),this.workers=null)}isPreloaded(){return!!this.active[Tt]}numActive(){return Object.keys(this.active).length}}const qt=Math.floor(N.hardwareConcurrency/2);let ti,Li;function ki(){return ti||(ti=new $t),ti}$t.workerCount=h.C(globalThis)?Math.max(Math.min(qt,3),1):1;class Er{constructor(r,f){this.workerPool=r,this.actors=[],this.currentActor=0,this.id=f;const _=this.workerPool.acquire(f);for(let y=0;y<_.length;y++){const x=new h.F(_[y],f);x.name=`Worker ${y}`,this.actors.push(x)}if(!this.actors.length)throw new Error("No actors found")}broadcast(r,f){const _=[];for(const y of this.actors)_.push(y.sendAsync({type:r,data:f}));return Promise.all(_)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(r=!0){this.actors.forEach((f=>{f.remove()})),this.actors=[],r&&this.workerPool.release(this.id)}registerMessageHandler(r,f){for(const _ of this.actors)_.registerMessageHandler(r,f)}}function Ts(){return Li||(Li=new Er(ki(),h.G),Li.registerMessageHandler("GR",((w,r,f)=>h.m(r,f)))),Li}function ot(w,r){const f=h.H();return h.J(f,f,[1,1,0]),h.K(f,f,[.5*w.width,.5*w.height,1]),h.L(f,f,w.calculatePosMatrix(r.toUnwrapped()))}function si(w,r,f,_,y,x){const M=(function(H,G,ee){if(H)for(const ne of H){const he=G[ne];if(he&&he.source===ee&&he.type==="fill-extrusion")return!0}else for(const ne in G){const he=G[ne];if(he.source===ee&&he.type==="fill-extrusion")return!0}return!1})(y&&y.layers,r,w.id),D=x.maxPitchScaleFactor(),O=w.tilesIn(_,D,M);O.sort(pi);const L=[];for(const H of O)L.push({wrappedTileID:H.tileID.wrapped().key,queryResults:H.tile.queryRenderedFeatures(r,f,w._state,H.queryGeometry,H.cameraQueryGeometry,H.scale,y,x,D,ot(w.transform,H.tileID))});const $=(function(H){const G={},ee={};for(const ne of H){const he=ne.queryResults,pe=ne.wrappedTileID,ge=ee[pe]=ee[pe]||{};for(const be in he){const le=he[be],Ce=ge[be]=ge[be]||{},Ie=G[be]=G[be]||[];for(const ze of le)Ce[ze.featureIndex]||(Ce[ze.featureIndex]=!0,Ie.push(ze))}}return G})(L);for(const H in $)$[H].forEach((G=>{const ee=G.feature,ne=w.getFeatureState(ee.layer["source-layer"],ee.id);ee.source=ee.layer.source,ee.layer["source-layer"]&&(ee.sourceLayer=ee.layer["source-layer"]),ee.state=ne}));return $}function pi(w,r){const f=w.tileID,_=r.tileID;return f.overscaledZ-_.overscaledZ||f.canonical.y-_.canonical.y||f.wrap-_.wrap||f.canonical.x-_.canonical.x}function Cn(w,r,f){return h._(this,void 0,void 0,(function*(){let _=w;if(w.url?_=(yield h.h(r.transformRequest(w.url,"Source"),f)).data:yield N.frameAsync(f),!_)return null;const y=h.M(h.e(_,w),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in _&&_.vector_layers&&(y.vectorLayerIds=_.vector_layers.map((x=>x.id))),y}))}class _e{constructor(r,f){r&&(f?this.setSouthWest(r).setNorthEast(f):Array.isArray(r)&&(r.length===4?this.setSouthWest([r[0],r[1]]).setNorthEast([r[2],r[3]]):this.setSouthWest(r[0]).setNorthEast(r[1])))}setNorthEast(r){return this._ne=r instanceof h.N?new h.N(r.lng,r.lat):h.N.convert(r),this}setSouthWest(r){return this._sw=r instanceof h.N?new h.N(r.lng,r.lat):h.N.convert(r),this}extend(r){const f=this._sw,_=this._ne;let y,x;if(r instanceof h.N)y=r,x=r;else{if(!(r instanceof _e))return Array.isArray(r)?r.length===4||r.every(Array.isArray)?this.extend(_e.convert(r)):this.extend(h.N.convert(r)):r&&("lng"in r||"lon"in r)&&"lat"in r?this.extend(h.N.convert(r)):this;if(y=r._sw,x=r._ne,!y||!x)return this}return f||_?(f.lng=Math.min(y.lng,f.lng),f.lat=Math.min(y.lat,f.lat),_.lng=Math.max(x.lng,_.lng),_.lat=Math.max(x.lat,_.lat)):(this._sw=new h.N(y.lng,y.lat),this._ne=new h.N(x.lng,x.lat)),this}getCenter(){return new h.N((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 h.N(this.getWest(),this.getNorth())}getSouthEast(){return new h.N(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(r){const{lng:f,lat:_}=h.N.convert(r);let y=this._sw.lng<=f&&f<=this._ne.lng;return this._sw.lng>this._ne.lng&&(y=this._sw.lng>=f&&f>=this._ne.lng),this._sw.lat<=_&&_<=this._ne.lat&&y}static convert(r){return r instanceof _e?r:r&&new _e(r)}static fromLngLat(r,f=0){const _=360*f/40075017,y=_/Math.cos(Math.PI/180*r.lat);return new _e(new h.N(r.lng-y,r.lat-_),new h.N(r.lng+y,r.lat+_))}adjustAntiMeridian(){const r=new h.N(this._sw.lng,this._sw.lat),f=new h.N(this._ne.lng,this._ne.lat);return new _e(r,r.lng>f.lng?new h.N(f.lng+360,f.lat):f)}}class Pt{constructor(r,f,_){this.bounds=_e.convert(this.validateBounds(r)),this.minzoom=f||0,this.maxzoom=_||24}validateBounds(r){return Array.isArray(r)&&r.length===4?[Math.max(-180,r[0]),Math.max(-90,r[1]),Math.min(180,r[2]),Math.min(90,r[3])]:[-180,-90,180,90]}contains(r){const f=Math.pow(2,r.z),_=Math.floor(h.O(this.bounds.getWest())*f),y=Math.floor(h.Q(this.bounds.getNorth())*f),x=Math.ceil(h.O(this.bounds.getEast())*f),M=Math.ceil(h.Q(this.bounds.getSouth())*f);return r.x>=_&&r.x<x&&r.y>=y&&r.y<M}}class gt extends h.E{constructor(r,f,_,y){if(super(),this.id=r,this.dispatcher=_,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,h.e(this,h.M(f,["url","scheme","tileSize","promoteId"])),this._options=h.e({type:"vector"},f),this._collectResourceTiming=f.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(y)}load(){return h._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new h.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const r=yield Cn(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),r&&(h.e(this,r),r.bounds&&(this.tileBounds=new Pt(r.bounds,this.minzoom,this.maxzoom)),this.fire(new h.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new h.k("data",{dataType:"source",sourceDataType:"content"})))}catch(r){this._tileJSONRequest=null,this.fire(new h.j(r))}}))}loaded(){return this._loaded}hasTile(r){return!this.tileBounds||this.tileBounds.contains(r.canonical)}onAdd(r){this.map=r,this.load()}setSourceProperty(r){this._tileJSONRequest&&this._tileJSONRequest.abort(),r(),this.load()}setTiles(r){return this.setSourceProperty((()=>{this._options.tiles=r})),this}setUrl(r){return this.setSourceProperty((()=>{this.url=r,this._options.url=r})),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return h.e({},this._options)}loadTile(r){return h._(this,void 0,void 0,(function*(){const f=r.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),_={request:this.map._requestManager.transformRequest(f,"Tile"),uid:r.uid,tileID:r.tileID,zoom:r.tileID.overscaledZ,tileSize:this.tileSize*r.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};_.request.collectResourceTiming=this._collectResourceTiming;let y="RT";if(r.actor&&r.state!=="expired"){if(r.state==="loading")return new Promise(((x,M)=>{r.reloadPromise={resolve:x,reject:M}}))}else r.actor=this.dispatcher.getActor(),y="LT";r.abortController=new AbortController;try{const x=yield r.actor.sendAsync({type:y,data:_},r.abortController);if(delete r.abortController,r.aborted)return;this._afterTileLoadWorkerResponse(r,x)}catch(x){if(delete r.abortController,r.aborted)return;if(x&&x.status!==404)throw x;this._afterTileLoadWorkerResponse(r,null)}}))}_afterTileLoadWorkerResponse(r,f){if(f&&f.resourceTiming&&(r.resourceTiming=f.resourceTiming),f&&this.map._refreshExpiredTiles&&r.setExpiryData(f),r.loadVectorData(f,this.map.painter),r.reloadPromise){const _=r.reloadPromise;r.reloadPromise=null,this.loadTile(r).then(_.resolve).catch(_.reject)}}abortTile(r){return h._(this,void 0,void 0,(function*(){r.abortController&&(r.abortController.abort(),delete r.abortController),r.actor&&(yield r.actor.sendAsync({type:"AT",data:{uid:r.uid,type:this.type,source:this.id}}))}))}unloadTile(r){return h._(this,void 0,void 0,(function*(){r.unloadVectorData(),r.actor&&(yield r.actor.sendAsync({type:"RMT",data:{uid:r.uid,type:this.type,source:this.id}}))}))}hasTransition(){return!1}}class Ut extends h.E{constructor(r,f,_,y){super(),this.id=r,this.dispatcher=_,this.setEventedParent(y),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=h.e({type:"raster"},f),h.e(this,h.M(f,["url","scheme","tileSize"]))}load(){return h._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new h.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const r=yield Cn(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,r&&(h.e(this,r),r.bounds&&(this.tileBounds=new Pt(r.bounds,this.minzoom,this.maxzoom)),this.fire(new h.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new h.k("data",{dataType:"source",sourceDataType:"content"})))}catch(r){this._tileJSONRequest=null,this.fire(new h.j(r))}}))}loaded(){return this._loaded}onAdd(r){this.map=r,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(r){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),r(),this.load()}setTiles(r){return this.setSourceProperty((()=>{this._options.tiles=r})),this}setUrl(r){return this.setSourceProperty((()=>{this.url=r,this._options.url=r})),this}serialize(){return h.e({},this._options)}hasTile(r){return!this.tileBounds||this.tileBounds.contains(r.canonical)}loadTile(r){return h._(this,void 0,void 0,(function*(){const f=r.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);r.abortController=new AbortController;try{const _=yield ve.getImage(this.map._requestManager.transformRequest(f,"Tile"),r.abortController,this.map._refreshExpiredTiles);if(delete r.abortController,r.aborted)return void(r.state="unloaded");if(_&&_.data){this.map._refreshExpiredTiles&&_.cacheControl&&_.expires&&r.setExpiryData({cacheControl:_.cacheControl,expires:_.expires});const y=this.map.painter.context,x=y.gl,M=_.data;r.texture=this.map.painter.getTileTexture(M.width),r.texture?r.texture.update(M,{useMipmap:!0}):(r.texture=new Qe(y,M,x.RGBA,{useMipmap:!0}),r.texture.bind(x.LINEAR,x.CLAMP_TO_EDGE,x.LINEAR_MIPMAP_NEAREST)),r.state="loaded"}}catch(_){if(delete r.abortController,r.aborted)r.state="unloaded";else if(_)throw r.state="errored",_}}))}abortTile(r){return h._(this,void 0,void 0,(function*(){r.abortController&&(r.abortController.abort(),delete r.abortController)}))}unloadTile(r){return h._(this,void 0,void 0,(function*(){r.texture&&this.map.painter.saveTileTexture(r.texture)}))}hasTransition(){return!1}}class Ri extends Ut{constructor(r,f,_,y){super(r,f,_,y),this.type="raster-dem",this.maxzoom=22,this._options=h.e({type:"raster-dem"},f),this.encoding=f.encoding||"mapbox",this.redFactor=f.redFactor,this.greenFactor=f.greenFactor,this.blueFactor=f.blueFactor,this.baseShift=f.baseShift}loadTile(r){return h._(this,void 0,void 0,(function*(){const f=r.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),_=this.map._requestManager.transformRequest(f,"Tile");r.neighboringTiles=this._getNeighboringTiles(r.tileID),r.abortController=new AbortController;try{const y=yield ve.getImage(_,r.abortController,this.map._refreshExpiredTiles);if(delete r.abortController,r.aborted)return void(r.state="unloaded");if(y&&y.data){const x=y.data;this.map._refreshExpiredTiles&&y.cacheControl&&y.expires&&r.setExpiryData({cacheControl:y.cacheControl,expires:y.expires});const M=h.b(x)&&h.U()?x:yield this.readImageNow(x),D={type:this.type,uid:r.uid,source:this.id,rawImageData:M,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!r.actor||r.state==="expired"){r.actor=this.dispatcher.getActor();const O=yield r.actor.sendAsync({type:"LDT",data:D});r.dem=O,r.needsHillshadePrepare=!0,r.needsTerrainPrepare=!0,r.state="loaded"}}}catch(y){if(delete r.abortController,r.aborted)r.state="unloaded";else if(y)throw r.state="errored",y}}))}readImageNow(r){return h._(this,void 0,void 0,(function*(){if(typeof VideoFrame<"u"&&h.V()){const f=r.width+2,_=r.height+2;try{return new h.R({width:f,height:_},yield h.W(r,-1,-1,f,_))}catch{}}return N.getImageData(r,1)}))}_getNeighboringTiles(r){const f=r.canonical,_=Math.pow(2,f.z),y=(f.x-1+_)%_,x=f.x===0?r.wrap-1:r.wrap,M=(f.x+1+_)%_,D=f.x+1===_?r.wrap+1:r.wrap,O={};return O[new h.S(r.overscaledZ,x,f.z,y,f.y).key]={backfilled:!1},O[new h.S(r.overscaledZ,D,f.z,M,f.y).key]={backfilled:!1},f.y>0&&(O[new h.S(r.overscaledZ,x,f.z,y,f.y-1).key]={backfilled:!1},O[new h.S(r.overscaledZ,r.wrap,f.z,f.x,f.y-1).key]={backfilled:!1},O[new h.S(r.overscaledZ,D,f.z,M,f.y-1).key]={backfilled:!1}),f.y+1<_&&(O[new h.S(r.overscaledZ,x,f.z,y,f.y+1).key]={backfilled:!1},O[new h.S(r.overscaledZ,r.wrap,f.z,f.x,f.y+1).key]={backfilled:!1},O[new h.S(r.overscaledZ,D,f.z,M,f.y+1).key]={backfilled:!1}),O}unloadTile(r){return h._(this,void 0,void 0,(function*(){r.demTexture&&this.map.painter.saveTileTexture(r.demTexture),r.fbo&&(r.fbo.destroy(),delete r.fbo),r.dem&&delete r.dem,delete r.neighboringTiles,r.state="unloaded",r.actor&&(yield r.actor.sendAsync({type:"RDT",data:{type:this.t
53ype,uid:r.uid,source:this.id}}))}))}}class Gi extends h.E{constructor(r,f,_,y){super(),this.id=r,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=_.getActor(),this.setEventedParent(y),this._data=f.data,this._options=h.e({},f),this._collectResourceTiming=f.collectResourceTiming,f.maxzoom!==void 0&&(this.maxzoom=f.maxzoom),f.type&&(this.type=f.type),f.attribution&&(this.attribution=f.attribution),this.promoteId=f.promoteId;const x=h.X/this.tileSize;f.clusterMaxZoom!==void 0&&this.maxzoom<=f.clusterMaxZoom&&h.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${f.clusterMaxZoom}".`),this.workerOptions=h.e({source:this.id,cluster:f.cluster||!1,geojsonVtOptions:{buffer:(f.buffer!==void 0?f.buffer:128)*x,tolerance:(f.tolerance!==void 0?f.tolerance:.375)*x,extent:h.X,maxZoom:this.maxzoom,lineMetrics:f.lineMetrics||!1,generateId:f.generateId||!1},superclusterOptions:{maxZoom:f.clusterMaxZoom!==void 0?f.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,f.clusterMinPoints||2),extent:h.X,radius:(f.clusterRadius||50)*x,log:!1,generateId:f.generateId||!1},clusterProperties:f.clusterProperties,filter:f.filter},f.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}load(){return h._(this,void 0,void 0,(function*(){yield this._updateWorkerData()}))}onAdd(r){this.map=r,this.load()}setData(r){return this._data=r,this._updateWorkerData(),this}updateData(r){return this._updateWorkerData(r),this}getData(){return h._(this,void 0,void 0,(function*(){const r=h.e({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:r})}))}setClusterOptions(r){return this.workerOptions.cluster=r.cluster,r&&(r.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=r.clusterRadius),r.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=r.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(r){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:r,source:this.id}})}getClusterChildren(r){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:r,source:this.id}})}getClusterLeaves(r,f,_){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:r,limit:f,offset:_}})}_updateWorkerData(r){return h._(this,void 0,void 0,(function*(){const f=h.e({type:this.type},this.workerOptions);
vendor: 6,004 bytes, line 53
53r?f.dataDiff=r:typeof this._data=="string"?(f.request=this.map._requestManager.transformRequest(N.resolveURL(this._data),"Source"),f.request.collectResourceTiming=this._collectResourceTiming):f.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new h.k("dataloading",{dataType:"source"}));try{const _=yield this.actor.sendAsync({type:"LD",data:f});if(this._pendingLoads--,this._removed||_.abandoned)return void this.fire(new h.k("dataabort",{dataType:"source"}));let y=null;_.resourceTiming&&_.resourceTiming[this.id]&&(y=_.resourceTiming[this.id].slice(0));const x={dataType:"source"};this._collectResourceTiming&&y&&y.length>0&&h.e(x,{resourceTiming:y}),this.fire(new h.k("data",Object.assign(Object.assign({},x),{sourceDataType:"metadata"}))),this.fire(new h.k("data",Object.assign(Object.assign({},x),{sourceDataType:"content"})))}catch(_){if(this._pendingLoads--,this._removed)return void this.fire(new h.k("dataabort",{dataType:"source"}));this.fire(new h.j(_))}}))}loaded(){return this._pendingLoads===0}loadTile(r){return h._(this,void 0,void 0,(function*(){const f=r.actor?"RT":"LT";r.actor=this.actor;const _={type:this.type,uid:r.uid,tileID:r.tileID,zoom:r.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};r.abortController=new AbortController;const y=yield this.actor.sendAsync({type:f,data:_},r.abortController);delete r.abortController,r.unloadVectorData(),r.aborted||r.loadVectorData(y,this.map.painter,f==="RT")}))}abortTile(r){return h._(this,void 0,void 0,(function*(){r.abortController&&(r.abortController.abort(),delete r.abortController),r.aborted=!0}))}unloadTile(r){return h._(this,void 0,void 0,(function*(){r.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:r.uid,type:this.type,source:this.id}})}))}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return h.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var or=h.Y([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class vn extends h.E{constructor(r,f,_,y){super(),this.id=r,this.dispatcher=_,this.coordinates=f.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(y),this.options=f}load(r){return h._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new h.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const f=yield ve.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,f&&f.data&&(this.image=f.data,r&&(this.coordinates=r),this._finishLoading())}catch(f){this._request=null,this._loaded=!0,this.fire(new h.j(f))}}))}loaded(){return this._loaded}updateImage(r){return r.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=r.url,this.load(r.coordinates).finally((()=>{this.texture=null})),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new h.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(r){this.map=r,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(r){this.coordinates=r;const f=r.map(h.Z.fromLngLat);this.tileID=(function(y){let x=1/0,M=1/0,D=-1/0,O=-1/0;for(const G of y)x=Math.min(x,G.x),M=Math.min(M,G.y),D=Math.max(D,G.x),O=Math.max(O,G.y);const L=Math.max(D-x,O-M),$=Math.max(0,Math.floor(-Math.log(L)/Math.LN2)),H=Math.pow(2,$);return new h.a1($,Math.floor((x+D)/2*H),Math.floor((M+O)/2*H))})(f),this.minzoom=this.maxzoom=this.tileID.z;const _=f.map((y=>this.tileID.getTilePoint(y)._round()));return this._boundsArray=new h.$,this._boundsArray.emplaceBack(_[0].x,_[0].y,0,0),this._boundsArray.emplaceBack(_[1].x,_[1].y,h.X,0),this._boundsArray.emplaceBack(_[3].x,_[3].y,0,h.X),this._boundsArray.emplaceBack(_[2].x,_[2].y,h.X,h.X),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new h.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const r=this.map.painter.context,f=r.gl;this.boundsBuffer||(this.boundsBuffer=r.createVertexBuffer(this._boundsArray,or.members)),this.boundsSegments||(this.boundsSegments=h.a0.simpleSegment(0,0,4,2)),this.texture||(this.texture=new Qe(r,this.image,f.RGBA),this.texture.bind(f.LINEAR,f.CLAMP_TO_EDGE));let _=!1;for(const y in this.tiles){const x=this.tiles[y];x.state!=="loaded"&&(x.state="loaded",x.texture=this.texture,_=!0)}_&&this.fire(new h.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(r){return h._(this,void 0,void 0,(function*(){this.tileID&&this.tileID.equals(r.tileID.canonical)?(this.tiles[String(r.tileID.wrap)]=r,r.buckets={}):r.state="errored"}))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class sn extends vn{constructor(r,f,_,y){super(r,f,_,y),this.roundZoom=!0,this.type="video",this.options=f}load(){return h._(this,void 0,void 0,(function*(){this._loaded=!1;const r=this.options;this.urls=[];for(const f of r.urls)this.urls.push(this.map._requestManager.transformRequest(f,"Source").url);try{const f=yield h.a3(this.urls);if(this._loaded=!0,!f)return;this.video=f,this.video.loop=!0,this.video.addEventListener("playing",(()=>{this.map.triggerRepaint()})),this.map&&this.video.play(),this._finishLoading()}catch(f){this.fire(new h.j(f))}}))}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(r){if(this.video){const f=this.video.seekable;r<f.start(0)||r>f.end(0)?this.fire(new h.j(new h.a2(`sources.${this.id}`,null,`Playback for this video can be set only between the ${f.start(0)} and ${f.end(0)}-second mark.`))):this.video.currentTime=r}}getVideo(){return this.video}
vendor: 4,460 bytes, line 53
53onAdd(r){this.map||(this.map=r,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 r=this.map.painter.context,f=r.gl;this.boundsBuffer||(this.boundsBuffer=r.createVertexBuffer(this._boundsArray,or.members)),this.boundsSegments||(this.boundsSegments=h.a0.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(f.LINEAR,f.CLAMP_TO_EDGE),f.texSubImage2D(f.TEXTURE_2D,0,0,0,f.RGBA,f.UNSIGNED_BYTE,this.video)):(this.texture=new Qe(r,this.video,f.RGBA),this.texture.bind(f.LINEAR,f.CLAMP_TO_EDGE));let _=!1;for(const y in this.tiles){const x=this.tiles[y];x.state!=="loaded"&&(x.state="loaded",x.texture=this.texture,_=!0)}_&&this.fire(new h.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class bn extends vn{constructor(r,f,_,y){super(r,f,_,y),f.coordinates?Array.isArray(f.coordinates)&&f.coordinates.length===4&&!f.coordinates.some((x=>!Array.isArray(x)||x.length!==2||x.some((M=>typeof M!="number"))))||this.fire(new h.j(new h.a2(`sources.${r}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new h.j(new h.a2(`sources.${r}`,null,'missing required property "coordinates"'))),f.animate&&typeof f.animate!="boolean"&&this.fire(new h.j(new h.a2(`sources.${r}`,null,'optional "animate" property must be a boolean value'))),f.canvas?typeof f.canvas=="string"||f.canvas instanceof HTMLCanvasElement||this.fire(new h.j(new h.a2(`sources.${r}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new h.j(new h.a2(`sources.${r}`,null,'missing required property "canvas"'))),this.options=f,this.animate=f.animate===void 0||f.animate}load(){return h._(this,void 0,void 0,(function*(){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 h.j(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(r){this.map=r,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let r=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,r=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,r=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const f=this.map.painter.context,_=f.gl;this.boundsBuffer||(this.boundsBuffer=f.createVertexBuffer(this._boundsArray,or.members)),this.boundsSegments||(this.boundsSegments=h.a0.simpleSegment(0,0,4,2)),this.texture?(r||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Qe(f,this.canvas,_.RGBA,{premultiply:!0});let y=!1;for(const x in this.tiles){const M=this.tiles[x];M.state!=="loaded"&&(M.state="loaded",M.texture=this.texture,y=!0)}y&&this.fire(new h.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const r of[this.canvas.width,this.canvas.height])if(isNaN(r)||r<=0)return!0;return!1}}const lr={},Ss=w=>{switch(w){case"geojson":return Gi;case"image":return vn;case"raster":return Ut;case"raster-dem":return Ri;case"vector":return gt;case"video":return sn;case"canvas":return bn}return lr[w]},pt="RTLPluginLoaded";class oa extends h.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=Ts()}_syncState(r){return this.status=r,this.dispatcher.broadcast("SRPS",{pluginStatus:r,pluginURL:this.url}).catch((f=>{throw this.status="error",f}))}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(r){return h._(this,arguments,void 0,(function*(f,_=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=N.resolveURL(f),!this.url)throw new Error(`requested url ${f}
53 is invalid`);if(this.status==="unavailable"){if(!_)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()}))}_requestImport(){return h._(this,void 0,void 0,(function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new h.k(pt))}))}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let Ir=null;function la(){return Ir||(Ir=new oa),Ir}class Za{constructor(r,f){this.timeAdded=0,this.fadeEndTime=0,this.tileID=r,this.uid=h.a4(),this.uses=0,this.tileSize=f,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(r){const f=r+this.timeAdded;f<this.fadeEndTime||(this.fadeEndTime=f)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(r){this.demTexture&&r.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(r,f,_){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",r){r.featureIndex&&(this.latestFeatureIndex=r.featureIndex,r.rawTileData?(this.latestRawTileData=r.rawTileData,this.latestFeatureIndex.rawTileData=r.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=r.collisionBoxArray,this.buckets=(function(y,x){const M={};if(!x)return M;for(const D of y){const O=D.layerIds.map((L=>x.getLayer(L))).filter(Boolean);if(O.length!==0){D.layers=O,D.stateDependentLayerIds&&(D.stateDependentLayers=D.stateDependentLayerIds.map((L=>O.filter(($=>
vendor: 8,549 bytes, line 53
53$.id===L))[0])));for(const L of O)M[L.id]=D}}return M})(r.buckets,f.style),this.hasSymbolBuckets=!1;for(const y in this.buckets){const x=this.buckets[y];if(x instanceof h.a6){if(this.hasSymbolBuckets=!0,!_)break;x.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const y in this.buckets){const x=this.buckets[y];if(x instanceof h.a6&&x.hasRTLText){this.hasRTLText=!0,la().lazyLoad();break}}this.queryPadding=0;for(const y in this.buckets){const x=this.buckets[y];this.queryPadding=Math.max(this.queryPadding,f.style.getLayer(y).queryRadius(x))}r.imageAtlas&&(this.imageAtlas=r.imageAtlas),r.glyphAtlasImage&&(this.glyphAtlasImage=r.glyphAtlasImage)}else this.collisionBoxArray=new h.a5}unloadVectorData(){for(const r in this.buckets)this.buckets[r].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(r){return this.buckets[r.id]}upload(r){for(const _ in this.buckets){const y=this.buckets[_];y.uploadPending()&&y.upload(r)}const f=r.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Qe(r,this.imageAtlas.image,f.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Qe(r,this.glyphAtlasImage,f.ALPHA),this.glyphAtlasImage=null)}prepare(r){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(r,this.imageAtlasTexture)}queryRenderedFeatures(r,f,_,y,x,M,D,O,L,$){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:y,cameraQueryGeometry:x,scale:M,tileSize:this.tileSize,pixelPosMatrix:$,transform:O,params:D,queryPadding:this.queryPadding*L},r,f,_):{}}querySourceFeatures(r,f){const _=this.latestFeatureIndex;if(!_||!_.rawTileData)return;const y=_.loadVTLayers(),x=f&&f.sourceLayer?f.sourceLayer:"",M=y._geojsonTileLayer||y[x];if(!M)return;const D=h.a7(f&&f.filter),{z:O,x:L,y:$}=this.tileID.canonical,H={z:O,x:L,y:$};for(let G=0;G<M.length;G++){const ee=M.feature(G);if(D.needGeometry){const pe=h.a8(ee,!0);if(!D.filter(new h.z(this.tileID.overscaledZ),pe,this.tileID.canonical))continue}else if(!D.filter(new h.z(this.tileID.overscaledZ),ee))continue;const ne=_.getId(ee,x),he=new h.a9(ee,O,L,$,ne);he.tile=H,r.push(he)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(r){const f=this.expirationTime;if(r.cacheControl){const _=h.aa(r.cacheControl);_["max-age"]&&(this.expirationTime=Date.now()+1e3*_["max-age"])}else r.expires&&(this.expirationTime=new Date(r.expires).getTime());if(this.expirationTime){const _=Date.now();let y=!1;if(this.expirationTime>_)y=!1;else if(f)if(this.expirationTime<f)y=!0;else{const x=this.expirationTime-f;x?this.expirationTime=_+Math.max(x,3e4):y=!0}else y=!0;y?(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(r,f){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(r).length===0)return;const _=this.latestFeatureIndex.loadVTLayers();for(const y in this.buckets){if(!f.style.hasLayer(y))continue;const x=this.buckets[y],M=x.layers[0].sourceLayer||"_geojsonTileLayer",D=_[M],O=r[M];if(!D||!O||Object.keys(O).length===0)continue;x.update(O,D,this.imageAtlas&&this.imageAtlas.patternPositions||{});const L=f&&f.style&&f.style.getLayer(y);L&&(this.queryPadding=Math.max(this.queryPadding,L.queryRadius(x)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<N.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(r){this.symbolFadeHoldUntil=N.now()+r}setDependencies(r,f){const _={};for(const y of f)_[y]=!0;this.dependencies[r]=_}hasDependency(r,f){for(const _ of r){const y=this.dependencies[_];if(y){for(const x of f)if(y[x])return!0}}return!1}}class bt{constructor(r,f){this.max=r,this.onRemove=f,this.reset()}reset(){for(const r in this.data)for(const f of this.data[r])f.timeout&&clearTimeout(f.timeout),this.onRemove(f.value);return this.data={},this.order=[],this}add(r,f,_){const y=r.wrapped().key;this.data[y]===void 0&&(this.data[y]=[]);const x={value:f,timeout:void 0};if(_!==void 0&&(x.timeout=setTimeout((()=>{this.remove(r,x)}),_)),this.data[y].push(x),this.order.push(y),this.order.length>this.max){const M=this._getAndRemoveByKey(this.order[0]);M&&this.onRemove(M)}return this}has(r){return r.wrapped().key in this.data}getAndRemove(r){return this.has(r)?this._getAndRemoveByKey(r.wrapped().key):null}_getAndRemoveByKey(r){const f=this.data[r].shift();return f.timeout&&clearTimeout(f.timeout),this.data[r].length===0&&delete this.data[r],this.order.splice(this.order.indexOf(r),1),f.value}getByKey(r){const f=this.data[r];return f?f[0].value:null}get(r){return this.has(r)?this.data[r.wrapped().key][0].value:null}remove(r,f){if(!this.has(r))return this;const _=r.wrapped().key,y=f===void 0?0:this.data[_].indexOf(f),x=this.data[_][y];return this.data[_].splice(y,1),x.timeout&&clearTimeout(x.timeout),this.data[_].length===0&&delete this.data[_],this.onRemove(x.value),this.order.splice(this.order.indexOf(_),1),this}setMaxSize(r){for(this.max=r;this.order.length>this.max;){const f=this._getAndRemoveByKey(this.order[0]);f&&this.onRemove(f)}return this}filter(r){const f=[];for(const _ in this.data)for(const y of this.data[_])r(y.value)||f.push(y);for(const _ of f)this.remove(_.value.tileID,_)}}class ii{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(r,f,_){const y=String(f);if(this.stateChanges[r]=this.stateChanges[r]||{},this.stateChanges[r][y]=this.stateChanges[r][y]||{},h.e(this.stateChanges[r][y],_),this.deletedStates[r]===null){this.deletedStates[r]={};for(const x in this.state[r])x!==y&&(this.deletedStates[r][x]=null)}else if(this.deletedStates[r]&&this.deletedStates[r][y]===null){this.deletedStates[r][y]={};for(const x in this.state[r][y])_[x]||(this.deletedStates[r][y][x]=null)}else for(const x in _)this.deletedStates[r]&&this.deletedStates[r][y]&&this.deletedStates[r][y][x]===null&&delete this.deletedStates[r][y][x]}removeFeatureState(r,f,_){if(this.deletedStates[r]===null)return;const y=String(f);if(this.deletedStates[r]=this.deletedStates[r]||{},_&&f!==void 0)this.deletedStates[r][y]!==null&&(this.deletedStates[r][y]=this.deletedStates[r][y]||{},this.deletedStates[r][y][_]=null);else if(f!==void 0)if(this.stateChanges[r]&&this.stateChanges[r][y])for(_ in this.deletedStates[r][y]={},this.stateChanges[r][y])this.deletedStates[r][y][_]=null;else this.deletedStates[r][y]=null;else this.deletedStates[r]=null}getState(r,f){const _=String(f),y=h.e({},(this.state[r]||{})[_],(this.stateChanges[r]||{})[_]);if(this.deletedStates[r]===null)return{};if(this.deletedStates[r]){const x=this.deletedStates[r][f];if(x===null)return{};for(const M in x)delete y[M]}return y}initializeTileState(r,f){r.setFeatureState(this.state,f)}coalesceChanges(r,f){const _={};for(const y in this.stateChanges){this.state[y]=this.state[y]||{};const x={};for(const M in this.stateChanges[y])this.state[y][M]||(this.state[y][M]={}),h.e(this.state[y][M],this.stateChanges[y][M]),x[M]=this.state[y][M];_[y]=x}for(const y in this.deletedStates){this.state[y]=this.state[y]||{};const x={};if(this.deletedStates[y]===null)for(const M in this.state[y])x[M]={},this.state[y][M]={};else for(const M in this.deletedStates[y]){if(this.deletedStates[y][M]===null)this.state[y][M]={};else for(const D of Object.keys(this.deletedStates[y][M]))delete this.state[y][M][D];x[M]=this.state[y][M]}_[y]=_[y]||{},h.e(_[y],x)}if(this.stateChanges={},this.deletedStates={},Object.keys(_).length!==0)for(const y in r)r[y].setFeatureState(_,f)}}class Wt extends h.E{constructor(r,f,_){super(),this.id=r,this.dispatcher=_,this.on("data",(y=>this._dataHandler(y))),this.on("dataloading",(()=>{this._sourceErrored=!1})),this.on("error",(()=>{this._sourceErrored=this._source.loaded()})),this._source=((y,x,M,D)=>{const O=new(Ss(x.type))(y,x,M,D);if(O.id!==y)throw new Error(`Expected Source id to be ${y} instead of ${O.id}`);return O})(r,f,_,this),this._tiles={},this._cache=new bt(0,(y=>this._unloadTile(y))),this._timers={},this._cacheTimers={}
vendor: 12,755 bytes, line 53
53,this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new ii,this._didEmitContent=!1,this._updated=!1}onAdd(r){this.map=r,this._maxTileCacheSize=r?r._maxTileCacheSize:null,this._maxTileCacheZoomLevels=r?r._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(r)}onRemove(r){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(r)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const r in this._tiles){const f=this._tiles[r];if(f.state!=="loaded"&&f.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const r=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,r&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(r,f,_){return h._(this,void 0,void 0,(function*(){try{yield this._source.loadTile(r),this._tileLoaded(r,f,_)}catch(y){r.state="errored",y.status!==404?this._source.fire(new h.j(y,{tile:r})):this.update(this.transform,this.terrain)}}))}_unloadTile(r){this._source.unloadTile&&this._source.unloadTile(r)}_abortTile(r){this._source.abortTile&&this._source.abortTile(r),this._source.fire(new h.k("dataabort",{tile:r,coord:r.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(r){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const f in this._tiles){const _=this._tiles[f];_.upload(r),_.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map((r=>r.tileID)).sort(xn).map((r=>r.key))}getRenderableIds(r){const f=[];for(const _ in this._tiles)this._isIdRenderable(_,r)&&f.push(this._tiles[_]);return r?f.sort(((_,y)=>{const x=_.tileID,M=y.tileID,D=new h.P(x.canonical.x,x.canonical.y)._rotate(this.transform.angle),O=new h.P(M.canonical.x,M.canonical.y)._rotate(this.transform.angle);return x.overscaledZ-M.overscaledZ||O.y-D.y||O.x-D.x})).map((_=>_.tileID.key)):f.map((_=>_.tileID)).sort(xn).map((_=>_.key))}hasRenderableParent(r){const f=this.findLoadedParent(r,0);return!!f&&this._isIdRenderable(f.tileID.key)}_isIdRenderable(r,f){return this._tiles[r]&&this._tiles[r].hasData()&&!this._coveredTiles[r]&&(f||!this._tiles[r].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const r in this._tiles)this._tiles[r].state!=="errored"&&this._reloadTile(r,"reloading")}}_reloadTile(r,f){return h._(this,void 0,void 0,(function*(){const _=this._tiles[r];_&&(_.state!=="loading"&&(_.state=f),yield this._loadTile(_,r,f))}))}_tileLoaded(r,f,_){r.timeAdded=N.now(),_==="expired"&&(r.refreshedUponExpiration=!0),this._setTileReloadTimer(f,r),this.getSource().type==="raster-dem"&&r.dem&&this._backfillDEM(r),this._state.initializeTileState(r,this.map?this.map.painter:null),r.aborted||this._source.fire(new h.k("data",{dataType:"source",tile:r,coord:r.tileID}))}_backfillDEM(r){const f=this.getRenderableIds();for(let y=0;y<f.length;y++){const x=f[y];if(r.neighboringTiles&&r.neighboringTiles[x]){const M=this.getTileByID(x);_(r,M),_(M,r)}}function _(y,x){y.needsHillshadePrepare=!0,y.needsTerrainPrepare=!0;let M=x.tileID.canonical.x-y.tileID.canonical.x;const D=x.tileID.canonical.y-y.tileID.canonical.y,O=Math.pow(2,y.tileID.canonical.z),L=x.tileID.key;M===0&&D===0||Math.abs(D)>1||(Math.abs(M)>1&&(Math.abs(M+O)===1?M+=O:Math.abs(M-O)===1&&(M-=O)),x.dem&&y.dem&&(y.dem.backfillBorder(x.dem,M,D),y.neighboringTiles&&y.neighboringTiles[L]&&(y.neighboringTiles[L].backfilled=!0)))}}getTile(r){return this.getTileByID(r.key)}getTileByID(r){return this._tiles[r]}_retainLoadedChildren(r,f,_,y){for(const x in this._tiles){let M=this._tiles[x];if(y[x]||!M.hasData()||M.tileID.overscaledZ<=f||M.tileID.overscaledZ>_)continue;let D=M.tileID;for(;M&&M.tileID.overscaledZ>f+1;){const L=M.tileID.scaledTo(M.tileID.overscaledZ-1);M=this._tiles[L.key],M&&M.hasData()&&(D=L)}let O=D;for(;O.overscaledZ>f;)if(O=O.scaledTo(O.overscaledZ-1),r[O.key]){y[D.key]=D;break}}}findLoadedParent(r,f){if(r.key in this._loadedParentTiles){const _=this._loadedParentTiles[r.key];return _&&_.tileID.overscaledZ>=f?_:null}for(let _=r.overscaledZ-1;_>=f;_--){const y=r.scaledTo(_),x=this._getLoadedTile(y);if(x)return x}}findLoadedSibling(r){return this._getLoadedTile(r)}_getLoadedTile(r){const f=this._tiles[r.key];return f&&f.hasData()?f:this._cache.getByKey(r.wrapped().key)}updateCacheSize(r){const f=Math.ceil(r.width/this._source.tileSize)+1,_=Math.ceil(r.height/this._source.tileSize)+1,y=Math.floor(f*_*(this._maxTileCacheZoomLevels===null?h.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),x=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,y):y;this._cache.setMaxSize(x)}handleWrapJump(r){const f=Math.round((r-(this._prevLng===void 0?r:this._prevLng))/360);if(this._prevLng=r,f){const _={};for(const y in this._tiles){const x=this._tiles[y];x.tileID=x.tileID.unwrapTo(x.tileID.wrap+f),_[x.tileID.key]=x}this._tiles=_;for(const y in this._timers)clearTimeout(this._timers[y]),delete this._timers[y];for(const y in this._tiles)this._setTileReloadTimer(y,this._tiles[y])}}_updateCoveredAndRetainedTiles(r,f,_,y,x,M){const D={},O={},L=Object.keys(r),$=N.now();for(const H of L){const G=r[H],ee=this._tiles[H];if(!ee||ee.fadeEndTime!==0&&ee.fadeEndTime<=$)continue;const ne=this.findLoadedParent(G,f),he=this.findLoadedSibling(G),pe=ne||he||null;pe&&(this._addTile(pe.tileID),D[pe.tileID.key]=pe.tileID),O[H]=G}this._retainLoadedChildren(O,y,_,r);for(const H in D)r[H]||(this._coveredTiles[H]=!0,r[H]=D[H]);if(M){const H={},G={};for(const ee of x)this._tiles[ee.key].hasData()?H[ee.key]=ee:G[ee.key]=ee;for(const ee in G){const ne=G[ee].children(this._source.maxzoom);this._tiles[ne[0].key]&&this._tiles[ne[1].key]&&this._tiles[ne[2].key]&&this._tiles[ne[3].key]&&(H[ne[0].key]=r[ne[0].key]=ne[0],H[ne[1].key]=r[ne[1].key]=ne[1],H[ne[2].key]=r[ne[2].key]=ne[2],H[ne[3].key]=r[ne[3].key]=ne[3],delete G[ee])}for(const ee in G){const ne=G[ee],he=this.findLoadedParent(ne,this._source.minzoom),pe=this.findLoadedSibling(ne),ge=he||pe||null;if(ge){H[ge.tileID.key]=r[ge.tileID.key]=ge.tileID;for(const be in H)H[be].isChildOf(ge.tileID)&&delete H[be]}}for(const ee in this._tiles)H[ee]||(this._coveredTiles[ee]=!0)}}update(r,f){if(!this._sourceLoaded||this._paused)return;let _;this.transform=r,this.terrain=f,this.updateCacheSize(r),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?_=r.getVisibleUnwrappedCoordinates(this._source.tileID).map(($=>new h.S($.canonical.z,$.wrap,$.canonical.z,$.canonical.x,$.canonical.y))):(_=r.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:f}),this._source.hasTile&&(_=_.filter(($=>this._source.hasTile($))))):_=[];const y=r.coveringZoomLevel(this._source),x=Math.max(y-Wt.maxOverzooming,this._source.minzoom),M=Math.max(y+Wt.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const $={};for(const H of _)if(H.canonical.z>this._source.minzoom){const G=H.scaledTo(H.canonical.z-1);$[G.key]=G;const ee=H.scaledTo(Math.max(this._source.minzoom,Math.min(H.canonical.z,5)));$[ee.key]=ee}_=_.concat(Object.values($))}const D=_.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,D&&this.fire(new h.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const O=this._updateRetainedTiles(_,y);Ws(this._source.type)&&this._updateCoveredAndRetainedTiles(O,x,M,y,_,f);for(const $ in O)this._tiles[$].clearFadeHold();const L=h.ab(this._tiles,O);for(const $ of L){const H=this._tiles[$];H.hasSymbolBuckets&&!H.holdingForFade()?H.setHoldDuration(this.map._fadeDuration):H.hasSymbolBuckets&&!H.symbolFadeFinished()||this._removeTile($)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(const r in this._tiles)this._tiles[r].holdingForFade()&&this._removeTile(r)}_updateRetainedTiles(r,f){var _;const y={},x={},M=Math.max(f-Wt.maxOverzooming,this._source.minzoom),D=Math.max(f+Wt.maxUnderzooming,this._source.minzoom),O={};for(const L of r){const $=this._addTile(L);y[L.key]=L,$.hasData()||f<this._source.maxzoom&&(O[L.key]=L)}this._retainLoadedChildren(O,f,D,y);for(const L of r){let $=this._tiles[L.key];if($.hasData())continue;if(f+1>this._source.maxzoom){const G=L.children(this._source.maxzoom)[0],ee=this.getTile(G);if(ee&&ee.hasData()){y[G.key]=G;continue}}else{const G=L.children(this._source.maxzoom);if(y[G[0].key]&&y[G[1].key]&&y[G[2].key]&&y[G[3].key])continue}let H=$.wasRequested();for(let G=L.overscaledZ-1;G>=M;--G){const ee=L.scaledTo(G);if(x[ee.key])break;if(x[ee.key]=!0,$=this.getTile(ee),!$&&H&&($=this._addTile(ee)),$){const ne=$.hasData();if((ne||!(!((_=this.map)===null||_===void 0)&&_.cancelPendingTileRequestsWhileZooming)||H)&&(y[ee.key]=ee),H=$.wasRequested(),ne)break}}}return y}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const r in this._tiles){const f=[];let _,y=this._tiles[r].tileID;for(;y.overscaledZ>0;){if(y.key in this._loadedParentTiles){_=this._loadedParentTiles[y.key];break}f.push(y.key);const x=y.scaledTo(y.overscaledZ-1);if(_=this._getLoadedTile(x),_)break;y=x}for(const x of f)this._loadedParentTiles[x]=_}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(const r in this._tiles){const f=this._tiles[r].tileID,_=this._getLoadedTile(f);this._loadedSiblingTiles[f.key]=_}}_addTile(r){let f=this._tiles[r.key];if(f)return f;f=this._cache.getAndRemove(r),f&&(this._setTileReloadTimer(r.key,f),f.tileID=r,this._state.initializeTileState(f,this.map?this.map.painter:null),this._cacheTimers[r.key]&&(clearTimeout(this._cacheTimers[r.key]),delete this._cacheTimers[r.key],this._setTileReloadTimer(r.key,f)));const _=f;return f||(f=new Za(r,this._source.tileSize*r.overscaleFactor()),this._loadTile(f,r.key,f.state)),f.uses++,this._tiles[r.key]=f,_||this._source.fire(new h.k("dataloading",{tile:f,coord:f.tileID,dataType:"source"})),f}_setTileReloadTimer(r,f){r in this._timers&&(clearTimeout(this._timers[r]),delete this._timers[r]);const _=f.getExpiryTimeout();_&&(this._timers[r]=setTimeout((()=>{this._reloadTile(r,"expired"),delete this._timers[r]}),_))}_removeTile(r){const f=this._tiles[r];f&&(f.uses--,delete this._tiles[r],this._timers[r]&&(clearTimeout(this._timers[r]),delete this._timers[r]),f.uses>0||(f.hasData()&&f.state!=="reloading"?this._cache.add(f.tileID,f,f.getExpiryTimeout()):(f.aborted=!0,this._abortTile(f),this._unloadTile(f))))}_dataHandler(r){const f=r.sourceDataType;r.dataType==="source"&&f==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&r.dataType==="source"&&f==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const r in this._tiles)this._removeTile(r);this._cache.reset()}tilesIn(r,f,_){const y=[],x=this.transform;if(!x)return y;const M=_?x.getCameraQueryGeometry(r):r,D=r.map((ne=>x.pointCoordinate(ne,this.terrain))),O=M.map((ne=>x.pointCoordinate(ne,this.terrain))),L=this.getIds();let $=1/0,H=1/0,G=-1/0,ee=-1/0;for(const ne of O)$=Math.min($,ne.x),H=Math.min(H,ne.y),G=Math.max(G,ne.x),ee=Math.max(ee,ne.y);for(let ne=0;ne<L.length;ne++){const he=this._tiles[L[ne]];if(he.holdingForFade())continue;const pe=he.tileID,ge=Math.pow(2,x.zoom-he.tileID.overscaledZ),be=f*he.queryPadding*h.X/he.tileSize/ge,le=[pe.getTilePoint(new h.Z($,H)),pe.getTilePoint(new h.Z(G,ee))];if(le[0].x-be<h.X&&le[0].y-be<h.X&&le[1].x+be>=0&&le[1].y+be>=0){const Ce=D.map((ze=>pe.getTilePoint(ze))),Ie=O.map((ze=>pe.getTilePoint(ze)));y.push({tile:he,tileID:pe,queryGeometry:Ce,cameraQueryGeometry:Ie,scale:ge})}}return y}getVisibleCoordinates(r){const f=this.getRenderableIds(r).map((_=>this._tiles[_].tileID));for(const _ of f)_.posMatrix=this.transform.calculatePosMatrix(_.toUnwrapped());return f}hasTransition(){if(this._source.hasTransition())return!0;if(Ws(this._source.type)){const r=N.now();for(const f in this._tiles)if(this._tiles[f].fadeEndTime>=r)return!0}return!1}setFeatureState(r,f,_){this._state.updateState(r=r||"_geojsonTileLayer",f,_)}removeFeatureState(r,f,_){this._state.removeFeatureState(r=r||"_geojsonTileLayer",f,_)}getFeatureState(r,f){return this._state.getState(r=r||"_geojsonTileLayer",f)}
vendor: 4,547 bytes, line 53
53setDependencies(r,f,_){const y=this._tiles[r];y&&y.setDependencies(f,_)}reloadTilesForDependencies(r,f){for(const _ in this._tiles)this._tiles[_].hasDependency(r,f)&&this._reloadTile(_,"reloading");this._cache.filter((_=>!_.hasDependency(r,f)))}}function xn(w,r){const f=Math.abs(2*w.wrap)-+(w.wrap<0),_=Math.abs(2*r.wrap)-+(r.wrap<0);return w.overscaledZ-r.overscaledZ||_-f||r.canonical.y-w.canonical.y||r.canonical.x-w.canonical.x}function Ws(w){return w==="raster"||w==="image"||w==="video"}Wt.maxOverzooming=10,Wt.maxUnderzooming=3;class ui{constructor(r,f){this.reset(r,f)}reset(r,f){this.points=r||[],this._distances=[0];for(let _=1;_<this.points.length;_++)this._distances[_]=this._distances[_-1]+this.points[_].dist(this.points[_-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(f||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(r){if(this.points.length===1)return this.points[0];r=h.ac(r,0,1);let f=1,_=this._distances[f];const y=r*this.paddedLength+this.padding;for(;_<y&&f<this._distances.length;)_=this._distances[++f];const x=f-1,M=this._distances[x],D=_-M,O=D>0?(y-M)/D:0;return this.points[x].mult(1-O).add(this.points[f].mult(O))}}function ca(w,r){let f=!0;return w==="always"||w!=="never"&&r!=="never"||(f=!1),f}class As{constructor(r,f,_){const y=this.boxCells=[],x=this.circleCells=[];this.xCellCount=Math.ceil(r/_),this.yCellCount=Math.ceil(f/_);for(let M=0;M<this.xCellCount*this.yCellCount;M++)y.push([]),x.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=r,this.height=f,this.xScale=this.xCellCount/r,this.yScale=this.yCellCount/f,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(r,f,_,y,x){this._forEachCell(f,_,y,x,this._insertBoxCell,this.boxUid++),this.boxKeys.push(r),this.bboxes.push(f),this.bboxes.push(_),this.bboxes.push(y),this.bboxes.push(x)}insertCircle(r,f,_,y){this._forEachCell(f-y,_-y,f+y,_+y,this._insertCircleCell,this.circleUid++),this.circleKeys.push(r),this.circles.push(f),this.circles.push(_),this.circles.push(y)}_insertBoxCell(r,f,_,y,x,M){this.boxCells[x].push(M)}_insertCircleCell(r,f,_,y,x,M){this.circleCells[x].push(M)}_query(r,f,_,y,x,M,D){if(_<0||r>this.width||y<0||f>this.height)return[];const O=[];if(r<=0&&f<=0&&this.width<=_&&this.height<=y){if(x)return[{key:null,x1:r,y1:f,x2:_,y2:y}];for(let L=0;L<this.boxKeys.length;L++)O.push({key:this.boxKeys[L],x1:this.bboxes[4*L],y1:this.bboxes[4*L+1],x2:this.bboxes[4*L+2],y2:this.bboxes[4*L+3]});for(let L=0;L<this.circleKeys.length;L++){const $=this.circles[3*L],H=this.circles[3*L+1],G=this.circles[3*L+2];O.push({key:this.circleKeys[L],x1:$-G,y1:H-G,x2:$+G,y2:H+G})}}else this._forEachCell(r,f,_,y,this._queryCell,O,{hitTest:x,overlapMode:M,seenUids:{box:{},circle:{}}},D);return O}query(r,f,_,y){return this._query(r,f,_,y,!1,null)}hitTest(r,f,_,y,x,M){return this._query(r,f,_,y,!0,x,M).length>0}hitTestCircle(r,f,_,y,x){const M=r-_,D=r+_,O=f-_,L=f+_;if(D<0||M>this.width||L<0||O>this.height)return!1;const $=[];return this._forEachCell(M,O,D,L,this._queryCellCircle,$,{hitTest:!0,overlapMode:y,circle:{x:r,y:f,radius:_},seenUids:{box:{},circle:{}}},x),$.length>0}_queryCell(r,f,_,y,x,M,D,O){const{seenUids:L,hitTest:$,overlapMode:H}=D,G=this.boxCells[x];if(G!==null){const ne=this.bboxes;for(const he of G)if(!L.box[he]){L.box[he]=!0;const pe=4*he,ge=this.boxKeys[he];if(r<=ne[pe+2]&&f<=ne[pe+3]&&_>=ne[pe+0]&&y>=ne[pe+1]&&(!O||O(ge))&&(!$||!ca(H,ge.overlapMode))&&(M.push({key:ge,x1:ne[pe],y1:ne[pe+1],x2:ne[pe+2],y2:ne[pe+3]}),$))return!0}}const ee=this.circleCells[x];if(ee!==null){const ne=this.circles;for(const he of ee)if(!L.circle[he]){L.circle[he]=!0;const pe=3*he,ge=this.circleKeys[he];if(this._circleAndRectCollide(ne[pe],ne[pe+1],ne[pe+2],r,f,_,y)&&(!O||O(ge))&&(!$||!ca(H,ge.overlapMode))){const be=ne[pe],le=ne[pe+1],Ce=ne[pe+2];if(M.push({key:ge,x1:be-Ce,y1:le-Ce,x2:be+Ce,y2:le+Ce}),$)return!0}}}return!1}_queryCellCircle(r,f,_,y,x,M,D,O){const{circle:L,seenUids:$,overlapMode:H}=D,G=this.boxCells[x];if(G!==null){const ne=this.bboxes;for(const he of G)if(!$.box[he]){$.box[he]=!0;const pe=4*he,ge=this.boxKeys[he];if(this._circleAndRectCollide(L.x,L.y,L.radius,ne[pe+0],ne[pe+1],ne[pe+2],ne[pe+3])&&(!O||O(ge))&&!ca(H,ge.overlapMode))return M.push(!0),!0}}const ee=this.circleCells[x];if(ee!==null){const ne=this.circles;for(const he of ee)if(!$.circle[he]){$.circle[he]=!0;const pe=3*he,ge=this.circleKeys[he];if(this._circlesCollide(ne[pe],ne[pe+1],ne[pe+2],L.x,L.y,L.radius)&&
vendor: 17,730 bytes, line 53
53(!O||O(ge))&&!ca(H,ge.overlapMode))return M.push(!0),!0}}}_forEachCell(r,f,_,y,x,M,D,O){const L=this._convertToXCellCoord(r),$=this._convertToYCellCoord(f),H=this._convertToXCellCoord(_),G=this._convertToYCellCoord(y);for(let ee=L;ee<=H;ee++)for(let ne=$;ne<=G;ne++)if(x.call(this,r,f,_,y,this.xCellCount*ne+ee,M,D,O))return}_convertToXCellCoord(r){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(r*this.xScale)))}_convertToYCellCoord(r){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(r*this.yScale)))}_circlesCollide(r,f,_,y,x,M){const D=y-r,O=x-f,L=_+M;return L*L>D*D+O*O}_circleAndRectCollide(r,f,_,y,x,M,D){const O=(M-y)/2,L=Math.abs(r-(y+O));if(L>O+_)return!1;const $=(D-x)/2,H=Math.abs(f-(x+$));if(H>$+_)return!1;if(L<=O||H<=$)return!0;const G=L-O,ee=H-$;return G*G+ee*ee<=_*_}}function Xs(w,r,f,_,y){const x=h.H();return r?(h.K(x,x,[1/y,1/y,1]),f||h.ad(x,x,_.angle)):h.L(x,_.labelPlaneMatrix,w),x}function ps(w,r,f,_,y){if(r){const x=h.ae(w);return h.K(x,x,[y,y,1]),f||h.ad(x,x,-_.angle),x}return _.glCoordMatrix}function de(w,r,f,_){let y;_?(y=[w,r,_(w,r),1],h.af(y,y,f)):(y=[w,r,0,1],yi(y,y,f));const x=y[3];return{point:new h.P(y[0]/x,y[1]/x),signedDistanceFromCamera:x,isOccluded:!1}}function q(w,r){return .5+w/r*.5}function X(w,r){return w.x>=-r[0]&&w.x<=r[0]&&w.y>=-r[1]&&w.y<=r[1]}function ie(w,r,f,_,y,x,M,D,O,L,$,H,G,ee,ne){const he=_?w.textSizeData:w.iconSizeData,pe=h.ag(he,f.transform.zoom),ge=[256/f.width*2+1,256/f.height*2+1],be=_?w.text.dynamicLayoutVertexArray:w.icon.dynamicLayoutVertexArray;be.clear();const le=w.lineVertexArray,Ce=_?w.text.placedSymbolArray:w.icon.placedSymbolArray,Ie=f.transform.width/f.transform.height;let ze=!1;for(let Ge=0;Ge<Ce.length;Ge++){const dt=Ce.get(Ge);if(dt.hidden||dt.writingMode===h.ah.vertical&&!ze){Xt(dt.numGlyphs,be);continue}ze=!1;const vt=de(dt.anchorX,dt.anchorY,r,ne);if(!X(vt.point,ge)){Xt(dt.numGlyphs,be);continue}const Mt=q(f.transform.cameraToCenterDistance,vt.signedDistanceFromCamera),xt=h.ai(he,pe,dt),ft=M?xt/Mt:xt*Mt,Ot={getElevation:ne,labelPlaneMatrix:y,lineVertexArray:le,pitchWithMap:M,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:L,tileAnchorPoint:new h.P(dt.anchorX,dt.anchorY),unwrappedTileID:$,width:H,height:G,translation:ee},ni=Me(Ot,dt,ft,!1,D,r,x,w.glyphOffsetArray,be,Ie,O);ze=ni.useVertical,(ni.notEnoughRoom||ze||ni.needsFlipping&&Me(Ot,dt,ft,!0,D,r,x,w.glyphOffsetArray,be,Ie,O).notEnoughRoom)&&Xt(dt.numGlyphs,be)}_?w.text.dynamicLayoutVertexBuffer.updateData(be):w.icon.dynamicLayoutVertexBuffer.updateData(be)}function ue(w,r,f,_,y,x,M,D){const O=x.glyphStartIndex+x.numGlyphs,L=x.lineStartIndex,$=x.lineStartIndex+x.lineLength,H=r.getoffsetX(x.glyphStartIndex),G=r.getoffsetX(O-1),ee=yt(w*H,f,_,y,x.segment,L,$,D,M);if(!ee)return null;const ne=yt(w*G,f,_,y,x.segment,L,$,D,M);return ne?D.projectionCache.anyProjectionOccluded?null:{first:ee,last:ne}:null}function Se(w,r,f,_){return w===h.ah.horizontal&&Math.abs(f.y-r.y)>Math.abs(f.x-r.x)*_?{useVertical:!0}:(w===h.ah.vertical?r.y<f.y:r.x>f.x)?{needsFlipping:!0}:null}function Me(w,r,f,_,y,x,M,D,O,L,$){const H=f/24,G=r.lineOffsetX*H,ee=r.lineOffsetY*H;let ne;if(r.numGlyphs>1){const he=r.glyphStartIndex+r.numGlyphs,pe=r.lineStartIndex,ge=r.lineStartIndex+r.lineLength,be=ue(H,D,G,ee,_,r,$,w);if(!be)return{notEnoughRoom:!0};const le=de(be.first.point.x,be.first.point.y,M,w.getElevation).point,Ce=de(be.last.point.x,be.last.point.y,M,w.getElevation).point;if(y&&!_){const Ie=Se(r.writingMode,le,Ce,L);if(Ie)return Ie}ne=[be.first];for(let Ie=r.glyphStartIndex+1;Ie<he-1;Ie++)ne.push(yt(H*D.getoffsetX(Ie),G,ee,_,r.segment,pe,ge,w,$));ne.push(be.last)}else{if(y&&!_){const pe=de(w.tileAnchorPoint.x,w.tileAnchorPoint.y,x,w.getElevation).point,ge=r.lineStartIndex+r.segment+1,be=new h.P(w.lineVertexArray.getx(ge),w.lineVertexArray.gety(ge)),le=de(be.x,be.y,x,w.getElevation),Ce=le.signedDistanceFromCamera>0?le.point:(function(ze,Ge,dt,vt,Mt,xt){return ke(ze,Ge,dt,1,Mt,xt)})(w.tileAnchorPoint,be,pe,0,x,w),Ie=Se(r.writingMode,pe,Ce,L);if(Ie)return Ie}const he=yt(H*D.getoffsetX(r.glyphStartIndex),G,ee,_,r.segment,r.lineStartIndex,r.lineStartIndex+r.lineLength,w,$);if(!he||w.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};ne=[he]}for(const he of ne)h.aj(O,he.point,he.angle);return{}}function ke(w,r,f,_,y,x){const M=w.add(w.sub(r)._unit()),D=y!==void 0?de(M.x,M.y,y,x.getElevation).point:qe(M.x,M.y,x).point,O=f.sub(D);return f.add(O._mult(_/O.mag()))}function ye(w,r,f){const _=r.projectionCache;if(_.projections[w])return _.projections[w];const y=new h.P(r.lineVertexArray.getx(w),r.lineVertexArray.gety(w)),x=qe(y.x,y.y,r);if(x.signedDistanceFromCamera>0)return _.projections[w]=x.point,_.anyProjectionOccluded=_.anyProjectionOccluded||x.isOccluded,x.point;const M=w-f.direction;return(function(D,O,L,$,H){return ke(D,O,L,$,void 0,H)})(f.distanceFromAnchor===0?r.tileAnchorPoint:new h.P(r.lineVertexArray.getx(M),r.lineVertexArray.gety(M)),y,f.previousVertex,f.absOffsetX-f.distanceFromAnchor+1,r)}function qe(w,r,f){const _=w+f.translation[0],y=r+f.translation[1];let x;return!f.pitchWithMap&&f.projection.useSpecialProjectionForSymbols?(x=f.projection.projectTileCoordinates(_,y,f.unwrappedTileID,f.getElevation),x.point.x=(.5*x.point.x+.5)*f.width,x.point.y=(.5*-x.point.y+.5)*f.height):(x=de(_,y,f.labelPlaneMatrix,f.getElevation),x.isOccluded=!1),x}function tt(w,r,f){return w._unit()._perp()._mult(r*f)}function je(w,r,f,_,y,x,M,D,O){if(D.projectionCache.offsets[w])return D.projectionCache.offsets[w];const L=f.add(r);if(w+O.direction<_||w+O.direction>=y)return D.projectionCache.offsets[w]=L,L;const $=ye(w+O.direction,D,O),H=tt($.sub(f),M,O.direction),G=f.add(H),ee=$.add(H);return D.projectionCache.offsets[w]=h.ak(x,L,G,ee)||L,D.projectionCache.offsets[w]}function yt(w,r,f,_,y,x,M,D,O){const L=_?w-r:w+r;let $=L>0?1:-1,H=0;_&&($*=-1,H=Math.PI),$<0&&(H+=Math.PI);let G,ee=$>0?x+y:x+y+1;D.projectionCache.cachedAnchorPoint?G=D.projectionCache.cachedAnchorPoint:(G=qe(D.tileAnchorPoint.x,D.tileAnchorPoint.y,D).point,D.projectionCache.cachedAnchorPoint=G);let ne,he,pe=G,ge=G,be=0,le=0;const Ce=Math.abs(L),Ie=[];let ze;for(;be+le<=Ce;){if(ee+=$,ee<x||ee>=M)return null;be+=le,ge=pe,he=ne;const vt={absOffsetX:Ce,direction:$,distanceFromAnchor:be,previousVertex:ge};if(pe=ye(ee,D,vt),f===0)Ie.push(ge),ze=pe.sub(ge);else{let Mt;const xt=pe.sub(ge);Mt=xt.mag()===0?tt(ye(ee+$,D,vt).sub(pe),f,$):tt(xt,f,$),he||(he=ge.add(Mt)),ne=je(ee,Mt,pe,x,M,he,f,D,vt),Ie.push(he),ze=ne.sub(he)}le=ze.mag()}const Ge=ze._mult((Ce-be)/le)._add(he||ge),dt=H+Math.atan2(pe.y-ge.y,pe.x-ge.x);return Ie.push(Ge),{point:Ge,angle:O?dt:0,path:Ie}}const jt=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Xt(w,r){for(let f=0;f<w;f++){const _=r.length;r.resize(_+4),r.float32.set(jt,3*_)}}function yi(w,r,f){const _=r[0],y=r[1];return w[0]=f[0]*_+f[4]*y+f[12],w[1]=f[1]*_+f[5]*y+f[13],w[3]=f[3]*_+f[7]*y+f[15],w}const Vt=100;class hi{constructor(r,f,_=new As(r.width+200,r.height+200,25),y=new As(r.width+200,r.height+200,25)){this.transform=r,this.mapProjection=f,this.grid=_,this.ignoredGrid=y,this.pitchFactor=Math.cos(r._pitch)*r.cameraToCenterDistance,this.screenRightBoundary=r.width+Vt,this.screenBottomBoundary=r.height+Vt,this.gridRightBoundary=r.width+200,this.gridBottomBoundary=r.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(r,f,_,y,x,M,D,O,L,$,H){const G=r.anchorPointX+O[0],ee=r.anchorPointY+O[1],ne=this.projectAndGetPerspectiveRatio(y,G,ee,x,$),he=_*ne.perspectiveRatio;let pe;if(M||D)pe=this._projectCollisionBox(r,he,y,x,M,D,O,ne,$,H);else{const Ie=ne.point.x+(H?H.x*he:0),ze=ne.point.y+(H?H.y*he:0);pe={allPointsOccluded:!1,box:[Ie+r.x1*he,ze+r.y1*he,Ie+r.x2*he,ze+r.y2*he]}}const[ge,be,le,Ce]=pe.box;return this.mapProjection.useSpecialProjectionForSymbols&&(M?pe.allPointsOccluded:this.mapProjection.isOccluded(G,ee,x))||ne.perspectiveRatio<this.perspectiveRatioCutoff||!this.isInsideGrid(ge,be,le,Ce)||f!=="always"&&this.grid.hitTest(ge,be,le,Ce,f,L)?{box:[ge,be,le,Ce],placeable:!1,offscreen:!1}:{box:[ge,be,le,Ce],placeable:!0,offscreen:this.isOffscreen(ge,be,le,Ce)}}placeCollisionCircles(r,f,_,y,x,M,D,O,L,$,H,G,ee,ne,he,pe){const ge=[],be=new h.P(f.anchorX,f.anchorY),le=this.getPerspectiveRatio(M,be.x,be.y,D,pe),Ce=(H?x/le:x*le)/h.ap,Ie={getElevation:pe,labelPlaneMatrix:O,lineVertexArray:_,pitchWithMap:H,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:this.mapProjection,tileAnchorPoint:be,unwrappedTileID:D,width:this.transform.width,height:this.transform.height,translation:he},ze=ue(Ce,y,f.lineOffsetX*Ce,f.lineOffsetY*Ce,!1,f,!1,Ie);let Ge=!1,dt=!1,vt=!0;if(ze){const Mt=.5*ee*le+ne,xt=new h.P(-100,-100),ft=new h.P(this.screenRightBoundary,this.screenBottomBoundary),Ot=new ui,ni=ze.first,wt=ze.last;let Ct=[];for(let mi=ni.path.length-1;mi>=1;mi--)Ct.push(ni.path[mi]);for(let mi=1;mi<wt.path.length;mi++)Ct.push(wt.path[mi]);const Qt=2.5*Mt;if(L){const mi=this.projectPathToScreenSpace(Ct,Ie,L);Ct=mi.some((Si=>Si.signedDistanceFromCamera<=0))?[]:mi.map((Si=>Si.point))}let Ki=[];if(Ct.length>0){const mi=Ct[0].clone(),Si=Ct[0].clone();for(let Zi=1;Zi<Ct.length;Zi++)mi.x=Math.min(mi.x,Ct[Zi].x),mi.y=Math.min(mi.y,Ct[Zi].y),Si.x=Math.max(Si.x,Ct[Zi].x),Si.y=Math.max(Si.y,Ct[Zi].y);Ki=mi.x>=xt.x&&Si.x<=ft.x&&mi.y>=xt.y&&Si.y<=ft.y?[Ct]:Si.x<xt.x||mi.x>ft.x||Si.y<xt.y||mi.y>ft.y?[]:h.al([Ct],xt.x,xt.y,ft.x,ft.y)}for(const mi of Ki){Ot.reset(mi,.25*Mt);let Si=0;Si=Ot.length<=.5*Mt?1:Math.ceil(Ot.paddedLength/Qt)+1;for(let Zi=0;Zi<Si;Zi++){const fr=Zi/Math.max(Si-1,1),Ds=Ot.lerp(fr),an=Ds.x+Vt,Lr=Ds.y+Vt;ge.push(an,Lr,Mt,0);const pn=an-Mt,mn=Lr-Mt,Xn=an+Mt,Os=Lr+Mt;if(vt=vt&&this.isOffscreen(pn,mn,Xn,Os),dt=dt||this.isInsideGrid(pn,mn,Xn,Os),r!=="always"&&this.grid.hitTestCircle(an,Lr,Mt,r,G)&&(Ge=!0,!$))return{circles:[],offscreen:!1,collisionDetected:Ge}}}}return{circles:!$&&Ge||!dt||le<this.perspectiveRatioCutoff?[]:ge,offscreen:vt,collisionDetected:Ge}}projectPathToScreenSpace(r,f,_){return r.map((y=>de(y.x,y.y,_,f.getElevation)))}queryRenderedSymbols(r){if(r.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const f=[];let _=1/0,y=1/0,x=-1/0,M=-1/0;for(const $ of r){const H=new h.P($.x+Vt,$.y+Vt);_=Math.min(_,H.x),y=Math.min(y,H.y),x=Math.max(x,H.x),M=Math.max(M,H.y),f.push(H)}const D=this.grid.query(_,y,x,M).concat(this.ignoredGrid.query(_,y,x,M)),O={},L={};for(const $ of D){const H=$.key;if(O[H.bucketInstanceId]===void 0&&(O[H.bucketInstanceId]={}),O[H.bucketInstanceId][H.featureIndex])continue;const G=[new h.P($.x1,$.y1),new h.P($.x2,$.y1),new h.P($.x2,$.y2),new h.P($.x1,$.y2)];h.am(f,G)&&(O[H.bucketInstanceId][H.featureIndex]=!0,L[H.bucketInstanceId]===void 0&&(L[H.bucketInstanceId]=[]),L[H.bucketInstanceId].push(H.featureIndex))}return L}insertCollisionBox(r,f,_,y,x,M){(_?this.ignoredGrid:this.grid).insert({bucketInstanceId:y,featureIndex:x,collisionGroupID:M,overlapMode:f},r[0],r[1],r[2],r[3])}insertCollisionCircles(r,f,_,y,x,M){const D=_?this.ignoredGrid:this.grid,O={bucketInstanceId:y,featureIndex:x,collisionGroupID:M,overlapMode:f};for(let L=0;L<r.length;L+=4)D.insertCircle(O,r[L],r[L+1],r[L+2])}projectAndGetPerspectiveRatio(r,f,_,y,x){let M;x?(M=[f,_,x(f,_),1],h.af(M,M,r)):(M=[f,_,0,1],yi(M,M,r));const D=M[3];return{point:new h.P((M[0]/D+1)/2*this.transform.width+Vt,(-M[1]/D+1)/2*this.transform.height+Vt),perspectiveRatio:.5+this.transform.cameraToCenterDistance/D*.5,isOccluded:!1,signedDistanceFromCamera:D}}getPerspectiveRatio(r,f,_,y,x){const M=this.mapProjection.useSpecialProjectionForSymbols?this.mapProjection.projectTileCoordinates(f,_,y,x):de(f,_,r,x);return .5+this.transform.cameraToCenterDistance/M.signedDistanceFromCamera*.5}isOffscreen(r,f,_,y){return _<Vt||r>=this.screenRightBoundary||y<Vt||f>this.screenBottomBoundary}isInsideGrid(r,f,_,y){return _>=0&&r<this.gridRightBoundary&&y>=0&&f<this.gridBottomBoundary}getViewportMatrix(){const r=h.an([]);return h.J(r,r,[-100,-100,0]),r}_projectCollisionBox(r,f,_,y,x,M,D,O,L,$){let H=new h.P(1,0),G=new h.P(0,1);const ee=new h.P(r.anchorPointX+D[0],r.anchorPointY+D[1]);if(M&&!x){const vt=this.projectAndGetPerspectiveRatio(_,ee.x+1,ee.y,y,L).point.sub(O.point).unit(),Mt=Math.atan(vt.y/vt.x)+(vt.x<0?Math.PI:0),xt=Math.sin(Mt),ft=Math.cos(Mt);H=new h.P(ft,xt),G=new h.P(-xt,ft)}else if(!M&&x){const vt=-this.transform.angle,Mt=Math.sin(vt),xt=Math.cos(vt);H=new h.P(xt,Mt),G=new h.P(-Mt,xt)}let ne=O.point,he=f;if(x){ne=ee;const vt=this.transform.zoom-Math.floor(this.transform.zoom);he=Math.pow(2,-vt),he*=this.mapProjection.getPitchedTextCorrection(this.transform,ee,y),$||(he*=h.ac(.5+O.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))}$&&(ne=ne.add(H.mult($.x*he)).add(G.mult($.y*he)));const pe=r.x1*he,ge=r.x2*he,be=(pe+ge)/2,le=r.y1*he,Ce=r.y2*he,Ie=(le+Ce)/2,ze=[{offsetX:pe,offsetY:le},{offsetX:be,offsetY:le},{offsetX:ge,offsetY:le},{offsetX:ge,offsetY:Ie},{offsetX:ge,offsetY:Ce},{offsetX:be,offsetY:Ce},{offsetX:pe,offsetY:Ce},{offsetX:pe,offsetY:Ie}];let Ge=[];for(const{offsetX:vt,offsetY:Mt}of ze)Ge.push(new h.P(ne.x+H.x*vt+G.x*Mt,ne.y+H.y*vt+G.y*Mt));let dt=!1;if(x){const vt=Ge.map((Mt=>this.projectAndGetPerspectiveRatio(_,Mt.x,Mt.y,y,L)));dt=vt.some((Mt=>!Mt.isOccluded)),Ge=vt.map((Mt=>Mt.point))}else dt=!0;return{box:h.ao(Ge),allPointsOccluded:!dt}}}function gi(w,r,f){return r*(h.X/(w.tileSize*Math.pow(2,f-w.tileID.overscaledZ)))}class $n{constructor(r,f,_,y){this.opacity=r?Math.max(0,Math.min(1,r.opacity+(r.placed?f:-f))):y&&_?1:0,this.placed=_}isHidden(){return this.opacity===0&&!this.placed}}class kn{constructor(r,f,_,y,x){this.text=new $n(r?r.text:null,f,_,x),this.icon=new $n(r?r.icon:null,f,y,x)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class vi{constructor(r,f,_){this.text=r,this.icon=f,this.skipFade=_}}class qi{constructor(){this.invProjMatrix=h.H(),this.viewportMatrix=h.H(),this.circles=[]}}class Ji{constructor(r,f,_,y,x){this.bucketInstanceId=r,this.featureIndex=f,this.sourceLayerIndex=_,this.bucketIndex=y,this.tileID=x}}class tr{constructor(r){this.crossSourceCollisions=r,this.maxGroupID=0,this.collisionGroups={}}get(r){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[r]){const f=++this.maxGroupID;this.collisionGroups[r]={ID:f,predicate:_=>_.collisionGroupID===f}}return this.collisionGroups[r]}}function Hn(w,r,f,_,y){const{horizontalAlign:x,verticalAlign:M}=h.au(w);return new h.P(-(x-.5)*r+_[0]*y,-(M-.5)*f+_[1]*y)}class ir{constructor(r,f,_,y,x,M){this.transform=r.clone(),this.terrain=_,this.collisionIndex=new hi(this.transform,f),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=y,this.retainedQueryData={},this.collisionGroups=new tr(x),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=M,M&&(M.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(r){const f=this.terrain;return f?(_,y)=>f.getElevation(r,_,y):null}getBucketParts(r,f,_,y){const x=_.getBucket(f),M=_.latestFeatureIndex;if(!x||!M||f.id!==x.layerIds[0])return;const D=_.collisionBoxArray,O=x.layers[0].layout,L=x.layers[0].paint,$=Math.pow(2,this.transform.zoom-_.tileID.overscaledZ),H=_.tileSize/h.X,G=_.tileID.toUnwrapped(),ee=this.transform.calculatePosMatrix(G),ne=O.get("text-pitch-alignment")==="map",he=O.get("text-rotation-alignment")==="map",pe=gi(_,1,this.transform.zoom),ge=this.collisionIndex.mapProjection.translatePosition(this.transform,_,L.get("text-translate"),L.get("text-translate-anchor")),be=this.collisionIndex.mapProjection.translatePosition(this.transform,_,L.get("icon-translate"),L.get("icon-translate-anchor")),le=Xs(ee,ne,he,this.transform,pe);let Ce=null;if(ne){const ze=ps(ee,ne,he,this.transform,pe);Ce=h.L([],this.transform.labelPlaneMatrix,ze)}this.retainedQueryData[x.bucketInstanceId]=new Ji(x.bucketInstanceId,M,x.sourceLayerIndex,x.index,_.tileID);const Ie={bucket:x,layout:O,translationText:ge,translationIcon:be,posMatrix:ee,unwrappedTileID:G,textLabelPlaneMatrix:le,labelToScreenMatrix:Ce,scale:$,textPixelRatio:H,holdingForFade:_.holdingForFade(),collisionBoxArray:D,partiallyEvaluatedTextSize:h.ag(x.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(x.sourceID)};if(y)for(const ze of x.sortKeyRanges){const{sortKey:Ge,symbolInstanceStart:dt,symbolInstanceEnd:vt}=ze;r.push({sortKey:Ge,symbolInstanceStart:dt,symbolInstanceEnd:vt,parameters:Ie})}else r.push({symbolInstanceStart:0,symbolInstanceEnd:x.symbolInstances.length,parameters:Ie})}attemptAnchorPlacement(r,f,_,y,x,M,D,O,L,$,H,G,ee,ne,he,pe,ge,be,le){const Ce=h.aq[r.textAnchor],Ie=[r.textOffset0,r.textOffset1],ze=Hn(Ce,_,y,Ie,x),Ge=this.collisionIndex.placeCollisionBox(f,G,O,L,$,D,M,pe,H.predicate,le,ze);if((!be||this.collisionIndex.placeCollisionBox(be,G,O,L,$,D,M,ge,H.predicate,le,ze).placeable)&&Ge.placeable){let dt;if(this.prevPlacement&&this.prevPlacement.variableOffsets[ee.crossTileID]&&this.prevPlacement.placements[ee.crossTileID]&&this.prevPlacement.placements[ee.crossTileID].text&&(dt=this.prevPlacement.variableOffsets[ee.crossTileID].anchor),ee.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[ee.crossTileID]={textOffset:Ie,width:_,height:y,anchor:Ce,textBoxScale:x,prevAnchor:dt},this.markUsedJustification(ne,Ce,ee,he),ne.allowVerticalPlacement&&(this.markUsedOrientation(ne,he,ee),this.placedOrientations[ee.crossTileID]=he),{shift:ze,placedGlyphBoxes:Ge}}}placeLayerBucketPart(r,f,_){const{bucket:y,layout:x,translationText:M,translationIcon:D,posMatrix:O,unwrappedTileID:L,textLabelPlaneMatr
vendor: 2,479 bytes, line 53
53ix:$,labelToScreenMatrix:H,textPixelRatio:G,holdingForFade:ee,collisionBoxArray:ne,partiallyEvaluatedTextSize:he,collisionGroup:pe}=r.parameters,ge=x.get("text-optional"),be=x.get("icon-optional"),le=h.ar(x,"text-overlap","text-allow-overlap"),Ce=le==="always",Ie=h.ar(x,"icon-overlap","icon-allow-overlap"),ze=Ie==="always",Ge=x.get("text-rotation-alignment")==="map",dt=x.get("text-pitch-alignment")==="map",vt=x.get("icon-text-fit")!=="none",Mt=x.get("symbol-z-order")==="viewport-y",xt=Ce&&(ze||!y.hasIconData()||be),ft=ze&&(Ce||!y.hasTextData()||ge);!y.collisionArrays&&ne&&y.deserializeCollisionBoxes(ne);const Ot=this._getTerrainElevationFunc(this.retainedQueryData[y.bucketInstanceId].tileID),ni=(wt,Ct,Qt)=>{var Ki,mi;if(f[wt.crossTileID])return;if(ee)return void(this.placements[wt.crossTileID]=new vi(!1,!1,!1));let Si=!1,Zi=!1,fr=!0,Ds=null,an={box:null,placeable:!1,offscreen:null},Lr={placeable:!1},pn=null,mn=null,Xn=null,Os=0,$o=0,Qs=0;Ct.textFeatureIndex?Os=Ct.textFeatureIndex:wt.useRuntimeCollisionCircles&&(Os=wt.featureIndex),Ct.verticalTextFeatureIndex&&($o=Ct.verticalTextFeatureIndex);const gr=Ct.textBox;if(gr){const oi=qn=>{let Zn=h.ah.horizontal;if(y.allowVerticalPlacement&&!qn&&this.prevPlacement){const Fr=this.prevPlacement.placedOrientations[wt.crossTileID];Fr&&(this.placedOrientations[wt.crossTileID]=Fr,Zn=Fr,this.markUsedOrientation(y,Zn,wt))}return Zn},Mi=(qn,Zn)=>{if(y.allowVerticalPlacement&&wt.numVerticalGlyphVertices>0&&Ct.verticalTextBox){for(const Fr of y.writingModes)if(Fr===h.ah.vertical?(an=Zn(),Lr=an):an=qn(),an&&an.placeable)break}else an=qn()},gn=wt.textAnchorOffsetStartIndex,os=wt.textAnchorOffsetEndIndex;if(os===gn){const qn=(Zn,Fr)=>{const wi=this.collisionIndex.placeCollisionBox(Zn,le,G,O,L,dt,Ge,M,pe.predicate,Ot);return wi&&wi.placeable&&(this.markUsedOrientation(y,Fr,wt),this.placedOrientations[wt.crossTileID]=Fr),wi};Mi((()=>qn(gr,h.ah.horizontal)),(()=>{const Zn=Ct.verticalTextBox;return y.allowVerticalPlacement&&wt.numVerticalGlyphVertices>0&&Zn?qn(Zn,h.ah.vertical):{box:null,offscreen:null}})),oi(an&&an.placeable)}else{let qn=h.aq[(mi=(Ki=this.prevPlacement)===null||Ki===void 0?void 0:Ki.variableOffsets[wt.crossTileID])===null||mi===void 0?void 0:mi.anchor];const Zn=(wi,ks,Ml)=>{const _n=wi.x2-wi.x1,Su=wi.y2-wi.y1,Bh=wt.textBoxScale,Nh=vt&&Ie==="never"?ks:null;let La=null,af=le==="never"?1:2,Pl="never";qn&&af++;for(let Wo=0;Wo<af;Wo++){for(let Il=gn;Il<os;Il++){const _r=y.textAnchorOffsets.get(Il);
vendor: 13,538 bytes, line 53
53if(qn&&_r.textAnchor!==qn)continue;const Tn=this.attemptAnchorPlacement(_r,wi,_n,Su,Bh,Ge,dt,G,O,L,pe,Pl,wt,y,Ml,M,D,Nh,Ot);if(Tn&&(La=Tn.placedGlyphBoxes,La&&La.placeable))return Si=!0,Ds=Tn.shift,La}qn?qn=null:Pl=le}return _&&!La&&(La={box:this.collisionIndex.placeCollisionBox(gr,"always",G,O,L,dt,Ge,M,pe.predicate,Ot,new h.P(0,0)).box,offscreen:!1,placeable:!1}),La};Mi((()=>Zn(gr,Ct.iconBox,h.ah.horizontal)),(()=>{const wi=Ct.verticalTextBox;return y.allowVerticalPlacement&&(!an||!an.placeable)&&wt.numVerticalGlyphVertices>0&&wi?Zn(wi,Ct.verticalIconBox,h.ah.vertical):{box:null,occluded:!0,offscreen:null}})),an&&(Si=an.placeable,fr=an.offscreen);const Fr=oi(an&&an.placeable);if(!Si&&this.prevPlacement){const wi=this.prevPlacement.variableOffsets[wt.crossTileID];wi&&(this.variableOffsets[wt.crossTileID]=wi,this.markUsedJustification(y,wi.anchor,wt,Fr))}}}if(pn=an,Si=pn&&pn.placeable,fr=pn&&pn.offscreen,wt.useRuntimeCollisionCircles){const oi=y.text.placedSymbolArray.get(wt.centerJustifiedTextSymbolIndex),Mi=h.ai(y.textSizeData,he,oi),gn=x.get("text-padding");mn=this.collisionIndex.placeCollisionCircles(le,oi,y.lineVertexArray,y.glyphOffsetArray,Mi,O,L,$,H,_,dt,pe.predicate,wt.collisionCircleDiameter,gn,M,Ot),mn.circles.length&&mn.collisionDetected&&!_&&h.w("Collisions detected, but collision boxes are not shown"),Si=Ce||mn.circles.length>0&&!mn.collisionDetected,fr=fr&&mn.offscreen}if(Ct.iconFeatureIndex&&(Qs=Ct.iconFeatureIndex),Ct.iconBox){const oi=Mi=>this.collisionIndex.placeCollisionBox(Mi,Ie,G,O,L,dt,Ge,D,pe.predicate,Ot,vt&&Ds?Ds:void 0);Lr&&Lr.placeable&&Ct.verticalIconBox?(Xn=oi(Ct.verticalIconBox),Zi=Xn.placeable):(Xn=oi(Ct.iconBox),Zi=Xn.placeable),fr=fr&&Xn.offscreen}const Wi=ge||wt.numHorizontalGlyphVertices===0&&wt.numVerticalGlyphVertices===0,Ho=be||wt.numIconVertices===0;Wi||Ho?Ho?Wi||(Zi=Zi&&Si):Si=Zi&&Si:Zi=Si=Zi&&Si;const Js=Zi&&Xn.placeable;if(Si&&pn.placeable&&this.collisionIndex.insertCollisionBox(pn.box,le,x.get("text-ignore-placement"),y.bucketInstanceId,Lr&&Lr.placeable&&$o?$o:Os,pe.ID),Js&&this.collisionIndex.insertCollisionBox(Xn.box,Ie,x.get("icon-ignore-placement"),y.bucketInstanceId,Qs,pe.ID),mn&&Si&&this.collisionIndex.insertCollisionCircles(mn.circles,le,x.get("text-ignore-placement"),y.bucketInstanceId,Os,pe.ID),_&&this.storeCollisionData(y.bucketInstanceId,Qt,Ct,pn,Xn,mn),wt.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(y.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[wt.crossTileID]=new vi(Si||xt,Zi||ft,fr||y.justReloaded),f[wt.crossTileID]=!0};if(Mt){if(r.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const wt=y.getSortedSymbolIndexes(this.transform.angle);for(let Ct=wt.length-1;Ct>=0;--Ct){const Qt=wt[Ct];ni(y.symbolInstances.get(Qt),y.collisionArrays[Qt],Qt)}}else for(let wt=r.symbolInstanceStart;wt<r.symbolInstanceEnd;wt++)ni(y.symbolInstances.get(wt),y.collisionArrays[wt],wt);if(_&&y.bucketInstanceId in this.collisionCircleArrays){const wt=this.collisionCircleArrays[y.bucketInstanceId];h.as(wt.invProjMatrix,O),wt.viewportMatrix=this.collisionIndex.getViewportMatrix()}y.justReloaded=!1}storeCollisionData(r,f,_,y,x,M){if(_.textBox||_.iconBox){let D,O;this.collisionBoxArrays.has(r)?D=this.collisionBoxArrays.get(r):(D=new Map,this.collisionBoxArrays.set(r,D)),D.has(f)?O=D.get(f):(O={text:null,icon:null},D.set(f,O)),_.textBox&&(O.text=y.box),_.iconBox&&(O.icon=x.box)}if(M){let D=this.collisionCircleArrays[r];D===void 0&&(D=this.collisionCircleArrays[r]=new qi);for(let O=0;O<M.circles.length;O+=4)D.circles.push(M.circles[O+0]),D.circles.push(M.circles[O+1]),D.circles.push(M.circles[O+2]),D.circles.push(M.collisionDetected?1:0)}}markUsedJustification(r,f,_,y){let x;x=y===h.ah.vertical?_.verticalPlacedTextSymbolIndex:{left:_.leftJustifiedTextSymbolIndex,center:_.centerJustifiedTextSymbolIndex,right:_.rightJustifiedTextSymbolIndex}[h.at(f)];const M=[_.leftJustifiedTextSymbolIndex,_.centerJustifiedTextSymbolIndex,_.rightJustifiedTextSymbolIndex,_.verticalPlacedTextSymbolIndex];for(const D of M)D>=0&&(r.text.placedSymbolArray.get(D).crossTileID=x>=0&&D!==x?0:_.crossTileID)}markUsedOrientation(r,f,_){const y=f===h.ah.horizontal||f===h.ah.horizontalOnly?f:0,x=f===h.ah.vertical?f:0,M=[_.leftJustifiedTextSymbolIndex,_.centerJustifiedTextSymbolIndex,_.rightJustifiedTextSymbolIndex];for(const D of M)r.text.placedSymbolArray.get(D).placedOrientation=y;_.verticalPlacedTextSymbolIndex&&(r.text.placedSymbolArray.get(_.verticalPlacedTextSymbolIndex).placedOrientation=x)}commit(r){this.commitTime=r,this.zoomAtLastRecencyCheck=this.transform.zoom;const f=this.prevPlacement;let _=!1;this.prevZoomAdjustment=f?f.zoomAdjustment(this.transform.zoom):0;const y=f?f.symbolFadeChange(r):1,x=f?f.opacities:{},M=f?f.variableOffsets:{},D=f?f.placedOrientations:{};for(const O in this.placements){const L=this.placements[O],$=x[O];$?(this.opacities[O]=new kn($,y,L.text,L.icon),_=_||L.text!==$.text.placed||L.icon!==$.icon.placed):(this.opacities[O]=new kn(null,y,L.text,L.icon,L.skipFade),_=_||L.text||L.icon)}for(const O in x){const L=x[O];if(!this.opacities[O]){const $=new kn(L,y,!1,!1);$.isHidden()||(this.opacities[O]=$,_=_||L.text.placed||L.icon.placed)}}for(const O in M)this.variableOffsets[O]||!this.opacities[O]||this.opacities[O].isHidden()||(this.variableOffsets[O]=M[O]);for(const O in D)this.placedOrientations[O]||!this.opacities[O]||this.opacities[O].isHidden()||(this.placedOrientations[O]=D[O]);if(f&&f.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");_?this.lastPlacementChangeTime=r:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=f?f.lastPlacementChangeTime:r)}updateLayerOpacities(r,f){const _={};for(const y of f){const x=y.getBucket(r);x&&y.latestFeatureIndex&&r.id===x.layerIds[0]&&this.updateBucketOpacities(x,y.tileID,_,y.collisionBoxArray)}}updateBucketOpacities(r,f,_,y){r.hasTextData()&&(r.text.opacityVertexArray.clear(),r.text.hasVisibleVertices=!1),r.hasIconData()&&(r.icon.opacityVertexArray.clear(),r.icon.hasVisibleVertices=!1),r.hasIconCollisionBoxData()&&r.iconCollisionBox.collisionVertexArray.clear(),r.hasTextCollisionBoxData()&&r.textCollisionBox.collisionVertexArray.clear();const x=r.layers[0],M=x.layout,D=new kn(null,0,!1,!1,!0),O=M.get("text-allow-overlap"),L=M.get("icon-allow-overlap"),$=x._unevaluatedLayout.hasValue("text-variable-anchor")||x._unevaluatedLayout.hasValue("text-variable-anchor-offset"),H=M.get("text-rotation-alignment")==="map",G=M.get("text-pitch-alignment")==="map",ee=M.get("icon-text-fit")!=="none",ne=new kn(null,0,O&&(L||!r.hasIconData()||M.get("icon-optional")),L&&(O||!r.hasTextData()||M.get("text-optional")),!0);!r.collisionArrays&&y&&(r.hasIconCollisionBoxData()||r.hasTextCollisionBoxData())&&r.deserializeCollisionBoxes(y);const he=(ge,be,le)=>{for(let Ce=0;Ce<be/4;Ce++)ge.opacityVertexArray.emplaceBack(le);ge.hasVisibleVertices=ge.hasVisibleVertices||le!==bo},pe=this.collisionBoxArrays.get(r.bucketInstanceId);for(let ge=0;ge<r.symbolInstances.length;ge++){const be=r.symbolInstances.get(ge),{numHorizontalGlyphVertices:le,numVerticalGlyphVertices:Ce,crossTileID:Ie}=be;let ze=this.opacities[Ie];_[Ie]?ze=D:ze||(ze=ne,this.opacities[Ie]=ze),_[Ie]=!0;const Ge=be.numIconVertices>0,dt=this.placedOrientations[be.crossTileID],vt=dt===h.ah.vertical,Mt=dt===h.ah.horizontal||dt===h.ah.horizontalOnly;if(le>0||Ce>0){const ft=is(ze.text);he(r.text,le,vt?bo:ft),he(r.text,Ce,Mt?bo:ft);const Ot=ze.text.isHidden();[be.rightJustifiedTextSymbolIndex,be.centerJustifiedTextSymbolIndex,be.leftJustifiedTextSymbolIndex].forEach((Ct=>{Ct>=0&&(r.text.placedSymbolArray.get(Ct).hidden=Ot||vt?1:0)})),be.verticalPlacedTextSymbolIndex>=0&&(r.text.placedSymbolArray.get(be.verticalPlacedTextSymbolIndex).hidden=Ot||Mt?1:0);const ni=this.variableOffsets[be.crossTileID];ni&&this.markUsedJustification(r,ni.anchor,be,dt);const wt=this.placedOrientations[be.crossTileID];wt&&(this.markUsedJustification(r,"left",be,wt),this.markUsedOrientation(r,wt,be))}if(Ge){const ft=is(ze.icon),Ot=!(ee&&be.verticalPlacedIconSymbolIndex&&vt);be.placedIconSymbolIndex>=0&&(he(r.icon,be.numIconVertices,Ot?ft:bo),r.icon.placedSymbolArray.get(be.placedIconSymbolIndex).hidden=ze.icon.isHidden()),be.verticalPlacedIconSymbolIndex>=0&&(he(r.icon,be.numVerticalIconVertices,Ot?bo:ft),r.icon.placedSymbolArray.get(be.verticalPlacedIconSymbolIndex).hidden=ze.icon.isHidden())}const xt=pe&&pe.has(ge)?pe.get(ge):{text:null,icon:null};if(r.hasIconCollisionBoxData()||r.hasTextCollisionBoxData()){const ft=r.collisionArrays[ge];if(ft){let Ot=new h.P(0,0);if(ft.textBox||ft.verticalTextBox){let ni=!0;if($){const wt=this.variableOffsets[Ie];wt?(Ot=Hn(wt.anchor,wt.width,wt.height,wt.textOffset,wt.textBoxScale),H&&Ot._rotate(G?this.transform.angle:-this.transform.angle)):ni=!1}if(ft.textBox||ft.verticalTextBox){let wt;ft.textBox&&(wt=vt),ft.verticalTextBox&&(wt=Mt),ua(r.textCollisionBox.collisionVertexArray,ze.text.placed,!ni||wt,xt.text,Ot.x,Ot.y)}}if(ft.iconBox||ft.verticalIconBox){const ni=!!(!Mt&&ft.verticalIconBox);let wt;ft.iconBox&&(wt=ni),ft.verticalIconBox&&(wt=!ni),ua(r.iconCollisionBox.collisionVertexArray,ze.icon.placed,wt,xt.icon,ee?Ot.x:0,ee?Ot.y:0)}}}}if(r.sortFeatures(this.transform.angle),this.retainedQueryData[r.bucketInstanceId]&&(this.retainedQueryData[r.bucketInstanceId].featureSortOrder=r.featureSortOrder),r.hasTextData()&&r.text.opacityVertexBuffer&&r.text.opacityVertexBuffer.updateData(r.text.opacityVertexArray),r.hasIconData()&&r.icon.opacityVertexBuffer&&r.icon.opacityVertexBuffer.updateData(r.icon.opacityVertexArray),r.hasIconCollisionBoxData()&&r.iconCollisionBox.collisionVertexBuffer&&r.iconCollisionBox.collisionVertexBuffer.updateData(r.iconCollisionBox.collisionVertexArray),r.hasTextCollisionBoxData()&&r.textCollisionBox.collisionVertexBuffer&&r.textCollisionBox.collisionVertexBuffer.updateData(r.textCollisionBox.collisionVertexArray),r.text.opacityVertexArray.length!==r.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${r.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${r.text.layoutVertexArray.length}) / 4`);if(r.icon.opacityVertexArray.length!==r.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${r.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${r.icon.layoutVertexArray.length}) / 4`);if(r.bucketInstanceId in this.collisionCircleArrays){const ge=this.collisionCircleArrays[r.bucketInstanceId];r.placementInvProjMatrix=ge.invProjMatrix,r.placementViewportMatrix=ge.viewportMatrix,r.collisionCircleArray=ge.circles,delete this.collisionCircleArrays[r.bucketInstanceId]}}symbolFadeChange(r){return this.fadeDuration===0?1:(r-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(r){return Math.max(0,(this.transform.zoom-r)/1.5)}hasTransitions(r){return this.stale||r-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(r,f){const _=this.zoomAtLastRecencyCheck===f?1-this.zoomAdjustment(f):1;return this.zoomAtLastRecencyCheck=f,this.commitTime+this.fadeDuration*_>r}setStale(){this.stale=!0}}function ua(w,r,f,_,y,x){_&&_.length!==0||(_=[0,0,0,0]);const M=_[0]-Vt,D=_[1]-Vt,O=_[2]-Vt,L=_[3]-Vt;w.emplaceBack(r?1:0,f?1:0,y||0,x||0,M,D),w.emplaceBack(r?1:0,f?1:0,y||0,x||0,O,D),w.emplaceBack(r?1:0,f?1:0,y||0,x||0,O,L),w.emplaceBack(r?1:0,f?1:0,y||0,x||0,M,L)}const Fi=Math.pow(2,25),nr=Math.pow(2,24),Xc=Math.pow(2,17),ts=Math.pow(2,16),cr=Math.pow(2,9),cl=Math.pow(2,8),Es=Math.pow(2,1);function is(w){if(w.opacity===0&&!w.placed)return 0;if(w.opacity===1&&w.placed)return 4294967295;const r=w.placed?1:0,f=Math.floor(127*w.opacity);return f*Fi+r*nr+f*Xc+r*ts+f*cr+r*cl+f*Es+r}const bo=0;function xo(){return{isOccluded:(w,r,f)=>!1,getPitchedTextCorrection:(w,r,f)=>1,get useSpecialProjectionForSymbols(){return!1},projectTileCoordinates(w,r,f,_){throw new Error("Not implemented.")},translatePosition:(w,r,f,_)=>(function(y,x,M,D,O=!1){if(!M[0]&&!M[1])return[0,0];const L=O?D==="map"?y.angle:0:D==="viewport"?-y.angle:0;if(L){const $=Math.sin(L),H=Math.cos(L);M=[M[0]*H-M[1]*$,M[0]*$+M[1]*H]}return[O?M[0]:gi(x,M[0],y.zoom),O?M[1]:gi(x,M[1],y.zoom)]})(w,r,f,_),getCircleRadiusCorrection:w=>1}}class Bn{constructor(r){this._sortAcrossTiles=r.layout.get("symbol-z-order")!=="viewport-y"&&!r.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(r,f,_,y,x){const M=this._bucketParts;for(;this._currentTileIndex<r.length;)if(f.getBucketParts(M,y,r[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,x())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,M.sort(((D,O)=>D.sortKey-O.sortKey)));this._currentPartIndex<M.length;)if(f.placeLayerBucketPart(M[this._currentPartIndex],this._seenCrossTileIDs,_),this._currentPartIndex++,x())return!0;return!1}}class Ya{constructor(r,f,_,y,x,M,D,O){this.placement=new ir(r,xo(),f,M,D,O),this._currentPlacementIndex=_.length-1,this._forceFullPlacement=y,this._showCollisionBoxes=x,this._done=!1}isDone(){return this._done}continuePlacement(r,f,_){const y=N.now(),x=()=>!this._forceFullPlacement&&N.now()-y>2;for(;this._currentPlacementIndex>=0;){const M=f[r[this._currentPlacementIndex]],D=this.placement.collisionIndex.transform.zoom;if(M.type==="symbol"&&(!M.minzoom||M.minzoom<=D)&&(!M.maxzoom||M.maxzoom>
vendor: 22,948 bytes, line 53
53D)){if(this._inProgressLayer||(this._inProgressLayer=new Bn(M)),this._inProgressLayer.continuePlacement(_[M.source],this.placement,this._showCollisionBoxes,M,x))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(r){return this.placement.commit(r),this.placement}}const ur=512/h.X/2;class Hi{constructor(r,f,_){this.tileID=r,this.bucketInstanceId=_,this._symbolsByKey={};const y=new Map;for(let x=0;x<f.length;x++){const M=f.get(x),D=M.key,O=y.get(D);O?O.push(M):y.set(D,[M])}for(const[x,M]of y){const D={positions:M.map((O=>({x:Math.floor(O.anchorX*ur),y:Math.floor(O.anchorY*ur)}))),crossTileIDs:M.map((O=>O.crossTileID))};if(D.positions.length>128){const O=new h.av(D.positions.length,16,Uint16Array);for(const{x:L,y:$}of D.positions)O.add(L,$);O.finish(),delete D.positions,D.index=O}this._symbolsByKey[x]=D}}getScaledCoordinates(r,f){const{x:_,y,z:x}=this.tileID.canonical,{x:M,y:D,z:O}=f.canonical,L=ur/Math.pow(2,O-x),$=(D*h.X+r.anchorY)*L,H=y*h.X*ur;return{x:Math.floor((M*h.X+r.anchorX)*L-_*h.X*ur),y:Math.floor($-H)}}findMatches(r,f,_){const y=this.tileID.canonical.z<f.canonical.z?1:Math.pow(2,this.tileID.canonical.z-f.canonical.z);for(let x=0;x<r.length;x++){const M=r.get(x);if(M.crossTileID)continue;const D=this._symbolsByKey[M.key];if(!D)continue;const O=this.getScaledCoordinates(M,f);if(D.index){const L=D.index.range(O.x-y,O.y-y,O.x+y,O.y+y).sort();for(const $ of L){const H=D.crossTileIDs[$];if(!_[H]){_[H]=!0,M.crossTileID=H;break}}}else if(D.positions)for(let L=0;L<D.positions.length;L++){const $=D.positions[L],H=D.crossTileIDs[L];if(Math.abs($.x-O.x)<=y&&Math.abs($.y-O.y)<=y&&!_[H]){_[H]=!0,M.crossTileID=H;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map((({crossTileIDs:r})=>r))}}class rc{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class qs{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(r){const f=Math.round((r-this.lng)/360);if(f!==0)for(const _ in this.indexes){const y=this.indexes[_],x={};for(const M in y){const D=y[M];D.tileID=D.tileID.unwrapTo(D.tileID.wrap+f),x[D.tileID.key]=D}this.indexes[_]=x}this.lng=r}addBucket(r,f,_){if(this.indexes[r.overscaledZ]&&this.indexes[r.overscaledZ][r.key]){if(this.indexes[r.overscaledZ][r.key].bucketInstanceId===f.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(r.overscaledZ,this.indexes[r.overscaledZ][r.key])}for(let x=0;x<f.symbolInstances.length;x++)f.symbolInstances.get(x).crossTileID=0;this.usedCrossTileIDs[r.overscaledZ]||(this.usedCrossTileIDs[r.overscaledZ]={});const y=this.usedCrossTileIDs[r.overscaledZ];for(const x in this.indexes){const M=this.indexes[x];if(Number(x)>r.overscaledZ)for(const D in M){const O=M[D];O.tileID.isChildOf(r)&&O.findMatches(f.symbolInstances,r,y)}else{const D=M[r.scaledTo(Number(x)).key];D&&D.findMatches(f.symbolInstances,r,y)}}for(let x=0;x<f.symbolInstances.length;x++){const M=f.symbolInstances.get(x);M.crossTileID||(M.crossTileID=_.generate(),y[M.crossTileID]=!0)}return this.indexes[r.overscaledZ]===void 0&&(this.indexes[r.overscaledZ]={}),this.indexes[r.overscaledZ][r.key]=new Hi(r,f.symbolInstances,f.bucketInstanceId),!0}removeBucketCrossTileIDs(r,f){for(const _ of f.getCrossTileIDsLists())for(const y of _)delete this.usedCrossTileIDs[r][y]}removeStaleBuckets(r){let f=!1;for(const _ in this.indexes){const y=this.indexes[_];for(const x in y)r[y[x].bucketInstanceId]||(this.removeBucketCrossTileIDs(_,y[x]),delete y[x],f=!0)}return f}}class sc{constructor(){this.layerIndexes={},this.crossTileIDs=new rc,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(r,f,_){let y=this.layerIndexes[r.id];y===void 0&&(y=this.layerIndexes[r.id]=new qs);let x=!1;const M={};y.handleWrapJump(_);for(const D of f){const O=D.getBucket(r);O&&r.id===O.layerIds[0]&&(O.bucketInstanceId||(O.bucketInstanceId=++this.maxBucketInstanceId),y.addBucket(D.tileID,O,this.crossTileIDs)&&(x=!0),M[O.bucketInstanceId]=!0)}return y.removeStaleBuckets(M)&&(x=!0),x}pruneUnusedLayers(r){const f={};r.forEach((_=>{f[_]=!0}));for(const _ in this.layerIndexes)f[_]||delete this.layerIndexes[_]}}const Cs=(w,r)=>h.t(w,r&&r.filter((f=>f.identifier!=="source.canvas"))),qc=h.aw();class Zc extends h.E{constructor(r,f={}){super(),this._rtlPluginLoaded=()=>{for(const _ in this.sourceCaches){const y=this.sourceCaches[_].getSource().type;y!=="vector"&&y!=="geojson"||this.sourceCaches[_].reload()}},this.map=r,this.dispatcher=new Er(ki(),r._getMapId()),this.dispatcher.registerMessageHandler("GG",((_,y)=>this.getGlyphs(_,y))),this.dispatcher.registerMessageHandler("GI",((_,y)=>this.getImages(_,y))),this.imageManager=new At,this.imageManager.setEventedParent(this),this.glyphManager=new nt(r._requestManager,f.localIdeographFontFamily),this.lineAtlas=new ut(256,512),this.crossTileSymbolIndex=new sc,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new h.ax,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",h.ay()),la().on(pt,this._rtlPluginLoaded),this.on("data",(_=>{if(_.dataType!=="source"||_.sourceDataType!=="metadata")return;const y=this.sourceCaches[_.sourceId];if(!y)return;const x=y.getSource();if(x&&x.vectorLayerIds)for(const M in this._layers){const D=this._layers[M];D.source===x.id&&this._validateLayer(D)}}))}loadURL(r,f={},_){this.fire(new h.k("dataloading",{dataType:"style"})),f.validate=typeof f.validate!="boolean"||f.validate;const y=this.map._requestManager.transformRequest(r,"Style");this._loadStyleRequest=new AbortController;const x=this._loadStyleRequest;h.h(y,this._loadStyleRequest).then((M=>{this._loadStyleRequest=null,this._load(M.data,f,_)})).catch((M=>{this._loadStyleRequest=null,M&&!x.signal.aborted&&this.fire(new h.j(M))}))}loadJSON(r,f={},_){this.fire(new h.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,N.frameAsync(this._frameRequest).then((()=>{this._frameRequest=null,f.validate=f.validate!==!1,this._load(r,f,_)})).catch((()=>{}))}loadEmpty(){this.fire(new h.k("dataloading",{dataType:"style"})),this._load(qc,{validate:!1})}_load(r,f,_){var y;const x=f.transformStyle?f.transformStyle(_,r):r;if(!f.validate||!Cs(this,h.u(x))){this._loaded=!0,this.stylesheet=x;for(const M in x.sources)this.addSource(M,x.sources[M],{validate:!1});x.sprite?this._loadSprite(x.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(x.glyphs),this._createLayers(),this.light=new ai(this.stylesheet.light),this.sky=new Ue(this.stylesheet.sky),this.map.setTerrain((y=this.stylesheet.terrain)!==null&&y!==void 0?y:null),this.fire(new h.k("data",{dataType:"style"})),this.fire(new h.k("style.load"))}}_createLayers(){const r=h.az(this.stylesheet.layers);this.dispatcher.broadcast("SL",r),this._order=r.map((f=>f.id)),this._layers={},this._serializedLayers=null;for(const f of r){const _=h.aA(f);_.setEventedParent(this,{layer:{id:f.id}}),this._layers[f.id]=_}}_loadSprite(r,f=!1,_=void 0){let y;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,(function(x,M,D,O){return h._(this,void 0,void 0,(function*(){const L=rt(x),$=D>1?"@2x":"",H={},G={};for(const{id:ee,url:ne}of L){const he=M.transformRequest(Ke(ne,$,".json"),"SpriteJSON");H[ee]=h.h(he,O);const pe=M.transformRequest(Ke(ne,$,".png"),"SpriteImage");G[ee]=ve.getImage(pe,O)}return yield Promise.all([...Object.values(H),...Object.values(G)]),(function(ee,ne){return h._(this,void 0,void 0,(function*(){const he={};for(const pe in ee){he[pe]={};const ge=N.getImageCanvasContext((yield ne[pe]).data),be=(yield ee[pe]).data;for(const le in be){const{width:Ce,height:Ie,x:ze,y:Ge,sdf:dt,pixelRatio:vt,stretchX:Mt,stretchY:xt,content:ft,textFitWidth:Ot,textFitHeight:ni}=be[le];he[pe][le]={data:null,pixelRatio:vt,sdf:dt,stretchX:Mt,stretchY:xt,content:ft,textFitWidth:Ot,textFitHeight:ni,spriteData:{width:Ce,height:Ie,x:ze,y:Ge,context:ge}}}}return he}))})(H,G)}))})(r,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then((x=>{if(this._spriteRequest=null,x)for(const M in x){this._spritesImagesIds[M]=[];const D=this._spritesImagesIds[M]?this._spritesImagesIds[M].filter((O=>!(O in x))):[];for(const O of D)this.imageManager.removeImage(O),this._changedImages[O]=!0;for(const O in x[M]){const L=M==="default"?O:`${M}:${O}`;this._spritesImagesIds[M].push(L),L in this.imageManager.images?this.imageManager.updateImage(L,x[M][O],!1):this.imageManager.addImage(L,x[M][O]),f&&(this._changedImages[L]=!0)}}})).catch((x=>{this._spriteRequest=null,y=x,this.fire(new h.j(y))})).finally((()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),f&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new h.k("data",{dataType:"style"})),_&&_(y)}))}_unloadSprite(){for(const r of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(r),this._changedImages[r]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new h.k("data",{dataType:"style"}))}_validateLayer(r){const f=this.sourceCaches[r.source];if(!f)return;const _=r.sourceLayer;if(!_)return;const y=f.getSource();(y.type==="geojson"||y.vectorLayerIds&&y.vectorLayerIds.indexOf(_)===-1)&&this.fire(new h.j(new Error(`Source layer "${_}" does not exist on source "${y.id}" as specified by style layer "${r.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const r in this.sourceCaches)if(!this.sourceCaches[r].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(r,f=!1){const _=this._serializedAllLayers();if(!r||r.length===0)return Object.values(f?h.aB(_):_);const y=[];for(const x of r)if(_[x]){const M=f?h.aB(_[x]):_[x];y.push(M)}return y}_serializedAllLayers(){let r=this._serializedLayers;if(r)return r;r=this._serializedLayers={};const f=Object.keys(this._layers);for(const _ of f){const y=this._layers[_];y.type!=="custom"&&(r[_]=y.serialize())}return r}hasTransitions(){if(this.light&&this.light.hasTransition()||this.sky&&this.sky.hasTransition())return!0;for(const r in this.sourceCaches)if(this.sourceCaches[r].hasTransition())return!0;for(const r in this._layers)if(this._layers[r].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(r){if(!this._loaded)return;const f=this._changed;if(f){const y=Object.keys(this._updatedLayers),x=Object.keys(this._removedLayers);(y.length||x.length)&&this._updateWorkerLayers(y,x);for(const M in this._updatedSources){const D=this._updatedSources[M];if(D==="reload")this._reloadSource(M);else{if(D!=="clear")throw new Error(`Invalid action ${D}`);this._clearSource(M)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const M in this._updatedPaintProps)this._layers[M].updateTransitions(r);this.light.updateTransitions(r),this.sky.updateTransitions(r),this._resetUpdates()}const _={};for(const y in this.sourceCaches){const x=this.sourceCaches[y];_[y]=x.used,x.used=!1}for(const y of this._order){const x=this._layers[y];x.recalculate(r,this._availableImages),!x.isHidden(r.zoom)&&x.source&&(this.sourceCaches[x.source].used=!0)}for(const y in _){const x=this.sourceCaches[y];!!_[y]!=!!x.used&&x.fire(new h.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:y}))}this.light.recalculate(r),this.sky.recalculate(r),this.z=r.zoom,f&&this.fire(new h.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const r=Object.keys(this._changedImages);if(r.length){for(const f in this.sourceCaches)this.sourceCaches[f].reloadTilesForDependencies(["icons","patterns"],r);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const r in this.sourceCaches)this.sourceCaches[r].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(r,f){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(r,!1),removedIds:f})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(r,f={}){var _;this._checkLoaded();const y=this.serialize();if(r=f.transformStyle?f.transformStyle(y,r):r,((_=f.validate)===null||_===void 0||_)&&Cs(this,h.u(r)))return!1;(r=h.aB(r)).layers=h.az(r.layers);const x=h.aC(y,r),M=this._getOperationsToPerform(x);if(M.unimplemented.length>0)throw new Error(`Unimplemented: ${M.unimplemented.join(", ")}.`);if(M.operations.length===0)return!1;for(const D of M.operations)D();return this.stylesheet=r,this._serializedLayers=null,!0}_getOperationsToPerform(r){const f=[],_=[];for(const y of r)switch(y.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":f.push((()=>this.addLayer.apply(this,y.args)));break;case"removeLayer":f.push((()=>this.removeLayer.apply(this,y.args)));break;case"setPaintProperty":f.push((()=>this.setPaintProperty.apply(this,y.args)));break;case"setLayoutProperty":f.push((()=>this.setLayoutProperty.apply(this,y.args)));break;case"setFilter":f.push((()=>this.setFilter.apply(this,y.args)));break;case"addSource":f.push((()=>this.addSource.apply(this,y.args)));break;case"removeSource":f.push((()=>this.removeSource.apply(this,y.args)));break;case"setLayerZoomRange":f.push((()=>this.setLayerZoomRange.apply(this,y.args)));break;case"setLight":f.push((()=>this.setLight.apply(this,y.args)));break;case"setGeoJSONSourceData":f.push((()=>this.setGeoJSONSourceData.apply(this,y.args)));break;case"setGlyphs":f.push((()=>this.setGlyphs.apply(this,y.args)));break;case"setSprite":f.push((()=>this.setSprite.apply(this,y.args)));break;case"setSky":f.push((()=>this.setSky.apply(this,y.args)));break;case"setTerrain":f.push((()=>this.map.setTerrain.apply(this,y.args)));break;case"setTransition":f.push((()=>{}));break;default:_.push(y.command)}return{operations:f,unimplemented:_}}addImage(r,f){if(this.getImage(r))return this.fire(new h.j(new Error(`An image named "${r}" already exists.`)));this.imageManager.addImage(r,f),this._afterImageUpdated(r)}updateImage(r,f){this.imageManager.updateImage(r,f)}getImage(r){return this.imageManager.getImage(r)}removeImage(r){if(!this.getImage(r))return this.fire(new h.j(new Error(`An image named "${r}" does not exist.`)));this.imageManager.removeImage(r),this._afterImageUpdated(r)}_afterImageUpdated(r){this._availableImages=this.imageManager.listImages(),this._changedImages[r]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new h.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(r,f,_={}){if(this._checkLoaded(),this.sourceCaches[r]!==void 0)throw new Error(`Source "${r}" already exists.`);if(!f.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(f).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(f.type)>=0&&this._validate(h.u.source,`sources.${r}`,f,null,_))return;this.map&&this.map._collectResourceTiming&&(f.collectResourceTiming=!0);const y=this.sourceCaches[r]=new Wt(r,f,this.dispatcher);y.style=this,y.setEventedParent(this,(()=>({isSourceLoaded:y.loaded(),source:y.serialize(),sourceId:r}))),y.onAdd(this.map),this._changed=!0}removeSource(r){if(this._checkLoaded(),this.sourceCaches[r]===void 0)throw new Error("There is no source with this ID");for(const _ in this._layers)if(this._layers[_].source===r)return this.fire(new h.j(new Error(`Source "${r}" cannot be removed while layer "${_}" is using it.`)));const f=this.sourceCaches[r];delete this.sourceCaches[r],delete this._updatedSources[r],f.fire(new h.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:r})),f.setEventedParent(null),f.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(r,f){if(this._checkLoaded(),this.sourceCaches[r]===void 0)throw new Error(`There is no source with this ID=${r}`);const _=this.sourceCaches[r].getSource();if(_.type!=="geojson")throw new Error(`geojsonSource.type is ${_.type}, which is !== 'geojson`);_.setData(f),this._changed=!0}getSource(r){return this.sourceCaches[r]&&this.sourceCaches[r].getSource()}addLayer(r,f,_={}){this._checkLoaded();const y=r.id;if(this.getLayer(y))return void this.fire(new h.j(new Error(`Layer "${y}" already exists on this map.`)));let x;if(r.type==="custom"){if(Cs(this,h.aD(r)))return;x=h.aA(r)}else{if("source"in r&&typeof r.source=="object"&&(this.addSource(y,r.source),r=h.aB(r),r=h.e(r,{source:y})),this._validate(h.u.layer,`layers.${y}`,r,{arrayIndex:-1},_))return;x=h.aA(r),this._validateLayer(x),x.setEventedParent(this,{layer:{id:y}})}const M=f?this._order.indexOf(f):this._order.length;if(f&&M===-1)this.fire(new h.j(new Error(`Cannot add layer "${y}" before non-existing layer "${f}".`)));else{if(this._order.splice(M,0,y),this._layerOrderChanged=!0,this._layers[y]=x,this._removedLayers[y]&&x.source&&x.type!=="custom"){const D=this._removedLayers[y];delete this._removedLayers[y],D.type!==x.type?this._updatedSources[x.source]="clear":(this._updatedSources[x.source]="reload",this.sourceCaches[x.source].pause())}this._updateLayer(x),x.onAdd&&x.onAdd(this.map)}}moveLayer(r,f){if(this._checkLoaded(),this._changed=!0,!this._layers[r])return void this.fire(new h.j(new Error(`The layer '${r}' does not exist in the map's style and cannot be moved.`)));if(r===f)return;const _=this._order.indexOf(r);this._order.splice(_,1);const y=f?this._order.indexOf(f):this._order.length;f&&y===-1?this.fire(new h.j(new Error(`Cannot move layer "${r}" before non-existing layer "${f}".`))):(this._order.splice(y,0,r),this._layerOrderChanged=!0)}removeLayer(r){this._checkLoaded();const f=this._layers[r];if(!f)return void this.fire(new h.j(new Error(`Cannot remove non-existing layer "${r}".`)));f.setEventedParent(null);const _=this._order.indexOf(r);this._order.splice(_,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[r]=f,delete this._layers[r],this._serializedLayers&&delete this._serializedLayers[r],delete this._updatedLayers[r],delete this._updatedPaintProps[r],f.onRemove&&f.onRemove(this.map)}getLayer(r){return this._layers[r]}getLayersOrder(){return[...this._order]}hasLayer(r){return r in this._layers}setLayerZoomRange(r,f,_){this._checkLoaded();const y=this.getLayer(r);y?y.minzoom===f&&y.maxzoom===_||(f!=null&&(y.minzoom=f),_!=null&&(y.maxzoom=_),this._updateLayer(y)):this.fire(new h.j(new Error(`Cannot set the zoom range of non-existing layer "${r}".`)))}setFilter(r,f,_={}){this._checkLoaded();const y=this.getLayer(r);if(y){if(!h.aE(y.filter,f))return f==null?(y.filter=void 0,void this._updateLayer(y)):void(this._validate(h.u.filter,`layers.${y.id}.filter`,f,null,_)||(y.filter=h.aB(f),this._updateLayer(y)))}else this.fire(new h.j(new Error(`Cannot filter non-existing layer "${r}".`)))}getFilter(r){return h.aB(this.getLayer(r).filter)}setLayoutProperty(r,f,_,y={}){this._checkLoaded();const x=this.getLayer(r);x?h.aE(x.getLayoutProperty(f),_)||(x.setLayoutProperty(f,_,y),this._updateLayer(x)):this.fire(new h.j(new Error(`Cannot style non-existing layer "${r}".`)))}getLayoutProperty(r,f){const _=this.getLayer(r);if(_)return _.getLayoutProperty(f);this.fire(new h.j(new Error(`Cannot get style of non-existing layer "${r}".`)))}setPaintProperty(r,f,_,y={}){this._checkLoaded();const x=this.getLayer(r);x?h.aE(x.getPaintProperty(f),_)||(x.setPaintProperty(f,_,y)&&this._updateLayer(x),this._changed=!0,this._updatedPaintProps[r]=!0,this._serializedLayers=null):this.fire(new h.j(new Error(`Cannot style non-existing layer "${r}".`)))}getPaintProperty(r,f){return this.getLayer(r).getPaintProperty(f)}setFeatureState(r,f){this._checkLoaded();const _=r.source,y=r.sourceLayer,x=this.sourceCaches[_];if(x===void 0)return void this.fire(new h.j(new Error(`The source '${_}' does not exist in the map's style.`)));const M=x.getSource().type;M==="geojson"&&y?this.fire(new h.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):M!=="vector"||y?(r.id===void 0&&this.fire(new h.j(new Error("The feature id parameter must be provided."))),x.setFeatureState(y,r.id,f)):this.fire(new h.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(r,f){this._checkLoaded();const _=r.source,y=this.sourceCaches[_];if(y===void 0)return void this.fire(new h.j(new Error(`The source '${_}' does not exist in the map's style.`)));const x=y.getSource().type,M=x==="vector"?r.sourceLayer:void 0;x!=="vector"||M?f&&typeof r.id!="string"&&typeof r.id!="number"?this.fire(new h.j(new Error("A feature id is required to remove its specific state property."))):y.removeFeatureState(M,r.id,f):this.fire(new h.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(r){this._checkLoaded();const f=r.source,_=r.sourceLayer,y=this.sourceCaches[f];if(y!==void 0)return y.getSource().type!=="vector"||_?(r.id===void 0&&this.fire(new h.j(new Error("The feature id parameter must be provided."))),y.getFeatureState(_,r.id)):void this.fire(new h.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new h.j(new Error(`The source '${f}' does not exist in the map's style.`)))}getTransition(){return h.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const r=h.aF(this.sourceCaches,(x=>x.serialize())),f=this._serializeByIds(this._order,!0),_=this.map.getTerrain()||void 0,y=this.stylesheet;return h.aG({version:y.version,name:y.name,metadata:y.metadata,light:y.light,sky:y.sky,center:y.center,zoom:y.zoom,bearing:y.bearing,pitch:y.pitch,sprite:y.sprite,glyphs:y.glyphs,transition:y.transition,sources:r,layers:f,terrain:_},(x=>x!==void 0))}_updateLayer(r){this._updatedLayers[r.id]=!0,r.source&&!this._updatedSources[r.source]&&this.sourceCaches[r.source].getSource().type!=="raster"&&(this._updatedSources[r.source]="reload",this.sourceCaches[r.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(r){const f=M=>this._layers[M].type==="fill-extrusion",_={},y=[];for(let M=this._order.length-1;M>=0;M--){const D=this._order[M];if(f(D)){_[D]=M;for(const O of r){const L=O[D];if(L)for(const $ of L)y.push($)}}}y.sort(((M,D)=>D.intersectionZ-M.intersectionZ));const x=[];for(let M=this._order.length-1;M>=0;M--){const D=this._order[M];if(f(D))for(let O=y.length-1;O>=0;O--){const L=y[O].feature;if(_[L.layer.id]<M)break;x.push(L),y.pop()}else for(const O of r){const L=O[D];if(L)for(const $ of L)x.push($.feature)}}return x}queryRenderedFeatures(r,f,_){f&&f.filter&&this._validate(h.u.filter,"queryRenderedFeatures.filter",f.filter,null,f);const y={};if(f&&f.layers){if(!Array.isArray(f.layers))return this.fire(new h.j(new Error("parameters.layers must be an Array."))),[];
vendor: 9,871 bytes, lines 53-112
53for(const D of f.layers){const O=this._layers[D];if(!O)return this.fire(new h.j(new Error(`The layer '${D}' does not exist in the map's style and cannot be queried for features.`))),[];y[O.source]=!0}}const x=[];f.availableImages=this._availableImages;const M=this._serializedAllLayers();for(const D in this.sourceCaches)f.layers&&!y[D]||x.push(si(this.sourceCaches[D],this._layers,M,r,f,_));return this.placement&&x.push((function(D,O,L,$,H,G,ee){const ne={},he=G.queryRenderedSymbols($),pe=[];for(const ge of Object.keys(he).map(Number))pe.push(ee[ge]);pe.sort(pi);for(const ge of pe){const be=ge.featureIndex.lookupSymbolFeatures(he[ge.bucketInstanceId],O,ge.bucketIndex,ge.sourceLayerIndex,H.filter,H.layers,H.availableImages,D);for(const le in be){const Ce=ne[le]=ne[le]||[],Ie=be[le];Ie.sort(((ze,Ge)=>{const dt=ge.featureSortOrder;if(dt){const vt=dt.indexOf(ze.featureIndex);return dt.indexOf(Ge.featureIndex)-vt}return Ge.featureIndex-ze.featureIndex}));for(const ze of Ie)Ce.push(ze)}}for(const ge in ne)ne[ge].forEach((be=>{const le=be.feature,Ce=L[D[ge].source].getFeatureState(le.layer["source-layer"],le.id);le.source=le.layer.source,le.layer["source-layer"]&&(le.sourceLayer=le.layer["source-layer"]),le.state=Ce}));return ne})(this._layers,M,this.sourceCaches,r,f,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(x)}querySourceFeatures(r,f){f&&f.filter&&this._validate(h.u.filter,"querySourceFeatures.filter",f.filter,null,f);const _=this.sourceCaches[r];return _?(function(y,x){const M=y.getRenderableIds().map((L=>y.getTileByID(L))),D=[],O={};for(let L=0;L<M.length;L++){const $=M[L],H=$.tileID.canonical.key;O[H]||(O[H]=!0,$.querySourceFeatures(D,x))}return D})(_,f):[]}getLight(){return this.light.getLight()}setLight(r,f={}){this._checkLoaded();const _=this.light.getLight();let y=!1;for(const M in r)if(!h.aE(r[M],_[M])){y=!0;break}if(!y)return;const x={now:N.now(),transition:h.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(r,f),this.light.updateTransitions(x)}getSky(){var r;return(r=this.stylesheet)===null||r===void 0?void 0:r.sky}setSky(r,f={}){const _=this.getSky();let y=!1;if(!r&&!_)return;if(r&&!_)y=!0;else if(!r&&_)y=!0;else for(const M in r)if(!h.aE(r[M],_[M])){y=!0;break}if(!y)return;const x={now:N.now(),transition:h.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=r,this.sky.setSky(r,f),this.sky.updateTransitions(x)}_validate(r,f,_,y,x={}){return(!x||x.validate!==!1)&&Cs(this,r.call(h.u,h.e({key:f,style:this.serialize(),value:_,styleSpec:h.v},y)))}_remove(r=!0){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),la().off(pt,this._rtlPluginLoaded);for(const f in this._layers)this._layers[f].setEventedParent(null);for(const f in this.sourceCaches){const _=this.sourceCaches[f];_.setEventedParent(null),_.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),r&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(r)}_clearSource(r){this.sourceCaches[r].clearTiles()}_reloadSource(r){this.sourceCaches[r].resume(),this.sourceCaches[r].reload()}_updateSources(r){for(const f in this.sourceCaches)this.sourceCaches[f].update(r,this.map.terrain)}_generateCollisionBoxes(){for(const r in this.sourceCaches)this._reloadSource(r)}_updatePlacement(r,f,_,y,x=!1){let M=!1,D=!1;const O={};for(const L of this._order){const $=this._layers[L];if($.type!=="symbol")continue;if(!O[$.source]){const G=this.sourceCaches[$.source];O[$.source]=G.getRenderableIds(!0).map((ee=>G.getTileByID(ee))).sort(((ee,ne)=>ne.tileID.overscaledZ-ee.tileID.overscaledZ||(ee.tileID.isLessThan(ne.tileID)?-1:1)))}const H=this.crossTileSymbolIndex.addLayer($,O[$.source],r.center.lng);M=M||H}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((x=x||this._layerOrderChanged||_===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(N.now(),r.zoom))&&(this.pauseablePlacement=new Ya(r,this.map.terrain,this._order,x,f,_,y,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,O),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(N.now()),D=!0),M&&this.pauseablePlacement.placement.setStale()),D||M)for(const L of this._order){const $=this._layers[L];$.type==="symbol"&&this.placement.updateLayerOpacities($,O[$.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(N.now())}_releaseSymbolFadeTiles(){for(const r in this.sourceCaches)this.sourceCaches[r].releaseSymbolFadeTiles()}getImages(r,f){return h._(this,void 0,void 0,(function*(){const _=yield this.imageManager.getImages(f.icons);this._updateTilesForChangedImages();const y=this.sourceCaches[f.source];return y&&y.setDependencies(f.tileID.key,f.type,f.icons),_}))}getGlyphs(r,f){return h._(this,void 0,void 0,(function*(){const _=yield this.glyphManager.getGlyphs(f.stacks),y=this.sourceCaches[f.source];return y&&y.setDependencies(f.tileID.key,f.type,[""]),_}))}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(r,f={}){this._checkLoaded(),r&&this._validate(h.u.glyphs,"glyphs",r,null,f)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=r,this.glyphManager.entries={},this.glyphManager.setURL(r))}addSprite(r,f,_={},y){this._checkLoaded();const x=[{id:r,url:f}],M=[...rt(this.stylesheet.sprite),...x];this._validate(h.u.sprite,"sprite",M,null,_)||(this.stylesheet.sprite=M,this._loadSprite(x,!0,y))}removeSprite(r){this._checkLoaded();const f=rt(this.stylesheet.sprite);if(f.find((_=>_.id===r))){if(this._spritesImagesIds[r])for(const _ of this._spritesImagesIds[r])this.imageManager.removeImage(_),this._changedImages[_]=!0;f.splice(f.findIndex((_=>_.id===r)),1),this.stylesheet.sprite=f.length>0?f:void 0,delete this._spritesImagesIds[r],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new h.k("data",{dataType:"style"}))}else this.fire(new h.j(new Error(`Sprite "${r}" doesn't exists on this map.`)))}getSprite(){return rt(this.stylesheet.sprite)}setSprite(r,f={},_){this._checkLoaded(),r&&this._validate(h.u.sprite,"sprite",r,null,f)||(this.stylesheet.sprite=r,r?this._loadSprite(r,!0,_):(this._unloadSprite(),_&&_(null)))}}var mr=h.Y([{name:"a_pos",type:"Int16",components:2}]);const ha={prelude:ji(`#ifdef GL_ES 54precision mediump float; 55#else 56#if !defined(lowp) 57#define lowp 58#endif 59#if !defined(mediump) 60#define mediump 61#endif 62#if !defined(highp) 63#define highp 64#endif 65#endif 66`,`#ifdef GL_ES 67precision highp float; 68#else 69#if !defined(lowp) 70#define lowp 71#endif 72#if !defined(mediump) 73#define mediump 74#endif 75#if !defined(highp) 76#define highp 77#endif 78#endif 79vec2 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 80);}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;} 81#ifdef TERRAIN3D 82uniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth; 83#endif 84const 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) { 85#ifdef TERRAIN3D 86highp 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)); 87#else 88return 1.0; 89#endif 90}float calculate_visibility(vec4 pos) { 91#ifdef TERRAIN3D 92vec3 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; 93#else 94return 1.0; 95#endif 96}float ele(vec2 pos) { 97#ifdef TERRAIN3D 98vec4 rgb=(texture2D(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a; 99#else 100return 0.0; 101#endif 102}float get_elevation(vec2 pos) { 103#ifdef TERRAIN3D 104vec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration; 105#else 106return 0.0; 107#endif 108}`),background:ji(`uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity; 109#ifdef OVERDRAW_INSPECTOR 110gl_FragColor=vec4(1.0); 111#endif 112}`,"attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),backgroundPattern:ji(`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;
112uniform 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; 113#ifdef OVERDRAW_INSPECTOR 114gl_FragColor=vec4(1.0); 115#endif 116}`,"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:ji(`varying vec3 v_data;varying float v_visibility; 117#pragma mapbox: define highp vec4 color 118#pragma mapbox: define mediump float radius 119#pragma mapbox: define lowp float blur 120#pragma mapbox: define lowp float opacity 121#pragma mapbox: define highp vec4 stroke_color 122#pragma mapbox: define mediump float stroke_width 123#pragma mapbox: define lowp float stroke_opacity 124void main() { 125#pragma mapbox: initialize highp vec4 color 126#pragma mapbox: initialize mediump float radius 127#pragma mapbox: initialize lowp float blur 128#pragma mapbox: initialize lowp float opacity 129#pragma mapbox: initialize highp vec4 stroke_color 130#pragma mapbox: initialize mediump float stroke_width 131#pragma mapbox: initialize lowp float stroke_opacity 132vec2 extrude=v_data.xy;float extrude_length=length(extrude);float antialiased_blur=v_data.z;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); 133#ifdef OVERDRAW_INSPECTOR 134gl_FragColor=vec4(1.0); 135#endif 136}`,`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; 137#pragma mapbox: define highp vec4 color 138#pragma mapbox: define mediump float radius 139#pragma mapbox: define lowp float blur 140#pragma mapbox: define lowp float opacity 141#pragma mapbox: define highp vec4 stroke_color 142#pragma mapbox: define mediump float stroke_width 143#pragma mapbox: define lowp float stroke_opacity 144void main(void) { 145#pragma mapbox: initialize highp vec4 color 146#pragma mapbox: initialize mediump float radius 147#pragma mapbox: initialize lowp float blur 148#pragma mapbox: initialize lowp float opacity 149#pragma mapbox: initialize highp vec4 stroke_color 150#pragma mapbox: initialize mediump float stroke_width 151#pragma mapbox: initialize lowp float stroke_opacity 152vec2 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;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:ji("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:ji(`uniform highp float u_intensity;varying vec2 v_extrude; 153#pragma mapbox: define highp float weight 154#define GAUSS_COEF 0.3989422804014327 155void main() { 156#pragma mapbox: initialize highp float weight 157float 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); 158#ifdef OVERDRAW_INSPECTOR 159gl_FragColor=vec4(1.0); 160#endif 161}`,`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; 162#pragma mapbox: define highp float weight 163#pragma mapbox: define mediump float radius 164const highp float ZERO=1.0/255.0/16.0; 165#define GAUSS_COEF 0.3989422804014327 166void main(void) { 167#pragma mapbox: initialize highp float weight 168#pragma mapbox: initialize mediump float radius 169vec2 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,get_elevation(floor(a_pos*0.5)),1);gl_Position=u_matrix*pos;}`),heatmapTexture:ji(`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; 170#ifdef OVERDRAW_INSPECTOR 171gl_FragColor=vec4(0.0); 172#endif 173}`,"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:ji("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_anchor_pos;attribute vec2 a_placed;attribute vec2 a_box_real;uniform mat4 u_matrix;uniform vec2 u_pixel_extrude_scale;varying float v_placed;varying float v_notUsed;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);}void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:ji("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:ji("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:ji(`#pragma mapbox: define highp vec4 color 174#pragma mapbox: define lowp float opacity 175void main() { 176#pragma mapbox: initialize highp vec4 color 177#pragma mapbox: initialize lowp float opacity 178gl_FragColor=color*opacity; 179#ifdef OVERDRAW_INSPECTOR 180gl_FragColor=vec4(1.0); 181#endif 182}`,`attribute vec2 a_pos;uniform mat4 u_matrix; 183#pragma mapbox: define highp vec4 color 184#pragma mapbox: define lowp float opacity 185void main() { 186#pragma mapbox: initialize highp vec4 color 187#pragma mapbox: initialize lowp float opacity 188gl_Position=u_matrix*vec4(a_pos,0,1);}`),fillOutline:ji(`varying vec2 v_pos; 189#pragma mapbox: define highp vec4 outline_color 190#pragma mapbox: define lowp float opacity 191void main() { 192#pragma mapbox: initialize highp vec4 outline_color 193#pragma mapbox: initialize lowp float opacity 194float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity); 195#ifdef OVERDRAW_INSPECTOR 196gl_FragColor=vec4(1.0); 197#endif 198}`,`attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos; 199#pragma mapbox: define highp vec4 outline_color 200#pragma mapbox: define lowp float opacity 201void main() { 202#pragma mapbox: initialize highp vec4 outline_color 203#pragma mapbox: initialize lowp float opacity 204gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`),fillOutlinePattern:ji(`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; 205#pragma mapbox: define lowp float opacity 206#pragma mapbox: define lowp vec4 pattern_from 207#pragma mapbox: define lowp vec4 pattern_to 208void main() { 209#pragma mapbox: initialize lowp float opacity 210#pragma mapbox: initialize mediump vec4 pattern_from 211#pragma mapbox: initialize mediump vec4 pattern_to 212vec2 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; 213#ifdef OVERDRAW_INSPECTOR 214gl_FragColor=vec4(1.0); 215#endif 216}`,`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; 217#pragma mapbox: define lowp float opacity 218#pragma mapbox: define lowp vec4 pattern_from 219#pragma mapbox: define lowp vec4 pattern_to 220#pragma mapbox: define lowp float pixel_ratio_from 221#pragma mapbox: define lowp float pixel_ratio_to 222void main() { 223#pragma mapbox: initialize lowp float opacity 224#pragma mapbox: initialize mediump vec4 pattern_from 225#pragma mapbox: initialize mediump vec4 pattern_to 226#pragma mapbox: initialize lowp float pixel_ratio_from 227#pragma mapbox: initialize lowp float pixel_ratio_to 228vec2 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:ji(`#ifdef GL_ES 229precision highp float; 230#endif 231uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b; 232#pragma mapbox: define lowp float opacity 233#pragma mapbox: define lowp vec4 pattern_from 234#pragma mapbox: define lowp vec4 pattern_to 235void main() { 236#pragma mapbox: initialize lowp float opacity 237#pragma mapbox: initialize mediump vec4 pattern_from 238#pragma mapbox: initialize mediump vec4 pattern_to 239vec2 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; 240#ifdef OVERDRAW_INSPECTOR 241gl_FragColor=vec4(1.0); 242#endif 243}`,`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; 244#pragma mapbox: define lowp float opacity 245#pragma mapbox: define lowp vec4 pattern_from 246#pragma mapbox: define lowp vec4 pattern_to 247#pragma mapbox: define lowp float pixel_ratio_from 248#pragma mapbox: define lowp float pixel_ratio_to 249void main() { 250#pragma mapbox: initialize lowp float opacity 251#pragma mapbox: initialize mediump vec4 pattern_from 252#pragma mapbox: initialize mediump vec4 pattern_to 253#pragma mapbox: initialize lowp float pixel_ratio_from 254#pragma mapbox: initialize lowp float pixel_ratio_to 255vec2 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:ji(`varying vec4 v_color;void main() {gl_FragColor=v_color; 256#ifdef OVERDRAW_INSPECTOR 257gl_FragColor=vec4(1.0); 258#endif 259}`,`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; 260#ifdef TERRAIN3D 261attribute vec2 a_centroid; 262#endif 263varying vec4 v_color; 264#pragma mapbox: define highp float base 265#pragma mapbox: define highp float height 266#pragma mapbox: define highp vec4 color 267void main() { 268#pragma mapbox: initialize highp float base 269#pragma mapbox: initialize highp float height 270#pragma mapbox: initialize highp vec4 color 271vec3 normal=a_normal_ed.xyz; 272#ifdef TERRAIN3D 273float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0); 274#else 275float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0; 276#endif 277base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/
27716384.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:ji(`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; 278#pragma mapbox: define lowp float base 279#pragma mapbox: define lowp float height 280#pragma mapbox: define lowp vec4 pattern_from 281#pragma mapbox: define lowp vec4 pattern_to 282#pragma mapbox: define lowp float pixel_ratio_from 283#pragma mapbox: define lowp float pixel_ratio_to 284void main() { 285#pragma mapbox: initialize lowp float base 286#pragma mapbox: initialize lowp float height 287#pragma mapbox: initialize mediump vec4 pattern_from 288#pragma mapbox: initialize mediump vec4 pattern_to 289#pragma mapbox: initialize lowp float pixel_ratio_from 290#pragma mapbox: initialize lowp float pixel_ratio_to 291vec2 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; 292#ifdef OVERDRAW_INSPECTOR 293gl_FragColor=vec4(1.0); 294#endif 295}`,`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; 296#ifdef TERRAIN3D 297attribute vec2 a_centroid; 298#endif 299varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting; 300#pragma mapbox: define lowp float base 301#pragma mapbox: define lowp float height 302#pragma mapbox: define lowp vec4 pattern_from 303#pragma mapbox: define lowp vec4 pattern_to 304#pragma mapbox: define lowp float pixel_ratio_from 305#pragma mapbox: define lowp float pixel_ratio_to 306void main() { 307#pragma mapbox: initialize lowp float base 308#pragma mapbox: initialize lowp float height 309#pragma mapbox: initialize mediump vec4 pattern_from 310#pragma mapbox: initialize mediump vec4 pattern_to 311#pragma mapbox: initialize lowp float pixel_ratio_from 312#pragma mapbox: initialize lowp float pixel_ratio_to 313vec2 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; 314#ifdef TERRAIN3D 315float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0); 316#else 317float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0; 318#endif 319base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0 320? a_pos 321: 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:ji(`#ifdef GL_ES 322precision highp float; 323#endif 324uniform 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); 325#ifdef OVERDRAW_INSPECTOR 326gl_FragColor=vec4(1.0); 327#endif 328}`,"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:ji(`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; 329#define PI 3.141592653589793 330void 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;
330float 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; 331#ifdef OVERDRAW_INSPECTOR 332gl_FragColor=vec4(1.0); 333#endif 334}`,"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:ji(`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale; 335#pragma mapbox: define highp vec4 color 336#pragma mapbox: define lowp float blur 337#pragma mapbox: define lowp float opacity 338void main() { 339#pragma mapbox: initialize highp vec4 color 340#pragma mapbox: initialize lowp float blur 341#pragma mapbox: initialize lowp float opacity 342float 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); 343#ifdef OVERDRAW_INSPECTOR 344gl_FragColor=vec4(1.0); 345#endif 346}`,` 347#define scale 0.015873016 348attribute 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; 349#pragma mapbox: define highp vec4 color 350#pragma mapbox: define lowp float blur 351#pragma mapbox: define lowp float opacity 352#pragma mapbox: define mediump float gapwidth 353#pragma mapbox: define lowp float offset 354#pragma mapbox: define mediump float width 355void main() { 356#pragma mapbox: initialize highp vec4 color 357#pragma mapbox: initialize lowp float blur 358#pragma mapbox: initialize lowp float opacity 359#pragma mapbox: initialize mediump float gapwidth 360#pragma mapbox: initialize lowp float offset 361#pragma mapbox: initialize mediump float width 362float 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; 363#ifdef TERRAIN3D 364v_gamma_scale=1.0; 365#else 366float 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; 367#endif 368v_width2=vec2(outset,inset);}`),lineGradient:ji(`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; 369#pragma mapbox: define lowp float blur 370#pragma mapbox: define lowp float opacity 371void main() { 372#pragma mapbox: initialize lowp float blur 373#pragma mapbox: initialize lowp float opacity 374float 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); 375#ifdef OVERDRAW_INSPECTOR 376gl_FragColor=vec4(1.0); 377#endif 378}`,` 379#define scale 0.015873016 380attribute 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; 381#pragma mapbox: define lowp float blur 382#pragma mapbox: define lowp float opacity 383#pragma mapbox: define mediump float gapwidth 384#pragma mapbox: define lowp float offset 385#pragma mapbox: define mediump float width 386void main() { 387#pragma mapbox: initialize lowp float blur 388#pragma mapbox: initialize lowp float opacity 389#pragma mapbox: initialize mediump float gapwidth 390#pragma mapbox: initialize lowp float offset 391#pragma mapbox: initialize mediump float width 392float 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; 393#ifdef TERRAIN3D 394v_gamma_scale=1.0; 395#else 396float 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; 397#endif 398v_width2=vec2(outset,inset);}`),linePattern:ji(`#ifdef GL_ES 399precision highp float; 400#endif 401uniform 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; 402#pragma mapbox: define lowp vec4 pattern_from 403#pragma mapbox: define lowp vec4 pattern_to 404#pragma mapbox: define lowp float pixel_ratio_from 405#pragma mapbox: define lowp float pixel_ratio_to 406#pragma mapbox: define lowp float blur 407#pragma mapbox: define lowp float opacity 408void main() { 409#pragma mapbox: initialize mediump vec4 pattern_from 410#pragma mapbox: initialize mediump vec4 pattern_to 411#pragma mapbox: initialize lowp float pixel_ratio_from 412#pragma mapbox: initialize lowp float pixel_ratio_to 413#pragma mapbox: initialize lowp float blur 414#pragma mapbox: initialize lowp float opacity 415vec2 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; 416#ifdef OVERDRAW_INSPECTOR 417gl_FragColor=vec4(1.0); 418#endif 419}`,` 420#define scale 0.015873016 421#define LINE_DISTANCE_SCALE 2.0 422attribute 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; 423#pragma mapbox: define lowp float blur 424#pragma mapbox: define lowp float opacity 425#pragma mapbox: define lowp float offset 426#pragma mapbox: define mediump float gapwidth 427#pragma mapbox: define mediump float width 428#pragma mapbox: define lowp float floorwidth 429#pragma mapbox: define lowp vec4 pattern_from 430#pragma mapbox: define lowp vec4 pattern_to 431#pragma mapbox: define lowp float pixel_ratio_from 432#pragma mapbox: define lowp float pixel_ratio_to 433void main() { 434#pragma mapbox: initialize lowp float blur 435#pragma mapbox: initialize lowp float opacity 436#pragma mapbox: initialize lowp float offset 437#pragma mapbox: initialize mediump float gapwidth 438#pragma mapbox: initialize mediump float width 439#pragma mapbox: initialize lowp float floorwidth 440#pragma mapbox: initialize mediump vec4 pattern_from 441#pragma mapbox: initialize mediump vec4 pattern_to 442#pragma mapbox: initialize lowp float pixel_ratio_from 443#pragma mapbox: initialize lowp float pixel_ratio_to 444float 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; 445#ifdef TERRAIN3D 446v_gamma_scale=1.0; 447#else 448float 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; 449#endif 450v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:ji(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;
450uniform 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; 451#pragma mapbox: define highp vec4 color 452#pragma mapbox: define lowp float blur 453#pragma mapbox: define lowp float opacity 454#pragma mapbox: define mediump float width 455#pragma mapbox: define lowp float floorwidth 456void main() { 457#pragma mapbox: initialize highp vec4 color 458#pragma mapbox: initialize lowp float blur 459#pragma mapbox: initialize lowp float opacity 460#pragma mapbox: initialize mediump float width 461#pragma mapbox: initialize lowp float floorwidth 462float 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); 463#ifdef OVERDRAW_INSPECTOR 464gl_FragColor=vec4(1.0); 465#endif 466}`,` 467#define scale 0.015873016 468#define LINE_DISTANCE_SCALE 2.0 469attribute 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; 470#pragma mapbox: define highp vec4 color 471#pragma mapbox: define lowp float blur 472#pragma mapbox: define lowp float opacity 473#pragma mapbox: define mediump float gapwidth 474#pragma mapbox: define lowp float offset 475#pragma mapbox: define mediump float width 476#pragma mapbox: define lowp float floorwidth 477void main() { 478#pragma mapbox: initialize highp vec4 color 479#pragma mapbox: initialize lowp float blur 480#pragma mapbox: initialize lowp float opacity 481#pragma mapbox: initialize mediump float gapwidth 482#pragma mapbox: initialize lowp float offset 483#pragma mapbox: initialize mediump float width 484#pragma mapbox: initialize lowp float floorwidth 485float 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; 486#ifdef TERRAIN3D 487v_gamma_scale=1.0; 488#else 489float 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; 490#endif 491v_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:ji(`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); 492#ifdef OVERDRAW_INSPECTOR 493gl_FragColor=vec4(1.0); 494#endif 495}`,"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:ji(`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity; 496#pragma mapbox: define lowp float opacity 497void main() { 498#pragma mapbox: initialize lowp float opacity 499lowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha; 500#ifdef OVERDRAW_INSPECTOR 501gl_FragColor=vec4(1.0); 502#endif 503}`,`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;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;varying vec2 v_tex;varying float v_fade_opacity;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);} 504#pragma mapbox: define lowp float opacity 505void main() { 506#pragma mapbox: initialize lowp float opacity 507vec2 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;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? 508camera_to_anchor_distance/u_camera_to_center_distance : 509u_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=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);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;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;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:ji(`#define SDF_PX 8.0 510uniform 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; 511#pragma mapbox: define highp vec4 fill_color 512#pragma mapbox: define highp vec4 halo_color 513#pragma mapbox: define lowp float opacity 514#pragma mapbox: define lowp float halo_width 515#pragma mapbox: define lowp float halo_blur 516void main() { 517#pragma mapbox: initialize highp vec4 fill_color 518#pragma mapbox: initialize highp vec4 halo_color 519#pragma mapbox: initialize lowp float opacity 520#pragma mapbox: initialize lowp float halo_width 521#pragma mapbox: initialize lowp float halo_blur 522float 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 inner_edge=(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);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}gl_FragColor=color*(alpha*opacity*fade_opacity); 523#ifdef OVERDRAW_INSPECTOR 524gl_FragColor=vec4(1.0); 525#endif 526}`,`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 bool u_is_along_line;uniform bool u_is_variable_anchor;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_translation;uniform float u_pitched_scale;varying vec2 v_data0;varying vec3 v_data1;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);} 527#pragma mapbox: define highp vec4 fill_color 528#pragma mapbox: define highp vec4 halo_color 529#pragma mapbox: define lowp float opacity 530#pragma mapbox: define lowp float halo_width 531#pragma mapbox: define lowp float halo_blur 532void main() { 533#pragma mapbox: initialize highp vec4 fill_color 534#pragma mapbox: initialize highp vec4 halo_color 535#pragma mapbox: initialize lowp float opacity 536#pragma mapbox: initialize lowp float halo_width 537#pragma mapbox: initialize lowp float halo_blur 538vec2 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;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? 539camera_to_anchor_distance/u_camera_to_center_distance : 540u_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=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);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;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;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:ji(`#define SDF_PX 8.0 541#define SDF 1.0 542#define ICON 0.0 543uniform 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; 544#pragma mapbox: define highp vec4 fill_color 545#pragma mapbox: define highp vec4 halo_color 546#pragma mapbox: define lowp float opacity 547#pragma mapbox: define lowp float halo_width 548#pragma mapbox: define lowp float halo_blur 549void main() { 550#pragma mapbox: initialize highp vec4 fill_color 551#pragma mapbox: initialize highp vec4 halo_color 552#pragma mapbox: initialize lowp float opacity 553#pragma mapbox: initialize lowp float halo_width 554#pragma mapbox: initialize lowp float halo_blur 555float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;
555gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha; 556#ifdef OVERDRAW_INSPECTOR 557gl_FragColor=vec4(1.0); 558#endif 559return;}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); 560#ifdef OVERDRAW_INSPECTOR 561gl_FragColor=vec4(1.0); 562#endif 563}`,`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;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;varying vec4 v_data0;varying vec4 v_data1;vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_matrix*vec4(posInTile,elevation,1.0);} 564#pragma mapbox: define highp vec4 fill_color 565#pragma mapbox: define highp vec4 halo_color 566#pragma mapbox: define lowp float opacity 567#pragma mapbox: define lowp float halo_width 568#pragma mapbox: define lowp float halo_blur 569void main() { 570#pragma mapbox: initialize highp vec4 fill_color 571#pragma mapbox: initialize highp vec4 halo_color 572#pragma mapbox: initialize lowp float opacity 573#pragma mapbox: initialize lowp float halo_width 574#pragma mapbox: initialize lowp float halo_blur 575vec2 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;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ? 576camera_to_anchor_distance/u_camera_to_center_distance : 577u_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=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);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;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;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:ji("uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;varying vec2 v_texture_pos;varying float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture2D(u_texture,v_texture_pos);if (v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);
577float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);gl_FragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {gl_FragColor=surface_color;}}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform mat4 u_fog_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:ji("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);}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}"),terrainCoords:ji("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);}","attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=u_matrix*vec4(a_pos3d.xy,ele-ele_delta,1.0);}"),sky:ji("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform float u_horizon;uniform float u_sky_horizon_blend;void main() {float y=gl_FragCoord.y;if (y > u_horizon) {float blend=y-u_horizon;if (blend < u_sky_horizon_blend) {gl_FragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {gl_FragColor=u_sky_color;}}}","attribute vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}")};function ji(w,r){const f=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,_=r.match(/attribute ([\w]+) ([\w]+)/g),y=w.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),x=r.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),M=x?x.concat(y):y,D={};return{fragmentSource:w=w.replace(f,((O,L,$,H,G)=>(D[G]=!0,L==="define"?` 578#ifndef HAS_UNIFORM_u_${G} 579varying ${$} ${H} ${G}; 580#else 581uniform ${$} ${H} u_${G}; 582#endif 583`:` 584#ifdef HAS_UNIFORM_u_${G} 585 ${$} ${H} ${G} = u_${G}; 586#endif 587`))),vertexSource:r=r.replace(f,((O,L,$,H,G)=>{const ee=H==="float"?"vec2":"vec4",ne=G.match(/color/)?"color":ee;return D[G]?L==="define"?` 588#ifndef HAS_UNIFORM_u_${G} 589uniform lowp float u_${G}_t; 590attribute ${$} ${ee} a_${G}; 591varying ${$} ${H} ${G}; 592#else 593uniform ${$} ${H} u_${G}; 594#endif 595`:ne==="vec4"?` 596#ifndef HAS_UNIFORM_u_${G} 597 ${G} = a_${G}; 598#else 599 ${$} ${H} ${G} = u_${G}; 600#endif 601`:` 602#ifndef HAS_UNIFORM_u_${G} 603 ${G} = unpack_mix_${ne}(a_${G}, u_${G}_t); 604#else 605 ${$} ${H} ${G} = u_${G}; 606#endif 607`:L==="define"?` 608#ifndef HAS_UNIFORM_u_${G} 609uniform lowp float u_${G}_t; 610attribute ${$} ${ee} a_${G}; 611#else 612uniform ${$} ${H} u_${G}; 613#endif 614`:ne==="vec4"?` 615#ifndef HAS_UNIFORM_u_${G} 616 ${$} ${H} ${G} = a_${G}; 617#else 618 ${$} ${H} ${G} = u_${G}; 619#endif 620`:` 621#ifndef HAS_UNIFORM_u_${G} 622 ${$} ${H} ${G} = unpack_mix_${ne}(a_${G}, u_${G}_t); 623#else 624 ${$} ${H} ${G} = u_${G}; 625#endif 626`})),staticAttributes:_,staticUniforms:M}}class ac{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(r,f,_,y,x,M,D,O,L){this.context=r;let $=this.boundPaintVertexBuffers.length!==y.length;for(let H=0;!$&&H<y.length;H++)this.boundPaintVertexBuffers[H]!==y[H]&&($=!0);!this.vao||this.boundProgram!==f||this.boundLayoutVertexBuffer!==_||$||this.boundIndexBuffer!==x||this.boundVertexOffset!==M||this.boundDynamicVertexBuffer!==D||this.boundDynamicVertexBuffer2!==O||this.boundDynamicVertexBuffer3!==L?this.freshBind(f,_,y,x,M,D,O,L):(r.bindVertexArray.set(this.vao),D&&D.bind(),x&&x.dynamicDraw&&x.bind(),O&&O.bind(),L&&L.bind())}freshBind(r,f,_,y,x,M,D,O){const L=r.numAttributes,$=this.context,H=$.gl;this.vao&&this.destroy(),this.vao=$.createVertexArray(),$.bindVertexArray.set(this.vao),this.boundProgram=r,this.boundLayoutVertexBuffer=f,this.boundPaintVertexBuffers=_,this.boundIndexBuffer=y,this.boundVertexOffset=x,this.boundDynamicVertexBuffer=M,this.boundDynamicVertexBuffer2=D,this.boundDynamicVertexBuffer3=O,f.enableAttributes(H,r);for(const G of _)G.enableAttributes(H,r);M&&M.enableAttributes(H,r),D&&D.enableAttributes(H,r),O&&O.enableAttributes(H,r),f.bind(),f.setVertexAttribPointers(H,r,x);for(const G of _)G.bind(),G.setVertexAttribPointers(H,r,x);M&&(M.bind(),M.setVertexAttribPointers(H,r,x)),y&&y.bind(),D&&(D.bind(),D.setVertexAttribPointers(H,r,x)),O&&(O.bind(),O.setVertexAttribPointers(H,r,x)),$.currentNumAttributes=L}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}const Ga=(w,r,f,_,y)=>({u_matrix:w,u_texture:0,u_ele_delta:r,u_fog_matrix:f,u_fog_color:_?_.properties.get("fog-color"):h.aM.white,u_fog_ground_blend:_?_.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:_?_.calculateFogBlendOpacity(y):0,u_horizon_color:_?_.properties.get("horizon-color"):h.aM.white,u_horizon_fog_blend:_?_.properties.get("horizon-fog-blend"):1});function wo(w){const r=[];for(let f=0;f<w.length;f++){if(w[f]===null)continue;const _=w[f].split(" ");r.push(_.pop())}return r}class Yc{constructor(r,f,_,y,x,M){const D=r.gl;this.program=D.createProgram();const O=wo(f.staticAttributes),L=_?_.getBinderAttributes():[],$=O.concat(L),H=
vendor: 10,839 bytes, lines 626-628
626ha.prelude.staticUniforms?wo(ha.prelude.staticUniforms):[],G=f.staticUniforms?wo(f.staticUniforms):[],ee=_?_.getBinderUniforms():[],ne=H.concat(G).concat(ee),he=[];for(const ze of ne)he.indexOf(ze)<0&&he.push(ze);const pe=_?_.defines():[];x&&pe.push("#define OVERDRAW_INSPECTOR;"),M&&pe.push("#define TERRAIN3D;");const ge=pe.concat(ha.prelude.fragmentSource,f.fragmentSource).join(` 627`),be=pe.concat(ha.prelude.vertexSource,f.vertexSource).join(` 628`),le=D.createShader(D.FRAGMENT_SHADER);if(D.isContextLost())return void(this.failedToCreate=!0);if(D.shaderSource(le,ge),D.compileShader(le),!D.getShaderParameter(le,D.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${D.getShaderInfoLog(le)}`);D.attachShader(this.program,le);const Ce=D.createShader(D.VERTEX_SHADER);if(D.isContextLost())return void(this.failedToCreate=!0);if(D.shaderSource(Ce,be),D.compileShader(Ce),!D.getShaderParameter(Ce,D.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${D.getShaderInfoLog(Ce)}`);D.attachShader(this.program,Ce),this.attributes={};const Ie={};this.numAttributes=$.length;for(let ze=0;ze<this.numAttributes;ze++)$[ze]&&(D.bindAttribLocation(this.program,ze,$[ze]),this.attributes[$[ze]]=ze);if(D.linkProgram(this.program),!D.getProgramParameter(this.program,D.LINK_STATUS))throw new Error(`Program failed to link: ${D.getProgramInfoLog(this.program)}`);D.deleteShader(Ce),D.deleteShader(le);for(let ze=0;ze<he.length;ze++){const Ge=he[ze];if(Ge&&!Ie[Ge]){const dt=D.getUniformLocation(this.program,Ge);dt&&(Ie[Ge]=dt)}}this.fixedUniforms=y(r,Ie),this.terrainUniforms=((ze,Ge)=>({u_depth:new h.aH(ze,Ge.u_depth),u_terrain:new h.aH(ze,Ge.u_terrain),u_terrain_dim:new h.aI(ze,Ge.u_terrain_dim),u_terrain_matrix:new h.aJ(ze,Ge.u_terrain_matrix),u_terrain_unpack:new h.aK(ze,Ge.u_terrain_unpack),u_terrain_exaggeration:new h.aI(ze,Ge.u_terrain_exaggeration)}))(r,Ie),this.binderUniforms=_?_.getUniforms(r,Ie):[]}draw(r,f,_,y,x,M,D,O,L,$,H,G,ee,ne,he,pe,ge,be){const le=r.gl;if(this.failedToCreate)return;if(r.program.set(this.program),r.setDepthMode(_),r.setStencilMode(y),r.setColorMode(x),r.setCullFace(M),O){r.activeTexture.set(le.TEXTURE2),le.bindTexture(le.TEXTURE_2D,O.depthTexture),r.activeTexture.set(le.TEXTURE3),le.bindTexture(le.TEXTURE_2D,O.texture);for(const Ie in this.terrainUniforms)this.terrainUniforms[Ie].set(O[Ie])}for(const Ie in this.fixedUniforms)this.fixedUniforms[Ie].set(D[Ie]);he&&he.setUniforms(r,this.binderUniforms,ee,{zoom:ne});let Ce=0;switch(f){case le.LINES:Ce=2;break;case le.TRIANGLES:Ce=3;break;case le.LINE_STRIP:Ce=1}for(const Ie of G.get()){const ze=Ie.vaos||(Ie.vaos={});(ze[L]||(ze[L]=new ac)).bind(r,this,$,he?he.getPaintVertexBuffers():[],H,Ie.vertexOffset,pe,ge,be),le.drawElements(f,Ie.primitiveLength*Ce,le.UNSIGNED_SHORT,Ie.primitiveOffset*Ce*2)}}}function Ta(w,r,f){const _=1/gi(f,1,r.transform.tileZoom),y=Math.pow(2,f.tileID.overscaledZ),x=f.tileSize*Math.pow(2,r.transform.tileZoom)/y,M=x*(f.tileID.canonical.x+f.tileID.wrap*y),D=x*f.tileID.canonical.y;return{u_image:0,u_texsize:f.imageAtlasTexture.size,u_scale:[_,w.fromScale,w.toScale],u_fade:w.t,u_pixel_coord_upper:[M>>16,D>>16],u_pixel_coord_lower:[65535&M,65535&D]}}const oc=(w,r,f,_)=>{const y=r.style.light,x=y.properties.get("position"),M=[x.x,x.y,x.z],D=(function(){var L=new h.A(9);return h.A!=Float32Array&&(L[1]=0,L[2]=0,L[3]=0,L[5]=0,L[6]=0,L[7]=0),L[0]=1,L[4]=1,L[8]=1,L})();y.properties.get("anchor")==="viewport"&&(function(L,$){var H=Math.sin($),G=Math.cos($);L[0]=G,L[1]=H,L[2]=0,L[3]=-H,L[4]=G,L[5]=0,L[6]=0,L[7]=0,L[8]=1})(D,-r.transform.angle),(function(L,$,H){var G=$[0],ee=$[1],ne=$[2];L[0]=G*H[0]+ee*H[3]+ne*H[6],L[1]=G*H[1]+ee*H[4]+ne*H[7],L[2]=G*H[2]+ee*H[5]+ne*H[8]})(M,M,D);const O=y.properties.get("color");return{u_matrix:w,u_lightpos:M,u_lightintensity:y.properties.get("intensity"),u_lightcolor:[O.r,O.g,O.b],u_vertical_gradient:+f,u_opacity:_}},lc=(w,r,f,_,y,x,M)=>h.e(oc(w,r,f,_),Ta(x,r,M),{u_height_factor:-Math.pow(2,y.overscaledZ)/M.tileSize/8}),To=w=>({u_matrix:w}),Gc=(w,r,f,_)=>h.e(To(w),Ta(f,r,_)),Rp=(w,r)=>({u_matrix:w,u_world:r}),jd=(w,r,f,_,y)=>h.e(Gc(w,r,f,_),{u_world:y}),Kc=(w,r,f,_)=>{const y=w.transform;let x,M;if(_.paint.get("circle-pitch-alignment")==="map"){const D=gi(f,1,y.zoom);x=!0,M=[D,D]}else x=!1,M=y.pixelsToGLUnits;return{u_camera_to_center_distance:y.cameraToCenterDistance,u_scale_with_map:+(_.paint.get("circle-pitch-scale")==="map"),u_matrix:w.translatePosMatrix(r.posMatrix,f,_.paint.get("circle-translate"),_.paint.get("circle-translate-anchor")),u_pitch_with_map:+x,u_device_pixel_ratio:w.pixelRatio,u_extrude_scale:M}},Xr=(w,r,f)=>({u_matrix:w,u_inv_matrix:r,u_camera_to_center_distance:f.cameraToCenterDistance,u_viewport_size:[f.width,f.height]}),So=(w,r,f=1)=>({u_matrix:w,u_color:r,u_overlay:0,u_overlay_scale:f}),Dr=w=>({u_matrix:w}),hr=(w,r,f,_)=>({u_matrix:w,u_extrude_scale:gi(r,1,f),u_intensity:_}),Sa=(w,r,f,_)=>{const y=h.H();h.aP(y,0,w.width,w.height,0,0,1);const x=w.context.gl;return{u_matrix:y,u_world:[x.drawingBufferWidth,x.drawingBufferHeight],u_image:f,u_color_ramp:_,u_opacity:r.paint.get("heatmap-opacity")}};function cc(w,r){const f=Math.pow(2,r.canonical.z),_=r.canonical.y;return[new h.Z(0,_/f).toLngLat().lat,new h.Z(0,(_+1)/f).toLngLat().lat]}const ul=(w,r,f,_)=>{const y=w.transform;return{u_matrix:hl(w,r,f,_),u_ratio:1/gi(r,1,y.zoom),u_device_pixel_ratio:w.pixelRatio,u_units_to_pixels:[1/y.pixelsToGLUnits[0],1/y.pixelsToGLUnits[1]]}},bh=(w,r,f,_,y)=>h.e(ul(w,r,f,y),{u_image:0,u_image_height:_}),da=(w,r,f,_,y)=>{const x=w.transform,M=Qc(r,x);return{u_matrix:hl(w,r,f,y),u_texsize:r.imageAtlasTexture.size,u_ratio:1/gi(r,1,x.zoom),u_device_pixel_ratio:w.pixelRatio,u_image:0,u_scale:[M,_.fromScale,_.toScale],u_fade:_.t,u_units_to_pixels:[1/x.pixelsToGLUnits[0],1/x.pixelsToGLUnits[1]]}},Aa=(w,r,f,_,y,x)=>{const M=w.lineAtlas,D=Qc(r,w.transform),O=f.layout.get("line-cap")==="round",L=M.getDash(_.from,O),$=M.getDash(_.to,O),H=L.width*y.fromScale,G=$.width*y.toScale;return h.e(ul(w,r,f,x),{u_patternscale_a:[D/H,-L.height/2],u_patternscale_b:[D/G,-$.height/2],u_sdfgamma:M.width/(256*Math.min(H,G)*w.pixelRatio)/2,u_image:0,u_tex_y_a:L.y,u_tex_y_b:$.y,u_mix:y.t})};function Qc(w,r){return 1/gi(w,1,r.tileZoom)}function hl(w,r,f,_){return w.translatePosMatrix(_?_.posMatrix:r.tileID.posMatrix,r,f.paint.get("line-translate"),f.paint.get("line-translate-anchor"))}const Ka=(w,r,f,_,y)=>{return{u_matrix:w,u_tl_parent:r,u_scale_parent:f,u_buffer_scale:1,u_fade_t:_.mix,u_opacity:_.opacity*y.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:y.paint.get("raster-brightness-min"),u_brightness_high:y.paint.get("raster-brightness-max"),u_saturation_factor:(M=y.paint.get("raster-saturation"),M>0?1-1/(1.001-M):-M),u_contrast_factor:(x=y.paint.get("raster-contrast"),x>0?1/(1-x):1+x),u_spin_weights:xh(y.paint.get("raster-hue-rotate"))};var x,M};function xh(w){w*=Math.PI/180;const r=Math.sin(w),f=Math.cos(w);return[(2*f+1)/3,(-Math.sqrt(3)*r-f+1)/3,(Math.sqrt(3)*r-f+1)/3]}const uc=(w,r,f,_,y,x,M,D,O,L,$,H,G,ee)=>{const ne=M.transform;return{u_is_size_zoom_constant:+(w==="constant"||w==="source"),u_is_size_feature_constant:+(w==="constant"||w==="camera"),u_size_t:r?r.uSizeT:0,u_size:r?r.uSize:0,u_camera_to_center_distance:ne.cameraToCenterDistance,u_pitch:ne.pitch/360*2*Math.PI,u_rotate_symbol:+f,u_aspect_ratio:ne.width/ne.height,u_fade_change:M.options.fadeDuration?M.symbolFadeChange:1,u_matrix:D,u_label_plane_matrix:O,u_coord_matrix:L,u_is_text:+H,u_pitch_with_map:+_,u_is_along_line:y,u_is_variable_anchor:x,u_texsize:G,u_texture:0,u_translation:$,u_pitched_scale:ee}},dl=(w,r,f,_,y,x,M,D,O,L,$,H,G,ee,ne)=>{const he=M.transform;return h.e(uc(w,r,f,_,y,x,M,D,O,L,$,H,G,ne),{u_gamma_scale:_?Math.cos(he._pitch)*he.cameraToCenterDistance:1,u_device_pixel_ratio:M.pixelRatio,u_is_halo:1})},fl=(w,r,f,_,y,x,M,D,O,L,$,H,G,ee)=>h.e(dl(w,r,f,_,y,x,M,D,O,L,$,!0,H,!0,ee),{u_texsize_icon:G,u_texture_icon:1}),Ao=(w,r,f)=>({u_matrix:w,u_opacity:r,u_color:f}),Jc=(w,r,f,_,y,x)=>h.e((function(M,D,O,L){const $=O.imageManager.getPattern(M.from.toString()),H=O.imageManager.getPattern(M.to.toString()),{width:G,height:ee}=O.imageManager.getPixelSize(),ne=Math.pow(2,L.tileID.overscaledZ),he=L.tileSize*Math.pow(2,O.transform.tileZoom)/ne,pe=he*(L.tileID.canonical.x+L.tileID.wrap*ne),ge=he*L.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:$.tl,u_pattern_br_a:$.br,u_pattern_tl_b:H.tl,u_pattern_br_b:H.br,u_texsize:[G,ee],u_mix:D.t,u_pattern_size_a:$.displaySize,u_pattern_size_b:H.displaySize,u_scale_a:D.fromScale,u_scale_b:D.toScale,u_tile_units_to_pixels:1/gi(L,1,O.transform.tileZoom),u_pixel_coord_upper:[pe>>16,ge>>16],u_pixel_coord_lower:[65535&pe,65535&ge]}})(_,x,f,y),{u_matrix:w,u_opacity:r}),Or={fillExtrusion:(w,r)=>({u_matrix:new h.aJ(w,r.u_matrix),u_lightpos:new h.aN(w,r.u_lightpos),u_lightintensity:new h.aI(w,r.u_lightintensity),u_lightcolor:new h.aN(w,r.u_lightcolor),u_vertical_gradient:new h.aI(w,r.u_vertical_gradient),u_opacity:new h.aI(w,r.u_opacity)}),fillExtrusionPattern:(w,r)=>({u_matrix:new h.aJ(w,r.u_matrix),u_lightpos:new h.aN(w,r.u_lightpos),u_lightintensity:new h.aI(w,r.u_lightintensity),u_lightcolor:new h.aN(w,r.u_lightcolor),u_vertical_gradient:new h.aI(w,r.u_vertical_gradient),u_height_factor:new h.aI(w,r.u_height_factor),u_image:new h.aH(w,r.u_image),u_texsize:new h.aO(w,r.u_texsize),u_pixel_coord_upper:new h.aO(w,r.u_pixel_coord_upper),u_pixel_coord_lower:new h.aO(w,r.u_pixel_coord_lower),u_scale:new h.aN(w,r.u_scale),u_fade:new h.aI(w,r.u_fade),u_opacity:new h.aI(w,r.u_opacity)}),fill:(w,r)=>({u_matrix:new h.aJ(w,r.u_matrix)}),fillPattern:(w,r)=>({u_matrix:new h.aJ(w,r.u_matrix),u_image:new h.aH(w,r.u_image),u_texsize:new h.aO(w,r.u_texsize),u_pixel_coord_upper:new h.aO(w,r.u_pixel_coord_upper),u_pixel_coord_lower:new h.aO(w,r.u_pixel_coord_lower),u_scale:new h.aN(w,r.u_scale),u_fade:new h.aI(w,r.u_fade)}),fillOutline:(w,r)=>({u_matrix:new h.aJ(w,r.u_matrix),u_world:new h.aO(w,r.u_world)}),fillOutlinePattern:(w,r)=>({u_matrix:new h.aJ(w,r.u_matrix),u_world:new h.aO(w,r.u_world),u_image:new h.aH(w,r.u_image),u_texsize:new h.aO(w,r.u_texsize),u_pixel_coord_upper:new h.aO(w,r.u_pixel_coord_upper),u_pixel_coord_lower:new h.aO(w,r.u_pixel_coord_lower),u_scale:new h.aN(w,r.u_scale),u_fade:new h.aI(w,r.u_fade)}),circle:(w,r)=>({u_camera_to_center_distance:new h.aI(w,r.u_camera_to_center_distance),u_scale_with_map:new h.aH(w,r.u_scale_with_map),u_pitch_with_map:new h.aH(w,r.u_pitch_with_map),u_extrude_scale:new h.aO(w,r.u_extrude_scale),u_device_pixel_ratio:new h.aI(w,r.u_device_pixel_ratio),u_matrix:new h.aJ(w,r.u_matrix)}),collisionBox:(w,r)=>({u_matrix:new h.aJ(w,r.u_matrix),u_pixel_extrude_scale:new h.aO(w,r.u_pixel_extrude_scale)}),collisionCircle:(w,r)=>({u_matrix:new h.aJ(w,r.u_matrix),u_inv_matrix:new h.aJ(w,r.u_inv_matrix
628),u_camera_to_center_distance:new h.aI(w,r.u_camera_to_center_distance),u_viewport_size:new h.aO(w,r.u_viewport_size)}),debug:(w,r)=>({u_color:new h.aL(w,r.u_color),u_matrix:new h.aJ(w,r.u_matrix),u_overlay:new h.aH(w,r.u_overlay),u_overlay_scale:new h.aI(w,r.u_overlay_scale)}),clippingMask:(w,r)=>({u_matrix:new h.aJ(w,r.u_matrix)}),heatmap:(w,r)=>({u_extrude_scale:new h.aI(w,r.u_extrude_scale),u_intensity:new h.aI(w,r.u_intensity),u_matrix:new h.aJ(w,r.u_matrix)}),heatmapTexture:(w,r)=>({u_matrix:new h.aJ(w,r.u_matrix),u_world:new h.aO(w,r.u_world),u_image:new h.aH(w,r.u_image),u_color_ramp:new h.aH(w,r.u_color_ramp),u_opacity:new h.aI(w,r.u_opacity)}),hillshade:(w,r)=>({u_matrix:new h.aJ(w,r.u_matrix),u_image:new h.aH(w,r.u_image),u_latrange:new h.aO(w,r.u_latrange),u_light:new h.aO(w,r.u_light),u_shadow:new h.aL(w,r.u_shadow),u_highlight:new h.aL(w,r.u_highlight),u_accent:new h.aL(w,r.u_accent)}),hillshadePrepare:(w,r)=>({u_matrix:new h.aJ(w,r.u_matrix),u_image:new h.aH(w,r.u_image),u_dimension:new h.aO(w,r.u_dimension),u_zoom:new h.aI(w,r.u_zoom),u_unpack:new h.aK(w,r.u_unpack)}),line:(w,r)=>({u_matrix:new h.aJ(w,r.u_matrix),u_ratio:new h.aI(w,r.u_ratio),u_device_pixel_ratio:new h.aI(w,r.u_device_pixel_ratio),u_units_to_pixels:new h.aO(w,r.u_units_to_pixels)}),lineGradient:(w,r)=>({u_matrix:new h.aJ(w,r.u_matrix),u_ratio:new h.aI(w,r.u_ratio),u_device_pixel_ratio:new h.aI(w,r.u_device_pixel_ratio),u_units_to_pixels:new h.aO(w,r.u_units_to_pixels),u_image:new h.aH(w,r.u_image),u_image_height:new h.aI(w,r.u_image_height)}),linePattern:(w,r)=>({u_matrix:new h.aJ(w,r.u_matrix),u_texsize:new h.aO(w,r.u_texsize),u_ratio:new h.aI(w,r.u_ratio),u_device_pixel_ratio:new h.aI(w,r.u_device_pixel_ratio),u_image:new h.aH(w,r.u_image),u_units_to_pixels:new h.aO(w,r.u_units_to_pixels),u_scale:new h.aN(w,r.u_scale),u_fade:new h.aI(w,r.u_fade)}),lineSDF:(w,r)=>({u_matrix:new h.aJ(w,r.u_matrix),u_ratio:new h.aI(w,r.u_ratio),u_device_pixel_ratio:new h.aI(w,r.u_device_pixel_ratio),u_units_to_pixels:new h.aO(w,r.u_units_to_pixels),u_patternscale_a:new h.aO(w,r.u_patternscale_a),u_patternscale_b:new h.aO(w,r.u_patternscale_b),u_sdfgamma:new h.aI(w,r.u_sdfgamma),u_image:new h.aH(w,r.u_image),u_tex_y_a:new h.aI(w,r.u_tex_y_a),u_tex_y_b:new h.aI(w,r.u_tex_y_b),u_mix:new h.aI(w,r.u_mix)}),raster:(w,r)=>({u_matrix:new h.aJ(w,r.u_matrix),u_tl_parent:new h.aO(w,r.u_tl_parent),u_scale_parent:new h.aI(w,r.u_scale_parent),u_buffer_scale:new h.aI(w,r.u_buffer_scale),u_fade_t:new h.aI(w,r.u_fade_t),u_opacity:new h.aI(w,r.u_opacity),u_image0:new h.aH(w,r.u_image0),u_image1:new h.aH(w,r.u_image1),u_brightness_low:new h.aI(w,r.u_brightness_low),u_brightness_high:new h.aI(w,r.u_brightness_high),u_saturation_factor:new h.aI(w,r.u_saturation_factor),u_contrast_factor:new h.aI(w,r.u_contrast_factor),u_spin_weights:new h.aN(w,r.u_spin_weights)}),symbolIcon:(w,r)=>({u_is_size_zoom_constant:new h.aH(w,r.u_is_size_zoom_constant),u_is_size_feature_constant:new h.aH(w,r.u_is_size_feature_constant),u_size_t:new h.aI(w,r.u_size_t),u_size:new h.aI(w,r.u_size),u_camera_to_center_distance:new h.aI(w,r.u_camera_to_center_distance),u_pitch:new h.aI(w,r.u_pitch),u_rotate_symbol:new h.aH(w,r.u_rotate_symbol),u_aspect_ratio:new h.aI(w,r.u_aspect_ratio),u_fade_change:new h.aI(w,r.u_fade_change),u_matrix:new h.aJ(w,r.u_matrix),u_label_plane_matrix:new h.aJ(w,r.u_label_plane_matrix),u_coord_matrix:new h.aJ(w,r.u_coord_matrix),u_is_text:new h.aH(w,r.u_is_text),u_pitch_with_map:new h.aH(w,r.u_pitch_with_map),u_is_along_line:new h.aH(w,r.u_is_along_line),u_is_variable_anchor:new h.aH(w,r.u_is_variable_anchor),u_texsize:new h.aO(w,r.u_texsize),u_texture:new h.aH(w,r.u_texture),u_translation:new h.aO(w,r.u_translation),u_pitched_scale:new h.aI(w,r.u_pitched_scale)}),symbolSDF:(w,r)=>({u_is_size_zoom_constant:new h.aH(w,r.u_is_size_zoom_constant),u_is_size_feature_constant:new h.aH(w,r.u_is_size_feature_constant),u_size_t:new h.aI(w,r.u_size_t),u_size:new h.aI(w,r.u_size),u_camera_to_center_distance:new h.aI(w,r.u_camera_to_center_distance),u_pitch:new h.aI(w,r.u_pitch),u_rotate_symbol:new h.aH(w,r.u_rotate_symbol),u_aspect_ratio:new h.aI(w,r.u_aspect_ratio),u_fade_change:new h.aI(w,r.u_fade_change),u_matrix:new h.aJ(w,r.u_matrix),u_label_plane_matrix:new h.aJ(w,r.u_label_plane_matrix
vendor: 18,927 bytes, line 628
628),u_coord_matrix:new h.aJ(w,r.u_coord_matrix),u_is_text:new h.aH(w,r.u_is_text),u_pitch_with_map:new h.aH(w,r.u_pitch_with_map),u_is_along_line:new h.aH(w,r.u_is_along_line),u_is_variable_anchor:new h.aH(w,r.u_is_variable_anchor),u_texsize:new h.aO(w,r.u_texsize),u_texture:new h.aH(w,r.u_texture),u_gamma_scale:new h.aI(w,r.u_gamma_scale),u_device_pixel_ratio:new h.aI(w,r.u_device_pixel_ratio),u_is_halo:new h.aH(w,r.u_is_halo),u_translation:new h.aO(w,r.u_translation),u_pitched_scale:new h.aI(w,r.u_pitched_scale)}),symbolTextAndIcon:(w,r)=>({u_is_size_zoom_constant:new h.aH(w,r.u_is_size_zoom_constant),u_is_size_feature_constant:new h.aH(w,r.u_is_size_feature_constant),u_size_t:new h.aI(w,r.u_size_t),u_size:new h.aI(w,r.u_size),u_camera_to_center_distance:new h.aI(w,r.u_camera_to_center_distance),u_pitch:new h.aI(w,r.u_pitch),u_rotate_symbol:new h.aH(w,r.u_rotate_symbol),u_aspect_ratio:new h.aI(w,r.u_aspect_ratio),u_fade_change:new h.aI(w,r.u_fade_change),u_matrix:new h.aJ(w,r.u_matrix),u_label_plane_matrix:new h.aJ(w,r.u_label_plane_matrix),u_coord_matrix:new h.aJ(w,r.u_coord_matrix),u_is_text:new h.aH(w,r.u_is_text),u_pitch_with_map:new h.aH(w,r.u_pitch_with_map),u_is_along_line:new h.aH(w,r.u_is_along_line),u_is_variable_anchor:new h.aH(w,r.u_is_variable_anchor),u_texsize:new h.aO(w,r.u_texsize),u_texsize_icon:new h.aO(w,r.u_texsize_icon),u_texture:new h.aH(w,r.u_texture),u_texture_icon:new h.aH(w,r.u_texture_icon),u_gamma_scale:new h.aI(w,r.u_gamma_scale),u_device_pixel_ratio:new h.aI(w,r.u_device_pixel_ratio),u_is_halo:new h.aH(w,r.u_is_halo),u_translation:new h.aO(w,r.u_translation),u_pitched_scale:new h.aI(w,r.u_pitched_scale)}),background:(w,r)=>({u_matrix:new h.aJ(w,r.u_matrix),u_opacity:new h.aI(w,r.u_opacity),u_color:new h.aL(w,r.u_color)}),backgroundPattern:(w,r)=>({u_matrix:new h.aJ(w,r.u_matrix),u_opacity:new h.aI(w,r.u_opacity),u_image:new h.aH(w,r.u_image),u_pattern_tl_a:new h.aO(w,r.u_pattern_tl_a),u_pattern_br_a:new h.aO(w,r.u_pattern_br_a),u_pattern_tl_b:new h.aO(w,r.u_pattern_tl_b),u_pattern_br_b:new h.aO(w,r.u_pattern_br_b),u_texsize:new h.aO(w,r.u_texsize),u_mix:new h.aI(w,r.u_mix),u_pattern_size_a:new h.aO(w,r.u_pattern_size_a),u_pattern_size_b:new h.aO(w,r.u_pattern_size_b),u_scale_a:new h.aI(w,r.u_scale_a),u_scale_b:new h.aI(w,r.u_scale_b),u_pixel_coord_upper:new h.aO(w,r.u_pixel_coord_upper),u_pixel_coord_lower:new h.aO(w,r.u_pixel_coord_lower),u_tile_units_to_pixels:new h.aI(w,r.u_tile_units_to_pixels)}),terrain:(w,r)=>({u_matrix:new h.aJ(w,r.u_matrix),u_texture:new h.aH(w,r.u_texture),u_ele_delta:new h.aI(w,r.u_ele_delta),u_fog_matrix:new h.aJ(w,r.u_fog_matrix),u_fog_color:new h.aL(w,r.u_fog_color),u_fog_ground_blend:new h.aI(w,r.u_fog_ground_blend),u_fog_ground_blend_opacity:new h.aI(w,r.u_fog_ground_blend_opacity),u_horizon_color:new h.aL(w,r.u_horizon_color),u_horizon_fog_blend:new h.aI(w,r.u_horizon_fog_blend)}),terrainDepth:(w,r)=>({u_matrix:new h.aJ(w,r.u_matrix),u_ele_delta:new h.aI(w,r.u_ele_delta)}),terrainCoords:(w,r)=>({u_matrix:new h.aJ(w,r.u_matrix),u_texture:new h.aH(w,r.u_texture),u_terrain_coords_id:new h.aI(w,r.u_terrain_coords_id),u_ele_delta:new h.aI(w,r.u_ele_delta)}),sky:(w,r)=>({u_sky_color:new h.aL(w,r.u_sky_color),u_horizon_color:new h.aL(w,r.u_horizon_color),u_horizon:new h.aI(w,r.u_horizon),u_sky_horizon_blend:new h.aI(w,r.u_sky_horizon_blend)})};class kr{constructor(r,f,_){this.context=r;const y=r.gl;this.buffer=y.createBuffer(),this.dynamicDraw=!!_,this.context.unbindVAO(),r.bindElementBuffer.set(this.buffer),y.bufferData(y.ELEMENT_ARRAY_BUFFER,f.arrayBuffer,this.dynamicDraw?y.DYNAMIC_DRAW:y.STATIC_DRAW),this.dynamicDraw||delete f.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(r){const f=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),f.bufferSubData(f.ELEMENT_ARRAY_BUFFER,0,r.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const eu={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Eo{constructor(r,f,_,y){this.length=f.length,this.attributes=_,this.itemSize=f.bytesPerElement,this.dynamicDraw=y,this.context=r;const x=r.gl;this.buffer=x.createBuffer(),r.bindVertexBuffer.set(this.buffer),x.bufferData(x.ARRAY_BUFFER,f.arrayBuffer,this.dynamicDraw?x.DYNAMIC_DRAW:x.STATIC_DRAW),this.dynamicDraw||delete f.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(r){if(r.length!==this.length)throw new Error(`Length of new data is ${r.length}, which doesn't match current length of ${this.length}`);const f=this.context.gl;this.bind(),f.bufferSubData(f.ARRAY_BUFFER,0,r.arrayBuffer)}enableAttributes(r,f){for(let _=0;_<this.attributes.length;_++){const y=f.attributes[this.attributes[_].name];y!==void 0&&r.enableVertexAttribArray(y)}}setVertexAttribPointers(r,f,_){for(let y=0;y<this.attributes.length;y++){const x=this.attributes[y],M=f.attributes[x.name];M!==void 0&&r.vertexAttribPointer(M,x.components,r[eu[x.type]],!1,this.itemSize,x.offset+this.itemSize*(_||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Co=new WeakMap;function fa(w){var r;if(Co.has(w))return Co.get(w);{const f=(r=w.getParameter(w.VERSION))===null||r===void 0?void 0:r.startsWith("WebGL 2.0");return Co.set(w,f),f}}class Vi{constructor(r){this.gl=r.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(r){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class Qa extends Vi{getDefault(){return h.aM.transparent}set(r){const f=this.current;(r.r!==f.r||r.g!==f.g||r.b!==f.b||r.a!==f.a||this.dirty)&&(this.gl.clearColor(r.r,r.g,r.b,r.a),this.current=r,this.dirty=!1)}}class tu extends Vi{getDefault(){return 1}set(r){(r!==this.current||this.dirty)&&(this.gl.clearDepth(r),this.current=r,this.dirty=!1)}}class Ro extends Vi{getDefault(){return 0}set(r){(r!==this.current||this.dirty)&&(this.gl.clearStencil(r),this.current=r,this.dirty=!1)}}class Mp extends Vi{getDefault(){return[!0,!0,!0,!0]}set(r){const f=this.current;(r[0]!==f[0]||r[1]!==f[1]||r[2]!==f[2]||r[3]!==f[3]||this.dirty)&&(this.gl.colorMask(r[0],r[1],r[2],r[3]),this.current=r,this.dirty=!1)}}class Vd extends Vi{getDefault(){return!0}set(r){(r!==this.current||this.dirty)&&(this.gl.depthMask(r),this.current=r,this.dirty=!1)}}class Pp extends Vi{getDefault(){return 255}set(r){(r!==this.current||this.dirty)&&(this.gl.stencilMask(r),this.current=r,this.dirty=!1)}}class iu extends Vi{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(r){const f=this.current;(r.func!==f.func||r.ref!==f.ref||r.mask!==f.mask||this.dirty)&&(this.gl.stencilFunc(r.func,r.ref,r.mask),this.current=r,this.dirty=!1)}}class wh extends Vi{getDefault(){const r=this.gl;return[r.KEEP,r.KEEP,r.KEEP]}set(r){const f=this.current;(r[0]!==f[0]||r[1]!==f[1]||r[2]!==f[2]||this.dirty)&&(this.gl.stencilOp(r[0],r[1],r[2]),this.current=r,this.dirty=!1)}}class $d extends Vi{getDefault(){return!1}set(r){if(r===this.current&&!this.dirty)return;const f=this.gl;r?f.enable(f.STENCIL_TEST):f.disable(f.STENCIL_TEST),this.current=r,this.dirty=!1}}class Hd extends Vi{getDefault(){return[0,1]}set(r){const f=this.current;(r[0]!==f[0]||r[1]!==f[1]||this.dirty)&&(this.gl.depthRange(r[0],r[1]),this.current=r,this.dirty=!1)}}class Wd extends Vi{getDefault(){return!1}set(r){if(r===this.current&&!this.dirty)return;const f=this.gl;r?f.enable(f.DEPTH_TEST):f.disable(f.DEPTH_TEST),this.current=r,this.dirty=!1}}class Xd extends Vi{getDefault(){return this.gl.LESS}set(r){(r!==this.current||this.dirty)&&(this.gl.depthFunc(r),this.current=r,this.dirty=!1)}}class Ja extends Vi{getDefault(){return!1}set(r){if(r===this.current&&!this.dirty)return;const f=this.gl;r?f.enable(f.BLEND):f.disable(f.BLEND),this.current=r,this.dirty=!1}}class qd extends Vi{getDefault(){const r=this.gl;return[r.ONE,r.ZERO]}set(r){const f=this.current;(r[0]!==f[0]||r[1]!==f[1]||this.dirty)&&(this.gl.blendFunc(r[0],r[1]),this.current=r,this.dirty=!1)}}class Ip extends Vi{getDefault(){return h.aM.transparent}set(r){const f=this.current;(r.r!==f.r||r.g!==f.g||r.b!==f.b||r.a!==f.a||this.dirty)&&(this.gl.blendColor(r.r,r.g,r.b,r.a),this.current=r,this.dirty=!1)}}class Zd extends Vi{getDefault(){return this.gl.FUNC_ADD}set(r){(r!==this.current||this.dirty)&&(this.gl.blendEquation(r),this.current=r,this.dirty=!1)}}class hc extends Vi{getDefault(){return!1}set(r){if(r===this.current&&!this.dirty)return;const f=this.gl;r?f.enable(f.CULL_FACE):f.disable(f.CULL_FACE),this.current=r,this.dirty=!1}}class Th extends Vi{getDefault(){return this.gl.BACK}set(r){(r!==this.current||this.dirty)&&(this.gl.cullFace(r),this.current=r,this.dirty=!1)}}class nu extends Vi{getDefault(){return this.gl.CCW}set(r){(r!==this.current||this.dirty)&&(this.gl.frontFace(r),this.current=r,this.dirty=!1)}}class Dp extends Vi{getDefault(){return null}set(r){(r!==this.current||this.dirty)&&(this.gl.useProgram(r),this.current=r,this.dirty=!1)}}class Op extends Vi{getDefault(){return this.gl.TEXTURE0}set(r){(r!==this.current||this.dirty)&&(this.gl.activeTexture(r),this.current=r,this.dirty=!1)}}class Sh extends Vi{getDefault(){const r=this.gl;return[0,0,r.drawingBufferWidth,r.drawingBufferHeight]}set(r){const f=this.current;(r[0]!==f[0]||r[1]!==f[1]||r[2]!==f[2]||r[3]!==f[3]||this.dirty)&&(this.gl.viewport(r[0],r[1],r[2],r[3]),this.current=r,this.dirty=!1)}}class Yd extends Vi{getDefault(){return null}set(r){if(r===this.current&&!this.dirty)return;const f=this.gl;f.bindFramebuffer(f.FRAMEBUFFER,r),this.current=r,this.dirty=!1}}class Gd extends Vi{getDefault(){return null}set(r){if(r===this.current&&!this.dirty)return;const f=this.gl;f.bindRenderbuffer(f.RENDERBUFFER,r),this.current=r,this.dirty=!1}}class Ah extends Vi{getDefault(){return null}set(r){if(r===this.current&&!this.dirty)return;const f=this.gl;f.bindTexture(f.TEXTURE_2D,r),this.current=r,this.dirty=!1}}class Kd extends Vi{getDefault(){return null}set(r){if(r===this.current&&!this.dirty)return;const f=this.gl;f.bindBuffer(f.ARRAY_BUFFER,r),this.current=r,this.dirty=!1}}class ru extends Vi{getDefault(){return null}set(r){const f=this.gl;f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,r),this.current=r,this.dirty=!1}}class Ea extends Vi{getDefault(){return null}set(r){var f;if(r===this.current&&!this.dirty)return;const _=this.gl;fa(_)?_.bindVertexArray(r):(f=_.getExtension("OES_vertex_array_object"))===null||f===void 0||f.bindVertexArrayOES(r),this.current=r,this.dirty=!1}}class Eh extends Vi{getDefault(){return 4}set(r){if(r===this.current&&!this.dirty)return;const f=this.gl;f.pixelStorei(f.UNPACK_ALIGNMENT,r),this.current=r,this.dirty=!1}}class Ch extends Vi{getDefault(){return!1}set(r){if(r===this.current&&!this.dirty)return;const f=this.gl;f.pixelStorei(f.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r),this.current=r,this.dirty=!1}}class Rh extends Vi{getDefault(){return!1}set(r){if(r===this.current&&!this.dirty)return;const f=this.gl;f.pixelStorei(f.UNPACK_FLIP_Y_WEBGL,r),this.current=r,this.dirty=!1}}class pl extends Vi{constructor(r,f){super(r),this.context=r,this.parent=f}getDefault(){return null}}class Mo extends pl{setDirty(){this.dirty=!0}set(r){if(r===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const f=this.gl;f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_2D,r,0),this.current=r,this.dirty=!1}}class Po extends pl{set(r){if(r===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const f=this.gl;f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_ATTACHMENT,f.RENDERBUFFER,r),this.current=r,this.dirty=!1}}class su extends pl{set(r){if(r===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const f=this.gl;f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_STENCIL_ATTACHMENT,f.RENDERBUFFER,r),this.current=r,this.dirty=!1}}class Qd{constructor(r,f,_,y,x){this.context=r,this.width=f,this.height=_;const M=r.gl,D=this.framebuffer=M.createFramebuffer();if(this.colorAttachment=new Mo(r,D),y)this.depthAttachment=x?new su(r,D):new Po(r,D);else if(x)throw new Error("Stencil cannot be set without depth");if(M.checkFramebufferStatus(M.FRAMEBUFFER)!==M.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){const r=this.context.gl,f=this.colorAttachment.get();if(f&&r.deleteTexture(f),this.depthAttachment){const _=this.depthAttachment.get();_&&r.deleteRenderbuffer(_)}r.deleteFramebuffer(this.framebuffer)}}class Nn{constructor(r,f,_){this.blendFunction=r,this.blendColor=f,this.mask=_}}Nn.Replace=[1,0],Nn.disabled=new Nn(Nn.Replace,h.aM.transparent,[!1,!1,!1,!1]),Nn.unblended=new Nn(Nn.Replace,h.aM.transparent,[!0,!0,!0,!0]),Nn.alphaBlended=new Nn([1,771],h.aM.transparent,[!0,!0,!0,!0]);class Jd{constructor(r){var f,_;if(this.gl=r,this.clearColor=new Qa(this),this.clearDepth=new tu(this),this.clearStencil=new Ro(this),this.colorMask=new Mp(this),this.depthMask=new Vd(this),this.stencilMask=new Pp(this),this.stencilFunc=new iu(this),this.stencilOp=new wh(this),this.stencilTest=new $d(this),this.depthRange=new Hd(this),this.depthTest=new Wd(this),this.depthFunc=new Xd(this),this.blend=new Ja(this),this.blendFunc=new qd(this),this.blendColor=new Ip(this),this.blendEquation=new Zd(this),this.cullFace=new hc(this),this.cullFaceSide=new Th(this),this.frontFace=new nu(this),this.program=new Dp(this),this.activeTexture=new Op(this),this.viewport=new Sh(this),this.bindFramebuffer=new Yd(this),this.bindRenderbuffer=new Gd(this),this.bindTexture=new Ah(this),this.bindVertexBuffer=new Kd(this),this.bindElementBuffer=new ru(this),this.bindVertexArray=new Ea(this),this.pixelStoreUnpack=new Eh(this),this.pixelStoreUnpackPremultiplyAlpha=new Ch(this),this.pixelStoreUnpackFlipY=new Rh(this),this.extTextureFilterAnisotropic=r.getExtension("EXT_texture_filter_anisotropic")||r.getExtension("MOZ_EXT_texture_filter_anisotropic")||r.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=r.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=r.getParameter(r.MAX_TEXTURE_SIZE),fa(r)){this.HALF_FLOAT=r.HALF_FLOAT;const y=r.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(f=r.RGBA16F)!==null&&f!==void 0?f:y==null?void 0:y.RGBA16F_EXT,this.RGB16F=(_=r.RGB16F)!==null&&_!==void 0?_:y==null?void 0:y.RGB16F_EXT,r.getExtension("EXT_color_buffer_float")}else{r.getExtension("EXT_color_buffer_half_float"),r.getExtension("OES_texture_half_float_linear");const y=r.getExtension("OES_texture_half_float");this.HALF_FLOAT=y==null?void 0:y.HALF_FLOAT_OES}}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(r,f){return new kr(this,r,f)}createVertexBuffer(r,f,_){return new Eo(this,r,f,_)}createRenderbuffer(r,f,_){const y=this.gl,x=y.createRenderbuffer();return this.bindRenderbuffer.set(x),y.renderbufferStorage(y.RENDERBUFFER,r,f,_),this.bindRenderbuffer.set(null),x}createFramebuffer(r,f,_,y){return new Qd(this,r,f,_,y)}clear({color:r,depth:f,stencil:_}){const y=this.gl;let x=0;r&&(x|=y.COLOR_BUFFER_BIT,this.clearColor.set(r),this.colorMask.set([!0,!0,!0,!0])),f!==void 0&&(x|=y.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(f),this.depthMask.set(!0)),_!==void 0&&(x|=y.STENCIL_BUFFER_BIT,this.clearStencil.set(_),this.stencilMask.set(255)),y.clear(x)}setCullFace(r){r.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(r.mode),this.frontFace.set(r.frontFace))}setDepthMode(r){r.func!==this.gl.ALWAYS||r.mask?(this.depthTest.set(!0),this.depthFunc.set(r.func),this.depthMask.set(r.mask),this.depthRange.set(r.range)):this.depthTest.set(!1)}setStencilMode(r){r.test.func!==this.gl.ALWAYS||r.mask?(this.stencilTest.set(!0),this.stencilMask.set(r.mask),this.stencilOp.set([r.fail,r.depthFail,r.pass]),this.stencilFunc.set({func:r.test.func,ref:r.ref,mask:r.test.mask})):this.stencilTest.set(!1)}setColorMode(r){h.aE(r.blendFunction,Nn.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(r.blendFunction),this.blendColor.set(r.blendColor)),this.colorMask.set(r.mask)}createVertexArray(){var r;return fa(this.gl)?this.gl.createVertexArray():(r=this.gl.getExtension("OES_vertex_array_object"))===null||r===void 0?void 0:r.createVertexArrayOES()}deleteVertexArray(r){var f;return fa(this.gl)?this.gl.deleteVertexArray(r):(f=this.gl.getExtension("OES_vertex_array_object"))===null||f===void 0?void 0:f.deleteVertexArrayOES(r)}unbindVAO(){this.bindVertexArray.set(null)}}class bi{constructor(r,f,_){this.func=r,this.mask=f,this.range=_}}bi.ReadOnly=!1,bi.ReadWrite=!0,bi.disabled=new bi(519,bi.ReadOnly,[0,1]);const Ca=7680;class fn{constructor(r,f,_,y,x,M){this.test=r,this.ref=f,this.mask=_,this.fail=y,this.depthFail=x,this.pass=M}}fn.disabled=new fn({func:519,mask:0},0,0,Ca,Ca,Ca);class en{constructor(r,f,_){this.enable=r,this.mode=f,this.frontFace=_}}let Io;function ml(w,r,f,_,y){const x=w.context,M=x.gl,D=w.useProgram("collisionBox"),O=[];let L=0,$=0;for(let ge=0;ge<_.length;ge++){const be=_[ge],le=r.getTile(be).getBucket(f);if(!le)continue;const Ce=y?le.textCollisionBox:le.iconCollisionBox,Ie=le.collisionCircleArray;
vendor: 22,489 bytes, line 628
628if(Ie.length>0){const ze=h.H();h.aQ(ze,le.placementInvProjMatrix,w.transform.glCoordMatrix),h.aQ(ze,ze,le.placementViewportMatrix),O.push({circleArray:Ie,circleOffset:$,transform:be.posMatrix,invTransform:ze,coord:be}),L+=Ie.length/4,$=L}Ce&&D.draw(x,M.LINES,bi.disabled,fn.disabled,w.colorModeForRenderPass(),en.disabled,{u_matrix:be.posMatrix,u_pixel_extrude_scale:[1/(H=w.transform).width,1/H.height]},w.style.map.terrain&&w.style.map.terrain.getTerrainData(be),f.id,Ce.layoutVertexBuffer,Ce.indexBuffer,Ce.segments,null,w.transform.zoom,null,null,Ce.collisionVertexBuffer)}var H;if(!y||!O.length)return;const G=w.useProgram("collisionCircle"),ee=new h.aR;ee.resize(4*L),ee._trim();let ne=0;for(const ge of O)for(let be=0;be<ge.circleArray.length/4;be++){const le=4*be,Ce=ge.circleArray[le+0],Ie=ge.circleArray[le+1],ze=ge.circleArray[le+2],Ge=ge.circleArray[le+3];ee.emplace(ne++,Ce,Ie,ze,Ge,0),ee.emplace(ne++,Ce,Ie,ze,Ge,1),ee.emplace(ne++,Ce,Ie,ze,Ge,2),ee.emplace(ne++,Ce,Ie,ze,Ge,3)}(!Io||Io.length<2*L)&&(Io=(function(ge){const be=2*ge,le=new h.aT;le.resize(be),le._trim();for(let Ce=0;Ce<be;Ce++){const Ie=6*Ce;le.uint16[Ie+0]=4*Ce+0,le.uint16[Ie+1]=4*Ce+1,le.uint16[Ie+2]=4*Ce+2,le.uint16[Ie+3]=4*Ce+2,le.uint16[Ie+4]=4*Ce+3,le.uint16[Ie+5]=4*Ce+0}return le})(L));const he=x.createIndexBuffer(Io,!0),pe=x.createVertexBuffer(ee,h.aS.members,!0);for(const ge of O){const be=Xr(ge.transform,ge.invTransform,w.transform);G.draw(x,M.TRIANGLES,bi.disabled,fn.disabled,w.colorModeForRenderPass(),en.disabled,be,w.style.map.terrain&&w.style.map.terrain.getTerrainData(ge.coord),f.id,pe,he,h.a0.simpleSegment(0,2*ge.circleOffset,ge.circleArray.length,ge.circleArray.length/2),null,w.transform.zoom,null,null,null)}pe.destroy(),he.destroy()}en.disabled=new en(!1,1029,2305),en.backCCW=new en(!0,1029,2305);const gl=h.an(new Float32Array(16));function Do(w,r,f,_,y,x){const{horizontalAlign:M,verticalAlign:D}=h.au(w);return new h.P((-(M-.5)*r/y+_[0])*x,(-(D-.5)*f/y+_[1])*x)}function Zs(w,r,f,_,y,x){const M=r.tileAnchorPoint.add(new h.P(r.translation[0],r.translation[1]));if(r.pitchWithMap){let D=_.mult(x);f||(D=D.rotate(-y));const O=M.add(D);return de(O.x,O.y,r.labelPlaneMatrix,r.getElevation).point}if(f){const D=qe(r.tileAnchorPoint.x+1,r.tileAnchorPoint.y,r).point.sub(w),O=Math.atan(D.y/D.x)+(D.x<0?Math.PI:0);return w.add(_.rotate(O))}return w.add(_)}function _l(w,r,f,_,y,x,M,D,O,L,$,H,G,ee){const ne=w.text.placedSymbolArray,he=w.text.dynamicLayoutVertexArray,pe=w.icon.dynamicLayoutVertexArray,ge={};he.clear();for(let be=0;be<ne.length;be++){const le=ne.get(be),Ce=le.hidden||!le.crossTileID||w.allowVerticalPlacement&&!le.placedOrientation?null:_[le.crossTileID];if(Ce){const Ie=new h.P(le.anchorX,le.anchorY),ze={getElevation:ee,width:y.width,height:y.height,labelPlaneMatrix:x,pitchWithMap:f,projection:$,tileAnchorPoint:Ie,translation:H,unwrappedTileID:G},Ge=f?de(Ie.x,Ie.y,M,ee):qe(Ie.x,Ie.y,ze),dt=q(y.cameraToCenterDistance,Ge.signedDistanceFromCamera);let vt=h.ai(w.textSizeData,O,le)*dt/h.ap;f&&(vt*=w.tilePixelRatio/D);const{width:Mt,height:xt,anchor:ft,textOffset:Ot,textBoxScale:ni}=Ce,wt=Do(ft,Mt,xt,Ot,ni,vt),Ct=$.getPitchedTextCorrection(y,Ie.add(new h.P(H[0],H[1])),G),Qt=Zs(Ge.point,ze,r,wt,y.angle,Ct),Ki=w.allowVerticalPlacement&&le.placedOrientation===h.ah.vertical?Math.PI/2:0;for(let mi=0;mi<le.numGlyphs;mi++)h.aj(he,Qt,Ki);L&&le.associatedIconIndex>=0&&(ge[le.associatedIconIndex]={shiftedAnchor:Qt,angle:Ki})}else Xt(le.numGlyphs,he)}if(L){pe.clear();const be=w.icon.placedSymbolArray;for(let le=0;le<be.length;le++){const Ce=be.get(le);if(Ce.hidden)Xt(Ce.numGlyphs,pe);else{const Ie=ge[le];if(Ie)for(let ze=0;ze<Ce.numGlyphs;ze++)h.aj(pe,Ie.shiftedAnchor,Ie.angle);else Xt(Ce.numGlyphs,pe)}}w.icon.dynamicLayoutVertexBuffer.updateData(pe)}w.text.dynamicLayoutVertexBuffer.updateData(he)}function qr(w,r,f){return f.iconsInText&&r?"symbolTextAndIcon":w?"symbolSDF":"symbolIcon"}function au(w,r,f,_,y,x,M,D,O,L,$,H){const G=w.context,ee=G.gl,ne=w.transform,he=xo(),pe=D==="map",ge=O==="map",be=D!=="viewport"&&f.layout.get("symbol-placement")!=="point",le=pe&&!ge&&!be,Ce=!ge&&be,Ie=!f.layout.get("symbol-sort-key").isConstant();let ze=!1;const Ge=w.depthModeForSublayer(0,bi.ReadOnly),dt=f._unevaluatedLayout.hasValue("text-variable-anchor")||f._unevaluatedLayout.hasValue("text-variable-anchor-offset"),vt=[],Mt=he.getCircleRadiusCorrection(ne);for(const xt of _){const ft=r.getTile(xt),Ot=ft.getBucket(f);if(!Ot)continue;const ni=y?Ot.text:Ot.icon;if(!ni||!ni.segments.get().length||!ni.hasVisibleVertices)continue;const wt=ni.programConfigurations.get(f.id),Ct=y||Ot.sdfIcons,Qt=y?Ot.textSizeData:Ot.iconSizeData,Ki=ge||ne.pitch!==0,mi=w.useProgram(qr(Ct,y,Ot),wt),Si=h.ag(Qt,ne.zoom),Zi=w.style.map.terrain&&w.style.map.terrain.getTerrainData(xt);let fr,Ds,an,Lr,pn=[0,0],mn=null;if(y)Ds=ft.glyphAtlasTexture,an=ee.LINEAR,fr=ft.glyphAtlasTexture.size,Ot.iconsInText&&(pn=ft.imageAtlasTexture.size,mn=ft.imageAtlasTexture,Lr=Ki||w.options.rotating||w.options.zooming||Qt.kind==="composite"||Qt.kind==="camera"?ee.LINEAR:ee.NEAREST);else{const wi=f.layout.get("icon-size").constantOr(0)!==1||Ot.iconsNeedLinear;Ds=ft.imageAtlasTexture,an=Ct||w.options.rotating||w.options.zooming||wi||Ki?ee.LINEAR:ee.NEAREST,fr=ft.imageAtlasTexture.size}const Xn=gi(ft,1,w.transform.zoom),Os=Ce?xt.posMatrix:gl,$o=Xs(Os,ge,pe,w.transform,Xn),Qs=ps(Os,ge,pe,w.transform,Xn),gr=ps(xt.posMatrix,ge,pe,w.transform,Xn),Wi=he.translatePosition(w.transform,ft,x,M),Ho=dt&&Ot.hasTextData(),Js=f.layout.get("icon-text-fit")!=="none"&&Ho&&Ot.hasIconData();if(be){const wi=w.style.map.terrain?(Ml,_n)=>w.style.map.terrain.getElevation(xt,Ml,_n):null,ks=f.layout.get("text-rotation-alignment")==="map";ie(Ot,xt.posMatrix,w,y,$o,gr,ge,L,ks,he,xt.toUnwrapped(),ne.width,ne.height,Wi,wi)}const oi=xt.posMatrix,Mi=y&&dt||Js,gn=be||Mi?gl:$o,os=Qs,qn=Ct&&f.paint.get(y?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let Zn;Zn=Ct?Ot.iconsInText?fl(Qt.kind,Si,le,ge,be,Mi,w,oi,gn,os,Wi,fr,pn,Mt):dl(Qt.kind,Si,le,ge,be,Mi,w,oi,gn,os,Wi,y,fr,!0,Mt):uc(Qt.kind,Si,le,ge,be,Mi,w,oi,gn,os,Wi,y,fr,Mt);const Fr={program:mi,buffers:ni,uniformValues:Zn,atlasTexture:Ds,atlasTextureIcon:mn,atlasInterpolation:an,atlasInterpolationIcon:Lr,isSDF:Ct,hasHalo:qn};if(Ie&&Ot.canOverlap){ze=!0;const wi=ni.segments.get();for(const ks of wi)vt.push({segments:new h.a0([ks]),sortKey:ks.sortKey,state:Fr,terrainData:Zi})}else vt.push({segments:ni.segments,sortKey:0,state:Fr,terrainData:Zi})}ze&&vt.sort(((xt,ft)=>xt.sortKey-ft.sortKey));for(const xt of vt){const ft=xt.state;if(G.activeTexture.set(ee.TEXTURE0),ft.atlasTexture.bind(ft.atlasInterpolation,ee.CLAMP_TO_EDGE),ft.atlasTextureIcon&&(G.activeTexture.set(ee.TEXTURE1),ft.atlasTextureIcon&&ft.atlasTextureIcon.bind(ft.atlasInterpolationIcon,ee.CLAMP_TO_EDGE)),ft.isSDF){const Ot=ft.uniformValues;ft.hasHalo&&(Ot.u_is_halo=1,ou(ft.buffers,xt.segments,f,w,ft.program,Ge,$,H,Ot,xt.terrainData)),Ot.u_is_halo=0}ou(ft.buffers,xt.segments,f,w,ft.program,Ge,$,H,ft.uniformValues,xt.terrainData)}}function ou(w,r,f,_,y,x,M,D,O,L){const $=_.context;y.draw($,$.gl.TRIANGLES,x,M,D,en.disabled,O,L,f.id,w.layoutVertexBuffer,w.indexBuffer,r,f.paint,_.transform.zoom,w.programConfigurations.get(f.id),w.dynamicLayoutVertexBuffer,w.opacityVertexBuffer)}function dc(w,r,f,_){const y=w.context,x=y.gl,M=fn.disabled,D=new Nn([x.ONE,x.ONE],h.aM.transparent,[!0,!0,!0,!0]),O=r.getBucket(f);if(!O)return;const L=_.key;let $=f.heatmapFbos.get(L);$||($=yl(y,r.tileSize,r.tileSize),f.heatmapFbos.set(L,$)),y.bindFramebuffer.set($.framebuffer),y.viewport.set([0,0,r.tileSize,r.tileSize]),y.clear({color:h.aM.transparent});const H=O.programConfigurations.get(f.id),G=w.useProgram("heatmap",H),ee=w.style.map.terrain.getTerrainData(_);G.draw(y,x.TRIANGLES,bi.disabled,M,D,en.disabled,hr(_.posMatrix,r,w.transform.zoom,f.paint.get("heatmap-intensity")),ee,f.id,O.layoutVertexBuffer,O.indexBuffer,O.segments,f.paint,w.transform.zoom,H)}function Ra(w,r,f){const _=w.context,y=_.gl;_.setColorMode(w.colorModeForRenderPass());const x=vl(_,r),M=f.key,D=r.heatmapFbos.get(M);D&&(_.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,D.colorAttachment.get()),_.activeTexture.set(y.TEXTURE1),x.bind(y.LINEAR,y.CLAMP_TO_EDGE),w.useProgram("heatmapTexture").draw(_,y.TRIANGLES,bi.disabled,fn.disabled,w.colorModeForRenderPass(),en.disabled,Sa(w,r,0,1),null,r.id,w.rasterBoundsBuffer,w.quadTriangleIndexBuffer,w.rasterBoundsSegments,r.paint,w.transform.zoom),D.destroy(),r.heatmapFbos.delete(M))}function yl(w,r,f){var _,y;const x=w.gl,M=x.createTexture();x.bindTexture(x.TEXTURE_2D,M),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_S,x.CLAMP_TO_EDGE),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_WRAP_T,x.CLAMP_TO_EDGE),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_MIN_FILTER,x.LINEAR),x.texParameteri(x.TEXTURE_2D,x.TEXTURE_MAG_FILTER,x.LINEAR);const D=(_=w.HALF_FLOAT)!==null&&_!==void 0?_:x.UNSIGNED_BYTE,O=(y=w.RGBA16F)!==null&&y!==void 0?y:x.RGBA;x.texImage2D(x.TEXTURE_2D,0,O,r,f,0,x.RGBA,D,null);const L=w.createFramebuffer(r,f,!1,!1);return L.colorAttachment.set(M),L}function vl(w,r){return r.colorRampTexture||(r.colorRampTexture=new Qe(w,r.colorRamp,w.gl.RGBA)),r.colorRampTexture}function Oo(w,r,f,_,y){if(!f||!_||!_.imageAtlas)return;const x=_.imageAtlas.patternPositions;let M=x[f.to.toString()],D=x[f.from.toString()];if(!M&&D&&(M=D),!D&&M&&(D=M),!M||!D){const O=y.getPaintProperty(r);M=x[O],D=x[O]}M&&D&&w.setConstantPatternPositions(M,D)}function fc(w,r,f,_,y,x,M){const D=w.context.gl,O="fill-pattern",L=f.paint.get(O),$=L&&L.constantOr(1),H=f.getCrossfadeParameters();let G,ee,ne,he,pe;M?(ee=$&&!f.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",G=D.LINES):(ee=$?"fillPattern":"fill",G=D.TRIANGLES);const ge=L.constantOr(null);for(const be of _){const le=r.getTile(be);if($&&!le.patternsLoaded())continue;const Ce=le.getBucket(f);if(!Ce)continue;const Ie=Ce.programConfigurations.get(f.id),ze=w.useProgram(ee,Ie),Ge=w.style.map.terrain&&w.style.map.terrain.getTerrainData(be);$&&(w.context.activeTexture.set(D.TEXTURE0),le.imageAtlasTexture.bind(D.LINEAR,D.CLAMP_TO_EDGE),Ie.updatePaintBuffers(H)),Oo(Ie,O,ge,le,f);const dt=Ge?be:null,vt=w.translatePosMatrix(dt?dt.posMatrix:be.posMatrix,le,f.paint.get("fill-translate"),f.paint.get("fill-translate-anchor"));if(M){he=Ce.indexBuffer2,pe=Ce.segments2;const Mt=[D.drawingBufferWidth,D.drawingBufferHeight];ne=ee==="fillOutlinePattern"&&$?jd(vt,w,H,le,Mt):Rp(vt,Mt)}else he=Ce.indexBuffer,pe=Ce.segments,ne=$?Gc(vt,w,H,le):To(vt);ze.draw(w.context,G,y,w.stencilModeForClipping(be),x,en.disabled,ne,Ge,f.id,Ce.layoutVertexBuffer,he,pe,f.paint,w.transform.zoom,Ie)}}function lu(w,r,f,_,y,x,M){const D=w.context,O=D.gl,L="fill-extrusion-pattern",$=f.paint.get(L),H=$.constantOr(1),G=f.getCrossfadeParameters(),ee=f.paint.get("fill-extrusion-opacity"),ne=$.constantOr(null);for(const he of _){const pe=r.getTile(he),ge=pe.getBucket(f);if(!ge)continue;const be=w.style.map.terrain&&w.style.map.terrain.getTerrainData(he),le=ge.programConfigurations.get(f.id),Ce=w.useProgram(H?"fillExtrusionPattern":"fillExtrusion",le);H&&(w.context.activeTexture.set(O.TEXTURE0),pe.imageAtlasTexture.bind(O.LINEAR,O.CLAMP_TO_EDGE),le.updatePaintBuffers(G)),Oo(le,L,ne,pe,f);const Ie=w.translatePosMatrix(he.posMatrix,pe,f.paint.get("fill-extrusion-translate"),f.paint.get("fill-extrusion-translate-anchor")),ze=f.paint.get("fill-extrusion-vertical-gradient"),Ge=H?lc(Ie,w,ze,ee,he,G,pe):oc(Ie,w,ze,ee);Ce.draw(D,D.gl.TRIANGLES,y,x,M,en.backCCW,Ge,be,f.id,ge.layoutVertexBuffer,ge.indexBuffer,ge.segments,f.paint,w.transform.zoom,le,w.style.map.terrain&&ge.centroidVertexBuffer)}}function bl(w,r,f,_,y,x,M){const D=w.context,O=D.gl,L=f.fbo;if(!L)return;const $=w.useProgram("hillshade"),H=w.style.map.terrain&&w.style.map.terrain.getTerrainData(r);D.activeTexture.set(O.TEXTURE0),O.bindTexture(O.TEXTURE_2D,L.colorAttachment.get()),$.draw(D,O.TRIANGLES,y,x,M,en.disabled,((G,ee,ne,he)=>{const pe=ne.paint.get("hillshade-shadow-color"),ge=ne.paint.get("hillshade-highlight-color"),be=ne.paint.get("hillshade-accent-color");let le=ne.paint.get("hillshade-illumination-direction")*(Math.PI/180);ne.paint.get("hillshade-illumination-anchor")==="viewport"&&(le-=G.transform.angle);const Ce=!G.options.moving;return{u_matrix:he?he.posMatrix:G.transform.calculatePosMatrix(ee.tileID.toUnwrapped(),Ce),u_image:0,u_latrange:cc(0,ee.tileID),u_light:[ne.paint.get("hillshade-exaggeration"),le],u_shadow:pe,u_highlight:ge,u_accent:be}})(w,f,_,H?r:null),H,_.id,w.rasterBoundsBuffer,w.quadTriangleIndexBuffer,w.rasterBoundsSegments)}function xl(w,r,f,_,y,x){const M=w.context,D=M.gl,O=r.dem;if(O&&O.data){const L=O.dim,$=O.stride,H=O.getPixels();if(M.activeTexture.set(D.TEXTURE1),M.pixelStoreUnpackPremultiplyAlpha.set(!1),r.demTexture=r.demTexture||w.getTileTexture($),r.demTexture){const ee=r.demTexture;ee.update(H,{premultiply:!1}),ee.bind(D.NEAREST,D.CLAMP_TO_EDGE)}else r.demTexture=new Qe(M,H,D.RGBA,{premultiply:!1}),r.demTexture.bind(D.NEAREST,D.CLAMP_TO_EDGE);M.activeTexture.set(D.TEXTURE0);let G=r.fbo;if(!G){const ee=new Qe(M,{width:L,height:L,data:null},D.RGBA);ee.bind(D.LINEAR,D.CLAMP_TO_EDGE),G=r.fbo=M.createFramebuffer(L,L,!0,!1),G.colorAttachment.set(ee.texture)}M.bindFramebuffer.set(G.framebuffer),M.viewport.set([0,0,L,L]),w.useProgram("hillshadePrepare").draw(M,D.TRIANGLES,_,y,x,en.disabled,((ee,ne)=>{const he=ne.stride,pe=h.H();return h.aP(pe,0,h.X,-h.X,0,0,1),h.J(pe,pe,[0,-h.X,0]),{u_matrix:pe,u_image:1,u_dimension:[he,he],u_zoom:ee.overscaledZ,u_unpack:ne.getUnpackVector()}})(r.tileID,O),null,f.id,w.rasterBoundsBuffer,w.quadTriangleIndexBuffer,w.rasterBoundsSegments),r.needsHillshadePrepare=!1}}function ef(w,r,f,_,y,x){const M=_.paint.get("raster-fade-duration");if(!x&&M>0){const D=N.now(),O=(D-w.timeAdded)/M,L=r?(D-r.timeAdded)/M:-1,$=f.getSource(),H=y.coveringZoomLevel({tileSize:$.tileSize,roundZoom:$.roundZoom}),G=!r||Math.abs(r.tileID.overscaledZ-H)>Math.abs(w.tileID.overscaledZ-H),ee=G&&w.refreshedUponExpiration?1:h.ac(G?O:1-L,0,1);return w.refreshedUponExpiration&&O>=1&&(w.refreshedUponExpiration=!1),r?{opacity:1,mix:1-ee}:{opacity:ee,mix:0}}return{opacity:1,mix:0}}const Zr=new h.aM(1,0,0,1),Di=new h.aM(0,1,0,1),pc=new h.aM(0,0,1,1),tf=new h.aM(1,0,1,1),Mh=new h.aM(0,1,1,1);function ko(w,r,f,_){uu(w,0,r+f/2,w.transform.width,f,_)}function cu(w,r,f,_){uu(w,r-f/2,0,f,w.transform.height,_)}function uu(w,r,f,_,y,x){const M=w.context,D=M.gl;D.enable(D.SCISSOR_TEST),D.scissor(r*w.pixelRatio,f*w.pixelRatio,_*w.pixelRatio,y*w.pixelRatio),M.clear({color:x}),D.disable(D.SCISSOR_TEST)}function Bo(w,r,f){const _=w.context,y=_.gl,x=f.posMatrix,M=w.useProgram("debug"),D=bi.disabled,O=fn.disabled,L=w.colorModeForRenderPass(),$="$debug",H=w.style.map.terrain&&w.style.map.terrain.getTerrainData(f);_.activeTexture.set(y.TEXTURE0);const G=r.getTileByID(f.key).latestRawTileData,ee=Math.floor((G&&G.byteLength||0)/1024),ne=r.getTile(f).tileSize,he=512/Math.min(ne,512)*(f.overscaledZ/w.transform.zoom)*.5;let pe=f.canonical.toString();f.overscaledZ!==f.canonical.z&&(pe+=` => ${f.overscaledZ}`),(function(ge,be){ge.initDebugOverlayCanvas();const le=ge.debugOverlayCanvas,Ce=ge.context.gl,Ie=ge.debugOverlayCanvas.getContext("2d");Ie.clearRect(0,0,le.width,le.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(be,5,5),Ie.strokeText(be,5,5),ge.debugOverlayTexture.update(le),ge.debugOverlayTexture.bind(Ce.LINEAR,Ce.CLAMP_TO_EDGE)})(w,`${pe} ${ee}kB`),M.draw(_,y.TRIANGLES,D,O,Nn.alphaBlended,en.disabled,So(x,h.aM.transparent,he),null,$,w.debugBuffer,w.quadTriangleIndexBuffer,w.debugSegments),M.draw(_,y.LINE_STRIP,D,O,L,en.disabled,So(x,h.aM.red),H,$,w.debugBuffer,w.tileBorderIndexBuffer,w.debugSegments)}function hu(w,r,f){const _=w.context,y=_.gl,x=w.colorModeForRenderPass(),M=new bi(y.LEQUAL,bi.ReadWrite,w.depthRangeFor3D),D=w.useProgram("terrain"),O=r.getTerrainMesh();_.bindFramebuffer.set(null),_.viewport.set([0,0,w.width,w.height]);for(const L of f){const $=w.renderToTexture.getTexture(L),H=r.getTerrainData(L.tileID);_.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,$.texture);const G=w.transform.calculatePosMatrix(L.tileID.toUnwrapped()),ee=r.getMeshFrameDelta(w.transform.zoom),ne=w.transform.calculateFogMatrix(L.tileID.toUnwrapped()),he=Ga(G,ee,ne,w.style.sky,w.transform.pitch);D.draw(_,y.TRIANGLES,M,fn.disabled,x,en.backCCW,he,H,"terrain",O.vertexBuffer,O.indexBuffer,O.segments)}}class eo{constructor(r,f,_){this.vertexBuffer=r,this.indexBuffer=f,this.segments=_}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}class wl{constructor(r,f){this.context=new Jd(r),this.transform=f,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:h.an(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Wt.maxUnderzooming+Wt.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new sc}resize(r,f,_){if(this.width=Math.floor(r*_),this.height=Math.floor(f*_),this.pixelRatio=_,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const y of this.style._order)this.style._layers[y].resize()}setup(){const r=this.context,f=new h.aX;f.emplaceBack(0,0),f.emplaceBack(h.X,0),f.emplaceBack(0,h.X),f.emplaceBack(h.X,h.X),this.tileExtentBuffer=r.createVertexBuffer(f,mr.members),this.tileExtentSegments=h.a0.simpleSegment(0,0,4,2);const _=new h.aX;_.emplaceBack(0,0),_.emplaceBack(h.X,0),_.emplaceBack(0,h.X),_.emplaceBack(h.X,h.X),this.debugBuffer=r.createVertexBuffer(_,mr.members),this.debugSegments=h.a0.simpleSegment(0,0,4,5);const y=new h.$;y.emplaceBack(0,0,0,0),y.emplaceBack(h.X,0,h.X,0),y.emplaceBack(0,h.X,0,h.X),y.emplaceBack(h.X,h.X,h.X,h.X),this.rasterBoundsBuffer=r.createVertexBuffer(y,or.members),this.rasterBoundsSegments=h.a0.simpleSegment(0,0,4,2);const x=new h.aX;x.emplaceBack(0,0),x.emplaceBack(1,0),x.emplaceBack(0,1),x.emplaceBack(1,1),this.viewportBuffer=r.createVertexBuffer(x,mr.members),this.viewportSegments=h.a0.simpleSegment(0,0,4,2);const M=new h.aZ;M.emplaceBack(0),M.emplaceBack(1),M.emplaceBack(3),M.emplaceBack(2),M.emplaceBack(0),this.tileBorderIndexBuffer=r.createIndexBuffer(M);const D=new h.aY;D.emplaceBack(0,1,2),D.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=r.createIndexBuffer(D);const O=this.context.gl;this.stencilClearMode=new fn({func:O.ALWAYS,mask:0},0,255,O.ZERO,O.ZERO,O.ZERO)}clearStencil(){const r=this.context,f=r.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const _=h.H();h.aP(_,0,this.width,this.height,0,0,1),h.K(_,_,[f.drawingBufferWidth,f.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(r,f.TRIANGLES,bi.disabled,this.stencilClearMode,Nn.disabled,en.disabled,Dr(_),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(r,f){if(this.currentStencilSource===r.source||!r.isTileClipped()||!f||!f.length)return;this.currentStencilSource=r.source;const _=this.context,y=_.gl;this.nextStencilID+f.length>256&&this.clearStencil(),_.setColorMode(Nn.disabled),_.setDepthMode(bi.disabled);const x=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const M of f){const D=this._tileClippingMaskIDs[M.key]=this.nextStencilID++,O=this.style.map.terrain&&this.style.map.terrain.getTerrainData(M);x.draw(_,y.TRIANGLES,bi.disabled,new fn({func:y.ALWAYS,mask:0},D,255,y.KEEP,y.KEEP,y.REPLACE),Nn.disabled,en.disabled,Dr(M.posMatrix),O,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const r=this.nextStencilID++,f=this.context.gl;return new fn({func:f.NOTEQUAL,mask:255},r,255,f.KEEP,f.KEEP,f.REPLACE)}stencilModeForClipping(r){const f=this.context.gl;return new fn({func:f.EQUAL,mask:255},this._tileClippingMaskIDs[r.key],0,f.KEEP,f.KEEP,f.REPLACE)}stencilConfigForOverlap(r){const f=this.context.gl,_=r.sort(((M,D)=>D.overscaledZ-M.overscaledZ)),y=_[_.length-1].overscaledZ,x=_[0].overscaledZ-y+1;if(x>1){this.currentStencilSource=void 0,this.nextStencilID+x>256&&this.clearStencil();const M={};for(let D=0;D<x;D++)M[D+y]=new fn({func:f.GEQUAL,mask:255},D+this.nextStencilID,255,f.KEEP,f.KEEP,f.REPLACE);return this.nextStencilID+=x,[M,_]}return[{[y]:fn.disabled},_]}colorModeForRenderPass(){const r=this.context.gl;return this._showOverdrawInspector?new Nn([r.CONSTANT_COLOR,r.ONE],new h.aM(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Nn.unblended:Nn.alphaBlended}depthModeForSublayer(r,f,_){if(!this.opaquePassEnabledForLayer())return bi.disabled;const y=1-((1+this.currentLayer)*this.numSublayers+r)*this.depthEpsilon;return new bi(_||this.context.gl.LEQUAL,f,[y,y])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(r,f){this.style=r,this.options=f,this.lineAtlas=r.lineAtlas,this.imageManager=r.imageManager,this.glyphManager=r.glyphManager,this.symbolFadeChange=r.placement.symbolFadeChange(N.now()),this.imageManager.beginFrame();const _=this.style._order,y=this.style.sourceCaches,x={},M={},D={};for(const O in y){const L=y[O];L.used&&L.prepare(this.context),x[O]=L.getVisibleCoordinates(),M[O]=x[O].slice().reverse(),D[O]=L.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let O=0;O<_.length;O++)if(this.style._layers[_[O]].is3D()){this.opaquePassCutoff=O;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const O of _){const L=this.style._layers[O];if(!L.hasOffscreenPass()||L.isHidden(this.transform.zoom))continue;const $=M[L.source];(L.type==="custom"||$.length)&&this.renderLayer(this,y[L.source],L,$)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:f.showOverdrawInspector?h.aM.black:h.aM.transparent,depth:1}),this.clearStencil(),this.style.sky&&(function(O,L){const $=O.context,H=$.gl,G=((ge,be,le)=>({u_sky_color:ge.properties.get("sky-color"),u_horizon_color:ge.properties.get("horizon-color"),u_horizon:(be.height/2+be.getHorizon())*le,u_sky_horizon_blend:ge.properties.get("sky-horizon-blend")*be.height/2*le}))(L,O.style.map.transform,O.pixelRatio),ee=new bi(H.LEQUAL,bi.ReadWrite,[0,1]),ne=fn.disabled,he=O.colorModeForRenderPass(),pe=O.useProgram("sky");
vendor: 9,029 bytes, line 628
628if(!L.mesh){const ge=new h.aX;ge.emplaceBack(-1,-1),ge.emplaceBack(1,-1),ge.emplaceBack(1,1),ge.emplaceBack(-1,1);const be=new h.aY;be.emplaceBack(0,1,2),be.emplaceBack(0,2,3),L.mesh=new eo($.createVertexBuffer(ge,mr.members),$.createIndexBuffer(be),h.a0.simpleSegment(0,0,ge.length,be.length))}pe.draw($,H.TRIANGLES,ee,ne,he,en.disabled,G,void 0,"sky",L.mesh.vertexBuffer,L.mesh.indexBuffer,L.mesh.segments)})(this,this.style.sky),this._showOverdrawInspector=f.showOverdrawInspector,this.depthRangeFor3D=[0,1-(r._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=_.length-1;this.currentLayer>=0;this.currentLayer--){const O=this.style._layers[_[this.currentLayer]],L=y[O.source],$=x[O.source];this._renderTileClippingMasks(O,$),this.renderLayer(this,L,O,$)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<_.length;this.currentLayer++){const O=this.style._layers[_[this.currentLayer]],L=y[O.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(O))continue;const $=(O.type==="symbol"?D:M)[O.source];this._renderTileClippingMasks(O,x[O.source]),this.renderLayer(this,L,O,$)}if(this.options.showTileBoundaries){const O=(function(L,$){let H=null;const G=Object.values(L._layers).flatMap((pe=>pe.source&&!pe.isHidden($)?[L.sourceCaches[pe.source]]:[])),ee=G.filter((pe=>pe.getSource().type==="vector")),ne=G.filter((pe=>pe.getSource().type!=="vector")),he=pe=>{(!H||H.getSource().maxzoom<pe.getSource().maxzoom)&&(H=pe)};return ee.forEach((pe=>he(pe))),H||ne.forEach((pe=>he(pe))),H})(this.style,this.transform.zoom);O&&(function(L,$,H){for(let G=0;G<H.length;G++)Bo(L,$,H[G])})(this,O,O.getVisibleCoordinates())}this.options.showPadding&&(function(O){const L=O.transform.padding;ko(O,O.transform.height-(L.top||0),3,Zr),ko(O,L.bottom||0,3,Di),cu(O,L.left||0,3,pc),cu(O,O.transform.width-(L.right||0),3,tf);const $=O.transform.centerPoint;(function(H,G,ee,ne){uu(H,G-1,ee-10,2,20,ne),uu(H,G-10,ee-1,20,2,ne)})(O,$.x,O.transform.height-$.y,Mh)})(this),this.context.setDefault()}maybeDrawDepthAndCoords(r){if(!this.style||!this.style.map||!this.style.map.terrain)return;const f=this.terrainFacilitator.matrix,_=this.transform.modelViewProjectionMatrix;let y=this.terrainFacilitator.dirty;y||(y=r?!h.a_(f,_):!h.a$(f,_)),y||(y=this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime).length>0),y&&(h.b0(f,_),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,(function(x,M){const D=x.context,O=D.gl,L=Nn.unblended,$=new bi(O.LEQUAL,bi.ReadWrite,[0,1]),H=M.getTerrainMesh(),G=M.sourceCache.getRenderableTiles(),ee=x.useProgram("terrainDepth");D.bindFramebuffer.set(M.getFramebuffer("depth").framebuffer),D.viewport.set([0,0,x.width/devicePixelRatio,x.height/devicePixelRatio]),D.clear({color:h.aM.transparent,depth:1});for(const ne of G){const he=M.getTerrainData(ne.tileID),pe={u_matrix:x.transform.calculatePosMatrix(ne.tileID.toUnwrapped()),u_ele_delta:M.getMeshFrameDelta(x.transform.zoom)};ee.draw(D,O.TRIANGLES,$,fn.disabled,L,en.backCCW,pe,he,"terrain",H.vertexBuffer,H.indexBuffer,H.segments)}D.bindFramebuffer.set(null),D.viewport.set([0,0,x.width,x.height])})(this,this.style.map.terrain),(function(x,M){const D=x.context,O=D.gl,L=Nn.unblended,$=new bi(O.LEQUAL,bi.ReadWrite,[0,1]),H=M.getTerrainMesh(),G=M.getCoordsTexture(),ee=M.sourceCache.getRenderableTiles(),ne=x.useProgram("terrainCoords");D.bindFramebuffer.set(M.getFramebuffer("coords").framebuffer),D.viewport.set([0,0,x.width/devicePixelRatio,x.height/devicePixelRatio]),D.clear({color:h.aM.transparent,depth:1}),M.coordsIndex=[];for(const he of ee){const pe=M.getTerrainData(he.tileID);D.activeTexture.set(O.TEXTURE0),O.bindTexture(O.TEXTURE_2D,G.texture);const ge={u_matrix:x.transform.calculatePosMatrix(he.tileID.toUnwrapped()),u_terrain_coords_id:(255-M.coordsIndex.length)/255,u_texture:0,u_ele_delta:M.getMeshFrameDelta(x.transform.zoom)};ne.draw(D,O.TRIANGLES,$,fn.disabled,L,en.backCCW,ge,pe,"terrain",H.vertexBuffer,H.indexBuffer,H.segments),M.coordsIndex.push(he.tileID.key)}D.bindFramebuffer.set(null),D.viewport.set([0,0,x.width,x.height])})(this,this.style.map.terrain))}renderLayer(r,f,_,y){if(!_.isHidden(this.transform.zoom)&&(_.type==="background"||_.type==="custom"||(y||[]).length))switch(this.id=_.id,_.type){case"symbol":(function(x,M,D,O,L){if(x.renderPass!=="translucent")return;const $=fn.disabled,H=x.colorModeForRenderPass();(D._unevaluatedLayout.hasValue("text-variable-anchor")||D._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&(function(G,ee,ne,he,pe,ge,be,le,Ce){const Ie=ee.transform,ze=xo(),Ge=pe==="map",dt=ge==="map";for(const vt of G){const Mt=he.getTile(vt),xt=Mt.getBucket(ne);if(!xt||!xt.text||!xt.text.segments.get().length)continue;const ft=h.ag(xt.textSizeData,Ie.zoom),Ot=gi(Mt,1,ee.transform.zoom),ni=Xs(vt.posMatrix,dt,Ge,ee.transform,Ot),wt=ne.layout.get("icon-text-fit")!=="none"&&xt.hasIconData();if(ft){const Ct=Math.pow(2,Ie.zoom-Mt.tileID.overscaledZ),Qt=ee.style.map.terrain?(mi,Si)=>ee.style.map.terrain.getElevation(vt,mi,Si):null,Ki=ze.translatePosition(Ie,Mt,be,le);_l(xt,Ge,dt,Ce,Ie,ni,vt.posMatrix,Ct,ft,wt,ze,Ki,vt.toUnwrapped(),Qt)}}})(O,x,D,M,D.layout.get("text-rotation-alignment"),D.layout.get("text-pitch-alignment"),D.paint.get("text-translate"),D.paint.get("text-translate-anchor"),L),D.paint.get("icon-opacity").constantOr(1)!==0&&au(x,M,D,O,!1,D.paint.get("icon-translate"),D.paint.get("icon-translate-anchor"),D.layout.get("icon-rotation-alignment"),D.layout.get("icon-pitch-alignment"),D.layout.get("icon-keep-upright"),$,H),D.paint.get("text-opacity").constantOr(1)!==0&&au(x,M,D,O,!0,D.paint.get("text-translate"),D.paint.get("text-translate-anchor"),D.layout.get("text-rotation-alignment"),D.layout.get("text-pitch-alignment"),D.layout.get("text-keep-upright"),$,H),M.map.showCollisionBoxes&&(ml(x,M,D,O,!0),ml(x,M,D,O,!1))})(r,f,_,y,this.style.placement.variableOffsets);break;case"circle":(function(x,M,D,O){if(x.renderPass!=="translucent")return;const L=D.paint.get("circle-opacity"),$=D.paint.get("circle-stroke-width"),H=D.paint.get("circle-stroke-opacity"),G=!D.layout.get("circle-sort-key").isConstant();if(L.constantOr(1)===0&&($.constantOr(1)===0||H.constantOr(1)===0))return;const ee=x.context,ne=ee.gl,he=x.depthModeForSublayer(0,bi.ReadOnly),pe=fn.disabled,ge=x.colorModeForRenderPass(),be=[];for(let le=0;le<O.length;le++){const Ce=O[le],Ie=M.getTile(Ce),ze=Ie.getBucket(D);if(!ze)continue;const Ge=ze.programConfigurations.get(D.id),dt=x.useProgram("circle",Ge),vt=ze.layoutVertexBuffer,Mt=ze.indexBuffer,xt=x.style.map.terrain&&x.style.map.terrain.getTerrainData(Ce),ft={programConfiguration:Ge,program:dt,layoutVertexBuffer:vt,indexBuffer:Mt,uniformValues:Kc(x,Ce,Ie,D),terrainData:xt};if(G){const Ot=ze.segments.get();for(const ni of Ot)be.push({segments:new h.a0([ni]),sortKey:ni.sortKey,state:ft})}else be.push({segments:ze.segments,sortKey:0,state:ft})}G&&be.sort(((le,Ce)=>le.sortKey-Ce.sortKey));for(const le of be){const{programConfiguration:Ce,program:Ie,layoutVertexBuffer:ze,indexBuffer:Ge,uniformValues:dt,terrainData:vt}=le.state;Ie.draw(ee,ne.TRIANGLES,he,pe,ge,en.disabled,dt,vt,D.id,ze,Ge,le.segments,D.paint,x.transform.zoom,Ce)}})(r,f,_,y);break;case"heatmap":(function(x,M,D,O){if(D.paint.get("heatmap-opacity")===0)return;const L=x.context;if(x.style.map.terrain){for(const $ of O){const H=M.getTile($);M.hasRenderableParent($)||(x.renderPass==="offscreen"?dc(x,H,D,$):x.renderPass==="translucent"&&Ra(x,D,$))}L.viewport.set([0,0,x.width,x.height])}else x.renderPass==="offscreen"?(function($,H,G,ee){const ne=$.context,he=ne.gl,pe=fn.disabled,ge=new Nn([he.ONE,he.ONE],h.aM.transparent,[!0,!0,!0,!0]);(function(be,le,Ce){const Ie=be.gl;be.activeTexture.set(Ie.TEXTURE1),be.viewport.set([0,0,le.width/4,le.height/4]);let ze=Ce.heatmapFbos.get(h.aU);ze?(Ie.bindTexture(Ie.TEXTURE_2D,ze.colorAttachment.get()),be.bindFramebuffer.set(ze.framebuffer)):(ze=yl(be,le.width/4,le.height/4),Ce.heatmapFbos.set(h.aU,ze))})(ne,$,G),ne.clear({color:h.aM.transparent});for(let be=0;be<ee.length;be++){const le=ee[be];if(H.hasRenderableParent(le))continue;const Ce=H.getTile(le),Ie=Ce.getBucket(G);if(!Ie)continue;const ze=Ie.programConfigurations.get(G.id),Ge=$.useProgram("heatmap",ze),{zoom:dt}=$.transform;Ge.draw(ne,he.TRIANGLES,bi.disabled,pe,ge,en.disabled,hr(le.posMatrix,Ce,dt,G.paint.get("heatmap-intensity")),null,G.id,Ie.layoutVertexBuffer,Ie.indexBuffer,Ie.segments,G.paint,$.transform.zoom,ze)}ne.viewport.set([0,0,$.width,$.height])})(x,M,D,O):x.renderPass==="translucent"&&(function($,H){const G=$.context,ee=G.gl;G.setColorMode($.colorModeForRenderPass());const ne=H.heatmapFbos.get(h.aU);ne&&(G.activeTexture.set(ee.TEXTURE0),ee.bindTexture(ee.TEXTURE_2D,ne.colorAttachment.get()),G.activeTexture.set(ee.TEXTURE1),vl(G,H).bind(ee.LINEAR,ee.CLAMP_TO_EDGE),$.useProgram("heatmapTexture").draw(G,ee.TRIANGLES,bi.disabled,fn.disabled,$.colorModeForRenderPass(),en.disabled,Sa($,H,
6280,1),null,H.id,$.viewportBuffer,$.quadTriangleIndexBuffer,$.viewportSegments,H.paint,$.transform.zoom))})(x,D)})(r,f,_,y);break;case"line":(function(x,M,D,O){if(x.renderPass!=="translucent")return;const L=D.paint.get("line-opacity"),$=D.paint.get("line-width");if(L.constantOr(1)===0||$.constantOr(1)===0)return;const H=x.depthModeForSublayer(0,bi.ReadOnly),G=x.colorModeForRenderPass(),ee=D.paint.get("line-dasharray"),ne=D.paint.get("line-pattern"),he=ne.constantOr(1),pe=D.paint.get("line-gradient"),ge=D.getCrossfadeParameters(),be=he?"linePattern":ee?"lineSDF":pe?"lineGradient":"line",le=x.context,Ce=le.gl;let Ie=!0;for(const ze of O){const Ge=M.getTile(ze);if(he&&!Ge.patternsLoaded())continue;const dt=Ge.getBucket(D);if(!dt)continue;const vt=dt.programConfigurations.get(D.id),Mt=x.context.program.get(),xt=x.useProgram(be,vt),ft=Ie||xt.program!==Mt,Ot=x.style.map.terrain&&x.style.map.terrain.getTerrainData(ze),ni=ne.constantOr(null);if(ni&&Ge.imageAtlas){const Qt=Ge.imageAtlas,Ki=Qt.patternPositions[ni.to.toString()],mi=Qt.patternPositions[ni.from.toString()];Ki&&mi&&vt.setConstantPatternPositions(Ki,mi)}const wt=Ot?ze:null,Ct=he?da(x,Ge,D,ge,wt):ee?Aa(x,Ge,D,ee,ge,wt):pe?bh(x,Ge,D,dt.lineClipsArray.length,wt):ul(x,Ge,D,wt);if(he)le.activeTexture.set(Ce.TEXTURE0),Ge.imageAtlasTexture.bind(Ce.LINEAR,Ce.CLAMP_TO_EDGE),vt.updatePaintBuffers(ge);else if(ee&&(ft||x.lineAtlas.dirty))le.activeTexture.set(Ce.TEXTURE0),x.lineAtlas.bind(le);else if(pe){const Qt=dt.gradients[D.id];let Ki=Qt.texture;if(D.gradientVersion!==Qt.version){let mi=256;if(D.stepInterpolant){const Si=M.getSource().maxzoom,Zi=ze.canonical.z===Si?Math.ceil(1<<x.transform.maxZoom-ze.canonical.z):1;mi=h.ac(h.aV(dt.maxLineLength/h.X*1024*Zi),256,le.maxTextureSize)}Qt.gradient=h.aW({expression:D.gradientExpression(),evaluationKey:"lineProgress",resolution:mi,image:Qt.gradient||void 0,clips:dt.lineClipsArray}),Qt.texture?Qt.texture.update(Qt.gradient):Qt.texture=new Qe(le,Qt.gradient,Ce.RGBA),Qt.version=D.gradientVersion,Ki=Qt.texture}le.activeTexture.set(Ce.TEXTURE0),Ki.bind(D.stepInterpolant?Ce.NEAREST:Ce.LINEAR,Ce.CLAMP_TO_EDGE)}xt.draw(le,Ce.TRIANGLES,H,x.stencilModeForClipping(ze),G,en.disabled,Ct,Ot,D.id,dt.layoutVertexBuffer,dt.indexBuffer,dt.segments,D.paint,x.transform.zoom,vt,dt.layoutVertexBuffer2),Ie=!1}})(r,f,_,y);break;case"fill":(function(x,M,D,O){const L=D.paint.get("fill-color"),$=D.paint.get("fill-opacity");if($.constantOr(1)===0)return;const H=x.colorModeForRenderPass(),G=D.paint.get("fill-pattern"),ee=x.opaquePassEnabledForLayer()&&!G.constantOr(1)&&L.constantOr(h.aM.transparent).a===1&&$.constantOr(0)===1?"opaque":"translucent";if(x.renderPass===ee){const ne=x.depthModeForSublayer(1,x.renderPass==="opaque"?bi.ReadWrite:bi.ReadOnly);fc(x,M,D,O,ne,H,!1)}if(x.renderPass==="translucent"&&D.paint.get("fill-antialias")){const ne=x.depthModeForSublayer(D.getPaintProperty("fill-outline-color")?2:0,bi.ReadOnly);fc(x,M,D,O,ne,H,!0)}})(r,f,_,y);break;case"fill-extrusion":(function(x,M,D,O){const L=D.paint.get("fill-extrusion-opacity");if(L!==0&&x.renderPass==="translucent"){const $=new bi(x.context.gl.LEQUAL,bi.ReadWrite,x.depthRangeFor3D);if(L!==1||D.paint.get("fill-extrusion-pattern").constantOr(1))lu(x,M,D,O,$,fn.disabled,Nn.disabled),lu(x,M,D,O,$,x.stencilModeFor3D(),x.colorModeForRenderPass());else{const H=x.colorModeForRenderPass();lu(x,M,D,O,$,fn.disabled,H)}}})(r,f,_,y);break;case"hillshade":(function(x,M,D,O){if(x.renderPass!=="offscreen"&&x.renderPass!=="translucent")return;const L=x.context,$=x.depthModeForSublayer(0,bi.ReadOnly),H=x.colorModeForRenderPass(),[G,ee]=x.renderPass==="translucent"?x.stencilConfigForOverlap(O):[{},O];for(const ne of ee){const he=M.getTile(ne);he.needsHillshadePrepare!==void 0&&he.needsHillshadePrepare&&x.renderPass==="offscreen"?xl(x,he,D,$,fn.disabled,H):x.renderPass==="translucent"&&bl(x,ne,he,D,$,G[ne.overscaledZ],H)}L.viewport.set([0,0,x.width,x.height])})(r,f,_,y);break;case"raster":(function(x,M,D,O){if(x.renderPass!=="translucent"||D.paint.get("raster-opacity")===0||!O.length)return;const L=x.context,$=L.gl,H=M.getSource(),G=x.useProgram("raster"),ee=x.colorModeForRenderPass(),[ne,he]=H instanceof vn?[{},O]:x.stencilConfigForOverlap(O),pe=he[he.length-1].overscaledZ,ge=!x.options.moving;for(const be of he){const le=x.depthModeForSublayer(be.overscaledZ-pe,D.paint.get("raster-opacity")===1?bi.ReadWrite:bi.ReadOnly,$.LESS),Ce=M.getTile(be);Ce.registerFadeDuration(D.paint.get("raster-fade-duration"));const Ie=M.findLoadedParent(be,0),ze=M.findLoadedSibling(be),Ge=ef(Ce,Ie||ze||null,M,D,x.transform,x.style.map.terrain);let dt,vt;const Mt=D.paint.get("raster-resampling")==="nearest"?$.NEAREST:$.LINEAR;L.activeTexture.set($.TEXTURE0),Ce.texture.bind(Mt,$.CLAMP_TO_EDGE,$.LINEAR_MIPMAP_NEAREST),L.activeTexture.set($.TEXTURE1),Ie?(Ie.texture.bind(Mt,$.CLAMP_TO_EDGE,$.LINEAR_MIPMAP_NEAREST),dt=Math.pow(2,Ie.tileID.overscaledZ-Ce.tileID.overscaledZ
vendor: 29,949 bytes, line 628
628),vt=[Ce.tileID.canonical.x*dt%1,Ce.tileID.canonical.y*dt%1]):Ce.texture.bind(Mt,$.CLAMP_TO_EDGE,$.LINEAR_MIPMAP_NEAREST),Ce.texture.useMipmap&&L.extTextureFilterAnisotropic&&x.transform.pitch>20&&$.texParameterf($.TEXTURE_2D,L.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,L.extTextureFilterAnisotropicMax);const xt=x.style.map.terrain&&x.style.map.terrain.getTerrainData(be),ft=xt?be:null,Ot=ft?ft.posMatrix:x.transform.calculatePosMatrix(be.toUnwrapped(),ge),ni=Ka(Ot,vt||[0,0],dt||1,Ge,D);H instanceof vn?G.draw(L,$.TRIANGLES,le,fn.disabled,ee,en.disabled,ni,xt,D.id,H.boundsBuffer,x.quadTriangleIndexBuffer,H.boundsSegments):G.draw(L,$.TRIANGLES,le,ne[be.overscaledZ],ee,en.disabled,ni,xt,D.id,x.rasterBoundsBuffer,x.quadTriangleIndexBuffer,x.rasterBoundsSegments)}})(r,f,_,y);break;case"background":(function(x,M,D,O){const L=D.paint.get("background-color"),$=D.paint.get("background-opacity");if($===0)return;const H=x.context,G=H.gl,ee=x.transform,ne=ee.tileSize,he=D.paint.get("background-pattern");if(x.isPatternMissing(he))return;const pe=!he&&L.a===1&&$===1&&x.opaquePassEnabledForLayer()?"opaque":"translucent";if(x.renderPass!==pe)return;const ge=fn.disabled,be=x.depthModeForSublayer(0,pe==="opaque"?bi.ReadWrite:bi.ReadOnly),le=x.colorModeForRenderPass(),Ce=x.useProgram(he?"backgroundPattern":"background"),Ie=O||ee.coveringTiles({tileSize:ne,terrain:x.style.map.terrain});he&&(H.activeTexture.set(G.TEXTURE0),x.imageManager.bind(x.context));const ze=D.getCrossfadeParameters();for(const Ge of Ie){const dt=O?Ge.posMatrix:x.transform.calculatePosMatrix(Ge.toUnwrapped()),vt=he?Jc(dt,$,x,he,{tileID:Ge,tileSize:ne},ze):Ao(dt,$,L),Mt=x.style.map.terrain&&x.style.map.terrain.getTerrainData(Ge);Ce.draw(H,G.TRIANGLES,be,ge,le,en.disabled,vt,Mt,D.id,x.tileExtentBuffer,x.quadTriangleIndexBuffer,x.tileExtentSegments)}})(r,0,_,y);break;case"custom":(function(x,M,D){const O=x.context,L=D.implementation;if(x.renderPass==="offscreen"){const $=L.prerender;$&&(x.setCustomLayerDefaults(),O.setColorMode(x.colorModeForRenderPass()),$.call(L,O.gl,x.transform.customLayerMatrix()),O.setDirty(),x.setBaseState())}else if(x.renderPass==="translucent"){x.setCustomLayerDefaults(),O.setColorMode(x.colorModeForRenderPass()),O.setStencilMode(fn.disabled);const $=L.renderingMode==="3d"?new bi(x.context.gl.LEQUAL,bi.ReadWrite,x.depthRangeFor3D):x.depthModeForSublayer(0,bi.ReadOnly);O.setDepthMode($),L.render(O.gl,x.transform.customLayerMatrix(),{farZ:x.transform.farZ,nearZ:x.transform.nearZ,fov:x.transform._fov,modelViewProjectionMatrix:x.transform.modelViewProjectionMatrix,projectionMatrix:x.transform.projectionMatrix}),O.setDirty(),x.setBaseState(),O.bindFramebuffer.set(null)}})(r,0,_)}}translatePosMatrix(r,f,_,y,x){if(!_[0]&&!_[1])return r;const M=x?y==="map"?this.transform.angle:0:y==="viewport"?-this.transform.angle:0;if(M){const L=Math.sin(M),$=Math.cos(M);_=[_[0]*$-_[1]*L,_[0]*L+_[1]*$]}const D=[x?_[0]:gi(f,_[0],this.transform.zoom),x?_[1]:gi(f,_[1],this.transform.zoom),0],O=new Float32Array(16);return h.J(O,r,D),O}saveTileTexture(r){const f=this._tileTextures[r.size[0]];f?f.push(r):this._tileTextures[r.size[0]]=[r]}getTileTexture(r){const f=this._tileTextures[r];return f&&f.length>0?f.pop():null}isPatternMissing(r){if(!r)return!1;if(!r.from||!r.to)return!0;const f=this.imageManager.getPattern(r.from.toString()),_=this.imageManager.getPattern(r.to.toString());return!f||!_}useProgram(r,f){this.cache=this.cache||{};const _=r+(f?f.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[_]||(this.cache[_]=new Yc(this.context,ha[r],f,Or[r],this._showOverdrawInspector,this.style.map.terrain)),this.cache[_]}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 r=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(r.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new Qe(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:r,drawingBufferHeight:f}=this.context.gl;return this.width!==r||this.height!==f}}class No{constructor(r,f){this.points=r,this.planes=f}static fromInvProjectionMatrix(r,f,_){const y=Math.pow(2,_),x=[[-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((D=>{const O=1/(D=h.af([],D,r))[3]/f*y;return h.b1(D,D,[O,O,1/D[3],O])})),M=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((D=>{const O=(function(G,ee){var ne=ee[0],he=ee[1],pe=ee[2],ge=ne*ne+he*he+pe*pe;return ge>0&&(ge=1/Math.sqrt(ge)),G[0]=ee[0]*ge,G[1]=ee[1]*ge,G[2]=ee[2]*ge,G})([],(function(G,ee,ne){var he=ee[0],pe=ee[1],ge=ee[2],be=ne[0],le=ne[1],Ce=ne[2];return G[0]=pe*Ce-ge*le,G[1]=ge*be-he*Ce,G[2]=he*le-pe*be,G})([],Ee([],x[D[0]],x[D[1]]),Ee([],x[D[2]],x[D[1]]))),L=-(($=O)[0]*(H=x[D[1]])[0]+$[1]*H[1]+$[2]*H[2]);var $,H;return O.concat(L)}));return new No(x,M)}}class Rs{constructor(r,f){this.min=r,this.max=f,this.center=(function(_,y,x){return _[0]=.5*y[0],_[1]=.5*y[1],_[2]=.5*y[2],_})([],(function(_,y,x){return _[0]=y[0]+x[0],_[1]=y[1]+x[1],_[2]=y[2]+x[2],_})([],this.min,this.max))}quadrant(r){const f=[r%2==0,r<2],_=Te(this.min),y=Te(this.max);for(let x=0;x<f.length;x++)_[x]=f[x]?this.min[x]:this.center[x],y[x]=f[x]?this.center[x]:this.max[x];return y[2]=this.max[2],new Rs(_,y)}distanceX(r){return Math.max(Math.min(this.max[0],r[0]),this.min[0])-r[0]}distanceY(r){return Math.max(Math.min(this.max[1],r[1]),this.min[1])-r[1]}intersects(r){const f=[[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 _=!0;for(let y=0;y<r.planes.length;y++){const x=r.planes[y];let M=0;for(let D=0;D<f.length;D++)h.b2(x,f[D])>=0&&M++;if(M===0)return 0;M!==f.length&&(_=!1)}if(_)return 2;for(let y=0;y<3;y++){let x=Number.MAX_VALUE,M=-Number.MAX_VALUE;for(let D=0;D<r.points.length;D++){const O=r.points[D][y]-this.min[y];x=Math.min(x,O),M=Math.max(M,O)}if(M<0||x>this.max[y]-this.min[y])return 0}return 1}}class Ys{constructor(r=0,f=0,_=0,y=0){if(isNaN(r)||r<0||isNaN(f)||f<0||isNaN(_)||_<0||isNaN(y)||y<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=r,this.bottom=f,this.left=_,this.right=y}interpolate(r,f,_){return f.top!=null&&r.top!=null&&(this.top=h.y.number(r.top,f.top,_)),f.bottom!=null&&r.bottom!=null&&(this.bottom=h.y.number(r.bottom,f.bottom,_)),f.left!=null&&r.left!=null&&(this.left=h.y.number(r.left,f.left,_)),f.right!=null&&r.right!=null&&(this.right=h.y.number(r.right,f.right,_)),this}getCenter(r,f){const _=h.ac((this.left+r-this.right)/2,0,r),y=h.ac((this.top+f-this.bottom)/2,0,f);return new h.P(_,y)}equals(r){return this.top===r.top&&this.bottom===r.bottom&&this.left===r.left&&this.right===r.right}clone(){return new Ys(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const mc=85.051129;class zo{constructor(r,f,_,y,x){this.tileSize=512,this._renderWorldCopies=x===void 0||!!x,this._minZoom=r||0,this._maxZoom=f||22,this._minPitch=_??0,this._maxPitch=y??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new h.N(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new Ys,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={},this.minElevationForCurrentTile=0}clone(){const r=new zo(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return r.apply(this),r}apply(r){this.tileSize=r.tileSize,this.latRange=r.latRange,this.lngRange=r.lngRange,this.width=r.width,this.height=r.height,this._center=r._center,this._elevation=r._elevation,this.minElevationForCurrentTile=r.minElevationForCurrentTile,this.zoom=r.zoom,this.angle=r.angle,this._fov=r._fov,this._pitch=r._pitch,this._unmodified=r._unmodified,this._edgeInsets=r._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(r){this._minZoom!==r&&(this._minZoom=r,this.zoom=Math.max(this.zoom,r))}get maxZoom(){return this._maxZoom}set maxZoom(r){this._maxZoom!==r&&(this._maxZoom=r,this.zoom=Math.min(this.zoom,r))}get minPitch(){return this._minPitch}set minPitch(r){this._minPitch!==r&&(this._minPitch=r,this.pitch=Math.max(this.pitch,r))}get maxPitch(){return this._maxPitch}set maxPitch(r){this._maxPitch!==r&&(this._maxPitch=r,this.pitch=Math.min(this.pitch,r))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(r){r===void 0?r=!0:r===null&&(r=!1),this._renderWorldCopies=r}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new h.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(r){const f=-h.b3(r,-180,180)*Math.PI/180;this.angle!==f&&(this._unmodified=!1,this.angle=f,this._calcMatrices(),this.rotationMatrix=(function(){var _=new h.A(4);return h.A!=Float32Array&&(_[1]=0,_[2]=0),_[0]=1,_[3]=1,_})(),(function(_,y,x){var M=y[0],D=y[1],O=y[2],L=y[3],$=Math.sin(x),H=Math.cos(x);_[0]=M*H+O*$,_[1]=D*H+L*$,_[2]=M*-$+O*H,_[3]=D*-$+L*H})(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(r){const f=h.ac(r,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==f&&(this._unmodified=!1,this._pitch=f,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(r){r=Math.max(.01,Math.min(60,r)),this._fov!==r&&(this._unmodified=!1,this._fov=r/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(r){const f=Math.min(Math.max(r,this.minZoom),this.maxZoom);this._zoom!==f&&(this._unmodified=!1,this._zoom=f,this.tileZoom=Math.max(0,Math.floor(f)),this.scale=this.zoomScale(f),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(r){r.lat===this._center.lat&&r.lng===this._center.lng||(this._unmodified=!1,this._center=r,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(r){r!==this._elevation&&(this._elevation=r,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(r){this._edgeInsets.equals(r)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,r,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(r){return this._edgeInsets.equals(r)}interpolatePadding(r,f,_){this._unmodified=!1,this._edgeInsets.interpolate(r,f,_),this._constrain(),this._calcMatrices()}coveringZoomLevel(r){const f=(r.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/r.tileSize));return Math.max(0,f)}getVisibleUnwrappedCoordinates(r){const f=[new h.b4(0,r)];if(this._renderWorldCopies){const _=this.pointCoordinate(new h.P(0,0)),y=this.pointCoordinate(new h.P(this.width,0)),x=this.pointCoordinate(new h.P(this.width,this.height)),M=this.pointCoordinate(new h.P(0,this.height)),D=Math.floor(Math.min(_.x,y.x,x.x,M.x)),O=Math.floor(Math.max(_.x,y.x,x.x,M.x)),L=1;for(let $=D-L;$<=O+L;$++)$!==0&&f.push(new h.b4($,r))}return f}coveringTiles(r){var f,_;let y=this.coveringZoomLevel(r);const x=y;if(r.minzoom!==void 0&&y<r.minzoom)return[];r.maxzoom!==void 0&&y>r.maxzoom&&(y=r.maxzoom);const M=this.pointCoordinate(this.getCameraPoint()),D=h.Z.fromLngLat(this.center),O=Math.pow(2,y),L=[O*M.x,O*M.y,0],$=[O*D.x,O*D.y,0],H=No.fromInvProjectionMatrix(this.invModelViewProjectionMatrix,this.worldSize,y);let G=r.minzoom||0;!r.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(G=y);const ee=r.terrain?2/Math.min(this.tileSize,r.tileSize)*this.tileSize:3,ne=le=>({aabb:new Rs([le*O,0,0],[(le+1)*O,O,0]),zoom:0,x:0,y:0,wrap:le,fullyVisible:!1}),he=[],pe=[],ge=y,be=r.reparseOverscaled?x:y;if(this._renderWorldCopies)for(let le=1;le<=3;le++)he.push(ne(-le)),he.push(ne(le));for(he.push(ne(0));he.length>0;){const le=he.pop(),Ce=le.x,Ie=le.y;let ze=le.fullyVisible;if(!ze){const xt=le.aabb.intersects(H);if(xt===0)continue;ze=xt===2}const Ge=r.terrain?L:$,dt=le.aabb.distanceX(Ge),vt=le.aabb.distanceY(Ge),Mt=Math.max(Math.abs(dt),Math.abs(vt));if(le.zoom===ge||Mt>ee+(1<<ge-le.zoom)-2&&le.zoom>=G){const xt=ge-le.zoom,ft=L[0]-.5-(Ce<<xt),Ot=L[1]-.5-(Ie<<xt);pe.push({tileID:new h.S(le.zoom===ge?be:le.zoom,le.wrap,le.zoom,Ce,Ie),distanceSq:Je([$[0]-.5-Ce,$[1]-.5-Ie]),tileDistanceToCamera:Math.sqrt(ft*ft+Ot*Ot)})}else for(let xt=0;xt<4;xt++){const ft=(Ce<<1)+xt%2,Ot=(Ie<<1)+(xt>>1),ni=le.zoom+1;let wt=le.aabb.quadrant(xt);if(r.terrain){const Ct=new h.S(ni,le.wrap,ni,ft,Ot),Qt=r.terrain.getMinMaxElevation(Ct),Ki=(f=Qt.minElevation)!==null&&f!==void 0?f:this.elevation,mi=(_=Qt.maxElevation)!==null&&_!==void 0?_:this.elevation;wt=new Rs([wt.min[0],wt.min[1],Ki],[wt.max[0],wt.max[1],mi])}he.push({aabb:wt,zoom:ni,x:ft,y:Ot,wrap:le.wrap,fullyVisible:ze})}}return pe.sort(((le,Ce)=>le.distanceSq-Ce.distanceSq)).map((le=>le.tileID))}resize(r,f){this.width=r,this.height=f,this.pixelsToGLUnits=[2/r,-2/f],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(r){return Math.pow(2,r)}scaleZoom(r){return Math.log(r)/Math.LN2}project(r){const f=h.ac(r.lat,-85.051129,mc);return new h.P(h.O(r.lng)*this.worldSize,h.Q(f)*this.worldSize)}unproject(r){return new h.Z(r.x/this.worldSize,r.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(r){const f=this.elevation,_=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,y=this.pointLocation(this.centerPoint,r),x=r.getElevationForLngLatZoom(y,this.tileZoom);if(!(this.elevation-x))return;const M=_+f-x,D=Math.cos(this._pitch)*this.cameraToCenterDistance/M/h.b5(1,y.lat),O=this.scaleZoom(D/this.tileSize);this._elevation=x,this._center=y,this.zoom=O}setLocationAtPoint(r,f){const _=this.pointCoordinate(f),y=this.pointCoordinate(this.centerPoint),x=this.locationCoordinate(r),M=new h.Z(x.x-(_.x-y.x),x.y-(_.y-y.y));this.center=this.coordinateLocation(M),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(r,f){return f?this.coordinatePoint(this.locationCoordinate(r),f.getElevationForLngLatZoom(r,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(r))}pointLocation(r,f){return this.coordinateLocation(this.pointCoordinate(r,f))}locationCoordinate(r){return h.Z.fromLngLat(r)}coordinateLocation(r){return r&&r.toLngLat()}pointCoordinate(r,f){if(f){const G=f.pointCoordinate(r);if(G!=null)return G}const _=[r.x,r.y,0,1],y=[r.x,r.y,1,1];h.af(_,_,this.pixelMatrixInverse),h.af(y,y,this.pixelMatrixInverse);const x=_[3],M=y[3],D=_[1]/x,O=y[1]/M,L=_[2]/x,$=y[2]/M,H=L===$?0:(0-L)/($-L);return new h.Z(h.y.number(_[0]/x,y[0]/M,H)/this.worldSize,h.y.number(D,O,H)/this.worldSize)}coordinatePoint(r,f=0,_=this.pixelMatrix){const y=[r.x*this.worldSize,r.y*this.worldSize,f,1];return h.af(y,y,_),new h.P(y[0]/y[3],y[1]/y[3])}getBounds(){const r=Math.max(0,this.height/2-this.getHorizon());return new _e().extend(this.pointLocation(new h.P(0,r))).extend(this.pointLocation(new h.P(this.width,r))).extend(this.pointLocation(new h.P(this.width,this.height))).extend(this.pointLocation(new h.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new _e([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(r){r?(this.lngRange=[r.getWest(),r.getEast()],this.latRange=[r.getSouth(),r.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-85.051129,mc])}calculateTileMatrix(r){const f=r.canonical,_=this.worldSize/this.zoomScale(f.z),y=f.x+Math.pow(2,f.z)*r.wrap,x=h.an(new Float64Array(16));return h.J(x,x,[y*_,f.y*_,0]),h.K(x,x,[_/h.X,_/h.X,1]),x}calculatePosMatrix(r,f=!1){const _=r.key,y=f?this._alignedPosMatrixCache:this._posMatrixCache;if(y[_])return y[_];const x=this.calculateTileMatrix(r);return h.L(x,f?this.alignedModelViewProjectionMatrix:this.modelViewProjectionMatrix,x),y[_]=new Float32Array(x),y[_]}calculateFogMatrix(r){const f=r.key,_=this._fogMatrixCache;if(_[f])return _[f];const y=this.calculateTileMatrix(r);return h.L(y,this.fogMatrix,y),_[f]=new Float32Array(y),_[f]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(r,f){f=h.ac(+f,this.minZoom,this.maxZoom);const _={center:new h.N(r.lng,r.lat),zoom:f};let y=this.lngRange;if(!this._renderWorldCopies&&y===null){const le=179.9999999999;y=[-le,le]}const x=this.tileSize*this.zoomScale(_.zoom);let M=0,D=x,O=0,L=x,$=0,H=0;const{x:G,y:ee}=this.size;if(this.latRange){const le=this.latRange;M=h.Q(le[1])*x,D=h.Q(le[0])*x,D-M<ee&&($=ee/(D-M))}y&&(O=h.b3(h.O(y[0])*x,0,x),L=h.b3(h.O(y[1])*x,0,x),L<O&&(L+=x),L-O<G&&(H=G/(L-O)));const{x:ne,y:he}=this.project.call({worldSize:x},r);let pe,ge;const be=Math.max(H||0,$||0);if(be){const le=new h.P(H?(L+O)/2:ne,$?(D+M)/2:he);return _.center=this.unproject.call({worldSize:x},le).wrap(),_.zoom+=this.scaleZoom(be),_}if(this.latRange){const le=ee/2;he-le<M&&(ge=M+le),he+le>D&&(ge=D-le)}if(y){const le=(O+L)/2;let Ce=ne;this._renderWorldCopies&&(Ce=h.b3(ne,le-x/2,le+x/2));const Ie=G/2;Ce-Ie<O&&(pe=O+Ie),Ce+Ie>L&&(pe=L-Ie)}if(pe!==void 0||ge!==void 0){const le=new h.P(pe??ne,ge??he);_.center=this.unproject.call({worldSize:x},le).wrap()}return _}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const r=this._unmodified,{center:f,zoom:_}=this.getConstrained(this.center,this.zoom);this.center=f,this.zoom=_,this._unmodified=r,this._constraining=!1}_calcMatrices(){if(!this.height)return;const r=this.centerOffset,f=this.point.x,_=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=h.b5(1,this.center.lat)*this.worldSize;let y=h.an(new Float64Array(16));h.K(y,y,[this.width/2,-this.height/2,1]),h.J(y,y,[1,-1,0]),this.labelPlaneMatrix=y,y=h.an(new Float64Array(16)),h.K(y,y,[1,-1,1]),h.J(y,y,[-1,-1,0]),h.K(y,y,[2/this.width,2/this.height,1]),this.glCoordMatrix=y;const x=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),M=Math.min(this.elevation,this.minElevationForCurrentTile),D=x-M*this._pixelPerMeter/Math.cos(this._pitch),O=M<0?D:x,L=Math.PI/2+this._pitch,$=this._fov*(.5+r.y/this.height),H=Math.sin($)*O/Math.sin(h.ac(Math.PI-L-$,.01,Math.PI-.01)),G=this.getHorizon(),ee=2*Math.atan(G/this.cameraToCenterDistance)*(.5+r.y/(2*G)),ne=Math.sin(ee)*O/Math.sin(h.ac(Math.PI-L-ee,.01,Math.PI-.01)),he=Math.min(H,ne);this.farZ=1.01*(Math.cos(Math.PI/2-this._pitch)*he+O),this.nearZ=this.height/50,y=new Float64Array(16),h.b6(y,this._fov,this.width/this.height,this.nearZ,this.farZ),y[8]=2*-r.x/this.width,y[9]=2*r.y/this.height,this.projectionMatrix=h.ae(y),h.K(y,y,[1,-1,1]),h.J(y,y,[0,0,-this.cameraToCenterDistance]),h.b7(y,y,this._pitch),h.ad(y,y,this.angle),h.J(y,y,[-f,-_,0]),this.mercatorMatrix=h.K([],y,[this.worldSize,this.worldSize,this.worldSize]),h.K(y,y,[1,1,this._pixelPerMeter]),this.pixelMatrix=h.L(new Float64Array(16),this.labelPlaneMatrix,y),h.J(y,y,[0,0,-this.elevation]),this.modelViewProjectionMatrix=y,this.invModelViewProjectionMatrix=h.as([],y),this.fogMatrix=new Float64Array(16),h.b6(this.fogMatrix,this._fov,this.width/this.height,x,this.farZ),this.fogMatrix[8]=2*-r.x/this.width,this.fogMatrix[9]=2*r.y/this.height,h.K(this.fogMatrix,this.fogMatrix,[1,-1,1]),h.J(this.fogMatrix,this.fogMatrix,[0,0,-this.cameraToCenterDistance]),h.b7(this.fogMatrix,this.fogMatrix,this._pitch),h.ad(this.fogMatrix,this.fogMatrix,this.angle),h.J(this.fogMatrix,this.fogMatrix,[-f,-_,0]),h.K(this.fogMatrix,this.fogMatrix,[1,1,this._pixelPerMeter]),h.J(this.fogMatrix,this.fogMatrix,[0,0,-this.elevation]),this.pixelMatrix3D=h.L(new Float64Array(16),this.labelPlaneMatrix,y);const pe=this.width%2/2,ge=this.height%2/2,be=Math.cos(this.angle),le=Math.sin(this.angle),Ce=f-Math.round(f)+be*pe+le*ge,Ie=_-Math.round(_)+be*ge+le*pe,ze=new Float64Array(y);if(h.J(ze,ze,[Ce>.5?Ce-1:Ce,Ie>.5?Ie-1:Ie,0]),this.alignedModelViewProjectionMatrix=ze,y=h.as(new Float64Array(16),this.pixelMatrix),!y)throw new Error("failed to invert matrix");this.pixelMatrixInverse=y,this._posMatrixCache={},this._alignedPosMatrixCache={},this._fogMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const r=this.pointCoordinate(new h.P(0,0)),f=[r.x*this.worldSize,r.y*this.worldSize,0,1];return h.af(f,f,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const r=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new h.P(0,r))}getCameraQueryGeometry(r){const f=this.getCameraPoint();if(r.length===1)return[r[0],f];{let _=f.x,y=f.y,x=f.x,M=f.y;for(const D of r)_=Math.min(_,D.x),y=Math.min(y,D.y),x=Math.max(x,D.x),M=Math.max(M,D.y);return[new h.P(_,y),new h.P(x,y),new h.P(x,M),new h.P(_,M),new h.P(_,y)]}}lngLatToCameraDepth(r,f){const _=this.locationCoordinate(r),y=[_.x*this.worldSize,_.y*this.worldSize,f,1];return h.af(y,y,this.modelViewProjectionMatrix),y[2]/y[3]}}function Gs(w,r){let f,_=!1,y=null,x=null;const M=()=>{y=null,_&&(w.apply(x,f),y=setTimeout(M,r),_=!1)};return(...D)=>(_=!0,x=this,f=D,y||M(),y)}class gc{constructor(r){this._getCurrentHash=()=>{const f=window.location.hash.replace("#","");if(this._hashName){let _;return f.split("&").map((y=>y.split("="))).forEach((y=>{y[0]===this._hashName&&(_=y)})),(_&&_[1]||"").split("/")}return f.split("/")},this._onHashChange=()=>{const f=this._getCurrentHash();if(f.length>=3&&!f.some((_=>isNaN(_)))){const _=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(f[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+f[2],+f[1]],zoom:+f[0],bearing:_,pitch:+(f[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const f=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,f)},this._removeHash=()=>{const f=this._getCurrentHash();if(f.length===0)return;const _=f.join("/");let y=_;y.split("&").length>0&&(y=y.split("&")[0]),this._hashName&&(y=`${this._hashName}=${_}`);let x=window.location.hash.replace(y,"");x.startsWith("#&")?x=x.slice(0,1)+x.slice(2):x==="#"&&(x="");let M=window.location.href.replace(/(#.+)?$/,x);M=M.replace("&&","&"),window.history.replaceState(window.history.state,null,M)},this._updateHash=Gs(this._updateHashUnthrottled,300),this._hashName=r&&encodeURIComponent(r)}addTo(r){return this._map=r,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()),this._removeHash(),delete this._map,this}getHashString(r){const f=this._map.getCenter(),_=Math.round(100*this._map.getZoom())/100,y=Math.ceil((_*Math.LN2+Math.log(512/360/.5))/Math.LN10),x=Math.pow(10,y),M=Math.round(f.lng*x)/x,D=Math.round(f.lat*x)/x,O=this._map.getBearing(),L=this._map.getPitch();let $="";if($+=r?`/${M}/${D}/${_}`:`${_}/${D}/${M}`,(O||L)&&($+="/"+Math.round(10*O)/10),L&&($+=`/${Math.round(L)}`),this._hashName){const H=this._hashName;let G=!1;const ee=window.location.hash.slice(1).split("&").map((ne=>{const he=ne.split("=")[0];return he===H?(G=!0,`${he}=${$}`):ne})).filter((ne=>ne));return G||ee.push(`${H}=${$}`),`#${ee.join("&")}`}return`#${$}`}}const _c={linearity:.3,easing:h.b8(0,0,.3,1)},du=h.e({deceleration:2500,maxSpeed:1400},_c),kp=h.e({deceleration:20,maxSpeed:1400},_c),nf=h.e({deceleration:1e3,maxSpeed:360},_c),fu=h.e({deceleration:1e3,maxSpeed:90},_c);class pu{constructor(r){this._map=r,this.clear()}clear(){this._inertiaBuffer=[]}record(r){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:N.now(),settings:r})}_drainInertiaBuffer(){const r=this._inertiaBuffer,f=N.now();for(;r.length>0&&f-r[0].time>160;)r.shift()}_onMoveEnd(r){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const f={zoom:0,bearing:0,pitch:0,pan:new h.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:x}of this._inertiaBuffer)f.zoom+=x.zoomDelta||0,f.bearing+=x.bearingDelta||0,f.pitch+=x.pitchDelta||0,x.panDelta&&f.pan._add(x.panDelta),x.around&&(f.around=x.around),x.pinchAround&&(f.pinchAround=x.pinchAround);const _=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,y={};if(f.pan.mag()){const x=Lo(f.pan.mag(),_,h.e({},du,r||{}));y.offset=f.pan.mult(x.amount/f.pan.mag()),y.center=this._map.transform.center,Tl(y,x)}if(f.zoom){const x=Lo(f.zoom,_,kp);y.zoom=this._map.transform.zoom+x.amount,Tl(y,x)}if(f.bearing){const x=Lo(f.bearing,_,nf);y.bearing=this._map.transform.bearing+h.ac(x.amount,-179,179),Tl(y,x)}if(f.pitch){const x=Lo(f.pitch,_,fu);y.pitch=this._map.transform.pitch+x.amount,Tl(y,x)}if(y.zoom||y.bearing){const x=f.pinchAround===void 0?f.around:f.pinchAround;y.around=x?this._map.unproject(x):this._map.getCenter()}return this.clear(),h.e(y,{noMoveStart:!0})}}function Tl(w,r){(!w.duration||w.duration<r.duration)&&(w.duration=r.duration,w.easing=r.easing)}function Lo(w,r,f){const{maxSpeed:_,linearity:y,deceleration:x}=f,M=h.ac(w*y/(r/1e3),-_,_),D=Math.abs(M)/(x*y);return{easing:f.easing,duration:1e3*D,amount:M*(D/2)}}class wn extends h.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(r,f,_,y={}){const x=F.mousePos(f.getCanvas(),_),M=f.unproject(x);super(r,h.e({point:x,lngLat:M,originalEvent:_},y)),this._defaultPrevented=!1,this.target=f}}class pa extends h.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(r,f,_){const y=r==="touchend"?_.changedTouches:_.touches,x=F.touchPos(f.getCanvasContainer(),y),M=x.map((O=>f.unproject(O))),D=x.reduce(((O,L,$,H)=>O.add(L.div(H.length))),new h.P(0,0));super(r,{points:x,point:D,lngLats:M,lngLat:f.unproject(D),originalEvent:_}),this._defaultPrevented=!1}}class ms extends h.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(r,f,_){super(r,{originalEvent:_}),this._defaultPrevented=!1}}class Fo{constructor(r,f){this._map=r,this._clickTolerance=f.clickTolerance}reset(){delete this._mousedownPos}wheel(r){return this._firePreventable(new ms(r.type,this._map,r))}mousedown(r,f){return this._mousedownPos=f,this._firePreventable(new wn(r.type,this._map,r))}mouseup(r){this._map.fire(new wn(r.type,this._map,r))}click(r,f){this._mousedownPos&&this._mousedownPos.dist(f)>=this._clickTolerance||this._map.fire(new wn(r.type,this._map,r))}dblclick(r){return this._firePreventable(new wn(r.type,this._map,r))}mouseover(r){this._map.fire(new wn(r.type,this._map,r))}mouseout(r){this._map.fire(new wn(r.type,this._map,r))}touchstart(r){return this._firePreventable(new pa(r.type,this._map,r))}touchmove(r){this._map.fire(new pa(r.type,this._map,r))}touchend(r){this._map.fire(new pa(r.type,this._map,r))}touchcancel(r){this._map.fire(new pa(r.type,this._map,r))}_firePreventable(r){if(this._map.fire(r),r.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Rn{constructor(r){this._map=r}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(r){this._map.fire(new wn(r.type,this._map,r))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new wn("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(r){this._delayContextMenu?this._contextMenuEvent=r:this._ignoreContextMenu||this._map.fire(new wn(r.type,this._map,r)),this._map.listens("contextmenu")&&r.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class ns{constructor(r){this._map=r}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(r){return this.transform.pointLocation(h.P.convert(r),this._map.terrain)}}class Br{constructor(r,f){this._map=r,this._tr=new ns(r),this._el=r.getCanvasContainer(),this._container=r.getContainer(),this._clickTolerance=f.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(r,f){this.isEnabled()&&r.shiftKey&&r.button===0&&(F.disableDrag(),this._startPos=this._lastPos=f,this._active=!0)}mousemoveWindow(r,f){if(!this._active)return;const _=f;if(this._lastPos.equals(_)||!this._box&&_.dist(this._startPos)<this._clickTolerance)return;const y=this._startPos;this._lastPos=_,this._box||(this._box=F.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",r));const x=Math.min(y.x,_.x),M=Math.max(y.x,_.x),D=Math.min(y.y,_.y),O=M
vendor: 14,362 bytes, line 628
628ath.max(y.y,_.y);F.setTransform(this._box,`translate(${x}px,${D}px)`),this._box.style.width=M-x+"px",this._box.style.height=O-D+"px"}mouseupWindow(r,f){if(!this._active||r.button!==0)return;const _=this._startPos,y=f;if(this.reset(),F.suppressClick(),_.x!==y.x||_.y!==y.y)return this._map.fire(new h.k("boxzoomend",{originalEvent:r})),{cameraAnimation:x=>x.fitScreenCoordinates(_,y,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",r)}keydown(r){this._active&&r.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",r))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(F.remove(this._box),this._box=null),F.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(r,f){return this._map.fire(new h.k(r,{originalEvent:f}))}}function Uo(w,r){if(w.length!==r.length)throw new Error(`The number of touches and points are not equal - touches ${w.length}, points ${r.length}`);const f={};for(let _=0;_<w.length;_++)f[w[_].identifier]=r[_];return f}class Ma{constructor(r){this.reset(),this.numTouches=r.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(r,f,_){(this.centroid||_.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=r.timeStamp),_.length===this.numTouches&&(this.centroid=(function(y){const x=new h.P(0,0);for(const M of y)x._add(M);return x.div(y.length)})(f),this.touches=Uo(_,f)))}touchmove(r,f,_){if(this.aborted||!this.centroid)return;const y=Uo(_,f);for(const x in this.touches){const M=y[x];(!M||M.dist(this.touches[x])>30)&&(this.aborted=!0)}}touchend(r,f,_){if((!this.centroid||r.timeStamp-this.startTime>500)&&(this.aborted=!0),_.length===0){const y=!this.aborted&&this.centroid;if(this.reset(),y)return y}}}class yc{constructor(r){this.singleTap=new Ma(r),this.numTaps=r.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(r,f,_){this.singleTap.touchstart(r,f,_)}touchmove(r,f,_){this.singleTap.touchmove(r,f,_)}touchend(r,f,_){const y=this.singleTap.touchend(r,f,_);if(y){const x=r.timeStamp-this.lastTime<500,M=!this.lastTap||this.lastTap.dist(y)<30;if(x&&M||this.reset(),this.count++,this.lastTime=r.timeStamp,this.lastTap=y,this.count===this.numTaps)return this.reset(),y}}}class Pa{constructor(r){this._tr=new ns(r),this._zoomIn=new yc({numTouches:1,numTaps:2}),this._zoomOut=new yc({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(r,f,_){this._zoomIn.touchstart(r,f,_),this._zoomOut.touchstart(r,f,_)}touchmove(r,f,_){this._zoomIn.touchmove(r,f,_),this._zoomOut.touchmove(r,f,_)}touchend(r,f,_){const y=this._zoomIn.touchend(r,f,_),x=this._zoomOut.touchend(r,f,_),M=this._tr;return y?(this._active=!0,r.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:D=>D.easeTo({duration:300,zoom:M.zoom+1,around:M.unproject(y)},{originalEvent:r})}):x?(this._active=!0,r.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:D=>D.easeTo({duration:300,zoom:M.zoom-1,around:M.unproject(x)},{originalEvent:r})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class rs{constructor(r){this._enabled=!!r.enable,this._moveStateManager=r.moveStateManager,this._clickTolerance=r.clickTolerance||1,this._moveFunction=r.move,this._activateOnStart=!!r.activateOnStart,r.assignEvents(this),this.reset()}reset(r){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(r)}_move(...r){const f=this._moveFunction(...r);if(f.bearingDelta||f.pitchDelta||f.around||f.panDelta)return this._active=!0,f}dragStart(r,f){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(r)&&(this._moveStateManager.startMove(r),this._lastPoint=f.length?f[0]:f,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(r,f){if(!this.isEnabled())return;const _=this._lastPoint;if(!_)return;if(r.preventDefault(),!this._moveStateManager.isValidMoveEvent(r))return void this.reset(r);const y=f.length?f[0]:f;return!this._moved&&y.dist(_)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=y,this._move(_,y))}dragEnd(r){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(r)&&(this._moved&&F.suppressClick(),this.reset(r))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const Ph={0:1,2:2};class Nr{constructor(r){this._correctEvent=r.checkCorrectEvent}startMove(r){const f=F.mouseButton(r);this._eventButton=f}endMove(r){delete this._eventButton}isValidStartEvent(r){return this._correctEvent(r)}isValidMoveEvent(r){return!(function(f,_){const y=Ph[_];return f.buttons===void 0||(f.buttons&y)!==y})(r,this._eventButton)}isValidEndEvent(r){return F.mouseButton(r)===this._eventButton}}class vc{constructor(){this._firstTouch=void 0}_isOneFingerTouch(r){return r.targetTouches.length===1}_isSameTouchEvent(r){return r.targetTouches[0].identifier===this._firstTouch}startMove(r){this._firstTouch=r.targetTouches[0].identifier}endMove(r){delete this._firstTouch}isValidStartEvent(r){return this._isOneFingerTouch(r)}isValidMoveEvent(r){return this._isOneFingerTouch(r)&&this._isSameTouchEvent(r)}isValidEndEvent(r){return this._isOneFingerTouch(r)&&this._isSameTouchEvent(r)}}const Ms=w=>{w.mousedown=w.dragStart,w.mousemoveWindow=w.dragMove,w.mouseup=w.dragEnd,w.contextmenu=r=>{r.preventDefault()}},mu=({enable:w,clickTolerance:r,bearingDegreesPerPixelMoved:f=.8})=>{const _=new Nr({checkCorrectEvent:y=>F.mouseButton(y)===0&&y.ctrlKey||F.mouseButton(y)===2});return new rs({clickTolerance:r,move:(y,x)=>({bearingDelta:(x.x-y.x)*f}),moveStateManager:_,enable:w,assignEvents:Ms})},Sl=({enable:w,clickTolerance:r,pitchDegreesPerPixelMoved:f=-.5})=>{const _=new Nr({checkCorrectEvent:y=>F.mouseButton(y)===0&&y.ctrlKey||F.mouseButton(y)===2});return new rs({clickTolerance:r,move:(y,x)=>({pitchDelta:(x.y-y.y)*f}),moveStateManager:_,enable:w,assignEvents:Ms})};class gs{constructor(r,f){this._clickTolerance=r.clickTolerance||1,this._map=f,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new h.P(0,0)}_shouldBePrevented(r){return r<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(r,f,_){return this._calculateTransform(r,f,_)}touchmove(r,f,_){if(this._active){if(!this._shouldBePrevented(_.length))return r.preventDefault(),this._calculateTransform(r,f,_);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",r)}}touchend(r,f,_){this._calculateTransform(r,f,_),this._active&&this._shouldBePrevented(_.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(r,f,_){_.length>0&&(this._active=!0);const y=Uo(_,f),x=new h.P(0,0),M=new h.P(0,0);let D=0;for(const L in y){const $=y[L],H=this._touches[L];H&&(x._add($),M._add($.sub(H)),D++,y[L]=$)}if(this._touches=y,this._shouldBePrevented(D)||!M.mag())return;const O=M.div(D);return this._sum._add(O),this._sum.mag()<this._clickTolerance?void 0:{around:x.div(D),panDelta:O}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Al{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(r,f,_){this._firstTwoTouches||_.length<2||(this._firstTwoTouches=[_[0].identifier,_[1].identifier],this._start([f[0],f[1]]))}touchmove(r,f,_){if(!this._firstTwoTouches)return;r.preventDefault();const[y,x]=this._firstTwoTouches,M=El(_,f,y),D=El(_,f,x);if(!M||!D)return;const O=this._aroundCenter?null:M.add(D).div(2);return this._move([M,D],O,r)}touchend(r,f,_){if(!this._firstTwoTouches)return;const[y,x]=this._firstTwoTouches,M=El(_,f,y),D=El(_,f,x);M&&D||(this._active&&F.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(r){this._enabled=!0,this._aroundCenter=!!r&&r.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function El(w,r,f){for(let _=0;_<w.length;_++)if(w[_].identifier===f)return r[_]}function bc(w,r){return Math.log(w/r)/Math.LN2}class gu extends Al{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(r){this._startDistance=this._distance=r[0].dist(r[1])}_move(r,f){const _=this._distance;if(this._distance=r[0].dist(r[1]),this._active||!(Math.abs(bc(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:bc(this._distance,_),pinchAround:f}}}function ss(w,r){return 180*w.angleWith(r)/Math.PI}class to extends Al{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(r){this._startVector=this._vector=r[0].sub(r[1]),this._minDiameter=r[0].dist(r[1])}_move(r,f,_){const y=this._vector;if(this._vector=r[0].sub(r[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:ss(this._vector,y),pinchAround:f}}_isBelowThreshold(r){this._minDiameter=Math.min(this._minDiameter,r.mag());const f=25/(Math.PI*this._minDiameter)*360,_=ss(r,this._startVector);return Math.abs(_)<f}}function Ia(w){return Math.abs(w.y)>Math.abs(w.x)}class io extends Al{constructor(r){super(),this._currentTouchCount=0,this._map=r}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(r,f,_){super.touchstart(r,f,_),this._currentTouchCount=_.length}_start(r){this._lastPoints=r,Ia(r[0].sub(r[1]))&&(this._valid=!1)}_move(r,f,_){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const y=r[0].sub(this._lastPoints[0]),x=r[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(y,x,_.timeStamp),this._valid?(this._lastPoints=r,this._active=!0,{pitchDelta:(y.y+x.y)/2*-.5}):void 0}gestureBeginsVertically(r,f,_){if(this._valid!==void 0)return this._valid;const y=r.mag()>=2,x=f.mag()>=2;if(!y&&!x)return;if(!y||!x)return this._firstMove===void 0&&(this._firstMove=_),_-this._firstMove<100&&void 0;const M=r.y>0==f.y>0;return Ia(r)&&Ia(f)&&M}}const Cl={panStep:100,bearingStep:15,pitchStep:10};class zn{constructor(r){this._tr=new ns(r);const f=Cl;this._panStep=f.panStep,this._bearingStep=f.bearingStep,this._pitchStep=f.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(r){if(r.altKey||r.ctrlKey||r.metaKey)return;let f=0,_=0,y=0,x=0,M=0;switch(r.keyCode){case 61:case 107:case 171:case 187:f=1;break;case 189:case 109:case 173:f=-1;break;case 37:r.shiftKey?_=-1:(r.preventDefault(),x=-1);break;case 39:r.shiftKey?_=1:(r.preventDefault(),x=1);break;case 38:r.shiftKey?y=1:(r.preventDefault(),M=-1);break;case 40:r.shiftKey?y=-1:(r.preventDefault(),M=1);break;default:return}return this._rotationDisabled&&(_=0,y=0),{cameraAnimation:D=>{const O=this._tr;D.easeTo({duration:300,easeId:"keyboardHandler",easing:Gn,zoom:f?Math.round(O.zoom)+f*(r.shiftKey?2:1):O.zoom,bearing:O.bearing+_*this._bearingStep,pitch:O.pitch+y*this._pitchStep,offset:[-x*this._panStep,-M*this._panStep],center:O.center},{originalEvent:r})}}}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 Gn(w){return w*(2-w)}const ma=4.000244140625;class rr{constructor(r,f){this._onTimeout=_=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(_)},this._map=r,this._tr=new ns(r),this._triggerRenderFrame=f,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(r){this._defaultZoomRate=r}setWheelZoomRate(r){this._wheelZoomRate=r}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(r){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!r&&r.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(r){return!!this._map.cooperativeGestures.isEnabled()&&!(r.ctrlKey||this._map.cooperativeGestures.isBypassed(r))}wheel(r){if(!this.isEnabled())return;if(this._shouldBePrevented(r))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",r);let f=r.deltaMode===WheelEvent.DOM_DELTA_LINE?40*r.deltaY:r.deltaY;const _=N.now(),y=_-(this._lastWheelEventTime||0);this._lastWheelEventTime=_,f!==0&&f%ma==0?this._type="wheel":f!==0&&Math.abs(f)<4?this._type="trackpad":y>400?(this._type=null,this._lastValue=f,this._timeout=setTimeout(this._onTimeout,40,r)):this._type||(this._type=Math.abs(y*f)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,f+=this._lastValue)),r.shiftKey&&f&&(f/=4),this._type&&(this._lastWheelEvent=r,this._delta-=f,this._active||this._start(r)),r.preventDefault()}_start(r){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 f=F.mousePos(this._map.getCanvas(),r),_=this._tr;this._around=f.y>_.transform.height/2-_.transform.getHorizon()?h.N.convert(this._aroundCenter?_.center:_.unproject(f)):h.N.convert(_.center),this._aroundPoint=_.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const r=this._tr.transform;if(this._delta!==0){const O=this._type==="wheel"&&Math.abs(this._delta)>ma?this._wheelZoomRate:this._defaultZoomRate;let L=2/(1+Math.exp(-Math.abs(this._delta*O)));this._delta<0&&L!==0&&(L=1/L);const $=typeof this._targetZoom=="number"?r.zoomScale(this._targetZoom):r.scale;this._targetZoom=Math.min(r.maxZoom,Math.max(r.minZoom,r.scaleZoom($*L))),this._type==="wheel"&&(this._startZoom=r.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const f=typeof this._targetZoom=="number"?this._targetZoom:r.zoom,_=this._startZoom,y=this._easing;let x,M=!1;const D=N.now()-this._lastWheelEventTime;if(this._type==="wheel"&&_&&y&&D){const O=Math.min(D/200,1),L=y(O);x=h.y.number(_,f,L),O<1?this._frameId||(this._frameId=!0):M=!0}else x=f,M=!0;return this._active=!0,M&&(this._active=!1,this._finishTimeout=setTimeout((()=>
vendor: 6,463 bytes, line 628
628{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout}),200)),{noInertia:!0,needsRenderFrame:!M,zoomDelta:x-r.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(r){let f=h.b9;if(this._prevEase){const _=this._prevEase,y=(N.now()-_.start)/_.duration,x=_.easing(y+.01)-_.easing(y),M=.27/Math.sqrt(x*x+1e-4)*.01,D=Math.sqrt(.0729-M*M);f=h.b8(M,D,.25,1)}return this._prevEase={start:N.now(),duration:r,easing:f},f}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class zr{constructor(r,f){this._clickZoom=r,this._tapZoom=f}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 Da{constructor(r){this._tr=new ns(r),this.reset()}reset(){this._active=!1}dblclick(r,f){return r.preventDefault(),{cameraAnimation:_=>{_.easeTo({duration:300,zoom:this._tr.zoom+(r.shiftKey?-1:1),around:this._tr.unproject(f)},{originalEvent:r})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class rf{constructor(){this._tap=new yc({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(r,f,_){if(!this._swipePoint)if(this._tapTime){const y=f[0],x=r.timeStamp-this._tapTime<500,M=this._tapPoint.dist(y)<30;x&&M?_.length>0&&(this._swipePoint=y,this._swipeTouch=_[0].identifier):this.reset()}else this._tap.touchstart(r,f,_)}touchmove(r,f,_){if(this._tapTime){if(this._swipePoint){if(_[0].identifier!==this._swipeTouch)return;const y=f[0],x=y.y-this._swipePoint.y;return this._swipePoint=y,r.preventDefault(),this._active=!0,{zoomDelta:x/128}}}else this._tap.touchmove(r,f,_)}touchend(r,f,_){if(this._tapTime)this._swipePoint&&_.length===0&&this.reset();else{const y=this._tap.touchend(r,f,_);y&&(this._tapTime=r.timeStamp,this._tapPoint=y)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class _u{constructor(r,f,_){this._el=r,this._mousePan=f,this._touchPan=_}enable(r){this._inertiaOptions=r||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class yu{constructor(r,f,_){this._pitchWithRotate=r.pitchWithRotate,this._mouseRotate=f,this._mousePitch=_}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 vu{constructor(r,f,_,y){this._el=r,this._touchZoom=f,this._touchRotate=_,this._tapDragZoom=y,this._rotationDisabled=!1,this._enabled=!0}enable(r){this._touchZoom.enable(r),this._rotationDisabled||this._touchRotate.enable(r),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-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()}}class Wn{constructor(r,f){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=r,this._options=f,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const r=this._map.getCanvasContainer();r.classList.add("maplibregl-cooperative-gestures"),this._container=F.create("div","maplibregl-cooperative-gesture-screen",r);let f=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(f=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const _=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),y=document.createElement("div");y.className="maplibregl-desktop-message",y.textContent=f,this._container.appendChild(y);const x=document.createElement("div");x.className="maplibregl-mobile-message",x.textContent=_,this._container.appendChild(x),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(F.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(r){return r[this._bypassKey]}notifyGestureBlocked(r,f){this._enabled&&(this._map.fire(new h.k("cooperativegestureprevented",{gestureType:r,originalEvent:f})),this._container.classList.add("maplibregl-show"),setTimeout((()=>{this._container.classList.remove("maplibregl-show")}),100))}}const Bi=w=>w.zoom||w.drag||w.pitch||w.rotate;class lt extends h.k{}function Ks(w){return w.panDelta&&w.panDelta.mag()||w.zoomDelta||w.bearingDelta||w.pitchDelta}class as{constructor(r,f){this.handleWindowEvent=y=>{this.handleEvent(y,`${y.type}Window`)},this.handleEvent=(y,x)=>{if(y.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const M=y.type==="renderFrame"?void 0:y,D={needsRenderFrame:!1},O={},L={},$=y.touches,H=$?this._getMapTouches($):void 0,G=H?F.touchPos(this._map.getCanvas(),H):F.mousePos(this._map.getCanvas(),y);for(const{handlerName:he,handler:pe,allowed:ge}of this._handlers){if(!pe.isEnabled())continue;let be;this._blockedByActive(L,ge,he)?pe.reset():pe[x||y.type]&&(be=pe[x||y.type](y,G,H),this.mergeHandlerResult(D,O,be,he,M),be&&be.needsRenderFrame&&this._triggerRe
vendor: 5,008 bytes, line 628
628nderFrame()),(be||pe.isActive())&&(L[he]=pe)}const ee={};for(const he in this._previousActiveHandlers)L[he]||(ee[he]=M);this._previousActiveHandlers=L,(Object.keys(ee).length||Ks(D))&&(this._changes.push([D,O,ee]),this._triggerRenderFrame()),(Object.keys(L).length||Ks(D))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:ne}=D;ne&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],ne(this._map))},this._map=r,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new pu(r),this._bearingSnap=f.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(f);const _=this._el;this._listeners=[[_,"touchstart",{passive:!0}],[_,"touchmove",{passive:!1}],[_,"touchend",void 0],[_,"touchcancel",void 0],[_,"mousedown",void 0],[_,"mousemove",void 0],[_,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[_,"mouseover",void 0],[_,"mouseout",void 0],[_,"dblclick",void 0],[_,"click",void 0],[_,"keydown",{capture:!1}],[_,"keyup",void 0],[_,"wheel",{passive:!1}],[_,"contextmenu",void 0],[window,"blur",void 0]];for(const[y,x,M]of this._listeners)F.addEventListener(y,x,y===document?this.handleWindowEvent:this.handleEvent,M)}destroy(){for(const[r,f,_]of this._listeners)F.removeEventListener(r,f,r===document?this.handleWindowEvent:this.handleEvent,_)}_addDefaultHandlers(r){const f=this._map,_=f.getCanvasContainer();this._add("mapEvent",new Fo(f,r));const y=f.boxZoom=new Br(f,r);this._add("boxZoom",y),r.interactive&&r.boxZoom&&y.enable();const x=f.cooperativeGestures=new Wn(f,r.cooperativeGestures);this._add("cooperativeGestures",x),r.cooperativeGestures&&x.enable();const M=new Pa(f),D=new Da(f);f.doubleClickZoom=new zr(D,M),this._add("tapZoom",M),this._add("clickZoom",D),r.interactive&&r.doubleClickZoom&&f.doubleClickZoom.enable();const O=new rf;this._add("tapDragZoom",O);const L=f.touchPitch=new io(f);this._add("touchPitch",L),r.interactive&&r.touchPitch&&f.touchPitch.enable(r.touchPitch);const $=mu(r),H=Sl(r);f.dragRotate=new yu(r,$,H),this._add("mouseRotate",$,["mousePitch"]),this._add("mousePitch",H,["mouseRotate"]),r.interactive&&r.dragRotate&&f.dragRotate.enable();const G=(({enable:be,clickTolerance:le})=>{const Ce=new Nr({checkCorrectEvent:Ie=>F.mouseButton(Ie)===0&&!Ie.ctrlKey});return new rs({clickTolerance:le,move:(Ie,ze)=>({around:ze,panDelta:ze.sub(Ie)}),activateOnStart:!0,moveStateManager:Ce,enable:be,assignEvents:Ms})})(r),ee=new gs(r,f);f.dragPan=new _u(_,G,ee),this._add("mousePan",G),this._add("touchPan",ee,["touchZoom","touchRotate"]),r.interactive&&r.dragPan&&f.dragPan.enable(r.dragPan);const ne=new to,he=new gu;f.touchZoomRotate=new vu(_,he,ne,O),this._add("touchRotate",ne,["touchPan","touchZoom"]),this._add("touchZoom",he,["touchPan","touchRotate"]),r.interactive&&r.touchZoomRotate&&f.touchZoomRotate.enable(r.touchZoomRotate);const pe=f.scrollZoom=new rr(f,(()=>this._triggerRenderFrame()));this._add("scrollZoom",pe,["mousePan"]),r.interactive&&r.scrollZoom&&f.scrollZoom.enable(r.scrollZoom);const ge=f.keyboard=new zn(f);this._add("keyboard",ge),r.interactive&&r.keyboard&&f.keyboard.enable(),this._add("blockableMapEvent",new Rn(f))}_add(r,f,_){this._handlers.push({handlerName:r,handler:f,allowed:_}),this._handlersById[r]=f}stop(r){if(!this._updatingCamera){for(const{handler:f}of this._handlers)f.reset();this._inertia.clear(),this._fireEvents({},{},r),this._changes=[]}}isActive(){for(const{handler:r}of this._handlers)if(r.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Bi(this._eventsInProgress)||this.isZooming()}_blockedByActive(r,f,_){for(const y in r)if(y!==_&&(!f||f.indexOf(y)<0))return!0;return!1}_getMapTouches(r){const f=[];for(const _ of r)this._el.contains(_.target)&&f.push(_);return f}mergeHandlerResult(r,f,_,y,x){if(!_)return;h.e(r,_);const M={handlerName:y,originalEvent:_.originalEvent||x};_.zoomDelta!==void 0&&(f.zoom=M),_.panDelta!==void 0&&(f.drag=M),_.pitchDelta!==void 0&&(f.pitch=M),_.bearingDelta!==void 0&&(f.rotate=M)}_applyChanges(){const r={},f={},_={};for(const[y,x,M]of this._changes)y.panDelta&&(r.panDelta=(r.panDelta||new h.P(0,0))._add(y.panDelta)),y.zoomDelta&&(r.zoomDelta=(r.zoomDelta||0)+y.zoomDelta),y.bearingDelta&&(r.bearingDelta=(r.bearingDelta||0)+y.bearingDelta),y.pitchDelta&&(r.pitchDelta=(r.pitchDelta||0)+y.pitchDelta),y.around!==void 0&&(r.around=y.around),y.pinchAround!==void 0&&(r.pinchAround=y.pinchAround),y.noInertia&&(r.noInertia=y.noInertia),h.e(f,x),h.e(_,M);this._updateMapTransform(r,f,_),this._changes=[]}_updateMapTransform(r,f,_){const y=this._map,x=y._getTransformForUpdate(),M=y.terrain;if(!(Ks(r)||M&&this._terrainMovement))return this._fireEvents(f,_,!0);let{panDelta:D,zoomDelta:O,bearingDelta:L,pitchDelta:$,around:H,pinchAround:G}=r;G!==void 0&&(H=G),y._stop(!0),H=H||y.transform.centerPoint;
vendor: 36,580 bytes, line 628
628const ee=x.pointLocation(D?H.sub(D):H);L&&(x.bearing+=L),$&&(x.pitch+=$),O&&(x.zoom+=O),M?this._terrainMovement||!f.drag&&!f.zoom?f.drag&&this._terrainMovement?x.center=x.pointLocation(x.centerPoint.sub(D)):x.setLocationAtPoint(ee,H):(this._terrainMovement=!0,this._map._elevationFreeze=!0,x.setLocationAtPoint(ee,H)):x.setLocationAtPoint(ee,H),y._applyUpdatedTransform(x),this._map._update(),r.noInertia||this._inertia.record(r),this._fireEvents(f,_,!0)}_fireEvents(r,f,_){const y=Bi(this._eventsInProgress),x=Bi(r),M={};for(const H in r){const{originalEvent:G}=r[H];this._eventsInProgress[H]||(M[`${H}start`]=G),this._eventsInProgress[H]=r[H]}!y&&x&&this._fireEvent("movestart",x.originalEvent);for(const H in M)this._fireEvent(H,M[H]);x&&this._fireEvent("move",x.originalEvent);for(const H in r){const{originalEvent:G}=r[H];this._fireEvent(H,G)}const D={};let O;for(const H in this._eventsInProgress){const{handlerName:G,originalEvent:ee}=this._eventsInProgress[H];this._handlersById[G].isActive()||(delete this._eventsInProgress[H],O=f[G]||ee,D[`${H}end`]=O)}for(const H in D)this._fireEvent(H,D[H]);const L=Bi(this._eventsInProgress),$=(y||x)&&!L;if($&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const H=this._map._getTransformForUpdate();H.recalculateZoom(this._map.terrain),this._map._applyUpdatedTransform(H)}if(_&&$){this._updatingCamera=!0;const H=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),G=ee=>ee!==0&&-this._bearingSnap<ee&&ee<this._bearingSnap;!H||!H.essential&&N.prefersReducedMotion?(this._map.fire(new h.k("moveend",{originalEvent:O})),G(this._map.getBearing())&&this._map.resetNorth()):(G(H.bearing||this._map.getBearing())&&(H.bearing=0),H.freezeElevation=!0,this._map.easeTo(H,{originalEvent:O})),this._updatingCamera=!1}}_fireEvent(r,f){this._map.fire(new h.k(r,f?{originalEvent:f}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add((r=>{delete this._frameId,this.handleEvent(new lt("renderFrame",{timeStamp:r})),this._applyChanges()}))}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class bu extends h.E{constructor(r,f){super(),this._renderFrameCallback=()=>{const _=Math.min((N.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(_)),_<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=r,this._bearingSnap=f.bearingSnap,this.on("moveend",(()=>{delete this._requestedCameraState}))}getCenter(){return new h.N(this.transform.center.lng,this.transform.center.lat)}setCenter(r,f){return this.jumpTo({center:r},f)}panBy(r,f,_){return r=h.P.convert(r).mult(-1),this.panTo(this.transform.center,h.e({offset:r},f),_)}panTo(r,f,_){return this.easeTo(h.e({center:r},f),_)}getZoom(){return this.transform.zoom}setZoom(r,f){return this.jumpTo({zoom:r},f),this}zoomTo(r,f,_){return this.easeTo(h.e({zoom:r},f),_)}zoomIn(r,f){return this.zoomTo(this.getZoom()+1,r,f),this}zoomOut(r,f){return this.zoomTo(this.getZoom()-1,r,f),this}getBearing(){return this.transform.bearing}setBearing(r,f){return this.jumpTo({bearing:r},f),this}getPadding(){return this.transform.padding}setPadding(r,f){return this.jumpTo({padding:r},f),this}rotateTo(r,f,_){return this.easeTo(h.e({bearing:r},f),_)}resetNorth(r,f){return this.rotateTo(0,h.e({duration:1e3},r),f),this}resetNorthPitch(r,f){return this.easeTo(h.e({bearing:0,pitch:0,duration:1e3},r),f),this}snapToNorth(r,f){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(r,f):this}getPitch(){return this.transform.pitch}setPitch(r,f){return this.jumpTo({pitch:r},f),this}cameraForBounds(r,f){r=_e.convert(r).adjustAntiMeridian();const _=f&&f.bearing||0;return this._cameraForBoxAndBearing(r.getNorthWest(),r.getSouthEast(),_,f)}_cameraForBoxAndBearing(r,f,_,y){const x={top:0,bottom:0,right:0,left:0};if(typeof(y=h.e({padding:x,offset:[0,0],maxZoom:this.transform.maxZoom},y)).padding=="number"){const xt=y.padding;y.padding={top:xt,bottom:xt,right:xt,left:xt}}y.padding=h.e(x,y.padding);const M=this.transform,D=M.padding,O=new _e(r,f),L=M.project(O.getNorthWest()),$=M.project(O.getNorthEast()),H=M.project(O.getSouthEast()),G=M.project(O.getSouthWest()),ee=h.ba(-_),ne=L.rotate(ee),he=$.rotate(ee),pe=H.rotate(ee),ge=G.rotate(ee),be=new h.P(Math.max(ne.x,he.x,ge.x,pe.x),Math.max(ne.y,he.y,ge.y,pe.y)),le=new h.P(Math.min(ne.x,he.x,ge.x,pe.x),Math.min(ne.y,he.y,ge.y,pe.y)),Ce=be.sub(le),Ie=(M.width-(D.left+D.right+y.padding.left+y.padding.right))/Ce.x,ze=(M.height-(D.top+D.bottom+y.padding.top+y.padding.bottom))/Ce.y;if(ze<0||Ie<0)return void h.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");const Ge=Math.min(M.scaleZoom(M.scale*Math.min(Ie,ze)),y.maxZoom),dt=h.P.convert(y.offset),vt=new h.P((y.padding.left-y.padding.right)/2,(y.padding.top-y.padding.bottom)/2).rotate(h.ba(_)),Mt=dt.add(vt).mult(M.scale/M.zoomScale(Ge));return{center:M.unproject(L.add(H).div(2).sub(Mt)),zoom:Ge,bearing:_}}fitBounds(r,f,_){return this._fitInternal(this.cameraForBounds(r,f),f,_)}fitScreenCoordinates(r,f,_,y,x){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(h.P.convert(r)),this.transform.pointLocation(h.P.convert(f)),_,y),y,x)}_fitInternal(r,f,_){return r?(delete(f=h.e(r,f)).padding,f.linear?this.easeTo(f,_):this.flyTo(f,_)):this}jumpTo(r,f){this.stop();const _=this._getTransformForUpdate();let y=!1,x=!1,M=!1;return"zoom"in r&&_.zoom!==+r.zoom&&(y=!0,_.zoom=+r.zoom),r.center!==void 0&&(_.center=h.N.convert(r.center)),"bearing"in r&&_.bearing!==+r.bearing&&(x=!0,_.bearing=+r.bearing),"pitch"in r&&_.pitch!==+r.pitch&&(M=!0,_.pitch=+r.pitch),r.padding==null||_.isPaddingEqual(r.padding)||(_.padding=r.padding),this._applyUpdatedTransform(_),this.fire(new h.k("movestart",f)).fire(new h.k("move",f)),y&&this.fire(new h.k("zoomstart",f)).fire(new h.k("zoom",f)).fire(new h.k("zoomend",f)),x&&this.fire(new h.k("rotatestart",f)).fire(new h.k("rotate",f)).fire(new h.k("rotateend",f)),M&&this.fire(new h.k("pitchstart",f)).fire(new h.k("pitch",f)).fire(new h.k("pitchend",f)),this.fire(new h.k("moveend",f))}calculateCameraOptionsFromTo(r,f,_,y=0){const x=h.Z.fromLngLat(r,f),M=h.Z.fromLngLat(_,y),D=M.x-x.x,O=M.y-x.y,L=M.z-x.z,$=Math.hypot(D,O,L);if($===0)throw new Error("Can't calculate camera options with same From and To");const H=Math.hypot(D,O),G=this.transform.scaleZoom(this.transform.cameraToCenterDistance/$/this.transform.tileSize),ee=180*Math.atan2(D,-O)/Math.PI;let ne=180*Math.acos(H/$)/Math.PI;return ne=L<0?90-ne:90+ne,{center:M.toLngLat(),zoom:G,pitch:ne,bearing:ee}}easeTo(r,f){var _;this._stop(!1,r.easeId),((r=h.e({offset:[0,0],duration:500,easing:h.b9},r)).animate===!1||!r.essential&&N.prefersReducedMotion)&&(r.duration=0);const y=this._getTransformForUpdate(),x=y.zoom,M=y.bearing,D=y.pitch,O=y.padding,L="bearing"in r?this._normalizeBearing(r.bearing,M):M,$="pitch"in r?+r.pitch:D,H="padding"in r?r.padding:y.padding,G=h.P.convert(r.offset);let ee=y.centerPoint.add(G);const ne=y.pointLocation(ee),{center:he,zoom:pe}=y.getConstrained(h.N.convert(r.center||ne),(_=r.zoom)!==null&&_!==void 0?_:x);this._normalizeCenter(he,y);const ge=y.project(ne),be=y.project(he).sub(ge),le=y.zoomScale(pe-x);let Ce,Ie;r.around&&(Ce=h.N.convert(r.around),Ie=y.locationPoint(Ce));const ze={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||pe!==x,this._rotating=this._rotating||M!==L,this._pitching=this._pitching||$!==D,this._padding=!y.isPaddingEqual(H),this._easeId=r.easeId,this._prepareEase(f,r.noMoveStart,ze),this.terrain&&this._prepareElevation(he),this._ease((Ge=>{if(this._zooming&&(y.zoom=h.y.number(x,pe,Ge)),this._rotating&&(y.bearing=h.y.number(M,L,Ge)),this._pitching&&(y.pitch=h.y.number(D,$,Ge)),this._padding&&(y.interpolatePadding(O,H,Ge),ee=y.centerPoint.add(G)),this.terrain&&!r.freezeElevation&&this._updateElevation(Ge),Ce)y.setLocationAtPoint(Ce,Ie);else{const dt=y.zoomScale(y.zoom-x),vt=pe>x?Math.min(2,le):Math.max(.5,le),Mt=Math.pow(vt,1-Ge),xt=y.unproject(ge.add(be.mult(Ge*Mt)).mult(dt));y.setLocationAtPoint(y.renderWorldCopies?xt.wrap():xt,ee)}this._applyUpdatedTransform(y),this._fireMoveEvents(f)}),(Ge=>{this.terrain&&r.freezeElevation&&this._finalizeElevation(),this._afterEase(f,Ge)}),r),this}_prepareEase(r,f,_={}){this._moving=!0,f||_.moving||this.fire(new h.k("movestart",r)),this._zooming&&!_.zooming&&this.fire(new h.k("zoomstart",r)),this._rotating&&!_.rotating&&this.fire(new h.k("rotatestart",r)),this._pitching&&!_.pitching&&this.fire(new h.k("pitchstart",r))}_prepareElevation(r){this._elevationCenter=r,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(r,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(r){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const f=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(r<1&&f!==this._elevationTarget){const _=this._elevationTarget-this._elevationStart;this._elevationStart+=r*(_-(f-(_*r+this._elevationStart))/(1-r)),this._elevationTarget=f}this.transform.elevation=h.y.number(this._elevationStart,this._elevationTarget,r)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(r){const f=r.getCameraPosition(),_=this.terrain.getElevationForLngLatZoom(f.lngLat,r.zoom);if(f.altitude<_){const y=this.calculateCameraOptionsFromTo(f.lngLat,_,r.center,r.elevation);return{pitch:y.pitch,zoom:y.zoom}}return{}}_applyUpdatedTransform(r){const f=[];if(this.terrain&&f.push((y=>this._elevateCameraIfInsideTerrain(y))),this.transformCameraUpdate&&f.push((y=>this.transformCameraUpdate(y))),!f.length)return;const _=r.clone();for(const y of f){const x=_.clone(),{center:M,zoom:D,pitch:O,bearing:L,elevation:$}=y(x);M&&(x.center=M),D!==void 0&&(x.zoom=D),O!==void 0&&(x.pitch=O),L!==void 0&&(x.bearing=L),$!==void 0&&(x.elevation=$),_.apply(x)}this.transform.apply(_)}_fireMoveEvents(r){this.fire(new h.k("move",r)),this._zooming&&this.fire(new h.k("zoom",r)),this._rotating&&this.fire(new h.k("rotate",r)),this._pitching&&this.fire(new h.k("pitch",r))}_afterEase(r,f){if(this._easeId&&f&&this._easeId===f)return;delete this._easeId;const _=this._zooming,y=this._rotating,x=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,_&&this.fire(new h.k("zoomend",r)),y&&this.fire(new h.k("rotateend",r)),x&&this.fire(new h.k("pitchend",r)),this.fire(new h.k("moveend",r))}flyTo(r,f){var _;if(!r.essential&&N.prefersReducedMotion){const Ct=h.M(r,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Ct,f)}this.stop(),r=h.e({offset:[0,0],speed:1.2,curve:1.42,easing:h.b9},r);const y=this._getTransformForUpdate(),x=y.zoom,M=y.bearing,D=y.pitch,O=y.padding,L="bearing"in r?this._normalizeBearing(r.bearing,M):M,$="pitch"in r?+r.pitch:D,H="padding"in r?r.padding:y.padding,G=h.P.convert(r.offset);let ee=y.centerPoint.add(G);const ne=y.pointLocation(ee),{center:he,zoom:pe}=y.getConstrained(h.N.convert(r.center||ne),(_=r.zoom)!==null&&_!==void 0?_:x);this._normalizeCenter(he,y);const ge=y.zoomScale(pe-x),be=y.project(ne),le=y.project(he).sub(be);let Ce=r.curve;const Ie=Math.max(y.width,y.height),ze=Ie/ge,Ge=le.mag();if("minZoom"in r){const Ct=h.ac(Math.min(r.minZoom,x,pe),y.minZoom,y.maxZoom),Qt=Ie/y.zoomScale(Ct-x);Ce=Math.sqrt(Qt/Ge*2)}const dt=Ce*Ce;function vt(Ct){const Qt=(ze*ze-Ie*Ie+(Ct?-1:1)*dt*dt*Ge*Ge)/(2*(Ct?ze:Ie)*dt*Ge);return Math.log(Math.sqrt(Qt*Qt+1)-Qt)}function Mt(Ct){return(Math.exp(Ct)-Math.exp(-Ct))/2}function xt(Ct){return(Math.exp(Ct)+Math.exp(-Ct))/2}const ft=vt(!1);let Ot=function(Ct){return xt(ft)/xt(ft+Ce*Ct)},ni=function(Ct){return Ie*((xt(ft)*(Mt(Qt=ft+Ce*Ct)/xt(Qt))-Mt(ft))/dt)/Ge;var Qt},wt=(vt(!0)-ft)/Ce;if(Math.abs(Ge)<1e-6||!isFinite(wt)){if(Math.abs(Ie-ze)<1e-6)return this.easeTo(r,f);const Ct=ze<Ie?-1:1;wt=Math.abs(Math.log(ze/Ie))/Ce,ni=()=>0,Ot=Qt=>Math.exp(Ct*Ce*Qt)}return r.duration="duration"in r?+r.duration:1e3*wt/("screenSpeed"in r?+r.screenSpeed/Ce:+r.speed),r.maxDuration&&r.duration>r.maxDuration&&(r.duration=0),this._zooming=!0,this._rotating=M!==L,this._pitching=$!==D,this._padding=!y.isPaddingEqual(H),this._prepareEase(f,!1),this.terrain&&this._prepareElevation(he),this._ease((Ct=>{const Qt=Ct*wt,Ki=1/Ot(Qt);y.zoom=Ct===1?pe:x+y.scaleZoom(Ki),this._rotating&&(y.bearing=h.y.number(M,L,Ct)),this._pitching&&(y.pitch=h.y.number(D,$,Ct)),this._padding&&(y.interpolatePadding(O,H,Ct),ee=y.centerPoint.add(G)),this.terrain&&!r.freezeElevation&&this._updateElevation(Ct);const mi=Ct===1?he:y.unproject(be.add(le.mult(ni(Qt))).mult(Ki));y.setLocationAtPoint(y.renderWorldCopies?mi.wrap():mi,ee),this._applyUpdatedTransform(y),this._fireMoveEvents(f)}),(()=>{this.terrain&&r.freezeElevation&&this._finalizeElevation(),this._afterEase(f)}),r),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(r,f){var _;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const y=this._onEaseEnd;delete this._onEaseEnd,y.call(this,f)}return r||(_=this.handlers)===null||_===void 0||_.stop(!1),this}_ease(r,f,_){_.animate===!1||_.duration===0?(r(1),f()):(this._easeStart=N.now(),this._easeOptions=_,this._onEaseFrame=r,this._onEaseEnd=f,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(r,f){r=h.b3(r,-180,180);const _=Math.abs(r-f);return Math.abs(r-360-f)<_&&(r-=360),Math.abs(r+360-f)<_&&(r+=360),r}_normalizeCenter(r,f){if(!f.renderWorldCopies||f.lngRange)return;const _=r.lng-f.center.lng;r.lng+=_>180?-360:_<-180?360:0}queryTerrainElevation(r){return this.terrain?this.terrain.getElevationForLngLatZoom(h.N.convert(r),this.transform.tileZoom)-this.transform.elevation:null}}const _s={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class jo{constructor(r=_s){this._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")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=f=>{!f||f.sourceDataType!=="metadata"&&f.sourceDataType!=="visibility"&&f.dataType!=="style"&&f.type!=="terrain"||this._updateAttributions()},this._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","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=r}getDefaultPosition(){return"bottom-right"}onAdd(r){return this._map=r,this._compact=this.options.compact,this._container=F.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=F.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=F.create("div","maplibregl-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(){F.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(r,f){const _=this._map._getUIString(`AttributionControl.${f}`);r.title=_,r.setAttribute("aria-label",_)}_updateAttributions(){if(!this._map.style)return;let r=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?r=r.concat(this.options.customAttribution.map((y=>typeof y!="string"?"":y))):typeof this.options.customAttribution=="string"&&r.push(this.options.customAttribution)),this._map.style.stylesheet){const y=this._map.style.stylesheet;this.styleOwner=y.owner,this.styleId=y.id}const f=this._map.style.sourceCaches;for(const y in f){const x=f[y];if(x.used||x.usedForTerrain){const M=x.getSource();M.attribution&&r.indexOf(M.attribution)<0&&r.push(M.attribution)}}r=r.filter((y=>String(y).trim())),r.sort(((y,x)=>y.length-x.length)),r=r.filter(((y,x)=>{for(let M=x+1;M<r.length;M++)if(r[M].indexOf(y)>=0)return!1;return!0}));const _=r.join(" | ");_!==this._attribHTML&&(this._attribHTML=_,r.length?(this._innerContainer.innerHTML=_,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class xu{constructor(r={}){this._updateCompact=()=>{const f=this._container.children;if(f.length){const _=f[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&_.classList.add("maplibregl-compact"):_.classList.remove("maplibregl-compact")}},this.options=r}getDefaultPosition(){return"bottom-left"}onAdd(r){this._map=r,this._compact=this.options&&this.options.compact,this._container=F.create("div","maplibregl-ctrl");const f=F.create("a","maplibregl-ctrl-logo");return f.target="_blank",f.rel="noopener nofollow",f.href="https://maplibre.org/",f.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),f.setAttribute("rel","noopener nofollow"),this._container.appendChild(f),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){F.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class _i{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(r){const f=++this._id;return this._queue.push({callback:r,id:f,cancelled:!1}),f}remove(r){const f=this._currentlyRunning,_=f?this._queue.concat(f):this._queue;for(const y of _)if(y.id===r)return void(y.cancelled=!0)}run(r=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const f=this._currentlyRunning=this._queue;this._queue=[];for(const _ of f)if(!_.cancelled&&(_.callback(r),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var Oa=h.Y([{name:"a_pos3d",type:"Int16",components:3}]);class Ih extends h.E{constructor(r){super(),this.sourceCache=r,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,r.usedForTerrain=!0,r.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(r,f){this.sourceCache.update(r,f),this._renderableTilesKeys=[];const _={};for(const y of r.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:f}))_[y.key]=!0,this._renderableTilesKeys.push(y.key),this._tiles[y.key]||(y.posMatrix=new Float64Array(16),h.aP(y.posMatrix,0,h.X,0,h.X,0,1),this._tiles[y.key]=new Za(y,this.tileSize));for(const y in this._tiles)_[y]||delete this._tiles[y]}freeRtt(r){for(const f in this._tiles){const _=this._tiles[f];(!r||_.tileID.equals(r)||_.tileID.isChildOf(r)||r.isChildOf(_.tileID))&&(_.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map((r=>this.getTileByID(r)))}getTileByID(r){return this._tiles[r]}getTerrainCoords(r){const f={};for(const _ of this._renderableTilesKeys){const y=this._tiles[_].tileID;if(y.canonical.equals(r.canonical)){const x=r.clone();x.posMatrix=new Float64Array(16),h.aP(x.posMatrix,0,h.X,0,h.X,0,1),f[_]=x}else if(y.canonical.isChildOf(r.canonical)){const x=r.clone();x.posMatrix=new Float64Array(16);const M=y.canonical.z-r.canonical.z,D=y.canonical.x-(y.canonical.x>>M<<M),O=y.canonical.y-(y.canonical.y>>M<<M),L=h.X>>M;h.aP(x.posMatrix,0,L,0,L,0,1),h.J(x.posMatrix,x.posMatrix,[-D*L,-O*L,0]),f[_]=x}else if(r.canonical.isChildOf(y.canonical)){const x=r.clone();x.posMatrix=new Float64Array(16);const M=r.canonical.z-y.canonical.z,D=r.canonical.x-(r.canonical.x>>M<<M),O=r.canonical.y-(r.canonical.y>>M<<M),L=h.X>>M;h.aP(x.posMatrix,0,h.X,0,h.X,0,1),h.J(x.posMatrix,x.posMatrix,[D*L,O*L,0]),h.K(x.posMatrix,x.posMatrix,[1/2**M,1/2**M,0]),f[_]=x}}return f}getSourceTile(r,f){const _=this.sourceCache._source;let y=r.overscaledZ-this.deltaZoom;if(y>_.maxzoom&&(y=_.maxzoom),y<_.minzoom)return null;this._sourceTileCache[r.key]||(this._sourceTileCache[r.key]=r.scaledTo(y).key);let x=this.sourceCache.getTileByID(this._sourceTileCache[r.key]);if((!x||!x.dem)&&f)for(;y>=_.minzoom&&(!x||!x.dem);)x=this.sourceCache.getTileByID(r.scaledTo(y--).key);return x}tilesAfterTime(r=Date.now()){return Object.values(this._tiles).filter((f=>f.timeAdded>=r))}}class Vo{constructor(r,f,_){this.painter=r,this.sourceCache=new Ih(f),this.options=_,this.exaggeration=typeof _.exaggeration=="number"?_.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(r,f,_,y=h.X){var x;if(!(f>=0&&f<y&&_>=0&&_<y))return 0;const M=this.getTerrainData(r),D=(x=M.tile)===null||x===void 0?void 0:x.dem;if(!D)return 0;const O=(function(ne,he,pe){var ge=he[0],be=he[1];return ne[0]=pe[0]*ge+pe[4]*be+pe[12],ne[1]=pe[1]*ge+pe[5]*be+pe[13],ne})([],[f/y*h.X,_/y*h.X],M.u_terrain_matrix),L=[O[0]*D.dim,O[1]*D.dim],$=Math.floor(L[0]),H=Math.floor(L[1]),G=L[0]-$,ee=L[1]-H;return D.get($,H)*(1-G)*(1-ee)+D.get($+1,H)*G*(1-ee)+D.get($,H+1)*(1-G)*ee+D.get($+1,H+1)*G*ee}getElevationForLngLatZoom(r,f){if(!h.bb(f,r.wrap()))return 0;const{tileID:_,mercatorX:y,mercatorY:x}=this._getOverscaledTileIDFromLngLatZoom(r,f);return this.getElevation(_,y%h.X,x%h.X,h.X)}getElevation(r,f,_,y=h.X){return this.getDEMElevation(r,f,_,y)*this.exaggeration}getTerrainData(r){if(!this._emptyDemTexture){const y=this.painter.context,x=new h.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new Qe(y,x,y.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new Qe(y,new h.R({width:1,height:1}),y.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(y.gl.NEAREST,y.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=h.an([])}const f=this.sourceCache.getSourceTile(r,!0);if(f&&f.dem&&(!f.demTexture||f.needsTerrainPrepare)){const y=this.painter.context;f.demTexture=this.painter.getTileTexture(f.dem.stride),f.demTexture?f.demTexture.update(f.dem.getPixels(),{premultiply:!1}):f.demTexture=new Qe(y,f.dem.getPixels(),y.gl.RGBA,{premultiply:!1}),f.demTexture.bind(y.gl.NEAREST,y.gl.CLAMP_TO_EDGE),f.needsTerrainPrepare=!1}const _=f&&f+f.tileID.key+r.key;if(_&&!this._demMatrixCache[_]){const y=this.sourceCache.sourceCache._source.maxzoom;let x=r.canonical.z-f.tileID.canonical.z;r.overscaledZ>r.canonical.z&&(r.canonical.z>=y?x=r.canonical.z-y:h.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const M=r.canonical.x-(r.canonical.x>>x<<x),D=r.canonical.y-(r.canonical.y>>x<<x),O=h.bc(new Float64Array(16),[1/(h.X<<x),1/(h.X<<x),0]);h.J(O,O,[M*h.X,D*h.X,0]),this._demMatrixCache[r.key]={matrix:O,coord:r}}return{u_depth:2,u_terrain:3,u_terrain_dim:f&&f.dem&&f.dem.dim||1,u_terrain_matrix:_?this._demMatrixCache[r.key].matrix:this._emptyDemMatrix,u_terrain_unpack:f&&f.dem&&f.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(f&&f.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:f}}getFramebuffer(r){const f=this.painter,_=f.width/devicePixelRatio,y=f.height/devicePixelRatio;return!this._fbo||this._fbo.width===_&&this._fbo.height===y||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new Qe(f.context,{width:_,height:y,data:null},f.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(f.context.gl.NEAREST,f.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new Qe(f.context,{width:_,height:y,data:null},f.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(f.context.gl.NEAREST,f.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=f.context.createFramebuffer(_,y,!0,!1),this._fbo.depthAttachment.set(f.context.createRenderbuffer(f.context.gl.DEPTH_COMPONENT16,_,y))),this._fbo.colorAttachment.set(r==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const r=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const f=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let x=0,M=0;x<this._coordsTextureSize;x++)for(let D=0;D<this._coordsTextureSize;D++,M+=4)f[M+0]=255&D,f[M+1]=255&x,f[M+2]=D>>8<<4|x>>8,f[M+3]=0;const _=new h.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(f.buffer)),y=new Qe(r,_,r.gl.RGBA,{premultiply:!1});return y.bind(r.gl.NEAREST,r.gl.CLAMP_TO_EDGE),this._coordsTexture=y,y}pointCoordinate(r){this.painter.maybeDrawDepthAndCoords(!0);const f=new Uint8Array(4),_=this.painter.context,y=_.gl,x=Math.round(r.x*this.painter.pixelRatio/devicePixelRatio),M=Math.round(r.y*this.painter.pixelRatio/devicePixelRatio),D=Math.round(this.painter.height/devicePixelRatio);_.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),y.readPixels(x,D-M-1,1,1,y.RGBA,y.UNSIGNED_BYTE,f),_.bindFramebuffer.set(null);const O=f[0]+(f[2]>>4<<8),L=f[1]+((15&f[2])<<8),$=this.coordsIndex[255-f[3]],H=$&&this.sourceCache.getTileByID($);if(!H)return null;const G=this._coordsTextureSize,ee=(1<<H.tileID.canonical.z)*G;return new h.Z((H.tileID.canonical.x*G+O)/ee+H.tileID.wrap,(H.tileID.canonical.y*G+L)/ee,this.getElevation(H.tileID,O,L,G))}depthAtPoint(r){const f=new Uint8Array(4),_=this.painter.context,y=_.gl;return _.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),y.readPixels(r.x,this.painter.height/devicePixelRatio-r.y-1,1,1,y.RGBA,y.UNSIGNED_BYTE,f),_.bindFramebuffer.set(null),(f[0]/16777216+f[1]/65536+f[2]/256+f[3])/256}getTerrainMesh(){if(this._mesh)return this._mesh;const r=this.painter.context,f=new h.bd,_=new h.aY,y=this.meshSize,x=h.X/y,M=y*y;for(let H=0;H<=y;H++)for(let G=0;G<=y;G++)f.emplaceBack(G*x,H*x,0);for(let H=0;H<M;H+=y+1)for(let G=0;G<y;G++)_.emplaceBack(G+H,y+G+H+1,y+G+H+2),_.emplaceBack(G+H,y+G+H+2,G+H+1);const D=f.length,O=D+2*(y+1);for(const H of[0,1])for(let G=0;G<=y;G++)for(const ee of[0,1])f.emplaceBack(G*x,H*h.X,ee);for(let H=0;H<2*y;H+=2)_.emplaceBack(O+H,O+H+1,O+H+3),_.emplaceBack(O+H,O+H+3,O+H+2),_.emplaceBack(D+H,D+H+3,D+H+1),_.emplaceBack(D+H,D+H+2,D+H+3);const L=f.length,$=L+2*(y+1);for(const H of[0,1])for(let G=0;G<=y;G++)for(const ee of[0,1])f.emplaceBack(H*h.X,G*x,ee);for(let H=0;H<2*y;H+=2)_.emplaceBack(L+H,L+H+1,L+H+3),_.emplaceBack(L+H,L+H+3,L+H+2),_.emplaceBack($+H,$+H+3,$+H+1),_.emplaceBack($+H,$+H+2,$+H+3);return this._mesh=new eo(r.createVertexBuffer(f,Oa.members),r.createIndexBuffer(_),h.a0.simpleSegment(0,0,f.length,_.length)),this._mesh}getMeshFrameDelta(r){return 2*Math.PI*h.be/Math.pow(2,r)/5}getMinTileElevationForLngLatZoom(r,f){var _;const{tileID:y}=this._getOverscaledTileIDFromLngLatZoom(r,f);return(_=this.getMinMaxElevation(y).minElevation)!==null&&_!==void 0?_:0}getMinMaxElevation(r){const f=this.getTerrainData(r).tile,_={minElevation:null,maxElevation:null};return f&&f.dem&&(_.minElevation=f.dem.min*this.exaggeration,_.maxElevation=f.dem.max*this.exaggeration),_}_getOverscaledTileIDFromLngLatZoom(r,f){const _=h.Z.fromLngLat(r.wrap()),y=(1<<f)*h.X,x=_.x*y,M=_.y*y,D=Math.floor(x/h.X),O=Math.floor(M/h.X);return{tileID:new h.S(f,0,f,D,O),mercatorX:x,mercatorY:M}}}class Dh{constructor(r,f,_){this._context=r,this._size=f,this._tileSize=_,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const r of this._objects)r.texture.destroy(),r.fbo.destroy()}_createObject(r){const f=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),_=new Qe(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return _.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),f.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),f.colorAttachment.set(_.texture),{id:r,fbo:f,texture:_,stamp:-1,inUse:!1}}getObjectForId(r){return this._objects[r]}useObject(r){r.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter((f=>r.id!==f)),this._recentlyUsed.push(r.id)}stampObject(r){r.stamp=++this._stamp}getOrCreateFreeObject(){for(const f of this._recentlyUsed)if(!this._objects[f].inUse)return this._objects[f];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const r=this._createObject(this._objects.length);return this._objects.push(r),r}freeObject(r){r.inUse=!1}freeAllObjects(){for(const r of this._objects)this.freeObject(r)}isFull(){return!(this._objects.length<this._size)&&this._objects.some((r=>!r.inUse))===!1}}const Ps={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class ga{constructor(r,f){this.painter=r,this.terrain=f,this.pool=new Dh(r.context,30,f.sourceCache.tileSize*f.qualityFactor)}destruct(){this.pool.destruct()}getTexture(r){return this.pool.getObjectForId(r.rtt[this._stacks.length-1].id).texture}prepareForRender(r,f){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=r._order.filter((_=>!r._layers[_].isHidden(f))),this._coordsDescendingInv={};for(const _ in r.sourceCaches){this._coordsDescendingInv[_]={};const y=r.sourceCaches[_].getVisibleCoordinates();for(const x of y){const M=this.terrain.sourceCache.getTerrainCoords(x);for(const D in M)this._coordsDescendingInv[_][D]||(this._coordsDescendingInv[_][D]=[]),this._coordsDescendingInv[_][D].push(M[D])}}this._coordsDescendingInvStr={};for(const _ of r._order){const y=r._layers[_],x=y.source;if(Ps[y.type]&&!this._coordsDescendingInvStr[x]){this._coordsDescendingInvStr[x]={};for(const M in this._coordsDescendingInv[x])this._coordsDescendingInvStr[x][M]=this._coordsDescendingInv[x][M].map((D=>D.key)).sort().join()}}for(const _ of this._renderableTiles)for(const y in this._coordsDescendingInvStr){const x=this._coordsDescendingInvStr[y][_.tileID.key];x&&x!==_.rttCoords[y]&&(_.rtt=[])}}renderLayer(r){if(r.isHidden(this.painter.transform.zoom))return!1;const f=r.type,_=this.painter,y=this._renderableLayerIds[this._renderableLayerIds.length-1]===r.id;if(Ps[f]&&(this._prevType&&Ps[this._prevType]||this._stacks.push([]),this._prevType=f,this._stacks[this._stacks.length-1].push(r.id),!y))return!0;if(Ps[this._prevType]||Ps[f]&&y){this._prevType=f;const x=this._stacks.length-1,M=this._stacks[x]||[];for(const D of this._renderableTiles){if(this.pool.isFull()&&(hu(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(D),D.rtt[x]){const L=this.pool.getObjectForId(D.rtt[x].id);if(L.stamp===D.rtt[x].stamp){this.pool.useObject(L);continue}}const O=this.pool.getOrCreateFreeObject();this.pool.useObject(O),this.pool.stampObject(O),D.rtt[x]={id:O.id,stamp:O.stamp},_.context.bindFramebuffer.set(O.fbo.framebuffer),_.context.clear({color:h.aM.transparent,stencil:0}),_.currentStencilSource=void 0;for(let L=0;L<M.length;L++){const $=_.style._layers[M[L]],H=$.source?this._coordsDescendingInv[$.source][D.tileID.key]:[D.tileID];_.context.viewport.set([0,0,O.fbo.width,O.fbo.height]),_._renderTileClippingMasks($,H),_.renderLayer(_,_.style.sourceCaches[$.source],$,H),$.source&&(D.rttCoords[$.source]=this._coordsDescendingInvStr[$.source][D.tileID.key])}}return hu(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),Ps[f]}return!1}}const _a={"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":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use â + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},ya=A,Oh={hash:!1,interactive:!0,bearingSnap:7,attributionControl:_s,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,refreshExpiredTiles:!0,scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],zoom:0,bearing:0,pitch:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:h.a.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0},xc=w=>{w.touchstart=w.dragStart,w.touchmoveWindow=w.dragMove,w.touchend=w.dragEnd},Rl={showCompass:!0,showZoom:!0,visualizePitch:!1};class wu{constructor(r,f,_=!1){this.mousedown=M=>{this.startMouse(h.e({},M,{ctrlKey:!0,preventDefault:()=>M.preventDefault()}),F.mousePos(this.element,M)),F.addEventListener(window,"mousemove",this.mousemove),F.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=M=>{this.moveMouse(M,F.mousePos(this.element,M))},this.mouseup=M=>{this.mouseRotate.dragEnd(M),this.mousePitch&&this.mousePitch.dragEnd(M),this.offTemp()},this.touchstart=M=>{M.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=F.touchPos(this.element,M.targetTouches)[0],this.startTouch(M,this._startPos),F.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),F.addEventListener(window,"touchend",this.touchend))},this.touchmove=M=>{M.targetTouches.length!==1?this.reset():(this._lastPos=F.touchPos(this.element,M.targetTouches)[0],this.moveTouch(M,this._lastPos))},this.touchend=M=>{M.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const y=r.dragRotate._mouseRotate.getClickTolerance(),x=r.dragRotate._mousePitch.getClickTolerance();this.element=f,this.mouseRotate=mu({clickTolerance:y,enable:!0}),this.touchRotate=(({enable:M,clickTolerance:D,bearingDegreesPerPixelMoved:O=.8})=>
628{const L=new vc;return new rs({clickTolerance:D,move:($,H)=>({bearingDelta:(H.x-$.x)*O}),moveStateManager:L,enable:M,assignEvents:xc})})({clickTolerance:y,enable:!0}),this.map=r,_&&(this.mousePitch=Sl({clickTolerance:x,enable:!0}),this.touchPitch=(({enable:M,clickTolerance:D,pitchDegreesPerPixelMoved:O=-.5})=>{const L=new vc;return new rs({clickTolerance:D,move:($,H)=>({pitchDelta:(H.y-$.y)*O}),moveStateManager:L,enable:M,assignEvents:xc})})({clickTolerance:x,enable:!0})),F.addEventListener(f,"mousedown",this.mousedown),F.addEventListener(f,"touchstart",this.touchstart,{passive:!1}),F.addEventListener(f,"touchcancel",this.reset)}startMouse(r,f){this.mouseRotate.dragStart(r,f),this.mousePitch&&this.mousePitch.dragStart(r,f),F.disableDrag()}startTouch(r,f){this.touchRotate.dragStart(r,f),this.touchPitch&&this.touchPitch.dragStart(r,f),F.disableDrag()}moveMouse(r,f){const _=this.map,{bearingDelta:y}=this.mouseRotate.dragMove(r,f)||{};if(y&&_.setBearing(_.getBearing()+y),this.mousePitch){const{pitchDelta:x}=this.mousePitch.dragMove(r,f)||{};x&&_.setPitch(_.getPitch()+x)}}moveTouch(r,f){const _=this.map,{bearingDelta:y}=this.touchRotate.dragMove(r,f)||{};if(y&&_.setBearing(_.getBearing()+y),this.touchPitch){const{pitchDelta:x}=this.touchPitch.dragMove(r,f)||{};x&&_.setPitch(_.getPitch()+x)}}off(){const r=this.element;F.removeEventListener(r,"mousedown",this.mousedown),F.removeEventListener(r,"touchstart",this.touchstart,{passive:!1}),F.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),F.removeEventListener(window,"touchend",this.touchend),F.removeEventListener(r,"touchcancel",this.reset),this.offTemp()}offTemp(){F.enableDrag(),F.removeEventListener(window,"mousemove",this.mousemove),F.removeEventListener(window,"mouseup",this.mouseup),F.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),F.removeEventListener(window,"touchend",this.touchend)}}let dr;function xi(w,r,f){const _=new h.N(w.lng,w.lat);if(w=new h.N(w.lng,w.lat),r){const y=new h.N(w.lng-360,w.lat),x=new h.N(w.lng+360,w.lat),M=f.locationPoint(w).distSqr(r);f.locationPoint(y).distSqr(r)<M?w=y:f.locationPoint(x).distSqr(r)<M&&(w=x)}for(;Math.abs(w.lng-f.center.lng)>180;){const y=f.locationPoint(w);if(y.x>=0&&y.y>=0&&y.x<=f.width&&y.y<=f.height)break;w.lng>f.center.lng?w.lng-=360:w.lng+=360}return w.lng!==_.lng&&f.locationPoint(w).y>f.height/2-f.getHorizon()?w:_}const ka={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 wc(w,r,f){const _=w.classList;for(const y in ka)_.remove(`maplibregl-${f}-anchor-${y}`);_.add(`maplibregl-${f}-anchor-${r}`)}class Tu extends h.E{constructor(r){if(super(),this._onKeyPress=f=>{const _=f.code,y=f.charCode||f.keyCode;_!=="Space"&&_!=="Enter"&&y!==32&&y!==13||this.togglePopup()},this._onMapClick=f=>{const _=f.originalEvent.target,y=this._element;this._popup&&(_===y||y.contains(_))&&this.togglePopup()},this._update=f=>{var _;if(!this._map)return;const y=this._map.loaded()&&!this._map.isMoving();((f==null?void 0:f.type)==="terrain"||(f==null?void 0:f.type)==="render"&&!y)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?xi(this._lngLat,this._flatPos,this._map.transform):(_=this._lngLat)===null||_===void 0?void 0:_.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(this._lngLat)._add(this._offset));let x="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?x=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(x=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let M="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?M="rotateX(0deg)":this._pitchAlignment==="map"&&(M=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||f&&f.type!=="moveend"||(this._pos=this._pos.round()),F.setTransform(this._element,`${ka[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${M} ${x}`),N.frameAsync(new AbortController).then((()=>{this._updateOpacity(f&&f.type==="moveend")}
vendor: 16,174 bytes, line 628
628)).catch((()=>{}))},this._onMove=f=>{if(!this._isDragging){const _=this._clickTolerance||this._map._clickTolerance;this._isDragging=f.point.dist(this._pointerdownPos)>=_}this._isDragging&&(this._pos=f.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 h.k("dragstart"))),this.fire(new h.k("drag")))},this._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 h.k("dragend")),this._state="inactive"},this._addDragHandler=f=>{this._element.contains(f.originalEvent.target)&&(f.preventDefault(),this._positionDelta=f.point.sub(this._pos).add(this._offset),this._pointerdownPos=f.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))},this._anchor=r&&r.anchor||"center",this._color=r&&r.color||"#3FB1CE",this._scale=r&&r.scale||1,this._draggable=r&&r.draggable||!1,this._clickTolerance=r&&r.clickTolerance||0,this._subpixelPositioning=r&&r.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=r&&r.rotation||0,this._rotationAlignment=r&&r.rotationAlignment||"auto",this._pitchAlignment=r&&r.pitchAlignment&&r.pitchAlignment!=="auto"?r.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(r==null?void 0:r.opacity,r==null?void 0:r.opacityWhenCovered),r&&r.element)this._element=r.element,this._offset=h.P.convert(r&&r.offset||[0,0]);else{this._defaultMarker=!0,this._element=F.create("div");const f=F.createNS("http://www.w3.org/2000/svg","svg"),_=41,y=27;f.setAttributeNS(null,"display","block"),f.setAttributeNS(null,"height",`${_}px`),f.setAttributeNS(null,"width",`${y}px`),f.setAttributeNS(null,"viewBox",`0 0 ${y} ${_}`);const x=F.createNS("http://www.w3.org/2000/svg","g");x.setAttributeNS(null,"stroke","none"),x.setAttributeNS(null,"stroke-width","1"),x.setAttributeNS(null,"fill","none"),x.setAttributeNS(null,"fill-rule","evenodd");const M=F.createNS("http://www.w3.org/2000/svg","g");M.setAttributeNS(null,"fill-rule","nonzero");const D=F.createNS("http://www.w3.org/2000/svg","g");D.setAttributeNS(null,"transform","translate(3.0, 29.0)"),D.setAttributeNS(null,"fill","#000000");const O=[{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 ge of O){const be=F.createNS("http://www.w3.org/2000/svg","ellipse");be.setAttributeNS(null,"opacity","0.04"),be.setAttributeNS(null,"cx","10.5"),be.setAttributeNS(null,"cy","5.80029008"),be.setAttributeNS(null,"rx",ge.rx),be.setAttributeNS(null,"ry",ge.ry),D.appendChild(be)}const L=F.createNS("http://www.w3.org/2000/svg","g");L.setAttributeNS(null,"fill",this._color);const $=F.createNS("http://www.w3.org/2000/svg","path");$.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"),L.appendChild($);const H=F.createNS("http://www.w3.org/2000/svg","g");H.setAttributeNS(null,"opacity","0.25"),H.setAttributeNS(null,"fill","#000000");const G=F.createNS("http://www.w3.org/2000/svg","path");G.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),H.appendChild(G);const ee=F.createNS("http://www.w3.org/2000/svg","g");ee.setAttributeNS(null,"transform","translate(6.0, 7.0)"),ee.setAttributeNS(null,"fill","#FFFFFF");const ne=F.createNS("http://www.w3.org/2000/svg","g");ne.setAttributeNS(null,"transform","translate(8.0, 8.0)");const he=F.createNS("http://www.w3.org/2000/svg","circle");he.setAttributeNS(null,"fill","#000000"),he.setAttributeNS(null,"opacity","0.25"),he.setAttributeNS(null,"cx","5.5"),he.setAttributeNS(null,"cy","5.5"),he.setAttributeNS(null,"r","5.4999962");const pe=F.createNS("http://www.w3.org/2000/svg","circle");pe.setAttributeNS(null,"fill","#FFFFFF"),pe.setAttributeNS(null,"cx","5.5"),pe.setAttributeNS(null,"cy","5.5"),pe.setAttributeNS(null,"r","5.4999962"),ne.appendChild(he),ne.appendChild(pe),M.appendChild(D),M.appendChild(L),M.appendChild(H),M.appendChild(ee),M.appendChild(ne),f.appendChild(M),f.setAttributeNS(null,"height",_*this._scale+"px"),f.setAttributeNS(null,"width",y*this._scale+"px"),this._element.appendChild(f),this._offset=h.P.convert(r&&r.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",(f=>{f.preventDefault()})),this._element.addEventListener("mousedown",(f=>{f.preventDefault()})),wc(this._element,this._anchor,"marker"),r&&r.className)for(const f of r.className.split(" "))this._element.classList.add(f);this._popup=null}addTo(r){return this.remove(),this._map=r,this._element.setAttribute("aria-label",r._getUIString("Marker.Title")),r.getCanvasContainer().appendChild(this._element),r.on("move",this._update),r.on("moveend",this._update),r.on("terrain",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("terrain",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),F.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(r){return this._lngLat=h.N.convert(r),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(r){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),r){if(!("offset"in r.options)){const y=Math.abs(13.5)/Math.SQRT2;r.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[y,-1*(38.1-13.5+y)],"bottom-right":[-y,-1*(38.1-13.5+y)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=r,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(r){return this._subpixelPositioning=r,this}getPopup(){return this._popup}togglePopup(){const r=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:r?(r.isOpen()?r.remove():(r.setLngLat(this._lngLat),r.addTo(this._map)),this):this}_updateOpacity(r=!1){var f,_;if(!(!((f=this._map)===null||f===void 0)&&f.terrain))return void(this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity));if(r)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout((()=>{this._opacityTimeout=null}),100)}const y=this._map,x=y.terrain.depthAtPoint(this._pos),M=y.terrain.getElevationForLngLatZoom(this._lngLat,y.transform.tileZoom);if(y.transform.lngLatToCameraDepth(this._lngLat,M)-x<.006)return void(this._element.style.opacity=this._opacity);const D=-this._offset.y/y.transform._pixelPerMeter,O=Math.sin(y.getPitch()*Math.PI/180)*D,L=y.terrain.depthAtPoint(new h.P(this._pos.x,this._pos.y-this._offset.y)),$=y.transform.lngLatToCameraDepth(this._lngLat,M+O)-L>.006;!((_=this._popup)===null||_===void 0)&&_.isOpen()&&$&&this._popup.remove(),this._element.style.opacity=$?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(r){return this._offset=h.P.convert(r),this._update(),this}addClassName(r){this._element.classList.add(r)}removeClassName(r){this._element.classList.remove(r)}toggleClassName(r){return this._element.classList.toggle(r)}setDraggable(r){return this._draggable=!!r,this._map&&(r?(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(r){return this._rotation=r||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(r){return this._rotationAlignment=r||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(r){return this._pitchAlignment=r&&r!=="auto"?r:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(r,f){return r===void 0&&f===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),r!==void 0&&(this._opacity=r),f!==void 0&&(this._opacityWhenCovered=f),this._map&&this._updateOpacity(!0),this}}const sf={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Tc=0,Mn=!1;const Is={maxWidth:100,unit:"metric"};function Ba(w,r,f){const _=f&&f.maxWidth||100,y=w._container.clientHeight/2,x=w.unproject([0,y]),M=w.unproject([_,y]),D=x.distanceTo(M);if(f&&f.unit==="imperial"){const O=3.2808*D;O>5280?Nt(r,_,O/5280,w._getUIString("ScaleControl.Miles")):Nt(r,_,O,w._getUIString("ScaleControl.Feet"))}else f&&f.unit==="nautical"?Nt(r,_,D/1852,w._getUIString("ScaleControl.NauticalMiles")):D>=1e3?Nt(r,_,D/1e3,w._getUIString("ScaleControl.Kilometers")):Nt(r,_,D,w._getUIString("ScaleControl.Meters"))}function Nt(w,r,f,_){const y=(function(x){const M=Math.pow(10,`${Math.floor(x)}`.length-1);let D=x/M;return D=D>=10?10:D>=5?5:D>=3?3:D>=2?2:D>=1?1:(function(O){const L=Math.pow(10,Math.ceil(-Math.log(O)/Math.LN10));return Math.round(O*L)/L})(D),M*D})(f);w.style.width=r*(y/f)+"px",w.innerHTML=`${y} ${_}`}const Zt={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},Na=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function za(w){if(w){if(typeof w=="number"){const r=Math.round(Math.abs(w)/Math.SQRT2);return{center:new h.P(0,0),top:new h.P(0,w),"top-left":new h.P(r,r),"top-right":new h.P(-r,r),bottom:new h.P(0,-w),"bottom-left":new h.P(r,-r),"bottom-right":new h.P(-r,-r),left:new h.P(w,0),right:new h.P(-w,0)}}if(w instanceof h.P||Array.isArray(w)){const r=h.P.convert(w);return{center:r,top:r,"top-left":r,"top-right":r,bottom:r,"bottom-left":r,"bottom-right":r,left:r,right:r}}return{center:h.P.convert(w.center||[0,0]),top:h.P.convert(w.top||[0,0]),"top-left":h.P.convert(w["top-left"]||[0,0]),"top-right":h.P.convert(w["top-right"]||[0,0]),bottom:h.P.convert(w.bottom||[0,0]),"bottom-left":h.P.convert(w["bottom-left"]||[0,0]),"bottom-right":h.P.convert(w["bottom-right"]||[0,0]),left:h.P.convert(w.left||[0,0]),right:h.P.convert(w.right||[0,0])}}return za(new h.P(0,0))}const kh=A;p.AJAXError=h.bh,p.Evented=h.E,p.LngLat=h.N,p.MercatorCoordinate=h.Z,p.Point=h.P,p.addProtocol=h.bi,p.config=h.a,p.removeProtocol=h.bj,p.AttributionControl=jo,p.BoxZoomHandler=Br,p.CanvasSource=bn,p.CooperativeGesturesHandler=Wn,p.DoubleClickZoomHandler=zr,p.DragPanHandler=_u,p.DragRotateHandler=yu,p.EdgeInsets=Ys,p.FullscreenControl=class extends h.E{constructor(w={}){super(),this._onFullscreenChange=()=>{var r;let f=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((r=f==null?void 0:f.shadowRoot)===null||r===void 0)&&r.fullscreenElement;)f=f.shadowRoot.fullscreenElement;f===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,w&&w.container&&(w.container instanceof HTMLElement?this._container=w.container:h.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(w){return this._map=w,this._container||(this._container=this._map.getContainer()),this._controlContainer=F.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){F.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const w=this._fullscreenButton=F.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);F.create("span","maplibregl-ctrl-icon",w).setAttribute("aria-hidden","true"),w.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const w=this._getTitle();this._fullscreenButton.setAttribute("aria-label",w),this._fullscreenButton.title=w}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new h.k("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new h.k("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},p.GeoJSONSource=Gi,p.GeolocateControl=class extends h.E{constructor(w){super(),this._onSuccess=r=>{if(this._map){if(this._isOutOfMapMaxBounds(r))return this._setErrorState(),this.fire(new h.k("outofmaxbounds",r)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=r,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_E
628RROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(r),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(r),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new h.k("geolocate",r)),this._finish()}},this._updateCamera=r=>{const f=new h.N(r.coords.longitude,r.coords.latitude),_=r.coords.accuracy,y=this._map.getBearing(),x=h.e({bearing:y},this.options.fitBoundsOptions),M=_e.fromLngLat(f,_);this._map.fitBounds(M,x,{geolocateSource:!0})},this._updateMarker=r=>{if(r){const f=new h.N(r.coords.longitude,r.coords.latitude);this._accuracyCircleMarker.setLngLat(f).addTo(this._map),this._userLocationDotMarker.setLngLat(f).addTo(this._map),this._accuracy=r.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=r=>{if(this._map){if(this.options.trackUserLocation)if(r.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const f=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=f,this._geolocateButton.setAttribute("aria-label",f),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(r.code===3&&Mn)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new h.k("error",r)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",(r=>r.preventDefault())),this._geolocateButton=F.create("button","maplibregl-ctrl-geolocate",this._container),F.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=r=>{if(this._map){if(r===!1){h.w("Geolocation support is not available so the GeolocateControl will be disabled.");const f=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=f,this._geolocateButton.setAttribute("aria-label",f)}else{const f=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=f,this._geolocateButton.setAttribute("aria-label",f)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=F.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Tu({element:this._dotElement}),this._circleElement=F.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Tu({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",(()=>this.trigger())),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",(f=>{f.geolocateSource||this._watchState!=="ACTIVE_LOCK"||f.originalEvent&&f.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new h.k("trackuserlocationend")),this.fire(new h.k("userlocationlostfocus")))}))}},this.options=h.e({},sf,w)}onAdd(w){return this._map=w,this._container=F.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),(function(){return h._(this,arguments,void 0,(function*(r=!1){if(dr!==void 0&&!r)return dr;if(window.navigator.permissions===void 0)return dr=!!window.navigator.geolocation,dr;try{dr=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{dr=!!window.navigator.geolocation}return dr}))})().then((r=>this._finishSetupUI(r))),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(),F.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Tc=0,Mn=!1}_isOutOfMapMaxBounds(w){const r=this._map.getMaxBounds(),f=w.coords;return r&&(f.longitude<r.getWest()||f.longitude>r.getEast()||f.latitude<r.getSouth()||f.latitude>r.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_E
628RROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const w=this._map.getBounds(),r=w.getSouthEast(),f=w.getNorthEast(),_=r.distanceTo(f),y=Math.ceil(this._accuracy/(_/this._map._container.clientHeight)*2);this._circleElement.style.width=`${y}px`,this._circleElement.style.height=`${y}px`}trigger(){if(!this._setup)return h.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new h.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Tc--,Mn=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new h.k("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new h.k("trackuserlocationstart")),this.fire(new h.k("userlocationfocus"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let w;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Tc++,Tc>1?(w={maximumAge:6e5,timeout:0},Mn=!0):(w=this.options.positionOptions,Mn=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,w)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},p.Hash=gc,p.ImageSource=vn,p.KeyboardHandler=zn,p.LngLatBounds=_e,p.LogoControl=xu,p.Map=class extends bu{constructor(w){h.bf.mark(h.bg.create);const r=Object.assign(Object.assign({},Oh),w);if(r.minZoom!=null&&r.maxZoom!=null&&r.minZoom>r.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(r.minPitch!=null&&r.maxPitch!=null&&r.minPitch>r.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(r.minPitch!=null&&r.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(r.maxPitch!=null&&r.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new zo(r.minZoom,r.maxZoom,r.minPitch,r.maxPitch,r.renderWorldCopies),{bearingSnap:r.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new _i,this._controls=[],this._mapId=h.a4(),this._contextLost=f=>{f.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new h.k("webglcontextlost",{originalEvent:f}))},this._contextRestored=f=>{this._setupPainter(),this.resize(),this._update(),this.fire(new h.k("webglcontextrestored",{originalEvent:f}))},this._onMapScroll=f=>{if(f.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()}
vendor: 18,162 bytes, line 628
628,this._interactive=r.interactive,this._maxTileCacheSize=r.maxTileCacheSize,this._maxTileCacheZoomLevels=r.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=r.failIfMajorPerformanceCaveat===!0,this._preserveDrawingBuffer=r.preserveDrawingBuffer===!0,this._antialias=r.antialias===!0,this._trackResize=r.trackResize===!0,this._bearingSnap=r.bearingSnap,this._refreshExpiredTiles=r.refreshExpiredTiles===!0,this._fadeDuration=r.fadeDuration,this._crossSourceCollisions=r.crossSourceCollisions===!0,this._collectResourceTiming=r.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},_a),r.locale),this._clickTolerance=r.clickTolerance,this._overridePixelRatio=r.pixelRatio,this._maxCanvasSize=r.maxCanvasSize,this.transformCameraUpdate=r.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=r.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=ve.addThrottleControl((()=>this.isMoving())),this._requestManager=new Oe(r.transformRequest),typeof r.container=="string"){if(this._container=document.getElementById(r.container),!this._container)throw new Error(`Container '${r.container}' not found.`)}else{if(!(r.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=r.container}if(r.maxBounds&&this.setMaxBounds(r.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",(()=>this._update(!1))).on("moveend",(()=>this._update(!1))).on("zoom",(()=>this._update(!0))).on("terrain",(()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)})).once("idle",(()=>{this._idleTriggered=!0})),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let f=!1;const _=Gs((y=>{this._trackResize&&!this._removed&&(this.resize(y),this.redraw())}),50);this._resizeObserver=new ResizeObserver((y=>{f?_(y):f=!0})),this._resizeObserver.observe(this._container)}this.handlers=new as(this,r),this._hash=r.hash&&new gc(typeof r.hash=="string"&&r.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:r.center,zoom:r.zoom,bearing:r.bearing,pitch:r.pitch}),r.bounds&&(this.resize(),this.fitBounds(r.bounds,h.e({},r.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=r.localIdeographFontFamily,this._validateStyle=r.validateStyle,r.style&&this.setStyle(r.style,{localIdeographFontFamily:r.localIdeographFontFamily}),r.attributionControl&&this.addControl(new jo(typeof r.attributionControl=="boolean"?void 0:r.attributionControl)),r.maplibreLogo&&this.addControl(new xu,r.logoPosition),this.on("style.load",(()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)})),this.on("data",(f=>{this._update(f.dataType==="style"),this.fire(new h.k(`${f.dataType}data`,f))})),this.on("dataloading",(f=>{this.fire(new h.k(`${f.dataType}dataloading`,f))})),this.on("dataabort",(f=>{this.fire(new h.k("sourcedataabort",f))}))}_getMapId(){return this._mapId}addControl(w,r){if(r===void 0&&(r=w.getDefaultPosition?w.getDefaultPosition():"top-right"),!w||!w.onAdd)return this.fire(new h.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const f=w.onAdd(this);this._controls.push(w);const _=this._controlPositions[r];return r.indexOf("bottom")!==-1?_.insertBefore(f,_.firstChild):_.appendChild(f),this}removeControl(w){if(!w||!w.onRemove)return this.fire(new h.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const r=this._controls.indexOf(w);return r>-1&&this._controls.splice(r,1),w.onRemove(this),this}hasControl(w){return this._controls.indexOf(w)>-1}calculateCameraOptionsFromTo(w,r,f,_){return _==null&&this.terrain&&(_=this.terrain.getElevationForLngLatZoom(f,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(w,r,f,_)}resize(w){var r;const f=this._containerDimensions(),_=f[0],y=f[1],x=this._getClampedPixelRatio(_,y);if(this._resizeCanvas(_,y,x),this.painter.resize(_,y,x),this.painter.overLimit()){const D=this.painter.context.gl;this._maxCanvasSize=[D.drawingBufferWidth,D.drawingBufferHeight];const O=this._getClampedPixelRatio(_,y);this._resizeCanvas(_,y,O),this.painter.resize(_,y,O)}this.transform.resize(_,y),(r=this._requestedCameraState)===null||r===void 0||r.resize(_,y);const M=!this._moving;return M&&(this.stop(),this.fire(new h.k("movestart",w)).fire(new h.k("move",w))),this.fire(new h.k("resize",w)),M&&this.fire(new h.k("moveend",w)),this}_getClampedPixelRatio(w,r){const{0:f,1:_}=this._maxCanvasSize,y=this.getPixelRatio(),x=w*y,M=r*y;return Math.min(x>f?f/x:1,M>_?_/M:1)*y}getPixelRatio(){var w;return(w=this._overridePixelRatio)!==null&&w!==void 0?w:devicePixelRatio}setPixelRatio(w){this._overridePixelRatio=w,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(w){return this.transform.setMaxBounds(_e.convert(w)),this._update()}setMinZoom(w){if((w=w??-2)>=-2&&w<=this.transform.maxZoom)return this.transform.minZoom=w,this._update(),this.getZoom()<w&&this.setZoom(w),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(w){if((w=w??22)>=this.transform.minZoom)return this.transform.maxZoom=w,this._update(),this.getZoom()>w&&this.setZoom(w),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(w){if((w=w??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(w>=0&&w<=this.transform.maxPitch)return this.transform.minPitch=w,this._update(),this.getPitch()<w&&this.setPitch(w),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(w){if((w=w??60)>85)throw new Error("maxPitch must be less than or equal to 85");if(w>=this.transform.minPitch)return this.transform.maxPitch=w,this._update(),this.getPitch()>w&&this.setPitch(w),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(w){return this.transform.renderWorldCopies=w,this._update()}project(w){return this.transform.locationPoint(h.N.convert(w),this.style&&this.terrain)}unproject(w){return this.transform.pointLocation(h.P.convert(w),this.terrain)}isMoving(){var w;return this._moving||((w=this.handlers)===null||w===void 0?void 0:w.isMoving())}isZooming(){var w;return this._zooming||((w=this.handlers)===null||w===void 0?void 0:w.isZooming())}isRotating(){var w;return this._rotating||((w=this.handlers)===null||w===void 0?void 0:w.isRotating())}_createDelegatedListener(w,r,f){if(w==="mouseenter"||w==="mouseover"){let _=!1;return{layers:r,listener:f,delegates:{mousemove:x=>{const M=r.filter((O=>this.getLayer(O))),D=M.length!==0?this.queryRenderedFeatures(x.point,{layers:M}):[];D.length?_||(_=!0,f.call(this,new wn(w,this,x.originalEvent,{features:D}))):_=!1},mouseout:()=>{_=!1}}}}if(w==="mouseleave"||w==="mouseout"){let _=!1;return{layers:r,listener:f,delegates:{mousemove:M=>{const D=r.filter((O=>this.getLayer(O)));(D.length!==0?this.queryRenderedFeatures(M.point,{layers:D}):[]).length?_=!0:_&&(_=!1,f.call(this,new wn(w,this,M.originalEvent)))},mouseout:M=>{_&&(_=!1,f.call(this,new wn(w,this,M.originalEvent)))}}}}{const _=y=>{const x=r.filter((D=>this.getLayer(D))),M=x.length!==0?this.queryRenderedFeatures(y.point,{layers:x}):[];M.length&&(y.features=M,f.call(this,y),delete y.features)};return{layers:r,listener:f,delegates:{[w]:_}}}}_saveDelegatedListener(w,r){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[w]=this._delegatedListeners[w]||[],this._delegatedListeners[w].push(r)}_removeDelegatedListener(w,r,f){if(!this._delegatedListeners||!this._delegatedListeners[w])return;const _=this._delegatedListeners[w];for(let y=0;y<_.length;y++){const x=_[y];if(x.listener===f&&x.layers.length===r.length&&x.layers.every((M=>r.includes(M)))){for(const M in x.delegates)this.off(M,x.delegates[M]);return void _.splice(y,1)}}}on(w,r,f){if(f===void 0)return super.on(w,r);const _=this._createDelegatedListener(w,typeof r=="string"?[r]:r,f);this._saveDelegatedListener(w,_);for(const y in _.delegates)this.on(y,_.delegates[y]);return this}once(w,r,f){if(f===void 0)return super.once(w,r);const _=typeof r=="string"?[r]:r,y=this._createDelegatedListener(w,_,f);for(const x in y.delegates){const M=y.delegates[x];y.delegates[x]=(...D)=>{this._removeDelegatedListener(w,_,f),M(...D)}}this._saveDelegatedListener(w,y);for(const x in y.delegates)this.once(x,y.delegates[x]);return this}off(w,r,f){return f===void 0?super.off(w,r):(this._removeDelegatedListener(w,typeof r=="string"?[r]:r,f),this)}queryRenderedFeatures(w,r){if(!this.style)return[];let f;const _=w instanceof h.P||Array.isArray(w),y=_?w:[[0,0],[this.transform.width,this.transform.height]];if(r=r||(_?{}:w)||{},y instanceof h.P||typeof y[0]=="number")f=[h.P.convert(y)];else{const x=h.P.convert(y[0]),M=h.P.convert(y[1]);f=[x,new h.P(M.x,x.y),M,new h.P(x.x,M.y),x]}return this.style.queryRenderedFeatures(f,r,this.transform)}querySourceFeatures(w,r){return this.style.querySourceFeatures(w,r)}setStyle(w,r){return(r=h.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},r)).diff!==!1&&r.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&w?(this._diffStyle(w,r),this):(this._localIdeographFontFamily=r.localIdeographFontFamily,this._updateStyle(w,r))}setTransformRequest(w){return this._requestManager.setTransformRequest(w),this}_getUIString(w){const r=this._locale[w];if(r==null)throw new Error(`Missing UI string '${w}'`);return r}_updateStyle(w,r){if(r.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",(()=>this._updateStyle(w,r)));const f=this.style&&r.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!w)),w?(this.style=new Zc(this,r||{}),this.style.setEventedParent(this,{style:this.style}),typeof w=="string"?this.style.loadURL(w,r,f):this.style.loadJSON(w,r,f),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Zc(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(w,r){if(typeof w=="string"){const f=this._requestManager.transformRequest(w,"Style");h.h(f,new AbortController).then((_=>{this._updateDiff(_.data,r)})).catch((_=>{_&&this.fire(new h.j(_))}))}else typeof w=="object"&&this._updateDiff(w,r)}_updateDiff(w,r){try{this.style.setState(w,r)&&this._update(!0)}catch(f){h.w(`Unable to perform style diff: ${f.message||f.error||f}. Rebuilding the style from scratch.`),this._updateStyle(w,r)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():h.w("There is no style added to the map.")}addSource(w,r){return this._lazyInitEmptyStyle(),this.style.addSource(w,r),this._update(!0)}isSourceLoaded(w){const r=this.style&&this.style.sourceCaches[w];if(r!==void 0)return r.loaded();this.fire(new h.j(new Error(`There is no source with ID '${w}'`)))}setTerrain(w){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),w){const r=this.style.sourceCaches[w.source];if(!r)throw new Error(`cannot load terrain, because there exists no source with ID: ${w.source}`);this.terrain===null&&r.reload();for(const f in this.style._layers){const _=this.style._layers[f];_.type==="hillshade"&&_.source===w.source&&h.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new Vo(this.painter,r,w),this.painter.renderToTexture=new ga(this.painter,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=f=>{f.dataType==="style"?this.terrain.sourceCache.freeRtt():f.dataType==="source"&&f.tile&&(f.sourceId!==w.source||this._elevationFreeze||(this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(f.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.minElevationForCurrentTile=0,this.transform.elevation=0;return this.fire(new h.k("terrain",{terrain:w})),this}getTerrain(){var w,r;return(r=(w=this.terrain)===null||w===void 0?void 0:w.options)!==null&&r!==void 0?r:null}areTilesLoaded(){const w=this.style&&this.style.sourceCaches;for(const r in w){const f=w[r]._tiles;for(const _ in f){const y=f[_];if(y.state!=="loaded"&&y.state!=="errored")return!1}}return!0}removeSource(w){return this.style.removeSource(w),this._update(!0)}getSource(w){return this.style.getSource(w)}addImage(w,r,f={}){const{pixelRatio:_=1,sdf:y=!1,stretchX:x,stretchY:M,content:D,textFitWidth:O,textFitHeight:L}=f;if(this._lazyInitEmptyStyle(),!(r instanceof HTMLImageElement||h.b(r))){if(r.width===void 0||r.height===void 0)return this.fire(new h.j(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:$,height:H,data:G}=r,ee=r;return this.style.addImage(w,{data:new h.R({width:$,height:H},new Uint8Array(G)),pixelRatio:_,stretchX:x,stretchY:M,content:D,textFitWidth:O,textFitHeight:L,sdf:y,version:0,userImage:ee}),ee.onAdd&&ee.onAdd(this,w),this}}{const{width:$,height:H,data:G}=N.getImageData(r);this.style.addImage(w,{data:new h.R({width:$,height:H},G),pixelRatio:_,stretchX:x,stretchY:M,content:D,textFitWidth:O,textFitHeight:L,sdf:y,version:0})}}updateImage(w,r){const f=this.style.getImage(w);if(!f)return this.fire(new h.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const _=r instanceof HTMLImageElement||h.b(r)?N.getImageData(r):r,{width:y,height:x,data:M}=_;if(y===void 0||x===void 0)return this.fire(new h.j(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(y!==f.data.width||x!==f.data.height)return this.fire(new h.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const D=!(r instanceof HTMLImageElement||h.b(r));return f.data.replace(M,D),this.style.updateImage(w,f),this}getImage(w){return this.style.getImage(w)}hasImage(w){return w?!!this.style.getImage(w):(this.fire(new h.j(new Error("Missing required image id"))),!1)}removeImage(w){this.style.removeImage(w)}loadImage(w){return ve.getImage(this._requestManager.transformRequest(w,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(w,r){return this._lazyInitEmptyStyle(),this.style.addLayer(w,r),this._update(!0)}moveLayer(w,r){return this.style.moveLayer(w,r),this._update(!0)}removeLayer(w){return this.style.removeLayer(w),this._update(!0)}getLayer(w){return this.style.getLayer(w)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(w,r,f){return this.style.setLayerZoomRange(w,r,f),this._update(!0)}setFilter(w,r,f={}){return this.style.setFilter(w,r,f),this._update(!0)}getFilter(w){return this.style.getFilter(w)}setPaintProperty(w,r,f,_={}){return this.style.setPaintProperty(w,r,f,_),this._update(!0)}getPaintProperty(w,r){return this.style.getPaintProperty(w,r)}setLayoutProperty(w,r,f,_={}){return this.style.setLayoutProperty(w,r,f,_),this._update(!0)}getLayoutProperty(w,r){return this.style.getLayoutProperty(w,r)}setGlyphs(w,r={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(w,r),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(w,r,f={}){return this._lazyInitEmptyStyle(),this.style.addSprite(w,r,f,(_=>{_||this._update(!0)})),this}removeSprite(w){return this._lazyInitEmptyStyle(),this.style.removeSprite(w),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(w,r={}){return this._lazyInitEmptyStyle(),this.style.setSprite(w,r,(f=>{f||this._update(!0)})),this}setLight(w,r={}){return this._lazyInitEmptyStyle(),this.style.setLight(w,r),this._update(!0)}getLight(){return this.style.getLight()}setSky(w){return this._lazyInitEmptyStyle(),this.style.setSky(w),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(w,r){return this.style.setFeatureState(w,r),this._update()}removeFeatureState(w,r){return this.style.removeFeatureState(w,r),this._update()}getFeatureState(w){return this.style.getFeatureState(w)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let w=0,r=0;return this._container&&(w=this._container.clientWidth||400,r=this._container.clientHeight||300),[w,r]}_setupContainer(){const w=this._container;w.classList.add("maplibregl-map");const r=this._canvasContainer=F.create("div","maplibregl-canvas-container",w);this._interactive&&r.classList.add("maplibregl-interactive"),this._canvas=F.create("canvas","maplibregl-canvas",r),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","regi
628on");const f=this._containerDimensions(),_=this._getClampedPixelRatio(f[0],f[1]);this._resizeCanvas(f[0],f[1],_);const y=this._controlContainer=F.create("div","maplibregl-control-container",w),x=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach((M=>{x[M]=F.create("div",`maplibregl-ctrl-${M} `,y)})),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(w,r,f){this._canvas.width=Math.floor(f*w),this._canvas.height=Math.floor(f*r),this._canvas.style.width=`${w}px`,this._canvas.style.height=`${r}px`}_setupPainter(){const w={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let r=null;this._canvas.addEventListener("webglcontextcreationerror",(_=>{r={requestedAttributes:w},_&&(r.statusMessage=_.statusMessage,r.type=_.type)}),{once:!0});const f=this._canvas.getContext("webgl2",w)||this._canvas.getContext("webgl",w);if(!f){const _="Failed to initialize WebGL";throw r?(r.message=_,new Error(JSON.stringify(r))):new Error(_)}this.painter=new wl(f,this.transform),Q.testSupport(f)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(w){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||w,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(w){return this._update(),this._renderTaskQueue.add(w)}_cancelRenderFrame(w){this._renderTaskQueue.remove(w)}_render(w){const r=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(w),this._removed)return;let f=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const y=this.transform.zoom,x=N.now();this.style.zoomHistory.update(y,x);const M=new h.z(y,{now:x,fadeDuration:r,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),D=M.crossFadingFactor();D===1&&D===this._crossFadingFactor||(f=!0,this._crossFadingFactor=D),this.style.update(M)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.minElevationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,r,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:r,showPadding:this.showPadding}),this.fire(new h.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,h.bf.mark(h.bg.load),this.fire(new h.k("load"))),this.style&&(this.style.hasTransitions()||f)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const _=this._sourcesDirty||this._styleDirty||this._placementDirty;return _||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new h.k("idle")),!this._loaded||this._fullyLoaded||_||(this._fullyLoaded=!0,h.bf.mark(h.bg.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var w;this._hash&&this._hash.remove();for(const f of this._controls)f.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),ve.removeThrottleControl(this._imageQueueHandle),(w=this._resizeObserver)===null||w===void 0||w.disconnect();const r=this.painter.context.gl.getExtension("WEBGL_lose_context");r!=null&&r.loseContext&&r.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),F.remove(this._canvasContainer),F.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),h.bf.clearMetrics(),this._removed=!0,this.fire(new h.k("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,N.frameAsync(this._frameRequest).then((w=>{h.bf.frame(w),this._frameRequest=null,this._render(w)})).catch((()=>{})))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(w){this._showTileBoundaries!==w&&(this._showTileBoundaries=w,this._update())}get showPadding(){return!!this._showPadding}set showPadding(w){this._showPadding!==w&&(this._showPadding=w,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(w){this._showCollisionBoxes!==w&&(this._showCollisionBoxes=w,w?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(w){this._showOverdrawInspector!==w&&(this._showOverdrawInspector=w,this._update())}get repaint(){return!!this._repaint}set repaint(w){this._repaint!==w&&(this._repaint=w,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(w){this._vertices=w,this._update()}get version(){return ya}getCameraTargetElevation(){return this.transform.elevation}},p.MapMouseEvent=wn,p.MapTouchEvent=pa,p.MapWheelEvent=ms,p.Marker=Tu,p.NavigationControl
vendor: 8,603 bytes, line 628
628=class{constructor(w){this._updateZoomButtons=()=>{const r=this._map.getZoom(),f=r===this._map.getMaxZoom(),_=r===this._map.getMinZoom();this._zoomInButton.disabled=f,this._zoomOutButton.disabled=_,this._zoomInButton.setAttribute("aria-disabled",f.toString()),this._zoomOutButton.setAttribute("aria-disabled",_.toString())},this._rotateCompassArrow=()=>{const r=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=r},this._setButtonTitle=(r,f)=>{const _=this._map._getUIString(`NavigationControl.${f}`);r.title=_,r.setAttribute("aria-label",_)},this.options=h.e({},Rl,w),this._container=F.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",(r=>r.preventDefault())),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",(r=>this._map.zoomIn({},{originalEvent:r}))),F.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",(r=>this._map.zoomOut({},{originalEvent:r}))),F.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",(r=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:r}):this._map.resetNorth({},{originalEvent:r})})),this._compassIcon=F.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(w){return this._map=w,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 wu(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){F.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(w,r){const f=F.create("button",w,this._container);return f.type="button",f.addEventListener("click",r),f}},p.Popup=class extends h.E{constructor(w){super(),this.remove=()=>(this._content&&F.remove(this._content),this._container&&(F.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),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new h.k("close"))),this),this._onMouseUp=r=>{this._update(r.point)},this._onMouseMove=r=>{this._update(r.point)},this._onDrag=r=>{this._update(r.point)},this._update=r=>{var f;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=F.create("div","maplibregl-popup",this._map.getContainer()),this._tip=F.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const D of this.options.className.split(" "))this._container.classList.add(D);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=this._map.transform.renderWorldCopies&&!this._trackPointer?xi(this._lngLat,this._flatPos,this._map.transform):(f=this._lngLat)===null||f===void 0?void 0:f.wrap(),this._trackPointer&&!r)return;const _=this._flatPos=this._pos=this._trackPointer&&r?r:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&r?r:this._map.transform.locationPoint(this._lngLat));let y=this.options.anchor;const x=za(this.options.offset);if(!y){const D=this._container.offsetWidth,O=this._container.offsetHeight;let L;L=_.y+x.bottom.y<O?["top"]:_.y>this._map.transform.height-O?["bottom"]:[],_.x<D/2?L.push("left"):_.x>this._map.transform.width-D/2&&L.push("right"),y=L.length===0?"bottom":L.join("-")}let M=_.add(x[y]);this.options.subpixelPositioning||(M=M.round()),F.setTransform(this._container,`${ka[y]} translate(${M.x}px,${M.y}px)`),wc(this._container,y,"popup")},this._onClose=()=>{this.remove()},this.options=h.e(Object.create(Zt),w)}addTo(w){return this._map&&this.remove(),this._map=w,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new h.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(w){return this._lngLat=h.N.convert(w),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(w){return this.setDOMContent(document.createTextNode(w))}setHTML(w){const r=document.createDocumentFragment(),f=document.createElement("body");let _;for(f.innerHTML=w;_=f.firstChild,_;)r.appendChild(_);return this.setDOMContent(r)}getMaxWidth(){var w;return(w=this._container)===null||w===void 0?void 0:w.style.maxWidth}setMaxWidth(w){return this.options.maxWidth=w,this._update(),this}setDOMContent(w){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=F.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(w),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(w){return this._container&&this._container.classList.add(w),this}removeClassName(w){return this._container&&this._container.classList.remove(w),this}setOffset(w){return this.options.offset=w,this._update(),this}toggleClassName(w){if(this._container)return this._container.classList.toggle(w)}setSubpixelPositioning(w){this.options.subpixelPositioning=w}_createCloseButton(){this.options.closeButton&&(this._closeButton=F.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const w=this._container.querySelector(Na);w&&w.focus()}},p.RasterDEMTileSource=Ri,p.RasterTileSource=Ut,p.ScaleControl=class{constructor(w){this._onMove=()=>{Ba(this._map,this._container,this.options)},this.setUnit=r=>{this.options.unit=r,Ba(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Is),w)}getDefaultPosition(){return"bottom-left"}onAdd(w){return this._map=w,this._container=F.create("div","maplibregl-ctrl maplibregl-ctrl-scale",w.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){F.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}}
vendor: 4,131 bytes, line 628
628,p.ScrollZoomHandler=rr,p.Style=Zc,p.TerrainControl=class{constructor(w){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=w}onAdd(w){return this._map=w,this._container=F.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=F.create("button","maplibregl-ctrl-terrain",this._container),F.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){F.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},p.TwoFingersTouchPitchHandler=io,p.TwoFingersTouchRotateHandler=to,p.TwoFingersTouchZoomHandler=gu,p.TwoFingersTouchZoomRotateHandler=vu,p.VectorTileSource=gt,p.VideoSource=sn,p.addSourceType=(w,r)=>h._(void 0,void 0,void 0,(function*(){if(Ss(w))throw new Error(`A source type called "${w}" already exists.`);((f,_)=>{lr[f]=_})(w,r)})),p.clearPrewarmedResources=function(){const w=ti;w&&(w.isPreloaded()&&w.numActive()===1?(w.release(Tt),ti=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()"))},p.getMaxParallelImageRequests=function(){return h.a.MAX_PARALLEL_IMAGE_REQUESTS},p.getRTLTextPluginStatus=function(){return la().getRTLTextPluginStatus()},p.getVersion=function(){return kh},p.getWorkerCount=function(){return $t.workerCount},p.getWorkerUrl=function(){return h.a.WORKER_URL},p.importScriptInWorkers=function(w){return Ts().broadcast("IS",w)},p.prewarm=function(){ki().acquire(Tt)},p.setMaxParallelImageRequests=function(w){h.a.MAX_PARALLEL_IMAGE_REQUESTS=w},p.setRTLTextPlugin=function(w,r){return la().setRTLTextPlugin(w,r)},p.setWorkerCount=function(w){$t.workerCount=w},p.setWorkerUrl=function(w){h.a.WORKER_URL=w}}));var d=i;return d}))})(iy)),iy.exports}var EE=AE();const Gx=tS(EE);function dy(t,e){if(!t)throw new Error(e||"loader assertion failed.")}const X0=!!(typeof process!="object"||String(process)!=="[object process]"||process.browser),Kx=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);Kx&&parseFloat(Kx[1]);const M_=globalThis,jf=globalThis.process||{},CE=globalThis.navigator||{};function nS(t){var n,o;if(typeof window<"u"&&((n=window.process)==null?void 0:n.type)==="renderer"||typeof process<"u"&&((o=process.versions)!=null&&o.electron))return!0;const i=typeof navigator<"u"&&navigator.userAgent;return!!(i&&i.indexOf("Electron")>=0)}function zd(){return!(typeof process=="object"&&String(process)==="[object process]"&&!(process!=null&&process.browser))||nS()}function RE(t){return zd()?nS()?"Electron":(CE.userAgent||"").indexOf("Edge")>-1?"Edge":globalThis.chrome?"Chrome":globalThis.safari?"Safari":globalThis.mozInnerScreenX?"Firefox":"Unknown":"Node"}const rS="4.1.1";function q0(t,e){if(!t)throw new Error("Assertion failed")}function sS(t){if(!t)return 0;let e;switch(typeof t){case"number":e=t;break;case"object":e=t.logLevel||t.priority||0;break;default:return 0}return q0(Number.isFinite(e)&&e>=0),e}function ME(t){const{logLevel:e,message:i}=t;t.logLevel=sS(e);const n=t.args?Array.from(t.args):[];for(;n.length&&n.shift()!==i;);switch(typeof e){case"string":case"function":i!==void 0&&n.unshift(i),t.message=e;break;case"object":Object.assign(t,e);break}typeof t.message=="function"&&(t.message=t.message());const o=typeof t.message;
vendor: 6,067 bytes, line 628
628return q0(o==="string"||o==="object"),Object.assign(t,{args:n},t.opts)}const qf=()=>{};class PE{constructor({level:e=0}={}){this.userData={},this._onceCache=new Set,this._level=e}set level(e){this.setLevel(e)}get level(){return this.getLevel()}setLevel(e){return this._level=e,this}getLevel(){return this._level}warn(e,...i){return this._log("warn",0,e,i,{once:!0})}error(e,...i){return this._log("error",0,e,i)}log(e,i,...n){return this._log("log",e,i,n)}info(e,i,...n){return this._log("info",e,i,n)}once(e,i,...n){return this._log("once",e,i,n,{once:!0})}_log(e,i,n,o,d={}){const p=ME({logLevel:i,message:n,args:this._buildArgs(i,n,o),opts:d});return this._createLogFunction(e,p,d)}_buildArgs(e,i,n){return[e,i,...n]}_createLogFunction(e,i,n){if(!this._shouldLog(i.logLevel))return qf;const o=this._getOnceTag(n.tag??i.tag??i.message);if((n.once||i.once)&&o!==void 0){if(this._onceCache.has(o))return qf;this._onceCache.add(o)}return this._emit(e,i)}_shouldLog(e){return this.getLevel()>=sS(e)}_getOnceTag(e){if(e!==void 0)try{return typeof e=="string"?e:String(e)}catch{return}}}function IE(t){try{const e=window[t],i="__storage_test__";return e.setItem(i,i),e.removeItem(i),e}catch{return null}}class DE{constructor(e,i,n="sessionStorage"){this.storage=IE(n),this.id=e,this.config=i,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(e){if(Object.assign(this.config,e),this.storage){const i=JSON.stringify(this.config);this.storage.setItem(this.id,i)}}_loadConfiguration(){let e={};if(this.storage){const i=this.storage.getItem(this.id);e=i?JSON.parse(i):{}}return Object.assign(this.config,e),this}}function OE(t){let e;return t<10?e=`${t.toFixed(2)}ms`:t<100?e=`${t.toFixed(1)}ms`:t<1e3?e=`${t.toFixed(0)}ms`:e=`${(t/1e3).toFixed(2)}s`,e}function kE(t,e=8){const i=Math.max(e-t.length,0);return`${" ".repeat(i)}${t}`}var fy;(function(t){t[t.BLACK=30]="BLACK",t[t.RED=31]="RED",t[t.GREEN=32]="GREEN",t[t.YELLOW=33]="YELLOW",t[t.BLUE=34]="BLUE",t[t.MAGENTA=35]="MAGENTA",t[t.CYAN=36]="CYAN",t[t.WHITE=37]="WHITE",t[t.BRIGHT_BLACK=90]="BRIGHT_BLACK",t[t.BRIGHT_RED=91]="BRIGHT_RED",t[t.BRIGHT_GREEN=92]="BRIGHT_GREEN",t[t.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",t[t.BRIGHT_BLUE=94]="BRIGHT_BLUE",t[t.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",t[t.BRIGHT_CYAN=96]="BRIGHT_CYAN",t[t.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(fy||(fy={}));const BE=10;function Qx(t){return typeof t!="string"?t:(t=t.toUpperCase(),fy[t]||fy.WHITE)}function NE(t,e,i){return!zd&&typeof t=="string"&&(e&&(t=`\x1B[${Qx(e)}m${t}\x1B[39m`),i&&(t=`\x1B[${Qx(i)+BE}m${t}\x1B[49m`)),t}function zE(t,e=["constructor"]){const i=Object.getPrototypeOf(t),n=Object.getOwnPropertyNames(i),o=t;for(const d of n){const p=o[d];typeof p=="function"&&(e.find(h=>d===h)||(o[d]=p.bind(t)))}}function Um(){var e,i,n;let t;if(zd()&&M_.performance)t=(i=(e=M_==null?void 0:M_.performance)==null?void 0:e.now)==null?void 0:i.call(e);else if("hrtime"in jf){const o=(n=jf==null?void 0:jf.hrtime)==null?void 0:n.call(jf);t=o[0]*1e3+o[1]/1e6}else t=Date.now();return t}const Vf={debug:zd()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Fv={enabled:!0,level:0};class vg extends PE{constructor({id:e}={id:""}){super({level:0}),this.VERSION=rS,this._startTs=Um(),this._deltaTs=Um(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=e,this.userData={},this._storage=new DE(`__probe-${this.id}__`,{[this.id]:Fv}),this.timeStamp(`${this.id} started`),zE(this),Object.seal(this)}isEnabled(){return this._getConfiguration().enabled}getLevel(){return this._getConfiguration().level}getTotal(){return Number((Um()-this._startTs).toPrecision(10))}getDelta(){return Number((Um()-this._deltaTs).toPrecision(10))}set priority(e){this.level=e}get priority(){return this.level}getPriority(){return this.level}enable(e=!0){return this._updateConfiguration({enabled:e}),this}setLevel(e){return this._updateConfiguration({level:e}),this}get(e){return this._getConfiguration()[e]}set(e,i){this._updateConfiguration({[e]:i})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(e,i){if(!e)throw new Error(i||"Assertion failed")}warn(e,...i){return this._log("warn",0,e,i,{method:Vf.warn,once:!0})}error(e,...i){return this._log("error",0,e,i,{method:Vf.error})}deprecated(e,i){return this.warn(`\`${e}\` is deprecated and will be removed in a later version. Use \`${i}\` instead`)}removed(e,i){return this.error(`\`${e}\` has been removed. Use \`${i}\` instead`)}probe(e,i,...n){return this._log("log",e,i,n,{method:Vf.log,time:!0,once:!0})}log(e,i,...n){return this._log("log",e,i,n,{method:Vf.debug})}info(e,i,...n){return this._log("info",e,i,n,{method:console.info})}once(e,i,...n){return this._log("once",e,i,n,{method:Vf.debug||Vf.info,once:!0})}table(e,i,n){return i?this._log("table",e,i,n&&[n]||[],{method:console.table||qf,tag:FE(i)}):qf}time(e,i){return this._log("time",e,i,[],{method:console.time?console.time:console.info})}timeEnd(e,i){return this._log("time",e,i,[],{method:console.timeEnd?console.timeEnd:console.info})}timeStamp(e,i){return this._log("time",e,i,[],{method:console.timeStamp||qf})}group(e,i,n={collapsed:!1}){const o=(n.collapsed?console.groupCollapsed:console.group)||console.info;return this._log("group",e,i,[],{method:o})}groupCollapsed(e,i,n={}){return this.group(e,i,Object.assign({},n,{collapsed:!0}))}groupEnd(e){return this._log("groupEnd",e,"",[],{method:console.groupEnd||qf})}withGroup(e,i,n){this.group(e,i)();try{n()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&super._shouldLog(e)}_emit(e,i){const n=i.method;q0(n),i.total=this.getTotal(),i.delta=this.getDelta(),this._deltaTs=Um();const o=LE(this.id,i.message,i);return n.bind(console,o,...i.args)}_getConfiguration(){return this._storage.config[this.id]||this._updateConfiguration(Fv),this._storage.config[this.id]}_updateConfiguration(e){const i=this._storage.config[this.id]||{...Fv};this._storage.setConfiguration({[this.id]:{...i,...e}})}}vg.VERSION=rS;
628function LE(t,e,i){if(typeof e=="string"){const n=i.time?kE(OE(i.total)):"";e=i.time?`${t}: ${n} ${e}`:`${t}: ${e}`,e=NE(e,i.color,i.background)}return e}function FE(t){for(const e in t)for(const i in t[e])return i||"untitled";return"empty"}const Uv="4.4.4",UE=Uv[0]>="0"&&Uv[0]<="9"?`v${Uv}`:"";function jE(){const t=new vg({id:"loaders.gl"});return globalThis.loaders||(globalThis.loaders={}),globalThis.loaders.log=t,globalThis.loaders.version=UE,globalThis.probe||(globalThis.probe={}),globalThis.probe.loaders=t,t}const VE=jE(),$E=t=>typeof t=="boolean",ec=t=>typeof t=="function",Ld=t=>t!==null&&typeof t=="object",Jx=t=>Ld(t)&&t.constructor==={}.constructor,aS=t=>typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer,Z0=t=>Ld(t)&&typeof t.byteLength=="number"&&typeof t.slice=="function",HE=t=>!!t&&ec(t[Symbol.iterator]),WE=t=>!!t&&ec(t[Symbol.asyncIterator]),Fd=t=>typeof Response<"u"&&t instanceof Response||Ld(t)&&ec(t.arrayBuffer)&&ec(t.text)&&ec(t.json),Ud=t=>typeof Blob<"u"&&t instanceof Blob,XE=t=>typeof ReadableStream<"u"&&t instanceof ReadableStream||Ld(t)&&ec(t.tee)&&ec(t.cancel)&&ec(t.getReader),qE=t=>Ld(t)&&ec(t.read)&&ec(t.pipe)&&$E(t.readable),oS=t=>XE(t)||qE(t);function ZE(t,e){return lS(t||{},e)}function lS(t,e,i=0){if(i>3)return e;const n={...t};for(const[o,d]of Object.entries(e))d&&typeof d=="object"&&!Array.isArray(d)?n[o]=lS(n[o]||{},e[o],i+1):n[o]=e[o];return n}const YE="latest";function GE(){var t;return(t=globalThis._loadersgl_)!=null&&t.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.4.4"),globalThis._loadersgl_.version}const KE=GE();function gh(t,e){if(!t)throw new Error(e||"loaders.gl assertion failed.")}const Sd=typeof process!="object"||String(process)!=="[object process]"||process.browser,QE=typeof window<"u"&&typeof window.orientation<"u",e1=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);e1&&parseFloat(e1[1]);class JE{constructor(e,i){Y(this,"name");Y(this,"workerThread");Y(this,"isRunning",!0);Y(this,"result");Y(this,"_resolve",()=>{});Y(this,"_reject",()=>{});this.name=e,this.workerThread=i,this.result=new Promise((n,o)=>{this._resolve=n,this._reject=o})}postMessage(e,i){this.workerThread.postMessage({source:"loaders.gl",type:e,payload:i})}done(e){gh(this.isRunning),this.isRunning=!1,this._resolve(e)}error(e){gh(this.isRunning),this.isRunning=!1,this._reject(e)}}class jv{terminate(){}}const Vv=new Map;function eC(t){gh(t.source&&!t.url||!t.source&&t.url);
628let e=Vv.get(t.source||t.url);return e||(t.url&&(e=tC(t.url),Vv.set(t.url,e)),t.source&&(e=cS(t.source),Vv.set(t.source,e))),gh(e),e}function tC(t){if(!t.startsWith("http"))return t;const e=iC(t);return cS(e)}function cS(t){const e=new Blob([t],{type:"application/javascript"});return URL.createObjectURL(e)}function iC(t){return`try { 629 importScripts('${t}'); 630} catch (error) { 631 console.error(error); 632 throw error; 633}`}function uS(t,e=!0,i){const n=i||new Set;if(t){if(t1(t))n.add(t);else if(t1(t.buffer))n.add(t.buffer);else if(!ArrayBuffer.isView(t)){if(e&&typeof t=="object")for(const o in t)uS(t[o],e,n)}}return i===void 0?Array.from(n):[]}function t1(t){return t?t instanceof ArrayBuffer||typeof MessagePort<"u"&&t instanceof MessagePort||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas:!1}const $v=()=>{};class Lb{constructor(e){Y(this,"name");Y(this,"source");Y(this,"url");Y(this,"terminated",!1);Y(this,"worker");Y(this,"onMessage");Y(this,"onError");Y(this,"_loadableURL","");const{name:i,source:n,url:o}=e;gh(n||o),this.name=i,this.source=n,this.url=o,this.onMessage=$v,this.onError=d=>console.log(d),this.worker=Sd?this._createBrowserWorker():this._createNodeWorker()}static isSupported(){return typeof Worker<"u"&&Sd||typeof jv<"u"&&!Sd}destroy(){this.onMessage=$v,this.onError=$v,this.worker.terminate(),this.terminated=!0}get isRunning(){return!!this.onMessage}postMessage(e,i){i=i||uS(e),this.worker.postMessage(e,i)}_getErrorFromErrorEvent(e){let i="Failed to load ";return i+=`worker ${this.name} from ${this.url}. `,e.message&&(i+=`${e.message} in `),e.lineno&&(i+=`:${e.lineno}:${e.colno}`),new Error(i)}_createBrowserWorker(){this._loadableURL=eC({source:this.source,url:this.url});const e=new Worker(this._loadableURL,{name:this.name});return e.onmessage=i=>{i.data?this.onMessage(i.data):this.onError(new Error("No data received"))},e.onerror=i=>{this.onError(this._getErrorFromErrorEvent(i)),this.terminated=!0},e.onmessageerror=i=>console.error(i),e}_createNodeWorker(){let e;if(this.url){const n=this.url.includes(":/")||this.url.startsWith("/")?this.url:`./${this.url}`,o=this.url.endsWith(".ts")||this.url.endsWith(".mjs")?"module":"commonjs";e=new jv(n,{eval:!1,type:o})}else if(this.source)e=new jv(this.source,{eval:!0});else throw new Error("no worker");return e.on("message",i=>{this.onMessage(i)}),e.on("error",i=>{this.onError(i)}),e.on("exit",i=>{}),e}}class nC{constructor(e){Y(this,"name","unnamed");Y(this,"source");Y(this,"url");Y(this,"maxConcurrency",1);Y(this,"maxMobileConcurrency",1);Y(this,"onDebug",()=>{});Y(this,"reuseWorkers",!0);Y(this,"props",{});Y(this,"jobQueue",[]);Y(this,"idleQueue",[]);Y(this,"count",0);Y(this,"isDestroyed",!1);this.source=e.source,this.url=e.url,this.setProps(e)}static isSupported(){return Lb.isSupported()}destroy(){this.idleQueue.forEach(e=>e.destroy()),this.isDestroyed=!0}setProps(e){this.props={...this.props,...e},e.name!==void 0&&(this.name=e.name),e.maxConcurrency!==void 0&&(this.maxConcurrency=e.maxConcurrency),e.maxMobileConcurrency!==void 0&&(this.maxMobileConcurrency=e.maxMobileConcurrency),e.reuseWorkers!==void 0&&(this.reuseWorkers=e.reuseWorkers),e.onDebug!==void 0&&(this.onDebug=e.onDebug)}async startJob(e,i=(o,d,p)=>o.done(p),n=(o,d)=>o.error(d)){const o=new Promise(d=>(this.jobQueue.push({name:e,onMessage:i,onError:n,onStart:d}),this));return this._startQueuedJob(),await o}async _startQueuedJob(){if(!this.jobQueue.length)return;const e=this._getAvailableWorker();if(!e)return;const i=this.jobQueue.shift();if(i){this.onDebug({message:"Starting job",name:i.name,workerThread:e,backlog:this.jobQueue.length});const n=new JE(i.name,e);e.onMessage=o=>i.onMessage(n,o.type,o.payload),e.onError=o=>i.onError(n,o),i.onStart(n);try{await n.result}catch(o){console.error(`Worker exception: ${o}`)}finally{this.returnWorkerToQueue(e)}}}returnWorkerToQueue(e){!Sd||this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(e.destroy(),this.count--):this.idleQueue.push(e),this.isDestroyed||this._startQueuedJob()}
633_getAvailableWorker(){if(this.idleQueue.length>0)return this.idleQueue.shift()||null;if(this.count<this._getMaxConcurrency()){this.count++;const e=`${this.name.toLowerCase()} (#${this.count} of ${this.maxConcurrency})`;return new Lb({name:e,source:this.source,url:this.url})}return null}_getMaxConcurrency(){return QE?this.maxMobileConcurrency:this.maxConcurrency}}const rC={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,onDebug:()=>{}},uh=class uh{constructor(e){Y(this,"props");Y(this,"workerPools",new Map);this.props={...rC},this.setProps(e),this.workerPools=new Map}static isSupported(){return Lb.isSupported()}static getWorkerFarm(e={}){return uh._workerFarm=uh._workerFarm||new uh({}),uh._workerFarm.setProps(e),uh._workerFarm}destroy(){for(const e of this.workerPools.values())e.destroy();this.workerPools=new Map}setProps(e){this.props={...this.props,...e};for(const i of this.workerPools.values())i.setProps(this._getWorkerPoolProps())}getWorkerPool(e){const{name:i,source:n,url:o}=e;let d=this.workerPools.get(i);return d||(d=new nC({name:i,source:n,url:o}),d.setProps(this._getWorkerPoolProps()),this.workerPools.set(i,d)),d}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}};Y(uh,"_workerFarm");let py=uh;function sC(t,e={}){var p;const i=e[t.id]||{},n=Sd?`${t.id}-worker.js`:`${t.id}-worker-node.js`;let o=i.workerUrl;if(!o&&t.id==="compression"&&(o=e.workerUrl),(e._workerType||((p=e==null?void 0:e.core)==null?void 0:p._workerType))==="test"&&(Sd?o=`modules/${t.module}/dist/${n}`:o=`modules/${t.module}/src/workers/${t.id}-worker-node.ts`),!o){let h=t.version;h==="latest"&&(h=YE);const A=h?`@${h}`:"";o=`https://unpkg.com/@loaders.gl/${t.module}${A}/dist/${n}`}return gh(o),o}function aC(t,e=KE){gh(t,"no worker provided");const i=t.version;return!(!e||!i)}function oC(t,e){var o,d;if(!py.isSupported())return!1;const i=(e==null?void 0:e._nodeWorkers)??((o=e==null?void 0:e.core)==null?void 0:o._nodeWorkers);if(!Sd&&!i)return!1;const n=(e==null?void 0:e.worker)??((d=e==null?void 0:e.core)==null?void 0:d.worker);return!!(t.worker&&n)}async function lC(t,e,i,n,o){const d=t.id,p=sC(t,i),A=py.getWorkerFarm(i==null?void 0:i.core).getWorkerPool({name:d,url:p});i=JSON.parse(JSON.stringify(i)),n=JSON.parse(JSON.stringify(n||{}));const R=await A.startJob("process-on-worker",cC.bind(null,o));return R.postMessage("process",{input:e,options:i,context:n}),await(await R.result).result}async function cC(t,e,i,n){switch(i){case"done":e.done(n);break;case"error":e.error(new Error(n.error));break;case"process":const{id:o,input:d,options:p}=n;try{const h=await t(d,p);e.postMessage("done",{id:o,result:h})}catch(h){const A=h instanceof Error?h.message:"unknown error";e.postMessage("error",{id:o,error:A})}break;default:console.warn(`parse-with-worker unknown message ${i}`)}}function uC(t,e,i){if(i=i||t.byteLength,t.byteLength<i||e.byteLength<i)return!1;const n=new Uint8Array(t),o=new Uint8Array(e);for(let d=0;d<n.length;++d)if(n[d]!==o[d])return!1;return!0}function hC(...t){return dC(t)}function dC(t){const e=t.map(d=>d instanceof ArrayBuffer?new Uint8Array(d):d),i=e.reduce((d,p)=>d+p.byteLength,0),n=new Uint8Array(i);let o=0;for(const d of e)n.set(d,o),o+=d.byteLength;return n.buffer}async function fC(t){const e=[];for await(const i of t)e.push(pC(i));return hC(...e)}function pC(t){if(t instanceof ArrayBuffer)return t;if(ArrayBuffer.isView(t)){const{buffer:e,byteOffset:i,byteLength:n}=t;return i1(e,i,n)}return i1(t)}function i1(t,e=0,i=t.byteLength-e){const n=new Uint8Array(t,e,i),o=new Uint8Array(n.length);return o.set(n),o.buffer}function n1(){let t;if(typeof window<"u"&&window.performance)t=window.performance.now();else if(typeof process<"u"&&process.hrtime){const e=process.hrtime();t=e[0]*1e3+e[1]/1e6}else t=Date.now();return t}class r1{constructor(e,i){this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=e,this.type=i,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(e){return this.sampleSize=e,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(e){return this._count+=e,this._samples++,this._checkSampling(),this}subtractCount(e){return this._count-=e,this._samples++,this._checkSampling(),this}addTime(e){return this._time+=e,this.lastTiming=e,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=n1(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(n1()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}}class sv{constructor(e){this.stats={},this.id=e.id,this.stats={},this._initializeStats(e.stats),Object.seal(this)}get(e,i="count"){return this._getOrCreate({name:e,type:i})}get size(){return Object.keys(this.stats).length}reset(){for(const e of Object.values(this.stats))e.reset();return this}forEach(e){for(const i of Object.values(this.stats))e(i)}getTable(){const e={};return this.forEach(i=>
633{e[i.name]={time:i.time||0,count:i.count||0,average:i.getAverageTime()||0,hz:i.getHz()||0}}),e}_initializeStats(e=[]){e.forEach(i=>this._getOrCreate(i))}_getOrCreate(e){const{name:i,type:n}=e;let o=this.stats[i];return o||(e instanceof r1?o=e:o=new r1(i,n),this.stats[i]=o),o}}let mC="";const s1={};function gC(t){for(const e in s1)if(t.startsWith(e)){const i=s1[e];t=t.replace(e,i)}return!t.startsWith("http://")&&!t.startsWith("https://")&&(t=`${mC}${t}`),t}function hS(t){return t&&typeof t=="object"&&t.isBuffer}function Y0(t){if(hS(t))return t;if(t instanceof ArrayBuffer)return t;if(aS(t))return Fb(t);if(ArrayBuffer.isView(t)){const e=t.buffer;return t.byteOffset===0&&t.byteLength===t.buffer.byteLength?e:e.slice(t.byteOffset,t.byteOffset+t.byteLength)}if(typeof t=="string"){const e=t;return new TextEncoder().encode(e).buffer}if(t&&typeof t=="object"&&t._toArrayBuffer)return t._toArrayBuffer();throw new Error("toArrayBuffer")}function dS(t){if(t instanceof ArrayBuffer)return t;if(aS(t))return Fb(t);const{buffer:e,byteOffset:i,byteLength:n}=t;return e instanceof ArrayBuffer&&i===0&&n===e.byteLength?e:Fb(e,i,n)}function Fb(t,e=0,i=t.byteLength-e){const n=new Uint8Array(t,e,i),o=new Uint8Array(n.length);return o.set(n),o.buffer}function _C(t){return ArrayBuffer.isView(t)?t:new Uint8Array(t)}function fS(t){const e=t?t.lastIndexOf("/"):-1;return e>=0?t.substr(e+1):t}function pS(t){const e=t?t.lastIndexOf("/"):-1;return e>=0?t.substr(0,e):""}class yC extends Error{constructor(i,n){super(i);Y(this,"reason");Y(this,"url");Y(this,"response");this.reason=n.reason,this.url=n.url,this.response=n.response}}const vC=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,bC=/^([-\w.]+\/[-\w.+]+)/;function a1(t,e){return t.toLowerCase()===e.toLowerCase()}function xC(t){const e=bC.exec(t);return e?e[1]:t}function o1(t){const e=vC.exec(t);return e?e[1]:""}const mS=/\?.*/;function wC(t){const e=t.match(mS);return e&&e[0]}function av(t){return t.replace(mS,"")}function TC(t){if(t.length<50)return t;const e=t.slice(t.length-15);return`${t.substr(0,32)}...${e}`}function ov(t){return Fd(t)?t.url:Ud(t)?("name"in t?t.name:"")||"":typeof t=="string"?t:""}function lv(t){if(Fd(t)){const e=t.headers.get("content-type")||"",i=av(t.url);return xC(e)||o1(i)}return Ud(t)?t.type||"":typeof t=="string"?o1(t):""}function SC(t){return Fd(t)?t.headers["content-length"]||-1:Ud(t)?t.size:typeof t=="string"?t.length:t instanceof ArrayBuffer||ArrayBuffer.isView(t)?t.byteLength:-1}async function gS(t){if(Fd(t))return t;const e={},i=SC(t);i>=0&&(e["content-length"]=String(i));const n=ov(t),o=lv(t);o&&(e["content-type"]=o);const d=await CC(t);d&&(e["x-first-bytes"]=d),typeof t=="string"&&(t=new TextEncoder().encode(t));const p=new Response(t,{headers:e});return Object.defineProperty(p,"url",{value:n}),p}async function AC(t){if(!t.ok)throw await EC(t)}async function EC(t){const e=TC(t.url);let i=`Failed to fetch resource (${t.status}) ${t.statusText}: ${e}`;i=i.length>100?`${i.slice(0,100)}...`:i;const n={reason:t.statusText,url:t.url,response:t};try{const o=t.headers.get("Content-Type");n.reason=!t.bodyUsed&&(o!=null&&o.includes("application/json"))?await t.json():await t.text()}catch{}return new yC(i,n)}async function CC(t){if(typeof t=="string")return`data:,${t.slice(0,5)}`;if(t instanceof Blob){const i=t.slice(0,5);return await new Promise(n=>{const o=new FileReader;o.onload=d=>{var p;return n((p=d==null?void 0:d.target)==null?void 0:p.result)},o.readAsDataURL(i)})}if(t instanceof ArrayBuffer){const i=t.slice(0,5);return`data:base64,${RC(i)}`}return null}function RC(t){let e="";const i=new Uint8Array(t);for(let n=0;n<i.byteLength;n++)e+=String.fromCharCode(i[n]);return btoa(e)}function MC(t){return!PC(t)&&!IC(t)}function PC(t){return t.startsWith("http:")||t.startsWith("https:")}function IC(t){return t.startsWith("data:")}async function l1(t,e){var i,n;if(typeof t=="string"){const o=gC(t);return MC(o)&&(i=globalThis.loaders)!=null&&i.fetchNode?(n=globalThis.loaders)==null?void 0:n.fetchNode(o,e):await fetch(o,e)}return await gS(t)}const P_=new vg({id:"loaders.gl"});class DC{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}}class OC{constructor(){Y(this,"console");this.console=console}log(...e){return this.console.log.bind(this.console,...e)}info(...e){return this.console.info.bind(this.console,...e)}warn(...e){return this.console.warn.bind(this.console,...e)}error(...e){return this.console.error.bind(this.console,...e)}}const Ub={core:{baseUrl:void 0,fetch:null,mimeType:void 0,fallbackMimeType:void 0,ignoreRegisteredLoaders:void 0,nothrow:!1,log:new OC,useL
633ocalLibraries:!1,CDN:"https://unpkg.com/@loaders.gl",worker:!0,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:X0,_nodeWorkers:!1,_workerType:"",limit:0,_limitMB:0,batchSize:"auto",batchDebounceMs:0,metadata:!1,transforms:[]}},kC={baseUri:"core.baseUrl",fetch:"core.fetch",mimeType:"core.mimeType",fallbackMimeType:"core.fallbackMimeType",ignoreRegisteredLoaders:"core.ignoreRegisteredLoaders",nothrow:"core.nothrow",log:"core.log",useLocalLibraries:"core.useLocalLibraries",CDN:"core.CDN",worker:"core.worker",maxConcurrency:"core.maxConcurrency",maxMobileConcurrency:"core.maxMobileConcurrency",reuseWorkers:"core.reuseWorkers",_nodeWorkers:"core.nodeWorkers",_workerType:"core._workerType",_worker:"core._workerType",limit:"core.limit",_limitMB:"core._limitMB",batchSize:"core.batchSize",batchDebounceMs:"core.batchDebounceMs",metadata:"core.metadata",transforms:"core.transforms",throws:"nothrow",dataType:"(no longer used)",uri:"core.baseUrl",method:"core.fetch.method",headers:"core.fetch.headers",body:"core.fetch.body",mode:"core.fetch.mode",credentials:"core.fetch.credentials",cache:"core.fetch.cache",redirect:"core.fetch.redirect",referrer:"core.fetch.referrer",referrerPolicy:"core.fetch.referrerPolicy",integrity:"core.fetch.integrity",keepalive:"
633core.fetch.keepalive",signal:"core.fetch.signal"},G0=["baseUrl","fetch","mimeType","fallbackMimeType","ignoreRegisteredLoaders","nothrow","log","useLocalLibraries","CDN","worker","maxConcurrency","maxMobileConcurrency","reuseWorkers","_nodeWorkers","_workerType","limit","_limitMB","batchSize","batchDebounceMs","metadata","transforms"];function _S(){globalThis.loaders=globalThis.loaders||{};const{loaders:t}=globalThis;return t._state||(t._state={}),t._state}function yS(){const t=_S();return t.globalOptions=t.globalOptions||{...Ub,core:{...Ub.core}},Pd(t.globalOptions)}function BC(t,e,i,n){return i=i||[],i=Array.isArray(i)?i:[i],NC(t,i),Pd(LC(e,t,n))}function Pd(t){const e=UC(t);vS(e);for(const i of G0)e.core&&e.core[i]!==void 0&&delete e[i];return e.core&&e.core._workerType!==void 0&&delete e._worker,e}function NC(t,e){c1(t,null,Ub,kC,e);for(const i of e){const n=t&&t[i.id]||{},o=i.options&&i.options[i.id]||{},d=i.deprecatedOptions&&i.deprecatedOptions[i.id]||{};c1(n,i.id,o,d,e)}}function c1(t,e,i,n,o){const d=e||"Top level",p=e?`${e}.`:"";for(const h in t){const A=!e&&Ld(t[h]),R=h==="baseUri"&&!e,B=h==="workerUrl"&&e;if(!(h in i)&&!R&&!B){if(h in n)P_.level>0&&P_.warn(`${d} loader option '${p}${h}' no longer supported, use '${n[h]}'`)();else if(!A&&P_.level>0){const N=zC(h,o);P_.warn(`${d} loader option '${p}${h}' not recognized. ${N}`)()}}}}function zC(t,e){const i=t.toLowerCase();let n="";for(const o of e)for(const d in o.options){if(t===d)return`Did you mean '${o.id}.${d}'?`;const p=d.toLowerCase();(i.startsWith(p)||p.startsWith(i))&&(n=n||`Did you mean '${o.id}.${d}'?`)}return n}function LC(t,e,i){var p;const n=t.options||{},o={...n};n.core&&(o.core={...n.core}),vS(o),((p=o.core)==null?void 0:p.log)===null&&(o.core={...o.core,log:new DC}),u1(o,Pd(yS()));const d=Pd(e);return u1(o,d),FC(o,i),jC(o),o}function u1(t,e){for(const i in e)if(i in e){const n=e[i];Jx(n)&&Jx(t[i])?t[i]={...t[i],...e[i]}:t[i]=e[i]}}function FC(t,e){var n;if(!e)return;((n=t.core)==null?void 0:n.baseUrl)!==void 0||(t.core||(t.core={}),t.core.baseUrl=pS(av(e)))}function UC(t){const e={...t};return t.core&&(e.core={...t.core}),e}function vS(t){t.baseUri!==void 0&&(t.core||(t.core={}),t.core.baseUrl===void 0&&(t.core.baseUrl=t.baseUri));for(const i of G0)if(t[i]!==void 0){const o=t.core=t.core||{};o[i]===void 0&&(o[i]=t[i])}const e=t._worker;e!==void 0&&(t.core||(t.core={}),t.core._workerType===void 0&&(t.core._workerType=e))}function jC(t){const e=t.core;if(e)for(const i of G0)e[i]!==void 0&&(t[i]=e[i])}function K0(t){return t?(Array.isArray(t)&&(t=t[0]),Array.isArray(t==null?void 0:t.extensions)):!1}function Q0(t){dy(t,"null loader"),dy(K0(t),"invalid loader");let e;return Array.isArray(t)&&(e=t[1],t=t[0],t={...t,options:{...t.options,...e}}),(t!=null&&t.parseTextSync||t!=null&&t.parseText)&&(t.text=!0),t.text||(t.binary=!0),t}const bS=()=>{const t=_S();return t.loaderRegistry=t.loaderRegistry||[],t.loaderRegistry};function VC(t){const e=bS();t=Array.isArray(t)?t:[t];for(const i of t){const n=Q0(i);e.find(o=>n===o)||e.unshift(n)}}function $C(){return bS()}const HC=/\.([^.]+)$/;async function WC(t,e=[],i,n){if(!xS(t))return null;const o=Pd(i||{});if(o.core||(o.core={}),t instanceof Response&&h1(t)){const p=await t.clone().text(),h=I_(p,e,{...o,core:{...o.core,nothrow:!0}},n);if(h)return h}let d=I_(t,e,{...o,core:{...o.core,nothrow:!0}},n);if(d)return d;if(Ud(t)&&(t=await t.slice(0,10).arrayBuffer(),d=I_(t,e,o,n)),!d&&t instanceof Response&&h1(t)){const p=await t.clone().text();d=I_(p,e,o,n)}if(!d&&!o.core.nothrow)throw new Error(wS(t));return d}function h1(t){const e=lv(t);return!!(e&&(e.startsWith("text/")||e==="application/json"||e.endsWith("+json")))}function I_(t,e=[],i,n){if(!xS(t))return null;const o=Pd(i||{});if(o.core||(o.core={}),e&&!Array.isArray(e))return Q0(e);let d=[];e&&(d=d.concat(e)),o.core.ignoreRegisteredLoaders||d.push(...$C()),qC(d);const p=XC(t,d,o,n);if(!p&&!o.core.nothrow)throw new Error(wS(t));return p}function XC(t,e,i,n){var R,B,N,F,Q;const o=ov(t),d=lv(t),p=av(o)||(n==null?void 0:n.url);let h=null,A="";return(R=i==null?void 0:i.core)!=null&&R.mimeType&&(h=Hv(e,(B=i==null?void 0:i.core)==null?void 0:B.mimeType),A=`match forced by supplied MIME type ${(N=i==null?void 0:i.core)==null?void 0:N.mimeType}`),h=h||ZC(e,p),A=A||(h?`matched url ${p}`:""),h=h||Hv(e,d),A=A||(h?`matched MIME type ${d}`:""),h=h||GC(e,t),A=A||(h?`matched initial data ${TS(t)}`:""),(F=i==null?void 0:i.core)!=null&&F.fallbackMimeType&&(h=h||Hv(e,(Q=i==null?void 0:i.core)==null?void 0:Q.fallbackMimeType),A=A||(h?`matched fallback MIME type ${d}`:"")),A&&VE.log(1,`selectLoader selected ${h==null?void 0:h.name}: ${A}.`),h}function xS(t){return!(t instanceof Response&&t.status===204)}function wS(t){const e=ov(t),i=lv(t);let n="No valid loader found (";n+=e?`${fS(e)}, `:"no url provided, ",n+=`MIME type: ${i?`"${i}"`:"not provided"}, `;const o=t?TS(t):"";return n+=o?` first bytes: "${o}"`:"first bytes: not available",n+=")",n}function qC(t){for(const e of t)Q0(e)}function ZC(t,e){const i=e&&HC.exec(e),n=i&&i[1];return n?YC(t,n):null}function YC(t,e){e=e.toLowerCase();for(const i of t)for(const n of i.extensions)if(n.toLowerCase()===e)return i;return null}function Hv(t,e){var i;for(const n of t)if((i=n.mimeTypes)!=null&&i.some(o=>a1(e,o))||a1(e,`application/x.${n.id}`))return n;return null}function GC(t,e){if(!e)return null;for(const i of t)if(typeof e=="string"){if(KC(e,i))return i}else if(ArrayBuffer.isView(e)){if(d1(e.buffer,e.byteOffset,i))return i}else if(e instanceof ArrayBuffer&&d1(e,0,i))return i;return null}function KC(t,e){return e.testText?e.testText(t):(Array.isArray(e.tests)?e.tests:[e.tests]).some(n=>t.startsWith(n))}function d1(t,e,i){return(Array.isArray(i.tests)?i.tests:[i.tests]).some(o=>QC(t,e,i,o))}function QC(t,e,i,n){if(Z0(n))return uC(n,t,n.byteLength);switch(typeof n){case"function":return n(dS(t));case"string":const o=jb(t,e,n.length);return n===o;default:return!1}}function TS(t,e=5){return typeof t=="string"?t.slice(0,e):ArrayBuffer.isView(t)?jb(t.buffer,t.byteOffset,e):t instanceof ArrayBuffer?jb(t,0,e):""}function jb(t,e,i){if(t.byteLength<e+i)return"";const n=new DataView(t);let o="";for(let d=0;d<i;d++)o+=String.fromCharCode(n.getUint8(e+d));return o}const JC=256*1024;function*eR(t,e){const i=(e==null?void 0:e.chunkSize)||JC;let n=0;const o=new TextEncoder;for(;n<t.length;){const d=Math.min(t.length-n,i),p=t.slice(n,n+d);n+=d,yield dS(o.encode(p))}}const tR=256*1024;function*iR(t,e={}){const{chunkSize:i=tR}=e;let n=0;for(;n<t.byteLength;){const o=Math.min(t.byteLength-n,i),d=new ArrayBuffer(o),p=new Uint8Array(t,n,o);new Uint8Array(d).set(p),n+=o,yield d}}const nR=1024*1024;async function*rR(t,e){const i=(e==null?void 0:e.chunkSize)||nR;let n=0;for(;n<t.size;){const o=n+i,d=await t.slice(n,o).arrayBuffer();n=o,yield d}}function f1(t,e){return X0?sR(t,e):aR(t)}async function*sR(t,e){const i=t.getReader();let n;try{for(;;){const o=n||i.read();e!=null&&e._streamReadAhead&&(n=i.read());const{done:d,value:p}=await o;
633if(d)return;yield Y0(p)}}catch{i.releaseLock()}}async function*aR(t,e){for await(const i of t)yield Y0(i)}function oR(t,e){if(typeof t=="string")return eR(t,e);if(t instanceof ArrayBuffer)return iR(t,e);if(Ud(t))return rR(t,e);if(oS(t))return f1(t,e);if(Fd(t)){const i=t.body;if(!i)throw new Error("Readable stream not available on Response");return f1(i,e)}throw new Error("makeIterator")}const SS="Cannot convert supplied data type";function lR(t,e,i){if(e.text&&typeof t=="string")return t;if(hS(t)&&(t=t.buffer),Z0(t)){const n=_C(t);return e.text&&!e.binary?new TextDecoder("utf8").decode(n):Y0(n)}throw new Error(SS)}async function cR(t,e,i){if(typeof t=="string"||Z0(t))return lR(t,e);if(Ud(t)&&(t=await gS(t)),Fd(t))return await AC(t),e.binary?await t.arrayBuffer():await t.text();if(oS(t)&&(t=oR(t,i)),HE(t)||WE(t))return fC(t);throw new Error(SS)}function AS(t,e){var d;const i=yS(),n=t||i,o=n.fetch??((d=n.core)==null?void 0:d.fetch);return typeof o=="function"?o:Ld(o)?p=>l1(p,o):e!=null&&e.fetch?e==null?void 0:e.fetch:l1}function uR(t,e,i){if(i)return i;const n={fetch:AS(e,t),...t};if(n.url){const o=av(n.url);n.baseUrl=o,n.queryString=wC(n.url),n.filename=fS(o),n.baseUrl=pS(o)}return Array.isArray(n.loaders)||(n.loaders=null),n}function hR(t,e){if(t&&!Array.isArray(t))return t;let i;if(t&&(i=Array.isArray(t)?t:[t]),e&&e.loaders){const n=Array.isArray(e.loaders)?e.loaders:[e.loaders];i=i?[...i,...n]:n}return i&&i.length?i:void 0}async function my(t,e,i,n){e&&!Array.isArray(e)&&!K0(e)&&(n=void 0,i=e,e=void 0),t=await t,i=i||{};const o=ov(t),p=hR(e,n),h=await WC(t,p,i);if(!h)return null;const A=BC(i,h,p,o);return n=uR({url:o,_parse:my,loaders:p},A,n||null),await dR(h,t,A,n)}async function dR(t,e,i,n){if(aC(t),i=ZE(t.options,i),Fd(e)){const{ok:d,redirected:p,status:h,statusText:A,type:R,url:B}=e,N=Object.fromEntries(e.headers.entries());n.response={headers:N,ok:d,redirected:p,status:h,statusText:A,type:R,url:B}}e=await cR(e,t,i);const o=t;if(o.parseTextSync&&typeof e=="string")return o.parseTextSync(e,i,n);if(oC(t,i))return await lC(t,e,i,n,my);if(o.parseText&&typeof e=="string")return await o.parseText(e,i,n);if(o.parse)return await o.parse(e,i,n);throw gh(!o.parseSync),new Error(`${t.id} loader - no parser found and worker is disabled`)}function fR(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function pR(t){return Array.isArray(t)?t.length===0||typeof t[0]=="number":!1}function mR(t){return fR(t)||pR(t)}async function Vb(t,e,i,n){var A;let o,d;!Array.isArray(e)&&!K0(e)?(o=[],d=e):(o=e,d=i);const p=AS(d);let h=t;return typeof t=="string"&&(h=await p(t)),Ud(t)&&(h=await p(t)),typeof t=="string"&&((A=Pd(d||{}).core)!=null&&A.baseUrl||(d={...d,core:{...d==null?void 0:d.core,baseUrl:t}})),Array.isArray(o)?await my(h,o,d):await my(h,o,d)}const gR="4.4.4";var eS;const _R=(eS=globalThis.loaders)==null?void 0:eS.parseImageNode,$b=typeof Image<"u",Hb=typeof ImageBitmap<"u",yR=!!_R,Wb=X0?!0:yR;function vR(t){switch(t){case"auto":return Hb||$b||Wb;case"imagebitmap":return Hb;case"image":return $b;case"data":return Wb;default:throw new Error(`@loaders.gl/images: image ${t} not supported in this environment`)}}function bR(){if(Hb)return"imagebitmap";if($b)return"image";if(Wb)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function xR(t){const e=TR(t);if(!e)throw new Error("Not an image");return e}function wR(t){switch(xR(t)){case"data":return t;case"image":case"imagebitmap":const e=document.createElement("canvas"),i=e.getContext("2d");if(!i)throw new Error("getImageData");return e.width=t.width,e.height=t.height,i.drawImage(t,0,0),i.getImageData(0,0,t.width,t.height);default:throw new Error("getImageData")}}function TR(t){return typeof ImageBitmap<"u"&&t instanceof ImageBitmap?"imagebitmap":typeof Image<"u"&&t instanceof Image?"image":t&&typeof t=="object"&&t.data&&t.width&&t.height?"data":null}const SR=/^data:image\/svg\+xml/,AR=/\.svg((\?|#).*)?$/;function J0(t){return t&&(SR.test(t)||AR.test(t))}function ER(t,e){if(J0(e)){let n=new TextDecoder().decode(t);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(n=unescape(encodeURIComponent(n)))}catch(d){throw new Error(d.message)}return`data:image/svg+xml;base64,${btoa(n)}`}return ES(t,e)}function ES(t,e){if(J0(e))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(t)])}
vendor: 6,081 bytes, lines 633-656
633async function CS(t,e,i){const n=ER(t,i),o=self.URL||self.webkitURL,d=typeof n!="string"&&o.createObjectURL(n);try{return await CR(d||n,e)}finally{d&&o.revokeObjectURL(d)}}async function CR(t,e){const i=new Image;return i.src=t,e.image&&e.image.decode&&i.decode?(await i.decode(),i):await new Promise((n,o)=>{try{i.onload=()=>n(i),i.onerror=d=>{const p=d instanceof Error?d.message:"error";o(new Error(p))}}catch(d){o(d)}})}let p1=!0;async function RR(t,e,i){let n;J0(i)?n=await CS(t,e,i):n=ES(t,i);const o=e&&e.imagebitmap;return await MR(n,o)}async function MR(t,e=null){if((PR(e)||!p1)&&(e=null),e)try{return await createImageBitmap(t,e)}catch(i){console.warn(i),p1=!1}return await createImageBitmap(t)}function PR(t){if(!t)return!0;for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}function IR(t){return!BR(t,"ftyp",4)||(t[8]&96)===0?null:DR(t)}function DR(t){switch(OR(t,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function OR(t,e,i){return String.fromCharCode(...t.slice(e,i))}function kR(t){return[...t].map(e=>e.charCodeAt(0))}function BR(t,e,i=0){const n=kR(e);for(let o=0;o<n.length;++o)if(n[o]!==t[o+i])return!1;return!0}const Ql=!1,tg=!0;function RS(t){const e=bg(t);return zR(e)||UR(e)||LR(e)||FR(e)||NR(e)}function NR(t){const e=new Uint8Array(t instanceof DataView?t.buffer:t),i=IR(e);return i?{mimeType:i.mimeType,width:0,height:0}:null}function zR(t){const e=bg(t);return e.byteLength>=24&&e.getUint32(0,Ql)===2303741511?{mimeType:"image/png",width:e.getUint32(16,Ql),height:e.getUint32(20,Ql)}:null}function LR(t){const e=bg(t);return e.byteLength>=10&&e.getUint32(0,Ql)===1195984440?{mimeType:"image/gif",width:e.getUint16(6,tg),height:e.getUint16(8,tg)}:null}function FR(t){const e=bg(t);return e.byteLength>=14&&e.getUint16(0,Ql)===16973&&e.getUint32(2,tg)===e.byteLength?{mimeType:"image/bmp",width:e.getUint32(18,tg),height:e.getUint32(22,tg)}:null}function UR(t){const e=bg(t);if(!(e.byteLength>=3&&e.getUint16(0,Ql)===65496&&e.getUint8(2)===255))return null;const{tableMarkers:n,sofMarkers:o}=jR();let d=2;for(;d+9<e.byteLength;){const p=e.getUint16(d,Ql);if(o.has(p))return{mimeType:"image/jpeg",height:e.getUint16(d+5,Ql),width:e.getUint16(d+7,Ql)};if(!n.has(p))return null;d+=2,d+=e.getUint16(d,Ql)}return null}function jR(){const t=new Set([65499,65476,65484,65501,65534]);for(let i=65504;i<65520;++i)t.add(i);return{tableMarkers:t,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function bg(t){if(t instanceof DataView)return t;if(ArrayBuffer.isView(t))return new DataView(t.buffer);if(t instanceof ArrayBuffer)return new DataView(t);throw new Error("toDataView")}async function VR(t,e){var o;const{mimeType:i}=RS(t)||{},n=(o=globalThis.loaders)==null?void 0:o.parseImageNode;return dy(n),await n(t,i)}async function $R(t,e,i){e=e||{};const o=(e.image||{}).type||"auto",{url:d}=i||{},p=HR(o);let h;switch(p){case"imagebitmap":h=await RR(t,e,d);break;case"image":h=await CS(t,e,d);break;case"data":h=await VR(t);break;default:dy(!1)}return o==="data"&&(h=wR(h)),h}function HR(t){switch(t){case"auto":case"data":return bR();default:return vR(t),t}}const WR=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],XR=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],qR={image:{type:"auto",decode:!0}},ZR={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:gR,mimeTypes:XR,extensions:WR,parse:$R,tests:[t=>!!RS(new DataView(t))],options:qR},On=new vg({id:"deck"});let Xb={};function YR(t){Xb=t}function aa(t,e,i,n){On.level>0&&Xb[t]&&Xb[t].call(null,e,i,n)}function GR(t){const e=t[0],i=t[t.length-1];return e==="{"&&i==="}"||e==="["&&i==="]"}const KR={dataType:null,batchType:null,id:"JSON",name:"JSON",module:"",version:"",options:{},extensions:["json","geojson"],mimeTypes:["application/json","application/geo+json"],testText:GR,parseTextSync:JSON.parse};function QR(){const t="9.3.7",e=globalThis.deck&&globalThis.deck.VERSION;if(e&&e!==t)throw new Error(`deck.gl - multiple versions detected: ${e} vs ${t}`);return e||(On.log(1,`deck.gl ${t}`)(),globalThis.deck={...globalThis.deck,VERSION:t,version:t,log:On,_registerLoggers:YR},VC([KR,[ZR,{imagebitmap:{premultiplyAlpha:"none"}}]])),t}const JR=QR();function xg(t,e){var i;if(!t){const n=new Error(e||"shadertools: assertion failed.");throw(i=Error.captureStackTrace)==null||i.call(Error,n,xg),n}}const Wv={number:{type:"number",validate(t,e){return Number.isFinite(t)&&typeof e=="object"&&(e.max===void 0||t<=e.max)&&(e.min===void 0||t>=e.min)}},array:{type:"array",validate(t,e){return Array.isArray(t)||ArrayBuffer.isView(t)}}};function e3(t){const e={};for(const[i,n]of Object.entries(t))e[i]=t3(n);return e}function t3(t){let e=m1(t);if(e!=="object")return{value:t,...Wv[e],type:e};if(typeof t=="object")return t?t.type!==void 0?{...t,...Wv[t.type],type:t.type}:t.value===void 0?{type:"object",value:t}:(e=m1(t.value),{...t,...Wv[e],type:e}):{type:"object",value:null};throw new Error("props")}function m1(t){return Array.isArray(t)||ArrayBuffer.isView(t)?"array":typeof t}const i3=`#ifdef MODULE_LOGDEPTH 634 logdepth_adjustPosition(gl_Position); 635#endif 636`,n3=`#ifdef MODULE_MATERIAL 637 fragColor = material_filterColor(fragColor); 638#endif 639 640#ifdef MODULE_LIGHTING 641 fragColor = lighting_filterColor(fragColor); 642#endif 643 644#ifdef MODULE_FOG 645 fragColor = fog_filterColor(fragColor); 646#endif 647 648#ifdef MODULE_PICKING 649 fragColor = picking_filterHighlightColor(fragColor); 650 fragColor = picking_filterPickingColor(fragColor); 651#endif 652 653#ifdef MODULE_LOGDEPTH 654 logdepth_setFragDepth(); 655#endif 656`,r3={vertex:i3,fragment:n3},g1=/void\s+main\s*\([^)]*\)\s*\{\n?/,_1=/}\n?[^{}]*$/,Xv=[],ny="__LUMA_INJECT_DECLARATIONS__";function s3(t){const e={vertex:{},fragment:{}};for(const i in t){let n=t[i];const o=a3(i);typeof n=="string"&&(n={order:0,injection:n}),e[o][i]=n}return e}function a3(t){const e=t.slice(0,2);switch(e){case"vs":return"vertex";
656case"fs":return"fragment";default:throw new Error(e)}}function gy(t,e,i,n=!1){const o=e==="vertex";for(const d in i){const p=i[d];p.sort((A,R)=>A.order-R.order),Xv.length=p.length;for(let A=0,R=p.length;A<R;++A)Xv[A]=p[A].injection;const h=`${Xv.join(` 657`)} 658`;switch(d){case"vs:#decl":o&&(t=t.replace(ny,h));break;case"vs:#main-start":o&&(t=t.replace(g1,A=>A+h));break;case"vs:#main-end":o&&(t=t.replace(_1,A=>h+A));break;case"fs:#decl":o||(t=t.replace(ny,h));break;case"fs:#main-start":o||(t=t.replace(g1,A=>A+h));break;case"fs:#main-end":o||(t=t.replace(_1,A=>h+A));break;default:t=t.replace(d,A=>A+h)}}return t=t.replace(ny,""),n&&(t=t.replace(/\}\s*$/,d=>d+r3[e])),t}function _y(t){t.map(e=>o3(e))}function o3(t){if(t.instance)return;_y(t.dependencies||[]);const{propTypes:e={},deprecations:i=[],inject:n={}}=t,o={normalizedInjections:s3(n),parsedDeprecations:l3(i)};e&&(o.propValidators=e3(e)),t.instance=o;let d={};e&&(d=Object.entries(e).reduce((p,[h,A])=>{const R=A==null?void 0:A.value;return R&&(p[h]=R),p},{})),t.defaultUniforms={...t.defaultUniforms,...d}}function MS(t,e,i){var n;(n=t.deprecations)==null||n.forEach(o=>{var d;(d=o.regex)!=null&&d.test(e)&&(o.deprecated?i.deprecated(o.old,o.new)():i.removed(o.old,o.new)())})}function l3(t){return t.forEach(e=>{switch(e.type){case"function":e.regex=new RegExp(`\\b${e.old}\\(`);break;default:e.regex=new RegExp(`${e.type} ${e.old};`)}}),t}function ex(t){_y(t);const e={},i={};PS({modules:t,level:0,moduleMap:e,moduleDepth:i});const n=Object.keys(i).sort((o,d)=>i[d]-i[o]).map(o=>e[o]);return _y(n),n}function PS(t){const{modules:e,level:i,moduleMap:n,moduleDepth:o}=t;if(i>=5)throw new Error("Possible loop in shader dependency graph");for(const d of e)n[d.name]=d,(o[d.name]===void 0||o[d.name]<i)&&(o[d.name]=i);for(const d of e)d.dependencies&&PS({modules:d.dependencies,level:i+1,moduleMap:n,moduleDepth:o})}const c3=/^(?:uniform\s+)?(?:(?:lowp|mediump|highp)\s+)?[A-Za-z0-9_]+(?:<[^>]+>)?\s+([A-Za-z0-9_]+)(?:\s*\[[^\]]+\])?\s*;/,u3=/((?:layout\s*\([^)]*\)\s*)*)uniform\s+([A-Za-z_][A-Za-z0-9_]*)\s*\{([\s\S]*?)\}\s*([A-Za-z_][A-Za-z0-9_]*)?\s*;/g;function IS(t){return`${t.name}Uniforms`}function h3(t,e){const i=e==="wgsl"?t.source:e==="vertex"?t.vs:t.fs;if(!i)return null;const n=IS(t);return m3(i,e==="wgsl"?"wgsl":"glsl",n)}function d3(t,e){const i=Object.keys(t.uniformTypes||{});if(!i.length)return null;const n=h3(t,e);return n?{moduleName:t.name,uniformBlockName:IS(t),stage:e,expectedUniformNames:i,actualUniformNames:n,matches:y3(i,n)}:null}function f3(t,e,i={}){var d,p;const n=d3(t,e);if(!n||n.matches)return n;const o=v3(n);return(p=(d=i.log)==null?void 0:d.error)==null||p.call(d,o,n)(),i.throwOnError!==!1&&xg(!1,o),n}function DS(t){var n;const e=[],i=b3(t);for(const o of i.matchAll(u3)){const d=((n=o[1])==null?void 0:n.trim())||null;e.push({blockName:o[2],body:o[3],instanceName:o[4]||null,layoutQualifier:d,hasLayoutQualifier:!!d,isStd140:!!(d&&/\blayout\s*\([^)]*\bstd140\b[^)]*\)/.exec(d))})}return e}function p3(t,e,i,n){var p;const o=DS(t).filter(h=>!h.isStd140),d=new Set;for(const h of o){if(d.has(h.blockName))continue;d.add(h.blockName);const A="",R=h.hasLayoutQualifier?`declares ${x3(h.layoutQualifier)} instead of layout(std140)`:"does not declare layout(std140)",B=`${A}${e} shader uniform block ${h.blockName} ${R}. luma.gl host-side shader block packing assumes explicit layout(std140) for GLSL uniform blocks. Add \`layout(std140)\` to the block declaration.`;(p=i==null?void 0:i.warn)==null||p.call(i,B,h)()}return o}function m3(t,e,i){const n=e==="wgsl"?g3(t,i):_3(t,i);if(!n)return null;const o=[];for(const d of n.split(` 659`)){const p=d.replace(/\/\/.*$/,"").trim();if(!p||p.startsWith("#"))continue;const h=e==="wgsl"?p.match(/^([A-Za-z0-9_]+)\s*:/):p.match(c3);h&&o.push(h[1])}return o}function g3(t,e){const i=new RegExp(`\\bstruct\\s+${e}\\b`,"m").exec(t);if(!i)return null;const n=t.indexOf("{",i.index);if(n<0)return null;let o=0;for(let d=n;d<t.length;d++){const p=t[d];if(p==="{"){o++;continue}if(p==="}"&&(o--,o===0))return t.slice(n+1,d)}return null}function _3(t,e){const i=DS(t).find(n=>n.blockName===e);return(i==null?void 0:i.body)||null}function y3(t,e){if(t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0}function v3(t){const{expectedUniformNames:e,actualUniformNames:i}=t,n=e.filter(h=>!i.includes(h)),o=i.filter(h=>!e.includes(h)),d=[`Expected ${e.length} fields, found ${i.length}.`],p=w3(e,i);return p&&d.push(p),n.length&&d.push(`Missing from shader block (${n.length}): ${y1(n)}.`),o.length&&d.push(`Unexpected in shader block (${o.length}): ${y1(o)}.`),e.length<=12&&i.length<=12&&(n.length||o.length)&&(d.push(`Expected: ${e.join(", ")}.`),d.push(`Actual: ${i.join(", ")}.`)),`${t.moduleName}: ${t.stage} shader uniform block ${t.uniformBlockName} does not match module.uniformTypes. ${d.join(" ")}`}function b3(t){return t.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\/\/.*$/gm,"")}function x3(t){return t.replace(/\s+/g," ").trim()}function w3(t,e){const i=Math.min(t.length,e.length);for(let n=0;n<i;n++)if(t[n]!==e[n])return`First mismatch at field ${n+1}: expected ${t[n]}, found ${e[n]}.`;return t.length>e.length?`Shader block ends after field ${e.length}; expected next field ${t[e.length]}.`:e.length>t.length?`Shader block has extra field ${e.length}: ${e[t.length]}.`:null}function y1(t,e=8){if(t.length<=e)return t.join(", ");const i=t.length-e;return`${t.slice(0,e).join(", ")}, ... (${i} more)`}function T3(t){switch(t==null?void 0:t.gpu.toLowerCase()){case"apple":return`#define APP
659LE_GPU 660// Apple optimizes away the calculation necessary for emulated fp64 661#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1 662#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1 663// Intel GPU doesn't have full 32 bits precision in same cases, causes overflow 664#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1 665`;case"nvidia":return`#define NVIDIA_GPU 666// Nvidia optimizes away the calculation necessary for emulated fp64 667#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1 668`;case"intel":return`#define INTEL_GPU 669// Intel optimizes away the calculation necessary for emulated fp64 670#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1 671// Intel's built-in 'tan' function doesn't have acceptable precision 672#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1 673// Intel GPU doesn't have full 32 bits precision in same cases, causes overflow 674#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1 675`;case"amd":return`#define AMD_GPU 676`;default:return`#define DEFAULT_GPU 677// Prevent driver from optimizing away the calculation necessary for emulated fp64 678#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1 679// Headless Chrome's software shader 'tan' function doesn't have acceptable precision 680#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1 681// If the GPU doesn't have full 32 bits precision, will causes overflow 682#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1 683`}}function S3(t,e){var n;if(Number(((n=t.match(/^#version[ \t]+(\d+)/m))==null?void 0:n[1])||100)!==300)throw new Error("luma.gl v9 only supports GLSL 3.00 shader sources");switch(e){case"vertex":return t=v1(t,A3),t;case"fragment":return t=v1(t,E3),t;default:throw new Error(e)}}const OS=[[/^(#version[ \t]+(100|300[ \t]+es))?[ \t]*\n/,`#version 300 es 684`],[/\btexture(2D|2DProj|Cube)Lod(EXT)?\(/g,"textureLod("],[/\btexture(2D|2DProj|Cube)(EXT)?\(/g,"texture("]],A3=[...OS,[qb("attribute"),"in $1"],[qb("varying"),"out $1"]],E3=[...OS,[qb("varying"),"in $1"]];function v1(t,e){for(const[i,n]of e)t=t.replace(i,n);return t}function qb(t){return new RegExp(`\\b${t}[ \\t]+(\\w+[ \\t]+\\w+(\\[\\w+\\])?;)`,"g")}function kS(t,e){let i="";for(const n in t){const o=t[n];if(i+=`void ${o.signature} { 685`,o.header&&(i+=` ${o.header}`),e[n]){const d=e[n];d.sort((p,h)=>p.order-h.order);for(const p of d)i+=` ${p.injection} 686`}o.footer&&(i+=` ${o.footer}`),i+=`} 687`}return i}function BS(t){const e={vertex:{},fragment:{}};for(const i of t){let n,o;typeof i!="string"?(n=i,o=n.hook):(n={},o=i),o=o.trim();const[d,p]=o.split(":"),h=o.replace(/\(.+/,""),A=Object.assign(n,{signature:p});switch(d){case"vs":e.vertex[h]=A;break;case"fs":e.fragment[h]=A;break;default:throw new Error(d)}}return e}function C3(t,e){return{name:R3(t,e),language:"glsl",version:M3(t)}}function R3(t,e="unnamed"){const n=/#define[^\S\r\n]*SHADER_NAME[^\S\r\n]*([A-Za-z0-9_-]+)\s*/.exec(t);return n?n[1]:e}function M3(t){let e=100;const i=t.match(/[^\s]+/g);if(i&&i.length>=2&&i[0]==="#version"){const n=parseInt(i[1],10);Number.isFinite(n)&&(e=n)}if(e!==100&&e!==300)throw new Error(`Invalid GLSL version ${e}`);return e}const mo="(?:var<\\s*(uniform|storage(?:\\s*,\\s*[A-Za-z_][A-Za-z0-9_]*)?)\\s*>|var)\\s+([A-Za-z_][A-Za-z0-9_]*)",go="\\s*",ug=[new RegExp(`@binding\\(\\s*(auto|\\d+)\\s*\\)${go}@group\\(\\s*(\\d+)\\s*\\)${go}${mo}`,"g"),new RegExp(`@group\\(\\s*(\\d+)\\s*\\)${go}@binding\\(\\s*(auto|\\d+)\\s*\\)${go}${mo}`,"g")],Zb=[new RegExp(`@binding\\(\\s*(auto|\\d+)\\s*\\)${go}@group\\(\\s*(\\d+)\\s*\\)${go}${mo}`,"g"),new RegExp(`@group\\(\\s*(\\d+)\\s*\\)${go}@binding\\(\\s*(auto|\\d+)\\s*\\)${go}${mo}`,"g")],P3=[new RegExp(`@binding\\(\\s*(\\d+)\\s*\\)${go}@group\\(\\s*(\\d+)\\s*\\)${go}${mo}`,"g"),new RegExp(`@group\\(\\s*(\\d+)\\s*\\)${go}@binding\\(\\s*(\\d+)\\s*\\)${go}${mo}`,"g")],I3=[new RegExp(`@binding\\(\\s*(auto)\\s*\\)\\s*@group\\(\\s*(\\d+)\\s*\\)\\s*${mo}`,"g"),new RegExp(`@group\\(\\s*(\\d+)\\s*\\)\\s*@binding\\(\\s*(auto)\\s*\\)\\s*${mo}`,"g"),new RegExp(`@binding\\(\\s*(auto)\\s*\\)\\s*@group\\(\\s*(\\d+)\\s*\\)(?:[\\s\\n\\r]*@[A-Za-z_][^\\n\\r]*)*[\\s\\n\\r]*${mo}`,"g"),new RegExp(`@group\\(\\s*(\\d+)\\s*\\)\\s*@binding\\(\\s*(auto)\\s*\\)(?:[\\s\\n\\r]*@[A-Za-z_][^\\n\\r]*)*[\\s\\n\\r]*${mo}`,"g")];function tx(t){const e=t.split("");let i=0,n=0,o=!1,d=!1,p=!1;for(;i<t.length;){const h=t[i],A=t[i+1];if(d){p?p=!1:h==="\\"?p=!0:h==='"'&&(d=!1),i++;continue}if(o){h===` 688`||h==="\r"?o=!1:e[i]=" ",i++;continue}if(n>0){if(h==="/"&&A==="*"){e[i]=" ",e[i+1]=" ",n++,i+=2;continue}if(h==="*"&&A==="/"){e[i]=" ",e[i+1]=" ",n--,i+=2;continue}h!==` 689`&&h!=="\r"&&(e[i]=" "),i++;continue}if(h==='"'){d=!0,i++;continue}if(h==="/"&&A==="/"){e[i]=" ",e[i+1]=" ",o=!0,i+=2;continue}if(h==="/"&&A==="*"){e[i]=" ",e[i+1]=" ",n=1,i+=2;continue}i++}return e.join("")}function wp(t,e){var o;const i=tx(t),n=[];for(const d of e){d.lastIndex=0;let p;for(p=d.exec(i);p;
689){const h=d===e[0],A=p.index,R=p[0].length;n.push({match:t.slice(A,A+R),index:A,length:R,bindingToken:p[h?1:2],groupToken:p[h?2:1],accessDeclaration:(o=p[3])==null?void 0:o.trim(),name:p[4]}),p=d.exec(i)}}return n.sort((d,p)=>d.index-p.index)}function NS(t,e,i){const n=wp(t,e);if(!n.length)return t;let o="",d=0;for(const p of n)o+=t.slice(d,p.index),o+=i(p),d=p.index+p.length;return o+=t.slice(d),o}function zS(t){return/@binding\(\s*auto\s*\)/.test(tx(t))}function D3(t,e){return wp(t,e===ug||e===Zb?I3:e).find(n=>n.bindingToken==="auto")}const b1=[new RegExp(`@binding\\(\\s*(\\d+)\\s*\\)\\s*@group\\(\\s*(\\d+)\\s*\\)\\s*${mo}\\s*:\\s*([^;]+);`,"g"),new RegExp(`@group\\(\\s*(\\d+)\\s*\\)\\s*@binding\\(\\s*(\\d+)\\s*\\)\\s*${mo}\\s*:\\s*([^;]+);`,"g")];function LS(t,e=[]){var d;const i=tx(t),n=new Map;for(const p of e)n.set(x1(p.name,p.group,p.location),p.moduleName);const o=[];for(const p of b1){p.lastIndex=0;let h;for(h=p.exec(i);h;){const A=p===b1[0],R=Number(h[A?1:2]),B=Number(h[A?2:1]),N=(d=h[3])==null?void 0:d.trim(),F=h[4],Q=h[5].trim(),re=n.get(x1(F,B,R));o.push(O3({name:F,group:B,binding:R,owner:re?"module":"application",moduleName:re,accessDeclaration:N,resourceType:Q})),h=p.exec(i)}}return o.sort((p,h)=>p.group!==h.group?p.group-h.group:p.binding!==h.binding?p.binding-h.binding:p.name.localeCompare(h.name))}function O3(t){const e={name:t.name,group:t.group,binding:t.binding,owner:t.owner,kind:"unknown",moduleName:t.moduleName,resourceType:t.resourceType};if(t.accessDeclaration){const i=t.accessDeclaration.split(",").map(n=>n.trim());if(i[0]==="uniform")return{...e,kind:"uniform",access:"uniform"};if(i[0]==="storage"){const n=i[1]||"read_write";return{...e,kind:n==="read"?"read-only-storage":"storage",access:n}}}return t.resourceType==="sampler"||t.resourceType==="sampler_comparison"?{...e,kind:"sampler",samplerKind:t.resourceType==="sampler_comparison"?"comparison":"filtering"}:t.resourceType.startsWith("texture_storage_")?{...e,kind:"storage-texture",access:B3(t.resourceType),viewDimension:w1(t.resourceType)}:t.resourceType.startsWith("texture_")?{...e,kind:"texture",viewDimension:w1(t.resourceType),sampleType:k3(t.resourceType),multisampled:t.resourceType.startsWith("texture_multisampled_")}:e}function x1(t,e,i){return`${e}:${i}:${t}`}function w1(t){if(t.includes("cube_array"))return"cube-array";if(t.includes("2d_array"))return"2d-array";if(t.includes("cube"))return"cube";if(t.includes("3d"))return"3d";if(t.includes("2d"))return"2d";if(t.includes("1d"))return"1d"}function k3(t){if(t.startsWith("texture_depth_"))return"depth";if(t.includes("<i32>"))return"sint";if(t.includes("<u32>"))return"uint";if(t.includes("<f32>"))return"float"}function B3(t){const e=/,\s*([A-Za-z_][A-Za-z0-9_]*)\s*>$/.exec(t);return e==null?void 0:e[1]}const ix=` 690 691${ny} 692`,hg=100,N3=`precision highp float; 693`;function z3(t){const e=ex(t.modules||[]),{source:i,bindingAssignments:n}=F3(t.platformInfo,{...t,source:t.source,stage:"vertex",modules:e});return{source:i,getUniforms:FS(e),bindingAssignments:n,bindingTable:LS(i,n)}}function L3(t){const{vs:e,fs:i}=t,n=ex(t.modules||[]);return{vs:T1(t.platformInfo,{...t,source:e,stage:"vertex",modules:n}),fs:T1(t.platformInfo,{...t,source:i,stage:"fragment",modules:n}),getUniforms:FS(n)}}function F3(t,e){var ve;const{source:i,stage:n,modules:o,hookFunctions:d=[],inject:p={},log:h}=e;xg(typeof i=="string","shader source must be a string");const A=i;let R="";const B=BS(d),N={},F={},Q={};for(const Oe in p){const Te=typeof p[Oe]=="string"?{injection:p[Oe],order:0}:p[Oe],Re=/^(v|f)s:(#)?([\w-]+)$/.exec(Oe);if(Re){const Ee=Re[2],Je=Re[3];Ee?Je==="decl"?F[Oe]=[Te]:Q[Oe]=[Te]:N[Oe]=[Te]}else Q[Oe]=[Te]}const re=o,se=V3(A),ae=j3(se.source),me=X3(re,e._bindingRegistry,ae),we=[];for(const Oe of re){h&&MS(Oe,A,h);const Te=$3(US(Oe,"wgsl",h),Oe,{usedBindingsByGroup:ae,bindingRegistry:e._bindingRegistry,reservedBindingKeysByGroup:me});we.push(...Te.bindingAssignments);const Re=Te.source;R+=Re;const Ee=((ve=Oe.injections)==null?void 0:ve[n])||{};for(const Je in Ee){const rt=/^(v|f)s:#([\w-]+)$/.exec(Je);if(rt){const Qe=rt[2]==="decl"?F:Q;Qe[Je]=Qe[Je]||[],Qe[Je].push(Ee[Je])}else N[Je]=N[Je]||[],N[Je].push(Ee[Je])}}return R+=ix,R=gy(R,n,F),R+=kS(B[n],N),R+=K3(we),R+=se.source,R=gy(R,n,Q),G3(R),{source:R,bindingAssignments:we}}function T1(t,e){var Re;const{source:i,stage:n,language:o="glsl",modules:d,defines:p={},hookFunctions:h=[],inject:A={},prologue:R=!0,log:B}=e;xg(typeof i=="string","shader source must be a string");const N=o==="glsl"?C3(i).version:-1,F=t.shaderLanguageVersion,Q=N===100?"#version 100":"#version 300 es",se=i.split(` 694`).slice(1).join(` 695`),ae={};d.forEach(Ee=>{Object.assign(ae,Ee.defines)}),Object.assign(ae,p);let me="";switch(o){case"wgsl":break;case"glsl":me=R?`${Q} 696 697// ----- PROLOGUE ------------------------- 698${`#define SHADER_TYPE_${n.toUpperCase()}`} 699 700${T3(t)} 701${n==="fragment"?N3:""} 702 703// ----- APPLICATION DEFINES ------------------------- 704 705${U3(ae)} 706 707`:`${Q} 708`;break}const we=BS(h),ve={},Oe={},Te={};
708for(const Ee in A){const Je=typeof A[Ee]=="string"?{injection:A[Ee],order:0}:A[Ee],rt=/^(v|f)s:(#)?([\w-]+)$/.exec(Ee);if(rt){const Ke=rt[2],Qe=rt[3];Ke?Qe==="decl"?Oe[Ee]=[Je]:Te[Ee]=[Je]:ve[Ee]=[Je]}else Te[Ee]=[Je]}for(const Ee of d){B&&MS(Ee,se,B);const Je=US(Ee,n,B);me+=Je;const rt=((Re=Ee.instance)==null?void 0:Re.normalizedInjections[n])||{};for(const Ke in rt){const Qe=/^(v|f)s:#([\w-]+)$/.exec(Ke);if(Qe){const At=Qe[2]==="decl"?Oe:Te;At[Ke]=At[Ke]||[],At[Ke].push(rt[Ke])}else ve[Ke]=ve[Ke]||[],ve[Ke].push(rt[Ke])}}return me+="// ----- MAIN SHADER SOURCE -------------------------",me+=ix,me=gy(me,n,Oe),me+=kS(we[n],ve),me+=se,me=gy(me,n,Te),o==="glsl"&&N!==F&&(me=S3(me,n)),o==="glsl"&&p3(me,n,B),me.trim()}function FS(t){return function(i){var o;const n={};for(const d of t){const p=(o=d.getUniforms)==null?void 0:o.call(d,i,n);Object.assign(n,p)}return n}}function U3(t={}){let e="";for(const i in t){const n=t[i];(n||Number.isFinite(n))&&(e+=`#define ${i.toUpperCase()} ${t[i]} 709`)}return e}function US(t,e,i){let n;switch(e){case"vertex":n=t.vs||"";break;case"fragment":n=t.fs||"";break;case"wgsl":n=t.source||"";break;default:xg(!1)}if(!t.name)throw new Error("Shader module must have a name");f3(t,e,{log:i});const o=t.name.toUpperCase().replace(/[^0-9a-z]/gi,"_");let d=`// ----- MODULE ${t.name} --------------- 710 711`;return e!=="wgsl"&&(d+=`#define MODULE_${o} 712`),d+=`${n} 713`,d}function j3(t){const e=new Map;for(const i of wp(t,P3)){const n=Number(i.bindingToken),o=Number(i.groupToken);nx(o,n,i.name),np(e,o,n,`application binding "${i.name}"`)}return e}function V3(t){const e=wp(t,Zb),i=new Map;for(const d of e){if(d.bindingToken==="auto")continue;const p=Number(d.bindingToken),h=Number(d.groupToken);nx(h,p,d.name),np(i,h,p,`application binding "${d.name}"`)}const n={sawSupportedBindingDeclaration:e.length>0},o=NS(t,Zb,d=>W3(d,i,n));if(zS(t)&&!n.sawSupportedBindingDeclaration)throw new Error('Unsupported @binding(auto) declaration form in application WGSL. Use adjacent "@group(N)" and "@binding(auto)" decorators followed by a bindable "var" declaration.');return{source:o}}function $3(t,e,i){const n=[],d={sawSupportedBindingDeclaration:wp(t,ug).length>0,nextHintedBindingLocation:typeof e.firstBindingSlot=="number"?e.firstBindingSlot:null},p=NS(t,ug,h=>H3(h,{module:e,context:i,bindingAssignments:n,relocationState:d}));if(zS(t)&&!d.sawSupportedBindingDeclaration)throw new Error(`Unsupported @binding(auto) declaration form in module "${e.name}". Use adjacent "@group(N)" and "@binding(auto)" decorators followed by a bindable "var" declaration.`);return{source:p,bindingAssignments:n}}function H3(t,e){var F,Q;const{module:i,context:n,bindingAssignments:o,relocationState:d}=e,{match:p,bindingToken:h,groupToken:A,name:R}=t,B=Number(A);if(h==="auto"){const re=jS(B,i.name,R),se=(F=n.bindingRegistry)==null?void 0:F.get(re),ae=se!==void 0?se:d.nextHintedBindingLocation===null?A1(B,n.usedBindingsByGroup):A1(B,n.usedBindingsByGroup,d.nextHintedBindingLocation);return S1(i.name,B,ae,R),se!==void 0&&q3(n.reservedBindingKeysByGroup,B,ae,re)?(o.push({moduleName:i.name,name:R,group:B,location:ae}),p.replace(/@binding\(\s*auto\s*\)/,`@binding(${ae})`)):(np(n.usedBindingsByGroup,B,ae,`module "${i.name}" binding "${R}"`),(Q=n.bindingRegistry)==null||Q.set(re,ae),o.push({moduleName:i.name,name:R,group:B,location:ae}),d.nextHintedBindingLocation!==null&&se===void 0&&(d.nextHintedBindingLocation=ae+1),p.replace(/@binding\(\s*auto\s*\)/,`@binding(${ae})`))}const N=Number(h);return S1(i.name,B,N,R),np(n.usedBindingsByGroup,B,N,`module "${i.name}" binding "${R}"`),o.push({moduleName:i.name,name:R,group:B,location:N}),p}function W3(t,e,i){const{match:n,bindingToken:o,groupToken:d,name:p}=t,h=Number(d);if(o==="auto"){const A=Y3(h,e);return nx(h,A,p),np(e,h,A,`application binding "${p}"`),n.replace(/@binding\(\s*auto\s*\)/,`@binding(${A})`)}return i.sawSupportedBindingDeclaration=!0,n}function X3(t,e,i){const n=new Map;if(!e)return n;for(const o of t)for(const d of Z3(o)){const p=jS(d.group,o.name,d.name),h=e.get(p);if(h!==void 0){const A=n.get(d.group)||new Map,R=A.get(h);if(R&&R!==p)throw new Error(`Duplicate WGSL binding reservation for modules "${R}" and "${p}": group ${d.group}, binding ${h}.`);np(i,d.group,h,`registered module binding "${p}"`),A.set(h,p),n.set(d.group,A)}}return n}function q3(t,e,i,n){const o=t.get(e);if(!o)return!1;const d=o.get(i);if(!d)return!1;if(d!==n)throw new Error(`Registered module binding "${n}" collided with "${d}": group ${e}, binding ${i}.`);return!0}function Z3(t){const e=[],i=t.source||"";for(const n of wp(i,ug))e.push({name:n.name,group:Number(n.groupToken)});return e}function nx(t,e,i){if(t===0&&e>=hg)throw new Error(`Application binding "${i}" in group 0 uses reserved binding ${e}. Application-owned explicit group-0 bindings must stay below ${hg}.`)}function S1(t,e,i,n){if(e===0&&i<hg)throw new Error(`Module "${t}" binding "${n}" in group 0 uses reserved application binding ${i}. Module-owned explicit group-0 bindings must be ${hg} or higher.`)}function np(t,e,i,n){const o=t.get(e)||new Set;if(o.has(i))throw new Error(`Duplicate WGSL binding assignment for ${n}: group ${e}, binding ${i}.`);o.add(i),t.set(e,o)}function A1(t,e,i){const n=e.get(t)||new Set;
713let o=i??(t===0?hg:n.size>0?Math.max(...n)+1:0);for(;n.has(o);)o++;return o}function Y3(t,e){const i=e.get(t)||new Set;let n=0;for(;i.has(n);)n++;return n}function G3(t){const e=D3(t,ug);if(!e)return;const i=Q3(t,e.index);throw i?new Error(`Unresolved @binding(auto) for module "${i}" binding "${e.name}" remained in assembled WGSL source.`):J3(t,e.index)?new Error(`Unresolved @binding(auto) for application binding "${e.name}" remained in assembled WGSL source.`):new Error(`Unresolved @binding(auto) remained in assembled WGSL source near "${eM(e.match)}".`)}function K3(t){if(t.length===0)return"";let e=`// ----- MODULE WGSL BINDING ASSIGNMENTS --------------- 714`;for(const i of t)e+=`// ${i.moduleName}.${i.name} -> @group(${i.group}) @binding(${i.location}) 715`;return e+=` 716`,e}function jS(t,e,i){return`${t}:${e}:${i}`}function Q3(t,e){const i=/^\/\/ ----- MODULE ([^\n]+) ---------------$/gm;let n,o;for(o=i.exec(t);o&&o.index<=e;)n=o[1],o=i.exec(t);return n}function J3(t,e){const i=t.indexOf(ix);return i>=0?e>i:!0}function eM(t){return t.replace(/\s+/g," ").trim()}const rx="([a-zA-Z_][a-zA-Z0-9_]*)",tM=new RegExp(`^\\s*\\#\\s*ifdef\\s*${rx}\\s*$`),iM=new RegExp(`^\\s*\\#\\s*ifndef\\s*${rx}\\s*(?:\\/\\/.*)?$`),nM=/^\s*\#\s*else\s*(?:\/\/.*)?$/,rM=/^\s*\#\s*endif\s*$/,sM=new RegExp(`^\\s*\\#\\s*ifdef\\s*${rx}\\s*(?:\\/\\/.*)?$`),aM=/^\s*\#\s*endif\s*(?:\/\/.*)?$/;function oM(t,e){var p,h;const i=t.split(` 717`),n=[],o=[];let d=!0;for(const A of i){const R=A.match(sM)||A.match(tM),B=A.match(iM),N=A.match(nM),F=A.match(aM)||A.match(rM);if(R||B){const Q=(p=R||B)==null?void 0:p[1],re=!!((h=e==null?void 0:e.defines)!=null&&h[Q]),se=R?re:!re,ae=d&&se;o.push({parentActive:d,branchTaken:se,active:ae}),d=ae}else if(N){const Q=o[o.length-1];if(!Q)throw new Error("Encountered #else without matching #ifdef or #ifndef");Q.active=Q.parentActive&&!Q.branchTaken,Q.branchTaken=!0,d=Q.active}else F?(o.pop(),d=o.length?o[o.length-1].active:!0):d&&n.push(A)}if(o.length>0)throw new Error("Unterminated conditional block in shader source");return n.join(` 718`)}const xd=class xd{constructor(){Y(this,"_hookFunctions",[]);Y(this,"_defaultModules",[]);Y(this,"_wgslBindingRegistry",new Map)}static getDefaultShaderAssembler(){return xd.defaultShaderAssembler=xd.defaultShaderAssembler||new xd,xd.defaultShaderAssembler}addDefaultModule(e){this._defaultModules.find(i=>i.name===(typeof e=="string"?e:e.name))||this._defaultModules.push(e)}removeDefaultModule(e){const i=typeof e=="string"?e:e.name;this._defaultModules=this._defaultModules.filter(n=>n.name!==i)}addShaderHook(e,i){i&&(e=Object.assign(i,{hook:e})),this._hookFunctions.push(e)}assembleWGSLShader(e){const i=this._getModuleList(e.modules),n=this._hookFunctions,{source:o,getUniforms:d,bindingAssignments:p}=z3({...e,source:e.source,_bindingRegistry:this._wgslBindingRegistry,modules:i,hookFunctions:n}),h={...i.reduce((R,B)=>(Object.assign(R,B.defines),R),{}),...e.defines},A=e.platformInfo.shaderLanguage==="wgsl"?oM(o,{defines:h}):o;return{source:A,getUniforms:d,modules:i,bindingAssignments:p,bindingTable:LS(A,p)}}assembleGLSLShaderPair(e){const i=this._getModuleList(e.modules),n=this._hookFunctions;return{...L3({...e,vs:e.vs,fs:e.fs,modules:i,hookFunctions:n}),modules:i}}_getModuleList(e=[]){const i=new Array(this._defaultModules.length+e.length),n={};let o=0;for(let d=0,p=this._defaultModules.length;d<p;++d){const h=this._defaultModules[d],A=h.name;i[o++]=h,n[A]=!0}for(let d=0,p=e.length;d<p;++d){const h=e[d],A=h.name;n[A]||(i[o++]=h,n[A]=!0)}return i.length=o,_y(i),i}};Y(xd,"defaultShaderAssembler");let yy=xd;const lM=`out vec4 transform_output; 719void main() { 720 transform_output = vec4(0); 721}`,cM=`#version 300 es 722${lM}`;function uM(t){const{input:e,inputChannels:i,output:n}={};if(!e)return cM;if(!i)throw new Error("inputChannels");const o=hM(i),d=dM(e,i);return`#version 300 es 723in ${o} ${e}; 724out vec4 ${n}; 725void main() { 726 ${n} = ${d}; 727}`}function hM(t){switch(t){case 1:return"float";case 2:return"vec2";case 3:return"vec3";case 4:return"vec4";default:throw new Error(`invalid channels: ${t}`)}}function dM(t,e){switch(e){case 1:return`vec4(${t}, 0.0, 0.0, 1.0)`;case 2:return`vec4(${t}, 0.0, 1.0)`;case 3:return`vec4(${t}
727, 1.0)`;case 4:return t;default:throw new Error(`invalid channels: ${e}`)}}const fM={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...fM}};const _o=globalThis.mathgl.config;function pM(t,{precision:e=_o.precision}={}){return t=mM(t),`${parseFloat(t.toPrecision(e))}`}function rp(t){return Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView)}function rl(t,e,i){return _M(t,n=>Math.max(e,Math.min(i,n)))}function vy(t,e,i){return rp(t)?t.map((n,o)=>vy(n,e[o],i)):i*e+(1-i)*t}function dg(t,e,i){const n=_o.EPSILON;try{if(t===e)return!0;if(rp(t)&&rp(e)){if(t.length!==e.length)return!1;for(let o=0;o<t.length;++o)if(!dg(t[o],e[o]))return!1;return!0}return t&&t.equals?t.equals(e):e&&e.equals?e.equals(t):typeof t=="number"&&typeof e=="number"?Math.abs(t-e)<=_o.EPSILON*Math.max(1,Math.abs(t),Math.abs(e)):!1}finally{_o.EPSILON=n}}function mM(t){return Math.round(t/_o.EPSILON)*_o.EPSILON}function gM(t){return t.clone?t.clone():new Array(t.length)}function _M(t,e,i){if(rp(t)){const n=t;i=i||gM(n);for(let o=0;o<i.length&&o<n.length;++o){const d=typeof t=="number"?t:t[o];i[o]=e(d,o,i)}return i}return e(t)}class VS extends Array{clone(){return new this.constructor().copy(this)}fromArray(e,i=0){for(let n=0;n<this.ELEMENTS;++n)this[n]=e[n+i];return this.check()}toArray(e=[],i=0){for(let n=0;n<this.ELEMENTS;++n)e[i+n]=this[n];return e}toObject(e){return e}from(e){return Array.isArray(e)?this.copy(e):this.fromObject(e)}to(e){return e===this?this:rp(e)?this.toArray(e):this.toObject(e)}toTarget(e){return e?this.to(e):this}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(_o)}formatString(e){let i="";for(let n=0;n<this.ELEMENTS;++n)i+=(n>0?", ":"")+pM(this[n],e);return`${e.printTypes?this.constructor.name:""}[${i}]`}equals(e){if(!e||this.length!==e.length)return!1;for(let i=0;i<this.ELEMENTS;++i)if(!dg(this[i],e[i]))return!1;return!0}exactEquals(e){if(!e||this.length!==e.length)return!1;for(let i=0;i<this.ELEMENTS;++i)if(this[i]!==e[i])return!1;return!0}negate(){for(let e=0;e<this.ELEMENTS;++e)this[e]=-this[e];return this.check()}lerp(e,i,n){if(n===void 0)return this.lerp(this,e,i);for(let o=0;o<this.ELEMENTS;++o){const d=e[o],p=typeof i=="number"?i:i[o];this[o]=d+n*(p-d)}return this.check()}min(e){for(let i=0;i<this.ELEMENTS;++i)this[i]=Math.min(e[i],this[i]);return this.check()}max(e){for(let i=0;i<this.ELEMENTS;++i)this[i]=Math.max(e[i],this[i]);return this.check()}clamp(e,i){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],e[n]),i[n]);return this.check()}add(...e){for(const i of e)for(let n=0;n<this.ELEMENTS;++n)this[n]+=i[n];return this.check()}subtract(...e){for(const i of e)for(let n=0;n<this.ELEMENTS;++n)this[n]-=i[n];return this.check()}scale(e){if(typeof e=="number")for(let i=0;i<this.ELEMENTS;++i)this[i]*=e;else for(let i=0;i<this.ELEMENTS&&i<e.length;++i)this[i]*=e[i];return this.check()}multiplyByScalar(e){for(let i=0;i<this.ELEMENTS;++i)this[i]*=e;return this.check()}check(){if(_o.debug&&!this.validate())throw new Error(`math.gl: ${this.constructor.name} some fields set to invalid numbers'`);return this}validate(){let e=this.length===this.ELEMENTS;for(let i=0;i<this.ELEMENTS;++i)e=e&&Number.isFinite(this[i]);return e}sub(e){return this.subtract(e)}setScalar(e){for(let i=0;i<this.ELEMENTS;++i)this[i]=e;return this.check()}addScalar(e){for(let i=0;i<this.ELEMENTS;++i)this[i]+=e;return this.check()}subScalar(e){return this.addScalar(-e)}multiplyScalar(e){for(let i=0;i<this.ELEMENTS;++i)this[i]*=e;return this.check()}divideScalar(e){return this.multiplyByScalar(1/e)}clampScalar(e,i){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],e),i);return this.check()}get elements(){return this}}function yM(t,e){if(t.length!==e)return!1;for(let i=0;i<t.length;++i)if(!Number.isFinite(t[i]))return!1;return!0}function Ha(t){if(!Number.isFinite(t))throw new Error(`Invalid number ${JSON.stringify(t)}`);return t}function qv(t,e,i=""){if(_o.debug&&!yM(t,e))throw new Error(`math.gl: ${i}
727 some fields set to invalid numbers'`);return t}function E1(t,e){if(!t)throw new Error(`math.gl assertion ${e}`)}class vM extends VS{get x(){return this[0]}set x(e){this[0]=Ha(e)}get y(){return this[1]}set y(e){this[1]=Ha(e)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let e=0;for(let i=0;i<this.ELEMENTS;++i)e+=this[i]*this[i];return e}magnitudeSquared(){return this.lengthSquared()}distance(e){return Math.sqrt(this.distanceSquared(e))}distanceSquared(e){let i=0;for(let n=0;n<this.ELEMENTS;++n){const o=this[n]-e[n];i+=o*o}return Ha(i)}dot(e){let i=0;for(let n=0;n<this.ELEMENTS;++n)i+=this[n]*e[n];return Ha(i)}normalize(){const e=this.magnitude();if(e!==0)for(let i=0;i<this.ELEMENTS;++i)this[i]/=e;return this.check()}multiply(...e){for(const i of e)for(let n=0;n<this.ELEMENTS;++n)this[n]*=i[n];return this.check()}divide(...e){for(const i of e)for(let n=0;n<this.ELEMENTS;++n)this[n]/=i[n];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(e){return this.distance(e)}distanceToSquared(e){return this.distanceSquared(e)}getComponent(e){return E1(e>=0&&e<this.ELEMENTS,"index is out of range"),Ha(this[e])}setComponent(e,i){return E1(e>=0&&e<this.ELEMENTS,"index is out of range"),this[e]=i,this.check()}addVectors(e,i){return this.copy(e).add(i)}subVectors(e,i){return this.copy(e).subtract(i)}multiplyVectors(e,i){return this.copy(e).multiply(i)}addScaledVector(e,i){return this.add(new this.constructor(e).multiplyScalar(i))}}const ry=1e-6;let sp=typeof Float32Array<"u"?Float32Array:Array;function bM(){const t=new sp(2);return sp!=Float32Array&&(t[0]=0,t[1]=0),t}function C1(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t}function xM(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t}function wM(t,e){return t[0]=-e[0],t[1]=-e[1],t}function $S(t,e,i,n){const o=e[0],d=e[1];return t[0]=o+n*(i[0]-o),t[1]=d+n*(i[1]-d),t}function TM(t,e,i){const n=e[0],o=e[1];return t[0]=i[0]*n+i[4]*o+i[12],t[1]=i[1]*n+i[5]*o+i[13],t}const SM=xM;(function(){const t=bM();return function(e,i,n,o,d,p){let h,A;for(i||(i=2),n||(n=0),o?A=Math.min(o*i+n,e.length):A=e.length,h=n;h<A;h+=i)t[0]=e[h],t[1]=e[h+1],d(t,t,p),e[h]=t[0],e[h+1]=t[1];return e}})();function AM(t,e,i){const n=e[0],o=e[1],d=i[3]*n+i[7]*o||1;return t[0]=(i[0]*n+i[4]*o)/d,t[1]=(i[1]*n+i[5]*o)/d,t}function HS(t,e,i){const n=e[0],o=e[1],d=e[2],p=i[3]*n+i[7]*o+i[11]*d||1;return t[0]=(i[0]*n+i[4]*o+i[8]*d)/p,t[1]=(i[1]*n+i[5]*o+i[9]*d)/p,t[2]=(i[2]*n+i[6]*o+i[10]*d)/p,t}function EM(t,e,i){const n=e[0],o=e[1];return t[0]=i[0]*n+i[2]*o,t[1]=i[1]*n+i[3]*o,t[2]=e[2],t}function CM(){const t=new sp(3);return sp!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function RM(t){const e=t[0],i=t[1],n=t[2];return Math.sqrt(e*e+i*i+n*n)}function MM(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t}function PM(t){const e=t[0],i=t[1],n=t[2];return e*e+i*i+n*n}function IM(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t}function DM(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function OM(t,e,i){const n=e[0],o=e[1],d=e[2],p=i[0],h=i[1],A=i[2];return t[0]=o*A-d*h,t[1]=d*p-n*A,t[2]=n*h-o*p,t}function kM(t,e,i,n){const o=e[0],d=e[1],p=e[2];return t[0]=o+n*(i[0]-o),t[1]=d+n*(i[1]-d),t[2]=p+n*(i[2]-p),t}function WS(t,e,i){const n=e[0],o=e[1],d=e[2];let p=i[3]*n+i[7]*o+i[11]*d+i[15];return p=p||1,t[0]=(i[0]*n+i[4]*o+i[8]*d+i[12])/p,t[1]=(i[1]*n+i[5]*o+i[9]*d+i[13])/p,t[2]=(i[2]*n+i[6]*o+i[10]*d+i[14])/p,t}function BM(t,e,i){const n=e[0],o=e[1],d=e[2];return t[0]=n*i[0]+o*i[3]+d*i[6],t[1]=n*i[1]+o*i[4]+d*i[7],t[2]=n*i[2]+o*i[5]+d*i[8],t}function NM(t,e,i){const n=i[0],o=i[1],d=i[2],p=i[3],h=e[0],A=e[1],R=e[2];let B=o*R-d*A,N=d*h-n*R,F=n*A-o*h,Q=o*F-d*N,re=d*B-n*F,se=n*N-o*B;const ae=p*2;return B*=ae,N*=ae,F*=ae,Q*=2,re*=2,se*=2,t[0]=h+B+Q,t[1]=A+N+re,t[2]=R+F+se,t}function zM(t,e,i,n){const o=[],d=[];return o[0]=e[0]-i[0],o[1]=e[1]-i[1],o[2]=e[2]-i[2],d[0]=o[0],d[1]=o[1]*Math.cos(n)-o[2]*Math.sin(n),d[2]=o[1]*Math.sin(n)+o[2]*Math.cos(n),t[0]=d[0]+i[0],t[1]=d[1]+i[1],t[2]=d[2]+i[2],t}function LM(t,e,i,n){const o=[],d=[];return o[0]=e[0]-i[0],o[1]=e[1]-i[1],o[2]=e[2]-i[2],d[0]=o[2]*Math.sin(n)+o[0]*Math.cos(n),d[1]=o[1],d[2]=o[2]*Math.cos(n)-o[0]*Math.sin(n),t[0]=d[0]+i[0],t[1]=d[1]+i[1],t[2]=d[2]+i[2],t}function FM(t,e,i,n){const o=[],d=[];return o[0]=e[0]-i[0],o[1]=e[1]-i[1],o[2]=e[2]-i[2],d[0]=o[0]*Math.cos(n)-o[1]*Math.sin(n),d[1]=o[0]*Math.sin(n)+o[1]*Math.cos(n),d[2]=o[2],t[0]=d[0]+i[0],t[1]=d[1]+i[1],t[2]=d[2]+i[2],t}function UM(t,e){const i=t[0],n=t[1],o=t[2],d=e[0],p=e[1],h=e[2],A=Math.sqrt((i*i+n*n+o*o)*(d*d+p*p+h*h)),R=A&&DM(t,e)/A;return Math.acos(Math.min(Math.max(R,-1),1))}const XS=MM,jM=RM,Zv=PM;(function(){const t=CM();return function(e,i,n,o,d,p){let h,A;
vendor: 15,647 bytes, lines 727-746
727for(i||(i=3),n||(n=0),o?A=Math.min(o*i+n,e.length):A=e.length,h=n;h<A;h+=i)t[0]=e[h],t[1]=e[h+1],t[2]=e[h+2],d(t,t,p),e[h]=t[0],e[h+1]=t[1],e[h+2]=t[2];return e}})();const Yv=[0,0,0];let D_;class nc extends vM{static get ZERO(){return D_||(D_=new nc(0,0,0),Object.freeze(D_)),D_}constructor(e=0,i=0,n=0){super(-0,-0,-0),arguments.length===1&&rp(e)?this.copy(e):(_o.debug&&(Ha(e),Ha(i),Ha(n)),this[0]=e,this[1]=i,this[2]=n)}set(e,i,n){return this[0]=e,this[1]=i,this[2]=n,this.check()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this.check()}fromObject(e){return _o.debug&&(Ha(e.x),Ha(e.y),Ha(e.z)),this[0]=e.x,this[1]=e.y,this[2]=e.z,this.check()}toObject(e){return e.x=this[0],e.y=this[1],e.z=this[2],e}get ELEMENTS(){return 3}get z(){return this[2]}set z(e){this[2]=Ha(e)}angle(e){return UM(this,e)}cross(e){return OM(this,this,e),this.check()}rotateX({radians:e,origin:i=Yv}){return zM(this,this,i,e),this.check()}rotateY({radians:e,origin:i=Yv}){return LM(this,this,i,e),this.check()}rotateZ({radians:e,origin:i=Yv}){return FM(this,this,i,e),this.check()}transform(e){return this.transformAsPoint(e)}transformAsPoint(e){return WS(this,this,e),this.check()}transformAsVector(e){return HS(this,this,e),this.check()}transformByMatrix3(e){return BM(this,this,e),this.check()}transformByMatrix2(e){return EM(this,this,e),this.check()}transformByQuaternion(e){return NM(this,this,e),this.check()}}class VM extends VS{toString(){let e="[";if(_o.printRowMajor){e+="row-major:";for(let i=0;i<this.RANK;++i)for(let n=0;n<this.RANK;++n)e+=` ${this[n*this.RANK+i]}`}else{e+="column-major:";for(let i=0;i<this.ELEMENTS;++i)e+=` ${this[i]}`}return e+="]",e}getElementIndex(e,i){return i*this.RANK+e}getElement(e,i){return this[i*this.RANK+e]}setElement(e,i,n){return this[i*this.RANK+e]=Ha(n),this}getColumn(e,i=new Array(this.RANK).fill(-0)){const n=e*this.RANK;for(let o=0;o<this.RANK;++o)i[o]=this[n+o];return i}setColumn(e,i){const n=e*this.RANK;for(let o=0;o<this.RANK;++o)this[n+o]=i[o];return this}}function $M(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function HM(t,e){if(t===e){const i=e[1],n=e[2],o=e[3],d=e[6],p=e[7],h=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=i,t[6]=e[9],t[7]=e[13],t[8]=n,t[9]=d,t[11]=e[14],t[12]=o,t[13]=p,t[14]=h}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t}function Yb(t,e){const i=e[0],n=e[1],o=e[2],d=e[3],p=e[4],h=e[5],A=e[6],R=e[7],B=e[8],N=e[9],F=e[10],Q=e[11],re=e[12],se=e[13],ae=e[14],me=e[15],we=i*h-n*p,ve=i*A-o*p,Oe=i*R-d*p,Te=n*A-o*h,Re=n*R-d*h,Ee=o*R-d*A,Je=B*se-N*re,rt=B*ae-F*re,Ke=B*me-Q*re,Qe=N*ae-F*se,ht=N*me-Q*se,At=F*me-Q*ae;let Fe=we*At-ve*ht+Oe*Qe+Te*Ke-Re*rt+Ee*Je;return Fe?(Fe=1/Fe,t[0]=(h*At-A*ht+R*Qe)*Fe,t[1]=(o*ht-n*At-d*Qe)*Fe,t[2]=(se*Ee-ae*Re+me*Te)*Fe,t[3]=(F*Re-N*Ee-Q*Te)*Fe,t[4]=(A*Ke-p*At-R*rt)*Fe,t[5]=(i*At-o*Ke+d*rt)*Fe,t[6]=(ae*Oe-re*Ee-me*ve)*Fe,t[7]=(B*Ee-F*Oe+Q*ve)*Fe,t[8]=(p*ht-h*Ke+R*Je)*Fe,t[9]=(n*Ke-i*ht-d*Je)*Fe,t[10]=(re*Re-se*Oe+me*we)*Fe,t[11]=(N*Oe-B*Re-Q*we)*Fe,t[12]=(h*rt-p*Qe-A*Je)*Fe,t[13]=(i*Qe-n*rt+o*Je)*Fe,t[14]=(se*ve-re*Te-ae*we)*Fe,t[15]=(B*Te-N*ve+F*we)*Fe,t):null}function WM(t){const e=t[0],i=t[1],n=t[2],o=t[3],d=t[4],p=t[5],h=t[6],A=t[7],R=t[8],B=t[9],N=t[10],F=t[11],Q=t[12],re=t[13],se=t[14],ae=t[15],me=e*p-i*d,we=e*h-n*d,ve=i*h-n*p,Oe=R*re-B*Q,Te=R*se-N*Q,Re=B*se-N*re,Ee=e*Re-i*Te+n*Oe,Je=d*Re-p*Te+h*Oe,rt=R*ve-B*we+N*me,Ke=Q*ve-re*we+se*me;return A*Ee-o*Je+ae*rt-F*Ke}function Ad(t,e,i){const n=e[0],o=e[1],d=e[2],p=e[3],h=e[4],A=e[5],R=e[6],B=e[7],N=e[8],F=e[9],Q=e[10],re=e[11],se=e[12],ae=e[13],me=e[14],we=e[15];let ve=i[0],Oe=i[1],Te=i[2],Re=i[3];return t[0]=ve*n+Oe*h+Te*N+Re*se,t[1]=ve*o+Oe*A+Te*F+Re*ae,t[2]=ve*d+Oe*R+Te*Q+Re*me,t[3]=ve*p+Oe*B+Te*re+Re*we,ve=i[4],Oe=i[5],Te=i[6],Re=i[7],t[4]=ve*n+Oe*h+Te*N+Re*se,t[5]=ve*o+Oe*A+Te*F+Re*ae,t[6]=ve*d+Oe*R+Te*Q+Re*me,t[7]=ve*p+Oe*B+Te*re+Re*we,ve=i[8],Oe=i[9],Te=i[10],Re=i[11],t[8]=ve*n+Oe*h+Te*N+Re*se,t[9]=ve*o+Oe*A+Te*F+Re*ae,t[10]=ve*d+Oe*R+Te*Q+Re*me,t[11]=ve*p+Oe*B+Te*re+Re*we,ve=i[12],Oe=i[13],Te=i[14],Re=i[15],t[12]=ve*n+Oe*h+Te*N+Re*se,t[13]=ve*o+Oe*A+Te*F+Re*ae,t[14]=ve*d+Oe*R+Te*Q+Re*me,t[15]=ve*p+Oe*B+Te*re+Re*we,t}function by(t,e,i){const n=i[0],o=i[1],d=i[2];let p,h,A,R,B,N,F,Q,re,se,ae,me;return e===t?(t[12]=e[0]*n+e[4]*o+e[8]*d+e[12],t[13]=e[1]*n+e[5]*o+e[9]*d+e[13],t[14]=e[2]*n+e[6]*o+e[10]*d+e[14],t[15]=e[3]*n+e[7]*o+e[11]*d+e[15]):(p=e[0],h=e[1],A=e[2],R=e[3],B=e[4],N=e[5],F=e[6],Q=e[7],re=e[8],se=e[9],ae=e[10],me=e[11],t[0]=p,t[1]=h,t[2]=A,t[3]=R,t[4]=B,t[5]=N,t[6]=F,t[7]=Q,t[8]=re,t[9]=se,t[10]=ae,t[11]=me,t[12]=p*n+B*o+re*d+e[12],t[13]=h*n+N*o+se*d+e[13],t[14]=A*n+F*o+ae*d+e[14],t[15]=R*n+Q*o+me*d+e[15]),t}function sx(t,e,i){const n=i[0],o=i[1],d=i[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*o,t[5]=e[5]*o,t[6]=e[6]*o,t[7]=e[7]*o,t[8]=e[8]*d,t[9]=e[9]*d,t[10]=e[10]*d,t[11]=e[11]*d,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function XM(t,e,i,n){let o=n[0],d=n[1],p=n[2],h=Math.sqrt(o*o+d*d+p*p),A,R,B,N,F,Q,re,se,ae,me,we,ve,Oe,Te,Re,Ee,Je,rt,Ke,Qe,ht,At,Fe,Dt;return h<ry?null:(h=1/h,o*=h,d*=h,p*=h,R=Math.sin(i),A=Math.cos(i),B=1-A,N=e[0],F=e[1],Q=e[2],re=e[3],se=e[4],ae=e[5],me=e[6],we=e[7],ve=e[8],Oe=e[9],Te=e[10],Re=e[11],Ee=o*o*B+A,Je=d*o*B+p*R,rt=p*o*B-d*R,Ke=o*d*B-p*R,Qe=d*d*B+A,ht=p*d*B+o*R,At=o*p*B+d*R,Fe=d*p*B-o*R,Dt=p*p*B+A,t[0]=N*Ee+se*Je+ve*rt,t[1]=F*Ee+ae*Je+Oe*rt,t[2]=Q*Ee+me*Je+Te*rt,t[3]=re*Ee+we*Je+Re*rt,t[4]=N*Ke+se*Qe+ve*ht,t[5]=F*Ke+ae*Qe+Oe*ht,t[6]=Q*Ke+me*Qe+Te*ht,t[7]=re*Ke+we*Qe+Re*ht,t[8]=N*At+se*Fe+ve*Dt,t[9]=F*At+ae*Fe+Oe*Dt,t[10]=Q*At+me*Fe+Te*Dt,t[11]=re*At+we*Fe+Re*Dt,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)}function qS(t,e,i){const n=Math.sin(i),o=Math.cos(i),d=e[4],p=e[5],h=e[6],A=e[7],R=e[8],B=e[9],N=e[10],F=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=d*o+R*n,t[5]=p*o+B*n,t[6]=h*o+N*n,t[7]=A*o+F*n,t[8]=R*o-d*n,t[9]=B*o-p*n,t[10]=N*o-h*n,t[11]=F*o-A*n,t}function qM(t,e,i){const n=Math.sin(i),o=Math.cos(i),d=e[0],p=e[1],h=e[2],A=e[3],R=e[8],B=e[9],N=e[10],F=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=d*o-R*n,t[1]=p*o-B*n,t[2]=h*o-N*n,t[3]=A*o-F*n,t[8]=d*n+R*o,t[9]=p*n+B*o,t[10]=h*n+N*o,t[11]=A*n+F*o,t}function ZS(t,e,i){const n=Math.sin(i),o=Math.cos(i),d=e[0],p=e[1],h=e[2],A=e[3],R=e[4],B=e[5],N=e[6],F=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=d*o+R*n,t[1]=p*o+B*n,t[2]=h*o+N*n,t[3]=A*o+F*n,t[4]=R*o-d*n,t[5]=B*o-p*n,t[6]=N*o-h*n,t[7]=F*o-A*n,t}function ZM(t,e){const i=e[0],n=e[1],o=e[2],d=e[3],p=i+i,h=n+n,A=o+o,R=i*p,B=n*p,N=n*h,F=o*p,Q=o*h,re=o*A,se=d*p,ae=d*h,me=d*A;return t[0]=1-N-re,t[1]=B+me,t[2]=F-ae,t[3]=0,t[4]=B-me,t[5]=1-R-re,t[6]=Q+se,t[7]=0,t[8]=F+ae,t[9]=Q-se,t[10]=1-R-N,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function YM(t,e,i,n,o,d,p){const h=1/(i-e),A=1/(o-n),R=1/(d-p);return t[0]=d*2*h,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=d*2*A,t[6]=0,t[7]=0,t[8]=(i+e)*h,t[9]=(o+n)*A,t[10]=(p+d)*R,t[11]=-1,t[12]=0,t[13]=0,t[14]=p*d*2*R,t[15]=0,t}function GM(t,e,i,n,o){const d=1/Math.tan(e/2);if(t[0]=d/i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=d,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,o!=null&&o!==1/0){const p=1/(n-o);t[10]=(o+n)*p,t[14]=2*o*n*p}else t[10]=-1,t[14]=-2*n;return t}const KM=GM;function QM(t,e,i,n,o,d,p){const h=1/(e-i),A=1/(n-o),R=1/(d-p);return t[0]=-2*h,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*A,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*R,t[11]=0,t[12]=(e+i)*h,t[13]=(o+n)*A,t[14]=(p+d)*R,t[15]=1,t}const JM=QM;function eP(t,e,i,n){let o,d,p,h,A,R,B,N,F,Q;const re=e[0],se=e[1],ae=e[2],me=n[0],we=n[1],ve=n[2],Oe=i[0],Te=i[1],Re=i[2];return Math.abs(re-Oe)<ry&&Math.abs(se-Te)<ry&&Math.abs(ae-Re)<ry?$M(t):(N=re-Oe,F=se-Te,Q=ae-Re,o=1/Math.sqrt(N*N+F*F+Q*Q),N*=o,F*=o,Q*=o,d=we*Q-ve*F,p=ve*N-me*Q,h=me*F-we*N,o=Math.sqrt(d*d+p*p+h*h),o?(o=1/o,d*=o,p*=o,h*=o):(d=0,p=0,h=0),A=F*h-Q*p,R=Q*d-N*h,B=N*p-F*d,o=Math.sqrt(A*A+R*R+B*B),o?(o=1/o,A*=o,R*=o,B*=o):(A=0,R=0,B=0),t[0]=d,t[1]=A,t[2]=N,t[3]=0,t[4]=p,t[5]=R,t[6]=F,t[7]=0,t[8]=h,t[9]=B,t[10]=Q,t[11]=0,t[12]=-(d*re+p*se+h*ae),t[13]=-(A*re+R*se+B*ae),t[14]=-(N*re+F*se+Q*ae),t[15]=1,t)}function tP(){const t=new sp(4);return sp!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function YS(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t}function Tp(t,e,i){const n=e[0],o=e[1],d=e[2],p=e[3];return t[0]=i[0]*n+i[4]*o+i[8]*d+i[12]*p,t[1]=i[1]*n+i[5]*o+i[9]*d+i[13]*p,t[2]=i[2]*n+i[6]*o+i[10]*d+i[14]*p,t[3]=i[3]*n+i[7]*o+i[11]*d+i[15]*p,t}(function(){const t=tP();return function(e,i,n,o,d,p){let h,A;for(i||(i=4),n||(n=0),o?A=Math.min(o*i+n,e.length):A=e.length,h=n;h<A;h+=i)t[0]=e[h],t[1]=e[h+1],t[2]=e[h+2],t[3]=e[h+3],d(t,t,p),e[h]=t[0],e[h+1]=t[1],e[h+2]=t[2],e[h+3]=t[3];return e}})();var Gb;(function(t){t[t.COL0ROW0=0]="COL0ROW0",t[t.COL0ROW1=1]="COL0ROW1",t[t.COL0ROW2=2]="COL0ROW2",t[t.COL0ROW3=3]="COL0ROW3",t[t.COL1ROW0=4]="COL1ROW0",t[t.COL1ROW1=5]="COL1ROW1",t[t.COL1ROW2=6]="COL1ROW2",t[t.COL1ROW3=7]="COL1ROW3",t[t.COL2ROW0=8]="COL2ROW0",t[t.COL2ROW1=9]="COL2ROW1",t[t.COL2ROW2=10]="COL2ROW2",t[t.COL2ROW3=11]="COL2ROW3",t[t.COL3ROW0=12]="COL3ROW0",t[t.COL3ROW1=13]="COL3ROW1",t[t.COL3ROW2=14]="COL3ROW2",t[t.COL3ROW3=15]="COL3ROW3"})(Gb||(Gb={}));const iP=45*Math.PI/180,nP=1,Gv=.1,Kv=500,rP=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);class ll extends VM{static get IDENTITY(){return aP()}static get ZERO(){return sP()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return Gb}constructor(e){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(e)?this.copy(e):this.identity()}copy(e){return this[0]=e[0],this[1]=e[1],this[2]=e[2],this[3]=e[3],this[4]=e[4],this[5]=e[5],this[6]=e[6],this[7]=e[7],this[8]=e[8],this[9]=e[9],this[10]=e[10],this[11]=e[11],this[12]=e[12],this[13]=e[13],this[14]=e[14],this[15]=e[15],this.check()}set(e,i,n,o,d,p,h,A,R,B,N,F,Q,re,se,ae){return this[0]=e,this[1]=i,this[2]=n,this[3]=o,this[4]=d,this[5]=p,this[6]=h,this[7]=A,this[8]=R,this[9]=B,this[10]=N,this[11]=F,this[12]=Q,this[13]=re,this[14]=se,this[15]=ae,this.check()}setRowMajor(e,i,n,o,d,p,h,A,R,B,N,F,Q,re,se,ae){return this[0]=e,this[1]=d,this[2]=R,this[3]=Q,this[4]=i,this[5]=p,this[6]=B,this[7]=re,this[8]=n,this[9]=h,this[10]=N,this[11]=se,this[12]=o,this[13]=A,this[14]=F,this[15]=ae,this.check()}toRowMajor(e){return e[0]=this[0],e[1]=this[4],e[2]=this[8],e[3]=this[12],e[4]=this[1],e[5]=this[5],e[6]=this[9],e[7]=this[13],e[8]=this[2],e[9]=this[6],e[10]=this[10],e[11]=this[14],e[12]=this[3],e[13]=this[7],e[14]=this[11],e[15]=this[15],e}identity(){return this.copy(rP)}fromObject(e){return this.check()}fromQuaternion(e){return ZM(this,e),this.check()}frustum(e){const{left:i,right:n,bottom:o,top:d,near:p=Gv,far:h=Kv}=e;return h===1/0?oP(this,i,n,o,d,p):YM(this,i,n,o,d,p,h),this.check()}lookAt(e){const{eye:i,center:n=[0,0,0],up:o=[0,1,0]}=e;return eP(this,i,n,o),this.check()}ortho(e){const{left:i,right:n,bottom:o,top:d,near:p=Gv,far:h=Kv}=e;return JM(this,i,n,o,d,p,h),this.check()}orthographic(e){const{fovy:i=iP,aspect:n=nP,focalDistance:o=1,near:d=Gv,far:p=Kv}=e;R1(i);const h=i/2,A=o*Math.tan(h),R=A*n;return this.ortho({left:-R,right:R,bottom:-A,top:A,near:d,far:p})}perspective(e){const{fovy:i=45*Math.PI/180,aspect:n=1,near:o=.1,far:d=500}=e;return R1(i),KM(this,i,n,o,d),this.check()}determinant(){return WM(this)}getScale(e=[-0,-0,-0]){return e[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),e[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),e[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),e}getTranslation(e=[-0,-0,-0]){return e[0]=this[12],e[1]=this[13],e[2]=this[14],e}getRotation(e,i){e=e||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],i=i||[-0,-0,-0];const n=this.getScale(i),o=1/n[0],d=1/n[1],p=1/n[2];return e[0]=this[0]*o,e[1]=this[1]*d,e[2]=this[2]*p,e[3]=0,e[4]=this[4]*o,e[5]=this[5]*d,e[6]=this[6]*p,e[7]=0,e[8]=this[8]*o,e[9]=this[9]*d,e[10]=this[10]*p,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}getRotationMatrix3(e,i){e=e||[-0,-0,-0,-0,-0,-0,-0,-0,-0],i=i||[-0,-0,-0];const n=this.getScale(i),o=1/n[0],d=1/n[1],p=1/n[2];return e[0]=this[0]*o,e[1]=this[1]*d,e[2]=this[2]*p,e[3]=this[4]*o,e[4]=this[5]*d,e[5]=this[6]*p,e[6]=this[8]*o,e[7]=this[9]*d,e[8]=this[10]*p,e}transpose(){return HM(this,this),this.check()}invert(){return Yb(this,this),this.check()}multiplyLeft(e){return Ad(this,e,this),this.check()}multiplyRight(e){return Ad(this,this,e),this.check()}rotateX(e){return qS(this,this,e),this.check()}rotateY(e){return qM(this,this,e),this.check()}rotateZ(e){return ZS(this,this,e),this.check()}rotateXYZ(e){return this.rotateX(e[0]).rotateY(e[1]).rotateZ(e[2])}rotateAxis(e,i){return XM(this,this,e,i),this.check()}scale(e){return sx(this,this,Array.isArray(e)?e:[e,e,e]),this.check()}translate(e){return by(this,this,e),this.check()}transform(e,i){return e.length===4?(i=Tp(i||[-0,-0,-0,-0],e,this),qv(i,4),i):this.transformAsPoint(e,i)}transformAsPoint(e,i){const{length:n}=e;let o;switch(n){case 2:o=TM(i||[-0,-0],e,this);break;case 3:o=WS(i||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return qv(o,e.length),o}transformAsVector(e,i){let n;switch(e.length){case 2:n=AM(i||[-0,-0],e,this);break;case 3:n=HS(i||[-0,-0,-0],e,this);break;default:throw new Error("Illegal vector")}return qv(n,e.length),n}transformPoint(e,i){return this.transformAsPoint(e,i)}transformVector(e,i){return this.transformAsPoint(e,i)}transformDirection(e,i){return this.transformAsVector(e,i)}makeRotationX(e){return this.identity().rotateX(e)}makeTranslation(e,i,n){return this.identity().translate([e,i,n])}}let O_,k_;function sP(){return O_||(O_=new ll([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(O_)),O_}function aP(){return k_||(k_=new ll,Object.freeze(k_)),k_}function R1(t){if(t>Math.PI*2)throw Error("expected radians")}function oP(t,e,i,n,o,d){const p=2*d/(i-e),h=2*d/(o-n),A=(i+e)/(i-e),R=(o+n)/(o-n),B=-1,N=-1,F=-2*d;return t[0]=p,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=h,t[6]=0,t[7]=0,t[8]=A,t[9]=R,t[10]=B,t[11]=N,t[12]=0,t[13]=0,t[14]=F,t[15]=0,t}function GS(t,e=[],i=0){const n=Math.fround(t),o=t-n;return e[i]=n,e[i+1]=o,e}function lP(t){return t-Math.fround(t)}function cP(t){const e=new Float32Array(32);for(let i=0;i<4;++i)for(let n=0;n<4;++n){const o=i*4+n;GS(t[n*4+i],e,o*2)}return e}function uP(t,e=!0){return t??e}function hP(t=[0,0,0],e=!0){return e?t.map(i=>i/255):[...t]}function dP(t,e=!0){const i=hP(t.slice(0,3),e),n=Number.isFinite(t[3]),o=n?t[3]:1;return[i[0],i[1],i[2],e&&n?o/255:o]}const fP=`#ifdef LUMA_FP32_TAN_PRECISION_WORKAROUND 728 729// All these functions are for substituting tan() function from Intel GPU only 730const float TWO_PI = 6.2831854820251465; 731const float PI_2 = 1.5707963705062866; 732const float PI_16 = 0.1963495463132858; 733 734const float SIN_TABLE_0 = 0.19509032368659973; 735const float SIN_TABLE_1 = 0.3826834261417389; 736const float SIN_TABLE_2 = 0.5555702447891235; 737const float SIN_TABLE_3 = 0.7071067690849304; 738 739const float COS_TABLE_0 = 0.9807852506637573; 740const float COS_TABLE_1 = 0.9238795042037964; 741const float COS_TABLE_2 = 0.8314695954322815; 742const float COS_TABLE_3 = 0.7071067690849304; 743 744const float INVERSE_FACTORIAL_3 = 1.666666716337204e-01; // 1/3! 745const float INVERSE_FACTORIAL_5 = 8.333333767950535e-03; // 1/5! 746const float INVERSE_FACTORIAL_7 = 1.9841270113829523e-04; // 1/7!
747const float INVERSE_FACTORIAL_9 = 2.75573188446287533e-06; // 1/9! 748 749float sin_taylor_fp32(float a) { 750 float r, s, t, x; 751 752 if (a == 0.0) { 753 return 0.0; 754 } 755 756 x = -a * a; 757 s = a; 758 r = a; 759 760 r = r * x; 761 t = r * INVERSE_FACTORIAL_3; 762 s = s + t; 763 764 r = r * x; 765 t = r * INVERSE_FACTORIAL_5; 766 s = s + t; 767 768 r = r * x; 769 t = r * INVERSE_FACTORIAL_7; 770 s = s + t; 771 772 r = r * x; 773 t = r * INVERSE_FACTORIAL_9; 774 s = s + t; 775 776 return s; 777} 778 779void sincos_taylor_fp32(float a, out float sin_t, out float cos_t) { 780 if (a == 0.0) { 781 sin_t = 0.0; 782 cos_t = 1.0; 783 } 784 sin_t = sin_taylor_fp32(a); 785 cos_t = sqrt(1.0 - sin_t * sin_t); 786} 787 788float tan_taylor_fp32(float a) { 789 float sin_a; 790 float cos_a; 791 792 if (a == 0.0) { 793 return 0.0; 794 } 795 796 // 2pi range reduction 797 float z = floor(a / TWO_PI); 798 float r = a - TWO_PI * z; 799 800 float t; 801 float q = floor(r / PI_2 + 0.5); 802 int j = int(q); 803 804 if (j < -2 || j > 2) { 805 return 1.0 / 0.0; 806 } 807 808 t = r - PI_2 * q; 809 810 q = floor(t / PI_16 + 0.5); 811 int k = int(q); 812 int abs_k = int(abs(float(k))); 813 814 if (abs_k > 4) { 815 return 1.0 / 0.0; 816 } else { 817 t = t - PI_16 * q; 818 } 819 820 float u = 0.0; 821 float v = 0.0; 822 823 float sin_t, cos_t; 824 float s, c; 825 sincos_taylor_fp32(t, sin_t, cos_t); 826 827 if (k == 0) { 828 s = sin_t; 829 c = cos_t; 830 } else { 831 if (abs(float(abs_k) - 1.0) < 0.5) { 832 u = COS_TABLE_0; 833 v = SIN_TABLE_0; 834 } else if (abs(float(abs_k) - 2.0) < 0.5) { 835 u = COS_TABLE_1; 836 v = SIN_TABLE_1; 837 } else if (abs(float(abs_k) - 3.0) < 0.5) { 838 u = COS_TABLE_2; 839 v = SIN_TABLE_2; 840 } else if (abs(float(abs_k) - 4.0) < 0.5) { 841 u = COS_TABLE_3; 842 v = SIN_TABLE_3; 843 } 844 if (k > 0) { 845 s = u * sin_t + v * cos_t; 846 c = u * cos_t - v * sin_t; 847 } else { 848 s = u * sin_t - v * cos_t; 849 c = u * cos_t + v * sin_t; 850 } 851 } 852 853 if (j == 0) { 854 sin_a = s; 855 cos_a = c; 856 } else if (j == 1) { 857 sin_a = c; 858 cos_a = -s; 859 } else if (j == -1) { 860 sin_a = -c; 861 cos_a = s; 862 } else { 863 sin_a = -s; 864 cos_a = -c; 865 } 866 return sin_a / cos_a; 867} 868#endif 869 870float tan_fp32(float a) { 871#ifdef LUMA_FP32_TAN_PRECISION_WORKAROUND 872 return tan_taylor_fp32(a); 873#else 874 return tan(a); 875#endif 876} 877`,pP={name:"fp32",vs:fP},M1=` 878layout(std140) uniform fp64arithmeticUniforms { 879 uniform float ONE; 880 uniform float SPLIT; 881} fp64; 882 883/* 884About LUMA_FP64_CODE_ELIMINATION_WORKAROUND 885 886The purpose of this workaround is to prevent shader compilers from 887optimizing away necessary arithmetic operations by swapping their sequences 888or transform the equation to some 'equivalent' form. 889 890These helpers implement Dekker/Veltkamp-style error tracking. If the compiler 891folds constants or reassociates the arithmetic, the high/low split can stop 892tracking the rounding error correctly. That failure mode tends to look fine in 893simple coordinate setup, but then breaks down inside iterative arithmetic such 894as fp64 Mandelbrot loops. 895 896The method is to multiply an artifical variable, ONE, which will be known to 897the compiler to be 1 only at runtime. The whole expression is then represented 898as a polynomial with respective to ONE. In the coefficients of all terms, only one a 899and one b should appear 900 901err = (a + b) * ONE^6 - a * ONE^5 - (a + b) * ONE^4 + a * ONE^3 - b - (a + b) * ONE^2 + a * ONE 902*/ 903 904float prevent_fp64_optimization(float value) { 905#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND) 906 return value + fp64.ONE * 0.0; 907#else 908 return value; 909#endif 910} 911 912// Divide float number to high and low floats to extend fraction bits 913vec2 split(float a) { 914 // Keep SPLIT as a runtime uniform so the compiler cannot fold the Dekker 915 // split into a constant expression and reassociate the recovery steps. 916 float split = prevent_fp64_optimization(fp64.SPLIT); 917 float t = prevent_fp64_optimization(a * split); 918 float temp = t - a; 919 float a_hi = t - temp; 920 float a_lo = a - a_hi; 921 return vec2(a_hi, a_lo); 922} 923 924// Divide float number again when high float uses too many fraction bits 925vec2 split2(vec2 a) { 926 vec2 b = split(a.x); 927 b.y += a.y; 928 return b; 929} 930 931// Special sum operation when a > b 932vec2 quickTwoSum(float a, float b) { 933#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND) 934 float sum = (a + b) * fp64.ONE; 935 float err = b - (sum - a) * fp64.ONE; 936#else 937 float sum = a + b; 938 float err = b - (sum - a); 939#endif 940 return vec2(sum, err); 941} 942 943// General sum operation 944vec2 twoSum(float a, float b) { 945 float s = (a + b); 946#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND) 947 float v = (s * fp64.ONE - a) * fp64.ONE; 948 float err = (a - (s - v) * fp64.ONE) * fp64.ONE * fp64.ONE * fp64.ONE + (b - v); 949#else 950 float v = s - a; 951 float err = (a - (s - v)) + (b - v); 952#endif 953 return vec2(s, err); 954} 955 956vec2 twoSub(float a, float b) { 957 float s = (a - b); 958#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND) 959 float v = (s * fp64.ONE - a) * fp64.ONE; 960 float err = (a - (s - v) * fp64.ONE) * fp64.ONE * fp64.ONE * fp64.ONE - (b + v); 961#else 962 float v = s - a; 963 float err = (a - (s - v)) - (b + v); 964#endif 965 return vec2(s, err); 966} 967 968vec2 twoSqr(float a) { 969 float prod = a * a; 970 vec2 a_fp64 = split(a); 971#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND) 972 float err = ((a_fp64.x * a_fp64.x - prod) * fp64.ONE + 2.0 * a_fp64.x * 973 a_fp64.y * fp64.ONE * fp64.ONE) + a_fp64.y * a_fp64.y * fp64.ONE * fp64.ONE * fp64.ONE; 974#else 975 float err = ((a_fp64.x * a_fp64.x - prod) + 2.0 * a_fp64.x * a_fp64.y) + a_fp64.y * a_fp64.y; 976#endif 977 return vec2(prod, err); 978} 979 980vec2 twoProd(float a, float b) { 981 float prod = a * b; 982 vec2 a_fp64 = split(a); 983 vec2 b_fp64 = split(b); 984 // twoProd is especially sensitive because mul_fp64 and div_fp64 both depend 985 // on the split terms and cross terms staying in the original evaluation 986 // order. If the compiler folds or reassociates them, the low part tends to 987 // collapse to zero or NaN on some drivers. 988 float highProduct = prevent_fp64_optimization(a_fp64.x * b_fp64.x); 989 float crossProduct1 = prevent_fp64_optimization(a_fp64.x * b_fp64.y); 990 float crossProduct2 = prevent_fp64_optimization(a_fp64.y * b_fp64.x); 991 float lowProduct = prevent_fp64_optimization(a_fp64.y * b_fp64.y); 992#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND) 993 float err1 = (highProduct - prod) * fp64.ONE; 994 float err2 = crossProduct1 * fp64.ONE * fp64.ONE; 995 float err3 = crossProduct2 * fp64.ONE * fp64.ONE * fp64.ONE; 996 float err4 = lowProduct * fp64.ONE * fp64.ONE * fp64.ONE * fp64.ONE; 997#else 998 float err1 = highProduct - prod; 999 float err2 = crossProduct1; 1000 float err3 = crossProduct2; 1001 float err4 = lowProduct; 1002#endif 1003 float err = ((err1 + err2) + err3) + err4; 1004 return vec2(prod, err); 1005} 1006 1007vec2 sum_fp64(vec2 a, vec2 b) { 1008 vec2 s, t;
1009 s = twoSum(a.x, b.x); 1010 t = twoSum(a.y, b.y); 1011 s.y += t.x; 1012 s = quickTwoSum(s.x, s.y); 1013 s.y += t.y; 1014 s = quickTwoSum(s.x, s.y); 1015 return s; 1016} 1017 1018vec2 sub_fp64(vec2 a, vec2 b) { 1019 vec2 s, t; 1020 s = twoSub(a.x, b.x); 1021 t = twoSub(a.y, b.y); 1022 s.y += t.x; 1023 s = quickTwoSum(s.x, s.y); 1024 s.y += t.y; 1025 s = quickTwoSum(s.x, s.y); 1026 return s; 1027} 1028 1029vec2 mul_fp64(vec2 a, vec2 b) { 1030 vec2 prod = twoProd(a.x, b.x); 1031 // y component is for the error 1032 prod.y += a.x * b.y; 1033#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND) 1034 prod = split2(prod); 1035#endif 1036 prod = quickTwoSum(prod.x, prod.y); 1037 prod.y += a.y * b.x; 1038#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND) 1039 prod = split2(prod); 1040#endif 1041 prod = quickTwoSum(prod.x, prod.y); 1042 return prod; 1043} 1044 1045vec2 div_fp64(vec2 a, vec2 b) { 1046 float xn = 1.0 / b.x; 1047#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND) 1048 vec2 yn = mul_fp64(a, vec2(xn, 0)); 1049#else 1050 vec2 yn = a * xn; 1051#endif 1052 float diff = (sub_fp64(a, mul_fp64(b, yn))).x; 1053 vec2 prod = twoProd(xn, diff); 1054 return sum_fp64(yn, prod); 1055} 1056 1057vec2 sqrt_fp64(vec2 a) { 1058 if (a.x == 0.0 && a.y == 0.0) return vec2(0.0, 0.0); 1059 if (a.x < 0.0) return vec2(0.0 / 0.0, 0.0 / 0.0); 1060 1061 float x = 1.0 / sqrt(a.x); 1062 float yn = a.x * x; 1063#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND) 1064 vec2 yn_sqr = twoSqr(yn) * fp64.ONE; 1065#else 1066 vec2 yn_sqr = twoSqr(yn); 1067#endif 1068 float diff = sub_fp64(a, yn_sqr).x; 1069 vec2 prod = twoProd(x * 0.5, diff); 1070#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND) 1071 return sum_fp64(split(yn), prod); 1072#else 1073 return sum_fp64(vec2(yn, 0.0), prod); 1074#endif 1075} 1076`,mP=`struct Fp64ArithmeticUniforms { 1077 ONE: f32, 1078 SPLIT: f32, 1079}; 1080 1081@group(0) @binding(auto) var<uniform> fp64arithmetic : Fp64ArithmeticUniforms; 1082 1083fn fp64_nan(seed: f32) -> f32 { 1084 let nanBits = 0x7fc00000u | select(0u, 1u, seed < 0.0); 1085 return bitcast<f32>(nanBits); 1086} 1087 1088fn fp64_runtime_zero() -> f32 { 1089 return fp64arithmetic.ONE * 0.0; 1090} 1091 1092fn prevent_fp64_optimization(value: f32) -> f32 { 1093#ifdef LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1094 return value + fp64_runtime_zero(); 1095#else 1096 return value; 1097#endif 1098} 1099 1100fn split(a: f32) -> vec2f { 1101 let splitValue = prevent_fp64_optimization(fp64arithmetic.SPLIT + fp64_runtime_zero()); 1102 let t = prevent_fp64_optimization(a * splitValue); 1103 let temp = prevent_fp64_optimization(t - a); 1104 let aHi = prevent_fp64_optimization(t - temp); 1105 let aLo = prevent_fp64_optimization(a - aHi); 1106 return vec2f(aHi, aLo); 1107} 1108 1109fn split2(a: vec2f) -> vec2f { 1110 var b = split(a.x); 1111 b.y = b.y + a.y; 1112 return b; 1113} 1114 1115fn quickTwoSum(a: f32, b: f32) -> vec2f { 1116#ifdef LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1117 let sum = prevent_fp64_optimization((a + b) * fp64arithmetic.ONE); 1118 let err = prevent_fp64_optimization(b - (sum - a) * fp64arithmetic.ONE); 1119#else 1120 let sum = prevent_fp64_optimization(a + b); 1121 let err = prevent_fp64_optimization(b - (sum - a)); 1122#endif 1123 return vec2f(sum, err); 1124} 1125 1126fn twoSum(a: f32, b: f32) -> vec2f { 1127 let s = prevent_fp64_optimization(a + b); 1128#ifdef LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1129 let v = prevent_fp64_optimization((s * fp64arithmetic.ONE - a) * fp64arithmetic.ONE); 1130 let err = 1131 prevent_fp64_optimization((a - (s - v) * fp64arithmetic.ONE) * 1132 fp64arithmetic.ONE * 1133 fp64arithmetic.ONE * 1134 fp64arithmetic.ONE) + 1135 prevent_fp64_optimization(b - v); 1136#else 1137 let v = prevent_fp64_optimization(s - a); 1138 let err = prevent_fp64_optimization(a - (s - v)) + prevent_fp64_optimization(b - v); 1139#endif 1140 return vec2f(s, err); 1141} 1142 1143fn twoSub(a: f32, b: f32) -> vec2f { 1144 let s = prevent_fp64_optimization(a - b); 1145#ifdef LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1146 let v = prevent_fp64_optimization((s * fp64arithmetic.ONE - a) * fp64arithmetic.ONE); 1147 let err = 1148 prevent_fp64_optimization((a - (s - v) * fp64arithmetic.ONE) * 1149 fp64arithmetic.ONE * 1150 fp64arithmetic.ONE * 1151 fp64arithmetic.ONE) - 1152 prevent_fp64_optimization(b + v); 1153#else 1154 let v = prevent_fp64_optimization(s - a); 1155 let err = prevent_fp64_optimization(a - (s - v)) - prevent_fp64_optimization(b + v); 1156#endif 1157 return vec2f(s, err); 1158} 1159 1160fn twoSqr(a: f32) -> vec2f { 1161 let prod = prevent_fp64_optimization(a * a); 1162 let aFp64 = split(a); 1163 let highProduct = prevent_fp64_optimization(aFp64.x * aFp64.x); 1164 let crossProduct = prevent_fp64_optimization(2.0 * aFp64.x * aFp64.y); 1165 let lowProduct = prevent_fp64_optimization(aFp64.y * aFp64.y); 1166#ifdef LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1167 let err = 1168 (prevent_fp64_optimization(highProduct - prod) * fp64arithmetic.ONE + 1169 crossProduct * fp64arithmetic.ONE * fp64arithmetic.ONE) + 1170 lowProduct * fp64arithmetic.ONE * fp64arithmetic.ONE * fp64arithmetic.ONE; 1171#else 1172 let err = ((prevent_fp64_optimization(highProduct - prod) + crossProduct) + lowProduct); 1173#endif 1174 return vec2f(prod, err); 1175} 1176 1177fn twoProd(a: f32, b: f32) -> vec2f { 1178 let prod = prevent_fp64_optimization(a * b); 1179 let aFp64 = split(a); 1180 let bFp64 = split(b); 1181 let highProduct = prevent_fp64_optimization(aFp64.x * bFp64.x); 1182 let crossProduct1 = prevent_fp64_optimization(aFp64.x * bFp64.y
1182); 1183 let crossProduct2 = prevent_fp64_optimization(aFp64.y * bFp64.x); 1184 let lowProduct = prevent_fp64_optimization(aFp64.y * bFp64.y); 1185#ifdef LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1186 let err1 = (highProduct - prod) * fp64arithmetic.ONE; 1187 let err2 = crossProduct1 * fp64arithmetic.ONE * fp64arithmetic.ONE; 1188 let err3 = crossProduct2 * fp64arithmetic.ONE * fp64arithmetic.ONE * fp64arithmetic.ONE; 1189 let err4 = 1190 lowProduct * 1191 fp64arithmetic.ONE * 1192 fp64arithmetic.ONE * 1193 fp64arithmetic.ONE * 1194 fp64arithmetic.ONE; 1195#else 1196 let err1 = highProduct - prod; 1197 let err2 = crossProduct1; 1198 let err3 = crossProduct2; 1199 let err4 = lowProduct; 1200#endif 1201 let err12InputA = prevent_fp64_optimization(err1); 1202 let err12InputB = prevent_fp64_optimization(err2); 1203 let err12 = prevent_fp64_optimization(err12InputA + err12InputB); 1204 let err123InputA = prevent_fp64_optimization(err12); 1205 let err123InputB = prevent_fp64_optimization(err3); 1206 let err123 = prevent_fp64_optimization(err123InputA + err123InputB); 1207 let err1234InputA = prevent_fp64_optimization(err123); 1208 let err1234InputB = prevent_fp64_optimization(err4); 1209 let err = prevent_fp64_optimization(err1234InputA + err1234InputB); 1210 return vec2f(prod, err); 1211} 1212 1213fn sum_fp64(a: vec2f, b: vec2f) -> vec2f { 1214 var s = twoSum(a.x, b.x); 1215 let t = twoSum(a.y, b.y); 1216 s.y = prevent_fp64_optimization(s.y + t.x); 1217 s = quickTwoSum(s.x, s.y); 1218 s.y = prevent_fp64_optimization(s.y + t.y); 1219 s = quickTwoSum(s.x, s.y); 1220 return s; 1221} 1222 1223fn sub_fp64(a: vec2f, b: vec2f) -> vec2f { 1224 var s = twoSub(a.x, b.x); 1225 let t = twoSub(a.y, b.y); 1226 s.y = prevent_fp64_optimization(s.y + t.x); 1227 s = quickTwoSum(s.x, s.y); 1228 s.y = prevent_fp64_optimization(s.y + t.y); 1229 s = quickTwoSum(s.x, s.y); 1230 return s; 1231} 1232 1233fn mul_fp64(a: vec2f, b: vec2f) -> vec2f { 1234 var prod = twoProd(a.x, b.x); 1235 let crossProduct1 = prevent_fp64_optimization(a.x * b.y); 1236 prod.y = prevent_fp64_optimization(prod.y + crossProduct1); 1237#ifdef LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1238 prod = split2(prod); 1239#endif 1240 prod = quickTwoSum(prod.x, prod.y); 1241 let crossProduct2 = prevent_fp64_optimization(a.y * b.x); 1242 prod.y = prevent_fp64_optimization(prod.y + crossProduct2); 1243#ifdef LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1244 prod = split2(prod); 1245#endif 1246 prod = quickTwoSum(prod.x, prod.y); 1247 return prod; 1248} 1249 1250fn div_fp64(a: vec2f, b: vec2f) -> vec2f { 1251 let xn = prevent_fp64_optimization(1.0 / b.x); 1252 let yn = mul_fp64(a, vec2f(xn, fp64_runtime_zero())); 1253 let diff = prevent_fp64_optimization(sub_fp64(a, mul_fp64(b, yn)).x); 1254 let prod = twoProd(xn, diff); 1255 return sum_fp64(yn, prod); 1256} 1257 1258fn sqrt_fp64(a: vec2f) -> vec2f { 1259 if (a.x == 0.0 && a.y == 0.0) { 1260 return vec2f(0.0, 0.0); 1261 } 1262 if (a.x < 0.0) { 1263 let nanValue = fp64_nan(a.x); 1264 return vec2f(nanValue, nanValue); 1265 } 1266 1267 let x = prevent_fp64_optimization(1.0 / sqrt(a.x)); 1268 let yn = prevent_fp64_optimization(a.x * x); 1269#ifdef LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1270 let ynSqr = twoSqr(yn) * fp64arithmetic.ONE; 1271#else 1272 let ynSqr = twoSqr(yn); 1273#endif 1274 let diff = prevent_fp64_optimization(sub_fp64(a, ynSqr).x); 1275 let prod = twoProd(prevent_fp64_optimization(x * 0.5), diff); 1276#ifdef LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1277 return sum_fp64(split(yn), prod); 1278#else 1279 return sum_fp64(vec2f(yn, 0.0), prod); 1280#endif 1281} 1282`,gP={ONE:1,SPLIT:4097},_P={name:"fp64arithmetic",source:mP,fs:M1,vs:M1,defaultUniforms:gP,uniformTypes:{ONE:"f32",SPLIT:"f32"},fp64ify:GS,fp64LowPart:lP,fp64ifyMatrix4:cP},yP=[0,1,1,1],vP=`layout(std140) uniform pickingUniforms { 1283 float isActive; 1284 float isAttribute; 1285 float isHighlightActive; 1286 float useByteColors; 1287 vec3 highlightedObjectColor; 1288 vec4 highlightColor; 1289} picking; 1290 1291out vec4 picking_vRGBcolor_Avalid; 1292 1293// Normalize unsigned byte color to 0-1 range 1294vec3 picking_normalizeColor(vec3 color) { 1295 return picking.useByteColors > 0.5 ? color / 255.0 : color; 1296} 1297 1298// Normalize unsigned byte color to 0-1 range 1299vec4 picking_normalizeColor(vec4 color) { 1300 return picking.useByteColors > 0.5 ? color / 255.0 : color; 1301} 1302 1303bool picking_isColorZero(vec3 color) { 1304 return dot(color, vec3(1.0)) < 0.00001; 1305} 1306 1307bool picking_isColorValid(vec3 color) { 1308 return dot(color, vec3(1.0)) > 0.00001; 1309} 1310 1311// Check if this vertex is highlighted 1312bool isVertexHighlighted(vec3 vertexColor) { 1313 vec3 highlightedObjectColor = picking_normalizeColor(picking.highlightedObjectColor); 1314 return 1315 bool(picking.isHighlightActive) && picking_isColorZero(abs(vertexColor - highlightedObjectColor)); 1316} 1317 1318// Set the current picking color 1319void picking_setPickingColor(vec3 pickingColor) { 1320 pickingColor = picking_normalizeColor(pickingColor); 1321 1322 if (bool(picking.isActive)) { 1323 // Use alpha as the validity flag. If pickingColor is [0, 0, 0] fragment is non-pickable
1324 picking_vRGBcolor_Avalid.a = float(picking_isColorValid(pickingColor)); 1325 1326 if (!bool(picking.isAttribute)) { 1327 // Stores the picking color so that the fragment shader can render it during picking 1328 picking_vRGBcolor_Avalid.rgb = pickingColor; 1329 } 1330 } else { 1331 // Do the comparison with selected item color in vertex shader as it should mean fewer compares 1332 picking_vRGBcolor_Avalid.a = float(isVertexHighlighted(pickingColor)); 1333 } 1334} 1335 1336void picking_setPickingAttribute(float value) { 1337 if (bool(picking.isAttribute)) { 1338 picking_vRGBcolor_Avalid.r = value; 1339 } 1340} 1341 1342void picking_setPickingAttribute(vec2 value) { 1343 if (bool(picking.isAttribute)) { 1344 picking_vRGBcolor_Avalid.rg = value; 1345 } 1346} 1347 1348void picking_setPickingAttribute(vec3 value) { 1349 if (bool(picking.isAttribute)) { 1350 picking_vRGBcolor_Avalid.rgb = value; 1351 } 1352} 1353`,bP=`layout(std140) uniform pickingUniforms { 1354 float isActive; 1355 float isAttribute; 1356 float isHighlightActive; 1357 float useByteColors; 1358 vec3 highlightedObjectColor; 1359 vec4 highlightColor; 1360} picking; 1361 1362in vec4 picking_vRGBcolor_Avalid; 1363 1364/* 1365 * Returns highlight color if this item is selected. 1366 */ 1367vec4 picking_filterHighlightColor(vec4 color) { 1368 // If we are still picking, we don't highlight 1369 if (picking.isActive > 0.5) { 1370 return color; 1371 } 1372 1373 bool selected = bool(picking_vRGBcolor_Avalid.a); 1374 1375 if (selected) { 1376 // Blend in highlight color based on its alpha value 1377 float highLightAlpha = picking.highlightColor.a; 1378 float blendedAlpha = highLightAlpha + color.a * (1.0 - highLightAlpha); 1379 float highLightRatio = highLightAlpha / blendedAlpha; 1380 1381 vec3 blendedRGB = mix(color.rgb, picking.highlightColor.rgb, highLightRatio); 1382 return vec4(blendedRGB, blendedAlpha); 1383 } else { 1384 return color; 1385 } 1386} 1387 1388/* 1389 * Returns picking color if picking enabled else unmodified argument. 1390 */ 1391vec4 picking_filterPickingColor(vec4 color) { 1392 if (bool(picking.isActive)) { 1393 if (picking_vRGBcolor_Avalid.a == 0.0) { 1394 discard; 1395 } 1396 return picking_vRGBcolor_Avalid; 1397 } 1398 return color; 1399} 1400 1401/* 1402 * Returns picking color if picking is enabled if not 1403 * highlight color if this item is selected, otherwise unmodified argument. 1404 */ 1405vec4 picking_filterColor(vec4 color) { 1406 vec4 highlightColor = picking_filterHighlightColor(color); 1407 return picking_filterPickingColor(highlightColor); 1408} 1409`,P1={props:{},uniforms:{},name:"picking",uniformTypes:{isActive:"f32",isAttribute:"f32",isHighlightActive:"f32",useByteColors:"f32",highlightedObjectColor:"vec3<f32>",highlightColor:"vec4<f32>"},defaultUniforms:{isActive:!1,isAttribute:!1,isHighlightActive:!1,useByteColors:!0,highlightedObjectColor:[0,0,0],highlightColor:yP},vs:vP,fs:bP,getUniforms:xP};function xP(t={},e){const i={},n=uP(t.useByteColors,!0);if(t.highlightedObjectColor!==void 0)if(t.highlightedObjectColor===null)i.isHighlightActive=!1;else{i.isHighlightActive=!0;const o=t.highlightedObjectColor.slice(0,3);i.highlightedObjectColor=o}return t.highlightColor&&(i.highlightColor=dP(t.highlightColor,n)),t.isActive!==void 0&&(i.isActive=!!t.isActive,i.isAttribute=!!t.isAttribute),t.useByteColors!==void 0&&(i.useByteColors=!!t.useByteColors),i}const wP="GPU Time and Memory",TP=["Adapter","GPU","GPU Type","GPU Backend","Frame Rate","CPU Time","GPU Time","GPU Memory","Buffer Memory","Texture Memory","Referenced Buffer Memory","Referenced Texture Memory","Swap Chain Texture"],I1=new WeakMap,D1=new WeakMap;class SP{constructor(){Y(this,"stats",new Map)}getStats(e){return this.get(e)}get(e){this.stats.has(e)||this.stats.set(e,new sv({id:e}));const i=this.stats.get(e);return e===wP&&AP(i,TP),i}}const KS=new SP;function AP(t,e){const i=t.stats;let n=!1;for(const A of e)i[A]||(t.get(A),n=!0);const o=Object.keys(i).length,d=I1.get(t);if(!n&&(d==null?void 0:d.orderedStatNames)===e&&d.statCount===o)return;const p={};let h=D1.get(e);h||(h=new Set(e),D1.set(e,h));for(const A of e)i[A]&&(p[A]=i[A]);for(const[A,R]of Object.entries(i))h.has(A)||(p[A]=R);for(const A of Object.keys(i))delete i[A];Object.assign(i,p),I1.set(t,{orderedStatNames:e,statCount:o})}const at=new vg({id:"luma.gl"}),Qv={};function wg(t="id"){Qv[t]=Qv[t]||1;const e=Qv[t]++;return`${t}-${e}`}const EP="cpu-hotspot-profiler",O1="GPU Resource Counts",k1="Resource Counts",B1="GPU Time and Memory",CP=["Resources","Buffers","Textures","Samplers","TextureViews","Framebuffers","QuerySets","Shaders","RenderPipelines","ComputePipelines","PipelineLayouts","VertexArrays","RenderPasss","ComputePasss","CommandEncoders","CommandBuffers"],RP=["Resources","Buffers","Textures","Samplers","TextureViews","Framebuffers","QuerySets","Shaders","RenderPipelines","SharedRenderPipelines","ComputePipelines","PipelineLayouts","VertexArrays","RenderPasss","ComputePasss","CommandEncoders","CommandBuffers"],MP=CP.flatMap(t=>[`${t} Created`,`${t} Active`]),PP=RP.flatMap(t=>[`${t} Created`,`${t} Active`]),N1=new WeakMap,z1=new WeakMap;var zb;let nn=(zb=class{constructor(e,i,n){Y(this,"id");Y(this,"props");Y(this,"userData",{});Y(this,"_device");Y(this,"destroyed",!1);Y(this,"allocatedBytes",0);Y(this,"allocatedBytesName",null);Y(this,"_attachedResources",new Set);if(!e)throw new Error("no device");this._device=e,this.props=IP(i,n);const o=this.props.id!=="undefined"?this.props.id:wg(this[Symbol.toStringTag]);this.props.id=o,this.id=o,this.userData=this.props.userData||{},this.addStats()}toString(){return`${this[Symbol.toStringTag]||this.constructor.name}:"${this.id}"`}destroy(){this.destroyed||this.destroyResource()}delete(){return this.destroy(),this}getProps(){return this.props}attachResource(e){this._attachedResources.add(e)}detachResource(e){this._attachedResources.delete(e)}destroyAttachedResource(e){this._attachedResources.delete(e)&&e.destroy()}destroyAttachedResources(){for(const e of this._attachedResources)e.destroy();this._attachedResources=new Set}destroyResource(){this.destroyed||(this.destroyAttachedResources(),this.removeStats(),this.destroyed=!0)}removeStats(){const e=Ym(this._device),i=e?ih():0,n=[this._device.statsManager.getStats(O1),this._device.statsManager.getStats(k1)],o=F1(this._device);for(const p of n)L1(p,o);const d=this.getStatsName();for(const p of n)p.get("Resources Active").decrementCount(),p.get(`${d}s Active`).decrementCount();e&&(e.statsBookkeepingCalls=(e.statsBookkeepingCalls||0)+1,e.statsBookkeepingTimeMs=(e.statsBookkeepingTimeMs||0)+(ih()-i))}trackAllocatedMemory(e,i=this.getStatsName()){const n=Ym(this._device),o=n?ih():0,d=this._device.statsManager.getStats(B1);this.allocatedBytes>0&&this.allocatedBytesName&&(d.get("GPU Memory").subtractCount(this.allocatedBytes),d.get(`${this.allocatedBytesName} Memory`).subtractCount(this.allocatedBytes)),d.get("GPU Memory").addCount(e),d.get(`${i} Memory`).addCount(e),n&&(n.statsBookkeepingCalls=(n.statsBookkeepingCalls||0)+1,n.statsBookkeepingTimeMs=(n.statsBookkeepingTimeMs||0)+(ih()-o)),this.allocatedBytes=e,this.allocatedBytesName=i}trackReferencedMemory(e,i=this.getStatsName()){this.trackAllocatedMemory(e,`Referenced ${i}`)}trackDeallocatedMemory(e=this.getStatsName()){if(this.allocatedBytes===0){this.allocatedBytesName=null;return}const i=Ym(this._device),n=i?ih():0,o=this._device.statsManager.getStats(B1);o.get("GPU Memory").subtractCount(this.allocatedBytes),o.get(`${this.allocatedBytesName||e} Memory`).subtractCount(this.allocatedBytes),i&&(i.statsBookkeepingCalls=(i.statsBookkeepingCalls||0)+1,i.statsBookkeepingTimeMs=(i.statsBookkeepingTimeMs||0)+(ih()-n)),this.allocatedBytes=0,this.allocatedBytesName=null}trackDeallocatedReferencedMemory(e=this.getStatsName()){this.trackDeallocatedMemory(`Referenced ${e}`)}addStats(){const e=this.getStatsName(),i=Ym(this._device),n=i?ih():0,o=[this._device.statsManager.getStats(O1),this._device.statsManager.getStats(k1)],d=F1(this._device);for(const p of o)L1(p,d);for(const p of o)p.get("Resources Created").incrementCount(),p.get("Resources Active").incrementCount(),p.get(`${e}s Created`).incrementCount(),p.get(`${e}s Active`).incrementCount();i&&(i.statsBookkeepingCalls=(i.statsBookkeepingCalls||0)+1,i.statsBookkeepingTimeMs=(i.statsBookkeepingTimeMs||0)+(ih()-n)),DP(this._device,e)}getStatsName(){return OP(this)}},Y(zb,"defaultProps",{id:"undefined",handle:void 0,userData:void 0}),zb);function IP(t,e){const i={...e};for(const n in t)t[n]!==void 0&&(i[n]=t[n]);return i}function L1(t,e){const i=t.stats;let n=!1;for(const A of e)i[A]||(t.get(A),n=!0);const o=Object.keys(i).length,d=N1.get(t);if(!n&&(d==null?void 0:d.orderedStatNames)===e&&d.statCount===o)return;const p={};let h=z1.get(e);h||(h=new Set(e),z1.set(e,h));for(const A of e)i[A]&&(p[A]=i[A]);for(const[A,R]of Object.entries(i))h.has(A)||(p[A]=R);for(const A of Object.keys(i))delete i[A];Object.assign(i,p),N1.set(t,{orderedStatNames:e,statCount:o})}function F1(t){return t.type==="webgl"?PP:MP}function Ym(t){const e=t.userData[EP];return e!=null&&e.enabled?e:null}function ih(){var t,e;return((e=(t=globalThis.performance)==null?void 0:t.now)==null?void 0:e.call(t))??Date.now()}function DP(t,e){const i=Ym(t);if(!(!i||!i.activeDefaultFramebufferAcquireDepth))switch(i.transientCanvasResourceCreates=(i.transientCanvasResourceCreates||0)+1,e){case"Texture":i.transientCanvasTextureCreates=(i.transientCanvasTextureCreates||0)+1;break;case"TextureView":i.transientCanvasTextureViewCreates=(i.transientCanvasTextureViewCreates||0)+1;break;case"Sampler":i.transientCanvasSamplerCreates=(i.transientCanvasSamplerCreates||0)+1;break;case"Framebuffer":i.transientCanvasFramebufferCreates=(i.transientCanvasFramebufferCreates||0)+1;break}}function OP(t){let e=Object.getPrototypeOf(t);for(;e;){const i=Object.getPrototypeOf(e);if(!i||i===nn.prototype)return kP(e)||t[Symbol.toStringTag]||t.constructor.name;e=i}return t[Symbol.toStringTag]||t.constructor.name}function kP(t){const e=Object.getOwnPropertyDescriptor(t,Symbol.toStringTag);return typeof(e==null?void 0:e.get)=="function"?e.get.call(t):typeof(e==null?void 0:e.value)=="str
1409ing"?e.value:null}const ws=class ws extends nn{constructor(i,n){const o={...n};(n.usage||0)&ws.INDEX&&!n.indexType&&(n.data instanceof Uint32Array?o.indexType="uint32":n.data instanceof Uint16Array?o.indexType="uint16":n.data instanceof Uint8Array&&(o.indexType="uint8")),delete o.data;super(i,o,ws.defaultProps);Y(this,"usage");Y(this,"indexType");Y(this,"updateTimestamp");Y(this,"debugData",new ArrayBuffer(0));this.usage=o.usage||0,this.indexType=o.indexType,this.updateTimestamp=i.incrementTimestamp()}get[Symbol.toStringTag](){return"Buffer"}clone(i){return this.device.createBuffer({...this.props,...i})}_setDebugData(i,n,o){let d=null,p;ArrayBuffer.isView(i)?(d=i,p=i.buffer):p=i;const h=Math.min(i?i.byteLength:o,ws.DEBUG_DATA_MAX_LENGTH);if(p===null)this.debugData=new ArrayBuffer(h);else{const A=Math.min((d==null?void 0:d.byteOffset)||0,p.byteLength),R=Math.max(0,p.byteLength-A),B=Math.min(h,R);this.debugData=new Uint8Array(p,A,B).slice().buffer}}};Y(ws,"INDEX",16),Y(ws,"VERTEX",32),Y(ws,"UNIFORM",64),Y(ws,"STORAGE",128),Y(ws,"INDIRECT",256),Y(ws,"QUERY_RESOLVE",512),Y(ws,"MAP_READ",1),Y(ws,"MAP_WRITE",2),Y(ws,"COPY_SRC",4),Y(ws,"COPY_DST",8),Y(ws,"DEBUG_DATA_MAX_LENGTH",32),Y(ws,"defaultProps",{...nn.defaultProps,usage:0,byteLength:0,byteOffset:0,data:null,indexType:"uint16",onMapped:void 0});let En=ws;class BP{getDataTypeInfo(e){const[i,n,o]=Jv[e],d=e.includes("norm"),p=!d&&!e.startsWith("float"),h=e.startsWith("s");return{signedType:i,primitiveType:n,byteLength:o,normalized:d,integer:p,signed:h}}getNormalizedDataType(e){const i=e;switch(i){case"uint8":return"unorm8";case"sint8":return"snorm8";case"uint16":return"unorm16";case"sint16":return"snorm16";default:return i}}alignTo(e,i){switch(i){case 1:return e;case 2:return e+e%2;default:return e+(4-e%4)%4}}getDataType(e){const i=ArrayBuffer.isView(e)?e.constructor:e;if(i===Uint8ClampedArray)return"uint8";const n=Object.values(Jv).find(o=>i===o[4]);if(!n)throw new Error(i.name);return n[0]}getTypedArrayConstructor(e){const[,,,,i]=Jv[e];return i}}const $c=new BP,Jv={uint8:["uint8","u32",1,!1,Uint8Array],sint8:["sint8","i32",1,!1,Int8Array],unorm8:["uint8","f32",1,!0,Uint8Array],snorm8:["sint8","f32",1,!0,Int8Array],uint16:["uint16","u32",2,!1,Uint16Array],sint16:["sint16","i32",2,!1,Int16Array],unorm16:["uint16","u32",2,!0,Uint16Array],snorm16:["sint16","i32",2,!0,Int16Array],float16:["float16","f16",2,!1,Uint16Array],float32:["float32","f32",4,!1,Float32Array],uint32:["uint32","u32",4,!1,Uint32Array],sint32:["sint32","i32",4,!1,Int32Array]};class NP{getVertexFormatInfo(e){let i;e.endsWith("-webgl")&&(e.replace("-webgl",""),i=!0);const[n,o]=e.split("x"),d=n,p=o?parseInt(o):1,h=$c.getDataTypeInfo(d),A={type:d,components:p,byteLength:h.byteLength*p,integer:h.integer,signed:h.signed,normalized:h.normalized};return i&&(A.webglOnly=!0),A}makeVertexFormat(e,i,n){const o=n?$c.getNormalizedDataType(e):e;switch(o){case"unorm8":return i===1?"unorm8":i===3?"unorm8x3-webgl":`${o}x${i}`;case"snorm8":return i===1?"snorm8":i===3?"snorm8x3-webgl":`${o}x${i}`;case"uint8":case"sint8":if(i===1||i===3)throw new Error(`size: ${i}`);return`${o}x${i}`;case"uint16":return i===1?"uint16":i===3?"uint16x3-webgl":`${o}x${i}`;case"sint16":return i===1?"sint16":i===3?"sint16x3-webgl":`${o}x${i}`;case"unorm16":return i===1?"unorm16":i===3?"unorm16x3-webgl":`${o}x${i}`;case"snorm16":return i===1?"snorm16":i===3?"snorm16x3-webgl":`${o}x${i}`;case"float16":if(i===1||i===3)throw new Error(`size: ${i}`);return`${o}x${i}`;default:return i===1?o:`${o}x${i}`}}getVertexFormatFromAttribute(e,i,n){if(!i||i>4)throw new Error(`size ${i}`);const o=i,d=$c.getDataType(e);return this.makeVertexFormat(d,o,n)}getCompatibleVertexFormat(e){let i;switch(e.primitiveType){case"f32":i="float32";break;case"i32":i="sint32";break;case"u32":i="uint32";break;case"f16":return e.components<=2?"float16x2":"float16x4"}return e.components===1?i:`${i}x${e.components}`}}const fg=new NP,Hs="texture-compression-bc",In="texture-compression-astc",Gl="texture-compression-etc2",zP="texture-compression-etc1-webgl",B_="texture-compression-pvrtc-webgl",eb="texture-compression-atc-webgl",N_="float32-renderable-webgl",tb="float16-renderable-webgl",LP="rgb9e5ufloat-renderable-webgl",ib="snorm8-renderable-webgl",nh="norm16-webgl",nb="norm16-renderable-webgl",rb="snorm16-renderable-webgl",z_="float32-filterable",U1="float16-filterable-webgl";function QS(t){const e=JS[t];if(!e)throw new Error(`Unsupported texture format ${t}`);return e}function FP(){return JS}const UP={r8unorm:{},rg8unorm:{},"rgb8unorm-webgl":{},rgba8unorm:{},"rgba8unorm-srgb":{},r8snorm:{render:ib},rg8snorm:{render:ib},"rgb8snorm-webgl":{},rgba8snorm:{render:ib},r8uint:{},rg8uint:{},rgba8uint:{},r8sint:{},rg8sint:{},rgba8sint:{},bgra8unorm:{},"bgra8unorm-srgb":{},r16unorm:{f:nh,render:nb},rg16unorm:{f:nh,render:nb},"rgb16unorm-webgl":{f:nh,render:!1},rgba16unorm:{f:nh,render:nb},r16snorm:{f:nh,render:rb},rg16snorm:{f:nh,render:rb},"rgb16snorm-webgl":{f:nh,render:!1},rgba16snorm:{f:nh,render:rb},r16uint:{},rg16uint:{},rgba16uint:{},r16sint:{},rg16sint:{},rgba16sint:{},r16float:{render:tb,filter:"float16-filterable-webgl"},rg16float:{render:tb,filter:U1},rgba16float:{render:tb,filter:U1},r32uint:{},rg32uint:{},rgba32uint:{},r32sint:{},rg32sint:{},rgba32sint:{},r32float:{render:N_,filter:z_},rg32float:{render:!1,filter:z_},"rgb32float-webgl":{render:N_,filter:z_},rgba32float:{render:N_,filter:z_},"rgba4unorm-webgl":{channels:"rgba",bitsPerChannel:[4,4,4,4],packed:!0},"rgb565unorm-webgl":{channels:"rgb",bitsPerChannel:[5,6,5,0],packed:!0},"rgb5a1unorm-webgl":{channels:"rgba",bitsPerChannel:[5,5,5,1],packed:!0},rgb9e5ufloat:{channels:"rgb",packed:!0,render:LP},rg11b10ufloat:{channels:"rgb",bitsPerChannel:[11,11,10,0],packed:!0,p:1,render:N_},rgb10a2unorm:{channels:"rgba",bitsPerChannel:[10,10,10,2],packed:!0,p:1},rgb10a2uint:{channels:"rgba",bitsPerChannel:[10,10,10,2],packed:!0,p:1},stencil8:{attachment:"stencil",bitsPerChannel:[8,0,0,0],dataType:"uint8"},depth16unorm:{attachment:"depth",bitsPerChannel:[16,0,0,0],dataType:"uint16"},depth24plus:{attachment:"depth",bitsPerChannel:[24,0,0,0],dataType:"uint32"},depth32float:{attachment:"depth",bitsPerChannel:[32,0,0,0],dataType:"float32"},"depth24plus-stencil8":{attachment:"depth-stencil",bitsPerChannel:[24,8,0,0],packed:!0},"depth32float-stencil8":{attachment:"depth-stencil",bitsPerChannel:[32,8,0,0],packed:!0}}
1409,jP={"bc1-rgb-unorm-webgl":{f:Hs},"bc1-rgb-unorm-srgb-webgl":{f:Hs},"bc1-rgba-unorm":{f:Hs},"bc1-rgba-unorm-srgb":{f:Hs},"bc2-rgba-unorm":{f:Hs},"bc2-rgba-unorm-srgb":{f:Hs},"bc3-rgba-unorm":{f:Hs},"bc3-rgba-unorm-srgb":{f:Hs},"bc4-r-unorm":{f:Hs},"bc4-r-snorm":{f:Hs},"bc5-rg-unorm":{f:Hs},"bc5-rg-snorm":{f:Hs},"bc6h-rgb-ufloat":{f:Hs},"bc6h-rgb-float":{f:Hs},"bc7-rgba-unorm":{f:Hs},"bc7-rgba-unorm-srgb":{f:Hs},"etc2-rgb8unorm":{f:Gl},"etc2-rgb8unorm-srgb":{f:Gl},"etc2-rgb8a1unorm":{f:Gl},"etc2-rgb8a1unorm-srgb":{f:Gl},"etc2-rgba8unorm":{f:Gl},"etc2-rgba8unorm-srgb":{f:Gl},"eac-r11unorm":{f:Gl},"eac-r11snorm":{f:Gl},"eac-rg11unorm":{f:Gl},"eac-rg11snorm":{f:Gl},"astc-4x4-unorm":{f:In},"astc-4x4-unorm-srgb":{f:In},"astc-5x4-unorm":{f:In},"astc-5x4-unorm-srgb":{f:In},"astc-5x5-unorm":{f:In},"astc-5x5-unorm-srgb":{f:In},"astc-6x5-unorm":{f:In},"astc-6x5-unorm-srgb":{f:In},"astc-6x6-unorm":{f:In},"astc-6x6-unorm-srgb":{f:In},"astc-8x5-unorm":{f:In},"astc-8x5-unorm-srgb":{f:In},"astc-8x6-unorm":{f:In},"astc-8x6-unorm-srgb":{f:In},"astc-8x8-unorm":{f:In},"astc-8x8-unorm-srgb":{f:In},"astc-10x5-unorm":{f:In},"astc-10x5-unorm-srgb":{f:In},"astc-10x6-unorm":{f:In},"astc-10x6-unorm-srgb":{f:In},"astc-10x8-unorm":{f:In},"astc-10x8-unorm-srgb":{f:In},"astc-10x10-unorm":{f:In},"astc-10x10-unorm-srgb":{f:In},"astc-12x10-unorm":{f:In},"astc-12x10-unorm-srgb":{f:In},"astc-12x12-unorm":{f:In},"astc-12x12-unorm-srgb":{f:In},"pvrtc-rgb4unorm-webgl":{f:B_},"pvrtc-rgba4unorm-webgl":{f:B_},"pvrtc-rgb2unorm-webgl":{f:B_},"pvrtc-rgba2unorm-webgl":{f:B_},"etc1-rbg-unorm-webgl":{f:zP},"atc-rgb-unorm-webgl":{f:eb},"atc-rgba-unorm-webgl":{f:eb},"atc-rgbai-unorm-webgl":{f:eb}},JS={...UP,...jP},VP=/^(r|rg|rgb|rgba|bgra)([0-9]*)([a-z]*)(-srgb)?(-webgl)?$/,$P=["rgb","rgba","bgra"],HP=["depth","stencil"],WP=["bc1","bc2","bc3","bc4","bc5","bc6","bc7","etc1","etc2","eac","atc","astc","pvrtc"];class XP{isColor(e){return $P.some(i=>e.startsWith(i))}isDepthStencil(e){return HP.some(i=>e.startsWith(i))}isCompressed(e){return WP.some(i=>e.startsWith(i))}getInfo(e){return e2(e)}getCapabilities(e){return ZP(e)}computeMemoryLayout(e){return qP(e)}}const al=new XP;function qP({format:t,width:e,height:i,depth:n,byteAlignment:o}){const d=al.getInfo(t),{bytesPerPixel:p,bytesPerBlock:h=p,blockWidth:A=1,blockHeight:R=1,compressed:B=!1}=d,N=B?Math.ceil(e/A):e,F=B?Math.ceil(i/R):i,Q=N*h,re=Math.ceil(Q/o)*o,se=F,ae=re*se*n;return{bytesPerPixel:p,bytesPerRow:re,rowsPerImage:se,depthOrArrayLayers:n,bytesPerImage:re*se,byteLength:ae}}function ZP(t){const e=QS(t),i={format:t,create:e.f??!0,render:e.render??!0,filter:e.filter??!0,blend:e.blend??!0,store:e.store??!0},n=e2(t),o=t.startsWith("depth")||t.startsWith("stencil"),d=n==null?void 0:n.signed,p=n==null?void 0:n.integer,h=n==null?void 0:n.webgl,A=!!(n!=null&&n.compressed);return i.render&&(i.render=!o&&!A),i.filter&&(i.filter=!o&&!d&&!p&&!h),i}function e2(t){let e=YP(t);if(al.isCompressed(t)){e.channels="rgb",e.components=3,e.bytesPerPixel=1,e.srgb=!1,e.compressed=!0,e.bytesPerBlock=KP(t);const n=GP(t);n&&(e.blockWidth=n.blockWidth,e.blockHeight=n.blockHeight)}const i=e.packed?null:VP.exec(t);if(i){const[,n,o,d,p,h]=i,A=`${d}${o}`,R=$c.getDataTypeInfo(A),B=R.byteLength*8,N=(n==null?void 0:n.length)??1,F=[B,N>=2?B:0,N>=3?B:0,N>=4?B:0];e={format:t,attachment:e.attachment,dataType:R.signedType,components:N,channels:n,integer:R.integer,signed:R.signed,normalized:R.normalized,bitsPerChannel:F,bytesPerPixel:R.byteLength*N,packed:e.packed,srgb:e.srgb},h==="-webgl"&&(e.webgl=!0),p==="-srgb"&&(e.srgb=!0)}return t.endsWith("-webgl")&&(e.webgl=!0),t.endsWith("-srgb")&&(e.srgb=!0),e}function YP(t){var d;const e=QS(t),i=e.bytesPerPixel||1,n=e.bitsPerChannel||[8,8,8,8];return delete e.bitsPerChannel,delete e.bytesPerPixel,delete e.f,delete e.render,delete e.filter,delete e.blend,delete e.store,{...e,format:t,attachment:e.attachment||"color",channels:e.channels||"r",components:e.components||((d=e.channels)==null?void 0:d.length)||1,bytesPerPixel:i,bitsPerChannel:n,dataType:e.dataType||"uint8",srgb:e.srgb??!1,packed:e.packed??!1,webgl:e.webgl??!1,integer:e.integer??!1,signed:e.signed??!1,normalized:e.normalized??!1,compressed:e.compressed??!1}}function GP(t){const i=/.*-(\d+)x(\d+)-.*/.exec(t);if(i){const[,n,o]=i;return{blockWidth:Number(n),blockHeight:Number(o)}}return t.startsWith("bc")||t.startsWith("etc1")||t.startsWith("etc2")||t.startsWith("eac")||t.startsWith("atc")?{blockWidth:4,blockHeight:4}:t.startsWith("pvrtc-rgb4")||t.startsWith("pvrtc-rgba4")?{blockWidth:4,blockHeight:4}:t.startsWith("pvrtc-rgb2")||t.startsWith("pvrtc-rgba2")?{blockWidth:8,blockHeight:4}:null}function KP(t){return t.startsWith("bc1")||t.startsWith("bc4")||t.startsWith("etc1")||t.startsWith("etc2-rgb8")||t.startsWith("etc2-rgb8a1")||t.startsWith("eac-r11")||t==="atc-rgb-unorm-webgl"?8:t.startsWith("bc2")||t.startsWith("bc3")||t.startsWith("bc5")||t.startsWith("bc6h")||t.startsWith("bc7")||t.startsWith("etc2-rgba8")||t.startsWith("eac-rg11")||t.startsWith("astc")||t==="atc-rgba-unorm-webgl"||t==="atc-rgbai-unorm-webgl"?16:t.startsWith("pvrtc")?8:16}function ax(t){return typeof ImageData<"u"&&t instanceof ImageData||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement||typeof VideoFrame<"u"&&t instanceof VideoFrame||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas}function t2(t){if(typeof ImageData<"u"&&t instanceof ImageData||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas)return{width:t.width,height:t.height};if(typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement)return{width:t.naturalWi
1409dth,height:t.naturalHeight};if(typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement)return{width:t.videoWidth,height:t.videoHeight};if(typeof VideoFrame<"u"&&t instanceof VideoFrame)return{width:t.displayWidth,height:t.displayHeight};throw new Error("Unknown image type")}class QP{}function JP(t,e){const i=Kb(t),n=e.map(Kb).filter(o=>o!==void 0);return[i,...n].filter(o=>o!==void 0)}function Kb(t){var e;if(t!==void 0){if(t===null||typeof t=="string"||typeof t=="number"||typeof t=="boolean")return t;if(t instanceof Error)return t.message;if(Array.isArray(t))return t.map(Kb);if(typeof t=="object"){if(eI(t)){const i=String(t);if(i!=="[object Object]")return i}return tI(t)?iI(t):((e=t.constructor)==null?void 0:e.name)||"Object"}return String(t)}}function eI(t){return"toString"in t&&typeof t.toString=="function"&&t.toString!==Object.prototype.toString}function tI(t){return"message"in t&&"type"in t}function iI(t){const e=typeof t.type=="string"?t.type:"message",i=typeof t.message=="string"?t.message:"",n=typeof t.lineNum=="number"?t.lineNum:null,o=typeof t.linePos=="number"?t.linePos:null,d=n!==null&&o!==null?` @ ${n}:${o}`:n!==null?` @ ${n}`:"";return`${e}${d}: ${i}`.trim()}class nI{constructor(e=[],i){Y(this,"features");Y(this,"disabledFeatures");this.features=new Set(e),this.disabledFeatures=i||{}}*[Symbol.iterator](){yield*this.features}has(e){var i;return!((i=this.disabledFeatures)!=null&&i[e])&&this.features.has(e)}}const Uy=class Uy{constructor(e){Y(this,"id");Y(this,"props");Y(this,"userData",{});Y(this,"statsManager",KS);Y(this,"_factories",{});Y(this,"timestamp",0);Y(this,"_reused",!1);Y(this,"_moduleData",{});Y(this,"_textureCaps",{});Y(this,"_debugGPUTimeQuery",null);this.props={...Uy.defaultProps,...e},this.id=this.props.id||wg(this[Symbol.toStringTag].toLowerCase())}get[Symbol.toStringTag](){return"Device"}toString(){return`Device(${this.id})`}getVertexFormatInfo(e){return fg.getVertexFormatInfo(e)}isVertexFormatSupported(e){return!0}getTextureFormatInfo(e){return al.getInfo(e)}getTextureFormatCapabilities(e){let i=this._textureCaps[e];if(!i){const n=this._getDeviceTextureFormatCapabilities(e);i=this._getDeviceSpecificTextureFormatCapabilities(n),this._textureCaps[e]=i}return i}getMipLevelCount(e,i,n=1){const o=Math.max(e,i,n);return 1+Math.floor(Math.log2(o))}isExternalImage(e){return ax(e)}getExternalImageSize(e){return t2(e)}isTextureFormatSupported(e){return this.getTextureFormatCapabilities(e).create}isTextureFormatFilterable(e){return this.getTextureFormatCapabilities(e).filter}isTextureFormatRenderable(e){return this.getTextureFormatCapabilities(e).render}isTextureFormatCompressed(e){return al.isCompressed(e)}getSupportedCompressedTextureFormats(){const e=[];for(const i of Object.keys(FP()))this.isTextureFormatCompressed(i)&&this.isTextureFormatSupported(i)&&e.push(i);return e}pushDebugGroup(e){this.commandEncoder.pushDebugGroup(e)}popDebugGroup(){var e;(e=this.commandEncoder)==null||e.popDebugGroup()}insertDebugMarker(e){var i;(i=this.commandEncoder)==null||i.insertDebugMarker(e)}loseDevice(){return!1}incrementTimestamp(){return this.timestamp++}reportError(e,i,...n){if(!this.props.onError(e,i)){const d=JP(i,n);return at.error(this.type==="webgl"?"%cWebGL":"%cWebGPU","color: white; background: red; padding: 2px 6px; border-radius: 3px;",e.message,...d)}return()=>{}}debug(){if(this.props.debug)debugger;else at.once(0,`'Type luma.log.set({debug: true}) in console to enable debug breakpoints', 1410or create a device with the 'debug: true' prop.`)()}getDefaultCanvasContext(){if(!this.canvasContext)throw new Error("Device has no default CanvasContext. See props.createCanvasContext");return this.canvasContext}createFence(){throw new Error("createFence() not implemented")}beginRenderPass(e){return this.commandEncoder.beginRenderPass(e)}beginComputePass(e){return this.commandEncoder.beginComputePass(e)}generateMipmapsWebGPU(e){throw new Error("not implemented")}_createSharedRenderPipelineWebGL(e){throw new Error("_createSharedRenderPipelineWebGL() not implemented")}_createBindGroupLayoutWebGPU(e,i){throw new Error("_createBindGroupLayoutWebGPU() not implemented")}_createBindGroupWebGPU(e,i,n,o,d){throw new Error("_createBindGroupWebGPU() not implemented")}_supportsDebugGPUTime(){return this.features.has("timestamp-query")&&!!(this.props.debug||this.props.debugGPUTime)}_enableDebugGPUTime(e=256){if(!this._supportsDebugGPUTime())return null;if(this._debugGPUTimeQuery)return this._debugGPUTimeQuery;try{this._debugGPUTimeQuery=this.createQuerySet({type:"timestamp",count:e}),this.commandEncoder=this.createCommandEncoder({id:this.commandEncoder.props.id,timeProfilingQuerySet:this._debugGPUTimeQuery})}catch{this._debugGPUTimeQuery=null}return this._debugGPUTimeQuery}_disableDebugGPUTime(){this._debugGPUTimeQuery&&(this.commandEncoder.getTimeProfilingQuerySet()===this._debugGPUTimeQuery&&(this.commandEncoder=this.createCommandEncoder({id:this.commandEncoder.props.id})),this._debugGPUTimeQuery.destroy(),this._debugGPUTimeQuery=null)}_isDebugGPUTimeEnabled(){return this._debugGPUTimeQuery!==null}getCanvasContext(){return this.getDefaultCanvasContext()}readPixelsToArrayWebGL(e,i){throw new Error("not implemented")}readPixelsToBufferWebGL(e,i){throw new Error("not implemented")}setParametersWebGL(e){throw new Error("not implemented")}getParametersWebGL(e){throw new Error("not implemented")}withParametersWebGL(e,i){throw new Error("not implemented")}clearWebGL(e){throw new Error("not implemented")}resetWebGL(){throw new Error("not implemented")}getModuleData(e){var i;return(i=this._moduleData)[e]||(i[e]={}),this._moduleData[e]}static _getCanvasContextProps(e){return e.createCanvasContext===!0?{}:e.createCanvasContext}_getDeviceTextureFormatCapabilities(e){const i=al.getCapabilities(e),n=d=>
1410(typeof d=="string"?this.features.has(d):d)??!0,o=n(i.create);return{format:e,create:o,render:o&&n(i.render),filter:o&&n(i.filter),blend:o&&n(i.blend),store:o&&n(i.store)}}_normalizeBufferProps(e){(e instanceof ArrayBuffer||ArrayBuffer.isView(e))&&(e={data:e});const i={...e};if((e.usage||0)&En.INDEX&&(e.indexType||(e.data instanceof Uint32Array?i.indexType="uint32":e.data instanceof Uint16Array?i.indexType="uint16":e.data instanceof Uint8Array&&(i.data=new Uint16Array(e.data),i.indexType="uint16")),!i.indexType))throw new Error("indices buffer content must be of type uint16 or uint32");return i}};Y(Uy,"defaultProps",{id:null,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,createCanvasContext:void 0,webgl:{},onError:(e,i)=>{},onResize:(e,i)=>{const[n,o]=e.getDevicePixelSize();at.log(1,`${e} resized => ${n}x${o}px`)()},onPositionChange:(e,i)=>{const[n,o]=e.getPosition();at.log(1,`${e} repositioned => ${n},${o}`)()},onVisibilityChange:e=>at.log(1,`${e} Visibility changed ${e.isVisible}`)(),onDevicePixelRatioChange:(e,i)=>at.log(1,`${e} DPR changed ${i.oldRatio} => ${e.devicePixelRatio}`)(),debug:sI(),debugGPUTime:!1,debugShaders:at.get("debug-shaders")||void 0,debugFramebuffers:!!at.get("debug-framebuffers"),debugFactories:!!at.get("debug-factories"),debugWebGL:!!at.get("debug-webgl"),debugSpectorJS:void 0,debugSpectorJSUrl:void 0,_reuseDevices:!1,_requestMaxLimits:!0,_cacheShaders:!0,_destroyShaders:!1,_cachePipelines:!0,_sharePipelines:!0,_destroyPipelines:!1,_initializeFeatures:!0,_disabledFeatures:{"compilation-status-async-webgl":!0},_handle:void 0});let Id=Uy;function rI(t,e){return t!=null?!!t:e!==void 0?e!=="production":!1}function sI(){return rI(at.get("debug"),aI())}function aI(){const t=globalThis.process;if(t!=null&&t.env)return t.env.NODE_ENV}const oI="set luma.log.level=1 (or higher) to trace rendering",j1="No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.",og=class og{constructor(){Y(this,"stats",KS);Y(this,"log",at);Y(this,"VERSION","9.3.6");Y(this,"spector");Y(this,"preregisteredAdapters",new Map);if(globalThis.luma){if(globalThis.luma.VERSION!==this.VERSION)throw at.error(`Found luma.gl ${globalThis.luma.VERSION} while initialzing ${this.VERSION}`)(),at.error("'yarn why @luma.gl/core' can help identify the source of the conflict")(),new Error("luma.gl - multiple versions detected: see console log");at.error("This version of luma.gl has already been initialized")()}at.log(1,`${this.VERSION} - ${oI}`)(),globalThis.luma=this}async createDevice(e={}){const i={...og.defaultProps,...e},n=this.selectAdapter(i.type,i.adapters);if(!n)throw new Error(j1);return i.waitForPageLoad&&await n.pageLoaded,await n.create(i)}async attachDevice(e,i){var d;const n=this._getTypeFromHandle(e,i.adapters),o=n&&this.selectAdapter(n,i.adapters);if(!o)throw new Error(j1);return await((d=o==null?void 0:o.attach)==null?void 0:d.call(o,e,i))}registerAdapters(e){for(const i of e)this.preregisteredAdapters.set(i.type,i)}getSupportedAdapters(e=[]){const i=this._getAdapterMap(e);return Array.from(i).map(([,n])=>n).filter(n=>{var o;return(o=n.isSupported)==null?void 0:o.call(n)}).map(n=>n.type)}getBestAvailableAdapterType(e=[]){var o,d;const i=["webgpu","webgl","null"],n=this._getAdapterMap(e);for(const p of i)if((d=(o=n.get(p))==null?void 0:o.isSupported)!=null&&d.call(o))return p;return null}selectAdapter(e,i=[]){let n=e;e==="best-available"&&(n=this.getBestAvailableAdapterType(i));const o=this._getAdapterMap(i);return n&&o.get(n)||null}enforceWebGL2(e=!0,i=[]){var d;const o=this._getAdapterMap(i).get("webgl");o||at.warn("enforceWebGL2: webgl adapter not found")(),(d=o==null?void 0:o.enforceWebGL2)==null||d.call(o,e)}setDefaultDeviceProps(e){Object.assign(og.defaultProps,e)}_getAdapterMap(e=[]){const i=new Map(this.preregisteredAdapters);for(const n of e)i.set(n.type,n);return i}_getTypeFromHandle(e,i=[]){return e instanceof WebGL2RenderingContext?"webgl":typeof GPUDevice<"u"&&e instanceof GPUDevice||e!=null&&e.queue?"webgpu":e===null?"null":(e instanceof WebGLRenderingContext?at.warn("WebGL1 is not supported",e)():at.warn("Unknown handle type",e)(),null)}};Y(og,"defaultProps",{...Id.defaultProps,type:"best-available",adapters:void 0,waitForPageLoad:!0});let Qb=og;const Jb=new Qb;class lI{get pageLoaded(){return hI()}}const cI=zd()&&typeof document<"u",uI=()=>cI&&document.readyState==="complete";let L_=null;function hI(){return L_||(uI()||typeof window>"u"?L_=Promise.resolve():L_=new Promise(t=>window.addEventListener("load",()=>t()))),L_}class dI{constructor(e){Y(this,"props");Y(this,"_resizeObserver");Y(this,"_intersectionObserver");Y(this,"_observeDevicePixelRatioTimeout",null);Y(this,"_observeDevicePixelRatioMediaQuery",null);Y(this,"_handleDevicePixelRatioChange",()=>this._refreshDevicePixelRatio());Y(this,"_trackPositionInterval",null);Y(this,"_started",!1);this.props=e}get started(){return this._started}
1410start(){if(this._started||!this.props.canvas)return;this._started=!0,this._intersectionObserver||(this._intersectionObserver=new IntersectionObserver(i=>this.props.onIntersection(i))),this._resizeObserver||(this._resizeObserver=new ResizeObserver(i=>this.props.onResize(i))),this._intersectionObserver.observe(this.props.canvas);const e=this.props.resizeObserverBox;try{this._resizeObserver.observe(this.props.canvas,{box:e})}catch{this._resizeObserver.observe(this.props.canvas,{box:"content-box"})}this._observeDevicePixelRatioTimeout=setTimeout(()=>this._refreshDevicePixelRatio(),0),this.props.trackPosition&&this._trackPosition()}stop(){var e,i;this._started&&(this._started=!1,this._observeDevicePixelRatioTimeout&&(clearTimeout(this._observeDevicePixelRatioTimeout),this._observeDevicePixelRatioTimeout=null),this._observeDevicePixelRatioMediaQuery&&(this._observeDevicePixelRatioMediaQuery.removeEventListener("change",this._handleDevicePixelRatioChange),this._observeDevicePixelRatioMediaQuery=null),this._trackPositionInterval&&(clearInterval(this._trackPositionInterval),this._trackPositionInterval=null),(e=this._resizeObserver)==null||e.disconnect(),(i=this._intersectionObserver)==null||i.disconnect())}_refreshDevicePixelRatio(){var e;this._started&&(this.props.onDevicePixelRatioChange(),(e=this._observeDevicePixelRatioMediaQuery)==null||e.removeEventListener("change",this._handleDevicePixelRatioChange),this._observeDevicePixelRatioMediaQuery=matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`),this._observeDevicePixelRatioMediaQuery.addEventListener("change",this._handleDevicePixelRatioChange,{once:!0}))}_trackPosition(e=100){this._trackPositionInterval||(this._trackPositionInterval=setInterval(()=>{this._started?this.props.onPositionChange():this._trackPositionInterval&&(clearInterval(this._trackPositionInterval),this._trackPositionInterval=null)},e))}}function fI(){let t,e;return{promise:new Promise((n,o)=>{t=n,e=o}),resolve:t,reject:e}}function i2(t,e){var i;if(!t){const n=new Error(e??"luma.gl assertion failed.");throw(i=Error.captureStackTrace)==null||i.call(Error,n,i2),n}}function xy(t,e){return i2(t,e),t}const ep=class ep{constructor(e){Y(this,"id");Y(this,"props");Y(this,"canvas");Y(this,"htmlCanvas");Y(this,"offscreenCanvas");Y(this,"type");Y(this,"initialized");Y(this,"isInitialized",!1);Y(this,"isVisible",!0);Y(this,"cssWidth");Y(this,"cssHeight");Y(this,"devicePixelRatio");Y(this,"devicePixelWidth");Y(this,"devicePixelHeight");Y(this,"drawingBufferWidth");Y(this,"drawingBufferHeight");Y(this,"_initializedResolvers",fI());Y(this,"_canvasObserver");Y(this,"_position",[0,0]);Y(this,"destroyed",!1);Y(this,"_needsDrawingBufferResize",!0);var i,n;this.props={...ep.defaultProps,...e},e=this.props,this.initialized=this._initializedResolvers.promise,zd()?e.canvas?typeof e.canvas=="string"?this.canvas=mI(e.canvas):this.canvas=e.canvas:this.canvas=gI(e):this.canvas={width:e.width||1,height:e.height||1},ep.isHTMLCanvas(this.canvas)?(this.id=e.id||this.canvas.id,this.type="html-canvas",this.htmlCanvas=this.canvas):ep.isOffscreenCanvas(this.canvas)?(this.id=e.id||"offscreen-canvas",this.type="offscreen-canvas",this.offscreenCanvas=this.canvas):(this.id=e.id||"node-canvas-context",this.type="node"),this.cssWidth=((i=this.htmlCanvas)==null?void 0:i.clientWidth)||this.canvas.width,this.cssHeight=((n=this.htmlCanvas)==null?void 0:n.clientHeight)||this.canvas.height,this.devicePixelWidth=this.canvas.width,this.devicePixelHeight=this.canvas.height,this.drawingBufferWidth=this.canvas.width,this.drawingBufferHeight=this.canvas.height,this.devicePixelRatio=globalThis.devicePixelRatio||1,this._position=[0,0],this._canvasObserver=new dI({canvas:this.htmlCanvas,trackPosition:this.props.trackPosition,resizeObserverBox:this.props.pixelSizeSource==="css-dpr"?"content-box":"device-pixel-content-box",onResize:o=>this._handleResize(o),onIntersection:o=>this._handleIntersection(o),onDevicePixelRatioChange:()=>this._observeDevicePixelRatio(),onPositionChange:()=>this.updatePosition()})}static isHTMLCanvas(e){return typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement}static isOffscreenCanvas(e){return typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas}toString(){return`${this[Symbol.toStringTag]}(${this.id})`}destroy(){this.destroyed||(this.destroyed=!0,this._stopObservers(),this.device=null)}setProps(e){return"useDevicePixels"in e&&(this.props.useDevicePixels=e.useDevicePixels||!1,this._updateDrawingBufferSize()),this}getCurrentFramebuffer(e){return this._resizeDrawingBufferIfNeeded(),this._getCurrentFramebuffer(e)}getCSSSize(){return[this.cssWidth,this.cssHeight]}getPosition(){return this._position}getDevicePixelSize(){return[this.devicePixelWidth,this.devicePixelHeight]}getDrawingBufferSize(){return[this.drawingBufferWidth,this.drawingBufferHeight]}getMaxDrawingBufferSize(){const e=this.device.limits.maxTextureDimension2D;return[e,e]}setDrawingBufferSize(e,i){e=Math.floor(e),i=Math.floor(i),!(this.drawingBufferWidth===e&&this.drawingBufferHeight===i)&&(this.drawingBufferWidth=e,this.drawingBufferHeight=i,this._needsDrawingBufferResize=!0)}getDevicePixelRatio(){return typeof window<"u"&&window.devicePixelRatio||1}cssToDevicePixels(e,i=!0){const n=this.cssToDeviceRatio(),[o,d]=this.getDrawingBufferSize();return _I(e,n,o,d,i)}getPixelSize(){return this.getDevicePixelSize()}getAspect(){const[e,i]=this.getDrawingBufferSize();return e>0&&i>0?e/i:1}cssToDeviceRatio(){try{const[e]=this.getDrawingBufferSize(),[i]=this.getCSSSize();return i?e/i:1}catch{return 1}}resize(e){this.setDrawingBufferSize(e.width,e.height)}_setAutoCreatedCanvasId(e){var i;((i=this.htmlCanvas)==null?void 0:i.id)==="lumagl-auto-created-canvas"&&(this.htmlCanvas.id=e)}_startObservers(){this.destroyed||this._canvasObserver.start()}_stopObservers(){this._canvasObserver.stop()}_handleIntersection(e){if(this.destroyed)return;const i=e.find(o=>o.target===this.canvas);if(!i)return;const n=i.isIntersecting;this.isVisible!==n&&(this.isVisible=n,this.device.props.onVisibilityChange(this))}_handleResize(e){var d;if(this.destroyed)return;const i=e.find(p=>p.target===this.canvas);if(!i)return;const n=xy((d=i.contentBoxSize)==null?void 0:d[0]);
1410this.cssWidth=n.inlineSize,this.cssHeight=n.blockSize;const o=this.getDevicePixelSize();this._setDevicePixelSize(this._getDevicePixelSizeFromResizeEntry(i)),this._updateDrawingBufferSize(),this.device.props.onResize(this,{oldPixelSize:o})}_updateDrawingBufferSize(){if(this.props.autoResize)if(typeof this.props.useDevicePixels=="number"){const e=this.props.useDevicePixels;this.setDrawingBufferSize(this.cssWidth*e,this.cssHeight*e)}else this.props.useDevicePixels?this.setDrawingBufferSize(this.devicePixelWidth,this.devicePixelHeight):this.setDrawingBufferSize(this.cssWidth,this.cssHeight);this._initializedResolvers.resolve(),this.isInitialized=!0,this.updatePosition()}_getDevicePixelSizeFromResizeEntry(e){var n,o,d,p,h;const i=xy((n=e.contentBoxSize)==null?void 0:n[0]);return this.props.pixelSizeSource==="css-dpr"?this._getDevicePixelSizeFromCSSSize(i.inlineSize,i.blockSize):{devicePixelWidth:((d=(o=e.devicePixelContentBoxSize)==null?void 0:o[0])==null?void 0:d.inlineSize)||i.inlineSize*devicePixelRatio,devicePixelHeight:((h=(p=e.devicePixelContentBoxSize)==null?void 0:p[0])==null?void 0:h.blockSize)||i.blockSize*devicePixelRatio}}_getDevicePixelSizeFromCSSSize(e,i){const n=this.getDevicePixelRatio();return{devicePixelWidth:Math.floor(e*n),devicePixelHeight:Math.floor(i*n)}}_setDevicePixelSize({devicePixelWidth:e,devicePixelHeight:i}){const[n,o]=this.getMaxDrawingBufferSize();this.devicePixelWidth=Math.max(1,Math.min(e,n)),this.devicePixelHeight=Math.max(1,Math.min(i,o))}_resizeDrawingBufferIfNeeded(){this._needsDrawingBufferResize&&(this._needsDrawingBufferResize=!1,(this.drawingBufferWidth!==this.canvas.width||this.drawingBufferHeight!==this.canvas.height)&&(this.canvas.width=this.drawingBufferWidth,this.canvas.height=this.drawingBufferHeight,this._configureDevice()))}_observeDevicePixelRatio(){var i,n;if(this.destroyed||!this._canvasObserver.started)return;const e=this.devicePixelRatio;if(this.devicePixelRatio=window.devicePixelRatio,this.props.pixelSizeSource==="css-dpr"){const o=this.getDevicePixelSize();this._setDevicePixelSize(this._getDevicePixelSizeFromCSSSize(this.cssWidth,this.cssHeight)),this._updateDrawingBufferSize(),this.device.props.onResize(this,{oldPixelSize:o})}this.updatePosition(),(n=(i=this.device.props).onDevicePixelRatioChange)==null||n.call(i,this,{oldRatio:e})}updatePosition(){var i,n,o;if(this.destroyed)return;const e=(i=this.htmlCanvas)==null?void 0:i.getBoundingClientRect();if(e){const d=[e.left,e.top];if(this._position??(this._position=d),d[0]!==this._position[0]||d[1]!==this._position[1]){const h=this._position;this._position=d,(o=(n=this.device.props).onPositionChange)==null||o.call(n,this,{oldPosition:h})}}}};Y(ep,"defaultProps",{id:void 0,canvas:null,width:800,height:600,useDevicePixels:!0,pixelSizeSource:"exact",autoResize:!0,container:null,visible:!0,alphaMode:"opaque",colorSpace:"srgb",trackPosition:!1});let ap=ep;function pI(t){if(typeof t=="string"){const e=document.getElementById(t);if(!e)throw new Error(`${t} is not an HTML element`);return e}return t||document.body}function mI(t){const e=document.getElementById(t);if(!ap.isHTMLCanvas(e))throw new Error("Object is not a canvas element");return e}function gI(t){const{width:e,height:i}=t,n=document.createElement("canvas");n.id=wg("lumagl-auto-created-canvas"),n.width=e||1,n.height=i||1,n.style.width=Number.isFinite(e)?`${e}px`:"100%",n.style.height=Number.isFinite(i)?`${i}px`:"100%",t!=null&&t.visible||(n.style.visibility="hidden");const o=pI((t==null?void 0:t.container)||null);return o.insertBefore(n,o.firstChild),n}function _I(t,e,i,n,o){const d=t,p=V1(d[0],e,i);let h=$1(d[1],e,n,o),A=V1(d[0]+1,e,i);const R=A===i-1?A:A-1;A=$1(d[1]+1,e,n,o);let B;return o?(A=A===0?A:A+1,B=h,h=A):B=A===n-1?A:A-1,{x:p,y:h,width:Math.max(R-p+1,1),height:Math.max(B-h+1,1)}}function V1(t,e,i){return Math.min(Math.round(t*e),i-1)}function $1(t,e,i,n){return n?Math.max(0,i-1-Math.round(t*e)):Math.min(Math.round(t*e),i-1)}class n2 extends ap{}Y(n2,"defaultProps",ap.defaultProps);class yI extends ap{}const lg=class lg extends nn{get[Symbol.toStringTag](){return"Sampler"}constructor(e,i){i=lg.normalizeProps(e,i),super(e,i,lg.defaultProps)}static normalizeProps(e,i){return i}};Y(lg,"defaultProps",{...nn.defaultProps,type:"color-sampler",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",addressModeW:"clamp-to-edge",magFilter:"nearest",minFilter:"nearest",mipmapFilter:"none",lodMinClamp:0,lodMaxClamp:32,compare:"less-equal",maxAnisotropy:1});let op=lg;const vI={"1d":"1d","2d":"2d","2d-array":"2d",cube:"2d","cube-array":"2d","3d":"3d"},er=class er extends nn{constructor(i,n,o){n=er.normalizeProps(i,n);super(i,n,er.defaultProps);Y(this,"dimension");Y(this,"baseDimension");Y(this,"format");Y(this,"width");Y(this,"height");Y(this,"depth");Y(this,"mipLevels");Y(this,"samples");Y(this,"byteAlignment");Y(this,"ready",Promise.resolve(this));Y(this,"isReady",!0);Y(this,"updateTimestamp");if(this.dimension=this.props.dimension,this.baseDimension=vI[this.dimension],this.format=this.props.format,this.width=this.props.width,this.height=this.props.height,this.depth=this.props.depth,this.mipLevels=this.props.mipLevels,this.samples=this.props.samples||1,this.dimension==="cube"&&(this.depth=6),this.props.width===void 0||this.props.height===void 0)if(i.isExternalImage(n.data)){const d=i.getExternalImageSize(n.data);this.width=(d==null?void 0:d.width)||1,this.height=(d==null?void 0:d.height)||1}else this.width=1,this.height=1,(this.props.width===void 0||this.props.height===void 0)&&at.warn(`${this} created with undefined width or height. This is deprecated. Use DynamicTexture instead.`)();this.byteAlignment=(o==null?void 0:o.byteAlignment)||1,this.updateTimestamp=i.incrementTimestamp()}get[Symbol.toStringTag](){return"Texture"}toString(){return`Texture(${this.id},${this.format},${this.width}x${this.height})`}clone(i){return this.device.createTexture({...this.props,...i})}setSampler(i){this.sampler=i instanceof op?i:this.device.createSampler(i)}copyImageData(i){const{data:n,depth:o,...d}=i;this.writeData(n,{...d,depthOrArrayLayers:d.depthOrArrayLayers??o})}computeMemoryLayout(i={}){const n=this._normalizeTextureReadOptions(i),{width:o=this.width,height:d=this.height,depthOrArrayLayers:p=this.depth}=n,{format:h,byteAlignment:A}=this;return al.computeMemoryLayout({format:h,width:o,height:d,depth:p,byteAlignment:A})}readBuffer(i,n){throw new Error("readBuffer not implemented")}readDataAsync(i){throw new Error("readBuffer not implemented")}writeBuffer(i,n){throw new Error("readBuffer not implemented")}writeData(i,n){throw new Error("readBuffer not implemented")}
1410readDataSyncWebGL(i){throw new Error("readDataSyncWebGL not available")}generateMipmapsWebGL(){throw new Error("generateMipmapsWebGL not available")}static normalizeProps(i,n){const o={...n},{width:d,height:p}=o;return typeof d=="number"&&(o.width=Math.max(1,Math.ceil(d))),typeof p=="number"&&(o.height=Math.max(1,Math.ceil(p))),o}_initializeData(i){this.device.isExternalImage(i)?this.copyExternalImage({image:i,width:this.width,height:this.height,depth:this.depth,mipLevel:0,x:0,y:0,z:0,aspect:"all",colorSpace:"srgb",premultipliedAlpha:!1,flipY:!1}):i&&this.copyImageData({data:i,mipLevel:0,x:0,y:0,z:0,aspect:"all"})}_normalizeCopyImageDataOptions(i){const{data:n,depth:o,...d}=i,p=this._normalizeTextureWriteOptions({...d,depthOrArrayLayers:d.depthOrArrayLayers??o});return{data:n,depth:p.depthOrArrayLayers,...p}}_normalizeCopyExternalImageOptions(i){const n=er._omitUndefined(i),o=n.mipLevel??0,d=this._getMipLevelSize(o),p=this.device.getExternalImageSize(i.image),h={...er.defaultCopyExternalImageOptions,...d,...p,...n};return h.width=Math.min(h.width,d.width-h.x),h.height=Math.min(h.height,d.height-h.y),h.depth=Math.min(h.depth,d.depthOrArrayLayers-h.z),h}_normalizeTextureReadOptions(i){const n=er._omitUndefined(i),o=n.mipLevel??0,d=this._getMipLevelSize(o),p={...er.defaultTextureReadOptions,...d,...n};return p.width=Math.min(p.width,d.width-p.x),p.height=Math.min(p.height,d.height-p.y),p.depthOrArrayLayers=Math.min(p.depthOrArrayLayers,d.depthOrArrayLayers-p.z),p}_getSupportedColorReadOptions(i){const n=this._normalizeTextureReadOptions(i),o=al.getInfo(this.format);switch(this._validateColorReadAspect(n),this._validateColorReadFormat(o),this.dimension){case"2d":case"cube":case"cube-array":case"2d-array":case"3d":return n;default:throw new Error(`${this} color readback does not support ${this.dimension} textures`)}}_validateColorReadAspect(i){if(i.aspect!=="all")throw new Error(`${this} color readback only supports aspect 'all'`)}_validateColorReadFormat(i){if(i.compressed)throw new Error(`${this} color readback does not support compressed formats (${this.format})`);switch(i.attachment){case"color":return;case"depth":throw new Error(`${this} color readback does not support depth formats (${this.format})`);case"stencil":throw new Error(`${this} color readback does not support stencil formats (${this.format})`);case"depth-stencil":throw new Error(`${this} color readback does not support depth-stencil formats (${this.format})`);default:throw new Error(`${this} color readback does not support format ${this.format}`)}}_normalizeTextureWriteOptions(i){const n=er._omitUndefined(i),o=n.mipLevel??0,d=this._getMipLevelSize(o),p={...er.defaultTextureWriteOptions,...d,...n};p.width=Math.min(p.width,d.width-p.x),p.height=Math.min(p.height,d.height-p.y),p.depthOrArrayLayers=Math.min(p.depthOrArrayLayers,d.depthOrArrayLayers-p.z);const h=al.computeMemoryLayout({format:this.format,width:p.width,height:p.height,depth:p.depthOrArrayLayers,byteAlignment:this.byteAlignment}),A=h.bytesPerPixel*p.width;if(p.bytesPerRow=n.bytesPerRow??h.bytesPerRow,p.rowsPerImage=n.rowsPerImage??p.height,p.bytesPerRow<A)throw new Error(`bytesPerRow (${p.bytesPerRow}) must be at least ${A} for ${this.format}`);if(p.rowsPerImage<p.height)throw new Error(`rowsPerImage (${p.rowsPerImage}) must be at least ${p.height} for ${this.format}`);const R=this.device.getTextureFormatInfo(this.format).bytesPerPixel;if(R&&p.bytesPerRow%R!==0)throw new Error(`bytesPerRow (${p.bytesPerRow}) must be a multiple of bytesPerPixel (${R}) for ${this.format}`);return p}_getMipLevelSize(i){const n=Math.max(1,this.width>>i),o=this.baseDimension==="1d"?1:Math.max(1,this.height>>i),d=this.dimension==="3d"?Math.max(1,this.depth>>i):this.depth;return{width:n,height:o,depthOrArrayLayers:d}}getAllocatedByteLength(){let i=0;for(let n=0;n<this.mipLevels;n++){const{width:o,height:d,depthOrArrayLayers:p}=this._getMipLevelSize(n);i+=al.computeMemoryLayout({format:this.format,width:o,height:d,depth:p,byteAlignment:1}).byteLength}return i*this.samples}static _omitUndefined(i){return Object.fromEntries(Object.entries(i).filter(([,n])=>n!==void 0))}};Y(er,"SAMPLE",4),Y(er,"STORAGE",8),Y(er,"RENDER",16),Y(er,"COPY_SRC",1),Y(er,"COPY_DST",2),Y(er,"TEXTURE",4),Y(er,"RENDER_ATTACHMENT",16),Y(er,"defaultProps",{...nn.defaultProps,data:null,dimension:"2d",format:"rgba8unorm",usage:er.SAMPLE|er.RENDER|er.COPY_DST,width:void 0,height:void 0,depth:1,mipLevels:1,samples:void 0,sampler:{},view:void 0}),Y(er,"defaultCopyDataOptions",{data:void 0,byteOffset:0,bytesPerRow:void 0,rowsPerImage:void 0,width:void 0,height:void 0,depthOrArrayLayers:void 0,depth:1,mipLevel:0,x:0,y:0,z:0,aspect:"all"}),Y(er,"defaultCopyExternalImageOptions",{image:void 0,sourceX:0,sourceY:0,width:void 0,height:void 0,depth:1,mipLevel:0,x:0,y:0,z:0,aspect:"all",colorSpace:"srgb",premultipliedAlpha:!1,flipY:!1}),Y(er,"defaultTextureReadOptions",{x:0,y:0,z:0,width:void 0,height:void 0,depthOrArrayLayers:1,mipLevel:0,aspect:"all"}),Y(er,"defaultTextureWriteOptions",{byteOffset:0,bytesPerRow:void 0,rowsPerImage:void 0,x:0,y:0,z:0,width:void 0,height:void 0,depthOrArrayLayers:1,mipLevel:0,aspect:"all"});let Dn=er;const jy=class jy extends nn{get[Symbol.toStringTag](){return"TextureView"}constructor(e,i){super(e,i,jy.defaultProps)}};Y(jy,"defaultProps",{...nn.defaultProps,format:void 0,dimension:void 0,aspect:"all",baseMipLevel:0,mipLevelCount:void 0,baseArrayLayer:0,arrayLayerCount:void 0});let wy=jy;function bI(t,e,i){let n="";const o=e.split(/\r?\n/),d=t.slice().sort((p,h)=>p.lineNum-h.lineNum);switch((i==null?void 0:i.showSourceCode)||"no"){case"all":let p=0;for(let h=1;h<=o.length;h++){const A=o[h-1],R=d[p];for(A&&R&&(n+=r2(A,h,i));d.length>p&&R.lineNum===h;){const B=d[p++];B&&(n+=sb(B,o,B.lineNum,{...i,inlineSource:!1}))}}for(;d.length>p;){const h=d[p++];h&&(n+=sb(h,[],0,{...i,inlineSource:!1}))}return n;case"issues":case"no":for(const h of t)n+=sb(h,o,h.lineNum,{inlineSource:(i==null?void 0:i.showSourceCode)!=="no"});return n}}
1410function sb(t,e,i,n){if(n!=null&&n.inlineSource){const d=xI(e,i),p=t.linePos>0?`${" ".repeat(t.linePos+5)}^^^ 1411`:"";return` 1412${d}${p}${t.type.toUpperCase()}: ${t.message} 1413 1414`}const o=t.type==="error"?"red":"orange";return n!=null&&n.html?`<div class='luma-compiler-log-${t.type}' style="color:${o};"><b> ${t.type.toUpperCase()}: ${t.message}</b></div>`:`${t.type.toUpperCase()}: ${t.message}`}function xI(t,e,i){let n="";for(let o=e-2;o<=e;o++){const d=t[o-1];d!==void 0&&(n+=r2(d,e,i))}return n}function r2(t,e,i){const n=i!=null&&i.html?TI(t):t;return`${wI(String(e),4)}: ${n}${i!=null&&i.html?"<br/>":` 1415`}`}function wI(t,e){let i="";for(let n=t.length;n<e;++n)i+=" ";return i+t}function TI(t){return t.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}const Vy=class Vy extends nn{constructor(i,n){n={...n,debugShaders:n.debugShaders||i.props.debugShaders||"errors"};super(i,{id:SI(n),...n},Vy.defaultProps);Y(this,"stage");Y(this,"source");Y(this,"compilationStatus","pending");this.stage=this.props.stage,this.source=this.props.source}get[Symbol.toStringTag](){return"Shader"}getCompilationInfoSync(){return null}getTranslatedSource(){return null}async debugShader(){const i=this.props.debugShaders;switch(i){case"never":return;case"errors":if(this.compilationStatus==="success")return;break}const n=await this.getCompilationInfo();i==="warnings"&&(n==null?void 0:n.length)===0||this._displayShaderLog(n,this.id)}_displayShaderLog(i,n){if(typeof document>"u"||!(document!=null&&document.createElement))return;const o=n,d=`${this.stage} shader "${o}"`,p=bI(i,this.source,{showSourceCode:"all",html:!0}),h=this.getTranslatedSource(),A=document.createElement("div");A.innerHTML=`<h1>Compilation error in ${d}</h1> 1416<div style="display:flex;position:fixed;top:10px;right:20px;gap:2px;"> 1417<button id="copy">Copy source</button><br/> 1418<button id="close">Close</button> 1419</div> 1420<code><pre>${p}</pre></code>`,h&&(A.innerHTML+=`<br /><h1>Translated Source</h1><br /><br /><code><pre>${h}</pre></code>`),A.style.top="0",A.style.left="0",A.style.background="white",A.style.position="fixed",A.style.zIndex="9999",A.style.maxWidth="100vw",A.style.maxHeight="100vh",A.style.overflowY="auto",document.body.appendChild(A);const R=A.querySelector(".luma-compiler-log-error");R==null||R.scrollIntoView(),A.querySelector("button#close").onclick=()=>{A.remove()},A.querySelector("button#copy").onclick=()=>{navigator.clipboard.writeText(this.source)}}};Y(Vy,"defaultProps",{...nn.defaultProps,language:"auto",stage:void 0,source:"",sourceMap:null,entryPoint:"main",debugShaders:void 0});let Ty=Vy;function SI(t){return AI(t.source)||t.id||wg(`unnamed ${t.stage}-shader`)}function AI(t,e="unnamed"){const n=/#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/.exec(t);return(n==null?void 0:n[1])??e}const $y=class $y extends nn{constructor(i,n={}){super(i,n,$y.defaultProps);Y(this,"width");Y(this,"height");this.width=this.props.width,this.height=this.props.height}get[Symbol.toStringTag](){return"Framebuffer"}clone(i){const n=this.colorAttachments.map(d=>d.texture.clone(i)),o=this.depthStencilAttachment&&this.depthStencilAttachment.texture.clone(i);return this.device.createFramebuffer({...this.props,...i,colorAttachments:n,depthStencilAttachment:o})}resize(i){let n=!i;if(i){const[o,d]=Array.isArray(i)?i:[i.width,i.height];n=n||d!==this.height||o!==this.width,this.width=o,this.height=d}n&&(at.log(2,`Resizing framebuffer ${this.id} to ${this.width}x${this.height}`)(),this.resizeAttachments(this.width,this.height))}autoCreateAttachmentTextures(){if(this.props.colorAttachments.length===0&&!this.props.depthStencilAttachment)throw new Error("Framebuffer has noattachments");this.colorAttachments=this.props.colorAttachments.map((n,o)=>{if(typeof n=="string"){const d=this.createColorTexture(n,o);return this.attachResource(d),d.view}return n instanceof Dn?n.view:n});const i=this.props.depthStencilAttachment;if(i)if(typeof i=="string"){const n=this.createDepthStencilTexture(i);this.attachResource(n),this.depthStencilAttachment=n.view}else i instanceof Dn?this.depthStencilAttachment=i.view:this.depthStencilAttachment=i}createColorTexture(i,n){return this.device.createTexture({id:`${this.id}-color-attachment-${n}`,usage:Dn.RENDER_ATTACHMENT,format:i,width:this.width,height:this.height,sampler:{magFilter:"linear",minFilter:"linear"}})}createDepthStencilTexture(i){return this.device.createTexture({id:`${this.id}-depth-stencil-attachment`,usage:Dn.RENDER_ATTACHMENT,format:i,width:this.width,height:this.height})}
1420resizeAttachments(i,n){if(this.colorAttachments.forEach((o,d)=>{const p=o.texture.clone({width:i,height:n});this.destroyAttachedResource(o),this.colorAttachments[d]=p.view,this.attachResource(p.view)}),this.depthStencilAttachment){const o=this.depthStencilAttachment.texture.clone({width:i,height:n});this.destroyAttachedResource(this.depthStencilAttachment),this.depthStencilAttachment=o.view,this.attachResource(o)}this.updateAttachments()}};Y($y,"defaultProps",{...nn.defaultProps,width:1,height:1,colorAttachments:[],depthStencilAttachment:null});let Sy=$y;const Hy=class Hy extends nn{constructor(i,n){super(i,n,Hy.defaultProps);Y(this,"shaderLayout");Y(this,"bufferLayout");Y(this,"linkStatus","pending");Y(this,"hash","");Y(this,"sharedRenderPipeline",null);this.shaderLayout=this.props.shaderLayout,this.bufferLayout=this.props.bufferLayout||[],this.sharedRenderPipeline=this.props._sharedRenderPipeline||null}get[Symbol.toStringTag](){return"RenderPipeline"}get isPending(){var i;return this.linkStatus==="pending"||this.vs.compilationStatus==="pending"||((i=this.fs)==null?void 0:i.compilationStatus)==="pending"}get isErrored(){var i;return this.linkStatus==="error"||this.vs.compilationStatus==="error"||((i=this.fs)==null?void 0:i.compilationStatus)==="error"}};Y(Hy,"defaultProps",{...nn.defaultProps,vs:null,vertexEntryPoint:"vertexMain",vsConstants:{},fs:null,fragmentEntryPoint:"fragmentMain",fsConstants:{},shaderLayout:null,bufferLayout:[],topology:"triangle-list",colorAttachmentFormats:void 0,depthStencilAttachmentFormat:void 0,parameters:{},varyings:void 0,bufferMode:void 0,disableWarnings:!1,_sharedRenderPipeline:void 0,bindings:void 0,bindGroups:void 0});let hh=Hy;class EI extends nn{get[Symbol.toStringTag](){return"SharedRenderPipeline"}constructor(e,i){super(e,i,{...nn.defaultProps,handle:void 0,vs:void 0,fs:void 0,varyings:void 0,bufferMode:void 0})}}const Wy=class Wy extends nn{constructor(i,n){super(i,n,Wy.defaultProps);Y(this,"hash","");Y(this,"shaderLayout");this.shaderLayout=n.shaderLayout}get[Symbol.toStringTag](){return"ComputePipeline"}};Y(Wy,"defaultProps",{...nn.defaultProps,shader:void 0,entryPoint:void 0,constants:{},shaderLayout:void 0});let Ay=Wy;const Xy=class Xy{constructor(e){Y(this,"device");Y(this,"_hashCounter",0);Y(this,"_hashes",{});Y(this,"_renderPipelineCache",{});Y(this,"_computePipelineCache",{});Y(this,"_sharedRenderPipelineCache",{});this.device=e}static getDefaultPipelineFactory(e){const i=e.getModuleData("@luma.gl/core");return i.defaultPipelineFactory||(i.defaultPipelineFactory=new Xy(e)),i.defaultPipelineFactory}get[Symbol.toStringTag](){return"PipelineFactory"}toString(){return`PipelineFactory(${this.device.id})`}createRenderPipeline(e){var p;if(!this.device.props._cachePipelines)return this.device.createRenderPipeline(e);const i={...hh.defaultProps,...e},n=this._renderPipelineCache,o=this._hashRenderPipeline(i);let d=(p=n[o])==null?void 0:p.resource;if(d)n[o].useCount++,this.device.props.debugFactories&&at.log(3,`${this}: ${n[o].resource} reused, count=${n[o].useCount}, (id=${e.id})`)();else{const h=this.device.type==="webgl"&&this.device.props._sharePipelines?this.createSharedRenderPipeline(i):void 0;d=this.device.createRenderPipeline({...i,id:i.id?`${i.id}-cached`:wg("unnamed-cached"),_sharedRenderPipeline:h}),d.hash=o,n[o]={resource:d,useCount:1},this.device.props.debugFactories&&at.log(3,`${this}: ${d} created, count=${n[o].useCount}`)()}return d}createComputePipeline(e){var p;if(!this.device.props._cachePipelines)return this.device.createComputePipeline(e);const i={...Ay.defaultProps,...e},n=this._computePipelineCache,o=this._hashComputePipeline(i);let d=(p=n[o])==null?void 0:p.resource;return d?(n[o].useCount++,this.device.props.debugFactories&&at.log(3,`${this}: ${n[o].resource} reused, count=${n[o].useCount}, (id=${e.id})`)()):(d=this.device.createComputePipeline({...i,id:i.id?`${i.id}-cached`:void 0}),d.hash=o,n[o]={resource:d,useCount:1},this.device.props.debugFactories&&at.log(3,`${this}: ${d} created, count=${n[o].useCount}`)()),d}release(e){if(!this.device.props._cachePipelines){e.destroy();return}const i=this._getCache(e),n=e.hash;i[n].useCount--,i[n].useCount===0?(this._destroyPipeline(e),this.device.props.debugFactories&&at.log(3,`${this}: ${e} released and destroyed`)()):i[n].useCount<0?(at.error(`${this}: ${e} released, useCount < 0, resetting`)(),i[n].useCount=0):this.device.props.debugFactories&&at.log(3,`${this}: ${e} released, count=${i[n].useCount}`)()}createSharedRenderPipeline(e){const i=this._hashSharedRenderPipeline(e);let n=this._sharedRenderPipelineCache[i];return n||(n={resource:this.device._createSharedRenderPipelineWebGL(e),useCount:0},this._sharedRenderPipelineCache[i]=n),n.useCount++,n.resource}releaseSharedRenderPipeline(e){if(!e.sharedRenderPipeline)return;const i=this._hashSharedRenderPipeline(e.sharedRenderPipeline.props),n=this._sharedRenderPipelineCache[i];n&&(n.useCount--,n.useCount===0&&(n.resource.destroy(),delete this._sharedRenderPipelineCache[i]))}_destroyPipeline(e){const i=this._getCache(e);return this.device.props._destroyPipelines?(delete i[e.hash],e.destroy(),e instanceof hh&&this.releaseSharedRenderPipeline(e),!0):!1}_getCache(e){let i;if(e instanceof Ay&&(i=this._computePipelineCache),e instanceof hh&&(i=this._renderPipelineCache),!i)throw new Error(`${this}`);
1420if(!i[e.hash])throw new Error(`${this}: ${e} matched incorrect entry`);return i}_hashComputePipeline(e){const{type:i}=this.device,n=this._getHash(e.shader.source),o=this._getHash(JSON.stringify(e.shaderLayout));return`${i}/C/${n}SL${o}`}_hashRenderPipeline(e){const i=e.vs?this._getHash(e.vs.source):0,n=e.fs?this._getHash(e.fs.source):0,o=this._getWebGLVaryingHash(e),d=this._getHash(JSON.stringify(e.shaderLayout)),p=this._getHash(JSON.stringify(e.bufferLayout)),{type:h}=this.device;switch(h){case"webgl":const A=this._getHash(JSON.stringify(e.parameters));return`${h}/R/${i}/${n}V${o}T${e.topology}P${A}SL${d}BL${p}`;case"webgpu":default:const R=this._getHash(JSON.stringify({vertexEntryPoint:e.vertexEntryPoint,fragmentEntryPoint:e.fragmentEntryPoint})),B=this._getHash(JSON.stringify(e.parameters)),N=this._getWebGPUAttachmentHash(e);return`${h}/R/${i}/${n}V${o}T${e.topology}EP${R}P${B}SL${d}BL${p}A${N}`}}_hashSharedRenderPipeline(e){const i=e.vs?this._getHash(e.vs.source):0,n=e.fs?this._getHash(e.fs.source):0,o=this._getWebGLVaryingHash(e);return`webgl/S/${i}/${n}V${o}`}_getHash(e){return this._hashes[e]===void 0&&(this._hashes[e]=this._hashCounter++),this._hashes[e]}_getWebGLVaryingHash(e){const{varyings:i=[],bufferMode:n=null}=e;return this._getHash(JSON.stringify({varyings:i,bufferMode:n}))}_getWebGPUAttachmentHash(e){var o;const i=e.colorAttachmentFormats??[this.device.preferredColorFormat],n=(o=e.parameters)!=null&&o.depthWriteEnabled?e.depthStencilAttachmentFormat||this.device.preferredDepthF
1420ormat:null;return this._getHash(JSON.stringify({colorAttachmentFormats:i,depthStencilAttachmentFormat:n}))}};Y(Xy,"defaultProps",{...hh.defaultProps});let e0=Xy;const qy=class qy{constructor(e){Y(this,"device");Y(this,"_cache",{});this.device=e}static getDefaultShaderFactory(e){const i=e.getModuleData("@luma.gl/core");return i.defaultShaderFactory||(i.defaultShaderFactory=new qy(e)),i.defaultShaderFactory}get[Symbol.toStringTag](){return"ShaderFactory"}toString(){return`${this[Symbol.toStringTag]}(${this.device.id})`}createShader(e){if(!this.device.props._cacheShaders)return this.device.createShader(e);const i=this._hashShader(e);let n=this._cache[i];if(n)n.useCount++,this.device.props.debugFactories&&at.log(3,`${this}: Reusing shader ${n.resource.id} count=${n.useCount}`)();else{const o=this.device.createShader({...e,id:e.id?`${e.id}-cached`:void 0});this._cache[i]=n={resource:o,useCount:1},this.device.props.debugFactories&&at.log(3,`${this}: Created new shader ${o.id}`)()}return n.resource}release(e){if(!this.device.props._cacheShaders){e.destroy();return}const i=this._hashShader(e),n=this._cache[i];if(n)if(n.useCount--,n.useCount===0)this.device.props._destroyShaders&&(delete this._cache[i],n.resource.destroy(),this.device.props.debugFactories&&at.log(3,`${this}: Releasing shader ${e.id}, destroyed`)());else{if(n.useCount<0)throw new Error(`ShaderFactory: Shader ${e.id} released too many times`);this.device.props.debugFactories&&at.log(3,`${this}: Releasing shader ${e.id} count=${n.useCount}`)()}}_hashShader(e){return`${e.stage}:${e.source}`}};Y(qy,"defaultProps",{...Ty.defaultProps});let t0=qy;function CI(t,e,i){const n=t.bindings.find(o=>o.name===e||`${o.name.toLocaleLowerCase()}uniforms`===e.toLocaleLowerCase());return n||at.warn(`Binding ${e} not set: Not found in shader layout.`)(),n||null}function s2(t,e){if(!e)return{};if(RI(e))return Object.fromEntries(Object.entries(e).map(([o,d])=>[Number(o),{...d}]));const i={};for(const[n,o]of Object.entries(e)){const d=CI(t,n),p=(d==null?void 0:d.group)??0;i[p]||(i[p]={}),i[p][n]=o}return i}function H1(t){const e={};for(const i of Object.values(t))Object.assign(e,i);return e}function RI(t){const e=Object.keys(t);return e.length>0&&e.every(i=>/^\d+$/.test(i))}const nl=class nl extends nn{get[Symbol.toStringTag](){return"RenderPass"}constructor(e,i){i=nl.normalizeProps(e,i),super(e,i,nl.defaultProps)}static normalizeProps(e,i){return i}};Y(nl,"defaultClearColor",[0,0,0,1]),Y(nl,"defaultClearDepth",1),Y(nl,"defaultClearStencil",0),Y(nl,"defaultProps",{...nn.defaultProps,framebuffer:null,parameters:void 0,clearColor:nl.defaultClearColor,clearColors:void 0,clearDepth:nl.defaultClearDepth,clearStencil:nl.defaultClearStencil,depthReadOnly:!1,stencilReadOnly:!1,discard:!1,occlusionQuerySet:void 0,timestampQuerySet:void 0,beginTimestampIndex:void 0,endTimestampIndex:void 0});let i0=nl;const Zy=class Zy extends nn{constructor(i,n){super(i,n,Zy.defaultProps);Y(this,"_timeProfilingQuerySet",null);Y(this,"_timeProfilingSlotCount",0);Y(this,"_gpuTimeMs");this._timeProfilingQuerySet=n.timeProfilingQuerySet??null,this._timeProfilingSlotCount=0,this._gpuTimeMs=void 0}get[Symbol.toStringTag](){return"CommandEncoder"}async resolveTimeProfilingQuerySet(){if(this._gpuTimeMs=void 0,!this._timeProfilingQuerySet)return;const i=Math.floor(this._timeProfilingSlotCount/2);if(i<=0)return;const n=i*2,o=await this._timeProfilingQuerySet.readResults({firstQuery:0,queryCount:n});let d=0n;for(let p=0;p<n;p+=2)d+=o[p+1]-o[p];this._gpuTimeMs=Number(d)/1e6}getTimeProfilingSlotCount(){return this._timeProfilingSlotCount}getTimeProfilingQuerySet(){return this._timeProfilingQuerySet}_applyTimeProfilingToPassProps(i){const n=i||{};if(!this._supportsTimestampQueries()||!this._timeProfilingQuerySet||n.timestampQuerySet!==void 0||n.beginTimestampIndex!==void 0||n.endTimestampIndex!==void 0)return n;const o=this._timeProfilingSlotCount;return o+1>=this._timeProfilingQuerySet.props.count?n:(this._timeProfilingSlotCount+=2,{...n,timestampQuerySet:this._timeProfilingQuerySet,beginTimestampIndex:o,endTimestampIndex:o+1})}_supportsTimestampQueries(){return this.device.features.has("timestamp-query")}};Y(Zy,"defaultProps",{...nn.defaultProps,measureExecutionTime:void 0,timeProfilingQuerySet:void 0});let n0=Zy;const Yy=class Yy extends nn{get[Symbol.toStringTag](){return"CommandBuffer"}constructor(e,i){super(e,i,Yy.defaultProps)}};Y(Yy,"defaultProps",{...nn.defaultProps});let r0=Yy;function ox(t){const e=lx(t),i=BI[e];
1420if(!i)throw new Error(`Unsupported variable shader type: ${t}`);return i}function MI(t){const e=a2(t),i=kI[e];if(!i)throw new Error(`Unsupported attribute shader type: ${t}`);const[n,o]=i,d=n==="i32"||n==="u32",p=n!=="u32",h=OI[n]*o;return{primitiveType:n,components:o,byteLength:h,integer:d,signed:p}}class PI{getVariableShaderTypeInfo(e){return ox(e)}getAttributeShaderTypeInfo(e){return MI(e)}makeShaderAttributeType(e,i){return II(e,i)}resolveAttributeShaderTypeAlias(e){return a2(e)}resolveVariableShaderTypeAlias(e){return lx(e)}}function II(t,e){return e===1?t:`vec${e}<${t}>`}function a2(t){return NI[t]||t}function lx(t){return zI[t]||t}const DI=new PI,OI={f32:4,f16:2,i32:4,u32:4},kI={f32:["f32",1],"vec2<f32>":["f32",2],"vec3<f32>":["f32",3],"vec4<f32>":["f32",4],f16:["f16",1],"vec2<f16>":["f16",2],"vec3<f16>":["f16",3],"vec4<f16>":["f16",4],i32:["i32",1],"vec2<i32>":["i32",2],"vec3<i32>":["i32",3],"vec4<i32>":["i32",4],u32:["u32",1],"vec2<u32>":["u32",2],"vec3<u32>":["u32",3],"vec4<u32>":["u32",4]},BI={f32:{type:"f32",components:1},f16:{type:"f16",components:1},i32:{type:"i32",components:1},u32:{type:"u32",components:1},"vec2<f32>":{type:"f32",components:2},"vec3<f32>":{type:"f32",components:3},"vec4<f32>":{type:"f32",components:4},"vec2<f16>":{type:"f16",components:2},"vec3<f16>":{type:"f16",components:3},"vec4<f16>":{type:"f16",components:4},"vec2<i32>":{type:"i32",components:2},"vec3<i32>":{type:"i32",components:3},"vec4<i32>":{type:"i32",components:4},"vec2<u32>":{type:"u32",components:2},"vec3<u32>":{type:"u32",components:3},"vec4<u32>":{type:"u32",components:4},"mat2x2<f32>":{type:"f32",components:4},"mat2x3<f32>":{type:"f32",components:6},"mat2x4<f32>":{type:"f32",components:8},"mat3x2<f32>":{type:"f32",components:6},"mat3x3<f32>":{type:"f32",components:9},"mat3x4<f32>":{type:"f32",components:12},"mat4x2<f32>":{type:"f32",components:8},"mat4x3<f32>":{type:"f32",components:12},"mat4x4<f32>":{type:"f32",components:16},"mat2x2<f16>":{type:"f16",components:4},"mat2x3<f16>":{type:"f16",components:6},"mat2x4<f16>":{type:"f16",components:8},"mat3x2<f16>":{type:"f16",components:6},"mat3x3<f16>":{type:"f16",components:9},"mat3x4<f16>":{type:"f16",components:12},"mat4x2<f16>":{type:"f16",components:8},"mat4x3<f16>":{type:"f16",components:12},"mat4x4<f16>":{type:"f16",components:16},"mat2x2<i32>":{type:"i32",components:4},"mat2x3<i32>":{type:"i32",components:6},"mat2x4<i32>":{type:"i32",components:8},"mat3x2<i32>":{type:"i32",components:6},"mat3x3<i32>":{type:"i32",components:9},"mat3x4<i32>":{type:"i32",components:12},"mat4x2<i32>":{type:"i32",components:8},"mat4x3<i32>":{type:"i32",components:12},"mat4x4<i32>":{type:"i32",components:16},"mat2x2<u32>":{type:"u32",components:4},"mat2x3<u32>":{type:"u32",components:6},"mat2x4<u32>":{type:"u32",components:8},"mat3x2<u32>":{type:"u32",components:6},"mat3x3<u32>":{type:"u32",components:9},"mat3x4<u32>":{type:"u32",components:12},"mat4x2<u32>":{type:"u32",components:8},"mat4x3<u32>":{type:"u32",components:12},"mat4x4<u32>":{type:"u32",components:16}},NI={vec2i:"vec2<i32>",vec3i:"vec3<i32>",vec4i:"vec4<i32>",vec2u:"vec2<u32>",vec3u:"vec3<u32>",vec4u:"vec4<u32>",vec2f:"vec2<f32>",vec3f:"vec3<f32>",vec4f:"vec4<f32>",vec2h:"vec2<f16>",vec3h:"vec3<f16>",vec4h:"vec4<f16>"},zI={vec2i:"vec2<i32>",vec3i:"vec3<i32>",vec4i:"vec4<i32>",vec2u:"vec2<u32>",vec3u:"vec3<u32>",vec4u:"vec4<u32>",vec2f:"vec2<f32>",vec3f:"vec3<f32>",vec4f:"vec4<f32>",vec2h:"vec2<f16>",vec3h:"vec3<f16>",vec4h:"vec4<f16>",mat2x2f:"mat2x2<f32>",mat2x3f:"mat2x3<f32>",mat2x4f:"mat2x4<f32>",mat3x2f:"mat3x2<f32>",mat3x3f:"mat3x3<f32>",mat3x4f:"mat3x4<f32>",mat4x2f:"mat4x2<f32>",mat4x3f:"mat4x3<f32>",mat4x4f:"mat4x4<f32>",mat2x2i:"mat2x2<i32>",mat2x3i:"mat2x3<i32>",mat2x4i:"mat2x4<i32>",mat3x2i:"mat3x2<i32>",mat3x3i:"mat3x3<i32>",mat3x4i:"mat3x4<i32>",mat4x2i:"mat4x2<i32>",mat4x3i:"mat4x3<i32>",mat4x4i:"mat4x4<i32>",mat2x2u:"mat2x2<u32>",mat2x3u:"mat2x3<u32>",mat2x4u:"mat2x4<u32>",mat3x2u:"mat3x2<u32>",mat3x3u:"mat3x3<u32>",mat3x4u:"mat3x4<u32>",mat4x2u:"mat4x2<u32>",mat4x3u:"mat4x3<u32>",mat4x4u:"mat4x4<u32>",mat2x2h:"mat2x2<f16>",mat2x3h:"mat2x3<f16>
1420",mat2x4h:"mat2x4<f16>",mat3x2h:"mat3x2<f16>",mat3x3h:"mat3x3<f16>",mat3x4h:"mat3x4<f16>",mat4x2h:"mat4x2<f16>",mat4x3h:"mat4x3<f16>",mat4x4h:"mat4x4<f16>"};function o2(t,e){const i={};for(const n of t.attributes){const o=FI(t,e,n.name);o&&(i[n.name]=o)}return i}function LI(t,e,i=16){const n=o2(t,e),o=new Array(i).fill(null);for(const d of Object.values(n))o[d.location]=d;return o}function FI(t,e,i){const n=UI(t,i),o=jI(e,i);if(!n)return null;const d=DI.getAttributeShaderTypeInfo(n.type),p=fg.getCompatibleVertexFormat(d),h=(o==null?void 0:o.vertexFormat)||p,A=fg.getVertexFormatInfo(h);return{attributeName:(o==null?void 0:o.attributeName)||n.name,bufferName:(o==null?void 0:o.bufferName)||n.name,location:n.location,shaderType:n.type,primitiveType:d.primitiveType,shaderComponents:d.components,vertexFormat:h,bufferDataType:A.type,bufferComponents:A.components,normalized:A.normalized,integer:d.integer,stepMode:(o==null?void 0:o.stepMode)||n.stepMode||"vertex",byteOffset:(o==null?void 0:o.byteOffset)||0,byteStride:(o==null?void 0:o.byteStride)||0}}function UI(t,e){const i=t.attributes.find(n=>n.name===e);return i||at.warn(`shader layout attribute "${e}" not present in shader`),i||null}function jI(t,e){VI(t);let i=$I(t,e);return i||(i=HI(t,e),i)?i:(at.warn(`layout for attribute "${e}" not present in buffer layout`),null)}function VI(t){for(const e of t)(e.attributes&&e.format||!e.attributes&&!e.format)&&at.warn(`BufferLayout ${name} must have either 'attributes' or 'format' field`)}function $I(t,e){for(const i of t)if(i.format&&i.name===e)return{attributeName:i.name,bufferName:e,stepMode:i.stepMode,vertexFormat:i.format,byteOffset:0,byteStride:i.byteStride||0};return null}function HI(t,e){var i;for(const n of t){let o=n.byteStride;if(typeof n.byteStride!="number")for(const p of n.attributes||[]){const h=fg.getVertexFormatInfo(p.format);o+=h.byteLength}const d=(i=n.attributes)==null?void 0:i.find(p=>p.attribute===e);if(d)return{attributeName:d.attribute,bufferName:n.name,stepMode:n.stepMode,vertexFormat:d.format,byteOffset:d.byteOffset,byteStride:o}}return null}const Gy=class Gy extends nn{constructor(i,n){super(i,n,Gy.defaultProps);Y(this,"maxVertexAttributes");Y(this,"attributeInfos");Y(this,"indexBuffer",null);Y(this,"attributes");this.maxVertexAttributes=i.limits.maxVertexAttributes,this.attributes=new Array(this.maxVertexAttributes).fill(null),this.attributeInfos=LI(n.shaderLayout,n.bufferLayout,this.maxVertexAttributes)}get[Symbol.toStringTag](){return"VertexArray"}setConstantWebGL(i,n){this.device.reportError(new Error("constant attributes not supported"),this)()}};Y(Gy,"defaultProps",{...nn.defaultProps,shaderLayout:void 0,bufferLayout:[]});let s0=Gy;const Ky=class Ky extends nn{get[Symbol.toStringTag](){return"TransformFeedback"}constructor(e,i){super(e,i,Ky.defaultProps)}};Y(Ky,"defaultProps",{...nn.defaultProps,layout:void 0,buffers:{}});let a0=Ky;const Qy=class Qy extends nn{get[Symbol.toStringTag](){return"QuerySet"}constructor(e,i){super(e,i,Qy.defaultProps)}};Y(Qy,"defaultProps",{...nn.defaultProps,type:void 0,count:void 0});let o0=Qy;const Jy=class Jy extends nn{get[Symbol.toStringTag](){return"Fence"}constructor(e,i={}){super(e,i,Jy.defaultProps)}};Y(Jy,"defaultProps",{...nn.defaultProps});let l0=Jy;function Vc(t,e){switch(e){case 1:return t;case 2:return t+t%2;default:return t+(4-t%4)%4}}function l2(t){const[,,,,e]=WI[t];return e}const WI={uint8:["uint8","u32",1,!1,Uint8Array],sint8:["sint8","i32",1,!1,Int8Array],unorm8:["uint8","f32",1,!0,Uint8Array],snorm8:["sint8","f32",1,!0,Int8Array],uint16:["uint16","u32",2,!1,Uint16Array],sint16:["sint16","i32",2,!1,Int16Array],unorm16:["uint16","u32",2,!0,Uint16Array],snorm16:["sint16","i32",2,!0,Int16Array],float16:["float16","f16",2,!1,Uint16Array],float32:["float32","f32",4,!1,Float32Array],uint32:["uint32","u32",4,!1,Uint32Array],sint32:["sint32","i32",4,!1,Int32Array]};function XI(t,e={}){const i={...t},n=e.layout??"std140",o={};let d=0;for(const[p,h]of Object.entries(i))d=c0(o,p,h,d,n);return d=Vc(d,_h(i,n)),{layout:n,byteLength:d*4,uniformTypes:i,fields:o}}function cv(t,e){const i=lx(t),n=ox(i),o=/^mat(\d)x(\d)<.+>$/.exec(i);if(o){const p=Number(o[1]),h=Number(o[2]),A=W1(h,i,n.type),R=ZI(A.size,A.alignment,e);return{alignment:A.alignment,size:p*R,components:p*h,columns:p,rows:h,columnStride:R,shaderType:i,type:n.type}}const d=/^vec(\d)<.+>$/.exec(i);return d?W1(Number(d[1]),i,n.type):{alignment:1,size:1,components:1,columns:1,rows:1,columnStride:1,shaderType:i,type:n.type}}function c2(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}function c0(t,e,i,n,o){if(typeof i=="string"){const d=cv(i,o),p=Vc(n,d.alignment);return t[e]={offset:p,...d},p+d.size}if(Array.isArray(i)){if(Array.isArray(i[0]))throw new Error(`Nested arrays are not supported for ${e}`);const d=i[0],p=i[1],h=h2(d,o),A=Vc(n,_h(i,o));for(let R=0;R<p;R++)c0(t,`${e}[${R}]`,d,A+R*h,o);return A+h*p}if(c2(i)){const d=_h(i,o);let p=Vc(n,d);for(const[h,A]of Object.entries(i))p=c0(t,`${e}.${h}`,A,p,o);return Vc(p,d)}throw new Error(`Unsupported CompositeShaderType for ${e}`)}function u2(t,e){if(typeof t=="string")return cv(t,e).size;if(Array.isArray(t)){const n=t[0],o=t[1];if(Array.isArray(n))throw new Error("Nested arrays are not supported");return h2(n,e)*o}let i=0;for(const n of Object.values(t)){const o=n;i=Vc(i,_h(o,e)),i+=u2(o,e)}return Vc(i,_h(t,e))}function _h(t,e){if(typeof t=="string")return cv(t,e).alignment;if(Array.isArray(t)){const n=t[0],o=_h(n,e);return d2(e)?Math.max(o,4):o}let i=1;for(const n of Object.values(t)){const o=_h(n,e);i=Math.max(i,o)}return YI(e)?Math.max(i,4):i}function W1(t,e,i,n){return{alignment:t===2?2:4,size:t===3?3:t,components:t,columns:1,rows:t,columnStride:t===3?3:t,shaderType:e,type:i}}function h2(t,e){const i=u2(t,e),n=_h(t,e);return qI(i,n,e)}
1420function qI(t,e,i){return Vc(t,d2(i)?4:e)}function ZI(t,e,i){return i==="std140"?4:Vc(t,e)}function d2(t){return t==="std140"||t==="wgsl-uniform"}function YI(t){return t==="std140"||t==="wgsl-uniform"}let F_;function f2(t){return(!F_||F_.byteLength<t)&&(F_=new ArrayBuffer(t)),F_}function GI(t,e){const i=f2(t.BYTES_PER_ELEMENT*e);return new t(i,0,e)}function KI(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Ey(t){return Array.isArray(t)?t.length===0||typeof t[0]=="number":KI(t)}class QI{constructor(e){Y(this,"layout");this.layout=e}has(e){return!!this.layout.fields[e]}get(e){const i=this.layout.fields[e];return i?{offset:i.offset,size:i.size}:void 0}getFlatUniformValues(e){const i={};for(const[n,o]of Object.entries(e)){const d=this.layout.uniformTypes[n];d?this._flattenCompositeValue(i,n,d,o):this.layout.fields[n]&&(i[n]=o)}return i}getData(e){const i=f2(this.layout.byteLength);new Uint8Array(i,0,this.layout.byteLength).fill(0);const n={i32:new Int32Array(i),u32:new Uint32Array(i),f32:new Float32Array(i),f16:new Uint16Array(i)},o=this.getFlatUniformValues(e);for(const[d,p]of Object.entries(o))this._writeLeafValue(n,d,p);return new Uint8Array(i,0,this.layout.byteLength)}_flattenCompositeValue(e,i,n,o){if(o!==void 0){if(typeof n=="string"||this.layout.fields[i]){e[i]=o;return}if(Array.isArray(n)){const d=n[0],p=n[1];if(Array.isArray(d))throw new Error(`Nested arrays are not supported for ${i}`);if(typeof d=="string"&&Ey(o)){this._flattenPackedArray(e,i,d,p,o);return}if(!Array.isArray(o)){at.warn(`Unsupported uniform array value for ${i}:`,o)();return}for(let h=0;h<Math.min(o.length,p);h++){const A=o[h];A!==void 0&&this._flattenCompositeValue(e,`${i}[${h}]`,d,A)}return}if(c2(n)&&JI(o)){for(const[d,p]of Object.entries(o)){if(p===void 0)continue;const h=`${i}.${d}`;this._flattenCompositeValue(e,h,n[d],p)}return}at.warn(`Unsupported uniform value for ${i}:`,o)()}}_flattenPackedArray(e,i,n,o,d){const p=d,A=cv(n,this.layout.layout).components;for(let R=0;R<o;R++){const B=R*A;if(B>=p.length)break;A===1?e[`${i}[${R}]`]=Number(p[B]):e[`${i}[${R}]`]=eD(d,B,B+A)}}_writeLeafValue(e,i,n){const o=this.layout.fields[i];if(!o){at.warn(`Uniform ${i} not found in layout`)();return}const{type:d,components:p,columns:h,rows:A,offset:R,columnStride:B}=o,N=e[d];if(p===1){N[R]=Number(n);return}const F=n;if(h===1){for(let re=0;re<p;re++)N[R+re]=Number(F[re]??0);return}let Q=0;for(let re=0;re<h;re++){const se=R+re*B;for(let ae=0;ae<A;ae++)N[se+ae]=Number(F[Q++]??0)}}}function JI(t){return!!t&&typeof t=="object"&&!Array.isArray(t)&&!ArrayBuffer.isView(t)}function eD(t,e,i){return Array.prototype.slice.call(t,e,i)}const tD=128;function iD(t,e,i=16){if(t===e)return!0;const n=t,o=e;if(!Ey(n)||!Ey(o)||n.length!==o.length)return!1;const d=Math.min(i,tD);if(n.length>d)return!1;for(let p=0;p<n.length;++p)if(o[p]!==n[p])return!1;return!0}function nD(t){return Ey(t)?t.slice():t}class rD{constructor(e){Y(this,"name");Y(this,"uniforms",{});Y(this,"modifiedUniforms",{});Y(this,"modified",!0);Y(this,"bindingLayout",{});Y(this,"needsRedraw","initialized");var i;if(this.name=(e==null?void 0:e.name)||"unnamed",e!=null&&e.name&&(e!=null&&e.shaderLayout)){const n=(i=e==null?void 0:e.shaderLayout.bindings)==null?void 0:i.find(d=>d.type==="uniform"&&d.name===(e==null?void 0:e.name));if(!n)throw new Error(e==null?void 0:e.name);const o=n;for(const d of o.uniforms||[])this.bindingLayout[d.name]=d}}setUniforms(e){for(const[i,n]of Object.entries(e))this._setUniform(i,n),this.needsRedraw||this.setNeedsRedraw(`${this.name}.${i}=${n}`)}setNeedsRedraw(e){this.needsRedraw=this.needsRedraw||e}getAllUniforms(){return this.modifiedUniforms={},this.needsRedraw=!1,this.uniforms||{}}_setUniform(e,i){iD(this.uniforms[e],i)||(this.uniforms[e]=nD(i),this.modifiedUniforms[e]=!0,this.modified=!0)}}const sD=1024;class aD{constructor(e,i){Y(this,"device");Y(this,"uniformBlocks",new Map);Y(this,"shaderBlockLayouts",new Map);Y(this,"shaderBlockWriters",new Map);Y(this,"uniformBuffers",new Map);this.device=e;for(const[n,o]of Object.entries(i)){const d=n,p=XI(o.uniformTypes??{},{layout:o.layout??oD(e)}),h=new QI(p);this.shaderBlockLayouts.set(d,p),this.shaderBlockWriters.set(d,h);const A=new rD({name:n});A.setUniforms(h.getFlatUniformValues(o.defaultUniforms||{})),this.uniformBlocks.set(d,A)}}destroy(){for(const e of this.uniformBuffers.values())e.destroy()}setUniforms(e){var i;for(const[n,o]of Object.entries(e)){const d=n,p=this.shaderBlockWriters.get(d),h=p==null?void 0:p.getFlatUniformValues(o||{});(i=this.uniformBlocks.get(d))==null||i.setUniforms(h||{})}this.updateUniformBuffers()}getUniformBufferByteLength(e){var n;const i=((n=this.shaderBlockLayouts.get(e))==null?void 0:n.byteLength)||0;return Math.max(i,sD)}getUniformBufferData(e){var o;const i=((o=this.uniformBlocks.get(e))==null?void 0:o.getAllUniforms())||{},n=this.shaderBlockWriters.get(e);return(n==null?void 0:n.getData(i))||new Uint8Array(0)}createUniformBuffer(e,i){i&&this.setUniforms(i);const n=this.getUniformBufferByteLength(e),o=this.device.createBuffer({usage:En.UNIFORM|En.COPY_DST,byteLength:n}),d=this.getUniformBufferData(e);return o.write(d),o}getManagedUniformBuffer(e){if(!this.uniformBuffers.get(e)){const i=this.getUniformBufferByteLength(e),n=this.device.createBuffer({usage:En.UNIFORM|En.COPY_DST,byteLength:i});this.uniformBuffers.set(e,n)}return this.uniformBuffers.get(e)}updateUniformBuffers(){let e=!1;for(const i of this.uniformBlocks.keys()){const n=this.updateUniformBuffer(i);e||(e=n)}return e&&at.log(3,`UniformStore.updateUniformBuffers(): ${e}`)(),e}updateUniformBuffer(e){var d;const i=this.uniformBlocks.get(e);let n=this.uniformBuffers.get(e),o=!1;if(n&&(i!=null&&i.needsRedraw)){o||(o=i.needsRedraw);const p=this.getUniformBufferData(e);n=this.uniformBuffers.get(e),n==null||n.write(p);const h=(d=this.uniformBlocks.get(e))==null?void 0:d.getAllUniforms();at.log(4,`Writing to uniform buffer ${String(e)}`,p,h)()}return o}}function oD(t){return t.type==="webgpu"?"wgsl-uniform":"std140"}const lD=`struct LayerUniforms { 1421 opacity: f32, 1422}; 1423 1424@group(0) @binding(auto) 1425var<uniform> layer: LayerUniforms; 1426`,X1=`layout(std140) uniform layerUniforms { 1427 uniform float opacity; 1428} layer; 1429`,cD={name:"layer",source:lD,vs:X1,fs:X1,getUniforms:t=>({opacity:Math.pow(t.opacity,1/2.2)}),uniformTypes:{opacity:"f32"}},uD=` 1430 1431@must_use 1432fn deckgl_premultiplied_alpha(fragColor: vec4<f32>) -> vec4<f32> { 1433 return vec4(fragColor.rgb * fragColor.a, fragColor.a); 1434}; 1435`,hD={name:"color",dependencies:[],source:uD,getUniforms:t=>({})},dD=`const SMOOTH_EDGE_RADIUS: f32 = 0.5; 1436 1437struct VertexGeometry { 1438 position: vec4<f32>, 1439 worldPosition: vec3<f32>, 1440 worldPositionAlt: vec3<f32>, 1441 normal: vec3<f32>, 1442 uv: vec2<f32>, 1443 pickingColor: vec3<f32>, 1444}; 1445 1446var<private> geometry_: VertexGeometry = VertexGeometry( 1447 vec4<f32>(0.0, 0.0, 1.0, 0.0), 1448 vec3<f32>(0.0, 0.0, 0.0), 1449 vec3<f32>(0.0, 0.0, 0.0), 1450 vec3<f32>(0.0, 0.0, 0.0), 1451 vec2<f32>(0.0, 0.0), 1452 vec3<f32>(0.0, 0.0, 0.0) 1453); 1454 1455struct FragmentGeometry { 1456 uv: vec2<f32>, 1457}; 1458 1459var<private> fragmentGeometry: FragmentGeometry; 1460 1461fn smoothedge(edge: f32, x: f32) -> f32 { 1462 return smoothstep(edge - SMOOTH_EDGE_RADIUS, edge + SMOOTH_EDGE_RADIUS, x); 1463} 1464`,p2="#define SMOOTH_EDGE_RADIUS 0.5",fD=`${p2} 1465 1466struct VertexGeometry { 1467 vec4 position; 1468 vec3 worldPosition; 1469 vec3 worldPositionAlt; 1470 vec3 normal; 1471 vec2 uv; 1472 vec3 pickingColor; 1473} geometry = VertexGeometry( 1474 vec4(0.0, 0.0, 1.0, 0.0), 1475 vec3(0.0), 1476 vec3(0.0), 1477 vec3(0.0), 1478 vec2(0.0), 1479 vec3(0.0) 1480); 1481`,pD=`${p2} 1482 1483struct FragmentGeometry { 1484 vec2 uv; 1485} geometry; 1486 1487float smoothedge(float edge, float x) { 1488 return smoothstep(edge - SMOOTH_EDGE_RADIUS, edge + SMOOTH_EDGE_RADIUS, x); 1489} 1490`,m2={name:"geometry",source:dD,vs:fD,fs:pD},mD=25;var Wr;(function(t){t[t.Start=1]="Start",t[t.Move=2]="Move",t[t.End=4]="End",t[t.Cancel=8]="Cancel"})(Wr||(Wr={}));var es;(function(t){t[t.None=0]="None",t[t.Left=1]="Left",t[t.Right=2]="Right",t[t.Up=4]="Up",t[t.Down=8]="Down",t[t.Horizontal=3]="Horizontal",t[t.Vertical=12]="Vertical",t[t.All=15]="All"})(es||(es={}));var Ii;(function(t){t[t.Possible=1]="Possible",t[t.Began=2]="Began",t[t.Changed=4]="Changed",t[t.Ended=8]="Ended",t[t.Recognized=8]="Recognized",t[t.Cancelled=16]="Cancelled",t[t.Failed=32]="Failed"})(Ii||(Ii={}));const gD="compute",_D="auto",u0="manipulation",sy="none",h0="pan-x",d0="pan-y";function yD(t){if(t.includes(sy))return sy;const e=t.includes(h0),i=t.includes(d0);return e&&i?sy:e||i?e?h0:d0:t.includes(u0)?u0:_D}class vD{constructor(e,i){this.actions="",this.manager=e,this.set(i)}set(e){e===gD&&(e=this.compute()),this.manager.element&&(this.manager.element.style.touchAction=e,this.actions=e)}update(){this.set(this.manager.options.touchAction)}compute(){let e=[];for(const i of this.manager.recognizers)i.options.enable&&(e=e.concat(i.getTouchAction()));return yD(e.join(" "))}}function Cy(t){return t.trim().split(/\s+/g)}
1490function ab(t,e,i){if(t)for(const n of Cy(e))t.addEventListener(n,i,!1)}function ob(t,e,i){if(t)for(const n of Cy(e))t.removeEventListener(n,i,!1)}function q1(t){return(t.ownerDocument||t).defaultView}function bD(t,e){let i=t;for(;i;){if(i===e)return!0;i=i.parentNode}return!1}function g2(t){const e=t.length;if(e===1)return{x:Math.round(t[0].clientX),y:Math.round(t[0].clientY)};let i=0,n=0,o=0;for(;o<e;)i+=t[o].clientX,n+=t[o].clientY,o++;return{x:Math.round(i/e),y:Math.round(n/e)}}function Z1(t){const e=[];let i=0;for(;i<t.pointers.length;)e[i]={clientX:Math.round(t.pointers[i].clientX),clientY:Math.round(t.pointers[i].clientY)},i++;return{timeStamp:Date.now(),pointers:e,center:g2(e),deltaX:t.deltaX,deltaY:t.deltaY}}function _2(t,e){const i=e.x-t.x,n=e.y-t.y;return Math.sqrt(i*i+n*n)}function Y1(t,e){const i=e.clientX-t.clientX,n=e.clientY-t.clientY;return Math.sqrt(i*i+n*n)}function xD(t,e){const i=e.x-t.x,n=e.y-t.y;return Math.atan2(n,i)*180/Math.PI}function G1(t,e){const i=e.clientX-t.clientX,n=e.clientY-t.clientY;return Math.atan2(n,i)*180/Math.PI}function y2(t,e){return t===e?es.None:Math.abs(t)>=Math.abs(e)?t<0?es.Left:es.Right:e<0?es.Up:es.Down}function wD(t,e){const i=e.center;let n=t.offsetDelta,o=t.prevDelta;const d=t.prevInput;return(e.eventType===Wr.Start||(d==null?void 0:d.eventType)===Wr.End)&&(o=t.prevDelta={x:(d==null?void 0:d.deltaX)||0,y:(d==null?void 0:d.deltaY)||0},n=t.offsetDelta={x:i.x,y:i.y}),{deltaX:o.x+(i.x-n.x),deltaY:o.y+(i.y-n.y)}}function v2(t,e,i){return{x:e/t||0,y:i/t||0}}function TD(t,e){return Y1(e[0],e[1])/Y1(t[0],t[1])}function SD(t,e){return G1(e[1],e[0])-G1(t[1],t[0])}function AD(t,e){const i=t.lastInterval||e,n=e.timeStamp-i.timeStamp;let o,d,p,h;if(e.eventType!==Wr.Cancel&&(n>mD||i.velocity===void 0)){const A=e.deltaX-i.deltaX,R=e.deltaY-i.deltaY,B=v2(n,A,R);d=B.x,p=B.y,o=Math.abs(B.x)>Math.abs(B.y)?B.x:B.y,h=y2(A,R),t.lastInterval=e}else o=i.velocity,d=i.velocityX,p=i.velocityY,h=i.direction;e.velocity=o,e.velocityX=d,e.velocityY=p,e.direction=h}function ED(t,e){const{session:i}=t,{pointers:n}=e,{length:o}=n;i.firstInput||(i.firstInput=Z1(e)),o>1&&!i.firstMultiple?i.firstMultiple=Z1(e):o===1&&(i.firstMultiple=!1);const{firstInput:d,firstMultiple:p}=i,h=p?p.center:d.center,A=e.center=g2(n);e.timeStamp=Date.now(),e.deltaTime=e.timeStamp-d.timeStamp,e.angle=xD(h,A),e.distance=_2(h,A);const{deltaX:R,deltaY:B}=wD(i,e);e.deltaX=R,e.deltaY=B,e.offsetDirection=y2(e.deltaX,e.deltaY);const N=v2(e.deltaTime,e.deltaX,e.deltaY);e.overallVelocityX=N.x,e.overallVelocityY=N.y,e.overallVelocity=Math.abs(N.x)>Math.abs(N.y)?N.x:N.y,e.scale=p?TD(p.pointers,n):1,e.rotation=p?SD(p.pointers,n):0,e.maxPointers=i.prevInput?e.pointers.length>i.prevInput.maxPointers?e.pointers.length:i.prevInput.maxPointers:e.pointers.length;let F=t.element;return bD(e.srcEvent.target,F)&&(F=e.srcEvent.target),e.target=F,AD(i,e),e}function CD(t,e,i){const n=i.pointers.length,o=i.changedPointers.length,d=e&Wr.Start&&n-o===0,p=e&(Wr.End|Wr.Cancel)&&n-o===0;i.isFirst=!!d,i.isFinal=!!p,d&&(t.session={}),i.eventType=e;const h=ED(t,i);t.emit("hammer.input",h),t.recognize(h),t.session.prevInput=h}let RD=class{constructor(e){this.evEl="",this.evWin="",this.evTarget="",this.domHandler=i=>{this.manager.options.enable&&this.handler(i)},this.manager=e,this.element=e.element,this.target=e.options.inputTarget||e.element}callback(e,i){CD(this.manager,e,i)}init(){ab(this.element,this.evEl,this.domHandler),ab(this.target,this.evTarget,this.domHandler),ab(q1(this.element),this.evWin,this.domHandler)}destroy(){ob(this.element,this.evEl,this.domHandler),ob(this.target,this.evTarget,this.domHandler),ob(q1(this.element),this.evWin,this.domHandler)}};const MD={pointerdown:Wr.Start,pointermove:Wr.Move,pointerup:Wr.End,pointercancel:Wr.Cancel,pointerout:Wr.Cancel},PD="pointerdown",ID="pointermove pointerup pointercancel";class DD extends RD{constructor(e){super(e),this.evEl=PD,this.evWin=ID,this.store=this.manager.session.pointerEvents=[],this.init()}handler(e){const{store:i}=this;let n=!1;const o=MD[e.type],d=e.pointerType,p=d==="touch";let h=i.findIndex(A=>A.pointerId===e.pointerId);o&Wr.Start&&(e.buttons||p)?h<0&&(i.push(e),h=i.length-1):o&(Wr.End|Wr.Cancel)&&(n=!0),!(h<0)&&(i[h]=e,this.callback(o,{pointers:i,changedPointers:[e],eventType:o,pointerType:d,srcEvent:e}),n&&i.splice(h,1))}}const OD=["","webkit","Moz","MS","ms","o"];function kD(t,e){const i=e[0].toUpperCase()+e.slice(1);for(const n of OD){const o=n?n+i:e;if(o in t)return o}}const BD=1,K1=2,Q1={touchAction:"compute",enable:!0,inputTarget:null,cssProps:{userSelect:"none",userDrag:"none",touchCallout:"none",tapHighlightColor:"rgba(0,0,0,0)"}};class ND{constructor(e,i){this.options={...Q1,...i,cssProps:{...Q1.cssProps,...i.cssProps},inputTarget:i.inputTarget||e},this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=e,this.input=new DD(this),this.touchAction=new vD(this,this.options.touchAction),this.toggleCssProps(!0)}set(e){return Object.assign(this.options,e),e.touchAction&&this.touchAction.update(),e.inputTarget&&(this.input.destroy(),this.input.target=e.inputTarget,this.input.init()),this}stop(e){this.session.stopped=e?K1:BD}recognize(e){const{session:i}=this;if(i.stopped)return;this.session.prevented&&e.srcEvent.preventDefault();let n;const{recognizers:o}=this;let{curRecognizer:d}=i;(!d||d&&d.state&Ii.Recognized)&&(d=i.curRecognizer=null);let p=0;for(;p<o.length;)n=o[p],i.stopped!==K1&&(!d||n===d||n.canRecognizeWith(d))?n.recognize(e):n.reset(),!d&&n.state&(Ii.Began|Ii.Changed|Ii.Ended)&&(d=i.curRecognizer=n),p++}get(e){const{recognizers:i}=this;for(let n=0;n<i.length;n++)if(i[n].options.event===e)return i[n];return null}add(e){if(Array.isArray(e)){for(const n of e)this.add(n);return this}const i=this.get(e.options.event);return i&&this.remove(i),this.recognizers.push(e),e.manager=this,this.touchAction.update(),e}remove(e){if(Array.isArray(e)){for(const n of e)this.remove(n);return this}const i=typeof e=="string"?this.get(e):e;if(i){const{recognizers:n}=this,o=n.indexOf(i);o!==-1&&(n.splice(o,1),this.touchAction.update())}return this}on(e,i){if(!e||!i)return;const{handlers:n}=this;for(const o of Cy(e))n[o]=n[o]||[],n[o].push(i)}off(e,i){if(!e)return;const{handlers:n}=this;for(const o of Cy(e))i?n[o]&&n[o].splice(n[o].indexOf(i),1):delete n[o]}emit(e,i){const n=this.handlers[e]&&this.handlers[e].slice();if(!n||!n.length)return;const o=i;o.type=e,o.preventDefault=function(){i.srcEvent.preventDefault()};let d=0;for(;d<n.length;)n[d](o),d++}destroy(){this.toggleCssProps(!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}toggleCssProps(e){const{element:i}=this;if(i){for(const[n,o]of Object.entries(this.options.cssProps)){const d=kD(i.style,n);
vendor: 4,688 bytes, line 1490
1490e?(this.oldCssProps[d]=i.style[d],i.style[d]=o):i.style[d]=this.oldCssProps[d]||""}e||(this.oldCssProps={})}}}let zD=1;function LD(){return zD++}function J1(t){return t&Ii.Cancelled?"cancel":t&Ii.Ended?"end":t&Ii.Changed?"move":t&Ii.Began?"start":""}class b2{constructor(e){this.options=e,this.id=LD(),this.state=Ii.Possible,this.simultaneous={},this.requireFail=[]}set(e){return Object.assign(this.options,e),this.manager.touchAction.update(),this}recognizeWith(e){if(Array.isArray(e)){for(const o of e)this.recognizeWith(o);return this}let i;if(typeof e=="string"){if(i=this.manager.get(e),!i)throw new Error(`Cannot find recognizer ${e}`)}else i=e;const{simultaneous:n}=this;return n[i.id]||(n[i.id]=i,i.recognizeWith(this)),this}dropRecognizeWith(e){if(Array.isArray(e)){for(const n of e)this.dropRecognizeWith(n);return this}let i;return typeof e=="string"?i=this.manager.get(e):i=e,i&&delete this.simultaneous[i.id],this}requireFailure(e){if(Array.isArray(e)){for(const o of e)this.requireFailure(o);return this}let i;if(typeof e=="string"){if(i=this.manager.get(e),!i)throw new Error(`Cannot find recognizer ${e}`)}else i=e;const{requireFail:n}=this;return n.indexOf(i)===-1&&(n.push(i),i.requireFailure(this)),this}dropRequireFailure(e){if(Array.isArray(e)){for(const n of e)this.dropRequireFailure(n);return this}let i;if(typeof e=="string"?i=this.manager.get(e):i=e,i){const n=this.requireFail.indexOf(i);n>-1&&this.requireFail.splice(n,1)}return this}hasRequireFailures(){return!!this.requireFail.find(e=>e.options.enable)}canRecognizeWith(e){return!!this.simultaneous[e.id]}emit(e){if(!e)return;const{state:i}=this;i<Ii.Ended&&this.manager.emit(this.options.event+J1(i),e),this.manager.emit(this.options.event,e),e.additionalEvent&&this.manager.emit(e.additionalEvent,e),i>=Ii.Ended&&this.manager.emit(this.options.event+J1(i),e)}tryEmit(e){this.canEmit()?this.emit(e):this.state=Ii.Failed}canEmit(){let e=0;for(;e<this.requireFail.length;){if(!(this.requireFail[e].state&(Ii.Failed|Ii.Possible)))return!1;e++}return!0}recognize(e){const i={...e};if(!this.options.enable){this.reset(),this.state=Ii.Failed;return}this.state&(Ii.Recognized|Ii.Cancelled|Ii.Failed)&&(this.state=Ii.Possible),this.state=this.process(i),this.state&(Ii.Began|Ii.Changed|Ii.Ended|Ii.Cancelled)&&this.tryEmit(i)}getEventNames(){return[this.options.event]}reset(){}}class x2 extends b2{attrTest(e){const i=this.options.pointers;return i===0||e.pointers.length===i}process(e){const{state:i}=this,{eventType:n}=e,o=i&(Ii.Began|Ii.Changed),d=this.attrTest(e);return o&&(n&Wr.Cancel||!d)?i|Ii.Cancelled:o||d?n&Wr.End?i|Ii.Ended:i&Ii.Began?i|Ii.Changed:Ii.Began:Ii.Failed}}class ew extends b2{constructor(e={}){super({enable:!0,event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10,...e}),this.pTime=null,this.pCenter=null,this._timer=null,this._input=null,this.count=0}getTouchAction(){return[u0]}process(e){const{options:i}=this,n=e.pointers.length===i.pointers,o=e.distance<i.threshold,d=e.deltaTime<i.time;if(this.reset(),e.eventType&Wr.Start&&this.count===0)return this.failTimeout();if(o&&d&&n){if(e.eventType!==Wr.End)return this.failTimeout();const p=this.pTime?e.timeStamp-this.pTime<i.interval:!0,h=!this.pCenter||_2(this.pCenter,e.center)<i.posThreshold;if(this.pTime=e.timeStamp,this.pCenter=e.center,!h||!p?this.count=1:this.count+=1,this._input=e,this.count%i.taps===0)return this.hasRequireFailures()?(this._timer=setTimeout(()=>{this.state=Ii.Recognized,this.tryEmit(this._input)},i.interval),Ii.Began):Ii.Recognized}return Ii.Failed}failTimeout(){return this._timer=setTimeout(()=>{this.state=Ii.Failed},this.options.interval),Ii.Failed}reset(){clearTimeout(this._timer)}emit(e){this.state===Ii.Recognized&&(e.tapCount=this.count,this.manager.emit(this.options.event,e))}}const FD=["","start","move","end","cancel","up","down","left","right"];class tw extends x2{constructor(e={}){super({enable:!0,pointers:1,event:"pan",threshold:10,direction:es.All,...e}),this.pX=null,this.pY=null}getTouchAction(){const{options:{direction:e}}=this,i=[];return e&es.Horizontal&&i.push(d0),e&es.Vertical&&i.push(h0),i}getEventNames(){return FD.map(e=>this.options.event+e)}directionTest(e){const{options:i}=this;let n=!0,{distance:o}=e,{direction:d}=e;const p=e.deltaX,h=e.deltaY;return d&i.direction||(i.direction&es.Horizontal?(d=p===0?es.None:p<0?es.Left:es.Right,n=p!==this.pX,o=Math.abs(e.deltaX)):(d=h===0?es.None:h<0?es.Up:es.Down,n=h!==this.pY,o=Math.abs(e.deltaY))),e.direction=d,n&&o>i.threshold&&!!(d&i.direction)}attrTest(e){return super.attrTest(e)&&(!!(this.state&Ii.Began)||!(this.state&Ii.Began)&&this.directionTest(e))}emit(e){this.pX=e.deltaX,this.pY=e.deltaY;
1490const i=es[e.direction].toLowerCase();i&&(e.additionalEvent=this.options.event+i),super.emit(e)}}const UD=["","start","move","end","cancel","in","out"];class jD extends x2{constructor(e={}){super({enable:!0,event:"pinch",threshold:0,pointers:2,...e})}getTouchAction(){return[sy]}getEventNames(){return UD.map(e=>this.options.event+e)}attrTest(e){return super.attrTest(e)&&(Math.abs(e.scale-1)>this.options.threshold||!!(this.state&Ii.Began))}emit(e){if(e.scale!==1){const i=e.scale<1?"in":"out";e.additionalEvent=this.options.event+i}super.emit(e)}}class uv{constructor(e,i,n){this.element=e,this.callback=i,this.options=n}}const VD=typeof navigator<"u"&&navigator.userAgent?navigator.userAgent.toLowerCase():"",$D=VD.indexOf("firefox")!==-1,iw=4.000244140625,HD=40,WD=.25;class XD extends uv{constructor(e,i,n){super(e,i,{enable:!0,...n}),this.handleEvent=o=>{if(!this.options.enable)return;let d=o.deltaY;globalThis.WheelEvent&&($D&&o.deltaMode===globalThis.WheelEvent.DOM_DELTA_PIXEL&&(d/=globalThis.devicePixelRatio),o.deltaMode===globalThis.WheelEvent.DOM_DELTA_LINE&&(d*=HD)),d!==0&&d%iw===0&&(d=Math.floor(d/iw)),o.shiftKey&&d&&(d=d*WD),this.callback({type:"wheel",center:{x:o.clientX,y:o.clientY},delta:-d,srcEvent:o,pointerType:"mouse",target:o.target})},e.addEventListener("wheel",this.handleEvent,{passive:!1})}destroy(){this.element.removeEventListener("wheel",this.handleEvent)}enableEventType(e,i){e==="wheel"&&(this.options.enable=i)}}const nw=["mousedown","mousemove","mouseup","mouseover","mouseout","mouseleave"];class qD extends uv{constructor(e,i,n){super(e,i,{enable:!0,...n}),this.handleEvent=d=>{this.handleOverEvent(d),this.handleOutEvent(d),this.handleEnterEvent(d),this.handleLeaveEvent(d),this.handleMoveEvent(d)},this.pressed=!1;const{enable:o}=this.options;this.enableMoveEvent=o,this.enableLeaveEvent=o,this.enableEnterEvent=o,this.enableOutEvent=o,this.enableOverEvent=o,nw.forEach(d=>e.addEventListener(d,this.handleEvent))}destroy(){nw.forEach(e=>this.element.removeEventListener(e,this.handleEvent))}enableEventType(e,i){switch(e){case"pointermove":this.enableMoveEvent=i;break;case"pointerover":this.enableOverEvent=i;break;case"pointerout":this.enableOutEvent=i;break;case"pointerenter":this.enableEnterEvent=i;break;case"pointerleave":this.enableLeaveEvent=i;break}}handleOverEvent(e){this.enableOverEvent&&e.type==="mouseover"&&this._emit("pointerover",e)}handleOutEvent(e){this.enableOutEvent&&e.type==="mouseout"&&this._emit("pointerout",e)}handleEnterEvent(e){this.enableEnterEvent&&e.type==="mouseenter"&&this._emit("pointerenter",e)}handleLeaveEvent(e){this.enableLeaveEvent&&e.type==="mouseleave"&&this._emit("pointerleave",e)}handleMoveEvent(e){if(this.enableMoveEvent)switch(e.type){case"mousedown":e.button>=0&&(this.pressed=!0);break;case"mousemove":e.buttons===0&&(this.pressed=!1),this.pressed||this._emit("pointermove",e);break;case"mouseup":this.pressed=!1;break}}_emit(e,i){this.callback({type:e,center:{x:i.clientX,y:i.clientY},srcEvent:i,pointerType:"mouse",target:i.target})}}const rw=["keydown","keyup"];class ZD extends uv{constructor(e,i,n){super(e,i,{enable:!0,tabIndex:0,...n}),this.handleEvent=o=>{const d=o.target||o.srcElement;d.tagName==="INPUT"&&d.type==="text"||d.tagName==="TEXTAREA"||(this.enableDownEvent&&o.type==="keydown"&&this.callback({type:"keydown",srcEvent:o,key:o.key,target:o.target}),this.enableUpEvent&&o.type==="keyup"&&this.callback({type:"keyup",srcEvent:o,key:o.key,target:o.target}))},this.enableDownEvent=this.options.enable,this.enableUpEvent=this.options.enable,e.tabIndex=this.options.tabIndex,e.style.outline="none",rw.forEach(o=>e.addEventListener(o,this.handleEvent))}destroy(){rw.forEach(e=>this.element.removeEventListener(e,this.handleEvent))}enableEventType(e,i){e==="keydown"&&(this.enableDownEvent=i),e==="keyup"&&(this.enableUpEvent=i)}}class YD extends uv{constructor(e,i,n){super(e,i,n),this.handleEvent=o=>{this.options.enable&&this.callback({type:"contextmenu",center:{x:o.clientX,y:o.clientY},srcEvent:o,pointerType:"mouse",target:o.target})},e.addEventListener("contextmenu",this.handleEvent)}destroy(){this.element.removeEventListener("contextmenu",this.handleEvent)}enableEventType(e,i){e==="contextmenu"&&(this.options.enable=i)}}const sw=1,f0=2,aw=4,GD={pointerdown:sw,pointermove:f0,pointerup:aw,mou
1490sedown:sw,mousemove:f0,mouseup:aw},KD=0,QD=1,JD=2,eO=1,tO=2,iO=4;function nO(t){const e=GD[t.srcEvent.type];if(!e)return null;const{buttons:i,button:n}=t.srcEvent;let o=!1,d=!1,p=!1;return e===f0?(o=!!(i&eO),d=!!(i&iO),p=!!(i&tO)):(o=n===KD,d=n===QD,p=n===JD),{leftButton:o,middleButton:d,rightButton:p}}function rO(t,e){const i=t.center;if(!i)return null;const n=e.getBoundingClientRect(),o=n.width/e.offsetWidth||1,d=n.height/e.offsetHeight||1,p={x:(i.x-n.left-e.clientLeft)/o,y:(i.y-n.top-e.clientTop)/d};return{center:i,offsetCenter:p}}const sO={srcElement:"root",priority:0};class aO{constructor(e,i){this.handleEvent=n=>{if(this.isEmpty())return;const o=this._normalizeEvent(n);let d=n.srcEvent.target;for(;d&&d!==o.rootElement;){if(this._emit(o,d),o.handled)return;d=d.parentNode}this._emit(o,"root")},this.eventManager=e,this.recognizerName=i,this.handlers=[],this.handlersByElement=new Map,this._active=!1}isEmpty(){return!this._active}add(e,i,n,o=!1,d=!1){const{handlers:p,handlersByElement:h}=this,A={...sO,...n};let R=h.get(A.srcElement);R||(R=[],h.set(A.srcElement,R));const B={type:e,handler:i,srcElement:A.srcElement,priority:A.priority};o&&(B.once=!0),d&&(B.passive=!0),p.push(B),this._active=this._active||!B.passive;let N=R.length-1;for(;N>=0&&!(R[N].priority>=B.priority);)N--;R.splice(N+1,0,B)}remove(e,i){const{handlers:n,handlersByElement:o}=this;for(let d=n.length-1;d>=0;d--){const p=n[d];if(p.type===e&&p.handler===i){n.splice(d,1);const h=o.get(p.srcElement);h.splice(h.indexOf(p),1),h.length===0&&o.delete(p.srcElement)}}this._active=n.some(d=>!d.passive)}_emit(e,i){const n=this.handlersByElement.get(i);if(n){let o=!1;const d=()=>{e.handled=!0},p=()=>{e.handled=!0,o=!0},h=[];for(let A=0;A<n.length;A++){const{type:R,handler:B,once:N}=n[A];if(B({...e,type:R,stopPropagation:d,stopImmediatePropagation:p}),N&&h.push(n[A]),o)break}for(let A=0;A<h.length;A++){const{type:R,handler:B}=h[A];this.remove(R,B)}}}_normalizeEvent(e){const i=this.eventManager.getElement();return{...e,...nO(e),...rO(e,i),preventDefault:()=>{e.srcEvent.preventDefault()},stopImmediatePropagation:null,stopPropagation:null,handled:!1,rootElement:i}}}function oO(t){if("recognizer"in t)return t;let e;const i=Array.isArray(t)?[...t]:[t];if(typeof i[0]=="function"){const n=i.shift(),o=i.shift()||{};e=new n(o)}else e=i.shift();return{recognizer:e,recognizeWith:typeof i[0]=="string"?[i[0]]:i[0],requireFailure:typeof i[1]=="string"?[i[1]]:i[1]}}class lO{constructor(e=null,i={}){if(this._onBasicInput=n=>{this.manager.emit(n.srcEvent.type,n)},this._onOtherEvent=n=>{this.manager.emit(n.type,n)},this.options={recognizers:[],events:{},touchAction:"compute",tabIndex:0,cssProps:{},...i},this.events=new Map,this.element=e,!!e){this.manager=new ND(e,this.options);for(const n of this.options.recognizers){const{recognizer:o,recognizeWith:d,requireFailure:p}=oO(n);this.manager.add(o),d&&o.recognizeWith(d),p&&o.requireFailure(p)}this.manager.on("hammer.input",this._onBasicInput),this.wheelInput=new XD(e,this._onOtherEvent,{enable:!1}),this.moveInput=new qD(e,this._onOtherEvent,{enable:!1}),this.keyInput=new ZD(e,this._onOtherEvent,{enable:!1,tabIndex:i.tabIndex}),this.contextmenuInput=new YD(e,this._onOtherEvent,{enable:!1}),this.on(this.options.events)}}getElement(){return this.element}destroy(){this.element&&(this.wheelInput.destroy(),this.moveInput.destroy(),this.keyInput.destroy(),this.contextmenuInput.destroy(),this.manager.destroy())}on(e,i,n){this._addEventHandler(e,i,n,!1)}once(e,i,n){this._addEventHandler(e,i,n,!0)}watch(e,i,n){this._addEventHandler(e,i,n,!1,!0)}off(e,i){this._removeEventHandler(e,i)}_toggleRecognizer(e,i){var d,p,h,A;const{manager:n}=this;if(!n)return;const o=n.get(e);o&&(o.set({enable:i}),n.touchAction.update()),(d=this.wheelInput)==null||d.enableEventType(e,i),(p=this.moveInput)==null||p.enableEventType(e,i),(h=this.keyInput)==null||h.enableEventType(e,i),(A=this.contextmenuInput)==null||A.enableEventType(e,i)}_addEventHandler(e,i,n,o,d){if(typeof e!="string"){n=i;for(const[R,B]of Object.entries(e))this._addEventHandler(R,B,n,o,d);return}const{manager:p,events:h}=this;if(!p)return;let A=h.get(e);if(!A){const R=this._getRecognizerName(e)||e;A=new aO(this,R),h.set(e,A),p&&p.on(e,A.handleEvent)}A.add(e,i,n,o,d),A.isEmpty()||this._toggleRecognizer(A.recognizerName,!0)}
1490_removeEventHandler(e,i){if(typeof e!="string"){for(const[d,p]of Object.entries(e))this._removeEventHandler(d,p);return}const{events:n}=this,o=n.get(e);if(o&&(o.remove(e,i),o.isEmpty())){const{recognizerName:d}=o;let p=!1;for(const h of n.values())if(h.recognizerName===d&&!h.isEmpty()){p=!0;break}p||this._toggleRecognizer(d,!1)}}_getRecognizerName(e){var i;return(i=this.manager.recognizers.find(n=>n.getEventNames().includes(e)))==null?void 0:i.options.event}}const Wa={WEB_MERCATOR:1,GLOBE:2,WEB_MERCATOR_AUTO_OFFSET:4,IDENTITY:0},lp={common:0,meters:1,pixels:2},ay={click:"onClick",dblclick:"onClick",panstart:"onDragStart",panmove:"onDrag",panend:"onDragEnd"},ow={multipan:[tw,{threshold:10,direction:es.Vertical,pointers:2}],pinch:[jD,{},null,["multipan"]],pan:[tw,{threshold:1},["pinch"],["multipan"]],dblclick:[ew,{event:"dblclick",taps:2}],click:[ew,{event:"click"},null,["dblclick"]]};function cO(t,e){if(t===e)return!0;if(Array.isArray(t)){const i=t.length;if(!e||e.length!==i)return!1;for(let n=0;n<i;n++)if(t[n]!==e[n])return!1;return!0}return!1}function Tg(t){let e={},i;return n=>{for(const o in n)if(!cO(n[o],e[o])){i=t(n),e=n;break}return i}}const lw=[0,0,0,0],uO=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0],w2=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],hO=[0,0,0],T2=[0,0,0],dO={default:-1,cartesian:0,lnglat:1,"meter-offsets":2,"lnglat-offsets":3};function hv(t){const e=dO[t];if(e===void 0)throw new Error(`Invalid coordinateSystem: ${t}`);return e}const fO=Tg(gO);function S2(t,e,i=T2){i.length<3&&(i=[i[0],i[1],0]);let n=i,o,d=!0;switch(e==="lnglat-offsets"||e==="meter-offsets"?o=i:o=t.isGeospatial?[Math.fround(t.longitude),Math.fround(t.latitude),0]:null,t.projectionMode){case Wa.WEB_MERCATOR:(e==="lnglat"||e==="cartesian")&&(o=[0,0,0],d=!1);break;case Wa.WEB_MERCATOR_AUTO_OFFSET:e==="lnglat"?n=o:e==="cartesian"&&(n=[Math.fround(t.center[0]),Math.fround(t.center[1]),0],o=t.unprojectPosition(n),n[0]-=i[0],n[1]-=i[1],n[2]-=i[2]);break;case Wa.IDENTITY:n=t.position.map(Math.fround),n[2]=n[2]||0;break;case Wa.GLOBE:d=!1,o=null;break;default:d=!1}return{geospatialOrigin:o,shaderCoordinateOrigin:n,offsetMode:d}}function pO(t,e,i){const{viewMatrixUncentered:n,projectionMatrix:o}=t;let{viewMatrix:d,viewProjectionMatrix:p}=t,h=lw,A=lw,R=t.cameraPosition;const{geospatialOrigin:B,shaderCoordinateOrigin:N,offsetMode:F}=S2(t,e,i);return F&&(A=t.projectPosition(B||N),R=[R[0]-A[0],R[1]-A[1],R[2]-A[2]],A[3]=1,h=Tp([],A,p),d=n||d,p=Ad([],o,d),p=Ad([],p,uO)),{viewMatrix:d,viewProjectionMatrix:p,projectionCenter:h,originCommon:A,cameraPosCommon:R,shaderCoordinateOrigin:N,geospatialOrigin:B}}function mO({viewport:t,devicePixelRatio:e=1,modelMatrix:i=null,coordinateSystem:n="default",coordinateOrigin:o=T2,autoWrapLongitude:d=!1}){n==="default"&&(n=t.isGeospatial?"lnglat":"cartesian");const p=fO({viewport:t,devicePixelRatio:e,coordinateSystem:n,coordinateOrigin:o});return p.wrapLongitude=d,p.modelMatrix=i||w2,p}function gO({viewport:t,devicePixelRatio:e,coordinateSystem:i,coordinateOrigin:n}){const{projectionCenter:o,viewProjectionMatrix:d,originCommon:p,cameraPosCommon:h,shaderCoordinateOrigin:A,geospatialOrigin:R}=pO(t,i,n),B=t.getDistanceScales(),N=[t.width*e,t.height*e],F=Tp([],[0,0,-t.focalDistance,1],t.projectionMatrix)[3]||1,Q={coordinateSystem:hv(i),projectionMode:t.projectionMode,coordinateOrigin:A,commonOrigin:p.slice(0,3),center:o,pseudoMeters:!!t._pseudoMeters,viewportSize:N,devicePixelRatio:e,focalDistance:F,commonUnitsPerMeter:B.unitsPerMeter,commonUnitsPerWorldUnit:B.unitsPerMeter,commonUnitsPerWorldUnit2:hO,scale:t.scale,wrapLongitude:!1,viewProjectionMatrix:d,modelMatrix:w2,cameraPosition:h};if(R){const re=t.getDistanceScales(R);switch(i){case"meter-offsets":Q.commonUnitsPerWorldUnit=re.unitsPerMeter,Q.commonUnitsPerWorldUnit2=re.unitsPerMeter2;break;case"lnglat":case"lnglat-offsets":t._pseudoMeters||(Q.commonUnitsPerMeter=re.unitsPerMeter),Q.commonUnitsPerWorldUnit=re.unitsPerDegree,Q.commonUnitsPerWorldUnit2=re.unitsPerDegree2;break;case"cartesian":Q.commonUnitsPerWorldUnit=[1,1,re.unitsPerMeter[2]],Q.commonUnitsPerWorldUnit2=[0,0,re.unitsPerMeter2[2]];break}}return Q}const _O=["default","lnglat","meter-offsets","lnglat-offsets","cartesian"],yO=_O.map(t=>`const COORDINATE_SYSTEM_${t.toUpperCase().replaceAll("-","_")}: i32 = ${hv(t)};`).join(""),vO=Object.keys(Wa).map(t=>`const PROJECTION_MODE_${t}: i32 = ${Wa[t]};`).join(""),bO=Object.keys(lp).map(t=>`const UNIT_${t.toUpperCase()}: i32 = ${lp[t]};`).join(""),xO=`${yO} 1491${vO} 1492${bO} 1493 1494const TILE_SIZE: f32 = 512.0; 1495const PI: f32 = 3.1415926536; 1496const WORLD_SCALE: f32 = TILE_SIZE / (PI * 2.0); 1497const ZERO_64_LOW: vec3<f32> = vec3<f32>(0.0, 0.0, 0.0); 1498const EARTH_RADIUS: f32 = 6370972.0; // meters 1499const GLOBE_RADIUS: f32 = 256.0; 1500 1501// ----------------------------------------------------------------------------- 1502// Uniform block (converted from GLSL uniform block) 1503// ----------------------------------------------------------------------------- 1504struct ProjectUniforms { 1505 wrapLongitude: i32, 1506 coordinateSystem: i32, 1507 commonUnitsPerMeter: vec3<f32>, 1508 projectionMode: i32, 1509 scale: f32, 1510 commonUnitsPerWorldUnit: vec3<f32>, 1511 commonUnitsPerWorldUnit2: vec3<f32>, 1512 center: vec4<f32>, 1513 modelMatrix: mat4x4<f32>, 1514 viewProjectionMatrix: mat4x4<f32>, 1515 viewportSize: vec2<f32>, 1516 devicePixelRatio: f32, 1517 focalDistance: f32, 1518 cameraPosition: vec3<f32>, 1519 coordinateOrigin: vec3<f32>, 1520 commonOrigin: vec3<f32>, 1521 pseudoMeters: i32, 1522}; 1523 1524@group(0) @binding(auto) 1525var<uniform> project: ProjectUniforms; 1526 1527// ----------------------------------------------------------------------------- 1528// Geometry data shared across the project helpers. 1529// The active layer shader is responsible for populating this private module 1530// state before calling the project functions below. 1531// ----------------------------------------------------------------------------- 1532 1533// Structure to carry additional geometry data used by deck.gl filters. 1534struct Geometry { 1535 worldPosition: vec3<f32>, 1536 worldPositionAlt: vec3<f32>, 1537 position: vec4<f32>, 1538 normal: vec3<f32>, 1539 uv: vec2<f32>, 1540 pickingColor: vec3<f32>, 1541}; 1542 1543var<private> geometry: Geometry; 1544`,wO=`${xO} 1545 1546// ----------------------------------------------------------------------------- 1547// Functions 1548// ----------------------------------------------------------------------------- 1549 1550// Returns an adjustment factor for commonUnitsPerMeter 1551fn _project_size_at_latitude(lat: f32) -> f32 { 1552 let y = clamp(lat, -89.9, 89.9); 1553 return 1.0 / cos(radians(y)); 1554} 1555 1556// Overloaded version: scales a value in meters at a given latitude. 1557fn _project_size_at_latitude_m(meters: f32, lat: f32) -> f32 { 1558 return meters * project.commonUnitsPerMeter.z * _project_size_at_latitude(lat); 1559} 1560 1561// Computes a non-linear scale factor based on geometry. 1562// (Note: This function relies on "geometry" being provided.) 1563fn project_size() -> f32 { 1564 if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR && 1565 project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT && 1566 project.pseudoMeters == 0) { 1567 if (geometry.position.w == 0.0) { 1568 return _project_size_at_latitude(geometry.worldPosition.y); 1569 } 1570 let y: f32 = geometry.position.y / TILE_SIZE * 2.0 - 1.0; 1571 let y2 = y * y; 1572 let y4 = y2 * y2; 1573 let y6 = y4 * y2; 1574 return 1.0 + 4.9348 * y2 + 4.0587 * y4 + 1.5642 * y6; 1575 } 1576 return 1.0; 1577} 1578 1579// Overloads to scale offsets (meters to world units) 1580fn project_size_float(meters: f32) -> f32 { 1581 return meters * project.commonUnitsPerMeter.z * project_size(); 1582} 1583 1584fn project_size_vec2(meters: vec2<f32>) -> vec2<f32> { 1585 return meters * project.commonUnitsPerMeter.xy * project_size(); 1586} 1587 1588fn project_size_vec3(meters: vec3<f32>) -> vec3<f32> { 1589 return meters * project.commonUnitsPerMeter * project_size(); 1590} 1591 1592fn project_size_vec4(meters: vec4<f32>) -> vec4<f32> { 1593 return vec4<f32>(meters.xyz * project.commonUnitsPerMeter, meters.w); 1594} 1595 1596// Returns a rotation matrix aligning the zâaxis with the given up vector. 1597fn project_get_orientation_matrix(up: vec3<f32>) -> mat3x3<f32> { 1598 let uz = normalize(up); 1599 let ux = select( 1600 vec3<f32>(1.0, 0.0, 0.0), 1601 normalize(vec3<f32>(uz.y, -uz.x, 0.0)), 1602 abs(uz.z) == 1.0 1603 ); 1604 let uy = cross(uz, ux); 1605 return mat3x3<f32>(ux, uy, uz); 1606} 1607 1608// Since WGSL does not support "out" parameters, we return a struct. 1609struct RotationResult { 1610 needsRotation: bool, 1611 transform: mat3x3<f32>, 1612}; 1613 1614fn project_needs_rotation(commonPosition: vec3<f32>) -> RotationResult { 1615 if (project.projectionMode == PROJECTION_MODE_GLOBE) { 1616 return RotationResult(true, project_get_orientation_matrix(commonPosition)); 1617 } else { 1618 return RotationResult(false, mat3x3<f32>()); // identity alternative if needed 1619 }; 1620} 1621 1622// Projects a normal vector from the current coordinate system to world space. 1623fn project_normal(vector: vec3<f32>) -> vec3<f32> { 1624 let normal_modelspace = project.modelMatrix * vec4<f32>(vector, 0.0); 1625 var n = normalize(normal_modelspace.xyz * project.commonUnitsPerMeter); 1626 let rotResult = project_needs_rotation(geometry.position.xyz); 1627 if (rotResult.needsRotation) { 1628 n = rotResult.transform * n; 1629 } 1630 return n; 1631} 1632 1633// Applies a scale offset based on y-offset (dy) 1634fn project_offset_(offset: vec4<f32>) -> vec4<f32> { 1635 let dy: f32 = offset.y; 1636 let commonUnitsPerWorldUnit = project.commonUnitsPerWorldUnit + project.commonUnitsPerWorldUnit2 * dy; 1637 return vec4<f32>(offset.xyz * commonUnitsPerWorldUnit, offset.w); 1638} 1639 1640// Projects lng/lat coordinates to a unit tile [0,1] 1641fn project_mercator_(lnglat: vec2<f32>) -> vec2<f32> { 1642 var x = lnglat.x; 1643 if (project.wrapLongitude != 0) { 1644 x = ((x + 180.0) % 360.0) - 180.0; 1645 } 1646 let y = clamp(lnglat.y, -89.9, 89.9); 1647 return vec2<f32>( 1648 radians(x) + PI, 1649 PI + log(tan(PI * 0.25 + radians(y) * 0.5)) 1650 ) * WORLD_SCALE; 1651} 1652 1653// Projects lng/lat/z coordinates for a globe projection. 1654fn project_globe_(lnglatz: vec3<f32>) -> vec3<f32> { 1655 let lambda = radians(lnglatz.x); 1656 let phi = radians(lnglatz.y); 1657 let cosPhi = cos(phi); 1658 let D = (lnglatz.z / EARTH_RADIUS + 1.0) * GLOBE_RADIUS; 1659 return vec3<f32>( 1660 sin(lambda) * cosPhi, 1661 -cos(lambda) * cosPhi, 1662 sin(phi) 1663 ) * D; 1664} 1665 1666// Projects positions (with an optional 64-bit low part) from the input 1667// coordinate system to the common space. 1668fn project_position_vec4_f64(position: vec4<f32>, position64Low: vec3<f32>) -> vec4<f32> { 1669 var position_world = project.modelMatrix * position; 1670 1671 // Work around for a Mac+NVIDIA bug: 1672 if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR) { 1673 if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) { 1674 return vec4<f32>( 1675 project_mercator_(position_world.xy), 1676 _project_size_at_latitude_m(position_world.z, position_world.y), 1677 position_world.w 1678 ); 1679 } 1680 if (project.coordinateSystem == COORDINATE_SYSTEM_CARTESIAN) {
1681 position_world = vec4f(position_world.xyz + project.coordinateOrigin, position_world.w); 1682 } 1683 } 1684 if (project.projectionMode == PROJECTION_MODE_GLOBE) { 1685 if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) { 1686 return vec4<f32>( 1687 project_globe_(position_world.xyz), 1688 position_world.w 1689 ); 1690 } 1691 } 1692 if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET) { 1693 if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) { 1694 if (abs(position_world.y - project.coordinateOrigin.y) > 0.25) { 1695 return vec4<f32>( 1696 project_mercator_(position_world.xy) - project.commonOrigin.xy, 1697 project_size_float(position_world.z), 1698 position_world.w 1699 ); 1700 } 1701 } 1702 } 1703 if (project.projectionMode == PROJECTION_MODE_IDENTITY || 1704 (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET && 1705 (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT || 1706 project.coordinateSystem == COORDINATE_SYSTEM_CARTESIAN))) { 1707 position_world = vec4f(position_world.xyz - project.coordinateOrigin, position_world.w); 1708 } 1709 1710 return project_offset_(position_world) + 1711 project_offset_(project.modelMatrix * vec4<f32>(position64Low, 0.0)); 1712} 1713 1714// Overloaded versions for different input types. 1715fn project_position_vec4_f32(position: vec4<f32>) -> vec4<f32> { 1716 return project_position_vec4_f64(position, ZERO_64_LOW); 1717} 1718 1719fn project_position_vec3_f64(position: vec3<f32>, position64Low: vec3<f32>) -> vec3<f32> { 1720 let projected_position = project_position_vec4_f64(vec4<f32>(position, 1.0), position64Low); 1721 return projected_position.xyz; 1722} 1723 1724fn project_position_vec3_f32(position: vec3<f32>) -> vec3<f32> { 1725 let projected_position = project_position_vec4_f64(vec4<f32>(position, 1.0), ZERO_64_LOW); 1726 return projected_position.xyz; 1727} 1728 1729fn project_position_vec2_f32(position: vec2<f32>) -> vec2<f32> { 1730 let projected_position = project_position_vec4_f64(vec4<f32>(position, 0.0, 1.0), ZERO_64_LOW); 1731 return projected_position.xy; 1732} 1733 1734// Transforms a common space position to clip space. 1735fn project_common_position_to_clipspace_with_projection(position: vec4<f32>, viewProjectionMatrix: mat4x4<f32>, center: vec4<f32>) -> vec4<f32> { 1736 return viewProjectionMatrix * position + center; 1737} 1738 1739// Uses the project viewProjectionMatrix and center. 1740fn project_common_position_to_clipspace(position: vec4<f32>) -> vec4<f32> { 1741 return project_common_position_to_clipspace_with_projection(position, project.viewProjectionMatrix, project.center); 1742} 1743 1744// Returns a clip space offset corresponding to a given number of screen pixels. 1745fn project_pixel_size_to_clipspace(pixels: vec2<f32>) -> vec2<f32> { 1746 let offset = pixels / project.viewportSize * project.devicePixelRatio * 2.0; 1747 return offset * project.focalDistance; 1748} 1749 1750fn project_meter_size_to_pixel(meters: f32) -> f32 { 1751 return project_size_float(meters) * project.scale; 1752} 1753 1754fn project_unit_size_to_pixel(size: f32, unit: i32) -> f32 { 1755 if (unit == UNIT_METERS) { 1756 return project_meter_size_to_pixel(size); 1757 } else if (unit == UNIT_COMMON) { 1758 return size * project.scale; 1759 } 1760 // UNIT_PIXELS: no scaling applied. 1761 return size; 1762} 1763 1764fn project_pixel_size_float(pixels: f32) -> f32 { 1765 return pixels / project.scale; 1766} 1767 1768fn project_pixel_size_vec2(pixels: vec2<f32>) -> vec2<f32> { 1769 return pixels / project.scale; 1770} 1771`,TO=["default","lnglat","meter-offsets","lnglat-offsets","cartesian"],SO=TO.map(t=>`const int COORDINATE_SYSTEM_${t.toUpperCase().replaceAll("-","_")} = ${hv(t)};`).join(""),AO=Object.keys(Wa).map(t=>`const int PROJECTION_MODE_${t} = ${Wa[t]};`).join(""),EO=Object.keys(lp).map(t=>`const int UNIT_${t.toUpperCase()} = ${lp[t]};`).join(""),CO=`${SO} 1772${AO} 1773${EO
vendor: 6,166 bytes, lines 1773-1965
1773} 1774layout(std140) uniform projectUniforms { 1775bool wrapLongitude; 1776int coordinateSystem; 1777vec3 commonUnitsPerMeter; 1778int projectionMode; 1779float scale; 1780vec3 commonUnitsPerWorldUnit; 1781vec3 commonUnitsPerWorldUnit2; 1782vec4 center; 1783mat4 modelMatrix; 1784mat4 viewProjectionMatrix; 1785vec2 viewportSize; 1786float devicePixelRatio; 1787float focalDistance; 1788vec3 cameraPosition; 1789vec3 coordinateOrigin; 1790vec3 commonOrigin; 1791bool pseudoMeters; 1792} project; 1793const float TILE_SIZE = 512.0; 1794const float PI = 3.1415926536; 1795const float WORLD_SCALE = TILE_SIZE / (PI * 2.0); 1796const vec3 ZERO_64_LOW = vec3(0.0); 1797const float EARTH_RADIUS = 6370972.0; 1798const float GLOBE_RADIUS = 256.0; 1799float project_size_at_latitude(float lat) { 1800float y = clamp(lat, -89.9, 89.9); 1801return 1.0 / cos(radians(y)); 1802} 1803float project_size() { 1804if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR && 1805project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT && 1806project.pseudoMeters == false) { 1807if (geometry.position.w == 0.0) { 1808return project_size_at_latitude(geometry.worldPosition.y); 1809} 1810float y = geometry.position.y / TILE_SIZE * 2.0 - 1.0; 1811float y2 = y * y; 1812float y4 = y2 * y2; 1813float y6 = y4 * y2; 1814return 1.0 + 4.9348 * y2 + 4.0587 * y4 + 1.5642 * y6; 1815} 1816return 1.0; 1817} 1818float project_size_at_latitude(float meters, float lat) { 1819return meters * project.commonUnitsPerMeter.z * project_size_at_latitude(lat); 1820} 1821float project_size(float meters) { 1822return meters * project.commonUnitsPerMeter.z * project_size(); 1823} 1824vec2 project_size(vec2 meters) { 1825return meters * project.commonUnitsPerMeter.xy * project_size(); 1826} 1827vec3 project_size(vec3 meters) { 1828return meters * project.commonUnitsPerMeter * project_size(); 1829} 1830vec4 project_size(vec4 meters) { 1831return vec4(meters.xyz * project.commonUnitsPerMeter, meters.w); 1832} 1833mat3 project_get_orientation_matrix(vec3 up) { 1834vec3 uz = normalize(up); 1835vec3 ux = abs(uz.z) == 1.0 ? vec3(1.0, 0.0, 0.0) : normalize(vec3(uz.y, -uz.x, 0)); 1836vec3 uy = cross(uz, ux); 1837return mat3(ux, uy, uz); 1838} 1839bool project_needs_rotation(vec3 commonPosition, out mat3 transform) { 1840if (project.projectionMode == PROJECTION_MODE_GLOBE) { 1841transform = project_get_orientation_matrix(commonPosition); 1842return true; 1843} 1844return false; 1845} 1846vec3 project_normal(vec3 vector) { 1847vec4 normal_modelspace = project.modelMatrix * vec4(vector, 0.0); 1848vec3 n = normalize(normal_modelspace.xyz * project.commonUnitsPerMeter); 1849mat3 rotation; 1850if (project_needs_rotation(geometry.position.xyz, rotation)) { 1851n = rotation * n; 1852} 1853return n; 1854} 1855vec4 project_offset_(vec4 offset) { 1856float dy = offset.y; 1857vec3 commonUnitsPerWorldUnit = project.commonUnitsPerWorldUnit + project.commonUnitsPerWorldUnit2 * dy; 1858return vec4(offset.xyz * commonUnitsPerWorldUnit, offset.w); 1859} 1860vec2 project_mercator_(vec2 lnglat) { 1861float x = lnglat.x; 1862if (project.wrapLongitude) { 1863x = mod(x + 180., 360.0) - 180.; 1864} 1865float y = clamp(lnglat.y, -89.9, 89.9); 1866return vec2( 1867radians(x) + PI, 1868PI + log(tan_fp32(PI * 0.25 + radians(y) * 0.5)) 1869) * WORLD_SCALE; 1870} 1871vec3 project_globe_(vec3 lnglatz) { 1872float lambda = radians(lnglatz.x); 1873float phi = radians(lnglatz.y); 1874float cosPhi = cos(phi); 1875float D = (lnglatz.z / EARTH_RADIUS + 1.0) * GLOBE_RADIUS; 1876return vec3( 1877sin(lambda) * cosPhi, 1878-cos(lambda) * cosPhi, 1879sin(phi) 1880) * D; 1881} 1882vec4 project_position(vec4 position, vec3 position64Low) { 1883vec4 position_world = project.modelMatrix * position; 1884if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR) { 1885if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) { 1886return vec4( 1887project_mercator_(position_world.xy), 1888project_size_at_latitude(position_world.z, position_world.y), 1889position_world.w 1890); 1891} 1892if (project.coordinateSystem == COORDINATE_SYSTEM_CARTESIAN) { 1893position_world.xyz += project.coordinateOrigin; 1894} 1895} 1896if (project.projectionMode == PROJECTION_MODE_GLOBE) { 1897if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) { 1898return vec4( 1899project_globe_(position_world.xyz), 1900position_world.w 1901); 1902} 1903} 1904if (project.projectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET) { 1905if (project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT) { 1906if (abs(position_world.y - project.coordinateOrigin.y) > 0.25) { 1907return vec4( 1908project_mercator_(position_world.xy) - project.commonOrigin.xy, 1909project_size(position_world.z), 1910position_world.w 1911); 1912} 1913} 1914} 1915if (project.projectionMode == PROJECTION_MODE_IDENTITY || 1916(project.projectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET && 1917(project.coordinateSystem == COORDINATE_SYSTEM_LNGLAT || 1918project.coordinateSystem == COORDINATE_SYSTEM_CARTESIAN))) { 1919position_world.xyz -= project.coordinateOrigin; 1920} 1921return project_offset_(position_world) + project_offset_(project.modelMatrix * vec4(position64Low, 0.0)); 1922} 1923vec4 project_position(vec4 position) { 1924return project_position(position, ZERO_64_LOW); 1925} 1926vec3 project_position(vec3 position, vec3 position64Low) { 1927vec4 projected_position = project_position(vec4(position, 1.0), position64Low); 1928return projected_position.xyz; 1929} 1930vec3 project_position(vec3 position) { 1931vec4 projected_position = project_position(vec4(position, 1.0), ZERO_64_LOW); 1932return projected_position.xyz; 1933} 1934vec2 project_position(vec2 position) { 1935vec4 projected_position = project_position(vec4(position, 0.0, 1.0), ZERO_64_LOW); 1936return projected_position.xy; 1937} 1938vec4 project_common_position_to_clipspace(vec4 position, mat4 viewProjectionMatrix, vec4 center) { 1939return viewProjectionMatrix * position + center; 1940} 1941vec4 project_common_position_to_clipspace(vec4 position) { 1942return project_common_position_to_clipspace(position, project.viewProjectionMatrix, project.center); 1943} 1944vec2 project_pixel_size_to_clipspace(vec2 pixels) { 1945vec2 offset = pixels / project.viewportSize * project.devicePixelRatio * 2.0; 1946return offset * project.focalDistance; 1947} 1948float project_size_to_pixel(float meters) { 1949return project_size(meters) * project.scale; 1950} 1951vec2 project_size_to_pixel(vec2 meters) { 1952return project_size(meters) * project.scale; 1953} 1954float project_size_to_pixel(float size, int unit) { 1955if (unit == UNIT_METERS) return project_size_to_pixel(size); 1956if (unit == UNIT_COMMON) return size * project.scale; 1957return size; 1958} 1959float project_pixel_size(float pixels) { 1960return pixels / project.scale; 1961} 1962vec2 project_pixel_size(vec2 pixels) { 1963return pixels / project.scale; 1964} 1965`,
1965RO={};function MO(t=RO){return"viewport"in t?mO(t):{}}const cx={name:"project",dependencies:[pP,m2],source:wO,vs:CO,getUniforms:MO,uniformTypes:{wrapLongitude:"f32",coordinateSystem:"i32",commonUnitsPerMeter:"vec3<f32>",projectionMode:"i32",scale:"f32",commonUnitsPerWorldUnit:"vec3<f32>",commonUnitsPerWorldUnit2:"vec3<f32>",center:"vec4<f32>",modelMatrix:"mat4x4<f32>",viewProjectionMatrix:"mat4x4<f32>",viewportSize:"vec2<f32>",devicePixelRatio:"f32",focalDistance:"f32",cameraPosition:"vec3<f32>",coordinateOrigin:"vec3<f32>",commonOrigin:"vec3<f32>",pseudoMeters:"f32"}},PO=`// Define a structure to hold both the clip-space position and the common position. 1966struct ProjectResult { 1967 clipPosition: vec4<f32>, 1968 commonPosition: vec4<f32>, 1969}; 1970 1971// This function mimics the GLSL version with the 'out' parameter by returning both values. 1972fn project_position_to_clipspace_and_commonspace( 1973 position: vec3<f32>, 1974 position64Low: vec3<f32>, 1975 offset: vec3<f32> 1976) -> ProjectResult { 1977 // Compute the projected position. 1978 let projectedPosition: vec3<f32> = project_position_vec3_f64(position, position64Low); 1979 1980 // Start with the provided offset. 1981 var finalOffset: vec3<f32> = offset; 1982 1983 // Get whether a rotation is needed and the rotation matrix. 1984 let rotationResult = project_needs_rotation(projectedPosition); 1985 1986 // If rotation is needed, update the offset. 1987 if (rotationResult.needsRotation) { 1988 finalOffset = rotationResult.transform * offset; 1989 } 1990 1991 // Compute the common position. 1992 let commonPosition: vec4<f32> = vec4<f32>(projectedPosition + finalOffset, 1.0); 1993 1994 // Convert to clip-space. 1995 let clipPosition: vec4<f32> = project_common_position_to_clipspace(commonPosition); 1996 1997 return ProjectResult(clipPosition, commonPosition); 1998} 1999 2000// A convenience overload that returns only the clip-space position. 2001fn project_position_to_clipspace( 2002 position: vec3<f32>, 2003 position64Low: vec3<f32>, 2004 offset: vec3<f32> 2005) -> vec4<f32> { 2006 return project_position_to_clipspace_and_commonspace(position, position64Low, offset).clipPosition; 2007} 2008`,IO=`vec4 project_position_to_clipspace( 2009 vec3 position, vec3 position64Low, vec3 offset, out vec4 commonPosition 2010) { 2011 vec3 projectedPosition = project_position(position, position64Low); 2012 mat3 rotation; 2013 if (project_needs_rotation(projectedPosition, rotation)) { 2014 // offset is specified as ENU 2015 // when in globe projection, rotate offset so that the ground alighs with the surface of the globe 2016 offset = rotation * offset; 2017 } 2018 commonPosition = vec4(projectedPosition + offset, 1.0); 2019 return project_common_position_to_clipspace(commonPosition); 2020} 2021 2022vec4 project_position_to_clipspace( 2023 vec3 position, vec3 position64Low, vec3 offset 2024) { 2025 vec4 commonPosition; 2026 return project_position_to_clipspace(position, position64Low, offset, commonPosition); 2027} 2028`,A2={name:"project32",dependencies:[cx],source:PO,vs:IO};function DO(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function tp(t,e){const i=Tp([],e,t);return YS(i,i,1/i[3]),i}function p0(t,e,i){return t<e?e:t>i?i:t}function OO(t){return Math.log(t)*Math.LOG2E}const E2=Math.log2||OO;function Hc(t,e){if(!t)throw new Error(e||"@math.gl/web-mercator: assertion failed.")}const ol=Math.PI,C2=ol/4,yo=ol/180,m0=180/ol,cp=512,Ry=4003e4,dh=85.051129,kO=1.5;function BO(t){return E2(t)}function up(t){const[e,i]=t;Hc(Number.isFinite(e)),Hc(Number.isFinite(i)&&i>=-90&&i<=90,"invalid latitude");const n=e*yo,o=i*yo,d=cp*(n+ol)/(2*ol),p=cp*(ol+Math.log(Math.tan(C2+o*.5)))/(2*ol);return[d,p]}function hp(t){const[e,i]=t,n=e/cp*(2*ol)-ol,o=2*(Math.atan(Math.exp(i/cp*(2*ol)-ol))-C2);return[n*m0,o*m0]}function NO(t){const{latitude:e}=t;Hc(Number.isFinite(e));const i=Math.cos(e*yo);return BO(Ry*i)-9}function lb(t){const e=Math.cos(t*yo);return cp/Ry/e}function g0(t){const{latitude:e,longitude:i,highPrecision:n=!1}=t;Hc(Number.isFinite(e)&&Number.isFinite(i));const o=cp,d=Math.cos(e*yo),p=o/360,h=p/d,A=o/Ry/d,R={unitsPerMeter:[A,A,A],metersPerUnit:[1/A,1/A,1/A],unitsPerDegree:[p,h,A],degreesPerUnit:[1/p,1/h,1/A]};if(n){const B=yo*Math.tan(e*yo)/d,N=p*B/2,F=o/Ry*B,Q=F/h*A;R.unitsPerDegree2=[0,N,F],R.unitsPerMeter2=[Q,0,Q]}return R}function R2(t,e){const[i,n,o]=t,[d,p,h]=e,{unitsPerMeter:A,unitsPerMeter2:R}=g0({longitude:i,latitude:n,highPrecision:!0}),B=up(t);B[0]+=d*(A[0]+R[0]*p),B[1]+=p*(A[1]+R[1]*p);const N=hp(B),F=(o||0)+(h||0);return Number.isFinite(o)||Number.isFinite(h)?[N[0],N[1],F]:N}function zO(t){const{height:e,pitch:i,bearing:n,altitude:o,scale:d,center:p}=t,h=DO();by(h,h,[0,0,-o]),qS(h,h,-i*yo),ZS(h,h,n*yo);const A=d/e;return sx(h,h,[A,A,A]),p&&by(h,h,IM([],p)),h}function LO(t){const{width:e,height:i,altitude:n,pitch:o=0,offset:d,center:p,scale:h,nearZMultiplier:A=1,farZMultiplier:R=1}=t;let{fovy:B=pg(kO)}=t;n!==void 0&&(B=pg(n));const N=B*yo,F=o*yo,Q=ux(B);let re=Q;p&&(re+=p[2]*h/Math.cos(F)/i);const se=N*(.5+(d?d[1]:0)/i),ae=Math.sin(se)*re/Math.sin(p0(Math.PI/2-F-se,.01,Math.PI-.01)),me=Math.sin(F)*ae+re,we=re*10,ve=Math.min(me*R,we);return{fov:N,aspect:e/i,focalDistance:Q,near:A,far:ve}}function pg(t){return 2*Math.atan(.5/t)*m0}function ux(t){return .5/Math.tan(.5*t*yo)}function M2(t,e){const[i,n,o=0]=t;return Hc(Number.isFinite(i)&&Number.isFinite(n)&&Number.isFinite(o)),tp(e,[i,n,o,1])}function hx(t,e,i=0){const[n,o,d]=t;if(Hc(Number.isFinite(n)&&Number.isFinite(o),"invalid pixel coordinate"),Number.isFinite(d))return tp(e,[n,o,d,1]);const p=tp(e,[n,o,0,1]),h=tp(e,[n,o,1,1]),A=p[2],R=h[2],B=A===R?0:((i||0)-A)/(R-A);return $S([],p,h,B)}function FO(t){const{width:e,height:i,bounds:n,minExtent:o=0,maxZoom:d=24,offset:p=[0,0]}=t,[[h,A],[R,B]]=n,N=UO(t.padding),F=up([h,p0(B,-dh,dh)]),Q=up([R,p0(A,-dh,dh)]),re=[Math.max(Math.abs(Q[0]-F[0]),o),Math.max(Math.abs(Q[1]-F[1]),o)],se=[e-N.left-N.right-Math.abs(p[0])*2,i-N.top-N.bottom-Math.abs(p[1])*2];Hc(se[0]>0&&se[1]>0);const ae=se[0]/re[0],me=se[1]/re[1],we=(N.right-N.left)/2/ae,ve=(N.top-N.bottom)/2/me,Oe=[(Q[0]+F[0])/2+we,(Q[1]+F[1])/2+ve],Te=hp(Oe),Re=Math.min(d,E2(Math.abs(Math.min(ae,me))));return Hc(Number.isFinite(Re)),{longitude:Te[0],latitude:Te[1],zoom:Re}}function UO(t=0){return typeof t=="number"?{top:t,bottom:t,left:t,right:t}:(Hc(Number.isFinite(t.top)&&Number.isFinite(t.bottom)&&Number.isFinite(t.left)&&Number.isFinite(t.right)),t)}const cw=Math.PI/180;function jO(t,e=0){const{width:i,height:n,unproject:o}=t,d={targetZ:e},p=o([0,n],d),h=o([i,n],d);let A,R;const B=t.fovy?.5*t.fovy*cw:Math.atan(.5/t.altitude),N=(90-t.pitch)*cw;return B>N-.01?(A=uw(t,0,e),R=uw(t,i,e)):(A=o([0,0],d),R=o([i,0],d)),[p,h,R,A]}function uw(t,e,i){const{pixelUnprojectionMatrix:n}
2028=t,o=tp(n,[e,0,1,1]),d=tp(n,[e,t.height,1,1]),h=(i*t.distanceScales.unitsPerMeter[2]-o[2])/(d[2]-o[2]),A=$S([],o,d,h),R=hp(A);return R.push(i),R}const P2=` 2029layout(std140) uniform shadowUniforms { 2030 bool drawShadowMap; 2031 bool useShadowMap; 2032 vec4 color; 2033 highp int lightId; 2034 float lightCount; 2035 mat4 viewProjectionMatrix0; 2036 mat4 viewProjectionMatrix1; 2037 vec4 projectCenter0; 2038 vec4 projectCenter1; 2039} shadow; 2040`,VO=` 2041const int max_lights = 2; 2042 2043out vec3 shadow_vPosition[max_lights]; 2044 2045vec4 shadow_setVertexPosition(vec4 position_commonspace) { 2046 mat4 viewProjectionMatrices[max_lights]; 2047 viewProjectionMatrices[0] = shadow.viewProjectionMatrix0; 2048 viewProjectionMatrices[1] = shadow.viewProjectionMatrix1; 2049 vec4 projectCenters[max_lights]; 2050 projectCenters[0] = shadow.projectCenter0; 2051 projectCenters[1] = shadow.projectCenter1; 2052 2053 if (shadow.drawShadowMap) { 2054 return project_common_position_to_clipspace(position_commonspace, viewProjectionMatrices[shadow.lightId], projectCenters[shadow.lightId]); 2055 } 2056 if (shadow.useShadowMap) { 2057 for (int i = 0; i < max_lights; i++) { 2058 if(i < int(shadow.lightCount)) { 2059 vec4 shadowMap_position = project_common_position_to_clipspace(position_commonspace, viewProjectionMatrices[i], projectCenters[i]); 2060 shadow_vPosition[i] = (shadowMap_position.xyz / shadowMap_position.w + 1.0) / 2.0; 2061 } 2062 } 2063 } 2064 return gl_Position; 2065} 2066`,$O=` 2067${P2} 2068${VO} 2069`,HO=` 2070const int max_lights = 2; 2071uniform sampler2D shadow_uShadowMap0; 2072uniform sampler2D shadow_uShadowMap1; 2073 2074in vec3 shadow_vPosition[max_lights]; 2075 2076const vec4 bitPackShift = vec4(1.0, 255.0, 65025.0, 16581375.0); 2077const vec4 bitUnpackShift = 1.0 / bitPackShift; 2078const vec4 bitMask = vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 0.0); 2079 2080float shadow_getShadowWeight(vec3 position, sampler2D shadowMap) { 2081 vec4 rgbaDepth = texture(shadowMap, position.xy); 2082 2083 float z = dot(rgbaDepth, bitUnpackShift); 2084 return smoothstep(0.001, 0.01, position.z - z); 2085} 2086 2087vec4 shadow_filterShadowColor(vec4 color) { 2088 if (shadow.drawShadowMap) { 2089 vec4 rgbaDepth = fract(gl_FragCoord.z * bitPackShift); 2090 rgbaDepth -= rgbaDepth.gbaa * bitMask; 2091 return rgbaDepth; 2092 } 2093 if (shadow.useShadowMap) { 2094 float shadowAlpha = 0.0; 2095 shadowAlpha += shadow_getShadowWeight(shadow_vPosition[0], shadow_uShadowMap0); 2096 if(shadow.lightCount > 1.0) { 2097 shadowAlpha += shadow_getShadowWeight(shadow_vPosition[1], shadow_uShadowMap1); 2098 } 2099 shadowAlpha *= shadow.color.a / shadow.lightCount; 2100 float blendedAlpha = shadowAlpha + color.a * (1.0 - shadowAlpha); 2101 2102 return vec4( 2103 mix(color.rgb, shadow.color.rgb, shadowAlpha / blendedAlpha), 2104 blendedAlpha 2105 ); 2106 } 2107 return color; 2108} 2109`,WO=` 2110${P2} 2111${HO} 2112`,XO=Tg(KO),qO=Tg(QO),ZO=[0,0,0,1],YO=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0];function GO(t,e){const[i,n,o]=t,d=hx([i,n,o],e);return Number.isFinite(o)?d:[d[0],d[1],0]}function KO({viewport:t,center:e}){return new ll(t.viewProjectionMatrix).invert().transform(e)}function QO({viewport:t,shadowMatrices:e}){const i=[],n=t.pixelUnprojectionMatrix,o=t.isGeospatial?void 0:1,d=[[0,0,o],[t.width,0,o],[0,t.height,o],[t.width,t.height,o],[0,0,-1],[t.width,0,-1],[0,t.height,-1],[t.width,t.height,-1]].map(p=>GO(p,n));for(const p of e){const h=p.clone().translate(new nc(t.center).negate()),A=d.map(B=>h.transform(B)),R=new ll().ortho({left:Math.min(...A.map(B=>B[0])),right:Math.max(...A.map(B=>B[0])),bottom:Math.min(...A.map(B=>B[1])),top:Math.max(...A.map(B=>B[1])),near:Math.min(...A.map(B=>-B[2])),far:Math.max(...A.map(B=>-B[2]))});i.push(R.multiplyRight(p))}return i}function JO(t){const{shadowEnabled:e=!0,project:i}=t;if(!e||!i||!t.shadowMatrices||!t.shadowMatrices.length)return{drawShadowMap:!1,useShadowMap:!1,shadow_uShadowMap0:t.dummyShadowMap,shadow_uShadowMap1:t.dummyShadowMap};const n=cx.getUniforms(i),o=XO({viewport:i.viewport,center:n.center}),d=[],p=qO({shadowMatrices:t.shadowMatrices,viewport:i.viewport}).slice();for(let A=0;A<t.shadowMatrices.length;A++){const R=p[A],B=R.clone().translate(new nc(i.viewport.center).negate());n.coordinateSystem===hv("lnglat")&&n.projectionMode===Wa.WEB_MERCATOR?(p[A]=B,d[A]=o):(p[A]=R.clone().multiplyRight(YO),d[A]=B.transform(o))}const h={drawShadowMap:!!t.drawToShadowMap,useShadowMap:t.shadowMaps?t.shadowMaps.length>0:!1,color:t.shadowColor||ZO,lightId:t.shadowLightId||0,lightCount:t.shadowMatrices.length,shadow_uShadowMap0:t.dummyShadowMap,shadow_uShadowMap1:t.dummyShadowMap};for(let A=0;A<p.length;A++)h[`viewProjectionMatrix${A}`]=p[A],h[`projectCenter${A}`]=d[A];for(let A=0;A<2;A++)h[`shadow_uShadowMap${A}`]=t.shadowMaps&&t.shadowMaps[A]||t.dummyShadowMap;return h}const hw={name:"shadow",dependencies:[cx],vs:$O,fs:WO,inject:{"vs:DECKGL_FILTER_GL_POSITION":` 2113 position = shadow_setVertexPosition(geometry.position); 2114 `,"fs:DECKGL_FILTER_COLOR":` 2115 color = shadow_filterShadowColor(color); 2116 `},getUniforms:JO,uniformTypes:{drawShadowMap:"f32",useShadowMap:"f32",color:"vec4<f32>",lightId:"i32",lightCount:"f32",viewProjectionMatrix0:"mat4x4<f32>",viewProjectionMatrix1:"mat4x4<f32>",projectCenter0:"vec4<f32>",projectCenter1:"vec4<f32>"}},ek=`struct pickingUniforms { 2117 isActive: f32, 2118 isAttribute: f32, 2119 isHighlightActive: f32, 2120 useByteColors: f32, 2121 highlightedObjectColor: vec3<f32>, 2122 highlightColor: vec4<f32>, 2123}; 2124 2125@group(0) @binding(auto) var<uniform> picking: pickingUniforms; 2126 2127fn picking_normalizeColor(color: vec3<f32>) -> vec3<f32> { 2128 return select(color, color / 255.0, picking.useByteColors > 0.5); 2129} 2130 2131fn picking_normalizeColor4(color: vec4<f32>) -> vec4<f32> { 2132 return select(color, color / 255.0, picking.useByteColors > 0.5); 2133} 2134 2135fn picking_isColorZero(color: vec3<f32>) -> bool { 2136 return dot(color, vec3<f32>(1.0)) < 0.00001; 2137} 2138 2139fn picking_isColorValid(color: vec3<f32>) -> bool { 2140 return dot(color, vec3<f32>(1.0)) > 0.00001; 2141} 2142`,I2={...P1,source:ek,defaultUniforms:{...P1.defaultUniforms,useByteColors:!0},inject:{"vs:DECKGL_FILTER_GL_POSITION":` 2143 // for picking depth values 2144 picking_setPickingAttribute(position.z / position.w); 2145 `,"vs:DECKGL_FILTER_COLOR":` 2146 picking_setPickingColor(geometry.pickingColor); 2147 `,"fs:DECKGL_FILTER_COLOR":{order:99,injection:` 2148 // use highlight color if this fragment belongs to the selected object. 2149 color = picking_filterHighlightColor(color); 2150 2151 // use picking color if rendering to picking FBO. 2152 color = picking_filterPickingColor(color); 2153 `}}},tk=[m2],ik=["vs:DECKGL_FILTER_SIZE(inout vec3 size, VertexGeometry geometry)","vs:DECKGL_FILTER_GL_POSITION(inout vec4 position, VertexGeometry geometry)","vs:DECKGL_FILTER_COLOR(inout vec4 color, VertexGeometry geometry)","fs:DECKGL_FILTER_COLOR(inout vec4 color, FragmentGeometry geometry)"],nk=[];function rk(t){const e=yy.getDefaultShaderAssembler();for(const n of tk)e.addDefaultModule(n);e._hookFunctions.length=0;const i=t==="glsl"?ik:nk;for(const n of i)e.addShaderHook(n);return e}const sk=[255,255,255],ak=1;let ok=0;class lk{constructor(e={}){this.type="ambient";const{color:i=sk}=e,{intensity:n=ak}=e;this.id=e.id||`ambient-${ok++}`,this.color=i,this.intensity=n}}const ck=[255,255,255],uk=1,hk=[0,0,-1];let dk=0;class dw{constructor(e={}){this.type="directional";const{color:i=ck}=e,{intensity:n=uk}=e,{direction:o=hk}=e,{_shadow:d=!1}=e;this.id=e.id||`directional-${dk++}`,this.color=i,this.intensity=n,this.type="directional",this.direction=new nc(o).normalize().toArray(),this.shadow=d}getProjectedLight(e){return this}}class fk{constructor(e,i={id:"pass"}){const{id:n}=i;this.id=n,this.device=e,this.props={...i}}setProps(e){Object.assign(this.props,e)}render(e){}cleanup(){}}const pk={depthWriteEnabled:!0,depthCompare:"less-equal",blendColorOperation:"add",blendColorSrcFactor:"src-alpha",blendColorDstFactor:"one",blendAlphaOperation:"add",blendAlphaSrcFactor:"one-minus-dst-alpha",blendAlphaDstFactor:"one"};class dx extends fk{constructor(){super(...arguments),this._lastRenderIndex=-1}render(e){this._render(e)}_render(e){const i=this.device.canvasContext,n=e.target??i.getCurrentFramebuffer(),[o,d]=i.getDrawingBufferSize(),p=e.clearCanvas??!0,h=e.clearColor??(p?[0,0,0,0]:!1),A=p?1:!1,R=p?0:!1,B=e.colorMask??15,N={viewport:[0,0,o,d]};e.colorMask&&(N.colorMask=B),e.scissorRect&&(N.scissorRect=e.scissorRect);const F=this.device.beginRenderPass({framebuffer:n,parameters:N,clearColor:h,clearDepth:A,clearStencil:R});try{return this._drawLayers(F,e)}finally{F.end(),this.device.submit()}}_drawLayers(e,i){const{target:n,shaderModuleProps:o,viewports:d,views:p,onViewportActive:h,clearStack:A=!0}=i;i.pass=i.pass||"unknown",A&&(this._lastRenderIndex=-1);const R=[];for(const B of d){const N=p&&p[B.id];h==null||h(B);const F=this._getDrawLayerParams(B,i),Q=B.subViewports||[B];for(const re of Q){const se=this._drawLayersInViewport(e,{target:n,shaderModuleProps:o,viewport:re,view:N,pass:i.pass,layers:i.layers,isPicking:i.isPicking},F);R.push(se)}}return R}_getDrawLayerParams(e,{layers:i,pass:n,isPicking:o=!1,layerFilter:d,cullRect:p,views:h,effects:A,shaderModuleProps:R},B=!1){var se,ae;const N=[],F=D2(this._lastRenderIndex+1),Q={layer:i[0],viewport:e,isPicking:o,renderPass:n,cullRect:p},re={};for(let me=0;me<i.length;me++){const we=i[me],ve=this._shouldDrawLayer(we,Q,d,re),Oe={shouldDrawLayer:ve};if(ve&&!B){Oe.shouldDrawLayer=!0,Oe.layerRenderIndex=F(we,ve),Oe.shaderModuleProps=this._getShaderModuleProps(we,A,n,R);const Te=we.context.device.type==="webgpu"?pk:null;Oe.layerParameters={...Te,...(se=we.context.deck)==null?void 0:se.props.parameters,...(ae=h==null?void 0:h[e.id])==null?void 0:ae.props.parameters,...this.getLayerParameters(we,me,e)}}N[me]=Oe}return N}_drawLayersInViewport(e,{layers:i,shaderModuleProps:n,pass:o,target:d,viewport:p,view:h,isPicking:A},R){const B=mk(this.device,{shaderModuleProps:n,target:d,viewport:p});if(h){const{clear:F,clearColor:Q,clearDepth:re,clearStencil:se}=h.props;if(F){let ae=[0,0,0,0],me=1,we=0;Array.isArray(Q)&&!A?ae=[...Q.slice(0,3),Q[3]||255].map(Oe=>Oe/255):Q===!1&&(ae=!1),re!==void 0&&(me=re),se!==void 0&&(we=se),this.device.beginRenderPass({framebuffer:d,parameters:{viewport:B,scissorRect:B},clearColor:ae,clearDepth:me,clearStencil:we}).end()}}const N={totalCount:i.length,visibleCount:0,compositeCount:0,pickableCount:0};e.setParameters({viewport:B});for(let F=0;F<i.length;F++){const Q=i[F],re=R[F],{shouldDrawLayer:se}=re;if(se&&Q.props.pickable&&N.pickableCount++,Q.isComposite&&N.compositeCount++,Q.isDrawable&&re.shouldDrawLayer){const{layerRenderIndex:ae,shaderModuleProps:me,layerParameters:we}=re;N.visibleCount++,this._lastRenderIndex=Math.max(this._lastRenderIndex,ae),me.project&&(me.project.viewport=p),Q.context.renderPass=e;try{Q._drawLayer({renderPass:e,shaderModuleProps:me,uniforms:{layerIndex:ae},parameters:we})}catch(ve){Q.raiseError(ve,`drawing ${Q} to ${o}`)}}}return N}shouldDrawLayer(e){return!0}getShaderModuleProps(e,i,n){return null}getLayerParameters(e,i,n){return e.props.parameters}_shouldDrawLayer(e,i,n,o){if(!(e.props.visible&&this.shouldDrawLayer(e)))return!1;i.layer=e;let p=e.parent;for(;p;){if(!p.props.visible||!p.filterSubLayer(i))return!1;i.layer=p,p=p.parent}if(n){const h=i.layer.id;if(h in o||(o[h]=n(i)),!o[h])return!1}return e.activateViewport(i.viewport),!0}_getShaderModuleProps(e,i,n,o){var A,R;const d=this.device.canvasContext.cssToDeviceRatio(),p=((A=e.internalState)==null?void 0:A.propsInTransition)||e.props,h={layer:p,picking:{isActive:!1},project:{viewport:e.context.viewport,devicePixelRatio:d,modelMatrix:p.modelMatrix,coordinateSystem:p.coordinateSystem,coordinateOrigin:p.coordinateOrigin,autoWrapLongitude:e.wrapLongitude}};if(i)for(const B of i)fw(h,(R=B.getShaderModuleProps)==null?void 0:R.call(B,e,h));for(const B of e.context.defaultShaderModules)B.name in h||(h[B.name]={});
2153return fw(h,this.getShaderModuleProps(e,i,h),o)}}function D2(t=0,e={}){const i={},n=(o,d)=>{const p=o.props._offset,h=o.id,A=o.parent&&o.parent.id;let R;if(A&&!(A in e)&&n(o.parent,!1),A in i){const B=i[A]=i[A]||D2(e[A],e);R=B(o,d),i[h]=B}else Number.isFinite(p)?(R=p+(e[A]||0),i[h]=null):R=t;return d&&R>=t&&(t=R+1),e[h]=R,R};return n}function mk(t,{shaderModuleProps:e,target:i,viewport:n}){var A;const o=((A=e==null?void 0:e.project)==null?void 0:A.devicePixelRatio)??t.canvasContext.cssToDeviceRatio(),[,d]=t.canvasContext.getDrawingBufferSize(),p=i?i.height:d,h=n;return[h.x*o,p-(h.y+h.height)*o,h.width*o,h.height*o]}function fw(t,...e){for(const i of e)if(i)for(const n in i)t[n]?Object.assign(t[n],i[n]):t[n]=i[n];return t}class gk extends dx{constructor(e,i){super(e,i);const n=e.createTexture({format:"rgba8unorm",width:1,height:1,sampler:{minFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}}),o=e.createTexture({format:"depth16unorm",width:1,height:1});this.fbo=e.createFramebuffer({id:"shadowmap",width:1,height:1,colorAttachments:[n],depthStencilAttachment:o})}delete(){this.fbo&&(this.fbo.destroy(),this.fbo=null)}getShadowMap(){return this.fbo.colorAttachments[0].texture}render(e){const i=this.fbo,n=this.device.canvasContext.cssToDeviceRatio(),o=e.viewports[0],d=o.width*n,p=o.height*n,h=[1,1,1,1];(d!==i.width||p!==i.height)&&i.resize({width:d,height:p}),super.render({...e,clearColor:h,target:i,pass:"shadow"})}getLayerParameters(e,i,n){return{...e.props.parameters,blend:!1,depthWriteEnabled:!0,depthCompare:"less-equal"}}shouldDrawLayer(e){return e.props.shadowEnabled!==!1}getShaderModuleProps(e,i,n){return{shadow:{project:n.project,drawToShadowMap:!0}}}}const _k={color:[255,255,255],intensity:1},pw=[{color:[255,255,255],intensity:1,direction:[-1,3,-1]},{color:[255,255,255],intensity:.9,direction:[1,-8,-2.5]}],yk=[0,0,0,200/255];class O2{constructor(e={}){this.id="lighting-effect",this.shadowColor=yk,this.shadow=!1,this.directionalLights=[],this.pointLights=[],this.shadowPasses=[],this.dummyShadowMap=null,this.setProps(e)}setup(e){this.context=e;const{device:i,deck:n}=e;this.shadow&&!this.dummyShadowMap&&(this._createShadowPasses(i),n._addDefaultShaderModule(hw),this.dummyShadowMap=i.createTexture({width:1,height:1}))}setProps(e){this.ambientLight=void 0,this.directionalLights=[],this.pointLights=[];for(const i in e){const n=e[i];switch(n.type){case"ambient":this.ambientLight=n;break;case"directional":this.directionalLights.push(n);break;case"point":this.pointLights.push(n);break}}this._applyDefaultLights(),this.shadow=this.directionalLights.some(i=>i.shadow),this.context&&this.setup(this.context),this.props=e}preRender({layers:e,layerFilter:i,viewports:n,onViewportActive:o,views:d}){if(this.shadow){this.shadowMatrices=this._calculateMatrices();for(let p=0;p<this.shadowPasses.length;p++)this.shadowPasses[p].render({layers:e,layerFilter:i,viewports:n,onViewportActive:o,views:d,shaderModuleProps:{shadow:{shadowLightId:p,dummyShadowMap:this.dummyShadowMap,shadowMatrices:this.shadowMatrices}}})}}getShaderModuleProps(e,i){const n=this.shadow?{project:i.project,shadowMaps:this.shadowPasses.map(p=>p.getShadowMap()),dummyShadowMap:this.dummyShadowMap,shadowColor:this.shadowColor,shadowMatrices:this.shadowMatrices}:{},o={enabled:!0,lights:this._getLights(e)},d=e.props.material;return{shadow:n,lighting:o,phongMaterial:d,gouraudMaterial:d}}cleanup(e){for(const i of this.shadowPasses)i.delete();this.shadowPasses.length=0,this.dummyShadowMap&&(this.dummyShadowMap.destroy(),this.dummyShadowMap=null,e.deck._removeDefaultShaderModule(hw))}_calculateMatrices(){const e=[];for(const i of this.directionalLights){const n=new ll().lookAt({eye:new nc(i.direction).negate()});e.push(n)}return e}_createShadowPasses(e){for(let i=0;i<this.directionalLights.length;i++){const n=new gk(e);this.shadowPasses[i]=n}}_applyDefaultLights(){const{ambientLight:e,pointLights:i,directionalLights:n}=this;!e&&i.length===0&&n.length===0&&(this.ambientLight=new lk(_k),this.directionalLights.push(new dw(pw[0]),new dw(pw[1])))}_getLights(e){const i=[];this.ambientLight&&i.push(this.ambientLight);for(const n of this.pointLights)i.push(n.getProjectedLight({layer:e}));for(const n of this.directionalLights)i.push(n.getProjectedLight({layer:e}));return i}}class vk{constructor(e={}){this._pool=[],this.opts={overAlloc:2,poolSize:100},this.setOptions(e)}setOptions(e){Object.assign(this.opts,e)}allocate(e,i,{size:n=1,type:o,padding:d=0,copy:p=!1,initialize:h=!1,maxCount:A}){const R=o||e&&e.constructor||Float32Array,B=i*n+d;if(ArrayBuffer.isView(e)){if(B<=e.length)return e;if(B*e.BYTES_PER_ELEMENT<=e.buffer.byteLength)return new R(e.buffer,0,B)}let N=1/0;A&&(N=A*n+d);const F=this._allocate(R,B,h,N);return e&&p?F.set(e):h||F.fill(0,0,4),this._release(e),F}release(e){this._release(e)}_allocate(e,i,n,o){let d=Math.max(Math.ceil(i*this.opts.overAlloc),1);d>
vendor: 7,360 bytes, line 2153
2153o&&(d=o);const p=this._pool,h=e.BYTES_PER_ELEMENT*d,A=p.findIndex(R=>R.byteLength>=h);if(A>=0){const R=new e(p.splice(A,1)[0],0,d);return n&&R.fill(0),R}return new e(d)}_release(e){if(!ArrayBuffer.isView(e))return;const i=this._pool,{buffer:n}=e,{byteLength:o}=n,d=i.findIndex(p=>p.byteLength>=o);d<0?i.push(n):(d>0||i.length<this.opts.poolSize)&&i.splice(d,0,n),i.length>this.opts.poolSize&&i.shift()}}const dp=new vk;function Gm(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function mw(t,e){const i=t%e;return i<0?e+i:i}function bk(t){return[t[12],t[13],t[14]]}function xk(t){return{left:$f(t[3]+t[0],t[7]+t[4],t[11]+t[8],t[15]+t[12]),right:$f(t[3]-t[0],t[7]-t[4],t[11]-t[8],t[15]-t[12]),bottom:$f(t[3]+t[1],t[7]+t[5],t[11]+t[9],t[15]+t[13]),top:$f(t[3]-t[1],t[7]-t[5],t[11]-t[9],t[15]-t[13]),near:$f(t[3]+t[2],t[7]+t[6],t[11]+t[10],t[15]+t[14]),far:$f(t[3]-t[2],t[7]-t[6],t[11]-t[10],t[15]-t[14])}}const gw=new nc;function $f(t,e,i,n){gw.set(t,e,i);const o=gw.len();return{distance:n/o,normal:new nc(-t/o,-e/o,-i/o)}}function wk(t){return t-Math.fround(t)}let jm;function cb(t,e){const{size:i=1,startIndex:n=0}=e,o=e.endIndex!==void 0?e.endIndex:t.length,d=(o-n)/i;jm=dp.allocate(jm,d,{type:Float32Array,size:i*2});let p=n,h=0;for(;p<o;){for(let A=0;A<i;A++){const R=t[p++];jm[h+A]=R,jm[h+A+i]=wk(R)}h+=i*2}return jm.subarray(0,d*i*2)}function Tk(t){let e=null,i=!1;for(const n of t)n&&(e?(i||(e=[[e[0][0],e[0][1]],[e[1][0],e[1][1]]],i=!0),e[0][0]=Math.min(e[0][0],n[0][0]),e[0][1]=Math.min(e[0][1],n[0][1]),e[1][0]=Math.max(e[1][0],n[1][0]),e[1][1]=Math.max(e[1][1],n[1][1])):e=n);return e}const Sk=Math.PI/180,Ak=Gm(),_w=[0,0,0],Ek={unitsPerMeter:[1,1,1],metersPerUnit:[1,1,1]};function Ck({width:t,height:e,orthographic:i,fovyRadians:n,focalDistance:o,padding:d,near:p,far:h}){const A=t/e,R=i?new ll().orthographic({fovy:n,aspect:A,focalDistance:o,near:p,far:h}):new ll().perspective({fovy:n,aspect:A,near:p,far:h});if(d){const{left:B=0,right:N=0,top:F=0,bottom:Q=0}=d,re=rl((B+t-N)/2,0,t)-t/2,se=rl((F+e-Q)/2,0,e)-e/2;R[8]-=re*2/t,R[9]+=se*2/e}return R}class Sp{constructor(e={}){this._frustumPlanes={},this.id=e.id||this.constructor.displayName||"viewport",this.x=e.x||0,this.y=e.y||0,this.width=e.width||1,this.height=e.height||1,this.zoom=e.zoom||0,this.padding=e.padding,this.distanceScales=e.distanceScales||Ek,this.focalDistance=e.focalDistance||1,this.position=e.position||_w,this.modelMatrix=e.modelMatrix||null;const{longitude:i,latitude:n}=e;this.isGeospatial=Number.isFinite(n)&&Number.isFinite(i),this._initProps(e),this._initMatrices(e),this.equals=this.equals.bind(this),this.project=this.project.bind(this),this.unproject=this.unproject.bind(this),this.projectPosition=this.projectPosition.bind(this),this.unprojectPosition=this.unprojectPosition.bind(this),this.projectFlat=this.projectFlat.bind(this),this.unprojectFlat=this.unprojectFlat.bind(this)}get subViewports(){return null}get metersPerPixel(){return this.distanceScales.metersPerUnit[2]/this.scale}get projectionMode(){return this.isGeospatial?this.zoom<12?Wa.WEB_MERCATOR:Wa.WEB_MERCATOR_AUTO_OFFSET:Wa.IDENTITY}equals(e){return e instanceof Sp?this===e?!0:e.width===this.width&&e.height===this.height&&e.scale===this.scale&&dg(e.projectionMatrix,this.projectionMatrix)&&dg(e.viewMatrix,this.viewMatrix):!1}project(e,{topLeft:i=!0}={}){const n=this.projectPosition(e),o=M2(n,this.pixelProjectionMatrix),[d,p]=o,h=i?p:this.height-p;return e.length===2?[d,h]:[d,h,o[2]]}unproject(e,{topLeft:i=!0,targetZ:n}={}){const[o,d,p]=e,h=i?d:this.height-d,A=n&&n*this.distanceScales.unitsPerMeter[2],R=hx([o,h,p],this.pixelUnprojectionMatrix,A),[B,N,F]=this.unprojectPosition(R);return Number.isFinite(p)?[B,N,F]:Number.isFinite(n)?[B,N,n]:[B,N]}projectPosition(e){const[i,n]=this.projectFlat(e),o=(e[2]||0)*this.distanceScales.unitsPerMeter[2];return[i,n,o]}unprojectPosition(e){const[i,n]=this.unprojectFlat(e),o=(e[2]||0)*this.distanceScales.metersPerUnit[2];return[i,n,o]}projectFlat(e){if(this.isGeospatial){const i=up(e);return i[1]=rl(i[1],-318,830),i}return e}unprojectFlat(e){return this.isGeospatial?hp(e):e}getBounds(e={}){const i={targetZ:e.z||0},n=this.unproject([0,0],i),o=this.unproject([this.width,0],i),d=this.unproject([0,this.height],i),p=this.unproject([this.width,this.height],i);return[Math.min(n[0],o[0],d[0],p[0]),Math.min(n[1],o[1],d[1],p[1]),Math.max(n[0],o[0],d[0],p[0]),Math.max(n[1],o[1],d[1],p[1])]}getDistanceScales(e){return e&&this.isGeospatial?g0({longitude:e[0],latitude:e[1],highPrecision:!0}):this.distanceScales}containsPixel({x:e,y:i,width:n=1,height:o=1}){return e<this.x+this.width&&this.x<e+n&&i<this.y+this.height&&this.y<i+o}getFrustumPlanes(){return this._frustumPlanes.near?this._frustumPlanes:(Object.assign(this._frustumPlanes,xk(this.viewProjectionMatrix)),this._frustumPlanes)}panByPosition(e,i,n){return null}_initProps(e){const i=e.longitude,n=e.latitude;this.isGeospatial&&(Number.isFinite(e.zoom)||(this.zoom=NO({latitude:n})+Math.log2(this.focalDistance)),this.distanceScales=e.distanceScales||g0({latitude:n,longitude:i}));const o=Math.pow(2,this.zoom);this.scale=o;const{position:d,modelMatrix:p}=e;let h=_w;if(d&&(h=p?new ll(p).transformAsVector(d,[]):d),this.isGeospatial){const A=this.projectPosition([i,n,0]);this.center=new nc(h).scale(this.distanceScales.unitsPerMeter).add(A)}else this.center=this.projectPosition(h)}_initMatrices(e){const{viewMatrix:i=Ak,projectionMatrix:n=null,orthographic:o=!1,fovyRadians:d,fovy:p=75,near:h=.1,far:A=1e3,padding:R=null,focalDistance:B=1}=e;this.viewMatrixUncentered=i,this.viewMatrix=new ll().multiplyRight(i).translate(new nc(this.center).negate()),this.projectionMatrix=n||Ck({width:this.width,height:this.height,orthographic:o,fovyRadians:d||p*Sk,focalDistance:B,padding:R,near:h,far:A});const N=Gm();Ad(N,N,this.projectionMatrix),Ad(N,N,this.viewMatrix),this.viewProjectionMatrix=N,this.viewMatrixInverse=Yb([],this.viewMatrix)||this.viewMatrix,this.cameraPosition=bk(this.viewMatrixInverse);const F=Gm(),Q=Gm();sx(F,F,[this.width/2,-this.height/2,1]),by(F,F,[1,-1,0]),Ad(Q,F,this.viewProjectionMatrix),this.pixelProjectionMatrix=Q,this.pixelUnprojectionMatrix=Yb(Gm(),this.pixelProjectionMatrix),this.pixelUnprojectionMatrix||On.warn("Pixel project matrix not invertible")()}}Sp.displayName="Viewport";class fp extends Sp{constructor(e={}){const{latitude:i=0,longitude:n=0,zoom:o=0,pitch:d=0,bearing:p=0,nearZMultiplier:h=.1,farZMultiplier:A=1.01,nearZ:R,farZ:B,orthographic:N=!1,projectionMatrix:F,repeat:Q=!1,worldOffset:re=0,position:se,padding:ae,legacyMeterSizes:me=!1}=e;let{width:we,height:ve,altitude:Oe=1.5}=e;const Te=Math.pow(2,o);we=we||1,ve=ve||1;let Re,Ee=null;if(F)Oe=F[5]/2,Re=pg(Oe);else{e.fovy?(Re=e.fovy,Oe=ux(Re)):Re=pg(Oe);let rt;if(ae){const{top:Ke=0,bottom:Qe=0}=ae;rt=[0,rl((Ke+ve-Qe)/2,0,ve)-ve/2]}Ee=LO({width:we,height:ve,scale:Te,center:se&&[0,0,se[2]*lb(i)],offset:rt,pitch:d,fovy:Re,nearZMultiplier:h,farZMultiplier:A}),Number.isFinite(R)&&(Ee.near=R),Number.isFinite(B)&&(Ee.far=B)}let Je=zO({height:ve,pitch:d,bearing:p,scale:Te,altitude:Oe});re&&(Je=new ll().translate([512*re,0,0]).multiplyLeft(Je)),super({...e,width:we,height:ve,viewMatrix:Je,longitude:n,latitude:i,zoom:o,...Ee,fovy:Re,focalDistance:Oe}),this.latitude=i,this.longitude=n,this.zoom=o,this.pitch=d,this.bearing=p,this.altitude=Oe,this.fovy=Re,this.orthographic=N,this._subViewports=
2153Q?[]:null,this._pseudoMeters=me,Object.freeze(this)}get subViewports(){if(this._subViewports&&!this._subViewports.length){const e=this.getBounds(),i=Math.floor((e[0]+180)/360),n=Math.ceil((e[2]-180)/360);for(let o=i;o<=n;o++){const d=o?new fp({...this,worldOffset:o}):this;this._subViewports.push(d)}}return this._subViewports}projectPosition(e){if(this._pseudoMeters)return super.projectPosition(e);const[i,n]=this.projectFlat(e),o=(e[2]||0)*lb(e[1]);return[i,n,o]}unprojectPosition(e){if(this._pseudoMeters)return super.unprojectPosition(e);const[i,n]=this.unprojectFlat(e),o=(e[2]||0)/lb(n);return[i,n,o]}addMetersToLngLat(e,i){return R2(e,i)}panByPosition(e,i,n){const o=hx(i,this.pixelUnprojectionMatrix),d=this.projectFlat(e),p=C1([],d,wM([],o)),h=C1([],this.center,p),[A,R]=this.unprojectFlat(h);return{longitude:A,latitude:R}}panByPosition3D(e,i){const n=e[2]||0,o=SM([],e,this.unproject(i,{targetZ:n}));return{longitude:this.longitude+o[0],latitude:this.latitude+o[1]}}getBounds(e={}){const i=jO(this,e.z||0);return[Math.min(i[0][0],i[1][0],i[2][0],i[3][0]),Math.min(i[0][1],i[1][1],i[2][1],i[3][1]),Math.max(i[0][0],i[1][0],i[2][0],i[3][0]),Math.max(i[0][1],i[1][1],i[2][1],i[3][1])]}fitBounds(e,i={}){const{width:n,height:o}=this,{longitude:d,latitude:p,zoom:h}=FO({width:n,height:o,bounds:e,...i});return new fp({width:n,height:o,longitude:d,latitude:p,zoom:h})}}fp.displayName="WebMercatorViewport";const yw=[0,0,0];function ub(t,e,i=!1){const n=e.projectPosition(t);if(i&&e instanceof fp){const[o,d,p=0]=t,h=e.getDistanceScales([o,d]);n[2]=p*h.unitsPerMeter[2]}return n}function Rk(t){const{viewport:e,modelMatrix:i,coordinateOrigin:n}=t;let{coordinateSystem:o,fromCoordinateSystem:d,fromCoordinateOrigin:p}=t;return o==="default"&&(o=e.isGeospatial?"lnglat":"cartesian"),d===void 0?d=o:d==="default"&&(d=e.isGeospatial?"lnglat":"cartesian"),p===void 0&&(p=n),{viewport:e,coordinateSystem:o,coordinateOrigin:n,modelMatrix:i,fromCoordinateSystem:d,fromCoordinateOrigin:p}}function fx(t,{viewport:e,modelMatrix:i,coordinateSystem:n,coordinateOrigin:o,offsetMode:d}){let[p,h,A=0]=t;switch(i&&([p,h,A]=Tp([],[p,h,A,1],i)),n){case"default":return fx(t,{viewport:e,modelMatrix:i,coordinateSystem:e.isGeospatial?"lnglat":"cartesian",coordinateOrigin:o,offsetMode:d});case"lnglat":return ub([p,h,A],e,d);case"lnglat-offsets":return ub([p+o[0],h+o[1],A+(o[2]||0)],e,d);case"meter-offsets":return ub(R2(o,[p,h,A]),e,d);case"cartesian":return e.isGeospatial?[p+o[0],h+o[1],A+o[2]]:e.projectPosition([p,h,A]);default:throw new Error(`Invalid coordinateSystem: ${n}`)}}function Mk(t,e){const{viewport:i,coordinateSystem:n,coordinateOrigin:o,modelMatrix:d,fromCoordinateSystem:p,fromCoordinateOrigin:h}=Rk(e),{autoOffset:A=!0}=e,{geospatialOrigin:R=yw,shaderCoordinateOrigin:B=yw,offsetMode:N=!1}=A?S2(i,n,o):{},F=fx(t,{viewport:i,modelMatrix:d,coordinateSystem:p,coordinateOrigin:h,offsetMode:N});if(N){const Q=i.projectPosition(R||B);XS(F,F,Q)}return F}let Pk=1,Ik=1;class k2{constructor(){Y(this,"time",0);Y(this,"channels",new Map);Y(this,"animations",new Map);Y(this,"playing",!1);Y(this,"lastEngineTime",-1)}addChannel(e){const{delay:i=0,duration:n=Number.POSITIVE_INFINITY,rate:o=1,repeat:d=1}=e,p=Pk++,h={time:0,delay:i,duration:n,rate:o,repeat:d};return this._setChannelTime(h,this.time),this.channels.set(p,h),p}removeChannel(e){this.channels.delete(e);for(const[i,n]of this.animations)n.channel===e&&this.detachAnimation(i)}isFinished(e){const i=this.channels.get(e);return i===void 0?!1:this.time>=i.delay+i.duration*i.repeat}getTime(e){if(e===void 0)return this.time;const i=this.channels.get(e);return i===void 0?-1:i.time}setTime(e){this.time=Math.max(0,e);const i=this.channels.values();for(const o of i)this._setChannelTime(o,this.time);const n=this.animations.values();for(const o of n){const{animation:d,channel:p}=o;d.setTime(this.getTime(p))}}play(){this.playing=!0}pause(){this.playing=!1,this.lastEngineTime=-1}reset(){this.setTime(0)}attachAnimation(e,i){const n=Ik++;return this.animations.set(n,{animation:e,channel:i}),e.setTime(this.getTime(i)),n}detachAnimation(e){this.animations.delete(e)}update(e){this.playing&&(this.lastEngineTime===-1&&(this.lastEngineTime=e),this.setTime(this.time+(e-this.lastEngineTime)),this.lastEngineTime=e)}_setChannelTime(e,i){const n=i-e.delay,o=e.duration*e.repeat;n>=o?e.time=e.duration*e.rate:(e.time=Math.max(0,n)%e.duration,e.time*=e.rate)}}function Dk(t){const e=typeof window<"u"?window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame:null;return e?e.call(window,t):setTimeout(()=>t(typeof performance<"u"?performance.now():Date.now()),1e3/60)}function Ok(t){const e=typeof window<"u"?window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame:null;if(e){e.call(window,t);return}clearTimeout(t)}let kk=0;const Bk="Animation Loop",ev=class ev{constructor(e){Y(this,"device",null);Y(this,"canvas",null);Y(this,"props");Y(this,"animationProps",null);Y(this,"timeline",null);Y(this,"stats");Y(this,"sharedStats");Y(this,"cpuTime");Y(this,"gpuTime");Y(this,"frameRate");Y(this,"display");Y(this,"_needsRedraw","initialized");Y(this,"_initialized",!1);Y(this,"_running",!1);Y(this,"_animationFrameId",null);Y(this,"_nextFramePromise",null);Y(this,"_resolveNextFrame",null);Y(this,"_cpuStartTime",0);Y(this,"_error",null);Y(this,"_lastFrameTime",0);if(this.props={...ev.defaultAnimationLoopProps,...e},e=this.props,!e.device)throw new Error("No device provided");this.stats=e.stats||new sv({id:`animation-loop-${kk++}`}),this.sharedStats=Jb.stats.get(Bk),this.frameRate=this.stats.get("Frame Rate"),this.frameRate.setSampleSize(1),this.cpuTime=this.stats.get("CPU Time"),this.gpuTime=this.stats.get("GPU Time"),this.setProps({autoResizeViewport:e.autoResizeViewport}),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this._onMousemove=this._onMousemove.bind(this),this._onMouseleave=this._onMouseleave.bind(this)}destroy(){var e;this.stop(),this._setDisplay(null),(e=this.device)==null||e._disableDebugGPUTime()}delete(){this.destroy()}reportError(e){this.props.onError(e),this._error=e}setNeedsRedraw(e){return this._needsRedraw=this._needsRedraw||e,this}needsRedraw(){const e=this._needsRedraw;return this._needsRedraw=!1,e}setProps(e){return"autoResizeViewport"in e&&(this.props.autoResizeViewport=e.autoResizeViewport||!1),this}
2153async start(){if(this._running)return this;this._running=!0;try{let e;if(!this._initialized){if(this._initialized=!0,await this._initDevice(),this._initialize(),!this._running)return null;await this.props.onInitialize(this._getAnimationProps())}return this._running?(e!==!1&&(this._cancelAnimationFrame(),this._requestAnimationFrame()),this):null}catch(e){const i=e instanceof Error?e:new Error("Unknown error");throw this.props.onError(i),i}}stop(){return this._running&&(this.animationProps&&!this._error&&this.props.onFinalize(this.animationProps),this._cancelAnimationFrame(),this._nextFramePromise=null,this._resolveNextFrame=null,this._running=!1,this._lastFrameTime=0),this}redraw(e){var i;return(i=this.device)!=null&&i.isLost||this._error?this:(this._beginFrameTimers(e),this._setupFrame(),this._updateAnimationProps(),this._renderFrame(this._getAnimationProps()),this._clearNeedsRedraw(),this._resolveNextFrame&&(this._resolveNextFrame(this),this._nextFramePromise=null,this._resolveNextFrame=null),this._endFrameTimers(),this)}attachTimeline(e){return this.timeline=e,this.timeline}detachTimeline(){this.timeline=null}waitForRender(){return this.setNeedsRedraw("waitForRender"),this._nextFramePromise||(this._nextFramePromise=new Promise(e=>{this._resolveNextFrame=e})),this._nextFramePromise}async toDataURL(){if(this.setNeedsRedraw("toDataURL"),await this.waitForRender(),this.canvas instanceof HTMLCanvasElement)return this.canvas.toDataURL();throw new Error("OffscreenCanvas")}_initialize(){var e;this._startEventHandling(),this._initializeAnimationProps(),this._updateAnimationProps(),this._resizeViewport(),(e=this.device)==null||e._enableDebugGPUTime()}_setDisplay(e){this.display&&(this.display.destroy(),this.display.animationLoop=null),e&&(e.animationLoop=this),this.display=e}_requestAnimationFrame(){this._running&&(this._animationFrameId=Dk(this._animationFrame.bind(this)))}_cancelAnimationFrame(){this._animationFrameId!==null&&(Ok(this._animationFrameId),this._animationFrameId=null)}_animationFrame(e){this._running&&(this.redraw(e),this._requestAnimationFrame())}_renderFrame(e){var i;if(this.display){this.display._renderFrame(e);return}this.props.onRender(this._getAnimationProps()),(i=this.device)==null||i.submit()}_clearNeedsRedraw(){this._needsRedraw=!1}_setupFrame(){this._resizeViewport()}_initializeAnimationProps(){var o;const e=(o=this.device)==null?void 0:o.getDefaultCanvasContext();if(!this.device||!e)throw new Error("loop");const i=e==null?void 0:e.canvas,n=e.props.useDevicePixels;this.animationProps={animationLoop:this,device:this.device,canvasContext:e,canvas:i,useDevicePixels:n,timeline:this.timeline,needsRedraw:!1,width:1,height:1,aspect:1,time:0,startTime:Date.now(),engineTime:0,tick:0,tock:0,_mousePosition:null}}_getAnimationProps(){if(!this.animationProps)throw new Error("animationProps");return this.animationProps}_updateAnimationProps(){if(!this.animationProps)return;const{width:e,height:i,aspect:n}=this._getSizeAndAspect();(e!==this.animationProps.width||i!==this.animationProps.height)&&this.setNeedsRedraw("drawing buffer resized"),n!==this.animationProps.aspect&&this.setNeedsRedraw("drawing buffer aspect changed"),this.animationProps.width=e,this.animationProps.height=i,this.animationProps.aspect=n,this.animationProps.needsRedraw=this._needsRedraw,this.animationProps.engineTime=Date.now()-this.animationProps.startTime,this.timeline&&this.timeline.update(this.animationProps.engineTime),this.animationProps.tick=Math.floor(this.animationProps.time/1e3*60),this.animationProps.tock++,this.animationProps.time=this.timeline?this.timeline.getTime():this.animationProps.engineTime}async _initDevice(){if(this.device=await this.props.device,!this.device)throw new Error("No device provided");this.canvas=this.device.getDefaultCanvasContext().canvas||null}_createInfoDiv(){if(this.canvas&&this.props.onAddHTML){const e=document.createElement("div");document.body.appendChild(e),e.style.position="relative";const i=document.createElement("div");i.style.position="absolute",i.style.left="10px",i.style.bottom="10px",i.style.width="300px",i.style.background="white",this.canvas instanceof HTMLCanvasElement&&e.appendChild(this.canvas),e.appendChild(i);const n=this.props.onAddHTML(i);n&&(i.innerHTML=n)}}_getSizeAndAspect(){if(!this.device)return{width:1,height:1,aspect:1};const[e,i]=this.device.getDefaultCanvasContext().getDrawingBufferSize(),n=e>0&&i>0?e/i:1;return{width:e,height:i,aspect:n}}_resizeViewport(){this.props.autoResizeViewport&&this.device.gl&&this.device.gl.viewport(0,0,this.device.gl.drawingBufferWidth,this.device.gl.drawingBufferHeight)}_beginFrameTimers(e){var n;const i=e??(typeof performance<"u"?performance.now():Date.now());if(this._lastFrameTime){const o=i-this._lastFrameTime;o>0&&this.frameRate.addTime(o)}this._lastFrameTime=i,(n=this.device)!=null&&n._isDebugGPUTimeEnabled()&&this._consumeEncodedGpuTime(),this.cpuTime.timeStart()}_endFrameTimers(){var e;(e=this.device)!=null&&e._isDebugGPUTimeEnabled()&&this._consumeEncodedGpuTime(),this.cpuTime.timeEnd(),this._updateSharedStats()}_consumeEncodedGpuTime(){if(!this.device)return;const e=this.device.commandEncoder._gpuTimeMs;e!==void 0&&(this.gpuTime.addTime(e),this.device.commandEncoder._gpuTimeMs=void 0)}_updateSharedStats(){if(this.stats!==this.sharedStats){for(const e of Object.keys(this.sharedStats.stats)
2153)this.stats.stats[e]||delete this.sharedStats.stats[e];this.stats.forEach(e=>{const i=this.sharedStats.get(e.name,e.type);i.sampleSize=e.sampleSize,i.time=e.time,i.count=e.count,i.samples=e.samples,i.lastTiming=e.lastTiming,i.lastSampleTime=e.lastSampleTime,i.lastSampleCount=e.lastSampleCount,i._count=e._count,i._time=e._time,i._samples=e._samples,i._startTime=e._startTime,i._timerPending=e._timerPending})}}_startEventHandling(){this.canvas&&(this.canvas.addEventListener("mousemove",this._onMousemove.bind(this)),this.canvas.addEventListener("mouseleave",this._onMouseleave.bind(this)))}_onMousemove(e){e instanceof MouseEvent&&(this._getAnimationProps()._mousePosition=[e.offsetX,e.offsetY])}_onMouseleave(e){this._getAnimationProps()._mousePosition=null}};Y(ev,"defaultAnimationLoopProps",{device:null,onAddHTML:()=>"",onInitialize:async()=>null,onRender:()=>{},onFinalize:()=>{},onError:e=>console.error(e),stats:void 0,autoResizeViewport:!1});let _0=ev;const hb={};function dv(t="id"){hb[t]=hb[t]||1;const e=hb[t]++;return`${t}-${e}`}class vw{constructor(e){Y(this,"id");Y(this,"userData",{});Y(this,"topology");Y(this,"bufferLayout",[]);Y(this,"vertexCount");Y(this,"indices");Y(this,"attributes");if(this.id=e.id||dv("geometry"),this.topology=e.topology,this.indices=e.indices||null,this.attributes=e.attributes,this.vertexCount=e.vertexCount,this.bufferLayout=e.bufferLayout||[],this.indices&&!(this.indices.usage&En.INDEX))throw new Error("Index buffer must have INDEX usage")}destroy(){var e;(e=this.indices)==null||e.destroy();for(const i of Object.values(this.attributes))i.destroy()}getVertexCount(){return this.vertexCount}getAttributes(){return this.attributes}getIndexes(){return this.indices||null}_calculateVertexCount(e){return e.byteLength/12}}function Nk(t,e){if(e instanceof vw)return e;const i=zk(t,e),{attributes:n,bufferLayout:o}=Lk(t,e);return new vw({topology:e.topology||"triangle-list",bufferLayout:o,vertexCount:e.vertexCount,indices:i,attributes:n})}function zk(t,e){if(!e.indices)return;const i=e.indices.value;return t.createBuffer({usage:En.INDEX,data:i})}function Lk(t,e){const i=[],n={};for(const[d,p]of Object.entries(e.attributes)){let h=d;switch(d){case"POSITION":h="positions";break;case"NORMAL":h="normals";break;case"TEXCOORD_0":h="texCoords";break;case"TEXCOORD_1":h="texCoords1";break;case"COLOR_0":h="colors";break}if(p){n[h]=t.createBuffer({data:p.value,id:`${d}-buffer`});const{value:A,size:R,normalized:B}=p;if(R===void 0)throw new Error(`Attribute ${d} is missing a size`);i.push({name:h,format:fg.getVertexFormatFromAttribute(A,R,B)})}}const o=e._calculateVertexCount(e.attributes,e.indices);return{attributes:n,bufferLayout:i,vertexCount:o}}function Fk(t,e){var o;const i={},n="Values";if(t.attributes.length===0&&!((o=t.varyings)!=null&&o.length))return{"No attributes or varyings":{[n]:"N/A"}};for(const d of t.attributes)if(d){const p=`${d.location} ${d.name}: ${d.type}`;i[`in ${p}`]={[n]:d.stepMode||"vertex"}}for(const d of t.varyings||[]){const p=`${d.location} ${d.name}`;i[`out ${p}`]={[n]:JSON.stringify(d)}}return i}const U_="__debugFramebufferState",db=8;function Uk(t,e,i){if(t.device.type!=="webgl")return;const n=$k(t.device);if(!n.flushing){if(Wk(t)){jk(t,i,n);return}e&&Hk(e)&&e.handle!==null&&(n.queuedFramebuffers.includes(e)||n.queuedFramebuffers.push(e))}}function jk(t,e,i){if(i.queuedFramebuffers.length===0)return;const n=t.device,{gl:o}=n,d=o.getParameter(36010),p=o.getParameter(36006),[h,A]=t.device.getDefaultCanvasContext().getDrawingBufferSize();let R=bw(e.top,db);const B=bw(e.left,db);i.flushing=!0;try{for(const N of i.queuedFramebuffers){const[F,Q,re,se,ae]=Vk({framebuffer:N,targetWidth:h,targetHeight:A,topPx:R,leftPx:B,minimap:e.minimap});o.bindFramebuffer(36008,N.handle),o.bindFramebuffer(36009,null),o.blitFramebuffer(0,0,N.width,N.height,F,Q,re,se,16384,9728),R+=ae+db}}finally{o.bindFramebuffer(36008,d),o.bindFramebuffer(36009,p),i.flushing=!1}}function Vk(t){const{framebuffer:e,targetWidth:i,targetHeight:n,topPx:o,leftPx:d}=t,p=Math.max(Math.floor(i/4),1),h=Math.max(Math.floor(n/4),1),A=Math.min(p/e.width,h/e.height),R=Math.max(Math.floor(e.width*A),1),B=Math.max(Math.floor(e.height*A),1),N=d,F=Math.max(n-o-B,0),Q=N+R,re=F+B;return[N,F,Q,re,B]}function $k(t){var e;return(e=t.userData)[U_]||(e[U_]={flushing:!1,queuedFramebuffers:[]}),t.userData[U_]}function Hk(t){return"colorAttachments"in t}function Wk(t){const e=t.props.framebuffer;return!e||e.handle===null}function bw(t,e){if(!t)return e;const i=Number.parseInt(t,10);return Number.isFinite(i)?i:e}function y0(t,e,i){if(t===e)return!0;
2153if(!i||!t||!e)return!1;if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!y0(t[n],e[n],i-1))return!1;return!0}if(Array.isArray(e))return!1;if(typeof t=="object"&&typeof e=="object"){const n=Object.keys(t),o=Object.keys(e);if(n.length!==o.length)return!1;for(const d of n)if(!e.hasOwnProperty(d)||!y0(t[d],e[d],i-1))return!1;return!0}return!1}class fb{constructor(e){Y(this,"bufferLayouts");this.bufferLayouts=e}getBufferLayout(e){return this.bufferLayouts.find(i=>i.name===e)||null}getAttributeNamesForBuffer(e){var i;return e.attributes?(i=e.attributes)==null?void 0:i.map(n=>n.attribute):[e.name]}mergeBufferLayouts(e,i){const n=[...e];for(const o of i){const d=n.findIndex(p=>p.name===o.name);d<0?n.push(o):n[d]=o}return n}getBufferIndex(e){const i=this.bufferLayouts.findIndex(n=>n.name===e);return i===-1&&at.warn(`BufferLayout: Missing buffer for "${e}".`)(),i}}function xw(t,e){let i=1/0;for(const n of t){const o=e[n];o!==void 0&&(i=Math.min(i,o))}return i}function Xk(t,e){const i=Object.fromEntries(t.attributes.map(o=>[o.name,o.location])),n=e.slice();return n.sort((o,d)=>{const p=o.attributes?o.attributes.map(B=>B.attribute):[o.name],h=d.attributes?d.attributes.map(B=>B.attribute):[d.name],A=xw(p,i),R=xw(h,i);return A-R}),n}function ww(t,e){if(!t||!e.some(n=>{var o;return(o=n.bindingLayout)==null?void 0:o.length}))return t;const i={...t,bindings:t.bindings.map(n=>({...n}))};"attributes"in(t||{})&&(i.attributes=(t==null?void 0:t.attributes)||[]);for(const n of e)for(const o of n.bindingLayout||[])for(const d of Zk(o.name)){const p=i.bindings.find(h=>h.name===d);(p==null?void 0:p.group)===0&&(p.group=o.group)}return i}function qk(t){return!!(t.uniformTypes&&!Yk(t.uniformTypes))}function Zk(t){const e=new Set([t,`${t}Uniforms`]);return t.endsWith("Uniforms")||e.add(`${t}Sampler`),[...e]}function Yk(t){for(const e in t)return!1;return!0}function Gk(t){return mR(t)||typeof t=="number"||typeof t=="boolean"}function Kk(t,e={}){const i={bindings:{},uniforms:{}};return Object.keys(t).forEach(n=>{const o=t[n];Object.prototype.hasOwnProperty.call(e,n)||Gk(o)?i.uniforms[n]=o:i.bindings[n]=o}),i}class Qk{constructor(e,i){Y(this,"options",{disableWarnings:!1});Y(this,"modules");Y(this,"moduleUniforms");Y(this,"moduleBindings");Object.assign(this.options,i);const n=ex(Object.values(e).filter(Jk));for(const o of n)e[o.name]=o;at.log(1,"Creating ShaderInputs with modules",Object.keys(e))(),this.modules=e,this.moduleUniforms={},this.moduleBindings={};for(const[o,d]of Object.entries(e))d&&(this._addModule(d),d.name&&o!==d.name&&!this.options.disableWarnings&&at.warn(`Module name: ${o} vs ${d.name}`)())}destroy(){}setProps(e){var i;for(const n of Object.keys(e)){const o=n,d=e[o]||{},p=this.modules[o];if(!p)this.options.disableWarnings||at.warn(`Module ${n} not found`)();else{const h=this.moduleUniforms[o],A=this.moduleBindings[o],R=((i=p.getUniforms)==null?void 0:i.call(p,d,h))||d,{uniforms:B,bindings:N}=Kk(R,p.uniformTypes);this.moduleUniforms[o]=Tw(h,B,p.uniformTypes),this.moduleBindings[o]={...A,...N}}}}getModules(){return Object.values(this.modules)}getUniformValues(){return this.moduleUniforms}getBindingValues(){const e={};for(const i of Object.values(this.moduleBindings))Object.assign(e,i);return e}getDebugTable(){var i;const e={};for(const[n,o]of Object.entries(this.moduleUniforms))for(const[d,p]of Object.entries(o))e[`${n}.${d}`]={type:(i=this.modules[n].uniformTypes)==null?void 0:i[d],value:String(p)};return e}_addModule(e){const i=e.name;this.moduleUniforms[i]=Tw({},e.defaultUniforms||{},e.uniformTypes),this.moduleBindings[i]={}}}function Tw(t={},e={},i={}){const n={...t};for(const[o,d]of Object.entries(e))d!==void 0&&(n[o]=v0(t[o],d,i[o]));return n}function v0(t,e,i){if(!i||typeof i=="string")return ig(e);if(Array.isArray(i)){if(b0(e)||!Array.isArray(e))return ig(e);const p=Array.isArray(t)&&!b0(t)?[...t]:[],h=p.slice();for(let A=0;A<e.length;A++){const R=e[A];R!==void 0&&(h[A]=v0(p[A],R,i[0]))}return h}if(!x0(e))return ig(e);const n=i,o=x0(t)?t:{},d={...o};for(const[p,h]of Object.entries(e))h!==void 0&&(d[p]=v0(o[p],h,n[p]));return d}function ig(t){return ArrayBuffer.isView(t)?Array.prototype.slice.call(t):Array.isArray(t)?b0(t)?t.slice():t.map(i=>i===void 0?void 0:ig(i)):x0(t)?Object.fromEntries(Object.entries(t).map(([e,i])=>[e,i===void 0?void 0:ig(i)])):t}function b0(t){return ArrayBuffer.isView(t)||Array.isArray(t)&&(t.length===0||typeof t[0]=="number")}function x0(t){return!!t&&typeof t=="object"&&!Array.isArray(t)&&!ArrayBuffer.isView(t)}
2153function Jk(t){return!!(t!=null&&t.dependencies)}const B2={"+X":0,"-X":1,"+Y":2,"-Y":3,"+Z":4,"-Z":5};function Vm(t){return t?Array.isArray(t)?t[0]??null:t:null}function eB(t){const{dimension:e,data:i}=t;if(!i)return null;switch(e){case"1d":{const n=Vm(i);if(!n)return null;const{width:o}=$m(n);return{width:o,height:1}}case"2d":{const n=Vm(i);return n?$m(n):null}case"3d":case"2d-array":{if(!Array.isArray(i)||i.length===0)return null;const n=Vm(i[0]);return n?$m(n):null}case"cube":{const n=Object.keys(i)[0]??null;if(!n)return null;const o=i[n],d=Vm(o);return d?$m(d):null}case"cube-array":{if(!Array.isArray(i)||i.length===0)return null;const n=i[0],o=Object.keys(n)[0]??null;if(!o)return null;const d=Vm(n[o]);return d?$m(d):null}default:return null}}function $m(t){if(ax(t))return t2(t);if(typeof t=="object"&&"width"in t&&"height"in t)return{width:t.width,height:t.height};throw new Error("Unsupported mip-level data")}function tB(t){return typeof t=="object"&&t!==null&&"data"in t&&"width"in t&&"height"in t}function iB(t){return ArrayBuffer.isView(t)}function N2(t){const{textureFormat:e,format:i}=t;if(e&&i&&e!==i)throw new Error(`Conflicting texture formats "${e}" and "${i}" provided for the same mip level`);return e??i}function z2(t){const e=B2[t];if(e===void 0)throw new Error(`Invalid cube face: ${t}`);return e}function nB(t,e){return 6*t+z2(e)}function L2(t){throw new Error("setTexture1DData not supported in WebGL.")}function rB(t){return Array.isArray(t)?t:[t]}function Ap(t,e,i,n){const o=rB(e),d=t,p=[];for(let h=0;h<o.length;h++){const A=o[h];if(ax(A))p.push({type:"external-image",image:A,z:d,mipLevel:h});else if(tB(A))p.push({type:"texture-data",data:A,textureFormat:N2(A),z:d,mipLevel:h});else if(iB(A)&&i)p.push({type:"texture-data",data:{data:A,width:Math.max(1,i.width>>h),height:Math.max(1,i.height>>h),...n?{format:n}:{}},textureFormat:n,z:d,mipLevel:h});else throw new Error("Unsupported 2D mip-level payload")}return p}function F2(t){const e=[];for(let i=0;i<t.length;i++)e.push(...Ap(i,t[i]));return e}function U2(t){const e=[];for(let i=0;i<t.length;i++)e.push(...Ap(i,t[i]));return e}function j2(t){const e=[];for(const[i,n]of Object.entries(t)){const o=z2(i);e.push(...Ap(o,n))}return e}function V2(t){const e=[];return t.forEach((i,n)=>{for(const[o,d]of Object.entries(i)){const p=nB(n,o);e.push(...Ap(p,d))}}),e}const tv=class tv{constructor(e,i){Y(this,"device");Y(this,"id");Y(this,"props");Y(this,"_texture",null);Y(this,"_sampler",null);Y(this,"_view",null);Y(this,"ready");Y(this,"isReady",!1);Y(this,"destroyed",!1);Y(this,"resolveReady",()=>{});Y(this,"rejectReady",()=>{});this.device=e;const n=dv("dynamic-texture"),o=i;this.props={...tv.defaultProps,id:n,...i,data:null},this.id=this.props.id,this.ready=new Promise((d,p)=>{this.resolveReady=d,this.rejectReady=p}),this.initAsync(o)}get texture(){if(!this._texture)throw new Error("Texture not initialized yet");return this._texture}get sampler(){if(!this._sampler)throw new Error("Sampler not initialized yet");return this._sampler}get view(){if(!this._view)throw new Error("View not initialized yet");return this._view}get[Symbol.toStringTag](){return"DynamicTexture"}toString(){var n,o;const e=((n=this._texture)==null?void 0:n.width)??this.props.width??"?",i=((o=this._texture)==null?void 0:o.height)??this.props.height??"?";return`DynamicTexture:"${this.id}":${e}x${i}px:(${this.isReady?"ready":"loading..."})`}async initAsync(e){try{const i=await this._loadAllData(e);this._checkNotDestroyed();const n=i.data?sB({...i,width:e.width,height:e.height,format:e.format}):[],o="format"in e&&e.format!==void 0,d="usage"in e&&e.usage!==void 0,h=(()=>
2153{if(this.props.width&&this.props.height)return{width:this.props.width,height:this.props.height};const se=eB(i);return se||{width:this.props.width||1,height:this.props.height||1}})();if(!h||h.width<=0||h.height<=0)throw new Error(`${this} size could not be determined or was zero`);const A=aB(this.device,n,h,{format:o?e.format:void 0}),R=A.format??this.props.format,B={...this.props,...h,format:R,mipLevels:1,data:void 0};this.device.isTextureFormatCompressed(R)&&!d&&(B.usage=Dn.SAMPLE|Dn.COPY_DST);const N=this.props.mipmaps&&!A.hasExplicitMipChain&&!this.device.isTextureFormatCompressed(R);if(this.device.type==="webgpu"&&N){const se=this.props.dimension==="3d"?Dn.SAMPLE|Dn.STORAGE|Dn.COPY_DST|Dn.COPY_SRC:Dn.SAMPLE|Dn.RENDER|Dn.COPY_DST|Dn.COPY_SRC;B.usage|=se}const F=this.device.getMipLevelCount(B.width,B.height),Q=A.hasExplicitMipChain?A.mipLevels:this.props.mipLevels==="auto"?F:Math.max(1,Math.min(F,this.props.mipLevels??1)),re={...B,mipLevels:Q};this._texture=this.device.createTexture(re),this._sampler=this.texture.sampler,this._view=this.texture.view,A.subresources.length&&this._setTextureSubresources(A.subresources),this.props.mipmaps&&!A.hasExplicitMipChain&&!N&&at.warn(`${this} skipping auto-generated mipmaps for compressed texture format`)(),N&&this.generateMipmaps(),this.isReady=!0,this.resolveReady(this.texture),at.info(0,`${this} created`)()}catch(i){const n=i instanceof Error?i:new Error(String(i));this.rejectReady(n)}}destroy(){this._texture&&(this._texture.destroy(),this._texture=null,this._sampler=null,this._view=null),this.destroyed=!0}generateMipmaps(){this.device.type==="webgl"?this.texture.generateMipmapsWebGL():this.device.type==="webgpu"?this.device.generateMipmapsWebGPU(this.texture):at.warn(`${this} mipmaps not supported on ${this.device.type}`)}setSampler(e={}){this._checkReady();const i=e instanceof op?e:this.device.createSampler(e);this.texture.setSampler(i),this._sampler=i}async readBuffer(e={}){this.isReady||await this.ready;const i=e.width??this.texture.width,n=e.height??this.texture.height,o=e.depthOrArrayLayers??this.texture.depth,d=this.texture.computeMemoryLayout({width:i,height:n,depthOrArrayLayers:o}),p=this.device.createBuffer({byteLength:d.byteLength,usage:En.COPY_DST|En.MAP_READ});this.texture.readBuffer({...e,width:i,height:n,depthOrArrayLayers:o},p);const h=this.device.createFence();return await h.signaled,h.destroy(),p}async readAsync(e={}){this.isReady||await this.ready;const i=e.width??this.texture.width,n=e.height??this.texture.height,o=e.depthOrArrayLayers??this.texture.depth,d=this.texture.computeMemoryLayout({width:i,height:n,depthOrArrayLayers:o}),p=await this.readBuffer(e),h=await p.readAsync(0,d.byteLength);return p.destroy(),h.buffer}resize(e){if(this._checkReady(),e.width===this.texture.width&&e.height===this.texture.height)return!1;const i=this.texture;return this._texture=i.clone(e),this._sampler=this.texture.sampler,this._view=this.texture.view,i.destroy(),at.info(`${this} resized`),!0}getCubeFaceIndex(e){const i=B2[e];if(i===void 0)throw new Error(`Invalid cube face: ${e}`);return i}getCubeArrayFaceIndex(e,i){return 6*e+this.getCubeFaceIndex(i)}setTexture1DData(e){if(this._checkReady(),this.texture.props.dimension!=="1d")throw new Error(`${this} is not 1d`);const i=L2();this._setTextureSubresources(i)}setTexture2DData(e,i=0){if(this._checkReady(),this.texture.props.dimension!=="2d")throw new Error(`${this} is not 2d`);const n=Ap(i,e);this._setTextureSubresources(n)}setTexture3DData(e){if(this.texture.props.dimension!=="3d")throw new Error(`${this} is not 3d`);const i=F2(e);this._setTextureSubresources(i)}setTextureArrayData(e){if(this.texture.props.dimension!=="2d-array")throw new Error(`${this} is not 2d-array`);const i=U2(e);this._setTextureSubresources(i)}setTextureCubeData(e){if(this.texture.props.dimension!=="cube")throw new Error(`${this} is not cube`);const i=j2(e);this._setTextureSubresources(i)}setTextureCubeArrayData(e){if(this.texture.props.dimension!=="cube-array")throw new Error(`${this} is not cube-array`);const i=V2(e);this._setTextureSubresources(i)}_setTextureSubresources(e){for(const i of e){const{z:n,mipLevel:o}=i;switch(i.type){case"external-image":const{image:d,flipY:p}=i;this.texture.copyExternalImage({image:d,z:n,mipLevel:o,flipY:p});break;case"texture-data":const{data:h,textureFormat:A}=i;if(A&&A!==this.texture.format)throw new Error(`${this} mip level ${o} uses format "${A}" but texture format is "${this.texture.format}"`);this.texture.writeData(h.data,{x:0,y:0,z:n,width:h.width,height:h.height,depthOrArrayLayers:1,mipLevel:o});break;default:throw new Error("Unsupported 2D mip-level payload")}}}async _loadAllData(e){const i=await w0(e.data);return{dimension:e.dimension??"2d",data:i??null}}_checkNotDestroyed(){this.destroyed&&at.warn(`${this} already destroyed`)}_checkReady(){this.isReady||at.warn(`${this} Cannot perform this operation before ready`)}};Y(tv,"defaultProps",{...Dn.defaultProps,dimension:"2d",data:null,mipmaps:!1});let Zf=tv;function sB(t){if(!t.data)return[];const e=t.width&&t.height?{width:t.width,height:t.height}:void 0,i="format"in t?t.format:void 0;switch(t.dimension){case"1d":return L2();case"2d":return Ap(0,t.data,e,i);case"3d":return F2(t.data);case"2d-array":return U2(t.data);case"cube":return j2(t.data);case"cube-array":return V2(t.data);default:throw new Error(`Unhandled dimension ${t.dimension}`)}}function aB(t,e,i,n){if(e.length===0)return{subresources:e,mipLevels:1,format:n.format,hasExplicitMipChain:!1};const o=new Map;for(const B of e){const N=o.get(B.z)??[];N.push(B),o.set(B.z,N)}const d=e.some(B=>B.mipLevel>0);let p=n.format,h=Number.POSITIVE_INFINITY;const A=[];for(const[B,N]of o){const F=[...N].sort((we,ve)=>we.mipLevel-ve.mipLevel),Q=F[0];if(!Q||Q.mipLevel!==0)throw new Error(`DynamicTexture: slice ${B} is missing mip level 0`);const re=Aw(t,Q);if(re.width!==i.width||re.height!==i.height)throw new Error(`DynamicTexture: slice ${B} base level dimensions ${re.width}x${re.height} do not match expected ${i.width}x${i.height}`);const se=Sw(Q);if(se){if(p&&p!==se)throw new Error(`DynamicTexture: slice ${B} base level format "${se}" does not match texture format "${p}"`);p=se}const ae=p&&t.isTextureFormatCompressed(p)?oB(t,re.width,re.height,p):t.getMipLevelCount(re.width,re.height);let me=0;for(let we=0;we<F.length;we++){const ve=F[we];if(!ve||ve.mipLevel!==we||we>=ae)break;const Oe=Aw(t,ve),Te=Math.max(1,re.width>>we),Re=Math.max(1,re.height>>we);if(Oe.width!==Te||Oe.height!==Re)break;const Ee=Sw(ve);if(Ee&&(p||(p=Ee),Ee!==p))break;me++,A.push(ve)}h=Math.min(h,me)}const R=Number.isFinite(h)?Math.max(1,h):1;return{subresources:A.filter(B=>B.mipLevel<R),mipLevels:R,format:p,hasExplicitMipChain:d}}function Sw(t){if(t.type==="texture-data")return t.textureFormat??N2(t.data)}function Aw(t,e){switch(e.type){case"external-image":return t.getExternalImageSize(e.image);case"texture-data":return{width:e.data.width,height:e.data.height};default:throw new Error("Unsupported texture subresource")}}function oB(t,e,i,n){const{blockWidth:o=1,blockHeight:d=1}=t.getTextureFormatInfo(n);let p=1;for(let h=1;;h++){const A=Math.max(1,e>>h),R=Math.max(1,i>>h);if(A<o||R<d)break;p++}return p}async function w0(t){if(t=await t,Array.isArray(t))return await Promise.all(t.map(w0));if(t&&typeof t=="object"&&t.constructor===Object){const e=t,i=await Promise.all(Object.values(e).map(w0)),n=Object.keys(e),o={};for(let d=0;d<n.length;d++)o[n[d]]=i[d];return o}return t}const rh=2,lB=1e4,Ew="render pipeline initialization failed",iv=class iv{constructor(e,i){Y(this,"device");Y(this,"id");Y(this,"source");Y(this,"vs");Y(this,"fs");Y(this,"pipelineFactory");Y(this,"shaderFactory");Y(this,"userData",{});Y(this,"parameters");Y(this,"topology");Y(this,"bufferLayout");Y(this,"isInstanced");Y(this,"instanceCount",0);Y(this,"vertexCount");Y(this,"indexBuffer",null);Y(this,"bufferAttributes",{});Y(this,"constantAttributes",{});Y(this,"bindings",{});Y(this,"vertexArray");Y(this,"transformFeedback",null);Y(this,"pipeline");Y(this,"shaderInputs");Y(this,"material",null);Y(this,"_uniformStore");Y(this,"_attributeInfos",{});Y(this,"_gpuGeometry",null);Y(this,"props");Y(this,"_pipelineNeedsUpdate","newly created");Y(this,"_needsRedraw","initializing");Y(this,"_destroyed",!1);Y(this,"_lastDrawTimestamp",-1);Y(this,"_bindingTable",[]);Y(this,"_lastLogTime",0);Y(this,"_logOpen",!1);Y(this,"_drawCount",0);var A,R,B,N;this.props={...iv.defaultProps,...i},i=this.props,this.id=i.id||dv("model"),this.device=e,Object.assign(this.userData,i.userData),this.material=i.material||null;const n=Object.fromEntries(((A=this.props.modules)==null?void 0:A.map(F=>[F.name,F]))||[]),o=i.shaderInputs||new Qk(n,{disableWarnings:this.props.disableWarnings});this.setShaderInputs(o);const d=cB(e),p=(((R=this.props.modules)==null?void 0:R.length)>0?this.props.modules:(B=this.shaderInputs)==null?void 0:B.getModules())||[];if(this.props.shaderLayout=ww(this.props.shaderLayout,p)||null,this.device.type==="webgpu"&&this.props.source){const{source:F,getUniforms:Q,bindingTable:re}=this.props.shaderAssembler.assembleWGSLShader({platformInfo:d,...this.props,modules:p});this.source=F,this._getModuleUniforms=Q,this._bindingTable=re;const se=(N=e.getShaderLayout)==null?void 0:N.call(e,this.source);this.props.shaderLayout=ww(this.props.shaderLayout||se||null,p)||null}else{const{vs:F,fs:Q,getUniforms:re}=this.props.shaderAssembler.assembleGLSLShaderPair({platformInfo:d,...this.props,modules:p});
2153this.vs=F,this.fs=Q,this._getModuleUniforms=re,this._bindingTable=[]}this.vertexCount=this.props.vertexCount,this.instanceCount=this.props.instanceCount,this.topology=this.props.topology,this.bufferLayout=this.props.bufferLayout,this.parameters=this.props.parameters,i.geometry&&this.setGeometry(i.geometry),this.pipelineFactory=i.pipelineFactory||e0.getDefaultPipelineFactory(this.device),this.shaderFactory=i.shaderFactory||t0.getDefaultShaderFactory(this.device),this.pipeline=this._updatePipeline(),this.vertexArray=e.createVertexArray({shaderLayout:this.pipeline.shaderLayout,bufferLayout:this.pipeline.bufferLayout}),this._gpuGeometry&&this._setGeometryAttributes(this._gpuGeometry),"isInstanced"in i&&(this.isInstanced=i.isInstanced),i.instanceCount&&this.setInstanceCount(i.instanceCount),i.vertexCount&&this.setVertexCount(i.vertexCount),i.indexBuffer&&this.setIndexBuffer(i.indexBuffer),i.attributes&&this.setAttributes(i.attributes),i.constantAttributes&&this.setConstantAttributes(i.constantAttributes),i.bindings&&this.setBindings(i.bindings),i.transformFeedback&&(this.transformFeedback=i.transformFeedback)}get[Symbol.toStringTag](){return"Model"}toString(){return`Model(${this.id})`}destroy(){var e;this._destroyed||(this.pipelineFactory.release(this.pipeline),this.shaderFactory.release(this.pipeline.vs),this.pipeline.fs&&this.pipeline.fs!==this.pipeline.vs&&this.shaderFactory.release(this.pipeline.fs),this._uniformStore.destroy(),(e=this._gpuGeometry)==null||e.destroy(),this._destroyed=!0)}needsRedraw(){this._getBindingsUpdateTimestamp()>this._lastDrawTimestamp&&this.setNeedsRedraw("contents of bound textures or buffers updated");const e=this._needsRedraw;return this._needsRedraw=!1,e}setNeedsRedraw(e){this._needsRedraw||(this._needsRedraw=e)}getBindingDebugTable(){return this._bindingTable}predraw(){this.updateShaderInputs(),this.pipeline=this._updatePipeline()}draw(e){const i=this._areBindingsLoading();if(i)return at.info(rh,`>>> DRAWING ABORTED ${this.id}: ${i} not loaded`)(),!1;try{e.pushDebugGroup(`${this}.predraw(${e})`),this.predraw()}finally{e.popDebugGroup()}let n,o=this.pipeline.isErrored;try{if(e.pushDebugGroup(`${this}.draw(${e})`),this._logDrawCallStart(),this.pipeline=this._updatePipeline(),o=this.pipeline.isErrored,o)at.info(rh,`>>> DRAWING ABORTED ${this.id}: ${Ew}`)(),n=!1;else{const d=this._getBindings(),p=this._getBindGroups(),{indexBuffer:h}=this.vertexArray,A=h?h.byteLength/(h.indexType==="uint32"?4:2):void 0;n=this.pipeline.draw({renderPass:e,vertexArray:this.vertexArray,isInstanced:this.isInstanced,vertexCount:this.vertexCount,instanceCount:this.instanceCount,indexCount:A,transformFeedback:this.transformFeedback||void 0,bindings:d,bindGroups:p,_bindGroupCacheKeys:this._getBindGroupCacheKeys(),uniforms:this.props.uniforms,parameters:this.parameters,topology:this.topology})}}finally{e.popDebugGroup(),this._logDrawCallEnd()}return this._logFramebuffer(e),n?(this._lastDrawTimestamp=this.device.timestamp,this._needsRedraw=!1):o?this._needsRedraw=Ew:this._needsRedraw="waiting for resource initialization",n}setGeometry(e){var n;(n=this._gpuGeometry)==null||n.destroy();const i=e&&Nk(this.device,e);if(i){this.setTopology(i.topology||"triangle-list");const o=new fb(this.bufferLayout);this.bufferLayout=o.mergeBufferLayouts(i.bufferLayout,this.bufferLayout),this.vertexArray&&this._setGeometryAttributes(i)}this._gpuGeometry=i}setTopology(e){e!==this.topology&&(this.topology=e,this._setPipelineNeedsUpdate("topology"))}setBufferLayout(e){const i=new fb(this.bufferLayout);this.bufferLayout=this._gpuGeometry?i.mergeBufferLayouts(e,this._gpuGeometry.bufferLayout):e,this._setPipelineNeedsUpdate("bufferLayout"),this.pipeline=this._updatePipeline(),this.vertexArray=this.device.createVertexArray({shaderLayout:this.pipeline.shaderLayout,bufferLayout:this.pipeline.bufferLayout}),this._gpuGeometry&&this._setGeometryAttributes(this._gpuGeometry)}setParameters(e){y0(e,this.parameters,2)||(this.parameters=e,this._setPipelineNeedsUpdate("parameters"))}setInstanceCount(e){this.instanceCount=e,this.isInstanced===void 0&&e>0&&(this.isInstanced=!0),this.setNeedsRedraw("instanceCount")}setVertexCount(e){this.vertexCount=e,this.setNeedsRedraw("vertexCount")}setShaderInputs(e){var i;this.shaderInputs=e,this._uniformStore=new aD(this.device,this.shaderInputs.modules);for(const[n,o]of Object.entries(this.shaderInputs.modules))if(qk(o)&&!((i=this.material)!=null&&i.ownsModule(n))){const d=this._uniformStore.getManagedUniformBuffer(n);this.bindings[`${n}Uniforms`]=d}this.setNeedsRedraw("shaderInputs")}setMaterial(e){this.material=e,this.setNeedsRedraw("material")}updateShaderInputs(){this._uniformStore.setUniforms(this.shaderInputs.getUniformValues()),this.setBindings(this._getNonMaterialBindings(this.shaderInputs.getBindingValues())),this.setNeedsRedraw("shaderInputs")}setBindings(e){Object.assign(this.bindings,e),this.setNeedsRedraw("bindings")}setTransformFeedback(e){this.transformFeedback=e,this.setNeedsRedraw("transformFeedback")}setIndexBuffer(e){this.vertexArray.setIndexBuffer(e),this.setNeedsRedraw("indexBuffer")}setAttributes(e,i){const n=(i==null?void 0:i.disableWarnings)??this.props.disableWarnings;e.indices&&at.warn(`Model:${this.id} setAttributes() - indexBuffer should be set using setIndexBuffer()`)(),this.bufferLayout=Xk(this.pipeline.shaderLayout,this.bufferLayout);const o=new fb(this.bufferLayout);for(const[d,p]of Object.entries(e)){const h=o.getBufferLayout(d);if(!h){n||at.warn(`Model(${this.id}): Missing layout for buffer "${d}".`)();continue}const A=o.getAttributeNamesForBuffer(h);let R=!1;for(const B of A){const N=this._attributeInfos[B];if(N){const F=this.device.type==="webgpu"?o.getBufferIndex(N.bufferName):N.location;this.vertexArray.setBuffer(F,p),R=!0}}!R&&!n&&at.warn(`Model(${this.id}): Ignoring buffer "${p.id}" for unknown attribute "${d}"`)()}this.setNeedsRedraw("attributes")}setConstantAttributes(e,i){for(const[n,o]of Object.entries(e)){const d=this._attributeInfos[n];d?this.vertexArray.setConstantWebGL(d.location,o):((i==null?void 0:i.disableWarnings)??this.props.disableWarnings)||at.warn(`Model "${this.id}: Ignoring constant supplied for unknown attribute "${n}"`)()}this.setNeedsRedraw("constants")}_areBindingsLoading(){var e;
2153for(const i of Object.values(this.bindings))if(i instanceof Zf&&!i.isReady)return i.id;for(const i of Object.values(((e=this.material)==null?void 0:e.bindings)||{}))if(i instanceof Zf&&!i.isReady)return i.id;return!1}_getBindings(){const e={};for(const[i,n]of Object.entries(this.bindings))n instanceof Zf?n.isReady&&(e[i]=n.texture):e[i]=n;return e}_getBindGroups(){var n;const e=((n=this.pipeline)==null?void 0:n.shaderLayout)||this.props.shaderLayout||{bindings:[]},i=e.bindings.length?s2(e,this._getBindings()):{0:this._getBindings()};if(!this.material)return i;for(const[o,d]of Object.entries(this.material.getBindingsByGroup())){const p=Number(o);i[p]={...i[p]||{},...d}}return i}_getBindGroupCacheKeys(){var i;const e=(i=this.material)==null?void 0:i.getBindGroupCacheKey(3);return e?{3:e}:{}}_getBindingsUpdateTimestamp(){var i;let e=0;for(const n of Object.values(this.bindings))n instanceof wy?e=Math.max(e,n.texture.updateTimestamp):n instanceof En||n instanceof Dn?e=Math.max(e,n.updateTimestamp):n instanceof Zf?e=n.texture?Math.max(e,n.texture.updateTimestamp):1/0:n instanceof op||(e=Math.max(e,n.buffer.updateTimestamp));return Math.max(e,((i=this.material)==null?void 0:i.getBindingsUpdateTimestamp())||0)}_setGeometryAttributes(e){const i={...e.attributes};for(const[n]of Object.entries(i))!this.pipeline.shaderLayout.attributes.find(o=>o.name===n)&&n!=="positions"&&delete i[n];this.vertexCount=e.vertexCount,this.setIndexBuffer(e.indices||null),this.setAttributes(e.attributes,{disableWarnings:!0}),this.setAttributes(i,{disableWarnings:this.props.disableWarnings}),this.setNeedsRedraw("geometry attributes")}_setPipelineNeedsUpdate(e){this._pipelineNeedsUpdate||(this._pipelineNeedsUpdate=e),this.setNeedsRedraw(e)}_updatePipeline(){if(this._pipelineNeedsUpdate){let e=null,i=null;this.pipeline&&(at.log(1,`Model ${this.id}: Recreating pipeline because "${this._pipelineNeedsUpdate}".`)(),e=this.pipeline.vs,i=this.pipeline.fs),this._pipelineNeedsUpdate=!1;const n=this.shaderFactory.createShader({id:`${this.id}-vertex`,stage:"vertex",source:this.source||this.vs,debugShaders:this.props.debugShaders});let o=null;this.source?o=n:this.fs&&(o=this.shaderFactory.createShader({id:`${this.id}-fragment`,stage:"fragment",source:this.source||this.fs,debugShaders:this.props.debugShaders})),this.pipeline=this.pipelineFactory.createRenderPipeline({...this.props,bindings:void 0,bufferLayout:this.bufferLayout,topology:this.topology,parameters:this.parameters,bindGroups:this._getBindGroups(),vs:n,fs:o}),this._attributeInfos=o2(this.pipeline.shaderLayout,this.bufferLayout),e&&this.shaderFactory.release(e),i&&i!==e&&this.shaderFactory.release(i)}return this.pipeline}_logDrawCallStart(){const e=at.level>3?0:lB;at.level<2||Date.now()-this._lastLogTime<e||(this._lastLogTime=Date.now(),this._logOpen=!0,at.group(rh,`>>> DRAWING MODEL ${this.id}`,{collapsed:at.level<=2})())}_logDrawCallEnd(){if(this._logOpen){const e=Fk(this.pipeline.shaderLayout,this.id);at.table(rh,e)();const i=this.shaderInputs.getDebugTable();at.table(rh,i)();const n=this._getAttributeDebugTable();at.table(rh,this._attributeInfos)(),at.table(rh,n)(),at.groupEnd(rh)(),this._logOpen=!1}}_logFramebuffer(e){const i=this.device.props.debugFramebuffers;if(this._drawCount++,!i)return;const n=e.props.framebuffer;Uk(e,n,{id:(n==null?void 0:n.id)||`${this.id}-framebuffer`,minimap:!0})}_getAttributeDebugTable(){const e={};for(const[i,n]of Object.entries(this._attributeInfos)){const o=this.vertexArray.attributes[n.location];e[n.location]={name:i,type:n.shaderType,values:o?this._getBufferOrConstantValues(o,n.bufferDataType):"null"}}if(this.vertexArray.indexBuffer){const{indexBuffer:i}=this.vertexArray,n=i.indexType==="uint32"?new Uint32Array(i.debugData):new Uint16Array(i.debugData);e.indices={name:"indices",type:i.indexType,values:n.toString()}}return e}_getBufferOrConstantValues(e,i){const n=$c.getTypedArrayConstructor(i);return(e instanceof En?new n(e.debugData):e).toString()}_getNonMaterialBindings(e){if(!this.material)return e;const i={};for(const[n,o]of Object.entries(e))this.material.ownsBinding(n)||(i[n]=o);return i}};Y(iv,"defaultProps",{...hh.defaultProps,source:void 0,vs:null,fs:null,id:"unnamed",handle:void 0,userData:{},defines:{},modules:[],geometry:null,indexBuffer:null,attributes:{},constantAttributes:{},bindings:{},uniforms:{},varyings:[],isInstanced:void 0,instanceCount:0,vertexCount:0,shaderInputs:void 0,material:void 0,pipelineFactory:void 0,shaderFactory:void 0,transformFeedback:void 0,shaderAssembler:yy.getDefaultShaderAssembler(),debugShaders:void 0,disableWarnings:void 0});let pp=iv;function cB(t){return{type:t.type,shaderLanguage:t.info.shadingLanguage,shaderLanguageVersion:t.info.shadingLanguageVersion,gpu:t.info.gpu,features:t.features}}const cg=class cg{constructor(e,i=cg.defaultProps){Y(this,"device");Y(this,"model");Y(this,"transformFeedback");if(!cg.isSupported(e))throw new Error("BufferTransform not yet implemented on WebGPU");this.device=e,this.model=new pp(this.device,{id:i.id||"buffer-transform-model",fs:i.fs||uM(),topology:i.topology||"point-list",varyings:i.outputs||i.varyings,...i}),this.transformFeedback=this.device.createTransformFeedback({layout:this.model.pipeline.shaderLayout,buffers:i.feedbackBuffers}),this.model.setTransformFeedback(this.transformFeedback),Object.seal(this)}static isSupported(e){var i;return((i=e==null?void 0:e.info)==null?void 0:i.type)==="webgl"}destroy(){this.model&&this.model.destroy()}delete(){this.destroy()}run(e){e!=null&&e.inputBuffers&&this.model.setAttributes(e.inputBuffers),e!=null&&e.outputBuffers&&this.transformFeedback.setBuffers(e.outputBuffers);const i=this.device.beginRenderPass(e);this.model.draw(i),i.end()}getBuffer(e){return this.transformFeedback.getBuffer(e)}readAsync(e){const i=this.getBuffer(e);if(!i)throw new Error("BufferTransform#getBuffer");if(i instanceof En)return i.readAsync();const{buffer:n,byteOffset:o=0,byteLength:d=n.byteLength}=i;return n.readAsync(o,d)}};Y(cg,"defaultProps",{...pp.defaultProps,outputs:void 0,feedbackBuffers:void 0});let mg=cg;class $2{constructor(e){Y(this,"id");Y(this,"topology");Y(this,"vertexCount");Y(this,"indices");Y(this,"attributes");Y(this,"userData",{});const{attributes:i={},indices:n=null,vertexCount:o=null}=e;this.id=e.id||dv("geometry"),this.topology=e.topology,n&&(this.indices=ArrayBuffer.isView(n)?{value:n,size:1}:n),this.attributes={};for(const[d,p]of Object.entries(i)){const h=ArrayBuffer.isView(p)?{value:p}:p;
vendor: 12,134 bytes, line 2153
2153if(!ArrayBuffer.isView(h.value))throw new Error(`${this._print(d)}: must be typed array or object with value as typed array`);if((d==="POSITION"||d==="positions")&&!h.size&&(h.size=3),d==="indices"){if(this.indices)throw new Error("Multiple indices detected");this.indices=h}else this.attributes[d]=h}this.indices&&this.indices.isIndexed!==void 0&&(this.indices=Object.assign({},this.indices),delete this.indices.isIndexed),this.vertexCount=o||this._calculateVertexCount(this.attributes,this.indices)}getVertexCount(){return this.vertexCount}getAttributes(){return this.indices?{indices:this.indices,...this.attributes}:this.attributes}_print(e){return`Geometry ${this.id} attribute ${e}`}_setAttributes(e,i){return this}_calculateVertexCount(e,i){if(i)return i.value.length;let n=1/0;for(const o of Object.values(e)){const{value:d,size:p,constant:h}=o;!h&&d&&p!==void 0&&p>=1&&(n=Math.min(n,d.length/p))}return n}}const uB={blendColorOperation:"add",blendColorSrcFactor:"one",blendColorDstFactor:"zero",blendAlphaOperation:"add",blendAlphaSrcFactor:"constant",blendAlphaDstFactor:"zero"};class H2 extends dx{constructor(){super(...arguments),this._colorEncoderState=null}render(e){return"pickingFBO"in e?this._drawPickingBuffer(e):{decodePickingColor:null,stats:super._render(e)}}_drawPickingBuffer({layers:e,layerFilter:i,views:n,viewports:o,onViewportActive:d,pickingFBO:p,deviceRect:{x:h,y:A,width:R,height:B},cullRect:N,effects:F,pass:Q="picking",pickZ:re,shaderModuleProps:se,clearColor:ae}){this.pickZ=re;const me=this._resetColorEncoder(re),we=[h,A,R,B],ve=super._render({target:p,layers:e,layerFilter:i,views:n,viewports:o,onViewportActive:d,cullRect:N,effects:F==null?void 0:F.filter(Te=>Te.useInPicking),pass:Q,isPicking:!0,shaderModuleProps:se,clearColor:ae??[0,0,0,0],colorMask:15,scissorRect:we});return this._colorEncoderState=null,{decodePickingColor:me&&hB.bind(null,me),stats:ve}}shouldDrawLayer(e){const{pickable:i,operation:n}=e.props;return i&&n.includes("draw")||n.includes("terrain")||n.includes("mask")}getShaderModuleProps(e,i,n){return{picking:{isActive:1,isAttribute:this.pickZ},lighting:{enabled:!1}}}getLayerParameters(e,i,n){var h;const o={...e.props.parameters},{pickable:d,operation:p}=e.props;return this._colorEncoderState?d&&p.includes("draw")?(Object.assign(o,uB),o.blend=!0,this.device.type==="webgpu"?o.blendConstant=Cw(this._colorEncoderState,e,n):o.blendColor=Cw(this._colorEncoderState,e,n),p.includes("terrain")&&((h=e.state)!=null&&h._hasPickingCover)&&(o.blendAlphaSrcFactor="one")):p.includes("terrain")&&(o.blend=!1):o.blend=!1,o}_resetColorEncoder(e){return this._colorEncoderState=e?null:{byLayer:new Map,byAlpha:[]},this._colorEncoderState}}function Cw(t,e,i){const{byLayer:n,byAlpha:o}=t;let d,p=n.get(e);return p?(p.viewports.push(i),d=p.a):(d=n.size+1,d<=255?(p={a:d,layer:e,viewports:[i]},n.set(e,p),o[d]=p):(On.warn("Too many pickable layers, only picking the first 255")(),d=0)),[0,0,0,d/255]}function hB(t,e){const i=t.byAlpha[e[3]];return i&&{pickedLayer:i.layer,pickedViewports:i.viewports,pickedObjectIndex:i.layer.decodePickingColor(e)}}const Wf={NO_STATE:"Awaiting state",MATCHED:"Matched. State transferred from previous layer",INITIALIZED:"Initialized",AWAITING_GC:"Discarded. Awaiting garbage collection",AWAITING_FINALIZATION:"No longer matched. Awaiting garbage collection",FINALIZED:"Finalized! Awaiting garbage collection"},My=Symbol.for("component"),Ed=Symbol.for("propTypes"),pb=Symbol.for("deprecatedProps"),ip=Symbol.for("asyncPropDefaults"),Dd=Symbol.for("asyncPropOriginal"),fh=Symbol.for("asyncPropResolved");function W2(t,e=()=>!0){return Array.isArray(t)?X2(t,e,[]):e(t)?[t]:[]}function X2(t,e,i){let n=-1;for(;++n<t.length;){const o=t[n];Array.isArray(o)?X2(o,e,i):e(o)&&i.push(o)}return i}function dB({target:t,source:e,start:i=0,count:n=1}){const o=e.length,d=n*o;let p=0;for(let h=i;p<o;p++)t[h++]=e[p];for(;p<d;)p<d-p?(t.copyWithin(i+p,i,i+p),p*=2):(t.copyWithin(i+p,i,i+d-p),p=d);return t}class fB{constructor(e,i,n){this._loadCount=0,this._subscribers=new Set,this.id=e,this.context=n,this.setData(i)}subscribe(e){this._subscribers.add(e)}unsubscribe(e){this._subscribers.delete(e)}inUse(){return this._subscribers.size>0}delete(){}getData(){return this.isLoaded?this._error?Promise.reject(this._error):this._content:this._loader.then(()=>this.getData())}setData(e,i){if(e===this._data&&!i)return;this._data=e;const n=++this._loadCount;let o=e;typeof e=="string"&&(o=Vb(e)),o instanceof Promise?(this.isLoaded=!1,this._loader=o.then(d=>{this._loadCount===n&&(this.isLoaded=!0,this._error=void 0,this._content=d)}).catch(d=>{this._loadCount===n&&(this.isLoaded=!0,this._error=d||!0)})):(this.isLoaded=!0,this._error=void 0,this._content=e);for(const d of this._subscribers)d.onChange(this.getData())}}class pB{constructor(e){var i;this.protocol=e.protocol||"resource://",this._context={device:e.device,gl:(i=e.device)==null?void 0:i.gl,resourceManager:this},this._resources={},this._consumers={},this._pruneRequest=null}contains(e){return e.startsWith(this.protocol)?!0:e in this._resources}add({resourceId:e,data:i,forceUpdate:n=!1,persistent:o=!0}){let d=this._resources[e];d?d.setData(i,n):(d=new fB(e,i,this._context),this._resources[e]=d),d.persistent=o}remove(e){const i=this._resources[e];i&&(i.delete(),delete this._resources[e])}unsubscribe({consumerId:e}){const i=this._consumers[e];if(i){for(const n in i){const o=i[n],d=this._resources[o.resourceId];d&&d.unsubscribe(o)}delete this._consumers[e],this.prune()}}subscribe({resourceId:e,onChange:i,consumerId:n,requestId:o="default"}){const{_resources:d,protocol:p}=this;e.startsWith(p)&&(e=e.replace(p,""),d[e]||this.add({resourceId:e,data:null,persistent:!1}));const h=d[e];if(this._track(n,o,h,i),h)return h.getData()}prune(){this._pruneRequest||(this._pruneRequest=setTimeout(()=>this._prune(),0))}finalize(){for(const e in this._resources)this._resources[e].delete()}_track(e,i,n,o){const d=this._consumers,p=d[e]=d[e]||{};let h=p[i];const A=h&&h.resourceId&&this._resources[h.resourceId];A&&(A.unsubscribe(h),this.prune()),n&&(h?(h.onChange=o,h.resourceId=n.id):h={onChange:o,resourceId:n.id},p[i]=h,n.subscribe(h))}_prune(){this._pruneRequest=null;for(const e of Object.keys(this._resources)){const i=this._resources[e];!i.persistent&&!i.inUse()&&(i.delete(),delete this._resources[e])}}}const mB="layerManager.setLayers",gB="layerManager.activateViewport";class _B{constructor(e,i){var h;this._lastRenderedLayers=[],this._needsRedraw=!1,this._needsUpdate=!1,this._nextLayers=null,this._debug=!1,this._defaultShaderModulesChanged=!1,this.activateViewport=A=>{aa(gB,this,A),A&&(this.context.viewport=A)};const{deck:n,stats:o,viewport:d,timeline:p}=i||{};this.layers=[],this.resourceManager=new pB({device:e,protocol:"deck://"}),this.context={mousePosition:null,userData:{},layerManager:this,device:e,gl:e==null?void 0:e.gl,deck:n,shaderAssembler:rk(((h=e==null?void 0:e.info)==null?void 0:h.shadingLanguage)||"glsl"),defaultShaderModules:[cD],renderPass:void 0,stats:o||new sv({id:"deck.gl"}),viewport:d||new Sp({id:"DEFAULT-INITIAL-VIEWPORT"}),timeline:p||new k2,resourceManager:this.resourceManager,onError:void 0},Object.seal(this)}finalize(){this.resourceManager.finalize();for(const e of this.layers)this._finalizeLayer(e)}needsRedraw(e={clearRedrawFlags:!1}){let i=this._needsRedraw;e.clearRedrawFlags&&(this._needsRedraw=!1);for(const n of this.layers){const o=n.getNeedsRedraw(e);i=i||o}return i}needsUpdate(){return this._nextLayers&&this._nextLayers!==this._lastRenderedLayers?"layers changed":this._defaultShaderModulesChanged?"shader modules changed":this._needsUpdate}setNeedsRedraw(e){this._needsRedraw=this._needsRedraw||e}setNeedsUpdate(e){this._needsUpdate=this._needsUpdate||e}getLayers({layerIds:e}={}){return e?this.layers.filter(i=>e.find(n=>i.id.indexOf(n)===0)):this.layers}setProps(e){"debug"in e&&(this._debug=e.debug),"userData"in e&&(this.context.userData=e.userData),"layers"in e&&(this._nextLayers=e.layers),"onError"in e&&(this.context.onError=e.onError)}setLayers(e,i){aa(mB,this,i,e),this._lastRenderedLayers=e;const n=W2(e,Boolean);for(const o of n)o.context=this.context;this._updateLayers(this.layers,n)}updateLayers(){const e=this.needsUpdate();e&&(this.setNeedsRedraw(`updating layers: ${e}`),this.setLayers(this._nextLayers||this._lastRenderedLayers,e)),this._nextLayers=null}addDefaultShaderModule(e){const{defaultShaderModules:i}=this.context;i.find(n=>n.name===e.name)||(i.push(e),this._defaultShaderModulesChanged=!0)}removeDefaultShaderModule(e){const{defaultShaderModules:i}=this.context,n=i.findIndex(o=>o.name===e.name);n>=0&&(i.splice(n,1),this._defaultShaderModulesChanged=!0)}_handleError(e,i,n){n.raiseError(i,`${e} of ${n}`)}_updateLayers(e,i){const n={};for(const p of e)n[p.id]?On.warn(`Multiple old layers with same id ${p.id}`)():n[p.id]=p;if(this._defaultShaderModulesChanged){for(const p of e)p.setNeedsUpdate(),p.setChangeFlags({extensionsChanged:!0});this._defaultShaderModulesChanged=!1}const o=[];this._updateSublayersRecursively(i,n,o),this._finalizeOldLayers(n);let d=!1;for(const p of o)if(p.hasUniformTransition()){d=`Uniform transition in ${p}`;break}this._needsUpdate=d,this.layers=o}_updateSublayersRecursively(e,i,n){for(const o of e){o.context=this.context;const d=i[o.id];d===null&&On.warn(`Multiple new layers with same id ${o.id}`)(),i[o.id]=null;let p=null;try{this._debug&&d!==o&&o.validateProps(),d?(this._transferLayerState(d,o),this._updateLayer(o)):this._initializeLayer(o),n.push(o),p=o.isComposite?o.getSubLayers():null}catch(h){this._handleError("matching",h,o)}p&&this._updateSublayersRecursively(p,i,n)}}_finalizeOldLayers(e){for(const i in e){const n=e[i];n&&this._finalizeLayer(n)}}_initializeLayer(e){try{e._initialize(),e.lifecycle=Wf.INITIALIZED}catch(i){this._handleError("initialization",i,e)}}_transferLayerState(e,i){i._transferState(e),i.lifecycle=Wf.MATCHED,i!==e&&(e.lifecycle=Wf.AWAITING_GC)}_updateLayer(e){try{e._update()}catch(i){this._handleError("update",i,e)}}_finalizeLayer(e){this._needsRedraw=this._needsRedraw||`finalized ${e}`,e.lifecycle=Wf.AWAITING_FINALIZATION;try{e._finalize(),e.lifecycle=Wf.FINALIZED}catch(i){this._handleError("finalization",i,e)}}}function Xa(t,e,i){if(t===e)return!0;if(!i||!t||!e)return!1;if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!Xa(t[n],e[n],i-1))return!1;return!0}if(Array.isArray(e))return!1;if(typeof t=="object"&&typeof e=="object"){const n=Object.keys(t),o=Object.keys(e);if(n.length!==o.length)return!1;for(const d of n)if(!e.hasOwnProperty(d)||!Xa(t[d],e[d],i-1))return!1;return!0}return!1}class yB{constructor(e){this.views=[],this.width=100,this.height=100,this.viewState={},this.controllers={},this.timeline=e.timeline,this._viewports=[],this._viewportMap={},this._isUpdating=!1,this._needsRedraw="First render",this._needsUpdate="Initialize",this._eventManager=e.eventManager,this._eventCallbacks={onViewStateChange:e.onViewStateChange,onInteractionStateChange:e.onInteractionStateChange},this._pickPosition=e.pickPosition,Object.seal(this),this.setProps(e)}finalize(){for(const e in this.controllers){const i=this.controllers[e];i&&i.finalize()}this.controllers={}}needsRedraw(e={clearRedrawFlags:!1}){const i=this._needsRedraw;return e.clearRedrawFlags&&(this._needsRedraw=!1),i}setNeedsUpdate(e){this._needsUpdate=this._needsUpdate||e,this._needsRedraw=this._needsRedraw||e}updateViewStates(){for(const e in this.controllers){const i=this.controllers[e];i&&i.updateTransition()}}getViewports(e){return e?this._viewports.filter(i=>i.containsPixel(e)):this._viewports}getViews(){const e={};return this.views.forEach(i=>{e[i.id]=i}),e}getView(e){return this.views.find(i=>i.id===e)}getViewState(e){const i=typeof e=="string"?this.getView(e):e,n=i&&this.viewState[i.getViewStateId()]||this.viewState;return i?i.filterViewState(n):n}getViewport(e){return this._viewportMap[e]}unproject(e,i){const n=this.getViewports(),o={x:e[0],y:e[1]};for(let d=n.length-1;d>=0;--d){const p=n[d];if(p.containsPixel(o)){const h=e.slice();return h[0]-=p.x,h[1]-=p.y,p.unproject(h,i)}}return null}
2153setProps(e){e.views&&this._setViews(e.views),e.viewState&&this._setViewState(e.viewState),("width"in e||"height"in e)&&this._setSize(e.width,e.height),"pickPosition"in e&&(this._pickPosition=e.pickPosition),this._isUpdating||this._update()}_update(){this._isUpdating=!0,this._needsUpdate&&(this._needsUpdate=!1,this._rebuildViewports()),this._needsUpdate&&(this._needsUpdate=!1,this._rebuildViewports()),this._isUpdating=!1}_setSize(e,i){(e!==this.width||i!==this.height)&&(this.width=e,this.height=i,this.setNeedsUpdate("Size changed"))}_setViews(e){e=W2(e,Boolean),this._diffViews(e,this.views)&&this.setNeedsUpdate("views changed"),this.views=e}_setViewState(e){e?(!Xa(e,this.viewState,3)&&this.setNeedsUpdate("viewState changed"),this.viewState=e):On.warn("missing `viewState` or `initialViewState`")()}_createController(e,i){const n=i.type;return new n({timeline:this.timeline,eventManager:this._eventManager,onViewStateChange:this._eventCallbacks.onViewStateChange,onStateChange:this._eventCallbacks.onInteractionStateChange,makeViewport:d=>{var p;return(p=this.getView(e.id))==null?void 0:p.makeViewport({viewState:d,width:this.width,height:this.height})},pickPosition:this._pickPosition})}_updateController(e,i,n,o){const d=e.controller;if(d&&n){const p={...i,...d,id:e.id,x:n.x,y:n.y,width:n.width,height:n.height};return(!o||o.constructor!==d.type)&&(o=this._createController(e,p)),o&&o.setProps(p),o}return null}_rebuildViewports(){const{views:e}=this,i=this.controllers;this._viewports=[],this.controllers={};let n=!1;for(let o=e.length;o--;){const d=e[o],p=this.getViewState(d),h=d.makeViewport({viewState:p,width:this.width,height:this.height});let A=i[d.id];const R=!!d.controller;R&&!A&&(n=!0),(n||!R)&&A&&(A.finalize(),A=null),this.controllers[d.id]=this._updateController(d,p,h,A),h&&this._viewports.unshift(h)}for(const o in i){const d=i[o];d&&!this.controllers[o]&&d.finalize()}this._buildViewportMap()}_buildViewportMap(){this._viewportMap={},this._viewports.forEach(e=>{e.id&&(this._viewportMap[e.id]=this._viewportMap[e.id]||e)})}_diffViews(e,i){return e.length!==i.length?!0:e.some((n,o)=>!e[o].equals(i[o]))}}const vB=/^(?:\d+\.?\d*|\.\d+)$/;function sh(t){switch(typeof t){case"number":if(!Number.isFinite(t))throw new Error(`Could not parse position string ${t}`);return{type:"literal",value:t};case"string":try{const e=bB(t);return new xB(e).parseExpression()}catch(e){const i=e instanceof Error?e.message:String(e);throw new Error(`Could not parse position string ${t}: ${i}`)}default:throw new Error(`Could not parse position string ${t}`)}}function T0(t,e){switch(t.type){case"literal":return t.value;case"percentage":return Math.round(t.value*e);case"binary":const i=T0(t.left,e),n=T0(t.right,e);return t.operator==="+"?i+n:i-n;default:throw new Error("Unknown layout expression type")}}function ah(t,e){return T0(t,e)}function bB(t){const e=[];let i=0;for(;i<t.length;){const n=t[i];if(/\s/.test(n)){i++;continue}if(n==="+"||n==="-"||n==="("||n===")"||n==="%"){e.push({type:"symbol",value:n}),i++;continue}if(Rw(n)||n==="."){const o=i;let d=n===".";for(i++;i<t.length;){const h=t[i];if(Rw(h)){i++;continue}if(h==="."&&!d){d=!0,i++;continue}break}const p=t.slice(o,i);if(!vB.test(p))throw new Error("Invalid number token");e.push({type:"number",value:parseFloat(p)});continue}if(Mw(n)){const o=i;for(;i<t.length&&Mw(t[i]);)i++;const d=t.slice(o,i).toLowerCase();e.push({type:"word",value:d});continue}throw new Error("Invalid token in position string")}return e}class xB{constructor(e){this.index=0,this.tokens=e}parseExpression(){const e=this.parseBinaryExpression();if(this.index<this.tokens.length)throw new Error("Unexpected token at end of expression");return e}parseBinaryExpression(){let e=this.parseFactor(),i=this.peek();for(;wB(i);){this.index++;const n=this.parseFactor();e={type:"binary",operator:i.value,left:e,right:n},i=this.peek()}return e}parseFactor(){const e=this.peek();if(!e)throw new Error("Unexpected end of expression");if(e.type==="symbol"&&e.value==="+")return this.index++,this.parseFactor();if(e.type==="symbol"&&e.value==="-"){this.index++;const i=this.parseFactor();return{type:"binary",operator:"-",left:{type:"literal",value:0},right:i}}if(e.type==="symbol"&&e.value==="("){this.index++;const i=this.parseBinaryExpression();if(!this.consumeSymbol(")"))throw new Error("Missing closing parenthesis");return i}if(e.type==="word"&&e.value==="calc"){if(this.index++,!this.consumeSymbol("("))throw new Error("Missing opening parenthesis after calc");const i=this.parseBinaryExpression();if(!this.consumeSymbol(")"))throw new Error("Missing closing parenthesis");return i}if(e.type==="number"){this.index++;const i=e.value,n=this.peek();return n&&n.type==="symbol"&&n.value==="%"?(this.index++,{type:"percentage",value:i/100}):n&&n.type==="word"&&n.value==="px"?(this.index++,{type:"literal",value:i}):{type:"literal",value:i}}throw new Error("Unexpected token in expression")}consumeSymbol(e){const i=this.peek();return i&&i.type==="symbol"&&i.value===e?(this.index++,!0):!1}peek(){return this.tokens[this.index]||null}}function Rw(t){return t>="0"&&t<="9"}function Mw(t){return t>="a"&&t<="z"||t>="A"&&t<="Z"}function wB(t){return!!(t&&t.type==="symbol"&&(t.value==="+"||t.value==="-"))}function TB(t,e){const i={...t};for(const n in e)n!=="id"&&(Array.isArray(i[n])&&Array.isArray(e[n])?i[n]=SB(i[n],e[n]):i[n]=e[n]);return i}function SB(t,e){t=t.slice();for(let i=0;i<e.length;i++){const n=e[i];Number.isFinite(n)&&(t[i]=n)}return t}class AB{constructor(e){const{id:i,x:n=0,y:o=0,width:d="100%",height:p="100%",padding:h=null}=e;this.id=i||this.constructor.displayName||"view",this.props={...e,id:this.id},this._x=sh(n),this._y=sh(o),this._width=sh(d),this._height=sh(p),this._padding=h&&{left:sh(h.left||0),right:sh(h.right||0),top:sh(h.top||0),bottom:sh(h.bottom||0)}
2153,this.equals=this.equals.bind(this),Object.seal(this)}equals(e){return this===e?!0:this.constructor===e.constructor&&Xa(this.props,e.props,2)}clone(e){const i=this.constructor;return new i({...this.props,...e})}makeViewport({width:e,height:i,viewState:n}){n=this.filterViewState(n);const o=this.getDimensions({width:e,height:i});if(!o.height||!o.width)return null;const d=this.getViewportType(n);return new d({...n,...this.props,...o})}getViewStateId(){const{viewState:e}=this.props;return typeof e=="string"?e:(e==null?void 0:e.id)||this.id}filterViewState(e){return this.props.viewState&&typeof this.props.viewState=="object"?this.props.viewState.id?TB(e,this.props.viewState):this.props.viewState:e}getDimensions({width:e,height:i}){const n={x:ah(this._x,e),y:ah(this._y,i),width:ah(this._width,e),height:ah(this._height,i)};return this._padding&&(n.padding={left:ah(this._padding.left,e),top:ah(this._padding.top,i),right:ah(this._padding.right,e),bottom:ah(this._padding.bottom,i)}),n}get controller(){const e=this.props.controller;return e?e===!0?{type:this.ControllerType}:typeof e=="function"?{type:e}:{type:this.ControllerType,...e}:null}}class fv{constructor(e){this._inProgress=!1,this._handle=null,this.time=0,this.settings={duration:0},this._timeline=e}get inProgress(){return this._inProgress}start(e){var i,n;this.cancel(),this.settings=e,this._inProgress=!0,(n=(i=this.settings).onStart)==null||n.call(i,this)}end(){var e,i;this._inProgress&&(this._timeline.removeChannel(this._handle),this._handle=null,this._inProgress=!1,(i=(e=this.settings).onEnd)==null||i.call(e,this))}cancel(){var e,i;this._inProgress&&((i=(e=this.settings).onInterrupt)==null||i.call(e,this),this._timeline.removeChannel(this._handle),this._handle=null,this._inProgress=!1)}update(){var e,i;if(!this._inProgress)return!1;if(this._handle===null){const{_timeline:n,settings:o}=this;this._handle=n.addChannel({delay:n.getTime(),duration:o.duration})}return this.time=this._timeline.getTime(this._handle),this._onUpdate(),(i=(e=this.settings).onUpdate)==null||i.call(e,this),this._timeline.isFinished(this._handle)&&this.end(),!0}_onUpdate(){}}const Pw=()=>{},S0={BREAK:1,SNAP_TO_END:2,IGNORE:3},EB=t=>t,CB=S0.BREAK;class RB{constructor(e){this._onTransitionUpdate=i=>{const{time:n,settings:{interpolator:o,startProps:d,endProps:p,duration:h,easing:A}}=i,R=A(n/h),B=o.interpolateProps(d,p,R);this.propsInTransition=this.getControllerState({...this.props,...B}).getViewportProps(),this.onViewStateChange({viewState:this.propsInTransition,oldViewState:this.props})},this.getControllerState=e.getControllerState,this.propsInTransition=null,this.transition=new fv(e.timeline),this.onViewStateChange=e.onViewStateChange||Pw,this.onStateChange=e.onStateChange||Pw}finalize(){this.transition.cancel()}getViewportInTransition(){return this.propsInTransition}processViewStateChange(e){let i=!1;const n=this.props;if(this.props=e,!n||this._shouldIgnoreViewportChange(n,e))return!1;if(this._isTransitionEnabled(e)){let o=n;if(this.transition.inProgress){const{interruption:d,endProps:p}=this.transition.settings;o={...n,...d===S0.SNAP_TO_END?p:this.propsInTransition||n}}this._triggerTransition(o,e),i=!0}else this.transition.cancel();return i}updateTransition(){this.transition.update()}_isTransitionEnabled(e){const{transitionDuration:i,transitionInterpolator:n}=e;return(i>0||i==="auto")&&!!n}_isUpdateDueToCurrentTransition(e){return this.transition.inProgress&&this.propsInTransition?this.transition.settings.interpolator.arePropsEqual(e,this.propsInTransition):!1}_shouldIgnoreViewportChange(e,i){return this.transition.inProgress?this.transition.settings.interruption===S0.IGNORE||this._isUpdateDueToCurrentTransition(i):this._isTransitionEnabled(i)?i.transitionInterpolator.arePropsEqual(e,i):!0}_triggerTransition(e,i){const n=this.getControllerState(e),o=this.getControllerState(i).shortestPathFrom(n),d=i.transitionInterpolator,p=d.getDuration?d.getDuration(e,i):i.transitionDuration;if(p===0)return;const h=d.initializeProps(e,o);this.propsInTransition={};const A={duration:p,easing:i.transitionEasing||EB,interpolator:d,interruption:i.transitionInterruption||CB,startProps:h.start,endProps:h.end,onStart:i.onTransitionStart,onUpdate:this._onTransitionUpdate,onInterrupt:this._onTransitionEnd(i.onTransitionInterrupt),onEnd:this._onTransitionEnd(i.onTransitionEnd)};this.transition.start(A),this.onStateChange({inTransition:!0}),this.updateTransition()}_onTransitionEnd(e){return i=>{this.propsInTransition=null,this.onStateChange({inTransition:!1,isZooming:!1,isPanning:!1,isRotating:!1}),e==null||e(i)}}}function fs(t,e){if(!t)throw new Error(e||"deck.gl: assertion failed.")}class MB{constructor(e){const{compare:i,extract:n,required:o}=e;this._propsToCompare=i,this._propsToExtract=n||i,this._requiredProps=o}
2153arePropsEqual(e,i){for(const n of this._propsToCompare)if(!(n in e)||!(n in i)||!dg(e[n],i[n]))return!1;return!0}initializeProps(e,i){const n={},o={};for(const d of this._propsToExtract)(d in e||d in i)&&(n[d]=e[d],o[d]=i[d]);return this._checkRequiredProps(n),this._checkRequiredProps(o),{start:n,end:o}}getDuration(e,i){return i.transitionDuration}_checkRequiredProps(e){this._requiredProps&&this._requiredProps.forEach(i=>{const n=e[i];fs(Number.isFinite(n)||Array.isArray(n),`${i} is required for transition`)})}}const j_=Math.PI/180,Iw=180/Math.PI,oy=6370972,Yf=256;function PB(){const t=Yf/oy,e=Math.PI/180*Yf;return{unitsPerMeter:[t,t,t],unitsPerMeter2:[0,0,0],metersPerUnit:[1/t,1/t,1/t],unitsPerDegree:[e,e,t],unitsPerDegree2:[0,0,0],degreesPerUnit:[1/e,1/e,1/t]}}class q2 extends Sp{constructor(e={}){const{longitude:i=0,zoom:n=0,nearZMultiplier:o=.5,farZMultiplier:d=1,resolution:p=10}=e;let{latitude:h=0,height:A,altitude:R=1.5,fovy:B}=e;h=Math.max(Math.min(h,dh),-dh),A=A||1,B?R=ux(B):B=pg(R);const N=Math.pow(2,n-V_(h)),F=e.nearZ??o,Q=e.farZ??(R+Yf*2*N/A)*d,re=new ll().lookAt({eye:[0,-R,0],up:[0,0,1]});re.rotateX(h*j_),re.rotateZ(-i*j_),re.scale(N/A),super({...e,height:A,viewMatrix:re,longitude:i,latitude:h,zoom:n,distanceScales:PB(),fovy:B,focalDistance:R,near:F,far:Q}),this.scale=N,this.latitude=h,this.longitude=i,this.fovy=B,this.resolution=p}get projectionMode(){return Wa.GLOBE}getDistanceScales(){return this.distanceScales}getBounds(e={}){const i={targetZ:e.z||0},n=this.unproject([0,this.height/2],i),o=this.unproject([this.width/2,0],i),d=this.unproject([this.width,this.height/2],i),p=this.unproject([this.width/2,this.height],i);return d[0]<this.longitude&&(d[0]+=360),n[0]>this.longitude&&(n[0]-=360),[Math.min(n[0],d[0],o[0],p[0]),Math.min(n[1],d[1],o[1],p[1]),Math.max(n[0],d[0],o[0],p[0]),Math.max(n[1],d[1],o[1],p[1])]}unproject(e,{topLeft:i=!0,targetZ:n}={}){const[o,d,p]=e,h=i?d:this.height-d,{pixelUnprojectionMatrix:A}=this;let R;if(Number.isFinite(p))R=mb(A,[o,h,p,1]);else{const Q=mb(A,[o,h,-1,1]),re=mb(A,[o,h,1,1]),se=((n||0)/oy+1)*Yf,ae=Zv(XS([],Q,re)),me=Zv(Q),we=Zv(re),Oe=4*((4*me*we-(ae-me-we)**2)/16)/ae,Te=Math.sqrt(me-Oe),Re=Math.sqrt(Math.max(0,se*se-Oe)),Ee=(Te-Re)/Math.sqrt(ae);R=kM([],Q,re,Ee)}const[B,N,F]=this.unprojectPosition(R);return Number.isFinite(p)?[B,N,F]:Number.isFinite(n)?[B,N,n]:[B,N]}projectPosition(e){const[i,n,o=0]=e,d=i*j_,p=n*j_,h=Math.cos(p),A=(o/oy+1)*Yf;return[Math.sin(d)*h*A,-Math.cos(d)*h*A,Math.sin(p)*A]}unprojectPosition(e){const[i,n,o]=e,d=jM(e),p=Math.asin(o/d),A=Math.atan2(i,-n)*Iw,R=p*Iw,B=(d/Yf-1)*oy;return[A,R,B]}projectFlat(e){return e}unprojectFlat(e){return e}panByPosition([e,i,n],o,d){const h=.25/Math.pow(2,this.zoom-V_(this.latitude)),A=e+h*(d[0]-o[0]);let R=i-h*(d[1]-o[1]);R=Math.max(Math.min(R,dh),-dh);const B={longitude:A,latitude:R,zoom:n-V_(i)};return B.zoom+=V_(B.latitude),B}}q2.displayName="GlobeViewport";function V_(t){const e=Math.PI*Math.cos(t*Math.PI/180);return Math.log2(e)}function mb(t,e){const i=Tp([],e,t);return YS(i,i,1/i[3]),i}const IB=["longitude","latitude","zoom","bearing","pitch"],DB=["longitude","latitude","zoom"];class Z2 extends MB{constructor(e={}){const i=Array.isArray(e)?e:e.transitionProps,n=Array.isArray(e)?{}:e;n.transitionProps=Array.isArray(i)?{compare:i,required:i}:i||{compare:IB,required:DB},super(n.transitionProps),this.opts=n}initializeProps(e,i){const n=super.initializeProps(e,i),{makeViewport:o,around:d}=this.opts;if(o&&d)if(o(e)instanceof q2)On.warn("around not supported in GlobeView")();else{const h=o(e),A=o(i),R=h.unproject(d);n.start.around=d,Object.assign(n.end,{around:A.project(R),aroundPosition:R,width:i.width,height:i.height})}return n}interpolateProps(e,i,n){const o={};for(const d of this._propsToExtract)o[d]=vy(e[d]||0,i[d]||0,n);if(i.aroundPosition&&this.opts.makeViewport){const d=this.opts.makeViewport({...i,...o});Object.assign(o,d.panByPosition(i.aroundPosition,vy(e.around,i.around,n)))}return o}}const Lc={transitionDuration:0},OB=300,$_=t=>1-(1-t)*(1-t),Hf={WHEEL:["wheel"],PAN:["panstart","panmove","panend"],PINCH:["pinchstart","pinchmove","pinchend"],MULTI_PAN:["multipanstart","multipanmove","multipanend"],DOUBLE_CLICK:["dblclick"],KEYBOARD:["keydown"]},yd={};class kB{constructor(e){this.state={},this._events={},this._interactionState={isDragging:!1},this._customEvents=[],this._eventStartBlocked=null,this._panMove=!1,this.invertPan=!1,this.dragMode="rotate",this.inertia=0,this.scrollZoom=!0,this.dragPan=!0,this.dragRotate=!0,this.doubleClickZoom=!0,this.touchZoom=!0,this.touchRotate=!1,this.keyboard=!0,this.transitionManager=new RB({...e,getControllerState:i=>new this.ControllerState(i),onViewStateChange:this._onTransition.bind(this),onStateChange:this._setInteractionState.bind(this)}),this.handleEvent=this.handleEvent.bind(this),this.eventManager=e.eventManager,this.onViewStateChange=e.onViewStateChange||(()=>{}),this.onStateChange=e.onStateChange||(()=>{}),this.makeViewport=e.makeViewport,this.pickPosition=e.pickPosition}set events(e){this.toggleEvents(this._customEvents,!1),this.toggleEvents(e,!0),this._customEvents=e,this.props&&this.setProps(this.props)}finalize(){var e;
vendor: 9,797 bytes, line 2153
2153for(const i in this._events)this._events[i]&&((e=this.eventManager)==null||e.off(i,this.handleEvent));this.transitionManager.finalize()}handleEvent(e){this._controllerState=void 0;const i=this._eventStartBlocked;switch(e.type){case"panstart":return i?!1:this._onPanStart(e);case"panmove":return this._onPan(e);case"panend":return this._onPanEnd(e);case"pinchstart":return i?!1:this._onPinchStart(e);case"pinchmove":return this._onPinch(e);case"pinchend":return this._onPinchEnd(e);case"multipanstart":return i?!1:this._onMultiPanStart(e);case"multipanmove":return this._onMultiPan(e);case"multipanend":return this._onMultiPanEnd(e);case"dblclick":return this._onDoubleClick(e);case"wheel":return this._onWheel(e);case"keydown":return this._onKeyDown(e);default:return!1}}get controllerState(){return this._controllerState=this._controllerState||new this.ControllerState({makeViewport:this.makeViewport,...this.props,...this.state}),this._controllerState}getCenter(e){const{x:i,y:n}=this.props,{offsetCenter:o}=e;return[o.x-i,o.y-n]}isPointInBounds(e,i){const{width:n,height:o}=this.props;if(i&&i.handled)return!1;const d=e[0]>=0&&e[0]<=n&&e[1]>=0&&e[1]<=o;return d&&i&&i.stopPropagation(),d}isFunctionKeyPressed(e){const{srcEvent:i}=e;return!!(i.metaKey||i.altKey||i.ctrlKey||i.shiftKey)}isDragging(){return this._interactionState.isDragging||!1}blockEvents(e){const i=setTimeout(()=>{this._eventStartBlocked===i&&(this._eventStartBlocked=null)},e);this._eventStartBlocked=i}setProps(e){e.dragMode&&(this.dragMode=e.dragMode);const i=this.props;this.props=e,"transitionInterpolator"in e||(e.transitionInterpolator=this._getTransitionProps().transitionInterpolator),this.transitionManager.processViewStateChange(e);const{inertia:n}=e;this.inertia=Number.isFinite(n)?n:n===!0?OB:0;const{scrollZoom:o=!0,dragPan:d=!0,dragRotate:p=!0,doubleClickZoom:h=!0,touchZoom:A=!0,touchRotate:R=!1,keyboard:B=!0}=e,N=!!this.onViewStateChange;if(this.toggleEvents(Hf.WHEEL,N&&o),this.toggleEvents(Hf.PAN,N),this.toggleEvents(Hf.PINCH,N&&(A||R)),this.toggleEvents(Hf.MULTI_PAN,N&&R),this.toggleEvents(Hf.DOUBLE_CLICK,N&&h),this.toggleEvents(Hf.KEYBOARD,N&&B),this.scrollZoom=o,this.dragPan=d,this.dragRotate=p,this.doubleClickZoom=h,this.touchZoom=A,this.touchRotate=R,this.keyboard=B,(!i||i.height!==e.height||i.width!==e.width||i.maxBounds!==e.maxBounds)&&e.maxBounds){const Q=new this.ControllerState({...e,makeViewport:this.makeViewport}),re=Q.getViewportProps();Object.keys(re).some(ae=>!Xa(re[ae],e[ae],1))&&this.updateViewport(Q)}}updateTransition(){this.transitionManager.updateTransition()}toggleEvents(e,i){this.eventManager&&e.forEach(n=>{this._events[n]!==i&&(this._events[n]=i,i?this.eventManager.on(n,this.handleEvent):this.eventManager.off(n,this.handleEvent))})}updateViewport(e,i=null,n={}){const o={...e.getViewportProps(),...i},d=this.controllerState!==e;if(this.state=e.getState(),this._setInteractionState(n),d){const p=this.controllerState&&this.controllerState.getViewportProps();this.onViewStateChange&&this.onViewStateChange({viewState:o,interactionState:this._interactionState,oldViewState:p,viewId:this.props.id})}}_onTransition(e){this.onViewStateChange({...e,interactionState:this._interactionState,viewId:this.props.id})}_setInteractionState(e){Object.assign(this._interactionState,e),this.onStateChange(this._interactionState)}_onPanStart(e){const i=this.getCenter(e);if(!this.isPointInBounds(i,e))return!1;let n=this.isFunctionKeyPressed(e)||e.rightButton||!1;(this.invertPan||this.dragMode==="pan")&&(n=!n);const o=this.controllerState[n?"panStart":"rotateStart"]({pos:i});return this._panMove=n,this.updateViewport(o,Lc,{isDragging:!0}),!0}_onPan(e){return this.isDragging()?this._panMove?this._onPanMove(e):this._onPanRotate(e):!1}_onPanEnd(e){return this.isDragging()?this._panMove?this._onPanMoveEnd(e):this._onPanRotateEnd(e):!1}_onPanMove(e){if(!this.dragPan)return!1;const i=this.getCenter(e),n=this.controllerState.pan({pos:i});return this.updateViewport(n,Lc,{isDragging:!0,isPanning:!0}),!0}_onPanMoveEnd(e){const{inertia:i}=this;if(this.dragPan&&i&&e.velocity){const n=this.getCenter(e),o=[n[0]+e.velocityX*i/2,n[1]+e.velocityY*i/2],d=this.controllerState.pan({pos:o}).panEnd();this.updateViewport(d,{...this._getTransitionProps(),transitionDuration:i,transitionEasing:$_},{isDragging:!1,isPanning:!0})}else{const n=this.controllerState.panEnd();this.updateViewport(n,null,{isDragging:!1,isPanning:!1})}return!0}_onPanRotate(e){if(!this.dragRotate)return!1;const i=this.getCenter(e),n=this.controllerState.rotate({pos:i});return this.updateViewport(n,Lc,{isDragging:!0,isRotating:!0}),!0}_onPanRotateEnd(e){const{inertia:i}=this;if(this.dragRotate&&i&&e.velocity){const n=this.getCenter(e),o=[n[0]+e.velocityX*i/2,n[1]+e.velocityY*i/2],d=this.controllerState.rotate({pos:o}).rotateEnd();this.updateViewport(d,{...this._getTransitionProps(),transitionDuration:i,transitionEasing:$_},{isDragging:!1,isRotating:!0})}else{const n=this.controllerState.rotateEnd();this.updateViewport(n,null,{isDragging:!1,isRotating:!1})}return!0}_onWheel(e){if(!this.scrollZoom)return!1;const i=this.getCenter(e);if(!this.isPointInBounds(i,e))return!1;e.srcEvent.preventDefault();const{speed:n=.01,smooth:o=!1}=this.scrollZoom===!0?{}:this.scrollZoom,{delta:d}=e;let p=2/(1+Math.exp(-Math.abs(d*n)));d<0&&p!==0&&(p=1/p);const h=o?{...this._getTransitionProps({around:i}),transitionDuration:250}:Lc,A=this.controllerState.zoom({pos:i,scale:p});return this.updateViewport(A,h,{isZooming:!0,isPanning:!0}),o||this._setInteractionState({isZooming:!1,isPanning:!1}),!0}_onMultiPanStart(e){const i=this.getCenter(e);if(!this.isPointInBounds(i,e))return!1;const n=this.controllerState.rotateStart({pos:i});return this.updateViewport(n,Lc,{isDragging:!0}),!0}_onMultiPan(e){if(!this.touchRotate||!this.isDragging())return!1;const i=this.getCenter(e);i[0]-=e.deltaX;const n=this.controllerState.rotate({pos:i});return this.updateViewport(n,Lc,{isDragging:!0,isRotating:!0}),!0}_onMultiPanEnd(e){if(!this.isDragging())return!1;const{inertia:i}=this;if(this.touchRotate&&i&&e.velocityY){const n=this.getCenter(e),o=[n[0],n[1]+=e.velocityY*i/2],d=this.controllerState.rotate({pos:o});this.updateViewport(d,{...this._getTransitionProps(),transitionDuration:i,transitionEasing:$_},{isDragging:!1,isRotating:!0}),this.blockEvents(i)}else{const n=this.controllerState.rotateEnd();this.updateViewport(n,null,{isDragging:!1,isRotating:!1})}return!0}_onPinchStart(e){const i=this.getCenter(e);if(!this.isPointInBounds(i,e))return!1;const n=this.controllerState.zoomStart({pos:i}).rotateStart({pos:i});return yd._startPinchRotation=e.rotation,yd._lastPinchEvent=e,this.updateViewport(n,Lc,{isDragging:!0}),!0}_onPinch(e){if(!this.touchZoom&&!this.touchRotate||!this.isDragging())return!1;let i=this.controllerState;if(this.touchZoom){const{scale:n}=e,o=this.getCenter(e);i=i.zoom({pos:o,scale:n})}if(this.touchRotate){const{rotation:n}=e;i=i.rotate({deltaAngleX:yd._startPinchRotation-n})}return this.updateViewport(i,Lc,{isDragging:!0,isPanning:this.touchZoom,isZooming:this.touchZoom,isRotating:this.touchRotate}),yd._lastPinchEvent=e,!0}_onPinchEnd(e){if(!this.isDragging())return!1;const{inertia:i}=this,{_lastPinchEvent:n}=yd;if(this.touchZoom&&i&&n&&e.scale!==n.scale){const o=this.getCenter(e);let d=this.controllerState.rotateEnd();const p=Math.log2(e.scale),h=(p-Math.log2(n.scale))/(e.deltaTime-n.deltaTime),A=Math.pow(2,p+h*i/2);d=d.zoom({pos:o,scale:A}).zoomEnd(),this.updateViewport(d,{...this._getTransitionProps({around:o}),transitionDuration:i,transitionEasing:$_},{isDragging:!1,isPanning:this.touchZoom,isZooming:this.touchZoom,isRotating:!1}),this.blockEvents(i)}else{const o=this.controllerState.zoomEnd().rotateEnd();this.updateViewport(o,null,{isDragging:!1,isPanning:!1,isZooming:!1,isRotating:!1})}return yd._startPinchRotation=null,yd._lastPinchEvent=null,!0}_onDoubleClick(e){if(!this.doubleClickZoom)return!1;const i=this.getCenter(e);if(!this.isPointInBounds(i,e))return!1;const n=this.isFunctionKeyPressed(e),o=this.controllerState.zoom({pos:i,scale:n?.5:2});return this.updateViewport(o,this._getTransitionProps({around:i}),{isZooming:!0,isPanning:!0}),this.blockEvents(100),!0}_onKeyDown(e){if(!this.keyboard)return!1;const i=this.isFunctionKeyPressed(e),{zoomSpeed:n,moveSpeed:o,rotateSpeedX:d,rotateSpeedY:p}=this.keyboard===!0?{}:this.keyboard,{controllerState:h}=this;let A;const R={};switch(e.srcEvent.code){case"Minus":A=i?h.zoomOut(n).zoomOut(n):h.zoomOut(n),R.isZooming=!0;break;case"Equal":A=i?h.zoomIn(n).zoomIn(n):h.zoomIn(n),R.isZooming=!0;break;case"ArrowLeft":i?(A=h.rotateLeft(d),R.isRotating=!0):(A=h.moveLeft(o),R.isPanning=!0);break;case"ArrowRight":i?(A=h.rotateRight(d),R.isRotating=!0):(A=h.moveRight(o),R.isPanning=!0);break;case"ArrowUp":i?(A=h.rotateUp(p),R.isRotating=!0):(A=h.moveUp(o),R.isPanning=!0);break;case"ArrowDown":i?(A=h.rotateDown(p),R.isRotating=!0):(A=h.moveDown(o),R.isPanning=!0);break;default:return!1}return this.updateViewport(A,this._getTransitionProps(),R),!0}_getTransitionProps(e){const{transition:i}=this;return!i||!i.transitionInterpolator?Lc:e?{...i,transitionInterpolator:new Z2({...e,...i.transitionInterpolator.opts,makeViewport:this.controllerState.makeViewport})}:i}}class BB{constructor(e,i,n){this.makeViewport=n,this._viewportProps=this.applyConstraints(e),this._state=i}getViewportProps(){return this._viewportProps}getState(){return this._state}}const Dw=5,NB=1.2,Ow=512,Y2=[[-1/0,-90],[1/0,90]];function H_([t,e]){if(Math.abs(e)>90&&(e=Math.sign(e)*90),Number.isFinite(t)){const[n,o]=up([t,e]);return[n,rl(o,0,Ow)]}const[,i]=up([0,e]);return[t,rl(i,0,Ow)]}class zB extends BB{constructor(e){const{width:i,height:n,latitude:o,longitude:d,zoom:p,bearing:h=0,pitch:A=0,altitude:R=1.5,position:B=[0,0,0],maxZoom:N=20,minZ
2153oom:F=0,maxPitch:Q=60,minPitch:re=0,startPanLngLat:se,startZoomLngLat:ae,startRotatePos:me,startRotateLngLat:we,startBearing:ve,startPitch:Oe,startZoom:Te,normalize:Re=!0}=e;fs(Number.isFinite(d)),fs(Number.isFinite(o)),fs(Number.isFinite(p));const Ee=e.maxBounds||(Re?Y2:null);super({width:i,height:n,latitude:o,longitude:d,zoom:p,bearing:h,pitch:A,altitude:R,maxZoom:N,minZoom:F,maxPitch:Q,minPitch:re,normalize:Re,position:B,maxBounds:Ee},{startPanLngLat:se,startZoomLngLat:ae,startRotatePos:me,startRotateLngLat:we,startBearing:ve,startPitch:Oe,startZoom:Te},e.makeViewport),this.getAltitude=e.getAltitude}panStart({pos:e}){return this._getUpdatedState({startPanLngLat:this._unproject(e)})}pan({pos:e,startPos:i}){const n=this.getState().startPanLngLat||this._unproject(i);if(!n)return this;const d=this.makeViewport(this.getViewportProps()).panByPosition(n,e);return this._getUpdatedState(d)}panEnd(){return this._getUpdatedState({startPanLngLat:null})}rotateStart({pos:e}){var n;const i=(n=this.getAltitude)==null?void 0:n.call(this,e);return this._getUpdatedState({startRotatePos:e,startRotateLngLat:i!==void 0?this._unproject3D(e,i):void 0,startBearing:this.getViewportProps().bearing,startPitch:this.getViewportProps().pitch})}rotate({pos:e,deltaAngleX:i=0,deltaAngleY:n=0}){const{startRotatePos:o,startRotateLngLat:d,startBearing:p,startPitch:h}=this.getState();if(!o||p===void 0||h===void 0)return this;let A;if(e?A=this._getNewRotation(e,o,h,p):A={bearing:p+i,pitch:h+n},d){const R=this.makeViewport({...this.getViewportProps(),...A}),B="panByPosition3D"in R?"panByPosition3D":"panByPosition";return this._getUpdatedState({...A,...R[B](d,o)})}return this._getUpdatedState(A)}rotateEnd(){return this._getUpdatedState({startRotatePos:null,startRotateLngLat:null,startBearing:null,startPitch:null})}zoomStart({pos:e}){return this._getUpdatedState({startZoomLngLat:this._unproject(e),startZoom:this.getViewportProps().zoom})}zoom({pos:e,startPos:i,scale:n}){let{startZoom:o,startZoomLngLat:d}=this.getState();if(d||(o=this.getViewportProps().zoom,d=this._unproject(i)||this._unproject(e)),!d)return this;const p=this._constrainZoom(o+Math.log2(n)),h=this.makeViewport({...this.getViewportProps(),zoom:p});return this._getUpdatedState({zoom:p,...h.panByPosition(d,e)})}zoomEnd(){return this._getUpdatedState({startZoomLngLat:null,startZoom:null})}zoomIn(e=2){return this._zoomFromCenter(e)}zoomOut(e=2){return this._zoomFromCenter(1/e)}moveLeft(e=100){return this._panFromCenter([e,0])}moveRight(e=100){return this._panFromCenter([-e,0])}moveUp(e=100){return this._panFromCenter([0,e])}moveDown(e=100){return this._panFromCenter([0,-e])}rotateLeft(e=15){return this._getUpdatedState({bearing:this.getViewportProps().bearing-e})}rotateRight(e=15){return this._getUpdatedState({bearing:this.getViewportProps().bearing+e})}rotateUp(e=10){return this._getUpdatedState({pitch:this.getViewportProps().pitch+e})}rotateDown(e=10){return this._getUpdatedState({pitch:this.getViewportProps().pitch-e})}shortestPathFrom(e){const i=e.getViewportProps(),n={...this.getViewportProps()},{bearing:o,longitude:d}=n;return Math.abs(o-i.bearing)>180&&(n.bearing=o<0?o+360:o-360),Math.abs(d-i.longitude)>180&&(n.longitude=d<0?d+360:d-360),n}applyConstraints(e){const{maxPitch:i,minPitch:n,pitch:o,longitude:d,bearing:p,normalize:h,maxBounds:A}=e;if(h&&((d<-180||d>180)&&(e.longitude=mw(d+180,360)-180),(p<-180||p>180)&&(e.bearing=mw(p+180,360)-180)),e.pitch=rl(o,n,i),e.zoom=this._constrainZoom(e.zoom,e),A){const R=H_(A[0]),B=H_(A[1]),N=2**e.zoom,F=e.width/2/N,Q=e.height/2/N,[re,se]=hp([R[0]+F,R[1]+Q]),[ae,me]=hp([B[0]-F,B[1]-Q]);e.longitude=rl(e.longitude,re,ae),e.latitude=rl(e.latitude,se,me)}return e}_constrainZoom(e,i){i||(i=this.getViewportProps());const{maxZoom:n,maxBounds:o}=i,d=o!==null&&i.width>0&&i.height>0;let{minZoom:p}=i;if(d){const h=H_(o[0]),A=H_(o[1]),R=A[0]-h[0],B=A[1]-h[1];Number.isFinite(R)&&R>0&&(p=Math.max(p,Math.log2(i.width/R))),Number.isFinite(B)&&B>0&&(p=Math.max(p,Math.log2(i.height/B))),p>n&&(p=n)}return rl(e,p,n)}_zoomFromCenter(e){const{width:i,height:n}=this.getViewportProps();return this.zoom({pos:[i/2,n/2],scale:e})}_panFromCenter(e){const{width:i,height:n}=this.getViewportProps();return this.pan({startPos:[i/2,n/2],pos:[i/2+e[0],n/2+e[1]]})}_getUpdatedState(e){return new this.constructor({makeViewport:this.makeViewport,...this.getViewportProps(),...this.get
2153State(),...e})}_unproject(e){const i=this.makeViewport(this.getViewportProps());return e&&i.unproject(e)}_unproject3D(e,i){return this.makeViewport(this.getViewportProps()).unproject(e,{targetZ:i})}_getNewRotation(e,i,n,o){const d=e[0]-i[0],p=e[1]-i[1],h=e[1],A=i[1],{width:R,height:B}=this.getViewportProps(),N=d/R;let F=0;p>0?Math.abs(B-A)>Dw&&(F=p/(A-B)*NB):p<0&&A>Dw&&(F=1-h/A),F=rl(F,-1,1);const{minPitch:Q,maxPitch:re}=this.getViewportProps(),se=o+180*N;let ae=n;return F>0?ae=n+F*(re-n):F<0&&(ae=n-F*(Q-n)),{pitch:ae,bearing:se}}}class LB extends kB{constructor(){super(...arguments),this.ControllerState=zB,this.transition={transitionDuration:300,transitionInterpolator:new Z2({transitionProps:{compare:["longitude","latitude","zoom","bearing","pitch","position"],required:["longitude","latitude","zoom"]}})},this.dragMode="pan",this.rotationPivot="center",this._getAltitude=e=>{if(this.rotationPivot==="2d")return 0;if(this.rotationPivot==="3d"&&this.pickPosition){const{x:i,y:n}=this.props,o=this.pickPosition(i+e[0],n+e[1]);if(o&&o.coordinate&&o.coordinate.length>=3)return o.coordinate[2]}}}setProps(e){"rotationPivot"in e&&(this.rotationPivot=e.rotationPivot||"center"),e.getAltitude=this._getAltitude,e.position=e.position||[0,0,0],e.maxBounds=e.maxBounds||(e.normalize===!1?null:Y2),super.setProps(e)}updateViewport(e,i=null,n={}){const o=e.getState();n.isDragging&&o.startRotateLngLat?n={...n,rotationPivotPosition:o.startRotateLngLat}:n.isDragging===!1&&(n={...n,rotationPivotPosition:void 0}),super.updateViewport(e,i,n)}}let G2=class extends AB{constructor(e={}){super(e)}getViewportType(){return fp}get ControllerType(){return LB}};G2.displayName="MapView";const FB=new O2;function UB(t,e){const i=t.order??1/0,n=e.order??1/0;return i-n}class jB{constructor(e){this._resolvedEffects=[],this._defaultEffects=[],this.effects=[],this._context=e,this._needsRedraw="Initial render",this._setEffects([])}addDefaultEffect(e){const i=this._defaultEffects;if(!i.find(n=>n.id===e.id)){const n=i.findIndex(o=>UB(o,e)>0);n<0?i.push(e):i.splice(n,0,e),e.setup(this._context),this._setEffects(this.effects)}}setProps(e){"effects"in e&&(Xa(e.effects,this.effects,1)||this._setEffects(e.effects))}needsRedraw(e={clearRedrawFlags:!1}){const i=this._needsRedraw;return e.clearRedrawFlags&&(this._needsRedraw=!1),i}getEffects(){return this._resolvedEffects}_setEffects(e){const i={};for(const o of this.effects)i[o.id]=o;const n=[];for(const o of e){const d=i[o.id];let p=o;d&&d!==o?d.setProps?(d.setProps(o.props),p=d):d.cleanup(this._context):d||o.setup(this._context),n.push(p),delete i[o.id]}for(const o in i)i[o].cleanup(this._context);this.effects=n,this._resolvedEffects=n.concat(this._defaultEffects),e.some(o=>o instanceof O2)||this._resolvedEffects.push(FB),this._needsRedraw="effects changed"}finalize(){for(const e of this._resolvedEffects)e.cleanup(this._context);this.effects.length=0,this._resolvedEffects.length=0,this._defaultEffects.length=0}}class VB extends dx{shouldDrawLayer(e){const{operation:i}=e.props;return i.includes("draw")||i.includes("terrain")}render(e){return this._render(e)}}const $B="deckRenderer.renderLayers";class HB{constructor(e,i={}){this.device=e,this.stats=i.stats,this.layerFilter=null,this.drawPickingColors=!1,this.drawLayersPass=new VB(e),this.pickLayersPass=new H2(e),this.renderCount=0,this._needsRedraw="Initial render",this.renderBuffers=[],this.lastPostProcessEffect=null}setProps(e){this.layerFilter!==e.layerFilter&&(this.layerFilter=e.layerFilter,this._needsRedraw="layerFilter changed"),this.drawPickingColors!==e.drawPickingColors&&(this.drawPickingColors=e.drawPickingColors,this._needsRedraw="drawPickingColors changed")}renderLayers(e){if(!e.viewports.length)return;const i=this.drawPickingColors?this.pickLayersPass:this.drawLayersPass,n={layerFilter:this.layerFilter,isPicking:this.drawPickingColors,...e};n.effects&&this._preRender(n.effects,n);const o=this.lastPostProcessEffect?this.renderBuffers[0]:n.target;this.lastPostProcessEffect&&(n.clearColor=[0,0,0,0],n.clearCanvas=!0);const d=i.render({...n,target:o}),p="stats"in d?d.stats:d;n.effects&&(this.lastPostProcessEffect&&(n.clearCanvas=e.clearCanvas===void 0?!0:e.clearCanvas),this._postRender(n.effects,n)),this.renderCount++,aa($B,this,p,e),this._updateStats(p)}needsRedraw(e={clearRedrawFlags:!1}){const i=this._needsRedraw;return e.clearRedrawFlags&&(this._needsRedraw=!1),i}finalize(){const{renderBuffers:e}=this;for(const i of e)i.delete();e.length=0}_updateStats(e){if(!this.stats)return;let i=0;for(const{visibleCount:n}of e)i+=n;this.stats.get("Layers rendered").addCount(i)}_preRender(e,i){this.lastPostProcessEffect=null,i.preRenderStats=i.preRenderStats||{};for(const n of e)i.preRenderStats[n.id]=n.preRender(i),n.postRender&&(this.lastPostProcessEffect=n.id);this.lastPostProcessEffect&&this._resizeRenderBuffers()}_resizeRenderBuffers(){const{renderBuffers:e}=this,i=this.device.canvasContext.getDrawingBufferSize(),[n,o]=i;e.length===0&&[0,1].map(d=>{const p=this.device.createTexture({sampler:{minFilter:"linear",magFilter:"linear"},width:n,height:o});
vendor: 2,832 bytes, line 2153
2153e.push(this.device.createFramebuffer({id:`deck-renderbuffer-${d}`,colorAttachments:[p]}))});for(const d of e)d.resize(i)}_postRender(e,i){const{renderBuffers:n}=this,o={...i,inputBuffer:n[0],swapBuffer:n[1]};for(const d of e)if(d.postRender){o.target=d.id===this.lastPostProcessEffect?i.target:void 0;const p=d.postRender(o);o.inputBuffer=p,o.swapBuffer=p===n[0]?n[1]:n[0]}}}const WB={pickedColor:null,pickedObjectIndex:-1};function kw({pickedColors:t,decodePickingColor:e,deviceX:i,deviceY:n,deviceRadius:o,deviceRect:d}){const{x:p,y:h,width:A,height:R}=d;let B=o*o,N=-1,F=0;for(let Q=0;Q<R;Q++){const re=Q+h-n,se=re*re;if(se>B)F+=4*A;else for(let ae=0;ae<A;ae++){if(t[F+3]-1>=0){const we=ae+p-i,ve=we*we+se;ve<=B&&(B=ve,N=F)}F+=4}}if(N>=0){const Q=t.slice(N,N+4),re=e(Q);if(re){const se=Math.floor(N/4/A),ae=N/4-se*A;return{...re,pickedColor:Q,pickedX:p+ae,pickedY:h+se}}On.error("Picked non-existent layer. Is picking buffer corrupt?")()}return WB}function Bw({pickedColors:t,decodePickingColor:e}){const i=new Map;if(t){for(let n=0;n<t.length;n+=4)if(t[n+3]-1>=0){const d=t.slice(n,n+4),p=d.join(",");if(!i.has(p)){const h=e(d);h?i.set(p,{...h,color:d}):On.error("Picked non-existent layer. Is picking buffer corrupt?")()}}}return Array.from(i.values())}function A0({pickInfo:t,viewports:e,pixelRatio:i,x:n,y:o,z:d}){let p=e[0];e.length>1&&(p=XB((t==null?void 0:t.pickedViewports)||e,{x:n,y:o}));let h;if(p){const A=[n-p.x,o-p.y];d!==void 0&&(A[2]=d),h=p.unproject(A)}return{color:null,layer:null,viewport:p,index:-1,picked:!1,x:n,y:o,pixel:[n,o],coordinate:h,devicePixel:t&&"pickedX"in t?[t.pickedX,t.pickedY]:void 0,pixelRatio:i}}function Nw(t){const{pickInfo:e,lastPickedInfo:i,mode:n,layers:o}=t,{pickedColor:d,pickedLayer:p,pickedObjectIndex:h}=e,A=p?[p]:[];if(n==="hover"){const N=i.index,F=i.layerId,Q=p?p.props.id:null;if(Q!==F||h!==N){if(Q!==F){const re=o.find(se=>se.props.id===F);re&&A.unshift(re)}i.layerId=Q,i.index=h,i.info=null}}const R=A0(t),B=new Map;return B.set(null,R),A.forEach(N=>{let F={...R};N===p&&(F.color=d,F.index=h,F.picked=!0),F=E0({layer:N,info:F,mode:n});const Q=F.layer;N===p&&n==="hover"&&(i.info=F),B.set(Q.id,F),n==="hover"&&Q.updateAutoHighlight(F)}),B}function E0({layer:t,info:e,mode:i}){for(;t&&e;){const n=e.layer||null;e.sourceLayer=n,e.layer=t,e=t.getPickingInfo({info:e,mode:i,sourceLayer:n}),t=t.parent}return e}function XB(t,e){for(let i=t.length-1;i>=0;i--){const n=t[i];if(n.containsPixel(e))return n}return t[0]}class qB{constructor(e,i={}){this._pickable=!0,this.device=e,this.stats=i.stats,this.pickLayersPass=new H2(e),this.lastPickedInfo={index:-1,layerId:null,info:null}}setProps(e){"layerFilter"in e&&(this.layerFilter=e.layerFilter),"_pickable"in e&&(this._pickable=e._pickable)}finalize(){this.pickingFBO&&this.pickingFBO.destroy(),this.depthFBO&&this.depthFBO.destroy()}
2153pickObjectAsync(e){return this._pickClosestObjectAsync(e)}pickObjectsAsync(e){return this._pickVisibleObjectsAsync(e)}pickObject(e){return this._pickClosestObject(e)}pickObjects(e){return this._pickVisibleObjects(e)}getLastPickedObject({x:e,y:i,layers:n,viewports:o},d=this.lastPickedInfo.info){const p=d&&d.layer&&d.layer.id,h=d&&d.viewport&&d.viewport.id,A=p?n.find(F=>F.id===p):null,R=h&&o.find(F=>F.id===h)||o[0],B=R&&R.unproject([e-R.x,i-R.y]);return{...d,...{x:e,y:i,viewport:R,coordinate:B,layer:A}}}_resizeBuffer(e=this.device.getDefaultCanvasContext()){var o,d;if(!this.pickingFBO){const p=this.device.createTexture({format:"rgba8unorm",width:1,height:1,usage:Dn.RENDER_ATTACHMENT|Dn.COPY_SRC});if(this.pickingFBO=this.device.createFramebuffer({colorAttachments:[p],depthStencilAttachment:"depth16unorm"}),this.device.isTextureFormatRenderable("rgba32float")){const h=this.device.createTexture({format:"rgba32float",width:1,height:1,usage:Dn.RENDER_ATTACHMENT|Dn.COPY_SRC}),A=this.device.createFramebuffer({colorAttachments:[h],depthStencilAttachment:"depth16unorm"});this.depthFBO=A}}const[i,n]=e.getDrawingBufferSize();(o=this.pickingFBO)==null||o.resize({width:i,height:n}),(d=this.depthFBO)==null||d.resize({width:i,height:n})}_getPickable(e){if(this._pickable===!1)return null;const i=e.filter(n=>this.pickLayersPass.shouldDrawLayer(n)&&!n.isComposite);return i.length?i:null}async _pickClosestObjectAsync({layers:e,views:i,viewports:n,x:o,y:d,radius:p=0,depth:h=1,mode:A="query",unproject3D:R,canvasContext:B=this.device.getDefaultCanvasContext(),onViewportActive:N,effects:F}){const Q=B.cssToDeviceRatio(),re=this._getPickable(e);if(!re||n.length===0)return{result:[],emptyInfo:A0({viewports:n,x:o,y:d,pixelRatio:Q})};this._resizeBuffer(B);const se=B.cssToDevicePixels([o,d],!0),ae=[se.x+Math.floor(se.width/2),se.y+Math.floor(se.height/2)],me=Math.round(p*Q),{width:we,height:ve}=this.pickingFBO,Oe=this._getPickingRect({deviceX:ae[0],deviceY:ae[1],deviceRadius:me,deviceWidth:we,deviceHeight:ve}),Te={x:o-p,y:d-p,width:p*2+1,height:p*2+1};let Re;const Ee=[],Je=new Set;for(let rt=0;rt<h;rt++){let Ke;if(Oe){const At=await this._drawAndSampleAsync({layers:re,views:i,viewports:n,onViewportActive:N,deviceRect:Oe,cullRect:Te,effects:F,pass:`picking:${A}`});Ke=kw({...At,deviceX:ae[0],deviceY:ae[1],deviceRadius:me,deviceRect:Oe})}else Ke={pickedColor:null,pickedObjectIndex:-1};let Qe;const ht=this._getDepthLayers(Ke,re,R);if(ht.length>0){const{pickedColors:At}=await this._drawAndSampleAsync({layers:ht,views:i,viewports:n,onViewportActive:N,deviceRect:{x:Ke.pickedX??ae[0],y:Ke.pickedY??ae[1],width:1,height:1},cullRect:Te,effects:F,pass:`picking:${A}:z`},!0);At[3]&&(Qe=At[0])}Ke.pickedLayer&&rt+1<h&&(Je.add(Ke.pickedLayer),Ke.pickedLayer.disablePickingIndex(Ke.pickedObjectIndex)),Re=Nw({pickInfo:Ke,lastPickedInfo:this.lastPickedInfo,mode:A,layers:re,viewports:n,x:o,y:d,z:Qe,pixelRatio:Q});for(const At of Re.values())At.layer&&Ee.push(At);if(!Ke.pickedColor)break}for(const rt of Je)rt.restorePickingColors();return{result:Ee,emptyInfo:Re.get(null)}}_pickClosestObject({layers:e,views:i,viewports:n,x:o,y:d,radius:p=0,depth:h=1,mode:A="query",unproject3D:R,canvasContext:B=this.device.getDefaultCanvasContext(),onViewportActive:N,effects:F}){const Q=B.cssToDeviceRatio(),re=this._getPickable(e);if(!re||n.length===0)return{result:[],emptyInfo:A0({viewports:n,x:o,y:d,pixelRatio:Q})};this._resizeBuffer(B);const se=B.cssToDevicePixels([o,d],!0),ae=[se.x+Math.floor(se.width/2),se.y+Math.floor(se.height/2)],me=Math.round(p*Q),{width:we,height:ve}=this.pickingFBO,Oe=this._getPickingRect({deviceX:ae[0],deviceY:ae[1],deviceRadius:me,deviceWidth:we,deviceHeight:ve}),Te={x:o-p,y:d-p,width:p*2+1,height:p*2+1};let Re;const Ee=[],Je=new Set;for(let rt=0;rt<h;rt++){let Ke;if(Oe){const At=this._drawAndSample({layers:re,views:i,viewports:n,onViewportActive:N,deviceRect:Oe,cullRect:Te,effects:F,pass:`picking:${A}`});Ke=kw({...At,deviceX:ae[0],deviceY:ae[1],deviceRadius:me,deviceRect:Oe})}else Ke={pickedColor:null,pickedObjectIndex:-1};let Qe;const ht=this._getDepthLayers(Ke,re,R);if(ht.length>0){const{pickedColors:At}=this._drawAndSample({layers:ht,views:i,viewports:n,onViewportActive:N,deviceRect:{x:Ke.pickedX??ae[0],y:Ke.pickedY??ae[1],width:1,height:1},cullRect:Te,effects:F,pass:`picking:${A}:z`},!0);At[3]&&(Qe=At[0])}Ke.pickedLayer&&rt+1<h&&(Je.add(Ke.pickedLayer),Ke.pickedLayer.disablePickingIndex(Ke.pickedObjectIndex)),Re=Nw({pickInfo:Ke,lastPickedInfo:this.lastPickedInfo,mode:A,layers:re,viewports:n,x:o,y:d,z:Qe,pixelRatio:Q});for(const At of Re.values())At.layer&&Ee.push(At);if(!Ke.pickedColor)break}for(const rt of Je)rt.restorePickingColors();return{result:Ee,emptyInfo:Re.get(null)}}async _pickVisibleObjectsAsync({layers:e,views:i,viewports:n,x:o,y:d,width:p=1,height:h=1,mode:A="query",maxObjects:R=null,canvasContext:B=this.device.getDefaultCanvasContext(),onViewportActive:N,effects:F}){const Q=this._getPickable(e);if(!Q||n.length===0)return[];this._resizeBuffer(B);const re=B.cssToDeviceRatio(),se=B.cssToDevicePixels([o,d],!0),ae=se.x,me=se.y+se.height,we=B.cssToDevicePixels([o+p,d+h],!0),ve=we.x+we.width,Oe=we.y,Te={x:ae,y:Oe,width:ve-ae,height:me-Oe}
2153,Re=await this._drawAndSampleAsync({layers:Q,views:i,viewports:n,onViewportActive:N,deviceRect:Te,cullRect:{x:o,y:d,width:p,height:h},effects:F,pass:`picking:${A}`}),Ee=Bw(Re),Je=new Map,rt=[],Ke=Number.isFinite(R);for(let Qe=0;Qe<Ee.length&&!(Ke&&rt.length>=R);Qe++){const ht=Ee[Qe];let At={color:ht.pickedColor,layer:null,index:ht.pickedObjectIndex,picked:!0,x:o,y:d,pixelRatio:re};At=E0({layer:ht.pickedLayer,info:At,mode:A});const Fe=At.layer.id;Je.has(Fe)||Je.set(Fe,new Set);const Dt=Je.get(Fe),Le=At.object??At.index;Dt.has(Le)||(Dt.add(Le),rt.push(At))}return rt}_pickVisibleObjects({layers:e,views:i,viewports:n,x:o,y:d,width:p=1,height:h=1,mode:A="query",maxObjects:R=null,canvasContext:B=this.device.getDefaultCanvasContext(),onViewportActive:N,effects:F}){const Q=this._getPickable(e);if(!Q||n.length===0)return[];this._resizeBuffer(B);const re=B.cssToDeviceRatio(),se=B.cssToDevicePixels([o,d],!0),ae=se.x,me=se.y+se.height,we=B.cssToDevicePixels([o+p,d+h],!0),ve=we.x+we.width,Oe=we.y,Te={x:ae,y:Oe,width:ve-ae,height:me-Oe},Re=this._drawAndSample({layers:Q,views:i,viewports:n,onViewportActive:N,deviceRect:Te,cullRect:{x:o,y:d,width:p,height:h},effects:F,pass:`picking:${A}`}),Ee=Bw(Re),Je=new Map,rt=[],Ke=Number.isFinite(R);for(let Qe=0;Qe<Ee.length&&!(Ke&&rt.length>=R);Qe++){const ht=Ee[Qe];let At={color:ht.pickedColor,layer:null,index:ht.pickedObjectIndex,picked:!0,x:o,y:d,pixelRatio:re};At=E0({layer:ht.pickedLayer,info:At,mode:A});const Fe=At.layer.id;Je.has(Fe)||Je.set(Fe,new Set);const Dt=Je.get(Fe),Le=At.object??At.index;Dt.has(Le)||(Dt.add(Le),rt.push(At))}return rt}async _drawAndSampleAsync({layers:e,views:i,viewports:n,onViewportActive:o,deviceRect:d,cullRect:p,effects:h,pass:A},R=!1){var Oe;const B=R?this.depthFBO:this.pickingFBO,N={layers:e,layerFilter:this.layerFilter,views:i,viewports:n,onViewportActive:o,pickingFBO:B,deviceRect:d,cullRect:p,effects:h,pass:A,pickZ:R,preRenderStats:{},isPicking:!0};for(const Te of h)Te.useInPicking&&(N.preRenderStats[Te.id]=Te.preRender(N));const{decodePickingColor:F,stats:Q}=this.pickLayersPass.render(N);this._updateStats(Q);const{x:re,y:se,width:ae,height:me}=d,we=(Oe=B.colorAttachments[0])==null?void 0:Oe.texture;if(!we)throw new Error("Picking framebuffer color attachment is missing");const ve=await this._readTextureDataAsync(we,{x:re,y:se,width:ae,height:me},R?Float32Array:Uint8Array);if(!R){let Te=!1;for(let Re=3;Re<ve.length;Re+=4)if(ve[Re]!==0){Te=!0;break}!Te&&ve.length>0&&On.warn("Async pick readback returned only zero alpha values",{deviceRect:d,bytes:Array.from(ve.subarray(0,Math.min(ve.length,16)))})()}return{pickedColors:ve,decodePickingColor:F}}async _readTextureDataAsync(e,i,n){const{width:o,height:d}=i,p=e.computeMemoryLayout(i),h=this.device.createBuffer({byteLength:p.byteLength,usage:En.COPY_DST|En.MAP_READ});try{e.readBuffer(i,h);const A=await h.readAsync(0,p.byteLength),R=n.BYTES_PER_ELEMENT;if(p.bytesPerRow%R!==0)throw new Error(`Texture readback row stride ${p.bytesPerRow} is not aligned to ${R}-byte elements.`);const B=new n(A.buffer,A.byteOffset,p.byteLength/R),N=o*4,F=p.bytesPerRow/R;if(F<N)throw new Error(`Texture readback row stride ${F} is smaller than packed row length ${N}.`);const Q=new n(o*d*4);for(let re=0;re<d;re++){const se=re*F;Q.set(B.subarray(se,se+N),re*N)}return Q}finally{h.destroy()}}_drawAndSample({layers:e,views:i,viewports:n,onViewportActive:o,deviceRect:d,cullRect:p,effects:h,pass:A},R=!1){const B=R?this.depthFBO:this.pickingFBO,N={layers:e,layerFilter:this.layerFilter,views:i,viewports:n,onViewportActive:o,pickingFBO:B,deviceRect:d,cullRect:p,effects:h,pass:A,pickZ:R,preRenderStats:{},isPicking:!0};for(const ve of h)ve.useInPicking&&(N.preRenderStats[ve.id]=ve.preRender(N));const{decodePickingColor:F,stats:Q}=this.pickLayersPass.render(N);this._updateStats(Q);const{x:re,y:se,width:ae,height:me}=d,we=new(R?Float32Array:Uint8Array)(ae*me*4);return this.device.readPixelsToArrayWebGL(B,{sourceX:re,sourceY:se,sourceWidth:ae,sourceHeight:me,target:we}),{pickedColors:we,decodePickingColor:F}}_updateStats(e){if(!this.stats)return;let i=0;for(const{visibleCount:n}of e)i+=n;this.stats.get("Layers picked").addCount(i)}_getDepthLayers(e,i,n){var p;if(!n||!this.depthFBO)return[];const{pickedLayer:o}=e,d=((p=o==null?void 0:o.state)==null?void 0:p.terrainDrawMode)==="drape";return o&&!d?[o]:i.filter(h=>h.props.operation.includes("terrain"))}_getPickingRect({deviceX:e,deviceY:i,deviceRadius:n,deviceWidth:o,deviceHeight:d}){const p=Math.max(0,e-n),h=Math.max(0,i-n),A=Math.min(o,e+n+1)-p,R=Math.min(d,i+n+1)-h;return A<=0||R<=0?null:{x:p,y:h,width:A,height:R}}}const ZB={"top-left":{top:0,left:0},"top-right":{top:0,right:0},"bottom-left":{bottom:0,left:0},"bottom-right":{bottom:0,right:0},fill:{top:0,left:0,bottom:0,right:0}},YB="top-left",zw="root";class GB{constructor({deck:e,parentElement:i}){this.defaultWidgets=[],this.widgets=[],this.resolvedWidgets=[],this.containers={},this.lastViewports={},this.deck=e,i==null||i.classList.add("deck-widget-container"),this.parentElement=i}getWidgets(){return this.resolvedWidgets}setProps(e){if(e.widgets&&!Xa(e.widgets,this.widgets,1)){const i=e.widgets.filter(
2153Boolean);this._setWidgets(i)}}finalize(){for(const e of this.getWidgets())this._removeWidget(e);this.defaultWidgets.length=0,this.resolvedWidgets.length=0;for(const e in this.containers)this.containers[e].remove()}addDefault(e){this.defaultWidgets.find(i=>i.id===e.id)||(this._addWidget(e),this.defaultWidgets.push(e),this._setWidgets(this.widgets))}onRedraw({viewports:e,layers:i}){var o,d;const n=e.reduce((p,h)=>(p[h.id]=h,p),{});for(const p of this.getWidgets()){const{viewId:h}=p;if(h){const A=n[h];A&&(p.onViewportChange&&p.onViewportChange(A),(o=p.onRedraw)==null||o.call(p,{viewports:[A],layers:i}))}else{if(p.onViewportChange)for(const A of e)p.onViewportChange(A);(d=p.onRedraw)==null||d.call(p,{viewports:e,layers:i})}}this.lastViewports=n,this._updateContainers()}onHover(e,i){var n,o;for(const d of this.getWidgets()){const{viewId:p}=d;(!p||p===((n=e.viewport)==null?void 0:n.id))&&((o=d.onHover)==null||o.call(d,e,i))}}onEvent(e,i){var o,d;const n=ay[i.type];if(n)for(const p of this.getWidgets()){const{viewId:h}=p;(!h||h===((o=e.viewport)==null?void 0:o.id))&&((d=p[n])==null||d.call(p,e,i))}}_setWidgets(e){const i={};for(const n of this.resolvedWidgets)i[n.id]=n;this.resolvedWidgets.length=0;for(const n of this.defaultWidgets)i[n.id]=null,this.resolvedWidgets.push(n);for(let n of e){const o=i[n.id];o?o.viewId!==n.viewId||o.placement!==n.placement?(this._removeWidget(o),this._addWidget(n)):n!==o&&(o.setProps(n.props),n=o):this._addWidget(n),i[n.id]=null,this.resolvedWidgets.push(n)}for(const n in i){const o=i[n];o&&this._removeWidget(o)}this.widgets=e}_addWidget(e){const{viewId:i=null,placement:n=YB}=e,o=e.props._container??i;e.widgetManager=this,e.deck=this.deck,e.rootElement=e._onAdd({deck:this.deck,viewId:i}),e.rootElement&&this._getContainer(o,n).append(e.rootElement),e.updateHTML()}_removeWidget(e){var i;(i=e.onRemove)==null||i.call(e),e.rootElement&&e.rootElement.remove(),e.rootElement=void 0,e.deck=void 0,e.widgetManager=void 0}_getContainer(e,i){var p;if(e&&typeof e!="string")return e;const n=e||zw;let o=this.containers[n];o||(o=document.createElement("div"),o.style.pointerEvents="none",o.style.position="absolute",o.style.overflow="hidden",(p=this.parentElement)==null||p.append(o),this.containers[n]=o);let d=o.querySelector(`.${i}`);return d||(d=globalThis.document.createElement("div"),d.className=i,d.style.position="absolute",d.style.zIndex="2",Object.assign(d.style,ZB[i]),o.append(d)),d}_updateContainers(){const e=this.deck.width,i=this.deck.height;for(const n in this.containers){const o=this.lastViewports[n]||null,d=n===zw||o,p=this.containers[n];d?(p.style.display="block",p.style.left=`${o?o.x:0}px`,p.style.top=`${o?o.y:0}px`,p.style.width=`${o?o.width:e}px`,p.style.height=`${o?o.height:i}px`):p.style.display="none"}}}function Lw(t,e){e&&Object.entries(e).map(([i,n])=>{i.startsWith("--")?t.style.setProperty(i,n):t.style[i]=n})}function KB(t,e){e&&Object.keys(e).map(i=>{i.startsWith("--")?t.style.removeProperty(i):t.style[i]=""})}class px{constructor(e){this.viewId=null,this.props={...this.constructor.defaultProps,...e},this.id=this.props.id}setProps(e){const i=this.props,n=this.rootElement;n&&i.className!==e.className&&(i.className&&n.classList.remove(i.className),e.className&&n.classList.add(e.className)),n&&!Xa(i.style,e.style,1)&&(KB(n,i.style),Lw(n,e.style)),Object.assign(this.props,e),this.updateHTML()}updateHTML(){this.rootElement&&this.onRenderHTML(this.rootElement)}get viewIds(){var e;return this.viewId?[this.viewId]:((e=this.deck)==null?void 0:e.getViews().map(i=>i.id))??[]}getViewState(e){var i,n;return((n=(i=this.deck)==null?void 0:i.viewManager)==null?void 0:n.getViewState(e))||{}}setViewState(e,i){var n;(n=this.deck)==null||n._onViewStateChange({viewId:e,viewState:i,interactionState:{}})}onCreateRootElement(){const e=["deck-widget",this.className,this.props.className],i=document.createElement("div");return e.filter(n=>typeof n=="string"&&n.length>0).forEach(n=>i.classList.add(n)),Lw(i,this.props.style),i}_onAdd(e){return this.onAdd(e)??this.onCreateRootElement()}onAdd(e){}onRemove(){}onViewportChange(e){}onRedraw(e){}
2153onHover(e,i){}onClick(e,i){}onDrag(e,i){}onDragStart(e,i){}onDragEnd(e,i){}}px.defaultProps={id:"widget",style:{},_container:null,className:""};const QB={zIndex:"1",position:"absolute",pointerEvents:"none",color:"#a0a7b4",backgroundColor:"#29323c",padding:"10px",top:"0",left:"0",display:"none"};class K2 extends px{constructor(e={}){super(e),this.id="default-tooltip",this.placement="fill",this.className="deck-tooltip",this.isVisible=!1,this.setProps(e)}onCreateRootElement(){const e=document.createElement("div");return e.className=this.className,Object.assign(e.style,QB),e}onRenderHTML(e){}onViewportChange(e){var i;this.isVisible&&e.id===((i=this.lastViewport)==null?void 0:i.id)&&!e.equals(this.lastViewport)&&this.setTooltip(null),this.lastViewport=e}onHover(e){const{deck:i}=this,n=i&&i.props.getTooltip;if(!n)return;const o=n(e);this.setTooltip(o,e.x,e.y)}setTooltip(e,i,n){const o=this.rootElement;if(o){if(typeof e=="string")o.innerText=e;else if(e)e.text&&(o.innerText=e.text),e.html&&(o.innerHTML=e.html),e.className&&(o.className=e.className);else{this.isVisible=!1,o.style.display="none";return}this.isVisible=!0,o.style.display="block",o.style.transform=`translate(${i}px, ${n}px)`,e&&typeof e=="object"&&"style"in e&&Object.assign(o.style,e.style)}}}K2.defaultProps={...px.defaultProps};var Gf;(
vendor: 32,708 bytes, line 2153
2153function(t){t[t.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",t[t.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",t[t.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT",t[t.POINTS=0]="POINTS",t[t.LINES=1]="LINES",t[t.LINE_LOOP=2]="LINE_LOOP",t[t.LINE_STRIP=3]="LINE_STRIP",t[t.TRIANGLES=4]="TRIANGLES",t[t.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",t[t.TRIANGLE_FAN=6]="TRIANGLE_FAN",t[t.ZERO=0]="ZERO",t[t.ONE=1]="ONE",t[t.SRC_COLOR=768]="SRC_COLOR",t[t.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",t[t.SRC_ALPHA=770]="SRC_ALPHA",t[t.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",t[t.DST_ALPHA=772]="DST_ALPHA",t[t.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",t[t.DST_COLOR=774]="DST_COLOR",t[t.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",t[t.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",t[t.CONSTANT_COLOR=32769]="CONSTANT_COLOR",t[t.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",t[t.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",t[t.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",t[t.FUNC_ADD=32774]="FUNC_ADD",t[t.FUNC_SUBTRACT=32778]="FUNC_SUBTRACT",t[t.FUNC_REVERSE_SUBTRACT=32779]="FUNC_REVERSE_SUBTRACT",t[t.BLEND_EQUATION=32777]="BLEND_EQUATION",t[t.BLEND_EQUATION_RGB=32777]="BLEND_EQUATION_RGB",t[t.BLEND_EQUATION_ALPHA=34877]="BLEND_EQUATION_ALPHA",t[t.BLEND_DST_RGB=32968]="BLEND_DST_RGB",t[t.BLEND_SRC_RGB=32969]="BLEND_SRC_RGB",t[t.BLEND_DST_ALPHA=32970]="BLEND_DST_ALPHA",t[t.BLEND_SRC_ALPHA=32971]="BLEND_SRC_ALPHA",t[t.BLEND_COLOR=32773]="BLEND_COLOR",t[t.ARRAY_BUFFER_BINDING=34964]="ARRAY_BUFFER_BINDING",t[t.ELEMENT_ARRAY_BUFFER_BINDING=34965]="ELEMENT_ARRAY_BUFFER_BINDING",t[t.LINE_WIDTH=2849]="LINE_WIDTH",t[t.ALIASED_POINT_SIZE_RANGE=33901]="ALIASED_POINT_SIZE_RANGE",t[t.ALIASED_LINE_WIDTH_RANGE=33902]="ALIASED_LINE_WIDTH_RANGE",t[t.CULL_FACE_MODE=2885]="CULL_FACE_MODE",t[t.FRONT_FACE=2886]="FRONT_FACE",t[t.DEPTH_RANGE=2928]="DEPTH_RANGE",t[t.DEPTH_WRITEMASK=2930]="DEPTH_WRITEMASK",t[t.DEPTH_CLEAR_VALUE=2931]="DEPTH_CLEAR_VALUE",t[t.DEPTH_FUNC=2932]="DEPTH_FUNC",t[t.STENCIL_CLEAR_VALUE=2961]="STENCIL_CLEAR_VALUE",t[t.STENCIL_FUNC=2962]="STENCIL_FUNC",t[t.STENCIL_FAIL=2964]="STENCIL_FAIL",t[t.STENCIL_PASS_DEPTH_FAIL=2965]="STENCIL_PASS_DEPTH_FAIL",t[t.STENCIL_PASS_DEPTH_PASS=2966]="STENCIL_PASS_DEPTH_PASS",t[t.STENCIL_REF=2967]="STENCIL_REF",t[t.STENCIL_VALUE_MASK=2963]="STENCIL_VALUE_MASK",t[t.STENCIL_WRITEMASK=2968]="STENCIL_WRITEMASK",t[t.STENCIL_BACK_FUNC=34816]="STENCIL_BACK_FUNC",t[t.STENCIL_BACK_FAIL=34817]="STENCIL_BACK_FAIL",t[t.STENCIL_BACK_PASS_DEPTH_FAIL=34818]="STENCIL_BACK_PASS_DEPTH_FAIL",t[t.STENCIL_BACK_PASS_DEPTH_PASS=34819]="STENCIL_BACK_PASS_DEPTH_PASS",t[t.STENCIL_BACK_REF=36003]="STENCIL_BACK_REF",t[t.STENCIL_BACK_VALUE_MASK=36004]="STENCIL_BACK_VALUE_MASK",t[t.STENCIL_BACK_WRITEMASK=36005]="STENCIL_BACK_WRITEMASK",t[t.VIEWPORT=2978]="VIEWPORT",t[t.SCISSOR_BOX=3088]="SCISSOR_BOX",t[t.COLOR_CLEAR_VALUE=3106]="COLOR_CLEAR_VALUE",t[t.COLOR_WRITEMASK=3107]="COLOR_WRITEMASK",t[t.UNPACK_ALIGNMENT=3317]="UNPACK_ALIGNMENT",t[t.PACK_ALIGNMENT=3333]="PACK_ALIGNMENT",t[t.MAX_TEXTURE_SIZE=3379]="MAX_TEXTURE_SIZE",t[t.MAX_VIEWPORT_DIMS=3386]="MAX_VIEWPORT_DIMS",t[t.SUBPIXEL_BITS=3408]="SUBPIXEL_BITS",t[t.RED_BITS=3410]="RED_BITS",t[t.GREEN_BITS=3411]="GREEN_BITS",t[t.BLUE_BITS=3412]="BLUE_BITS",t[t.ALPHA_BITS=3413]="ALPHA_BITS",t[t.DEPTH_BITS=3414]="DEPTH_BITS",t[t.STENCIL_BITS=3415]="STENCIL_BITS",t[t.POLYGON_OFFSET_UNITS=10752]="POLYGON_OFFSET_UNITS",t[t.POLYGON_OFFSET_FACTOR=32824]="POLYGON_OFFSET_FACTOR",t[t.TEXTURE_BINDING_2D=32873]="TEXTURE_BINDING_2D",t[t.SAMPLE_BUFFERS=32936]="SAMPLE_BUFFERS",t[t.SAMPLES=32937]="SAMPLES",t[t.SAMPLE_COVERAGE_VALUE=32938]="SAMPLE_COVERAGE_VALUE",t[t.SAMPLE_COVERAGE_INVERT=32939]="SAMPLE_COVERAGE_INVERT",t[t.COMPRESSED_TEXTURE_FORMATS=34467]="COMPRESSED_TEXTURE_FORMATS",t[t.VENDOR=7936]="VENDOR",t[t.RENDERER=7937]="RENDERER",t[t.VERSION=7938]="VERSION",t[t.IMPLEMENTATION_COLOR_READ_TYPE=35738]="IMPLEMENTATION_COLOR_READ_TYPE",t[t.IMPLEMENTATION_COLOR_READ_FORMAT=35739]="IMPLEMENTATION_COLOR_READ_FORMAT",t[t.BROWSER_DEFAULT_WEBGL=37444]="BROWSER_DEFAULT_WEBGL",t[t.STATIC_DRAW=35044]="STATIC_DRAW",t[t.STREAM_DRAW=35040]="STREAM_DRAW",t[t.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",t[t.ARRAY_BUFFER=34962]="ARRAY_BUFFER",t[t.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",t[t.BUFFER_SIZE=34660]="BUFFER_SIZE",t[t.BUFFER_USAGE=34661]="BUFFER_USAGE",t[t.CURRENT_VERTEX_ATTRIB=34342]="CURRENT_VERTEX_ATTRIB",t[t.VERTEX_ATTRIB_ARRAY_ENABLED=34338]="VERTEX_ATTRIB_ARRAY_ENABLED",t[t.VERTEX_ATTRIB_ARRAY_SIZE=34339]="VERTEX_ATTRIB_ARRAY_SIZE",t[t.VERTEX_ATTRIB_ARRAY_STRIDE=34340]="VERTEX_ATTRIB_ARRAY_STRIDE",t[t.VERTEX_ATTRIB_ARRAY_TYPE=34341]="VERTEX_ATTRIB_ARRAY_TYPE",t[t.VERTEX_ATTRIB_ARRAY_NORMALIZED=34922]="VERTEX_ATTRIB_ARRAY_NORMALIZED",t[t.VERTEX_ATTRIB_ARRAY_POINTER=34373]="VERTEX_ATTRIB_ARRAY_POINTER",t[t.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING=34975]="VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",t[t.CULL_FACE=2884]="CULL_FACE",t[t.FRONT=1028]="FRONT",t[t.BACK=1029]="BACK",t[t.FRONT_AND_BACK=1032]="FRONT_AND_BACK",t[t.BLEND=3042]="BLEND",t[t.DEPTH_TEST=2929]="DEPTH_TEST",t[t.DITHER=3024]="DITHER",t[t.POLYGON_OFFSET_FILL=32823]="POLYGON_OFFSET_FILL",t[t.SAMPLE_ALPHA_TO_COVERAGE=32926]="SAMPLE_ALPHA_TO_COVERAGE",t[t.SAMPLE_COVERAGE=32928]="SAMPLE_COVERAGE",t[t.SCISSOR_TEST=3089]="SCISSOR_TEST",t[t.STENCIL_TEST=2960]="STENCIL_TEST",t[t.NO_ERROR=0]="NO_ERROR",t[t.INVALID_ENUM=1280]="INVALID_ENUM",t[t.INVALID_VALUE=1281]="INVALID_VALUE",t[t.INVALID_OPERATION=1282]="INVALID_OPERATION",t[t.OUT_OF_MEMORY=1285]="OUT_OF_MEMORY",t[t.CONTEXT_LOST_WEBGL=37442]="CONTEXT_LOST_WEBGL",t[t.CW=2304]="CW",t[t.CCW=2305]="CCW",t[t.DONT_CARE=4352]="DONT_CARE",t[t.FASTEST=4353]="FASTEST",t[t.NICEST=4354]="NICEST",t[t.GENERATE_MIPMAP_HINT=33170]="GENERATE_MIPMAP_HINT",t[t.BYTE=5120]="BYTE",t[t.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",t[t.SHORT=5122]="SHORT",t[t.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",t[t.INT=5124]="INT",t[t.UNSIGNED_INT=5125]="UNSIGNED_INT",t[t.FLOAT=5126]="FLOAT",t[t.DOUBLE=5130]="DOUBLE",t[t.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",t[t.ALPHA=6406]="ALPHA",t[t.RGB=6407]="RGB",t[t.RGBA=6408]="RGBA",t[t.LUMINANCE=6409]="LUMINANCE",t[t.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",t[t.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",t[t.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",t[t.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",t[t.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",t[t.VERTEX_SHADER=35633]="VERTEX_SHADER",t[t.COMPILE_STATUS=35713]="COMPILE_STATUS",t[t.DELETE_STATUS=35712]="DELETE_STATUS",t[t.LINK_STATUS=35714]="LINK_STATUS",t[t.VALIDATE_STATUS=35715]="VALIDATE_STATUS",t[t.ATTACHED_SHADERS=35717]="ATTACHED_SHADERS",t[t.ACTIVE_ATTRIBUTES=35721]="ACTIVE_ATTRIBUTES",t[t.ACTIVE_UNIFORMS=35718]="ACTIVE_UNIFORMS",t[t.MAX_VERTEX_ATTRIBS=34921]="MAX_VERTEX_ATTRIBS",t[t.MAX_VERTEX_UNIFORM_VECTORS=36347]="MAX_VERTEX_UNIFORM_VECTORS",t[t.MAX_VARYING_VECTORS=36348]="MAX_VARYING_VECTORS",t[t.MAX_COMBINED_TEXTURE_IMAGE_UNITS=35661]="MAX_COMBINED_TEXTURE_IMAGE_UNITS",t[t.MAX_VERTEX_TEXTURE_IMAGE_UNITS=35660]="MAX_VERTEX_TEXTURE_IMAGE_UNITS",t[t.MAX_TEXTURE_IMAGE_UNITS=34930]="MAX_TEXTURE_IMAGE_UNITS",t[t.MAX_FRAGMENT_UNIFORM_VECTORS=36349]="MAX_FRAGMENT_UNIFORM_VECTORS",t[t.SHADER_TYPE=35663]="SHADER_TYPE",t[t.SHADING_LANGUAGE_VERSION=35724]="SHADING_LANGUAGE_VERSION",t[t.CURRENT_PROGRAM=35725]="CURRENT_PROGRAM",t[t.NEVER=512]="NEVER",t[t.LESS=513]="LESS",t[t.EQUAL=514]="EQUAL",t[t.LEQUAL=515]="LEQUAL",t[t.GREATER=516]="GREATER",t[t.NOTEQUAL=517]="NOTEQUAL",t[t.GEQUAL=518]="GEQUAL",t[t.ALWAYS=519]="ALWAYS",t[t.KEEP=7680]="KEEP",t[t.REPLACE=7681]="REPLACE",t[t.INCR=7682]="INCR",t[t.DECR=7683]="DECR",t[t.INVERT=5386]="INVERT",t[t.INCR_WRAP=34055]="INCR_WRAP",t[t.DECR_WRAP=34056]="DECR_WRAP",t[t.NEAREST=9728]="NEAREST",t[t.LINEAR=9729]="LINEAR",t[t.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",t[t.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",t[t.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",t[t.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR",t[t.TEXTURE_MAG_FILTER=10240]="TEXTURE_MAG_FILTER",t[t.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",t[t.TEXTURE_WRAP_S=10242]="TEXTURE_WRAP_S",t[t.TEXTURE_WRAP_T=10243]="TEXTURE_WRAP_T",t[t.TEXTURE_2D=3553]="TEXTURE_2D",t[t.TEXTURE=5890]="TEXTURE",t[t.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",t[t.TEXTURE_BINDING_CUBE_MAP=34068]="TEXTURE_BINDING_CUBE_MAP",t[t.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",t[t.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",t[t.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",t[t.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",t[t.MAX_CUBE_MAP_TEXTURE_SIZE=34076]="MAX_CUBE_MAP_TEXTURE_SIZE",t[t.TEXTURE0=33984]="TEXTURE0",t[t.ACTIVE_TEXTURE=34016]="ACTIVE_TEXTURE",t[t.REPEAT=10497]="REPEAT",t[t.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",t[t.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",t[t.TEXTURE_WIDTH=4096]="TEXTURE_WIDTH",t[t.TEXTURE_HEIGHT=4097]="TEXTURE_HEIGHT",t[t.FLOAT_VEC2=35664]="FLOAT_VEC2",t[t.FLOAT_VEC3=35665]="FLOAT_VEC3",t[t.FLOAT_VEC4=35666]="FLOAT_VEC4",t[t.INT_VEC2=35667]="INT_VEC2",t[t.INT_VEC3=35668]="INT_VEC3",t[t.INT_VEC4=35669]="INT_VEC4",t[t.BOOL=35670]="BOOL",t[t.BOOL_VEC2=35671]="BOOL_VEC2",t[t.BOOL_VEC3=35672]="BOOL_VEC3",t[t.BOOL_VEC4=35673]="BOOL_VEC4",t[t.FLOAT_MAT2=35674]="FLOAT_MAT2",t[t.FLOAT_MAT3=35675]="FLOAT_MAT3",t[t.FLOAT_MAT4=35676]="FLOAT_MAT4",t[t.SAMPLER_2D=35678]="SAMPLER_2D",t[t.SAMPLER_CUBE=35680]="SAMPLER_CUBE",t[t.LOW_FLOAT=36336]="LOW_FLOAT",t[t.MEDIUM_FLOAT=36337]="MEDIUM_FLOAT",t[t.HIGH_FLOAT=36338]="HIGH_FLOAT",t[t.LOW_INT=36339]="LOW_INT",t[t.MEDIUM_INT=36340]="MEDIUM_INT",t[t.HIGH_INT=36341]="HIGH_INT",t[t.FRAMEBUFFER=36160]="FRAMEBUFFER",t[t.RENDERBUFFER=36161]="RENDERBUFFER",t[t.RGBA4=32854]="RGBA4",t[t.RGB5_A1=32855]="RGB5_A1",t[t.RGB565=36194]="RGB565",t[t.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",t[t.STENCIL_INDEX=6401]="STENCIL_INDEX",t[t.STENCIL_INDEX8=36168]="STENCIL_INDEX8",t[t.DEPTH_STENCIL=34041]="DEPTH_STENCIL",t[t.RENDERBUFFER_WIDTH=36162]="RENDERBUFFER_WIDTH",t[t.RENDERBUFFER_HEIGHT=36163]="RENDERBUFFER_HEIGHT",t[t.RENDERBUFFER_INTERNAL_FORMAT=36164]="RENDERBUFFER_INTERNAL_FORMAT",t[t.RENDERBUFFER_RED_SIZE=36176]="RENDERBUFFER_RED_SIZE",t[t.RENDERBUFFER_GREEN_SIZE=36177]="RENDERBUFFER_GREEN_SIZE",t[t.RENDERBUFFER_BLUE_SIZE=36178]="RENDERBUFFER_BLUE_SIZE",t[t.RENDERBUFFER_ALPHA_SIZE=36179]="RENDERBUFFER_ALPHA_SIZE",t[t.RENDERBUFFER_DEPTH_SIZE=36180]="RENDERBUFFER_DEPTH_SIZE",t[t.RENDERBUFFER_STENCIL_SIZE=36181]="RENDERBUFFER_STENCIL_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE=36048]="FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",t[t.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME=36049]="FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",t[t.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL=36050]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",t[t.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE=36051]="FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",t[t.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",t[t.DEPTH_ATTACHMENT=36096]="DEPTH_ATTACHMENT",t[t.STENCIL_ATTACHMENT=36128]="STENCIL_ATTACHMENT",t[t.DEPTH_STENCIL_ATTACHMENT=33306]="DEPTH_STENCIL_ATTACHMENT",t[t.NONE=0]="NONE",t[t.FRAMEBUFFER_COMPLETE=36053]="FRAMEBUFFER_COMPLETE",t[t.FRAMEBUFFER_INCOMPLETE_ATTACHMENT=36054]="FRAMEBUFFER_INCOMPLETE_ATTACHMENT",t[t.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=36055]="FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",t[t.FRAMEBUFFER_INCOMPLETE_DIMENSIONS=36057]="FRAMEBUFFER_INCOMPLETE_DIMENSIONS",t[t.FRAMEBUFFER_UNSUPPORTED=36061]="FRAMEBUFFER_UNSUPPORTED",t[t.FRAMEBUFFER_BINDING=36006]="FRAMEBUFFER_BINDING",t[t.RENDERBUFFER_BINDING=36007]="RENDERBUFFER_BINDING",t[t.READ_FRAMEBUFFER=36008]="READ_FRAMEBUFFER",t[t.DRAW_FRAMEBUFFER=36009]="DRAW_FRAMEBUFFER",t[t.MAX_RENDERBUFFER_SIZE=34024]="MAX_RENDERBUFFER_SIZE",t[t.INVALID_FRAMEBUFFER_OPERATION=1286]="INVALID_FRAMEBUFFER_OPERATION",t[t.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL",t[t.UNPACK_PREMULTIPLY_ALPHA_WEBGL=37441]="UNPACK_PREMULTIPLY_ALPHA_WEBGL",t[t.UNPACK_COLORSPACE_CONVERSION_WEBGL=37443]="UNPACK_COLORSPACE_CONVERSION_WEBGL",t[t.READ_BUFFER=3074]="READ_BUFFER",t[t.UNPACK_ROW_LENGTH=3314]="UNPACK_ROW_LENGTH",t[t.UNPACK_SKIP_ROWS=3315]="UNPACK_SKIP_ROWS",t[t.UNPACK_SKIP_PIXELS=3316]="UNPACK_SKIP_PIXELS",t[t.PACK_ROW_LENGTH=3330]="PACK_ROW_LENGTH",t[t.PACK_SKIP_ROWS=3331]="PACK_SKIP_ROWS",t[t.PACK_SKIP_PIXELS=3332]="PACK_SKIP_PIXELS",t[t.TEXTURE_BINDING_3D=32874]="TEXTURE_BINDING_3D",t[t.UNPACK_SKIP_IMAGES=32877]="UNPACK_SKIP_IMAGES",t[t.UNPACK_IMAGE_HEIGHT=32878]="UNPACK_IMAGE_HEIGHT",t[t.MAX_3D_TEXTURE_SIZE=32883]="MAX_3D_TEXTURE_SIZE",t[t.MAX_ELEMENTS_VERTICES=33e3]="MAX_ELEMENTS_VERTICES",t[t.MAX_ELEMENTS_INDICES=33001]="MAX_ELEMENTS_INDICES",t[t.MAX_TEXTURE_LOD_BIAS=34045]="MAX_TEXTURE_LOD_BIAS",t[t.MAX_FRAGMENT_UNIFORM_COMPONENTS=35657]="MAX_FRAGMENT_UNIFORM_COMPONENTS",t[t.MAX_VERTEX_UNIFORM_COMPONENTS=35658]="MAX_VERTEX_UNIFORM_COMPONENTS",t[t.MAX_ARRAY_TEXTURE_LAYERS=35071]="MAX_ARRAY_TEXTURE_LAYERS",t[t.MIN_PROGRAM_TEXEL_OFFSET=35076]="MIN_PROGRAM_TEXEL_OFFSET",t[t.MAX_PROGRAM_TEXEL_OFFSET=35077]="MAX_PROGRAM_TEXEL_OFFSET",t[t.MAX_VARYING_COMPONENTS=35659]="MAX_VARYING_COMPONENTS",t[t.FRAGMENT_SHADER_DERIVATIVE_HINT=35723]="FRAGMENT_SHADER_DERIVATIVE_HINT",t[t.RASTERIZER_DISCARD=35977]="RASTERIZER_DISCARD",t[t.VERTEX_ARRAY_BINDING=34229]="VERTEX_ARRAY_BINDING",t[t.MAX_VERTEX_OUTPUT_COMPONENTS=37154]="MAX_VERTEX_OUTPUT_COMPONENTS",t[t.MAX_FRAGMENT_INPUT_COMPONENTS=37157]="MAX_FRAGMENT_INPUT_COMPONENTS",t[t.MAX_SERVER_WAIT_TIMEOUT=37137]="MAX_SERVER_WAIT_TIMEOUT",t[t.MAX_ELEMENT_INDEX=36203]="MAX_ELEMENT_INDEX",t[t.RED=6403]="RED",t[t.RGB8=32849]="RGB8",t[t.RGBA8=32856]="RGBA8",t[t.RGB10_A2=32857]="RGB10_A2",t[t.TEXTURE_3D=32879]="TEXTURE_3D",t[t.TEXTURE_WRAP_R=32882]="TEXTURE_WRAP_R",t[t.TEXTURE_MIN_LOD=33082]="TEXTURE_MIN_LOD",t[t.TEXTURE_MAX_LOD=33083]="TEXTURE_MAX_LOD",t[t.TEXTURE_BASE_LEVEL=33084]="TEXTURE_BASE_LEVEL",t[t.TEXTURE_MAX_LEVEL=33085]="TEXTURE_MAX_LEVEL",t[t.TEXTURE_COMPARE_MODE=34892]="TEXTURE_COMPARE_MODE",t[t.TEXTURE_COMPARE_FUNC=34893]="TEXTURE_COMPARE_FUNC",t[t.SRGB=35904]="SRGB",t[t.SRGB8=35905]="SRGB8",t[t.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",t[t.COMPARE_REF_TO_TEXTURE=34894]="COMPARE_REF_TO_TEXTURE",t[t.RGBA32F=34836]="RGBA32F",t[t.RGB32F=34837]="RGB32F",t[t.RGBA16F=34842]="RGBA16F",t[t.RGB16F=34843]="RGB16F",t[t.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",t[t.TEXTURE_BINDING_2D_ARRAY=35869]="TEXTURE_BINDING_2D_ARRAY",t[t.R11F_G11F_B10F=35898]="R11F_G11F_B10F",t[t.RGB9_E5=35901]="RGB9_E5",t[t.RGBA32UI=36208]="RGBA32UI",t[t.RGB32UI=36209]="RGB32UI",t[t.RGBA16UI=36214]="RGBA16UI",t[t.RGB16UI=36215]="RGB16UI",t[t.RGBA8UI=36220]="RGBA8UI",t[t.RGB8UI=36221]="RGB8UI",t[t.RGBA32I=36226]="RGBA32I",t[t.RGB32I=36227]="RGB32I",t[t.RGBA16I=36232]="RGBA16I",t[t.RGB16I=36233]="RGB16I",t[t.RGBA8I=36238]="RGBA8I",t[t.RGB8I=36239]="RGB8I",t[t.RED_INTEGER=36244]="RED_INTEGER",t[t.RGB_INTEGER=36248]="RGB_INTEGER",t[t.RGBA_INTEGER=36249]="RGBA_INTEGER",t[t.R8=33321]="R8",t[t.RG8=33323]="RG8",t[t.R16F=33325]="R16F",t[t.R32F=33326]="R32F",t[t.RG16F=33327]="RG16F",t[t.RG32F=33328]="RG32F",t[t.R8I=33329]="R8I",t[t.R8UI=33330]="R8UI",t[t.R16I=33331]="R16I",t[t.R16UI=33332]="R16UI",t[t.R32I=33333]="R32I",t[t.R32UI=33334]="R32UI",t[t.RG8I=33335]="RG8I",t[t.RG8UI=33336]="RG8UI",t[t.RG16I=33337]="RG16I",t[t.RG16UI=33338]="RG16UI",t[t.RG32I=33339]="RG32I",t[t.RG32UI=33340]="RG32UI",t[t.R8_SNORM=36756]="R8_SNORM",t[t.RG8_SNORM=36757]="RG8_SNORM",t[t.RGB8_SNORM=36758]="RGB8_SNORM",t[t.RGBA8_SNORM=36759]="RGBA8_SNORM",t[t.RGB10_A2UI=36975]="RGB10_A2UI",t[t.TEXTURE_IMMUTABLE_FORMAT=37167]="TEXTURE_IMMUTABLE_FORMAT",t[t.TEXTURE_IMMUTABLE_LEVELS=33503]="TEXTURE_IMMUTABLE_LEVELS",t[t.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",t[t.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",t[t.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",t[t.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",t[t.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",t[t.HALF_FLOAT=5131]="HALF_FLOAT",t[t.RG=33319]="RG",t[t.RG_INTEGER=33320]="RG_INTEGER",t[t.INT_2_10_10_10_REV=36255]="INT_2_10_10_10_REV",t[t.CURRENT_QUERY=34917]="CURRENT_QUERY",t[t.QUERY_RESULT=34918]="QUERY_RESULT",t[t.QUERY_RESULT_AVAILABLE=34919]="QUERY_RESULT_AVAILABLE",t[t.ANY_SAMPLES_PASSED=35887]="ANY_SAMPLES_PASSED",t[t.ANY_SAMPLES_PASSED_CONSERVATIVE=36202]="ANY_SAMPLES_PASSED_CONSERVATIVE",t[t.MAX_DRAW_BUFFERS=34852]="MAX_DRAW_BUFFERS",t[t.DRAW_BUFFER0=34853]="DRAW_BUFFER0",t[t.DRAW_BUFFER1=34854]="DRAW_BUFFER1",t[t.DRAW_BUFFER2=34855]="DRAW_BUFFER2",t[t.DRAW_BUFFER3=34856]="DRAW_BUFFER3",t[t.DRAW_BUFFER4=34857]="DRAW_BUFFER4",t[t.DRAW_BUFFER5=34858]="DRAW_BUFFER5",t[t.DRAW_BUFFER6=34859]="DRAW_BUFFER6",t[t.DRAW_BUFFER7=34860]="DRAW_BUFFER7",t[t.DRAW_BUFFER8=34861]="DRAW_BUFFER8",t[t.DRAW_BUFFER9=34862]="DRAW_BUFFER9",t[t.DRAW_BUFFER10=34863]="DRAW_BUFFER10",t[t.DRAW_BUFFER11=34864]="DRAW_BUFFER11",t[t.DRAW_BUFFER12=34865]="DRAW_BUFFER12",t[t.DRAW_BUFFER13=34866]="DRAW_BUFFER13",t[t.DRAW_BUFFER14=34867]="DRAW_BUFFER14",t[t.DRAW_BUFFER15=34868]="DRAW_BUFFER15",t[t.MAX_COLOR_ATTACHMENTS=36063]="MAX_COLOR_ATTACHMENTS",t[t.COLOR_ATTACHMENT1=36065]="COLOR_ATTACHMENT1",t[t.COLOR_ATTACHMENT2=36066]="COLOR_ATTACHMENT2",t[t.COLOR_ATTACHMENT3=36067]="COLOR_ATTACHMENT3",t[t.COLOR_ATTACHMENT4=36068]="COLOR_ATTACHMENT4",t[t.COLOR_ATTACHMENT5=36069]="COLOR_ATTACHMENT5",t[t.COLOR_ATTACHMENT6=36070]="COLOR_ATTACHMENT6",t[t.COLOR_ATTACHMENT7=36071]="COLOR_ATTACHMENT7",t[t.COLOR_ATTACHMENT8=36072]="COLOR_ATTACHMENT8",t[t.COLOR_ATTACHMENT9=36073]="COLOR_ATTACHMENT9",t[t.COLOR_ATTACHMENT10=36074]="COLOR_ATTACHMENT10",t[t.COLOR_ATTACHMENT11=36075]="COLOR_ATTACHMENT11",t[t.COLOR_ATTACHMENT12=36076]="COLOR_ATTACHMENT12",t[t.COLOR_ATTACHMENT13=36077]="COLOR_ATTACHMENT13",t[t.COLOR_ATTACHMENT14=36078]="COLOR_ATTACHMENT14",t[t.COLOR_ATTACHMENT15=36079]="COLOR_ATTACHMENT15",t[t.SAMPLER_3D=35679]="SAMPLER_3D",t[t.SAMPLER_2D_SHADOW=35682]="SAMPLER_2D_SHADOW",t[t.SAMPLER_2D_ARRAY=36289]="SAMPLER_2D_ARRAY",t[t.SAMPLER_2D_ARRAY_SHADOW=36292]="SAMPLER_2D_ARRAY_SHADOW",t[t.SAMPLER_CUBE_SHADOW=36293]="SAMPLER_CUBE_SHADOW",t[t.INT_SAMPLER_2D=36298]="INT_SAMPLER_2D",t[t.INT_SAMPLER_3D=36299]="INT_SAMPLER_3D",t[t.INT_SAMPLER_CUBE=36300]="INT_SAMPLER_CUBE",t[t.INT_SAMPLER_2D_ARRAY=36303]="INT_SAMPLER_2D_ARRAY",t[t.UNSIGNED_INT_SAMPLER_2D=36306]="UNSIGNED_INT_SAMPLER_2D",t[t.UNSIGNED_INT_SAMPLER_3D=36307]="UNSIGNED_INT_SAMPLER_3D",t[t.UNSIGNED_INT_SAMPLER_CUBE=36308]="UNSIGNED_INT_SAMPLER_CUBE",t[t.UNSIGNED_INT_SAMPLER_2D_ARRAY=36311]="UNSIGNED_INT_SAMPLER_2D_ARRAY",t[t.MAX_SAMPLES=36183]="MAX_SAMPLES",t[t.SAMPLER_BINDING=35097]="SAMPLER_BINDING",t[t.PIXEL_PACK_BUFFER=35051]="PIXEL_PACK_BUFFER",t[t.PIXEL_UNPACK_BUFFER=35052]="PIXEL_UNPACK_BUFFER",t[t.PIXEL_PACK_BUFFER_BINDING=35053]="PIXEL_PACK_BUFFER_BINDING",t[t.PIXEL_UNPACK_BUFFER_BINDING=35055]="PIXEL_UNPACK_BUFFER_BINDING",t[t.COPY_READ_BUFFER=36662]="COPY_READ_BUFFER",t[t.COPY_WRITE_BUFFER=36663]="COPY_WRITE_BUFFER",t[t.COPY_READ_BUFFER_BINDING=36662]="COPY_READ_BUFFER_BINDING",t[t.COPY_WRITE_BUFFER_BINDING=36663]="COPY_WRITE_BUFFER_BINDING",t[t.FLOAT_MAT2x3=35685]="FLOAT_MAT2x3",t[t.FLOAT_MAT2x4=35686]="FLOAT_MAT2x4",t[t.FLOAT_MAT3x2=35687]="FLOAT_MAT3x2",t[t.FLOAT_MAT3x4=35688]="FLOAT_MAT3x4",t[t.FLOAT_MAT4x2=35689]="FLOAT_MAT4x2",t[t.FLOAT_MAT4x3=35690]="FLOAT_MAT4x3",t[t.UNSIGNED_INT_VEC2=36294]="UNSIGNED_INT_VEC2",t[t.UNSIGNED_INT_VEC3=36295]="UNSIGNED_INT_VEC3",t[t.UNSIGNED_INT_VEC4=36296]="UNSIGNED_INT_VEC4",t[t.UNSIGNED_NORMALIZED=35863]="UNSIGNED_NORMALIZED",t[t.SIGNED_NORMALIZED=36764]="SIGNED_NORMALIZED",t[t.VERTEX_ATTRIB_ARRAY_INTEGER=35069]="VERTEX_ATTRIB_ARRAY_INTEGER",t[t.VERTEX_ATTRIB_ARRAY_DIVISOR=35070]="VERTEX_ATTRIB_ARRAY_DIVISOR",t[t.TRANSFORM_FEEDBACK_BUFFER_MODE=35967]="TRANSFORM_FEEDBACK_BUFFER_MODE",t[t.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS=35968]="MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS",t[t.TRANSFORM_FEEDBACK_VARYINGS=35971]="TRANSFORM_FEEDBACK_VARYINGS",t[t.TRANSFORM_FEEDBACK_BUFFER_START=35972]="TRANSFORM_FEEDBACK_BUFFER_START",t[t.TRANSFORM_FEEDBACK_BUFFER_SIZE=35973]="TRANSFORM_FEEDBACK_BUFFER_SIZE",t[t.TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN=35976]="TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN",t[t.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS=35978]="MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS",t[t.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS=35979]="MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS",t[t.INTERLEAVED_ATTRIBS=35980]="INTERLEAVED_ATTRIBS",t[t.SEPARATE_ATTRIBS=35981]="SEPARATE_ATTRIBS",t[t.TRANSFORM_FEEDBACK_BUFFER=35982]="TRANSFORM_FEEDBACK_BUFFER",t[t.TRANSFORM_FEEDBACK_BUFFER_BINDING=35983]="TRANSFORM_FEEDBACK_BUFFER_BINDING",t[t.TRANSFORM_FEEDBACK=36386]="TRANSFORM_FEEDBACK",t[t.TRANSFORM_FEEDBACK_PAUSED=36387]="TRANSFORM_FEEDBACK_PAUSED",t[t.TRANSFORM_FEEDBACK_ACTIVE=36388]="TRANSFORM_FEEDBACK_ACTIVE",t[t.TRANSFORM_FEEDBACK_BINDING=36389]="TRANSFORM_FEEDBACK_BINDING",t[t.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING=33296]="FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING",t[t.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE=33297]="FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE",t[t.FRAMEBUFFER_ATTACHMENT_RED_SIZE=33298]="FRAMEBUFFER_ATTACHMENT_RED_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_GREEN_SIZE=33299]="FRAMEBUFFER_ATTACHMENT_GREEN_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_BLUE_SIZE=33300]="FRAMEBUFFER_ATTACHMENT_BLUE_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE=33301]="FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE=33302]="FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE",t[t.FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE=33303]="FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE",t[t.FRAMEBUFFER_DEFAULT=33304]="FRAMEBUFFER_DEFAULT",t[t.DEPTH24_STENCIL8=35056]="DEPTH24_STENCIL8",t[t.DRAW_FRAMEBUFFER_BINDING=36006]="DRAW_FRAMEBUFFER_BINDING",t[t.READ_FRAMEBUFFER_BINDING=36010]="READ_FRAMEBUFFER_BINDING",t[t.RENDERBUFFER_SAMPLES=36011]="RENDERBUFFER_SAMPLES",t[t.FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER=36052]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER",t[t.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE=36182]="FRAMEBUFFER_INCOMPLETE_MULTISAMPLE",t[t.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",t[t.UNIFORM_BUFFER_BINDING=35368]="UNIFORM_BUFFER_BINDING",t[t.UNIFORM_BUFFER_START=35369]="UNIFORM_BUFFER_START",t[t.UNIFORM_BUFFER_SIZE=35370]="UNIFORM_BUFFER_SIZE",t[t.MAX_VERTEX_UNIFORM_BLOCKS=35371]="MAX_VERTEX_UNIFORM_BLOCKS",t[t.MAX_FRAGMENT_UNIFORM_BLOCKS=35373]="MAX_FRAGMENT_UNIFORM_BLOCKS",t[t.MAX_COMBINED_UNIFORM_BLOCKS=35374]="MAX_COMBINED_UNIFORM_BLOCKS",t[t.MAX_UNIFORM_BUFFER_BINDINGS=35375]="MAX_UNIFORM_BUFFER_BINDINGS",t[t.MAX_UNIFORM_BLOCK_SIZE=35376]="MAX_UNIFORM_BLOCK_SIZE",t[t.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS=35377]="MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS",t[t.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS=35379]="MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS",t[t.UNIFORM_BUFFER_OFFSET_ALIGNMENT=35380]="UNIFORM_BUFFER_OFFSET_ALIGNMENT",t[t.ACTIVE_UNIFORM_BLOCKS=35382]="ACTIVE_UNIFORM_BLOCKS",t[t.UNIFORM_TYPE=35383]="UNIFORM_TYPE",t[t.UNIFORM_SIZE=35384]="UNIFORM_SIZE",t[t.UNIFORM_BLOCK_INDEX=35386]="UNIFORM_BLOCK_INDEX",t[t.UNIFORM_OFFSET=35387]="UNIFORM_OFFSET",t[t.UNIFORM_ARRAY_STRIDE=35388]="UNIFORM_ARRAY_STRIDE",t[t.UNIFORM_MATRIX_STRIDE=35389]="UNIFORM_MATRIX_STRIDE",t[t.UNIFORM_IS_ROW_MAJOR=35390]="UNIFORM_IS_ROW_MAJOR",t[t.UNIFORM_BLOCK_BINDING=35391]="UNIFORM_BLOCK_BINDING",t[t.UNIFORM_BLOCK_DATA_SIZE=35392]="UNIFORM_BLOCK_DATA_SIZE",t[t.UNIFORM_BLOCK_ACTIVE_UNIFORMS=35394]="UNIFORM_BLOCK_ACTIVE_UNIFORMS",t[t.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES=35395]="UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES",t[t.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER=35396]="UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER",t[t.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER=35398]="UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER",t[t.OBJECT_TYPE=37138]="OBJECT_TYPE",t[t.SYNC_CONDITION=37139]="SYNC_CONDITION",t[t.SYNC_STATUS=37140]="SYNC_STATUS",t[t.SYNC_FLAGS=37141]="SYNC_FLAGS",t[t.SYNC_FENCE=37142]="SYNC_FENCE",t[t.SYNC_GPU_COMMANDS_COMPLETE=37143]="SYNC_GPU_COMMANDS_COMPLETE",t[t.UNSIGNALED=37144]="UNSIGNALED",t[t.SIGNALED=37145]="SIGNALED",t[t.ALREADY_SIGNALED=37146]="ALREADY_SIGNALED",t[t.TIMEOUT_EXPIRED=37147]="TIMEOUT_EXPIRED",t[t.CONDITION_SATISFIED=37148]="CONDITION_SATISFIED",t[t.WAIT_FAILED=37149]="WAIT_FAILED",t[t.SYNC_FLUSH_COMMANDS_BIT=1]="SYNC_FLUSH_COMMANDS_BIT",t[t.COLOR=6144]="COLOR",t[t.DEPTH=6145]="DEPTH",t[t.STENCIL=6146]="STENCIL",t[t.MIN=32775]="MIN",t[t.MAX=32776]="MAX",t[t.DEPTH_COMPONENT24=33190]="DEPTH_COMPONENT24",t[t.STREAM_READ=35041]="STREAM_READ",t[t.STREAM_COPY=35042]="STREAM_COPY",t[t.STATIC_READ=35045]="STATIC_READ",t[t.STATIC_COPY=35046]="STATIC_COPY",t[t.DYNAMIC_READ=35049]="DYNAMIC_READ",t[t.DYNAMIC_COPY=35050]="DYNAMIC_COPY",t[t.DEPTH_COMPONENT32F=36012]="DEPTH_COMPONENT32F",t[t.DEPTH32F_STENCIL8=36013]="DEPTH32F_STENCIL8",t[t.INVALID_INDEX=4294967295]="INVALID_INDEX",t[t.TIMEOUT_IGNORED=-1]="TIMEOUT_IGNORED",t[t.MAX_CLIENT_WAIT_TIMEOUT_WEBGL=37447]="MAX_CLIENT_WAIT_TIMEOUT_WEBGL",t[t.UNMASKED_VENDOR_WEBGL=37445]="UNMASKED_VENDOR_WEBGL",t[t.UNMASKED_RENDERER_WEBGL=37446]="UNMASKED_RENDERER_WEBGL",t[t.MAX_TEXTURE_MAX_ANISOTROPY_EXT=34047]="MAX_TEXTURE_MAX_ANISOTROPY_EXT",t[t.TEXTURE_MAX_ANISOTROPY_EXT=34046]="TEXTURE_MAX_ANISOTROPY_EXT",t[t.R16_EXT=33322]="R16_EXT",t[t.RG16_EXT=33324]="RG16_EXT",t[t.RGB16_EXT=32852]="RGB16_EXT",t[t.RGBA16_EXT=32859]="RGBA16_EXT",t[t.R16_SNORM_EXT=36760]="R16_SNORM_EXT",t[t.RG16_SNORM_EXT=36761]="RG16_SNORM_EXT",t[t.RGB16_SNORM_EXT=36762]="RGB16_SNORM_EXT",t[t.RGBA16_SNORM_EXT=36763]="RGBA16_SNORM_EXT",t[t.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",t[t.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",t[t.COMPRESSED_RED_RGTC1_EXT=36283]="COMPRESSED_RED_RGTC1_EXT",t[t.COMPRESSED_SIGNED_RED_RGTC1_EXT=36284]="COMPRESSED_SIGNED_RED_RGTC1_EXT",t[t.COMPRESSED_RED_GREEN_RGTC2_EXT=36285]="COMPRESSED_RED_GREEN_RGTC2_EXT",t[t.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT=36286]="COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT",t[t.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",t[t.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",t[t.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",t[t.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",t[t.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",t[t.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",t[t.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",t[t.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",t[t.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",t[t.COMPRESSED_RGBA8_ETC2_EAC=37493]="COMPRESSED_RGBA8_ETC2_EAC",t[t.COMPRESSED_SRGB8_ETC2=37494]="COMPRESSED_SRGB8_ETC2",t[t.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37495]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",t[t.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37496]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",t[t.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37497]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",t[t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",t[t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",t[t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",t[t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",t[t.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",t[t.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",t[t.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",t[t.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",t[t.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",t[t.COMPRESSED_RGBA_ASTC_5x4_KHR=37809]="COMPRESSED_RGBA_ASTC_5x4_KHR",t[t.COMPRESSED_RGBA_ASTC_5x5_KHR=37810]="COMPRESSED_RGBA_ASTC_5x5_KHR",t[t.COMPRESSED_RGBA_ASTC_6x5_KHR=37811]="COMPRESSED_RGBA_ASTC_6x5_KHR",t[t.COMPRESSED_RGBA_ASTC_6x6_KHR=37812]="COMPRESSED_RGBA_ASTC_6x6_KHR",t[t.COMPRESSED_RGBA_ASTC_8x5_KHR=37813]="COMPRESSED_RGBA_ASTC_8x5_KHR",t[t.COMPRESSED_RGBA_ASTC_8x6_KHR=37814]="COMPRESSED_RGBA_ASTC_8x6_KHR",t[t.COMPRESSED_RGBA_ASTC_8x8_KHR=37815]="COMPRESSED_RGBA_ASTC_8x8_KHR",t[t.COMPRESSED_RGBA_ASTC_10x5_KHR=37816]="COMPRESSED_RGBA_ASTC_10x5_KHR",t[t.COMPRESSED_RGBA_ASTC_10x6_KHR=37817]="COMPRESSED_RGBA_ASTC_10x6_KHR",t[t.COMPRESSED_RGBA_ASTC_10x8_KHR=37818]="COMPRESSED_RGBA_ASTC_10x8_KHR",t[t.COMPRESSED_RGBA_ASTC_10x10_KHR=37819]="COMPRESSED_RGBA_ASTC_10x10_KHR",t[t.COMPRESSED_RGBA_ASTC_12x10_KHR=37820]="COMPRESSED_RGBA_ASTC_12x10_KHR",t[t.COMPRESSED_RGBA_ASTC_12x12_KHR=37821]="COMPRESSED_RGBA_ASTC_12x12_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=37840]="COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR=37841]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR=37842]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR=37843]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR=37844]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR=37845]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR=37846]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR=37847]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR=37848]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR=37849]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR=37850]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR=37851]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR=37852]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR=37853]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR",t[t.QUERY_COUNTER_BITS_EXT=34916]="QUERY_COUNTER_BITS_EXT",t[t.CURRENT_QUERY_EXT=34917]="CURRENT_QUERY_EXT",t[t.QUERY_RESULT_EXT=34918]="QUERY_RESULT_EXT",t[t.QUERY_RESULT_AVAILABLE_EXT=34919]="QUERY_RESULT_AVAILABLE_EXT",t[t.TIME_ELAPSED_EXT=35007]="TIME_ELAPSED_EXT",t[t.TIMESTAMP_EXT=36392]="TIMESTAMP_EXT",t[t.GPU_DISJOINT_EXT=36795]="GPU_DISJOINT_EXT",t[t.COMPLETION_STATUS_KHR=37297]="COMPLETION_STATUS_KHR",t[t.DEPTH_CLAMP_EXT=34383]="DEPTH_CLAMP_EXT",t[t.FIRST_VERTEX_CONVENTION_WEBGL=36429]="FIRST_VERTEX_CONVENTION_WEBGL",t[t.LAST_VERTEX_CONVENTION_WEBGL=36430]="LAST_VERTEX_CONVENTION_WEBGL",t[t.PROVOKING_VERTEX_WEBL=36431]="PROVOKING_VERTEX_WEBL",t[t.POLYGON_MODE_WEBGL=2880]="POLYGON_MODE_WEBGL",t[t.POLYGON_OFFSET_LINE_WEBGL=10754]="POLYGON_OFFSET_LINE_WEBGL",t[t.LINE_WEBGL=6913]="LINE_WEBGL",t[t.FILL_WEBGL=6914]="FILL_WEBGL",t[t.MAX_CLIP_DISTANCES_WEBGL=3378]="MAX_CLIP_DISTANCES_WEBGL",t[t.MAX_CULL_DISTANCES_WEBGL=33529]="MAX_CULL_DISTANCES_WEBGL",t[t.MAX_COMBINED_CLIP_AND_CULL_DISTANCES_WEBGL=33530]="MAX_COMBINED_CLIP_AND_CULL_DISTANCES_WEBGL",t[t.CLIP_DISTANCE0_WEBGL=12288]="CLIP_DISTANCE0_WEBGL",t[t.CLIP_DISTANCE1_WEBGL=12289]="CLIP_DISTANCE1_WEBGL",t[t.CLIP_DISTANCE2_WEBGL=12290]="CLIP_DISTANCE2_WEBGL",t[t.CLIP_DISTANCE3_WEBGL=12291]="CLIP_DISTANCE3_WEBGL",t[t.CLIP_DISTANCE4_WEBGL=12292]="CLIP_DISTANCE4_WEBGL",t[t.CLIP_DISTANCE5_WEBGL=12293]="CLIP_DISTANCE5_WEBGL",t[t.CLIP_DISTANCE6_WEBGL=12294]="CLIP_DISTANCE6_WEBGL",t[t.CLIP_DISTANCE7_WEBGL=12295]="CLIP_DISTANCE7_WEBGL",t[t.POLYGON_OFFSET_CLAMP_EXT=36379]="POLYGON_OFFSET_CLAMP_EXT",t[t.LOWER_LEFT_EXT=36001]="LOWER_LEFT_EXT",t[t.UPPER_LEFT_EXT=36002]="UPPER_LEFT_EXT",t[t.NEGATIVE_ONE_TO_ONE_EXT=37726]="NEGATIVE_ONE_TO_ONE_EXT",t[t.ZERO_TO_ONE_EXT=37727]="ZERO_TO_ONE_EXT",t[t.CLIP_ORIGIN_EXT=37724]="CLIP_ORIGIN_EXT",t[t.CLIP_DEPTH_MODE_EXT=37725]="CLIP_DEPTH_MODE_EXT",t[t.SRC1_COLOR_WEBGL=35065]="SRC1_COLOR_WEBGL",t[t.SRC1_ALPHA_WEBGL=34185]="SRC1_ALPHA_WEBGL",t[t.ONE_MINUS_SRC1_COLOR_WEBGL=35066]="ONE_MINUS_SRC1_COLOR_WEBGL",t[t.ONE_MINUS_SRC1_ALPHA_WEBGL=35067]="ONE_MINUS_SRC1_ALPHA_WEBGL",t[t.MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL=35068]="MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL",t[t.MIRROR_CLAMP_TO_EDGE_EXT=34627]="MIRROR_CLAMP_TO_EDGE_EXT"}
2153)(Gf||(Gf={}));const JB="modulepreload",eN=function(t){return"/"+t},Fw={},Uw=function(e,i,n){let o=Promise.resolve();if(i&&i.length>0){let p=function(R){return Promise.all(R.map(B=>Promise.resolve(B).then(N=>({status:"fulfilled",value:N}),N=>({status:"rejected",reason:N}))))};document.getElementsByTagName("link");const h=document.querySelector("meta[property=csp-nonce]"),A=(h==null?void 0:h.nonce)||(h==null?void 0:h.getAttribute("nonce"));o=p(i.map(R=>{if(R=eN(R),R in Fw)return;Fw[R]=!0;const B=R.endsWith(".css"),N=B?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${R}"]${N}`))return;const F=document.createElement("link");if(F.rel=B?"stylesheet":JB,B||(F.as="script"),F.crossOrigin="",F.href=R,A&&F.setAttribute("nonce",A),document.head.appendChild(F),B)return new Promise((Q,re)=>{F.addEventListener("load",Q),F.addEventListener("error",()=>re(new Error(`Unable to preload CSS for ${R}`)))})}))}function d(p){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=p,window.dispatchEvent(h),!h.defaultPrevented)throw p}return o.then(p=>{for(const h of p||[])h.status==="rejected"&&d(h.reason);return e().catch(d)})},tN={WEBGL_depth_texture:{UNSIGNED_INT_24_8_WEBGL:34042},OES_element_index_uint:{},OES_texture_float:{},OES_texture_half_float:{HALF_FLOAT_OES:5131},EXT_color_buffer_float:{},OES_standard_derivatives:{FRAGMENT_SHADER_DERIVATIVE_HINT_OES:35723},EXT_frag_depth:{},EXT_blend_minmax:{MIN_EXT:32775,MAX_EXT:32776},EXT_shader_texture_lod:{}},iN=t=>({drawBuffersWEBGL(e){return t.drawBuffers(e)},COLOR_ATTACHMENT0_WEBGL:36064,COLOR_ATTACHMENT1_WEBGL:36065,COLOR_ATTACHMENT2_WEBGL:36066,COLOR_ATTACHMENT3_WEBGL:36067}),nN=t=>({VERTEX_ARRAY_BINDING_OES:34229,createVertexArrayOES(){return t.createVertexArray()},deleteVertexArrayOES(e){return t.deleteVertexArray(e)},isVertexArrayOES(e){return t.isVertexArray(e)},bindVertexArrayOES(e){return t.bindVertexArray(e)}}),rN=t=>({VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE:35070,drawArraysInstancedANGLE(...e){return t.drawArraysInstanced(...e)},drawElementsInstancedANGLE(...e){return t.drawElementsInstanced(...e)},vertexAttribDivisorANGLE(...e){return t.vertexAttribDivisor(...e)}});function sN(t=!0){const e=HTMLCanvasElement.prototype;if(!t&&e.originalGetContext){e.getContext=e.originalGetContext,e.originalGetContext=void 0;return}e.originalGetContext=e.getContext,e.getContext=function(i,n){if(i==="webgl"||i==="experimental-webgl"){const o=this.originalGetContext("webgl2",n);return o instanceof HTMLElement&&aN(o),o}return this.originalGetContext(i,n)}}function aN(t){t.getExtension("EXT_color_buffer_float");const e={...tN,WEBGL_disjoint_timer_query:t.getExtension("EXT_disjoint_timer_query_webgl2"),WEBGL_draw_buffers:iN(t),OES_vertex_array_object:nN(t),ANGLE_instanced_arrays:rN(t)},i=t.getExtension;t.getExtension=function(o){const d=i.call(t,o);return d||(o in e?e[o]:null)};const n=t.getSupportedExtensions;t.getSupportedExtensions=function(){const o=n.apply(t)||[];return o==null?void 0:o.concat(Object.keys(e))}}async function Q2(t,e){const i=document.getElementsByTagName("head")[0];if(!i)throw new Error("loadScript");const n=document.createElement("script");return n.setAttribute("type","text/javascript"),n.setAttribute("src",t),new Promise((o,d)=>{n.onload=o,n.onerror=p=>d(new Error(`Unable to load script '${t}': ${p}`)),i.appendChild(n)})}function Py(t){const e=t.luma||{_polyfilled:!1,extensions:{},softwareRenderer:!1};return e._polyfilled??(e._polyfilled=!1),e.extensions||(e.extensions={}),t.luma=e,e}const oN=1;let Vn=null,jw=!1;const mx={debugSpectorJS:at.get("debug-spectorjs"),debugSpectorJSUrl:"https://cdn.jsdelivr.net/npm/[email protected]/dist/spector.bundle.js",gl:void 0};async function lN(t){if(!globalThis.SPECTOR)try{await Q2(t.debugSpectorJSUrl||mx.debugSpectorJSUrl)}catch(e){at.warn(String(e))}}function cN(t){var e;if(t={...mx,...t},!t.debugSpectorJS)return null;if(!Vn&&globalThis.SPECTOR&&!((e=globalThis.luma)!=null&&e.spector)){at.probe(oN,"SPECTOR found and initialized. Start with `luma.spector.displayUI()`")();const{Spector:i}=globalThis.SPECTOR;Vn=new i,globalThis.luma&&(globalThis.luma.spector=Vn)}if(!Vn)return null;if(jw||(jw=!0,Vn.spyCanvases(),Vn==null||Vn.onCaptureStarted.add(i=>at.info("Spector capture started:",i)()),Vn==null||Vn.onCapture.add(i=>{at.info("Spector capture complete:",i)(),Vn==null||Vn.getResultUI(),Vn==null||Vn.resultView.display(),Vn==null||Vn.resultView.addCapture(i)})),t.gl){const i=t.gl,n=Py(i),o=n.device;Vn==null||Vn.startCapture(t.gl,500),n.device=o,new Promise(d=>setTimeout(d,2e3)).then(d=>{at.info("Spector capture stopped after 2 seconds")(),Vn==null||Vn.stopCapture()})}return Vn}const uN="https://unpkg.com/[email protected]/index.js";function J2(t){return t.luma=t.luma||{},t.luma}async function hN(){zd()&&!globalThis.WebGLDebugUtils&&(globalThis.global=globalThis.global||globalThis,globalThis.global.module={},await Q2(uN))}function dN(t,e={}){return e.debugWebGL||e.traceWebGL?pN(t,e):fN(t)}function fN(t){const e=J2(t);return e.realContext?e.realContext:t}function pN(t,e){if(!globalThis.WebGLDebugUtils)return at.warn("webgl-debug not loaded")(),t;
2153const i=J2(t);if(i.debugContext)return i.debugContext;globalThis.WebGLDebugUtils.init({...Gf,...t});const n=globalThis.WebGLDebugUtils.makeDebugContext(t,mN.bind(null,e),gN.bind(null,e));for(const p in Gf)!(p in n)&&typeof Gf[p]=="number"&&(n[p]=Gf[p]);class o{}Object.setPrototypeOf(n,Object.getPrototypeOf(t)),Object.setPrototypeOf(o,n);const d=Object.create(o);return i.realContext=t,i.debugContext=d,d.luma=i,d.debug=!0,d}function Vw(t,e){e=Array.from(e).map(n=>n===void 0?"undefined":n);let i=globalThis.WebGLDebugUtils.glFunctionArgsToString(t,e);return i=`${i.slice(0,100)}${i.length>100?"...":""}`,`gl.${t}(${i})`}function mN(t,e,i,n){n=Array.from(n).map(h=>h===void 0?"undefined":h);const o=globalThis.WebGLDebugUtils.glEnumToString(e),d=globalThis.WebGLDebugUtils.glFunctionArgsToString(i,n),p=`${o} in gl.${i}(${d})`;at.error("%cWebGL","color: white; background: red; padding: 2px 6px; border-radius: 3px;",p)();debugger;throw new Error(p)}function gN(t,e,i){let n="";t.traceWebGL&&at.level>=1&&(n=Vw(e,i),at.info(1,"%cWebGL","color: white; background: blue; padding: 2px 6px; border-radius: 3px;",n)());for(const o of i)if(o===void 0){n=n||Vw(e,i);debugger}}const Hm=1;class _N extends lI{constructor(){super();Y(this,"type","webgl");Id.defaultProps={...Id.defaultProps,...mx}}enforceWebGL2(i){sN(i)}isSupported(){return typeof WebGL2RenderingContext<"u"}isDeviceHandle(i){return typeof WebGL2RenderingContext<"u"&&i instanceof WebGL2RenderingContext?!0:(typeof WebGLRenderingContext<"u"&&i instanceof WebGLRenderingContext&&at.warn("WebGL1 is not supported",i)(),!1)}async attach(i,n={}){const{WebGLDevice:o}=await Uw(async()=>{const{WebGLDevice:h}=await Promise.resolve().then(()=>iT);return{WebGLDevice:h}},void 0);if(i instanceof o)return i;const d=o.getDeviceFromContext(i);if(d)return d;if(!yN(i))throw new Error("Invalid WebGL2RenderingContext");const p=n.createCanvasContext===!0?{}:n.createCanvasContext;return new o({...n,_handle:i,createCanvasContext:{canvas:i.canvas,autoResize:!1,...p}})}async create(i={}){const{WebGLDevice:n}=await Uw(async()=>{const{WebGLDevice:p}=await Promise.resolve().then(()=>iT);return{WebGLDevice:p}},void 0),o=[];(i.debugWebGL||i.debug)&&o.push(hN()),i.debugSpectorJS&&o.push(lN(i));const d=await Promise.allSettled(o);for(const p of d)p.status==="rejected"&&at.error(`Failed to initialize debug libraries ${p.reason}`)();try{const p=new n(i);at.groupCollapsed(Hm,`WebGLDevice ${p.id} created`)();const h=`${p._reused?"Reusing":"Created"} device with WebGL2 ${p.props.debug?"debug ":""}context: ${p.info.vendor}, ${p.info.renderer} for canvas: ${p.canvasContext.id}`;return at.probe(Hm,h)(),at.table(Hm,p.info)(),p}finally{at.groupEnd(Hm)(),at.info(Hm,"%cWebGL call tracing: luma.log.set('debug-webgl') ","color: white; background: blue; padding: 2px 6px; border-radius: 3px;")()}}}function yN(t){return typeof WebGL2RenderingContext<"u"&&t instanceof WebGL2RenderingContext?!0:!!(t&&typeof t.createVertexArray=="function")}const gb=new _N,gx={3042:!1,32773:new Float32Array([0,0,0,0]),32777:32774,34877:32774,32969:1,32968:0,32971:1,32970:0,3106:new Float32Array([0,0,0,0]),3107:[!0,!0,!0,!0],2884:!1,2885:1029,2929:!1,2931:1,2932:513,2928:new Float32Array([0,1]),2930:!0,3024:!0,35725:null,36006:null,36007:null,34229:null,34964:null,2886:2305,33170:4352,2849:1,32823:!1,32824:0,10752:0,32926:!1,32928:!1,32938:1,32939:!1,3089:!1,3088:new Int32Array([0,0,1024,1024]),2960:!1,2961:0,2968:4294967295,36005:4294967295,2962:519,2967:0,2963:4294967295,34816:519,36003:0,36004:4294967295,2964:7680,2965:7680,2966:7680,34817:7680,34818:7680,34819:7680,2978:[0,0,1024,1024],36389:null,36662:null,36663:null,35053:null,35055:null,35723:4352,36010:null,35977:!1,3333:4,3317:4,37440:!1,37441:!1,37443:37444,3330:0,3332:0,3331:0,3314:0,32878:0,3316:0,3315:0,32877:0},$r=(t,e,i)=>
vendor: 4,070 bytes, line 2153
2153e?t.enable(i):t.disable(i),$w=(t,e,i)=>t.hint(i,e),$a=(t,e,i)=>t.pixelStorei(i,e),Hw=(t,e,i)=>{const n=i===36006?36009:36008;return t.bindFramebuffer(n,e)},Wm=(t,e,i)=>{const o={34964:34962,36662:36662,36663:36663,35053:35051,35055:35052}[i];t.bindBuffer(o,e)};function _b(t){return Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView)}const vN={3042:$r,32773:(t,e)=>t.blendColor(...e),32777:"blendEquation",34877:"blendEquation",32969:"blendFunc",32968:"blendFunc",32971:"blendFunc",32970:"blendFunc",3106:(t,e)=>t.clearColor(...e),3107:(t,e)=>t.colorMask(...e),2884:$r,2885:(t,e)=>t.cullFace(e),2929:$r,2931:(t,e)=>t.clearDepth(e),2932:(t,e)=>t.depthFunc(e),2928:(t,e)=>t.depthRange(...e),2930:(t,e)=>t.depthMask(e),3024:$r,35723:$w,35725:(t,e)=>t.useProgram(e),36007:(t,e)=>t.bindRenderbuffer(36161,e),36389:(t,e)=>{var i;return(i=t.bindTransformFeedback)==null?void 0:i.call(t,36386,e)},34229:(t,e)=>t.bindVertexArray(e),36006:Hw,36010:Hw,34964:Wm,36662:Wm,36663:Wm,35053:Wm,35055:Wm,2886:(t,e)=>t.frontFace(e),33170:$w,2849:(t,e)=>t.lineWidth(e),32823:$r,32824:"polygonOffset",10752:"polygonOffset",35977:$r,32926:$r,32928:$r,32938:"sampleCoverage",32939:"sampleCoverage",3089:$r,3088:(t,e)=>t.scissor(...e),2960:$r,2961:(t,e)=>t.clearStencil(e),2968:(t,e)=>t.stencilMaskSeparate(1028,e),36005:(t,e)=>t.stencilMaskSeparate(1029,e),2962:"stencilFuncFront",2967:"stencilFuncFront",2963:"stencilFuncFront",34816:"stencilFuncBack",36003:"stencilFuncBack",36004:"stencilFuncBack",2964:"stencilOpFront",2965:"stencilOpFront",2966:"stencilOpFront",34817:"stencilOpBack",34818:"stencilOpBack",34819:"stencilOpBack",2978:(t,e)=>t.viewport(...e),34383:$r,10754:$r,12288:$r,12289:$r,12290:$r,12291:$r,12292:$r,12293:$r,12294:$r,12295:$r,3333:$a,3317:$a,37440:$a,37441:$a,37443:$a,3330:$a,3332:$a,3331:$a,3314:$a,32878:$a,3316:$a,3315:$a,32877:$a,framebuffer:(t,e)=>{const i=e&&"handle"in e?e.handle:e;return t.bindFramebuffer(36160,i)},blend:(t,e)=>e?t.enable(3042):t.disable(3042),blendColor:(t,e)=>t.blendColor(...e),blendEquation:(t,e)=>{const i=typeof e=="number"?[e,e]:e;t.blendEquationSeparate(...i)},blendFunc:(t,e)=>{const i=(e==null?void 0:e.length)===2?[...e,...e]:e;t.blendFuncSeparate(...i)},clearColor:(t,e)=>t.clearColor(...e),clearDepth:(t,e)=>t.clearDepth(e),clearStencil:(t,e)=>t.clearStencil(e),colorMask:(t,e)=>t.colorMask(...e),cull:(t,e)=>e?t.enable(2884):t.disable(2884),cullFace:(t,e)=>t.cullFace(e),depthTest:(t,e)=>e?t.enable(2929):t.disable(2929),depthFunc:(t,e)=>t.depthFunc(e),depthMask:(t,e)=>t.depthMask(e),depthRange:(t,e)=>t.depthRange(...e),dither:(t,e)=>e?t.enable(3024):t.disable(3024),derivativeHint:(t,e)=>{t.hint(35723,e)},frontFace:(t,e)=>t.frontFace(e),mipmapHint:(t,e)=>t.hint(33170,e),lineWidth:(t,e)=>t.lineWidth(e),polygonOffsetFill:(t,e)=>e?t.enable(32823):t.disable(32823),polygonOffset:(t,e)=>t.polygonOffset(...e),sampleCoverage:(t,e)=>t.sampleCoverage(e[0],e[1]||!1),scissorTest:(t,e)=>e?t.enable(3089):t.disable(3089),scissor:(t,e)=>t.scissor(...e),stencilTest:(t,e)=>e?t.enable(2960):t.disable(2960),stencilMask:(t,e)=>{e=_b(e)?e:[e,e];const[i,n]=e;t.stencilMaskSeparate(1028,i),t.stencilMaskSeparate(1029,n)},stencilFunc:(t,e)=>{e=_b(e)&&e.length===3?[...e,...e]:e;const[i,n,o,d,p,h]=e;t.stencilFuncSeparate(1028,i,n,o),t.stencilFuncSeparate(1029,d,p,h)},stencilOp:(t,e)=>{e=_b(e)&&e.length===3?[...e,...e]:e;const[i,n,o,d,p,h]=e;t.stencilOpSeparate(1028,i,n,o),t.stencilOpSeparate(1029,d,p,h)},viewport:(t,e)=>t.viewport(...e)};function Ar(t,e,i){return e[t]!==void 0?e[t]:i[t]}const bN={blendEquation:(t,e,i)=>t.blendEquationSeparate(Ar(32777,e,i),Ar(34877,e,i)),blendFunc:(t,e,i)=>t.blendFuncSeparate(Ar(32969,e,i),Ar(32968,e,i),Ar(32971,e,i),Ar(32970,e,i)),polygonOffset:(t,e,i)=>t.polygonOffset(Ar(32824,e,i),Ar(10752,e,i)),sampleCoverage:(t,e,i)=>t.sampleCoverage(Ar(32938,e,i),Ar(32939,e,i)),stencilFuncFront:(t,e,i)=>t.stencilFuncSeparate(1028,Ar(2962,e,i),Ar(2967,e,i),Ar(2963,e,i)),stencilFuncBack:(t,e,i)=>t.stencilFuncSeparate(1029,Ar(34816,e,i),Ar(36003,e,i),Ar(36004,e,i)),stencilOpFront:(t,e,i)=>
2153t.stencilOpSeparate(1028,Ar(2964,e,i),Ar(2965,e,i),Ar(2966,e,i)),stencilOpBack:(t,e,i)=>t.stencilOpSeparate(1029,Ar(34817,e,i),Ar(34818,e,i),Ar(34819,e,i))},Ww={enable:(t,e)=>t({[e]:!0}),disable:(t,e)=>t({[e]:!1}),pixelStorei:(t,e,i)=>t({[e]:i}),hint:(t,e,i)=>t({[e]:i}),useProgram:(t,e)=>t({35725:e}),bindRenderbuffer:(t,e,i)=>t({36007:i}),bindTransformFeedback:(t,e,i)=>t({36389:i}),bindVertexArray:(t,e)=>t({34229:e}),bindFramebuffer:(t,e,i)=>{switch(e){case 36160:return t({36006:i,36010:i});case 36009:return t({36006:i});case 36008:return t({36010:i});default:return null}},bindBuffer:(t,e,i)=>{const n={34962:[34964],36662:[36662],36663:[36663],35051:[35053],35052:[35055]}[e];return n?t({[n]:i}):{valueChanged:!0}},blendColor:(t,e,i,n,o)=>t({32773:new Float32Array([e,i,n,o])}),blendEquation:(t,e)=>t({32777:e,34877:e}),blendEquationSeparate:(t,e,i)=>t({32777:e,34877:i}),blendFunc:(t,e,i)=>t({32969:e,32968:i,32971:e,32970:i}),blendFuncSeparate:(t,e,i,n,o)=>t({32969:e,32968:i,32971:n,32970:o}),clearColor:(t,e,i,n,o)=>t({3106:new Float32Array([e,i,n,o])}),clearDepth:(t,e)=>t({2931:e}),clearStencil:(t,e)=>t({2961:e}),colorMask:(t,e,i,n,o)=>t({3107:[e,i,n,o]}),cullFace:(t,e)=>t({2885:e}),depthFunc:(t,e)=>t({2932:e}),depthRange:(t,e,i)=>t({2928:new Float32Array([e,i])}),depthMask:(t,e)=>t({2930:e}),frontFace:(t,e)=>t({2886:e}),lineWidth:(t,e)=>t({2849:e}),polygonOffset:(t,e,i)=>t({32824:e,10752:i}),sampleCoverage:(t,e,i)=>t({32938:e,32939:i}),scissor:(t,e,i,n,o)=>t({3088:new Int32Array([e,i,n,o])}),stencilMask:(t,e)=>t({2968:e,36005:e}),stencilMaskSeparate:(t,e,i)=>t({[e===1028?2968:36005]:i}),stencilFunc:(t,e,i,n)=>t({2962:e,2967:i,2963:n,34816:e,36003:i,36004:n}),stencilFuncSeparate:(t,e,i,n,o)=>t({[e===1028?2962:34816]:i,[e===1028?2967:36003]:n,[e===1028?2963:36004]:o}),stencilOp:(t,e,i,n)=>t({2964:e,2965:i,2966:n,34817:e,34818:i,34819:n}),stencilOpSeparate:(t,e,i,n,o)=>t({[e===1028?2964:34817]:i,[e===1028?2965:34818]:n,[e===1028?2966:34819]:o}),viewport:(t,e,i,n,o)=>t({2978:[e,i,n,o]})},Kl=(t,e)=>t.isEnabled(e),Xw={3042:Kl,2884:Kl,2929:Kl,3024:Kl,32823:Kl,32926:Kl,32928:Kl,3089:Kl,2960:Kl,35977:Kl},xN=new Set([34016,36388,36387,35983,35368,34965,35739,35738,3074,34853,34854,34855,34856,34857,34858,34859,34860,34861,34862,34863,34864,34865,34866,34867,34868,35097,32873,35869,32874,34068]);function Ep(t,e){var o;if(TN(e))return;const i={};for(const d in e){const p=Number(d),h=vN[d];h&&(typeof h=="string"?i[h]=!0:h(t,e[d],p))}const n=(o=t.lumaState)==null?void 0:o.cache;if(n)for(const d in i){const p=bN[d];p(t,e,n)}}function eA(t,e=gx){if(typeof e=="number"){const o=e,d=Xw[o];return d?d(t,o):t.getParameter(o)}const i=Array.isArray(e)?e:Object.keys(e),n={};for(const o of i){const d=Xw[o];n[o]=d?d(t,Number(o)):t.getParameter(Number(o))}return n}function wN(t){Ep(t,gx)}function TN(t){for(const e in t)return!1;return!0}function SN(t,e){if(t===e)return!0;if(qw(t)&&qw(e)&&t.length===e.length){for(let i=0;i<t.length;++i)if(t[i]!==e[i])return!1;return!0}return!1}function qw(t){return Array.isArray(t)||ArrayBuffer.isView(t)}class Cd{constructor(e,i){Y(this,"gl");Y(this,"program",null);Y(this,"stateStack",[]);Y(this,"enable",!0);Y(this,"cache",null);Y(this,"log");Y(this,"initialized",!1);this.gl=e,this.log=(i==null?void 0:i.log)||(()=>{}),this._updateCache=this._updateCache.bind(this),Object.seal(this)}static get(e){return e.lumaState}push(e={}){this.stateStack.push({})}pop(){const e=this.stateStack[this.stateStack.length-1];Ep(this.gl,e),this.stateStack.pop()}trackState(e,i){if(this.cache=i!=null&&i.copyState?eA(e):Object.assign({},gx),this.initialized)throw new Error("WebGLStateTracker");this.initialized=!0,this.gl.lumaState=this,EN(e);for(const n in Ww){const o=Ww[n];AN(e,n,o)}Zw(e,"getParameter"),Zw(e,"isEnabled")}_updateCache(e){let i=!1,n;const o=this.stateStack.length>0?this.stateStack[this.stateStack.length-1]:null;for(const d in e){const p=e[d],h=this.cache[d];SN(p,h)||(i=!0,n=h,o&&!(d in o)&&(o[d]=h),this.cache[d]=p)}return{valueChanged:i,oldValue:n}}}function Zw(t,e){const i=t[e].bind(t);t[e]=function(o){if(o===void 0||xN.has(o))return i(o);const d=Cd.get(t);
2153return o in d.cache||(d.cache[o]=i(o)),d.enable?d.cache[o]:i(o)},Object.defineProperty(t[e],"name",{value:`${e}-from-cache`,configurable:!1})}function AN(t,e,i){if(!t[e])return;const n=t[e].bind(t);t[e]=function(...d){const p=Cd.get(t),{valueChanged:h,oldValue:A}=i(p._updateCache,...d);return h&&n(...d),A},Object.defineProperty(t[e],"name",{value:`${e}-to-cache`,configurable:!1})}function EN(t){const e=t.useProgram.bind(t);t.useProgram=function(n){const o=Cd.get(t);o.program!==n&&(e(n),o.program=n)}}function CN(t,e,i){let n="";const o=A=>{const R=A.statusMessage;R&&(n||(n=R))};t.addEventListener("webglcontextcreationerror",o,!1);const d=i.failIfMajorPerformanceCaveat!==!0,p={preserveDrawingBuffer:!0,...i,failIfMajorPerformanceCaveat:!0};let h=null;try{h||(h=t.getContext("webgl2",p)),!h&&p.failIfMajorPerformanceCaveat&&(n||(n="Only software GPU is available. Set `failIfMajorPerformanceCaveat: false` to allow."));let A=!1;if(!h&&d&&(p.failIfMajorPerformanceCaveat=!1,h=t.getContext("webgl2",p),A=!0),h||(h=t.getContext("webgl",{}),h&&(h=null,n||(n="Your browser only supports WebGL1"))),!h)throw n||(n="Your browser does not support WebGL"),new Error(`Failed to create WebGL context: ${n}`);const R=Py(h);R.softwareRenderer=A;const{onContextLost:B,onContextRestored:N}=e;return t.addEventListener("webglcontextlost",F=>B(F),!1),t.addEventListener("webglcontextrestored",F=>N(F),!1),h}finally{t.removeEventListener("webglcontextcreationerror",o,!1)}}function Od(t,e,i){return i[e]===void 0&&(i[e]=t.getExtension(e)||null),i[e]}function RN(t,e){const i=t.getParameter(7936),n=t.getParameter(7937);Od(t,"WEBGL_debug_renderer_info",e);const o=e.WEBGL_debug_renderer_info,d=t.getParameter(o?o.UNMASKED_VENDOR_WEBGL:7936),p=t.getParameter(o?o.UNMASKED_RENDERER_WEBGL:7937),h=d||i,A=p||n,R=t.getParameter(7938),B=tA(h,A),N=MN(h,A),F=PN(h,A);return{type:"webgl",gpu:B,gpuType:F,gpuBackend:N,vendor:h,renderer:A,version:R,shadingLanguage:"glsl",shadingLanguageVersion:300}}function tA(t,e){return/NVIDIA/i.exec(t)||/NVIDIA/i.exec(e)?"nvidia":/INTEL/i.exec(t)||/INTEL/i.exec(e)?"intel":/Apple/i.exec(t)||/Apple/i.exec(e)?"apple":/AMD/i.exec(t)||/AMD/i.exec(e)||/ATI/i.exec(t)||/ATI/i.exec(e)?"amd":/SwiftShader/i.exec(t)||/SwiftShader/i.exec(e)?"software":"unknown"}function MN(t,e){return/Metal/i.exec(t)||/Metal/i.exec(e)?"metal":/ANGLE/i.exec(t)||/ANGLE/i.exec(e)?"opengl":"unknown"}function PN(t,e){if(/SwiftShader/i.exec(t)||/SwiftShader/i.exec(e))return"cpu";switch(tA(t,e)){case"apple":return IN(t,e)?"integrated":"unknown";case"intel":return"integrated";case"software":return"cpu";case"unknown":return"unknown";default:return"discrete"}}function IN(t,e){return/Apple (M\d|A\d|GPU)/i.test(`${t} ${e}`)}function iA(t){switch(t){case"uint8":return 5121;case"sint8":return 5120;case"unorm8":return 5121;case"snorm8":return 5120;case"uint16":return 5123;case"sint16":return 5122;case"unorm16":return 5123;case"snorm16":return 5122;case"uint32":return 5125;case"sint32":return 5124;case"float16":return 5131;case"float32":return 5126}throw new Error(String(t))}const Km="WEBGL_compressed_texture_s3tc",Qm="WEBGL_compressed_texture_s3tc_srgb",Kf="EXT_texture_compression_rgtc",Qf="EXT_texture_compression_bptc",DN="WEBGL_compressed_texture_etc",ON="WEBGL_compressed_texture_astc",kN="WEBGL_compressed_texture_etc1",BN="WEBGL_compressed_texture_pvrtc",NN="WEBGL_compressed_texture_atc",zN="EXT_texture_norm16",Yw="EXT_render_snorm",nA="EXT_color_buffer_float",yb="snorm8-renderable-webgl",vb="norm16-renderable-webgl",bb="snorm16-renderable-webgl",xb="float16-renderable-webgl",W_="float32-renderable-webgl",LN="rgb9e5ufloat-renderable-webgl",_x={"float32-renderable-webgl":{extensions:[nA]},"float16-renderable-webgl":{extensions:["EXT_color_buffer_half_float"]},"rgb9e5ufloat-renderable-webgl":{extensions:["WEBGL_render_shared_exponent"]},"snorm8-renderable-webgl":{extensions:[Yw]},"norm16-webgl":{extensions:[zN]}
2153,"norm16-renderable-webgl":{features:["norm16-webgl"]},"snorm16-renderable-webgl":{features:["norm16-webgl"],extensions:[Yw]},"float32-filterable":{extensions:["OES_texture_float_linear"]},"float16-filterable-webgl":{extensions:["OES_texture_half_float_linear"]},"texture-filterable-anisotropic-webgl":{extensions:["EXT_texture_filter_anisotropic"]},"texture-blend-float-webgl":{extensions:["EXT_float_blend"]},"texture-compression-bc":{extensions:[Km,Qm,Kf,Qf]},"texture-compression-bc5-webgl":{extensions:[Kf]},"texture-compression-bc7-webgl":{extensions:[Qf]},"texture-compression-etc2":{extensions:[DN]},"texture-compression-astc":{extensions:[ON]},"texture-compression-etc1-webgl":{extensions:[kN]},"texture-compression-pvrtc-webgl":{extensions:[BN]},"texture-compression-atc-webgl":{extensions:[NN]}};function FN(t){return t in _x}function rA(t,e,i){return sA(t,e,i,new Set)}function sA(t,e,i,n){const o=_x[e];if(!o||n.has(e))return!1;n.add(e);const d=(o.features||[]).every(p=>sA(t,p,i,n));return n.delete(e),d?(o.extensions||[]).every(p=>!!Od(t,p,i)):!1}const pv={r8unorm:{gl:33321,rb:!0},r8snorm:{gl:36756,r:yb},r8uint:{gl:33330,rb:!0},r8sint:{gl:33329,rb:!0},rg8unorm:{gl:33323,rb:!0},rg8snorm:{gl:36757,r:yb},rg8uint:{gl:33336,rb:!0},rg8sint:{gl:33335,rb:!0},r16uint:{gl:33332,rb:!0},r16sint:{gl:33331,rb:!0},r16float:{gl:33325,rb:!0,r:xb},r16unorm:{gl:33322,rb:!0,r:vb},r16snorm:{gl:36760,r:bb},"rgba4unorm-webgl":{gl:32854,rb:!0},"rgb565unorm-webgl":{gl:36194,rb:!0},"rgb5a1unorm-webgl":{gl:32855,rb:!0},"rgb8unorm-webgl":{gl:32849},"rgb8snorm-webgl":{gl:36758},rgba8unorm:{gl:32856},"rgba8unorm-srgb":{gl:35907},rgba8snorm:{gl:36759,r:yb},rgba8uint:{gl:36220},rgba8sint:{gl:36238},bgra8unorm:{},"bgra8unorm-srgb":{},rg16uint:{gl:33338},rg16sint:{gl:33337},rg16float:{gl:33327,rb:!0,r:xb},rg16unorm:{gl:33324,r:vb},rg16snorm:{gl:36761,r:bb},r32uint:{gl:33334,rb:!0},r32sint:{gl:33333,rb:!0},r32float:{gl:33326,r:W_},rgb9e5ufloat:{gl:35901,r:LN},rg11b10ufloat:{gl:35898,rb:!0},rgb10a2unorm:{gl:32857,rb:!0},rgb10a2uint:{gl:36975,rb:!0},"rgb16unorm-webgl":{gl:32852,r:!1},"rgb16snorm-webgl":{gl:36762,r:!1},rg32uint:{gl:33340,rb:!0},rg32sint:{gl:33339,rb:!0},rg32float:{gl:33328,rb:!0,r:W_},rgba16uint:{gl:36214,rb:!0},rgba16sint:{gl:36232,rb:!0},rgba16float:{gl:34842,r:xb},rgba16unorm:{gl:32859,rb:!0,r:vb},rgba16snorm:{gl:36763,r:bb},"rgb32float-webgl":{gl:34837,x:nA,r:W_,dataFormat:6407,types:[5126]},rgba32uint:{gl:36208,rb:!0},rgba32sint:{gl:36226,rb:!0},rgba32float:{gl:34836,rb:!0,r:W_},stencil8:{gl:36168,rb:!0},depth16unorm:{gl:33189,dataFormat:6402,types:[5123],rb:!0},depth24plus:{gl:33190,dataFormat:6402,types:[5125]},depth32float:{gl:36012,dataFormat:6402,types:[5126],rb:!0},"depth24plus-stencil8":{gl:35056,rb:!0,depthTexture:!0,dataFormat:34041,types:[34042]},"depth32float-stencil8":{gl:36013,dataFormat:34041,types:[36269],rb:!0},"bc1-rgb-unorm-webgl":{gl:33776,x:Km},"bc1-rgb-unorm-srgb-webgl":{gl:35916,x:Qm},"bc1-rgba-unorm":{gl:33777,x:Km},"bc1-rgba-unorm-srgb":{gl:35916,x:Qm},"bc2-rgba-unorm":{gl:33778,x:Km},"bc2-rgba-unorm-srgb":{gl:35918,x:Qm},"bc3-rgba-unorm":{gl:33779,x:Km},"bc3-rgba-unorm-srgb":{gl:35919,x:Qm},"bc4-r-unorm":{gl:36283,x:Kf},"bc4-r-snorm":{gl:36284,x:Kf},"bc5-rg-unorm":{gl:36285,x:Kf},"bc5-rg-snorm":{gl:36286,x:Kf},"bc6h-rgb-ufloat":{gl:36495,x:Qf},"bc6h-rgb-float":{gl:36494,x:Qf},"bc7-rgba-unorm":{gl:36492,x:Qf},"bc7-rgba-unorm-srgb":{gl:36493,x:Qf},"etc2-rgb8unorm":{gl:37492},"etc2-rgb8unorm-srgb":{gl:37494},"etc2-rgb8a1unorm":{gl:37496},"etc2-rgb8a1unorm-srgb":{gl:37497},"etc2-rgba8unorm":{gl:37493},"etc2-rgba8unorm-srgb":{gl:37495},"eac-r11unorm":{gl:37488},"eac-r11snorm":{gl:37489},"eac-rg11unorm":{gl:37490},"eac-rg11snorm":{gl:37491},"astc-4x4-unorm":{gl:37808},"astc-4x4-unorm-srgb":{gl:37840},"astc-5x4-unorm":{gl:37809},"astc-5x4-unorm-srgb":{gl:37841},"astc-5x5-unorm":{gl:37810},"astc-5x5-unorm-srgb":{gl:37842},"astc-6x5-unorm":{gl:37811},"astc-6x5-unorm-srgb":{gl:37843},"astc-6x6-unorm":{gl:37812},"astc-6x6-unorm-srgb":{gl:37844},"astc-8x5-unorm":{gl:37813},"astc-8x5-unorm-srgb":{gl:37845},"astc-8x6-unorm":{gl:37814},"astc-8x6-unorm-srgb":{gl:37846},"astc-8x8-unorm":{gl:37815},"astc-8x8-unorm-srgb":{gl:37847},"astc-10x5-unorm":{gl:37816},"astc-10x5-unorm-srgb":{gl:37848},"astc-10x6-unorm":{gl:37817},"astc-10x6-unorm-srgb":{gl:37849},"astc-10x8-unorm":{gl:37818},"astc-10x8-unorm-srgb":{gl:37850},"astc-10x10-unorm":{gl:37819},"astc-10x10-unorm-srgb":{gl:37851},"astc-12x10-unorm":{gl:37820},"astc-12x10-unorm-srgb":{gl:37852},"astc-12x12-unorm":{gl:37821},"astc-12x12-unorm-srgb":{gl:37853},"pvrtc-rgb4unorm-webgl":{gl:35840},"pvrtc-rgba4unorm-webgl":{gl:35842},"pvrtc-rgb2unorm-webgl":{gl:35841},"pvrtc-rgba2unorm-webgl":{gl:35843},"etc1-rbg-unorm-webgl":{gl:36196},"atc-rgb-unorm-webgl":{gl:35986},"atc-rgba-unorm-webgl":{gl:35986},"atc-rgbai-unorm-webgl":{gl:34798}};function UN(t,e,i){let n=e.create;const o=pv[e.format];(o==null?void 0:o.gl)===void 0&&(n=!1),o!=null&&o.x&&(n=n&&!!Od(t,o.x,i)),e.format==="stencil8"&&(n=!1);const d=(o==null?void 0:o.r)===!1?!1:(o==null?void 0:o.r)===void 0||rA(t,o.r,i),p=n&&e.render&&d&&jN(t,e.format,i);return{format:e.format,create:n&&e.create,render:p,filter:n&&e.filter,blend:n&&e.blend,store:n&&e.store}}function jN(t,e,i){const n=pv[e],o=n==null?void 0:n.gl;if(o===void 0||n!=null&&n.x&&!Od(t,n.x,i))return!1;const d=t.getParameter(32873),p=t.getParameter(36006),h=t.createTexture(),A=t.createFramebuffer();if(!h||!A)return!1;const R=0;let B=Number(t.getError());for(;B!==R;)B=t.getError();let N=!1;
2153try{if(t.bindTexture(3553,h),t.texStorage2D(3553,1,o,1,1),Number(t.getError())!==R)return!1;t.bindFramebuffer(36160,A),t.framebufferTexture2D(36160,36064,3553,h,0),N=Number(t.checkFramebufferStatus(36160))===36053&&Number(t.getError())===R}finally{t.bindFramebuffer(36160,p),t.deleteFramebuffer(A),t.bindTexture(3553,d),t.deleteTexture(h)}return N}function aA(t){var o;const e=pv[t],i=HN(t),n=al.getInfo(t);return n.compressed&&(e.dataFormat=i),{internalFormat:i,format:(e==null?void 0:e.dataFormat)||$N(n.channels,n.integer,n.normalized,i),type:n.dataType?iA(n.dataType):((o=e==null?void 0:e.types)==null?void 0:o[0])||5121,compressed:n.compressed||!1}}function VN(t){switch(al.getInfo(t).attachment){case"depth":return 36096;case"stencil":return 36128;case"depth-stencil":return 33306;default:throw new Error(`Not a depth stencil format: ${t}`)}}function $N(t,e,i,n){if(n===6408||n===6407)return n;switch(t){case"r":return e&&!i?36244:6403;case"rg":return e&&!i?33320:33319;case"rgb":return e&&!i?36248:6407;case"rgba":return e&&!i?36249:6408;case"bgra":throw new Error("bgra pixels not supported by WebGL");default:return 6408}}function HN(t){const e=pv[t],i=e==null?void 0:e.gl;if(i===void 0)throw new Error(`Unsupported texture format ${t}`);return i}const Gw={"depth-clip-control":"EXT_depth_clamp","timestamp-query":"EXT_disjoint_timer_query_webgl2","compilation-status-async-webgl":"KHR_parallel_shader_compile","polygon-mode-webgl":"WEBGL_polygon_mode","provoking-vertex-webgl":"WEBGL_provoking_vertex","shader-clip-cull-distance-webgl":"WEBGL_clip_cull_distance","shader-noperspective-interpolation-webgl":"NV_shader_noperspective_interpolation","shader-conservative-depth-webgl":"EXT_conservative_depth"};class WN extends nI{constructor(i,n,o){super([],o);Y(this,"gl");Y(this,"extensions");Y(this,"testedFeatures",new Set);this.gl=i,this.extensions=n,Od(i,"EXT_color_buffer_float",n)}*[Symbol.iterator](){const i=this.getFeatures();for(const n of i)this.has(n)&&(yield n);return[]}has(i){var n;return(n=this.disabledFeatures)!=null&&n[i]?!1:(this.testedFeatures.has(i)||(this.testedFeatures.add(i),FN(i)&&rA(this.gl,i,this.extensions)&&this.features.add(i),this.getWebGLFeature(i)&&this.features.add(i)),this.features.has(i))}initializeFeatures(){const i=this.getFeatures().filter(n=>n!=="polygon-mode-webgl");for(const n of i)this.has(n)}getFeatures(){return[...Object.keys(Gw),...Object.keys(_x)]}getWebGLFeature(i){const n=Gw[i];return typeof n=="string"?!!Od(this.gl,n,this.extensions):!!n}}class XN extends QP{constructor(i){super();Y(this,"gl");Y(this,"limits",{});this.gl=i}get maxTextureDimension1D(){return 0}get maxTextureDimension2D(){return this.getParameter(3379)}get maxTextureDimension3D(){return this.getParameter(32883)}get maxTextureArrayLayers(){return this.getParameter(35071)}get maxBindGroups(){return 0}get maxDynamicUniformBuffersPerPipelineLayout(){return 0}get maxDynamicStorageBuffersPerPipelineLayout(){return 0}get maxSampledTexturesPerShaderStage(){return this.getParameter(35660)}get maxSamplersPerShaderStage(){return this.getParameter(35661)}get maxStorageBuffersPerShaderStage(){return 0}get maxStorageTexturesPerShaderStage(){return 0}get maxUniformBuffersPerShaderStage(){return this.getParameter(35375)}get maxUniformBufferBindingSize(){return this.getParameter(35376)}get maxStorageBufferBindingSize(){return 0}get minUniformBufferOffsetAlignment(){return this.getParameter(35380)}get minStorageBufferOffsetAlignment(){return 0}get maxVertexBuffers(){return 16}get maxVertexAttributes(){return this.getParameter(34921)}get maxVertexBufferArrayStride(){return 2048}get maxInterStageShaderVariables(){return this.getParameter(35659)}get maxComputeWorkgroupStorageSize(){return 0}get maxComputeInvocationsPerWorkgroup(){return 0}get maxComputeWorkgroupSizeX(){return 0}get maxComputeWorkgroupSizeY(){return 0}get maxComputeWorkgroupSizeZ(){return 0}get maxComputeWorkgroupsPerDimension(){return 0}getParameter(i){return this.limits[i]===void 0&&(this.limits[i]=this.gl.getParameter(i)),this.limits[i]||0}}class ng extends Sy{constructor(i,n){super(i,n);Y(this,"device");Y(this,"gl");Y(this,"handle");Y(this,"colorAttachments",[]);Y(this,"depthStencilAttachment",null);const o=n.handle===null;this.device=i,this.gl=i.gl,this.handle=this.props.handle||o?this.props.handle:this.gl.createFramebuffer(),o||(i._setWebGLDebugMetadata(this.handle,this,{spector:this.props}),n.handle||(this.autoCreateAttachmentTextures(),this.updateAttachments()))}destroy(){super.destroy(),!this.destroyed&&this.handle!==null&&!this.props.handle&&this.gl.deleteFramebuffer(this.handle)}updateAttachments(){const i=this.gl.bindFramebuffer(36160,this.handle);for(let n=0;n<this.colorAttachments.length;++n){const o=this.colorAttachments[n];if(o){const d=36064+n;this._attachTextureView(d,o)}}if(this.depthStencilAttachment){const n=VN(this.depthStencilAttachment.props.format);this._attachTextureView(n,this.depthStencilAttachment)}if(this.device.props.debug){const n=this.gl.checkFramebufferStatus(36160);if(n!==36053)throw new Error(`Framebuffer ${ZN(n)}`)}this.gl.bindFramebuffer(36160,i)}_attachTextureView(i,n){const{gl:o}=this.device,{texture:d}=n,p=n.props.baseMipLevel,h=n.props.baseArrayLayer;switch(o.bindTexture(d.glTarget,d.handle),d.glTarget){case 35866:case 32879:o.framebufferTextureLayer(36160,i,d.handle,p,h);break;case 34067:const A=qN(h);o.framebufferTexture2D(36160,i,A,d.handle,p);break;case 3553:o.framebufferTexture2D(36160,i,3553,d.handle,p);break;default:throw new Error("Illegal texture type")}o.bindTexture(d.glTarget,null)}resizeAttachments(i,n){if(this.handle===null){this.width=i,this.height=n;return}super.resizeAttachments(i,n)}}function qN(t){return t<34069?t+34069:t}function ZN(t){switch(t){case 36053:return"success";case 36054:return"Mismatched attachments";case 36055:return"No attachments";case 36057:return"Height/width mismatch";case 36061:return"Unsupported or split attachments";case 36182:return"Samples mismatch";default:return`${t}`}}class YN extends n2{constructor(i,n){super(n);Y(this,"device");Y(this,"handle",null);Y(this,"_framebuffer",null);this.device=i,this._setAutoCreatedCanvasId(`${this.device.id}-canvas`),this._configureDevice()}get[Symbol.toStringTag](){return"WebGLCanvasContext"}_configureDevice(){var n,o,d;(this.drawingBufferWidth!==((n=this._framebuffer)==null?void 0:n.width)||this.drawingBufferHeight!==((o=this._framebuffer)==null?void 0:o.height))&&((d=this._framebuffer)==null||d.resize([this.drawingBufferWidth,this.drawingBufferHeight]))}_getCurrentFramebuffer(){return this._framebuffer||(this._framebuffer=new ng(this.device,{id:"canvas-context-framebuffer",handle:null,width:this.drawingBufferWidth,height:this.drawingBufferHeight})),this._framebuffer}}class GN extends yI{constructor(i,n={}){super(n);Y(this,"device");Y(this,"handle",null);Y(this,"context2d");this.device=i;const o=`${this[Symbol.toStringTag]}(${this.id})`;if(!this.device.getDefaultCanvasContext().offscreenCanvas)throw new Error(`${o}: WebGL PresentationContext requires the default CanvasContext c
2153anvas to be an OffscreenCanvas`);const p=this.canvas.getContext("2d");if(!p)throw new Error(`${o}: Failed to create 2d presentation context`);this.context2d=p,this._setAutoCreatedCanvasId(`${this.device.id}-presentation-canvas`),this._configureDevice(),this._startObservers()}get[Symbol.toStringTag](){return"WebGLPresentationContext"}present(){this._resizeDrawingBufferIfNeeded(),this.device.submit();const i=this.device.getDefaultCanvasContext(),[n,o]=i.getDrawingBufferSize();if(!(this.drawingBufferWidth===0||this.drawingBufferHeight===0||n===0||o===0||i.canvas.width===0||i.canvas.height===0)){if(n!==this.drawingBufferWidth||o!==this.drawingBufferHeight||i.canvas.width!==this.drawingBufferWidth||i.canvas.height!==this.drawingBufferHeight)throw new Error(`${this[Symbol.toStringTag]}(${this.id}): Default canvas context size ${n}x${o} does not match presentation size ${this.drawingBufferWidth}x${this.drawingBufferHeight}`);this.context2d.clearRect(0,0,this.drawingBufferWidth,this.drawingBufferHeight),this.context2d.drawImage(i.canvas,0,0)}}_configureDevice(){}_getCurrentFramebuffer(i){const n=this.device.getDefaultCanvasContext();return n.setDrawingBufferSize(this.drawingBufferWidth,this.drawingBufferHeight),n.getCurrentFramebuffer(i)}}const wb={};function KN(t="id"){wb[t]=wb[t]||1;const e=wb[t]++;return`${t}-${e}`}class rg extends En{constructor(i,n={}){super(i,n);Y(this,"device");Y(this,"gl");Y(this,"handle");Y(this,"glTarget");Y(this,"glUsage");Y(this,"glIndexType",5123);Y(this,"byteLength",0);Y(this,"bytesUsed",0);this.device=i,this.gl=this.device.gl;const o=typeof n=="object"?n.handle:void 0;this.handle=o||this.gl.createBuffer(),i._setWebGLDebugMetadata(this.handle,this,{spector:{...this.props,data:typeof this.props.data}}),this.glTarget=QN(this.props.usage),this.glUsage=JN(this.props.usage),this.glIndexType=this.props.indexType==="uint32"?5125:5123,n.data?this._initWithData(n.data,n.byteOffset,n.byteLength):this._initWithByteLength(n.byteLength||0)}destroy(){!this.destroyed&&this.handle&&(this.removeStats(),this.props.handle?this.trackDeallocatedReferencedMemory("Buffer"):(this.trackDeallocatedMemory(),this.gl.deleteBuffer(this.handle)),this.destroyed=!0,this.handle=null)}_initWithData(i,n=0,o=i.byteLength+n){const d=this.glTarget;this.gl.bindBuffer(d,this.handle),this.gl.bufferData(d,o,this.glUsage),this.gl.bufferSubData(d,n,i),this.gl.bindBuffer(d,null),this.bytesUsed=o,this.byteLength=o,this._setDebugData(i,n,o),this.props.handle?this.trackReferencedMemory(o,"Buffer"):this.trackAllocatedMemory(o)}_initWithByteLength(i){let n=i;i===0&&(n=new Float32Array(0));const o=this.glTarget;return this.gl.bindBuffer(o,this.handle),this.gl.bufferData(o,n,this.glUsage),this.gl.bindBuffer(o,null),this.bytesUsed=i,this.byteLength=i,this._setDebugData(null,0,i),this.props.handle?this.trackReferencedMemory(i,"Buffer"):this.trackAllocatedMemory(i),this}write(i,n=0){const o=ArrayBuffer.isView(i)?i:new Uint8Array(i),d=36663;this.gl.bindBuffer(d,this.handle),this.gl.bufferSubData(d,n,o),this.gl.bindBuffer(d,null),this._setDebugData(i,n,i.byteLength)}async mapAndWriteAsync(i,n=0,o=this.byteLength-n){const d=new ArrayBuffer(o);await i(d,"copied"),this.write(d,n)}async readAsync(i=0,n){return this.readSyncWebGL(i,n)}async mapAndReadAsync(i,n=0,o){const d=await this.readAsync(n,o);return await i(d.buffer,"copied")}readSyncWebGL(i=0,n){n=n??this.byteLength-i;const o=new Uint8Array(n),d=0;return this.gl.bindBuffer(36662,this.handle),this.gl.getBufferSubData(36662,i,o,d,n),this.gl.bindBuffer(36662,null),this._setDebugData(o,i,n),o}}function QN(t){return t&En.INDEX?34963:t&En.VERTEX?34962:t&En.UNIFORM?35345:34962}function JN(t){return t&En.INDEX||t&En.VERTEX?35044:t&En.UNIFORM?35048:35044}function e4(t){var n;const e=t.split(/\r?\n/),i=[];for(const o of e){if(o.length<=1)continue;const d=o.trim(),p=o.split(":"),h=(n=p[0])==null?void 0:n.trim();if(p.length===2){const[re,se]=p;if(!re||!se){i.push({message:d,type:X_(h||"info"),lineNum:0,linePos:0});continue}i.push({message:se.trim(),type:X_(re),lineNum:0,linePos:0});continue}const[A,R,B,...N]=p;if(!A||!R||!B){i.push({message:p.slice(1).join(":").trim()||d,type:X_(h||"info"),lineNum:0,linePos:0});continue}let F=parseInt(B,10);
2153Number.isNaN(F)&&(F=0);let Q=parseInt(R,10);Number.isNaN(Q)&&(Q=0),i.push({message:N.join(":").trim(),type:X_(A),lineNum:F,linePos:Q})}return i}function X_(t){const e=["warning","error","info"],i=t.toLowerCase();return e.includes(i)?i:"info"}class t4 extends Ty{constructor(i,n){super(i,n);Y(this,"device");Y(this,"handle");switch(this.device=i,this.props.stage){case"vertex":this.handle=this.props.handle||this.device.gl.createShader(35633);break;case"fragment":this.handle=this.props.handle||this.device.gl.createShader(35632);break;default:throw new Error(this.props.stage)}i._setWebGLDebugMetadata(this.handle,this,{spector:this.props});const o=this._compile(this.source);o&&typeof o.catch=="function"&&o.catch(()=>{this.compilationStatus="error"})}destroy(){this.handle&&(this.removeStats(),this.device.gl.deleteShader(this.handle),this.destroyed=!0,this.handle.destroyed=!0)}get asyncCompilationStatus(){return this._waitForCompilationComplete().then(()=>(this._getCompilationStatus(),this.compilationStatus))}async getCompilationInfo(){return await this._waitForCompilationComplete(),this.getCompilationInfoSync()}getCompilationInfoSync(){const i=this.device.gl.getShaderInfoLog(this.handle);return i?e4(i):[]}getTranslatedSource(){const n=this.device.getExtension("WEBGL_debug_shaders").WEBGL_debug_shaders;return(n==null?void 0:n.getTranslatedShaderSource(this.handle))||null}_compile(i){i=i.startsWith("#version ")?i:`#version 300 es 2154${i}`;const{gl:n}=this.device;if(n.shaderSource(this.handle,i),n.compileShader(this.handle),!this.device.props.debug){this.compilationStatus="pending";return}if(!this.device.features.has("compilation-status-async-webgl")){if(this._getCompilationStatus(),this.debugShader(),this.compilationStatus==="error")throw new Error(`GLSL compilation errors in ${this.props.stage} shader ${this.props.id}`);return}return at.once(1,"Shader compilation is asynchronous")(),this._waitForCompilationComplete().then(()=>{at.info(2,`Shader ${this.id} - async compilation complete: ${this.compilationStatus}`)(),this._getCompilationStatus(),this.debugShader()})}async _waitForCompilationComplete(){const i=async d=>await new Promise(p=>setTimeout(p,d));if(!this.device.features.has("compilation-status-async-webgl")){await i(10);return}const{gl:o}=this.device;for(;;){if(o.getShaderParameter(this.handle,37297))return;await i(10)}}_getCompilationStatus(){this.compilationStatus=this.device.gl.getShaderParameter(this.handle,35713)?"success":"error"}}function i4(t,e,i,n){if(a4(e))return n(t);const o=t;o.pushState();try{return n4(t,e),Ep(o.gl,i),n(t)}finally{o.popState()}}function n4(t,e){const i=t,{gl:n}=i;if(e.cullMode)switch(e.cullMode){case"none":n.disable(2884);break;case"front":n.enable(2884),n.cullFace(1028);break;case"back":n.enable(2884),n.cullFace(1029);break}if(e.frontFace&&n.frontFace(Rd("frontFace",e.frontFace,{ccw:2305,cw:2304})),e.unclippedDepth&&t.features.has("depth-clip-control")&&n.enable(34383),e.depthBias!==void 0&&(n.enable(32823),n.polygonOffset(e.depthBias,e.depthBiasSlopeScale||0)),e.provokingVertex&&t.features.has("provoking-vertex-webgl")){const d=i.getExtension("WEBGL_provoking_vertex").WEBGL_provoking_vertex,p=Rd("provokingVertex",e.provokingVertex,{first:36429,last:36430});d==null||d.provokingVertexWEBGL(p)}if((e.polygonMode||e.polygonOffsetLine)&&t.features.has("polygon-mode-webgl")){if(e.polygonMode){const d=i.getExtension("WEBGL_polygon_mode").WEBGL_polygon_mode,p=Rd("polygonMode",e.polygonMode,{fill:6914,line:6913});d==null||d.polygonModeWEBGL(1028,p),d==null||d.polygonModeWEBGL(1029,p)}e.polygonOffsetLine&&n.enable(10754)}if(t.features.has("shader-clip-cull-distance-webgl")&&(e.clipDistance0&&n.enable(12288),e.clipDistance1&&n.enable(12289),e.clipDistance2&&n.enable(12290),e.clipDistance3&&n.enable(12291),e.clipDistance4&&n.enable(12292),e.clipDistance5&&n.enable(12293),e.clipDistance6&&n.enable(12294),e.clipDistance7&&n.enable(12295)),e.depthWriteEnabled!==void 0&&n.depthMask(s4("depthWriteEnabled",e.depthWriteEnabled)),e.depthCompare&&(e.depthCompare!=="always"?n.enable(2929):n.disable(2929),n.depthFunc(C0("depthCompare",e.depthCompare))),e.clearDepth!==void 0&&n.clearDepth(e.clearDepth),e.stencilWriteMask){const o=e.stencilWriteMask;n.stencilMaskSeparate(1028,o),n.stencilMaskSeparate(1029,o)}if(e.stencilReadMask&&at.warn("stencilReadMask not supported under WebGL"),e.stencilCompare){const o=e.stencilReadMask||4294967295,d=C0("depthCompare",e.stencilCompare);e.stencilCompare!=="always"?n.enable(2960):n.disable(2960),n.stencilFuncSeparate(1028,d,0,o),n.stencilFuncSeparate(1029,d,0,o)}if(e.stencilPassOperation&&e.stencilFailOperation&&e.stencilDepthFailOperation){const o=Tb("stencilPassOperation",e.stencilPassOperation),d=Tb("stencilFailOperation",e.stencilFailOperation),p=Tb("stencilDepthFailOperation",e.stencilDepthFailOperation);n.stencilOpSeparate(1028,d,p,o),n.stencilOpSeparate(1029,d,p,o)}switch(e.blend){case!0:n.enable(3042);break;case!1:n.disable(3042);break}if(e.blendColorOperation||e.blendAlphaOperation){const o=Kw("blendColorOperation",e.blendColorOperation||"add"),d=Kw("blendAlphaOperation",e.blendAlphaOperation||"add");n.blendEquationSeparate(o,d);const p=q_("blendColorSrcFactor",e.blendColorSrcFactor||"one"),h=q_("blendColorDstFactor",e.blendColorDstFactor||"zero"),A=q_("blendAlphaSrcFactor",e.blendAlphaSrcFactor||"one"),R=q_("blendAlphaDstFactor",e.blendAlphaDstFactor||"zero");n.blendFuncSeparate(p,h,A,R)}}function C0(t,e){return Rd(t,e,{never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519})}function Tb(t,e){return Rd(t,e,{keep:7680,zero:0,replace:7681,invert:5386,"increment-clamp":7682,"decrement-clamp":7683,"increment-wrap":34055,"decrement-wrap":34056})}function Kw(t,e){return Rd(t,e,{add:32774,subtract:32778,"reverse-subtract":32779,min:32775,max:32776})}function q_(t,e,i="color"){return Rd(t,e,{one:1,zero:0,src:768,"one-minus-src":769,dst:774,"one-minus-dst":775,"src-alpha":770,"one-minus-src-alpha":771,"dst-alpha":772,"one-minus-dst-alpha":773,"src-alpha-saturated":776,constant:i==="color"?32769:32771,"one-minus-constant":i==="color"?32770:32772,src1:768,"one-minus-src1":769,"src1-alpha":770,"one-minus-src1-alpha":771})}function r4(t,e){return`Illegal parameter ${e} for ${t}`}function Rd(t,e,i){if(!(e in i))throw new Error(r4(t,e));return i[e]}function s4(t,e){return e}function a4(t){let e=!0;for(const i in t){e=!1;break}return e}function oA(t){const e={};return t.addressModeU&&(e[10242]=Sb(t.addressModeU)),t.addressModeV&&(e[10243]=Sb(t.addressModeV)),t.addressModeW&&(e[32882]=Sb(t.addressModeW)),t.magFilter&&(e[10240]=R0(t.magFilter)),(t.minFilter||t.mipmapFilter)&&(e[10241]=o4(t.minFilter||"linear",t.mipmapFilter)),t.lodMinClamp!==void 0&&(e[33082]=t.lodMinClamp),t.lodMaxClamp!==void 0&&(e[33083]=t.lodMaxClamp),t.type==="comparison-sampler"&&(e[34892]=34894),t.compare&&(e[34893]=C0("compare",t.compare)),t.maxAnisotropy&&(e[34046]=t.maxAnisotropy),e}function Sb(t){switch(t){case"clamp-to-edge":return 33071;case"repeat":return 10497;case"mirror-repeat":return 33648}}function R0(t){switch(t){case"nearest":return 9728;case"linear":return 9729}}function o4(t,e="none"){if(!e)return R0(t);switch(e){case"none":return R0(t);case"nearest":switch(t){case"nearest":return 9984;case"linear":return 9985}break;case"linear":switch(t){case"nearest":return 9986;case"linear":return 9987}}}class l4 extends op{constructor(i,n){super(i,n);Y(this,"device");Y(this,"handle");Y(this,"parameters");this.device=i,this.parameters=oA(n),this.handle=n.handle||this.device.gl.createSampler(),this._setSamplerParameters(this.parameters)}destroy(){this.handle&&(this.device.gl.deleteSampler(this.handle),this.handle=void 0)}toString(){return`Sampler(${this.id},${JSON.stringify(this.props)})`}_setSamplerParameters(i){for(const[n,o]of Object.entries(i)){const d=Number(n);switch(d){case 33082:case 33083:this.device.gl.samplerParameterf(this.handle,d,o);break;default:this.device.gl.samplerParameteri(this.handle,d,o);break}}}}function wd(t,e,i){if(c4(e))return i(t);const{nocatch:n=!0}=e,o=Cd.get(t);o.push(),Ep(t,e);let d;if(n)d=i(t),o.pop();else try{d=i(t)}finally{o.pop()}return d}function c4(t){for(const e in t)return!1;return!0}class Jf extends wy{constructor(i,n){super(i,{...Dn.defaultProps,...n});Y(this,"device");Y(this,"gl");Y(this,"handle");Y(this,"texture");this.device=i,this.gl=this.device.gl,this.handle=null,this.texture=n.texture}}function lA(t){return u4[t]}const u4={5124:"sint32",5125:"uint32",5122:"sint16",5123:"uint16",5120:"sint8",5121:"uint8",5126:"float32",5131:"float16",33635:"uint16",32819:"uint16",32820:"uint16",33640:"uint32",35899:"uint32",35902:"uint32",34042:"uint32",36269:"uint32"};class sg extends Dn{constructor(i,n){super(i,n,{byteAlignment:1});Y(this,"device");Y(this,"gl");Y(this,"handle");Y(this,"sampler");Y(this,"view");Y(this,"glTarget");Y(this,"glFormat");Y(this,"glType");Y(this,"glInternalFormat");Y(this,"compressed");Y(this,"_textureUnit",0);Y(this,"_framebuffer",null);Y(this,"_framebufferAttachmentKey",null);this.device=i,this.gl=this.device.gl;
2154const o=aA(this.props.format);this.glTarget=f4(this.props.dimension),this.glInternalFormat=o.internalFormat,this.glFormat=o.format,this.glType=o.type,this.compressed=o.compressed,this.handle=this.props.handle||this.gl.createTexture(),this.device._setWebGLDebugMetadata(this.handle,this,{spector:this.props}),this.gl.bindTexture(this.glTarget,this.handle);const{dimension:d,width:p,height:h,depth:A,mipLevels:R,glTarget:B,glInternalFormat:N}=this;if(!this.compressed)switch(d){case"2d":case"cube":this.gl.texStorage2D(B,R,N,p,h);break;case"2d-array":case"3d":this.gl.texStorage3D(B,R,N,p,h,A);break;default:throw new Error(d)}this.gl.bindTexture(this.glTarget,null),this._initializeData(n.data),this.props.handle?this.trackReferencedMemory(this.getAllocatedByteLength(),"Texture"):this.trackAllocatedMemory(this.getAllocatedByteLength(),"Texture"),this.setSampler(this.props.sampler),this.view=new Jf(this.device,{...this.props,texture:this}),Object.seal(this)}destroy(){var i;this.handle&&((i=this._framebuffer)==null||i.destroy(),this._framebuffer=null,this._framebufferAttachmentKey=null,this.removeStats(),this.props.handle?this.trackDeallocatedReferencedMemory("Texture"):(this.gl.deleteTexture(this.handle),this.trackDeallocatedMemory("Texture")),this.destroyed=!0)}createView(i){return new Jf(this.device,{...i,texture:this})}setSampler(i={}){super.setSampler(i);const n=oA(this.sampler.props);this._setSamplerParameters(n)}copyExternalImage(i){const n=this._normalizeCopyExternalImageOptions(i);if(n.sourceX||n.sourceY)throw new Error("WebGL does not support sourceX/sourceY)");const{glFormat:o,glType:d}=this,{image:p,depth:h,mipLevel:A,x:R,y:B,z:N,width:F,height:Q}=n,re=Z_(this.glTarget,this.dimension,N),se=n.flipY?{37440:!0}:{};return this.gl.bindTexture(this.glTarget,this.handle),wd(this.gl,se,()=>{switch(this.dimension){case"2d":case"cube":this.gl.texSubImage2D(re,A,R,B,F,Q,o,d,p);break;case"2d-array":case"3d":this.gl.texSubImage3D(re,A,R,B,N,F,Q,h,o,d,p);break;default:}}),this.gl.bindTexture(this.glTarget,null),{width:n.width,height:n.height}}copyImageData(i){super.copyImageData(i)}readBuffer(i={},n){if(!n)throw new Error(`${this} readBuffer requires a destination buffer`);const o=this._getSupportedColorReadOptions(i),d=i.byteOffset??0,p=this.computeMemoryLayout(o);if(n.byteLength<d+p.byteLength)throw new Error(`${this} readBuffer target is too small (${n.byteLength} < ${d+p.byteLength})`);const h=n;this.gl.bindBuffer(35051,h.handle);try{this._readColorTextureLayers(o,p,A=>{this.gl.readPixels(o.x,o.y,o.width,o.height,this.glFormat,this.glType,d+A)})}finally{this.gl.bindBuffer(35051,null)}return n}async readDataAsync(i={}){throw new Error(`${this} readDataAsync is deprecated; use readBuffer() with an explicit destination buffer or DynamicTexture.readAsync()`)}writeBuffer(i,n={}){const o=this._normalizeTextureWriteOptions(n),{width:d,height:p,depthOrArrayLayers:h,mipLevel:A,byteOffset:R,x:B,y:N,z:F}=o,{glFormat:Q,glType:re,compressed:se}=this,ae=Z_(this.glTarget,this.dimension,F);if(se)throw new Error("writeBuffer for compressed textures is not implemented in WebGL");const{bytesPerPixel:me}=this.device.getTextureFormatInfo(this.format),we=me?o.bytesPerRow/me:void 0,ve={3317:this.byteAlignment,...we!==void 0?{3314:we}:{},32878:o.rowsPerImage};this.gl.bindTexture(this.glTarget,this.handle),this.gl.bindBuffer(35052,i.handle),wd(this.gl,ve,()=>{switch(this.dimension){case"2d":case"cube":this.gl.texSubImage2D(ae,A,B,N,d,p,Q,re,R);break;case"2d-array":case"3d":this.gl.texSubImage3D(ae,A,B,N,F,d,p,h,Q,re,R);break;default:}}),this.gl.bindBuffer(35052,null),this.gl.bindTexture(this.glTarget,null)}writeData(i,n={}){const o=this._normalizeTextureWriteOptions(n),d=ArrayBuffer.isView(i)?i:new Uint8Array(i),{width:p,height:h,depthOrArrayLayers:A,mipLevel:R,x:B,y:N,z:F,byteOffset:Q}=o,{glFormat:re,glType:se,compressed:ae}=this,me=Z_(this.glTarget,this.dimension,F);let we;if(!ae){const{bytesPerPixel:Je}=this.device.getTextureFormatInfo(this.format);Je&&(we=o.bytesPerRow/Je)}const ve=this.compressed?{}:{3317:this.byteAlignment,...we!==void 0?{3314:we}:{},32878:o.rowsPerImage},Oe=d4(d,Q),Te=ae?h4(d,Q):d,Re=this._getMipLevelSize(R),Ee=B===0&&N===0&&F===0&&p===Re.width&&h===Re.height&&A===Re.depthOrArrayLayers;this.gl.bindTexture(this.glTarget,this.handle),this.gl.bindBuffer(35052,null),wd(this.gl,ve,()=>{switch(this.dimension){case"2d":case"cube":ae?Ee?this.gl.compressedTexImage2D(me,R,re,p,h,0,Te):this.gl.compressedTexSubImage2D(me,R,B,N,p,h,re,Te):this.gl.texSubImage2D(me,R,B,N,p,h,re,se,d,Oe);break;case"2d-array":case"3d":ae?Ee?this.gl.compressedTexImage3D(me,R,re,p,h,A,0,Te):this.gl.compressedTexSubImage3D(me,R,B,N,F,p,h,A,re,Te):this.gl.texSubImage3D(me,R,B,N,F,p,h,A,re,se,d,Oe);break;default:}}),this.gl.bindTexture(this.glTarget,null)}_getRowByteAlignment(i,n){return 1}_getFramebuffer(){return this._framebuffer||(this._framebuffer=this.device.createFramebuffer({
2154id:`framebuffer-for-${this.id}`,width:this.width,height:this.height,colorAttachments:[this]})),this._framebuffer}readDataSyncWebGL(i={}){const n=this._getSupportedColorReadOptions(i),o=this.computeMemoryLayout(n),d=lA(this.glType),p=l2(d),h=new p(o.byteLength/p.BYTES_PER_ELEMENT);return this._readColorTextureLayers(n,o,A=>{const R=new p(h.buffer,h.byteOffset+A,o.bytesPerImage/p.BYTES_PER_ELEMENT);this.gl.readPixels(n.x,n.y,n.width,n.height,this.glFormat,this.glType,R)}),h.buffer}_readColorTextureLayers(i,n,o){const d=this._getFramebuffer(),p=n.bytesPerRow/n.bytesPerPixel,h={3333:this.byteAlignment,...p!==i.width?{3330:p}:{}},A=this.gl.getParameter(3074),R=this.gl.bindFramebuffer(36160,d.handle);try{this.gl.readBuffer(36064),wd(this.gl,h,()=>{for(let B=0;B<i.depthOrArrayLayers;B++)this._attachReadSubresource(d,i.mipLevel,i.z+B),o(B*n.bytesPerImage)})}finally{this.gl.bindFramebuffer(36160,R||null),this.gl.readBuffer(A)}}_attachReadSubresource(i,n,o){const d=`${n}:${o}`;if(this._framebufferAttachmentKey!==d){switch(this.dimension){case"2d":this.gl.framebufferTexture2D(36160,36064,3553,this.handle,n);break;case"cube":this.gl.framebufferTexture2D(36160,36064,Z_(this.glTarget,this.dimension,o),this.handle,n);break;case"2d-array":case"3d":this.gl.framebufferTextureLayer(36160,36064,this.handle,n,o);break;default:throw new Error(`${this} color readback does not support ${this.dimension} textures`)}if(this.device.props.debug){const p=Number(this.gl.checkFramebufferStatus(36160));if(p!==36053)throw new Error(`${i} incomplete for ${this} readback (${p})`)}this._framebufferAttachmentKey=d}}generateMipmapsWebGL(i){if(!(!(this.device.isTextureFormatRenderable(this.props.format)&&this.device.isTextureFormatFilterable(this.props.format))&&(at.warn(`${this} is not renderable or filterable, may not be able to generate mipmaps`)(),!(i!=null&&i.force))))try{this.gl.bindTexture(this.glTarget,this.handle),this.gl.generateMipmap(this.glTarget)}catch(o){at.warn(`Error generating mipmap for ${this}: ${o.message}`)()}finally{this.gl.bindTexture(this.glTarget,null)}}_setSamplerParameters(i){at.log(2,`${this.id} sampler parameters`,this.device.getGLKeys(i))(),this.gl.bindTexture(this.glTarget,this.handle);for(const[n,o]of Object.entries(i)){const d=Number(n),p=o;switch(d){case 33082:case 33083:this.gl.texParameterf(this.glTarget,d,p);break;case 10240:case 10241:this.gl.texParameteri(this.glTarget,d,p);break;case 10242:case 10243:case 32882:this.gl.texParameteri(this.glTarget,d,p);break;case 34046:this.device.features.has("texture-filterable-anisotropic-webgl")&&this.gl.texParameteri(this.glTarget,d,p);break;case 34892:case 34893:this.gl.texParameteri(this.glTarget,d,p);break}}this.gl.bindTexture(this.glTarget,null)}_getActiveUnit(){return this.gl.getParameter(34016)-33984}_bind(i){const{gl:n}=this;return i!==void 0&&(this._textureUnit=i,n.activeTexture(33984+i)),n.bindTexture(this.glTarget,this.handle),i}_unbind(i){const{gl:n}=this;return i!==void 0&&(this._textureUnit=i,n.activeTexture(33984+i)),n.bindTexture(this.glTarget,null),i}}function h4(t,e=0){return e?new t.constructor(t.buffer,t.byteOffset+e,(t.byteLength-e)/t.BYTES_PER_ELEMENT):t}function d4(t,e){if(e%t.BYTES_PER_ELEMENT!==0)throw new Error(`Texture byteOffset ${e} must align to typed array element size ${t.BYTES_PER_ELEMENT}`);return e/t.BYTES_PER_ELEMENT}function f4(t){switch(t){case"1d":break;case"2d":return 3553;case"3d":return 32879;case"cube":return 34067;case"2d-array":return 35866}throw new Error(t)}function Z_(t,e,i){return e==="cube"?34069+i:t}function p4(t,e,i,n){const o=t;let d=n;d===!0&&(d=1),d===!1&&(d=0);const p=typeof d=="number"?[d]:d;switch(i){case 35678:case 35680:case 35679:case 35682:case 36289:case 36292:case 36293:case 36298:case 36299:case 36300:case 36303:case 36306:case 36307:case 36308:case 36311:if(typeof n!="number")throw new Error("samplers must be set to integers");return t.uniform1i(e,n);case 5126:return t.uniform1fv(e,p);case 35664:return t.uniform2fv(e,p);case 35665:return t.uniform3fv(e,p);case 35666:return t.uniform4fv(e,p);case 5124:return t.uniform1iv(e,p);case 35667:return t.uniform2iv(e,p);case 35668:return t.uniform3iv(e,p);case 35669:return t.uniform4iv(e,p);case 35670:return t.uniform1iv(e,p);case 35671:return t.uniform2iv(e,p);case 35672:return t.uniform3iv(e,p);case 35673:return t.uniform4iv(e,p);case 5125:return o.uniform1uiv(e,p,1);case 36294:return o.uniform2uiv(e,p,2);case 36295:return o.uniform3uiv(e,p,3);case 36296:return o.uniform4uiv(e,p,4);case 35674:return t.uniformMatrix2fv(e,!1,p);case 35675:return t.uniformMatrix3fv(e,!1,p);case 35676:return t.uniformMatrix4fv(e,!1,p);
2154case 35685:return o.uniformMatrix2x3fv(e,!1,p);case 35686:return o.uniformMatrix2x4fv(e,!1,p);case 35687:return o.uniformMatrix3x2fv(e,!1,p);case 35688:return o.uniformMatrix3x4fv(e,!1,p);case 35689:return o.uniformMatrix4x2fv(e,!1,p);case 35690:return o.uniformMatrix4x3fv(e,!1,p)}throw new Error("Illegal uniform")}function m4(t){switch(t){case"point-list":return 0;case"line-list":return 1;case"line-strip":return 3;case"triangle-list":return 4;case"triangle-strip":return 5;default:throw new Error(t)}}function g4(t){switch(t){case"point-list":return 0;case"line-list":return 1;case"line-strip":return 1;case"triangle-list":return 4;case"triangle-strip":return 4;default:throw new Error(t)}}class _4 extends hh{constructor(i,n){super(i,n);Y(this,"device");Y(this,"handle");Y(this,"vs");Y(this,"fs");Y(this,"introspectedLayout");Y(this,"bindings",{});Y(this,"uniforms",{});Y(this,"varyings",null);Y(this,"_uniformCount",0);Y(this,"_uniformSetters",{});this.device=i;const o=this.sharedRenderPipeline||this.device._createSharedRenderPipelineWebGL(n);this.sharedRenderPipeline=o,this.handle=o.handle,this.vs=o.vs,this.fs=o.fs,this.linkStatus=o.linkStatus,this.introspectedLayout=o.introspectedLayout,this.device._setWebGLDebugMetadata(this.handle,this,{spector:{id:this.props.id}}),this.shaderLayout=n.shaderLayout?y4(this.introspectedLayout,n.shaderLayout):this.introspectedLayout}get[Symbol.toStringTag](){return"WEBGLRenderPipeline"}destroy(){this.destroyed||(this.sharedRenderPipeline&&!this.props._sharedRenderPipeline&&this.sharedRenderPipeline.destroy(),this.destroyResource())}setBindings(i,n){const o=H1(s2(this.shaderLayout,i));for(const[d,p]of Object.entries(o)){const h=cA(this.shaderLayout,d);if(h){switch(p||at.warn(`Unsetting binding "${d}" in render pipeline "${this.id}"`)(),h.type){case"uniform":if(!(p instanceof rg)&&!(p.buffer instanceof rg))throw new Error("buffer value");break;case"texture":if(!(p instanceof Jf||p instanceof sg||p instanceof ng))throw new Error(`${this} Bad texture binding for ${d}`);break;case"sampler":at.warn(`Ignoring sampler ${d}`)();break;default:throw new Error(h.type)}this.bindings[d]=p}else{const A=this.shaderLayout.bindings.map(R=>`"${R.name}"`).join(", ");n!=null&&n.disableWarnings||at.warn(`No binding "${d}" in render pipeline "${this.id}", expected one of ${A}`,p)()}}}draw(i){var we;this._syncLinkStatus();const n=i.bindGroups?H1(i.bindGroups):i.bindings||this.bindings,{renderPass:o,parameters:d=this.props.parameters,topology:p=this.props.topology,vertexArray:h,vertexCount:A,instanceCount:R,isInstanced:B=!1,firstVertex:N=0,transformFeedback:F,uniforms:Q=this.uniforms}=i,re=m4(p),se=!!h.indexBuffer,ae=(we=h.indexBuffer)==null?void 0:we.glIndexType;if(this.linkStatus!=="success")return at.info(2,`RenderPipeline:${this.id}.draw() aborted - waiting for shader linking`)(),!1;if(!this._areTexturesRenderable(n))return at.info(2,`RenderPipeline:${this.id}.draw() aborted - textures not yet loaded`)(),!1;this.device.gl.useProgram(this.handle),h.bindBeforeRender(o),F&&F.begin(this.props.topology),this._applyBindings(n,{disableWarnings:this.props.disableWarnings}),this._applyUniforms(Q);const me=o;return i4(this.device,d,me.glParameters,()=>{se&&B?this.device.gl.drawElementsInstanced(re,A||0,ae,N,R||0):se?this.device.gl.drawElements(re,A||0,ae,N):B?this.device.gl.drawArraysInstanced(re,N,A||0,R||0):this.device.gl.drawArrays(re,N,A||0),F&&F.end()}),h.unbindAfterRender(o),!0}_areTexturesRenderable(i){let n=!0;for(const o of this.shaderLayout.bindings)Qw(i,o.name)||(at.warn(`Binding ${o.name} not found in ${this.id}`)(),n=!1);return n}_applyBindings(i,n){if(this._syncLinkStatus(),this.linkStatus!=="success")return;const{gl:o}=this.device;o.useProgram(this.handle);let d=0,p=0;for(const h of this.shaderLayout.bindings){const A=Qw(i,h.name);if(!A)throw new Error(`No value for binding ${h.name} in ${this.id}`);switch(h.type){case"uniform":const{name:R}=h,B=o.getUniformBlockIndex(this.handle,R);if(B===4294967295)throw new Error(`Invalid uniform block name ${R}`);if(o.uniformBlockBinding(this.handle,B,p),A instanceof rg)o.bindBufferBase(35345,p,A.handle);else{const F=A;o.bindBufferRange(35345,p,F.buffer.handle,F.offset||0,F.size||F.buffer.byteLength-(F.offset||0))}p+=1;break;case"texture":if(!(A instanceof Jf||A instanceof sg||A instanceof ng))throw new Error("texture");let N;if(A instanceof Jf)N=A.texture;else if(A instanceof sg)N=A;else if(A instanceof ng&&A.colorAttachments[0]instanceof Jf)at.warn("Passing framebuffer in texture binding may be deprecated. Use fbo.colorAttachments[0] instead")(),N=A.colorAttachments[0].texture;else throw new Error("No texture");o.activeTexture(33984+d),o.bindTexture(N.glTarget,N.handle),d+=1;break;case"sampler":break;case"storage":case"read-only-storage":throw new Error(`binding type '${h.t
2154ype}' not supported in WebGL`)}}}_applyUniforms(i){for(const n of this.shaderLayout.uniforms||[]){const{name:o,location:d,type:p,textureUnit:h}=n,A=i[o]??h;A!==void 0&&p4(this.device.gl,d,p,A)}}_syncLinkStatus(){this.linkStatus=this.sharedRenderPipeline.linkStatus}}function y4(t,e){const i={...t,attributes:t.attributes.map(n=>({...n})),bindings:t.bindings.map(n=>({...n}))};for(const n of(e==null?void 0:e.attributes)||[]){const o=i.attributes.find(d=>d.name===n.name);o?(o.type=n.type||o.type,o.stepMode=n.stepMode||o.stepMode):at.warn(`shader layout attribute ${n.name} not present in shader`)}for(const n of(e==null?void 0:e.bindings)||[]){const o=cA(i,n.name);if(!o){at.warn(`shader layout binding ${n.name} not present in shader`);continue}Object.assign(o,n)}return i}function cA(t,e){return t.bindings.find(i=>i.name===e||i.name===`${e}Uniforms`||`${i.name}Uniforms`===e)}function Qw(t,e){return t[e]||t[`${e}Uniforms`]||t[e.replace(/Uniforms$/,"")]}function v4(t){return w4[t]}function yx(t){return x4[t]}function uA(t){return!!hA[t]}function b4(t){return hA[t]}const x4={5126:"f32",35664:"vec2<f32>",35665:"vec3<f32>",35666:"vec4<f32>",5124:"i32",35667:"vec2<i32>",35668:"vec3<i32>",35669:"vec4<i32>",5125:"u32",36294:"vec2<u32>",36295:"vec3<u32>",36296:"vec4<u32>",35670:"f32",35671:"vec2<f32>",35672:"vec3<f32>",35673:"vec4<f32>",35674:"mat2x2<f32>",35685:"mat2x3<f32>",35686:"mat2x4<f32>",35687:"mat3x2<f32>",35675:"mat3x3<f32>",35688:"mat3x4<f32>",35689:"mat4x2<f32>",35690:"mat4x3<f32>",35676:"mat4x4<f32>"},hA={35678:{viewDimension:"2d",sampleType:"float"},35680:{viewDimension:"cube",sampleType:"float"},35679:{viewDimension:"3d",sampleType:"float"},35682:{viewDimension:"3d",sampleType:"depth"},36289:{viewDimension:"2d-array",sampleType:"float"},36292:{viewDimension:"2d-array",sampleType:"depth"},36293:{viewDimension:"cube",sampleType:"float"},36298:{viewDimension:"2d",sampleType:"sint"},36299:{viewDimension:"3d",sampleType:"sint"},36300:{viewDimension:"cube",sampleType:"sint"},36303:{viewDimension:"2d-array",sampleType:"uint"},36306:{viewDimension:"2d",sampleType:"uint"},36307:{viewDimension:"3d",sampleType:"uint"},36308:{viewDimension:"cube",sampleType:"uint"},36311:{viewDimension:"2d-array",sampleType:"uint"}},w4={uint8:5121,sint8:5120,unorm8:5121,snorm8:5120,uint16:5123,sint16:5122,unorm16:5123,snorm16:5122,uint32:5125,sint32:5124,float16:5131,float32:5126};function T4(t,e){const i={attributes:[],bindings:[]};i.attributes=S4(t,e);const n=C4(t,e);for(const h of n){const A=h.uniforms.map(R=>({name:R.name,format:R.format,byteOffset:R.byteOffset,byteStride:R.byteStride,arrayLength:R.arrayLength}));i.bindings.push({type:"uniform",name:h.name,group:0,location:h.location,visibility:(h.vertex?1:0)&(h.fragment?2:0),minBindingSize:h.byteLength,uniforms:A})}const o=E4(t,e);let d=0;for(const h of o)if(uA(h.type)){const{viewDimension:A,sampleType:R}=b4(h.type);i.bindings.push({type:"texture",name:h.name,group:0,location:d,viewDimension:A,sampleType:R}),h.textureUnit=d,d+=1}o.length&&(i.uniforms=o);const p=A4(t,e);return p!=null&&p.length&&(i.varyings=p),i}function S4(t,e){const i=[],n=t.getProgramParameter(e,35721);for(let o=0;o<n;o++){const d=t.getActiveAttrib(e,o);if(!d)throw new Error("activeInfo");const{name:p,type:h}=d,A=t.getAttribLocation(e,p);if(A>=0){const R=yx(h),B=/instance/i.test(p)?"instance":"vertex";i.push({name:p,location:A,stepMode:B,type:R})}}return i.sort((o,d)=>o.location-d.location),i}function A4(t,e){const i=[],n=t.getProgramParameter(e,35971);for(let o=0;o<n;o++){const d=t.getTransformFeedbackVarying(e,o);if(!d)throw new Error("activeInfo");const{name:p,type:h,size:A}=d,R=yx(h),{type:B,components:N}=ox(R);i.push({location:o,name:p,type:B,size:A*N})}return i.sort((o,d)=>o.location-d.location),i}function E4(t,e){const i=[],n=t.getProgramParameter(e,35718);for(let o=0;o<n;o++){const d=t.getActiveUniform(e,o);if(!d)throw new Error("activeInfo");const{name:p,size:h,type:A}=d,{name:R,isArray:B}=R4(p);let N=t.getUniformLocation(e,R);const F={location:N,name:R,size:h,type:A,isArray:B};if(i.push(F),F.size>1)for(let Q=0;Q<F.size;Q++){const re=`${R}[${Q}]`;N=t.getUniformLocation(e,re);const se={...F,name:re,location:N};i.push(se)}}return i}function C4(t,e){const i=(d,p)=>t.getActiveUniformBlockParameter(e,d,p),n=[],o=t.getProgramParameter(e,35382);for(let d=0;d<o;d++){const p={name:t.getActiveUniformBlockName(e,d)||"",location:i(d,35391),byteLength:i(d,35392),vertex:i(d,35396),fragment:i(d,35398),uniformCount:i(d,35394),uniforms:[]},h=i(d,35395)||[],A=t.getActiveUniforms(e,h,35383),R=t.getActiveUniforms(e,h,35384),B=t.getActiveUniforms(e,h,35387),N=t.getActiveUniforms(e,h,35388);for(let re=0;re<p.uniformCount;++re){const se=h[re];
2154if(se!==void 0){const ae=t.getActiveUniform(e,se);if(!ae)throw new Error("activeInfo");const me=yx(A[re]);p.uniforms.push({name:ae.name,format:me,type:A[re],arrayLength:R[re],byteOffset:B[re],byteStride:N[re]})}}const F=new Set(p.uniforms.map(re=>re.name.split(".")[0]).filter(re=>!!re)),Q=p.name.replace(/Uniforms$/,"");if(F.size===1&&!F.has(p.name)&&!F.has(Q)){const[re]=F;at.warn(`Uniform block "${p.name}" uses GLSL instance "${re}". luma.gl binds uniform buffers by block name ("${p.name}") and alias ("${Q}"). Prefer matching the instance name to one of those to avoid confusing silent mismatches.`)()}n.push(p)}return n.sort((d,p)=>d.location-p.location),n}function R4(t){if(t[t.length-1]!=="]")return{name:t,length:1,isArray:!1};const i=/([^[]*)(\[[0-9]+\])?/.exec(t);return{name:xy(i==null?void 0:i[1],`Failed to parse GLSL uniform name ${t}`),length:i!=null&&i[2]?1:0,isArray:!!(i!=null&&i[2])}}const Jw=4;class M4 extends EI{constructor(i,n){super(i,n);Y(this,"device");Y(this,"handle");Y(this,"vs");Y(this,"fs");Y(this,"introspectedLayout",{attributes:[],bindings:[],uniforms:[]});Y(this,"linkStatus","pending");this.device=i,this.handle=n.handle||this.device.gl.createProgram(),this.vs=n.vs,this.fs=n.fs,n.varyings&&n.varyings.length>0&&this.device.gl.transformFeedbackVaryings(this.handle,n.varyings,n.bufferMode||35981),this._linkShaders(),at.time(3,`RenderPipeline ${this.id} - shaderLayout introspection`)(),this.introspectedLayout=T4(this.device.gl,this.handle),at.timeEnd(3,`RenderPipeline ${this.id} - shaderLayout introspection`)()}destroy(){this.destroyed||(this.device.gl.useProgram(null),this.device.gl.deleteProgram(this.handle),this.handle.de
2154stroyed=!0,this.destroyResource())}async _linkShaders(){const{gl:i}=this.device;if(i.attachShader(this.handle,this.vs.handle),i.attachShader(this.handle,this.fs.handle),at.time(Jw,`linkProgram for ${this.id}`)(),i.linkProgram(this.handle),at.timeEnd(Jw,`linkProgram for ${this.id}`)(),!this.device.features.has("compilation-status-async-webgl")){const o=this._getLinkStatus();this._reportLinkStatus(o);return}at.once(1,"RenderPipeline linking is asynchronous")(),await this._waitForLinkComplete(),at.info(2,`RenderPipeline ${this.id} - async linking complete: ${this.linkStatus}`)();const n=this._getLinkStatus();this._reportLinkStatus(n)}async _reportLinkStatus(i){var n;switch(i){case"success":return;default:const o=i==="link-error"?"Link error":"Validation error";switch(this.vs.compilationStatus){case"error":throw this.vs.debugShader(),new Error(`${this} ${o} during compilation of ${this.vs}`);case"pending":await this.vs.asyncCompilationStatus,this.vs.debugShader();break}switch((n=this.fs)==null?void 0:n.compilationStatus){case"error":throw this.fs.debugShader(),new Error(`${this} ${o} during compilation of ${this.fs}`);case"pending":await this.fs.asyncCompilationStatus,this.fs.debugShader();break}const d=this.device.gl.getProgramInfoLog(this.handle);this.device.reportError(new Error(`${o} during ${i}: ${d}`),this)(),this.device.debug()}}_getLinkStatus(){const{gl:i}=this.device;return i.getProgramParameter(this.handle,35714)?(this._initializeSamplerUniforms(),i.validateProgram(this.handle),i.getProgramParameter(this.handle,35715)?(this.linkStatus="success","success"):(this.linkStatus="error","validation-error")):(this.linkStatus="error","link-error")}_initializeSamplerUniforms(){const{gl:i}=this.device;i.useProgram(this.handle);let n=0;const o=i.getProgramParameter(this.handle,35718);for(let d=0;d<o;d++){const p=i.getActiveUniform(this.handle,d);if(p&&uA(p.type)){const h=p.name.endsWith("[0]"),A=h?p.name.slice(0,-3):p.name,R=i.getUniformLocation(this.handle,A);R!==null&&(n=this._assignSamplerUniform(R,p,h,n))}}}_assignSamplerUniform(i,n,o,d){const{gl:p}=this.device;if(o&&n.size>1){const h=Int32Array.from({length:n.size},(A,R)=>d+R);return p.uniform1iv(i,h),d+n.size}return p.uniform1i(i,d),d+1}async _waitForLinkComplete(){const i=async d=>await new Promise(p=>setTimeout(p,d));if(!this.device.features.has("compilation-status-async-webgl")){await i(10);return}const{gl:o}=this.device;for(;;){if(o.getProgramParameter(this.handle,37297))return;await i(10)}}}class P4 extends r0{constructor(i,n={}){super(i,n);Y(this,"device");Y(this,"handle",null);Y(this,"commands",[]);this.device=i}_executeCommands(i=this.commands){for(const n of i)switch(n.name){case"copy-buffer-to-buffer":I4(this.device,n.options);break;case"copy-buffer-to-texture":D4(this.device,n.options);break;case"copy-texture-to-buffer":O4(this.device,n.options);break;case"copy-texture-to-texture":k4(this.device,n.options);break;default:throw new Error(n.name)}}}function I4(t,e){const i=e.sourceBuffer,n=e.destinationBuffer;t.gl.bindBuffer(36662,i.handle),t.gl.bindBuffer(36663,n.handle),t.gl.copyBufferSubData(36662,36663,e.sourceOffset??0,e.destinationOffset??0,e.size),t.gl.bindBuffer(36662,null),t.gl.bindBuffer(36663,null)}function D4(t,e){throw new Error("copyBufferToTexture is not supported in WebGL")}function O4(t,e){const{sourceTexture:i,mipLevel:n=0,aspect:o="all",width:d=e.sourceTexture.width,height:p=e.sourceTexture.height,depthOrArrayLayers:h,origin:A=[0,0,0],destinationBuffer:R,byteOffset:B=0,bytesPerRow:N,rowsPerImage:F}=e;if(i instanceof Dn){i.readBuffer({x:A[0]??0,y:A[1]??0,z:A[2]??0,width:d,height:p,depthOrArrayLayers:h,mipLevel:n,aspect:o,byteOffset:B},R);return}if(o!=="all")throw new Error("aspect not supported in WebGL");if(n!==0||h!==void 0||N||F)throw new Error("not implemented");const{framebuffer:Q,destroyFramebuffer:re}=dA(i);let se;try{const ae=R,me=d||Q.width,we=p||Q.height,ve=xy(Q.colorAttachments[0]),Oe=aA(ve.texture.props.format),Te=Oe.format,Re=Oe.type;t.gl.bindBuffer(35051,ae.handle),se=t.gl.bindFramebuffer(36160,Q.handle),t.gl.readPixels(A[0],A[1],me,we,Te,Re,B)}finally{t.gl.bindBuffer(35051,null),se!==void 0&&t.gl.bindFramebuffer(36160,se),re&&Q.destroy()}}function k4(t,e){const{sourceTexture:i,destinationMipLevel:n=0,origin:o=[0,0],destinationOrigin:d=[0,0,0],destinationTexture:p}=e;let{width:h=e.destinationTexture.width,height:A=e.destinationTexture.height}=e;const{framebuffer:R,destroyFramebuffer:B}=dA(i),[N=0,F=0]=o,[Q,re,se]=d,ae=t.gl.bindFramebuffer(36160,R.handle);let me,we;if(p instanceof sg)me=p,h=Number.isFinite(h)?h:me.width,A=Number.isFinite(A)?A:me.height,me._bind(0),we=me.glTarget;else throw new Error("invalid destination");switch(we){case 3553:case 34067:t.gl.copyTexSubImage2D(we,n,Q,re,N,F,h,A);break;case 35866:case 32879:t.gl.copyTexSubImage3D(we,n,Q,re,se,N,F,h,A);break}me&&me._unbind(),t.gl.bindFramebuffer(36160,ae),B&&R.destroy()}function dA(t){if(t instanceof Dn){const{width:e,height:i,id:n}=t;
2154return{framebuffer:t.device.createFramebuffer({id:`framebuffer-for-${n}`,width:e,height:i,colorAttachments:[t]}),destroyFramebuffer:!0}}return{framebuffer:t,destroyFramebuffer:!1}}const B4=[1,2,4,8];class N4 extends i0{constructor(i,n){var h;super(i,n);Y(this,"device");Y(this,"handle",null);Y(this,"glParameters",{});this.device=i;const o=this.props.framebuffer,d=!o||o.handle===null;d&&i.getDefaultCanvasContext()._resizeDrawingBufferIfNeeded();let p;if(!((h=n==null?void 0:n.parameters)!=null&&h.viewport))if(!d&&o){const{width:A,height:R}=o;p=[0,0,A,R]}else{const[A,R]=i.getDefaultCanvasContext().getDrawingBufferSize();p=[0,0,A,R]}if(this.device.pushState(),this.setParameters({viewport:p,...this.props.parameters}),!d&&(o!=null&&o.colorAttachments.length)){const A=o.colorAttachments.map((R,B)=>36064+B);this.device.gl.drawBuffers(A)}else d&&this.device.gl.drawBuffers([1029]);this.clear(),this.props.timestampQuerySet&&this.props.beginTimestampIndex!==void 0&&this.props.timestampQuerySet.writeTimestamp(this.props.beginTimestampIndex)}end(){this.destroyed||(this.props.timestampQuerySet&&this.props.endTimestampIndex!==void 0&&this.props.timestampQuerySet.writeTimestamp(this.props.endTimestampIndex),this.device.popState(),this.destroy())}pushDebugGroup(i){}popDebugGroup(){}insertDebugMarker(i){}setParameters(i={}){const n={...this.glParameters};n.framebuffer=this.props.framebuffer||null,this.props.depthReadOnly&&(n.depthMask=!this.props.depthReadOnly),n.stencilMask=this.props.stencilReadOnly?0:1,n[35977]=this.props.discard,i.viewport&&(i.viewport.length>=6?(n.viewport=i.viewport.slice(0,4),n.depthRange=[i.viewport[4],i.viewport[5]]):n.viewport=i.viewport),i.scissorRect&&(n.scissorTest=!0,n.scissor=i.scissorRect),i.blendConstant&&(n.blendColor=i.blendConstant),i.stencilReference!==void 0&&(n[2967]=i.stencilReference,n[36003]=i.stencilReference),"colorMask"in i&&(n.colorMask=B4.map(o=>!!(o&i.colorMask))),this.glParameters=n,Ep(this.device.gl,n)}beginOcclusionQuery(i){const n=this.props.occlusionQuerySet;n==null||n.beginOcclusionQuery()}endOcclusionQuery(){const i=this.props.occlusionQuerySet;i==null||i.endOcclusionQuery()}clear(){const i={...this.glParameters};let n=0;this.props.clearColors&&this.props.clearColors.forEach((o,d)=>{o&&this.clearColorBuffer(d,o)}),this.props.clearColor!==!1&&this.props.clearColors===void 0&&(n|=16384,i.clearColor=this.props.clearColor),this.props.clearDepth!==!1&&(n|=256,i.clearDepth=this.props.clearDepth),this.props.clearStencil!==!1&&(n|=1024,i.clearStencil=this.props.clearStencil),n!==0&&wd(this.device.gl,i,()=>{this.device.gl.clear(n)})}clearColorBuffer(i=0,n=[0,0,0,0]){wd(this.device.gl,{framebuffer:this.props.framebuffer},()=>{switch(n.constructor){case Int8Array:case Int16Array:case Int32Array:this.device.gl.clearBufferiv(6144,i,n);break;case Uint8Array:case Uint8ClampedArray:case Uint16Array:case Uint32Array:this.device.gl.clearBufferuiv(6144,i,n);break;case Float32Array:this.device.gl.clearBufferfv(6144,i,n);break;default:throw new Error("clearColorBuffer: color must be typed array")}})}}class eT extends n0{constructor(i,n){super(i,n);Y(this,"device");Y(this,"handle",null);Y(this,"commandBuffer");this.device=i,this.commandBuffer=new P4(i,{id:`${this.props.id}-command-buffer`})}destroy(){this.destroyResource()}finish(i){return i!=null&&i.id&&this.commandBuffer.id!==i.id&&(this.commandBuffer.id=i.id,this.commandBuffer.props.id=i.id),this.destroy(),this.commandBuffer}beginRenderPass(i={}){return new N4(this.device,this._applyTimeProfilingToPassProps(i))}beginComputePass(i={}){throw new Error("ComputePass not supported in WebGL")}copyBufferToBuffer(i){this.commandBuffer.commands.push({name:"copy-buffer-to-buffer",options:i})}copyBufferToTexture(i){this.commandBuffer.commands.push({name:"copy-buffer-to-texture",options:i})}copyTextureToBuffer(i){this.commandBuffer.commands.push({name:"copy-texture-to-buffer",options:i})}copyTextureToTexture(i){this.commandBuffer.commands.push({name:"copy-texture-to-texture",options:i})}pushDebugGroup(i){}popDebugGroup(){}insertDebugMarker(i){}resolveQuerySet(i,n,o){throw new Error("resolveQuerySet is not supported in WebGL")}writeTimestamp(i,n){i.writeTimestamp(n)}}function z4(t){const{target:e,source:i,start:n=0,count:o=1}=t,d=i.length,p=o*d;let h=0;for(let A=n;h<d;h++)e[A++]=i[h]??0;for(;h<p;)h<p-h?(e.copyWithin(n+h,n,n+h),h*=2):(e.copyWithin(n+h,n,n+p-h),h=p);return t.target}class vx extends s0{constructor(i,n){super(i,n);Y(this,"device");Y(this,"handle");Y(this,"buffer",null);Y(this,"bufferValue",null);this.device=i,this.handle=this.device.gl.createVertexArray()}get[Symbol.toStringTag](){return"VertexArray"}static isConstantAttributeZeroSupported(i){return RE()==="Chrome"}destroy(){var i;super.destroy(),this.buffer&&((i=this.buffer)==null||i.destroy()),this.handle&&(this.device.gl.deleteVertexArray(this.handle),this.handle=void 0)}setIndexBuffer(i){const n=i;if(n&&n.glTarget!==34963)throw new Error("Use .setBuffer()");this.device.gl.bindVertexArray(this.handle),this.device.gl.bindBuffer(34963,n?n.handle:null),this.indexBuffer=n,this.device.gl.bindVertexArray(null)}setBuffer(i,n){const o=n;if(o.glTarget===34963)throw new Error("Use .setIndexBuffer()");
2154const{size:d,type:p,stride:h,offset:A,normalized:R,integer:B,divisor:N}=this._getAccessor(i);this.device.gl.bindVertexArray(this.handle),this.device.gl.bindBuffer(34962,o.handle),B?this.device.gl.vertexAttribIPointer(i,d,p,h,A):this.device.gl.vertexAttribPointer(i,d,p,R,h,A),this.device.gl.bindBuffer(34962,null),this.device.gl.enableVertexAttribArray(i),this.device.gl.vertexAttribDivisor(i,N||0),this.attributes[i]=o,this.device.gl.bindVertexArray(null)}setConstantWebGL(i,n){this._enable(i,!1),this.attributes[i]=n}bindBeforeRender(){this.device.gl.bindVertexArray(this.handle),this._applyConstantAttributes()}unbindAfterRender(){this.device.gl.bindVertexArray(null)}_applyConstantAttributes(){for(let i=0;i<this.maxVertexAttributes;++i){const n=this.attributes[i];ArrayBuffer.isView(n)&&this.device.setConstantAttributeWebGL(i,n)}}_getAccessor(i){const n=this.attributeInfos[i];if(!n)throw new Error(`Unknown attribute location ${i}`);const o=iA(n.bufferDataType);return{size:n.bufferComponents,type:o,stride:n.byteStride,offset:n.byteOffset,normalized:n.normalized,integer:n.integer,divisor:n.stepMode==="instance"?1:0}}_enable(i,n=!0){const d=vx.isConstantAttributeZeroSupported(this.device)||i!==0;(n||d)&&(i=Number(i),this.device.gl.bindVertexArray(this.handle),n?this.device.gl.enableVertexAttribArray(i):this.device.gl.disableVertexAttribArray(i),this.device.gl.bindVertexArray(null))}getConstantBuffer(i,n){const o=L4(n),d=o.byteLength*i,p=o.length*i;if(this.buffer&&d!==this.buffer.byteLength)throw new Error(`Buffer size is immutable, byte length ${d} !== ${this.buffer.byteLength}.`);let h=!this.buffer;if(this.buffer=this.buffer||this.device.createBuffer({byteLength:d}),h||(h=!F4(o,this.bufferValue)),h){const A=GI(n.constructor,p);z4({target:A,source:o,start:0,count:p}),this.buffer.write(A),this.bufferValue=n}return this.buffer}}function L4(t){return Array.isArray(t)?new Float32Array(t):t}function F4(t,e){if(!t||!e||t.length!==e.length||t.constructor!==e.constructor)return!1;for(let i=0;i<t.length;++i)if(t[i]!==e[i])return!1;return!0}class U4 extends a0{constructor(i,n){super(i,n);Y(this,"device");Y(this,"gl");Y(this,"handle");Y(this,"layout");Y(this,"buffers",{});Y(this,"unusedBuffers",{});Y(this,"bindOnUse",!0);Y(this,"_bound",!1);this.device=i,this.gl=i.gl,this.handle=this.props.handle||this.gl.createTransformFeedback(),this.layout=this.props.layout,n.buffers&&this.setBuffers(n.buffers),Object.seal(this)}destroy(){this.gl.deleteTransformFeedback(this.handle),super.destroy()}begin(i="point-list"){this.gl.bindTransformFeedback(36386,this.handle),this.bindOnUse&&this._bindBuffers(),this.gl.beginTransformFeedback(g4(i))}end(){this.gl.endTransformFeedback(),this.bindOnUse&&this._unbindBuffers(),this.gl.bindTransformFeedback(36386,null)}setBuffers(i){this.buffers={},this.unusedBuffers={},this.bind(()=>{for(const[n,o]of Object.entries(i))this.setBuffer(n,o)})}setBuffer(i,n){const o=this._getVaryingIndex(i),{buffer:d,byteLength:p,byteOffset:h}=this._getBufferRange(n);if(o<0){this.unusedBuffers[i]=d,at.warn(`${this.id} unusedBuffers varying buffer ${i}`)();return}this.buffers[o]={buffer:d,byteLength:p,byteOffset:h},this.bindOnUse||this._bindBuffer(o,d,h,p)}getBuffer(i){if(tT(i))return this.buffers[i]||null;const n=this._getVaryingIndex(i);return this.buffers[n]??null}bind(i=this.handle){if(typeof i!="function")return this.gl.bindTransformFeedback(36386,i),this;let n;return this._bound?n=i():(this.gl.bindTransformFeedback(36386,this.handle),this._bound=!0,n=i(),this._bound=!1,this.gl.bindTransformFeedback(36386,null)),n}unbind(){this.bind(null)}_getBufferRange(i){if(i instanceof rg)return{buffer:i,byteOffset:0,byteLength:i.byteLength};const{buffer:n,byteOffset:o=0,byteLength:d=i.buffer.byteLength}=i;return{buffer:n,byteOffset:o,byteLength:d}}_getVaryingIndex(i){if(tT(i))return Number(i);for(const n of this.layout.varyings||[])if(i===n.name)return n.location;return-1}_bindBuffers(){for(const[i,n]of Object.entries(this.buffers)){const{buffer:o,byteLength:d,byteOffset:p}=this._getBufferRange(n);this._bindBuffer(Number(i),o,p,d)}}_unbindBuffers(){for(const i in this.buffers)this.gl.bindBufferBase(35982,Number(i),null)}_bindBuffer(i,n,o=0,d){const p=n&&n.handle;!p||d===void 0?this.gl.bindBufferBase(35982,i,p):this.gl.bindBufferRange(35982,i,p,o,d)}}function tT(t){return typeof t=="number"?Number.isInteger(t):/^\d+$/.test(t)}class j4 extends o0{constructor(i,n){super(i,n);Y(this,"device");Y(this,"handle");Y(this,"_timestampPairs",[]);Y(this,"_pendingReads",new Set);Y(this,"_occlusionQuery",null);Y(this,"_occlusionActive",!1);if(this.device=i,n.type==="timestamp"){if(n.count<2)throw new Error("Timestamp QuerySet requires at least two query slots");this._timestampPairs=new Array(Math.ceil(n.count/2)).fill(null).map(()=>({activeQuery:null,completedQueries:[]})),this.handle=null}else{if(n.count>1)throw new Error("WebGL occlusion QuerySet can only have one value");const o=this.device.gl.createQuery();if(!o)throw new Error("WebGL query not supported");this.handle=o}Object.seal(this)}get[Symbol.toStringTag](){return"QuerySet"}destroy(){if(!this.destroyed){this.handle&&this.device.gl.deleteQuery(this.handle);for(const i of this._timestampPairs){i.activeQuery&&(this._cancelPendingQuery(i.activeQuery),this.device.gl.deleteQuery(i.activeQuery.handle));for(const n of i.completedQueries)this._cancelPendingQuery(n),this.device.gl.deleteQuery(n.handle)}this._occlusionQuery&&(this._cancelPendingQuery(this._occlusionQuery),this.device.gl.deleteQuery(this._occlusionQuery.handle));
vendor: 4,038 bytes, line 2154
2154for(const i of Array.from(this._pendingReads))this._cancelPendingQuery(i);this.destroyResource()}}isResultAvailable(i){return this.props.type==="timestamp"?i===void 0?this._timestampPairs.some((n,o)=>this._isTimestampPairAvailable(o)):this._isTimestampPairAvailable(this._getTimestampPairIndex(i)):this._occlusionQuery?this._pollQueryAvailability(this._occlusionQuery):!1}async readResults(i){const n=(i==null?void 0:i.firstQuery)||0,o=(i==null?void 0:i.queryCount)||this.props.count-n;if(this._validateRange(n,o),this.props.type==="timestamp"){const d=new Array(o).fill(0n),p=Math.floor(n/2),h=Math.floor((n+o-1)/2);for(let A=p;A<=h;A++){const R=await this._consumeTimestampPairResult(A),B=A*2,N=B+1;B>=n&&B<n+o&&(d[B-n]=0n),N>=n&&N<n+o&&(d[N-n]=R)}return d}if(!this._occlusionQuery)throw new Error("Occlusion query has not been started");return[await this._consumeQueryResult(this._occlusionQuery)]}async readTimestampDuration(i,n){if(this.props.type!=="timestamp")throw new Error("Timestamp durations require a timestamp QuerySet");if(i<0||n>=this.props.count||n<=i)throw new Error("Timestamp duration range is out of bounds");if(i%2!==0||n!==i+1)throw new Error("WebGL timestamp durations require adjacent even/odd query indices");const o=await this._consumeTimestampPairResult(this._getTimestampPairIndex(i));return Number(o)/1e6}beginOcclusionQuery(){if(this.props.type!=="occlusion")throw new Error("Occlusion queries require an occlusion QuerySet");if(!this.handle)throw new Error("WebGL occlusion query is not available");if(this._occlusionActive)throw new Error("Occlusion query is already active");this.device.gl.beginQuery(35887,this.handle),this._occlusionQuery={handle:this.handle,promise:null,result:null,disjoint:!1,cancelled:!1,pollRequestId:null,resolve:null,reject:null},this._occlusionActive=!0}endOcclusionQuery(){if(!this._occlusionActive)throw new Error("Occlusion query is not active");this.device.gl.endQuery(35887),this._occlusionActive=!1}writeTimestamp(i){if(this.props.type!=="timestamp")throw new Error("Timestamp writes require a timestamp QuerySet");const n=this._getTimestampPairIndex(i),o=this._timestampPairs[n];if(i%2===0){if(o.activeQuery)throw new Error("Timestamp query pair is already active");const d=this.device.gl.createQuery();if(!d)throw new Error("WebGL query not supported");const p={handle:d,promise:null,result:null,disjoint:!1,cancelled:!1,pollRequestId:null,resolve:null,reject:null};this.device.gl.beginQuery(35007,d),o.activeQuery=p;return}if(!o.activeQuery)throw new Error("Timestamp query pair was ended before it was started");this.device.gl.endQuery(35007),o.completedQueries.push(o.activeQuery),o.activeQuery=null}_validateRange(i,n){if(i<0||n<0||i+n>this.props.count)throw new Error("Query read range is out of bounds")}_getTimestampPairIndex(i){if(i<0||i>=this.props.count)throw new Error("Query index is out of bounds");return Math.floor(i/2)}_isTimestampPairAvailable(i){const n=this._timestampPairs[i];return!n||n.completedQueries.length===0?!1:this._pollQueryAvailability(n.completedQueries[0])}_pollQueryAvailability(i){if(i.cancelled||this.destroyed)return i.result=0n,!0;if(i.result!==null||i.disjoint)return!0;if(!this.device.gl.getQueryParameter(i.handle,34919))return!1;const o=!!this.device.gl.getParameter(36795);return i.disjoint=o,i.result=o?0n:BigInt(this.device.gl.getQueryParameter(i.handle,34918)),!0}async _consumeTimestampPairResult(i){const n=this._timestampPairs[i];if(!n||n.completedQueries.length===0)throw new Error("Timestamp query pair has no completed result");const o=n.completedQueries.shift();try{return await this._consumeQueryResult(o)}finally{this.device.gl.deleteQuery(o.handle)}}_consumeQueryResult(i){return i.promise||(this._pendingReads.add(i),i.promise=new Promise((n,o)=>{i.resolve=n,i.reject=o;const d=()=>{if(i.pollRequestId=null,i.cancelled||this.destroyed){this._pendingReads.delete(i),i.promise=null,i.resolve=null,i.reject=null,n(0n);return}if(!this._pollQueryAvailability(i)){i.pollRequestId=this._requestAnimationFrame(d);return}
2154this._pendingReads.delete(i),i.promise=null,i.resolve=null,i.reject=null,i.disjoint?o(new Error("GPU timestamp query was invalidated by a disjoint event")):n(i.result||0n)};d()})),i.promise}_cancelPendingQuery(i){if(this._pendingReads.delete(i),i.cancelled=!0,i.pollRequestId!==null&&(this._cancelAnimationFrame(i.pollRequestId),i.pollRequestId=null),i.resolve){const n=i.resolve;i.promise=null,i.resolve=null,i.reject=null,n(0n)}}_requestAnimationFrame(i){return requestAnimationFrame(i)}_cancelAnimationFrame(i){cancelAnimationFrame(i)}}class V4 extends l0{constructor(i,n={}){super(i,{});Y(this,"device");Y(this,"gl");Y(this,"handle");Y(this,"signaled");Y(this,"_signaled",!1);this.device=i,this.gl=i.gl;const o=this.props.handle||this.gl.fenceSync(this.gl.SYNC_GPU_COMMANDS_COMPLETE,0);if(!o)throw new Error("Failed to create WebGL fence");this.handle=o,this.signaled=new Promise(d=>{const p=()=>{const h=this.gl.clientWaitSync(this.handle,0,0);h===this.gl.ALREADY_SIGNALED||h===this.gl.CONDITION_SATISFIED?(this._signaled=!0,d()):setTimeout(p,1)};p()})}isSignaled(){if(this._signaled)return!0;const i=this.gl.getSyncParameter(this.handle,this.gl.SYNC_STATUS);return this._signaled=i===this.gl.SIGNALED,this._signaled}destroy(){this.destroyed||this.gl.deleteSync(this.handle)}}function fA(t){switch(t){case 6406:case 33326:case 6403:case 36244:return 1;case 33339:case 33340:case 33328:case 33320:case 33319:return 2;case 6407:case 36248:case 34837:return 3;case 6408:case 36249:case 34836:return 4;default:return 0}}function $4(t){switch(t){case 5121:return 1;case 33635:case 32819:case 32820:return 2;case 5126:return 4;default:return 0}}function H4(t,e){var we;const{sourceX:i=0,sourceY:n=0,sourceAttachment:o=0}=e||{};let{target:d=null,sourceWidth:p,sourceHeight:h,sourceDepth:A,sourceFormat:R,sourceType:B}=e||{};const{framebuffer:N,deleteFramebuffer:F}=pA(t),{gl:Q,handle:re}=N;p||(p=N.width),h||(h=N.height);const se=(we=N.colorAttachments[o])==null?void 0:we.texture;if(!se)throw new Error(`Invalid framebuffer attachment ${o}`);A=(se==null?void 0:se.depth)||1,R||(R=(se==null?void 0:se.glFormat)||6408),B||(B=(se==null?void 0:se.glType)||5121),d=q4(d,B,R,p,h);const ae=$c.getDataType(d);B=B||v4(ae);const me=Q.bindFramebuffer(36160,re);return Q.readBuffer(36064+o),Q.readPixels(i,n,p,h,R,B,d),Q.readBuffer(36064),Q.bindFramebuffer(36160,me||null),F&&N.destroy(),d}function W4(t,e){const{target:i,sourceX:n=0,sourceY:o=0,sourceFormat:d=6408,targetByteOffset:p=0}=e||{};let{sourceWidth:h,sourceHeight:A,sourceType:R}=e||{};const{framebuffer:B,deleteFramebuffer:N}=pA(t);h=h||B.width,A=A||B.height;const F=B;R=R||5121;let Q=i;if(!Q){const se=fA(d),ae=$4(R),me=p+h*A*se*ae;Q=F.device.createBuffer({byteLength:me})}const re=t.device.createCommandEncoder();return re.copyTextureToBuffer({sourceTexture:t,width:h,height:A,origin:[n,o],destinationBuffer:Q,byteOffset:p}),re.destroy(),N&&B.destroy(),Q}function pA(t){return t instanceof Sy?{framebuffer:t,deleteFramebuffer:!1}:{framebuffer:X4(t),deleteFramebuffer:!0}}function X4(t,e){const{device:i,width:n,height:o,id:d}=t;return i.createFramebuffer({...e,id:`framebuffer-for-${d}`,width:n,height:o,colorAttachments:[t]})}function q4(t,e,i,n,o,d){if(t)return t;e||(e=5121);const p=lA(e),h=$c.getTypedArrayConstructor(p),A=fA(i);return new h(n*o*A)}class Md extends Id{constructor(i){var N;super({...i,id:i.id||KN("webgl-device")});Y(this,"type","webgl");Y(this,"handle");Y(this,"features");Y(this,"limits");Y(this,"info");Y(this,"canvasContext");Y(this,"preferredColorFormat","rgba8unorm");
2154Y(this,"preferredDepthFormat","depth24plus");Y(this,"commandEncoder");Y(this,"lost");Y(this,"_resolveContextLost");Y(this,"gl");Y(this,"_constants");Y(this,"extensions");Y(this,"_polyfilled",!1);Y(this,"spectorJS");const n=Id._getCanvasContextProps(i);if(!n)throw new Error("WebGLDevice requires props.createCanvasContext to be set");const o=((N=n.canvas)==null?void 0:N.gl)??null;let d=Md.getDeviceFromContext(o);if(d)throw new Error(`WebGL context already attached to device ${d.id}`);this.canvasContext=new YN(this,n),this.lost=new Promise(F=>{this._resolveContextLost=F});const p={...i.webgl};n.alphaMode==="premultiplied"&&(p.premultipliedAlpha=!0),i.powerPreference!==void 0&&(p.powerPreference=i.powerPreference),i.failIfMajorPerformanceCaveat!==void 0&&(p.failIfMajorPerformanceCaveat=i.failIfMajorPerformanceCaveat);const A=this.props._handle||CN(this.canvasContext.canvas,{onContextLost:F=>{var Q;return(Q=this._resolveContextLost)==null?void 0:Q.call(this,{reason:"destroyed",message:"Entered sleep mode, or too many apps or browser tabs are using the GPU."})},onContextRestored:F=>console.log("WebGL context restored")},p);if(!A)throw new Error("WebGL context creation failed");if(d=Md.getDeviceFromContext(A),d){if(i._reuseDevices)return at.log(1,`Not creating a new Device, instead returning a reference to Device ${d.id} already attached to WebGL context`,d)(),this.canvasContext.destroy(),d._reused=!0,d;throw new Error(`WebGL context already attached to device ${d.id}`)}this.handle=A,this.gl=A,this.spectorJS=cN({...this.props,gl:this.handle});const R=Py(this.handle);R.device=this,R.extensions||(R.extensions={}),this.extensions=R.extensions,this.info=RN(this.gl,this.extensions),this.limits=new XN(this.gl),this.features=new WN(this.gl,this.extensions,this.props._disabledFeatures),this.props._initializeFeatures&&this.features.initializeFeatures(),new Cd(this.gl,{log:(...F)=>at.log(1,...F)()}).trackState(this.gl,{copyState:!1}),(i.debug||i.debugWebGL)&&(this.gl=dN(this.gl,{debugWebGL:!0,traceWebGL:i.debugWebGL}),at.warn("WebGL debug mode activated. Performance reduced.")()),i.debugWebGL&&(at.level=Math.max(at.level,1)),this.commandEncoder=new eT(this,{id:`${this}-command-encoder`}),this.canvasContext._startObservers()}static getDeviceFromContext(i){var n;return i?((n=i.luma)==null?void 0:n.device)??null:null}get[Symbol.toStringTag](){return"WebGLDevice"}toString(){return`${this[Symbol.toStringTag]}(${this.id})`}isVertexFormatSupported(i){switch(i){case"unorm8x4-bgra":return!1;default:return!0}}destroy(){var i;if((i=this.commandEncoder)==null||i.destroy(),!this.props._reuseDevices&&!this._reused){const n=Py(this.handle);n.device=null}}get isLost(){return this.gl.isContextLost()}createCanvasContext(i){throw new Error("WebGL only supports a single canvas")}createPresentationContext(i){return new GN(this,i||{})}createBuffer(i){const n=this._normalizeBufferProps(i);return new rg(this,n)}createTexture(i){return new sg(this,i)}createExternalTexture(i){throw new Error("createExternalTexture() not implemented")}createSampler(i){return new l4(this,i)}createShader(i){return new t4(this,i)}createFramebuffer(i){return new ng(this,i)}createVertexArray(i){return new vx(this,i)}createTransformFeedback(i){return new U4(this,i)}createQuerySet(i){return new j4(this,i)}createFence(){return new V4(this)}createRenderPipeline(i){return new _4(this,i)}_createSharedRenderPipelineWebGL(i){return new M4(this,i)}createComputePipeline(i){throw new Error("ComputePipeline not supported in WebGL")}createCommandEncoder(i={}){return new eT(this,i)}submit(i){let n=null;i||({submittedCommandEncoder:n,commandBuffer:i}=this._finalizeDefaultCommandEncoderForSubmit());try{i._executeCommands(),n&&n.resolveTimeProfilingQuerySet().then(()=>{this.commandEncoder._gpuTimeMs=n._gpuTimeMs}).catch(()=>{})}finally{i.destroy()}}_finalizeDefaultCommandEncoderForSubmit(){const i=this.commandEncoder,n=i.finish();return this.commandEncoder.destroy(),this.commandEncoder=this.createCommandEncoder({id:i.props.id,timeProfilingQuerySet:i.getTimeProfilingQuerySet()}),{submittedCommandEncoder:i,commandBuffer:n}}readPixelsToArrayWebGL(i,n){return H4(i,n)}readPixelsToBufferWebGL(i,n){return W4(i,n)}setParametersWebGL(i){Ep(this.gl,i)}getParametersWebGL(i){return eA(this.gl,i)}withParametersWebGL(i,n){return wd(this.gl,i,n)}resetWebGL(){at.warn("WebGLDevice.resetWebGL is deprecated, use only for debugging")(),wN(this.gl)}_getDeviceSpecificTextureFormatCapabilities(i){return UN(this.gl,i,this.extensions)}loseDevice(){var d;let i=!1;const o=this.getExtension("WEBGL_lose_context").WEBGL_lose_context;return o&&(i=!0,o.loseContext()),(d=this._resolveContextLost)==null||d.call(this,{reason:"destroyed",message:"Application triggered context loss"}),i}pushState(){Cd.get(this.gl).push()}popState(){Cd.get(this.gl).pop()}getGLKey(i,n){const o=Number(i);for(const d in this.gl)if(this.gl[d]===o)return`GL.${d}`;return n!=null&&n.emptyIfUnknown?"":String(i)}getGLKeys(i){const n={emptyIfUnknown:!0};return Object.entries(i).reduce((o,[d,p])=>(o[`${d}:${this.getGLKey(d,n)}`]=`${p}:${this.getGLKey(p,n)}`,o),{})}setConstantAttributeWebGL(i,n){const o=this.limits.maxVertexAttributes;this._constants=this._constants||new Array(o).fill(null);const d=this._constants[i];switch(d&&K4(d,n)&&at.info(1,`setConstantAttributeWebGL(${i}) could have been skipped, value unchanged`)(),this._constants[i]=n,n.constructor){case Float32Array:Z4(this,i,n);break;case Int32Array:Y4(this,i,n);break;case Uint32Array:G4(this,i,n);break;default:throw new Error("constant")}}getExtension(i){return Od(this.gl,i,this.extensions),this.extensions}_setWebGLDebugMetadata(i,n,o){i.luma=n;const d={props:o.spector,id:o.spector.id};i.__SPECTOR_Metadata=d}}function Z4(t,e,i){switch(i.length){case 1:t.gl.vertexAttrib1fv(e,i);break;case 2:t.gl.vertexAttrib2fv(e,i);break;case 3:t.gl.vertexAttrib3fv(e,i);break;case 4:t.gl.vertexAttrib4fv(e,i);break}}function Y4(t,e,i){t.gl.vertexAttribI4iv(e,i)}function G4(t,e,i){t.gl.vertexAttribI4uiv(e,i)}function K4(t,e){if(!t||!e||t.length!==e.length||t.constructor!==e.constructor)return!1;for(let i=0;i<t.length;++i)if(t[i]!==e[i])return!1;return!0}const iT=Object.freeze(Object.defineProperty({__proto__:null,WebGLDevice:Md},Symbol.toStringTag,{value:"Module"}));function Fc(){}const Q4=({isDragging:t})=>t?"grabbing":"grab",mA={id:"",width:"100%",height:"100%",style:null,viewState:null,initialViewState:null,pickingRadius:0,pickAsync:"auto",layerFilter:null,parameters:{},parent:null,device:null,deviceProps:{},gl:null,canvas:null,layers:[],effects:[],views:null,controller:null,useDevicePixels:!0,touchAction:"none",eventRecognizerOptions:{},_framebuffer:null,_animate:!1,_pickable:!0,_typedArrayManagerProps:{},_customRender:null,widgets:[],onDeviceInitialized:Fc,onWebGLInitialized:Fc,onResize:Fc,onViewStateChange:Fc,onInteractionStateChange:Fc,onBeforeRender:Fc,onAfterRender:Fc,onLoad:Fc,onError:t=>On.error(t.message,t.cause)(),onHover:null,onClick:null,onDragStart:null,onDrag:null,onDragEnd:null,_onMetrics:null,getCursor:Q4,getTooltip:null,debug:!1,drawPickingColors:!1};class bx{constructor(e){this.width=0,this.height=0,this.userData={},this.device=null,this.canvas=null,this.viewManager=null,this.layerManager=null,this.effectManager=null,this.deckRenderer=null,this.deckPicker=null,this.eventManager=null,this.widgetManager=null,this.tooltip=null,this.animationLoop=null,this._canvasContext=null,this._deviceResizeHandler=null,this.cursorState={isHovering:!1,isDragging:!1},this.stats=new sv({id:"deck.gl"}),this.metrics={fps:0,setPropsTime:0,layersCount:0,drawLayersCount:0,updateLayersCount:0,updateAttributesCount:0,updateAttributesTime:0,framesRedrawn:0,pickTime:0,pickCount:0,pickLayersCount:0,gpuTime:0,gpuTimePerFrame:0,cpuTime:0,cpuTimePerFrame:0,bufferMemory:0,textureMemory:0,renderbufferMemory:0,gpuMemory:0},this._metricsCounter=0,this._hoverPickSequence=0,this._pointerDownPickSequence=0,this._needsRedraw="Initial render",this._pickRequest={mode:"hover",x:-1,y:-1,radius:0,event:null,unproject3D:!1},this._lastPointerDownInfo=null,this._lastPointerDownInfoPromise=null,this._onPointerMove=o=>{const{_pickRequest:d}=this;if(o.type==="pointerleave")d.x=-1,d.y=-1,d.radius=0;else{if(o.leftButton||o.rightButton)return;{const p=o.offsetCenter;if(!p)return;d.x=p.x,d.y=p.y,d.radius=this.props.pickingRadius}}this.layerManager&&(this.layerManager.context.mousePosition={x:d.x,y:d.y}),d.event=o},this._onEvent=o=>{const d=ay[o.type],p=o.offsetCenter;
2154if(!d||!p||!this.layerManager)return;const h=this.layerManager.getLayers(),A=this._getInternalPickingMode();if(!A)return;if(A==="sync"){const B=o.type==="click"&&this._shouldUnproject3D(h)?this._getFirstPickedInfo(this._pickPointSync(this._getPointPickOptions(p.x,p.y,{unproject3D:!0},h))):this._getLastPointerDownPickingInfo(p.x,p.y,h);this._dispatchPickingEvent(B,o);return}(this._lastPointerDownInfoPromise||Promise.resolve(this._getLastPointerDownPickingInfo(p.x,p.y,h))).then(B=>{this._dispatchPickingEvent(B,o)}).catch(B=>{var N,F;return(F=(N=this.props).onError)==null?void 0:F.call(N,B)})},this._onPointerDown=o=>{var B;const d=o.offsetCenter;if(!d)return;const p=this._getInternalPickingMode();if(!p)return;const h=((B=this.layerManager)==null?void 0:B.getLayers())||[],A=++this._pointerDownPickSequence;if(p==="sync"){const N=this._pickPointSync({x:d.x,y:d.y,radius:this.props.pickingRadius}),F=this._getFirstPickedInfo(N);this._lastPointerDownInfo=F,this._lastPointerDownInfoPromise=Promise.resolve(F);return}const R=this._pickPointAsync(this._getPointPickOptions(d.x,d.y,{},h)).then(N=>this._getFirstPickedInfo(N)).then(N=>(A===this._pointerDownPickSequence&&(this._lastPointerDownInfo=N),N)).catch(N=>{var Q,re;(re=(Q=this.props).onError)==null||re.call(Q,N);const F=this.deckPicker&&this.viewManager?this._getLastPointerDownPickingInfo(d.x,d.y,h):{};return A===this._pointerDownPickSequence&&(this._lastPointerDownInfo=F),F});this._lastPointerDownInfo=null,this._lastPointerDownInfoPromise=R};const i=e;this.props={...mA,...e},e=this.props,e.viewState&&e.initialViewState&&On.warn("View state tracking is disabled. Use either `initialViewState` for auto update or `viewState` for manual update.")(),this.viewState=this.props.initialViewState,e.device&&(this.device=e.device,this._setDeviceCanvasContext(e.device));let n=this.device;!n&&e.gl&&(e.gl instanceof WebGLRenderingContext&&On.error("WebGL1 context not supported.")(),n=gb.attach(e.gl,{_cacheShaders:!0,_cachePipelines:!0,...this.props.deviceProps})),n||(n=this._createDevice(e)),this.animationLoop=this._createAnimationLoop(n,e),this.setProps(i),e._typedArrayManagerProps&&dp.setOptions(e._typedArrayManagerProps),this.animationLoop.start()}finalize(){var e,i,n,o,d,p,h,A,R,B;this._restoreDeviceResizeHandler(),(e=this.animationLoop)==null||e.stop(),(i=this.animationLoop)==null||i.destroy(),this.animationLoop=null,this._hoverPickSequence++,this._pointerDownPickSequence++,this._lastPointerDownInfo=null,this._lastPointerDownInfoPromise=null,(n=this.layerManager)==null||n.finalize(),this.layerManager=null,(o=this.viewManager)==null||o.finalize(),this.viewManager=null,(d=this.effectManager)==null||d.finalize(),this.effectManager=null,(p=this.deckRenderer)==null||p.finalize(),this.deckRenderer=null,(h=this.deckPicker)==null||h.finalize(),this.deckPicker=null,(A=this.eventManager)==null||A.destroy(),this.eventManager=null,(R=this.widgetManager)==null||R.finalize(),this.widgetManager=null,!this.props.canvas&&!this.props.device&&!this.props.gl&&this.canvas&&((B=this.canvas.parentElement)==null||B.removeChild(this.canvas),this.canvas=null),this._canvasContext=null}setProps(e){var n,o,d,p,h,A;this.stats.get("setProps Time").timeStart(),"onLayerHover"in e&&On.removed("onLayerHover","onHover")(),"onLayerClick"in e&&On.removed("onLayerClick","onClick")(),e.initialViewState&&!Xa(this.props.initialViewState,e.initialViewState,3)&&(this.viewState=e.initialViewState),Object.assign(this.props,e),this._validateInternalPickingMode(),this._setCanvasSize(this.props);const i=Object.create(this.props);if(Object.assign(i,{views:this._getViews(),width:this.width,height:this.height,viewState:this._getViewState()}),e.device&&e.device.id!==((n=this.device)==null?void 0:n.id)){const R=e.device.getDefaultCanvasContext();(o=this.animationLoop)==null||o.stop(),this.canvas!==R.canvas&&((d=this.canvas)==null||d.remove(),(p=this.eventManager)==null||p.destroy(),this.canvas=null),this._setDeviceCanvasContext(e.device),On.log(`recreating animation loop for new device! id=${e.device.id}`)(),this.animationLoop=this._createAnimationLoop(e.device,e),this.animationLoop.start()}(h=this.animationLoop)==null||h.setProps(i),e.useDevicePixels!==void 0&&((A=this._canvasContext)!=null&&A.setProps)&&this._canvasContext.setProps({useDevicePixels:e.useDevicePixels}),this.layerManager&&(this.viewManager.setProps(i),this.layerManager.activateViewport(this.getViewports()[0]),this.layerManager.setProps(i),this.effectManager.setProps(i),this.deckRenderer.setProps(i),this.deckPicker.setProps(i),this.widgetManager.setProps(i)),this.stats.get("setProps Time").timeEnd()}needsRedraw(e={clearRedrawFlags:!1}){if(!this.layerManager)return!1;if(this.props._animate)return"Deck._animate";let i=this._needsRedraw;e.clearRedrawFlags&&(this._needsRedraw=!1);const n=this.viewManager.needsRedraw(e),o=this.layerManager.needsRedraw(e),d=this.effectManager.needsRedraw(e),p=this.deckRenderer.needsRedraw(e);return i=i||n||o||d||p,i}redraw(e){if(!this.layerManager)return;let i=this.needsRedraw({clearRedrawFlags:!0});i=e||i,i&&(this.stats.get("Redraw Count").incrementCount(),this.props._customRender?this.props._customRender(i):this._drawLayers(i))}get isInitialized(){return this.viewManager!==null}getViews(){return fs(this.viewManager),this.viewManager.views}getView(e){return fs(this.viewManager),this.viewManager.getView(e)}getViewports(e){return fs(this.viewManager),this.viewManager.getViewports(e)}getCanvas(){return this.canvas}async pickObjectAsync(e){const i=(await this._pickAsync("pickObjectAsync","pickObject Time",e)).result;return i.length?i[0]:null}async pickObjectsAsync(e){return await this._pickAsync("pickObjectsAsync","pickObjects Time",e)}
2154pickObject(e){const i=this._pick("pickObject","pickObject Time",e).result;return i.length?i[0]:null}pickMultipleObjects(e){return e.depth=e.depth||10,this._pick("pickObject","pickMultipleObjects Time",e).result}pickObjects(e){return this._pick("pickObjects","pickObjects Time",e)}_pickPositionForController(e,i){return this._getInternalPickingMode()!=="sync"?null:this.pickObject({x:e,y:i,radius:0,unproject3D:!0})}_addResources(e,i=!1){for(const n in e)this.layerManager.resourceManager.add({resourceId:n,data:e[n],forceUpdate:i})}_removeResources(e){for(const i of e)this.layerManager.resourceManager.remove(i)}_addDefaultEffect(e){this.effectManager.addDefaultEffect(e)}_addDefaultShaderModule(e){this.layerManager.addDefaultShaderModule(e)}_removeDefaultShaderModule(e){var i;(i=this.layerManager)==null||i.removeDefaultShaderModule(e)}_resolveInternalPickingMode(){var n,o;const{pickAsync:e}=this.props,i=((n=this.device)==null?void 0:n.type)||((o=this.props.deviceProps)==null?void 0:o.type);if(e==="auto")return i==="webgpu"?"async":"sync";if(e==="sync"&&i==="webgpu")throw new Error('`pickAsync: "sync"` is not supported when Deck is using a WebGPU device.');return e}_getInternalPickingMode(){var e,i;try{return this._resolveInternalPickingMode()}catch(n){return(i=(e=this.props).onError)==null||i.call(e,n),null}}_validateInternalPickingMode(){this._getInternalPickingMode()}_getFirstPickedInfo({result:e,emptyInfo:i}){return e[0]||i}_shouldUnproject3D(e=(i=>(i=this.layerManager)==null?void 0:i.getLayers())()||[]){return e.some(n=>n.props.pickable==="3d")}_getPointPickOptions(e,i,n={},o=(d=>(d=this.layerManager)==null?void 0:d.getLayers())()||[]){return{x:e,y:i,radius:this.props.pickingRadius,unproject3D:this._shouldUnproject3D(o),...n}}_pickPointSync(e){return this._pick("pickObject","pickObject Time",e)}_pickPointAsync(e){return this._pickAsync("pickObjectAsync","pickObject Time",e)}_getLastPointerDownPickingInfo(e,i,n=(o=>(o=this.layerManager)==null?void 0:o.getLayers())()||[]){return this.deckPicker.getLastPickedObject({x:e,y:i,layers:n,viewports:this.getViewports({x:e,y:i})},this._lastPointerDownInfo)}_applyHoverCallbacks({result:e,emptyInfo:i},n){var p,h,A;if(!this.widgetManager)return;this.cursorState.isHovering=e.length>0;let o=i,d=!1;for(const R of e)o=R,d=((p=R.layer)==null?void 0:p.onHover(R,n))||d;d||((A=(h=this.props).onHover)==null||A.call(h,o,n),this.widgetManager.onHover(o,n))}_dispatchPickingEvent(e,i){if(!this.layerManager||!this.widgetManager)return;const n=ay[i.type];if(!n)return;const{layer:o}=e,d=o&&(o[n]||o.props[n]),p=this.props[n];let h=!1;d&&(h=d.call(o,e,i)),h||(p==null||p(e,i),this.widgetManager.onEvent(e,i))}_pickAsync(e,i,n){fs(this.deckPicker);const{stats:o}=this;o.get("Pick Count").incrementCount(),o.get(i).timeStart();const d=this.deckPicker[e]({layers:this.layerManager.getLayers(n),views:this.viewManager.getViews(),viewports:this.getViewports(n),onViewportActive:this.layerManager.activateViewport,effects:this.effectManager.getEffects(),...n,canvasContext:this._canvasContext||void 0});return o.get(i).timeEnd(),d}_pick(e,i,n){fs(this.deckPicker);const{stats:o}=this;o.get("Pick Count").incrementCount(),o.get(i).timeStart();const d=this.deckPicker[e]({layers:this.layerManager.getLayers(n),views:this.viewManager.getViews(),viewports:this.getViewports(n),onViewportActive:this.layerManager.activateViewport,effects:this.effectManager.getEffects(),...n,canvasContext:this._canvasContext||void 0});return o.get(i).timeEnd(),d}_createCanvas(e){let i=e.canvas;return typeof i=="string"&&(i=document.getElementById(i),fs(i)),i||(i=document.createElement("canvas"),i.id=e.id||"deckgl-overlay",e.width&&typeof e.width=="number"&&(i.width=e.width),e.height&&typeof e.height=="number"&&(i.height=e.height),(e.parent||document.body).appendChild(i)),Object.assign(i.style,e.style),i}_setCanvasContext(e){this._canvasContext=e,"style"in e.canvas&&(this.canvas=e.canvas)}_setDeviceCanvasContext(e,i={}){const n=e.getDefaultCanvasContext();this._setCanvasContext(n),this._setDeviceResizeHandler(e,i)}_setDeviceResizeHandler(e,i={}){var d;const n=!!i.syncDrawingBuffer;if(((d=this._deviceResizeHandler)==null?void 0:d.device)===e){this._deviceResizeHandler.syncDrawingBuffer=n;return}this._restoreDeviceResizeHandler();const o=p=>{var h;p===this._canvasContext&&this._canvasContext&&this._onCanvasContextResize(this._canvasContext,{syncDrawingBuffer:(h=this._deviceResizeHandler)==null?void 0:h.syncDrawingBuffer})};e.props.onResize=o,this._deviceResizeHandler={device:e,onResize:o,syncDrawingBuffer:n}}_restoreDeviceResizeHandler(){var i;const e=this._deviceResizeHandler;e&&((i=e.device.props)==null?void 0:i.onResize)===e.onResize&&(e.device.props.onResize=Fc),this._deviceResizeHandler=null}_setCanvasSize(e){var o;if(!this.canvas)return;const{width:i,height:n}=e;if(i||i===0){const d=Number.isFinite(i)?`${i}px`:i;this.canvas.style.width=d}if(n||n===0){const d=Number.isFinite(n)?`${n}px`:n;this.canvas.style.position=((o=e.style)==null?void 0:o.position)||"absolute",this.canvas.style.height=d}}_updateCanvasSize(e=this._canvasContext){var d,p;const{canvas:i}=this,[n,o]=e?e.getCSSSize():[(i==null?void 0:i.clientWidth)??(i==null?void 0:i.width)??0,(i==null?void 0:i.clientHeight)??(i==null?void 0:i.height)??0];(n!==this.width||o!==this.height)&&(this.width=n,this.height=o,(d=this.viewManager)==null||d.setProps({width:n,height:o}),(p=this.layerManager)==null||p.activateViewport(this.getViewports()[0]),this.props.onResize({width:n,height:o},e||void 0))}_onCanvasContextResize(e,i={}){if(i.syncDrawingBuffer){const{width:n,height:o}=e.canvas;e.setDrawingBufferSize(n,o)}this._needsRedraw="Canvas resized",this._updateCanvasSize(e)}_createAnimationLoop(e,i){const{gl:n,onError:o}=i;return new _0({device:e,autoResizeDrawingBuffer:!n,autoResizeViewport:!1,onInitialize:d=>this._setDevice(d.device),onRender:this._onRenderFrame.bind(this),onError:o})}_createDevice(e){var p,h;const i=(p=this.props.deviceProps)==null?void 0:p.createCanvasContext,n=typeof i=="object"?i:void 0,o={adapters:[],_cacheShaders:!0,_cachePipelines:!0,...e.deviceProps};o.adapters.includes(gb)||o.adapters.push(gb);const d={alphaMode:((h=this.props.deviceProps)==null?void 0:h.type)==="webgpu"?"premultiplied":void 0};
2154return Jb.createDevice({_reuseDevices:!0,type:"webgl",...o,createCanvasContext:{...d,...n,canvas:this._createCanvas(e),useDevicePixels:this.props.useDevicePixels,autoResize:!0}})}_getViewState(){return this.props.viewState||this.viewState}_getViews(){const{views:e}=this.props,i=Array.isArray(e)?e:e?[e]:[new G2({id:"default-view"})];return i.length&&this.props.controller&&(i[0].props.controller=this.props.controller),i}_onContextLost(){const{onError:e}=this.props;this.animationLoop&&e&&e(new Error("WebGL context is lost"))}_pickAndCallback(){var i;const{_pickRequest:e}=this;if(e.event){const n=e.event,o=((i=this.layerManager)==null?void 0:i.getLayers())||[],d=this._getPointPickOptions(e.x,e.y,{radius:e.radius,mode:e.mode},o),p=this._getInternalPickingMode(),h=++this._hoverPickSequence;if(e.event=null,!p)return;if(p==="sync"){this._applyHoverCallbacks(this._pickPointSync(d),n);return}this._pickPointAsync(d).then(({result:A,emptyInfo:R})=>{h===this._hoverPickSequence&&this._applyHoverCallbacks({result:A,emptyInfo:R},n)}).catch(A=>{var R,B;return(B=(R=this.props).onError)==null?void 0:B.call(R,A)})}}_updateCursor(){const e=this.props.parent||this.canvas;e&&(e.style.cursor=this.props.getCursor(this.cursorState))}_setDevice(e){var p,h,A;if(this.device=e,this._validateInternalPickingMode(),!this.animationLoop)return;this._setDeviceCanvasContext(e,{syncDrawingBuffer:!!(this.props.gl&&this.props.device!==e)}),this.canvas&&!this.canvas.isConnected&&this.props.parent&&this.props.parent.insertBefore(this.canvas,this.props.parent.firstChild),this.device.type==="webgl"&&this.device.setParametersWebGL({blend:!0,blendFunc:[770,771,1,771],polygonOffsetFill:!0,depthTest:!0,depthFunc:515}),this.props.onDeviceInitialized(this.device),this.device.type==="webgl"&&this.props.onWebGLInitialized(this.device.gl);const i=new k2;i.play(),this.animationLoop.attachTimeline(i);const n=((p=this.props.parent)==null?void 0:p.querySelector(".deck-events-root"))||this.canvas;this.eventManager=new lO(n,{touchAction:this.props.touchAction,recognizers:Object.keys(ow).map(R=>{var ae;const[B,N,F,Q]=ow[R],re=(ae=this.props.eventRecognizerOptions)==null?void 0:ae[R],se={...N,...re,event:R};return{recognizer:new B(se),recognizeWith:F,requireFailure:Q}}),events:{pointerdown:this._onPointerDown,pointermove:this._onPointerMove,pointerleave:this._onPointerMove}});for(const R in ay)this.eventManager.on(R,this._onEvent);this.viewManager=new yB({timeline:i,eventManager:this.eventManager,onViewStateChange:this._onViewStateChange.bind(this),onInteractionStateChange:this._onInteractionStateChange.bind(this),pickPosition:this._pickPositionForController.bind(this),views:this._getViews(),viewState:this._getViewState(),width:this.width,height:this.height});const o=this.viewManager.getViewports()[0];this.layerManager=new _B(this.device,{deck:this,stats:this.stats,viewport:o,timeline:i}),this.effectManager=new jB({deck:this,device:this.device}),this.deckRenderer=new HB(this.device,{stats:this.stats}),this.deckPicker=new qB(this.device,{stats:this.stats});const d=((h=this.props.parent)==null?void 0:h.querySelector(".deck-widgets-root"))||((A=this.canvas)==null?void 0:A.parentElement);this.widgetManager=new GB({deck:this,parentElement:d}),this.widgetManager.addDefault(new K2),this.setProps({}),this._updateCanvasSize(this._canvasContext),this.props.onLoad()}_drawLayers(e,i){var p;const{device:n,gl:o}=this.layerManager.context;this.props.onBeforeRender({device:n,gl:o});const d={target:this.props._framebuffer,layers:this.layerManager.getLayers(),viewports:this.viewManager.getViewports(),onViewportActive:this.layerManager.activateViewport,views:this.viewManager.getViews(),pass:"screen",effects:this.effectManager.getEffects(),...i};(p=this.deckRenderer)==null||p.renderLayers(d),d.pass==="screen"&&this.widgetManager.onRedraw({viewports:d.viewports,layers:d.layers}),this.props.onAfterRender({device:n,gl:o})}_onRenderFrame(){this._getFrameStats(),this._metricsCounter++%60===0&&(this._getMetrics(),this.stats.reset(),On.table(4,this.metrics)(),this.props._onMetrics&&this.props._onMetrics(this.metrics)),this._updateCursor(
vendor: 54,373 bytes, lines 2154-2234
2154),this.layerManager.updateLayers(),this._pickAndCallback(),this.redraw(),this.viewManager&&this.viewManager.updateViewStates()}_onViewStateChange(e){const i=this.props.onViewStateChange(e)||e.viewState;this.viewState&&(this.viewState={...this.viewState,[e.viewId]:i},this.props.viewState||this.viewManager&&this.viewManager.setProps({viewState:this.viewState}))}_onInteractionStateChange(e){this.cursorState.isDragging=e.isDragging||!1,this.props.onInteractionStateChange(e)}_getFrameStats(){const{stats:e}=this;e.get("frameRate").timeEnd(),e.get("frameRate").timeStart();const i=this.animationLoop.stats;e.get("GPU Time").addTime(i.get("GPU Time").lastTiming),e.get("CPU Time").addTime(i.get("CPU Time").lastTiming)}_getMetrics(){var o;const{metrics:e,stats:i}=this;e.fps=i.get("frameRate").getHz(),e.setPropsTime=i.get("setProps Time").time,e.updateAttributesTime=i.get("Update Attributes").time,e.framesRedrawn=i.get("Redraw Count").count,e.pickTime=i.get("pickObject Time").time+i.get("pickMultipleObjects Time").time+i.get("pickObjects Time").time,e.pickCount=i.get("Pick Count").count,e.layersCount=((o=this.layerManager)==null?void 0:o.layers.length)??0,e.drawLayersCount=i.get("Layers rendered").lastSampleCount,e.pickLayersCount=i.get("Layers picked").lastSampleCount,e.updateAttributesCount=i.get("Layers updated").count,e.updateAttributesCount=i.get("Attributes updated").count,e.gpuTime=i.get("GPU Time").time,e.cpuTime=i.get("CPU Time").time,e.gpuTimePerFrame=i.get("GPU Time").getAverageTime(),e.cpuTimePerFrame=i.get("CPU Time").getAverageTime();const n=Jb.stats.get("GPU Time and Memory");e.bufferMemory=n.get("Buffer Memory").count,e.textureMemory=n.get("Texture Memory").count,e.renderbufferMemory=n.get("Renderbuffer Memory").count,e.gpuMemory=n.get("GPU Memory").count}}bx.defaultProps=mA;bx.VERSION=JR;function J4(t){switch(t){case"float64":return Float64Array;case"uint8":case"unorm8":return Uint8ClampedArray;default:return l2(t)}}const ez=$c.getDataType.bind($c);function Y_(t,e,i){if(e.size>4)return null;const n=i==="webgpu"&&e.type==="uint8"?"unorm8":e.type;return{attribute:t,format:e.size>1?`${n}x${e.size}`:e.type,byteOffset:e.offset||0}}function Td(t){return t.stride||t.size*t.bytesPerElement}function tz(t,e){return t.type===e.type&&t.size===e.size&&Td(t)===Td(e)&&(t.offset||0)===(e.offset||0)}function M0(t,e){e.offset&&On.removed("shaderAttribute.offset","vertexOffset, elementOffset")();const i=Td(t),n=e.vertexOffset!==void 0?e.vertexOffset:t.vertexOffset||0,o=e.elementOffset||0,d=n*i+o*t.bytesPerElement+(t.offset||0);return{...e,offset:d,stride:i}}function iz(t,e){const i=M0(t,e);return{high:i,low:{...i,offset:i.offset+t.size*4}}}class nz{constructor(e,i,n){this._buffer=null,this.device=e,this.id=i.id||"",this.size=i.size||1;const o=i.logicalType||i.type,d=o==="float64";let{defaultValue:p}=i;p=Number.isFinite(p)?[p]:p||new Array(this.size).fill(0);let h;d?h="float32":!o&&i.isIndexed?h="uint32":h=o||"float32";let A=J4(o||h);this.doublePrecision=d,d&&i.fp64===!1&&(A=Float32Array),this.value=null,this.settings={...i,defaultType:A,defaultValue:p,logicalType:o,type:h,normalized:h.includes("norm"),size:this.size,bytesPerElement:A.BYTES_PER_ELEMENT},this.state={...n,externalBuffer:null,bufferAccessor:this.settings,allocatedValue:null,numInstances:0,bounds:null,constant:!1}}get isConstant(){return this.state.constant}get buffer(){return this._buffer}get byteOffset(){const e=this.getAccessor();return e.vertexOffset?e.vertexOffset*Td(e):0}get numInstances(){return this.state.numInstances}set numInstances(e){this.state.numInstances=e}delete(){this._buffer&&(this._buffer.delete(),this._buffer=null),dp.release(this.state.allocatedValue)}getBuffer(){return this.state.constant?null:this.state.externalBuffer||this._buffer}getValue(e=this.id,i=null){const n={};if(this.state.constant){const o=this.value;if(i){const d=M0(this.getAccessor(),i),p=d.offset/o.BYTES_PER_ELEMENT,h=d.size||this.size;n[e]=o.subarray(p,p+h)}else n[e]=o}else n[e]=this.getBuffer();return this.doublePrecision&&(this.value instanceof Float64Array?n[`${e}64Low`]=n[e]:n[`${e}64Low`]=new Float32Array(this.size)),n}_getBufferLayout(e=this.id,i=null){const n=this.getAccessor(),o=[],d={name:this.id,byteStride:Td(n)};if(this.doublePrecision){const p=iz(n,i||{});o.push(Y_(e,{...n,...p.high},this.device.type),Y_(`${e}64Low`,{...n,...p.low},this.device.type))}else if(i){const p=M0(n,i);o.push(Y_(e,{...n,...p},this.device.type))}else o.push(Y_(e,n,this.device.type));return d.attributes=o.filter(Boolean),d}setAccessor(e){this.state.bufferAccessor=e}getAccessor(){return this.state.bufferAccessor}getBounds(){if(this.state.bounds)return this.state.bounds;let e=null;if(this.state.constant&&this.value){const i=Array.from(this.value);e=[i,i]}else{const{value:i,numInstances:n,size:o}=this,d=n*o;if(i&&d&&i.length>=d){const p=new Array(o).fill(1/0),h=new Array(o).fill(-1/0);for(let A=0;A<d;)for(let R=0;R<o;R++){const B=i[A++];B<p[R]&&(p[R]=B),B>h[R]&&(h[R]=B)}e=[p,h]}}return this.state.bounds=e,e}setData(e){const{state:i}=this;let n;ArrayBuffer.isView(e)?n={value:e}:e instanceof En?n={buffer:e}:n=e;const o={...this.settings,...n};if(ArrayBuffer.isView(n.value)){if(!n.type)if(this.doublePrecision&&n.value instanceof Float64Array)o.type="float32";else{const p=ez(n.value);o.type=o.normalized?p.replace("int","norm"):p}o.bytesPerElement=n.value.BYTES_PER_ELEMENT,o.stride=Td(o)}if(i.bounds=null,n.constant){let d=n.value;if(d=this._normalizeValue(d,[],0),this.settings.normalized&&(d=this.normalizeConstant(d)),!(!i.constant||!this._areValuesEqual(d,this.value)))return!1;i.externalBuffer=null,i.constant=!0,this.value=ArrayBuffer.isView(d)?d:new Float32Array(d)}else if(n.buffer){const d=n.buffer;i.externalBuffer=d,i.constant=!1,this.value=n.value||null}else if(n.value){this._checkExternalBuffer(n);let d=n.value;i.externalBuffer=null,i.constant=!1,this.value=d;let{buffer:p}=this;const h=Td(o),A=(o.vertexOffset||0)*h;if(this.doublePrecision&&d instanceof Float64Array&&(d=cb(d,o)),this.settings.isIndexed){const B=this.settings.defaultType;d.constructor!==B&&(d=new B(d))}const R=d.byteLength+A+h*2;(!p||p.byteLength<R)&&(p=this._createBuffer(R)),p.write(d,A)}return this.setAccessor(o),!0}updateSubBuffer(e={}){this.state.bounds=null;const i=this.value,{startOffset:n=0,endOffset:o}=e;this.buffer.write(this.doublePrecision&&i instanceof Float64Array?cb(i,{size:this.size,startIndex:n,endIndex:o}):i.subarray(n,o),n*i.BYTES_PER_ELEMENT+this.byteOffset)}allocate(e,i=!1){const{state:n}=this,o=n.allocatedValue,d=dp.allocate(o,e+1,{size:this.size,type:this.settings.defaultType,copy:i});this.value=d;const{byteOffset:p}=this;let{buffer:h}=this;return(!h||h.byteLength<d.byteLength+p)&&(h=this._createBuffer(d.byteLength+p),i&&o&&h.write(o instanceof Float64Array?cb(o,this):o,p)),n.allocatedValue=d,n.constant=!1,n.externalBuffer=null,this.setAccessor(this.settings),!0}_checkExternalBuffer(e){const{value:i}=e;if(!ArrayBuffer.isView(i))throw new Error(`Attribute ${this.id} value is not TypedArray`);const n=this.settings.defaultType;let o=!1;if(this.doublePrecision&&(o=i.BYTES_PER_ELEMENT<4),o)throw new Error(`Attribute ${this.id} does not support ${i.constructor.name}`);!(i instanceof n)&&this.settings.normalized&&!("normalized"in e)&&On.warn(`Attribute ${this.id} is normalized`)()}normalizeConstant(e){switch(this.settings.type){case"snorm8":return new Float32Array(e).map(i=>(i+128)/255*2-1);case"snorm16":return new Float32Array(e).map(i=>(i+32768)/65535*2-1);case"unorm8":return new Float32Array(e).map(i=>i/255);case"unorm16":return new Float32Array(e).map(i=>i/65535);default:return e}}_normalizeValue(e,i,n){const{defaultValue:o,size:d}=this.settings;if(Number.isFinite(e))return i[n]=e,i;if(!e){let p=d;for(;--p>=0;)i[n+p]=o[p];return i}switch(d){case 4:i[n+3]=Number.isFinite(e[3])?e[3]:o[3];case 3:i[n+2]=Number.isFinite(e[2])?e[2]:o[2];case 2:i[n+1]=Number.isFinite(e[1])?e[1]:o[1];case 1:i[n+0]=Number.isFinite(e[0])?e[0]:o[0];break;default:let p=d;for(;--p>=0;)i[n+p]=Number.isFinite(e[p])?e[p]:o[p]}return i}_areValuesEqual(e,i){if(!e||!i)return!1;const{size:n}=this;for(let o=0;o<n;o++)if(e[o]!==i[o])return!1;return!0}_createBuffer(e){var o;this._buffer&&this._buffer.destroy();const{isIndexed:i,type:n}=this.settings;return this._buffer=this.device.createBuffer({...(o=this._buffer)==null?void 0:o.props,id:this.id,usage:(i?En.INDEX:En.VERTEX)|En.COPY_DST,indexType:i?n:void 0,byteLength:e}),this._buffer}}const nT=[],rT=[];function gA(t,e=0,i=1/0){let n=nT;const o={index:-1,data:t,target:[]};return t?typeof t[Symbol.iterator]=="function"?n=t:t.length>0&&(rT.length=t.length,n=rT):n=nT,(e>0||Number.isFinite(i))&&(n=(Array.isArray(n)?n:Array.from(n)).slice(e,i),o.index=e-1),{iterable:n,objectInfo:o}}function _A(t){return t&&t[Symbol.asyncIterator]}function yA(t,e){const{size:i,stride:n,offset:o,startIndices:d,nested:p}=e,h=t.BYTES_PER_ELEMENT,A=n?n/h:i,R=o?o/h:0,B=Math.floor((t.length-R)/A);return(N,{index:F,target:Q})=>{if(!d){const me=F*A+R;for(let we=0;we<i;we++)Q[we]=t[me+we];return Q}const re=d[F],se=d[F+1]||B;let ae;if(p){ae=new Array(se-re);for(let me=re;me<se;me++){const we=me*A+R;Q=new Array(i);for(let ve=0;ve<i;ve++)Q[ve]=t[we+ve];ae[me-re]=Q}}else if(A===i)ae=t.subarray(re*i+R,se*i+R);else{ae=new t.constructor((se-re)*i);let me=0;for(let we=re;we<se;we++){const ve=we*A+R;for(let Oe=0;Oe<i;Oe++)ae[me++]=t[ve+Oe]}}return ae}}const rz=[],ly=[[0,1/0]];function sz(t,e){if(t===ly||(e[0]<0&&(e[0]=0),e[0]>=e[1]))return t;const i=[],n=t.length;let o=0;for(let d=0;d<n;d++){const p=t[d];p[1]<e[0]?(i.push(p),o=d+1):p[0]>e[1]?i.push(p):e=[Math.min(p[0],e[0]),Math.max(p[1],e[1])]}return i.splice(o,0,e),i}const az={interpolation:{duration:0,easing:t=>t},spring:{stiffness:.05,damping:.5}};function vA(t,e){if(!t)return null;Number.isFinite(t)&&(t={type:"interpolation",duration:t});const i=t.type||"interpolation";return{...az[i],...e,...t,type:i}}class bA extends nz{constructor(e,i){super(e,i,{startIndices:null,lastExternalBuffer:null,binaryValue:null,binaryAccessor:null,needsUpdate:!0,needsRedraw:!1,layoutChanged:!1,updateRanges:ly}),this.constant=!1,this.settings.update=i.update||(i.accessor?this._autoUpdater:void 0),Object.seal(this.settings),Object.seal(this.state),this._validateAttributeUpdaters()}get startIndices(){return this.state.startIndices}set startIndices(e){this.state.startIndices=e}needsUpdate(){return this.state.needsUpdate}needsRedraw({clearChangedFlags:e=!1}={}){const i=this.state.needsRedraw;return this.state.needsRedraw=i&&!e,i}layoutChanged(){return this.state.layoutChanged}setAccessor(e){var i;(i=this.state).layoutChanged||(i.layoutChanged=!tz(e,this.getAccessor())),super.setAccessor(e)}getUpdateTriggers(){const{accessor:e}=this.settings;return[this.id].concat(typeof e!="function"&&e||[])}supportsTransition(){return!!this.settings.transition}getTransitionSetting(e){if(!e||!this.supportsTransition())return null;const{accessor:i}=this.settings,n=this.settings.transition,o=Array.isArray(i)?e[i.find(d=>e[d])]:e[i];return vA(o,n)}setNeedsUpdate(e=this.id,i){if(this.state.needsUpdate=this.state.needsUpdate||e,this.setNeedsRedraw(e),i){const{startRow:n=0,endRow:o=1/0}=i;this.state.updateRanges=sz(this.state.updateRanges,[n,o])}else this.state.updateRanges=ly}clearNeedsUpdate(){this.state.needsUpdate=!1,this.state.updateRanges=rz}setNeedsRedraw(e=this.id){this.state.needsRedraw=this.state.needsRedraw||e}allocate(e){const{state:i,settings:n}=this;return n.noAlloc?!1:n.update?(super.allocate(e,i.updateRanges!==ly),!0):!1}updateBuffer({numInstances:e,data:i,props:n,context:o}){if(!this.needsUpdate())return!1;const{state:{updateRanges:d},settings:{update:p,noAlloc:h}}=this;let A=!0;if(p){for(const[R,B]of d)p.call(o,this,{data:i,startRow:R,endRow:B,props:n,numInstances:e});if(this.value)if(this.constant||!this.buffer||this.buffer.byteLength<this.value.byteLength+this.byteOffset)this.constant?this.setConstantValue(o,this.value):this.setData({value:this.value,constant:this.constant}),this.constant=!1;else for(const[R,B]of d){const N=Number.isFinite(R)?this.getVertexOffset(R):0,F=Number.isFinite(B)?this.getVertexOffset(B):h||!Number.isFinite(e)?this.value.length:e*this.size;super.updateSubBuffer({startOffset:N,endOffset:F})}this._checkAttributeArray()}else A=!1;return this.clearNeedsUpdate(),this.setNeedsRedraw(),A}setConstantValue(e,i){if(i===void 0||typeof i=="function")return!1;const n=this.settings.transform&&e?this.settings.transform.call(e,i):i;return this.device.type==="webgpu"?this.setConstantBufferValue(n,this.numInstances):(this.setData({constant:!0,value:n})&&this.setNeedsRedraw(),this.clearNeedsUpdate(),!0)}setConstantBufferValue(e,i){const n=this.settings.defaultType,o=this._normalizeValue(e,new n(this.size),0);if(this._hasConstantBufferValue(o,i))return this.constant=!1,this.clearNeedsUpdate(),!1;const d=new n(Math.max(i,1)*this.size);for(let h=0;h<d.length;h+=this.size)d.set(o,h);const p=this.setData({value:d});return this.constant=!1,this.clearNeedsUpdate(),p&&this.setNeedsRedraw(),p}_hasConstantBufferValue(e,i){const n=this.value,o=Math.max(i,1)*this.size;if(!ArrayBuffer.isView(n)||n.length!==o||n.length%this.size!==0)return!1;for(let d=0;d<n.length;d+=this.size)for(let p=0;p<this.size;p++)if(n[d+p]!==e[p])return!1;return!0}setExternalBuffer(e){const{state:i}=this;return e?(this.clearNeedsUpdate(),i.lastExternalBuffer===e||(i.lastExternalBuffer=e,this.setNeedsRedraw(),this.setData(e)),!0):(i.lastExternalBuffer=null,!1)}setBinaryValue(e,i=null){const{state:n,settings:o}=this;if(!e)return n.binaryValue=null,n.binaryAccessor=null,!1;if(o.noAlloc)return!1;if(n.binaryValue===e)return this.clearNeedsUpdate(),!0;if(n.binaryValue=e,this.setNeedsRedraw(),o.transform||i!==this.startIndices){ArrayBuffer.isView(e)&&(e={value:e});const p=e;fs(ArrayBuffer.isView(p.value),`invalid ${o.accessor}`);const h=!!p.size&&p.size!==this.size;return n.binaryAccessor=yA(p.value,{size:p.size||this.size,stride:p.stride,offset:p.offset,startIndices:i,nested:h}),!1}return this.clearNeedsUpdate(),this.setData(e),!0}getVertexOffset(e){const{startIndices:i}=this;return(i?e<i.length?i[e]:this.numInstances:e)*this.size}getValue(){const e=this.settings.shaderAttributes,i=super.getValue();if(!e)return i;for(const n in e)Object.assign(i,super.getValue(n,e[n]));return i}getBufferLayout(e){this.state.layoutChanged=!1;const i=this.settings.shaderAttributes,n=super._getBufferLayout(),{stepMode:o}=this.settings;if(o==="dynamic"?n.stepMode=e?e.isInstanced?"instance":"vertex":"instance":n.stepMode=o??"vertex",!i)return n;for(const d in i){const p=super._getBufferLayout(d,i[d]);n.attributes.push(...p.attributes)}return n}_autoUpdater(e,{data:i,startRow:n,endRow:o,props:d,numInstances:p}){const{settings:h,state:A,value:R,size:B,startIndices:N}=e,{accessor:F,transform:Q}=h,re=A.binaryAccessor||(typeof F=="function"?F:d[F]);fs(typeof re=="function",`accessor "${F}" is not a function`);let se=e.getVertexOffset(n);const{iterable:ae,objectInfo:me}=gA(i,n,o);for(const we of ae){me.index++;let ve=re(we,me);if(Q&&(ve=Q.call(this,ve)),N){const Oe=(me.index<N.length-1?N[me.index+1]:p)-N[me.index];if(ve&&Array.isArray(ve[0])){let Te=se;for(const Re of ve)e._normalizeValue(Re,R,Te),Te+=B}else ve&&ve.length>B?R.set(ve,se):(e._normalizeValue(ve,me.target,0),dB({target:R,source:me.target,start:se,count:Oe}));se+=Oe*B}else e._normalizeValue(ve,R,se),se+=B}}_validateAttributeUpdaters(){const{settings:e}=this;if(!(e.noAlloc||typeof e.update=="function"))throw new Error(`Attribute ${this.id} missing update or accessor`)}_checkAttributeArray(){const{value:e}=this,i=Math.min(4,this.size);if(e&&e.length>=i){let n=!0;switch(i){case 4:n=n&&Number.isFinite(e[3]);case 3:n=n&&Number.isFinite(e[2]);case 2:n=n&&Number.isFinite(e[1]);case 1:n=n&&Number.isFinite(e[0]);break;default:n=!1}if(!n)throw new Error(`Illegal attribute generated for ${this.id}`)}}}function Ab(t){const{source:e,target:i,start:n=0,size:o,getData:d}=t,p=t.end||i.length,h=e.length,A=p-n;if(h>A){i.set(e.subarray(0,A),n);return}if(i.set(e,n),!d)return;let R=h;for(;R<A;){const B=d(R,e);for(let N=0;N<o;N++)i[n+R]=B[N]||0,R++}}function oz({source:t,target:e,size:i,getData:n,sourceStartIndices:o,targetStartIndices:d}){if(!o||!d)return Ab({source:t,target:e,size:i,getData:n}),e;let p=0,h=0;const A=n&&((B,N)=>n(B+h,N)),R=Math.min(o.length,d.length);for(let B=1;B<R;B++){const N=o[B]*i,F=d[B]*i;Ab({source:t.subarray(p,N),target:e,start:h,end:F,size:i,getData:A}),p=N,h=F}return h<e.length&&Ab({source:[],target:e,start:h,size:i,getData:A}),e}function lz(t){const{device:e,settings:i,value:n}=t,o=new bA(e,i);return o.setData({value:n instanceof Float64Array?new Float64Array(0):new Float32Array(0),normalized:i.normalized}),o}function xA(t){switch(t){case 1:return"float";case 2:return"vec2";case 3:return"vec3";case 4:return"vec4";default:throw new Error(`No defined attribute type for size "${t}"`)}}function wA(t){switch(t){case 1:return"float32";case 2:return"float32x2";case 3:return"float32x3";case 4:return"float32x4";default:throw new Error("invalid type size")}}function TA(t){t.push(t.shift())}function cz(t,e){const{doublePrecision:i,settings:n,value:o,size:d}=t,p=i&&o instanceof Float64Array?2:1;let h=0;const{shaderAttributes:A}=t.settings;if(A)for(const R of Object.values(A))h=Math.max(h,R.vertexOffset??0);return(n.noAlloc?o.length:(e+h)*d)*p}function SA({device:t,source:e,target:i}){return(!i||i.byteLength<e.byteLength)&&(i==null||i.destroy(),i=t.createBuffer({byteLength:e.byteLength,usage:e.usage})),i}function AA({device:t,buffer:e,attribute:i,fromLength:n,toLength:o,fromStartIndices:d,getData:p=h=>h}){const h=i.doublePrecision&&i.value instanceof Float64Array?2:1,A=i.size*h,R=i.byteOffset,B=i.settings.bytesPerElement<4?R/i.settings.bytesPerElement*4:R,N=i.startIndices,F=d&&N,Q=i.isConstant;if(!F&&e&&n>=o)return e;const re=i.value instanceof Float64Array?Float32Array:i.value.constructor,se=Q?i.value:new re(i.getBuffer().readSyncWebGL(R,o*re.BYTES_PER_ELEMENT).buffer);if(i.settings.normalized&&!Q){const ve=p;p=(Oe,Te)=>i.normalizeConstant(ve(Oe,Te))}const ae=Q?(ve,Oe)=>p(se,Oe):(ve,Oe)=>p(se.subarray(ve+R,ve+R+A),Oe),me=e?new Float32Array(e.readSyncWebGL(B,n*4).buffer):new Float32Array(0),we=new Float32Array(o);return oz({source:me,target:we,sourceStartIndices:d,targetStartIndices:N,size:A,getData:ae}),(!e||e.byteLength<we.byteLength+B)&&(e==null||e.destroy(),e=t.createBuffer({byteLength:we.byteLength+B,usage:35050})),e.write(we,B),e}class EA{constructor({device:e,attribute:i,timeline:n}){this.buffers=[],this.currentLength=0,this.device=e,this.transition=new fv(n),this.attribute=i,this.attributeInTransition=lz(i),this.currentStartIndices=i.startIndices}get inProgress(){return this.transition.inProgress}start(e,i,n=1/0){this.settings=e,this.currentStartIndices=this.attribute.startIndices,this.currentLength=cz(this.attribute,i),this.transition.start({...e,duration:n})}update(){const e=this.transition.update();return e&&this.onUpdate(),e}setBuffer(e){this.attributeInTransition.setData({buffer:e,normalized:this.attribute.settings.normalized,value:this.attributeInTransition.value})}cancel(){this.transition.cancel()}delete(){this.cancel();for(const e of this.buffers)e.destroy();this.buffers.length=0}}class uz extends EA{constructor({device:e,attribute:i,timeline:n}){super({device:e,attribute:i,timeline:n}),this.type="interpolation",this.transform=pz(e,i)}start(e,i){const n=this.currentLength,o=this.currentStartIndices;if(super.start(e,i,e.duration),e.duration<=0){this.transition.cancel();return}const{buffers:d,attribute:p}=this;TA(d),d[0]=AA({device:this.device,buffer:d[0],attribute:p,fromLength:n,toLength:this.currentLength,fromStartIndices:o,getData:e.enter}),d[1]=SA({device:this.device,source:d[0],target:d[1]}),this.setBuffer(d[1]);const{transform:h}=this,A=h.model;let R=Math.floor(this.currentLength/p.size);CA(p)&&(R/=2),A.setVertexCount(R),p.isConstant?(A.setAttributes({aFrom:d[0]}),A.setConstantAttributes({aTo:p.value})):A.setAttributes({aFrom:d[0],aTo:p.getBuffer()}),h.transformFeedback.setBuffers({vCurrent:d[1]})}onUpdate(){const{duration:e,easing:i}=this.settings,{time:n}=this.transition;let o=n/e;i&&(o=i(o));const{model:d}=this.transform,p={time:o};d.shaderInputs.setProps({interpolation:p}),this.transform.run({discard:!0})}delete(){super.delete(),this.transform.destroy()}}const hz=`layout(std140) uniform interpolationUniforms { 2155 float time; 2156} interpolation; 2157`,sT={name:"interpolation",vs:hz,uniformTypes:{time:"f32"}},dz=`#version 300 es 2158#define SHADER_NAME interpolation-transition-vertex-shader 2159 2160in ATTRIBUTE_TYPE aFrom; 2161in ATTRIBUTE_TYPE aTo; 2162out ATTRIBUTE_TYPE vCurrent; 2163 2164void main(void) { 2165 vCurrent = mix(aFrom, aTo, interpolation.time); 2166 gl_Position = vec4(0.0); 2167} 2168`,fz=`#version 300 es 2169#define SHADER_NAME interpolation-transition-vertex-shader 2170 2171in ATTRIBUTE_TYPE aFrom; 2172in ATTRIBUTE_TYPE aFrom64Low; 2173in ATTRIBUTE_TYPE aTo; 2174in ATTRIBUTE_TYPE aTo64Low; 2175out ATTRIBUTE_TYPE vCurrent; 2176out ATTRIBUTE_TYPE vCurrent64Low; 2177 2178vec2 mix_fp64(vec2 a, vec2 b, float x) { 2179 vec2 range = sub_fp64(b, a); 2180 return sum_fp64(a, mul_fp64(range, vec2(x, 0.0))); 2181} 2182 2183void main(void) { 2184 for (int i=0; i<ATTRIBUTE_SIZE; i++) { 2185 vec2 value = mix_fp64(vec2(aFrom[i], aFrom64Low[i]), vec2(aTo[i], aTo64Low[i]), interpolation.time); 2186 vCurrent[i] = value.x; 2187 vCurrent64Low[i] = value.y; 2188 } 2189 gl_Position = vec4(0.0); 2190} 2191`;function CA(t){return t.doublePrecision&&t.value instanceof Float64Array}function pz(t,e){const i=e.size,n=xA(i),o=wA(i),d=e.getBufferLayout();return CA(e)?new mg(t,{vs:fz,bufferLayout:[{name:"aFrom",byteStride:8*i,attributes:[{attribute:"aFrom",format:o,byteOffset:0},{attribute:"aFrom64Low",format:o,byteOffset:4*i}]},{name:"aTo",byteStride:8*i,attributes:[{attribute:"aTo",format:o,byteOffset:0},{attribute:"aTo64Low",format:o,byteOffset:4*i}]}],modules:[_P,sT],defines:{ATTRIBUTE_TYPE:n,ATTRIBUTE_SIZE:i},moduleSettings:{},varyings:["vCurrent","vCurrent64Low"],bufferMode:35980,disableWarnings:!0}):new mg(t,{vs:dz,bufferLayout:[{name:"aFrom",format:o},{name:"aTo",format:d.attributes[0].format}],modules:[sT],defines:{ATTRIBUTE_TYPE:n},varyings:["vCurrent"],disableWarnings:!0})}class mz extends EA{constructor({device:e,attribute:i,timeline:n}){super({device:e,attribute:i,timeline:n}),this.type="spring",this.texture=xz(e),this.framebuffer=wz(e,this.texture),this.transform=bz(e,i)}start(e,i){const n=this.currentLength,o=this.currentStartIndices;super.start(e,i);const{buffers:d,attribute:p}=this;for(let A=0;A<2;A++)d[A]=AA({device:this.device,buffer:d[A],attribute:p,fromLength:n,toLength:this.currentLength,fromStartIndices:o,getData:e.enter});d[2]=SA({device:this.device,source:d[0],target:d[2]}),this.setBuffer(d[1]);const{model:h}=this.transform;h.setVertexCount(Math.floor(this.currentLength/p.size)),p.isConstant?h.setConstantAttributes({aTo:p.value}):h.setAttributes({aTo:p.getBuffer()})}onUpdate(){const{buffers:e,transform:i,framebuffer:n,transition:o}=this,d=this.settings;i.model.setAttributes({aPrev:e[0],aCur:e[1]}),i.transformFeedback.setBuffers({vNext:e[2]});const p={stiffness:d.stiffness,damping:d.damping};i.model.shaderInputs.setProps({spring:p}),i.run({framebuffer:n,discard:!1,parameters:{viewport:[0,0,1,1]},clearColor:[0,0,0,0]}),TA(e),this.setBuffer(e[1]),this.device.readPixelsToArrayWebGL(n)[0]>0||o.end()}delete(){super.delete(),this.transform.destroy(),this.texture.destroy(),this.framebuffer.destroy()}}const gz=`layout(std140) uniform springUniforms { 2192 float damping; 2193 float stiffness; 2194} spring; 2195`,_z={name:"spring",vs:gz,uniformTypes:{damping:"f32",stiffness:"f32"}},yz=`#version 300 es 2196#define SHADER_NAME spring-transition-vertex-shader 2197 2198#define EPSILON 0.00001 2199 2200in ATTRIBUTE_TYPE aPrev; 2201in ATTRIBUTE_TYPE aCur; 2202in ATTRIBUTE_TYPE aTo; 2203out ATTRIBUTE_TYPE vNext; 2204out float vIsTransitioningFlag; 2205 2206ATTRIBUTE_TYPE getNextValue(ATTRIBUTE_TYPE cur, ATTRIBUTE_TYPE prev, ATTRIBUTE_TYPE dest) { 2207 ATTRIBUTE_TYPE velocity = cur - prev; 2208 ATTRIBUTE_TYPE delta = dest - cur; 2209 ATTRIBUTE_TYPE force = delta * spring.stiffness; 2210 ATTRIBUTE_TYPE resistance = velocity * spring.damping; 2211 return force - resistance + velocity + cur; 2212} 2213 2214void main(void) { 2215 bool isTransitioning = length(aCur - aPrev) > EPSILON || length(aTo - aCur) > EPSILON; 2216 vIsTransitioningFlag = isTransitioning ? 1.0 : 0.0; 2217 2218 vNext = getNextValue(aCur, aPrev, aTo); 2219 gl_Position = vec4(0, 0, 0, 1); 2220 gl_PointSize = 100.0; 2221} 2222`,vz=`#version 300 es 2223#define SHADER_NAME spring-transition-is-transitioning-fragment-shader 2224 2225in float vIsTransitioningFlag; 2226 2227out vec4 fragColor; 2228 2229void main(void) { 2230 if (vIsTransitioningFlag == 0.0) { 2231 discard; 2232 } 2233 fragColor = vec4(1.0); 2234}`;function bz(t,e){const i=xA(e.size),n=wA(e.size);return new mg(t,{vs:yz,fs:vz,bufferLayout:[{name:"aPrev",format:n},{name:"aCur",format:n},{name:"aTo",format:e.getBufferLayout().attributes[0].format}],varyings:["vNext"],modules:[_z],defines:{ATTRIBUTE_TYPE:i},parameters:{depthCompare:"always",blendColorOperation:"max",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaOperation:"max",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"}})}function xz(t){return t.createTexture({data:new Uint8Array(4),format:"rgba8unorm",width:1,height:1})}function wz(t,e){return t.createFramebuffer({id:"spring-transition-is-transitioning-framebuffer",width:1,height:1,colorAttachments:[e]})}const Tz={interpolation:uz,spring:mz};class Sz{constructor(e,{id:i,timeline:n}){if(!e)throw new Error("AttributeTransitionManager is constructed without device");this.id=i,this.device=e,this.timeline=n,this.transitions={},this.needsRedraw=!1,this.numInstances=1}finalize(){for(const e in this.transitions)this._removeTransition(e)}update({attributes:e,transitions:i,numInstances:n}){this.numInstances=n||1;for(const o in e){const d=e[o],p=d.getTransitionSetting(i);p&&this._updateAttribute(o,d,p)}for(const o in this.transitions){const d=e[o];(!d||!d.getTransitionSetting(i))&&this._removeTransition(o)}}hasAttribute(e){const i=this.transitions[e];return i&&i.inProgress}getAttributes(){const e={};for(const i in this.transitions){const n=this.transitions[i];n.inProgress&&(e[i]=n.attributeInTransition)}return e}run(){if(this.numInstances===0)return!1;for(const i in this.transitions)this.transitions[i].update()&&(this.needsRedraw=!0);const e=this.needsRedraw;return this.needsRedraw=!1,e}_removeTransition(e){this.transitions[e].delete(),delete this.transitions[e]}_updateAttribute(e,i,n){const o=this.transitions[e];let d=!o||o.type!==n.type;if(d){o&&this._removeTransition(e);const p=Tz[n.type];p?this.transitions[e]=new p({attribute:i,timeline:this.timeline,device:this.device}):(On.error(`unsupported transition type '${n.type}'`)(),d=!1)}(d||i.needsRedraw())&&(this.needsRedraw=!0,this.transitions[e].start(n,this.numInstances))}}const aT="attributeManager.invalidate",Az="attributeManager.updateStart",Ez="attributeManager.updateEnd",Cz="attribute.updateStart",Rz="attribute.allocate",Mz="attribute.updateEnd";class Pz{constructor(e,{id:i="attribute-manager",stats:n,timeline:o}={}){this.mergeBoundsMemoized=Tg(Tk),this.id=i,this.device=e,this.attributes={},this.updateTriggers={},this.needsRedraw=!0,this.userData={},this.stats=n,this.attributeTransitionManager=new Sz(e,{id:`${i}-transitions`,timeline:o}),Object.seal(this)}finalize(){for(const e in this.attributes)this.attributes[e].delete();this.attributeTransitionManager.finalize()}getNeedsRedraw(e={clearRedrawFlags:!1}){const i=this.needsRedraw;return this.needsRedraw=this.needsRedraw&&!e.clearRedrawFlags,i&&this.id}setNeedsRedraw(){this.needsRedraw=!0}add(e){this._add(e)}addInstanced(e){this._add(e,{stepMode:"instance"})}remove(e){for(const i of e)this.attributes[i]!==void 0&&(this.attributes[i].delete(),delete this.attributes[i])}invalidate(e,i){const n=this._invalidateTrigger(e,i);aa(aT,this,e,n)}invalidateAll(e){for(const i in this.attributes)this.attributes[i].setNeedsUpdate(i,e);aa(aT,this,"all")}update({data:e,numInstances:i,startIndices:n=null,transitions:o,props:d={},buffers:p={},context:h={}}){let A=!1;aa(Az,this),this.stats&&this.stats.get("Update Attributes").timeStart();for(const R in this.attributes){const B=this.attributes[R],N=B.settings.accessor;B.startIndices=n,B.numInstances=i,d[R]&&On.removed(`props.${R}`,`data.attributes.${R}`)(),B.setExternalBuffer(p[R])||B.setBinaryValue(typeof N=="string"?p[N]:void 0,e.startIndices)||typeof N=="string"&&!p[N]&&B.setConstantValue(h,d[N])||B.needsUpdate()&&(A=!0,this._updateAttribute({attribute:B,numInstances:i,data:e,props:d,context:h})),this.needsRedraw=this.needsRedraw||B.needsRedraw()}A&&aa(Ez,this,i),this.stats&&(this.stats.get("Update Attributes").timeEnd(),A&&this.stats.get("Attributes updated").incrementCount()),this.attributeTransitionManager.update({attributes:this.attributes,numInstances:i,transitions:o})}updateTransition(){const{attributeTransitionManager:e}=this,i=e.run();return this.needsRedraw=this.needsRedraw||i,i}getAttributes(){return{...this.attributes,...this.attributeTransitionManager.getAttributes()}}getBounds(e){const i=e.map(n=>{var o;return(o=this.attributes[n])==null?void 0:o.getBounds()});return this.mergeBoundsMemoized(i)}getChangedAttributes(e={clearChangedFlags:!1}){const{attributes:i,attributeTransitionManager:n}=this,o={...n.getAttributes()};for(const d in i){const p=i[d];p.needsRedraw(e)&&!n.hasAttribute(d)&&(o[d]=p)}return o}getBufferLayouts(e){return Object.values(this.getAttributes()).map(i=>i.getBufferLayout(e))}_add(e,i){for(const n in e){const o=e[n],d={...o,id:n,size:o.isIndexed&&1||o.size||1,...i};this.attributes[n]=new bA(this.device,d)}this._mapUpdateTriggersToAttributes()}_mapUpdateTriggersToAttributes(){const e={};for(const i in this.attributes)this.attributes[i].getUpdateTriggers().forEach(o=>{e[o]||(e[o]=[]),e[o].push(i)});this.updateTriggers=e}_invalidateTrigger(e,i){const{attributes:n,updateTriggers:o}=this,d=o[e];return d&&d.forEach(p=>{const h=n[p];h&&h.setNeedsUpdate(h.id,i)}),d}_updateAttribute(e){const{attribute:i,numInstances:n}=e;if(aa(Cz,i),i.constant){i.setConstantValue(e.context,i.value);return}i.allocate(n)&&aa(Rz,i,n),i.updateBuffer(e)&&(this.needsRedraw=!0,aa(Mz,i,n))}}class Iz extends fv{get value(){return this._value}_onUpdate(){const{time:e,settings:{fromValue:i,toValue:n,duration:o,easing:d}}=this,p=d(e/o);this._value=vy(i,n,p)}}const oT=1e-5;function lT(t,e,i,n,o){const d=e-t,h=(i-e)*o,A=-d*n;return h+A+d+e}function Dz(t,e,i,n,o){if(Array.isArray(i)){const d=[];for(let p=0;p<i.length;p++)d[p]=lT(t[p],e[p],i[p],n,o);return d}return lT(t,e,i,n,o)}function cT(t,e){if(Array.isArray(t)){let i=0;for(let n=0;n<t.length;n++){const o=t[n]-e[n];i+=o*o}return Math.sqrt(i)}return Math.abs(t-e)}class Oz extends fv{get value(){return this._currValue}_onUpdate(){const{fromValue:e,toValue:i,damping:n,stiffness:o}=this.settings,{_prevValue:d=e,_currValue:p=e}=this;let h=Dz(d,p,i,n,o);const A=cT(h,i),R=cT(h,p);A<oT&&R<oT&&(h=i,this.end()),this._prevValue=p,this._currValue=h}}const kz={interpolation:Iz,spring:Oz};class Bz{constructor(e){this.transitions=new Map,this.timeline=e}get active(){return this.transitions.size>0}add(e,i,n,o){const{transitions:d}=this;if(d.has(e)){const A=d.get(e),{value:R=A.settings.fromValue}=A;i=R,this.remove(e)}if(o=vA(o),!o)return;const p=kz[o.type];if(!p){On.error(`unsupported transition type '${o.type}'`)();return}const h=new p(this.timeline);h.start({...o,fromValue:i,toValue:n}),d.set(e,h)}remove(e){const{transitions:i}=this;i.has(e)&&(i.get(e).cancel(),i.delete(e))}update(){const e={};for(const[i,n]of this.transitions)n.update(),e[i]=n.value,n.inProgress||this.remove(i);return e}clear(){for(const e of this.transitions.keys())this.remove(e)}}function Nz(t){const e=t[Ed];for(const i in e){const n=e[i],{validate:o}=n;if(o&&!o(t[i],n))throw new Error(`Invalid prop ${i}: ${t[i]}`)}}function zz(t,e){const i=RA({newProps:t,oldProps:e,propTypes:t[Ed],ignoreProps:{data:null,updateTriggers:null,extensions:null,transitions:null}}),n=Fz(t,e);let o=!1;return n||(o=Uz(t,e)),{dataChanged:n,propsChanged:i,updateTriggersChanged:o,extensionsChanged:jz(t,e),transitionsChanged:Lz(t,e)}}function Lz(t,e){if(!t.transitions)return!1;const i={},n=t[Ed];let o=!1;for(const d in t.transitions){const p=n[d],h=p&&p.type;(h==="number"||h==="color"||h==="array")&&P0(t[d],e[d],p)&&(i[d]=!0,o=!0)}return o?i:!1}function RA({newProps:t,oldProps:e,ignoreProps:i={},propTypes:n={},triggerName:o="props"}){if(e===t)return!1;if(typeof t!="object"||t===null)return`${o} changed shallowly`;if(typeof e!="object"||e===null)return`${o} changed shallowly`;for(const d of Object.keys(t))if(!(d in i)){if(!(d in e))return`${o}.${d} added`;const p=P0(t[d],e[d],n[d]);if(p)return`${o}.${d} ${p}`}for(const d of Object.keys(e))if(!(d in i)){if(!(d in t))return`${o}.${d} dropped`;if(!Object.hasOwnProperty.call(t,d)){const p=P0(t[d],e[d],n[d]);if(p)return`${o}.${d} ${p}`}}return!1}function P0(t,e,i){let n=i&&i.equal;return n&&!n(t,e,i)||!n&&(n=t&&e&&t.equals,n&&!n.call(t,e))?"changed deeply":!n&&e!==t?"changed shallowly":null}function Fz(t,e){if(e===null)return"oldProps is null, initial diff";let i=!1;const{dataComparator:n,_dataDiff:o}=t;return n?n(t.data,e.data)||(i="Data comparator detected a change"):t.data!==e.data&&(i="A new data container was supplied"),i&&o&&(i=o(t.data,e.data)||i),i}function Uz(t,e){if(e===null)return{all:!0};if("all"in t.updateTriggers&&uT(t,e,"all"))return{all:!0};const i={};let n=!1;for(const o in t.updateTriggers)o!=="all"&&uT(t,e,o)&&(i[o]=!0,n=!0);return n?i:!1}function jz(t,e){if(e===null)return!0;const i=e.extensions,{extensions:n}=t;if(n===i)return!1;if(!i||!n||n.length!==i.length)return!0;for(let o=0;o<n.length;o++)if(!n[o].equals(i[o]))return!0;return!1}function uT(t,e,i){let n=t.updateTriggers[i];n=n??{};let o=e.updateTriggers[i];return o=o??{},RA({oldProps:o,newProps:n,triggerName:i})}const Vz="count(): argument not an object",$z="count(): argument not a container";function Hz(t){if(!Xz(t))throw new Error(Vz);if(typeof t.count=="function")return t.count();if(Number.isFinite(t.size))return t.size;if(Number.isFinite(t.length))return t.length;if(Wz(t))return Object.keys(t).length;throw new Error($z)}function Wz(t){return t!==null&&typeof t=="object"&&t.constructor===Object}function Xz(t){return t!==null&&typeof t=="object"}function hT(t,e){if(!e)return t;const i={...t,...e};if("defines"in e&&(i.defines={...t.defines,...e.defines}),"modules"in e&&(i.modules=(t.modules||[]).concat(e.modules),e.modules.some(n=>n.name==="project64"))){const n=i.modules.findIndex(o=>o.name==="project32");n>=0&&i.modules.splice(n,1)}if("inject"in e)if(!t.inject)i.inject=e.inject;else{const n={...t.inject};for(const o in e.inject)n[o]=(n[o]||"")+e.inject[o];i.inject=n}return i}const qz={minFilter:"linear",mipmapFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"},I0={};function Zz(t,e,i,n){if(i instanceof Dn)return i;i.constructor&&i.constructor.name!=="Object"&&(i={data:i});let o=null;i.compressed&&(o={minFilter:"linear",mipmapFilter:i.data.length>1?"nearest":"linear"});const{width:d,height:p}=i.data,h=e.createTexture({...i,sampler:{...qz,...o,...n},mipLevels:e.getMipLevelCount(d,p)});return e.type==="webgl"?h.generateMipmapsWebGL():e.type==="webgpu"&&e.generateMipmapsWebGPU(h),I0[h.id]=t,h}function Yz(t,e){!e||!(e instanceof Dn)||I0[e.id]===t&&(e.delete(),delete I0[e.id])}const Gz={boolean:{validate(t,e){return!0},equal(t,e,i){return!!t==!!e}},number:{validate(t,e){return Number.isFinite(t)&&(!("max"in e)||t<=e.max)&&(!("min"in e)||t>=e.min)}},color:{validate(t,e){return e.optional&&!t||D0(t)&&(t.length===3||t.length===4)},equal(t,e,i){return Xa(t,e,1)}},accessor:{validate(t,e){const i=Iy(t);return i==="function"||i===Iy(e.value)},equal(t,e,i){return typeof e=="function"?!0:Xa(t,e,1)}},array:{validate(t,e){return e.optional&&!t||D0(t)},equal(t,e,i){const{compare:n}=i,o=Number.isInteger(n)?n:n?1:0;return n?Xa(t,e,o):t===e}},object:{equal(t,e,i){if(i.ignore)return!0;const{compare:n}=i,o=Number.isInteger(n)?n:n?1:0;return n?Xa(t,e,o):t===e}},function:{validate(t,e){return e.optional&&!t||typeof t=="function"},equal(t,e,i){return!i.compare&&i.ignore!==!1||t===e}},data:{transform:(t,e,i)=>{if(!t)return t;const{dataTransform:n}=i.props;return n?n(t):typeof t.shape=="string"&&t.shape.endsWith("-table")&&Array.isArray(t.data)?t.data:t}},image:{transform:(t,e,i)=>{const n=i.context;return!n||!n.device?null:Zz(i.id,n.device,t,{...e.parameters,...i.props.textureParameters})},release:(t,e,i)=>{Yz(i.id,t)}}};function Kz(t){const e={},i={},n={};for(const[o,d]of Object.entries(t)){const p=d==null?void 0:d.deprecatedFor;if(p)n[o]=Array.isArray(p)?p:[p];else{const h=Qz(o,d);e[o]=h,i[o]=h.value}}return{propTypes:e,defaultProps:i,deprecatedProps:n}}function Qz(t,e){switch(Iy(e)){case"object":return Xm(t,e);case"array":return Xm(t,{type:"array",value:e,compare:!1});case"boolean":return Xm(t,{type:"boolean",value:e});case"number":return Xm(t,{type:"number",value:e});case"function":return Xm(t,{type:"function",value:e,compare:!0});default:return{name:t,type:"unknown",value:e}}}function Xm(t,e){return"type"in e?{name:t,...Gz[e.type],...e}:"value"in e?{name:t,type:Iy(e.value),...e}:{name:t,type:"object",value:e}}function D0(t){return Array.isArray(t)||ArrayBuffer.isView(t)}function Iy(t){return D0(t)?"array":t===null?"null":typeof t}function Jz(t,e){let i;for(let d=e.length-1;d>=0;d--){const p=e[d];"extensions"in p&&(i=p.extensions)}const n=O0(t.constructor,i),o=Object.create(n);o[My]=t,o[Dd]={},o[fh]={};for(let d=0;d<e.length;++d){const p=e[d];for(const h in p)o[h]=p[h]}return Object.freeze(o),o}const e6="_mergedDefaultProps";function O0(t,e){if(!(t instanceof mv.constructor))return{};let i=e6;if(e)for(const o of e){const d=o.constructor;d&&(i+=`:${d.extensionName||d.name}`)}const n=MA(t,i);return n||(t[i]=t6(t,e||[]))}function t6(t,e){if(!t.prototype)return null;const n=Object.getPrototypeOf(t),o=O0(n),d=MA(t,"defaultProps")||{},p=Kz(d),h=Object.assign(Object.create(null),o,p.defaultProps),A=Object.assign(Object.create(null),o==null?void 0:o[Ed],p.propTypes),R=Object.assign(Object.create(null),o==null?void 0:o[pb],p.deprecatedProps);for(const B of e){const N=O0(B.constructor);N&&(Object.assign(h,N),Object.assign(A,N[Ed]),Object.assign(R,N[pb]))}return i6(h,t),r6(h,A),n6(h,R),h[Ed]=A,h[pb]=R,e.length===0&&!xx(t,"_propTypes")&&(t._propTypes=A),h}function i6(t,e){const i=a6(e);Object.defineProperties(t,{id:{writable:!0,value:i}})}function n6(t,e){for(const i in e)Object.defineProperty(t,i,{enumerable:!1,set(n){const o=`${this.id}: ${i}`;for(const d of e[i])xx(this,d)||(this[d]=n);On.deprecated(o,e[i].join("/"))()}})}function r6(t,e){const i={},n={};for(const o in e){const d=e[o],{name:p,value:h}=d;d.async&&(i[p]=h,n[p]=s6(p))}t[ip]=i,t[Dd]={},Object.defineProperties(t,n)}function s6(t){return{enumerable:!0,set(e){typeof e=="string"||e instanceof Promise||_A(e)?this[Dd][t]=e:this[fh][t]=e},get(){if(this[fh]){if(t in this[fh])return this[fh][t]||this[ip][t];if(t in this[Dd]){const e=this[My]&&this[My].internalState;if(e&&e.hasAsyncProp(t))return e.getAsyncProp(t)||this[ip][t]}}return this[ip][t]}}}function xx(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function MA(t,e){return xx(t,e)&&t[e]}function a6(t){const e=t.componentName;return e||On.warn(`${t.name}.componentName not specified`)(),e||t.name}let o6=0;class mv{constructor(...e){this.props=Jz(this,e),this.id=this.props.id,this.count=o6++}clone(e){const{props:i}=this,n={};for(const o in i[ip])o in i[fh]?n[o]=i[fh][o]:o in i[Dd]&&(n[o]=i[Dd][o]);return new this.constructor({...i,...n,...e})}}mv.componentName="Component";mv.defaultProps={};const l6=Object.freeze({});class c6{constructor(e){this.component=e,this.asyncProps={},this.onAsyncPropUpdated=()=>{},this.oldProps=null,this.oldAsyncProps=null}finalize(){for(const e in this.asyncProps){const i=this.asyncProps[e];i&&i.type&&i.type.release&&i.type.release(i.resolvedValue,i.type,this.component)}this.asyncProps={},this.component=null,this.resetOldProps()}getOldProps(){return this.oldAsyncProps||this.oldProps||l6}resetOldProps(){this.oldAsyncProps=null,this.oldProps=this.component?this.component.props:null}hasAsyncProp(e){return e in this.asyncProps}getAsyncProp(e){const i=this.asyncProps[e];return i&&i.resolvedValue}isAsyncPropLoading(e){if(e){const i=this.asyncProps[e];return!!(i&&i.pendingLoadCount>0&&i.pendingLoadCount!==i.resolvedLoadCount)}for(const i in this.asyncProps)if(this.isAsyncPropLoading(i))return!0;return!1}reloadAsyncProp(e,i){this._watchPromise(e,Promise.resolve(i))}setAsyncProps(e){this.component=e[My]||this.component;const i=e[fh]||{},n=e[Dd]||e,o=e[ip]||{};for(const d in i){const p=i[d];this._createAsyncPropData(d,o[d]),this._updateAsyncProp(d,p),i[d]=this.getAsyncProp(d)}for(const d in n){const p=n[d];this._createAsyncPropData(d,o[d]),this._updateAsyncProp(d,p)}}_fetch(e,i){return null}_onResolve(e,i){}_onError(e,i){}_updateAsyncProp(e,i){if(this._didAsyncInputValueChange(e,i)){if(typeof i=="string"&&(i=this._fetch(e,i)),i instanceof Promise){this._watchPromise(e,i);return}if(_A(i)){this._resolveAsyncIterable(e,i);return}this._setPropValue(e,i)}}_freezeAsyncOldProps(){if(!this.oldAsyncProps&&this.oldProps){this.oldAsyncProps=Object.create(this.oldProps);for(const e in this.asyncProps)Object.defineProperty(this.oldAsyncProps,e,{enumerable:!0,value:this.oldProps[e]})}}_didAsyncInputValueChange(e,i){const n=this.asyncProps[e];return i===n.resolvedValue||i===n.lastValue?!1:(n.lastValue=i,!0)}_setPropValue(e,i){this._freezeAsyncOldProps();const n=this.asyncProps[e];n&&(i=this._postProcessValue(n,i),n.resolvedValue=i,n.pendingLoadCount++,n.resolvedLoadCount=n.pendingLoadCount)}_setAsyncPropValue(e,i,n){const o=this.asyncProps[e];o&&n>=o.resolvedLoadCount&&i!==void 0&&(this._freezeAsyncOldProps(),o.resolvedValue=i,o.resolvedLoadCount=n,this.onAsyncPropUpdated(e,i))}_watchPromise(e,i){const n=this.asyncProps[e];if(n){n.pendingLoadCount++;const o=n.pendingLoadCount;i.then(d=>{this.component&&(d=this._postProcessValue(n,d),this._setAsyncPropValue(e,d,o),this._onResolve(e,d))}).catch(d=>{this._onError(e,d)})}}async _resolveAsyncIterable(e,i){if(e!=="data"){this._setPropValue(e,i);return}const n=this.asyncProps[e];if(!n)return;n.pendingLoadCount++;const o=n.pendingLoadCount;let d=[],p=0;for await(const h of i){if(!this.component)return;const{dataTransform:A}=this.component.props;A?d=A(h,d):d=d.concat(h),Object.defineProperty(d,"__diff",{enumerable:!1,value:[{startRow:p,endRow:d.length}]}),p=d.length,this._setAsyncPropValue(e,d,o)}this._onResolve(e,d)}_postProcessValue(e,i){const n=e.type;return n&&this.component&&(n.release&&n.release(e.resolvedValue,n,this.component),n.transform)?n.transform(i,n,this.component):i}_createAsyncPropData(e,i){if(!this.asyncProps[e]){const o=this.component&&this.component.props[Ed];this.asyncProps[e]={type:o&&o[e],lastValue:null,resolvedValue:i,pendingLoadCount:0,resolvedLoadCount:0}}}}class u6 extends c6{constructor({attributeManager:e,layer:i}){super(i),this.attributeManager=e,this.needsRedraw=!0,this.needsUpdate=!0,this.subLayers=null,this.usesPickingColorCache=!1}get layer(){return this.component}_fetch(e,i){const n=this.layer,o=n==null?void 0:n.props.fetch;return o?o(i,{propName:e,layer:n}):super._fetch(e,i)}_onResolve(e,i){const n=this.layer;if(n){const o=n.props.onDataLoad;e==="data"&&o&&o(i,{propName:e,layer:n})}}_onError(e,i){const n=this.layer;n&&n.raiseError(i,`loading ${e} of ${this.layer}`)}}const h6="layer.changeFlag",d6="layer.initialize",f6="layer.update",p6="layer.finalize",m6="layer.matched",dT=2**24-1,g6=Object.freeze([]),_6=Tg(({oldViewport:t,viewport:e})=>t.equals(e));let po=new Uint8ClampedArray(0);const y6={data:{type:"data",value:g6,async:!0},dataComparator:{type:"function",value:null,optional:!0},_dataDiff:{type:"function",value:t=>t&&t.__diff,optional:!0},dataTransform:{type:"function",value:null,optional:!0},onDataLoad:{type:"function",value:null,optional:!0},onError:{type:"function",value:null,optional:!0},fetch:{type:"function",value:(t,{propName:e,layer:i,loaders:n,loadOptions:o,signal:d})=>{var A;const{resourceManager:p}=i.context;o=o||i.getLoadOptions(),n=n||i.props.loaders,d&&(o={...o,core:{...o==null?void 0:o.core,fetch:{...(A=o==null?void 0:o.core)==null?void 0:A.fetch,signal:d}}});let h=p.contains(t);return!h&&!o&&(p.add({resourceId:t,data:Vb(t,n),persistent:!1}),h=!0),h?p.subscribe({resourceId:t,onChange:R=>{var B;return(B=i.internalState)==null?void 0:B.reloadAsyncProp(e,R)},consumerId:i.id,requestId:e}):Vb(t,n,o)}},updateTriggers:{},visible:!0,pickable:!1,opacity:{type:"number",min:0,max:1,value:1},operation:"draw",onHover:{type:"function",value:null,optional:!0},onClick:{type:"function",value:null,optional:!0},onDragStart:{type:"function",value:null,optional:!0},onDrag:{type:"function",value:null,optional:!0},onDragEnd:{type:"function",value:null,optional:!0},coordinateSystem:"default",coordinateOrigin:{type:"array",value:[0,0,0],compare:!0},modelMatrix:{type:"array",value:null,compare:!0,optional:!0},wrapLongitude:!1,positionFormat:"XYZ",colorFormat:"RGBA",parameters:{type:"object",value:{},optional:!0,compare:2},loadOptions:{type:"object",value:null,optional:!0,ignore:!0},transitions:null,extensions:[],loaders:{type:"array",value:[],optional:!0,ignore:!0},getPolygonOffset:{type:"function",value:({layerIndex:t})=>[0,-t*100]},highlightedObjectIndex:null,autoHighlight:!1,highlightColor:{type:"accessor",value:[0,0,128,128]}};class gv extends mv{constructor(){super(...arguments),this.internalState=null,this.lifecycle=Wf.NO_STATE,this.parent=null}static get componentName(){return Object.prototype.hasOwnProperty.call(this,"layerName")?this.layerName:""}get root(){let e=this;for(;e.parent;)e=e.parent;return e}toString(){return`${this.constructor.layerName||this.constructor.name}({id: '${this.props.id}'})`}project(e){fs(this.internalState);const i=this.internalState.viewport||this.context.viewport,n=fx(e,{viewport:i,modelMatrix:this.props.modelMatrix,coordinateOrigin:this.props.coordinateOrigin,coordinateSystem:this.props.coordinateSystem}),[o,d,p]=M2(n,i.pixelProjectionMatrix);return e.length===2?[o,d]:[o,d,p]}unproject(e){return fs(this.internalState),(this.internalState.viewport||this.context.viewport).unproject(e)}projectPosition(e,i){fs(this.internalState);const n=this.internalState.viewport||this.context.viewport;return Mk(e,{viewport:n,modelMatrix:this.props.modelMatrix,coordinateOrigin:this.props.coordinateOrigin,coordinateSystem:this.props.coordinateSystem,...i})}get isComposite(){return!1}get isDrawable(){return!0}setState(e){this.setChangeFlags({stateChanged:!0}),Object.assign(this.state,e),this.setNeedsRedraw()}setNeedsRedraw(){this.internalState&&(this.internalState.needsRedraw=!0)}setNeedsUpdate(){this.internalState&&(this.context.layerManager.setNeedsUpdate(String(this)),this.internalState.needsUpdate=!0)}get isLoaded(){return this.internalState?!this.internalState.isAsyncPropLoading():!1}get wrapLongitude(){return this.props.wrapLongitude}isPickable(){return this.props.pickable&&this.props.visible}getModels(){const e=this.state;return e&&(e.models||e.model&&[e.model])||[]}setShaderModuleProps(...e){for(const i of this.getModels())i.shaderInputs.setProps(...e)}getAttributeManager(){return this.internalState&&this.internalState.attributeManager}getCurrentLayer(){return this.internalState&&this.internalState.layer}getLoadOptions(){return this.props.loadOptions}use64bitPositions(){const{coordinateSystem:e}=this.props;return e==="default"||e==="lnglat"||e==="cartesian"}onHover(e,i){return this.props.onHover&&this.props.onHover(e,i)||!1}onClick(e,i){return this.props.onClick&&this.props.onClick(e,i)||!1}nullPickingColor(){return[0,0,0]}encodePickingColor(e,i=[]){return i[0]=e+1&255,i[1]=e+1>>8&255,i[2]=e+1>>8>>8&255,i}decodePickingColor(e){fs(e instanceof Uint8Array);const[i,n,o]=e;return i+n*256+o*65536-1}getNumInstances(){return Number.isFinite(this.props.numInstances)?this.props.numInstances:this.state&&this.state.numInstances!==void 0?this.state.numInstances:Hz(this.props.data)}getStartIndices(){return this.props.startIndices?this.props.startIndices:this.state&&this.state.startIndices?this.state.startIndices:null}getBounds(){var e;return(e=this.getAttributeManager())==null?void 0:e.getBounds(["positions","instancePositions"])}getShaders(e){e=hT(e,{disableWarnings:!0,modules:this.context.defaultShaderModules});for(const i of this.props.extensions)e=hT(e,i.getShaders.call(this,i));return e}shouldUpdateState(e){return e.changeFlags.propsOrDataChanged}updateState(e){const i=this.getAttributeManager(),{dataChanged:n}=e.changeFlags;if(n&&i)if(Array.isArray(n))for(const o of n)i.invalidateAll(o);else i.invalidateAll();if(i){const{props:o}=e,d=this.internalState.hasPickingBuffer,p=Number.isInteger(o.highlightedObjectIndex)||!!o.pickable||o.extensions.some(h=>h.getNeedsPickingBuffer.call(this,h));if(d!==p){this.internalState.hasPickingBuffer=p;const{pickingColors:h,instancePickingColors:A}=i.attributes,R=h||A;R&&(p&&R.constant&&(R.constant=!1,i.invalidate(R.id)),!R.value&&!p&&(R.constant=!0,R.value=[0,0,0]))}}}finalizeState(e){for(const n of this.getModels())n.destroy();const i=this.getAttributeManager();i&&i.finalize(),this.context&&this.context.resourceManager.unsubscribe({consumerId:this.id}),this.internalState&&(this.internalState.uniformTransitions.clear(),this.internalState.finalize())}draw(e){for(const i of this.getModels())i.draw(e.renderPass)}getPickingInfo({info:e,mode:i,sourceLayer:n}){const{index:o}=e;return o>=0&&Array.isArray(this.props.data)&&(e.object=this.props.data[o]),e}raiseError(e,i){var n,o,d,p;i&&(e=new Error(`${i}: ${e.message}`,{cause:e})),(o=(n=this.props).onError)!=null&&o.call(n,e)||(p=(d=this.context)==null?void 0:d.onError)==null||p.call(d,e,this)}getNeedsRedraw(e={clearRedrawFlags:!1}){return this._getNeedsRedraw(e)}needsUpdate(){return this.internalState?this.internalState.needsUpdate||this.hasUniformTransition()||this.shouldUpdateState(this._getUpdateParams()):!1}hasUniformTransition(){var e;return((e=this.internalState)==null?void 0:e.uniformTransitions.active)||!1}activateViewport(e){if(!this.internalState)return;const i=this.internalState.viewport;this.internalState.viewport=e,(!i||!_6({oldViewport:i,viewport:e}))&&(this.setChangeFlags({viewportChanged:!0}),this.isComposite?this.needsUpdate()&&this.setNeedsUpdate():this._update())}invalidateAttribute(e="all"){const i=this.getAttributeManager();i&&(e==="all"?i.invalidateAll():i.invalidate(e))}updateAttributes(e){let i=!1;for(const n in e)e[n].layoutChanged()&&(i=!0);for(const n of this.getModels())this._setModelAttributes(n,e,i)}_updateAttributes(){const e=this.getAttributeManager();if(!e)return;const i=this.props,n=this.getNumInstances(),o=this.getStartIndices();e.update({data:i.data,numInstances:n,startIndices:o,props:i,transitions:i.transitions,buffers:i.data.attributes,context:this});const d=e.getChangedAttributes({clearChangedFlags:!0});this.updateAttributes(d)}_updateAttributeTransition(){const e=this.getAttributeManager();e&&e.updateTransition()}_updateUniformTransition(){const{uniformTransitions:e}=this.internalState;if(e.active){const i=e.update(),n=Object.create(this.props);for(const o in i)Object.defineProperty(n,o,{value:i[o]});return n}return this.props}calculateInstancePickingColors(e,{numInstances:i}){if(e.constant)return;const n=Math.floor(po.length/4);this.internalState.usesPickingColorCache=!0;const o=i>0&&po[0]===0;if(n<i||o){i>dT&&On.warn("Layer has too many data objects. Picking might not be able to distinguish all objects.")(),po=dp.allocate(po,i,{size:4,copy:!0,maxCount:Math.max(i,dT)});const d=Math.floor(po.length/4),p=[0,0,0],h=o?0:n;for(let A=h;A<d;A++)this.encodePickingColor(A,p),po[A*4+0]=p[0],po[A*4+1]=p[1],po[A*4+2]=p[2],po[A*4+3]=0}e.value=po.subarray(0,i*4)}_setModelAttributes(e,i,n=!1){var h;if(!Object.keys(i).length)return;if(n){const A=this.getAttributeManager();e.setBufferLayout(A.getBufferLayouts(e)),i=A.getAttributes()}const o=((h=e.userData)==null?void 0:h.excludeAttributes)||{},d={},p={};for(const A in i){if(o[A])continue;const R=i[A].getValue();for(const B in R){const N=R[B];N instanceof En?i[A].settings.isIndexed?e.setIndexBuffer(N):d[B]=N:N&&(p[B]=N)}}e.setAttributes(d),e.setConstantAttributes(p)}disablePickingIndex(e){const i=this.props.data;if(!("attributes"in i)){this._disablePickingIndex(e);return}const{pickingColors:n,instancePickingColors:o}=this.getAttributeManager().attributes,d=n||o,p=d&&i.attributes&&i.attributes[d.id];if(p&&p.value){const h=p.value,A=this.encodePickingColor(e);for(let R=0;R<i.length;R++){const B=d.getVertexOffset(R);h[B]===A[0]&&h[B+1]===A[1]&&h[B+2]===A[2]&&this._disablePickingIndex(R)}}else this._disablePickingIndex(e)}_disablePickingIndex(e){const{pickingColors:i,instancePickingColors:n}=this.getAttributeManager().attributes,o=i||n;if(!o)return;const d=o.getVertexOffset(e),p=o.getVertexOffset(e+1);o.buffer.write(new Uint8Array(p-d),d)}restorePickingColors(){const{pickingColors:e,instancePickingColors:i}=this.getAttributeManager().attributes,n=e||i;n&&(this.internalState.usesPickingColorCache&&n.value.buffer!==po.buffer&&(n.value=po.subarray(0,n.value.length)),n.updateSubBuffer({startOffset:0}))}_initialize(){fs(!this.internalState),aa(d6,this);const e=this._getAttributeManager();e&&e.addInstanced({instancePickingColors:{type:"uint8",size:4,noAlloc:!0,update:this.calculateInstancePickingColors}}),this.internalState=new u6({attributeManager:e,layer:this}),this._clearChangeFlags(),this.state={},Object.defineProperty(this.state,"attributeManager",{get:()=>(On.deprecated("layer.state.attributeManager","layer.getAttributeManager()")(),e)}),this.internalState.uniformTransitions=new Bz(this.context.timeline),this.internalState.onAsyncPropUpdated=this._onAsyncPropUpdated.bind(this),this.internalState.setAsyncProps(this.props),this.initializeState(this.context);for(const i of this.props.extensions)i.initializeState.call(this,this.context,i);this.setChangeFlags({dataChanged:"init",propsChanged:"init",viewportChanged:!0,extensionsChanged:!0}),this._update()}_transferState(e){aa(m6,this,this===e);const{state:i,internalState:n}=e;this!==e&&(this.internalState=n,this.state=i,this.internalState.setAsyncProps(this.props),this._diffProps(this.props,this.internalState.getOldProps()))}
2234_update(){const e=this.needsUpdate();if(aa(f6,this,e),!e)return;this.context.stats.get("Layer updates").incrementCount();const i=this.props,n=this.context,o=this.internalState,d=n.viewport,p=this._updateUniformTransition();o.propsInTransition=p,n.viewport=o.viewport||d,this.props=p;try{const h=this._getUpdateParams(),A=this.getModels();if(n.device)this.updateState(h);else try{this.updateState(h)}catch{}for(const B of this.props.extensions)B.updateState.call(this,h,B);this.setNeedsRedraw(),this._updateAttributes();const R=this.getModels()[0]!==A[0];this._postUpdate(h,R)}finally{n.viewport=d,this.props=i,this._clearChangeFlags(),o.needsUpdate=!1,o.resetOldProps()}}_finalize(){aa(p6,this),this.finalizeState(this.context);for(const e of this.props.extensions)e.finalizeState.call(this,this.context,e)}_drawLayer({renderPass:e,shaderModuleProps:i=null,uniforms:n={},parameters:o={}}){this._updateAttributeTransition();const d=this.props,p=this.context;this.props=this.internalState.propsInTransition||d;try{i&&this.setShaderModuleProps(i);const{getPolygonOffset:h}=this.props,A=h&&h(n)||[0,0];p.device instanceof Md&&p.device.setParametersWebGL({polygonOffset:A});const R=p.device instanceof Md?null:v6(o);if(b6(this.getModels(),e,o,R),p.device instanceof Md)p.device.withParametersWebGL(o,()=>{const B={renderPass:e,shaderModuleProps:i,uniforms:n,parameters:o,context:p};for(const N of this.props.extensions)N.draw.call(this,B,N);this.draw(B)});else{R!=null&&R.renderPassParameters&&e.setParameters(R.renderPassParameters);const B={renderPass:e,shaderModuleProps:i,uniforms:n,parameters:o,context:p};for(const N of this.props.extensions)N.draw.call(this,B,N);this.draw(B)}}finally{this.props=d}}getChangeFlags(){var e;return(e=this.internalState)==null?void 0:e.changeFlags}setChangeFlags(e){if(!this.internalState)return;const{changeFlags:i}=this.internalState;for(const o in e)if(e[o]){let d=!1;switch(o){case"dataChanged":const p=e[o],h=i[o];p&&Array.isArray(h)&&(i.dataChanged=Array.isArray(p)?h.concat(p):p,d=!0);default:i[o]||(i[o]=e[o],d=!0)}d&&aa(h6,this,o,e)}const n=!!(i.dataChanged||i.updateTriggersChanged||i.propsChanged||i.extensionsChanged);i.propsOrDataChanged=n,i.somethingChanged=n||i.viewportChanged||i.stateChanged}_clearChangeFlags(){this.internalState.changeFlags={dataChanged:!1,propsChanged:!1,updateTriggersChanged:!1,viewportChanged:!1,stateChanged:!1,extensionsChanged:!1,propsOrDataChanged:!1,somethingChanged:!1}}_diffProps(e,i){var o;const n=zz(e,i);if(n.updateTriggersChanged)for(const d in n.updateTriggersChanged)n.updateTriggersChanged[d]&&this.invalidateAttribute(d);if(n.transitionsChanged)for(const d in n.transitionsChanged)this.internalState.uniformTransitions.add(d,i[d],e[d],(o=e.transitions)==null?void 0:o[d]);return this.setChangeFlags(n)}validateProps(){Nz(this.props)}updateAutoHighlight(e){this.props.autoHighlight&&!Number.isInteger(this.props.highlightedObjectIndex)&&this._updateAutoHighlight(e)}_updateAutoHighlight(e){const i={highlightedObjectColor:e.picked?e.color:null},{highlightColor:n}=this.props;e.picked&&typeof n=="function"&&(i.highlightColor=n(e)),this.setShaderModuleProps({picking:i}),this.setNeedsRedraw()}_getAttributeManager(){const e=this.context;return new Pz(e.device,{id:this.props.id,stats:e.stats,timeline:e.timeline})}_postUpdate(e,i){const{props:n,oldProps:o}=e,d=this.state.model;d!=null&&d.isInstanced&&d.setInstanceCount(this.getNumInstances());const{autoHighlight:p,highlightedObjectIndex:h,highlightColor:A}=n;if(i||o.autoHighlight!==p||o.highlightedObjectIndex!==h||o.highlightColor!==A){const R={};Array.isArray(A)&&(R.highlightColor=A),(i||o.autoHighlight!==p||h!==o.highlightedObjectIndex)&&(R.highlightedObjectColor=Number.isFinite(h)&&h>=0?this.encodePickingColor(h):null),this.setShaderModuleProps({picking:R})}}_getUpdateParams(){return{props:this.props,oldProps:this.internalState.getOldProps(),context:this.context,changeFlags:this.internalState.changeFlags}}_getNeedsRedraw(e){if(!this.internalState)return!1;let i=!1;i=i||this.internalState.needsRedraw&&this.id;const n=this.getAttributeManager(),o=n?n.getNeedsRedraw(e):!1;if(i=i||o,i)for(const d of this.props.extensions)d.onNeedsRedraw.call(this,d);return this.internalState.needsRedraw=this.internalState.needsRedraw&&!e.clearRedrawFlags,i}_onAsyncPropUpdated(){this._diffProps(this.props,this.internalState.getOldProps()),this.setNeedsUpdate()}}gv.defaultProps=y6;gv.layerName="Layer";function v6(t){const{blendConstant:e,...i}=t;return e?{pipelineParameters:i,renderPassParameters:{blendConstant:e}}:{pipelineParameters:i}}function b6(t,e,i,n){for(const o of t)o.device.type==="webgpu"?(x6(o,e),o.setParameters({...o.parameters,...n==null?void 0:n.pi
2234pelineParameters})):o.setParameters(i)}function x6(t,e){var p,h;const i=e.props.framebuffer||(e.framebuffer??null);if(!i)return;const n=i.colorAttachments.map(A=>{var R;return((R=A==null?void 0:A.texture)==null?void 0:R.format)??null}),o=(h=(p=i.depthStencilAttachment)==null?void 0:p.texture)==null?void 0:h.format,d=t;(!w6(d.props.colorAttachmentFormats,n)||d.props.depthStencilAttachmentFormat!==o)&&(d.props.colorAttachmentFormats=n,d.props.depthStencilAttachmentFormat=o,d._setPipelineNeedsUpdate("attachment formats"))}function w6(t,e){if(t===e)return!0;if(!t||!e||t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0}class T6{constructor(e){this.indexStarts=[0],this.vertexStarts=[0],this.vertexCount=0,this.instanceCount=0;const{attributes:i={}}=e;this.typedArrayManager=dp,this.attributes={},this._attributeDefs=i,this.opts=e,this.updateGeometry(e)}updateGeometry(e){Object.assign(this.opts,e);const{data:i,buffers:n={},getGeometry:o,geometryBuffer:d,positionFormat:p,dataChanged:h,normalize:A=!0}=this.opts;if(this.data=i,this.getGeometry=o,this.positionSize=d&&d.size||(p==="XY"?2:3),this.buffers=n,this.normalize=A,d&&(fs(i.startIndices),this.getGeometry=this.getGeometryFromBuffer(d),A||(n.vertexPositions=d)),this.geometryBuffer=n.vertexPositions,Array.isArray(h))for(const R of h)this._rebuildGeometry(R);else this._rebuildGeometry()}updatePartialGeometry({startRow:e,endRow:i}){this._rebuildGeometry({startRow:e,endRow:i})}getGeometryFromBuffer(e){const i=e.value||e;return ArrayBuffer.isView(i)?yA(i,{size:this.positionSize,offset:e.offset,stride:e.stride,startIndices:this.data.startIndices}):null}_allocate(e,i){const{attributes:n,buffers:o,_attributeDefs:d,typedArrayManager:p}=this;for(const h in d)if(h in o)p.release(n[h]),n[h]=null;else{const A=d[h];A.copy=i,n[h]=p.allocate(n[h],e,A)}}_forEachGeometry(e,i,n){const{data:o,getGeometry:d}=this,{iterable:p,objectInfo:h}=gA(o,i,n);for(const A of p){h.index++;const R=d?d(A,h):null;e(R,h.index)}}_rebuildGeometry(e){if(!this.data)return;let{indexStarts:i,vertexStarts:n,instanceCount:o}=this;const{data:d,geometryBuffer:p}=this,{startRow:h=0,endRow:A=1/0}=e||{},R={};if(e||(i=[0],n=[0]),this.normalize||!p)this._forEachGeometry((N,F)=>{const Q=N&&this.normalizeGeometry(N);R[F]=Q,n[F+1]=n[F]+(Q?this.getGeometrySize(Q):0)},h,A),o=n[n.length-1];else if(n=d.startIndices,o=n[d.length]||0,ArrayBuffer.isView(p))o=o||p.length/this.positionSize;else if(p instanceof En){const N=this.positionSize*4;o=o||p.byteLength/N}else if(p.buffer){const N=p.stride||this.positionSize*4;o=o||p.buffer.byteLength/N}else if(p.value){const N=p.value,F=p.stride/N.BYTES_PER_ELEMENT||this.positionSize;o=o||N.length/F}this._allocate(o,!!e),this.indexStarts=i,this.vertexStarts=n,this.instanceCount=o;const B={};this._forEachGeometry((N,F)=>{const Q=R[F]||N;B.vertexStart=n[F],B.indexStart=i[F];const re=F<n.length-1?n[F+1]:o;B.geometrySize=re-n[F],B.geometryIndex=F,this.updateGeometryAttributes(Q,B)},h,A),this.vertexCount=i[i.length-1]}}const fT=`layout(std140) uniform lineUniforms { 2235 float widthScale; 2236 float widthMinPixels; 2237 float widthMaxPixels; 2238 float useShortestPath; 2239 highp int widthUnits; 2240} line; 2241`,S6={name:"line",source:"",vs:fT,fs:fT,uniformTypes:{widthScale:"f32",widthMinPixels:"f32",widthMaxPixels:"f32",useShortestPath:"f32",widthUnits:"i32"}},A6=`// ---------- Helper Structures & Functions ---------- 2242 2243// Placeholder filter functions. 2244fn deckgl_filter_size(offset: vec3<f32>, geometry: Geometry) -> vec3<f32> { 2245 return offset; 2246} 2247fn deckgl_filter_gl_position(p: vec4<f32>, geometry: Geometry) -> vec4<f32> { 2248 if (picking.isAttribute > 0.5) { 2249 // For depth picking, write normalized depth into the picking payload. 2250 // This mirrors the legacy DECKGL_FILTER_GL_POSITION hook on WebGL. 2251 } 2252 return p; 2253} 2254 2255// Compute an extrusion offset given a line direction (in clipspace), 2256// an offset direction (-1 or 1), and a width in pixels. 2257// Assumes a uniform "project" with a viewportSize field is available. 2258fn getExtrusionOffset(line_clipspace: vec2<f32>, offset_direction: f32, width: f32) -> vec2<f32> { 2259 // project.viewportSize should be provided as a uniform (not shown here) 2260 let dir_screenspace = normalize(line_clipspace * project.viewportSize); 2261 // Rotate by 90°: (x,y) becomes (-y,x) 2262 let rotated = vec2<f32>(-dir_screenspace.y, dir_screenspace.x); 2263 return rotated * offset_direction * width / 2.0; 2264} 2265 2266// Splits the line between two points at a given x coordinate. 2267// Interpolates the y and z components. 2268fn splitLine(a: vec3<f32>, b: vec3<f32>, x: f32) -> vec3<f32> { 2269 let t: f32 = (x - a.x) / (b.x - a.x); 2270 return vec3<f32>(x, a.yz + t * (b.yz - a.yz)); 2271} 2272 2273// ---------- Uniforms & Global Structures ---------- 2274 2275struct LineUniforms { 2276 widthScale: f32, 2277 widthMinPixels: f32, 2278 widthMaxPixels: f32, 2279 useShortestPath: f32, 2280 widthUnits: i32, 2281}; 2282 2283@group(0) @binding(0) 2284var<uniform> line: LineUniforms; 2285 2286 2287 2288// ---------- Vertex Output Structure ---------- 2289
2290struct Varyings { 2291 @builtin(position) gl_Position: vec4<f32>, 2292 @location(0) vColor: vec4<f32>, 2293 @location(1) uv: vec2<f32>, 2294 @location(2) pickingColor: vec3<f32>, 2295}; 2296 2297// ---------- Vertex Shader Entry Point ---------- 2298 2299@vertex 2300fn vertexMain( 2301 @location(0) positions: vec3<f32>, 2302 @location(1) instanceSourcePositions: vec3<f32>, 2303 @location(2) instanceTargetPositions: vec3<f32>, 2304 @location(3) instanceSourcePositions64Low: vec3<f32>, 2305 @location(4) instanceTargetPositions64Low: vec3<f32>, 2306 @location(5) instanceColors: vec4<f32>, 2307 @location(6) instancePickingColors: vec3<f32>, 2308 @location(7) instanceWidths: f32 2309) -> Varyings { 2310 geometry.worldPosition = instanceSourcePositions; 2311 geometry.worldPositionAlt = instanceTargetPositions; 2312 2313 var source_world: vec3<f32> = instanceSourcePositions; 2314 var target_world: vec3<f32> = instanceTargetPositions; 2315 var source_world_64low: vec3<f32> = instanceSourcePositions64Low; 2316 var target_world_64low: vec3<f32> = instanceTargetPositions64Low; 2317 2318 // Apply shortest-path adjustments if needed. 2319 if (line.useShortestPath > 0.5 || line.useShortestPath < -0.5) { 2320 source_world.x = (source_world.x + 180.0 % 360.0) - 180.0; 2321 target_world.x = (target_world.x + 180.0 % 360.0) - 180.0; 2322 let deltaLng: f32 = target_world.x - source_world.x; 2323 2324 if (deltaLng * line.useShortestPath > 180.0) { 2325 source_world.x = source_world.x + 360.0 * line.useShortestPath; 2326 source_world = splitLine(source_world, target_world, 180.0 * line.useShortestPath); 2327 source_world_64low = vec3<f32>(0.0, 0.0, 0.0); 2328 } else if (deltaLng * line.useShortestPath < -180.0) { 2329 target_world.x = target_world.x + 360.0 * line.useShortestPath; 2330 target_world = splitLine(source_world, target_world, 180.0 * line.useShortestPath); 2331 target_world_64low = vec3<f32>(0.0, 0.0, 0.0); 2332 } else if (line.useShortestPath < 0.0) { 2333 var abortOut: Varyings; 2334 abortOut.gl_Position = vec4<f32>(0.0); 2335 abortOut.vColor = vec4<f32>(0.0); 2336 abortOut.uv = vec2<f32>(0.0); 2337 return abortOut; 2338 } 2339 } 2340 2341 // Project Pos and target positions to clip space. 2342 let sourceResult = project_position_to_clipspace_and_commonspace(source_world, source_world_64low, vec3<f32>(0.0)); 2343 let targetResult = project_position_to_clipspace_and_commonspace(target_world, target_world_64low, vec3<f32>(0.0)); 2344 let sourcePos: vec4<f32> = sourceResult.clipPosition; 2345 let targetPos: vec4<f32> = targetResult.clipPosition; 2346 let source_commonspace: vec4<f32> = sourceResult.commonPosition; 2347 let target_commonspace: vec4<f32> = targetResult.commonPosition; 2348 2349 // Interpolate along the line segment. 2350 let segmentIndex: f32 = positions.x; 2351 let p: vec4<f32> = sourcePos + segmentIndex * (targetPos - sourcePos); 2352 geometry.position = source_commonspace + segmentIndex * (target_commonspace - source_commonspace); 2353 let uv: vec2<f32> = positions.xy; 2354 geometry.uv = uv; 2355 geometry.pickingColor = instancePickingColors; 2356 2357 // Determine width in pixels. 2358 let widthPixels: f32 = clamp( 2359 project_unit_size_to_pixel(instanceWidths * line.widthScale, line.widthUnits), 2360 line.widthMinPixels, line.widthMaxPixels 2361 ); 2362 2363 // Compute extrusion offset. 2364 let extrusion: vec2<f32> = getExtrusionOffset(targetPos.xy - sourcePos.xy, positions.y, widthPixels); 2365 let offset: vec3<f32> = vec3<f32>(extrusion, 0.0); 2366 2367 // Apply deck.gl filter functions. 2368 let filteredOffset = deckgl_filter_size(offset, geometry); 2369 let filteredP = deckgl_filter_gl_position(p, geometry); 2370 2371 let clipOffset: vec2<f32> = project_pixel_size_to_clipspace(filteredOffset.xy); 2372 let finalPosition: vec4<f32> = filteredP + vec4<f32>(clipOffset, 0.0, 0.0); 2373 2374 // Compute color. 2375 var vColor: vec4<f32> = vec4<f32>(instanceColors.rgb, instanceColors.a * layer.opacity); 2376 // vColor = deckgl_filter_color(vColor, geometry); 2377 2378 var output: Varyings; 2379 output.gl_Position = finalPosition; 2380 output.vColor = vColor; 2381 output.uv = uv; 2382 output.pickingColor = instancePickingColors; 2383 return output; 2384} 2385 2386@fragment 2387fn fragmentMain( 2388 @location(0) vColor: vec4<f32>, 2389 @location(1) uv: vec2<f32>, 2390 @location(2) pickingColor: vec3<f32> 2391) -> @location(0) vec4<f32> { 2392 // Create and initialize geometry with the provided uv. 2393 var geometry: Geometry; 2394 geometry.uv = uv; 2395 2396 // Start with the input color. 2397 var fragColor: vec4<f32> = vColor; 2398 2399 if (picking.isActive > 0.5) { 2400 if (!picking_isColorValid(pickingColor)) { 2401 discard; 2402 } 2403 return vec4<f32>(pickingColor, 1.0); 2404 } 2405 2406 if (picking.isHighlightActive > 0.5) { 2407 let highlightedObjectColor = picking_normalizeColor(picking.highlightedObjectColor); 2408 if (picking_isColorZero(abs(pickingColor - highlightedObjectColor))) { 2409 let highLightAlpha = picking.highlightColor.a; 2410 let blendedAlpha = highLightAlpha + fragColor.a * (1.0 - highLightAlpha); 2411 if (blendedAlpha > 0.0) { 2412 let highLightRatio = highLightAlpha / blendedAlpha; 2413 fragColor = vec4<f32>( 2414 mix(fragColor.rgb, picking.highlightColor.rgb, highLightRatio), 2415 blendedAlpha 2416 ); 2417 } else { 2418 fragColor = vec4<f32>(fragColor.rgb, 0.0); 2419 } 2420 } 2421 } 2422 2423 // Apply premultiplied alpha as required by transparent canvas 2424 fragColor = deckgl_premultiplied_alpha(fragColor); 2425 2426 return fragColor; 2427} 2428`,E6=`#version 300 es 2429#define SHADER_NAME line-layer-vertex-shader 2430in vec3 positions; 2431in vec3 instanceSourcePositions; 2432in vec3 instanceTargetPositions; 2433in vec3 instanceSourcePositions64Low; 2434in vec3 instanceTargetPositions64Low; 2435in vec4 instanceColors; 2436in vec3 instancePickingColors; 2437in float instanceWidths; 2438out vec4 vColor; 2439out vec2 uv; 2440vec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction, float width) {
2441vec2 dir_screenspace = normalize(line_clipspace * project.viewportSize); 2442dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x); 2443return dir_screenspace * offset_direction * width / 2.0; 2444} 2445vec3 splitLine(vec3 a, vec3 b, float x) { 2446float t = (x - a.x) / (b.x - a.x); 2447return vec3(x, mix(a.yz, b.yz, t)); 2448} 2449void main(void) { 2450geometry.worldPosition = instanceSourcePositions; 2451geometry.worldPositionAlt = instanceTargetPositions; 2452vec3 source_world = instanceSourcePositions; 2453vec3 target_world = instanceTargetPositions; 2454vec3 source_world_64low = instanceSourcePositions64Low; 2455vec3 target_world_64low = instanceTargetPositions64Low; 2456if (line.useShortestPath > 0.5 || line.useShortestPath < -0.5) { 2457source_world.x = mod(source_world.x + 180., 360.0) - 180.; 2458target_world.x = mod(target_world.x + 180., 360.0) - 180.; 2459float deltaLng = target_world.x - source_world.x; 2460if (deltaLng * line.useShortestPath > 180.) { 2461source_world.x += 360. * line.useShortestPath; 2462source_world = splitLine(source_world, target_world, 180. * line.useShortestPath); 2463source_world_64low = vec3(0.0); 2464} else if (deltaLng * line.useShortestPath < -180.) { 2465target_world.x += 360. * line.useShortestPath; 2466target_world = splitLine(source_world, target_world, 180. * line.useShortestPath); 2467target_world_64low = vec3(0.0); 2468} else if (line.useShortestPath < 0.) { 2469gl_Position = vec4(0.); 2470return; 2471} 2472} 2473vec4 source_commonspace; 2474vec4 target_commonspace; 2475vec4 source = project_position_to_clipspace(source_world, source_world_64low, vec3(0.), source_commonspace); 2476vec4 target = project_position_to_clipspace(target_world, target_world_64low, vec3(0.), target_commonspace); 2477float segmentIndex = positions.x; 2478vec4 p = mix(source, target, segmentIndex); 2479geometry.position = mix(source_commonspace, target_commonspace, segmentIndex); 2480uv = positions.xy; 2481geometry.uv = uv; 2482geometry.pickingColor = instancePickingColors; 2483float widthPixels = clamp( 2484project_size_to_pixel(instanceWidths * line.widthScale, line.widthUnits), 2485line.widthMinPixels, line.widthMaxPixels 2486); 2487vec3 offset = vec3( 2488getExtrusionOffset(target.xy - source.xy, positions.y, widthPixels), 24890.0); 2490DECKGL_FILTER_SIZE(offset, geometry); 2491DECKGL_FILTER_GL_POSITION(p, geometry); 2492gl_Position = p + vec4(project_pixel_size_to_clipspace(offset.xy), 0.0, 0.0); 2493vColor = vec4(instanceColors.rgb, instanceColors.a * layer.opacity); 2494DECKGL_FILTER_COLOR(vColor, geometry); 2495} 2496`,C6=`#version 300 es 2497#define SHADER_NAME line-layer-fragment-shader 2498precision highp float; 2499in vec4 vColor; 2500in vec2 uv; 2501out vec4 fragColor; 2502void main(void) { 2503geometry.uv = uv; 2504fragColor = vColor; 2505DECKGL_FILTER_COLOR(fragColor, geometry); 2506} 2507`,R6=[0,0,0,255],M6={getSourcePosition:{type:"accessor",value:t=>t.sourcePosition},getTargetPosition:{type:"accessor",value:t=>t.targetPosition},getColor:{type:"accessor",value:R6},getWidth:{type:"accessor",value:1},widthUnits:"pixels",widthScale:{type:"number",value:1,min:0},widthMinPixels:{type:"number",value:0,min:0},widthMaxPixels:{type:"number",value:Number.MAX_SAFE_INTEGER,min:0}};class wx extends gv{getBounds(){var e;return(e=this.getAttributeManager())==null?void 0:e.getBounds(["instanceSourcePositions","instanceTargetPositions"])}getShaders(){return super.getShaders({vs:E6,fs:C6,source:A6,modules:[A2,hD,I2,S6]})}get wrapLongitude(){return!1}initializeState(){this.getAttributeManager().addInstanced({instanceSourcePositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:!0,accessor:"getSourcePosition"},instanceTargetPositions:{size:3,type:"float64",fp64:this.use64bitPositions(),transition:!0,accessor:"getTargetPosition"},instanceColors:{size:this.props.colorFormat.length,type:"unorm8",transition:!0,accessor:"getColor",defaultValue:[0,0,0,255]},instanceWidths:{size:1,transition:!0,accessor:"getWidth",defaultValue:1}})}updateState(e){var i;super.updateState(e),e.changeFlags.extensionsChanged&&((i=this.state.model)==null||i.destroy(),this.state.model=this._getModel(),this.getAttributeManager().invalidateAll())}draw({uniforms:e}){const{widthUnits:i,widthScale:n,widthMinPixels:o,widthMaxPixels:d,wrapLongitude:p}=this.props,h=this.state.model,A={widthUnits:lp[i],widthScale:n,widthMinPixels:o,widthMaxPixels:d,useShortestPath:p?1:0};h.shaderInputs.setProps({line:A}),h.draw(this.context.renderPass),p&&(h.shaderInputs.setProps({line:{...A,useShortestPath:-1}}),h.draw(this.context.renderPass))}_getModel(){const e=[0,-1,0,0,1,0,1,-1,0,1,1,0];
vendor: 6,329 bytes, lines 2507-2573
2507return new pp(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new $2({topology:"triangle-strip",attributes:{positions:{size:3,value:new Float32Array(e)}}}),isInstanced:!0})}}wx.layerName="LineLayer";wx.defaultProps=M6;function G_(t,e){const i=e.length,n=t.length;if(n>0){let o=!0;for(let d=0;d<i;d++)if(t[n-i+d]!==e[d]){o=!1;break}if(o)return!1}for(let o=0;o<i;o++)t[n+o]=e[o];return!0}function pT(t,e){const i=e.length;for(let n=0;n<i;n++)t[n]=e[n]}function mT(t,e,i,n,o=[]){const d=n+e*i;for(let p=0;p<i;p++)o[p]=t[d+p];return o}function gT(t,e,i,n,o=[]){let d,p;if(i&8)d=(n[3]-t[1])/(e[1]-t[1]),p=3;else if(i&4)d=(n[1]-t[1])/(e[1]-t[1]),p=1;else if(i&2)d=(n[2]-t[0])/(e[0]-t[0]),p=2;else if(i&1)d=(n[0]-t[0])/(e[0]-t[0]),p=0;else return null;for(let h=0;h<t.length;h++)o[h]=(p&1)===h?n[p]:d*(e[h]-t[h])+t[h];return o}function Eb(t,e){let i=0;return t[0]<e[0]?i|=1:t[0]>e[2]&&(i|=2),t[1]<e[1]?i|=4:t[1]>e[3]&&(i|=8),i}function PA(t,e){const{size:i=2,broken:n=!1,gridResolution:o=10,gridOffset:d=[0,0],startIndex:p=0,endIndex:h=t.length}=e||{},A=(h-p)/i;let R=[];const B=[R],N=mT(t,0,i,p);let F,Q;const re=P6(N,o,d,[]),se=[];G_(R,N);for(let ae=1;ae<A;ae++){for(F=mT(t,ae,i,p,F),Q=Eb(F,re);Q;){gT(N,F,Q,re,se);const me=Eb(se,re);me&&(gT(N,se,me,re,se),Q=me),G_(R,se),pT(N,se),I6(re,o,Q),n&&R.length>i&&(R=[],B.push(R),G_(R,N)),Q=Eb(F,re)}G_(R,F),pT(N,F)}return n?B:B[0]}function P6(t,e,i,n){const o=Math.floor((t[0]-i[0])/e)*e+i[0],d=Math.floor((t[1]-i[1])/e)*e+i[1];return n[0]=o,n[1]=d,n[2]=o+e,n[3]=d+e,n}function I6(t,e,i){i&8?(t[1]+=e,t[3]+=e):i&4?(t[1]-=e,t[3]-=e):i&2?(t[0]+=e,t[2]+=e):i&1&&(t[0]-=e,t[2]-=e)}function D6(t,e){const{size:i=2,startIndex:n=0,endIndex:o=t.length,normalize:d=!0}=e||{},p=t.slice(n,o);O6(p,i,0,o-n);const h=PA(p,{size:i,broken:!0,gridResolution:360,gridOffset:[-180,-180]});if(d)for(const A of h)k6(A,i);return h}function O6(t,e,i,n){let o=t[0],d;for(let p=i;p<n;p+=e){d=t[p];const h=d-o;(h>180||h<-180)&&(d-=Math.round(h/360)*360),t[p]=o=d}}function k6(t,e){let i;const n=t.length/e;for(let d=0;d<n&&(i=t[d*e],(i+180)%360===0);d++);const o=-Math.round(i/360)*360;if(o!==0)for(let d=0;d<n;d++)t[d*e]+=o}function B6(t,e,i,n){let o;if(Array.isArray(t[0])){const d=t.length*e;o=new Array(d);for(let p=0;p<t.length;p++)for(let h=0;h<e;h++)o[p*e+h]=t[p][h]||0}else o=t;return i?PA(o,{size:e,gridResolution:i}):n?D6(o,{size:e}):o}const N6=1,z6=2,Cb=4;class L6 extends T6{constructor(e){super({...e,attributes:{positions:{size:3,padding:18,initialize:!0,type:e.fp64?Float64Array:Float32Array},segmentTypes:{size:1,type:Uint8ClampedArray}}})}get(e){return this.attributes[e]}getGeometryFromBuffer(e){return this.normalize?super.getGeometryFromBuffer(e):null}normalizeGeometry(e){return this.normalize?B6(e,this.positionSize,this.opts.resolution,this.opts.wrapLongitude):e}getGeometrySize(e){if(_T(e)){let n=0;for(const o of e)n+=this.getGeometrySize(o);return n}const i=this.getPathLength(e);return i<2?0:this.isClosed(e)?i<3?0:i+2:i}updateGeometryAttributes(e,i){if(i.geometrySize!==0)if(e&&_T(e))for(const n of e){const o=this.getGeometrySize(n);i.geometrySize=o,this.updateGeometryAttributes(n,i),i.vertexStart+=o}else this._updateSegmentTypes(e,i),this._updatePositions(e,i)}_updateSegmentTypes(e,i){const n=this.attributes.segmentTypes,o=e?this.isClosed(e):!1,{vertexStart:d,geometrySize:p}=i;n.fill(0,d,d+p),o?(n[d]=Cb,n[d+p-2]=Cb):(n[d]+=N6,n[d+p-2]+=z6),n[d+p-1]=Cb}_updatePositions(e,i){const{positions:n}=this.attributes;if(!n||!e)return;const{vertexStart:o,geometrySize:d}=i,p=new Array(3);for(let h=o,A=0;A<d;h++,A++)this.getPointOnPath(e,A,p),n[h*3]=p[0],n[h*3+1]=p[1],n[h*3+2]=p[2]}getPathLength(e){return e.length/this.positionSize}getPointOnPath(e,i,n=[]){const{positionSize:o}=this;i*o>=e.length&&(i+=1-e.length/o);const d=i*o;return n[0]=e[d],n[1]=e[d+1],n[2]=o===3&&e[d+2]||0,n}isClosed(e){if(!this.normalize)return!!this.opts.loop;const{positionSize:i}=this,n=e.length-i;return e[0]===e[n]&&e[1]===e[n+1]&&(i===2||e[2]===e[n+2])}}function _T(t){return Array.isArray(t[0])}const yT=`layout(std140) uniform pathUniforms { 2508 float widthScale; 2509 float widthMinPixels; 2510 float widthMaxPixels; 2511 float jointType; 2512 float capType; 2513 float miterLimit; 2514 bool billboard; 2515 highp int widthUnits; 2516} path; 2517`,F6={name:"path",vs:yT,fs:yT,uniformTypes:{widthScale:"f32",widthMinPixels:"f32",widthMaxPixels:"f32",jointType:"f32",capType:"f32",miterLimit:"f32",billboard:"f32",widthUnits:"i32"}},U6=`#version 300 es 2518#define SHADER_NAME path-layer-vertex-shader 2519in vec2 positions; 2520in float instanceTypes; 2521in vec3 instanceStartPositions; 2522in vec3 instanceEndPositions; 2523in vec3 instanceLeftPositions; 2524in vec3 instanceRightPositions; 2525in vec3 instanceLeftPositions64Low; 2526in vec3 instanceStartPositions64Low; 2527in vec3 instanceEndPositions64Low; 2528in vec3 instanceRightPositions64Low; 2529in float instanceStrokeWidths; 2530in vec4 instanceColors; 2531in vec3 instancePickingColors; 2532uniform float opacity; 2533out vec4 vColor; 2534out vec2 vCornerOffset; 2535out float vMiterLength; 2536out vec2 vPathPosition; 2537out float vPathLength; 2538out float vJointType; 2539const float EPSILON = 0.001; 2540const vec3 ZERO_OFFSET = vec3(0.0); 2541float flipIfTrue(bool flag) { 2542return -(float(flag) * 2. - 1.); 2543} 2544vec3 getLineJoinOffset( 2545vec3 prevPoint, vec3 currPoint, vec3 nextPoint, 2546vec2 width 2547) { 2548bool isEnd = positions.x > 0.0; 2549float sideOfPath = positions.y; 2550float isJoint = float(sideOfPath == 0.0); 2551vec3 deltaA3 = (currPoint - prevPoint); 2552vec3 deltaB3 = (nextPoint - currPoint); 2553mat3 rotationMatrix; 2554bool needsRotation = !path.billboard && project_needs_rotation(currPoint, rotationMatrix); 2555if (needsRotation) { 2556deltaA3 = deltaA3 * rotationMatrix; 2557deltaB3 = deltaB3 * rotationMatrix; 2558} 2559vec2 deltaA = deltaA3.xy / width; 2560vec2 deltaB = deltaB3.xy / width; 2561float lenA = length(deltaA); 2562float lenB = length(deltaB); 2563vec2 dirA = lenA > 0. ? normalize(deltaA) : vec2(0.0, 0.0); 2564vec2 dirB = lenB > 0. ? normalize(deltaB) : vec2(0.0, 0.0); 2565vec2 perpA = vec2(-dirA.y, dirA.x); 2566vec2 perpB = vec2(-dirB.y, dirB.x); 2567vec2 tangent = dirA + dirB; 2568tangent = length(tangent) > 0. ? normalize(tangent) : perpA; 2569vec2 miterVec = vec2(-tangent.y, tangent.x); 2570vec2 dir = isEnd ? dirA : dirB; 2571vec2 perp = isEnd ? perpA : perpB; 2572float L = isEnd ? lenA : lenB; 2573float sinHalfA = abs(dot(miterVec, perp));
2574float cosHalfA = abs(dot(dirA, miterVec)); 2575float turnDirection = flipIfTrue(dirA.x * dirB.y >= dirA.y * dirB.x); 2576float cornerPosition = sideOfPath * turnDirection; 2577float miterSize = 1.0 / max(sinHalfA, EPSILON); 2578miterSize = mix( 2579min(miterSize, max(lenA, lenB) / max(cosHalfA, EPSILON)), 2580miterSize, 2581step(0.0, cornerPosition) 2582); 2583vec2 offsetVec = mix(miterVec * miterSize, perp, step(0.5, cornerPosition)) 2584* (sideOfPath + isJoint * turnDirection); 2585bool isStartCap = lenA == 0.0 || (!isEnd && (instanceTypes == 1.0 || instanceTypes == 3.0)); 2586bool isEndCap = lenB == 0.0 || (isEnd && (instanceTypes == 2.0 || instanceTypes == 3.0)); 2587bool isCap = isStartCap || isEndCap; 2588if (isCap) { 2589offsetVec = mix(perp * sideOfPath, dir * path.capType * 4.0 * flipIfTrue(isStartCap), isJoint); 2590vJointType = path.capType; 2591} else { 2592vJointType = path.jointType; 2593} 2594vPathLength = L; 2595vCornerOffset = offsetVec; 2596vMiterLength = dot(vCornerOffset, miterVec * turnDirection); 2597vMiterLength = isCap ? isJoint : vMiterLength; 2598vec2 offsetFromStartOfPath = vCornerOffset + deltaA * float(isEnd); 2599vPathPosition = vec2( 2600dot(offsetFromStartOfPath, perp), 2601dot(offsetFromStartOfPath, dir) 2602); 2603geometry.uv = vPathPosition; 2604float isValid = step(instanceTypes, 3.5); 2605vec3 offset = vec3(offsetVec * width * isValid, 0.0); 2606if (needsRotation) { 2607offset = rotationMatrix * offset; 2608} 2609return offset; 2610} 2611void clipLine(inout vec4 position, vec4 refPosition) { 2612if (position.w < EPSILON) { 2613float r = (EPSILON - refPosition.w) / (position.w - refPosition.w); 2614position = refPosition + (position - refPosition) * r; 2615} 2616} 2617void main() { 2618geometry.pickingColor = instancePickingColors; 2619vColor = vec4(instanceColors.rgb, instanceColors.a * layer.opacity); 2620float isEnd = positions.x; 2621vec3 prevPosition = mix(instanceLeftPositions, instanceStartPositions, isEnd); 2622vec3 prevPosition64Low = mix(instanceLeftPositions64Low, instanceStartPositions64Low, isEnd); 2623vec3 currPosition = mix(instanceStartPositions, instanceEndPositions, isEnd); 2624vec3 currPosition64Low = mix(instanceStartPositions64Low, instanceEndPositions64Low, isEnd); 2625vec3 nextPosition = mix(instanceEndPositions, instanceRightPositions, isEnd); 2626vec3 nextPosition64Low = mix(instanceEndPositions64Low, instanceRightPositions64Low, isEnd); 2627geometry.worldPosition = currPosition; 2628vec2 widthPixels = vec2(clamp( 2629project_size_to_pixel(instanceStrokeWidths * path.widthScale, path.widthUnits), 2630path.widthMinPixels, path.widthMaxPixels) / 2.0); 2631vec3 width; 2632if (path.billboard) { 2633vec4 prevPositionScreen = project_position_to_clipspace(prevPosition, prevPosition64Low, ZERO_OFFSET); 2634vec4 currPositionScreen = project_position_to_clipspace(currPosition, currPosition64Low, ZERO_OFFSET, geometry.position); 2635vec4 nextPositionScreen = project_position_to_clipspace(nextPosition, nextPosition64Low, ZERO_OFFSET); 2636clipLine(prevPositionScreen, currPositionScreen); 2637clipLine(nextPositionScreen, currPositionScreen); 2638clipLine(currPositionScreen, mix(nextPositionScreen, prevPositionScreen, isEnd)); 2639width = vec3(widthPixels, 0.0); 2640DECKGL_FILTER_SIZE(width, geometry); 2641vec3 offset = getLineJoinOffset( 2642prevPositionScreen.xyz / prevPositionScreen.w, 2643currPositionScreen.xyz / currPositionScreen.w, 2644nextPositionScreen.xyz / nextPositionScreen.w, 2645project_pixel_size_to_clipspace(width.xy) 2646); 2647DECKGL_FILTER_GL_POSITION(currPositionScreen, geometry); 2648gl_Position = vec4(currPositionScreen.xyz + offset * currPositionScreen.w, currPositionScreen.w); 2649} else { 2650prevPosition = project_position(prevPosition, prevPosition64Low); 2651currPosition = project_position(currPosition, currPosition64Low); 2652nextPosition = project_position(nextPosition, nextPosition64Low); 2653width = vec3(project_pixel_size(widthPixels), 0.0); 2654DECKGL_FILTER_SIZE(width, geometry); 2655vec3 offset = getLineJoinOffset(prevPosition, currPosition, nextPosition, width.xy); 2656geometry.position = vec4(currPosition + offset, 1.0); 2657gl_Position = project_common_position_to_clipspace(geometry.position); 2658DECKGL_FILTER_GL_POSITION(gl_Position, geometry); 2659} 2660DECKGL_FILTER_COLOR(vColor, geometry); 2661} 2662`,j6=`#version 300 es 2663#define SHADER_NAME path-layer-fragment-shader 2664precision highp float; 2665in vec4 vColor; 2666in vec2 vCornerOffset; 2667in float vMiterLength; 2668in vec2 vPathPosition; 2669in float vPathLength; 2670in float vJointType; 2671out vec4 fragColor; 2672void main(void) { 2673geometry.uv = vPathPosition; 2674if (vPathPosition.y < 0.0 || vPathPosition.y > vPathLength) { 2675if (vJointType > 0.5 && length(vCornerOffset) > 1.0) { 2676discard; 2677} 2678if (vJointType < 0.5 && vMiterLength > path.miterLimit + 1.0) { 2679discard; 2680} 2681} 2682fragColor = vColor; 2683DECKGL_FILTER_COLOR(fragColor, geometry); 2684}
2685`,IA=[0,0,0,255],V6={widthUnits:"meters",widthScale:{type:"number",min:0,value:1},widthMinPixels:{type:"number",min:0,value:0},widthMaxPixels:{type:"number",min:0,value:Number.MAX_SAFE_INTEGER},jointRounded:!1,capRounded:!1,miterLimit:{type:"number",min:0,value:4},billboard:!1,_pathType:null,getPath:{type:"accessor",value:t=>t.path},getColor:{type:"accessor",value:IA},getWidth:{type:"accessor",value:1},rounded:{deprecatedFor:["jointRounded","capRounded"]}},Rb={enter:(t,e)=>e.length?e.subarray(e.length-t.length):t};class Tx extends gv{getShaders(){return super.getShaders({vs:U6,fs:j6,modules:[A2,I2,F6]})}get wrapLongitude(){return!1}getBounds(){var e;return(e=this.getAttributeManager())==null?void 0:e.getBounds(["vertexPositions"])}initializeState(){this.getAttributeManager().addInstanced({vertexPositions:{size:3,vertexOffset:1,type:"float64",fp64:this.use64bitPositions(),transition:Rb,accessor:"getPath",update:this.calculatePositions,noAlloc:!0,shaderAttributes:{instanceLeftPositions:{vertexOffset:0},instanceStartPositions:{vertexOffset:1},instanceEndPositions:{vertexOffset:2},instanceRightPositions:{vertexOffset:3}}},instanceTypes:{size:1,type:"uint8",update:this.calculateSegmentTypes,noAlloc:!0},instanceStrokeWidths:{size:1,accessor:"getWidth",transition:Rb,defaultValue:1},instanceColors:{size:this.props.colorFormat.length,type:"unorm8",accessor:"getColor",transition:Rb,defaultValue:IA},instancePickingColors:{size:4,type:"uint8",accessor:(n,{index:o,target:d})=>this.encodePickingColor(n&&n.__source?n.__source.index:o,d)}}),this.setState({pathTesselator:new L6({fp64:this.use64bitPositions()})})}updateState(e){var p;super.updateState(e);const{props:i,changeFlags:n}=e,o=this.getAttributeManager();if(n.dataChanged||n.updateTriggersChanged&&(n.updateTriggersChanged.all||n.updateTriggersChanged.getPath)){const{pathTesselator:h}=this.state,A=i.data.attributes||{};h.updateGeometry({data:i.data,geometryBuffer:A.getPath,buffers:A,normalize:!i._pathType,loop:i._pathType==="loop",getGeometry:i.getPath,positionFormat:i.positionFormat,wrapLongitude:i.wrapLongitude,resolution:this.context.viewport.resolution,dataChanged:n.dataChanged}),this.setState({numInstances:h.instanceCount,startIndices:h.vertexStarts}),n.dataChanged||o.invalidateAll()}n.extensionsChanged&&((p=this.state.model)==null||p.destroy(),this.state.model=this._getModel(),o.invalidateAll())}getPickingInfo(e){const i=super.getPickingInfo(e),{index:n}=i,o=this.props.data;return o[0]&&o[0].__source&&(i.object=o.find(d=>d.__source.index===n)),i}disablePickingIndex(e){const i=this.props.data;if(i[0]&&i[0].__source)for(let n=0;n<i.length;n++)i[n].__source.index===e&&this._disablePickingIndex(n);else super.disablePickingIndex(e)}draw({uniforms:e}){const{jointRounded:i,capRounded:n,billboard:o,miterLimit:d,widthUnits:p,widthScale:h,widthMinPixels:A,widthMaxPixels:R}=this.props,B=this.state.model,N={jointType:Number(i),capType:Number(n),billboard:o,widthUnits:lp[p],widthScale:h,miterLimit:d,widthMinPixels:A,widthMaxPixels:R};B.shaderInputs.setProps({path:N}),B.draw(this.context.renderPass)}_getModel(){const e=[0,1,2,1,4,2,1,3,4,3,5,4],i=[0,0,0,-1,0,1,1,-1,1,1,1,0];return new pp(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new $2({topology:"triangle-list",attributes:{indices:new Uint16Array(e),positions:{value:new Float32Array(i),size:2}}}),isInstanced:!0})}calculatePositions(e){const{pathTesselator:i}=this.state;e.startIndices=i.vertexStarts,e.value=i.get("positions")}calculateSegmentTypes(e){const{pathTesselator:i}=this.state;e.startIndices=i.vertexStarts,e.value=i.get("segmentTypes")}}Tx.defaultProps=V6;Tx.layerName="PathLayer";const vT=t=>{let e;const i=new Set,n=(R,B)=>{const N=typeof R=="function"?R(e):R;if(!Object.is(N,e)){const F=e;e=B??(typeof N!="object"||N===null)?N:Object.assign({},e,N),i.forEach(Q=>Q(e,F))}},o=()=>e,h={setState:n,getState:o,getInitialState:()=>A,subscribe:R=>(i.add(R),()=>i.delete(R))},A=e=t(n,o,h);return h},$6=(t=>t?vT(t):vT),H6=t=>t;function W6(t,e=H6){const i=R_.useSyncExternalStore(t.subscribe,R_.useCallback(()=>e(t.getState()),[t,e]),R_.useCallback(()=>e(t.getInitialState()),[t,e]));return R_.useDebugValue(i),i}const bT=t=>{const e=$6(t),i=n=>W6(e,n);return Object.assign(i,e),i},X6=(t=>t?bT(t):bT),q6={dark:"#515a6d",light:"#9e968a"},Z6={dark:{heatmap:["#256abf","#3987e5","#6da7ec","#9ec5f4","#cde2fb"],frontier:"#eda100",oneWay:["#be4b1d","#d15421","#e15a24","#f76730","#f88d68","#faac90"],bothWays:["#256abf","#3579cd","#4a86cf","#5598e7","#79b0ef","#9ec5f4"]},light:{heatmap:["#5b52e8","#4a34c9","#3822a0","#261577","#170a4d"],frontier:"#c07a00",oneWay:["#b5471b","#a44017","#8f3713","#7d2f0f","#6e280c","#581e07"],bothWays:["#5b52e8","#5346d9","#4a34c9","#4029b4","#3822a0","#2b1a80"]}},k0="um.theme",Y6="https://s3.amazonaws.com/elevation-tiles-prod/terrarium/{z}/{x}/{y}.png",Mb={dark:["https://tiles.openfreemap.org/styles/dark","https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json"],light:["https://tiles.openfreemap.org/styles/positron","https://basemaps.cartocdn.com/gl/positron-gl-style/style.json"]};function G6(){var t;return(t=window.matchMedia)!=null&&t.call(window,"(prefers-color-scheme: light)").matches?"light":"dark"}function xT(){const t=localStorage.getItem(k0);return t==="light"||t==="dark"?t:"system"}function DA(t){return t==="system"?G6():t}function OA(t){document.documentElement.dataset.theme=t,document.documentElement.style.colorScheme=t}function K6(t){t==="system"?localStorage.removeItem(k0):localStorage.setItem(k0,t)}function Q6(t){var n;const e=(n=window.matchMedia)==null?void 0:n.call(window,"(prefers-color-scheme: light)");if(!e)return()=>{};const i=()=>t(e.matches?"light":"dark");
2685return e.addEventListener("change",i),()=>e.removeEventListener("change",i)}const wT=(t,e)=>{if(!t)return null;const i=t.split(",");if(i.length!==e||i.some(o=>o.trim()===""))return null;const n=i.map(Number);return n.every(Number.isFinite)?n:null};function TT(t){if(!t||t.trim()==="")return;const e=Number(t);if(Number.isFinite(e))return e;const i=Date.parse(/^\d{4}-\d{2}-\d{2}$/.test(t)?`${t}T00:00:00Z`:t);return Number.isFinite(i)?Math.floor(i/1e3):void 0}function Sx(t){const e=new URLSearchParams(t.replace(/^#/,"")),i={},n=TT(e.get("t0")),o=TT(e.get("t1"));n!==void 0&&(i.t0=o!==void 0?Math.min(n,o):n),o!==void 0&&(i.t1=n!==void 0?Math.max(n,o):o);const d=e.get("g");if(d){const B=[...new Set(d.split(",").map(Number))].filter(N=>Number.isInteger(N)&&N>=0&&N<=4).sort((N,F)=>N-F);B.length&&(i.groups=B)}const p=e.get("m");(p==="heatmap"||p==="exploration")&&(i.mode=p),e.get("vp")==="1"&&(i.viewportFilter=!0),e.get("fit")==="1"&&(i.fitToSelection=!0),e.get("fitplay")==="1"&&(i.fitWhilePlaying=!0),e.get("noskip")==="1"&&(i.skipEmptyDays=!1),e.get("inview")==="1"&&(i.skipOutsideBounds=!0);const h=e.get("u");(h==="mi"||h==="km")&&(i.units=h),e.get("d")==="1"&&(i.drawerOpen=!0),e.get("play")==="1"&&(i.playing=!0);let A=null;const R=wT(e.get("b"),4);if(R&&R[0]!==R[2]&&R[1]!==R[3])A={kind:"bounds",bounds:[Math.min(R[0],R[2]),Math.min(R[1],R[3]),Math.max(R[0],R[2]),Math.max(R[1],R[3])]};else{const B=wT(e.get("map"),3);B&&(A={kind:"center",center:[B[0],B[1]],zoom:B[2]})}return{view:i,camera:A}}function kA(t,e,i,n){if(t===void 0&&e===void 0)return null;let o=t??i,d=e??n;const p=d-o;return p>
2685=n-i?[i,n]:(o<i&&(o=i,d=i+p),d>n&&(d=n,o=n-p),[o,d])}const BA=86400;function Ax(t){const e=new URLSearchParams;return e.set("t0",String(Math.round(t.t0))),e.set("t1",String(Math.round(t.t1))),e.set("g",t.groups.join(",")),e.set("m",t.mode),t.viewportFilter&&e.set("vp","1"),t.fitToSelection&&e.set("fit","1"),t.fitWhilePlaying&&e.set("fitplay","1"),t.skipEmptyDays||e.set("noskip","1"),t.skipOutsideBounds&&e.set("inview","1"),e.set("u",t.units),t.drawerOpen&&e.set("d","1"),t.playing&&e.set("play","1"),e}const di=X6((t,e)=>({load:"loading",theme:DA(xT()),themeChoice:xT(),hillshade:localStorage.getItem("um.hillshade")==="1",loadError:"",paramsWarning:"",manifest:null,activities:[],t0:0,t1:0,minTs:0,maxTs:0,groups:[0,1,2,3,4],mode:"exploration",viewportFilter:!1,fitToSelection:!1,fitWhilePlaying:!1,units:"mi",drawerOpen:!1,filtersOpen:!0,statsOpen:!0,playing:!1,playhead:null,speed:1,skipEmptyDays:!0,skipOutsideBounds:!1,viewBounds:null,replayReverse:!1,actSpans:null,maxVisit:1,activeActivity:null,stats:{distinctM:0,newM:0,totalM:0,activityCount:0},extras:null,set:i=>t(i),setWindow:(i,n)=>t({t0:Math.min(i,n),t1:Math.max(i,n),playhead:null,playing:!1}),toggleGroup:i=>{const n=e().groups,o=n.includes(i)?n.filter(d=>d!==i):[...n,i].sort();t({groups:o.length?o:n})}}));function J6(t,e){const i=di.getState(),{view:n}=Sx(location.hash),o=e+BA,d=kA(n.t0,n.t1,t,o);di.setState({minTs:t,maxTs:e,t0:(d==null?void 0:d[0])??t,t1:(d==null?void 0:d[1])??o,groups:n.groups??i.groups,mode:n.mode??i.mode,viewportFilter:n.viewportFilter??i.viewportFilter,fitToSelection:n.fitToSelection??i.fitToSelection,fitWhilePlaying:n.fitWhilePlaying??i.fitWhilePlaying,skipEmptyDays:n.skipEmptyDays??i.skipEmptyDays,skipOutsideBounds:n.skipOutsideBounds??i.skipOutsideBounds,units:n.units??i.units,drawerOpen:n.drawerOpen??i.drawerOpen,playing:n.playing??!1})}const Ex="um.camera";function eL(t){try{sessionStorage.setItem(Ex,t.map(e=>e.toFixed(5)).join(","))}catch{}}function tL(){try{sessionStorage.removeItem(Ex)}catch{}}function iL(){var t;try{const e=(t=sessionStorage.getItem(Ex))==null?void 0:t.split(",").map(Number);return!e||e.length!==4||!e.every(Number.isFinite)?null:{kind:"bounds",bounds:[e[0],e[1],e[2],e[3]]}}catch{return null}}function nL(t,e,i=!1){const n=Ax(di.getState());return t&&e&&n.set("b",e.map(o=>o.toFixed(4)).join(",")),i?n.set("play","1"):n.delete("play"),`${location.origin}${location.pathname}${location.search}#${n.toString()}`}let ST;function rL(t){const e=()=>{const i=di.getState();if(i.load!=="ready")return;history.replaceState(null,"",`#${Ax(i).toString()}`);const n=t();n&&eL(n)};return di.subscribe(()=>{clearTimeout(ST),ST=window.setTimeout(e,250)})}const sL=(()=>{const{view:t,camera:e}=Sx(location.hash);return e||(t.t0!==void 0||t.t1!==void 0?null:iL())})();function NA(){return sL}const aL={viewportFilter:!1,fitToSelection:!1,fitWhilePlaying:!1,skipEmptyDays:!0,skipOutsideBounds:!1,drawerOpen:!1,playing:!1};function oL(t){const e=()=>{const i=di.getState();if(i.load!=="ready"||location.hash.replace(/^#/,"")===Ax(i).toString())return;const{view:n,camera:o}=Sx(location.hash);if(Object.keys(n).length===0&&!o)return;const d=kA(n.t0,n.t1,i.minTs,i.maxTs+BA);di.setState({...aL,...n,...d?{t0:d[0],t1:d[1]}:{},playhead:null}),t(o)};return window.addEventListener("hashchange",e),()=>window.removeEventListener("hashchange",e)}const zA={mi:1609.344,km:1e3},cy=(t,e)=>{const i=t/zA[e];return i>=1e3?i.toLocaleString(void 0,{maximumFractionDigits:0}):i.toFixed(1)},lL=t=>({version:8,sources:{},layers:[{id:"bg",type:"background",paint:{"background-color":t==="light"?"#f4f4f1":"#1b1f27"}}]}),cL=t=>{for(const e of t.getStyle().layers??[])if("source-layer"in e&&e["source-layer"]==="transportation")return e.source},uL=1,hL=600,dL=12e3,oh=32,fL=10,pL=22,AT=()=>{var t;return(t=window.matchMedia)!=null&&t.call(window,"(pointer: coarse)").matches?pL:fL};function Pb(t,e,i){t.fitBounds(e,{...i,essential:!0})}function mL({onReady:t,onViewportChange:e,onHover:i,onPick:n}){const o=He.useRef(null),d=He.useRef(null),p=He.useRef(null),h=He.useRef(!1),A=He.useRef(null),R=He.useRef(null),B=He.useRef(null),N=He.useRef(null),F=He.useRef(0),Q=He.useRef(null),re=He.useRef(0),se=He.useRef(null),ae=di(Te=>Te.mode),me=di(Te=>Te.theme),we=di(Te=>Te.hillshade),ve=()=>{const Te=R.current,Re=B.current;if(!Te||!Re||!Q.current)return;const{mode:Ee,theme:Je}=di.getState(),rt=Ee==="heatmap",Qe=[new wx({id:"coverage",data:{length:Re.n,attributes:{getSourcePosition:{value:Re.src,size:2},getTargetPosition:{value:Re.dst,size:2},getColor:{value:Q.current,size:4,normalized:!0}}},widthUnits:"meters",getWidth:7,widthMinPixels:2.4,widthMaxPixels:8,pickable:!0,parameters:rt&&Je==="dark"?{blend:!0,blendColorSrcFactor:"src-alpha",blendColorDstFactor:"one",blendColorOperation:"add"}:{},updateTriggers:{getColor:re.current}})];se.current&&se.current.length>1&&Qe.push(new Tx({id:"active",data:[{path:se.current}],getPath:ht=>ht.path,getColor:[255,255,245,235],widthUnits:"meters",getWidth:12,widthMinPixels:2.5,capRounded:!0,jointRounded:!0}
2685)),Te.setProps({layers:Qe})};He.useEffect(()=>{if(!o.current||!d.current||A.current)return;const Te=o.current,Re=NA(),Ee=new Gx.Map({container:Te,style:Mb[di.getState().theme][F.current],...(Re==null?void 0:Re.kind)==="bounds"?{bounds:Re.bounds,fitBoundsOptions:{padding:oh}}:{center:(Re==null?void 0:Re.center)??[-98,39],zoom:(Re==null?void 0:Re.zoom)??3},attributionControl:{compact:!0}});A.current=Ee,(Re==null?void 0:Re.kind)==="bounds"&&(N.current=Re.bounds),Ee.dragRotate.disable(),Ee.touchZoomRotate.disableRotation(),Ee.touchPitch.disable();let Je=0,rt;const Ke=()=>Mb[di.getState().theme],Qe=ot=>{window.clearTimeout(rt);const si=Ke(),pi=F.current+1;if(pi>=si.length){Ee.setStyle(lL(di.getState().theme));return}F.current=pi,Je=0,Fe()};let ht=!1;const At=()=>{window.clearTimeout(rt),rt=window.setTimeout(()=>{ht||document.visibilityState==="visible"&&Qe()},dL)},Fe=()=>{const ot=Ke()[F.current];ot&&(ht=!1,Ee.setStyle(ot),At())};Ee.on("sourcedata",ot=>{!ot.isSourceLoaded||ot.sourceId==="um-dem"||(ht=!0,window.clearTimeout(rt))});const Dt=()=>{document.visibilityState==="visible"&&!ht&&At()};document.addEventListener("visibilitychange",Dt),Ee.on("error",ot=>{var pi;if((((pi=ot.error)==null?void 0:pi.url)??"")===Ke()[F.current]){if(Je<uL){Je+=1,window.setTimeout(Fe,hL*Je);return}Qe()}}),Ee.on("styledata",()=>{Ee.isStyleLoaded()&&(Je=0)}),At();const Le=new bx({canvas:d.current,controller:!1,viewState:{longitude:Ee.getCenter().lng,latitude:Ee.getCenter().lat,zoom:Ee.getZoom(),bearing:Ee.getBearing(),pitch:Ee.getPitch()},layers:[]});R.current=Le;const nt=()=>{const ot=Ee.getCenter();Le.setProps({viewState:{longitude:ot.lng,latitude:ot.lat,zoom:Ee.getZoom(),bearing:Ee.getBearing(),pitch:Ee.getPitch()}}),Le.isInitialized&&Le.redraw()};Ee.on("render",nt),Ee.on("movestart",ot=>{ot.originalEvent&&(N.current=null)});const mt=new ResizeObserver(()=>{Ee.resize();const ot=N.current;ot&&Ee.fitBounds([[ot[0],ot[1]],[ot[2],ot[3]]],{padding:oh,duration:0,essential:!0}),nt()});mt.observe(Te),Ee.on("moveend",e),Ee.addControl(new Gx.NavigationControl({showCompass:!1}),"bottom-right");const ei=ot=>{if(h.current||ot.pointerType==="touch")return;const si=Te.getBoundingClientRect(),pi=ot.clientX-si.left,Cn=ot.clientY-si.top,_e=Ee.unproject([pi,Cn]),Pt=156543.03392*Math.cos(_e.lat*Math.PI/180)/Math.pow(2,Ee.getZoom());i({lng:_e.lng,lat:_e.lat,radiusM:Pt*AT(),x:pi,y:Cn})},ai=()=>i(null);Te.addEventListener("pointermove",ei),Te.addEventListener("pointerleave",ai);let oe=null,Ue=!1;const ut=(ot,si)=>{const pi=p.current;pi&&(pi.style.display="block",pi.style.left=`${Math.min(ot.x,si.x)}px`,pi.style.top=`${Math.min(ot.y,si.y)}px`,pi.style.width=`${Math.abs(ot.x-si.x)}px`,pi.style.height=`${Math.abs(ot.y-si.y)}px`)},Tt=()=>{oe=null,h.current=!1,p.current&&(p.current.style.display="none"),Ee.dragPan.enable()},$t=ot=>{if(!(ot.metaKey||ot.ctrlKey)||ot.button!==0)return;const si=Te.getBoundingClientRect();oe={x:ot.clientX-si.left,y:ot.clientY-si.top},h.current=!0,Ee.dragPan.disable(),i(null),ot.preventDefault()},qt=ot=>{if(!oe)return;const si=Te.getBoundingClientRect();ut(oe,{x:ot.clientX-si.left,y:ot.clientY-si.top})},ti=ot=>{if(!oe)return;const si=Te.getBoundingClientRect(),pi={x:ot.clientX-si.left,y:ot.clientY-si.top},Cn=oe,_e=Math.abs(Cn.x-pi.x)>8&&Math.abs(Cn.y-pi.y)>8;Tt(),_e&&(Ue=!0,Pb(Ee,[Ee.unproject([Cn.x,Cn.y]),Ee.unproject([pi.x,pi.y])],{padding:24,duration:400}))},Li=ot=>{ot.key==="Escape"&&oe&&Tt()},ki=ot=>{h.current&&ot.preventDefault()};Te.addEventListener("pointerdown",$t),window.addEventListener("pointermove",qt),window.addEventListener("pointerup",ti),window.addEventListener("keydown",Li),Te.addEventListener("contextmenu",ki),Ee.on("click",ot=>{if(Ue){Ue=!1;return}const si=156543.03392*Math.cos(ot.lngLat.lat*Math.PI/180)/Math.pow(2,Ee.getZoom());n({lng:ot.lngLat.lng,lat:ot.lngLat.lat,radiusM:si*AT(),x:ot.point.x,y:ot.point.y})});const Er={setColors:(ot,si)=>{Q.current=ot,re.current=si,ve()},setGeometry:(ot,si,pi)=>{B.current={src:ot,dst:si,n:pi},ve()},setActivePath:ot=>{se.current=ot,ve()},getViewport:()=>{const ot=Ee.getBounds();return{minX:qx(ot.getWest())*100,maxX:qx(ot.getEast())*100,minY:Zx(ot.getSouth())*100,maxY:Zx(ot.getNorth())*100}},getBounds:()=>{const ot=Ee.getBounds(),si=Ee.getContainer(),pi=si.clientWidth>2*oh?(ot.getEast()-ot.getWest())*oh/si.clientWidth:0,Cn=si.clientHeight>2*oh?(ot.getNorth()-ot.getSouth())*oh/si.clientHeight:0;return[ot.getWest()+pi,ot.getSouth()+Cn,ot.getEast()-pi,ot.getNorth()-Cn]},flyToBounds:(ot,si=900)=>{N.current=ot,Pb(Ee,[[ot[0],ot[1]],[ot[2],ot[3]]],{padding:oh,duration:si})},setHovering:ot=>{Ee.getCanvas().style.cursor=ot?"pointer":""},fitIfNeeded:ot=>{const si=Ee.getBounds(),pi=ot[0]>=si.getWest()&&ot[2]<=si.getEast()&&ot[1]>=si.getSouth()&&ot[3]<=si.getNorth(),Cn=si.getEast()-si.getWest(),_e=si.getNorth()-si.getSouth(),Pt=(ot[2]-ot[0])/(Cn||1)>.3&&(ot[3]-ot[1])/(_e||1)>.3;pi&&Pt||(N.current=ot,Pb(Ee,[[ot[0],ot[1]],[ot[2],ot[3]]],{padding:oh,duration:700}))}};Ee.once("load",()=>t(Er));const Ts=window.setTimeout(()=>t(Er),4e3);return()=>{window.clearTimeout(rt),document.removeEventListener("visibilitychange",Dt),mt.disconnect(),window.clearTimeout(Ts),Te.removeEventListener("pointermove",ei),Te.removeEventListener("pointerleave",ai),Te.removeEventListener("pointerdown",$t),window.removeEventListener("pointermove",qt),window.removeEventListener("pointerup",ti),window.removeEventListener("keydown",Li),Te.removeEventListener("contextmenu",ki),Le.finalize(),R.current=null,Ee.remove(),A.current=null}},[]),He.useEffect(ve,[ae,me]),He.useEffect(()=>{const Te=A.current;if(!Te)return;const Re=()=>{var Ke,Qe;if(!Te.isStyleLoaded())return;const Ee=!!Te.getLayer("um-hillshade");if(!we){Ee&&Te.removeLayer("um-hillshade"),Te.getSource("um-dem")&&Te.removeSource("um-dem");return}if(Ee)return;Te.getSource("um-dem")||Te.addSource("um-dem",{type:"raster-dem",tiles:[Y
26856],encoding:"terrarium",tileSize:256,maxzoom:13,attribution:'Elevation: <a href="https://registry.opendata.aws/terrain-tiles/">AWS Terrain Tiles</a>'});const Je=(Qe=(Ke=Te.getStyle().layers)==null?void 0:Ke.find(ht=>ht.type==="symbol"))==null?void 0:Qe.id,rt=Te.getLayer("um-trails")?"um-trails":Je;Te.addLayer({id:"um-hillshade",type:"hillshade",source:"um-dem",paint:{"hillshade-exaggeration":me==="light"?.6:.45,"hillshade-shadow-color":me==="light"?"#46505f":"#000000","hillshade-highlight-color":me==="light"?"#ffffff":"#9db0cf","hillshade-accent-color":me==="light"?"#6f7885":"#0a0d12"}},rt)};return Re(),Te.on("styledata",Re),Te.on("idle",Re),()=>{Te.off("styledata",Re),Te.off("idle",Re)}},[we,me]),He.useEffect(()=>{const Te=A.current;if(!Te)return;const Re=()=>{var rt,Ke;if(!Te.isStyleLoaded()||Te.getLayer("um-trails"))return;const Ee=cL(Te);if(!Ee)return;const Je=(Ke=(rt=Te.getStyle().layers)==null?void 0:rt.find(Qe=>Qe.type==="symbol"))==null?void 0:Ke.id;Te.addLayer({id:"um-trails",type:"line",source:Ee,"source-layer":"transportation",filter:["all",["match",["geometry-type"],["LineString","MultiLineString"],!0,!1],["match",["get","class"],["path","track"],!0,!1]],layout:{"line-cap":"butt","line-join":"round"},paint:{"line-color":q6[me],"line-dasharray":[2,1.6],"line-width":["interpolate",["exponential",1.2],["zoom"],13,1.1,16,1.7,20,4.5]}},Je)};return Re(),Te.on("styledata",Re),Te.on("idle",Re),()=>{Te.off("styledata",Re),Te.off("idle",Re)}},[me]);const Oe=He.useRef(null);return He.useEffect(()=>{const Te=A.current;if(Te){if(Oe.current===null){Oe.current=me;return}Oe.current!==me&&(Oe.current=me,F.current=0,Te.setStyle(Mb[me][0]))}},[me]),j.jsxs("div",{style:{position:"absolute",inset:0},children:[j.jsx("div",{ref:o,style:{position:"absolute",inset:0}}),j.jsx("canvas",{ref:d,style:{position:"absolute",inset:0,width:"100%",height:"100%",pointerEvents:"none"}}),j.jsx("div",{ref:p,className:"zoom-box"})]})}function gL(){const t=di(A=>A.mode),e=di(A=>A.theme),i=di(A=>A.maxVisit),n=Z6[e],o=t==="exploration",d=1,p=Math.max(d,i),h=o?[{label:"one way only",stops:n.oneWay},{label:"both ways",stops:n.bothWays}]:[{label:"",stops:n.heatmap}];return j.jsxs(j.Fragment,{children:[j.jsx("hr",{className:"rule"}),j.jsx("h2",{style:{margin:"0 0 8px"},children:o?"Exploration":"Visits"}),h.map(({label:A,stops:R})=>j.jsxs("div",{style:{marginBottom:o?9:0},children:[A&&j.jsx("div",{style:{color:"var(--text-secondary)",marginBottom:4},children:A}),j.jsx("div",{"aria-hidden":!0,style:{height:8,borderRadius:3,background:`linear-gradient(to right, ${R.join(", ")})`,border:"1px solid var(--panel-border)"}})]},A)),j.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginTop:4,color:"var(--text-muted)",fontSize:11,fontVariantNumeric:"tabular-nums"},children:[j.jsx("span",{children:"1 visit"}),j.jsx("span",{children:p<=d?"":`${p.toLocaleString()}+`})]})]})}function _L(){const{manifest:t,activities:e,groups:i,mode:n,filtersOpen:o,hillshade:d}=di(),p=di(R=>R.toggleGroup),h=di(R=>R.set),A=He.useMemo(()=>{const R=new Map;for(const B of e)R.set(B.group,(R.get(B.group)??0)+1);return R},[e]);return t?j.jsxs("div",{className:"panel",children:[j.jsxs("h2",{children:["Filters",j.jsx("button",{onClick:()=>h({filtersOpen:!o}),"aria-label":"Toggle filters",children:o?"â":"+"})]}),o&&j.jsxs(j.Fragment,{children:[j.jsx("div",{style:{marginBottom:10},children:t.sportGroups.map((R,B)=>{const N=A.get(B)??0;return N===0?null:j.jsxs("label",{className:"check",children:[j.jsx("input",{type:"checkbox",checked:i.includes(B),onChange:()=>p(B)}),j.jsx("span",{style:{textTransform:"capitalize"},children:R}),j.jsx("span",{className:"count",children:N.toLocaleString()})]},R)})}),j.jsx("hr",{className:"rule"}),j.jsx("h2",{style:{margin:"0 0 6px"},children:"Map mode"}),j.jsxs("div",{style:{display:"flex",gap:6},children:[j.jsx("button",{className:"chip","aria-pressed":n==="exploration",onClick:()=>h({mode:"exploration"}),children:"Exploration"}),j.jsx("button",{className:"chip","aria-pressed":n==="heatmap",onClick:()=>h({mode:"heatmap"}),children:"Heatmap"})]}),j.jsxs("label",{className:"check",style:{marginTop:10},title:"Shaded relief from AWS Terrain Tiles",children:[j.jsx("input",{type:"checkbox",checked:d,onChange:()=>{const R=!d;localStorage.setItem("um.hillshade",R?"1":"0"),h({hillshade:R})}}),j.jsx("span",{children:"Terrain"})]}),j.jsx(gL,{})]})]}):null}function yL({onClose:t}){return j.jsx("div",{style:{position:"absolute",inset:0,background:"var(--scrim)",zIndex:100,display:"grid",placeItems:"center"},onClick:t,children:j.jsxs("div",{className:"panel",style:{position:"relative",maxWidth:620,maxHeight:"80vh",overflow:"auto",padding:"18px 22px"},onClick:e=>e.stopPropagation(),children:[j.jsxs("h2",{children:["How this is calculated",j.jsx("button",{onClick:t,"aria-label":"Close",children:"Ã"})]}),j.jsxs("div",{style:{color:"var(--text-secondary)",lineHeight:1.65},children:[j.jsxs("p",{children:[j.jsx("strong",{style:{color:"var(--text-primary)"},children:"Distinct ground"})," is how much non-overlapping ground you covered inside the current selection, ignoring everything outside it. A road run forty times in one year counts once."]}),j.jsxs("p",{children:[j.jsx("strong",{style:{color:"var(--frontier)"},children:"New ground"})," is how much of that was ground you had never covered before, at any point in y
2685our history. It can never exceed distinct ground."]}),j.jsx("p",{children:"Every activity is resampled to a point every 8 metres, and those points are matched against everywhere you have already been. Ground within about 20 metres of a previous pass counts as the same ground; beyond about 30 metres it counts as new. The gap between is deliberate: it is what stops years of GPS wobble along a familiar road from slowly inventing new mileage."}),j.jsx("h3",{style:{color:"var(--text-primary)",fontSize:13,marginBottom:4},children:"Known limitations"}),j.jsxs("ul",{style:{paddingLeft:18,margin:0},children:[j.jsx("li",{children:"Paths less than about 20 metres apart merge. A separated bike path beside a road counts as the road."}),j.jsx("li",{children:"Switchback legs 10 to 20 metres apart merge unless the activity recorded barometric altitude, and they merge near every turn regardless. This is a genuine limitation of measuring coverage from GPS geometry alone."}),j.jsx("li",{children:"Roads 20 to 30 metres apart earn nothing; between 30 and about 40 they earn partial, permanent credit. Full credit resumes past roughly 40 to 45 metres."}),j.jsx("li",{children:"Genuinely new fragments shorter than 24 metres are never credited."}),j.jsx("li",{children:"Small closed loops, under about 100 metres around, are only partially credited."}),j.jsx("li",{children:"Trainer, manual, virtual and GPS-less activities are excluded from every number here, including total logged, so these totals will not match Strava's."})]}),j.jsx("p",{style:{marginBottom:0,color:"var(--text-muted)"},children:"Every one of these is bounded, deterministic, and the same every time you rebuild."})]})]})})}function vL(){const{stats:t,units:e,viewportFilter:i,statsOpen:n,drawerOpen:o}=di(),d=di(B=>B.set),[p,h]=He.useState(!1),A=t.activityCount===0,R=t.totalM&&t.totalM>0?1-t.distinctM/t.totalM:null;return j.jsxs(j.Fragment,{children:[j.jsxs("div",{className:"panel",children:[j.jsxs("h2",{children:[i?"Stats · map view":"Stats",j.jsx("button",{onClick:()=>d({statsOpen:!n}),"aria-label":"Toggle stats",children:n?"â":"+"})]}),n&&j.jsxs(j.Fragment,{children:[A?j.jsx("div",{style:{color:"var(--text-muted)",padding:"6px 0 10px"},children:"No activities in this selection"}):j.jsxs(j.Fragment,{children:[j.jsxs("div",{style:{display:"flex",gap:16,marginBottom:10},children:[j.jsxs("div",{children:[j.jsx("div",{className:"stat-value",children:cy(t.distinctM,e)}),j.jsxs("div",{className:"stat-label",children:["distinct ground (",e,")"]})]}),j.jsxs("div",{children:[j.jsx("div",{className:"stat-value",style:{color:"var(--frontier)"},children:cy(t.newM,e)}),j.jsxs("div",{className:"stat-label",children:["new ground (",e,")"]})]})]}),j.jsx("hr",{className:"rule"}),j.jsxs("div",{className:"stat-sub",children:[j.jsx("span",{children:"Total logged"}),j.jsx("span",{children:t.totalM===null?"â":`${cy(t.totalM,e)} ${e}`})]}),j.jsxs("div",{className:"stat-sub",children:[j.jsx("span",{children:"Repeat ratio"}),j.jsx("span",{children:R===null?"â":`${Math.round(R*100)}%`})]}),j.jsxs("div",{className:"stat-sub",children:[j.jsx("span",{children:"Activities"}),j.jsx("span",{children:t.activityCount.toLocaleString()})]})]}),j.jsx("hr",{className:"rule"}),j.jsxs("label",{className:"check",children:[j.jsx("input",{type:"checkbox",checked:i,onChange:B=>d({viewportFilter:B.target.checked})}),j.jsx("span",{children:"Limit stats to map view"})]}),i&&j.jsx("div",{style:{color:"var(--text-muted)",fontSize:11,paddingLeft:22},children:"Total logged is hidden: an activity's distance has no position to clip."}),j.jsxs("div",{style:{display:"flex",gap:6,marginTop:10,alignItems:"center"},children:[j.jsx("button",{className:"ghost",onClick:()=>d({drawerOpen:!o}),children:o?"Hide charts":"Stats and charts"}),j.jsx("button",{className:"chip",onClick:()=>d({units:e==="mi"?"km":"mi"}),"aria-label":"Toggle units",children:e})]}),j.jsx("button",{className:"ghost",style:{marginTop:6,width:"100%",border:"none",background:"none",color:"var(--text-muted)",textAlign:"left",padding:"2px 0"},onClick:()=>h(!0),children:"How this is calculated"})]})]}),p&&j.jsx(yL,{onClose:()=>h(!1)})]})}const LA=180,bL=.35,ET=1.2;function xL(t){if(t<=0)return ET;const e=LA/t;return Math.min(ET,Math.max(bL,e))}
2685function wL(t,e,i,n){return Math.max(1,e-t)}function TL(t,e,i=!1){if(t.length===0||e===null)return{i:0,t:0};let n=0;if(i)for(;n<t.length-1&&t[n].from>e;)n++;else for(;n<t.length-1&&t[n].to<e;)n++;const o=t[n],d=o.to-o.from;if(!(d>0))return{i:n,t:0};const p=i?(o.to-e)/d:(e-o.from)/d;return{i:n,t:Math.min(.999,Math.max(0,p))}}function SL(t,e,i,n,o,d){const p=t[e.i];if(!p)return{cue:e,playhead:0,done:!0};const h=e.t+i/Math.max(n,1e-6),A=p.to-p.from;if(h<1){const re=d?p.to-A*h:p.from+A*h;return{cue:{i:e.i,t:h},playhead:re,done:!1}}const R=e.i+1;if(R>=t.length)return{cue:e,playhead:d?p.from:p.to,done:!0};const B=t[R],N=(h-1)*n;if(N<o){const re=d?p.from-B.to:B.from-p.to,se=N/Math.max(o,1e-6);return{cue:{i:e.i,t:h},playhead:d?p.from-re*se:p.to+re*se,done:!1}}const F=Math.min(.999,(N-o)/Math.max(n,1e-6)),Q=B.to-B.from;return{cue:{i:R,t:F},playhead:d?B.to-Q*F:B.from+Q*F,done:!1}}const jc=86400,Dy=7*jc;function CT(t){return Math.floor((t+3*jc)/Dy)*Dy-3*jc}function AL(t){const e=new Map;for(const i of t){const n=new Date(i.startDateLocal).getUTCFullYear(),o=e.get(n);o?e.set(n,[Math.min(o[0],i.startTs),Math.max(o[1],i.startTs)]):e.set(n,[i.startTs,i.startTs])}return e}function EL(){const{activities:t,groups:e,t0:i,t1:n,minTs:o,maxTs:d,playing:p,speed:h,skipEmptyDays:A,playhead:R,actSpans:B,replayReverse:N,skipOutsideBounds:F,viewBounds:Q,fitToSelection:re,fitWhilePlaying:se}=di(),ae=di(Fe=>Fe.set),me=di(Fe=>Fe.setWindow),we=He.useRef(null),ve=He.useRef(null),Oe=He.useRef({x:0,t0:0,t1:0}),Te=Math.max(1,d+jc-o),Re=Fe=>(Fe-o)/Te*100,Ee=He.useMemo(()=>{if(!t.length||!Number.isFinite(o))return[];const Fe=new Set(e),Dt=new Map;for(const mt of t){if(!Fe.has(mt.group))continue;const ei=new Date(mt.startDateLocal),ai=Date.UTC(ei.getUTCFullYear(),ei.getUTCMonth(),ei.getUTCDate())/1e3,oe=CT(ai);Dt.set(oe,(Dt.get(oe)??0)+mt.distanceM)}const Le=[];for(let mt=CT(o);mt<=d+jc;mt+=Dy)Le.push({ts:mt,tsEnd:mt+Dy,m:Dt.get(mt)??0});const nt=Math.max(1,...Le.map(mt=>mt.m));return Le.map(mt=>({ts:mt.ts,tsEnd:mt.tsEnd,h:mt.m/nt}))},[t,e,o,d]),Je=He.useMemo(()=>AL(t),[t]),rt=He.useCallback(Fe=>{const Dt=we.current;if(!Dt)return o;const Le=Dt.getBoundingClientRect(),nt=Math.min(1,Math.max(0,(Fe-Le.left)/Le.width));return o+nt*Te},[o,Te]);He.useEffect(()=>{const Fe=Le=>{if(!ve.current)return;const nt=rt(Le.clientX);if(ve.current==="t0")me(nt,n);
2685else if(ve.current==="t1")me(i,nt);else{const mt=we.current;if(!mt)return;const ei=(Le.clientX-Oe.current.x)/mt.getBoundingClientRect().width*Te,ai=Oe.current.t1-Oe.current.t0;let oe=Oe.current.t0+ei;oe=Math.max(o,Math.min(d+jc-ai,oe)),me(oe,oe+ai)}},Dt=()=>{ve.current=null};return window.addEventListener("pointermove",Fe),window.addEventListener("pointerup",Dt),window.addEventListener("pointercancel",Dt),()=>{window.removeEventListener("pointermove",Fe),window.removeEventListener("pointerup",Dt),window.removeEventListener("pointercancel",Dt)}},[rt,me,i,n,Te,o,d]);const Ke=He.useMemo(()=>{if(!B)return[];const Fe=new Set(e),Dt=F?Q:null,Le=[];for(const nt of t){if(!Fe.has(nt.group)||Dt&&(nt.bbox[2]<Dt[0]||nt.bbox[0]>Dt[2]||nt.bbox[3]<Dt[1]||nt.bbox[1]>Dt[3]))continue;const mt=B[2*nt.idx],ei=B[2*nt.idx+1];!Number.isFinite(mt)||!Number.isFinite(ei)||Le.push({from:mt,to:ei})}return Le.sort((nt,mt)=>nt.from-mt.from),Le},[t,e,B,F,Q]),Qe=He.useMemo(()=>Ke.map(Fe=>Fe.from),[Ke]),ht=He.useRef(null);He.useEffect(()=>{if(!p)return;const Fe=Ke.filter(Ue=>Ue.to>=i&&Ue.from<=n);if(Fe.length===0){ae({playing:!1,playhead:null});return}const Dt=xL(Fe.length),Le=Math.max(0,LA-Fe.length*Dt),nt=Math.max(1,wL(i,n)-Fe.reduce((Ue,ut)=>Ue+(ut.to-ut.from),0)),mt=N?[...Fe].reverse():Fe;if(ht.current=TL(mt,di.getState().playhead,N),di.getState().playhead===null){const Ue=mt[ht.current.i];ae({playhead:N?Ue.to:Ue.from})}let ei=0,ai=performance.now();const oe=Ue=>{const ut=Math.min(.25,(Ue-ai)/1e3)*h;ai=Ue;const Tt=ht.current;if(!Tt)return;const $t=Tt.i+1<mt.length?Math.abs(N?mt[Tt.i].from-mt[Tt.i+1].to:mt[Tt.i+1].from-mt[Tt.i].to):0,qt=A?0:$t/nt*Le,ti=SL(mt,Tt,ut,Dt,qt,N);if(ht.current=ti.cue,ti.done){ae({playhead:null,playing:!1}),ht.current=null;return}ae({playhead:ti.playhead}),ei=requestAnimationFrame(oe)};return ei=requestAnimationFrame(oe),()=>cancelAnimationFrame(ei)},[p,h,ae,i,n,Ke,Qe,A,N]);const At=Fe=>new Date(Fe*1e3).toISOString().slice(0,10);return j.jsxs("div",{className:"panel",style:{padding:"10px 14px"},children:[j.jsxs("div",{className:"transport-controls",style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:10,rowGap:6,marginBottom:8},children:[j.jsx("button",{className:"ghost",style:{width:34},onClick:()=>ae({playing:!p}),"aria-label":p?"Pause":R===null||R<=i?"Play":"Resume",title:p?"Pause":R===null||R<=i?"Play":"Resume from here",children:p?"ââ":"â¶"}),j.jsx("button",{className:"ghost",style:{width:34},onClick:()=>{ht.current=null,ae({playhead:i,playing:!1})},disabled:!p&&(R===null||R<=i),"aria-label":"Back to the start of the selection",title:"Back to the start of the selection",children:"âº"}),[.5,1,2,4].map(Fe=>j.jsxs("button",{className:"chip","aria-pressed":h===Fe,onClick:()=>ae({speed:Fe}),children:[Fe,"x"]},Fe)),j.jsxs("label",{className:"check",style:{margin:0},title:"Compress stretches with no activities",children:[j.jsx("input",{type:"checkbox",checked:A,onChange:Fe=>ae({skipEmptyDays:Fe.target.checked})}),j.jsx("span",{children:"Skip empty days"})]}),j.jsxs("label",{className:"check",style:{margin:0},title:"Pass over activities that fall entirely outside the map view",children:[j.jsx("input",{type:"checkbox",checked:F,onChange:Fe=>ae({skipOutsideBounds:Fe.target.checked})}),j.jsx("span",{children:"Skip out of view"})]}),j.jsxs("label",{className:"check",style:{margin:0},title:"Move the map to frame the selected window whenever it changes",children:[j.jsx("input",{type:"checkbox",checked:re,onChange:Fe=>ae({fitToSelection:Fe.target.checked})}),j.jsx("span",{children:"Fit map to selection"})]}),re&&j.jsxs("label",{className:"check",style:{margin:0},title:"Refit on every frame of playback",children:[j.jsx("input",{type:"checkbox",checked:se,onChange:Fe=>ae({fitWhilePlaying:Fe.target.checked})}),j.jsx("span",{children:"â¦also while playing"})]}),j.jsxs("span",{style:{marginLeft:"auto",color:"var(--text-secondary)",fontVariantNumeric:"tabular-nums"},children:[At(i)," â ",At(R??n)]})]}),j.jsxs("div",{ref:we,style:{position:"relative",height:46,cursor:"crosshair",userSelect:"none",touchAction:"none"},onPointerDown:Fe=>{if(ve.current)return;Fe.currentTarget.setPointerCapture(Fe.pointerId);const Dt=rt(Fe.clientX);Math.abs(Dt-i)<Math.abs(Dt-n)?(ve.current="t0",me(Dt,n)):(ve.current="t1",me(i,Dt))},children:[j.jsx("div",{style:{position:"absolute",inset:0},children:Ee.map(Fe=>{const Dt=Re(Fe.ts),Le=Re(Fe.tsEnd),nt=Fe.tsEnd>i&&Fe.ts<n;return j.jsx("div",{style:{position:"absolute",bottom:0,left:`${Dt}%`,width:`calc(${Math.max(0,Le-Dt)}% - 1px)`,minWidth:1,height:`${Math.max(2,Fe.h*100)}
2685%`,background:"var(--text-muted)",opacity:nt?.55:.16,borderRadius:"2px 2px 0 0"}},Fe.ts)})}),j.jsx("div",{style:{position:"absolute",top:0,bottom:0,left:`${Re(i)}%`,width:`${Math.max(.4,Re(n)-Re(i))}%`,background:"rgba(57,135,229,0.16)",border:"1px solid var(--series-1)",borderRadius:3,cursor:"grab"},onPointerDown:Fe=>{Fe.stopPropagation(),ve.current="mid",Oe.current={x:Fe.clientX,t0:i,t1:n}}}),R!==null&&j.jsx("div",{"aria-hidden":!0,style:{position:"absolute",top:-3,bottom:-3,left:`calc(${Re(R)}% - 1px)`,width:2,background:"var(--frontier)",borderRadius:1,pointerEvents:"none",boxShadow:"0 0 6px var(--frontier)"}}),["t0","t1"].map(Fe=>j.jsx("div",{className:"scrub-handle",style:{position:"absolute",top:-2,bottom:-2,left:`calc(${Re(Fe==="t0"?i:n)}% - 4px)`,width:8,background:"var(--series-1)",borderRadius:3,cursor:"ew-resize"},onPointerDown:Dt=>{Dt.stopPropagation(),Dt.currentTarget.setPointerCapture(Dt.pointerId),ve.current=Fe}},Fe))]}),j.jsxs("div",{className:"preset-row",style:{display:"flex",gap:5,marginTop:8,flexWrap:"wrap"},children:[j.jsx("button",{className:"chip",onClick:()=>me(o,d+jc),children:"All time"}),j.jsx("button",{className:"chip",onClick:()=>me(Math.max(o,d-365*jc),d+jc),children:"Last 12 months"}),[...Je.keys()].sort((Fe,Dt)=>Dt-Fe).slice(0,12).map(Fe=>j.jsx("button",{className:"chip",onClick:()=>{const[Dt,Le]=Je.get(Fe);me(Dt,Le)},children:Fe},Fe))]})]})}function FA(){const t=He.useRef(null),[e,i]=He.useState(0);return He.useEffect(()=>{const n=t.current;if(!n)return;i(Math.round(n.clientWidth));const o=new ResizeObserver(d=>{for(const p of d)i(Math.round(p.contentRect.width))});return o.observe(n),()=>o.disconnect()},[]),[t,e]}function UA(t,e=4){if(!Number.isFinite(t)||t<=0)return[0,1];const i=t/Math.max(1,e),n=10**Math.floor(Math.log10(i)),o=i/n,d=(o>7.07?10:o>3.16?5:o>1.41?2:1)*n,p=[];for(let A=0,R=0;A<t+d*1e-6&&R<40;A+=d,R++)p.push(RT(A));const h=p[p.length-1];return(h===void 0||h<t)&&p.push(RT((h??0)+d)),p}function RT(t){return Number(t.toFixed(10))}function jA(t){return t>=1e4?e=>e===0?"0":`${Number((e/1e3).toFixed(1)).toLocaleString()}k`:t>=10?e=>e.toLocaleString(void 0,{maximumFractionDigits:0}):e=>e===0?"0":e.toFixed(1)}function Oy({orientation:t,ticks:e,plot:i}){return t==="x"?j.jsxs("g",{className:"chart-axis",children:[j.jsx("line",{x1:i.x0,x2:i.x1,y1:i.y1,y2:i.y1}),e.map(n=>j.jsx("text",{x:n.pos,y:i.y1+14,textAnchor:"middle",children:n.label},`${n.label}@${n.pos}`))]}):j.jsx("g",{className:"chart-axis",children:e.map(n=>j.jsx("text",{x:i.x0-8,y:n.pos+3.5,textAnchor:"end",children:n.label},`${n.label}@${n.pos}`))})}function VA({ticks:t,plot:e}){return j.jsx("g",{className:"chart-grid",children:t.map(i=>j.jsx("line",{x1:e.x0,x2:e.x1,y1:i.pos,y2:i.pos},`${i.label}@${i.pos}`))})}function $A({x:t,y:e,width:i,above:n=!1,children:o}){const p=t>i*.55?"translateX(calc(-100% - 12px))":"translateX(12px)";return j.jsx("div",{className:"chart-tip",role:"status",style:{left:t,top:e,transform:n?`${p} translateY(-100%)`:p},children:o})}function mp({title:t,subtitle:e,table:i,aside:n,children:o}){const[d,p]=He.useState(!1);return j.jsxs("section",{className:"chart-figure",children:[j.jsxs("header",{className:"chart-head",children:[j.jsxs("div",{children:[j.jsx("h3",{className:"chart-title",children:t}),e!==void 0&&j.jsx("p",{className:"chart-sub",children:e})]}),i!==void 0&&j.jsx("button",{className:"ghost chart-toggle","aria-pressed":d,onClick:()=>p(h=>!h),children:d?"Chart":"Table"})]}),!d&&n,j.jsx("div",{className:"chart-body",children:d&&i!==void 0?i:o})]})}const K_={top:10,bottom:24,left:50},CL=96,RL=13;function ML({title:t,subtitle:e,x:i,series:n,formatX:o,formatY:d,xLabel:p="Period",height:h=172}){const[A,R]=FA(),[B,N]=He.useState(null),F=j.jsx("div",{className:"chart-table-wrap scroll",children:j.jsxs("table",{className:"chart-table",children:[j.jsx("thead",{children:j.jsxs("tr",{children:[j.jsx("th",{scope:"col",children:p}),n.map(oe=>j.jsx("th",{scope:"col",children:oe.name},oe.name))]})}),j.jsx("tbody",{children:i.map((oe,Ue)=>j.jsxs("tr",{children:[j.jsx("th",{scope:"row",children:o(oe)}),n.map(ut=>j.jsx("td",{children:d(ut.values[Ue]??0)},ut.name))]},oe))})]})}),Q=n.length>=2?j.jsx("div",{className:"chart-legend",children:n.map(oe=>j.jsxs("span",{children:[j.jsx("i",{style:{background:oe.color}}),oe.name]},oe.name))}):void 0,re=R>=340,se=re?CL:14,ae={x0:K_.left,x1:Math.max(K_.left+10,R-se),y0:K_.top,y1:h-K_.bottom};
2685if(!(R>0&&i.length>0&&n.length>0))return j.jsx(mp,{title:t,subtitle:e,table:F,aside:Q,children:j.jsx("div",{ref:A,className:"chart-plot",style:{height:h}})});const we=i[0],Oe=i[i.length-1]-we,Te=oe=>Oe>0?ae.x0+(oe-we)/Oe*(ae.x1-ae.x0):(ae.x0+ae.x1)/2;let Re=0;for(const oe of n)for(const Ue of oe.values)Ue>Re&&(Re=Ue);const Ee=UA(Re,4),Je=Ee[Ee.length-1]||1,rt=oe=>ae.y1-oe/Je*(ae.y1-ae.y0),Ke=jA(Je),Qe=Ee.map(oe=>({pos:rt(oe),label:Ke(oe)})),ht=[],At=Math.max(2,Math.min(6,Math.floor((ae.x1-ae.x0)/70))),Fe=Math.max(1,Math.ceil(i.length/At));let Dt=-1/0;for(let oe=0;oe<i.length;oe+=Fe){const Ue=Te(i[oe]);Ue-Dt<48||(ht.push({pos:Ue,label:o(i[oe])}),Dt=Ue)}const Le=n.map(oe=>oe.values.map((Ue,ut)=>`${ut===0?"M":"L"}${Te(i[ut]).toFixed(1)},${rt(Ue).toFixed(1)}`).join(" ")),nt=n.map((oe,Ue)=>{const ut=oe.values[oe.values.length-1]??0;return{i:Ue,name:oe.name,color:oe.color,y:rt(ut),ly:rt(ut)}}).sort((oe,Ue)=>oe.y-Ue.y);let mt=-1/0;for(const oe of nt)oe.ly=Math.max(oe.y,mt+RL),mt=oe.ly;const ei=oe=>{const Ue=oe.currentTarget.getBoundingClientRect(),ut=oe.clientX-Ue.left;if(ut<ae.x0-12||ut>ae.x1+12){N(null);return}let Tt=0,$t=1/0;for(let qt=0;qt<i.length;qt++){const ti=Math.abs(Te(i[qt])-ut);ti<$t&&($t=ti,Tt=qt)}N(Tt)},ai=B===null?0:Te(i[B]);return j.jsx(mp,{title:t,subtitle:e,table:F,aside:Q,children:j.jsxs("div",{ref:A,className:"chart-plot",style:{height:h},children:[j.jsxs("svg",{width:R,height:h,role:"img","aria-label":`${t}. Use the table toggle for the underlying numbers.`,style:{touchAction:"none"},onPointerMove:ei,onPointerLeave:()=>N(null),children:[j.jsx(VA,{ticks:Qe,plot:ae}),j.jsx(Oy,{orientation:"y",ticks:Qe,plot:ae}),j.jsx(Oy,{orientation:"x",ticks:ht,plot:ae}),B!==null&&j.jsx("line",{className:"chart-crosshair",x1:ai,x2:ai,y1:ae.y0,y2:ae.y1}),n.map((oe,Ue)=>j.jsx("path",{d:Le[Ue],fill:"none",stroke:oe.color,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"},oe.name)),i.length===1&&n.map(oe=>j.jsx("circle",{cx:Te(i[0]),cy:rt(oe.values[0]??0),r:4,fill:oe.color,stroke:"var(--map-surface)",strokeWidth:2},oe.name)),B!==null&&n.map(oe=>j.jsx("circle",{cx:ai,cy:rt(oe.values[B]??0),r:3.5,fill:oe.color,stroke:"var(--map-surface)",strokeWidth:2},oe.name)),re&&nt.map(oe=>j.jsxs("g",{children:[j.jsx("line",{x1:ae.x1,y1:oe.y,x2:ae.x1+8,y2:oe.ly,stroke:oe.color,strokeWidth:2,strokeLinecap:"round"}),j.jsx("text",{className:"chart-endlabel",x:ae.x1+12,y:oe.ly+3.5,children:oe.name})]},oe.name))]}),B!==null&&j.jsxs($A,{x:ai,y:ae.y0+4,width:R,children:[j.jsx("div",{className:"tip-head",children:o(i[B])}),n.map(oe=>j.jsxs("div",{className:"tip-row",children:[j.jsx("i",{style:{background:oe.color}}),oe.name,j.jsx("b",{children:d(oe.values[B]??0)})]},oe.name))]})]})})}const qm={top:10,right:14,bottom:24,left:50},PL=2,IL=4,DL=28,OL=48;function kL(t,e,i,n){const o=Math.max(0,Math.min(IL,i/2,n));return`M${t},${e+n}L${t},${e+o}Q${t},${e} ${t+o},${e}L${t+i-o},${e}Q${t+i},${e} ${t+i},${e+o}L${t+i},${e+n}Z`}function BL({title:t,subtitle:e,data:i,color:n,formatY:o,xLabel:d="Period",valueLabel:p="Value",height:h=150}){const[A,R]=FA(),[B,N]=He.useState(null),F=j.jsx("div",{className:"chart-table-wrap scroll",children:j.jsxs("table",{className:"chart-table",children:[j.jsx("thead",{children:j.jsxs("tr",{children:[j.jsx("th",{scope:"col",children:d}),j.jsx("th",{scope:"col",children:p})]})}),j.jsx("tbody",{children:i.map(ht=>j.jsxs("tr",{children:[j.jsx("th",{scope:"row",children:ht.label}),j.jsx("td",{children:o(ht.value)})]},ht.key))})]})}),Q={x0:qm.left,x1:Math.max(qm.left+10,R-qm.right),y0:qm.top,y1:h-qm.bottom};if(!(R>0&&i.length>0))return j.jsx(mp,{title:t,subtitle:e,table:F,children:j.jsx("div",{ref:A,className:"chart-plot",style:{height:h}})});let se=0;for(const ht of i)ht.value>se&&(se=ht.value);const ae=UA(se,4),me=ae[ae.length-1]||1,we=ht=>Q.y1-ht/me*(Q.y1-Q.y0),ve=jA(me),Oe=ae.map(ht=>({pos:we(ht),label:ve(ht)})),Te=(Q.x1-Q.x0)/i.length,Re=Math.max(1,Math.min(Te-PL,DL)),Ee=ht=>Q.x0+ht*Te,Je=ht=>Ee(ht)+(Te-Re)/2,rt=Math.max(1,Math.ceil(i.length/Math.max(1,Math.floor((Q.x1-Q.x0)/62)))),Ke=[];for(let ht=0;ht<i.length;ht+=rt)Ke.push({pos:Ee(ht)+Te/2,label:i[ht].label});const Qe=B===null?null:i[B];return j.jsx(mp,{title:t,subtitle:e,table:F,children:j.jsxs("div",{ref:A,className:"chart-plot",style:{height:h},children:[j.jsxs("svg",{width:R,height:h,role:"img","aria-label":`${t}. Use the table toggle for the underlying numbers.`,style:{touchAction:"none"},onPointerLeave:()=>N(null),children:[j.jsx(VA,{ticks:Oe,plot:Q}),j.jsx(Oy,{orientation:"y",ticks:Oe,plot:Q}),j.jsx(Oy,{orientation:"x",ticks:Ke,plot:Q}),i.map((ht,At)=>
2685{const Fe=Math.max(0,Q.y1-we(Math.max(0,ht.value)));return j.jsx("path",{d:kL(Je(At),Q.y1-Fe,Re,Fe),fill:n,opacity:B===null||B===At?1:.55},ht.key)}),i.map((ht,At)=>j.jsx("rect",{x:Ee(At),y:Q.y0,width:Te,height:Q.y1-Q.y0,fill:"transparent",onPointerEnter:()=>N(At),onPointerMove:()=>N(At)},ht.key))]}),B!==null&&Qe!==null&&j.jsxs($A,{x:Je(B)+Re/2,y:Math.max(OL,we(Math.max(0,Qe.value))-6),width:R,above:!0,children:[j.jsx("div",{className:"tip-head",children:Qe.label}),j.jsxs("div",{className:"tip-row",children:[j.jsx("i",{style:{background:n}}),p,j.jsx("b",{children:o(Qe.value)})]})]})]})})}const NL=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],MT=["var(--series-1)","var(--series-2)","var(--series-3)"],zL="var(--text-muted)",LL=330*86400;function FL({extras:t,onSelectActivity:e,onClose:i}){const n=di(we=>we.activities),o=di(we=>we.manifest),d=di(we=>we.units),p=zA[d],h=we=>`${cy(we,d)} ${d}`,A=we=>h(we*p),R=He.useMemo(()=>(t==null?void 0:t.byBucket)??[],[t]),B=He.useMemo(()=>R.length>=2?R[1].bucketStart-R[0].bucketStart>=LL:R.length===1&&new Date(R[0].bucketStart*1e3).getUTCMonth()===0,[R]),N=He.useMemo(()=>we=>{const ve=new Date(we*1e3),Oe=ve.getUTCFullYear();return B?String(Oe):`${NL[ve.getUTCMonth()]} ${Oe}`},[B]),F=He.useMemo(()=>{const we=[],ve=[],Oe=[];let Te=0,Re=0;for(const Ee of R)Te+=Ee.newM,Re+=Ee.totalM,we.push(Ee.bucketStart),ve.push(Te/p),Oe.push(Re/p);return{x:we,newGround:ve,totalLogged:Oe}},[R,p]),Q=He.useMemo(()=>R.map(we=>({key:String(we.bucketStart),label:N(we.bucketStart),value:we.newM/p})),[R,N,p]),re=He.useMemo(()=>{const we=new Map;for(const ve of n)we.set(ve.idx,ve);return we},[n]),se=He.useMemo(()=>{const we=((t==null?void 0:t.perActivityNewM)??[]).slice(0,20),ve=we.reduce((Oe,Te)=>Math.max(Oe,Te.newM),0)||1;return we.flatMap(Oe=>{const Te=re.get(Oe.idx);return Te?[{a:Te,newM:Oe.newM,share:Oe.newM/ve}]:[]})},[t,re]),ae=He.useMemo(()=>[...(t==null?void 0:t.byGroup)??[]].sort((ve,Oe)=>Oe.totalM-ve.totalM).map(ve=>({...ve,name:(o==null?void 0:o.sportGroups[ve.group])??`Group ${ve.group}`,color:ve.group<MT.length?MT[ve.group]:zL,repeat:ve.totalM>0?Math.max(0,1-ve.distinctM/ve.totalM):null})),[t,o]),me=d==="mi"?"miles":"kilometres";return j.jsxs("aside",{className:"panel stats-drawer","aria-label":"Stats and charts",children:[j.jsxs("h2",{children:["Stats and charts",j.jsx("button",{onClick:i,"aria-label":"Close stats and charts",children:"Ã"})]}),t===null?j.jsx("p",{className:"chart-empty",children:"Loading charts..."}):j.jsxs("div",{className:"stats-drawer-body",children:[j.jsx(ML,{title:"Cumulative coverage",subtitle:`Running totals across the selected window, in ${me}.`,x:F.x,series:[{name:"New ground",color:"var(--series-1)",values:F.newGround},{name:"Total logged",color:"var(--series-2)",values:F.totalLogged}],formatX:N,formatY:A,xLabel:B?"Year":"Month"}),j.jsx(BL,{title:"New ground per period",subtitle:`Ground covered for the first time, by ${B?"year":"month"}, in ${me}.`,data:Q,color:"var(--series-1)",formatY:A,xLabel:B?"Year":"Month",valueLabel:"New ground"}),j.jsx(mp,{title:"Biggest discoveries",subtitle:"The 20 activities that opened the most new ground in this selection. Select one to draw it on the map.",children:se.length===0?j.jsx("p",{className:"chart-empty",children:"No activities in this selection"}):j.jsx("div",{className:"chart-table-wrap",children:j.jsxs("table",{className:"chart-table fixed",children:[j.jsxs("colgroup",{children:[j.jsx("col",{style:{width:"17%"}}),j.jsx("col",{style:{width:"27%"}}),j.jsx("col",{style:{width:"16%"}}),j.jsx("col",{style:{width:"17%"}}),j.jsx("col",{style:{width:"13%"}}),j.jsx("col",{style:{width:"10%"}})]}),j.jsx("thead",{children:j.jsxs("tr",{children:[j.jsx("th",{scope:"col",children:"Date"}),j.jsx("th",{scope:"col",children:"Activity"}),j.jsx("th",{scope:"col",children:"Sport"}),j.jsx("th",{scope:"col",children:"New ground"}),j.jsx("th",{scope:"col",children:"Distance"}),j.jsx("th",{scope:"col",children:"% new"})]})}),j.jsx("tbody",{children:se.map(({a:we,newM:ve,share:Oe})=>j.jsxs("tr",{className:"row-click",tabIndex:0,onClick:()=>e(we.idx),onKeyDown:Te=>{(Te.key==="Enter"||Te.key===" ")&&(Te.preventDefault(),e(we.idx))},children:[j.jsx("td",{children:we.startDateLocal.slice(0,10)}),j.jsx("th",{scope:"row",className:"name",title:we.name,children:we.name}),j.jsx("td",{children:we.sportType}),j.jsxs("td",{className:"cellbar",children:[j.jsx("div",{className:"cellbar-fill",style:{width:`${Oe*100}%`}}),j.jsx("span",{children:h(ve)})]}),j.jsx("td",{children:h(we.distanceM)}),j.jsx("td",{children:we.distanceM>0?`${Math.min(100,Math.round(ve/we.distanceM*100))}%`:"--"})]},we.idx))})]})})}),j.jsxs(mp,{title:"By sport",children:[j.jsx("p",{className:"chart-note",children:"Ground covered by more than one sport appears in every row that covers it, so the rows do not sum to the total."}),ae.length===0?j.jsx("p",{className:"chart-empty",children:"No activities in this selection"}):j.jsx("div",{className:"chart-table-wrap",children:j.jsxs("table",{className:"chart-table",children:[j.jsx("thead",{children:j.jsxs("tr",{children:[j.jsx("th",{scope:"col",children:"Sport"}),j.jsx("th",{scope:"col",children:"Distinct ground"}),j.jsx("th",{scope:"col",children:"New ground"}),j.jsx("th",{scope:"col",children:"Total logged"}),j.jsx("th",{scope:"col",children:"Repeat"})]})}),j.jsx("tbody",{children:ae.map(we=>j.jsxs("tr",{children:[j.jsxs("th",{scope:"row",className:"sport",children:[j.jsx("i",{className:"sport-key",style:{background:we.color}}),we.name]}),j.jsx("td",{children:h(we.distinctM)}),j.jsx("td",{children:h(we.newM)}),j.jsx("td",{children:h(we.totalM)}),j.jsx("td",{children:we.repeat===null?"--":`${Math.round(we.repeat*100)}%`})]},we.group))})]})})]})]})]})}const PT=8;function UL({onGo:t}){const e=di(se=>se.activities),[i,n]=He.useState(""),[o,d]=He.useState(!1),[p,h]=He.useState(0),A=He.useRef(null),R=
2685He.useRef(null),B=He.useMemo(()=>{const se=i.trim().toLowerCase();if(se.length<2)return[];const ae=[];for(const me of e)if(me.name.toLowerCase().includes(se)&&(ae.push({kind:"activity",label:me.name,sub:`${me.startDateLocal.slice(0,10)} · ${me.sportType}`,idx:me.idx,bounds:me.bbox}),ae.length>=PT*8))break;return ae.sort((me,we)=>me.sub<we.sub?1:-1),ae},[i,e]),N=He.useMemo(()=>B.slice(0,PT),[B]),F=N,Q=B.length-N.length;He.useEffect(()=>h(0),[i]);const re=He.useCallback(se=>{var ae;t(se.bounds,se.kind==="activity"?se.idx:null),d(!1),(ae=A.current)==null||ae.blur()},[t]);return He.useEffect(()=>{const se=ae=>{var we,ve;const me=((we=ae.target)==null?void 0:we.tagName)==="INPUT";(ae.key==="k"&&(ae.metaKey||ae.ctrlKey)||ae.key==="/"&&!me)&&(ae.preventDefault(),(ve=A.current)==null||ve.focus(),d(!0))};return window.addEventListener("keydown",se),()=>window.removeEventListener("keydown",se)},[]),He.useEffect(()=>{const se=ae=>{R.current&&!R.current.contains(ae.target)&&d(!1)};return window.addEventListener("pointerdown",se),()=>window.removeEventListener("pointerdown",se)},[]),j.jsxs("div",{ref:R,className:"panel",style:{overflow:"hidden"},children:[j.jsx("input",{ref:A,value:i,onChange:se=>{n(se.target.value),d(!0)},onFocus:()=>d(!0),onKeyDown:se=>{var ae;se.key==="Escape"?(d(!1),(ae=A.current)==null||ae.blur()):se.key==="ArrowDown"?(se.preventDefault(),h(me=>Math.min(F.length-1,me+1))):se.key==="ArrowUp"?(se.preventDefault(),h(me=>Math.max(0,me-1))):se.key==="Enter"&&F[p]&&re(F[p])},placeholder:"Search your activities","aria-label":"Search your activities",style:{width:"100%",background:"transparent",border:"none",outline:"none",color:"var(--text-primary)",font:"inherit",padding:"10px 12px"}}),o&&F.length>0&&j.jsx("div",{style:{borderTop:"1px solid var(--panel-border)",maxHeight:340,overflowY:"auto"},children:F.map((se,ae)=>
2685{const me=ae===0?`Activities${Q>0?` (${B.length} matches)`:""}`:null;return j.jsxs("div",{children:[me&&j.jsx("div",{style:{padding:"7px 12px 3px",fontSize:10,letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--text-muted)"},children:me}),j.jsxs("button",{onClick:()=>re(se),onPointerEnter:()=>h(ae),style:{display:"flex",gap:9,alignItems:"baseline",width:"100%",textAlign:"left",background:ae===p?"var(--hover-bg)":"transparent",border:"none",cursor:"pointer",padding:"6px 12px",color:"var(--text-secondary)",font:"inherit"},children:[j.jsx("span",{"aria-hidden":!0,style:{flex:"0 0 auto",width:8,height:8,marginTop:1,borderRadius:1,background:"var(--frontier)"}}),j.jsxs("span",{style:{minWidth:0,flex:1},children:[j.jsx("span",{style:{display:"block",color:"var(--text-primary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:se.label}),j.jsx("span",{style:{fontSize:11,color:"var(--text-muted)"},children:se.sub})]})]})]},`${ae}-${se.label}`)})})]})}const jL={Run:"Run",TrailRun:"Trail run",Walk:"Walk",Hike:"Hike",Ride:"Ride",GravelRide:"Gravel",MountainBikeRide:"MTB",EBikeRide:"E-bike",NordicSki:"Nordic ski",AlpineSki:"Alpine ski",BackcountrySki:"BC ski",Snowshoe:"Snowshoe",Swim:"Swim"};function VL({info:t,x:e,y:i,onClose:n,onPreview:o}){He.useEffect(()=>{const B=N=>{N.key==="Escape"&&n()};return window.addEventListener("keydown",B),()=>window.removeEventListener("keydown",B)},[n]);const d=t.activities??[],p=B=>B===3?`${t.alongLabel}+${t.againstLabel}`:B&1?t.alongLabel:t.againstLabel,h=290,A=Math.min(Math.max(8,e+14),window.innerWidth-h-8),R=Math.min(Math.max(8,i+14),Math.max(8,window.innerHeight-340));return j.jsxs("div",{className:"panel",style:{left:A,top:R,width:h,padding:0,zIndex:60,maxHeight:320,display:"flex",flexDirection:"column"},onPointerDown:B=>B.stopPropagation(),onMouseLeave:()=>o(null),children:[j.jsxs("div",{style:{padding:"10px 12px 8px",borderBottom:"1px solid var(--panel-border)"},children:[j.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:8},children:[j.jsx("span",{style:{fontSize:15,fontWeight:600},children:t.visits===1?"1 pass":`${t.visits} passes`}),t.visitsAllTime>t.visits&&j.jsxs("span",{style:{color:"var(--text-muted)",fontSize:11},children:[t.visitsAllTime," all time"]}),j.jsx("button",{onClick:n,"aria-label":"Close",style:{marginLeft:"auto",background:"none",border:"none",color:"var(--text-muted)",cursor:"pointer",fontSize:15,lineHeight:1,padding:0},children:"Ã"})]}),j.jsx("div",{style:{color:"var(--text-secondary)",fontSize:11,marginTop:3},children:[{n:t.alongCount,l:t.alongLabel},{n:t.againstCount,l:t.againstLabel}].filter(B=>B.n>0).map(B=>`${B.n} heading ${B.l}`).join(" · ")})]}),j.jsxs("div",{style:{overflowY:"auto",flex:1},children:[d.map(B=>j.jsxs("a",{href:`https://www.strava.com/activities/${B.stravaId}`,target:"_blank",rel:"noopener noreferrer",onPointerEnter:()=>o(B.idx),style:{display:"block",padding:"6px 12px",textDecoration:"none",color:"var(--text-secondary)",borderBottom:"1px solid var(--panel-border)"},onFocus:()=>o(B.idx),children:[j.jsx("span",{style:{display:"block",color:"var(--text-primary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:B.name}),j.jsxs("span",{style:{fontSize:11,color:"var(--text-muted)"},children:[B.startDateLocal.slice(0,10)," · ",jL[B.sportType]??B.sportType," ·"," ",p(B.dir)]})]},B.idx)),d.length===0&&j.jsx("div",{style:{padding:"10px 12px",color:"var(--text-muted)"},children:"No activities in the current filters."})]}),j.jsx("div",{style:{padding:"6px 12px",borderTop:"1px solid var(--panel-border)",color:"var(--text-muted)",fontSize:10},children:"Hover a row to trace it. Click to open on Strava."})]})}const $L="unique-miles",HL=1,gp="activities",B0="artifacts",Jl="syncState",kd="credentials",IT=1e7;function WL(){return new Promise((t,e)=>{const i=indexedDB.open($L,HL);i.onupgradeneeded=()=>{const n=i.result;n.objectStoreNames.contains(gp)||n.createObjectStore(gp,{keyPath:"id"}).createIndex("byStart","startTs"),n.objectStoreNames.contains(B0)||n.createObjectStore(B0,{keyPath:"name"}),n.objectStoreNames.contains(Jl)||n.createObjectStore(Jl,{keyPath:"k"}),n.objectStoreNames.contains(kd)||n.createObjectStore(kd,{keyPath:"k"})},i.onsuccess=()=>t(i.result),i.onerror=()=>e(i.error)})}let Ib=null;function Sg(){return Ib||(Ib=WL()),Ib}function HA(t){return new Promise((e,i)=>{t.onsuccess=()=>e(t.result),t.onerror=()=>i(t.error)})}async function _v(t,e){const i=await Sg();return HA(i.transaction(t,"readonly").objectStore(t).get(e))}async function vd(t,e){const n=(await Sg()).transaction(t,"readwrite");n.objectStore(t).put(e),await new Promise((o,d)=>{n.oncomplete=()=>o(),n.onerror=()=>d(n.error)})}async function XL(t,e){if(!e.length)return;const n=(await Sg()).transaction(t,"readwrite"),o=n.objectStore(t);for(const d of e)o.put(d);await new Promise((d,p)=>{n.oncomplete=()=>d(),n.onerror=()=>p(n.error)})}async function DT(){const t=await Sg(),e=await HA(t.transaction(gp,"readonly").objectStore(gp).getAllKeys());return new Set(e)}async function qL(){const t=await Sg(),e=[gp,B0,Jl,kd],i=t.transaction(e,"readwrite");for(const n of e)i.objectStore(n).clear();await new Promise((n,o)=>{i.oncomplete=()=>n(),i.onerror=()=>o(i.error)})}async function ZL(){var e;if(!((e=navigator.storage)!=null&&e.estimate))return null;const t=await navigator.storage.estimate();return{usage:t.usage??0,quota:t.quota??0}}async function WA(){var t;if(!((t=navigator.storage)!=null&&t.persist))return!1;try{return await navigator.storage.persisted()?!0:await navigator.storage.persist()}catch{return!1}}function YL(t){if(!t||typeof t!="object")return!1;const e=t;return e.name==="QuotaExceededError"||e.code===22||/quota|storage.*full|exceeded/i.test(e.message??"")}function GL(t){return t>=1e9?`${(t/1e9).toFixed(1)} GB`:t>=1e6?`${Math.round(t/1e6)} MB`:`${Math.round(t/1e3)} kB`}function KL({busy:t,connected:e,onSync:i,onConnect:n,onDisconnect:o}){const[d,p]=He.useState(!1),[h,A]=He.useState(!1),[R,B]=He.useState(null),[N,F]=He.useState(null);return He.useEffect(()=>{var Q,re;d&&(ZL().then(se=>{se&&se.usage>0&&B(GL(se.usage))}),(re=(Q=navigator.storage)==null?void 0:Q.persisted)==null||re.call(Q).then(F,()=>F(null)))},[d]),d?j.jsxs("div",{className:"panel",children:[j.jsxs("h2",{children:["Your data",j.jsx("button",{onClick:()=>p(!1),title:"Close",children:"Ã"})]}),j.jsxs("p",{style:{color:"var(--text-muted)",fontSize:12,lineHeight:1.5,margin:"0 0 12px"},children:["Stored in this browser only",R?`, using about ${R}`:"","."]}),N===!1&&j.jsxs("p",{style:{color:"var(--text-muted)",fontSize:12,lineHeight:1.5,margin:"0 0 12px"},children:["Your browser has not promised to keep this. It may clear it if disk space runs low, or after a long time without a visit â Safari does this after about a week. Nothing is lost permanently: syncing again rebuilds it from Strava."," ",j.jsx("button",{className:"ghost",onClick:()=>void WA().then(F),style:{padding:"2px 7px",marginTop:5},children:"Ask again"})]}),e&&j.jsx("button",{className:"ghost",onClick:i,disabled:t,style:{width:"100%"},children:t?"Workingâ¦":"Check Strava for new activities"}),j.jsx("button",{className:"ghost",onClick:n,style:{width:"100%",marginTop:e?7:0},children:e?"Reconnect to Strava":"Connect to Strava"}),j.jsx("div",{style:{marginTop:10},children:h?j.jsxs(j.Fragment,{children:[j.jsx("p",{style:{color:"var(--text-secondary)",fontSize:12,lineHeight:1.5,margin:"0 0 8px"},children:"This erases every downloaded activity, your computed map, and your Strava credentials from this browser. There is no copy anyw
2685here else."}),j.jsxs("div",{style:{display:"flex",gap:7},children:[j.jsx("button",{className:"ghost",onClick:()=>void o(),style:{borderColor:"rgba(220,70,50,0.5)",color:"#ffb3a3"},children:"Erase everything"}),j.jsx("button",{className:"ghost",onClick:()=>A(!1),children:"Cancel"})]})]}):j.jsx("button",{className:"ghost",onClick:()=>A(!0),style:{width:"100%"},children:"Disconnect and erase"})})]}):j.jsx("button",{className:"ghost",onClick:()=>p(!0),children:"Your data"})}const QL={trainer:"recorded on a trainer, so there is no ground to cover",manual:"entered by hand, with no GPS track",virtual:"a virtual ride â real effort, but not real ground","no-gps":"no GPS was recorded","stream-mismatch":"the GPS and time data did not line up, so it could not be trusted","treadmill-shaped":"the GPS never moved while distance was recorded â a treadmill or a stationary session","too-short":"too little movement left to measure once duplicate points were removed"};function JL({report:t,onClose:e}){const[i,n]=He.useState(!1),o=Object.values(t.excluded).reduce((h,A)=>h+A,0);if(o===0)return null;const d=Object.entries(t.excluded).sort((h,A)=>A[1]-h[1]),p=t.included+o===t.seen;return j.jsxs("div",{className:"panel import-report",children:[j.jsxs("h2",{children:["Not everything counted",j.jsx("button",{onClick:e,title:"Dismiss",children:"Ã"})]}),j.jsxs("div",{className:"import-sum",children:[j.jsx("strong",{children:t.included.toLocaleString()})," of ",t.seen.toLocaleString()," ","activities are on your map. ",j.jsx("strong",{children:o.toLocaleString()})," ",o===1?"was":"were"," left out, because there was no ground in"," ",o===1?"it":"them"," to measure."]}),!p&&j.jsx("div",{className:"import-warn",children:"These numbers do not add up, which is a bug. Please treat the total as unreliable."}),i&&j.jsx("ul",{className:"import-reasons",children:d.map(([h,A])=>j.jsxs("li",{children:[j.jsx("span",{className:"import-count",children:A.toLocaleString()}),j.jsx("span",{children:QL[h]??h})]},h))}),j.jsx("button",{className:"ghost",onClick:()=>n(h=>!h),style:{marginTop:10},children:i?"Hide the breakdown":"Why?"})]})}const eF={system:"â",light:"â",dark:"â¾"},tF={system:"light",light:"dark",dark:"system"},Q_={system:"following your system",light:"light",dark:"dark"};function J_({floating:t=!1}={}){const e=di(d=>d.theme),i=di(d=>d.themeChoice),n=di(d=>d.set);He.useEffect(()=>OA(e),[e]),He.useEffect(()=>Q6(d=>
2685{di.getState().themeChoice==="system"&&n({theme:d})}),[n]);const o=tF[i];return j.jsx("button",{className:`ghost theme-toggle${t?" theme-toggle-floating":""}`,onClick:()=>{K6(o),n({themeChoice:o,theme:DA(o)})},title:`Theme: ${Q_[i]} â click for ${Q_[o]}`,"aria-label":`Theme: ${Q_[i]}. Click for ${Q_[o]}.`,children:j.jsx("span",{"aria-hidden":!0,children:eF[i]})})}const XA={peek:0,half:.32,full:.55},ag=34,iF=140;function ky(t,e){const i=ag+XA[t]*e;return Math.round(Math.min(i,Math.max(ag,e-iF)))}function nF(t,e){return["peek","half","full"].reduce((n,o)=>Math.abs(ky(o,e)-t)<Math.abs(ky(n,e)-t)?o:n)}function rF({children:t,onDragHeight:e,onStop:i,stop:n}){const o=He.useRef(null),d=He.useCallback(A=>{A.preventDefault(),A.currentTarget.setPointerCapture(A.pointerId),o.current={id:A.pointerId,startY:A.clientY,startH:ky(n,window.innerHeight)}},[n]),p=He.useCallback(A=>{const R=o.current;if(!R||R.id!==A.pointerId)return;const B=R.startH+(R.startY-A.clientY);e(Math.max(ag,Math.min(B,window.innerHeight*XA.full+ag)))},[e]),h=He.useCallback(A=>{const R=o.current;if(!R||R.id!==A.pointerId)return;o.current=null;const B=Math.max(ag,R.startH+(R.startY-A.clientY));e(null),i(nF(B,window.innerHeight))},[e,i]);return j.jsxs("div",{className:"rail",children:[j.jsx("button",{className:"sheet-handle","aria-label":n==="peek"?"Show controls":"Hide controls",onPointerDown:d,onPointerMove:p,onPointerUp:h,onPointerCancel:h,onClick:()=>{o.current||i(n==="peek"?"half":n==="half"?"full":"peek")}}),t]})}const OT=t=>new Date(t*1e3).toISOString().slice(0,10);function sF({getViewBounds:t,onClose:e}){const[i,n]=He.useState(!1),[o,d]=He.useState(!1),[p,h]=He.useState(!1),A=di(Q=>Q.t0),R=di(Q=>Q.t1),B=He.useRef(null),N=nL(i,t(),o);He.useEffect(()=>{if(!p)return;const Q=window.setTimeout(()=>h(!1),1600);return()=>window.clearTimeout(Q)},[p]);const F=async()=>{var Q;try{await navigator.clipboard.writeText(N),h(!0)}catch{(Q=B.current)==null||Q.select()}};return j.jsxs("div",{className:"panel",children:[j.jsxs("h2",{children:["Share this view",j.jsx("button",{onClick:e,"aria-label":"Close",children:"Ã"})]}),j.jsxs("div",{style:{color:"var(--text-secondary)",fontSize:12,marginBottom:8},children:[OT(A)," â ",OT(R)]}),j.jsx("input",{ref:B,className:"share-url",readOnly:!0,value:N,onFocus:Q=>Q.currentTarget.select()}),j.jsxs("label",{className:"check",style:{fontSize:12,marginTop:8},children:[j.jsx("input",{type:"checkbox",checked:i,onChange:Q=>n(Q.currentTarget.checked)}),"Pin the current map view"]}),j.jsxs("label",{className:"check",style:{fontSize:12},children:[j.jsx("input",{type:"checkbox",checked:o,onChange:Q=>d(Q.currentTarget.checked)}),"Start the time-lapse on open"]}),j.jsx("div",{style:{color:"var(--text-muted)",fontSize:11,lineHeight:1.45,marginTop:2},children:i?"Opens at exactly this extent, whatever screen it is opened on.":"Opens framed on the ground this time frame covers."}),j.jsx("button",{className:"ghost",onClick:F,style:{marginTop:10,width:"100%"},children:p?"Copied":"Copy link"})]})}var dn;(function(t){t.assertEqual=o=>{};function e(o){}t.assertIs=e;function i(o){throw new Error}t.assertNever=i,t.arrayToEnum=o=>{const d={};for(const p of o)d[p]=p;return d},t.getValidEnumValues=o=>{const d=t.objectKeys(o).filter(h=>typeof o[o[h]]!="number"),p={};for(const h of d)p[h]=o[h];return t.objectValues(p)},t.objectValues=o=>t.objectKeys(o).map(function(d){return o[d]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{const d=[];for(const p in o)Object.prototype.hasOwnProperty.call(o,p)&&d.push(p);return d},t.find=(o,d)=>{for(const p of o)if(d(p))return p},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,d=" | "){return o.map(p=>typeof p=="string"?`'${p}'`:p).join(d)}t.joinValues=n,t.jsonStringifyReplacer=(o,d)=>typeof d=="bigint"?d.toString():d})(dn||(dn={}));var kT;(function(t){t.mergeShapes=(e,i)=>({...e,...i})})(kT||(kT={}));const Gt=dn.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ch=t=>{switch(typeof t){case"undefined":return Gt.undefined;case"string":return Gt.string;case"number":return Number.isNaN(t)?Gt.nan:Gt.number;case"boolean":return Gt.boolean;case"function":return Gt.function;case"bigint":return Gt.bigint;case"symbol":return Gt.symbol;case"object":return Array.isArray(t)?Gt.array:t===null?Gt.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Gt.promise:typeof Map<"u"&&t instanceof Map?Gt.map:typeof Set<"u"&&t instanceof Set?Gt.set:typeof Date<"u"&&t instanceof Date?Gt.date:Gt.object;default:return Gt.unknown}}
vendor: 4,379 bytes, line 2685
2685,Et=dn.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Wc extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const i=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,i):this.__proto__=i,this.name="ZodError",this.issues=e}format(e){const i=e||function(d){return d.message},n={_errors:[]},o=d=>{for(const p of d.issues)if(p.code==="invalid_union")p.unionErrors.map(o);else if(p.code==="invalid_return_type")o(p.returnTypeError);else if(p.code==="invalid_arguments")o(p.argumentsError);else if(p.path.length===0)n._errors.push(i(p));else{let h=n,A=0;for(;A<p.path.length;){const R=p.path[A];A===p.path.length-1?(h[R]=h[R]||{_errors:[]},h[R]._errors.push(i(p))):h[R]=h[R]||{_errors:[]},h=h[R],A++}}};return o(this),n}static assert(e){if(!(e instanceof Wc))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,dn.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=i=>i.message){const i={},n=[];for(const o of this.issues)if(o.path.length>0){const d=o.path[0];i[d]=i[d]||[],i[d].push(e(o))}else n.push(e(o));return{formErrors:n,fieldErrors:i}}get formErrors(){return this.flatten()}}Wc.create=t=>new Wc(t);const N0=(t,e)=>{let i;switch(t.code){case Et.invalid_type:t.received===Gt.undefined?i="Required":i=`Expected ${t.expected}, received ${t.received}`;break;case Et.invalid_literal:i=`Invalid literal value, expected ${JSON.stringify(t.expected,dn.jsonStringifyReplacer)}`;break;case Et.unrecognized_keys:i=`Unrecognized key(s) in object: ${dn.joinValues(t.keys,", ")}`;break;case Et.invalid_union:i="Invalid input";break;case Et.invalid_union_discriminator:i=`Invalid discriminator value. Expected ${dn.joinValues(t.options)}`;break;case Et.invalid_enum_value:i=`Invalid enum value. Expected ${dn.joinValues(t.options)}, received '${t.received}'`;break;case Et.invalid_arguments:i="Invalid function arguments";break;case Et.invalid_return_type:i="Invalid function return type";break;case Et.invalid_date:i="Invalid date";break;case Et.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(i=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(i=`${i} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?i=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?i=`Invalid input: must end with "${t.validation.endsWith}"`:dn.assertNever(t.validation):t.validation!=="regex"?i=`Invalid ${t.validation}`:i="Invalid";break;case Et.too_small:t.type==="array"?i=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?i=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?i=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?i=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?i=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:i="Invalid input";break;case Et.too_big:t.type==="array"?i=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?i=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?i=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?i=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?i=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:i="Invalid input";break;case Et.custom:i="Invalid input";break;
vendor: 4,957 bytes, line 2685
2685case Et.invalid_intersection_types:i="Intersection results could not be merged";break;case Et.not_multiple_of:i=`Number must be a multiple of ${t.multipleOf}`;break;case Et.not_finite:i="Number must be finite";break;default:i=e.defaultError,dn.assertNever(t)}return{message:i}};let aF=N0;function oF(){return aF}const lF=t=>{const{data:e,path:i,errorMaps:n,issueData:o}=t,d=[...i,...o.path||[]],p={...o,path:d};if(o.message!==void 0)return{...o,path:d,message:o.message};let h="";const A=n.filter(R=>!!R).slice().reverse();for(const R of A)h=R(p,{data:e,defaultError:h}).message;return{...o,path:d,message:h}};function Ft(t,e){const i=oF(),n=lF({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,i,i===N0?void 0:N0].filter(o=>!!o)});t.common.issues.push(n)}class qa{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,i){const n=[];for(const o of i){if(o.status==="aborted")return Ei;o.status==="dirty"&&e.dirty(),n.push(o.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,i){const n=[];for(const o of i){const d=await o.key,p=await o.value;n.push({key:d,value:p})}return qa.mergeObjectSync(e,n)}static mergeObjectSync(e,i){const n={};for(const o of i){const{key:d,value:p}=o;if(d.status==="aborted"||p.status==="aborted")return Ei;d.status==="dirty"&&e.dirty(),p.status==="dirty"&&e.dirty(),d.value!=="__proto__"&&(typeof p.value<"u"||o.alwaysSet)&&(n[d.value]=p.value)}return{status:e.value,value:n}}}const Ei=Object.freeze({status:"aborted"}),Jm=t=>({status:"dirty",value:t}),vo=t=>({status:"valid",value:t}),BT=t=>t.status==="aborted",NT=t=>t.status==="dirty",_p=t=>t.status==="valid",By=t=>typeof Promise<"u"&&t instanceof Promise;var Jt;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(Jt||(Jt={}));class yh{constructor(e,i,n,o){this._cachedPath=[],this.parent=e,this.data=i,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const zT=(t,e)=>{if(_p(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const i=new Wc(t.common.issues);return this._error=i,this._error}}};function $i(t){if(!t)return{};const{errorMap:e,invalid_type_error:i,required_error:n,description:o}=t;if(e&&(i||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(p,h)=>{const{message:A}=t;return p.code==="invalid_enum_value"?{message:A??h.defaultError}:typeof h.data>"u"?{message:A??n??h.defaultError}:p.code!=="invalid_type"?{message:h.defaultError}:{message:A??i??h.defaultError}},description:o}}class rn{get description(){return this._def.description}_getType(e){return ch(e.data)}_getOrReturnCtx(e,i){return i||{common:e.parent.common,data:e.data,parsedType:ch(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new qa,ctx:{common:e.parent.common,data:e.data,parsedType:ch(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const i=this._parse(e);if(By(i))throw new Error("Synchronous parse encountered promise.");return i}_parseAsync(e){const i=this._parse(e);return Promise.resolve(i)}parse(e,i){const n=this.safeParse(e,i);if(n.success)return n.data;throw n.error}safeParse(e,i){const n={common:{issues:[],async:(i==null?void 0:i.async)??!1,contextualErrorMap:i==null?void 0:i.errorMap},path:(i==null?void 0:i.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ch(e)},o=this._parseSync({data:e,path:n.path,parent:n});return zT(n,o)}"~validate"(e){var n,o;const i={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ch(e)};if(!this["~standard"].async)try{const d=this._parseSync({data:e,path:[],parent:i});return _p(d)?{value:d.value}:{issues:i.common.issues}}catch(d){(o=(n=d==null?void 0:d.message)==null?void 0:n.toLowerCase())!=null&&o.includes("encountered")&&(this["~standard"].async=!0),i.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:i}).then(d=>_p(d)?{value:d.value}:{issues:i.common.issues})}async parseAsync(e,i){const n=await this.safeParseAsync(e,i);if(n.success)return n.data;throw n.error}async safeParseAsync(e,i){const n={common:{issues:[],contextualErrorMap:i==null?void 0:i.errorMap,async:!0},path:(i==null?void 0:i.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ch(e)},o=this._parse({data:e,path:n.path,parent:n}),d=await(By(o)?o:Promise.resolve(o));return zT(n,d)}
vendor: 6,015 bytes, line 2685
2685refine(e,i){const n=o=>typeof i=="string"||typeof i>"u"?{message:i}:typeof i=="function"?i(o):i;return this._refinement((o,d)=>{const p=e(o),h=()=>d.addIssue({code:Et.custom,...n(o)});return typeof Promise<"u"&&p instanceof Promise?p.then(A=>A?!0:(h(),!1)):p?!0:(h(),!1)})}refinement(e,i){return this._refinement((n,o)=>e(n)?!0:(o.addIssue(typeof i=="function"?i(n,o):i),!1))}_refinement(e){return new bp({schema:this,typeName:Ci.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:i=>this["~validate"](i)}}optional(){return mh.create(this,this._def)}nullable(){return xp.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return tc.create(this)}promise(){return Fy.create(this,this._def)}or(e){return zy.create([this,e],this._def)}and(e){return Ly.create(this,e,this._def)}transform(e){return new bp({...$i(this._def),schema:this,typeName:Ci.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const i=typeof e=="function"?e:()=>e;return new F0({...$i(this._def),innerType:this,defaultValue:i,typeName:Ci.ZodDefault})}brand(){return new IF({typeName:Ci.ZodBranded,type:this,...$i(this._def)})}catch(e){const i=typeof e=="function"?e:()=>e;return new U0({...$i(this._def),innerType:this,catchValue:i,typeName:Ci.ZodCatch})}describe(e){const i=this.constructor;return new i({...this._def,description:e})}pipe(e){return Cx.create(this,e)}readonly(){return j0.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const cF=/^c[^\s-]{8,}$/i,uF=/^[0-9a-z]+$/,hF=/^[0-9A-HJKMNP-TV-Z]{26}$/i,dF=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,fF=/^[a-z0-9_-]{21}$/i,pF=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,mF=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,gF=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,_F="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Db;const yF=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,vF=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,bF=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,xF=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,wF=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,TF=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,qA="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",SF=new RegExp(`^${qA}$`);function ZA(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const i=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${i}`}function AF(t){return new RegExp(`^${ZA(t)}$`)}function EF(t){let e=`${qA}T${ZA(t)}`;const i=[];return i.push(t.local?"Z?":"Z"),t.offset&&i.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${i.join("|")})`,new RegExp(`^${e}$`)}function CF(t,e){return!!((e==="v4"||!e)&&yF.test(t)||(e==="v6"||!e)&&bF.test(t))}function RF(t,e){if(!pF.test(t))return!1;try{const[i]=t.split(".");if(!i)return!1;const n=i.replace(/-/g,"+").replace(/_/g,"/").padEnd(i.length+(4-i.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&(o==null?void 0:o.typ)!=="JWT"||!
vendor: 17,610 bytes, line 2685
2685o.alg||e&&o.alg!==e)}catch{return!1}}function MF(t,e){return!!((e==="v4"||!e)&&vF.test(t)||(e==="v6"||!e)&&xF.test(t))}class ph extends rn{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Gt.string){const d=this._getOrReturnCtx(e);return Ft(d,{code:Et.invalid_type,expected:Gt.string,received:d.parsedType}),Ei}const n=new qa;let o;for(const d of this._def.checks)if(d.kind==="min")e.data.length<d.value&&(o=this._getOrReturnCtx(e,o),Ft(o,{code:Et.too_small,minimum:d.value,type:"string",inclusive:!0,exact:!1,message:d.message}),n.dirty());else if(d.kind==="max")e.data.length>d.value&&(o=this._getOrReturnCtx(e,o),Ft(o,{code:Et.too_big,maximum:d.value,type:"string",inclusive:!0,exact:!1,message:d.message}),n.dirty());else if(d.kind==="length"){const p=e.data.length>d.value,h=e.data.length<d.value;(p||h)&&(o=this._getOrReturnCtx(e,o),p?Ft(o,{code:Et.too_big,maximum:d.value,type:"string",inclusive:!0,exact:!0,message:d.message}):h&&Ft(o,{code:Et.too_small,minimum:d.value,type:"string",inclusive:!0,exact:!0,message:d.message}),n.dirty())}else if(d.kind==="email")gF.test(e.data)||(o=this._getOrReturnCtx(e,o),Ft(o,{validation:"email",code:Et.invalid_string,message:d.message}),n.dirty());else if(d.kind==="emoji")Db||(Db=new RegExp(_F,"u")),Db.test(e.data)||(o=this._getOrReturnCtx(e,o),Ft(o,{validation:"emoji",code:Et.invalid_string,message:d.message}),n.dirty());else if(d.kind==="uuid")dF.test(e.data)||(o=this._getOrReturnCtx(e,o),Ft(o,{validation:"uuid",code:Et.invalid_string,message:d.message}),n.dirty());else if(d.kind==="nanoid")fF.test(e.data)||(o=this._getOrReturnCtx(e,o),Ft(o,{validation:"nanoid",code:Et.invalid_string,message:d.message}),n.dirty());else if(d.kind==="cuid")cF.test(e.data)||(o=this._getOrReturnCtx(e,o),Ft(o,{validation:"cuid",code:Et.invalid_string,message:d.message}),n.dirty());else if(d.kind==="cuid2")uF.test(e.data)||(o=this._getOrReturnCtx(e,o),Ft(o,{validation:"cuid2",code:Et.invalid_string,message:d.message}),n.dirty());else if(d.kind==="ulid")hF.test(e.data)||(o=this._getOrReturnCtx(e,o),Ft(o,{validation:"ulid",code:Et.invalid_string,message:d.message}),n.dirty());else if(d.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),Ft(o,{validation:"url",code:Et.invalid_string,message:d.message}),n.dirty()}else d.kind==="regex"?(d.regex.lastIndex=0,d.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),Ft(o,{validation:"regex",code:Et.invalid_string,message:d.message}),n.dirty())):d.kind==="trim"?e.data=e.data.trim():d.kind==="includes"?e.data.includes(d.value,d.position)||(o=this._getOrReturnCtx(e,o),Ft(o,{code:Et.invalid_string,validation:{includes:d.value,position:d.position},message:d.message}),n.dirty()):d.kind==="toLowerCase"?e.data=e.data.toLowerCase():d.kind==="toUpperCase"?e.data=e.data.toUpperCase():d.kind==="startsWith"?e.data.startsWith(d.value)||(o=this._getOrReturnCtx(e,o),Ft(o,{code:Et.invalid_string,validation:{startsWith:d.value},message:d.message}),n.dirty()):d.kind==="endsWith"?e.data.endsWith(d.value)||(o=this._getOrReturnCtx(e,o),Ft(o,{code:Et.invalid_string,validation:{endsWith:d.value},message:d.message}),n.dirty()):d.kind==="datetime"?EF(d).test(e.data)||(o=this._getOrReturnCtx(e,o),Ft(o,{code:Et.invalid_string,validation:"datetime",message:d.message}),n.dirty()):d.kind==="date"?SF.test(e.data)||(o=this._getOrReturnCtx(e,o),Ft(o,{code:Et.invalid_string,validation:"date",message:d.message}),n.dirty()):d.kind==="time"?AF(d).test(e.data)||(o=this._getOrReturnCtx(e,o),Ft(o,{code:Et.invalid_string,validation:"time",message:d.message}),n.dirty()):d.kind==="duration"?mF.test(e.data)||(o=this._getOrReturnCtx(e,o),Ft(o,{validation:"duration",code:Et.invalid_string,message:d.message}),n.dirty()):d.kind==="ip"?CF(e.data,d.version)||(o=this._getOrReturnCtx(e,o),Ft(o,{validation:"ip",code:Et.invalid_string,message:d.message}),n.dirty()):d.kind==="jwt"?RF(e.data,d.alg)||(o=this._getOrReturnCtx(e,o),Ft(o,{validation:"jwt",code:Et.invalid_string,message:d.message}),n.dirty()):d.kind==="cidr"?MF(e.data,d.version)||(o=this._getOrReturnCtx(e,o),Ft(o,{validation:"cidr",code:Et.invalid_string,message:d.message}),n.dirty()):d.kind==="base64"?wF.test(e.data)||(o=this._getOrReturnCtx(e,o),Ft(o,{validation:"base64",code:Et.invalid_string,message:d.message}),n.dirty()):d.kind==="base64url"?TF.test(e.data)||(o=this._getOrReturnCtx(e,o),Ft(o,{validation:"base64url",code:Et.invalid_string,message:d.message}),n.dirty()):dn.assertNever(d);return{status:n.value,value:e.data}}_regex(e,i,n){return this.refinement(o=>e.test(o),{validation:i,code:Et.invalid_string,...Jt.errToObj(n)})}_addCheck(e){return new ph({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Jt.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Jt.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Jt.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Jt.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Jt.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Jt.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Jt.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Jt.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Jt.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Jt.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Jt.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Jt.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Jt.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...Jt.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...Jt.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Jt.errToObj(e)})}regex(e,i){return this._addCheck({kind:"regex",regex:e,...Jt.errToObj(i)})}includes(e,i){return this._addCheck({kind:"includes",value:e,position:i==null?void 0:i.position,...Jt.errToObj(i==null?void 0:i.message)})}startsWith(e,i){return this._addCheck({kind:"startsWith",value:e,...Jt.errToObj(i)})}endsWith(e,i){return this._addCheck({kind:"endsWith",value:e,...Jt.errToObj(i)})}min(e,i){return this._addCheck({kind:"min",value:e,...Jt.errToObj(i)})}max(e,i){return this._addCheck({kind:"max",value:e,...Jt.errToObj(i)})}length(e,i){return this._addCheck({kind:"length",value:e,...Jt.errToObj(i)})}nonempty(e){return this.min(1,Jt.errToObj(e))}trim(){return new ph({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ph({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ph({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const i of this._def.checks)i.kind==="min"&&(e===null||i.value>e)&&(e=i.value);return e}get maxLength(){let e=null;for(const i of this._def.checks)i.kind==="max"&&(e===null||i.value<e)&&(e=i.value);return e}}ph.create=t=>new ph({checks:[],typeName:Ci.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...$i(t)});function PF(t,e){const i=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=i>n?i:n,d=Number.parseInt(t.toFixed(o).replace(".","")),p=Number.parseInt(e.toFixed(o).replace(".",""));return d%p/10**o}class yp extends rn{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Gt.number){const d=this._getOrReturnCtx(e);return Ft(d,{code:Et.invalid_type,expected:Gt.number,received:d.parsedType}),Ei}let n;const o=new qa;for(const d of this._def.checks)d.kind==="int"?dn.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),Ft(n,{code:Et.invalid_type,expected:"integer",received:"float",message:d.message}),o.dirty()):d.kind==="min"?(d.inclusive?e.data<d.value:e.data<=d.value)&&(n=this._getOrReturnCtx(e,n),Ft(n,{code:Et.too_small,minimum:d.value,type:"number",inclusive:d.inclusive,exact:!1,message:d.message}),o.dirty()):d.kind==="max"?(d.inclusive?e.data>d.value:e.data>=d.value)&&(n=this._getOrReturnCtx(e,n),Ft(n,{code:Et.too_big,maximum:d.value,type:"number",inclusive:d.inclusive,exact:!1,message:d.message}),o.dirty()):d.kind==="multipleOf"?PF(e.data,d.value)!==0&&(n=this._getOrReturnCtx(e,n),Ft(n,{code:Et.not_multiple_of,multipleOf:d.value,message:d.message}),o.dirty()):d.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),Ft(n,{code:Et.not_finite,message:d.message}),o.dirty()):dn.assertNever(d);return{status:o.value,value:e.data}}gte(e,i){return this.setLimit("min",e,!0,Jt.toString(i))}gt(e,i){return this.setLimit("min",e,!1,Jt.toString(i))}lte(e,i){return this.setLimit("max",e,!0,Jt.toString(i))}lt(e,i){return this.setLimit("max",e,!1,Jt.toString(i))}setLimit(e,i,n,o){return new yp({...this._def,checks:[...this._def.checks,{kind:e,value:i,inclusive:n,message:Jt.toString(o)}]})}_addCheck(e){return new yp({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Jt.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Jt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Jt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Jt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Jt.toString(e)})}multipleOf(e,i){return this._addCheck({kind:"multipleOf",value:e,message:Jt.toString(i)})}finite(e){return this._addCheck({kind:"finite",message:Jt.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Jt.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Jt.toString(e)})}get minValue(){let e=null;for(const i of this._def.checks)i.kind==="min"&&(e===null||i.value>e)&&(e=i.value);return e}get maxValue(){let e=null;for(const i of this._def.checks)i.kind==="max"&&(e===null||i.value<e)&&(e=i.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&dn.isInteger(e.value))}get isFinite(){let e=null,i=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(i===null||n.value>i)&&(i=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(i)&&Number.isFinite(e)}}yp.create=t=>new yp({checks:[],typeName:Ci.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...$i(t)});class gg extends rn{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==Gt.bigint)return this._getInvalidInput(e);let n;const o=new qa;for(const d of this._def.checks)d.kind==="min"?(d.inclusive?e.data<d.value:e.data<=d.value)&&(n=this._getOrReturnCtx(e,n),Ft(n,{code:Et.too_small,type:"bigint",minimum:d.value,inclusive:d.inclusive,message:d.message}),o.dirty()):d.kind==="max"?(d.inclusive?e.data>d.value:e.data>=d.value)&&(n=this._getOrReturnCtx(e,n),Ft(n,{code:Et.too_big,type:"bigint",maximum:d.value,inclusive:d.inclusive,message:d.message}),o.dirty()):d.kind==="multipleOf"?e.data%d.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),Ft(n,{code:Et.not_multiple_of,multipleOf:d.value,message:d.message}),o.dirty()):dn.assertNever(d);return{status:o.value,value:e.data}}_getInvalidInput(e){const i=this._getOrReturnCtx(e);return Ft(i,{code:Et.invalid_type,expected:Gt.bigint,received:i.parsedType}),Ei}gte(e,i){return this.setLimit("min",e,!0,Jt.toString(i))}gt(e,i){return this.setLimit("min",e,!1,Jt.toString(i))}lte(e,i){return this.setLimit("max",e,!0,Jt.toString(i))}lt(e,i){return this.setLimit("max",e,!1,Jt.toString(i))}setLimit(e,i,n,o){return new gg({...this._def,checks:[...this._def.checks,{kind:e,value:i,inclusive:n,message:Jt.toString(o)}]})}_addCheck(e){return new gg({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Jt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Jt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Jt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Jt.toString(e)})}multipleOf(e,i){return this._addCheck({kind:"multipleOf",value:e,message:Jt.toString(i)})}get minValue(){let e=null;for(const i of this._def.checks)i.kind==="min"&&(e===null||i.value>e)&&(e=i.value);return e}get maxValue(){let e=null;for(const i of this._def.checks)i.kind==="max"&&(e===null||i.value<e)&&(e=i.value);return e}}gg.create=t=>new gg({checks:[],typeName:Ci.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...$i(t)});class z0 extends rn{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Gt.boolean){const n=this._getOrReturnCtx(e);return Ft(n,{code:Et.invalid_type,expected:Gt.boolean,received:n.parsedType}),Ei}return vo(e.data)}}z0.create=t=>new z0({typeName:Ci.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...$i(t)});class Ny extends rn{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Gt.date){const d=this._getOrReturnCtx(e);return Ft(d,{code:Et.invalid_type,expected:Gt.date,received:d.parsedType}),Ei}if(Number.isNaN(e.data.getTime())){const d=this._getOrReturnCtx(e);return Ft(d,{code:Et.invalid_date}),Ei}const n=new qa;let o;for(const d of this._def.checks)d.kind==="min"?e.data.getTime()<d.value&&(o=this._getOrReturnCtx(e,o),Ft(o,{code:Et.too_small,message:d.message,inclusive:!0,exact:!1,minimum:d.value,type:"date"}),n.dirty()):d.kind==="max"?e.data.getTime()>d.value&&(o=this._getOrReturnCtx(e,o),Ft(o,{code:Et.too_big,message:d.message,inclusive:!0,exact:!1,maximum:d.value,type:"date"}),n.dirty()):dn.assertNever(d);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Ny({...this._def,checks:[...this._def.checks,e]})}min(e,i){return this._addCheck({kind:"min",value:e.getTime(),message:Jt.toString(i)})}max(e,i){return this._addCheck({kind:"max",value:e.getTime(),message:Jt.toString(i)})}get minDate(){let e=null;for(const i of this._def.checks)i.kind==="min"&&(e===null||i.value>e)&&(e=i.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const i of this._def.checks)i.kind==="max"&&(e===null||i.value<e)&&(e=i.value);return e!=null?new Date(e):null}}Ny.create=t=>new Ny({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:Ci.ZodDate,...$i(t)});class LT extends rn{_parse(e){if(this._getType(e)!==Gt.symbol){const n=this._getOrReturnCtx(e);return Ft(n,{code:Et.invalid_type,expected:Gt.symbol,received:n.parsedType}),Ei}return vo(e.data)}}LT.create=t=>new LT({typeName:Ci.ZodSymbol,...$i(t)});class FT extends rn{_parse(e){if(this._getType(e)!==Gt.undefined){const n=this._getOrReturnCtx(e);return Ft(n,{code:Et.invalid_type,expected:Gt.undefined,received:n.parsedType}),Ei}return vo(e.data)}}FT.create=t=>new FT({typeName:Ci.ZodUndefined,...$i(t)});class UT extends rn{_parse(e){if(this._getType(e)!==Gt.null){const n=this._getOrReturnCtx(e);return Ft(n,{code:Et.invalid_type,expected:Gt.null,received:n.parsedType}),Ei}return vo(e.data)}}UT.create=t=>new UT({typeName:Ci.ZodNull,...$i(t)});class jT extends rn{constructor(){super(...arguments),this._any=!0}_parse(e){return vo(e.data)}}jT.create=t=>new jT({typeName:Ci.ZodAny,...$i(t)});class VT extends rn{constructor(){super(...arguments),this._unknown=!0}_parse(e){return vo(e.data)}}VT.create=t=>new VT({typeName:Ci.ZodUnknown,...$i(t)});class vh extends rn{_parse(e){const i=this._getOrReturnCtx(e);return Ft(i,{code:Et.invalid_type,expected:Gt.never,received:i.parsedType}),Ei}}vh.create=t=>new vh({typeName:Ci.ZodNever,...$i(t)});class $T extends rn{_parse(e){if(this._getType(e)!==Gt.undefined){const n=this._getOrReturnCtx(e);return Ft(n,{code:Et.invalid_type,expected:Gt.void,received:n.parsedType}),Ei}return vo(e.data)}}$T.create=t=>new $T({typeName:Ci.ZodVoid,...$i(t)});class tc extends rn{_parse(e){const{ctx:i,status:n}=this._processInputParams(e),o=this._def;
vendor: 5,494 bytes, line 2685
2685if(i.parsedType!==Gt.array)return Ft(i,{code:Et.invalid_type,expected:Gt.array,received:i.parsedType}),Ei;if(o.exactLength!==null){const p=i.data.length>o.exactLength.value,h=i.data.length<o.exactLength.value;(p||h)&&(Ft(i,{code:p?Et.too_big:Et.too_small,minimum:h?o.exactLength.value:void 0,maximum:p?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&i.data.length<o.minLength.value&&(Ft(i,{code:Et.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&i.data.length>o.maxLength.value&&(Ft(i,{code:Et.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),i.common.async)return Promise.all([...i.data].map((p,h)=>o.type._parseAsync(new yh(i,p,i.path,h)))).then(p=>qa.mergeArray(n,p));const d=[...i.data].map((p,h)=>o.type._parseSync(new yh(i,p,i.path,h)));return qa.mergeArray(n,d)}get element(){return this._def.type}min(e,i){return new tc({...this._def,minLength:{value:e,message:Jt.toString(i)}})}max(e,i){return new tc({...this._def,maxLength:{value:e,message:Jt.toString(i)}})}length(e,i){return new tc({...this._def,exactLength:{value:e,message:Jt.toString(i)}})}nonempty(e){return this.min(1,e)}}tc.create=(t,e)=>new tc({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Ci.ZodArray,...$i(e)});function Xf(t){if(t instanceof Hr){const e={};for(const i in t.shape){const n=t.shape[i];e[i]=mh.create(Xf(n))}return new Hr({...t._def,shape:()=>e})}else return t instanceof tc?new tc({...t._def,type:Xf(t.element)}):t instanceof mh?mh.create(Xf(t.unwrap())):t instanceof xp?xp.create(Xf(t.unwrap())):t instanceof Bd?Bd.create(t.items.map(e=>Xf(e))):t}class Hr extends rn{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),i=dn.objectKeys(e);return this._cached={shape:e,keys:i},this._cached}_parse(e){if(this._getType(e)!==Gt.object){const R=this._getOrReturnCtx(e);return Ft(R,{code:Et.invalid_type,expected:Gt.object,received:R.parsedType}),Ei}const{status:n,ctx:o}=this._processInputParams(e),{shape:d,keys:p}=this._getCached(),h=[];if(!(this._def.catchall instanceof vh&&this._def.unknownKeys==="strip"))for(const R in o.data)p.includes(R)||h.push(R);const A=[];for(const R of p){const B=d[R],N=o.data[R];A.push({key:{status:"valid",value:R},value:B._parse(new yh(o,N,o.path,R)),alwaysSet:R in o.data})}if(this._def.catchall instanceof vh){const R=this._def.unknownKeys;if(R==="passthrough")for(const B of h)A.push({key:{status:"valid",value:B},value:{status:"valid",value:o.data[B]}});else if(R==="strict")h.length>0&&(Ft(o,{code:Et.unrecognized_keys,keys:h}),n.dirty());else if(R!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const R=this._def.catchall;for(const B of h){const N=o.data[B];A.push({key:{status:"valid",value:B},value:R._parse(new yh(o,N,o.path,B)),alwaysSet:B in o.data})}}return o.common.async?Promise.resolve().then(async()=>{const R=[];for(const B of A){const N=await B.key,F=await B.value;R.push({key:N,value:F,alwaysSet:B.alwaysSet})}return R}).then(R=>qa.mergeObjectSync(n,R)):qa.mergeObjectSync(n,A)}get shape(){return this._def.shape()}strict(e){return Jt.errToObj,new Hr({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(i,n)=>{var d,p;const o=((p=(d=this._def).errorMap)==null?void 0:p.call(d,i,n).message)??n.defaultError;return i.code==="unrecognized_keys"?{message:Jt.errToObj(e).message??o}:{message:o}}}:{}})}strip(){return new Hr({...this._def,unknownKeys:"strip"})}passthrough(){return new Hr({...this._def,unknownKeys:"passthrough"})}extend(e){return new Hr({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Hr({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Ci.ZodObject})}setKey(e,i){return this.augment({[e]:i})}catchall(e){return new Hr({...this._def,catchall:e})}pick(e){const i={};for(const n of dn.objectKeys(e))e[n]&&this.shape[n]&&(i[n]=this.shape[n]);return new Hr({...this._def,shape:()=>i})}omit(e){const i={};for(const n of dn.objectKeys(this.shape))e[n]||(i[n]=this.shape[n]);return new Hr({...this._def,shape:()=>i})}deepPartial(){return Xf(this)}partial(e){const i={};for(const n of dn.objectKeys(this.shape)){const o=this.shape[n];e&&!e[n]?i[n]=o:i[n]=o.optional()}return new Hr({...this._def,shape:()=>i})}required(e){const i={};for(const n of dn.objectKeys(this.shape))if(e&&!e[n])i[n]=this.shape[n];else{let d=this.shape[n];for(;d instanceof mh;)d=d._def.innerType;i[n]=d}return new Hr({...this._def,shape:()=>i})}keyof(){return YA(dn.objectKeys(this.shape))}}Hr.create=(t,e)=>new Hr({shape:()=>t,unknownKeys:"strip",catchall:vh.create(),typeName:Ci.ZodObject,...$i(e)});Hr.strictCreate=(t,e)=>new Hr({shape:()=>t,unknownKeys:"strict",catchall:vh.create(),typeName:Ci.ZodObject,...$i(e)});Hr.lazycreate=(t,e)=>new Hr({shape:t,unknownKeys:"strip",catchall:vh.create(),typeName:Ci.ZodObject,...$i(e)});class zy extends rn{_parse(e){const{ctx:i}=this._processInputParams(e),n=this._def.options;function o(d){for(const h of d)if(h.result.status==="valid")return h.result;for(const h of d)if(h.result.status==="dirty")return i.common.issues.push(...h.ctx.common.issues),h.result;const p=d.map(h=>new Wc(h.ctx.common.issues));
vendor: 4,118 bytes, line 2685
2685return Ft(i,{code:Et.invalid_union,unionErrors:p}),Ei}if(i.common.async)return Promise.all(n.map(async d=>{const p={...i,common:{...i.common,issues:[]},parent:null};return{result:await d._parseAsync({data:i.data,path:i.path,parent:p}),ctx:p}})).then(o);{let d;const p=[];for(const A of n){const R={...i,common:{...i.common,issues:[]},parent:null},B=A._parseSync({data:i.data,path:i.path,parent:R});if(B.status==="valid")return B;B.status==="dirty"&&!d&&(d={result:B,ctx:R}),R.common.issues.length&&p.push(R.common.issues)}if(d)return i.common.issues.push(...d.ctx.common.issues),d.result;const h=p.map(A=>new Wc(A));return Ft(i,{code:Et.invalid_union,unionErrors:h}),Ei}}get options(){return this._def.options}}zy.create=(t,e)=>new zy({options:t,typeName:Ci.ZodUnion,...$i(e)});function L0(t,e){const i=ch(t),n=ch(e);if(t===e)return{valid:!0,data:t};if(i===Gt.object&&n===Gt.object){const o=dn.objectKeys(e),d=dn.objectKeys(t).filter(h=>o.indexOf(h)!==-1),p={...t,...e};for(const h of d){const A=L0(t[h],e[h]);if(!A.valid)return{valid:!1};p[h]=A.data}return{valid:!0,data:p}}else if(i===Gt.array&&n===Gt.array){if(t.length!==e.length)return{valid:!1};const o=[];for(let d=0;d<t.length;d++){const p=t[d],h=e[d],A=L0(p,h);if(!A.valid)return{valid:!1};o.push(A.data)}return{valid:!0,data:o}}else return i===Gt.date&&n===Gt.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class Ly extends rn{_parse(e){const{status:i,ctx:n}=this._processInputParams(e),o=(d,p)=>{if(BT(d)||BT(p))return Ei;const h=L0(d.value,p.value);return h.valid?((NT(d)||NT(p))&&i.dirty(),{status:i.value,value:h.data}):(Ft(n,{code:Et.invalid_intersection_types}),Ei)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([d,p])=>o(d,p)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}Ly.create=(t,e,i)=>new Ly({left:t,right:e,typeName:Ci.ZodIntersection,...$i(i)});class Bd extends rn{_parse(e){const{status:i,ctx:n}=this._processInputParams(e);if(n.parsedType!==Gt.array)return Ft(n,{code:Et.invalid_type,expected:Gt.array,received:n.parsedType}),Ei;if(n.data.length<this._def.items.length)return Ft(n,{code:Et.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ei;!this._def.rest&&n.data.length>this._def.items.length&&(Ft(n,{code:Et.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),i.dirty());const d=[...n.data].map((p,h)=>{const A=this._def.items[h]||this._def.rest;return A?A._parse(new yh(n,p,n.path,h)):null}).filter(p=>!!p);return n.common.async?Promise.all(d).then(p=>qa.mergeArray(i,p)):qa.mergeArray(i,d)}get items(){return this._def.items}rest(e){return new Bd({...this._def,rest:e})}}Bd.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Bd({items:t,typeName:Ci.ZodTuple,rest:null,...$i(e)})};class HT extends rn{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:i,ctx:n}=this._processInputParams(e);if(n.parsedType!==Gt.map)return Ft(n,{code:Et.invalid_type,expected:Gt.map,received:n.parsedType}),Ei;const o=this._def.keyType,d=this._def.valueType,p=[...n.data.entries()].map(([h,A],R)=>({key:o._parse(new yh(n,h,n.path,[R,"key"])),value:d._parse(new yh(n,A,n.path,[R,"value"]))}));if(n.common.async){const h=new Map;return Promise.resolve().then(async()=>{for(const A of p){const R=await A.key,B=await A.value;if(R.status==="aborted"||B.status==="aborted")return Ei;(R.status==="dirty"||B.status==="dirty")&&i.dirty(),h.set(R.value,B.value)}return{status:i.value,value:h}})}else{const h=new Map;for(const A of p){const R=A.key,B=A.value;if(R.status==="aborted"||B.status==="aborted")return Ei;(R.status==="dirty"||B.status==="dirty")&&i.dirty(),h.set(R.value,B.value)}return{status:i.value,value:h}}}}HT.create=(t,e,i)=>new HT({valueType:e,keyType:t,typeName:Ci.ZodMap,...$i(i)});class _g extends rn{_parse(e){const{status:i,ctx:n}=this._processInputParams(e);
vendor: 4,225 bytes, line 2685
2685if(n.parsedType!==Gt.set)return Ft(n,{code:Et.invalid_type,expected:Gt.set,received:n.parsedType}),Ei;const o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(Ft(n,{code:Et.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),i.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(Ft(n,{code:Et.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),i.dirty());const d=this._def.valueType;function p(A){const R=new Set;for(const B of A){if(B.status==="aborted")return Ei;B.status==="dirty"&&i.dirty(),R.add(B.value)}return{status:i.value,value:R}}const h=[...n.data.values()].map((A,R)=>d._parse(new yh(n,A,n.path,R)));return n.common.async?Promise.all(h).then(A=>p(A)):p(h)}min(e,i){return new _g({...this._def,minSize:{value:e,message:Jt.toString(i)}})}max(e,i){return new _g({...this._def,maxSize:{value:e,message:Jt.toString(i)}})}size(e,i){return this.min(e,i).max(e,i)}nonempty(e){return this.min(1,e)}}_g.create=(t,e)=>new _g({valueType:t,minSize:null,maxSize:null,typeName:Ci.ZodSet,...$i(e)});class WT extends rn{get schema(){return this._def.getter()}_parse(e){const{ctx:i}=this._processInputParams(e);return this._def.getter()._parse({data:i.data,path:i.path,parent:i})}}WT.create=(t,e)=>new WT({getter:t,typeName:Ci.ZodLazy,...$i(e)});class XT extends rn{_parse(e){if(e.data!==this._def.value){const i=this._getOrReturnCtx(e);return Ft(i,{received:i.data,code:Et.invalid_literal,expected:this._def.value}),Ei}return{status:"valid",value:e.data}}get value(){return this._def.value}}XT.create=(t,e)=>new XT({value:t,typeName:Ci.ZodLiteral,...$i(e)});function YA(t,e){return new vp({values:t,typeName:Ci.ZodEnum,...$i(e)})}class vp extends rn{_parse(e){if(typeof e.data!="string"){const i=this._getOrReturnCtx(e),n=this._def.values;return Ft(i,{expected:dn.joinValues(n),received:i.parsedType,code:Et.invalid_type}),Ei}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const i=this._getOrReturnCtx(e),n=this._def.values;return Ft(i,{received:i.data,code:Et.invalid_enum_value,options:n}),Ei}return vo(e.data)}get options(){return this._def.values}get enum(){const e={};for(const i of this._def.values)e[i]=i;return e}get Values(){const e={};for(const i of this._def.values)e[i]=i;return e}get Enum(){const e={};for(const i of this._def.values)e[i]=i;return e}extract(e,i=this._def){return vp.create(e,{...this._def,...i})}exclude(e,i=this._def){return vp.create(this.options.filter(n=>!e.includes(n)),{...this._def,...i})}}vp.create=YA;class qT extends rn{_parse(e){const i=dn.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Gt.string&&n.parsedType!==Gt.number){const o=dn.objectValues(i);return Ft(n,{expected:dn.joinValues(o),received:n.parsedType,code:Et.invalid_type}),Ei}if(this._cache||(this._cache=new Set(dn.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const o=dn.objectValues(i);return Ft(n,{received:n.data,code:Et.invalid_enum_value,options:o}),Ei}return vo(e.data)}get enum(){return this._def.values}}qT.create=(t,e)=>new qT({values:t,typeName:Ci.ZodNativeEnum,...$i(e)});class Fy extends rn{unwrap(){return this._def.type}_parse(e){const{ctx:i}=this._processInputParams(e);if(i.parsedType!==Gt.promise&&i.common.async===!1)return Ft(i,{code:Et.invalid_type,expected:Gt.promise,received:i.parsedType}),Ei;const n=i.parsedType===Gt.promise?i.data:Promise.resolve(i.data);return vo(n.then(o=>this._def.type.parseAsync(o,{path:i.path,errorMap:i.common.contextualErrorMap})))}}Fy.create=(t,e)=>new Fy({type:t,typeName:Ci.ZodPromise,...$i(e)});class bp extends rn{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ci.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:i,ctx:n}=this._processInputParams(e),o=this._def.effect||null,d={addIssue:p=>{Ft(n,p),p.fatal?i.abort():i.dirty()},get path(){return n.path}};if(d.addIssue=d.addIssue.bind(d),o.type==="preprocess"){const p=o.transform(n.data,d);if(n.common.async)return Promise.resolve(p).then(async h=>{if(i.value==="aborted")return Ei;const A=await this._def.schema._parseAsync({data:h,path:n.path,parent:n});
vendor: 4,567 bytes, line 2685
2685return A.status==="aborted"?Ei:A.status==="dirty"||i.value==="dirty"?Jm(A.value):A});{if(i.value==="aborted")return Ei;const h=this._def.schema._parseSync({data:p,path:n.path,parent:n});return h.status==="aborted"?Ei:h.status==="dirty"||i.value==="dirty"?Jm(h.value):h}}if(o.type==="refinement"){const p=h=>{const A=o.refinement(h,d);if(n.common.async)return Promise.resolve(A);if(A instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return h};if(n.common.async===!1){const h=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return h.status==="aborted"?Ei:(h.status==="dirty"&&i.dirty(),p(h.value),{status:i.value,value:h.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(h=>h.status==="aborted"?Ei:(h.status==="dirty"&&i.dirty(),p(h.value).then(()=>({status:i.value,value:h.value}))))}if(o.type==="transform")if(n.common.async===!1){const p=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!_p(p))return Ei;const h=o.transform(p.value,d);if(h instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:i.value,value:h}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(p=>_p(p)?Promise.resolve(o.transform(p.value,d)).then(h=>({status:i.value,value:h})):Ei);dn.assertNever(o)}}bp.create=(t,e,i)=>new bp({schema:t,typeName:Ci.ZodEffects,effect:e,...$i(i)});bp.createWithPreprocess=(t,e,i)=>new bp({schema:e,effect:{type:"preprocess",transform:t},typeName:Ci.ZodEffects,...$i(i)});class mh extends rn{_parse(e){return this._getType(e)===Gt.undefined?vo(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}mh.create=(t,e)=>new mh({innerType:t,typeName:Ci.ZodOptional,...$i(e)});class xp extends rn{_parse(e){return this._getType(e)===Gt.null?vo(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}xp.create=(t,e)=>new xp({innerType:t,typeName:Ci.ZodNullable,...$i(e)});class F0 extends rn{_parse(e){const{ctx:i}=this._processInputParams(e);let n=i.data;return i.parsedType===Gt.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:i.path,parent:i})}removeDefault(){return this._def.innerType}}F0.create=(t,e)=>new F0({innerType:t,typeName:Ci.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...$i(e)});class U0 extends rn{_parse(e){const{ctx:i}=this._processInputParams(e),n={...i,common:{...i.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return By(o)?o.then(d=>({status:"valid",value:d.status==="valid"?d.value:this._def.catchValue({get error(){return new Wc(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Wc(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}U0.create=(t,e)=>new U0({innerType:t,typeName:Ci.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...$i(e)});class ZT extends rn{_parse(e){if(this._getType(e)!==Gt.nan){const n=this._getOrReturnCtx(e);return Ft(n,{code:Et.invalid_type,expected:Gt.nan,received:n.parsedType}),Ei}return{status:"valid",value:e.data}}}ZT.create=t=>new ZT({typeName:Ci.ZodNaN,...$i(t)});class IF extends rn{_parse(e){const{ctx:i}=this._processInputParams(e),n=i.data;return this._def.type._parse({data:n,path:i.path,parent:i})}unwrap(){return this._def.type}}class Cx extends rn{_parse(e){const{status:i,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const d=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return d.status==="aborted"?Ei:d.status==="dirty"?(i.dirty(),Jm(d.value)):this._def.out._parseAsync({data:d.value,path:n.path,parent:n})})();{const o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?Ei:o.status==="dirty"?(i.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(e,i){return new Cx({in:e,out:i,typeName:Ci.ZodPipeline})}}class j0 extends rn{_parse(e){const i=this._def.innerType._parse(e),n=o=>(_p(o)&&(o.value=Object.freeze(o.value)),o);return By(i)?i.then(o=>n(o)):n(i)}unwrap(){return this._def.innerType}}j0.create=(t,e)=>new j0({innerType:t,typeName:Ci.ZodReadonly,...$i(e)});var Ci;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodD
2685ate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Ci||(Ci={}));const sl=ph.create,ic=yp.create,Ob=z0.create;vh.create;const Rx=tc.create,Nd=Hr.create;zy.create;Ly.create;const DF=Bd.create;vp.create;Fy.create;mh.create;xp.create;const OF="https://www.strava.com/oauth/token",kF="https://www.strava.com/oauth/authorize",Mx="activity:read_all",BF=Nd({access_token:sl(),refresh_token:sl(),expires_at:ic(),athlete:Nd({id:ic()}).passthrough().nullable().optional()}).passthrough();async function GA(t){const e=await fetch(OF,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:t});if(!e.ok)throw new Error(`Strava token request failed: HTTP ${e.status}`);return BF.parse(await e.json())}async function NF(t,e){const i=await GA(new URLSearchParams({client_id:t.clientId,client_secret:t.clientSecret,grant_type:"refresh_token",refresh_token:e.refreshToken}));return{accessToken:i.access_token,expiresAt:i.expires_at,refreshToken:i.refresh_token,rotated:i.refresh_token!==e.refreshToken}}async function KA(t,e){var n;const i=await GA(new URLSearchParams({client_id:t.clientId,client_secret:t.clientSecret,grant_type:"authorization_code",code:e}));return{refreshToken:i.refresh_token,accessToken:i.access_token,expiresAt:i.expires_at,athleteId:(n=i.athlete)==null?void 0:n.id}}function zF(t,e,i){const n=new URLSearchParams({client_id:t,redirect_uri:e,response_type:"code",approval_prompt:"force",scope:Mx});return i!==void 0&&n.set("state",i),`${kF}?${n.toString()}`}const LF="https://www.strava.com/api/v3";class V0 extends Error{constructor(i,n={}){super(i);Y(this,"retryAfterMs");Y(this,"usage");this.name="RateLimitError",n.retryAfterMs!==void 0&&(this.retryAfterMs=n.retryAfterMs),n.usage&&(this.usage=n.usage)}}class eg extends Error{constructor(i,n){super(i);Y(this,"status");this.name="StravaHttpError",this.status=n}}function ey(t){if(t===null)return null;const e=t.split(",");if(e.length<2)return null;const i=Number(e[0].trim()),n=Number(e[1].trim());return!Number.isFinite(i)||!Number.isFinite(n)?null:[i,n]}function FF(t){const e=ey(t.get("x-readratelimit-usage"))??ey(t.get("x-ratelimit-usage")),i=ey(t.get("x-readratelimit-limit"))??ey(t.get("x-ratelimit-limit"));return!e||!i?null:{shortUsage:e[0],dailyUsage:e[1],shortLimit:i[0],dailyLimit:i[1]}}async function QA(t,e){const i=new URL(`${LF}${t.startsWith("/")?t:`/${t}`}`);for(const[d,p]of Object.entries(e.query??{}))p!==void 0&&i.searchParams.set(d,String(p));const n=await fetch(i.toString(),{headers:{Authorization:`Bearer ${e.accessToken}`,Accept:"application/json"}}),o=FF(n.headers);if(n.status===429){const d=Number(n.headers.get("retry-after"));throw new V0(`Strava rate limit reached on GET ${t}`,{retryAfterMs:Number.isFinite(d)&&d>0?d*1e3:void 0,usage:o})}if(!n.ok)throw new eg(`Strava GET ${t} failed: HTTP ${n.status}`,n.status);return{data:await n.json(),rateLimit:o}}const UF=200,jF=300;function VF(t){return new Promise(e=>setTimeout(e,t))}async function*$F(t){const e=t.perPage??UF,i=t.pace??jF;for(let n=1;;n++){n>1&&i>0&&await VF(i);const{data:o}=await QA("/athlete/activities",{accessToken:t.accessToken,query:{per_page:e,page:n,after:t.after}});if(!Array.isArray(o))throw new Error("Strava returned a non-array page from /athlete/activities");if(o.length>0&&(yield o),o.length<e)return}}const YT=Nd({data:Rx(ic()),series_type:sl().optional(),original_size:ic().optional(),resolution:sl().optional()}).passthrough(),HF=Nd({data:Rx(DF([ic(),ic()])),series_type:sl().optional(),original_size:ic().optional(),resolution:sl().optional()}).passthrough(),WF=Nd({latlng:HF.optional(),time:YT.optional(),altitude:YT.optional()}).passthrough(),XF=Nd({id:ic(),name:sl(),sport_type:sl(),start_date:sl(),start_date_local:sl(),distance:ic(),trainer:Ob(),manual:Ob(),start_latlng:Rx(ic()).nullable().optional(),has_heartrate:Ob().optional(),map:Nd({summary_polyline:sl().nullable().optional()}).passthrough().nullable().optional()}
2685).passthrough(),qF=new Set(["achievement_count","athlete","athlete_count","average_cadence","average_heartrate","average_speed","average_temp","average_watts","comment_count","commute","device_watts","display_hide_heartrate_option","distance","elapsed_time","elev_high","elev_low","end_latlng","external_id","flagged","from_accepted_tag","gear_id","has_heartrate","has_kudoed","heartrate_opt_out","hide_from_home","id","kilojoules","kudos_count","location_city","location_country","location_state","manual","map","max_heartrate","max_speed","max_watts","moving_time","name","photo_count","pr_count","private","resource_state","sport_type","start_date","start_date_local","start_latlng","suffer_score","timezone","total_elevation_gain","total_photo_count","trainer","type","upload_id","upload_id_str","utc_offset","visibility","weighted_average_watts","workout_type"]);let GT=!1;function ZF(t){const e=XF.parse(t);if(!GT){const i=Object.keys(e).filter(n=>!qF.has(n));i.length>0&&(GT=!0,console.warn(`strava: unrecognized SummaryActivity fields: ${i.sort().join(", ")}`))}return e}const JA="app",eE="token",YF=300,lh="localhost";async function GF(t){await vd(kd,{k:JA,v:t})}async function Cp(){const t=await _v(kd,JA),e=t==null?void 0:t.v;return!e||!e.clientId||!e.clientSecret?null:{...e,callbackDomain:e.callbackDomain||lh}}async function yv(t){await vd(kd,{k:eE,v:t})}async function Px(){var e;const t=await _v(kd,eE);return(e=t==null?void 0:t.v)!=null&&e.refreshToken?t.v:null}async function KF(){return await Cp()!==null&&await Px()!==null}class QF extends Error{constructor(){super("Not connected to Strava."),this.name="NotConnectedError"}}async function KT(){const t=await Cp(),e=await Px();if(!t||!e)throw new QF;const i=Math.floor(Date.now()/1e3);if(e.accessToken&&e.expiresAt&&e.expiresAt-YF>i)return e.accessToken;const n=await NF(t,e);try{await yv({refreshToken:n.refreshToken,accessToken:n.accessToken,expiresAt:n.expiresAt,athleteId:e.athleteId})}catch(o){throw new Error("Your Strava sign-in was renewed but could not be saved, most likely because this browser is out of storage. Free up space and sign in again. Your downloaded activities are untouched.",{cause:o})}return n.accessToken}async function JF(){const t=await Px();t&&await yv({refreshToken:t.refreshToken,athleteId:t.athleteId})}const yg="um.oauth.state";function uy(t){return`${t==="localhost"||t==="127.0.0.1"||t==="[::1]"?"http":"https"}://${t}/`}function eU(){return window.location.hostname}function tE(t){return t===eU()}function tU(){const t=new Uint8Array(16);return crypto.getRandomValues(t),Array.from(t,e=>e.toString(16).padStart(2,"0")).join("")}async function iU(){const t=await Cp();if(!t)throw new Error("Add your Strava app credentials first.");const e=tU();sessionStorage.setItem(yg,e);const i=zF(t.clientId,uy(t.callbackDomain),e);return tE(t.callbackDomain)?(window.location.assign(i),{kind:"redirected"}):window.open(i,"_blank","noopener")?{kind:"popup",url:i}:{kind:"blocked",url:i}}async function nU(t){const e=t.trim();if(!e)return{kind:"error",message:"Paste the address you were redirected to."};let i;try{/^https?:\/\//i.test(e)?i=new URL(e).searchParams:e.includes("=")?i=new URLSearchParams(e.replace(/^\?/,"")):i=new URLSearchParams({code:e})}catch{return{kind:"error",message:"That does not look like a web address. Paste the whole thing."}}if(i.get("error"))return{kind:"denied"};const n=i.get("code");if(!n)return{kind:"error",message:"No authorization code in that address. Make sure you copied the whole thing, including everything after the question mark."};const o=sessionStorage.getItem(yg),d=i.get("state");if(o&&d&&d!==o)return{kind:"error",message:"That address is from a different sign-in attempt. Start again and paste the new one."};sessionStorage.removeItem(yg);const p=i.get("scope");if(p!==null&&!p.split(",").includes(Mx))return{kind:"error",message:'The "View data about your private activities" permission was not granted. Without it Strava hides private activities and trims GPS inside your privacy zones, which would leave gaps in your map. Please authorize again and leave that box ticked.'};const h=await Cp();if(!h)return{kind:"error",message:"Your app credentials are missing. Start again."};try{const A=await KA(h,n);return await yv(A),{kind:"connected",athleteId:A.athleteId}}catch{return{kind:"error",message:"Strava rejected that code. Authorization codes are single-use and expire quickly, so the usual fix is to authorize again and paste the fresh address."}}}function rU(){const t=new URL(window.location.href);for(const e of["code","state","scope","error"])t.searchParams.delete(e);window.history.replaceState(null,"",t.pathname+t.search+t.hash)}let sU=null;function aU(){return sU??(sU=oU())}async function oU(){const t=new URLSearchParams(window.location.search),e=t.get("code"),i=t.get("error");
2685if(!e&&!i)return{kind:"none"};const n=sessionStorage.getItem(yg);if(sessionStorage.removeItem(yg),rU(),i)return{kind:"denied"};if(!n||t.get("state")!==n)return{kind:"error",message:"That sign-in did not start from this tab. Please try again."};if(!(t.get("scope")??"").split(",").includes(Mx))return{kind:"error",message:'The "View data about your private activities" permission was not granted. Without it Strava hides private activities and trims GPS inside your privacy zones, which would leave gaps in your map. Please authorize again and leave that box ticked.'};const d=await Cp();if(!d)return{kind:"error",message:"Your app credentials are missing. Start again."};try{const p=await KA(d,e);return await yv(p),{kind:"connected",athleteId:p.athleteId}}catch{return{kind:"error",message:"Strava rejected the sign-in. The usual cause is a Client ID or Secret that does not match the app you authorized. Check both and try again."}}}const lU="#fc4c02";function $0({onClick:t,children:e}){return j.jsx("button",{onClick:t,style:{background:lU,color:"#fff",border:"none",borderRadius:6,padding:"11px 20px",fontSize:14,fontWeight:600,fontFamily:"var(--font)",cursor:"pointer"},children:e})}function cU({onStart:t}){return j.jsx("div",{className:"connect-scroll",children:j.jsxs("div",{className:"connect-card",children:[j.jsxs("h1",{className:"connect-title",children:["How much ground have you ",j.jsx("em",{children:"actually"})," covered?"]}),j.jsx("p",{className:"connect-lede",children:"Strava adds up every mile you log. It never tells you how much of the world those miles actually cover â how much distinct road and trail your feet have genuinely been on, counting the loop you have run two hundred times exactly once."}),j.jsxs("div",{className:"connect-numbers",children:[j.jsxs("div",{children:[j.jsx("div",{className:"connect-num",style:{color:"var(--text-primary)"},children:"10,639"}),j.jsx("div",{className:"connect-num-label",children:"miles logged"})]}),j.jsx("div",{className:"connect-num-arrow",children:"becomes"}),j.jsxs("div",{children:[j.jsx("div",{className:"connect-num",style:{color:"var(--frontier)"},children:"3,975"}),j.jsx("div",{className:"connect-num-label",children:"miles of actual ground"})]})]}),j.jsx("p",{className:"connect-fine",style:{marginTop:-14,marginBottom:18},children:"One athleteâs six years, as an example. Yours will be different, and you are the only person who will ever see it."}),j.jsx("p",{className:"connect-lede",children:"This works that number out from your GPS, then draws it. Ground you have covered once glows gold. Ground you have worn a groove into fades to blue. Scrub through time and watch your own map fill in."}),j.jsxs("div",{className:"connect-promise",children:[j.jsx("strong",{children:"Your history never leaves this browser."})," There is no server here, no account, and no database. Your activities are downloaded straight from Strava to this tab, and everything is computed and stored on your own machine. Nobody, including whoever made this, can see your map."]}),j.jsx("div",{style:{marginTop:22},children:j.jsx($0,{onClick:t,children:"Connect with Strava"})}),j.jsx("p",{className:"connect-fine",children:"Because everything runs in your browser, you connect using your own Strava API credentials rather than shared ones â it takes about two minutes and the next screen walks you through it. Since June 2026 Strava requires a paid subscription to hold API credentials, so this route needs one."})]})})}function uU({onBack:t,onConnected:e}){const[i,n]=He.useState(""),[o,d]=He.useState(""),[p,h]=He.useState(lh),[A,R]=He.useState(""),[B,N]=He.useState(!1),[F,Q]=He.useState(null),[re,se]=He.useState(!1),[ae,me]=He.useState(null);He.useEffect(()=>{Cp().then(Re=>{Re&&(n(Re.clientId),d(Re.clientSecret),h(Re.callbackDomain))})},[]);const we=async()=>{const Re=i.trim(),Ee=o.trim(),Je=p.trim().replace(/^https?:\/\//i,"").replace(/\/.*$/,"");return/^\d+$/.test(Re)?Ee.length<20?(me('That Client Secret looks too short. Use "Show" on Strava to reveal the full value.'),!1):Je?(h(Je),await GF({clientId:Re,clientSecret:Ee,callbackDomain:Je}),!0):(me("Enter the Authorization Callback Domain shown on your Strava app settings."),!1):(me("The Client ID is the short number at the top of your Strava app settings."),!1)},ve=async()=>{se(!0),me(null);try{if(await WA(),!await we())return;const Re=await iU();if(Re.kind==="redirected")return;Q(Re.kind==="blocked"?Re.url:null),N(!0)}catch(Re){me(Re instanceof Error?Re.message:String(Re))}finally{se(!1)}},Oe=async()=>{se(!0),me(null);const Re=await nU(A);if(se(!1),Re.kind==="connected")return e();if(Re.kind==="denied"){me("You declined the authorization on Strava. Nothing was changed.");return}Re.kind==="error"&&me(Re.message)},Te=tE(p.trim());return j.jsx("div",{className:"connect-scroll",children:j.jsxs("div",{className:"connect-card",children:[j.jsx("button",{className:"ghost",onClick:t,style:{marginBottom:18},children:"â Back"}),j.jsx("h1",{className:"connect-title",style:{fontSize:26},children:"Create your own Strava API application"}),j.jsx("p",{className:"connect-lede",children:"Stravaâs rate limits are counted per application, so a shared one would run dry after a handful of people. Registering your own gives you your own quota â and means your data is only ever moving between you and Strava."}),j.jsxs("ol",{className:"connect-steps",children:[j.jsxs("li",{children:["Open"," ",j.jsx("a",{href:"https://www.strava.com/settings/api",target:"_blank",rel:"noreferrer noopener",children:"strava.com/settings/api"})," ","and fill in the form. Any application name works â ",j.jsx("em",{children:"My Coverage Map"})," is fine. Category can be ",j.jsx("em",{children:"Data Importer"}),"."]}),j.jsxs("li",{children:["Leave ",j.jsx("strong",{children:"Authorization Callback Domain"})," as"," ",j.jsx("code",{children:lh}),", or whatever it already says. Copy that value into the box below so we send you to the same place Strava expects.",j.jsxs("div",{className:"connect-warn",children:["You do ",j.jsx("strong",{children:"not"})," need to change this to use this site, and you should not if another tool already depends on it â Strava allows only one per application. ",j.jsx("code",{children:lh})," is the safest choice: nothing is listening there, so your authorization code is never sent to any server at all."]})]}),j.jsx("li",{children:"Strava asks you to upload an icon before it will save. Any small image will do; it is only shown to you."}),j.jsxs("li",{children:["Once saved, the page shows your ",j.jsx("strong",{children:"Client ID"})," and, behind a âShowâ link, your ",j.jsx("strong",{children:"Client Secret"}),". Paste both below."]})]}),j.jsxs("div",{className:"connect-field",children:[j.jsx("label",{htmlFor:"cid",children:"Client ID"}),j.jsx("input",{id:"cid",value:i,onChange:Re=>n(Re.target.value),placeholder:"123456",inputMode:"numeric",autoComplete:"off"})]}),j.jsxs("div",{className:"connect-field",children:[j.jsx("label",{htmlFor:"csec",children:"Client Secret"}),j.jsx("input",{id:"csec",value:o,onChange:Re=>d(Re.target.value),placeholder:"a1b2c3...",autoComplete:"off",spellCheck:!1})]}),j.jsxs("div",{className:"connect-field",children:[j.jsx("label",{htmlFor:"cdom",children:"Authorization Callback Domain (exactly as Strava shows it)"}),j.jsx("input",{id:"cdom",value:p,onChange:Re=>h(Re.target.value),placeholder:lh,autoComplete:"off",spellCheck:!1}),j.jsx("p",{className:"connect-fine",style:{marginTop:6},children:Te?"This matches where you are now, so authorizing will simply bring you back here.":`You will be sent to ${uy(p.trim()||lh)}, which will almost certainly fail to load. That is expected, and the next step explains what to do.`})]}),j.jsxs("div",{className:"connect-promise",style:{marginTop:14},children:["These values are stored only in this browser and are sent nowhere except to Strava itself, which is where they came from. Clearing your browser data, or using"," ",j.jsx("em",{children:"Disconnect"})," later, erases them."]}),ae&&j.jsx("div",{className:"connect-error",children:ae}),!B&&j.jsxs(j.Fragment,{children:[!Te&&j.jsxs("div",{className:"connect-warn",style:{marginTop:18},children:[j.jsx("strong",{children:"Read this before you click â the next page cannot tell you."}),j.jsxs("ol",{style:{margin:"8px 0 0",paddingLeft:18,lineHeight:1.65},children:[j.jsx("li",{children:"Strava opens in a new tab. Approve there."}),j.jsxs("li",{children:["It then sends that tab to"," ",j.jsx("code",{children:uy(p.trim()||lh)}),", which will show ",j.jsx("strong",{children:"âThis site canât be reachedâ"}
2685)," or similar. ",j.jsx("strong",{children:"That error is what success looks like."})," Nothing is running at that address, which is exactly why your authorization code is safe there â it was never sent to any server."]}),j.jsxs("li",{children:[j.jsx("strong",{children:"Copy the whole address"})," out of that tabâs address bar."]}),j.jsxs("li",{children:[j.jsx("strong",{children:"Come back to this tab"})," â it stays open and waiting â and paste the address into the box that will be here."]})]})]}),j.jsx("div",{style:{marginTop:20},children:j.jsx($0,{onClick:()=>void ve(),children:re?"Workingâ¦":"Authorize with Strava"})}),j.jsxs("p",{className:"connect-fine",children:["On Stravaâs screen, leave"," ",j.jsx("strong",{children:"âView data about your private activitiesâ"})," ticked. Without it Strava hides private activities and trims the GPS inside your privacy zones, which would leave real holes in your map."]})]}),B&&j.jsxs("div",{className:"connect-paste",children:[j.jsx("h2",{children:"Now copy the address you landed on"}),F?j.jsxs("p",{children:["Your browser blocked the new tab."," ",j.jsx("a",{href:F,target:"_blank",rel:"noreferrer noopener",children:"Open Stravaâs authorization page"})," ","yourself, then come back here."]}):j.jsx("p",{children:"Strava is open in another tab. Approve it there, then come back."}),j.jsxs("p",{children:["You will land on ",j.jsx("code",{children:uy(p.trim()||lh)})," ","and it will fail to load. ",j.jsx("strong",{children:"That is the expected result"}),", not a mistake â nothing is running at that address, which is precisely why your authorization code is safe sitting in the address bar rather than in somebodyâs server logs."]}),j.jsxs("p",{children:["Copy the ",j.jsx("strong",{children:"whole address"})," from that tab and paste it below. It looks like ",j.jsx("code",{children:"http://localhost/?state=â¦&code=â¦&scope=â¦"})," â the long"," ",j.jsx("code",{children:"code="})," part is the piece that matters."]}),j.jsxs("div",{className:"connect-field",style:{marginTop:12},children:[j.jsx("label",{htmlFor:"paste",children:"Pasted address"}),j.jsx("input",{id:"paste",value:A,onChange:Re=>R(Re.target.value),placeholder:"http://localhost/?state=...&code=...&scope=...",autoComplete:"off",spellCheck:!1,onKeyDown:Re=>{Re.key==="Enter"&&Oe()}})]}),j.jsxs("div",{style:{display:"flex",gap:9,alignItems:"center",marginTop:12},children:[j.jsx($0,{onClick:()=>void Oe(),children:re?"Connectingâ¦":"Finish connecting"}),j.jsx("button",{className:"ghost",onClick:()=>void ve(),children:"Open Strava again"})]})]})]})})}function hU({error:t,onConnected:e}){const[i,n]=He.useState("landing");return He.useEffect(()=>{t&&n("credentials")},[t]),j.jsxs(j.Fragment,{children:[t&&i==="credentials"&&j.jsx("div",{className:"connect-toast",children:t}),i==="landing"?j.jsx(cU,{onStart:()=>n("credentials")}):j.jsx(uU,{onBack:()=>n("landing"),onConnected:e})]})}const H0=900*1e3,iE=300,dU=100,fU=20,QT="summaries",JT="status";class Zm extends Error{}class kb extends Error{}class Bb extends Error{}class bd extends Error{}function ty(t,e){return new Promise((i,n)=>{if(e.aborted)return n(new bd);const o=setTimeout(()=>{e.removeEventListener("abort",d),i()},t);function d(){clearTimeout(o),n(new bd)}e.addEventListener("abort",d,{once:!0})})}function hy(t=Date.now()){return H0-t%H0+1e3}function pU(t,e){if(t<=0)return 0;const i=(e==null?void 0:e.shortLimit)??dU,n=e?Math.max(0,e.shortLimit-e.shortUsage):i;if(t<=n)return t*iE;const o=Math.ceil((t-n)/i);return hy()+(o-1)*H0}function nE(t){const e=Math.max(0,Math.round(t/1e3)),i=Math.floor(e/86400),n=Math.floor(e%86400/3600),o=Math.floor(e%3600/60);return i>0?`${i}d ${n}h`:n>0?`${n}h ${o}m`:o>0?`${o}m`:`${e}s`}async function mU(){return await _v(Jl,QT)??{k:QT,fetchedAt:0,activities:{}}}async function gU(){return await _v(Jl,JT)??{k:JT,streams:{}}}function _U(t){const e=Math.floor(Date.parse(t.start_date)/1e3);return Number.isFinite(e)?{id:t.id,name:t.name,sportType:t.sport_type,startDateLocal:t.start_date_local,startTs:e,distance:t.distance,trainer:t.trainer,manual:t.manual}:null}function yU(t){return t.trainer?"trainer":t.manual?"manual":t.sportType.startsWith("Virtual")?"virtual":null}function vU(t,e){var B,N,F;const i=((B=e.latlng)==null?void 0:B.data)??[],n=((N=e.time)==null?void 0:N.data)??[],o=Math.min(i.length,n.length);if(o<2)return null;const d=new Int32Array(o),p=new Int32Array(o),h=new Int32Array(o);for(let Q=0;Q<o;Q++)d[Q]=Math.round(i[Q][0]*IT),p[Q]=Math.round(i[Q][1]*IT),h[Q]=n[Q];const A=(F=e.altitude)==null?void 0:F.data;let R=null;if(A&&A.length>=o){R=new Int16Array(o);for(let Q=0;Q<o;Q++)R[Q]=Math.round(A[Q])}return{id:t.id,name:t.name,startTs:t.startTs,startDateLocal:t.startDateLocal,sportType:t.sportType,distanceM:t.distance,trainer:t.trainer,manual:t.manual,source:"api",lat:d,lng:p,t:h,alt:R}}async function bU(t){var B,N,F,Q,re;const{signal:e,onProgress:i}=t,n=t.batchSize??25,o=[];let d=null;const p=await mU(),h=await gU();let A=(await DT()).size;const R=se=>{const ae={phase:"starting",known:Object.keys(p.activities).length,stored:A,remaining:0,current:null,etaMs:0,rateLimit:d,warnings:o,waitUntil:null,message:null,...se};return i(ae),ae};R({phase:"starting"});try{R({phase:"summaries",message:"Asking Strava what you have done"});for(let Ee=0;;Ee++)try{for await(const Je of $F({accessToken:await KT()})){for(const rt of Je){let Ke=null;try{Ke=_U(ZF(rt))}catch{Ke=null}Ke&&(p.activities[String(Ke.id)]=Ke)}R({phase:"summaries",message:"Asking Strava what you have done"})}break}catch(Je){if(Je instanceof V0){if(Je.usage&&Je.usage.dailyUsage>=Je.usage.dailyLimit)throw new Zm;if(Ee<3){const rt=Je.retryAfterMs??hy();R({phase:"waiting",waitUntil:Date.now()+rt,message:"Rate limited while listing activities"}),await ty(rt,e);continue}}throw Je}p.fetchedAt=Math.floor(Date.now()/1e3),await vd(Jl,p);const se=await DT(),ae=[];for(const Ee of Object.values(p.activities)){const Je=String(Ee.id);if(se.has(Ee.id)){h.streams[Je]="ok";continue}const rt=h.streams[Je];if(rt!=null&&rt.startsWith("skipped:"))continue;const Ke=yU(Ee);if(Ke!==null){h.streams[Je]=`skipped:${Ke}`;continue}ae.push(Ee)}if(ae.sort((Ee,Je)=>Je.startTs-Ee.startTs),await vd(Jl,h),ae.length===0)return R({phase:"done",remaining:0,message:"Everything is up to date"});let me=0,we=0,ve=0,Oe=0;const Te=[],Re=async()=>
2685{if(Te.length!==0){try{await XL(gp,Te)}catch(Ee){throw YL(Ee)?new kb:Ee}A+=Te.length,Te.length=0}};try{for(const Ee of ae){if(e.aborted)throw new bd;if(d&&d.dailyUsage>=d.dailyLimit)throw new Zm;if(d&&d.shortUsage>=d.shortLimit){await Re();const Ke=hy();R({phase:"waiting",remaining:ae.length-me,waitUntil:Date.now()+Ke,message:"Strava lets through a fixed number of requests every 15 minutes"}),await ty(Ke,e),d=null}else me>0&&await ty(iE,e);R({phase:"streams",current:Ee.name,remaining:ae.length-me,etaMs:pU(ae.length-me,d)});const Je=String(Ee.id);let rt=!1;for(;;){if(e.aborted)throw new bd;try{const Ke=await QA(`/activities/${Ee.id}/streams`,{accessToken:await KT(),query:{keys:"latlng,time,altitude",key_by_type:"true"}});Ke.rateLimit&&(d=Ke.rateLimit);const Qe=WF.parse(Ke.data),ht=vU(Ee,Qe);ht===null?(h.streams[Je]="skipped:no-gps",o.push({activityId:Ee.id,name:Ee.name,reason:"no GPS recorded"})):(Te.push(ht),h.streams[Je]="ok");break}catch(Ke){if(Ke instanceof bd)throw Ke;if(Ke instanceof V0){if(Ke.usage&&(d=Ke.usage),Ke.usage&&Ke.usage.dailyUsage>=Ke.usage.dailyLimit)throw new Zm;await Re();const Qe=Ke.retryAfterMs??hy();R({phase:"waiting",remaining:ae.length-me,waitUntil:Date.now()+Qe,message:"Strava asked us to slow down"}),await ty(Qe,e),d=null;continue}if(Ke instanceof eg&&Ke.status===401&&!rt){rt=!0,await JF();continue}if(Ke instanceof eg&&Ke.status===401)throw new Bb;Ke instanceof eg&&Ke.status===404?(h.streams[Je]="skipped:no-gps",o.push({activityId:Ee.id,name:Ee.name,reason:"no GPS recorded"})):(h.streams[Je]=`error:${Ke instanceof eg?Ke.status:"fetch"}`,we++,o.push({activityId:Ee.id,name:Ee.name,reason:"could not be downloaded; it will be retried next time"}));break}}me++,ve++,Oe++,Te.length>=10&&await Re(),ve>=fU&&(await vd(Jl,h),ve=0),Oe>=n&&t.onBatch&&(await Re(),t.onBatch(A),Oe=0)}}catch(Ee){if(await Re(),await vd(Jl,h),Ee instanceof Zm)return(B=t.onBatch)==null||B.call(t,A),R({phase:"out-of-budget",remaining:ae.length-me,message:`Strava's daily limit is reached after ${me} activities. This is normal for a large history. Come back tomorrow and it will pick up where it stopped.`});if(Ee instanceof kb)return(N=t.onBatch)==null||N.call(t,A),R({phase:"out-of-space",remaining:ae.length-me,message:`This browser is out of storage after ${A.toLocaleString()} activities. Everything downloaded so far is safe and your map is built from all of it. To go further, free up disk space, or use a browser with more room.`});if(Ee instanceof Bb)return(F=t.onBatch)==null||F.call(t,A),R({phase:"needs-auth",remaining:ae.length-me,message:"Strava is no longer accepting this connection. This usually means the app was revoked, or its Client Secret changed. Reconnect to carry on -- everything downloaded so far is kept."});if(Ee instanceof bd)return(Q=t.onBatch)==null||Q.call(t,A),R({phase:"stopped",remaining:ae.length-me,message:"Stopped"});throw Ee}return await Re(),await vd(Jl,h),(re=t.onBatch)==null||re.call(t,A),R({phase:"done",remaining:0,current:null,message:we>0?`Finished, but ${we} ${we===1?"activity":"activities"} could not be downloaded. They will be retried next time.`:"Sync complete"})}catch(se){return se instanceof bd?R({phase:"stopped",message:"Stopped"}):se instanceof kb?R({phase:"out-of-space",message:"This browser is out of storage."}):se instanceof Zm?R({phase:"out-of-budget",message:"Strava's daily request limit is already used up. This is normal partway through a large history. Come back tomorrow and it will pick up where it stopped."}):se instanceof Bb?R({phase:"needs-auth",message:"Strava is no longer accepting this connection. Reconnect to carry on."}):R({phase:"error",message:se instanceof Error?se.message:String(se)})}}function xU(t){const e=t.stored+t.remaining;return e<=0?0:Math.min(100,Math.round(t.stored/e*100))}function wU({until:t}){const[e,i]=He.useState(()=>Date.now());He.useEffect(()=>{const o=setInterval(()=>i(Date.now()),1e3);return()=>clearInterval(o)},[]);const n=Math.max(0,t-e);return j.jsx(j.Fragment,{children:nE(n)})}function TU({progress:t,onStop:e,onDismiss:i,onReconnect:n}){const[o,d]=He.useState(!1),p=t,h=p.phase==="done"||p.phase==="stopped"||p.phase==="out-of-budget"||p.phase==="out-of-space"||p.phase==="error";let A;switch(p.phase){case"starting":A="Connecting to Stravaâ¦";break;case"summaries":A=`Asking Strava what you have done â ${p.known.toLocaleStr
2685ing()} activities so far`;break;case"streams":A=p.current??"Downloading activities";break;case"waiting":A=j.jsxs(j.Fragment,{children:[p.message??"Waiting"," â resuming in"," ",p.waitUntil?j.jsx(wU,{until:p.waitUntil}):"a moment"]});break;default:A=p.message??""}return j.jsxs("div",{className:`sync-ribbon${h?" sync-ribbon-done":""}`,children:[j.jsxs("div",{className:"sync-ribbon-main",children:[j.jsx("div",{className:"sync-ribbon-line1",children:A}),j.jsxs("div",{className:"sync-ribbon-line2",children:[p.stored.toLocaleString()," of ",(p.stored+p.remaining).toLocaleString()," activities",p.remaining>0&&p.phase==="streams"&&j.jsxs(j.Fragment,{children:[" · about ",nE(p.etaMs)," left"]}),p.rateLimit&&j.jsxs(j.Fragment,{children:[" ","· ",p.rateLimit.dailyUsage,"/",p.rateLimit.dailyLimit," of todayâs Strava requests"]})]}),!h&&j.jsx("div",{className:"sync-bar",children:j.jsx("div",{className:"sync-bar-fill",style:{width:`${xU(p)}%`}})})]}),j.jsxs("div",{className:"sync-ribbon-actions",children:[n&&j.jsx("button",{className:"ghost",onClick:n,children:"Reconnect"}),p.warnings.length>0&&j.jsxs("button",{className:"ghost",onClick:()=>d(R=>!R),children:[p.warnings.length," left out"]}),h?j.jsx("button",{className:"ghost",onClick:i,children:"Dismiss"}):j.jsx("button",{className:"ghost",onClick:e,children:"Stop"})]}),o&&j.jsxs("div",{className:"sync-warnings",children:[j.jsx("p",{children:"These are not on your map. The reason is given for each; anything that failed will be retried next time."}),j.jsx("ul",{children:p.warnings.slice(0,200).map(R=>j.jsxs("li",{children:[j.jsx("span",{children:R.name})," ",j.jsx("em",{children:R.reason})]},R.activityId))}),p.warnings.length>200&&j.jsxs("p",{children:["â¦and ",p.warnings.length-200," more."]})]})]})}const SU="https://sp9byen5ncsw4eie.public.blob.vercel-storage.com/current.json",Uc=!!SU;function AU(){return new Promise(t=>{const e=new Worker(new URL("/assets/build.worker-DzXTGubK.js",import.meta.url),{type:"module"});e.onmessage=i=>{i.data.type!=="progress"&&(e.terminate(),t(i.data))},e.onerror=i=>{e.terminate(),t({type:"error",message:i.message||"The build worker failed."})},e.postMessage({type:"build"})})}function EU(t){const[e,i]=He.useState("checking"),[n,o]=He.useState(null),[d,p]=He.useState(null),[h,A]=He.useState(!1),[R,B]=He.useState(null),[N,F]=He.useState(null),Q=He.useRef(null),re=He.useRef(null),se=He.useRef(!1),ae=He.useRef(!1),me=He.useRef(!1),we=He.useRef(t);we.current=t;const ve=He.useCallback(async()=>{if(!se.current){se.current=!0,A(!0);try{for(;ae.current;){ae.current=!1;const Qe=await AU();Qe.type==="done"?(B({seen:Qe.seen,included:Qe.activities,excluded:Qe.excluded}),F(null),we.current()):Qe.type==="error"&&F(Qe.message)}}finally{se.current=!1,A(!1)}}},[]),Oe=He.useCallback(()=>{if(me.current)return;me.current=!0;const Qe=new AbortController;Q.current=Qe;const ht=bU({signal:Qe.signal,onProgress:p,onBatch:()=>{ae.current=!0,ve()}}).finally(()=>{me.current=!1,Q.current=null});re.current=ht},[ve]),Te=He.useCallback(()=>B(null),[]),Re=He.useCallback(()=>{var Qe;return(Qe=Q.current)==null?void 0:Qe.abort()},[]),Ee=He.useCallback(()=>p(null),[]),Je=He.useCallback(()=>{ae.current=!0,ve()},[ve]),rt=He.useCallback(()=>{o(null),i("connected"),Oe()},[Oe]),Ke=He.useCallback(async()=>{var Qe,ht;(Qe=Q.current)==null||Qe.abort(),await((ht=re.current)==null?void 0:ht.catch(()=>{})),await qL(),tL(),p(null),i("disconnected"),window.location.replace(window.location.origin+window.location.pathname)},[]);return He.useEffect(()=>{if(Uc){i("disconnected");return}(async()=>{const Qe=await aU();Qe.kind==="error"&&o(Qe.message),Qe.kind==="denied"&&o("Strava sign-in was cancelled. Nothing was changed.");const ht=Qe.kind==="connected"||await KF();i(ht?"connected":"disconnected"),Qe.kind==="connected"&&Oe()})()},[Oe]),{state:e,authError:n,sync:d,building:h,report:R,buildError:N,startSync:Oe,stopSync:Re,dismissSync:Ee,dismissReport:Te,rebuild:Je,markConnected:rt,disconnect:Ke}}const CU="https://groundcovermap.vercel.app";function RU(t){if(!t)return null;const e=Date.parse(t);if(!Number.isFinite(e))return null;const i=Math.floor((Date.now()-e)/6e4);if(i<90)return"updated just now";const n=Math.floor(i/60);return n<36?`updated ${n} hours ago`:`updated ${new Date(e).toISOString().slice(0,10)}`}function MU({builtAt:t}){const e=RU(t);return j.jsxs("div",{className:"panel",children:[j.jsx("div",{style:{color:"var(--text-primary)",fontSize:13,fontWeight:600},children:"GroundCover"}),j.jsxs("div",{style:{color:"var(--text-muted)",fontSize:11.5,lineHeight:1.5,marginTop:3},children:["Deduplicated coverage, not a heatmap of repeats. Powered by Strava",e?` · ${e}`:"","."]}),j.jsx("a",{className:"ghost",href:CU,target:"_blank",rel:"noopener noreferrer",style:{display:"inline-block",marginTop:9,textDecoration:"none",fontSize:12},children:"Map your own â"})]})}const PU=40,Nb=86400;function IU(){var si,pi,Cn;const t=di(),e=di(_e=>_e.set),i=He.useRef(null),n=He.useRef(null),o=He.useRef(null),d=He.useRef(null),p=He.useRef(null),h=He.useRef(null),A=He.useRef(0),R=He.useRef(!1),B=He.useRef(!1),N=He.useRef(""),[F,Q]=He.useState(!1),[re,se]=He.useState(!1),[ae,me]=He.useState(null),we=He.useRef(0),[ve,Oe]=He.useState(null),[Te,Re]=He.useState(null),Ee=He.useRef(0),Je=He.useRef(null),rt=He.useRef(void 0),[Ke,Qe]=He.useState(0),[ht,At]=He.useState(0),Fe=EU(He.useCallback(()=>At(_e=>_e+1),[])),[Dt,Le]=He.useState(!1),[nt,mt]=He.useState(!1),[ei,ai]=He.useState("peek"),[oe,Ue]=He.useState(null),ut=He.useRef(!1),Tt=He.useRef(0);He.useEffect(()=>{R.current=!1,B.current=!1,h.current=null,d.current=null,se(!1);const _e=new Worker(new URL("/assets/query.worker-gmLmWVkN.js",import.meta.url),{type:"module"});return i.current=_e,_e.onmessage=Pt=>{var Ut,Ri;const gt=Pt.data;switch(gt.type){case"progress":Qe(gt.loaded);break;case"ready":{J6(gt.manifest.timeRange.minTs,gt.manifest.timeRange.maxTs),o.current={mintTs:gt.siteMintTs,mintAct:gt.siteMintAct};{const or=gt.activities.length,vn=new Float64Array(2*or);for(let lr=0;lr<or;lr++)vn[2*lr]=1/0,vn[2*lr+1]=-1/0;const sn=gt.siteMintTs,bn=gt.siteMintAct;for(let lr=0;lr<sn.length;lr++){const Ss=bn[lr];Ss>
2685=or||(sn[lr]<vn[2*Ss]&&(vn[2*Ss]=sn[lr]),sn[lr]>vn[2*Ss+1]&&(vn[2*Ss+1]=sn[lr]))}di.setState({actSpans:vn})}e({load:"ready",manifest:gt.manifest,activities:gt.activities});const Gi=gt.manifest.bounds;p.current={src:gt.sourcePositions,dst:gt.targetPositions,n:gt.nSites,bounds:[Gi.minLng,Gi.minLat,Gi.maxLng,Gi.maxLat]},ti(),Li();break}case"result":{const Gi=new Uint8Array(gt.colors);(!h.current||h.current.length!==Gi.length)&&(h.current=new Uint8Array(Gi.length)),h.current.set(Gi),_e.postMessage({type:"release",slot:gt.slot,colors:gt.colors},[gt.colors]),(Ut=n.current)==null||Ut.setColors(h.current,++A.current),e({maxVisit:gt.maxVisit,stats:{distinctM:gt.distinctM,newM:gt.newM,totalM:gt.totalM,activityCount:gt.activityCount},...gt.extras?{extras:gt.extras}:{}}),R.current=!1,B.current&&(B.current=!1,Li());break}case"siteInfoResult":if(gt.activities){if(gt.seq!==Ee.current)break;Re(gt.siteIndex>=0&&Je.current?{info:gt,x:Je.current.x,y:Je.current.y}:null);break}if(gt.seq!==we.current)break;Oe(gt.siteIndex>=0?gt:null),(Ri=n.current)==null||Ri.setHovering(gt.siteIndex>=0);break;case"tracks":d.current=gt,se(!0);break;case"error":gt.kind==="params-mismatch"?e({paramsWarning:gt.message}):e({load:gt.kind==="failed"?"failed":gt.kind,loadError:gt.message});break}},_e.postMessage({type:"init"}),()=>_e.terminate()},[ht]);const $t=He.useCallback(()=>{var Ut;const _e=(Ut=n.current)==null?void 0:Ut.getViewport();if(!_e)return;const Pt=[zv(_e.minX/100),zv(_e.maxX/100)],gt=[Lv(_e.minY/100),Lv(_e.maxY/100)];di.setState({viewBounds:[Math.min(...Pt),Math.min(...gt),Math.max(...Pt),Math.max(...gt)]})},[]),qt=He.useCallback((_e,Pt,gt,Ut)=>{const Ri=new Set(gt);let Gi=1/0,or=1/0,vn=-1/0,sn=-1/0;for(const bn of Ut)bn.startTs<_e||bn.startTs>Pt||!Ri.has(bn.group)||(bn.bbox[0]<Gi&&(Gi=bn.bbox[0]),bn.bbox[1]<or&&(or=bn.bbox[1]),bn.bbox[2]>vn&&(vn=bn.bbox[2]),bn.bbox[3]>sn&&(sn=bn.bbox[3]));return Number.isFinite(Gi)?[Gi,or,vn,sn]:null},[]),ti=He.useCallback(()=>{const _e=p.current,Pt=n.current;if(!_e||!Pt||(Pt.setGeometry(_e.src,_e.dst,_e.n),NA()))return;const gt=di.getState();Pt.flyToBounds(qt(gt.t0,gt.t1,gt.groups,gt.activities)??_e.bounds)},[qt]),Li=He.useCallback(()=>{var Ut;const _e=i.current,Pt=di.getState();if(!_e||Pt.load!=="ready")return;if(R.current){B.current=!0;return}R.current=!0;const gt={type:"query",t0:Pt.replayReverse&&Pt.playhead!==null?Pt.playhead:Pt.t0,t1:Pt.replayReverse?Pt.t1:Pt.playhead??Pt.t1,reverse:Pt.replayReverse&&Pt.playing,scaleMax:Pt.playing?Pt.maxVisit:void 0,groups:Pt.groups,viewport:Pt.viewportFilter?((Ut=n.current)==null?void 0:Ut.getViewport())??null:null,mode:Pt.mode,theme:Pt.theme,playing:Pt.playing,drawer:Pt.drawerOpen,incremental:Pt.playing};_e.postMessage(gt)},[]);He.useEffect(()=>{Li()},[t.load,t.t0,t.t1,t.playhead,t.replayReverse,t.groups,t.mode,t.viewportFilter,t.drawerOpen,t.theme,t.playing,t.speed,Li]),He.useEffect(()=>rL(()=>{var _e;return((_e=n.current)==null?void 0:_e.getBounds())??null}),[]),He.useEffect(()=>oL(_e=>{const Pt=n.current;if(!Pt)return;if((_e==null?void 0:_e.kind)==="bounds"){Pt.flyToBounds(_e.bounds);return}const gt=di.getState(),Ut=qt(gt.t0,gt.t1,gt.groups,gt.activities);Ut&&Pt.flyToBounds(Ut)}),[qt]);const ki=(si=Fe.sync)==null?void 0:si.phase,Er=((pi=Fe.sync)==null?void 0:pi.remaining)??0;He.useEffect(()=>{if(ki==="starting"||ki==="summaries"||ki==="streams"||ki==="waiting"){if(Tt.current=Math.max(Tt.current,Er),t.load==="ready"&&!ut.current&&Tt.current>=PU){ut.current=!0,e({t0:t.minTs,t1:t.maxTs+Nb,playhead:null,replayReverse:!0,playing:!0});return}ut.current&&!t.playing&&e({t0:t.minTs,t1:t.maxTs+Nb,playhead:null,replayReverse:!0,playing:!0});return}Tt.current=0,ut.current&&(ut.current=!1,e({playing:!1,playhead:null,replayReverse:!1,t0:di.getState().minTs,t1:di.getState().maxTs+Nb}))},[ki,Er,t.load,t.playing,t.t1,t.minTs,t.maxTs,e]),He.useEffect(()=>{var Ut;if(t.load!=="ready"||!t.fitToSelection||!F)return;const _e=t.playhead??t.t1,Pt=`${Math.round(t.t0)}|${Math.round(_e)}|${t.groups.join(",")}`;if(t.playing&&!t.fitWhilePlaying){N.current=Pt;return}if(N.current===Pt)return;N.current=Pt;const gt=qt(t.t0,_e,t.groups,t.activities);gt&&((Ut=n.current)==null||Ut.fitIfNeeded(gt))},[t.load,t.fitToSelection,t.fitWhilePlaying,t.playing,t.t0,t.t1,t.playhead,t.replayReverse,t.groups,t.activities,qt,F]);const Ts=He.useCallback((_e,Pt)=>{var Ri;const gt=di.getState(),Ut={activeActivity:Pt};if(Pt!==null){const Gi=gt.activities[Pt];Gi&&(Gi.startTs<gt.t0||Gi.startTs>gt.t1)&&(Ut.t0=Math.min(gt.t0,Gi.startTs),Ut.t1=Math.max(gt.t1,Gi.startTs),N.current=`${Math.round(Ut.t0)}|${Math.round(Ut.t1)}|${gt.groups.join(",")}`)}e(Ut),(Ri=n.current)==null||Ri.flyToBounds(_e)},[e]);if(He.useEffect(()=>{const _e=Pt=>{var Ri;if(((Ri=Pt.target)==null?void 0:Ri.tagName)==="INPUT")return;const gt=di.getState(),Ut=(gt.t1-gt.t0)*.1;Pt.code==="Space"?(Pt.preventDefault(),e({playing:!gt.playing})):Pt.key==="ArrowRight"?e({t0:gt.t0+Ut,t1:gt.t1+Ut}):Pt.key==="ArrowLeft"?e({t0:gt.t0-Ut,t1:gt.t1-Ut}):Pt.key.toLowerCase()==="e"?e({mode:"exploration"}):Pt.key.toLowerCase()==="h"&&e({mode:"heatmap"})};return window.addEventListener("keydown",_e),()=>window.removeEventListener("keydown",_e)},[e]),He.useEffect(()=>{var Gi,or;const _e=i.current;if(t.activeActivity===null){(Gi=n.current)==null||Gi.setActivePath(null);return}if(!d.current){_e==null||_e.postMessage({type:"loadTracks"});return}const Pt=d.current,gt=Pt.trackOffsets[t.activeActivity],Ut=Pt.trackOffsets[t.activeActivity+1],Ri=[];for(let vn=gt;vn<Ut;vn++)Ri.push([zv(Pt.px[vn]/100),Lv(Pt.py[vn]/100)]);(or=n.current)==null||or.setActivePath(Ri)},[t.activeActivity,re]),He.useEffect(()=>{var _e;if(window.clearTimeout(rt.current),!ae){Oe(null),(_e=n.current)==null||_e.setHovering(!1);return}return rt.current=window.setTimeout(()=>{var gt;const Pt=di.getState();(gt=i.current)==null||gt.postMessage({type:"siteAt",lng:ae.lng,lat:ae.lat,radiusM:ae.radiu
2685sM,t0:Pt.t0,t1:Pt.t1,groups:Pt.groups,seq:++we.current})},45),()=>window.clearTimeout(rt.current)},[ae]),Fe.state==="checking"||t.load==="loading")return j.jsxs(j.Fragment,{children:[j.jsx(J_,{floating:!0}),j.jsx("div",{className:"connect-scroll",children:j.jsxs("div",{className:"connect-card",style:{margin:"auto",textAlign:"center"},children:[j.jsx("div",{style:{color:"var(--text-secondary)",fontSize:15},children:Uc?"Loading the map":"Loading your map"}),j.jsx("div",{style:{color:"var(--text-muted)",fontSize:13,marginTop:6},children:Ke>0?`${(Ke/1e6).toFixed(1)} MB`:Uc?"Fetching coverage":"Reading it back out of this browser"})]})})]});if(t.load==="failed"||t.load==="format-mismatch")return j.jsxs(j.Fragment,{children:[j.jsx(J_,{floating:!0}),j.jsx("div",{className:"connect-scroll",children:j.jsxs("div",{className:"connect-card",style:{margin:"auto"},children:[j.jsx("h1",{className:"connect-title",style:{fontSize:24},children:Uc?"This map could not be loaded":"Your stored map could not be read"}),j.jsxs("p",{className:"connect-lede",children:[t.loadError,Uc?" It is rebuilt nightly; try again shortly.":" Rebuilding from the activities already downloaded usually fixes it, and costs no Strava requests."]}),!Uc&&j.jsx("button",{className:"ghost",onClick:Fe.rebuild,children:"Rebuild"})]})})]});if(!Uc&&(Dt||t.load!=="ready"&&Fe.state==="disconnected"))return j.jsxs(j.Fragment,{children:[j.jsx(J_,{floating:!0}),j.jsx(hU,{error:Fe.authError,onConnected:()=>{Le(!1),Fe.markConnected()}})]});const ot=t.load==="ready";return j.jsxs("div",{className:"app-shell","data-chrome":ot?"on":"off","data-drawer":t.drawerOpen?"open":"closed",style:{"--sheet-h":`${oe??ky(ei,window.innerHeight)}px`},children:[j.jsxs("div",{className:"map-pane",children:[j.jsx(mL,{onReady:_e=>{n.current!==_e&&(n.current=_e,ti(),Li(),Q(!0),$t())},onViewportChange:()=>{$t(),di.getState().viewportFilter&&Li()},onHover:me,onPick:_e=>{var gt;const Pt=di.getState();Je.current={x:_e.x,y:_e.y},we.current+=1,Ee.current=we.current,(gt=i.current)==null||gt.postMessage({type:"siteAt",lng:_e.lng,lat:_e.lat,radiusM:_e.radiusM,t0:Pt.t0,t1:Pt.t1,groups:Pt.groups,seq:Ee.current,detail
2685:!0})}}),Fe.sync&&j.jsx(TU,{progress:Fe.sync,onStop:Fe.stopSync,onDismiss:Fe.dismissSync,onReconnect:Fe.sync.phase==="needs-auth"?()=>Le(!0):void 0}),!Uc&&t.load==="no-artifacts"&&!Fe.sync&&!Fe.building&&j.jsxs("div",{className:"panel",style:{top:"50%",left:"50%",transform:"translate(-50%,-50%)",width:320},children:[j.jsx("h2",{children:"Nothing here yet"}),j.jsx("div",{style:{color:"var(--text-secondary)",lineHeight:1.55,marginBottom:12},children:"You are connected to Strava, but no activities have been downloaded yet."}),j.jsxs("div",{style:{display:"flex",gap:7},children:[j.jsx("button",{className:"ghost",onClick:Fe.startSync,children:"Download my activities"}),j.jsx("button",{className:"ghost",onClick:()=>Le(!0),children:"Reconnect"})]})]}),Fe.building&&!Fe.sync&&j.jsx("div",{className:"sync-ribbon",children:j.jsxs("div",{className:"sync-ribbon-main",children:[j.jsx("div",{className:"sync-ribbon-line1",children:"Working out your coverageâ¦"}),j.jsx("div",{className:"sync-ribbon-line2",children:"This runs over your whole history at once."})]})}),t.paramsWarning&&t.load==="ready"&&j.jsx("div",{className:"panel",style:{top:12,left:"50%",transform:"translateX(-50%)",padding:"8px 14px"},children:j.jsx("span",{style:{color:"var(--text-secondary)"},children:t.paramsWarning})}),t.load==="ready"&&j.jsxs(j.Fragment,{children:[Te&&j.jsx(VL,{info:Te.info,x:Te.x,y:Te.y,onClose:()=>{Re(null),e({activeActivity:null})},onPreview:_e=>e({activeActivity:_e})}),!Te&&ae&&ve&&ve.visits>0&&j.jsxs("div",{style:{position:"absolute",left:Math.min(ae.x+14,window.innerWidth-250),top:ae.y+14,background:"var(--tooltip-bg)",border:"1px solid var(--panel-border)",borderRadius:6,padding:"7px 10px",pointerEvents:"none",zIndex:50,fontSize:11,width:232},children:[j.jsxs("div",{style:{color:"var(--text-primary)",fontSize:13,fontWeight:600},children:[ve.visits===1?"1 pass":`${ve.visits} passes`,ve.visitsAllTime>ve.visits&&j.jsxs("span",{style:{color:"var(--text-muted)",fontWeight:400,fontSize:11},children:[" ",ve.visitsAllTime," all time"]})]}),j.jsx("div",{style:{display:"flex",gap:10,margin:"4px 0 5px"},children:[{n:ve.alongCount,label:ve.alongLabel},{n:ve.againstCount,label:ve.againstLabel}].filter(_e=>_e.n>0).map(_e=>j.jsxs("span",{style:{color:"var(--text-secondary)"},children:[j.jsx("span",{style:{color:"var(--text-primary)",fontVariantNumeric:"tabular-nums"},children:_e.n})," ","heading ",_e.label]},_e.label))}),j.jsxs("div",{style:{color:"var(--frontier)"},children:["first covered ",new Date(ve.firstTs*1e3).toISOString().slice(0,10)]}),j.jsx("div",{style:{color:"var(--text-muted)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ve.firstActivityName})]})]})]}),ot&&j.jsxs(rF,{stop:ei,onStop:ai,onDragHeight:Ue,children:[j.jsx(UL,{onGo:Ts}),j.jsx(_L,{}),j.jsx(vL,{}),t.drawerOpen&&j.jsx(FL,{extras:t.extras,onSelectActivity:_e=>{var gt;e({activeActivity:_e});const Pt=t.activities[_e];Pt&&((gt=n.current)==null||gt.flyToBounds(Pt.bbox))},onClose:()=>e({drawerOpen:!1})}),nt&&j.jsx(sF,{getViewBounds:()=>{var _e;return((_e=n.current)==null?void 0:_e.getBounds())??null},onClose:()=>mt(!1)}),Fe.report&&j.jsx(JL,{report:Fe.report,onClose:Fe.dismissReport}),Fe.buildError&&j.jsxs("div",{className:"panel",children:[j.jsx("h2",{children:"Your map could not be rebuilt"}),j.jsx("div",{style:{color:"var(--text-secondary)",fontSize:12.5,lineHeight:1.5},children:Fe.buildError}),j.jsx("button",{className:"ghost",onClick:Fe.rebuild,style:{marginTop:10},children:"Try again"})]}),j.jsxs("div",{className:"rail-foot",children:[j.jsxs("div",{className:"rail-row",children:[j.jsx(J_,{}),j.jsx("button",{className:"ghost","aria-pressed":nt,onClick:()=>mt(_e=>!_e),title:"Copy a link to this view",children:"Share"})]}),Uc?j.jsx(MU,{builtAt:(Cn=t.manifest)==null?void 0:Cn.builtAt}):j.jsx(KL,{busy:Fe.sync!==null||Fe.building,connected:Fe.state==="connected",onSync:Fe.startSync,onConnect:()=>Le(!0),onDisconnect:Fe.disconnect})]})]}),ot&&j.jsx("div",{className:"transport",children:j.jsx(EL,{})})]})}class DU extends He.Component{constructor(){super(...arguments);Y(this,"state",{error:null})}static getDerivedStateFromError(i){return{error:i}}componentDidCatch(i,n){console.error("GroundCover crashed",i,n.componentStack)}render(){const{error:i}=this.state;return i?j.jsx("div",{className:"connect-scroll",children:j.jsxs("div",{className:"connect-card",style:{margin:"auto"},children:[j.jsx("h1",{className:"connect-title",style:{fontSize:24},children:"Something broke"}),j.jsx("p",{className:"connect-lede",children:"Your downloaded activities are still safe in this browser â nothing here deletes them. Reloading is usually enough."}),j.jsx("pre",{style:{fontFamily:"var(--mono)",fontSize:12,color:"var(--text-muted)",background:"var(--field-bg)",border:"1px solid var(--panel-border)",borderRadius:6,padding:"10px 12px",overflowX:"auto",whiteSpace:"pre-wrap"},children:i.message}),j.jsx("button",{className:"ghost",onClick:()=>window.location.reload(),style:{marginTop:14},children:"Reload"})]})}):this.props.children}}OA(di.getState().theme);bE.createRoot(document.getElementById("root")).render(j.jsx(He.StrictMode,{children:j.jsx(DU,{children:j.jsx(IU,{})})}));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.