PageSourceSearch

https://betamarribe-tribe.web.app/assets/index-Ce_LLIAe.js

js betamarribe-tribe.web.app collected 2026-10-03 12:18:04 UTC 1,972,169 bytes, 816 lines download raw bytes

vendor: 20,485 bytes, lines 1-3
1var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var l=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=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,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function ee(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function te(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function ne(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,ne(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+ee(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),ne(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+ee(a,u),c+=ne(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+ee(a,u++),c+=ne(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return ne(te(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function re(e,t,n){if(e==null)return e;var r=[],i=0;return ne(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function ie(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var j=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},M={map:re,forEach:function(e,t,n){re(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return re(e,function(){t++}),t},toArray:function(e){return re(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=M,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:ie}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,j)}catch(e){j(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.7`})),u=o(((e,t)=>{t.exports=l()})),d=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&ee(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&ee(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function ee(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,ee(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),f=o(((e,t)=>{t.exports=d()})),p=o((e=>{var t=u();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return o(e,t,null,r)},e.flushSync=function(e){var t=s.T,n=i.p;try{if(s.T=null,i.p=2,e)return e()}finally{s.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=c(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??i.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=c(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else i.d.m(e)},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return s.H.useFormState(e,t,n)},e.useFormStatus=function(){return s.H.useHostTransitionStatus()},e.version=`19.2.7`})),m=o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=p()})),h=o((e=>{var t=f(),n=u(),r=m();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function d(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function p(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=p(e),t!==null)return t;e=e.sibling}return null}var h=Object.assign,g=Symbol.for(`react.element`),_=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),S=Symbol.for(`react.consumer`),C=Symbol.for(`react.context`),w=Symbol.for(`react.forward_ref`),T=Symbol.for(`react.suspense`),E=Symbol.for(`react.suspense_list`),D=Symbol.for(`react.memo`),O=Symbol.for(`react.lazy`),k=Symbol.for(`react.activity`),A=Symbol.for(`react.memo_cache_sentinel`),ee=Symbol.iterator;function te(e){return typeof e!=`object`||!e?null:(e=ee&&e[ee]||e[`@@iterator`],typeof e==`function`?e:null)}var ne=Symbol.for(`react.client.reference`);function re(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===ne?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case T:return`Suspense`;case E:return`SuspenseList`;case k:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case C:return e.displayName||`Context`;case S:return(e._context.displayName||`Context`)+`.Consumer`;case w:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case D:return t=e.displayName||null,t===null?re(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return re(e(t))}catch{}}return null}var ie=Array.isArray,j=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,M=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ae={pending:!1,data:null,method:null,action:null},oe=[],se=-1;function ce(e){return{current:e}}function le(e){0>se||(e.current=oe[se],oe[se]=null,se--)}function ue(e,t){se++,oe[se]=e.current,e.current=t}var de=ce(null),fe=ce(null),pe=ce(null),me=ce(null);function he(e,t){switch(ue(pe,t),ue(fe,e),ue(de,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Hd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Hd(t),e=Ud(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}le(de),ue(de,e)}function ge(){le(de),le(fe),le(pe)}function _e(e){e.memoizedState!==null&&ue(me,e);var t=de.current,n=Ud(t,e.type);t!==n&&(ue(fe,e),ue(de,n))}function ve(e){fe.current===e&&(le(de),le(fe)),me.current===e&&(le(me),$f._currentValue=ae)}var ye,be;function xe(e){if(ye===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ye=t&&t[1]||``,be=-1<e.stack.indexOf(`
2    at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
3`+ye+e+be}var Se=!1;function Ce(e,t){if(!e||Se)return``;Se=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}
vendor: 6,575 bytes, lines 3-8
3else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
4`),l=s.split(`
5`);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
6`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{Se=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?xe(n):``}function we(e,t){switch(e.tag){case 26:case 27:case 5:return xe(e.type);case 16:return xe(`Lazy`);case 13:return e.child!==t&&t!==null?xe(`Suspense Fallback`):xe(`Suspense`);case 19:return xe(`SuspenseList`);case 0:case 15:return Ce(e.type,!1);case 11:return Ce(e.type.render,!1);case 1:return Ce(e.type,!0);case 31:return xe(`Activity`);default:return``}}function Te(e){try{var t=``,n=null;do t+=we(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
7Error generating stack: `+e.message+`
8`+e.stack}}var Ee=Object.prototype.hasOwnProperty,De=t.unstable_scheduleCallback,Oe=t.unstable_cancelCallback,ke=t.unstable_shouldYield,Ae=t.unstable_requestPaint,je=t.unstable_now,Me=t.unstable_getCurrentPriorityLevel,Ne=t.unstable_ImmediatePriority,Pe=t.unstable_UserBlockingPriority,Fe=t.unstable_NormalPriority,Ie=t.unstable_LowPriority,Le=t.unstable_IdlePriority,Re=t.log,ze=t.unstable_setDisableYieldValue,Be=null,N=null;function Ve(e){if(typeof Re==`function`&&ze(e),N&&typeof N.setStrictMode==`function`)try{N.setStrictMode(Be,e)}catch{}}var He=Math.clz32?Math.clz32:Ge,Ue=Math.log,We=Math.LN2;function Ge(e){return e>>>=0,e===0?32:31-(Ue(e)/We|0)|0}var Ke=256,qe=262144,Je=4194304;function Ye(e){var t=e&42;if(t!==0)return t;switch(e&-e){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 e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Xe(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=Ye(n))):i=Ye(o):i=Ye(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Ye(n))):i=Ye(o)):i=Ye(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function Ze(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function P(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+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 t+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 Qe(){var e=Je;return Je<<=1,!(Je&62914560)&&(Je=4194304),e}function $e(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function et(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function tt(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-He(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&F(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function F(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-He(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function nt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-He(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function rt(e,t){var n=t&-t;return n=n&42?1:it(n),(n&(e.suspendedLanes|t))===0?n:0}function it(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=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:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function at(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function ot(){var e=M.p;return e===0?(e=window.event,e===void 0?32:hp(e.type)):e}function st(e,t){var n=M.p;try{return M.p=e,t()}finally{M.p=n}}var ct=Math.random().toString(36).slice(2),lt=`__reactFiber$`+ct,ut=`__reactProps$`+ct,dt=`__reactContainer$`+ct,ft=`__reactEvents$`+ct,pt=`__reactListeners$`+ct,mt=`__reactHandles$`+ct,ht=`__reactResources$`+ct,gt=`__reactMarker$`+ct;function _t(e){delete e[lt],delete e[ut],delete e[ft],delete e[pt],delete e[mt]}function vt(e){var t=e[lt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[dt]||n[lt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=ff(e);e!==null;){if(n=e[lt])return n;e=ff(e)}return t}e=n,n=e.parentNode}return null}function yt(e){if(e=e[lt]||e[dt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function bt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function xt(e){var t=e[ht];return t||=e[ht]={hoistableStyles:new Map,hoistableScripts:new Map},t}function St(e){e[gt]=!0}var Ct=new Set,wt={};function Tt(e,t){Et(e,t),Et(e+`Capture`,t)}function Et(e,t){for(wt[e]=t,e=0;e<t.length;e++)Ct.add(t[e])}var Dt=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u
8037D\\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]*$`),Ot={},kt={};function At(e){return Ee.call(kt,e)?!0:Ee.call(Ot,e)?!1:Dt.test(e)?kt[e]=!0:(Ot[e]=!0,!1)}function jt(e,t,n){if(At(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,``+n)}}function Mt(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,``+n)}}function Nt(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,``+r)}}function Pt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Ft(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function It(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Lt(e){if(!e._valueTracker){var t=Ft(e)?`checked`:`value`;e._valueTracker=It(e,t,``+e[t])}}function Rt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Ft(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function zt(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var Bt=/[\n"\\]/g;function Vt(e){return e.replace(Bt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Ht(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+Pt(t)):e.value!==``+Pt(t)&&(e.value=``+Pt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Wt(e,o,Pt(n)):Wt(e,o,Pt(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+Pt(s):e.removeAttribute(`name`)}function Ut(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){Lt(e);return}n=n==null?``:``+Pt(n),t=t==null?n:``+Pt(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),Lt(e)}function Wt(e,t,n){t===`number`&&zt(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function Gt(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+Pt(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Kt(e,t,n){if(t!=null&&(t=``+Pt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+Pt(n)}function qt(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(ie(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}
vendor: 91,754 bytes, line 8
8n=Pt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Lt(e)}function Jt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Yt=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 Xt(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||Yt.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function Zt(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(i(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&Xt(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&Xt(e,o,t[o])}function Qt(e){if(e.indexOf(`-`)===-1)return!1;switch(e){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 $t=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`],[`colorRendering`,`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`]]),en=/^[\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 tn(e){return en.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function nn(){}var rn=null;function an(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var on=null,sn=null;function cn(e){var t=yt(e);if(t&&(e=t.stateNode)){var n=e[ut]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Ht(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+Vt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[ut]||null;if(!a)throw Error(i(90));Ht(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&Rt(r)}break a;case`textarea`:Kt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Gt(e,!!n.multiple,t,!1)}}}var ln=!1;function un(e,t,n){if(ln)return e(t,n);ln=!0;try{return e(t)}finally{if(ln=!1,(on!==null||sn!==null)&&(Su(),on&&(t=on,e=sn,sn=on=null,cn(t),e)))for(t=0;t<e.length;t++)cn(e[t])}}function dn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[ut]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=!(e===`button`||e===`input`||e===`select`||e===`textarea`)),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(i(231,t,typeof n));return n}var fn=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),pn=!1;if(fn)try{var mn={};Object.defineProperty(mn,"passive",{get:function(){pn=!0}}),window.addEventListener(`test`,mn,mn),window.removeEventListener(`test`,mn,mn)}catch{pn=!1}var hn=null,gn=null,_n=null;function vn(){if(_n)return _n;var e,t=gn,n=t.length,r,i=`value`in hn?hn.value:hn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return _n=i.slice(e,1<r?1-r:void 0)}function yn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function bn(){return!0}function xn(){return!1}function Sn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?bn:xn,this.isPropagationStopped=xn,this}return h(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=bn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=bn)},persist:function(){},isPersistent:bn}),t}var Cn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},wn=Sn(Cn),Tn=h({},Cn,{view:0,detail:0}),En=Sn(Tn),Dn,On,kn,An=h({},Tn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Vn,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==kn&&(kn&&e.type===`mousemove`?(Dn=e.screenX-kn.screenX,On=e.screenY-kn.screenY):On=Dn=0,kn=e),Dn)},movementY:function(e){return`movementY`in e?e.movementY:On}}),jn=Sn(An),Mn=Sn(h({},An,{dataTransfer:0})),Nn=Sn(h({},Tn,{relatedTarget:0})),Pn=Sn(h({},Cn,{animationName:0,elapsedTime:0,pseudoElement:0})),Fn=Sn(h({},Cn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),In=Sn(h({},Cn,{data:0})),Ln={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Rn={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`},zn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Bn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=zn[e])?!!t[e]:!1}function Vn(){return Bn}var Hn=Sn(h({},Tn,{key:function(e){if(e.key){var t=Ln[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=yn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Rn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Vn,charCode:function(e){return e.type===`keypress`?yn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?yn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Un=Sn(h({},An,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Wn=Sn(h({},Tn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Vn})),Gn=Sn(h({},Cn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Kn=Sn(h({},An,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),qn=Sn(h({},Cn,{newState:0,oldState:0})),Jn=[9,13,27,32],Yn=fn&&`CompositionEvent`in window,Xn=null;fn&&`documentMode`in document&&(Xn=document.documentMode);var Zn=fn&&`TextEvent`in window&&!Xn,Qn=fn&&(!Yn||Xn&&8<Xn&&11>=Xn),$n=` `,er=!1;function tr(e,t){switch(e){case`keyup`:return Jn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function nr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var rr=!1;function ir(e,t){switch(e){case`compositionend`:return nr(t);case`keypress`:return t.which===32?(er=!0,$n):null;case`textInput`:return e=t.data,e===$n&&er?null:e;default:return null}}function ar(e,t){if(rr)return e===`compositionend`||!Yn&&tr(e,t)?(e=vn(),_n=gn=hn=null,rr=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return Qn&&t.locale!==`ko`?null:t.data;default:return null}}var or={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 sr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!or[e.type]:t===`textarea`}function cr(e,t,n,r){on?sn?sn.push(r):sn=[r]:on=r,t=Od(t,`onChange`),0<t.length&&(n=new wn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var lr=null,ur=null;function dr(e){bd(e,0)}function fr(e){if(Rt(bt(e)))return e}function pr(e,t){if(e===`change`)return t}var mr=!1;if(fn){var hr;if(fn){var gr=`oninput`in document;if(!gr){var I=document.createElement(`div`);I.setAttribute(`oninput`,`return;`),gr=typeof I.oninput==`function`}hr=gr}else hr=!1;mr=hr&&(!document.documentMode||9<document.documentMode)}function L(){lr&&(lr.detachEvent(`onpropertychange`,_r),ur=lr=null)}function _r(e){if(e.propertyName===`value`&&fr(ur)){var t=[];cr(t,ur,e,an(e)),un(dr,t)}}function vr(e,t,n){e===`focusin`?(L(),lr=t,ur=n,lr.attachEvent(`onpropertychange`,_r)):e===`focusout`&&L()}function yr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return fr(ur)}function br(e,t){if(e===`click`)return fr(t)}function xr(e,t){if(e===`input`||e===`change`)return fr(t)}function Sr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Cr=typeof Object.is==`function`?Object.is:Sr;function wr(e,t){if(Cr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!Ee.call(t,i)||!Cr(e[i],t[i]))return!1}return!0}function Tr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Er(e,t){var n=Tr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Tr(n)}}function Dr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Dr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Or(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=zt(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=zt(e.document)}return t}function kr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Ar=fn&&`documentMode`in document&&11>=document.documentMode,jr=null,Mr=null,Nr=null,Pr=!1;function R(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Pr||jr==null||jr!==zt(r)||(r=jr,`selectionStart`in r&&kr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Nr&&wr(Nr,r)||(Nr=r,r=Od(Mr,`onSelect`),0<r.length&&(t=new wn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=jr)))}function z(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Fr={animationend:z(`Animation`,`AnimationEnd`),animationiteration:z(`Animation`,`AnimationIteration`),animationstart:z(`Animation`,`AnimationStart`),transitionrun:z(`Transition`,`TransitionRun`),transitionstart:z(`Transition`,`TransitionStart`),transitioncancel:z(`Transition`,`TransitionCancel`),transitionend:z(`Transition`,`TransitionEnd`)},Ir={},Lr={};fn&&(Lr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Fr.animationend.animation,delete Fr.animationiteration.animation,delete Fr.animationstart.animation),`TransitionEvent`in window||delete Fr.transitionend.transition);function Rr(e){if(Ir[e])return Ir[e];if(!Fr[e])return e;var t=Fr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Lr)return Ir[e]=t[n];return e}var zr=Rr(`animationend`),Br=Rr(`animationiteration`),Vr=Rr(`animationstart`),Hr=Rr(`transitionrun`),Ur=Rr(`transitionstart`),Wr=Rr(`transitioncancel`),Gr=Rr(`transitionend`),Kr=new Map,qr=`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(` `);qr.push(`scrollEnd`);function Jr(e,t){Kr.set(e,t),Tt(t,[e])}var Yr=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},Xr=[],Zr=0,Qr=0;function $r(){for(var e=Zr,t=Qr=Zr=0;t<e;){var n=Xr[t];Xr[t++]=null;var r=Xr[t];Xr[t++]=null;var i=Xr[t];Xr[t++]=null;var a=Xr[t];if(Xr[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&ri(n,i,a)}}function ei(e,t,n,r){Xr[Zr++]=e,Xr[Zr++]=t,Xr[Zr++]=n,Xr[Zr++]=r,Qr|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function ti(e,t,n,r){return ei(e,t,n,r),ii(e)}function ni(e,t){return ei(e,null,null,t),ii(e)}function ri(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-He(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function ii(e){if(50<pu)throw pu=0,mu=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var ai={};function oi(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function si(e,t,n,r){return new oi(e,t,n,r)}function ci(e){return e=e.prototype,!(!e||!e.isReactComponent)}function li(e,t){var n=e.alternate;return n===null?(n=si(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function ui(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function di(e,t,n,r,a,o){var s=0;if(r=e,typeof e==`function`)ci(e)&&(s=1);else if(typeof e==`string`)s=Wf(e,n,de.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case k:return e=si(31,n,t,a),e.elementType=k,e.lanes=o,e;case y:return fi(n.children,a,o,t);case b:s=8,a|=24;break;case x:return e=si(12,n,t,a|2),e.elementType=x,e.lanes=o,e;case T:return e=si(13,n,t,a),e.elementType=T,e.lanes=o,e;case E:return e=si(19,n,t,a),e.elementType=E,e.lanes=o,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case C:s=10;break a;case S:s=9;break a;case w:s=11;break a;case D:s=14;break a;case O:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=si(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function fi(e,t,n,r){return e=si(7,e,r,t),e.lanes=n,e}function pi(e,t,n){return e=si(6,e,null,t),e.lanes=n,e}function mi(e){var t=si(18,null,null,0);return t.stateNode=e,t}function hi(e,t,n){return t=si(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var gi=new WeakMap;function _i(e,t){if(typeof e==`object`&&e){var n=gi.get(e);return n===void 0?(t={value:e,source:t,stack:Te(t)},gi.set(e,t),t):n}return{value:e,source:t,stack:Te(t)}}var vi=[],yi=0,B=null,bi=0,xi=[],Si=0,Ci=null,wi=1,V=``;function Ti(e,t){vi[yi++]=bi,vi[yi++]=B,B=e,bi=t}function H(e,t,n){xi[Si++]=wi,xi[Si++]=V,xi[Si++]=Ci,Ci=e;var r=wi;e=V;var i=32-He(r)-1;r&=~(1<<i),n+=1;var a=32-He(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,wi=1<<32-He(t)+i|n<<i|r,V=a+e}else wi=1<<a|n<<i|r,V=e}function U(e){e.return!==null&&(Ti(e,1),H(e,1,0))}function Ei(e){for(;e===B;)B=vi[--yi],vi[yi]=null,bi=vi[--yi],vi[yi]=null;for(;e===Ci;)Ci=xi[--Si],xi[Si]=null,V=xi[--Si],xi[Si]=null,wi=xi[--Si],xi[Si]=null}function Di(e,t){xi[Si++]=wi,xi[Si++]=V,xi[Si++]=Ci,wi=t.id,V=t.overflow,Ci=e}var Oi=null,ki=null,Ai=!1,ji=null,Mi=!1,Ni=Error(i(519));function Pi(e){throw Bi(_i(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Ni}function Fi(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[lt]=e,t[ut]=r,n){case`dialog`:xd(`cancel`,t),xd(`close`,t);break;case`iframe`:case`object`:case`embed`:xd(`load`,t);break;case`video`:case`audio`:for(n=0;n<vd.length;n++)xd(vd[n],t);break;case`source`:xd(`error`,t);break;case`img`:case`image`:case`link`:xd(`error`,t),xd(`load`,t);break;case`details`:xd(`toggle`,t);break;case`input`:xd(`invalid`,t),Ut(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:xd(`invalid`,t);break;case`textarea`:xd(`invalid`,t),qt(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||Z(t.textContent,n)?(r.popover!=null&&(xd(`beforetoggle`,t),xd(`toggle`,t)),r.onScroll!=null&&xd(`scroll`,t),r.onScrollEnd!=null&&xd(`scrollend`,t),r.onClick!=null&&(t.onclick=nn),t=!0):t=!1,t||Pi(e,!0)}function Ii(e){for(Oi=e.return;Oi;)switch(Oi.tag){case 5:case 31:case 13:Mi=!1;return;case 27:case 3:Mi=!0;return;default:Oi=Oi.return}}function Li(e){if(e!==Oi)return!1;if(!Ai)return Ii(e),Ai=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!==`form`&&n!==`button`)||Wd(e.type,e.memoizedProps)),n=!n),n&&ki&&Pi(e),Ii(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));ki=df(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));ki=df(e)}else t===27?(t=ki,Qd(e.type)?(e=uf,uf=null,ki=e):ki=t):ki=Oi?lf(e.stateNode.nextSibling):null;return!0}function Ri(){ki=Oi=null,Ai=!1}function zi(){var e=ji;return e!==null&&($l===null?$l=e:$l.push.apply($l,e),ji=null),e}function Bi(e){ji===null?ji=[e]:ji.push(e)}var Vi=ce(null),Hi=null,Ui=null;function Wi(e,t,n){ue(Vi,t._currentValue),t._currentValue=n}function Gi(e){e._currentValue=Vi.current,le(Vi)}function Ki(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function qi(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),Ki(o.return,n,e),r||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(i(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),Ki(s,n,e),s=null}else s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function W(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;Cr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===me.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[$f]:e.push($f))}a=a.return}e!==null&&qi(t,e,n,r),t.flags|=262144}function Ji(e){for(e=e.firstContext;e!==null;){if(!Cr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Yi(e){Hi=e,Ui=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Xi(e){return Qi(Hi,e)}function Zi(e,t){return Hi===null&&Yi(e),Qi(e,t)}function Qi(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Ui===null){if(e===null)throw Error(i(308));Ui=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Ui=Ui.next=t;return n}var $i=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},ea=t.unstable_scheduleCallback,ta=t.unstable_NormalPriority,na={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ra(){return{controller:new $i,data:new Map,refCount:0}}function ia(e){e.refCount--,e.refCount===0&&ea(ta,function(){e.controller.abort()})}var aa=null,oa=0,sa=0,ca=null;function la(e,t){if(aa===null){var n=aa=[];oa=0,sa=fd(),ca={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return oa++,t.then(ua,ua),t}function ua(){if(--oa===0&&aa!==null){ca!==null&&(ca.status=`fulfilled`);var e=aa;aa=null,sa=0,ca=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function da(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var fa=j.S;j.S=function(e,t){nu=je(),typeof t==`object`&&t&&typeof t.then==`function`&&la(e,t),fa!==null&&fa(e,t)};var pa=ce(null);function ma(){var e=pa.current;return e===null?Ll.pooledCache:e}function ha(e,t){t===null?ue(pa,pa.current):ue(pa,t.pool)}function G(){var e=ma();return e===null?null:{parent:na._currentValue,pool:e}}var ga=Error(i(460)),_a=Error(i(474)),va=Error(i(542)),K={then:function(){}};function ya(e){return e=e.status,e===`fulfilled`||e===`rejected`}function ba(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(nn,nn),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,wa(e),e;default:if(typeof t.status==`string`)t.then(nn,nn);else{if(e=Ll,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,wa(e),e}throw Sa=t,ga}}function xa(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Sa=e,ga):e}}var Sa=null;function Ca(){if(Sa===null)throw Error(i(459));var e=Sa;return Sa=null,e}function wa(e){if(e===ga||e===va)throw Error(i(483))}var Ta=null,Ea=0;function Da(e){var t=Ea;return Ea+=1,Ta===null&&(Ta=[]),ba(Ta,e,t)}function Oa(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function ka(e,t){throw t.$$typeof===g?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function Aa(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function a(e,t){return e=li(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=pi(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===y?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===O&&xa(i)===t.type)?(t=a(t,n.props),Oa(t,n),t.return=e,t):(t=di(n.type,n.key,n.props,null,e.mode,r),Oa(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=hi(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=fi(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=pi(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case _:return n=di(t.type,t.key,t.props,null,e.mode,n),Oa(n,t),n.return=e,n;case v:return t=hi(t,e.mode,n),t.return=e,t;case O:return t=xa(t),f(e,t,n)}if(ie(t)||te(t))return t=fi(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,Da(t),n);if(t.$$typeof===C)return f(e,Zi(e,t),n);ka(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case _:return n.key===i?l(e,t,n,r):null;case v:return n.key===i?u(e,t,n,r):null;case O:return n=xa(n),p(e,t,n,r)}if(ie(n)||te(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,Da(n),r);if(n.$$typeof===C)return p(e,t,Zi(e,n),r);ka(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case _:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case v:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case O:return r=xa(r),m(e,t,n,r,i)}if(ie(r)||te(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,Da(r),i);if(r.$$typeof===C)return m(e,t,n,Zi(t,r),i);ka(t,r)}return null}function h(i,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),Ai&&Ti(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return Ai&&Ti(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),Ai&&Ti(i,h),l}function g(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),Ai&&Ti(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return Ai&&Ti(a,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),Ai&&Ti(a,g),u}function b(e,r,o,c){if(typeof o==`object`&&o&&o.type===y&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case _:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===y){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===O&&xa(l)===r.type){n(e,r.sibling),c=a(r,o.props),Oa(c,o),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}o.type===y?(c=fi(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=di(o.type,o.key,o.props,null,e.mode,c),Oa(c,o),c.return=e,e=c)}return s(e);case v:a:{for(l=o.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}else{n(e,r);break}else t(e,r);r=r.sibling}c=hi(o,e.mode,c),c.return=e,e=c}return s(e);case O:return o=xa(o),b(e,r,o,c)}if(ie(o))return h(e,r,o,c);if(te(o)){if(l=te(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return b(e,r,Da(o),c);if(o.$$typeof===C)return b(e,r,Zi(e,o),c);ka(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=pi(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Ea=0;var i=b(e,t,n,r);return Ta=null,i}catch(t){if(t===ga||t===va)throw t;var a=si(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var ja=Aa(!0),Ma=Aa(!1),Na=!1;function Pa(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Fa(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ia(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function La(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Il&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=ii(e),ri(e,null,n),t}return ei(e,r,t,n),ii(e)}function Ra(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,nt(e,n)}}function za(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ba=!1;function Va(){if(Ba){var e=ca;if(e!==null)throw e}}function Ha(e,t,n,r){Ba=!1;var i=e.updateQueue;Na=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(zl&f)===f:(r&f)===f){f!==0&&f===sa&&(Ba=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(m=g.payload,typeof m==`function`){d=m.call(_,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=g.payload,f=typeof m==`function`?m.call(_,d,f):m,f==null)break a;d=h({},d,f);break a;case 2:Na=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),ql|=o,e.lanes=o,e.memoizedState=d}}function Ua(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Wa(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Ua(n[e],t)}var Ga=ce(null),Ka=ce(0);function qa(e,t){e=Gl,ue(Ka,e),ue(Ga,t),Gl=e|t.baseLanes}function Ja(){ue(Ka,Gl),ue(Ga,Ga.current)}function Ya(){Gl=Ka.current,le(Ga),le(Ka)}var q=ce(null),J=null;function Xa(e){var t=e.alternate;ue(to,to.current&1),ue(q,e),J===null&&(t===null||Ga.current!==null||t.memoizedState!==null)&&(J=e)}function Za(e){ue(to,to.current),ue(q,e),J===null&&(J=e)}function Qa(e){e.tag===22?(ue(to,to.current),ue(q,e),J===null&&(J=e)):$a(e)}function $a(){ue(to,to.current),ue(q,q.current)}function eo(e){le(q),J===e&&(J=null),le(to)}var to=ce(0);function no(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||of(n)||sf(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var ro=0,io=null,ao=null,oo=null,so=!1,co=!1,lo=!1,uo=0,fo=0,po=null,mo=0;function ho(){throw Error(i(321))}function go(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Cr(e[n],t[n]))return!1;return!0}function _o(e,t,n,r,i,a){return ro=a,io=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,j.H=e===null||e.memoizedState===null?Ps:Fs,lo=!1,a=n(r,i),lo=!1,co&&(a=yo(t,n,r,i)),vo(e),a}function vo(e){j.H=Ns;var t=ao!==null&&ao.next!==null;if(ro=0,oo=ao=io=null,so=!1,fo=0,po=null,t)throw Error(i(300));e===null||Qs||(e=e.dependencies,e!==null&&Ji(e)&&(Qs=!0))}function yo(e,t,n,r){io=e;var a=0;do{if(co&&(po=null),fo=0,co=!1,25<=a)throw Error(i(301));if(a+=1,oo=ao=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}j.H=Is,o=t(n,r)}while(co);return o}function bo(){var e=j.H,t=e.useState()[0];return t=typeof t.then==`function`?Do(t):t,e=e.useState()[0],(ao===null?null:ao.memoizedState)!==e&&(io.flags|=1024),t}function xo(){var e=uo!==0;return uo=0,e}function So(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Co(e){if(so){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}so=!1}ro=0,oo=ao=io=null,co=!1,fo=uo=0,po=null}function wo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return oo===null?io.memoizedState=oo=e:oo=oo.next=e,oo}function To(){if(ao===null){var e=io.alternate;e=e===null?null:e.memoizedState}else e=ao.next;var t=oo===null?io.memoizedState:oo.next;if(t!==null)oo=t,ao=e;else{if(e===null)throw io.alternate===null?Error(i(467)):Error(i(310));ao=e,e={memoizedState:ao.memoizedState,baseState:ao.baseState,baseQueue:ao.baseQueue,queue:ao.queue,next:null},oo===null?io.memoizedState=oo=e:oo=oo.next=e}return oo}function Eo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Do(e){var t=fo;return fo+=1,po===null&&(po=[]),e=ba(po,e,t),t=io,(oo===null?t.memoizedState:oo.next)===null&&(t=t.alternate,j.H=t===null||t.memoizedState===null?Ps:Fs),e}function Oo(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return Do(e);if(e.$$typeof===C)return Xi(e)}throw Error(i(438,String(e)))}function ko(e){var t=null,n=io.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=io.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=Eo(),io.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=A;return t.index++,n}function Ao(e,t){return typeof t==`function`?t(e):t}function jo(e){return Mo(To(),ao,e)}function Mo(e,t,n){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(ro&f)===f:(zl&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===sa&&(d=!0);else if((ro&p)===p){u=u.next,p===sa&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,io.lanes|=p,ql|=p;f=u.action,lo&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,io.lanes|=f,ql|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!Cr(o,e.memoizedState)&&(Qs=!0,d&&(n=ca,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function No(e){var t=To(),n=t.queue;if(n===null)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);Cr(o,t.memoizedState)||(Qs=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Po(e,t,n){var r=io,a=To(),o=Ai;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!Cr((ao||a).memoizedState,n);if(s&&(a.memoizedState=n,Qs=!0),a=a.queue,as(Lo.bind(null,r,a,e),[e]),a.getSnapshot!==t||s||oo!==null&&oo.memoizedState.tag&1){if(r.flags|=2048,es(9,{destroy:void 0},Io.bind(null,r,a,n,t),null),Ll===null)throw Error(i(349));o||ro&127||Fo(r,t,n)}return n}function Fo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=io.updateQueue,t===null?(t=Eo(),io.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Io(e,t,n,r){t.value=n,t.getSnapshot=r,Ro(t)&&zo(e)}function Lo(e,t,n){return n(function(){Ro(t)&&zo(e)})}function Ro(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Cr(e,n)}catch{return!0}}function zo(e){var t=ni(e,2);t!==null&&_u(t,e,2)}function Bo(e){var t=wo();if(typeof e==`function`){var n=e;if(e=n(),lo){Ve(!0);try{n()}finally{Ve(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ao,lastRenderedState:e},t}function Vo(e,t,n,r){return e.baseState=n,Mo(e,ao,typeof r==`function`?r:Ao)}function Ho(e,t,n,r,a){if(As(e))throw Error(i(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};j.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,Uo(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Uo(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=j.T,o={};j.T=o;try{var s=n(i,r),c=j.S;c!==null&&c(o,s),Wo(e,t,s)}catch(n){Ko(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),j.T=a}}else try{a=n(i,r),Wo(e,t,a)}catch(n){Ko(e,t,n)}}function Wo(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){Go(e,t,n)},function(n){return Ko(e,t,n)}):Go(e,t,n)}function Go(e,t,n){t.status=`fulfilled`,t.value=n,qo(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Uo(e,n)))}function Ko(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,qo(t),t=t.next;while(t!==r)}e.action=null}function qo(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Jo(e,t){return t}function Yo(e,t){if(Ai){var n=Ll.formState;if(n!==null){a:{var r=io;if(Ai){if(ki){b:{for(var i=ki,a=Mi;i.nodeType!==8;){if(!a){i=null;break b}if(i=lf(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){ki=lf(i.nextSibling),r=i.data===`F!`;break a}}Pi(r)}r=!1}r&&(t=n[0])}}return n=wo(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Jo,lastRenderedState:t},n.queue=r,n=Ds.bind(null,io,r),r.dispatch=n,r=Bo(!1),a=ks.bind(null,io,!1,r.queue),r=wo(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Ho.bind(null,io,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Xo(e){return Zo(To(),ao,e)}function Zo(e,t,n){if(t=Mo(e,t,Jo)[0],e=jo(Ao)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=Do(t)}catch(e){throw e===ga?va:e}else r=t;t=To();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(io.flags|=2048,es(9,{destroy:void 0},Qo.bind(null,i,n),null)),[r,a,e]}function Qo(e,t){e.action=t}function $o(e){var t=To(),n=ao;if(n!==null)return Zo(t,n,e);To(),t=t.memoizedState,n=To();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function es(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=io.updateQueue,t===null&&(t=Eo(),io.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function ts(){return To().memoizedState}function ns(e,t,n,r){var i=wo();io.flags|=e,i.memoizedState=es(1|t,{destroy:void 0},n,r===void 0?null:r)}function rs(e,t,n,r){var i=To();r=r===void 0?null:r;var a=i.memoizedState.inst;ao!==null&&r!==null&&go(r,ao.memoizedState.deps)?i.memoizedState=es(t,a,n,r):(io.flags|=e,i.memoizedState=es(1|t,a,n,r))}function is(e,t){ns(8390656,8,e,t)}function as(e,t){rs(2048,8,e,t)}function os(e){io.flags|=4;var t=io.updateQueue;if(t===null)t=Eo(),io.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function ss(e){var t=To().memoizedState;return os({ref:t,nextImpl:e}),function(){if(Il&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function cs(e,t){return rs(4,2,e,t)}function ls(e,t){return rs(4,4,e,t)}function us(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function ds(e,t,n){n=n==null?null:n.concat([e]),rs(4,4,us.bind(null,t,e),n)}function fs(){}function ps(e,t){var n=To();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&go(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function ms(e,t){var n=To();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&go(t,r[1]))return r[0];if(r=e(),lo){Ve(!0);try{e()}finally{Ve(!1)}}return n.memoizedState=[r,t],r}function hs(e,t,n){return n===void 0||ro&1073741824&&!(zl&261930)?e.memoizedState=t:(e.memoizedState=n,e=gu(),io.lanes|=e,ql|=e,n)}function gs(e,t,n,r){return Cr(n,t)?n:Ga.current===null?!(ro&42)||ro&1073741824&&!(zl&261930)?(Qs=!0,e.memoizedState=n):(e=gu(),io.lanes|=e,ql|=e,t):(e=hs(e,n,r),Cr(e,t)||(Qs=!0),e)}function _s(e,t,n,r,i){var a=M.p;M.p=a!==0&&8>a?a:8;var o=j.T,s={};j.T=s,ks(e,!1,t,n);try{var c=i(),l=j.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Os(e,t,da(c,r),hu(e)):Os(e,t,r,hu(e))}catch(n){Os(e,t,{then:function(){},status:`rejected`,reason:n},hu())}finally{M.p=a,o!==null&&s.types!==null&&(o.types=s.types),j.T=o}}function vs(){}function ys(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=bs(e).queue;_s(e,a,t,ae,n===null?vs:function(){return xs(e),n(r)})}function bs(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ae,baseState:ae,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ao,lastRenderedState:ae},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ao,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function xs(e){var t=bs(e);t.next===null&&(t=e.alternate.memoizedState),Os(e,t.next.queue,{},hu())}function Ss(){return Xi($f)}function Cs(){return To().memoizedState}function ws(){return To().memoizedState}function Ts(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=hu();e=Ia(n);var r=La(t,e,n);r!==null&&(_u(r,t,n),Ra(r,t,n)),t={cache:ra()},e.payload=t;return}t=t.return}}function Es(e,t,n){var r=hu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},As(e)?js(t,n):(n=ti(e,t,n,r),n!==null&&(_u(n,e,r),Ms(n,t,r)))}function Ds(e,t,n){Os(e,t,n,hu())}function Os(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(As(e))js(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Cr(s,o))return ei(e,t,i,0),Ll===null&&$r(),!1}catch{}if(n=ti(e,t,i,r),n!==null)return _u(n,e,r),Ms(n,t,r),!0}return!1}function ks(e,t,n,r){if(r={lane:2,revertLane:fd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},As(e)){if(t)throw Error(i(479))}else t=ti(e,n,r,2),t!==null&&_u(t,e,2)}function As(e){var t=e.alternate;return e===io||t!==null&&t===io}function js(e,t){co=so=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ms(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,nt(e,n)}}var Ns={readContext:Xi,use:Oo,useCallback:ho,useContext:ho,useEffect:ho,useImperativeHandle:ho,useLayoutEffect:ho,useInsertionEffect:ho,useMemo:ho,useReducer:ho,useRef:ho,useState:ho,useDebugValue:ho,useDeferredValue:ho,useTransition:ho,useSyncExternalStore:ho,useId:ho,useHostTransitionStatus:ho,useFormState:ho,useActionState:ho,useOptimistic:ho,useMemoCache:ho,useCacheRefresh:ho};Ns.useEffectEvent=ho;var Ps={readContext:Xi,use:Oo,useCallback:function(e,t){return wo().memoizedState=[e,t===void 0?null:t],e},useContext:Xi,useEffect:is,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),ns(4194308,4,us.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ns(4194308,4,e,t)},useInsertionEffect:function(e,t){ns(4,2,e,t)},useMemo:function(e,t){var n=wo();t=t===void 0?null:t;var r=e();if(lo){Ve(!0);try{e()}finally{Ve(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=wo();if(n!==void 0){var i=n(t);if(lo){Ve(!0);try{n(t)}finally{Ve(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Es.bind(null,io,e),[r.memoizedState,e]},useRef:function(e){var t=wo();return e={current:e},t.memoizedState=e},useState:function(e){e=Bo(e);var t=e.queue,n=Ds.bind(null,io,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:fs,useDeferredValue:function(e,t){return hs(wo(),e,t)},useTransition:function(){var e=Bo(!1);return e=_s.bind(null,io,e.queue,!0,!1),wo().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=io,a=wo();if(Ai){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Ll===null)throw Error(i(349));zl&127||Fo(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,is(Lo.bind(null,r,o,e),[e]),r.flags|=2048,es(9,{destroy:void 0},Io.bind(null,r,o,n,t),null),n},useId:function(){var e=wo(),t=Ll.identifierPrefix;if(Ai){var n=V,r=wi;n=(r&~(1<<32-He(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=uo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=mo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:Ss,useFormState:Yo,useActionState:Yo,useOptimistic:function(e){var t=wo();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=ks.bind(null,io,!0,n),n.dispatch=t,[e,t]},useMemoCache:ko,useCacheRefresh:function(){return wo().memoizedState=Ts.bind(null,io)},useEffectEvent:function(e){var t=wo(),n={impl:e};return t.memoizedState=n,function(){if(Il&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},Fs={readContext:Xi,use:Oo,useCallback:ps,useContext:Xi,useEffect:as,useImperativeHandle:ds,useInsertionEffect:cs,useLayoutEffect:ls,useMemo:ms,useReducer:jo,useRef:ts,useState:function(){return jo(Ao)},useDebugValue:fs,useDeferredValue:function(e,t){return gs(To(),ao.memoizedState,e,t)},useTransition:function(){var e=jo(Ao)[0],t=To().memoizedState;return[typeof e==`boolean`?e:Do(e),t]},useSyncExternalStore:Po,useId:Cs,useHostTransitionStatus:Ss,useFormState:Xo,useActionState:Xo,useOptimistic:function(e,t){return Vo(To(),ao,e,t)},useMemoCache:ko,useCacheRefresh:ws};Fs.useEffectEvent=ss;var Is={readContext:Xi,use:Oo,useCallback:ps,useContext:Xi,useEffect:as,useImperativeHandle:ds,useInsertionEffect:cs,useLayoutEffect:ls,useMemo:ms,useReducer:No,useRef:ts,useState:function(){return No(Ao)},useDebugValue:fs,useDeferredValue:function(e,t){var n=To();return ao===null?hs(n,e,t):gs(n,ao.memoizedState,e,t)},useTransition:function(){var e=No(Ao)[0],t=To().memoizedState;return[typeof e==`boolean`?e:Do(e),t]},useSyncExternalStore:Po,useId:Cs,useHostTransitionStatus:Ss,useFormState:$o,useActionState:$o,useOptimistic:function(e,t){var n=To();return ao===null?(n.baseState=e,[e,n.queue.dispatch]):Vo(n,ao,e,t)},useMemoCache:ko,useCacheRefresh:ws};Is.useEffectEvent=ss;function Ls(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:h({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Rs={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=hu(),i=Ia(r);i.payload=t,n!=null&&(i.callback=n),t=La(e,i,r),t!==null&&(_u(t,e,r),Ra(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=hu(),i=Ia(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=La(e,i,r),t!==null&&(_u(t,e,r),Ra(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=hu(),r=Ia(n);r.tag=2,t!=null&&(r.callback=t),t=La(e,r,n),t!==null&&(_u(t,e,n),Ra(t,e,n))}};function zs(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!wr(n,r)||!wr(i,a):!0}function Bs(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Rs.enqueueReplaceState(t,t.state,null)}function Vs(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=h({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Hs(e){Yr(e)}function Us(e){console.error(e)}function Ws(e){Yr(e)}function Gs(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Ks(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function qs(e,t,n){return n=Ia(n),n.tag=3,n.payload={element:null},n.callback=function(){Gs(e,t)},n}function Js(e){return e=Ia(e),e.tag=3,e}function Ys(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){Ks(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Ks(t,n,r),typeof i!=`function`&&(au===null?au=new Set([this]):au.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Xs(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&W(t,n,a,!0),n=q.current,n!==null){switch(n.tag){case 31:case 13:return J===null?ku():n.alternate===null&&Kl===0&&(Kl=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===K?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),qu(e,r,a)),!1;case 22:return n.flags|=65536,r===K?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),qu(e,r,a)),!1}throw Error(i(435,n.tag))}return qu(e,r,a),ku(),!1}if(Ai)return t=q.current,t===null?(r!==Ni&&(t=Error(i(423),{cause:r}),Bi(_i(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=_i(r,n),a=qs(e.stateNode,r,a),za(e,a),Kl!==4&&(Kl=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==Ni&&(e=Error(i(422),{cause:r}),Bi(_i(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=_i(o,n),Ql===null?Ql=[o]:Ql.push(o),Kl!==4&&(Kl=2),t===null)return!0;r=_i(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=qs(n.stateNode,r,e),za(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(au===null||!au.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=Js(a),Ys(a,e,n,r),za(n,a),!1}n=n.return}while(n!==null);return!1}var Zs=Error(i(461)),Qs=!1;function $s(e,t,n,r){t.child=e===null?Ma(t,null,n,r):ja(t,e.child,n,r)}function ec(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return Yi(t),r=_o(e,t,n,o,a,i),s=xo(),e!==null&&!Qs?(So(e,t,i),wc(e,t,i)):(Ai&&s&&U(t),t.flags|=1,$s(e,t,r,i),t.child)}function tc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!ci(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,nc(e,t,a,r,i)):(e=di(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!Tc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?wr:n,n(o,r)&&e.ref===t.ref)return wc(e,t,i)}return t.flags|=1,e=li(a,r),e.ref=t.ref,e.return=t,t.child=e}function nc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(wr(a,r)&&e.ref===t.ref)if(Qs=!1,t.pendingProps=r=a,Tc(e,i))e.flags&131072&&(Qs=!0);else return t.lanes=e.lanes,wc(e,t,i)}return uc(e,t,n,r,i)}function rc(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return ac(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&ha(t,a===null?null:a.cachePool),a===null?Ja():qa(t,a),Qa(t);else return r=t.lanes=536870912,ac(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&ha(t,null),Ja(),$a(t)):(ha(t,a.cachePool),qa(t,a),$a(t),t.memoizedState=null);return $s(e,t,i,n),t.child}function ic(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function ac(e,t,n,r,i){var a=ma();return a=a===null?null:{parent:na._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&ha(t,null),Ja(),Qa(t),e!==null&&W(e,t,r,!0),t.childLanes=i,null}function oc(e,t){return t=yc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function sc(e,t,n){return ja(t,e.child,null,n),e=oc(t,t.pendingProps),e.flags|=2,eo(t),t.memoizedState=null,e}function cc(e,t,n){var r=t.pendingProps,a=(t.flags&128)!=0;if(t.flags&=-129,e===null){if(Ai){if(r.mode===`hidden`)return e=oc(t,r),t.lanes=536870912,ic(null,e);if(Za(t),(e=ki)?(e=af(e,Mi),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ci===null?null:{id:wi,overflow:V},retryLane:536870912,hydrationErrors:null},n=mi(e),n.return=t,t.child=n,Oi=t,ki=null)):e=null,e===null)throw Pi(t);return t.lanes=536870912,null}return oc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(Za(t),a)if(t.flags&256)t.flags&=-257,t=sc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558));else if(Qs||W(e,t,n,!1),a=(n&e.childLanes)!==0,Qs||a){if(r=Ll,r!==null&&(s=rt(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,ni(e,s),_u(r,e,s),Zs;ku(),t=sc(e,t,n)}else e=o.treeContext,ki=lf(s.nextSibling),Oi=t,Ai=!0,ji=null,Mi=!1,e!==null&&Di(t,e),t=oc(t,r),t.flags|=4096;return t}return e=li(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function lc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(i(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function uc(e,t,n,r,i){return Yi(t),n=_o(e,t,n,r,void 0,i),r=xo(),e!==null&&!Qs?(So(e,t,i),wc(e,t,i)):(Ai&&r&&U(t),t.flags|=1,$s(e,t,n,i),t.child)}function dc(e,t,n,r,i,a){return Yi(t),t.updateQueue=null,n=yo(t,r,n,i),vo(e),r=xo(),e!==null&&!Qs?(So(e,t,a),wc(e,t,a)):(Ai&&r&&U(t),t.flags|=1,$s(e,t,n,a),t.child)}function fc(e,t,n,r,i){if(Yi(t),t.stateNode===null){var a=ai,o=n.contextType;typeof o==`object`&&o&&(a=Xi(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Rs,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},Pa(t),o=n.contextType,a.context=typeof o==`object`&&o?Xi(o):ai,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Ls(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&Rs.enqueueReplaceState(a,a.state,null),Ha(t,r,a,i),Va(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=Vs(n,s);a.props=c;var l=a.context,u=n.contextType;o=ai,typeof u==`object`&&u&&(o=Xi(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&Bs(t,a,r,o),Na=!1;var f=t.memoizedState;a.state=f,Ha(t,r,a,i),Va(),l=t.memoizedState,s||f!==l||Na?(typeof d==`function`&&(Ls(t,n,d,r),l=t.memoizedState),(c=Na||zs(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,Fa(e,t),o=t.memoizedProps,u=Vs(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=ai,typeof l==`object`&&l&&(c=Xi(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&Bs(t,a,r,c),Na=!1,f=t.memoizedState,a.state=f,Ha(t,r,a,i),Va();var p=t.memoizedState;o!==d||f!==p||Na||e!==null&&e.dependencies!==null&&Ji(e.dependencies)?(typeof s==`function`&&(Ls(t,n,s,r),p=t.memoizedState),(u=Na||zs(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Ji(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,lc(e,t),r=(t.flags&128)!=0,a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=ja(t,e.child,null,i),t.child=ja(t,null,n,i)):$s(e,t,n,i),t.memoizedState=a.state,e=t.child):e=wc(e,t,i),e}function pc(e,t,n,r){return Ri(),t.flags|=256,$s(e,t,n,r),t.child}var mc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function hc(e){return{baseLanes:e,cachePool:G()}}function gc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=Xl),e}function _c(e,t,n){var r=t.pendingProps,a=!1,o=(t.flags&128)!=0,s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:(to.current&2)!=0),s&&(a=!0,t.flags&=-129),s=(t.flags&32)!=0,t.flags&=-33,e===null){if(Ai){if(a?Xa(t):$a(t),(e=ki)?(e=af(e,Mi),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ci===null?null:{id:wi,overflow:V},retryLane:536870912,hydrationErrors:null},n=mi(e),n.return=t,t.child=n,Oi=t,ki=null)):e=null,e===null)throw Pi(t);return sf(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?($a(t),a=t.mode,c=yc({mode:`hidden`,children:c},a),r=fi(r,a,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=hc(n),r.childLanes=gc(e,s,n),t.memoizedState=mc,ic(null,r)):(Xa(t),vc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?(Xa(t),t.flags&=-257,t=bc(e,t,n)):t.memoizedState===null?($a(t),c=r.fallback,a=t.mode,r=yc({mode:`visible`,children:r.children},a),c=fi(c,a,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,ja(t,e.child,null,n),r=t.child,r.memoizedState=hc(n),r.childLanes=gc(e,s,n),t.memoizedState=mc,t=ic(null,r)):($a(t),t.child=e.child,t.flags|=128,t=null);else if(Xa(t),sf(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(i(419)),r.stack=``,r.digest=s,Bi({value:r,source:null,stack:null}),t=bc(e,t,n)}else if(Qs||W(e,t,n,!1),s=(n&e.childLanes)!==0,Qs||s){if(s=Ll,s!==null&&(r=rt(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,ni(e,r),_u(s,e,r),Zs;of(c)||ku(),t=bc(e,t,n)}else of(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,ki=lf(c.nextSibling),Oi=t,Ai=!0,ji=null,Mi=!1,e!==null&&Di(t,e),t=vc(t,r.children),t.flags|=4096);return t}return a?($a(t),c=r.fallback,a=t.mode,l=e.child,u=l.sibling,r=li(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=fi(c,a,n,null),c.flags|=2):c=li(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,ic(null,r),r=t.child,c=e.child.memoizedState,c===null?c=hc(n):(a=c.cachePool,a===null?a=G():(l=na._currentValue,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),r.memoizedState=c,r.childLanes=gc(e,s,n),t.memoizedState=mc,ic(e.child,r)):(Xa(t),n=e.child,e=n.sibling,n=li(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n)}function vc(e,t){return t=yc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function yc(e,t){return e=si(22,e,null,t),e.lanes=0,e}function bc(e,t,n){return ja(t,e.child,null,n),e=vc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function xc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Ki(e.return,t,n)}function Sc(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function Cc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=to.current,s=(o&2)!=0;if(s?(o=o&1|2,t.flags|=128):o&=1,ue(to,o),$s(e,t,r,n),r=Ai?bi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&xc(e,n,t);else if(e.tag===19)xc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&no(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Sc(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&no(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Sc(t,!0,n,null,a,r);break;case`together`:Sc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function wc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),ql|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(W(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=li(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=li(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Tc(e,t){return(e.lanes&t)===0?(e=e.dependencies,!!(e!==null&&Ji(e))):!0}function Ec(e,t,n){switch(t.tag){case 3:he(t,t.stateNode.containerInfo),Wi(t,na,e.memoizedState.cache),Ri();break;case 27:case 5:_e(t);break;case 4:he(t,t.stateNode.containerInfo);break;case 10:Wi(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Za(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(Xa(t),e=wc(e,t,n),e===null?null:e.sibling):_c(e,t,n):(Xa(t),t.flags|=128,null);Xa(t);break;case 19:var i=(e.flags&128)!=0;if(r=(n&t.childLanes)!==0,r||=(W(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return Cc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),ue(to,to.current),r)break;return null;case 22:return t.lanes=0,rc(e,t,n,t.pendingProps);case 24:Wi(t,na,e.memoizedState.cache)}return wc(e,t,n)}function Dc(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Qs=!0;else{if(!Tc(e,n)&&!(t.flags&128))return Qs=!1,Ec(e,t,n);Qs=!!(e.flags&131072)}else Qs=!1,Ai&&t.flags&1048576&&H(t,bi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=xa(t.elementType),t.type=e,typeof e==`function`)ci(e)?(r=Vs(e,r),t.tag=1,t=fc(null,t,e,r,n)):(t.tag=0,t=uc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===w){t.tag=11,t=ec(null,t,e,r,n);break a}else if(a===D){t.tag=14,t=tc(null,t,e,r,n);break a}}throw t=re(e)||e,Error(i(306,t,``))}}return t;case 0:return uc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=Vs(r,t.pendingProps),fc(e,t,r,a,n);case 3:a:{if(he(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,Fa(e,t),Ha(t,r,null,n);var s=t.memoizedState;if(r=s.cache,Wi(t,na,r),r!==o.cache&&qi(t,[na],n,!0),Va(),r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=pc(e,t,r,n);break a}else if(r!==a){a=_i(Error(i(424)),t),Bi(a),t=pc(e,t,r,n);break a}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(ki=lf(e.firstChild),Oi=t,Ai=!0,ji=null,Mi=!0,n=Ma(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Ri(),r===a){t=wc(e,t,n);break a}$s(e,t,r,n)}t=t.child}return t;case 26:return lc(e,t),e===null?(n=Af(t.type,null,t.pendingProps,null))?t.memoizedState=n:Ai||(n=t.type,e=t.pendingProps,r=Vd(pe.current).createElement(n),r[lt]=t,r[ut]=e,Q(r,n,e),St(r),t.stateNode=r):t.memoizedState=Af(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return _e(t),e===null&&Ai&&(r=t.stateNode=pf(t.type,t.pendingProps,pe.current),Oi=t,Mi=!0,a=ki,Qd(t.type)?(uf=a,ki=lf(r.firstChild)):ki=a),$s(e,t,t.pendingProps.children,n),lc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ai&&((a=r=ki)&&(r=nf(r,t.type,t.pendingProps,Mi),r===null?a=!1:(t.stateNode=r,Oi=t,ki=lf(r.firstChild),Mi=!1,a=!0)),a||Pi(t)),_e(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,Wd(a,o)?r=null:s!==null&&Wd(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=_o(e,t,bo,null,null,n),$f._currentValue=a),lc(e,t),$s(e,t,r,n),t.child;case 6:return e===null&&Ai&&((e=n=ki)&&(n=rf(n,t.pendingProps,Mi),n===null?e=!1:(t.stateNode=n,Oi=t,ki=null,e=!0)),e||Pi(t)),null;case 13:return _c(e,t,n);case 4:return he(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=ja(t,null,r,n):$s(e,t,r,n),t.child;case 11:return ec(e,t,t.type,t.pendingProps,n);case 7:return $s(e,t,t.pendingProps,n),t.child;case 8:return $s(e,t,t.pendingProps.children,n),t.child;case 12:return $s(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Wi(t,t.type,r.value),$s(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,Yi(t),a=Xi(a),r=r(a),t.flags|=1,$s(e,t,r,n),t.child;case 14:return tc(e,t,t.type,t.pendingProps,n);case 15:return nc(e,t,t.type,t.pendingProps,n);case 19:return Cc(e,t,n);case 31:return cc(e,t,n);case 22:return rc(e,t,n,t.pendingProps);case 24:return Yi(t),r=Xi(na),e===null?(a=ma(),a===null&&(a=Ll,o=ra(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},Pa(t),Wi(t,na,a)):((e.lanes&n)!==0&&(Fa(e,t),Ha(t,null,null,n),Va()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,Wi(t,na,r),r!==a.cache&&qi(t,[na],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),Wi(t,na,r))),$s(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function Oc(e){e.flags|=4}function kc(e,t,n,r,i){if((t=(e.mode&32)!=0)&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i)if(e.stateNode.complete)e.flags|=8192;else if(Eu())e.flags|=8192;else throw Sa=K,_a}else e.flags&=-16777217}function Ac(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Gf(t))if(Eu())e.flags|=8192;else throw Sa=K,_a}function jc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:Qe(),e.lanes|=t,Zl|=t)}function Mc(e,t){if(!Ai)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Nc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Pc(e,t,n){var r=t.pendingProps;switch(Ei(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Nc(t),null;case 1:return Nc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Gi(na),ge(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Li(t)?Oc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,zi())),Nc(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(Oc(t),o===null?(Nc(t),kc(t,a,null,r,n)):(Nc(t),Ac(t,o))):o?o===e.memoizedState?(Nc(t),t.flags&=-16777217):(Oc(t),Nc(t),Ac(t,o)):(e=e.memoizedProps,e!==r&&Oc(t),Nc(t),kc(t,a,e,r,n)),null;case 27:if(ve(t),n=pe.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Oc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Nc(t),null}e=de.current,Li(t)?Fi(t,e):(e=pf(a,r,n),t.stateNode=e,Oc(t))}return Nc(t),null;case 5:if(ve(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Oc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Nc(t),null}if(o=de.current,Li(t))Fi(t,o);else{var s=Vd(pe.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;default:switch(a){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[lt]=t,o[ut]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Q(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Oc(t)}}return Nc(t),kc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Oc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=pe.current,Li(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Oi,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[lt]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Z(e.nodeValue,n)),e||Pi(t,!0)}else e=Vd(e).createTextNode(r),e[lt]=t,t.stateNode=e}return Nc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Li(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[lt]=t}else Ri(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Nc(t),e=!1}else n=zi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(eo(t),t):(eo(t),null);if(t.flags&128)throw Error(i(558))}return Nc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Li(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[lt]=t}else Ri(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Nc(t),a=!1}else a=zi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(eo(t),t):(eo(t),null)}return eo(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),jc(t,t.updateQueue),Nc(t),null);case 4:return ge(),e===null&&wd(t.stateNode.containerInfo),Nc(t),null;case 10:return Gi(t.type),Nc(t),null;case 19:if(le(to),r=t.memoizedState,r===null)return Nc(t),null;if(a=(t.flags&128)!=0,o=r.rendering,o===null)if(a)Mc(r,!1);else{if(Kl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=no(e),o!==null){for(t.flags|=128,Mc(r,!1),e=o.updateQueue,t.updateQueue=e,jc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ui(n,e),n=n.sibling;return ue(to,to.current&1|2),Ai&&Ti(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&je()>ru&&(t.flags|=128,a=!0,Mc(r,!1),t.lanes=4194304)}else{if(!a)if(e=no(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,jc(t,e),Mc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!Ai)return Nc(t),null}else 2*je()-r.renderingStartTime>ru&&n!==536870912&&(t.flags|=128,a=!0,Mc(r,!1),t.lanes=4194304);r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(Nc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=je(),e.sibling=null,n=to.current,ue(to,a?n&1|2:n&1),Ai&&Ti(t,r.treeForkCount),e);case 22:case 23:return eo(t),Ya(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Nc(t),t.subtreeFlags&6&&(t.flags|=8192)):Nc(t),n=t.updateQueue,n!==null&&jc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&le(pa),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Gi(na),Nc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Fc(e,t){switch(Ei(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Gi(na),ge(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ve(t),null;case 31:if(t.memoizedState!==null){if(eo(t),t.alternate===null)throw Error(i(340));Ri()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(eo(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Ri()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return le(to),null;case 4:return ge(),null;case 10:return Gi(t.type),null;case 22:case 23:return eo(t),Ya(),e!==null&&le(pa),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Gi(na),null;case 25:return null;default:return null}}function Ic(e,t){switch(Ei(t),t.tag){case 3:Gi(na),ge();break;case 26:case 27:case 5:ve(t);break;case 4:ge();break;case 31:t.memoizedState!==null&&eo(t);break;case 13:eo(t);break;case 19:le(to);break;case 10:Gi(t.type);break;case 22:case 23:eo(t),Ya(),e!==null&&le(pa);break;case 24:Gi(na)}}function Lc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Ku(t,t.return,e)}}function Rc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Ku(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Ku(t,t.return,e)}}function zc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Wa(t,n)}catch(t){Ku(e,e.return,t)}}}function Bc(e,t,n){n.props=Vs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Ku(e,t,n)}}function Vc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Ku(e,t,n)}}function Hc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){Ku(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Ku(e,t,n)}else n.current=null}function Uc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Ku(e,e.return,t)}}function Wc(e,t,n){try{var r=e.stateNode;Id(r,e.type,n,t),r[ut]=t}catch(t){Ku(e,e.return,t)}}function Gc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Qd(e.type)||e.tag===4}function Kc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Gc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Qd(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function qc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=nn));else if(r!==4&&(r===27&&Qd(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(qc(e,t,n),e=e.sibling;e!==null;)qc(e,t,n),e=e.sibling}function Jc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&Qd(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Jc(e,t,n),e=e.sibling;e!==null;)Jc(e,t,n),e=e.sibling}function Yc(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Q(t,r,n),t[lt]=e,t[ut]=n}catch(t){Ku(e,e.return,t)}}var Xc=!1,Zc=!1,Qc=!1,$c=typeof WeakSet==`function`?WeakSet:Set,el=null;function tl(e,t){if(e=e.containerInfo,zd=cp,e=Or(e),kr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Bd={focusedElem:e,selectionRange:n},cp=!1,el=t;el!==null;)if(t=el,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,el=e;else for(;el!==null;){switch(t=el,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n<e.length;n++)a=e[n],a.ref.impl=a.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&o!==null){e=void 0,n=t,a=o.memoizedProps,o=o.memoizedState,r=n.stateNode;try{var h=Vs(n.type,a);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){Ku(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)tf(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:tf(e);break;default:e.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(i(163))}if(e=t.sibling,e!==null){e.return=t.return,el=e;break}el=t.return}}function nl(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:_l(e,n),r&4&&Lc(5,n);break;case 1:if(_l(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){Ku(n,n.return,e)}else{var i=Vs(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Ku(n,n.return,e)}}r&64&&zc(n),r&512&&Vc(n,n.return);break;case 3:if(_l(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Wa(e,t)}catch(e){Ku(n,n.return,e)}}break;case 27:t===null&&r&4&&Yc(n);case 26:case 5:_l(e,n),t===null&&r&4&&Uc(n),r&512&&Vc(n,n.return);break;case 12:_l(e,n);break;case 31:_l(e,n),r&4&&cl(e,n);break;case 13:_l(e,n),r&4&&ll(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Xu.bind(null,n),cf(e,n))));break;case 22:if(r=n.memoizedState!==null||Xc,!r){t=t!==null&&t.memoizedState!==null||Zc,i=Xc;var a=Zc;Xc=r,(Zc=t)&&!a?yl(e,n,(n.subtreeFlags&8772)!=0):_l(e,n),Xc=i,Zc=a}break;case 30:break;default:_l(e,n)}}function rl(e){var t=e.alternate;t!==null&&(e.alternate=null,rl(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&_t(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var il=null,al=!1;function ol(e,t,n){for(n=n.child;n!==null;)sl(e,t,n),n=n.sibling}function sl(e,t,n){if(N&&typeof N.onCommitFiberUnmount==`function`)try{N.onCommitFiberUnmount(Be,n)}catch{}switch(n.tag){case 26:Zc||Hc(n,t),ol(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Zc||Hc(n,t);var r=il,i=al;Qd(n.type)&&(il=n.stateNode,al=!1),ol(e,t,n),mf(n.stateNode),il=r,al=i;break;case 5:Zc||Hc(n,t);case 6:if(r=il,i=al,il=null,ol(e,t,n),il=r,al=i,il!==null)if(al)try{(il.nodeType===9?il.body:il.nodeName===`HTML`?il.ownerDocument.body:il).removeChild(n.stateNode)}catch(e){Ku(n,t,e)}else try{il.removeChild(n.stateNode)}catch(e){Ku(n,t,e)}break;case 18:il!==null&&(al?(e=il,$d(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Pp(e)):$d(il,n.stateNode));break;case 4:r=il,i=al,il=n.stateNode.containerInfo,al=!0,ol(e,t,n),il=r,al=i;break;case 0:case 11:case 14:case 15:Rc(2,n,t),Zc||Rc(4,n,t),ol(e,t,n);break;case 1:Zc||(Hc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Bc(n,t,r)),ol(e,t,n);break;case 21:ol(e,t,n);break;case 22:Zc=(r=Zc)||n.memoizedState!==null,ol(e,t,n),Zc=r;break;default:ol(e,t,n)}}function cl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Pp(e)}catch(e){Ku(t,t.return,e)}}}function ll(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Pp(e)}catch(e){Ku(t,t.return,e)}}function ul(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new $c),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new $c),t;default:throw Error(i(435,e.tag))}}function dl(e,t){var n=ul(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=Zu.bind(null,e,t);t.then(r,r)}})}function fl(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var a=n[r],o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 27:if(Qd(c.type)){il=c.stateNode,al=!1;break a}break;case 5:il=c.stateNode,al=!1;break a;case 3:case 4:il=c.stateNode.containerInfo,al=!0;break a}c=c.return}if(il===null)throw Error(i(160));sl(o,s,a),il=null,al=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)ml(t,e),t=t.sibling}var pl=null;function ml(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:fl(t,e),hl(e),r&4&&(Rc(3,e,e.return),Lc(3,e),Rc(5,e,e.return));break;case 1:fl(t,e),hl(e),r&512&&(Zc||n===null||Hc(n,n.return)),r&64&&Xc&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var a=pl;if(fl(t,e),hl(e),r&512&&(Zc||n===null||Hc(n,n.return)),r&4){var o=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null)if(r===null)if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,a=a.ownerDocument||a;b:switch(r){case`title`:o=a.getElementsByTagName(`title`)[0],(!o||o[gt]||o[lt]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=a.createElement(r),a.head.insertBefore(o,a.querySelector(`head >
8 title`))),Q(o,r,n),o[lt]=e,St(o),r=o;break a;case`link`:var s=Hf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&o.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&o.getAttribute(`title`)===(n.title==null?null:n.title)&&o.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(c,1);break b}}o=a.createElement(r),Q(o,r,n),a.head.appendChild(o);break;case`meta`:if(s=Hf(`meta`,`content`,a).get(r+(n.content||``))){for(c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`content`)===(n.content==null?null:``+n.content)&&o.getAttribute(`name`)===(n.name==null?null:n.name)&&o.getAttribute(`property`)===(n.property==null?null:n.property)&&o.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&o.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){s.splice(c,1);break b}}o=a.createElement(r),Q(o,r,n),a.head.appendChild(o);break;default:throw Error(i(468,r))}o[lt]=e,St(o),r=o}e.stateNode=r}else Uf(a,e.type,e.stateNode);else e.stateNode=Lf(a,r,e.memoizedProps);
vendor: 40,654 bytes, lines 8-9
8else o===r?r===null&&e.stateNode!==null&&Wc(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?Uf(a,e.type,e.stateNode):Lf(a,r,e.memoizedProps))}break;case 27:fl(t,e),hl(e),r&512&&(Zc||n===null||Hc(n,n.return)),n!==null&&r&4&&Wc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(fl(t,e),hl(e),r&512&&(Zc||n===null||Hc(n,n.return)),e.flags&32){a=e.stateNode;try{Jt(a,``)}catch(t){Ku(e,e.return,t)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,Wc(e,a,n===null?a:n.memoizedProps)),r&1024&&(Qc=!0);break;case 6:if(fl(t,e),hl(e),r&4){if(e.stateNode===null)throw Error(i(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){Ku(e,e.return,t)}}break;case 3:if(Vf=null,a=pl,pl=_f(t.containerInfo),fl(t,e),pl=a,hl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Pp(t.containerInfo)}catch(t){Ku(e,e.return,t)}Qc&&(Qc=!1,gl(e));break;case 4:r=pl,pl=_f(e.stateNode.containerInfo),fl(t,e),hl(e),pl=r;break;case 12:fl(t,e),hl(e);break;case 31:fl(t,e),hl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,dl(e,r)));break;case 13:fl(t,e),hl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(tu=je()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,dl(e,r)));break;case 22:a=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=Xc,d=Zc;if(Xc=u||a,Zc=d||l,fl(t,e),Zc=d,Xc=u,hl(e),r&8192)a:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||l||Xc||Zc||vl(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(o=l.stateNode,a)s=o.style,typeof s.setProperty==`function`?s.setProperty(`display`,`none`,`important`):s.display=`none`;else{c=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty(`display`)?f.display:null;c.style.display=p==null||typeof p==`boolean`?``:(``+p).trim()}}catch(e){Ku(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=a?``:l.memoizedProps}catch(e){Ku(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;a?ef(m,!0):ef(l.stateNode,!1)}catch(e){Ku(l,l.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,dl(e,n))));break;case 19:fl(t,e),hl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,dl(e,r)));break;case 30:break;case 21:break;default:fl(t,e),hl(e)}}function hl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Gc(r)){n=r;break}r=r.return}if(n==null)throw Error(i(160));switch(n.tag){case 27:var a=n.stateNode;Jc(e,Kc(e),a);break;case 5:var o=n.stateNode;n.flags&32&&(Jt(o,``),n.flags&=-33),Jc(e,Kc(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;qc(e,Kc(e),s);break;default:throw Error(i(161))}}catch(t){Ku(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function gl(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;gl(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function _l(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)nl(e,t.alternate,t),t=t.sibling}function vl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Rc(4,t,t.return),vl(t);break;case 1:Hc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Bc(t,t.return,n),vl(t);break;case 27:mf(t.stateNode);case 26:case 5:Hc(t,t.return),vl(t);break;case 22:t.memoizedState===null&&vl(t);break;case 30:vl(t);break;default:vl(t)}e=e.sibling}}function yl(e,t,n){for(n&&=(t.subtreeFlags&8772)!=0,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:yl(i,a,n),Lc(4,a);break;case 1:if(yl(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){Ku(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)Ua(c[i],s)}catch(e){Ku(r,r.return,e)}}n&&o&64&&zc(a),Vc(a,a.return);break;case 27:Yc(a);case 26:case 5:yl(i,a,n),n&&r===null&&o&4&&Uc(a),Vc(a,a.return);break;case 12:yl(i,a,n);break;case 31:yl(i,a,n),n&&o&4&&cl(i,a);break;case 13:yl(i,a,n),n&&o&4&&ll(i,a);break;case 22:a.memoizedState===null&&yl(i,a,n),Vc(a,a.return);break;case 30:break;default:yl(i,a,n)}t=t.sibling}}function bl(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&ia(n))}function xl(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ia(e))}function Sl(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Cl(e,t,n,r),t=t.sibling}function Cl(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:Sl(e,t,n,r),i&2048&&Lc(9,t);break;case 1:Sl(e,t,n,r);break;case 3:Sl(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ia(e)));break;case 12:if(i&2048){Sl(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){Ku(t,t.return,e)}}else Sl(e,t,n,r);break;case 31:Sl(e,t,n,r);break;case 13:Sl(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?Sl(e,t,n,r):(a._visibility|=2,wl(e,t,n,r,(t.subtreeFlags&10256)!=0||!1)):a._visibility&2?Sl(e,t,n,r):Tl(e,t),i&2048&&bl(o,t);break;case 24:Sl(e,t,n,r),i&2048&&xl(t.alternate,t);break;default:Sl(e,t,n,r)}}function wl(e,t,n,r,i){for(i&&=(t.subtreeFlags&10256)!=0||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:wl(a,o,s,c,i),Lc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,wl(a,o,s,c,i)):u._visibility&2?wl(a,o,s,c,i):Tl(a,o),i&&l&2048&&bl(o.alternate,o);break;case 24:wl(a,o,s,c,i),i&&l&2048&&xl(o.alternate,o);break;default:wl(a,o,s,c,i)}t=t.sibling}}function Tl(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:Tl(n,r),i&2048&&bl(r.alternate,r);break;case 24:Tl(n,r),i&2048&&xl(r.alternate,r);break;default:Tl(n,r)}t=t.sibling}}var El=8192;function Dl(e,t,n){if(e.subtreeFlags&El)for(e=e.child;e!==null;)Ol(e,t,n),e=e.sibling}function Ol(e,t,n){switch(e.tag){case 26:Dl(e,t,n),e.flags&El&&e.memoizedState!==null&&Kf(n,pl,e.memoizedState,e.memoizedProps);break;case 5:Dl(e,t,n);break;case 3:case 4:var r=pl;pl=_f(e.stateNode.containerInfo),Dl(e,t,n),pl=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=El,El=16777216,Dl(e,t,n),El=r):Dl(e,t,n));break;default:Dl(e,t,n)}}function kl(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Al(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];el=r,Nl(r,e)}kl(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)jl(e),e=e.sibling}function jl(e){switch(e.tag){case 0:case 11:case 15:Al(e),e.flags&2048&&Rc(9,e,e.return);break;case 3:Al(e);break;case 12:Al(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Ml(e)):Al(e);break;default:Al(e)}}function Ml(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];el=r,Nl(r,e)}kl(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Rc(8,t,t.return),Ml(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Ml(t));break;default:Ml(t)}e=e.sibling}}function Nl(e,t){for(;el!==null;){var n=el;switch(n.tag){case 0:case 11:case 15:Rc(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:ia(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,el=r;else a:for(n=e;el!==null;){r=el;var i=r.sibling,a=r.return;if(rl(r),r===n){el=null;break a}if(i!==null){i.return=a,el=i;break a}el=a}}}var Pl={getCacheForType:function(e){var t=Xi(na),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Xi(na).controller.signal}},Fl=typeof WeakMap==`function`?WeakMap:Map,Il=0,Ll=null,Rl=null,zl=0,Bl=0,Vl=null,Hl=!1,Ul=!1,Wl=!1,Gl=0,Kl=0,ql=0,Jl=0,Yl=0,Xl=0,Zl=0,Ql=null,$l=null,eu=!1,tu=0,nu=0,ru=1/0,iu=null,au=null,ou=0,su=null,cu=null,lu=0,uu=0,du=null,fu=null,pu=0,mu=null;function hu(){return Il&2&&zl!==0?zl&-zl:j.T===null?ot():fd()}function gu(){if(Xl===0)if(!(zl&536870912)||Ai){var e=qe;qe<<=1,!(qe&3932160)&&(qe=262144),Xl=e}else Xl=536870912;return e=q.current,e!==null&&(e.flags|=32),Xl}function _u(e,t,n){(e===Ll&&(Bl===2||Bl===9)||e.cancelPendingCommit!==null)&&(wu(e,0),xu(e,zl,Xl,!1)),et(e,n),(!(Il&2)||e!==Ll)&&(e===Ll&&(!(Il&2)&&(Jl|=n),Kl===4&&xu(e,zl,Xl,!1)),id(e))}function vu(e,t,n){if(Il&6)throw Error(i(327));var r=!n&&(t&127)==0&&(t&e.expiredLanes)===0||Ze(e,t),a=r?Mu(e,t):Au(e,t,!0),o=r;do{if(a===0){Ul&&!r&&xu(e,t,0,!1);break}else{if(n=e.current.alternate,o&&!bu(n)){a=Au(e,t,!1),o=!1;continue}if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;a=Ql;var l=c.current.memoizedState.isDehydrated;if(l&&(wu(c,s).flags|=256),s=Au(c,s,!1),s!==2){if(Wl&&!l){c.errorRecoveryDisabledLanes|=o,Jl|=o,a=4;break a}o=$l,$l=a,o!==null&&($l===null?$l=o:$l.push.apply($l,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){wu(e,0),xu(e,t,0,!0);break}a:{switch(r=e,o=a,o){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t)break;case 6:xu(r,t,Xl,!Hl);break a;case 2:$l=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=tu+300-je(),10<a)){if(xu(r,t,Xl,!Hl),Xe(r,0,!0)!==0)break a;lu=t,r.timeoutHandle=qd(yu.bind(null,r,n,$l,iu,eu,t,Xl,Jl,Zl,Hl,o,`Throttled`,-0,0),a);break a}yu(r,n,$l,iu,eu,t,Xl,Jl,Zl,Hl,o,null,-0,0)}}break}while(1);id(e)}function yu(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:nn},Ol(t,a,d);var m=(a&62914560)===a?tu-je():(a&4194048)===a?nu-je():0;if(m=Jf(d,m),m!==null){lu=a,e.cancelPendingCommit=m(zu.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),xu(e,a,o,!l);return}}zu(e,t,a,n,r,i,o,s,c)}function bu(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!Cr(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function xu(e,t,n,r){t&=~Yl,t&=~Jl,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-He(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&F(e,n,t)}function Su(){return Il&6?!0:(ad(0,!1),!1)}function Cu(){if(Rl!==null){if(Bl===0)var e=Rl.return;else e=Rl,Ui=Hi=null,Co(e),Ta=null,Ea=0,e=Rl;for(;e!==null;)Ic(e.alternate,e),e=e.return;Rl=null}}function wu(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,Jd(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),lu=0,Cu(),Ll=e,Rl=n=li(e.current,null),zl=t,Bl=0,Vl=null,Hl=!1,Ul=Ze(e,t),Wl=!1,Zl=Xl=Yl=Jl=ql=Kl=0,$l=Ql=null,eu=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-He(r),a=1<<i;t|=e[i],r&=~a}return Gl=t,$r(),n}function Tu(e,t){io=null,j.H=Ns,t===ga||t===va?(t=Ca(),Bl=3):t===_a?(t=Ca(),Bl=4):Bl=t===Zs?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Vl=t,Rl===null&&(Kl=1,Gs(e,_i(t,e.current)))}function Eu(){var e=q.current;return e===null?!0:(zl&4194048)===zl?J===null:(zl&62914560)===zl||zl&536870912?e===J:!1}function Du(){var e=j.H;return j.H=Ns,e===null?Ns:e}function Ou(){var e=j.A;return j.A=Pl,e}function ku(){Kl=4,Hl||(zl&4194048)!==zl&&q.current!==null||(Ul=!0),!(ql&134217727)&&!(Jl&134217727)||Ll===null||xu(Ll,zl,Xl,!1)}function Au(e,t,n){var r=Il;Il|=2;var i=Du(),a=Ou();(Ll!==e||zl!==t)&&(iu=null,wu(e,t)),t=!1;var o=Kl;a:do try{if(Bl!==0&&Rl!==null){var s=Rl,c=Vl;switch(Bl){case 8:Cu(),o=6;break a;case 3:case 2:case 9:case 6:q.current===null&&(t=!0);var l=Bl;if(Bl=0,Vl=null,Iu(e,s,c,l),n&&Ul){o=0;break a}break;default:l=Bl,Bl=0,Vl=null,Iu(e,s,c,l)}}ju(),o=Kl;break}catch(t){Tu(e,t)}while(1);return t&&e.shellSuspendCounter++,Ui=Hi=null,Il=r,j.H=i,j.A=a,Rl===null&&(Ll=null,zl=0,$r()),o}function ju(){for(;Rl!==null;)Pu(Rl)}function Mu(e,t){var n=Il;Il|=2;var r=Du(),a=Ou();Ll!==e||zl!==t?(iu=null,ru=je()+500,wu(e,t)):Ul=Ze(e,t);a:do try{if(Bl!==0&&Rl!==null){t=Rl;var o=Vl;b:switch(Bl){case 1:Bl=0,Vl=null,Iu(e,t,o,1);break;case 2:case 9:if(ya(o)){Bl=0,Vl=null,Fu(t);break}t=function(){Bl!==2&&Bl!==9||Ll!==e||(Bl=7),id(e)},o.then(t,t);break a;case 3:Bl=7;break a;case 4:Bl=5;break a;case 7:ya(o)?(Bl=0,Vl=null,Fu(t)):(Bl=0,Vl=null,Iu(e,t,o,7));break;case 5:var s=null;switch(Rl.tag){case 26:s=Rl.memoizedState;case 5:case 27:var c=Rl;if(s?Gf(s):c.stateNode.complete){Bl=0,Vl=null;var l=c.sibling;if(l!==null)Rl=l;else{var u=c.return;u===null?Rl=null:(Rl=u,Lu(u))}break b}}Bl=0,Vl=null,Iu(e,t,o,5);break;case 6:Bl=0,Vl=null,Iu(e,t,o,6);break;case 8:Cu(),Kl=6;break a;default:throw Error(i(462))}}Nu();break}catch(t){Tu(e,t)}while(1);return Ui=Hi=null,j.H=r,j.A=a,Il=n,Rl===null?(Ll=null,zl=0,$r(),Kl):0}function Nu(){for(;Rl!==null&&!ke();)Pu(Rl)}function Pu(e){var t=Dc(e.alternate,e,Gl);e.memoizedProps=e.pendingProps,t===null?Lu(e):Rl=t}function Fu(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=dc(n,t,t.pendingProps,t.type,void 0,zl);break;case 11:t=dc(n,t,t.pendingProps,t.type.render,t.ref,zl);break;case 5:Co(t);default:Ic(n,t),t=Rl=ui(t,Gl),t=Dc(n,t,Gl)}e.memoizedProps=e.pendingProps,t===null?Lu(e):Rl=t}function Iu(e,t,n,r){Ui=Hi=null,Co(t),Ta=null,Ea=0;var i=t.return;try{if(Xs(e,i,t,n,zl)){Kl=1,Gs(e,_i(n,e.current)),Rl=null;return}}catch(t){if(i!==null)throw Rl=i,t;Kl=1,Gs(e,_i(n,e.current)),Rl=null;return}t.flags&32768?(Ai||r===1?e=!0:Ul||zl&536870912?e=!1:(Hl=e=!0,(r===2||r===9||r===3||r===6)&&(r=q.current,r!==null&&r.tag===13&&(r.flags|=16384))),Ru(t,e)):Lu(t)}function Lu(e){var t=e;do{if(t.flags&32768){Ru(t,Hl);return}e=t.return;var n=Pc(t.alternate,t,Gl);if(n!==null){Rl=n;return}if(t=t.sibling,t!==null){Rl=t;return}Rl=t=e}while(t!==null);Kl===0&&(Kl=5)}function Ru(e,t){do{var n=Fc(e.alternate,e);if(n!==null){n.flags&=32767,Rl=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Rl=e;return}Rl=e=n}while(e!==null);Kl=6,Rl=null}function zu(e,t,n,r,a,o,s,c,l){e.cancelPendingCommit=null;do Wu();while(ou!==0);if(Il&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(o=t.lanes|t.childLanes,o|=Qr,tt(e,n,o,s,c,l),e===Ll&&(Rl=Ll=null,zl=0),cu=t,su=e,lu=n,uu=o,du=a,fu=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,Qu(Fe,function(){return Y(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!=0,t.subtreeFlags&13878||r){r=j.T,j.T=null,a=M.p,M.p=2,s=Il,Il|=4;try{tl(e,t,n)}finally{Il=s,M.p=a,j.T=r}}ou=1,Bu(),Vu(),Hu()}}function Bu(){if(ou===1){ou=0;var e=su,t=cu,n=(t.flags&13878)!=0;if(t.subtreeFlags&13878||n){n=j.T,j.T=null;var r=M.p;M.p=2;var i=Il;Il|=4;try{ml(t,e);var a=Bd,o=Or(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&Dr(s.ownerDocument.documentElement,s)){if(c!==null&&kr(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=Er(s,h),v=Er(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}cp=!!zd,Bd=zd=null}finally{Il=i,M.p=r,j.T=n}}e.current=t,ou=2}}function Vu(){if(ou===2){ou=0;var e=su,t=cu,n=(t.flags&8772)!=0;if(t.subtreeFlags&8772||n){n=j.T,j.T=null;var r=M.p;M.p=2;var i=Il;Il|=4;try{nl(e,t.alternate,t)}finally{Il=i,M.p=r,j.T=n}}ou=3}}function Hu(){if(ou===4||ou===3){ou=0,Ae();var e=su,t=cu,n=lu,r=fu;t.subtreeFlags&10256||t.flags&10256?ou=5:(ou=0,cu=su=null,Uu(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(au=null),at(n),t=t.stateNode,N&&typeof N.onCommitFiberRoot==`function`)try{N.onCommitFiberRoot(Be,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=j.T,i=M.p,M.p=2,j.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{j.T=t,M.p=i}}lu&3&&Wu(),id(e),i=e.pendingLanes,n&261930&&i&42?e===mu?pu++:(pu=0,mu=e):pu=0,ad(0,!1)}}function Uu(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,ia(t)))}function Wu(){return Bu(),Vu(),Hu(),Y()}function Y(){if(ou!==5)return!1;var e=su,t=uu;uu=0;var n=at(lu),r=j.T,a=M.p;try{M.p=32>n?32:n,j.T=null,n=du,du=null;var o=su,s=lu;if(ou=0,cu=su=null,lu=0,Il&6)throw Error(i(331));var c=Il;if(Il|=4,jl(o.current),Cl(o,o.current,s,n),Il=c,ad(0,!1),N&&typeof N.onPostCommitFiberRoot==`function`)try{N.onPostCommitFiberRoot(Be,o)}catch{}return!0}finally{M.p=a,j.T=r,Uu(e,t)}}function Gu(e,t,n){t=_i(n,t),t=qs(e.stateNode,t,2),e=La(e,t,2),e!==null&&(et(e,2),id(e))}function Ku(e,t,n){if(e.tag===3)Gu(e,e,n);else for(;t!==null;){if(t.tag===3){Gu(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(au===null||!au.has(r))){e=_i(n,e),n=Js(2),r=La(t,n,2),r!==null&&(Ys(n,r,t,e),et(r,2),id(r));break}}t=t.return}}function qu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Fl;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Wl=!0,i.add(n),e=Ju.bind(null,e,t,n),t.then(e,e))}function Ju(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Ll===e&&(zl&n)===n&&(Kl===4||Kl===3&&(zl&62914560)===zl&&300>je()-tu?!(Il&2)&&wu(e,0):Yl|=n,Zl===zl&&(Zl=0)),id(e)}function Yu(e,t){t===0&&(t=Qe()),e=ni(e,t),e!==null&&(et(e,t),id(e))}function Xu(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Yu(e,n)}function Zu(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),Yu(e,n)}function Qu(e,t){return De(e,t)}var $u=null,ed=null,td=!1,nd=!1,rd=!1,X=0;function id(e){e!==ed&&e.next===null&&(ed===null?$u=ed=e:ed=ed.next=e),nd=!0,td||(td=!0,dd())}function ad(e,t){if(!rd&&nd){rd=!0;do for(var n=!1,r=$u;r!==null;){if(!t)if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-He(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,ud(r,a))}else a=zl,a=Xe(r,r===Ll?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Ze(r,a)||(n=!0,ud(r,a));r=r.next}while(n);rd=!1}}function od(){sd()}function sd(){nd=td=!1;var e=0;X!==0&&Kd()&&(e=X);for(var t=je(),n=null,r=$u;r!==null;){var i=r.next,a=cd(r,t);a===0?(r.next=null,n===null?$u=i:n.next=i,i===null&&(ed=n)):(n=r,(e!==0||a&3)&&(nd=!0)),r=i}ou!==0&&ou!==5||ad(e,!1),X!==0&&(X=0)}function cd(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-He(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=P(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Ll,n=zl,n=Xe(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Bl===2||Bl===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Oe(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Ze(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&Oe(r),at(n)){case 2:case 8:n=Pe;break;case 32:n=Fe;break;case 268435456:n=Le;break;default:n=Fe}return r=ld.bind(null,e),n=De(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&Oe(r),e.callbackPriority=2,e.callbackNode=null,2}function ld(e,t){if(ou!==0&&ou!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Wu()&&e.callbackNode!==n)return null;var r=zl;return r=Xe(e,e===Ll?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(vu(e,r,t),cd(e,je()),e.callbackNode!=null&&e.callbackNode===n?ld.bind(null,e):null)}function ud(e,t){if(Wu())return null;vu(e,t,!0)}function dd(){Xd(function(){Il&6?De(Ne,od):sd()})}function fd(){if(X===0){var e=sa;e===0&&(e=Ke,Ke<<=1,!(Ke&261888)&&(Ke=256)),X=e}return X}function pd(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:tn(``+e)}function md(e,t){var n=t.ownerDocument.createElement(`input`);return n.name=t.name,n.value=t.value,e.id&&n.setAttribute(`form`,e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function hd(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=pd((i[ut]||null).action),o=r.submitter;o&&(t=(t=o[ut]||null)?pd(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new wn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(X!==0){var e=o?md(i,o):new FormData(i);ys(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?md(i,o):new FormData(i),ys(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var gd=0;gd<qr.length;gd++){var _d=qr[gd];Jr(_d.toLowerCase(),`on`+(_d[0].toUpperCase()+_d.slice(1)))}Jr(zr,`onAnimationEnd`),Jr(Br,`onAnimationIteration`),Jr(Vr,`onAnimationStart`),Jr(`dblclick`,`onDoubleClick`),Jr(`focusin`,`onFocus`),Jr(`focusout`,`onBlur`),Jr(Hr,`onTransitionRun`),Jr(Ur,`onTransitionStart`),Jr(Wr,`onTransitionCancel`),Jr(Gr,`onTransitionEnd`),Et(`onMouseEnter`,[`mouseout`,`mouseover`]),Et(`onMouseLeave`,[`mouseout`,`mouseover`]),Et(`onPointerEnter`,[`pointerout`,`pointerover`]),Et(`onPointerLeave`,[`pointerout`,`pointerover`]),Tt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),Tt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),Tt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),Tt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),Tt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),Tt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var vd=`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(` `),yd=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(vd));function bd(e,t){t=(t&4)!=0;for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Yr(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Yr(e)}i.currentTarget=null,a=c}}}}function xd(e,t){var n=t[ft];n===void 0&&(n=t[ft]=new Set);var r=e+`__bubble`;n.has(r)||(Td(t,e,2,!1),n.add(r))}function Sd(e,t,n){var r=0;t&&(r|=4),Td(n,e,r,t)}var Cd=`_reactListening`+Math.random().toString(36).slice(2);function wd(e){if(!e[Cd]){e[Cd]=!0,Ct.forEach(function(t){t!==`selectionchange`&&(yd.has(t)||Sd(t,!1,e),Sd(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Cd]||(t[Cd]=!0,Sd(`selectionchange`,!1,t))}}function Td(e,t,n,r){switch(hp(t)){case 2:var i=lp;break;case 8:i=up;break;default:i=dp}n=i.bind(null,t,n,e),i=void 0,!pn||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function Ed(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var c=r.stateNode.containerInfo;if(c===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&s.stateNode.containerInfo===i)return;s=s.return}for(;c!==null;){if(s=vt(c),s===null)return;if(l=s.tag,l===5||l===6||l===26||l===27){r=a=s;continue a}c=c.parentNode}}r=r.return}un(function(){var r=a,i=an(n),s=[];a:{var c=Kr.get(e);if(c!==void 0){var l=wn,u=e;switch(e){case`keypress`:if(yn(n)===0)break a;case`keydown`:case`keyup`:l=Hn;break;case`focusin`:u=`focus`,l=Nn;break;case`focusout`:u=`blur`,l=Nn;break;case`beforeblur`:case`afterblur`:l=Nn;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=jn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=Mn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=Wn;break;case zr:case Br:case Vr:l=Pn;break;case Gr:l=Gn;break;case`scroll`:case`scrollend`:l=En;break;case`wheel`:l=Kn;break;case`copy`:case`cut`:case`paste`:l=Fn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=Un;break;case`toggle`:case`beforetoggle`:l=qn}var d=(t&4)!=0,f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=dn(m,p),g!=null&&d.push(Dd(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(c=e===`mouseover`||e===`pointerover`,l=e===`mouseout`||e===`pointerout`,c&&n!==rn&&(u=n.relatedTarget||n.fromElement)&&(vt(u)||u[dt]))break a;if((l||c)&&(c=i.window===i?i:(c=i.ownerDocument)?c.defaultView||c.parentWindow:window,l?(u=n.relatedTarget||n.toElement,l=r,u=u?vt(u):null,u!==null&&(f=o(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(l=null,u=r),l!==u)){if(d=jn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Un,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:bt(l),h=u==null?c:bt(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,vt(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,l&&u)b:{for(d=kd,p=l,m=u,h=0,g=p;g;g=d(g))h++;g=0;for(var _=m;_;_=d(_))g++;for(;0<h-g;)p=d(p),h--;for(;0<g-h;)m=d(m),g--;for(;h--;){if(p===m||m!==null&&p===m.alternate){d=p;break b}p=d(p),m=d(m)}d=null}else d=null;l!==null&&Ad(s,c,l,d,!1),u!==null&&f!==null&&Ad(s,f,u,d,!0)}}a:{if(c=r?bt(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=pr;else if(sr(c))if(mr)v=xr;else{v=yr;var y=vr}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&Qt(r.elementType)&&(v=pr):v=br;if(v&&=v(e,r)){cr(s,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&Wt(c,`number`,c.value)}switch(y=r?bt(r):window,e){case`focusin`:(sr(y)||y.contentEditable===`true`)&&(jr=y,Mr=r,Nr=null);break;case`focusout`:Nr=Mr=jr=null;break;case`mousedown`:Pr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Pr=!1,R(s,n,i);break;case`selectionchange`:if(Ar)break;case`keydown`:case`keyup`:R(s,n,i)}var b;if(Yn)b:{switch(e){case`compositionstart`:var x=`onCompositionStart`;break b;case`compositionend`:x=`onCompositionEnd`;break b;case`compositionupdate`:x=`onCompositionUpdate`;break b}x=void 0}else rr?tr(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Qn&&n.locale!==`ko`&&(rr||x!==`onCompositionStart`?x===`onCompositionEnd`&&rr&&(b=vn()):(hn=i,gn=`value`in hn?hn.value:hn.textContent,rr=!0)),y=Od(r,x),0<y.length&&(x=new In(x,e,null,n,i),s.push({event:x,listeners:y}),b?x.data=b:(b=nr(n),b!==null&&(x.data=b)))),(b=Zn?ir(e,n):ar(e,n))&&(x=Od(r,`onBeforeInput`),0<x.length&&(y=new In(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:y,listeners:x}),y.data=b)),hd(s,e,r,n,i)}bd(s,t)})}function Dd(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Od(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=dn(e,n),i!=null&&r.unshift(Dd(e,i,a)),i=dn(e,t),i!=null&&r.push(Dd(e,i,a))),e.tag===3)return r;e=e.return}return[]}function kd(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Ad(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=dn(n,a),l!=null&&o.unshift(Dd(n,l,c))):i||(l=dn(n,a),l!=null&&o.push(Dd(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var jd=/\r\n?/g,Md=/\u0000|\uFFFD/g;function Nd(e){return(typeof e==`string`?e:``+e).replace(jd,`
9`).replace(Md,``)}function Z(e,t){return t=Nd(t),Nd(e)===t}function Pd(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Jt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Jt(e,``+r);break;case`className`:Mt(e,`class`,r);break;case`tabIndex`:Mt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Mt(e,n,r);break;case`style`:Zt(e,r,o);break;case`data`:if(t!==`object`){Mt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=tn(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`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 o==`function`&&(n===`formAction`?(t!==`input`&&Pd(e,t,`name`,a.name,a,null),Pd(e,t,`formEncType`,a.formEncType,a,null),Pd(e,t,`formMethod`,a.formMethod,a,null),Pd(e,t,`formTarget`,a.formTarget,a,null)):(Pd(e,t,`encType`,a.encType,a,null),Pd(e,t,`method`,a.method,a,null),Pd(e,t,`target`,a.target,a,null)));if(r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=tn(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=nn);break;case`onScroll`:r!=null&&xd(`scroll`,e);break;case`onScrollEnd`:r!=null&&xd(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=tn(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);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`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:xd(`beforetoggle`,e),xd(`toggle`,e),jt(e,`popover`,r);break;case`xlinkActuate`:Nt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Nt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Nt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Nt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Nt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Nt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Nt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Nt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Nt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:jt(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=$t.get(n)||n,jt(e,n,r))}}function Fd(e,t,n,r,a,o){switch(n){case`style`:Zt(e,r,o);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?Jt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Jt(e,``+r);break;case`onScroll`:r!=null&&xd(`scroll`,e);break;case`onScrollEnd`:r!=null&&xd(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=nn);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!wt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),t=n.slice(2,a?n.length-7:void 0),o=e[ut]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,a),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,a);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):jt(e,n,r)}}}function Q(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:xd(`error`,e),xd(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Pd(e,t,o,s,n,null)}}a&&Pd(e,t,`srcSet`,n.srcSet,n,null),r&&Pd(e,t,`src`,n.src,n,null);return;case`input`:xd(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:Pd(e,t,r,d,n,null)}}Ut(e,o,c,l,u,s,a,!1);return;case`select`:for(a in xd(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:Pd(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Gt(e,!!r,n,!0):Gt(e,!!r,t,!1);return;case`textarea`:for(s in xd(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:Pd(e,t,s,c,n,null)}qt(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Pd(e,t,l,r,n,null)}return;case`dialog`:xd(`beforetoggle`,e),xd(`toggle`,e),xd(`cancel`,e),xd(`close`,e);break;case`iframe`:case`object`:xd(`load`,e);break;case`video`:case`audio`:for(r=0;r<vd.length;r++)xd(vd[r],e);break;case`image`:xd(`error`,e),xd(`load`,e);break;case`details`:xd(`toggle`,e);break;case`embed`:case`source`:case`link`:xd(`error`,e),xd(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Pd(e,t,u,r,n,null)}return;default:if(Qt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Fd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Pd(e,t,c,r,n,null))}function Id(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Pd(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:o=m;break;case`name`:a=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&Pd(e,t,p,m,r,f)}}Ht(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||Pd(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&Pd(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Gt(e,!!n,n?[]:``,!1):Gt(e,!!n,t,!0)):Gt(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Pd(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:p=a;break;case`defaultValue`:m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&Pd(e,t,s,a,r,o)}Kt(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Pd(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Pd(e,t,l,p,r,m)}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 g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Pd(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:Pd(e,t,u,p,r,m)}return;default:if(Qt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Fd(e,t,_,void 0,r,p);
vendor: 4,463 bytes, line 9
9for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||Fd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Pd(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Pd(e,t,f,p,r,m)}function Ld(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Rd(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Ld(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Ld(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var zd=null,Bd=null;function Vd(e){return e.nodeType===9?e:e.ownerDocument}function Hd(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function Ud(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function Wd(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Gd=null;function Kd(){var e=window.event;return e&&e.type===`popstate`?e===Gd?!1:(Gd=e,!0):(Gd=null,!1)}var qd=typeof setTimeout==`function`?setTimeout:void 0,Jd=typeof clearTimeout==`function`?clearTimeout:void 0,Yd=typeof Promise==`function`?Promise:void 0,Xd=typeof queueMicrotask==`function`?queueMicrotask:Yd===void 0?qd:function(e){return Yd.resolve(null).then(e).catch(Zd)};function Zd(e){setTimeout(function(){throw e})}function Qd(e){return e===`head`}function $d(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Pp(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)mf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,mf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[gt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&mf(e.ownerDocument.body);n=i}while(n);Pp(t)}function ef(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8)if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++;n=r}while(n)}function tf(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:tf(n),_t(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function nf(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r)if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e;else if(!e[gt])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=lf(e.nextSibling),e===null)break}return null}function rf(e,t,n){if(t===``)return null;for(;
vendor: 20,895 bytes, line 9
9e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=lf(e.nextSibling),e===null))return null;return e}function af(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=lf(e.nextSibling),e===null))return null;return e}function of(e){return e.data===`$?`||e.data===`$~`}function sf(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function cf(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function lf(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var uf=null;function df(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return lf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function ff(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function pf(e,t,n){switch(t=Vd(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function mf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);_t(e)}var hf=new Map,gf=new Set;function _f(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var vf=M.d;M.d={f:yf,r:bf,D:Cf,C:wf,L:Tf,m:Ef,X:Of,S:Df,M:kf};function yf(){var e=vf.f(),t=Su();return e||t}function bf(e){var t=yt(e);t!==null&&t.tag===5&&t.type===`form`?xs(t):vf.r(e)}var xf=typeof document>`u`?null:document;function Sf(e,t,n){var r=xf;if(r&&typeof t==`string`&&t){var i=Vt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),gf.has(i)||(gf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Q(t,`link`,e),St(t),r.head.appendChild(t)))}}function Cf(e){vf.D(e),Sf(`dns-prefetch`,e,null)}function wf(e,t){vf.C(e,t),Sf(`preconnect`,e,t)}function Tf(e,t,n){vf.L(e,t,n);var r=xf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Vt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Vt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Vt(n.imageSizes)+`"]`)):i+=`[href="`+Vt(e)+`"]`;var a=i;switch(t){case`style`:a=jf(e);break;case`script`:a=Ff(e)}hf.has(a)||(e=h({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),hf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Mf(a))||t===`script`&&r.querySelector(If(a))||(t=r.createElement(`link`),Q(t,`link`,e),St(t),r.head.appendChild(t)))}}function Ef(e,t){vf.m(e,t);var n=xf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Vt(r)+`"][href="`+Vt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Ff(e)}if(!hf.has(a)&&(e=h({rel:`modulepreload`,href:e},t),hf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(If(a)))return}r=n.createElement(`link`),Q(r,`link`,e),St(r),n.head.appendChild(r)}}}function Df(e,t,n){vf.S(e,t,n);var r=xf;if(r&&e){var i=xt(r).hoistableStyles,a=jf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Mf(a)))s.loading=5;else{e=h({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=hf.get(a))&&zf(e,n);var c=o=r.createElement(`link`);St(c),Q(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Rf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Of(e,t){vf.X(e,t);var n=xf;if(n&&e){var r=xt(n).hoistableScripts,i=Ff(e),a=r.get(i);a||(a=n.querySelector(If(i)),a||(e=h({src:e,async:!0},t),(t=hf.get(i))&&Bf(e,t),a=n.createElement(`script`),St(a),Q(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function kf(e,t){vf.M(e,t);var n=xf;if(n&&e){var r=xt(n).hoistableScripts,i=Ff(e),a=r.get(i);a||(a=n.querySelector(If(i)),a||(e=h({src:e,async:!0,type:`module`},t),(t=hf.get(i))&&Bf(e,t),a=n.createElement(`script`),St(a),Q(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Af(e,t,n,r){var a=(a=pe.current)?_f(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=jf(n.href),n=xt(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=jf(n.href);var o=xt(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Mf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),hf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},hf.set(e,n),o||Pf(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Ff(n),n=xt(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function jf(e){return`href="`+Vt(e)+`"`}function Mf(e){return`link[rel="stylesheet"][`+e+`]`}function Nf(e){return h({},e,{"data-precedence":e.precedence,precedence:null})}function Pf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Q(t,`link`,n),St(t),e.head.appendChild(t))}function Ff(e){return`[src="`+Vt(e)+`"]`}function If(e){return`script[async]`+e}function Lf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Vt(n.href)+`"]`);if(r)return t.instance=r,St(r),r;var a=h({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),St(r),Q(r,`style`,a),Rf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=jf(n.href);var o=e.querySelector(Mf(a));if(o)return t.state.loading|=4,t.instance=o,St(o),o;r=Nf(n),(a=hf.get(a))&&zf(r,a),o=(e.ownerDocument||e).createElement(`link`),St(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Q(o,`link`,r),t.state.loading|=4,Rf(o,n.precedence,e),t.instance=o;case`script`:return o=Ff(n.src),(a=e.querySelector(If(o)))?(t.instance=a,St(a),a):(r=n,(a=hf.get(o))&&(r=h({},n),Bf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),St(a),Q(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Rf(r,n.precedence,e));return t.instance}function Rf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function zf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Bf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Vf=null;function Hf(e,t,n){if(Vf===null){var r=new Map,i=Vf=new Map;i.set(n,r)}else i=Vf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[gt]||a[lt]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Uf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Wf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Gf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Kf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=jf(r.href),a=t.querySelector(Mf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Yf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,St(a);return}a=t.ownerDocument||t,r=Nf(r),(i=hf.get(i))&&zf(r,i),a=a.createElement(`link`),St(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Q(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Yf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var qf=0;function Jf(e,t){return e.stylesheets&&e.count===0&&Zf(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&Zf(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&qf===0&&(qf=62500*Rd());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Zf(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>qf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Yf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Zf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Xf=null;function Zf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Xf=new Map,t.forEach(Qf,e),Xf=null,Yf.call(e))}function Qf(e,t){if(!(t.state.loading&4)){var n=Xf.get(e);if(n)var r=n.get(null);else{n=new Map,Xf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=Yf.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var $f={$$typeof:C,Provider:null,Consumer:null,_currentValue:ae,_currentValue2:ae,_threadCount:0};function ep(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,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=$e(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=$e(0),this.hiddenUpdates=$e(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function tp(e,t,n,r,i,a,o,s,c,l,u,d){return e=new ep(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=si(3,null,null,t),e.current=a,a.stateNode=e,t=ra(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Pa(a),e}function np(e){return e?(e=ai,e):ai}function rp(e,t,n,r,i,a){i=np(i),r.context===null?r.context=i:r.pendingContext=i,r=Ia(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=La(e,r,t),n!==null&&(_u(n,e,t),Ra(n,e,t))}function ip(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ap(e,t){ip(e,t),(e=e.alternate)&&ip(e,t)}function op(e){if(e.tag===13||e.tag===31){var t=ni(e,67108864);t!==null&&_u(t,e,67108864),ap(e,67108864)}}function sp(e){if(e.tag===13||e.tag===31){var t=hu();t=it(t);var n=ni(e,t);n!==null&&_u(n,e,t),ap(e,t)}}var cp=!0;function lp(e,t,n,r){var i=j.T;j.T=null;var a=M.p;try{M.p=2,dp(e,t,n,r)}finally{M.p=a,j.T=i}}function up(e,t,n,r){var i=j.T;j.T=null;var a=M.p;try{M.p=8,dp(e,t,n,r)}finally{M.p=a,j.T=i}}function dp(e,t,n,r){if(cp){var i=fp(r);if(i===null)Ed(e,t,r,pp,n),wp(e,r);else if(Ep(i,e,t,n,r))r.stopPropagation();else if(wp(e,r),t&4&&-1<Cp.indexOf(e)){for(;i!==null;){var a=yt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Ye(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-He(o);s.entanglements[1]|=c,o&=~c}id(a),!(Il&6)&&(ru=je()+500,ad(0,!1))}}break;case 31:case 13:s=ni(a,2),s!==null&&_u(s,a,2),Su(),ap(a,2)}if(a=fp(r),a===null&&Ed(e,t,r,pp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Ed(e,t,r,null,n)}}function fp(e){return e=an(e),mp(e)}var pp=null;function mp(e){if(pp=null,e=vt(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return pp=e,null}function hp(e){switch(e){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(Me()){case Ne:return 2;case Pe:return 8;case Fe:case Ie:return 32;case Le:return 268435456;default:return 32}default:return 32}}var gp=!1,_p=null,vp=null,yp=null,bp=new Map,xp=new Map,Sp=[],Cp=`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 wp(e,t){switch(e){case`focusin`:case`focusout`:_p=null;break;case`dragenter`:case`dragleave`:vp=null;break;case`mouseover`:case`mouseout`:yp=null;break;case`pointerover`:case`pointerout`:bp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:xp.delete(t.pointerId)}}function Tp(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=yt(t),t!==null&&op(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Ep(e,t,n,r,i){switch(t){case`focusin`:return _p=Tp(_p,e,t,n,r,i),!0;case`dragenter`:return vp=Tp(vp,e,t,n,r,i),!0;case`mouseover`:return yp=Tp(yp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return bp.set(a,Tp(bp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,xp.set(a,Tp(xp.get(a)||null,e,t,n,r,i)),!0}return!1}function Dp(e){var t=vt(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,st(e.priority,function(){sp(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,st(e.priority,function(){sp(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Op(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=fp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);rn=r,n.target.dispatchEvent(r),rn=null}else return t=yt(n),t!==null&&op(t),e.blockedOn=n,!1;t.shift()}return!0}function kp(e,t,n){Op(e)&&n.delete(t)}function Ap(){gp=!1,_p!==null&&Op(_p)&&(_p=null),vp!==null&&Op(vp)&&(vp=null),yp!==null&&Op(yp)&&(yp=null),bp.forEach(kp),xp.forEach(kp)}function jp(e,n){e.blockedOn===n&&(e.blockedOn=null,gp||(gp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Ap)))}var Mp=null;function Np(e){Mp!==e&&(Mp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Mp===e&&(Mp=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(mp(r||n)===null)continue;break}var a=yt(n);a!==null&&(e.splice(t,3),t-=3,ys(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Pp(e){function t(t){return jp(t,e)}_p!==null&&jp(_p,e),vp!==null&&jp(vp,e),yp!==null&&jp(yp,e),bp.forEach(t),xp.forEach(t);for(var n=0;n<Sp.length;n++){var r=Sp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Sp.length&&(n=Sp[0],n.blockedOn===null);)Dp(n),n.blockedOn===null&&Sp.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[ut]||null;if(typeof a==`function`)o||Np(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[ut]||null)s=o.formAction;else if(mp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Np(n)}}}function Fp(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Ip(e){this._internalRoot=e}Lp.prototype.render=Ip.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;rp(n,hu(),e,t,null,null)},Lp.prototype.unmount=Ip.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;rp(e.current,2,null,e,null,null),Su(),t[dt]=null}};function Lp(e){this._internalRoot=e}Lp.prototype.unstable_scheduleHydration=function(e){if(e){var t=ot();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Sp.length&&t!==0&&t<Sp[n].priority;n++);Sp.splice(n,0,e),n===0&&Dp(e)}};var Rp=n.version;if(Rp!==`19.2.7`)throw Error(i(527,Rp,`19.2.7`));M.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=d(t),e=e===null?null:p(e),e=e===null?null:e.stateNode,e};var zp={bundleType:0,version:`19.2.7`,rendererPackageName:`react-dom`,currentDispatcherRef:j,reconcilerVersion:`19.2.7`};
9if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Bp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Bp.isDisabled&&Bp.supportsFiber)try{Be=Bp.inject(zp),N=Bp}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Hs,s=Us,c=Ws;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=tp(e,1,!1,null,null,n,r,null,o,s,c,Fp),e[dt]=t.current,wd(e),new Ip(t)}})),g=o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=h()})),_=c(u(),1),v=g(),y=c(o(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self,n.maplibregl=r())})(e,(function(){var e={},t={};function n(n,r,i){if(t[n]=i,n===`index`){var a=`var sharedModule = {}; (`+t.shared+`)(sharedModule); (`+t.worker+`)(sharedModule);`,o={};return t.shared(o),t.index(e,o),typeof window<`u`&&e.setWorkerUrl(window.URL.createObjectURL(new Blob([a],{type:`text/javascript`}))),e}}return n(`shared`,[`exports`],(function(e){function t(e,t,n,r){return new(n||=Promise)((function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}c((r=r.apply(e,t||[])).next())}))}function n(e,t){this.x=e,this.y=t}function r(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var i,a;n.prototype={clone(){return new n(this.x,this.y)},add(e){return this.clone()._add(e)},sub(e){return this.clone()._sub(e)},multByPoint(e){return this.clone()._multByPoint(e)},divByPoint(e){return this.clone()._divByPoint(e)},mult(e){return this.clone()._mult(e)},div(e){return this.clone()._div(e)},rotate(e){return this.clone()._rotate(e)},rotateAround(e,t){return this.clone()._rotateAround(e,t)},matMult(e){return this.clone()._matMult(e)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(e){return this.x===e.x&&this.y===e.y},dist(e){return Math.sqrt(this.distSqr(e))},distSqr(e){let t=e.x-this.x,n=e.y-this.y;return t*t+n*n},angle(){return Math.atan2(this.y,this.x)},angleTo(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith(e){return this.angleWithSep(e.x,e.y)},angleWithSep(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult(e){let t=e[2]*this.x+e[3]*this.y;return this.x=e[0]*this.x+e[1]*this.y,this.y=t,this},_add(e){return this.x+=e.x,this.y+=e.y,this},_sub(e){return this.x-=e.x,this.y-=e.y,this},_mult(e){return this.x*=e,this.y*=e,this},_div(e){return this.x/=e,this.y/=e,this},_multByPoint(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint(e){return this.x/=e.x,this.y/=e.y,this},_unit(){return this._div(this.mag()),this},_perp(){let e=this.y;return this.y=this.x,this.x=-e,this},_rotate(e){let t=Math.cos(e),n=Math.sin(e),r=n*this.x+t*this.y;return this.x=t*this.x-n*this.y,this.y=r,this},_rotateAround(e,t){let n=Math.cos(e),r=Math.sin(e),i=t.y+r*(this.x-t.x)+n*(this.y-t.y);return this.x=t.x+n*(this.x-t.x)-r*(this.y-t.y),this.y=i,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:n},n.convert=function(e){if(e instanceof n)return e;if(Array.isArray(e))return new n(+e[0],+e[1]);if(e.x!==void 0&&e.y!==void 0)return new n(+e.x,+e.y);throw Error(`Expected [x, y] or {x, y} point format`)};var o=r(function(){if(a)return i;function e(e,t,n,r){this.cx=3*e,this.bx=3*(n-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(r-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=n,this.p2y=r}return a=1,i=e,e.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,t){if(t===void 0&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var n=e,r=0;r<8;r++){var i=this.sampleCurveX(n)-e;if(Math.abs(i)<t)return n;var a=this.sampleCurveDerivativeX(n);
vendor: 9,762 bytes, line 9
9if(Math.abs(a)<1e-6)break;n-=i/a}var o=0,s=1;for(n=e,r=0;r<20&&(i=this.sampleCurveX(n),!(Math.abs(i-e)<t));r++)e>i?o=n:s=n,n=.5*(s-o)+o;return n},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},i}());let s,c;function l(){return s??=typeof OffscreenCanvas<`u`&&new OffscreenCanvas(1,1).getContext(`2d`)&&typeof createImageBitmap==`function`,s}function u(){if(c==null&&(c=!1,l())){let e=new OffscreenCanvas(5,5).getContext(`2d`,{willReadFrequently:!0});if(e){for(let t=0;t<25;t++){let n=4*t;e.fillStyle=`rgb(${n},${n+1},${n+2})`,e.fillRect(t%5,Math.floor(t/5),1,1)}let t=e.getImageData(0,0,5,5).data;for(let e=0;e<100;e++)if(e%4!=3&&t[e]!==e){c=!0;break}}}return c||!1}var d=1e-6,f=typeof Float32Array<`u`?Float32Array:Array;function p(){var e=new f(9);return f!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function m(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function h(){var e=new f(3);return f!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function g(e){var t=e[0],n=e[1],r=e[2];return Math.sqrt(t*t+n*n+r*r)}function _(e,t,n){var r=new f(3);return r[0]=e,r[1]=t,r[2]=n,r}function v(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e}function y(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e}function b(e,t,n){var r=t[0],i=t[1],a=t[2],o=n[0],s=n[1],c=n[2];return e[0]=i*c-a*s,e[1]=a*o-r*c,e[2]=r*s-i*o,e}var x,S=g;function C(e,t,n){var r=t[0],i=t[1],a=t[2],o=t[3];return e[0]=n[0]*r+n[4]*i+n[8]*a+n[12]*o,e[1]=n[1]*r+n[5]*i+n[9]*a+n[13]*o,e[2]=n[2]*r+n[6]*i+n[10]*a+n[14]*o,e[3]=n[3]*r+n[7]*i+n[11]*a+n[15]*o,e}function w(){var e=new f(4);return f!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function T(e,t,n,r){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:`zyx`,a=Math.PI/360;t*=a,r*=a,n*=a;var o=Math.sin(t),s=Math.cos(t),c=Math.sin(n),l=Math.cos(n),u=Math.sin(r),d=Math.cos(r);switch(i){case`xyz`:e[0]=o*l*d+s*c*u,e[1]=s*c*d-o*l*u,e[2]=s*l*u+o*c*d,e[3]=s*l*d-o*c*u;break;case`xzy`:e[0]=o*l*d-s*c*u,e[1]=s*c*d-o*l*u,e[2]=s*l*u+o*c*d,e[3]=s*l*d+o*c*u;break;case`yxz`:e[0]=o*l*d+s*c*u,e[1]=s*c*d-o*l*u,e[2]=s*l*u-o*c*d,e[3]=s*l*d+o*c*u;break;case`yzx`:e[0]=o*l*d+s*c*u,e[1]=s*c*d+o*l*u,e[2]=s*l*u-o*c*d,e[3]=s*l*d-o*c*u;break;case`zxy`:e[0]=o*l*d-s*c*u,e[1]=s*c*d+o*l*u,e[2]=s*l*u+o*c*d,e[3]=s*l*d-o*c*u;break;case`zyx`:e[0]=o*l*d-s*c*u,e[1]=s*c*d+o*l*u,e[2]=s*l*u-o*c*d,e[3]=s*l*d+o*c*u;break;default:throw Error(`Unknown angle order `+i)}return e}function E(){var e=new f(2);return f!=Float32Array&&(e[0]=0,e[1]=0),e}function D(e,t){var n=new f(2);return n[0]=e,n[1]=t,n}h(),x=new f(4),f!=Float32Array&&(x[0]=0,x[1]=0,x[2]=0,x[3]=0),h(),_(1,0,0),_(0,1,0),w(),w(),p(),E();let O=8192;function k(e,t,n){return t*(O/(e.tileSize*2**(n-e.tileID.overscaledZ)))}function A(e){return e instanceof Error?e:Error(typeof e==`string`?e:String(e))}function ee(e,t){return(e%t+t)%t}function te(e,t,n){return e*(1-n)+t*n}function ne(e){if(e<=0)return 0;if(e>=1)return 1;let t=e*e,n=t*e;return 4*(e<.5?n:3*(e-t)+n-.75)}function re(e,t,n,r){let i=new o(e,t,n,r);return e=>i.solve(e)}let ie=re(.25,.1,.25,1);function j(e,t,n){return Math.min(n,Math.max(t,e))}function M(e,t,n){let r=n-t,i=((e-t)%r+r)%r+t;return i===t?n:i}function ae(e,...t){for(let n of t)for(let t in n)e[t]=n[t];return e}let oe=1;function se(e,t,n){let r={};for(let n in e)r[n]=t.call(this,e[n],n,e);return r}function ce(e,t,n){let r={};for(let n in e)t.call(this,e[n],n,e)&&(r[n]=e[n]);return r}function le(e){return Array.isArray(e)?e.map(le):typeof e==`object`&&e?se(e,le):e}let ue={};function de(e){ue[e]||(typeof console<`u`&&console.warn(e),ue[e]=!0)}function fe(e,t,n){return(n.y-e.y)*(t.x-e.x)>(t.y-e.y)*(n.x-e.x)}function pe(e){return typeof WorkerGlobalScope<`u`&&e!==void 0&&e instanceof WorkerGlobalScope}let me=null;function he(e){return typeof ImageBitmap<`u`&&e instanceof ImageBitmap}let ge=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=`;function _e(e,n,r,i,a){return t(this,void 0,void 0,(function*(){if(typeof VideoFrame>`u`)throw Error(`VideoFrame not supported`);let t=new VideoFrame(e,{timestamp:0});try{let o=t?.format;if(!o||!o.startsWith(`BGR`)&&!o.startsWith(`RGB`))throw Error(`Unrecognized format ${o}`);let s=o.startsWith(`BGR`),c=new Uint8ClampedArray(i*a*4);if(yield t.copyTo(c,function(e,t,n,r,i){let a=4*Math.max(-t,0),o=(Math.max(0,n)-n)*r*4+a,s=4*r,c=Math.max(0,t),l=Math.max(0,n);return{rect:{x:c,y:l,width:Math.min(e.width,t+r)-c,height:Math.min(e.height,n+i)-l},layout:[{offset:o,stride:s}]}}(e,n,r,i,a)),s)for(let e=0;e<c.length;e+=4){let t=c[e];c[e]=c[e+2],c[e+2]=t}return c}finally{t.close()}}))}let ve,ye;function be(e,t,n,r){return e.addEventListener(t,n,r),{unsubscribe:()=>{e.removeEventListener(t,n,r)}}}function xe(e){return e*Math.PI/180}function Se(e){return e/Math.PI*180}let Ce={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},we={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0},Te=`AbortError`;class Ee extends Error{constructor(e=Te){super(e instanceof Error?e.message:e),this.name=Te,e instanceof Error&&e.stack&&(this.stack=e.stack)}}function De(e){return e instanceof Error&&e.name===Te}function Oe(e){if(e.aborted)throw new Ee(e.reason)}let ke={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:``};function Ae(e){return ke.REGISTERED_PROTOCOLS[e.substring(0,e.indexOf(`://`))]}let je=`global-dispatcher`;class Me extends Error{constructor(e,t,n,r){super(`AJAXError: ${t} (${e}): ${n}`),this.status=e,this.statusText=t,this.url=n,this.body=r}}let Ne=()=>pe(self)?self.worker?.referrer:(window.location.protocol===`blob:`?window.parent:window).location.href,Pe=function(e,n){return t(this,void 0,void 0,(function*(){if(e.url.includes(`://`)&&!/^https?:|^file:/.test(e.url)){let t=Ae(e.url);if(t){let r=yield t(e,n);return r.data||e.type!==`arrayBuffer`?r:ae(r,{data:new ArrayBuffer(0)})}if(pe(self)&&self.worker?.actor)return self.worker.actor.sendAsync({type:`GR`,data:e,targetMapId:je},n)}if(!(e=>e.startsWith(`file:`)||Ne()?.startsWith(`file:`)&&!/^\w+:/.test(e))(e.url)){if(fetch&&Request&&AbortController&&Object.hasOwn(Request.prototype,`signal`))return function(e,n){return t(this,void 0,void 0,(function*(){let t=new Request(e.url,{method:e.method||`GET`,body:e.body,credentials:e.credentials,headers:e.headers,cache:e.cache,referrer:Ne(),referrerPolicy:e.referrerPolicy,signal:n.signal}),r,i;e.type!==`json`||t.headers.has(`Accept`)||t.headers.set(`Accept`,`application/json`);try{r=yield fetch(t)}catch(t){throw De(t)?t:new Me(0,A(t).message,e.url,new Blob)}if(!r.ok){let t=yield r.blob();throw new Me(r.status,r.statusText,e.url,t)}i=e.type===`arrayBuffer`||e.type===`image`?r.arrayBuffer():e.type===`json`?r.json():r.text();let a=yield i;return Oe(n.signal),{data:a,cacheControl:r.headers.get(`Cache-Control`),expires:r.headers.get(`Expires`),etag:r.headers.get(`ETag`)}}))}(e,n);if(pe(self)&&self.worker?.actor)return self.worker.actor.sendAsync({type:`GR`,data:e,mustQueue:!0,targetMapId:je},n)}return function(e,t){return new Promise(((n,r)=>{var i;let a=new XMLHttpRequest;a.open(e.method||`GET`,e.url,!0),e.type!==`arrayBuffer`&&e.type!==`image`||(a.responseType=`arraybuffer`);for(let t in e.headers)a.setRequestHeader(t,e.headers[t]);e.type===`json`&&(a.responseType=`text`,(i=e.headers)!=null&&i.Accept||a.setRequestHeader(`Accept`,`application/json`)),a.withCredentials=e.credentials===`include`,a.onerror=()=>{r(Error(a.statusText))},a.onload=()=>{if(!t.signal.aborted)if((a.status>=200&&a.status<300||a.status===0)&&a.response!==null){let t=a.response;if(e.type===`json`)try{t=JSON.parse(a.response)}catch(e){r(e);return}n({data:t,cacheControl:a.getResponseHeader(`Cache-Control`),expires:a.getResponseHeader(`Expires`),etag:a.getResponseHeader(`ETag`)})}else{let t=new Blob([a.response],{type:a.getResponseHeader(`Content-Type`)});r(new Me(a.status,a.statusText,e.url,t))}},t.signal.addEventListener(`abort`,(()=>{a.abort(),r(new Ee(t.signal.reason))})),a.send(e.body)}))}(e,n)}))};function Fe(e){if(!e||e.indexOf(`://`)<=0||e.startsWith(`data:image/`)||e.startsWith(`blob:`))return!0;let t=new URL(e),n=window.location;return t.protocol===n.protocol&&t.host===n.host}function Ie(e,t,n){var r;(r=n[e])!=null&&r.includes(t)||(n[e]||(n[e]=[]),n[e].push(t))}function Le(e,t,n){if(n?.[e]){let r=n[e].indexOf(t);r!==-1&&n[e].splice(r,1)}}class Re{constructor(e,t={}){ae(this,t),this.type=e}}class ze extends Re{constructor(e,t={}){super(`error`,ae({error:e},t))}}class Be{on(e,t){return this._listeners||={},Ie(e,t,this._listeners),{unsubscribe:()=>{this.off(e,t)}}}off(e,t){return Le(e,t,this._listeners),Le(e,t,this._oneTimeListeners),this}once(e,t){return t?(this._oneTimeListeners||={},Ie(e,t,this._oneTimeListeners),this):new Promise((t=>this.once(e,t)))}fire(e,t){typeof e==`string`&&(e=new Re(e,t||{}));let n=e.type;if(this.listens(n)){e.target=this;let t=this._listeners?.[n]?this._listeners[n].slice():[];for(let n of t)n.call(this,e);let r=this._oneTimeListeners?.[n]?this._oneTimeListeners[n].slice():[];for(let t of r)Le(n,t,this._oneTimeListeners),t.call(this,e);let i=this._eventedParent;i&&(ae(e,typeof this._eventedParentData==`function`?this._eventedParentData():this._eventedParentData),i.fire(e))}else e instanceof ze&&console.error(e.error);return this}listens(e){return this._listeners?.[e]?.length>0||this._oneTimeListeners?.[e]?.length>0||this._eventedParent?.listens(e)}setEventedParent(e,t){return this._eventedParent=e,this._eventedParentData=t,this}}var N
vendor: 33,953 bytes, line 9
9={$version:8,$root:{version:{required:!0,type:`enum`,values:[8]},name:{type:`string`},metadata:{type:`*`},center:{type:`array`,value:`number`,length:2},centerAltitude:{type:`number`},zoom:{type:`number`},bearing:{type:`number`,default:0,period:360,units:`degrees`},pitch:{type:`number`,default:0,units:`degrees`},roll:{type:`number`,default:0,units:`degrees`},state:{type:`state`,default:{}},light:{type:`light`},sky:{type:`sky`},projection:{type:`projection`},terrain:{type:`terrain`},sources:{required:!0,type:`sources`},sprite:{type:`sprite`},glyphs:{type:`string`},"font-faces":{type:`fontFaces`},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},encoding:{type:`enum`,values:{mvt:{},mlt:{}},default:`mvt`},"*":{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:`filter`},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:{},"color-relief":{},background:{}},required:!0},metadata:{type:`*`},source:{type:`string`},"source-layer":{type:`string`},minzoom:{type:`number`,minimum:0,maximum:24},maxzoom:{type:`number`,minimum:0,maximum:24},filter:{type:`filter`},layout:{type:`layout`},paint:{type:`paint`}},layout:[`layout_fill`,`layout_line`,`layout_circle`,`layout_heatmap`,`layout_fill-extrusion`,`layout_symbol`,`layout_raster`,`layout_hillshade`,`layout_color-relief`,`layout_background`],layout_background:{visibility:{type:`enum`,values:{visible:{},none:{}},default:`visible`,expression:{interpolated:!1,parameters:[`global-state`]},"property-type":`data-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`,expression:{interpolated:!1,parameters:[`global-state`]},"property-type":`data-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`,expression:{interpolated:!1,parameters:[`global-state`]},"property-type":`data-constant`}},layout_heatmap:{visibility:{type:`enum`,values:{visible:{},none:{}},default:`visible`,expression:{interpolated:!1,parameters:[`global-state`]},"property-type":`data-constant`}},"layout_fill-extrusion":{visibility:{type:`enum`,values:{visible:{},none:{}},default:`visible`,expression:{interpolated:!1,parameters:[`global-state`]},"property-type":`data-constant`}},layout_line:{"line-cap":{type:`enum`,values:{butt:{},round:{},square:{}},default:`butt`,expression:{interpolated:!1,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},"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`,`feature`]},"property-type":`data-driven`},"line-round-limit":{type:`number`,default:1.05,requires:[{"line-join":`round`}],expression:{interpolated:!0,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},"line-sort-key":{type:`number`,expression:{interpolated:!1,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},visibility:{type:`enum`,values:{visible:{},none:{}},default:`visible`,expression:{interpolated:!1,parameters:[`global-state`]},"property-type":`data-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`},"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`,expression:{interpolated:!1,parameters:[`global-state`]},"property-type":`data-constant`}},layout_raster:{visibility:{type:`enum`,values:{visible:{},none:{}},default:`visible`,expression:{interpolated:!1,parameters:[`global-state`]},"property-type":`data-constant`}},layout_hillshade:{visibility:{type:`enum`,values:{visible:{},none:{}},default:`visible`,expression:{interpolated:!1,parameters:[`global-state`]},"property-type":`data-constant`}},"layout_color-relief":{visibility:{type:`enum`,values:{visible:{},none:{}},default:`visible`,expression:{interpolated:!1,parameters:[`global-state`]},"property-type":`data-constant`}},filter:{type:`boolean`,expression:{interpolated:!1,parameters:[`zoom`,`feature`]},"property-type":`data-driven`},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:`expression_name`,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:`projectionDefinition`,default:`mercator`,"property-type":`data-constant`,transition:!1,expression:{interpolated:!0,parameters:[`zoom`]}}},paint:[`paint_fill`,`paint_line`,`paint_circle`,`paint_heatmap`,`paint_fill-extrusion`,`paint_symbol`,`paint_raster`,`paint_hillshade`,`paint_color-relief`,`paint_background`],paint_fill:{"fill-antialias":{type:`boolean`,default:!0,expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"fill-opacity":{type:`number`,default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"fill-color":{type:`color`,default:`#000000`,transition:!0,requires:[{"!":`fill-pattern`}],expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"fill-outline-color":{type:`color`,transition:!0,requires:[{"!":`fill-pattern`},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"fill-translate":{type:`array`,value:`number`,length:2,default:[0,0],transition:!0,units:`pixels`,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"fill-translate-anchor":{type:`enum`,values:{map:{},viewport:{}},default:`map`,requires:[`fill-translate`],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"fill-pattern":{type:`resolvedImage`,transition:!0,expression:{interpolated:!1,parameters:[`zoom`,`feature`]},"property-type":`cross-faded-data-driven`}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:`number`,default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"fill-extrusion-color":{type:`color`,default:`#000000`,transition:!0,requires:[{"!":`fill-extrusion-pattern`}],expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"fill-extrusion-translate":{type:`array`,value:`number`,length:2,default:[0,0],transition:!0,units:`pixels`,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"fill-extrusion-translate-anchor":{type:`enum`,values:{map:{},viewport:{}},default:`map`,requires:[`fill-extrusion-translate`],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"fill-extrusion-pattern":{type:`resolvedImage`,transition:!0,expression:{interpolated:!1,parameters:[`zoom`,`feature`]},"property-type":`cross-faded-data-driven`},"fill-extrusion-height":{type:`number`,default:0,minimum:0,units:`meters`,transition:!0,expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"fill-extrusion-base":{type:`number`,default:0,minimum:0,units:`meters`,transition:!0,requires:[`fill-extrusion-height`],expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"fill-extrusion-vertical-gradient":{type:`boolean`,default:!0,transition:!1,expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`}},paint_line:{"line-opacity":{type:`number`,default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"line-color":{type:`color`,default:`#000000`,transition:!0,requires:[{"!":`line-pattern`}],expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"line-translate":{type:`array`,value:`number`,length:2,default:[0,0],transition:!0,units:`pixels`,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"line-translate-anchor":{type:`enum`,values:{map:{},viewport:{}},default:`map`,requires:[`line-translate`],expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},"line-width":{type:`number`,default:1,minimum:0,transition:!0,units:`pixels`,expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"line-gap-width":{type:`number`,default:0,minimum:0,transition:!0,units:`pixels`,expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"line-offset":{type:`number`,default:0,transition:!0,units:`pixels`,expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"line-blur":{type:`number`,default:0,minimum:0,transition:!0,units:`pixels`,expression:{interpolated:!0,parameters:[`zoom`,`feature`,`feature-state`]},"property-type":`data-driven`},"line-dasharray":{type:`array`,value:`number`,minimum:0,transition:!0,units:`line widths`,requires:[{"!":`line-pattern`}],expression:{interpolated:!1,parameters:[`zoom`,`feature`]},"property-type":`cross-faded-data-driven`},"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`},resampling:{type:`enum`,values:{linear:{},nearest:{}},default:`linear`,expression:{interpolated:!1,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:`numberArray`,default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"hillshade-illumination-altitude":{type:`numberArray`,default:45,minimum:0,maximum:90,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:`colorArray`,default:`#000000`,transition:!0,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"hillshade-highlight-color":{type:`colorArray`,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`},"hillshade-method":{type:`enum`,values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:`standard`,expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`},resampling:{type:`enum`,values:{linear:{},nearest:{}},default:`linear`,expression:{interpolated:!1,parameters:[`zoom`]},"property-type":`data-constant`}},"paint_color-relief":{"color-relief-opacity":{type:`number`,default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[`zoom`]},"property-type":`data-constant`},"color-relief-color":{type:`color`,transition:!1,expression:{interpolated:!0,parameters:[`elevation`]},"property-type":`color-ramp`},resampling:{type:`enum`,values:{linear:{},nearest:{}},default:`linear`,expression:{interpolated:!1,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`}},interpolation:{type:`array`,value:`interpolation_name`,minimum:1},interpolation_name:{type:`enum`,values:{linear:{syntax:{overloads:[{parameters:[],"output-type":`interpolation`}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:[`base`],"output-type":`interpolation`}],parameters:[{name:`base`,type:`number literal`}]}},"cubic-bezier":{syntax:{overloads:[{parameters:[`x1`,`y1`,`x2`,`y2`],"output-type":`interpolation`}],parameters:[{name:`x1`,type:`number literal`},{name:`y1`,type:`number literal`},{name:`x2`,type:`number literal`},{name:`y2`,type:`number literal`}]}}}}};let 
vendor: 22,264 bytes, line 9
9Ve=[`type`,`source`,`source-layer`,`minzoom`,`maxzoom`,`filter`,`layout`];function He(e,t){let n={};for(let t in e)t!==`ref`&&(n[t]=e[t]);return Ve.forEach((e=>{e in t&&(n[e]=t[e])})),n}function Ue(e,t){if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Ue(e[n],t[n]))return!1;return!0}if(typeof e==`object`&&e&&t!==null){if(typeof t!=`object`||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(!Ue(e[n],t[n]))return!1;return!0}return e===t}function We(e,t){e.push(t)}function Ge(e,t,n){We(n,{command:`addSource`,args:[e,t[e]]})}function Ke(e,t,n){We(t,{command:`removeSource`,args:[e]}),n[e]=!0}function qe(e,t,n,r){Ke(e,n,r),Ge(e,t,n)}function Je(e,t,n){let r;for(r in e[n])if(Object.prototype.hasOwnProperty.call(e[n],r)&&r!==`data`&&!Ue(e[n][r],t[n][r]))return!1;for(r in t[n])if(Object.prototype.hasOwnProperty.call(t[n],r)&&r!==`data`&&!Ue(e[n][r],t[n][r]))return!1;return!0}function Ye(e,t,n,r,i,a){e||={},t||={};for(let o in e)Object.prototype.hasOwnProperty.call(e,o)&&(Ue(e[o],t[o])||n.push({command:a,args:[r,o,t[o],i]}));for(let o in t)Object.prototype.hasOwnProperty.call(t,o)&&!Object.prototype.hasOwnProperty.call(e,o)&&(Ue(e[o],t[o])||n.push({command:a,args:[r,o,t[o],i]}))}function Xe(e){return e.id}function Ze(e,t){return e[t.id]=t,e}class P{constructor(e,t,n,r){this.message=(e?`${e}: `:``)+n,r&&(this.identifier=r),t!=null&&t.__line__&&(this.line=t.__line__)}}function Qe(e,...t){for(let n of t)for(let t in n)e[t]=n[t];return e}class $e extends Error{constructor(e,t){super(t),this.message=t,this.key=e}}class et{constructor(e,t=[]){this.parent=e,this.bindings={};for(let[e,n]of t)this.bindings[e]=n}concat(e){return new et(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}let tt={kind:`null`},F={kind:`number`},nt={kind:`string`},rt={kind:`boolean`},it={kind:`color`},at={kind:`projectionDefinition`},ot={kind:`object`},st={kind:`value`},ct={kind:`collator`},lt={kind:`formatted`},ut={kind:`padding`},dt={kind:`colorArray`},ft={kind:`numberArray`},pt={kind:`resolvedImage`},mt={kind:`variableAnchorOffsetCollection`};function ht(e,t){return{kind:`array`,itemType:e,N:t}}function gt(e){if(e.kind===`array`){let t=gt(e.itemType);return typeof e.N==`number`?`array<${t}, ${e.N}>`:e.itemType.kind===`value`?`array`:`array<${t}>`}return e.kind}let _t=[tt,F,nt,rt,it,at,lt,ot,ht(st),ut,ft,dt,pt,mt];function vt(e,t){if(t.kind===`error`)return null;if(e.kind===`array`){if(t.kind===`array`&&(t.N===0&&t.itemType.kind===`value`||!vt(e.itemType,t.itemType))&&(typeof e.N!=`number`||e.N===t.N))return null}else{if(e.kind===t.kind)return null;if(e.kind===`value`){for(let e of _t)if(!vt(e,t))return null}}return`Expected ${gt(e)} but found ${gt(t)} instead.`}function yt(e,t){return t.some((t=>t.kind===e.kind))}function bt(e,t){return t.some((t=>t===`null`?e===null:t===`array`?Array.isArray(e):t===`object`?e&&!Array.isArray(e)&&typeof e==`object`:t===typeof e))}function xt(e,t){return e.kind===`array`&&t.kind===`array`?e.itemType.kind===t.itemType.kind&&typeof e.N==`number`:e.kind===t.kind}let St=.96422,Ct=.82521,wt=4/29,Tt=6/29,Et=3*Tt*Tt,Dt=Math.PI/180,Ot=180/Math.PI;function kt(e){return(e%=360)<0&&(e+=360),e}function At([e,t,n,r]){let i,a,o=Mt((.2225045*(e=jt(e))+.7168786*(t=jt(t))+.0606169*(n=jt(n)))/1);e===t&&t===n?i=a=o:(i=Mt((.4360747*e+.3850649*t+.1430804*n)/St),a=Mt((.0139322*e+.0971045*t+.7141733*n)/Ct));let s=116*o-16;return[s<0?0:s,500*(i-o),200*(o-a),r]}function jt(e){return e<=.04045?e/12.92:((e+.055)/1.055)**2.4}function Mt(e){return e>.008856451679035631?e**(1/3):e/Et+wt}function Nt([e,t,n,r]){let i=(e+16)/116,a=isNaN(t)?i:i+t/500,o=isNaN(n)?i:i-n/200;return i=1*Ft(i),a=St*Ft(a),o=Ct*Ft(o),[Pt(3.1338561*a-1.6168667*i-.4906146*o),Pt(-.9787684*a+1.9161415*i+.033454*o),Pt(.0719453*a-.2289914*i+1.4052427*o),r]}function Pt(e){return(e=e<=.00304?12.92*e:1.055*e**(1/2.4)-.055)<0?0:e>1?1:e}function Ft(e){return e>Tt?e*e*e:Et*(e-wt)}let It=Object.hasOwn||function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};function Lt(e,t){return It(e,t)?e[t]:void 0}function Rt(e){return parseInt(e.padEnd(2,e),16)/255}function zt(e,t){return Bt(t?e/100:e,0,1)}function Bt(e,t,n){return Math.min(Math.max(t,e),n)}function Vt(e){return!e.some(Number.isNaN)}let Ht={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]};function Ut(e,t,n){return e+n*(t-e)}function Wt(e,t,n){return e.map(((e,r)=>Ut(e,t[r],n)))}class Gt{constructor(e,t,n,r=1,i=!0){this.r=e,this.g=t,this.b=n,this.a=r,i||(this.r*=r,this.g*=r,this.b*=r,r||this.overwriteGetter(`rgb`,[e,t,n,r]))}static parse(e){if(e instanceof Gt)return e;if(typeof e!=`string`)return;let t=function(e){if((e=e.toLowerCase().trim())===`transparent`)return[0,0,0,0];let t=Lt(Ht,e);if(t){let[e,n,r]=t;return[e/255,n/255,r/255,1]}if(e.startsWith(`#`)&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(e)){let t=e.length<6?1:2,n=1;return[Rt(e.slice(n,n+=t)),Rt(e.slice(n,n+=t)),Rt(e.slice(n,n+=t)),Rt(e.slice(n,n+t)||`ff`)]}if(e.startsWith(`rgb`)){let t=e.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(t){let[e,n,r,i,a,o,s,c,l,u,d,f]=t,p=[i||` `,s||` `,u].join(``);if(p===`  `||p===`  /`||p===`,,`||p===`,,,`){let e=[r,o,l].join(``),t=e===`%%%`?100:e===``?255:0;if(t){let e=[Bt(+n/t,0,1),Bt(+a/t,0,1),Bt(+c/t,0,1),d?zt(+d,f):1];if(Vt(e))return e}}return}}let n=e.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(n){let[e,t,r,i,a,o,s,c,l]=n,u=[r||` `,a||` `,s].join(``);if(u===`  `||u===`  /`||u===`,,`||u===`,,,`){let e=[+t,Bt(+i,0,100),Bt(+o,0,100),c?zt(+c,l):1];if(Vt(e))return function([e,t,n,r]){function i(r){let i=(r+e/30)%12,a=t*Math.min(n,1-n);return n-a*Math.max(-1,Math.min(i-3,9-i,1))}return e=kt(e),t/=100,n/=100,[i(0),i(8),i(4),r]}(e)}}}(e);return t?new Gt(...t,!1):void 0}get rgb(){let{r:e,g:t,b:n,a:r}=this,i=r||1/0;return this.overwriteGetter(`rgb`,[e/i,t/i,n/i,r])}get hcl(){return this.overwriteGetter(`hcl`,function(e){let[t,n,r,i]=At(e),a=Math.sqrt(n*n+r*r);return[Math.round(1e4*a)?kt(Math.atan2(r,n)*Ot):NaN,a,t,i]}(this.rgb))}get lab(){return this.overwriteGetter(`lab`,At(this.rgb))}overwriteGetter(e,t){return Object.defineProperty(this,e,{value:t}),t}toString(){let[e,t,n,r]=this.rgb;return`rgba(${[e,t,n].map((e=>Math.round(255*e))).join(`,`)},${r})`}static interpolate(e,t,n,r=`rgb`){switch(r){case`rgb`:{let[r,i,a,o]=Wt(e.rgb,t.rgb,n);return new Gt(r,i,a,o,!1)}case`hcl`:{let[r,i,a,o]=e.hcl,[s,c,l,u]=t.hcl,d,f;if(isNaN(r)||isNaN(s))isNaN(r)?isNaN(s)?d=NaN:(d=s,a!==1&&a!==0||(f=c)):(d=r,l!==1&&l!==0||(f=i));else{let e=s-r;s>r&&e>180?e-=360:s<r&&r-s>180&&(e+=360),d=r+n*e}let[p,m,h,g]=function([e,t,n,r]){return e=isNaN(e)?0:e*Dt,Nt([n,Math.cos(e)*t,Math.sin(e)*t,r])}([d,f??Ut(i,c,n),Ut(a,l,n),Ut(o,u,n)]);return new Gt(p,m,h,g,!1)}case`lab`:{let[r,i,a,o]=Nt(Wt(e.lab,t.lab,n));return new Gt(r,i,a,o,!1)}}}}Gt.black=new Gt(0,0,0,1),Gt.white=new Gt(1,1,1,1),Gt.transparent=new Gt(0,0,0,0),Gt.red=new Gt(1,0,0,1);class Kt{constructor(e,t,n){this.sensitivity=e?t?`variant`:`case`:t?`accent`:`base`,this.locale=n,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:`search`})}compare(e,t){return this.collator.compare(e,t)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}let qt=[`bottom`,`center`,`top`];class Jt{constructor(e,t,n,r,i,a){this.text=e,this.image=t,this.scale=n,this.fontStack=r,this.textColor=i,this.verticalAlign=a}}class Yt{constructor(e){this.sections=e}static fromString(e){return new Yt([new Jt(e,null,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some((e=>e.text.length!==0||e.image&&e.image.name.length!==0))}static factory(e){return e instanceof Yt?e:Yt.fromString(e)}toString(){return this.sections.length===0?``:this.sections.map((e=>e.text)).join(``)}}class Xt{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Xt)return e;if(typeof e==`number`)return new Xt([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(let t of e)if(typeof t!=`number`)return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new Xt(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,n){return new Xt(Wt(e.values,t.values,n))}}class Zt{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Zt)return e;if(typeof e==`number`)return new Zt([e]);if(Array.isArray(e)){for(let t of e)if(typeof t!=`number`)return;return new Zt(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,n){return new Zt(Wt(e.values,t.values,n))}}class Qt{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Qt)return e;if(typeof e==`string`){let t=Gt.parse(e);return t?new Qt([t]):void 0}if(!Array.isArray(e))return;let t=[];for(let n of e){if(typeof n!=`string`)return;let e=Gt.parse(n);if(!e)return;t.push(e)}return new Qt(t)}toString(){return JSON.stringify(this.values)}static interpolate(e,t,n,r=`rgb`){let i=[];if(e.values.length!=t.values.length)throw Error(`colorArray: Arrays have mismatched length (${e.values.length} vs. ${t.values.length}), cannot interpolate.`);for(let a=0;a<e.values.length;a++)i.push(Gt.interpolate(e.values[a],t.values[a],n,r));return new Qt(i)}}class $t extends Error{constructor(e){super(e),this.name=`RuntimeError`}toJSON(){return this.message}}let en=new Set([`center`,`left`,`right`,`top`,`bottom`,`top-left`,`top-right`,`bottom-left`,`bottom-right`]);class tn{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof tn)return e;if(Array.isArray(e)&&!(e.length<1)&&e.length%2==0){for(let t=0;t<e.length;t+=2){let n=e[t],r=e[t+1];if(typeof n!=`string`||!en.has(n)||!Array.isArray(r)||r.length!==2||typeof r[0]!=`number`||typeof r[1]!=`number`)return}return new tn(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,t,n){let r=e.values,i=t.values;if(r.length!==i.length)throw new $t(`Cannot interpolate values of different length. from: ${e.toString()}, to: ${t.toString()}`);let a=[];for(let e=0;e<r.length;e+=2){if(r[e]!==i[e])throw new $t(`Cannot interpolate values containing mismatched anchors. from[${e}]: ${r[e]}, to[${e}]: ${i[e]}`);a.push(r[e]);let[t,o]=r[e+1],[s,c]=i[e+1];a.push([Ut(t,s,n),Ut(o,c,n)])}return new tn(a)}}class nn{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new nn({name:e,available:!1}):null}}class rn{constructor(e,t,n){this.from=e,this.to=t,this.transition=n}static interpolate(e,t,n){return new rn(e,t,n)}static parse(e){return e instanceof rn?e:Array.isArray(e)&&e.length===3&&typeof e[0]==`string`&&typeof e[1]==`string`&&typeof e[2]==`number`?new rn(e[0],e[1],e[2]):typeof e==`object`&&typeof e.from==`string`&&typeof e.to==`string`&&typeof e.transition==`number`?new rn(e.from,e.to,e.transition):typeof e==`string`?new rn(e,e,1):void 0}}function an(e,t,n,r){return typeof e==`number`&&e>=0&&e<=255&&typeof t==`number`&&t>=0&&t<=255&&typeof n==`number`&&n>=0&&n<=255?r===void 0||typeof r==`number`&&r>=0&&r<=1?null:`Invalid rgba value [${[e,t,n,r].join(`, `)}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof r==`number`?[e,t,n,r]:[e,t,n]).join(`, `)}]: 'r', 'g', and 'b' must be between 0 and 255.`}function on(e){if(e===null||typeof e==`string`||typeof e==`boolean`||typeof e==`number`||e instanceof rn||e instanceof Gt||e instanceof Kt||e instanceof Yt||e instanceof Xt||e instanceof Zt||e instanceof Qt||e instanceof tn||e instanceof nn)return!0;if(Array.isArray(e)){for(let t of e)if(!on(t))return!1;return!0}if(typeof e==`object`){for(let t in e)if(!on(e[t]))return!1;return!0}return!1}function sn(e){if(e===null)return tt;if(typeof e==`string`)return nt;if(typeof e==`boolean`)return rt;if(typeof e==`number`)return F;if(e instanceof Gt)return it;if(e instanceof rn)return at;if(e instanceof Kt)return ct;if(e instanceof Yt)return lt;if(e instanceof Xt)return ut;if(e instanceof Zt)return ft;if(e instanceof Qt)return dt;if(e instanceof tn)return mt;if(e instanceof nn)return pt;if(Array.isArray(e)){let t=e.length,n;for(let t of e){let e=sn(t);if(n){if(n===e)continue;n=st;break}n=e}return ht(n||st,t)}return ot}function cn(e){let t=typeof e;return e===null?``:t===`string`||t===`number`||t===`boolean`?String(e):e instanceof Gt||e instanceof rn||e instanceof Yt||e instanceof Xt||e instanceof Zt||e instanceof Qt||e instanceof tn||e instanceof nn?e.toString():JSON.stringify(e)}class ln{constructor(e,t){this.type=e,this.value=t}static parse(e,t){if(e.length!==2)return t.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!on(e[1]))return t.error(`invalid value`);let n=e[1],r=sn(n),i=t.expectedType;return r.kind!==`array`||r.N!==0||!i||i.kind!==`array`||typeof i.N==`number`&&i.N!==0||(r=i),new ln(r,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}let un={string:nt,number:F,boolean:rt,object:ot};class dn{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error(`Expected at least one argument.`);let n,r=1,i=e[0];if(i===`array`){let i,a;if(e.length>2){let n=e[1];if(typeof n!=`string`||!(n in un)||n===`object`)return t.error(`The item type argument of "array" must be one of string, number, boolean`,1);i=un[n],r++}else i=st;if(e.length>3){if(e[2]!==null&&(typeof e[2]!=`number`||e[2]<0||e[2]!==Math.floor(e[2])))return t.error(`The length argument to "array" must be a positive integer literal`,2);a=e[2],r++}n=ht(i,a)}else{if(!un[i])throw Error(`Types doesn't contain name = ${i}`);n=un[i]}let a=[];for(;r<e.length;r++){let n=t.parse(e[r],r,st);if(!n)return null;a.push(n)}return new dn(n,a)}evaluate(e){for(let t=0;t<this.args.length;t++){let n=this.args[t].evaluate(e);if(!vt(this.type,sn(n)))return n;if(t===this.args.length-1)throw new $t(`Expected value to be of type ${gt(this.type)}, but found ${gt(sn(n))} instead.`)}throw Error()}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}let fn={"to-boolean":rt,"to-color":it,"to-number":F,"to-string":nt};class pn{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error(`Expected at least one argument.`);let n=e[0];if(!fn[n])throw Error(`Can't parse ${n} as it is not part of the known types`);if((n===`to-boolean`||n===`to-string`)&&e.length!==2)return t.error(`Expected one argument.`);let r=fn[n],i=[];for(let n=1;n<e.length;n++){let r=t.parse(e[n],n,st);if(!r)return null;i.push(r)}return new pn(r,i)}evaluate(e){switch(this.type.kind){case`boolean`:return!!this.args[0].evaluate(e);case`color`:{let t,n;for(let r of this.args){if(t=r.evaluate(e),n=null,t instanceof Gt)return t;if(typeof t==`string`){let n=e.parseColor(t);if(n)return n}else if(Array.isArray(t)&&(n=t.length<3||t.length>4?`Invalid rgba value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:an(t[0],t[1],t[2],t[3]),!n))return new Gt(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new $t(n||`Could not parse color from value '${typeof t==`string`?t:JSON.stringify(t)}'`)}case`padding`:{let t;for(let n of this.args){t=n.evaluate(e);let r=Xt.parse(t);if(r)return r}throw new $t(`Could not parse padding from value '${typeof t==`string`?t:JSON.stringify(t)}'`)}case`numberArray`:{let t;for(let n of this.args){t=n.evaluate(e);let r=Zt.parse(t);if(r)return r}throw new $t(`Could not parse numberArray from value '${typeof t==`string`?t:JSON.stringify(t)}'`)}case`colorArray`:{let t;for(let n of this.args){t=n.evaluate(e);let r=Qt.parse(t);if(r)return r}throw new $t(`Could not parse colorArray from value '${typeof t==`string`?t:JSON.stringify(t)}'`)}case`variableAnchorOffsetCollection`:{let t;for(let n of this.args){t=n.evaluate(e);let r=tn.parse(t);if(r)return r}throw new $t(`Could not parse variableAnchorOffsetCollection from value '${typeof t==`string`?t:JSON.stringify(t)}'`)}case`number`:{let t=null;for(let n of this.args){if(t=n.evaluate(e),t===null)return 0;let r=Number(t);if(!isNaN(r))return r}throw new $t(`Could not convert ${JSON.stringify(t)} to number.`)}case`formatted`:return Yt.fromString(cn(this.args[0].evaluate(e)));case`resolvedImage`:return nn.fromString(cn(this.args[0].evaluate(e)));case`projectionDefinition`:return this.args[0].evaluate(e);default:return cn(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}let mn=[`Unknown`,`Point`,`LineString`,`Polygon`];class hn{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,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`?mn[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&`geometry`in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(e){let t=this._parseColorCache.get(e);return t||(t=Gt.parse(e),this._parseColorCache.set(e,t)),t}}class gn{constructor(e,t,n=[],r,i=new et,a=[]){this.registry=e,this.path=n,this.key=n.map((e=>`[${e}]`)).join(``),this.scope=i,this.errors=a,this.expectedType=r,this._isConstant=t}parse(e,t,n,r,i={}){return t?this.concat(t,n,r)._parse(e,i):this._parse(e,i)}_parse(e,t){function n(e,t,n){return n===`assert`?new dn(t,[e]):n===`coerce`?new pn(t,[e]):e}if(e!==null&&typeof e!=`string`&&typeof e!=`boolean`&&typeof e!=`number`||(e=[`literal`,e]),Array.isArray(e)){if(e.length===0)return this.error(`Expected an array with at least one element. If you wanted a literal array, use ["literal", []].`);let r=e[0];if(typeof r!=`string`)return this.error(`Expression name must be a string, but found ${typeof r} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let i=this.registry[r];if(i){let r=i.parse(e,this);if(!r)return null;if(this.expectedType){let e=this.expectedType,i=r.type;if(e.kind!==`string`&&e.kind!==`number`&&e.kind!==`boolean`&&e.kind!==`object`&&e.kind!==`array`||i.kind!==`value`){if(e.kind===`projectionDefinition`&&[`string`,`array`].includes(i.kind)||[`color`,`formatted`,`resolvedImage`].includes(e.kind)&&[`value`,`string`].includes(i.kind)||[`padding`,`numberArray`].includes(e.kind)&&[`value`,`number`,`array`].includes(i.kind)||e.kind===`colorArray`&&[`value`,`string`,`array`].includes(i.kind)||e.kind===`variableAnchorOffsetCollection`&&[`value`,`array`].includes(i.kind))r=n(r,e,t.typeAnnotation||`c
9oerce`);else if(this.checkSubtype(e,i))return null}else r=n(r,e,t.typeAnnotation||`assert`)}if(!(r instanceof ln)&&r.type.kind!==`resolvedImage`&&this._isConstant(r)){let e=new hn;try{r=new ln(r.type,r.evaluate(e))}catch(e){return this.error(e.message),null}}return r}return this.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(e===void 0?`'undefined' value invalid. Use null instead.`:typeof e==`object`?`Bare objects invalid. Use ["literal", {...}] instead.`:`Expected an array, but found ${typeof e} instead.`)}concat(e,t,n){let r=typeof e==`number`?this.path.concat(e):this.path,i=n?this.scope.concat(n):this.scope;return new gn(this.registry,this._isConstant,r,t||null,i,this.errors)}error(e,...t){let n=`${this.key}${t.map((e=>`[${e}]`)).join(``)}`;this.errors.push(new $e(n,e))}checkSubtype(e,t){let n=vt(e,t);return n&&this.error(n),n}}class _n{constructor(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(let t of this.bindings)e(t[1]);e(this.result)}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);let n=[];for(let r=1;r<e.length-1;r+=2){let i=e[r];if(typeof i!=`string`)return t.error(`Expected string, but found ${typeof i} instead.`,r);if(/[^a-zA-Z0-9_]/.test(i))return t.error(`Variable names must contain only alphanumeric characters or '_'.`,r);let a=t.parse(e[r+1],r+1);if(!a)return null;n.push([i,a])}let r=t.parse(e[e.length-1],e.length-1,t.expectedType,n);return r?new _n(n,r):null}outputDefined(){return this.result.outputDefined()}}class vn{constructor(e,t){this.type=t.type,this.name=e,this.boundExpression=t}static parse(e,t){if(e.length!==2||typeof e[1]!=`string`)return t.error(`'var' expression requires exactly one string literal argument.`);let n=e[1];return t.scope.has(n)?new vn(n,t.scope.get(n)):t.error(`Unknown variable "${n}". Make sure "${n}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class yn{constructor(e,t,n){this.type=e,this.index=t,this.input=n}static parse(e,t){if(e.length!==3)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let n=t.parse(e[1],1,F),r=t.parse(e[2],2,ht(t.expectedType||st));return n&&r?new yn(r.type.itemType,n,r):null}evaluate(e){let t=this.index.evaluate(e),n=this.input.evaluate(e);if(t<0)throw new $t(`Array index out of bounds: ${t} < 0.`);if(t>=n.length)throw new $t(`Array index out of bounds: ${t} > ${n.length-1}.`);if(t!==Math.floor(t))throw new $t(`Array index must be an integer, but found ${t} instead.`);return n[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class bn{constructor(e,t){this.type=rt,this.needle=e,this.haystack=t}static parse(e,t){if(e.length!==3)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let n=t.parse(e[1],1,st),r=t.parse(e[2],2,st);return n&&r?yt(n.type,[rt,nt,F,tt,st])?new bn(n,r):t.error(`Expected first argument to be of type boolean, string, number or null, but found ${gt(n.type)} instead`):null}evaluate(e){let t=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!n)return!1;if(!bt(t,[`boolean`,`string`,`number`,`null`]))throw new $t(`Expected first argument to be of type boolean, string, number or null, but found ${gt(sn(t))} instead.`);if(!bt(n,[`string`,`array`]))throw new $t(`Expected second argument to be of type array or string, but found ${gt(sn(n))} instead.`);return n.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class xn{constructor(e,t,n){this.type=F,this.needle=e,this.haystack=t,this.fromIndex=n}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);let n=t.parse(e[1],1,st),r=t.parse(e[2],2,st);if(!n||!r)return null;if(!yt(n.type,[rt,nt,F,tt,st]))return t.error(`Expected first argument to be of type boolean, string, number or null, but found ${gt(n.type)} instead`);if(e.length===4){let i=t.parse(e[3],3,F);return i?new xn(n,r,i):null}return new xn(n,r)}evaluate(e){let t=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!bt(t,[`boolean`,`string`,`number`,`null`]))throw new $t(`Expected first argument to be of type boolean, string, number or null, but found ${gt(sn(t))} instead.`);let r;if(this.fromIndex&&(r=this.fromIndex.evaluate(e)),bt(n,[`string`])){let e=n.indexOf(t,r);return e===-1?-1:[...n.slice(0,e)].length}if(bt(n,[`array`]))return n.indexOf(t,r);throw new $t(`Expected second argument to be of type array or string, but found ${gt(sn(n))} instead.`)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class Sn{constructor(e,t,n,r,i,a){this.inputType=e,this.type=t,this.input=n,this.cases=r,this.outputs=i,this.otherwise=a}static parse(e,t){if(e.length<5)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return t.error(`Expected an even number of arguments.`);let n,r;t.expectedType&&t.expectedType.kind!==`value`&&(r=t.expectedType);let i={},a=[];for(let o=2;o<e.length-1;o+=2){let s=e[o],c=e[o+1];Array.isArray(s)||(s=[s]);let l=t.concat(o);if(s.length===0)return l.error(`Expected at least one branch label.`);for(let e of s){if(typeof e!=`number`&&typeof e!=`string`)return l.error(`Branch labels must be numbers or strings.`);if(typeof e==`number`&&Math.abs(e)>2**53-1)return l.error(`Branch labels must be integers no larger than ${2**53-1}.`);if(typeof e==`number`&&Math.floor(e)!==e)return l.error(`Numeric branch labels must be integer values.`);if(n){if(l.checkSubtype(n,sn(e)))return null}else n=sn(e);if(i[String(e)]!==void 0)return l.error(`Branch labels must be unique.`);
vendor: 255,320 bytes, line 9
9i[String(e)]=a.length}let u=t.parse(c,o,r);if(!u)return null;r||=u.type,a.push(u)}let o=t.parse(e[1],1,st);if(!o)return null;let s=t.parse(e[e.length-1],e.length-1,r);return s?o.type.kind!==`value`&&t.concat(1).checkSubtype(n,o.type)?null:new Sn(n,r,o,i,a,s):null}evaluate(e){let t=this.input.evaluate(e);return(sn(t)===this.inputType&&this.outputs[this.cases[t]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))&&this.otherwise.outputDefined()}}class Cn{constructor(e,t,n){this.type=e,this.branches=t,this.otherwise=n}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return t.error(`Expected an odd number of arguments.`);let n;t.expectedType&&t.expectedType.kind!==`value`&&(n=t.expectedType);let r=[];for(let i=1;i<e.length-1;i+=2){let a=t.parse(e[i],i,rt);if(!a)return null;let o=t.parse(e[i+1],i+1,n);if(!o)return null;r.push([a,o]),n||=o.type}let i=t.parse(e[e.length-1],e.length-1,n);if(!i)return null;if(!n)throw Error(`Can't infer output type`);return new Cn(n,r,i)}evaluate(e){for(let[t,n]of this.branches)if(t.evaluate(e))return n.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(let[t,n]of this.branches)e(t),e(n);e(this.otherwise)}outputDefined(){return this.branches.every((([e,t])=>t.outputDefined()))&&this.otherwise.outputDefined()}}class wn{constructor(e,t,n,r){this.type=e,this.input=t,this.beginIndex=n,this.endIndex=r}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);let n=t.parse(e[1],1,st),r=t.parse(e[2],2,F);if(!n||!r)return null;if(!yt(n.type,[ht(st),nt,st]))return t.error(`Expected first argument to be of type array or string, but found ${gt(n.type)} instead`);if(e.length===4){let i=t.parse(e[3],3,F);return i?new wn(n.type,n,r,i):null}return new wn(n.type,n,r)}evaluate(e){let t=this.input.evaluate(e),n=this.beginIndex.evaluate(e),r;if(this.endIndex&&(r=this.endIndex.evaluate(e)),bt(t,[`string`]))return[...t].slice(n,r).join(``);if(bt(t,[`array`]))return t.slice(n,r);throw new $t(`Expected first argument to be of type array or string, but found ${gt(sn(t))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function Tn(e,t){let n=e.length-1,r,i,a=0,o=n,s=0;for(;a<=o;)if(s=Math.floor((a+o)/2),r=e[s],i=e[s+1],r<=t){if(s===n||t<i)return s;a=s+1}else{if(!(r>t))throw new $t(`Input is not a number.`);o=s-1}return 0}class En{constructor(e,t,n){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(let[e,t]of n)this.labels.push(e),this.outputs.push(t)}static parse(e,t){if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error(`Expected an even number of arguments.`);let n=t.parse(e[1],1,F);if(!n)return null;let r=[],i=null;t.expectedType&&t.expectedType.kind!==`value`&&(i=t.expectedType);for(let n=1;n<e.length;n+=2){let a=n===1?-1/0:e[n],o=e[n+1],s=n,c=n+1;if(typeof a!=`number`)return t.error(`Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.`,s);if(r.length&&r[r.length-1][0]>=a)return t.error(`Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.`,s);let l=t.parse(o,c,i);if(!l)return null;i||=l.type,r.push([a,l])}return new En(i,n,r)}evaluate(e){let t=this.labels,n=this.outputs;if(t.length===1)return n[0].evaluate(e);let r=this.input.evaluate(e);if(r<=t[0])return n[0].evaluate(e);let i=t.length;return r>=t[i-1]?n[i-1].evaluate(e):n[Tn(t,r)].evaluate(e)}eachChild(e){e(this.input);for(let t of this.outputs)e(t)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}}function Dn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var On,kn,An=Dn(function(){if(kn)return On;function e(e,t,n,r){this.cx=3*e,this.bx=3*(n-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(r-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=n,this.p2y=r}return kn=1,On=e,e.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,t){if(t===void 0&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var n=e,r=0;r<8;r++){var i=this.sampleCurveX(n)-e;if(Math.abs(i)<t)return n;var a=this.sampleCurveDerivativeX(n);if(Math.abs(a)<1e-6)break;n-=i/a}var o=0,s=1;for(n=e,r=0;r<20&&(i=this.sampleCurveX(n),!(Math.abs(i-e)<t));r++)e>i?o=n:s=n,n=.5*(s-o)+o;return n},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},On}());class jn{constructor(e,t,n,r,i){this.type=e,this.operator=t,this.interpolation=n,this.input=r,this.labels=[],this.outputs=[];for(let[e,t]of i)this.labels.push(e),this.outputs.push(t)}static interpolationFactor(e,t,n,r){let i=0;if(e.name===`exponential`)i=Mn(t,e.base,n,r);else if(e.name===`linear`)i=Mn(t,1,n,r);else if(e.name===`cubic-bezier`){let a=e.controlPoints;i=new An(a[0],a[1],a[2],a[3]).solve(Mn(t,1,n,r))}return i}static parse(e,t){let[n,r,i,...a]=e;if(!Array.isArray(r)||r.length===0)return t.error(`Expected an interpolation type expression.`,1);if(r[0]===`linear`)r={name:`linear`};else if(r[0]===`exponential`){let e=r[1];if(typeof e!=`number`)return t.error(`Exponential interpolation requires a numeric base.`,1,1);r={name:`exponential`,base:e}}else{if(r[0]!==`cubic-bezier`)return t.error(`Unknown interpolation type ${String(r[0])}`,1,0);{let e=r.slice(1);if(e.length!==4||e.some((e=>typeof e!=`number`||e<0||e>1)))return t.error(`Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.`,1);r={name:`cubic-bezier`,controlPoints:e}}}if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error(`Expected an even number of arguments.`);if(i=t.parse(i,2,F),!i)return null;let o=[],s=null;n!==`interpolate-hcl`&&n!==`interpolate-lab`||t.expectedType==dt?t.expectedType&&t.expectedType.kind!==`value`&&(s=t.expectedType):s=it;for(let e=0;e<a.length;e+=2){let n=a[e],r=a[e+1],i=e+3,c=e+4;if(typeof n!=`number`)return t.error(`Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.`,i);if(o.length&&o[o.length-1][0]>=n)return t.error(`Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.`,i);let l=t.parse(r,c,s);if(!l)return null;s||=l.type,o.push([n,l])}return xt(s,F)||xt(s,at)||xt(s,it)||xt(s,ut)||xt(s,ft)||xt(s,dt)||xt(s,mt)||xt(s,ht(F))?new jn(s,n,r,i,o):t.error(`Type ${gt(s)} is not interpolatable.`)}evaluate(e){let t=this.labels,n=this.outputs;if(t.length===1)return n[0].evaluate(e);let r=this.input.evaluate(e);if(r<=t[0])return n[0].evaluate(e);let i=t.length;if(r>=t[i-1])return n[i-1].evaluate(e);let a=Tn(t,r),o=jn.interpolationFactor(this.interpolation,r,t[a],t[a+1]),s=n[a].evaluate(e),c=n[a+1].evaluate(e);switch(this.operator){case`interpolate`:switch(this.type.kind){case`number`:return Ut(s,c,o);case`color`:return Gt.interpolate(s,c,o);case`padding`:return Xt.interpolate(s,c,o);case`colorArray`:return Qt.interpolate(s,c,o);case`numberArray`:return Zt.interpolate(s,c,o);case`variableAnchorOffsetCollection`:return tn.interpolate(s,c,o);case`array`:return Wt(s,c,o);case`projectionDefinition`:return rn.interpolate(s,c,o)}case`interpolate-hcl`:switch(this.type.kind){case`color`:return Gt.interpolate(s,c,o,`hcl`);case`colorArray`:return Qt.interpolate(s,c,o,`hcl`)}case`interpolate-lab`:switch(this.type.kind){case`color`:return Gt.interpolate(s,c,o,`lab`);case`colorArray`:return Qt.interpolate(s,c,o,`lab`)}}}eachChild(e){e(this.input);for(let t of this.outputs)e(t)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}}function Mn(e,t,n,r){let i=r-n,a=e-n;return i===0?0:t===1?a/i:(t**+a-1)/(t**+i-1)}let Nn={color:Gt.interpolate,number:Ut,padding:Xt.interpolate,numberArray:Zt.interpolate,colorArray:Qt.interpolate,variableAnchorOffsetCollection:tn.interpolate,array:Wt};class Pn{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error(`Expected at least one argument.`);let n=null,r=t.expectedType;r&&r.kind!==`value`&&(n=r);let i=[];for(let r of e.slice(1)){let e=t.parse(r,1+i.length,n,void 0,{typeAnnotation:`omit`});if(!e)return null;n||=e.type,i.push(e)}if(!n)throw Error(`No output type`);let a=r&&i.some((e=>vt(r,e.type)));return new Pn(a?st:n,i)}evaluate(e){let t,n=null,r=0;for(let i of this.args)if(r++,n=i.evaluate(e),n&&n instanceof nn&&!n.available&&(t||=n.name,n=null,r===this.args.length&&(n=t)),n!==null)break;return n}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}function Fn(e,t){return e===`==`||e===`!=`?t.kind===`boolean`||t.kind===`string`||t.kind===`number`||t.kind===`null`||t.kind===`value`:t.kind===`string`||t.kind===`number`||t.kind===`value`}function In(e,t,n,r){return r.compare(t,n)===0}function Ln(e,t,n){let r=e!==`==`&&e!==`!=`;return class i{constructor(e,t,n){this.type=rt,this.lhs=e,this.rhs=t,this.collator=n,this.hasUntypedArgument=e.type.kind===`value`||t.type.kind===`value`}static parse(e,t){if(e.length!==3&&e.length!==4)return t.error(`Expected two or three arguments.`);let n=e[0],a=t.parse(e[1],1,st);if(!a)return null;if(!Fn(n,a.type))return t.concat(1).error(`"${n}" comparisons are not supported for type '${gt(a.type)}'.`);let o=t.parse(e[2],2,st);if(!o)return null;if(!Fn(n,o.type))return t.concat(2).error(`"${n}" comparisons are not supported for type '${gt(o.type)}'.`);if(a.type.kind!==o.type.kind&&a.type.kind!==`value`&&o.type.kind!==`value`)return t.error(`Cannot compare types '${gt(a.type)}' and '${gt(o.type)}'.`);r&&(a.type.kind===`value`&&o.type.kind!==`value`?a=new dn(o.type,[a]):a.type.kind!==`value`&&o.type.kind===`value`&&(o=new dn(a.type,[o])));let s=null;if(e.length===4){if(a.type.kind!==`string`&&o.type.kind!==`string`&&a.type.kind!==`value`&&o.type.kind!==`value`)return t.error(`Cannot use collator to compare non-string types.`);if(s=t.parse(e[3],3,ct),!s)return null}return new i(a,o,s)}evaluate(i){let a=this.lhs.evaluate(i),o=this.rhs.evaluate(i);if(r&&this.hasUntypedArgument){let t=sn(a),n=sn(o);if(t.kind!==n.kind||t.kind!==`string`&&t.kind!==`number`)throw new $t(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${t.kind}, ${n.kind}) instead.`)}if(this.collator&&!r&&this.hasUntypedArgument){let e=sn(a),n=sn(o);if(e.kind!==`string`||n.kind!==`string`)return t(i,a,o)}return this.collator?n(i,a,o,this.collator.evaluate(i)):t(i,a,o)}eachChild(e){e(this.lhs),e(this.rhs),this.collator&&e(this.collator)}outputDefined(){return!0}}}let Rn=Ln(`==`,(function(e,t,n){return t===n}),In),zn=Ln(`!=`,(function(e,t,n){return t!==n}),(function(e,t,n,r){return!In(0,t,n,r)})),Bn=Ln(`<`,(function(e,t,n){return t<n}),(function(e,t,n,r){return r.compare(t,n)<0})),Vn=Ln(`>`,(function(e,t,n){return t>n}),(function(e,t,n,r){return r.compare(t,n)>0})),Hn=Ln(`<=`,(function(e,t,n){return t<=n}),(function(e,t,n,r){return r.compare(t,n)<=0})),Un=Ln(`>=`,(function(e,t,n){return t>=n}),(function(e,t,n,r){return r.compare(t,n)>=0}));class Wn{constructor(e,t,n){this.type=ct,this.locale=n,this.caseSensitive=e,this.diacriticSensitive=t}static parse(e,t){if(e.length!==2)return t.error(`Expected one argument.`);let n=e[1];if(typeof n!=`object`||Array.isArray(n))return t.error(`Collator options argument must be an object.`);let r=t.parse(n[`case-sensitive`]!==void 0&&n[`case-sensitive`],1,rt);if(!r)return null;let i=t.parse(n[`diacritic-sensitive`]!==void 0&&n[`diacritic-sensitive`],1,rt);if(!i)return null;let a=null;return n.locale&&(a=t.parse(n.locale,1,nt),!a)?null:new Wn(r,i,a)}evaluate(e){return new Kt(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}}class Gn{constructor(e,t,n,r,i,a){this.type=nt,this.number=e,this.locale=t,this.currency=n,this.unit=r,this.minFractionDigits=i,this.maxFractionDigits=a}static parse(e,t){if(e.length!==3)return t.error(`Expected two arguments.`);let n=t.parse(e[1],1,F);if(!n)return null;let r=e[2];if(typeof r!=`object`||Array.isArray(r))return t.error(`NumberFormat options argument must be an object.`);let i=null;if(r.locale&&(i=t.parse(r.locale,1,nt),!i))return null;let a=null;if(r.currency&&(a=t.parse(r.currency,1,nt),!a))return null;let o=null;if(r.unit&&(o=t.parse(r.unit,1,nt),!o))return null;if(a&&o)return t.error("NumberFormat options `currency` and `unit` are mutually exclusive");let s=null;if(r[`min-fraction-digits`]&&(s=t.parse(r[`min-fraction-digits`],1,F),!s))return null;let c=null;return r[`max-fraction-digits`]&&(c=t.parse(r[`max-fraction-digits`],1,F),!c)?null:new Gn(n,i,a,o,s,c)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?`currency`:this.unit?`unit`:`decimal`,currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class Kn{constructor(e){this.type=lt,this.sections=e}static parse(e,t){if(e.length<2)return t.error(`Expected at least one argument.`);let n=e[1];if(!Array.isArray(n)&&typeof n==`object`)return t.error(`First argument must be an image or text section.`);let r=[],i=!1;for(let n=1;n<=e.length-1;++n){let a=e[n];if(i&&typeof a==`object`&&!Array.isArray(a)){i=!1;let e=null;if(a[`font-scale`]&&(e=t.parse(a[`font-scale`],1,F),!e))return null;let n=null;if(a[`text-font`]&&(n=t.parse(a[`text-font`],1,ht(nt)),!n))return null;let o=null;if(a[`text-color`]&&(o=t.parse(a[`text-color`],1,it),!o))return null;let s=null;if(a[`vertical-align`]){if(typeof a[`vertical-align`]==`string`&&!qt.includes(a[`vertical-align`]))return t.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${a[`vertical-align`]}' instead.`);if(s=t.parse(a[`vertical-align`],1,nt),!s)return null}let c=r[r.length-1];c.scale=e,c.font=n,c.textColor=o,c.verticalAlign=s}else{let a=t.parse(e[n],1,st);if(!a)return null;let o=a.type.kind;if(o!==`string`&&o!==`value`&&o!==`null`&&o!==`resolvedImage`)return t.error(`Formatted text type must be 'string', 'value', 'image' or 'null'.`);i=!0,r.push({content:a,scale:null,font:null,textColor:null,verticalAlign:null})}}return new Kn(r)}evaluate(e){return new Yt(this.sections.map((t=>{let n=t.content.evaluate(e);return sn(n)===pt?new Jt(``,n,null,null,null,t.verticalAlign?t.verticalAlign.evaluate(e):null):new Jt(cn(n),null,t.scale?t.scale.evaluate(e):null,t.font?t.font.evaluate(e).join(`,`):null,t.textColor?t.textColor.evaluate(e):null,t.verticalAlign?t.verticalAlign.evaluate(e):null)})))}eachChild(e){for(let t of this.sections)e(t.content),t.scale&&e(t.scale),t.font&&e(t.font),t.textColor&&e(t.textColor),t.verticalAlign&&e(t.verticalAlign)}outputDefined(){return!1}}class qn{constructor(e){this.type=pt,this.input=e}static parse(e,t){if(e.length!==2)return t.error(`Expected two arguments.`);let n=t.parse(e[1],1,nt);return n?new qn(n):t.error(`No image name provided.`)}evaluate(e){let t=this.input.evaluate(e),n=nn.fromString(t);return n&&e.availableImages&&(n.available=e.availableImages.indexOf(t)>-1),n}eachChild(e){e(this.input)}outputDefined(){return!1}}class Jn{constructor(e){this.type=F,this.input=e}static parse(e,t){if(e.length!==2)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);let n=t.parse(e[1],1);return n?n.type.kind!==`array`&&n.type.kind!==`string`&&n.type.kind!==`value`?t.error(`Expected argument of type string or array, but found ${gt(n.type)} instead.`):new Jn(n):null}evaluate(e){let t=this.input.evaluate(e);if(typeof t==`string`)return[...t].length;if(Array.isArray(t))return t.length;throw new $t(`Expected value to be of type string or array, but found ${gt(sn(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}let Yn=8192;function Xn(e,t){let n=(180+e[0])/360,r=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e[1]*Math.PI/360)))/360,i=2**t.z;return[Math.round(n*i*Yn),Math.round(r*i*Yn)]}function Zn(e,t){let n=2**t.z;return[(i=(e[0]/Yn+t.x)/n,360*i-180),(r=(e[1]/Yn+t.y)/n,360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90)];var r,i}function Qn(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[0]),e[3]=Math.max(e[3],t[1])}function $n(e,t){return!(e[0]<=t[0]||e[2]>=t[2]||e[1]<=t[1]||e[3]>=t[3])}function er(e,t,n){let r=e[0]-t[0],i=e[1]-t[1],a=e[0]-n[0],o=e[1]-n[1];return r*o-a*i==0&&r*a<=0&&i*o<=0}function tr(e,t,n,r){return(i=[r[0]-n[0],r[1]-n[1]])[0]*(a=[t[0]-e[0],t[1]-e[1]])[1]-i[1]*a[0]!=0&&!(!sr(e,t,n,r)||!sr(n,r,e,t));var i,a}function nr(e,t,n){for(let r of n)for(let n=0;n<r.length-1;++n)if(tr(e,t,r[n],r[n+1]))return!0;return!1}function rr(e,t,n=!1){let r=!1;for(let s of t)for(let t=0;t<s.length-1;t++){if(er(e,s[t],s[t+1]))return n;(a=s[t])[1]>(i=e)[1]!=(o=s[t+1])[1]>i[1]&&i[0]<(o[0]-a[0])*(i[1]-a[1])/(o[1]-a[1])+a[0]&&(r=!r)}var i,a,o;return r}function ir(e,t){for(let n of t)if(rr(e,n))return!0;return!1}function ar(e,t){for(let n of e)if(!rr(n,t))return!1;for(let n=0;n<e.length-1;++n)if(nr(e[n],e[n+1],t))return!1;return!0}function or(e,t){for(let n of t)if(ar(e,n))return!0;return!1}function sr(e,t,n,r){let i=r[0]-n[0],a=r[1]-n[1],o=(e[0]-n[0])*a-i*(e[1]-n[1]),s=(t[0]-n[0])*a-i*(t[1]-n[1]);return o>0&&s<0||o<0&&s>0}function cr(e,t,n){let r=[];for(let i=0;i<e.length;i++){let a=[];for(let r=0;r<e[i].length;r++){let o=Xn(e[i][r],n);Qn(t,o),a.push(o)}r.push(a)}return r}function lr(e,t,n){let r=[];for(let i=0;i<e.length;i++){let a=cr(e[i],t,n);r.push(a)}return r}function ur(e,t,n,r){if(e[0]<n[0]||e[0]>n[2]){let t=.5*r,i=e[0]-n[0]>t?-r:n[0]-e[0]>t?r:0;i===0&&(i=e[0]-n[2]>t?-r:n[2]-e[0]>t?r:0),e[0]+=i}Qn(t,e)}function dr(e,t,n,r){let i=2**r.z*Yn,a=[r.x*Yn,r.y*Yn],o=[];for(let r of e)for(let e of r){let r=[e.x+a[0],e.y+a[1]];ur(r,t,n,i),o.push(r)}return o}function fr(e,t,n,r){let i=2**r.z*Yn,a=[r.x*Yn,r.y*Yn],o=[];for(let n of e){let e=[];for(let r of n){let n=[r.x+a[0],r.y+a[1]];Qn(t,n),e.push(n)}o.push(e)}if(t[2]-t[0]<=i/2){(s=t)[0]=s[1]=1/0,s[2]=s[3]=-1/0;for(let e of o)for(let r of e)ur(r,t,n,i)}var s;return o}class pr{constructor(e,t){this.type=rt,this.geojson=e,this.geometries=t}static parse(e,t){if(e.length!==2)return t.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(on(e[1])){let t=e[1];if(t.type===`FeatureCollection`){let e=[];for(let n of t.features){let{type:t,coordinates:r}=n.geometry;t===`Polygon`&&e.push(r),t===`MultiPolygon`&&e.push(...r)}if(e.length)return new pr(t,{type:`MultiPolygon`,coordinates:e})}else if(t.type===`Feature`){let e=t.geometry.type;if(e===`Polygon`||e===`MultiPolygon`)return new pr(t,t.geometry)}else if(t.type===`Polygon`||t.type===`MultiPolygon`)return new pr(t,t)}return t.error(`'within' expression requires valid geojson object that contains polygon geometry type.`)}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()===`Point`)return function(e,t){let n=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],i=e.canonicalID();if(t.type===`Polygon`){let a=cr(t.coordinates,r,i),o=dr(e.geometry(),n,r,i);if(!$n(n,r))return!1;for(let e of o)if(!rr(e,a))return!1}if(t.type===`MultiPolygon`){let a=lr(t.coordinates,r,i),o=dr(e.geometry(),n,r,i);if(!$n(n,r))return!1;for(let e of o)if(!ir(e,a))return!1}return!0}(e,this.geometries);if(e.geometryType()===`LineString`)return function(e,t){let n=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],i=e.canonicalID();if(t.type===`Polygon`){let a=cr(t.coordinates,r,i),o=fr(e.geometry(),n,r,i);if(!$n(n,r))return!1;for(let e of o)if(!ar(e,a))return!1}if(t.type===`MultiPolygon`){let a=lr(t.coordinates,r,i),o=fr(e.geometry(),n,r,i);if(!$n(n,r))return!1;for(let e of o)if(!or(e,a))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let mr=class{constructor(e=[],t=(e,t)=>e<t?-1:+(e>t)){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;let e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:t,compare:n}=this,r=t[e];for(;e>0;){let i=e-1>>1,a=t[i];if(n(r,a)>=0)break;t[e]=a,e=i}t[e]=r}_down(e){let{data:t,compare:n}=this,r=this.length>>1,i=t[e];for(;e<r;){let r=1+(e<<1),a=r+1;if(a<this.length&&n(t[a],t[r])<0&&(r=a),n(t[r],i)>=0)break;t[e]=t[r],e=r}t[e]=i}};function hr(e,t,n=0,r=e.length-1,i=I){for(;r>n;){if(r-n>600){let a=r-n+1,o=t-n+1,s=Math.log(a),c=.5*Math.exp(2*s/3),l=.5*Math.sqrt(s*c*(a-c)/a)*(o-a/2<0?-1:1);hr(e,t,Math.max(n,Math.floor(t-o*c/a+l)),Math.min(r,Math.floor(t+(a-o)*c/a+l)),i)}let a=e[t],o=n,s=r;for(gr(e,n,t),i(e[r],a)>0&&gr(e,n,r);o<s;){for(gr(e,o,s),o++,s--;i(e[o],a)<0;)o++;for(;i(e[s],a)>0;)s--}i(e[n],a)===0?gr(e,n,s):(s++,gr(e,s,r)),s<=t&&(n=s+1),t<=s&&(r=s-1)}}function gr(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function I(e,t){return e<t?-1:+(e>t)}function L(e,t){if(e.length<=1)return[e];let n=[],r,i;for(let t of e){let e=vr(t);e!==0&&(t.area=Math.abs(e),i===void 0&&(i=e<0),i===e<0?(r&&n.push(r),r=[t]):r.push(t))}if(r&&n.push(r),t>1)for(let e=0;e<n.length;e++)n[e].length<=t||(hr(n[e],t,1,n[e].length-1,_r),n[e]=n[e].slice(0,t));return n}function _r(e,t){return t.area-e.area}function vr(e){let t=0;for(let n,r,i=0,a=e.length,o=a-1;i<a;o=i++)n=e[i],r=e[o],t+=(r.x-n.x)*(n.y+r.y);return t}let yr=1/298.257223563,br=yr*(2-yr),xr=Math.PI/180;class Sr{constructor(e){let t=6378.137*xr*1e3,n=Math.cos(e*xr),r=1/(1-br*(1-n*n)),i=Math.sqrt(r);this.kx=t*i*n,this.ky=t*i*r*(1-br)}distance(e,t){let n=this.wrap(e[0]-t[0])*this.kx,r=(e[1]-t[1])*this.ky;return Math.sqrt(n*n+r*r)}pointOnLine(e,t){let n,r,i,a,o=1/0;for(let s=0;s<e.length-1;s++){let c=e[s][0],l=e[s][1],u=this.wrap(e[s+1][0]-c)*this.kx,d=(e[s+1][1]-l)*this.ky,f=0;u===0&&d===0||(f=(this.wrap(t[0]-c)*this.kx*u+(t[1]-l)*this.ky*d)/(u*u+d*d),f>1?(c=e[s+1][0],l=e[s+1][1]):f>0&&(c+=u/this.kx*f,l+=d/this.ky*f)),u=this.wrap(t[0]-c)*this.kx,d=(t[1]-l)*this.ky;let p=u*u+d*d;p<o&&(o=p,n=c,r=l,i=s,a=f)}return{point:[n,r],index:i,t:Math.max(0,Math.min(1,a))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}}function Cr(e,t){return t[0]-e[0]}function wr(e){return e[1]-e[0]+1}function Tr(e,t){return e[1]>=e[0]&&e[1]<t}function Er(e,t){if(e[0]>e[1])return[null,null];let n=wr(e);if(t){if(n===2)return[e,null];let t=Math.floor(n/2);return[[e[0],e[0]+t],[e[0]+t,e[1]]]}if(n===1)return[e,null];let r=Math.floor(n/2)-1;return[[e[0],e[0]+r],[e[0]+r+1,e[1]]]}function Dr(e,t){if(!Tr(t,e.length))return[1/0,1/0,-1/0,-1/0];let n=[1/0,1/0,-1/0,-1/0];for(let r=t[0];r<=t[1];++r)Qn(n,e[r]);return n}function Or(e){let t=[1/0,1/0,-1/0,-1/0];for(let n of e)for(let e of n)Qn(t,e);return t}function kr(e){return e[0]!==-1/0&&e[1]!==-1/0&&e[2]!==1/0&&e[3]!==1/0}function Ar(e,t,n){if(!kr(e)||!kr(t))return NaN;let r=0,i=0;return e[2]<t[0]&&(r=t[0]-e[2]),e[0]>t[2]&&(r=e[0]-t[2]),e[1]>t[3]&&(i=e[1]-t[3]),e[3]<t[1]&&(i=t[1]-e[3]),n.distance([0,0],[r,i])}function jr(e,t,n){let r=n.pointOnLine(t,e);return n.distance(e,r.point)}function Mr(e,t,n,r,i){let a=Math.min(jr(e,[n,r],i),jr(t,[n,r],i)),o=Math.min(jr(n,[e,t],i),jr(r,[e,t],i));return Math.min(a,o)}function Nr(e,t,n,r,i){if(!Tr(t,e.length)||!Tr(r,n.length))return 1/0;let a=1/0;for(let o=t[0];o<t[1];++o){let t=e[o],s=e[o+1];for(let e=r[0];e<r[1];++e){let r=n[e],o=n[e+1];if(tr(t,s,r,o))return 0;a=Math.min(a,Mr(t,s,r,o,i))}}return a}function Pr(e,t,n,r,i){if(!Tr(t,e.length)||!Tr(r,n.length))return NaN;let a=1/0;for(let o=t[0];o<=t[1];++o)for(let t=r[0];t<=r[1];++t)if(a=Math.min(a,i.distance(e[o],n[t])),a===0)return a;return a}function R(e,t,n){if(rr(e,t,!0))return 0;let r=1/0;for(let i of t){let t=i[0],a=i[i.length-1];if(t!==a&&(r=Math.min(r,jr(e,[a,t],n)),r===0))return r;let o=n.pointOnLine(i,e);if(r=Math.min(r,n.distance(e,o.point)),r===0)return r}return r}function z(e,t,n,r){if(!Tr(t,e.length))return NaN;for(let r=t[0];r<=t[1];++r)if(rr(e[r],n,!0))return 0;let i=1/0;for(let a=t[0];a<t[1];++a){let t=e[a],o=e[a+1];for(let e of n)for(let n=0,a=e.length,s=a-1;n<a;s=n++){let a=e[s],c=e[n];if(tr(t,o,a,c))return 0;i=Math.min(i,Mr(t,o,a,c,r))}}return i}function Fr(e,t){for(let n of e)for(let e of n)if(rr(e,t,!0))return!0;return!1}function Ir(e,t,n,r=1/0){let i=Or(e),a=Or(t);if(r!==1/0&&Ar(i,a,n)>=r)return r;if($n(i,a)){if(Fr(e,t))return 0}else if(Fr(t,e))return 0;let o=1/0;for(let r of e)for(let e=0,i=r.length,a=i-1;e<i;a=e++){let i=r[a],s=r[e];for(let e of t)for(let t=0,r=e.length,a=r-1;t<r;a=t++){let r=e[a],c=e[t];if(tr(i,s,r,c))return 0;o=Math.min(o,Mr(i,s,r,c,n))}}return o}function Lr(e,t,n,r,i,a){if(!a)return;let o=Ar(Dr(r,a),i,n);o<t&&e.push([o,a,[0,0]])}function Rr(e,t,n,r,i,a,o){if(!a||!o)return;let s=Ar(Dr(r,a),Dr(i,o),n);s<t&&e.push([s,a,o])}function zr(e,t,n,r,i=1/0){let a=Math.min(r.distance(e[0],n[0][0]),i);if(a===0)return a;let o=new mr([[0,[0,e.length-1],[0,0]]],Cr),s=Or(n);for(;o.length>0;){let i=o.pop();if(i[0]>=a)continue;let c=i[1],l=t?50:100;if(wr(c)<=l){if(!Tr(c,e.length))return NaN;if(t){let t=z(e,c,n,r);if(isNaN(t)||t===0)return t;a=Math.min(a,t)}else for(let t=c[0];t<=c[1];++t){let i=R(e[t],n,r);if(a=Math.min(a,i),a===0)return 0}}else{let n=Er(c,t);Lr(o,a,r,e,s,n[0]),Lr(o,a,r,e,s,n[1])}}return a}function Br(e,t,n,r,i,a=1/0){let o=Math.min(a,i.distance(e[0],n[0]));if(o===0)return o;let s=new mr([[0,[0,e.length-1],[0,n.length-1]]],Cr);for(;s.length>0;){let a=s.pop();if(a[0]>=o)continue;let c=a[1],l=a[2],u=t?50:100,d=r?50:100;if(wr(c)<=u&&wr(l)<=d){if(!Tr(c,e.length)&&Tr(l,n.length))return NaN;let a;if(t&&r)a=Nr(e,c,n,l,i),o=Math.min(o,a);else if(t&&!r){let t=e.slice(c[0],c[1]+1);for(let e=l[0];e<=l[1];++e)if(a=jr(n[e],t,i),o=Math.min(o,a),o===0)return o}else if(!t&&r){let t=n.slice(l[0],l[1]+1);for(let n=c[0];n<=c[1];++n)if(a=jr(e[n],t,i),o=Math.min(o,a),o===0)return o}else a=Pr(e,c,n,l,i),o=Math.min(o,a)}else{let a=Er(c,t),u=Er(l,r);Rr(s,o,i,e,n,a[0],u[0]),Rr(s,o,i,e,n,a[0],u[1]),Rr(s,o,i,e,n,a[1],u[0]),Rr(s,o,i,e,n,a[1],u[1])}}return o}function Vr(e){return e.type===`MultiPolygon`?e.coordinates.map((e=>({type:`Polygon`,coordinates:e}))):e.type===`MultiLineString`?e.coordinates.map((e=>({type:`LineString`,coordinates:e}))):e.type===`MultiPoint`?e.coordinates.map((e=>({type:`Point`,coordinates:e}))):[e]}class Hr{constructor(e,t){this.type=F,this.geojson=e,this.geometries=t}static parse(e,t){if(e.length!==2)return t.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(on(e[1])){let t=e[1];if(t.type===`FeatureCollection`)return new Hr(t,t.features.map((e=>Vr(e.geometry))).flat());if(t.type===`Feature`)return new Hr(t,Vr(t.geometry));if(`type`in t&&`coordinates`in t)return new Hr(t,Vr(t))}return t.error(`'distance' expression requires valid geojson object that contains polygon geometry type.`)}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()===`Point`)return function(e,t){let n=e.geometry(),r=n.flat().map((t=>Zn([t.x,t.y],e.canonical)));if(n.length===0)return NaN;let i=new Sr(r[0][1]),a=1/0;for(let e of t){switch(e.type){case`Point`:a=Math.min(a,Br(r,!1,[e.coordinates],!1,i,a));break;case`LineString`:a=Math.min(a,Br(r,!1,e.coordinates,!0,i,a));break;case`Polygon`:a=Math.min(a,zr(r,!1,e.coordinates,i,a))}if(a===0)return a}return a}(e,this.geometries);if(e.geometryType()===`LineString`)return function(e,t){let n=e.geometry(),r=n.flat().map((t=>Zn([t.x,t.y],e.canonical)));if(n.length===0)return NaN;let i=new Sr(r[0][1]),a=1/0;for(let e of t){switch(e.type){case`Point`:a=Math.min(a,Br(r,!0,[e.coordinates],!1,i,a));break;case`LineString`:a=Math.min(a,Br(r,!0,e.coordinates,!0,i,a));break;case`Polygon`:a=Math.min(a,zr(r,!0,e.coordinates,i,a))}if(a===0)return a}return a}(e,this.geometries);if(e.geometryType()===`Polygon`)return function(e,t){let n=e.geometry();if(n.length===0||n[0].length===0)return NaN;let r=L(n,0).map((t=>t.map((t=>t.map((t=>Zn([t.x,t.y],e.canonical))))))),i=new Sr(r[0][0][0][1]),a=1/0;for(let e of t)for(let t of r){switch(e.type){case`Point`:a=Math.min(a,zr([e.coordinates],!1,t,i,a));break;case`LineString`:a=Math.min(a,zr(e.coordinates,!0,t,i,a));break;case`Polygon`:a=Math.min(a,Ir(t,e.coordinates,i,a))}if(a===0)return a}return a}(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class Ur{constructor(e){this.type=st,this.key=e}static parse(e,t){if(e.length!==2)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);let n=e[1];return n==null?t.error(`Global state property must be defined.`):typeof n==`string`?new Ur(n):t.error(`Global state property must be string, but found ${typeof e[1]} instead.`)}evaluate(e){let t=e.globals?.globalState;return t&&Object.keys(t).length!==0?Lt(t,this.key):null}eachChild(){}outputDefined(){return!1}}let Wr={"==":Rn,"!=":zn,">":Vn,"<":Bn,">=":Un,"<=":Hn,array:dn,at:yn,boolean:dn,case:Cn,coalesce:Pn,collator:Wn,format:Kn,image:qn,in:bn,"index-of":xn,interpolate:jn,"interpolate-hcl":jn,"interpolate-lab":jn,length:Jn,let:_n,literal:ln,match:Sn,number:dn,"number-format":Gn,object:dn,slice:wn,step:En,string:dn,"to-boolean":pn,"to-color":pn,"to-number":pn,"to-string":pn,var:vn,within:pr,distance:Hr,"global-state":Ur};class Gr{constructor(e,t,n,r){this.name=e,this.type=t,this._evaluate=n,this.args=r}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,t){let n=e[0],r=Gr.definitions[n];if(!r)return t.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0);let i=Array.isArray(r)?r[0]:r.type,a=Array.isArray(r)?[[r[1],r[2]]]:r.overloads,o=a.filter((([t])=>!Array.isArray(t)||t.length===e.length-1)),s=null;for(let[r,a]of o){s=new gn(t.registry,Xr,t.path,null,t.scope);let o=[],c=!1;for(let t=1;t<e.length;t++){let n=e[t],i=Array.isArray(r)?r[t-1]:r.type,a=s.parse(n,1+o.length,i);if(!a){c=!0;break}o.push(a)}if(!c)if(Array.isArray(r)&&r.length!==o.length)s.error(`Expected ${r.length} arguments, but found ${o.length} instead.`);else{for(let e=0;e<o.length;e++){let t=Array.isArray(r)?r[e]:r.type,n=o[e];s.concat(e+1).checkSubtype(t,n.type)}if(s.errors.length===0)return new Gr(n,i,a,o)}}if(o.length===1)t.errors.push(...s.errors);else{let n=(o.length?o:a).map((([e])=>{return t=e,Array.isArray(t)?`(${t.map(gt).join(`, `)})`:`(${gt(t.type)}...)`;var t})).join(` | `),r=[];for(let n=1;n<e.length;n++){let i=t.parse(e[n],1+r.length);if(!i)return null;r.push(gt(i.type))}t.error(`Expected arguments of type ${n}, but found (${r.join(`, `)}) instead.`)}return null}static register(e,t){Gr.definitions=t;for(let n in t)e[n]=Gr}}function Kr(e,[t,n,r,i]){t=t.evaluate(e),n=n.evaluate(e),r=r.evaluate(e);let a=i?i.evaluate(e):1,o=an(t,n,r,a);if(o)throw new $t(o);return new Gt(t/255,n/255,r/255,a,!1)}function qr(e,t){return e in t}function Jr(e,t){let n=t[e];return n===void 0?null:n}function Yr(e){return{type:e}}function Xr(e){if(e instanceof vn)return Xr(e.boundExpression);if(e instanceof Gr&&e.name===`error`||e instanceof Wn||e instanceof pr||e instanceof Hr||e instanceof Ur)return!1;let t=e instanceof pn||e instanceof dn,n=!0;return e.eachChild((e=>{n=t?n&&Xr(e):n&&e instanceof ln})),!!n&&Zr(e)&&$r(e,[`zoom`,`heatmap-density`,`elevation`,`line-progress`,`accumulated`,`is-supported-script`])}function Zr(e){if(e instanceof Gr&&(e.name===`get`&&e.args.length===1||e.name===`feature-state`||e.name===`has`&&e.args.length===1||e.name===`properties`||e.name===`geometry-type`||e.name===`id`||/^filter-/.test(e.name))||e instanceof pr||e instanceof Hr)return!1;let t=!0;return e.eachChild((e=>{t&&!Zr(e)&&(t=!1)})),t}function Qr(e){if(e instanceof Gr&&e.name===`feature-state`)return!1;let t=!0;return e.eachChild((e=>{t&&!Qr(e)&&(t=!1)})),t}function $r(e,t){if(e instanceof Gr&&t.indexOf(e.name)>=0)return!1;let n=!0;return e.eachChild((e=>{n&&!$r(e,t)&&(n=!1)})),n}function ei(e){return{result:`success`,value:e}}function ti(e){return{result:`error`,value:e}}function ni(e){return e[`property-type`]===`data-driven`||e[`property-type`]===`cross-faded-data-driven`}function ri(e){return!!e.expression&&e.expression.parameters.indexOf(`zoom`)>-1}function ii(e){return!!e.expression&&e.expression.interpolated}function ai(e){return e instanceof Number?`number`:e instanceof String?`string`:e instanceof Boolean?`boolean`:Array.isArray(e)?`array`:e===null?`null`:typeof e}function oi(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&sn(e)===ot}function si(e){return e}function ci(e,t){let n=e.stops&&typeof e.stops[0][0]==`object`,r=n||!(n||e.property!==void 0),i=e.type||(ii(t)?`exponential`:`interval`),a=function(e){switch(e.type){case`color`:return Gt.parse;case`padding`:return Xt.parse;case`numberArray`:return Zt.parse;case`colorArray`:return Qt.parse;default:return null}}(t);if(a&&((e=Qe({},e)).stops&&(e.stops=e.stops.map((e=>[e[0],a(e[1])]))),e.default=a(e.default?e.default:t.default)),e.colorSpace&&(o=e.colorSpace)!==`rgb`&&o!==`hcl`&&o!==`lab`)throw Error(`Unknown color space: "${e.colorSpace}"`);var o;let s=function(e){switch(e){case`exponential`:return fi;case`interval`:return di;case`categorical`:return ui;case`identity`:return pi;default:throw Error(`Unknown function type "${e}"`)}}(i),c,l;if(i===`categorical`){c=Object.create(null);for(let t of e.stops)c[t[0]]=t[1];l=typeof e.stops[0][0]}if(n){let n={},r=[];for(let t=0;t<e.stops.length;t++){let i=e.stops[t],a=i[0].zoom;n[a]===void 0&&(n[a]={zoom:a,type:e.type,property:e.property,default:e.default,stops:[]},r.push(a)),n[a].stops.push([i[0].value,i[1]])}let i=[];for(let e of r)i.push([n[e].zoom,ci(n[e],t)]);let a={name:`linear`};return{kind:`composite`,interpolationType:a,interpolationFactor:jn.interpolationFactor.bind(void 0,a),zoomStops:i.map((e=>e[0])),evaluate:({zoom:n},r)=>fi({stops:i,base:e.base},t,n).evaluate(n,r)}}if(r){let n=i===`exponential`?{name:`exponential`,base:e.base===void 0?1:e.base}:null;return{kind:`camera`,interpolationType:n,interpolationFactor:jn.interpolationFactor.bind(void 0,n),zoomStops:e.stops.map((e=>e[0])),evaluate:({zoom:n})=>s(e,t,n,c,l)}}return{kind:`source`,evaluate(n,r){let i=r&&r.properties?r.properties[e.property]:void 0;return i===void 0?li(e.default,t.default):s(e,t,i,c,l)}}}function li(e,t,n){return e===void 0?t===void 0?n===void 0?void 0:n:t:e}function ui(e,t,n,r,i){return li(typeof n===i?r[n]:void 0,e.default,t.default)}function di(e,t,n){if(ai(n)!==`number`)return li(e.default,t.default);let r=e.stops.length;if(r===1||n<=e.stops[0][0])return e.stops[0][1];if(n>=e.stops[r-1][0])return e.stops[r-1][1];let i=Tn(e.stops.map((e=>e[0])),n);return e.stops[i][1]}function fi(e,t,n){let r=e.base===void 0?1:e.base;if(ai(n)!==`number`)return li(e.default,t.default);let i=e.stops.length;if(i===1||n<=e.stops[0][0])return e.stops[0][1];if(n>=e.stops[i-1][0])return e.stops[i-1][1];let a=Tn(e.stops.map((e=>e[0])),n),o=function(e,t,n,r){let i=r-n,a=e-n;return i===0?0:t===1?a/i:(t**+a-1)/(t**+i-1)}(n,r,e.stops[a][0],e.stops[a+1][0]),s=e.stops[a][1],c=e.stops[a+1][1],l=Nn[t.type]||si;return typeof s.evaluate==`function`?{evaluate(...t){let n=s.evaluate.apply(void 0,t),r=c.evaluate.apply(void 0,t);if(n!==void 0&&r!==void 0)return l(n,r,o,e.colorSpace)}}:l(s,c,o,e.colorSpace)}function pi(e,t,n){switch(t.type){case`color`:n=Gt.parse(n);break;case`formatted`:n=Yt.fromString(n.toString());break;case`resolvedImage`:n=nn.fromString(n.toString());break;case`padding`:n=Xt.parse(n);break;case`colorArray`:n=Qt.parse(n);break;case`numberArray`:n=Zt.parse(n);break;default:ai(n)===t.type||t.type===`enum`&&t.values[n]||(n=void 0)}return li(n,e.default,t.default)}Gr.register(Wr,{error:[{kind:`error`},[nt],(e,[t])=>{throw new $t(t.evaluate(e))}],typeof:[nt,[st],(e,[t])=>gt(sn(t.evaluate(e)))],"to-rgba":[ht(F,4),[it],(e,[t])=>{let[n,r,i,a]=t.evaluate(e).rgb;return[255*n,255*r,255*i,a]}],rgb:[it,[F,F,F],Kr],rgba:[it,[F,F,F,F],Kr],has:{type:rt,overloads:[[[nt],(e,[t])=>qr(t.evaluate(e),e.properties())],[[nt,ot],(e,[t,n])=>qr(t.evaluate(e),n.evaluate(e))]]},get:{type:st,overloads:[[[nt],(e,[t])=>Jr(t.evaluate(e),e.properties())],[[nt,ot],(e,[t,n])=>Jr(t.evaluate(e),n.evaluate(e))]]},"feature-state":[st,[nt],(e,[t])=>Jr(t.evaluate(e),e.featureState||{})],properties:[ot,[],e=>e.properties()],"geometry-type":[nt,[],e=>e.geometryType()],id:[st,[],e=>e.id()],zoom:[F,[],e=>e.globals.zoom],"heatmap-density":[F,[],e=>e.globals.heatmapDensity||0],elevation:[F,[],e=>e.globals.elevation||0],"line-progress":[F,[],e=>e.globals.lineProgress||0],accumulated:[st,[],e=>e.globals.accumulated===void 0?null:e.globals.accumulated],"+":[F,Yr(F),(e,t)=>{let n=0;for(let r of t)n+=r.evaluate(e);return n}],"*":[F,Yr(F),(e,t)=>{let n=1;for(let r of t)n*=r.evaluate(e);return n}],"-":{type:F,overloads:[[[F,F],(e,[t,n])=>t.evaluate(e)-n.evaluate(e)],[[F],(e,[t])=>-t.evaluate(e)]]},"/":[F,[F,F],(e,[t,n])=>t.evaluate(e)/n.evaluate(e)],"%":[F,[F,F],(e,[t,n])=>t.evaluate(e)%n.evaluate(e)],ln2:[F,[],()=>Math.LN2],pi:[F,[],()=>Math.PI],e:[F,[],()=>Math.E],"^":[F,[F,F],(e,[t,n])=>t.evaluate(e)**+n.evaluate(e)],sqrt:[F,[F],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[F,[F],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[F,[F],(e,[t])=>Math.log(t.evaluate(e))],log2:[F,[F],(e,[t])=>Math.log(t.evaluate(e))/Math.LN2],sin:[F,[F],(e,[t])=>Math.sin(t.evaluate(e))],cos:[F,[F],(e,[t])=>Math.cos(t.evaluate(e))],tan:[F,[F],(e,[t])=>Math.tan(t.evaluate(e))],asin:[F,[F],(e,[t])=>Math.asin(t.evaluate(e))],acos:[F,[F],(e,[t])=>Math.acos(t.evaluate(e))],atan:[F,[F],(e,[t])=>Math.atan(t.evaluate(e))],min:[F,Yr(F),(e,t)=>Math.min(...t.map((t=>t.evaluate(e))))],max:[F,Yr(F),(e,t)=>Math.max(...t.map((t=>t.evaluate(e))))],abs:[F,[F],(e,[t])=>Math.abs(t.evaluate(e))],round:[F,[F],(e,[t])=>{let n=t.evaluate(e);return n<0?-Math.round(-n):Math.round(n)}],floor:[F,[F],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[F,[F],(e,[t])=>Math.ceil(t.evaluate(e))],"filter-==":[rt,[nt,st],(e,[t,n])=>e.properties()[t.value]===n.value],"filter-id-==":[rt,[st],(e,[t])=>e.id()===t.value],"filter-type-==":[rt,[nt],(e,[t])=>e.geometryType()===t.value],"filter-<":[rt,[nt,st],(e,[t,n])=>{let r=e.properties()[t.value],i=n.value;return typeof r==typeof i&&r<i}],"filter-id-<":[rt,[st],(e,[t])=>{let n=e.id(),r=t.value;return typeof n==typeof r&&n<r}],"filter->":[rt,[nt,st],(e,[t,n])=>{let r=e.properties()[t.value],i=n.value;return typeof r==typeof i&&r>i}],"filter-id->":[rt,[st],(e,[t])=>{let n=e.id(),r=t.value;return typeof n==typeof r&&n>r}],"filter-<=":[rt,[nt,st],(e,[t,n])=>{let r=e.properties()[t.value],i=n.value;return typeof r==typeof i&&r<=i}],"filter-id-<=":[rt,[st],(e,[t])=>{let n=e.id(),r=t.value;return typeof n==typeof r&&n<=r}],"filter->=":[rt,[nt,st],(e,[t,n])=>{let r=e.properties()[t.value],i=n.value;return typeof r==typeof i&&r>=i}],"filter-id->=":[rt,[st],(e,[t])=>{let n=e.id(),r=t.value;return typeof n==typeof r&&n>=r}],"filter-has":[rt,[st],(e,[t])=>t.value in e.properties()],"filter-has-id":[rt,[],e=>e.id()!==null&&e.id()!==void 0],"filter-type-in":[rt,[ht(nt)],(e,[t])=>t.value.indexOf(e.geometryType())>=0],"filter-id-in":[rt,[ht(st)],(e,[t])=>t.value.indexOf(e.id())>=0],"filter-in-small":[rt,[nt,ht(st)],(e,[t,n])=>n.value.indexOf(e.properties()[t.value])>=0],"filter-in-large":[rt,[nt,ht(st)],(e,[t,n])=>function(e,t,n,r){for(;n<=r;){let i=n+r>>1;if(t[i]===e)return!0;t[i]>e?r=i-1:n=i+1}return!1}(e.properties()[t.value],n.value,0,n.value.length-1)],all:{type:rt,overloads:[[[rt,rt],(e,[t,n])=>t.evaluate(e)&&n.evaluate(e)],[Yr(rt),(e,t)=>{for(let n of t)if(!n.evaluate(e))return!1;return!0}]]},any:{type:rt,overloads:[[[rt,rt],(e,[t,n])=>t.evaluate(e)||n.evaluate(e)],[Yr(rt),(e,t)=>{for(let n of t)if(n.evaluate(e))return!0;return!1}]]},"!":[rt,[rt],(e,[t])=>!t.evaluate(e)],"is-supported-script":[rt,[nt],(e,[t])=>{let n=e.globals&&e.globals.isSupportedScript;return!n||n(t.evaluate(e))}],upcase:[nt,[nt],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[nt,[nt],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[nt,Yr(st),(e,t)=>t.map((t=>cn(t.evaluate(e)))).join(``)],split:[ht(nt),[nt,nt],(e,[t,n])=>t.evaluate(e).split(n.evaluate(e))],join:[nt,[ht(nt),nt],(e,[t,n])=>t.evaluate(e).join(n.evaluate(e))],"resolved-locale":[nt,[ct],(e,[t])=>t.evaluate(e).resolvedLocale()]});class mi{constructor(e,t,n){this.expression=e,this._warningHistory={},this._evaluator=new hn,this._defaultValue=t?function(e){if(e.type===`color`&&oi(e.default))return new Gt(0,0,0,0);switch(e.type){case`color`:return Gt.parse(e.default)||null;case`padding`:return Xt.parse(e.default)||null;case`numberArray`:return Zt.parse(e.default)||null;case`colorArray`:return Qt.parse(e.default)||null;case`variableAnchorOffsetCollection`:return tn.parse(e.default)||null;case`projectionDefinition`:return rn.parse(e.default)||null;default:return e.default===void 0?null:e.default}}(t):null,this._enumValues=t&&t.type===`enum`?t.values:null,this._globalState=n}evaluateWithoutErrorHandling(e,t,n,r,i,a){return this._globalState&&(e=Si(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=n,this._evaluator.canonical=r,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=a,this.expression.evaluate(this._evaluator)}evaluate(e,t,n,r,i,a){this._globalState&&(e=Si(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=n||null,this._evaluator.canonical=r,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=a||null;try{let e=this.expression.evaluate(this._evaluator);if(e==null||typeof e==`number`&&e!=e)return this._defaultValue;if(this._enumValues&&!(e in this._enumValues))throw new $t(`Expected value to be one of ${Object.keys(this._enumValues).map((e=>JSON.stringify(e))).join(`, `)}, but found ${JSON.stringify(e)} instead.`);return e}catch(e){return this._warningHistory[e.message]||(this._warningHistory[e.message]=!0,typeof console<`u`&&console.warn(e.message)),this._defaultValue}}}function hi(e){return Array.isArray(e)&&e.length>0&&typeof e[0]==`string`&&e[0]in Wr}function gi(e,t,n){let r=new gn(Wr,Xr,[],t?function(e){let t={color:it,string:nt,number:F,enum:nt,boolean:rt,formatted:lt,padding:ut,numberArray:ft,colorArray:dt,projectionDefinition:at,resolvedImage:pt,variableAnchorOffsetCollection:mt};return e.type===`array`?ht(t[e.value]||st,e.length):t[e.type]}(t):void 0),i=r.parse(e,void 0,void 0,void 0,t&&t.type===`string`?{typeAnnotation:`coerce`}:void 0);return i?ei(new mi(i,t,n)):ti(r.errors)}class _i{constructor(e,t,n){this.kind=e,this._styleExpression=t,this.isStateDependent=e!==`constant`&&!Qr(t.expression),this.globalStateRefs=xi(t.expression),this._globalState=n}evaluateWithoutErrorHandling(e,t,n,r,i,a){return this._globalState&&(e=Si(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,t,n,r,i,a)}evaluate(e,t,n,r,i,a){return this._globalState&&(e=Si(e,this._globalState)),this._styleExpression.evaluate(e,t,n,r,i,a)}}class vi{constructor(e,t,n,r,i){this.kind=e,this.zoomStops=n,this._styleExpression=t,this.isStateDependent=e!==`camera`&&!Qr(t.expression),this.globalStateRefs=xi(t.expression),this.interpolationType=r,this._globalState=i}evaluateWithoutErrorHandling(e,t,n,r,i,a){return this._globalState&&(e=Si(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,t,n,r,i,a)}evaluate(e,t,n,r,i,a){return this._globalState&&(e=Si(e,this._globalState)),this._styleExpression.evaluate(e,t,n,r,i,a)}interpolationFactor(e,t,n){return this.interpolationType?jn.interpolationFactor(this.interpolationType,e,t,n):0}}function yi(e,t,n){let r=gi(e,t,n);if(r.result===`error`)return r;let i=r.value.expression,a=Zr(i);if(!a&&!ni(t))return ti([new $e(``,`data expressions not supported`)]);let o=$r(i,[`zoom`]);if(!o&&!ri(t))return ti([new $e(``,`zoom expressions not supported`)]);let s=bi(i);return s||o?s instanceof $e?ti([s]):s instanceof jn&&!ii(t)?ti([new $e(``,`"interpolate" expressions cannot be used with this property`)]):ei(s?new vi(a?`camera`:`composite`,r.value,s.labels,s instanceof jn?s.interpolation:void 0,n):new _i(a?`constant`:`source`,r.value,n)):ti([new $e(``,`"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.`)])}class B{constructor(e,t){this._parameters=e,this._specification=t,Qe(this,ci(this._parameters,this._specification))}static deserialize(e){return new B(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function bi(e){let t=null;if(e instanceof _n)t=bi(e.result);else if(e instanceof Pn){for(let n of e.args)if(t=bi(n),t)break}else(e instanceof En||e instanceof jn)&&e.input instanceof Gr&&e.input.name===`zoom`&&(t=e);return t instanceof $e||e.eachChild((e=>{let n=bi(e);n instanceof $e?t=n:!t&&n?t=new $e(``,`"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.`):t&&n&&t!==n&&(t=new $e(``,`Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.`))})),t}function xi(e,t=new Set){return e instanceof Ur&&t.add(e.key),e.eachChild((e=>{xi(e,t)})),t}function Si(e,t){let{zoom:n,heatmapDensity:r,elevation:i,lineProgress:a,isSupportedScript:o,accumulated:s}=e??{};return{zoom:n,heatmapDensity:r,elevation:i,lineProgress:a,isSupportedScript:o,accumulated:s,globalState:t}}function Ci(e){if(!0===e||!1===e)return!0;if(!Array.isArray(e)||e.length===0)return!1;switch(e[0]){case`has`:return e.length>=2&&e[1]!==`$id`&&e[1]!==`$type`;case`in`:return e.length>=3&&(typeof e[1]!=`string`||Array.isArray(e[2]));case`!in`:case`!has`:case`none`:return!1;case`==`:case`!=`:case`>`:case`>=`:case`<`:case`<=`:return e.length!==3||Array.isArray(e[1])||Array.isArray(e[2]);case`any`:case`all`:for(let t of e.slice(1))if(!Ci(t)&&typeof t!=`boolean`)return!1;return!0;default:return!0}}let wi={type:`boolean`,default:!1,transition:!1,"property-type":`data-driven`,expression:{interpolated:!1,parameters:[`zoom`,`feature`]}};function V(e,t){if(e==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};Ci(e)||(e=U(e));let n=gi(e,wi,t);if(n.result===`error`)throw Error(n.value.map((e=>`${e.key}: ${e.message}`)).join(`, `));return{filter:(e,t,r)=>n.value.evaluate(e,t,{},r),needGeometry:H(e),getGlobalStateRefs:()=>xi(n.value.expression)}}function Ti(e,t){return e<t?-1:+(e>t)}function H(e){if(!Array.isArray(e))return!1;if(e[0]===`within`||e[0]===`distance`)return!0;for(let t=1;t<e.length;t++)if(H(e[t]))return!0;return!1}function U(e){if(!e)return!0;let t=e[0];return e.length<=1?t!==`any`:t===`==`?Ei(e[1],e[2],`==`):t===`!=`?ki(Ei(e[1],e[2],`==`)):t===`<`||t===`>`||t===`<=`||t===`>=`?Ei(e[1],e[2],t):t===`any`?(n=e.slice(1),[`any`].concat(n.map(U))):t===`all`?[`all`].concat(e.slice(1).map(U)):t===`none`?[`all`].concat(e.slice(1).map(U).map(ki)):t===`in`?Di(e[1],e.slice(2)):t===`!in`?ki(Di(e[1],e.slice(2))):t===`has`?Oi(e[1]):t!==`!has`||ki(Oi(e[1]));var n}function Ei(e,t,n){switch(e){case`$type`:return[`filter-type-${n}`,t];case`$id`:return[`filter-id-${n}`,t];default:return[`filter-${n}`,e,t]}}function Di(e,t){if(t.length===0)return!1;switch(e){case`$type`:return[`filter-type-in`,[`literal`,t]];case`$id`:return[`filter-id-in`,[`literal`,t]];default:return t.length>200&&!t.some((e=>typeof e!=typeof t[0]))?[`filter-in-large`,e,[`literal`,t.sort(Ti)]]:[`filter-in-small`,e,[`literal`,t]]}}function Oi(e){switch(e){case`$type`:return!0;case`$id`:return[`filter-has-id`];default:return[`filter-has`,e]}}function ki(e){return[`!`,e]}function Ai(e){let t=typeof e;if(t===`number`||t===`boolean`||t===`string`||e==null)return JSON.stringify(e);if(Array.isArray(e)){let t=`[`;for(let n of e)t+=`${Ai(n)},`;return`${t}]`}let n=Object.keys(e).sort(),r=`{`;for(let t=0;t<n.length;t++)r+=`${JSON.stringify(n[t])}:${Ai(e[n[t]])},`;return`${r}}`}function ji(e){let t=``;for(let n of Ve)t+=`/${Ai(e[n])}`;return t}function Mi(e){let t=e.value;return t?[new P(e.key,t,`constants have been deprecated as of v8`)]:[]}function Ni(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function Pi(e){if(Array.isArray(e))return e.map(Pi);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){let t={};for(let n in e)t[n]=Pi(e[n]);return t}return Ni(e)}function Fi(e){let t=e.key,n=e.value,r=e.valueSpec||{},i=e.objectElementValidators||{},a=e.style,o=e.styleSpec,s=e.validateSpec,c=[],l=ai(n);if(l!==`object`)return[new P(t,n,`object expected, ${l} found`)];for(let e in n){let l=e.split(`.`)[0],u=Lt(r,l)||r[`*`],d;if(Lt(i,l))d=i[l];else if(Lt(r,l)){if(n[e]===void 0)continue;d=s}else if(i[`*`])d=i[`*`];else{if(!r[`*`]){c.push(new P(t,n[e],`unknown property "${e}"`));continue}d=s}c=c.concat(d({key:(t&&`${t}.`)+e,value:n[e],valueSpec:u,style:a,styleSpec:o,object:n,objectKey:e,validateSpec:s},n))}for(let e in r)i[e]||r[e].required&&r[e].default===void 0&&n[e]===void 0&&c.push(new P(t,n,`missing required property "${e}"`));return c}function Ii(e){let t=e.value,n=e.valueSpec,r=e.style,i=e.styleSpec,a=e.key,o=e.arrayElementValidator||e.validateSpec;if(ai(t)!==`array`)return[new P(a,t,`array expected, ${ai(t)} found`)];if(n.length&&t.length!==n.length)return[new P(a,t,`array length ${n.length} expected, length ${t.length} found`)];let s={type:n.value,values:n.values};i.$version<7&&(s.function=n.function),ai(n.value)===`object`&&(s=n.value);let c=[];for(let n=0;n<t.length;n++)c=c.concat(o({array:t,arrayIndex:n,value:t[n],valueSpec:s,validateSpec:e.validateSpec,style:r,styleSpec:i,key:`${a}[${n}]`}));return c}function Li(e){let t=e.key,n=e.value,r=e.valueSpec,i=ai(n);return i===`number`&&n!=n&&(i=`NaN`),i===`number`?`minimum`in r&&n<r.minimum?[new P(t,n,`${n} is less than the minimum value ${r.minimum}`)]:`maximum`in r&&n>r.maximum?[new P(t,n,`${n} is greater than the maximum value ${r.maximum}`)]:[]:[new P(t,n,`number expected, ${i} found`)]}function Ri(e){let t=e.valueSpec,n=Ni(e.value.type),r,i,a,o={},s=n!==`categorical`&&e.value.property===void 0,c=!s,l=ai(e.value.stops)===`array`&&ai(e.value.stops[0])===`array`&&ai(e.value.stops[0][0])===`object`,u=Fi({key:e.key,value:e.value,valueSpec:e.styleSpec.function,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{stops:function(e){if(n===`identity`)return[new P(e.key,e.value,`identity function may not have a "stops" property`)];let t=[],r=e.value;return t=t.concat(Ii({key:e.key,value:r,valueSpec:e.valueSpec,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,arrayElementValidator:d})),ai(r)===`array`&&r.length===0&&t.push(new P(e.key,r,`array must have at least one stop`)),t},default:function(e){return e.validateSpec({key:e.key,value:e.value,valueSpec:t,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec})}}});return n===`identity`&&s&&u.push(new P(e.key,e.value,`missing required property "property"`)),n===`identity`||e.value.stops||u.push(new P(e.key,e.value,`missing required property "stops"`)),n===`exponential`&&e.valueSpec.expression&&!ii(e.valueSpec)&&u.push(new P(e.key,e.value,`exponential functions not supported`)),e.styleSpec.$version>=8&&(c&&!ni(e.valueSpec)?u.push(new P(e.key,e.value,`property functions not supported`)):s&&!ri(e.valueSpec)&&u.push(new P(e.key,e.value,`zoom functions not supported`))),n!==`categorical`&&!l||e.value.property!==void 0||u.push(new P(e.key,e.value,`"property" property is required`)),u;function d(e){let n=[],r=e.value,s=e.key;if(ai(r)!==`array`)return[new P(s,r,`array expected, ${ai(r)} found`)];if(r.length!==2)return[new P(s,r,`array length 2 expected, length ${r.length} found`)];if(l){if(ai(r[0])!==`object`)return[new P(s,r,`object expected, ${ai(r[0])} found`)];if(r[0].zoom===void 0)return[new P(s,r,`object stop key must have zoom`)];if(r[0].value===void 0)return[new P(s,r,`object stop key must have value`)];if(a&&a>Ni(r[0].zoom))return[new P(s,r[0].zoom,`stop zoom values must appear in ascending order`)];Ni(r[0].zoom)!==a&&(a=Ni(r[0].zoom),i=void 0,o={}),n=n.concat(Fi({key:`${s}[0]`,value:r[0],valueSpec:{zoom:{}},validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{zoom:Li,value:f}}))}else n=n.concat(f({key:`${s}[0]`,value:r[0],validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec},r));return hi(Pi(r[1]))?n.concat([new P(`${s}[1]`,r[1],`expressions are not allowed in function stops.`)]):n.concat(e.validateSpec({key:`${s}[1]`,value:r[1],valueSpec:t,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec}))}function f(e,a){let s=ai(e.value),c=Ni(e.value),l=e.value===null?a:e.value;if(r){if(s!==r)return[new P(e.key,l,`${s} stop domain type must match previous stop domain type ${r}`)]}else r=s;if(s!==`number`&&s!==`string`&&s!==`boolean`)return[new P(e.key,l,`stop domain value must be a number, string, or boolean`)];if(s!==`number`&&n!==`categorical`){let r=`number expected, ${s} found`;return ni(t)&&n===void 0&&(r+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new P(e.key,l,r)]}return n!==`categorical`||s!==`number`||isFinite(c)&&Math.floor(c)===c?n!==`categorical`&&s===`number`&&i!==void 0&&c<i?[new P(e.key,l,`stop domain values must appear in ascending order`)]:(i=c,n===`categorical`&&c in o?[new P(e.key,l,`stop domain values must be unique`)]:(o[c]=!0,[])):[new P(e.key,l,`integer expected, found ${c}`)]}}function zi(e){let t=(e.expressionContext===`property`?yi:gi)(Pi(e.value),e.valueSpec);if(t.result===`error`)return t.value.map((t=>new P(`${e.key}${t.key}`,e.value,t.message)));let n=t.value.expression||t.value._styleExpression.expression;if(e.expressionContext===`property`&&e.propertyKey===`text-font`&&!n.outputDefined())return[new P(e.key,e.value,`Invalid data expression for "${e.propertyKey}". Output values must be contained as literals within the expression.`)];if(e.expressionContext===`property`&&e.propertyType===`layout`&&!Qr(n))return[new P(e.key,e.value,`"feature-state" data expressions are not supported with layout properties.`)];if(e.expressionContext===`filter`&&!Qr(n))return[new P(e.key,e.value,`"feature-state" data expressions are not supported with filters.`)];if(e.expressionContext&&e.expressionContext.indexOf(`cluster`)===0){if(!$r(n,[`zoom`,`feature-state`]))return[new P(e.key,e.value,`"zoom" and "feature-state" expressions are not supported with cluster properties.`)];if(e.expressionContext===`cluster-initial`&&!Zr(n))return[new P(e.key,e.value,`Feature data expressions are not supported with initial expression part of cluster properties.`)]}return[]}function Bi(e){let t=e.key,n=e.value,r=ai(n);return r===`string`?Gt.parse(String(n))?[]:[new P(t,n,`color expected, "${n}" found`)]:[new P(t,n,`color expected, ${r} found`)]}function Vi(e){let t=e.key,n=e.value,r=e.valueSpec,i=[];return Array.isArray(r.values)?r.values.indexOf(Ni(n))===-1&&i.push(new P(t,n,`expected one of [${r.values.join(`, `)}], ${JSON.stringify(n)} found`)):Object.keys(r.values).indexOf(Ni(n))===-1&&i.push(new P(t,n,`expected one of [${Object.keys(r.values).join(`, `)}], ${JSON.stringify(n)} found`)),i}function Hi(e){return Ci(Pi(e.value))?zi(Qe({},e,{expressionContext:`filter`,valueSpec:{value:`boolean`}})):Ui(e)}function Ui(e){let t=e.value,n=e.key;if(ai(t)!==`array`)return[new P(n,t,`array expected, ${ai(t)} found`)];let r=e.styleSpec,i,a=[];if(t.length<1)return[new P(n,t,`filter array must have at least 1 element`)];switch(a=a.concat(Vi({key:`${n}[0]`,value:t[0],valueSpec:r.filter_operator,style:e.style,styleSpec:e.styleSpec})),Ni(t[0])){case`<`:case`<=`:case`>`:case`>=`:t.length>=2&&Ni(t[1])===`$type`&&a.push(new P(n,t,`"$type" cannot be use with operator "${t[0]}"`));case`==`:case`!=`:t.length!==3&&a.push(new P(n,t,`filter array for operator "${t[0]}" must have 3 elements`));case`in`:case`!in`:t.length>=2&&(i=ai(t[1]),i!==`string`&&a.push(new P(`${n}[1]`,t[1],`string expected, ${i} found`)));for(let o=2;o<t.length;o++)i=ai(t[o]),Ni(t[1])===`$type`?a=a.concat(Vi({key:`${n}[${o}]`,value:t[o],valueSpec:r.geometry_type,style:e.style,styleSpec:e.styleSpec})):i!==`string`&&i!==`number`&&i!==`boolean`&&a.push(new P(`${n}[${o}]`,t[o],`string, number, or boolean expected, ${i} found`));break;case`any`:case`all`:case`none`:for(let r=1;r<t.length;r++)a=a.concat(Ui({key:`${n}[${r}]`,value:t[r],style:e.style,styleSpec:e.styleSpec}));break;case`has`:case`!has`:i=ai(t[1]),t.length===2?i!==`string`&&a.push(new P(`${n}[1]`,t[1],`string expected, ${i} found`)):a.push(new P(n,t,`filter array for "${t[0]}" operator must have 2 elements`))}return a}function Wi(e,t){let n=e.key,r=e.validateSpec,i=e.style,a=e.styleSpec,o=e.value,s=e.objectKey,c=a[`${t}_${e.layerType}`];if(!c)return[];let l=s.match(/^(.*)-transition$/);if(t===`paint`&&l&&c[l[1]]&&c[l[1]].transition)return r({key:n,value:o,valueSpec:a.transition,style:i,styleSpec:a});let u=e.valueSpec||c[s];if(!u)return[new P(n,o,`unknown property "${s}"`)];let d;if(ai(o)===`string`&&ni(u)&&!u.tokens&&(d=/^{([^}]+)}$/.exec(o)))return[new P(n,o,`"${s}" does not support interpolation syntax\nUse an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(d[1])} }\`.`)];let f=[];return e.layerType===`symbol`&&s===`text-font`&&oi(Pi(o))&&Ni(o.type)===`identity`&&f.push(new P(n,o,`"text-font" does not support identity functions`)),f.concat(r({key:e.key,value:o,valueSpec:u,style:i,styleSpec:a,expressionContext:`property`,propertyType:t,propertyKey:s}))}function Gi(e){return Wi(e,`paint`)}function Ki(e){return Wi(e,`layout`)}function qi(e){var t,n;let r=[],i=e.value,a=e.key,o=e.style,s=e.styleSpec;if(ai(i)!==`object`)return[new P(a,i,`object expected, ${ai(i)} found`)];i.type||i.ref||r.push(new P(a,i,`either "type" or "ref" is required`));let c=Ni(i.type),l=Ni(i.ref);if(i.id){let t=Ni(i.id);for(let n=0;n<e.arrayIndex;n++){let e=o.layers[n];Ni(e.id)===t&&r.push(new P(a,i.id,`duplicate layer id "${i.id}", previously used at line ${e.id.__line__}`))}}if(`ref`in i){let e;[`type`,`source`,`source-layer`,`filter`,`layout`].forEach((e=>{e in i&&r.push(new P(a,i[e],`"${e}" is prohibited for ref layers`))})),o.layers.forEach((t=>{Ni(t.id)===l&&(e=t)})),e?e.ref?r.push(new P(a,i.ref,`ref cannot reference another ref layer`)):c=Ni(e.type):r.push(new P(a,i.ref,`ref layer "${l}" not found`))}else if(c!==`background`)if(i.source){let e=o.sources&&o.sources[i.source],t=e&&Ni(e.type);e?t===`vector`&&c===`raster`?r.push(new P(a,i.source,`layer "${i.id}" requires a raster source`)):t!==`raster-dem`&&c===`hillshade`||t!==`raster-dem`&&c===`color-relief`?r.push(new P(a,i.source,`layer "${i.id}" requires a raster-dem source`)):t===`raster`&&c!==`raster`?r.push(new P(a,i.source,`layer "${i.id}" requires a vector source`)):t!==`vector`||i[`source-layer`]?t===`raster-dem`&&c!==`hillshade`&&c!==`color-relief`?r.push(new P(a,i.source,`raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.`)):c!==`line`||!i.paint||!i.paint[`line-gradient`]||t===`geojson`&&e.lineMetrics||r.push(new P(a,i,`layer "${i.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):r.push(new P(a,i,`layer "${i.id}" must specify a "source-layer"`)):r.push(new P(a,i.source,`source "${i.source}" not found`))}else r.push(new P(a,i,`missing required property "source"`));return c===`raster`&&(t=i.paint)!=null&&t.resampling&&(n=i.paint)!=null&&n[`raster-resampling`]&&r.push(new P(a,i.paint,`layer "${i.id}" redundantly specifies "resampling" and "raster-resampling" paint properties, but only one is allowed. It is advised to use "resampling".`)),r=r.concat(Fi({key:a,value:i,valueSpec:s.layer,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":()=>[],type:()=>e.validateSpec({key:`${a}.type`,value:i.type,valueSpec:s.layer.type,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,object:i,objectKey:`type`}),filter:Hi,layout:e=>Fi({layer:i,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":e=>Ki(Qe({layerType:c},e))}}),paint:e=>Fi({layer:i,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":e=>Gi(Qe({layerType:c},e))}})}})),r}function W(e){let t=e.value,n=e.key,r=ai(t);return r===`string`?[]:[new P(n,t,`string expected, ${r} found`)]}let Ji={promoteId:function({key:e,value:t}){if(ai(t)===`string`)return W({key:e,value:t});{let n=[];for(let r in t)n.push(...W({key:`${e}.${r}`,value:t[r]}));return n}}};function Yi(e){let t=e.value,n=e.key,r=e.styleSpec,i=e.style,a=e.validateSpec;if(!t.type)return[new P(n,t,`"type" is required`)];let o=Ni(t.type),s;switch(o){case`vector`:case`raster`:return s=Fi({key:n,value:t,valueSpec:r[`source_${o.replace(`-`,`_`)}`],style:e.style,styleSpec:r,objectElementValidators:Ji,validateSpec:a}),s;case`raster-dem`:return s=function(e){let t=e.sourceName??``,n=e.value,r=e.styleSpec,i=r.source_raster_dem,a=e.style,o=[],s=ai(n);if(n===void 0)return o;if(s!==`object`)return o.push(new P(`source_raster_dem`,n,`object expected, ${s} found`)),o;let c=Ni(n.encoding)===`custom`,l=[`redFactor`,`greenFactor`,`blueFactor`,`baseShift`],u=e.value.encoding?`"${e.value.encoding}"`:`Default`;for(let s in n)!c&&l.includes(s)?o.push(new P(s,n[s],`In "${t}": "${s}" is only valid when "encoding" is set to "custom". ${u} encoding found`)):i[s]?o=o.concat(e.validateSpec({key:s,value:n[s],valueSpec:i[s],validateSpec:e.validateSpec,style:a,styleSpec:r})):o.push(new P(s,n[s],`unknown property "${s}"`));return o}({sourceName:n,value:t,style:e.style,styleSpec:r,validateSpec:a}),s;case`geojson`:if(s=Fi({key:n,value:t,valueSpec:r.source_geojson,style:i,styleSpec:r,validateSpec:a,objectElementValidators:Ji}),t.cluster)for(let e in t.clusterProperties){let[r,i]=t.clusterProperties[e],a=typeof r==`string`?[r,[`accumulated`],[`get`,e]]:r;s.push(...zi({key:`${n}.${e}.map`,value:i,expressionContext:`cluster-map`})),s.push(...zi({key:`${n}.${e}.reduce`,value:a,expressionContext:`cluster-reduce`}))}return s;case`video`:return Fi({key:n,value:t,valueSpec:r.source_video,style:i,validateSpec:a,styleSpec:r});case`image`:return Fi({key:n,value:t,valueSpec:r.source_image,style:i,validateSpec:a,styleSpec:r});case`canvas`:return[new P(n,null,`Please use runtime APIs to add canvas sources, rather than including them in stylesheets.`,`source.canvas`)];default:return Vi({key:`${n}.type`,value:t.type,valueSpec:{values:[`vector`,`raster`,`raster-dem`,`geojson`,`video`,`image`]}})}}function Xi(e){let t=e.value,n=e.styleSpec,r=n.light,i=e.style,a=[],o=ai(t);if(t===void 0)return a;if(o!==`object`)return a=a.concat([new P(`light`,t,`object expected, ${o} found`)]),a;for(let o in t){let s=o.match(/^(.*)-transition$/);a=a.concat(s&&r[s[1]]&&r[s[1]].transition?e.validateSpec({key:o,value:t[o],valueSpec:n.transition,validateSpec:e.validateSpec,style:i,styleSpec:n}):r[o]?e.validateSpec({key:o,value:t[o],valueSpec:r[o],validateSpec:e.validateSpec,style:i,styleSpec:n}):[new P(o,t[o],`unknown property "${o}"`)])}return a}function Zi(e){let t=e.value,n=e.styleSpec,r=n.sky,i=e.style,a=ai(t);if(t===void 0)return[];if(a!==`object`)return[new P(`sky`,t,`object expected, ${a} found`)];let o=[];for(let a in t)o=o.concat(r[a]?e.validateSpec({key:a,value:t[a],valueSpec:r[a],style:i,styleSpec:n}):[new P(a,t[a],`unknown property "${a}"`)]);return o}function Qi(e){let t=e.value,n=e.styleSpec,r=n.terrain,i=e.style,a=[],o=ai(t);if(t===void 0)return a;if(o!==`object`)return a=a.concat([new P(`terrain`,t,`object expected, ${o} found`)]),a;for(let o in t)a=a.concat(r[o]?e.validateSpec({key:o,value:t[o],valueSpec:r[o],validateSpec:e.validateSpec,style:i,styleSpec:n}):[new P(o,t[o],`unknown property "${o}"`)]);return a}function $i(e){let t=[],n=e.value,r=e.key;if(Array.isArray(n)){let i=[],a=[];for(let o in n)n[o].id&&i.includes(n[o].id)&&t.push(new P(r,n,`all the sprites' ids must be unique, but ${n[o].id} is duplicated`)),i.push(n[o].id),n[o].url&&a.includes(n[o].url)&&t.push(new P(r,n,`all the sprites' URLs must be unique, but ${n[o].url} is duplicated`)),a.push(n[o].url),t=t.concat(Fi({key:`${r}[${o}]`,value:n[o],valueSpec:{id:{type:`string`,required:!0},url:{type:`string`,required:!0}},validateSpec:e.validateSpec}));return t}return W({key:r,value:n})}function ea(e){return!!e&&e.constructor===Object}function ta(e){return ea(e.value)?[]:[new P(e.key,e.value,`object expected, ${ai(e.value)} found`)]}let na={"*":()=>[],array:Ii,boolean:function(e){let t=e.value,n=e.key,r=ai(t);return r===`boolean`?[]:[new P(n,t,`boolean expected, ${r} found`)]},number:Li,color:Bi,constants:Mi,enum:Vi,filter:Hi,function:Ri,layer:qi,object:Fi,source:Yi,light:Xi,sky:Zi,terrain:Qi,projection:function(e){let t=e.value,n=e.styleSpec,r=n.projection,i=e.style,a=ai(t);if(t===void 0)return[];if(a!==`object`)return[new P(`projection`,t,`object expected, ${a} found`)];let o=[];for(let a in t)o=o.concat(r[a]?e.validateSpec({key:a,value:t[a],valueSpec:r[a],style:i,styleSpec:n}):[new P(a,t[a],`unknown property "${a}"`)]);return o},projectionDefinition:function(e){let t=e.key,n=e.value;n=n instanceof String?n.valueOf():n;let r=ai(n);return r!==`array`||function(e){return Array.isArray(e)&&e.length===3&&typeof e[0]==`string`&&typeof e[1]==`string`&&typeof e[2]==`number`}(n)||function(e){return!![`interpolate`,`step`,`literal`].includes(e[0])}(n)?[`array`,`string`].includes(r)?[]:[new P(t,n,`projection expected, invalid type "${r}" found`)]:[new P(t,n,`projection expected, invalid array ${JSON.stringify(n)} found`)]},string:W,formatted:function(e){return W(e).length===0?[]:zi(e)},resolvedImage:function(e){return W(e).length===0?[]:zi(e)},padding:function(e){let t=e.key,n=e.value;if(ai(n)===`array`){if(n.length<1||n.length>4)return[new P(t,n,`padding requires 1 to 4 values; ${n.length} values found`)];let r={type:`number`},i=[];for(let a=0;a<n.length;a++)i=i.concat(e.validateSpec({key:`${t}[${a}]`,value:n[a],validateSpec:e.validateSpec,valueSpec:r}));return i}return Li({key:t,value:n,valueSpec:{}})},numberArray:function(e){let t=e.key,n=e.value;if(ai(n)===`array`){let r={type:`number`};if(n.length<1)return[new P(t,n,`array length at least 1 expected, length 0 found`)];let i=[];for(let a=0;a<n.length;a++)i=i.concat(e.validateSpec({key:`${t}[${a}]`,value:n[a],validateSpec:e.validateSpec,valueSpec:r}));return i}return Li({key:t,value:n,valueSpec:{}})},colorArray:function(e){let t=e.key,n=e.value;if(ai(n)===`array`){if(n.length<1)return[new P(t,n,`array length at least 1 expected, length 0 found`)];let e=[];for(let r=0;r<n.length;r++)e=e.concat(Bi({key:`${t}[${r}]`,value:n[r]}));return e}return Bi({key:t,value:n})},variableAnchorOffsetCollection:function(e){let t=e.key,n=e.value,r=ai(n),i=e.styleSpec;if(r!==`array`||n.length<1||n.length%2!=0)return[new P(t,n,`variableAnchorOffsetCollection requires a non-empty array of even length`)];let a=[];for(let r=0;r<n.length;r+=2)a=a.concat(Vi({key:`${t}[${r}]`,value:n[r],valueSpec:i.layout_symbol[`text-anchor`]})),a=a.concat(Ii({key:`${t}[${r+1}]`,value:n[r+1],valueSpec:{length:2,value:`number`},validateSpec:e.validateSpec,style:e.style,styleSpec:i}));return a},sprite:$i,state:ta,fontFaces:function(e){let t=e.key,n=e.value,r=e.validateSpec,i=e.styleSpec,a=e.style;if(!ea(n))return[new P(t,n,`object expected, ${ai(n)} found`)];let o=[];for(let e in n){let s=n[e],c=ai(s);if(c===`string`)o.push(...W({key:`${t}.${e}`,value:s}));else if(c===`array`){let n={url:{type:`string`,required:!0},"unicode-range":{type:`array`,value:`string`}};for(let[c,l]of s.entries())o.push(...Fi({key:`${t}.${e}[${c}]`,value:l,valueSpec:n,styleSpec:i,style:a,validateSpec:r}))}else o.push(new P(`${t}.${e}`,s,`string or array expected, ${c} found`))}return o}};function ra(e){let t=e.value,n=e.valueSpec,r=e.styleSpec;return e.validateSpec=ra,n.expression&&oi(Ni(t))?Ri(e):n.expression&&hi(Pi(t))?zi(e):n.type&&na[n.type]?na[n.type](e):Fi(Qe({},e,{valueSpec:n.type?r[n.type]:n}))}function ia(e){let t=e.value,n=e.key,r=W(e);return r.length||(t.indexOf(`{fontstack}`)===-1&&r.push(new P(n,t,`"glyphs" url must include a "{fontstack}" token`)),t.indexOf(`{range}`)===-1&&r.push(new P(n,t,`"glyphs" url must include a "{range}" token`))),r}function aa(e,t=N){let n=[];return n=n.concat(ra({key:``,value:e,valueSpec:t.$root,styleSpec:t,style:e,validateSpec:ra,objectElementValidators:{glyphs:ia,"*":()=>[]}})),e.constants&&(n=n.concat(Mi({key:`constants`,value:e.constants}))),sa(n)}function oa(e){return function(t){return e(Object.assign({},t,{validateSpec:ra}))}}function sa(e){return[].concat(e).sort(((e,t)=>e.line-t.line))}function ca(e){return function(...t){return sa(e.apply(this,t))}}aa.source=ca(oa(Yi)),aa.sprite=ca(oa($i)),aa.glyphs=ca(oa(ia)),aa.light=ca(oa(Xi)),aa.sky=ca(oa(Zi)),aa.terrain=ca(oa(Qi)),aa.state=ca(oa(ta)),aa.layer=ca(oa(qi)),aa.filter=ca(oa(Hi)),aa.paintProperty=ca(oa(Gi)),aa.layoutProperty=ca(oa(Ki));let la={type:`enum`,"property-type":`data-constant`,expression:{interpolated:!1,parameters:[`global-state`]},values:{visible:{},none:{}},transition:!1,default:`visible`};class ua{constructor(e,t){this._globalState=t,this.setValue(e)}evaluate(){return this._literalValue??this._compiledValue.evaluate({})}setValue(e){if(e==null||e===`visible`||e===`none`)return this._literalValue=e===`none`?`none`:`visible`,this._compiledValue=void 0,void(this._globalStateRefs=new Set);let t=gi(e,la,this._globalState);if(t.result===`error`)throw this._literalValue=`visible`,this._compiledValue=void 0,Error(t.value.map((e=>`${e.key}: ${e.message}`)).join(`, `));this._literalValue=void 0,this._compiledValue=t.value,this._globalStateRefs=xi(t.value.expression)}getGlobalStateRefs(){return this._globalStateRefs}}let da=N,fa=aa,pa=fa.light,ma=fa.sky,ha=fa.paintProperty,G=fa.layoutProperty;function ga(e,t){let n=!1;if(t?.length)for(let r of t)e.fire(new ze(Error(r.message))),n=!0;return n}class _a{constructor(e,t,n){let r=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;let i=new Int32Array(this.arrayBuffer);e=i[0],this.d=(t=i[1])+2*(n=i[2]);for(let e=0;e<this.d*this.d;e++){let t=i[3+e],n=i[3+e+1];r.push(t===n?null:i.subarray(t,n))}let a=i[3+r.length+1];this.keys=i.subarray(i[3+r.length],a),this.bboxes=i.subarray(a),this.insert=this._insertReadonly}else{this.d=t+2*n;for(let e=0;e<this.d*this.d;e++)r.push([]);this.keys=[],this.bboxes=[]}this.n=t,this.extent=e,this.padding=n,this.scale=t/e,this.uid=0;let i=n/t*e;this.min=-i,this.max=e+i}insert(e,t,n,r,i){this._forEachCell(t,n,r,i,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(t),this.bboxes.push(n),this.bboxes.push(r),this.bboxes.push(i)}_insertReadonly(){throw Error(`Cannot insert into a GridIndex created from an ArrayBuffer.`)}_insertCell(e,t,n,r,i,a){this.cells[i].push(a)}query(e,t,n,r,i){let a=this.min,o=this.max;if(e<=a&&t<=a&&o<=n&&o<=r&&!i)return[...this.keys];{let a=[];return this._forEachCell(e,t,n,r,this._queryCell,a,{},i),a}}_queryCell(e,t,n,r,i,a,o,s){let c=this.cells[i];if(c!==null){let i=this.keys,l=this.bboxes;for(let u of c)if(o[u]===void 0){let c=4*u;(s?s(l[c+0],l[c+1],l[c+2],l[c+3]):e<=l[c+2]&&t<=l[c+3]&&n>=l[c+0]&&r>=l[c+1])?(o[u]=!0,a.push(i[u])):o[u]=!1}}}_forEachCell(e,t,n,r,i,a,o,s){let c=this._convertToCellCoord(e),l=this._convertToCellCoord(t),u=this._convertToCellCoord(n),d=this._convertToCellCoord(r);for(let f=c;f<=u;f++)for(let c=l;c<=d;c++){let l=this.d*c+f;if((!s||s(this._convertFromCellCoord(f),this._convertFromCellCoord(c),this._convertFromCellCoord(f+1),this._convertFromCellCoord(c+1)))&&i.call(this,e,t,n,r,l,a,o,s))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let e=this.cells,t=3+this.cells.length+1+1,n=0;for(let e of this.cells)n+=e.length;let r=new Int32Array(t+n+this.keys.length+this.bboxes.length);r[0]=this.extent,r[1]=this.n,r[2]=this.padding;let i=t;for(let t=0;t<e.length;t++){let n=e[t];r[3+t]=i,r.set(n,i),i+=n.length}return r[3+e.length]=i,r.set(this.keys,i),i+=this.keys.length,r[3+e.length+1]=i,r.set(this.bboxes,i),i+=this.bboxes.length,r.buffer}static serialize(e,t){let n=e.toArrayBuffer();return t&&t.push(n),{buffer:n}}static deserialize(e){return new _a(e.buffer)}}let va={};function K(e,t,n={}){if(va[e])throw Error(`${e} is already registered.`);Object.defineProperty(t,"_classRegistryKey",{value:e,writeable:!1}),va[e]={klass:t,omit:n.omit||[],shallow:n.shallow||[]}}K(`Object`,Object),K(`Set`,Set),K(`TransferableGridIndex`,_a),K(`Color`,Gt),K(`Error`,Error),K(`AJAXError`,Me),K(`ResolvedImage`,nn),K(`StylePropertyFunction`,B),K(`StyleExpression`,mi,{omit:[`_evaluator`]}),K(`ZoomDependentExpression`,vi),K(`ZoomConstantExpression`,_i),K(`CompoundExpression`,Gr,{omit:[`_evaluate`]});for(let e in Wr)Wr[e]._classRegistryKey||K(`Expression_${e}`,Wr[e]);function ya(e){return e&&typeof ArrayBuffer<`u`&&(e instanceof ArrayBuffer||e.constructor?.name===`ArrayBuffer`)}function ba(e){return e.$name||e.constructor._classRegistryKey}function xa(e){return!function(e){if(typeof e!=`object`||!e)return!1;let t=ba(e);return t&&t!==`Object`}(e)&&(e==null||typeof e==`boolean`||typeof e==`number`||typeof e==`string`||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||e instanceof Blob||e instanceof Error||ya(e)||he(e)||ArrayBuffer.isView(e)||e instanceof ImageData)}function Sa(e,t){if(xa(e))return(ya(e)||he(e))&&t&&t.push(e),ArrayBuffer.isView(e)&&t&&t.push(e.buffer),e instanceof ImageData&&t&&t.push(e.data.buffer),e;if(Array.isArray(e)){let n=[];for(let r of e)n.push(Sa(r,t));return n}if(typeof e!=`object`)throw Error(`can't serialize object of type `+typeof e);let n=ba(e);if(!n)throw Error(`can't serialize object of unregistered class ${e.constructor.name}`);if(!va[n])throw Error(`${n} is not registered.`);let{klass:r}=va[n],i=r.serialize?r.serialize(e,t):{};if(r.serialize){if(i===t?.[t.length-1])throw Error(`statically serialized object won't survive transfer of $name property`)}else{for(let r in e){if(!e.hasOwnProperty(r)||va[n].omit.includes(r))continue;let a=e[r];i[r]=va[n].shallow.includes(r)?a:Sa(a,t)}e instanceof Error&&(i.message=e.message)}if(i.$name)throw Error(`$name property is reserved for worker serialization logic.`);return n!==`Object`&&(i.$name=n),i}function Ca(e){if(xa(e))return e;if(Array.isArray(e))return e.map(Ca);if(typeof e!=`object`)throw Error(`can't deserialize object of type `+typeof e);let t=ba(e)||`Object`;if(!va[t])throw Error(`can't deserialize unregistered class ${t}`);let{klass:n}=va[t];if(!n)throw Error(`can't deserialize unregistered class ${t}`);if(n.deserialize)return n.deserialize(e);let r=Object.create(n.prototype);for(let n of Object.keys(e)){if(n===`$name`)continue;let i=e[n];r[n]=va[t].shallow.includes(n)?i:Ca(i)}return r}class wa{constructor(){this.first=!0}update(e,t){let n=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=n,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=n,!0):(this.lastFloorZoom>n?(this.lastIntegerZoom=n+1,this.lastIntegerZoomTime=t):this.lastFloorZoom<n&&(this.lastIntegerZoom=n,this.lastIntegerZoomTime=t),e!==this.lastZoom&&(this.lastZoom=e,this.lastFloorZoom=n,!0))}}function Ta(e){return/[\u02EA\u02EB\u2E80-\u2FDF\u2FF0-\u303F\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FD-\u30FF\u3105-\u312F\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE4F\uFF00-\uFFEF]|\uD81B[\uDFE0-\uDFFF]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFB]|\uD83C[\uDE00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(e))}function Ea(e){return/[\u02EA\u02EB\u1100-\u11FF\u1400-\u167F\u18B0-\u18F5\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u3007\u3012\u3013\u3020-\u302F\u3031-\u303F\u3041-\u3096\u309D-\u30FB\u30FD-\u30FF\u3105-\u312F\u3131-\u318E\u3190-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE48\uFE50-\uFE57\uFE5F-\uFE62\uFE67-\uFE6F\uFF00-\uFF07\uFF0A-\uFF0C\uFF0E-\uFF19\uFF1F-\uFF3A\uFF3C\uFF3E\uFF40-\uFF5A\uFFE0-\uFFE2\uFFE4-\uFFE7]|\uD802[\uDD80-\uDD9F]|\uD805[\uDD80-\uDDFF]|\uD806[\uDE00-\uDEBF]|\uD811[\uDC00-\uDE7F]|\uD81B[\uDFE0-\uDFE4\uDFF0-\uDFF6]|[\uD81C-\uD822\uD83D\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD30-\uDEFB]|\uD833[\uDEC0-\uDFCF]|\uD834[\uDC00-\uDDFF\uDEE0-\uDF7F]|\uD836[\uDC00-\uDEAF]|\uD83C[\uDC00-\uDE00\uDF00-\uDFFF]|\uD83E[\uDD00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(e))}function Da(e){return/\s/u.test(String.fromCodePoint(e))}function Oa(e){for(let t of e)if(Ea(t.codePointAt(0)))return!0;return!1}function ka(e){for(let t of e)if(!Ma(t.codePointAt(0)))return!1;return!0}function Aa(e){let t=e.map((e=>{try{return RegExp(`\\p{sc=${e}}`,`u`).source}catch{return null}})).filter((e=>e));return new RegExp(t.join(`|`),`u`)}let ja=Aa([`Arab`,`Dupl`,`Mong`,`Ougr`,`Syrc`]);function Ma(e){return!ja.test(String.fromCodePoint(e))}function Na(e){return!(Ea(e)||(t=e,/[\xA7\xA9\xAE\xB1\xBC-\xBE\xD7\xF7\u2016\u2020\u2021\u2030\u2031\u203B\u203C\u2042\u2047-\u2049\u2051\u2100-\u218F\u221E\u2234\u2235\u2300-\u2307\u230C-\u231F\u2324-\u2328\u232B\u237D-\u239A\u23BE-\u23CD\u23CF\u23D1-\u23DB\u23E2-\u2422\u2424-\u24FF\u25A0-\u2619\u2620-\u2767\u2776-\u2793\u2B12-\u2B2F\u2B50-\u2B59\u2BB8-\u2BEB\u3000-\u303F\u30A0-\u30FF\uE000-\uF8FF\uFE30-\uFE6F\uFF00-\uFFEF\uFFFC\uFFFD]|[\uDB80-\uDBFF][\uDC00-\uDFFF]/gim.test(String.fromCodePoint(t))));var t}let Pa=Aa(`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`.split(`.`));function Fa(e){return Pa.test(String.fromCodePoint(e))}function Ia(e,t){return!(!t&&Fa(e)||/[\u0900-\u0DFF\u0F00-\u109F\u1780-\u17FF]/gim.test(String.fromCodePoint(e)))}function La(e){for(let t of e)if(Fa(t.codePointAt(0)))return!0;return!1}let Ra=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus=`unavailable`,this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(e){this.pluginStatus=e.pluginStatus,this.pluginURL=e.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(e){if(Ra.isParsed())throw Error(`RTL text plugin already registered.`);this.applyArabicShaping=e.applyArabicShaping,this.processBidirectionalText=e.processBidirectionalText,this.processStyledBidirectionalText=e.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}syncState(e,n){return t(this,void 0,void 0,(function*(){if(this.isParsed())return this.getState();if(e.pluginStatus!==`loading`)return this.setState(e),e;let t=e.pluginURL,r=new Promise((e=>{this.loadScriptResolve=e}));n(t);let i=new Promise((e=>setTimeout((()=>e()),this.TIMEOUT)));if(yield Promise.race([r,i]),this.isParsed()){let e={pluginStatus:`loaded`,pluginURL:t};return this.setState(e),e}throw this.setState({pluginStatus:`error`,pluginURL:``}),Error(`RTL Text Plugin failed to import scripts from ${t}`)}))}};class za{constructor(e,t){this.isSupportedScript=Ba,this.zoom=e,t?(this.now=t.now||0,this.fadeDuration=t.fadeDuration||0,this.zoomHistory=t.zoomHistory||new wa,this.transition=t.transition||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new wa,this.transition={})}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let e=this.zoom,t=e-Math.floor(e),n=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:t+(1-t)*n}:{fromScale:.5,toScale:1,t:1-(1-n)*t}}}function Ba(e){return function(e,t){for(let n of e)if(!Ia(n.codePointAt(0),t))return!1;return!0}(e,Ra.getRTLTextPluginStatus()===`loaded`)}let Va=`-transition`;class Ha{constructor(e,t,n){this.property=e,this.value=t,this.expression=function(e,t,n){if(oi(e))return new B(e,t);if(hi(e)){let r=yi(e,t,n);if(r.result===`error`)throw Error(r.value.map((e=>`${e.key}: ${e.message}`)).join(`, `));return r.value}{let n=e;return t.type===`color`&&typeof e==`string`?n=Gt.parse(e):t.type!==`padding`||typeof e!=`number`&&!Array.isArray(e)?t.type!==`numberArray`||typeof e!=`number`&&!Array.isArray(e)?t.type!==`colorArray`||typeof e!=`string`&&!Array.isArray(e)?t.type===`variableAnchorOffsetCollection`&&Array.isArray(e)?n=tn.parse(e):t.type===`projectionDefinition`&&typeof e==`string`&&(n=rn.parse(e)):n=Qt.parse(e):n=Zt.parse(e):n=Xt.parse(e),{globalStateRefs:new Set,_globalState:null,kind:`constant`,evaluate:()=>n}}}(t===void 0?e.specification.default:t,e.specification,n)}isDataDriven(){return this.expression.kind===`source`||this.expression.kind===`composite`}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(e,t,n){return this.property.possiblyEvaluate(this,e,t,n)}}class Ua{constructor(e,t){this.property=e,this.value=new Ha(e,void 0,t)}transitioned(e,t){return new Ga(this.property,this.value,t,ae({},e.transition,this.transition),e.now)}untransitioned(){return new Ga(this.property,this.value,null,{},0)}}class Wa{constructor(e,t){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._globalState=t}hasProperty(e){return e in this._properties.defaultTransitionablePropertyValues}getValue(e){return le(this._values[e].value.value)}setValue(e,t){Object.hasOwn(this._values,e)||(this._values[e]=new Ua(this._values[e].property,this._globalState)),this._values[e].value=new Ha(this._values[e].property,t===null?void 0:le(t),this._globalState)}getTransition(e){return le(this._values[e].transition)}setTransition(e,t){Object.hasOwn(this._values,e)||(this._values[e]=new Ua(this._values[e].property,this._globalState)),this._values[e].transition=le(t)||void 0}serialize(){let e={};for(let t of Object.keys(this._values)){let n=this.getValue(t);n!==void 0&&(e[t]=n);let r=this.getTransition(t);r!==void 0&&(e[`${t}${Va}`]=r)}return e}transitioned(e,t){let n=new Ka(this._properties);for(let r of Object.keys(this._values))n._values[r]=this._values[r].transitioned(e,t._values[r]);return n}untransitioned(){let e=new Ka(this._properties);for(let t of Object.keys(this._values))e._values[t]=this._values[t].untransitioned();return e}}class Ga{constructor(e,t,n,r,i){this.property=e,this.value=t,this.begin=i+r.delay||0,this.end=this.begin+r.duration||0,e.specification.transition&&(r.delay||r.duration)&&(this.prior=n)}possiblyEvaluate(e,t,n){let r=e.now||0,i=this.value.possiblyEvaluate(e,t,n),a=this.prior;if(a){if(r>this.end||this.value.isDataDriven())return this.prior=null,i;if(r<this.begin)return a.possiblyEvaluate(e,t,n);{let o=(r-this.begin)/(this.end-this.begin);return this.property.interpolate(a.possiblyEvaluate(e,t,n),i,ne(o))}}return i}}class Ka{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,t,n){let r=new Ya(this._properties);for(let i of Object.keys(this._values))r._values[i]=this._values[i].possiblyEvaluate(e,t,n);return r}hasTransition(){for(let e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class qa{constructor(e,t){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._globalState=t}hasValue(e){return this._values[e].value!==void 0}hasProperty(e){return e in this._properties.defaultPropertyValues}getValue(e){return le(this._values[e].value)}setValue(e,t){this._values[e]=new Ha(this._values[e].property,t===null?void 0:le(t),this._globalState)}serialize(){let e={};for(let t of Object.keys(this._values)){let n=this.getValue(t);n!==void 0&&(e[t]=n)}return e}possiblyEvaluate(e,t,n){let r=new Ya(this._properties);for(let i of Object.keys(this._values))r._values[i]=this._values[i].possiblyEvaluate(e,t,n);return r}}class Ja{constructor(e,t,n){this.property=e,this.value=t,this.parameters=n}isConstant(){return this.value.kind===`constant`}constantOr(e){return this.value.kind===`constant`?this.value.value:e}evaluate(e,t,n,r){return this.property.evaluate(this.value,this.parameters,e,t,n,r)}}class Ya{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class q{constructor(e){this.specification=e}possiblyEvaluate(e,t){if(e.isDataDriven())throw Error(`Value should not be data driven`);return e.expression.evaluate(t)}interpolate(e,t,n){let r=Nn[this.specification.type];return r?r(e,t,n):e}}class J{constructor(e,t){this.specification=e,this.overrides=t}possiblyEvaluate(e,t,n,r){return new Ja(this,e.expression.kind===`constant`||e.expression.kind===`camera`?{kind:`constant`,value:e.expression.evaluate(t,null,{},n,r)}:e.expression,t)}interpolate(e,t,n){if(e.value.kind!==`constant`||t.value.kind!==`constant`)return e;if(e.value.value===void 0||t.value.value===void 0)return new Ja(this,{kind:`constant`,value:void 0},e.parameters);let r=Nn[this.specification.type];if(r){let i=r(e.value.value,t.value.value,n);return new Ja(this,{kind:`constant`,value:i},e.parameters)}return e}evaluate(e,t,n,r,i,a){return e.kind===`constant`?e.value:e.evaluate(t,n,r,i,a)}}class Xa extends J{possiblyEvaluate(e,t,n,r){if(e.value===void 0)return new Ja(this,{kind:`constant`,value:void 0},t);if(e.expression.kind===`constant`){let i=e.expression.evaluate(t,null,{},n,r),a=e.property.specification.type===`resolvedImage`&&typeof i!=`string`?i.name:i,o=this._calculate(a,a,a,t);return new Ja(this,{kind:`constant`,value:o},t)}if(e.expression.kind===`camera`){let n=this._calculate(e.expression.evaluate({zoom:t.zoom-1}),e.expression.evaluate({zoom:t.zoom}),e.expression.evaluate({zoom:t.zoom+1}),t);return new Ja(this,{kind:`constant`,value:n},t)}return new Ja(this,e.expression,t)}evaluate(e,t,n,r,i,a){if(e.kind===`source`){let o=e.evaluate(t,n,r,i,a);return this._calculate(o,o,o,t)}return e.kind===`composite`?this._calculate(e.evaluate({zoom:Math.floor(t.zoom)-1},n,r),e.evaluate({zoom:Math.floor(t.zoom)},n,r),e.evaluate({zoom:Math.floor(t.zoom)+1},n,r),t):e.value}_calculate(e,t,n,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:n,to:t}}interpolate(e){return e}}class Za{constructor(e){this.specification=e}possiblyEvaluate(e,t,n,r){if(e.value!==void 0){if(e.expression.kind===`constant`){let i=e.expression.evaluate(t,null,{},n,r);return this._calculate(i,i,i,t)}return this._calculate(e.expression.evaluate(new za(Math.floor(t.zoom-1),t)),e.expression.evaluate(new za(Math.floor(t.zoom),t)),e.expression.evaluate(new za(Math.floor(t.zoom+1),t)),t)}}_calculate(e,t,n,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:n,to:t}}interpolate(e){return e}}class Qa{constructor(e){this.specification=e}possiblyEvaluate(e,t,n,r){return!!e.expression.evaluate(t,null,{},n,r)}interpolate(){return!1}}class $a{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let t in e){let n=e[t];n.specification.overridable&&this.overridableProperties.push(t);let r=this.defaultPropertyValues[t]=new Ha(n,void 0,void 0),i=this.defaultTransitionablePropertyValues[t]=new Ua(n,void 0);this.defaultTransitioningPropertyValues[t]=i.untransitioned(),this.defaultPossiblyEvaluatedValues[t]=r.possiblyEvaluate({})}}}K(`DataDrivenProperty`,J),K(`DataConstantProperty`,q),K(`CrossFadedDataDrivenProperty`,Xa),K(`CrossFadedProperty`,Za),K(`ColorRampProperty`,Qa);let eo=` is a PAINT property not a LAYOUT property. Use get/setPaintProperty instead?`,to=` is a LAYOUT property not a PAINT property. Use get/setLayoutProperty instead?`;class no extends Be{constructor(e,t,n){if(super(),this.id=e.id,this.type=e.type,this._globalState=n,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},this._visibilityExpression=function(e,t){return new ua(e,t)}(this.visibility,n),e.type!==`custom`&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!==`background`&&(this.source=e.source,this.sourceLayer=e[`source-layer`],this.filter=e.filter,this._featureFilter=V(e.filter,n)),t.layout&&(this._unevaluatedLayout=new qa(t.layout,n)),t.paint)){this._transitionablePaint=new Wa(t.paint,n);for(let t in e.paint)this.setPaintProperty(t,e.paint[t],{validate:!1});for(let t in e.layout)this.setLayoutProperty(t,e.layout[t],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Ya(t.paint)}}setFilter(e){this.filter=e,this._featureFilter=V(e,this._globalState)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){if(e===`visibility`)return this.visibility;if(this._transitionablePaint?.hasProperty(e))throw Error(e+eo);if(!this._unevaluatedLayout)throw Error(`Cannot get layout property "${e}" on layer type "${this.type}" which has no layout properties.`);return this._unevaluatedLayout.getValue(e)}getLayoutAffectingGlobalStateRefs(){let e=new Set;for(let t of this._visibilityExpression.getGlobalStateRefs())e.add(t);if(this._unevaluatedLayout)for(let t in this._unevaluatedLayout._values){let n=this._unevaluatedLayout._values[t];for(let t of n.getGlobalStateRefs())e.add(t)}for(let t of this._featureFilter.getGlobalStateRefs())e.add(t);return e}getPaintAffectingGlobalStateRefs(){let e=new globalThis.Map;if(this._transitionablePaint)for(let t in this._transitionablePaint._values){let n=this._transitionablePaint._values[t].value;for(let r of n.getGlobalStateRefs()){let i=e.get(r)??[];i.push({name:t,value:n.value}),e.set(r,i)}}return e}getVisibilityAffectingGlobalStateRefs(){return this._visibilityExpression.getGlobalStateRefs()}setLayoutProperty(e,t,n={}){if(e===`visibility`)return this.visibility=t,this._visibilityExpression.setValue(t),void this.recalculateVisibility();this._transitionablePaint?.hasProperty(e)?this.fire(new ze(Error(e+eo))):t!=null&&this._validate(G,`layers.${this.id}.layout.${e}`,e,t,n)||this._unevaluatedLayout.setValue(e,t)}getPaintProperty(e){if(e.endsWith(Va)){let t=e.slice(0,-11);if(t===`visibility`||this._unevaluatedLayout?.hasProperty(t))throw Error(e+to);return this._transitionablePaint.getTransition(t)}if(e===`visibility`||this._unevaluatedLayout?.hasProperty(e))throw Error(e+to);return this._transitionablePaint.getValue(e)}setPaintProperty(e,t,n={}){if(e===`visibility`||this._unevaluatedLayout?.hasProperty(e))return this.fire(new ze(Error(e+to))),!1;if(t!=null&&this._validate(ha,`layers.${this.id}.paint.${e}`,e,t,n))return!1;if(e.endsWith(Va))return this._transitionablePaint.setTransition(e.slice(0,-11),t||void 0),!1;{let n=this._transitionablePaint._values[e],r=n.property.specification[`property-type`]===`cross-faded-data-driven`,i=n.value.isDataDriven(),a=n.value;this._transitionablePaint.setValue(e,t),this._handleSpecialPaintPropertyUpdate(e);let o=this._transitionablePaint._values[e].value;return o.isDataDriven()||i||r||this._handleOverridablePaintPropertyUpdate(e,a,o)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,t,n){return!1}isHidden(e=this.minzoom,t=!1){return!!(this.minzoom&&e<(t?Math.floor(this.minzoom):this.minzoom))||!!(this.maxzoom&&e>=this.maxzoom)||this._evaluatedVisibility===`none`}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculateVisibility(){this._evaluatedVisibility=this._visibilityExpression.evaluate()}recalculate(e,t){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,t)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,t)}serialize(){let e={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout?.serialize(),paint:this._transitionablePaint?.serialize()};return this.visibility&&(e.layout||={},e.layout.visibility=this.visibility),ce(e,((e,t)=>!(e===void 0||t===`layout`&&!Object.keys(e).length||t===`paint`&&!Object.keys(e).length)))}_validate(e,t,n,r,i={}){return!1!==i?.validate&&ga(this,e.call(fa,{key:t,layerType:this.type,objectKey:n,value:r,styleSpec:N,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let e in this.paint._values){let t=this.paint.get(e);if(t instanceof Ja&&ni(t.property.specification)&&(t.value.kind===`source`||t.value.kind===`composite`)&&t.value.isStateDependent)return!0}return!1}}let ro;var io={get paint(){return ro||=new $a({"raster-opacity":new q(N.paint_raster[`raster-opacity`]),"raster-hue-rotate":new q(N.paint_raster[`raster-hue-rotate`]),"raster-brightness-min":new q(N.paint_raster[`raster-brightness-min`]),"raster-brightness-max":new q(N.paint_raster[`raster-brightness-max`]),"raster-saturation":new q(N.paint_raster[`raster-saturation`]),"raster-contrast":new q(N.paint_raster[`raster-contrast`]),resampling:new q(N.paint_raster.resampling),"raster-resampling":new q(N.paint_raster[`raster-resampling`]),"raster-fade-duration":new q(N.paint_raster[`raster-fade-duration`])})}};class ao extends no{constructor(e,t){super(e,io,t)}}let oo={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class so{constructor(e,t){this._structArray=e,this._pos1=t*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class co{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,t){return e._trim(),t&&(e.isTransferred=!0,t.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){let t=Object.create(this.prototype);return t.arrayBuffer=e.arrayBuffer,t.length=e.length,t.capacity=e.arrayBuffer.byteLength/t.bytesPerElement,t._refreshViews(),t}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let t=this.uint8;this._refreshViews(),t&&this.uint8.set(t)}}_refreshViews(){throw Error(`_refreshViews() must be implemented by each concrete StructArray layout`)}freeBufferAfterUpload(){this.arrayBuffer=new ArrayBuffer(0),this._refreshViews()}}function lo(e,t=1){let n=0,r=0;return{members:e.map((e=>{let i=oo[e.type].BYTES_PER_ELEMENT,a=n=uo(n,Math.max(t,i)),o=e.components||1;return r=Math.max(r,i),n+=i*o,{name:e.name,type:e.type,components:o,offset:a}})),size:uo(n,Math.max(r,t)),alignment:t}}function uo(e,t){return Math.ceil(e/t)*t}class fo extends co{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t){let n=this.length;return this.resize(n+1),this.emplace(n,e,t)}emplace(e,t,n){let r=2*e;return this.int16[r+0]=t,this.int16[r+1]=n,e}}fo.prototype.bytesPerElement=4,K(`StructArrayLayout2i4`,fo);class po extends co{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n){let r=this.length;return this.resize(r+1),this.emplace(r,e,t,n)}emplace(e,t,n,r){let i=3*e;return this.int16[i+0]=t,this.int16[i+1]=n,this.int16[i+2]=r,e}}po.prototype.bytesPerElement=6,K(`StructArrayLayout3i6`,po);class mo extends co{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,r){let i=this.length;return this.resize(i+1),this.emplace(i,e,t,n,r)}emplace(e,t,n,r,i){let a=4*e;return this.int16[a+0]=t,this.int16[a+1]=n,this.int16[a+2]=r,this.int16[a+3]=i,e}}mo.prototype.bytesPerElement=8,K(`StructArrayLayout4i8`,mo);class ho extends co{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i,a){let o=this.length;return this.resize(o+1),this.emplace(o,e,t,n,r,i,a)}emplace(e,t,n,r,i,a,o){let s=6*e;return this.int16[s+0]=t,this.int16[s+1]=n,this.int16[s+2]=r,this.int16[s+3]=i,this.int16[s+4]=a,this.int16[s+5]=o,e}}ho.prototype.bytesPerElement=12,K(`StructArrayLayout2i4i12`,ho);class go extends co{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i,a){let o=this.length;return this.resize(o+1),this.emplace(o,e,t,n,r,i,a)}emplace(e,t,n,r,i,a,o){let s=4*e,c=8*e;return this.int16[s+0]=t,this.int16[s+1]=n,this.uint8[c+4]=r,this.uint8[c+5]=i,this.uint8[c+6]=a,this.uint8[c+7]=o,e}}go.prototype.bytesPerElement=8,K(`StructArrayLayout2i4ub8`,go);class _o extends co{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t){let n=this.length;return this.resize(n+1),this.emplace(n,e,t)}emplace(e,t,n){let r=2*e;return this.float32[r+0]=t,this.float32[r+1]=n,e}}_o.prototype.bytesPerElement=8,K(`StructArrayLayout2f8`,_o);class vo extends co{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i,a,o,s,c,l){let u=this.length;return this.resize(u+1),this.emplace(u,e,t,n,r,i,a,o,s,c,l)}emplace(e,t,n,r,i,a,o,s,c,l,u){let d=10*e;return this.uint16[d+0]=t,this.uint16[d+1]=n,this.uint16[d+2]=r,this.uint16[d+3]=i,this.uint16[d+4]=a,this.uint16[d+5]=o,this.uint16[d+6]=s,this.uint16[d+7]=c,this.uint16[d+8]=l,this.uint16[d+9]=u,e}}vo.prototype.bytesPerElement=20,K(`StructArrayLayout10ui20`,vo);class yo extends co{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i,a,o,s){let c=this.length;return this.resize(c+1),this.emplace(c,e,t,n,r,i,a,o,s)}emplace(e,t,n,r,i,a,o,s,c){let l=8*e;return this.uint16[l+0]=t,this.uint16[l+1]=n,this.uint16[l+2]=r,this.uint16[l+3]=i,this.uint16[l+4]=a,this.uint16[l+5]=o,this.uint16[l+6]=s,this.uint16[l+7]=c,e}}yo.prototype.bytesPerElement=16,K(`StructArrayLayout8ui16`,yo);class bo extends co{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i,a,o,s,c,l,u,d){let f=this.length;return this.resize(f+1),this.emplace(f,e,t,n,r,i,a,o,s,c,l,u,d)}emplace(e,t,n,r,i,a,o,s,c,l,u,d,f){let p=12*e;return this.int16[p+0]=t,this.int16[p+1]=n,this.int16[p+2]=r,this.int16[p+3]=i,this.uint16[p+4]=a,this.uint16[p+5]=o,this.uint16[p+6]=s,this.uint16[p+7]=c,this.int16[p+8]=l,this.int16[p+9]=u,this.int16[p+10]=d,this.int16[p+11]=f,e}}bo.prototype.bytesPerElement=24,K(`StructArrayLayout4i4ui4i24`,bo);class xo extends co{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n){let r=this.length;return this.resize(r+1),this.emplace(r,e,t,n)}emplace(e,t,n,r){let i=3*e;return this.float32[i+0]=t,this.float32[i+1]=n,this.float32[i+2]=r,e}}xo.prototype.bytesPerElement=12,K(`StructArrayLayout3f12`,xo);class So extends co{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){let t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint32[1*e+0]=t,e}}So.prototype.bytesPerElement=4,K(`StructArrayLayout1ul4`,So);class Co extends co{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i,a,o,s,c){let l=this.length;return this.resize(l+1),this.emplace(l,e,t,n,r,i,a,o,s,c)}emplace(e,t,n,r,i,a,o,s,c,l){let u=10*e,d=5*e;return this.int16[u+0]=t,this.int16[u+1]=n,this.int16[u+2]=r,this.int16[u+3]=i,this.int16[u+4]=a,this.int16[u+5]=o,this.uint32[d+3]=s,this.uint16[u+8]=c,this.uint16[u+9]=l,e}}Co.prototype.bytesPerElement=20,K(`StructArrayLayout6i1ul2ui20`,Co);class wo extends co{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i,a){let o=this.length;return this.resize(o+1),this.emplace(o,e,t,n,r,i,a)}emplace(e,t,n,r,i,a,o){let s=6*e;return this.int16[s+0]=t,this.int16[s+1]=n,this.int16[s+2]=r,this.int16[s+3]=i,this.int16[s+4]=a,this.int16[s+5]=o,e}}wo.prototype.bytesPerElement=12,K(`StructArrayLayout2i2i2i12`,wo);class To extends co{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i){let a=this.length;return this.resize(a+1),this.emplace(a,e,t,n,r,i)}emplace(e,t,n,r,i,a){let o=4*e,s=8*e;return this.float32[o+0]=t,this.float32[o+1]=n,this.float32[o+2]=r,this.int16[s+6]=i,this.int16[s+7]=a,e}}To.prototype.bytesPerElement=16,K(`StructArrayLayout2f1f2i16`,To);class Eo extends co{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i,a){let o=this.length;return this.resize(o+1),this.emplace(o,e,t,n,r,i,a)}emplace(e,t,n,r,i,a,o){let s=16*e,c=4*e,l=8*e;return this.uint8[s+0]=t,this.uint8[s+1]=n,this.float32[c+1]=r,this.float32[c+2]=i,this.int16[l+6]=a,this.int16[l+7]=o,e}}Eo.prototype.bytesPerElement=16,K(`StructArrayLayout2ub2f2i16`,Eo);class Do extends co{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n){let r=this.length;return this.resize(r+1),this.emplace(r,e,t,n)}emplace(e,t,n,r){let i=3*e;return this.uint16[i+0]=t,this.uint16[i+1]=n,this.uint16[i+2]=r,e}}Do.prototype.bytesPerElement=6,K(`StructArrayLayout3ui6`,Do);class Oo extends co{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g){let _=this.length;return this.resize(_+1),this.emplace(_,e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g)}emplace(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_){let v=24*e,y=12*e,b=48*e;return this.int16[v+0]=t,this.int16[v+1]=n,this.uint16[v+2]=r,this.uint16[v+3]=i,this.uint32[y+2]=a,this.uint32[y+3]=o,this.uint32[y+4]=s,this.uint16[v+10]=c,this.uint16[v+11]=l,this.uint16[v+12]=u,this.float32[y+7]=d,this.float32[y+8]=f,this.uint8[b+36]=p,this.uint8[b+37]=m,this.uint8[b+38]=h,this.uint32[y+10]=g,this.int16[v+22]=_,e}}Oo.prototype.bytesPerElement=48,K(`StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48`,Oo);class ko extends co{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D){let O=this.length;return this.resize(O+1),this.emplace(O,e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D)}emplace(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O){let k=32*e,A=16*e;return this.int16[k+0]=t,this.int16[k+1]=n,this.int16[k+2]=r,this.int16[k+3]=i,this.int16[k+4]=a,this.int16[k+5]=o,this.int16[k+6]=s,this.int16[k+7]=c,this.uint16[k+8]=l,this.uint16[k+9]=u,this.uint16[k+10]=d,this.uint16[k+11]=f,this.uint16[k+12]=p,this.uint16[k+13]=m,this.uint16[k+14]=h,this.uint16[k+15]=g,this.uint16[k+16]=_,this.uint16[k+17]=v,this.uint16[k+18]=y,this.uint16[k+19]=b,this.uint16[k+20]=x,this.uint16[k+21]=S,this.uint16[k+22]=C,this.uint32[A+12]=w,this.float32[A+13]=T,this.float32[A+14]=E,this.uint16[k+30]=D,this.uint16[k+31]=O,e}}ko.prototype.bytesPerElement=64,K(`StructArrayLayout8i15ui1ul2f2ui64`,ko);class Ao extends co{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){let t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.float32[1*e+0]=t,e}}Ao.prototype.bytesPerElement=4,K(`StructArrayLayout1f4`,Ao);class jo extends co{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n){let r=this.length;return this.resize(r+1),this.emplace(r,e,t,n)}emplace(e,t,n,r){let i=3*e;return this.uint16[6*e+0]=t,this.float32[i+1]=n,this.float32[i+2]=r,e}}jo.prototype.bytesPerElement=12,K(`StructArrayLayout1ui2f12`,jo);class Mo extends co{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n){let r=this.length;return this.resize(r+1),this.emplace(r,e,t,n)}emplace(e,t,n,r){let i=4*e;return this.uint32[2*e+0]=t,this.uint16[i+2]=n,this.uint16[i+3]=r,e}}Mo.prototype.bytesPerElement=8,K(`StructArrayLayout1ul2ui8`,Mo);class No extends co{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t){let n=this.length;return this.resize(n+1),this.emplace(n,e,t)}emplace(e,t,n){let r=2*e;return this.uint16[r+0]=t,this.uint16[r+1]=n,e}}No.prototype.bytesPerElement=4,K(`StructArrayLayout2ui4`,No);class Po extends co{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){let t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint16[1*e+0]=t,e}}Po.prototype.bytesPerElement=2,K(`StructArrayLayout1ui2`,Po);class Fo extends co{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,r){let i=this.length;return this.resize(i+1),this.emplace(i,e,t,n,r)}emplace(e,t,n,r,i){let a=4*e;return this.float32[a+0]=t,this.float32[a+1]=n,this.float32[a+2]=r,this.float32[a+3]=i,e}}Fo.prototype.bytesPerElement=16,K(`StructArrayLayout4f16`,Fo);class Io extends so{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new n(this.anchorPointX,this.anchorPointY)}}Io.prototype.size=20;class Lo extends Co{get(e){return new Io(this,e)}}K(`CollisionBoxArray`,Lo);class Ro extends so{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}Ro.prototype.size=48;class zo extends Oo{get(e){return new Ro(this,e)}}K(`PlacedSymbolArray`,zo);class Bo extends so{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(e){this._structArray.uint32[this._pos4+12]=e}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get 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]}}Bo.prototype.size=64;class Vo extends ko{get(e){return new Bo(this,e)}}K(`SymbolInstanceArray`,Vo);class Ho extends Ao{getoffsetX(e){return this.float32[1*e+0]}}K(`GlyphOffsetArray`,Ho);class Uo extends po{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}K(`SymbolLineVertexArray`,Uo);class Wo extends so{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]}}Wo.prototype.size=12;class Go extends jo{get(e){return new Wo(this,e)}}K(`TextAnchorOffsetArray`,Go);class Ko extends so{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]}}Ko.prototype.size=8;class qo extends Mo{get(e){return new Ko(this,e)}}K(`FeatureIndexArray`,qo);class Jo extends fo{}class Yo extends fo{}class Xo extends fo{}class Zo extends ho{}class Qo extends go{}class $o extends _o{}class es extends vo{}class ts extends yo{}class ns extends bo{}class rs extends xo{}class is extends So{}class as extends wo{}class os extends Eo{}class ss extends Do{}class cs extends No{}let{members:ls}=lo([{name:`a_pos`,components:2,type:`Int16`}],4);class us{constructor(e=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=e}prepareSegment(e,t,n,r){let i=this.segments[this.segments.length-1];return e>us.MAX_VERTEX_ARRAY_LENGTH&&de(`Max vertices per segment is ${us.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${us.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!i||i.vertexLength+e>us.MAX_VERTEX_ARRAY_LENGTH||i.sortKey!==r?this.createNewSegment(t,n,r):i}createNewSegment(e,t,n){let r={vertexOffset:e.length,primitiveOffset:t.length,vertexLength:0,primitiveLength:0,vaos:{}};return n!==void 0&&(r.sortKey=n),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(r),r}getOrCreateLatestSegment(e,t,n){return this.prepareSegment(0,e,t,n)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(let e of this.segments)for(let t in e.vaos)e.vaos[t].destroy()}static simpleSegment(e,t,n,r){return new us([{vertexOffset:e,primitiveOffset:t,vertexLength:n,primitiveLength:r,vaos:{},sortKey:0}])}}function ds(e,t){return 256*(e=j(Math.floor(e),0,255))+j(Math.floor(t),0,255)}us.MAX_VERTEX_ARRAY_LENGTH=2**16-1,K(`SegmentVector`,us);let fs=lo([{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`}]),ps=lo([{name:`a_dasharray_from`,components:4,type:`Uint16`},{name:`a_dasharray_to`,components:4,type:`Uint16`}]);var ms,hs,gs,_s={exports:{}},vs={exports:{}},ys={exports:{}},bs=r(function(){if(gs)return _s.exports;gs=1;var e=(ms||(ms=1,vs.exports=function(e,t){var n,r,i,a,o,s,c,l;for(r=e.length-(n=3&e.length),i=t,o=3432918353,s=461845907,l=0;l<r;)c=255&e.charCodeAt(l)|(255&e.charCodeAt(++l))<<8|(255&e.charCodeAt(++l))<<16|(255&e.charCodeAt(++l))<<24,++l,i=27492+(65535&(a=5*(65535&(i=(i^=c=(65535&(c=(c=(65535&c)*o+(((c>>>16)*o&65535)<<16)&4294967295)<<15|c>>>17))*s+(((c>>>16)*s&65535)<<16)&4294967295)<<13|i>>>19))+((5*(i>>>16)&65535)<<16)&4294967295))+((58964+(a>>>16)&65535)<<16);switch(c=0,n){case 3:c^=(255&e.charCodeAt(l+2))<<16;case 2:c^=(255&e.charCodeAt(l+1))<<8;case 1:i^=c=(65535&(c=(c=(65535&(c^=255&e.charCodeAt(l)))*o+(((c>>>16)*o&65535)<<16)&4294967295)<<15|c>>>17))*s+(((c>>>16)*s&65535)<<16)&4294967295}return i^=e.length,i=2246822507*(65535&(i^=i>>>16))+((2246822507*(i>>>16)&65535)<<16)&4294967295,i=3266489909*(65535&(i^=i>>>13))+((3266489909*(i>>>16)&65535)<<16)&4294967295,(i^=i>>>16)>>>0}),vs.exports),t=(hs||(hs=1,ys.exports=function(e,t){for(var n,r=e.length,i=t^r,a=0;r>=4;)n=1540483477*(65535&(n=255&e.charCodeAt(a)|(255&e.charCodeAt(++a))<<8|(255&e.charCodeAt(++a))<<16|(255&e.charCodeAt(++a))<<24))+((1540483477*(n>>>16)&65535)<<16),i=1540483477*(65535&i)+((1540483477*(i>>>16)&65535)<<16)^(n=1540483477*(65535&(n^=n>>>24))+((1540483477*(n>>>16)&65535)<<16)),r-=4,++a;switch(r){case 3:i^=(255&e.charCodeAt(a+2))<<16;case 2:i^=(255&e.charCodeAt(a+1))<<8;case 1:i=1540483477*(65535&(i^=255&e.charCodeAt(a)))+((1540483477*(i>>>16)&65535)<<16)}return i=1540483477*(65535&(i^=i>>>13))+((1540483477*(i>>>16)&65535)<<16),(i^=i>>>15)>>>0}),ys.exports);return _s.exports=e,_s.exports.murmur3=e,_s.exports.murmur2=t,_s.exports}());class xs{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,t,n,r){this.ids.push(Ss(e)),this.positions.push(t,n,r)}getPositions(e){if(!this.indexed)throw Error(`Trying to get index, but feature positions are not indexed`);let t=Ss(e),n=0,r=this.ids.length-1;for(;n<r;){let e=n+r>>1;this.ids[e]>=t?r=e:n=e+1}let i=[];for(;this.ids[n]===t;)i.push({index:this.positions[3*n],start:this.positions[3*n+1],end:this.positions[3*n+2]}),n++;return i}static serialize(e,t){let n=new Float64Array(e.ids),r=new Uint32Array(e.positions);return Cs(n,r,0,n.length-1),t&&t.push(n.buffer,r.buffer),{ids:n,positions:r}}static deserialize(e){let t=new xs;return t.ids=e.ids,t.positions=e.positions,t.indexed=!0,t}}function Ss(e){let t=+e;return!isNaN(t)&&t<=2**53-1?t:bs(String(e))}function Cs(e,t,n,r){for(;n<r;){let i=e[n+r>>1],a=n-1,o=r+1;for(;;){do a++;while(e[a]<i);do o--;while(e[o]>i);if(a>=o)break;ws(e,a,o),ws(t,3*a,3*o),ws(t,3*a+1,3*o+1),ws(t,3*a+2,3*o+2)}o-n<r-o?(Cs(e,t,n,o),n=o+1):(Cs(e,t,o+1,r),r=o)}}function ws(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}K(`FeaturePositionMap`,xs);class Ts{constructor(e,t){this.gl=e.gl,this.location=t}}class Es extends Ts{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}}class Ds extends Ts{constructor(e,t){super(e,t),this.current=[0,0,0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]&&e[2]===this.current[2]&&e[3]===this.current[3]||(this.current=e,this.gl.uniform4f(this.location,e[0],e[1],e[2],e[3]))}}class Os extends Ts{constructor(e,t){super(e,t),this.current=Gt.transparent}set(e){e.r===this.current.r&&e.g===this.current.g&&e.b===this.current.b&&e.a===this.current.a||(this.current=e,this.gl.uniform4f(this.location,e.r,e.g,e.b,e.a))}}let ks=new Float32Array(16);function As(e){return[ds(255*e.r,255*e.g),ds(255*e.b,255*e.a)]}class js{constructor(e,t,n){this.value=e,this.uniformNames=t.map((e=>`u_${e}`)),this.type=n}setUniform(e,t,n){e.set(n.constantOr(this.value))}getBinding(e,t,n){return this.type===`color`?new Os(e,t):new Es(e,t)}}class Ms{constructor(e,t){this.uniformNames=t.map((e=>`u_${e}`)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,t){this.pixelRatioFrom=t.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=t.tlbr,this.patternTo=e.tlbr}setConstantDashPositions(e,t){this.dashTo=[0,e.y,e.height,e.width],this.dashFrom=[0,t.y,t.height,t.width]}setUniform(e,t,n,r){let i=null;r===`u_pattern_to`?i=this.patternTo:r===`u_pattern_from`?i=this.patternFrom:r===`u_dasharray_to`?i=this.dashTo:r===`u_dasharray_from`?i=this.dashFrom:r===`u_pixel_ratio_to`?i=this.pixelRatioTo:r===`u_pixel_ratio_from`&&(i=this.pixelRatioFrom),i!==null&&e.set(i)}getBinding(e,t,n){return n.startsWith(`u_pattern`)||n.startsWith(`u_dasharray_`)?new Ds(e,t):new Es(e,t)}}class Ns{constructor(e,t,n,r){this.expression=e,this.type=n,this.maxValue=0,this.paintVertexAttributes=t.map((e=>({name:`a_${e}`,type:`Float32`,components:n===`color`?2:1,offset:0}))),this.paintVertexArray=new r}populatePaintArray(e,t,n){let r=this.paintVertexArray.length,i=this.expression.evaluate(new za(0,n),t,{},n.canonical,[],n.formattedSection);this.paintVertexArray.resize(e),this._setPaintValue(r,e,i)}updatePaintArray(e,t,n,r,i){let a=this.expression.evaluate(new za(0,i),n,r);this._setPaintValue(e,t,a)}_setPaintValue(e,t,n){if(this.type===`color`){let r=As(n);for(let n=e;n<t;n++)this.paintVertexArray.emplace(n,r[0],r[1])}else{for(let r=e;r<t;r++)this.paintVertexArray.emplace(r,n);this.maxValue=Math.max(this.maxValue,Math.abs(n))}}upload(e){var t;(t=this.paintVertexArray)!=null&&t.arrayBuffer.byteLength&&(this.paintVertexBuffer?.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Ps{constructor(e,t,n,r,i,a){this.expression=e,this.uniformNames=t.map((e=>`u_${e}_t`)),this.type=n,this.useIntegerZoom=r,this.zoom=i,this.maxValue=0,this.paintVertexAttributes=t.map((e=>({name:`a_${e}`,type:`Float32`,components:n===`color`?4:2,offset:0}))),this.paintVertexArray=new a}populatePaintArray(e,t,n){let r=this.expression.evaluate(new za(this.zoom,n),t,{},n.canonical,[],n.formattedSection),i=this.expression.evaluate(new za(this.zoom+1,n),t,{},n.canonical,[],n.formattedSection),a=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(a,e,r,i)}updatePaintArray(e,t,n,r,i){let a=this.expression.evaluate(new za(this.zoom,i),n,r),o=this.expression.evaluate(new za(this.zoom+1,i),n,r);this._setPaintValue(e,t,a,o)}_setPaintValue(e,t,n,r){if(this.type===`color`){let i=As(n),a=As(r);for(let n=e;n<t;n++)this.paintVertexArray.emplace(n,i[0],i[1],a[0],a[1])}else{for(let i=e;i<t;i++)this.paintVertexArray.emplace(i,n,r);this.maxValue=Math.max(this.maxValue,Math.abs(n),Math.abs(r))}}upload(e){var t;(t=this.paintVertexArray)!=null&&t.arrayBuffer.byteLength&&(this.paintVertexBuffer?.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,t){let n=this.useIntegerZoom?Math.floor(t.zoom):t.zoom,r=j(this.expression.interpolationFactor(n,this.zoom,this.zoom+1),0,1);e.set(r)}getBinding(e,t,n){return new Es(e,t)}}class Fs{constructor(e,t,n,r,i,a){this.expression=e,this.type=t,this.useIntegerZoom=n,this.zoom=r,this.layerId=a,this.zoomInPaintVertexArray=new i,this.zoomOutPaintVertexArray=new i}populatePaintArray(e,t,n){let r=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(r,e,this.getPositionIds(t),n)}updatePaintArray(e,t,n,r,i){this._setPaintValues(e,t,this.getPositionIds(n),i)}_setPaintValues(e,t,n,r){let i=this.getPositions(r);if(!i||!n)return;let a=i[n.min],o=i[n.mid],s=i[n.max];if(a&&o&&s)for(let n=e;n<t;n++)this.emplace(this.zoomInPaintVertexArray,n,o,a),this.emplace(this.zoomOutPaintVertexArray,n,o,s)}upload(e){if(this.zoomInPaintVertexArray?.arrayBuffer.byteLength&&this.zoomOutPaintVertexArray?.arrayBuffer.byteLength){let t=this.getVertexAttributes();this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,t,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,t,this.expression.isStateDependent)}}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class Is extends Fs{getPositions(e){return e.imagePositions}getPositionIds(e){return e.patterns?.[this.layerId]}getVertexAttributes(){return fs.members}emplace(e,t,n,r){e.emplace(t,n.tlbr[0],n.tlbr[1],n.tlbr[2],n.tlbr[3],r.tlbr[0],r.tlbr[1],r.tlbr[2],r.tlbr[3],n.pixelRatio,r.pixelRatio)}}class Ls extends Fs{getPositions(e){return e.dashPositions}getPositionIds(e){return e.dashes?.[this.layerId]}getVertexAttributes(){return ps.members}emplace(e,t,n,r){e.emplace(t,0,n.y,n.height,n.width,0,r.y,r.height,r.width)}}class Rs{constructor(e,t,n){this.binders={},this._buffers=[];let r=[];for(let i in e.paint._values){if(!n(i))continue;let a=e.paint.get(i);if(!(a instanceof Ja&&ni(a.property.specification)))continue;let o=Bs(i,e.type),s=a.value,c=a.property.specification.type,l=a.property.useIntegerZoom,u=a.property.specification[`property-type`],d=u===`cross-faded`||u===`cross-faded-data-driven`;if(s.kind===`constant`)this.binders[i]=d?new Ms(s.value,o):new js(s.value,o,c),r.push(`/u_${i}`);else if(s.kind===`source`||d){let n=Vs(i,c,`source`);this.binders[i]=d?i===`line-dasharray`?new Ls(s,c,l,t,n,e.id):new Is(s,c,l,t,n,e.id):new Ns(s,o,c,n),r.push(`/a_${i}`)}else{let e=Vs(i,c,`composite`);this.binders[i]=new Ps(s,o,c,l,t,e),r.push(`/z_${i}`)}}this.cacheKey=r.sort().join(``)}getMaxValue(e){let t=this.binders[e];return t instanceof Ns||t instanceof Ps?t.maxValue:0}populatePaintArrays(e,t,n){for(let r in this.binders){let i=this.binders[r];(i instanceof Ns||i instanceof Ps||i instanceof Fs)&&i.populatePaintArray(e,t,n)}}setConstantPatternPositions(e,t){for(let n in this.binders){let r=this.binders[n];r instanceof Ms&&r.setConstantPatternPositions(e,t)}}setConstantDashPositions(e,t){for(let n in this.binders){let r=this.binders[n];r instanceof Ms&&r.setConstantDashPositions(e,t)}}updatePaintArrays(e,t,n,r,i){let a=!1;for(let o in e){let s=t.getPositions(o);for(let t of s){let s=n.feature(t.index);for(let n in this.binders){let c=this.binders[n];(c instanceof Ns||c instanceof Ps||c instanceof Fs)&&!0===c.expression.isStateDependent&&(c.expression=r.paint.get(n).value,c.updatePaintArray(t.start,t.end,s,e[o],i),a=!0)}}}return a}defines(){let e=[];for(let t in this.binders){let n=this.binders[t];(n instanceof js||n instanceof Ms)&&e.push(...n.uniformNames.map((e=>`#define HAS_UNIFORM_${e}`)))}return e}getBinderAttributes(){let e=[];for(let t in this.binders){let n=this.binders[t];if(n instanceof Ns||n instanceof Ps)for(let t of n.paintVertexAttributes)e.push(t.name);else if(n instanceof Fs){let t=n.getVertexAttributes();for(let n of t)e.push(n.name)}}return e}getBinderUniforms(){let e=[];for(let t in this.binders){let n=this.binders[t];if(n instanceof js||n instanceof Ms||n instanceof Ps)for(let t of n.uniformNames)e.push(t)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,t){let n=[];for(let r in this.binders){let i=this.binders[r];if(i instanceof js||i instanceof Ms||i instanceof Ps){for(let a of i.uniformNames)if(t[a]){let o=i.getBinding(e,t[a],a);n.push({name:a,property:r,binding:o})}}}return n}setUniforms(e,t,n,r){for(let{name:e,property:i,binding:a}of t)this.binders[i].setUniform(a,r,n.get(i),e)}updatePaintBuffers(e){this._buffers=[];for(let t in this.binders){let n=this.binders[t];if(e&&n instanceof Fs){let t=e.fromScale===2?n.zoomInPaintVertexBuffer:n.zoomOutPaintVertexBuffer;t&&this._buffers.push(t)}else(n instanceof Ns||n instanceof Ps)&&n.paintVertexBuffer&&this._buffers.push(n.paintVertexBuffer)}}upload(e){for(let t in this.binders){let n=this.binders[t];(n instanceof Ns||n instanceof Ps||n instanceof Fs)&&n.upload(e)}this.updatePaintBuffers()}destroy(){for(let e in this.binders){let t=this.binders[e];(t instanceof Ns||t instanceof Ps||t instanceof Fs)&&t.destroy()}}}class zs{constructor(e,t,n=()=>!0){this.programConfigurations={};for(let r of e)this.programConfigurations[r.id]=new Rs(r,t,n);this.needsUpload=!1,this._featureMap=new xs,this._bufferOffset=0}populatePaintArrays(e,t,n,r){for(let n in this.programConfigurations)this.programConfigurations[n].populatePaintArrays(e,t,r);t.id!==void 0&&this._featureMap.add(t.id,n,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,t,n,r){for(let i of n)this.needsUpload=this.programConfigurations[i.id].updatePaintArrays(e,this._featureMap,t,i,r)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(let t in this.programConfigurations)this.programConfigurations[t].upload(e);this.needsUpload=!1}}destroy(){for(let e in this.programConfigurations)this.programConfigurations[e].destroy()}}function Bs(e,t){return{"text-opacity":[`opacity`],"icon-opacity":[`opacity`],"text-color":[`fill_color`],"icon-color":[`fill_color`],"text-halo-color":[`halo_color`],"icon-halo-color":[`halo_color`],"text-halo-blur":[`halo_blur`],"icon-halo-blur":[`halo_blur`],"text-halo-width":[`halo_width`],"icon-halo-width":[`halo_width`],"line-gap-width":[`gapwidth`],"line-dasharray":[`dasharray_to`,`dasharray_from`],"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`]}[e]||[e.replace(`${t}-`,``).replace(/-/g,`_`)]}function Vs(e,t,n){let r={color:{source:_o,composite:Fo},number:{source:Ao,composite:_o}};return function(e){return{"line-pattern":{source:es,composite:es},"fill-pattern":{source:es,composite:es},"fill-extrusion-pattern":{source:es,composite:es},"line-dasharray":{source:ts,composite:ts}}[e]}(e)?.[n]||r[t][n]}K(`ConstantBinder`,js),K(`CrossFadedConstantBinder`,Ms),K(`SourceExpressionBinder`,Ns),K(`CrossFadedPatternBinder`,Is),K(`CrossFadedDasharrayBinder`,Ls),K(`CompositeExpressionBinder`,Ps),K(`ProgramConfiguration`,Rs,{omit:[`_buffers`]}),K(`ProgramConfigurationSet`,zs);let Hs=2**14-1,Us=-Hs-1;function Ws(e){let t=O/e.extent,n=e.loadGeometry();for(let e of n)for(let n of e){let e=Math.round(n.x*t),r=Math.round(n.y*t);n.x=j(e,Us,Hs),n.y=j(r,Us,Hs),(e<n.x||e>n.x+1||r<n.y||r>n.y+1)&&de(`Geometry exceeds allowed extent, reduce your vector tile buffer size`)}return n}function Gs(e,t){return{type:e.type,id:e.id,properties:e.properties,geometry:t?Ws(e):[]}}let Ks=-32768;function qs(e,t,n,r,i){e.emplaceBack(Ks+8*t+r,Ks+8*n+i)}class Js{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.hasDependencies=!1,this.layoutVertexArray=new Yo,this.indexArray=new ss,this.segments=new us,this.programConfigurations=new zs(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,t,n){let r=this.layers[0],i=[],a=null,o=!1,s=r.type===`heatmap`;if(r.type===`circle`){let e=r;a=e.layout.get(`circle-sort-key`),o=!a.isConstant(),s||=e.paint.get(`circle-pitch-alignment`)===`map`}let c=s?t.subdivisionGranularity.circle:1;for(let{feature:t,id:r,index:s,sourceLayerIndex:c}of e){let e=this.layers[0]._featureFilter.needGeometry,l=Gs(t,e);if(!this.layers[0]._featureFilter.filter(new za(this.zoom),l,n))continue;let u=o?a.evaluate(l,{},n):void 0,d={id:r,properties:t.properties,type:t.type,sourceLayerIndex:c,index:s,geometry:e?l.geometry:Ws(t),patterns:{},sortKey:u};i.push(d)}o&&i.sort(((e,t)=>e.sortKey-t.sortKey));for(let r of i){let{geometry:i,index:a,sourceLayerIndex:o}=r,s=e[a].feature;this.addFeature(r,i,a,n,c),t.featureIndex.insert(s,i,a,o,this.index)}}update(e,t,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions:n})}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ls),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,t,n,r,i=1){let a;switch(i){case 1:a=[0,7];break;case 3:a=[0,2,5,7];break;case 5:a=[0,1,3,4,6,7];break;case 7:a=[0,1,2,3,4,5,6,7];break;default:throw Error(`Invalid circle bucket granularity: ${i}; valid values are 1, 3, 5, 7.`)}let o=a.length;for(let n of t)for(let t of n){let n=t.x,r=t.y;if(n<0||n>=O||r<0||r>=O)continue;let i=this.segments.prepareSegment(o*o,this.layoutVertexArray,this.indexArray,e.sortKey),s=i.vertexLength;for(let e=0;e<o;e++)for(let t=0;t<o;t++)qs(this.layoutVertexArray,n,r,a[t],a[e]);for(let e=0;e<o-1;e++)for(let t=0;t<o-1;t++){let n=s+e*o+t,r=s+(e+1)*o+t;this.indexArray.emplaceBack(n,r+1,n+1),this.indexArray.emplaceBack(n,r,r+1)}i.vertexLength+=o*o,i.primitiveLength+=(o-1)*(o-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,{imagePositions:{},canonical:r})}}function Ys(e,t){for(let n of e)if(ic(t,n))return!0;for(let n of t)if(ic(e,n))return!0;return $s(e,t)}function Xs(e,t,n){return!!ic(e,t)||tc(t,e,n)}function Zs(e,t){if(e.length===1)return rc(t,e[0]);for(let n of t)for(let t of n)if(ic(e,t))return!0;for(let n of e)if(rc(t,n))return!0;for(let n of t)if($s(e,n))return!0;return!1}function Qs(e,t,n){if(e.length>1){if($s(e,t))return!0;for(let r of t)if(tc(r,e,n))return!0}for(let r of e)if(tc(r,t,n))return!0;return!1}function $s(e,t){if(e.length===0||t.length===0)return!1;for(let n=0;n<e.length-1;n++){let r=e[n],i=e[n+1];for(let e=0;e<t.length-1;e++)if(ec(r,i,t[e],t[e+1]))return!0}return!1}function ec(e,t,n,r){return fe(e,n,r)!==fe(t,n,r)&&fe(e,t,n)!==fe(e,t,r)}function tc(e,t,n){let r=n*n;if(t.length===1)return e.distSqr(t[0])<r;for(let n=1;n<t.length;n++)if(nc(e,t[n-1],t[n])<r)return!0;return!1}function nc(e,t,n){let r=t.distSqr(n);if(r===0)return e.distSqr(t);let i=((e.x-t.x)*(n.x-t.x)+(e.y-t.y)*(n.y-t.y))/r;return e.distSqr(i<0?t:i>1?n:n.sub(t)._mult(i)._add(t))}function rc(e,t){let n,r,i,a=!1;for(let o of e){n=o;for(let e=0,o=n.length-1;e<n.length;o=e++)r=n[e],i=n[o],r.y>t.y!=i.y>t.y&&t.x<(i.x-r.x)*(t.y-r.y)/(i.y-r.y)+r.x&&(a=!a)}return a}function ic(e,t){let n=!1;for(let r=0,i=e.length-1;r<e.length;i=r++){let a=e[r],o=e[i];a.y>t.y!=o.y>t.y&&t.x<(o.x-a.x)*(t.y-a.y)/(o.y-a.y)+a.x&&(n=!n)}return n}function ac(e,t,n){let r=n[0],i=n[2];if(e.x<r.x&&t.x<r.x||e.x>i.x&&t.x>i.x||e.y<r.y&&t.y<r.y||e.y>i.y&&t.y>i.y)return!1;let a=fe(e,t,n[0]);return a!==fe(e,t,n[1])||a!==fe(e,t,n[2])||a!==fe(e,t,n[3])}function oc(e,t,n){let r=t.paint.get(e).value;return r.kind===`constant`?r.value:n.programConfigurations.get(t.id).getMaxValue(e)}function sc(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function cc(e,t,r,i,a){if(!t[0]&&!t[1])return e;let o=n.convert(t)._mult(a);r===`viewport`&&o._rotate(-i);let s=[];for(let t of e)s.push(t.sub(o));return s}function lc(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n],i=t.at(-1);(n===0||i&&!r.equals(i))&&t.push(r)}return t}function uc({queryGeometry:e,size:t},n){return Xs(e,n,t)}function dc({queryGeometry:e,size:t,transform:n,unwrappedTileID:r,getElevation:i},a){return Xs(e,a,t*(n.projectTileCoordinates(a.x,a.y,r,i).signedDistanceFromCamera/n.cameraToCenterDistance))}function fc({queryGeometry:e,size:t,transform:n,unwrappedTileID:r,getElevation:i},a){let o=n.projectTileCoordinates(a.x,a.y,r,i).signedDistanceFromCamera,s=t*(n.cameraToCenterDistance/o);return Xs(e,hc(a,n,r,i),s)}function pc({queryGeometry:e,size:t,transform:n,unwrappedTileID:r,getElevation:i},a){return Xs(e,hc(a,n,r,i),t)}function mc({queryGeometry:e,size:t,transform:n,unwrappedTileID:r,getElevation:i,pitchAlignment:a=`map`,pitchScale:o=`map`},s){let c=a===`map`?o===`map`?uc:dc:o===`map`?fc:pc,l={queryGeometry:e,size:t,transform:n,unwrappedTileID:r,getElevation:i};for(let e of s)for(let t of e)if(c(l,t))return!0;return!1}function hc(e,t,r,i){let a=t.projectTileCoordinates(e.x,e.y,r,i).point;return new n((.5*a.x+.5)*t.width,(.5*-a.y+.5)*t.height)}let gc,_c;K(`CircleBucket`,Js,{omit:[`layers`]});var vc={get paint(){return _c||=new $a({"circle-radius":new J(N.paint_circle[`circle-radius`]),"circle-color":new J(N.paint_circle[`circle-color`]),"circle-blur":new J(N.paint_circle[`circle-blur`]),"circle-opacity":new J(N.paint_circle[`circle-opacity`]),"circle-translate":new q(N.paint_circle[`circle-translate`]),"circle-translate-anchor":new q(N.paint_circle[`circle-translate-anchor`]),"circle-pitch-scale":new q(N.paint_circle[`circle-pitch-scale`]),"circle-pitch-alignment":new q(N.paint_circle[`circle-pitch-alignment`]),"circle-stroke-width":new J(N.paint_circle[`circle-stroke-width`]),"circle-stroke-color":new J(N.paint_circle[`circle-stroke-color`]),"circle-stroke-opacity":new J(N.paint_circle[`circle-stroke-opacity`])})},get layout(){return gc||=new $a({"circle-sort-key":new J(N.layout_circle[`circle-sort-key`])})}};class yc extends no{constructor(e,t){super(e,vc,t)}createBucket(e){return new Js(e)}queryRadius(e){let t=e;return oc(`circle-radius`,this,t)+oc(`circle-stroke-width`,this,t)+sc(this.paint.get(`circle-translate`))}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:n,geometry:r,transform:i,pixelsToTileUnits:a,unwrappedTileID:o,getElevation:s}){let c=cc(e,this.paint.get(`circle-translate`),this.paint.get(`circle-translate-anchor`),-i.bearingInRadians,a),l=this.paint.get(`circle-radius`).evaluate(t,n)+this.paint.get(`circle-stroke-width`).evaluate(t,n),u=this.paint.get(`circle-pitch-scale`),d=this.paint.get(`circle-pitch-alignment`),f,p;return d===`map`?(f=c,p=l*a):(f=function(e,t,n,r){return e.map((e=>hc(e,t,n,r)))}(c,i,o,s),p=l),mc({queryGeometry:f,size:p,transform:i,unwrappedTileID:o,getElevation:s,pitchAlignment:d,pitchScale:u},r)}}class bc extends Js{}let xc;K(`HeatmapBucket`,bc,{omit:[`layers`]});var Sc={get paint(){return xc||=new $a({"heatmap-radius":new J(N.paint_heatmap[`heatmap-radius`]),"heatmap-weight":new J(N.paint_heatmap[`heatmap-weight`]),"heatmap-intensity":new q(N.paint_heatmap[`heatmap-intensity`]),"heatmap-color":new Qa(N.paint_heatmap[`heatmap-color`]),"heatmap-opacity":new q(N.paint_heatmap[`heatmap-opacity`])})}};function Cc(e,{width:t,height:n},r,i){if(i){if(i instanceof Uint8ClampedArray)i=new Uint8Array(i.buffer);else if(i.length!==t*n*r)throw RangeError(`mismatched image size. expected: ${i.length} but got: ${t*n*r}`)}else i=new Uint8Array(t*n*r);return e.width=t,e.height=n,e.data=i,e}function wc(e,{width:t,height:n},r){if(t===e.width&&n===e.height)return;let i=Cc({},{width:t,height:n},r);Tc(e,i,{x:0,y:0},{x:0,y:0},{width:Math.min(e.width,t),height:Math.min(e.height,n)},r),e.width=t,e.height=n,e.data=i.data}function Tc(e,t,n,r,i,a){if(i.width===0||i.height===0)return t;if(i.width>e.width||i.height>e.height||n.x>e.width-i.width||n.y>e.height-i.height)throw RangeError(`out of range source coordinates for image copy`);if(i.width>t.width||i.height>t.height||r.x>t.width-i.width||r.y>t.height-i.height)throw RangeError(`out of range destination coordinates for image copy`);let o=e.data,s=t.data;if(o===s)throw Error(`srcData equals dstData, so image is already copied`);for(let c=0;c<i.height;c++){let l=((n.y+c)*e.width+n.x)*a,u=((r.y+c)*t.width+r.x)*a;for(let e=0;e<i.width*a;e++)s[u+e]=o[l+e]}return t}class Ec{constructor(e,t){Cc(this,e,1,t)}resize(e){wc(this,e,1)}clone(){return new Ec({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,n,r,i){Tc(e,t,n,r,i,1)}}class Dc{constructor(e,t){Cc(this,e,4,t)}resize(e){wc(this,e,4)}replace(e,t){t?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new Dc({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,n,r,i){Tc(e,t,n,r,i,4)}setPixel(e,t,n){let r=4*(e*this.width+t);this.data[r+0]=Math.round(255*n.r/n.a),this.data[r+1]=Math.round(255*n.g/n.a),this.data[r+2]=Math.round(255*n.b/n.a),this.data[r+3]=Math.round(255*n.a)}}function Oc(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n+=4){let r=e[n+3];t[n+0]=Math.round(e[n+0]*r/255),t[n+1]=Math.round(e[n+1]*r/255),t[n+2]=Math.round(e[n+2]*r/255),t[n+3]=r}return t}function kc(e){let t={},n=e.resolution||256,r=e.clips?e.clips.length:1,i=e.image||new Dc({width:n,height:r});if(Math.log(n)/Math.LN2%1!=0)throw Error(`width is not a power of 2 - ${n}`);let a=(r,a,o)=>{t[e.evaluationKey]=o;let s=e.expression.evaluate(t);i.setPixel(r/4/n,a/4,s)};if(e.clips)for(let t=0,i=0;t<r;++t,i+=4*n)for(let r=0,o=0;r<n;r++,o+=4){let s=r/(n-1),{start:c,end:l}=e.clips[t];a(i,o,c*(1-s)+l*s)}else for(let e=0,t=0;e<n;e++,t+=4)a(0,t,e/(n-1));return i}K(`AlphaImage`,Ec),K(`RGBAImage`,Dc);let Ac=`big-fb`;class jc extends no{createBucket(e){return new bc(e)}constructor(e,t){super(e,Sc,t),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){e===`heatmap-color`&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=kc({expression:this._transitionablePaint._values[`heatmap-color`].value.expression,evaluationKey:`heatmapDensity`,image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(Ac)&&this.heatmapFbos.delete(Ac)}queryRadius(e){return oc(`heatmap-radius`,this,e)}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:n,geometry:r,transform:i,pixelsToTileUnits:a,unwrappedTileID:o,getElevation:s}){return mc({queryGeometry:e,size:this.paint.get(`heatmap-radius`).evaluate(t,n)*a,transform:i,unwrappedTileID:o,getElevation:s},r)}hasOffscreenPass(){return this.paint.get(`heatmap-opacity`)!==0&&!this.isHidden()}}let Mc;var Nc={get paint(){return Mc||=new $a({"hillshade-illumination-direction":new q(N.paint_hillshade[`hillshade-illumination-direction`]),"hillshade-illumination-altitude":new q(N.paint_hillshade[`hillshade-illumination-altitude`]),"hillshade-illumination-anchor":new q(N.paint_hillshade[`hillshade-illumination-anchor`]),"hillshade-exaggeration":new q(N.paint_hillshade[`hillshade-exaggeration`]),"hillshade-shadow-color":new q(N.paint_hillshade[`hillshade-shadow-color`]),"hillshade-highlight-color":new q(N.paint_hillshade[`hillshade-highlight-color`]),"hillshade-accent-color":new q(N.paint_hillshade[`hillshade-accent-color`]),"hillshade-method":new q(N.paint_hillshade[`hillshade-method`]),resampling:new q(N.paint_hillshade.resampling)})}};class Pc extends no{constructor(e,t){super(e,Nc,t),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let e=this.paint.get(`hillshade-illumination-direction`).values,t=this.paint.get(`hillshade-illumination-altitude`).values,n=this.paint.get(`hillshade-highlight-color`).values,r=this.paint.get(`hillshade-shadow-color`).values,i=Math.max(e.length,t.length,n.length,r.length);e=e.concat(Array(i-e.length).fill(e.at(-1))),t=t.concat(Array(i-t.length).fill(t.at(-1))),n=n.concat(Array(i-n.length).fill(n.at(-1))),r=r.concat(Array(i-r.length).fill(r.at(-1)));let a=t.map(xe);return{directionRadians:e.map(xe),altitudeRadians:a,shadowColor:r,highlightColor:n}}hasOffscreenPass(){return this.paint.get(`hillshade-exaggeration`)!==0&&!this.isHidden()}}let Fc;var Ic={get paint(){return Fc||=new $a({"color-relief-opacity":new q(N[`paint_color-relief`][`color-relief-opacity`]),"color-relief-color":new Qa(N[`paint_color-relief`][`color-relief-color`]),resampling:new q(N[`paint_color-relief`].resampling)})}};function Lc(e){return`data`in e}class Rc{constructor(e,t,n,r){this.context=e,this.format=n,this.texture=e.gl.createTexture(),this._ownedHandle=this.texture,this.update(t,r)}update(e,t,n){let{width:r,height:i}=e,a=(this.size?.[0]!==r||this.size[1]!==i)&&!n,{context:o}=this,{gl:s}=o;this.useMipmap=!!t?.useMipmap,s.bindTexture(s.TEXTURE_2D,this.texture),o.pixelStoreUnpackFlipY.set(!1),o.pixelStoreUnpack.set(1);let c=this.format===s.RGBA&&!1!==t?.premultiply;if(a)this.size=[r,i],Lc(e)?(o.pixelStoreUnpackPremultiplyAlpha.set(!1),this._uploadRawData(e,c,r,i,s)):(o.pixelStoreUnpackPremultiplyAlpha.set(c),this._uploadDomImage(e,s));else{let{x:t,y:a}=n||{x:0,y:0};Lc(e)?(o.pixelStoreUnpackPremultiplyAlpha.set(!1),this._updateRawData(e,c,t,a,r,i,s)):(o.pixelStoreUnpackPremultiplyAlpha.set(c),this._updateDomImage(e,t,a,s))}this.useMipmap&&this.isSizePowerOfTwo()&&s.generateMipmap(s.TEXTURE_2D),o.pixelStoreUnpackFlipY.setDefault(),o.pixelStoreUnpack.setDefault(),o.pixelStoreUnpackPremultiplyAlpha.setDefault()}_uploadDomImage(e,t){t.texImage2D(t.TEXTURE_2D,0,this.format,this.format,t.UNSIGNED_BYTE,e)}_uploadRawData(e,t,n,r,i){let{data:a}=e;t&&a&&(a=Oc(a)),i.texImage2D(i.TEXTURE_2D,0,this.format,n,r,0,this.format,i.UNSIGNED_BYTE,a)}_updateDomImage(e,t,n,r){r.texSubImage2D(r.TEXTURE_2D,0,t,n,r.RGBA,r.UNSIGNED_BYTE,e)}_updateRawData(e,t,n,r,i,a,o){let{data:s}=e;t&&s&&(s=Oc(s)),o.texSubImage2D(o.TEXTURE_2D,0,n,r,i,a,o.RGBA,o.UNSIGNED_BYTE,s)}bind(e,t,n){let{context:r}=this,{gl:i}=r;this.texture!==this._ownedHandle&&(this.texture=this._ownedHandle),i.bindTexture(i.TEXTURE_2D,this.texture),n!==i.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(n=i.LINEAR),e!==this.filter&&(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,e),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,n||e),this.filter=e),t!==this.wrap&&(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,t),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,t),this.wrap=t)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){let{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null,this._ownedHandle=null}}class zc{constructor(e,t,n,r=1,i=1,a=1,o=0){if(this.uid=e,t.height!==t.width)throw RangeError(`DEM tiles must be square`);if(n&&![`mapbox`,`terrarium`,`custom`].includes(n))return void de(`"${n}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=t.height;let s=this.dim=t.height-2;switch(this.data=new Uint32Array(t.data.buffer),n){case`terrarium`:this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case`custom`:this.redFactor=r,this.greenFactor=i,this.blueFactor=a,this.baseShift=o;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let e=0;e<s;e++)this.data[this._idx(-1,e)]=this.data[this._idx(0,e)],this.data[this._idx(s,e)]=this.data[this._idx(s-1,e)],this.data[this._idx(e,-1)]=this.data[this._idx(e,0)],this.data[this._idx(e,s)]=this.data[this._idx(e,s-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(s,-1)]=this.data[this._idx(s-1,0)],this.data[this._idx(-1,s)]=this.data[this._idx(0,s-1)],this.data[this._idx(s,s)]=this.data[this._idx(s-1,s-1)],this.min=2**53-1,this.max=-(2**53-1);for(let e=0;e<s;e++)for(let t=0;t<s;t++){let n=this.get(e,t);n>this.max&&(this.max=n),n<this.min&&(this.min=n)}}get(e,t){let n=new Uint8Array(this.data.buffer),r=4*this._idx(e,t);return this.unpack(n[r],n[r+1],n[r+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(e,t){if(e<-1||e>=this.dim+1||t<-1||t>=this.dim+1)throw RangeError(`Out of range source coordinates for DEM data. x: ${e}, y: ${t}, dim: ${this.dim}`);return(t+1)*this.stride+(e+1)}unpack(e,t,n){return e*this.redFactor+t*this.greenFactor+n*this.blueFactor-this.baseShift}pack(e){return Bc(e,this.getUnpackVector())}getPixels(){return new Dc({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,t,n){if(this.dim!==e.dim)throw Error(`dem dimension mismatch`);let r=t*this.dim,i=t*this.dim+this.dim,a=n*this.dim,o=n*this.dim+this.dim;switch(t){case-1:r=i-1;break;case 1:i=r+1}switch(n){case-1:a=o-1;break;case 1:o=a+1}let s=-t*this.dim,c=-n*this.dim;for(let t=a;t<o;t++)for(let n=r;n<i;n++)this.data[this._idx(n,t)]=e.data[this._idx(n+s,t+c)]}}function Bc(e,t){let n=t[0],r=t[1],i=t[2],a=t[3],o=Math.min(n,r,i),s=Math.round((e+a)/o);return{r:Math.floor(s*o/n)%256,g:Math.floor(s*o/r)%256,b:Math.floor(s*o/i)%256}}K(`DEMData`,zc);class Vc extends no{constructor(e,t){super(e,Ic,t)}_createColorRamp(e){let t={elevationStops:[],colorStops:[]},n=this._transitionablePaint._values[`color-relief-color`].value.expression;if(n instanceof _i&&n._styleExpression.expression instanceof jn){this.colorRampExpression=n;let e=n._styleExpression.expression;t.elevationStops=e.labels,t.colorStops=[];for(let n of t.elevationStops)t.colorStops.push(e.evaluate({globals:{elevation:n}}))}if(t.elevationStops.length<1&&(t.elevationStops=[0],t.colorStops=[Gt.transparent]),t.elevationStops.length<2&&(t.elevationStops.push(t.elevationStops[0]+1),t.colorStops.push(t.colorStops[0])),t.elevationStops.length<=e)return t;let r={elevationStops:[],colorStops:[]},i=(t.elevationStops.length-1)/(e-1);for(let e=0;e<t.elevationStops.length-.5;e+=i)r.elevationStops.push(t.elevationStops[Math.round(e)]),r.colorStops.push(t.colorStops[Math.round(e)]);return de(`Too many colors in specification of ${this.id} color-relief layer, may not render properly. Max possible colors: ${e}, provided: ${t.elevationStops.length}`),r}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values[`color-relief-color`].value.expression}getColorRampTextures(e,t,n){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;let r=this._createColorRamp(t),i=new Dc({width:r.colorStops.length,height:1}),a=new Dc({width:r.colorStops.length,height:1});for(let e=0;e<r.elevationStops.length;e++){let t=Bc(r.elevationStops[e],n);a.setPixel(0,e,new Gt(t.r/255,t.g/255,t.b/255,1)),i.setPixel(0,e,r.colorStops[e])}return this.colorRampTextures={elevationTexture:new Rc(e,a,e.gl.RGBA),colorTexture:new Rc(e,i,e.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return!this.isHidden()&&!!this.colorRampTextures}}let{members:Hc}=lo([{name:`a_pos`,components:2,type:`Int16`}],4);function Uc(e,t,n){let r=n.patternDependencies,i=!1;for(let n of t){let t=n.paint.get(`${e}-pattern`);t.isConstant()||(i=!0);let a=t.constantOr(null);a&&(i=!0,r[a.to]=!0,r[a.from]=!0)}return i}function Wc(e,t,n,r,i){let{zoom:a}=r,o=i.patternDependencies;for(let r of t){let t=r.paint.get(`${e}-pattern`).value;if(t.kind!==`constant`){let e=t.evaluate({zoom:a-1},n,{},i.availableImages),s=t.evaluate({zoom:a},n,{},i.availableImages),c=t.evaluate({zoom:a+1},n,{},i.availableImages);e=e?.name?e.name:e,s=s?.name?s.name:s,c=c?.name?c.name:c,o[e]=!0,o[s]=!0,o[c]=!0,n.patterns[r.id]={min:e,mid:s,max:c}}}return n}function Gc(e,t,n,r,i){let a;if(i===function(e,t,n,r){let i=0;for(let a=t,o=n-r;a<n;a+=r)i+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return i}(e,t,n,r)>0)for(let i=t;i<n;i+=r)a=pl(i/r|0,e[i],e[i+1],a);else for(let i=n-r;i>=t;i-=r)a=pl(i/r|0,e[i],e[i+1],a);return a&&sl(a,a.next)&&(ml(a),a=a.next),a}function Kc(e,t){if(!e)return e;t||=e;let n,r=e;do if(n=!1,r.steiner||!sl(r,r.next)&&ol(r.prev,r,r.next)!==0)r=r.next;else{if(ml(r),r=t=r.prev,r===r.next)break;n=!0}while(n||r!==t);return t}function qc(e,t,n,r,i,a,o){if(!e)return;!o&&a&&function(e,t,n,r){let i=e;do i.z===0&&(i.z=tl(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,function(e){let t,n=1;do{let r,i=e;e=null;let a=null;for(t=0;i;){t++;let o=i,s=0;for(let e=0;e<n&&(s++,o=o.nextZ,o);e++);let c=n;for(;s>0||c>0&&o;)s!==0&&(c===0||!o||i.z<=o.z)?(r=i,i=i.nextZ,s--):(r=o,o=o.nextZ,c--),a?a.nextZ=r:e=r,r.prevZ=a,a=r;i=o}a.nextZ=null,n*=2}while(t>1)}(i)}(e,r,i,a);let s=e;for(;e.prev!==e.next;){let c=e.prev,l=e.next;if(a?Yc(e,r,i,a):Jc(e))t.push(c.i,e.i,l.i),ml(e),e=l.next,s=l.next;else if((e=l)===s){o?o===1?qc(e=Xc(Kc(e),t),t,n,r,i,a,2):o===2&&Zc(e,t,n,r,i,a):qc(Kc(e),t,n,r,i,a,1);break}}}function Jc(e){let t=e.prev,n=e,r=e.next;if(ol(t,n,r)>=0)return!1;let i=t.x,a=n.x,o=r.x,s=t.y,c=n.y,l=r.y,u=Math.min(i,a,o),d=Math.min(s,c,l),f=Math.max(i,a,o),p=Math.max(s,c,l),m=r.next;for(;m!==t;){if(m.x>=u&&m.x<=f&&m.y>=d&&m.y<=p&&il(i,s,a,c,o,l,m.x,m.y)&&ol(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function Yc(e,t,n,r){let i=e.prev,a=e,o=e.next;if(ol(i,a,o)>=0)return!1;let s=i.x,c=a.x,l=o.x,u=i.y,d=a.y,f=o.y,p=Math.min(s,c,l),m=Math.min(u,d,f),h=Math.max(s,c,l),g=Math.max(u,d,f),_=tl(p,m,t,n,r),v=tl(h,g,t,n,r),y=e.prevZ,b=e.nextZ;for(;y&&y.z>=_&&b&&b.z<=v;){if(y.x>=p&&y.x<=h&&y.y>=m&&y.y<=g&&y!==i&&y!==o&&il(s,u,c,d,l,f,y.x,y.y)&&ol(y.prev,y,y.next)>=0||(y=y.prevZ,b.x>=p&&b.x<=h&&b.y>=m&&b.y<=g&&b!==i&&b!==o&&il(s,u,c,d,l,f,b.x,b.y)&&ol(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;y&&y.z>=_;){if(y.x>=p&&y.x<=h&&y.y>=m&&y.y<=g&&y!==i&&y!==o&&il(s,u,c,d,l,f,y.x,y.y)&&ol(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;b&&b.z<=v;){if(b.x>=p&&b.x<=h&&b.y>=m&&b.y<=g&&b!==i&&b!==o&&il(s,u,c,d,l,f,b.x,b.y)&&ol(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function Xc(e,t){let n=e;do{let r=n.prev,i=n.next.next;!sl(r,i)&&cl(r,n,n.next,i)&&dl(r,i)&&dl(i,r)&&(t.push(r.i,n.i,i.i),ml(n),ml(n.next),n=e=i),n=n.next}while(n!==e);return Kc(n)}function Zc(e,t,n,r,i,a){let o=e;do{let e=o.next.next;for(;e!==o.prev;){if(o.i!==e.i&&al(o,e)){let s=fl(o,e);o=Kc(o,o.next),s=Kc(s,s.next),qc(o,t,n,r,i,a,0),qc(s,t,n,r,i,a,0);return}e=e.next}o=o.next}while(o!==e)}function Qc(e,t){let n=e.x-t.x;return n===0&&(n=e.y-t.y,n===0)&&(n=(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x)),n}function $c(e,t){let n=function(e,t){let n=t,r=e.x,i=e.y,a,o=-1/0;if(sl(e,n))return n;do{if(sl(e,n.next))return n.next;if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){let e=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(e<=r&&e>o&&(o=e,a=n.x<n.next.x?n:n.next,e===r))return a}n=n.next}while(n!==t);if(!a)return null;let s=a,c=a.x,l=a.y,u=1/0;n=a;do{if(r>=n.x&&n.x>=c&&r!==n.x&&rl(i<l?r:o,i,c,l,i<l?o:r,i,n.x,n.y)){let t=Math.abs(i-n.y)/(r-n.x);dl(n,e)&&(t<u||t===u&&(n.x>a.x||n.x===a.x&&el(a,n)))&&(a=n,u=t)}n=n.next}while(n!==s);return a}(e,t);if(!n)return t;let r=fl(n,e);return Kc(r,r.next),Kc(n,n.next)}function el(e,t){return ol(e.prev,e,t.prev)<0&&ol(t.next,e,e.next)<0}function tl(e,t,n,r,i){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function nl(e){let t=e,n=e;do(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next;while(t!==e);return n}function rl(e,t,n,r,i,a,o,s){return(i-o)*(t-s)>=(e-o)*(a-s)&&(e-o)*(r-s)>=(n-o)*(t-s)&&(n-o)*(a-s)>=(i-o)*(r-s)}function il(e,t,n,r,i,a,o,s){return!(e===o&&t===s)&&rl(e,t,n,r,i,a,o,s)}function al(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&cl(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(dl(e,t)&&dl(t,e)&&function(e,t){let n=e,r=!1,i=(e.x+t.x)/2,a=(e.y+t.y)/2;do n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==e);return r}(e,t)&&(ol(e.prev,e,t.prev)||ol(e,t.prev,t))||sl(e,t)&&ol(e.prev,e,e.next)>0&&ol(t.prev,t,t.next)>0)}function ol(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function sl(e,t){return e.x===t.x&&e.y===t.y}function cl(e,t,n,r){let i=ul(ol(e,t,n)),a=ul(ol(e,t,r)),o=ul(ol(n,r,e)),s=ul(ol(n,r,t));return i!==a&&o!==s||!(i!==0||!ll(e,n,t))||!(a!==0||!ll(e,r,t))||!(o!==0||!ll(n,e,r))||!(s!==0||!ll(n,t,r))}function ll(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function ul(e){return e>0?1:e<0?-1:0}function dl(e,t){return ol(e.prev,e,e.next)<0?ol(e,t,e.next)>=0&&ol(e,e.prev,t)>=0:ol(e,t,e.prev)<0||ol(e,e.next,t)<0}function fl(e,t){let n=hl(e.i,e.x,e.y),r=hl(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function pl(e,t,n,r){let i=hl(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function ml(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function hl(e,t,n){return{i:e,x:t,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class gl{constructor(e,t){if(t>e)throw Error(`Min granularity must not be greater than base granularity.`);this._baseZoomGranularity=e,this._minGranularity=t}getGranularityForZoomLevel(e){return Math.max(Math.floor(this._baseZoomGranularity/(1<<e)),this._minGranularity,1)}}class _l{constructor(e){this.fill=e.fill,this.line=e.line,this.tile=e.tile,this.stencil=e.stencil,this.circle=e.circle}}_l.noSubdivision=new _l({fill:new gl(0,0),line:new gl(0,0),tile:new gl(0,0),stencil:new gl(0,0),circle:1}),K(`SubdivisionGranularityExpression`,gl),K(`SubdivisionGranularitySetting`,_l);let vl=-32768,yl=32767;class bl{constructor(e,t){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=e,this._granularityCellSize=O/e,this._canonical=t}_getKey(e,t){return(e+=32768)<<16|t+32768}_vertexToIndex(e,t){if(e<-32768||t<-32768||e>32767||t>32767)throw Error(`Vertex coordinates are out of signed 16 bit integer range.`);let n=0|Math.round(e),r=0|Math.round(t),i=this._getKey(n,r);if(this._vertexDictionary.has(i))return this._vertexDictionary.get(i);let a=this._vertexBuffer.length/2;return this._vertexDictionary.set(i,a),this._vertexBuffer.push(n,r),a}_subdivideTrianglesScanline(e){if(this._granularity<2)return function(e,t){let n=[];for(let r=0;r<t.length;r+=3){let i=t[r],a=t[r+1],o=t[r+2],s=e[2*i],c=e[2*i+1];(e[2*a]-s)*(e[2*o+1]-c)-(e[2*a+1]-c)*(e[2*o]-s)>0?(n.push(i),n.push(o),n.push(a)):(n.push(i),n.push(a),n.push(o))}return n}(this._vertexBuffer,e);let t=[],n=e.length;for(let r=0;r<n;r+=3){let n=[e[r+0],e[r+1],e[r+2]],i=[this._vertexBuffer[2*e[r+0]+0],this._vertexBuffer[2*e[r+0]+1],this._vertexBuffer[2*e[r+1]+0],this._vertexBuffer[2*e[r+1]+1],this._vertexBuffer[2*e[r+2]+0],this._vertexBuffer[2*e[r+2]+1]],a=1/0,o=1/0,s=-1/0,c=-1/0;for(let e=0;e<3;e++){let t=i[2*e],n=i[2*e+1];a=Math.min(a,t),s=Math.max(s,t),o=Math.min(o,n),c=Math.max(c,n)}if(a===s||o===c)continue;let l=Math.floor(a/this._granularityCellSize),u=Math.ceil(s/this._granularityCellSize),d=Math.floor(o/this._granularityCellSize),f=Math.ceil(c/this._granularityCellSize);if(l!==u||d!==f)for(let e=d;e<f;e++){let r=this._scanlineGenerateVertexRingForCellRow(e,i,n);Cl(this._vertexBuffer,r,t)}else t.push(...n)}return t}_scanlineGenerateVertexRingForCellRow(e,t,n){let r=e*this._granularityCellSize,i=r+this._granularityCellSize,a=[];for(let e=0;e<3;e++){let o=t[2*e],s=t[2*e+1],c=t[2*(e+1)%6],l=t[(2*(e+1)+1)%6],u=t[2*(e+2)%6],d=t[(2*(e+2)+1)%6],f=c-o,p=l-s,m=f===0,h=p===0,g=(r-s)/p,_=(i-s)/p,v=Math.min(g,_),y=Math.max(g,_);if(!h&&(v>=1||y<=0)||h&&(s<r||s>i)){l>=r&&l<=i&&a.push(n[(e+1)%3]);continue}!h&&v>0&&a.push(this._vertexToIndex(o+f*v,s+p*v));let b=o+f*Math.max(v,0),x=o+f*Math.min(y,1);m||this._generateIntraEdgeVertices(a,o,s,c,l,b,x),!h&&y<1&&a.push(this._vertexToIndex(o+f*y,s+p*y)),(h||l>=r&&l<=i)&&a.push(n[(e+1)%3]),!h&&(l<=r||l>=i)&&this._generateInterEdgeVertices(a,o,s,c,l,u,d,x,r,i)}return a}_generateIntraEdgeVertices(e,t,n,r,i,a,o){let s=r-t,c=i-n,l=c===0,u=l?Math.min(t,r):Math.min(a,o),d=l?Math.max(t,r):Math.max(a,o),f=Math.floor(u/this._granularityCellSize)+1,p=Math.ceil(d/this._granularityCellSize)-1;if(l?t<r:a<o)for(let r=f;r<=p;r++){let i=r*this._granularityCellSize;e.push(this._vertexToIndex(i,n+c*(i-t)/s))}else for(let r=p;r>=f;r--){let i=r*this._granularityCellSize;e.push(this._vertexToIndex(i,n+c*(i-t)/s))}}_generateInterEdgeVertices(e,t,n,r,i,a,o,s,c,l){let u=i-n,d=a-r,f=o-i,p=(c-i)/f,m=(l-i)/f,h=Math.min(p,m),g=Math.max(p,m),_=r+d*h,v=Math.floor(Math.min(_,s)/this._granularityCellSize)+1,y=Math.ceil(Math.max(_,s)/this._granularityCellSize)-1,b=s<_,x=f===0;if(x&&(o===c||o===l))return;if(x||h>=1||g<=0){let e=n-o,r=a+(t-a)*Math.min((c-o)/e,(l-o)/e);v=Math.floor(Math.min(r,s)/this._granularityCellSize)+1,y=Math.ceil(Math.max(r,s)/this._granularityCellSize)-1,b=s<r}let S=u>0?l:c;if(b)for(let t=v;t<=y;t++)e.push(this._vertexToIndex(t*this._granularityCellSize,S));else for(let t=y;t>=v;t--)e.push(this._vertexToIndex(t*this._granularityCellSize,S))}_generateOutline(e){let t=[];for(let n of e){let e=Sl(n,this._granularity,!0),r=this._pointArrayToIndices(e),i=[];for(let e=1;e<r.length;e++)i.push(r[e-1]),i.push(r[e]);t.push(i)}return t}_handlePoles(e){let t=!1,n=!1;this._canonical&&(this._canonical.y===0&&(t=!0),this._canonical.y===(1<<this._canonical.z)-1&&(n=!0)),(t||n)&&this._fillPoles(e,t,n)}_ensureNoPoleVertices(){let e=this._vertexBuffer;for(let t=0;t<e.length;t+=2){let n=e[t+1];n===vl&&(e[t+1]=-32767),n===yl&&(e[t+1]=32766)}}_generatePoleQuad(e,t,n,r,i,a){r>i==(a===vl)?(e.push(n),e.push(t),e.push(this._vertexToIndex(r,a)),e.push(this._vertexToIndex(i,a)),e.push(n),e.push(this._vertexToIndex(r,a))):(e.push(t),e.push(n),e.push(this._vertexToIndex(r,a)),e.push(n),e.push(this._vertexToIndex(i,a)),e.push(this._vertexToIndex(r,a)))}_fillPoles(e,t,n){let r=this._vertexBuffer,i=O,a=e.length;for(let o=2;o<a;o+=3){let a=e[o-2],s=e[o-1],c=e[o],l=r[2*a],u=r[2*a+1],d=r[2*s],f=r[2*s+1],p=r[2*c],m=r[2*c+1];t&&(u===0&&f===0&&this._generatePoleQuad(e,a,s,l,d,vl),f===0&&m===0&&this._generatePoleQuad(e,s,c,d,p,vl),m===0&&u===0&&this._generatePoleQuad(e,c,a,p,l,vl)),n&&(u===i&&f===i&&this._generatePoleQuad(e,a,s,l,d,yl),f===i&&m===i&&this._generatePoleQuad(e,s,c,d,p,yl),m===i&&u===i&&this._generatePoleQuad(e,c,a,p,l,yl))}}_initializeVertices(e){for(let t=0;t<e.length;t+=2)this._vertexToIndex(e[t],e[t+1])}subdividePolygonInternal(e,t){if(this._used)throw Error(`Subdivision: multiple use not allowed.`);this._used=!0;let{flattened:n,holeIndices:r}=function(e){let t=[],n=[];for(let r of e)if(r.length!==0){r!==e[0]&&t.push(n.length/2);for(let e of r)n.push(e.x),n.push(e.y)}return{flattened:n,holeIndices:t}}(e),i;this._initializeVertices(n);try{let e=function(e,t,n=2){let r=t&&t.length,i=r?t[0]*n:e.length,a=Gc(e,0,i,n,!0),o=[];if(!a||a.next===a.prev)return o;let s,c,l;if(r&&(a=function(e,t,n,r){let i=[];for(let n=0,a=t.length;n<a;n++){let o=Gc(e,t[n]*r,n<a-1?t[n+1]*r:e.length,r,!1);o===o.next&&(o.steiner=!0),i.push(nl(o))}i.sort(Qc);for(let e=0;e<i.length;e++)n=$c(i[e],n);return n}(e,t,a,n)),e.length>80*n){s=e[0],c=e[1];let t=s,r=c;for(let a=n;a<i;a+=n){let n=e[a],i=e[a+1];n<s&&(s=n),i<c&&(c=i),n>t&&(t=n),i>r&&(r=i)}l=Math.max(t-s,r-c),l=l===0?0:32767/l}return qc(a,o,n,s,c,l,0),o}(n,r),t=this._convertIndices(n,e);i=this._subdivideTrianglesScanline(t)}catch(e){console.error(e)}let a=[];return t&&(a=this._generateOutline(e)),this._ensureNoPoleVertices(),this._handlePoles(i),{verticesFlattened:this._vertexBuffer,indicesTriangles:i,indicesLineList:a}}_convertIndices(e,t){let n=[];for(let r of t)n.push(this._vertexToIndex(e[2*r],e[2*r+1]));return n}_pointArrayToIndices(e){let t=[];for(let n of e)t.push(this._vertexToIndex(n.x,n.y));return t}}function xl(e,t,n,r=!0){return new bl(n,t).subdividePolygonInternal(e,r)}function Sl(e,t,r=!1){if(!e||e.length<1||e.length<2)return[];let i=e[0],a=e[e.length-1],o=r&&(i.x!==a.x||i.y!==a.y);if(t<2)return o?[...e,e[0]]:[...e];let s=Math.floor(O/t),c=[];c.push(new n(e[0].x,e[0].y));let l=e.length,u=o?l:l-1;for(let t=0;t<u;t++){let r=e[t],i=t<l-1?e[t+1]:e[0],a=r.x,o=r.y,u=i.x,d=i.y,f=a!==u,p=o!==d;if(!f&&!p)continue;let m=u-a,h=d-o,g=Math.abs(m),_=Math.abs(h),v=a,y=o;for(;;){let e=m>0?(Math.floor(v/s)+1)*s:(Math.ceil(v/s)-1)*s,t=h>0?(Math.floor(y/s)+1)*s:(Math.ceil(y/s)-1)*s,r=Math.abs(v-e),i=Math.abs(y-t),a=Math.abs(v-u),o=Math.abs(y-d),l=f?r/g:1/0,b=p?i/_:1/0;if((a<=r||!f)&&(o<=i||!p))break;if(l<b&&f||!p){v=e,y+=h*l;let t=new n(v,Math.round(y));c[c.length-1].x===t.x&&c[c.length-1].y===t.y||c.push(t)}else{v+=m*b,y=t;let e=new n(Math.round(v),y);c[c.length-1].x===e.x&&c[c.length-1].y===e.y||c.push(e)}}let b=new n(u,d);c[c.length-1].x===b.x&&c[c.length-1].y===b.y||c.push(b)}return c}function Cl(e,t,n){if(t.length===0)throw Error(`Subdivision vertex ring is empty.`);let r=0,i=e[2*t[0]];for(let n=1;n<t.length;n++){let a=e[2*t[n]];a<i&&(i=a,r=n)}let a=t.length,o=r,s=(o+1)%a;for(;;){let r=o-1>=0?o-1:a-1,i=(s+1)%a,c=e[2*t[r]],l=e[2*t[i]],u=e[2*t[o]],d=e[2*t[o]+1],f=e[2*t[s]+1],p=!1;if(c<l)p=!0;else if(c>l)p=!1;else{let n=f-d,a=-(e[2*t[s]]-u),o=d<f?1:-1;((c-u)*n+(e[2*t[r]+1]-d)*a)*o>((l-u)*n+(e[2*t[i]+1]-d)*a)*o&&(p=!0)}if(p){let e=t[r],i=t[o],c=t[s];e!==i&&e!==c&&i!==c&&n.push(c,i,e),o--,o<0&&(o=a-1)}else{let e=t[i],r=t[o],c=t[s];e!==r&&e!==c&&r!==c&&n.push(c,r,e),s++,s>=a&&(s=0)}if(r===i)break}}function wl(e,t,n,r,i,a,o,s,c){let l=i.length/2,u=o&&s&&c;if(l<us.MAX_VERTEX_ARRAY_LENGTH){let d=t.prepareSegment(l,n,r),f=d.vertexLength;for(let e=0;e<a.length;e+=3)r.emplaceBack(f+a[e],f+a[e+1],f+a[e+2]);let p,m;d.vertexLength+=l,d.primitiveLength+=a.length/3,u&&(m=o.prepareSegment(l,n,s),p=m.vertexLength,m.vertexLength+=l);for(let t=0;t<i.length;t+=2)e(i[t],i[t+1]);if(u)for(let e of c){for(let t=1;t<e.length;t+=2)s.emplaceBack(p+e[t-1],p+e[t]);m.primitiveLength+=e.length/2}}else(function(e,t,n,r,i,a){let o=[];for(let e=0;e<r.length/2;e++)o.push(-1);let s={count:0},c=0,l=e.getOrCreateLatestSegment(t,n),u=l.vertexLength;for(let d=2;d<i.length;d+=3){let f=i[d-2],p=i[d-1],m=i[d],h=o[f]<c,g=o[p]<c,_=o[m]<c;l.vertexLength+(+!!h+ +!!g+ +!!_)>us.MAX_VERTEX_ARRAY_LENGTH&&(l=e.createNewSegment(t,n),c=s.count,h=!0,g=!0,_=!0,u=0);let v=Tl(o,r,a,s,f,h,l),y=Tl(o,r,a,s,p,g,l),b=Tl(o,r,a,s,m,_,l);n.emplaceBack(u+v-c,u+y-c,u+b-c),l.primitiveLength++}})(t,n,r,i,a,e),u&&function(e,t,n,r,i,a){let o=[];for(let e=0;e<r.length/2;e++)o.push(-1);let s={count:0},c=0,l=e.getOrCreateLatestSegment(t,n),u=l.vertexLength;for(let d of i)for(let i=1;i<d.length;i+=2){let f=d[i-1],p=d[i],m=o[f]<c,h=o[p]<c;l.vertexLength+(+!!m+ +!!h)>us.MAX_VERTEX_ARRAY_LENGTH&&(l=e.createNewSegment(t,n),c=s.count,m=!0,h=!0,u=0);let g=Tl(o,r,a,s,f,m,l),_=Tl(o,r,a,s,p,h,l);n.emplaceBack(u+g-c,u+_-c),l.primitiveLength++}}(o,n,s,i,c,e),t.forceNewSegmentOnNextPrepare(),o?.forceNewSegmentOnNextPrepare()}function Tl(e,t,n,r,i,a,o){if(a){let a=r.count;return n(t[2*i],t[2*i+1]),e[i]=r.count,r.count++,o.vertexLength++,a}return e[i]}class El{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.hasDependencies=!1,this.patternFeatures=[],this.layoutVertexArray=new Xo,this.indexArray=new ss,this.indexArray2=new cs,this.programConfigurations=new zs(e.layers,e.zoom),this.segments=new us,this.segments2=new us,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,t,n){this.hasDependencies=Uc(`fill`,this.layers,t);let r=this.layers[0].layout.get(`fill-sort-key`),i=!r.isConstant(),a=[];for(let{feature:o,id:s,index:c,sourceLayerIndex:l}of e){let e=this.layers[0]._featureFilter.needGeometry,u=Gs(o,e);if(!this.layers[0]._featureFilter.filter(new za(this.zoom),u,n))continue;let d=i?r.evaluate(u,{},n,t.availableImages):void 0,f={id:s,properties:o.properties,type:o.type,sourceLayerIndex:l,index:c,geometry:e?u.geometry:Ws(o),patterns:{},sortKey:d};a.push(f)}i&&a.sort(((e,t)=>e.sortKey-t.sortKey));for(let r of a){let{geometry:i,index:a,sourceLayerIndex:o}=r;if(this.hasDependencies){let e=Wc(`fill`,this.layers,r,{zoom:this.zoom},t);this.patternFeatures.push(e)}else this.addFeature(r,i,a,n,{},t.subdivisionGranularity);t.featureIndex.insert(e[a].feature,i,a,o,this.index)}}update(e,t,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions:n})}addFeatures(e,t,n){for(let r of this.patternFeatures)this.addFeature(r,r.geometry,r.index,t,n,e.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Hc),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(e,t,n,r,i,a){for(let e of L(t,500)){let t=xl(e,r,a.fill.getGranularityForZoomLevel(r.z)),n=this.layoutVertexArray;wl(((e,t)=>{n.emplaceBack(e,t)}),this.segments,this.layoutVertexArray,this.indexArray,t.verticesFlattened,t.indicesTriangles,this.segments2,this.indexArray2,t.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,{imagePositions:i,canonical:r})}}let Dl,Ol;K(`FillBucket`,El,{omit:[`layers`,`patternFeatures`]});var kl={get paint(){return Ol||=new $a({"fill-antialias":new q(N.paint_fill[`fill-antialias`]),"fill-opacity":new J(N.paint_fill[`fill-opacity`]),"fill-color":new J(N.paint_fill[`fill-color`]),"fill-outline-color":new J(N.paint_fill[`fill-outline-color`]),"fill-translate":new q(N.paint_fill[`fill-translate`]),"fill-translate-anchor":new q(N.paint_fill[`fill-translate-anchor`]),"fill-pattern":new Xa(N.paint_fill[`fill-pattern`])})},get layout(){return Dl||=new $a({"fill-sort-key":new J(N.layout_fill[`fill-sort-key`])})}};class Al extends no{constructor(e,t){super(e,kl,t)}recalculate(e,t){super.recalculate(e,t);let n=this.paint._values[`fill-outline-color`];n.value.kind===`constant`&&n.value.value===void 0&&(this.paint._values[`fill-outline-color`]=this.paint._values[`fill-color`])}createBucket(e){return new El(e)}queryRadius(){return sc(this.paint.get(`fill-translate`))}queryIntersectsFeature({queryGeometry:e,geometry:t,transform:n,pixelsToTileUnits:r}){return Zs(cc(e,this.paint.get(`fill-translate`),this.paint.get(`fill-translate-anchor`),-n.bearingInRadians,r),t)}isTileClipped(){return!0}}let jl=lo([{name:`a_pos`,components:2,type:`Int16`},{name:`a_normal_ed`,components:4,type:`Int16`}],4),Ml=lo([{name:`a_centroid`,components:2,type:`Int16`}],4),{members:Nl}=jl;class Pl{constructor(e,t,n,r,i){this.properties={},this.extent=n,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=r,this._values=i,e.readFields(Fl,this,t)}loadGeometry(){let e=this._pbf;e.pos=this._geometry;let t=e.readVarint()+e.pos,r=[],i,a=1,o=0,s=0,c=0;for(;e.pos<t;){if(o<=0){let t=e.readVarint();a=7&t,o=t>>3}if(o--,a===1||a===2)s+=e.readSVarint(),c+=e.readSVarint(),a===1&&(i&&r.push(i),i=[]),i&&i.push(new n(s,c));else{if(a!==7)throw Error(`unknown command ${a}`);i&&i.push(i[0].clone())}}return i&&r.push(i),r}bbox(){let e=this._pbf;e.pos=this._geometry;let t=e.readVarint()+e.pos,n=1,r=0,i=0,a=0,o=1/0,s=-1/0,c=1/0,l=-1/0;for(;e.pos<t;){if(r<=0){let t=e.readVarint();n=7&t,r=t>>3}if(r--,n===1||n===2)i+=e.readSVarint(),a+=e.readSVarint(),i<o&&(o=i),i>s&&(s=i),a<c&&(c=a),a>l&&(l=a);else if(n!==7)throw Error(`unknown command ${n}`)}return[o,c,s,l]}toGeoJSON(e,t,n){let r=this.extent*2**n,i=this.extent*e,a=this.extent*t,o=this.loadGeometry();function s(e){return[360*(e.x+i)/r-180,360/Math.PI*Math.atan(Math.exp((1-2*(e.y+a)/r)*Math.PI))-90]}function c(e){return e.map(s)}let l;if(this.type===1){let e=[];for(let t of o)e.push(t[0]);let t=c(e);l=e.length===1?{type:`Point`,coordinates:t[0]}:{type:`MultiPoint`,coordinates:t}}else if(this.type===2){let e=o.map(c);l=e.length===1?{type:`LineString`,coordinates:e[0]}:{type:`MultiLineString`,coordinates:e}}else{if(this.type!==3)throw Error(`unknown feature type`);{let e=Il(o),t=[];for(let n of e)t.push(n.map(c));l=t.length===1?{type:`Polygon`,coordinates:t[0]}:{type:`MultiPolygon`,coordinates:t}}}let u={type:`Feature`,geometry:l,properties:this.properties};return this.id!=null&&(u.id=this.id),u}}function Fl(e,t,n){e===1?t.id=n.readVarint():e===2?function(e,t){let n=e.readVarint()+e.pos;for(;e.pos<n;){let n=t._keys[e.readVarint()],r=t._values[e.readVarint()];t.properties[n]=r}}(n,t):e===3?t.type=n.readVarint():e===4&&(t._geometry=n.pos)}function Il(e){let t=e.length;if(t<=1)return[e];let n=[],r,i;for(let a=0;a<t;a++){let t=Ll(e[a]);t!==0&&(i===void 0&&(i=t<0),i===t<0?(r&&n.push(r),r=[e[a]]):r&&r.push(e[a]))}return r&&n.push(r),n}function Ll(e){let t=0;for(let n,r,i=0,a=e.length,o=a-1;i<a;o=i++)n=e[i],r=e[o],t+=(r.x-n.x)*(n.y+r.y);return t}Pl.types=[`Unknown`,`Point`,`LineString`,`Polygon`];class Rl{constructor(e,t){this.version=1,this.name=``,this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(zl,this,t),this.length=this._features.length}feature(e){if(e<0||e>=this._features.length)throw Error(`feature index out of bounds`);this._pbf.pos=this._features[e];let t=this._pbf.readVarint()+this._pbf.pos;return new Pl(this._pbf,t,this.extent,this._keys,this._values)}}function zl(e,t,n){e===15?t.version=n.readVarint():e===1?t.name=n.readString():e===5?t.extent=n.readVarint():e===2?t._features.push(n.pos):e===3?t._keys.push(n.readString()):e===4&&t._values.push(function(e){let t=null,n=e.readVarint()+e.pos;for(;e.pos<n;){let n=e.readVarint()>>3;t=n===1?e.readString():n===2?e.readFloat():n===3?e.readDouble():n===4?e.readVarint64():n===5?e.readVarint():n===6?e.readSVarint():n===7?e.readBoolean():null}if(t==null)throw Error(`unknown feature value`);return t}(n))}class Bl{constructor(e,t){this.layers=e.readFields(Vl,{},t)}}function Vl(e,t,n){if(e===3){let e=new Rl(n,n.readVarint()+n.pos);e.length&&(t[e.name]=e)}}let Hl=2**13;function Ul(e,t,n,r,i,a,o,s){e.emplaceBack(t,n,2*Math.floor(r*Hl)+o,i*Hl*2,a*Hl*2,Math.round(s))}class Wl{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.hasDependencies=!1,this.layoutVertexArray=new Zo,this.centroidVertexArray=new Jo,this.indexArray=new ss,this.programConfigurations=new zs(e.layers,e.zoom),this.segments=new us,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,t,n){this.features=[],this.hasDependencies=Uc(`fill-extrusion`,this.layers,t);for(let{feature:r,id:i,index:a,sourceLayerIndex:o}of e){let e=this.layers[0]._featureFilter.needGeometry,s=Gs(r,e);if(!this.layers[0]._featureFilter.filter(new za(this.zoom),s,n))continue;let c={id:i,sourceLayerIndex:o,index:a,geometry:e?s.geometry:Ws(r),properties:r.properties,type:r.type,patterns:{}};this.hasDependencies?this.features.push(Wc(`fill-extrusion`,this.layers,c,{zoom:this.zoom},t)):this.addFeature(c,c.geometry,a,n,{},t.subdivisionGranularity),t.featureIndex.insert(r,c.geometry,a,o,this.index,!0)}}addFeatures(e,t,n){for(let r of this.features){let{geometry:i}=r;this.addFeature(r,i,r.index,t,n,e.subdivisionGranularity)}}update(e,t,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions:n})}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Nl),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,Ml.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,t,n,r,i,a){for(let n of L(t,500)){let t={x:0,y:0,sampleCount:0},i=this.layoutVertexArray.length;this.processPolygon(t,r,e,n,a);let o=this.layoutVertexArray.length-i,s=Math.floor(t.x/t.sampleCount),c=Math.floor(t.y/t.sampleCount);for(let e=0;e<o;e++)this.centroidVertexArray.emplaceBack(s,c)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,{imagePositions:i,canonical:r})}processPolygon(e,t,n,r,i){if(r.length<1||ql(r[0]))return;for(let t of r)t.length!==0&&Gl(e,t);let a={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},o=i.fill.getGranularityForZoomLevel(t.z),s=Pl.types[n.type]===`Polygon`;for(let e of r){if(e.length===0||ql(e))continue;let t=Sl(e,o,s);this._generateSideFaces(t,a)}if(!s)return;let c=xl(r,t,o,!1),l=this.layoutVertexArray;wl(((e,t)=>{Ul(l,e,t,0,0,1,1,0)}),this.segments,this.layoutVertexArray,this.indexArray,c.verticesFlattened,c.indicesTriangles)}_generateSideFaces(e,t){let n=0;for(let r=1;r<e.length;r++){let i=e[r],a=e[r-1];if(Kl(i,a))continue;t.segment.vertexLength+4>us.MAX_VERTEX_ARRAY_LENGTH&&(t.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let o=i.sub(a)._perp()._unit(),s=a.dist(i);n+s>32768&&(n=0),Ul(this.layoutVertexArray,i.x,i.y,o.x,o.y,0,0,n),Ul(this.layoutVertexArray,i.x,i.y,o.x,o.y,0,1,n),n+=s,Ul(this.layoutVertexArray,a.x,a.y,o.x,o.y,0,0,n),Ul(this.layoutVertexArray,a.x,a.y,o.x,o.y,0,1,n);let c=t.segment.vertexLength;this.indexArray.emplaceBack(c,c+2,c+1),this.indexArray.emplaceBack(c+1,c+2,c+3),t.segment.vertexLength+=4,t.segment.primitiveLength+=2}}}function Gl(e,t){for(let n=0;n<t.length;n++){let r=t[n];n===t.length-1&&t[0].x===r.x&&t[0].y===r.y||(e.x+=r.x,e.y+=r.y,e.sampleCount++)}}function Kl(e,t){return e.x===t.x&&(e.x<0||e.x>O)||e.y===t.y&&(e.y<0||e.y>O)}function ql(e){return e.every((e=>e.x<0))||e.every((e=>e.x>O))||e.every((e=>e.y<0))||e.every((e=>e.y>O))}let Jl;K(`FillExtrusionBucket`,Wl,{omit:[`layers`,`features`]});var Yl={get paint(){return Jl||=new $a({"fill-extrusion-opacity":new q(N[`paint_fill-extrusion`][`fill-extrusion-opacity`]),"fill-extrusion-color":new J(N[`paint_fill-extrusion`][`fill-extrusion-color`]),"fill-extrusion-translate":new q(N[`paint_fill-extrusion`][`fill-extrusion-translate`]),"fill-extrusion-translate-anchor":new q(N[`paint_fill-extrusion`][`fill-extrusion-translate-anchor`]),"fill-extrusion-pattern":new Xa(N[`paint_fill-extrusion`][`fill-extrusion-pattern`]),"fill-extrusion-height":new J(N[`paint_fill-extrusion`][`fill-extrusion-height`]),"fill-extrusion-base":new J(N[`paint_fill-extrusion`][`fill-extrusion-base`]),"fill-extrusion-vertical-gradient":new q(N[`paint_fill-extrusion`][`fill-extrusion-vertical-gradient`])})}};class Xl extends no{constructor(e,t){super(e,Yl,t)}createBucket(e){return new Wl(e)}queryRadius(){return sc(this.paint.get(`fill-extrusion-translate`))}is3D(){return!0}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:r,geometry:i,transform:a,pixelsToTileUnits:o,pixelPosMatrix:s}){let c=cc(e,this.paint.get(`fill-extrusion-translate`),this.paint.get(`fill-extrusion-translate-anchor`),-a.bearingInRadians,o),l=this.paint.get(`fill-extrusion-height`).evaluate(t,r),u=this.paint.get(`fill-extrusion-base`).evaluate(t,r),d=function(e,t){let r=[];for(let i of e){let e=[i.x,i.y,0,1];C(e,e,t),r.push(new n(e[0]/e[3],e[1]/e[3]))}return r}(c,s),f=function(e,t,r,i){let a=[],o=[],s=i[8]*t,c=i[9]*t,l=i[10]*t,u=i[11]*t,d=i[8]*r,f=i[9]*r,p=i[10]*r,m=i[11]*r;for(let t of e){let e=[],r=[];for(let a of t){let t=a.x,o=a.y,h=i[0]*t+i[4]*o+i[12],g=i[1]*t+i[5]*o+i[13],_=i[2]*t+i[6]*o+i[14],v=i[3]*t+i[7]*o+i[15],y=_+l,b=v+u,x=h+d,S=g+f,C=_+p,w=v+m,T=new n((h+s)/b,(g+c)/b);T.z=y/b,e.push(T);let E=new n(x/w,S/w);E.z=C/w,r.push(E)}a.push(e),o.push(r)}return[a,o]}(i,u,l,s);return function(e,t,n){let r=1/0;Zs(n,t)&&(r=Ql(n,t[0]));for(let i=0;i<t.length;i++){let a=t[i],o=e[i];for(let e=0;e<a.length-1;e++){let t=a[e],i=[t,a[e+1],o[e+1],o[e],t];Ys(n,i)&&(r=Math.min(r,Ql(n,i)))}}return r!==1/0&&r}(f[0],f[1],d)}}function Zl(e,t){return e.x*t.x+e.y*t.y}function Ql(e,t){if(e.length===1){let n=0,r=t[n++],i;for(;!i||r.equals(i);)if(i=t[n++],!i)return 1/0;for(;n<t.length;n++){let a=t[n],o=e[0],s=i.sub(r),c=a.sub(r),l=o.sub(r),u=Zl(s,s),d=Zl(s,c),f=Zl(c,c),p=Zl(l,s),m=Zl(l,c),h=u*f-d*d,g=(f*p-d*m)/h,_=(u*m-d*p)/h,v=r.z*(1-g-_)+i.z*g+a.z*_;if(isFinite(v))return v}return 1/0}{let e=1/0;for(let n of t)e=Math.min(e,n.z);return e}}let $l=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class eu{static from(e){if(!(e instanceof ArrayBuffer))throw Error(`Data must be an instance of ArrayBuffer.`);let[t,n]=new Uint8Array(e,0,2);if(t!==219)throw Error(`Data does not appear to be in a KDBush format.`);let r=n>>4;if(r!==1)throw Error(`Got v${r} data when expected v1.`);let i=$l[15&n];if(!i)throw Error(`Unrecognized array type.`);let[a]=new Uint16Array(e,2,1),[o]=new Uint32Array(e,4,1);return new eu(o,a,i,e)}constructor(e,t=64,n=Float64Array,r){if(isNaN(e)||e<0)throw Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=n,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;let i=$l.indexOf(this.ArrayType),a=2*e*this.ArrayType.BYTES_PER_ELEMENT,o=e*this.IndexArrayType.BYTES_PER_ELEMENT,s=(8-o%8)%8;if(i<0)throw Error(`Unexpected typed array class: ${n}.`);r&&r instanceof ArrayBuffer?(this.data=r,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+o+s,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+a+o+s),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+o+s,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+i]),new Uint16Array(this.data,2,1)[0]=t,new Uint32Array(this.data,4,1)[0]=e)}add(e,t){let n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=e,this.coords[this._pos++]=t,n}finish(){let e=this._pos>>1;if(e!==this.numItems)throw Error(`Added ${e} items when expected ${this.numItems}.`);return tu(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,n,r){if(!this._finished)throw Error(`Data not yet indexed - call index.finish().`);let{ids:i,coords:a,nodeSize:o}=this,s=[0,i.length-1,0],c=[];for(;s.length;){let l=s.pop()||0,u=s.pop()||0,d=s.pop()||0;if(u-d<=o){for(let o=d;o<=u;o++){let s=a[2*o],l=a[2*o+1];s>=e&&s<=n&&l>=t&&l<=r&&c.push(i[o])}continue}let f=d+u>>1,p=a[2*f],m=a[2*f+1];p>=e&&p<=n&&m>=t&&m<=r&&c.push(i[f]),(l===0?e<=p:t<=m)&&(s.push(d),s.push(f-1),s.push(1-l)),(l===0?n>=p:r>=m)&&(s.push(f+1),s.push(u),s.push(1-l))}return c}within(e,t,n){if(!this._finished)throw Error(`Data not yet indexed - call index.finish().`);let{ids:r,coords:i,nodeSize:a}=this,o=[0,r.length-1,0],s=[],c=n*n;for(;o.length;){let l=o.pop()||0,u=o.pop()||0,d=o.pop()||0;if(u-d<=a){for(let n=d;n<=u;n++)au(i[2*n],i[2*n+1],e,t)<=c&&s.push(r[n]);continue}let f=d+u>>1,p=i[2*f],m=i[2*f+1];au(p,m,e,t)<=c&&s.push(r[f]),(l===0?e-n<=p:t-n<=m)&&(o.push(d),o.push(f-1),o.push(1-l)),(l===0?e+n>=p:t+n>=m)&&(o.push(f+1),o.push(u),o.push(1-l))}return s}}function tu(e,t,n,r,i,a){if(i-r<=n)return;let o=r+i>>1;nu(e,t,o,r,i,a),tu(e,t,n,r,o-1,1-a),tu(e,t,n,o+1,i,1-a)}function nu(e,t,n,r,i,a){for(;i>r;){if(i-r>600){let o=i-r+1,s=n-r+1,c=Math.log(o),l=.5*Math.exp(2*c/3),u=.5*Math.sqrt(c*l*(o-l)/o)*(s-o/2<0?-1:1);nu(e,t,n,Math.max(r,Math.floor(n-s*l/o+u)),Math.min(i,Math.floor(n+(o-s)*l/o+u)),a)}let o=t[2*n+a],s=r,c=i;for(ru(e,t,r,n),t[2*i+a]>o&&ru(e,t,r,i);s<c;){for(ru(e,t,s,c),s++,c--;t[2*s+a]<o;)s++;for(;t[2*c+a]>o;)c--}t[2*r+a]===o?ru(e,t,r,c):(c++,ru(e,t,c,i)),c<=n&&(r=c+1),n<=c&&(i=c-1)}}function ru(e,t,n,r){iu(e,n,r),iu(t,2*n,2*r),iu(t,2*n+1,2*r+1)}function iu(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function au(e,t,n,r){let i=e-n,a=t-r;return i*i+a*a}function ou(e,t,n,r){let i=r,a=t+(n-t>>1),o,s=n-t,c=e[t],l=e[t+1],u=e[n],d=e[n+1];for(let r=t+3;r<n;r+=3){let t=su(e[r],e[r+1],c,l,u,d);if(t>i)o=r,i=t;else if(t===i){let e=Math.abs(r-a);e<s&&(o=r,s=e)}}i>r&&(o-t>3&&ou(e,t,o,r),e[o+2]=i,n-o>3&&ou(e,o,n,r))}function su(e,t,n,r,i,a){let o=i-n,s=a-r;if(o!==0||s!==0){let c=((e-n)*o+(t-r)*s)/(o*o+s*s);c>1?(n=i,r=a):c>0&&(n+=o*c,r+=s*c)}return o=e-n,s=t-r,o*o+s*s}function cu(e,t,n,r){let i={type:t,geom:n},a={id:e??null,type:i.type,geometry:i.geom,tags:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};switch(i.type){case`Point`:case`MultiPoint`:uu(a,i.geom);break;case`LineString`:uu(a,i.geom.points);break;case`Polygon`:uu(a,i.geom[0].points);break;case`MultiLineString`:for(let e of i.geom)uu(a,e.points);break;case`MultiPolygon`:for(let e of i.geom)uu(a,e[0].points)}return a}function lu(e){e.points.length>64&&(e.points=new Float64Array(e.points))}function uu(e,t){for(let n=0;n<t.length;n+=3)e.minX=Math.min(e.minX,t[n]),e.minY=Math.min(e.minY,t[n+1]),e.maxX=Math.max(e.maxX,t[n]),e.maxY=Math.max(e.maxY,t[n+1])}function du(e,t){let n=[];switch(e.type){case`FeatureCollection`:for(let r=0;r<e.features.length;r++)fu(n,e.features[r],t,r);break;case`Feature`:fu(n,e,t);break;default:fu(n,{geometry:e,properties:void 0},t)}return n}function fu(e,t,n,r){if(!t.geometry)return;if(t.geometry.type===`GeometryCollection`)return void function(e,t,n,r,i){for(let a of n.geometries)fu(e,{id:t.id,geometry:a,properties:t.properties},r,i)}(e,t,t.geometry,n,r);if(!t.geometry.coordinates?.length)return;let i=function(e,t,n){return t.promoteId?e.properties?.[t.promoteId]:t.generateId?n||0:e.id}(t,n,r),a=(n.tolerance/((1<<n.maxZoom)*n.extent))**2;switch(t.geometry.type){case`Point`:(function(e,t,n,r){let i=[];i.push(hu(n.coordinates[0]),gu(n.coordinates[1]),0),e.push(cu(t,`Point`,i,r))})(e,i,t.geometry,t.properties);return;case`MultiPoint`:(function(e,t,n,r){let i=[];for(let e of n.coordinates)i.push(hu(e[0]),gu(e[1]),0);e.push(cu(t,`MultiPoint`,i,r))})(e,i,t.geometry,t.properties);return;case`LineString`:(function(e,t,n,r,i){let a={points:[]};pu(n.coordinates,a,r,!1),e.push(cu(t,`LineString`,a,i))})(e,i,t.geometry,a,t.properties);return;case`MultiLineString`:(function(e,t,n,r,i,a){if(i.lineMetrics)for(let i of n.coordinates){let n={points:[]};pu(i,n,r,!1),e.push(cu(t,`LineString`,n,a))}else{let i=[];mu(n.coordinates,i,r,!1),e.push(cu(t,`MultiLineString`,i,a))}})(e,i,t.geometry,a,n,t.properties);return;case`Polygon`:(function(e,t,n,r,i){let a=[];mu(n.coordinates,a,r,!0),e.push(cu(t,`Polygon`,a,i))})(e,i,t.geometry,a,t.properties);return;case`MultiPolygon`:(function(e,t,n,r,i){let a=[];for(let e of n.coordinates){let t=[];mu(e,t,r,!0),a.push(t)}e.push(cu(t,`MultiPolygon`,a,i))})(e,i,t.geometry,a,t.properties);return;default:throw Error(`Input data is not a valid GeoJSON object.`)}}function pu(e,t,n,r){let i,a,o=0;for(let n=0;n<e.length;n++){let s=hu(e[n][0]),c=gu(e[n][1]);t.points.push(s,c,0),n>0&&(o+=r?(i*c-s*a)/2:Math.sqrt((s-i)**2+(c-a)**2)),i=s,a=c}let s=t.points.length-3;t.points[2]=1,n>0&&ou(t.points,0,s,n),t.points[s+2]=1,lu(t),t.size=Math.abs(o),t.start=0,t.end=t.size}function mu(e,t,n,r){for(let i=0;i<e.length;i++){let a={points:[]};pu(e[i],a,n,r),t.push(a)}}function hu(e){return e/360+.5}function gu(e){let t=Math.sin(e*Math.PI/180),n=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return n<0?0:n>1?1:n}function _u(e){let t={type:`Feature`,geometry:vu(e),properties:e.tags};return e.id!=null&&(t.id=e.id),t}function vu(e){let{type:t,geometry:n}=e;switch(t){case`Point`:return{type:t,coordinates:bu(n[0],n[1])};case`MultiPoint`:return{type:t,coordinates:yu(n)};case`LineString`:return{type:t,coordinates:yu(n.points)};case`MultiLineString`:case`Polygon`:return{type:t,coordinates:n.map((e=>yu(e.points)))};case`MultiPolygon`:return{type:t,coordinates:n.map((e=>e.map((e=>yu(e.points)))))}}}function yu(e){let t=[];for(let n=0;n<e.length;n+=3)t.push(bu(e[n],e[n+1]));return t}function bu(e,t){return[xu(e),Su(t)]}function xu(e){return 360*(e-.5)}function Su(e){let t=(180-360*e)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}var Cu;function wu(e,t,n,r,i,a,o,s){if(r/=t,a>=(n/=t)&&o<r)return e;if(o<n||a>=r)return null;let c=[];for(let t of e){let e=i===Cu.X?t.minX:t.minY,a=i===Cu.X?t.maxX:t.maxY;if(e>=n&&a<r)c.push(t);else if(!(a<n||e>=r))switch(t.type){case`Point`:case`MultiPoint`:Tu(t,c,n,r,i);continue;case`LineString`:Eu(t,c,n,r,i,s);continue;case`MultiLineString`:Du(t,c,n,r,i);continue;case`Polygon`:Ou(t,c,n,r,i);continue;case`MultiPolygon`:ku(t,c,n,r,i);continue}}return c.length?c:null}function Tu(e,t,n,r,i){let a=[];(function(e,t,n,r,i){for(let a=0;a<e.length;a+=3){let o=e[a+i];o>=n&&o<=r&&Nu(t,e[a],e[a+1],e[a+2])}})(e.geometry,a,n,r,i),a.length&&t.push(cu(e.id,a.length===3?`Point`:`MultiPoint`,a,e.tags))}function Eu(e,t,n,r,i,a){let o=[];if(Au(e.geometry,o,n,r,i,!1,a.lineMetrics),o.length)if(a.lineMetrics)for(let n of o)t.push(cu(e.id,`LineString`,n,e.tags));else t.push(o.length>1?cu(e.id,`MultiLineString`,o,e.tags):cu(e.id,`LineString`,o[0],e.tags))}function Du(e,t,n,r,i){let a=[];Mu(e.geometry,a,n,r,i,!1),a.length&&t.push(a.length===1?cu(e.id,`LineString`,a[0],e.tags):cu(e.id,`MultiLineString`,a,e.tags))}function Ou(e,t,n,r,i){let a=[];Mu(e.geometry,a,n,r,i,!0),a.length&&t.push(cu(e.id,`Polygon`,a,e.tags))}function ku(e,t,n,r,i){let a=[];for(let t of e.geometry){let e=[];Mu(t,e,n,r,i,!0),e.length&&a.push(e)}a.length&&t.push(cu(e.id,`MultiPolygon`,a,e.tags))}function Au(e,t,n,r,i,a,o){let s=ju(e),c=i===Cu.X?Pu:Fu,l,u,d=e.start;for(let f=0;f<e.points.length-3;f+=3){let p=e.points[f],m=e.points[f+1],h=e.points[f+2],g=e.points[f+3],_=e.points[f+4],v=i===Cu.X?p:m,y=i===Cu.X?g:_,b=!1;o&&(l=Math.sqrt((p-g)**2+(m-_)**2)),v<n?y>n&&(u=c(s,p,m,g,_,n),o&&(s.start=d+l*u)):v>r?y<r&&(u=c(s,p,m,g,_,r),o&&(s.start=d+l*u)):Nu(s.points,p,m,h),y<n&&v>=n&&(u=c(s,p,m,g,_,n),b=!0),y>r&&v<=r&&(u=c(s,p,m,g,_,r),b=!0),!a&&b&&(o&&(s.end=d+l*u),t.push(s),s=ju(e)),o&&(d+=l)}let f=e.points.length-3,p=e.points[f],m=e.points[f+1],h=i===Cu.X?p:m;h>=n&&h<=r&&Nu(s.points,p,m,e.points[f+2]),f=s.points.length-3,a&&f>=3&&(s.points[f]!==s.points[0]||s.points[f+1]!==s.points[1])&&Nu(s.points,s.points[0],s.points[1],s.points[2]),s.points.length&&(lu(s),t.push(s))}function ju(e){return{points:[],size:e.size,start:e.start,end:e.end}}function Mu(e,t,n,r,i,a){for(let o of e)Au(o,t,n,r,i,a,!1)}function Nu(e,t,n,r){e.push(t,n,r)}function Pu(e,t,n,r,i,a){let o=(a-t)/(r-t);return Nu(e.points,a,n+(i-n)*o,1),o}function Fu(e,t,n,r,i,a){let o=(a-n)/(i-n);return Nu(e.points,t+(r-t)*o,a,1),o}function Iu(e,t){let n=t.buffer/t.extent,r=e,i=wu(e,1,-1-n,n,Cu.X,-1,2,t),a=wu(e,1,1-n,2+n,Cu.X,-1,2,t);return i||a?(r=wu(e,1,-n,1+n,Cu.X,-1,2,t)||[],i&&(r=Lu(i,1).concat(r)),a&&(r=r.concat(Lu(a,-1))),r):r}function Lu(e,t){let n=[];for(let r of e)switch(r.type){case`Point`:case`MultiPoint`:{let e=Ru(r.geometry,t);n.push(cu(r.id,r.type,e,r.tags));continue}case`LineString`:{let e=zu(r.geometry,t);n.push(cu(r.id,r.type,e,r.tags));continue}case`MultiLineString`:case`Polygon`:{let e=[];for(let n of r.geometry)e.push(zu(n,t));n.push(cu(r.id,r.type,e,r.tags));continue}case`MultiPolygon`:{let e=[];for(let n of r.geometry){let r=[];for(let e of n)r.push(zu(e,t));e.push(r)}n.push(cu(r.id,r.type,e,r.tags));continue}}return n}function Ru(e,t){let n=[];for(let r=0;r<e.length;r+=3)n.push(e[r]+t,e[r+1],e[r+2]);return n}function zu(e,t){let n={points:[],size:e.size};e.start!==void 0&&(n.start=e.start,n.end=e.end);for(let r=0;r<e.points.length;r+=3)n.points.push(e.points[r]+t,e.points[r+1],e.points[r+2]);return lu(n),n}function Bu(e,t,n){let r=!!t.newGeometry,i=t.removeAllProperties||t.removeProperties?.length>0||t.addOrUpdateProperties?.length>0;if(r){let r=e[0],a=du({type:`FeatureCollection`,features:[{type:`Feature`,id:r.id,geometry:t.newGeometry,properties:i?Vu(r.tags,t):r.tags}]},n);return a=Iu(a,n),a}if(i){let n=[];for(let r of e){let e={...r};e.tags=Vu(e.tags,t),n.push(e)}return n}return e}function Vu(e,t){if(t.removeAllProperties)return{};let n={...e||{}};if(t.removeProperties)for(let e of t.removeProperties)delete n[e];if(t.addOrUpdateProperties)for(let{key:e,value:r}of t.addOrUpdateProperties)n[e]=r;return n}(function(e){e[e.X=0]=`X`,e[e.Y=1]=`Y`})(Cu||={});let Hu={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:e=>e};class Uu{constructor(e){this.options=Object.assign(Object.create(Hu),e),this.trees=Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[],this.points=[]}load(e){let t=[];for(let n of e){if(!n.geometry)continue;let[e,r]=n.geometry.coordinates,[i,a]=[hu(e),gu(r)];t.push({id:n.id,type:`Point`,geometry:[i,a],tags:n.properties})}this.createIndex(t)}initialize(e){let t=[];for(let n of e)n.type===`Point`&&t.push(n);this.createIndex(t)}updateIndex(e,t,n){this.options=Object.assign(Object.create(Hu),n.clusterOptions),this.initialize(e)}createIndex(e){let{log:t,minZoom:n,maxZoom:r}=this.options;t&&console.time(`total time`);let i=`prepare ${e.length} points`;t&&console.time(i),this.points=e;let a=[];for(let t=0;t<e.length;t++){let n=e[t];if(!n?.geometry)continue;let[r,i]=n.geometry;r=Math.fround(r),i=Math.fround(i),a.push(r,i,1/0,t,-1,1),this.options.reduce&&a.push(0)}let o=this.trees[r+1]=this.createTree(a);t&&console.timeEnd(i);for(let e=r;e>=n;e--){let n=Date.now();o=this.trees[e]=this.createTree(this.cluster(o,e)),t&&console.log(`z%d: %d clusters in %dms`,e,o.numItems,Date.now()-n)}t&&console.timeEnd(`total time`)}getClusters(e,t){return this.getClustersInternal(e,t).map((e=>_u(e)))}getClustersInternal(e,t){let n=((e[0]+180)%360+360)%360-180,r=Math.max(-90,Math.min(90,e[1])),i=e[2]===180?180:((e[2]+180)%360+360)%360-180,a=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)n=-180,i=180;else if(n>i){let e=this.getClustersInternal([n,r,180,a],t),o=this.getClustersInternal([-180,r,i,a],t);return e.concat(o)}let o=this.trees[this.limitZoom(t)],s=o.range(hu(n),gu(a),hu(i),gu(r)),c=o.flatData,l=[];for(let e of s){let t=this.stride*e;l.push(c[t+5]>1?Wu(c,t,this.clusterProps):this.points[c[t+3]])}return l}getChildren(e){let t=this.getOriginId(e),n=this.getOriginZoom(e),r=Error(`No cluster with the specified id: `+e),i=this.trees[n];if(!i)throw r;let a=i.flatData;if(t*this.stride>=a.length)throw r;let o=this.options.radius/(this.options.extent*2**(n-1)),s=i.within(a[t*this.stride],a[t*this.stride+1],o),c=[];for(let t of s){let n=t*this.stride;a[n+4]===e&&c.push(a[n+5]>1?Y(a,n,this.clusterProps):_u(this.points[a[n+3]]))}if(c.length===0)throw r;return c}getLeaves(e,t,n){let r=[];return this.appendLeaves(r,e,t||=10,n||=0,0),r}getTile(e,t,n){let r=this.trees[this.limitZoom(e)];if(!r)return null;let i=2**e,{extent:a,radius:o}=this.options,s=o/a,c=(n-s)/i,l=(n+1+s)/i,u={transformed:!0,features:[],source:null,x:t,y:n,z:e};return this.addTileFeatures(r.range((t-s)/i,c,(t+1+s)/i,l),r.flatData,t,n,i,u),t===0&&this.addTileFeatures(r.range(1-s/i,c,1,l),r.flatData,i,n,i,u),t===i-1&&this.addTileFeatures(r.range(0,c,s/i,l),r.flatData,-1,n,i,u),u}getClusterExpansionZoom(e){return this.getOriginZoom(e)}appendLeaves(e,t,n,r,i){let a=this.getChildren(t);for(let t of a){let a=t.properties;if(a?.cluster?i+a.point_count<=r?i+=a.point_count:i=this.appendLeaves(e,a.cluster_id,n,r,i):i<r?i++:e.push(t),e.length===n)break}return i}createTree(e){let t=new eu(e.length/this.stride|0,this.options.nodeSize,Float32Array);for(let n=0;n<e.length;n+=this.stride)t.add(e[n],e[n+1]);return t.finish(),t.flatData=e,t.data=null,t}addTileFeatures(e,t,n,r,i,a){for(let o of e){let e=o*this.stride,s=t[e+5]>1,c,l,u;if(s)c=Gu(t,e,this.clusterProps),l=t[e],u=t[e+1];else{let n=this.points[t[e+3]];c=n.tags,[l,u]=n.geometry}let d={type:1,geometry:[[Math.round(this.options.extent*(l*i-n)),Math.round(this.options.extent*(u*i-r))]],tags:c},f;f=s||this.options.generateId?t[e+3]:this.points[t[e+3]].id,f!==void 0&&(d.id=f),a.features.push(d)}}limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}cluster(e,t){let{radius:n,extent:r,reduce:i,minPoints:a}=this.options,o=n/(r*2**t),s=e.flatData,c=[],l=this.stride;for(let n=0;n<s.length;n+=l){if(s[n+2]<=t)continue;s[n+2]=t;let r=s[n],u=s[n+1],d=e.within(s[n],s[n+1],o),f=s[n+5],p=f;for(let e of d){let n=e*l;s[n+2]>t&&(p+=s[n+5])}if(p>f&&p>=a){let e,a=r*f,o=u*f,m=-1,h=(n/l<<5)+(t+1)+this.points.length;for(let r of d){let c=r*l;if(s[c+2]<=t)continue;s[c+2]=t;let u=s[c+5];a+=s[c]*u,o+=s[c+1]*u,s[c+4]=h,i&&(e||(e=this.map(s,n,!0),m=this.clusterProps.length,this.clusterProps.push(e)),i(e,this.map(s,c)))}s[n+4]=h,c.push(a/p,o/p,1/0,h,-1,p),i&&c.push(m)}else{for(let e=0;e<l;e++)c.push(s[n+e]);if(p>1)for(let e of d){let n=e*l;if(!(s[n+2]<=t)){s[n+2]=t;for(let e=0;e<l;e++)c.push(s[n+e])}}}}return c}getOriginId(e){return e-this.points.length>>5}getOriginZoom(e){return(e-this.points.length)%32}map(e,t,n){if(e[t+5]>1){let r=this.clusterProps[e[t+6]];return n?Object.assign({},r):r}let r=this.points[e[t+3]].tags,i=this.options.map(r);return n&&i===r?Object.assign({},i):i}}function Wu(e,t,n){return{id:e[t+3],type:`Point`,tags:Gu(e,t,n),geometry:[e[t],e[t+1]]}}function Y(e,t,n){return{type:`Feature`,id:e[t+3],properties:Gu(e,t,n),geometry:{type:`Point`,coordinates:[xu(e[t]),Su(e[t+1])]}}}function Gu(e,t,n){let r=e[t+5],i=r>=1e4?`${Math.round(r/1e3)}k`:r>=1e3?Math.round(r/100)/10+`k`:r,a=e[t+6],o=a===-1?{}:Object.assign({},n[a]);return Object.assign(o,{cluster:!0,cluster_id:e[t+3],point_count:r,point_count_abbreviated:i})}let Ku=`geojsonvt_clip_start`,qu=`geojsonvt_clip_end`;function Ju(e,t,n,r,i){let a=t===i.maxZoom?0:i.tolerance/((1<<t)*i.extent),o={transformed:!1,features:[],source:null,x:n,y:r,z:t,minX:2,minY:1,maxX:-1,maxY:0,numPoints:0,numSimplified:0,numFeatures:e.length};for(let t of e)Yu(o,t,a,i);return o}function Yu(e,t,n,r){switch(e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),t.type){case`Point`:case`MultiPoint`:(function(e,t){let n=[];for(let r=0;r<t.geometry.length;r+=3)n.push(t.geometry[r],t.geometry[r+1]),e.numPoints++,e.numSimplified++;if(!n.length)return;let r={type:1,tags:t.tags||null,geometry:n};t.id!==null&&(r.id=t.id),e.features.push(r)})(e,t);return;case`LineString`:(function(e,t,n,r){let i=[];if(Xu(i,t.geometry,e,n,!1,!1),!i.length)return;let a=t.tags||null;if(r.lineMetrics){a={};for(let e in t.tags)a[e]=t.tags[e];a[Ku]=t.geometry.start/t.geometry.size,a[qu]=t.geometry.end/t.geometry.size}let o={type:2,tags:a,geometry:i};t.id!==null&&(o.id=t.id),e.features.push(o)})(e,t,n,r);return;case`MultiLineString`:case`Polygon`:(function(e,t,n){let r=[];for(let i=0;i<t.geometry.length;i++)Xu(r,t.geometry[i],e,n,t.type===`Polygon`,i===0);if(!r.length)return;let i={type:t.type===`Polygon`?3:2,tags:t.tags||null,geometry:r};t.id!==null&&(i.id=t.id),e.features.push(i)})(e,t,n);return;case`MultiPolygon`:(function(e,t,n){let r=[];for(let i=0;i<t.geometry.length;i++){let a=t.geometry[i];for(let t=0;t<a.length;t++)Xu(r,a[t],e,n,!0,t===0)}if(!r.length)return;let i={type:3,tags:t.tags||null,geometry:r};t.id!==null&&(i.id=t.id),e.features.push(i)})(e,t,n);return}}function Xu(e,t,n,r,i,a){let o=r*r;if(r>0&&t.size<(i?o:r))return void(n.numPoints+=t.points.length/3);let s=[];for(let e=0;e<t.points.length;e+=3)(r===0||t.points[e+2]>o)&&(n.numSimplified++,s.push(t.points[e],t.points[e+1])),n.numPoints++;i&&function(e,t){let n=0;for(let t=0,r=e.length,i=r-2;t<r;i=t,t+=2)n+=(e[t]-e[i])*(e[t+1]+e[i+1]);if(n>0===t)for(let t=0,n=e.length;t<n/2;t+=2){let r=e[t],i=e[t+1];e[t]=e[n-2-t],e[t+1]=e[n-1-t],e[n-2-t]=r,e[n-1-t]=i}}(s,a),e.push(s)}function Zu(e,t){if(e.transformed)return e;let n=1<<e.z,r=e.x,i=e.y;for(let a of e.features)a.type===1?Qu(a,t,n,r,i):$u(a,t,n,r,i);return e.transformed=!0,e}function Qu(e,t,n,r,i){let a=e,o=e.geometry,s=[];for(let e=0;e<o.length;e+=2)s.push(ed(o[e],o[e+1],t,n,r,i));return a.geometry=s,a}function $u(e,t,n,r,i){let a=e,o=e.geometry,s=[];for(let e of o){let a=[];for(let o=0;o<e.length;o+=2)a.push(ed(e[o],e[o+1],t,n,r,i));s.push(a)}return a.geometry=s,a}function ed(e,t,n,r,i,a){return[Math.round(n*(e*r-i)),Math.round(n*(t*r-a))]}class td{constructor(e){this.options=e,this.total=0,this.stats={},this.tiles={},this.tileCoords=[],this.stats={},this.total=0}initialize(e){this.splitTile(e,0,0,0),this.options.debug&&(e.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)))}updateIndex(e,t,n){n.debug>1&&(console.log(`invalidating tiles`),console.time(`invalidating`)),this.invalidateTiles(t),n.debug>1&&console.timeEnd(`invalidating`);let[r,i,a]=[0,0,0],o=Ju(e,r,i,a,n);o.source=e;let s=nd(r,i,a);if(this.tiles[s]=o,this.tileCoords.push({z:r,x:i,y:a,id:s}),n.debug){let e=`z${r}`;this.stats[e]=(this.stats[e]||0)+1,this.total++}}getClusterExpansionZoom(e){return null}getChildren(e){return null}getLeaves(e,t,n){return null}getTile(e,t,n){let{extent:r,debug:i}=this.options,a=1<<e,o=nd(e,t=t+a&a-1,n);if(this.tiles[o])return Zu(this.tiles[o],r);i>1&&console.log(`drilling down to z%d-%d-%d`,e,t,n);let s,c=e,l=t,u=n;for(;!s&&c>0;)c--,l>>=1,u>>=1,s=this.tiles[nd(c,l,u)];return s?.source?(i>1&&(console.log(`found parent tile z%d-%d-%d`,c,l,u),console.time(`drilling down`)),this.splitTile(s.source,c,l,u,e,t,n),i>1&&console.timeEnd(`drilling down`),this.tiles[o]?Zu(this.tiles[o],r):null):null}splitTile(e,t,n,r,i,a,o){let s=[e,t,n,r],c=this.options,l=c.debug;for(;s.length;){r=s.pop(),n=s.pop(),t=s.pop(),e=s.pop();let u=1<<t,d=nd(t,n,r),f=this.tiles[d];if(!f&&(l>1&&console.time(`creation`),f=this.tiles[d]=Ju(e,t,n,r,c),this.tileCoords.push({z:t,x:n,y:r,id:d}),l)){l>1&&(console.log(`tile z%d-%d-%d (features: %d, points: %d, simplified: %d)`,t,n,r,f.numFeatures,f.numPoints,f.numSimplified),console.timeEnd(`creation`));let e=`z${t}`;this.stats[e]=(this.stats[e]||0)+1,this.total++}if(f.source=e,i==null){if(t===c.indexMaxZoom||f.numPoints<=c.indexMaxPoints)continue}else{if(t===c.maxZoom||t===i)continue;if(i!=null){let e=i-t;if(n!==a>>e||r!==o>>e)continue}}if(f.source=null,!e.length)continue;l>1&&console.time(`clipping`);let p=.5*c.buffer/c.extent,m=.5-p,h=.5+p,g=1+p,_=null,v=null,y=null,b=null,x=wu(e,u,n-p,n+h,Cu.X,f.minX,f.maxX,c),S=wu(e,u,n+m,n+g,Cu.X,f.minX,f.maxX,c);x&&(_=wu(x,u,r-p,r+h,Cu.Y,f.minY,f.maxY,c),v=wu(x,u,r+m,r+g,Cu.Y,f.minY,f.maxY,c)),S&&(y=wu(S,u,r-p,r+h,Cu.Y,f.minY,f.maxY,c),b=wu(S,u,r+m,r+g,Cu.Y,f.minY,f.maxY,c)),l>1&&console.timeEnd(`clipping`),s.push(_||[],t+1,2*n,2*r),s.push(v||[],t+1,2*n,2*r+1),s.push(y||[],t+1,2*n+1,2*r),s.push(b||[],t+1,2*n+1,2*r+1)}}invalidateTiles(e){if(!e.length)return;let t=this.options,{debug:n}=t,r=1/0,i=-1/0,a=1/0,o=-1/0;for(let t of e)r=Math.min(r,t.minX),i=Math.max(i,t.maxX),a=Math.min(a,t.minY),o=Math.max(o,t.maxY);let s=t.buffer/t.extent,c=new Set;for(let t in this.tiles){let l=this.tiles[t],u=1<<l.z,d=(l.x-s)/u,f=(l.x+1+s)/u,p=(l.y-s)/u,m=(l.y+1+s)/u;if(i<d||r>=f||o<p||a>=m)continue;let h=!1;for(let t of e)if(t.maxX>=d&&t.minX<f&&t.maxY>=p&&t.minY<m){h=!0;break}if(h){if(n){n>1&&console.log(`invalidate tile z%d-%d-%d (features: %d, points: %d, simplified: %d)`,l.z,l.x,l.y,l.numFeatures,l.numPoints,l.numSimplified);let e=`z${l.z}`;this.stats[e]=(this.stats[e]||0)-1,this.total--}delete this.tiles[t],c.add(t)}}c.size&&(this.tileCoords=this.tileCoords.filter((e=>!c.has(e.id))))}}function nd(e,t,n){return 32*((1<<e)*n+t)+e}let rd={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,updateable:!1,cluster:!1,clusterOptions:Hu,debug:0},{members:X}=lo([{name:`a_pos_normal`,components:2,type:`Int16`},{name:`a_data`,components:4,type:`Uint8`}],4),{members:id}=lo([{name:`a_uv_x`,components:1,type:`Float32`},{name:`a_split_index`,components:1,type:`Float32`}]),ad=Math.cos(Math.PI/180*37.5),od=2**14/.5;class sd{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.hasDependencies=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={};for(let e of this.layers)this.gradients[e.id]={};this.layoutVertexArray=new Qo,this.layoutVertexArray2=new $o,this.indexArray=new ss,this.programConfigurations=new zs(e.layers,e.zoom),this.segments=new us,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,t,n){this.hasDependencies=Uc(`line`,this.layers,t)||this.hasLineDasharray(this.layers);let r=this.layers[0].layout.get(`line-sort-key`),i=!r.isConstant(),a=[];for(let{feature:t,id:o,index:s,sourceLayerIndex:c}of e){let e=this.layers[0]._featureFilter.needGeometry,l=Gs(t,e);if(!this.layers[0]._featureFilter.filter(new za(this.zoom),l,n))continue;let u=i?r.evaluate(l,{},n):void 0,d={id:o,properties:t.properties,type:t.type,sourceLayerIndex:c,index:s,geometry:e?l.geometry:Ws(t),patterns:{},dashes:{},sortKey:u};a.push(d)}i&&a.sort(((e,t)=>e.sortKey-t.sortKey));for(let r of a){let{geometry:i,index:a,sourceLayerIndex:o}=r;this.hasDependencies?(Uc(`line`,this.layers,t)?Wc(`line`,this.layers,r,{zoom:this.zoom},t):this.hasLineDasharray(this.layers)&&this.addLineDashDependencies(this.layers,r,this.zoom,t),this.patternFeatures.push(r)):this.addFeature(r,i,a,n,{},{},t.subdivisionGranularity),t.featureIndex.insert(e[a].feature,i,a,o,this.index)}}update(e,t,n,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions:n,dashPositions:r})}addFeatures(e,t,n,r){for(let i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,t,n,r,e.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,id)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,X),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.hasOwn(e.properties,Ku)&&Object.hasOwn(e.properties,qu))return{start:+e.properties[Ku],end:+e.properties[qu]}}addFeature(e,t,n,r,i,a,o){let s=this.layers[0].layout,c=s.get(`line-join`).evaluate(e,{}),l=s.get(`line-cap`).evaluate(e,{}),u=s.get(`line-miter-limit`).evaluate(e,{}),d=s.get(`line-round-limit`).evaluate(e,{});this.lineClips=this.lineFeatureClips(e);for(let n of t)this.addLine(n,e,c,l,u,d,r,o);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,{imagePositions:i,dashPositions:a,canonical:r})}addLine(e,t,n,r,i,a,o,s){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,e=Sl(e,o?s.line.getGranularityForZoomLevel(o.z):1),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let t=0;t<e.length-1;t++)this.totalDistance+=e[t].dist(e[t+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let c=Pl.types[t.type]===`Polygon`,l=e.length;for(;l>=2&&e[l-1].equals(e[l-2]);)l--;let u=0;for(;u<l-1&&e[u].equals(e[u+1]);)u++;if(l<(c?3:2))return;n===`bevel`&&(i=1.05);let d=this.overscaling<=16?122880/(512*this.overscaling):0,f=this.segments.prepareSegment(10*l,this.layoutVertexArray,this.indexArray),p,m,h,g,_;this.e1=this.e2=-1,c&&(p=e[l-2],_=e[u].sub(p)._unit()._perp());for(let t=u;t<l;t++){if(h=t===l-1?c?e[u+1]:void 0:e[t+1],h&&e[t].equals(h))continue;_&&(g=_),p&&(m=p),p=e[t],_=h?h.sub(p)._unit()._perp():g,g||=_;let o=g.add(_);o.x===0&&o.y===0||o._unit();let s=g.x*_.x+g.y*_.y,v=o.x*_.x+o.y*_.y,y=v===0?1/0:1/v,b=2*Math.sqrt(2-2*v),x=v<ad&&m&&h,S=g.x*_.y-g.y*_.x>0;if(x&&t>u){let e=p.dist(m);if(e>2*d){let t=p.sub(p.sub(m)._mult(d/e)._round());this.updateDistance(m,t),this.addCurrentVertex(t,g,0,0,f),m=t}}let C=m&&h,w=C?n:c?`butt`:r;if(C&&w===`round`&&(y<a?w=`miter`:y<=2&&(w=`fakeround`)),w===`miter`&&y>i&&(w=`bevel`),w===`bevel`&&(y>2&&(w=`flipbevel`),y<i&&(w=`miter`)),m&&this.updateDistance(m,p),w===`miter`)o._mult(y),this.addCurrentVertex(p,o,0,0,f);else if(w===`flipbevel`){if(y>100)o=_.mult(-1);else{let e=y*g.add(_).mag()/g.sub(_).mag();o._perp()._mult(e*(S?-1:1))}this.addCurrentVertex(p,o,0,0,f),this.addCurrentVertex(p,o.mult(-1),0,0,f)}else if(w===`bevel`||w===`fakeround`){let e=-Math.sqrt(y*y-1),t=S?e:0,n=S?0:e;if(m&&this.addCurrentVertex(p,g,t,n,f),w===`fakeround`){let e=Math.round(180*b/Math.PI/20);for(let t=1;t<e;t++){let n=t/e;if(n!==.5){let e=n-.5;n+=n*e*(n-1)*((1.0904+s*(s*(3.55645-1.43519*s)-3.2452))*e*e+(.848013+s*(.215638*s-1.06021)))}let r=_.sub(g)._mult(n)._add(g)._unit()._mult(S?-1:1);this.addHalfVertex(p,r.x,r.y,!1,S,0,f)}}h&&this.addCurrentVertex(p,_,-t,-n,f)}else if(w===`butt`)this.addCurrentVertex(p,o,0,0,f);else if(w===`square`){let e=m?1:-1;this.addCurrentVertex(p,o,e,e,f)}else w===`round`&&(m&&(this.addCurrentVertex(p,g,0,0,f),this.addCurrentVertex(p,g,1,1,f,!0)),h&&(this.addCurrentVertex(p,_,-1,-1,f,!0),this.addCurrentVertex(p,_,0,0,f)));if(x&&t<l-1){let e=p.dist(h);if(e>2*d){let t=p.add(h.sub(p)._mult(d/e)._round());this.updateDistance(p,t),this.addCurrentVertex(t,_,0,0,f),p=t}}}}addCurrentVertex(e,t,n,r,i,a=!1){let o=t.y*r-t.x,s=-t.y-t.x*r;this.addHalfVertex(e,t.x+t.y*n,t.y-t.x*n,a,!1,n,i),this.addHalfVertex(e,o,s,a,!0,-r,i),this.distance>od/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,t,n,r,i,a))}addHalfVertex({x:e,y:t},n,r,i,a,o,s){let c=.5*(this.lineClips?this.scaledDistance*(od-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+ +!!i,(t<<1)+ +!!a,Math.round(63*n)+128,Math.round(63*r)+128,1+(o===0?0:o<0?-1:1)|(63&c)<<2,c>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);let l=s.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,l,this.e2),s.primitiveLength++),a?this.e2=l:this.e1=l}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,t){this.distance+=e.dist(t),this.updateScaledDistance()}hasLineDasharray(e){for(let t of e){let e=t.paint.get(`line-dasharray`);if(e&&!e.isConstant())return!0}return!1}addLineDashDependencies(e,t,n,r){for(let i of e){let e=i.paint.get(`line-dasharray`);if(!e||e.value.kind===`constant`)continue;let a=i.layout.get(`line-cap`).evaluate(t,{})===`round`,o={dasharray:e.value.evaluate({zoom:n-1},t,{}),round:a},s={dasharray:e.value.evaluate({zoom:n},t,{}),round:a},c={dasharray:e.value.evaluate({zoom:n+1},t,{}),round:a},l=`${o.dasharray.join(`,`)},${o.round}`,u=`${s.dasharray.join(`,`)},${s.round}`,d=`${c.dasharray.join(`,`)},${c.round}`;r.dashDependencies[l]=o,r.dashDependencies[u]=s,r.dashDependencies[d]=c,t.dashes[i.id]={min:l,mid:u,max:d}}}}let cd,ld;K(`LineBucket`,sd,{omit:[`layers`,`patternFeatures`]});var ud={get paint(){return ld||=new $a({"line-opacity":new J(N.paint_line[`line-opacity`]),"line-color":new J(N.paint_line[`line-color`]),"line-translate":new q(N.paint_line[`line-translate`]),"line-translate-anchor":new q(N.paint_line[`line-translate-anchor`]),"line-width":new J(N.paint_line[`line-width`]),"line-gap-width":new J(N.paint_line[`line-gap-width`]),"line-offset":new J(N.paint_line[`line-offset`]),"line-blur":new J(N.paint_line[`line-blur`]),"line-dasharray":new Xa(N.paint_line[`line-dasharray`]),"line-pattern":new Xa(N.paint_line[`line-pattern`]),"line-gradient":new Qa(N.paint_line[`line-gradient`])})},get layout(){return cd||=new $a({"line-cap":new J(N.layout_line[`line-cap`]),"line-join":new J(N.layout_line[`line-join`]),"line-miter-limit":new J(N.layout_line[`line-miter-limit`]),"line-round-limit":new J(N.layout_line[`line-round-limit`]),"line-sort-key":new J(N.layout_line[`line-sort-key`])})}};class dd extends J{possiblyEvaluate(e,t){return t=new za(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,zoomHistory:t.zoomHistory,transition:t.transition}),super.possiblyEvaluate(e,t)}evaluate(e,t,n,r){return t=ae({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(e,t,n,r)}}let fd;class pd extends no{constructor(e,t){super(e,ud,t),this.gradientVersion=0,fd||(fd=new dd(ud.paint.properties[`line-width`].specification),fd.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e===`line-gradient`){let e=this.gradientExpression();this.stepInterpolant=!!function(e){return e._styleExpression!==void 0}(e)&&e._styleExpression.expression instanceof En,this.gradientVersion=(this.gradientVersion+1)%(2**53-1)}}gradientExpression(){return this._transitionablePaint._values[`line-gradient`].value.expression}recalculate(e,t){super.recalculate(e,t),this.paint._values[`line-floorwidth`]=fd.possiblyEvaluate(this._transitioningPaint._values[`line-width`].value,e)}createBucket(e){return new sd(e)}queryRadius(e){let t=e,n=md(oc(`line-width`,this,t),oc(`line-gap-width`,this,t)),r=oc(`line-offset`,this,t);return n/2+Math.abs(r)+sc(this.paint.get(`line-translate`))}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:r,geometry:i,transform:a,pixelsToTileUnits:o}){let s=cc(e,this.paint.get(`line-translate`),this.paint.get(`line-translate-anchor`),-a.bearingInRadians,o),c=o/2*md(this.paint.get(`line-width`).evaluate(t,r),this.paint.get(`line-gap-width`).evaluate(t,r)),l=this.paint.get(`line-offset`).evaluate(t,r);return l&&(i=function(e,t){let r=[];for(let i of e){let e=lc(i),a=[];for(let r=0;r<e.length;r++){let i=e[r],o=e[r-1],s=e[r+1],c=r===0?new n(0,0):i.sub(o)._unit()._perp(),l=r===e.length-1?new n(0,0):s.sub(i)._unit()._perp(),u=c._add(l)._unit(),d=u.x*l.x+u.y*l.y;d!==0&&u._mult(1/d),a.push(u._mult(t)._add(i))}r.push(a)}return r}(i,l*o)),function(e,t,n){for(let r of t){if(e.length>=3){for(let t of r)if(ic(e,t))return!0}if(Qs(e,r,n))return!0}return!1}(s,i,c)}isTileClipped(){return!0}}function md(e,t){return t>0?t+2*e:e}let hd=lo([{name:`a_pos_offset`,components:4,type:`Int16`},{name:`a_data`,components:4,type:`Uint16`},{name:`a_pixeloffset`,components:4,type:`Int16`}],4),gd=lo([{name:`a_projected_pos`,components:3,type:`Float32`}],4);lo([{name:`a_fade_opacity`,components:1,type:`Uint32`}],4);let _d=lo([{name:`a_placed`,components:2,type:`Uint8`},{name:`a_shift`,components:2,type:`Float32`},{name:`a_box_real`,components:2,type:`Int16`}]);lo([{type:`Int16`,name:`anchorPointX`},{type:`Int16`,name:`anchorPointY`},{type:`Int16`,name:`x1`},{type:`Int16`,name:`y1`},{type:`Int16`,name:`x2`},{type:`Int16`,name:`y2`},{type:`Uint32`,name:`featureIndex`},{type:`Uint16`,name:`sourceLayerIndex`},{type:`Uint16`,name:`bucketIndex`}]);let vd=lo([{name:`a_pos`,components:2,type:`Int16`},{name:`a_anchor_pos`,components:2,type:`Int16`},{name:`a_extrude`,components:2,type:`Int16`}],4),yd=lo([{name:`a_pos`,components:2,type:`Float32`},{name:`a_radius`,components:1,type:`Float32`},{name:`a_flags`,components:2,type:`Int16`}],4);function bd(e,t,n){let r=t.layout.get(`text-transform`).evaluate(n,{});return r===`uppercase`?e=e.toLocaleUpperCase():r===`lowercase`&&(e=e.toLocaleLowerCase()),Ra.applyArabicShaping&&(e=Ra.applyArabicShaping(e)),e}function xd(e,t,n){for(let r of e.sections)r.text=bd(r.text,t,n);return e}lo([{name:`triangle`,components:3,type:`Uint16`}]),lo([{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`}]),lo([{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`}]),lo([{type:`Float32`,name:`offsetX`}]),lo([{type:`Int16`,name:`x`},{type:`Int16`,name:`y`},{type:`Int16`,name:`tileUnitDistanceFromAnchor`}]),lo([{type:`Uint16`,name:`textAnchor`},{type:`Float32`,components:2,name:`textOffset`}]);var Sd=24;let Cd={"!":`︕`,"#":`#`,$:`$`,"%":`%`,"&":`&`,"(":`︵`,")":`︶`,"*":`*`,"+":`+`,",":`︐`,"-":`︲`,".":`・`,"/":`/`,":":`︓`,";":`︔`,"<":`︿`,"=":`=`,">":`﹀`,"?":`︖`,"@":`@`,"[":`﹇`,"\\":`\`,"]":`﹈`,"^":`^`,_:`︳`,"`":```,"{":`︷`,"|":`―`,"}":`︸`,"~":`~`,"¢":`¢`,"£":`£`,"¥":`¥`,"¦":`¦`,"¬":`¬`,"¯":` ̄`,"–":`︲`,"—":`︱`,"‘":`﹃`,"’":`﹄`,"“":`﹁`,"”":`﹂`,"…":`︙`,"⋯":`︙`,"‧":`・`,"₩":`₩`,"、":`︑`,"。":`︒`,"〈":`︿`,"〉":`﹀`,"《":`︽`,"》":`︾`,"「":`﹁`,"」":`﹂`,"『":`﹃`,"』":`﹄`,"【":`︻`,"】":`︼`,"〔":`︹`,"〕":`︺`,"〖":`︗`,"〗":`︘`,"!":`︕`,"(":`︵`,")":`︶`,",":`︐`,"-":`︲`,".":`・`,":":`︓`,";":`︔`,"<":`︿`,">":`﹀`,"?":`︖`,"[":`﹇`,"]":`﹈`,"_":`︳`,"{":`︷`,"|":`―`,"}":`︸`,"⦅":`︵`,"⦆":`︶`,"。":`︒`,"「":`﹁`,"」":`﹂`},wd={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},Td={40:!0};function Ed(e,t,n,r,i,a){if(`fontStack`in t){let r=n[t.fontStack]?.[e];return r?r.metrics.advance*t.scale+i:0}{let e=r[t.imageName];return e?e.displaySize[0]*t.scale*Sd/a+i:0}}function Dd(e,t,n,r){let i=(e-t)**2;return r?e<t?i/2:2*i:i+Math.abs(n)*n}function Od(e,t,n){let r=0;return e===10&&(r-=1e4),n&&(r+=150),e!==40&&e!==65288||(r+=50),t!==41&&t!==65289||(r+=50),r}function kd(e,t,n,r,i,a){let o=null,s=Dd(t,n,i,a);for(let e of r){let r=Dd(t-e.x,n,i,a)+e.badness;r<=s&&(o=e,s=r)}return{index:e,x:t,priorBreak:o,badness:s}}function Ad(e){return e?Ad(e.priorBreak).concat(e.index):[]}class jd{constructor(e=``,t=[],n=[]){this.text=e,this.sections=t,this.sectionIndex=n,this.imageSectionID=null}static fromFeature(e,t){let n=new jd;for(let r of e.sections)r.image?n.addImageSection(r):n.addTextSection(r,t);return n}length(){return[...this.text].length}getSection(e){return this.sections[this.sectionIndex[e]]}getSectionIndex(e){return this.sectionIndex[e]}verticalizePunctuation(){this.text=function(e){let t=``,n={premature:!0,value:void 0},r=e[Symbol.iterator](),i=r.next(),a=e[Symbol.iterator]();a.next();let o=a.next();for(;!i.done;)t+=!o.done&&Na(o.value.codePointAt(0))&&!Cd[o.value]||!n.premature&&Na(n.value.codePointAt(0))&&!Cd[n.value]||!Cd[i.value]?i.value:Cd[i.value],n={value:i.value,premature:!1},i=r.next(),o=a.next();return t}(this.text)}hasZeroWidthSpaces(){return this.text.includes(`​`)}trim(){let e=this.text.match(/^\s*/),t=e?e[0].length:0,n=this.text.match(/\S\s*$/),r=n?n[0].length-1:0;this.text=this.text.substring(t,this.text.length-r),this.sectionIndex=this.sectionIndex.slice(t,this.sectionIndex.length-r)}substring(e,t){let n=[...this.text].slice(e,t).join(``),r=this.sectionIndex.slice(e,t);return new jd(n,this.sections,r)}toCodeUnitIndex(e){return[...this.text].slice(0,e).join(``).length}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((e,t)=>Math.max(e,this.sections[t].scale)),0)}getMaxImageSize(e){let t=0,n=0;for(let r=0;r<this.length();r++){let i=this.getSection(r);if(`imageName`in i){let r=e[i.imageName];if(!r)continue;let a=r.displaySize;t=Math.max(t,a[0]),n=Math.max(n,a[1])}}return{maxImageWidth:t,maxImageHeight:n}}addTextSection(e,t){this.text+=e.text,this.sections.push({scale:e.scale||1,verticalAlign:e.verticalAlign||`bottom`,fontStack:e.fontStack||t});let n=this.sections.length-1;this.sectionIndex.push(...[...e.text].map((()=>n)))}addImageSection(e){let t=e.image?e.image.name:``;if(t.length===0)return void de(`Can't add FormattedSection with an empty image.`);let n=this.getNextImageSectionCharCode();n?(this.text+=String.fromCharCode(n),this.sections.push({scale:1,verticalAlign:e.verticalAlign||`bottom`,imageName:t}),this.sectionIndex.push(this.sections.length-1)):de(`Reached maximum number of images 6401`)}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}determineLineBreaks(e,t,n,r,i){let a=[],o=this.determineAverageLineWidth(e,t,n,r,i),s=this.hasZeroWidthSpaces(),c=0,l=0,u=this.text[Symbol.iterator](),d=u.next(),f=this.text[Symbol.iterator]();f.next();let p=f.next(),m=this.text[Symbol.iterator]();m.next(),m.next();let h=m.next();for(;!d.done;){let t=this.getSection(l),g=d.value.codePointAt(0);if(Da(g)||(c+=Ed(g,t,n,r,e,i)),!p.done){let e=Ta(g),n=p.value.codePointAt(0);(wd[g]||e||`imageName`in t||!h.done&&Td[n])&&a.push(kd(l+1,c,o,a,Od(g,n,e&&s),!1))}l++,d=u.next(),p=f.next(),h=m.next()}return Ad(kd(this.length(),c,o,a,0,!0))}determineAverageLineWidth(e,t,n,r,i){let a=0,o=0;for(let t of this.text){let s=this.getSection(o);a+=Ed(t.codePointAt(0),s,n,r,e,i),o++}return a/Math.max(1,Math.ceil(a/t))}}let Md=4294967296,Nd=1/Md,Z=typeof TextDecoder>`u`?null:new TextDecoder(`utf-8`);class Pd{constructor(e=new Uint8Array(16)){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(e,t,n=this.length){for(;this.pos<n;){let n=this.readVarint(),r=n>>3,i=this.pos;this.type=7&n,e(r,t,this),this.pos===i&&this.skip(n)}return t}readMessage(e,t){return this.readFields(e,t,this.readVarint()+this.pos)}readFixed32(){let e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){let e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){let e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*Md;return this.pos+=8,e}readSFixed64(){let e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*Md;return this.pos+=8,e}readFloat(){let e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){let e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){let t=this.buf,n,r;return r=t[this.pos++],n=127&r,r<128?n:(r=t[this.pos++],n|=(127&r)<<7,r<128?n:(r=t[this.pos++],n|=(127&r)<<14,r<128?n:(r=t[this.pos++],n|=(127&r)<<21,r<128?n:(r=t[this.pos],n|=(15&r)<<28,function(e,t,n){let r=n.buf,i,a;if(a=r[n.pos++],i=(112&a)>>4,a<128||(a=r[n.pos++],i|=(127&a)<<3,a<128)||(a=r[n.pos++],i|=(127&a)<<10,a<128)||(a=r[n.pos++],i|=(127&a)<<17,a<128)||(a=r[n.pos++],i|=(127&a)<<24,a<128)||(a=r[n.pos++],i|=(1&a)<<31,a<128))return Fd(e,i,t);throw Error(`Expected varint not more than 10 bytes`)}(n,e,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){let e=this.readVarint();return e%2==1?(e+1)/-2:e/2}readBoolean(){return!!this.readVarint()}readString(){let e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=12&&Z?Z.decode(this.buf.subarray(t,e)):function(e,t,n){let r=``,i=t;for(;i<n;){let t=e[i],a,o,s,c=null,l=t>239?4:t>223?3:t>191?2:1;if(i+l>n)break;l===1?t<128&&(c=t):l===2?(a=e[i+1],(192&a)==128&&(c=(31&t)<<6|63&a,c<=127&&(c=null))):l===3?(a=e[i+1],o=e[i+2],(192&a)==128&&(192&o)==128&&(c=(15&t)<<12|(63&a)<<6|63&o,(c<=2047||c>=55296&&c<=57343)&&(c=null))):l===4&&(a=e[i+1],o=e[i+2],s=e[i+3],(192&a)==128&&(192&o)==128&&(192&s)==128&&(c=(15&t)<<18|(63&a)<<12|(63&o)<<6|63&s,(c<=65535||c>=1114112)&&(c=null))),c===null?(c=65533,l=1):c>65535&&(c-=65536,r+=String.fromCharCode(c>>>10&1023|55296),c=56320|1023&c),r+=String.fromCharCode(c),i+=l}return r}(this.buf,t,e)}readBytes(){let e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t}readPackedVarint(e=[],t){let n=this.readPackedEnd();for(;this.pos<n;)e.push(this.readVarint(t));return e}readPackedSVarint(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFloat());return e}readPackedDouble(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed64());return e}readPackedEnd(){return this.type===2?this.readVarint()+this.pos:this.pos+1}skip(e){let t=7&e;if(t===0)for(;this.buf[this.pos++]>127;);else if(t===2)this.pos=this.readVarint()+this.pos;else if(t===5)this.pos+=4;else{if(t!==1)throw Error(`Unimplemented type: ${t}`);this.pos+=8}}writeTag(e,t){this.writeVarint(e<<3|t)}realloc(e){let t=this.length||16;for(;t<this.pos+e;)t*=2;if(t!==this.length){let e=new Uint8Array(t);e.set(this.buf),this.buf=e,this.dataView=new DataView(e.buffer),this.length=t}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeSFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,-1&e,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*Nd),!0),this.pos+=8}writeSFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,-1&e,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*Nd),!0),this.pos+=8}writeVarint(e){(e=+e||0)>268435455||e<0?function(e,t){let n,r;if(e>=0?(n=e%4294967296|0,r=e/4294967296|0):(n=~(-e%4294967296),r=~(-e/4294967296),4294967295^n?n=n+1|0:(n=0,r=r+1|0)),e>=0x10000000000000000||e<-0x10000000000000000)throw Error(`Given varint doesn't fit into 10 bytes`);t.realloc(10),function(e,t,n){n.buf[n.pos++]=127&e|128,e>>>=7,n.buf[n.pos++]=127&e|128,e>>>=7,n.buf[n.pos++]=127&e|128,e>>>=7,n.buf[n.pos++]=127&e|128,n.buf[n.pos]=127&(e>>>=7)}(n,0,t),function(e,t){let n=(7&e)<<4;t.buf[t.pos++]|=n|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e)))))}(r,t)}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))}writeSVarint(e){this.writeVarint(e<0?2*-e-1:2*e)}writeBoolean(e){this.writeVarint(+e)}writeString(e){e=String(e),this.realloc(4*e.length),this.pos++;let t=this.pos;this.pos=function(e,t,n){for(let r,i,a=0;a<t.length;a++){if(r=t.charCodeAt(a),r>55295&&r<57344){if(!i){r>56319||a+1===t.length?(e[n++]=239,e[n++]=191,e[n++]=189):i=r;continue}if(r<56320){e[n++]=239,e[n++]=191,e[n++]=189,i=r;continue}r=i-55296<<10|r-56320|65536,i=null}else i&&=(e[n++]=239,e[n++]=191,e[n++]=189,null);r<128?e[n++]=r:(r<2048?e[n++]=r>>6|192:(r<65536?e[n++]=r>>12|224:(e[n++]=r>>18|240,e[n++]=r>>12&63|128),e[n++]=r>>6&63|128),e[n++]=63&r|128)}return n}(this.buf,e,this.pos);let n=this.pos-t;n>=128&&Q(t,n,this),this.pos=t-1,this.writeVarint(n),this.pos+=n}writeFloat(e){this.realloc(4),this.dataView.setFloat32(this.pos,e,!0),this.pos+=4}writeDouble(e){this.realloc(8),this.dataView.setFloat64(this.pos,e,!0),this.pos+=8}writeBytes(e){let t=e.length;this.writeVarint(t),this.realloc(t);for(let n=0;n<t;n++)this.buf[this.pos++]=e[n]}writeRawMessage(e,t){this.pos++;let n=this.pos;e(t,this);let r=this.pos-n;r>=128&&Q(n,r,this),this.pos=n-1,this.writeVarint(r),this.pos+=r}writeMessage(e,t,n){this.writeTag(e,2),this.writeRawMessage(t,n)}writePackedVarint(e,t){t.length&&this.writeMessage(e,Id,t)}writePackedSVarint(e,t){t.length&&this.writeMessage(e,Ld,t)}writePackedBoolean(e,t){t.length&&this.writeMessage(e,Bd,t)}writePackedFloat(e,t){t.length&&this.writeMessage(e,Rd,t)}writePackedDouble(e,t){t.length&&this.writeMessage(e,zd,t)}writePackedFixed32(e,t){t.length&&this.writeMessage(e,Vd,t)}writePackedSFixed32(e,t){t.length&&this.writeMessage(e,Hd,t)}writePackedFixed64(e,t){t.length&&this.writeMessage(e,Ud,t)}writePackedSFixed64(e,t){t.length&&this.writeMessage(e,Wd,t)}writeBytesField(e,t){this.writeTag(e,2),this.writeBytes(t)}writeFixed32Field(e,t){this.writeTag(e,5),this.writeFixed32(t)}writeSFixed32Field(e,t){this.writeTag(e,5),this.writeSFixed32(t)}writeFixed64Field(e,t){this.writeTag(e,1),this.writeFixed64(t)}writeSFixed64Field(e,t){this.writeTag(e,1),this.writeSFixed64(t)}writeVarintField(e,t){this.writeTag(e,0),this.writeVarint(t)}writeSVarintField(e,t){this.writeTag(e,0),this.writeSVarint(t)}writeStringField(e,t){this.writeTag(e,2),this.writeString(t)}writeFloatField(e,t){this.writeTag(e,5),this.writeFloat(t)}writeDoubleField(e,t){this.writeTag(e,1),this.writeDouble(t)}writeBooleanField(e,t){this.writeVarintField(e,+t)}}function Fd(e,t,n){return n?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}function Q(e,t,n){let r=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));n.realloc(r);for(let t=n.pos-1;t>=e;t--)n.buf[t+r]=n.buf[t]}function Id(e,t){for(let n=0;n<e.length;n++)t.writeVarint(e[n])}function Ld(e,t){for(let n=0;n<e.length;n++)t.writeSVarint(e[n])}function Rd(e,t){for(let n=0;n<e.length;n++)t.writeFloat(e[n])}function zd(e,t){for(let n=0;n<e.length;n++)t.writeDouble(e[n])}function Bd(e,t){for(let n=0;n<e.length;n++)t.writeBoolean(e[n])}function Vd(e,t){for(let n=0;n<e.length;n++)t.writeFixed32(e[n])}function Hd(e,t){for(let n=0;n<e.length;n++)t.writeSFixed32(e[n])}function Ud(e,t){for(let n=0;n<e.length;n++)t.writeFixed64(e[n])}function Wd(e,t){for(let n=0;n<e.length;n++)t.writeSFixed64(e[n])}function Gd(e,t,n){e===1&&n.readMessage(Kd,t)}function Kd(e,t,n){if(e===3){let{id:e,bitmap:r,width:i,height:a,left:o,top:s,advance:c}=n.readMessage(qd,{});t.push({id:e,bitmap:new Ec({width:i+6,height:a+6},r),metrics:{width:i,height:a,left:o,top:s,advance:c}})}}function qd(e,t,n){e===1?t.id=n.readVarint():e===2?t.bitmap=n.readBytes():e===3?t.width=n.readVarint():e===4?t.height=n.readVarint():e===5?t.left=n.readSVarint():e===6?t.top=n.readSVarint():e===7&&(t.advance=n.readVarint())}function Jd(e){let t=0,n=0;for(let r of e)t+=r.w*r.h,n=Math.max(n,r.w);e.sort(((e,t)=>t.h-e.h));let r=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),n),h:1/0}],i=0,a=0;for(let t of e)for(let e=r.length-1;e>=0;e--){let n=r[e];if(!(t.w>n.w||t.h>n.h)){if(t.x=n.x,t.y=n.y,a=Math.max(a,t.y+t.h),i=Math.max(i,t.x+t.w),t.w===n.w&&t.h===n.h){let t=r.pop();t&&e<r.length&&(r[e]=t)}else t.h===n.h?(n.x+=t.w,n.w-=t.w):t.w===n.w?(n.y+=t.h,n.h-=t.h):(r.push({x:n.x+t.w,y:n.y,w:n.w-t.w,h:t.h}),n.y+=t.h,n.h-=t.h);break}}return{w:i,h:a,fill:t/(i*a)||0}}class Yd{constructor(e,{pixelRatio:t,version:n,stretchX:r,stretchY:i,content:a,textFitWidth:o,textFitHeight:s}){this.paddedRect=e,this.pixelRatio=t,this.stretchX=r,this.stretchY=i,this.content=a,this.version=n,this.textFitWidth=o,this.textFitHeight=s}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class Xd{constructor(e,t){let n={},r={};this.haveRenderCallbacks=[];let i=[];this.addImages(e,n,i),this.addImages(t,r,i);let{w:a,h:o}=Jd(i),s=new Dc({width:a||1,height:o||1});for(let t in e){let r=e[t],i=n[t].paddedRect;Dc.copy(r.data,s,{x:0,y:0},{x:i.x+1,y:i.y+1},r.data)}for(let e in t){let n=t[e],i=r[e].paddedRect,a=i.x+1,o=i.y+1,c=n.data.width,l=n.data.height;Dc.copy(n.data,s,{x:0,y:0},{x:a,y:o},n.data),Dc.copy(n.data,s,{x:0,y:l-1},{x:a,y:o-1},{width:c,height:1}),Dc.copy(n.data,s,{x:0,y:0},{x:a,y:o+l},{width:c,height:1}),Dc.copy(n.data,s,{x:c-1,y:0},{x:a-1,y:o},{width:1,height:l}),Dc.copy(n.data,s,{x:0,y:0},{x:a+c,y:o},{width:1,height:l})}this.image=s,this.iconPositions=n,this.patternPositions=r}addImages(e,t,n){for(let r in e){let i=e[r],a={x:0,y:0,w:i.data.width+2,h:i.data.height+2};n.push(a),t[r]=new Yd(a,i),i.hasRenderCallback&&this.haveRenderCallbacks.push(r)}}patchUpdatedImages(e,t){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(let n in e.updatedImages)this.patchUpdatedImage(this.iconPositions[n],e.getImage(n),t),this.patchUpdatedImage(this.patternPositions[n],e.getImage(n),t)}patchUpdatedImage(e,t,n){if(!e||!t||e.version===t.version)return;e.version=t.version;let[r,i]=e.tl;n.update(t.data,void 0,{x:r,y:i})}}var Zd;function Qd(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){let g=jd.fromFeature(t,a),_;f===e.ax.vertical&&g.verticalizePunctuation();let v=g.determineLineBreaks(u,o,n,i,m),{processBidirectionalText:y,processStyledBidirectionalText:b}=Ra;if(y&&g.sections.length===1){_=[],v=v.map((e=>g.toCodeUnitIndex(e)));let e=y(g.toString(),v);for(let t of e){let e=[...t].map((()=>0));_.push(new jd(t,g.sections,e))}}else if(b){_=[],v=v.map((e=>g.toCodeUnitIndex(e)));let e=0,t=[];for(let n of g.text)t.push(...Array(n.length).fill(g.sectionIndex[e])),e++;let n=b(g.text,t,v);for(let e of n){let t=[],n=``;for(let r of e[0])t.push(e[1][n.length]),n+=r;_.push(new jd(e[0],g.sections,t))}}else _=function(e,t){let n=[],r=0;for(let i of t)n.push(e.substring(r,i)),r=i;return r<e.length()&&n.push(e.substring(r,e.length())),n}(g,v);let x=[],S={positionedLines:x,text:g.toString(),top:d[1],bottom:d[1],left:d[0],right:d[0],writingMode:f,iconsInText:!1,verticalizable:!1};return function(e,t,n,r,i,a,o,s,c,l,u,d){let f=0,p=0,m=0,h=0,g=s===`right`?1:s===`left`?0:.5,_=Sd/d,v=0;for(let o of i){o.trim();let i=o.getMaxScale(),s={positionedGlyphs:[],lineOffset:0};e.positionedLines[v]=s;let d=s.positionedGlyphs,y=0;if(!o.length()){p+=a,++v;continue}let b=ef(r,o,_),x=0;for(let a of o.text){let s=o.getSection(x),m=a.codePointAt(0),h=nf(c,u,m),g={glyph:m,imageName:null,x:f,y:p+-17,vertical:h,scale:1,fontStack:``,sectionIndex:o.getSectionIndex(x),metrics:null,rect:null},v;if(`fontStack`in s){if(v=rf(s,m,h,b,t,n),!v)continue;g.fontStack=s.fontStack}else{if(e.iconsInText=!0,s.scale*=_,v=af(s,h,i,b,r),!v)continue;y=Math.max(y,v.imageOffset),g.imageName=s.imageName}let{rect:S,metrics:C,baselineOffset:w}=v;g.y+=w,g.scale=s.scale,g.metrics=C,g.rect=S,d.push(g),h?(e.verticalizable=!0,f+=(`imageName`in s?C.advance:Sd)*s.scale+l):f+=C.advance*s.scale+l,x++}d.length!==0&&(m=Math.max(f-l,m),of(d,0,d.length-1,g)),f=0,s.lineOffset=Math.max(y,(i-1)*Sd);let S=a*i+y;p+=S,h=Math.max(S,h),++v}let{horizontalAlign:y,verticalAlign:b}=$d(o);(function(e,t,n,r,i,a,o,s,c){let l=(t-n)*i,u=0;u=a===o?-r*c*o+.5*o:-s*r- -17;for(let t of e)for(let e of t.positionedGlyphs)e.x+=l,e.y+=u})(e.positionedLines,g,y,b,m,h,a,p,i.length),e.top+=-b*p,e.bottom=e.top+p,e.left+=-y*m,e.right=e.left+m}(S,n,r,i,_,s,c,l,f,u,p,h),!function(e){for(let t of e)if(t.positionedGlyphs.length!==0)return!1;return!0}(x)&&S}function $d(e){let t=.5,n=.5;switch(e){case`right`:case`top-right`:case`bottom-right`:t=1;break;case`left`:case`top-left`:case`bottom-left`:t=0}switch(e){case`bottom`:case`bottom-right`:case`bottom-left`:n=1;break;case`top`:case`top-right`:case`top-left`:n=0}return{horizontalAlign:t,verticalAlign:n}}function ef(e,t,n){let r=t.getMaxScale()*Sd,{maxImageWidth:i,maxImageHeight:a}=t.getMaxImageSize(e),o=Math.max(r,a*n);return{verticalLineContentWidth:Math.max(r,i*n),horizontalLineContentHeight:o}}function tf(e){switch(e){case`top`:return 0;case`center`:return .5;default:return 1}}function nf(t,n,r){return!(t===e.ax.horizontal||!n&&!Ea(r)||n&&(Da(r)||(i=r,/\p{sc=Arab}/u.test(String.fromCodePoint(i)))));var i}function rf(e,t,n,r,i,a){let o=function(e,t,n,r){if(e?.rect)return e;let i=t[n.fontStack]?.[r];return i?{rect:null,metrics:i.metrics}:null}(a[e.fontStack]?.[t],i,e,t);if(o===null)return null;let s;if(n)s=r.verticalLineContentWidth-e.scale*Sd;else{let t=tf(e.verticalAlign);s=(r.horizontalLineContentHeight-e.scale*Sd)*t}return{rect:o.rect,metrics:o.metrics,baselineOffset:s}}function af(e,t,n,r,i){let a=i[e.imageName];if(!a)return null;let o=a.paddedRect,s=a.displaySize,c={width:s[0],height:s[1],left:1,top:-3,advance:t?s[1]:s[0]},l;if(t)l=r.verticalLineContentWidth-s[1]*e.scale;else{let t=tf(e.verticalAlign);l=(r.horizontalLineContentHeight-s[1]*e.scale)*t}return{rect:o,metrics:c,baselineOffset:l,imageOffset:(t?s[0]:s[1])*e.scale-Sd*n}}function of(e,t,n,r){if(r===0)return;let i=e[n],a=(e[n].x+i.metrics.advance*i.scale)*r;for(let r=t;r<=n;r++)e[r].x-=a}function sf(e,t,n){let{horizontalAlign:r,verticalAlign:i}=$d(n),a=t[0]-e.displaySize[0]*r,o=t[1]-e.displaySize[1]*i;return{image:e,top:o,bottom:o+e.displaySize[1],left:a,right:a+e.displaySize[0]}}function cf(e){let t=e.left,n=e.top,r=e.right-t,i=e.bottom-n,a=e.image.textFitWidth??`stretchOrShrink`,o=e.image.textFitHeight??`stretchOrShrink`,s=(e.image.content[2]-e.image.content[0])/(e.image.content[3]-e.image.content[1]);if(o===`proportional`){if(a===`stretchOnly`&&r/i<s||a===`proportional`){let e=Math.ceil(i*s);t*=e/r,r=e}}else if(a===`proportional`&&o===`stretchOnly`&&s!==0&&r/i>s){let e=Math.ceil(r/s);n*=e/i,i=e}return{x1:t,y1:n,x2:t+r,y2:n+i}}function lf(e,t,n,r,i,a){let o=e.image,s;if(o.content){let e=o.content,t=o.pixelRatio||1;s=[e[0]/t,e[1]/t,o.displaySize[0]-e[2]/t,o.displaySize[1]-e[3]/t]}let c=t.left*a,l=t.right*a,u,d,f,p;n===`width`||n===`both`?(p=i[0]+c-r[3],d=i[0]+l+r[1]):(p=i[0]+(c+l-o.displaySize[0])/2,d=p+o.displaySize[0]);let m=t.top*a,h=t.bottom*a;return n===`height`||n===`both`?(u=i[1]+m-r[0],f=i[1]+h+r[2]):(u=i[1]+(m+h-o.displaySize[1])/2,f=u+o.displaySize[1]),{image:o,top:u,right:d,bottom:f,left:p,collisionPadding:s}}K(`ImagePosition`,Yd),K(`ImageAtlas`,Xd),e.ax=void 0,(Zd=e.ax||={})[Zd.none=0]=`none`,Zd[Zd.horizontal=1]=`horizontal`,Zd[Zd.vertical=2]=`vertical`,Zd[Zd.horizontalOnly=3]=`horizontalOnly`;let uf=32640;function df(e,t){let{expression:n}=t;if(n.kind===`constant`)return{kind:`constant`,layoutSize:n.evaluate(new za(e+1))};if(n.kind===`source`)return{kind:`source`};{let{zoomStops:t,interpolationType:r}=n,i=0;for(;i<t.length&&t[i]<=e;)i++;i=Math.max(0,i-1);let a=i;for(;a<t.length&&t[a]<e+1;)a++;a=Math.min(t.length-1,a);let o=t[i],s=t[a];return n.kind===`composite`?{kind:`composite`,minZoom:o,maxZoom:s,interpolationType:r}:{kind:`camera`,minZoom:o,maxZoom:s,minSize:n.evaluate(new za(o)),maxSize:n.evaluate(new za(s)),interpolationType:r}}}function ff(e,t,n){let r=`never`,i=e.get(t);return i?r=i:e.get(n)&&(r=`always`),r}let pf=[{name:`a_fade_opacity`,components:1,type:`Uint8`,offset:0}];function mf(e,t,n,r,i,a,o,s,c,l,u,d,f){let p=s?Math.min(uf,Math.round(s[0])):0,m=s?Math.min(uf,Math.round(s[1])):0;e.emplaceBack(t,n,Math.round(32*r),Math.round(32*i),a,o,(p<<1)+ +!!c,m,16*l,16*u,256*d,256*f)}function hf(e,t,n){e.emplaceBack(t.x,t.y,n),e.emplaceBack(t.x,t.y,n),e.emplaceBack(t.x,t.y,n),e.emplaceBack(t.x,t.y,n)}function gf(e){for(let t of e.sections)if(La(t.text))return!0;return!1}class _f{constructor(e){this.layoutVertexArray=new ns,this.indexArray=new ss,this.programConfigurations=e,this.segments=new us,this.dynamicLayoutVertexArray=new rs,this.opacityVertexArray=new is,this.hasVisibleVertices=!1,this.placedSymbolArray=new zo}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,t,n,r){this.isEmpty()||(n&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,hd.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,gd.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,pf,!0),this.opacityVertexBuffer.itemSize=1),(n||r)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}K(`SymbolBuffers`,_f);class vf{constructor(e,t,n){this.layoutVertexArray=new e,this.layoutAttributes=t,this.indexArray=new n,this.segments=new us,this.collisionVertexArray=new os}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,_d.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}K(`CollisionBuffers`,vf);class yf{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasDependencies=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];let n=this.layers[0]._unevaluatedLayout._values;this.textSizeData=df(this.zoom,n[`text-size`]),this.iconSizeData=df(this.zoom,n[`icon-size`]);let r=this.layers[0].layout,i=r.get(`symbol-sort-key`),a=r.get(`symbol-z-order`);this.canOverlap=ff(r,`text-overlap`,`text-allow-overlap`)!==`never`||ff(r,`icon-overlap`,`icon-allow-overlap`)!==`never`||r.get(`text-ignore-placement`)||r.get(`icon-ignore-placement`),this.sortFeaturesByKey=a!==`viewport-y`&&!i.isConstant(),this.sortFeaturesByY=(a===`viewport-y`||a===`auto`&&!this.sortFeaturesByKey)&&this.canOverlap,r.get(`symbol-placement`)===`point`&&(this.writingModes=r.get(`text-writing-mode`).map((t=>e.ax[t]))),this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.sourceID=t.sourceID}createArrays(){this.text=new _f(new zs(this.layers,this.zoom,(e=>e.startsWith(`text`)))),this.icon=new _f(new zs(this.layers,this.zoom,(e=>e.startsWith(`icon`)))),this.glyphOffsetArray=new Ho,this.lineVertexArray=new Uo,this.symbolInstances=new Vo,this.textAnchorOffsets=new Go}calculateGlyphDependencies(e,t,n,r,i){for(let a of e)if(t[a.codePointAt(0)]=!0,(n||r)&&i){let e=Cd[a];e&&(t[e.codePointAt(0)]=!0)}}populate(t,n,r){let i=this.layers[0],a=i.layout,o=a.get(`text-font`),s=a.get(`text-field`),c=a.get(`icon-image`),l=(s.value.kind!==`constant`||s.value.value instanceof Yt&&!s.value.value.isEmpty()||s.value.value.toString().length>0)&&(o.value.kind!==`constant`||o.value.value.length>0),u=c.value.kind!==`constant`||!!c.value.value||Object.keys(c.parameters).length>0,d=a.get(`symbol-sort-key`);if(this.features=[],!l&&!u)return;let f=n.iconDependencies,p=n.glyphDependencies,m=n.availableImages,h=new za(this.zoom);for(let{feature:n,id:s,index:c,sourceLayerIndex:g}of t){let t=i._featureFilter.needGeometry,_=Gs(n,t);if(!i._featureFilter.filter(h,_,r))continue;let v,y;if(t||(_.geometry=Ws(n)),l){let e=i.getValueAndResolveTokens(`text-field`,_,r,m),t=Yt.factory(e);this.hasRTLText||=gf(t),(!this.hasRTLText||Ra.getRTLTextPluginStatus()===`unavailable`||this.hasRTLText&&Ra.isParsed())&&(v=xd(t,i,_))}if(u){let e=i.getValueAndResolveTokens(`icon-image`,_,r,m);y=e instanceof nn?e:nn.fromString(e)}if(!v&&!y)continue;let b=this.sortFeaturesByKey?d.evaluate(_,{},r):void 0;if(this.features.push({id:s,text:v,icon:y,index:c,sourceLayerIndex:g,geometry:_.geometry,properties:n.properties,type:Pl.types[n.type],sortKey:b}),y&&(f[y.name]=!0),v){let t=o.evaluate(_,{},r).join(`,`),n=a.get(`text-rotation-alignment`)!==`viewport`&&a.get(`symbol-placement`)!==`point`;this.allowVerticalPlacement=this.writingModes?.includes(e.ax.vertical);for(let e of v.sections)if(e.image)f[e.image.name]=!0;else{let r=Oa(v.toString()),i=e.fontStack||t;p[i]||(p[i]={}),this.calculateGlyphDependencies(e.text,p[i],n,this.allowVerticalPlacement,r)}}}a.get(`symbol-placement`)===`line`&&(this.features=function(e){let t={},n={},r=[],i=0;function a(t){r.push(e[t]),i++}function o(e,t,i){let a=n[e];return delete n[e],n[t]=a,r[a].geometry[0].pop(),r[a].geometry[0]=r[a].geometry[0].concat(i[0]),a}function s(e,n,i){let a=t[n];return delete t[n],t[e]=a,r[a].geometry[0].shift(),r[a].geometry[0]=i[0].concat(r[a].geometry[0]),a}function c(e,t,n){let r=n?t[0][t[0].length-1]:t[0][0];return`${e}:${r.x}:${r.y}`}for(let l=0;l<e.length;l++){let u=e[l],d=u.geometry,f=u.text?u.text.toString():null;if(!f){a(l);continue}let p=c(f,d),m=c(f,d,!0);if(p in n&&m in t&&n[p]!==t[m]){let e=s(p,m,d),i=o(p,m,r[e].geometry);delete t[p],delete n[m],n[c(f,r[i].geometry,!0)]=i,r[e].geometry=null}else p in n?o(p,m,d):m in t?s(p,m,d):(a(l),t[p]=i-1,n[m]=i-1)}return r.filter((e=>e.geometry))}(this.features)),this.sortFeaturesByKey&&this.features.sort(((e,t)=>e.sortKey-t.sortKey))}update(e,t,n){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,t,this.layers,{imagePositions:n}),this.icon.programConfigurations.updatePaintArrays(e,t,this.layers,{imagePositions:n}))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,t){let n=this.lineVertexArray.length;if(e.segment!==void 0){let n=e.dist(t[e.segment+1]),r=e.dist(t[e.segment]),i={};for(let r=e.segment+1;r<t.length;r++)i[r]={x:t[r].x,y:t[r].y,tileUnitDistanceFromAnchor:n},r<t.length-1&&(n+=t[r+1].dist(t[r]));for(let n=e.segment||0;n>=0;n--)i[n]={x:t[n].x,y:t[n].y,tileUnitDistanceFromAnchor:r},n>0&&(r+=t[n-1].dist(t[n]));for(let e=0;e<t.length;e++){let t=i[e];this.lineVertexArray.emplaceBack(t.x,t.y,t.tileUnitDistanceFromAnchor)}}return{lineStartIndex:n,lineLength:this.lineVertexArray.length-n}}addSymbols(t,n,r,i,a,o,s,c,l,u,d,f){let p=t.indexArray,m=t.layoutVertexArray,h=t.segments.prepareSegment(4*n.length,m,p,this.canOverlap?o.sortKey:void 0),g=this.glyphOffsetArray.length,_=h.vertexLength,v=this.allowVerticalPlacement&&s===e.ax.vertical?Math.PI/2:0,y=o.text&&o.text.sections;for(let e=0;e<n.length;e++){let{tl:i,tr:a,bl:s,br:l,tex:u,pixelOffsetTL:d,pixelOffsetBR:g,minFontScaleX:_,minFontScaleY:b,glyphOffset:x,isSDF:S,sectionIndex:C}=n[e],w=h.vertexLength,T=x[1];mf(m,c.x,c.y,i.x,T+i.y,u.x,u.y,r,S,d.x,d.y,_,b),mf(m,c.x,c.y,a.x,T+a.y,u.x+u.w,u.y,r,S,g.x,d.y,_,b),mf(m,c.x,c.y,s.x,T+s.y,u.x,u.y+u.h,r,S,d.x,g.y,_,b),mf(m,c.x,c.y,l.x,T+l.y,u.x+u.w,u.y+u.h,r,S,g.x,g.y,_,b),hf(t.dynamicLayoutVertexArray,c,v),p.emplaceBack(w,w+2,w+1),p.emplaceBack(w+1,w+2,w+3),h.vertexLength+=4,h.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(x[0]),e!==n.length-1&&C===n[e+1].sectionIndex||t.programConfigurations.populatePaintArrays(m.length,o,o.index,{imagePositions:{},canonical:f,formattedSection:y?.[C]})}t.placedSymbolArray.emplaceBack(c.x,c.y,g,this.glyphOffsetArray.length-g,_,l,u,c.segment,r?r[0]:0,r?r[1]:0,i[0],i[1],s,0,!1,0,d)}_addCollisionDebugVertex(e,t,n,r,i,a){return t.emplaceBack(0,0),e.emplaceBack(n.x,n.y,r,i,Math.round(a.x),Math.round(a.y))}addCollisionDebugVertices(e,t,r,i,a,o,s){let c=a.segments.prepareSegment(4,a.layoutVertexArray,a.indexArray),l=c.vertexLength,u=a.layoutVertexArray,d=a.collisionVertexArray,f=s.anchorX,p=s.anchorY;this._addCollisionDebugVertex(u,d,o,f,p,new n(e,t)),this._addCollisionDebugVertex(u,d,o,f,p,new n(r,t)),this._addCollisionDebugVertex(u,d,o,f,p,new n(r,i)),this._addCollisionDebugVertex(u,d,o,f,p,new n(e,i)),c.vertexLength+=4;let m=a.indexArray;m.emplaceBack(l,l+1),m.emplaceBack(l+1,l+2),m.emplaceBack(l+2,l+3),m.emplaceBack(l+3,l),c.primitiveLength+=4}addDebugCollisionBoxes(e,t,n,r){for(let i=e;i<t;i++){let e=this.collisionBoxArray.get(i);this.addCollisionDebugVertices(e.x1,e.y1,e.x2,e.y2,r?this.textCollisionBox:this.iconCollisionBox,e.anchorPoint,n)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new vf(as,vd.members,cs),this.iconCollisionBox=new vf(as,vd.members,cs);for(let e=0;e<this.symbolInstances.length;e++){let t=this.symbolInstances.get(e);this.addDebugCollisionBoxes(t.textBoxStartIndex,t.textBoxEndIndex,t,!0),this.addDebugCollisionBoxes(t.verticalTextBoxStartIndex,t.verticalTextBoxEndIndex,t,!0),this.addDebugCollisionBoxes(t.iconBoxStartIndex,t.iconBoxEndIndex,t,!1),this.addDebugCollisionBoxes(t.verticalIconBoxStartIndex,t.verticalIconBoxEndIndex,t,!1)}}_deserializeCollisionBoxesForSymbol(e,t,n,r,i,a,o,s,c){let l={};for(let r=t;r<n;r++){let t=e.get(r);l.textBox={x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,anchorPointX:t.anchorPointX,anchorPointY:t.anchorPointY},l.textFeatureIndex=t.featureIndex;break}for(let t=r;t<i;t++){let n=e.get(t);l.verticalTextBox={x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,anchorPointX:n.anchorPointX,anchorPointY:n.anchorPointY},l.verticalTextFeatureIndex=n.featureIndex;break}for(let t=a;t<o;t++){let n=e.get(t);l.iconBox={x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,anchorPointX:n.anchorPointX,anchorPointY:n.anchorPointY},l.iconFeatureIndex=n.featureIndex;break}for(let t=s;t<c;t++){let n=e.get(t);l.verticalIconBox={x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,anchorPointX:n.anchorPointX,anchorPointY:n.anchorPointY},l.verticalIconFeatureIndex=n.featureIndex;break}return l}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let t=0;t<this.symbolInstances.length;t++){let n=this.symbolInstances.get(t);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,n.textBoxStartIndex,n.textBoxEndIndex,n.verticalTextBoxStartIndex,n.verticalTextBoxEndIndex,n.iconBoxStartIndex,n.iconBoxEndIndex,n.verticalIconBoxStartIndex,n.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(e,t){let n=e.placedSymbolArray.get(t),r=n.vertexStartIndex+4*n.numGlyphs;for(let t=n.vertexStartIndex;t<r;t+=4)e.indexArray.emplaceBack(t,t+2,t+1),e.indexArray.emplaceBack(t+1,t+2,t+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;let t=Math.sin(e),n=Math.cos(e),r=[],i=[],a=[];for(let e=0;e<this.symbolInstances.length;++e){a.push(e);let o=this.symbolInstances.get(e);r.push(0|Math.round(t*o.anchorX+n*o.anchorY)),i.push(o.featureIndex)}return a.sort(((e,t)=>r[e]-r[t]||i[t]-i[e])),a}addToSortKeyRanges(e,t){let n=this.sortKeyRanges[this.sortKeyRanges.length-1];n?.sortKey===t?n.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:t,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let e of this.symbolInstanceIndexes){let t=this.symbolInstances.get(e);this.featureSortOrder.push(t.featureIndex);let n=[t.rightJustifiedTextSymbolIndex,t.centerJustifiedTextSymbolIndex,t.leftJustifiedTextSymbolIndex];for(let e=0;e<n.length;e++){let t=n[e];t>=0&&n.indexOf(t)===e&&this.addIndicesForPlacedSymbol(this.text,t)}t.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,t.verticalPlacedTextSymbolIndex),t.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,t.placedIconSymbolIndex),t.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,t.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let bf,xf;K(`SymbolBucket`,yf,{omit:[`layers`,`collisionBoxArray`,`features`,`compareText`]}),yf.MAX_GLYPHS=65535,yf.addDynamicAttributes=hf;var Sf={get paint(){return xf||=new $a({"icon-opacity":new J(N.paint_symbol[`icon-opacity`]),"icon-color":new J(N.paint_symbol[`icon-color`]),"icon-halo-color":new J(N.paint_symbol[`icon-halo-color`]),"icon-halo-width":new J(N.paint_symbol[`icon-halo-width`]),"icon-halo-blur":new J(N.paint_symbol[`icon-halo-blur`]),"icon-translate":new q(N.paint_symbol[`icon-translate`]),"icon-translate-anchor":new q(N.paint_symbol[`icon-translate-anchor`]),"text-opacity":new J(N.paint_symbol[`text-opacity`]),"text-color":new J(N.paint_symbol[`text-color`],{runtimeType:it,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new J(N.paint_symbol[`text-halo-color`]),"text-halo-width":new J(N.paint_symbol[`text-halo-width`]),"text-halo-blur":new J(N.paint_symbol[`text-halo-blur`]),"text-translate":new q(N.paint_symbol[`text-translate`]),"text-translate-anchor":new q(N.paint_symbol[`text-translate-anchor`])})},get layout(){return bf||=new $a({"symbol-placement":new q(N.layout_symbol[`symbol-placement`]),"symbol-spacing":new q(N.layout_symbol[`symbol-spacing`]),"symbol-avoid-edges":new q(N.layout_symbol[`symbol-avoid-edges`]),"symbol-sort-key":new J(N.layout_symbol[`symbol-sort-key`]),"symbol-z-order":new q(N.layout_symbol[`symbol-z-order`]),"icon-allow-overlap":new q(N.layout_symbol[`icon-allow-overlap`]),"icon-overlap":new q(N.layout_symbol[`icon-overlap`]),"icon-ignore-placement":new q(N.layout_symbol[`icon-ignore-placement`]),"icon-optional":new q(N.layout_symbol[`icon-optional`]),"icon-rotation-alignment":new q(N.layout_symbol[`icon-rotation-alignment`]),"icon-size":new J(N.layout_symbol[`icon-size`]),"icon-text-fit":new q(N.layout_symbol[`icon-text-fit`]),"icon-text-fit-padding":new q(N.layout_symbol[`icon-text-fit-padding`]),"icon-image":new J(N.layout_symbol[`icon-image`]),"icon-rotate":new J(N.layout_symbol[`icon-rotate`]),"icon-padding":new J(N.layout_symbol[`icon-padding`]),"icon-keep-upright":new q(N.layout_symbol[`icon-keep-upright`]),"icon-offset":new J(N.layout_symbol[`icon-offset`]),"icon-anchor":new J(N.layout_symbol[`icon-anchor`]),"icon-pitch-alignment":new q(N.layout_symbol[`icon-pitch-alignment`]),"text-pitch-alignment":new q(N.layout_symbol[`text-pitch-alignment`]),"text-rotation-alignment":new q(N.layout_symbol[`text-rotation-alignment`]),"text-field":new J(N.layout_symbol[`text-field`]),"text-font":new J(N.layout_symbol[`text-font`]),"text-size":new J(N.layout_symbol[`text-size`]),"text-max-width":new J(N.layout_symbol[`text-max-width`]),"text-line-height":new q(N.layout_symbol[`text-line-height`]),"text-letter-spacing":new J(N.layout_symbol[`text-letter-spacing`]),"text-justify":new J(N.layout_symbol[`text-ju
9stify`]),"text-radial-offset":new J(N.layout_symbol[`text-radial-offset`]),"text-variable-anchor":new q(N.layout_symbol[`text-variable-anchor`]),"text-variable-anchor-offset":new J(N.layout_symbol[`text-variable-anchor-offset`]),"text-anchor":new J(N.layout_symbol[`text-anchor`]),"text-max-angle":new q(N.layout_symbol[`text-max-angle`]),"text-writing-mode":new q(N.layout_symbol[`text-writing-mode`]),"text-rotate":new J(N.layout_symbol[`text-rotate`]),"text-padding":new q(N.layout_symbol[`text-padding`]),"text-keep-upright":new q(N.layout_symbol[`text-keep-upright`]),"text-transform":new J(N.layout_symbol[`text-transform`]),"text-offset":new J(N.layout_symbol[`text-offset`]),"text-allow-overlap":new q(N.layout_symbol[`text-allow-overlap`]),"text-overlap":new q(N.layout_symbol[`text-overlap`]),"text-ignore-placement":new q(N.layout_symbol[`text-ignore-placement`]),"text-optional":new q(N.layout_symbol[`text-optional`])})}};class Cf{constructor(e){if(e.property.overrides===void 0)throw Error(`overrides must be provided to instantiate FormatSectionOverride class`);this.type=e.property.overrides?e.property.overrides.runtimeType:tt,this.defaultValue=e}evaluate(e){if(e.formattedSection){let t=this.defaultValue.property.overrides;if(t?.hasOverride(e.formattedSection))return t.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}K(`FormatSectionOverride`,Cf,{omit:[`defaultValue`]});class wf extends no{constructor(e,t){super(e,Sf,t)}recalculate(e,t){if(super.recalculate(e,t),this.layout.get(`icon-rotation-alignment`)===`auto`&&(this.layout._values[`icon-rotation-alignment`]=this.layout.get(`symbol-placement`)===`point`?`viewport`:`map`),this.layout.get(`text-rotation-alignment`)===`auto`&&(this.layout._values[`text-rotation-alignment`]=this.layout.get(`symbol-placement`)===`point`?`viewport`:`map`),this.layout.get(`text-pitch-alignment`)===`auto`&&(this.layout._values[`text-pitch-alignment`]=this.layout.get(`text-rotation-alignment`)===`map`?`map`:`viewport`),this.layout.get(`icon-pitch-alignment`)===`auto`&&(this.layout._values[`icon-pitch-alignment`]=this.layout.get(`icon-rotation-alignment`)),this.layout.get(`symbol-placement`)===`point`){let e=this.layout.get(`text-writing-mode`);if(e){let t=[];for(let n of e)t.includes(n)||t.push(n);this.layout._values[`text-writing-mode`]=t}else this.layout._values[`text-writing-mode`]=[`horizontal`]}this._setPaintOverrides()}getValueAndResolveTokens(e,t,n,r){let i=this.layout.get(e).evaluate(t,{},n,r),a=this._unevaluatedLayout._values[e];return a.isDataDriven()||hi(a.value)||!i?i:function(e,t){return t.replace(/{([^{}]+)}/g,((t,n)=>e&&n in e?String(e[n]):``))}(t.properties,i)}createBucket(e){return new yf(e)}queryRadius(){return 0}queryIntersectsFeature(){throw Error(`Should take a different path in FeatureIndex`)}_setPaintOverrides(){for(let e of Sf.paint.overridableProperties){if(!wf.hasPaintOverride(this.layout,e))continue;let t=this.paint.get(e),n=new Cf(t),r=new mi(n,t.property.specification),i=null;i=t.value.kind===`constant`||t.value.kind===`source`?new _i(`source`,r):new vi(`composite`,r,t.value.zoomStops),this.paint._values[e]=new Ja(t.property,i,t.parameters)}}_handleOverridablePaintPropertyUpdate(e,t,n){return!(!this.layout||t.isDataDriven()||n.isDataDriven())&&wf.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,t){let n=e.get(`text-field`),r=Sf.paint.properties[t],i=!1,a=e=>{for(let t of e)if(r.overrides?.hasOverride(t))return void(i=!0)};if(n.value.kind===`constant`&&n.value.value instanceof Yt)a(n.value.value.sections);else if(n.value.kind===`source`||n.value.kind===`composite`){let e=t=>{i||(t instanceof ln&&sn(t.value)===lt?a(t.value.sections):t instanceof Kn?a(t.sections):t.eachChild(e))},t=n.value;t._styleExpression&&e(t._styleExpression.expression)}return i}}let Tf;var Ef={get paint(){return Tf||=new $a({"background-color":new q(N.paint_background[`background-color`]),"background-pattern":new Za(N.paint_background[`background-pattern`]),"background-opacity":new q(N.paint_background[`background-opacity`])})}};class Df extends no{constructor(e,t){super(e,Ef,t)}}class Of extends no{constructor(e,t){super(e,{},t),this.onAdd=e=>{this.implementation.onAdd&&this.implementation.onAdd(e,e.painter.context.gl)},this.onRemove=e=>{this.implementation.onRemove&&this.implementation.onRemove(e,e.painter.context.gl)},this.implementation=e}is3D(){return this.implementation.renderingMode===`3d`}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw Error(`Custom layers cannot be serialized`)}}class kf{constructor(e){this._methodToThrottle=e,this._triggered=!1,this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()}}trigger(){var e;this._triggered||(this._triggered=!0,(e=this._channel)==null||e.port1.postMessage(!0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}let Af={once:!0},jf=6371008.8;class Mf{constructor(e,t){if(isNaN(e)||isNaN(t))throw Error(`Invalid LngLat object: (${e}, ${t})`);if(this.lng=+e,this.lat=+t,this.lat>90||this.lat<-90)throw Error(`Invalid LngLat latitude value: must be between -90 and 90`)}wrap(){return new Mf(M(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){let t=Math.PI/180,n=this.lat*t,r=e.lat*t,i=Math.sin(n)*Math.sin(r)+Math.cos(n)*Math.cos(r)*Math.cos((e.lng-this.lng)*t);return jf*Math.acos(Math.min(i,1))}static convert(e){if(e instanceof Mf)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new Mf(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e==`object`&&e)return new Mf(Number(`lng`in e?e.lng:e.lon),Number(e.lat));throw Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}let Nf=2*Math.PI*jf;function Pf(e){return Nf*Math.cos(e*Math.PI/180)}function Ff(e){return(180+e)/360}function If(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function Lf(e,t){return e/Pf(t)}function Rf(e){return 360*e-180}function zf(e){return 360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180)
vendor: 7,545 bytes, line 9
9)-90}function Bf(e,t){return e*Pf(zf(t))}class Vf{constructor(e,t,n=0){this.x=+e,this.y=+t,this.z=+n}static fromLngLat(e,t=0){let n=Mf.convert(e);return new Vf(Ff(n.lng),If(n.lat),Lf(t,n.lat))}toLngLat(){return new Mf(Rf(this.x),zf(this.y))}toAltitude(){return Bf(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/Nf*(e=zf(this.y),1/Math.cos(e*Math.PI/180));var e}}function Hf(e,t,n){var r=2*Math.PI*6378137/256/2**n;return[e*r-2*Math.PI*6378137/2,t*r-2*Math.PI*6378137/2]}class Uf{constructor(e,t,n){if(!function(e,t,n){return!(e<0||e>25||n<0||n>=2**e||t<0||t>=2**e)}(e,t,n))throw Error(`x=${t}, y=${n}, z=${e} outside of bounds. 0<=x<${2**e}, 0<=y<${2**e} 0<=z<=25 `);this.z=e,this.x=t,this.y=n,this.key=Kf(0,e,e,t,n)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,t,n){let r=(a=this.y,o=this.z,s=Hf(256*(i=this.x),256*(a=2**o-a-1),o),c=Hf(256*(i+1),256*(a+1),o),s[0]+`,`+s[1]+`,`+c[0]+`,`+c[1]);var i,a,o,s,c;let l=function(e,t,n){let r=``;for(let i=e;i>0;i--){let e=1<<i-1;r+=(t&e?1:0)+(n&e?2:0)}return r}(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(n===`tms`?2**this.z-this.y-1:this.y)).replace(/{ratio}/g,t>1?`@2x`:``).replace(/{quadkey}/g,l).replace(/{bbox-epsg-3857}/g,r)}isChildOf(e){let t=this.z-e.z;return t>0&&e.x===this.x>>t&&e.y===this.y>>t}getTilePoint(e){let t=2**this.z;return new n((e.x*t-this.x)*O,(e.y*t-this.y)*O)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Wf{constructor(e,t){this.wrap=e,this.canonical=t,this.key=Kf(e,t.z,t.z,t.x,t.y)}}class Gf{constructor(e,t,n,r,i){if(this.terrainRttPosMatrix32f=null,e<n)throw Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${n}`);this.overscaledZ=e,this.wrap=t,this.canonical=new Uf(n,+r,+i),this.key=Kf(t,e,n,r,i)}clone(){return new Gf(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);let t=this.canonical.z-e;return e>this.canonical.z?new Gf(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Gf(e,this.wrap,e,this.canonical.x>>t,this.canonical.y>>t)}isOverscaled(){return this.overscaledZ>this.canonical.z}calculateScaledKey(e,t){if(e>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);let n=this.canonical.z-e;return e>this.canonical.z?Kf(this.wrap*+t,e,this.canonical.z,this.canonical.x,this.canonical.y):Kf(this.wrap*+t,e,e,this.canonical.x>>n,this.canonical.y>>n)}isChildOf(e){if(e.wrap!==this.wrap||this.overscaledZ-e.overscaledZ<=0)return!1;if(e.overscaledZ===0)return this.overscaledZ>0;let t=this.canonical.z-e.canonical.z;return!(t<0)&&e.canonical.x===this.canonical.x>>t&&e.canonical.y===this.canonical.y>>t}children(e){if(this.overscaledZ>=e)return[new Gf(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let t=this.canonical.z+1,n=2*this.canonical.x,r=2*this.canonical.y;return[new Gf(t,this.wrap,t,n,r),new Gf(t,this.wrap,t,n+1,r),new Gf(t,this.wrap,t,n,r+1),new Gf(t,this.wrap,t,n+1,r+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new Gf(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new Gf(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return 2**(this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Wf(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new Vf(e.x-this.wrap,e.y))}normalizeCoordinates(e,t,n=8192){if(e>=0&&e<n&&t>=0&&t<n)return{tileID:this,x:e,y:t};let r=Math.floor(e/n),i=Math.floor(t/n),a=e-r*n,o=t-i*n,s=this.canonical.z,c=1<<s,l=this.canonical.y+i;if(l<0||l>=c)return null;let u=this.canonical.x+r,d=this.wrap;return u<0?(d-=Math.ceil(-u/c),u=(u%c+c)%c):u>=c&&(d+=Math.floor(u/c),u%=c),{tileID:new Gf(this.overscaledZ,d,s,u,l),x:a,y:o}}}function Kf(e,t,n,r,i){(e*=2)<0&&(e=-1*e-1);let a=1<<n;return(a*a*e+a*i+r).toString(36)+n.toString(36)+t.toString(36)}K(`CanonicalTileID`,Uf),K(`OverscaledTileID`,Gf,{omit:[`terrainRttPosMatrix32f`]});class qf{constructor(){this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0}extend(e){return this.minX=Math.min(this.minX,e.x),this.minY=Math.min(this.minY,e.y),this.maxX=Math.max(this.maxX,e.x),this.maxY=Math.max(this.maxY,e.y),this}expandBy(e){return this.minX-=e,this.minY-=e,this.maxX+=e,this.maxY+=e,(this.minX>this.maxX||this.minY>this.maxY)&&(this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0),this}shrinkBy(e){return this.expandBy(-e)}map(e){let t=new qf;return t.extend(e(new n(this.minX,this.minY))),t.extend(e(new n(this.maxX,this.minY))),t.extend(e(new n(this.minX,this.maxY))),t.extend(e(new n(this.maxX,this.maxY))),t}static fromPoints(e){let t=new qf;for(let n of e)t.extend(n);return t}contains(e){return e.x>=this.minX&&e.x<=this.maxX&&e.y>=this.minY&&e.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(e){return!this.empty()&&!e.empty()&&e.minX>=this.minX&&e.maxX<=this.maxX&&e.minY>=this.minY&&e.maxY<=this.maxY}intersects(e){return!this.empty()&&!e.empty()&&e.minX<=this.maxX&&e.maxX>=this.minX&&e.minY<=this.maxY&&e.maxY>=this.minY}}class Jf{constructor(e){this._stringToNumber={},this._numberToString=[];for(let t=0;t<e.length;t++){let n=e[t];this._stringToNumber[n]=t,this._numberToString[t]=n}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=this._numberToString.length)throw Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}}class Yf{constructor(e,t,n,r,i){this.type=`Feature`,this._vectorTileFeature=e,this._x=n,this._y=r,this._z=t,this.properties=e.properties,this.id=i}projectPoint(e,t,n,r){return[360*(e.x+t)/r-180,360/Math.PI*Math.atan(Math.exp((1-2*(e.y+n)/r)*Math.PI))-90]}projectLine(e,t,n,r){return e.map((e=>this.projectPoint(e,t,n,r)))}get geometry(){if(this._geometry)return this._geometry;let e=this._vectorTileFeature,t=e.extent*2**this._z,n=e.extent*this._x,r=e.extent*this._y,i=e.loadGeometry();switch(e.type){case 1:{let e=[];for(let t of i)e.push(t[0]);let a=this.projectLine(e,n,r,t);this._geometry=e.length===1?{type:`Point`,coordinates:a[0]}:{type:`MultiPoint`,coordinates:a};break}case 2:{let e=i.map((e=>this.projectLine(e,n,r,t)));this._geometry=e.length===1?{type:`LineString`,coordinates:e[0]}:{type:`MultiLineString`,coordinates:e};break}case 3:{let e=Il(i),a=[];for(let i of e)a.push(i.map((e=>this.projectLine(e,n,r,t))));this._geometry=a.length===1?{type:`Polygon`,coordinates:a[0]}:{type:`MultiPolygon`,coordinates:a};break}default:throw Error(`unknown feature type: ${e.type}`)}return this._geometry}set geometry(e){this._geometry=e}toJSON(){let e={geometry:this.geometry};for(let t in this)t!==`_geometry`&&t!==`_vectorTileFeature`&&t!==`_x`&&t!==`_y`&&t!==`_z`&&(e[t]=this[t]);return e}}class Xf{constructor(e,t,n){this._name=e,this.dataBuffer=t,typeof n==`
9number`?this._size=n:(this.nullabilityBuffer=n,this._size=n.size())}getValue(e){return this.nullabilityBuffer&&!this.nullabilityBuffer.get(e)?null:this.getValueFromBuffer(e)}has(e){return this.nullabilityBuffer?.get(e)||!this.nullabilityBuffer}get name(){return this._name}get size(){return this._size}}class Zf extends Xf{}class Qf extends Zf{getValueFromBuffer(e){return this.dataBuffer[e]}}class $f extends Zf{getValueFromBuffer(e){return this.dataBuffer[e]}}class ep extends Xf{constructor(e,t,n,r){super(e,t,r),this.delta=n}}class tp extends ep{constructor(e,t,n,r){super(e,Int32Array.of(t),n,r)}getValueFromBuffer(e){return this.dataBuffer[0]+e*this.delta}}class np extends Xf{constructor(e,t,n,r){super(e,r?Int32Array.of(t):Uint32Array.of(t),n)}getValueFromBuffer(e){return this.dataBuffer[0]}}class rp{constructor(e,t,n,r,i=4096){this._name=e,this._geometryVector=t,this._idVector=n,this._propertyVectors=r,this._extent=i}get name(){return this._name}get idVector(){return this._idVector}get geometryVector(){return this._geometryVector}get propertyVectors(){return this._propertyVectors}getPropertyVector(e){return this.propertyVectorsMap||=new Map(this._propertyVectors.map((e=>[e.name,e]))),this.propertyVectorsMap.get(e)}get numFeatures(){return this.geometryVector.numGeometries}get extent(){return this._extent}getFeatures(){let e=[],t=this.geometryVector.getGeometries();for(let n=0;n<this.numFeatures;n++){let r;if(this.idVector){let e=this.idVector.getValue(n);r=this.containsMaxSafeIntegerValues(this.idVector)&&e!==null?Number(e):e}let i={coordinates:t[n],type:this.geometryVector.geometryType(n)},a={};for(let e of this.propertyVectors){if(!e)continue;let t=e.name,r=e.getValue(n);r!==null&&(a[t]=r)}e.push({id:r,geometry:i,properties:a})}return e}containsMaxSafeIntegerValues(e){return e instanceof Qf||e instanceof np||e instanceof tp||e instanceof $f}}class ip{constructor(e){this.value=e}get(){return this.value}set(e){this.value=e}increment(){return this.value++}add(e){this.value+=e}}var ap,op;(function(e){e.NONE=`NONE`,e.DELTA=`DELTA`,e.COMPONENTWISE_DELTA=`COMPONENTWISE_DELTA`,e.RLE=`RLE`,e.MORTON=`MORTON`,e.PDE=`PDE`})(ap||={}),function(e){e.NONE=`NONE`,e.FAST_PFOR=`FAST_PFOR`,e.VARINT=`VARINT`,e.ALP=`ALP`}(op||={});let sp=new Uint32Array(33);sp[0]=0;for(let e=1;e<=32;e++)sp[e]=e===32?4294967295:4294967295>>>32-e;let cp=sp;function lp(e,t){return e-e%t}function up(e){let t=e>>>0;return((255&t)<<24|(65280&t)<<8|t>>>8&65280|t>>>24&255)>>>0}let dp=function(){let e=lp(65536,256);return e===0?256:e}(),fp=3*dp/256+dp|0;function pp(){let e=new Uint8Array(fp);return{dataToBePacked:Array(33),dataPointers:new Int32Array(33),byteContainer:e,byteContainerI32:new Int32Array(e.buffer,e.byteOffset,e.byteLength>>>2),exceptionSizes:new Int32Array(33)}}function mp(e,t,n,r,i){switch(i){case 1:(function(e,t,n,r){let i=r,a=t;for(let t=0;t<8;t++){let t=e[a++]>>>0;n[i++]=t>>>0&1,n[i++]=t>>>1&1,n[i++]=t>>>2&1,n[i++]=t>>>3&1,n[i++]=t>>>4&1,n[i++]=t>>>5&1,n[i++]=t>>>6&1,n[i++]=t>>>7&1,n[i++]=t>>>8&1,n[i++]=t>>>9&1,n[i++]=t>>>10&1,n[i++]=t>>>11&1,n[i++]=t>>>12&1,n[i++]=t>>>13&1,n[i++]=t>>>14&1,n[i++]=t>>>15&1,n[i++]=t>>>16&1,n[i++]=t>>>17&1,n[i++]=t>>>18&1,n[i++]=t>>>19&1,n[i++]=t>>>20&1,n[i++]=t>>>21&1,n[i++]=t>>>22&1,n[i++]=t>>>23&1,n[i++]=t>>>24&1,n[i++]=t>>>25&1,n[i++]=t>>>26&1,n[i++]=t>>>27&1,n[i++]=t>>>28&1,n[i++]=t>>>29&1,n[i++]=t>>>30&1,n[i++]=t>>>31&1}})(e,t,n,r);break;case 2:(function(e,t,n,r){let i=r,a=t;for(let t=0;t<8;t++){let t=e[a++]>>>0,r=e[a++]>>>0;n[i++]=t>>>0&3,n[i++]=t>>>2&3,n[i++]=t>>>4&3,n[i++]=t>>>6&3,n[i++]=t>>>8&3,n[i++]=t>>>10&3,n[i++]=t>>>12&3,n[i++]=t>>>14&3,n[i++]=t>>>16&3,n[i++]=t>>>18&3,n[i++]=t>>>20&3,n[i++]=t>>>22&3,n[i++]=t>>>24&3,n[i++]=t>>>26&3,n[i++]=t>>>28&3,n[i++]=t>>>30&3,n[i++]=r>>>0&3,n[i++]=r>>>2&3,n[i++]=r>>>4&3,n[i++]=r>>>6&3,n[i++]=r>>>8&3,n[i++]=r>>>10&3,n[i++]=r>>>12&3,n[i++]=r>>>14&3,n[i++]=r>>>16&3,n[i++]=r>>>18&3,n[i++]=r>>>20&3,n[i++]=r>>>22&3,n[i++]=r>>>24&3,n[i++]=r>>>26&3,n[i++]=r>>>28&3,n[i++]=r>>>30&3}})(e,t,n,r);break;case 3:(function(e,t,n,r){let i=r,a=t;for(let t=0;t<8;t++){let t=e[a++]>>>0,r=e[a++]>>>0,o=e[a++]>>>0;n[i++]=t>>>0&7,n[i++]=t>>>3&7,n[i++]=t>>>6&7,n[i++]=t>>>9&7,n[i++]=t>>>12&7,n[i++]=t>>>15&7,n[i++]=t>>>18&7,n[i++]=t>>>21&7,n[i++]=t>>>24&7,n[i++]=t>>>27&7,n[i++]=7&(t>>>30|(1&r)<<2),n[i++]=r>>>1&7,n[i++]=r>>>4&7,n[i++]=r>>>7&7,n[i++]=r>>>10&7,n[i++]=r>>>13&7,n[i++]=r>>>16&7,n[i++]=r>>>19&7,n[i++]=r>>>22&7,n[i++]=r>>>25&7,n[i++]=r>>>28&7,n[i++]=7&(r>>>31|(3&o)<<1),n[i++]=o>>>2&7,n[i++]=o>>>5&7,n[i++]=o>>>8&7,n[i++]=o>>>11&7,n[i++]=o>>>14&7,n[i++]=o>>>17&7,n[i++]=o>>>20&7,n[i++]=o>>>23&7,n[i++]=o>>>
vendor: 4,449 bytes, line 9
926&7,n[i++]=o>>>29&7}})(e,t,n,r);break;case 4:(function(e,t,n,r){let i=r,a=t;for(let t=0;t<8;t++){let t=e[a++]>>>0,r=e[a++]>>>0,o=e[a++]>>>0,s=e[a++]>>>0;n[i++]=t>>>0&15,n[i++]=t>>>4&15,n[i++]=t>>>8&15,n[i++]=t>>>12&15,n[i++]=t>>>16&15,n[i++]=t>>>20&15,n[i++]=t>>>24&15,n[i++]=t>>>28&15,n[i++]=r>>>0&15,n[i++]=r>>>4&15,n[i++]=r>>>8&15,n[i++]=r>>>12&15,n[i++]=r>>>16&15,n[i++]=r>>>20&15,n[i++]=r>>>24&15,n[i++]=r>>>28&15,n[i++]=o>>>0&15,n[i++]=o>>>4&15,n[i++]=o>>>8&15,n[i++]=o>>>12&15,n[i++]=o>>>16&15,n[i++]=o>>>20&15,n[i++]=o>>>24&15,n[i++]=o>>>28&15,n[i++]=s>>>0&15,n[i++]=s>>>4&15,n[i++]=s>>>8&15,n[i++]=s>>>12&15,n[i++]=s>>>16&15,n[i++]=s>>>20&15,n[i++]=s>>>24&15,n[i++]=s>>>28&15}})(e,t,n,r);break;case 5:(function(e,t,n,r){let i=r,a=t;for(let t=0;t<8;t++){let t=e[a++]>>>0,r=e[a++]>>>0,o=e[a++]>>>0,s=e[a++]>>>0,c=e[a++]>>>0;n[i++]=t>>>0&31,n[i++]=t>>>5&31,n[i++]=t>>>10&31,n[i++]=t>>>15&31,n[i++]=t>>>20&31,n[i++]=t>>>25&31,n[i++]=31&(t>>>30|(7&r)<<2),n[i++]=r>>>3&31,n[i++]=r>>>8&31,n[i++]=r>>>13&31,n[i++]=r>>>18&31,n[i++]=r>>>23&31,n[i++]=31&(r>>>28|(1&o)<<4),n[i++]=o>>>1&31,n[i++]=o>>>6&31,n[i++]=o>>>11&31,n[i++]=o>>>16&31,n[i++]=o>>>21&31,n[i++]=o>>>26&31,n[i++]=31&(o>>>31|(15&s)<<1),n[i++]=s>>>4&31,n[i++]=s>>>9&31,n[i++]=s>>>14&31,n[i++]=s>>>19&31,n[i++]=s>>>24&31,n[i++]=31&(s>>>29|(3&c)<<3),n[i++]=c>>>2&31,n[i++]=c>>>7&31,n[i++]=c>>>12&31,n[i++]=c>>>17&31,n[i++]=c>>>22&31,n[i++]=c>>>27&31}})(e,t,n,r);break;case 6:(function(e,t,n,r){let i=r,a=t;for(let t=0;t<8;t++){let t=e[a++]>>>0,r=e[a++]>>>0,o=e[a++]>>>0,s=e[a++]>>>0,c=e[a++]>>>0,l=e[a++]>>>0;n[i++]=t>>>0&63,n[i++]=t>>>6&63,n[i++]=t>>>12&63,n[i++]=t>>>18&63,n[i++]=t>>>24&63,n[i++]=63&(t>>>30|(15&r)<<2),n[i++]=r>>>4&63,n[i++]=r>>>10&63,n[i++]=r>>>16&63,n[i++]=r>>>22&63,n[i++]=63&(r>>>28|(3&o)<<4),n[i++]=o>>>2&63,n[i++]=o>>>8&63,n[i++]=o>>>14&63,n[i++]=o>>>20&63,n[i++]=o>>>26&63,n[i++]=s>>>0&63,n[i++]=s>>>6&63,n[i++]=s>>>12&63,n[i++]=s>>>18&63,n[i++]=s>>>24&63,n[i++]=63&(s>>>30|(15&c)<<2),n[i++]=c>>>4&63,n[i++]=c>>>10&63,n[i++]=c>>>16&63,n[i++]=c>>>22&63,n[i++]=63&(c>>>28|(3&l)<<4),n[i++]=l>>>2&63,n[i++]=l>>>8&63,n[i++]=l>>>14&63,n[i++]=l>>>20&63,n[i++]=l>>>26&63}})(e,t,n,r);break;case 7:(function(e,t,n,r){let i=r,a=t;for(let t=0;t<8;t++){let t=e[a++]>>>0,r=e[a++]>>>0,o=e[a++]>>>0,s=e[a++]>>>0,c=e[a++]>>>0,l=e[a++]>>>0,u=e[a++]>>>0;n[i++]=t>>>0&127,n[i++]=t>>>7&127,n[i++]=t>>>14&127,n[i++]=t>>>21&127,n[i++]=127&(t>>>28|(7&r)<<4),n[i++]=r>>>3&127,n[i++]=r>>>10&127,n[i++]=r>>>17&127,n[i++]=r>>>24&127,n[i++]=127&(r>>>31|(63&o)<<1),n[i++]=o>>>6&127,n[i++]=o>>>13&127,n[i++]=o>>>20&127,n[i++]=127&(o>>>27|(3&s)<<5),n[i++]=s>>>2&127,n[i++]=s>>>9&127,n[i++]=s>>>16&127,n[i++]=s>>>23&127,n[i++]=127&(s>>>30|(31&c)<<2),n[i++]=c>>>5&127,n[i++]=c>>>12&127,n[i++]=c>>>19&127,n[i++]=127&(c>>>26|(1&l)<<6),n[i++]=l>>>1&127,n[i++]=l>>>8&127,n[i++]=l>>>15&127,n[i++]=l>>>22&127,n[i++]=127&(l>>>29|(15&u)<<3),n[i++]=u>>>4&127,n[i++]=u>>>11&127,n[i++]=u>>>18&127,n[i++]=u>>>25&127}})(e,t,n,r);break;case 8:(function(e,t,n,r){let i=r,a=t;for(let t=0;t<8;t++){let t=e[a++]>>>0,r=e[a++]>>>0,o=e[a++]>>>0,s=e[a++]>>>0,c=e[a++]>>>0,l=e[a++]>>>0,u=e[a++]>>>0,d=e[a++]>>>0;n[i++]=t>>>0&255,n[i++]=t>>>8&255,n[i++]=t>>>16&255,n[i++]=t>>>24&255,n[i++]=r>>>0&255,n[i++]=r>>>8&255,n[i++]=r>>>16&255,n[i++]=r>>>24&255,n[i++]=o>>>0&255,n[i++]=o>>>8&255,n[i++]=o>>>16&255,n[i++]=o>>>24&255,n[i++]=s>>>0&255,n[i++]=s>>>8&255,n[i++]=s>>>16&255,n[i++]=s>>>24&255,n[i++]=c>>>0&255,n[i++]=c>>>8&255,n[i++]=c>>>16&255,n[i++]=c>>>24&255,n[i++]=l>>>0&255,n[i++]=l>>>8&255,n[i++]=l>>>16&255,n[i++]=l>>>24&255,n[i++]=u>>>0&255,n[i++]=u>>>8&255,n[i++]=u>>>16&255,n[i++]=u>>>24&255,n[i++]=d>>>0&255,n[i++]=d>>>8&255,n[i++]=d>>>16&255,n[i++]=d>>>24&255}})(e,t,n,r);break;case 16:(function(e,t,n,r){let i=r,a=t;for(let t=0;t<128;t++){let t=e[a++]>>>0;n[i++]=65535&t,n[i++]=t>>>16&65535}})(e,t,n,r);break;default:(function(e,t,n,r,i){let a=cp[i]>>>0,o=t,s=0,c=e[o]>>>0,l=r;for(let t=0;t<8;t++){for(let t=0;t<32;t++)if(s+i<=32)n[l+t]=c>>>s&a,s+=i,s===32&&(s=0,o++,t!==31&&(c=e[o]>>>0));else{let r=32-s,u=c>>>s;o++,c=e[o]>>>0;let d=i-r;n[l+t]=(u|(c&-1>>>32-d>>>0)<<r)&a,s=d}l+=32,s=0,t<7&&(c=e[o]>>>0)}})(e,t,n,r,i)}return t+(i<<3)|0}function hp(e,t,n,r){if(n+2>t)throw Error(`FastPFOR decode: byteContainer underflow at block=${r} (need 2 bytes for [bitWidth, exceptionCount], bytePos=${n}, byteSize=${t})`);let i=e[n++],a=e[n++];if(i>32)throw Error(`FastPFOR decode: invalid bitWidth=${i} at block=${r}
9 (expected 0..32). This likely indicates corrupted or truncated input.`);return{bitWidth:i,exceptionCount:a,bytePosIn:n}}function gp(e,t,n,r,i,a,o,s,c){let{maxBits:l,exceptionBitWidth:u,bytePosIn:d}=function(e,t,n,r,i,a){if(n+1>t)throw Error(`FastPFOR decode: exception header underflow at block=${a} (need 1 byte for maxBits, bytePos=${n}, byteSize=${t})`);let o=e[n++];if(o<r||o>32)throw Error(`FastPFOR decode: invalid maxBits=${o} at block=${a} (bitWidth=${r}, expected ${r}..32)`);let s=o-r|0;if(s<1||s>32)throw Error(`FastPFOR decode: invalid exceptionBitWidth=${s} at block=${a} (bitWidth=${r}, maxBits=${o})`);if(n+i>t)throw Error(`FastPFOR decode: exception positions underflow at block=${a} (need=${i}, have=${t-n})`);return{maxBits:o,exceptionBitWidth:s,bytePosIn:n}}(i,a,o,n,r,c);if(o=d,u===1){let a=1<<n;for(let n=0;n<r;n=n+1|0)e[i[o++]+t|0]|=a;return o}let f=s.dataToBePacked[u];if(!f)throw Error(`FastPFOR decode: missing exception stream for exceptionBitWidth=${u} (bitWidth=${n}, maxBits=${l}) at block ${c}`);let p=s.dataPointers,m=0|p[u],h=0|s.exceptionSizes[u];if(m+r>h)throw Error(`FastPFOR decode: exception stream overflow for exceptionBitWidth=${u} (ptr=${m}, need ${r}, size=${h}) at block ${c}`);for(let a=0;a<r;a=a+1|0){let r=i[o++],a=0|f[m++];e[r+t|0]|=a<<n}return p[u]=m,o}function _p(e,t,n,r,i,a){let o=0|n,s=0|e[o];if(s<=0||o+s>e.length-1)throw Error(`FastPFOR decode: invalid whereMeta=${s} at pageStart=${o} (expected > 0 and pageStart+whereMeta < encoded.length=${e.length})`);let c=o+1|0,l=o+s|0,u=e[l]>>>0,d=u+3>>>2,f=l+1,p=f+d;if(p>=e.length)throw Error(`FastPFOR decode: invalid byteSize=${u} (metaInts=${d}, pageStart=${o}, packedEnd=${l}, byteContainerStart=${f}) causes bitmapPos=${p} out of bounds (encoded.length=${e.length})`);let m=function(e,t,n,r){r.byteContainer.length<n&&(r.byteContainer=new Uint8Array(2*n),r.byteContainerI32=void 0);let i=r.byteContainer,a=n>>>2;if(3&i.byteOffset)for(let n=0;n<a;n=n+1|0){let r=0|e[t+n|0],a=n<<2;i[a]=255&r,i[a+1|0]=r>>>8&255,i[a+2|0]=r>>>16&255,i[a+3|0]=r>>>24&255}else{let n=r.byteContainerI32;(!n||n.buffer!==i.buffer||n.byteOffset!==i.byteOffset||n.length<a)&&(n=r.byteContainerI32=new Int32Array(i.buffer,i.byteOffset,i.byteLength>>>2)),n.set(e.subarray(t,t+a))}let o=3&n;if(o>0){let n=0|e[t+a|0],r=a<<2;for(let e=0;e<o;e=e+1|0)i[r+e|0]=n>>>(e<<3)&255}return i}(e,f,u,a),h=u,g=function(e,t,n){let r=0|e[t++],i=n.dataToBePacked;for(let a=2;a<=32;a=a+1|0){if(!(r>>>a-1&1))continue;if(t>=e.length)throw Error(`FastPFOR decode: truncated exception stream header (bitWidth=${a}, streamWordIndex=${t}, needWords=1, availableWords=${e.length-t}, encodedWords=${e.length})`);let o=e[t++]>>>0,s=lp(o+31,32),c=o*a+31>>>5;if(t+c>e.length)throw Error(`FastPFOR decode: truncated exception stream (bitWidth=${a}, size=${o}, streamWordIndex=${t}, needWords=${c}, availableWords=${e.length-t}, encodedWords=${e.length})`);let l=i[a];(!l||l.length<s)&&(l=i[a]=new Uint32Array(s));let u=0;for(;u<o;u=u+32|0)vp(e,t,l,u,a),t=t+a|0;t=t-((u-o|0)*a>>>5)|0,n.exceptionSizes[a]=o}return t}(e,p,a);return a.dataPointers.fill(0),function(e,t,n,r,i,a,o,s,c,l){let u=0|n,d=0;for(let t=0;t<o;t=t+1|0){let n=hp(s,c,d,t);d=n.bytePosIn;let r=n.bitWidth,o=n.exceptionCount,f=a+t*256|0;switch(r){case 0:i.fill(0,f,f+256);break;case 32:for(let t=0;t<256;t=t+1|0)i[f+t|0]=0|e[u+t|0];u=u+256|0;break;default:u=mp(e,u,i,f,r)}o>0&&(d=gp(i,f,r,o,s,c,d,l,t))}if(u!==r)throw Error(`FastPFOR decode: packed region mismatch (pageStart=${t}, packedStart=${n}, consumedPackedEnd=${u}, expectedPackedEnd=${r}, packedWords=${r-n}, encoded.length=${e.length})`)}(e,o,c,l,t,0|r,i/256|0,m,h,a),g}function v
vendor: 9,195 bytes, line 9
9p(e,t,n,r,i){switch(i){case 2:(function(e,t,n,r){let i=r,a=e[t]>>>0,o=e[t+1]>>>0;n[i++]=a>>>0&3,n[i++]=a>>>2&3,n[i++]=a>>>4&3,n[i++]=a>>>6&3,n[i++]=a>>>8&3,n[i++]=a>>>10&3,n[i++]=a>>>12&3,n[i++]=a>>>14&3,n[i++]=a>>>16&3,n[i++]=a>>>18&3,n[i++]=a>>>20&3,n[i++]=a>>>22&3,n[i++]=a>>>24&3,n[i++]=a>>>26&3,n[i++]=a>>>28&3,n[i++]=a>>>30&3,n[i++]=o>>>0&3,n[i++]=o>>>2&3,n[i++]=o>>>4&3,n[i++]=o>>>6&3,n[i++]=o>>>8&3,n[i++]=o>>>10&3,n[i++]=o>>>12&3,n[i++]=o>>>14&3,n[i++]=o>>>16&3,n[i++]=o>>>18&3,n[i++]=o>>>20&3,n[i++]=o>>>22&3,n[i++]=o>>>24&3,n[i++]=o>>>26&3,n[i++]=o>>>28&3,n[i]=o>>>30&3})(e,t,n,r);return;case 3:(function(e,t,n,r){let i=r,a=e[t]>>>0,o=e[t+1]>>>0,s=e[t+2]>>>0;n[i++]=a>>>0&7,n[i++]=a>>>3&7,n[i++]=a>>>6&7,n[i++]=a>>>9&7,n[i++]=a>>>12&7,n[i++]=a>>>15&7,n[i++]=a>>>18&7,n[i++]=a>>>21&7,n[i++]=a>>>24&7,n[i++]=a>>>27&7,n[i++]=7&(a>>>30|(1&o)<<2),n[i++]=o>>>1&7,n[i++]=o>>>4&7,n[i++]=o>>>7&7,n[i++]=o>>>10&7,n[i++]=o>>>13&7,n[i++]=o>>>16&7,n[i++]=o>>>19&7,n[i++]=o>>>22&7,n[i++]=o>>>25&7,n[i++]=o>>>28&7,n[i++]=7&(o>>>31|(3&s)<<1),n[i++]=s>>>2&7,n[i++]=s>>>5&7,n[i++]=s>>>8&7,n[i++]=s>>>11&7,n[i++]=s>>>14&7,n[i++]=s>>>17&7,n[i++]=s>>>20&7,n[i++]=s>>>23&7,n[i++]=s>>>26&7,n[i]=s>>>29&7})(e,t,n,r);return;case 4:(function(e,t,n,r){let i=r,a=e[t]>>>0,o=e[t+1]>>>0,s=e[t+2]>>>0,c=e[t+3]>>>0;n[i++]=a>>>0&15,n[i++]=a>>>4&15,n[i++]=a>>>8&15,n[i++]=a>>>12&15,n[i++]=a>>>16&15,n[i++]=a>>>20&15,n[i++]=a>>>24&15,n[i++]=a>>>28&15,n[i++]=o>>>0&15,n[i++]=o>>>4&15,n[i++]=o>>>8&15,n[i++]=o>>>12&15,n[i++]=o>>>16&15,n[i++]=o>>>20&15,n[i++]=o>>>24&15,n[i++]=o>>>28&15,n[i++]=s>>>0&15,n[i++]=s>>>4&15,n[i++]=s>>>8&15,n[i++]=s>>>12&15,n[i++]=s>>>16&15,n[i++]=s>>>20&15,n[i++]=s>>>24&15,n[i++]=s>>>28&15,n[i++]=c>>>0&15,n[i++]=c>>>4&15,n[i++]=c>>>8&15,n[i++]=c>>>12&15,n[i++]=c>>>16&15,n[i++]=c>>>20&15,n[i++]=c>>>24&15,n[i]=c>>>28&15})(e,t,n,r);return;case 5:(function(e,t,n,r){let i=r,a=e[t]>>>0,o=e[t+1]>>>0,s=e[t+2]>>>0,c=e[t+3]>>>0,l=e[t+4]>>>0;n[i++]=a>>>0&31,n[i++]=a>>>5&31,n[i++]=a>>>10&31,n[i++]=a>>>15&31,n[i++]=a>>>20&31,n[i++]=a>>>25&31,n[i++]=31&(a>>>30|(7&o)<<2),n[i++]=o>>>3&31,n[i++]=o>>>8&31,n[i++]=o>>>13&31,n[i++]=o>>>18&31,n[i++]=o>>>23&31,n[i++]=31&(o>>>28|(1&s)<<4),n[i++]=s>>>1&31,n[i++]=s>>>6&31,n[i++]=s>>>11&31,n[i++]=s>>>16&31,n[i++]=s>>>21&31,n[i++]=s>>>26&31,n[i++]=31&(s>>>31|(15&c)<<1),n[i++]=c>>>4&31,n[i++]=c>>>9&31,n[i++]=c>>>14&31,n[i++]=c>>>19&31,n[i++]=c>>>24&31,n[i++]=31&(c>>>29|(3&l)<<3),n[i++]=l>>>2&31,n[i++]=l>>>7&31,n[i++]=l>>>12&31,n[i++]=l>>>17&31,n[i++]=l>>>22&31,n[i]=l>>>27&31})(e,t,n,r);return;case 6:(function(e,t,n,r){let i=r,a=e[t]>>>0,o=e[t+1]>>>0,s=e[t+2]>>>0,c=e[t+3]>>>0,l=e[t+4]>>>0,u=e[t+5]>>>0;n[i++]=a>>>0&63,n[i++]=a>>>6&63,n[i++]=a>>>12&63,n[i++]=a>>>18&63,n[i++]=a>>>24&63,n[i++]=63&(a>>>30|(15&o)<<2),n[i++]=o>>>4&63,n[i++]=o>>>10&63,n[i++]=o>>>16&63,n[i++]=o>>>22&63,n[i++]=63&(o>>>28|(3&s)<<4),n[i++]=s>>>2&63,n[i++]=s>>>8&63,n[i++]=s>>>14&63,n[i++]=s>>>20&63,n[i++]=s>>>26&63,n[i++]=c>>>0&63,n[i++]=c>>>6&63,n[i++]=c>>>12&63,n[i++]=c>>>18&63,n[i++]=c>>>24&63,n[i++]=63&(c>>>30|(15&l)<<2),n[i++]=l>>>4&63,n[i++]=l>>>10&63,n[i++]=l>>>16&63,n[i++]=l>>>22&63,n[i++]=63&(l>>>28|(3&u)<<4),n[i++]=u>>>2&63,n[i++]=u>>>8&63,n[i++]=u>>>14&63,n[i++]=u>>>20&63,n[i]=u>>>26&63})(e,t,n,r);return;case 7:(function(e,t,n,r){let i=r,a=e[t]>>>0,o=e[t+1]>>>0,s=e[t+2]>>>0,c=e[t+3]>>>0,l=e[t+4]>>>0,u=e[t+5]>>>0,d=e[t+6]>>>0;n[i++]=a>>>0&127,n[i++]=a>>>7&127,n[i++]=a>>>14&127,n[i++]=a>>>21&127,n[i++]=127&(a>>>28|(7&o)<<4),n[i++]=o>>>3&127,n[i++]=o>>>10&127,n[i++]=o>>>17&127,n[i++]=o>>>24&127,n[i++]=127&(o>>>31|(63&s)<<1),n[i++]=s>>>6&127,n[i++]=s>>>13&127,n[i++]=s>>>20&127,n[i++]=127&(s>>>27|(3&c)<<5),n[i++]=c>>>2&127,n[i++]=c>>>9&127,n[i++]=c>>>16&127,n[i++]=c>>>23&127,n[i++]=127&(c>>>30|(31&l)<<2),n[i++]=l>>>5&127,n[i++]=l>>>12&127,n[i++]=l>>>19&127,n[i++]=127&(l>>>26|(1&u)<<6),n[i++]=u>>>1&127,n[i++]=u>>>8&127,n[i++]=u>>>15&127,n[i++]=u>>>22&127,n[i++]=127&(u>>>29|(15&d)<<3),n[i++]=d>>>4&127,n[i++]=d>>>11&127,n[i++]=d>>>18&127,n[i]=d>>>25&127})(e,t,n,r);return;case 8:(function(e,t,n,r){let i=r,a=e[t]>>>0,o=e[t+1]>>>0,s=e[t+2]>>>0,c=e[t+3]>>>0,l=e[t+4]>>>0,u=e[t+5]>>>0,d=e[t+6]>>>0,f=e[t+7]>>>0;n[i++]=a>>>0&255,n[i++]=a>>>8&255,n[i++]=a>>>16&255,n[i++]=a>>>24&255,n[i++]=o>>>0&255,n[i++]=o>>>8&255,n[i++]=o>>>16&255,n[i++]=o>>>24&255,n[i++]=s>>>0&255,n[i++]=s>>>8&255,n[i++]=s>>>16&255,n[i++]=s>>>24&255,n[i++]=c>>>0&255,n[i++]=c>>>8&255,n[i++]=c>>>16&255,n[i++]=c>>>24&255,n[i++]=l>>>0&255,n[i++]=l>>>8&255,n[i++]=l>>>16&255,n[i++]=l>>>24&255,n[i++]=u>>>0&255,n[i++]=u>>>8&255,n[i++]=u>>>16&255,n[i++]=u>>>24&255,n[i++]=d>>>0&255,n[i++]=d>>>8&255,n[i++]=d>>>16&255,n[i++]=d>>>24&255,n[i++]=f>>>0&255,n[i++]=f>>>8&255,n[i++]=f>>>16&255,n[i]=f>>>24&255})(e,t,n,r);return;case 9:(function(e,t,n,r){let i=r,a=e[t]>>>0,o=e[t+1]>>>0,s=e[t+2]>>>0,c=e[t+3]>>>0,l=e[t+4]>>>0,u=e[t+5]>>>0,d=e[t+6]>>>0,f=e[t+7]>>>0,p=e[t+8]>>>0;n[i++]=a>>>0&511,n[i++]=a>>>9&511,n[i++]=a>>>18&511,n[i++]=511&(a>>>27|(15&o)<<5),n[i++]=o>>>4&511,n[i++]=o>>>13&511,n[i++]=o>>>22&511,n[i++]=511&(o>>>31|(255&s)<<1),n[i++]=s>>>8&511,n[i++]=s>>>17&511,n[i++]=511&(s>>>26|(7&c)<<6),n[i++]=c>>>3&511,n[i++]=c>>>12&511,n[i++]=c>>>21&511,n[i++]=511&(c>>>30|(127&l)<<2),n[i++]=l>>>7&511,n[i++]=l>>>16&511,n[i++]=511&(l>>>25|(3&u)<<7),n[i++]=u>>>2&511,n[i++]=u>>>11&511,n[i++]=u>>>20&511,n[i++]=511&(u>>>29|(63&d)<<3),n[i++]=d>>>6&511,n[i++]=d>>>15&511,n[i++]=511&(d>>>24|(1&f)<<8),n[i++]=f>>>1&511,n[i++]=f>>>10&511,n[i++]=f>>>19&511,n[i++]=511&(f>>>28|(31&p)<<4),n[i++]=p>>>5&511,n[i++]=p>>>14&511,n[i]=p>>>23&511})(e,t,n,r);return;case 10:(function(e,t,n,r){let i=r,a=e[t]>>>0,o=e[t+1]>>>0,s=e[t+2]>>>0,c=e[t+3]>>>0,l=e[t+4]>>>0,u=e[t+5]>>>0,d=e[t+6]>>>0,f=e[t+7]>>>0,p=e[t+8]>>>0,m=e[t+9]>>>0;n[i++]=a>>>0&1023,n[i++]=a>>>10&1023,n[i++]=a>>>20&1023,n[i++]=1023&(a>>>30|(255&o)<<2),n[i++]=o>>>8&1023,n[i++]=o>>>18&1023,n[i++]=1023&(o>>>28|(63&s)<<4),n[i++]=s>>>6&1023,n[i++]=s>>>16&1023,n[i++]=1023&(s>>>26|(15&c)<<6),n[i++]=c>>>4&1023,n[i++]=c>>>14&1023,n[i++]=1023&(c>>>24|(3&l)<<8),n[i++]=l>>>2&1023,n[i++]=l>>>12&1023,n[i++]=l>>>22&1023,n[i++]=u>>>0&1023,n[i++]=u>>>10&1023,n[i++]=u>>>20&1023,n[i++]=1023&(u>>>30|(255&d)<<2),n[i++]=d>>>8&1023,n[i++]=d>>>18&1023,n[i++]=1023&(d>>>28|(63&f)<<4),n[i++]=f>>>6&1023,n[i++]=f>>>16&1023,n[i++]=1023&(f>>>26|(15&p)<<6),n[i++]=p>>>4&1023,n[i++]=p>>>14&1023,n[i++]=1023&(p>>>24|(3&m)<<8),n[i++]=m>>>2&1023,n[i++]=m>>>12&1023,n[i]=m>>>22&1023})(e,t,n,r);return;case 11:(function(e,t,n,r){let i=r,a=e[t]>>>0,o=e[t+1]>>>0,s=e[t+2]>>>0,c=e[t+3]>>>0,l=e[t+4]>>>0,u=e[t+5]>>>0,d=e[t+6]>>>0,f=e[t+7]>>>0,p=e[t+8]>>>0,m=e[t+9]>>>0,h=e[t+10]>>>0;n[i++]=a>>>0&2047,n[i++]=a>>>11&2047,n[i++]=2047&(a>>>22|(1&o)<<10),n[i++]=o>>>1&2047,n[i++]=o>>>12&2047,n[i++]=2047&(o>>>23|(3&s)<<9),n[i++]=s>>>2&2047,n[i++]=s>>>13&2047,n[i++]=2047&(s>>>24|(7&c)<<8),n[i++]=c>>>3&2047,n[i++]=c>>>14&2047,n[i++]=2047&(c>>>25|(15&l)<<7),n[i++]=l>>>4&2047,n[i++]=l>>>15&2047,n[i++]=2047&(l>>>26|(31&u)<<6),n[i++]=u>>>5&2047,n[i++]=u>>>16&2047,n[i++]=2047&(u>>>27|(63&d)<<5),n[i++]=d>>>6&2047,n[i++]=d>>>17&2047,n[i++]=2047&(d>>>28|(127&f)<<4),n[i++]=f>>>7&2047,n[i++]=f>>>18&2047,n[i++]=2047&(f>>>29|(255&p)<<3),n[i++]=p>>>8&2047,n[i++]=p>>>19&2047,n[i++]=2047&(p>>>30|(511&m)<<2),n[i++]=m>>>9&2047,n[i++]=m>>>20&2047,n[i++]=2047&(m>>>31|(1023&h)<<1),n[i++]=h>>>10&2047,n[i]=h>>>21&2047})(e,t,n,r);return;case 12:(function(e,t,n,r){let i=r,a=e[t]>>>0,o=e[t+1]>>>0,s=e[t+2]>>>0,c=e[t+3]>>>0,l=e[t+4]>>>0,u=e[t+5]>>>0,d=e[t+6]>>>0,f=e[t+7]>>>0,p=e[t+8]>>>0,m=e[t+9]>>>0,h=e[t+10]>>>0,g=e[t+11]>>>0;n[i++]=a>>>0&4095,n[i++]=a>>>12&4095,n[i++]=4095&(a>>>24|(15&o)<<8),n[i++]=o>>>4&4095,n[i++]=o>>>16&4095,n[i++]=4095&(o>>>28|(255&s)<<4),n[i++]=s>>>8&4095,n[i++]=s>>>20&4095,n[i++]=c>>>0&4095,n[i++]=c>>>12&4095,n[i++]=4095&(c>>>24|(15&l)<<8),n[i++]=l>>>4&4095,n[i++]=l>>>16&4095,n[i++]=4095&(l>>>28|(255&u)<<4),n[i++]=u>>>8&4095,n[i++]=u>>>20&4095,n[i++]=d>>>0&4095,n[i++]=d>>>12&4095,n[i++]=4095&(d>>>24|(15&f)<<8),n[i++]=f>>>4&4095,n[i++]=f>>>16&4095,n[i++]=4095&(f>>>28|(255&p)<<4),n[i++]=p>>>8&4095,n[i++]=p>>>20&4095,n[i++]=m>>>0&4095,n[i++]=m>>>12&4095,n[i++]=4095&(m>>>24|(15&h)<<8),n[i++]=h>>>4&4095,n[i++]=h>>>16&4095,n[i++]=4095&(h>>>28|(255&g)<<4),n[i++]=g>>>8&4095,n[i]=g>>>20&4095})(e,t,n,r);return;case 16:(function(e,t,n,r){let i=r,a=e[t]>>>0,o=e[t+1]>>>0,s=e[t+2]>>>0,c=e[t+3]>>>0,l=e[t+4]>>>0,u=e[t+5]>>>0,d=e[t+6]>>>0,f=e[t+7]>>>0,p=e[t+8]>>>0,m=e[t+9]>>>0,h=e[t+10]>>>0,g=e[t+11]>>>0,_=e[t+12]>>>0,v=e[t+13]>>>0,y=e[t+14]>>>0,b=e[t+15]>>>0;n[i++]=a>>>0&65535,n[i++]=a>>>16&65535,n[i++]=o>>>0&65535,n[i++]=o>>>16&65535,n[i++]=s>>>0&65535,n[i++]=s>>>16&65535,n[i++]=c>>>0&65535,n[i++]=c>>>16&65535,n[i++]=l>>>0&65535,n[i++]=l>>>16&65535,n[i++]=u>>>0&65535,n[i++]=u>>>16&65535,n[i++]=d>>>0&65535,n[i++]=d>>>16&65535,n[i++]=f>>>0&65535,n[i++]=f>>>16&65535,n[i++]=p>>>0&65535,n[i++]=p>>>16&65535,n[i++]=m>>>0&65535,n[i++]=m>>>16&65535,n[i++]=h>>>0&65535,n[i++]=h>>>16&65535,n[i++]=g>>>0&65535,n[i++]=g>>>16&65535,n[i++]=_>>>0&65535,n[i++]=_>>>16&65535,n[i++]=v>>>0&65535,n[i++]=v>>>16&65535,n[i++]=y>>>0&65535,n[i++]=y>>>16&65535,n[i++]=b>>>0&65535,n[i]=b>>>16&65535})(e,t,n,r);return;case 32:for(let i=0;i<32;i=i+1|0)n[r+i|0]=0|e[t+i|0];return}let a=
vendor: 91,655 bytes, line 9
9cp[i]>>>0,o=t,s=0,c=e[o]>>>0;for(let t=0;t<32;t++)if(s+i<=32)n[r+t]=c>>>s&a,s+=i,s===32&&(s=0,o++,t!==31&&(c=e[o]>>>0));else{let l=32-s,u=c>>>s;o++,c=e[o]>>>0,n[r+t]=(u|(c&cp[i-l]>>>0)<<l)&a,s=i-l}}function yp(e,t,n){let r=new Uint32Array(n),i=0,a=t.get();for(let t=0;t<r.length;t++){let t=e[a++],n=127&t;t<128||(t=e[a++],n|=(127&t)<<7,t<128||(t=e[a++],n|=(127&t)<<14,t<128||(t=e[a++],n|=(127&t)<<21,t<128||(t=e[a++],n|=(15&t)<<28)))),r[i++]=n}return t.set(a),r}function bp(e,t,n){let r=new BigUint64Array(n);for(let n=0;n<r.length;n++)r[n]=xp(e,t);return r}function xp(e,t){let n=0n,r=0,i=t.get();for(;i<e.length;){let t=e[i++];if(n|=BigInt(127&t)<<BigInt(r),!(128&t))break;if(r+=7,r>=64)throw Error(`Varint too long`)}return t.set(i),n}function Sp(e,t){let n,r;return r=e[t.get()],t.increment(),n=127&r,r<128?n:(r=e[t.get()],t.increment(),n|=(127&r)<<7,r<128?n:(r=e[t.get()],t.increment(),n|=(127&r)<<14,r<128?n:(r=e[t.get()],t.increment(),n|=(127&r)<<21,r<128?n:(r=e[t.get()],n|=(15&r)<<28,function(e,t,n){let r,i;if(i=t[n.get()],n.increment(),r=(112&i)>>4,i<128||(i=t[n.get()],n.increment(),r|=(127&i)<<3,i<128)||(i=t[n.get()],n.increment(),r|=(127&i)<<10,i<128)||(i=t[n.get()],n.increment(),r|=(127&i)<<17,i<128)||(i=t[n.get()],n.increment(),r|=(127&i)<<24,i<128)||(i=t[n.get()],n.increment(),r|=(1&i)<<31,i<128))return 4294967296*r+(e>>>0);throw Error(`Expected varint not more than 10 bytes`)}(n,e,t)))))}function Cp(e){return e>>>1^-(1&e)}function wp(e){return e>>1n^-(1n&e)}function Tp(e){return e%2==1?(e+1)/-2:e/2}function Ep(e,t,n){if(n===void 0){n=0;for(let r=0;r<t;r++)n+=e[r]}let r=new Uint32Array(n),i=0;for(let n=0;n<t;n++){let a=e[n];r.fill(e[n+t],i,i+a),i+=a}return r}function Dp(e,t,n){if(n===void 0){n=0;for(let r=0;r<t;r++)n+=Number(e[r])}let r=new BigUint64Array(n),i=0;for(let n=0;n<t;n++){let a=Number(e[n]);r.fill(e[n+t],i,i+a),i+=a}return r}function Op(e,t,n){let r=new Float64Array(n),i=0;for(let n=0;n<t;n++){let a=e[n];r.fill(e[n+t],i,i+a),i+=a}return r}function kp(e){let t=new Int32Array(e.length);t[0]=Cp(e[0]);let n=e.length/4*4,r=1;if(n>=4)for(;r<n-4;r+=4){let n=e[r+1],i=e[r+2],a=e[r+3];t[r]=Cp(e[r])+t[r-1],t[r+1]=Cp(n)+t[r],t[r+2]=Cp(i)+t[r+1],t[r+3]=Cp(a)+t[r+2]}for(;r!==e.length;++r)t[r]=Cp(e[r])+t[r-1];return t}function Ap(e){let t=new BigInt64Array(e.length);t[0]=wp(e[0]);let n=e.length/4*4,r=1;if(n>=4)for(;r<n-4;r+=4){let n=e[r+1],i=e[r+2],a=e[r+3];t[r]=wp(e[r])+t[r-1],t[r+1]=wp(n)+t[r],t[r+2]=wp(i)+t[r+1],t[r+3]=wp(a)+t[r+2]}for(;r!==t.length;++r)t[r]=wp(e[r])+t[r-1];return t}function jp(e){let t=e.length/4*4,n=1;if(t>=4)for(let r=e[0];n<t-4;n+=4)r=e[n]+=r,r=e[n+1]+=r,r=e[n+2]+=r,r=e[n+3]+=r;for(;n!==e.length;)e[n]+=e[n-1],++n}var Mp,Np,Pp,Fp,Ip,Lp,Rp,zp;function Bp(e,t){let n=function(e,t){let n=e[t.get()],r=Object.values(Mp)[n>>4],i=null;switch(r){case Mp.DATA:i={dictionaryType:Object.values(Np)[15&n]};break;case Mp.OFFSET:i={offsetType:Object.values(Pp)[15&n]};break;case Mp.LENGTH:i={lengthType:Object.values(Fp)[15&n]}}t.increment();let a=e[t.get()],o=Object.values(ap)[a>>5],s=Object.values(ap)[a>>2&7],c=Object.values(op)[3&a];t.increment();let l=yp(e,t,2),u=l[0];return{physicalStreamType:r,logicalStreamType:i,logicalLevelTechnique1:o,logicalLevelTechnique2:s,physicalLevelTechnique:c,numValues:u,byteLength:l[1],decompressedCount:u}}(e,t);return n.logicalLevelTechnique1===ap.MORTON?function(e,t,n){let r=yp(t,n,2);return{physicalStreamType:e.physicalStreamType,logicalStreamType:e.logicalStreamType,logicalLevelTechnique1:e.logicalLevelTechnique1,logicalLevelTechnique2:e.logicalLevelTechnique2,physicalLevelTechnique:e.physicalLevelTechnique,numValues:e.numValues,byteLength:e.byteLength,decompressedCount:e.decompressedCount,numBits:r[0],coordinateShift:r[1]}}(n,e,t):ap.RLE!==n.logicalLevelTechnique1&&ap.RLE!==n.logicalLevelTechnique2||op.NONE===n.physicalLevelTechnique?n:function(e,t,n){let r=yp(t,n,2);return{physicalStreamType:e.physicalStreamType,logicalStreamType:e.logicalStreamType,logicalLevelTechnique1:e.logicalLevelTechnique1,logicalLevelTechnique2:e.logicalLevelTechnique2,physicalLevelTechnique:e.physicalLevelTechnique,numValues:e.numValues,byteLength:e.byteLength,decompressedCount:r[1],runs:r[0],numRleValues:r[1]}}(n,e,t)}(function(e){e.PRESENT=`PRESENT`,e.DATA=`DATA`,e.OFFSET=`OFFSET`,e.LENGTH=`LENGTH`})(Mp||={}),function(e){e.NONE=`NONE`,e.SINGLE=`SINGLE`,e.SHARED=`SHARED`,e.VERTEX=`VERTEX`,e.MORTON=`MORTON`,e.FSST=`FSST`}(Np||={}),function(e){e.VERTEX=`VERTEX`,e.INDEX=`INDEX`,e.STRING=`STRING`,e.KEY=`KEY`}(Pp||={}),function(e){e.VAR_BINARY=`VAR_BINARY`,e.GEOMETRIES=`GEOMETRIES`,e.PARTS=`PARTS`,e.RINGS=`RINGS`,e.TRIANGLES=`TRIANGLES`,e.SYMBOL=`SYMBOL`,e.DICTIONARY=`DICTIONARY`}(Fp||={}),function(e){e[e.FLAT=0]=`FLAT`,e[e.CONST=1]=`CONST`,e[e.SEQUENCE=2]=`SEQUENCE`,e[e.DICTIONARY=3]=`DICTIONARY`,e[e.FSST_DICTIONARY=4]=`FSST_DICTIONARY`}(Ip||={});class Vp{constructor(e,t){this.values=e,this._size=t}get(e){let t=Math.floor(e/8);return(this.values[t]>>e%8&1)==1}set(e,t){let n=Math.floor(e/8);this.values[n]=this.values[n]|!!t<<e%8}getInt(e){let t=Math.floor(e/8);return this.values[t]>>e%8&1}size(){return this._size}getBuffer(){return this.values}}function Hp(e,t,n){if(!t)return e;let r=t.size(),i=new e.constructor(r),a=0;for(let o=0;o<r;o++)i[o]=t.get(o)?e[a++]:n;return i}function Up(e,t,n,r,i){return function(e,t,n,r){let i;switch(t.logicalLevelTechnique1){case ap.DELTA:if(t.logicalLevelTechnique2===ap.RLE){let n=t;if(!r)return function(e,t,n){let r=new Int32Array(n),i=0,a=0;for(let n=0;n<t;n++){let o=e[n],s=Cp(e[n+t]);for(let e=0;e<o;e++)a+=s,r[i++]=a}return r}(e,n.runs,n.numRleValues);i=kp(e=Ep(e,n.runs,n.numRleValues))}else i=kp(e);break;case ap.RLE:i=function(e,t,n){if(n===void 0){n=0;for(let r=0;r<t;r++)n+=e[r]}let r=new Int32Array(n),i=0;for(let n=0;n<t;n++){let a=e[n],o=e[n+t];o=Cp(o),r.fill(o,i,i+a),i+=a}return r}(e,t.runs,t.numRleValues);break;case ap.MORTON:jp(e),i=new Int32Array(e);break;case ap.COMPONENTWISE_DELTA:i=function(e){if(e.length<2)return new Int32Array(e);let t=new Int32Array(e.length);t[0]=Cp(e[0]),t[1]=Cp(e[1]);let n=e.length/4*4,r=2;if(n>=4)for(;r<n-4;r+=4){let n=e[r+1],i=e[r+2],a=e[r+3];t[r]=Cp(e[r])+t[r-2],t[r+1]=Cp(n)+t[r-1],t[r+2]=Cp(i)+t[r],t[r+3]=Cp(a)+t[r+1]}for(;r!==e.length;r+=2)t[r]=Cp(e[r])+t[r-2],t[r+1]=Cp(e[r+1])+t[r-1];return t}(e);break;case ap.NONE:i=function(e){let t=new Int32Array(e.length);for(let n=0;n<e.length;n++)t[n]=Cp(e[n]);return t}(e);break;default:throw Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}return r?Hp(i,r,0):i}(Kp(e,t,n),n,0,i)}function Wp(e,t,n,r,i){return function(e,t,n,r){let i;switch(t.logicalLevelTechnique1){case ap.DELTA:i=function(e){let t=new Uint32Array(e.length);t[0]=Cp(e[0])>>>0;for(let n=1;n<e.length;n++)t[n]=t[n-1]+Cp(e[n])>>>0;return t}(t.logicalLevelTechnique2===ap.RLE?Ep(e,t.runs,t.numRleValues):e);break;case ap.RLE:i=Ep(e,t.runs,t.numRleValues);break;case ap.MORTON:jp(e),i=e;break;case ap.COMPONENTWISE_DELTA:i=function(e){if(e.length<2)return new Uint32Array(e);let t=new Uint32Array(e.length);t[0]=Cp(e[0])>>>0,t[1]=Cp(e[1])>>>0;for(let n=2;n<e.length;n+=2)t[n]=t[n-2]+Cp(e[n])>>>0,t[n+1]=t[n-1]+Cp(e[n+1])>>>0;return t}(e);break;case ap.NONE:i=e;break;default:throw Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}return r?Hp(i,r,0):i}(Kp(e,t,n),n,0,i)}function Gp(e,t,n){return function(e,t){if(t.logicalLevelTechnique1===ap.DELTA&&t.logicalLevelTechnique2===ap.NONE)return function(e){let t=new Int32Array(e.length+1);t[0]=0,t[1]=Cp(e[0]);let n=t[1];for(let r=2;r!==t.length;++r)n+=Cp(e[r-1]),t[r]=t[r-1]+n;return new Uint32Array(t)}(e);if(t.logicalLevelTechnique1===ap.RLE&&t.logicalLevelTechnique2===ap.NONE)return function(e,t,n){let r=new Uint32Array(n+1);r[0]=0;let i=1,a=r[0];for(let n=0;n<t;n++){let o=e[n],s=e[n+t];for(let e=i;e<i+o;e++)r[e]=s+a,a=r[e];i+=o}return r}(e,t.runs,t.numRleValues);if(t.logicalLevelTechnique1===ap.NONE&&t.logicalLevelTechnique2===ap.NONE){(function(e){let t=0;for(let n=0;n<e.length;n++)e[n]+=t,t=e[n]})(e);let n=new Uint32Array(t.numValues+1);return n[0]=0,n.set(e,1),n}if(t.logicalLevelTechnique1===ap.DELTA&&t.logicalLevelTechnique2===ap.RLE){let n=function(e,t,n){let r=new Int32Array(n+1);r[0]=0;let i=1,a=r[0];for(let n=0;n<t;n++){let o=e[n],s=e[n+t];s=Cp(s);for(let e=i;e<i+o;e++)r[e]=s+a,a=r[e];i+=o}return r}(e,t.runs,t.numRleValues);return jp(n),new Uint32Array(n)}throw Error(`Only delta encoding is supported for transforming length to offset streams yet.`)}(Kp(e,t,n),n)}function Kp(e,t,n){let r=n.physicalLevelTechnique;switch(r){case op.FAST_PFOR:return function(e,t,n,r){return function(e,t,n,r,i){let a=r.get();if(3&n)throw Error(`FastPFOR: invalid encodedByteLength=${n} at offset=${a} (encodedBytes.length=${e.length}; expected a multiple of 4 bytes for an int32 big-endian word stream)`);let o=n>>>2,s=function(e,t){if(t<=e.encodedWords.length)return e.encodedWords;let n=new Uint32Array(Math.max(16,2*t));return e.encodedWords=n,n}(i,o);(function(e,t,n,r){if(t<0||n<0||t+n>e.length)throw RangeError(`decodeBigEndianInt32sInto: out of bounds (offset=${t}, byteLength=${n}, bytes.length=${e.length})`);let i=Math.floor(n/4),a=n%4!=0,o=a?i+1:i;if(r.length<o)throw RangeError(`decodeBigEndianInt32sInto: out.length=${r.length} < ${o}`);if(i>0){let n=e.byteOffset+t;if(3&n)for(let n=0;n<i;n++){let i=t+4*n;r[n]=e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3]}else{let t=new Uint32Array(e.buffer,n,i);for(let e=0;e<i;e++)r[e]=0|up(t[e])}}if(a){let a=t+4*i,o=n-4*i,s=0;for(let t=0;t<o;t++)s|=e[a+t]<<24-8*t;r[i]=0|s}})(e,a,n,s);let c=function(e,t,n){let r=0,i=0,a=new Uint32Array(t),o=n??pp();if(e.length>0){let t=0|e[r];if(r=r+1|0,255&t)throw Error(`FastPFOR decode: invalid alignedLength=${t} (expected multiple of 256)`);if(i+t>a.length)throw Error(`FastPFOR decode: output buffer too small (outPos=${i}, alignedLength=${t}, out.length=${a.length})`);r=function(e,t,n,r,i,a){let o=r+lp(i,256),s=r,c=n;for(;s!==o;){let n=Math.min(dp,o-s);c=_p(e,t,c,s,n,a),s=s+n|0}return c}(e,a,r,i,t,o),i=i+t|0}return function(e,t,n,r,i,a){if(a===0)return t;let o=0,s=t,c=t+n,l=i,u=i,d=i+a,f=0,p=0;for(;s<c&&u<d;){let t=e[s]>>>o&255;if(o+=8,s+=o>>>5,o&=31,f|=(127&t)<<p,128&t)r[u++]=0|f,f=0,p=0;else if(p+=7,p>28)throw Error(`FastPFOR VByte: unterminated value (expected MSB=1 terminator within 5 bytes; shift=${p}, partial=${f}, decoded=${u-l}/${a}, inPos=${s}, inEnd=${c})`)}if(u!==d)throw Error(`FastPFOR VByte: truncated stream (decoded=${u-l}, expected=${a}, consumedWords=${s-t}/${n}, vbyteStart=${t}, vbyteEnd=${c})`)}(e,r,e.length-r|0,a,i,t-i|0),a}(s.subarray(0,o),t,i.decoderWorkspace);return r.add(n),c}(e,t,n,r,function(e=16){if(e<0)throw RangeError(`initialEncodedWordCapacity must be >= 0, got ${e}`);let t=Math.max(16,0|e);return{encodedWords:new Uint32Array(t),decoderWorkspace:pp()}}(n>>>2))}(e,n.numValues,n.byteLength,t);case op.VARINT:return yp(e,t,n.numValues);case op.NONE:{let r=t.get();t.add(n.byteLength);let i=e.subarray(r,t.get());return new Uint32Array(i)}default:throw Error(`Specified physicalLevelTechnique ${r} is not supported (yet).`)}}function qp(e,t,n){let r=Kp(e,t,n);return r.length===1?r[0]:function(e){return e[1]}(r)}function Jp(e,t,n){return function(e){if(e.length===2){let t=Cp(e[1]);return[t,t]}return[Cp(e[2]),Cp(e[3])]}(Kp(e,t,n))}function Yp(e,t,n){return function(e){if(e.length===2){let t=wp(e[1]);return[t,t]}return[wp(e[2]),wp(e[3])]}(bp(e,t,n.numValues))}function Xp(e,t,n,r){return function(e,t,n){let r;switch(t.logicalLevelTechnique1){case ap.DELTA:r=function(e){let t=new BigUint64Array(e.length);t[0]=BigInt.asUintN(64,wp(e[0]));for(let n=1;n<e.length;n++)t[n]=BigInt.asUintN(64,t[n-1]+wp(e[n]));return t}(t.logicalLevelTechnique2===ap.RLE?Dp(e,t.runs,t.numRleValues):e);break;case ap.RLE:r=Dp(e,t.runs,t.numRleValues);break;case ap.NONE:r=e;break;default:throw Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}return n?Hp(r,n,0n):r}(bp(e,t,n.numValues),n,r)}function Zp(e,t,n){let r=bp(e,t,n.numValues);return r.length===1?r[0]:function(e){return e[1]}(r)}function Qp(e,t,n,r,i=`int32`){let a=e.logicalLevelTechnique1;if(a===ap.RLE)return e.runs===1?Ip.CONST:Ip.FLAT;if(a!==ap.DELTA||e.logicalLevelTechnique2!==ap.RLE)return e.numValues===1?Ip.CONST:Ip.FLAT;let o=t instanceof Vp?t.size():t;if(e.numRleValues!==o)return Ip.FLAT;if(e.runs===1)return Ip.SEQUENCE;if(e.runs!==2)return e.numValues===1?Ip.CONST:Ip.FLAT;let s=r.get();if(e.physicalLevelTechnique===op.VARINT)return function(e,t,n){let r=new ip(t.get());if(n===`int64`){let t=bp(e,r,4);return t[2]===2n&&t[3]===2n}let i=yp(e,r,4);return i[2]===2&&i[3]===2}(n,r,i)?Ip.SEQUENCE:e.numValues===1?Ip.CONST:Ip.FLAT;let c=r.get(),l=new Int32Array(n.buffer,n.byteOffset+c,4);return r.set(s),l[2]===2&&l[3]===2?Ip.SEQUENCE:e.numValues===1?Ip.CONST:Ip.FLAT}class $p extends Zf{getValueFromBuffer(e){return this.dataBuffer[e]}}class em extends ep{constructor(e,t,n,r){super(e,BigInt64Array.of(t),n,r)}getValueFromBuffer(e){return this.dataBuffer[0]+BigInt(e)*this.delta}}function tm(e,t,n){return{x:nm(e,t)-n,y:nm(e>>1,t)-n}}function nm(e,t){let n=0;for(let r=0;r<t;r++)n|=(e&1<<2*r)>>r;return n}function rm(e,t,r,i,a,o,s){return e===zp.MORTON?function(e,t,r,i,a,o){let s=Array(a?i+1:i);for(let a=0;a<i;a++){let i=tm(e[t[r+a]],o.numBits,o.coordinateShift);s[a]=new n(i.x,i.y)}return a&&(s[s.length-1]=s[0]),s}(t,r,i,a,o,s):function(e,t,r,i,a){let o=Array(a?i+1:i);for(let a=0;a<2*i;a+=2){let i=2*t[r+a/2];o[a/2]=new n(e[i],e[i+1])}return a&&(o[o.length-1]=o[0]),o}(t,r,i,a,o)}function im(e,t,r,i){let a=Array(i?r+1:r);for(let i=0;i<2*r;i+=2)a[i/2]=new n(e[t+i],e[t+i+1]);return i&&(a[a.length-1]=a[0]),a}(function(e){e[e.POINT=0]=`POINT`,e[e.LINESTRING=1]=`LINESTRING`,e[e.POLYGON=2]=`POLYGON`,e[e.MULTIPOINT=3]=`MULTIPOINT`,e[e.MULTILINESTRING=4]=`MULTILINESTRING`,e[e.MULTIPOLYGON=5]=`MULTIPOLYGON`})(Lp||={}),function(e){e[e.POINT=0]=`POINT`,e[e.LINESTRING=1]=`LINESTRING`,e[e.POLYGON=2]=`POLYGON`}(Rp||={}),function(e){e[e.MORTON=0]=`MORTON`,e[e.VEC_2=1]=`VEC_2`,e[e.VEC_3=2]=`VEC_3`}(zp||={});class am{constructor(e,t,n,r,i){this._vertexBufferType=e,this._topologyVector=t,this._vertexOffsets=n,this._vertexBuffer=r,this._mortonSettings=i}get vertexBufferType(){return this._vertexBufferType}get topologyVector(){return this._topologyVector}get vertexOffsets(){return this._vertexOffsets}get vertexBuffer(){return this._vertexBuffer}getSimpleEncodedVertex(e){let t=this.vertexOffsets?2*this.vertexOffsets[e]:2*e;return[this.vertexBuffer[t],this.vertexBuffer[t+1]]}getVertex(e){if(this.vertexOffsets&&this.mortonSettings){let t=tm(this.vertexBuffer[this.vertexOffsets[e]],this.mortonSettings.numBits,this.mortonSettings.coordinateShift);return[t.x,t.y]}let t=this.vertexOffsets?2*this.vertexOffsets[e]:2*e;return[this.vertexBuffer[t],this.vertexBuffer[t+1]]}getGeometries(){return function(e){let t=Array(e.numGeometries),r=1,i=1,a=1,o=0,s=0,c=0,l=e.mortonSettings,u=e.topologyVector,d=u.geometryOffsets,f=u.partOffsets,p=u.ringOffsets,m=e.vertexOffsets,h=!m||m.length===0,g=e.containsPolygonGeometry(),_=e.vertexBuffer;for(let u=0;u<e.numGeometries;u++)switch(e.geometryType(u)){case Lp.POINT:{let u,g;if(h)u=_[s++],g=_[s++];else if(e.vertexBufferType===zp.MORTON){let e=tm(_[m[c++]],l.numBits,l.coordinateShift);u=e.x,g=e.y}else{let e=2*m[c++];u=_[e],g=_[e+1]}t[o++]=[[new n(u,g)]],d&&a++,f&&r++,p&&i++}break;case Lp.MULTIPOINT:{let e=d[a]-d[a-1];a++;let l=Array(e);if(h)for(let t=0;t<e;t++){let e=_[s++],r=_[s++];l[t]=new n(e,r)}else for(let t=0;t<e;t++){let e=2*m[c++];l[t]=new n(_[e],_[e+1])}t[o++]=l.map((e=>[e])),r+=e,i+=e}break;case Lp.LINESTRING:{let n,u;g?(n=p[i]-p[i-1],i++):n=f[r]-f[r-1],r++,h?(u=im(_,s,n,!1),s+=2*n):(u=rm(e.vertexBufferType,_,m,c,n,!1,l),c+=n),t[o++]=[u],d&&a++}break;case Lp.POLYGON:{let n=f[r]-f[r-1];r++;let u=Array(n-1),g,v=p[i]-p[i-1];if(i++,h){g=im(_,s,v,!0),s+=2*v;for(let e=0;e<u.length;e++)v=p[i]-p[i-1],i++,u[e]=im(_,s,v,!0),s+=2*v}else{g=rm(e.vertexBufferType,_,m,c,v,!0,l),c+=v;for(let t=0;t<u.length;t++)v=p[i]-p[i-1],i++,u[t]=rm(e.vertexBufferType,_,m,c,v,!0,l),c+=v}t[o++]=[g].concat(u),d&&a++}break;case Lp.MULTILINESTRING:{let n=d[a]-d[a-1];a++;let u=Array(n);for(let t=0;t<n;t++){let n;g?(n=p[i]-p[i-1],i++):n=f[r]-f[r-1],r++,h?(u[t]=im(_,s,n,!1),s+=2*n):(u[t]=rm(e.vertexBufferType,_,m,c,n,!1,l),c+=n)}t[o++]=u}break;case Lp.MULTIPOLYGON:{let n=d[a]-d[a-1];a++;let u=Array(n);for(let t=0;t<n;t++){let n=f[r]-f[r-1],a;r++;let o=Array(n-1),d=p[i]-p[i-1];i++,h?(a=im(_,s,d,!0),s+=2*d):(a=rm(e.vertexBufferType,_,m,c,d,!0,l),c+=d);for(let t=0;t<o.length;t++){let n=p[i]-p[i-1];i++,h?(o[t]=im(_,s,n,!0),s+=2*n):(o[t]=rm(e.vertexBufferType,_,m,c,n,!0,l),c+=n)}u[t]=[a].concat(o)}t[o++]=u.flat()}break;default:throw Error(`The specified geometry type is currently not supported.`)}return t}(this)}get mortonSettings(){return this._mortonSettings}}class om extends am{constructor(e,t,n,r,i,a,o){super(n,r,i,a,o),this._numGeometries=e,this._geometryType=t}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsPolygonGeometry(){return this._geometryType===Lp.POLYGON||this._geometryType===Lp.MULTIPOLYGON}containsSingleGeometryType(){return!0}}class sm extends am{constructor(e,t,n,r,i,a){super(e,n,r,i,a),this._geometryTypes=t}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsPolygonGeometry(){for(let e=0;e<this.numGeometries;e++)if(this.geometryType(e)===Lp.POLYGON||this.geometryType(e)===Lp.MULTIPOLYGON)return!0;return!1}containsSingleGeometryType(){return!1}}class cm{constructor(e,t,n,r){this._triangleOffsets=e,this._indexBuffer=t,this._vertexBuffer=n,this._topologyVector=r}get triangleOffsets(){return this._triangleOffsets}get indexBuffer(){return this._indexBuffer}get vertexBuffer(){return this._vertexBuffer}get topologyVector(){return this._topologyVector}getGeometries(){if(!this._topologyVector)throw Error(`Cannot convert GpuVector to coordinates without topology information`);let e=Array(this.numGeometries),t=this._topologyVector,r=t.partOffsets,i=t.ringOffsets,a=t.geometryOffsets,o=0,s=1,c=1,l=1;for(let t=0;t<this.numGeometries;t++)switch(this.geometryType(t)){case Lp.POLYGON:{let u=r[s]-r[s-1];s++;let d=[];for(let e=0;e<u;e++){let e=i[c]-i[c-1];c++;let t=[];for(let r=0;r<e;r++){let e=this._vertexBuffer[o++],r=this._vertexBuffer[o++];t.push(new n(e,r))}t.length>0&&t.push(t[0]),d.push(t)}e[t]=d,a&&l++}break;case Lp.MULTIPOLYGON:{let u=a[l]-a[l-1];l++;let d=[];for(let e=0;e<u;e++){let e=r[s]-r[s-1];s++;for(let t=0;t<e;t++){let e=i[c]-i[c-1];c++;let t=[];for(let r=0;r<e;r++){let e=this._vertexBuffer[o++],r=this._vertexBuffer[o++];t.push(new n(e,r))}t.length>0&&t.push(t[0]),d.push(t)}}e[t]=d}}return e}[Symbol.iterator](){return null}}function lm(e,t,n,r,i,a){return new um(e,t,n,r,i,a)}class um extends cm{constructor(e,t,n,r,i,a){super(n,r,i,a),this._numGeometries=e,this._geometryType=t}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsSingleGeometryType(){return!0}}function dm(e,t,n,r,i){return new fm(e,t,n,r,i)}class fm extends cm{constructor(e,t,n,r,i){super(t,n,r,i),this._geometryTypes=e}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsSingleGeometryType(){return!1}}function pm(e,t,n,r,i){let a=Bp(e,n),o,s,c,l;if(Qp(a,r,e,n)===Ip.CONST){let i=qp(e,n,a),u,d,f,p;for(let r=0;r<t-1;r++){let t=Bp(e,n);switch(t.physicalStreamType){case Mp.LENGTH:switch(t.logicalStreamType.lengthType){case Fp.GEOMETRIES:u=Gp(e,n,t);break;case Fp.PARTS:d=Gp(e,n,t);break;case Fp.RINGS:f=Gp(e,n,t);break;case Fp.TRIANGLES:p=Gp(e,n,t)}break;case Mp.OFFSET:switch(t.logicalStreamType.offsetType){case Pp.VERTEX:o=Wp(e,n,t);break;case Pp.INDEX:l=Wp(e,n,t)}break;case Mp.DATA:Np.VERTEX===t.logicalStreamType.dictionaryType?s=Up(e,n,t):(c={numBits:t.numBits,coordinateShift:t.coordinateShift},s=Wp(e,n,t))}}return l?u!==void 0||d!==void 0?lm(r,i,p,l,s,{geometryOffsets:u,partOffsets:d,ringOffsets:f}):lm(r,i,p,l,s):c===void 0?function(e,t,n,r,i){return new om(e,t,zp.VEC_2,n,r,i)}(r,i,{geometryOffsets:u,partOffsets:d,ringOffsets:f},o,s):function(e,t,n,r,i,a){return new om(e,t,zp.MORTON,n,r,i,a)}(r,i,{geometryOffsets:u,partOffsets:d,ringOffsets:f},o,s,c)}let u=Wp(e,n,a),d,f,p,m,h,g,_;for(let r=0;r<t-1;r++){let t=Bp(e,n);switch(t.physicalStreamType){case Mp.LENGTH:switch(t.logicalStreamType.lengthType){case Fp.GEOMETRIES:d=Wp(e,n,t);break;case Fp.PARTS:f=Wp(e,n,t);break;case Fp.RINGS:p=Wp(e,n,t);break;case Fp.TRIANGLES:m=Gp(e,n,t)}break;case Mp.OFFSET:switch(t.logicalStreamType.offsetType){case Pp.VERTEX:o=Wp(e,n,t);break;case Pp.INDEX:l=Wp(e,n,t)}break;case Mp.DATA:Np.VERTEX===t.logicalStreamType.dictionaryType?s=Up(e,n,t):(c={numBits:t.numBits,coordinateShift:t.coordinateShift},s=Wp(e,n,t))}}return d?(h=mm(u,d,2),f&&p?(g=hm(u,h,f,!1),_=function(e,t,n,r){let i=new Uint32Array(n[n.length-1]+1),a=0;i[0]=a;let o=1,s=1,c=0;for(let l=0;l<e.length;l++){let u=e[l],d=t[l+1]-t[l];if(u!==0&&u!==3)for(let e=0;e<d;e++){let e=n[o]-n[o-1];o++;for(let t=0;t<e;t++)a=i[s++]=a+r[c++]}else for(let e=0;e<d;e++)i[s++]=++a,o++}return i}(u,h,g,p)):f&&(g=function(e,t,n){let r=new Uint32Array(t[t.length-1]+1),i=0;r[0]=i;let a=1,o=0;for(let s=0;s<e.length;s++){let c=e[s],l=t[s+1]-t[s];if(c===4||c===1)for(let e=0;e<l;e++)i=r[a++]=i+n[o++];else for(let e=0;e<l;e++)r[a++]=++i}return r}(u,h,f))):f&&p?(g=mm(u,f,1),_=hm(u,g,p,!0)):f&&(g=mm(u,f,0)),l&&!g?dm(u,m,l,s):l?dm(u,m,l,s,{geometryOffsets:h,partOffsets:g,ringOffsets:_}):c===void 0?function(e,t,n,r){return new sm(zp.VEC_2,e,t,n,r)}(u,{geometryOffsets:h,partOffsets:g,ringOffsets:_},o,s):function(e,t,n,r,i){return new sm(zp.MORTON,e,t,n,r,i)}(u,{geometryOffsets:h,partOffsets:g,ringOffsets:_},o,s,c)}function mm(e,t,n){let r=new Uint32Array(e.length+1),i=0;r[0]=i;let a=0;for(let o=0;o<e.length;o++)i=r[o+1]=i+(e[o]>n?t[a++]:1);return r}function hm(e,t,n,r){let i=new Uint32Array(t[t.length-1]+1),a=0;i[0]=a;let o=1,s=0;for(let c=0;c<e.length;c++){let l=e[c],u=t[c+1]-t[c];if(l===5||l===2||r&&(l===4||l===1))for(let e=0;e<u;e++)a=i[o++]=a+n[s++];else for(let e=0;e<u;e++)i[o++]=++a}return i}class gm extends Xf{constructor(e,t,n){super(e,t.getBuffer(),n),this.dataVector=t}getValueFromBuffer(e){return this.dataVector.get(e)}}class _m extends Zf{getValueFromBuffer(e){return this.dataBuffer[e]}}class vm extends Xf{constructor(e,t,n,r){super(e,r?BigInt64Array.of(t):BigUint64Array.of(t),n)}getValueFromBuffer(e){return this.dataBuffer[0]}}function ym(e,t,n,r,i){let a=function(e,t,n,r){let i=new Uint8Array(t),a=0,o=r.get()+n;for(;a<t&&!(r.get()>=o);){let n=e[r.increment()];if(n<=127){let o=n+3,s=e[r.increment()],c=Math.min(a+o,t);i.fill(s,a,c),a=c}else{let o=256-n;for(let n=0;n<o&&a<t;n++)i[a++]=e[r.increment()]}}return r.set(o),i}(e,Math.ceil(t/8),n,r);return i?function(e,t,n){if(!n)return e;let r=n.size(),i=new Vp(e,t),a=new Vp(new Uint8Array(Math.ceil(r/8)),r),o=0;for(let e=0;e<r;e++){let t=!!n.get(e)&&i.get(o++);a.set(e,t)}return a.getBuffer()}(a,t,i):a}let bm=new TextDecoder;function xm(e,t,n){return n-t>=12?bm.decode(e.subarray(t,n)):function(e,t,n){let r=``,i=t;for(;i<n;){let t=e[i],a,o,s,c=null,l=t>239?4:t>223?3:t>191?2:1;if(i+l>n)break;l===1?t<128&&(c=t):l===2?(a=e[i+1],(192&a)==128&&(c=(31&t)<<6|63&a,c<=127&&(c=null))):l===3?(a=e[i+1],o=e[i+2],(192&a)==128&&(192&o)==128&&(c=(15&t)<<12|(63&a)<<6|63&o,(c<=2047||c>=55296&&c<=57343)&&(c=null))):l===4&&(a=e[i+1],o=e[i+2],s=e[i+3],(192&a)==128&&(192&o)==128&&(192&s)==128&&(c=(15&t)<<18|(63&a)<<12|(63&o)<<6|63&s,(c<=65535||c>=1114112)&&(c=null))),c===null?(c=65533,l=1):c>65535&&(c-=65536,r+=String.fromCharCode(c>>>10&1023|55296),c=56320|1023&c),r+=String.fromCharCode(c),i+=l}return r}(e,t,n)}class Sm extends Xf{constructor(e,t,n,r){super(e,n,r),this.offsetBuffer=t}}class Cm extends Sm{constructor(e,t,n,r){super(e,t,n,r??t.length-1)}getValueFromBuffer(e){return xm(this.dataBuffer,this.offsetBuffer[e],this.offsetBuffer[e+1])}}class wm extends Sm{constructor(e,t,n,r,i){super(e,n,r,i??t.length),this.indexBuffer=t,this.indexBuffer=t}getValueFromBuffer(e){let t=this.indexBuffer[e];return xm(this.dataBuffer,this.offsetBuffer[t],this.offsetBuffer[t+1])}}class Tm extends Sm{constructor(e,t,n,r,i,a,o){super(e,n,r,o),this.indexBuffer=t,this.symbolOffsetBuffer=i,this.symbolTableBuffer=a}getValueFromBuffer(e){this.decodedDictionary??=(this.symbolLengthBuffer??=this.offsetToLengthBuffer(this.symbolOffsetBuffer),function(e,t,n){let r=[],i=Array(t.length).fill(0);for(let e=1;e<t.length;e++)i[e]=i[e-1]+t[e-1];for(let a=0;a<n.length;a++)if(n[a]===255)r.push(n[++a]);else{let o=t[n[a]],s=i[n[a]];for(let t=0;t<o;t++)r.push(e[s+t])}return new Uint8Array(r)}(this.symbolTableBuffer,this.symbolLengthBuffer,this.dataBuffer));let t=this.indexBuffer[e];return xm(this.decodedDictionary,this.offsetBuffer[t],this.offsetBuffer[t+1])}offsetToLengthBuffer(e){let t=new Uint32Array(e.length-1),n=e[0];for(let r=1;r<e.length;r++){let i=e[r];t[r-1]=i-n,n=i}return t}}function Em(e,t,n,r,i,a){return n.type===`scalarType`?function(e,t,n,r,i,a){let o=null;if(e===0)return null;if(a.nullable){let e=Bp(t,n),r=e.numValues,i=n.get(),a=ym(t,r,e.byteLength,n);n.set(i+e.byteLength),o=new Vp(a,e.numValues)}let s=o??r;switch(i.physicalType){case 4:case 3:return function(e,t,n,r,i){let a=Bp(e,t),o=Qp(a,i,e,t),s=r.physicalType===3;if(o===Ip.FLAT){let r=Dm(i)?i:void 0,o=s?Up(e,t,a,0,r):Wp(e,t,a,0,r);return new Qf(n.name,o,i)}if(o===Ip.SEQUENCE){let r=Jp(e,t,a);return new tp(n.name,r[0],r[1],a.numRleValues)}let c=s?function(e,t,n){let r=Kp(e,t,n);return r.length===1?Cp(r[0]):function(e){return Cp(e[1])}(r)}(e,t,a):qp(e,t,a);return new np(n.name,c,i,s)}(t,n,a,i,s);case 9:return function(e,t,n,r,i){let a=null,o=null,s=null,c=null,l=null,u=i??null,d=null,f=null;for(let e=0;e<r;e++){let e=Bp(t,n);switch(e.physicalStreamType){case Mp.PRESENT:{let r=ym(t,e.numValues,e.byteLength,n),a=new Vp(r,e.numValues);u=i??a;break}case Mp.OFFSET:o=Wp(t,n,e,0,u);break;case Mp.LENGTH:{let r=Gp(t,n,e);Fp.DICTIONARY===e.logicalStreamType.lengthType?a=r:Fp.SYMBOL===e.logicalStreamType.lengthType?c=r:d=r;break}case Mp.DATA:{let r=t.subarray(n.get(),n.get()+e.byteLength);n.add(e.byteLength);let i=e.logicalStreamType.dictionaryType;Np.FSST===i?l=r:Np.SINGLE===i||Np.SHARED===i?s=r:Np.NONE===i&&(f=r);break}}}return function(e,t,n,r,i,a,o){return t?new Tm(e,n,r,i,a,t,o):null}(e,l,o,a,s,c,u)??function(e,t,n,r,i){return t?i?new wm(e,n,r,t,i):new wm(e,n,r,t):null}(e,s,o,a,u)??function(e,t,n,r,i){if(!t||!n)return null;if(r)return i?new wm(e,r,t,n,i):new wm(e,r,t,n);if(i&&i.size()!==t.length-1){let r=new Uint32Array(i.size()),a=0;for(let e=0;e<i.size();e++)r[e]=i.get(e)?a++:0;return new wm(e,r,t,n,i)}return i?new Cm(e,t,n,i):new Cm(e,t,n)}(e,d,f,o,u)}(a.name,t,n,a.nullable?e-1:e,o);case 0:return function(e,t,n,r,i){let a=Bp(e,t),o=a.numValues,s=t.get(),c=Dm(i)?i:void 0,l=ym(e,o,a.byteLength,t,c);t.set(s+a.byteLength);let u=new Vp(l,o);return new gm(n.name,u,i)}(t,n,a,0,s);case 6:case 5:return function(e,t,n,r,i){let a=Bp(e,t),o=Qp(a,r,e,t,`int64`),s=i.physicalType===5;if(o===Ip.FLAT){let i=Dm(r)?r:void 0,o=s?function(e,t,n,r){return function(e,t,n){let r;switch(t.logicalLevelTechnique1){case ap.DELTA:if(t.logicalLevelTechnique2===ap.RLE){let i=t;if(!n)return function(e,t,n){let r=new BigInt64Array(n),i=0,a=0n;for(let n=0;n<t;n++){let o=Number(e[n]),s=wp(e[n+t]);for(let e=0;e<o;e++)a+=s,r[i++]=a}return r}(e,i.runs,i.numRleValues);r=Ap(e=Dp(e,i.runs,i.numRleValues))}else r=Ap(e);break;case ap.RLE:r=function(e,t,n){if(n===void 0){n=0;for(let r=0;r<t;r++)n+=Number(e[r])}let r=new BigInt64Array(n),i=0;for(let n=0;n<t;n++){let a=Number(e[n]),o=e[n+t];o=wp(o),r.fill(o,i,i+a),i+=a}return r}(e,t.runs,t.numRleValues);break;case ap.NONE:r=function(e){let t=new BigInt64Array(e.length);for(let n=0;n<e.length;n++)t[n]=wp(e[n]);return t}(e);break;default:throw Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}return n?Hp(r,n,0n):r}(bp(e,t,n.numValues),n,r)}(e,t,a,i):Xp(e,t,a,i);return new $p(n.name,o,r)}if(o===Ip.SEQUENCE){let r=Yp(e,t,a);return new em(n.name,r[0],r[1],a.numRleValues)}let c=s?function(e,t,n){let r=bp(e,t,n.numValues);return r.length===1?wp(r[0]):function(e){return wp(e[1])}(r)}(e,t,a):Zp(e,t,a);return new vm(n.name,c,r,s)}(t,n,a,s,i);case 7:return function(e,t,n,r){let i=Bp(e,t),a=Dm(r)?r:void 0,o=function(e,t,n,r){let i=t.get(),a=i+n*Float32Array.BYTES_PER_ELEMENT,o=new Uint8Array(e.subarray(i,a)).buffer,s=new Float32Array(o);return t.set(a),r?Hp(s,r,0):s}(e,t,i.numValues,a);return new _m(n.name,o,r)}(t,n,a,s);case 8:return function(e,t,n,r){let i=Bp(e,t),a=Dm(r)?r:void 0,o=function(e,t,n,r){let i=t.get(),a=i+n*Float64Array.BYTES_PER_ELEMENT,o=new Uint8Array(e.subarray(i,a)).buffer,s=new Float64Array(o);return t.set(a),r?Hp(s,r,0):s}(e,t,i.numValues,a);return new $f(n.name,o,r)}(t,n,a,s);default:throw Error(`The specified data type for the field is currently not supported: ${i}`)}}(r,e,t,i,n.scalarType,n):r===0?null:function(e,t,n,r){let i=null,a=null,o=null,s=null,c=!1;for(;!c;){let n=Bp(e,t);switch(n.physicalStreamType){case Mp.LENGTH:Fp.DICTIONARY===n.logicalStreamType.lengthType?i=Gp(e,t,n):o=Gp(e,t,n);break;case Mp.DATA:Np.SINGLE===n.logicalStreamType.dictionaryType||Np.SHARED===n.logicalStreamType.dictionaryType?(a=e.subarray(t.get(),t.get()+n.byteLength),c=!0):s=e.subarray(t.get(),t.get()+n.byteLength),t.add(n.byteLength)}}let l=n.complexType.children,u=[],d=0;for(let c of l){let l=yp(e,t,1)[0];if(l===0)continue;let f=c.name?`${n.name}${c.name}`:n.name;if(l!==2||c.type!==`scalarField`||c.scalarField.physicalType!==9)throw Error(`Currently only optional string fields are implemented for a struct.`);let p=Bp(e,t),m=ym(e,p.numValues,p.byteLength,t),h=Bp(e,t),g=Wp(e,t,h,0,h.decompressedCount===r?void 0:new Vp(m,p.numValues));u[d++]=s?new Tm(f,g,i,a,o,s,new Vp(m,p.numValues)):new wm(f,g,i,a,new Vp(m,p.numValues))}return u}(e,t,n,i)}function Dm(e){return e instanceof Vp}function Om(e){switch(e){case 0:case 1:case 2:case 3:{let t={};t.nullable=!!(1&e),t.columnScope=0;let n={type:`logicalType`,logicalType:0};return n.longID=!!(2&e),t.scalarType=n,t.type=`scalarType`,t}case 4:{let e={nullable:!1,columnScope:0};return e.type=`complexType`,e.complexType={type:`physicalType`,physicalType:0},e}case 30:{let e={nullable:!1,columnScope:0};return e.type=`complexType`,e.complexType={type:`physicalType`,physicalType:1},e}default:return function(e){let t;switch(e){case 10:case 11:t=0;break;case 12:case 13:t=1;break;case 14:case 15:t=2;break;case 16:case 17:t=3;break;case 18:case 19:t=4;break;case 20:case 21:t=5;break;case 22:case 23:t=6;break;case 24:case 25:t=7;break;case 26:case 27:t=8;break;case 28:case 29:t=9;break;default:return null}let n={};n.nullable=!!(1&e),n.columnScope=0;let r={type:`physicalType`};return r.physicalType=t,n.type=`scalarType`,n.scalarType=r,n}(e)}}function km(e){return e>=10}function Am(e){return e===30}function jm(e){if(e.type===`scalarType`){let t=e.scalarType;if(t.type===`physicalType`)switch(t.physicalType){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:default:return!1;case 9:return!0}if(t.type===`logicalType`)return!1}else if(e.type===`complexType`){let t=e.complexType;if(t.type===`physicalType`)switch(t.physicalType){case 0:case 1:return!0;default:return!1}}return console.warn(`Unexpected column type in hasStreamCount`,e),!1}function Mm(e){return e.type===`complexType`&&e.complexType?.type===`physicalType`&&e.complexType.physicalType===0}let Nm=new TextDecoder;function Pm(e,t){let n=yp(e,t,1)[0];if(n===0)return``;let r=t.get(),i=e.subarray(r,r+n);return t.add(n),Nm.decode(i)}function Fm(e,t){let n=yp(e,t,1)[0]>>>0;if(n<10||n>30)throw Error(`Unsupported field type code ${n}. Supported: 10-29(scalars), 30(STRUCT)`);let r=Om(n);if(km(n)&&(r.name=Pm(e,t)),Am(n)){let n=yp(e,t,1)[0]>>>0;r.complexType.children=Array(n);for(let i=0;i<n;i++)r.complexType.children[i]=Fm(e,t)}return function(e){return{name:e.name,nullable:e.nullable,scalarField:e.scalarType,complexField:e.complexType,type:e.type===`scalarType`?`scalarField`:`complexField`}}(r)}function Im(e,t){let n=yp(e,t,1)[0]>>>0,r=Om(n);if(!r)throw Error(`Unsupported column type code ${n}. Supported: 0-3(ID), 4(GEOMETRY), 10-29(scalars), 30(STRUCT)`);if(km(n)?r.name=Pm(e,t):n>=0&&n<=3?r.name=`id`:n===4&&(r.name=`geometry`),Am(n)){let n=yp(e,t,1)[0]>>>0,i=r.complexType;i.children=Array(n);for(let r=0;r<n;r++)i.children[r]=Fm(e,t)}return r}function Lm(e,t){let n={featureTables:[]},r={};r.name=Pm(e,t);let i=yp(e,t,1)[0]>>>0,a=yp(e,t,1)[0]>>>0;r.columns=Array(a);for(let n=0;n<a;n++)r.columns[n]=Im(e,t);return n.featureTables.push(r),[n,i]}function Rm(e,t,n,r,i,a,o=!1){let s=t.scalarType;if(!s||s.type!==`logicalType`||s.logicalType!==0)throw Error(`ID column must be a logical ID scalar type: ${r}`);let c=s.longID?6:4,l=typeof a==`number`?void 0:a,u=Qp(i,a,e,n,c===6?`int64`:`int32`);if(c===4)switch(u){case Ip.FLAT:{let t=Wp(e,n,i,0,l);return new Qf(r,t,a)}case Ip.SEQUENCE:{let t=Jp(e,n,i);return new tp(r,t[0],t[1],i.numRleValues)}case Ip.CONST:{let t=qp(e,n,i);return new np(r,t,a,!1)}}switch(u){case Ip.FLAT:{if(o){let t=function(e,t,n){return function(e,t){switch(t.logicalLevelTechnique1){case ap.DELTA:return t.logicalLevelTechnique2===ap.RLE&&(e=Op(e,t.runs,t.numRleValues)),function(e){e[0]=Tp(e[0]);let t=e.length/4*4,n=1;if(t>=4)for(;n<t-4;n+=4){let t=e[n+1],r=e[n+2],i=e[n+3];e[n]=Tp(e[n])+e[n-1],e[n+1]=Tp(t)+e[n],e[n+2]=Tp(r)+e[n+1],e[n+3]=Tp(i)+e[n+2]}for(;n!==e.length;++n)e[n]=Tp(e[n])+e[n-1]}(e),e;case ap.RLE:return function(e,t){return Op(e,t.runs,t.numRleValues)}(e,t);case ap.NONE:return e;default:throw Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}}(function(e,t,n){let r=new Float64Array(n);for(let i=0;i<n;i++)r[i]=Sp(e,t);return r}(e,t,n.numValues),n)}(e,n,i);return new $f(r,t,a)}let t=Xp(e,n,i,l);return new $p(r,t,a)}case Ip.SEQUENCE:{let t=Yp(e,n,i);return new em(r,t[0],t[1],i.numRleValues)}case Ip.CONST:{let t=Zp(e,n,i);return new vm(r,t,a,!1)}}throw Error(`Vector type not supported for id column.`)}class zm{constructor(e,t){switch(this._featureData=e,this.properties=this._featureData.properties||{},this._featureData.geometry?.type){case Lp.POINT:case Lp.MULTIPOINT:this.type=1;break;case Lp.LINESTRING:case Lp.MULTILINESTRING:this.type=2;break;case Lp.POLYGON:case Lp.MULTIPOLYGON:this.type=3;break;default:this.type=0}this.extent=t,this.id=Number(this._featureData.id)}loadGeometry(){let e=[];for(let t of this._featureData.geometry.coordinates){let r=[];for(let e of t)r.push(new n(e.x,e.y));e.push(r)}return e}}class Bm{constructor(e){this.features=[],this.featureTable=e,this.name=e.name,this.extent=e.extent,this.version=2,this.features=e.getFeatures(),this.length=this.features.length}feature(e){return new zm(this.features[e],this.extent)}}class Vm{constructor(e){this.layers={};let t=function(e,t,n=!0){let r=new ip(0),i=[];for(;r.get()<e.length;){let t=yp(e,r,1)[0]>>>0,o=r.get()+t;if(o>e.length)throw Error(`Block overruns tile: ${o} > ${e.length}`);if(yp(e,r,1)[0]>>>0!=1){r.set(o);continue}let[s,c]=Lm(e,r),l=s.featureTables[0],u=null,d=null,f=[],p=0;for(let t of l.columns){let i=t.name;if((a=t).type===`scalarType`&&a.scalarType?.type===`logicalType`&&a.scalarType.logicalType===0){let a=null;if(t.nullable){let t=Bp(e,r),n=r.get(),i=ym(e,t.numValues,t.byteLength,r);r.set(n+t.byteLength),a=new Vp(i,t.numValues)}let o=Bp(e,r);p=a?a.size():o.decompressedCount,u=Rm(e,t,r,i,o,a??p,n)}else if(Mm(t)){let t=yp(e,r,1)[0];if(p===0){let t=r.get();p=Bp(e,r).decompressedCount,r.set(t)}d=pm(e,t,r,p)}else{let n=jm(t)?yp(e,r,1)[0]:1;if(n===0)continue;let i=Em(e,r,t,n,p);if(i)if(Array.isArray(i))for(let e of i)f.push(e);else f.push(i)}}let m=new rp(l.name,d,u,f,c);i.push(m),r.set(o)}var a;return i}(new Uint8Array(e));this.layers=t.reduce(((e,t)=>Object.assign(Object.assign({},e),{[t.name]:new Bm(t)})),{})}}class Hm{constructor(e,t){this.feature=e,this.type=e.type,this.properties=e.tags?e.tags:{},this.extent=t,`id`in e&&(typeof e.id==`string`?this.id=parseInt(e.id,10):typeof e.id!=`number`||isNaN(e.id)||(this.id=e.id))}loadGeometry(){let e=[],t=this.feature.type===1?[this.feature.geometry]:this.feature.geometry;for(let r of t){let t=[];for(let e of r)t.push(new n(e[0],e[1]));e.push(t)}return e}}let Um=`_geojsonTileLayer`;function Wm(e,t,n=``){t.writeVarintField(15,e.version||1),t.writeStringField(1,e.name||``),t.writeVarintField(5,e.extent||4096);let r={jsonPrefix:n,keys:[],values:[],keycache:{},valuecache:{}};for(let n=0;n<e.length;n++)r.feature=e.feature(n),t.writeMessage(2,Gm,r);let i=r.keys;for(let e of i)t.writeStringField(3,e);let a=r.values;for(let e of a)t.writeMessage(4,Xm,e)}function Gm(e,t){if(!e.feature)return;let n=e.feature;n.id!==void 0&&t.writeVarintField(1,n.id),t.writeMessage(2,Km,e),t.writeVarintField(3,n.type),t.writeMessage(4,Ym,n)}function Km(e,t){for(let n in e.feature?.properties){let r=e.feature.properties[n],i=e.keycache[n];if(r==null)continue;i===void 0&&(e.keys.push(n),i=e.keys.length-1,e.keycache[n]=i),t.writeVarint(i),typeof r!=`string`&&typeof r!=`boolean`&&typeof r!=`number`&&(r=e.jsonPrefix+JSON.stringify(r));let a=typeof r+`:`+r,o=e.valuecache[a];o===void 0&&(e.values.push(r),o=e.values.length-1,e.valuecache[a]=o),t.writeVarint(o)}}function qm(e,t){return(t<<3)+(7&e)}function Jm(e){return e<<1^e>>31}function Ym(e,t){let n=e.loadGeometry(),r=e.type,i=0,a=0;for(let o of n){let n=1;r===1&&(n=o.length),t.writeVarint(qm(1,n));let s=r===3?o.length-1:o.length;for(let e=0;e<s;e++){e===1&&r!==1&&t.writeVarint(qm(2,s-1));let n=o[e].x-i,c=o[e].y-a;t.writeVarint(Jm(n)),t.writeVarint(Jm(c)),i+=n,a+=c}e.type===3&&t.writeVarint(qm(7,1))}}function Xm(e,t){let n=typeof e;n===`string`?t.writeStringField(1,e):n===`boolean`?t.writeBooleanField(7,e):n===`number`&&(e%1==0?e<0?t.writeSVarintField(6,e):t.writeVarintField(5,e):t.writeDoubleField(3,e))}class Zm{constructor(e,t){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new _a(O,16,0),this.grid3D=new _a(O,16,0),this.featureIndexArray=new qo,this.promoteId=t}insert(e,t,n,r,i,a){let o=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(n,r,i);let s=a?this.grid3D:this.grid;for(let e of t){let t=[1/0,1/0,-1/0,-1/0];for(let n of e)t[0]=Math.min(t[0],n.x),t[1]=Math.min(t[1],n.y),t[2]=Math.max(t[2],n.x),t[3]=Math.max(t[3],n.y);t[0]<O&&t[1]<O&&t[2]>=0&&t[3]>=0&&s.insert(o,t[0],t[1],t[2],t[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=this.encoding===`mlt`?new Vm(this.rawTileData).layers:new Bl(new Pd(this.rawTileData)).layers,this.sourceLayerCoder=new Jf(this.vtLayers?Object.keys(this.vtLayers).sort():[Um])),this.vtLayers}query(e,t,r,i){this.loadVTLayers();let a=e.params,o=O/e.tileSize/e.scale,s=V(a.filter,a.globalState),c=e.queryGeometry,l=e.queryPadding*o,u=qf.fromPoints(c),d=this.grid.query(u.minX-l,u.minY-l,u.maxX+l,u.maxY+l),f=qf.fromPoints(e.cameraQueryGeometry).expandBy(l),p=this.grid3D.query(f.minX,f.minY,f.maxX,f.maxY,((t,r,i,a)=>function(e,t,r,i,a){for(let n of e)if(t<=n.x&&r<=n.y&&i>=n.x&&a>=n.y)return!0;let o=[new n(t,r),new n(t,a),new n(i,a),new n(i,r)];if(e.length>2){for(let t of o)if(ic(e,t))return!0}for(let t=0;t<e.length-1;t++)if(ac(e[t],e[t+1],o))return!0;return!1}(e.cameraQueryGeometry,t-l,r-l,i+l,a+l)));for(let e of p)d.push(e);d.sort($m);let m={},h;for(let n of d){if(n===h)continue;h=n;let l=this.featureIndexArray.get(n),u=null;this.loadMatchingFeature(m,l.bucketIndex,l.sourceLayerIndex,l.featureIndex,s,a.layers,a.availableImages,t,r,i,((t,n,r)=>(u||=Ws(t),n.queryIntersectsFeature({queryGeometry:c,feature:t,featureState:r,geometry:u,zoom:this.z,transform:e.transform,pixelsToTileUnits:o,pixelPosMatrix:e.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:e.getElevation}))))}return m}loadMatchingFeature(e,t,n,r,i,a,o,s,c,l,u){let d=this.bucketLayerIDs[t];if(a&&!d.some((e=>a.has(e))))return;let f=this.sourceLayerCoder.decode(n),p=this.vtLayers[f].feature(r);if(i.needGeometry){let e=Gs(p,!0);if(!i.filter(new za(this.tileID.overscaledZ),e,this.tileID.canonical))return}else if(!i.filter(new za(this.tileID.overscaledZ),p))return;let m=this.getId(p,f);for(let t of d){if(a&&!a.has(t))continue;let n=s[t];if(!n)continue;let i={};m&&l&&(i=l.getState(n.sourceLayer||Um,m));let d=ae({},c[t]);d.paint=Qm(d.paint,n.paint,p,i,o),d.layout=Qm(d.layout,n.layout,p,i,o);let f=!u||u(p,n,i);if(!f)continue;let h=new Yf(p,this.z,this.x,this.y,m);h.layer=d;let g=e[t];g===void 0&&(g=e[t]=[]),g.push({featureIndex:r,feature:h,intersectionZ:f})}}lookupSymbolFeatures(e,t,n,r,i,a,o,s){let c={};this.loadVTLayers();let l=V(i.filterSpec,i.globalState);for(let i of e)this.loadMatchingFeature(c,n,r,i,l,a,o,s,t);return c}hasLayer(e){for(let t of this.bucketLayerIDs)for(let n of t)if(e===n)return!0;return!1}getId(e,t){var n;let r=e.id;return this.promoteId&&(r=e.properties[typeof this.promoteId==`string`?this.promoteId:this.promoteId[t]],typeof r==`boolean`&&(r=Number(r)),r===void 0&&(n=e.properties)!=null&&n.cluster&&this.promoteId&&(r=Number(e.properties.cluster_id))),r}}function Qm(e,t,n,r,i){return se(e,((e,a)=>{let o=t instanceof Ya?t.get(a):null;return o?.evaluate?o.evaluate(n,r,i):o}))}function $m(e,t){return t-e}function eh(e,t,r,i,a){let o=[];for(let s of e){let e;for(let c=0;c<s.length-1;c++){let l=s[c],u=s[c+1];l.x<t&&u.x<t||(l.x<t?l=new n(t,l.y+(t-l.x)/(u.x-l.x)*(u.y-l.y))._round():u.x<t&&(u=new n(t,l.y+(t-l.x)/(u.x-l.x)*(u.y-l.y))._round()),l.y<r&&u.y<r||(l.y<r?l=new n(l.x+(r-l.y)/(u.y-l.y)*(u.x-l.x),r)._round():u.y<r&&(u=new n(l.x+(r-l.y)/(u.y-l.y)*(u.x-l.x),r)._round()),l.x>=i&&u.x>=i||(l.x>=i?l=new n(i,l.y+(i-l.x)/(u.x-l.x)*(u.y-l.y))._round():u.x>=i&&(u=new n(i,l.y+(i-l.x)/(u.x-l.x)*(u.y-l.y))._round()),l.y>=a&&u.y>=a||(l.y>=a?l=new n(l.x+(a-l.y)/(u.y-l.y)*(u.x-l.x),a)._round():u.y>=a&&(u=new n(l.x+(a-l.y)/(u.y-l.y)*(u.x-l.x),a)._round()),e&&l.equals(e[e.length-1])||(e=[l],o.push(e)),e.push(u)))))}}return o}function th(e,t,n,r,i){switch(t){case 1:return function(e,t,n,r){let i=[];for(let a of e)for(let e of a){let a=r===0?e.x:e.y;a>=t&&a<=n&&i.push([e])}return i}(e,n,r,i);case 2:return rh(e,n,r,i,!1);case 3:return rh(e,n,r,i,!0)}return[]}function nh(e,t,r,i,a){let o=i===0?ih:ah,s=[],c=[];for(let n=0;n<e.length-1;n++){let l=e[n],u=e[n+1],d=i===0?l.x:l.y,f=i===0?u.x:u.y,p=!1;d<t?f>t&&s.push(o(l,u,t)):d>r?f<r&&s.push(o(l,u,r)):s.push(l),f<t&&d>=t&&(s.push(o(l,u,t)),p=!0),f>r&&d<=r&&(s.push(o(l,u,r)),p=!0),!a&&p&&(c.push(s),s=[])}let l=e.length-1,u=i===0?e[l].x:e[l].y;return u>=t&&u<=r&&s.push(e[l]),a&&s.length>0&&!s[0].equals(s[s.length-1])&&s.push(new n(s[0].x,s[0].y)),s.length>0&&c.push(s),c}function rh(e,t,n,r,i){let a=[];for(let o of e){let e=nh(o,t,n,r,i);e.length>0&&a.push(...e)}return a}function ih(e,t,r){return new n(r,e.y+(r-e.x)/(t.x-e.x)*(t.y-e.y))}function ah(e,t,r){return new n(e.x+(r-e.y)/(t.y-e.y)*(t.x-e.x),r)}K(`FeatureIndex`,Zm,{omit:[`rawTileData`,`sourceLayerCoder`]});class oh extends n{constructor(e,t,n,r){super(e,t),this.angle=n,r!==void 0&&(this.segment=r)}clone(){return new oh(this.x,this.y,this.angle,this.segment)}}function sh(e,t,n,r,i){if(t.segment===void 0||n===0)return!0;let a=t,o=t.segment+1,s=0;for(;s>-n/2;){if(o--,o<0)return!1;s-=e[o].dist(a),a=e[o]}s+=e[o].dist(e[o+1]),o++;let c=[],l=0;for(;s<n/2;){let t=e[o],n=e[o+1];if(!n)return!1;let a=e[o-1].angleTo(t)-t.angleTo(n);for(a=Math.abs((a+3*Math.PI)%(2*Math.PI)-Math.PI),c.push({distance:s,angleDelta:a}),l+=a;s-c[0].distance>r;)l-=c.shift().angleDelta;if(l>i)return!1;o++,s+=t.dist(n)}return!0}function ch(e){let t=0;for(let n=0;n<e.length-1;n++)t+=e[n].dist(e[n+1]);return t}function lh(e,t,n){return e?.6*t*n:0}function uh(e,t){return Math.max(e?e.right-e.left:0,t?t.right-t.left:0)}function dh(e,t,n,r,i,a){let o=lh(n,i,a),s=uh(n,r)*a,c=0,l=ch(e)/2;for(let n=0;n<e.length-1;n++){let r=e[n],i=e[n+1],a=r.dist(i);if(c+a>l){let u=(l-c)/a,d=Nn.number(r.x,i.x,u),f=Nn.number(r.y,i.y,u),p=new oh(d,f,i.angleTo(r),n);return p._round(),!o||sh(e,p,s,o,t)?p:void 0}c+=a}}function fh(e,t,n,r,i,a,o,s,c){let l=lh(r,a,o),u=uh(r,i),d=u*o,f=e[0].x===0||e[0].x===c||e[0].y===0||e[0].y===c;return t-d<t/4&&(t=d+t/4),ph(e,f?t/2*s%t:(u/2+2*a)*o*s%t,t,l,n,d,f,!1,c)}function ph(e,t,n,r,i,a,o,s,c){let l=a/2,u=ch(e),d=0,f=t-n,p=[];for(let t=0;t<e.length-1;t++){let o=e[t],s=e[t+1],m=o.dist(s),h=s.angleTo(o);for(;f+n<d+m;){f+=n;let g=(f-d)/m,_=Nn.number(o.x,s.x,g),v=Nn.number(o.y,s.y,g);if(_>=0&&_<c&&v>=0&&v<c&&f-l>=0&&f+l<=u){let n=new oh(_,v,h,t);n._round(),r&&!sh(e,n,a,r,i)||p.push(n)}}d+=m}return s||p.length||o||(p=ph(e,d/2,n,r,i,a,o,!0,c)),p}function mh(e,t,r,i){let a=[],o=e.image,s=o.pixelRatio,c=o.paddedRect.w-2,l=o.paddedRect.h-2,u={x1:e.left,y1:e.top,x2:e.right,y2:e.bottom},d=o.stretchX||[[0,c]],f=o.stretchY||[[0,l]],p=(e,t)=>e+t[1]-t[0],m=d.reduce(p,0),h=f.reduce(p,0),g=c-m,_=l-h,v=0,y=m,b=0,x=h,S=0,C=g,w=0,T=_;if(o.content&&i){let t=o.content,n=t[2]-t[0],r=t[3]-t[1];(o.textFitWidth||o.textFitHeight)&&(u=cf(e)),v=hh(d,0,t[0]),b=hh(f,0,t[1]),y=hh(d,t[0],t[2]),x=hh(f,t[1],t[3]),S=t[0]-v,w=t[1]-b,C=n-y,T=r-x}let E=u.x1,D=u.y1,O=u.x2-E,k=u.y2-D,A=(e,i,a,c)=>{let l=_h(e.stretch-v,y,O,E),u=vh(e.fixed-S,C,e.stretch,m),d=_h(i.stretch-b,x,k,D),f=vh(i.fixed-w,T,i.stretch,h),p=_h(a.stretch-v,y,O,E),g=vh(a.fixed-S,C,a.stretch,m),_=_h(c.stretch-b,x,k,D),A=vh(c.fixed-w,T,c.stretch,h),ee=new n(l,d),te=new n(p,d),ne=new n(p,_),re=new n(l,_),ie=new n(u/s,f/s),j=new n(g/s,A/s),M=t*Math.PI/180;if(M){let e=Math.sin(M),t=Math.cos(M),n=[t,-e,e,t];ee._matMult(n),te._matMult(n),re._matMult(n),ne._matMult(n)}let ae=e.stretch+e.fixed,oe=i.stretch+i.fixed;return{tl:ee,tr:te,bl:re,br:ne,tex:{x:o.paddedRect.x+1+ae,y:o.paddedRect.y+1+oe,w:a.stretch+a.fixed-ae,h:c.stretch+c.fixed-oe},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:ie,pixelOffsetBR:j,minFontScaleX:C/s/O,minFontScaleY:T/s/k,isSDF:r}};if(i&&(o.stretchX||o.stretchY)){let e=gh(d,g,m),t=gh(f,_,h);for(let n=0;n<e.length-1;n++){let r=e[n],i=e[n+1];for(let e=0;e<t.length-1;e++)a.push(A(r,t[e],i,t[e+1]))}}else a.push(A({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:c+1},{fixed:0,stretch:l+1}));return a}function hh(e,t,n){let r=0;for(let i of e)r+=Math.max(t,Math.min(n,i[1]))-Math.max(t,Math.min(n,i[0]));return r}function gh(e,t,n){let r=[{fixed:-1,stretch:0}];for(let[t,n]of e){let e=r[r.length-1];r.push({fixed:t-e.stretch,stretch:e.stretch}),r.push({fixed:t-e.stretch,stretch:e.stretch+(n-t)})}return r.push({fixed:t+1,stretch:n}),r}function _h(e,t,n,r){return e/t*n+r}function vh(e,t,n,r){return e-t*n/r}K(`Anchor`,oh);class yh{constructor(e,t,r,i,a,o,s,c,l,u){if(this.boxStartIndex=e.length,l){let e=o.top,t=o.bottom,n=o.collisionPadding;n&&(e-=n[1],t+=n[3]);let r=t-e;r>0&&(r=Math.max(10,r),this.circleDiameter=r)}else{let l=o.image?.content&&(o.image.textFitWidth||o.image.textFitHeight)?cf(o):{x1:o.left,y1:o.top,x2:o.right,y2:o.bottom};l.y1=l.y1*s-c[0],l.y2=l.y2*s+c[2],l.x1=l.x1*s-c[3],l.x2=l.x2*s+c[1];let d=o.collisionPadding;if(d&&(l.x1-=d[0]*s,l.y1-=d[1]*s,l.x2+=d[2]*s,l.y2+=d[3]*s),u){let e=new n(l.x1,l.y1),t=new n(l.x2,l.y1),r=new n(l.x1,l.y2),i=new n(l.x2,l.y2),a=u*Math.PI/180;e._rotate(a),t._rotate(a),r._rotate(a),i._rotate(a),l.x1=Math.min(e.x,t.x,r.x,i.x),l.x2=Math.max(e.x,t.x,r.x,i.x),l.y1=Math.min(e.y,t.y,r.y,i.y),l.y2=Math.max(e.y,t.y,r.y,i.y)}e.emplaceBack(t.x,t.y,l.x1,l.y1,l.x2,l.y2,r,i,a)}this.boxEndIndex=e.length}}class bh{constructor(e=[],t=(e,t)=>e<t?-1:+(e>t)){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;let e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:t,compare:n}=this,r=t[e];for(;e>0;){let i=e-1>>1,a=t[i];if(n(r,a)>=0)break;t[e]=a,e=i}t[e]=r}_down(e){let{data:t,compare:n}=this,r=this.length>>1,i=t[e];for(;e<r;){let r=1+(e<<1),a=r+1;if(a<this.length&&n(t[a],t[r])<0&&(r=a),n(t[r],i)>=0)break;t[e]=t[r],e=r}t[e]=i}}function xh(e,t=1){let r=qf.fromPoints(e[0]),i=Math.min(r.width(),r.height()),a=i/2,o=new bh([],Sh),{minX:s,minY:c,maxX:l,maxY:u}=r;if(i===0)return new n(s,c);for(let t=s;t<l;t+=i)for(let n=c;n<u;n+=i)o.push(new Ch(t+a,n+a,a,e));let d=function(e){let t=0,n=0,r=0,i=e[0];for(let e=0,a=i.length,o=a-1;e<a;o=e++){let a=i[e],s=i[o],c=a.x*s.y-s.x*a.y;n+=(a.x+s.x)*c,r+=(a.y+s.y)*c,t+=3*c}return new Ch(n/t,r/t,0,e)}(e),f=d;for(;o.length;){let n=o.pop();(n.d>f.d||!f.d)&&(f=n),n.max-f.d<=t||(a=n.h/2,o.push(new Ch(n.p.x-a,n.p.y-a,a,e)),o.push(new Ch(n.p.x+a,n.p.y-a,a,e)),o.push(new Ch(n.p.x-a,n.p.y+a,a,e)),o.push(new Ch(n.p.x+a,n.p.y+a,a,e)))}return d.d>0&&f.d-d.d<=t?d.p:f.p}function Sh(e,t){return t.max-e.max}class Ch{constructor(e,t,r,i){this.p=new n(e,t),this.h=r,this.d=function(e,t){let n=!1,r=1/0;for(let i of t)for(let t=0,a=i.length,o=a-1;t<a;o=t++){let a=i[t],s=i[o];a.y>e.y!=s.y>e.y&&e.x<(s.x-a.x)*(e.y-a.y)/(s.y-a.y)+a.x&&(n=!n),r=Math.min(r,nc(e,a,s))}return(n?1:-1)*Math.sqrt(r)}(this.p,i),this.max=this.d+this.h*Math.SQRT2}}var wh;e.aM=void 0,(wh=e.aM||={})[wh.center=1]=`center`,wh[wh.left=2]=`left`,wh[wh.right=3]=`right`,wh[wh.top=4]=`top`,wh[wh.bottom=5]=`bottom`,wh[wh[`top-left`]=6]=`top-left`,wh[wh[`top-right`]=7]=`top-right`,wh[wh[`bottom-left`]=8]=`bottom-left`,wh[wh[`bottom-right`]=9]=`bottom-right`;let Th=1/0;function Eh(e,t){return t[1]===Th?function(e,t){let n=0,r=0;t<0&&(t=0);let i=t/Math.SQRT2;switch(e){case`top-right`:case`top-left`:r=i-7;break;case`bottom-right`:case`bottom-left`:r=7-i;break;case`bottom`:r=7-t;break;case`top`:r=t-7}switch(e){case`top-right`:case`bottom-right`:n=-i;break;case`top-left`:case`bottom-left`:n=i;break;case`left`:n=t;break;case`right`:n=-t}return[n,r]}(e,t[0]):function(e,t,n){let r=0,i=0;switch(t=Math.abs(t),n=Math.abs(n),e){case`top-right`:case`top-left`:case`top`:i=n-7;break;case`bottom-right`:case`bottom-left`:case`bottom`:i=7-n}switch(e){case`top-right`:case`bottom-right`:case`right`:r=-t;break;case`top-left`:case`bottom-left`:case`left`:r=t}return[r,i]}(e,t[0],t[1])}function Dh(e,t,n){let r=e.layout,i=r.get(`text-variable-anchor-offset`)?.evaluate(t,{},n);if(i){let e=i.values,t=[];for(let n=0;n<e.length;n+=2){let r=t[n]=e[n],i=e[n+1].map((e=>e*Sd));r.startsWith(`top`)?i[1]-=7:r.startsWith(`bottom`)&&(i[1]+=7),t[n+1]=i}return new tn(t)}let a=r.get(`text-variable-anchor`);if(a){let i;i=e._unevaluatedLayout.getValue(`text-radial-offset`)===void 0?r.get(`text-offset`).evaluate(t,{},n).map((e=>e*Sd)):[r.get(`text-radial-offset`).evaluate(t,{},n)*Sd,Th];let o=[];for(let e of a)o.push(e,Eh(e,i));return new tn(o)}return null}function Oh(e){switch(e){case`right`:case`top-right`:case`bottom-right`:return`right`;case`left`:case`top-left`:case`bottom-left`:return`left`}return`center`}function kh(t,n,r,i,a,o,s,c,l,u,d,f){let p=o.textMaxSize.evaluate(n,{});p===void 0&&(p=s);let m=t.layers[0].layout,h=m.get(`icon-offset`).evaluate(n,{},d),g=jh(r.horizontal),_=s/24,v=t.tilePixelRatio*_,y=t.tilePixelRatio*p/24,b=t.tilePixelRatio*c,x=t.tilePixelRatio*m.get(`symbol-spacing`),S=m.get(`text-padding`)*t.tilePixelRatio,C=function(e,t,n,r=1){let i=e.get(`icon-padding`).evaluate(t,{},n)?.values;return[i[0]*r,i[1]*r,i[2]*r,i[3]*r]}(m,n,d,t.tilePixelRatio),w=m.get(`text-max-angle`)/180*Math.PI,T=m.get(`text-rotation-alignment`)!==`viewport`&&m.get(`symbol-placement`)!==`point`,E=m.get(`icon-rotation-alignment`)===`map`&&m.get(`symbol-placement`)!==`point`,D=m.get(`symbol-placement`),k=x/2,A=m.get(`icon-text-fit`),ee;i&&A!==`none`&&(t.allowVerticalPlacement&&r.vertical&&(ee=lf(i,r.vertical,A,m.get(`icon-text-fit-padding`),h,_)),g&&(i=lf(i,g,A,m.get(`icon-text-fit-padding`),h,_)));let te=d?f.line.getGranularityForZoomLevel(d.z):1,ne=(c,f)=>{f.x<0||f.x>=O||f.y<0||f.y>=O||function(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T){let E=t.addToLineVertexArray(n,r),D,O,k,A,ee=0,te=0,ne=0,re=0,ie=-1,j=-1,M={},ae=bs(``);if(t.allowVerticalPlacement&&i.vertical){let e=c.layout.get(`text-rotate`).evaluate(x,{},w)+90;k=new yh(l,n,u,d,f,i.vertical,p,m,h,e),s&&(A=new yh(l,n,u,d,f,s,_,v,h,e))}if(a){let r=c.layout.get(`icon-rotate`).evaluate(x,{}),i=c.layout.get(`icon-text-fit`)!==`none`,o=mh(a,r,C,i),p=s?mh(s,r,C,i):void 0;O=new yh(l,n,u,d,f,a,_,v,!1,r),ee=4*o.length;let m=t.iconSizeData,h=null;m.kind===`source`?(h=[128*c.layout.get(`icon-size`).evaluate(x,{})],h[0]>uf&&de(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):m.kind===`composite`&&(h=[128*S.compositeIconSizes[0].evaluate(x,{},w),128*S.compositeIconSizes[1].evaluate(x,{},w)],(h[0]>uf||h[1]>uf)&&de(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),t.addSymbols(t.icon,o,h,b,y,x,e.ax.none,n,E.lineStartIndex,E.lineLength,-1,w),ie=t.icon.placedSymbolArray.length-1,p&&(te=4*p.length,t.addSymbols(t.icon,p,h,b,y,x,e.ax.vertical,n,E.lineStartIndex,E.lineLength,-1,w),j=t.icon.placedSymbolArray.length-1)}let oe=Object.keys(i.horizontal);for(let r of oe){let a=i.horizontal[r];if(!D){ae=bs(a.text);let e=c.layout.get(`text-rotate`).evaluate(x,{},w);D=new yh(l,n,u,d,f,a,p,m,h,e)}let s=a.positionedLines.length===1;if(ne+=Ah(t,n,a,o,c,h,x,g,E,i.vertical?e.ax.horizontal:e.ax.horizontalOnly,s?oe:[r],M,ie,S,w),s)break}i.vertical&&(re+=Ah(t,n,i.vertical,o,c,h,x,g,E,e.ax.vertical,[`vertical`],M,j,S,w));let se=D?D.boxStartIndex:t.collisionBoxArray.length,ce=D?D.boxEndIndex:t.collisionBoxArray.length,le=k?k.boxStartIndex:t.collisionBoxArray.length,ue=k?k.boxEndIndex:t.collisionBoxArray.length,fe=O?O.boxStartIndex:t.collisionBoxArray.length,pe=O?O.boxEndIndex:t.collisionBoxArray.length,me=A?A.boxStartIndex:t.collisionBoxArray.length,he=A?A.boxEndIndex:t.collisionBoxArray.length,ge=-1,_e=(e,t)=>e?.circleDiameter?Math.max(e.circleDiameter,t):t;ge=_e(D,ge),ge=_e(k,ge),ge=_e(O,ge),ge=_e(A,ge);let ve=+(ge>-1);ve&&(ge*=T/Sd),t.glyphOffsetArray.length>=yf.MAX_GLYPHS&&de(`Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907`),x.sortKey!==void 0&&t.addToSortKeyRanges(t.symbolInstances.length,x.sortKey);let ye=Dh(c,x,w),[be,xe]=function(t,n){let r=t.length,i=n?.values;if(i?.length>0)for(let n=0;n<i.length;n+=2){let r=i[n+1];t.emplaceBack(e.aM[i[n]],r[0],r[1])}return[r,t.length]}(t.textAnchorOffsets,ye);t.symbolInstances.emplaceBack(n.x,n.y,M.right>=0?M.right:-1,M.center>=0?M.center:-1,M.left>=0?M.left:-1,M.vertical||-1,ie,j,ae,se,ce,le,ue,fe,pe,me,he,u,ne,re,ee,te,ve,0,p,ge,be,xe)}(t,f,c,r,i,a,ee,t.layers[0],t.collisionBoxArray,n.index,n.sourceLayerIndex,t.index,v,[S,S,S,S],T,l,b,C,E,h,n,o,u,d,s)};if(D===`line`)for(let e of eh(n.geometry,0,0,O,O)){let n=Sl(e,te),a=fh(n,x,w,r.vertical||g,i,24,y,t.overscaling,O);for(let e of a)g&&Mh(t,g.text,k,e)||ne(n,e)}else if(D===`line-center`){for(let e of n.geometry)if(e.length>1){let t=Sl(e,te),n=dh(t,w,r.vertical||g,i,24,y);n&&ne(t,n)}}else if(n.type===`Polygon`)for(let e of L(n.geometry,0)){let t=xh(e,16);ne(Sl(e[0],te,!0),new oh(t.x,t.y,0))}else if(n.type===`LineString`)for(let e of n.geometry){let t=Sl(e,te);ne(t,new oh(t[0].x,t[0].y,0))}else if(n.type===`Point`)for(let e of n.geometry)for(let t of e)ne([t],new oh(t.x,t.y,0))}function Ah(e,t,r,i,a,o,s,c,l,u,d,f,p,m,h){let g=function(e,t,r,i,a,o,s,c){let l=i.layout.get(`text-rotate`).evaluate(o,{})*Math.PI/180,u=[];for(let e of t.positionedLines)for(let i of e.positionedGlyphs){if(!i.rect)continue;let o=i.rect||{},d=4,f=!0,p=1,m=0,h=(a||c)&&i.vertical,g=i.metrics.advance*i.scale/2;if(c&&t.verticalizable&&(m=e.lineOffset/2-(i.imageName?-(Sd-i.metrics.width*i.scale)/2:(i.scale-1)*Sd)),i.imageName){let e=s[i.imageName];f=e.sdf,p=e.pixelRatio,d=1/p}let _=a?[i.x+g,i.y]:[0,0],v=a?[0,0]:[i.x+g+r[0],i.y+r[1]-m],y=[0,0];h&&(y=v,v=[0,0]);let b=i.metrics.isDoubleResolution?2:1,x=(i.metrics.left-d)*i.scale-g+v[0],S=(-i.metrics.top-d)*i.scale+v[1],C=x+o.w/b*i.scale/p,w=S+o.h/b*i.scale/p,T=new n(x,S),E=new n(C,S),D=new n(x,w),O=new n(C,w);if(h){let e=new n(-g,g- -17),t=-Math.PI/2,r=12-g,a=new n(22-r,-(i.imageName?r:0)),o=new n(...y);T._rotateAround(t,e)._add(a)._add(o),E._rotateAround(t,e)._add(a)._add(o),D._rotateAround(t,e)._add(a)._add(o),O._rotateAround(t,e)._add(a)._add(o)}if(l){let e=Math.sin(l),t=Math.cos(l),n=[t,-e,e,t];T._matMult(n),E._matMult(n),D._matMult(n),O._matMult(n)}let k=new n(0,0),A=new n(0,0);u.push({tl:T,tr:E,bl:D,br:O,tex:o,writingMode:t.writingMode,glyphOffset:_,sectionIndex:i.sectionIndex,isSDF:f,pixelOffsetTL:k,pixelOffsetBR:A,minFontScaleX:0,minFontScaleY:0})}return u}(0,r,c,a,o,s,i,e.allowVerticalPlacement),_=e.textSizeData,v=null;_.kind===`source`?(v=[128*a.layout.get(`text-size`).evaluate(s,{})],v[0]>uf&&de(`${e.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):_.kind===`composite`&&(v=[128*m.compositeTextSizes[0].evaluate(s,{},h),128*m.compositeTextSizes[1].evaluate(s,{},h)],(v[0]>uf||v[1]>uf)&&de(`${e.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),e.addSymbols(e.text,g,v,c,o,s,u,t,l.lineStartIndex,l.lineLength,p,h);for(let t of d)f[t]=e.text.placedSymbolArray.length-1;return 4*g.length}function jh(e){for(let t in e)return e[t];return null}function Mh(e,t,n,r){let i=e.compareText;if(t in i){let e=i[t];for(let t=e.length-1;t>=0;t--)if(r.dist(e[t])<n)return!0}else i[t]=[];return i[t].push(r),!1}e.$=De,e.A=f,e.B=Va,e.C=ga,e.D=q,e.E=Be,e.F=fa,e.G=function([e,t,n]){return t+=90,t*=Math.PI/180,n*=Math.PI/180,{x:e*Math.cos(t)*Math.sin(n),y:e*Math.sin(t)*Math.sin(n),z:e*Math.cos(n)}},e.H=Nn,e.I=Yd,e.J=za,e.K=ma,e.L=function(e){if(me==null){let t=e.navigator?e.navigator.userAgent:null;me=!!e.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match(`Safari`)&&!t.match(`Chrome`)))}return me},e.M=je,e.N=class{constructor(e,t){this.target=e,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new kf((()=>this.process())),this.subscription=be(this.target,`message`,(e=>this.receive(e)),!1),this.globalScope=pe(self)?e:window}registerMessageHandler(e,t){this.messageHandlers[e]=t}unregisterMessageHandler(e){delete this.messageHandlers[e]}sendAsync(e,t){return new Promise(((n,r)=>{let i=Math.round(0xde0b6b3a7640000*Math.random()).toString(36).substring(0,10),a=t?be(t.signal,`abort`,(()=>{a?.unsubscribe(),delete this.resolveRejects[i];let t={id:i,type:`<cancel>`,origin:location.origin,targetMapId:e.targetMapId,sourceMapId:this.mapId};this.target.postMessage(t)}),Af):null;this.resolveRejects[i]={resolve:e=>{a?.unsubscribe(),n(e)},reject:e=>{a?.unsubscribe(),r(e)}};let o=[],s=Object.assign(Object.assign({},e),{id:i,sourceMapId:this.mapId,origin:location.origin,data:Sa(e.data,o)});this.target.postMessage(s,{transfer:o})}))}receive(e){let t=e.data,n=t.id,r=[`file://`,`resource://android`,`null`],i=[t.origin,location.origin],a=t.origin===location.origin,o=i.some((e=>r.includes(e)));if((a||o)&&(!t.targetMapId||this.mapId===t.targetMapId)){if(t.type===`<cancel>`){delete this.tasks[n];let e=this.abortControllers[n];delete this.abortControllers[n],e&&e.abort();return}if(pe(self)||t.mustQueue)return this.tasks[n]=t,this.taskQueue.push(n),void this.invoker.trigger();this.processTask(n,t)}}process(){if(this.taskQueue.length===0)return;let e=this.taskQueue.shift(),t=this.tasks[e];delete this.tasks[e],this.taskQueue.length>0&&this.invoker.trigger(),t&&this.processTask(e,t)}processTask(e,n){return t(this,void 0,void 0,(function*(){if(n.type===`<response>`){let t=this.resolveRejects[e];if(delete this.resolveRejects[e],!t)return;n.error?t.reject(A(Ca(n.error))):t.resolve(Ca(n.data));return}if(!this.messageHandlers[n.type])return void this.completeTask(e,Error(`Could not find a registered handler for ${n.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(`, `)}`));let t=Ca(n.data),r=new AbortController;this.abortControllers[e]=r;try{let i=yield this.messageHandlers[n.type](n.sourceMapId,t,r);this.completeTask(e,null,i)}catch(t){this.completeTask(e,A(t))}}))}completeTask(e,t,n){let r=[];delete this.abortControllers[e];let i={id:e,type:`<response>`,sourceMapId:this.mapId,origin:location.origin,error:t?Sa(t):null,data:Sa(n,r)};this.target.postMessage(i,{transfer:r})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},e.O=function(){var e=new f(16);return f!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e},e.P=n,e.Q=function(e,t,n){var r,i,a,o,s,c,l,u,d,f,p,m,h=n[0],g=n[1],_=n[2];return t===e?(e[12]=t[0]*h+t[4]*g+t[8]*_+t[12],e[13]=t[1]*h+t[5]*g+t[9]*_+t[13],e[14]=t[2]*h+t[6]*g+t[10]*_+t[14],e[15]=t[3]*h+t[7]*g+t[11]*_+t[15]):(i=t[1],a=t[2],o=t[3],s=t[4],c=t[5],l=t[6],u=t[7],d=t[8],f=t[9],p=t[10],m=t[11],e[0]=r=t[0],e[1]=i,e[2]=a,e[3]=o,e[4]=s,e[5]=c,e[6]=l,e[7]=u,e[8]=d,e[9]=f,e[10]=p,e[11]=m,e[12]=r*h+s*g+d*_+t[12],e[13]=i*h+c*g+f*_+t[13],e[14]=a*h+l*g+p*_+t[14],e[15]=o*h+u*g+m*_+t[15]),e},e.R=Dc,e.S=function(e,t,n){var r=n[0],i=n[1],a=n[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*a,e[9]=t[9]*a,e[10]=t[10]*a,e[11]=t[11]*a,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},e.T=Rc,e.U=function(e,t,n){var r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5],l=t[6],u=t[7],d=t[8],f=t[9],p=t[10],m=t[11],h=t[12],g=t[13],_=t[14],v=t[15],y=n[0],b=n[1],x=n[2],S=n[3];return e[0]=y*r+b*s+x*d+S*h,e[1]=y*i+b*c+x*f+S*g,e[2]=y*a+b*l+x*p+S*_,e[3]=y*o+b*u+x*m+S*v,e[4]=(y=n[4])*r+(b=n[5])*s+(x=n[6])*d+(S=n[7])*h,e[5]=y*i+b*c+x*f+S*g,e[6]=y*a+b*l+x*p+S*_,e[7]=y*o+b*u+x*m+S*v,e[8]=(y=n[8])*r+(b=n[9])*s+(x=n[10])*d+(S=n[11])*h,e[9]=y*i+b*c+x*f+S*g,e[10]=y*a+b*l+x*p+S*_,e[11]=y*o+b*u+x*m+S*v,e[12]=(y=n[12])*r+(b=n[13])*s+(x=n[14])*d+(S=n[15])*h,e[13]=y*i+b*c+x*f+S*g,e[14]=y*a+b*l+x*p+S*_,e[15]=y*o+b*u+x*m+S*v,e},e.V=function(e,t){let n={};for(let r of t)r in e&&(n[r]=e[r]);return n},e.W=Mf,e.X=M,e.Y=If,e.Z=Ff,e._=t,e.a=Ee,e.a$=function(e){var t=new f(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t},e.a0=l,e.a1=u,e.a2=_e,e.a3=Gf,e.a4=Rf,e.a5=zf,e.a6=O,e.a7=Vf,e.a8=qf,e.a9=25,e.aA=function(e){var t=e[0],n=e[1];return Math.sqrt(t*t+n*n)},e.aB=function(e){return e[0]=0,e[1]=0,e},e.aC=function(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e},e.aD=hf,e.aE=C,e.aF=function(e,t,r,i){let a=t.y-e.y,o=t.x-e.x,s=i.y-r.y,c=i.x-r.x,l=s*o-c*a;if(l===0)return null;let u=(c*(e.y-r.y)-s*(e.x-r.x))/l;return new n(e.x+u*o,e.y+u*a)},e.aG=eh,e.aH=Ys,e.aI=function(e){let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let a of e)t=Math.min(t,a.x),n=Math.min(n,a.y),r=Math.max(r,a.x),i=Math.max(i,a.y);return[t,n,r,i]},e.aJ=Sd,e.aK=k,e.aL=function(e,t,n,r,i=!1){if(!n[0]&&!n[1])return[0,0];let a=i?r===`map`?-e.bearingInRadians:0:r===`viewport`?e.bearingInRadians:0;if(a){let e=Math.sin(a),t=Math.cos(a);n=[n[0]*t-n[1]*e,n[0]*e+n[1]*t]}return[i?n[0]:k(t,n[0],e.zoom),i?n[1]:k(t,n[1],e.zoom)]},e.aN=ff,e.aO=Oh,e.aP=$d,e.aQ=e=>e.type===`symbol`,e.aR=eu,e.aS=lo,e.aT=_l,e.aU=Jo,e.aV=us,e.aW=ss,e.aX=Se,e.aY=Bf,e.aZ=y,e.a_=v,e.aa=Uf,e.ab=e=>{let t=window.document.createElement(`video`);return t.muted=!0,new Promise((n=>{t.onloadstart=()=>{n(t)};for(let n of e){let e=window.document.createElement(`source`);Fe(n)||(t.crossOrigin=`Anonymous`),e.src=n,t.appendChild(e)}}))},e.ac=P,e.ad=function(){return oe++},e.ae=Lo,e.af=yf,e.ag=Um,e.ah=V,e.ai=Gs,e.aj=Yf,e.ak=function(e){let t={};if(e.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((e,n,r,i)=>{let a=r||i;return t[n]=!a||a.toLowerCase(),``})),t[`max-age`]){let e=parseInt(t[`max-age`],10);isNaN(e)?delete t[`max-age`]:t[`max-age`]=e}return t},e.al=j,e.am=85.051129,e.an=xe,e.ao=function(e){return 2**e},e.ap=m,e.aq=Lf,e.ar=function(e){return Math.log(e)/Math.LN2},e.as=function(e){var t=e[0],n=e[1];return t*t+n*n},e.at=function(e){if(!e.length)return new Set;let t=Math.max(...e.map((e=>e.canonical.z))),n=1/0,r=-1/0,i=1/0,a=-1/0,o=[];for(let s of e){let{x:e,y:c,z:l}=s.canonical,u=2**(t-l),d=e*u,f=c*u;o.push({id:s,x:d,y:f}),d<n&&(n=d),d>r&&(r=d),f<i&&(i=f),f>a&&(a=f)}let s=new Set;for(let e of o)e.x!==n&&e.x!==r&&e.y!==i&&e.y!==a||s.add(e.id);return s},e.au=function(e,t){let n=Math.abs(2*e.wrap)-+(e.wrap<0),r=Math.abs(2*t.wrap)-+(t.wrap<0);return e.overscaledZ-t.overscaledZ||r-n||t.canonical.y-e.canonical.y||t.canonical.x-e.canonical.x},e.av=class{constructor(e,t){this.max=e,this.onRemove=t,this.reset()}reset(){for(let e in this.data)for(let t of this.data[e])t.timeout&&clearTimeout(t.timeout),this.onRemove(t.value);return this.data={},this.order=[],this}add(e,t,n){let r=e.wrapped().key;this.data[r]===void 0&&(this.data[r]=[]);let i={value:t,timeout:void 0};if(n!==void 0&&(i.timeout=setTimeout((()=>{this.remove(e,i)}),n)),this.data[r].push(i),this.order.push(r),this.order.length>this.max){let e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){let t=this.data[e].shift();return t.timeout&&clearTimeout(t.timeout),this.data[e].length===0&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),t.value}getByKey(e){let t=this.data[e];return t?t[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,t){if(!this.has(e))return this;let n=e.wrapped().key,r=t===void 0?0:this.data[n].indexOf(t),i=this.data[n][r];return this.data[n].splice(r,1),i.timeout&&clearTimeout(i.timeout),this.data[n].length===0&&delete this.data[n],this.onRemove(i.value),this.order.splice(this.order.indexOf(n),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){let e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}filter(e){let t=[];for(let n in this.data)for(let r of this.data[n])e(r.value)||t.push(r);for(let e of t)this.remove(e.value.tileID,e)}},e.aw=function(e,t){let n=0,r=0;if(e.kind===`constant`)r=e.layoutSize;else if(e.kind!==`source`){let{interpolationType:i,minZoom:a,maxZoom:o}=e,s=i?j(jn.interpolationFactor(i,t,a,o),0,1):0;e.kind===`camera`?r=Nn.number(e.minSize,e.maxSize,s):n=s}return{uSizeT:n,uSize:r}},e.ay=function(e,{uSize:t,uSizeT:n},{lowerSize:r,upperSize:i}){return e.kind===`source`?r/128:e.kind===`composite`?Nn.number(r/128,i/128,n):t},e.az=E,e.b=he,e.b$=Os,e.b0=function(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e},e.b1=function(e,t){var n=t[0],r=t[1],i=t[2],a=n*n+r*r+i*i;return a>0&&(a=1/Math.sqrt(a)),e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a,e},e.b2=b,e.b3=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]},e.b4=function(e,t,n){return e[0]=t[0]*n[0],e[1]=t[1]*n[1],e[2]=t[2]*n[2],e[3]=t[3]*n[3],e},e.b5=g,e.b6=function(e,t,n){let r=t[0]*n[0]+t[1]*n[1]+t[2]*n[2];return r===0?null:(-(e[0]*n[0]+e[1]*n[1]+e[2]*n[2])-n[3])/r},e.b7=S,e.b8=function(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e},e.b9=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]},e.bA=T,e.bB=function(e,t,n){var r=n[0],i=n[1],a=n[2],o=n[3],s=t[0],c=t[1],l=t[2],u=i*l-a*c,d=a*s-r*l,f=r*c-i*s;return e[0]=s+o*(u+=u)+i*(f+=f)-a*(d+=d),e[1]=c+o*d+a*u-r*f,e[2]=l+o*f+r*d-i*u,e},e.bC=function(e,t,n){let r=(i=[e[0],e[1],e[2],t[0],t[1],t[2],n[0],n[1],n[2]])[0]*((u=i[8])*(o=i[4])-(s=i[5])*(l=i[7]))+i[1]*(-u*(a=i[3])+s*(c=i[6]))+i[2]*(l*a-o*c);var i,a,o,s,c,l,u;if(r===0)return null;let d=b([],[t[0],t[1],t[2]],[n[0],n[1],n[2]]),f=b([],[n[0],n[1],n[2]],[e[0],e[1],e[2]]),p=b([],[e[0],e[1],e[2]],[t[0],t[1],t[2]]),m=y([],d,-e[3]);return v(m,m,y([],f,-t[3])),v(m,m,y([],p,-n[3])),y(m,m,1/r),m},e.bD=jf,e.bE=function(){return new Float64Array(4)},e.bF=function(e,t,n,r){var i=[],a=[];return i[0]=t[0]-n[0],i[1]=t[1]-n[1],i[2]=t[2]-n[2],a[0]=i[0]*Math.cos(r)-i[1]*Math.sin(r),a[1]=i[0]*Math.sin(r)+i[1]*Math.cos(r),a[2]=i[2],e[0]=a[0]+n[0],e[1]=a[1]+n[1],e[2]=a[2]+n[2],e},e.bG=function(e,t,n,r){var i=[],a=[];return i[0]=t[0]-n[0],i[1]=t[1]-n[1],i[2]=t[2]-n[2],a[0]=i[0],a[1]=i[1]*Math.cos(r)-i[2]*Math.sin(r),a[2]=i[1]*Math.sin(r)+i[2]*Math.cos(r),e[0]=a[0]+n[0],e[1]=a[1]+n[1],e[2]=a[2]+n[2],e},e.bH=function(e,t,n,r){var i=[],a=[];return i[0]=t[0]-n[0],i[1]=t[1]-n[1],i[2]=t[2]-n[2],a[0]=i[2]*Math.sin(r)+i[0]*Math.cos(r),a[1]=i[1],a[2]=i[2]*Math.cos(r)-i[0]*Math.sin(r),e[0]=a[0]+n[0],e[1]=a[1]+n[1],e[2]=a[2]+n[2],e},e.bI=function(e,t,n){var r=Math.sin(n),i=Math.cos(n),a=t[0],o=t[1],s=t[2],c=t[3],l=t[8],u=t[9],d=t[10],f=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=a*i-l*r,e[1]=o*i-u*r,e[2]=s*i-d*r,e[3]=c*i-f*r,e[8]=a*r+l*i,e[9]=o*r+u*i,e[10]=s*r+d*i,e[11]=c*r+f*i,e},e.bJ=function(e,t){let n=ee(e,360),r=ee(t,360),i=r-n,a=r>n?i-360:i+360;return Math.abs(i)<Math.abs(a)?i:a},e.bK=function(e){return e[0]=0,e[1]=0,e[2]=0,e},e.bL=function(e,t,n,r){let i=Math.sqrt(e*e+t*t),a=Math.sqrt(n*n+r*r);e/=i,t/=i,n/=a,r/=a;let o=Math.acos(e*n+t*r);return-t*n+e*r>0?o:-o},e.bM=function(e,t){let n=ee(e,2*Math.PI),r=ee(t,2*Math.PI);return Math.min(Math.abs(n-r),Math.abs(n-r+2*Math.PI),Math.abs(n-r-2*Math.PI))},e.bN=function(){let e={},t=N.$version;for(let n in N.$root){let r=N.$root[n];if(r.required){let i=null;i=n===`version`?t:r.type===`array`?[]:{},i!=null&&(e[n]=i)}}return e},e.bO=Ne,e.bP=wa,e.bQ=function e(t,n){if(Array.isArray(t)){if(!Array.isArray(n)||t.length!==n.length)return!1;for(let r=0;r<t.length;r++)if(!e(t[r],n[r]))return!1;return!0}if(typeof t==`object`&&t&&n!==null){if(typeof n!=`object`||Object.keys(t).length!==Object.keys(n).length)return!1;for(let r in t)if(!e(t[r],n[r]))return!1;return!0}return t===n},e.bR=Oe,e.bS=function(e){e=e.slice();let t=Object.create(null);for(let n=0;n<e.length;n++)t[e[n].id]=e[n];for(let n=0;n<e.length;n++)`ref`in e[n]&&(e[n]=He(e[n],t[e[n].ref]));return e},e.bT=function(e,t){if(e.type===`custom`)return new Of(e,t);switch(e.type){case`background`:return new Df(e,t);case`circle`:return new yc(e,t);case`color-relief`:return new Vc(e,t);case`fill`:return new Al(e,t);case`fill-extrusion`:return new Xl(e,t);case`heatmap`:return new jc(e,t);case`hillshade`:return new Pc(e,t);case`line`:return new pd(e,t);case`raster`:return new ao(e,t);case`symbol`:return new wf(e,t)}},e.bU=e=>e.type===`raster`,e.bV=le,e.bW=function(e,t){if(!e)return[{command:`setStyle`,args:[t]}];let n=[];try{if(!Ue(e.version,t.version))return[{command:`setStyle`,args:[t]}];Ue(e.center,t.center)||n.push({command:`setCenter`,args:[t.center]}),Ue(e.state,t.state)||n.push({command:`setGlobalState`,args:[t.state]}),Ue(e.centerAltitude,t.centerAltitude)||n.push({command:`setCenterAltitude`,args:[t.centerAltitude]}),Ue(e.zoom,t.zoom)||n.push({command:`setZoom`,args:[t.zoom]}),Ue(e.bearing,t.bearing)||n.push({command:`setBearing`,args:[t.bearing]}),Ue(e.pitch,t.pitch)||n.push({command:`setPitch`,args:[t.pitch]}),Ue(e.roll,t.roll)||n.push({command:`setRoll`,args:[t.roll]}),Ue(e.sprite,t.sprite)||n.push({command:`setSprite`,args:[t.sprite]}),Ue(e.glyphs,t.glyphs)||n.push({command:`setGlyphs`,args:[t.glyphs]}),Ue(e.transition,t.transition)||n.push({command:`setTransition`,args:[t.transition]}),Ue(e.light,t.light)||n.push({command:`setLight`,args:[t.light]}),Ue(e.terrain,t.terrain)||n.push({command:`setTerrain`,args:[t.terrain]}),Ue(e.sky,t.sky)||n.push({command:`setSky`,args:[t.sky]}),Ue(e.projection,t.projection)||n.push({command:`setProjection`,args:[t.projection]});let r={},i=[];(function(e,t,n,r){let i;for(i in t||={},e||={})Object.prototype.hasOwnProperty.call(e,i)&&(Object.prototype.hasOwnProperty.call(t,i)||Ke(i,n,r));for(i in t)Object.prototype.hasOwnProperty.call(t,i)&&(Object.prototype.hasOwnProperty.call(e,i)?Ue(e[i],t[i])||(e[i].type===`geojson`&&t[i].type===`geojson`&&Je(e,t,i)?We(n,{command:`setGeoJSONSourceData`,args:[i,t[i].data]}):qe(i,t,n,r)):Ge(i,t,n))})(e.sources,t.sources,i,r);let a=[];e.layers&&e.layers.forEach((e=>{`source`in e&&r[e.source]?n.push({command:`removeLayer`,args:[e.id]}):a.push(e)})),n=n.concat(i),function(e,t,n){t||=[];let r=(e||=[]).map(Xe),i=t.map(Xe),a=e.reduce(Ze,{}),o=t.reduce(Ze,{}),s=r.slice(),c=Object.create(null),l,u,d,f,p;for(let e=0,t=0;e<r.length;e++)l=r[e],Object.prototype.hasOwnProperty.call(o,l)?t++:(We(n,{command:`removeLayer`,args:[l]}),s.splice(s.indexOf(l,t),1));for(let e=0,t=0;e<i.length;e++)l=i[i.length-1-e],s[s.length-1-e]!==l&&(Object.prototype.hasOwnProperty.call(a,l)?(We(n,{command:`removeLayer`,args:[l]}),s.splice(s.lastIndexOf(l,s.length-t),1)):t++,f=s[s.length-e],We(n,{command:`addLayer`,args:[o[l],f]}),s.splice(s.length-e,0,l),c[l]=!0);for(let e=0;e<i.length;e++)if(l=i[e],u=a[l],d=o[l],!c[l]&&!Ue(u,d))if(Ue(u.source,d.source)&&Ue(u[`source-layer`],d[`source-layer`])&&Ue(u.type,d.type)){for(p in Ye(u.layout,d.layout,n,l,null,`setLayoutProperty`),Ye(u.paint,d.paint,n,l,null,`setPaintProperty`),Ue(u.filter,d.filter)||We(n,{command:`setFilter`,args:[l,d.filter]}),Ue(u.minzoom,d.minzoom)&&Ue(u.maxzoom,d.maxzoom)||We(n,{command:`setLayerZoomRange`,args:[l,d.minzoom,d.maxzoom]}),u)Object.prototype.hasOwnProperty.call(u,p)&&p!==`layout`&&p!==`paint`&&p!==`filter`&&p!==`metadata`&&p!==`minzoom`&&p!==`maxzoom`&&(p.indexOf(`paint.`)===0?Ye(u[p],d[p],n,l,p.slice(6),`setPaintProperty`):Ue(u[p],d[p])||We(n,{command:`setLayerProperty`,args:[l,p,d[p]]}));for(p in d)Object.prototype.hasOwnProperty.call(d,p)&&!Object.prototype.hasOwnProperty.call(u,p)&&p!==`layout`&&p!==`paint`&&p!==`filter`&&p!==`metadata`&&p!==`minzoom`&&p!==`maxzoom`&&(p.indexOf(`paint.`)===0?Ye(u[p],d[p],n,l,p.slice(6),`setPaintProperty`):Ue(u[p],d[p])||We(n,{command:`setLayerProperty`,args:[l,p,d[p]]}))}else We(n,{command:`removeLayer`,args:[l]}),f=s[s.lastIndexOf(l)+1],We(n,{command:`addLayer`,args:[d,f]})}(a,t.layers,n)}catch(e){console.warn(`Unable to compute style diff:`,e),n=[{command:`setStyle`,args:[t]}]}return n},e.bX=function(e){let t=[],n=e.id;return n===void 0&&t.push({message:`layers.${n}: missing required property "id"`}),e.render===void 0&&t.push({message:`layers.${n}: missing required method "render"`}),e.renderingMode&&e.renderingMode!==`2d`&&e.renderingMode!==`3d`&&t.push({message:`layers.${n}: property "renderingMode" must be either "2d" or "3d"`}),t},e.bY=se,e.bZ=ce,e.b_=class extends Ts{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1i(this.location,e))}},e.ba=Wf,e.bb=Kf,e.bc=function(e,t,n,r,i){var a=1/Math.tan(t/2);if(e[0]=a/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,i!=null&&i!==1/0){var o=1/(r-i);e[10]=(i+r)*o,e[14]=2*i*r*o}else e[10]=-1,e[14]=-2*r;return e},e.bd=function(e){var t=new f(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],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},e.be=function(e,t,n){var r=Math.sin(n),i=Math.cos(n),a=t[0],o=t[1],s=t[2],c=t[3],l=t[4],u=t[5],d=t[6],f=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=a*i+l*r,e[1]=o*i+u*r,e[2]=s*i+d*r,e[3]=c*i+f*r,e[4]=l*i-a*r,e[5]=u*i-o*r,e[6]=d*i-s*r,e[7]=f*i-c*r,e},e.bf=function(e,t,n){var r=Math.sin(n),i=Math.cos(n),a=t[4],o=t[5],s=t[6],c=t[7],l=t[8],u=t[9],d=t[10],f=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=a*i+l*r,e[5]=o*i+u*r,e[6]=s*i+d*r,e[7]=c*i+f*r,e[8]=l*i-a*r,e[9]=u*i-o*r,e[10]=d*i-s*r,e[11]=f*i-c*r,e},e.bg=function(e,t){var n=t[0],r=t[1],i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12],h=t[13],g=t[14],_=t[15],v=n*s-r*o,y=n*c-i*o,b=n*l-a*o,x=r*c-i*s,S=r*l-a*s,C=i*l-a*c,w=u*h-d*m,T=u*g-f*m,E=u*_-p*m,D=d*g-f*h,O=d*_-p*h,k=f*_-p*g,A=v*k-y*O+b*D+x*E-S*T+C*w;return A?(e[0]=(s*k-c*O+l*D)*(A=1/A),e[1]=(i*O-r*k-a*D)*A,e[2]=(h*C-g*S+_*x)*A,e[3]=(f*S-d*C-p*x)*A,e[4]=(c*E-o*k-l*T)*A,e[5]=(n*k-i*E+a*T)*A,e[6]=(g*b-m*C-_*y)*A,e[7]=(u*C-f*b+p*y)*A,e[8]=(o*O-s*E+l*w)*A,e[9]=(r*E-n*O-a*w)*A,e[10]=(m*S-h*b+_*v)*A,e[11]=(d*b-u*S-p*v)*A,e[12]=(s*T-o*D-c*w)*A,e[13]=(n*D-r*T+i*w)*A,e[14]=(h*y-m*x-g*v)*A,e[15]=(u*x-d*y+f*v)*A,e):null},e.bh=function(){let e=new Float32Array(16);return m(e),e},e.bi=function(){let e=new Float64Array(16);return m(e),e},e.bj=function(){return new Float64Array(16)},e.bk=function(e,t,n){let r=new Float64Array(4);return T(r,e,t-90,n),r},e.bl=function(e,t,n,r){var i,a,o,s,c,l=t[0],u=t[1],f=t[2],p=t[3],m=n[0],h=n[1],g=n[2],_=n[3];return(a=l*m+u*h+f*g+p*_)<0&&(a=-a,m=-m,h=-h,g=-g,_=-_),1-a>d?(i=Math.acos(a),o=Math.sin(i),s=Math.sin((1-r)*i)/o,c=Math.sin(r*i)/o):(s=1-r,c=r),e[0]=s*l+c*m,e[1]=s*u+c*h,e[2]=s*f+c*g,e[3]=s*p+c*_,e},e.bm=function(e){let t=new Float64Array(9);var n,r,i,a,o,s,c,l,u,d=(i=(r=e)[0])*(c=i+i),f=(a=r[1])*c,p,m=(o=r[2])*c,h=o*(l=a+a),g,_=(s=r[3])*c,v=s*l,y=s*(u=o+o);(n=t)[0]=1-(p=a*l)-(g=o*u),n[3]=f-y,n[6]=m+v,n[1]=f+y,n[4]=1-d-g,n[7]=h-_,n[2]=m-v,n[5]=h+_,n[8]=1-d-p;let b=Se(-Math.asin(j(t[2],-1,1))),x,S;return Math.hypot(t[5],t[8])<.001?(x=0,S=-Se(Math.atan2(t[3],t[4]))):(x=Se(t[5]===0&&t[8]===0?0:Math.atan2(t[5],t[8])),S=Se(t[1]===0&&t[0]===0?0:Math.atan2(t[1],t[0]))),{roll:x,pitch:b+90,bearing:S}},e.bn=function(e,t){return e.roll==t.roll&&e.pitch==t.pitch&&e.bearing==t.bearing},e.bo=Gt,e.bp=Es,e.bq=vl,e.br=yl,e.bs=gl,e.bt=te,e.bu=ne,e.bv=rn,e.bw=function(e,t,n,r,i){return te(r,i,j((e-t)/(n-t),0,1))},e.bx=function(e,t,n,r){return e[0]=t[0]+n[0]*r,e[1]=t[1]+n[1]*r,e[2]=t[2]+n[2]*r,e},e.by=ee,e.bz=function(){return new Float64Array(3)},e.c=ke,e.c$=gi,e.c0=class extends Ts{constructor(e,t){super(e,t),this.current=ks}set(e){if(e[12]!==this.current[12]||e[0]!==this.current[0])return this.current=e,void this.gl.uniformMatrix4fv(this.location,!1,e);for(let t=1;t<16;t++)if(e[t]!==this.current[t]){this.current=e,this.gl.uniformMatrix4fv(this.location,!1,e);break}}},e.c1=Ds,e.c2=class extends Ts{constructor(e,t){super(e,t),this.current=[0,0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]&&e[2]===this.current[2]||(this.current=e,this.gl.uniform3f(this.location,e[0],e[1],e[2]))}},e.c3=class extends Ts{constructor(e,t){super(e,t),this.current=[0,0]}set(e){e[0]===this.current[0]&&e[1]===this.current[1]||(this.current=e,this.gl.uniform2f(this.location,e[0],e[1]))}},e.c4=p,e.c5=function(e,t){var n=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=n,e[2]=0,e[3]=-n,e[4]=r,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},e.c6=function(e,t,n){var r=t[0],i=t[1],a=t[2];return e[0]=r*n[0]+i*n[3]+a*n[6],e[1]=r*n[1]+i*n[4]+a*n[7],e[2]=r*n[2]+i*n[5]+a*n[8],e},e.c7=function(e,t,n,r,i,a,o){var s=1/(t-n),c=1/(r-i),l=1/(a-o);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*c,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*l,e[11]=0,e[12]=(t+n)*s,e[13]=(i+r)*c,e[14]=(o+a)*l,e[15]=1,e},e.c8=class extends Ts{constructor(e,t){super(e,t),this.current=[]}set(e){if(e!=this.current){this.current=e;let t=new Float32Array(4*e.length);for(let n=0;n<e.length;n++)t[4*n]=e[n].r,t[4*n+1]=e[n].g,t[4*n+2]=e[n].b,t[4*n+3]=e[n].a;this.gl.uniform4fv(this.location,t)}}},e.c9=class extends Ts{constructor(e,t){super(e,t),this.current=[]}set(e){if(e!=this.current){this.current=e;let t=new Float32Array(e);this.gl.uniform1fv(this.location,t)}}},e.cA=function(e,t){return Ce[t]&&`touches`in e},e.cB=function(e){return Ce[e]||we[e]},e.cC=function(e,t,n){var r=t[0],i=t[1];return e[0]=n[0]*r+n[4]*i+n[12],e[1]=n[1]*r+n[5]*i+n[13],e},e.cD=function(e,t){let{x:n,y:r}=Vf.fromLngLat(t);return!(e<0||e>25||r<0||r>=1||n<0||n>=1)},e.cE=function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},e.cF=class extends po{},e.cG=Me,e.cH=function(e,t){ke.REGISTERED_PROTOCOLS[e]=t},e.cI=function(e){delete ke.REGISTERED_PROTOCOLS[e]},e.cJ=function(e,t){let n={};for(let r=0;r<e.length;r++){let i=t&&t[e[r].id]||ji(e[r]);t&&(t[e[r].id]=i);let a=n[i];a||=n[i]=[],a.push(e[r])}let r=[];for(let e in n)r.push(n[e]);return r},e.cK=K,e.cL=Jf,e.cM=Zm,e.cN=Xd,e.cO=function(t){var n;t.bucket.createArrays(),t.bucket.tilePixelRatio=O/(512*t.bucket.overscaling),t.bucket.compareText={},t.bucket.iconsNeedLinear=!1;let r=t.bucket.layers[0],i=r.layout,a=r._unevaluatedLayout._values,o={layoutIconSize:a[`icon-size`].possiblyEvaluate(new za(t.bucket.zoom+1),t.canonical),layoutTextSize:a[`text-size`].possiblyEvaluate(new za(t.bucket.zoom+1),t.canonical),textMaxSize:a[`text-size`].possiblyEvaluate(new za(18))};if(t.bucket.textSizeData.kind===`composite`){let{minZoom:e,maxZoom:n}=t.bucket.textSizeData;o.compositeTextSizes=[a[`text-size`].possiblyEvaluate(new za(e),t.canonical),a[`text-size`].possiblyEvaluate(new za(n),t.canonical)]}if(t.bucket.iconSizeData.kind===`composite`){let{minZoom:e,maxZoom:n}=t.bucket.iconSizeData;o.compositeIconSizes=[a[`icon-size`].possiblyEvaluate(new za(e),t.canonical),a[`icon-size`].possiblyEvaluate(new za(n),t.canonical)]}let s=i.get(`text-line-height`)*Sd,c=i.get(`text-rotation-alignment`)!==`viewport`&&i.get(`symbol-placement`)!==`point`,l=i.get(`text-keep-upright`),u=i.get(`text-size`);for(let a of t.bucket.features){let d=i.get(`text-font`).evaluate(a,{},t.canonical).join(`,`),f=u.evaluate(a,{},t.canonical),p=o.layoutTextSize.evaluate(a,{},t.canonical),m=o.layoutIconSize.evaluate(a,{},t.canonical),h={horizontal:{},vertical:void 0},g=a.text,_,v=[0,0];if(g){let n=g.toString(),o=i.get(`text-letter-spacing`).evaluate(a,{},t.canonical)*Sd,u=ka(n)?o:0,m=i.get(`text-anchor`).evaluate(a,{},t.canonical),_=Dh(r,a,t.canonical);if(!_){let e=i.get(`text-radial-offset`).evaluate(a,{},t.canonical);v=e?Eh(m,[e*Sd,Th]):i.get(`text-offset`).evaluate(a,{},t.canonical).map((e=>e*Sd))}let y=c?`center`:i.get(`text-justify`).evaluate(a,{},t.canonical),b=i.get(`symbol-placement`)===`point`?i.get(`text-max-width`).evaluate(a,{},t.canonical)*Sd:1/0,x=()=>{t.bucket.allowVerticalPlacement&&Oa(n)&&(h.vertical=Qd(g,t.glyphMap,t.glyphPositions,t.imagePositions,d,b,s,m,`left`,u,v,e.ax.vertical,!0,p,f))};if(!c&&_){let n=new Set;if(y===`auto`)for(let e=0;e<_.values.length;e+=2)n.add(Oh(_.values[e]));else n.add(y);let r=!1;for(let i of n)if(!h.horizontal[i])if(r)h.horizontal[i]=h.horizontal[0];else{let n=Qd(g,t.glyphMap,t.glyphPositions,t.imagePositions,d,b,s,`center`,i,u,v,e.ax.horizontal,!1,p,f);n&&(h.horizontal[i]=n,r=n.positionedLines.length===1)}x()}else{y===`auto`&&(y=Oh(m));let r=Qd(g,t.glyphMap,t.glyphPositions,t.imagePositions,d,b,s,m,y,u,v,e.ax.horizontal,!1,p,f);r&&(h.horizontal[y]=r),x(),Oa(n)&&c&&l&&(h.vertical=Qd(g,t.glyphMap,t.glyphPositions,t.imagePositions,d,b,s,m,y,u,v,e.ax.vertical,!1,p,f))}}let y=!1;if(a.icon?.name){let e=t.imageMap[a.icon.name];e&&(_=sf(t.imagePositions[a.icon.name],i.get(`icon-offset`).evaluate(a,{},t.canonical),i.get(`icon-anchor`).evaluate(a,{},t.canonical)),y=!!e.sdf,t.bucket.sdfIcons===void 0?t.bucket.sdfIcons=y:t.bucket.sdfIcons!==y&&de(`Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer`),(e.pixelRatio!==t.bucket.pixelRatio||i.get(`icon-rotate`).constantOr(1)!==0)&&(t.bucket.iconsNeedLinear=!0))}let b=jh(h.horizontal)||h.vertical;(n=t.bucket).iconsInText||(n.iconsInText=!!b&&b.iconsInText),(b||_)&&kh(t.bucket,a,h,_,t.imageMap,o,p,m,v,y,t.canonical,t.subdivisionGranularity)}t.showCollisionBoxes&&t.bucket.generateCollisionDebugBuffers()},e.cP=El,e.cQ=Wl,e.cR=sd,e.cS=function(e,t=``){let n=new Pd;return function(e,t,n=``){for(let r in e.layers)t.writeMessage(3,((e,t)=>Wm(e,t,n)),e.layers[r])}(e,n,t),n.finish()},e.cT=function(e,t,n,r,i,a){let o=th(e,t,n,i,0);return o=th(o,t,r,a,1),o},e.cU=class{constructor(e){this.maxEntries=e,this.map=new Map}get(e){let t=this.map.get(e);return t!==void 0&&(this.map.delete(e),this.map.set(e,t)),t}set(e,t){if(this.map.has(e))this.map.delete(e);else if(this.map.size>=this.maxEntries){let e=this.map.keys().next().value;this.map.delete(e)}this.map.set(e,t)}clear(){this.map.clear()}},e.cV=Bl,e.cW=Pd,e.cX=Vm,e.cY=function(e,n,r,i,a){return t(this,void 0,void 0,(function*(){if(u())try{return yield _e(e,n,r,i,a)}catch{}return function(e,t,n,r,i){let a=e.width,o=e.height;ve&&ye||(ve=new OffscreenCanvas(a,o),ye=ve.getContext(`2d`,{willReadFrequently:!0})),ve.width=a,ve.height=o,ye.drawImage(e,0,0,a,o);let s=ye.getImageData(t,n,r,i);return ye.clearRect(0,0,a,o),s.data}(e,n,r,i,a)}))},e.cZ=zc,e.c_=class{constructor(e,t){this.layers={[Um]:this},this.name=Um,this.version=t?t.version:1,this.extent=t?t.extent:4096,this.length=e.length,this.features=e}feature(e){return new Hm(this.features[e],this.extent)}},e.ca=class extends To{},e.cb=yd,e.cc=class extends Do{},e.cd=Ac,e.ce=function(e){return e<=1?1:2**Math.ceil(Math.log(e)/Math.LN2)},e.cf=kc,e.cg=function(e,t,n){var r=t[0],i=t[1],a=t[2],o=n[3]*r+n[7]*i+n[11]*a+n[15];return e[0]=(n[0]*r+n[4]*i+n[8]*a+n[12])/(o||=1),e[1]=(n[1]*r+n[5]*i+n[9]*a+n[13])/o,e[2]=(n[2]*r+n[6]*i+n[10]*a+n[14])/o,e},e.ch=class extends mo{},e.ci=class extends Po{},e.cj=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15]},e.ck=function(e,t){var n=e[0],r=e[1],i=e[2],a=e[3],o=e[4],s=e[5],c=e[6],l=e[7],u=e[8],f=e[9],p=e[10],m=e[11],h=e[12],g=e[13],_=e[14],v=e[15],y=t[0],b=t[1],x=t[2],S=t[3],C=t[4],w=t[5],T=t[6],E=t[7],D=t[8],O=t[9],k=t[10],A=t[11],ee=t[12],te=t[13],ne=t[14],re=t[15];return Math.abs(n-y)<=d*Math.max(1,Math.abs(n),Math.abs(y))&&Math.abs(r-b)<=d*Math.max(1,Math.abs(r),Math.abs(b))&&Math.abs(i-x)<=d*Math.max(1,Math.abs(i),Math.abs(x))&&Math.abs(a-S)<=d*Math.max(1,Math.abs(a),Math.abs(S))&&Math.abs(o-C)<=d*Math.max(1,Math.abs(o),Math.abs(C))&&Math.abs(s-w)<=d*Math.max(1,Math.abs(s),Math.abs(w))&&Math.abs(c-T)<=d*Math.max(1,Math.abs(c),Math.abs(T))&&Math.abs(l-E)<=d*Math.max(1,Math.abs(l),Math.abs(E))&&Math.abs(u-D)<=d*Math.max(1,Math.abs(u),Math.abs(D))&&Math.abs(f-O)<=d*Math.max(1,Math.abs(f),Math.abs(O))&&Math.abs(p-k)<=d*Math.max(1,Math.abs(p),Math.abs(k))&&Math.abs(m-A)<=d*Math.max(1,Math.abs(m),Math.abs(A))&&Math.abs(h-ee)<=d*Math.max(1,Math.abs(h),Math.abs(ee))&&Math.abs(g-te)<=d*Math.max(1,Math.abs(g),Math.abs(te))&&Math.abs(_-ne)<=d*Math.max(1,Math.abs(_),Math.abs(ne))&&Math.abs(v-re)<=d*Math.max(1,Math.abs(v),Math.abs(re))},e.cl=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},e.cm=e=>e.type===`circle`,e.cn=e=>e.type===`heatmap`,e.co=e=>e.type===`line`,e.cp=e=>e.type===`fill`,e.cq=e=>e.type===`fill-extrusion`,e.cr=e=>e.type===`hillshade`,e.cs=e=>e.type===`color-relief`,e.ct=e=>e.type===`background`,e.cu=e=>e.type===`custom`,e.cv=re,e.cw=function(e,t,n){if(t<=0)return e;let r=1/t;return n===void 0||Math.abs(n)<1e-10?Math.round(e*r)/r:(n>0?Math.ceil(e*r-1e-9):Math.floor(e*r+1e-10))/r},e.cx=function(e,t,n){let r=D(t.x-n.x,t.y-n.y),i=D(e.x-n.x,e.y-n.y);var a,o;return Se(Math.atan2(r[0]*i[1]-r[1]*i[0],(a=r)[0]*(o=i)[0]+a[1]*o[1]))},e.cy=ie,e.cz=function(e,t){if(!we[t])return!1;let n=(e?.target)?.ownerDocument?.defaultView||window;return e instanceof n.MouseEvent||e instanceof n.WheelEvent},e.d=A,e.d0=class{constructor(e,t){let n=(t=this.options=Object.assign({},rd,t)).debug;if(n&&console.time(`preprocess data`),t.maxZoom<0||t.maxZoom>24)throw Error(`maxZoom should be in the 0-24 range`);if(t.promoteId&&t.generateId)throw Error(`promoteId and generateId cannot be used together.`);let r=du(e,t);n&&(console.timeEnd(`preprocess data`),console.log(`index: maxZoom: %d, maxPoints: %d`,t.indexMaxZoom,t.indexMaxPoints),console.time(`generate tiles`)),r=Iu(r,t),t.updateable&&(this.source=r),this.initializeIndex(r,t)}initializeIndex(e,t){this.tileIndex=t.cluster?new Uu(t.clusterOptions):new td(t),e.length&&this.tileIndex.initialize(e)}getTile(e,t,n){return t=+t,n=+n,(e=+e)<0||e>24?null:this.tileIndex.getTile(e,t,n)}updateData(e,t){let n=this.options;if(!n.updateable)throw Error("to update tile geojson `updateable` option must be set to true");let{affected:r,source:i}=function(e,t,n){let r=function(e,t){return e?{removeAll:e.removeAll,remove:new Set(e.remove||[]),add:new Map(e.add?.map((e=>[t.promoteId?e.properties[t.promoteId]:e.id,e]))),update:new Map(e.update?.map((e=>[e.id,e])))}:{remove:new Set,add:new Map,update:new Map}}(t,n),i=[];if(r.removeAll&&(i=e,e=[]),r.remove.size||r.add.size){let t=[];for(let n of e)(r.remove.has(n.id)||r.add.has(n.id))&&t.push(n);if(t.length){i.push(...t);let n=new Set(t.map((e=>e.id)));e=e.filter((e=>!n.has(e.id)))}if(r.add.size){let t=du({type:`FeatureCollection`,features:Array.from(r.add.values())},n);t=Iu(t,n),i.push(...t),e.push(...t)}}if(r.update.size){let t=new Map,a=[];for(let n of e)r.update.has(n.id)?t.set(n.id,[...t.get(n.id)||[],n]):a.push(n);for(let[e,o]of r.update){let r=t.get(e);if(!r||r.length===0)continue;let s=Bu(r,o,n);i.push(...r,...s),a.push(...s)}e=a}return{affected:i,source:e}}(this.source,e,n);t&&({affected:r,source:i}=this.filterUpdate(i,r,t)),r.length&&(this.source=i,this.tileIndex.updateIndex(i,r,n))}filterUpdate(e,t,n){let r=new Set;for(let i of e)i.id!=null&&(n(_u(i))||(t.push(i),r.add(i.id)));return{affected:t,source:e=e.filter((e=>!r.has(e.id)))}}getData(){if(!this.options.updateable)throw Error("to retrieve data the `updateable` option must be set to true");return{type:`FeatureCollection`,features:this.source.map((e=>_u(e)))}}updateClusterOptions(e,t){let n=this.options.cluster;this.options.cluster=e,this.options.clusterOptions=t,n==e?this.tileIndex.updateIndex(this.source,[],this.options):this.initializeIndex(this.source,this.options)}getClusterExpansionZoom(e){return this.tileIndex.getClusterExpansionZoom(e)}getClusterChildren(e){return this.tileIndex.getChildren(e)}getClusterLeaves(e,t,n){return this.tileIndex.getLeaves(e,t,n)}},e.d1=Ra,e.e=ae,e.f=Fe,e.g=Ae,e.h=e=>t(void 0,void 0,void 0,(function*(){if(e.byteLength===0)return createImageBitmap(new ImageData(1,1));let t=new Blob([new Uint8Array(e)],{type:`image/png`});try{return createImageBitmap(t)}catch(e){throw Error(`Could not load image because of ${A(e).message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}})),e.i=pe,e.j=e=>new Promise(((t,n)=>{let r=new Image;r.onload=()=>{t(r),URL.revokeObjectURL(r.src),r.onload=null,window.requestAnimationFrame((()=>r.src=ge))},r.onerror=()=>n(Error(`Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`));let i=new Blob([new Uint8Array(e)],{type:`image/png`});r.src=e.byteLength?URL.createObjectURL(i):ge})),e.k=(e,t)=>Pe(ae(e,{type:`json`}),t),e.l=ze,e.m=Pe,e.n=Re,e.o=(e,t)=>Pe(ae(e,{type:`arrayBuffer`}),t),e.p=Jd,e.q=function(e){return new Pd(e).readFields(Gd,[])},e.r=function(e){return/[\u02EA\u02EB\u1100-\u11FF\u2E80-\u2FDF\u3000-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE4F\uFF00-\uFFEF]|\uD81B[\uDFE0-\uDFFF]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFB]|\uD83C[\uDE00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(e))},e.s=be,e.t=Ec,e.u=$a,e.v=da,e.w=de,e.x=N,e.y=Wa,e.z=p
vendor: 40,749 bytes, line 9
9a})),n(`worker`,[`./shared`],(function(e){class t{constructor(e,t){this.keyCache={},e&&this.replace(e,t)}replace(e,t){this._layerConfigs={},this._layers={},this.update(e,[],t)}update(t,n,r){for(let n of t){this._layerConfigs[n.id]=n;let t=this._layers[n.id]=e.bT(n,r);t._featureFilter=e.ah(t.filter,r),this.keyCache[n.id]&&delete this.keyCache[n.id]}for(let e of n)delete this.keyCache[e],delete this._layerConfigs[e],delete this._layers[e];this.familiesBySource={};let i=e.cJ(Object.values(this._layerConfigs),this.keyCache);for(let t of i){let n=t.map((e=>this._layers[e.id])),r=n[0];if(r.isHidden())continue;let i=r.source||``,a=this.familiesBySource[i];a||=this.familiesBySource[i]={};let o=r.sourceLayer||e.ag,s=a[o];s||=a[o]=[],s.push(n)}}}class n{constructor(t){let n={},r=[];for(let e in t){let i=t[e],a=n[e]={};for(let e in i){let t=i[+e];if(!t||t.bitmap.width===0||t.bitmap.height===0)continue;let n={x:0,y:0,w:t.bitmap.width+2,h:t.bitmap.height+2};r.push(n),a[e]={rect:n,metrics:t.metrics}}}let{w:i,h:a}=e.p(r),o=new e.t({width:i||1,height:a||1});for(let r in t){let i=t[r];for(let t in i){let a=i[+t];if(!a||a.bitmap.width===0||a.bitmap.height===0)continue;let s=n[r][t].rect;e.t.copy(a.bitmap,o,{x:0,y:0},{x:s.x+1,y:s.y+1},a.bitmap)}}this.image=o,this.positions=n}}e.cK(`GlyphAtlas`,n);class r{constructor(t){this.tileID=new e.a3(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.uid=t.uid,this.zoom=t.zoom,this.pixelRatio=t.pixelRatio,this.tileSize=t.tileSize,this.source=t.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=t.showCollisionBoxes,this.collectResourceTiming=!!t.collectResourceTiming,this.returnDependencies=!!t.returnDependencies,this.promoteId=t.promoteId,this.inFlightDependencies=[]}parse(t,r,a,o,s){return e._(this,void 0,void 0,(function*(){this.status=`parsing`,this.data=t,this.collisionBoxArray=new e.ae;let c=new e.cL(Object.keys(t.layers).sort()),l=new e.cM(this.tileID,this.promoteId);l.bucketLayerIDs=[];let u={},d={featureIndex:l,iconDependencies:{},patternDependencies:{},glyphDependencies:{},dashDependencies:{},availableImages:a,subdivisionGranularity:s},f=r.familiesBySource[this.source];for(let n in f){let r=t.layers[n];if(!r)continue;r.version===1&&e.w(`Vector tile source "${this.source}" layer "${n}" does not use vector tile spec v2 and therefore may have some rendering errors.`);let o=c.encode(n),s=[];for(let e=0;e<r.length;e++){let t=r.feature(e),i=l.getId(t,n);s.push({feature:t,id:i,index:e,sourceLayerIndex:o})}for(let t of f[n]){let n=t[0];n.source!==this.source&&e.w(`layer.source = ${n.source} does not equal this.source = ${this.source}`),n.isHidden(this.zoom,!0)||(i(t,this.zoom,a),(u[n.id]=n.createBucket({index:l.bucketLayerIDs.length,layers:t,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:o,sourceID:this.source})).populate(s,d,this.tileID.canonical),l.bucketLayerIDs.push(t.map((e=>e.id))))}}let p=e.bY(d.glyphDependencies,(e=>Object.keys(e).map(Number)));for(let e of this.inFlightDependencies)e?.abort();this.inFlightDependencies=[];let m=Promise.resolve({});if(Object.keys(p).length){let e=new AbortController;this.inFlightDependencies.push(e),m=o.sendAsync({type:`GG`,data:{stacks:p,source:this.source,tileID:this.tileID,type:`glyphs`}},e)}let h=Object.keys(d.iconDependencies),g=Promise.resolve({});if(h.length){let e=new AbortController;this.inFlightDependencies.push(e),g=o.sendAsync({type:`GI`,data:{icons:h,source:this.source,tileID:this.tileID,type:`icons`}},e)}let _=Object.keys(d.patternDependencies),v=Promise.resolve({});if(_.length){let e=new AbortController;this.inFlightDependencies.push(e),v=o.sendAsync({type:`GI`,data:{icons:_,source:this.source,tileID:this.tileID,type:`patterns`}},e)}let y=d.dashDependencies,b=Promise.resolve({});if(Object.keys(y).length){let e=new AbortController;this.inFlightDependencies.push(e),b=o.sendAsync({type:`GDA`,data:{dashes:y}},e)}let[x,S,C,w]=yield Promise.all([m,g,v,b]),T=new n(x),E=new e.cN(S,C);for(let t in u){let n=u[t];n instanceof e.af?(i(n.layers,this.zoom,a),e.cO({bucket:n,glyphMap:x,glyphPositions:T.positions,imageMap:S,imagePositions:E.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:d.subdivisionGranularity})):n.hasDependencies&&(n instanceof e.cP||n instanceof e.cQ||n instanceof e.cR)&&(i(n.layers,this.zoom,a),n.addFeatures(d,this.tileID.canonical,E.patternPositions,w))}return this.status=`done`,{buckets:Object.values(u).filter((e=>!e.isEmpty())),featureIndex:l,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:T.image,imageAtlas:E,dashPositions:w,glyphMap:this.returnDependencies?x:null,iconMap:this.returnDependencies?S:null,glyphPositions:this.returnDependencies?T.positions:null}}))}}function i(t,n,r){let i=new e.J(n);for(let e of t)e.recalculate(i,r)}class a{constructor(){this.loading={},this.loaded={},this.parsing={}}startLoading(e,t){this.loading[e]=t}finishLoading(e){delete this.loading[e]}abort(e){let t=this.loading[e];t!=null&&t.abort&&(t.abort.abort(),delete this.loading[e])}setParsing(e,t){this.parsing[e]=t}consumeParsing(e){let t=this.parsing[e];if(t)return delete this.parsing[e],t}clearParsing(e){delete this.parsing[e]}markLoaded(e,t){this.loaded[e]=t}getLoaded(e){let t=this.loaded[e];if(t)return t}removeLoaded(e){delete this.loaded[e]}clearLoaded(){this.loaded={}}}class o{constructor(e){this.start=`${e}#start`,this.end=`${e}#end`,this.measure=e,performance.mark(this.start)}finish(){performance.mark(this.end);let e=performance.getEntriesByName(this.measure);return e.length===0&&(performance.measure(this.measure,this.start,this.end),e=performance.getEntriesByName(this.measure),performance.clearMarks(this.start),performance.clearMarks(this.end),performance.clearMeasures(this.measure)),e}}class s{constructor(e,t,n,r,i){this.type=e,this.properties=n||{},this.extent=i,this.pointsArray=t,this.id=r}loadGeometry(){return this.pointsArray.map((t=>t.map((t=>new e.P(t.x,t.y)))))}}class c{constructor(e,t,n){this.version=2,this._myFeatures=e,this.name=t,this.length=e.length,this.extent=n}feature(e){return this._myFeatures[e]}}class l{constructor(){this.layers={}}addLayer(e){this.layers[e.name]=e}}function u(t){let n=e.cS(t);return n.byteOffset===0&&n.byteLength===n.buffer.byteLength||(n=new Uint8Array(n)),{vectorTile:t,rawData:n.buffer}}function d(t,n,r){let{extent:i}=t,a=2**(r.z-n.z),o=(r.x-n.x*a)*i,l=(r.y-n.y*a)*i,u=[];for(let n=0;n<t.length;n++){let r=t.feature(n),c=r.loadGeometry();for(let e of c)for(let t of e)t.x=t.x*a-o,t.y=t.y*a-l;c=e.cT(c,r.type,-128,-128,i+128,i+128),c.length!==0&&u.push(new s(r.type,c,r.properties,r.id,i))}return new c(u,t.name,i)}class f{constructor(t,n,r){this.actor=t,this.layerIndex=n,this.availableImages=r,this.tileState=new a,this.overzoomedTileResultCache=new e.cU(1e3)}loadVectorTile(t,n){try{return{vectorTile:t.encoding===`mlt`?new e.cX(n):new e.cV(new e.cW(n)),rawData:n}}catch(r){let i=new Uint8Array(n),a=`Unable to parse the tile at ${t.request.url}, `;throw a+=i[0]===31&&i[1]===139?`please make sure the data is not gzipped and that you have configured the relevant header in the server`:`got error: ${e.d(r).message}`,Error(a)}}loadTile(t){return e._(this,void 0,void 0,(function*(){let{uid:n,overzoomParameters:i}=t;i&&(t.request=i.overzoomRequest);let a=this._startRequestTiming(t),o=new r(t);this.tileState.startLoading(n,o);let s=new AbortController;o.abort=s;try{let r=yield e.o(t.request,s);if(t.etag&&t.etag===r.etag)return this.tileState.finishLoading(n),this._getEtagUnmodifiedResult(r,a);let c=this.loadVectorTile(t,r.data);if(this.tileState.finishLoading(n),!c)return null;let{vectorTile:l,rawData:u}=c;i&&({vectorTile:l,rawData:u}=this._getOverzoomTile(t,l));let d=this._getExpiryData(r),f=this._finishRequestTiming(a);o.vectorTile=l,this.tileState.markLoaded(n,o);let p={rawData:u,cacheControl:d,resourceTiming:f};this.tileState.setParsing(n,p);try{return yield this._parseWorkerTile(o,t,p)}finally{this.tileState.clearParsing(n)}}catch(e){throw this.tileState.finishLoading(n),o.status=`done`,this.tileState.markLoaded(n,o),e}}))}_getEtagUnmodifiedResult(t,n){let r=this._getExpiryData(t),i=this._finishRequestTiming(n);return e.e({etagUnmodified:!0},r,i)}_parseWorkerTile(t,n,r){return e._(this,void 0,void 0,(function*(){let i=yield t.parse(t.vectorTile,this.layerIndex,this.availableImages,this.actor,n.subdivisionGranularity);if(r){let{rawData:t,cacheControl:a,resourceTiming:o}=r;i=e.e({rawTileData:t.slice(0),encoding:n.encoding},i,a,o)}return i}))}_getExpiryData({expires:e,cacheControl:t,etag:n}){let r={};return e&&(r.expires=e),t&&(r.cacheControl=t),n&&(r.etag=n),r}_startRequestTiming(e){if(e.request?.collectResourceTiming)return new o(e.request.url)}_finishRequestTiming(e){let t=e?.finish();return t?{resourceTiming:JSON.parse(JSON.stringify(t))}:{}}_getOverzoomTile(e,t){let{tileID:n,source:r,overzoomParameters:i}=e,{maxZoomTileID:a}=i,o=`${a.key}_${n.key}_${e.request?.url}`,s=this.overzoomedTileResultCache.get(o);if(s)return s;let c=new l,f=this.layerIndex.familiesBySource[r];for(let e in f){let r=t.layers[e];if(!r)continue;let i=d(r,a,n.canonical);i.length>0&&c.addLayer(i)}let p=u(c);return this.overzoomedTileResultCache.set(o,p),p}reloadTile(t){return e._(this,void 0,void 0,(function*(){let e=t.uid,n=this.tileState.getLoaded(e);if(!n)throw Error(`Should not be trying to reload a tile that was never loaded or has been removed`);if(n.showCollisionBoxes=t.showCollisionBoxes,n.status===`parsing`){let r=this.tileState.consumeParsing(e);return yield this._parseWorkerTile(n,t,r)}if(n.status===`done`&&n.vectorTile)return yield this._parseWorkerTile(n,t)}))}abortTile(t){return e._(this,void 0,void 0,(function*(){this.tileState.abort(t.uid)}))}removeTile(t){return e._(this,void 0,void 0,(function*(){this.tileState.removeLoaded(t.uid)}))}}class p{constructor(){this.loaded={}}loadTile(t){return e._(this,void 0,void 0,(function*(){let{uid:n,encoding:r,rawImageData:i,redFactor:a,greenFactor:o,blueFactor:s,baseShift:c}=t,l=i.width+2,u=i.height+2,d=e.b(i)?new e.R({width:l,height:u},yield e.cY(i,-1,-1,l,u)):i,f=new e.cZ(n,d,r,a,o,s,c);return this.loaded||={},this.loaded[n]=f,f}))}removeTile(e){let t=this.loaded,n=e.uid;t!=null&&t[n]&&delete t[n]}}class m{constructor(e,t,n,r=h){this.actor=e,this.layerIndex=t,this.availableImages=n,this.tileState=new a,this._createGeoJSONIndex=r}loadVectorTile(t){if(!this._geoJSONIndex)throw Error(`Unable to parse the data into a cluster or geojson`);let{z:n,x:r,y:i}=t.tileID.canonical,a=this._geoJSONIndex.getTile(n,r,i);return a?u(new e.c_(a.features,{version:2,extent:e.a6})):null}loadTile(t){return e._(this,void 0,void 0,(function*(){let{uid:e}=t,n=new r(t);n.abort=new AbortController;try{let r=this.loadVectorTile(t);if(!r)return null;let{vectorTile:i,rawData:a}=r;n.vectorTile=i,this.tileState.markLoaded(e,n);let o={rawData:a};this.tileState.setParsing(e,o);try{return yield this._parseWorkerTile(n,t,o)}finally{this.tileState.clearParsing(e)}}catch(t){throw n.status=`done`,this.tileState.markLoaded(e,n),t}}))}_reloadLoadedTile(t){return e._(this,void 0,void 0,(function*(){let e=t.uid,n=this.tileState.getLoaded(e);if(!n)throw Error(`Should not be trying to reload a tile that was never loaded or has been removed`);if(n.showCollisionBoxes=t.showCollisionBoxes,n.status===`parsing`){let r=this.tileState.consumeParsing(e);return yield this._parseWorkerTile(n,t,r)}if(n.status===`done`&&n.vectorTile)return yield this._parseWorkerTile(n,t)}))}_parseWorkerTile(t,n,r){return e._(this,void 0,void 0,(function*(){let i=yield t.parse(t.vectorTile,this.layerIndex,this.availableImages,this.actor,n.subdivisionGranularity);if(r){let{rawData:t}=r;i=e.e({rawTileData:t.slice(0),encoding:`mvt`},i)}return i}))}abortTile(t){return e._(this,void 0,void 0,(function*(){this.tileState.abort(t.uid)}))}removeTile(t){return e._(this,void 0,void 0,(function*(){this.tileState.removeLoaded(t.uid)}))}loadData(t){return e._(this,void 0,void 0,(function*(){var n;(n=this._pendingRequest)==null||n.abort();let r=this._startRequestTiming(t);this._pendingRequest=new AbortController;try{yield this.loadAndProcessGeoJSON(t,this._pendingRequest),delete this._pendingRequest,this.tileState.clearLoaded();let e={};return t.request&&(e.data=t.data),this._finishRequestTiming(r,t,e),e}catch(t){if(delete this._pendingRequest,!e.$(t))throw t;return{abandoned:!0}}}))}_startRequestTiming(e){if(e.request?.collectResourceTiming)return new o(e.request.url)}_finishRequestTiming(e,t,n){let r=e?.finish();r&&(n.resourceTiming={[t.source]:JSON.parse(JSON.stringify(r))})}reloadTile(e){return this.tileState.getLoaded(e.uid)?this._reloadLoadedTile(e):this.loadTile(e)}loadAndProcessGeoJSON(t,n){return e._(this,void 0,void 0,(function*(){if(t.request&&(t.data=(yield e.k(t.request,n)).data),t.data)return t.data=this._filterGeoJSON(t.data,t.filter),void(this._geoJSONIndex=this._createGeoJSONIndex(t.data,t));if(t.dataDiff)return this._geoJSONIndex??=this._createGeoJSONIndex({type:`FeatureCollection`,features:[]},t),void this._geoJSONIndex.updateData(t.dataDiff,this._getFilterPredicate(t.filter));if(t.updateCluster&&this._geoJSONIndex.updateClusterOptions(t.geojsonVtOptions.cluster,g(t)),this._geoJSONIndex==null)throw Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`)}))}_filterGeoJSON(e,t){if(e.type!==`FeatureCollection`)return e;let n=this._getFilterPredicate(t);return n?{type:`FeatureCollection`,features:e.features.filter((e=>n(e)))}:e}_getFilterPredicate(t){if(typeof t!=`boolean`&&!t?.length)return;let n=e.c$(t,{type:`boolean`,"property-type":`data-driven`,overridable:!1,transition:!1});if(n.result===`error`)throw Error(n.value.map((e=>`${e.key}: ${e.message}`)).join(`, `));return e=>n.value.evaluate({zoom:0},e)}removeSource(t){return e._(this,void 0,void 0,(function*(){var e;(e=this._pendingRequest)==null||e.abort()}))}getClusterExpansionZoom(e){return this._geoJSONIndex.getClusterExpansionZoom(e.clusterId)}getClusterChildren(e){return this._geoJSONIndex.getClusterChildren(e.clusterId)}getClusterLeaves(e){return this._geoJSONIndex.getClusterLeaves(e.clusterId,e.limit,e.offset)}}function h(t,n){let r=e.e(n.geojsonVtOptions||{},{updateable:!0,clusterOptions:g(n)});return new e.d0(t,r)}function g({geojsonVtOptions:t,clusterProperties:n}){if(!n||!t.clusterOptions)return t.clusterOptions;let r={},i={},a={accumulated:null,zoom:0},o={properties:null},s=Object.keys(n);for(let t of s){let[a,o]=n[t],s=e.c$(o),c=e.c$(typeof a==`string`?[a,[`accumulated`],[`get`,t]]:a);r[t]=s.value,i[t]=c.value}return t.clusterOptions.map=e=>{o.properties=e;let t={};for(let e of s)t[e]=r[e].evaluate(a,o);return t},t.clusterOptions.reduce=(e,t)=>{o.properties=t;for(let t of s)a.accumulated=e[t],e[t]=i[t].evaluate(a,o)},t.clusterOptions}class _{constructor(t){this.self=t,this.actor=new e.N(t),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.globalStates=new Map,this.self.registerWorkerSource=(e,t)=>{if(this.externalWorkerSourceTypes[e])throw Error(`Worker source with name "${e}" already registered.`);this.externalWorkerSourceTypes[e]=t},this.self.addProtocol=e.cH,this.self.removeProtocol=e.cI,this.self.registerRTLTextPlugin=t=>{e.d1.setMethods(t)},this.self.makeRequest=e.m,this.actor.registerMessageHandler(`LDT`,((e,t)=>this._getDEMWorkerSource(e,t.source).loadTile(t))),this.actor.registerMessageHandler(`RDT`,((t,n)=>e._(this,void 0,void 0,(function*(){this._getDEMWorkerSource(t,n.source).removeTile(n)})))),this.actor.registerMessageHandler(`GCEZ`,((t,n)=>e._(this,void 0,void 0,(function*(){return this._getWorkerSource(t,n.type,n.source).getClusterExpansionZoom(n)})))),this.actor.registerMessageHandler(`GCC`,((t,n)=>e._(this,void 0,void 0,(function*(){return this._getWorkerSource(t,n.type,n.source).getClusterChildren(n)})))),this.actor.registerMessageHandler(`GCL`,((t,n)=>e._(this,void 0,void 0,(function*(){return this._getWorkerSource(t,n.type,n.source).getClusterLeaves(n)})))),this.actor.registerMessageHandler(`LD`,((e,t)=>this._getWorkerSource(e,t.type,t.source).loadData(t))),this.actor.registerMessageHandler(`LT`,((e,t)=>this._getWorkerSource(e,t.type,t.source).loadTile(t))),this.actor.registerMessageHandler(`RT`,((e,t)=>this._getWorkerSource(e,t.type,t.source).reloadTile(t))),this.actor.registerMessageHandler(`AT`,((e,t)=>this._getWorkerSource(e,t.type,t.source).abortTile(t))),this.actor.registerMessageHandler(`RMT`,((e,t)=>this._getWorkerSource(e,t.type,t.source).removeTile(t))),this.actor.registerMessageHandler(`RS`,((t,n)=>e._(this,void 0,void 0,(function*(){if(!this.workerSources[t]?.[n.type]?.[n.source])return;let e=this.workerSources[t][n.type][n.source];delete this.workerSources[t][n.type][n.source],e.removeSource!==void 0&&e.removeSource(n)})))),this.actor.registerMessageHandler(`RM`,(t=>e._(this,void 0,void 0,(function*(){delete this.layerIndexes[t],delete this.availableImages[t],delete this.workerSources[t],delete this.demWorkerSources[t],this.globalStates.delete(t)})))),this.actor.registerMessageHandler(`SR`,((t,n)=>e._(this,void 0,void 0,(function*(){this.referrer=n})))),this.actor.registerMessageHandler(`SRPS`,((e,t)=>this._syncRTLPluginState(e,t))),this.actor.registerMessageHandler(`IS`,((t,n)=>e._(this,void 0,void 0,(function*(){this.self.importScripts(n)})))),this.actor.registerMessageHandler(`SI`,((e,t)=>this._setImages(e,t))),this.actor.registerMessageHandler(`UL`,((t,n)=>e._(this,void 0,void 0,(function*(){this._getLayerIndex(t).update(n.layers,n.removedIds,this._getGlobalState(t))})))),this.actor.registerMessageHandler(`UGS`,((t,n)=>e._(this,void 0,void 0,(function*(){let e=this._getGlobalState(t);for(let t in n)e[t]=n[t]})))),this.actor.registerMessageHandler(`SL`,((t,n)=>e._(this,void 0,void 0,(function*(){this._getLayerIndex(t).replace(n,this._getGlobalState(t))}))))}_getGlobalState(e){let t=this.globalStates.get(e);return t||(t={},this.globalStates.set(e,t)),t}_setImages(t,n){return e._(this,void 0,void 0,(function*(){this.availableImages[t]=n;for(let e in this.workerSources[t]){let r=this.workerSources[t][e];for(let e in r)r[e].availableImages=n}}))}_syncRTLPluginState(t,n){return e._(this,void 0,void 0,(function*(){return yield e.d1.syncState(n,this.self.importScripts)}))}_getAvailableImages(e){let t=this.availableImages[e];return t||=[],t}_getLayerIndex(e){let n=this.layerIndexes[e];return n||=this.layerIndexes[e]=new t,n}_getWorkerSource(e,t,n){var r,i;if((r=this.workerSources)[e]||(r[e]={}),(i=this.workerSources[e])[t]||(i[t]={}),!this.workerSources[e][t][n]){let r={sendAsync:(t,n)=>(t.targetMapId=e,this.actor.sendAsync(t,n))};switch(t){case`vector`:this.workerSources[e][t][n]=new f(r,this._getLayerIndex(e),this._getAvailableImages(e));break;case`geojson`:this.workerSources[e][t][n]=new m(r,this._getLayerIndex(e),this._getAvailableImages(e));break;default:this.workerSources[e][t][n]=new this.externalWorkerSourceTypes[t](r,this._getLayerIndex(e),this._getAvailableImages(e))}}return this.workerSources[e][t][n]}_getDEMWorkerSource(e,t){var n,r;return(n=this.demWorkerSources)[e]||(n[e]={}),(r=this.demWorkerSources[e])[t]||(r[t]=new p),this.demWorkerSources[e][t]}}return e.i(self)&&(self.worker=new _(self)),_})),n(`index`,[`exports`,`./shared`],(function(e,t){var n=`5.24.0`;function r(){var e=new t.A(4);return t.A!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e}let i,a,o,s={frame(e,n,r,i){let a=i||window,o=a.requestAnimationFrame((e=>{s(),n(e)})),{unsubscribe:s}=t.s(e.signal,`abort`,(()=>{s(),a.cancelAnimationFrame(o),r(new t.a(e.signal.reason))}),!1)},frameAsync(e,t){return new Promise(((n,r)=>{this.frame(e,n,r,t)}))},getImageData(e,t=0){return this.getImageCanvasContext(e).getImageData(-t,-t,e.width+2*t,e.height+2*t)},getImageCanvasContext(e){let t=window.document.createElement(`canvas`),n=t.getContext(`2d`,{willReadFrequently:!0});if(!n)throw Error(`failed to create canvas 2d context`);return t.width=e.width,t.height=e.height,n.drawImage(e,0,0,e.width,e.height),n},resolveURL:e=>(i||=document.createElement(`a`),i.href=e,i.href),hardwareConcurrency:typeof navigator<`u`&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return o===void 0?!!matchMedia&&(a??=matchMedia(`(prefers-reduced-motion: reduce)`),a.matches):o},set prefersReducedMotion(e){o=e}},c=new class{constructor(){this._frozenAt=null}getCurrentTime(){return this._frozenAt===null?performance.now():this._frozenAt}setNow(e){this._frozenAt=e}restoreNow(){this._frozenAt=null}isFrozen(){return this._frozenAt!==null}};function l(){return c.getCurrentTime()}var u;class d{static create(e,t,n){let r=window.document.createElement(e);return t!==void 0&&(r.className=t),n&&n.appendChild(r),r}static createNS(e,t){return window.document.createElementNS(e,t)}static disableDrag(){d.docStyle&&d.selectProp&&(d.userSelect=d.docStyle[d.selectProp],d.docStyle[d.selectProp]=`none`)}static enableDrag(){d.docStyle&&d.selectProp&&(d.docStyle[d.selectProp]=d.userSelect)}static suppressClickInternal(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener(`click`,d.suppressClickInternal,!0)}static suppressClick(){window.addEventListener(`click`,d.suppressClickInternal,!0),window.setTimeout((()=>{window.removeEventListener(`click`,d.suppressClickInternal,!0)}),0)}static getScale(e){let t=e.getBoundingClientRect();return{x:t.width/e.offsetWidth||1,y:t.height/e.offsetHeight||1,boundingClientRect:t}}static getPoint(e,n,r){let i=n.boundingClientRect;return new t.P((r.clientX-i.left)/n.x-e.clientLeft,(r.clientY-i.top)/n.y-e.clientTop)}static mousePos(e,t){let n=d.getScale(e);return d.getPoint(e,n,t)}static touchPos(e,t){let n=[],r=d.getScale(e);for(let i of t)n.push(d.getPoint(e,r,i));return n}static sanitize(e){let t=new DOMParser().parseFromString(e,`text/html`).body||document.createElement(`body`),n=t.querySelectorAll(`script`);for(let e of n)e.remove();return d.clean(t),t.innerHTML}static isPossiblyDangerous(e,t){let n=t.replace(/\s+/g,``).toLowerCase();return!(![`src`,`href`,`xlink:href`].includes(e)||!n.includes(`javascript:`)&&!n.includes(`data:`))||!!e.startsWith(`on`)||void 0}static clean(e){let t=e.children;for(let e of t)d.removeAttributes(e),d.clean(e)}static removeAttributes(e){for(let{name:t,value:n}of e.attributes)d.isPossiblyDangerous(t,n)&&e.removeAttribute(t)}}d.docStyle=typeof window<`u`&&window.document?.documentElement.style,d.selectProp=!d.docStyle||`userSelect`in d.docStyle?`userSelect`:`webkitUserSelect`,function(e){let n,r,i,a;e.resetRequestQueue=()=>{n=[],r=0,i=0,a={}},e.addThrottleControl=e=>{let t=i++;return a[t]=e,t},e.removeThrottleControl=e=>{delete a[e],s()},e.getImage=(e,r,i=!0)=>new Promise(((a,o)=>{e.headers||={},e.headers.accept=`image/webp,*/*`,t.e(e,{type:`image`}),n.push({abortController:r,requestParameters:e,supportImageRefresh:i,state:`queued`,onError:e=>{o(e)},onSuccess:e=>{a(e)}}),s()}));let o=e=>t._(this,void 0,void 0,(function*(){e.state=`running`;let{requestParameters:n,supportImageRefresh:i,onError:a,onSuccess:o,abortController:l}=e,u=!1===i&&!t.i(self)&&!t.g(n.url)&&(!n.headers||Object.keys(n.headers).reduce(((e,t)=>e&&t===`accept`),!0));r++;let d=u?c(n,l):t.m(n,l);try{let n=yield d;delete e.abortController,e.state=`completed`,n.data instanceof HTMLImageElement||t.b(n.data)?o(n):n.data&&o({data:yield(f=n.data,typeof createImageBitmap==`function`?t.h(f):t.j(f)),cacheControl:n.cacheControl,expires:n.expires})}catch(n){delete e.abortController,a(t.d(n))}finally{r--,s()}var f})),s=()=>{let e=(()=>{for(let e of Object.keys(a))if(a[e]())return!0;return!1})()?t.c.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:t.c.MAX_PARALLEL_IMAGE_REQUESTS;for(let t=r;t<e&&n.length>0;t++){let e=n.shift();e.abortController.signal.aborted?t--:o(e)}},c=(e,n)=>new Promise(((r,i)=>{let a=new Image,o=e.url,s=e.credentials;s&&s===`include`?a.crossOrigin=`use-credentials`:(s&&s===`same-origin`||!t.f(o))&&(a.crossOrigin=`anonymous`),n.signal.addEventListener(`abort`,(()=>{a.src=``,i(new t.a(n.signal.reason))})),a.fetchPriority=`high`,a.onload=()=>{a.onerror=a.onload=null,r({data:a})},a.onerror=()=>{a.onerror=a.onload=null,n.signal.aborted||i(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.`))},a.src=o}))}(u||={}),u.resetRequestQueue();class f{constructor(e){this._transformRequestFn=e??null}transformRequest(e,t){return this._transformRequestFn&&this._transformRequestFn(e,t)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}}function p(e){let t=[];if(typeof e==`string`)t.push({id:`default`,url:e});else if(e&&e.length>0){let n=[];for(let{id:r,url:i}of e){let e=`${r}${i}`;n.includes(e)||(n.push(e),t.push({id:r,url:i}))}}return t}function m(e,t,n){try{let r=new URL(e);return r.pathname+=`${t}${n}`,r.toString()}catch{throw Error(`Invalid sprite URL "${e}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}function h(e){let{userImage:t}=e;return!(!t?.render||!t.render()||(e.data.replace(new Uint8Array(t.data.buffer)),0))}class g extends t.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new t.R({width:1,height:1}),this.dirty=!0}destroy(){this.atlasTexture&&=(this.atlasTexture.destroy(),null);for(let e of Object.keys(this.images))this.removeImage(e);this.patterns={},this.atlasImage=new t.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(let{ids:e,promiseResolve:t}of this.requestors)t(this._getImagesForIds(e));this.requestors=[]}}getImage(e){let n=this.images[e];if(n&&!n.data&&n.spriteData){let e=n.spriteData;n.data=new t.R({width:e.width,height:e.height},e.context.getImageData(e.x,e.y,e.width,e.height).data),n.spriteData=null}return n}addImage(e,t){if(this.images[e])throw Error(`Image id ${e} already exist, use updateImage instead`);this._validate(e,t)&&(this.images[e]=t)}_validate(e,n){let r=!0,i=n.data||n.spriteData;return this._validateStretch(n.stretchX,i?.width)||(this.fire(new t.l(Error(`Image "${e}" has invalid "stretchX" value`))),r=!1),this._validateStretch(n.stretchY,i?.height)||(this.fire(new t.l(Error(`Image "${e}" has invalid "stretchY" value`))),r=!1),this._validateContent(n.content,n)||(this.fire(new t.l(Error(`Image "${e}" has invalid "content" value`))),r=!1),r}_validateStretch(e,t){if(!e)return!0;let n=0;for(let r of e){if(r[0]<n||r[1]<r[0]||t<r[1])return!1;n=r[1]}return!0}_validateContent(e,t){if(!e)return!0;if(e.length!==4)return!1;let n=t.spriteData,r=n?.width||t.data.width,i=n?.height||t.data.height;return!(e[0]<0||r<e[0]||e[1]<0||i<e[1]||e[2]<0||r<e[2]||e[3]<0||i<e[3]||e[2]<e[0]||!(e[3]>=e[1]))}updateImage(e,t,n=!0){let r=this.getImage(e);if(n&&(r.data.width!==t.data.width||r.data.height!==t.data.height))throw Error(`size mismatch between old image (${r.data.width}x${r.data.height}) and new image (${t.data.width}x${t.data.height}).`);t.version=r.version+1,this.images[e]=t,this.updatedImages[e]=!0}removeImage(e){var t;let n=this.images[e];delete this.images[e],delete this.patterns[e],(t=n.userImage)!=null&&t.onRemove&&n.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(e){return new Promise(((t,n)=>{let r=!0;if(!this.isLoaded())for(let t of e)this.images[t]||(r=!1);this.isLoaded()||r?t(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:t})}))}_getImagesForIds(e){let n={};for(let r of e){let e=this.getImage(r);e||=(this.fire(new t.n(`styleimagemissing`,{id:r})),this.getImage(r)),e?n[r]={data:e.data.clone(),pixelRatio:e.pixelRatio,sdf:e.sdf,version:e.version,stretchX:e.stretchX,stretchY:e.stretchY,content:e.content,textFitWidth:e.textFitWidth,textFitHeight:e.textFitHeight,hasRenderCallback:!!e.userImage?.render}:t.w(`Image "${r}" 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 n}getPixelSize(){let{width:e,height:t}=this.atlasImage;return{width:e,height:t}}getPattern(e){let n=this.patterns[e],r=this.getImage(e);if(!r)return null;if(n&&n.position.version===r.version)return n.position;if(n)n.position.version=r.version;else{let n={w:r.data.width+2,h:r.data.height+2,x:0,y:0},i=new t.I(n,r);this.patterns[e]={bin:n,position:i}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){let n=e.gl;this.atlasTexture?this.dirty&&=(this.atlasTexture.update(this.atlasImage),!1):this.atlasTexture=new t.T(e,this.atlasImage,n.RGBA),this.atlasTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}_updatePatternAtlas(){let e=[];for(let t in this.patterns)e.push(this.patterns[t].bin);let{w:n,h:r}=t.p(e),i=this.atlasImage;i.resize({width:n||1,height:r||1});for(let e in this.patterns){let{bin:n}=this.patterns[e],r=n.x+1,a=n.y+1,o=this.getImage(e).data,s=o.width,c=o.height;t.R.copy(o,i,{x:0,y:0},{x:r,y:a},{width:s,height:c}),t.R.copy(o,i,{x:0,y:c-1},{x:r,y:a-1},{width:s,height:1}),t.R.copy(o,i,{x:0,y:0},{x:r,y:a+c},{width:s,height:1}),t.R.copy(o,i,{x:s-1,y:0},{x:r-1,y:a},{width:1,height:c}),t.R.copy(o,i,{x:0,y:0},{x:r+s,y:a},{width:1,height:c})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(let n of e){if(this.callbackDispatchedThisFrame[n])continue;this.callbackDispatchedThisFrame[n]=!0;let e=this.getImage(n);e||t.w(`Image with ID: "${n}" was not found`),h(e)&&this.updateImage(n,e)}}cloneImages(){let e={};for(let t in this.images){let n=this.images[t];e[t]=Object.assign(Object.assign({},n),{data:n.data?n.data.clone():null})}return e}}let _=0x56bc75e2d63100000,v=new Float64Array(256);for(let e=0;e<256;e++){let t=.5-(e/255)**(1/2.2);v[e]=t*Math.abs(t)}function y(e,t,n,r,i,a,o,s,c){for(let l=t;l<t+r;l++)b(e,n*a+l,a,i,o,s,c);for(let l=n;l<n+i;l++)b(e,l*a+t,1,r,o,s,c)}function b(e,t,n,r,i,a,o){a[0]=0,o[0]=-0x56bc75e2d63100000,o[1]=_,i[0]=e[t];for(let s=1,c=0,l=0;s<r;s++){i[s]=e[t+s*n];let r=s*s;do{let e=a[c];l=(i[s]-i[e]+r-e*e)/(s-e)/2}while(l<=o[c]&&--c>-1);c++,a[c]=s,o[c]=l,o[c+1]=_}for(let s=0,c=0;s<r;s++){for(;o[c+1]<s;)c++;let r=a[c],l=s-r;e[t+s*n]=i[r]+l*l}}v[255]=-0x56bc75e2d63100000;let x=t.v.layout_symbol[`text-font`].default.join(`,`);class S{constructor(e,t,n){this.requestManager=e,this.localIdeographFontFamily=t,this.entries={},this.lang=n}setURL(e){this.url=e}getGlyphs(e){return t._(this,void 0,void 0,(function*(){let t=[];for(let n in e)for(let r of e[n])t.push(this._getAndCacheGlyphsPromise(n,r));let n=yield Promise.all(t),r={};for(let{stack:e,id:t,glyph:i}of n)r[e]||(r[e]={}),r[e][t]=i&&{id:i.id,bitmap:i.bitmap.clone(),metrics:i.metrics};return r}))}_getAndCacheGlyphsPromise(e,n){return t._(this,void 0,void 0,(function*(){var t;(t=this.entries)[e]??(t[e]={glyphs:{},requests:{},ranges:{}});let r=this.entries[e],i=r.glyphs[n];return i===void 0?!this.url||this._charUsesLocalIdeographFontFamily(n)?(i=r.glyphs[n]=this._drawGlyph(r,e,n),{stack:e,id:n,glyph:i}):yield this._downloadAndCacheRangePromise(e,n):{stack:e,id:n,glyph:i}}))}_downloadAndCacheRangePromise(e,n){return t._(this,void 0,void 0,(function*(){var r;let i=this.entries[e],a=Math.floor(n/256);if(i.ranges[a])return{stack:e,id:n,glyph:null};(r=i.requests)[a]||(r[a]=S.loadGlyphRange(e,a,this.url,this.requestManager));try{let t=yield i.requests[a];for(let e in t)i.glyphs[+e]=t[+e];return i.ranges[a]=!0,{stack:e,id:n,glyph:t[n]||null}}catch(r){let o=i.glyphs[n]=this._drawGlyph(i,e,n);return this._warnOnMissingGlyphRange(o,a,n,t.d(r)),{stack:e,id:n,glyph:o}}}))}_warnOnMissingGlyphRange(e,n,r,i){let a=256*n,o=a+255,s=r.toString(16).padStart(4,`0`).toUpperCase();t.w(`Unable to load glyph range ${n}, ${a}-${o}. Rendering codepoint U+${s} locally instead. ${i}`)}_charUsesLocalIdeographFontFamily(e){return!!this.localIdeographFontFamily&&t.r(e)}_drawGlyph(e,n,r){let i=n===x&&this.localIdeographFontFamily!==``&&this._charUsesLocalIdeographFontFamily(r),a=i?`ideographTinySDF`:`tinySDF`;e[a]||(e[a]=this._createTinySDF(i?this.localIdeographFontFamily:n));let o=e[a].draw(String.fromCodePoint(r)),s=/^\p{gc=Cf}+$/u.test(String.fromCodePoint(r));return{id:r,bitmap:new t.t({width:o.width||60,height:o.height||60},o.data),metrics:{width:s?0:o.glyphWidth/2||24,height:o.glyphHeight/2||24,left:o.glyphLeft/2+.5||0,top:o.glyphTop/2-27.5||-8,advance:s?0:o.glyphAdvance/2||24,isDoubleResolution:!0}}}_createTinySDF(e){let t=e?e.split(`,`):[];t.push(`sans-serif`);let n=t.map((e=>/[-\w]+/.test(e)?e:`'${CSS.escape(e)}'`)).join(`,`);return new S.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:n,fontWeight:this._fontWeight(t[0]),fontStyle:this._fontStyle(t[0]),lang:this.lang})}_fontStyle(e){return/italic/i.test(e)?`italic`:/oblique/i.test(e)?`oblique`:`normal`}_fontWeight(e){let t={thin:100,hairline:100,"extra light":200,"ultra light":200,light:300,normal:400,regular:400,medium:500,semibold:600,demibold:600,bold:700,"extra bold":800,"ultra bold":800,black:900,heavy:900,"extra black":950,"ultra black":950},n;for(let[r,i]of Object.entries(t))RegExp(`\\b${r}\\b`,`i`).test(e)&&(n=`${i}`);return n}destroy(){for(let e in this.entries){let t=this.entries[e];t.tinySDF=null,t.ideographTinySDF=null,t.glyphs={},t.requests={},t.ranges={}}this.entries={}}}S.loadGlyphRange=function(e,n,r,i){return t._(this,void 0,void 0,(function*(){let a=256*n,o=a+255,s=yield i.transformRequest(r.replace(`{fontstack}`,e).replace(`{range}`,`${a}-${o}`),`Glyphs`),c=yield t.o(s,new AbortController);if(!c?.data)throw Error(`Could not load glyph range. range: ${n}, ${a}-${o}`);let l={};for(let e of t.q(c.data))l[e.id]=e;return l}))},S.TinySDF=class{constructor({fontSize:e=24,buffer:t=3,radius:n=8,cutoff:r=.25,fontFamily:i=`sans-serif`,fontWeight:a=`normal`,fontStyle:o=`normal`,lang:s=null}={}){this.buffer=t,this.radius=n,this.cutoff=r,this.lang=s;let c=this.size=e+4*t,l=this._createCanvas(c),u=this.ctx=l.getContext(`2d`,{willReadFrequently:!0});u.font=`${o} ${a} ${e}px ${i}`,u.textBaseline=`alphabetic`,u.textAlign=`left`,u.fillStyle=`black`,this.gridOuter=new Float64Array(c*c),this.gridInner=new Float64Array(c*c),this.f=new Float64Array(c),this.z=new Float64Array(c+1),this.v=new Uint16Array(c)}_createCanvas(e){if(typeof OffscreenCanvas<`u`)return new OffscreenCanvas(e,e);let t=document.createElement(`canvas`);return t.width=t.height=e,t}draw(e){let{width:t,actualBoundingBoxAscent:n,actualBoundingBoxDescent:r,actualBoundingBoxLeft:i,actualBoundingBoxRight:a}=this.ctx.measureText(e),o=Math.ceil(n),s=Math.floor(i),c=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(a)-s)),l=Math.max(0,Math.min(this.size-this.buffer,o+Math.ceil(r))),u=c+2*this.buffer,d=l+2*this.buffer,f=Math.max(u*d,0),p=new Uint8ClampedArray(f),m={data:p,width:u,height:d,glyphWidth:c,glyphHeight:l,glyphTop:o,glyphLeft:s,glyphAdvance:t};if(c===0||l===0)return m;let{ctx:h,buffer:g,gridInner:b,gridOuter:x}=this;this.lang&&(h.lang=this.lang),h.clearRect(g,g,c,l),h.fillText(e,g-s,g+o);let S=h.getImageData(g,g,c,l);x.fill(_,0,f),b.fill(0,0,f);let C=3;for(let e=0;e<l;e++){let t=(e+g)*u+g;for(let e=0;e<c;e++,C+=4,t++){let e=S.data[C];if(e===0)continue;let n=v[e];x[t]=Math.max(0,n),b[t]=Math.max(0,-n)}}y(x,0,0,u,d,u,this.f,this.v,this.z),y(b,g,g,c,l,u,this.f,this.v,this.z);let w=255/this.radius,T=255*(1-this.cutoff);for(let e=0;e<f;e++){let t=Math.sqrt(x[e])-Math.sqrt(b[e]);p[e]=Math.round(T-w*t)}return m}};class C{constructor(){this.specification=t.x.light.position}possiblyEvaluate(e,n){return t.G(e.expression.evaluate(n))}interpolate(e,n,r){return{x:t.H.number(e.x,n.x,r),y:t.H.number(e.y,n.y,r),z:t.H.number(e.z,n.z,r)}}}let w;class T extends t.E{constructor(e){super(),w||=new t.u({anchor:new t.D(t.x.light.anchor),position:new C,color:new t.D(t.x.light.color),intensity:new t.D(t.x.light.intensity)}),this._transitionable=new t.y(w,void 0),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,n={}){if(!this._validate(t.z,e,n))for(let n in e){let r=e[n];n.endsWith(t.B)?this._transitionable.setTransition(n.slice(0,-t.B.length),r):this._transitionable.setValue(n,r)}}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,n,r){return!1!==r?.validate&&t.C(this,e.call(t.F,{value:n,style:{glyphs:!0,sprite:!0},styleSpec:t.x}))}}let E=new t.u({"sky-color":new t.D(t.x.sky[`sky-color`]),"horizon-color":new t.D(t.x.sky[`horizon-color`]),"fog-color":new t.D(t.x.sky[`fog-color`]),"fog-ground-blend":new t.D(t.x.sky[`fog-ground-blend`]),"horizon-fog-blend":new t.D(t.x.sky[`horizon-fog-blend`]),"sky-horizon-blend":new t.D(t.x.sky[`sky-horizon-blend`]),"atmosphere-blend":new t.D(t.x.sky[`atmosphere-blend`])});class D extends t.E{constructor(e){super(),this._transitionable=new t.y(E,void 0),this.setSky(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new t.J(0))}setSky(e,n={}){if(!this._validate(t.K,e,n)){e||={"sky-color":`transparent`,"horizon-color":`transparent`,"fog-color":`transparent`,"fog-ground-blend":1,"atmosphere-blend":0};for(let n in e){let r=e[n];n.endsWith(t.B)?this._transitionable.setTransition(n.slice(0,-t.B.length),r):this._transitionable.setValue(n,r)}}}getSky(){return this._transitionable.serialize()}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,n,r={}){return!1!==r?.validate&&t.C(this,e.call(t.F,t.e({value:n,style:{glyphs:!0,sprite:!0},styleSpec:t.x})))}calculateFogBlendOpacity(e){return e<60?0:e<70?(e-60)/10:1}}class O{constructor(e,t){this.width=e,this.height=t,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(e,t){var n;let r=e.join(`,`)+String(t);return(n=this.dashEntry)[r]||(n[r]=this.addDash(e,t)),this.dashEntry[r]}getDashRanges(e,t,n){let r=[],i=e.length%2==1?-e[e.length-1]*n:0,a=e[0]*n,o=!0;r.push({left:i,right:a,isDash:o,zeroLength:e[0]===0});let s=e[0];for(let t=1;t<e.length;t++){o=!o;let c=e[t];i=s*n,s+=c,a=s*n,r.push({left:i,right:a,isDash:o,zeroLength:c===0})}return r}addRoundDash(e,t,n){let r=t/2;for(let t=-n;t<=n;t++){let i=this.width*(this.nextRow+n+t),a=0,o=e[a];for(let s=0;s<this.width;s++){s/o.right>1&&(o=e[++a]);let c=Math.abs(s-o.left),l=Math.abs(s-o.right),u=Math.min(c,l),d,f=t/n*(r+1);if(o.isDash){let e=r-Math.abs(f);d=Math.sqrt(u*u+e*e)}else d=r-Math.sqrt(u*u+f*f);this.data[i+s]=Math.max(0,Math.min(255,d+128))}}}addRegularDash(e){for(let t=e.length-1;t>=0;--t){let n=e[t],r=e[t+1];n.zeroLength?e.splice(t,1):r&&r.isDash===n.isDash&&(r.left=n.left,e.splice(t,1))}let t=e[0],n=e[e.length-1];t.isDash===n.isDash&&(t.left=n.left-this.width,n.right=t.right+this.width);let r=this.width*this.nextRow,i=0,a=e[i];for(let t=0;t<this.width;t++){t/a.right>1&&(a=e[++i]);let n=Math.abs(t-a.left),o=Math.abs(t-a.right),s=Math.min(n,o);this.data[r+t]=Math.max(0,Math.min(255,(a.isDash?s:-s)+128))}}addDash(e,n){let r=n?7:0,i=2*r+1;if(this.nextRow+i>this.height)return t.w(`LineAtlas out of space`),null;let a=0;for(let t of e)a+=t;if(a!==0){let t=this.width/a,i=this.getDashRanges(e,this.width,t);n?this.addRoundDash(i,t,r):this.addRegularDash(i)}let o={y:this.nextRow+r,height:2*r,width:a};return this.nextRow+=i,this.dirty=!0,o}bind(e){let t=e.gl;this.texture?(t.bindTexture(t.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,t.texSubImage2D(t.TEXTURE_2D,0,0,0,this.width,this.height,t.ALPHA,t.UNSIGNED_BYTE,this.data))):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.ALPHA,this.width,this.height,0,t.ALPHA,t.UNSIGNED_BYTE,this.data))}}let k=`maplibre_preloaded_worker_pool`;class A{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<A.workerCount;)this.workers.push(new Worker(t.c.WORKER_URL));return this.active[e]=!0,this.workers.slice()}release(e){if(delete this.active[e],this.numActive()===0){for(let e of this.workers)e.terminate();this.workers=null}}isPreloaded(){return!!this.active[k]}numActive(){return Object.keys(this.active).length}}let 
vendor: 6,499 bytes, line 9
9ee=Math.floor(s.hardwareConcurrency/2),te,ne;function re(){return te||=new A,te}A.workerCount=t.L(globalThis)?Math.max(Math.min(ee,3),1):1;class ie{constructor(e,n){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=n;let r=this.workerPool.acquire(n);for(let e=0;e<r.length;e++){let i=new t.N(r[e],n);i.name=`Worker ${e}`,this.actors.push(i)}if(!this.actors.length)throw Error(`No actors found`)}broadcast(e,t){let n=[];for(let r of this.actors)n.push(r.sendAsync({type:e,data:t}));return Promise.all(n)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(e=!0){for(let e of this.actors)e.remove();this.actors=[],e&&this.workerPool.release(this.id)}registerMessageHandler(e,t){for(let n of this.actors)n.registerMessageHandler(e,t)}unregisterMessageHandler(e){for(let t of this.actors)t.unregisterMessageHandler(e)}}function j(){return ne||(ne=new ie(re(),t.M),ne.registerMessageHandler(`GR`,((e,n,r)=>t.m(n,r)))),ne}function M(e,n){let r=t.O();return t.Q(r,r,[1,1,0]),t.S(r,r,[.5*e.width,.5*e.height,1]),e.calculatePosMatrix?t.U(r,r,e.calculatePosMatrix(n.toUnwrapped())):r}function ae(e,t,n,r,i,a,o){let s=function(e,t,n){if(e)for(let r of e){let e=t[r];if(e?.source===n&&e.type===`fill-extrusion`)return!0}else for(let e in t){let r=t[e];if(r.source===n&&r.type===`fill-extrusion`)return!0}return!1}(i?.layers??null,t,e.id),c=a.maxPitchScaleFactor(),l=e.tilesIn(r,c,s);l.sort(oe);let u=[];for(let r of l)u.push({wrappedTileID:r.tileID.wrapped().key,queryResults:r.tile.queryRenderedFeatures(t,n,e.getState(),r.queryGeometry,r.cameraQueryGeometry,r.scale,i,a,c,M(a,r.tileID),o?(e,t)=>o(r.tileID,e,t):void 0)});return function(e,t){for(let n in e)for(let r of e[n])se(r,t);return e}(function(e){let t={},n={};for(let{queryResults:r,wrappedTileID:i}of e){n[i]||(n[i]={});let e=n[i];for(let n in r){let i=r[n];e[n]||(e[n]={});let a=e[n];t[n]||(t[n]=[]);for(let e of i)a[e.featureIndex]||(a[e.featureIndex]=!0,t[n].push(e))}}return t}(u),e)}function oe(e,t){let n=e.tileID,r=t.tileID;return n.overscaledZ-r.overscaledZ||n.canonical.y-r.canonical.y||n.wrap-r.wrap||n.canonical.x-r.canonical.x}function se(e,t){let n=e.feature,r=t.getFeatureState(n.layer[`source-layer`],n.id);n.source=n.layer.source,n.layer[`source-layer`]&&(n.sourceLayer=n.layer[`source-layer`]),n.state=r}function ce(e,n,r,i){return t._(this,void 0,void 0,(function*(){let a=e;if(e.url?a=(yield t.k(yield n.transformRequest(e.url,`Source`),r)).data:yield s.frameAsync(r,i),!a)return null;let o=t.V(t.e(a,e),[`tiles`,`minzoom`,`maxzoom`,`attribution`,`bounds`,`scheme`,`tileSize`,`encoding`]);return`vector_layers`in a&&a.vector_layers&&(o.vectorLayerIds=a.vector_layers.map((e=>e.id))),o}))}class le{constructor(e,t){e&&(t?this.setSouthWest(e).setNorthEast(t):Array.isArray(e)&&(e.length===4?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1])))}setNorthEast(e){return this._ne=e instanceof t.W?new t.W(e.lng,e.lat):t.W.convert(e),this}setSouthWest(e){return this._sw=e instanceof t.W?new t.W(e.lng,e.lat):t.W.convert(e),this}extend(e){let n=this._sw,r=this._ne,i,a;if(e instanceof t.W)i=e,a=e;else{if(!(e instanceof le))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(le.convert(e)):this.extend(t.W.convert(e)):e&&(`lng`in e||`lon`in e)&&`lat`in e?this.extend(t.W.convert(e)):this;if(i=e._sw,a=e._ne,!i||!a)return this}return n||r?(n.lng=Math.min(i.lng,n.lng),n.lat=Math.min(i.lat,n.lat),r.lng=Math.max(a.lng,r.lng),r.lat=Math.max(a.lat,r.lat)):(this._sw=new t.W(i.lng,i.lat),this._ne=new t.W(a.lng,a.lat)),this}getCenter(){return new t.W((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 t.W(this.getWest(),this.getNorth())}getSouthEast(){return new t.W(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){let{lng:n,lat:r}=t.W.convert(e),i=this._sw.lng<=n&&n<=this._ne.lng;return this._sw.lng>this._ne.lng&&(i=this._sw.lng>=n&&n>=this._ne.lng),this._sw.lat<=r&&r<=this._ne.lat&&i}intersects(e){if(!((e=le.convert(e)).getNorth()>=this.getSouth()&&e.getSouth()<=this.getNorth()))return!1;let n=Math.abs(this.getEast()-this.getWest()),r=Math.abs(e.getEast()-e.getWest());if(n>=360||r>=360)return!0;let i=t.X(this.getWest(),-180,180),a=t.X(this.getEast(),-180,180),o=t.X(e.getWest(),-180,180),s=t.X(e.getEast(),-180,180),c=i>a,l=o>s;return!(!c||!l)||(c?s>=i||o<=a:l?a>=o||i<=s:o<=a&&s>=i)}static convert(e){return e instanceof le?e:e&&new le(e)}static fromLngLat(e,n=0){let r=360*n/40075017,i=r/Math.cos(Math.PI/180*e.lat);return new le(new t.W(e.lng-i,e.lat-r),new t.W(e.lng+i,e.lat+r))}adjustAntiMeridian(){let e=new t.W(this._sw.lng,this._sw.lat),n=new t.W(this._ne.lng,this._ne.lat);return new le(e,e.lng>n.lng?new t.W(n.lng+360,n.lat):n)}}class ue{constructor(e,t,n){this.bounds=le.convert(this.validateBounds(e)),this.minzoom=t||0,this.maxzoom=n||24}validateBounds(e){return Array.isArray(e)&&e.length===4?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(e){let n=2**e.z,r=Math.floor(t.Z(this.bounds.getWest())*n),i=Math.floor(t.Y(this.bounds.getNorth())*n),a=Math.ceil(t.Z(this.bounds.getEast())*n),o=Math.ceil(t.Y(this.bounds.getSouth())*n);return e.x>=r&&e.x<a&&e.y>=i&&e.y<o}}class de extends t.E{constructor(e,n,r,i){if(super(),this.id=e,this.dispatcher=r,this.type=`vector`,this.minzoom=0,this.maxzoom=22,this.scheme=`xyz`,this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,t.e(this,t.V(n,[`url`,`scheme`,`tileSize`,`promoteId`,`encoding`])),this._options=t.e({type:`vector`},n),this._collectResourceTiming=n.collectResourceTiming,this.tileSize!==512)throw Error(`vector tile sources must have a tileSize of 512`);this.setEventedParent(i)}load(){return t._(this,arguments,void 0,(function*(e=!1){this._loaded=!1,this.fire(new t.n(`dataloading`,{dataType:`source`})),this._tileJSONRequest=new AbortController;try{let n=yield ce(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,n&&(t.e(this,n),n.bounds&&(this.tileBounds=new u
vendor: 3,141 bytes, line 9
9e(n.bounds,this.minzoom,this.maxzoom)),this.fire(new t.n(`data`,{dataType:`source`,sourceDataType:`metadata`})),this.fire(new t.n(`data`,{dataType:`source`,sourceDataType:`content`,sourceDataChanged:e})))}catch(e){this._tileJSONRequest=null,this._loaded=!0,t.$(e)||this.fire(new t.l(t.d(e)))}}))}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}setSourceProperty(e){this._tileJSONRequest&&this._tileJSONRequest.abort(),e(),this.load(!0)}setTiles(e){return this.setSourceProperty((()=>{this._options.tiles=e})),this}setUrl(e){return this.setSourceProperty((()=>{this.url=e,this._options.url=e})),this}onRemove(){this._tileJSONRequest&&=(this._tileJSONRequest.abort(),null)}serialize(){return t.e({},this._options)}loadTile(e){return t._(this,void 0,void 0,(function*(){let t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),n={request:yield this.map._requestManager.transformRequest(t,`Tile`),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,encoding:this.encoding,overzoomParameters:yield this._getOverzoomParameters(e),etag:e.etag};n.request.collectResourceTiming=this._collectResourceTiming;let r=`RT`;if(e.actor&&e.state!==`expired`){if(e.state===`loading`)return new Promise(((t,n)=>{e.reloadPromise={resolve:t,reject:n}}))}else e.actor=this.dispatcher.getActor(),r=`LT`;e.abortController=new AbortController;try{let t=yield e.actor.sendAsync({type:r,data:n},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,t);let i={};return t!=null&&t.etagUnmodified&&(i.unmodified=!0),i}catch(t){if(delete e.abortController,e.aborted)return;if(t&&t.status!==404)throw t;this._afterTileLoadWorkerResponse(e,null)}}))}_getOverzoomParameters(e){return t._(this,void 0,void 0,(function*(){if(e.tileID.canonical.z<=this.maxzoom||this.map._zoomLevelsToOverscale===void 0)return;let t=e.tileID.scaledTo(this.maxzoom).canonical,n=t.url(this.tiles,this.map.getPixelRatio(),this.scheme);return{maxZoomTileID:t,overzoomRequest:yield this.map._requestManager.transformRequest(n,`Tile`)}}))}_afterTileLoadWorkerResponse(e,t){if(t!=null&&t.resourceTiming&&(e.resourceTiming=t.resourceTiming),t&&this.map._refreshExpiredTiles&&e.setExpiryData(t),e.etag=t?.etag,e.loadVectorData(t,this.map.painter),e.reloadPromise){let t=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(t.resolve).catch(t.reject)}}abortTile(e){return t._(this,void 0,void 0,(function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.actor&&(yield e.actor.sendAsync({type:`AT`,data:{uid:e.uid,type:this.type,source:this.id}}))}))}unloadTile(e){return t._(this,void 0,void 0,(function*(){e.unloadVectorData(),e.actor&&(yield e.actor.sendAsync({type:`RMT`,data:{uid:e.uid,type:this.type,source:this.id}}))}))}hasTransition(){return!1}}class 
vendor: 24,243 bytes, line 9
9fe extends t.E{constructor(e,n,r,i){super(),this.id=e,this.dispatcher=r,this.setEventedParent(i),this.type=`raster`,this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme=`xyz`,this.tileSize=512,this._loaded=!1,this._options=t.e({type:`raster`},n),t.e(this,t.V(n,[`url`,`scheme`,`tileSize`]))}load(){return t._(this,arguments,void 0,(function*(e=!1){this._loaded=!1,this.fire(new t.n(`dataloading`,{dataType:`source`})),this._tileJSONRequest=new AbortController;try{let n=yield ce(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,n&&(t.e(this,n),n.bounds&&(this.tileBounds=new ue(n.bounds,this.minzoom,this.maxzoom)),this.fire(new t.n(`data`,{dataType:`source`,sourceDataType:`metadata`})),this.fire(new t.n(`data`,{dataType:`source`,sourceDataType:`content`,sourceDataChanged:e})))}catch(e){this._tileJSONRequest=null,this._loaded=!0,t.$(e)||this.fire(new t.l(t.d(e)))}}))}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&=(this._tileJSONRequest.abort(),null)}setSourceProperty(e){this._tileJSONRequest&&=(this._tileJSONRequest.abort(),null),e(),this.load(!0)}setTiles(e){return this.setSourceProperty((()=>{this._options.tiles=e})),this}setUrl(e){return this.setSourceProperty((()=>{this.url=e,this._options.url=e})),this}serialize(){return t.e({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e){return t._(this,void 0,void 0,(function*(){let n=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.abortController=new AbortController;try{let r=yield u.getImage(yield this.map._requestManager.transformRequest(n,`Tile`),e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state=`unloaded`);if(r?.data){this.map._refreshExpiredTiles&&(r.cacheControl||r.expires)&&e.setExpiryData({cacheControl:r.cacheControl,expires:r.expires});let n=this.map.painter.context,i=n.gl,a=r.data;e.texture=this.map.painter.getTileTexture(a.width),e.texture?e.texture.update(a,{useMipmap:!0}):(e.texture=new t.T(n,a,i.RGBA,{useMipmap:!0}),e.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE,i.LINEAR_MIPMAP_NEAREST)),e.state=`loaded`}}catch(t){if(delete e.abortController,e.aborted)e.state=`unloaded`;else if(t)throw e.state=`errored`,t}}))}abortTile(e){return t._(this,void 0,void 0,(function*(){e.abortController&&(e.abortController.abort(),delete e.abortController)}))}unloadTile(e){return t._(this,void 0,void 0,(function*(){e.texture&&this.map.painter.saveTileTexture(e.texture)}))}hasTransition(){return!1}}class pe extends fe{constructor(e,n,r,i){super(e,n,r,i),this.type=`raster-dem`,this.maxzoom=22,this._options=t.e({type:`raster-dem`},n),this.encoding=n.encoding||`mapbox`,this.redFactor=n.redFactor,this.greenFactor=n.greenFactor,this.blueFactor=n.blueFactor,this.baseShift=n.baseShift}loadTile(e){return t._(this,void 0,void 0,(function*(){let n=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),r=yield this.map._requestManager.transformRequest(n,`Tile`);e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{let n=yield u.getImage(r,e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state=`unloaded`);if(n?.data){let r=n.data;this.map._refreshExpiredTiles&&(n.cacheControl||n.expires)&&e.setExpiryData({cacheControl:n.cacheControl,expires:n.expires});let i=t.b(r)&&t.a0()?r:yield this.readImageNow(r),a={type:this.type,uid:e.uid,source:this.id,rawImageData:i,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(e.actor&&e.state!==`expired`&&e.state!==`reloading`)return;e.actor&&e.state!==`expired`||(e.actor=this.dispatcher.getActor()),e.dem=yield e.actor.sendAsync({type:`LDT`,data:a}),e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state=`loaded`}}catch(t){if(delete e.abortController,e.aborted)e.state=`unloaded`;else if(t)throw e.state=`errored`,t}}))}readImageNow(e){return t._(this,void 0,void 0,(function*(){if(typeof VideoFrame<`u`&&t.a1()){let n=e.width+2,r=e.height+2;try{return new t.R({width:n,height:r},yield t.a2(e,-1,-1,n,r))}catch{}}return s.getImageData(e,1)}))}_getNeighboringTiles(e){let n=e.canonical,r=2**n.z,i=(n.x-1+r)%r,a=n.x===0?e.wrap-1:e.wrap,o=(n.x+1+r)%r,s=n.x+1===r?e.wrap+1:e.wrap,c={};return c[new t.a3(e.overscaledZ,a,n.z,i,n.y).key]={backfilled:!1},c[new t.a3(e.overscaledZ,s,n.z,o,n.y).key]={backfilled:!1},n.y>0&&(c[new t.a3(e.overscaledZ,a,n.z,i,n.y-1).key]={backfilled:!1},c[new t.a3(e.overscaledZ,e.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},c[new t.a3(e.overscaledZ,s,n.z,o,n.y-1).key]={backfilled:!1}),n.y+1<r&&(c[new t.a3(e.overscaledZ,a,n.z,i,n.y+1).key]={backfilled:!1},c[new t.a3(e.overscaledZ,e.wrap,n.z,n.x,n.y+1).key]={backfilled:!1},c[new t.a3(e.overscaledZ,s,n.z,o,n.y+1).key]={backfilled:!1}),c}unloadTile(e){return t._(this,void 0,void 0,(function*(){e.demTexture&&this.map.painter.saveTileTexture(e.demTexture),e.fbo&&(e.fbo.destroy(),delete e.fbo),e.dem&&delete e.dem,delete e.neighboringTiles,e.state=`unloaded`,e.actor&&(yield e.actor.sendAsync({type:`RDT`,data:{type:this.type,uid:e.uid,source:this.id}}))}))}}function me(e,t){return t?e.properties[t]:e.id}function he(e,t){let n={id:e.id};if(t.removeAllProperties&&(delete e.removeProperties,delete e.addOrUpdateProperties,delete t.removeProperties),t.removeProperties)for(let n of t.removeProperties){let t=e.addOrUpdateProperties.findIndex((e=>e.key===n));t>-1&&e.addOrUpdateProperties.splice(t,1)}return(e.removeAllProperties||t.removeAllProperties)&&(n.removeAllProperties=!0),(e.removeProperties||t.removeProperties)&&(n.removeProperties=[...e.removeProperties||[],...t.removeProperties||[]]),(e.addOrUpdateProperties||t.addOrUpdateProperties)&&(n.addOrUpdateProperties=[...e.addOrUpdateProperties||[],...t.addOrUpdateProperties||[]]),(e.newGeometry||t.newGeometry)&&(n.newGeometry=t.newGeometry||e.newGeometry),n}function ge(e){if(!e)return{};let t={};return t.removeAll=e.removeAll,t.remove=new Set(e.remove||[]),t.add=new Map(e.add?.map((e=>[e.id,e]))),t.update=new Map(e.update?.map((e=>[e.id,e]))),t}function _e(e){return e&&e.length!==0?typeof e[0]==`number`?[e]:e.flatMap((e=>_e(e))):[]}function ve(e){return e.type===`GeometryCollection`?e.geometries.flatMap((e=>ve(e))):_e(e.coordinates)}function ye(e){let t=new le,n;switch(e.type){case`FeatureCollection`:n=e.features.flatMap((e=>ve(e.geometry)));break;case`Feature`:n=ve(e.geometry);break;default:n=ve(e)}if(n.length===0)return t;for(let e of n){let[n,r]=e;t.extend([n,r])}return t}class be extends t.E{constructor(e,n,r,i){super(),this.id=e,this.type=`geojson`,this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._isUpdatingWorker=!1,this._pendingWorkerUpdate={data:n.data},this.actor=r.getActor(),this.setEventedParent(i),this._data=typeof n.data==`string`?{url:n.data}:{geojson:n.data},this._options=t.e({},n),this._collectResourceTiming=n.collectResourceTiming,n.maxzoom!==void 0&&(this.maxzoom=n.maxzoom),n.type&&(this.type=n.type),n.attribution&&(this.attribution=n.attribution),this.promoteId=n.promoteId,n.clusterMaxZoom!==void 0&&this.maxzoom<=n.clusterMaxZoom&&t.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${n.clusterMaxZoom}".`),this.workerOptions=t.e({source:this.id,geojsonVtOptions:{buffer:this._pixelsToTileUnits(n.buffer===void 0?128:n.buffer),tolerance:this._pixelsToTileUnits(n.tolerance===void 0?.375:n.tolerance),extent:t.a6,maxZoom:this.maxzoom,lineMetrics:n.lineMetrics||!1,generateId:n.generateId||!1,promoteId:typeof n.promoteId==`string`?n.promoteId:void 0,cluster:n.cluster||!1,clusterOptions:{maxZoom:this._getClusterMaxZoom(n.clusterMaxZoom),minPoints:Math.max(2,n.clusterMinPoints||2),extent:t.a6,radius:this._pixelsToTileUnits(n.clusterRadius||50),log:!1,generateId:n.generateId||!1}},clusterProperties:n.clusterProperties,filter:n.filter},n.workerOptions)}_hasPendingWorkerUpdate(){return this._pendingWorkerUpdate.data!==void 0||this._pendingWorkerUpdate.diff!==void 0||this._pendingWorkerUpdate.updateCluster}_pixelsToTileUnits(e){return e*(t.a6/this.tileSize)}_getClusterMaxZoom(e){let n=e?Math.round(e):this.maxzoom-1;return Number.isInteger(e)||e===void 0||t.w(`Integer expected for option 'clusterMaxZoom': provided value "${e}" rounded to "${n}"`),n}load(){return t._(this,void 0,void 0,(function*(){yield this._updateWorkerData()}))}onAdd(e){this.map=e,this.load()}setData(e,t){this._data=typeof e==`string`?{url:e}:{geojson:e},this._pendingWorkerUpdate={data:e};let n=this._updateWorkerData();return t?n:this}updateData(e,t){this._pendingWorkerUpdate.diff=function(e,t){if(!e)return t||{};if(!t)return e||{};let n=ge(e),r=ge(t);(function(e,t){t.removeAll&&(e.add.clear(),e.update.clear(),e.remove.clear(),t.remove.clear());for(let n of t.remove)e.add.delete(n),e.update.delete(n);for(let[n,r]of t.update){let i=e.update.get(n);i&&(t.update.set(n,he(i,r)),e.update.delete(n))}})(n,r);let i={};if((n.removeAll||r.removeAll)&&(i.removeAll=!0),i.remove=new Set([...n.remove,...r.remove]),i.add=new Map([...n.add,...r.add]),i.update=new Map([...n.update,...r.update]),i.remove.size&&i.add.size)for(let e of i.add.keys())i.remove.delete(e);return function(e){let t={};return e.removeAll&&(t.removeAll=e.removeAll),e.remove&&(t.remove=Array.from(e.remove)),e.add&&(t.add=Array.from(e.add.values())),e.update&&(t.update=Array.from(e.update.values())),t}(i)}(this._pendingWorkerUpdate.diff,e);let n=this._updateWorkerData();return t?n:this}getData(){return t._(this,void 0,void 0,(function*(){return this._data.url&&(yield this.once(`data`)),this._data.geojson?this._data.geojson:{type:`FeatureCollection`,features:Array.from(this._data.updateable.values())}}))}getBounds(){return t._(this,void 0,void 0,(function*(){return ye(yield this.getData())}))}setClusterOptions(e){return this.workerOptions.geojsonVtOptions.cluster=e.cluster,e.clusterRadius!==void 0&&(this.workerOptions.geojsonVtOptions.clusterOptions.radius=this._pixelsToTileUnits(e.clusterRadius)),e.clusterMaxZoom!==void 0&&(this.workerOptions.geojsonVtOptions.clusterOptions.maxZoom=this._getClusterMaxZoom(e.clusterMaxZoom)),this._pendingWorkerUpdate.updateCluster=!0,this._updateWorkerData(),this}getClusterExpansionZoom(e){return this.actor.sendAsync({type:`GCEZ`,data:{type:this.type,clusterId:e,source:this.id}})}getClusterChildren(e){return this.actor.sendAsync({type:`GCC`,data:{type:this.type,clusterId:e,source:this.id}})}getClusterLeaves(e,t,n){return this.actor.sendAsync({type:`GCL`,data:{type:this.type,source:this.id,clusterId:e,limit:t,offset:n}})}_updateWorkerData(){return t._(this,void 0,void 0,(function*(){if(this._isUpdatingWorker)return;if(!this._hasPendingWorkerUpdate())return void t.w(`No pending worker updates for GeoJSONSource ${this.id}.`);let{data:e,diff:n,updateCluster:r}=this._pendingWorkerUpdate,i=this._getLoadGeoJSONParameters(e,n,r);e===void 0?n?this._pendingWorkerUpdate.diff=void 0:r&&(this._pendingWorkerUpdate.updateCluster=void 0):this._pendingWorkerUpdate.data=void 0,yield this._dispatchWorkerUpdate(i)}))}_getLoadGeoJSONParameters(e,n,r){return t._(this,void 0,void 0,(function*(){let i=t.e({type:this.type},this.workerOptions);return typeof e==`string`?(i.request=yield this.map._requestManager.transformRequest(s.resolveURL(e),`Source`),i.request.collectResourceTiming=this._collectResourceTiming,i):e===void 0?n?(i.dataDiff=n,i):r?(i.updateCluster=!0,i):void 0:(i.data=e,i)}))}_dispatchWorkerUpdate(e){return t._(this,void 0,void 0,(function*(){this._isUpdatingWorker=!0,this.fire(new t.n(`dataloading`,{dataType:`source`}));try{let n=yield e,r=yield this.actor.sendAsync({type:`LD`,data:n});if(this._isUpdatingWorker=!1,this._removed||r.abandoned)return void this.fire(new t.n(`dataabort`,{dataType:`source`}));r.data&&(this._data={geojson:r.data});let i=this._applyDiffToSource(n.dataDiff),a=this._getShouldReloadTileOptions(i),o={dataType:`source`};this._applyResourceTiming(o,r),this.fire(new t.n(`data`,Object.assign(Object.assign({},o),{sourceDataType:`metadata`}))),this.fire(new t.n(`data`,Object.assign(Object.assign({},o),{sourceDataType:`content`,shouldReloadTileOptions:a})))}catch(e){if(this._isUpdatingWorker=!1,this._removed)return void this.fire(new t.n(`dataabort`,{dataType:`source`}));this.fire(new t.l(t.d(e)))}finally{this._hasPendingWorkerUpdate()&&this._updateWorkerData()}}))}_applyResourceTiming(e,n){if(!this._collectResourceTiming)return;let r=n.resourceTiming?.[this.id];if(!r)return;let i=r.slice(0);i!=null&&i.length&&t.e(e,{resourceTiming:i})}_applyDiffToSource(e){if(!e)return;let t=typeof this.promoteId==`string`?this.promoteId:void 0;if(!this._data.url&&!this._data.updateable){let e=function(e,t){let n=new Map;if(e==null||e.type==null)return n;if(e.type===`Feature`){let r=me(e,t);return r==null?void 0:(n.set(r,e),n)}if(e.type===`FeatureCollection`){let r=new Set;for(let i of e.features){let e=me(i,t);if(e==null||r.has(e))return;r.add(e),n.set(e,i)}return n}}(this._data.geojson,t);if(!e)throw Error(`GeoJSONSource "${this.id}": GeoJSON data is not compatible with updateData`);this._data={updateable:e}}if(!this._data.updateable)return;let n=function(e,t,n){let r=[];if(t.removeAll)e.clear();else if(t.remove)for(let n of t.remove){let t=e.get(n);t&&(r.push(t.geometry),e.delete(n))}if(t.add)for(let i of t.add){let t=me(i,n);if(t==null)continue;let a=e.get(t);a&&r.push(a.geometry),r.push(i.geometry),e.set(t,i)}if(t.update)for(let n of t.update){let t=e.get(n.id);if(!t)continue;let i=!!n.newGeometry,a=n.removeAllProperties||n.removeProperties?.length>0||n.addOrUpdateProperties?.length>0;if(!i&&!a)continue;r.push(t.geometry);let o=Object.assign({},t);if(e.set(n.id,o),i&&(r.push(n.newGeometry),o.geometry=n.newGeometry),a){if(o.properties=n.removeAllProperties?{}:Object.assign({},o.properties||{}),n.removeProperties)for(let e of n.removeProperties)delete o.properties[e];if(n.addOrUpdateProperties)for(let{key:e,value:t}of n.addOrUpdateProperties)o.properties[e]=t}}return r}(this._data.updateable,e,t);return e.removeAll||this._options.cluster?void 0:n}_getShouldReloadTileOptions(e){if(e)return{affectedBounds:e.filter(Boolean).map((e=>ye(e)))}}shouldReloadTile(e,{affectedBounds:n}){if(e.state===`loading`)return!0;if(e.state===`unloaded`)return!1;let{buffer:r,extent:i}=this.workerOptions.geojsonVtOptions,a=function({x:e,y:n,z:r},i=0){let a=t.a4((e-i)/2**r),o=t.a5((n+1+i)/2**r),s=t.a4((e+1+i)/2**r),c=t.a5((n-i)/2**r);return new le([a,o],[s,c])}(e.tileID.canonical,r/i);for(let e of n)if(a.intersects(e))return!0;return!1}loaded(){return!this._isUpdatingWorker&&!this._hasPendingWorkerUpdate()}loadTile(e){return t._(this,void 0,void 0,(function*(){let t=e.actor?`RT`:`LT`;e.actor=this.actor;let n={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};e.abortController=new AbortController;let r=yield this.actor.sendAsync({type:t,data:n},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(r,this.map.painter,t===`RT`)}))}abortTile(e){return t._(this,void 0,void 0,(function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.aborted=!0}))}unloadTile(e){return t._(this,void 0,void 0,(function*(){e.unloadVectorData(),yield this.actor.sendAsync({type:`RMT`,data:{uid:e.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 t.e({},this._options,{type:this.type,data:this._data.updateable?{type:`FeatureCollection`,features:Array.from(this._data.updateable.values())}:this._data.url||this._data.geojson})}hasTransition(){return!1}}class xe extends t.E{constructor(e,t,n,r){super(),this.flippedWindingOrder=!1,this.id=e,this.dispatcher=n,this.coordinates=t.coordinates,this.type=`image`,this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(r),this.options=t}load(e){return t._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new t.n(`dataloading`,{dataType:`source`})),this.url=this.options.url,this._request=new AbortController;try{let t=yield u.getImage(yield this.map._requestManager.transformRequest(this.url,`Image`),this._request);this._request=null,this._loaded=!0,t!=null&&t.data&&(this.image=t.data,e&&(this.coordinates=e),this._finishLoading())}catch(e){this._request=null,this._loaded=!0,t.$(e)||this.fire(new t.l(t.d(e)))}}))}loaded(){return this._loaded}updateImage(e){return e.url?(this._request&&=(this._request.abort(),null),this.options.url=e.url,this.load(e.coordinates).finally((()=>this.texture=null)),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new t.n(`data`,{dataType:`source`,sourceDataType:`metadata`})))}onAdd(e){this.map=e,this.load()}onRemove(){this._request&&=(this._request.abort(),null)}setCoordinates(e){this.coordinates=e;let n=e.map(t.a7.fromLngLat);var r;return this.tileID=function(e){let n=t.a8.fromPoints(e),r=n.width(),i=n.height(),a=Math.max(0,Math.floor(-Math.log(Math.max(r,i))/Math.LN2)),o=2**a;return new t.aa(a,Math.floor((n.minX+n.maxX)/2*o),Math.floor((n.minY+n.maxY)/2*o))}(n),this.terrainTileRanges=this._getOverlappingTileRanges(n),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=n.map((e=>this.tileID.getTilePoint(e)._round())),this.flippedWindingOrder=((r=this.tileCoords)[1].x-r[0].x)*(r[2].y-r[0].y)-(r[1].y-r[0].y)*(r[2].x-r[0].x)<0,this.fire(new t.n(`data`,{dataType:`source`,sourceDataType:`content`})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;let e=this.map.painter.context,n=e.gl;this.texture||(this.texture=new t.T(e,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let r=!1;for(let e in this.tiles){let t=this.tiles[e];t.state!==`loaded`&&(t.state=`loaded`,t.texture=this.texture,r=!0)}r&&this.fire(new t.n(`data`,{dataType:`source`,sourceDataType:`idle`,sourceId:this.id}))}loadTile(e){return t._(this,void 0,void 0,(function*(){this.tileID?.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={}):e.state=`errored`}))}serialize(){return{type:`image`,url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}_getOverlappingTileRanges(e){let{minX:n,minY:r,maxX:i,maxY:a}=t.a8.fromPoints(e),o={};for(let e=0;e<=t.a9;e++){let t=2**e,s=Math.floor(n*t),c=Math.floor(r*t),l=Math.floor(i*t),u=Math.floor(a*t),d=(s%t+t)%t,f=l%t;o[e]={minWrap:Math.floor(s/t),maxWrap:Math.floor(l/t),minTileXWrapped:d,maxTileXWrapped:f,minTileY:c,maxTileY:u}}return o}}class Se extends xe{constructor(e,t,n,r){super(e,t,n,r),this._onPlayingHandler=()=>{var e;(e=this.map)==null||e.triggerRepaint()},this.roundZoom=!0,this.type=`video`,this.options=t}load(){return t._(this,void 0,void 0,(function*(){this._loaded=!1;let e=this.options;this.urls=[];for(let t of e.urls)this.urls.push((yield this.map._requestManager.transformRequest(t,`Source`)).url);try{let e=yield t.ab(this.urls);if(this._loaded=!0,!e)return;this.video=e,this.video.loop=!0,this.video.addEventListener(`playing`,this._onPlayingHandler),this.map&&this.video.play(),this._finishLoading()}catch(e){this.fire(new t.l(t.d(e)))}}))}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){let n=this.video.seekable;e<n.start(0)||e>n.end(0)?this.fire(new t.l(new t.ac(`sources.${this.id}`,null,`Playback for this video can be set only between the ${n.start(0)} and ${n.end(0)}-second mark.`))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}onRemove(){super.onRemove(),this.video&&(this.video.removeEventListener(`playing`,this._onPlayingHandler),this.video.pause())}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;let e=this.map.painter.context,n=e.gl;this.texture?this.video.paused||(this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,this.video)):(this.texture=new t.T(e,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let r=!1;for(let e in this.tiles){let t=this.tiles[e];t.state!==`loaded`&&(t.state=`loaded`,t.texture=this.texture,r=!0)}r&&this.fire(new t.n(`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 Ce extends xe{constructor(e,n,r,i){super(e,n,r,i),n.coordinates?Array.isArray(n.coordinates)&&n.coordinates.length===4&&!n.coordinates.some((e=>!Array.isArray(e)||e.length!==2||e.some((e=>typeof e!=`number`))))||this.fire(new t.l(new t.ac(`sources.${e}`,null,`"coordinates" property must be an array of 4 longitude/latitude array pairs`))):this.fire(new t.l(new t.ac(`sources.${e}`,null,`missing required property "coordinates"`))),n.animate&&typeof n.animate!=`boolean`&&this.fire(new t.l(new t.ac(`sources.${e}`,null,`optional "animate" property must be a boolean value`))),n.canvas?typeof n.canvas==`string`||n.canvas instanceof HTMLCanvasElement||this.fire(new t.l(new t.ac(`sources.${e}`,null,`"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance`))):this.fire(new t.l(new t.ac(`sources.${e}`,null,`missing required property "canvas"`))),this.options=n,this.animate=n.animate===void 0||n.animate}load(){return t._(this,void 0,void 0,(function*(){this._loaded=!0,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 t.l(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(),!1)},this._finishLoading())}))}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;let n=this.map.painter.context,r=n.gl;this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):(this.texture=new t.T(n,this.canvas,r.RGBA,{premultiply:!0}),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE));let i=!1;for(let e in this.tiles){let t=this.tiles[e];t.state!==`loaded`&&(t.state=`loaded`,t.texture=this.texture,i=!0)}i&&this.fire(new t.n(`data`,{dataType:`source`,sourceDataType:`idle`,sourceId:this.id}))}serialize(){return{type:`canvas`,animate:this.animate,canvas:this.options.canvas,coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}}let we={},Te=e=>{switch(e){case`geojson`:return be;case`image`:return xe;case`raster`:return fe;case`raster-dem`:return pe;case`vector`:return de;case`video`:return Se;case`canvas`:return Ce}return we[e]},Ee=`RTLPluginLoaded`;class De extends t.E{constructor(){super(...arguments),this.status=`unavailable`,this.url=null,this.dispatcher=j()}_syncState(e){return this.status=e,this.dispatcher.broadcast(`SRPS`,{pluginStatus:e,pluginURL:this.url}).catch((e=>{throw this.status=`error`,e}))}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status=`unavailable`,this.url=null}setRTLTextPlugin(e){return t._(this,arguments,void 0,(function*(e,t=!1){if(this.url)throw Error(`setRTLTextPlugin cannot be called multiple times.`);if(this.url=s.resolveURL(e),!this.url)throw Error(`requested url ${e}
9 is invalid`);if(this.status===`unavailable`){if(!t)return this._requestImport();this.status=`deferred`,this._syncState(this.status)}else if(this.status===`requested`)return this._requestImport()}))}_requestImport(){return t._(this,void 0,void 0,(function*(){yield this._syncState(`loading`),this.status=`loaded`,this.fire(new t.n(Ee))}))}lazyLoad(){this.status===`unavailable`?this.status=`requested`:this.status===`deferred`&&this._requestImport()}}let Oe=null;function ke(){return Oe||=new De,Oe}var Ae,je;(function(e){e[e.Base=0]=`Base`,e[e.Parent=1]=`Parent`})(Ae||={}),function(e){e[e.Departing=0]=`Departing`,e[e.Incoming=1]=`Incoming`}(je||={});class Me{constructor(e,n){this.timeAdded=0,this.fadeEndTime=0,this.fadeOpacity=1,this.tileID=e,this.uid=t.ad(),this.uses=0,this.tileSize=n,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttFingerprint={},this.expiredRequestCount=0,this.state=`loading`}isRenderable(e){return this.hasData()&&(!this.fadeEndTime||this.fadeOpacity>0)&&(e||!this.holdingForSymbolFade())}setCrossFadeLogic({fadingRole:e,fadingDirection:t,fadingParentID:n,fadeEndTime:r}){this.resetFadeLogic(),this.fadingRole=e,this.fadingDirection=t,this.fadingParentID=n,this.fadeEndTime=r}setSelfFadeLogic(e){this.resetFadeLogic(),this.selfFading=!0,this.fadeEndTime=e}resetFadeLogic(){this.fadingRole=null,this.fadingDirection=null,this.fadingParentID=null,this.selfFading=!1,this.timeAdded=l(),this.fadeEndTime=0,this.fadeOpacity=1}wasRequested(){return this.state===`errored`||this.state===`loaded`||this.state===`reloading`}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(e,n,r){if(!0!==e?.etagUnmodified)if(this.hasData()&&this.unloadVectorData(),this.state=`loaded`,e){e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestEncoding=e.encoding,this.latestFeatureIndex.rawTileData=e.rawTileData,this.latestFeatureIndex.encoding=e.encoding):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData,this.latestFeatureIndex.encoding=this.latestEncoding)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=function(e,t){let n={};if(!t)return n;for(let r of e){let e=r.layerIds.map((e=>t.getLayer(e))).filter(Boolean);if(e.length!==0){r.layers=e,r.stateDependentLayerIds&&(r.stateDependentLayers=r.stateDependentLayerIds.map((t=>e.filter((e=>e.id===t))[0])));for(let t of e)n[t.id]=r}}return n}(e.buckets,n?.style),this.hasSymbolBuckets=!1;for(let e in this.buckets){let n=this.buckets[e];if(n instanceof t.af){if(this.hasSymbolBuckets=!0,!r)break;n.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let e in this.buckets){let n=this.buckets[e];if(n instanceof t.af&&n.hasRTLText){this.hasRTLText=!0,ke().lazyLoad();break}}this.queryPadding=0;for(let e in this.buckets){let t=this.buckets[e];this.queryPadding=Math.max(this.queryPadding,n.style.getLayer(e).queryRadius(t))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage),this.dashPositions=e.dashPositions}else this.collisionBoxArray=new t.ae;else this.state=`loaded`}unloadVectorData(){for(let e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.imageAtlas=null,this.dashPositions=null,this.latestFeatureIndex=null,this.state=`unloaded`}getBucket(e){return this.buckets[e.id]}upload(e){for(let t in this.buckets){let n=this.buckets[t];n.uploadPending()&&n.upload(e)}let n=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new t.T(e,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&=(this.glyphAtlasTexture=new t.T(e,this.glyphAtlasImage,n.ALPHA),null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,t,n,r,i,a,o,s,c,l,u){return this.latestFeatureIndex?.rawTileData?this.latestFeatureIndex.query({queryGeometry:r,cameraQueryGeometry:i,scale:a,tileSize:this.tileSize,pixelPosMatrix:l,transform:s,params:o,queryPadding:this.queryPadding*c,getElevation:u},e,t,n):{}}querySourceFeatures(e,n){let r=this.latestFeatureIndex;if(!r?.rawTileData)return;let i=r.loadVTLayers(),a=n?.sourceLayer?n.sourceLayer:``,o=i[t.ag]||i[a];if(!o)return;let s=t.ah(n?.filter,n?.globalState),{z:c,x:l,y:u}=this.tileID.canonical,d={z:c,x:l,y:u};for(let n=0;n<o.length;n++){let i=o.feature(n);if(s.needGeometry){let e=t.ai(i,!0);
vendor: 64,752 bytes, lines 9-36
9if(!s.filter(new t.J(this.tileID.overscaledZ),e,this.tileID.canonical))continue}else if(!s.filter(new t.J(this.tileID.overscaledZ),i))continue;let f=r.getId(i,a),p=new t.aj(i,c,l,u,f);p.tile=d,e.push(p)}}hasData(){return this.state===`loaded`||this.state===`reloading`||this.state===`expired`}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){let n=this.expirationTime;if(e.cacheControl){let n=t.ak(e.cacheControl);n[`max-age`]&&(this.expirationTime=Date.now()+1e3*n[`max-age`])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){let e=Date.now(),t=!1;if(this.expirationTime>e)t=!1;else if(n)if(this.expirationTime<n)t=!0;else{let r=this.expirationTime-n;r?this.expirationTime=e+Math.max(r,3e4):t=!0}else t=!0;t?(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(),2**31-1)}setFeatureState(e,n){if(!this.latestFeatureIndex?.rawTileData||Object.keys(e).length===0)return;let r=this.latestFeatureIndex.loadVTLayers();for(let i in this.buckets){if(!n.style.hasLayer(i))continue;let a=this.buckets[i],o=a.layers[0].sourceLayer||t.ag,s=r[o],c=e[o];if(!s||!c||Object.keys(c).length===0)continue;a.update(c,s,this.imageAtlas?.patternPositions||{},this.dashPositions||{});let l=(n?.style)?.getLayer(i);l&&(this.queryPadding=Math.max(this.queryPadding,l.queryRadius(a)))}}holdingForSymbolFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<l()}clearSymbolFadeHold(){this.symbolFadeHoldUntil=void 0}setSymbolHoldDuration(e){this.symbolFadeHoldUntil=l()+e}setDependencies(e,t){let n={};for(let e of t)n[e]=!0;this.dependencies[e]=n}hasDependency(e,t){for(let n of e){let e=this.dependencies[n];if(e){for(let n of t)if(e[n])return!0}}return!1}}class Ne{constructor(){this.state={},this.stateChanges={},this.deletedStates={},this.revision=0}updateState(e,n,r){var i,a;let o=String(n);if((i=this.stateChanges)[e]||(i[e]={}),(a=this.stateChanges[e])[o]||(a[o]={}),t.e(this.stateChanges[e][o],r),this.deletedStates[e]===null){this.deletedStates[e]={};for(let t in this.state[e])t!==o&&(this.deletedStates[e][t]=null)}else if(this.deletedStates[e]?.[o]===null){this.deletedStates[e][o]={};for(let t in this.state[e][o])r[t]||(this.deletedStates[e][o][t]=null)}else for(let t in r)this.deletedStates[e]?.[o]?.[t]===null&&delete this.deletedStates[e][o][t]}removeFeatureState(e,t,n){var r,i;if(this.deletedStates[e]===null)return;let a=String(t);if((r=this.deletedStates)[e]||(r[e]={}),n&&t!==void 0)this.deletedStates[e][a]!==null&&((i=this.deletedStates[e])[a]||(i[a]={}),this.deletedStates[e][a][n]=null);else if(t!==void 0)if(this.stateChanges[e]?.[a])for(n in this.deletedStates[e][a]={},this.stateChanges[e][a])this.deletedStates[e][a][n]=null;else this.deletedStates[e][a]=null;else this.deletedStates[e]=null}getState(e,n){let r=String(n),i=t.e({},(this.state[e]||{})[r],(this.stateChanges[e]||{})[r]);if(this.deletedStates[e]===null)return{};if(this.deletedStates[e]){let t=this.deletedStates[e][n];if(t===null)return{};for(let e in t)delete i[e]}return i}initializeTileState(e,t){e.setFeatureState(this.state,t)}coalesceChanges(e,n){var r,i,a;let o={};for(let e in this.stateChanges){(r=this.state)[e]||(r[e]={});let n={};for(let r in this.stateChanges[e])(i=this.state[e])[r]||(i[r]={}),t.e(this.state[e][r],this.stateChanges[e][r]),n[r]=this.state[e][r];o[e]=n}for(let e in this.deletedStates){(a=this.state)[e]||(a[e]={});let n={};if(this.deletedStates[e]===null)for(let t in this.state[e])n[t]={},this.state[e][t]={};else for(let t in this.deletedStates[e]){if(this.deletedStates[e][t]===null)this.state[e][t]={};else for(let n of Object.keys(this.deletedStates[e][t]))delete this.state[e][t][n];n[t]=this.state[e][t]}o[e]||(o[e]={}),t.e(o[e],n)}this.stateChanges={},this.deletedStates={},Object.keys(o).length!==0&&(this.revision++,e.setFeatureState(o,n))}}let Pe=89.25;function Fe(e,n){let r=t.al(n.lat,-t.am,t.am);return new t.P(t.Z(n.lng)*e,t.Y(r)*e)}function Ie(e,n){return new t.a7(n.x/e,n.y/e).toLngLat()}function Le(e){return e.cameraToCenterDistance*Math.min(.85*Math.tan(t.an(90-e.pitch)),Math.tan(t.an(Pe-e.pitch)))}function Re(e,n){let r=e.canonical,i=n/t.ao(r.z),a=r.x+2**r.z*e.wrap,o=t.ap(new Float64Array(16));return t.Q(o,o,[a*i,r.y*i,0]),t.S(o,o,[i/t.a6,i/t.a6,1]),o}function ze(e,n,r,i,a){let o=t.a7.fromLngLat(e,n),s=a*t.aq(1,e.lat),{x:c,y:l,z:u}=Be(r,i);return new t.a7(o.x+s*-c,o.y+s*-l,o.z+s*-u)}function Be(e,n){let r=t.an(e),i=t.an(n),a=Math.cos(-r),o=Math.sin(r);return{x:o*Math.sin(i),y:-o*Math.cos(i),z:a}}function N(e,t,n){let r=t.intersectsFrustum(e);if(!n||r===0)return r;let i=t.intersectsPlane(n);return i===0?0:r===2&&i===2?2:1}function Ve(e,t,n){let r=0,i=(n-t)/10;for(let a=0;a<10;a++)r+=i*Math.cos(t+(a+.5)/10*(n-t))**+e;return r}function He(e,n){return function(r,i,a,o,s){let c=2*((e-1)/t.ar(Math.cos(t.an(Pe-s))/Math.cos(t.an(Pe)))-1),l=Math.acos(a/o),u=2*Ve(c-1,0,t.an(s/2)),d=Math.min(t.an(Pe),l+t.an(s/2)),f=Ve(c-1,Math.min(d,l-t.an(s/2)),d),p=Math.atan(i/a),m=Math.hypot(i,a),h=r;return h+=t.ar(o/m/Math.max(.5,Math.cos(t.an(s/2)))),h+=c*t.ar(Math.cos(p))/2,h-=t.ar(Math.max(1,f/u/n))/2,h}}let Ue=He(9.314,3);function We(e,n){let r=(n.roundZoom?Math.round:Math.floor)(e.zoom+t.ar(e.tileSize/n.tileSize));return Math.max(0,r)}function Ge(e,n){let r=e.getCameraFrustum(),i=e.getClippingPlane(),a=e.screenPointToMercatorCoordinate(e.getCameraPoint()),o=t.a7.fromLngLat(e.center,e.elevation);a.z=o.z+Math.cos(e.pitchInRadians)*e.cameraToCenterDistance/e.worldSize;let s=e.getCoveringTilesDetailsProvider(),c=s.allowVariableZoom(e,n),l=We(e,n),u=n.minzoom||0,d=n.maxzoom===void 0?e.maxZoom:n.maxzoom,f=Math.min(Math.max(0,l),d),p=2**f,m=[p*a.x,p*a.y,0],h=[p*o.x,p*o.y,0],g=Math.hypot(o.x-a.x,o.y-a.y),_=Math.abs(o.z-a.z),v=Math.hypot(g,_),y=e=>({zoom:0,x:0,y:0,wrap:e,fullyVisible:!1}),b=[],x=[];if(e.renderWorldCopies&&s.allowWorldCopies())for(let e=1;e<=3;e++)b.push(y(-e)),b.push(y(e));for(b.push(y(0));b.length>0;){let p=b.pop(),g=p.x,y=p.y,S=p.fullyVisible,C={x:g,y,z:p.zoom},w=s.getTileBoundingVolume(C,p.wrap,e.elevation,n);if(!S){let e=N(r,w,i);if(e===0)continue;S=e===2}let T=s.distanceToTile2d(a.x,a.y,C,w),E=l;c&&(E=(n.calculateTileZoom||Ue)(e.zoom+t.ar(e.tileSize/n.tileSize),T,_,v,e.fov)),E=(n.roundZoom?Math.round:Math.floor)(E),E=Math.max(0,E);let D=Math.min(E,d);if(p.wrap=s.getWrap(o,C,p.wrap),p.zoom>=D){if(p.zoom<u)continue;let e=f-p.zoom,r=m[0]-.5-(g<<e),i=m[1]-.5-(y<<e),a=n.reparseOverscaled?Math.max(p.zoom,E):p.zoom;x.push({tileID:new t.a3(p.zoom===d?a:p.zoom,p.wrap,p.zoom,g,y),distanceSq:t.as([h[0]-.5-g,h[1]-.5-y]),tileDistanceToCamera:Math.sqrt(r*r+i*i)})}else for(let e=0;e<4;e++)b.push({zoom:p.zoom+1,x:(g<<1)+e%2,y:(y<<1)+(e>>1),wrap:p.wrap,fullyVisible:S})}return x.sort(((e,t)=>e.distanceSq-t.distanceSq)).map((e=>e.tileID))}let Ke=t.a8.fromPoints([new t.P(0,0),new t.P(t.a6,t.a6)]);function qe(e){return e===`raster`||e===`image`||e===`video`}function Je(e,t,n,r,i,a,o){if(!t.hasData())return!1;let{tileID:s,fadingRole:c,fadingDirection:l,fadingParentID:u}=t;if(c===Ae.Base&&l===je.Incoming&&u)return n[u.key]=u,!0;let d=Math.max(s.overscaledZ-i,a);for(let i=s.overscaledZ-1;i>=d;i--){let a=s.scaledTo(i),c=e.getLoadedTile(a);if(c)return t.setCrossFadeLogic({fadingRole:Ae.Base,fadingDirection:je.Incoming,fadingParentID:c.tileID,fadeEndTime:r+o}),c.setCrossFadeLogic({fadingRole:Ae.Parent,fadingDirection:je.Departing,fadeEndTime:r+o}),n[a.key]=a,!0}return!1}function Ye(e,t,n,r,i,a){if(!t.hasData())return!1;let o=t.tileID.children(i),s=Xe(e,t,o,n,r,i,a);if(s)return!0;for(let c of o)Xe(e,t,c.children(i),n,r,i,a)&&(s=!0);return s}function Xe(e,t,n,r,i,a,o){if(n[0].overscaledZ>=a)return!1;let s=!1;for(let a of n){let n=e.getLoadedTile(a);if(!n)continue;let{fadingRole:c,fadingDirection:l,fadingParentID:u}=n;c===Ae.Base&&l===je.Departing&&u||(n.setCrossFadeLogic({fadingRole:Ae.Base,fadingDirection:je.Departing,fadingParentID:t.tileID,fadeEndTime:i+o}),t.setCrossFadeLogic({fadingRole:Ae.Parent,fadingDirection:je.Incoming,fadeEndTime:i+o})),r[a.key]=a,s=!0}return s}function Ze(e,t,n,r){let i=e.tileID;return!!e.selfFading||!e.hasData()&&!!t.has(i)&&(e.setSelfFadeLogic(n+r),!0)}function P(e,t){var n;e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0;let r=t.tileID.canonical.x-e.tileID.canonical.x,i=t.tileID.canonical.y-e.tileID.canonical.y,a=2**e.tileID.canonical.z,o=t.tileID.key;r===0&&i===0||Math.abs(i)>1||(Math.abs(r)>1&&(Math.abs(r+a)===1?r+=a:Math.abs(r-a)===1&&(r-=a)),t.dem&&e.dem&&(e.dem.backfillBorder(t.dem,r,i),(n=e.neighboringTiles)!=null&&n[o]&&(e.neighboringTiles[o].backfilled=!0)))}class Qe{constructor(){this._tiles={}}handleWrapJump(e){let t={};for(let n in this._tiles){let r=this._tiles[n];r.tileID=r.tileID.unwrapTo(r.tileID.wrap+e),t[r.tileID.key]=r}this._tiles=t}setFeatureState(e,t){for(let n in this._tiles)this._tiles[n].setFeatureState(e,t)}getAllTiles(){return Object.values(this._tiles)}getAllIds(e=!1){return e?Object.values(this._tiles).map((e=>e.tileID)).sort(t.au).map((e=>e.key)):Object.keys(this._tiles)}getTileById(e){return this._tiles[e]}setTile(e,t){this._tiles[e]=t}deleteTileById(e){delete this._tiles[e]}getLoadedTile(e){let t=this.getTileById(e.key);return t?.hasData()?t:null}isIdRenderable(e,t=!1){return this.getTileById(e)?.isRenderable(t)}getRenderableIds(e=0,n){let r=[];for(let e of this.getAllIds())this.isIdRenderable(e,n)&&r.push(this.getTileById(e));return n?r.sort(((n,r)=>{let i=n.tileID,a=r.tileID,o=new t.P(i.canonical.x,i.canonical.y)._rotate(-e),s=new t.P(a.canonical.x,a.canonical.y)._rotate(-e);return i.overscaledZ-a.overscaledZ||s.y-o.y||s.x-o.x})).map((e=>e.tileID.key)):r.map((e=>e.tileID)).sort(t.au).map((e=>e.key))}}class $e extends t.E{constructor(e,n,r){super(),this.id=e,this.dispatcher=r,this.on(`data`,(e=>{this._dataHandler(e)})),this.on(`dataloading`,(()=>{this._sourceErrored=!1})),this.on(`error`,(()=>{this._sourceErrored=this._source.loaded()})),this._source=((e,t,n,r)=>{let i=new(Te(t.type))(e,t,n,r);if(i.id!==e)throw Error(`Expected Source id to be ${e} instead of ${i.id}`);return i})(e,n,r,this),this._inViewTiles=new Qe,this._outOfViewCache=new t.av(0,(e=>this._unloadTile(e))),this._timers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._rasterFadeDuration=0,this._maxFadingAncestorLevels=5,this._state=new Ne,this._didEmitContent=!1,this._updated=!1}onAdd(e){var t;this.map=e,this._maxTileCacheSize=e?e._maxTileCacheSize:null,this._maxTileCacheZoomLevels=e?e._maxTileCacheZoomLevels:null,(t=this._source)!=null&&t.onAdd&&this._source.onAdd(e)}onRemove(e){var t;for(let e of this._inViewTiles.getAllTiles())e.unloadVectorData();this.clearTiles(),(t=this._source)!=null&&t.onRemove&&this._source.onRemove(e),this._inViewTiles=new Qe}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(let e of this._inViewTiles.getAllTiles())if(e.state!==`loaded`&&e.state!==`errored`)return!1;return!0}getSource(){return this._source}getState(){return this._state}pause(){this._paused=!0}resume(){if(!this._paused)return;let e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(e,n,r){return t._(this,void 0,void 0,(function*(){try{let t=yield this._source.loadTile(e);this._tileLoaded(e,n,r,t)}catch(n){e.state=`errored`,n.status===404?this.update(this.transform,this.terrain):this._source.fire(new t.l(t.d(n),{tile:e}))}}))}_unloadTile(e){this._source.unloadTile&&this._source.unloadTile(e)}_abortTile(e){this._source.abortTile&&this._source.abortTile(e),this._source.fire(new t.n(`dataabort`,{tile:e,coord:e.tileID,dataType:`source`}))}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._inViewTiles,this.map?this.map.painter:null);for(let t of this._inViewTiles.getAllTiles())t.upload(e),t.prepare(this.map.style.imageManager)}getIds(){return this._inViewTiles.getAllIds(!0)}getRenderableIds(e){return this._inViewTiles.getRenderableIds(this.transform?.bearingInRadians,e)}hasRenderableParent(e){let t=e.overscaledZ-1;if(t>=this._source.minzoom){let n=this.getLoadedTile(e.scaledTo(t));if(n)return this._inViewTiles.isIdRenderable(n.tileID.key)}return!1}reload(e,t=void 0){if(this._paused)this._shouldReloadOnResume=!0;else{this._outOfViewCache.reset();for(let n of this._inViewTiles.getAllIds()){let r=this._inViewTiles.getTileById(n);t&&!this._source.shouldReloadTile(r,t)||(e?this._reloadTile(n,`expired`):r.state!==`errored`&&this._reloadTile(n,`reloading`))}}}_reloadTile(e,n){return t._(this,void 0,void 0,(function*(){let t=this._inViewTiles.getTileById(e);t&&(t.state!==`loading`&&(t.state=n),yield this._loadTile(t,e,n))}))}_tileLoaded(e,n,r,i){e.timeAdded=l(),e.selfFading&&(e.fadeEndTime=e.timeAdded+this._rasterFadeDuration),r===`expired`&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(n,e),i!=null&&i.unmodified||(this.getSource().type===`raster-dem`&&e.dem&&function(e,t){var n;let r=t.getRenderableIds();for(let i of r){if(!e.neighboringTiles?.[i])continue;let r=t.getTileById(i);e.neighboringTiles[i].backfilled||P(e,r),(n=r.neighboringTiles?.[e.tileID.key])!=null&&n.backfilled||P(r,e)}}(e,this._inViewTiles),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new t.n(`data`,{dataType:`source`,tile:e,coord:e.tileID})))}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._inViewTiles.getTileById(e)}_retainLoadedChildren(e,t){let n=this._getLoadedDescendents(t),r=new Set;for(let i of t){let t=n[i.key];if(!t?.length){r.add(i);continue}let a=i.overscaledZ+$e.maxOverzooming,o=t.filter((e=>e.tileID.overscaledZ<=a));if(!o.length){r.add(i);continue}let s=Math.min(...o.map((e=>e.tileID.overscaledZ))),c=o.filter((e=>e.tileID.overscaledZ===s)).map((e=>e.tileID));for(let t of c)e[t.key]=t;this._areDescendentsComplete(c,s,i.overscaledZ)||r.add(i)}return r}_getLoadedDescendents(e){var t;let n={};for(let r of this._inViewTiles.getAllTiles().filter((e=>e.hasData())))for(let i of e)r.tileID.isChildOf(i)&&(n[t=i.key]||(n[t]=[]),n[i.key].push(r));return n}_areDescendentsComplete(e,t,n){return e.length===1&&e[0].isOverscaled()?e[0].overscaledZ===t:4**(t-n)===e.length}getLoadedTile(e){return this._inViewTiles.getLoadedTile(e)}updateCacheSize(e){let n=Math.ceil(e.width/this._source.tileSize)+1,r=Math.ceil(e.height/this._source.tileSize)+1,i=Math.floor(n*r*(this._maxTileCacheZoomLevels===null?t.c.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),a=typeof this._maxTileCacheSize==`number`?Math.min(this._maxTileCacheSize,i):i;this._outOfViewCache.setMaxSize(a)}handleWrapJump(e){let t=Math.round((e-(this._prevLng===void 0?e:this._prevLng))/360);this._prevLng=e,t&&(this._inViewTiles.handleWrapJump(t),this._resetTileReloadTimers())}update(e,n){if(!this._sourceLoaded||this._paused)return;let r;this.transform=e,this.terrain=n,this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this.used||this.usedForTerrain?this._source.tileID?r=e.getVisibleUnwrappedCoordinates(this._source.tileID).map((e=>new t.a3(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y))):(r=Ge(e,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.type===`vector`&&this.map._zoomLevelsToOverscale!==void 0?e.maxZoom-this.map._zoomLevelsToOverscale:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:n,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(r=r.filter((e=>this._source.hasTile(e))))):r=[],this.usedForTerrain&&(r=this._addTerrainIdealTiles(r));let i=r.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,i&&this.fire(new t.n(`data`,{sourceDataType:`idle`,dataType:`source`,sourceId:this.id}));let a=We(e,this._source),o=this._updateRetainedTiles(r,a),s=qe(this._source.type);s&&this._rasterFadeDuration>0&&!n&&function(e,n,r,i,a,o,s){let c=l(),u=t.at(n);for(let t of n){let n=e.getTileById(t.key);n.fadingDirection!==je.Departing&&n.fadeOpacity!==0||n.resetFadeLogic(),Je(e,n,r,c,i,a,s)||Ye(e,n,r,c,o,s)||Ze(n,u,c,s)||n.resetFadeLogic()}}(this._inViewTiles,r,o,this._maxFadingAncestorLevels,this._source.minzoom,this._source.maxzoom,this._rasterFadeDuration),s?this._cleanUpRasterTiles(o):this._cleanUpVectorTiles(o)}_cleanUpRasterTiles(e){for(let t of this._inViewTiles.getAllIds())e[t]||this._removeTile(t)}_cleanUpVectorTiles(e){for(let t of this._inViewTiles.getAllIds()){let n=this._inViewTiles.getTileById(t);e[t]?n.clearSymbolFadeHold():n.hasSymbolBuckets?n.holdingForSymbolFade()?n.symbolFadeFinished()&&this._removeTile(t):n.setSymbolHoldDuration(this.map._fadeDuration):this._removeTile(t)}}_addTerrainIdealTiles(e){let t=[];for(let n of e)if(n.canonical.z>this._source.minzoom){let e=n.scaledTo(n.canonical.z-1);t.push(e);let r=n.scaledTo(Math.max(this._source.minzoom,Math.min(n.canonical.z,5)));t.push(r)}return e.concat(t)}releaseSymbolFadeTiles(){for(let e of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(e).holdingForSymbolFade()&&this._removeTile(e)}_updateRetainedTiles(e,t){let n=new Set;for(let t of e)this._addTile(t).hasData()||n.add(t);let r=e.reduce(((e,t)=>(e[t.key]=t,e)),{}),i=this._retainLoadedChildren(r,n),a={},o=Math.max(t-$e.maxUnderzooming,this._source.minzoom);for(let e of i){let t=this._inViewTiles.getTileById(e.key),n=t?.wasRequested();for(let i=e.overscaledZ-1;i>=o;--i){let o=e.scaledTo(i);if(a[o.key])break;if(a[o.key]=!0,t=this.getTile(o),!t&&n&&(t=this._addTile(o)),t){let e=t.hasData();if((e||!this.map?.cancelPendingTileRequestsWhileZooming||n)&&(r[o.key]=o),n=t.wasRequested(),e)break}}}return r}_addTile(e){let n=this._inViewTiles.getTileById(e.key);if(n)return n;n=this._outOfViewCache.getAndRemove(e),n&&(n.resetFadeLogic(),this._setTileReloadTimer(e.key,n),n.tileID=e,this._state.initializeTileState(n,this.map?this.map.painter:null));let r=n;return n||(n=new Me(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(n,e.key,n.state)),n.uses++,this._inViewTiles.setTile(e.key,n),r||this._source.fire(new t.n(`dataloading`,{tile:n,coord:n.tileID,dataType:`source`})),n}_setTileReloadTimer(e,t){this._clearTileReloadTimer(e);let n=t.getExpiryTimeout();n&&(this._timers[e]=setTimeout((()=>{this._reloadTile(e,`expired`),delete this._timers[e]}),n))}_clearTileReloadTimer(e){let t=this._timers[e];t&&(clearTimeout(t),delete this._timers[e])}_resetTileReloadTimers(){for(let e in this._timers)clearTimeout(this._timers[e]),delete this._timers[e];for(let e of this._inViewTiles.getAllIds()){let t=this._inViewTiles.getTileById(e);this._setTileReloadTimer(e,t)}}refreshTiles(e){for(let t of this._inViewTiles.getAllIds()){let n=this._inViewTiles.getTileById(t);(this._inViewTiles.isIdRenderable(t)||n.state==`errored`)&&e.some((e=>e.equals(n.tileID.canonical)))&&this._reloadTile(t,`expired`)}}_removeTile(e){let t=this._inViewTiles.getTileById(e);t&&(t.uses--,this._inViewTiles.deleteTileById(e),this._clearTileReloadTimer(e),t.uses>0||(t.hasData()&&t.state!==`reloading`?this._outOfViewCache.add(t.tileID,t,t.getExpiryTimeout()):(t.aborted=!0,this._abortTile(t),this._unloadTile(t))))}_dataHandler(e){e.dataType===`source`&&(e.sourceDataType===`metadata`?this._sourceLoaded=!0:e.sourceDataType===`content`&&this._sourceLoaded&&!this._paused&&(this.reload(e.sourceDataChanged,e.shouldReloadTileOptions),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(let e of this._inViewTiles.getAllIds())this._removeTile(e);this._outOfViewCache.reset()}tilesIn(e,n,r){let i=[],a=this.transform;if(!a)return i;let o=a.getCoveringTilesDetailsProvider().allowWorldCopies(),s=r?a.getCameraQueryGeometry(e):e,c=e=>a.screenPointToMercatorCoordinate(e,this.terrain),l=this.transformBbox(e,c,!o),u=this.transformBbox(s,c,!o),d=this.getIds(),f=t.a8.fromPoints(u);for(let e of d){let r=this._inViewTiles.getTileById(e);if(r.holdingForSymbolFade())continue;let s=o?[r.tileID]:[r.tileID.unwrapTo(-1),r.tileID.unwrapTo(0)],c=2**(a.zoom-r.tileID.overscaledZ),d=n*r.queryPadding*t.a6/r.tileSize/c;for(let e of s){let n=f.map((n=>e.getTilePoint(new t.a7(n.x,n.y))));if(n.expandBy(d),n.intersects(Ke)){let t=l.map((t=>e.getTilePoint(t))),n=u.map((t=>e.getTilePoint(t)));i.push({tile:r,tileID:o?e:e.unwrapTo(0),queryGeometry:t,cameraQueryGeometry:n,scale:c})}}}return i}transformBbox(e,n,r){let i=e.map(n);if(r){let r=t.a8.fromPoints(e);r.shrinkBy(.001*Math.min(r.width(),r.height()));let a=r.map(n);t.a8.fromPoints(i).covers(a)||(i=i.map((e=>e.x>.5?new t.a7(e.x-1,e.y,e.z):e)))}return i}getVisibleCoordinates(e){let t=this.getRenderableIds(e).map((e=>this._inViewTiles.getTileById(e).tileID));return this.transform&&this.transform.populateCache(t),t}hasTransition(){return!!this._source.hasTransition()||qe(this._source.type)&&function(e,t){if(t<=0)return!1;let n=l();for(let t of e.getAllTiles())if(t.fadeEndTime>=n)return!0;return!1}(this._inViewTiles,this._rasterFadeDuration)}setRasterFadeDuration(e){this._rasterFadeDuration=e}setFeatureState(e,n,r){e||=t.ag,this._state.updateState(e,n,r)}removeFeatureState(e,n,r){e||=t.ag,this._state.removeFeatureState(e,n,r)}getFeatureState(e,n){return e||=t.ag,this._state.getState(e,n)}setDependencies(e,t,n){let r=this._inViewTiles.getTileById(e);r&&r.setDependencies(t,n)}reloadTilesForDependencies(e,t){for(let n of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(n).hasDependency(e,t)&&this._reloadTile(n,`reloading`);this._outOfViewCache.filter((n=>!n.hasDependency(e,t)))}areTilesLoaded(){for(let e of this._inViewTiles.getAllTiles())if(e.state!==`loaded`&&e.state!==`errored`)return!1;return!0}}$e.maxUnderzooming=10,$e.maxOverzooming=3;class et{constructor(e,t){this.reset(e,t)}reset(e,t){this.points=e||[],this._distances=[0];for(let e=1;e<this.points.length;e++)this._distances[e]=this._distances[e-1]+this.points[e].dist(this.points[e-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(t||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(e){if(this.points.length===1)return this.points[0];e=t.al(e,0,1);let n=1,r=this._distances[n],i=e*this.paddedLength+this.padding;for(;r<i&&n<this._distances.length;)r=this._distances[++n];let a=n-1,o=this._distances[a],s=r-o,c=s>0?(i-o)/s:0;return this.points[a].mult(1-c).add(this.points[n].mult(c))}}function tt(e,t){let n=!0;return e===`always`||e!==`never`&&t!==`never`||(n=!1),n}class F{constructor(e,t,n){let r=this.boxCells=[],i=this.circleCells=[];this.xCellCount=Math.ceil(e/n),this.yCellCount=Math.ceil(t/n);for(let e=0;e<this.xCellCount*this.yCellCount;e++)r.push([]),i.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=t,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/t,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,t,n,r,i){this._forEachCell(t,n,r,i,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(t),this.bboxes.push(n),this.bboxes.push(r),this.bboxes.push(i)}insertCircle(e,t,n,r){this._forEachCell(t-r,n-r,t+r,n+r,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(t),this.circles.push(n),this.circles.push(r)}_insertBoxCell(e,t,n,r,i,a){this.boxCells[i].push(a)}_insertCircleCell(e,t,n,r,i,a){this.circleCells[i].push(a)}_query(e,t,n,r,i,a,o){if(n<0||e>this.width||r<0||t>this.height)return[];let s=[];if(e<=0&&t<=0&&this.width<=n&&this.height<=r){if(i)return[{key:null,x1:e,y1:t,x2:n,y2:r}];for(let e=0;e<this.boxKeys.length;e++)s.push({key:this.boxKeys[e],x1:this.bboxes[4*e],y1:this.bboxes[4*e+1],x2:this.bboxes[4*e+2],y2:this.bboxes[4*e+3]});for(let e=0;e<this.circleKeys.length;e++){let t=this.circles[3*e],n=this.circles[3*e+1],r=this.circles[3*e+2];s.push({key:this.circleKeys[e],x1:t-r,y1:n-r,x2:t+r,y2:n+r})}}else this._forEachCell(e,t,n,r,this._queryCell,s,{hitTest:i,overlapMode:a,seenUids:{box:{},circle:{}}},o);return s}query(e,t,n,r){return this._query(e,t,n,r,!1,null)}hitTest(e,t,n,r,i,a){return this._query(e,t,n,r,!0,i,a).length>0}hitTestCircle(e,t,n,r,i){let a=e-n,o=e+n,s=t-n,c=t+n;if(o<0||a>this.width||c<0||s>this.height)return!1;let l=[];return this._forEachCell(a,s,o,c,this._queryCellCircle,l,{hitTest:!0,overlapMode:r,circle:{x:e,y:t,radius:n},seenUids:{box:{},circle:{}}},i),l.length>0}_queryCell(e,t,n,r,i,a,o,s){let{seenUids:c,hitTest:l,overlapMode:u}=o,d=this.boxCells[i],f=1e-6;if(d!==null){let i=this.bboxes;for(let o of d)if(!c.box[o]){c.box[o]=!0;let d=4*o,p=this.boxKeys[o];if(e<=i[d+2]+f&&t<=i[d+3]+f&&n>=i[d+0]-f&&r>=i[d+1]-f&&(!s||s(p))&&(!l||!tt(u,p.overlapMode))&&(a.push({key:p,x1:i[d],y1:i[d+1],x2:i[d+2],y2:i[d+3]}),l))return!0}}let p=this.circleCells[i];if(p!==null){let i=this.circles;for(let o of p)if(!c.circle[o]){c.circle[o]=!0;let d=3*o,f=this.circleKeys[o];if(this._circleAndRectCollide(i[d],i[d+1],i[d+2],e,t,n,r)&&(!s||s(f))&&(!l||!tt(u,f.overlapMode))){let e=i[d],t=i[d+1],n=i[d+2];if(a.push({key:f,x1:e-n,y1:t-n,x2:e+n,y2:t+n}),l)return!0}}}return!1}_queryCellCircle(e,t,n,r,i,a,o,s){let{circle:c,seenUids:l,overlapMode:u}=o,d=this.boxCells[i];if(d!==null){let e=this.bboxes;for(let t of d)if(!l.box[t]){l.box[t]=!0;let n=4*t,r=this.boxKeys[t];if(this._circleAndRectCollide(c.x,c.y,c.radius,e[n+0],e[n+1],e[n+2],e[n+3])&&(!s||s(r))&&!tt(u,r.overlapMode))return a.push(!0),!0}}let f=this.circleCells[i];if(f!==null){let e=this.circles;for(let t of f)if(!l.circle[t]){l.circle[t]=!0;let n=3*t,r=this.circleKeys[t];if(this._circlesCollide(e[n],e[n+1],e[n+2],c.x,c.y,c.radius)&&(!s||s(r))&&!tt(u,r.overlapMode))return a.push(!0),!0}}}_forEachCell(e,t,n,r,i,a,o,s){let c=this._convertToXCellCoord(e),l=this._convertToYCellCoord(t),u=this._convertToXCellCoord(n),d=this._convertToYCellCoord(r);for(let f=c;f<=u;f++)for(let c=l;c<=d;c++)if(i.call(this,e,t,n,r,this.xCellCount*c+f,a,o,s))return}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,t,n,r,i,a){let o=r-e,s=i-t,c=n+a;return c*c>o*o+s*s}_circleAndRectCollide(e,t,n,r,i,a,o){let s=(a-r)/2,c=Math.abs(e-(r+s));if(c>s+n)return!1;let l=(o-i)/2,u=Math.abs(t-(i+l));if(u>l+n)return!1;if(c<=s||u<=l)return!0;let d=c-s,f=u-l;return d*d+f*f<=n*n}}function nt(e,t){let n=1/(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]),r=1/(t[8]*t[8]+t[9]*t[9]+t[10]*t[10]),i=t[0]*n,a=t[4]*n,o=t[8]*r,s=t[1]*n,c=t[5]*n,l=t[9]*r,u=t[2]*n,d=t[6]*n,f=t[10]*r;e[0]=i,e[1]=a,e[2]=o,e[4]=s,e[5]=c,e[6]=l,e[8]=u,e[9]=d,e[10]=f;let p=t[12],m=t[13],h=t[14];return e[12]=-i*p-s*m-u*h,e[13]=-a*p-c*m-d*h,e[14]=-o*p-l*m-f*h,e[3]=0,e[7]=0,e[11]=0,e[15]=1,e}let rt=t.O();function it(e,n,i){let a=t.O();if(!e){let{vecSouth:e,vecEast:t}=ot(n),i=r();i[0]=t[0],i[1]=t[1],i[2]=e[0],i[3]=e[1],o=i,(f=(c=(s=i)[0])*(d=s[3])-(u=s[2])*(l=s[1]))&&(o[0]=d*(f=1/f),o[1]=-l*f,o[2]=-u*f,o[3]=c*f),a[0]=i[0],a[1]=i[1],a[4]=i[2],a[5]=i[3]}var o,s,c,l,u,d,f;return t.S(a,a,[1/i,1/i,1]),a}function at(e,n,r,i){if(e){let e=t.O();if(!n){let{vecSouth:t,vecEast:n}=ot(r);e[0]=n[0],e[1]=n[1],e[4]=t[0],e[5]=t[1]}return t.S(e,e,[i,i,1]),e}return r.pixelsToClipSpaceMatrix}function ot(e){let n=Math.cos(e.rollInRadians),r=Math.sin(e.rollInRadians),i=Math.cos(e.pitchInRadians),a=Math.cos(e.bearingInRadians),o=Math.sin(e.bearingInRadians),s=t.az();s[0]=-a*i*r-o*n,s[1]=-o*i*r+a*n;let c=t.aA(s);c<1e-9?t.aB(s):t.aC(s,s,1/c);let l=t.az();l[0]=a*i*n-o*r,l[1]=o*i*n+a*r;let u=t.aA(l);return u<1e-9?t.aB(l):t.aC(l,l,1/u),{vecEast:l,vecSouth:s}}function st(e,n,r,i){let a;i?(a=[e,n,i(e,n),1],t.aE(a,a,r)):(a=[e,n,0,1],wt(a,a,r));let o=a[3];return{point:new t.P(a[0]/o,a[1]/o),signedDistanceFromCamera:o,isOccluded:!1}}function ct(e,t){return .5+e/t*.5}function lt(e,t){return e.x>=-t[0]&&e.x<=t[0]&&e.y>=-t[1]&&e.y<=t[1]}function ut(e,n,r,i,a,o,s,c,l,u,d,f,p){let m=r?e.textSizeData:e.iconSizeData,h=t.aw(m,n.transform.zoom),g=[256/n.width*2+1,256/n.height*2+1],_=r?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;_.clear();let v=e.lineVertexArray,y=r?e.text.placedSymbolArray:e.icon.placedSymbolArray,b=n.transform.width/n.transform.height,x=!1;for(let r=0;r<y.length;r++){let S=y.get(r);if(S.hidden||S.writingMode===t.ax.vertical&&!x){Ct(S.numGlyphs,_);continue}x=!1;let C=new t.P(S.anchorX,S.anchorY),w={getElevation:p,pitchedLabelPlaneMatrix:i,lineVertexArray:v,pitchWithMap:o,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:n.transform,tileAnchorPoint:C,unwrappedTileID:l,width:u,height:d,translation:f},T=vt(S.anchorX,S.anchorY,w);if(!lt(T.point,g)){Ct(S.numGlyphs,_);continue}let E=ct(n.transform.cameraToCenterDistance,T.signedDistanceFromCamera),D=t.ay(m,h,S),O=o?D*n.transform.getPitchedTextCorrection(S.anchorX,S.anchorY,l)/E:D*E,k=pt({projectionContext:w,pitchedLabelPlaneMatrixInverse:a,symbol:S,fontSize:O,flip:!1,keepUpright:s,glyphOffsetArray:e.glyphOffsetArray,dynamicLayoutVertexArray:_,aspectRatio:b,rotateToLine:c});x=k.useVertical,(k.notEnoughRoom||x||k.needsFlipping&&pt({projectionContext:w,pitchedLabelPlaneMatrixInverse:a,symbol:S,fontSize:O,flip:!0,keepUpright:s,glyphOffsetArray:e.glyphOffsetArray,dynamicLayoutVertexArray:_,aspectRatio:b,rotateToLine:c}).notEnoughRoom)&&Ct(S.numGlyphs,_)}r?e.text.dynamicLayoutVertexBuffer.updateData(_):e.icon.dynamicLayoutVertexBuffer.updateData(_)}function dt(e,t,n,r,i,a,o,s){let c=a.glyphStartIndex+a.numGlyphs,l=a.lineStartIndex,u=a.lineStartIndex+a.lineLength,d=t.getoffsetX(a.glyphStartIndex),f=t.getoffsetX(c-1),p=xt(e*d,n,r,i,a.segment,l,u,s,o);if(!p)return null;let m=xt(e*f,n,r,i,a.segment,l,u,s,o);return m?s.projectionCache.anyProjectionOccluded?null:{first:p,last:m}:null}function ft(e,n,r,i){return e===t.ax.horizontal&&Math.abs(r.y-n.y)>Math.abs(r.x-n.x)*i?{useVertical:!0}:(e===t.ax.vertical?n.y<r.y:n.x>r.x)?{needsFlipping:!0}:null}function pt(e){let{projectionContext:n,pitchedLabelPlaneMatrixInverse:r,symbol:i,fontSize:a,flip:o,keepUpright:s,glyphOffsetArray:c,dynamicLayoutVertexArray:l,aspectRatio:u,rotateToLine:d}=e,f=a/24,p=i.lineOffsetX*f,m=i.lineOffsetY*f,h;if(i.numGlyphs>1){let e=i.glyphStartIndex+i.numGlyphs,t=i.lineStartIndex,a=i.lineStartIndex+i.lineLength,l=dt(f,c,p,m,o,i,d,n);if(!l)return{notEnoughRoom:!0};let g=_t(l.first.point.x,l.first.point.y,n,r),_=_t(l.last.point.x,l.last.point.y,n,r);if(s&&!o){let e=ft(i.writingMode,g,_,u);if(e)return e}h=[l.first];for(let r=i.glyphStartIndex+1;r<e-1;r++){let e=xt(f*c.getoffsetX(r),p,m,o,i.segment,t,a,n,d);if(!e)return{notEnoughRoom:!0};h.push(e)}h.push(l.last)}else{if(s&&!o){let e=gt(n.tileAnchorPoint.x,n.tileAnchorPoint.y,n).point,a=i.lineStartIndex+i.segment+1,o=new t.P(n.lineVertexArray.getx(a),n.lineVertexArray.gety(a)),s=gt(o.x,o.y,n),c=s.signedDistanceFromCamera>0?s.point:mt(n.tileAnchorPoint,o,e,1,n),l=_t(e.x,e.y,n,r),d=_t(c.x,c.y,n,r),f=ft(i.writingMode,l,d,u);if(f)return f}let e=xt(f*c.getoffsetX(i.glyphStartIndex),p,m,o,i.segment,i.lineStartIndex,i.lineStartIndex+i.lineLength,n,d);if(!e||n.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};h=[e]}for(let e of h)t.aD(l,e.point,e.angle);return{}}function mt(e,t,n,r,i){let a=e.add(e.sub(t)._unit()),o=gt(a.x,a.y,i).point,s=n.sub(o);return n.add(s._mult(r/s.mag()))}function ht(e,n,r){let i=n.projectionCache;if(i.projections[e])return i.projections[e];let a=new t.P(n.lineVertexArray.getx(e),n.lineVertexArray.gety(e)),o=gt(a.x,a.y,n);if(o.signedDistanceFromCamera>0)return i.projections[e]=o.point,i.anyProjectionOccluded||=o.isOccluded,o.point;let s=e-r.direction;return mt(r.distanceFromAnchor===0?n.tileAnchorPoint:new t.P(n.lineVertexArray.getx(s),n.lineVertexArray.gety(s)),a,r.previousVertex,r.absOffsetX-r.distanceFromAnchor+1,n)}function gt(e,t,n){let r=e+n.translation[0],i=t+n.translation[1],a;return n.pitchWithMap?(a=st(r,i,n.pitchedLabelPlaneMatrix,n.getElevation),a.isOccluded=!1):(a=n.transform.projectTileCoordinates(r,i,n.unwrappedTileID,n.getElevation),a.point.x=(.5*a.point.x+.5)*n.width,a.point.y=(.5*-a.point.y+.5)*n.height),a}function _t(e,n,r,i){if(r.pitchWithMap){let a=[e,n,0,1];return t.aE(a,a,i),r.transform.projectTileCoordinates(a[0]/a[3],a[1]/a[3],r.unwrappedTileID,r.getElevation).point}return{x:e/r.width*2-1,y:1-n/r.height*2}}function vt(e,t,n){return n.transform.projectTileCoordinates(e,t,n.unwrappedTileID,n.getElevation)}function yt(e,t,n){return e._unit()._perp()._mult(t*n)}function bt(e,n,r,i,a,o,s,c,l){if(c.projectionCache.offsets[e])return c.projectionCache.offsets[e];let u=r.add(n);if(e+l.direction<i||e+l.direction>=a)return c.projectionCache.offsets[e]=u,u;let d=ht(e+l.direction,c,l),f=yt(d.sub(r),s,l.direction),p=r.add(f),m=d.add(f);return c.projectionCache.offsets[e]=t.aF(o,u,p,m)||u,c.projectionCache.offsets[e]}function xt(e,t,n,r,i,a,o,s,c){let l=r?e-t:e+t,u=l>0?1:-1,d=0;r&&(u*=-1,d=Math.PI),u<0&&(d+=Math.PI);let f,p=u>0?a+i:a+i+1;s.projectionCache.cachedAnchorPoint?f=s.projectionCache.cachedAnchorPoint:(f=gt(s.tileAnchorPoint.x,s.tileAnchorPoint.y,s).point,s.projectionCache.cachedAnchorPoint=f);let m,h,g=f,_=f,v=0,y=0,b=Math.abs(l),x=[],S;for(;v+y<=b;){if(p+=u,p<a||p>=o)return null;v+=y,_=g,h=m;let e={absOffsetX:b,direction:u,distanceFromAnchor:v,previousVertex:_};if(g=ht(p,s,e),n===0)x.push(_),S=g.sub(_);else{let t,r=g.sub(_);t=r.mag()===0?yt(ht(p+u,s,e).sub(g),n,u):yt(r,n,u),h||=_.add(t),m=bt(p,t,g,a,o,h,n,s,e),x.push(h),S=m.sub(h)}y=S.mag()}let C=S._mult((b-v)/y)._add(h||_),w=d+Math.atan2(g.y-_.y,g.x-_.x);return x.push(C),{point:C,angle:c?w:0,path:x}}let St=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Ct(e,t){for(let n=0;n<e;n++){let e=t.length;t.resize(e+4),t.float32.set(St,3*e)}}function wt(e,t,n){let r=t[0],i=t[1];return e[0]=n[0]*r+n[4]*i+n[12],e[1]=n[1]*r+n[5]*i+n[13],e[3]=n[3]*r+n[7]*i+n[15],e}class Tt{constructor(e,t=new F(e.width+200,e.height+200,25),n=new F(e.width+200,e.height+200,25)){this.transform=e,this.grid=t,this.ignoredGrid=n,this.pitchFactor=Math.cos(e.pitch*Math.PI/180)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+100,this.screenBottomBoundary=e.height+100,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,t,n,r,i,a,o,s,c,l,u,d){let f=this.projectAndGetPerspectiveRatio(e.anchorPointX+s[0],e.anchorPointY+s[1],i,l,d),p=n*f.perspectiveRatio,m;if(a||o)m=this._projectCollisionBox(e,p,r,i,a,o,s,f,l,u,d);else{let t=f.x+(u?u.x*p:0),n=f.y+(u?u.y*p:0);m={allPointsOccluded:!1,box:[t+e.x1*p,n+e.y1*p,t+e.x2*p,n+e.y2*p]}}let[h,g,_,v]=m.box,y=a?m.allPointsOccluded:f.isOccluded,b=y;return b||=f.perspectiveRatio<this.perspectiveRatioCutoff,b||=!this.isInsideGrid(h,g,_,v),b||t!==`always`&&this.grid.hitTest(h,g,_,v,t,c)?{box:[h,g,_,v],placeable:!1,offscreen:!1,occluded:y}:{box:[h,g,_,v],placeable:!0,offscreen:this.isOffscreen(h,g,_,v),occluded:y}}placeCollisionCircles(e,n,r,i,a,o,s,c,l,u,d,f,p,m){let h=[],g=new t.P(n.anchorX,n.anchorY),_=this.getPerspectiveRatio(g.x,g.y,o,m),v=(l?a*this.transform.getPitchedTextCorrection(n.anchorX,n.anchorY,o)/_:a*_)/t.aJ,y={getElevation:m,pitchedLabelPlaneMatrix:s,lineVertexArray:r,pitchWithMap:l,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:this.transform,tileAnchorPoint:g,unwrappedTileID:o,width:this.transform.width,height:this.transform.height,translation:p},b=dt(v,i,n.lineOffsetX*v,n.lineOffsetY*v,!1,n,!1,y),x=!1,S=!1,C=!0;if(b){let n=.5*d*_+f,r=new t.P(-100,-100),i=new t.P(this.screenRightBoundary,this.screenBottomBoundary),a=new et,o=b.first,s=b.last,p=[];for(let e=o.path.length-1;e>=1;e--)p.push(o.path[e]);for(let e=1;e<s.path.length;e++)p.push(s.path[e]);let m=2.5*n;if(l){let e=this.projectPathToScreenSpace(p,y);p=e.some((e=>e.signedDistanceFromCamera<=0))?[]:e.map((e=>e.point))}let g=[];if(p.length>0){let e=p[0].clone(),n=p[0].clone();for(let t=1;t<p.length;t++)e.x=Math.min(e.x,p[t].x),e.y=Math.min(e.y,p[t].y),n.x=Math.max(n.x,p[t].x),n.y=Math.max(n.y,p[t].y);g=e.x>=r.x&&n.x<=i.x&&e.y>=r.y&&n.y<=i.y?[p]:n.x<r.x||e.x>i.x||n.y<r.y||e.y>i.y?[]:t.aG([p],r.x,r.y,i.x,i.y)}for(let t of g){a.reset(t,.25*n);let r=0;r=a.length<=.5*n?1:Math.ceil(a.paddedLength/m)+1;for(let t=0;t<r;t++){let i=t/Math.max(r-1,1),o=a.lerp(i),s=o.x+100,l=o.y+100;h.push(s,l,n,0);let d=s-n,f=l-n,p=s+n,m=l+n;if(C&&=this.isOffscreen(d,f,p,m),S||=this.isInsideGrid(d,f,p,m),e!==`always`&&this.grid.hitTestCircle(s,l,n,e,u)&&(x=!0,!c))return{circles:[],offscreen:!1,collisionDetected:x}}}}return{circles:!c&&x||!S||_<this.perspectiveRatioCutoff?[]:h,offscreen:C,collisionDetected:x}}projectPathToScreenSpace(e,t){return function(e){let t=0,n=0,r=0,i=0;for(let a=0;a<e.length;a++)e[a].isOccluded?(r=a+1,i=0):(i++,i>n&&(n=i,t=r));return e.slice(t,t+n)}(function(e,t){let n=rt;return function(e,t){let n=1/(t[0]*t[5]-t[1]*t[4]);e[0]=t[5]*n,e[1]=-t[1]*n,e[2]=0,e[3]=0,e[4]=-t[4]*n,e[5]=t[0]*n,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1/t[10],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1/t[15]}(n,t.pitchedLabelPlaneMatrix),e.map((e=>{let r=st(e.x,e.y,n,t.getElevation),i=t.transform.projectTileCoordinates(r.point.x,r.point.y,t.unwrappedTileID,t.getElevation);return i.point.x=(.5*i.point.x+.5)*t.width,i.point.y=(.5*-i.point.y+.5)*t.height,i}))}(e,t))}queryRenderedSymbols(e){if(e.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};let n=[],r=new t.a8;for(let i of e){let e=new t.P(i.x+100,i.y+100);r.extend(e),n.push(e)}let{minX:i,minY:a,maxX:o,maxY:s}=r,c=this.grid.query(i,a,o,s).concat(this.ignoredGrid.query(i,a,o,s)),l={},u={};for(let e of c){let r=e.key;if(l[r.bucketInstanceId]===void 0&&(l[r.bucketInstanceId]={}),l[r.bucketInstanceId][r.featureIndex])continue;let i=[new t.P(e.x1,e.y1),new t.P(e.x2,e.y1),new t.P(e.x2,e.y2),new t.P(e.x1,e.y2)];t.aH(n,i)&&(l[r.bucketInstanceId][r.featureIndex]=!0,u[r.bucketInstanceId]===void 0&&(u[r.bucketInstanceId]=[]),u[r.bucketInstanceId].push(r.featureIndex))}return u}insertCollisionBox(e,t,n,r,i,a){(n?this.ignoredGrid:this.grid).insert({bucketInstanceId:r,featureIndex:i,collisionGroupID:a,overlapMode:t},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,t,n,r,i,a){let o=n?this.ignoredGrid:this.grid,s={bucketInstanceId:r,featureIndex:i,collisionGroupID:a,overlapMode:t};for(let t=0;t<e.length;t+=4)o.insertCircle(s,e[t],e[t+1],e[t+2])}projectAndGetPerspectiveRatio(e,n,r,i,a){if(a){let r;i?(r=[e,n,i(e,n),1],t.aE(r,r,a)):(r=[e,n,0,1],wt(r,r,a));let o=r[3];return{x:(r[0]/o+1)/2*this.transform.width+100,y:(-r[1]/o+1)/2*this.transform.height+100,perspectiveRatio:.5+this.transform.cameraToCenterDistance/o*.5,isOccluded:!1,signedDistanceFromCamera:o}}{let t=this.transform.projectTileCoordinates(e,n,r,i);return{x:(t.point.x+1)/2*this.transform.width+100,y:(1-t.point.y)/2*this.transform.height+100,perspectiveRatio:.5+this.transform.cameraToCenterDistance/t.signedDistanceFromCamera*.5,isOccluded:t.isOccluded,signedDistanceFromCamera:t.signedDistanceFromCamera}}}getPerspectiveRatio(e,t,n,r){let i=this.transform.projectTileCoordinates(e,t,n,r);return .5+this.transform.cameraToCenterDistance/i.signedDistanceFromCamera*.5}isOffscreen(e,t,n,r){return n<100||e>=this.screenRightBoundary||r<100||t>this.screenBottomBoundary}isInsideGrid(e,t,n,r){return n>=0&&e<this.gridRightBoundary&&r>=0&&t<this.gridBottomBoundary}getViewportMatrix(){let e=t.ap([]);return t.Q(e,e,[-100,-100,0]),e}_projectCollisionBox(e,n,r,i,a,o,s,c,l,u,d){let f=1,p=0,m=0,h=1,g=e.anchorPointX+s[0],_=e.anchorPointY+s[1];if(o&&!a){let e=this.projectAndGetPerspectiveRatio(g+1,_,i,l,d),t=e.x-c.x,n=Math.atan((e.y-c.y)/t)+(t<0?Math.PI:0),r=Math.sin(n),a=Math.cos(n);f=a,p=r,m=-r,h=a}else if(!o&&a){let e=ot(this.transform);f=e.vecEast[0],p=e.vecEast[1],m=e.vecSouth[0],h=e.vecSouth[1]}let v=c.x,y=c.y,b=n;a&&(v=g,y=_,b=2**-(this.transform.zoom-r.overscaledZ),b*=this.transform.getPitchedTextCorrection(g,_,i),u||(b*=t.al(.5+c.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))),u&&(v+=f*u.x*b+m*u.y*b,y+=p*u.x*b+h*u.y*b);let x=e.x1*b,S=e.x2*b,C=(x+S)/2,w=e.y1*b,T=e.y2*b,E=(w+T)/2,D=[{offsetX:x,offsetY:w},{offsetX:C,offsetY:w},{offsetX:S,offsetY:w},{offsetX:S,offsetY:E},{offsetX:S,offsetY:T},{offsetX:C,offsetY:T},{offsetX:x,offsetY:T},{offsetX:x,offsetY:E}],O=[];for(let{offsetX:e,offsetY:n}of D)O.push(new t.P(v+f*e+m*n,y+p*e+h*n));let k=!1;if(a){let e=O.map((e=>this.projectAndGetPerspectiveRatio(e.x,e.y,i,l,d)));k=e.some((e=>!e.isOccluded)),O=e.map((e=>new t.P(e.x,e.y)))}else k=!0;return{box:t.aI(O),allPointsOccluded:!k}}}class Et{constructor(e,t,n,r){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?t:-t))):r&&n?1:0,this.placed=n}isHidden(){return this.opacity===0&&!this.placed}}class Dt{constructor(e,t,n,r,i){this.text=new Et(e?e.text:null,t,n,i),this.icon=new Et(e?e.icon:null,t,r,i)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Ot{constructor(e,t,n){this.text=e,this.icon=t,this.skipFade=n}}class kt{constructor(e,t,n,r,i){this.bucketInstanceId=e,this.featureIndex=t,this.sourceLayerIndex=n,this.bucketIndex=r,this.tileID=i}}class At{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){let t=++this.maxGroupID;this.collisionGroups[e]={ID:t,predicate:e=>e.collisionGroupID===t}}return this.collisionGroups[e]}}function jt(e,n,r,i,a){let{horizontalAlign:o,verticalAlign:s}=t.aP(e);return new t.P(-(o-.5)*n+i[0]*a,-(s-.5)*r+i[1]*a)}class Mt{constructor(e,t,n,r,i){this.transform=e.clone(),this.terrain=t,this.collisionIndex=new Tt(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=n,this.retainedQueryData={},this.collisionGroups=new At(r),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=i,i&&(i.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){let t=this.terrain;return t?(n,r)=>t.getElevation(e,n,r):null}getBucketParts(e,n,r,i){let a=r.getBucket(n),o=r.latestFeatureIndex;if(!a||!o||n.id!==a.layerIds[0])return;let s=r.collisionBoxArray,c=a.layers[0].layout,l=a.layers[0].paint,u=2**(this.transform.zoom-r.tileID.overscaledZ),d=r.tileSize/t.a6,f=r.tileID.toUnwrapped(),p=c.get(`text-rotation-alignment`)===`map`,m=t.aK(r,1,this.transform.zoom),h=t.aL(this.collisionIndex.transform,r,l.get(`text-translate`),l.get(`text-translate-anchor`)),g=t.aL(this.collisionIndex.transform,r,l.get(`icon-translate`),l.get(`icon-translate-anchor`)),_=it(p,this.transform,m);this.retainedQueryData[a.bucketInstanceId]=new kt(a.bucketInstanceId,o,a.sourceLayerIndex,a.index,r.tileID);let v={bucket:a,layout:c,translationText:h,translationIcon:g,unwrappedTileID:f,pitchedLabelPlaneMatrix:_,scale:u,textPixelRatio:d,holdingForFade:r.holdingForSymbolFade(),collisionBoxArray:s,partiallyEvaluatedTextSize:t.aw(a.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(a.sourceID)};if(i)for(let t of a.sortKeyRanges){let{sortKey:n,symbolInstanceStart:r,symbolInstanceEnd:i}=t;e.push({sortKey:n,symbolInstanceStart:r,symbolInstanceEnd:i,parameters:v})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:a.symbolInstances.length,parameters:v})}attemptAnchorPlacement(e,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b){var x,S;let C=t.aM[e.textAnchor],w=[e.textOffset0,e.textOffset1],T=jt(C,r,i,w,a),E=this.collisionIndex.placeCollisionBox(n,f,c,l,u,s,o,g,d.predicate,y,T,b);if((!v||this.collisionIndex.placeCollisionBox(v,f,c,l,u,s,o,_,d.predicate,y,T,b).placeable)&&E.placeable){let e;if((x=this.prevPlacement)!=null&&x.variableOffsets[p.crossTileID]&&(S=this.prevPlacement?.placements[p.crossTileID])!=null&&S.text&&(e=this.prevPlacement.variableOffsets[p.crossTileID].anchor),p.crossTileID===0)throw Error(`symbolInstance.crossTileID can't be 0`);return this.variableOffsets[p.crossTileID]={textOffset:w,width:r,height:i,anchor:C,textBoxScale:a,prevAnchor:e},this.markUsedJustification(m,C,p,h),m.allowVerticalPlacement&&(this.markUsedOrientation(m,h,p),this.placedOrientations[p.crossTileID]=h),{shift:T,placedGlyphBoxes:E}}}placeLayerBucketPart(e,n,r){let{bucket:i,layout:a,translationText:o,translationIcon:s,unwrappedTileID:c,pitchedLabelPlaneMatrix:l,textPixelRatio:u,holdingForFade:d,collisionBoxArray:f,partiallyEvaluatedTextSize:p,collisionGroup:m}=e.parameters,h=a.get(`text-optional`),g=a.get(`icon-optional`),_=t.aN(a,`text-overlap`,`text-allow-overlap`),v=_===`always`,y=t.aN(a,`icon-overlap`,`icon-allow-overlap`),b=y===`always`,x=a.get(`text-rotation-alignment`)===`map`,S=a.get(`text-pitch-alignment`)===`map`,C=a.get(`icon-text-fit`)!==`none`,w=a.get(`symbol-z-order`)===`viewport-y`,T=v&&(b||!i.hasIconData()||g),E=b&&(v||!i.hasTextData()||h);!i.collisionArrays&&f&&i.deserializeCollisionBoxes(f);let D=this.retainedQueryData[i.bucketInstanceId].tileID,O=this._getTerrainElevationFunc(D),k=this.transform.getFastPathSimpleProjectionMatrix(D),A=(e,f,b)=>{if(n[e.crossTileID])return;if(d)return void(this.placements[e.crossTileID]=new Ot(!1,!1,!1));let w=!1,A=!1,ee=!0,te=null,ne={box:null,placeable:!1,offscreen:null,occluded:!1},re={placeable:!1},ie=null,j=null,M=null,ae=0,oe=0,se=0;f.textFeatureIndex?ae=f.textFeatureIndex:e.useRuntimeCollisionCircles&&(ae=e.featureIndex),f.verticalTextFeatureIndex&&(oe=f.verticalTextFeatureIndex);let ce=f.textBox;if(ce){let n=n=>{let r=t.ax.horizontal;if(i.allowVerticalPlacement&&!n&&this.prevPlacement){let t=this.prevPlacement.placedOrientations[e.crossTileID];t&&(this.placedOrientations[e.crossTileID]=t,r=t,this.markUsedOrientation(i,r,e))}return r},a=(n,r)=>{if(i.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&f.verticalTextBox){for(let e of i.writingModes)if(e===t.ax.vertical?(ne=r(),re=ne):ne=n(),ne?.placeable)break}else ne=n()},l=e.textAnchorOffsetStartIndex,d=e.textAnchorOffsetEndIndex;if(d===l){let r=(t,n)=>{let r=this.collisionIndex.placeCollisionBox(t,_,u,D,c,S,x,o,m.predicate,O,void 0,k);return r!=null&&r.placeable&&(this.markUsedOrientation(i,n,e),this.placedOrientations[e.crossTileID]=n),r};a((()=>r(ce,t.ax.horizontal)),(()=>{let n=f.verticalTextBox;return i.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&n?r(n,t.ax.vertical):{box:null,offscreen:null}})),n(ne?.placeable)}else{let p=t.aM[this.prevPlacement?.variableOffsets[e.crossTileID]?.anchor],h=(t,n,a)=>{let f=t.x2-t.x1,h=t.y2-t.y1,g=e.textBoxScale,v=C&&y===`never`?n:null,b=null,T=_===`never`?1:2,E=`never`;p&&T++;for(let n=0;n<T;n++){for(let n=l;n<d;n++){let r=i.textAnchorOffsets.get(n);if(p&&r.textAnchor!==p)continue;let l=this.attemptAnchorPlacement(r,t,f,h,g,x,S,u,D,c,m,E,e,i,a,o,s,v,O);if(l&&(b=l.placedGlyphBoxes,b?.placeable))return w=!0,te=l.shift,b}p?p=null:E=_}return r&&!b&&(b={box:this.collisionIndex.placeCollisionBox(ce,`always`,u,D,c,S,x,o,m.predicate,O,void 0,k).box,offscreen:!1,placeable:!1,occluded:!1}),b};a((()=>h(ce,f.iconBox,t.ax.horizontal)),(()=>{let n=f.verticalTextBox;return i.allowVerticalPlacement&&!ne?.placeable&&e.numVerticalGlyphVertices>0&&n?h(n,f.verticalIconBox,t.ax.vertical):{box:null,occluded:!0,offscreen:null}})),ne&&(w=ne.placeable,ee=ne.offscreen);let g=n(ne?.placeable);if(!w&&this.prevPlacement){let t=this.prevPlacement.variableOffsets[e.crossTileID];t&&(this.variableOffsets[e.crossTileID]=t,this.markUsedJustification(i,t.anchor,e,g))}}}if(ie=ne,w=ie?.placeable,ee=ie?.offscreen,e.useRuntimeCollisionCircles&&e.centerJustifiedTextSymbolIndex>=0){let n=i.text.placedSymbolArray.get(e.centerJustifiedTextSymbolIndex),s=t.ay(i.textSizeData,p,n),u=a.get(`text-padding`);j=this.collisionIndex.placeCollisionCircles(_,n,i.lineVertexArray,i.glyphOffsetArray,s,c,l,r,S,m.predicate,e.collisionCircleDiameter,u,o,O),j.circles.length&&j.collisionDetected&&!r&&t.w(`Collisions detected, but collision boxes are not shown`),w=v||j.circles.length>0&&!j.collisionDetected,ee&&=j.offscreen}if(f.iconFeatureIndex&&(se=f.iconFeatureIndex),f.iconBox){let e=e=>this.collisionIndex.placeCollisionBox(e,y,u,D,c,S,x,s,m.predicate,O,C&&te?te:void 0,k);re&&re.placeable&&f.verticalIconBox?(M=e(f.verticalIconBox),A=M.placeable):(M=e(f.iconBox),A=M.placeable),ee&&=M.offscreen}let le=h||e.numHorizontalGlyphVertices===0&&e.numVerticalGlyphVertices===0,ue=g||e.numIconVertices===0;le||ue?ue?le||(A&&=w):w=A&&w:A=w=A&&w;let de=A&&M.placeable;if(w&&ie.placeable&&this.collisionIndex.insertCollisionBox(ie.box,_,a.get(`text-ignore-placement`),i.bucketInstanceId,re&&re.placeable&&oe?oe:ae,m.ID),de&&this.collisionIndex.insertCollisionBox(M.box,y,a.get(`icon-ignore-placement`),i.bucketInstanceId,se,m.ID),j&&w&&this.collisionIndex.insertCollisionCircles(j.circles,_,a.get(`text-ignore-placement`),i.bucketInstanceId,ae,m.ID),r&&this.storeCollisionData(i.bucketInstanceId,b,f,ie,M,j),e.crossTileID===0)throw Error(`symbolInstance.crossTileID can't be 0`);if(i.bucketInstanceId===0)throw Error(`bucket.bucketInstanceId can't be 0`);this.placements[e.crossTileID]=new Ot((w||T)&&!ie?.occluded,(A||E)&&!M?.occluded,ee||i.justReloaded),n[e.crossTileID]=!0};if(w){if(e.symbolInstanceStart!==0)throw Error(`bucket.bucketInstanceId should be 0`);let t=i.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let e=t.length-1;e>=0;--e){let n=t[e];A(i.symbolInstances.get(n),i.collisionArrays[n],n)}}else for(let t=e.symbolInstanceStart;t<e.symbolInstanceEnd;t++)A(i.symbolInstances.get(t),i.collisionArrays[t],t);i.justReloaded=!1}storeCollisionData(e,t,n,r,i,a){if(n.textBox||n.iconBox){let a,o;this.collisionBoxArrays.has(e)?a=this.collisionBoxArrays.get(e):(a=new Map,this.collisionBoxArrays.set(e,a)),a.has(t)?o=a.get(t):(o={text:null,icon:null},a.set(t,o)),n.textBox&&(o.text=r.box),n.iconBox&&(o.icon=i.box)}if(a){let t=this.collisionCircleArrays[e];t===void 0&&(t=this.collisionCircleArrays[e]=[]);for(let e=0;e<a.circles.length;e+=4)t.push(a.circles[e+0]-100),t.push(a.circles[e+1]-100),t.push(a.circles[e+2]),t.push(+!!a.collisionDetected)}}markUsedJustification(e,n,r,i){let a;a=i===t.ax.vertical?r.verticalPlacedTextSymbolIndex:{left:r.leftJustifiedTextSymbolIndex,center:r.centerJustifiedTextSymbolIndex,right:r.rightJustifiedTextSymbolIndex}[t.aO(n)];let o=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex,r.verticalPlacedTextSymbolIndex];for(let t of o)t>=0&&(e.text.placedSymbolArray.get(t).crossTileID=a>=0&&t!==a?0:r.crossTileID)}markUsedOrientation(e,n,r){let i=n===t.ax.horizontal||n===t.ax.horizontalOnly?n:0,a=n===t.ax.vertical?n:0,o=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex];for(let t of o)e.text.placedSymbolArray.get(t).placedOrientation=i;r.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(r.verticalPlacedTextSymbolIndex).placedOrientation=a)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;let t=this.prevPlacement,n=!1;this.prevZoomAdjustment=t?t.zoomAdjustment(this.transform.zoom):0;let r=t?t.symbolFadeChange(e):1,i=t?t.opacities:{},a=t?t.variableOffsets:{},o=t?t.placedOrientations:{};for(let e in this.placements){let t=this.placements[e],a=i[e];a?(this.opacities[e]=new Dt(a,r,t.text,t.icon),n||=t.text!==a.text.placed,n||=t.icon!==a.icon.placed):(this.opacities[e]=new Dt(null,r,t.text,t.icon,t.skipFade),n||=t.text||t.icon)}for(let e in i){let t=i[e];if(!this.opacities[e]){let i=new Dt(t,r,!1,!1);i.isHidden()||(this.opacities[e]=i,n||=t.text.placed,n||=t.icon.placed)}}for(let e in a)this.variableOffsets[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.variableOffsets[e]=a[e]);for(let e in o)this.placedOrientations[e]||!this.opacities[e]||this.opacities[e].isHidden()||(this.placedOrientations[e]=o[e]);if(t&&t.lastPlacementChangeTime===void 0)throw Error(`Last placement time for previous placement is not defined`);n?this.lastPlacementChangeTime=e:typeof this.lastPlacementChangeTime!=`number`&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e)}updateLayerOpacities(e,t){let n={};for(let r of t){let t=r.getBucket(e);t&&r.latestFeatureIndex&&e.id===t.layerIds[0]&&this.updateBucketOpacities(t,r.tileID,n,r.collisionBoxArray)}}updateBucketOpacities(e,n,r,i){e.hasTextData()&&(e.text.opacityVertexArray.clear(),e.text.hasVisibleVertices=!1),e.hasIconData()&&(e.icon.opacityVertexArray.clear(),e.icon.hasVisibleVertices=!1),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();let a=e.layers[0],o=a.layout,s=new Dt(null,0,!1,!1,!0),c=o.get(`text-allow-overlap`),l=o.get(`icon-allow-overlap`),u=a._unevaluatedLayout.hasValue(`text-variable-anchor`)||a._unevaluatedLayout.hasValue(`text-variable-anchor-offset`),d=o.get(`text-rotation-alignment`)===`map`,f=o.get(`text-pitch-alignment`)===`map`,p=o.get(`icon-text-fit`)!==`none`,m=new Dt(null,0,c&&(l||!e.hasIconData()||o.get(`icon-optional`)),l&&(c||!e.hasTextData()||o.get(`text-optional`)),!0);!e.collisionArrays&&i&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(i);let h=(e,t,n)=>{for(let r=0;r<t/4;r++)e.opacityVertexArray.emplaceBack(n);e.hasVisibleVertices||=n!==zt},g=this.collisionBoxArrays.get(e.bucketInstanceId);for(let n=0;n<e.symbolInstances.length;n++){let i=e.symbolInstances.get(n),{numHorizontalGlyphVertices:a,numVerticalGlyphVertices:o,crossTileID:c}=i,l=this.opacities[c];r[c]?l=s:l||(l=m,this.opacities[c]=l),r[c]=!0;let _=i.numIconVertices>0,v=this.placedOrientations[i.crossTileID],y=v===t.ax.vertical,b=v===t.ax.horizontal||v===t.ax.horizontalOnly;if(a>0||o>0){let t=Rt(l.text);h(e.text,a,y?zt:t),h(e.text,o,b?zt:t);let n=l.text.isHidden(),r=[i.rightJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.leftJustifiedTextSymbolIndex];for(let t of r)t>=0&&(e.text.placedSymbolArray.get(t).hidden=n||y?1:0);i.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(i.verticalPlacedTextSymbolIndex).hidden=n||b?1:0);let s=this.variableOffsets[i.crossTileID];s&&this.markUsedJustification(e,s.anchor,i,v);let c=this.placedOrientations[i.crossTileID];c&&(this.markUsedJustification(e,`left`,i,c),this.markUsedOrientation(e,c,i))}if(_){let t=Rt(l.icon),n=!(p&&i.verticalPlacedIconSymbolIndex&&y);i.placedIconSymbolIndex>=0&&(h(e.icon,i.numIconVertices,n?t:zt),e.icon.placedSymbolArray.get(i.placedIconSymbolIndex).hidden=l.icon.isHidden()),i.verticalPlacedIconSymbolIndex>=0&&(h(e.icon,i.numVerticalIconVertices,n?zt:t),e.icon.placedSymbolArray.get(i.verticalPlacedIconSymbolIndex).hidden=l.icon.isHidden())}let x=g?.has(n)?g.get(n):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){let r=e.collisionArrays[n];if(r){let n=new t.P(0,0);if(r.textBox||r.verticalTextBox){let t=!0;if(u){let e=this.variableOffsets[c];e?(n=jt(e.anchor,e.width,e.height,e.textOffset,e.textBoxScale),d&&n._rotate(f?-this.transform.bearingInRadians:this.transform.bearingInRadians)):t=!1}if(r.textBox||r.verticalTextBox){let i;r.textBox&&(i=y),r.verticalTextBox&&(i=b),Nt(e.textCollisionBox.collisionVertexArray,l.text.placed,!t||i,x.text,n.x,n.y)}}if(r.iconBox||r.verticalIconBox){let t=!!(!b&&r.verticalIconBox),i;r.iconBox&&(i=t),r.verticalIconBox&&(i=!t),Nt(e.iconCollisionBox.collisionVertexArray,l.icon.placed,i,x.icon,p?n.x:0,p?n.y:0)}}}}if(e.sortFeatures(-this.transform.bearingInRadians),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.text.opacityVertexArray.length!==e.text.layoutVertexArray.length/4)throw Error(`bucket.text.opacityVertexArray.length (= ${e.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${e.text.layoutVertexArray.length}) / 4`);if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw Error(`bucket.icon.opacityVertexArray.length (= ${e.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${e.icon.layoutVertexArray.length}) / 4`);e.bucketInstanceId in this.collisionCircleArrays&&(e.collisionCircleArray=this.collisionCircleArrays[e.bucketInstanceId],delete this.collisionCircleArrays[e.bucketInstanceId])}symbolFadeChange(e){return this.fadeDuration===0?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,t){let n=this.zoomAtLastRecencyCheck===t?1-this.zoomAdjustment(t):1;return this.zoomAtLastRecencyCheck=t,this.commitTime+this.fadeDuration*n>e}setStale(){this.stale=!0}}function Nt(e,t,n,r,i,a){r&&r.length!==0||(r=[0,0,0,0]);let o=r[0]-100,s=r[1]-100,c=r[2]-100,l=r[3]-100;e.emplaceBack(+!!t,+!!n,i||0,a||0,o,s),e.emplaceBack(+!!t,+!!n,i||0,a||0,c,s),e.emplaceBack(+!!t,+!!n,i||0,a||0,c,l),e.emplaceBack(+!!t,+!!n,i||0,a||0,o,l)}let Pt=2**25,Ft=2**24,It=2**17,Lt=2**16;function Rt(e){if(e.opacity===0&&!e.placed)return 0;if(e.opacity===1&&e.placed)return 4294967295;let t=+!!e.placed,n=Math.floor(127*e.opacity);return n*Pt+t*Ft+n*It+t*Lt+n*512+t*256+n*2+t}let zt=0;class Bt{constructor(e){this._sortAcrossTiles=e.layout.get(`symbol-z-order`)!==`viewport-y`&&!e.layout.get(`symbol-sort-key`).isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,t,n,r,i){let a=this._bucketParts;for(;this._currentTileIndex<e.length;)if(t.getBucketParts(a,r,e[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,i())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,a.sort(((e,t)=>e.sortKey-t.sortKey)));this._currentPartIndex<a.length;)if(t.placeLayerBucketPart(a[this._currentPartIndex],this._seenCrossTileIDs,n),this._currentPartIndex++,i())return!0;return!1}}class Vt{constructor(e,t,n,r,i,a,o,s){this.placement=new Mt(e,t,a,o,s),this._currentPlacementIndex=n.length-1,this._forceFullPlacement=r,this._showCollisionBoxes=i,this._done=!1}isDone(){return this._done}continuePlacement(e,n,r){let i=l(),a=()=>!this._forceFullPlacement&&l()-i>2;for(;this._currentPlacementIndex>=0;){let i=n[e[this._currentPlacementIndex]],o=this.placement.collisionIndex.transform.zoom;if(t.aQ(i)&&i.layout&&(!i.minzoom||i.minzoom<=o)&&(!i.maxzoom||i.maxzoom>o)){if(this._inProgressLayer||=new Bt(i),this._inProgressLayer.continuePlacement(r[i.source],this.placement,this._showCollisionBoxes,i,a))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}let Ht=512/t.a6/2;class Ut{constructor(e,n,r){this.tileID=e,this.bucketInstanceId=r,this._symbolsByKey={};let i=new Map;for(let e=0;e<n.length;e++){let t=n.get(e),r=t.key,a=i.get(r);a?a.push(t):i.set(r,[t])}for(let[e,n]of i){let r={positions:n.map((e=>({x:Math.floor(e.anchorX*Ht),y:Math.floor(e.anchorY*Ht)}))),crossTileIDs:n.map((e=>e.crossTileID))};if(r.positions.length>128){let e=new t.aR(r.positions.length,16,Uint16Array);for(let{x:t,y:n}of r.positions)e.add(t,n);e.finish(),delete r.positions,r.index=e}this._symbolsByKey[e]=r}}getScaledCoordinates(e,n){let{x:r,y:i,z:a}=this.tileID.canonical,{x:o,y:s,z:c}=n.canonical,l=Ht/2**(c-a),u=(s*t.a6+e.anchorY)*l,d=i*t.a6*Ht;return{x:Math.floor((o*t.a6+e.anchorX)*l-r*t.a6*Ht),y:Math.floor(u-d)}}findMatches(e,t,n){let r=this.tileID.canonical.z<t.canonical.z?1:2**(this.tileID.canonical.z-t.canonical.z);for(let i=0;i<e.length;i++){let a=e.get(i);if(a.crossTileID)continue;let o=this._symbolsByKey[a.key];if(!o)continue;let s=this.getScaledCoordinates(a,t);if(o.index){let e=o.index.range(s.x-r,s.y-r,s.x+r,s.y+r).sort();for(let t of e){let e=o.crossTileIDs[t];if(!n[e]){n[e]=!0,a.crossTileID=e;break}}}else if(o.positions)for(let e=0;e<o.positions.length;e++){let t=o.positions[e],i=o.crossTileIDs[e];if(Math.abs(t.x-s.x)<=r&&Math.abs(t.y-s.y)<=r&&!n[i]){n[i]=!0,a.crossTileID=i;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map((({crossTileIDs:e})=>e))}}class Wt{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Gt{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){let t=Math.round((e-this.lng)/360);if(t!==0)for(let e in this.indexes){let n=this.indexes[e],r={};for(let e in n){let i=n[e];i.tileID=i.tileID.unwrapTo(i.tileID.wrap+t),r[i.tileID.key]=i}this.indexes[e]=r}this.lng=e}addBucket(e,t,n){var r,i;if(this.indexes[e.overscaledZ]?.[e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===t.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let e=0;e<t.symbolInstances.length;e++)t.symbolInstances.get(e).crossTileID=0;(r=this.usedCrossTileIDs)[i=e.overscaledZ]||(r[i]={});let a=this.usedCrossTileIDs[e.overscaledZ];for(let n in this.indexes){let r=this.indexes[n];if(Number(n)>e.overscaledZ)for(let n in r){let i=r[n];i.tileID.isChildOf(e)&&i.findMatches(t.symbolInstances,e,a)}else{let i=r[e.scaledTo(Number(n)).key];i&&i.findMatches(t.symbolInstances,e,a)}}for(let e=0;e<t.symbolInstances.length;e++){let r=t.symbolInstances.get(e);r.crossTileID||(r.crossTileID=n.generate(),a[r.crossTileID]=!0)}return this.indexes[e.overscaledZ]===void 0&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new Ut(e,t.symbolInstances,t.bucketInstanceId),!0}removeBucketCrossTileIDs(e,t){for(let n of t.getCrossTileIDsLists())for(let t of n)delete this.usedCrossTileIDs[e][t]}removeStaleBuckets(e){let t=!1;for(let n in this.indexes){let r=this.indexes[n];for(let i in r)e[r[i].bucketInstanceId]||(this.removeBucketCrossTileIDs(n,r[i]),delete r[i],t=!0)}return t}}class Kt{constructor(){this.layerIndexes={},this.crossTileIDs=new Wt,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,t,n){let r=this.layerIndexes[e.id];r===void 0&&(r=this.layerIndexes[e.id]=new Gt);let i=!1,a={};r.handleWrapJump(n);for(let n of t){let t=n.getBucket(e);e.id===t?.layerIds[0]&&(t.bucketInstanceId||=(this.maxBucketInstanceId+=1,this.maxBucketInstanceId),r.addBucket(n.tileID,t,this.crossTileIDs)&&(i=!0),a[t.bucketInstanceId]=!0)}return r.removeStaleBuckets(a)&&(i=!0),i}pruneUnusedLayers(e){let t={};for(let n of e)t[n]=!0;for(let e in this.layerIndexes)t[e]||delete this.layerIndexes[e]}}var qt=`void main() {fragColor=vec4(1.0);}`;let Jt={prelude:Yt(`#ifdef GL_ES
10precision mediump float;
11#else
12#if !defined(lowp)
13#define lowp
14#endif
15#if !defined(mediump)
16#define mediump
17#endif
18#if !defined(highp)
19#define highp
20#endif
21#endif
22out highp vec4 fragColor;`,`#ifdef GL_ES
23precision highp float;
24#else
25#if !defined(lowp)
26#define lowp
27#endif
28#if !defined(mediump)
29#define mediump
30#endif
31#if !defined(highp)
32#define highp
33#endif
34#endif
35vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0
36);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);
36return (tile_units_to_pixels*pos+offset)/pattern_size;}mat3 rotationMatrixFromAxisAngle(vec3 u,float angle) {float c=cos(angle);float s=sin(angle);float c2=1.0-c;return mat3(u.x*u.x*c2+      c,u.x*u.y*c2-u.z*s,u.x*u.z*c2+u.y*s,u.y*u.x*c2+u.z*s,u.y*u.y*c2+    c,u.y*u.z*c2-u.x*s,u.z*u.x*c2-u.y*s,u.z*u.y*c2+u.x*s,u.z*u.z*c2+    c
37);}
38#ifdef TERRAIN3D
39uniform 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;
40#endif
41const 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) {
42#ifdef TERRAIN3D
43highp float d=unpack(texture(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));
44#else
45return 1.0;
46#endif
47}float calculate_visibility(vec4 pos) {
48#ifdef TERRAIN3D
49vec3 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;
50#else
51return 1.0;
52#endif
53}float ele(vec2 pos) {
54#ifdef TERRAIN3D
55vec4 rgb=(texture(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;
56#else
57return 0.0;
58#endif
59}float get_elevation(vec2 pos) {
60#ifdef TERRAIN3D
61#ifdef GLOBE
62if ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;}
63#endif
64vec2 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;
65#else
66return 0.0;
67#endif
68}const float PI=3.141592653589793;uniform mat4 u_projection_matrix;`),projectionMercator:Yt(``,`float projectLineThickness(float tileY) {return 1.0;}float projectCircleRadius(float tileY) {return 1.0;}vec4 projectTile(vec2 p) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);return result;}vec4 projectTile(vec2 p,vec2 rawPos) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);if (rawPos.y <-32767.5 || rawPos.y > 32766.5) {result.z=-10000000.0;}return result;}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_projection_matrix*vec4(posInTile,elevation,1.0);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {return projectTileWithElevation(posInTile,elevation);}`),projectionGlobe:Yt(``,`#define GLOBE_RADIUS 6371008.8
69uniform highp vec4 u_projection_tile_mercator_coords;uniform highp vec4 u_projection_clipping_plane;uniform highp float u_projection_transition;uniform mat4 u_projection_fallback_matrix;vec3 globeRotateVector(vec3 vec,vec2 angles) {vec3 axisRight=vec3(vec.z,0.0,-vec.x);vec3 axisUp=cross(axisRight,vec);axisRight=normalize(axisRight);axisUp=normalize(axisUp);vec2 t=tan(angles);return normalize(vec+axisRight*t.x+axisUp*t.y);}mat3 globeGetRotationMatrix(vec3 spherePos) {vec3 axisRight=vec3(spherePos.z,0.0,-spherePos.x);vec3 axisDown=cross(axisRight,spherePos);axisRight=normalize(axisRight);axisDown=normalize(axisDown);return mat3(axisRight,axisDown,spherePos
70);}float circumferenceRatioAtTileY(float tileY) {float mercator_pos_y=u_projection_tile_mercator_coords.y+u_projection_tile_mercator_coords.w*tileY;float spherical_y=2.0*atan(exp(PI-(mercator_pos_y*PI*2.0)))-PI*0.5;return cos(spherical_y);}float projectLineThickness(float tileY) {float thickness=1.0/circumferenceRatioAtTileY(tileY); 
71if (u_projection_transition < 0.999) {return mix(1.0,thickness,u_projection_transition);} else {return thickness;}}vec3 projectToSphere(vec2 translatedPos,vec2 rawPos) {vec2 mercator_pos=u_projection_tile_mercator_coords.xy+u_projection_tile_mercator_coords.zw*translatedPos;vec2 spherical;spherical.x=mercator_pos.x*PI*2.0+PI;spherical.y=2.0*atan(exp(PI-(mercator_pos.y*PI*2.0)))-PI*0.5;float len=cos(spherical.y);vec3 pos=vec3(sin(spherical.x)*len,sin(spherical.y),cos(spherical.x)*len
72);if (rawPos.y <-32767.5) {pos=vec3(0.0,1.0,0.0);}if (rawPos.y > 32766.5) {pos=vec3(0.0,-1.0,0.0);}return pos;}vec3 projectToSphere(vec2 posInTile) {return projectToSphere(posInTile,vec2(0.0,0.0));}float globeComputeClippingZ(vec3 spherePos) {return (1.0-(dot(spherePos,u_projection_clipping_plane.xyz)+u_projection_clipping_plane.w));}vec4 interpolateProjection(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);globePosition.z=globeComputeClippingZ(elevatedPos)*globePosition.w;if (u_projection_transition > 0.999) {return globePosition;}vec4 flatPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);const float z_globeness_threshold=0.2;vec4 result=globePosition;result.z=mix(0.0,globePosition.z,clamp((u_projection_transition-z_globeness_threshold)/(1.0-z_globeness_threshold),0.0,1.0));result.xyw=mix(flatPosition.xyw,globePosition.xyw,u_projection_transition);if ((posInTile.y <-32767.5) || (posInTile.y > 32766.5)) {result=globePosition;const float poles_hidden_anim_percentage=0.02;result.z=mix(globePosition.z,100.0,pow(max((1.0-u_projection_transition)/poles_hidden_anim_percentage,0.0),8.0));}return result;}vec4 interpolateProjectionFor3D(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);if (u_projection_transition > 0.999) {return globePosition;}vec4 fallbackPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);return mix(fallbackPosition,globePosition,u_projection_transition);}vec4 projectTile(vec2 posInTile) {return interpolateProjection(posInTile,projectToSphere(posInTile),0.0);}vec4 projectTile(vec2 posInTile,vec2 rawPos) {return interpolateProjection(posInTile,projectToSphere(posInTile,rawPos),0.0);}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return interpolateProjection(posInTile,projectToSphere(posInTile),elevation);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {vec3 spherePos=projectToSphere(posInTile,posInTile);return interpolateProjectionFor3D(posInTile,spherePos,elevation);}`),background:Yt(`uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity;
73#ifdef OVERDRAW_INSPECTOR
74fragColor=vec4(1.0);
75#endif
76}`,`in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}`),backgroundPattern:Yt(`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;
76uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;in vec2 v_pos_a;in 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=texture(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=texture(u_image,pos2);fragColor=mix(color1,color2,u_mix)*u_opacity;
77#ifdef OVERDRAW_INSPECTOR
78fragColor=vec4(1.0);
79#endif
80}`,`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;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;void main() {gl_Position=projectTile(a_pos);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:Yt(`in vec3 v_data;in float v_visibility;
81#pragma mapbox: define highp vec4 color
82#pragma mapbox: define mediump float radius
83#pragma mapbox: define lowp float blur
84#pragma mapbox: define lowp float opacity
85#pragma mapbox: define highp vec4 stroke_color
86#pragma mapbox: define mediump float stroke_width
87#pragma mapbox: define lowp float stroke_opacity
88void main() {
89#pragma mapbox: initialize highp vec4 color
90#pragma mapbox: initialize mediump float radius
91#pragma mapbox: initialize lowp float blur
92#pragma mapbox: initialize lowp float opacity
93#pragma mapbox: initialize highp vec4 stroke_color
94#pragma mapbox: initialize mediump float stroke_width
95#pragma mapbox: initialize lowp float stroke_opacity
96vec2 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));fragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);const float epsilon=0.5/255.0;if (fragColor.r < epsilon && fragColor.g < epsilon && fragColor.b < epsilon && fragColor.a < epsilon) {discard;}
97#ifdef OVERDRAW_INSPECTOR
98fragColor=vec4(1.0);
99#endif
100}`,`uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform highp float u_globe_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;uniform vec2 u_translate;in vec2 a_pos;out vec3 v_data;out float v_visibility;
101#pragma mapbox: define highp vec4 color
102#pragma mapbox: define mediump float radius
103#pragma mapbox: define lowp float blur
104#pragma mapbox: define lowp float opacity
105#pragma mapbox: define highp vec4 stroke_color
106#pragma mapbox: define mediump float stroke_width
107#pragma mapbox: define lowp float stroke_opacity
108void main(void) {
109#pragma mapbox: initialize highp vec4 color
110#pragma mapbox: initialize mediump float radius
111#pragma mapbox: initialize lowp float blur
112#pragma mapbox: initialize lowp float opacity
113#pragma mapbox: initialize highp vec4 stroke_color
114#pragma mapbox: initialize mediump float stroke_width
115#pragma mapbox: initialize lowp float stroke_opacity
116vec2 pos_raw=a_pos+32768.0;vec2 extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);vec2 circle_center=floor(pos_raw/8.0)+u_translate;float ele=get_elevation(circle_center);v_visibility=calculate_visibility(projectTileWithElevation(circle_center,ele));if (u_pitch_with_map) {
117#ifdef GLOBE
118vec3 center_vector=projectToSphere(circle_center);
119#endif
120float angle_scale=u_globe_extrude_scale;vec2 corner_position=circle_center;if (u_scale_with_map) {angle_scale*=(radius+stroke_width);corner_position+=extrude*u_extrude_scale*(radius+stroke_width);} else {
121#ifdef GLOBE
122vec4 projected_center=interpolateProjection(circle_center,center_vector,ele);
123#else
124vec4 projected_center=projectTileWithElevation(circle_center,ele);
125#endif
126corner_position+=extrude*u_extrude_scale*(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);angle_scale*=(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);}
127#ifdef GLOBE
128vec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele);
129#else
130gl_Position=projectTileWithElevation(corner_position,ele);
131#endif
132} else {gl_Position=projectTileWithElevation(circle_center,ele);if (gl_Position.z/gl_Position.w > 1.0) {gl_Position.xy=vec2(10000.0);}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:Yt(qt,`in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}`),heatmap:Yt(`uniform highp float u_intensity;in vec2 v_extrude;
133#pragma mapbox: define highp float weight
134#define GAUSS_COEF 0.3989422804014327
135void main() {
136#pragma mapbox: initialize highp float weight
137float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);fragColor=vec4(val,1.0,1.0,1.0);
138#ifdef OVERDRAW_INSPECTOR
139fragColor=vec4(1.0);
140#endif
141}`,`uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;uniform highp float u_globe_extrude_scale;in vec2 a_pos;out vec2 v_extrude;
142#pragma mapbox: define highp float weight
143#pragma mapbox: define mediump float radius
144const highp float ZERO=1.0/255.0/16.0;
145#define GAUSS_COEF 0.3989422804014327
146void main(void) {
147#pragma mapbox: initialize highp float weight
148#pragma mapbox: initialize mediump float radius
149vec2 pos_raw=a_pos+32768.0;vec2 unscaled_extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 circle_center=floor(pos_raw/8.0);
150#ifdef GLOBE
151vec2 angles=v_extrude*radius*u_globe_extrude_scale;vec3 center_vector=projectToSphere(circle_center);vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(circle_center+extrude,corner_vector,0.0);
152#else
153gl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center));
154#endif
155}`),heatmapTexture:Yt(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));fragColor=color*u_opacity;
156#ifdef OVERDRAW_INSPECTOR
157fragColor=vec4(0.0);
158#endif
159}`,`uniform mat4 u_matrix;uniform vec2 u_world;in vec2 a_pos;out 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:Yt(`in float v_placed;in float v_notUsed;void main() {float alpha=0.5;fragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {fragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {fragColor*=.1;}}`,`in vec2 a_anchor_pos;in vec2 a_placed;in vec2 a_box_real;uniform vec2 u_pixel_extrude_scale;out float v_placed;out float v_notUsed;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:Yt(`in float v_radius;in vec2 v_extrude;in float v_collision;void main() {float alpha=0.5;float stroke_radius=0.9;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);fragColor=color*alpha*opacity_t;}`,`in vec2 a_pos;in float a_radius;in vec2 a_flags;uniform vec2 u_viewport_size;out float v_radius;out vec2 v_extrude;out float v_collision;void main() {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;float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_collision=collision;gl_Position=vec4((a_pos/u_viewport_size*2.0-1.0)*vec2(1.0,-1.0),0.0,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}`),colorRelief:Yt(`#ifdef GL_ES
160precision highp float;
161#endif
162uniform sampler2D u_image;uniform vec4 u_unpack;uniform sampler2D u_elevation_stops;uniform sampler2D u_color_stops;uniform int u_color_ramp_size;uniform float u_opacity;in vec2 v_pos;float getElevation(vec2 coord) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}float getElevationStop(int stop) {float x=(float(stop)+0.5)/float(u_color_ramp_size);vec4 data=texture(u_elevation_stops,vec2(x,0))*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {float el=getElevation(v_pos);int r=(u_color_ramp_size-1);int l=0;float el_l=getElevationStop(l);float el_r=getElevationStop(r);while(r-l > 1){int m=(r+l)/2;float el_m=getElevationStop(m);if(el < el_m){r=m;el_r=el_m;}else
163{l=m;el_l=el_m;}}float x=(float(l)+(el-el_l)/(el_r-el_l)+0.5)/float(u_color_ramp_size);fragColor=u_opacity*texture(u_color_stops,vec2(x,0));
164#ifdef OVERDRAW_INSPECTOR
165fragColor=vec4(1.0);
166#endif
167}`,`uniform vec2 u_dimension;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_pos/8192.0)*scale+epsilon;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}`),debug:Yt(`uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);fragColor=mix(u_color,overlay_color,overlay_color.a);}`,`in vec2 a_pos;out vec2 v_uv;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=projectTileWithElevation(a_pos*u_overlay_scale,get_elevation(a_pos));}`),depth:Yt(qt,`in vec2 a_pos;void main() {
168#ifdef GLOBE
169gl_Position=projectTileFor3D(a_pos,0.0);
170#else
171gl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0);
172#endif
173}`),fill:Yt(`#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
178fragColor=color*opacity;
179#ifdef OVERDRAW_INSPECTOR
180fragColor=vec4(1.0);
181#endif
182}`,`uniform vec2 u_fill_translate;in vec2 a_pos;
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=projectTile(a_pos+u_fill_translate,a_pos);}`),fillOutline:Yt(`in vec2 v_pos;
189#ifdef GLOBE
190in float v_depth;
191#endif
192#pragma mapbox: define highp vec4 outline_color
193#pragma mapbox: define lowp float opacity
194void main() {
195#pragma mapbox: initialize highp vec4 outline_color
196#pragma mapbox: initialize lowp float opacity
197float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=outline_color*(alpha*opacity);
198#ifdef GLOBE
199if (v_depth > 1.0) {discard;}
200#endif
201#ifdef OVERDRAW_INSPECTOR
202fragColor=vec4(1.0);
203#endif
204}`,`uniform vec2 u_world;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos;
205#ifdef GLOBE
206out float v_depth;
207#endif
208#pragma mapbox: define highp vec4 outline_color
209#pragma mapbox: define lowp float opacity
210void main() {
211#pragma mapbox: initialize highp vec4 outline_color
212#pragma mapbox: initialize lowp float opacity
213gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
214#ifdef GLOBE
215v_depth=gl_Position.z/gl_Position.w;
216#endif
217}`),fillOutlinePattern:Yt(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;in vec2 v_pos_a;in vec2 v_pos_b;in vec2 v_pos;
218#ifdef GLOBE
219in float v_depth;
220#endif
221#pragma mapbox: define lowp float opacity
222#pragma mapbox: define lowp vec4 pattern_from
223#pragma mapbox: define lowp vec4 pattern_to
224void main() {
225#pragma mapbox: initialize lowp float opacity
226#pragma mapbox: initialize mediump vec4 pattern_from
227#pragma mapbox: initialize mediump vec4 pattern_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;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(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=texture(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=mix(color1,color2,u_fade)*alpha*opacity;
229#ifdef GLOBE
230if (v_depth > 1.0) {discard;}
231#endif
232#ifdef OVERDRAW_INSPECTOR
233fragColor=vec4(1.0);
234#endif
235}`,`uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;out vec2 v_pos;
236#ifdef GLOBE
237out float v_depth;
238#endif
239#pragma mapbox: define lowp float opacity
240#pragma mapbox: define lowp vec4 pattern_from
241#pragma mapbox: define lowp vec4 pattern_to
242#pragma mapbox: define lowp float pixel_ratio_from
243#pragma mapbox: define lowp float pixel_ratio_to
244void main() {
245#pragma mapbox: initialize lowp float opacity
246#pragma mapbox: initialize mediump vec4 pattern_from
247#pragma mapbox: initialize mediump vec4 pattern_to
248#pragma mapbox: initialize lowp float pixel_ratio_from
249#pragma mapbox: initialize lowp float pixel_ratio_to
250vec2 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=projectTile(a_pos+u_fill_translate,a_pos);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;
251#ifdef GLOBE
252v_depth=gl_Position.z/gl_Position.w;
253#endif
254}`),fillPattern:Yt(`#ifdef GL_ES
255precision highp float;
256#endif
257uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;
258#pragma mapbox: define lowp float opacity
259#pragma mapbox: define lowp vec4 pattern_from
260#pragma mapbox: define lowp vec4 pattern_to
261void main() {
262#pragma mapbox: initialize lowp float opacity
263#pragma mapbox: initialize mediump vec4 pattern_from
264#pragma mapbox: initialize mediump vec4 pattern_to
265vec2 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=texture(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=texture(u_image,pos2);fragColor=mix(color1,color2,u_fade)*opacity;
266#ifdef OVERDRAW_INSPECTOR
267fragColor=vec4(1.0);
268#endif
269}`,`uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;
270#pragma mapbox: define lowp float opacity
271#pragma mapbox: define lowp vec4 pattern_from
272#pragma mapbox: define lowp vec4 pattern_to
273#pragma mapbox: define lowp float pixel_ratio_from
274#pragma mapbox: define lowp float pixel_ratio_to
275void main() {
276#pragma mapbox: initialize lowp float opacity
277#pragma mapbox: initialize mediump vec4 pattern_from
278#pragma mapbox: initialize mediump vec4 pattern_to
279#pragma mapbox: initialize lowp float pixel_ratio_from
280#pragma mapbox: initialize lowp float pixel_ratio_to
281vec2 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_siz
281e_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=projectTile(a_pos+u_fill_translate,a_pos);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:Yt(`in vec4 v_color;void main() {fragColor=v_color;
282#ifdef OVERDRAW_INSPECTOR
283fragColor=vec4(1.0);
284#endif
285}`,`uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;in vec2 a_pos;in vec4 a_normal_ed;
286#ifdef TERRAIN3D
287in vec2 a_centroid;
288#endif
289out vec4 v_color;
290#pragma mapbox: define highp float base
291#pragma mapbox: define highp float height
292#pragma mapbox: define highp vec4 color
293void main() {
294#pragma mapbox: initialize highp float base
295#pragma mapbox: initialize highp float height
296#pragma mapbox: initialize highp vec4 color
297vec3 normal=a_normal_ed.xyz;
298#ifdef TERRAIN3D
299float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
300#else
301float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
302#endif
303base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;
304#ifdef GLOBE
305vec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);
306#else
307gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);
308#endif
309float 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;vec3 normalForLighting=normal/16384.0;float directional=clamp(dot(normalForLighting,u_lightpos),0.0,1.0);
310#ifdef GLOBE
311mat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition);
312#endif
313directional=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:Yt(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;in vec4 v_lighting;
314#pragma mapbox: define lowp float base
315#pragma mapbox: define lowp float height
316#pragma mapbox: define lowp vec4 pattern_from
317#pragma mapbox: define lowp vec4 pattern_to
318#pragma mapbox: define lowp float pixel_ratio_from
319#pragma mapbox: define lowp float pixel_ratio_to
320void main() {
321#pragma mapbox: initialize lowp float base
322#pragma mapbox: initialize lowp float height
323#pragma mapbox: initialize mediump vec4 pattern_from
324#pragma mapbox: initialize mediump vec4 pattern_to
325#pragma mapbox: initialize lowp float pixel_ratio_from
326#pragma mapbox: initialize lowp float pixel_ratio_to
327vec2 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=texture(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=texture(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);fragColor=mixedColor*v_lighting;
328#ifdef OVERDRAW_INSPECTOR
329fragColor=vec4(1.0);
330#endif
331}`,`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 vec2 u_fill_translate;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;in vec2 a_pos;in vec4 a_normal_ed;
332#ifdef TERRAIN3D
333in vec2 a_centroid;
334#endif
335#ifdef GLOBE
336out vec3 v_sphere_pos;
337#endif
338out vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting;
339#pragma mapbox: define lowp float base
340#pragma mapbox: define lowp float height
341#pragma mapbox: define lowp vec4 pattern_from
342#pragma mapbox: define lowp vec4 pattern_to
343#pragma mapbox: define lowp float pixel_ratio_from
344#pragma mapbox: define lowp float pixel_ratio_to
345void main() {
346#pragma mapbox: initialize lowp float base
347#pragma mapbox: initialize lowp float height
348#pragma mapbox: initialize mediump vec4 pattern_from
349#pragma mapbox: initialize mediump vec4 pattern_to
350#pragma mapbox: initialize lowp float pixel_ratio_from
351#pragma mapbox: initialize lowp float pixel_ratio_to
352vec2 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;
353#ifdef TERRAIN3D
354float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
355#else
356float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
357#endif
358base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;
359#ifdef GLOBE
360vec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);
361#else
362gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);
363#endif
364vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0
365? a_pos
366: vec2(edgedistance,elevation*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:Yt(`#ifdef GL_ES
367precision highp float;
368#endif
369uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {vec2 epsilon=1.0/u_dimension;float tileSize=u_dimension.x-2.0;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))*tileSize/p
369ow(2.0,exaggeration+(28.2562-u_zoom));fragColor=clamp(vec4(deriv.x/8.0+0.5,deriv.y/8.0+0.5,1.0,1.0),0.0,1.0);
370#ifdef OVERDRAW_INSPECTOR
371fragColor=vec4(1.0);
372#endif
373}`,`uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}`),hillshade:Yt(`uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform float u_exaggeration;uniform vec4 u_accent;uniform int u_method;uniform float u_altitudes[NUM_ILLUMINATION_SOURCES];uniform float u_azimuths[NUM_ILLUMINATION_SOURCES];uniform vec4 u_shadows[NUM_ILLUMINATION_SOURCES];uniform vec4 u_highlights[NUM_ILLUMINATION_SOURCES];
374#define PI 3.141592653589793
375#define STANDARD 0
376#define COMBINED 1
377#define IGOR 2
378#define MULTIDIRECTIONAL 3
379#define BASIC 4
380float get_aspect(vec2 deriv){return deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);}void igor_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float aspect=get_aspect(deriv);float azimuth=u_azimuths[0]+PI;float slope_stength=atan(length(deriv))*2.0/PI;float aspect_strength=1.0-abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);float shadow_strength=slope_stength*aspect_strength;float highlight_strength=slope_stength*(1.0-aspect_strength);fragColor=u_shadows[0]*shadow_strength+u_highlights[0]*highlight_strength;}void standard_hillshade(vec2 deriv){float azimuth=u_azimuths[0]+PI;float slope=atan(0.625*length(deriv));float aspect=get_aspect(deriv);float intensity=u_exaggeration;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadows[0],u_highlights[0],shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);fragColor=accent_color*(1.0-shade_color.a)+shade_color;}void basic_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor=u_highlights[0]*(2.0*shade-1.0);}else
381{fragColor=u_shadows[0]*(1.0-2.0*shade);}}void multidirectional_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;fragColor=vec4(0,0,0,0);for(int i=0; i < NUM_ILLUMINATION_SOURCES; i++){float cos_alt=cos(u_altitudes[i]);float sin_alt=sin(u_altitudes[i]);float cos_az=-cos(u_azimuths[i]);float sin_az=-sin(u_azimuths[i]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor+=u_highlights[i]*(2.0*shade-1.0)/float(NUM_ILLUMINATION_SOURCES);}else
382{fragColor+=u_shadows[i]*(1.0-2.0*shade)/float(NUM_ILLUMINATION_SOURCES);}}}void combined_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=acos((sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv)));cang=clamp(cang,0.0,PI/2.0);float shade=cang*atan(length(deriv))*4.0/PI/PI;float highlight=(PI/2.0-cang)*atan(length(deriv))*4.0/PI/PI;fragColor=u_shadows[0]*shade+u_highlights[0]*highlight;}void main() {vec4 pixel=texture(u_image,v_pos);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));vec2 deriv=((pixel.rg*8.0)-4.0)/scaleFactor;if (u_method==BASIC) {basic_hillshade(deriv);} else if (u_method==COMBINED) {combined_hillshade(deriv);} else if (u_method==IGOR) {igor_hillshade(deriv);} else if (u_method==MULTIDIRECTIONAL) {multidirectional_hillshade(deriv);} else if (u_method==STANDARD) {standard_hillshade(deriv);} else {standard_hillshade(deriv);}
383#ifdef OVERDRAW_INSPECTOR
384fragColor=vec4(1.0);
385#endif
386}`,`uniform mat4 u_matrix;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);v_pos=a_pos/8192.0;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}`),line:Yt(`uniform lowp float u_device_pixel_ratio;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;
387#ifdef GLOBE
388in float v_depth;
389#endif
390#pragma mapbox: define highp vec4 color
391#pragma mapbox: define lowp float blur
392#pragma mapbox: define lowp float opacity
393void main() {
394#pragma mapbox: initialize highp vec4 color
395#pragma mapbox: initialize lowp float blur
396#pragma mapbox: initialize lowp float opacity
397float 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);fragColor=color*(alpha*opacity);
398#ifdef GLOBE
399if (v_depth > 1.0) {discard;}
400#endif
401#ifdef OVERDRAW_INSPECTOR
402fragColor=vec4(1.0);
403#endif
404}`,`
405#define scale 0.015873016
406in vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp float v_linesofar;
407#ifdef GLOBE
408out float v_depth;
409#endif
410#pragma mapbox: define highp vec4 color
411#pragma mapbox: define lowp float blur
412#pragma mapbox: define lowp float opacity
413#pragma mapbox: define mediump float gapwidth
414#pragma mapbox: define lowp float offset
415#pragma mapbox: define mediump float width
416void main() {
417#pragma mapbox: initialize highp vec4 color
418#pragma mapbox: initialize lowp float blur
419#pragma mapbox: initialize lowp float opacity
420#pragma mapbox: initialize mediump float gapwidth
421#pragma mapbox: initialize lowp float offset
422#pragma mapbox: initialize mediump float width
423float 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);
423float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
424#ifdef GLOBE
425v_depth=gl_Position.z/gl_Position.w;
426#endif
427#ifdef TERRAIN3D
428v_gamma_scale=1.0;
429#else
430float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
431#endif
432v_width2=vec2(outset,inset);}`),lineGradient:Yt(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec2 v_uv;
433#ifdef GLOBE
434in float v_depth;
435#endif
436#pragma mapbox: define lowp float blur
437#pragma mapbox: define lowp float opacity
438void main() {
439#pragma mapbox: initialize lowp float blur
440#pragma mapbox: initialize lowp float opacity
441float 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=texture(u_image,v_uv);fragColor=color*(alpha*opacity);
442#ifdef GLOBE
443if (v_depth > 1.0) {discard;}
444#endif
445#ifdef OVERDRAW_INSPECTOR
446fragColor=vec4(1.0);
447#endif
448}`,`
449#define scale 0.015873016
450in vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;
451#ifdef GLOBE
452out float v_depth;
453#endif
454#pragma mapbox: define lowp float blur
455#pragma mapbox: define lowp float opacity
456#pragma mapbox: define mediump float gapwidth
457#pragma mapbox: define lowp float offset
458#pragma mapbox: define mediump float width
459void main() {
460#pragma mapbox: initialize lowp float blur
461#pragma mapbox: initialize lowp float opacity
462#pragma mapbox: initialize mediump float gapwidth
463#pragma mapbox: initialize lowp float offset
464#pragma mapbox: initialize mediump float width
465float 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);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
466#ifdef GLOBE
467v_depth=gl_Position.z/gl_Position.w;
468#endif
469#ifdef TERRAIN3D
470v_gamma_scale=1.0;
471#else
472float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
473#endif
474v_width2=vec2(outset,inset);}`),linePattern:Yt(`#ifdef GL_ES
475precision highp float;
476#endif
477uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;in vec2 v_normal;in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;in float v_width;
478#ifdef GLOBE
479in float v_depth;
480#endif
481#pragma mapbox: define lowp vec4 pattern_from
482#pragma mapbox: define lowp vec4 pattern_to
483#pragma mapbox: define lowp float pixel_ratio_from
484#pragma mapbox: define lowp float pixel_ratio_to
485#pragma mapbox: define lowp float blur
486#pragma mapbox: define lowp float opacity
487void main() {
488#pragma mapbox: initialize mediump vec4 pattern_from
489#pragma mapbox: initialize mediump vec4 pattern_to
490#pragma mapbox: initialize lowp float pixel_ratio_from
491#pragma mapbox: initialize lowp float pixel_ratio_to
492#pragma mapbox: initialize lowp float blur
493#pragma mapbox: initialize lowp float opacity
494vec2 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(texture(u_image,pos_a),texture(u_image,pos_b),u_fade);fragColor=color*alpha*opacity;
495#ifdef GLOBE
496if (v_depth > 1.0) {discard;}
497#endif
498#ifdef OVERDRAW_INSPECTOR
499fragColor=vec4(1.0);
500#endif
501}`,`
502#define scale 0.015873016
503#define LINE_DISTANCE_SCALE 2.0
504in vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;out float v_width;
505#ifdef GLOBE
506out float v_depth;
507#endif
508#pragma mapbox: define lowp float blur
509#pragma mapbox: define lowp float opacity
510#pragma mapbox: define lowp float offset
511#pragma mapbox: define mediump float gapwidth
512#pragma mapbox: define mediump float width
513#pragma mapbox: define lowp float floorwidth
514#pragma mapbox: define lowp vec4 pattern_from
515#pragma mapbox: define lowp vec4 pattern_to
516#pragma mapbox: define lowp float pixel_ratio_from
517#pragma mapbox: define lowp float pixel_ratio_to
518void main() {
519#pragma mapbox: initialize lowp float blur
520#pragma mapbox: initialize lowp float opacity
521#pragma mapbox: initialize lowp float offset
522#pragma mapbox: initialize mediump float gapwidth
523#pragma mapbox: initialize mediump float width
524#pragma mapbox: initialize lowp float floorwidth
525#pragma mapbox: initialize mediump vec4 pattern_from
526#pragma mapbox: initialize mediump vec4 pattern_to
527#pragma mapbox: initialize lowp float pixel_ratio_from
528#pragma mapbox: initialize lowp float pixel_ratio_to
529float 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);
529float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
530#ifdef GLOBE
531v_depth=gl_Position.z/gl_Position.w;
532#endif
533#ifdef TERRAIN3D
534v_gamma_scale=1.0;
535#else
536float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
537#endif
538v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:Yt(`uniform lowp float u_device_pixel_ratio;uniform lowp float u_lineatlas_width;uniform sampler2D u_image;uniform float u_mix;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;
539#ifdef GLOBE
540in float v_depth;
541#endif
542#pragma mapbox: define highp vec4 color
543#pragma mapbox: define lowp float blur
544#pragma mapbox: define lowp float opacity
545#pragma mapbox: define mediump float width
546#pragma mapbox: define lowp float floorwidth
547#pragma mapbox: define mediump vec4 dasharray_from
548#pragma mapbox: define mediump vec4 dasharray_to
549void main() {
550#pragma mapbox: initialize highp vec4 color
551#pragma mapbox: initialize lowp float blur
552#pragma mapbox: initialize lowp float opacity
553#pragma mapbox: initialize mediump float width
554#pragma mapbox: initialize lowp float floorwidth
555#pragma mapbox: initialize mediump vec4 dasharray_from
556#pragma mapbox: initialize mediump vec4 dasharray_to
557float 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=texture(u_image,v_tex_a).a;float sdfdist_b=texture(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);
557float sdfgamma=(u_lineatlas_width/256.0/u_device_pixel_ratio)/min(dasharray_from.w,dasharray_to.w);alpha*=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*opacity);
558#ifdef GLOBE
559if (v_depth > 1.0) {discard;}
560#endif
561#ifdef OVERDRAW_INSPECTOR
562fragColor=vec4(1.0);
563#endif
564}`,`
565#define scale 0.015873016
566#define LINE_DISTANCE_SCALE 2.0
567in vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;out vec2 v_width2;out vec2 v_tex_a;out vec2 v_tex_b;out float v_gamma_scale;
568#ifdef GLOBE
569out float v_depth;
570#endif
571#pragma mapbox: define highp vec4 color
572#pragma mapbox: define lowp float blur
573#pragma mapbox: define lowp float opacity
574#pragma mapbox: define mediump float gapwidth
575#pragma mapbox: define lowp float offset
576#pragma mapbox: define mediump float width
577#pragma mapbox: define lowp float floorwidth
578#pragma mapbox: define mediump vec4 dasharray_from
579#pragma mapbox: define mediump vec4 dasharray_to
580void main() {
581#pragma mapbox: initialize highp vec4 color
582#pragma mapbox: initialize lowp float blur
583#pragma mapbox: initialize lowp float opacity
584#pragma mapbox: initialize mediump float gapwidth
585#pragma mapbox: initialize lowp float offset
586#pragma mapbox: initialize mediump float width
587#pragma mapbox: initialize lowp float floorwidth
588#pragma mapbox: initialize mediump vec4 dasharray_from
589#pragma mapbox: initialize mediump vec4 dasharray_to
590float 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);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
591#ifdef GLOBE
592v_depth=gl_Position.z/gl_Position.w;
593#endif
594#ifdef TERRAIN3D
595v_gamma_scale=1.0;
596#else
597float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
598#endif
599float u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}`),lineGradientSDF:Yt(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform sampler2D u_image_dash;uniform float u_mix;uniform lowp float u_lineatlas_width;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;in highp vec2 v_uv;
600#ifdef GLOBE
601in float v_depth;
602#endif
603#pragma mapbox: define lowp float blur
604#pragma mapbox: define lowp float opacity
605#pragma mapbox: define mediump float width
606#pragma mapbox: define lowp float floorwidth
607#pragma mapbox: define mediump vec4 dasharray_from
608#pragma mapbox: define mediump vec4 dasharray_to
609void main() {
610#pragma mapbox: initialize lowp float blur
611#pragma mapbox: initialize lowp float opacity
612#pragma mapbox: initialize mediump float width
613#pragma mapbox: initialize lowp float floorwidth
614#pragma mapbox: initialize mediump vec4 dasharray_from
615#pragma mapbox: initialize mediump vec4 dasharray_to
616float 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=texture(u_image,v_uv);float sdfdist_a=texture(u_image_dash,v_tex_a).a;float sdfdist_b=texture(u_image_dash,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);
616float sdfgamma=(u_lineatlas_width/256.0)/min(dasharray_from.w,dasharray_to.w);float dash_alpha=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*dash_alpha*opacity);
617#ifdef GLOBE
618if (v_depth > 1.0) {discard;}
619#endif
620#ifdef OVERDRAW_INSPECTOR
621fragColor=vec4(1.0);
622#endif
623}`,`
624#define scale 0.015873016
625#define LINE_DISTANCE_SCALE 2.0
626in vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;out vec2 v_tex_a;out vec2 v_tex_b;
627#ifdef GLOBE
628out float v_depth;
629#endif
630#pragma mapbox: define lowp float blur
631#pragma mapbox: define lowp float opacity
632#pragma mapbox: define mediump float gapwidth
633#pragma mapbox: define lowp float offset
634#pragma mapbox: define mediump float width
635#pragma mapbox: define lowp float floorwidth
636#pragma mapbox: define mediump vec4 dasharray_from
637#pragma mapbox: define mediump vec4 dasharray_to
638void main() {
639#pragma mapbox: initialize lowp float blur
640#pragma mapbox: initialize lowp float opacity
641#pragma mapbox: initialize mediump float gapwidth
642#pragma mapbox: initialize lowp float offset
643#pragma mapbox: initialize mediump float width
644#pragma mapbox: initialize lowp float floorwidth
645#pragma mapbox: initialize mediump vec4 dasharray_from
646#pragma mapbox: initialize mediump vec4 dasharray_to
647float 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;float texel_height=1.0/u_image_height;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);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
648#ifdef GLOBE
649v_depth=gl_Position.z/gl_Position.w;
650#endif
651#ifdef TERRAIN3D
652v_gamma_scale=1.0;
653#else
654float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
655#endif
656float u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}`),raster:Yt(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;in vec2 v_pos0;in 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=texture(u_image0,v_pos0);vec4 color1=texture(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);fragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);
657#ifdef OVERDRAW_INSPECTOR
658fragColor=vec4(1.0);
659#endif
660}`,`uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;uniform vec4 u_coords_top;uniform vec4 u_coords_bottom;in vec2 a_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {vec2 fractionalPos=a_pos/8192.0;vec2 position=mix(mix(u_coords_top.xy,u_coords_top.zw,fractionalPos.x),mix(u_coords_bottom.xy,u_coords_bottom.zw,fractionalPos.x),fractionalPos.y);gl_Position=projectTile(position,position);v_pos0=((fractionalPos-0.5)/u_buffer_scale)+0.5;
661#ifdef GLOBE
662if (a_pos.y <-32767.5) {v_pos0.y=0.0;}if (a_pos.y > 32766.5) {v_pos0.y=1.0;}
663#endif
664v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`),symbolIcon:Yt(`uniform sampler2D u_texture;in vec2 v_tex;in float v_total_opacity;void main() {fragColor=texture(u_texture,v_tex)*v_total_opacity;
665#ifdef OVERDRAW_INSPECTOR
666fragColor=vec4(1.0);
667#endif
668}`,`in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in 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_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;out vec2 v_tex;out float v_total_opacity;
669#pragma mapbox: define lowp float opacity
670void main() {
671#pragma mapbox: initialize lowp float opacity
672vec2 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);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_total_opacity=opacity*max(0.0,min(visibility,fade_opacity[0]+fade_change));if (v_total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
673camera_to_anchor_distance/u_camera_to_center_distance :
674u_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;
675#ifdef GLOBE
676if(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}
677#endif
678vec4 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;}`),symbolSDF:Yt(`#define SDF_PX 8.0
679uniform bool u_is_halo;uniform bool u_is_plain;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;in vec2 v_data0;in vec3 v_data1;
680#pragma mapbox: define highp vec4 fill_color
681#pragma mapbox: define highp vec4 halo_color
682#pragma mapbox: define lowp float halo_width
683#pragma mapbox: define lowp float halo_blur
684void main() {
685#pragma mapbox: initialize highp vec4 fill_color
686#pragma mapbox: initialize highp vec4 halo_color
687#pragma mapbox: initialize lowp float halo_width
688#pragma mapbox: initialize lowp float halo_blur
689float 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 total_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;lowp float dist=texture(u_texture,tex).a;lowp vec4 color_alpha_out_text,color_alpha_out_halo;if (u_is_plain){highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);color_alpha_out_text=total_opacity*alpha*fill_color;}if (u_is_halo) {float gamma_halo=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);float inner_edge_halo=inner_edge+gamma_halo*gamma_scale;highp float gamma_scaled_halo=gamma_halo*gamma_scale;highp float alpha_halo=smoothstep(inner_edge_halo-gamma_scaled_halo,inner_edge_halo+gamma_scaled_halo,dist);highp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha_halo= min(smoothstep(halo_edge-gamma_scaled_halo,halo_edge+gamma_scaled_halo,dist),1.0-alpha_halo);color_alpha_out_halo=total_opacity*alpha_halo*halo_color;}if (u_is_plain && u_is_halo) {fragColor=color_alpha_out_text+(1.-color_alpha_out_text.a)*color_alpha_out_halo;} else if (u_is_halo){fragColor=color_alpha_out_halo;} else {fragColor=color_alpha_out_text;}
690#ifdef OVERDRAW_INSPECTOR
691fragColor=vec4(1.0);
692#endif
693}`,`in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in 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_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;out vec2 v_data0;out vec3 v_data1;
694#pragma mapbox: define highp vec4 fill_color
695#pragma mapbox: define highp vec4 halo_color
696#pragma mapbox: define lowp float opacity
697#pragma mapbox: define lowp float halo_width
698#pragma mapbox: define lowp float halo_blur
699void main() {
700#pragma mapbox: initialize highp vec4 fill_color
701#pragma mapbox: initialize highp vec4 halo_color
702#pragma mapbox: initialize lowp float opacity
703#pragma mapbox: initialize lowp float halo_width
704#pragma mapbox: initialize lowp float halo_blur
705vec2 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/16.0;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);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));float total_opacity=opacity*interpolated_fade_opacity;if (total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
706camera_to_anchor_distance/u_camera_to_center_distance :
707u_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;
708#ifdef GLOBE
709if(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}
710#endif
711vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,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;v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,total_opacity);}`),symbolTextAndIcon:Yt(`#define SDF_PX 8.0
712#define SDF 1.0
713#define ICON 0.0
714uniform bool u_is_halo;uniform bool u_is_text;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;in vec4 v_data0;in vec4 v_data1;
715#pragma mapbox: define highp vec4 fill_color
716#pragma mapbox: define highp vec4 halo_color
717#pragma mapbox: define lowp float halo_width
718#pragma mapbox: define lowp float halo_blur
719void main() {
720#pragma mapbox: initialize highp vec4 fill_color
721#pragma mapbox: initialize highp vec4 halo_color
722#pragma mapbox: initialize lowp float halo_width
723#pragma mapbox: initialize lowp float halo_blur
724float total_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;
724fragColor=texture(u_texture_icon,tex_icon)*total_opacity;
725#ifdef OVERDRAW_INSPECTOR
726fragColor=vec4(1.0);
727#endif
728return;}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;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;lowp float dist=texture(u_texture,tex).a;lowp vec4 color_alpha_out,color_alpha_out_halo;if (u_is_text) {highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);color_alpha_out=fill_color*(alpha*total_opacity);}if (u_is_halo) {highp float gamma_halo=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);lowp float buff_halo=(6.0-halo_width/fontScale)/SDF_PX;highp float gamma_scaled_halo=gamma_halo*gamma_scale;highp float alpha_halo=smoothstep(buff_halo-gamma_scaled_halo,buff_halo+gamma_scaled_halo,dist);color_alpha_out_halo=halo_color*(alpha_halo*total_opacity);}if (u_is_text && u_is_halo) {fragColor=color_alpha_out+(1.-color_alpha_out.a)*color_alpha_out_halo;} else if (u_is_halo) {fragColor=color_alpha_out_halo;} else {fragColor=color_alpha_out;}
729#ifdef OVERDRAW_INSPECTOR
730fragColor=vec4(1.0);
731#endif
732}`,`in vec4 a_pos_offset;in vec4 a_data;in vec3 a_projected_pos;in 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_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;out vec4 v_data0;out vec4 v_data1;
733#pragma mapbox: define highp vec4 fill_color
734#pragma mapbox: define highp vec4 halo_color
735#pragma mapbox: define lowp float opacity
736#pragma mapbox: define lowp float halo_width
737#pragma mapbox: define lowp float halo_blur
738void main() {
739#pragma mapbox: initialize highp vec4 fill_color
740#pragma mapbox: initialize highp vec4 halo_color
741#pragma mapbox: initialize lowp float opacity
742#pragma mapbox: initialize lowp float halo_width
743#pragma mapbox: initialize lowp float halo_blur
744vec2 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);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));float total_opacity=opacity*interpolated_fade_opacity;if (total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
745camera_to_anchor_distance/u_camera_to_center_distance :
746u_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;
747#ifdef GLOBE
748if(u_pitch_with_map && !u_is_along_line) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}
749#endif
750vec4 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;v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,total_opacity,is_sdf);}`),terrain:Yt(`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;uniform bool u_is_globe_mode;in vec2 v_texture_pos;in 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=texture(u_texture,vec2(v_texture_pos.x,1.0-v_texture_pos.y));if (!u_is_globe_mode && u_fog_ground_blend_opacity > 0.0 && 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);
750float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);fragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {fragColor=surface_color;}}`,`in vec3 a_pos3d;uniform mat4 u_fog_matrix;uniform float u_ele_delta;out vec2 v_texture_pos;out 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=projectTileFor3D(a_pos3d.xy,ele-ele_delta);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}`),terrainDepth:Yt(`in 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() {fragColor=pack(v_depth);}`,`in vec3 a_pos3d;uniform float u_ele_delta;out 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=projectTileFor3D(a_pos3d.xy,ele-ele_delta);v_depth=gl_Position.z/gl_Position.w;}`),terrainCoords:Yt(`precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;in vec2 v_texture_pos;void main() {vec4 rgba=texture(u_texture,v_texture_pos);fragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}`,`in vec3 a_pos3d;uniform float u_ele_delta;out 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=projectTileFor3D(a_pos3d.xy,ele-ele_delta);}`),projectionErrorMeasurement:Yt(`in vec4 v_output_error_encoded;void main() {fragColor=v_output_error_encoded;}`,`in vec2 a_pos;uniform highp float u_input;uniform highp float u_output_expected;out vec4 v_output_error_encoded;void main() {float real_output=2.0*atan(exp(PI-(u_input*PI*2.0)))-PI*0.5;float error=real_output-u_output_expected;float abs_error=abs(error)*128.0;v_output_error_encoded.x=min(floor(abs_error*256.0),255.0)/255.0;abs_error-=v_output_error_encoded.x;v_output_error_encoded.y=min(floor(abs_error*65536.0),255.0)/255.0;abs_error-=v_output_error_encoded.x/255.0;v_output_error_encoded.z=min(floor(abs_error*16777216.0),255.0)/255.0;v_output_error_encoded.w=error >=0.0 ? 1.0 : 0.0;gl_Position=vec4(a_pos,0.0,1.0);}`),atmosphere:Yt(`#ifdef GL_ES
751precision highp float;
752#endif
753in vec3 view_direction;uniform vec3 u_sun_pos;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;/**Shader use from https:*Made some change to adapt to MapLibre Globe geometry*/const float PI=3.141592653589793;const int iSteps=5;const int jSteps=3;/*radius of the planet*/const float EARTH_RADIUS=6371e3;/*radius of the atmosphere*/const float ATMOS_RADIUS=6471e3;vec2 rsi(vec3 r0,vec3 rd,float sr) {float a=dot(rd,rd);float b=2.0*dot(rd,r0);float c=dot(r0,r0)-(sr*sr);float d=(b*b)-4.0*a*c;if (d < 0.0) return vec2(1e5,-1e5);return vec2((-b-sqrt(d))/(2.0*a),(-b+sqrt(d))/(2.0*a));}vec4 atmosphere(vec3 r,vec3 r0,vec3 pSun,float iSun,float rPlanet,float rAtmos,vec3 kRlh,float kMie,float shRlh,float shMie,float g) {pSun=normalize(pSun);r=normalize(r);vec2 p=rsi(r0,r,rAtmos);if (p.x > p.y) {return vec4(0.0,0.0,0.0,1.0);}if (p.x < 0.0) {p.x=0.0;}vec3 pos=r0+r*p.x;vec2 p2=rsi(r0,r,rPlanet);if (p2.x <=p2.y && p2.x > 0.0) {p.y=min(p.y,p2.x);}float iStepSize=(p.y-p.x)/float(iSteps);float iTime=p.x+iStepSize*0.5;vec3 totalRlh=vec3(0,0,0);vec3 totalMie=vec3(0,0,0);float iOdRlh=0.0;float iOdMie=0.0;float mu=dot(r,pSun);float mumu=mu*mu;float gg=g*g;float pRlh=3.0/(16.0*PI)*(1.0+mumu);float pMie=3.0/(8.0*PI)*((1.0-gg)*(mumu+1.0))/(pow(1.0+gg-2.0*mu*g,1.5)*(2.0+gg));for (int i=0; i < iSteps; i++) {vec3 iPos=r0+r*iTime;float iHeight=length(iPos)-rPlanet;float odStepRlh=exp(-iHeight/shRlh)*iStepSize;float odStepMie=exp(-iHeight/shMie)*iStepSize;iOdRlh+=odStepRlh;iOdMie+=odStepMie;float jStepSize=rsi(iPos,pSun,rAtmos).y/float(jSteps);float jTime=jStepSize*0.5;float jOdRlh=0.0;float jOdMie=0.0;for (int j=0; j < jSteps; j++) {vec3 jPos=iPos+pSun*jTime;float jHeight=length(jPos)-rPlanet;jOdRlh+=exp(-jHeight/shRlh)*jStepSize;jOdMie+=exp(-jHeight/shMie)*jStepSize;jTime+=jStepSize;}vec3 attn=exp(-(kMie*(iOdMie+jOdMie)+kRlh*(iOdRlh+jOdRlh)));totalRlh+=odStepRlh*attn;totalMie+=odStepMie*attn;iTime+=iStepSize;}float opacity=exp(-(length(kRlh)*length(totalRlh)+kMie*length(totalMie)));vec3 color=iSun*(pRlh*kRlh*totalRlh+pMie*kMie*totalMie);return vec4(color,opacity);}void main() {vec3 scale_camera_pos=-u_globe_position*EARTH_RADIUS/u_globe_radius;vec4 color=atmosphere(normalize(view_direction),scale_camera_pos,u_sun_pos,22.0,EARTH_RADIUS,ATMOS_RADIUS,vec3(5.5e-6,13.0e-6,22.4e-6),21e-6,8e3,1.2e3,0.758
754);color.rgb=1.0-exp(-1.0*color.rgb);color=pow(color,vec4(1.0/2.2));fragColor=vec4(color.rgb,1.0-color.a)*u_atmosphere_blend;}`,`in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 view_direction;void main() {view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,0.0,1.0);}`),sky:Yt(`uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform vec2 u_horizon;uniform vec2 u_horizon_normal;uniform float u_sky_horizon_blend;uniform float u_sky_blend;void main() {float x=gl_FragCoord.x;float y=gl_FragCoord.y;float blend=(y-u_horizon.y)*u_horizon_normal.y+(x-u_horizon.x)*u_horizon_normal.x;if (blend > 0.0) {if (blend < u_sky_horizon_blend) {fragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {fragColor=u_sky_color;}}fragColor=mix(fragColor,vec4(vec3(0.0),0.0),u_sky_blend);}`,`in vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}`)};
vendor: 92,114 bytes, line 754
754function Yt(e,t){let n=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,r=t.match(/in ([\w]+) ([\w]+)/g),i=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),a=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),o=a?a.concat(i):i,s={};return{fragmentSource:e=e.replace(n,((e,t,n,r,i)=>(s[i]=!0,t===`define`?`\n#ifndef HAS_UNIFORM_u_${i}\nin ${n} ${r} ${i};\n#else\nuniform ${n} ${r} u_${i};\n#endif\n`:`\n#ifdef HAS_UNIFORM_u_${i}\n    ${n} ${r} ${i} = u_${i};\n#endif\n`))),vertexSource:t=t.replace(n,((e,t,n,r,i)=>{let a=r===`float`?`vec2`:`vec4`,o=i.match(/color/)?`color`:a;return s[i]?t===`define`?`\n#ifndef HAS_UNIFORM_u_${i}\nuniform lowp float u_${i}_t;\nin ${n} ${a} a_${i};\nout ${n} ${r} ${i};\n#else\nuniform ${n} ${r} u_${i};\n#endif\n`:o===`vec4`?`\n#ifndef HAS_UNIFORM_u_${i}\n    ${i} = a_${i};\n#else\n    ${n} ${r} ${i} = u_${i};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${i}\n    ${i} = unpack_mix_${o}(a_${i}, u_${i}_t);\n#else\n    ${n} ${r} ${i} = u_${i};\n#endif\n`:t===`define`?`\n#ifndef HAS_UNIFORM_u_${i}\nuniform lowp float u_${i}_t;\nin ${n} ${a} a_${i};\n#else\nuniform ${n} ${r} u_${i};\n#endif\n`:o===`vec4`?`\n#ifndef HAS_UNIFORM_u_${i}\n    ${n} ${r} ${i} = a_${i};\n#else\n    ${n} ${r} ${i} = u_${i};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${i}\n    ${n} ${r} ${i} = unpack_mix_${o}(a_${i}, u_${i}_t);\n#else\n    ${n} ${r} ${i} = u_${i};\n#endif\n`})),staticAttributes:r,staticUniforms:o}}class Xt{constructor(e,t,n){this.vertexBuffer=e,this.indexBuffer=t,this.segments=n}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}var Zt=t.aS([{name:`a_pos`,type:`Int16`,components:2}]);let Qt=`#define PROJECTION_MERCATOR`,$t=`mercator`;class en{constructor(){this._cachedMesh=null}get name(){return`mercator`}get useSubdivision(){return!1}get shaderVariantName(){return $t}get shaderDefine(){return Qt}get shaderPreludeCode(){return Jt.projectionMercator}get vertexShaderPreludeCode(){return Jt.projectionMercator.vertexSource}get subdivisionGranularity(){return t.aT.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}get latitudeErrorCorrectionRadians(){return 0}destroy(){}updateGPUdependent(e){}getMeshFromTileID(e,n,r,i,a){if(this._cachedMesh)return this._cachedMesh;let o=new t.aU;o.emplaceBack(0,0),o.emplaceBack(t.a6,0),o.emplaceBack(0,t.a6),o.emplaceBack(t.a6,t.a6);let s=e.createVertexBuffer(o,Zt.members),c=t.aV.simpleSegment(0,0,4,2),l=new t.aW;l.emplaceBack(1,0,2),l.emplaceBack(1,2,3);let u=e.createIndexBuffer(l);return this._cachedMesh=new Xt(s,u,c),this._cachedMesh}recalculate(){}hasTransition(){return!1}setErrorQueryLatitudeDegrees(e){}}class tn{constructor(e=0,t=0,n=0,r=0){if(isNaN(e)||e<0||isNaN(t)||t<0||isNaN(n)||n<0||isNaN(r)||r<0)throw Error(`Invalid value for edge-insets, top, bottom, left and right must all be numbers`);this.top=e,this.bottom=t,this.left=n,this.right=r}interpolate(e,n,r){return n.top!=null&&e.top!=null&&(this.top=t.H.number(e.top,n.top,r)),n.bottom!=null&&e.bottom!=null&&(this.bottom=t.H.number(e.bottom,n.bottom,r)),n.left!=null&&e.left!=null&&(this.left=t.H.number(e.left,n.left,r)),n.right!=null&&e.right!=null&&(this.right=t.H.number(e.right,n.right,r)),this}getCenter(e,n){let r=t.al((this.left+e-this.right)/2,0,e),i=t.al((this.top+n-this.bottom)/2,0,n);return new t.P(r,i)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new tn(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function nn(e,t){if(!e.renderWorldCopies||e.lngRange)return;let n=t.lng-e.center.lng;t.lng+=n>180?-360:n<-180?360:0}function rn(e){return Math.max(0,Math.floor(e))}class an{constructor(e,n){this.applyConstrain=(e,t)=>this._constrainOverride===null?this._callbacks.defaultConstrain(e,t):this._constrainOverride(e,t),this._callbacks=e,this._tileSize=512,this._renderWorldCopies=n?.renderWorldCopies===void 0||!!n?.renderWorldCopies,this._minZoom=n?.minZoom||0,this._maxZoom=n?.maxZoom||22,this._minPitch=n?.minPitch==null?0:n?.minPitch,this._maxPitch=n?.maxPitch==null?60:n?.maxPitch,this._constrainOverride=n?.constrainOverride??null,this.setMaxBounds(),this._width=0,this._height=0,this._center=new t.W(0,0),this._elevation=0,this._zoom=0,this._tileZoom=rn(this._zoom),this._scale=t.ao(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new tn,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(e,n,r){this._constrainOverride=e.constrainOverride,this._latRange=e.latRange,this._lngRange=e.lngRange,this._width=e.width,this._height=e.height,this._center=e.center,this._elevation=e.elevation,this._minElevationForCurrentTile=e.minElevationForCurrentTile,this._zoom=e.zoom,this._tileZoom=rn(this._zoom),this._scale=t.ao(this._zoom),this._bearingInRadians=e.bearingInRadians,this._fovInRadians=e.fovInRadians,this._pitchInRadians=e.pitchInRadians,this._rollInRadians=e.rollInRadians,this._unmodified=e.unmodified,this._edgeInsets=new tn(e.padding.top,e.padding.bottom,e.padding.left,e.padding.right),this._minZoom=e.minZoom,this._maxZoom=e.maxZoom,this._minPitch=e.minPitch,this._maxPitch=e.maxPitch,this._renderWorldCopies=e.renderWorldCopies,this._cameraToCenterDistance=e.cameraToCenterDistance,this._nearZ=e.nearZ,this._farZ=e.farZ,this._autoCalculateNearFarZ=!r&&e.autoCalculateNearFarZ,n&&this.constrainInternal(),this._calcMatrices()}get pixelsToClipSpaceMatrix(){return this._pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._clipSpaceToPixelsMatrix}get minElevationForCurrentTile(){return this._minElevationForCurrentTile}setMinElevationForCurrentTile(e){this._minElevationForCurrentTile=e}get tileSize(){return this._tileSize}get tileZoom(){return this._tileZoom}get scale(){return this._scale}get width(){return this._width}get height(){return this._height}get bearingInRadians(){return this._bearingInRadians}get lngRange(){return this._lngRange}get latRange(){return this._latRange}get pixelsToGLUnits(){return this._pixelsToGLUnits}get minZoom(){return this._minZoom}setMinZoom(e){this._minZoom!==e&&(this._minZoom=e,this.setZoom(this.applyConstrain(this._center,this.zoom).zoom))}get maxZoom(){return this._maxZoom}setMaxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.setZoom(this.applyConstrain(this._center,this.zoom).zoom))}get minPitch(){return this._minPitch}setMinPitch(e){this._minPitch!==e&&(this._minPitch=e,this.setPitch(Math.max(this.pitch,e)))}get maxPitch(){return this._maxPitch}setMaxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.setPitch(Math.min(this.pitch,e)))}get renderWorldCopies(){return this._renderWorldCopies}setRenderWorldCopies(e){e===void 0?e=!0:e===null&&(e=!1),this._renderWorldCopies=e}get constrainOverride(){return this._constrainOverride}setConstrainOverride(e){e===void 0&&(e=null),this._constrainOverride!==e&&(this._constrainOverride=e,this.constrainInternal(),this._calcMatrices())}get worldSize(){return this._tileSize*this._scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new t.P(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(e){let n=t.X(e,-180,180)*Math.PI/180;var i,a,o,s,c,l,u,d,f;this._bearingInRadians!==n&&(this._unmodified=!1,this._bearingInRadians=n,this._calcMatrices(),this._rotationMatrix=r(),i=this._rotationMatrix,o=-this._bearingInRadians,s=(a=this._rotationMatrix)[0],c=a[1],l=a[2],u=a[3],d=Math.sin(o),f=Math.cos(o),i[0]=s*f+l*d,i[1]=c*f+u*d,i[2]=s*-d+l*f,i[3]=c*-d+u*f)}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(e){let n=t.al(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==n&&(this._unmodified=!1,this._pitchInRadians=n,this._calcMatrices())}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(e){let t=e/180*Math.PI;this._rollInRadians!==t&&(this._unmodified=!1,this._rollInRadians=t,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return t.aX(this._fovInRadians)}setFov(e){e=t.al(e,.1,150),this.fov!==e&&(this._unmodified=!1,this._fovInRadians=t.an(e),this._calcMatrices())}get zoom(){return this._zoom}setZoom(e){let n=this.applyConstrain(this._center,e).zoom;this._zoom!==n&&(this._unmodified=!1,this._zoom=n,this._tileZoom=Math.max(0,Math.floor(n)),this._scale=t.ao(n),this.constrainInternal(),this._calcMatrices())}get center(){return this._center}setCenter(e){e.lat===this._center.lat&&e.lng===this._center.lng||(this._unmodified=!1,this._center=e,this.constrainInternal(),this._calcMatrices())}get elevation(){return this._elevation}setElevation(e){e!==this._elevation&&(this._elevation=e,this.constrainInternal(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}setPadding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this._width,this._height)}get pixelsPerMeter(){return this._pixelPerMeter}get unmodified(){return this._unmodified}get cameraToCenterDistance(){return this._cameraToCenterDistance}get nearZ(){return this._nearZ}get farZ(){return this._farZ}get autoCalculateNearFarZ(){return this._autoCalculateNearFarZ}overrideNearFarZ(e,t){this._autoCalculateNearFarZ=!1,this._nearZ=e,this._farZ=t,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,t,n){this._unmodified=!1,this._edgeInsets.interpolate(e,t,n),this.constrainInternal(),this._calcMatrices()}resize(e,t,n=!0){this._width=e,this._height=t,n&&this.constrainInternal(),this._calcMatrices()}getMaxBounds(){return this._latRange?.length!==2||this._lngRange?.length!==2?null:new le([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]])}setMaxBounds(e){e?(this._lngRange=[e.getWest(),e.getEast()],this._latRange=[e.getSouth(),e.getNorth()],this.constrainInternal()):(this._lngRange=null,this._latRange=[-t.am,t.am])}getCameraQueryGeometry(e,n){if(n.length===1)return[n[0],e];{let{minX:r,minY:i,maxX:a,maxY:o}=t.a8.fromPoints(n).extend(e);return[new t.P(r,i),new t.P(a,i),new t.P(a,o),new t.P(r,o),new t.P(r,i)]}}constrainInternal(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;let e=this._unmodified,{center:t,zoom:n}=this.applyConstrain(this.center,this.zoom);this.setCenter(t),this.setZoom(n),this._unmodified=e,this._constraining=!1}_calcMatrices(){if(this._width&&this._height){this._pixelsToGLUnits=[2/this._width,-2/this._height];let e=t.ap(new Float64Array(16));t.S(e,e,[this._width/2,-this._height/2,1]),t.Q(e,e,[1,-1,0]),this._clipSpaceToPixelsMatrix=e,e=t.ap(new Float64Array(16)),t.S(e,e,[1,-1,1]),t.Q(e,e,[-1,-1,0]),t.S(e,e,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=e,this._cameraToCenterDistance=.5/Math.tan(this.fovInRadians/2)*this._height}this._callbacks.calcMatrices()}calculateCenterFromCameraLngLatAlt(e,n,r,i){let a=r===void 0?this.bearing:r,o=i=i===void 0?this.pitch:i,{distanceToCenter:s,clampedElevation:c}=this._distanceToCenterFromAltElevationPitch(n,this.elevation,o),{x:l,y:u}=Be(o,a),d=t.a7.fromLngLat(e,n),f,p,m=t.aY(1,d.y),h=0;do{if(h+=1,h>10)break;p=s/m,f=new t.a7(d.x+l*p,d.y+u*p),m=1/f.meterInMercatorCoordinateUnits()}while(Math.abs(s-p*m)>1e-12);return{center:f.toLngLat(),elevation:c,zoom:t.ar(this.height/2/Math.tan(this.fovInRadians/2)/p/this.tileSize)}}recalculateZoomAndCenter(e){if(this.elevation-e==0)return;let n=1/this.worldSize,r=t.aq(1,this.center.lat)*this.worldSize,i=t.a7.fromLngLat(this.center,this.elevation),a=i.x/n,o=i.y/n,s=i.z/n,c=this.pitch,l=this.bearing,{x:u,y:d,z:f}=Be(c,l),p=this.cameraToCenterDistance,m=a+p*-u,h=o+p*-d,g=s+p*f,{distanceToCenter:_,clampedElevation:v}=this._distanceToCenterFromAltElevationPitch(g/r,e,c),y=_*r,b=new t.a7((m+u*y)*n,(h+d*y)*n,0).toLngLat(),x=t.aq(1,b.lat),S=t.ar(this.height/2/Math.tan(this.fovInRadians/2)/_/x/this.tileSize);this._elevation=v,this._center=b,this.setZoom(S)}_distanceToCenterFromAltElevationPitch(e,n,r){let i=-Math.cos(t.an(r)),a=e-n,o,s=n;return i*a>=0||Math.abs(i)<.1?(o=1e4,s=e+o*i):o=-a/i,{distanceToCenter:o,clampedElevation:s}}getCameraPoint(){let e=Math.tan(this.pitchInRadians)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new t.P(e*Math.sin(this.rollInRadians),e*Math.cos(this.rollInRadians)))}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this._cameraToCenterDistance/this._pixelPerMeter+this.elevation}getCameraLngLat(){let e=t.aq(1,this.center.lat)*this.worldSize;return ze(this.center,this.elevation,this.pitch,this.bearing,this.cameraToCenterDistance/e).toLngLat()}getMercatorTileCoordinates(e){if(!e)return[0,0,1,1];let n=e.canonical.z>=0?1<<e.canonical.z:2**e.canonical.z;return[e.canonical.x/n,e.canonical.y/n,1/n/t.a6,1/n/t.a6]}}class on{constructor(e,n){this.min=e,this.max=n,this.center=t.aZ([],t.a_([],this.min,this.max),.5)}quadrant(e){let n=[e%2==0,e<2],r=t.a$(this.min),i=t.a$(this.max);for(let e=0;e<n.length;e++)r[e]=n[e]?this.min[e]:this.center[e],i[e]=n[e]?this.center[e]:this.max[e];return i[2]=this.max[2],new on(r,i)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}intersectsFrustum(e){let t=!0;for(let n of e.planes){let e=this.intersectsPlane(n);if(e===0)return 0;e===1&&(t=!1)}return t?2:e.aabb.min[0]>this.max[0]||e.aabb.min[1]>this.max[1]||e.aabb.min[2]>this.max[2]||e.aabb.max[0]<this.min[0]||e.aabb.max[1]<this.min[1]||e.aabb.max[2]<this.min[2]?0:1}intersectsPlane(e){let t=e[3],n=e[3];for(let r=0;r<3;r++)e[r]>0?(t+=e[r]*this.min[r],n+=e[r]*this.max[r]):(n+=e[r]*this.min[r],t+=e[r]*this.max[r]);return t>=0?2:n<0?0:1}}class sn{distanceToTile2d(e,t,n,r){let i=r,a=i.distanceX([e,t]),o=i.distanceY([e,t]);return Math.hypot(a,o)}getWrap(e,t,n){return n}getTileBoundingVolume(e,n,r,i){let a=0,o=0;if(i?.terrain){let s=new t.a3(e.z,n,e.z,e.x,e.y),c=i.terrain.getMinMaxElevation(s);a=c.minElevation??Math.min(0,r),o=c.maxElevation??Math.max(0,r)}let s=1<<e.z;return new on([n+e.x/s,e.y/s,a],[n+(e.x+1)/s,(e.y+1)/s,o])}allowVariableZoom(e,n){let r=e.fov*(Math.abs(Math.cos(e.rollInRadians))*e.height+Math.abs(Math.sin(e.rollInRadians))*e.width)/e.height,i=t.al(78.5-r/2,0,60);return!!n.terrain||e.pitch>i}allowWorldCopies(){return!0}prepareNextFrame(){}}class cn{constructor(e,t,n){this.points=e,this.planes=t,this.aabb=n}static fromInvProjectionMatrix(e,n=1,r=0,i,a){let o=a?[[6,5,4],[0,1,2],[0,3,7],[2,1,5],[3,2,6],[0,4,5]]:[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]],s=2**r,c=[[-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((r=>function(e,n,r,i){let a=t.aE([],e,n),o=1/a[3]/r*i;return t.b4(a,a,[o,o,1/a[3],o])}(r,e,n,s)));i&&function(e,n,r,i){let a=i?4:0,o=i?0:4,s=0,c=[],l=[];for(let n=0;n<4;n++){let r=t.b0([],e[n+o],e[n+a]),i=t.b5(r);t.aZ(r,r,1/i),c.push(i),l.push(r)}for(let n=0;n<4;n++){let i=t.b6(e[n+a],l[n],r);s=i!==null&&i>=0?Math.max(s,i):Math.max(s,c[n])}let u=function(e,n){let r=t.b0([],e[n[0]],e[n[1]]),i=t.b0([],e[n[2]],e[n[1]]),a=[0,0,0,0];return t.b1(a,t.b2([],r,i)),a[3]=-t.b3(a,e[n[0]]),a}(e,n),d=function(e,n){let r=t.b7(e),i=t.b8([],e,1/r),a=t.b0([],n,t.aZ([],i,t.b3(n,i))),o=t.b7(a);if(o>0){let e=Math.sqrt(1-i[3]*i[3]),r=t.aZ([],i,-i[3]),s=t.a_([],r,t.aZ([],a,e/o));return t.b9(n,s)}return null}(r,u);if(d!==null){let e=d/t.b3(l[0],u);s=Math.min(s,e)}for(let t=0;t<4;t++){let n=Math.min(s,c[t]);e[t+o]=[e[t+a][0]+l[t][0]*n,e[t+a][1]+l[t][1]*n,e[t+a][2]+l[t][2]*n,1]}}(c,o[0],i,a);let l=o.map((e=>{let n=t.b0([],c[e[0]],c[e[1]]),r=t.b0([],c[e[2]],c[e[1]]),i=t.b1([],t.b2([],n,r)),a=-t.b3(i,c[e[1]]);return i.concat(a)})),u=[1/0,1/0,1/0],d=[-1/0,-1/0,-1/0];for(let e of c)for(let t=0;t<3;t++)u[t]=Math.min(u[t],e[t]),d[t]=Math.max(d[t],e[t]);return new cn(c,l,new on(u,d))}}class ln{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,t,n){this._helper.interpolatePadding(e,t,n)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,t,n=!0){this._helper.resize(e,t,n)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}setConstrainOverride(e){this._helper.setConstrainOverride(e)}overrideNearFarZ(e,t){this._helper.overrideNearFarZ(e,t)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(e,t){}constructor(e){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this.defaultConstrain=(e,n)=>{n=t.al(+n,this.minZoom,this.maxZoom);let r={center:new t.W(e.lng,e.lat),zoom:n},i=this._helper._lngRange;!this._helper._renderWorldCopies&&i===null&&(i=[-179.9999999999,179.9999999999]);let a=this.tileSize*t.ao(r.zoom),o=0,s=a,c=0,l=a,u=0,d=0,{x:f,y:p}=this.size;if(this._helper._latRange){let e=this._helper._latRange;o=t.Y(e[1])*a,s=t.Y(e[0])*a,s-o<p&&(u=p/(s-o))}i&&(c=t.X(t.Z(i[0])*a,0,a),l=t.X(t.Z(i[1])*a,0,a),l<c&&(l+=a),l-c<f&&(d=f/(l-c)));let{x:m,y:h}=Fe(a,e),g,_,v=Math.max(d||0,u||0);if(v)return r.center=Ie(a,new t.P(d?(l+c)/2:m,u?(s+o)/2:h)).wrap(),r.zoom+=t.ar(v),r;if(this._helper._latRange){let e=p/2;h-e<o&&(_=o+e),h+e>s&&(_=s-e)}if(i){let e=(c+l)/2,n=m;this._helper._renderWorldCopies&&(n=t.X(m,e-a/2,e+a/2));let r=f/2;n-r<c&&(g=c+r),n+r>l&&(g=l-r)}return(g!==void 0||_!==void 0)&&(r.center=Ie(a,new t.P(g??m,_??h)).wrap()),r},this.applyConstrain=(e,t)=>this._helper.applyConstrain(e,t),this._helper=new an({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(e,t)=>this.defaultConstrain(e,t)},e),this._coveringTilesDetailsProvider=new sn}clone(){let e=new ln;return e.apply(this,!1),e}apply(e,t,n){this._helper.apply(e,t,n)}get cameraPosition(){return this._cameraPosition}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._viewProjMatrix}get inverseProjectionMatrix(){return this._invProjMatrix}get mercatorMatrix(){return this._mercatorMatrix}getVisibleUnwrappedCoordinates(e){let n=[new t.ba(0,e)];if(this._helper._renderWorldCopies){let r=this.screenPointToMercatorCoordinate(new t.P(0,0)),i=this.screenPointToMercatorCoordinate(new t.P(this._helper._width,0)),a=this.screenPointToMercatorCoordinate(new t.P(this._helper._width,this._helper._height)),o=this.screenPointToMercatorCoordinate(new t.P(0,this._helper._height)),s=Math.floor(Math.min(r.x,i.x,a.x,o.x)),c=Math.floor(Math.max(r.x,i.x,a.x,o.x));for(let r=s-1;r<=c+1;r++)r!==0&&n.push(new t.ba(r,e))}return n}getCameraFrustum(){return cn.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(e){let t=this.screenPointToLocation(this.centerPoint,e),n=e?e.getElevationForLngLatZoom(t,this._helper._tileZoom):0;this._helper.recalculateZoomAndCenter(n)}setLocationAtPoint(e,n){let r=t.aq(this.elevation,this.center.lat),i=this.screenPointToMercatorCoordinateAtZ(n,r),a=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,r),o=t.a7.fromLngLat(e),s=new t.a7(o.x-(i.x-a.x),o.y-(i.y-a.y));this.setCenter(s?.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(e,n){return n?this.coordinatePoint(t.a7.fromLngLat(e),n.getElevationForLngLat(e,this),this._pixelMatrix3D):this.coordinatePoint(t.a7.fromLngLat(e))}screenPointToLocation(e,t){return this.screenPointToMercatorCoordinate(e,t)?.toLngLat()}screenPointToMercatorCoordinate(e,t){if(t){let n=t.pointCoordinate(e);if(n!=null)return n}return this.screenPointToMercatorCoordinateAtZ(e)}screenPointToMercatorCoordinateAtZ(e,n){let r=n||0,i=[e.x,e.y,0,1],a=[e.x,e.y,1,1];t.aE(i,i,this._pixelMatrixInverse),t.aE(a,a,this._pixelMatrixInverse);let o=i[3],s=a[3],c=i[1]/o,l=a[1]/s,u=i[2]/o,d=a[2]/s,f=u===d?0:(r-u)/(d-u);return new t.a7(t.H.number(i[0]/o,a[0]/s,f)/this.worldSize,t.H.number(c,l,f)/this.worldSize,r)}coordinatePoint(e,n=0,r=this._pixelMatrix){let i=[e.x*this.worldSize,e.y*this.worldSize,n,1];return t.aE(i,i,r),new t.P(i[0]/i[3],i[1]/i[3])}getBounds(){let e=Math.max(0,this._helper._height/2-Le(this));return new le().extend(this.screenPointToLocation(new t.P(0,e))).extend(this.screenPointToLocation(new t.P(this._helper._width,e))).extend(this.screenPointToLocation(new t.P(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new t.P(0,this._helper._height)))}isPointOnMapSurface(e,t){return t?t.pointCoordinate(e)!=null:e.y>this.height/2-Le(this)}calculatePosMatrix(e,n=!1,r){let i=e.key??t.bb(e.wrap,e.canonical.z,e.canonical.z,e.canonical.x,e.canonical.y),a=n?this._alignedPosMatrixCache:this._posMatrixCache;if(a.has(i)){let e=a.get(i);return r?e.f32:e.f64}let o=Re(e,this.worldSize);t.U(o,n?this._alignedProjMatrix:this._viewProjMatrix,o);let s={f64:o,f32:new Float32Array(o)};return a.set(i,s),r?s.f32:s.f64}calculateFogMatrix(e){let n=e.key,r=this._fogMatrixCacheF32;if(r.has(n))return r.get(n);let i=Re(e,this.worldSize);return t.U(i,this._fogMatrix,i),r.set(n,new Float32Array(i)),r.get(n)}calculateCenterFromCameraLngLatAlt(e,t,n,r){return this._helper.calculateCenterFromCameraLngLatAlt(e,t,n,r)}_calculateNearFarZIfNeeded(e,n,r){if(!this._helper.autoCalculateNearFarZ)return;let i=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),a=e-i*this._helper._pixelPerMeter/Math.cos(n),o=i<0?a:e,s=Math.PI/2+this.pitchInRadians,c=t.an(this.fov)*(Math.abs(Math.cos(t.an(this.roll)))*this.height+Math.abs(Math.sin(t.an(this.roll)))*this.width)/this.height*(.5+r.y/this.height),l=Math.sin(c)*o/Math.sin(t.al(Math.PI-s-c,.01,Math.PI-.01)),u=Le(this),d=Math.atan(u/this._helper.cameraToCenterDistance),f=t.an(.75),p=d>f?2*d*(.5+r.y/(2*u)):f,m=Math.sin(p)*o/Math.sin(t.al(Math.PI-s-p,.01,Math.PI-.01)),h=Math.min(l,m);this._helper._farZ=1.01*(Math.cos(Math.PI/2-n)*h+o),this._helper._nearZ=this._helper._height/50}_calcMatrices(){if(!this._helper._height)return;let e=this.centerOffset,n=Fe(this.worldSize,this.center),r=n.x,i=n.y;this._helper._pixelPerMeter=t.aq(1,this.center.lat)*this.worldSize;let a=t.an(Math.min(this.pitch,Pe)),o=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(a)),s;var c,l;this._calculateNearFarZIfNeeded(o,a,e),s=new Float64Array(16),t.bc(s,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),(c=this._invProjMatrix)[0]=1/(l=s)[0],c[1]=0,c[2]=0,c[3]=0,c[4]=0,c[5]=1/l[5],c[6]=0,c[7]=0,c[8]=0,c[9]=0,c[10]=0,c[11]=1/l[14],c[12]=0,c[13]=0,c[14]=-1,c[15]=l[10]/l[14],s[8]=2*-e.x/this._helper._width,s[9]=2*e.y/this._helper._height,this._projectionMatrix=t.bd(s),t.S(s,s,[1,-1,1]),t.Q(s,s,[0,0,-this._helper.cameraToCenterDistance]),t.be(s,s,-this.rollInRadians),t.bf(s,s,this.pitchInRadians),t.be(s,s,-this.bearingInRadians),t.Q(s,s,[-r,-i,0]),this._mercatorMatrix=t.S([],s,[this.worldSize,this.worldSize,this.worldSize]),t.S(s,s,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=t.U(new Float64Array(16),this.clipSpaceToPixelsMatrix,s),t.Q(s,s,[0,0,-this.elevation]),this._viewProjMatrix=s,this._invViewProjMatrix=t.bg([],s);let u=[0,0,-1,1];t.aE(u,u,this._invViewProjMatrix),this._cameraPosition=[u[0]/u[3],u[1]/u[3],u[2]/u[3]],this._fogMatrix=new Float64Array(16),t.bc(this._fogMatrix,this.fovInRadians,this.width/this.height,o,this._helper._farZ),this._fogMatrix[8]=2*-e.x/this.width,this._fogMatrix[9]=2*e.y/this.height,t.S(this._fogMatrix,this._fogMatrix,[1,-1,1]),t.Q(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),t.be(this._fogMatrix,this._fogMatrix,-this.rollInRadians),t.bf(this._fogMatrix,this._fogMatrix,this.pitchInRadians),t.be(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),t.Q(this._fogMatrix,this._fogMatrix,[-r,-i,0]),t.S(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),t.Q(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=t.U(new Float64Array(16),this.clipSpaceToPixelsMatrix,s);let d=this._helper._width%2/2,f=this._helper._height%2/2,p=Math.cos(this.bearingInRadians),m=Math.sin(-this.bearingInRadians),h=r-Math.round(r)+p*d+m*f,g=i-Math.round(i)+p*f+m*d,_=new Float64Array(s);if(t.Q(_,_,[h>.5?h-1:h,g>.5?g-1:g,0]),this._alignedProjMatrix=_,s=t.bg(new Float64Array(16),this._pixelMatrix),!s)throw Error(`failed to invert matrix`);this._pixelMatrixInverse=s,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;let e=this.screenPointToMercatorCoordinate(new t.P(0,0)),n=[e.x*this.worldSize,e.y*this.worldSize,0,1];return t.aE(n,n,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){let e=t.aq(1,this.center.lat)*this.worldSize;return ze(this.center,this.elevation,this.pitch,this.bearing,this._helper.cameraToCenterDistance/e).toLngLat()}lngLatToCameraDepth(e,n){let r=t.a7.fromLngLat(e),i=[r.x*this.worldSize,r.y*this.worldSize,n,1];return t.aE(i,i,this._viewProjMatrix),i[2]/i[3]}getProjectionData(e){let{overscaledTileID:n,aligned:r,applyTerrainMatrix:i}=e,a=this._helper.getMercatorTileCoordinates(n),o=n?this.calculatePosMatrix(n,r,!0):null,s;return s=n?.terrainRttPosMatrix32f&&i?n.terrainRttPosMatrix32f:o||t.bh(),{mainMatrix:s,tileMercatorCoords:a,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:s}}isLocationOccluded(e){return!1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(e,t,n){return 1}transformLightDirection(e){return t.a$(e)}getRayDirectionFromPixel(e){throw Error(`Not implemented.`)}projectTileCoordinates(e,n,r,i){let a=this.calculatePosMatrix(r),o;i?(o=[e,n,i(e,n),1],t.aE(o,o,a)):(o=[e,n,0,1],wt(o,o,a));let s=o[3];return{point:new t.P(o[0]/s,o[1]/s),signedDistanceFromCamera:s,isOccluded:!1}}populateCache(e){for(let t of e)this.calculatePosMatrix(t)}getMatrixForModel(e,n){let r=t.a7.fromLngLat(e,n),i=r.meterInMercatorCoordinateUnits(),a=t.bi();return t.Q(a,a,[r.x,r.y,r.z]),t.be(a,a,Math.PI),t.bf(a,a,Math.PI/2),t.S(a,a,[-i,i,i]),a}getProjectionDataForCustomLayer(e=!0){let n=new t.a3(0,0,0,0,0),r=this.getProjectionData({overscaledTileID:n,applyGlobeMatrix:e}),i=Re(n,this.worldSize);t.U(i,this._viewProjMatrix,i),r.tileMercatorCoords=[0,0,1,1];let a=[t.a6,t.a6,this.worldSize/this._helper.pixelsPerMeter],o=t.bj();return t.S(o,i,a),r.fallbackMatrix=o,r.mainMatrix=o,r}getFastPathSimpleProjectionMatrix(e){return this.calculatePosMatrix(e)}}function un(){t.w(`Map cannot fit within canvas with the given bounds, padding, and/or offset.`)}function dn(e){if(e.useSlerp)if(e.k<1){let n=t.bk(e.startEulerAngles.roll,e.startEulerAngles.pitch,e.startEulerAngles.bearing),r=t.bk(e.endEulerAngles.roll,e.endEulerAngles.pitch,e.endEulerAngles.bearing),i=new Float64Array(4);t.bl(i,n,r,e.k);let a=t.bm(i);e.tr.setRoll(a.roll),e.tr.setPitch(a.pitch),e.tr.setBearing(a.bearing)}else e.tr.setRoll(e.endEulerAngles.roll),e.tr.setPitch(e.endEulerAngles.pitch),e.tr.setBearing(e.endEulerAngles.bearing);else e.tr.setRoll(t.H.number(e.startEulerAngles.roll,e.endEulerAngles.roll,e.k)),e.tr.setPitch(t.H.number(e.startEulerAngles.pitch,e.endEulerAngles.pitch,e.k)),e.tr.setBearing(t.H.number(e.startEulerAngles.bearing,e.endEulerAngles.bearing,e.k))}function fn(e,n,r,i,a){let o=a.padding,s=Fe(a.worldSize,r.getNorthWest()),c=Fe(a.worldSize,r.getNorthEast()),l=Fe(a.worldSize,r.getSouthEast()),u=Fe(a.worldSize,r.getSouthWest()),d=t.an(-i),f=s.rotate(d),p=c.rotate(d),m=l.rotate(d),h=u.rotate(d),g=new t.P(Math.max(f.x,p.x,h.x,m.x),Math.max(f.y,p.y,h.y,m.y)),_=new t.P(Math.min(f.x,p.x,h.x,m.x),Math.min(f.y,p.y,h.y,m.y)),v=g.sub(_),y=(a.width-(o.left+o.right+n.left+n.right))/v.x,b=(a.height-(o.top+o.bottom+n.top+n.bottom))/v.y;if(b<0||y<0)return void un();let x=Math.min(t.ar(a.scale*Math.min(y,b)),e.maxZoom),S=t.P.convert(e.offset),C=new t.P((n.left-n.right)/2,(n.top-n.bottom)/2).rotate(t.an(i)),w=S.add(C).mult(a.scale/t.ao(x));return{center:Ie(a.worldSize,s.add(l).div(2).sub(w)),zoom:x,bearing:i}}class pn{get useGlobeControls(){return!1}handlePanInertia(e,t){let n=e.mag(),r=Math.abs(Le(t));return{easingOffset:e.mult(Math.min(.75*r/n,1)),easingCenter:t.center}}handleMapControlsRollPitchBearingZoom(e,t){e.bearingDelta&&t.setBearing(t.bearing+e.bearingDelta),e.pitchDelta&&t.setPitch(t.pitch+e.pitchDelta),e.rollDelta&&t.setRoll(t.roll+e.rollDelta),e.zoomDelta&&t.setZoom(t.zoom+e.zoomDelta)}handleMapControlsPan(e,t,n){e.around.distSqr(t.centerPoint)<.01||t.setLocationAtPoint(n,e.around)}cameraForBoxAndBearing(e,t,n,r,i){return fn(e,t,n,r,i)}handleJumpToCenterZoom(e,n){e.zoom!==(n.zoom===void 0?e.zoom:+n.zoom)&&e.setZoom(+n.zoom),n.center!==void 0&&e.setCenter(t.W.convert(n.center))}handleEaseTo(e,n){let r=e.zoom,i=e.padding,a={roll:e.roll,pitch:e.pitch,bearing:e.bearing},o={roll:n.roll===void 0?e.roll:n.roll,pitch:n.pitch===void 0?e.pitch:n.pitch,bearing:n.bearing===void 0?e.bearing:n.bearing},s=n.zoom!==void 0,c=!e.isPaddingEqual(n.padding),l=!1,u=s?+n.zoom:e.zoom,d=e.centerPoint.add(n.offsetAsPoint),f=e.screenPointToLocation(d),{center:p,zoom:m}=e.applyConstrain(t.W.convert(n.center||f),u??r);nn(e,p);let h=Fe(e.worldSize,f),g=Fe(e.worldSize,p).sub(h),_=t.ao(m-r);return l=m!==r,{easeFunc:s=>{if(l&&e.setZoom(t.H.number(r,m,s)),t.bn(a,o)||dn({startEulerAngles:a,endEulerAngles:o,tr:e,k:s,useSlerp:a.roll!=o.roll}),c&&(e.interpolatePadding(i,n.padding,s),d=e.centerPoint.add(n.offsetAsPoint)),n.around)e.setLocationAtPoint(n.around,n.aroundPoint);else{let n=t.ao(e.zoom-r),i=(m>r?Math.min(2,_):Math.max(.5,_))**(1-s),a=Ie(e.worldSize,h.add(g.mult(s*i)).mult(n));e.setLocationAtPoint(e.renderWorldCopies?a.wrap():a,d)}},isZooming:l,elevationCenter:p}}handleFlyTo(e,n){let r=n.zoom!==void 0,i=e.zoom,a=e.applyConstrain(t.W.convert(n.center||n.locationAtOffset),r?+n.zoom:i),o=a.center,s=a.zoom;nn(e,o);let c=Fe(e.worldSize,n.locationAtOffset),l=Fe(e.worldSize,o).sub(c),u=l.mag(),d=t.ao(s-i),f;if(n.minZoom!==void 0){let r=Math.min(+n.minZoom,i,s),a=e.applyConstrain(o,r).zoom;f=t.ao(a-i)}return{easeFunc:(n,r,a,u)=>{e.setZoom(n===1?s:i+t.ar(r));let d=n===1?o:Ie(e.worldSize,c.add(l.mult(a)).mult(r));e.setLocationAtPoint(e.renderWorldCopies?d.wrap():d,u)},scaleOfZoom:d,targetCenter:o,scaleOfMinZoom:f,pixelPathLength:u}}}class mn{constructor(e,t,n){this.blendFunction=e,this.blendColor=t,this.mask=n}}mn.Replace=[1,0],mn.disabled=new mn(mn.Replace,t.bo.transparent,[!1,!1,!1,!1]),mn.unblended=new mn(mn.Replace,t.bo.transparent,[!0,!0,!0,!0]),mn.alphaBlended=new mn([1,771],t.bo.transparent,[!0,!0,!0,!0]);let hn=2305;class gn{constructor(e,t,n){this.enable=e,this.mode=t,this.frontFace=n}}gn.disabled=new gn(!1,1029,hn),gn.backCCW=new gn(!0,1029,hn),gn.frontCCW=new gn(!0,1028,hn);class _n{constructor(e,t,n){this.func=e,this.mask=t,this.range=n}}_n.ReadOnly=!1,_n.ReadWrite=!0,_n.disabled=new _n(519,_n.ReadOnly,[0,1]);let vn=7680;class yn{constructor(e,t,n,r,i,a){this.test=e,this.ref=t,this.mask=n,this.fail=r,this.depthFail=i,this.pass=a}}function bn(e){return typeof WebGL2RenderingContext<`u`&&e instanceof WebGL2RenderingContext}yn.disabled=new yn({func:519,mask:0},0,0,vn,vn,vn);class xn{get awaitingQuery(){return!!this._readbackQueue}constructor(e){this._readbackWaitFrames=4,this._measureWaitFrames=6,this._texWidth=1,this._texHeight=1,this._measuredError=0,this._updateCount=0,this._lastReadbackFrame=-1e3,this._readbackQueue=null,this._cachedRenderContext=e;let n=e.context,r=n.gl;this._texFormat=r.RGBA,this._texType=r.UNSIGNED_BYTE;let i=new t.aU;i.emplaceBack(-1,-1),i.emplaceBack(2,-1),i.emplaceBack(-1,2);let a=new t.aW;a.emplaceBack(0,1,2),this._fullscreenTriangle=new Xt(n.createVertexBuffer(i,Zt.members),n.createIndexBuffer(a),t.aV.simpleSegment(0,0,i.length,a.length)),this._resultBuffer=new Uint8Array(4),n.activeTexture.set(r.TEXTURE1);let o=r.createTexture();r.bindTexture(r.TEXTURE_2D,o),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST),r.texImage2D(r.TEXTURE_2D,0,this._texFormat,this._texWidth,this._texHeight,0,this._texFormat,this._texType,null),this._fbo=n.createFramebuffer(this._texWidth,this._texHeight,!1,!1),this._fbo.colorAttachment.set(o),bn(r)&&(this._pbo=r.createBuffer(),r.bindBuffer(r.PIXEL_PACK_BUFFER,this._pbo),r.bufferData(r.PIXEL_PACK_BUFFER,4,r.STREAM_READ),r.bindBuffer(r.PIXEL_PACK_BUFFER,null))}destroy(){let e=this._cachedRenderContext.context.gl;this._fullscreenTriangle.destroy(),this._fbo.destroy(),e.deleteBuffer(this._pbo),this._fullscreenTriangle=null,this._fbo=null,this._pbo=null,this._resultBuffer=null}updateErrorLoop(e,t){let n=this._updateCount;return this._readbackQueue?n>=this._readbackQueue.frameNumberIssued+this._readbackWaitFrames&&this._tryReadback():n>=this._lastReadbackFrame+this._measureWaitFrames&&this._renderErrorTexture(e,t),this._updateCount++,this._measuredError}_bindFramebuffer(){let e=this._cachedRenderContext.context,t=e.gl;e.activeTexture.set(t.TEXTURE1),t.bindTexture(t.TEXTURE_2D,this._fbo.colorAttachment.get()),e.bindFramebuffer.set(this._fbo.framebuffer)}_renderErrorTexture(e,n){let r=this._cachedRenderContext.context,i=r.gl;if(this._bindFramebuffer(),r.viewport.set([0,0,this._texWidth,this._texHeight]),r.clear({color:t.bo.transparent}),this._cachedRenderContext.useProgram(`projectionErrorMeasurement`).draw(r,i.TRIANGLES,_n.disabled,yn.disabled,mn.unblended,gn.disabled,((e,t)=>({u_input:e,u_output_expected:t}))(e,n),null,null,`$clipping`,this._fullscreenTriangle.vertexBuffer,this._fullscreenTriangle.indexBuffer,this._fullscreenTriangle.segments),this._pbo&&bn(i)){i.bindBuffer(i.PIXEL_PACK_BUFFER,this._pbo),i.readBuffer(i.COLOR_ATTACHMENT0),i.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,0),i.bindBuffer(i.PIXEL_PACK_BUFFER,null);let e=i.fenceSync(i.SYNC_GPU_COMMANDS_COMPLETE,0);i.flush(),this._readbackQueue={frameNumberIssued:this._updateCount,sync:e}}else this._readbackQueue={frameNumberIssued:this._updateCount,sync:null}}_tryReadback(){let e=this._cachedRenderContext.context.gl;if(this._pbo&&this._readbackQueue&&bn(e)){let n=e.clientWaitSync(this._readbackQueue.sync,0,0);if(n===e.WAIT_FAILED)return t.w(`WebGL2 clientWaitSync failed.`),this._readbackQueue=null,void(this._lastReadbackFrame=this._updateCount);if(n===e.TIMEOUT_EXPIRED)return;e.bindBuffer(e.PIXEL_PACK_BUFFER,this._pbo),e.getBufferSubData(e.PIXEL_PACK_BUFFER,0,this._resultBuffer,0,4),e.bindBuffer(e.PIXEL_PACK_BUFFER,null)}else this._bindFramebuffer(),e.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,this._resultBuffer);this._readbackQueue=null,this._measuredError=xn._parseRGBA8float(this._resultBuffer),this._lastReadbackFrame=this._updateCount}static _parseRGBA8float(e){let t=0;return t+=e[0]/256,t+=e[1]/65536,t+=e[2]/16777216,e[3]<127&&(t=-t),t/128}}let Sn=t.a6/128;function Cn(e,n){let r=e.granularity===void 0?1:Math.max(e.granularity,1),i=r+(e.generateBorders?2:0),a=r+(e.extendToNorthPole||e.generateBorders?1:0)+(e.extendToSouthPole||e.generateBorders?1:0),o=i+1,s=a+1,c=e.generateBorders?-1:0,l=e.generateBorders||e.extendToNorthPole?-1:0,u=r+ +!!e.generateBorders,d=r+(e.generateBorders||e.extendToSouthPole?1:0),f=o*s,p=i*a*6,m=o*s>65536;if(m&&n===`16bit`)throw Error(`Granularity is too large and meshes would not fit inside 16 bit vertex indices.`);let h=m||n===`32bit`,g=new Int16Array(2*f),_=0;for(let n=l;n<=d;n++)for(let i=c;i<=u;i++){let a=i/r*t.a6;i===-1&&(a=-Sn),i===r+1&&(a=t.a6+Sn);let o=n/r*t.a6;n===-1&&(o=e.extendToNorthPole?t.bq:-Sn),n===r+1&&(o=e.extendToSouthPole?t.br:t.a6+Sn),g[_++]=a,g[_++]=o}let v=h?new Uint32Array(p):new Uint16Array(p),y=0;for(let e=0;e<a;e++)for(let t=0;t<i;t++){let n=t+1+e*o,r=t+(e+1)*o,i=t+1+(e+1)*o;v[y++]=t+e*o,v[y++]=r,v[y++]=n,v[y++]=n,v[y++]=r,v[y++]=i}return{vertices:g.buffer.slice(0),indices:v.buffer.slice(0),uses32bitIndices:h}}let wn=new t.aT({fill:new t.bs(128,2),line:new t.bs(512,0),tile:new t.bs(128,32),stencil:new t.bs(128,1),circle:3});class Tn{constructor(){this._tileMeshCache={},this._errorCorrectionUsable=0,this._errorMeasurementLastValue=0,this._errorCorrectionPreviousValue=0,this._errorMeasurementLastChangeTime=-1e3}get name(){return`vertical-perspective`}get transitionState(){return 1}get useSubdivision(){return!0}get shaderVariantName(){return`globe`}get shaderDefine(){return`#define GLOBE`}get shaderPreludeCode(){return Jt.projectionGlobe}get vertexShaderPreludeCode(){return Jt.projectionMercator.vertexSource}get subdivisionGranularity(){return wn}get useGlobeControls(){return!0}get latitudeErrorCorrectionRadians(){return this._errorCorrectionUsable}destroy(){this._errorMeasurement&&this._errorMeasurement.destroy()}updateGPUdependent(e){this._errorMeasurement||=new xn(e);let n=t.Y(this._errorQueryLatitudeDegrees),r=2*Math.atan(Math.exp(Math.PI-n*Math.PI*2))-.5*Math.PI,i=this._errorMeasurement.updateErrorLoop(n,r),a=l();i!==this._errorMeasurementLastValue&&(this._errorCorrectionPreviousValue=this._errorCorrectionUsable,this._errorMeasurementLastValue=i,this._errorMeasurementLastChangeTime=a);let o=Math.min(Math.max((a-this._errorMeasurementLastChangeTime)/1e3/.5,0),1);this._errorCorrectionUsable=t.bt(this._errorCorrectionPreviousValue,-this._errorMeasurementLastValue,t.bu(o))}_getMeshKey(e){return`${e.granularity.toString(36)}_${e.generateBorders?`b`:``}${e.extendToNorthPole?`n`:``}${e.extendToSouthPole?`s`:``}`}getMeshFromTileID(e,t,n,r,i){let a=(i===`stencil`?wn.stencil:wn.tile).getGranularityForZoomLevel(t.z);return this._getMesh(e,{granularity:a,generateBorders:n,extendToNorthPole:t.y===0&&r,extendToSouthPole:t.y===(1<<t.z)-1&&r})}_getMesh(e,n){let r=this._getMeshKey(n);if(r in this._tileMeshCache)return this._tileMeshCache[r];let i=function(e,n){let r=Cn(n,`16bit`),i=t.aU.deserialize({arrayBuffer:r.vertices,length:r.vertices.byteLength/2/2}),a=t.aW.deserialize({arrayBuffer:r.indices,length:r.indices.byteLength/2/3});return new Xt(e.createVertexBuffer(i,Zt.members),e.createIndexBuffer(a),t.aV.simpleSegment(0,0,i.length,a.length))}(e,n);return this._tileMeshCache[r]=i,i}recalculate(e){}hasTransition(){let e=l(),t=!1;return t||=(e-this._errorMeasurementLastChangeTime)/1e3<.7,t||=this._errorMeasurement?.awaitingQuery,t}setErrorQueryLatitudeDegrees(e){this._errorQueryLatitudeDegrees=e}}let En=new t.u({type:new t.D(t.x.projection.type)});class Dn extends t.E{constructor(e){super(),this._transitionable=new t.y(En,void 0),this.setProjection(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new t.J(0)),this._mercatorProjection=new en,this._verticalPerspectiveProjection=new Tn}get transitionState(){let e=this.properties.get(`type`);if(typeof e==`string`&&e===`mercator`)return 0;if(typeof e==`string`&&e===`vertical-perspective`)return 1;if(e instanceof t.bv){if(e.from===`vertical-perspective`&&e.to===`mercator`)return 1-e.transition;if(e.from===`mercator`&&e.to===`vertical-perspective`)return e.transition}return 1}get useGlobeRendering(){return this.transitionState>0}get latitudeErrorCorrectionRadians(){return this._verticalPerspectiveProjection.latitudeErrorCorrectionRadians}get currentProjection(){return this.useGlobeRendering?this._verticalPerspectiveProjection:this._mercatorProjection}get name(){return`globe`}get useSubdivision(){return this.currentProjection.useSubdivision}get shaderVariantName(){return this.currentProjection.shaderVariantName}get shaderDefine(){return this.currentProjection.shaderDefine}get shaderPreludeCode(){return this.currentProjection.shaderPreludeCode}get vertexShaderPreludeCode(){return this.currentProjection.vertexShaderPreludeCode}get subdivisionGranularity(){return this.currentProjection.subdivisionGranularity}get useGlobeControls(){return this.transitionState>0}destroy(){this._mercatorProjection.destroy(),this._verticalPerspectiveProjection.destroy()}updateGPUdependent(e){this._mercatorProjection.updateGPUdependent(e),this._verticalPerspectiveProjection.updateGPUdependent(e)}getMeshFromTileID(e,t,n,r,i){return this.currentProjection.getMeshFromTileID(e,t,n,r,i)}setProjection(e){this._transitionable.setValue(`type`,e?.type||`mercator`)}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()||this.currentProjection.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}setErrorQueryLatitudeDegrees(e){this._verticalPerspectiveProjection.setErrorQueryLatitudeDegrees(e),this._mercatorProjection.setErrorQueryLatitudeDegrees(e)}}function On(e){let t=jn(e.worldSize,e.center.lat);return 2*Math.PI*t}function kn(e,n,r,i,a){let o=1/(1<<a),s=n/t.a6*o+i*o,c=t.by((e/t.a6*o+r*o)*Math.PI*2+Math.PI,2*Math.PI),l=2*Math.atan(Math.exp(Math.PI-s*Math.PI*2))-.5*Math.PI,u=Math.cos(l),d=new Float64Array(3);return d[0]=Math.sin(c)*u,d[1]=Math.sin(l),d[2]=Math.cos(c)*u,d}function An(e){return function(e,t){let n=Math.cos(t),r=new Float64Array(3);return r[0]=Math.sin(e)*n,r[1]=Math.sin(t),r[2]=Math.cos(e)*n,r}(e.lng*Math.PI/180,e.lat*Math.PI/180)}function jn(e,t){return e/(2*Math.PI)/Math.cos(t*Math.PI/180)}function Mn(e){let n=Math.asin(e[1])/Math.PI*180,r=Math.sqrt(e[0]*e[0]+e[2]*e[2]);if(r>1e-6){let i=e[0]/r,a=Math.acos(e[2]/r),o=(i>0?a:-a)/Math.PI*180;return new t.W(t.X(o,-180,180),n)}return new t.W(0,n)}function Nn(e){return Math.cos(e*Math.PI/180)}function Pn(e,n){let r=Nn(e),i=Nn(n);return t.ar(i/r)}function Fn(e,n){let r=e.rotate(n.bearingInRadians),i=n.zoom+Pn(n.center.lat,0),a=t.bt(1/Nn(n.center.lat),1/Nn(Math.min(Math.abs(n.center.lat),60)),t.bw(i,7,3,0,1)),o=360/On({worldSize:n.worldSize,center:{lat:n.center.lat}});return new t.W(n.center.lng-r.x*o*a,t.al(n.center.lat+r.y*o,-t.am,t.am))}function In(e){let t=.5*e,n=Math.sin(t),r=Math.cos(t);return Math.log(n+r)-Math.log(r-n)}function Ln(e,n,r,i){let a=e.lat+r*i;if(Math.abs(r)>1){let o=(Math.sign(e.lat+r)===Math.sign(e.lat)?Math.abs(e.lat):-Math.abs(e.lat))*Math.PI/180,s=Math.abs(e.lat+r)*Math.PI/180,c=In(o+i*(s-o)),l=In(o),u=In(s);return new t.W(e.lng+n*((c-l)/(u-l)),a)}return new t.W(e.lng+n*i,a)}class Rn{constructor(e){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._boundingVolumeFactory=e}swapBuffers(){if(!this._hadAnyChanges)return;let e=this._cachePrevious;this._cachePrevious=this._cache,this._cache=e,this._cache.clear(),this._hadAnyChanges=!1}getTileBoundingVolume(e,t,n,r){let i=`${e.z}_${e.x}_${e.y}_${r?.terrain?`t`:``}`,a=this._cache.get(i);if(a)return a;let o=this._cachePrevious.get(i);if(o)return this._cache.set(i,o),o;let s=this._boundingVolumeFactory(e,t,n,r);return this._cache.set(i,s),this._hadAnyChanges=!0,s}}class zn{constructor(e,t,n,r){this.min=n,this.max=r,this.points=e,this.planes=t}static fromAabb(e,t){let n=[];for(let r=0;r<8;r++)n.push([1&~r?e[0]:t[0],(r>>1&1)==1?t[1]:e[1],(r>>2&1)==1?t[2]:e[2]]);return new zn(n,[[-1,0,0,t[0]],[1,0,0,-e[0]],[0,-1,0,t[1]],[0,1,0,-e[1]],[0,0,-1,t[2]],[0,0,1,-e[2]]],e,t)}static fromCenterSizeAngles(e,n,r){let i=t.bA([],r[0],r[1],r[2]),a=t.bB([],[n[0],0,0],i),o=t.bB([],[0,n[1],0],i),s=t.bB([],[0,0,n[2]],i),c=[...e],l=[...e];for(let t=0;t<8;t++)for(let n=0;n<3;n++){let r=e[n]+a[n]*(1&~t?-1:1)+o[n]*((t>>1&1)==1?1:-1)+s[n]*((t>>2&1)==1?1:-1);c[n]=Math.min(c[n],r),l[n]=Math.max(l[n],r)}let u=[];for(let n=0;n<8;n++){let r=[...e];t.a_(r,r,t.aZ([],a,1&~n?-1:1)),t.a_(r,r,t.aZ([],o,(n>>1&1)==1?1:-1)),t.a_(r,r,t.aZ([],s,(n>>2&1)==1?1:-1)),u.push(r)}return new zn(u,[[...a,-t.b3(a,u[0])],[...o,-t.b3(o,u[0])],[...s,-t.b3(s,u[0])],[-a[0],-a[1],-a[2],-t.b3(a,u[7])],[-o[0],-o[1],-o[2],-t.b3(o,u[7])],[-s[0],-s[1],-s[2],-t.b3(s,u[7])]],c,l)}intersectsFrustum(e){let t=!0,n=this.points.length,r=this.planes.length,i=e.planes.length,a=e.points.length;for(let r=0;r<i;r++){let i=e.planes[r],a=0;for(let e=0;e<n;e++){let t=this.points[e];i[0]*t[0]+i[1]*t[1]+i[2]*t[2]+i[3]>=0&&a++}if(a===0)return 0;a<n&&(t=!1)}if(t)return 2;for(let t=0;t<r;t++){let n=this.planes[t],r=0;for(let t=0;t<a;t++){let i=e.points[t];n[0]*i[0]+n[1]*i[1]+n[2]*i[2]+n[3]>=0&&r++}if(r===0)return 0}return 1}intersectsPlane(e){let t=this.points.length,n=0;for(let r=0;r<t;r++){let t=this.points[r];e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]>=0&&n++}return n===t?2:n===0?0:1}}function Bn(e,t,n){let r=e-t;return r<0?-r:Math.max(0,r-n)}function Vn(e,t,n,r,i){let a=e-n,o;return o=a<0?Math.min(-a,1+a-i):a>i?Math.min(Math.max(a-i,0),1-a):0,Math.max(o,Bn(t,r,i))}class Hn{constructor(){this._boundingVolumeCache=new Rn(this._computeTileBoundingVolume)}prepareNextFrame(){this._boundingVolumeCache.swapBuffers()}distanceToTile2d(e,t,n,r){let i=1<<n.z,a=1/i,o=n.x/i,s=n.y/i,c=2;return c=Math.min(c,Vn(e,t,o,s,a)),c=Math.min(c,Vn(e,t,o+.5,-s-a,a)),c=Math.min(c,Vn(e,t,o+.5,2-s-a,a)),c}getWrap(e,t,n){let r=1<<t.z,i=1/r,a=t.x/r,o=Bn(e.x,a,i),s=Bn(e.x,a-1,i),c=Bn(e.x,a+1,i),l=Math.min(o,s,c);return l===c?1:l===s?-1:0}allowVariableZoom(e,t){return We(e,t)>4}allowWorldCopies(){return!1}getTileBoundingVolume(e,t,n,r){return this._boundingVolumeCache.getTileBoundingVolume(e,t,n,r)}_computeTileBoundingVolume(e,n,r,i){let a=0,o=0;if(i?.terrain){let s=new t.a3(e.z,n,e.z,e.x,e.y),c=i.terrain.getMinMaxElevation(s);a=c.minElevation??Math.min(0,r),o=c.maxElevation??Math.max(0,r)}if(a/=t.bD,o/=t.bD,a+=1,o+=1,e.z<=0)return zn.fromAabb([-o,-o,-o],[o,o,o]);if(e.z===1)return zn.fromAabb([e.x===0?-o:0,e.y===0?0:-o,-o],[e.x===0?0:o,e.y===0?o:0,o]);{let n=[kn(0,0,e.x,e.y,e.z),kn(t.a6,0,e.x,e.y,e.z),kn(t.a6,t.a6,e.x,e.y,e.z),kn(0,t.a6,e.x,e.y,e.z)],r=[];for(let e of n)r.push(t.aZ([],e,o));if(o!==a)for(let e of n)r.push(t.aZ([],e,a));e.y===0&&r.push([0,1,0]),e.y===(1<<e.z)-1&&r.push([0,-1,0]);let i=[1,1,1],s=[-1,-1,-1];for(let e of r)for(let t=0;t<3;t++)i[t]=Math.min(i[t],e[t]),s[t]=Math.max(s[t],e[t]);let c=kn(t.a6/2,t.a6/2,e.x,e.y,e.z),l=t.b2([],[0,1,0],c);t.b1(l,l);let u=t.b2([],c,l);t.b1(u,u);let d=t.b2([],n[2],n[1]);t.b1(d,d);let f=t.b2([],n[0],n[3]);t.b1(f,f),r.push(t.aZ([],c,o)),e.y>=(1<<e.z)/2&&r.push(t.aZ([],kn(t.a6/2,0,e.x,e.y,e.z),o)),e.y<(1<<e.z)/2&&r.push(t.aZ([],kn(t.a6/2,t.a6,e.x,e.y,e.z),o));let p=Un(c,r),m=Un(u,r),h=[-c[0],-c[1],-c[2],p.max],g=[c[0],c[1],c[2],-p.min],_=[-u[0],-u[1],-u[2],m.max],v=[u[0],u[1],u[2],-m.min],y=[...d,0],b=[...f,0],x=[];return e.y===0?x.push(t.bC(b,y,h),t.bC(b,y,g)):x.push(t.bC(_,y,h),t.bC(_,y,g),t.bC(_,b,h),t.bC(_,b,g)),e.y===(1<<e.z)-1?x.push(t.bC(b,y,h),t.bC(b,y,g)):x.push(t.bC(v,y,h),t.bC(v,y,g),t.bC(v,b,h),t.bC(v,b,g)),new zn(x,[h,g,_,v,y,b],i,s)}}}function Un(e,n){let r=1/0,i=-1/0;for(let a of n){let n=t.b3(e,a);r=Math.min(r,n),i=Math.max(i,n)}return{min:r,max:i}}class Wn{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,t,n){this._helper.interpolatePadding(e,t,n)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,t){this._helper.resize(e,t)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}setConstrainOverride(e){this._helper.setConstrainOverride(e)}overrideNearFarZ(e,t){this._helper.overrideNearFarZ(e,t)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(e){}constructor(e){this._cachedClippingPlane=t.bE(),this._projectionMatrix=t.bi(),this._globeViewProjMatrix32f=t.bh(),this._globeViewProjMatrixNoCorrection=t.bi(),this._globeViewProjMatrixNoCorrectionInverted=t.bi(),this._globeProjMatrixInverted=t.bi(),this._cameraPosition=t.bz(),this._globeLatitudeErrorCorrectionRadians=0,this.defaultConstrain=(e,n)=>{let r=t.al(e.lat,-t.am,t.am),i=t.al(+n,this.minZoom+Pn(0,r),this.maxZoom);return{center:new t.W(e.lng,r),zoom:i}},this.applyConstrain=(e,t)=>this._helper.applyConstrain(e,t),this._helper=new an({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(e,t)=>this.defaultConstrain(e,t)},e),this._coveringTilesDetailsProvider=new Hn}clone(){let e=new Wn;return e.apply(this,!1),e}apply(e,t,n){this._globeLatitudeErrorCorrectionRadians=n||0,this._helper.apply(e,t)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixNoCorrection}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){let e=t.bz();return e[0]=this._cameraPosition[0],e[1]=this._cameraPosition[1],e[2]=this._cameraPosition[2],e}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}getProjectionData(e){let{overscaledTileID:t,applyGlobeMatrix:n}=e,r=this._helper.getMercatorTileCoordinates(t);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:r,clippingPlane:this._cachedClippingPlane,projectionTransition:+!!n,fallbackMatrix:this._globeViewProjMatrix32f}}_computeClippingPlane(e){let n=this.pitchInRadians,r=this.cameraToCenterDistance/e,i=Math.sin(n)*r,a=Math.cos(n)*r+1,o=1/Math.sqrt(i*i+a*a)*1,s=-i,c=a,l=Math.sqrt(s*s+c*c);s/=l,c/=l;let u=[0,s,c];t.bF(u,u,[0,0,0],-this.bearingInRadians),t.bG(u,u,[0,0,0],-1*this.center.lat*Math.PI/180),t.bH(u,u,[0,0,0],this.center.lng*Math.PI/180);let d=1/t.b5(u);return t.aZ(u,u,d),[...u,-o*d]}isLocationOccluded(e){return!this.isSurfacePointVisible(An(e))}transformLightDirection(e){let n=this._helper._center.lng*Math.PI/180,r=this._helper._center.lat*Math.PI/180,i=Math.cos(r),a=[Math.sin(n)*i,Math.sin(r),Math.cos(n)*i],o=[a[2],0,-a[0]],s=[0,0,0];t.b2(s,o,a),t.b1(o,o),t.b1(s,s);let c=[0,0,0];return t.b1(c,[o[0]*e[0]+s[0]*e[1]+a[0]*e[2],o[1]*e[0]+s[1]*e[1]+a[1]*e[2],o[2]*e[0]+s[2]*e[1]+a[2]*e[2]]),c}getPixelScale(){return 1/Math.cos(this._helper._center.lat*Math.PI/180)}getCircleRadiusCorrection(){return Math.cos(this._helper._center.lat*Math.PI/180)}getPitchedTextCorrection(e,n,r){let i=function(e,n,r){let i=1/(1<<r.z);return new t.a7(e/t.a6*i+r.x*i,n/t.a6*i+r.y*i)}(e,n,r.canonical),a=(o=i.y,[t.by(i.x*Math.PI*2+Math.PI,2*Math.PI),2*Math.atan(Math.exp(Math.PI-o*Math.PI*2))-.5*Math.PI]);var o;return this.getCircleRadiusCorrection()/Math.cos(a[1])}projectTileCoordinates(e,n,r,i){let a=r.canonical,o=kn(e,n,a.x,a.y,a.z),s=1+(i?i(e,n):0)/t.bD,c=[o[0]*s,o[1]*s,o[2]*s,1];t.aE(c,c,this._globeViewProjMatrixNoCorrection);let l=this._cachedClippingPlane,u=l[0]*o[0]+l[1]*o[1]+l[2]*o[2]+l[3]<0;return{point:new t.P(c[0]/c[3],c[1]/c[3]),signedDistanceFromCamera:c[3],isOccluded:u}}_calcMatrices(){if(!this._helper._width||!this._helper._height)return;let e=jn(this.worldSize,this.center.lat),n=t.bj(),r=t.bj();this._helper.autoCalculateNearFarZ&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+2*e),t.bc(n,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);let i=this.centerOffset;n[8]=2*-i.x/this._helper._width,n[9]=2*i.y/this._helper._height,this._projectionMatrix=t.bd(n),this._globeProjMatrixInverted=t.bj(),t.bg(this._globeProjMatrixInverted,n),t.Q(n,n,[0,0,-this.cameraToCenterDistance]),t.be(n,n,this.rollInRadians),t.bf(n,n,-this.pitchInRadians),t.be(n,n,this.bearingInRadians),t.Q(n,n,[0,0,-e]);let a=t.bz();a[0]=e,a[1]=e,a[2]=e,t.bf(r,n,this.center.lat*Math.PI/180),t.bI(r,r,-this.center.lng*Math.PI/180),t.S(r,r,a),this._globeViewProjMatrixNoCorrection=r,t.bf(n,n,this.center.lat*Math.PI/180-this._globeLatitudeErrorCorrectionRadians),t.bI(n,n,-this.center.lng*Math.PI/180),t.S(n,n,a),this._globeViewProjMatrix32f=new Float32Array(n),this._globeViewProjMatrixNoCorrectionInverted=t.bj(),t.bg(this._globeViewProjMatrixNoCorrectionInverted,r);let o=t.bz();this._cameraPosition=t.bz(),this._cameraPosition[2]=this.cameraToCenterDistance/e,t.bF(this._cameraPosition,this._cameraPosition,o,-this.rollInRadians),t.bG(this._cameraPosition,this._cameraPosition,o,this.pitchInRadians),t.bF(this._cameraPosition,this._cameraPosition,o,-this.bearingInRadians),t.a_(this._cameraPosition,this._cameraPosition,[0,0,1]),t.bG(this._cameraPosition,this._cameraPosition,o,-this.center.lat*Math.PI/180),t.bH(this._cameraPosition,this._cameraPosition,o,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(e);let s=t.bd(this._globeViewProjMatrixNoCorrectionInverted);t.S(s,s,[1,1,-1]),this._cachedFrustum=cn.fromInvProjectionMatrix(s,1,0,this._cachedClippingPlane,!0)}calculateFogMatrix(e){t.w(`calculateFogMatrix is not supported on globe projection.`);let n=t.bj();return t.ap(n),n}getVisibleUnwrappedCoordinates(e){return[new t.ba(0,e)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(e){e&&t.w(`terrain is not fully supported on vertical perspective projection.`),this._helper.recalculateZoomAndCenter(0)}maxPitchScaleFactor(){return 1}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(e,n){if(!this._globeViewProjMatrixNoCorrection)return 1;let r=An(e);t.aZ(r,r,1+n/t.bD);let i=t.bE();return t.aE(i,[r[0],r[1],r[2],1],this._globeViewProjMatrixNoCorrection),i[2]/i[3]}populateCache(e){}getBounds(){let e=.5*this.width,n=.5*this.height,r=[new t.P(0,0),new t.P(e,0),new t.P(this.width,0),new t.P(this.width,n),new t.P(this.width,this.height),new t.P(e,this.height),new t.P(0,this.height),new t.P(0,n)],i=[];for(let e of r)i.push(this.unprojectScreenPoint(e));let a=0,o=0,s=0,c=0,l=this.center;for(let e of i){let n=t.bJ(l.lng,e.lng),r=t.bJ(l.lat,e.lat);n<o&&(o=n),n>a&&(a=n),r<c&&(c=r),r>s&&(s=r)}let u=[l.lng+o,l.lat+c,l.lng+a,l.lat+s];return this.isSurfacePointOnScreen([0,1,0])&&(u[3]=90,u[0]=-180,u[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(u[1]=-90,u[0]=-180,u[2]=180),new le(u)}calculateCenterFromCameraLngLatAlt(e,t,n,r){return this._helper.calculateCenterFromCameraLngLatAlt(e,t,n,r)}setLocationAtPoint(e,n){let r=An(this.unprojectScreenPoint(n)),i=An(e),a=t.bz();t.bK(a);let o=t.bz();t.bH(o,r,a,-this.center.lng*Math.PI/180),t.bG(o,o,a,this.center.lat*Math.PI/180);let s=i[0]*i[0]+i[2]*i[2],c=o[0]*o[0];if(s<c)return;let l=Math.sqrt(s-c),u=-l,d=t.bL(i[0],i[2],o[0],l),f=t.bL(i[0],i[2],o[0],u),p=t.bz();t.bH(p,i,a,-d);let m=t.bL(p[1],p[2],o[1],o[2]),h=t.bz();t.bH(h,i,a,-f);let g=t.bL(h[1],h[2],o[1],o[2]),_=.5*Math.PI,v=m>=-_&&m<=_,y=g>=-_&&g<=_,b,x;if(v&&y){let e=this.center.lng*Math.PI/180,n=this.center.lat*Math.PI/180;t.bM(d,e)+t.bM(m,n)<t.bM(f,e)+t.bM(g,n)?(b=d,x=m):(b=f,x=g)}else if(v)b=d,x=m;else{if(!y)return;b=f,x=g}let S=b/Math.PI*180,C=x/Math.PI*180,w=this.center.lat;this.setCenter(new t.W(S,t.al(C,-90,90))),this.setZoom(this.zoom+Pn(w,this.center.lat))}locationToScreenPoint(e,n){let r=An(e);if(n){let i=n.getElevationForLngLatZoom(e,this._helper._tileZoom);t.aZ(r,r,1+i/t.bD)}return this._projectSurfacePointToScreen(r)}_projectSurfacePointToScreen(e){let n=t.bE();return t.aE(n,[...e,1],this._globeViewProjMatrixNoCorrection),n[0]/=n[3],n[1]/=n[3],new t.P((.5*n[0]+.5)*this.width,(.5*-n[1]+.5)*this.height)}screenPointToMercatorCoordinate(e,n){if(n){let t=n.pointCoordinate(e);if(t)return t}return t.a7.fromLngLat(this.unprojectScreenPoint(e))}screenPointToLocation(e,t){return this.screenPointToMercatorCoordinate(e,t)?.toLngLat()}isPointOnMapSurface(e,t){let n=this._cameraPosition,r=this.getRayDirectionFromPixel(e);return!!this.rayPlanetIntersection(n,r)}getRayDirectionFromPixel(e){let n=t.bE();n[0]=e.x/this.width*2-1,n[1]=-1*(e.y/this.height*2-1),n[2]=1,n[3]=1,t.aE(n,n,this._globeViewProjMatrixNoCorrectionInverted),n[0]/=n[3],n[1]/=n[3],n[2]/=n[3];let r=t.bz();r[0]=n[0]-this._cameraPosition[0],r[1]=n[1]-this._cameraPosition[1],r[2]=n[2]-this._cameraPosition[2];let i=t.bz();return t.b1(i,r),i}isSurfacePointVisible(e){let t=this._cachedClippingPlane;return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]>=0}isSurfacePointOnScreen(e){if(!this.isSurfacePointVisible(e))return!1;let n=t.bE();return t.aE(n,[...e,1],this._globeViewProjMatrixNoCorrection),n[0]/=n[3],n[1]/=n[3],n[2]/=n[3],n[0]>-1&&n[0]<1&&n[1]>-1&&n[1]<1&&n[2]>-1&&n[2]<1}rayPlanetIntersection(e,n){let r=t.b3(e,n),i=t.bz(),a=t.bz();t.aZ(a,n,r),t.b0(i,e,a);let o=1-t.b3(i,i);if(o<0)return null;let s=t.b3(e,e)-1,c=-r+(r<0?1:-1)*Math.sqrt(o),l=s/c,u=c;return{tMin:Math.min(l,u),tMax:Math.max(l,u)}}unprojectScreenPoint(e){let n=this._cameraPosition,r=this.getRayDirectionFromPixel(e),i=this.rayPlanetIntersection(n,r);if(i){let e=t.bz();t.a_(e,n,[r[0]*i.tMin,r[1]*i.tMin,r[2]*i.tMin]);let a=t.bz();return t.b1(a,e),Mn(a)}let a=this._cachedClippingPlane,o=a[0]*r[0]+a[1]*r[1]+a[2]*r[2],s=-t.b9(a,n)/o,c=t.bz();if(s>0)t.a_(c,n,[r[0]*s,r[1]*s,r[2]*s]);else{let e=t.bz();t.a_(e,n,[2*r[0],2*r[1],2*r[2]]);let i=t.b9(this._cachedClippingPlane,e);t.b0(c,e,[this._cachedClippingPlane[0]*i,this._cachedClippingPlane[1]*i,this._cachedClippingPlane[2]*i])}let l=function(e){let n=t.bz();return n[0]=e[0]*-e[3],n[1]=e[1]*-e[3],n[2]=e[2]*-e[3],{center:n,radius:Math.sqrt(1-e[3]*e[3])}}(a);return Mn(function(e,n,r){let i=t.bz();t.b0(i,r,e);let a=t.bz();return t.bx(a,e,i,n/t.b7(i)),a}(l.center,l.radius,c))}getMatrixForModel(e,n){let r=t.W.convert(e),i=1/t.bD,a=t.bi();return t.bI(a,a,r.lng/180*Math.PI),t.bf(a,a,-r.lat/180*Math.PI),t.Q(a,a,[0,0,1+n/t.bD]),t.bf(a,a,.5*Math.PI),t.S(a,a,[i,i,i]),a}getProjectionDataForCustomLayer(e=!0){let n=this.getProjectionData({overscaledTileID:new t.a3(0,0,0,0,0),applyGlobeMatrix:e});return n.tileMercatorCoords=[0,0,1,1],n}getFastPathSimpleProjectionMatrix(e){}}class Gn{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,t,n){this._helper.interpolatePadding(e,t,n)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,t,n=!0){this._helper.resize(e,t,n)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}setConstrainOverride(e){this._helper.setConstrainOverride(e)}overrideNearFarZ(e,t){this._helper.overrideNearFarZ(e,t)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}get isGlobeRendering(){return this._globeness>0}setTransitionState(e,t){this._globeness=e,this._globeLatitudeErrorCorrectionRadians=t,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().prepareNextFrame(),this._mercatorTransform.getCoveringTilesDetailsProvider().prepareNextFrame()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}constructor(e){this._globeLatitudeErrorCorrectionRadians=0,this._globeness=1,this.defaultConstrain=(e,t)=>this.currentTransform.defaultConstrain(e,t),this.applyConstrain=(e,t)=>this._helper.applyConstrain(e,t),this._helper=new an({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(e,t)=>this.defaultConstrain(e,t)},e),this._globeness=1,this._mercatorTransform=new ln,this._verticalPerspectiveTransform=new Wn}clone(){let e=new Gn;return e._globeness=this._globeness,e._globeLatitudeErrorCorrectionRadians=this._globeLatitudeErrorCorrectionRadians,e.apply(this,!1),e}apply(e,t){this._helper.apply(e,t),this._mercatorTransform.apply(this,!1),this._verticalPerspectiveTransform.apply(this,!1,this._globeLatitudeErrorCorrectionRadians)}get projectionMatrix(){return this.currentTransform.projectionMatrix}get modelViewProjectionMatrix(){return this.currentTransform.modelViewProjectionMatrix}get inverseProjectionMatrix(){return this.currentTransform.inverseProjectionMatrix}get cameraPosition(){return this.currentTransform.cameraPosition}getProjectionData(e){let t=this._mercatorTransform.getProjectionData(e),n=this._verticalPerspectiveTransform.getProjectionData(e);return{mainMatrix:this.isGlobeRendering?n.mainMatrix:t.mainMatrix,clippingPlane:n.clippingPlane,tileMercatorCoords:n.tileMercatorCoords,projectionTransition:e.applyGlobeMatrix?this._globeness:0,fallbackMatrix:t.fallbackMatrix}}isLocationOccluded(e){return this.currentTransform.isLocationOccluded(e)}transformLightDirection(e){return this.currentTransform.transformLightDirection(e)}getPixelScale(){return t.bt(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return t.bt(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(e,n,r){let i=this._mercatorTransform.getPitchedTextCorrection(e,n,r),a=this._verticalPerspectiveTransform.getPitchedTextCorrection(e,n,r);return t.bt(i,a,this._globeness)}projectTileCoordinates(e,t,n,r){return this.currentTransform.projectTileCoordinates(e,t,n,r)}_calcMatrices(){this._helper._width&&this._helper._height&&(this._verticalPerspectiveTransform.apply(this,!1,this._globeLatitudeErrorCorrectionRadians),this._helper._nearZ=this._verticalPerspectiveTransform.nearZ,this._helper._farZ=this._verticalPerspectiveTransform.farZ,this._mercatorTransform.apply(this,!0,this.isGlobeRendering),this._helper._nearZ=this._mercatorTransform.nearZ,this._helper._farZ=this._mercatorTransform.farZ)}calculateFogMatrix(e){return this.currentTransform.calculateFogMatrix(e)}getVisibleUnwrappedCoordinates(e){return this.currentTransform.getVisibleUnwrappedCoordinates(e)}getCameraFrustum(){return this.currentTransform.getCameraFrustum()}getClippingPlane(){return this.currentTransform.getClippingPlane()}getCoveringTilesDetailsProvider(){return this.currentTransform.getCoveringTilesDetailsProvider()}recalculateZoomAndCenter(e){this._mercatorTransform.recalculateZoomAndCenter(e),this._verticalPerspectiveTransform.recalculateZoomAndCenter(e)}maxPitchScaleFactor(){return this._mercatorTransform.maxPitchScaleFactor()}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(e,t){return this.currentTransform.lngLatToCameraDepth(e,t)}populateCache(e){this._mercatorTransform.populateCache(e),this._verticalPerspectiveTransform.populateCache(e)}getBounds(){return this.currentTransform.getBounds()}calculateCenterFromCameraLngLatAlt(e,t,n,r){return this._helper.calculateCenterFromCameraLngLatAlt(e,t,n,r)}setLocationAtPoint(e,t){if(!this.isGlobeRendering)return this._mercatorTransform.setLocationAtPoint(e,t),void this.apply(this._mercatorTransform,!1);this._verticalPerspectiveTransform.setLocationAtPoint(e,t),this.apply(this._verticalPerspectiveTransform,!1)}locationToScreenPoint(e,t){return this.currentTransform.locationToScreenPoint(e,t)}screenPointToMercatorCoordinate(e,t){return this.currentTransform.screenPointToMercatorCoordinate(e,t)}screenPointToLocation(e,t){return this.currentTransform.screenPointToLocation(e,t)}isPointOnMapSurface(e,t){return this.currentTransform.isPointOnMapSurface(e,t)}getRayDirectionFromPixel(e){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(e)}getMatrixForModel(e,t){return this.currentTransform.getMatrixForModel(e,t)}getProjectionDataForCustomLayer(e=!0){let t=this._mercatorTransform.getProjectionDataForCustomLayer(e);if(!this.isGlobeRendering)return t;let n=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(e);return n.fallbackMatrix=t.mainMatrix,n}getFastPathSimpleProjectionMatrix(e){return this.currentTransform.getFastPathSimpleProjectionMatrix(e)}}class Kn{get useGlobeControls(){return!0}handlePanInertia(e,n){let r=Fn(e,n);return Math.abs(r.lng-n.center.lng)>180&&(r.lng=n.center.lng+179.5*Math.sign(r.lng-n.center.lng)),{easingCenter:r,easingOffset:new t.P(0,0)}}handleMapControlsRollPitchBearingZoom(e,n){let r=e.around,i=n.screenPointToLocation(r);e.bearingDelta&&n.setBearing(n.bearing+e.bearingDelta),e.pitchDelta&&n.setPitch(n.pitch+e.pitchDelta),e.rollDelta&&n.setRoll(n.roll+e.rollDelta);let a=n.zoom;e.zoomDelta&&n.setZoom(n.zoom+e.zoomDelta);let o=n.zoom-a;if(o===0)return;let s=t.bJ(n.center.lng,i.lng),c=s/(Math.abs(s/180)+1),l=t.bJ(n.center.lat,i.lat),u=n.getRayDirectionFromPixel(r),d=n.cameraPosition,f=-1*t.b3(d,u),p=t.bz();t.a_(p,d,[u[0]*f,u[1]*f,u[2]*f]);let m=t.b5(p)-1,h=Math.exp(.5*-Math.max(m-.3,0)),g=jn(n.worldSize,n.center.lat)/Math.min(n.width,n.height),_=t.bw(g,.9,.5,1,.25),v=(1-t.ao(-o))*Math.min(h,_),y=n.center.lat,b=n.zoom,x=new t.W(n.center.lng+c*v,t.al(n.center.lat+l*v,-t.am,t.am));n.setLocationAtPoint(i,r);let S=n.center,C=t.bw(Math.abs(s),45,85,0,1),w=t.bw(g,.75,.35,0,1),T=Math.max(C,w)**.25,E=t.bJ(S.lng,x.lng),D=t.bJ(S.lat,x.lat);n.setCenter(new t.W(S.lng+E*T,S.lat+D*T).wrap()),n.setZoom(b+Pn(y,n.center.lat))}handleMapControlsPan(e,t,n){if(!e.panDelta)return;let r=t.center.lat,i=t.zoom;t.setCenter(Fn(e.panDelta,t).wrap()),t.setZoom(i+Pn(r,t.center.lat))}cameraForBoxAndBearing(e,n,r,i,a){let o=fn(e,n,r,i,a),s=n.left/a.width*2-1,c=(a.width-n.right)/a.width*2-1,l=n.top/a.height*-2+1,u=(a.height-n.bottom)/a.height*-2+1,d=t.bJ(r.getWest(),r.getEast())<0,f=d?r.getEast():r.getWest(),p=d?r.getWest():r.getEast(),m=Math.max(r.getNorth(),r.getSouth()),h=Math.min(r.getNorth(),r.getSouth()),g=f+.5*t.bJ(f,p),_=m+.5*t.bJ(m,h),v=a.clone();v.setCenter(o.center),v.setBearing(o.bearing),v.setPitch(0),v.setRoll(0),v.setZoom(o.zoom);let y=v.modelViewProjectionMatrix,b=[An(r.getNorthWest()),An(r.getNorthEast()),An(r.getSouthWest()),An(r.getSouthEast()),An(new t.W(p,_)),An(new t.W(f,_)),An(new t.W(g,m)),An(new t.W(g,h))],x=An(o.center),S=1/0;for(let e of b)s<0&&(S=Kn.getLesserNonNegativeNonNull(S,Kn.solveVectorScale(e,x,y,`x`,s))),c>0&&(S=Kn.getLesserNonNegativeNonNull(S,Kn.solveVectorScale(e,x,y,`x`,c))),l>0&&(S=Kn.getLesserNonNegativeNonNull(S,Kn.solveVectorScale(e,x,y,`y`,l))),u<0&&(S=Kn.getLesserNonNegativeNonNull(S,Kn.solveVectorScale(e,x,y,`y`,u)));if(Number.isFinite(S)&&S!==0)return o.zoom=Math.min(v.zoom+t.ar(S),e.maxZoom),o;un()}handleJumpToCenterZoom(e,n){let r=e.center.lat,i=e.applyConstrain(n.center?t.W.convert(n.center):e.center,e.zoom).center;e.setCenter(i.wrap());let a=n.zoom===void 0?e.zoom+Pn(r,i.lat):+n.zoom;e.zoom!==a&&e.setZoom(a)}handleEaseTo(e,n){let r=e.zoom,i=e.center,a=e.padding,o={roll:e.roll,pitch:e.pitch,bearing:e.bearing},s={roll:n.roll===void 0?e.roll:n.roll,pitch:n.pitch===void 0?e.pitch:n.pitch,bearing:n.bearing===void 0?e.bearing:n.bearing},c=n.zoom!==void 0,l=!e.isPaddingEqual(n.padding),u=!1,d=n.center?t.W.convert(n.center):i,f=e.applyConstrain(d,r).center;nn(e,f);let p=e.clone();p.setCenter(f),p.setZoom(c?+n.zoom:r+Pn(i.lat,d.lat)),p.setBearing(n.bearing);let m=new t.P(t.al(e.centerPoint.x+n.offsetAsPoint.x,0,e.width),t.al(e.centerPoint.y+n.offsetAsPoint.y,0,e.height));p.setLocationAtPoint(f,m);let h=(n.offset&&n.offsetAsPoint.mag())>0?p.center:f,g=c?+n.zoom:r+Pn(i.lat,h.lat),_=r+Pn(i.lat,0),v=g+Pn(h.lat,0),y=t.bJ(i.lng,h.lng),b=t.bJ(i.lat,h.lat),x=t.ao(v-_);return u=g!==r,{easeFunc:r=>{if(t.bn(o,s)||dn({startEulerAngles:o,endEulerAngles:s,tr:e,k:r,useSlerp:o.roll!=s.roll}),l&&e.interpolatePadding(a,n.padding,r),n.around)t.w(`Easing around a point is not supported under globe projection.`),e.setLocationAtPoint(n.around,n.aroundPoint);else{let t=(v>_?Math.min(2,x):Math.max(.5,x))**(1-r),n=Ln(i,y,b,r*t);e.setCenter(n.wrap())}if(u){let n=t.H.number(_,v,r)+Pn(0,e.center.lat);e.setZoom(n)}},isZooming:u,elevationCenter:h}}handleFlyTo(e,n){let r=n.zoom!==void 0,i=e.center,a=e.zoom,o=e.padding,s=!e.isPaddingEqual(n.padding),c=e.applyConstrain(t.W.convert(n.center||n.locationAtOffset),a).center,l=r?+n.zoom:e.zoom+Pn(e.center.lat,c.lat),u=e.clone();u.setCenter(c),u.setZoom(l),u.setBearing(n.bearing);let d=new t.P(t.al(e.centerPoint.x+n.offsetAsPoint.x,0,e.width),t.al(e.centerPoint.y+n.offsetAsPoint.y,0,e.height));u.setLocationAtPoint(c,d);let f=u.center;nn(e,f);let p=function(e,n,r){let i=An(n),a=An(r),o=t.b3(i,a),s=Math.acos(o),c=On(e);return s/(2*Math.PI)*c}(e,i,f),m=a+Pn(i.lat,0),h=l+Pn(f.lat,0),g=t.ao(h-m),_;if(typeof n.minZoom==`number`){let r=+n.minZoom+Pn(f.lat,0),i=Math.min(r,m,h)+Pn(0,f.lat),a=e.applyConstrain(f,i).zoom+Pn(f.lat,0);_=t.ao(a-m)}let v=t.bJ(i.lng,f.lng),y=t.bJ(i.lat,f.lat);return{easeFunc:(r,a,c,u)=>{let d=Ln(i,v,y,c);s&&e.interpolatePadding(o,n.padding,r);let p=r===1?f:d;e.setCenter(p.wrap());let h=m+t.ar(a);e.setZoom(r===1?l:h+Pn(0,p.lat))},scaleOfZoom:g,targetCenter:f,scaleOfMinZoom:_,pixelPathLength:p}}static solveVectorScale(e,t,n,r,i){let a=r===`x`?[n[0],n[4],n[8],n[12]]:[n[1],n[5],n[9],n[13]],o=[n[3],n[7],n[11],n[15]],s=e[0]*a[0]+e[1]*a[1]+e[2]*a[2],c=e[0]*o[0]+e[1]*o[1]+e[2]*o[2],l=t[0]*a[0]+t[1]*a[1]+t[2]*a[2],u=t[0]*o[0]+t[1]*o[1]+t[2]*o[2];return l+i*c===s+i*u||o[3]*(s-l)+a[3]*(u-c)+s*u==l*c?null:(l+a[3]-i*u-i*o[3])/(l-s-i*u+i*c)}static getLesserNonNegativeNonNull(e,t){return t!==null&&t>=0&&t<e?t:e}}class qn{constructor(e){this._globe=e,this._mercatorCameraHelper=new pn,this._verticalPerspectiveCameraHelper=new Kn}get useGlobeControls(){return this._globe.useGlobeRendering}get currentHelper(){return this.useGlobeControls?this._verticalPerspectiveCameraHelper:this._mercatorCameraHelper}handlePanInertia(e,t){return this.currentHelper.handlePanInertia(e,t)}handleMapControlsRollPitchBearingZoom(e,t){this.currentHelper.handleMapControlsRollPitchBearingZoom(e,t)}handleMapControlsPan(e,t,n){this.currentHelper.handleMapControlsPan(e,t,n)}cameraForBoxAndBearing(e,t,n,r,i){return this.currentHelper.cameraForBoxAndBearing(e,t,n,r,i)}handleJumpToCenterZoom(e,t){this.currentHelper.handleJumpToCenterZoom(e,t)}handleEaseTo(e,t){return this.currentHelper.handleEaseTo(e,t)}handleFlyTo(e,t){return this.currentHelper.handleFlyTo(e,t)}}let Jn=(e,n)=>t.C(e,n?.filter((e=>e.identifier!==`source.canvas`))),Yn=t.bN();class Xn extends t.E{constructor(e,n={}){super(),this._rtlPluginLoaded=()=>{for(let e in this.tileManagers){let t=this.tileManagers[e].getSource().type;t!==`vector`&&t!==`geojson`||this.tileManagers[e].reload()}},this.map=e,this.dispatcher=new ie(re(),e._getMapId()),this.dispatcher.registerMessageHandler(`GG`,((e,t)=>this.getGlyphs(e,t))),this.dispatcher.registerMessageHandler(`GI`,((e,t)=>this.getImages(e,t))),this.dispatcher.registerMessageHandler(`GDA`,((e,t)=>this.getDashes(e,t))),this.imageManager=new g,this.imageManager.setEventedParent(this);let r=e._container?.lang||typeof document<`u`&&document.documentElement?.lang||void 0;this.glyphManager=new S(e._requestManager,n.localIdeographFontFamily,r),this.lineAtlas=new O(256,512),this.crossTileSymbolIndex=new Kt,this._setInitialValues(),this._resetUpdates(),this.dispatcher.broadcast(`SR`,t.bO()),ke().on(Ee,this._rtlPluginLoaded),this.on(`data`,(e=>{if(e.dataType!==`source`||e.sourceDataType!==`metadata`)return;let t=this.tileManagers[e.sourceId];if(!t)return;let n=t.getSource();if(n?.vectorLayerIds)for(let e in this._layers){let t=this._layers[e];t.source===n.id&&this._validateLayer(t)}}))}_setInitialValues(){this._spritesImagesIds={},this._layers={},this._order=[],this.tileManagers={},this.zoomHistory=new t.bP,this._availableImages=[],this._globalState={},this._serializedLayers={},this.stylesheet=null,this.light=null,this.sky=null,this.projection&&(this.projection.destroy(),delete this.projection),this._loaded=!1,this._changed=!1,this._updatedLayers={},this._updatedSources={},this._changedImages={},this._glyphsDidChange=!1,this._updatedPaintProps={},this._layerOrderChanged=!1,this.crossTileSymbolIndex=new((this.crossTileSymbolIndex?.constructor)||Object),this.pauseablePlacement=void 0,this.placement=void 0,this.z=0}setGlobalStateProperty(e,n){this._checkLoaded();let r=n===null?this.stylesheet.state?.[e]?.default??null:n;if(t.bQ(r,this._globalState[e]))return this;this._globalState[e]=r,this._applyGlobalStateChanges([e])}getGlobalState(){return this._globalState}setGlobalState(e){this._checkLoaded();let n=[];for(let r in e)!t.bQ(this._globalState[r],e[r].default)&&(n.push(r),this._globalState[r]=e[r].default);this._applyGlobalStateChanges(n)}_applyGlobalStateChanges(e){if(e.length===0)return;let t=new Set,n={};for(let r of e){n[r]=this._globalState[r];for(let e in this._layers){let n=this._layers[e],i=n.getLayoutAffectingGlobalStateRefs(),a=n.getPaintAffectingGlobalStateRefs(),o=n.getVisibilityAffectingGlobalStateRefs();if(i.has(r)&&t.add(n.source),a.has(r))for(let{name:e,value:t}of a.get(r))this._updatePaintProperty(n,e,t);o!=null&&o.has(r)&&(n.recalculateVisibility(),this._updateLayer(n))}}this.dispatcher.broadcast(`UGS`,n);for(let e in this.tileManagers)t.has(e)&&(this._reloadSource(e),this._changed=!0)}loadURL(e){return t._(this,arguments,void 0,(function*(e,n={},r){this.fire(new t.n(`dataloading`,{dataType:`style`})),n.validate=typeof n.validate!=`boolean`||n.validate,this._loadStyleRequest=new AbortController;let i=this._loadStyleRequest;try{let a=yield this.map._requestManager.transformRequest(e,`Style`);t.bR(i.signal);let o=yield t.k(a,i);this._loadStyleRequest===i&&(this._loadStyleRequest=null),this._load(o.data,n,r)}catch(e){this._loadStyleRequest===i&&(this._loadStyleRequest=null),e&&!i.signal.aborted&&this.fire(new t.l(t.d(e)))}}))}loadJSON(e,n={},r){this.fire(new t.n(`dataloading`,{dataType:`style`})),this._frameRequest=new AbortController,s.frameAsync(this._frameRequest,this.map._ownerWindow).then((()=>{this._frameRequest=null,n.validate=!1!==n.validate,this._load(e,n,r)})).catch((()=>{}))}loadEmpty(){this.fire(new t.n(`dataloading`,{dataType:`style`})),this._load(Yn,{validate:!1})}_load(e,n,r){let i=n.transformStyle?n.transformStyle(r,e):e;if(!n.validate||!Jn(this,t.F(i))){i=Object.assign({},i),this._loaded=!0,this.stylesheet=i;for(let e in i.sources)this.addSource(e,i.sources[e],{validate:!1});i.sprite?this._loadSprite(i.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(i.glyphs),this._createLayers(),this.light=new T(this.stylesheet.light),this._setProjectionInternal(this.stylesheet.projection?.type||`mercator`),this.sky=new D(this.stylesheet.sky),this.map.setTerrain(this.stylesheet.terrain??null),this.fire(new t.n(`data`,{dataType:`style`})),this.fire(new t.n(`style.load`))}}_createLayers(){let e=t.bS(this.stylesheet.layers);this.setGlobalState(this.stylesheet.state??null),this.dispatcher.broadcast(`SL`,e),this._order=e.map((e=>e.id)),this._layers={},this._serializedLayers=null;for(let n of e){let e=t.bT(n,this._globalState);if(e.setEventedParent(this,{layer:{id:n.id}}),this._layers[n.id]=e,t.bU(e)&&this.tileManagers[e.source]){let t=n.paint?.[`raster-fade-duration`]??e.paint.get(`raster-fade-duration`);this.tileManagers[e.source].setRasterFadeDuration(t)}}}_loadSprite(e,n=!1,r=void 0){this.imageManager.setLoaded(!1);let i=new AbortController,a;this._spriteRequest=i,function(e,n,r,i){return t._(this,void 0,void 0,(function*(){let a=p(e),o=r>1?`@2x`:``,c={},l={};for(let{id:e,url:r}of a){let a=yield n.transformRequest(m(r,o,`.json`),`SpriteJSON`);c[e]=t.k(a,i);let s=yield n.transformRequest(m(r,o,`.png`),`SpriteImage`);l[e]=u.getImage(s,i)}return yield Promise.all([...Object.values(c),...Object.values(l)]),function(e,n){return t._(this,void 0,void 0,(function*(){let t={};for(let r in e){t[r]={};let i=s.getImageCanvasContext((yield n[r]).data),a=(yield e[r]).data;for(let e in a){let{width:n,height:o,x:s,y:c,sdf:l,pixelRatio:u,stretchX:d,stretchY:f,content:p,textFitWidth:m,textFitHeight:h}=a[e];t[r][e]={data:null,pixelRatio:u,sdf:l,stretchX:d,stretchY:f,content:p,textFitWidth:m,textFitHeight:h,spriteData:{width:n,height:o,x:s,y:c,context:i}}}}return t}))}(c,l)}))}(e,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then((e=>{if(this._spriteRequest=null,e)for(let t in e){this._spritesImagesIds[t]=[];let r=this._spritesImagesIds[t]?this._spritesImagesIds[t].filter((t=>!(t in e))):[];for(let e of r)this.imageManager.removeImage(e),this._changedImages[e]=!0;for(let r in e[t]){let i=t==="default"?r:`${t}:${r}`;this._spritesImagesIds[t].push(i),i in this.imageManager.images?this.imageManager.updateImage(i,e[t][r],!1):this.imageManager.addImage(i,e[t][r]),n&&(this._changedImages[i]=!0)}}})).catch((e=>{this._spriteRequest=null,a=e,i.signal.aborted||this.fire(new t.l(a))})).finally((()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),n&&(this._changed=!0),this.dispatcher.broadcast(`SI`,this._availableImages),this.fire(new t.n(`data`,{dataType:`style`})),r&&r(a)}))}_unloadSprite(){for(let e of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(e),this._changedImages[e]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast(`SI`,this._availableImages),this.fire(new t.n(`data`,{dataType:`style`}))}_validateLayer(e){let n=this.tileManagers[e.source];if(!n)return;let r=e.sourceLayer;if(!r)return;let i=n.getSource();(i.type===`geojson`||i.vectorLayerIds&&!i.vectorLayerIds.includes(r))&&this.fire(new t.l(Error(`Source layer "${r}" does not exist on source "${i.id}" as specified by style layer "${e.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let e in this.tileManagers)if(!this.tileManagers[e].loaded())return!1;return this.imageManager.isLoaded()}_serializeByIds(e,n=!1){let r=this._serializedAllLayers();if(!e||e.length===0)return Object.values(n?t.bV(r):r);let i=[];for(let a of e)if(r[a]){let e=n?t.bV(r[a]):r[a];i.push(e)}return i}_serializedAllLayers(){let e=this._serializedLayers;if(e)return e;e=this._serializedLayers={};let t=Object.keys(this._layers);for(let n of t){let t=this._layers[n];t.type!==`custom`&&(e[n]=t.serialize())}return e}hasTransitions(){if(this.light?.hasTransition()||this.sky?.hasTransition()||this.projection?.hasTransition())return!0;for(let e in this.tileManagers)if(this.tileManagers[e].hasTransition())return!0;for(let e in this._layers)if(this._layers[e].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw Error(`Style is not done loading.`)}update(e){if(!this._loaded)return;let n=this._changed;if(n){let t=Object.keys(this._updatedLayers),n=Object.keys(this._removedLayers);(t.length||n.length)&&this._updateWorkerLayers(t,n);for(let e in this._updatedSources){let t=this._updatedSources[e];if(t===`reload`)this._reloadSource(e);else{if(t!==`clear`)throw Error(`Invalid action ${t}`);this._clearSource(e)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(let t in this._updatedPaintProps)this._layers[t].updateTransitions(e);this.light.updateTransitions(e),this.sky.updateTransitions(e),this._resetUpdates()}let r={};for(let e in this.tileManagers){let t=this.tileManagers[e];r[e]=t.used,t.used=!1}for(let t of this._order){let n=this._layers[t];n.recalculate(e,this._availableImages),!n.isHidden(e.zoom)&&n.source&&(this.tileManagers[n.source].used=!0)}for(let e in r){let n=this.tileManagers[e];!!r[e]!=!!n.used&&n.fire(new t.n(`data`,{sourceDataType:`visibility`,dataType:`source`,sourceId:e}))}this.light.recalculate(e),this.sky.recalculate(e),this.projection.recalculate(e),this.z=e.zoom,n&&this.fire(new t.n(`data`,{dataType:`style`}))}_updateTilesForChangedImages(){let e=Object.keys(this._changedImages);if(e.length){for(let t in this.tileManagers)this.tileManagers[t].reloadTilesForDependencies([`icons`,`patterns`],e);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(let e in this.tileManagers)this.tileManagers[e].reloadTilesForDependencies([`glyphs`],[``]);this._glyphsDidChange=!1}}_updateWorkerLayers(e,t){this.dispatcher.broadcast(`UL`,{layers:this._serializeByIds(e,!1),removedIds:t})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(e,n={}){var r;this._checkLoaded();let i=this.serialize();if(e=n.transformStyle?n.transformStyle(i,e):e,((r=n.validate)==null||r)&&Jn(this,t.F(e)))return!1;(e=t.bV(e)).layers=t.bS(e.layers);let a=t.bW(i,e),o=this._getOperationsToPerform(a);if(o.unimplemented.length>0)throw Error(`Unimplemented: ${o.unimplemented.join(`, `)}.`);if(o.operations.length===0)return!1;for(let e of o.operations)e();return this.stylesheet=e,this._serializedLayers=null,this.fire(new t.n(`style.load`,{style:this})),!0}_getOperationsToPerform(e){let t=[],n=[];for(let r of e)switch(r.command){case`setCenter`:case`setZoom`:case`setBearing`:case`setPitch`:case`setRoll`:continue;case`addLayer`:t.push((()=>this.addLayer.apply(this,r.args)));break;case`removeLayer`:t.push((()=>this.removeLayer.apply(this,r.args)));break;case`setPaintProperty`:t.push((()=>this.setPaintProperty.apply(this,r.args)));break;case`setLayoutProperty`:t.push((()=>this.setLayoutProperty.apply(this,r.args)));break;case`setFilter`:t.push((()=>this.setFilter.apply(this,r.args)));break;case`addSource`:t.push((()=>this.addSource.apply(this,r.args)));break;case`removeSource`:t.push((()=>this.removeSource.apply(this,r.args)));break;case`setLayerZoomRange`:t.push((()=>this.setLayerZoomRange.apply(this,r.args)));break;case`setLight`:t.push((()=>this.setLight.apply(this,r.args)));break;case`setGeoJSONSourceData`:t.push((()=>this.setGeoJSONSourceData.apply(this,r.args)));break;case`setGlyphs`:t.push((()=>this.setGlyphs.apply(this,r.args)));break;case`setSprite`:t.push((()=>this.setSprite.apply(this,r.args)));break;case`setTerrain`:t.push((()=>this.map.setTerrain.apply(this,r.args)));break;case`setSky`:t.push((()=>this.setSky.apply(this,r.args)));break;case`setProjection`:this.setProjection.apply(this,r.args);break;case`setGlobalState`:t.push((()=>this.setGlobalState.apply(this,r.args)));break;case`setTransition`:t.push((()=>{}));break;default:n.push(r.command)}return{operations:t,unimplemented:n}}addImage(e,n){if(this.getImage(e))return this.fire(new t.l(Error(`An image named "${e}" already exists.`)));this.imageManager.addImage(e,n),this._afterImageUpdated(e)}updateImage(e,t){this.imageManager.updateImage(e,t)}getImage(e){return this.imageManager.getImage(e)}removeImage(e){if(!this.getImage(e))return this.fire(new t.l(Error(`An image named "${e}" does not exist.`)));this.imageManager.removeImage(e),this._afterImageUpdated(e)}_afterImageUpdated(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast(`SI`,this._availableImages),this.fire(new t.n(`data`,{dataType:`style`}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,n,r={}){var i;if(this._checkLoaded(),this.tileManagers[e]!==void 0)throw Error(`Source "${e}" already exists.`);if(!n.type)throw Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(`, `)}.`);if([`vector`,`raster`,`geojson`,`video`,`image`].includes(n.type)&&this._validate(t.F.source,`sources.${e}`,n,null,r))return;(i=this.map)!=null&&i._collectResourceTiming&&(n.collectResourceTiming=!0);let a=this.tileManagers[e]=new $e(e,n,this.dispatcher);a.style=this,a.setEventedParent(this,(()=>({isSourceLoaded:a.loaded(),source:a.serialize(),sourceId:e}))),a.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),this.tileManagers[e]===void 0)throw Error(`There is no source with this ID=${e}`);for(let n in this._layers)if(this._layers[n].source===e)return this.fire(new t.l(Error(`Source "${e}" cannot be removed while layer "${n}" is using it.`)));let n=this.tileManagers[e];delete this.tileManagers[e],delete this._updatedSources[e],n.fire(new t.n(`data`,{sourceDataType:`metadata`,dataType:`source`,sourceId:e})),n.setEventedParent(null),n.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,t){if(this._checkLoaded(),this.tileManagers[e]===void 0)throw Error(`There is no source with this ID=${e}`);let n=this.tileManagers[e].getSource();if(n.type!==`geojson`)throw Error(`geojsonSource.type is ${n.type}, which is !== 'geojson`);n.setData(t),this._changed=!0}getSource(e){return this.tileManagers[e]?.getSource()}addLayer(e,n,r={}){this._checkLoaded();let i=e.id;if(this.getLayer(i))return void this.fire(new t.l(Error(`Layer "${i}" already exists on this map.`)));let a;if(e.type===`custom`){if(J
vendor: 7,079 bytes, line 754
754n(this,t.bX(e)))return;a=t.bT(e,this._globalState)}else{if(`source`in e&&typeof e.source==`object`&&(this.addSource(i,e.source),e=t.bV(e),e=t.e(e,{source:i})),this._validate(t.F.layer,`layers.${i}`,e,{arrayIndex:-1},r))return;a=t.bT(e,this._globalState),this._validateLayer(a),a.setEventedParent(this,{layer:{id:i}})}let o=n?this._order.indexOf(n):this._order.length;if(n&&o===-1)this.fire(new t.l(Error(`Cannot add layer "${i}" before non-existing layer "${n}".`)));else{if(this._order.splice(o,0,i),this._layerOrderChanged=!0,this._layers[i]=a,this._removedLayers[i]&&a.source&&a.type!==`custom`){let e=this._removedLayers[i];delete this._removedLayers[i],e.type===a.type?(this._updatedSources[a.source]=`reload`,this.tileManagers[a.source].pause()):this._updatedSources[a.source]=`clear`}this._updateLayer(a),a.onAdd&&a.onAdd(this.map)}}moveLayer(e,n){if(this._checkLoaded(),this._changed=!0,!this._layers[e])return void this.fire(new t.l(Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));if(e===n)return;let r=this._order.indexOf(e);this._order.splice(r,1);let i=n?this._order.indexOf(n):this._order.length;n&&i===-1?this.fire(new t.l(Error(`Cannot move layer "${e}" before non-existing layer "${n}".`))):(this._order.splice(i,0,e),this._layerOrderChanged=!0)}removeLayer(e){this._checkLoaded();let n=this._layers[e];if(!n)return void this.fire(new t.l(Error(`Cannot remove non-existing layer "${e}".`)));n.setEventedParent(null);let r=this._order.indexOf(e);this._order.splice(r,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=n,delete this._layers[e],this._serializedLayers&&delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],n.onRemove&&n.onRemove(this.map)}getLayer(e){return this._layers[e]}getLayersOrder(){return[...this._order]}hasLayer(e){return e in this._layers}setLayerZoomRange(e,n,r){this._checkLoaded();let i=this.getLayer(e);i?i.minzoom===n&&i.maxzoom===r||(n!=null&&(i.minzoom=n),r!=null&&(i.maxzoom=r),this._updateLayer(i)):this.fire(new t.l(Error(`Cannot set the zoom range of non-existing layer "${e}".`)))}setFilter(e,n,r={}){this._checkLoaded();let i=this.getLayer(e);if(i){if(!t.bQ(i.filter,n))return n==null?(i.setFilter(void 0),void this._updateLayer(i)):void(this._validate(t.F.filter,`layers.${i.id}.filter`,n,null,r)||(i.setFilter(t.bV(n)),this._updateLayer(i)))}else this.fire(new t.l(Error(`Cannot filter non-existing layer "${e}".`)))}getFilter(e){return t.bV(this.getLayer(e).filter)}setLayoutProperty(e,n,r,i={}){this._checkLoaded();let a=this.getLayer(e);a?t.bQ(a.getLayoutProperty(n),r)||(a.setLayoutProperty(n,r,i),this._updateLayer(a)):this.fire(new t.l(Error(`Cannot style non-existing layer "${e}".`)))}getLayoutProperty(e,n){let r=this.getLayer(e);if(r)return r.getLayoutProperty(n);this.fire(new t.l(Error(`Cannot get style of non-existing layer "${e}".`)))}setPaintProperty(e,n,r,i={}){this._checkLoaded();let a=this.getLayer(e);a?t.bQ(a.getPaintProperty(n),r)||this._updatePaintProperty(a,n,r,i):this.fire(new t.l(Error(`Cannot style non-existing layer "${e}".`)))}_updatePaintProperty(e,n,r,i={}){e.setPaintProperty(n,r,i)&&this._updateLayer(e),t.bU(e)&&n===`raster-fade-duration`&&this.tileManagers[e.source].setRasterFadeDuration(r),this._changed=!0,this._updatedPaintProps[e.id]=!0,this._serializedLayers=null}getPaintProperty(e,t){return this.getLayer(e).getPaintProperty(t)}setFeatureState(e,n){this._checkLoaded();let r=e.source,i=e.sourceLayer,a=this.tileManagers[r];if(a===void 0)return void this.fire(new t.l(Error(`The source '${r}' does not exist in the map's style.`)));let o=a.getSource().type;o===`geojson`&&i?this.fire(new t.l(Error(`GeoJSON sources cannot have a sourceLayer parameter.`))):o!==`vector`||i?(e.id===void 0&&this.fire(new t.l(Error(`The feature id parameter must be provided.`))),a.setFeatureState(i,e.id,n)):this.fire(new t.l(Error(`The sourceLayer parameter must be provided for vector source types.`)))}removeFeatureState(e,n){this._checkLoaded();let r=e.source,i=this.tileManagers[r];if(i===void 0)return void this.fire(new t.l(Error(`The source '${r}' does not exist in the map's style.`)));let a=i.getSource().type,o=a===`vector`?e.sourceLayer:void 0;a!==`vector`||o?n&&typeof e.id!=`string`&&typeof e.id!=`number`?this.fire(new t.l(Error(`A feature id is required to remove its specific state property.`))):i.removeFeatureState(o,e.id,n):this.fire(new t.l(Error(`The sourceLayer parameter must be provided for vector source types.`)))}getFeatureState(e){this._checkLoaded();let n=e.source,r=e.sourceLayer,i=this.tileManagers[n];if(i!==void 0)return i.getSource().type!==`vector`||r?(e.id===void 0&&this.fire(new t.l(Error(`The feature id parameter must be provided.`))),i.getFeatureState(r,e.id)):void this.fire(new t.l(Error(`The sourceLayer parameter must be provided for vector source types.`)));this.fire(new t.l(Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return t.e({duration:300,delay:0},this.stylesheet?.transition)}serialize(){if(!this._loaded)return;let e=t.bY(this.tileManagers,(e=>e.serialize())),n=this._serializeByIds(this._order,!0),r=this.map.getTerrain()||void 0,i=this.stylesheet;return t.bZ({version:i.version,name:i.name,metadata:i.metadata,light:i.light,sky:i.sky,center:i.center,zoom:i.zoom,bearing:i.bearing,pitch:i.pitch,sprite:i.sprite,glyphs:i.glyphs,transition:i.transition,projection:i.projection,sources:e,layers:n,terrain:r},(e=>e!==void 0))}_updateLayer(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&this.tileManagers[e.source].getSource().type!==`raster`&&(this._updatedSources[e.source]=`reload`,this.tileManagers[e.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(e){let t=e=>this._layers[e].type===`fill-extrusion`,n={},r=[];for(let i=this._order.length-1;i>=0;i--){let a=this._order[i];if(t(a)){n[a]=i;for(let t of e){let e=t[a];if(e)for(let t of e)r.push(t)}}}r.sort(((e,t)=>t.intersectionZ-e.intersectionZ));let i=[];for(let a=this._order.length-1;a>=0;a--){let o=this._order[a];if(t(o))for(let e=r.length-1;e>=0;e--){let t=r[e].feature;if(n[t.layer.id]<a)break;i.push(t),r.pop()}else for(let t of e){let e=t[o];if(e)for(let t of e)i.push(t.feature)}}return i}queryRenderedFeatures(e,n,r){n!=null&&n.filter&&this._validate(t.F.filter,`queryRenderedFeatures.filter`,n.filter,null,n);let i={};if(n?.layers){if(!(Array.isArray(n.layers)||n.layers instanceof Set))return this.fire(new t.l(Error(`parameters.layers must be an Array or a Set of strings`))),[];for(let e of n.layers){let n=this._layers[e];if(!n)return this.fire(new t.l(Error(`The layer '${e}' does not exist in the map's style and cannot be queried for features.`))),[];i[n.source]=!0}}let a=[];n.availableImages=this._availableImages;let o=this._serializedAllLayers(),s=n.layers instanceof Set?n.layers:Array.isArray(n.layers)?new Set(n.layers):null,c=Object.assign(Object.assign({},n),{layers:s,globalState:this._globalState});for(let t in this.tileManagers)n.layers&&!i[t]||a.push(
vendor: 96,768 bytes, lines 754-756
754ae(this.tileManagers[t],this._layers,o,e,c,r,this.map.terrain?(e,t,n)=>this.map.terrain.getElevation(e,t,n):void 0));return this.placement&&a.push(function(e,t,n,r,i,a,o){let s={},c=a.queryRenderedSymbols(r),l=[];for(let e of Object.keys(c).map(Number))l.push(o[e]);l.sort(oe);for(let n of l){let r=n.featureIndex.lookupSymbolFeatures(c[n.bucketInstanceId],t,n.bucketIndex,n.sourceLayerIndex,{filterSpec:i.filter,globalState:i.globalState},i.layers,i.availableImages,e);for(let e in r){s[e]||(s[e]=[]);let t=r[e];t.sort(((e,t)=>{let r=n.featureSortOrder;if(r){let n=r.indexOf(e.featureIndex);return r.indexOf(t.featureIndex)-n}return t.featureIndex-e.featureIndex}));for(let n of t)s[e].push(n)}}return function(e,t,n){for(let r in e)for(let i of e[r])se(i,n[t[r].source]);return e}(s,e,n)}(this._layers,o,this.tileManagers,e,c,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(a)}querySourceFeatures(e,n){n!=null&&n.filter&&this._validate(t.F.filter,`querySourceFeatures.filter`,n.filter,null,n);let r=this.tileManagers[e];return r?function(e,t){let n=e.getRenderableIds().map((t=>e.getTileByID(t))),r=[],i={};for(let e of n){let n=e.tileID.canonical.key;i[n]||(i[n]=!0,e.querySourceFeatures(r,t))}return r}(r,n?Object.assign(Object.assign({},n),{globalState:this._globalState}):{globalState:this._globalState}):[]}getLight(){return this.light.getLight()}setLight(e,n={}){this._checkLoaded();let r=this.light.getLight(),i=!1;for(let n in e)if(!t.bQ(e[n],r[n])){i=!0;break}if(!i)return;let a={now:l(),transition:t.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,n),this.light.updateTransitions(a)}getProjection(){return this.stylesheet?.projection}setProjection(e){this._checkLoaded();let t=e??{type:`mercator`};if(this.stylesheet.projection=e,this.projection){if(this.projection.name===t.type)return;this.projection.destroy(),delete this.projection}this._setProjectionInternal(t.type)}getSky(){return this.stylesheet?.sky}setSky(e,n={}){this._checkLoaded();let r=this.getSky(),i=!1;if(!e&&!r)return;if(e&&!r)i=!0;else if(!e&&r)i=!0;else for(let n in e)if(!t.bQ(e[n],r[n])){i=!0;break}if(!i)return;let a={now:l(),transition:t.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=e,this.sky.setSky(e,n),this.sky.updateTransitions(a)}_setProjectionInternal(e){let n=function(e,n){let r={constrainOverride:n};if(Array.isArray(e)){let t=new Dn({type:e});return{projection:t,transform:new Gn(r),cameraHelper:new qn(t)}}switch(e){case`mercator`:return{projection:new en,transform:new ln(r),cameraHelper:new pn};case`globe`:{let e=new Dn({type:[`interpolate`,[`linear`],[`zoom`],11,`vertical-perspective`,12,`mercator`]});return{projection:e,transform:new Gn(r),cameraHelper:new qn(e)}}case`vertical-perspective`:return{projection:new Tn,transform:new Wn(r),cameraHelper:new Kn};default:return t.w(`Unknown projection name: ${e}. Falling back to mercator projection.`),{projection:new en,transform:new ln(r),cameraHelper:new pn}}}(e,this.map.transformConstrain);this.projection=n.projection,this.map.migrateProjection(n.transform,n.cameraHelper);for(let e in this.tileManagers)this.tileManagers[e].reload()}_validate(e,n,r,i,a={}){return!1!==a?.validate&&Jn(this,e.call(t.F,t.e({key:n,style:this.serialize(),value:r,styleSpec:t.x},i)))}_remove(e=!0){this._frameRequest&&=(this._frameRequest.abort(),null),this._loadStyleRequest&&=(this._loadStyleRequest.abort(),null),this._spriteRequest&&=(this._spriteRequest.abort(),null),ke().off(Ee,this._rtlPluginLoaded);for(let e in this._layers)this._layers[e].setEventedParent(null);for(let e in this.tileManagers){let t=this.tileManagers[e];t.setEventedParent(null),t.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),e&&this.dispatcher.broadcast(`RM`,void 0),this.dispatcher.remove(e)}_clearSource(e){this.tileManagers[e].clearTiles()}_reloadSource(e){this.tileManagers[e].resume(),this.tileManagers[e].reload()}_updateSources(e){for(let t in this.tileManagers)this.tileManagers[t].update(e,this.map.terrain)}_generateCollisionBoxes(){for(let e in this.tileManagers)this._reloadSource(e)}_updatePlacement(e,t,n,r,i=!1){let a=!1,o=!1,s={};for(let t of this._order){let n=this._layers[t];if(n.type!==`symbol`)continue;if(!s[n.source]){let e=this.tileManagers[n.source];s[n.source]=e.getRenderableIds(!0).map((t=>e.getTileByID(t))).sort(((e,t)=>t.tileID.overscaledZ-e.tileID.overscaledZ||(e.tileID.isLessThan(t.tileID)?-1:1)))}let r=this.crossTileSymbolIndex.addLayer(n,s[n.source],e.center.lng);a||=r}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),i||=this._layerOrderChanged||n===0,(i||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(l(),e.zoom))&&(this.pauseablePlacement=new Vt(e,this.map.terrain,this._order,i,t,n,r,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,s),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(l()),o=!0),a&&this.pauseablePlacement.placement.setStale()),o||a)for(let e of this._order){let t=this._layers[e];t.type===`symbol`&&this.placement.updateLayerOpacities(t,s[t.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(l())}_releaseSymbolFadeTiles(){for(let e in this.tileManagers)this.tileManagers[e].releaseSymbolFadeTiles()}getImages(e,n){return t._(this,void 0,void 0,(function*(){let e=yield this.imageManager.getImages(n.icons);this._updateTilesForChangedImages();let t=this.tileManagers[n.source];return t&&t.setDependencies(n.tileID.key,n.type,n.icons),e}))}getGlyphs(e,n){return t._(this,void 0,void 0,(function*(){let e=yield this.glyphManager.getGlyphs(n.stacks),t=this.tileManagers[n.source];return t&&t.setDependencies(n.tileID.key,n.type,[``]),e}))}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,n={}){this._checkLoaded(),e&&this._validate(t.F.glyphs,`glyphs`,e,null,n)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}getDashes(e,n){return t._(this,void 0,void 0,(function*(){let e={};for(let[t,r]of Object.entries(n.dashes))e[t]=this.lineAtlas.getDash(r.dasharray,r.round);return e}))}addSprite(e,n,r={},i){this._checkLoaded();let a=[{id:e,url:n}],o=[...p(this.stylesheet.sprite),...a];this._validate(t.F.sprite,`sprite`,o,null,r)||(this.stylesheet.sprite=o,this._loadSprite(a,!0,i))}removeSprite(e){this._checkLoaded();let n=p(this.stylesheet.sprite);if(n.find((t=>t.id===e))){if(this._spritesImagesIds[e])for(let t of this._spritesImagesIds[e])this.imageManager.removeImage(t),this._changedImages[t]=!0;n.splice(n.findIndex((t=>t.id===e)),1),this.stylesheet.sprite=n.length>0?n:void 0,delete this._spritesImagesIds[e],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast(`SI`,this._availableImages),this.fire(new t.n(`data`,{dataType:`style`}))}else this.fire(new t.l(Error(`Sprite "${e}" doesn't exists on this map.`)))}getSprite(){return p(this.stylesheet.sprite)}setSprite(e,n={},r){this._checkLoaded(),e&&this._validate(t.F.sprite,`sprite`,e,null,n)||(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,r):(this._unloadSprite(),r&&r(null)))}destroy(){this._frameRequest&&=(this._frameRequest.abort(),null),this._loadStyleRequest&&=(this._loadStyleRequest.abort(),null),this._spriteRequest&&=(this._spriteRequest.abort(),null);for(let e in this.tileManagers){let t=this.tileManagers[e];t.setEventedParent(null),t.onRemove(this.map)}this.tileManagers={},this.imageManager&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this._availableImages=[],this._spritesImagesIds={}),this.glyphManager&&this.glyphManager.destroy();for(let e in this._layers){let t=this._layers[e];t.setEventedParent(null),t.onRemove&&t.onRemove(this.map)}this._setInitialValues(),this.setEventedParent(null),this.dispatcher.unregisterMessageHandler(`GG`),this.dispatcher.unregisterMessageHandler(`GI`),this.dispatcher.unregisterMessageHandler(`GDA`),this.dispatcher.remove(!0),this._listeners={},this._oneTimeListeners={}}}var Zn=t.aS([{name:`a_pos`,type:`Int16`,components:2},{name:`a_texture_pos`,type:`Int16`,components:2}]);class Qn{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(e,t,n,r,i,a,o,s,c){this.context=e;let l=this.boundPaintVertexBuffers.length!==r.length;for(let e=0;!l&&e<r.length;e++)this.boundPaintVertexBuffers[e]!==r[e]&&(l=!0);!this.vao||this.boundProgram!==t||this.boundLayoutVertexBuffer!==n||l||this.boundIndexBuffer!==i||this.boundVertexOffset!==a||this.boundDynamicVertexBuffer!==o||this.boundDynamicVertexBuffer2!==s||this.boundDynamicVertexBuffer3!==c?this.freshBind(t,n,r,i,a,o,s,c):(e.bindVertexArray.set(this.vao),o&&o.bind(),i!=null&&i.dynamicDraw&&i.bind(),s&&s.bind(),c&&c.bind())}freshBind(e,t,n,r,i,a,o,s){let c=e.numAttributes,l=this.context,u=l.gl;this.vao&&this.destroy(),this.vao=l.createVertexArray(),l.bindVertexArray.set(this.vao),this.boundProgram=e,this.boundLayoutVertexBuffer=t,this.boundPaintVertexBuffers=n,this.boundIndexBuffer=r,this.boundVertexOffset=i,this.boundDynamicVertexBuffer=a,this.boundDynamicVertexBuffer2=o,this.boundDynamicVertexBuffer3=s,t.enableAttributes(u,e);for(let t of n)t.enableAttributes(u,e);a&&a.enableAttributes(u,e),o&&o.enableAttributes(u,e),s&&s.enableAttributes(u,e),t.bind(),t.setVertexAttribPointers(u,e,i);for(let t of n)t.bind(),t.setVertexAttribPointers(u,e,i);a&&(a.bind(),a.setVertexAttribPointers(u,e,i)),r&&r.bind(),o&&(o.bind(),o.setVertexAttribPointers(u,e,i)),s&&(s.bind(),s.setVertexAttribPointers(u,e,i)),l.currentNumAttributes=c}destroy(){this.vao&&=(this.context.deleteVertexArray(this.vao),null)}}let $n=(e,n,r,i,a)=>({u_texture:0,u_ele_delta:e,u_fog_matrix:n,u_fog_color:r?r.properties.get(`fog-color`):t.bo.white,u_fog_ground_blend:r?r.properties.get(`fog-ground-blend`):1,u_fog_ground_blend_opacity:a?0:r?r.calculateFogBlendOpacity(i):0,u_horizon_color:r?r.properties.get(`horizon-color`):t.bo.white,u_horizon_fog_blend:r?r.properties.get(`horizon-fog-blend`):1,u_is_globe_mode:+!!a}),er={mainMatrix:`u_projection_matrix`,tileMercatorCoords:`u_projection_tile_mercator_coords`,clippingPlane:`u_projection_clipping_plane`,projectionTransition:`u_projection_transition`,fallbackMatrix:`u_projection_fallback_matrix`};function tr(e){let t=[];for(let n of e){if(n===null)continue;let e=n.split(` `);t.push(e.pop())}return t}class nr{constructor(e,n,r,i,a,o,s,c,l=[]){let u=e.gl;this.program=u.createProgram();let d=tr(n.staticAttributes),f=r?r.getBinderAttributes():[],p=d.concat(f),m=Jt.prelude.staticUniforms?tr(Jt.prelude.staticUniforms):[],h=s.staticUniforms?tr(s.staticUniforms):[],g=n.staticUniforms?tr(n.staticUniforms):[],_=r?r.getBinderUniforms():[],v=m.concat(h).concat(g).concat(_),y=[];for(let e of v)y.includes(e)||y.push(e);let b=r?r.defines():[];bn(u)&&b.unshift(`#version 300 es`),a&&b.push(`#define OVERDRAW_INSPECTOR;`),o&&b.push(`#define TERRAIN3D;`),c&&b.push(c),l&&b.push(...l);let x=b.concat(Jt.prelude.fragmentSource,s.fragmentSource,n.fragmentSource).join(`
755`),S=b.concat(Jt.prelude.vertexSource,s.vertexSource,n.vertexSource).join(`
756`);bn(u)||(x=function(e){return e.replace(/\bin\s/g,`varying `).replace(`out highp vec4 fragColor;`,``).replace(/fragColor/g,`gl_FragColor`).replace(/texture\(/g,`texture2D(`)}(x),S=function(e){return e.replace(/\bin\s/g,`attribute `).replace(/\bout\s/g,`varying `).replace(/texture\(/g,`texture2D(`)}(S));let C=u.createShader(u.FRAGMENT_SHADER);if(u.isContextLost())return void(this.failedToCreate=!0);if(u.shaderSource(C,x),u.compileShader(C),!u.getShaderParameter(C,u.COMPILE_STATUS))throw Error(`Could not compile fragment shader: ${u.getShaderInfoLog(C)}`);u.attachShader(this.program,C);let w=u.createShader(u.VERTEX_SHADER);if(u.isContextLost())return void(this.failedToCreate=!0);if(u.shaderSource(w,S),u.compileShader(w),!u.getShaderParameter(w,u.COMPILE_STATUS))throw Error(`Could not compile vertex shader: ${u.getShaderInfoLog(w)}`);u.attachShader(this.program,w),this.attributes={};let T={};this.numAttributes=p.length;for(let e=0;e<this.numAttributes;e++)p[e]&&(u.bindAttribLocation(this.program,e,p[e]),this.attributes[p[e]]=e);if(u.linkProgram(this.program),!u.getProgramParameter(this.program,u.LINK_STATUS))throw Error(`Program failed to link: ${u.getProgramInfoLog(this.program)}`);u.deleteShader(w),u.deleteShader(C);for(let e of y)if(e&&!T[e]){let t=u.getUniformLocation(this.program,e);t&&(T[e]=t)}this.fixedUniforms=i(e,T),this.terrainUniforms=((e,n)=>({u_depth:new t.b_(e,n.u_depth),u_terrain:new t.b_(e,n.u_terrain),u_terrain_dim:new t.bp(e,n.u_terrain_dim),u_terrain_matrix:new t.c0(e,n.u_terrain_matrix),u_terrain_unpack:new t.c1(e,n.u_terrain_unpack),u_terrain_exaggeration:new t.bp(e,n.u_terrain_exaggeration)}))(e,T),this.projectionUniforms=((e,n)=>({u_projection_matrix:new t.c0(e,n.u_projection_matrix),u_projection_tile_mercator_coords:new t.c1(e,n.u_projection_tile_mercator_coords),u_projection_clipping_plane:new t.c1(e,n.u_projection_clipping_plane),u_projection_transition:new t.bp(e,n.u_projection_transition),u_projection_fallback_matrix:new t.c0(e,n.u_projection_fallback_matrix)}))(e,T),this.binderUniforms=r?r.getUniforms(e,T):[]}draw(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v){var y;let b=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(n),e.setStencilMode(r),e.setColorMode(i),e.setCullFace(a),s){e.activeTexture.set(b.TEXTURE2),b.bindTexture(b.TEXTURE_2D,s.depthTexture),e.activeTexture.set(b.TEXTURE3),b.bindTexture(b.TEXTURE_2D,s.texture);for(let e in this.terrainUniforms)this.terrainUniforms[e].set(s[e])}if(c)for(let e in c)this.projectionUniforms[er[e]].set(c[e]);if(o)for(let e in this.fixedUniforms)this.fixedUniforms[e].set(o[e]);h&&h.setUniforms(e,this.binderUniforms,p,{zoom:m});let x=0;switch(t){case b.LINES:x=2;break;case b.TRIANGLES:x=3;break;case b.LINE_STRIP:x=1}for(let n of f.get())n.vaos||={},(y=n.vaos)[l]||(y[l]=new Qn),n.vaos[l].bind(e,this,u,h?h.getPaintVertexBuffers():[],d,n.vertexOffset,g,_,v),b.drawElements(t,n.primitiveLength*x,b.UNSIGNED_SHORT,n.primitiveOffset*x*2)}}function rr(e,n,r){let i=1/t.aK(r,1,n.transform.tileZoom),a=2**r.tileID.overscaledZ,o=r.tileSize*2**n.transform.tileZoom/a,s=o*(r.tileID.canonical.x+r.tileID.wrap*a),c=o*r.tileID.canonical.y;return{u_image:0,u_texsize:r.imageAtlasTexture.size,u_scale:[i,e.fromScale,e.toScale],u_fade:e.t,u_pixel_coord_upper:[s>>16,c>>16],u_pixel_coord_lower:[65535&s,65535&c]}}let ir=(e,n,r,i)=>{let a=e.style.light,o=a.properties.get(`position`),s=[o.x,o.y,o.z],c=t.c4();a.properties.get(`anchor`)===`viewport`&&t.c5(c,e.transform.bearingInRadians),t.c6(s,s,c);let l=e.transform.transformLightDirection(s),u=a.properties.get(`color`);return{u_lightpos:s,u_lightpos_globe:l,u_lightintensity:a.properties.get(`intensity`),u_lightcolor:[u.r,u.g,u.b],u_vertical_gradient:+n,u_opacity:r,u_fill_translate:i}},ar=(e,n,r,i,a,o,s)=>t.e(ir(e,n,r,i),rr(o,e,s),{u_height_factor:-(2**a.overscaledZ)/s.tileSize/8}),or=(e,n,r,i)=>t.e(rr(n,e,r),{u_fill_translate:i}),sr=(e,t)=>({u_world:e,u_fill_translate:t}),cr=(e,n,r,i,a)=>t.e(or(e,n,r,a),{u_world:i}),lr=(e,n,r,i,a)=>{let o=e.transform,s,c,l=0;if(r.paint.get(`circle-pitch-alignment`)===`map`){let e=t.aK(n,1,o.zoom);s=!0,c=[e,e],l=e/(t.a6*2**n.tileID.overscaledZ)*2*Math.PI*a}else s=!1,c=o.pixelsToGLUnits;return{u_camera_to_center_distance:o.cameraToCenterDistance,u_scale_with_map:+(r.paint.get(`circle-pitch-scale`)===`map`),u_pitch_with_map:+s,u_device_pixel_ratio:e.pixelRatio,u_extrude_scale:c,u_globe_extrude_scale:l,u_translate:i}},ur=e=>({u_pixel_extrude_scale:[1/e.width,1/e.height]}),dr=e=>({u_viewport_size:[e.width,e.height]}),fr=(e,t=1)=>({u_color:e,u_overlay:0,u_overlay_scale:t}),pr=(e,n,r,i)=>{let a=t.aK(e,1,n)/(t.a6*2**e.tileID.overscaledZ)*2*Math.PI*i;return{u_extrude_scale:t.aK(e,1,n),u_intensity:r,u_globe_extrude_scale:a}},mr=(e,n,r,i)=>{let a=t.O();t.c7(a,0,e.width,e.height,0,0,1);let o=e.context.gl;return{u_matrix:a,u_world:[o.drawingBufferWidth,o.drawingBufferHeight],u_image:r,u_color_ramp:i,u_opacity:n.paint.get(`heatmap-opacity`)}},hr=(e,t,n)=>{let r=n.paint.get(`hillshade-accent-color`),i;switch(n.paint.get(`hillshade-method`)){case`basic`:i=4;break;case`combined`:i=1;break;case`igor`:i=2;break;case`multidirectional`:i=3;break;default:i=0}let a=n.getIlluminationProperties();for(let t=0;t<a.directionRadians.length;t++)n.paint.get(`hillshade-illumination-anchor`)===`viewport`&&(a.directionRadians[t]+=e.transform.bearingInRadians);return{u_image:0,u_latrange:I(0,t.tileID),u_exaggeration:n.paint.get(`hillshade-exaggeration`),u_altitudes:a.altitudeRadians,u_azimuths:a.directionRadians,u_accent:r,u_method:i,u_highlights:a.highlightColor,u_shadows:a.shadowColor}},gr=(e,n)=>{let r=n.stride,i=t.O();return t.c7(i,0,t.a6,-t.a6,0,0,1),t.Q(i,i,[0,-t.a6,0]),{u_matrix:i,u_image:1,u_dimension:[r,r],u_zoom:e.overscaledZ,u_unpack:n.getUnpackVector()}};function I(e,n){let r=2**n.canonical.z,i=n.canonical.y;return[new t.a7(0,i/r).toLngLat().lat,new t.a7(0,(i+1)/r).toLngLat().lat]}let L=(e,t,n=0)=>({u_image:0,u_unpack:t.getUnpackVector(),u_dimension:[t.stride,t.stride],u_elevation_stops:1,u_color_stops:4,u_color_ramp_size:n,u_opacity:e.paint.get(`color-relief-opacity`)}),_r=(e,n,r,i)=>{let a=e.transform;return{u_translation:Cr(e,n,r),u_ratio:i/t.aK(n,1,a.zoom),u_device_pixel_ratio:e.pixelRatio,u_units_to_pixels:[1/a.pixelsToGLUnits[0],1/a.pixelsToGLUnits[1]]}},vr=(e,n,r,i,a)=>t.e(_r(e,n,r,i),{u_image:0,u_image_height:a}),yr=(e,n,r,i,a)=>{let o=e.transform,s=Sr(n,o);return{u_translation:Cr(e,n,r),u_texsize:n.imageAtlasTexture.size,u_ratio:i/t.aK(n,1,o.zoom),u_device_pixel_ratio:e.pixelRatio,u_image:0,u_scale:[s,a.fromScale,a.toScale],u_fade:a.t,u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]]}},br=(e,n,r,i,a)=>{let o=Sr(n,e.transform);return t.e(_r(e,n,r,i),{u_tileratio:o,u_crossfade_from:a.fromScale,u_crossfade_to:a.toScale,u_image:0,u_mix:a.t,u_lineatlas_width:e.lineAtlas.width,u_lineatlas_height:e.lineAtlas.height})},xr=(e,n,r,i,a,o)=>{let s=Sr(n,e.transform);return t.e(_r(e,n,r,i),{u_image:0,u_image_height:o,u_tileratio:s,u_crossfade_from:a.fromScale,u_crossfade_to:a.toScale,u_image_dash:1,u_mix:a.t,u_lineatlas_width:e.lineAtlas.width,u_lineatlas_height:e.lineAtlas.height})};function Sr(e,n){return 1/t.aK(e,1,n.tileZoom)}function Cr(e,n,r){return t.aL(e.transform,n,r.paint.get(`line-translate`),r.paint.get(`line-translate-anchor`))}let wr=(e,t,n,r,i)=>{return{u_tl_parent:e,u_scale_parent:t,u_buffer_scale:1,u_fade_t:n.mix,u_opacity:n.opacity*r.paint.get(`raster-opacity`),u_image0:0,u_image1:1,u_brightness_low:r.paint.get(`raster-brightness-min`),u_brightness_high:r.paint.get(`raster-brightness-max`),u_saturation_factor:(o=r.paint.get(`raster-saturation`),o>0?1-1/(1.001-o):-o),u_contrast_factor:(a=r.paint.get(`raster-contrast`),a>0?1/(1-a):1+a),u_spin_weights:Tr(r.paint.get(`raster-hue-rotate`)),u_coords_top:[i[0].x,i[0].y,i[1].x,i[1].y],u_coords_bottom:[i[3].x,i[3].y,i[2].x,i[2].y]};var a,o};function Tr(e){e*=Math.PI/180;let t=Math.sin(e),n=Math.cos(e);return[(2*n+1)/3,(-Math.sqrt(3)*t-n+1)/3,(Math.sqrt(3)*t-n+1)/3]}let Er=(e,t,n,r,i,a,o,s,c,l,u,d,f)=>{let p=o.transform;return{u_is_size_zoom_constant:+(e===`constant`||e===`source`),u_is_size_feature_constant:+(e===`constant`||e===`camera`),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:p.cameraToCenterDistance,u_pitch:p.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:p.width/p.height,u_fade_change:o.options.fadeDuration?o.symbolFadeChange:1,u_label_plane_matrix:s,u_coord_matrix:c,u_is_text:+u,u_pitch_with_map:+r,u_is_along_line:i,u_is_variable_anchor:a,u_texsize:d,u_texture:0,u_translation:l,u_pitched_scale:f}},Dr=(e,n,r,i,a,o,s,c,l,u,d,f,p,m)=>{let h=s.transform;return t.e(Er(e,n,r,i,a,o,s,c,l,u,d,f,m),{u_gamma_scale:i?Math.cos(h.pitch*Math.PI/180)*h.cameraToCenterDistance:1,u_device_pixel_ratio:s.pixelRatio,u_is_halo:+!!p,u_is_plain:1})},Or=(e,n,r,i,a,o,s,c,l,u,d,f,p)=>t.e(Dr(e,n,r,i,a,o,s,c,l,u,!0,d,!0,p),{u_texsize_icon:f,u_texture_icon:1}),kr=(e,t)=>({u_opacity:e,u_color:t}),Ar=(e,n,r,i,a)=>t.e(function(e,n,r,i){let a=r.imageManager.getPattern(e.from.toString()),o=r.imageManager.getPattern(e.to.toString()),{width:s,height:c}=r.imageManager.getPixelSize(),l=2**i.tileID.overscaledZ,u=i.tileSize*2**r.transform.tileZoom/l,d=u*(i.tileID.canonical.x+i.tileID.wrap*l),f=u*i.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:a.tl,u_pattern_br_a:a.br,u_pattern_tl_b:o.tl,u_pattern_br_b:o.br,u_texsize:[s,c],u_mix:n.t,u_pattern_size_a:a.displaySize,u_pattern_size_b:o.displaySize,u_scale_a:n.fromScale,u_scale_b:n.toScale,u_tile_units_to_pixels:1/t.aK(i,1,r.transform.tileZoom),u_pixel_coord_upper:[d>>16,f>>16],u_pixel_coord_lower:[65535&d,65535&f]}}(r,a,n,i),{u_opacity:e}),jr=(e,t)=>{},Mr={fillExtrusion:(e,n)=>({u_lightpos:new t.c2(e,n.u_lightpos),u_lightpos_globe:new t.c2(e,n.u_lightpos_globe),u_lightintensity:new t.bp(e,n.u_lightintensity),u_lightcolor:new t.c2(e,n.u_lightcolor),u_vertical_gradient:new t.bp(e,n.u_vertical_gradient),u_opacity:new t.bp(e,n.u_opacity),u_fill_translate:new t.c3(e,n.u_fill_translate)}),fillExtrusionPattern:(e,n)=>({u_lightpos:new t.c2(e,n.u_lightpos),u_lightpos_globe:new t.c2(e,n.u_lightpos_globe),u_lightintensity:new t.bp(e,n.u_lightintensity),u_lightcolor:new t.c2(e,n.u_lightcolor),u_vertical_gradient:new t.bp(e,n.u_vertical_gradient),u_height_factor:new t.bp(e,n.u_height_factor),u_opacity:new t.bp(e,n.u_opacity),u_fill_translate:new t.c3(e,n.u_fill_translate),u_image:new t.b_(e,n.u_image),u_texsize:new t.c3(e,n.u_texsize),u_pixel_coord_upper:new t.c3(e,n.u_pixel_coord_upper),u_pixel_coord_lower:new t.c3(e,n.u_pixel_coord_lower),u_scale:new t.c2(e,n.u_scale),u_fade:new t.bp(e,n.u_fade)}),fill:(e,n)=>({u_fill_translate:new t.c3(e,n.u_fill_translate)}),fillPattern:(e,n)=>({u_image:new t.b_(e,n.u_image),u_texsize:new t.c3(e,n.u_texsize),u_pixel_coord_upper:new t.c3(e,n.u_pixel_coord_upper),u_pixel_coord_lower:new t.c3(e,n.u_pixel_coord_lower),u_scale:new t.c2(e,n.u_scale),u_fade:new t.bp(e,n.u_fade),u_fill_translate:new t.c3(e,n.u_fill_translate)}),fillOutline:(e,n)=>({u_world:new t.c3(e,n.u_world),u_fill_translate:new t.c3(e,n.u_fill_translate)}),fillOutlinePattern:(e,n)=>({u_world:new t.c3(e,n.u_world),u_image:new t.b_(e,n.u_image),u_texsize:new t.c3(e,n.u_texsize),u_pixel_coord_upper:new t.c3(e,n.u_pixel_coord_upper),u_pixel_coord_lower:new t.c3(e,n.u_pixel_coord_lower),u_scale:new t.c2(e,n.u_scale),u_fade:new t.bp(e,n.u_fade),u_fill_translate:new t.c3(e,n.u_fill_translate)}),circle:(e,n)=>({u_camera_to_center_distance:new t.bp(e,n.u_camera_to_center_distance),u_scale_with_map:new t.b_(e,n.u_scale_with_map),u_pitch_with_map:new t.b_(e,n.u_pitch_with_map),u_extrude_scale:new t.c3(e,n.u_extrude_scale),u_device_pixel_ratio:new t.bp(e,n.u_device_pixel_ratio),u_globe_extrude_scale:new t.bp(e,n.u_globe_extrude_scale),u_translate:new t.c3(e,n.u_translate)}),collisionBox:(e,n)=>({u_pixel_extrude_scale:new t.c3(e,n.u_pixel_extrude_scale)}),collisionCircle:(e,n)=>({u_viewport_size:new t.c3(e,n.u_viewport_size)}),debug:(e,n)=>({u_color:new t.b$(e,n.u_color),u_overlay:new t.b_(e,n.u_overlay),u_overlay_scale:new t.bp(e,n.u_overlay_scale)}),depth:jr,clippingMask:jr,heatmap:(e,n)=>({u_extrude_scale:new t.bp(e,n.u_extrude_scale),u_intensity:new t.bp(e,n.u_intensity),u_globe_extrude_scale:new t.bp(e,n.u_globe_extrude_scale)}),heatmapTexture:(e,n)=>({u_matrix:new t.c0(e,n.u_matrix),u_world:new t.c3(e,n.u_world),u_image:new t.b_(e,n.u_image),u_color_ramp:new t.b_(e,n.u_color_ramp),u_opacity:new t.bp(e,n.u_opacity)}),hillshade:(e,n)=>({u_image:new t.b_(e,n.u_image),u_latrange:new t.c3(e,n.u_latrange),u_exaggeration:new t.bp(e,n.u_exaggeration),u_altitudes:new t.c9(e,n.u_altitudes),u_azimuths:new t.c9(e,n.u_azimuths),u_accent:new t.b$(e,n.u_accent),u_method:new t.b_(e,n.u_method),u_shadows:new t.c8(e,n.u_shadows),u_highlights:new t.c8(e,n.u_highlights)}),hillshadePrepare:(e,n)=>({u_matrix:new t.c0(e,n.u_matrix),u_image:new t.b_(e,n.u_image),u_dimension:new t.c3(e,n.u_dimension),u_zoom:new t.bp(e,n.u_zoom),u_unpack:new t.c1(e,n.u_unpack)}),colorRelief:(e,n)=>({u_image:new t.b_(e,n.u_image),u_unpack:new t.c1(e,n.u_unpack),u_dimension:new t.c3(e,n.u_dimension),u_elevation_stops:new t.b_(e,n.u_elevation_stops),u_color_stops:new t.b_(e,n.u_color_stops),u_color_ramp_size:new t.b_(e,n.u_color_ramp_size),u_opacity:new t.bp(e,n.u_opacity)}),line:(e,n)=>({u_translation:new t.c3(e,n.u_translation),u_ratio:new t.bp(e,n.u_ratio),u_device_pixel_ratio:new t.bp(e,n.u_device_pixel_ratio),u_units_to_pixels:new t.c3(e,n.u_units_to_pixels)}),lineGradient:(e,n)=>({u_translation:new t.c3(e,n.u_translation),u_ratio:new t.bp(e,n.u_ratio),u_device_pixel_ratio:new t.bp(e,n.u_device_pixel_ratio),u_units_to_pixels:new t.c3(e,n.u_units_to_pixels),u_image:new t.b_(e,n.u_image),u_image_height:new t.bp(e,n.u_image_height)}),linePattern:(e,n)=>({u_translation:new t.c3(e,n.u_translation),u_texsize:new t.c3(e,n.u_texsize),u_ratio:new t.bp(e,n.u_ratio),u_device_pixel_ratio:new t.bp(e,n.u_device_pixel_ratio),u_image:new t.b_(e,n.u_image),u_units_to_pixels:new t.c3(e,n.u_units_to_pixels),u_scale:new t.c2(e,n.u_scale),u_fade:new t.bp(e,n.u_fade)}),lineSDF:(e,n)=>({u_translation:new t.c3(e,n.u_translation),u_ratio:new t.bp(e,n.u_ratio),u_device_pixel_ratio:new t.bp(e,n.u_device_pixel_ratio),u_units_to_pixels:new t.c3(e,n.u_units_to_pixels),u_image:new t.b_(e,n.u_image),u_mix:new t.bp(e,n.u_mix),u_tileratio:new t.bp(e,n.u_tileratio),u_crossfade_from:new t.bp(e,n.u_crossfade_from),u_crossfade_to:new t.bp(e,n.u_crossfade_to),u_lineatlas_width:new t.bp(e,n.u_lineatlas_width),u_lineatlas_height:new t.bp(e,n.u_lineatlas_height)}),lineGradientSDF:(e,n)=>({u_translation:new t.c3(e,n.u_translation),u_ratio:new t.bp(e,n.u_ratio),u_device_pixel_ratio:new t.bp(e,n.u_device_pixel_ratio),u_units_to_pixels:new t.c3(e,n.u_units_to_pixels),u_image:new t.b_(e,n.u_image),u_image_height:new t.bp(e,n.u_image_height),u_tileratio:new t.bp(e,n.u_tileratio),u_crossfade_from:new t.bp(e,n.u_crossfade_from),u_crossfade_to:new t.bp(e,n.u_crossfade_to),u_image_dash:new t.b_(e,n.u_image_dash),u_mix:new t.bp(e,n.u_mix),u_lineatlas_width:new t.bp(e,n.u_lineatlas_width),u_lineatlas_height:new t.bp(e,n.u_lineatlas_height)}),raster:(e,n)=>({u_tl_parent:new t.c3(e,n.u_tl_parent),u_scale_parent:new t.bp(e,n.u_scale_parent),u_buffer_scale:new t.bp(e,n.u_buffer_scale),u_fade_t:new t.bp(e,n.u_fade_t),u_opacity:new t.bp(e,n.u_opacity),u_image0:new t.b_(e,n.u_image0),u_image1:new t.b_(e,n.u_image1),u_brightness_low:new t.bp(e,n.u_brightness_low),u_brightness_high:new t.bp(e,n.u_brightness_high),u_saturation_factor:new t.bp(e,n.u_saturation_factor),u_contrast_factor:new t.bp(e,n.u_contrast_factor),u_spin_weights:new t.c2(e,n.u_spin_weights),u_coords_top:new t.c1(e,n.u_coords_top),u_coords_bottom:new t.c1(e,n.u_coords_bottom)}),symbolIcon:(e,n)=>({u_is_size_zoom_constant:new t.b_(e,n.u_is_size_zoom_constant),u_is_size_feature_constant:new t.b_(e,n.u_is_size_feature_constant),u_size_t:new t.bp(e,n.u_size_t),u_size:new t.bp(e,n.u_size),u_camera_to_center_distance:new t.bp(e,n.u_camera_to_center_distance),u_pitch:new t.bp(e,n.u_pitch),u_rotate_symbol:new t.b_(e,n.u_rotate_symbol),u_aspect_ratio:new t.bp(e,n.u_aspect_ratio),u_fade_change:new t.bp(e,n.u_fade_change),u_label_plane_matrix:new t.c0(e,n.u_label_plane_matrix),u_coord_matrix:new t.c0(e,n.u_coord_matrix),u_is_text:new t.b_(e,n.u_is_text),u_pitch_with_map:new t.b_(e,n.u_pitch_with_map),u_is_along_line:new t.b_(e,n.u_is_along_line),u_is_variable_anchor:new t.b_(e,n.u_is_variable_anchor),u_texsize:new t.c3(e,n.u_texsize),u_texture:new t.b_(e,n.u_texture),u_translation:new t.c3(e,n.u_translation),u_pitched_scale:new t.bp(e,n.u_pitched_scale)}),symbolSDF:(e,n)=>({u_is_size_zoom_constant:new t.b_(e,n.u_is_size_zoom_constant),u_is_size_feature_constant:new t.b_(e,n.u_is_size_feature_constant),u_size_t:new t.bp(e,n.u_size_t),u_size:new t.bp(e,n.u_size),u_camera_to_center_distance:new t.bp(e,n.u_camera_to_center_distance),u_pitch:new t.bp(e,n.u_pitch),u_rotate_symbol:new t.b_(e,n.u_rotate_symbol),u_aspect_ratio:new t.bp(e,n.u_aspect_ratio),u_fade_change:new t.bp(e,n.u_fade_change),u_label_plane_matrix:new t.c0(e,n.u_label_plane_matrix),u_coord_matrix:new t.c0(e,n.u_coord_matrix),u_is_text:new t.b_(e,n.u_is_text),u_pitch_with_map:new t.b_(e,n.u_pitch_with_map),u_is_along_line:new t.b_(e,n.u_is_along_line),u_is_variable_anchor:new t.b_(e,n.u_is_variable_anchor),u_texsize:new t.c3(e,n.u_texsize),u_texture:new t.b_(e,n.u_texture),u_gamma_scale:new t.bp(e,n.u_gamma_scale),u_device_pixel_ratio:new t.bp(e,n.u_device_pixel_ratio),u_is_halo:new t.b_(e,n.u_is_halo),u_is_plain:new t.b_(e,n.u_is_plain),u_translation:new t.c3(e,n.u_translation),u_pitched_scale:new t.bp(e,n.u_pitched_scale)}),symbolTextAndIcon:(e,n)=>({u_is_size_zoom_constant:new t.b_(e,n.u_is_size_zoom_constant),u_is_size_feature_constant:new t.b_(e,n.u_is_size_feature_constant),u_size_t:new t.bp(e,n.u_size_t),u_size:new t.bp(e,n.u_size),u_camera_to_center_distance:new t.bp(e,n.u_camera_to_center_distance),u_pitch:new t.bp(e,n.u_pitch),u_rotate_symbol:new t.b_(e,n.u_rotate_symbol),u_aspect_ratio:new t.bp(e,n.u_aspect_ratio),u_fade_change:new t.bp(e,n.u_fade_change),u_label_plane_matrix:new t.c0(e,n.u_label_plane_matrix),u_coord_matrix:new t.c0(e,n.u_coord_matrix),u_is_text:new t.b_(e,n.u_is_text),u_pitch_with_map:new t.b_(e,n.u_pitch_with_map),u_is_along_line:new t.b_(e,n.u_is_along_line),u_is_variable_anchor:new t.b_(e,n.u_is_variable_anchor),u_texsize:new t.c3(e,n.u_texsize),u_texsize_icon:new t.c3(e,n.u_texsize_icon),u_texture:new t.b_(e,n.u_texture),u_texture_icon:new t.b_(e,n.u_texture_icon),u_gamma_scale:new t.bp(e,n.u_gamma_scale),u_device_pixel_ratio:new t.bp(e,n.u_device_pixel_ratio),u_is_halo:new t.b_(e,n.u_is_halo),u_translation:new t.c3(e,n.u_translation),u_pitched_scale:new t.bp(e,n.u_pitched_scale)}),background:(e,n)=>({u_opacity:new t.bp(e,n.u_opacity),u_color:new t.b$(e,n.u_color)}),backgroundPattern:(e,n)=>({u_opacity:new t.bp(e,n.u_opacity),u_image:new t.b_(e,n.u_image),u_pattern_tl_a:new t.c3(e,n.u_pattern_tl_a),u_pattern_br_a:new t.c3(e,n.u_pattern_br_a),u_pattern_tl_b:new t.c3(e,n.u_pattern_tl_b),u_pattern_br_b:new t.c3(e,n.u_pattern_br_b),u_texsize:new t.c3(e,n.u_texsize),u_mix:new t.bp(e,n.u_mix),u_pattern_size_a:new t.c3(e,n.u_pattern_size_a),u_pattern_size_b:new t.c3(e,n.u_pattern_size_b),u_scale_a:new t.bp(e,n.u_scale_a),u_scale_b:new t.bp(e,n.u_scale_b),u_pixel_coord_upper:new t.c3(e,n.u_pixel_coord_upper),u_pixel_coord_lower:new t.c3(e,n.u_pixel_coord_lower),u_tile_units_to_pixels:new t.bp(e,n.u_tile_units_to_pixels)}),terrain:(e,n)=>({u_texture:new t.b_(e,n.u_texture),u_ele_delta:new t.bp(e,n.u_ele_delta),u_fog_matrix:new t.c0(e,n.u_fog_matrix),u_fog_color:new t.b$(e,n.u_fog_color),u_fog_ground_blend:new t.bp(e,n.u_fog_ground_blend),u_fog_ground_blend_opacity:new t.bp(e,n.u_fog_ground_blend_opacity),u_horizon_color:new t.b$(e,n.u_horizon_color),u_horizon_fog_blend:new t.bp(e,n.u_horizon_fog_blend),u_is_globe_mode:new t.bp(e,n.u_is_globe_mode)}),terrainDepth:(e,n)=>({u_ele_delta:new t.bp(e,n.u_ele_delta)}),terrainCoords:(e,n)=>({u_texture:new t.b_(e,n.u_texture),u_terrain_coords_id:new t.bp(e,n.u_terrain_coords_id),u_ele_delta:new t.bp(e,n.u_ele_delta)}),projectionErrorMeasurement:(e,n)=>({u_input:new t.bp(e,n.u_input),u_output_expected:new t.bp(e,n.u_output_expected)}),atmosphere:(e,n)=>({u_sun_pos:new t.c2(e,n.u_sun_pos),u_atmosphere_blend:new t.bp(e,n.u_atmosphere_blend),u_globe_position:new t.c2(e,n.u_globe_position),u_globe_radius:new t.bp(e,n.u_globe_radius),u_inv_proj_matrix:new t.c0(e,n.u_inv_proj_matrix)}),sky:(e,n)=>({u_sky_color:new t.b$(e,n.u_sky_color),u_horizon_color:new t.b$(e,n.u_horizon_color),u_horizon:new t.c3(e,n.u_horizon),u_horizon_normal:new t.c3(e,n.u_horizon_normal),u_sky_horizon_blend:new t.bp(e,n.u_sky_horizon_blend),u_sky_blend:new t.bp(e,n.u_sky_blend)})};class Nr{constructor(e,t,n){this.context=e;let r=e.gl;this.buffer=r.createBuffer(),this.dynamicDraw=!!n,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),r.bufferData(r.ELEMENT_ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?r.DYNAMIC_DRAW:r.STATIC_DRAW),this.dynamicDraw||t.freeBufferAfterUpload()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){let t=this.context.gl;if(!this.dynamicDraw)throw Error(`Attempted to update data while not in dynamic mode.`);this.context.unbindVAO(),this.bind(),t.bufferSubData(t.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}let Pr={Int8:`BYTE`,Uint8:`UNSIGNED_BYTE`,Int16:`SHORT`,Uint16:`UNSIGNED_SHORT`,Int32:`INT`,Uint32:`UNSIGNED_INT`,Float32:`FLOAT`};class R{constructor(e,t,n,r){this.length=t.length,this.attributes=n,this.itemSize=t.bytesPerElement,this.dynamicDraw=r,this.context=e;let i=e.gl;this.buffer=i.createBuffer(),e.bindVertexBuffer.set(this.buffer),i.bufferData(i.ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?i.DYNAMIC_DRAW:i.STATIC_DRAW),this.dynamicDraw||t.freeBufferAfterUpload()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){if(e.length!==this.length)throw Error(`Length of new data is ${e.length}, which doesn't match current length of ${this.length}`);let t=this.context.gl;this.bind(),t.bufferSubData(t.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,t){for(let n of this.attributes){let r=t.attributes[n.name];r!==void 0&&e.enableVertexAttribArray(r)}}setVertexAttribPointers(e,t,n){for(let r of this.attributes){let i=t.attributes[r.name];i!==void 0&&e.vertexAttribPointer(i,r.components,e[Pr[r.type]],!1,this.itemSize,r.offset+this.itemSize*(n||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class z{constructor(e){this.gl=e.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(e){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class Fr extends z{getDefault(){return t.bo.transparent}set(e){let t=this.current;(e.r!==t.r||e.g!==t.g||e.b!==t.b||e.a!==t.a||this.dirty)&&(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class Ir extends z{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}class Lr extends z{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}class Rr extends z{getDefault(){return[!0,!0,!0,!0]}set(e){let t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||this.dirty)&&(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class zr extends z{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}class Br extends z{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class Vr extends z{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){let t=this.current;(e.func!==t.func||e.ref!==t.ref||e.mask!==t.mask||this.dirty)&&(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}}class Hr extends z{getDefault(){let e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){let t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||this.dirty)&&(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}}class Ur extends z{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.STENCIL_TEST):t.disable(t.STENCIL_TEST),this.current=e,this.dirty=!1}}class Wr extends z{getDefault(){return[0,1]}set(e){let t=this.current;(e[0]!==t[0]||e[1]!==t[1]||this.dirty)&&(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}}class Gr extends z{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.DEPTH_TEST):t.disable(t.DEPTH_TEST),this.current=e,this.dirty=!1}}class Kr extends z{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}}class qr extends z{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.BLEND):t.disable(t.BLEND),this.current=e,this.dirty=!1}}class Jr extends z{getDefault(){let e=this.gl;return[e.ONE,e.ZERO]}set(e){let t=this.current;(e[0]!==t[0]||e[1]!==t[1]||this.dirty)&&(this.gl.blendFunc(e[0],e[1]),this.current=e,this.dirty=!1)}}class Yr extends z{getDefault(){return t.bo.transparent}set(e){let t=this.current;(e.r!==t.r||e.g!==t.g||e.b!==t.b||e.a!==t.a||this.dirty)&&(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class Xr extends z{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}}class Zr extends z{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.CULL_FACE):t.disable(t.CULL_FACE),this.current=e,this.dirty=!1}}class Qr extends z{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}}class $r extends z{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}}class ei extends z{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}}class ti extends z{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}}class ni extends z{getDefault(){let e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){let t=this.current;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3]||this.dirty)&&(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class ri extends z{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,e),this.current=e,this.dirty=!1}}class ii extends z{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindRenderbuffer(t.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class ai extends z{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindTexture(t.TEXTURE_2D,e),this.current=e,this.dirty=!1}}class oi extends z{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindBuffer(t.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class si extends z{getDefault(){return null}set(e){let t=this.gl;t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class ci extends z{getDefault(){return null}set(e){var t;if(e===this.current&&!this.dirty)return;let n=this.gl;bn(n)?n.bindVertexArray(e):(t=n.getExtension(`OES_vertex_array_object`))==null||t.bindVertexArrayOES(e),this.current=e,this.dirty=!1}}class li extends z{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.pixelStorei(t.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}}class ui extends z{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}}class di extends z{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}}class fi extends z{constructor(e,t){super(e),this.context=e,this.parent=t}getDefault(){return null}}class pi extends fi{setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let t=this.gl;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}}class mi extends fi{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let t=this.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class hi extends fi{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let t=this.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,e),this.current=e,this.dirty=!1}}let gi=`Framebuffer is not complete`;class _i{constructor(e,t,n,r,i){this.context=e,this.width=t,this.height=n;let a=e.gl,o=this.framebuffer=a.createFramebuffer();if(this.colorAttachment=new pi(e,o),r)this.depthAttachment=i?new hi(e,o):new mi(e,o);else if(i)throw Error(`Stencil cannot be set without depth`);if(a.checkFramebufferStatus(a.FRAMEBUFFER)!==a.FRAMEBUFFER_COMPLETE)throw Error(gi)}destroy(){let e=this.context.gl,t=this.colorAttachment.get();if(t&&e.deleteTexture(t),this.depthAttachment){let t=this.depthAttachment.get();t&&e.deleteRenderbuffer(t)}e.deleteFramebuffer(this.framebuffer)}}class vi{constructor(e){if(this.gl=e,this.clearColor=new Fr(this),this.clearDepth=new Ir(this),this.clearStencil=new Lr(this),this.colorMask=new Rr(this),this.depthMask=new zr(this),this.stencilMask=new Br(this),this.stencilFunc=new Vr(this),this.stencilOp=new Hr(this),this.stencilTest=new Ur(this),this.depthRange=new Wr(this),this.depthTest=new Gr(this),this.depthFunc=new Kr(this),this.blend=new qr(this),this.blendFunc=new Jr(this),this.blendColor=new Yr(this),this.blendEquation=new Xr(this),this.cullFace=new Zr(this),this.cullFaceSide=new Qr(this),this.frontFace=new $r(this),this.program=new ei(this),this.activeTexture=new ti(this),this.viewport=new ni(this),this.bindFramebuffer=new ri(this),this.bindRenderbuffer=new ii(this),this.bindTexture=new ai(this),this.bindVertexBuffer=new oi(this),this.bindElementBuffer=new si(this),this.bindVertexArray=new ci(this),this.pixelStoreUnpack=new li(this),this.pixelStoreUnpackPremultiplyAlpha=new ui(this),this.pixelStoreUnpackFlipY=new di(this),this.extTextureFilterAnisotropic=e.getExtension(`EXT_texture_filter_anisotropic`),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),bn(e)){this.HALF_FLOAT=e.HALF_FLOAT;let t=e.getExtension(`EXT_color_buffer_half_float`);this.RGBA16F=e.RGBA16F??t?.RGBA16F_EXT,this.RGB16F=e.RGB16F??t?.RGB16F_EXT,e.getExtension(`EXT_color_buffer_float`)}else{e.getExtension(`EXT_color_buffer_half_float`),e.getExtension(`OES_texture_half_float_linear`);let t=e.getExtension(`OES_texture_half_float`);this.HALF_FLOAT=t?.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(e,t){return new Nr(this,e,t)}createVertexBuffer(e,t,n){return new R(this,e,t,n)}createRenderbuffer(e,t,n){let r=this.gl,i=r.createRenderbuffer();return this.bindRenderbuffer.set(i),r.renderbufferStorage(r.RENDERBUFFER,e,t,n),this.bindRenderbuffer.set(null),i}createFramebuffer(e,t,n,r){return new _i(this,e,t,n,r)}clear({color:e,depth:t,stencil:n}){let r=this.gl,i=0;e&&(i|=r.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),t!==void 0&&(i|=r.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(t),this.depthMask.set(!0)),n!==void 0&&(i|=r.STENCIL_BUFFER_BIT,this.clearStencil.set(n),this.stencilMask.set(255)),r.clear(i)}setCullFace(e){!1===e.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func!==this.gl.ALWAYS||e.mask?(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range)):this.depthTest.set(!1)}setStencilMode(e){e.test.func!==this.gl.ALWAYS||e.mask?(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask})):this.stencilTest.set(!1)}setColorMode(e){t.bQ(e.blendFunction,mn.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)}createVertexArray(){return bn(this.gl)?this.gl.createVertexArray():this.gl.getExtension(`OES_vertex_array_object`)?.createVertexArrayOES()}deleteVertexArray(e){var t;bn(this.gl)?this.gl.deleteVertexArray(e):(t=this.gl.getExtension(`OES_vertex_array_object`))==null||t.deleteVertexArrayOES(e)}unbindVAO(){this.bindVertexArray.set(null)}}let yi;function B(e,n,r,i,a){let o=e.context,s=e.transform,c=o.gl,l=e.useProgram(`collisionBox`),u=[],d=0,f=0;for(let t of i){let i=n.getTile(t).getBucket(r);if(!i)continue;let p=a?i.textCollisionBox:i.iconCollisionBox,m=i.collisionCircleArray;m.length>0&&(u.push({circleArray:m,circleOffset:f,coord:t}),d+=m.length/4,f=d),p&&l.draw(o,c.LINES,_n.disabled,yn.disabled,e.colorModeForRenderPass(),gn.disabled,ur(e.transform),e.style.map.terrain?.getTerrainData(t),s.getProjectionData({overscaledTileID:t,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),r.id,p.layoutVertexBuffer,p.indexBuffer,p.segments,null,e.transform.zoom,null,null,p.collisionVertexBuffer)}if(!a||!u.length)return;let p=e.useProgram(`collisionCircle`),m=new t.ca;m.resize(4*d),m._trim();let h=0;for(let e of u)for(let t=0;t<e.circleArray.length/4;t++){let n=4*t,r=e.circleArray[n+0],i=e.circleArray[n+1],a=e.circleArray[n+2],o=e.circleArray[n+3];m.emplace(h++,r,i,a,o,0),m.emplace(h++,r,i,a,o,1),m.emplace(h++,r,i,a,o,2),m.emplace(h++,r,i,a,o,3)}(!yi||yi.length<2*d)&&(yi=function(e){let n=2*e,r=new t.cc;r.resize(n),r._trim();for(let e=0;e<n;e++){let t=6*e;r.uint16[t+0]=4*e+0,r.uint16[t+1]=4*e+1,r.uint16[t+2]=4*e+2,r.uint16[t+3]=4*e+2,r.uint16[t+4]=4*e+3,r.uint16[t+5]=4*e+0}return r}(d));let g=o.createIndexBuffer(yi,!0),_=o.createVertexBuffer(m,t.cb.members,!0);for(let n of u){let i=dr(e.transform);p.draw(o,c.TRIANGLES,_n.disabled,yn.disabled,e.colorModeForRenderPass(),gn.disabled,i,e.style.map.terrain?.getTerrainData(n.coord),null,r.id,_,g,t.aV.simpleSegment(0,2*n.circleOffset,n.circleArray.length,n.circleArray.length/2),null,e.transform.zoom,null,null,null)}_.destroy(),g.destroy()}let bi=t.ap(new Float32Array(16));function xi(e,n,r,i,a,o){let{horizontalAlign:s,verticalAlign:c}=t.aP(e);return new t.P((-(s-.5)*n/a+i[0])*o,(-(c-.5)*r/a+i[1])*o)}function Si(e,n,r,i,a,o){let s=n.tileAnchorPoint.add(new t.P(n.translation[0],n.translation[1]));if(n.pitchWithMap){let e=i.mult(o);r||(e=e.rotate(-a));let t=s.add(e);return st(t.x,t.y,n.pitchedLabelPlaneMatrix,n.getElevation).point}if(r){let t=gt(n.tileAnchorPoint.x+1,n.tileAnchorPoint.y,n).point.sub(e),r=Math.atan(t.y/t.x)+(t.x<0?Math.PI:0);return e.add(i.rotate(r))}return e.add(i)}function Ci(e,n,r,i,a,o,s,c,l,u,d,f){let p=e.text.placedSymbolArray,m=e.text.dynamicLayoutVertexArray,h=e.icon.dynamicLayoutVertexArray,g={};m.clear();for(let h=0;h<p.length;h++){let _=p.get(h),v=_.hidden||!_.crossTileID||e.allowVerticalPlacement&&!_.placedOrientation?null:i[_.crossTileID];if(v){let i=new t.P(_.anchorX,_.anchorY),p={getElevation:f,width:a.width,height:a.height,pitchedLabelPlaneMatrix:o,pitchWithMap:r,transform:a,tileAnchorPoint:i,translation:u,unwrappedTileID:d},h=r?vt(i.x,i.y,p):gt(i.x,i.y,p),y=ct(a.cameraToCenterDistance,h.signedDistanceFromCamera),b=t.ay(e.textSizeData,c,_)*y/t.aJ;r&&(b*=e.tilePixelRatio/s);let{width:x,height:S,anchor:C,textOffset:w,textBoxScale:T}=v,E=xi(C,x,S,w,T,b),D=a.getPitchedTextCorrection(i.x+u[0],i.y+u[1],d),O=Si(h.point,p,n,E,-a.bearingInRadians,D),k=e.allowVerticalPlacement&&_.placedOrientation===t.ax.vertical?Math.PI/2:0;for(let e=0;e<_.numGlyphs;e++)t.aD(m,O,k);l&&_.associatedIconIndex>=0&&(g[_.associatedIconIndex]={shiftedAnchor:O,angle:k})}else Ct(_.numGlyphs,m)}if(l){h.clear();let n=e.icon.placedSymbolArray;for(let e=0;e<n.length;e++){let r=n.get(e);if(r.hidden)Ct(r.numGlyphs,h);else{let n=g[e];if(n)for(let e=0;e<r.numGlyphs;e++)t.aD(h,n.shiftedAnchor,n.angle);else Ct(r.numGlyphs,h)}}e.icon.dynamicLayoutVertexBuffer.updateData(h)}e.text.dynamicLayoutVertexBuffer.updateData(m)}function wi(e,t,n){return n.iconsInText&&t?`symbolTextAndIcon`:e?`symbolSDF`:`symbolIcon`}function V(e,n,r,i,a,o,s,c,l,u,d,f,p){let m=e.context,h=m.gl,g=e.transform,_=c===`map`,v=l===`map`,y=c!==`viewport`&&r.layout.get(`symbol-placement`)!==`point`,b=_&&!v&&!y,x=!r.layout.get(`symbol-sort-key`).isConstant(),S=!1,C=e.getDepthModeForSublayer(0,_n.ReadOnly),w=r._unevaluatedLayout.hasValue(`text-variable-anchor`)||r._unevaluatedLayout.hasValue(`text-variable-anchor-offset`),T=[],E=g.getCircleRadiusCorrection();for(let c of i){let i=n.getTile(c),l=i.getBucket(r);if(!l)continue;let d=a?l.text:l.icon;if(!d?.segments.get().length||!d.hasVisibleVertices)continue;let f=d.programConfigurations.get(r.id),m=a||l.sdfIcons,C=a?l.textSizeData:l.iconSizeData,D=v||g.pitch!==0,O=e.useProgram(wi(m,a,l),f),k=t.aw(C,g.zoom),A=e.style.map.terrain?.getTerrainData(c),ee,te,ne,re,ie=[0,0],j=null;if(a)te=i.glyphAtlasTexture,ne=h.LINEAR,ee=i.glyphAtlasTexture.size,l.iconsInText&&(ie=i.imageAtlasTexture.size,j=i.imageAtlasTexture,re=D||e.options.rotating||e.options.zooming||C.kind===`composite`||C.kind===`camera`?h.LINEAR:h.NEAREST);else{let t=r.layout.get(`icon-size`).constantOr(0)!==1||l.iconsNeedLinear;te=i.imageAtlasTexture,ne=m||e.options.rotating||e.options.zooming||t||D?h.LINEAR:h.NEAREST,ee=i.imageAtlasTexture.size}let M=t.aK(i,1,e.transform.zoom),ae=it(_,e.transform,M),oe=at(v,_,e.transform,M),se=t.aL(g,i,o,s),ce=g.getProjectionData({overscaledTileID:c,applyGlobeMatrix:!p,applyTerrainMatrix:!0}),le=w&&l.hasTextData(),ue=r.layout.get(`icon-text-fit`)!==`none`&&le&&l.hasIconData();if(y){let n=t.O();nt(n,ae);let i=e.style.map.terrain?(t,n)=>e.style.map.terrain.getElevation(c,t,n):null;ut(l,e,a,ae,n,v,u,r.layout.get(`text-rotation-alignment`)===`map`,c.toUnwrapped(),g.width,g.height,se,i)}let de=a&&w||ue,fe=y||de?bi:v?ae:e.transform.clipSpaceToPixelsMatrix,pe=m&&r.paint.get(a?`text-halo-width`:`icon-halo-width`).constantOr(1)!==0,me;me=m?l.iconsInText?Or(C.kind,k,b,v,y,de,e,fe,oe,se,ee,ie,E):Dr(C.kind,k,b,v,y,de,e,fe,oe,se,a,ee,pe,E):Er(C.kind,k,b,v,y,de,e,fe,oe,se,a,ee,E);let he={program:O,buffers:d,uniformValues:me,projectionData:ce,atlasTexture:te,atlasTextureIcon:j,atlasInterpolation:ne,atlasInterpolationIcon:re,isSDF:m,hasHalo:pe};if(x&&l.canOverlap){S=!0;let e=d.segments.get();for(let n of e)T.push({segments:new t.aV([n]),sortKey:n.sortKey,state:he,terrainData:A})}else T.push({segments:d.segments,sortKey:0,state:he,terrainData:A})}S&&T.sort(((e,t)=>e.sortKey-t.sortKey));let D=r.paint.get(a?`text-halo-width`:`icon-halo-width`).constantOr(null)??1/0,O=r.layout.get(`text-letter-spacing`).constantOr(0)*t.aJ<0||D>1;for(let t of T){let n=t.state;m.activeTexture.set(h.TEXTURE0),n.atlasTexture.bind(n.atlasInterpolation,h.CLAMP_TO_EDGE),n.atlasTextureIcon&&(m.activeTexture.set(h.TEXTURE1),n.atlasTextureIcon&&n.atlasTextureIcon.bind(n.atlasInterpolationIcon,h.CLAMP_TO_EDGE));let i=n.isSDF&&n.hasHalo;if(i){let i=n.uniformValues;i.u_is_halo=1,O&&(i.u_is_plain=0,Ti(n.buffers,t.segments,r,e,n.program,C,d,f,i,n.projectionData,t.terrainData),i.u_is_halo=0,i.u_is_plain=1)}Ti(n.buffers,t.segments,r,e,n.program,C,d,f,n.uniformValues,n.projectionData,t.terrainData),i&&!O&&(n.uniformValues.u_is_halo=0)}}function Ti(e,t,n,r,i,a,o,s,c,l,u){let d=r.context;i.draw(d,d.gl.TRIANGLES,a,o,s,gn.backCCW,c,u,l,n.id,e.layoutVertexBuffer,e.indexBuffer,t,n.paint,r.transform.zoom,e.programConfigurations.get(n.id),e.dynamicLayoutVertexBuffer,e.opacityVertexBuffer)}function H(e,n,r,i,a){let o=e.context,s=o.gl,c=yn.disabled,l=new mn([s.ONE,s.ONE],t.bo.transparent,[!0,!0,!0,!0]),u=n.getBucket(r);if(!u)return;let d=i.key,f=r.heatmapFbos.get(d);f||(f=Ei(o,n.tileSize,n.tileSize),r.heatmapFbos.set(d,f)),o.bindFramebuffer.set(f.framebuffer),o.viewport.set([0,0,n.tileSize,n.tileSize]),o.clear({color:t.bo.transparent});let p=u.programConfigurations.get(r.id),m=e.useProgram(`heatmap`,p,!a),h=e.transform.getProjectionData({overscaledTileID:n.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),g=e.style.map.terrain.getTerrainData(i);m.draw(o,s.TRIANGLES,_n.disabled,c,l,gn.disabled,pr(n,e.transform.zoom,r.paint.get(`heatmap-intensity`),1),g,h,r.id,u.layoutVertexBuffer,u.indexBuffer,u.segments,r.paint,e.transform.zoom,p)}function U(e,t,n,r,i){let a=e.context,o=a.gl,s=e.transform;a.setColorMode(e.colorModeForRenderPass());let c=Di(a,t),l=n.key,u=t.heatmapFbos.get(l);if(!u)return;a.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,u.colorAttachment.get()),a.activeTexture.set(o.TEXTURE1),c.bind(o.LINEAR,o.CLAMP_TO_EDGE);let d=s.getProjectionData({overscaledTileID:n,applyTerrainMatrix:i,applyGlobeMatrix:!r});e.useProgram(`heatmapTexture`).draw(a,o.TRIANGLES,_n.disabled,yn.disabled,e.colorModeForRenderPass(),gn.disabled,mr(e,t,0,1),null,d,t.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments,t.paint,s.zoom),u.destroy(),t.heatmapFbos.delete(l)}function Ei(e,t,n){let r=e.gl,i=r.createTexture();r.bindTexture(r.TEXTURE_2D,i),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR);let a=e.HALF_FLOAT??r.UNSIGNED_BYTE,o=e.RGBA16F??r.RGBA;r.texImage2D(r.TEXTURE_2D,0,o,t,n,0,r.RGBA,a,null);let s=e.createFramebuffer(t,n,!1,!1);return s.colorAttachment.set(i),s}function Di(e,n){return n.colorRampTexture||=new t.T(e,n.colorRamp,e.gl.RGBA),n.colorRampTexture}function Oi(e,n,r,i,a,o,s,c){let l=256;if(a.stepInterpolant){let i=n.getSource().maxzoom,a=s.canonical.z===i?Math.ceil(1<<e.transform.maxZoom-s.canonical.z):1;l=t.al(t.ce(o.maxLineLength/t.a6*1024*a),256,r.maxTextureSize)}return c.gradient=t.cf({expression:a.gradientExpression(),evaluationKey:`lineProgress`,resolution:l,image:c.gradient||void 0,clips:o.lineClipsArray}),c.texture?c.texture.update(c.gradient):c.texture=new t.T(r,c.gradient,i.RGBA),c.version=a.gradientVersion,c.texture}function ki(e,t,n,r,i){e.activeTexture.set(t.TEXTURE0),n.imageAtlasTexture.bind(t.LINEAR,t.CLAMP_TO_EDGE),r.updatePaintBuffers(i)}function Ai(e,t,n,r,i,a){(i||e.lineAtlas.dirty)&&(t.activeTexture.set(n.TEXTURE0),e.lineAtlas.bind(t)),r.updatePaintBuffers(a)}function ji(e,t,n,r,i,a,o){let s=a.gradients[i.id],c=s.texture;i.gradientVersion!==s.version&&(c=Oi(e,t,n,r,i,a,o,s)),n.activeTexture.set(r.TEXTURE0),c.bind(i.stepInterpolant?r.NEAREST:r.LINEAR,r.CLAMP_TO_EDGE)}function Mi(e,t,n,r,i,a,o,s,c){let l=a.gradients[i.id],u=l.texture;i.gradientVersion!==l.version&&(u=Oi(e,t,n,r,i,a,o,l)),n.activeTexture.set(r.TEXTURE0),u.bind(i.stepInterpolant?r.NEAREST:r.LINEAR,r.CLAMP_TO_EDGE),n.activeTexture.set(r.TEXTURE1),e.lineAtlas.bind(n),s.updatePaintBuffers(c)}function Ni(e,t,n,r,i){if(!n||!r?.imageAtlas)return;let a=r.imageAtlas.patternPositions,o=a[n.to.toString()],s=a[n.from.toString()];if(!o&&s&&(o=s),!s&&o&&(s=o),!o||!s){let e=i.getPaintProperty(t);o=a[e],s=a[e]}o&&s&&e.setConstantPatternPositions(o,s)}function Pi(e,n,r,i,a,o,s,c){let l=e.context.gl,u=`fill-pattern`,d=r.paint.get(u),f=d?.constantOr(1),p=r.getCrossfadeParameters(),m,h,g,_,v,y=e.transform,b=r.paint.get(`fill-translate`),x=r.paint.get(`fill-translate-anchor`);s?(h=f&&!r.getPaintProperty(`fill-outline-color`)?`fillOutlinePattern`:`fillOutline`,m=l.LINES):(h=f?`fillPattern`:`fill`,m=l.TRIANGLES);let S=d.constantOr(null);for(let d of i){let i=n.getTile(d);if(f&&!i.patternsLoaded())continue;let C=i.getBucket(r);if(!C)continue;let w=C.programConfigurations.get(r.id),T=e.useProgram(h,w),E=e.style.map.terrain?.getTerrainData(d);f&&(e.context.activeTexture.set(l.TEXTURE0),i.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),w.updatePaintBuffers(p)),Ni(w,u,S,i,r);let D=y.getProjectionData({overscaledTileID:d,applyGlobeMatrix:!c,applyTerrainMatrix:!0}),O=t.aL(y,i,b,x);if(s){_=C.indexBuffer2,v=C.segments2;let t=[l.drawingBufferWidth,l.drawingBufferHeight];g=h===`fillOutlinePattern`&&f?cr(e,p,i,t,O):sr(t,O)}else _=C.indexBuffer,v=C.segments,g=f?or(e,p,i,O):{u_fill_translate:O};let k=e.stencilModeForClipping(d);T.draw(e.context,m,a,k,o,gn.backCCW,g,E,D,r.id,C.layoutVertexBuffer,_,v,r.paint,e.transform.zoom,w)}}function Fi(e,n,r,i,a,o,s,c){let l=e.context,u=l.gl,d=`fill-extrusion-pattern`,f=r.paint.get(d),p=f.constantOr(1),m=r.getCrossfadeParameters(),h=r.paint.get(`fill-extrusion-opacity`),g=f.constantOr(null),_=e.transform;for(let f of i){let i=n.getTile(f),v=i.getBucket(r);if(!v)continue;let y=e.style.map.terrain?.getTerrainData(f),b=v.programConfigurations.get(r.id),x=e.useProgram(p?`fillExtrusionPattern`:`fillExtrusion`,b);p&&(e.context.activeTexture.set(u.TEXTURE0),i.imageAtlasTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE),b.updatePaintBuffers(m));let S=_.getProjectionData({overscaledTileID:f,applyGlobeMatrix:!c,applyTerrainMatrix:!0});Ni(b,d,g,i,r);let C=t.aL(_,i,r.paint.get(`fill-extrusion-translate`),r.paint.get(`fill-extrusion-translate-anchor`)),w=r.paint.get(`fill-extrusion-vertical-gradient`),T=p?ar(e,w,h,C,f,m,i):ir(e,w,h,C);x.draw(l,l.gl.TRIANGLES,a,o,s,gn.backCCW,T,y,S,r.id,v.layoutVertexBuffer,v.indexBuffer,v.segments,r.paint,e.transform.zoom,b,e.style.map.terrain&&v.centroidVertexBuffer)}}function Ii(e,t,n,r,i,a,o,s,c){let l=e.style.projection,u=e.context,d=e.transform,f=u.gl,p=[`#define NUM_ILLUMINATION_SOURCES ${n.paint.get(`hillshade-highlight-color`).values.length}`],m=e.useProgram(`hillshade`,null,!1,p),h=!e.options.moving;for(let p of r){let r=t.getTile(p),g=r.fbo;if(!g)continue;let _=l.getMeshFromTileID(u,p.canonical,s,!0,`raster`),v=e.style.map.terrain?.getTerrainData(p);u.activeTexture.set(f.TEXTURE0),f.bindTexture(f.TEXTURE_2D,g.colorAttachment.get());let y=d.getProjectionData({overscaledTileID:p,aligned:h,applyGlobeMatrix:!c,applyTerrainMatrix:!0});m.draw(u,f.TRIANGLES,a,i[p.overscaledZ],o,gn.backCCW,hr(e,r,n),v,y,n.id,_.vertexBuffer,_.indexBuffer,_.segments)}}let Li=0;function Ri(e,n,r,i,a,o,s,c,l){let u=e.style.projection,d=e.context,f=e.transform,p=d.gl,m=e.useProgram(`colorRelief`),h=!e.options.moving,g=r.paint.get(`resampling`)===`nearest`?p.NEAREST:p.LINEAR,_=!0,v=0;for(let y of i){let i=n.getTile(y),b=i.dem;if(_){Li||=p.getParameter(p.MAX_TEXTURE_SIZE);let e=Li,{elevationTexture:t,colorTexture:n}=r.getColorRampTextures(d,e,b.getUnpackVector());d.activeTexture.set(p.TEXTURE1),t.bind(p.NEAREST,p.CLAMP_TO_EDGE),d.activeTexture.set(p.TEXTURE4),n.bind(p.LINEAR,p.CLAMP_TO_EDGE),_=!1,v=t.size[0]}if(!b?.data)continue;let x=b.stride,S=b.getPixels();if(d.activeTexture.set(p.TEXTURE0),d.pixelStoreUnpackPremultiplyAlpha.set(!1),i.demTexture||=e.getTileTexture(x),i.demTexture){let e=i.demTexture;e.update(S,{premultiply:!1}),e.bind(g,p.CLAMP_TO_EDGE)}else i.demTexture=new t.T(d,S,p.RGBA,{premultiply:!1}),i.demTexture.bind(g,p.CLAMP_TO_EDGE);let C=u.getMeshFromTileID(d,y.canonical,c,!0,`raster`),w=e.style.map.terrain?.getTerrainData(y),T=f.getProjectionData({overscaledTileID:y,aligned:h,applyGlobeMatrix:!l,applyTerrainMatrix:!0});m.draw(d,p.TRIANGLES,o,a[y.overscaledZ],s,gn.backCCW,L(r,i.dem,v),w,T,r.id,C.vertexBuffer,C.indexBuffer,C.segments)}}let zi=[new t.P(0,0),new t.P(t.a6,0),new t.P(t.a6,t.a6),new t.P(0,t.a6)];function Bi(e,t,n,r,i,a,o,s,c=!1,l=!1){let u=r[r.length-1].overscaledZ,d=e.context,f=d.gl,p=e.useProgram(`raster`),m=e.transform,h=e.style.projection,g=e.colorModeForRenderPass(),_=!e.options.moving,v=n.paint.get(`raster-opacity`),y=n.paint.get(`resampling`)===`nearest`||n.paint.get(`raster-resampling`)===`nearest`?f.NEAREST:f.LINEAR,b=n.paint.get(`raster-fade-duration`),x=!!e.style.map.terrain;for(let S of r){let r=e.getDepthModeForSublayer(S.overscaledZ-u,v===1?_n.ReadWrite:_n.ReadOnly,f.LESS),C=t.getTile(S);d.activeTexture.set(f.TEXTURE0),C.texture.bind(y,f.CLAMP_TO_EDGE,f.LINEAR_MIPMAP_NEAREST),d.activeTexture.set(f.TEXTURE1);let{parentTile:w,parentScaleBy:T,parentTopLeft:E,fadeValues:D}=Vi(C,t,b,x);C.fadeOpacity=D.tileOpacity,w?(w.fadeOpacity=D.parentTileOpacity,w.texture.bind(y,f.CLAMP_TO_EDGE,f.LINEAR_MIPMAP_NEAREST)):C.texture.bind(y,f.CLAMP_TO_EDGE,f.LINEAR_MIPMAP_NEAREST),C.texture.useMipmap&&d.extTextureFilterAnisotropic&&e.transform.pitch>e.options.anisotropicFilterPitch&&f.texParameterf(f.TEXTURE_2D,d.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,d.extTextureFilterAnisotropicMax);let O=e.style.map.terrain?.getTerrainData(S),k=m.getProjectionData({overscaledTileID:S,aligned:_,applyGlobeMatrix:!l,applyTerrainMatrix:!0}),A=wr(E,T,D.fadeMix,n,s),ee=h.getMeshFromTileID(d,S.canonical,a,o,`raster`);p.draw(d,f.TRIANGLES,r,i?i[S.overscaledZ]:yn.disabled,g,c?gn.frontCCW:gn.backCCW,A,O,k,n.id,ee.vertexBuffer,ee.indexBuffer,ee.segments)}}function Vi(e,n,r,i){let a={parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:{tileOpacity:1,parentTileOpacity:1,fadeMix:{opacity:1,mix:0}}};if(r===0||i)return a;if(e.fadingParentID){let i=n.getLoadedTile(e.fadingParentID);if(!i)return a;let o=2**(i.tileID.overscaledZ-e.tileID.overscaledZ);return{parentTile:i,parentScaleBy:o,parentTopLeft:[e.tileID.canonical.x*o%1,e.tileID.canonical.y*o%1],fadeValues:function(e,n,r){let i=l(),a=(i-n.timeAdded)/r,o=e.fadingDirection===je.Incoming,s=t.al((i-e.timeAdded)/r,0,1),c=t.al(1-a,0,1),u=o?s:c;return{tileOpacity:u,parentTileOpacity:o?c:s,fadeMix:{opacity:1,mix:1-u}}}(e,i,r)}}return e.selfFading?{parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:function(e,n){let r=(l()-e.timeAdded)/n,i=t.al(r,0,1);return{tileOpacity:i,fadeMix:{opacity:i,mix:0}}}(e,r)}:a}let Hi=new t.bo(1,0,0,1),Ui=new t.bo(0,1,0,1),Wi=new t.bo(0,0,1,1),Gi=new t.bo(1,0,1,1),Ki=new t.bo(0,1,1,1);function qi(e,t,n,r){Ji(e,0,t+n/2,e.transform.width,n,r)}function W(e,t,n,r){Ji(e,t-n/2,0,n,e.transform.height,r)}function Ji(e,t,n,r,i,a){let o=e.context,s=o.gl;s.enable(s.SCISSOR_TEST),s.scissor(t*e.pixelRatio,n*e.pixelRatio,r*e.pixelRatio,i*e.pixelRatio),o.clear({color:a}),s.disable(s.SCISSOR_TEST)}function Yi(e,n,r){let i=e.context,a=i.gl,o=e.useProgram(`debug`),s=_n.disabled,c=yn.disabled,l=e.colorModeForRenderPass(),u=`$debug`,d=e.style.map.terrain?.getTerrainData(r);i.activeTexture.set(a.TEXTURE0);let f=n.getTileByID(r.key).latestRawTileData,p=Math.floor((f?.byteLength||0)/1024),m=n.getTile(r).tileSize,h=512/Math.min(m,512)*(r.overscaledZ/e.transform.zoom)*.5,g=r.canonical.toString();r.overscaledZ!==r.canonical.z&&(g+=` => ${r.overscaledZ}`),function(e,t){e.initDebugOverlayCanvas();let n=e.debugOverlayCanvas,r=e.context.gl,i=e.debugOverlayCanvas.getContext(`2d`);i.clearRect(0,0,n.width,n.height),i.shadowColor=`white`,i.shadowBlur=2,i.lineWidth=1.5,i.strokeStyle=`white`,i.textBaseline=`top`,i.font=`bold 36px Open Sans, sans-serif`,i.fillText(t,5,5),i.strokeText(t,5,5),e.debugOverlayTexture.update(n),e.debugOverlayTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}(e,`${g} ${p}kB`);let _=e.transform.getProjectionData({overscaledTileID:r,applyGlobeMatrix:!0,applyTerrainMatrix:!0});o.draw(i,a.TRIANGLES,s,c,mn.alphaBlended,gn.disabled,fr(t.bo.transparent,h),null,_,u,e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments),o.draw(i,a.LINE_STRIP,s,c,l,gn.disabled,fr(t.bo.red),d,_,u,e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments)}function Xi(e,t,n,r){let{isRenderingGlobe:i}=r,a=e.context,o=a.gl,s=e.transform,c=e.colorModeForRenderPass(),l=e.getDepthModeFor3D(),u=e.useProgram(`terrain`);a.bindFramebuffer.set(null),a.viewport.set([0,0,e.width,e.height]);for(let r of n){let n=t.getTerrainMesh(r.tileID),d=e.renderToTexture.getTexture(r),f=t.getTerrainData(r.tileID);a.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,d.texture);let p=t.getMeshFrameDelta(s.zoom),m=s.calculateFogMatrix(r.tileID.toUnwrapped()),h=$n(p,m,e.style.sky,s.pitch,i),g=s.getProjectionData({overscaledTileID:r.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});u.draw(a,o.TRIANGLES,l,yn.disabled,c,gn.backCCW,h,f,g,`terrain`,n.vertexBuffer,n.indexBuffer,n.segments)}}function Zi(e,n){if(!n.mesh){let r=new t.aU;r.emplaceBack(-1,-1),r.emplaceBack(1,-1),r.emplaceBack(1,1),r.emplaceBack(-1,1);let i=new t.aW;i.emplaceBack(0,1,2),i.emplaceBack(0,2,3),n.mesh=new Xt(e.createVertexBuffer(r,Zt.members),e.createIndexBuffer(i),t.aV.simpleSegment(0,0,r.length,i.length))}return n.mesh}let Qi={symbol:function(e,n,r,i,a,o){if(e.renderPass!==`translucent`)return;let{isRenderingToTexture:s}=o,c=yn.disabled,l=e.colorModeForRenderPass();(r._unevaluatedLayout.hasValue(`text-variable-anchor`)||r._unevaluatedLayout.hasValue(`text-variable-anchor-offset`))&&function(e,n,r,i,a,o,s,c,l){let u=n.transform,d=n.style.map.terrain,f=a===`map`,p=o===`map`;for(let a of e){let e=i.getTile(a),o=e.getBucket(r);if(!(o?.text)?.segments.get().length)continue;let m=t.aw(o.textSizeData,u.zoom),h=t.aK(e,1,n.transform.zoom),g=it(f,n.transform,h),_=r.layout.get(`icon-text-fit`)!==`none`&&o.hasIconData();if(m){let n=2**(u.zoom-e.tileID.overscaledZ),r=d?(e,t)=>d.getElevation(a,e,t):null;Ci(o,f,p,l,u,g,n,m,_,t.aL(u,e,s,c),a.toUnwrapped(),r)}}}(i,e,r,n,r.layout.get(`text-rotation-alignment`),r.layout.get(`text-pitch-alignment`),r.paint.get(`text-translate`),r.paint.get(`text-translate-anchor`),a),r.paint.get(`icon-opacity`).constantOr(1)!==0&&V(e,n,r,i,!1,r.paint.get(`icon-translate`),r.paint.get(`icon-translate-anchor`),r.layout.get(`icon-rotation-alignment`),r.layout.get(`icon-pitch-alignment`),r.layout.get(`icon-keep-upright`),c,l,s),r.paint.get(`text-opacity`).constantOr(1)!==0&&V(e,n,r,i,!0,r.paint.get(`text-translate`),r.paint.get(`text-translate-anchor`),r.layout.get(`text-rotation-alignment`),r.layout.get(`text-pitch-alignment`),r.layout.get(`text-keep-upright`),c,l,s),n.map.showCollisionBoxes&&(B(e,n,r,i,!0),B(e,n,r,i,!1))},circle:function(e,n,r,i,a){if(e.renderPass!==`translucent`)return;let{isRenderingToTexture:o}=a,s=r.paint.get(`circle-opacity`),c=r.paint.get(`circle-stroke-width`),l=r.paint.get(`circle-stroke-opacity`),u=!r.layout.get(`circle-sort-key`).isConstant();if(s.constantOr(1)===0&&(c.constantOr(1)===0||l.constantOr(1)===0))return;let d=e.context,f=d.gl,p=e.transform,m=e.getDepthModeForSublayer(0,_n.ReadOnly),h=yn.disabled,g=e.colorModeForRenderPass(),_=[],v=p.getCircleRadiusCorrection();for(let a of i){let i=n.getTile(a),s=i.getBucket(r);if(!s)continue;let c=r.paint.get(`circle-translate`),l=r.paint.get(`circle-translate-anchor`),d=t.aL(p,i,c,l),f=s.programConfigurations.get(r.id),m=e.useProgram(`circle`,f),h=s.layoutVertexBuffer,g=s.indexBuffer,y=e.style.map.terrain?.getTerrainData(a),b={programConfiguration:f,program:m,layoutVertexBuffer:h,indexBuffer:g,uniformValues:lr(e,i,r,d,v),terrainData:y,projectionData:p.getProjectionData({overscaledTileID:a,applyGlobeMatrix:!o,applyTerrainMatrix:!0})};if(u){let e=s.segments.get();for(let n of e)_.push({segments:new t.aV([n]),sortKey:n.sortKey,state:b})}else _.push({segments:s.segments,sortKey:0,state:b})}u&&_.sort(((e,t)=>e.sortKey-t.sortKey));for(let t of _){let{programConfiguration:n,program:i,layoutVertexBuffer:a,indexBuffer:o,uniformValues:s,terrainData:c,projectionData:l}=t.state;i.draw(d,f.TRIANGLES,m,h,g,gn.backCCW,s,c,l,r.id,a,o,t.segments,r.paint,e.transform.zoom,n)}},heatmap:function(e,n,r,i,a){if(r.paint.get(`heatmap-opacity`)===0)return;let o=e.context,{isRenderingToTexture:s,isRenderingGlobe:c}=a;if(e.style.map.terrain){for(let t of i){let i=n.getTile(t);n.hasRenderableParent(t)||(e.renderPass===`offscreen`?H(e,i,r,t,c):e.renderPass===`translucent`&&U(e,r,t,s,c))}o.viewport.set([0,0,e.width,e.height])}else e.renderPass===`offscreen`?function(e,n,r,i){let a=e.context,o=a.gl,s=e.transform,c=yn.disabled,l=new mn([o.ONE,o.ONE],t.bo.transparent,[!0,!0,!0,!0]);(function(e,n,r){let i=e.gl;e.activeTexture.set(i.TEXTURE1),e.viewport.set([0,0,n.width/4,n.height/4]);let a=r.heatmapFbos.get(t.cd);a?(i.bindTexture(i.TEXTURE_2D,a.colorAttachment.get()),e.bindFramebuffer.set(a.framebuffer)):(a=Ei(e,n.width/4,n.height/4),r.heatmapFbos.set(t.cd,a))})(a,e,r),a.clear({color:t.bo.transparent});for(let t of i){if(n.hasRenderableParent(t))continue;let i=n.getTile(t),u=i.getBucket(r);if(!u)continue;let d=u.programConfigurations.get(r.id),f=e.useProgram(`heatmap`,d),p=s.getProjectionData({overscaledTileID:t,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),m=s.getCircleRadiusCorrection();f.draw(a,o.TRIANGLES,_n.disabled,c,l,gn.backCCW,pr(i,s.zoom,r.paint.get(`heatmap-intensity`),m),null,p,r.id,u.layoutVertexBuffer,u.indexBuffer,u.segments,r.paint,s.zoom,d)}a.viewport.set([0,0,e.width,e.height])}(e,n,r,i):e.renderPass===`translucent`&&function(e,n){let r=e.context,i=r.gl;r.setColorMode(e.colorModeForRenderPass());let a=n.heatmapFbos.get(t.cd);a&&(r.activeTexture.set(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,a.colorAttachment.get()),r.activeTexture.set(i.TEXTURE1),Di(r,n).bind(i.LINEAR,i.CLAMP_TO_EDGE),e.useProgram(`heatmapTexture`).draw(r,i.TRIANGLES,_n.disabled,yn.disabled,e.colorModeForRenderPass(),gn.disabled,mr(e,n,0,1),null,null,n.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,n.paint,e.transform.zoom))}(e,r)},line:function(e,t,n,r,i){if(e.renderPass!==`translucent`)return;let{isRenderingToTexture:a}=i,o=n.paint.get(`line-opacity`),s=n.paint.get(`line-width`);if(o.constantOr(1)===0||s.constantOr(1)===0)return;let c=e.getDepthModeForSublayer(0,_n.ReadOnly),l=e.colorModeForRenderPass(),u=n.paint.get(`line-dasharray`),d=u.constantOr(1),f=n.paint.get(`line-pattern`),p=f.constantOr(1),m=n.paint.get(`line-gradient`),h=n.getCrossfadeParameters(),g;g=p?`linePattern`:d&&m?`lineGradientSDF`:d?`lineSDF`:m?`lineGradient`:`line`;let _=e.context,v=_.gl,y=e.transform,b=!0;for(let i of r){let r=t.getTile(i);if(p&&!r.patternsLoaded())continue;let o=r.getBucket(n);if(!o)continue;let s=o.programConfigurations.get(n.id),x=e.context.program.get(),S=e.useProgram(g,s),C=b||S.program!==x,w=e.style.map.terrain?.getTerrainData(i),T=f.constantOr(null),E=u?.constantOr(null);if(T&&r.imageAtlas){let e=r.imageAtlas,t=e.patternPositions[T.to.toString()],n=e.patternPositions[T.from.toString()];t&&n&&s.setConstantPatternPositions(t,n)}else if(E){let t=n.layout.get(`line-cap`).constantOr(null)===`round`,r=e.lineAtlas.getDash(E.to,t),i=e.lineAtlas.getDash(E.from,t);s.setConstantDashPositions(r,i)}let D=y.getProjectionData({overscaledTileID:i,applyGlobeMatrix:!a,applyTerrainMatrix:!0}),O=y.getPixelScale(),k;p?(k=yr(e,r,n,O,h),ki(_,v,r,s,h)):d&&m?(k=xr(e,r,n,O,h,o.lineClipsArray.length),Mi(e,t,_,v,n,o,i,s,h)):d?(k=br(e,r,n,O,h),Ai(e,_,v,s,C,h)):m?(k=vr(e,r,n,O,o.lineClipsArray.length),ji(e,t,_,v,n,o,i)):k=_r(e,r,n,O);let A=e.stencilModeForClipping(i);S.draw(_,v.TRIANGLES,c,A,l,gn.disabled,k,w,D,n.id,o.layoutVertexBuffer,o.indexBuffer,o.segments,n.paint,e.transform.zoom,s,o.layoutVertexBuffer2),b=!1}},fill:function(e,n,r,i,a){let o=r.paint.get(`fill-color`),s=r.paint.get(`fill-opacity`);if(s.constantOr(1)===0)return;let{isRenderingToTexture:c}=a,l=e.colorModeForRenderPass(),u=r.paint.get(`fill-pattern`),d=e.opaquePassEnabledForLayer()&&!u.constantOr(1)&&o.constantOr(t.bo.transparent).a===1&&s.constantOr(0)===1?`opaque`:`translucent`;e.renderPass===d&&Pi(e,n,r,i,e.getDepthModeForSublayer(1,e.renderPass===`opaque`?_n.ReadWrite:_n.ReadOnly),l,!1,c),e.renderPass===`translucent`&&r.paint.get(`fill-antialias`)&&Pi(e,n,r,i,e.getDepthModeForSublayer(r.getPaintProperty(`fill-outline-color`)?2:0,_n.ReadOnly),l,!0,c)},fillExtrusion:function(e,t,n,r,i){let a=n.paint.get(`fill-extrusion-opacity`);if(a===0)return;let{isRenderingToTexture:o}=i;if(e.renderPass===`translucent`){let i=new _n(e.context.gl.LEQUAL,_n.ReadWrite,e.depthRangeFor3D);if(a!==1||n.paint.get(`fill-extrusion-pattern`).constantOr(1))Fi(e,t,n,r,i,yn.disabled,mn.disabled,o),Fi(e,t,n,r,i,e.stencilModeFor3D(),e.colorModeForRenderPass(),o);else{let a=e.colorModeForRenderPass();Fi(e,t,n,r,i,yn.disabled,a,o)}}},hillshade:function(e,n,r,i,a){if(e.renderPass!==`offscreen`&&e.renderPass!==`translucent`)return;let{isRenderingToTexture:o}=a,s=e.context,c=e.style.projection.useSubdivision,l=e.getDepthModeForSublayer(0,_n.ReadOnly),u=e.colorModeForRenderPass();if(e.renderPass===`offscreen`)(function(e,n,r,i,a,o,s){let c=e.context,l=c.gl,u=i.paint.get(`resampling`)===`nearest`?l.NEAREST:l.LINEAR;for(let d of r){let r=n.getTile(d),f=r.dem;if(!f?.data||!r.needsHillshadePrepare)continue;let p=f.dim,m=f.stride,h=f.getPixels();if(c.activeTexture.set(l.TEXTURE1),c.pixelStoreUnpackPremultiplyAlpha.set(!1),r.demTexture||=e.getTileTexture(m),r.demTexture){let e=r.demTexture;e.update(h,{premultiply:!1}),e.bind(l.NEAREST,l.CLAMP_TO_EDGE)}else r.demTexture=new t.T(c,h,l.RGBA,{premultiply:!1}),r.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE);c.activeTexture.set(l.TEXTURE0);let g=r.fbo;if(!g){let e=new t.T(c,{width:p,height:p,data:null},l.RGBA);e.bind(u,l.CLAMP_TO_EDGE),g=r.fbo=c.createFramebuffer(p,p,!0,!1),g.colorAttachment.set(e.texture)}c.bindFramebuffer.set(g.framebuffer),c.viewport.set([0,0,p,p]),e.useProgram(`hillshadePrepare`).draw(c,l.TRIANGLES,a,o,s,gn.disabled,gr(r.tileID,f),null,null,i.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments),r.needsHillshadePrepare=!1}})(e,n,i,r,l,yn.disabled,u),s.viewport.set([0,0,e.width,e.height]);else if(e.renderPass===`translucent`)if(c){let[t,a,s]=e.stencilConfigForOverlapTwoPass(i);Ii(e,n,r,s,t,l,u,!1,o),Ii(e,n,r,s,a,l,u,!0,o)}else{let[t,a]=e.getStencilConfigForOverlapAndUpdateStencilID(i);Ii(e,n,r,a,t,l,u,!1,o)}},colorRelief:function(e,t,n,r,i){if(e.renderPass!==`translucent`||!r.length)return;let{isRenderingToTexture:a}=i,o=e.style.projection.useSubdivision,s=e.getDepthModeForSublayer(0,_n.ReadOnly),c=e.colorModeForRenderPass();if(o){let[i,o,l]=e.stencilConfigForOverlapTwoPass(r);Ri(e,t,n,l,i,s,c,!1,a),Ri(e,t,n,l,o,s,c,!0,a)}else{let[i,o]=e.getStencilConfigForOverlapAndUpdateStencilID(r);Ri(e,t,n,o,i,s,c,!1,a)}},raster:function(e,t,n,r,i){if(e.renderPass!==`translucent`||n.paint.get(`raster-opacity`)===0||!r.length)return;let{isRenderingToTexture:a}=i,o=t.getSource(),s=e.style.projection.useSubdivision;if(o instanceof xe)Bi(e,t,n,r,null,!1,!1,o.tileCoords,o.flippedWindingOrder,a);else if(s){let[i,o,s]=e.stencilConfigForOverlapTwoPass(r);Bi(e,t,n,s,i,!1,!0,zi,!1,a),Bi(e,t,n,s,o,!0,!0,zi,!1,a)}else{let[i,o]=e.getStencilConfigForOverlapAndUpdateStencilID(r);Bi(e,t,n,o,i,!1,!0,zi,!1,a)}},background:function(e,t,n,r,i){let a=n.paint.get(`background-color`),o=n.paint.get(`background-opacity`);if(o===0)return;let{isRenderingToTexture:s}=i,c=e.context,l=c.gl,u=e.style.projection,d=e.transform,f=d.tileSize,p=n.paint.get(`background-pattern`);if(e.isPatternMissing(p))return;let m=!p&&a.a===1&&o===1&&e.opaquePassEnabledForLayer()?`opaque`:`translucent`;if(e.renderPass!==m)return;let h=yn.disabled,g=e.getDepthModeForSublayer(0,m===`opaque`?_n.ReadWrite:_n.ReadOnly),_=e.colorModeForRenderPass(),v=e.useProgram(p?`backgroundPattern`:`background`),y=r||Ge(d,{tileSize:f,terrain:e.style.map.terrain});p&&(c.activeTexture.set(l.TEXTURE0),e.imageManager.bind(e.context));let b=n.getCrossfadeParameters();for(let t of y){let r=d.getProjectionData({overscaledTileID:t,applyGlobeMatrix:!s,applyTerrainMatrix:!0}),i=p?Ar(o,e,p,{tileID:t,tileSize:f},b):kr(o,a),m=e.style.map.terrain?.getTerrainData(t),y=u.getMeshFromTileID(c,t.canonical,!1,!0,`raster`);v.draw(c,l.TRIANGLES,g,h,_,gn.backCCW,i,m,r,n.id,y.vertexBuffer,y.indexBuffer,y.segments)}},sky:function(e,t){let n=e.context,r=n.gl,i=((e,t,n)=>{let r=Math.cos(t.rollInRadians),i=Math.sin(t.rollInRadians),a=Le(t),o=t.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:e.properties.get(`sky-color`),u_horizon_color:e.properties.get(`horizon-color`),u_horizon:[(t.width/2-a*i)*n,(t.height/2+a*r)*n],u_horizon_normal:[-i,r],u_sky_horizon_blend:e.properties.get(`sky-horizon-blend`)*t.height/2*n,u_sky_blend:o}})(t,e.style.map.transform,e.pixelRatio),a=new _n(r.LEQUAL,_n.ReadWrite,[0,1]),o=yn.disabled,s=e.colorModeForRenderPass(),c=e.useProgram(`sky`),l=Zi(n,t);c.draw(n,r.TRIANGLES,a,o,s,gn.disabled,i,null,void 0,`sky`,l.vertexBuffer,l.indexBuffer,l.segments)},atmosphere:function(e,n,r){let i=e.context,a=i.gl,o=e.useProgram(`atmosphere`),s=new _n(a.LEQUAL,_n.ReadOnly,[0,1]),c=e.transform,l=function(e,n){let r=e.properties.get(`position`),i=[-r.x,-r.y,-r.z],a=t.ap(new Float64Array(16));return e.properties.get(`anchor`)===`map`&&(t.be(a,a,n.rollInRadians),t.bf(a,a,-n.pitchInRadians),t.be(a,a,n.bearingInRadians),t.bf(a,a,n.center.lat*Math.PI/180),t.bI(a,a,-n.center.lng*Math.PI/180)),t.cg(i,i,a),i}(r,e.transform),u=c.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),d=n.properties.get(`atmosphere-blend`)*u.projectionTransition;if(d===0)return;let f=jn(c.worldSize,c.center.lat),p=c.inverseProjectionMatrix,m=new Float64Array(4);m[3]=1,t.aE(m,m,c.modelViewProjectionMatrix),m[0]/=m[3],m[1]/=m[3],m[2]/=m[3],m[3]=1,t.aE(m,m,p),m[0]/=m[3],m[1]/=m[3],m[2]/=m[3],m[3]=1;let h=((e,t,n,r,i)=>({u_sun_pos:e,u_atmosphere_blend:t,u_globe_position:n,u_globe_radius:r,u_inv_proj_matrix:i}))(l,d,[m[0],m[1],m[2]],f,p),g=Zi(i,n);o.draw(i,a.TRIANGLES,s,yn.disabled,mn.alphaBlended,gn.disabled,h,null,null,`atmosphere`,g.vertexBuffer,g.indexBuffer,g.segments)},custom:function(e,t,n,r){let{isRenderingGlobe:i}=r,a=e.context,o=n.implementation,s=e.style.projection,c=e.transform,l=c.getProjectionDataForCustomLayer(i),u={farZ:c.farZ,nearZ:c.nearZ,fov:c.fov*Math.PI/180,modelViewProjectionMatrix:c.modelViewProjectionMatrix,projectionMatrix:c.projectionMatrix,shaderData:{variantName:s.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793;\nuniform mat4 u_projection_matrix;\n${s.shaderPreludeCode.vertexSource}`,define:s.shaderDefine},defaultProjectionData:l},d=o.renderingMode?o.renderingMode:`2d`;if(e.renderPass===`offscreen`){let t=o.prerender;t&&(e.setCustomLayerDefaults(),a.setColorMode(e.colorModeForRenderPass()),t.call(o,a.gl,u),a.setDirty(),e.setBaseState())}else if(e.renderPass===`translucent`){e.setCustomLayerDefaults(),a.setColorMode(e.colorModeForRenderPass()),a.setStencilMode(yn.disabled);let t=d===`3d`?e.getDepthModeFor3D():e.getDepthModeForSublayer(0,_n.ReadOnly);a.setDepthMode(t),o.render(a.gl,u),a.setDirty(),e.setBaseState(),a.bindFramebuffer.set(null)}},debug:function(e,t,n){for(let r of n)Yi(e,t,r)},debugPadding:function(e){let t=e.transform.padding;qi(e,e.transform.height-(t.top||0),3,Hi),qi(e,t.bottom||0,3,Ui),W(e,t.left||0,3,Wi),W(e,e.transform.width-(t.right||0),3,Gi);let n=e.transform.centerPoint;(function(e,t,n,r){Ji(e,t-1,n-10,2,20,r),Ji(e,t-10,n-1,20,2,r)})(e,n.x,e.transform.height-n.y,Ki)},terrainDepth:function(e,n){let r=e.context,i=r.gl,a=e.transform,o=mn.unblended,s=new _n(i.LEQUAL,_n.ReadWrite,[0,1]),c=n.tileManager.getRenderableTiles(),l=e.useProgram(`terrainDepth`);r.bindFramebuffer.set(n.getFramebuffer(`depth`).framebuffer),r.viewport.set([0,0,e.width/devicePixelRatio,e.height/devicePixelRatio]),r.clear({color:t.bo.transparent,depth:1});for(let e of c){let t=n.getTerrainMesh(e.tileID),c=n.getTerrainData(e.tileID),u=a.getProjectionData({overscaledTileID:e.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),d={u_ele_delta:n.getMeshFrameDelta(a.zoom)};l.draw(r,i.TRIANGLES,s,yn.disabled,o,gn.backCCW,d,c,u,`terrain`,t.vertexBuffer,t.indexBuffer,t.segments)}r.bindFramebuffer.set(null),r.viewport.set([0,0,e.width,e.height])},terrainCoords:function(e,n){let r=e.context,i=r.gl,a=e.transform,o=mn.unblended,s=new _n(i.LEQUAL,_n.ReadWrite,[0,1]),c=n.getCoordsTexture(),l=n.tileManager.getRenderableTiles(),u=e.useProgram(`terrainCoords`);r.bindFramebuffer.set(n.getFramebuffer(`coords`).framebuffer),r.viewport.set([0,0,e.width/devicePixelRatio,e.height/devicePixelRatio]),r.clear({color:t.bo.transparent,depth:1}),n.coordsIndex=[];for(let e of l){let t=n.getTerrainMesh(e.tileID),l=n.getTerrainData(e.tileID);r.activeTexture.set(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,c.texture);let d={u_terrain_coords_id:(255-n.coordsIndex.length)/255,u_texture:0,u_ele_delta:n.getMeshFrameDelta(a.zoom)},f=a.getProjectionData({overscaledTileID:e.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});u.draw(r,i.TRIANGLES,s,yn.disabled,o,gn.backCCW,d,l,f,`terrain`,t.vertexBuffer,t.indexBuffer,t.segments),n.coordsIndex.push(e.tileID.key)}r.bindFramebuffer.set(null),r.viewport.set([0,0,e.width,e.height])}};class $i{constructor(e,n){this.drawFunctions=Qi,this.context=new vi(e),this.transform=n,this._tileTextures={},this.terrainFacilitator={depthDirty:!0,coordsDirty:!1,matrix:t.ap(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=$e.maxOverzooming+$e.maxUnderzooming+1,this.depthEpsilon=1/2**16,this.crossTileSymbolIndex=new Kt}resize(e,t,n){if(this.width=Math.floor(e*n),this.height=Math.floor(t*n),this.pixelRatio=n,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let e of this.style._order)this.style._layers[e].resize()}setup(){let e=this.context,n=new t.aU;n.emplaceBack(0,0),n.emplaceBack(t.a6,0),n.emplaceBack(0,t.a6),n.emplaceBack(t.a6,t.a6),this.tileExtentBuffer=e.createVertexBuffer(n,Zt.members),this.tileExtentSegments=t.aV.simpleSegment(0,0,4,2);let r=new t.aU;r.emplaceBack(0,0),r.emplaceBack(t.a6,0),r.emplaceBack(0,t.a6),r.emplaceBack(t.a6,t.a6),this.debugBuffer=e.createVertexBuffer(r,Zt.members),this.debugSegments=t.aV.simpleSegment(0,0,4,5);let i=new t.ch;i.emplaceBack(0,0,0,0),i.emplaceBack(t.a6,0,t.a6,0),i.emplaceBack(0,t.a6,0,t.a6),i.emplaceBack(t.a6,t.a6,t.a6,t.a6),this.rasterBoundsBuffer=e.createVertexBuffer(i,Zn.members),this.rasterBoundsSegments=t.aV.simpleSegment(0,0,4,2);let a=new t.aU;a.emplaceBack(0,0),a.emplaceBack(t.a6,0),a.emplaceBack(0,t.a6),a.emplaceBack(t.a6,t.a6),this.rasterBoundsBufferPosOnly=e.createVertexBuffer(a,Zt.members),this.rasterBoundsSegmentsPosOnly=t.aV.simpleSegment(0,0,4,5);let o=new t.aU;o.emplaceBack(0,0),o.emplaceBack(1,0),o.emplaceBack(0,1),o.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(o,Zt.members),this.viewportSegments=t.aV.simpleSegment(0,0,4,2);let s=new t.ci;s.emplaceBack(0),s.emplaceBack(1),s.emplaceBack(3),s.emplaceBack(2),s.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(s);let c=new t.aW;c.emplaceBack(1,0,2),c.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(c);let l=this.context.gl;this.stencilClearMode=new yn({func:l.ALWAYS,mask:0},0,255,l.ZERO,l.ZERO,l.ZERO),this.tileExtentMesh=new Xt(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){let e=this.context,n=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let r=t.O();t.c7(r,0,this.width,this.height,0,0,1),t.S(r,r,[n.drawingBufferWidth,n.drawingBufferHeight,0]);let i={mainMatrix:r,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:r};this.useProgram(`clippingMask`,null,!0).draw(e,n.TRIANGLES,_n.disabled,this.stencilClearMode,mn.disabled,gn.disabled,null,null,i,`$clipping`,this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(e,t,n){if(this.currentStencilSource===e.source||!e.isTileClipped()||!t?.length)return;this.currentStencilSource=e.source,this.nextStencilID+t.length>256&&this.clearStencil();let r=this.context;r.setColorMode(mn.disabled),r.setDepthMode(_n.disabled);let i={};for(let e of t)i[e.key]=this.nextStencilID++;this._renderTileMasks(i,t,n,!0),this._renderTileMasks(i,t,n,!1),this._tileClippingMaskIDs=i}_renderTileMasks(e,t,n,r){let i=this.context,a=i.gl,o=this.style.projection,s=this.transform,c=this.useProgram(`clippingMask`);for(let l of t){let t=e[l.key],u=this.style.map.terrain?.getTerrainData(l),d=o.getMeshFromTileID(this.context,l.canonical,r,!0,`stencil`),f=s.getProjectionData({overscaledTileID:l,applyGlobeMatrix:!n,applyTerrainMatrix:!0});c.draw(i,a.TRIANGLES,_n.disabled,new yn({func:a.ALWAYS,mask:0},t,255,a.KEEP,a.KEEP,a.REPLACE),mn.disabled,n?gn.disabled:gn.backCCW,null,u,f,`$clipping`,d.vertexBuffer,d.indexBuffer,d.segments)}}_renderTilesDepthBuffer(){let e=this.context,t=e.gl,n=this.style.projection,r=this.transform,i=this.useProgram(`depth`),a=this.getDepthModeFor3D(),o=Ge(r,{tileSize:r.tileSize});for(let s of o){let o=this.style.map.terrain?.getTerrainData(s),c=n.getMeshFromTileID(this.context,s.canonical,!0,!0,`raster`),l=r.getProjectionData({overscaledTileID:s,applyGlobeMatrix:!0,applyTerrainMatrix:!0});i.draw(e,t.TRIANGLES,a,yn.disabled,mn.disabled,gn.backCCW,null,o,l,`$clipping`,c.vertexBuffer,c.indexBuffer,c.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let e=this.nextStencilID++,t=this.context.gl;return new yn({func:t.NOTEQUAL,mask:255},e,255,t.KEEP,t.KEEP,t.REPLACE)}stencilModeForClipping(e){let t=this.context.gl;return new yn({func:t.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,t.KEEP,t.KEEP,t.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(e){let t=this.context.gl,n=e.sort(((e,t)=>t.overscaledZ-e.overscaledZ)),r=n[n.length-1].overscaledZ,i=n[0].overscaledZ-r+1;if(i>1){this.currentStencilSource=void 0,this.nextStencilID+i>256&&this.clearStencil();let e={};for(let n=0;n<i;n++)e[n+r]=new yn({func:t.GEQUAL,mask:255},n+this.nextStencilID,255,t.KEEP,t.KEEP,t.REPLACE);return this.nextStencilID+=i,[e,n]}return[{[r]:yn.disabled},n]}stencilConfigForOverlapTwoPass(e){let t=this.context.gl,n=e.sort(((e,t)=>t.overscaledZ-e.overscaledZ)),r=n[n.length-1].overscaledZ,i=n[0].overscaledZ-r+1;if(this.clearStencil(),i>1){let e={},a={};for(let n=0;n<i;n++)e[n+r]=new yn({func:t.GREATER,mask:255},i+1+n,255,t.KEEP,t.KEEP,t.REPLACE),a[n+r]=new yn({func:t.GREATER,mask:255},1+n,255,t.KEEP,t.KEEP,t.REPLACE);return this.nextStencilID=2*i+1,[e,a,n]}return this.nextStencilID=3,[{[r]:new yn({func:t.GREATER,mask:255},2,255,t.KEEP,t.KEEP,t.REPLACE)},{[r]:new yn({func:t.GREATER,mask:255},1,255,t.KEEP,t.KEEP,t.REPLACE)},n]}colorModeForRenderPass(){let e=this.context.gl;if(this._showOverdrawInspector){let n=1/8;return new mn([e.CONSTANT_COLOR,e.ONE],new t.bo(n,n,n,0),[!0,!0,!0,!0])}return this.renderPass===`opaque`?mn.unblended:mn.alphaBlended}getDepthModeForSublayer(e,t,n){if(!this.opaquePassEnabledForLayer())return _n.disabled;let r=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new _n(n||this.context.gl.LEQUAL,t,[r,r])}getDepthModeFor3D(){return new _n(this.context.gl.LEQUAL,_n.ReadWrite,this.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(e,n){var r;this.style=e,this.options=n,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(l()),this.imageManager.beginFrame();let i=this.style._order,a=this.style.tileManagers,o={},s={},c={},u={isRenderingToTexture:!1,isRenderingGlobe:e.projection?.transitionState>0};for(let e in a){let t=a[e];t.used&&t.prepare(this.context),o[e]=t.getVisibleCoordinates(!1),s[e]=o[e].slice().reverse(),c[e]=t.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let e=0;e<i.length;e++)if(this.style._layers[i[e]].is3D()){this.opaquePassCutoff=e;break}this.maybeDrawDepth(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass=`offscreen`;for(let e of i){let t=this.style._layers[e];if(!t.hasOffscreenPass()||t.isHidden(this.transform.zoom))continue;let n=s[t.source];(t.type===`custom`||n.length)&&this.renderLayer(this,a[t.source],t,n,u)}if((r=this.style.projection)==null||r.updateGPUdependent({context:this.context,useProgram:e=>this.useProgram(e)}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:n.showOverdrawInspector?t.bo.black:t.bo.transparent,depth:1}),this.clearStencil(),this.style.sky&&this.drawFunctions.sky(this,this.style.sky),this._showOverdrawInspector=n.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass=`opaque`,this.currentLayer=i.length-1;this.currentLayer>=0;this.currentLayer--){let e=this.style._layers[i[this.currentLayer]],t=a[e.source],n=o[e.source];this._renderTileClippingMasks(e,n,!1),this.renderLayer(this,t,e,n,u)}this.renderPass=`translucent`;let d=!1;for(this.currentLayer=0;this.currentLayer<i.length;this.currentLayer++){let e=this.style._layers[i[this.currentLayer]],t=a[e.source];if(this.renderToTexture?.renderLayer(e,u))continue;this.opaquePassEnabledForLayer()||d||(d=!0,u.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());let n=(e.type===`symbol`?c:s)[e.source];this._renderTileClippingMasks(e,o[e.source],!!this.renderToTexture),this.renderLayer(this,t,e,n,u)}if(u.isRenderingGlobe&&this.drawFunctions.atmosphere(this,this.style.sky,this.style.light),this.options.showTileBoundaries){let e=function(e,t){let n=null,r=Object.values(e._layers).flatMap((n=>n.source&&!n.isHidden(t)?[e.tileManagers[n.source]]:[])),i=r.filter((e=>e.getSource().type===`vector`)),a=r.filter((e=>e.getSource().type!==`vector`)),o=e=>{(!n||n.getSource().maxzoom<e.getSource().maxzoom)&&(n=e)};for(let e of i)o(e);if(!n)for(let e of a)o(e);return n}(this.style,this.transform.zoom);e&&this.drawFunctions.debug(this,e,e.getVisibleCoordinates())}this.options.showPadding&&this.drawFunctions.debugPadding(this),this.context.setDefault()}maybeDrawDepth(e){if(!this.style?.map?.terrain)return;let n=this.terrainFacilitator.matrix,r=this.transform.modelViewProjectionMatrix,i=this.terrainFacilitator.depthDirty;i||=e?!t.cj(n,r):!t.ck(n,r),i||=this.style.map.terrain.tileManager.anyTilesAfterTime(this.terrainFacilitator.renderTime),i&&(t.cl(n,r),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.depthDirty=!1,this.terrainFacilitator.coordsDirty=!0,this.drawFunctions.terrainDepth(this,this.style.map.terrain))}maybeDrawCoords(){var e;(e=this.style?.map)!=null&&e.terrain&&this.terrainFacilitator.coordsDirty&&(this.terrainFacilitator.coordsDirty=!1,this.drawFunctions.terrainCoords(this,this.style.map.terrain))}renderLayer(e,n,r,i,a){if(r.isHidden(this.transform.zoom)||r.type!==`background`&&r.type!==`custom`&&!(i||[]).length)return;this.id=r.id;let o=this.drawFunctions;t.aQ(r)?o.symbol(e,n,r,i,this.style.placement.variableOffsets,a):t.cm(r)?o.circle(e,n,r,i,a):t.cn(r)?o.heatmap(e,n,r,i,a):t.co(r)?o.line(e,n,r,i,a):t.cp(r)?o.fill(e,n,r,i,a):t.cq(r)?o.fillExtrusion(e,n,r,i,a):t.cr(r)?o.hillshade(e,n,r,i,a):t.cs(r)?o.colorRelief(e,n,r,i,a):t.bU(r)?o.raster(e,n,r,i,a):t.ct(r)?o.background(e,n,r,i,a):t.cu(r)&&o.custom(e,n,r,a)}saveTileTexture(e){let t=this._tileTextures[e.size[0]];t?t.length<$i.MAX_TEXTURE_POOL_SIZE_PER_BUCKET?t.push(e):e.destroy():this._tileTextures[e.size[0]]=[e]}getTileTexture(e){let t=this._tileTextures[e];return t&&t.length>0?t.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;let t=this.imageManager.getPattern(e.from.toString()),n=this.imageManager.getPattern(e.to.toString());return!t||!n}useProgram(e,t,n=!1,r=[]){var i;this.cache||={};let a=!!this.style.map.terrain,o=this.style.projection,s=n?Jt.projectionMercator:o.shaderPreludeCode,c=n?Qt:o.shaderDefine,l=e+(t?t.cacheKey:``)+`/${n?$t:o.shaderVariantName}`+(this._showOverdrawInspector?`/overdraw`:``)+(a?`/terrain`:``)+(r?`/${r.join(`/`)}`:``);return(i=this.cache)[l]||(i[l]=new nr(this.context,Jt[e],t,Mr[e],this._showOverdrawInspector,a,s,c,r)),this.cache[l]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){let e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas??(this.debugOverlayCanvas=document.createElement(`canvas`),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new t.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){var e,t;if(this._tileTextures){for(let e in this._tileTextures){let t=this._tileTextures[e];if(t)for(let e of t)e.destroy()}this._tileTextures={}}if(this.tileExtentBuffer&&this.tileExtentBuffer.destroy(),this.debugBuffer&&this.debugBuffer.destroy(),this.rasterBoundsBuffer&&this.rasterBoundsBuffer.destroy(),this.rasterBoundsBufferPosOnly&&this.rasterBoundsBufferPosOnly.destroy(),this.viewportBuffer&&this.viewportBuffer.destroy(),this.tileBorderIndexBuffer&&this.tileBorderIndexBuffer.destroy(),this.quadTriangleIndexBuffer&&this.quadTriangleIndexBuffer.destroy(),this.tileExtentMesh&&((e=this.tileExtentMesh.vertexBuffer)==null||e.destroy()),this.tileExtentMesh&&((t=this.tileExtentMesh.indexBuffer)==null||t.destroy()),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.cache){for(let e in this.cache){let t=this.cache[e];t!=null&&t.program&&this.context.gl.deleteProgram(t.program)}this.cache={}}this.context&&this.context.setDefault()}overLimit(){let{drawingBufferWidth:e,drawingBufferHeight:t}=this.context.gl;return this.width!==e||this.height!==t}}function ea(e,t){let n,r=!1,i=null,a=()=>{i=null,r&&=(e(...n),i=setTimeout(a,t),!1)};return(...e)=>(r=!0,n=e,i||a(),i)}$i.MAX_TEXTURE_POOL_SIZE_PER_BUCKET=50;class ta{constructor(e){this._getCurrentHash=()=>{let e=window.location.hash.replace(`#`,``);if(this._hashName){let t,n=e.split(`&`).map((e=>e.split(`=`)));for(let e of n)e[0]===this._hashName&&(t=e);return(t&&t[1]||``).split(`/`)}return e.split(`/`)},this._onHashChange=()=>{let e=this._getCurrentHash();if(!this._isValidHash(e))return!1;let t=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(e[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+e[2],+e[1]],zoom:+e[0],bearing:t,pitch:+(e[4]||0)}),!0},this._updateHashUnthrottled=()=>{let e=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,e)},this._removeHash=()=>{let e=this._getCurrentHash();if(e.length===0)return;let t=e.join(`/`),n=t;n.split(`&`).length>0&&(n=n.split(`&`)[0]),this._hashName&&(n=`${this._hashName}=${t}`);let r=window.location.hash.replace(n,``);r.startsWith(`#&`)?r=r.slice(0,1)+r.slice(2):r===`#`&&(r=``);let i=window.location.href.replace(/(#.+)?$/,r);i=i.replace(`&&`,`&`),window.history.replaceState(window.history.state,null,i)},this._updateHash=ea(this._updateHashUnthrottled,300),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,addEventListener(`hashchange`,this._onHashChange,!1),this._map.on(`moveend`,this._updateHash),this}remove(){return removeEventListener(`hashchange`,this._onHashChange,!1),this._map.off(`moveend`,this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(e){let t=this._map.getCenter(),n=Math.round(100*this._map.getZoom())/100,r=10**Math.ceil((n*Math.LN2+Math.log(512/360/.5))/Math.LN10),i=Math.round(t.lng*r)/r,a=Math.round(t.lat*r)/r,o=this._map.getBearing(),s=this._map.getPitch(),c=``;if(c+=e?`/${i}/${a}/${n}`:`${n}/${a}/${i}
756`,(o||s)&&(c+=`/`+Math.round(10*o)/10),s&&(c+=`/${Math.round(s)}`),this._hashName){let e=this._hashName,t=!1,n=window.location.hash.slice(1).split(`&`).map((n=>{let r=n.split(`=`)[0];return r===e?(t=!0,`${r}=${c}`):n})).filter((e=>e));return t||n.push(`${e}=${c}`),`#${n.join(`&`)}`}return`#${c}`}_isValidHash(e){if(e.length<3||e.some(isNaN))return!1;try{new t.W(+e[2],+e[1])}catch{return!1}let n=+e[0],r=+(e[3]||0),i=+(e[4]||0);return n>=this._map.getMinZoom()&&n<=this._map.getMaxZoom()&&r>=-180&&r<=180&&i>=this._map.getMinPitch()&&i<=this._map.getMaxPitch()}}let na={linearity:.3,easing:t.cv(0,0,.3,1)},ra=t.e({deceleration:2500,maxSpeed:1400},na),ia=t.e({deceleration:20,maxSpeed:1400},na),aa=t.e({deceleration:1e3,maxSpeed:360},na),oa=t.e({deceleration:1e3,maxSpeed:90},na),sa=t.e({deceleration:1e3,maxSpeed:360},na);class ca{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:l(),settings:e})}_drainInertiaBuffer(){let e=this._inertiaBuffer,t=l();for(;e.length>0&&t-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;let n={zoom:0,bearing:0,pitch:0,roll:0,pan:new t.P(0,0),pinchAround:void 0,around:void 0};for(let{settings:e}of this._inertiaBuffer)n.zoom+=e.zoomDelta||0,n.bearing+=e.bearingDelta||0,n.pitch+=e.pitchDelta||0,n.roll+=e.rollDelta||0,e.panDelta&&n.pan._add(e.panDelta),e.around&&(n.around=e.around),e.pinchAround&&(n.pinchAround=e.pinchAround);let r=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,i={};if(n.pan.mag()){let a=ua(n.pan.mag(),r,t.e({},ra,e||{})),o=n.pan.mult(a.amount/n.pan.mag()),s=this._map.cameraHelper.handlePanInertia(o,this._map.transform);i.center=s.easingCenter,i.offset=s.easingOffset,la(i,a)}if(n.zoom){let e=ua(n.zoom,r,ia);i.zoom=t.cw(this._map.transform.zoom+e.amount,this._map.getZoomSnap(),e.amount),la(i,e)}if(n.bearing){let e=ua(n.bearing,r,aa);
vendor: 114,432 bytes, line 756
756i.bearing=this._map.transform.bearing+t.al(e.amount,-179,179),la(i,e)}if(n.pitch){let e=ua(n.pitch,r,oa);i.pitch=this._map.transform.pitch+e.amount,la(i,e)}if(n.roll){let e=ua(n.roll,r,sa);i.roll=this._map.transform.roll+t.al(e.amount,-179,179),la(i,e)}if(i.zoom||i.bearing){let e=n.pinchAround===void 0?n.around:n.pinchAround;i.around=e?this._map.unproject(e):this._map.getCenter()}return this.clear(),t.e(i,{noMoveStart:!0})}}function la(e,t){(!e.duration||e.duration<t.duration)&&(e.duration=t.duration,e.easing=t.easing)}function ua(e,n,r){let{maxSpeed:i,linearity:a,deceleration:o}=r,s=t.al(e*a/(n/1e3),-i,i),c=Math.abs(s)/(o*a);return{easing:r.easing,duration:1e3*c,amount:c/2*s}}class da extends t.n{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,n,r,i={}){r=r instanceof MouseEvent?r:new MouseEvent(e,r);let a=d.mousePos(n.getCanvas(),r),o=n.unproject(a);super(e,t.e({point:a,lngLat:o,originalEvent:r},i)),this._defaultPrevented=!1,this.target=n}}class fa extends t.n{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,n,r){let i=e===`touchend`?r.changedTouches:r.touches,a=d.touchPos(n.getCanvasContainer(),i),o=a.map((e=>n.unproject(e))),s=a.reduce(((e,t,n,r)=>e.add(t.div(r.length))),new t.P(0,0));super(e,{points:a,point:s,lngLats:o,lngLat:n.unproject(s),originalEvent:r}),this._defaultPrevented=!1}}class pa extends t.n{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,n){super(e,{originalEvent:n}),this._defaultPrevented=!1}}class ma{constructor(e,t){this._map=e,this._clickTolerance=t.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new pa(e.type,this._map,e))}mousedown(e,t){return this._mousedownPos=t,this._firePreventable(new da(e.type,this._map,e))}mouseup(e){this._map.fire(new da(e.type,this._map,e))}click(e,t){this._mousedownPos&&this._mousedownPos.dist(t)>=this._clickTolerance||this._map.fire(new da(e.type,this._map,e))}dblclick(e){return this._firePreventable(new da(e.type,this._map,e))}mouseover(e){this._map.fire(new da(e.type,this._map,e))}mouseout(e){this._map.fire(new da(e.type,this._map,e))}touchstart(e){return this._firePreventable(new fa(e.type,this._map,e))}touchmove(e){this._map.fire(new fa(e.type,this._map,e))}touchend(e){this._map.fire(new fa(e.type,this._map,e))}touchcancel(e){this._map.fire(new fa(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class ha{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new da(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new da(`contextmenu`,this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new da(e.type,this._map,e)),this._map.listens(`contextmenu`)&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class G{constructor(e){this._map=e}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(e){return this.transform.screenPointToLocation(t.P.convert(e),this._map.terrain)}}class ga{constructor(e,t){this._map=e,this._tr=new G(e),this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=t.clickTolerance||1,t.boxZoom&&typeof t.boxZoom==`object`&&(this._boxZoomEnd=t.boxZoom.boxZoomEnd)}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,t){this.isEnabled()&&e.shiftKey&&e.button===0&&(d.disableDrag(),this._startPos=this._lastPos=t,this._active=!0)}mousemoveWindow(e,t){if(!this._active)return;let n=t;if(this._lastPos.equals(n)||!this._box&&n.dist(this._startPos)<this._clickTolerance)return;let r=this._startPos;this._lastPos=n,this._box||(this._box=d.create(`div`,`maplibregl-boxzoom`,this._container),this._container.classList.add(`maplibregl-crosshair`),this._fireEvent(`boxzoomstart`,e));let i=Math.min(r.x,n.x),a=Math.max(r.x,n.x),o=Math.min(r.y,n.y),s=Math.max(r.y,n.y);this._box.style.transform=`translate(${i}px,${o}px)`,this._box.style.width=a-i+`px`,this._box.style.height=s-o+`px`}mouseupWindow(e,n){if(!this._active||e.button!==0)return;let r=this._startPos,i=n;if(this.reset(),d.suppressClick(),r.x!==i.x||r.y!==i.y)return this._map.fire(new t.n(`boxzoomend`,{originalEvent:e})),this._boxZoomEnd?void this._boxZoomEnd(this._map,r,i,e):{cameraAnimation:e=>e.fitScreenCoordinates(r,i,this._tr.bearing,{linear:!0})};this._fireEvent(`boxzoomcancel`,e)}keydown(e){this._active&&e.keyCode===27&&(this.reset(),this._fireEvent(`boxzoomcancel`,e))}reset(){this._active=!1,this._container.classList.remove(`maplibregl-crosshair`),this._box&&=(this._box.remove(),null),d.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,n){return this._map.fire(new t.n(e,{originalEvent:n}))}}function _a(e,t){if(e.length!==t.length)throw Error(`The number of touches and points are not equal - touches ${e.length}, points ${t.length}`);let n={};for(let r=0;r<e.length;r++)n[e[r].identifier]=t[r];return n}class va{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,n,r){(this.centroid||r.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=e.timeStamp),r.length===this.numTouches&&(this.centroid=function(e){let n=new t.P(0,0);for(let t of e)n._add(t);return n.div(e.length)}(n),this.touches=_a(r,n)))}touchmove(e,t,n){if(this.aborted||!this.centroid)return;let r=_a(n,t);for(let e in this.touches){let t=r[e];(!t||t.dist(this.touches[e])>30)&&(this.aborted=!0)}}touchend(e,t,n){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),n.length===0){let e=!this.aborted&&this.centroid;if(this.reset(),e)return e}}}class K{constructor(e){this.singleTap=new va(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,t,n){this.singleTap.touchstart(e,t,n)}touchmove(e,t,n){this.singleTap.touchmove(e,t,n)}touchend(e,t,n){let r=this.singleTap.touchend(e,t,n);if(r){let t=e.timeStamp-this.lastTime<500,n=!this.lastTap||this.lastTap.dist(r)<30;if(t&&n||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=r,this.count===this.numTaps)return this.reset(),r}}}class ya{constructor(e){this._tr=new G(e),this._zoomIn=new K({numTouches:1,numTaps:2}),this._zoomOut=new K({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,t,n){this._zoomIn.touchstart(e,t,n),this._zoomOut.touchstart(e,t,n)}touchmove(e,t,n){this._zoomIn.touchmove(e,t,n),this._zoomOut.touchmove(e,t,n)}touchend(e,n,r){let i=this._zoomIn.touchend(e,n,r),a=this._zoomOut.touchend(e,n,r),o=this._tr;return i?(this._active=!0,e.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:n=>n.easeTo({duration:300,zoom:t.cw(o.zoom+1,n.getZoomSnap()),around:o.unproject(i)},{originalEvent:e})}):a?(this._active=!0,e.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:n=>n.easeTo({duration:300,zoom:t.cw(o.zoom-1,n.getZoomSnap()),around:o.unproject(a)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ba{constructor(e){this._enabled=!!e.enable,this._moveStateManager=e.moveStateManager,this._clickTolerance=e.clickTolerance||1,this._moveFunction=e.move,this._activateOnStart=!!e.activateOnStart,e.assignEvents(this),this.reset()}reset(e){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(e)}_move(...e){let t=this._moveFunction(...e);if(t.bearingDelta||t.pitchDelta||t.rollDelta||t.around||t.panDelta)return this._active=!0,t}dragStart(e,t){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=Array.isArray(t)?t[0]:t,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,t){if(!this.isEnabled())return;let n=this._lastPoint;if(!n)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e))return void this.reset(e);let r=Array.isArray(t)?t[0]:t;return!this._moved&&r.dist(n)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=r,this._move(n,r))}dragEnd(e){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(e)&&(this._moved&&d.suppressClick(),this.reset(e))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}let xa={0:1,2:2};class Sa{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){this._eventButton=e.button}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!function(e,t){let n=xa[t];return e.buttons===void 0||(e.buttons&n)!==n}(e,this._eventButton)}isValidEndEvent(e){return e.button===this._eventButton}}class Ca{constructor(){this._firstTouch=void 0}_isOneFingerTouch(e){return e.targetTouches.length===1}_isSameTouchEvent(e){return e.targetTouches[0].identifier===this._firstTouch}startMove(e){this._firstTouch=e.targetTouches[0].identifier}endMove(e){delete this._firstTouch}isValidStartEvent(e){return this._isOneFingerTouch(e)}isValidMoveEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}isValidEndEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}}class wa{constructor(e=new Sa({checkCorrectEvent:()=>!0}),t=new Ca){this.mouseMoveStateManager=e,this.oneFingerTouchMoveStateManager=t}_executeRelevantHandler(e,t,n){return e instanceof MouseEvent?t(e):typeof TouchEvent<`u`&&e instanceof TouchEvent?n(e):void 0}startMove(e){this._executeRelevantHandler(e,(e=>{this.mouseMoveStateManager.startMove(e)}),(e=>{this.oneFingerTouchMoveStateManager.startMove(e)}))}endMove(e){this._executeRelevantHandler(e,(e=>{this.mouseMoveStateManager.endMove(e)}),(e=>{this.oneFingerTouchMoveStateManager.endMove(e)}))}isValidStartEvent(e){return this._executeRelevantHandler(e,(e=>this.mouseMoveStateManager.isValidStartEvent(e)),(e=>this.oneFingerTouchMoveStateManager.isValidStartEvent(e)))}isValidMoveEvent(e){return this._executeRelevantHandler(e,(e=>this.mouseMoveStateManager.isValidMoveEvent(e)),(e=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(e)))}isValidEndEvent(e){return this._executeRelevantHandler(e,(e=>this.mouseMoveStateManager.isValidEndEvent(e)),(e=>this.oneFingerTouchMoveStateManager.isValidEndEvent(e)))}}let Ta=e=>{e.mousedown=e.dragStart,e.mousemoveWindow=e.dragMove,e.mouseup=e.dragEnd,e.contextmenu=e=>{e.preventDefault()}};class Ea{constructor(e,t){this._clickTolerance=e.clickTolerance||1,this._map=t,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new t.P(0,0)}_shouldBePrevented(e){return e<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(e,t,n){return this._calculateTransform(e,t,n)}touchmove(e,t,n){if(this._active){if(!this._shouldBePrevented(n.length))return e.preventDefault(),this._calculateTransform(e,t,n);this._map.cooperativeGestures.notifyGestureBlocked(`touch_pan`,e)}}touchend(e,t,n){this._calculateTransform(e,t,n),this._active&&this._shouldBePrevented(n.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,n,r){r.length>0&&(this._active=!0);let i=_a(r,n),a=new t.P(0,0),o=new t.P(0,0),s=0;for(let e in i){let t=i[e],n=this._touches[e];n&&(a._add(t),o._add(t.sub(n)),s++,i[e]=t)}if(this._touches=i,this._shouldBePrevented(s)||!o.mag())return;let c=o.div(s);return this._sum._add(c),this._sum.mag()<this._clickTolerance?void 0:{around:a.div(s),panDelta:c}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Da{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(e,t,n){this._firstTwoTouches||n.length<2||(this._firstTwoTouches=[n[0].identifier,n[1].identifier],this._start([t[0],t[1]]))}touchmove(e,t,n){if(!this._firstTwoTouches)return;e.preventDefault();let[r,i]=this._firstTwoTouches,a=Oa(n,t,r),o=Oa(n,t,i);if(!a||!o)return;let s=this._aroundCenter?null:a.add(o).div(2);return this._move([a,o],s,e)}touchend(e,t,n){if(!this._firstTwoTouches)return;let[r,i]=this._firstTwoTouches,a=Oa(n,t,r),o=Oa(n,t,i);a&&o||(this._active&&d.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&e.around===`center`}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function Oa(e,t,n){for(let r=0;r<e.length;r++)if(e[r].identifier===n)return t[r]}function ka(e,t){return Math.log(e/t)/Math.LN2}class Aa extends Da{constructor(){super(),this._zoomRate=1,this._zoomThreshold=.1}setZoomRate(e){this._zoomRate=e??1}setZoomThreshold(e){this._zoomThreshold=e??.1}reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,t){let n=this._distance;if(this._distance=e[0].dist(e[1]),this._active||!(Math.abs(ka(this._distance,this._startDistance))<this._zoomThreshold))return this._active=!0,{zoomDelta:ka(this._distance,n)*this._zoomRate,pinchAround:t}}}function ja(e,t){return 180*e.angleWith(t)/Math.PI}class Ma extends Da{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,t,n){let r=this._vector;if(this._vector=e[0].sub(e[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:ja(this._vector,r),pinchAround:t}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());let t=25/(Math.PI*this._minDiameter)*360,n=ja(e,this._startVector);return Math.abs(n)<t}}function Na(e){return Math.abs(e.y)>Math.abs(e.x)}class Pa extends Da{constructor(e){super(),this._currentTouchCount=0,this._map=e}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(e,t,n){super.touchstart(e,t,n),this._currentTouchCount=n.length}_start(e){this._lastPoints=e,Na(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,t,n){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;let r=e[0].sub(this._lastPoints[0]),i=e[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(r,i,n.timeStamp),this._valid?(this._lastPoints=e,this._active=!0,{pitchDelta:(r.y+i.y)/2*-.5}):void 0}gestureBeginsVertically(e,t,n){if(this._valid!==void 0)return this._valid;let r=e.mag()>=2,i=t.mag()>=2;if(!r&&!i)return;if(!r||!i)return this._firstMove===void 0&&(this._firstMove=n),n-this._firstMove<100&&void 0;let a=e.y>0==t.y>0;return Na(e)&&Na(t)&&a}}let Fa={panStep:100,bearingStep:15,pitchStep:10};class Ia{constructor(e){this._tr=new G(e);let t=Fa;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let n=0,r=0,i=0,a=0,o=0;switch(e.keyCode){case 61:case 107:case 171:case 187:n=1;break;case 189:case 109:case 173:n=-1;break;case 37:e.shiftKey?r=-1:(e.preventDefault(),a=-1);break;case 39:e.shiftKey?r=1:(e.preventDefault(),a=1);break;case 38:e.shiftKey?i=1:(e.preventDefault(),o=-1);break;case 40:e.shiftKey?i=-1:(e.preventDefault(),o=1);break;default:return}return this._rotationDisabled&&(r=0,i=0),{cameraAnimation:s=>{let c=this._tr;s.easeTo({duration:300,easeId:`keyboardHandler`,easing:La,zoom:n?t.cw(c.zoom+n*(e.shiftKey?2:1),s.getZoomSnap()):c.zoom,bearing:c.bearing+r*this._bearingStep,pitch:c.pitch+i*this._pitchStep,offset:[-a*this._panStep,-o*this._panStep],center:c.center},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function La(e){return e*(2-e)}let Ra=4.000244140625;class za{constructor(e,t){this._onTimeout=e=>{this._type=`wheel`,this._delta-=this._lastValue,this._active||this._start(e)},this._map=e,this._tr=new G(e),this._triggerRenderFrame=t,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&e.around===`center`)}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(e){return!!this._map.cooperativeGestures.isEnabled()&&!(e.ctrlKey||this._map.cooperativeGestures.isBypassed(e))}wheel(e){if(!this.isEnabled())return;if(this._shouldBePrevented(e))return void this._map.cooperativeGestures.notifyGestureBlocked(`wheel_zoom`,e);let t=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY,n=l(),r=n-(this._lastWheelEventTime||0);this._lastWheelEventTime=n,t!==0&&t%Ra==0?this._type=`wheel`:t!==0&&Math.abs(t)<4?this._type=`trackpad`:r>400?(this._type=null,this._lastValue=t,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(r*t)<200?`trackpad`:`wheel`,this._timeout&&(clearTimeout(this._timeout),this._timeout=null,t+=this._lastValue)),e.shiftKey&&t&&(t/=4),this._type&&(this._lastWheelEvent=e,this._delta-=t,this._active||this._start(e)),e.preventDefault()}_start(e){if(!this._delta)return;this._needsRerender=!1,this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);let n=d.mousePos(this._map.getCanvas(),e),r=this._tr;this._aroundPoint=this._aroundCenter?r.transform.locationToScreenPoint(t.W.convert(r.center)):n,this._needsRerender||(this._needsRerender=!0,this._triggerRenderFrame())}renderFrame(){if(!this._needsRerender||(this._needsRerender=!1,!this.isActive()))return;let e=this._tr.transform;if(typeof this._lastExpectedZoom==`number`){let t=e.zoom-this._lastExpectedZoom;typeof this._startZoom==`number`&&(this._startZoom+=t),typeof this._targetZoom==`number`&&(this._targetZoom+=t)}if(this._delta!==0){let n=this._type===`wheel`&&Math.abs(this._delta)>Ra?this._wheelZoomRate:this._defaultZoomRate,r=2/(1+Math.exp(-Math.abs(this._delta*n)));this._delta<0&&r!==0&&(r=1/r);let i=typeof this._targetZoom==`number`?t.ao(this._targetZoom):e.scale,a=e.applyConstrain(e.getCameraLngLat(),t.ar(i*r)).zoom,o=this._map.getZoomSnap();if(this._type===`wheel`&&o>0){let n=t.cw(e.zoom,o);this._targetZoom=t.cw(a,o,a-n)}else this._targetZoom=a;this._type===`wheel`&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let n=typeof this._targetZoom==`number`?this._targetZoom:e.zoom,r=this._startZoom,i=this._easing,a,o=!1;if(this._type===`wheel`&&r&&i){let e=l()-this._lastWheelEventTime,s=Math.min((e+5)/200,1),c=i(s);a=t.H.number(r,n,c),s<1?this._needsRerender=!0:o=!0}else a=n,o=!0;return this._active=!0,o&&(this._active=!1,this._finishTimeout=setTimeout((()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout}),200)),this._lastExpectedZoom=a,{noInertia:!0,needsRenderFrame:!o,zoomDelta:a-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let n=t.cy;if(this._prevEase){let e=this._prevEase,r=(l()-e.start)/e.duration,i=e.easing(r+.01)-e.easing(r),a=.27/Math.sqrt(i*i+1e-4)*.01,o=Math.sqrt(.0729-a*a);n=t.cv(a,o,.25,1)}return this._prevEase={start:l(),duration:e,easing:n},n}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Ba{constructor(e,t){this._clickZoom=e,this._tapZoom=t}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 Va{constructor(e){this._tr=new G(e),this.reset()}reset(){this._active=!1}dblclick(e,n){return e.preventDefault(),{cameraAnimation:r=>{r.easeTo({duration:300,zoom:t.cw(this._tr.zoom+(e.shiftKey?-1:1),r.getZoomSnap()),around:this._tr.unproject(n)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ha{constructor(){this._tap=new K({numTouches:1,numTaps:1}),this._zoomRate=1,this.reset()}setZoomRate(e){this._zoomRate=e??1}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(e,t,n){if(!this._swipePoint)if(this._tapTime){let r=t[0],i=e.timeStamp-this._tapTime<500,a=this._tapPoint.dist(r)<30;i&&a?n.length>0&&(this._swipePoint=r,this._swipeTouch=n[0].identifier):this.reset()}else this._tap.touchstart(e,t,n)}touchmove(e,t,n){if(this._tapTime){if(this._swipePoint){if(n[0].identifier!==this._swipeTouch)return;let r=t[0],i=r.y-this._swipePoint.y;return this._swipePoint=r,e.preventDefault(),this._active=!0,{zoomDelta:i/128*this._zoomRate}}}else this._tap.touchmove(e,t,n)}touchend(e,t,n){if(this._tapTime)this._swipePoint&&n.length===0&&this.reset();else{let r=this._tap.touchend(e,t,n);r&&(this._tapTime=e.timeStamp,this._tapPoint=r)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ua{constructor(e,t,n){this._el=e,this._mousePan=t,this._touchPan=n}enable(e){this._inertiaOptions=e||{},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 Wa{constructor(e,t,n,r){this._pitchWithRotate=e.pitchWithRotate,this._rollEnabled=e.rollEnabled,this._mouseRotate=t,this._mousePitch=n,this._mouseRoll=r}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}}class Ga{constructor(e,t,n,r){this._el=e,this._touchZoom=t,this._touchRotate=n,this._tapDragZoom=r,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add(`maplibregl-touch-zoom-rotate`)}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()}setZoomRate(e){this._touchZoom.setZoomRate(e),this._tapDragZoom.setZoomRate(e)}setZoomThreshold(e){this._touchZoom.setZoomThreshold(e)}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class Ka{constructor(e,t){this._bypassKey=navigator.userAgent.includes(`Mac`)?`metaKey`:`ctrlKey`,this._map=e,this._options=t,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;let e=this._map.getCanvasContainer();e.classList.add(`maplibregl-cooperative-gestures`),this._container=d.create(`div`,`maplibregl-cooperative-gesture-screen`,e);let t=this._map._getUIString(`CooperativeGesturesHandler.WindowsHelpText`);this._bypassKey===`metaKey`&&(t=this._map._getUIString(`CooperativeGesturesHandler.MacHelpText`));let n=this._map._getUIString(`CooperativeGesturesHandler.MobileHelpText`),r=document.createElement(`div`);r.className=`maplibregl-desktop-message`,r.textContent=t,this._container.appendChild(r);let i=document.createElement(`div`);i.className=`maplibregl-mobile-message`,i.textContent=n,this._container.appendChild(i),this._container.setAttribute(`aria-hidden`,`true`)}_destroyUI(){this._container&&(this._container.remove(),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(e){return e[this._bypassKey]}notifyGestureBlocked(e,n){this._enabled&&(this._map.fire(new t.n(`cooperativegestureprevented`,{gestureType:e,originalEvent:n})),this._container.classList.add(`maplibregl-show`),setTimeout((()=>{this._container.classList.remove(`maplibregl-show`)}),100))}}let qa=e=>e.zoom||e.drag||e.roll||e.pitch||e.rotate;class Ja extends t.n{}function Ya(e){return e.panDelta?.mag()||e.zoomDelta||e.bearingDelta||e.pitchDelta||e.rollDelta}class q{get _ownerDocument(){return this._el?.ownerDocument||document}get _ownerWindow(){return this._el?.ownerDocument?.defaultView||window}constructor(e,n){this.handleWindowEvent=e=>{this.handleEvent(e,`${e.type}Window`)},this.handleEvent=(e,n)=>{if(e.type===`blur`)return void this.stop(!0);this._updatingCamera=!0;let r=e.type===`renderFrame`?void 0:e,i={needsRenderFrame:!1},a={},o={};for(let{handlerName:s,handler:c,allowed:l}of this._handlers){if(!c.isEnabled())continue;let u;if(this._blockedByActive(o,l,s))c.reset();else if(c[n||e.type]){if(t.cz(e,n||e.type)){let t=d.mousePos(this._map.getCanvas(),e);u=c[n||e.type](e,t)}else if(t.cA(e,n||e.type)){let t=this._getMapTouches(e.touches),r=d.touchPos(this._map.getCanvas(),t);u=c[n||e.type](e,r,t)}else t.cB(n||e.type)||(u=c[n||e.type](e));this.mergeHandlerResult(i,a,u,s,r),u!=null&&u.needsRenderFrame&&this._triggerRenderFrame()}(u||c.isActive())&&(o[s]=c)}let s={};for(let e in this._previousActiveHandlers)o[e]||(s[e]=r);this._previousActiveHandlers=o,(Object.keys(s).length||Ya(i))&&(this._changes.push([i,a,s]),this._triggerRenderFrame()),(Object.keys(o).length||Ya(i))&&this._map._stop(!0),this._updatingCamera=!1;let{cameraAnimation:c}=i;c&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],c(this._map))},this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new ca(e),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n);let r=this._el;this._listeners=[[r,`touchstart`,{passive:!0}],[r,`touchmove`,{passive:!1}],[r,`touchend`,void 0],[r,`touchcancel`,void 0],[r,`mousedown`,void 0],[r,`mousemove`,void 0],[r,`mouseup`,void 0],[this._ownerDocument,`mousemove`,{capture:!0}],[this._ownerDocument,`mouseup`,void 0],[r,`mouseover`,void 0],[r,`mouseout`,void 0],[r,`dblclick`,void 0],[r,`click`,void 0],[r,`keydown`,{capture:!1}],[r,`keyup`,void 0],[r,`wheel`,{passive:!1}],[r,`contextmenu`,void 0],[this._ownerWindow,`blur`,void 0]];for(let[e,t,n]of this._listeners)e.addEventListener(t,e===this._ownerDocument?this.handleWindowEvent:this.handleEvent,n)}destroy(){for(let[e,t,n]of this._listeners)e.removeEventListener(t,e===this._ownerDocument?this.handleWindowEvent:this.handleEvent,n)}_addDefaultHandlers(e){let n=this._map,r=n.getCanvasContainer();this._add(`mapEvent`,new ma(n,e));let i=n.boxZoom=new ga(n,e);this._add(`boxZoom`,i),e.interactive&&e.boxZoom&&i.enable();let a=n.cooperativeGestures=new Ka(n,e.cooperativeGestures);this._add(`cooperativeGestures`,a),e.cooperativeGestures&&a.enable();let o=new ya(n),s=new Va(n);n.doubleClickZoom=new Ba(s,o),this._add(`tapZoom`,o),this._add(`clickZoom`,s),e.interactive&&e.doubleClickZoom&&n.doubleClickZoom.enable();let c=new Ha;this._add(`tapDragZoom`,c);let l=n.touchPitch=new Pa(n);this._add(`touchPitch`,l),e.interactive&&e.touchPitch&&n.touchPitch.enable(e.touchPitch);let u=()=>n.project(n.getCenter()),d=function({enable:e,clickTolerance:n,aroundCenter:r=!0,minPixelCenterThreshold:i=100,rotateDegreesPerPixelMoved:a=.8},o){let s=new Sa({checkCorrectEvent:e=>e.button===0&&e.ctrlKey||e.button===2&&!e.ctrlKey});return new ba({clickTolerance:n,move:(e,n)=>{let s=o();if(r&&Math.abs(s.y-e.y)>i)return{bearingDelta:t.cx(new t.P(e.x,n.y),n,s)};let c=(n.x-e.x)*a;return r&&n.y<s.y&&(c=-c),{bearingDelta:c}},moveStateManager:s,enable:e,assignEvents:Ta})}(e,u),f=function({enable:e,clickTolerance:t,pitchDegreesPerPixelMoved:n=-.5}){let r=new Sa({checkCorrectEvent:e=>e.button===0&&e.ctrlKey||e.button===2});return new ba({clickTolerance:t,move:(e,t)=>({pitchDelta:(t.y-e.y)*n}),moveStateManager:r,enable:e,assignEvents:Ta})}(e),p=function({enable:e,clickTolerance:t,rollDegreesPerPixelMoved:n=.3},r){let i=new Sa({checkCorrectEvent:e=>e.button===2&&e.ctrlKey});return new ba({clickTolerance:t,move:(e,t)=>{let i=r(),a=(t.x-e.x)*n;return t.y<i.y&&(a=-a),{rollDelta:a}},moveStateManager:i,enable:e,assignEvents:Ta})}(e,u);n.dragRotate=new Wa(e,d,f,p),this._add(`mouseRotate`,d,[`mousePitch`]),this._add(`mousePitch`,f,[`mouseRotate`,`mouseRoll`]),this._add(`mouseRoll`,p,[`mousePitch`]),e.interactive&&e.dragRotate&&n.dragRotate.enable();let m=function({enable:e,clickTolerance:t}){let n=new Sa({checkCorrectEvent:e=>e.button===0&&!e.ctrlKey});return new ba({clickTolerance:t,move:(e,t)=>({around:t,panDelta:t.sub(e)}),activateOnStart:!0,moveStateManager:n,enable:e,assignEvents:Ta})}(e),h=new Ea(e,n);n.dragPan=new Ua(r,m,h),this._add(`mousePan`,m),this._add(`touchPan`,h,[`touchZoom`,`touchRotate`]),e.interactive&&e.dragPan&&n.dragPan.enable(e.dragPan);let g=new Ma,_=new Aa;n.touchZoomRotate=new Ga(r,_,g,c),this._add(`touchRotate`,g,[`touchPan`,`touchZoom`]),this._add(`touchZoom`,_,[`touchPan`,`touchRotate`]),e.interactive&&e.touchZoomRotate&&n.touchZoomRotate.enable(e.touchZoomRotate),this._add(`blockableMapEvent`,new ha(n));let v=n.scrollZoom=new za(n,(()=>this._triggerRenderFrame()));this._add(`scrollZoom`,v,[`mousePan`]),e.interactive&&e.scrollZoom&&n.scrollZoom.enable(e.scrollZoom);let y=n.keyboard=new Ia(n);this._add(`keyboard`,y),e.interactive&&e.keyboard&&n.keyboard.enable()}_add(e,t,n){this._handlers.push({handlerName:e,handler:t,allowed:n}),this._handlersById[e]=t}stop(e){if(!this._updatingCamera){for(let{handler:e}of this._handlers)e.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(let{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!qa(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,t,n){for(let r in e)if(r!==n&&!t?.includes(r))return!0;return!1}_getMapTouches(e){let t=[];for(let n of e)this._el.contains(n.target)&&t.push(n);return t}mergeHandlerResult(e,n,r,i,a){if(!r)return;t.e(e,r);let o={handlerName:i,originalEvent:r.originalEvent||a};r.zoomDelta!==void 0&&(n.zoom=o),r.panDelta!==void 0&&(n.drag=o),r.rollDelta!==void 0&&(n.roll=o),r.pitchDelta!==void 0&&(n.pitch=o),r.bearingDelta!==void 0&&(n.rotate=o)}_applyChanges(){let e={},n={},r={};for(let[i,a,o]of this._changes)i.panDelta&&(e.panDelta=(e.panDelta||new t.P(0,0))._add(i.panDelta)),i.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+i.zoomDelta),i.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+i.bearingDelta),i.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+i.pitchDelta),i.rollDelta&&(e.rollDelta=(e.rollDelta||0)+i.rollDelta),i.around!==void 0&&(e.around=i.around),i.pinchAround!==void 0&&(e.pinchAround=i.pinchAround),i.noInertia&&(e.noInertia=i.noInertia),t.e(n,a),t.e(r,o);this._updateMapTransform(e,n,r),this._changes=[]}_updateMapTransform(e,t,n){let r=this._map,i=r._getTransformForUpdate(),a=r.terrain;if(!(Ya(e)||a&&this._terrainMovement))return void this._fireEvents(t,n,!0);r._stop(!0);let{panDelta:o,zoomDelta:s,bearingDelta:c,pitchDelta:l,rollDelta:u,around:d,pinchAround:f}=e;f!==void 0&&(d=f),d||=r.transform.centerPoint,a&&!i.isPointOnMapSurface(d)&&(d=i.centerPoint);let p={panDelta:o,zoomDelta:s,rollDelta:u,pitchDelta:l,bearingDelta:c,around:d};this._map.cameraHelper.useGlobeControls&&!i.isPointOnMapSurface(d)&&(d=i.centerPoint);let m=d.distSqr(i.centerPoint)<.01?i.center:i.screenPointToLocation(o?d.sub(o):d);this._handleMapControls({terrain:a,tr:i,deltasForHelper:p,preZoomAroundLoc:m,combinedEventsInProgress:t,panDelta:o}),r._applyUpdatedTransform(i),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(t,n,!0)}_handleMapControls({terrain:e,tr:t,deltasForHelper:n,preZoomAroundLoc:r,combinedEventsInProgress:i,panDelta:a}){let o=this._map.cameraHelper;if(o.handleMapControlsRollPitchBearingZoom(n,t),e)return o.useGlobeControls?(this._terrainMovement||!i.drag&&!i.zoom||(this._terrainMovement=!0,this._map._elevationFreeze=!0),void o.handleMapControlsPan(n,t,r)):this._terrainMovement||!i.drag&&!i.zoom?void(i.drag&&this._terrainMovement&&a?t.setCenter(t.screenPointToLocation(t.centerPoint.sub(a))):o.handleMapControlsPan(n,t,r)):(this._terrainMovement=!0,this._map._elevationFreeze=!0,void o.handleMapControlsPan(n,t,r));o.handleMapControlsPan(n,t,r)}_fireEvents(e,n,r){let i=qa(this._eventsInProgress),a=qa(e),o={};for(let t in e){let{originalEvent:n}=e[t];this._eventsInProgress[t]||(o[`${t}start`]=n),this._eventsInProgress[t]=e[t]}!i&&a&&this._fireEvent(`movestart`,a.originalEvent);for(let e in o)this._fireEvent(e,o[e]);a&&this._fireEvent(`move`,a.originalEvent);for(let t in e){let{originalEvent:n}=e[t];this._fireEvent(t,n)}let c={},l;for(let e in this._eventsInProgress){let{handlerName:t,originalEvent:r}=this._eventsInProgress[e];this._handlersById[t].isActive()||(delete this._eventsInProgress[e],l=n[t]||r,c[`${e}end`]=l)}for(let e in c)this._fireEvent(e,c[e]);let u=qa(this._eventsInProgress),d=(i||a)&&!u;if(d&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;let e=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&e.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(e)}if(r&&d){this._updatingCamera=!0;let e=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),n=e=>e!==0&&-this._bearingSnap<e&&e<this._bearingSnap;!e||!e.essential&&s.prefersReducedMotion?(this._map.fire(new t.n(`moveend`,{originalEvent:l})),n(this._map.getBearing())&&this._map.resetNorth()):(n(e.bearing||this._map.getBearing())&&(e.bearing=0),e.freezeElevation=!0,this._map.easeTo(e,{originalEvent:l})),this._updatingCamera=!1}}_fireEvent(e,n){this._map.fire(new t.n(e,n?{originalEvent:n}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add((e=>{delete this._frameId,this.handleEvent(new Ja(`renderFrame`,{timeStamp:e})),this._applyChanges()}))}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class J extends t.E{constructor(e,t,n){super(),this._renderFrameCallback=()=>{let e=Math.min((l()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(e)),e<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=n.bearingSnap,this._zoomSnap=n.zoomSnap,this.cameraHelper=t,this.on(`moveend`,(()=>{delete this._requestedCameraState}))}migrateProjection(e,t){e.apply(this.transform,!0),this.transform=e,this.cameraHelper=t}getCenter(){return new t.W(this.transform.center.lng,this.transform.center.lat)}setCenter(e,t){return this.jumpTo({center:e},t)}getCenterElevation(){return this.transform.elevation}setCenterElevation(e,t){return this.jumpTo({elevation:e},t),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(e){this._centerClampedToGround=e}panBy(e,n,r){return e=t.P.convert(e).mult(-1),this.panTo(this.transform.center,t.e({offset:e},n),r)}panTo(e,n,r){return this.easeTo(t.e({center:e},n),r)}getZoom(){return this.transform.zoom}setZoom(e,t){return this.jumpTo({zoom:e},t),this}zoomTo(e,n,r){return this.easeTo(t.e({zoom:e},n),r)}zoomIn(e,n){return this.zoomTo(t.cw(this.getZoom()+1,this._zoomSnap),e,n),this}zoomOut(e,n){return this.zoomTo(t.cw(this.getZoom()-1,this._zoomSnap),e,n),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(e,n){return e!=this.transform.fov&&(this.transform.setFov(e),this.fire(new t.n(`movestart`,n)).fire(new t.n(`move`,n)).fire(new t.n(`moveend`,n))),this}getBearing(){return this.transform.bearing}setZoomSnap(e){return this._zoomSnap=e,this}getZoomSnap(){return this._zoomSnap}setBearing(e,t){return this.jumpTo({bearing:e},t),this}getPadding(){return this.transform.padding}setPadding(e,t){return this.jumpTo({padding:e},t),this}rotateTo(e,n,r){return this.easeTo(t.e({bearing:e},n),r)}resetNorth(e,n){return this.rotateTo(0,t.e({duration:1e3},e),n),this}resetNorthPitch(e,n){return this.easeTo(t.e({bearing:0,pitch:0,roll:0,duration:1e3},e),n),this}snapToNorth(e,t){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,t):this}getPitch(){return this.transform.pitch}setPitch(e,t){return this.jumpTo({pitch:e},t),this}getRoll(){return this.transform.roll}setRoll(e,t){return this.jumpTo({roll:e},t),this}cameraForBounds(e,t){e=le.convert(e).adjustAntiMeridian();let n=t?.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),n,t)}_cameraForBoxAndBearing(e,n,r,i){let a={top:0,bottom:0,right:0,left:0};if(typeof(i=t.e({padding:a,offset:[0,0],maxZoom:this.transform.maxZoom},i)).padding==`number`){let e=i.padding;i.padding={top:e,bottom:e,right:e,left:e}}let o=t.e(a,i.padding);i.padding=o;let s=this.transform,c=new le(e,n),l=this.cameraHelper.cameraForBoxAndBearing(i,o,c,r,s);return l&&this._zoomSnap&&(l.zoom=t.cw(l.zoom,this._zoomSnap,-1)),l}fitBounds(e,t,n){return this._fitInternal(this.cameraForBounds(e,t),t,n)}fitScreenCoordinates(e,n,r,i,a){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(t.P.convert(e)),this.transform.screenPointToLocation(t.P.convert(n)),r,i),i,a)}_fitInternal(e,n,r){return e?(delete(n=t.e(e,n)).padding,n.linear?this.easeTo(n,r):this.flyTo(n,r)):this}jumpTo(e,n){this.stop(),`zoom`in e&&this._zoomSnap&&(e.zoom=t.cw(e.zoom,this._zoomSnap));let r=this._getTransformForUpdate(),i=!1,a=!1,o=!1,s=r.zoom;this.terrain&&r.setElevation(this.terrain.getElevationForLngLatZoom(e.center?t.W.convert(e.center):r.center,e.zoom||r.tileZoom)),this.cameraHelper.handleJumpToCenterZoom(r,e);let c=r.zoom!==s;return`elevation`in e&&r.elevation!==+e.elevation&&r.setElevation(+e.elevation),`bearing`in e&&r.bearing!==+e.bearing&&(i=!0,r.setBearing(+e.bearing)),`pitch`in e&&r.pitch!==+e.pitch&&(a=!0,r.setPitch(+e.pitch)),`roll`in e&&r.roll!==+e.roll&&(o=!0,r.setRoll(+e.roll)),e.padding==null||r.isPaddingEqual(e.padding)||r.setPadding(e.padding),this._applyUpdatedTransform(r),this.fire(new t.n(`movestart`,n)).fire(new t.n(`move`,n)),c&&this.fire(new t.n(`zoomstart`,n)).fire(new t.n(`zoom`,n)).fire(new t.n(`zoomend`,n)),i&&this.fire(new t.n(`rotatestart`,n)).fire(new t.n(`rotate`,n)).fire(new t.n(`rotateend`,n)),a&&this.fire(new t.n(`pitchstart`,n)).fire(new t.n(`pitch`,n)).fire(new t.n(`pitchend`,n)),o&&this.fire(new t.n(`rollstart`,n)).fire(new t.n(`roll`,n)).fire(new t.n(`rollend`,n)),this.fire(new t.n(`moveend`,n))}calculateCameraOptionsFromTo(e,n,r,i=0){let a=t.a7.fromLngLat(e,n),o=t.a7.fromLngLat(r,i),s=o.x-a.x,c=o.y-a.y,l=o.z-a.z,u=Math.hypot(s,c,l);if(u===0)throw Error(`Can't calculate camera options with same From and To`);let d=Math.hypot(s,c),f=t.ar(this.transform.cameraToCenterDistance/u/this.transform.tileSize),p=180*Math.atan2(s,-c)/Math.PI,m=180*Math.acos(d/u)/Math.PI;return m=l<0?90-m:90+m,{center:o.toLngLat(),elevation:i,zoom:f,pitch:m,bearing:p}}calculateCameraOptionsFromCameraLngLatAltRotation(e,t,n,r,i){let a=this.transform.calculateCenterFromCameraLngLatAlt(e,t,n,r);return{center:a.center,elevation:a.elevation,zoom:a.zoom,bearing:n,pitch:r,roll:i}}easeTo(e,n){this._stop(!1,e.easeId),`zoom`in(e=t.e({offset:[0,0],duration:500,easing:t.cy},e))&&this._zoomSnap&&(e.zoom=t.cw(e.zoom,this._zoomSnap)),(!1===e.animate||!e.essential&&s.prefersReducedMotion)&&(e.duration=0);let r=this._getTransformForUpdate(),i=this.getBearing(),a=r.pitch,o=r.roll,c=`bearing`in e?this._normalizeBearing(e.bearing,i):i,l=`pitch`in e?+e.pitch:a,u=`roll`in e?this._normalizeBearing(e.roll,o):o,d=`padding`in e?e.padding:r.padding,f=t.P.convert(e.offset),p,m;e.around&&(p=t.W.convert(e.around),m=r.locationToScreenPoint(p));let h={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},g=this.cameraHelper.handleEaseTo(r,{bearing:c,pitch:l,roll:u,padding:d,around:p,aroundPoint:m,offsetAsPoint:f,offset:e.offset,zoom:e.zoom,center:e.center});return this._rotating||=i!==c,this._pitching||=l!==a,this._rolling||=u!==o,this._padding=!r.isPaddingEqual(d),this._zooming||=g.isZooming,this._easeId=e.easeId,this._prepareEase(n,e.noMoveStart,h),this.terrain&&this._prepareElevation(g.elevationCenter),this._ease((t=>{g.easeFunc(t),this.terrain&&!e.freezeElevation&&this._updateElevation(t),this._applyUpdatedTransform(r),this._fireMoveEvents(n)}),(t=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(n,t)}),e),this}_prepareEase(e,n,r={}){this._moving=!0,n||r.moving||this.fire(new t.n(`movestart`,e)),this._zooming&&!r.zooming&&this.fire(new t.n(`zoomstart`,e)),this._rotating&&!r.rotating&&this.fire(new t.n(`rotatestart`,e)),this._pitching&&!r.pitching&&this.fire(new t.n(`pitchstart`,e)),this._rolling&&!r.rolling&&this.fire(new t.n(`rollstart`,e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(e,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(e){this._elevationStart!==void 0&&this._elevationCenter!==void 0||this._prepareElevation(this.transform.center),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));let n=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(e<1&&n!==this._elevationTarget){let t=this._elevationTarget-this._elevationStart;this._elevationStart+=e*(t-(n-(t*e+this._elevationStart))/(1-e)),this._elevationTarget=n}this.transform.setElevation(t.H.number(this._elevationStart,this._elevationTarget,e))}_finalizeElevation(){this._elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||=this.transform.clone(),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(e){if(!this.terrain&&e.elevation>=0&&e.pitch<=90)return{};let t=e.getCameraLngLat(),n=e.getCameraAltitude(),r=this.terrain?this.terrain.getElevationForLngLatZoom(t,e.zoom):0;if(n<r){let n=this.calculateCameraOptionsFromTo(t,r,e.center,e.elevation);return{pitch:n.pitch,zoom:n.zoom}}return{}}_applyUpdatedTransform(e){let t=[];if(t.push((e=>this._elevateCameraIfInsideTerrain(e))),this.transformCameraUpdate&&t.push((e=>this.transformCameraUpdate(e))),!t.length)return;let n=e.clone();for(let e of t){let t=n.clone(),{center:r,zoom:i,roll:a,pitch:o,bearing:s,elevation:c}=e(t);r&&t.setCenter(r),c!==void 0&&t.setElevation(c),i!==void 0&&t.setZoom(i),a!==void 0&&t.setRoll(a),o!==void 0&&t.setPitch(o),s!==void 0&&t.setBearing(s),n.apply(t,!1)}this.transform.apply(n,!1)}_fireMoveEvents(e){this.fire(new t.n(`move`,e)),this._zooming&&this.fire(new t.n(`zoom`,e)),this._rotating&&this.fire(new t.n(`rotate`,e)),this._pitching&&this.fire(new t.n(`pitch`,e)),this._rolling&&this.fire(new t.n(`roll`,e))}_afterEase(e,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId;let r=this._zooming,i=this._rotating,a=this._pitching,o=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,r&&this.fire(new t.n(`zoomend`,e)),i&&this.fire(new t.n(`rotateend`,e)),a&&this.fire(new t.n(`pitchend`,e)),o&&this.fire(new t.n(`rollend`,e)),this.fire(new t.n(`moveend`,e))}flyTo(e,n){if(!e.essential&&s.prefersReducedMotion){let r=t.V(e,[`center`,`zoom`,`bearing`,`pitch`,`roll`,`elevation`,`padding`]);return this.jumpTo(r,n)}this.stop(),`zoom`in(e=t.e({offset:[0,0],speed:1.2,curve:1.42,easing:t.cy},e))&&this._zoomSnap&&(e.zoom=t.cw(e.zoom,this._zoomSnap));let r=this._getTransformForUpdate(),i=r.bearing,a=r.pitch,o=r.roll,c=r.padding,l=`bearing`in e?this._normalizeBearing(e.bearing,i):i,u=`pitch`in e?+e.pitch:a,d=`roll`in e?this._normalizeBearing(e.roll,o):o,f=`padding`in e?e.padding:r.padding,p=t.P.convert(e.offset),m=r.centerPoint.add(p),h=r.screenPointToLocation(m),g=this.cameraHelper.handleFlyTo(r,{bearing:l,pitch:u,roll:d,padding:f,locationAtOffset:h,offsetAsPoint:p,center:e.center,minZoom:e.minZoom,zoom:e.zoom}),_=e.curve,v=Math.max(r.width,r.height),y=v/g.scaleOfZoom,b=g.pixelPathLength;typeof g.scaleOfMinZoom==`number`&&(_=Math.sqrt(v/g.scaleOfMinZoom/b*2));let x=_*_;function S(e){let t=(y*y-v*v+(e?-1:1)*x*x*b*b)/(2*(e?y:v)*x*b);return Math.log(Math.sqrt(t*t+1)-t)}function C(e){return(Math.exp(e)-Math.exp(-e))/2}function w(e){return(Math.exp(e)+Math.exp(-e))/2}let T=S(!1),E=function(e){return w(T)/w(T+_*e)},D=function(e){return v*((w(T)*(C(t=T+_*e)/w(t))-C(T))/x)/b;var t},O=(S(!0)-T)/_;if(Math.abs(b)<2e-6||!isFinite(O)){if(Math.abs(v-y)<1e-6)return this.easeTo(e,n);let t=y<v?-1:1;O=Math.abs(Math.log(y/v))/_,D=()=>0,E=e=>Math.exp(t*_*e)}return e.duration=`duration`in e?+e.duration:1e3*O/(`screenSpeed`in e?+e.screenSpeed/_:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=i!==l,this._pitching=u!==a,this._rolling=d!==o,this._padding=!r.isPaddingEqual(f),this._prepareEase(n,!1),this.terrain&&this._prepareElevation(g.targetCenter),this._ease((s=>{let h=s*O,_=1/E(h),v=D(h);this._rotating&&r.setBearing(t.H.number(i,l,s)),this._pitching&&r.setPitch(t.H.number(a,u,s)),this._rolling&&r.setRoll(t.H.number(o,d,s)),this._padding&&(r.interpolatePadding(c,f,s),m=r.centerPoint.add(p)),g.easeFunc(s,_,v,m),this.terrain&&!e.freezeElevation&&this._updateElevation(s),this._applyUpdatedTransform(r),this._fireMoveEvents(n)}),(()=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(n)}),e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,t){var n;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let e=this._onEaseEnd;delete this._onEaseEnd,e.call(this,t)}return e||(n=this.handlers)==null||n.stop(!1),this}_ease(e,t,n){!1===n.animate||n.duration===0?(e(1),t()):(this._easeStart=l(),this._easeOptions=n,this._onEaseFrame=e,this._onEaseEnd=t,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,n){e=t.X(e,-180,180);let r=Math.abs(e-n);return Math.abs(e-360-n)<r&&(e-=360),Math.abs(e+360-n)<r&&(e+=360),e}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLat(t.W.convert(e),this.transform):null}}let Xa={compact:!0,customAttribution:`<a href="https://maplibre.org/" target="_blank">MapLibre</a>`};class Za{constructor(e=Xa){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=e=>{!e||e.sourceDataType!==`metadata`&&e.sourceDataType!==`visibility`&&e.dataType!==`style`&&e.type!==`terrain`||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1===this._compact?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=e}getDefaultPosition(){return`bottom-right`}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=d.create(`details`,`maplibregl-ctrl maplibregl-ctrl-attrib`),this._compactButton=d.create(`summary`,`maplibregl-ctrl-attrib-button`,this._container),this._compactButton.addEventListener(`click`,this._toggleAttribution),this._setElementTitle(this._compactButton,`ToggleAttribution`),this._innerContainer=d.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(){this._container.remove(),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(e,t){let n=this._map._getUIString(`AttributionControl.${t}`);e.title=n,e.setAttribute(`aria-label`,n)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map((e=>typeof e==`string`?e:``))):typeof this.options.customAttribution==`string`&&e.push(this.options.customAttribution)),this._map.style.stylesheet){let e=this._map.style.stylesheet;this.styleOwner=e.owner,this.styleId=e.id}let t=this._map.style.tileManagers;for(let n in t){let r=t[n];if(r.used||r.usedForTerrain){let t=r.getSource();t.attribution&&!e.includes(t.attribution)&&e.push(t.attribution)}}e=e.filter((e=>String(e).trim())),e.sort(((e,t)=>e.length-t.length)),e=e.filter(((t,n)=>{for(let r=n+1;r<e.length;r++)if(e[r].includes(t))return!1;return!0}));let n=e.join(` | `);n!==this._attribHTML&&(this._attribHTML=n,e.length?(this._innerContainer.innerHTML=d.sanitize(n),this._container.classList.remove(`maplibregl-attrib-empty`)):this._container.classList.add(`maplibregl-attrib-empty`),this._updateCompact(),this._editLink=null)}}class Qa{constructor(e={}){this._updateCompact=()=>{let e=this._container.children;if(e.length){let t=e[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1!==this._compact&&t.classList.add(`maplibregl-compact`):t.classList.remove(`maplibregl-compact`)}},this.options=e}getDefaultPosition(){return`bottom-left`}onAdd(e){this._map=e,this._compact=this.options?.compact,this._container=d.create(`div`,`maplibregl-ctrl`);let t=d.create(`a`,`maplibregl-ctrl-logo`);return t.target=`_blank`,t.rel=`noopener nofollow`,t.href=`https://maplibre.org/`,t.setAttribute(`aria-label`,this._map._getUIString(`LogoControl.Title`)),t.setAttribute(`rel`,`noopener nofollow`),this._container.appendChild(t),this._container.style.display=`block`,this._map.on(`resize`,this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off(`resize`,this._updateCompact),this._map=void 0,this._compact=void 0}}class $a{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){let t=++this._id;return this._queue.push({callback:e,id:t,cancelled:!1}),t}remove(e){let t=this._currentlyRunning,n=t?this._queue.concat(t):this._queue;for(let t of n)if(t.id===e)return void(t.cancelled=!0)}run(e=0){if(this._currentlyRunning)throw Error(`Attempting to run(), but is already running.`);let t=this._currentlyRunning=this._queue;this._queue=[];for(let n of t)if(!n.cancelled&&(n.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var eo=t.aS([{name:`a_pos3d`,type:`Int16`,components:3}]);class to extends t.E{constructor(e){super(),this._lastTilesetChange=l(),this.tileManager=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=e._source.tileSize*2**this.deltaZoom,e.usedForTerrain=!0,e.tileSize=this.tileSize}destruct(){this.tileManager.usedForTerrain=!1,this.tileManager.tileSize=null}getSource(){return this.tileManager._source}update(e,n){this.tileManager.update(e,n),this._renderableTilesKeys=[];let r={};for(let i of Ge(e,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:n,calculateTileZoom:this.tileManager._source.calculateTileZoom}))r[i.key]=!0,this._renderableTilesKeys.push(i.key),this._tiles[i.key]||(i.terrainRttPosMatrix32f=new Float64Array(16),t.c7(i.terrainRttPosMatrix32f,0,t.a6,t.a6,0,0,1),this._tiles[i.key]=new Me(i,this.tileSize),this._lastTilesetChange=l());for(let e in this._tiles)r[e]||delete this._tiles[e]}freeRtt(e){for(let t in this._tiles){let n=this._tiles[t];(!e||n.tileID.equals(e)||n.tileID.isChildOf(e)||e.isChildOf(n.tileID))&&(n.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map((e=>this.getTileByID(e)))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e,t){return t?this._getTerrainCoordsForTileRanges(e,t):this._getTerrainCoordsForRegularTile(e)}_getTerrainCoordsForRegularTile(e){let n={};for(let r of this._renderableTilesKeys){let i=this._tiles[r].tileID,a=e.clone(),o=t.bj();if(i.canonical.equals(e.canonical))t.c7(o,0,t.a6,t.a6,0,0,1);else if(i.canonical.isChildOf(e.canonical)){let n=i.canonical.z-e.canonical.z,r=i.canonical.x-(i.canonical.x>>n<<n),a=i.canonical.y-(i.canonical.y>>n<<n),s=t.a6>>n;t.c7(o,0,s,s,0,0,1),t.Q(o,o,[-r*s,-a*s,0])}else{if(!e.canonical.isChildOf(i.canonical))continue;{let n=e.canonical.z-i.canonical.z,r=e.canonical.x-(e.canonical.x>>n<<n),a=e.canonical.y-(e.canonical.y>>n<<n),s=t.a6>>n;t.c7(o,0,t.a6,t.a6,0,0,1),t.Q(o,o,[r*s,a*s,0]),t.S(o,o,[1/2**n,1/2**n,0])}}a.terrainRttPosMatrix32f=new Float32Array(o),n[r]=a}return n}_getTerrainCoordsForTileRanges(e,n){let r={};for(let i of this._renderableTilesKeys){let a=this._tiles[i].tileID;if(!this._isWithinTileRanges(a,n))continue;let o=e.clone(),s=t.bj();if(a.canonical.z===e.canonical.z){let n=e.canonical.x-a.canonical.x+e.wrap*(1<<e.canonical.z),r=e.canonical.y-a.canonical.y;t.c7(s,0,t.a6,t.a6,0,0,1),t.Q(s,s,[n*t.a6,r*t.a6,0])}else if(a.canonical.z>e.canonical.z){let n=a.canonical.z-e.canonical.z,r=a.canonical.x-(a.canonical.x>>n<<n)+e.wrap*(1<<a.canonical.z),i=a.canonical.y-(a.canonical.y>>n<<n),o=e.canonical.x-(a.canonical.x>>n),c=e.canonical.y-(a.canonical.y>>n),l=t.a6>>n;t.c7(s,0,l,l,0,0,1),t.Q(s,s,[-r*l+o*t.a6,-i*l+c*t.a6,0])}else{let n=e.canonical.z-a.canonical.z,r=e.canonical.x-(e.canonical.x>>n<<n)+e.wrap*(1<<e.canonical.z),i=e.canonical.y-(e.canonical.y>>n<<n),o=(e.canonical.x>>n)-a.canonical.x,c=(e.canonical.y>>n)-a.canonical.y,l=t.a6<<n;t.c7(s,0,l,l,0,0,1),t.Q(s,s,[r*t.a6+o*l,i*t.a6+c*l,0])}o.terrainRttPosMatrix32f=new Float32Array(s),r[i]=o}return r}getSourceTile(e,t){var n,r;let i=this.tileManager._source,a=e.overscaledZ-this.deltaZoom;if(a>i.maxzoom&&(a=i.maxzoom),a<i.minzoom)return;(n=this._sourceTileCache)[r=e.key]||(n[r]=e.scaledTo(a).key);let o=this.findTileInCaches(this._sourceTileCache[e.key]);if(!o?.dem&&t)for(;a>=i.minzoom&&!o?.dem;)o=this.findTileInCaches(e.scaledTo(a--).key);return o}findTileInCaches(e){let t=this.tileManager.getTileByID(e);return t||(t=this.tileManager._outOfViewCache.getByKey(e),t)}anyTilesAfterTime(e=Date.now()){return this._lastTilesetChange>=e}_isWithinTileRanges(e,t){let n=t[e.canonical.z];return!!n&&(e.wrap>n.minWrap||e.wrap<n.maxWrap||e.canonical.x>=n.minTileXWrapped&&e.canonical.x<=n.maxTileXWrapped&&e.canonical.y>=n.minTileY&&e.canonical.y<=n.maxTileY)}}class no{constructor(e,t,n){this._meshCache={},this.painter=e,this.tileManager=new to(t),this.options=n,this.exaggeration=typeof n.exaggeration==`number`?n.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}destroy(){this._fbo&&=(this._fbo.destroy(),null),this._fboCoordsTexture&&=(this._fboCoordsTexture.destroy(),null),this._fboDepthTexture&&=(this._fboDepthTexture.destroy(),null),this._emptyDemTexture&&=(this._emptyDemTexture.destroy(),null),this._emptyDepthTexture&&=(this._emptyDepthTexture.destroy(),null),this._coordsTexture&&=(this._coordsTexture.destroy(),null);for(let e in this._meshCache)this._meshCache[e].destroy();this._meshCache={},this.tileManager.destruct()}getDEMElevation(e,n,r,i=t.a6){let a=e.normalizeCoordinates(n,r,i);if(!a)return 0;let o=this.getTerrainData(a.tileID),s=o.tile?.dem;if(!s)return 0;let c=t.cC([],[a.x/i*t.a6,a.y/i*t.a6],o.u_terrain_matrix),l=[c[0]*s.dim,c[1]*s.dim],u=Math.floor(l[0]),d=Math.floor(l[1]),f=l[0]-u,p=l[1]-d;return s.get(u,d)*(1-f)*(1-p)+s.get(u+1,d)*f*(1-p)+s.get(u,d+1)*(1-f)*p+s.get(u+1,d+1)*f*p}getElevationForLngLatZoom(e,n){if(!t.cD(n,e.wrap()))return 0;let{tileID:r,mercatorX:i,mercatorY:a}=this._getOverscaledTileIDFromLngLatZoom(e,n);return this.getElevation(r,i%t.a6,a%t.a6,t.a6)}getElevationForLngLat(e,t){let n=Ge(t,{maxzoom:this.tileManager.maxzoom,minzoom:this.tileManager.minzoom,tileSize:512,terrain:this}),r=0;for(let e of n)e.canonical.z>r&&(r=Math.min(e.canonical.z,this.tileManager.maxzoom));return this.getElevationForLngLatZoom(e,r)}getElevation(e,n,r,i=t.a6){return this.getDEMElevation(e,n,r,i)*this.exaggeration}getTerrainData(e){if(!this._emptyDemTexture){let e=this.painter.context,n=new t.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new t.T(e,n,e.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new t.T(e,new t.R({width:1,height:1}),e.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=t.ap([])}let n=this.tileManager.getSourceTile(e,!0);if(n?.dem&&(!n.demTexture||n.needsTerrainPrepare)){let e=this.painter.context;n.demTexture=this.painter.getTileTexture(n.dem.stride),n.demTexture?n.demTexture.update(n.dem.getPixels(),{premultiply:!1}):n.demTexture=new t.T(e,n.dem.getPixels(),e.gl.RGBA,{premultiply:!1}),n.demTexture.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),n.needsTerrainPrepare=!1}let r=n&&n.toString()+n.tileID.key+e.key;if(r&&!this._demMatrixCache[r]){let i=this.tileManager.getSource().maxzoom,a=e.canonical.z-n.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=i?a=e.canonical.z-i:t.w(`cannot calculate elevation if elevation maxzoom > source.maxzoom`));let o=e.canonical.x-(e.canonical.x>>a<<a),s=e.canonical.y-(e.canonical.y>>a<<a),c=t.cE(new Float64Array(16),[1/(t.a6<<a),1/(t.a6<<a),0]);t.Q(c,c,[o*t.a6,s*t.a6,0]),this._demMatrixCache[r]={matrix:c,coord:e}}return{u_depth:2,u_terrain:3,u_terrain_dim:n?.dem?.dim||1,u_terrain_matrix:r?this._demMatrixCache[r].matrix:this._emptyDemMatrix,u_terrain_unpack:(n?.dem)?.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(n?.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:n}}getFramebuffer(e){let n=this.painter,r=n.width/devicePixelRatio,i=n.height/devicePixelRatio;return!this._fbo||this._fbo.width===r&&this._fbo.height===i||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new t.T(n.context,{width:r,height:i,data:null},n.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(n.context.gl.NEAREST,n.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new t.T(n.context,{width:r,height:i,data:null},n.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(n.context.gl.NEAREST,n.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=n.context.createFramebuffer(r,i,!0,!1),this._fbo.depthAttachment.set(n.context.createRenderbuffer(n.context.gl.DEPTH_COMPONENT16,r,i))),this._fbo.colorAttachment.set(e===`coords`?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){let e=this.painter.context;if(this._coordsTexture)return this._coordsTexture;let n=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let e=0,t=0;e<this._coordsTextureSize;e++)for(let r=0;r<this._coordsTextureSize;r++,t+=4)n[t+0]=255&r,n[t+1]=255&e,n[t+2]=r>>8<<4|e>>8,n[t+3]=0;let r=new t.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),i=new t.T(e,r,e.gl.RGBA,{premultiply:!1});return i.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=i,i}pointCoordinate(e){this.painter.maybeDrawDepth(!0),this.painter.maybeDrawCoords();let n=new Uint8Array(4),r=this.painter.context,i=r.gl,a=Math.round(e.x*this.painter.pixelRatio/devicePixelRatio),o=Math.round(e.y*this.painter.pixelRatio/devicePixelRatio),s=Math.round(this.painter.height/devicePixelRatio);r.bindFramebuffer.set(this.getFramebuffer(`coords`).framebuffer),i.readPixels(a,s-o-1,1,1,i.RGBA,i.UNSIGNED_BYTE,n),r.bindFramebuffer.set(null);let c=n[0]+(n[2]>>4<<8),l=n[1]+((15&n[2])<<8),u=this.coordsIndex[255-n[3]],d=u&&this.tileManager.getTileByID(u);if(!d)return null;let f=this._coordsTextureSize,p=(1<<d.tileID.canonical.z)*f;return new t.a7((d.tileID.canonical.x*f+c)/p+d.tileID.wrap,(d.tileID.canonical.y*f+l)/p,this.getElevation(d.tileID,c,l,f))}depthAtPoint(e){let t=new Uint8Array(4),n=this.painter.context,r=n.gl;return n.bindFramebuffer.set(this.getFramebuffer(`depth`).framebuffer),r.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,r.RGBA,r.UNSIGNED_BYTE,t),n.bindFramebuffer.set(null),(t[0]/16777216+t[1]/65536+t[2]/256+t[3])/256}getTerrainMesh(e){let n=this.painter.style.projection?.transitionState>0,r=n&&e.canonical.y===0,i=n&&e.canonical.y===(1<<e.canonical.z)-1,a=`m_${r?`n`:``}_${i?`s`:``}`;if(this._meshCache[a])return this._meshCache[a];let o=this.painter.context,s=new t.cF,c=new t.aW,l=this.meshSize,u=t.a6/l,d=l*l;for(let e=0;e<=l;e++)for(let t=0;t<=l;t++)s.emplaceBack(t*u,e*u,0);for(let e=0;e<d;e+=l+1)for(let t=0;t<l;t++)c.emplaceBack(t+e,l+t+e+1,l+t+e+2),c.emplaceBack(t+e,l+t+e+2,t+e+1);let f=s.length,p=f+(l+1),m=(l+1)*l,h=r?t.bq:0,g=+!r,_=i?t.br:t.a6,v=+!i;for(let e=0;e<=l;e++)s.emplaceBack(e*u,h,g);for(let e=0;e<=l;e++)s.emplaceBack(e*u,_,v);for(let e=0;e<l;e++)c.emplaceBack(m+e,p+e,p+e+1),c.emplaceBack(m+e,p+e+1,m+e+1),c.emplaceBack(0+e,f+e+1,f+e),c.emplaceBack(0+e,0+e+1,f+e+1);let y=s.length,b=y+2*(l+1);for(let e of[0,1])for(let n=0;n<=l;n++)for(let r of[0,1])s.emplaceBack(e*t.a6,n*u,r);for(let e=0;e<2*l;e+=2)c.emplaceBack(y+e,y+e+1,y+e+3),c.emplaceBack(y+e,y+e+3,y+e+2),c.emplaceBack(b+e,b+e+3,b+e+1),c.emplaceBack(b+e,b+e+2,b+e+3);let x=new Xt(o.createVertexBuffer(s,eo.members),o.createIndexBuffer(c),t.aV.simpleSegment(0,0,s.length,c.length));return this._meshCache[a]=x,x}getMeshFrameDelta(e){return 2*Math.PI*t.bD/2**Math.max(e,0)/5}getMinTileElevationForLngLatZoom(e,n){if(!t.cD(n,e.wrap()))return 0;let{tileID:r}=this._getOverscaledTileIDFromLngLatZoom(e,n);return this.getMinMaxElevation(r).minElevation??0}getMinMaxElevation(e){let t=this.getTerrainData(e).tile,n={minElevation:null,maxElevation:null};return t!=null&&t.dem&&(n.minElevation=t.dem.min*this.exaggeration,n.maxElevation=t.dem.max*this.exaggeration),n}_getOverscaledTileIDFromLngLatZoom(e,n){let r=t.a7.fromLngLat(e.wrap()),i=(1<<n)*t.a6,a=r.x*i,o=r.y*i,s=Math.floor(a/t.a6),c=Math.floor(o/t.a6);return{tileID:new t.a3(n,0,n,s,c),mercatorX:a,mercatorY:o}}}class ro{constructor(e,t,n){this._context=e,this._size=t,this._tileSize=n,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(let e of this._objects)e.texture.destroy(),e.fbo.destroy()}_createObject(e){let n=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),r=new t.T(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return r.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),this._context.extTextureFilterAnisotropic&&this._context.gl.texParameterf(this._context.gl.TEXTURE_2D,this._context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this._context.extTextureFilterAnisotropicMax),n.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),n.colorAttachment.set(r.texture),{id:e,fbo:n,texture:r,stamp:-1,inUse:!1}}getObjectForId(e){return this._objects[e]}useObject(e){e.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter((t=>e.id!==t)),this._recentlyUsed.push(e.id)}stampObject(e){e.stamp=++this._stamp}getOrCreateFreeObject(){for(let e of this._recentlyUsed)if(!this._objects[e].inUse)return this._objects[e];if(this._objects.length>=this._size)throw Error(`No free RenderPool available, call freeAllObjects() required!`);let e=this._createObject(this._objects.length);return this._objects.push(e),e}freeObject(e){e.inUse=!1}freeAllObjects(){for(let e of this._objects)this.freeObject(e)}isFull(){return!(this._objects.length<this._size)&&!1===this._objects.some((e=>!e.inUse))}}let io={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0};class ao{constructor(e,t){this.painter=e,this.terrain=t,this.pool=new ro(e.context,30,t.tileManager.tileSize*t.qualityFactor)}destruct(){this.pool.destruct()}getTexture(e){return this.pool.getObjectForId(e.rtt[this._stacks.length-1].id).texture}prepareForRender(e,t){var n;this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.tileManager.getRenderableTiles(),this._renderableLayerIds=e._order.filter((n=>!e._layers[n].isHidden(t))),this._coordsAscending={};for(let t in e.tileManagers){this._coordsAscending[t]={};let r=e.tileManagers[t].getVisibleCoordinates(),i=e.tileManagers[t].getSource(),a=i instanceof xe?i.terrainTileRanges:null;for(let e of r){let r=this.terrain.tileManager.getTerrainCoords(e,a);for(let e in r)(n=this._coordsAscending[t])[e]||(n[e]=[]),this._coordsAscending[t][e].push(r[e])}}this._rttFingerprints={};for(let t of e._order){let n=e._layers[t],r=n.source;if(io[n.type]&&!this._rttFingerprints[r]){this._rttFingerprints[r]={};let t=e.tileManagers[r]?.getState().revision??0;for(let e in this._coordsAscending[r])this._rttFingerprints[r][e]=`${this._coordsAscending[r][e].map((e=>e.key)).sort().join()}#${t}`}}for(let e of this._renderableTiles)for(let t in this._rttFingerprints){let n=this._rttFingerprints[t][e.tileID.key];n&&n!==e.rttFingerprint[t]&&(e.rtt=[])}}renderLayer(e,n){if(e.isHidden(this.painter.transform.zoom))return!1;let r=Object.assign(Object.assign({},n),{isRenderingToTexture:!0}),i=e.type,a=this.painter,o=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(io[i]&&(this._prevType&&io[this._prevType]||this._stacks.push([]),this._prevType=i,this._stacks[this._stacks.length-1].push(e.id),!o))return!0;if(io[this._prevType]||io[i]&&o){this._prevType=i;let e=this._stacks.length-1,n=this._stacks[e]||[];for(let i of this._renderableTiles){if(this.pool.isFull()&&(Xi(this.painter,this.terrain,this._rttTiles,r),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(i),i.rtt[e]){let t=this.pool.getObjectForId(i.rtt[e].id);if(t.stamp===i.rtt[e].stamp){this.pool.useObject(t);continue}}let o=this.pool.getOrCreateFreeObject();this.pool.useObject(o),this.pool.stampObject(o),i.rtt[e]={id:o.id,stamp:o.stamp},a.context.bindFramebuffer.set(o.fbo.framebuffer),a.context.clear({color:t.bo.transparent,stencil:0}),a.currentStencilSource=void 0;for(let e of n){let t=a.style._layers[e],n=t.source?this._coordsAscending[t.source][i.tileID.key]:[i.tileID];a.context.viewport.set([0,0,o.fbo.width,o.fbo.height]),a._renderTileClippingMasks(t,n,!0),a.renderLayer(a,a.style.tileManagers[t.source],t,n,r),t.source&&(i.rttFingerprint[t.source]=this._rttFingerprints[t.source][i.tileID.key])}}return Xi(this.painter,this.terrain,this._rttTiles,r),this._rttTiles=[],this.pool.freeAllObjects(),io[i]}return!1}}let oo={"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":`Drag to rotate map, click to reset 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`,"GlobeControl.Enable":`Enable globe`,"GlobeControl.Disable":`Disable globe`,"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`},so=n,co={hash:!1,interactive:!0,bearingSnap:7,zoomSnap:0,attributionControl:Xa,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:`high-performance`,failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 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],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:t.c.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,transformConstrain:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:`sans-serif`,pitchWithRotate:!0,rollEnabled:!1,reduceMotion:void 0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0,experimentalZoomLevelsToOverscale:void 0,anisotropicFilterPitch:20},lo=class extends J{get _ownerWindow(){return this._container?.ownerDocument?.defaultView||window}constructor(e){var n;let r=Object.assign(Object.assign(Object.assign({},co),e),{canvasContextAttributes:Object.assign(Object.assign({},co.canvasContextAttributes),e.canvasContextAttributes)});if(r.minZoom!=null&&r.maxZoom!=null&&r.minZoom>r.maxZoom)throw Error(`maxZoom must be greater than or equal to minZoom`);if(r.minPitch!=null&&r.maxPitch!=null&&r.minPitch>r.maxPitch)throw Error(`maxPitch must be greater than or equal to minPitch`);if(r.minPitch!=null&&r.minPitch<0)throw Error(`minPitch must be greater than or equal to 0`);if(r.maxPitch!=null&&r.maxPitch>180)throw Error(`maxPitch must be less than or equal to 180`);let i=new ln,a=new pn;r.minZoom!==void 0&&i.setMinZoom(r.minZoom),r.maxZoom!==void 0&&i.setMaxZoom(r.maxZoom),r.minPitch!==void 0&&i.setMinPitch(r.minPitch),r.maxPitch!==void 0&&i.setMaxPitch(r.maxPitch),r.renderWorldCopies!==void 0&&i.setRenderWorldCopies(r.renderWorldCopies),r.transformConstrain!==null&&i.setConstrainOverride(r.transformConstrain),super(i,a,{bearingSnap:r.bearingSnap,zoomSnap:r.zoomSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new $a,this._controls=[],this._mapId=t.ad(),this._lostContextStyle={style:null,images:null},this._contextLost=e=>{if(e.preventDefault(),this._frameRequest&&=(this._frameRequest.abort(),null),this.painter.destroy(),this._lostContextStyle=this._getStyleAndImages(),this.style){for(let e of Object.values(this.style._layers))if(e.type===`custom`&&console.warn(`Custom layer with id '${e.id}' cannot be restored after WebGL context loss. You will need to re-add it manually after context restoration.`),e._listeners)for(let[t]of Object.entries(e._listeners))console.warn(`Custom layer with id '${e.id}' had event listeners for event '${t}' which cannot be restored after WebGL context loss. You will need to re-add them manually after context restoration.`);this.style.destroy(),this.style=null,this.fire(new t.n(`webglcontextlost`,{originalEvent:e}))}else this.fire(new t.n(`webglcontextlost`,{originalEvent:e}))},this._contextRestored=e=>{this._lostContextStyle.style&&this.setStyle(this._lostContextStyle.style,{diff:!1}),this._lostContextStyle.images&&this.style&&(this.style.imageManager.images=this._lostContextStyle.images),this._lostContextStyle={style:null,images:null},this._setupPainter(),this.resize(),this._update(),this._resizeInternal(),this.fire(new t.n(`webglcontextrestored`,{originalEvent:e}))},this._onMapScroll=e=>{if(e.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=r.interactive,this._maxTileCacheSize=r.maxTileCacheSize,this._maxTileCacheZoomLevels=r.maxTileCacheZoomLevels,this._canvasContextAttributes=Object.assign({},r.canvasContextAttributes),this._trackResize=!0===r.trackResize,this._bearingSnap=r.bearingSnap,this._zoomSnap=r.zoomSnap,this._centerClampedToGround=r.centerClampedToGround,this._refreshExpiredTiles=!0===r.refreshExpiredTiles,this._fadeDuration=r.fadeDuration,this._crossSourceCollisions=!0===r.crossSourceCollisions,this._collectResourceTiming=!0===r.collectResourceTiming,this._locale=Object.assign(Object.assign({},oo),r.locale),this._clickTolerance=r.clickTolerance,this._overridePixelRatio=r.pixelRatio,this._maxCanvasSize=r.maxCanvasSize,this._zoomLevelsToOverscale=r.experimentalZoomLevelsToOverscale,this.transformCameraUpdate=r.transformCameraUpdate,this.transformConstrain=r.transformConstrain,this.cancelPendingTileRequestsWhileZooming=!0===r.cancelPendingTileRequestsWhileZooming,this.setAnisotropicFilterPitch(r.anisotropicFilterPitch),r.reduceMotion!==void 0&&(s.prefersReducedMotion=r.reduceMotion),this._imageQueueHandle=u.addThrottleControl((()=>this.isMoving())),this._requestManager=new f(r.transformRequest),this._container=this._resolveContainer(r.container),r.maxBounds&&this.setMaxBounds(r.maxBounds),this._setupContainer(),this._setupPainter(),this.on(`move`,(()=>this._update(!1))),this.on(`moveend`,(()=>this._update(!1))),this.on(`zoom`,(()=>this._update(!0))),this.on(`terrain`,(()=>{this.painter.terrainFacilitator.depthDirty=!0,this._update(!0)})),this.once(`idle`,(()=>this._idleTriggered=!0)),typeof window<`u`&&(this._ownerWindow.addEventListener(`online`,this._onWindowOnline,!1),this._setupResizeObserver()),this.handlers=new q(this,r),this._hash=r.hash?new ta(typeof r.hash==`string`&&r.hash||void 0).addTo(this):void 0,(n=this._hash)!=null&&n._onHashChange()||(this.jumpTo({center:r.center,elevation:r.elevation,zoom:r.zoom,bearing:r.bearing,pitch:r.pitch,roll:r.roll}),r.bounds&&(this.resize(),this.fitBounds(r.bounds,t.e({},r.fitBoundsOptions,{duration:0}))));let o=typeof r.style==`string`||r.style?.projection?.type!==`globe`;this.resize(null,o),this._localIdeographFontFamily=r.localIdeographFontFamily,this._validateStyle=r.validateStyle,r.style&&this.setStyle(r.style,{localIdeographFontFamily:r.localIdeographFontFamily}),r.attributionControl&&this.addControl(new Za(typeof r.attributionControl==`boolean`?void 0:r.attributionControl)),r.maplibreLogo&&this.addControl(new Qa,r.logoPosition),this.on(`style.load`,(()=>{if(o||this._resizeTransform(),this.transform.unmodified){let e=t.V(this.style.stylesheet,[`center`,`zoom`,`bearing`,`pitch`,`roll`]);this.jumpTo(e)}})),this.on(`data`,(e=>{this._update(e.dataType===`style`),this.fire(new t.n(`${e.dataType}data`,e))})),this.on(`dataloading`,(e=>{this.fire(new t.n(`${e.dataType}dataloading`,e))})),this.on(`dataabort`,(e=>{this.fire(new t.n(`sourcedataabort`,e))}))}_getMapId(){return this._mapId}setGlobalStateProperty(e,t){return this.style.setGlobalStateProperty(e,t),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(e,n){if(n===void 0&&(n=e.getDefaultPosition?e.getDefaultPosition():`top-right`),!e?.onAdd)return this.fire(new t.l(Error(`Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.`)));let r=e.onAdd(this);this._controls.push(e);let i=this._controlPositions[n];return n.includes(`bottom`)?i.insertBefore(r,i.firstChild):i.appendChild(r),this}removeControl(e){if(!e?.onRemove)return this.fire(new t.l(Error(`Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.`)));let n=this._controls.indexOf(e);return n>-1&&this._controls.splice(n,1),e.onRemove(this),this}hasControl(e){return this._controls.includes(e)}coveringTiles(e){return Ge(this.transform,e)}calculateCameraOptionsFromTo(e,t,n,r){return r==null&&this.terrain&&(r=this.terrain.getElevationForLngLat(n,this.transform)),super.calculateCameraOptionsFromTo(e,t,n,r)}resize(e,n=!0){if(this._lostContextStyle.style!==null)return this;this._resizeInternal(n);let r=!this._moving;return r&&(this.stop(),this.fire(new t.n(`movestart`,e)).fire(new t.n(`move`,e))),this.fire(new t.n(`resize`,e)),r&&this.fire(new t.n(`moveend`,e)),this}_resizeInternal(e=!0){let[t,n]=this._containerDimensions(),r=this._getClampedPixelRatio(t,n);if(this._resizeCanvas(t,n,r),this.painter.resize(t,n,r),this.painter.overLimit()){let e=this.painter.context.gl;this._maxCanvasSize=[e.drawingBufferWidth,e.drawingBufferHeight];let r=this._getClampedPixelRatio(t,n);this._resizeCanvas(t,n,r),this.painter.resize(t,n,r)}this._resizeTransform(e)}_resizeTransform(e=!0){var t;let[n,r]=this._containerDimensions();this.transform.resize(n,r,e),(t=this._requestedCameraState)==null||t.resize(n,r,e)}_getClampedPixelRatio(e,t){let{0:n,1:r}=this._maxCanvasSize,i=this.getPixelRatio(),a=e*i,o=t*i;return Math.min(a>n?n/a:1,o>r?r/o:1)*i}getPixelRatio(){return this._overridePixelRatio??devicePixelRatio}setPixelRatio(e){this._overridePixelRatio=e,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(e){return this.transform.setMaxBounds(le.convert(e)),this._update()}setMinZoom(e){if((e??=-2)>=-2&&e<=this.transform.maxZoom){let n=this.transform.zoom,r=this._getTransformForUpdate();return r.setMinZoom(e),this._applyUpdatedTransform(r),this._update(),n!==this.transform.zoom&&this.fire(new t.n(`zoomstart`)).fire(new t.n(`zoom`)).fire(new t.n(`zoomend`)).fire(new t.n(`movestart`)).fire(new t.n(`move`)).fire(new t.n(`moveend`)),this}throw Error(`minZoom must be between -2 and the current maxZoom, inclusive`)}getMinZoom(){return this.transform.minZoom}setMaxZoom(e){if((e??=22)>=this.transform.minZoom){let n=this.transform.zoom,r=this._getTransformForUpdate();return r.setMaxZoom(e),this._applyUpdatedTransform(r),this._update(),n!==this.transform.zoom&&this.fire(new t.n(`zoomstart`)).fire(new t.n(`zoom`)).fire(new t.n(`zoomend`)).fire(new t.n(`movestart`)).fire(new t.n(`move`)).fire(new t.n(`moveend`)),this}throw Error(`maxZoom must be greater than the current minZoom`)}getMaxZoom(){return this.transform.maxZoom}setMinPitch(e){if((e??=0)<0)throw Error(`minPitch must be greater than or equal to 0`);if(e>=0&&e<=this.transform.maxPitch){let n=this.transform.pitch,r=this._getTransformForUpdate();return r.setMinPitch(e),this._applyUpdatedTransform(r),this._update(),n!==this.transform.pitch&&this.fire(new t.n(`pitchstart`)).fire(new t.n(`pitch`)).fire(new t.n(`pitchend`)).fire(new t.n(`movestart`)).fire(new t.n(`move`)).fire(new t.n(`moveend`)),this}throw Error(`minPitch must be between 0 and the current maxPitch, inclusive`)}getMinPitch(){return this.transform.minPitch}setMaxPitch(e){if((e??=60)>180)throw Error(`maxPitch must be less than or equal to 180`);if(e>=this.transform.minPitch){let n=this.transform.pitch,r=this._getTransformForUpdate();return r.setMaxPitch(e),this._applyUpdatedTransform(r),this._update(),n!==this.transform.pitch&&this.fire(new t.n(`pitchstart`)).fire(new t.n(`pitch`)).fire(new t.n(`pitchend`)).fire(new t.n(`movestart`)).fire(new t.n(`move`)).fire(new t.n(`moveend`)),this}throw Error(`maxPitch must be greater than the current minPitch`)}getMaxPitch(){return this.transform.maxPitch}getAnisotropicFilterPitch(){return this._anisotropicFilterPitch}setAnisotropicFilterPitch(e){if((e??=20)>180)throw Error(`anisotropicFilterPitch must be less than or equal to 180`);if(e<0)throw Error(`anisotropicFilterPitch must be greater than or equal to 0`);return this._anisotropicFilterPitch=e,this._update()}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(e){return this.transform.setRenderWorldCopies(e),this._update()}setTransformConstrain(e){return this.transform.setConstrainOverride(e),this._update()}project(e){return this.transform.locationToScreenPoint(t.W.convert(e),this.style&&this.terrain)}unproject(e){return this.transform.screenPointToLocation(t.P.convert(e),this.terrain)}isMoving(){return this._moving||this.handlers?.isMoving()}isZooming(){return this._zooming||this.handlers?.isZooming()}isRotating(){return this._rotating||this.handlers?.isRotating()}_createDelegatedListener(e,t,n){if(e===`mouseenter`||e===`mouseover`){let r=!1;return{layers:t,listener:n,delegates:{mousemove:i=>{let a=t.filter((e=>this.getLayer(e))),o=a.length===0?[]:this.queryRenderedFeatures(i.point,{layers:a});o.length?r||(r=!0,n.call(this,new da(e,this,i.originalEvent,{features:o}))):r=!1},mouseout:()=>{r=!1}}}}if(e===`mouseleave`||e===`mouseout`){let r=!1;return{layers:t,listener:n,delegates:{mousemove:i=>{let a=t.filter((e=>this.getLayer(e)));(a.length===0?[]:this.queryRenderedFeatures(i.point,{layers:a})).length?r=!0:r&&(r=!1,n.call(this,new da(e,this,i.originalEvent)))},mouseout:t=>{r&&(r=!1,n.call(this,new da(e,this,t.originalEvent)))}}}}{let r=e=>{let r=t.filter((e=>this.getLayer(e))),i=r.length===0?[]:this.queryRenderedFeatures(e.point,{layers:r});i.length&&(e.features=i,n.call(this,e),delete e.features)};return{layers:t,listener:n,delegates:{[e]:r}}}}_saveDelegatedListener(e,t){var n;this._delegatedListeners||={},(n=this._delegatedListeners)[e]||(n[e]=[]),this._delegatedListeners[e].push(t)}_removeDelegatedListener(e,t,n){if(!this._delegatedListeners?.[e])return;let r=this._delegatedListeners[e];for(let e=0;e<r.length;e++){let i=r[e];if(i.listener===n&&i.layers.length===t.length&&i.layers.every((e=>t.includes(e)))){for(let e in i.delegates)this.off(e,i.delegates[e]);r.splice(e,1);return}}}on(e,t,n){if(n===void 0)return super.on(e,t);let r=typeof t==`string`?[t]:t,i=this._createDelegatedListener(e,r,n);this._saveDelegatedListener(e,i);for(let e in i.delegates)this.on(e,i.delegates[e]);return{unsubscribe:()=>{this._removeDelegatedListener(e,r,n)}}}once(e,t,n){if(n===void 0)return super.once(e,t);let r=typeof t==`string`?[t]:t,i=this._createDelegatedListener(e,r,n);for(let t in i.delegates){let a=i.delegates[t];i.delegates[t]=(...t)=>{this._removeDelegatedListener(e,r,n),a(...t)}}this._saveDelegatedListener(e,i);for(let e in i.delegates)this.once(e,i.delegates[e]);return this}off(e,t,n){return n===void 0?super.off(e,t):(this._removeDelegatedListener(e,typeof t==`string`?[t]:t,n),this)}queryRenderedFeatures(e,n){if(!this.style)return[];let r,i=e instanceof t.P||Array.isArray(e),a=i?e:[[0,0],[this.transform.width,this.transform.height]];if(n||=(i?{}:e)||{},a instanceof t.P||typeof a[0]==`number`)r=[t.P.convert(a)];else{let e=t.P.convert(a[0]),n=t.P.convert(a[1]);r=[e,new t.P(n.x,e.y),n,new t.P(e.x,n.y),e]}return this.style.queryRenderedFeatures(r,n,this.transform)}querySourceFeatures(e,t){return this.style.querySourceFeatures(e,t)}setStyle(e,n){return!1!==(n=t.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},n)).diff&&n.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&e?(this._diffStyle(e,n),this):(this._localIdeographFontFamily=n.localIdeographFontFamily,this._updateStyle(e,n))}setTransformRequest(e){return this._requestManager.setTransformRequest(e),this}_getUIString(e){let t=this._locale[e];if(t==null)throw Error(`Missing UI string '${e}'`);return t}_updateStyle(e,t){var n,r;if((n=this._diffStyleRequest)==null||n.abort(),this._diffStyleRequest=null,t.transformStyle&&this.style&&!this.style._loaded)return void this.style.once(`style.load`,(()=>this._updateStyle(e,t)));let i=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!e)),e?(this.style=new Xn(this,t||{}),this.style.setEventedParent(this,{style:this.style}),typeof e==`string`?this.style.loadURL(e,t,i):this.style.loadJSON(e,t,i),this):(this._frameRequest&&=(this._frameRequest.abort(),null),(r=this.style?.projection)==null||r.destroy(),delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Xn(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(e,n){return t._(this,void 0,void 0,(function*(){var r;if((r=this._diffStyleRequest)==null||r.abort(),typeof e==`string`){let r=e;this._diffStyleRequest=new AbortController;let i=this._diffStyleRequest;try{let e=yield this._requestManager.transformRequest(r,`Style`);if(i.signal.aborted)return void(this._diffStyleRequest=null);let a=yield t.k(e,i);this._diffStyleRequest=null,this._updateDiff(a.data,n)}catch(e){this._diffStyleRequest=null,t.$(e)||this.fire(new t.l(t.d(e)))}}else typeof e==`object`&&(this._diffStyleRequest=null,this._updateDiff(e,n))}))}_updateDiff(e,n){try{this.style.setState(e,n)&&this._update(!0)}catch(r){t.w(`Unable to perform style diff: ${t.d(r).message}.  Rebuilding the style from scratch.`),this._updateStyle(e,n)}}getStyle(){if(this.style)return this.style.serialize()}_getStyleAndImages(){return this.style?{style:this.style.serialize(),images:this.style.imageManager.cloneImages()}:{style:null,images:{}}}isStyleLoaded(){if(this.style)return this.style.loaded();t.w(`There is no style added to the map.`)}addSource(e,t){return this._lazyInitEmptyStyle(),this.style.addSource(e,t),this._update(!0)}isSourceLoaded(e){let n=this.style?.tileManagers[e];if(n!==void 0)return n.loaded();this.fire(new t.l(Error(`There is no tile manager with ID '${e}'`)))}setTerrain(e){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off(`data`,this._terrainDataCallback),e){let n=this.style.tileManagers[e.source];if(!n)throw Error(`cannot load terrain, because there exists no source with ID: ${e.source}`);this.terrain===null&&n.reload();for(let n in this.style._layers){let r=this.style._layers[n];r.type===`hillshade`&&r.source===e.source&&t.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.`),r.type===`color-relief`&&r.source===e.source&&t.w(`You are using the same source for a color-relief layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.`)}this.terrain=new no(this.painter,n,e),this.painter.renderToTexture=new ao(this.painter,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._terrainDataCallback=t=>{t.dataType===`style`?this.terrain.tileManager.freeRtt():t.dataType===`source`&&t.tile&&(t.sourceId!==e.source||this._elevationFreeze||(this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))),t.source?.type===`image`?this.terrain.tileManager.freeRtt():this.terrain.tileManager.freeRtt(t.tile.tileID))},this.style.on(`data`,this._terrainDataCallback)}else this.terrain&&this.terrain.destroy(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0);return this.fire(new t.n(`terrain`,{terrain:e})),this}getTerrain(){return this.terrain?.options??null}areTilesLoaded(){let e=this.style?.tileManagers;for(let t of Object.values(e))if(!t.areTilesLoaded())return!1;return!0}removeSource(e){return this.style.removeSource(e),this._update(!0)}getSource(e){return this.style.getSource(e)}setSourceTileLodParams(e,t,n){if(n){let r=this.getSource(n);if(!r)throw Error(`There is no source with ID "${n}", cannot set LOD parameters`);r.calculateTileZoom=He(Math.max(1,e),Math.max(1,t))}else for(let n in this.style.tileManagers)this.style.tileManagers[n].getSource().calculateTileZoom=He(Math.max(1,e),Math.max(1,t));return this._update(!0),this}refreshTiles(e,n){let r=this.style.tileManagers[e];if(!r)throw Error(`There is no tile manager with ID "${e}", cannot refresh tile`);n===void 0?r.reload(!0):r.refreshTiles(n.map((e=>new t.aa(e.z,e.x,e.y))))}addImage(e,n,r={}){let{pixelRatio:i=1,sdf:a=!1,stretchX:o,stretchY:c,content:l,textFitWidth:u,textFitHeight:d}=r;if(this._lazyInitEmptyStyle(),!(n instanceof HTMLImageElement||t.b(n))){if(n.width===void 0||n.height===void 0)return this.fire(new t.l(Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{let{width:r,height:s,data:f}=n,p=n;return this.style.addImage(e,{data:new t.R({width:r,height:s},new Uint8Array(f)),pixelRatio:i,stretchX:o,stretchY:c,content:l,textFitWidth:u,textFitHeight:d,sdf:a,version:0,userImage:p}),p.onAdd&&p.onAdd(this,e),this}}{let{width:r,height:f,data:p}=s.getImageData(n);this.style.addImage(e,{data:new t.R({width:r,height:f},p),pixelRatio:i,stretchX:o,stretchY:c,content:l,textFitWidth:u,textFitHeight:d,sdf:a,version:0})}}updateImage(e,n){let r=this.style.getImage(e);if(!r)return this.fire(new t.l(Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let{width:i,height:a,data:o}=n instanceof HTMLImageElement||t.b(n)?s.getImageData(n):n;if(i===void 0||a===void 0)return this.fire(new t.l(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(i!==r.data.width||a!==r.data.height)return this.fire(new t.l(Error(`The width and height of the updated image must be that same as the previous version of the image`)));let c=!(n instanceof HTMLImageElement||t.b(n));return r.data.replace(o,c),this.style.updateImage(e,r),this}getImage(e){return this.style.getImage(e)}hasImage(e){return e?!!this.style.getImage(e):(this.fire(new t.l(Error(`Missing required image id`))),!1)}removeImage(e){this.style.removeImage(e)}loadImage(e){return t._(this,void 0,void 0,(function*(){return u.getImage(yield this._requestManager.transformRequest(e,`Image`),new AbortController)}))}listImages(){return this.style.listImages()}addLayer(e,t){return this._lazyInitEmptyStyle(),this.style.addLayer(e,t),this._update(!0)}moveLayer(e,t){return this.style.moveLayer(e,t),this._update(!0)}removeLayer(e){return this.style.removeLayer(e),this._update(!0)}getLayer(e){return this.style.getLayer(e)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(e,t,n){return this.style.setLayerZoomRange(e,t,n),this._update(!0)}setFilter(e,t,n={}){return this.style.setFilter(e,t,n),this._update(!0)}getFilter(e){return this.style.getFilter(e)}setPaintProperty(e,t,n,r={}){return this.style.setPaintProperty(e,t,n,r),this._update(!0)}getPaintProperty(e,t){return this.style.getPaintProperty(e,t)}setLayoutProperty(e,t,n,r={}){return this.style.setLayoutProperty(e,t,n,r),this._update(!0)}getLayoutProperty(e,t){return this.style.getLayoutProperty(e,t)}setGlyphs(e,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(e,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(e,t,n={}){return this._lazyInitEmptyStyle(),this.style.addSprite(e,t,n,(e=>{e||this._update(!0)})),this}removeSprite(e){return this._lazyInitEmptyStyle(),this.style.removeSprite(e),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(e,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(e,t,(e=>{e||this._update(!0)})),this}setLight(e,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(e,t),this._update(!0)}getLight(){return this.style.getLight()}setSky(e,t={}){return this._lazyInitEmptyStyle(),this.style.setSky(e,t),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(e,t){return this.style.setFeatureState(e,t),this._update()}removeFeatureState(e,t){return this.style.removeFeatureState(e,t),this._update()}getFeatureState(e){return this.style.getFeatureState(e)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let e=0,t=0;return this._container&&(e=this._container.clientWidth||400,t=this._container.clientHeight||300),[e,t]}_setupResizeObserver(){let e=!1,t=ea((e=>{this._trackResize&&!this._removed&&(this.resize(e),this.redraw())}),50),n=this._ownerWindow.ResizeObserver??ResizeObserver;this._resizeObserver=new n((n=>{e?t(n):e=!0})),this._resizeObserver.observe(this._container)}_resolveContainer(e){if(typeof e==`string`){let t=document.getElementById(e);if(!t)throw Error(`Container '${e}' not found.`);return t}if(e instanceof HTMLElement||e&&typeof e==`object`&&e.nodeType===1)return e;throw Error(`Invalid type: 'container' must be a String or HTMLElement.`)}_setupContainer(){let e=this._container;e.classList.add(`maplibregl-map`);let t=this._canvasContainer=d.create(`div`,`maplibregl-canvas-container`,e);this._interactive&&t.classList.add(`maplibregl-interactive`),this._canvas=d.create(`canvas`,`maplibregl-canvas`,t),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`,`region`);let n=this._containerDimensions(),r=this._getClampedPixelRatio(n[0],n[1]);this._resizeCanvas(n[0],n[1],r);let i=this._controlContainer=d.create(`div`,`maplibregl-control-container`,e),a=this._controlPositions={};for(let e of[`top-left`,`top-right`,`bottom-left`,`bottom-right`])a[e]=d.create(`div`,`maplibregl-ctrl-${e} `,i);this._container.addEventListener(`scroll`,this._onMapScroll,!1)}_resizeCanvas(e,t,n){this._canvas.width=Math.floor(n*e),this._canvas.height=Math.floor(n*t),this._canvas.style.width=`${e}px`,this._canvas.style.height=`${t}px`}_setupPainter(){let e=Object.assign(Object.assign({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0}),t=null;this._canvas.addEventListener(`webglcontextcreationerror`,(n=>{t={requestedAttributes:e},n&&(t.statusMessage=n.statusMessage,t.type=n.type)}),{once:!0});let n=null;if(n=this._canvasContextAttributes.contextType?this._canvas.getContext(this._canvasContextAttributes.contextType,e):this._canvas.getContext(`webgl2`,e)||this._canvas.getContext(`webgl`,e),!n){let e=`Failed to initialize WebGL`;throw t?(t.message=e,Error(JSON.stringify(t))):Error(e)}this.painter=new $i(n,this.transform)}migrateProjection(e,n){super.migrateProjection(e,n),this.painter.transform=e,this.fire(new t.n(`projectiontransition`,{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(e){return this.style?._loaded?(this._styleDirty||=e,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(e){return this._update(),this._renderTaskQueue.add(e)}_cancelRenderFrame(e){this._renderTaskQueue.remove(e)}_render(e){var n;let r=this._idleTriggered?this._fadeDuration:0,i=this.style.projection?.transitionState>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(e),this._removed)return;let a=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let e=this.transform.zoom,n=l();this.style.zoomHistory.update(e,n);let i=new t.J(e,{now:n,fadeDuration:r,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),o=i.crossFadingFactor();o===1&&o===this._crossFadingFactor||(a=!0,this._crossFadingFactor=o),this.style.update(i)}let o=this.style.projection?.transitionState>0!==i;(n=this.style.projection)==null||n.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState(this.style.projection?.transitionState,this.style.projection?.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||o)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.tileManager.update(this.transform,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),!this._elevationFreeze&&this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0)),this._placementDirty=this.style?._updatePlacement(this.transform,this.showCollisionBoxes,r,this._crossSourceCollisions,o),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,anisotropicFilterPitch:this.getAnisotropicFilterPitch()}),this.fire(new t.n(`render`)),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new t.n(`load`))),this.style&&(this.style.hasTransitions()||a)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let s=this._sourcesDirty||this._styleDirty||this._placementDirty;return s||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new t.n(`idle`)),!this._loaded||this._fullyLoaded||s||(this._fullyLoaded=!0),this}redraw(){return this.style&&(this._frameRequest&&=(this._frameRequest.abort(),null),this._render(0)),this}remove(){var e,n;this._hash&&this._hash.remove();for(let e of this._controls)e.onRemove(this);this._controls=[],this._frameRequest&&=(this._frameRequest.abort(),null),this._renderTaskQueue.clear(),(e=this._diffStyleRequest)==null||e.abort(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<`u`&&this._ownerWindow.removeEventListener(`online`,this._onWindowOnline,!1),u.removeThrottleControl(this._imageQueueHandle),(n=this._resizeObserver)==null||n.disconnect();let 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),this._canvasContainer.remove(),this._controlContainer.remove(),this._container.removeEventListener(`scroll`,this._onMapScroll,!1),this._container.classList.remove(`maplibregl-map`),this._removed=!0,this.fire(new t.n(`remove`))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,s.frame(this._frameRequest,(e=>{this._frameRequest=null;try{this._render(e)}catch(e){if(!t.$(e)&&!function(e){return e.message===gi}(e))throw e}}),(()=>{}),this._ownerWindow))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(e){this._showTileBoundaries!==e&&(this._showTileBoundaries=e,this._update())}get showPadding(){return!!this._showPadding}set showPadding(e){this._showPadding!==e&&(this._showPadding=e,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(e){this._showCollisionBoxes!==e&&(this._showCollisionBoxes=e,e?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(e){this._showOverdrawInspector!==e&&(this._showOverdrawInspector=e,this._update())}get repaint(){return!!this._repaint}set repaint(e){this._repaint!==e&&(this._repaint=e,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(e){this._vertices=e,this._update()}get version(){return so}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(e){return this._lazyInitEmptyStyle(),this.style.setProjection(e),this._update(!0)}},uo={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class fo{constructor(e,n,r=!1){this.mousedown=e=>{this.startMove(e,d.mousePos(this.element,e)),window.addEventListener(`mousemove`,this.mousemove),window.addEventListener(`mouseup`,this.mouseup)},this.mousemove=e=>{this.move(e,d.mousePos(this.element,e))},this.mouseup=e=>{this._rotatePitchHandler.dragEnd(e),this.offTemp()},this.touchstart=e=>{e.targetTouches.length===1?(this._startPos=this._lastPos=d.touchPos(this.element,e.targetTouches)[0],this.startMove(e,this._startPos),window.addEventListener(`touchmove`,this.touchmove,{passive:!1}),window.addEventListener(`touchend`,this.touchend)):this.reset()},this.touchmove=e=>{e.targetTouches.length===1?(this._lastPos=d.touchPos(this.element,e.targetTouches)[0],this.move(e,this._lastPos)):this.reset()},this.touchend=e=>{e.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._rotatePitchHandler.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=n;let i=new wa;this._rotatePitchHandler=new ba({clickTolerance:3,move:(e,i)=>{let a=n.getBoundingClientRect(),o=new t.P((a.bottom-a.top)/2,(a.right-a.left)/2);return{bearingDelta:t.cx(new t.P(e.x,i.y),i,o),pitchDelta:r?-.5*(i.y-e.y):void 0}},moveStateManager:i,enable:!0,assignEvents:()=>{}}),this.map=e,n.addEventListener(`mousedown`,this.mousedown),n.addEventListener(`touchstart`,this.touchstart,{passive:!1}),n.addEventListener(`touchcancel`,this.reset)}startMove(e,t){this._rotatePitchHandler.dragStart(e,t),d.disableDrag()}move(e,t){let n=this.map,{bearingDelta:r,pitchDelta:i}=this._rotatePitchHandler.dragMove(e,t)||{};r&&n.setBearing(n.getBearing()+r),i&&n.setPitch(n.getPitch()+i)}off(){let e=this.element;e.removeEventListener(`mousedown`,this.mousedown),e.removeEventListener(`touchstart`,this.touchstart),window.removeEventListener(`touchmove`,this.touchmove),window.removeEventListener(`touchend`,this.touchend),e.removeEventListener(`touchcancel`,this.reset),this.offTemp()}offTemp(){d.enableDrag(),window.removeEventListener(`mousemove`,this.mousemove),window.removeEventListener(`mouseup`,this.mouseup),window.removeEventListener(`touchmove`,this.touchmove),window.removeEventListener(`touchend`,this.touchend)}}let po;function mo(e,n,r,i=!1){if(i||!r.getCoveringTilesDetailsProvider().allowWorldCopies())return e?.wrap();let a=new t.W(e.lng,e.lat);if(e=new t.W(e.lng,e.lat),n){let i=new t.W(e.lng-360,e.lat),a=new t.W(e.lng+360,e.lat),o=r.locationToScreenPoint(e).distSqr(n);r.locationToScreenPoint(i).distSqr(n)<o?e=i:r.locationToScreenPoint(a).distSqr(n)<o&&(e=a)}for(;Math.abs(e.lng-r.center.lng)>180;){let t=r.locationToScreenPoint(e);if(t.x>=0&&t.y>=0&&t.x<=r.width&&t.y<=r.height)break;e.lng>r.center.lng?e.lng-=360:e.lng+=360}return e.lng!==a.lng&&r.isPointOnMapSurface(r.locationToScreenPoint(e))?e:a}let ho={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 go(e,t,n){let r=e.classList;for(let e in ho)r.remove(`maplibregl-${n}-anchor-${e}`);r.add(`maplibregl-${n}-anchor-${t}`)}class _o extends t.E{constructor(e){if(super(),this._onClick=e=>{this.fire(new t.n(`click`,{originalEvent:e}))},this._onKeyPress=e=>{e.code!==`Space`&&e.code!==`Enter`||this.togglePopup()},this._onMapClick=e=>{let t=e.originalEvent.target,n=this._element;this._popup&&(t===n||n.contains(t))&&this.togglePopup()},this._update=e=>{if(!this._map)return;let t=this._map.loaded()&&!this._map.isMoving();(e?.type===`terrain`||e?.type===`render`&&!t)&&this._map.once(`render`,this._update),this._lngLat=mo(this._lngLat,this._flatPos,this._map.transform),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let n=``;this._rotationAlignment===`viewport`||this._rotationAlignment===`auto`?n=`rotateZ(${this._rotation}deg)`:this._rotationAlignment===`map`&&(n=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let r=``;this._pitchAlignment===`viewport`||this._pitchAlignment===`auto`?r=`rotateX(0deg)`:this._pitchAlignment===`map`&&(r=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||e&&e.type!==`moveend`||(this._pos=this._pos.round()),this._element.style.transform=`${ho[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${r} ${n}`,s.frameAsync(new AbortController,this._map._ownerWindow).then((()=>{this._updateOpacity(e?.type===`moveend`)})).catch((()=>{}))},this._onMove=e=>{if(!this._isDragging){let t=this._clickTolerance||this._map._clickTolerance;this._isDragging=e.point.dist(this._pointerdownPos)>=t}this._isDragging&&(this._pos=e.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents=`none`,this._state===`pending`&&(this._state=`active`,this.fire(new t.n(`dragstart`))),this.fire(new t.n(`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 t.n(`dragend`)),this._state=`inactive`},this._addDragHandler=e=>{this._element.contains(e.originalEvent.target)&&(e.preventDefault(),this._positionDelta=e.point.sub(this._pos).add(this._offset),this._pointerdownPos=e.point,this._state=`pending`,this._map.on(`mousemove`,this._onMove),this._map.on(`touchmove`,this._onMove),this._map.once(`mouseup`,this._onUp),this._map.once(`touchend`,this._onUp))},this._anchor=e?.anchor||`center`,this._color=e?.color||`#3FB1CE`,this._scale=e?.scale||1,this._draggable=e?.draggable||!1,this._clickTolerance=e?.clickTolerance||0,this._subpixelPositioning=e?.subpixelPositioning||!1,this._isDragging=!1,this._state=`inactive`,this._rotation=e?.rotation||0,this._rotationAlignment=e?.rotationAlignment||`auto`,this._pitchAlignment=e?.pitchAlignment&&e.pitchAlignment!==`auto`?e.pitchAlignment:this._rotationAlignment,this.setOpacity(e?.opacity,e?.opacityWhenCovered),e?.element)this._element=e.element,this._offset=t.P.convert(e?.offset||[0,0]);else{this._defaultMarker=!0,this._element=d.create(`div`);let n=d.createNS(`http://www.w3.org/2000/svg`,`svg`);n.setAttributeNS(null,`display`,`block`),n.setAttributeNS(null,`height`,`41px`),n.setAttributeNS(null,`width`,`27px`),n.setAttributeNS(null,`viewBox`,`0 0 27 41`);let r=d.createNS(`http://www.w3.org/2000/svg`,`g`);r.setAttributeNS(null,`stroke`,`none`),r.setAttributeNS(null,`stroke-width`,`1`),r.setAttributeNS(null,`fill`,`none`),r.setAttributeNS(null,`fill-rule`,`evenodd`);let i=d.createNS(`http://www.w3.org/2000/svg`,`g`);i.setAttributeNS(null,`fill-rule`,`nonzero`);let a=d.createNS(`http://www.w3.org/2000/svg`,`g`);a.setAttributeNS(null,`transform`,`translate(3.0, 29.0)`),a.setAttributeNS(null,`fill`,`#000000`);for(let e of[{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`}]){let t=d.createNS(`http://www.w3.org/2000/svg`,`ellipse`);t.setAttributeNS(null,`opacity`,`0.04`),t.setAttributeNS(null,`cx`,`10.5`),t.setAttributeNS(null,`cy`,`5.80029008`),t.setAttributeNS(null,`rx`,e.rx),t.setAttributeNS(null,`ry`,e.ry),a.appendChild(t)}let o=d.createNS(`http://www.w3.org/2000/svg`,`g`);o.setAttributeNS(null,`fill`,this._color);let s=d.createNS(`http://www.w3.org/2000/svg`,`path`);s.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`),o.appendChild(s);let c=d.createNS(`http://www.w3.org/2000/svg`,`g`);c.setAttributeNS(null,`opacity`,`0.25`),c.setAttributeNS(null,`fill`,`#000000`);let l=d.createNS(`http://www.w3.org/2000/svg`,`path`);l.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`),c.appendChild(l);let u=d.createNS(`http://www.w3.org/2000/svg`,`g`);u.setAttributeNS(null,`transform`,`translate(6.0, 7.0)`),u.setAttributeNS(null,`fill`,`#FFFFFF`);let f=d.createNS(`http://www.w3.org/2000/svg`,`g`);f.setAttributeNS(null,`transform`,`translate(8.0, 8.0)`);let p=d.createNS(`http://www.w3.org/2000/svg`,`circle`);p.setAttributeNS(null,`fill`,`#000000`),p.setAttributeNS(null,`opacity`,`0.25`),p.setAttributeNS(null,`cx`,`5.5`),p.setAttributeNS(null,`cy`,`5.5`),p.setAttributeNS(null,`r`,`5.4999962`);let m=d.createNS(`http://www.w3.org/2000/svg`,`circle`);m.setAttributeNS(null,`fill`,`#FFFFFF`),m.setAttributeNS(null,`cx`,`5.5`),m.setAttributeNS(null,`cy`,`5.5`),m.setAttributeNS(null,`r`,`5.4999962`),f.appendChild(p),f.appendChild(m),i.appendChild(a),i.appendChild(o),i.appendChild(c),i.appendChild(u),i.appendChild(f),n.appendChild(i),n.setAttributeNS(null,`height`,41*this._scale+`px`),n.setAttributeNS(null,`width`,27*this._scale+`px`),this._element.appendChild(n),this._offset=t.P.convert(e?.offset||[0,-14])}if(this._element.classList.add(`maplibregl-marker`),this._element.addEventListener(`dragstart`,(e=>{e.preventDefault()})),this._element.addEventListener(`mousedown`,(e=>{e.preventDefault()})),go(this._element,this._anchor,`marker`),e?.className)for(let t of e.className.split(` `))this._element.classList.add(t);this._popup=null}addTo(e){return this.remove(),this._map=e,this._element.hasAttribute(`aria-label`)||this._element.setAttribute(`aria-label`,e._getUIString(`Marker.Title`)),this._element.hasAttribute(`role`)||this._element.setAttribute(`role`,`button`),e.getCanvasContainer().appendChild(this._element),e.on(`move`,this._update),e.on(`moveend`,this._update),e.on(`terrain`,this._update),e.on(`projectiontransition`,this._update),this._element.addEventListener(`click`,this._onClick),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(`projectiontransition`,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),this._element.removeEventListener(`click`,this._onClick),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=t.W.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener(`ke
756ypress`,this._onKeyPress),this._originalTabIndex||this._element.removeAttribute(`tabindex`)),e){if(!(`offset`in e.options)){let t=38.1,n=13.5,r=13.5/Math.SQRT2;e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[r,-1*(t-n+r)],"bottom-right":[-r,-1*(t-n+r)],left:[n,-1*(t-n)],right:[-13.5,-1*(t-n)]}:this._offset}this._popup=e,this._originalTabIndex=this._element.getAttribute(`tabindex`),this._originalTabIndex||this._element.setAttribute(`tabindex`,`0`),this._element.addEventListener(`keypress`,this._onKeyPress)}return this}setSubpixelPositioning(e){return this._subpixelPositioning=e,this}getPopup(){return this._popup}togglePopup(){let e=this._popup;return this._element.style.opacity===this._opacityWhenCovered||e&&(e.isOpen()?e.remove():(e.setLngLat(this._lngLat),e.addTo(this._map))),this}_updateOpacity(e=!1){var n;let r=this._map?.terrain,i=this._map.transform.isLocationOccluded(this._lngLat);if(!r||i){let e=i?this._opacityWhenCovered:this._opacity;this._element.style.opacity!==e&&(this._element.style.opacity=e,this._element.classList.toggle(`maplibregl-marker-covered`,i));return}if(e)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout((()=>{this._opacityTimeout=null}),100)}let a=this._map,o=a.terrain.depthAtPoint(this._pos),s=a.terrain.getElevationForLngLat(this._lngLat,a.transform);if(a.transform.lngLatToCameraDepth(this._lngLat,s)-o<.006)return this._element.style.opacity=this._opacity,void this._element.classList.remove(`maplibregl-marker-covered`);let c=-this._offset.y/a.transform.pixelsPerMeter,l=Math.sin(a.getPitch()*Math.PI/180)*c,u=a.terrain.depthAtPoint(new t.P(this._pos.x,this._pos.y-this._offset.y)),d=a.transform.lngLatToCameraDepth(this._lngLat,s+l)-u>.006;(n=this._popup)!=null&&n.isOpen()&&d&&this._popup.remove(),this._element.style.opacity=d?this._opacityWhenCovered:this._opacity,this._element.classList.toggle(`maplibregl-marker-covered`,d)}getOffset(){return this._offset}setOffset(e){return this._offset=t.P.convert(e),this._update(),this}addClassName(e){this._element.classList.add(e)}removeClassName(e){this._element.classList.remove(e)}toggleClassName(e){return this._element.classList.toggle(e)}setDraggable(e){return this._draggable=!!e,this._map&&(e?(this._map.on(`mousedown`,this._addDragHandler),this._map.on(`touchstart`,this._addDragHandler)):(this._map.off(`mousedown`,this._addDragHandler),this._map.off(`touchstart`,this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||`auto`,this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&e!==`auto`?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(e,t){return(this._opacity===void 0||e===void 0&&t===void 0)&&(this._opacity=`1`,this._opacityWhenCovered=`0.2`),e!==void 0&&(this._opacity=String(e)),t!==void 0&&(this._opacityWhenCovered=String(t)),this._map&&this._updateOpacity(!0),this}}let vo={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},yo=0,bo=!1,xo={maxWidth:100,unit:`metric`};function So(e,t,n){let r=n?.maxWidth||100,i=e._container.clientHeight/2,a=e._container.clientWidth/2,o=e.unproject([a-r/2,i]),s=e.unproject([a+r/2,i]),c=Math.round(e.project(s).x-e.project(o).x),l=Math.min(r,c,e._container.clientWidth),u=o.distanceTo(s);if(n?.unit===`imperial`){let n=3.2808*u;n>5280?Co(t,l,n/5280,e._getUIString(`ScaleControl.Miles`)):Co(t,l,n,e._getUIString(`ScaleControl.Feet`))}else n?.unit===`nautical`?Co(t,l,u/1852,e._getUIString(`ScaleControl.NauticalMiles`)):u>=1e3?Co(t,l,u/1e3,e._getUIString(`ScaleControl.Kilometers`)):Co(t,l,u,e._getUIString(`ScaleControl.Meters`))}function Co(e,t,n,r){let i=function(e){let t=10**(`${Math.floor(e)}`.length-1),n=e/t;return n=n>=10?10:n>=5?5:n>=3?3:n>=2?2:n>=1?1:function(e){let t=10**Math.ceil(-Math.log(e)/Math.LN10);return Math.round(e*t)/t}(n),t*n}(n);e.style.width=i/n*t+`px`,e.innerHTML=`${i}&nbsp;${r}`}let wo={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:``,maxWidth:`240px`,subpixelPositioning:!1,locationOccludedOpacity:void 0,padding:void 0}
vendor: 10,988 bytes, line 756
756,To=[`a[href]`,`[tabindex]:not([tabindex='-1'])`,`[contenteditable]:not([contenteditable='false'])`,`button:not([disabled])`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`].join(`, `);function Eo(e){if(e){if(typeof e==`number`){let n=Math.round(Math.abs(e)/Math.SQRT2);return{center:new t.P(0,0),top:new t.P(0,e),"top-left":new t.P(n,n),"top-right":new t.P(-n,n),bottom:new t.P(0,-e),"bottom-left":new t.P(n,-n),"bottom-right":new t.P(-n,-n),left:new t.P(e,0),right:new t.P(-e,0)}}if(e instanceof t.P||Array.isArray(e)){let n=t.P.convert(e);return{center:n,top:n,"top-left":n,"top-right":n,bottom:n,"bottom-left":n,"bottom-right":n,left:n,right:n}}return{center:t.P.convert(e.center||[0,0]),top:t.P.convert(e.top||[0,0]),"top-left":t.P.convert(e[`top-left`]||[0,0]),"top-right":t.P.convert(e[`top-right`]||[0,0]),bottom:t.P.convert(e.bottom||[0,0]),"bottom-left":t.P.convert(e[`bottom-left`]||[0,0]),"bottom-right":t.P.convert(e[`bottom-right`]||[0,0]),left:t.P.convert(e.left||[0,0]),right:t.P.convert(e.right||[0,0])}}return Eo(new t.P(0,0))}let Do=n;e.AJAXError=t.cG,e.EXTENT=t.a6,e.Event=t.n,e.Evented=t.E,e.LngLat=t.W,e.MercatorCoordinate=t.a7,e.Point=t.P,e.addProtocol=t.cH,e.config=t.c,e.removeProtocol=t.cI,e.AttributionControl=Za,e.BoxZoomHandler=ga,e.CanvasSource=Ce,e.CooperativeGesturesHandler=Ka,e.DoubleClickZoomHandler=Ba,e.DragPanHandler=Ua,e.DragRotateHandler=Wa,e.EdgeInsets=tn,e.FullscreenControl=class extends t.E{constructor(e={}){var n;super(),this._onFullscreenChange=()=>{let e=window.document.fullscreenElement||window.document.webkitFullscreenElement;for(;e?.shadowRoot?.fullscreenElement;)e=e.shadowRoot.fullscreenElement;e===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,this._pseudo=(n=e.pseudo)!=null&&n,e!=null&&e.container&&(e.container instanceof HTMLElement?this._container=e.container:t.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(e){return this._map=e,this._container||=this._map.getContainer(),this._controlContainer=d.create(`div`,`maplibregl-ctrl maplibregl-ctrl-group`),this._setupUI(),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){let e=this._fullscreenButton=d.create(`button`,`maplibregl-ctrl-fullscreen`,this._controlContainer);d.create(`span`,`maplibregl-ctrl-icon`,e).setAttribute(`aria-hidden`,`true`),e.type=`button`,this._updateTitle(),this._fullscreenButton.addEventListener(`click`,this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){let e=this._getTitle();this._fullscreenButton.setAttribute(`aria-label`,e),this._fullscreenButton.title=e}_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 t.n(`fullscreenstart`)),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new t.n(`fullscreenend`)),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){this._pseudo?this._togglePseudoFullScreen():window.document.exitFullscreen?window.document.exitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._pseudo?this._togglePseudoFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle(`maplibregl-pseudo-fullscreen`),this._handleFullscreenChange(),this._map.resize()}},e.GeoJSONSource=be,e.GeolocateControl=class extends t.E{constructor(e){super(),this._onSuccess=e=>{if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new t.n(`outofmaxbounds`,e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case`WAITING_ACTIVE`:case`ACTIVE_LOCK`:case`ACTIVE_ERROR`: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 Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!==`OFF`&&this._updateMarker(e),this.options.trackUserLocation&&this._watchState!==`ACTIVE_LOCK`||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove(`maplibregl-user-location-dot-stale`),this.fire(new t.n(`geolocate`,e)),this._finish()}},this._updateCamera=e=>{let n=new t.W(e.coords.longitude,e.coords.latitude),r=e.coords.accuracy,i=this._map.getBearing(),a=t.e({bearing:i},this.options.fitBoundsOptions),o=le.fromLngLat(n,r);this._map.fitBounds(o,a,{geolocateSource:!0})},this._updateMarker=e=>{if(e){let n=new t.W(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(n).addTo(this._map),this._userLocationDotMarker.setLngLat(n).addTo(this._map),this._accuracy=e.coords.accuracy,this._updateCircleRadiusIfNeeded()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onUpdate=()=>{this._updateCircleRadiusIfNeeded()},this._onError=e=>{if(this._map){if(e.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;let e=this._map._getUIString(`GeolocateControl.LocationNotAvailable`);this._geolocateButton.title=e,this._geolocateButton.setAttribute(`aria-label`,e),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(e.code===3&&bo)return;this._setErrorState()}this._watchState!==`OFF`&&this.options.showUserLocation&&this._dotElement.classList.add(`maplibregl-user-location-dot-stale`),this.fire(new t.n(`error`,e)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._onMoveStart=e=>{if(!this._map)return;let n=e?.[0]instanceof ResizeObserverEntry;e.geolocateSource||this._watchState!==`ACTIVE_LOCK`||n||this._map.isZooming()||(this._watchState=`BACKGROUND`,this._geolocateButton.classList.add(`maplibregl-ctrl-geolocate-background`),this._geolocateButton.classList.remove(`maplibregl-ctrl-geolocate-active`),this.fire(new t.n(`trackuserlocationend`)),this.fire(new t.n(`userlocationlostfocus`)))},this._setupUI=()=>{this._map&&(this._container.addEventListener(`contextmenu`,(e=>{e.preventDefault()})),this._geolocateButton=d.create(`button`,`maplibregl-ctrl-geolocate`,this._container),d.create(`span`,`maplibregl-ctrl-icon`,this._geolocateButton).setAttribute(`aria-hidden`,`true`),this._geolocateButton.type=`button`,this._geolocateButton.disabled=!0)},this._finishSetupUI=e=>{if(this._map){if(!1===e){t.w(`Geolocation support is not available so the GeolocateControl will be disabled.`);let e=this._map._getUIString(`GeolocateControl.LocationNotAvailable`);this._geolocateButton.disabled=!0,this._geolocateButton.title=e,this._geolocateButton.setAttribute(`aria-label`,e)}else{let e=this._map._getUIString(`GeolocateControl.FindMyLocation`);this._geolocateButton.disabled=!1,this._geolocateButton.title=e,this._geolocateButton.setAttribute(`aria-label`,e)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute(`aria-pressed`,`false`),this._watchState=`OFF`),this.options.showUserLocation&&(this._dotElement=d.create(`div`,`maplibregl-user-location-dot`),this._userLocationDotMarker=new _o({element:this._dotElement}),this._circleElement=d.create(`div`,`maplibregl-user-location-accuracy-circle`),this._accuracyCircleMarker=new _o({element:this._circleElement,pitchAlignment:`map`}),this.options.trackUserLocation&&(this._watchState=`OFF`),this._map.on(`zoom`,this._onUpdate),this._map.on(`move`,this._onUpdate),this._map.on(`rotate`,this._onUpdate),this._map.on(`pitch`,this._onUpdate)),this._geolocateButton.addEventListener(`click`,(()=>this.trigger())),this._setup=!0,this.options.trackUserLocation&&this._map.on(`movestart`,this._onMoveStart)}},this.options=t.e({},vo,e)}onAdd(e){return this._map=e,this._container=d.create(`div`,`maplibregl-ctrl maplibregl-ctrl-group`),this._setupUI(),function(){return t._(this,arguments,void 0,(function*(e=!1){if(po!==void 0&&!e)return po;if(window.navigator.permissions===void 0)return po=!!window.navigator.geolocation,po;try{po=(yield window.navigator.permissions.query({name:`geolocation`})).state!==`denied`}catch{po=!!window.navigator.geolocation}return po}))}().then((e=>this._finishSetupUI(e))),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(),this._container.remove(),this._map.off(`movestart`,this._onMoveStart),this._map.off(`zoom`,this._onUpdate),this._map.off(`move`,this._onUpdate),this._map.off(`rotate`,this._onUpdate),this._map.off(`pitch`,this._onUpdate),this._map=void 0,yo=0,bo=!1}_isOutOfMapMaxBounds(e){let t=this._map.getMaxBounds(),n=e.coords;return t&&(n.longitude<t.getWest()||n.longitude>t.getEast()||n.latitude<t.getSouth()||n.latitude>t.getNorth())}_setErrorState(){switch(this._watchState){case`WAITING_ACTIVE`:this._watchState=`ACTIVE_E
756RROR`,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`:case`BACKGROUND_ERROR`:case`OFF`:case void 0:break;default:throw Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadiusIfNeeded(){let e=this._userLocationDotMarker.getLngLat();if(!(this.options.showUserLocation&&this.options.showAccuracyCircle&&this._accuracy&&e))return;let t=this._map.project(e),n=this._map.unproject([t.x+100,t.y]),r=e.distanceTo(n)/100,i=2*this._accuracy/r;this._circleElement.style.width=`${i.toFixed(2)}px`,this._circleElement.style.height=`${i.toFixed(2)}px`}trigger(){if(!this._setup)return t.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 t.n(`trackuserlocationstart`));break;case`WAITING_ACTIVE`:case`ACTIVE_LOCK`:case`ACTIVE_ERROR`:case`BACKGROUND_ERROR`:yo--,bo=!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 t.n(`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 t.n(`trackuserlocationstart`)),this.fire(new t.n(`userlocationfocus`));break;default:throw 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 Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState===`OFF`&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let e;this._geolocateButton.classList.add(`maplibregl-ctrl-geolocate-waiting`),this._geolocateButton.setAttribute(`aria-pressed`,`true`),yo++,yo>1?(e={maximumAge:6e5,timeout:0},bo=!0):(e=this.options.positionOptions,bo=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,e)}}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)}},e.GlobeControl=class{constructor(){this._toggleProjection=()=>{let e=this._map.getProjection()?.type;this._map.setProjection(e!==`mercator`&&e?{type:`mercator`}:{type:`globe`}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{this._globeButton.classList.remove(`maplibregl-ctrl-globe`),this._globeButton.classList.remove(`maplibregl-ctrl-globe-enabled`),this._map.getProjection()?.type===`globe`?(this._globeButton.classList.add(`maplibregl-ctrl-globe-enabled`),this._globeButton.title=this._map._getUIString(`GlobeControl.Disable`)):(this._globeButton.classList.add(`maplibregl-ctrl-globe`),this._globeButton.title=this._map._getUIString(`GlobeControl.Enable`))}}onAdd(e){return this._map=e,this._container=d.create(`div`,`maplibregl-ctrl maplibregl-ctrl-group`),this._globeButton=d.create(`button`,`maplibregl-ctrl-globe`,this._container),d.create(`span`,`maplibregl-ctrl-icon`,this._globeButton).setAttribute(`aria-hidden`,`true`),this._globeButton.type=`button`,this._globeButton.addEventListener(`click`,this._toggleProjection),this._updateGlobeIcon(),this._map.on(`styledata`,this._updateGlobeIcon),this._map.on(`projectiontransition`,this._updateGlobeIcon),this._container}onRemove(){this._container.remove(),this._map.off(`styledata`,this._updateGlobeIcon),this._map.off(`projectiontransition`,this._updateGlobeIcon),this._globeButton.removeEventListener(`click`,this._toggleProjection),this._map=void 0}},e.Hash=ta,e.ImageSource=xe,e.KeyboardHandler=Ia,e.LngLatBounds=le,e.LogoControl
vendor: 10,515 bytes, line 756
756=Qa,e.Map=lo,e.MapLibreMap=lo,e.MapMouseEvent=da,e.MapTouchEvent=fa,e.MapWheelEvent=pa,e.Marker=_o,e.NavigationControl=class{constructor(e){this._updateZoomButtons=()=>{let e=this._map.getZoom(),t=e===this._map.getMaxZoom(),n=e===this._map.getMinZoom();this._zoomInButton.disabled=t,this._zoomOutButton.disabled=n,this._zoomInButton.setAttribute(`aria-disabled`,t.toString()),this._zoomOutButton.setAttribute(`aria-disabled`,n.toString())},this._rotateCompassArrow=()=>{this._compassIcon.style.transform=this.options.visualizePitch&&this.options.visualizeRoll?`scale(${1/Math.cos(this._map.transform.pitchInRadians)**.5}) rotateZ(${-this._map.transform.roll}deg) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizePitch?`scale(${1/Math.cos(this._map.transform.pitchInRadians)**.5}) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizeRoll?`rotate(${-this._map.transform.bearing-this._map.transform.roll}deg)`:`rotate(${-this._map.transform.bearing}deg)`},this._setButtonTitle=(e,t)=>{let n=this._map._getUIString(`NavigationControl.${t}`);e.title=n,e.setAttribute(`aria-label`,n)},this.options=t.e({},uo,e),this._container=d.create(`div`,`maplibregl-ctrl maplibregl-ctrl-group`),this._container.addEventListener(`contextmenu`,(e=>e.preventDefault())),this.options.showZoom&&(this._zoomInButton=this._createButton(`maplibregl-ctrl-zoom-in`,(e=>this._map.zoomIn({},{originalEvent:e}))),d.create(`span`,`maplibregl-ctrl-icon`,this._zoomInButton).setAttribute(`aria-hidden`,`true`),this._zoomOutButton=this._createButton(`maplibregl-ctrl-zoom-out`,(e=>this._map.zoomOut({},{originalEvent:e}))),d.create(`span`,`maplibregl-ctrl-icon`,this._zoomOutButton).setAttribute(`aria-hidden`,`true`)),this.options.showCompass&&(this._compass=this._createButton(`maplibregl-ctrl-compass`,(e=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})})),this._compassIcon=d.create(`span`,`maplibregl-ctrl-icon`,this._compass),this._compassIcon.setAttribute(`aria-hidden`,`true`))}onAdd(e){return this._map=e,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.options.visualizeRoll&&this._map.on(`roll`,this._rotateCompassArrow),this._map.on(`rotate`,this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new fo(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){this._container.remove(),this.options.showZoom&&this._map.off(`zoom`,this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off(`pitch`,this._rotateCompassArrow),this.options.visualizeRoll&&this._map.off(`roll`,this._rotateCompassArrow),this._map.off(`rotate`,this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(e,t){let n=d.create(`button`,e,this._container);return n.type=`button`,n.addEventListener(`click`,t),n}},e.Popup=class extends t.E{constructor(e){super(),this._updateOpacity=()=>{this.options.locationOccludedOpacity!==void 0&&(this._container.style.opacity=this._map.transform.isLocationOccluded(this.getLngLat())?`${this.options.locationOccludedOpacity}`:``)},this.remove=()=>(this._content&&this._content.remove(),this._container&&(this._container.remove(),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(`terrain`,this._update),this._map.off(`projectiontransition`,this._update),this._map.off(`mousemove`,this._update),this._map.off(`mouseup`,this._update),this._map.off(`drag`,this._update),this._map._canvasContainer.classList.remove(`maplibregl-track-pointer`),delete this._map,this.fire(new t.n(`close`))),this),this._update=e=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=d.create(`div`,`maplibregl-popup`,this._map.getContainer()),this._tip=d.create(`div`,`maplibregl-popup-tip`,this._container),this._container.appendChild(this._content),this.options.className)for(let e of this.options.className.split(` `))this._container.classList.add(e);this._closeButton&&this._closeButton.setAttribute(`aria-label`,this._map._getUIString(`Popup.Close`)),this._trackPointer&&this._container.classList.add(`maplibregl-popup-track-pointer`)}let t;if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=mo(this._lngLat,this._flatPos,this._map.transform,this._trackPointer),e&&`point`in e&&e.point&&(t=e.point),this._trackPointer&&!t)return;let n=this._flatPos=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&t?t:this._map.transform.locationToScreenPoint(this._lngLat));let r=this.options.anchor,i=Eo(this.options.offset);if(!r){let e=this._container.offsetWidth,t=this._container.offsetHeight,a=function(e){return e?{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}:{top:0,right:0,bottom:0,left:0}}(this.options.padding),o;o=n.y+i.bottom.y<t+a.top?[`top`]:n.y>this._map.transform.height-t-a.bottom?[`bottom`]:[],n.x<e/2+a.left?o.push(`left`):n.x>this._map.transform.width-e/2-a.right&&o.push(`right`),r=o.length===0?`bottom`:o.join(`-`)}let a=n.add(i[r]);this.options.subpixelPositioning||(a=a.round()),this._container.style.transform=`${ho[r]} translate(${a.x}px,${a.y}px)`,go(this._container,r,`popup`),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=t.e(Object.create(wo),e)}addTo(e){return this._map&&this.remove(),this._map=e,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._map.on(`terrain`,this._update),this._map.on(`projectiontransition`,this._update),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on(`mousemove`,this._update),this._map.on(`mouseup`,this._update),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 t.n(`open`)),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=t.W.convert(e),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on(`move`,this._update),this._map.off(`mousemove`,this._update),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._update),this._map.on(`drag`,this._update),this._container&&this._container.classList.add(`maplibregl-popup-track-pointer`),this._map._canvasContainer.classList.add(`maplibregl-track-pointer`)),this}getElement(){return this._container}setText(e){return this.setDOMContent(document.createTextNode(e))}setHTML(e){let t=document.createDocumentFragment(),n=document.createElement(`body`),r;for(n.innerHTML=e;r=n.firstChild,r;)t.appendChild(r);return this.setDOMContent(t)}getMaxWidth(){return this._container?.style.maxWidth}setMaxWidth(e){return this.options.maxWidth=e,this._update(),this}setDOMContent(e){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=d.create(`div`,`maplibregl-popup-content`,this._container);return this._content.appendChild(e),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(e){return this._container&&this._container.classList.add(e),this}removeClassName(e){return this._container&&this._container.classList.remove(e),this}setOffset(e){return this.options.offset=e,this._update(),this}toggleClassName(e){if(this._container)return this._container.classList.toggle(e)}setSubpixelPositioning(e){this.options.subpixelPositioning=e}setPadding(e){this.options.padding=e,this._update()}_createCloseButton(){this.options.closeButton&&(this._closeButton=d.create(`button`,`maplibregl-popup-close-button`,this._content),this._closeButton.type=`button`,this._closeButton.innerHTML=`&#215;`,this._closeButton.addEventListener(`click`,this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;let e=this._container.querySelector(To);e&&e.focus()}},e.RasterDEMTileSource=pe,e.RasterTileSource=fe,e.ScaleControl=class{constructor(e){this._onMove=()=>{So(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,So(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},xo),e)}getDefaultPosition(){return`bottom-left`}onAdd(e){return this._map=e,this._container=d.create(`div`,`maplibregl-ctrl maplibregl-ctrl-scale`,e.getContainer()),this._map.on(`move`,this._onMove),this._onMove(),this._container}onRemove(){this._container.remove(),this._map.off(`move`,this._onMove),this._map=void 0}},e.ScrollZoomHandler=za,e.Style=Xn,e.TerrainControl=class{constructor(e){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=e}onAdd(e){return this._map=e,this._container=d.create(`div`,`maplibregl-ctrl maplibregl-ctrl-group`),this._terrainButton=d.create(`button`,`maplibregl-ctrl-terrain`,this._container),d.create(`span`,`maplibregl-ctrl-icon`,this._terrainButton).setAttribute(`aria-hidden`,`true`),this._terrainButton.t
756ype=`button`,this._terrainButton.addEventListener(`click`,this._toggleTerrain),this._updateTerrainIcon(),this._map.on(`terrain`,this._updateTerrainIcon),this._container}onRemove(){this._container.remove(),this._map.off(`terrain`,this._updateTerrainIcon),this._map=void 0}},e.TwoFingersTouchPitchHandler=Pa,e.TwoFingersTouchRotateHandler=Ma,e.TwoFingersTouchZoomHandler=Aa,e.TwoFingersTouchZoomRotateHandler=Ga,e.VectorTileSource=de,e.VideoSource=Se,e.addSourceType=(e,n)=>t._(void 0,void 0,void 0,(function*(){if(Te(e))throw Error(`A source type called "${e}" already exists.`);((e,t)=>{we[e]=t})(e,n)})),e.clearPrewarmedResources=function(){let e=te;e&&(e.isPreloaded()&&e.numActive()===1?(e.release(k),te=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()`))},e.createTileMesh=Cn,e.getGlobalDispatcher=j,e.getMaxParallelImageRequests=function(){return t.c.MAX_PARALLEL_IMAGE_REQUESTS},e.getRTLTextPluginStatus=function(){return ke().getRTLTextPluginStatus()},e.getVersion=function(){return Do},e.getWorkerCount=function(){return A.workerCount},e.getWorkerUrl=function(){return t.c.WORKER_URL},e.importScriptInWorkers=function(e){return j().broadcast(`IS`,e)},e.isTimeFrozen=function(){return c.isFrozen()},e.now=l,e.prewarm=function(){re().acquire(k)},e.restoreNow=function(){c.restoreNow()},e.setMaxParallelImageRequests=function(e){t.c.MAX_PARALLEL_IMAGE_REQUESTS=e},e.setNow=function(e){c.setNow(e)},e.setRTLTextPlugin=function(e,t){return ke().setRTLTextPlugin(e,t)},e.setWorkerCount=function(e){A.workerCount=e},e.setWorkerUrl=function(e){t.c.WORKER_URL=e}})),e}))}))(),1),b=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),x=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),S=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),C=e=>{let t=S(e);return t.charAt(0).toUpperCase()+t.slice(1)},w={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},T=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},E=(0,_.createContext)({}),D=()=>(0,_.useContext)(E),O=(0,_.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=D()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,_.createElement)(`svg`,{ref:c,...w,width:t??l??w.width,height:t??l??w.height,stroke:e??f,strokeWidth:m,className:b(`lucide`,p,i),...!a&&!T(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,_.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),k=(e,t)=>{let n=(0,_.forwardRef)(({className:n,...r},i)=>(0,_.createElement)(O,{ref:i,iconNode:t,className:b(`lucide-${x(C(e))}`,`lucide-${e}`,n),...r}));return n.displayName=C(e),n},A=k(`book-open`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]),ee=k(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),te=k(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),ne=k(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),re=k(`heart`,[[`path`,{d:`M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5`,key:`mvr1a0`}]]),ie=k(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),j=k(`map-pin`,[[`path`,{d:`M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0`,key:`1r0f0z`}],[`circle`,{cx:`12`,cy:`10`,r:`3`,key:`ilqhr7`}]]),M=k(`map`,[[`path`,{d:`M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z`,key:`169xi5`}],[`path`,{d:`M15 5.764v15`,key:`1pn4in`}],[`path`,{d:`M9 3.236v15`,key:`1uimfh`}]]),ae=k(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),oe=k(`mic-off`,[[`path`,{d:`M12 19v3`,key:`npa21l`}],[`path`,{d:`M15 9.34V5a3 3 0 0 0-5.68-1.33`,key:`1gzdoj`}],[`path`,{d:`M16.95 16.95A7 7 0 0 1 5 12v-2`,key:`cqa7eg`}],[`path`,{d:`M18.89 13.23A7 7 0 0 0 19 12v-2`,key:`16hl24`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v3a3 3 0 0 0 5.12 2.12`,key:`r2i35w`}]]),se=k(`mic`,[[`path`,{d:`M12 19v3`,key:`npa21l`}],[`path`,{d:`M19 10v2a7 7 0 0 1-14 0v-2`,key:`1vc78b`}
vendor: 4,620 bytes, line 756
756],[`rect`,{x:`9`,y:`2`,width:`6`,height:`13`,rx:`3`,key:`s6n7sd`}]]),ce=k(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),le=k(`navigation`,[[`polygon`,{points:`3 11 22 2 13 21 11 13 3 11`,key:`1ltx0t`}]]),ue=k(`newspaper`,[[`path`,{d:`M15 18h-5`,key:`95g1m2`}],[`path`,{d:`M18 14h-8`,key:`sponae`}],[`path`,{d:`M4 22h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v16a2 2 0 0 1-4 0v-9a2 2 0 0 1 2-2h2`,key:`39pd36`}],[`rect`,{width:`8`,height:`4`,x:`10`,y:`6`,rx:`1`,key:`aywv1n`}]]),de=k(`phone`,[[`path`,{d:`M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384`,key:`9njp5v`}]]),fe=k(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),pe=k(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),me=k(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),he=k(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),ge=k(`shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),_e=k(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),ve=k(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),ye=k(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),be=()=>void 0,xe=function(e){let t=[],n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);i<128?t[n++]=i:i<2048?(t[n++]=i>>6|192,t[n++]=i&63|128):(i&64512)==55296&&r+1<e.length&&(e.charCodeAt(r+1)&64512)==56320?(i=65536+((i&1023)<<10)+(e.charCodeAt(++r)&1023),t[n++]=i>>18|240,t[n++]=i>>12&63|128,t[n++]=i>>6&63|128,t[n++]=i&63|128):(t[n++]=i>>12|224,t[n++]=i>>6&63|128,t[n++]=i&63|128)}return t},Se=function(e){let t=[],n=0,r=0;for(;n<e.length;){let i=e[n++];if(i<128)t[r++]=String.fromCharCode(i);else if(i>191&&i<224){let a=e[n++];t[r++]=String.fromCharCode((i&31)<<6|a&63)}else if(i>239&&i<365){let a=e[n++],o=e[n++],s=e[n++],c=((i&7)<<18|(a&63)<<12|(o&63)<<6|s&63)-65536;t[r++]=String.fromCharCode(55296+(c>>10)),t[r++]=String.fromCharCode(56320+(c&1023))}else{let a=e[n++],o=e[n++];t[r++]=String.fromCharCode((i&15)<<12|(a&63)<<6|o&63)}}return t.join(``)},Ce={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`,get ENCODED_VALS(){return this.ENCODED_VALS_BASE+`+/=`},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+`-_.`},HAS_NATIVE_SUPPORT:typeof atob==`function`,encodeByteArray(e,t){if(!Array.isArray(e))throw Error(`encodeByteArray takes an array as a parameter`);this.init_();let n=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let t=0;t<e.length;t+=3){let i=e[t],a=t+1<e.length,o=a?e[t+1]:0,s=t+2<e.length,c=s?e[t+2]:0,l=i>>2,u=(i&3)<<4|o>>4,d=(o&15)<<2|c>>6,f=c&63;s||(f=64,a||(d=64)),r.push(n[l],n[u],n[d],n[f])}return r.join(``)},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(xe(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):Se(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();let n=t?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let t=0;t<e.length;){let i=n[e.charAt(t++)],a=t<e.length?n[e.charAt(t)]:0;++t;let o=t<e.length?n[e.charAt(t)]:64;++t;let s=t<e.length?n[e.charAt(t)]:64;if(++t,i==null||a==null||o==null||s==null)throw new we;let c=i<<2|a>>4;if(r.push(c),o!==64){let e=a<<4&240|o>>2;if(r.push(e),s!==64){let e=o<<6&192|s;
756r.push(e)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}},we=class extends Error{constructor(){super(...arguments),this.name=`DecodeBase64StringError`}},Te=function(e){let t=xe(e);return Ce.encodeByteArray(t,!0)},Ee=function(e){return Te(e).replace(/\./g,``)},De=function(e){try{return Ce.decodeString(e,!0)}catch(e){console.error(`base64Decode failed: `,e)}return null};function Oe(){if(typeof self<`u`)return self;if(typeof window<`u`)return window;if(typeof global<`u`)return global;throw Error(`Unable to locate global object.`)}var ke=()=>Oe().__FIREBASE_DEFAULTS__,Ae=()=>{if(typeof process>`u`)return;let e={}.__FIREBASE_DEFAULTS__;if(e)return JSON.parse(e)},je=()=>{if(typeof document>`u`)return;let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}let t=e&&De(e[1]);return t&&JSON.parse(t)},Me=()=>{try{return be()||ke()||Ae()||je()}catch(e){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`);return}},Ne=e=>Me()?.emulatorHosts?.[e],Pe=e=>{let t=Ne(e);if(!t)return;let n=t.lastIndexOf(`:`);if(n<=0||n+1===t.length)throw Error(`Invalid host ${t} with no separate hostname and port!`);let r=parseInt(t.substring(n+1),10);return t[0]===`[`?[t.substring(1,n-1),r]:[t.substring(0,n),r]},Fe=()=>Me()?.config,Ie=e=>Me()?.[`_${e}`],Le=class{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}wrapCallback(e){return(t,n)=>{t?this.reject(t):this.resolve(n),typeof e==`function`&&(this.promise.catch(()=>{}),e.length===1?e(t):e(t,n))}}};function Re(e,t){if(e.uid)throw Error(`The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.`);let n={alg:`none`,type:`JWT`},r=t||`demo-project`,i=e.iat||0,a=e.sub||e.user_id;if(!a)throw Error(`mockUserToken must contain 'sub' or 'user_id' field!`);let o={iss:`https://securetoken.google.com/${r}`,aud:r,iat:i,exp:i+3600,auth_time:i,sub:a,user_id:a,firebase:{sign_in_provider:`custom`,identities:{}},...e};return[Ee(JSON.stringify(n)),Ee(JSON.stringify(o)),``].join(`.`)}function ze(){return typeof navigator<`u`&&typeof navigator.userAgent==`string`?navigator.userAgent:``}function Be(){return typeof window<`u`&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(ze())}function N(){let e=Me()?.forceEnvironment;if(e===`node`)return!0;if(e===`browser`)return!1;try{return Object.prototype.toString.call(global.process)===`[object process]`}catch{return!1}}function Ve(){return typeof navigator<`u`&&navigator.userAgent===`Cloudflare-Workers`}function He(){let e=typeof chrome==`object`?chrome.runtime:typeof browser==`object`?browser.runtime:void 0;return typeof e==`object`&&e.id!==void 0}function Ue(){return typeof navigator==`object`&&navigator.product===`ReactNative`}function We(){let e=ze();return e.indexOf(`MSIE `)>=0||e.indexOf(`Trident/`)>=0}function Ge(){return!N()&&!!navigator.userAgent&&navigator.userAgent.includes(`Safari`)&&!navigator.userAgent.includes(`Chrome`)}function Ke(){try{return typeof indexedDB==`object`}catch{return!1}}function qe(){return new Promise((e,t)=>{try{let n=!0,r=`validate-browser-context-for-indexeddb-analytics-module`,i=self.indexedDB.open(r);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(r),e(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{t(i.error?.message||``)}}catch(e){t(e)}})}var Je=`FirebaseError`,Ye=class e extends Error{constructor(t,n,r){super(n),this.code=t,this.customData=r,this.name=Je,Object.setPrototypeOf(this,e.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,Xe.prototype.create)}},Xe=class{constructor(e,t,n){this.service=e,this.serviceName=t,this.errors=n}create(e,...t){let n=t[0]||{},r=`${this.service}/${e}`,i=this.errors[e],a=i?Ze(i,n):`Error`;return new Ye(r,`${this.serviceName}: ${a} (${r}).`,n)}};function Ze(e,t){return e.replace(P,(e,n)=>{let r=t[n];return r==null?`<${n}?>`:String(r)})}var P=/\{\$([^}]+)}/g;function Qe(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}function $e(e,t){if(e===t)return!0;let n=Object.keys(e),r=Object.keys(t);for(let i of n){if(!r.includes(i))return!1;let n=e[i],a=t[i];if(et(n)&&et(a)){if(!$e(n,a))return!1}else if(n!==a)return!1}for(let e of r)if(!n.includes(e))return!1;return!0}function et(e){return typeof e==`object`&&!!e}function tt(e){let t=[];
756for(let[n,r]of Object.entries(e))Array.isArray(r)?r.forEach(e=>{t.push(encodeURIComponent(n)+`=`+encodeURIComponent(e))}):t.push(encodeURIComponent(n)+`=`+encodeURIComponent(r));return t.length?`&`+t.join(`&`):``}function F(e){let t={};return e.replace(/^\?/,``).split(`&`).forEach(e=>{if(e){let[n,r]=e.split(`=`);t[decodeURIComponent(n)]=decodeURIComponent(r)}}),t}function nt(e){let t=e.indexOf(`?`);if(!t)return``;let n=e.indexOf(`#`,t);return e.substring(t,n>0?n:void 0)}function rt(e,t){let n=new it(e,t);return n.subscribe.bind(n)}var it=class{constructor(e,t){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then(()=>{e(this)}).catch(e=>{this.error(e)})}next(e){this.forEachObserver(t=>{t.next(e)})}error(e){this.forEachObserver(t=>{t.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,t,n){let r;if(e===void 0&&t===void 0&&n===void 0)throw Error(`Missing Observer.`);r=at(e,[`next`,`error`,`complete`])?e:{next:e,error:t,complete:n},r.next===void 0&&(r.next=ot),r.error===void 0&&(r.error=ot),r.complete===void 0&&(r.complete=ot);let i=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?r.error(this.finalError):r.complete()}catch{}}),this.observers.push(r),i}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],--this.observerCount,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let t=0;t<this.observers.length;t++)this.sendOne(t,e)}sendOne(e,t){this.task.then(()=>{if(this.observers!==void 0&&this.observers[e]!==void 0)try{t(this.observers[e])}catch(e){typeof console<`u`&&console.error&&console.error(e)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}};function at(e,t){if(typeof e!=`object`||!e)return!1;for(let n of t)if(n in e&&typeof e[n]==`function`)return!0;return!1}function ot(){}function st(e){return e&&e._delegate?e._delegate:e}function ct(e){try{return(e.startsWith(`http://`)||e.startsWith(`https://`)?new URL(e).hostname:e).endsWith(`.cloudworkstations.dev`)}catch{return!1}}async function lt(e){return(await fetch(e,{credentials:`include`})).ok}var ut=class{constructor(e,t,n){this.name=e,this.instanceFactory=t,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode=`LAZY`,this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}},dt=`[DEFAULT]`,ft=class{constructor(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){let t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){let e=new Le;if(this.instancesDeferred.set(t,e),this.isInitialized(t)||this.shouldAutoInitialize())try{let n=this.getOrInitializeService({instanceIdentifier:t});n&&e.resolve(n)}catch{}}return this.instancesDeferred.get(t).promise}getImmediate(e){let t=this.normalizeInstanceIdentifier(e?.identifier),n=e?.optional??!1;if(this.isInitialized(t)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:t})}catch(e){if(n)return null;throw e}else if(n)return null;else throw Error(`Service ${this.name} is not available`)}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,this.shouldAutoInitialize()){if(mt(e))try{this.getOrInitializeService({instanceIdentifier:dt})}catch{}for(let[e,t]of this.instancesDeferred.entries()){let n=this.normalizeInstanceIdentifier(e);try{let e=this.getOrInitializeService({instanceIdentifier:n});t.resolve(e)}catch{}}}}clearInstance(e=dt){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){let e=Array.from(this.instances.values());await Promise.all([...e.filter(e=>`INTERNAL`in e).map(e=>e.INTERNAL.delete()),...e.filter(e=>`_delete`in e).map(e=>e._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=dt){return this.instances.has(e)}getOptions(e=dt){return this.instancesOptions.get(e)||{}}initialize(e={}){let{options:t={}}=e,n=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(n))throw Error(`${this.name}(${n}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);let r=this.getOrInitializeService({instanceIdentifier:n,options:t});for(let[e,t]of this.instancesDeferred.entries())n===this.normalizeInstanceIdentifier(e)&&t.resolve(r);return r}onInit(e,t){let n=this.normalizeInstanceIdentifier(t),r=this.onInitCallbacks.get(n)??new Set;r.add(e),this.onInitCallbacks.set(n,r);let i=this.instances.get(n);return i&&e(i,n),()=>{r.delete(e)}}invokeOnInitCallbacks(e,t){let n=this.onInitCallbacks.get(t);if(n)for(let r of n)try{r(e,t)}catch{}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let n=this.instances.get(e);if(!n&&this.component&&(n=this.component.instanceFactory(this.container,{instanceIdentifier:pt(e),options:t}),this.instances.set(e,n),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(n,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,n)}catch{}return n||null}normalizeInstanceIdentifier(e=dt){return this.component?this.component.multipleInstances?e:dt:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!==`EXPLICIT`}};function pt(e){return e===dt?void 0:e}function mt(e){return e.instantiationMode===`EAGER`}var ht=class{constructor(e){this.name=e,this.providers=new Map}addComponent(e){let t=this.getProvider(e.name);if(t.isComponentSet())throw Error(`Component ${e.name} has already been registered with ${this.name}`);t.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);let t=new ft(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}},gt=[],_t;(function(e){e[e.DEBUG=0]=`DEBUG`,e[e.VERBOSE=1]=`VERBOSE`,e[e.INFO=2]=`INFO`,e[e.WARN=3]=`WARN`,e[e.ERROR=4]=`ERROR`,e[e.SILENT=5]=`SILENT`})(_t||={});var vt={debug:_t.DEBUG,verbose:_t.VERBOSE,info:_t.INFO,warn:_t.WARN,error:_t.ERROR,silent:_t.
vendor: 14,290 bytes, line 756
756SILENT},yt=_t.INFO,bt={[_t.DEBUG]:`log`,[_t.VERBOSE]:`log`,[_t.INFO]:`info`,[_t.WARN]:`warn`,[_t.ERROR]:`error`},xt=(e,t,...n)=>{if(t<e.logLevel)return;let r=new Date().toISOString(),i=bt[t];if(i)console[i](`[${r}]  ${e.name}:`,...n);else throw Error(`Attempted to log a message with an invalid logType (value: ${t})`)},St=class{constructor(e){this.name=e,this._logLevel=yt,this._logHandler=xt,this._userLogHandler=null,gt.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in _t))throw TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e==`string`?vt[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if(typeof e!=`function`)throw TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,_t.DEBUG,...e),this._logHandler(this,_t.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,_t.VERBOSE,...e),this._logHandler(this,_t.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,_t.INFO,...e),this._logHandler(this,_t.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,_t.WARN,...e),this._logHandler(this,_t.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,_t.ERROR,...e),this._logHandler(this,_t.ERROR,...e)}},Ct=(e,t)=>t.some(t=>e instanceof t),wt,Tt;function Et(){return wt||=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]}function Dt(){return Tt||=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey]}var Ot=new WeakMap,kt=new WeakMap,At=new WeakMap,jt=new WeakMap,Mt=new WeakMap;function Nt(e){let t=new Promise((t,n)=>{let r=()=>{e.removeEventListener(`success`,i),e.removeEventListener(`error`,a)},i=()=>{t(zt(e.result)),r()},a=()=>{n(e.error),r()};e.addEventListener(`success`,i),e.addEventListener(`error`,a)});return t.then(t=>{t instanceof IDBCursor&&Ot.set(t,e)}).catch(()=>{}),Mt.set(t,e),t}function Pt(e){if(kt.has(e))return;let t=new Promise((t,n)=>{let r=()=>{e.removeEventListener(`complete`,i),e.removeEventListener(`error`,a),e.removeEventListener(`abort`,a)},i=()=>{t(),r()},a=()=>{n(e.error||new DOMException(`AbortError`,`AbortError`)),r()};e.addEventListener(`complete`,i),e.addEventListener(`error`,a),e.addEventListener(`abort`,a)});kt.set(e,t)}var Ft={get(e,t,n){if(e instanceof IDBTransaction){if(t===`done`)return kt.get(e);if(t===`objectStoreNames`)return e.objectStoreNames||At.get(e);if(t===`store`)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return zt(e[t])},set(e,t,n){return e[t]=n,!0},has(e,t){return e instanceof IDBTransaction&&(t===`done`||t===`store`)||t in e}};function It(e){Ft=e(Ft)}function Lt(e){return e===IDBDatabase.prototype.transaction&&!(`objectStoreNames`in IDBTransaction.prototype)?function(t,...n){let r=e.call(Bt(this),t,...n);return At.set(r,t.sort?t.sort():[t]),zt(r)}:Dt().includes(e)?function(...t){return e.apply(Bt(this),t),zt(Ot.get(this))}:function(...t){return zt(e.apply(Bt(this),t))}}function Rt(e){return typeof e==`function`?Lt(e):(e instanceof IDBTransaction&&Pt(e),Ct(e,Et())?new Proxy(e,Ft):e)}function zt(e){if(e instanceof IDBRequest)return Nt(e);if(jt.has(e))return jt.get(e);let t=Rt(e);return t!==e&&(jt.set(e,t),Mt.set(t,e)),t}var Bt=e=>Mt.get(e);function Vt(e,t,{blocked:n,upgrade:r,blocking:i,terminated:a}={}){let o=indexedDB.open(e,t),s=zt(o);return r&&o.addEventListener(`upgradeneeded`,e=>{r(zt(o.result),e.oldVersion,e.newVersion,zt(o.transaction),e)}),n&&o.addEventListener(`blocked`,e=>n(e.oldVersion,e.newVersion,e)),s.then(e=>{a&&e.addEventListener(`close`,()=>a()),i&&e.addEventListener(`versionchange`,e=>i(e.oldVersion,e.newVersion,e))}).catch(()=>{}),s}var Ht=[`get`,`getKey`,`getAll`,`getAllKeys`,`count`],Ut=[`put`,`add`,`delete`,`clear`],Wt=new Map;function Gt(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&typeof t==`string`))return;if(Wt.get(t))return Wt.get(t);let n=t.replace(/FromIndex$/,``),r=t!==n,i=Ut.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(i||Ht.includes(n)))return;let a=async function(e,...t){let a=this.transaction(e,i?`readwrite`:`readonly`),o=a.store;return r&&(o=o.index(t.shift())),(await Promise.all([o[n](...t),i&&a.done]))[0]};return Wt.set(t,a),a}It(e=>({...e,get:(t,n,r)=>Gt(t,n)||e.get(t,n,r),has:(t,n)=>!!Gt(t,n)||e.has(t,n)}));var Kt=class{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(e=>{if(qt(e)){let t=e.getImmediate();return`${t.library}/${t.version}`}else return null}).filter(e=>e).join(` `)}};function qt(e){return e.getComponent()?.type===`VERSION`}var Jt=`@firebase/app`,Yt=`0.15.1`,Xt=new St(`@firebase/app`),Zt=`@firebase/app-compat`,Qt=`@firebase/analytics-compat`,$t=`@firebase/analytics`,en=`@firebase/app-check-compat`,tn=`@firebase/app-check`,nn=`@firebase/auth`,rn=`@firebase/auth-compat`,an=`@firebase/database`,on=`@firebase/data-connect`,sn=`@firebase/database-compat`,cn=`@firebase/functions`,ln=`@firebase/functions-compat`,un=`@firebase/installations`,dn=`@firebase/installations-compat`,fn=`@firebase/messaging`,pn=`@firebase/messaging-compat`,mn=`@firebase/performance`,hn=`@firebase/performance-compat`,gn=`@firebase/remote-config`,_n=`@firebase/remote-config-compat`,vn=`@firebase/storage`,yn=`@firebase/storage-compat`,bn=`@firebase/firestore`,xn=`@firebase/ai`,Sn=`@firebase/firestore-compat`,Cn=`firebase`,wn=`12.16.0`,Tn=`[DEFAULT]`,En={[Jt]:`fire-core`,[Zt]:`fire-core-compat`,[$t]:`fire-analytics`,[Qt]:`fire-analytics-compat`,[tn]:`fire-app-check`,[en]:`fire-app-check-compat`,[nn]:`fire-auth`,[rn]:`fire-auth-compat`,[an]:`fire-rtdb`,[on]:`fire-data-connect`,[sn]:`fire-rtdb-compat`,[cn]:`fire-fn`,[ln]:`fire-fn-compat`,[un]:`fire-iid`,[dn]:`fire-iid-compat`,[fn]:`fire-fcm`,[pn]:`fire-fcm-compat`,[mn]:`fire-perf`,[hn]:`fire-perf-compat`,[gn]:`fire-rc`,[_n]:`fire-rc-compat`,[vn]:`fire-gcs`,[yn]:`fire-gcs-compat`,[bn]:`fire-fst`,[Sn]:`fire-fst-compat`,[xn]:`fire-vertex`,"fire-js":`fire-js`,[Cn]:`fire-js-all`},Dn=new Map,On=new Map,kn=new Map;function An(e,t){try{e.container.addComponent(t)}catch(n){Xt.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,n)}}function jn(e){let t=e.name;if(kn.has(t))return Xt.debug(`There were multiple attempts to register component ${t}.`),!1;kn.set(t,e);for(let t of Dn.values())An(t,e);for(let t of On.values())An(t,e);return!0}function Mn(e,t){let n=e.container.getProvider(`heartbeat`).getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}function Nn(e){return e!=null&&e.settings!==void 0}var Pn=new Xe(`app`,`Firebase`,{"no-app":`No Firebase App '{$appName}' has been created - call initializeApp() first`,"bad-app-name":`Illegal App name: '{$appName}'`,"duplicate-app":`Firebase App named '{$appName}' already exists with different options or config`,"app-deleted":`Firebase App named '{$appName}' already deleted`,"server-app-deleted":`Firebase Server App has been deleted`,"no-options":`Need to provide options, when not being deployed to hosting via source.`,"invalid-app-argument":`firebase.{$appName}() takes either no argument or a Firebase App instance.`,"invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":`Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.`,"idb-get":`Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.`,"idb-set":`Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.`,"idb-delete":`Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.`,"finalization-registry-not-supported":`FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.`,"invalid-server-app-environment":`FirebaseServerApp is not for use in browser environments.`}),Fn=class{constructor(e,t,n){this._isDeleted=!1,this._options={...e},this._config={...t},this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new ut(`app`,()=>this,`PUBLIC`))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw Pn.create(`app-deleted`,{appName:this._name})}},In=wn;function Ln(e,t={}){let n=e;typeof t!=`object`&&(t={name:t});let r={name:Tn,automaticDataCollectionEnabled:!0,...t},i=r.name;if(typeof i!=`string`||!i)throw Pn.create(`bad-app-name`,{appName:String(i)});if(n||=Fe(),!n)throw Pn.create(`no-options`);let a=Dn.get(i);if(a){if($e(n,a.options)&&$e(r,a.config))return a;throw Pn.create(`duplicate-app`,{appName:i})}let o=new ht(i);for(let e of kn.values())o.addComponent(e);let s=new Fn(n,r,o);return Dn.set(i,s),s}function Rn(e=Tn){let t=Dn.get(e);if(!t&&e===`[DEFAULT]`&&Fe())return Ln();if(!t)throw Pn.create(`no-app`,{appName:e});return t}function zn(e,t,n){let r=En[e]??e;n&&(r+=`-${n}`);let i=r.match(/\s|\//),a=t.match(/\s|\//);if(i||a){let e=[`Unable to register library "${r}" with version "${t}":`];i&&e.push(`library name "${r}" contains illegal characters (whitespace or "/")`),i&&a&&e.push(`and`),a&&e.push(`version name "${t}" contains illegal characters (whitespace or "/")`),Xt.warn(e.join(` `));return}jn(new ut(`${r}-version`,()=>({library:r,version:t}),`VERSION`))}var Bn=`firebase-heartbeat-database`,Vn=1,Hn=`firebase-heartbeat-store`,Un=null;function Wn(){return Un||=Vt(Bn,Vn,{upgrade:(e,t)=>{switch(t){case 0:try{e.createObjectStore(Hn)}catch(e){console.warn(e)}}}}).catch(e=>{throw Pn.create(`idb-open`,{originalErrorMessage:e.message})}),Un}async function Gn(e){try{let t=(await Wn()).transaction(Hn),n=await t.objectStore(Hn).get(qn(e));return await t.done,n}catch(e){if(e instanceof Ye)Xt.warn(e.message);else{let t=Pn.create(`idb-get`,{originalErrorMessage:e?.message});Xt.warn(t.message)}}}async function Kn(e,t){try{let n=(await Wn()).transaction(Hn,`readwrite`);await n.objectStore(Hn).put(t,qn(e)),await n.done}catch(e){if(e instanceof Ye)Xt.warn(e.message);else{let t=Pn.create(`idb-set`,{originalErrorMessage:e?.message});Xt.warn(t.message)}}}function qn(e){return`${e.name}!${e.options.appId}`}var Jn=1024,Yn=30,Xn=class{constructor(e){this.container=e,this._heartbeatsCache=null;let t=this.container.getProvider(`app`).getImmediate();this._storage=new $n(t),this._heartbeatsCachePromise=this._storage.read().then(e=>(this._heartbeatsCache=e,e))}async triggerHeartbeat(){try{let e=this.container.getProvider(`platform-logger`).getImmediate().getPlatformInfoString(),t=Zn();if(this._heartbeatsCache?.heartbeats==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null)||this._heartbeatsCache.lastSentHeartbeatDate===t||this._heartbeatsCache.heartbeats.some(e=>e.date===t))return;if(this._heartbeatsCache.heartbeats.push({date:t,agent:e}),this._heartbeatsCache.heartbeats.length>Yn){let e=tr(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(e,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(e){Xt.warn(e)}}async getHeartbeatsHeader(){try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null||this._heartbeatsCache.heartbeats.length===0)return``;let e=Zn(),{heartbeatsToSend:t,unsentEntries:n}=Qn(this._heartbeatsCache.heartbeats),r=Ee(JSON.stringify({version:2,heartbeats:t}));return this._heartbeatsCache.lastSentHeartbeatDate=e,n.length>0?(this._heartbeatsCache.heartbeats=n,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),r}catch(e){return Xt.warn(e),``}}};function Zn(){return new Date().toISOString().substring(0,10)}function Qn(e,t=Jn){let n=[],r=e.slice();for(let i of e){let e=n.find(e=>e.agent===i.agent);if(!e){if(n.push({agent:i.agent,dates:[i.date]}),er(n)>t){n.pop();break}}else if(e.dates.push(i.date),er(n)>t){e.dates.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}var $n=class{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return Ke()?qe().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){let e=await Gn(this.app);return e?.heartbeats?e:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){if(await this._canUseIndexedDBPromise){let t=await this.read();return Kn(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??t.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){if(await this._canUseIndexedDBPromise){let t=await this.read();return Kn(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??t.lastSentHeartbeatDate,heartbeats:[...t.heartbeats,...e.heartbeats]})}else return}};function er(e){return Ee(JSON.stringify({version:2,heartbeats:e})).length}function tr(e){if(e.length===0)return-1;let t=0,n=e[0].date;for(let r=1;r<e.length;r++)e[r].date<n&&(n=e[r].date,t=r);return t}function nr(e){jn(new ut(`platform-logger`,e=>new Kt(e),`PRIVATE`)),jn(new ut(`heartbeat`,e=>new Xn(e),`PRIVATE`)),zn(Jt,Yt,e),zn(Jt,Yt,`esm2020`),zn(`fire-js`,``)}nr(``),zn(`firebase`,`12.16.0`,`app`);var rr=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{},ir={},ar,or;(function(){var e;function t(e,t){function n(){}n.prototype=t.prototype,e.F=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.D=function(e,n,r){for(var i=Array(arguments.length-2),a=2;a<arguments.length;a++)i[a-2]=arguments[a];return t.prototype[n].apply(e,i)}}function n(){this.blockSize=-1}function r(){this.blockSize=-1,this.blockSize=64,this.g=[,,,,],this.C=Array(this.blockSize),this.o=this.h=0,this.u()}
756t(r,n),r.prototype.u=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.o=this.h=0};function i(e,t,n){n||=0;let r=Array(16);if(typeof t==`string`)for(var i=0;i<16;++i)r[i]=t.charCodeAt(n++)|t.charCodeAt(n++)<<8|t.charCodeAt(n++)<<16|t.charCodeAt(n++)<<24;else for(i=0;i<16;++i)r[i]=t[n++]|t[n++]<<8|t[n++]<<16|t[n++]<<24;t=e.g[0],n=e.g[1],i=e.g[2];let a=e.g[3],o;o=t+(a^n&(i^a))+r[0]+3614090360&4294967295,t=n+(o<<7&4294967295|o>>>25),o=a+(i^t&(n^i))+r[1]+3905402710&4294967295,a=t+(o<<12&4294967295|o>>>20),o=i+(n^a&(t^n))+r[2]+606105819&4294967295,i=a+(o<<17&4294967295|o>>>15),o=n+(t^i&(a^t))+r[3]+3250441966&4294967295,n=i+(o<<22&4294967295|o>>>10),o=t+(a^n&(i^a))+r[4]+4118548399&4294967295,t=n+(o<<7&4294967295|o>>>25),o=a+(i^t&(n^i))+r[5]+1200080426&4294967295,a=t+(o<<12&4294967295|o>>>20),o=i+(n^a&(t^n))+r[6]+2821735955&4294967295,i=a+(o<<17&4294967295|o>>>15),o=n+(t^i&(a^t))+r[7]+4249261313&4294967295,n=i+(o<<22&4294967295|o>>>10),o=t+(a^n&(i^a))+r[8]+1770035416&4294967295,t=n+(o<<7&4294967295|o>>>25),o=a+(i^t&(n^i))+r[9]+2336552879&4294967295,a=t+(o<<12&4294967295|o>>>20),o=i+(n^a&(t^n))+r[10]+4294925233&4294967295,i=a+(o<<17&4294967295|o>>>15),o=n+(t^i&(a^t))+r[11]+2304563134&4294967295,n=i+(o<<22&4294967295|o>>>10),o=t+(a^n&(i^a))+r[12]+1804603682&4294967295,t=n+(o<<7&4294967295|o>>>25),o=a+(i^t&(n^i))+r[13]+4254626195&4294967295,a=t+(o<<12&4294967295|o>>>20),o=i+(n^a&(t^n))+r[14]+2792965006&4294967295,i=a+(o<<17&4294967295|o>>>15),o=n+(t^i&(a^t))+r[15]+1236535329&4294967295,n=i+(o<<22&4294967295|o>>>10),o=t+(i^a&(n^i))+r[1]+4129170786&4294967295,t=n+(o<<5&4294967295|o>>>27),o=a+(n^i&(t^n))+r[6]+3225465664&4294967295,a=t+(o<<9&4294967295|o>>>23),o=i+(t^n&(a^t))+r[11]+643717713&4294967295,i=a+(o<<14&4294967295|o>>>18),o=n+(a^t&(i^a))+r[0]+3921069994&4294967295,n=i+(o<<20&4294967295|o>>>12),o=t+(i^a&(n^i))+r[5]+3593408605&4294967295,t=n+(o<<5&4294967295|o>>>27),o=a+(n^i&(t^n))+r[10]+38016083&4294967295,a=t+(o<<9&4294967295|o>>>23),o=i+(t^n&(a^t))+r[15]+3634488961&4294967295,i=a+(o<<14&4294967295|o>>>18),o=n+(a^t&(i^a))+r[4]+3889429448&4294967295,n=i+(o<<20&4294967295|o>>>12),o=t+(i^a&(n^i))+r[9]+568446438&4294967295,t=n+(o<<5&4294967295|o>>>27),o=a+(n^i&(t^n))+r[14]+3275163606&4294967295,a=t+(o<<9&4294967295|o>>>23),o=i+(t^n&(a^t))+r[3]+4107603335&4294967295,i=a+(o<<14&4294967295|o>>>18),o=n+(a^t&(i^a))+r[8]+1163531501&4294967295,n=i+(o<<20&4294967295|o>>>12),o=t+(i^a&(n^i))+r[13]+2850285829&4294967295,t=n+(o<<5&4294967295|o>>>27),o=a+(n^i&(t^n))+r[2]+4243563512&4294967295,a=t+(o<<9&4294967295|o>>>23),o=i+(t^n&(a^t))+r[7]+1735328473&4294967295,i=a+(o<<14&4294967295|o>>>18),o=n+(a^t&(i^a))+r[12]+2368359562&4294967295,n=i+(o<<20&4294967295|o>>>12),o=t+(n^i^a)+r[5]+4294588738&4294967295,t=n+(o<<4&4294967295|o>>>28),o=a+(t^n^i)+r[8]+2272392833&4294967295,a=t+(o<<11&4294967295|o>>>21),o=i+(a^t^n)+r[11]+1839030562&4294967295,i=a+(o<<16&4294967295|o>>>16),o=n+(i^a^t)+r[14]+4259657740&4294967295,n=i+(o<<23&4294967295|o>>>9),o=t+(n^i^a)+r[1]+2763975236&4294967295,t=n+(o<<4&4294967295|o>>>28),o=a+(t^n^i)+r[4]+1272893353&4294967295,a=t+(o<<11&4294967295|o>>>21),o=i+(a^t^n)+r[7]+4139469664&4294967295,i=a+(o<<16&4294967295|o>>>16),o=n+(i^a^t)+r[10]+3200236656&4294967295,n=i+(o<<23&4294967295|o>>>9),o=t+(n^i^a)+r[13]+681279174&4294967295,t=n+(o<<4&4294967295|o>>>28),o=a+(t^n^i)+r[0]+3936430074&4294967295,a=t+(o<<11&4294967295|o>>>21),o=i+(a^t^n)+r[3]+3572445317&4294967295,i=a+(o<<16&4294967295|o>>>16),o=n+(i^a^t)+r[6]+76029189&4294967295,n=i+(o<<23&4294967295|o>>>9),o=t+(n^i^a)+r[9]+3654602809&4294967295,t=n+(o<<4&4294967295|o>>>28),o=a+(t^n^i)+r[12]+3873151461&4294967295,a=t+(o<<11&4294967295|o>>>21),o=i+(a^t^n)+r[15]+530742520&4294967295,i=a+(o<<16&4294967295|o>>>16),o=n+(i^a^t)+r[2]+3299628645&4294967295,n=i+(o<<23&4294967295|o>>>9),o=t+(i^(n|~a))+r[0]+4096336452&4294967295,t=n+(o<<6&4294967295|o>>>26),o=a+(n^(t|~i))+r[7]+1126891415&4294967295,a=t+(o<<10&4294967295|o>>>22),o=i+(t^(a|~n))+r[14]+2878612391&4294967295,i=a+(o<<15&4294967295|o>>>17),o=n+(a^(i|~t))+r[5]+4237533241&4294967295,n=i+(o<<21&4294967295|o>>>11),o=t+(i^(n|~a))+r[12]+1700485571&4294967295,t=n+(o<<6&4294967295|o>>>26),o=a+(n^(t|~i))+r[3]+2399980690&4294967295,a=t+(o<<10&4294967295|o>>>22),o=i+(t^(a|~n))+r[10]+4293915773&4294967295,i=a+(o<<15&4294967295|o>>>17),o=n+(a^(i|~t))+r[1]+2240044497&4294967295,n=i+(o<<21&4294967295|o>>>11),o=t+(i^(n|~a))+r[8]+1873313359&4294967295,t=n+(o<<6&4294967295|o>>>26),o=a+(n^(t|~i))+r[15]+4264355552&4294967295,a=t+(o<<10&4294967295|o>>>22),o=i+(t^(a|~n))+r[6]+2734768916&4294967295,i=a+(o<<15&4294967295|o>>>17),o=n+(a^(i|~t))+r[13]+1309151649&4294967295,n=i+(o<<21&4294967295|o>>>11),o=t+(i^(n|~a))+r[4]+4149444226&4294967295,t=n+(o<<6&4294967295|o>>>
75626),o=a+(n^(t|~i))+r[11]+3174756917&4294967295,a=t+(o<<10&4294967295|o>>>22),o=i+(t^(a|~n))+r[2]+718787259&4294967295,i=a+(o<<15&4294967295|o>>>17),o=n+(a^(i|~t))+r[9]+3951481745&4294967295,e.g[0]=e.g[0]+t&4294967295,e.g[1]=e.g[1]+(i+(o<<21&4294967295|o>>>11))&4294967295,e.g[2]=e.g[2]+i&4294967295,e.g[3]=e.g[3]+a&4294967295}r.prototype.v=function(e,t){t===void 0&&(t=e.length);let n=t-this.blockSize,r=this.C,a=this.h,o=0;for(;o<t;){if(a==0)for(;o<=n;)i(this,e,o),o+=this.blockSize;if(typeof e==`string`){for(;o<t;)if(r[a++]=e.charCodeAt(o++),a==this.blockSize){i(this,r),a=0;break}}else for(;o<t;)if(r[a++]=e[o++],a==this.blockSize){i(this,r),a=0;break}}this.h=a,this.o+=t},r.prototype.A=function(){var e=Array((this.h<56?this.blockSize:this.blockSize*2)-this.h);e[0]=128;for(var t=1;t<e.length-8;++t)e[t]=0;t=this.o*8;for(var n=e.length-8;n<e.length;++n)e[n]=t&255,t/=256;for(this.v(e),e=Array(16),t=0,n=0;n<4;++n)for(let r=0;r<32;r+=8)e[t++]=this.g[n]>>>r&255;return e};function a(e,t){var n=s;return Object.prototype.hasOwnProperty.call(n,e)?n[e]:n[e]=t(e)}function o(e,t){this.h=t;let n=[],r=!0;for(let i=e.length-1;i>=0;i--){let a=e[i]|0;r&&a==t||(n[i]=a,r=!1)}this.g=n}var s={};function c(e){return-128<=e&&e<128?a(e,function(e){return new o([e|0],e<0?-1:0)}):new o([e|0],e<0?-1:0)}function l(e){if(isNaN(e)||!isFinite(e))return d;if(e<0)return g(l(-e));let t=[],n=1;for(let r=0;e>=n;r++)t[r]=e/n|0,n*=4294967296;return new o(t,0)}function u(e,t){if(e.length==0)throw Error(`number format error: empty string`);if(t||=10,t<2||36<t)throw Error(`radix out of range: `+t);if(e.charAt(0)==`-`)return g(u(e.substring(1),t));if(e.indexOf(`-`)>=0)throw Error(`number format error: interior "-" character`);let n=l(t**8),r=d;for(let a=0;a<e.length;a+=8){var i=Math.min(8,e.length-a);let o=parseInt(e.substring(a,a+i),t);i<8?(i=l(t**+i),r=r.j(i).add(l(o))):(r=r.j(n),r=r.add(l(o)))}return r}var d=c(0),f=c(1),p=c(16777216);e=o.prototype,e.m=function(){if(h(this))return-g(this).m();let e=0,t=1;for(let n=0;n<this.g.length;n++){let r=this.i(n);e+=(r>=0?r:4294967296+r)*t,t*=4294967296}return e},e.toString=function(e){if(e||=10,e<2||36<e)throw Error(`radix out of range: `+e);if(m(this))return`0`;if(h(this))return`-`+g(this).toString(e);let t=l(e**6);var n=this;let r=``;for(;;){let i=b(n,t).g;n=_(n,i.j(t));let a=((n.g.length>0?n.g[0]:n.h)>>>0).toString(e);if(n=i,m(n))return a+r;for(;a.length<6;)a=`0`+a;r=a+r}},e.i=function(e){return e<0?0:e<this.g.length?this.g[e]:this.h};function m(e){if(e.h!=0)return!1;for(let t=0;t<e.g.length;t++)if(e.g[t]!=0)return!1;return!0}function h(e){return e.h==-1}e.l=function(e){return e=_(this,e),h(e)?-1:+!m(e)};function g(e){let t=e.g.length,n=[];for(let r=0;r<t;r++)n[r]=~e.g[r];return new o(n,~e.h).add(f)}e.abs=function(){return h(this)?g(this):this},e.add=function(e){let t=Math.max(this.g.length,e.g.length),n=[],r=0;for(let i=0;i<=t;i++){let t=r+(this.i(i)&65535)+(e.i(i)&65535),a=(t>>>16)+(this.i(i)>>>16)+(e.i(i)>>>16);r=a>>>16,t&=65535,a&=65535,n[i]=a<<16|t}return new o(n,n[n.length-1]&-2147483648?-1:0)};function _(e,t){return e.add(g(t))}e.j=function(e){if(m(this)||m(e))return d;if(h(this))return h(e)?g(this).j(g(e)):g(g(this).j(e));if(h(e))return g(this.j(g(e)));if(this.l(p)<0&&e.l(p)<0)return l(this.m()*e.m());let t=this.g.length+e.g.length,n=[];for(var r=0;r<2*t;r++)n[r]=0;for(r=0;r<this.g.length;r++)for(let t=0;t<e.g.length;t++){let i=this.i(r)>>>16,a=this.i(r)&65535,o=e.i(t)>>>16,s=e.i(t)&65535;n[2*r+2*t]+=a*s,v(n,2*r+2*t),n[2*r+2*t+1]+=i*s,v(n,2*r+2*t+1),n[2*r+2*t+1]+=a*o,v(n,2*r+2*t+1),n[2*r+2*t+2]+=i*o,v(n,2*r+2*t+2)}for(e=0;e<t;e++)n[e]=n[2*e+1]<<16|n[2*e];for(e=t;e<2*t;e++)n[e]=0;return new o(n,0)};function v(e,t){for(;(e[t]&65535)!=e[t];)e[t+1]+=e[t]>>>16,e[t]&=65535,t++}function y(e,t){this.g=e,this.h=t}function b(e,t){if(m(t))throw Error(`division by zero`);if(m(e))return new y(d,d);if(h(e))return t=b(g(e),t),new y(g(t.g),g(t.h));if(h(t))return t=b(e,g(t)),new y(g(t.g),t.h);if(e.g.length>30){if(h(e)||h(t))throw Error(`slowDivide_ only works with positive integers.`);for(var n=f,r=t;r.l(e)<=0;)n=x(n),r=x(r);var i=S(n,1),a=S(r,1);for(r=S(r,2),n=S(n,2);!m(r);){var o=a.add(r);o.l(e)<=0&&(i=i.add(n),a=o),r=S(r,1),n=S(n,1)}return t=_(e,i.j(t)),new y(i,t)}for(i=d;
756e.l(t)>=0;){for(n=Math.max(1,Math.floor(e.m()/t.m())),r=Math.ceil(Math.log(n)/Math.LN2),r=r<=48?1:2**(r-48),a=l(n),o=a.j(t);h(o)||o.l(e)>0;)n-=r,a=l(n),o=a.j(t);m(a)&&(a=f),i=i.add(a),e=_(e,o)}return new y(i,e)}e.B=function(e){return b(this,e).h},e.and=function(e){let t=Math.max(this.g.length,e.g.length),n=[];for(let r=0;r<t;r++)n[r]=this.i(r)&e.i(r);return new o(n,this.h&e.h)},e.or=function(e){let t=Math.max(this.g.length,e.g.length),n=[];for(let r=0;r<t;r++)n[r]=this.i(r)|e.i(r);return new o(n,this.h|e.h)},e.xor=function(e){let t=Math.max(this.g.length,e.g.length),n=[];for(let r=0;r<t;r++)n[r]=this.i(r)^e.i(r);return new o(n,this.h^e.h)};function x(e){let t=e.g.length+1,n=[];for(let r=0;r<t;r++)n[r]=e.i(r)<<1|e.i(r-1)>>>31;return new o(n,e.h)}function S(e,t){let n=t>>5;t%=32;let r=e.g.length-n,i=[];for(let a=0;a<r;a++)i[a]=t>0?e.i(a+n)>>>t|e.i(a+n+1)<<32-t:e.i(a+n);return new o(i,e.h)}r.prototype.digest=r.prototype.A,r.prototype.reset=r.prototype.u,r.prototype.update=r.prototype.v,or=ir.Md5=r,o.prototype.add=o.prototype.add,o.prototype.multiply=o.prototype.j,o.prototype.modulo=o.prototype.B,o.prototype.compare=o.prototype.l,o.prototype.toNumber=o.prototype.m,o.prototype.toString=o.prototype.toString,o.prototype.getBits=o.prototype.i,o.fromNumber=l,o.fromString=u,ar=ir.Integer=o}).apply(rr===void 0?typeof self<`u`?self:typeof window<`u`?window:{}:rr);var sr=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{},cr={},lr,ur,dr,fr,pr,mr,hr,gr;(function(){var e,t=Object.defineProperty;function n(e){e=[typeof globalThis==`object`&&globalThis,e,typeof window==`object`&&window,typeof self==`object`&&self,typeof sr==`object`&&sr];for(var t=0;t<e.length;++t){var n=e[t];if(n&&n.Math==Math)return n}throw Error(`Cannot find global object`)}var r=n(this);function i(e,n){if(n)a:{var i=r;e=e.split(`.`);for(var a=0;a<e.length-1;a++){var o=e[a];if(!(o in i))break a;i=i[o]}e=e[e.length-1],a=i[e],n=n(a),n!=a&&n!=null&&t(i,e,{configurable:!0,writable:!0,value:n})}}i(`Symbol.dispose`,function(e){return e||Symbol(`Symbol.dispose`)}),i(`Array.prototype.values`,function(e){return e||function(){return this[Symbol.iterator]()}}),i(`Object.entries`,function(e){return e||function(e){var t=[],n;for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push([n,e[n]]);return t}});var a=a||{},o=this||self;function s(e){var t=typeof e;return t==`object`&&e!=null||t==`function`}function c(e,t,n){return e.call.apply(e.bind,arguments)}function l(e,t,n){return l=c,l.apply(null,arguments)}function u(e,t){var n=Array.prototype.slice.call(arguments,1);return function(){var t=n.slice();return t.push.apply(t,arguments),e.apply(this,t)}}function d(e,t){function n(){}n.prototype=t.prototype,e.Z=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.Ob=function(e,n,r){for(var i=Array(arguments.length-2),a=2;a<arguments.length;a++)i[a-2]=arguments[a];return t.prototype[n].apply(e,i)}}var f=typeof AsyncContext<`u`&&typeof AsyncContext.Snapshot==`function`?e=>e&&AsyncContext.Snapshot.wrap(e):e=>e;function p(e){let t=e.length;if(t>0){let n=Array(t);for(let r=0;r<t;r++)n[r]=e[r];return n}return[]}function m(e,t){for(let t=1;t<arguments.length;t++){let r=arguments[t];var n=typeof r;if(n=n==`object`?r?Array.isArray(r)?`array`:n:`null`:n,n==`array`||n==`object`&&typeof r.length==`number`){n=e.length||0;let t=r.length||0;e.length=n+t;for(let i=0;i<t;i++)e[n+i]=r[i]}else e.push(r)}}class h{constructor(e,t){this.i=e,this.j=t,this.h=0,this.g=null}get(){let e;return this.h>0?(this.h--,e=this.g,this.g=e.next,e.next=null):e=this.i(),e}}function g(e){o.setTimeout(()=>{throw e},0)}function _(){var e=C;let t=null;return e.g&&(t=e.g,e.g=e.g.next,e.g||(e.h=null),t.next=null),t}class v{constructor(){this.h=this.g=null}add(e,t){let n=y.get();n.set(e,t),this.h?this.h.next=n:this.g=n,this.h=n}}var y=new h(()=>new b,e=>e.reset());class b{constructor(){this.next=this.g=this.h=null}set(e,t){this.h=e,this.g=t,this.next=null}reset(){this.next=this.g=this.h=null}}let x,S=!1,C=new v,w=()=>{let e=Promise.resolve(void 0);x=()=>{e.then(T)}};function T(){for(var e;e=_();){try{e.h.call(e.g)}catch(e){g(e)}var t=y;t.j(e),t.h<100&&(t.h++,e.next=t.g,t.g=e)}S=!1}function E(){this.u=this.u,this.C=this.C}E.prototype.u=!1,E.prototype.dispose=function(){this.u||(this.u=!0,this.N())},E.prototype[Symbol.dispose]=function(){this.dispose()},E.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()};function D(e,t){this.type=e,this.g=this.target=t,this.defaultPrevented=!1}D.prototype.h=function(){this.defaultPrevented=!0};var O=function(){if(!o.addEventListener||!Object.defineProperty)return!1;var e=!1,t=Object.defineProperty({},"passive",{get:function(){e=!0}});try{let e=()=>{};o.addEventListener(`test`,e,t),o.removeEventListener(`test`,e,t)}catch{}return e}();function k(e){return/^[\s\xa0]*$/.test(e)}function A(e,t){D.call(this,e?e.type:``),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key=``,this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType=``,this.i=null,e&&this.init(e,t)}d(A,D),A.prototype.init=function(e,t){let n=this.type=e.type,r=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:null;this.target=e.target||e.srcElement,this.g=t,t=e.relatedTarget,t||(n==`mouseover`?t=e.fromElement:n==`mouseout`&&(t=e.toElement)),this.relatedTarget=t,r?(this.clientX=r.clientX===void 0?r.pageX:r.clientX,this.clientY=r.clientY===void 0?r.pageY:r.clientY,this.screenX=r.screenX||0,this.screenY=r.screenY||0):(this.clientX=e.clientX===void 0?e.pageX:e.clientX,this.clientY=e.clientY===void 0?e.pageY:e.clientY,this.screenX=e.screenX||0,this.screenY=e.screenY||0),this.button=e.button,this.key=e.key||``,this.ctrlKey=e.ctrlKey,this.altKey=e.altKey,this.shiftKey=e.shiftKey,this.metaKey=e.metaKey,this.pointerId=e.pointerId||0,this.pointerType=e.pointerType,this.state=e.state,this.i=e,e.defaultPrevented&&A.Z.h.call(this)}
756,A.prototype.h=function(){A.Z.h.call(this);let e=this.i;e.preventDefault?e.preventDefault():e.returnValue=!1};var ee=`closure_listenable_`+(Math.random()*1e6|0),te=0;function ne(e,t,n,r,i){this.listener=e,this.proxy=null,this.src=t,this.type=n,this.capture=!!r,this.ha=i,this.key=++te,this.da=this.fa=!1}function re(e){e.da=!0,e.listener=null,e.proxy=null,e.src=null,e.ha=null}function ie(e,t,n){for(let r in e)t.call(n,e[r],r,e)}function j(e,t){for(let n in e)t.call(void 0,e[n],n,e)}function M(e){let t={};for(let n in e)t[n]=e[n];return t}let ae=`constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf`.split(` `);function oe(e,t){let n,r;for(let t=1;t<arguments.length;t++){for(n in r=arguments[t],r)e[n]=r[n];for(let t=0;t<ae.length;t++)n=ae[t],Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}}function se(e){this.src=e,this.g={},this.h=0}se.prototype.add=function(e,t,n,r,i){let a=e.toString();e=this.g[a],e||(e=this.g[a]=[],this.h++);let o=le(e,t,r,i);return o>-1?(t=e[o],n||(t.fa=!1)):(t=new ne(t,this.src,a,!!r,i),t.fa=n,e.push(t)),t};function ce(e,t){let n=t.type;if(n in e.g){var r=e.g[n],i=Array.prototype.indexOf.call(r,t,void 0),a;(a=i>=0)&&Array.prototype.splice.call(r,i,1),a&&(re(t),e.g[n].length==0&&(delete e.g[n],e.h--))}}function le(e,t,n,r){for(let i=0;i<e.length;++i){let a=e[i];if(!a.da&&a.listener==t&&a.capture==!!n&&a.ha==r)return i}return-1}var ue=`closure_lm_`+(Math.random()*1e6|0),de={};function fe(e,t,n,r,i){if(r&&r.once)return he(e,t,n,r,i);if(Array.isArray(t)){for(let a=0;a<t.length;a++)fe(e,t[a],n,r,i);return null}return n=Se(n),e&&e[ee]?e.J(t,n,s(r)?!!r.capture:!!r,i):pe(e,t,n,!1,r,i)}function pe(e,t,n,r,i,a){if(!t)throw Error(`Invalid event type`);let o=s(i)?!!i.capture:!!i,c=be(e);if(c||(e[ue]=c=new se(e)),n=c.add(t,n,r,o,a),n.proxy)return n;if(r=me(),n.proxy=r,r.src=e,r.listener=n,e.addEventListener)O||(i=o),i===void 0&&(i=!1),e.addEventListener(t.toString(),r,i);else if(e.attachEvent)e.attachEvent(ve(t.toString()),r);else if(e.addListener&&e.removeListener)e.addListener(r);else throw Error(`addEventListener and attachEvent are unavailable.`);return n}function me(){function e(n){return t.call(e.src,e.listener,n)}let t=ye;return e}function he(e,t,n,r,i){if(Array.isArray(t)){for(let a=0;a<t.length;a++)he(e,t[a],n,r,i);return null}return n=Se(n),e&&e[ee]?e.K(t,n,s(r)?!!r.capture:!!r,i):pe(e,t,n,!0,r,i)}function ge(e,t,n,r,i){if(Array.isArray(t))for(var a=0;a<t.length;a++)ge(e,t[a],n,r,i);else r=s(r)?!!r.capture:!!r,n=Se(n),e&&e[ee]?(e=e.i,a=String(t).toString(),a in e.g&&(t=e.g[a],n=le(t,n,r,i),n>-1&&(re(t[n]),Array.prototype.splice.call(t,n,1),t.length==0&&(delete e.g[a],e.h--)))):(e&&=be(e))&&(t=e.g[t.toString()],e=-1,t&&(e=le(t,n,r,i)),(n=e>-1?t[e]:null)&&_e(n))}function _e(e){if(typeof e!=`number`&&e&&!e.da){var t=e.src;if(t&&t[ee])ce(t.i,e);else{var n=e.type,r=e.proxy;t.removeEventListener?t.removeEventListener(n,r,e.capture):t.detachEvent?t.detachEvent(ve(n),r):t.addListener&&t.removeListener&&t.removeListener(r),(n=be(t))?(ce(n,e),n.h==0&&(n.src=null,t[ue]=null)):re(e)}}}function ve(e){return e in de?de[e]:de[e]=`on`+e}function ye(e,t){if(e.da)e=!0;else{t=new A(t,this);let n=e.listener,r=e.ha||e.src;e.fa&&_e(e),e=n.call(r,t)}return e}function be(e){return e=e[ue],e instanceof se?e:null}var xe=`__closure_events_fn_`+(Math.random()*1e9>>>0);function Se(e){return typeof e==`function`?e:(e[xe]||(e[xe]=function(t){return e.handleEvent(t)}),e[xe])}function Ce(){E.call(this),this.i=new se(this),this.M=this,this.G=null}d(Ce,E),Ce.prototype[ee]=!0,Ce.prototype.removeEventListener=function(e,t,n,r){ge(this,e,t,n,r)};function we(e,t){var n,r=e.G;if(r)for(n=[];r;r=r.G)n.push(r);if(e=e.M,r=t.type||t,typeof t==`string`)t=new D(t,e);else if(t instanceof D)t.target=t.target||e;else{var i=t;
756t=new D(r,e),oe(t,i)}i=!0;let a,o;if(n)for(o=n.length-1;o>=0;o--)a=t.g=n[o],i=Te(a,r,!0,t)&&i;if(a=t.g=e,i=Te(a,r,!0,t)&&i,i=Te(a,r,!1,t)&&i,n)for(o=0;o<n.length;o++)a=t.g=n[o],i=Te(a,r,!1,t)&&i}Ce.prototype.N=function(){if(Ce.Z.N.call(this),this.i){var e=this.i;for(let t in e.g){let n=e.g[t];for(let e=0;e<n.length;e++)re(n[e]);delete e.g[t],e.h--}}this.G=null},Ce.prototype.J=function(e,t,n,r){return this.i.add(String(e),t,!1,n,r)},Ce.prototype.K=function(e,t,n,r){return this.i.add(String(e),t,!0,n,r)};function Te(e,t,n,r){if(t=e.i.g[String(t)],!t)return!0;t=t.concat();let i=!0;for(let a=0;a<t.length;++a){let o=t[a];if(o&&!o.da&&o.capture==n){let t=o.listener,n=o.ha||o.src;o.fa&&ce(e.i,o),i=t.call(n,r)!==!1&&i}}return i&&!r.defaultPrevented}function Ee(e,t){if(typeof e!=`function`)if(e&&typeof e.handleEvent==`function`)e=l(e.handleEvent,e);else throw Error(`Invalid listener argument`);return Number(t)>2147483647?-1:o.setTimeout(e,t||0)}function De(e){e.g=Ee(()=>{e.g=null,e.i&&(e.i=!1,De(e))},e.l);let t=e.h;e.h=null,e.m.apply(null,t)}class Oe extends E{constructor(e,t){super(),this.m=e,this.l=t,this.h=null,this.i=!1,this.g=null}j(e){this.h=arguments,this.g?this.i=!0:De(this)}N(){super.N(),this.g&&(o.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function ke(e){E.call(this),this.h=e,this.g={}}d(ke,E);var Ae=[];function je(e){ie(e.g,function(e,t){this.g.hasOwnProperty(t)&&_e(e)},e),e.g={}}ke.prototype.N=function(){ke.Z.N.call(this),je(this)},ke.prototype.handleEvent=function(){throw Error(`EventHandler.handleEvent not implemented`)};var Me=o.JSON.stringify,Ne=o.JSON.parse,Pe=class{stringify(e){return o.JSON.stringify(e,void 0)}parse(e){return o.JSON.parse(e,void 0)}};function Fe(){}function Ie(){}var Le={OPEN:`a`,hb:`b`,ERROR:`c`,tb:`d`};function Re(){D.call(this,`d`)}d(Re,D);function ze(){D.call(this,`c`)}d(ze,D);var Be={},N=null;function Ve(){return N||=new Ce}Be.Ia=`serverreachability`;function He(e){D.call(this,Be.Ia,e)}d(He,D);function Ue(e){let t=Ve();we(t,new He(t))}Be.STAT_EVENT=`statevent`;function We(e,t){D.call(this,Be.STAT_EVENT,e),this.stat=t}d(We,D);function Ge(e){let t=Ve();we(t,new We(t,e))}Be.Ja=`timingevent`;function Ke(e,t){D.call(this,Be.Ja,e),this.size=t}d(Ke,D);function qe(e,t){if(typeof e!=`function`)throw Error(`Fn must not be null and must be a function`);return o.setTimeout(function(){e()},t)}function Je(){this.g=!0}Je.prototype.ua=function(){this.g=!1};function Ye(e,t,n,r,i,a){e.info(function(){if(e.g)if(a){var o=``,s=a.split(`&`);for(let e=0;e<s.length;e++){var c=s[e].split(`=`);
756if(c.length>1){let e=c[0];c=c[1];let t=e.split(`_`);o=t.length>=2&&t[1]==`type`?o+(e+`=`+c+`&`):o+(e+`=redacted&`)}}}else o=null;else o=a;return`XMLHTTP REQ (`+r+`) [attempt `+i+`]: `+t+`
757`+n+`
758`+o})}function Xe(e,t,n,r,i,a,o){e.info(function(){return`XMLHTTP RESP (`+r+`) [ attempt `+i+`]: `+t+`
759`+n+`
760`+a+` `+o})}function Ze(e,t,n,r){e.info(function(){return`XMLHTTP TEXT (`+t+`): `+Qe(e,n)+(r?` `+r:``)})}function P(e,t){e.info(function(){return`TIMEOUT: `+t})}Je.prototype.info=function(){};function Qe(e,t){if(!e.g)return t;if(!t)return null;try{let a=JSON.parse(t);if(a){for(e=0;e<a.length;e++)if(Array.isArray(a[e])){var n=a[e];if(!(n.length<2)){var r=n[1];if(Array.isArray(r)&&!(r.length<1)){var i=r[0];if(i!=`noop`&&i!=`stop`&&i!=`close`)for(let e=1;e<r.length;e++)r[e]=``}}}}return Me(a)}catch{return t}}var $e={NO_ERROR:0,cb:1,qb:2,pb:3,kb:4,ob:5,rb:6,Ga:7,TIMEOUT:8,ub:9},et={ib:`complete`,Fb:`success`,ERROR:`error`,Ga:`abort`,xb:`ready`,yb:`readystatechange`,TIMEOUT:`timeout`,sb:`incrementaldata`,wb:`progress`,lb:`downloadprogress`,Nb:`uploadprogress`},tt;function F(){}d(F,Fe),F.prototype.g=function(){return new XMLHttpRequest},tt=new F;function nt(e){return encodeURIComponent(String(e))}function rt(e){var t=1;e=e.split(`:`);let n=[];for(;t>0&&e.length;)n.push(e.shift()),t--;return e.length&&n.push(e.join(`:`)),n}function it(e,t,n,r){this.j=e,this.i=t,this.l=n,this.S=r||1,this.V=new ke(this),this.H=45e3,this.J=null,this.o=!1,this.u=this.B=this.A=this.M=this.F=this.T=this.D=null,this.G=[],this.g=null,this.C=0,this.m=this.v=null,this.X=-1,this.K=!1,this.P=0,this.O=null,this.W=this.L=this.U=this.R=!1,this.h=new at}function at(){this.i=null,this.g=``,this.h=!1}var ot={},st={};function ct(e,t,n){e.M=1,e.A=Ft(At(t)),e.u=n,e.R=!0,lt(e,null)}function lt(e,t){e.F=Date.now(),pt(e),e.B=At(e.A);var n=e.B,r=e.S;Array.isArray(r)||(r=[String(r)]),Yt(n.i,`t`,r),e.C=0,n=e.j.L,e.h=new at,e.g=Vn(e.j,n?t:null,!e.u),e.P>0&&(e.O=new Oe(l(e.Y,e,e.g),e.P)),t=e.V,n=e.g,r=e.ba;var i=`readystatechange`;Array.isArray(i)||(i&&(Ae[0]=i.toString()),i=Ae);for(let e=0;e<i.length;e++){let a=fe(n,i[e],r||t.handleEvent,!1,t.h||t);if(!a)break;t.g[a.key]=a}t=e.J?M(e.J):{},e.u?(e.v||=`POST`,t[`Content-Type`]=`application/x-www-form-urlencoded`,e.g.ea(e.B,e.v,e.u,t)):(e.v=`GET`,e.g.ea(e.B,e.v,null,t)),Ue(),Ye(e.i,e.v,e.B,e.l,e.S,e.u)}it.prototype.ba=function(e){e=e.target;let t=this.O;t&&vn(e)==3?t.j():this.Y(e)},it.prototype.Y=function(e){try{if(e==this.g)a:{let s=vn(this.g),c=this.g.ya(),l=this.g.ca();if(!(s<3)&&(s!=3||this.g&&(this.h.h||this.g.la()||yn(this.g)))){this.K||s!=4||c==7||Ue(c==8||l<=0?3:2),ht(this);var t=this.g.ca();this.X=t;var n=ut(this);if(this.o=t==200,Xe(this.i,this.v,this.B,this.l,this.S,s,t),this.o){if(this.U&&!this.L){b:{if(this.g){var r,i=this.g;if((r=i.g?i.g.getResponseHeader(`X-HTTP-Initial-Response`):null)&&!k(r)){var a=r;break b}}a=null}if(e=a)Ze(this.i,this.l,e,`Initial handshake response via X-HTTP-Initial-Response`),this.L=!0,vt(this,e);else{this.o=!1,this.m=3,Ge(12),_t(this),gt(this);break a}}if(this.R){e=!0;let t;for(;!this.K&&this.C<n.length;)if(t=ft(this,n),t==st){s==4&&(this.m=4,Ge(14),e=!1),Ze(this.i,this.l,null,`[Incomplete Response]`);break}else if(t==ot){this.m=4,Ge(15),Ze(this.i,this.l,n,`[Invalid Chunk]`),e=!1;break}else Ze(this.i,this.l,t,null),vt(this,t);if(dt(this)&&this.C!=0&&(this.h.g=this.h.g.slice(this.C),this.C=0),s!=4||n.length!=0||this.h.h||(this.m=1,Ge(16),e=!1),this.o=this.o&&e,!e)Ze(this.i,this.l,n,`[Invalid Chunked Response]`),_t(this),gt(this);else if(n.length>0&&!this.W){this.W=!0;var o=this.j;o.g==this&&o.aa&&!o.P&&(o.j.info(`Great, no buffering proxy detected. Bytes received: `+n.length),Nn(o),o.P=!0,Ge(11))}}else Ze(this.i,this.l,n,null),vt(this,n);s==4&&_t(this),this.o&&!this.K&&(s==4?In(this.j,this):(this.o=!1,pt(this)))}else bn(this.g),t==400&&n.indexOf(`Unknown SID`)>0?(this.m=3,Ge(12)):(this.m=0,Ge(13)),_t(this),gt(this)}}}catch{}};function ut(e){if(!dt(e))return e.g.la();let t=yn(e.g);if(t===``)return``;let n=``,r=t.length,i=vn(e.g)==4;if(!e.h.i){if(typeof TextDecoder>`u`)return _t(e),gt(e),``;e.h.i=new o.TextDecoder}for(let a=0;a<r;a++)e.h.h=!0,n+=e.h.i.decode(t[a],{stream:!(i&&a==r-1)});return t.length=0,e.h.g+=n,e.C=0,e.h.g}function dt(e){return e.g?e.v==`GET`&&e.M!=2&&e.j.Aa:!1}function ft(e,t){var n=e.C,r=t.indexOf(`
761`,n);return r==-1?st:(n=Number(t.substring(n,r)),isNaN(n)?ot:(r+=1,r+n>t.length?st:(t=t.slice(r,r+n),e.C=r+n,t)))}it.prototype.cancel=function(){this.K=!0,_t(this)};function pt(e){e.T=Date.now()+e.H,mt(e,e.H)}function mt(e,t){if(e.D!=null)throw Error(`WatchDog timer not null`);e.D=qe(l(e.aa,e),t)}function ht(e){e.D&&=(o.clearTimeout(e.D),null)}it.prototype.aa=function(){this.D=null;let e=Date.now();e-this.T>=0?(P(this.i,this.B),this.M!=2&&(Ue(),Ge(17)),_t(this),this.m=2,gt(this)):mt(this,this.T-e)};function gt(e){e.j.I==0||e.K||In(e.j,e)}function _t(e){ht(e);var t=e.O;t&&typeof t.dispose==`function`&&t.dispose(),e.O=null,je(e.V),e.g&&(t=e.g,e.g=null,t.abort(),t.dis
761pose())}function vt(e,t){try{var n=e.j;if(n.I!=0&&(n.g==e||Ct(n.h,e))){if(!e.L&&Ct(n.h,e)&&n.I==3){try{var r=n.Ba.g.parse(t)}catch{r=null}if(Array.isArray(r)&&r.length==3){var i=r;if(i[0]==0){a:if(!n.v){if(n.g)if(n.g.F+3e3<e.F)Fn(n),wn(n);else break a;Mn(n),Ge(18)}}else n.xa=i[1],0<n.xa-n.K&&i[2]<37500&&n.F&&n.A==0&&!n.C&&(n.C=qe(l(n.Va,n),6e3));St(n.h)<=1&&n.ta&&(n.ta=void 0)}else Rn(n,11)}else if((e.L||n.g==e)&&Fn(n),!k(t))for(i=n.Ba.g.parse(t),t=0;t<i.length;t++){let l=i[t],u=l[0];if(!(u<=n.K))if(n.K=u,l=l[1],n.I==2)if(l[0]==`c`){n.M=l[1],n.ba=l[2];let t=l[3];t!=null&&(n.ka=t,n.j.info(`VER=`+n.ka));let i=l[4];i!=null&&(n.za=i,n.j.info(`SVER=`+n.za));let u=l[5];u!=null&&typeof u==`number`&&u>0&&(r=1.5*u,n.O=r,n.j.info(`backChannelRequestTimeoutMs_=`+r)),r=n;let d=e.g;if(d){let e=d.g?d.g.getResponseHeader(`X-Client-Wire-Protocol`):null;if(e){var a=r.h;a.g||e.indexOf(`spdy`)==-1&&e.indexOf(`quic`)==-1&&e.indexOf(`h2`)==-1||(a.j=a.l,a.g=new Set,a.h&&=(wt(a,a.h),null))}if(r.G){let e=d.g?d.g.getResponseHeader(`X-HTTP-Session-Id`):null;e&&(r.wa=e,Pt(r.J,r.G,e))}}n.I=3,n.l&&n.l.ra(),n.aa&&(n.T=Date.now()-e.F,n.j.info(`Handshake RTT: `+n.T+`ms`)),r=n;var o=e;if(r.na=Bn(r,r.L?r.ba:null,r.W),o.L){Tt(r.h,o);var s=o,c=r.O;c&&(s.H=c),s.D&&(ht(s),pt(s)),r.g=o}else jn(r);n.i.length>0&&En(n)}else l[0]!=`stop`&&l[0]!=`close`||Rn(n,7);else n.I==3&&(l[0]==`stop`||l[0]==`close`?l[0]==`stop`?Rn(n,7):Cn(n):l[0]!=`noop`&&n.l&&n.l.qa(l),n.A=0)}}Ue(4)}catch{}}var yt=class{constructor(e,t){this.g=e,this.map=t}};function bt(e){this.l=e||10,o.PerformanceNavigationTiming?(e=o.performance.getEntriesByType(`navigation`),e=e.length>0&&(e[0].nextHopProtocol==`hq`||e[0].nextHopProtocol==`h2`)):e=!!(o.chrome&&o.chrome.loadTimes&&o.chrome.loadTimes()&&o.chrome.loadTimes().wasFetchedViaSpdy),this.j=e?this.l:1,this.g=null,this.j>1&&(this.g=new Set),this.h=null,this.i=[]}function xt(e){return e.h?!0:e.g?e.g.size>=e.j:!1}function St(e){return e.h?1:e.g?e.g.size:0}function Ct(e,t){return e.h?e.h==t:e.g?e.g.has(t):!1}function wt(e,t){e.g?e.g.add(t):e.h=t}function Tt(e,t){e.h&&e.h==t?e.h=null:e.g&&e.g.has(t)&&e.g.delete(t)}bt.prototype.cancel=function(){if(this.i=Et(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&this.g.size!==0){for(let e of this.g.values())e.cancel();this.g.clear()}};function Et(e){if(e.h!=null)return e.i.concat(e.h.G);if(e.g!=null&&e.g.size!==0){let t=e.i;for(let n of e.g.values())t=t.concat(n.G);return t}return p(e.i)}var Dt=RegExp(`^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$`);function Ot(e,t){if(e){e=e.split(`&`);for(let n=0;n<e.length;n++){let r=e[n].indexOf(`=`),i,a=null;r>=0?(i=e[n].substring(0,r),a=e[n].substring(r+1)):i=e[n],t(i,a?decodeURIComponent(a.replace(/\+/g,` `)):``)}}}function kt(e){this.g=this.o=this.j=``,this.u=null,this.m=this.h=``,this.l=!1;let t;e instanceof kt?(this.l=e.l,jt(this,e.j),this.o=e.o,this.g=e.g,Mt(this,e.u),this.h=e.h,Nt(this,Xt(e.i)),this.m=e.m):e&&(t=String(e).match(Dt))?(this.l=!1,jt(this,t[1]||``,!0),this.o=It(t[2]||``),this.g=It(t[3]||``,!0),Mt(this,t[4]),this.h=It(t[5]||``,!0),Nt(this,t[6]||``,!0),this.m=It(t[7]||``)):(this.l=!1,this.i=new Wt(null,this.l))}kt.prototype.toString=function(){let e=[];var t=this.j;t&&e.push(Lt(t,zt,!0),`:`);var n=this.g;return(n||t==`file`)&&(e.push(`//`),(t=this.o)&&e.push(Lt(t,zt,!0),`@`),e.push(nt(n).replace(/%25([0-9a-fA-F]{2})/g,`%$1`)),n=this.u,n!=null&&e.push(`:`,String(n))),(n=this.h)&&(this.g&&n.charAt(0)!=`/`&&e.push(`/`),e.push(Lt(n,n.charAt(0)==`/`?Vt:Bt,!0))),(n=this.i.toString())&&e.push(`?`,n),(n=this.m)&&e.push(`#`,Lt(n,Ut)),e.join(``)},kt.prototype.resolve=function(e){let t=At(this),n=!!e.j;n?jt(t,e.j):n=!!e.o,n?t.o=e.o:n=!!e.g,n?t.g=e.g:n=e.u!=null;var r=e.h;if(n)Mt(t,e.u);else if(n=!!e.h){if(r.charAt(0)!=`/`)if(this.g&&!this.h)r=`/`+r;else{var i=t.h.lastIndexOf(`/`);i!=-1&&(r=t.h.slice(0,i+1)+r)}if(i=r,i==`..`||i==`.`)r=``;else if(i.indexOf(`./`)!=-1||i.indexOf(`/.`)!=-1){r=i.lastIndexOf(`/`,0)==0,i=i.split(`/`);let e=[];for(let t=0;t<i.length;){let n=i[t++];n==`.`?r&&t==i.length&&e.push(``):n==`..`?((e.length>1||e.length==1&&e[0]!=``)&&e.pop(),r&&t==i.length&&e.push(``)):(e.push(n),r=!0)}r=e.join(`/`)}else r=i}return n?t.h=r:n=e.i.toString()!==``,n?Nt(t,Xt(e.i)):n=!!e.m,n&&(t.m=e.m),t};function At(e){return new kt(e)}function jt(e,t,n){e.j=n?It(t,!0):t,e.j&&=e.j.replace(/:$/,``)}function Mt(e,t){if(t){if(t=Number(t),isNaN(t)||t<0)throw Error(`Bad port number `+t);e.u=t}else e.u=null}function Nt(e,t,n){t instanceof Wt?(e.i=t,Qt(e.i,e.l)):(n||(t=Lt(t,Ht)),e.i=new Wt(t,e.l))}function Pt(e,t,n){e.i.set(t,n)}function Ft(e){return Pt(e,`zx`,Math.floor(Math.random()*2147483648).toString(36)+Math.abs(Math.floor(Math.random()*2147483648)^Date.now()).toString(36)),e}function It(e,t){return e?t?decodeURI(e.replace(/%25/g,`%2525`)):decodeURIComponent(e):``}function Lt(e,t,n){return typeof e==`string`?(e=encodeURI(e).replace(t,Rt),n&&(e=e.replace(/%25([0-9a-fA-F]{2})/g,`%$1`)),e):null}function Rt(e){return e=e.charCodeAt(0),`%`+(e>>4&15).toString(16)+(e&15).toString(16)}
761var zt=/[#\/\?@]/g,Bt=/[#\?:]/g,Vt=/[#\?]/g,Ht=/[#\?@]/g,Ut=/#/g;function Wt(e,t){this.h=this.g=null,this.i=e||null,this.j=!!t}function Gt(e){e.g||(e.g=new Map,e.h=0,e.i&&Ot(e.i,function(t,n){e.add(decodeURIComponent(t.replace(/\+/g,` `)),n)}))}e=Wt.prototype,e.add=function(e,t){Gt(this),this.i=null,e=Zt(this,e);let n=this.g.get(e);return n||this.g.set(e,n=[]),n.push(t),this.h+=1,this};function Kt(e,t){Gt(e),t=Zt(e,t),e.g.has(t)&&(e.i=null,e.h-=e.g.get(t).length,e.g.delete(t))}function qt(e,t){return Gt(e),t=Zt(e,t),e.g.has(t)}e.forEach=function(e,t){Gt(this),this.g.forEach(function(n,r){n.forEach(function(n){e.call(t,n,r,this)},this)},this)};function Jt(e,t){Gt(e);let n=[];if(typeof t==`string`)qt(e,t)&&(n=n.concat(e.g.get(Zt(e,t))));else for(e=Array.from(e.g.values()),t=0;t<e.length;t++)n=n.concat(e[t]);return n}e.set=function(e,t){return Gt(this),this.i=null,e=Zt(this,e),qt(this,e)&&(this.h-=this.g.get(e).length),this.g.set(e,[t]),this.h+=1,this},e.get=function(e,t){return e?(e=Jt(this,e),e.length>0?String(e[0]):t):t};function Yt(e,t,n){Kt(e,t),n.length>0&&(e.i=null,e.g.set(Zt(e,t),p(n)),e.h+=n.length)}e.toString=function(){if(this.i)return this.i;if(!this.g)return``;let e=[],t=Array.from(this.g.keys());for(let r=0;r<t.length;r++){var n=t[r];let i=nt(n);n=Jt(this,n);for(let t=0;t<n.length;t++){let r=i;n[t]!==``&&(r+=`=`+nt(n[t])),e.push(r)}}return this.i=e.join(`&`)};function Xt(e){let t=new Wt;return t.i=e.i,e.g&&(t.g=new Map(e.g),t.h=e.h),t}function Zt(e,t){return t=String(t),e.j&&(t=t.toLowerCase()),t}function Qt(e,t){t&&!e.j&&(Gt(e),e.i=null,e.g.forEach(function(e,t){let n=t.toLowerCase();t!=n&&(Kt(this,t),Yt(this,n,e))},e)),e.j=t}function $t(e,t){let n=new Je;if(o.Image){let r=new Image;r.onload=u(tn,n,`TestLoadImage: loaded`,!0,t,r),r.onerror=u(tn,n,`TestLoadImage: error`,!1,t,r),r.onabort=u(tn,n,`TestLoadImage: abort`,!1,t,r),r.ontimeout=u(tn,n,`TestLoadImage: timeout`,!1,t,r),o.setTimeout(function(){r.ontimeout&&r.ontimeout()},1e4),r.src=e}else t(!1)}function en(e,t){let n=new Je,r=new AbortController,i=setTimeout(()=>{r.abort(),tn(n,`TestPingServer: timeout`,!1,t)},1e4);fetch(e,{signal:r.signal}).then(e=>{clearTimeout(i),e.ok?tn(n,`TestPingServer: ok`,!0,t):tn(n,`TestPingServer: server error`,!1,t)}).catch(()=>{clearTimeout(i),tn(n,`TestPingServer: error`,!1,t)})}function tn(e,t,n,r,i){try{i&&(i.onload=null,i.onerror=null,i.onabort=null,i.ontimeout=null),r(n)}catch{}}function nn(){this.g=new Pe}function rn(e){this.i=e.Sb||null,this.h=e.ab||!1}d(rn,Fe),rn.prototype.g=function(){return new an(this.i,this.h)};function an(e,t){Ce.call(this),this.H=e,this.o=t,this.m=void 0,this.status=this.readyState=0,this.responseType=this.responseText=this.response=this.statusText=``,this.onreadystatechange=null,this.A=new Headers,this.h=null,this.F=`GET`,this.D=``,this.g=!1,this.B=this.j=this.l=null,this.v=new AbortController}d(an,Ce),e=an.prototype,e.open=function(e,t){if(this.readyState!=0)throw this.abort(),Error(`Error reopening a connection`);this.F=e,this.D=t,this.readyState=1,cn(this)},e.send=function(e){if(this.readyState!=1)throw this.abort(),Error(`need to call open() first. `);if(this.v.signal.aborted)throw this.abort(),Error(`Request was aborted.`);this.g=!0;let t={headers:this.A,method:this.F,credentials:this.m,cache:void 0,signal:this.v.signal};e&&(t.body=e),(this.H||o).fetch(new Request(this.D,t)).then(this.Pa.bind(this),this.ga.bind(this))},e.abort=function(){this.response=this.responseText=``,this.A=new Headers,this.status=0,this.v.abort(),this.j&&this.j.cancel(`Request was aborted.`).catch(()=>{}),this.readyState>=1&&this.g&&this.readyState!=4&&(this.g=!1,sn(this)),this.readyState=0},e.Pa=function(e){if(this.g&&(this.l=e,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=e.headers,this.readyState=2,cn(this)),this.g&&(this.readyState=3,cn(this),this.g)))if(this.responseType===`arraybuffer`)e.arrayBuffer().then(this.Na.bind(this),this.ga.bind(this));else if(o.ReadableStream!==void 0&&`body`in e){if(this.j=e.body.getReader(),this.o){if(this.responseType)throw Error(`responseType must be empty for "streamBinaryChunks" mode responses.`);this.response=[]}else this.response=this.responseText=``,this.B=new TextDecoder;on(this)}else e.text().then(this.Oa.bind(this),this.ga.bind(this))};function on(e){e.j.read().then(e.Ma.bind(e)).catch(e.ga.bind(e))}e.Ma=function(e){if(this.g){if(this.o&&e.value)this.response.push(e.value);else if(!this.o){var t=e.value?e.value:new Uint8Array;(t=this.B.decode(t,{stream:!e.done}))&&(this.response=this.responseText+=t)}e.done?sn(this):cn(this),this.readyState==3&&on(this)}},e.Oa=function(e){this.g&&(this.response=this.responseText=e,sn(this))},e.Na=function(e){this.g&&(this.response=e,sn(this))},e.ga=function(){this.g&&sn(this)};function sn(e){e.readyState=4,e.l=null,e.j=null,e.B=null,cn(e)}e.setRequestHeader=function(e,t){this.A.append(e,t)},e.getResponseHeader=function(e){return this.h&&this.h.get(e.toLowerCase())||``},e.getAllResponseHeaders=function(){if(!this.h)return``;let e=[],t=this.h.entries();for(var n=t.next();!n.done;)n=n.value,e.push(n[0]+`: `+n[1]),n=t.next();return e.join(`\r
762`)};function cn(e){e.onreadystatechange&&e.onreadystatechange.call(e)}Object.defineProperty(an.prototype,"withCredentials",{get:function(){return this.m===`include`},set:function(e){this.m=e?`include`:`same-origin`}});function ln(e){let t=``;return ie(e,function(e,n){t+=n,t+=`:`,t+=e,t+=`\r
763`}),t}
763function un(e,t,n){a:{for(r in n){var r=!1;break a}r=!0}r||(n=ln(n),typeof e==`string`||Pt(e,t,n))}function dn(e){Ce.call(this),this.headers=new Map,this.L=e||null,this.h=!1,this.g=null,this.D=``,this.o=0,this.l=``,this.j=this.B=this.v=this.A=!1,this.m=null,this.F=``,this.H=!1}d(dn,Ce);var fn=/^https?$/i,pn=[`POST`,`PUT`];e=dn.prototype,e.Fa=function(e){this.H=e},e.ea=function(e,t,n,r){if(this.g)throw Error(`[goog.net.XhrIo] Object is active with another request=`+this.D+`; newUri=`+e);t=t?t.toUpperCase():`GET`,this.D=e,this.l=``,this.o=0,this.A=!1,this.h=!0,this.g=this.L?this.L.g():tt.g(),this.g.onreadystatechange=f(l(this.Ca,this));try{this.B=!0,this.g.open(t,String(e),!0),this.B=!1}catch(e){mn(this,e);return}if(e=n||``,n=new Map(this.headers),r)if(Object.getPrototypeOf(r)===Object.prototype)for(var i in r)n.set(i,r[i]);else if(typeof r.keys==`function`&&typeof r.get==`function`)for(let e of r.keys())n.set(e,r.get(e));else throw Error(`Unknown input type for opt_headers: `+String(r));r=Array.from(n.keys()).find(e=>e.toLowerCase()==`content-type`),i=o.FormData&&e instanceof o.FormData,!(Array.prototype.indexOf.call(pn,t,void 0)>=0)||r||i||n.set(`Content-Type`,`application/x-www-form-urlencoded;charset=utf-8`);for(let[e,t]of n)this.g.setRequestHeader(e,t);this.F&&(this.g.responseType=this.F),`withCredentials`in this.g&&this.g.withCredentials!==this.H&&(this.g.withCredentials=this.H);try{this.m&&=(clearTimeout(this.m),null),this.v=!0,this.g.send(e),this.v=!1}catch(e){mn(this,e)}};function mn(e,t){e.h=!1,e.g&&(e.j=!0,e.g.abort(),e.j=!1),e.l=t,e.o=5,hn(e),_n(e)}function hn(e){e.A||(e.A=!0,we(e,`complete`),we(e,`error`))}e.abort=function(e){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.o=e||7,we(this,`complete`),we(this,`abort`),_n(this))},e.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),_n(this,!0)),dn.Z.N.call(this)},e.Ca=function(){this.u||(this.B||this.v||this.j?gn(this):this.Xa())},e.Xa=function(){gn(this)};function gn(e){if(e.h&&a!==void 0){if(e.v&&vn(e)==4)setTimeout(e.Ca.bind(e),0);else if(we(e,`readystatechange`),vn(e)==4){e.h=!1;try{let a=e.ca();a:switch(a){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var t=!0;break a;default:t=!1}var n;if(!(n=t)){var r;if(r=a===0){let t=String(e.D).match(Dt)[1]||null;!t&&o.self&&o.self.location&&(t=o.self.location.protocol.slice(0,-1)),r=!fn.test(t?t.toLowerCase():``)}n=r}if(n)we(e,`complete`),we(e,`success`);else{e.o=6;try{var i=vn(e)>2?e.g.statusText:``}catch{i=``}e.l=i+` [`+e.ca()+`]`,hn(e)}}finally{_n(e)}}}}function _n(e,t){if(e.g){e.m&&=(clearTimeout(e.m),null);let n=e.g;e.g=null,t||we(e,`ready`);try{n.onreadystatechange=null}catch{}}}e.isActive=function(){return!!this.g};function vn(e){return e.g?e.g.readyState:0}e.ca=function(){try{return vn(this)>2?this.g.status:-1}catch{return-1}},e.la=function(){try{return this.g?this.g.responseText:``}catch{return``}},e.La=function(e){if(this.g){var t=this.g.responseText;return e&&t.indexOf(e)==0&&(t=t.substring(e.length)),Ne(t)}};function yn(e){try{if(!e.g)return null;if(`response`in e.g)return e.g.response;switch(e.F){case``:case`text`:return e.g.responseText;case`arraybuffer`:if(`mozResponseArrayBuffer`in e.g)return e.g.mozResponseArrayBuffer}return null}catch{return null}}function bn(e){let t={};e=(e.g&&vn(e)>=2&&e.g.getAllResponseHeaders()||``).split(`\r
764`);for(let r=0;r<e.length;r++){if(k(e[r]))continue;var n=rt(e[r]);let i=n[0];if(n=n[1],typeof n!=`string`)continue;n=n.trim();let a=t[i]||[];t[i]=a,a.push(n)}j(t,function(e){return e.join(`, `)})}e.ya=function(){return this.o},e.Ha=function(){return typeof this.l==`string`?this.l:String(this.l)};function xn(e,t,n){return n&&n.internalChannelParams&&n.internalChannelParams[e]||t}function Sn(e){this.za=0,this.i=[],this.j=new Je,this.ba=this.na=this.J=this.W=this.g=this.wa=this.G=this.H=this.u=this.U=this.o=null,this.Ya=this.V=0,this.Sa=xn(`failFast`,!1,e),this.F=this.C=this.v=this.m=this.l=null,this.X=!0,this.xa=this.K=-1,this.Y=this.A=this.D=0,this.Qa=xn(`baseRetryDelayMs`,5e3,e),this.Za=xn(`retryDelaySeedMs`,1e4,e),this.Ta=xn(`forwardChannelMaxRetries`,2,e),this.va=xn(`forwardChannelRequestTimeoutMs`,2e4,e),this.ma=e&&e.xmlHttpFactory||void 0,this.Ua=e&&e.Rb||void 0,this.Aa=e&&e.useFetchStreams||!1,this.O=void 0,this.L=e&&e.supportsCrossDomainXhr||!1,this.M=``,this.h=new bt(e&&e.concurrentRequestLimit),this.Ba=new nn,this.S=e&&e.fastHandshake||!1,this.R=e&&e.encodeInitMessageHeaders||!1,this.S&&this.R&&(this.R=!1),this.Ra=e&&e.Pb||!1,e&&e.ua&&this.j.ua(),e&&e.forceLongPolling&&(this.X=!1),this.aa=!this.S&&this.X&&e&&e.detectBufferingProxy||!1,this.ia=void 0,e&&e.longPollingTimeout&&e.longPollingTimeout>0&&(this.ia=e.longPollingTimeout),this.ta=void 0,this.T=0,this.P=!1,this.ja=this.B=null}e=Sn.prototype,e.ka=8,e.I=1,e.connect=function(e,t,n,r){Ge(0),this.W=e,this.H=t||{},n&&r!==void 0&&(this.H.OSID=n,this.H.OAID=r),this.F=this.X,this.J=Bn(this,null,this.W),En(this)};function Cn(e){if(Tn(e),e.I==3){var t=e.V++,n=At(e.J);if(Pt(n,`SID`,e.M),Pt(n,`RID`,t),Pt(n,`TYPE`,`terminate`),kn(e,n),t=new it(e,e.j,t),t.M=2,t.A=Ft(At(n)),n=!1,o.navigator&&o.navigator.sendBeacon)try{n=o.navigator.sendBeacon(t.A.toString(),``)}catch{}!n&&o.Image&&(new Image().src=t.A,n=!0),n||(t.g=Vn(t.j,null),t.g.ea(t.A)),t.F=Date.now(),pt(t)}zn(e)}function wn(e){e.g&&=(Nn(e),e.g.cancel(),null)}function Tn(e){wn(e),e.v&&=(o.clearTimeout(e.v),null),Fn(e),e.h.cancel(),e.m&&=(typeof e.m==`number`&&o.clearTimeout(e.m),null)}function En(e){if(!xt(e.h)&&!e.m){e.m=!0;var t=e.Ea;x||w(),S||=(x(),!0),C.add(t,e),e.D=0}}function Dn(e,t){return St(e.h)>=e.h.j-+!!e.m?!1:e.m?(e.i=t.G.concat(e.i),!0):e.I==1||e.I==2||e.D>=(e.Sa?0:e.Ta)?!1:(e.m=qe(l(e.Ea,e,t),Ln(e,e.D)),e.D++,!0)}e.Ea=function(e){if(this.m)if(this.m=null,this.I==1){if(!e){this.V=Math.floor(Math.random()*1e5),e=this.V++;let i=new it(this,this.j,e),a=this.o;if(this.U&&(a?(a=M(a),oe(a,this.U)):a=this.U),this.u!==null||this.R||(i.J=a,a=null),this.S)a:{for(var t=0,n=0;n<this.i.length;n++){b:{var r=this.i[n];if(`__data__`in r.map&&(r=r.map.__data__,typeof r==`string`)){r=r.length;break b}r=void 0}if(r===void 0)break;if(t+=r,t>4096){t=n;break a}if(t===4096||n===this.i.length-1){t=n+1;break a}}t=1e3}else t=1e3;t=An(this,i,t),n=At(this.J),Pt(n,`RID`,e),Pt(n,`CVER`,22),this.G&&Pt(n,`X-HTTP-Session-Id`,this.G),kn(this,n),a&&(this.R?t=`headers=`+nt(ln(a))+`&`+t:this.u&&un(n,this.u,a)),wt(this.h,i),this.Ra&&Pt(n,`TYPE`,`init`),this.S?(Pt(n,`$req`,t),Pt(n,`SID`,`null`),i.U=!0,ct(i,n,null)):ct(i,n,t),this.I=2}}else this.I==3&&(e?On(this,e):this.i.length==0||xt(this.h)||On(this))};function On(e,t){var n=t?t.l:e.V++;let r=At(e.J);Pt(r,`SID`,e.M),Pt(r,`RID`,n),Pt(r,`AID`,e.K),kn(e,r),e.u&&e.o&&un(r,e.u,e.o),n=new it(e,e.j,n,e.D+1),e.u===null&&(n.J=e.o),t&&(e.i=t.G.concat(e.i)),t=An(e,n,1e3),n.H=Math.round(e.va*.5)+Math.round(e.va*.5*Math.random()),wt(e.h,n),ct(n,r,t)}function kn(e,t){e.H&&ie(e.H,function(e,n){Pt(t,n,e)}),e.l&&ie({},function(e,n){Pt(t,n,e)})}
764function An(e,t,n){n=Math.min(e.i.length,n);let r=e.l?l(e.l.Ka,e.l,e):null;a:{var i=e.i;let t=-1;for(;;){let e=[`count=`+n];t==-1?n>0?(t=i[0].g,e.push(`ofs=`+t)):t=0:e.push(`ofs=`+t);let c=!0;for(let l=0;l<n;l++){var a=i[l].g;let n=i[l].map;if(a-=t,a<0)t=Math.max(0,i[l].g-100),c=!1;else try{a=`req`+a+`_`||``;try{var o=n instanceof Map?n:Object.entries(n);for(let[t,n]of o){let r=n;s(n)&&(r=Me(n)),e.push(a+t+`=`+encodeURIComponent(r))}}catch(t){throw e.push(a+`type=_badmap`),t}}catch{r&&r(n)}}if(c){o=e.join(`&`);break a}}o=void 0}return e=e.i.splice(0,n),t.G=e,o}function jn(e){if(!e.g&&!e.v){e.Y=1;var t=e.Da;x||w(),S||=(x(),!0),C.add(t,e),e.A=0}}function Mn(e){return e.g||e.v||e.A>=3?!1:(e.Y++,e.v=qe(l(e.Da,e),Ln(e,e.A)),e.A++,!0)}e.Da=function(){if(this.v=null,Pn(this),this.aa&&!(this.P||this.g==null||this.T<=0)){var e=4*this.T;this.j.info(`BP detection timer enabled: `+e),this.B=qe(l(this.Wa,this),e)}},e.Wa=function(){this.B&&(this.B=null,this.j.info(`BP detection timeout reached.`),this.j.info(`Buffering proxy detected and switch to long-polling!`),this.F=!1,this.P=!0,Ge(10),wn(this),Pn(this))};function Nn(e){e.B!=null&&(o.clearTimeout(e.B),e.B=null)}function Pn(e){e.g=new it(e,e.j,`rpc`,e.Y),e.u===null&&(e.g.J=e.o),e.g.P=0;var t=At(e.na);Pt(t,`RID`,`rpc`),Pt(t,`SID`,e.M),Pt(t,`AID`,e.K),Pt(t,`CI`,e.F?`0`:`1`),!e.F&&e.ia&&Pt(t,`TO`,e.ia),Pt(t,`TYPE`,`xmlhttp`),kn(e,t),e.u&&e.o&&un(t,e.u,e.o),e.O&&(e.g.H=e.O);var n=e.g;e=e.ba,n.M=1,n.A=Ft(At(t)),n.u=null,n.R=!0,lt(n,e)}e.Va=function(){this.C!=null&&(this.C=null,wn(this),Mn(this),Ge(19))};function Fn(e){e.C!=null&&(o.clearTimeout(e.C),e.C=null)}function In(e,t){var n=null;if(e.g==t){Fn(e),Nn(e),e.g=null;var r=2}else if(Ct(e.h,t))n=t.G,Tt(e.h,t),r=1;else return;if(e.I!=0){if(t.o)if(r==1){n=t.u?t.u.length:0,t=Date.now()-t.F;var i=e.D;r=Ve(),we(r,new Ke(r,n)),En(e)}else jn(e);else if(i=t.m,i==3||i==0&&t.X>0||!(r==1&&Dn(e,t)||r==2&&Mn(e)))switch(n&&n.length>0&&(t=e.h,t.i=t.i.concat(n)),i){case 1:Rn(e,5);break;case 4:Rn(e,10);break;case 3:Rn(e,6);break;default:Rn(e,2)}}}function Ln(e,t){let n=e.Qa+Math.floor(Math.random()*e.Za);return e.isActive()||(n*=2),n*t}function Rn(e,t){if(e.j.info(`Error code `+t),t==2){var n=l(e.bb,e),r=e.Ua;let t=!r;r=new kt(r||`//www.google.com/images/cleardot.gif`),o.location&&o.location.protocol==`http`||jt(r,`https`),Ft(r),t?$t(r.toString(),n):en(r.toString(),n)}else Ge(2);e.I=0,e.l&&e.l.pa(t),zn(e),Tn(e)}e.bb=function(e){e?(this.j.info(`Successfully pinged google.com`),Ge(2)):(this.j.info(`Failed to ping google.com`),Ge(1))};function zn(e){if(e.I=0,e.ja=[],e.l){let t=Et(e.h);(t.length!=0||e.i.length!=0)&&(m(e.ja,t),m(e.ja,e.i),e.h.i.length=0,p(e.i),e.i.length=0),e.l.oa()}}function Bn(e,t,n){var r=n instanceof kt?At(n):new kt(n);if(r.g!=``)t&&(r.g=t+`.`+r.g),Mt(r,r.u);else{var i=o.location;r=i.protocol,t=t?t+`.`+i.hostname:i.hostname,i=+i.port;let e=new kt(null);r&&jt(e,r),t&&(e.g=t),i&&Mt(e,i),n&&(e.h=n),r=e}return n=e.G,t=e.wa,n&&t&&Pt(r,n,t),Pt(r,`VER`,e.ka),kn(e,r),r}function Vn(e,t,n){if(t&&!e.L)throw Error(`Can't create secondary domain capable XhrIo object.`);return t=e.Aa&&!e.ma?new dn(new rn({ab:n})):new dn(e.ma),t.Fa(e.L),t}e.isActive=function(){return!!this.l&&this.l.isActive(this)};function Hn(){}e=Hn.prototype,e.ra=function(){},e.qa=function(){},e.pa=function(){},e.oa=function(){},e.isActive=function(){return!0},e.Ka=function(){};function Un(){}Un.prototype.g=function(e,t){return new Wn(e,t)};function Wn(e,t){Ce.call(this),this.g=new Sn(t),this.l=e,this.h=t&&t.messageUrlParams||null,e=t&&t.messageHeaders||null,t&&t.clientProtocolHeaderRequired&&(e?e[`X-Client-Protocol`]=`webchannel`:e={"X-Client-Protocol":`webchannel`}),this.g.o=e,e=t&&t.initMessageHeaders||null,t&&t.messageContentType&&(e?e[`X-WebChannel-Content-Type`]=t.messageContentType:e={"X-WebChannel-Content-Type":t.messageContentType}),t&&t.sa&&(e?e[`X-WebChannel-Client-Profile`]=t.sa:e={"X-WebChannel-Client-Profile":t.sa}),this.g.U=e,(e=t&&t.Qb)&&!k(e)&&(this.g.u=e),this.A=t&&t.supportsCrossDomainXhr||!1,this.v=t&&t.sendRawJson||!1,(t&&=t.httpSessionIdParam)&&!k(t)&&(this.g.G=t,e=this.h,e!==null&&t in e&&(e=this.h,t in e&&delete e[t])),this.j=new qn(this)}d(Wn,Ce),Wn.prototype.m=function(){this.g.l=this.j,this.A&&(this.g.L=!0),this.g.connect(this.l,this.h||void 0)},Wn.prototype.close=function(){Cn(this.g)},Wn.prototype.o=function(e){var t=this.g;if(typeof e==`string`){var n={};n.__data__=e,e=n}else this.v&&(n={},n.__data__=Me(e),e=n);t.i.push(new yt(t.Ya++,e)),t.I==3&&En(t)},Wn.prototype.N=function(){this.g.l=null,delete this.j,Cn(this.g),delete this.g,Wn.Z.N.call(this)};function Gn(e){Re.call(this),e.__headers__&&(this.headers=e.__headers__,this.statusCode=e.__status__,delete e.__headers__,delete e.__status__);var t=e.__sm__;if(t){a:{for(let n in t){e=n;break a}e=void 0}(this.i=e)&&(e=this.i,t=t!==null&&e in t?t[e]:void 0),this.data=t}else this.data=e}d(Gn,Re);function Kn(){ze.call(this),this.status=1}d(Kn,ze);function qn(e){this.g=e}d(qn,Hn),qn.prototype.ra=function(){we(this.g,`a`)},qn.prototype.qa=function(e){we(this.g,new Gn(e))},qn.prototype.pa=function(e){we(this.g,new Kn)},qn.prototype.oa=function(){we(this.g,`b`)},Un.prototype.createWebChannel=Un.prototype.g,Wn.prototype.send=Wn.prototype.o,Wn.prototype.open=Wn.prototype.m,Wn.prototype.close=Wn.prototype.close,gr=cr.createWebChannelTransport=function(){return new Un},hr=cr.getStatEventTarget=function(){return Ve()},mr=cr.Event=Be,pr=cr.Stat={jb:0,mb:1,nb:2,Hb:3,Mb:4,Jb:5,Kb:6,Ib:7,Gb:8,Lb:9,PROXY:10,NOPROXY:11,Eb:12,Ab:13,Bb:14,zb:15,Cb:16,Db:17,fb:18,eb:19,gb:20},$e.NO_ERROR=0,$e.TIMEOUT=8,$e.HTTP_ERROR=6,fr=cr.ErrorCode=$e,et.COMPLETE=`complete`,dr=cr.EventType=et,Ie.EventType=Le,Le.OPEN=`a`,Le.CLOSE=`b`,Le.ERROR=`c`,Le.MESSAGE=`d`,Ce.prototype.listen=Ce.prototype.J,ur=cr.WebChannel=Ie,cr.FetchXmlHttpFactory=rn,dn.prototype.listenOnce=dn.prototype.K,dn.prototype.getLastError=dn.prototype.Ha,dn.prototype.getLastErrorCode=dn.prototype.ya,dn.prototype.getStatus=dn.prototype.ca,dn.prototype.getResponseJson=dn.prototype.La,dn.prototype.getResponseText=dn.prototype.la,dn.prototype.send=dn.prototype.ea,dn.prototype.setWithCredentials=dn.prototype.Fa,lr=cr.XhrIo=dn}).apply(sr===void 0?typeof self<`u`?self:typeof window<`u`?window:{}:sr);var I=class e{static FOLD_CASE=1;static LITERAL=2;static CLASS_NL=4;static DOT_NL=8;static ONE_LINE=16;static NON_GREEDY=32;static PERL_X=64;static UNICODE_GROUPS=128;static WAS_DOLLAR=256;static MATCH_NL=e.CLASS_NL|e.DOT_NL;static PERL=e.CLASS_NL|e.ONE_LINE|e.PERL_X|e.UNICODE_GROUPS;static POSIX=0;static UNANCHORED=0;static ANCHOR_START=1;static ANCHOR_BOTH=2},L=class{static CODES=new Map([[`\x07`,7],[`\b`,8],[`	`,9],[`
765`,10],[`\v`,11],[`\f`,12],[`\r`,13],[` `,32],[`"`,34],[`$`,36],[`&`,38],[`(`,40],[`)`,41],[`*`,42],[`+`,43],[`-`,45],[`.`,46],[`0`,48],[`1`,49],[`2`,50],[`3`,51],[`4`,52],[`5`,53],[`6`,54],[`7`,55],[`8`,56],[`9`,57],[`:`,58],[`<`,60],[`>`,62],[`?`,63],[`A`,65],[`B`,66],[`C`,67],[`F`,70],[`P`,80],[`Q`,81],[`U`,85],[`Z`,90],[`[`,91],[`\\`,92],[`]`,93],[`^`,94],[`_`,95],[`a`,97],[`b`,98],[`f`,102],[`i`,105],[`m`,109],[`n`,110],[`r`,114],[`s`,115],[`t`,116],[`v`,118],[`x`,120],[`z`,122],[`{`,123],[`|`,124],[`}`,125]]);static toUpperCase(e){let t=String.fromCodePoint(e).toUpperCase();if(t.length>1)return e;let n=String.fromCodePoint(t.codePointAt(0)).toLowerCase();return n.length>1||n.codePointAt(0)!==e?e:t.codePointAt(0)}static toLowerCase(e){let t=String.fromCodePoint(e).toLowerCase();if(t.length>1)return e;let n=String.fromCodePoint(t.codePointAt(0)).toUpperCase();return n.length>1||n.codePointAt(0)!==e?e:t.codePointAt(0)}},_r=class e{static CASE_ORBIT=new Map([[75,107],[107,8490],[8490,75],[83,115],[115,383],[383,83],[181,924],[924,956],[956,181],[197,229],[229,8491],[8491,197],[452,453],[453,454],[454,452],[455,456],[456,457],[457,455],[458,459],[459,460],[460,458],[497,498],[498,499],[499,497],[837,921],[921,953],[953,8126],[8126,837],[914,946],[946,976],[976,914],[917,949],[949,1013],[1013,917],[920,952],[952,977],[977,1012],[1012,920],[922,954],[954,1008],[1008,922],[928,960],[960,982],[982,928],[929,961],[961,1009],[1009,929],[931,962],[962,963],[963,931],[934,966],[966,981],[981,934],[937,969],[969,8486],[8486,937],[1042,1074],[1074,7296],[7296,1042],[1044,1076],[1076,7297],[7297,1044],[1054,1086],[1086,7298],[7298,1054],[1057,1089],[1089,7299],[7299,1057],[1058,1090],[1090,7300],[7300,7301],[7301,1058],[1066,1098],[1098,7302],[7302,1066],[1122,1123],[1123,7303],[7303,1122],[7304,42570],[42570,42571],[42571,7304],[7776,7777],[7777,7835],[7835,7776],[223,7838],[7838,223],[8064,8072],[8072,8064],[8065,8073],[8073,8065],[8066,8074],[8074,8066],[8067,8075],[8075,8067],[8068,8076],[8076,8068],[8069,8077],[8077,8069],[8070,8078],[8078,8070],[8071,8079],[8079,8071],[8080,8088],[8088,8080],[8081,8089],[8089,8081],[8082,8090],[8090,8082],[8083,8091],[8091,8083],[8084,8092],[8092,8084],[8085,8093],[8093,8085],[8086,8094],[8094,8086],[8087,8095],[8095,8087],[8096,8104],[8104,8096],[8097,8105],[8105,8097],[8098,8106],[8106,8098],[8099,8107],[8107,8099],[8100,8108],[8108,8100],[8101,8109],[8109,8101],[8102,8110],[8110,8102],[8103,8111],[8111,8103],[8115,8124],[8124,8115],[8131,8140],[8140,8131],[912,8147],[8147,912],[944,8163],[8163,944],[8179,8188],[8188,8179],[64261,64262],[64262,64261],[66560,66600],[66600,66560],[66561,66601],[66601,66561],[66562,66602],[66602,66562],[66563,66603],[66603,66563],[66564,66604],[66604,66564],[66565,66605],[66605,66565],[66566,66606],[66606,66566],[66567,66607],[66607,66567],[66568,66608],[66608,66568],[66569,66609],[66609,66569],[66570,66610],[66610,66570],[66571,66611],[66611,66571],[66572,66612],[66612,66572],[66573,66613],[66613,66573],[66574,66614],[66614,66574],[66575,66615],[66615,66575],[66576,66616],[66616,66576],[66577,66617],[66617,66577],[66578,66618],[66618,66578],[66579,66619],[66619,66579],[66580,66620],[66620,66580],[66581,66621],[66621,66581],[66582,66622],[66622,66582],[66583,66623],[66623,66583],[66584,66624],[66624,66584],[66585,66625],[66625,66585],[66586,66626],[66626,66586],[66587,66627],[66627,66587],[66588,66628],[66628,66588],[66589,66629],[66629,66589],[66590,66630],[66630,66590],[66591,66631],[66631,66591],[66592,66632],[66632,66592],[66593,66633],[66633,66593],[66594,66634],[66634,66594],[66595,66635],[66635,66595],[66596,66636],[66636,66596],[66597,66637],[66637,66597],[66598,66638],[66638,66598],[66599,66639],[66639,66599],[66736,66776],[66776,66736],[66737,66777],[66777,66737],[66738,66778],[66778,66738],[66739,66779],[66779,66739],[66740,66780],[66780,66740],[66741,66781],[66781,66741],[66742,66782],[66782,66742],[66743,66783],[66783,66743],[66744,66784],[66784,66744],[66745,66785],[66785,66745],[66746,66786],[66786,66746],[66747,66787],[66787,66747],[66748,66788],[66788,66748],[66749,66789],[66789,66749],[66750,66790],[66790,66750],[66751,66791],[66791,66751],[66752,66792],[66792,66752],[66753,66793],[66793,66753],[66754,66794],[66794,66754],[66755,66795],[66795,66
765755],[66756,66796],[66796,66756],[66757,66797],[66797,66757],[66758,66798],[66798,66758],[66759,66799],[66799,66759],[66760,66800],[66800,66760],[66761,66801],[66801,66761],[66762,66802],[66802,66762],[66763,66803],[66803,66763],[66764,66804],[66804,66764],[66765,66805],[66805,66765],[66766,66806],[66806,66766],[66767,66807],[66807,66767],[66768,66808],[66808,66768],[66769,66809],[66809,66769],[66770,66810],[66810,66770],[66771,66811],[66811,66771],[66928,66967],[66967,66928],[66929,66968],[66968,66929],[66930,66969],[66969,66930],[66931,66970],[66970,66931],[66932,66971],[66971,66932],[66933,66972],[66972,66933],[66934,66973],[66973,66934],[66935,66974],[66974,66935],[66936,66975],[66975,66936],[66937,66976],[66976,66937],[66938,66977],[66977,66938],[66940,66979],[66979,66940],[66941,66980],[66980,66941],[66942,66981],[66981,66942],[66943,66982],[66982,66943],[66944,66983],[66983,66944],[66945,66984],[66984,66945],[66946,66985],[66985,66946],[66947,66986],[66986,66947],[66948,66987],[66987,66948],[66949,66988],[66988,66949],[66950,66989],[66989,66950],[66951,66990],[66990,66951],[66952,66991],[66991,66952],[66953,66992],[66992,66953],[66954,66993],[66993,66954],[66956,66995],[66995,66956],[66957,66996],[66996,66957],[66958,66997],[66997,66958],[66959,66998],[66998,66959],[66960,66999],[66999,66960],[66961,67e3],[67e3,66961],[66962,67001],[67001,66962],[66964,67003],[67003,66964],[66965,67004],[67004,66965],[68736,68800],[68800,68736],[68737,68801],[68801,68737],[68738,68802],[68802,68738],[68739,68803],[68803,68739],[68740,68804],[68804,68740],[68741,68805],[68805,68741],[68742,68806],[68806,68742],[68743,68807],[68807,68743],[68744,68808],[68808,68744],[68745,68809],[68809,68745],[68746,68810],[68810,68746],[68747,68811],[68811,68747],[68748,68812],[68812,68748],[68749,68813],[68813,68749],[68750,68814],[68814,68750],[68751,68815],[68815,68751],[68752,68816],[68816,68752],[68753,68817],[68817,68753],[68754,68818],[68818,68754],[68755,68819],[68819,68755],[68756,68820],[68820,68756],[68757,68821],[68821,68757],[68758,68822],[68822,68758],[68759,68823],[68823,68759],[68760,68824],[68824,68760],[68761,68825],[68825,68761],[68762,68826],[68826,68762],[68763,68827],[68827,68763],[68764,68828],[68828,68764],[68765,68829],[68829,68765],[68766,68830],[68830,68766],[68767,68831],[68831,68767],[68768,68832],[68832,68768],[68769,68833],[68833,68769],[68770,68834],[68834,68770],[68771,68835],[68835,68771],[68772,68836],[68836,68772],[68773,68837],[68837,68773],[68774,68838],[68838,68774],[68775,68839],[68839,68775],[68776,68840],[68840,68776],[68777,68841],[68841,68777],[68778,68842],[68842,68778],[68779,68843],[68843,68779],[68780,68844],[68844,68780],[68781,68845],[68845,68781],[68782,68846],[68846,68782],[68783,68847],[68847,68783],[68784,68848],[68848,68784],[68785,68849],[68849,68785],[68786,68850],[68850,68786],[71840,71872],[71872,71840],[71841,71873],[71873,71841],[71842,71874],[71874,71842],[71843,71875],[71875,71843],[71844,71876],[71876,71844],[71845,71877],[71877,71845],[71846,71878],[71878,71846],[71847,71879],[71879,71847],[71848,71880],[71880,71848],[71849,71881],[71881,71849],[71850,71882],[71882,71850],[71851,71883],[71883,71851],[71852,71884],[71884,71852],[71853,71885],[71885,71853],[71854,71886],[71886,71854],[71855,71887],[71887,71855],[71856,71888],[71888,71856],[71857,71889],[71889,71857],[71858,71890],[71890,71858],[71859,71891],[71891,71859],[71860,71892],[71892,71860],[71861,71893],[71893,71861],[71862,71894],[71894,71862],[71863,71895],[71895,71863],[71864,71896],[71896,71864],[71865,71897],[71897,71865],[71866,71898],[71898,71866],[71867,71899],[71899,71867],[71868,71900],[71900,71868],[71869,71901],[71901,71869],[71870,71902],[71902,71870],[71871,71903],[71903,71871],[93760,93792],[93792,93760],[93761,93793],[93793,93761],[93762,93794],[93794,93762],[93763,93795],[93795,93763],[93764,93796],[93796,93764],[93765,93797],[93797,93765],[93766,93798],[93798,93766],[93767,93799],[93799,93767],[93768,93800],[93800,93768],[93769,93801],[93801,93769],[93770,93802],[93802,93770],[93771,93803],[93803,93771],[93772,93804],[93804,93772],[93773,93805],[93805,93773],[93774,93806],[93806,93774],[93775,93807],[93807,93775],[93776,93808],[93808,93776],[937
76577,93809],[93809,93777],[93778,93810],[93810,93778],[93779,93811],[93811,93779],[93780,93812],[93812,93780],[93781,93813],[93813,93781],[93782,93814],[93814,93782],[93783,93815],[93815,93783],[93784,93816],[93816,93784],[93785,93817],[93817,93785],[93786,93818],[93818,93786],[93787,93819],[93819,93787],[93788,93820],[93820,93788],[93789,93821],[93821,93789],[93790,93822],[93822,93790],[93791,93823],[93823,93791],[125184,125218],[125218,125184],[125185,125219],[125219,125185],[125186,125220],[125220,125186],[125187,125221],[125221,125187],[125188,125222],[125222,125188],[125189,125223],[125223,125189],[125190,125224],[125224,125190],[125191,125225],[125225,125191],[125192,125226],[125226,125192],[125193,125227],[125227,125193],[125194,125228],[125228,125194],[125195,125229],[125229,125195],[125196,125230],[125230,125196],[125197,125231],[125231,125197],[125198,125232],[125232,125198],[125199,125233],[125233,125199],[125200,125234],[125234,125200],[125201,125235],[125235,125201],[125202,125236],[125236,125202],[125203,125237],[125237,125203],[125204,125238],[125238,125204],[125205,125239],[125239,125205],[125206,125240],[125240,125206],[125207,125241],[125241,125207],[125208,125242],[125242,125208],[125209,125243],[125243,125209],[125210,125244],[125244,125210],[125211,125245],[125245,125211],[125212,125246],[125246,125212],[125213,125247],[125247,125213],[125214,125248],[125248,125214],[125215,125249],[125249,125215],[125216,125250],[125250,125216],[125217,125251],[125251,125217]]);static C=[[0,31,1],[127,159,1],[173,888,715],[889,896,7],[897,899,1],[907,909,2],[930,1328,398],[1367,1368,1],[1419,1420,1],[1424,1480,56],[1481,1487,1],[1515,1518,1],[1525,1541,1],[1564,1757,193],[1806,1807,1],[1867,1868,1],[1970,1983,1],[2043,2044,1],[2094,2095,1],[2111,2140,29],[2141,2143,2],[2155,2159,1],[2191,2199,1],[2274,2436,162],[2445,2446,1],[2449,2450,1],[2473,2481,8],[2483,2485,1],[2490,2491,1],[2501,2502,1],[2505,2506,1],[2511,2518,1],[2520,2523,1],[2526,2532,6],[2533,2559,26],[2560,2564,4],[2571,2574,1],[2577,2578,1],[2601,2609,8],[2612,2618,3],[2619,2621,2],[2627,2630,1],[2633,2634,1],[2638,2640,1],[2642,2648,1],[2653,2655,2],[2656,2661,1],[2679,2688,1],[2692,2702,10],[2706,2729,23],[2737,2740,3],[2746,2747,1],[2758,2766,4],[2767,2769,2],[2770,2783,1],[2788,2789,1],[2802,2808,1],[2816,2820,4],[2829,2830,1],[2833,2834,1],[2857,2865,8],[2868,2874,6],[2875,2885,10],[2886,2889,3],[2890,2894,4],[2895,2900,1],[2904,2907,1],[2910,2916,6],[2917,2936,19],[2937,2945,1],[2948,2955,7],[2956,2957,1],[2961,2966,5],[2967,2968,1],[2971,2973,2],[2976,2978,1],[2981,2983,1],[2987,2989,1],[3002,3005,1],[3011,3013,1],[3017,3022,5],[3023,3025,2],[3026,3030,1],[3032,3045,1],[3067,3071,1],[3085,3089,4],[3113,3130,17],[3131,3141,10],[3145,3150,5],[3151,3156,1],[3159,3163,4],[3164,3166,2],[3167,3172,5],[3173,3184,11],[3185,3190,1],[3213,3217,4],[3241,3252,11],[3258,3259,1],[3269,3273,4],[3278,3284,1],[3287,3292,1],[3295,3300,5],[3301,3312,11],[3316,3327,1],[3341,3345,4],[3397,3401,4],[3408,3411,1],[3428,3429,1],[3456,3460,4],[3479,3481,1],[3506,3516,10],[3518,3519,1],[3527,3529,1],[3531,3534,1],[3541,3543,2],[3552,3557,1],[3568,3569,1],[3573,3584,1],[3643,3646,1],[3676,3712,1],[3715,3717,2],[3723,3748,25],[3750,3774,24],[3775,3781,6],[3783,3791,8],[3802,3803,1],[3808,3839,1],[3912,3949,37],[3950,3952,1],[3992,4029,37],[4045,4059,14],[4060,4095,1],[4294,4296,2],[4297,4300,1],[4302,4303,1],[4681,4686,5],[4687,4695,8],[4697,4702,5],[4703,4745,42],[4750,4751,1],[4785,4790,5],[4791,4799,8],[4801,4806,5],[4807,4823,16],[4881,4886,5],[4887,4955,68],[4956,4989,33],[4990,4991,1],[5018,5023,1],[5110,5111,1],[5118,5119,1],[5789,5791,1],[5881,5887,1],[5910,5918,1],[5943,5951,1],[5972,5983,1],[5997,6001,4],[6004,6015,1],[6110,6111,1],[6122,6127,1],[6138,6143,1],[6158,6170,12],[6171,6175,1],[6265,6271,1],[6315,6319,1],[6390,6399,1],[6431,6444,13],[6445,6447,1],[6460,6463,1],[6465,6467,1],[6510,6511,1],[6517,6527,1],[6572,6575,1],[6602,6607,1],[6619,6621,1],[6684,6685,1],[6751,6781,30],[6782,6794,12],[6795,6799,1],[6810,6815,1],[6830,6831,1],[6863,6911,1],[6989,6991,1],[7039,7156,117],[7157,7163,1],[7224,7226,1],[7242,7244,1],[7305,7311,1],[7355,7356,1],[7368,7375,1],[7419,7423,1],[7958,7959,1],[7966,7967,1],[8006,8007,1],[8014,8015,1],[8024,8030,2],[8062,8063,1],[8117,8133,16],[8148,8149,1],[8156,8176,20],[8177,8181,4],[8191,8203,12],[8204,8207,1],[8234,8238,1],[8288,8303,1],[8306,8307,1],[8335,8349,14],[8350,8351,1],[8385,8399,1],[8433,8447,1],[8588,8591,1],[9255,9279,1],[9291,9311,1],[11124,11125,1],[11158,11508,350],[11509,11512,1],[11558,11560,2],[11561,11564,1],[11566,11567,1],[11624,11630,1],[11633,11646,1],[11671,11679,1],[11687,11743,8],[11870,11903,1],[11930,12020,90],[12021,12031,1],[12246,12271,1],[12352,12439,87],[12440,12544,104],[12545,12548,1],[12592,12687,95],[12772,12782,1],[12831,42125,29294],[42126,42127,1],[42183,42191,1],[42540,42559,1],[42744,42751,1],[42955,42959,1],[42962,42964,2],[42970,42993,1],[43053,43055,1],[43066,43071,1],[43128,43135,1],[43206,43213,1],[43226,43231,1],[43348,43358,1],[43389,43391,1],[43470,43482,12],[43483,43485,1],[43519,43575,56],[43576,43583,1],[43598,43599,1],[43610,43611,1],[43715,43738,1],[43767,43776,1],[43783,43784,1],[43791,43792,1],[43799,43807,1],[43815,43823,8],[43884,43887,1],[44014,44015,1],[44026,44031,1],[55204,55215,1],[55239,55242,1],[55292,63743,1],[64110,64111,1],[64218,64255,1],[64263,64274,1],[64280,64284,1],[64311,64317,6],[64319,64325,3],[64451,64466,1],[64912,64913,1],[64968,64974,1],[64976,65007,1],[65050,65055,1],[65107,65127,20],[65132,65135,1],[65141,65277,136],[65278,65280,1],[65471,65473,1],[65480,65481,1],[65488,65489,1],[65496,65497,1],[65501,65503,1],[65511,65519,8],[65520,65531,1],[65534,65535,1],[65548,65575,27],[65595,65598,3],[65614,65615,1],[65630,65663,1],[65787,65791,1],[65795,65798,1],[65844,65846,1],[65935,65949,14],[65950,65951,1],[65953,65999,1],[66046,66175,1],[66205,66207,1],[66257,66271,1],[66300,66303,1],[66340,66348,1],[66379,66383,1],[66427,66431,1],[66462,66500,38],[66501,66503,1],[66518,66559,1],[66718,66719,1],[66730,66735,1],[66772,66775,1],[66812,66815,1],[66856,66863,1],[66916,66926,1],[66939,66955,16],[66963,66966,3],[66978,66994,16],[67002,67005,3],[67006,67071,1],[67383,67391,1],[67414,67423,1],[67432,67455,1],[67462,67505,43],[67515,67583,1],[67590,67591,1],[67593,67638,45],[67641,67643,1],[67645,67646,1],[67670,67743,73],[67744,67750,1],[67760,67807,1],[67827,67830,3],[67831,67834,1],[67868,67870,1],[67898,67902,1],[67904,67967,1],[68024,68027,1],[68048,68049,1],[68100,68103,3],[68104,68107,1],[68116,68120,4],[68150,68151,1],[68155,68158,1],[68169,68175,1],[68185,68191,1],[68256,68287,1],[68327,68330,1],[68343,68351,1],[68406,68408,1],[68438,68439,1],[68467,68471,1],[68498,68504,1],[68509,68520,1],[68528,68607,1],[68681,68735,1],[68787,68799,1],[68851,68857,1],[68904,68911,1],[68922,69215,1],[69247,69290,43],[69294,69295,1],[69298,69372,1],[69416,69423,1],[69466,69487,1],[69514,69551,1],[69580,69599,1],[69623,69631,1],[69710,69713,1],[69750,69758,1],[69821,69827,6],[69828,69839,1],[69865,69871,1],[69882,69887,1],[69941,69960,19],[69961,69967,1],[70007,70015,1],[70112,70133,21],[70134,70143,1],[70162,70210,48],[70211,70271,1],[70279,70281,2],[70286,70302,16],[70314,70319,1],[70379,70383,1],[70394,70399,1],[70404,70413,9],[70414,70417,3],[70418,70441,23],[70449,70452,3],[70458,70469,11],[70470,70473,3],[70474,70478,4],[70479,70481,2],[70482,70486,1],[70488,70492,1],[70500,70501,1],[70509,70511,
7651],[70517,70655,1],[70748,70754,6],[70755,70783,1],[70856,70863,1],[70874,71039,1],[71094,71095,1],[71134,71167,1],[71237,71247,1],[71258,71263,1],[71277,71295,1],[71354,71359,1],[71370,71423,1],[71451,71452,1],[71468,71471,1],[71495,71679,1],[71740,71839,1],[71923,71934,1],[71943,71944,1],[71946,71947,1],[71956,71959,3],[71990,71993,3],[71994,72007,13],[72008,72015,1],[72026,72095,1],[72104,72105,1],[72152,72153,1],[72165,72191,1],[72264,72271,1],[72355,72367,1],[72441,72447,1],[72458,72703,1],[72713,72759,46],[72774,72783,1],[72813,72815,1],[72848,72849,1],[72872,72887,15],[72888,72959,1],[72967,72970,3],[73015,73017,1],[73019,73022,3],[73032,73039,1],[73050,73055,1],[73062,73065,3],[73103,73106,3],[73113,73119,1],[73130,73439,1],[73465,73471,1],[73489,73531,42],[73532,73533,1],[73562,73647,1],[73649,73663,1],[73714,73726,1],[74650,74751,1],[74863,74869,6],[74870,74879,1],[75076,77711,1],[77811,77823,1],[78896,78911,1],[78934,82943,1],[83527,92159,1],[92729,92735,1],[92767,92778,11],[92779,92781,1],[92863,92874,11],[92875,92879,1],[92910,92911,1],[92918,92927,1],[92998,93007,1],[93018,93026,8],[93048,93052,1],[93072,93759,1],[93851,93951,1],[94027,94030,1],[94088,94094,1],[94112,94175,1],[94181,94191,1],[94194,94207,1],[100344,100351,1],[101590,101631,1],[101641,110575,1],[110580,110588,8],[110591,110883,292],[110884,110897,1],[110899,110927,1],[110931,110932,1],[110934,110947,1],[110952,110959,1],[111356,113663,1],[113771,113775,1],[113789,113791,1],[113801,113807,1],[113818,113819,1],[113824,118527,1],[118574,118575,1],[118599,118607,1],[118724,118783,1],[119030,119039,1],[119079,119080,1],[119155,119162,1],[119275,119295,1],[119366,119487,1],[119508,119519,1],[119540,119551,1],[119639,119647,1],[119673,119807,1],[119893,119965,72],[119968,119969,1],[119971,119972,1],[119975,119976,1],[119981,119994,13],[119996,120004,8],[120070,120075,5],[120076,120085,9],[120093,120122,29],[120127,120133,6],[120135,120137,1],[120145,120486,341],[120487,120780,293],[120781,121484,703],[121485,121498,1],[121504,121520,16],[121521,122623,1],[122655,122660,1],[122667,122879,1],[122887,122905,18],[122906,122914,8],[122917,122923,6],[122924,122927,1],[122990,123022,1],[123024,123135,1],[123181,123183,1],[123198,123199,1],[123210,123213,1],[123216,123535,1],[123567,123583,1],[123642,123646,1],[123648,124111,1],[124154,124895,1],[124903,124908,5],[124911,124927,16],[125125,125126,1],[125143,125183,1],[125260,125263,1],[125274,125277,1],[125280,126064,1],[126133,126208,1],[126270,126463,1],[126468,126496,28],[126499,126501,2],[126502,126504,2],[126515,126520,5],[126522,126524,2],[126525,126529,1],[126531,126534,1],[126536,126540,2],[126544,126547,3],[126549,126550,1],[126552,126560,2],[126563,126565,2],[126566,126571,5],[126579,126589,5],[126591,126602,11],[126620,126624,1],[126628,126634,6],[126652,126703,1],[126706,126975,1],[127020,127023,1],[127124,127135,1],[127151,127152,1],[127168,127184,16],[127222,127231,1],[127406,127461,1],[127491,127503,1],[127548,127551,1],[127561,127567,1],[127570,127583,1],[127590,127743,1],[128728,128731,1],[128749,128751,1],[128765,128767,1],[128887,128890,1],[128986,128991,1],[129004,129007,1],[129009,129023,1],[129036,129039,1],[129096,129103,1],[129114,129119,1],[129160,129167,1],[129198,129199,1],[129202,129279,1],[129620,129631,1],[129646,129647,1],[129661,129663,1],[129673,129679,1],[129726,129734,8],[129735,129741,1],[129756,129759,1],[129769,129775,1],[129785,129791,1],[129939,129995,56],[129996,130031,1],[130042,131071,1],[173792,173823,1],[177978,177983,1],[178206,178207,1],[183970,183983,1],[191457,191471,1],[192094,194559,1],[195102,196607,1],[201547,201551,1],[205744,917759,1],[918e3,1114111,1]];static Cc=[[0,31,1],[127,159,1]];static Cf=[[173,1536,1363],[1537,1541,1],[1564,1757,193],[1807,2192,385],[2193,2274,81],[6158,8203,2045],[8204,8207,1],[8234,8238,1],[8288,8292,1],[8294,8303,1],[65279,65529,250],[65530,65531,1],[69821,69837,16],[78896,78911,1],[113824,113827,1],[119155,119162,1],[917505,917536,31],[917537,917631,1]];static Co=[[57344,63743,1],[983040,1048573,1],[1048576,1114109,1]];static Cs=[[55296,57343,1]];static L=[[65,90,1],[97,122,1],[170,181,11],[186,192,6],[193,214,1],[216,246,1],[248,705,1],[710,721,1],[736,740,1],[748,750,2],[880,884,1],[886,887,1],[890,893,1],[895,902,7],[904,906,1],[908,910,2],[911,929,1],[931,1013,1],[1015,1153,1],[1162,1327,1],[1329,1366,1],[1369,1376,7
765],[1377,1416,1],[1488,1514,1],[1519,1522,1],[1568,1610,1],[1646,1647,1],[1649,1747,1],[1749,1765,16],[1766,1774,8],[1775,1786,11],[1787,1788,1],[1791,1808,17],[1810,1839,1],[1869,1957,1],[1969,1994,25],[1995,2026,1],[2036,2037,1],[2042,2048,6],[2049,2069,1],[2074,2084,10],[2088,2112,24],[2113,2136,1],[2144,2154,1],[2160,2183,1],[2185,2190,1],[2208,2249,1],[2308,2361,1],[2365,2384,19],[2392,2401,1],[2417,2432,1],[2437,2444,1],[2447,2448,1],[2451,2472,1],[2474,2480,1],[2482,2486,4],[2487,2489,1],[2493,2510,17],[2524,2525,1],[2527,2529,1],[2544,2545,1],[2556,2565,9],[2566,2570,1],[2575,2576,1],[2579,2600,1],[2602,2608,1],[2610,2611,1],[2613,2614,1],[2616,2617,1],[2649,2652,1],[2654,2674,20],[2675,2676,1],[2693,2701,1],[2703,2705,1],[2707,2728,1],[2730,2736,1],[2738,2739,1],[2741,2745,1],[2749,2768,19],[2784,2785,1],[2809,2821,12],[2822,2828,1],[2831,2832,1],[2835,2856,1],[2858,2864,1],[2866,2867,1],[2869,2873,1],[2877,2908,31],[2909,2911,2],[2912,2913,1],[2929,2947,18],[2949,2954,1],[2958,2960,1],[2962,2965,1],[2969,2970,1],[2972,2974,2],[2975,2979,4],[2980,2984,4],[2985,2986,1],[2990,3001,1],[3024,3077,53],[3078,3084,1],[3086,3088,1],[3090,3112,1],[3114,3129,1],[3133,3160,27],[3161,3162,1],[3165,3168,3],[3169,3200,31],[3205,3212,1],[3214,3216,1],[3218,3240,1],[3242,3251,1],[3253,3257,1],[3261,3293,32],[3294,3296,2],[3297,3313,16],[3314,3332,18],[3333,3340,1],[3342,3344,1],[3346,3386,1],[3389,3406,17],[3412,3414,1],[3423,3425,1],[3450,3455,1],[3461,3478,1],[3482,3505,1],[3507,3515,1],[3517,3520,3],[3521,3526,1],[3585,3632,1],[3634,3635,1],[3648,3654,1],[3713,3714,1],[3716,3718,2],[3719,3722,1],[3724,3747,1],[3749,3751,2],[3752,3760,1],[3762,3763,1],[3773,3776,3],[3777,3780,1],[3782,3804,22],[3805,3807,1],[3840,3904,64],[3905,3911,1],[3913,3948,1],[3976,3980,1],[4096,4138,1],[4159,4176,17],[4177,4181,1],[4186,4189,1],[4193,4197,4],[4198,4206,8],[4207,4208,1],[4213,4225,1],[4238,4256,18],[4257,4293,1],[4295,4301,6],[4304,4346,1],[4348,4680,1],[4682,4685,1],[4688,4694,1],[4696,4698,2],[4699,4701,1],[4704,4744,1],[4746,4749,1],[4752,4784,1],[4786,4789,1],[4792,4798,1],[4800,4802,2],[4803,4805,1],[4808,4822,1],[4824,4880,1],[4882,4885,1],[4888,4954,1],[4992,5007,1],[5024,5109,1],[5112,5117,1],[5121,5740,1],[5743,5759,1],[5761,5786,1],[5792,5866,1],[5873,5880,1],[5888,5905,1],[5919,5937,1],[5952,5969,1],[5984,5996,1],[5998,6e3,1],[6016,6067,1],[6103,6108,5],[6176,6264,1],[6272,6276,1],[6279,6312,1],[6314,6320,6],[6321,6389,1],[6400,6430,1],[6480,6509,1],[6512,6516,1],[6528,6571,1],[6576,6601,1],[6656,6678,1],[6688,6740,1],[6823,6917,94],[6918,6963,1],[6981,6988,1],[7043,7072,1],[7086,7087,1],[7098,7141,1],[7168,7203,1],[7245,7247,1],[7258,7293,1],[7296,7304,1],[7312,7354,1],[7357,7359,1],[7401,7404,1],[7406,7411,1],[7413,7414,1],[7418,7424,6],[7425,7615,1],[7680,7957,1],[7960,7965,1],[7968,8005,1],[8008,8013,1],[8016,8023,1],[8025,8031,2],[8032,8061,1],[8064,8116,1],[8118,8124,1],[8126,8130,4],[8131,8132,1],[8134,8140,1],[8144,8147,1],[8150,8155,1],[8160,8172,1],[8178,8180,1],[8182,8188,1],[8305,8319,14],[8336,8348,1],[8450,8455,5],[8458,8467,1],[8469,8473,4],[8474,8477,1],[8484,8490,2],[8491,8493,1],[8495,8505,1],[8508,8511,1],[8517,8521,1],[8526,8579,53],[8580,11264,2684],[11265,11492,1],[11499,11502,1],[11506,11507,1],[11520,11557,1],[11559,11565,6],[11568,11623,1],[11631,11648,17],[11649,11670,1],[11680,11686,1],[11688,11694,1],[11696,11702,1],[11704,11710,1],[11712,11718,1],[11720,11726,1],[11728,11734,1],[11736,11742,1],[11823,12293,470],[12294,12337,43],[12338,12341,1],[12347,12348,1],[12353,12438,1],[12445,12447,1],[12449,12538,1],[12540,12543,1],[12549,12591,1],[12593,12686,1],[12704,12735,1],[12784,12799,1],[13312,19903,1],[19968,42124,1],[42192,42237,1],[42240,42508,1],[42512,42527,1],[42538,42539,1],[42560,42606,1],[42623,42653,1],[42656,42725,1],[42775,42783,1],[42786,42888,1],[42891,42954,1],[42960,42961,1],[42963,42965,2],[42966,42969,1],[42994,43009,1],[43011,43013,1],[43015,43018,1],[43020,43042,1],[43072,43123,1],[43138,43187,1],[43250,43255,1],[43259,43261,2],[43262,43274,12],[43275,43301,1],[43312,43334,1],[43360,43388,1],[43396,43442,1],[43471,43488,17],[43489,43492,1],[43494,43503,1],[43514,43518,1],[43520,43560,1],[43584,43586,1],[43588,43595,1],[43616,43638,1],[43642,43646,4],[43647,43695,1],[43697,43701,4],[43702,43705,3],[43706,43709,1],[43712,43714,2],[43739,43741,1],[43744,43754,1],[43762,43764,1],[43777,43782,1],[43785,43790,1],[43793,43798,1],[43808,43814,1],[43816,43822,1],[43824,43866,1],[43868,43881,1],[43888,44002,1],[44032,55203,1],[55216,55238,1],[55243,5
7655291,1],[63744,64109,1],[64112,64217,1],[64256,64262,1],[64275,64279,1],[64285,64287,2],[64288,64296,1],[64298,64310,1],[64312,64316,1],[64318,64320,2],[64321,64323,2],[64324,64326,2],[64327,64433,1],[64467,64829,1],[64848,64911,1],[64914,64967,1],[65008,65019,1],[65136,65140,1],[65142,65276,1],[65313,65338,1],[65345,65370,1],[65382,65470,1],[65474,65479,1],[65482,65487,1],[65490,65495,1],[65498,65500,1],[65536,65547,1],[65549,65574,1],[65576,65594,1],[65596,65597,1],[65599,65613,1],[65616,65629,1],[65664,65786,1],[66176,66204,1],[66208,66256,1],[66304,66335,1],[66349,66368,1],[66370,66377,1],[66384,66421,1],[66432,66461,1],[66464,66499,1],[66504,66511,1],[66560,66717,1],[66736,66771,1],[66776,66811,1],[66816,66855,1],[66864,66915,1],[66928,66938,1],[66940,66954,1],[66956,66962,1],[66964,66965,1],[66967,66977,1],[66979,66993,1],[66995,67001,1],[67003,67004,1],[67072,67382,1],[67392,67413,1],[67424,67431,1],[67456,67461,1],[67463,67504,1],[67506,67514,1],[67584,67589,1],[67592,67594,2],[67595,67637,1],[67639,67640,1],[67644,67647,3],[67648,67669,1],[67680,67702,1],[67712,67742,1],[67808,67826,1],[67828,67829,1],[67840,67861,1],[67872,67897,1],[67968,68023,1],[68030,68031,1],[68096,68112,16],[68113,68115,1],[68117,68119,1],[68121,68149,1],[68192,68220,1],[68224,68252,1],[68288,68295,1],[68297,68324,1],[68352,68405,1],[68416,68437,1],[68448,68466,1],[68480,68497,1],[68608,68680,1],[68736,68786,1],[68800,68850,1],[68864,68899,1],[69248,69289,1],[69296,69297,1],[69376,69404,1],[69415,69424,9],[69425,69445,1],[69488,69505,1],[69552,69572,1],[69600,69622,1],[69635,69687,1],[69745,69746,1],[69749,69763,14],[69764,69807,1],[69840,69864,1],[69891,69926,1],[69956,69959,3],[69968,70002,1],[70006,70019,13],[70020,70066,1],[70081,70084,1],[70106,70108,2],[70144,70161,1],[70163,70187,1],[70207,70208,1],[70272,70278,1],[70280,70282,2],[70283,70285,1],[70287,70301,1],[70303,70312,1],[70320,70366,1],[70405,70412,1],[70415,70416,1],[70419,70440,1],[70442,70448,1],[70450,70451,1],[70453,70457,1],[70461,70480,19],[70493,70497,1],[70656,70708,1],[70727,70730,1],[70751,70753,1],[70784,70831,1],[70852,70853,1],[70855,71040,185],[71041,71086,1],[71128,71131,1],[71168,71215,1],[71236,71296,60],[71297,71338,1],[71352,71424,72],[71425,71450,1],[71488,71494,1],[71680,71723,1],[71840,71903,1],[71935,71942,1],[71945,71948,3],[71949,71955,1],[71957,71958,1],[71960,71983,1],[71999,72001,2],[72096,72103,1],[72106,72144,1],[72161,72163,2],[72192,72203,11],[72204,72242,1],[72250,72272,22],[72284,72329,1],[72349,72368,19],[72369,72440,1],[72704,72712,1],[72714,72750,1],[72768,72818,50],[72819,72847,1],[72960,72966,1],[72968,72969,1],[72971,73008,1],[73030,73056,26],[73057,73061,1],[73063,73064,1],[73066,73097,1],[73112,73440,328],[73441,73458,1],[73474,73476,2],[73477,73488,1],[73490,73523,1],[73648,73728,80],[73729,74649,1],[74880,75075,1],[77712,77808,1],[77824,78895,1],[78913,78918,1],[82944,83526,1],[92160,92728,1],[92736,92766,1],[92784,92862,1],[92880,92909,1],[92928,92975,1],[92992,92995,1],[93027,93047,1],[93053,93071,1],[93760,93823,1],[93952,94026,1],[94032,94099,67],[94100,94111,1],[94176,94177,1],[94179,94208,29],[94209,100343,1],[100352,101589,1],[101632,101640,1],[110576,110579,1],[110581,110587,1],[110589,110590,1],[110592,110882,1],[110898,110928,30],[110929,110930,1],[110933,110948,15],[110949,110951,1],[110960,111355,1],[113664,113770,1],[113776,113788,1],[113792,113800,1],[113808,113817,1],[119808,119892,1],[119894,119964,1],[119966,119967,1],[119970,119973,3],[119974,119977,3],[119978,119980,1],[119982,119993,1],[119995,119997,2],[119998,120003,1],[120005,120069,1],[120071,120074,1],[120077,120084,1],[120086,120092,1],[120094,120121,1],[120123,120126,1],[120128,120132,1],[120134,120138,4],[120139,120144,1],[120146,120485,1],[120488,120512,1],[120514,120538,1],[120540,120570,1],[120572,120596,1],[120598,120628,1],[120630,120654,1],[120656,120686,1],[120688,120712,1],[120714,120744,1],[120746,120770,1],[120772,120779,1],[122624,122654,1],[122661,122666,1],[122928,122989,1],[123136,123180,1],[123191,123197,1],[123214,123536,322],[123537,123565,1],[123584,123627,1],[124112,124139,1],[124896,124902,1],[124904,124907,1],[124909,124910,1],[124912,124926,1],[124928,125124,1],[125184,125251,1],[125259,126464,1205],[126465,126467,1],[126469,126495,1],[126497,126498,1],[126500,126503,3],[126505,126514,1],[126516,126519,1],[126521,126523,2],[126530,126535,5],[126537,126541,2],[126542,126543,1],[126545,126546,1],[126548,126551,3],[126553,126561,2],[126562,126564,2],[126567,126570,1],[126572,126578,1],[126580,126583,1],[126585,126588,1],[126590,126592,2],[126593,126601,1],[126603,126619,1],[126625,126627,1],[126629,126633,1],[126635,126651,1],[131072,173791,1],[173824,177977,1],[177984,178205,1],[178208,183969,1],[183984,191456,1],[191472,192093,1],[194560,195101,1],[196608,201546,1],[201552,205743,1]];static foldL=[[837,837,1]];static Ll=[[97,122,1],[181,223,42],[224,246,1],[248,255,1],[257,311,2],[312,328,2],[329,375,2],[378,382,2],[383,384,1],[387,389,2],[392,396,4],[397,402,5],[405,409,4],[410,411,1],[414,417,3],[419,421,2],[424,426,2],[427,429,2],[432,436,4],[438,441,3],[442,445,3],[446,447,1],[454,460,3],[462,476,2],[477,495,2],[496,499,3],[501,505,4],[507,563,2],[564,569,1],[572,575,3],[576,578,2],[583,591,2],[592,659,1],[661,687,1],[881,883,2],[887,891,4],[892,893,1],[912,940,28],[941,974,1],[976,977,1],[981,983,1],[985,1007,2],[1008,1011,1],[1013,1019,3],[1020,1072,52],[1073,1119,1],[1121,1153,2],[1163,1215,2],[1218,1230,2],[1231,1327,2],[1376,1416,1],[4304,4346,1],[4349,4351,1],[5112,5117,1],[7296,7304,1],[7424,7467,1],[7531,7543,1],[7545,7578,1],[7681,7829,2],[7830,7837,1],[7839,7935,2],[7936,7943,1],[7952,7957,1],[7968,7975,1],[7984,7991,1],[8e3,8005,1],[8016,8023,1],[8032,8039,1],[8048,8061,1],[8064,8071,1],[8080,8087,1],[8096,8103,1],[8112,8116,1],[8118,8119,1],[8126,8130,4],[8131,8132,1],[8134,8135,1],[8144,8147,1],[8150,8151,1],[8160,8167,1],[8178,8180,1],[8182,8183,1],[8458,8462,4],[8463,8467,4],[8495,8505,5],[8508,8509,1],[8518,8521,1],[8526,8580,54],[11312,11359,1],[11361,11365,4],[11366,11372,2],[11377,11379,2],[11380,11382,2],[11383,11387,1],[11393,11491,2],[11492,11500,8],[11502,11507,5],[11520,11557,1],[11559,11565,6],[42561,42605,2],[42625,42651,2],[42787,42799,2],[42800,42801,1],[42803,42865,2],[42866,42872,1],[42874,42876,2],[42879,42887,2],[42892,42894,2],[42897,42899,2],[42900,42901,1],[42903,42921,2],[42927,42933,6],[42935,42947,2],[42952,42954,2],[42961,42969,2],[42998,43002,4],[43824,43866,1],[43872,43880,1],[43888,43967,1],[64256,64262,1],[64275,64279,1],[65345,65370,1],[66600,66639,1],[66776,66811,1],[66967,66977,1],[66979,66993,1],[66995,67001,1],[67003,67004,1],[68800,68850,1],[71872,71903,1],[93792,93823,1],[119834,119859,1],[119886,119892,1],[119894,119911,1],[119938,119963,1],[119990,119993,1],[119995,119997,2],[119998,120003,1],[120005,120015,1],[120042,120067,1],[120094,120119,1],[120146,120171,1],[120198,120223,1],[120250,12
7650275,1],[120302,120327,1],[120354,120379,1],[120406,120431,1],[120458,120485,1],[120514,120538,1],[120540,120545,1],[120572,120596,1],[120598,120603,1],[120630,120654,1],[120656,120661,1],[120688,120712,1],[120714,120719,1],[120746,120770,1],[120772,120777,1],[120779,122624,1845],[122625,122633,1],[122635,122654,1],[122661,122666,1],[125218,125251,1]];static foldLl=[[65,90,1],[192,214,1],[216,222,1],[256,302,2],[306,310,2],[313,327,2],[330,376,2],[377,381,2],[385,386,1],[388,390,2],[391,393,2],[394,395,1],[398,401,1],[403,404,1],[406,408,1],[412,413,1],[415,416,1],[418,422,2],[423,425,2],[428,430,2],[431,433,2],[434,435,1],[437,439,2],[440,444,4],[452,453,1],[455,456,1],[458,459,1],[461,475,2],[478,494,2],[497,498,1],[500,502,2],[503,504,1],[506,562,2],[570,571,1],[573,574,1],[577,579,2],[580,582,1],[584,590,2],[837,880,43],[882,886,4],[895,902,7],[904,906,1],[908,910,2],[911,913,2],[914,929,1],[931,939,1],[975,984,9],[986,1006,2],[1012,1015,3],[1017,1018,1],[1021,1071,1],[1120,1152,2],[1162,1216,2],[1217,1229,2],[1232,1326,2],[1329,1366,1],[4256,4293,1],[4295,4301,6],[5024,5109,1],[7312,7354,1],[7357,7359,1],[7680,7828,2],[7838,7934,2],[7944,7951,1],[7960,7965,1],[7976,7983,1],[7992,7999,1],[8008,8013,1],[8025,8031,2],[8040,8047,1],[8072,8079,1],[8088,8095,1],[8104,8111,1],[8120,8124,1],[8136,8140,1],[8152,8155,1],[8168,8172,1],[8184,8188,1],[8486,8490,4],[8491,8498,7],[8579,11264,2685],[11265,11311,1],[11360,11362,2],[11363,11364,1],[11367,11373,2],[11374,11376,1],[11378,11381,3],[11390,11392,1],[11394,11490,2],[11499,11501,2],[11506,42560,31054],[42562,42604,2],[42624,42650,2],[42786,42798,2],[42802,42862,2],[42873,42877,2],[42878,42886,2],[42891,42893,2],[42896,42898,2],[42902,42922,2],[42923,42926,1],[42928,42932,1],[42934,42948,2],[42949,42951,1],[42953,42960,7],[42966,42968,2],[42997,65313,22316],[65314,65338,1],[66560,66599,1],[66736,66771,1],[66928,66938,1],[66940,66954,1],[66956,66962,1],[66964,66965,1],[68736,68786,1],[71840,71871,1],[93760,93791,1],[125184,125217,1]];static Lm=[[688,705,1],[710,721,1],[736,740,1],[748,750,2],[884,890,6],[1369,1600,231],[1765,1766,1],[2036,2037,1],[2042,2074,32],[2084,2088,4],[2249,2417,168],[3654,3782,128],[4348,6103,1755],[6211,6823,612],[7288,7293,1],[7468,7530,1],[7544,7579,35],[7580,7615,1],[8305,8319,14],[8336,8348,1],[11388,11389,1],[11631,11823,192],[12293,12337,44],[12338,12341,1],[12347,12445,98],[12446,12540,94],[12541,12542,1],[40981,42232,1251],[42233,42237,1],[42508,42623,115],[42652,42653,1],[42775,42783,1],[42864,42888,24],[42994,42996,1],[43e3,43001,1],[43471,43494,23],[43632,43741,109],[43763,43764,1],[43868,43871,1],[43881,65392,21511],[65438,65439,1],[67456,67461,1],[67463,67504,1],[67506,67514,1],[92992,92995,1],[94099,94111,1],[94176,94177,1],[94179,110576,16397],[110577,110579,1],[110581,110587,1],[110589,110590,1],[122928,122989,1],[123191,123197,1],[124139,125259,1120]];static Lo=[[170,186,16],[443,448,5],[449,451,1],[660,1488,828],[1489,1514,1],[1519,1522,1],[1568,1599,1],[1601,1610,1],[1646,1647,1],[1649,1747,1],[1749,1774,25],[1775,1786,11],[1787,1788,1],[1791,1808,17],[1810,1839,1],[1869,1957,1],[1969,1994,25],[1995,2026,1],[2048,2069,1],[2112,2136,1],[2144,2154,1],[2160,2183,1],[2185,2190,1],[2208,2248,1],[2308,2361,1],[2365,2384,19],[2392,2401,1],[2418,2432,1],[2437,2444,1],[2447,2448,1],[2451,2472,1],[2474,2480,1],[2482,2486,4],[2487,2489,1],[2493,2510,17],[2524,2525,1],[2527,2529,1],[2544,2545,1],[2556,2565,9],[2566,2570,1],[2575,2576,1],[2579,2600,1],[2602,2608,1],[2610,2611,1],[2613,2614,1],[2616,2617,1],[2649,2652,1],[2654,2674,20],[2675,2676,1],[2693,2701,1],[2703,2705,1],[2707,2728,1],[2730,2736,1],[2738,2739,1],[2741,2745,1],[2749,2768,19],[2784,2785,1],[2809,2821,12],[2822,2828,1],[2831,2832,1],[2835,2856,1],[2858,2864,1],[2866,2867,1],[2869,2873,1],[2877,2908,31],[2909,2911,2],[2912,2913,1],[2929,2947,18],[2949,2954,1],[2958,2960,1],[2962,2965,1],[2969,2970,1],[2972,2974,2],[2975,2979,4],[2980,2984,4],[2985,2986,1],[2990,3001,1],[3024,3077,53],[3078,3084,1],[3086,3088,1],[3090,3112,1],[3114,3129,1],[3133,3160,27],[3161,3162,1],[3165,3168,3],[3169,3200,31],[3205,3212,1],[3214,3216,1],[3218,3240,1],[3242,3251,1],[3253,3257,1],[3261,3293,32],[3294,3296,2],[3297,3313,16],[3314,3332,18],[3333,3340,1],[3342,3344,1],[3346,3386,1],[3389,3406,17],[3412,3414,1],[3423,3425,1],[3450,3455,1],[3461,3478,1],[3482,3505,1],[3507,3515,1],[3517,3520,3],[3521,3526,1],[3585,3632,1],[3634,3635,1],[3648,3653,1],[3713,3714,1],[3716,3718,2],[3719,3722,1],[3724,3747,1],[3749,3751,2],[3752,3760,1],[3762,3763,1],[3773,3776,3],[3777,3780,1],[3804,3807,1],[3840,3904,64],[3905,3911,1],[3913,3948,1],[3976,3980,1],[4096,4138,1],[4159,4176,17],[4177,4181,1],[4186,4189,1],[4193,4197,4],[4198,4206,8],[4207,4208,1],[4213,4225,1],[4238,4352,114],[4353,4680,1],[4682,4685,1],[4688,4694,1],[4696,4698,2],[4699,4701,1],[4704,4744,1],[4746,4749,1],[4752,4784,1],[4786,4789,1],[4792,4798,1],[4800,4802,2],[4803,4805,1],[4808,4822,1],[4824,4880,1],[4882,4885,1],[4888,4954,1],[4992,5007,1],[5121,5740,1],[5743,5759,1],[5761,5786,1],[5792,5866,1],[5873,5880,1],[5888,5905,1],[5919,5937,1],[5952,5969,1],[5984,5996,1],[5998,6e3,1],[6016,6067,1],[6108,6176,68],[6177,6210,1],[6212,6264,1],[6272,6276,1],[6279,6312,1],[6314,6320,6],[6321,6389,1],[6400,6430,1],[6480,6509,1],[6512,6516,1],[6528,6571,1],[6576,6601,1],[6656,6678,1],[6688,6740,1],[6917,6963,1],[6981,6988,1],[7043,7072,1],[7086,7087,1],[7098,7141,1],[7168,7203,1],[7245,7247,1],[7258,7287,1],[7401,7404,1],[7406,7411,1],[7413,7414,1],[7418,8501,1083],[8502,8504,1],[11568,11623,1],[11648,11670,1],[11680,11686,1],[11688,11694,1],[11696,11702,1],[11704,11710,1],[11712,11718,1],[11720,11726,1],[11728,11734,1],[11736,11
765742,1],[12294,12348,54],[12353,12438,1],[12447,12449,2],[12450,12538,1],[12543,12549,6],[12550,12591,1],[12593,12686,1],[12704,12735,1],[12784,12799,1],[13312,19903,1],[19968,40980,1],[40982,42124,1],[42192,42231,1],[42240,42507,1],[42512,42527,1],[42538,42539,1],[42606,42656,50],[42657,42725,1],[42895,42999,104],[43003,43009,1],[43011,43013,1],[43015,43018,1],[43020,43042,1],[43072,43123,1],[43138,43187,1],[43250,43255,1],[43259,43261,2],[43262,43274,12],[43275,43301,1],[43312,43334,1],[43360,43388,1],[43396,43442,1],[43488,43492,1],[43495,43503,1],[43514,43518,1],[43520,43560,1],[43584,43586,1],[43588,43595,1],[43616,43631,1],[43633,43638,1],[43642,43646,4],[43647,43695,1],[43697,43701,4],[43702,43705,3],[43706,43709,1],[43712,43714,2],[43739,43740,1],[43744,43754,1],[43762,43777,15],[43778,43782,1],[43785,43790,1],[43793,43798,1],[43808,43814,1],[43816,43822,1],[43968,44002,1],[44032,55203,1],[55216,55238,1],[55243,55291,1],[63744,64109,1],[64112,64217,1],[64285,64287,2],[64288,64296,1],[64298,64310,1],[64312,64316,1],[64318,64320,2],[64321,64323,2],[64324,64326,2],[64327,64433,1],[64467,64829,1],[64848,64911,1],[64914,64967,1],[65008,65019,1],[65136,65140,1],[65142,65276,1],[65382,65391,1],[65393,65437,1],[65440,65470,1],[65474,65479,1],[65482,65487,1],[65490,65495,1],[65498,65500,1],[65536,65547,1],[65549,65574,1],[65576,65594,1],[65596,65597,1],[65599,65613,1],[65616,65629,1],[65664,65786,1],[66176,66204,1],[66208,66256,1],[66304,66335,1],[66349,66368,1],[66370,66377,1],[66384,66421,1],[66432,66461,1],[66464,66499,1],[66504,66511,1],[66640,66717,1],[66816,66855,1],[66864,66915,1],[67072,67382,1],[67392,67413,1],[67424,67431,1],[67584,67589,1],[67592,67594,2],[67595,67637,1],[67639,67640,1],[67644,67647,3],[67648,67669,1],[67680,67702,1],[67712,67742,1],[67808,67826,1],[67828,67829,1],[67840,67861,1],[67872,67897,1],[67968,68023,1],[68030,68031,1],[68096,68112,16],[68113,68115,1],[68117,68119,1],[68121,68149,1],[68192,68220,1],[68224,68252,1],[68288,68295,1],[68297,68324,1],[68352,68405,1],[68416,68437,1],[68448,68466,1],[68480,68497,1],[68608,68680,1],[68864,68899,1],[69248,69289,1],[69296,69297,1],[69376,69404,1],[69415,69424,9],[69425,69445,1],[69488,69505,1],[69552,69572,1],[69600,69622,1],[69635,69687,1],[69745,69746,1],[69749,69763,14],[69764,69807,1],[69840,69864,1],[69891,69926,1],[69956,69959,3],[69968,70002,1],[70006,70019,13],[70020,70066,1],[70081,70084,1],[70106,70108,2],[70144,70161,1],[70163,70187,1],[70207,70208,1],[70272,70278,1],[70280,70282,2],[70283,70285,1],[70287,70301,1],[70303,70312,1],[70320,70366,1],[70405,70412,1],[70415,70416,1],[70419,70440,1],[70442,70448,1],[70450,70451,1],[70453,70457,1],[70461,70480,19],[70493,70497,1],[70656,70708,1],[70727,70730,1],[70751,70753,1],[70784,70831,1],[70852,70853,1],[70855,71040,185],[71041,71086,1],[71128,71131,1],[71168,71215,1],[71236,71296,60],[71297,71338,1],[71352,71424,72],[71425,71450,1],[71488,71494,1],[71680,71723,1],[71935,71942,1],[71945,71948,3],[71949,71955,1],[71957,71958,1],[71960,71983,1],[71999,72001,2],[72096,72103,1],[72106,72144,1],[72161,72163,2],[72192,72203,11],[72204,72242,1],[72250,72272,22],[72284,72329,1],[72349,72368,19],[72369,72440,1],[72704,72712,1],[72714,72750,1],[72768,72818,50],[72819,72847,1],[72960,72966,1],[72968,72969,1],[72971,73008,1],[73030,73056,26],[73057,73061,1],[73063,73064,1],[73066,73097,1],[73112,73440,328],[73441,73458,1],[73474,73476,2],[73477,73488,1],[73490,73523,1],[73648,73728,80],[73729,74649,1],[74880,75075,1],[77712,77808,1],[77824,78895,1],[78913,78918,1],[82944,83526,1],[92160,92728,1],[92736,92766,1],[92784,92862,1],[92880,92909,1],[92928,92975,1],[93027,93047,1],[93053,93071,1],[93952,94026,1],[94032,94208,176],[94209,100343,1],[100352,101589,1],[101632,101640,1],[110592,110882,1],[110898,110928,30],[110929,110930,1],[110933,110948,15],[110949,110951,1],[110960,111355,1],[113664,113770,1],[113776,113788,1],[113792,113800,1],[113808,113817,1],[122634,123136,502],[123137,123180,1],[123214,123536,322],[123537,123565,1],[123584,123627,1],[124112,124138,1],[124896,124902,1],[124904,124907,1],[124909,124910,1],[124912,124926,1],[124928,125124,1],[126464,126467,1],[126469,126495,1],[126497,126498,1],[126500,126503,3],[126505,126514,1],[126516,126519,1],[126521,126523,2],[126530,126535,5],[126537,126541,2],[126542,126543,1],[126545,126546,1],[126548,126551,3],[126553,126561,2],[126562,126564,2],[126567,126570,1],[126572,126578,1],[126580,126583,1],[126585,126588,1],[126590,126592,2],[126593,126601,1],[126603,126619,1],[126625,126627,1],[126629,126633,1],[126635,126651,1],[131072,173791,1],[173824,177977,1],[177984,178205,1],[178208,183969,1],[183984,191456,1],[191472,192093,1],[194560,195101,1],[196608,201546,1],[201552,205743,1]];static Lt=[[453,459,3],[498,8072,7574],[8073,8079,1],[8088,8095,1],[8104,8111,1],[8124,8140,16],[8188,8188,1]];static foldLt=[[452,454,2],[455,457,2],[458,460,2],[497,499,2],[8064,8071,1],[8080,8087,1],[8096,8103,1],[8115,8131,16],[8179,8179,1]];static Lu=[[65,90,1],[192,214,1],[216,222,1],[256,310,2],[313,327,2],[330,376,2],[377,381,2],[385,386,1],[388,390,2],[391,393,2],[394,395,1],[398,401,1],[403,404,1],[406,408,1],[412,413,1],[415,416,1],[418,422,2],[423,425,2],[428,430,2],[431,433,2],[434,435,1],[437,439,2],[440,444,4],[452,461,3],[463,475,2],[478,494,2],[497,500,3],[502,504,1],[506,562,2],[570,571,1],[573,574,1],[577,579,2],[580,582,1],[584,590,2],[880,882,2],[886,895,9],[902,904,2],[905,906,1],[908,910,2],[911,913,2],[914,929,1],[931,939,1],[975,978,3],[979,980,1],[984,1006,2],[1012,1015,3],[1017,1018,1],[1021,10
76571,1],[1120,1152,2],[1162,1216,2],[1217,1229,2],[1232,1326,2],[1329,1366,1],[4256,4293,1],[4295,4301,6],[5024,5109,1],[7312,7354,1],[7357,7359,1],[7680,7828,2],[7838,7934,2],[7944,7951,1],[7960,7965,1],[7976,7983,1],[7992,7999,1],[8008,8013,1],[8025,8031,2],[8040,8047,1],[8120,8123,1],[8136,8139,1],[8152,8155,1],[8168,8172,1],[8184,8187,1],[8450,8455,5],[8459,8461,1],[8464,8466,1],[8469,8473,4],[8474,8477,1],[8484,8490,2],[8491,8493,1],[8496,8499,1],[8510,8511,1],[8517,8579,62],[11264,11311,1],[11360,11362,2],[11363,11364,1],[11367,11373,2],[11374,11376,1],[11378,11381,3],[11390,11392,1],[11394,11490,2],[11499,11501,2],[11506,42560,31054],[42562,42604,2],[42624,42650,2],[42786,42798,2],[42802,42862,2],[42873,42877,2],[42878,42886,2],[42891,42893,2],[42896,42898,2],[42902,42922,2],[42923,42926,1],[42928,42932,1],[42934,42948,2],[42949,42951,1],[42953,42960,7],[42966,42968,2],[42997,65313,22316],[65314,65338,1],[66560,66599,1],[66736,66771,1],[66928,66938,1],[66940,66954,1],[66956,66962,1],[66964,66965,1],[68736,68786,1],[71840,71871,1],[93760,93791,1],[119808,119833,1],[119860,119885,1],[119912,119937,1],[119964,119966,2],[119967,119973,3],[119974,119977,3],[119978,119980,1],[119982,119989,1],[120016,120041,1],[120068,120069,1],[120071,120074,1],[120077,120084,1],[120086,120092,1],[120120,120121,1],[120123,120126,1],[120128,120132,1],[120134,120138,4],[120139,120144,1],[120172,120197,1],[120224,120249,1],[120276,120301,1],[120328,120353,1],[120380,120405,1],[120432,120457,1],[120488,120512,1],[120546,120570,1],[120604,120628,1],[120662,120686,1],[120720,120744,1],[120778,125184,4406],[125185,125217,1]];static Upper=this.Lu;static foldLu=[[97,122,1],[181,223,42],[224,246,1],[248,255,1],[257,303,2],[307,311,2],[314,328,2],[331,375,2],[378,382,2],[383,384,1],[387,389,2],[392,396,4],[402,405,3],[409,410,1],[414,417,3],[419,421,2],[424,429,5],[432,436,4],[438,441,3],[445,447,2],[453,454,1],[456,457,1],[459,460,1],[462,476,2],[477,495,2],[498,499,1],[501,505,4],[507,543,2],[547,563,2],[572,575,3],[576,578,2],[583,591,2],[592,596,1],[598,599,1],[601,603,2],[604,608,4],[609,613,2],[614,616,2],[617,620,1],[623,625,2],[626,629,3],[637,640,3],[642,643,1],[647,652,1],[658,669,11],[670,837,167],[881,883,2],[887,891,4],[892,893,1],[940,943,1],[945,974,1],[976,977,1],[981,983,1],[985,1007,2],[1008,1011,1],[1013,1019,3],[1072,1119,1],[1121,1153,2],[1163,1215,2],[1218,1230,2],[1231,1327,2],[1377,1414,1],[4304,4346,1],[4349,4351,1],[5112,5117,1],[7296,7304,1],[7545,7549,4],[7566,7681,115],[7683,7829,2],[7835,7841,6],[7843,7935,2],[7936,7943,1],[7952,7957,1],[7968,7975,1],[7984,7991,1],[8e3,8005,1],[8017,8023,2],[8032,8039,1],[8048,8061,1],[8112,8113,1],[8126,8144,18],[8145,8160,15],[8161,8165,4],[8526,8580,54],[11312,11359,1],[11361,11365,4],[11366,11372,2],[11379,11382,3],[11393,11491,2],[11500,11502,2],[11507,11520,13],[11521,11557,1],[11559,11565,6],[42561,42605,2],[42625,42651,2],[42787,42799,2],[42803,42863,2],[42874,42876,2],[42879,42887,2],[42892,42897,5],[42899,42900,1],[42903,42921,2],[42933,42947,2],[42952,42954,2],[42961,42967,6],[42969,42998,29],[43859,43888,29],[43889,43967,1],[65345,65370,1],[66600,66639,1],[66776,66811,1],[66967,66977,1],[66979,66993,1],[66995,67001,1],[67003,67004,1],[68800,68850,1],[71872,71903,1],[93792,93823,1],[125218,125251,1]];static M=[[768,879,1],[1155,1161,1],[1425,1469,1],[1471,1473,2],[1474,1476,2],[1477,1479,2],[1552,1562,1],[1611,1631,1],[1648,1750,102],[1751,1756,1],[1759,1764,1],[1767,1768,1],[1770,1773,1],[1809,1840,31],[1841,1866,1],[1958,1968,1],[2027,2035,1],[2045,2070,25],[2071,2073,1],[2075,2083,1],[2085,2087,1],[2089,2093,1],[2137,2139,1],[2200,2207,1],[2250,2273,1],[2275,2307,1],[2362,2364,1],[2366,2383,1],[2385,2391,1],[2402,2403,1],[2433,2435,1],[2492,2494,2],[2495,2500,1],[2503,2504,1],[2507,2509,1],[2519,2530,11],[2531,2558,27],[2561,2563,1],[2620,2622,2],[2623,2626,1],[2631,2632,1],[2635,2637,1],[2641,2672,31],[2673,2677,4],[2689,2691,1],[2748,2750,2],[2751,2757,1],[2759,2761,1],[2763,2765,1],[2786,2787,1],[2810,2815,1],[2817,2819,1],[2876,2878,2],[2879,2884,1],[2887,2888,1],[2891,2893,1],[2901,2903,1],[2914,2915,1],[2946,3006,60],[3007,3010,1],[3014,3016,1],[3018,3021,1],[3031,3072,41],[3073,3076,1],[3132,3134,2],[3135,3140,1],[3142,3144,1],[3146,3149,1],[3157,3158,1],[3170,3171,1],[3201,3203,1],[3260,3262,2],[3263,3268,1],[3270,3272,1],[3274,3277,1],[3285,3286,1],[3298,3299,1],[3315,3328,13],[3329,3331,1],[3387,3388,1],[3390,3396,1],[3398,3400,1],[3402,3405,1],[3415,3426,11],[3427,3457,30],[3458,3459,1],[3530,3535,5],[3536,3540,1],[3542,3544,2],[3545,3551,1],[3570,3571,1],[3633,3636,3],[3637,3642,1],[3655,3662,1],[3761,3764,3],[3765,3772,1],[3784,3790,1],[3864,3865,1],[3893,3897,2],[3902,3903,1],[3953,3972,1],[3974,3975,1],[3981,3991,1],[3993,4028,1],[4038,4139,101],[4140,4158,1],[4182,4185,1],[4190,4192,1],[4194,4196,1],[4199,4205,1],[4209,4212,1],[4226,4237,1],[4239,4250,11],[4251,4253,1],[4957,4959,1],[5906,5909,1],[5938,5940,1],[5970,5971,1],[6002,6003,1],[6068,6099,1],[6109,6155,46],[6156,6157,1],[6159,6277,118],[6278,6313,35],[6432,6443,1],[6448,6459,1],[6679,6683,1],[6741,6750,1],[6752,6780,1],[6783,6832,49],[6833,6862,1],[6912,6916,1],[6964,6980,1],[7019,7027,1],[7040,7042,1],[7073,7085,
7651],[7142,7155,1],[7204,7223,1],[7376,7378,1],[7380,7400,1],[7405,7412,7],[7415,7417,1],[7616,7679,1],[8400,8432,1],[11503,11505,1],[11647,11744,97],[11745,11775,1],[12330,12335,1],[12441,12442,1],[42607,42610,1],[42612,42621,1],[42654,42655,1],[42736,42737,1],[43010,43014,4],[43019,43043,24],[43044,43047,1],[43052,43136,84],[43137,43188,51],[43189,43205,1],[43232,43249,1],[43263,43302,39],[43303,43309,1],[43335,43347,1],[43392,43395,1],[43443,43456,1],[43493,43561,68],[43562,43574,1],[43587,43596,9],[43597,43643,46],[43644,43645,1],[43696,43698,2],[43699,43700,1],[43703,43704,1],[43710,43711,1],[43713,43755,42],[43756,43759,1],[43765,43766,1],[44003,44010,1],[44012,44013,1],[64286,65024,738],[65025,65039,1],[65056,65071,1],[66045,66272,227],[66422,66426,1],[68097,68099,1],[68101,68102,1],[68108,68111,1],[68152,68154,1],[68159,68325,166],[68326,68900,574],[68901,68903,1],[69291,69292,1],[69373,69375,1],[69446,69456,1],[69506,69509,1],[69632,69634,1],[69688,69702,1],[69744,69747,3],[69748,69759,11],[69760,69762,1],[69808,69818,1],[69826,69888,62],[69889,69890,1],[69927,69940,1],[69957,69958,1],[70003,70016,13],[70017,70018,1],[70067,70080,1],[70089,70092,1],[70094,70095,1],[70188,70199,1],[70206,70209,3],[70367,70378,1],[70400,70403,1],[70459,70460,1],[70462,70468,1],[70471,70472,1],[70475,70477,1],[70487,70498,11],[70499,70502,3],[70503,70508,1],[70512,70516,1],[70709,70726,1],[70750,70832,82],[70833,70851,1],[71087,71093,1],[71096,71104,1],[71132,71133,1],[71216,71232,1],[71339,71351,1],[71453,71467,1],[71724,71738,1],[71984,71989,1],[71991,71992,1],[71995,71998,1],[72e3,72002,2],[72003,72145,142],[72146,72151,1],[72154,72160,1],[72164,72193,29],[72194,72202,1],[72243,72249,1],[72251,72254,1],[72263,72273,10],[72274,72283,1],[72330,72345,1],[72751,72758,1],[72760,72767,1],[72850,72871,1],[72873,72886,1],[73009,73014,1],[73018,73020,2],[73021,73023,2],[73024,73029,1],[73031,73098,67],[73099,73102,1],[73104,73105,1],[73107,73111,1],[73459,73462,1],[73472,73473,1],[73475,73524,49],[73525,73530,1],[73534,73538,1],[78912,78919,7],[78920,78933,1],[92912,92916,1],[92976,92982,1],[94031,94033,2],[94034,94087,1],[94095,94098,1],[94180,94192,12],[94193,113821,19628],[113822,118528,4706],[118529,118573,1],[118576,118598,1],[119141,119145,1],[119149,119154,1],[119163,119170,1],[119173,119179,1],[119210,119213,1],[119362,119364,1],[121344,121398,1],[121403,121452,1],[121461,121476,15],[121499,121503,1],[121505,121519,1],[122880,122886,1],[122888,122904,1],[122907,122913,1],[122915,122916,1],[122918,122922,1],[123023,123184,161],[123185,123190,1],[123566,123628,62],[123629,123631,1],[124140,124143,1],[125136,125142,1],[125252,125258,1],[917760,917999,1]];static foldM=[[921,953,32],[8126,8126,1]];static Mc=[[2307,2363,56],[2366,2368,1],[2377,2380,1],[2382,2383,1],[2434,2435,1],[2494,2496,1],[2503,2504,1],[2507,2508,1],[2519,2563,44],[2622,2624,1],[2691,2750,59],[2751,2752,1],[2761,2763,2],[2764,2818,54],[2819,2878,59],[2880,2887,7],[2888,2891,3],[2892,2903,11],[3006,3007,1],[3009,3010,1],[3014,3016,1],[3018,3020,1],[3031,3073,42],[3074,3075,1],[3137,3140,1],[3202,3203,1],[3262,3264,2],[3265,3268,1],[3271,3272,1],[3274,3275,1],[3285,3286,1],[3315,3330,15],[3331,3390,59],[3391,3392,1],[3398,3400,1],[3402,3404,1],[3415,3458,43],[3459,3535,76],[3536,3537,1],[3544,3551,1],[3570,3571,1],[3902,3903,1],[3967,4139,172],[4140,4145,5],[4152,4155,3],[4156,4182,26],[4183,4194,11],[4195,4196,1],[4199,4205,1],[4227,4228,1],[4231,4236,1],[4239,4250,11],[4251,4252,1],[5909,5940,31],[6070,6078,8],[6079,6085,1],[6087,6088,1],[6435,6438,1],[6441,6443,1],[6448,6449,1],[6451,6456,1],[6681,6682,1],[6741,6743,2],[6753,6755,2],[6756,6765,9],[6766,6770,1],[6916,6965,49],[6971,6973,2],[6974,6977,1],[6979,6980,1],[7042,7073,31],[7078,7079,1],[7082,7143,61],[7146,7148,1],[7150,7154,4],[7155,7204,49],[7205,7211,1],[7220,7221,1],[7393,7415,22],[12334,12335,1],[43043,43044,1],[43047,43136,89],[43137,43188,51],[43189,43203,1],[43346,43347,1],[43395,43444,49],[43445,43450,5],[43451,43454,3],[43455,43456,1],[43567,43568,1],[43571,43572,1],[43597,43643,46],[43645,43755,110],[43758,43759,1],[43765,44003,238],[44004,44006,2],[44007,44009,2],[44010,44012,2],[69632,69634,2],[69762,69808,46],[69809,69810,1],[69815,69816,1],[69932,69957,25],[69958,70018,60],[70067,70069,1],[70079,70080,1],[70094,70188,94],[70189,70190,1],[70194,70195,1],[70197,70368,171],[70369,70370,1],[70402,70403,1],[70462,70463,1],[70465,70468,1],[70471,70472,1],[70475,70477,1],[70487,70498,11],[70499,70709,210],[70710,70711,1],[70720,70721,1],[70725,70832,107],[70833,70834,1],[70841,70843,2],[70844,70846,1],[70849,71087,238],[71088,71089,1],[71096,71099,1],[71102,71216,114],[71217,71218,1],[71227,71228,1],[71230,71340,110],[71342,71343,1],[71350,71456,106],[71457,71462,5],[71724,71726,1],[71736,71984,248],[71985,71989,1],[71991,71992,1],[71997,72e3,3],[72002,72145,143],[72146,72147,1],[72156,72159,1],[72164,72249,85],[72279,72280,1],[72343,72751,408],[72766,72873,107],[72881,72884,3],[73098,73102,1],[73107,73108,1],[73110,73461,351],[73462,73475,13],[73524,73525,1],[73534,73535,1],[73537,94033,20496],[94034,94087,1],[94192,94193,1],[119141,119142,1],[119149,119154,1]];static Me=[[1160,1161,1],[6846,8413,1567],[8414,8416,1],[8418,8420,1],[42608,42610,1]];static Mn=[[768,879,1],[1155,1159,1],[1425,1469,1],[1471,1473,2],[1474,1476,2],[1477,1479,2],[1552,1562,1],[1611,1631,1],[1648,1750,102],[1751,1756,1],[1759,1764,1],[1767,1768,1],[1770,1773,1],[1809,1840,31],[1841,1866,1],[1958,1968,1],[2027,2035,1],[2045,2070,25],[2071,2073,1],[2075,2083,1],[2085,2087,
7651],[2089,2093,1],[2137,2139,1],[2200,2207,1],[2250,2273,1],[2275,2306,1],[2362,2364,2],[2369,2376,1],[2381,2385,4],[2386,2391,1],[2402,2403,1],[2433,2492,59],[2497,2500,1],[2509,2530,21],[2531,2558,27],[2561,2562,1],[2620,2625,5],[2626,2631,5],[2632,2635,3],[2636,2637,1],[2641,2672,31],[2673,2677,4],[2689,2690,1],[2748,2753,5],[2754,2757,1],[2759,2760,1],[2765,2786,21],[2787,2810,23],[2811,2815,1],[2817,2876,59],[2879,2881,2],[2882,2884,1],[2893,2901,8],[2902,2914,12],[2915,2946,31],[3008,3021,13],[3072,3076,4],[3132,3134,2],[3135,3136,1],[3142,3144,1],[3146,3149,1],[3157,3158,1],[3170,3171,1],[3201,3260,59],[3263,3270,7],[3276,3277,1],[3298,3299,1],[3328,3329,1],[3387,3388,1],[3393,3396,1],[3405,3426,21],[3427,3457,30],[3530,3538,8],[3539,3540,1],[3542,3633,91],[3636,3642,1],[3655,3662,1],[3761,3764,3],[3765,3772,1],[3784,3790,1],[3864,3865,1],[3893,3897,2],[3953,3966,1],[3968,3972,1],[3974,3975,1],[3981,3991,1],[3993,4028,1],[4038,4141,103],[4142,4144,1],[4146,4151,1],[4153,4154,1],[4157,4158,1],[4184,4185,1],[4190,4192,1],[4209,4212,1],[4226,4229,3],[4230,4237,7],[4253,4957,704],[4958,4959,1],[5906,5908,1],[5938,5939,1],[5970,5971,1],[6002,6003,1],[6068,6069,1],[6071,6077,1],[6086,6089,3],[6090,6099,1],[6109,6155,46],[6156,6157,1],[6159,6277,118],[6278,6313,35],[6432,6434,1],[6439,6440,1],[6450,6457,7],[6458,6459,1],[6679,6680,1],[6683,6742,59],[6744,6750,1],[6752,6754,2],[6757,6764,1],[6771,6780,1],[6783,6832,49],[6833,6845,1],[6847,6862,1],[6912,6915,1],[6964,6966,2],[6967,6970,1],[6972,6978,6],[7019,7027,1],[7040,7041,1],[7074,7077,1],[7080,7081,1],[7083,7085,1],[7142,7144,2],[7145,7149,4],[7151,7153,1],[7212,7219,1],[7222,7223,1],[7376,7378,1],[7380,7392,1],[7394,7400,1],[7405,7412,7],[7416,7417,1],[7616,7679,1],[8400,8412,1],[8417,8421,4],[8422,8432,1],[11503,11505,1],[11647,11744,97],[11745,11775,1],[12330,12333,1],[12441,12442,1],[42607,42612,5],[42613,42621,1],[42654,42655,1],[42736,42737,1],[43010,43014,4],[43019,43045,26],[43046,43052,6],[43204,43205,1],[43232,43249,1],[43263,43302,39],[43303,43309,1],[43335,43345,1],[43392,43394,1],[43443,43446,3],[43447,43449,1],[43452,43453,1],[43493,43561,68],[43562,43566,1],[43569,43570,1],[43573,43574,1],[43587,43596,9],[43644,43696,52],[43698,43700,1],[43703,43704,1],[43710,43711,1],[43713,43756,43],[43757,43766,9],[44005,44008,3],[44013,64286,20273],[65024,65039,1],[65056,65071,1],[66045,66272,227],[66422,66426,1],[68097,68099,1],[68101,68102,1],[68108,68111,1],[68152,68154,1],[68159,68325,166],[68326,68900,574],[68901,68903,1],[69291,69292,1],[69373,69375,1],[69446,69456,1],[69506,69509,1],[69633,69688,55],[69689,69702,1],[69744,69747,3],[69748,69759,11],[69760,69761,1],[69811,69814,1],[69817,69818,1],[69826,69888,62],[69889,69890,1],[69927,69931,1],[69933,69940,1],[70003,70016,13],[70017,70070,53],[70071,70078,1],[70089,70092,1],[70095,70191,96],[70192,70193,1],[70196,70198,2],[70199,70206,7],[70209,70367,158],[70371,70378,1],[70400,70401,1],[70459,70460,1],[70464,70502,38],[70503,70508,1],[70512,70516,1],[70712,70719,1],[70722,70724,1],[70726,70750,24],[70835,70840,1],[70842,70847,5],[70848,70850,2],[70851,71090,239],[71091,71093,1],[71100,71101,1],[71103,71104,1],[71132,71133,1],[71219,71226,1],[71229,71231,2],[71232,71339,107],[71341,71344,3],[71345,71349,1],[71351,71453,102],[71454,71455,1],[71458,71461,1],[71463,71467,1],[71727,71735,1],[71737,71738,1],[71995,71996,1],[71998,72003,5],[72148,72151,1],[72154,72155,1],[72160,72193,33],[72194,72202,1],[72243,72248,1],[72251,72254,1],[72263,72273,10],[72274,72278,1],[72281,72283,1],[72330,72342,1],[72344,72345,1],[72752,72758,1],[72760,72765,1],[72767,72850,83],[72851,72871,1],[72874,72880,1],[72882,72883,1],[72885,72886,1],[73009,73014,1],[73018,73020,2],[73021,73023,2],[73024,73029,1],[73031,73104,73],[73105,73109,4],[73111,73459,348],[73460,73472,12],[73473,73526,53],[73527,73530,1],[73536,73538,2],[78912,78919,7],[78920,78933,1],[92912,92916,1],[92976,92982,1],[94031,94095,64],[94096,94098,1],[94180,113821,19641],[113822,118528,4706],[118529,118573,1],[118576,118598,1],[119143,119145,1],[119163,119170,1],[119173,119179,1],[119210,119213,1],[119362,119364,1],[121344,121398,1],[121403,121452,1],[121461,121476,15],[121499,121503,1],[121505,121519,1],[122880,122886,1],[122888,122904,1],[122907,122913,1],[122915,122916,1],[122918,122922,1],[123023,123184,161],[123185,123190,1],[123566,123628,62],[123629,123631,1],[124140,124143,1],[125136,125142,1],[125252,125258,1],[917760,917999,1]];static foldMn=[[921,953,32],[8126,8126,1]];static N=[[48,57,1],[178,179,1],[185,188,3],[189,190,1],[1632,1641,1],[1776,1785,1],[1984,1993,1],[2406,2415,1],[2534,2543,1],[2548,2553,1],[2662,2671,1],[2790,2799,1],[2918,2927,1],[2930,2935,1],[3046,3058,1],[3174,3183,1],[3192,3198,1],[3302,3311,1],[3416,3422,1],[3430,3448,1],[3558,3567,1],[3664,3673,1],[3792,3801,1],[3872,3891,1],[4160,4169,1],[4240,4249,1],[4969,4988,1],[5870,5872,1],[6112,6121,1],[6128,6137,1],[6160,6169,1],[6470,6479,1],[6608,6618,1],[6784,6793,1],[6800,6809,1],[6992,7001,1],[7088,7097,1],[7232,7241,1],[7248,7257,1],[8304,8308,4],[8309,8313,1],[8320,8329,1],[8528,8578,1],[8581,8585,1],[9312,9371,1],[9450,9471,1],[10102,10131,1],[11517,12295,778],[12321,12329,1],[12344,12346,1],[12690,12693,1],[12832,12841,1],[12872,12879,1],[12881,12895,1],[12928,12937,1],[12977,12991,1],[42528,42537,1],[42726,42735,1],[43056,43061,1],[43216,43225,1],[43264,43273,1],[43472,43481,1],[43504,43513,1],[43600,43609,1],[44016,44025,1],[65296,65305,1],[65799,65843,1],[65856,65912,1],[65930,65931,1],[66273,66299,1],[66336,66339,1],[66369,66378,9],[66513,66517,1],[66720,66729,1],[67672,67679,1],[67705,67711,1],[67751,67759,1],[67835,67839,1],[67862,67867,1],[68028,68029,1],[68032,68047,1],[68050,68095,1],[68160,68168,1],[68221,68222,1],[68253,68255,1],[68331,68335,1],[68440,68447,1],[68472,68479,1],[68521,68527,1],[68858,68863,1],[68912,68921,1],[69216,69246,1],[69405,69414,1],[69457,69460,1],[69573,69579,1],[69714,69743,1],[69872,69881,1],[69942,69951,1],[70096,70105,1],[70113,70132,1],[70384,70393,1],[70736,70745,1],[70864,70873,1],[71248,71257,1],[71360,71369,1],[71472,71483,1],[71904,71922,1],[72016,72025,1],[72784,72812,1],[73040,73049,1],[73120,73129,1],[73552,73561,1],[73664,73684,1],[74752,74862,1],[92768,92777,1],[92864,92873,1],[93008,93017,1],[93019,93025,1],[93824,93846,1],[119488,119507,1],[119520,119539,1],[119648,119672,1],[120782,120831,1],[123200,123209,1],[123632,123641,1],[124144,124153,1],[125127,125135,1],[125264,125273,1],[126065,126123,1],[126125,126127,1],[126129,126132,1],[126209,126253,1],[126255,126269,1],[127232,127244,1],[130032,130041,1]];static Nd=[[48,57,1],[1632,1641,1],[1776,1785,1],[1984,1993,1],[2406,2415,1],[2534,2543,1],[2662,2671,1],[2790,2799,1],[2918,2927,1],[3046,3055,1],[3174,3183,1],[3302,3311,1],[3430,3439,1],[3558,3567,1],[3664,3673,1],[3792,3801,1],[3872,3881,1],[4160,4169,1],[4240,4249,1],[6112,6121,1],[6160,6169,1],[6470,6479,1],[6608,6617,1],[6784,6793,1],[6800,6809,1],[6992,7001,1],[7088,7097,1],[7232,7241,1],[7248,7257,1],[42528,42537,1],[43216,43225,1],[43264,43273,1],[43472,43481,1],[43504,43513,1],[43600,43609,1],[44016,44025,1],[65296,65305,1],[66720,66729,1],[68912,68921,1],[69734,69743,1],[69872,69881,1],[69942,69951,1],[70096,70105,1],[70384,70393,1],[70736,70745,1],[70864,70873,1],[71248,71257,1],[71360,71369,1],[71472,71481,1],[71904,71913,1],[72016,72025,1],[72784,72793,1],[73040,73049,1],[73120,73129,1],[73552,73561,1],[92768,92777,1],[92864,92873,1],[93008,93017,1],[120782,120831,1],[123200,123209,1],[123632,123641,1],[124144,124153,1],[125264,125273,1],[130032,130041,1]];static Nl=[[5870,5872,1],[8544,8578,1],[8581,8584,1],[12295,12321,26],[12322,12329,1],[12344,12346,1],[42726,42735,1],[65856,65908,1],[66369,66378,9],[66513,66517,1],[74752,74862,1]];
765static No=[[178,179,1],[185,188,3],[189,190,1],[2548,2553,1],[2930,2935,1],[3056,3058,1],[3192,3198,1],[3416,3422,1],[3440,3448,1],[3882,3891,1],[4969,4988,1],[6128,6137,1],[6618,8304,1686],[8308,8313,1],[8320,8329,1],[8528,8543,1],[8585,9312,727],[9313,9371,1],[9450,9471,1],[10102,10131,1],[11517,12690,1173],[12691,12693,1],[12832,12841,1],[12872,12879,1],[12881,12895,1],[12928,12937,1],[12977,12991,1],[43056,43061,1],[65799,65843,1],[65909,65912,1],[65930,65931,1],[66273,66299,1],[66336,66339,1],[67672,67679,1],[67705,67711,1],[67751,67759,1],[67835,67839,1],[67862,67867,1],[68028,68029,1],[68032,68047,1],[68050,68095,1],[68160,68168,1],[68221,68222,1],[68253,68255,1],[68331,68335,1],[68440,68447,1],[68472,68479,1],[68521,68527,1],[68858,68863,1],[69216,69246,1],[69405,69414,1],[69457,69460,1],[69573,69579,1],[69714,69733,1],[70113,70132,1],[71482,71483,1],[71914,71922,1],[72794,72812,1],[73664,73684,1],[93019,93025,1],[93824,93846,1],[119488,119507,1],[119520,119539,1],[119648,119672,1],[125127,125135,1],[126065,126123,1],[126125,126127,1],[126129,126132,1],[126209,126253,1],[126255,126269,1],[127232,127244,1]];static P=[[33,35,1],[37,42,1],[44,47,1],[58,59,1],[63,64,1],[91,93,1],[95,123,28],[125,161,36],[167,171,4],[182,183,1],[187,191,4],[894,903,9],[1370,1375,1],[1417,1418,1],[1470,1472,2],[1475,1478,3],[1523,1524,1],[1545,1546,1],[1548,1549,1],[1563,1565,2],[1566,1567,1],[1642,1645,1],[1748,1792,44],[1793,1805,1],[2039,2041,1],[2096,2110,1],[2142,2404,262],[2405,2416,11],[2557,2678,121],[2800,3191,391],[3204,3572,368],[3663,3674,11],[3675,3844,169],[3845,3858,1],[3860,3898,38],[3899,3901,1],[3973,4048,75],[4049,4052,1],[4057,4058,1],[4170,4175,1],[4347,4960,613],[4961,4968,1],[5120,5742,622],[5787,5788,1],[5867,5869,1],[5941,5942,1],[6100,6102,1],[6104,6106,1],[6144,6154,1],[6468,6469,1],[6686,6687,1],[6816,6822,1],[6824,6829,1],[7002,7008,1],[7037,7038,1],[7164,7167,1],[7227,7231,1],[7294,7295,1],[7360,7367,1],[7379,8208,829],[8209,8231,1],[8240,8259,1],[8261,8273,1],[8275,8286,1],[8317,8318,1],[8333,8334,1],[8968,8971,1],[9001,9002,1],[10088,10101,1],[10181,10182,1],[10214,10223,1],[10627,10648,1],[10712,10715,1],[10748,10749,1],[11513,11516,1],[11518,11519,1],[11632,11776,144],[11777,11822,1],[11824,11855,1],[11858,11869,1],[12289,12291,1],[12296,12305,1],[12308,12319,1],[12336,12349,13],[12448,12539,91],[42238,42239,1],[42509,42511,1],[42611,42622,11],[42738,42743,1],[43124,43127,1],[43214,43215,1],[43256,43258,1],[43260,43310,50],[43311,43359,48],[43457,43469,1],[43486,43487,1],[43612,43615,1],[43742,43743,1],[43760,43761,1],[44011,64830,20819],[64831,65040,209],[65041,65049,1],[65072,65106,1],[65108,65121,1],[65123,65128,5],[65130,65131,1],[65281,65283,1],[65285,65290,1],[65292,65295,1],[65306,65307,1],[65311,65312,1],[65339,65341,1],[65343,65371,28],[65373,65375,2],[65376,65381,1],[65792,65794,1],[66463,66512,49],[66927,67671,744],[67871,67903,32],[68176,68184,1],[68223,68336,113],[68337,68342,1],[68409,68415,1],[68505,68508,1],[69293,69461,168],[69462,69465,1],[69510,69513,1],[69703,69709,1],[69819,69820,1],[69822,69825,1],[69952,69955,1],[70004,70005,1],[70085,70088,1],[70093,70107,14],[70109,70111,1],[70200,70205,1],[70313,70731,418],[70732,70735,1],[70746,70747,1],[70749,70854,105],[71105,71127,1],[71233,71235,1],[71264,71276,1],[71353,71484,131],[71485,71486,1],[71739,72004,265],[72005,72006,1],[72162,72255,93],[72256,72262,1],[72346,72348,1],[72350,72354,1],[72448,72457,1],[72769,72773,1],[72816,72817,1],[73463,73464,1],[73539,73551,1],[73727,74864,1137],[74865,74868,1],[77809,77810,1],[92782,92783,1],[92917,92983,66],[92984,92987,1],[92996,93847,851],[93848,93850,1],[94178,113823,19645],[121479,121483,1],[125278,125279,1]];static Pc=[[95,8255,8160],[8256,8276,20],[65075,65076,1],[65101,65103,1],[65343,65343,1]];static Pd=[[45,1418,1373],[1470,5120,3650],[6150,8208,2058],[8209,8213,1],[11799,11802,3],[11834,11835,1],[11840,11869,29],[12316,12336,20],[12448,65073,52625],[65074,65112,38],[65123,65293,170],[69293,69293,1]];static Pe=[[41,93,52],[125,3899,3774],[3901,5788,1887],[8262,8318,56],[8334,8969,635],[8971,9002,31],[10089,10101,2],[10182,10215,33],[10217,10223,2],[10628,10648,2],[10713,10715,2],[10749,11811,1062],[11813,11817,2],[11862,11868,2],[12297,12305,2],[12309,12315,2],[12318,12319,1],[64830,65048,218],[65078,65092,2],[65096,65114,18],[65116,65118,2],[65289,65341,52],[65373,65379,3]];static Pf=[[187,8217,8030],[8221,8250,29],[11779,11781,2],[11786,11789,3],[11805,11809,4]];static Pi=[[171,8216,8045],[8219,8220,1],[8223,8249,26],[11778,11780,2],[11785,11788,3],[11804,11808,4]];static Po=[[33,35,1],[37,39,1],[42,46,2],[47,58,11],[59,63,4],[64,92,28],[161,167,6],[182,183,1],[191,894,703],[903,1370,467],[1371,1375,1],[1417,1472,55],[1475,1478,3],[1523,1524,1],[1545,1546,1],[1548,1549,1],[1563,1565,2],[1566,1567,1],[1642,1645,1],[1748,1792,44],[1793,1805,1],[2039,2041,1],[2096,2110,1],[2142,2404,262],[2405,2416,11],[2557,2678,121],[2800,3191,391],[3204,3572,3
76568],[3663,3674,11],[3675,3844,169],[3845,3858,1],[3860,3973,113],[4048,4052,1],[4057,4058,1],[4170,4175,1],[4347,4960,613],[4961,4968,1],[5742,5867,125],[5868,5869,1],[5941,5942,1],[6100,6102,1],[6104,6106,1],[6144,6149,1],[6151,6154,1],[6468,6469,1],[6686,6687,1],[6816,6822,1],[6824,6829,1],[7002,7008,1],[7037,7038,1],[7164,7167,1],[7227,7231,1],[7294,7295,1],[7360,7367,1],[7379,8214,835],[8215,8224,9],[8225,8231,1],[8240,8248,1],[8251,8254,1],[8257,8259,1],[8263,8273,1],[8275,8277,2],[8278,8286,1],[11513,11516,1],[11518,11519,1],[11632,11776,144],[11777,11782,5],[11783,11784,1],[11787,11790,3],[11791,11798,1],[11800,11801,1],[11803,11806,3],[11807,11818,11],[11819,11822,1],[11824,11833,1],[11836,11839,1],[11841,11843,2],[11844,11855,1],[11858,11860,1],[12289,12291,1],[12349,12539,190],[42238,42239,1],[42509,42511,1],[42611,42622,11],[42738,42743,1],[43124,43127,1],[43214,43215,1],[43256,43258,1],[43260,43310,50],[43311,43359,48],[43457,43469,1],[43486,43487,1],[43612,43615,1],[43742,43743,1],[43760,43761,1],[44011,65040,21029],[65041,65046,1],[65049,65072,23],[65093,65094,1],[65097,65100,1],[65104,65106,1],[65108,65111,1],[65119,65121,1],[65128,65130,2],[65131,65281,150],[65282,65283,1],[65285,65287,1],[65290,65294,2],[65295,65306,11],[65307,65311,4],[65312,65340,28],[65377,65380,3],[65381,65792,411],[65793,65794,1],[66463,66512,49],[66927,67671,744],[67871,67903,32],[68176,68184,1],[68223,68336,113],[68337,68342,1],[68409,68415,1],[68505,68508,1],[69461,69465,1],[69510,69513,1],[69703,69709,1],[69819,69820,1],[69822,69825,1],[69952,69955,1],[70004,70005,1],[70085,70088,1],[70093,70107,14],[70109,70111,1],[70200,70205,1],[70313,70731,418],[70732,70735,1],[70746,70747,1],[70749,70854,105],[71105,71127,1],[71233,71235,1],[71264,71276,1],[71353,71484,131],[71485,71486,1],[71739,72004,265],[72005,72006,1],[72162,72255,93],[72256,72262,1],[72346,72348,1],[72350,72354,1],[72448,72457,1],[72769,72773,1],[72816,72817,1],[73463,73464,1],[73539,73551,1],[73727,74864,1137],[74865,74868,1],[77809,77810,1],[92782,92783,1],[92917,92983,66],[92984,92987,1],[92996,93847,851],[93848,93850,1],[94178,113823,19645],[121479,121483,1],[125278,125279,1]];static Ps=[[40,91,51],[123,3898,3775],[3900,5787,1887],[8218,8222,4],[8261,8317,56],[8333,8968,635],[8970,9001,31],[10088,10100,2],[10181,10214,33],[10216,10222,2],[10627,10647,2],[10712,10714,2],[10748,11810,1062],[11812,11816,2],[11842,11861,19],[11863,11867,2],[12296,12304,2],[12308,12314,2],[12317,64831,52514],[65047,65077,30],[65079,65091,2],[65095,65113,18],[65115,65117,2],[65288,65339,51],[65371,65375,4],[65378,65378,1]];static S=[[36,43,7],[60,62,1],[94,96,2],[124,126,2],[162,166,1],[168,169,1],[172,174,2],[175,177,1],[180,184,4],[215,247,32],[706,709,1],[722,735,1],[741,747,1],[749,751,2],[752,767,1],[885,900,15],[901,1014,113],[1154,1421,267],[1422,1423,1],[1542,1544,1],[1547,1550,3],[1551,1758,207],[1769,1789,20],[1790,2038,248],[2046,2047,1],[2184,2546,362],[2547,2554,7],[2555,2801,246],[2928,3059,131],[3060,3066,1],[3199,3407,208],[3449,3647,198],[3841,3843,1],[3859,3861,2],[3862,3863,1],[3866,3871,1],[3892,3896,2],[4030,4037,1],[4039,4044,1],[4046,4047,1],[4053,4056,1],[4254,4255,1],[5008,5017,1],[5741,6107,366],[6464,6622,158],[6623,6655,1],[7009,7018,1],[7028,7036,1],[8125,8127,2],[8128,8129,1],[8141,8143,1],[8157,8159,1],[8173,8175,1],[8189,8190,1],[8260,8274,14],[8314,8316,1],[8330,8332,1],[8352,8384,1],[8448,8449,1],[8451,8454,1],[8456,8457,1],[8468,8470,2],[8471,8472,1],[8478,8483,1],[8485,8489,2],[8494,8506,12],[8507,8512,5],[8513,8516,1],[8522,8525,1],[8527,8586,59],[8587,8592,5],[8593,8967,1],[8972,9e3,1],[9003,9254,1],[9280,9290,1],[9372,9449,1],[9472,10087,1],[10132,10180,1],[10183,10213,1],[10224,10626,1],[10649,10711,1],[10716,10747,1],[10750,11123,1],[11126,11157,1],[11159,11263,1],[11493,11498,1],[11856,11857,1],[11904,11929,1],[11931,12019,1],[12032,12245,1],[12272,12287,1],[12292,12306,14],[12307,12320,13],[12342,12343,1],[12350,12351,1],[12443,12444,1],[12688,12689,1],[12694,12703,1],[12736,12771,1],[12783,12800,17],[12801,12830,1],[12842,12871,1],[12880,12896,16],[12897,12927,1],[12938,12976,
7651],[12992,13311,1],[19904,19967,1],[42128,42182,1],[42752,42774,1],[42784,42785,1],[42889,42890,1],[43048,43051,1],[43062,43065,1],[43639,43641,1],[43867,43882,15],[43883,64297,20414],[64434,64450,1],[64832,64847,1],[64975,65020,45],[65021,65023,1],[65122,65124,2],[65125,65126,1],[65129,65284,155],[65291,65308,17],[65309,65310,1],[65342,65344,2],[65372,65374,2],[65504,65510,1],[65512,65518,1],[65532,65533,1],[65847,65855,1],[65913,65929,1],[65932,65934,1],[65936,65948,1],[65952,66e3,48],[66001,66044,1],[67703,67704,1],[68296,71487,3191],[73685,73713,1],[92988,92991,1],[92997,113820,20823],[118608,118723,1],[118784,119029,1],[119040,119078,1],[119081,119140,1],[119146,119148,1],[119171,119172,1],[119180,119209,1],[119214,119274,1],[119296,119361,1],[119365,119552,187],[119553,119638,1],[120513,120539,26],[120571,120597,26],[120629,120655,26],[120687,120713,26],[120745,120771,26],[120832,121343,1],[121399,121402,1],[121453,121460,1],[121462,121475,1],[121477,121478,1],[123215,123647,432],[126124,126128,4],[126254,126704,450],[126705,126976,271],[126977,127019,1],[127024,127123,1],[127136,127150,1],[127153,127167,1],[127169,127183,1],[127185,127221,1],[127245,127405,1],[127462,127490,1],[127504,127547,1],[127552,127560,1],[127568,127569,1],[127584,127589,1],[127744,128727,1],[128732,128748,1],[128752,128764,1],[128768,128886,1],[128891,128985,1],[128992,129003,1],[129008,129024,16],[129025,129035,1],[129040,129095,1],[129104,129113,1],[129120,129159,1],[129168,129197,1],[129200,129201,1],[129280,129619,1],[129632,129645,1],[129648,129660,1],[129664,129672,1],[129680,129725,1],[129727,129733,1],[129742,129755,1],[129760,129768,1],[129776,129784,1],[129792,129938,1],[129940,129994,1]];static Sc=[[36,162,126],[163,165,1],[1423,1547,124],[2046,2047,1],[2546,2547,1],[2555,2801,246],[3065,3647,582],[6107,8352,2245],[8353,8384,1],[43064,65020,21956],[65129,65284,155],[65504,65505,1],[65509,65510,1],[73693,73696,1],[123647,126128,2481]];static Sk=[[94,96,2],[168,175,7],[180,184,4],[706,709,1],[722,735,1],[741,747,1],[749,751,2],[752,767,1],[885,900,15],[901,2184,1283],[8125,8127,2],[8128,8129,1],[8141,8143,1],[8157,8159,1],[8173,8175,1],[8189,8190,1],[12443,12444,1],[42752,42774,1],[42784,42785,1],[42889,42890,1],[43867,43882,15],[43883,64434,20551],[64435,64450,1],[65342,65344,2],[65507,127995,62488],[127996,127999,1]];static Sm=[[43,60,17],[61,62,1],[124,126,2],[172,177,5],[215,247,32],[1014,1542,528],[1543,1544,1],[8260,8274,14],[8314,8316,1],[8330,8332,1],[8472,8512,40],[8513,8516,1],[8523,8592,69],[8593,8596,1],[8602,8603,1],[8608,8614,3],[8622,8654,32],[8655,8658,3],[8660,8692,32],[8693,8959,1],[8992,8993,1],[9084,9115,31],[9116,9139,1],[9180,9185,1],[9655,9665,10],[9720,9727,1],[9839,10176,337],[10177,10180,1],[10183,10213,1],[10224,10239,1],[10496,10626,1],[10649,10711,1],[10716,10747,1],[10750,11007,1],[11056,11076,1],[11079,11084,1],[64297,65122,825],[65124,65126,1],[65291,65308,17],[65309,65310,1],[65372,65374,2],[65506,65513,7],[65514,65516,1],[120513,120539,26],[120571,120597,26],[120629,120655,26],[120687,120713,26],[120745,120771,26],[126704,126705,1]];static So=[[166,169,3],[174,176,2],[1154,1421,267],[1422,1550,128],[1551,1758,207],[1769,1789,20],[1790,2038,248],[2554,2928,374],[3059,3064,1],[3066,3199,133],[3407,3449,42],[3841,3843,1],[3859,3861,2],[3862,3863,1],[3866,3871,1],[3892,3896,2],[4030,4037,1],[4039,4044,1],[4046,4047,1],[4053,4056,1],[4254,4255,1],[5008,5017,1],[5741,6464,723],[6622,6655,1],[7009,7018,1],[7028,7036,1],[8448,8449,1],[8451,8454,1],[8456,8457,1],[8468,8470,2],[8471,8478,7],[8479,8483,1],[8485,8489,2],[8494,8506,12],[8507,8522,15],[8524,8525,1],[8527,8586,59],[8587,8597,10],[8598,8601,1],[8604,8607,1],[8609,8610,1],[8612,8613,1],[8615,8621,1],[8623,8653,1],[8656,8657,1],[8659,8661,2],[8662,8691,1],[8960,8967,1],[8972,8991,1],[8994,9e3,1],[9003,9083,1],[9085,9114,1],[9140,9179,1],[9186,9254,1],[9280,9290,1],[9372,9449,1],[9472,9654,1],[9656,9664,1],[9666,9719,1],[9728,9838,1],[9840,10087,1],[10132,10175,1],[10240,10495,1],[11008,11055,1],[11077,11078,1],[11085,11123,1],[11126,11157,1],[11159,11263,1],[11493,11498,1],[11856,11857,1],[11904,11929,1],[11931,12019,1],[12032,12245,1],[12272,12287,1],[12292,12306,14],[12307,12320,13],[12342,12343,1],[12350,12351,1],[12688,12689,1],[12694,12703,1],[12736,12771,1],[12783,12800,17],[12801,12830,1],[12842,12871,1],[12880,12896,16],[12897,12927,1],[12938,12976,
7651],[12992,13311,1],[19904,19967,1],[42128,42182,1],[43048,43051,1],[43062,43063,1],[43065,43639,574],[43640,43641,1],[64832,64847,1],[64975,65021,46],[65022,65023,1],[65508,65512,4],[65517,65518,1],[65532,65533,1],[65847,65855,1],[65913,65929,1],[65932,65934,1],[65936,65948,1],[65952,66e3,48],[66001,66044,1],[67703,67704,1],[68296,71487,3191],[73685,73692,1],[73697,73713,1],[92988,92991,1],[92997,113820,20823],[118608,118723,1],[118784,119029,1],[119040,119078,1],[119081,119140,1],[119146,119148,1],[119171,119172,1],[119180,119209,1],[119214,119274,1],[119296,119361,1],[119365,119552,187],[119553,119638,1],[120832,121343,1],[121399,121402,1],[121453,121460,1],[121462,121475,1],[121477,121478,1],[123215,126124,2909],[126254,126976,722],[126977,127019,1],[127024,127123,1],[127136,127150,1],[127153,127167,1],[127169,127183,1],[127185,127221,1],[127245,127405,1],[127462,127490,1],[127504,127547,1],[127552,127560,1],[127568,127569,1],[127584,127589,1],[127744,127994,1],[128e3,128727,1],[128732,128748,1],[128752,128764,1],[128768,128886,1],[128891,128985,1],[128992,129003,1],[129008,129024,16],[129025,129035,1],[129040,129095,1],[129104,129113,1],[129120,129159,1],[129168,129197,1],[129200,129201,1],[129280,129619,1],[129632,129645,1],[129648,129660,1],[129664,129672,1],[129680,129725,1],[129727,129733,1],[129742,129755,1],[129760,129768,1],[129776,129784,1],[129792,129938,1],[129940,129994,1]];static Z=[[32,160,128],[5760,8192,2432],[8193,8202,1],[8232,8233,1],[8239,8287,48],[12288,12288,1]];static Zl=[[8232,8232,1]];static Zp=[[8233,8233,1]];static Zs=[[32,160,128],[5760,8192,2432],[8193,8202,1],[8239,8287,48],[12288,12288,1]];static Adlam=[[125184,125259,1],[125264,125273,1],[125278,125279,1]];static Ahom=[[71424,71450,1],[71453,71467,1],[71472,71494,1]];static Anatolian_Hieroglyphs=[[82944,83526,1]];static Arabic=[[1536,1540,1],[1542,1547,1],[1549,1562,1],[1564,1566,1],[1568,1599,1],[1601,1610,1],[1622,1647,1],[1649,1756,1],[1758,1791,1],[1872,1919,1],[2160,2190,1],[2192,2193,1],[2200,2273,1],[2275,2303,1],[64336,64450,1],[64467,64829,1],[64832,64911,1],[64914,64967,1],[64975,65008,33],[65009,65023,1],[65136,65140,1],[65142,65276,1],[69216,69246,1],[69373,69375,1],[126464,126467,1],[126469,126495,1],[126497,126498,1],[126500,126503,3],[126505,126514,1],[126516,126519,1],[126521,126523,2],[126530,126535,5],[126537,126541,2],[126542,126543,1],[126545,126546,1],[126548,126551,3],[126553,126561,2],[126562,126564,2],[126567,126570,1],[126572,126578,1],[126580,126583,1],[126585,126588,1],[126590,126592,2],[126593,126601,1],[126603,126619,1],[126625,126627,1],[126629,126633,1],[126635,126651,1],[126704,126705,1]];static Armenian=[[1329,1366,1],[1369,1418,1],[1421,1423,1],[64275,64279,1]];static Avestan=[[68352,68405,1],[68409,68415,1]];static Balinese=[[6912,6988,1],[6992,7038,1]];static Bamum=[[42656,42743,1],[92160,92728,1]];static Bassa_Vah=[[92880,92909,1],[92912,92917,1]];static Batak=[[7104,7155,1],[7164,7167,1]];static Bengali=[[2432,2435,1],[2437,2444,1],[2447,2448,1],[2451,2472,1],[2474,2480,1],[2482,2486,4],[2487,2489,1],[2492,2500,1],[2503,2504,1],[2507,2510,1],[2519,2524,5],[2525,2527,2],[2528,2531,1],[2534,2558,1]];static Bhaiksuki=[[72704,72712,1],[72714,72758,1],[72760,72773,1],[72784,72812,1]];static Bopomofo=[[746,747,1],[12549,12591,1],[12704,12735,1]];static Brahmi=[[69632,69709,1],[69714,69749,1],[69759,69759,1]];static Braille=[[10240,10495,1]];static Buginese=[[6656,6683,1],[6686,6687,1]];static Buhid=[[5952,5971,1]];static Canadian_Aboriginal=[[5120,5759,1],[6320,6389,1],[72368,72383,1]];static Carian=[[66208,66256,1]];static Caucasian_Albanian=[[66864,66915,1],[66927,66927,1]];static Chakma=[[69888,69940,1],[69942,69959,1]];static Cham=[[43520,43574,1],[43584,43597,1],[43600,43609,1],[43612,43615,1]];static Cherokee=[[5024,5109,1],[5112,5117,1],[43888,43967,1]];static Chorasmian=[[69552,69579,1]];static Common=[[0,64,1],[91,96,1],[123,169,1],[171,185,1],[187,191,1],[215,247,32],[697,735,1],[741,745,1],[748,767,1],[884,894,10],[901,903,2],[1541,1548,7],[1563,1567,4],[1600,1757,157],[2274,2404,130],[2405,3647,1242],[4053,4056,1],[4347,5867,1520],[5868,5869,1],[5941,5942,1],[6146,6147,1],[6149,7379,1230],[7393,7401,8],[7402,7404,1],[7406,7411,1],[7413,7415,1],[7418,8192,774],[8193,8203,1],[8206,8292,1],[8294,8304,1],[8308,8318,1],[8320,8334,1],[8352,8384,1],[8448,8485,1],[8487,8489,1],[8492,8497,1],[8499,8525,1],[8527,8543,1],[8585,8587,1],[8592,9254,1],[9280,9290,1],[9312,10239,1],[10496,11123,1],[11126,11157,1],[11159,11263,1],[11776,11869,1],[12272,12292,1],[12294,12296,2],[12297,12320,1],[12336,12343,1],[12348,12351,1],[12443,12444,1],[12448,12539,91],[12540,12688,148],[12689,12703,1],[12736,12771,1],[12783,12832,49],[12833,12895,1],[12927,13007,1],[13055,13144,89],[13145,13311,1],[19904,19967,1],[42752,42785,1],[42888,42890,1],[43056,43065,1],[43310,43471,161],[43867,43882,15],[43883,64830,20947],[64831,65040,209],[65041,65049,1],[65072,65106,1],[65108,65126,1],[65128,65131,1],[65279,65281,2],[65282,65312,1],[65339,65344,1],[65371,65381,1],[65392,65438,46],[65439,65504,65],[65505,65510,1],[65512,65518,1],[65529,65533,1],[65792,65794,1],[65799,65843,1],[65847,65855,1],[65936,65948,1],[66e3,66044,1],[66273,66299,1],[113824,113827,1],[118608,118723,1],[118784,119029,1],[119040,119078,1],[119081,119142,1],[119146,119162,1],[119171,119172,1],[119180,119209,1],[119214,119274,1],[119488,119507,1],[119520,119539,1],[119552,119638,1],[119648,119672,1],[119808,119892,1],[119894,119964,1],[119966,119967,1],[119970,
765119973,3],[119974,119977,3],[119978,119980,1],[119982,119993,1],[119995,119997,2],[119998,120003,1],[120005,120069,1],[120071,120074,1],[120077,120084,1],[120086,120092,1],[120094,120121,1],[120123,120126,1],[120128,120132,1],[120134,120138,4],[120139,120144,1],[120146,120485,1],[120488,120779,1],[120782,120831,1],[126065,126132,1],[126209,126269,1],[126976,127019,1],[127024,127123,1],[127136,127150,1],[127153,127167,1],[127169,127183,1],[127185,127221,1],[127232,127405,1],[127462,127487,1],[127489,127490,1],[127504,127547,1],[127552,127560,1],[127568,127569,1],[127584,127589,1],[127744,128727,1],[128732,128748,1],[128752,128764,1],[128768,128886,1],[128891,128985,1],[128992,129003,1],[129008,129024,16],[129025,129035,1],[129040,129095,1],[129104,129113,1],[129120,129159,1],[129168,129197,1],[129200,129201,1],[129280,129619,1],[129632,129645,1],[129648,129660,1],[129664,129672,1],[129680,129725,1],[129727,129733,1],[129742,129755,1],[129760,129768,1],[129776,129784,1],[129792,129938,1],[129940,129994,1],[130032,130041,1],[917505,917536,31],[917537,917631,1]];static foldCommon=[[924,956,32]];static Coptic=[[994,1007,1],[11392,11507,1],[11513,11519,1]];static Cuneiform=[[73728,74649,1],[74752,74862,1],[74864,74868,1],[74880,75075,1]];static Cypriot=[[67584,67589,1],[67592,67594,2],[67595,67637,1],[67639,67640,1],[67644,67647,3]];static Cypro_Minoan=[[77712,77810,1]];static Cyrillic=[[1024,1156,1],[1159,1327,1],[7296,7304,1],[7467,7544,77],[11744,11775,1],[42560,42655,1],[65070,65071,1],[122928,122989,1],[123023,123023,1]];static Deseret=[[66560,66639,1]];static Devanagari=[[2304,2384,1],[2389,2403,1],[2406,2431,1],[43232,43263,1],[72448,72457,1]];static Dives_Akuru=[[71936,71942,1],[71945,71948,3],[71949,71955,1],[71957,71958,1],[71960,71989,1],[71991,71992,1],[71995,72006,1],[72016,72025,1]];static Dogra=[[71680,71739,1]];static Duployan=[[113664,113770,1],[113776,113788,1],[113792,113800,1],[113808,113817,1],[113820,113823,1]];static Egyptian_Hieroglyphs=[[77824,78933,1]];static Elbasan=[[66816,66855,1]];static Elymaic=[[69600,69622,1]];static Ethiopic=[[4608,4680,1],[4682,4685,1],[4688,4694,1],[4696,4698,2],[4699,4701,1],[4704,4744,1],[4746,4749,1],[4752,4784,1],[4786,4789,1],[4792,4798,1],[4800,4802,2],[4803,4805,1],[4808,4822,1],[4824,4880,1],[4882,4885,1],[4888,4954,1],[4957,4988,1],[4992,5017,1],[11648,11670,1],[11680,11686,1],[11688,11694,1],[11696,11702,1],[11704,11710,1],[11712,11718,1],[11720,11726,1],[11728,11734,1],[11736,11742,1],[43777,43782,1],[43785,43790,1],[43793,43798,1],[43808,43814,1],[43816,43822,1],[124896,124902,1],[124904,124907,1],[124909,124910,1],[124912,124926,1]];static Georgian=[[4256,4293,1],[4295,4301,6],[4304,4346,1],[4348,4351,1],[7312,7354,1],[7357,7359,1],[11520,11557,1],[11559,11565,6]];static Glagolitic=[[11264,11359,1],[122880,122886,1],[122888,122904,1],[122907,122913,1],[122915,122916,1],[122918,122922,1]];static Gothic=[[66352,66378,1]];static Grantha=[[70400,70403,1],[70405,70412,1],[70415,70416,1],[70419,70440,1],[70442,70448,1],[70450,70451,1],[70453,70457,1],[70460,70468,1],[70471,70472,1],[70475,70477,1],[70480,70487,7],[70493,70499,1],[70502,70508,1],[70512,70516,1]];static Greek=[[880,883,1],[885,887,1],[890,893,1],[895,900,5],[902,904,2],[905,906,1],[908,910,2],[911,929,1],[931,993,1],[1008,1023,1],[7462,7466,1],[7517,7521,1],[7526,7530,1],[7615,7936,321],[7937,7957,1],[7960,7965,1],[7968,8005,1],[8008,8013,1],[8016,8023,1],[8025,8031,2],[8032,8061,1],[8064,8116,1],[8118,8132,1],[8134,8147,1],[8150,8155,1],[8157,8175,1],[8178,8180,1],[8182,8190,1],[8486,43877,35391],[65856,65934,1],[65952,119296,53344],[119297,119365,1]];static foldGreek=[[181,837,656]];static Gujarati=[[2689,2691,1],[2693,2701,1],[2703,2705,1],[2707,2728,1],[2730,2736,1],[2738,2739,1],[2741,2745,1],[2748,2757,1],[2759,2761,1],[2763,2765,1],[2768,2784,16],[2785,2787,1],[2790,2801,1],[2809,2815,1]];static Gunjala_Gondi=[[73056,73061,1],[73063,73064,1],[73066,73102,1],[73104,73105,1],[73107,73112,1],[73120,73129,1]];static Gurmukhi=[[2561,2563,1],[2565,2570,1],[2575,2576,1],[2579,2600,1],[2602,2608,1],[2610,2611,1],[2613,2614,1],[2616,2617,1],[2620,2622,2],[2623,2626,1],[2631,2632,1],[2635,2637,1],[2641,2649,8],[2650,2652,1],[2654,2662,8],[2663,2678,1]];static Han=[[11904,11929,1],[11931,12019,1],[12032,12245,1],[12293,12295,2],[12321,12329,1],[12344,12347,1],[13312,19903,1],[19968,40959,1],[63744,64109,1],[64112,64217,1],[94178,94179,1],[94192,94193,1],[131072,173791,1],[173824,177977,1],[177984,178205,1],[178208,183969,1],[183984,191456,1],[191472,192093,1],[194560,195101,1],[196608,201546,1],[201552,205743,1]];
765static Hangul=[[4352,4607,1],[12334,12335,1],[12593,12686,1],[12800,12830,1],[12896,12926,1],[43360,43388,1],[44032,55203,1],[55216,55238,1],[55243,55291,1],[65440,65470,1],[65474,65479,1],[65482,65487,1],[65490,65495,1],[65498,65500,1]];static Hanifi_Rohingya=[[68864,68903,1],[68912,68921,1]];static Hanunoo=[[5920,5940,1]];static Hatran=[[67808,67826,1],[67828,67829,1],[67835,67839,1]];static Hebrew=[[1425,1479,1],[1488,1514,1],[1519,1524,1],[64285,64310,1],[64312,64316,1],[64318,64320,2],[64321,64323,2],[64324,64326,2],[64327,64335,1]];static Hiragana=[[12353,12438,1],[12445,12447,1],[110593,110879,1],[110898,110928,30],[110929,110930,1],[127488,127488,1]];static Imperial_Aramaic=[[67648,67669,1],[67671,67679,1]];static Inherited=[[768,879,1],[1157,1158,1],[1611,1621,1],[1648,2385,737],[2386,2388,1],[6832,6862,1],[7376,7378,1],[7380,7392,1],[7394,7400,1],[7405,7412,7],[7416,7417,1],[7616,7679,1],[8204,8205,1],[8400,8432,1],[12330,12333,1],[12441,12442,1],[65024,65039,1],[65056,65069,1],[66045,66272,227],[70459,118528,48069],[118529,118573,1],[118576,118598,1],[119143,119145,1],[119163,119170,1],[119173,119179,1],[119210,119213,1],[917760,917999,1]];static foldInherited=[[921,953,32],[8126,8126,1]];static Inscriptional_Pahlavi=[[68448,68466,1],[68472,68479,1]];static Inscriptional_Parthian=[[68416,68437,1],[68440,68447,1]];static Javanese=[[43392,43469,1],[43472,43481,1],[43486,43487,1]];static Kaithi=[[69760,69826,1],[69837,69837,1]];static Kannada=[[3200,3212,1],[3214,3216,1],[3218,3240,1],[3242,3251,1],[3253,3257,1],[3260,3268,1],[3270,3272,1],[3274,3277,1],[3285,3286,1],[3293,3294,1],[3296,3299,1],[3302,3311,1],[3313,3315,1]];static Katakana=[[12449,12538,1],[12541,12543,1],[12784,12799,1],[13008,13054,1],[13056,13143,1],[65382,65391,1],[65393,65437,1],[110576,110579,1],[110581,110587,1],[110589,110590,1],[110592,110880,288],[110881,110882,1],[110933,110948,15],[110949,110951,1]];static Kawi=[[73472,73488,1],[73490,73530,1],[73534,73561,1]];static Kayah_Li=[[43264,43309,1],[43311,43311,1]];static Kharoshthi=[[68096,68099,1],[68101,68102,1],[68108,68115,1],[68117,68119,1],[68121,68149,1],[68152,68154,1],[68159,68168,1],[68176,68184,1]];static Khitan_Small_Script=[[94180,101120,6940],[101121,101589,1]];static Khmer=[[6016,6109,1],[6112,6121,1],[6128,6137,1],[6624,6655,1]];static Khojki=[[70144,70161,1],[70163,70209,1]];static Khudawadi=[[70320,70378,1],[70384,70393,1]];static Lao=[[3713,3714,1],[3716,3718,2],[3719,3722,1],[3724,3747,1],[3749,3751,2],[3752,3773,1],[3776,3780,1],[3782,3784,2],[3785,3790,1],[3792,3801,1],[3804,3807,1]];static Latin=[[65,90,1],[97,122,1],[170,186,16],[192,214,1],[216,246,1],[248,696,1],[736,740,1],[7424,7461,1],[7468,7516,1],[7522,7525,1],[7531,7543,1],[7545,7614,1],[7680,7935,1],[8305,8319,14],[8336,8348,1],[8490,8491,1],[8498,8526,28],[8544,8584,1],[11360,11391,1],[42786,42887,1],[42891,42954,1],[42960,42961,1],[42963,42965,2],[42966,42969,1],[42994,43007,1],[43824,43866,1],[43868,43876,1],[43878,43881,1],[64256,64262,1],[65313,65338,1],[65345,65370,1],[67456,67461,1],[67463,67504,1],[67506,67514,1],[122624,122654,1],[122661,122666,1]];static Lepcha=[[7168,7223,1],[7227,7241,1],[7245,7247,1]];static Limbu=[[6400,6430,1],[6432,6443,1],[6448,6459,1],[6464,6468,4],[6469,6479,1]];static Linear_A=[[67072,67382,1],[67392,67413,1],[67424,67431,1]];static Linear_B=[[65536,65547,1],[65549,65574,1],[65576,65594,1],[65596,65597,1],[65599,65613,1],[65616,65629,1],[65664,65786,1]];static Lisu=[[42192,42239,1],[73648,73648,1]];static Lycian=[[66176,66204,1]];static Lydian=[[67872,67897,1],[67903,67903,1]];static Mahajani=[[69968,70006,1]];static Makasar=[[73440,73464,1]];static Malayalam=[[3328,3340,1],[3342,3344,1],[3346,3396,1],[3398,3400,1],[3402,3407,1],[3412,3427,1],[3430,3455,1]];static Mandaic=[[2112,2139,1],[2142,2142,1]];static Manichaean=[[68288,68326,1],[68331,68342,1]];static Marchen=[[72816,72847,1],[72850,72871,1],[72873,72886,1]];static Masaram_Gondi=[[72960,72966,1],[72968,72969,1],[72971,73014,1],[73018,73020,2],[73021,73023,2],[73024,73031,1],[73040,73049,1]];static Medefaidrin=[[93760,93850,1]];static Meetei_Mayek=[[43744,43766,1],[43968,44013,1],[44016,44025,1]];static Mende_Kikakui=[[124928,125124,1],[125127,125142,1]];static Meroitic_Cursive=[[68e3,68023,1],[68028,68047,1],[68050,68095,1]];static Meroitic_Hieroglyphs=[[67968,67999,1]];static Miao=[[93952,94026,1],[94031,94087,1],[94095,94111,1]];static Modi=[[71168,71236,1],[71248,71257,1]];static Mongolian=[[6144,6145,1],[6148,6150,2],[6151,6169,1],[6176,6264,1],[6272,6314,1],[71264,71276,1]];static Mro=[[92736,92766,1],[92768,92777,1],[92782,92783,1]];static Multani=[[70272,70278,1],[70280,70282,2],[70283,70285,1],[70287,70301,1],[70303,70313,1]];static Myanmar=[[4096,4255,1],[43488,43518,1],[43616,43647,1]];static Nabataean=[[67712,67742,1],[67751,67759,1]];static Nag_Mundari=[[124112,124153,1]];static Nandinagari=[[72096,72103,1],[72106,72151,1],[72154,72164,1]];static New_Tai_Lue=[[6528,6571,1],[6576,6601,1],[6608,6618,1],[6622,6623,1]];static Newa=[[70656,70747,1],[70749,70753,1]];static Nko=[[1984,2042,1],[2045,2047,1]];
765static Nushu=[[94177,110960,16783],[110961,111355,1]];static Nyiakeng_Puachue_Hmong=[[123136,123180,1],[123184,123197,1],[123200,123209,1],[123214,123215,1]];static Ogham=[[5760,5788,1]];static Ol_Chiki=[[7248,7295,1]];static Old_Hungarian=[[68736,68786,1],[68800,68850,1],[68858,68863,1]];static Old_Italic=[[66304,66339,1],[66349,66351,1]];static Old_North_Arabian=[[68224,68255,1]];static Old_Permic=[[66384,66426,1]];static Old_Persian=[[66464,66499,1],[66504,66517,1]];static Old_Sogdian=[[69376,69415,1]];static Old_South_Arabian=[[68192,68223,1]];static Old_Turkic=[[68608,68680,1]];static Old_Uyghur=[[69488,69513,1]];static Oriya=[[2817,2819,1],[2821,2828,1],[2831,2832,1],[2835,2856,1],[2858,2864,1],[2866,2867,1],[2869,2873,1],[2876,2884,1],[2887,2888,1],[2891,2893,1],[2901,2903,1],[2908,2909,1],[2911,2915,1],[2918,2935,1]];static Osage=[[66736,66771,1],[66776,66811,1]];static Osmanya=[[66688,66717,1],[66720,66729,1]];static Pahawh_Hmong=[[92928,92997,1],[93008,93017,1],[93019,93025,1],[93027,93047,1],[93053,93071,1]];static Palmyrene=[[67680,67711,1]];static Pau_Cin_Hau=[[72384,72440,1]];static Phags_Pa=[[43072,43127,1]];static Phoenician=[[67840,67867,1],[67871,67871,1]];static Psalter_Pahlavi=[[68480,68497,1],[68505,68508,1],[68521,68527,1]];static Rejang=[[43312,43347,1],[43359,43359,1]];static Runic=[[5792,5866,1],[5870,5880,1]];static Samaritan=[[2048,2093,1],[2096,2110,1]];static Saurashtra=[[43136,43205,1],[43214,43225,1]];static Sharada=[[70016,70111,1]];static Shavian=[[66640,66687,1]];static Siddham=[[71040,71093,1],[71096,71133,1]];static SignWriting=[[120832,121483,1],[121499,121503,1],[121505,121519,1]];static Sinhala=[[3457,3459,1],[3461,3478,1],[3482,3505,1],[3507,3515,1],[3517,3520,3],[3521,3526,1],[3530,3535,5],[3536,3540,1],[3542,3544,2],[3545,3551,1],[3558,3567,1],[3570,3572,1],[70113,70132,1]];static Sogdian=[[69424,69465,1]];static Sora_Sompeng=[[69840,69864,1],[69872,69881,1]];static Soyombo=[[72272,72354,1]];static Sundanese=[[7040,7103,1],[7360,7367,1]];static Syloti_Nagri=[[43008,43052,1]];static Syriac=[[1792,1805,1],[1807,1866,1],[1869,1871,1],[2144,2154,1]];static Tagalog=[[5888,5909,1],[5919,5919,1]];static Tagbanwa=[[5984,5996,1],[5998,6e3,1],[6002,6003,1]];static Tai_Le=[[6480,6509,1],[6512,6516,1]];static Tai_Tham=[[6688,6750,1],[6752,6780,1],[6783,6793,1],[6800,6809,1],[6816,6829,1]];static Tai_Viet=[[43648,43714,1],[43739,43743,1]];static Takri=[[71296,71353,1],[71360,71369,1]];static Tamil=[[2946,2947,1],[2949,2954,1],[2958,2960,1],[2962,2965,1],[2969,2970,1],[2972,2974,2],[2975,2979,4],[2980,2984,4],[2985,2986,1],[2990,3001,1],[3006,3010,1],[3014,3016,1],[3018,3021,1],[3024,3031,7],[3046,3066,1],[73664,73713,1],[73727,73727,1]];static Tangsa=[[92784,92862,1],[92864,92873,1]];static Tangut=[[94176,94208,32],[94209,100343,1],[100352,101119,1],[101632,101640,1]];static Telugu=[[3072,3084,1],[3086,3088,1],[3090,3112,1],[3114,3129,1],[3132,3140,1],[3142,3144,1],[3146,3149,1],[3157,3158,1],[3160,3162,1],[3165,3168,3],[3169,3171,1],[3174,3183,1],[3191,3199,1]];static Thaana=[[1920,1969,1]];static Thai=[[3585,3642,1],[3648,3675,1]];static Tibetan=[[3840,3911,1],[3913,3948,1],[3953,3991,1],[3993,4028,1],[4030,4044,1],[4046,4052,1],[4057,4058,1]];static Tifinagh=[[11568,11623,1],[11631,11632,1],[11647,11647,1]];static Tirhuta=[[70784,70855,1],[70864,70873,1]];static Toto=[[123536,123566,1]];static Ugaritic=[[66432,66461,1],[66463,66463,1]];static Vai=[[42240,42539,1]];static Vithkuqi=[[66928,66938,1],[66940,66954,1],[66956,66962,1],[66964,66965,1],[66967,66977,1],[66979,66993,1],[66995,67001,1],[67003,67004,1]];static Wancho=[[123584,123641,1],[123647,123647,1]];static Warang_Citi=[[71840,71922,1],[71935,71935,1]];static Yezidi=[[69248,69289,1],[69291,69293,1],[69296,69297,1]];static Yi=[[40960,42124,1],[42128,42182,1]];static Zanabazar_Square=[[72192,72263,1]];static CATEGORIES=new Map([[`C`,e.C],[`Cc`,e.Cc],[`Cf`,e.Cf],[`Co`,e.Co],[`Cs`,e.Cs],[`L`,e.L],[`Ll`,e.Ll],[`Lm`,e.Lm],[`Lo`,e.Lo],[`Lt`,e.Lt],[`Lu`,e.Lu],[`M`,e.M],[`Mc`,e.Mc],[`Me`,e.Me],[`Mn`,e.Mn],[`N`,e.N],[`Nd`,e.Nd],[`Nl`,e.Nl],[`No`,e.No],[`P`,e.P],[`Pc`,e.Pc],[`Pd`,e.Pd],[`Pe`,e.Pe],[`Pf`,e.Pf],[`Pi`,e.Pi],[`Po`,e.Po],[`Ps`,e.Ps],[`S`,e.S],[`Sc`,e.Sc],[`Sk`,e.Sk],[`Sm`,e.Sm],[`So`,e.So],[`Z`,e.Z],[`Zl`,e.Zl],[`Zp`,e.Zp],[`Zs`,e.Zs]]);static SCRIPTS=new Map([[`Adlam`,e.Adlam],[`Ahom`,e.Ahom],[`Anatolian_Hieroglyphs`,e.Anatolian_Hieroglyphs],[`Arabic`,e.Arabic],[`Armenian`,e.Armenian],[`Avestan`,e.Avestan],[`Balinese`,e.Balinese],[`Bamum`,e.Bamum],[`Bassa_Vah`,e.Bassa_Vah],[`Batak`,e.Batak],[`Bengali`,e.Bengali],[`Bhaiksuki`,e.Bhaiksuki],[`Bopomofo`,e.Bopomofo],[`Brahmi`,e.Brahmi],[`Braille`,e.Braille],[`Buginese`,e.Buginese],[`Buhid`,e.Buhid],[`Canadian_Aboriginal`,e.Canadian_Aboriginal],[`Carian`,e.Carian],[`Caucasian_Albanian`,e.Caucasian_Albanian],[`Chakma`,e.Chakma],[`Cham`,e.Cham],[`Cherokee`,e.Cherokee],[`Chorasmian`,e.Chorasmian],[`Common`,e.Common],[`Coptic`,e.Coptic],[`Cuneiform`,e.Cuneiform],[`Cypriot`,e.Cypriot],[`Cypro_Minoan`,e.Cypro_Minoan],[`Cyrillic`,e.Cyrillic
765],[`Deseret`,e.Deseret],[`Devanagari`,e.Devanagari],[`Dives_Akuru`,e.Dives_Akuru],[`Dogra`,e.Dogra],[`Duployan`,e.Duployan],[`Egyptian_Hieroglyphs`,e.Egyptian_Hieroglyphs],[`Elbasan`,e.Elbasan],[`Elymaic`,e.Elymaic],[`Ethiopic`,e.Ethiopic],[`Georgian`,e.Georgian],[`Glagolitic`,e.Glagolitic],[`Gothic`,e.Gothic],[`Grantha`,e.Grantha],[`Greek`,e.Greek],[`Gujarati`,e.Gujarati],[`Gunjala_Gondi`,e.Gunjala_Gondi],[`Gurmukhi`,e.Gurmukhi],[`Han`,e.Han],[`Hangul`,e.Hangul],[`Hanifi_Rohingya`,e.Hanifi_Rohingya],[`Hanunoo`,e.Hanunoo],[`Hatran`,e.Hatran],[`Hebrew`,e.Hebrew],[`Hiragana`,e.Hiragana],[`Imperial_Aramaic`,e.Imperial_Aramaic],[`Inherited`,e.Inherited],[`Inscriptional_Pahlavi`,e.Inscriptional_Pahlavi],[`Inscriptional_Parthian`,e.Inscriptional_Parthian],[`Javanese`,e.Javanese],[`Kaithi`,e.Kaithi],[`Kannada`,e.Kannada],[`Katakana`,e.Katakana],[`Kawi`,e.Kawi],[`Kayah_Li`,e.Kayah_Li],[`Kharoshthi`,e.Kharoshthi],[`Khitan_Small_Script`,e.Khitan_Small_Script],[`Khmer`,e.Khmer],[`Khojki`,e.Khojki],[`Khudawadi`,e.Khudawadi],[`Lao`,e.Lao],[`Latin`,e.Latin],[`Lepcha`,e.Lepcha],[`Limbu`,e.Limbu],[`Linear_A`,e.Linear_A],[`Linear_B`,e.Linear_B],[`Lisu`,e.Lisu],[`Lycian`,e.Lycian],[`Lydian`,e.Lydian],[`Mahajani`,e.Mahajani],[`Makasar`,e.Makasar],[`Malayalam`,e.Malayalam],[`Mandaic`,e.Mandaic],[`Manichaean`,e.Manichaean],[`Marchen`,e.Marchen],[`Masaram_Gondi`,e.Masaram_Gondi],[`Medefaidrin`,e.Medefaidrin],[`Meetei_Mayek`,e.Meetei_Mayek],[`Mende_Kikakui`,e.Mende_Kikakui],[`Meroitic_Cursive`,e.Meroitic_Cursive],[`Meroitic_Hieroglyphs`,e.Meroitic_Hieroglyphs],[`Miao`,e.Miao],[`Modi`,e.Modi],[`Mongolian`,e.Mongolian],[`Mro`,e.Mro],[`Multani`,e.Multani],[`Myanmar`,e.Myanmar],[`Nabataean`,e.Nabataean],[`Nag_Mundari`,e.Nag_Mundari],[`Nandinagari`,e.Nandinagari],[`New_Tai_Lue`,e.New_Tai_Lue],[`Newa`,e.Newa],[`Nko`,e.Nko],[`Nushu`,e.Nushu],[`Nyiakeng_Puachue_Hmong`,e.Nyiakeng_Puachue_Hmong],[`Ogham`,e.Ogham],[`Ol_Chiki`,e.Ol_Chiki],[`Old_Hungarian`,e.Old_Hungarian],[`Old_Italic`,e.Old_Italic],[`Old_North_Arabian`,e.Old_North_Arabian],[`Old_Permic`,e.Old_Permic],[`Old_Persian`,e.Old_Persian],[`Old_Sogdian`,e.Old_Sogdian],[`Old_South_Arabian`,e.Old_South_Arabian],[`Old_Turkic`,e.Old_Turkic],[`Old_Uyghur`,e.Old_Uyghur],[`Oriya`,e.Oriya],[`Osage`,e.Osage],[`Osmanya`,e.Osmanya],[`Pahawh_Hmong`,e.Pahawh_Hmong],[`Palmyrene`,e.Palmyrene],[`Pau_Cin_Hau`,e.Pau_Cin_Hau],[`Phags_Pa`,e.Phags_Pa],[`Phoenician`,e.Phoenician],[`Psalter_Pahlavi`,e.Psalter_Pahlavi],[`Rejang`,e.Rejang],[`Runic`,e.Runic],[`Samaritan`,e.Samaritan],[`Saurashtra`,e.Saurashtra],[`Sharada`,e.Sharada],[`Shavian`,e.Shavian],[`Siddham`,e.Siddham],[`SignWriting`,e.SignWriting],[`Sinhala`,e.Sinhala],[`Sogdian`,e.Sogdian],[`Sora_Sompeng`,e.Sora_Sompeng],[`Soyombo`,e.Soyombo],[`Sundanese`,e.Sundanese],[`Syloti_Nagri`,e.Syloti_Nagri],[`Syriac`,e.Syriac],[`Tagalog`,e.Tagalog],[`Tagbanwa`,e.Tagbanwa],[`Tai_Le`,e.Tai_Le],[`Tai_Tham`,e.Tai_Tham],[`Tai_Viet`,e.Tai_Viet],[`Takri`,e.Takri],[`Tamil`,e.Tamil],[`Tangsa`,e.Tangsa],[`Tangut`,e.Tangut],[`Telugu`,e.Telugu],[`Thaana`,e.Thaana],[`Thai`,e.Thai],[`Tibetan`,e.Tibetan],[`Tifinagh`,e.Tifinagh],[`Tirhuta`,e.Tirhuta],[`Toto`,e.Toto],[`Ugaritic`,e.Ugaritic],[`Vai`,e.Vai],[`Vithkuqi`,e.Vithkuqi],[`Wancho`,e.Wancho],[`Warang_Citi`,e.Warang_Citi],[`Yezidi`,e.Yezidi],[`Yi`,e.Yi],[`Zanabazar_Square`,e.Zanabazar_Square]]);static FOLD_CATEGORIES=new Map([[`L`,e.foldL],[`Ll`,e.foldLl],[`Lt`,e.foldLt],[`Lu`,e.foldLu],[`M`,e.foldM],[`Mn`,e.foldMn]]);static FOLD_SCRIPT=new Map([[`Common`,e.foldCommon],[`Greek`,e.foldGreek],[`Inherited`,e.foldInherited]])},vr=class{static MAX_RUNE=1114111;static MAX_ASCII=127;static MAX_LATIN1=255;static MAX_BMP=65535;static MIN_FOLD=65;static MAX_FOLD=125251;static is32(e,t){let n=0,r=e.length;for(;n<r;){let i=n+Math.floor((r-n)/2),a=e[i];if(a[0]<=t&&t<=a[1])return(t-a[0])%a[2]===0;t<a[0]?r=i:n=i+1}return!1}static is(e,t){if(t<=this.MAX_LATIN1){for(let n of e)if(!(t>n[1]))return t<n[0]?!1:(t-n[0])%n[2]===0;return!1}return e.length>0&&t>=e[0][0]&&this.is32(e,t)}static isUpper(e){if(e<=this.MAX_LATIN1){let t=String.fromCodePoint(e);return t.toUpperCase()===t&&t.toLowerCase()!==t}return this.is(_r.Upper,e)}static isPrint(e){return e<=this.MAX_LATIN1?e>=32&&e<127||e>=161&&e!==173:this.is(_r.L,e)||this.is(_r.M,e)||this.is(_r.N,e)||this.is(_r.P,e)||this.is(_r.S,e)}static simpleFold(e){if(_r.CASE_ORBIT.has(e))return _r.CASE_ORBIT.get(e);let t=L.toLowerCase(e);return t===e?L.toUpperCase(e):t}static equalsIgnoreCase(e,t){if(e<0||t<0||e===t)return!0;
765if(e<=this.MAX_ASCII&&t<=this.MAX_ASCII)return L.CODES.get(`A`)<=e&&e<=L.CODES.get(`Z`)&&(e|=32),L.CODES.get(`A`)<=t&&t<=L.CODES.get(`Z`)&&(t|=32),e===t;for(let n=this.simpleFold(e);n!==e;n=this.simpleFold(n))if(n===t)return!0;return!1}},yr=class{static METACHARACTERS=`\\.+*?()|[]{}^$`;static EMPTY_BEGIN_LINE=1;static EMPTY_END_LINE=2;static EMPTY_BEGIN_TEXT=4;static EMPTY_END_TEXT=8;static EMPTY_WORD_BOUNDARY=16;static EMPTY_NO_WORD_BOUNDARY=32;static EMPTY_ALL=-1;static emptyInts(){return[]}static isalnum(e){return L.CODES.get(`0`)<=e&&e<=L.CODES.get(`9`)||L.CODES.get(`a`)<=e&&e<=L.CODES.get(`z`)||L.CODES.get(`A`)<=e&&e<=L.CODES.get(`Z`)}static unhex(e){return L.CODES.get(`0`)<=e&&e<=L.CODES.get(`9`)?e-L.CODES.get(`0`):L.CODES.get(`a`)<=e&&e<=L.CODES.get(`f`)?e-L.CODES.get(`a`)+10:L.CODES.get(`A`)<=e&&e<=L.CODES.get(`F`)?e-L.CODES.get(`A`)+10:-1}static escapeRune(e){let t=``;if(vr.isPrint(e))this.METACHARACTERS.indexOf(String.fromCodePoint(e))>=0&&(t+=`\\`),t+=String.fromCodePoint(e);else switch(e){case L.CODES.get(`"`):t+=`\\"`;break;case L.CODES.get(`\\`):t+=`\\\\`;break;case L.CODES.get(`	`):t+=`\\t`;break;case L.CODES.get(`
766`):t+=`\\n`;break;case L.CODES.get(`\r`):t+=`\\r`;break;case L.CODES.get(`\b`):t+=`\\b`;break;case L.CODES.get(`\f`):t+=`\\f`;break;default:{let n=e.toString(16);e<256?(t+=`\\x`,n.length===1&&(t+=`0`),t+=n):t+=`\\x{${n}}`;break}}return t}static stringToRunes(e){return String(e).split(``).map(e=>e.codePointAt(0))}static runeToString(e){return String.fromCodePoint(e)}static isWordRune(e){return L.CODES.get(`a`)<=e&&e<=L.CODES.get(`z`)||L.CODES.get(`A`)<=e&&e<=L.CODES.get(`Z`)||L.CODES.get(`0`)<=e&&e<=L.CODES.get(`9`)||e===L.CODES.get(`_`)}static emptyOpContext(e,t){let n=0;return e<0&&(n|=this.EMPTY_BEGIN_TEXT|this.EMPTY_BEGIN_LINE),e===L.CODES.get(`
767`)&&(n|=this.EMPTY_BEGIN_LINE),t<0&&(n|=this.EMPTY_END_TEXT|this.EMPTY_END_LINE),t===L.CODES.get(`
768`)&&(n|=this.EMPTY_END_LINE),this.isWordRune(e)===this.isWordRune(t)?n|=this.EMPTY_NO_WORD_BOUNDARY:n|=this.EMPTY_WORD_BOUNDARY,n}static quoteMeta(e){return e.split(``).map(e=>this.METACHARACTERS.indexOf(e)>=0?`\\${e}`:e).join(``)}static charCount(e){return e>vr.MAX_BMP?2:1}static stringToUtf8ByteArray(e){if(globalThis.TextEncoder)return Array.from(new TextEncoder().encode(e));{let t=[],n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);i<128?t[n++]=i:i<2048?(t[n++]=i>>6|192,t[n++]=i&63|128):(i&64512)==55296&&r+1<e.length&&(e.charCodeAt(r+1)&64512)==56320?(i=65536+((i&1023)<<10)+(e.charCodeAt(++r)&1023),t[n++]=i>>18|240,t[n++]=i>>12&63|128,t[n++]=i>>6&63|128,t[n++]=i&63|128):(t[n++]=i>>12|224,t[n++]=i>>6&63|128,t[n++]=i&63|128)}return t}}static utf8ByteArrayToString(e){if(globalThis.TextDecoder)return new TextDecoder(`utf-8`).decode(new Uint8Array(e));{let t=[],n=0,r=0;for(;n<e.length;){let i=e[n++];if(i<128)t[r++]=String.fromCharCode(i);else if(i>191&&i<224){let a=e[n++];t[r++]=String.fromCharCode((i&31)<<6|a&63)}else if(i>239&&i<365){let a=e[n++],o=e[n++],s=e[n++],c=((i&7)<<18|(a&63)<<12|(o&63)<<6|s&63)-65536;t[r++]=String.fromCharCode(55296+(c>>10)),t[r++]=String.fromCharCode(56320+(c&1023))}else{let a=e[n++],o=e[n++];t[r++]=String.fromCharCode((i&15)<<12|(a&63)<<6|o&63)}}return t.join(``)}}},br=(e=[],t=0)=>{let n={};for(let r=0;r<e.length;r++){let i=e[r],a=t+r;n[i]=a,n[a]=i}return Object.freeze(n)},xr=class e{static Encoding=br([`UTF_16`,`UTF_8`]);getEncoding(){throw Error(`not implemented`)}isUTF8Encoding(){return this.getEncoding()===e.Encoding.UTF_8}isUTF16Encoding(){return this.getEncoding()===e.Encoding.UTF_16}},Sr=class extends xr{constructor(e=null){super(),this.bytes=e}getEncoding(){return xr.Encoding.UTF_8}asCharSequence(){return yr.utf8ByteArrayToString(this.bytes)}asBytes(){return this.bytes}length(){return this.bytes.length}},Cr=class extends xr{constructor(e=null){super(),this.charSequence=e}getEncoding(){return xr.Encoding.UTF_16}asCharSequence(){return this.charSequence}asBytes(){return this.charSequence.toString().split(``).map(e=>e.codePointAt(0))}length(){return this.charSequence.length}},wr=class{static utf16(e){return new Cr(e)}static utf8(e){return Array.isArray(e)?new Sr(e):new Sr(yr.stringToUtf8ByteArray(e))}}
768,Tr=class extends Error{constructor(e){super(e),this.name=`RE2JSException`}},Er=class extends Tr{constructor(e,t=null){let n=`error parsing regexp: ${e}`;t&&(n+=`: \`${t}\``),super(n),this.name=`RE2JSSyntaxException`,this.message=n,this.error=e,this.input=t}getDescription(){return this.error}getPattern(){return this.input}},Dr=class extends Tr{constructor(e){super(e),this.name=`RE2JSCompileException`}},Or=class extends Tr{constructor(e){super(e),this.name=`RE2JSGroupException`}},kr=class extends Tr{constructor(e){super(e),this.name=`RE2JSFlagsException`}},Ar=class{static quoteReplacement(e){return e.indexOf(`\\`)<0&&e.indexOf(`$`)<0?e:e.split(``).map(e=>{let t=e.codePointAt(0);return t===L.CODES[`\\`]||t===L.CODES.$?`\\${e}`:e}).join(``)}constructor(e,t){if(e===null)throw Error(`pattern is null`);this.patternInput=e;let n=this.patternInput.re2();this.patternGroupCount=n.numberOfCapturingGroups(),this.groups=[],this.namedGroups=n.namedGroups,t instanceof xr?this.resetMatcherInput(t):Array.isArray(t)?this.resetMatcherInput(wr.utf8(t)):this.resetMatcherInput(wr.utf16(t))}pattern(){return this.patternInput}reset(){return this.matcherInputLength=this.matcherInput.length(),this.appendPos=0,this.hasMatch=!1,this.hasGroups=!1,this.anchorFlag=0,this}resetMatcherInput(e){if(e===null)throw Error(`input is null`);return this.matcherInput=e,this.reset(),this}start(e=0){if(typeof e==`string`){let t=this.namedGroups[e];if(!Number.isFinite(t))throw new Or(`group '${e}' not found`);e=t}return this.loadGroup(e),this.groups[2*e]}end(e=0){if(typeof e==`string`){let t=this.namedGroups[e];if(!Number.isFinite(t))throw new Or(`group '${e}' not found`);e=t}return this.loadGroup(e),this.groups[2*e+1]}group(e=0){if(typeof e==`string`){let t=this.namedGroups[e];if(!Number.isFinite(t))throw new Or(`group '${e}' not found`);e=t}let t=this.start(e),n=this.end(e);return t<0&&n<0?null:this.substring(t,n)}groupCount(){return this.patternGroupCount}loadGroup(e){if(e<0||e>this.patternGroupCount)throw new Or(`Group index out of bounds: ${e}`);if(!this.hasMatch)throw new Or(`perhaps no match attempted`);if(e===0||this.hasGroups)return;let t=this.groups[1]+1;t>this.matcherInputLength&&(t=this.matcherInputLength);let n=this.patternInput.re2().matchMachineInput(this.matcherInput,this.groups[0],t,this.anchorFlag,1+this.patternGroupCount);if(!n[0])throw new Or(`inconsistency in matching group data`);this.groups=n[1],this.hasGroups=!0}matches(){return this.genMatch(0,I.ANCHOR_BOTH)}lookingAt(){return this.genMatch(0,I.ANCHOR_START)}find(e=null){if(e!==null){if(e<0||e>this.matcherInputLength)throw new Or(`start index out of bounds: ${e}`);return this.reset(),this.genMatch(e,0)}return e=0,this.hasMatch&&(e=this.groups[1],this.groups[0]===this.groups[1]&&e++),this.genMatch(e,I.UNANCHORED)}genMatch(e,t){let n=this.patternInput.re2().matchMachineInput(this.matcherInput,e,this.matcherInputLength,t,1);return n[0]?(this.groups=n[1],this.hasMatch=!0,this.hasGroups=!1,this.anchorFlag=t,!0):!1}substring(e,t){return this.matcherInput.isUTF8Encoding()?yr.utf8ByteArrayToString(this.matcherInput.asBytes().slice(e,t)):this.matcherInput.asCharSequence().substring(e,t).toString()}inputLength(){return this.matcherInputLength}appendReplacement(e,t=!1){let n=``,r=this.start(),i=this.end();return this.appendPos<r&&(n+=this.substring(this.appendPos,r)),this.appendPos=i,n+=t?this.appendReplacementInternalPerl(e):this.appendReplacementInternal(e),n}appendReplacementInternal(e){let t=``,n=0,r=e.length;for(let i=0;i<r-1;i++){if(e.codePointAt(i)===L.CODES.get(`\\`)){n<i&&(t+=e.substring(n,i)),i++,n=i;continue}if(e.codePointAt(i)===L.CODES.get(`$`)){let a=e.codePointAt(i+1);if(L.CODES.get(`0`)<=a&&a<=L.CODES.get(`9`)){let o=a-L.CODES.get(`0`);for(n<i&&(t+=e.substring(n,i)),i+=2;i<r&&(a=e.codePointAt(i),!(a<L.CODES.get(`0`)||a>L.CODES.get(`9`)||o*10+a-L.CODES.get(`0`)>this.patternGroupCount));i++)o=o*10+a-L.CODES.get(`0`);if(o>this.patternGroupCount)throw new Or(`n > number of groups: ${o}`);let s=this.group(o);s!==null&&(t+=s),n=i,i--;continue}else if(a===L.CODES.get(`{`)){n<i&&(t+=e.substring(n,i)),i++;let r=i+1;for(;r<e.length&&e.codePointAt(r)!==L.CODES.get(`}`)&&e.codePointAt(r)!==L.CODES.get(` `);)r++;if(r===e.length||e.codePointAt(r)!==L.CODES.get(`}`))throw new Or(`named capture group is missing trailing '}'`);let a=e.substring(i+1,r);t+=this.group(a),n=r+1}}}return n<r&&(t+=e.substring(n,r)),t}appendReplacementInternalPerl(e){let t=``,n=0,r=e.length;for(let i=0;i<r-1;i++)if(e.codePointAt(i)===L.CODES.get(`$`)){let a=e.codePointAt(i+1);if(L.CODES.get(`$`)===a){n<i&&(t+=e.substring(n,i)),t+=`$`,i++,n=i+1;continue}else if(L.CODES.get(`&`)===a){n<i&&(t+=e.substring(n,i));let r=this.group(0);r===null?t+=`$&`:t+=r,i++,n=i+1;continue}else if(L.CODES.get(`1`)<=a&&a<=L.CODES.get(`9`)){let o=a-L.CODES.get(`0`);for(n<i&&(t+=e.substring(n,i)),i+=2;i<r&&(a=e.codePointAt(i),!(a<L.CODES.get(`0`)||a>L.CODES.get(`9`)||o*10+a-L.CODES.get(`0`)>this.patternGroupCount));i++)o=o*10+a-L.CODES.get(`0`);if(o>this.patternGroupCount){t+=`$${o}`,n=i,i--;continue}let s=this.group(o);s!==null&&(t+=s),n=i,i--;continue}else if(a===L.CODES.get(`<`)){n<i&&(t+=e.substring(n,i)),i++;let r=i+1;for(;r<e.length&&e.codePointAt(r)!==L.CODES.get(`>`)&&e.codePointAt(r)!==L.CODES.get(` `);)r++;if(r===e.length||e.codePointAt(r)!==L.CODES.get(`>`)){t+=e.substring(i-1,r+1),n=r+1;continue}let a=e.substring(i+1,r);Object.prototype.hasOwnProperty.call(this.namedGroups,a)?t+=this.group(a):t+=`$<${a}>`,n=r+1}}return n<r&&(t+=e.substring(n,r)),t}appendTail(){return this.substring(this.appendPos,this.matcherIn
768putLength)}replaceAll(e,t=!1){return this.replace(e,!0,t)}replaceFirst(e,t=!1){return this.replace(e,!1,t)}replace(e,t=!0,n=!1){let r=``;for(this.reset();this.find()&&(r+=this.appendReplacement(e,n),t););return r+=this.appendTail(),r}},jr=class{static EOF(){return-8}canCheckPrefix(){return!0}endPos(){return this.end}},Mr=class extends jr{constructor(e,t=0,n=e.length){super(),this.bytes=e,this.start=t,this.end=n}step(e){if(e+=this.start,e>=this.end)return jr.EOF();let t=this.bytes[e++]&255;return t&128?(t&224)==192?(t&=31,e>=this.end?jr.EOF():(t=t<<6|this.bytes[e++]&63,t<<3|2)):(t&240)==224?(t&=15,e+1>=this.end?jr.EOF():(t=t<<6|this.bytes[e++]&63,t=t<<6|this.bytes[e++]&63,t<<3|3)):(t&=7,e+2>=this.end?jr.EOF():(t=t<<6|this.bytes[e++]&63,t=t<<6|this.bytes[e++]&63,t=t<<6|this.bytes[e++]&63,t<<3|4)):t<<3|1}index(e,t){t+=this.start;let n=this.indexOf(this.bytes,e.prefixUTF8,t);return n<0?n:n-t}context(e){e+=this.start;let t=-1;if(e>this.start&&e<=this.end){let n=e-1;if(t=this.bytes[n--],t>=128){let r=e-4;for(r<this.start&&(r=this.start);n>=r&&(this.bytes[n]&192)==128;)n--;n<this.start&&(n=this.start),t=this.step(n)>>3}}let n=e<this.end?this.step(e)>>3:-1;return yr.emptyOpContext(t,n)}indexOf(e,t,n=0){let r=t.length;if(r===0)return-1;let i=e.length;for(let a=n;a<=i-r;a++)for(let n=0;n<r&&e[a+n]===t[n];n++)if(n===r-1)return a;return-1}},Nr=class extends jr{constructor(e,t=0,n=e.length){super(),this.charSequence=e,this.start=t,this.end=n}step(e){if(e+=this.start,e<this.end){let t=this.charSequence.codePointAt(e);return t<<3|yr.charCount(t)}else return jr.EOF()}index(e,t){t+=this.start;let n=this.charSequence.indexOf(e.prefix,t);return n<0?n:n-t}context(e){e+=this.start;let t=e>0&&e<=this.charSequence.length?this.charSequence.codePointAt(e-1):-1,n=e<this.charSequence.length?this.charSequence.codePointAt(e):-1;return yr.emptyOpContext(t,n)}},Pr=class{static fromUTF8(e,t=0,n=e.length){return new Mr(e,t,n)}static fromUTF16(e,t=0,n=e.length){return new Nr(e,t,n)}},R=class e{static Op=br([`NO_MATCH`,`EMPTY_MATCH`,`LITERAL`,`CHAR_CLASS`,`ANY_CHAR_NOT_NL`,`ANY_CHAR`,`BEGIN_LINE`,`END_LINE`,`BEGIN_TEXT`,`END_TEXT`,`WORD_BOUNDARY`,`NO_WORD_BOUNDARY`,`CAPTURE`,`STAR`,`PLUS`,`QUEST`,`REPEAT`,`CONCAT`,`ALTERNATE`,`LEFT_PAREN`,`VERTICAL_BAR`]);static isPseudoOp(t){return t>=e.Op.LEFT_PAREN}static emptySubs(){return[]}static quoteIfHyphen(e){return e===L.CODES.get(`-`)?`\\`:``}static fromRegexp(t){let n=new e(t.op);return n.flags=t.flags,n.subs=t.subs,n.runes=t.runes,n.cap=t.cap,n.min=t.min,n.max=t.max,n.name=t.name,n.namedGroups=t.namedGroups,n}constructor(t){this.op=t,this.flags=0,this.subs=e.emptySubs(),this.runes=null,this.min=0,this.max=0,this.cap=0,this.name=null,this.namedGroups={}}reinit(){this.flags=0,this.subs=e.emptySubs(),this.runes=null,this.cap=0,this.min=0,this.max=0,this.name=null,this.namedGroups={}}toString(){return this.appendTo()}appendTo(){let t=``;switch(this.op){case e.Op.NO_MATCH:t+=`[^\\x00-\\x{10FFFF}]`;break;case e.Op.EMPTY_MATCH:t+=`(?:)`;break;case e.Op.STAR:case e.Op.PLUS:case e.Op.QUEST:case e.Op.REPEAT:{let n=this.subs[0];switch(n.op>e.Op.CAPTURE||n.op===e.Op.LITERAL&&n.runes.length>1?t+=`(?:${n.appendTo()})`:t+=n.appendTo(),this.op){case e.Op.STAR:t+=`*`;break;case e.Op.PLUS:t+=`+`;break;case e.Op.QUEST:t+=`?`;break;case e.Op.REPEAT:t+=`{${this.min}`,this.min!==this.max&&(t+=`,`,this.max>=0&&(t+=this.max)),t+=`}`;break}(this.flags&I.NON_GREEDY)!==0&&(t+=`?`);break}case e.Op.CONCAT:for(let n of this.subs)n.op===e.Op.ALTERNATE?t+=`(?:${n.appendTo()})`:t+=n.appendTo();break;case e.Op.ALTERNATE:{let e=``;for(let n of this.subs)t+=e,e=`|`,t+=n.appendTo();break}case e.Op.LITERAL:(this.flags&I.FOLD_CASE)!==0&&(t+=`(?i:`);for(let e of this.runes)t+=yr.escapeRune(e);(this.flags&I.FOLD_CASE)!==0&&(t+=`)`);break;case e.Op.ANY_CHAR_NOT_NL:t+=`(?-s:.)`;break;case e.Op.ANY_CHAR:t+=`(?s:.)`;break;case e.Op.CAPTURE:this.name===null||this.name.length===0?t+=`(`:t+=`(?P<${this.name}>`,this.subs[0].op!==e.Op.EMPTY_MATCH&&(t+=this.subs[0].appendTo()),t+=`)`;break;case e.Op.BEGIN_TEXT:t+=`\\A`;break;case e.Op.END_TEXT:(this.flags&I.WAS_DOLLAR)===0?t+=`\\z`:t+=`(?-m:$)`;break;case e.Op.BEGIN_LINE:t+=`^`;break;case e.Op.END_LINE:t+=`$`;break;case e.Op.WORD_BOUNDARY:t+=`\\b`;break;case e.Op.NO_WORD_BOUNDARY:t+=`\\B`;break;
768case e.Op.CHAR_CLASS:if(this.runes.length%2!=0){t+=`[invalid char class]`;break}if(t+=`[`,this.runes.length===0)t+=`^\\x00-\\x{10FFFF}`;else if(this.runes[0]===0&&this.runes[this.runes.length-1]===vr.MAX_RUNE){t+=`^`;for(let n=1;n<this.runes.length-1;n+=2){let r=this.runes[n]+1,i=this.runes[n+1]-1;t+=e.quoteIfHyphen(r),t+=yr.escapeRune(r),r!==i&&(t+=`-`,t+=e.quoteIfHyphen(i),t+=yr.escapeRune(i))}}else for(let n=0;n<this.runes.length;n+=2){let r=this.runes[n],i=this.runes[n+1];t+=e.quoteIfHyphen(r),t+=yr.escapeRune(r),r!==i&&(t+=`-`,t+=e.quoteIfHyphen(i),t+=yr.escapeRune(i))}t+=`]`;break;default:t+=this.op;break}return t}maxCap(){let t=0;if(this.op===e.Op.CAPTURE&&(t=this.cap),this.subs!==null)for(let e of this.subs){let n=e.maxCap();t<n&&(t=n)}return t}equals(t){if(!(t!==null&&t instanceof e)||this.op!==t.op)return!1;switch(this.op){case e.Op.END_TEXT:if((this.flags&I.WAS_DOLLAR)!==(t.flags&I.WAS_DOLLAR))return!1;break;case e.Op.LITERAL:case e.Op.CHAR_CLASS:if(this.runes===null&&t.runes===null)break;if(this.runes===null||t.runes===null||this.runes.length!==t.runes.length)return!1;for(let e=0;e<this.runes.length;e++)if(this.runes[e]!==t.runes[e])return!1;break;case e.Op.ALTERNATE:case e.Op.CONCAT:if(this.subs.length!==t.subs.length)return!1;for(let e=0;e<this.subs.length;++e)if(!this.subs[e].equals(t.subs[e]))return!1;break;case e.Op.STAR:case e.Op.PLUS:case e.Op.QUEST:if((this.flags&I.NON_GREEDY)!==(t.flags&I.NON_GREEDY)||!this.subs[0].equals(t.subs[0]))return!1;break;case e.Op.REPEAT:if((this.flags&I.NON_GREEDY)!==(t.flags&I.NON_GREEDY)||this.min!==t.min||this.max!==t.max||!this.subs[0].equals(t.subs[0]))return!1;break;case e.Op.CAPTURE:if(this.cap!==t.cap||(this.name===null?t.name!==null:this.name!==t.name)||!this.subs[0].equals(t.subs[0]))return!1;break}return!0}},z=class e{static ALT=1;static ALT_MATCH=2;static CAPTURE=3;static EMPTY_WIDTH=4;static FAIL=5;static MATCH=6;static NOP=7;static RUNE=8;static RUNE1=9;static RUNE_ANY=10;static RUNE_ANY_NOT_NL=11;static isRuneOp(t){return e.RUNE<=t&&t<=e.RUNE_ANY_NOT_NL}static escapeRunes(e){let t=`"`;for(let n of e)t+=yr.escapeRune(n);return t+=`"`,t}constructor(e){this.op=e,this.out=0,this.arg=0,this.runes=null}matchRune(e){if(this.runes.length===1){let t=this.runes[0];return(this.arg&I.FOLD_CASE)===0?e===t:vr.equalsIgnoreCase(t,e)}for(let t=0;t<this.runes.length&&t<=8;t+=2){if(e<this.runes[t])return!1;if(e<=this.runes[t+1])return!0}let t=0,n=this.runes.length/2|0;for(;t<n;){let r=t+((n-t)/2|0);if(this.runes[2*r]<=e){if(e<=this.runes[2*r+1])return!0;t=r+1}else n=r}return!1}toString(){switch(this.op){case e.ALT:return`alt -> ${this.out}, ${this.arg}`;case e.ALT_MATCH:return`altmatch -> ${this.out}, ${this.arg}`;case e.CAPTURE:return`cap ${this.arg} -> ${this.out}`;case e.EMPTY_WIDTH:return`empty ${this.arg} -> ${this.out}`;case e.MATCH:return`match`;case e.FAIL:return`fail`;case e.NOP:return`nop -> ${this.out}`;case e.RUNE:return this.runes===null?`rune <null>`:[`rune `,e.escapeRunes(this.runes),(this.arg&I.FOLD_CASE)===0?``:`/i`,` -> `,this.out].join(``);case e.RUNE1:return`rune1 ${e.escapeRunes(this.runes)} -> ${this.out}`;case e.RUNE_ANY:return`any -> ${this.out}`;case e.RUNE_ANY_NOT_NL:return`anynotnl -> ${this.out}`;default:throw Error(`unhandled case in Inst.toString`)}}},Fr=class{constructor(){this.inst=[],this.start=0,this.numCap=2}getInst(e){return this.inst[e]}numInst(){return this.inst.length}addInst(e){this.inst.push(new z(e))}skipNop(e){let t=this.inst[e];for(;t.op===z.NOP||t.op===z.CAPTURE;)t=this.inst[e],e=t.out;return t}prefix(){let e=``,t=this.skipNop(this.start);if(!z.isRuneOp(t.op)||t.runes.length!==1)return[t.op===z.MATCH,e];for(;z.isRuneOp(t.op)&&t.runes.length===1&&(t.arg&I.FOLD_CASE)===0;)e+=String.fromCodePoint(t.runes[0]),t=this.skipNop(t.out);return[t.op===z.MATCH,e]}startCond(){let e=0,t=this.start;loop:for(;;){let n=this.inst[t];switch(n.op){case z.EMPTY_WIDTH:e|=n.arg;break;case z.FAIL:return-1;case z.CAPTURE:case z.NOP:break;default:break loop}t=n.out}return e}next(e){let t=this.inst[e>>1];return e&1?t.arg:t.out}patch(e,t){for(;e!==0;){let n=this.inst[e>>1];e&1?(e=n.arg,n.arg=t):(e=n.out,n.out=t)}}append(e,t){if(e===0)return t;if(t===0)return e;let n=e;for(;;){let e=this.next(n);if(e===0)break;n=e}let r=this.inst[n>>1];return n&1?r.arg=t:r.out=t,e}toString(){let e=``;for(let t=0;t<this.inst.length;t++){let n=e.length;e+=t,t===this.start&&(e+=`*`),e+=`        `.substring(e.length-n),e+=this.inst[t],e+=`
769`}return e}},Ir=class{constructor(e=0,t=0,n=!1){this.i=e,this.out=t,this.nullable=n}},Lr=class e{static ANY_RUNE_NOT_NL(){return[0,L.CODES.get(`
770`)-1,L.CODES.get(`
771`)+1,vr.MAX_RUNE]}static ANY_RUNE(){return[0,vr.MAX_RUNE]}static compileRegexp(t){let n=new e,r=n.compile(t);return n.prog.patch(r.out,n.newInst(z.MATCH).i),n.prog.start=r.i,n.prog}constructor(){this.prog=new Fr,this.newInst(z.FAIL)}newInst(e){return this.prog.addInst(e),new Ir(this.prog.numInst()-1,0,!0)}nop(){let e=this.newInst(z.NOP);return e.out=e.i<<1,e}fail(){return new Ir}cap(e){let t=this.newInst(z.CAPTURE);return t.out=t.i<<1,this.prog.getInst(t.i).arg=e,this.prog.numCap<e+1&&(this.prog.numCap=e+1),t}cat(e,t){return e.i===0||t.i===0?this.fail():(this.prog.patch(e.out,t.i),new Ir(e.i,t.out,e.nullable&&t.nullable))}alt(e,t){if(e.i===0)return t;if(t.i===0)return e;let n=this.newInst(z.ALT),r=this.prog.getInst(n.i);return r.out=e.i,r.arg=t.i,n.out=this.prog.append(e.out,t.out),n.nullable=e.nullable||t.nullable,n}loop(e,t){let n=this.newInst(z.ALT),r=this.prog.getInst(n.i);return t?(r.arg=e.i,n.out=n.i<<1):(r.out=e.i,n.out=n.i<<1|1),this.prog.patch(e.out,n.i),n}quest(e,t){let n=this.newInst(z.ALT),r=this.prog.getInst(n.i);return t?(r.arg=e.i,n.out=n.i<<1):(r.out=e.i,n.out=n.i<<1|1),n.out=this.prog.append(n.out,e.out),n}star(e,t){return e.nullable?this.quest(this.plus(e,t),t):this.loop(e,t)}plus(e,t){return new Ir(e.i,this.loop(e,t).out,e.nullable)}empty(e){let t=this.newInst(z.EMPTY_WIDTH);return this.prog.getInst(t.i).arg=e,t.out=t.i<<1,t}rune(e,t){let n=this.newInst(z.RUNE);n.nullable=!1;let r=this.prog.getInst(n.i);return r.runes=e,t&=I.FOLD_CASE,(e.length!==1||vr.simpleFold(e[0])===e[0])&&(t&=~I.FOLD_CASE),r.arg=t,n.out=n.i<<1,(t&I.FOLD_CASE)===0&&e.length===1||e.length===2&&e[0]===e[1]?r.op=z.RUNE1:e.length===2&&e[0]===0&&e[1]===vr.MAX_RUNE?r.op=z.RUNE_ANY:e.length===4&&e[0]===0&&e[1]===L.CODES.get(`
772`)-1&&e[2]===L.CODES.get(`
773`)+1&&e[3]===vr.MAX_RUNE&&(r.op=z.RUNE_ANY_NOT_NL),n}compile(t){switch(t.op){case R.Op.NO_MATCH:return this.fail();case R.Op.EMPTY_MATCH:return this.nop();case R.Op.LITERAL:if(t.runes.length===0)return this.nop();{let e=null;for(let n of t.runes){let r=this.rune([n],t.flags);e=e===null?r:this.cat(e,r)}return e}case R.Op.CHAR_CLASS:return this.rune(t.runes,t.flags);case R.Op.ANY_CHAR_NOT_NL:return this.rune(e.ANY_RUNE_NOT_NL(),0);case R.Op.ANY_CHAR:return this.rune(e.ANY_RUNE(),0);case R.Op.BEGIN_LINE:return this.empty(yr.EMPTY_BEGIN_LINE);case R.Op.END_LINE:return this.empty(yr.EMPTY_END_LINE);case R.Op.BEGIN_TEXT:return this.empty(yr.EMPTY_BEGIN_TEXT);case R.Op.END_TEXT:return this.empty(yr.EMPTY_END_TEXT);case R.Op.WORD_BOUNDARY:return this.empty(yr.EMPTY_WORD_BOUNDARY);case R.Op.NO_WORD_BOUNDARY:return this.empty(yr.EMPTY_NO_WORD_BOUNDARY);case R.Op.CAPTURE:{let e=this.cap(t.cap<<1),n=this.compile(t.subs[0]),r
773=this.cap(t.cap<<1|1);return this.cat(this.cat(e,n),r)}case R.Op.STAR:return this.star(this.compile(t.subs[0]),(t.flags&I.NON_GREEDY)!==0);case R.Op.PLUS:return this.plus(this.compile(t.subs[0]),(t.flags&I.NON_GREEDY)!==0);case R.Op.QUEST:return this.quest(this.compile(t.subs[0]),(t.flags&I.NON_GREEDY)!==0);case R.Op.CONCAT:if(t.subs.length===0)return this.nop();{let e=null;for(let n of t.subs){let t=this.compile(n);e=e===null?t:this.cat(e,t)}return e}case R.Op.ALTERNATE:if(t.subs.length===0)return this.nop();{let e=null;for(let n of t.subs){let t=this.compile(n);e=e===null?t:this.alt(e,t)}return e}default:throw new Dr(`regexp: unhandled case in compile`)}}},Rr=class e{static simplify(t){if(t===null)return null;switch(t.op){case R.Op.CAPTURE:case R.Op.CONCAT:case R.Op.ALTERNATE:{let n=t;for(let r=0;r<t.subs.length;r++){let i=t.subs[r],a=e.simplify(i);n===t&&a!==i&&(n=R.fromRegexp(t),n.runes=null,n.subs=t.subs.slice(0,t.subs.length)),n!==t&&(n.subs[r]=a)}return n}case R.Op.STAR:case R.Op.PLUS:case R.Op.QUEST:{let n=e.simplify(t.subs[0]);return e.simplify1(t.op,t.flags,n,t)}case R.Op.REPEAT:{if(t.min===0&&t.max===0)return new R(R.Op.EMPTY_MATCH);let n=e.simplify(t.subs[0]);if(t.max===-1){if(t.min===0)return e.simplify1(R.Op.STAR,t.flags,n,null);if(t.min===1)return e.simplify1(R.Op.PLUS,t.flags,n,null);let r=new R(R.Op.CONCAT),i=[];for(let e=0;e<t.min-1;e++)i.push(n);return i.push(e.simplify1(R.Op.PLUS,t.flags,n,null)),r.subs=i.slice(0),r}if(t.min===1&&t.max===1)return n;let r=null;if(t.min>0){r=[];for(let e=0;e<t.min;e++)r.push(n)}if(t.max>t.min){let i=e.simplify1(R.Op.QUEST,t.flags,n,null);for(let r=t.min+1;r<t.max;r++){let r=new R(R.Op.CONCAT);r.subs=[n,i],i=e.simplify1(R.Op.QUEST,t.flags,r,null)}if(r===null)return i;r.push(i)}if(r!==null){let e=new R(R.Op.CONCAT);return e.subs=r.slice(0),e}return new R(R.Op.NO_MATCH)}}return t}static simplify1(e,t,n,r){return n.op===R.Op.EMPTY_MATCH||e===n.op&&(t&I.NON_GREEDY)===(n.flags&I.NON_GREEDY)?n:r!==null&&r.op===e&&(r.flags&I.NON_GREEDY)===(t&I.NON_GREEDY)&&n===r.subs[0]?r:(r=new R(e),r.flags=t,r.subs=[n],r)}},zr=class{constructor(e,t){this.sign=e,this.cls=t}},Br=[48,57],Vr=[9,10,12,13,32,32],Hr=[48,57,65,90,95,95,97,122],Ur=new Map([[`\\d`,new zr(1,Br)],[`\\D`,new zr(-1,Br)],[`\\s`,new zr(1,Vr)],[`\\S`,new zr(-1,Vr)],[`\\w`,new zr(1,Hr)],[`\\W`,new zr(-1,Hr)]]),Wr=[48,57,65,90,97,122],Gr=[65,90,97,122],Kr=[0,127],qr=[9,9,32,32],Jr=[0,31,127,127],Yr=[48,57],Xr=[33,126],Zr=[97,122],Qr=[32,126],$r=[33,47,58,64,91,96,123,126],ei=[9,13,32,32],ti=[65,90],ni=[48,57,65,90,95,95,97,122],ri=[48,57,65,70,97,102],ii=new Map([[`[:alnum:]`,new zr(1,Wr)],[`[:^alnum:]`,new zr(-1,Wr)],[`[:alpha:]`,new zr(1,Gr)],[`[:^alpha:]`,new zr(-1,Gr)],[`[:ascii:]`,new zr(1,Kr)],[`[:^ascii:]`,new zr(-1,Kr)],[`[:blank:]`,new zr(1,qr)],[`[:^blank:]`,new zr(-1,qr)],[`[:cntrl:]`,new zr(1,Jr)],[`[:^cntrl:]`,new zr(-1,Jr)],[`[:digit:]`,new zr(1,Yr)],[`[:^digit:]`,new zr(-1,Yr)],[`[:graph:]`,new zr(1,Xr)],[`[:^graph:]`,new zr(-1,Xr)],[`[:lower:]`,new zr(1,Zr)],[`[:^lower:]`,new zr(-1,Zr)],[`[:print:]`,new zr(1,Qr)],[`[:^print:]`,new zr(-1,Qr)],[`[:punct:]`,new zr(1,$r)],[`[:^punct:]`,new zr(-1,$r)],[`[:space:]`,new zr(1,ei)],[`[:^space:]`,new zr(-1,ei)],[`[:upper:]`,new zr(1,ti)],[`[:^upper:]`,new zr(-1,ti)],[`[:word:]`,new zr(1,ni)],[`[:^word:]`,new zr(-1,ni)],[`[:xdigit:]`,new zr(1,ri)],[`[:^xdigit:]`,new zr(-1,ri)]]),ai=class e{static charClassToString(e,t){let n=`[`;for(let r=0;r<t;r+=2){r>0&&(n+=` `);let t=e[r],i=e[r+1];t===i?n+=`0x${t.toString(16)}`:n+=`0x${t.toString(16)}-0x${i.toString(16)}`}return n+=`]`,n}static cmp(e,t,n,r){let i=e[t]-n;return i===0?r-e[t+1]:i}static qsortIntPair(t,n,r){let i=((n+r)/2|0)&-2,a=t[i],o=t[i+1],s=n,c=r;for(;s<=c;){for(;s<r&&e.cmp(t,s,a,o)<0;)s+=2;for(;c>n&&e.cmp(t,c,a,o)>0;)c-=2;if(s<=c){if(s!==c){let e=t[s];t[s]=t[c],t[c]=e,e=t[s+1],t[s+1]=t[c+1],t[c+1]=e}s+=2,c-=2}}n<c&&e.qsortIntPair(t,n,c),s<r&&e.qsortIntPair(t,s,r)}constructor(e=yr.emptyInts()){this.r=e,this.len=e.length}toArray(){return this.len===this.r.length?this.r:this.r.slice(0,this.len)}cleanClass(){if(this.len<4)return this;e.qsortIntPair(this.r,0,this.len-2);let t=2;for(let e=2;e<this.len;e+=2){let n=this.r[e],r=this.r[e+1];if(n<=this.r[t-1]+1){r>this.r[t-1]&&(this.r[t-1]=r);continue}this.r[t]=n,this.r[t+1]=r,t+=2}return this.len=t,this}appendLiteral(e,t){return(t&I.FOLD_CASE)===0?this.appendRange(e,e):this.appendFoldedRange(e,e)}appendRange(e,t){if(this.len>0){for(let n=2;n<=4;n+=2)if(this.len>=n){let r=this.r[this.len-n],i=this.r[this.len-n+1];if(e<=i+1&&r<=t+1)return e<r&&(this.r[this.len-n]=e),t>i&&(this.r[this.len-n+1]=t),this}}return this.r[this.len++]=e,this.r[this.len++]=t,this}appendFoldedRange(e,t){if(e<=vr.MIN_FOLD&&t>=vr.MAX_FOLD||t<vr.MIN_FOLD||e>vr.MAX_FOLD)return this.appendRange(e,t);e<vr.MIN_FOLD&&(this.appendRange(e,vr.MIN_FOLD-1),e=vr.MIN_FOLD),t>vr.MAX_FOLD&&(this.appendRange(vr.MAX_FOLD+1,t),t=vr.MAX_FOLD);for(let n=e;n<=t;n++){this.appendRange(n,n);for(let e=vr.simpleFold(n);e!==n;e=vr.simpleFold(e))this.appendRange(e,e)}return this}appendClass(e){for(let t=0;t<e.length;t+=2)this.appendRange(e[t],e[t+1]);return this}appendFoldedClass(e){for(let t=0;t<e.length;t+=2)this.appendFoldedRange(e[t],e[t+1]);return this}appendNegatedClass(e){let t=0;for(let n=0;n<e.length;n+=2){let r=e[n],i=e[n+1];t<=r-1&&this.appendRange(t,r-1),t=i+1}return t<=vr.MAX_RUNE&&this.appendRange(t,vr.MAX_RUNE),this}appendTable(e){for(let t of e){let e=t[0],n=t[1],r=t[2];if(r===1){this.appendRange(e,n);continue}for(let t=e;t<=n;t+=r)this.appendRange(t,t)}return this}appendNegatedTable(e){let t=0;for(let n of e){let e=n[0],r=n[1],i=n[2];if(i===1){t<=e-1&&this.appendRange(t,e-1),t=r+1;continue}for(let n=e;n<=r;n+=i)t<=n-1&&this.appendRange(t,n-1),t=n+1}return t<=vr.MAX_RUNE&&this.appendRange(t,vr.MAX_RUNE),this}appendTableWithSign(e,t){return t<0?this.appendNegatedTable(e):this.appendTable(e)}negateClass(){let e=0,t=0;for(let n=0;n<this.len;n+=2){let r=this.r[n],i=this.r[n+1];
773e<=r-1&&(this.r[t]=e,this.r[t+1]=r-1,t+=2),e=i+1}return this.len=t,e<=vr.MAX_RUNE&&(this.r[this.len++]=e,this.r[this.len++]=vr.MAX_RUNE),this}appendClassWithSign(e,t){return t<0?this.appendNegatedClass(e):this.appendClass(e)}appendGroup(t,n){let r=t.cls;return n&&(r=new e().appendFoldedClass(r).cleanClass().toArray()),this.appendClassWithSign(r,t.sign)}toString(){return e.charClassToString(this.r,this.len)}},oi=class e{static of(t,n){return new e(t,n)}constructor(e,t){this.first=e,this.second=t}},si=class{constructor(e){this.str=e,this.position=0}pos(){return this.position}rewindTo(e){this.position=e}more(){return this.position<this.str.length}peek(){return this.str.codePointAt(this.position)}skip(e){this.position+=e}skipString(e){this.position+=e.length}pop(){let e=this.str.codePointAt(this.position);return this.position+=yr.charCount(e),e}lookingAt(e){return this.rest().startsWith(e)}rest(){return this.str.substring(this.position)}from(e){return this.str.substring(e,this.position)}toString(){return this.rest()}},ci=class e{static ERR_INTERNAL_ERROR=`regexp/syntax: internal error`;static ERR_INVALID_CHAR_RANGE=`invalid character class range`;static ERR_INVALID_ESCAPE=`invalid escape sequence`;static ERR_INVALID_NAMED_CAPTURE=`invalid named capture`;static ERR_INVALID_PERL_OP=`invalid or unsupported Perl syntax`;static ERR_INVALID_REPEAT_OP=`invalid nested repetition operator`;static ERR_INVALID_REPEAT_SIZE=`invalid repeat count`;static ERR_MISSING_BRACKET=`missing closing ]`;static ERR_MISSING_PAREN=`missing closing )`;static ERR_MISSING_REPEAT_ARGUMENT=`missing argument to repetition operator`;static ERR_TRAILING_BACKSLASH=`trailing backslash at end of expression`;static ERR_DUPLICATE_NAMED_CAPTURE=`duplicate capture group name`;static ANY_TABLE(){return[[0,vr.MAX_RUNE,1]]}static unicodeTable(t){return t===`Any`?oi.of(e.ANY_TABLE(),e.ANY_TABLE()):_r.CATEGORIES.has(t)?oi.of(_r.CATEGORIES.get(t),_r.FOLD_CATEGORIES.get(t)):_r.SCRIPTS.has(t)?oi.of(_r.SCRIPTS.get(t),_r.FOLD_SCRIPT.get(t)):null}static minFoldRune(e){if(e<vr.MIN_FOLD||e>vr.MAX_FOLD)return e;let t=e,n=e;for(e=vr.simpleFold(e);e!==n;e=vr.simpleFold(e))t>e&&(t=e);return t}static leadingRegexp(e){if(e.op===R.Op.EMPTY_MATCH)return null;if(e.op===R.Op.CONCAT&&e.subs.length>0){let t=e.subs[0];return t.op===R.Op.EMPTY_MATCH?null:t}return e}static literalRegexp(e,t){let n=new R(R.Op.LITERAL);return n.flags=t,n.runes=yr.stringToRunes(e),n}static parse(t,n){return new e(t,n).parseInternal()}static parseRepeat(t){let n=t.pos();if(!t.more()||!t.lookingAt(`{`))return-1;t.skip(1);let r=e.parseInt(t);if(r===-1||!t.more())return-1;let i;if(!t.lookingAt(`,`))i=r;else{if(t.skip(1),!t.more())return-1;if(t.lookingAt(`}`))i=-1;else if((i=e.parseInt(t))===-1)return-1}if(!t.more()||!t.lookingAt(`}`))return-1;if(t.skip(1),r<0||r>1e3||i===-2||i>1e3||i>=0&&r>i)throw new Er(e.ERR_INVALID_REPEAT_SIZE,t.from(n));return r<<16|i&vr.MAX_BMP}static isValidCaptureName(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++){let n=e.codePointAt(t);if(n!==L.CODES.get(`_`)&&!yr.isalnum(n))return!1}return!0}static parseInt(e){let t=e.pos();for(;e.more()&&e.peek()>=L.CODES.get(`0`)&&e.peek()<=L.CODES.get(`9`);)e.skip(1);let n=e.from(t);return n.length===0||n.length>1&&n.codePointAt(0)===L.CODES.get(`0`)?-1:n.length>8?-2:parseFloat(n,10)}static isCharClass(e){return e.op===R.Op.LITERAL&&e.runes.length===1||e.op===R.Op.CHAR_CLASS||e.op===R.Op.ANY_CHAR_NOT_NL||e.op===R.Op.ANY_CHAR}static matchRune(e,t){switch(e.op){case R.Op.LITERAL:return e.runes.length===1&&e.runes[0]===t;case R.Op.CHAR_CLASS:for(let n=0;n<e.runes.length;n+=2)if(e.runes[n]<=t&&t<=e.runes[n+1])return!0;return!1;case R.Op.ANY_CHAR_NOT_NL:return t!==L.CODES.get(`
774`);case R.Op.ANY_CHAR:return!0}return!1}static mergeCharClass(t,n){switch(t.op){case R.Op.ANY_CHAR:break;case R.Op.ANY_CHAR_NOT_NL:e.matchRune(n,L.CODES.get(`
775`))&&(t.op=R.Op.ANY_CHAR);break;case R.Op.CHAR_CLASS:n.op===R.Op.LITERAL?t.runes=new ai(t.runes).appendLiteral(n.runes[0],n.flags).toArray():t.runes=new ai(t.runes).appendClass(n.runes).toArray();break;case R.Op.LITERAL:if(n.runes[0]===t.runes[0]&&n.flags===t.flags)break;t.op=R.Op.CHAR_CLASS,t.runes=new ai().appendLiteral(t.runes[0],t.flags).appendLiteral(n.runes[0],n.flags).toArray();break}}static parseEscape(t){let n=t.pos();if(t.skip(1),!t.more())throw new Er(e.ERR_TRAILING_BACKSLASH);let r=t.pop();bigswitch:switch(r){case L.CODES.get(`1`):case L.CODES.get(`2`):case L.CODES.get(`3`):case L.CODES.get(`4`):case L.CODES.get(`5`):case L.CODES.get(`6`):case L.CODES.get(`7`):if(!t.more()||t.peek()<L.CODES.get(`0`)||t.peek()>L.CODES.get(`7`))break;case L.CODES.get(`0`):{let e=r-L.CODES.get(`0`);for(let n=1;n<3&&!(!t.more()||t.peek()<L.CODES.get(`0`)||t.peek()>L.CODES.get(`7`));n++)e=e*8+t.peek()-L.CODES.get(`0`),t.skip(1);return e}case L.CODES.get(`x`):{if(!t.more())break;if(r=t.pop(),r===L.CODES.get(`{`)){let e=0,n=0;for(;;){if(!t.more())break bigswitch;if(r=t.pop(),r===L.CODES.get(`}`))break;let i=yr.unhex(r);if(i<0||(n=n*16+i,n>vr.MAX_RUNE))break bigswitch;e++}if(e===0)break bigswitch;return n}let e=yr.unhex(r);if(!t.more())break;r=t.pop();let n=yr.unhex(r);if(e<0||n<0)break;return e*16+n}case L.CODES.get(`a`):return L.CODES.get(`\x07`);case L.CODES.get(`f`):return L.CODES.get(`\f`);case L.CODES.get(`n`):return L.CODES.get(`
776`);case L.CODES.get(`r`):return L.CODES.get(`\r`);case L.CODES.get(`t`):return L.CODES.get(`	`);case L.CODES.get(`v`):return L.CODES.get(`\v`);default:if(!yr.isalnum(r))return r;break}throw new Er(e.ERR_INVALID_ESCAPE,t.from(n))}static parseClassChar(t,n){if(!t.more())throw new Er(e.ERR_MISSING_BRACKET,t.from(n));return t.lookingAt(`\\`)?e.parseEscape(t):t.pop()}static concatRunes(e,t){return[...e,...t]}constructor(e,t=0){this.wholeRegexp=e,this.flags=t,this.numCap=0,this.namedGroups={},this.stack=[],this.free=null}
776newRegexp(e){let t=this.free;return t!==null&&t.subs!==null&&t.subs.length>0?(this.free=t.subs[0],t.reinit(),t.op=e):t=new R(e),t}reuse(e){e.subs!==null&&e.subs.length>0&&(e.subs[0]=this.free),this.free=e}pop(){return this.stack.pop()}popToPseudo(){let e=this.stack.length,t=e;for(;t>0&&!R.isPseudoOp(this.stack[t-1].op);)t--;let n=this.stack.slice(t,e);return this.stack=this.stack.slice(0,t),n}push(e){if(e.op===R.Op.CHAR_CLASS&&e.runes.length===2&&e.runes[0]===e.runes[1]){if(this.maybeConcat(e.runes[0],this.flags&~I.FOLD_CASE))return null;e.op=R.Op.LITERAL,e.runes=[e.runes[0]],e.flags=this.flags&~I.FOLD_CASE}else if(e.op===R.Op.CHAR_CLASS&&e.runes.length===4&&e.runes[0]===e.runes[1]&&e.runes[2]===e.runes[3]&&vr.simpleFold(e.runes[0])===e.runes[2]&&vr.simpleFold(e.runes[2])===e.runes[0]||e.op===R.Op.CHAR_CLASS&&e.runes.length===2&&e.runes[0]+1===e.runes[1]&&vr.simpleFold(e.runes[0])===e.runes[1]&&vr.simpleFold(e.runes[1])===e.runes[0]){if(this.maybeConcat(e.runes[0],this.flags|I.FOLD_CASE))return null;e.op=R.Op.LITERAL,e.runes=[e.runes[0]],e.flags=this.flags|I.FOLD_CASE}else this.maybeConcat(-1,0);return this.stack.push(e),e}maybeConcat(t,n){let r=this.stack.length;if(r<2)return!1;let i=this.stack[r-1],a=this.stack[r-2];
776return i.op!==R.Op.LITERAL||a.op!==R.Op.LITERAL||(i.flags&I.FOLD_CASE)!==(a.flags&I.FOLD_CASE)?!1:(a.runes=e.concatRunes(a.runes,i.runes),t>=0?(i.runes=[t],i.flags=n,!0):(this.pop(),this.reuse(i),!1))}newLiteral(t,n){let r=this.newRegexp(R.Op.LITERAL);return r.flags=n,(n&I.FOLD_CASE)!==0&&(t=e.minFoldRune(t)),r.runes=[t],r}literal(e){this.push(this.newLiteral(e,this.flags))}op(e){let t=this.newRegexp(e);return t.flags=this.flags,this.push(t)}repeat(t,n,r,i,a,o){let s=this.flags;if((s&I.PERL_X)!==0&&(a.more()&&a.lookingAt(`?`)&&(a.skip(1),s^=I.NON_GREEDY),o!==-1))throw new Er(e.ERR_INVALID_REPEAT_OP,a.from(o));let c=this.stack.length;if(c===0)throw new Er(e.ERR_MISSING_REPEAT_ARGUMENT,a.from(i));let l=this.stack[c-1];if(R.isPseudoOp(l.op))throw new Er(e.ERR_MISSING_REPEAT_ARGUMENT,a.from(i));let u=this.newRegexp(t);u.min=n,u.max=r,u.flags=s,u.subs=[l],this.stack[c-1]=u}concat(){this.maybeConcat(-1,0);let e=this.popToPseudo();return e.length===0?this.push(this.newRegexp(R.Op.EMPTY_MATCH)):this.push(this.collapse(e,R.Op.CONCAT))}alternate(){let e=this.popToPseudo();return e.length>0&&this.cleanAlt(e[e.length-1]),e.length===0?this.push(this.newRegexp(R.Op.NO_MATCH)):this.push(this.collapse(e,R.Op.ALTERNATE))}cleanAlt(e){e.op===R.Op.CHAR_CLASS&&(e.runes=new ai(e.runes).cleanClass().toArray(),e.runes.length===2&&e.runes[0]===0&&e.runes[1]===vr.MAX_RUNE?(e.runes=null,e.op=R.Op.ANY_CHAR):e.runes.length===4&&e.runes[0]===0&&e.runes[1]===L.CODES.get(`
777`)-1&&e.runes[2]===L.CODES.get(`
778`)+1&&e.runes[3]===vr.MAX_RUNE&&(e.runes=null,e.op=R.Op.ANY_CHAR_NOT_NL))}collapse(e,t){if(e.length===1)return e[0];let n=0;for(let r of e)n+=r.op===t?r.subs.length:1;let r=Array(n).fill(null),i=0;for(let n of e)n.op===t?(r.splice(i,n.subs.length,...n.subs),i+=n.subs.length,this.reuse(n)):r[i++]=n;let a=this.newRegexp(t);if(a.subs=r,t===R.Op.ALTERNATE&&(a.subs=this.factor(a.subs),a.subs.length===1)){let e=a;a=a.subs[0],this.reuse(e)}return a}factor(t){if(t.length<2)return t;let n=0,r=t.length,i=0,a=null,o=0,s=0,c=0;for(let e=0;e<=r;e++){let l=null,u=0,d=0;if(e<r){let r=t[n+e];if(r.op===R.Op.CONCAT&&r.subs.length>0&&(r=r.subs[0]),r.op===R.Op.LITERAL&&(l=r.runes,u=r.runes.length,d=r.flags&I.FOLD_CASE),d===s){let e=0;for(;e<o&&e<u&&a[e]===l[e];)e++;if(e>0){o=e;continue}}}if(e!==c)if(e===c+1)t[i++]=t[n+c];else{let r=this.newRegexp(R.Op.LITERAL);r.flags=s,r.runes=a.slice(0,o);for(let r=c;r<e;r++)t[n+r]=this.removeLeadingString(t[n+r],o);let l=this.collapse(t.slice(n+c,n+e),R.Op.ALTERNATE),u=this.newRegexp(R.Op.CONCAT);u.subs=[r,l],t[i++]=u}c=e,a=l,o=u,s=d}r=i,n=0,c=0,i=0;let l=null;for(let a=0;a<=r;a++){let o=null;if(!(a<r&&(o=e.leadingRegexp(t[n+a]),l!==null&&l.equals(o)&&(e.isCharClass(l)||l.op===R.Op.REPEAT&&l.min===l.max&&e.isCharClass(l.subs[0]))))){if(a!==c)if(a===c+1)t[i++]=t[n+c];else{let e=l;for(let e=c;e<a;e++){let r=e!==c;t[n+e]=this.removeLeadingRegexp(t[n+e],r)}let r=this.collapse(t.slice(n+c,n+a),R.Op.ALTERNATE),o=this.newRegexp(R.Op.CONCAT);o.subs=[e,r],t[i++]=o}c=a,l=o}}r=i,n=0,c=0,i=0;for(let a=0;a<=r;a++)if(!(a<r&&e.isCharClass(t[n+a]))){if(a!==c)if(a===c+1)t[i++]=t[n+c];else{let r=c;for(let e=c+1;e<a;e++){let i=t[n+r],a=t[n+e];(i.op<a.op||i.op===a.op&&(i.runes===null?0:i.runes.length)<(a.runes===null?0:a.runes.length))&&(r=e)}let o=t[n+c];t[n+c]=t[n+r],t[n+r]=o;for(let r=c+1;r<a;r++)e.mergeCharClass(t[n+c],t[n+r]),this.reuse(t[n+r]);this.cleanAlt(t[n+c]),t[i++]=t[n+c]}a<r&&(t[i++]=t[n+a]),c=a+1}r=i,n=0,c=0,i=0;for(let e=0;e<r;++e)e+1<r&&t[n+e].op===R.Op.EMPTY_MATCH&&t[n+e+1].op===R.Op.EMPTY_MATCH||(t[i++]=t[n+e]);return r=i,n=0,t.slice(n,r)}removeLeadingString(e,t){if(e.op===R.Op.CONCAT&&e.subs.length>0){let n=this.removeLeadingString(e.subs[0],t);if(e.subs[0]=n,n.op===R.Op.EMPTY_MATCH)switch(this.reuse(n),e.subs.length){case 0:case 1:e.op=R.Op.EMPTY_MATCH,e.subs=null;break;case 2:{let t=e;e=e.subs[1],this.reuse(t);break}default:e.subs=e.subs.slice(1,e.subs.length);break}return e}return e.op===R.Op.LITERAL&&(e.runes=e.runes.slice(t,e.runes.length),e.runes.length===0&&(e.op=R.Op.EMPTY_MATCH)),e}removeLeadingRegexp(e,t){if(e.op===R.Op.CONCAT&&e.subs.length>0){switch(t&&this.reuse(e.subs[0]),e.subs=e.subs.slice(1,e.subs.length),e.subs.length){case 0:e.op=R.Op.EMPTY_MATCH,e.subs=R.emptySubs();break;case 1:{let t=e;e=e.subs[0],this.reuse(t);break}}return e}return t&&this.reuse(e),this.newRegexp(R.Op.EMPTY_MATCH)}parseInternal(){if((this.flags&I.LITERAL)!==0)return e.literalRegexp(this.wholeRegexp,this.flags);let t=-1,n=-1,r=-1,i=new si(this.wholeRegexp);for(;i.more();){let a=-1;bigswitch:switch(i.peek()){case L.CODES.get(`(`):if((this.flags&I.PERL_X)!==0&&i.lookingAt(`(?`)){this.parsePerlFlags(i);break}this.op(R.Op.LEFT_PAREN).cap=++this.numCap,i.skip(1);break;case L.CODES.get(`|`):this.parseVerticalBar(),i.skip(1);break;case L.CODES.get(`)`):this.parseRightParen(),i.skip(1);break;case L.CODES.get(`^`):(this.flags&I.ONE_LINE)===0?this.op(R.Op.BEGIN_LINE):this.op(R.Op.BEGIN_TEXT),i.skip(1);break;case L.CODES.get(`$`):(this.flags&I.ONE_LINE)===0?this.op(R.Op.END_LINE):this.op(R.Op.END_TEXT).flags|=I.WAS_DOLLAR,i.skip(1);break;case L.CODES.get(`.`):(this.flags&I.DOT_NL)===0?this.op(R.Op.ANY_CHAR_NOT_NL):this.op(R.Op.ANY_CHAR),i.skip(1);break;case L.CODES.get(`[`):this.parseClass(i);break;case L.CODES.get(`*`):case L.CODES.get(`+`):case L.CODES.get(`?`):{a=i.pos();let e=null;switch(i.pop()){case L.CODES.get(`*`):e=R.Op.STAR;break;case L.CODES.get(`+`):e=R.Op.PLUS;break;case L.CODES.get(`?`):e=R.Op.QUEST;break}this.repeat(e,n,r,a,i,t);break}case L.CODES.get(`{`):{a=i.pos();let o=e.parseRepeat(i);if(o<0){i.rewindTo(a),this.literal(i.pop());break}n=o>>16,r=(o&vr.MAX_BMP)<<16>>16,this.repeat(R.Op.REPEAT,n,r,a,i,t);break}case L.CODES.get(`\\`):{let t=i.pos();if(i.skip(1),(this.flags&I.PERL_X)!==0&&i.more())switch(i.pop()){case L.CODES.get(`A`):this.op(R.Op.BEGIN_TEXT);break bigswitch;case L.CODES.get(`b`):this.op(R.Op.WORD_BOUNDARY);break bigswitch;case L.CODES.get(`B`):this.op(R.Op.NO_WORD_BOUNDARY);break bigswitch;case L.CODES.get(`C`):throw new Er(e.ERR_INVALID_ESCAPE,`\\C`);case L.CODES.get(`Q`):{let e=i.rest(),t=e.indexOf(`\\E`);t>=0&&(e=e.substring(0,t)),i.skipString(e),i.skipString(`\\E`);let n=0;for(;n<e.length;){let t=e.codePointAt(n);this.literal(t),n+=yr.charCount(t)}break bigswitch}case L.CODES.get(`z`):this.op(R.Op.END_TEXT);break bigswitch;default:i.rewindTo(t);break}let n=this.newRegexp(R.Op.CHAR_CLASS);if(n.flags=this.flags,i.lookingAt(`\\p`)||i.lookingAt(`\\P`)){let e=new ai;if(this.parseUnicodeClass(i,e)){n.runes=e.toArray(),this.push(n);break bigswitch}}let r=new ai;if(this.parsePerlClassEscape(i,r)){n.runes=r.toArray(),this.push(n);break bigswitch}i.rewindTo(t),this.reuse(n),this.literal(e.parseEscape(i));break}default:this.literal(i.pop());break}t=a}if(this.concat(),this.swapVerticalBar()&&this.pop(),this.alternate(),this.stack.length!==1)throw new Er(e.ERR_MISSING_PAREN,this.wholeRegexp);return this.stack[0].namedGroups=this.namedGroups,this.stack[0]}parsePerlFlags(t){let n=t.pos(),r=t.rest();if(r.startsWith(`(?P<`)||r.startsWith(`(?<`)){let n=r.charAt(2)===`P`?4:3,i=r.indexOf(`>`);
778if(i<0)throw new Er(e.ERR_INVALID_NAMED_CAPTURE,r);let a=r.substring(n,i);if(t.skipString(a),t.skip(n+1),!e.isValidCaptureName(a))throw new Er(e.ERR_INVALID_NAMED_CAPTURE,r.substring(0,i+1));let o=this.op(R.Op.LEFT_PAREN);if(o.cap=++this.numCap,this.namedGroups[a])throw new Er(e.ERR_DUPLICATE_NAMED_CAPTURE,a);this.namedGroups[a]=this.numCap,o.name=a;return}t.skip(2);let i=this.flags,a=1,o=!1;loop:for(;t.more();){let e=t.pop();switch(e){case L.CODES.get(`i`):i|=I.FOLD_CASE,o=!0;break;case L.CODES.get(`m`):i&=~I.ONE_LINE,o=!0;break;case L.CODES.get(`s`):i|=I.DOT_NL,o=!0;break;case L.CODES.get(`U`):i|=I.NON_GREEDY,o=!0;break;case L.CODES.get(`-`):if(a<0)break loop;a=-1,i=~i,o=!1;break;case L.CODES.get(`:`):case L.CODES.get(`)`):if(a<0){if(!o)break loop;i=~i}e===L.CODES.get(`:`)&&this.op(R.Op.LEFT_PAREN),this.flags=i;return;default:break loop}}throw new Er(e.ERR_INVALID_PERL_OP,t.from(n))}parseVerticalBar(){this.concat(),this.swapVerticalBar()||this.op(R.Op.VERTICAL_BAR)}swapVerticalBar(){let t=this.stack.length;if(t>=3&&this.stack[t-2].op===R.Op.VERTICAL_BAR&&e.isCharClass(this.stack[t-1])&&e.isCharClass(this.stack[t-3])){let n=this.stack[t-1],r=this.stack[t-3];if(n.op>r.op){let e=r;r=n,n=e,this.stack[t-3]=r}return e.mergeCharClass(r,n),this.reuse(n),this.pop(),!0}if(t>=2){let e=this.stack[t-1],n=this.stack[t-2];if(n.op===R.Op.VERTICAL_BAR)return t>=3&&this.cleanAlt(this.stack[t-3]),this.stack[t-2]=e,this.stack[t-1]=n,!0}return!1}parseRightParen(){if(this.concat(),this.swapVerticalBar()&&this.pop(),this.alternate(),this.stack.length<2)throw new Er(e.ERR_INTERNAL_ERROR,`stack underflow`);let t=this.pop(),n=this.pop();if(n.op!==R.Op.LEFT_PAREN)throw new Er(e.ERR_MISSING_PAREN,this.wholeRegexp);this.flags=n.flags,n.cap===0?this.push(t):(n.op=R.Op.CAPTURE,n.subs=[t],this.push(n))}parsePerlClassEscape(e,t){let n=e.pos();if((this.flags&I.PERL_X)===0||!e.more()||e.pop()!==L.CODES.get(`\\`)||!e.more())return!1;e.pop();let r=e.from(n),i=Ur.has(r)?Ur.get(r):null;return i===null?!1:(t.appendGroup(i,(this.flags&I.FOLD_CASE)!==0),!0)}parseNamedClass(t,n){let r=t.rest(),i=r.indexOf(`:]`);if(i<0)return!1;let a=r.substring(0,i+2);t.skipString(a);let o=ii.has(a)?ii.get(a):null;if(o===null)throw new Er(e.ERR_INVALID_CHAR_RANGE,a);return n.appendGroup(o,(this.flags&I.FOLD_CASE)!==0),!0}parseUnicodeClass(t,n){let r=t.pos();if((this.flags&I.UNICODE_GROUPS)===0||!t.lookingAt(`\\p`)&&!t.lookingAt(`\\P`))return!1;t.skip(1);let i=1,a=t.pop();if(a===L.CODES.get(`P`)&&(i=-1),!t.more())throw t.rewindTo(r),new Er(e.ERR_INVALID_CHAR_RANGE,t.rest());a=t.pop();let o;if(a!==L.CODES.get(`{`))o=yr.runeToString(a);else{let n=t.rest(),i=n.indexOf(`}`);if(i<0)throw t.rewindTo(r),new Er(e.ERR_INVALID_CHAR_RANGE,t.rest());o=n.substring(0,i),t.skipString(o),t.skip(1)}o.length!==0&&o.codePointAt(0)===L.CODES.get(`^`)&&(i=0-i,o=o.substring(1));let s=e.unicodeTable(o);if(s===null)throw new Er(e.ERR_INVALID_CHAR_RANGE,t.from(r));let c=s.first,l=s.second;if((this.flags&I.FOLD_CASE)===0||l===null)n.appendTableWithSign(c,i);else{let e=new ai().appendTable(c).appendTable(l).cleanClass().toArray();n.appendClassWithSign(e,i)}return!0}parseClass(t){let n=t.pos();t.skip(1);let r=this.newRegexp(R.Op.CHAR_CLASS);r.flags=this.flags;let i=new ai,a=1;t.more()&&t.lookingAt(`^`)&&(a=-1,t.skip(1),(this.flags&I.CLASS_NL)===0&&i.appendRange(L.CODES.get(`
779`),L.CODES.get(`
780`)));let o=!0;for(;!t.more()||t.peek()!==L.CODES.get(`]`)||o;){if(t.more()&&t.lookingAt(`-`)&&(this.flags&I.PERL_X)===0&&!o){let r=t.rest();if(r===`-`||!r.startsWith(`-]`))throw t.rewindTo(n),new Er(e.ERR_INVALID_CHAR_RANGE,t.rest())}o=!1;let r=t.pos();if(t.lookingAt(`[:`)){if(this.parseNamedClass(t,i))continue;t.rewindTo(r)}if(this.parseUnicodeClass(t,i)||this.parsePerlClassEscape(t,i))continue;t.rewindTo(r);let a=e.parseClassChar(t,n),s=a;if(t.more()&&t.lookingAt(`-`)){if(t.skip(1),t.more()&&t.lookingAt(`]`))t.skip(-1);else if(s=e.parseClassChar(t,n),s<a)throw new Er(e.ERR_INVALID_CHAR_RANGE,t.from(r))}(this.flags&I.FOLD_CASE)===0?i.appendRange(a,s):i.appendFoldedRange(a,s)}t.skip(1),i.cleanClass(),a<0&&i.negateClass(),r.runes=i.toArray(),this.push(r)}},li=class{constructor(){this.inst=null,this.cap=[]}},ui=class{constructor(){this.sparse=[],this.densePcs=[],this.denseThreads=[],this.size=0}contains(e){let t=this.sparse[e];return t<this.size&&this.densePcs[t]===e}isEmpty(){return this.size===0}add(e){let t=this.size++;return this.sparse[e]=t,this.denseThreads[t]=null,this.densePcs[t]=e,t}clear(){this.sparse=[],this.densePcs=[],this.denseThreads=[],this.size=0}toString(){let e=`{`;for(let t=0;t<this.size;t++)t!==0&&(e+=`, `),e+=this.densePcs[t];return e+=`}`,e}},di=class e{static fromRE2(t){let n=new e;return n.prog=t.prog,n.re2=t,n.q0=new ui(n.prog.numInst()),n.q1=new ui(n.prog.numInst()),n.pool=[],n.poolSize=0,n.matched=!1,n.matchcap=Array(n.prog.numCap<2?2:n.prog.numCap).fill(0),n.ncap=0,n}static fromMachine(t){let n=new e;return n.re2=t.re2,n.prog=t.prog,n.q0=t.q0,n.q1=t.q1,n.pool=t.pool,n.poolSize=t.poolSize,n.matched=t.matched,n.matchcap=t.matchcap,n.ncap=t.ncap,n}init(e){this.ncap=e,e>this.matchcap.length?this.initNewCap(e):this.resetCap(e)}resetCap(e){for(let t=0;t<this.poolSize;t++){let n=this.pool[t];
780n.cap=Array(e).fill(0)}}initNewCap(e){for(let t=0;t<this.poolSize;t++){let n=this.pool[t];n.cap=Array(e).fill(0)}this.matchcap=Array(e).fill(0)}submatches(){return this.ncap===0?yr.emptyInts():this.matchcap.slice(0,this.ncap)}alloc(e){let t;return this.poolSize>0?(this.poolSize--,t=this.pool[this.poolSize]):t=new li,t.inst=e,t}freeQueue(e,t=0){let n=e.size-t,r=this.poolSize+n;this.pool.length<r&&(this.pool=this.pool.slice(0,Math.max(this.pool.length*2,r)));for(let n=t;n<e.size;n++){let t=e.denseThreads[n];t!==null&&(this.pool[this.poolSize]=t,this.poolSize++)}e.clear()}freeThread(e){this.pool.length<=this.poolSize&&(this.pool=this.pool.slice(0,this.pool.length*2)),this.pool[this.poolSize]=e,this.poolSize++}match(e,t,n){let r=this.re2.cond;if(r===yr.EMPTY_ALL||(n===I.ANCHOR_START||n===I.ANCHOR_BOTH)&&t!==0)return!1;this.matched=!1,this.matchcap=Array(this.prog.numCap).fill(-1);let i=this.q0,a=this.q1,o=e.step(t),s=o>>3,c=o&7,l=-1,u=0;o!==jr.EOF()&&(o=e.step(t+c),l=o>>3,u=o&7);let d;for(d=t===0?yr.emptyOpContext(-1,s):e.context(t);;){if(i.isEmpty()){if((r&yr.EMPTY_BEGIN_TEXT)!==0&&t!==0||this.matched)break;if(this.re2.prefix.length!==0&&l!==this.re2.prefixRune&&e.canCheckPrefix()){let n=e.index(this.re2,t);if(n<0)break;t+=n,o=e.step(t),s=o>>3,c=o&7,o=e.step(t+c),l=o>>3,u=o&7}}!this.matched&&(t===0||n===I.UNANCHORED)&&(this.ncap>0&&(this.matchcap[0]=t),this.add(i,this.prog.start,t,this.matchcap,d,null));let f=t+c;if(d=e.context(f),this.step(i,a,t,f,s,d,n,t===e.endPos()),c===0||this.ncap===0&&this.matched)break;t+=c,s=l,c=u,s!==-1&&(o=e.step(t+c),l=o>>3,u=o&7);let p=i;i=a,a=p}return this.freeQueue(a),this.matched}step(e,t,n,r,i,a,o,s){let c=this.re2.longest;for(let l=0;l<e.size;l++){let u=e.denseThreads[l];if(u===null)continue;if(c&&this.matched&&this.ncap>0&&this.matchcap[0]<u.cap[0]){this.freeThread(u);continue}let d=u.inst,f=!1;switch(d.op){case z.MATCH:if(o===I.ANCHOR_BOTH&&!s)break;this.ncap>0&&(!c||!this.matched||this.matchcap[1]<n)&&(u.cap[1]=n,this.matchcap=u.cap.slice(0,this.ncap)),c||this.freeQueue(e,l+1),this.matched=!0;break;case z.RUNE:f=d.matchRune(i);break;case z.RUNE1:f=i===d.runes[0];break;case z.RUNE_ANY:f=!0;break;case z.RUNE_ANY_NOT_NL:f=i!==L.CODES.get(`
781`);break;default:throw Error(`bad inst`)}f&&(u=this.add(t,d.out,r,u.cap,a,u)),u!==null&&(this.freeThread(u),e.denseThreads[l]=null)}e.clear()}add(e,t,n,r,i,a){if(t===0||e.contains(t))return a;let o=e.add(t),s=this.prog.inst[t];switch(s.op){case z.FAIL:break;case z.ALT:case z.ALT_MATCH:a=this.add(e,s.out,n,r,i,a),a=this.add(e,s.arg,n,r,i,a);break;case z.EMPTY_WIDTH:(s.arg&~i)===0&&(a=this.add(e,s.out,n,r,i,a));break;case z.NOP:a=this.add(e,s.out,n,r,i,a);break;case z.CAPTURE:if(s.arg<this.ncap){let t=r[s.arg];r[s.arg]=n,this.add(e,s.out,n,r,i,null),r[s.arg]=t}else a=this.add(e,s.out,n,r,i,a);break;case z.MATCH:case z.RUNE:case z.RUNE1:case z.RUNE_ANY:case z.RUNE_ANY_NOT_NL:a===null?a=this.alloc(s):a.inst=s,this.ncap>0&&a.cap!==r&&(a.cap=r.slice(0,this.ncap)),e.denseThreads[o]=a,a=null;break;default:throw Error(`unhandled`)}return a}},fi=class{constructor(e){this.value=e}get(){return this.value}set(e){this.value=e}compareAndSet(e,t){return this.value===e?(this.value=t,!0):!1}},pi=class e{static initTest(t){let n=e.compile(t),r=new e(n.expr,n.prog,n.numSubexp,n.longest);return r.cond=n.cond,r.prefix=n.prefix,r.prefixUTF8=n.prefixUTF8,r.prefixComplete=n.prefixComplete,r.prefixRune=n.prefixRune,r}static compile(t){return e.compileImpl(t,I.PERL,!1)}static compilePOSIX(t){return e.compileImpl(t,I.POSIX,!0)}static compileImpl(t,n,r){let i=ci.parse(t,n),a=i.maxCap();i=Rr.simplify(i);let o=Lr.compileRegexp(i),s=new e(t,o,a,r),[c,l]=o.prefix();return s.prefixComplete=c,s.prefix=l,s.prefixUTF8=yr.stringToUtf8ByteArray(s.prefix),s.prefix.length>0&&(s.prefixRune=s.prefix.codePointAt(0)),s.namedGroups=i.namedGroups,s}static match(t,n){return e.compile(t).match(n)}constructor(e,t,n=0,r=0){this.expr=e,this.prog=t,this.numSubexp=n,this.longest=r,this.cond=t.startCond(),this.prefix=null,this.prefixUTF8=null,this.prefixComplete=!1,this.prefixRune=0,this.pooled=new fi}numberOfCapturingGroups(){return this.numSubexp}get(){let e;do e=this.pooled.get();while(e&&!this.pooled.compareAndSet(e,e.next));return e}reset(){this.pooled.set(null)}put(e,t){let n=this.pooled.get();do n=this.pooled.get(),!t&&n&&(e=di.fromMachine(e),t=!0),e.next!==n&&(e.next=n);while(!this.pooled.compareAndSet(n,e))}toString(){return this.expr}doExecute(e,t,n,r){let i=this.get(),a=!1;i?i.next!==null&&(i=di.fromMachine(i),a=!0):(i=di.fromRE2(this),a=!0),i.init(r);
781let o=i.match(e,t,n)?i.submatches():null;return this.put(i,a),o}match(e){return this.doExecute(Pr.fromUTF16(e),0,I.UNANCHORED,0)!==null}matchWithGroup(e,t,n,r,i){return e instanceof xr||(e=wr.utf16(e)),this.matchMachineInput(e,t,n,r,i)}matchMachineInput(e,t,n,r,i){if(t>n)return[!1,null];let a=e.isUTF16Encoding()?Pr.fromUTF16(e.asCharSequence(),0,n):Pr.fromUTF8(e.asBytes(),0,n),o=this.doExecute(a,t,r,2*i);return o===null?[!1,null]:[!0,o]}matchUTF8(e){return this.doExecute(Pr.fromUTF8(e),0,I.UNANCHORED,0)!==null}replaceAll(e,t){return this.replaceAllFunc(e,()=>t,2*e.length+1)}replaceFirst(e,t){return this.replaceAllFunc(e,()=>t,1)}replaceAllFunc(e,t,n){let r=0,i=0,a=``,o=Pr.fromUTF16(e),s=0;for(;i<=e.length;){let c=this.doExecute(o,i,I.UNANCHORED,2);if(c===null||c.length===0)break;a+=e.substring(r,c[0]),(c[1]>r||c[0]===0)&&(a+=t(e.substring(c[0],c[1])),s++),r=c[1];let l=o.step(i)&7;if(i+l>c[1]?i+=l:i+1>c[1]?i++:i=c[1],s>=n)break}return a+=e.substring(r),a}pad(e){if(e===null)return null;let t=(1+this.numSubexp)*2;if(e.length<t){let n=Array(t).fill(-1);for(let t=0;t<e.length;t++)n[t]=e[t];e=n}return e}allMatches(e,t,n=e=>e){let r=[],i=e.endPos();t<0&&(t=i+1);let a=0,o=0,s=-1;for(;o<t&&a<=i;){let t=this.doExecute(e,a,I.UNANCHORED,this.prog.numCap);if(t===null||t.length===0)break;let c=!0;if(t[1]===a){t[0]===s&&(c=!1);let n=e.step(a);n<0?a=i+1:a+=n&7}else a=t[1];s=t[1],c&&(r.push(n(this.pad(t))),o++)}return r}findUTF8(e){let t=this.doExecute(Pr.fromUTF8(e),0,I.UNANCHORED,2);return t===null?null:e.slice(t[0],t[1])}findUTF8Index(e){let t=this.doExecute(Pr.fromUTF8(e),0,I.UNANCHORED,2);return t===null?null:t.slice(0,2)}find(e){let t=this.doExecute(Pr.fromUTF16(e),0,I.UNANCHORED,2);return t===null?``:e.substring(t[0],t[1])}findIndex(e){return this.doExecute(Pr.fromUTF16(e),0,I.UNANCHORED,2)}findUTF8Submatch(e){let t=this.doExecute(Pr.fromUTF8(e),0,I.UNANCHORED,this.prog.numCap);if(t===null)return null;let n=Array(1+this.numSubexp).fill(null);for(let r=0;r<n.length;r++)2*r<t.length&&t[2*r]>=0&&(n[r]=e.slice(t[2*r],t[2*r+1]));return n}findUTF8SubmatchIndex(e){return this.pad(this.doExecute(Pr.fromUTF8(e),0,I.UNANCHORED,this.prog.numCap))}findSubmatch(e){let t=this.doExecute(Pr.fromUTF16(e),0,I.UNANCHORED,this.prog.numCap);if(t===null)return null;let n=Array(1+this.numSubexp).fill(null);for(let r=0;r<n.length;r++)2*r<t.length&&t[2*r]>=0&&(n[r]=e.substring(t[2*r],t[2*r+1]));return n}findSubmatchIndex(e){return this.pad(this.doExecute(Pr.fromUTF16(e),0,I.UNANCHORED,this.prog.numCap))}findAllUTF8(e,t){let n=this.allMatches(Pr.fromUTF8(e),t,t=>e.slice(t[0],t[1]));return n.length===0?null:n}findAllUTF8Index(e,t){let n=this.allMatches(Pr.fromUTF8(e),t,e=>e.slice(0,2));return n.length===0?null:n}findAll(e,t){let n=this.allMatches(Pr.fromUTF16(e),t,t=>e.substring(t[0],t[1]));return n.length===0?null:n}findAllIndex(e,t){let n=this.allMatches(Pr.fromUTF16(e),t,e=>e.slice(0,2));return n.length===0?null:n}findAllUTF8Submatch(e,t){let n=this.allMatches(Pr.fromUTF8(e),t,t=>{let n=Array(t.length/2|0).fill(null);for(let r=0;r<n.length;r++)t[2*r]>=0&&(n[r]=e.slice(t[2*r],t[2*r+1]));return n});return n.length===0?null:n}findAllUTF8SubmatchIndex(e,t){let n=this.allMatches(Pr.fromUTF8(e),t);return n.length===0?null:n}findAllSubmatch(e,t){let n=this.allMatches(Pr.fromUTF16(e),t,t=>{let n=Array(t.length/2|0).fill(null);for(let r=0;r<n.length;r++)t[2*r]>=0&&(n[r]=e.substring(t[2*r],t[2*r+1]));return n});return n.length===0?null:n}findAllSubmatchIndex(e,t){let n=this.allMatches(Pr.fromUTF16(e),t);return n.length===0?null:n}},mi=class e{static CASE_INSENSITIVE=1;static DOTALL=2;static MULTILINE=4;static DISABLE_UNICODE_GROUPS=8;static LONGEST_MATCH=16;static quote(e){return yr.quoteMeta(e)}static compile(t,n=0){let r=t;if((n&e.CASE_INSENSITIVE)!==0&&(r=`(?i)${r}`),(n&e.DOTALL)!==0&&(r=`(?s)${r}`),(n&e.MULTILINE)!==0&&(r=`(?m)${r}`),(n&~(e.MULTILINE|e.DOTALL|e.CASE_INSENSITIVE|e.DISABLE_UNICODE_GROUPS|e.LONGEST_MATCH))!==0)throw new kr(`Flags should only be a combination of MULTILINE, DOTALL, CASE_INSENSITIVE, DISABLE_UNICODE_GROUPS, LONGEST_MATCH`);let i=I.PERL;(n&e.DISABLE_UNICODE_GROUPS)!==0&&(i&=~I.UNICODE_GROUPS);let a=new e(t,n);return a.re2Input=pi.compileImpl(r,i,(n&e.LONGEST_MATCH)!==0),a}static matches(t,n){return e.compile(t).matcher(n).matches()}static initTest(t,n,r){if(t==null)throw Error(`pattern is null`);if(r==null)throw Error(`re2 is null`);let i=new e(t,n);return i.re2Input=r,i}
781constructor(e,t){this.patternInput=e,this.flagsInput=t}reset(){this.re2Input.reset()}flags(){return this.flagsInput}pattern(){return this.patternInput}re2(){return this.re2Input}matches(e){return this.matcher(e).matches()}matcher(e){return Array.isArray(e)&&(e=wr.utf8(e)),new Ar(this,e)}split(e,t=0){let n=this.matcher(e),r=[],i=0,a=0;for(;n.find();){if(a===0&&n.end()===0){a=n.end();continue}if(t>0&&r.length===t-1)break;if(a===n.start()){if(t===0){i+=1,a=n.end();continue}}else for(;i>0;)r.push(``),--i;r.push(n.substring(a,n.start())),a=n.end()}if(t===0&&a!==n.inputLength()){for(;i>0;)r.push(``),--i;r.push(n.substring(a,n.inputLength()))}return(t!==0||r.length===0)&&r.push(n.substring(a,n.inputLength())),r}toString(){return this.patternInput}groupCount(){return this.re2Input.numberOfCapturingGroups()}namedGroups(){return this.re2Input.namedGroups}equals(e){return this===e?!0:e===null||this.constructor!==e.constructor?!1:this.flagsInput===e.flagsInput&&this.patternInput===e.patternInput}},hi=class{constructor(e){this.uid=e}isAuthenticated(){return this.uid!=null}toKey(){return this.isAuthenticated()?`uid:`+this.uid:`anonymous-user`}isEqual(e){return e.uid===this.uid}};hi.UNAUTHENTICATED=new hi(null),hi.GOOGLE_CREDENTIALS=new hi(`google-credentials-uid`),hi.FIRST_PARTY=new hi(`first-party-uid`),hi.MOCK_USER=new hi(`mock-user`);var gi=`12.15.0`;function _i(e){gi=e}var vi=new St(`@firebase/firestore`);function yi(){return vi.logLevel}function B(e,...t){if(vi.logLevel<=_t.DEBUG){let n=t.map(Si);vi.debug(`Firestore (${gi}): ${e}`,...n)}}function bi(e,...t){if(vi.logLevel<=_t.ERROR){let n=t.map(Si);vi.error(`Firestore (${gi}): ${e}`,...n)}}function xi(e,...t){if(vi.logLevel<=_t.WARN){let n=t.map(Si);vi.warn(`Firestore (${gi}): ${e}`,...n)}}function Si(e){if(typeof e==`string`)return e;try{return function(e){return JSON.stringify(e)}(e)}catch{return e}}function Ci(e,t,n){let r=`Unexpected state`;typeof t==`string`?r=t:n=t,wi(e,r,n)}function wi(e,t,n){let r=`FIRESTORE (${gi}) INTERNAL ASSERTION FAILED: ${t} (ID: ${e.toString(16)})`;if(n!==void 0)try{r+=` CONTEXT: `+JSON.stringify(n)}catch{r+=` CONTEXT: `+n}throw bi(r),Error(r)}function V(e,t,n,r){let i=`Unexpected state`;typeof n==`string`?i=n:r=n,e||wi(t,i,r)}function Ti(e,t){return e}var H={OK:`ok`,CANCELLED:`cancelled`,UNKNOWN:`unknown`,INVALID_ARGUMENT:`invalid-argument`,DEADLINE_EXCEEDED:`deadline-exceeded`,NOT_FOUND:`not-found`,ALREADY_EXISTS:`already-exists`,PERMISSION_DENIED:`permission-denied`,UNAUTHENTICATED:`unauthenticated`,RESOURCE_EXHAUSTED:`resource-exhausted`,FAILED_PRECONDITION:`failed-precondition`,ABORTED:`aborted`,OUT_OF_RANGE:`out-of-range`,UNIMPLEMENTED:`unimplemented`,INTERNAL:`internal`,UNAVAILABLE:`unavailable`,DATA_LOSS:`data-loss`},U=class extends Ye{constructor(e,t){super(e,t),this.code=e,this.message=t,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}},Ei=class{constructor(){this.promise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}},Di=class{constructor(e,t){this.user=t,this.type=`OAuth`,this.headers=new Map,this.headers.set(`Authorization`,`Bearer ${e}`)}},Oi=class{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,t){e.enqueueRetryable((()=>t(hi.UNAUTHENTICATED)))}shutdown(){}},ki=class{constructor(e){this.token=e,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(e,t){this.changeListener=t,e.enqueueRetryable((()=>t(this.token.user)))}shutdown(){this.changeListener=null}},Ai=class{constructor(e){this.t=e,this.currentUser=hi.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,t){V(this.o===void 0,42304);let n=this.i,r=e=>this.i===n?Promise.resolve():(n=this.i,t(e)),i=new Ei;this.o=()=>{this.i++,this.currentUser=this.u(),i.resolve(),i=new Ei,e.enqueueRetryable((()=>r(this.currentUser)))};let a=()=>{let t=i;e.enqueueRetryable((async()=>{await t.promise,await r(this.currentUser)}))},o=e=>{B(`FirebaseAuthCredentialsProvider`,`Auth detected`),this.auth=e,this.o&&(this.auth.addAuthTokenListener(this.o),a())};this.t.onInit((e=>o(e))),setTimeout((()=>
781{if(!this.auth){let e=this.t.getImmediate({optional:!0});e?o(e):(B(`FirebaseAuthCredentialsProvider`,`Auth not yet detected`),i.resolve(),i=new Ei)}}),0),a()}getToken(){let e=this.i,t=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(t).then((t=>this.i===e?t?(V(typeof t.accessToken==`string`,31837,{l:t}),new Di(t.accessToken,this.currentUser)):null:(B(`FirebaseAuthCredentialsProvider`,`getToken aborted due to token change.`),this.getToken()))):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.o&&this.auth.removeAuthTokenListener(this.o),this.o=void 0}u(){let e=this.auth&&this.auth.getUid();return V(e===null||typeof e==`string`,2055,{h:e}),new hi(e)}},ji=class{constructor(e,t,n){this.T=e,this.P=t,this.R=n,this.type=`FirstParty`,this.user=hi.FIRST_PARTY,this.I=new Map}A(){return this.R?this.R():null}get headers(){this.I.set(`X-Goog-AuthUser`,this.T);let e=this.A();return e&&this.I.set(`Authorization`,e),this.P&&this.I.set(`X-Goog-Iam-Authorization-Token`,this.P),this.I}},Mi=class{constructor(e,t,n){this.T=e,this.P=t,this.R=n}getToken(){return Promise.resolve(new ji(this.T,this.P,this.R))}start(e,t){e.enqueueRetryable((()=>t(hi.FIRST_PARTY)))}shutdown(){}invalidateToken(){}},Ni=class{constructor(e){this.value=e,this.type=`AppCheck`,this.headers=new Map,e&&e.length>0&&this.headers.set(`x-firebase-appcheck`,this.value)}},Pi=class{constructor(e,t){this.V=t,this.forceRefresh=!1,this.appCheck=null,this.m=null,this.p=null,Nn(e)&&e.settings.appCheckToken&&(this.p=e.settings.appCheckToken)}start(e,t){V(this.o===void 0,3512);let n=e=>{e.error!=null&&B(`FirebaseAppCheckTokenProvider`,`Error getting App Check token; using placeholder token instead. Error: ${e.error.message}`);let n=e.token!==this.m;return this.m=e.token,B(`FirebaseAppCheckTokenProvider`,`Received ${n?`new`:`existing`} token.`),n?t(e.token):Promise.resolve()};this.o=t=>{e.enqueueRetryable((()=>n(t)))};let r=e=>{B(`FirebaseAppCheckTokenProvider`,`AppCheck detected`),this.appCheck=e,this.o&&this.appCheck.addTokenListener(this.o)};this.V.onInit((e=>r(e))),setTimeout((()=>{if(!this.appCheck){let e=this.V.getImmediate({optional:!0});e?r(e):B(`FirebaseAppCheckTokenProvider`,`AppCheck not yet detected`)}}),0)}getToken(){if(this.p)return Promise.resolve(new Ni(this.p));let e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then((e=>e?(V(typeof e.token==`string`,44558,{tokenResult:e}),this.m=e.token,new Ni(e.token)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.o&&this.appCheck.removeTokenListener(this.o),this.o=void 0}};function Fi(e){let t=typeof self<`u`&&(self.crypto||self.msCrypto),n=new Uint8Array(e);if(t&&typeof t.getRandomValues==`function`)t.getRandomValues(n);else for(let t=0;t<e;t++)n[t]=Math.floor(256*Math.random());return n}var Ii=class{static newId(){let e=``;for(;e.length<20;){let t=Fi(40);for(let n=0;n<t.length;++n)e.length<20&&t[n]<248&&(e+=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`.charAt(t[n]%62))}return e}};function Li(e,t){return e<t?-1:+(e>t)}function Ri(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++){let n=e.charAt(r),i=t.charAt(r);if(n!==i)return Vi(n)===Vi(i)?Li(n,i):Vi(n)?1:-1}return Li(e.length,t.length)}var zi=55296,Bi=57343;function Vi(e){let t=e.charCodeAt(0);return t>=zi&&t<=Bi}function Hi(e,t,n){return e.length===t.length&&e.every(((e,r)=>n(e,t[r])))}var Ui=`__name__`,Wi=class e{constructor(e,t,n){t===void 0?t=0:t>e.length&&Ci(637,{offset:t,range:e.length}),n===void 0?n=e.length-t:n>e.length-t&&Ci(1746,{length:n,range:e.length-t}),this.segments=e,this.offset=t,this.len=n}get length(){return this.len}isEqual(t){return e.comparator(this,t)===0}child(t){let n=this.segments.slice(this.offset,this.limit());return t instanceof e?t.forEach((e=>{n.push(e)})):n.push(t),this.construct(n)}limit(){return this.offset+this.length}popFirst(e){return e=e===void 0?1:e,this.construct(this.segments,this.offset+e,this.length-e)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(e){return this.segments[this.offset+e]}isEmpty(){return this.length===0}isPrefixOf(e){if(e.length<this.length)return!1;for(let t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}isImmediateParentOf(e){if(this.length+1!==e.length)return!1;for(let t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}forEach(e){for(let t=this.offset,n=this.limit();t<n;t++)e(this.segments[t])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(t,n){let r=Math.min(t.length,n.length);for(let i=0;i<r;i++){let r=e.compareSegments(t.get(i),n.get(i));if(r!==0)return r}return Li(t.length,n.length)}static compareSegments(t,n){let r=e.isNumericId(t),i=e.isNumericId(n);return r&&!i?-1:!r&&i?1:r&&i?e.extractNumericId(t).compare(e.extractNumericId(n)):Ri(t,n)}static isNumericId(e){return e.startsWith(`__id`)&&e.endsWith(`__`)}static extractNumericId(e){return ar.fromString(e.substring(4,e.length-2))}},Gi=class e extends Wi{construct(t,n,r){return new e(t,n,r)}canonicalString(){return this.toArray().join(`/`)}toString(){return this.canonicalString()}toStringWithLeadingSlash(){return`/${this.canonicalString()}`}
781toUriEncodedString(){return this.toArray().map(encodeURIComponent).join(`/`)}static fromString(...t){let n=[];for(let e of t){if(e.indexOf(`//`)>=0)throw new U(H.INVALID_ARGUMENT,`Invalid segment (${e}). Paths must not contain // in them.`);n.push(...e.split(`/`).filter((e=>e.length>0)))}return new e(n)}static emptyPath(){return new e([])}},Ki=/^[_a-zA-Z][_a-zA-Z0-9]*$/,qi=class e extends Wi{construct(t,n,r){return new e(t,n,r)}static isValidIdentifier(e){return Ki.test(e)}canonicalString(){return this.toArray().map((t=>(t=t.replace(/\\/g,`\\\\`).replace(/`/g,"\\`"),e.isValidIdentifier(t)||(t="`"+t+"`"),t))).join(`.`)}toString(){return this.canonicalString()}isKeyField(){return this.length===1&&this.get(0)===Ui}static keyField(){return new e([Ui])}static fromServerFormat(t){let n=[],r=``,i=0,a=()=>{if(r.length===0)throw new U(H.INVALID_ARGUMENT,`Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);n.push(r),r=``},o=!1;for(;i<t.length;){let e=t[i];if(e===`\\`){if(i+1===t.length)throw new U(H.INVALID_ARGUMENT,`Path has trailing escape character: `+t);let e=t[i+1];if(e!==`\\`&&e!==`.`&&e!=="`")throw new U(H.INVALID_ARGUMENT,`Path has invalid escape sequence: `+t);r+=e,i+=2}else e==="`"?(o=!o,i++):e!==`.`||o?(r+=e,i++):(a(),i++)}if(a(),o)throw new U(H.INVALID_ARGUMENT,"Unterminated ` in path: "+t);return new e(n)}static emptyPath(){return new e([])}},W=class e{constructor(e){this.path=e}static fromPath(t){return new e(Gi.fromString(t))}static fromName(t){return new e(Gi.fromString(t).popFirst(5))}static empty(){return new e(Gi.emptyPath())}get collectionGroup(){return this.path.popLast().lastSegment()}hasCollectionId(e){return this.path.length>=2&&this.path.get(this.path.length-2)===e}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(e){return e!==null&&Gi.comparator(this.path,e.path)===0}toString(){return this.path.toString()}static comparator(e,t){return Gi.comparator(e.path,t.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(t){return new e(new Gi(t.slice()))}};function Ji(e,t,n){if(!n)throw new U(H.INVALID_ARGUMENT,`Function ${e}() cannot be called with an empty ${t}.`)}function Yi(e,t,n,r){if(!0===t&&!0===r)throw new U(H.INVALID_ARGUMENT,`${e} and ${n} cannot be used together.`)}function Xi(e){if(!W.isDocumentKey(e))throw new U(H.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${e} has ${e.length}.`)}function Zi(e){if(W.isDocumentKey(e))throw new U(H.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${e} has ${e.length}.`)}function Qi(e){return typeof e==`object`&&!!e&&(Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null)}function $i(e){if(e===void 0)return`undefined`;if(e===null)return`null`;if(typeof e==`string`)return e.length>20&&(e=`${e.substring(0,20)}...`),JSON.stringify(e);if(typeof e==`number`||typeof e==`boolean`)return``+e;if(typeof e==`object`){if(e instanceof Array)return`an array`;{let t=function(e){return e.constructor?e.constructor.name:null}(e);return t?`a custom ${t} object`:`an object`}}return typeof e==`function`?`a function`:Ci(12329,{type:typeof e})}function ea(e,t){if(`_delegate`in e&&(e=e._delegate),!(e instanceof t)){if(t.name===e.constructor.name)throw new U(H.INVALID_ARGUMENT,`Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?`);{let n=$i(e);throw new U(H.INVALID_ARGUMENT,`Expected type '${t.name}', but it was: ${n}`)}}return e}function ta(e,t){let n={typeString:e};return t&&(n.value=t),n}function na(e,t){if(!Qi(e))throw new U(H.INVALID_ARGUMENT,`JSON must be an object`);let n;for(let r in t)if(t[r]){let i=t[r].typeString,a=`value`in t[r]?{value:t[r].value}:void 0;if(!(r in e)){n=`JSON missing required field: '${r}'`;break}let o=e[r];if(i&&typeof o!==i){n=`JSON field '${r}' must be a ${i}.`;break}if(a!==void 0&&o!==a.value){n=`Expected '${r}' field to equal '${a.value}'`;break}}if(n)throw new U(H.INVALID_ARGUMENT,n);return!0}var ra=-62135596800,ia=1e6,aa=class e{static now(){return e.fromMillis(Date.now())}static fromDate(t){return e.fromMillis(t.getTime())}static fromMillis(t){let n=Math.floor(t/1e3),r=Math.floor((t-1e3*n)*ia);return new e(n,r)}constructor(e,t){if(this.seconds=e,this.nanoseconds=t,t<0||t>=1e9)throw new U(H.INVALID_ARGUMENT,`Timestamp nanoseconds out of range: `+t);if(e<ra||e>=253402300800)throw new U(H.INVALID_ARGUMENT,`Timestamp seconds out of range: `+e)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/ia}_compareTo(e){return this.seconds===e.seconds?Li(this.nanoseconds,e.nanoseconds):Li(this.seconds,e.seconds)}isEqual(e){return e.seconds===this.seconds&&e.nanoseconds===this.nanoseconds}toString(){return`Timestamp(seconds=`+this.seconds+`, nanoseconds=`+this.nanoseconds+`)`}toJSON(){return{type:e._jsonSchemaVersion,seconds:this.seconds,nanoseconds:this.nanoseconds}}static fromJSON(t){if(na(t,e._jsonSchema))return new e(t.seconds,t.nanoseconds)}valueOf(){let e=this.seconds-ra;return String(e).padStart(12,`0`)+`.`+String(this.nanoseconds).padStart(9,`0`)}};aa._jsonSchemaVersion=`firestore/timestamp/1.0`,aa._jsonSchema={type:ta(`string`,aa._jsonSchemaVersion),seconds:ta(`number`),nanoseconds:ta(`number`)};var oa=class e{static fromTimestamp(t){return new e(t)}static min(){return new e(new aa(0,0))}static max(){return new e(new aa(253402300799,999999999))}constructor(e){this.timestamp=e}compareTo(e){return this.timestamp._compareTo(e.timestamp)}isEqual(e){return this.timestamp.isEqual(e.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return`SnapshotVersion(`+this.timestamp.toString()+`)`}toTimestamp(){return this.timestamp}},sa=-1,ca=class{constructor(e,t,n,r){this.indexId=e,this.collectionGroup=t,this.fields=n,this.indexState=r}};ca.UNKNOWN_ID=-1;function la(e,t){let n=e.toTimestamp().seconds,r=e.toTimestamp().nanoseconds+1;return new da(oa.fromTimestamp(r===1e9?new aa(n+1,0):new aa(n,r)),W.empty(),t)}function ua(e){return new da(e.readTime,e.key,sa)}var da=class e{constructor(e,t,n){this.readTime=e,this.documentKey=t,this.largestBatchId=n}static min(){return new e(oa.min(),W.empty(),sa)}static max(){return new e(oa.max(),W.empty(),sa)}};function fa(e,t){let n=e.readTime.compareTo(t.readTime);return n===0?(n=W.comparator(e.documentKey,t.documentKey),n===0?Li(e.largestBatchId,t.largestBatchId):n):n}var pa=`The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.`,ma=class{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}
781raiseOnCommittedEvent(){this.onCommittedListeners.forEach((e=>e()))}};async function ha(e){if(e.code!==H.FAILED_PRECONDITION||e.message!==pa)throw e;B(`LocalStore`,`Unexpectedly lost primary lease`)}var G=class e{constructor(e){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,e((e=>{this.isDone=!0,this.result=e,this.nextCallback&&this.nextCallback(e)}),(e=>{this.isDone=!0,this.error=e,this.catchCallback&&this.catchCallback(e)}))}catch(e){return this.next(void 0,e)}next(t,n){return this.callbackAttached&&Ci(59440),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(n,this.error):this.wrapSuccess(t,this.result):new e(((e,r)=>{this.nextCallback=n=>{this.wrapSuccess(t,n).next(e,r)},this.catchCallback=t=>{this.wrapFailure(n,t).next(e,r)}}))}toPromise(){return new Promise(((e,t)=>{this.next(e,t)}))}wrapUserFunction(t){try{let n=t();return n instanceof e?n:e.resolve(n)}catch(t){return e.reject(t)}}wrapSuccess(t,n){return t?this.wrapUserFunction((()=>t(n))):e.resolve(n)}wrapFailure(t,n){return t?this.wrapUserFunction((()=>t(n))):e.reject(n)}static resolve(t){return new e(((e,n)=>{e(t)}))}static reject(t){return new e(((e,n)=>{n(t)}))}static waitFor(t){return new e(((e,n)=>{let r=0,i=0,a=!1;t.forEach((t=>{++r,t.next((()=>{++i,a&&i===r&&e()}),(e=>n(e)))})),a=!0,i===r&&e()}))}static or(t){let n=e.resolve(!1);for(let r of t)n=n.next((t=>t?e.resolve(t):r()));return n}static forEach(e,t){let n=[];return e.forEach(((e,r)=>{n.push(t.call(this,e,r))})),this.waitFor(n)}static mapArray(t,n){return new e(((e,r)=>{let i=t.length,a=Array(i),o=0;for(let s=0;s<i;s++){let c=s;n(t[c]).next((t=>{a[c]=t,++o,o===i&&e(a)}),(e=>r(e)))}}))}static doWhile(t,n){return new e(((e,r)=>{let i=()=>{!0===t()?n().next((()=>{i()}),r):e()};i()}))}};function ga(e){let t=e.match(/Android ([\d.]+)/i),n=t?t[1].split(`.`).slice(0,2).join(`.`):`-1`;return Number(n)}function _a(e){return e.name===`IndexedDbTransactionError`}var va=class{constructor(e,t){this.previousValue=e,t&&(t.sequenceNumberHandler=e=>this.ae(e),this.ue=e=>t.writeSequenceNumber(e))}ae(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){let e=++this.previousValue;return this.ue&&this.ue(e),e}};va.ce=-1;var K=-1;function ya(e){return e==null}function ba(e){return e===0&&1/e==-1/0}function xa(e){return typeof e==`number`&&Number.isInteger(e)&&!ba(e)&&e<=2**53-1&&e>=-(2**53-1)}function Sa(e){return typeof e==`string`}var Ca=`�`;function wa(e){let t=``;for(let n=0;n<e.length;n++)t.length>0&&(t=Ea(t)),t=Ta(e.get(n),t);return Ea(t)}function Ta(e,t){let n=t,r=e.length;for(let t=0;t<r;t++){let r=e.charAt(t);switch(r){case`\0`:n+=`��`;break;case Ca:n+=`��`;break;default:n+=r}}return n}function Ea(e){return e+`��`}var Da=class e{constructor(e,t){this.comparator=e,this.root=t||ka.EMPTY}insert(t,n){return new e(this.comparator,this.root.insert(t,n,this.comparator).copy(null,null,ka.BLACK,null,null))}remove(t){return new e(this.comparator,this.root.remove(t,this.comparator).copy(null,null,ka.BLACK,null,null))}get(e){let t=this.root;for(;!t.isEmpty();){let n=this.comparator(e,t.key);if(n===0)return t.value;n<0?t=t.left:n>0&&(t=t.right)}return null}indexOf(e){let t=0,n=this.root;for(;!n.isEmpty();){let r=this.comparator(e,n.key);if(r===0)return t+n.left.size;r<0?n=n.left:(t+=n.left.size+1,n=n.right)}return-1}isEmpty(){return this.root.isEmpty()}get size(){return this.root.size}minKey(){return this.root.minKey()}maxKey(){return this.root.maxKey()}inorderTraversal(e){return this.root.inorderTraversal(e)}forEach(e){this.inorderTraversal(((t,n)=>(e(t,n),!1)))}toString(){let e=[];return this.inorderTraversal(((t,n)=>(e.push(`${t}:${n}`),!1))),`{${e.join(`, `)}}`}reverseTraversal(e){return this.root.reverseTraversal(e)}getIterator(){return new Oa(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new Oa(this.root,e,this.comparator,!1)}getReverseIterator(){return new Oa(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new Oa(this.root,e,this.comparator,!0)}},Oa=class{constructor(e,t,n,r){this.isReverse=r,this.nodeStack=[];let i=1;for(;!e.isEmpty();)if(i=t?n(e.key,t):1,t&&r&&(i*=-1),i<0)e=this.isReverse?e.left:e.right;else{if(i===0){this.nodeStack.push(e);break}this.nodeStack.push(e),e=this.isReverse?e.right:e.left}}getNext(){let e=this.nodeStack.pop(),t={key:e.key,value:e.value};if(this.isReverse)for(e=e.left;!e.isEmpty();)this.nodeStack.push(e),e=e.right;else for(e=e.right;!e.isEmpty();)this.nodeStack.push(e),e=e.left;return t}hasNext(){return this.nodeStack.length>0}peek(){if(this.nodeStack.length===0)return null;let e=this.nodeStack[this.nodeStack.length-1];return{key:e.key,value:e.value}}},ka=class e{constructor(t,n,r,i,a){this.key=t,this.value=n,this.color=r??e.RED,this.left=i??e.EMPTY,this.right=a??e.EMPTY,this.size=this.left.size+1+this.right.size}copy(t,n,r,i,a){return new e(t??this.key,n??this.value,r??this.color,i??this.left,a??this.right)}isEmpty(){return!1}inorderTraversal(e){return this.left.inorderTraversal(e)||e(this.key,this.value)||this.right.inorderTraversal(e)}reverseTraversal(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)}min(){return this.left.isEmpty()?this:this.left.min()}minKey(){return this.min().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(e,t,n){let r=this,i=n(e,r.key);return r=i<0?r.copy(null,null,null,r.left.insert(e,t,n),null):i===0?r.copy(null,t,null,null,null):r.copy(null,null,null,null,r.right.insert(e,t,n)),r.fixUp()}removeMin(){if(this.left.isEmpty())return e.EMPTY;let t=this;return t.left.isRed()||t.left.left.isRed()||(t=t.moveRedLeft()),t=t.copy(null,null,null,t.left.removeMin(),null),t.fixUp()}remove(t,n){let r,i=this;if(n(t,i.key)<0)i.left.isEmpty()||i.left.isRed()||i.left.left.isRed()||(i=i.moveRedLeft()),i=i.copy(null,null,null,i.left.remove(t,n),null);else{if(i.left.isRed()&&(i=i.rotateRight()),i.right.isEmpty()||i.right.isRed()||i.right.left.isRed()||(i=i.moveRedRight()),n(t,i.key)===0){if(i.right.isEmpty())return e.EMPTY;r=i.right.min(),i=i.copy(r.key,r.value,null,null,i.right.removeMin())}i=i.copy(null,null,null,null,i.right.remove(t,n))}return i.fixUp()}isRed(){return this.color}fixUp(){let e=this;return e.right.isRed()&&!e.left.isRed()&&(e=e.rotateLeft()),e.left.isRed()&&e.left.left.isRed()&&(e=e.rotateRight()),e.left.isRed()&&e.right.isRed()&&(e=e.colorFlip()),e}moveRedLeft(){let e=this.colorFlip();return e.right.left.isRed()&&(e=e.copy(null,null,null,null,e.right.rotateRight()),e=e.rotateLeft(),e=e.colorFlip()),e}moveRedRight(){let e=this.colorFlip();return e.left.left.isRed()&&(e=e.rotateRight(),e=e.colorFlip()),e}rotateLeft(){let t=this.copy(null,null,e.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)}rotateRight(){let t=this.copy(null,null,e.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)}colorFlip(){let e=this.left.copy(null,null,!this.left.color,null,null),t=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,t)}checkMaxDepth(){return 2**this.check()<=this.size+1}check(){if(this.isRed()&&this.left.isRed())throw Ci(43730,{key:this.key,value:this.value});if(this.right.isRed())throw Ci(14113,{key:this.key,value:this.value});let e=this.left.check();if(e!==this.right.check())throw Ci(27949);return e+ +!this.isRed()}};
781ka.EMPTY=null,ka.RED=!0,ka.BLACK=!1,ka.EMPTY=new class{constructor(){this.size=0}get key(){throw Ci(57766)}get value(){throw Ci(16141)}get color(){throw Ci(16727)}get left(){throw Ci(29726)}get right(){throw Ci(36894)}copy(e,t,n,r,i){return this}insert(e,t,n){return new ka(e,t)}remove(e,t){return this}isEmpty(){return!0}inorderTraversal(e){return!1}reverseTraversal(e){return!1}minKey(){return null}maxKey(){return null}isRed(){return!1}checkMaxDepth(){return!0}check(){return 0}};var Aa=class e{constructor(e){this.comparator=e,this.data=new Da(this.comparator)}has(e){return this.data.get(e)!==null}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(e){return this.data.indexOf(e)}forEach(e){this.data.inorderTraversal(((t,n)=>(e(t),!1)))}forEachInRange(e,t){let n=this.data.getIteratorFrom(e[0]);for(;n.hasNext();){let r=n.getNext();if(this.comparator(r.key,e[1])>=0)return;t(r.key)}}forEachWhile(e,t){let n;for(n=t===void 0?this.data.getIterator():this.data.getIteratorFrom(t);n.hasNext();)if(!e(n.getNext().key))return}firstAfterOrEqual(e){let t=this.data.getIteratorFrom(e);return t.hasNext()?t.getNext().key:null}getIterator(){return new ja(this.data.getIterator())}getIteratorFrom(e){return new ja(this.data.getIteratorFrom(e))}add(e){return this.copy(this.data.remove(e).insert(e,!0))}delete(e){return this.has(e)?this.copy(this.data.remove(e)):this}isEmpty(){return this.data.isEmpty()}unionWith(e){let t=this;return t.size<e.size&&(t=e,e=this),e.forEach((e=>{t=t.add(e)})),t}isEqual(t){if(!(t instanceof e)||this.size!==t.size)return!1;let n=this.data.getIterator(),r=t.data.getIterator();for(;n.hasNext();){let e=n.getNext().key,t=r.getNext().key;if(this.comparator(e,t)!==0)return!1}return!0}toArray(){let e=[];return this.forEach((t=>{e.push(t)})),e}toString(){let e=[];return this.forEach((t=>e.push(t))),`SortedSet(`+e.toString()+`)`}copy(t){let n=new e(this.comparator);return n.data=t,n}},ja=class{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}},Ma=class e{constructor(e){this.fields=e,e.sort(qi.comparator)}static empty(){return new e([])}unionWith(t){let n=new Aa(qi.comparator);for(let e of this.fields)n=n.add(e);for(let e of t)n=n.add(e);return new e(n.toArray())}covers(e){for(let t of this.fields)if(t.isPrefixOf(e))return!0;return!1}isEqual(e){return Hi(this.fields,e.fields,((e,t)=>e.isEqual(t)))}};function Na(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}function Pa(e,t){for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t(n,e[n])}function Fa(e,t){let n=[];for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.push(t(e[r],r,e));return n}function Ia(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}var La=class extends Error{constructor(){super(...arguments),this.name=`Base64DecodeError`}},Ra=class e{constructor(e){this.binaryString=e}static fromBase64String(t){let n=function(e){try{return atob(e)}catch(e){throw typeof DOMException<`u`&&e instanceof DOMException?new La(`Invalid base64 string: `+e):e}}(t);return new e(n)}static fromUint8Array(t){let n=function(e){let t=``;for(let n=0;n<e.length;++n)t+=String.fromCharCode(e[n]);return t}(t);return new e(n)}[Symbol.iterator](){let e=0;return{next:()=>e<this.binaryString.length?{value:this.binaryString.charCodeAt(e++),done:!1}:{value:void 0,done:!0}}}toBase64(){return function(e){return btoa(e)}(this.binaryString)}toUint8Array(){return function(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(e){return Li(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}};Ra.EMPTY_BYTE_STRING=new Ra(``);var za=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function Ba(e){if(V(!!e,39018),typeof e==`string`){let t=0,n=za.exec(e);if(V(!!n,46558,{timestamp:e}),n[1]){let e=n[1];e=(e+`000000000`).substr(0,9),t=Number(e)}let r=new Date(e);return{seconds:Math.floor(r.getTime()/1e3),nanos:t}}return{seconds:Va(e.seconds),nanos:Va(e.nanos)}}function Va(e){return typeof e==`number`?e:typeof e==`string`?Number(e):0}function Ha(e){return typeof e==`string`?Ra.fromBase64String(e):Ra.fromUint8Array(e)}var Ua=`server_timestamp`,Wa=`__type__`,Ga=`__previous_value__`,Ka=`__local_write_time__`;function qa(e){return(e?.mapValue?.fields||{})[Wa]?.stringValue===Ua}function Ja(e){let t=e.mapValue.fields[Ga];return qa(t)?Ja(t):t}function Ya(e){let t=Ba(e.mapValue.fields[Ka].timestampValue);return new aa(t.seconds,t.nanos)}var q=class{constructor(e,t,n,r,i,a,o,s,c,l,u){this.databaseId=e,this.appId=t,this.persistenceKey=n,this.host=r,this.ssl=i,this.forceLongPolling=a,this.autoDetectLongPolling=o,this.longPollingOptions=s,this.useFetchStreams=c,this.isUsingEmulator=l,this.apiKey=u}},J=`(default)`,Xa=class e{constructor(e,t){this.projectId=e,this.database=t||J}static empty(){return new e(``,``)}get isDefaultDatabase(){return this.database===J}isEqual(t){return t instanceof e&&t.projectId===this.projectId&&t.database===this.database}};function Za(e,t){if(!Object.prototype.hasOwnProperty.apply(e.options,[`projectId`]))throw new U(H.INVALID_ARGUMENT,`"projectId" not provided in firebase.initializeApp.`);return new Xa(e.options.projectId,t)}var Qa=`__type__`,$a=`__max__`,eo={mapValue:{fields:{__type__:{stringValue:$a}}}},to=`__vector__`,no=`value`,ro={nullValue:`NULL_VALUE`},io={booleanValue:!0},ao={booleanValue:!1};function oo(e){return`nullValue`in e?0:`booleanValue`in e?1:`integerValue`in e||`doubleValue`in e?2:`timestampValue`in e?3:`stringValue`in e?5:`bytesValue`in e?6:`referenceValue`in e?7:`geoPointValue`in e?8:`arrayValue`in e?9:`mapValue`in e?qa(e)?4:Do(e)?9007199254740991:wo(e)?10:11:Ci(28295,{value:e})}function so(e,t,n){if(e===t)return!0;let r=oo(e);if(r!==oo(t))return!1;switch(r){case 0:case 9007199254740991:return!0;case 1:return e.booleanValue===t.booleanValue;case 4:return Ya(e).isEqual(Ya(t));case 3:return function(e,t){if(typeof e.timestampValue==`string`&&typeof t.timestampValue==`string`&&e.timestampValue.length===t.timestampValue.length)return e.timestampValue===t.timestampValue;let n=Ba(e.timestampValue),r=Ba(t.timestampValue);return n.seconds===r.seconds&&n.nanos===r.nanos}(e,t);case 5:return e.stringValue===t.stringValue;case 6:return function(e,t){return Ha(e.bytesValue).isEqual(Ha(t.bytesValue))}(e,t);case 7:return e.referenceValue===t.referenceValue;case 8:return function(e,t){return Va(e.geoPointValue.latitude)===Va(t.geoPointValue.latitude)&&Va(e.geoPointValue.longitude)===Va(t.geoPointValue.longitude)}(e,t);case 2:return function(e,t,n){if(`integerValue`in e&&`integerValue`in t)return Va(e.integerValue)===Va(t.integerValue);let r,i;if(`doubleValue`in e&&`doubleValue`in t)r=Va(e.doubleValue),i=Va(t.doubleValue);else{if(!n?.Ee)return!1;r=Va(e.integerValue??e.doubleValue),i=Va(t.integerValue??t.doubleValue)}return r===i?!!n?.he||ba(r)===ba(i):!!(n===void 0||n.Te)&&isNaN(r)&&isNaN(i)}
781(e,t,n);case 9:return Hi(e.arrayValue.values||[],t.arrayValue.values||[],((e,t)=>so(e,t,n)));case 10:case 11:return function(e,t,n){let r=e.mapValue.fields||{},i=t.mapValue.fields||{};if(Na(r)!==Na(i))return!1;for(let e in r)if(r.hasOwnProperty(e)&&(i[e]===void 0||!so(r[e],i[e],n)))return!1;return!0}(e,t,n);default:return Ci(52216,{left:e})}}function co(e,t){return(e.values||[]).find((e=>so(e,t)))!==void 0}function lo(e,t){if(e===t)return 0;let n=oo(e),r=oo(t);if(n!==r)return Li(n,r);switch(n){case 0:case 9007199254740991:return 0;case 1:return Li(e.booleanValue,t.booleanValue);case 2:return function(e,t){let n=Va(e.integerValue||e.doubleValue),r=Va(t.integerValue||t.doubleValue);return n<r?-1:n>r?1:n===r?0:isNaN(n)?isNaN(r)?0:-1:1}(e,t);case 3:return uo(e.timestampValue,t.timestampValue);case 4:return uo(Ya(e),Ya(t));case 5:return Ri(e.stringValue,t.stringValue);case 6:return function(e,t){let n=Ha(e),r=Ha(t);return n.compareTo(r)}(e.bytesValue,t.bytesValue);case 7:return function(e,t){let n=e.split(`/`),r=t.split(`/`);for(let e=0;e<n.length&&e<r.length;e++){let t=Li(n[e],r[e]);if(t!==0)return t}return Li(n.length,r.length)}(e.referenceValue,t.referenceValue);case 8:return function(e,t){let n=Li(Va(e.latitude),Va(t.latitude));return n===0?Li(Va(e.longitude),Va(t.longitude)):n}(e.geoPointValue,t.geoPointValue);case 9:return fo(e.arrayValue,t.arrayValue);case 10:return function(e,t){let n=e.fields||{},r=t.fields||{},i=n[no]?.arrayValue,a=r[no]?.arrayValue,o=Li(i?.values?.length||0,a?.values?.length||0);return o===0?fo(i,a):o}(e.mapValue,t.mapValue);case 11:return function(e,t){if(e===eo.mapValue&&t===eo.mapValue)return 0;if(e===eo.mapValue)return 1;if(t===eo.mapValue)return-1;let n=e.fields||{},r=Object.keys(n),i=t.fields||{},a=Object.keys(i);r.sort(),a.sort();for(let e=0;e<r.length&&e<a.length;++e){let t=Ri(r[e],a[e]);if(t!==0)return t;let o=lo(n[r[e]],i[a[e]]);if(o!==0)return o}return Li(r.length,a.length)}(e.mapValue,t.mapValue);default:throw Ci(23264,{Pe:n})}}function uo(e,t){if(typeof e==`string`&&typeof t==`string`&&e.length===t.length)return Li(e,t);let n=Ba(e),r=Ba(t),i=Li(n.seconds,r.seconds);return i===0?Li(n.nanos,r.nanos):i}function fo(e,t){let n=e.values||[],r=t.values||[];for(let e=0;e<n.length&&e<r.length;++e){let t=lo(n[e],r[e]);if(t!==void 0&&t!==0)return t}return Li(n.length,r.length)}function po(e){return mo(e)}function mo(e){return`nullValue`in e?`null`:`booleanValue`in e?``+e.booleanValue:`integerValue`in e?``+e.integerValue:`doubleValue`in e?``+e.doubleValue:`timestampValue`in e?function(e){let t=Ba(e);return`time(${t.seconds},${t.nanos})`}(e.timestampValue):`stringValue`in e?e.stringValue:`bytesValue`in e?function(e){return Ha(e).toBase64()}(e.bytesValue):`referenceValue`in e?function(e){return W.fromName(e).toString()}(e.referenceValue):`geoPointValue`in e?function(e){return`geo(${e.latitude},${e.longitude})`}(e.geoPointValue):`arrayValue`in e?function(e){let t=`[`,n=!0;for(let r of e.values||[])n?n=!1:t+=`,`,t+=mo(r);return t+`]`}(e.arrayValue):`mapValue`in e?function(e){let t=Object.keys(e.fields||{}).sort(),n=`{`,r=!0;for(let i of t)r?r=!1:n+=`,`,n+=`${i}:${mo(e.fields[i])}`;return n+`}`}(e.mapValue):Ci(61005,{value:e})}function ho(e){switch(oo(e)){case 0:case 1:return 4;case 2:return 8;case 3:case 8:return 16;case 4:let t=Ja(e);return t?16+ho(t):16;case 5:return 2*e.stringValue.length;case 6:return Ha(e.bytesValue).approximateByteSize();case 7:return e.referenceValue.length;case 9:return function(e){return(e.values||[]).reduce(((e,t)=>e+ho(t)),0)}(e.arrayValue);case 10:case 11:return function(e){let t=0;return Pa(e.fields,((e,n)=>{t+=e.length+ho(n)})),t}(e.mapValue);default:throw Ci(13486,{value:e})}}function go(e,t){return{referenceValue:`projects/${e.projectId}/databases/${e.database}/documents/${t.path.canonicalString()}`}}function _o(e){return!!e&&`integerValue`in e}function vo(e){return!!e&&`doubleValue`in e}function yo(e){return _o(e)||vo(e)}function bo(e){return!!e&&`arrayValue`in e}function xo(e){return!!e&&`nullValue`in e}function So(e){return!!e&&`doubleValue`in e&&isNaN(Number(e.doubleValue))}function Co(e){return!!e&&`mapValue`in e}function wo(e){return(e?.mapValue?.fields||{})[Qa]?.stringValue===to}function To(e){return(e?.mapValue?.fields||{})[no]?.arrayValue}function Eo(e){if(e.geoPointValue)return{geoPointValue:{...e.geoPointValue}};if(e.timestampValue&&typeof e.timestampValue==`object`)return{timestampValue:{...e.timestampValue}};if(e.mapValue){let t={mapValue:{fields:{}}};return Pa(e.mapValue.fields,((e,n)=>t.mapValue.fields[e]=Eo(n))),t}if(e.arrayValue){let t={arrayValue:{values:[]}};for(let n=0;n<(e.arrayValue.values||[]).length;++n)t.arrayValue.values[n]=Eo(e.arrayValue.values[n]);return t}return{...e}}function Do(e){return(((e.mapValue||{}).fields||{}).__type__||{}).stringValue===$a}var Oo=class e{constructor(e){this.value=e}static empty(){return new e({mapValue:{}})}field(e){if(e.isEmpty())return this.value;{let t=this.value;for(let n=0;n<e.length-1;++n)if(t=(t.mapValue.fields||{})[e.get(n)],!Co(t))return null;return t=(t.mapValue.fields||{})[e.lastSegment()],t||null}}set(e,t){this.getFieldsMap(e.popLast())[e.lastSegment()]=Eo(t)}setAll(e){let t=qi.emptyPath(),n={},r=[];e.forEach(((e,i)=>{if(!t.isImmediateParentOf(i)){let e=this.getFieldsMap(t);this.applyChanges(e,n,r),n={},r=[],t=i.popLast()}e?n[i.lastSegment()]=Eo(e):r.push(i.lastSegment())}
781));let i=this.getFieldsMap(t);this.applyChanges(i,n,r)}delete(e){let t=this.field(e.popLast());Co(t)&&t.mapValue.fields&&delete t.mapValue.fields[e.lastSegment()]}isEqual(e){return so(this.value,e.value)}getFieldsMap(e){let t=this.value;t.mapValue.fields||(t.mapValue={fields:{}});for(let n=0;n<e.length;++n){let r=t.mapValue.fields[e.get(n)];Co(r)&&r.mapValue.fields||(r={mapValue:{fields:{}}},t.mapValue.fields[e.get(n)]=r),t=r}return t.mapValue.fields}applyChanges(e,t,n){Pa(t,((t,n)=>e[t]=n));for(let t of n)delete e[t]}clone(){return new e(Eo(this.value))}};function ko(e){let t=[];return Pa(e.fields,((e,n)=>{let r=new qi([e]);if(Co(n)){let e=ko(n.mapValue).fields;if(e.length===0)t.push(r);else for(let n of e)t.push(r.child(n))}else t.push(r)})),new Ma(t)}function Ao(e,t){if(e.useProto3Json){if(isNaN(t))return{doubleValue:`NaN`};if(t===1/0)return{doubleValue:`Infinity`};if(t===-1/0)return{doubleValue:`-Infinity`}}return{doubleValue:ba(t)?`-0`:t}}function jo(e){return{integerValue:``+e}}function Mo(e,t,n){return Number.isInteger(t)&&n?.preferIntegers||xa(t)?jo(t):Ao(e,t)}var No=class{constructor(){this._=void 0}};function Po(e,t,n){return e instanceof Lo?function(e,t){let n={fields:{[Wa]:{stringValue:Ua},[Ka]:{timestampValue:{seconds:e.seconds,nanos:e.nanoseconds}}}};return t&&qa(t)&&(t=Ja(t)),t&&(n.fields[Ga]=t),{mapValue:n}}(n,t):e instanceof Ro?zo(e,t):e instanceof Bo?Vo(e,t):e instanceof Uo?function(e,t){let n=Io(e,t),r=qo(n)+qo(e.Re);return _o(n)&&_o(e.Re)?jo(r):Ao(e.serializer,r)}(e,t):e instanceof Wo?function(e,t){return Ko(e,t,Math.min)}(e,t):e instanceof Go?function(e,t){return Ko(e,t,Math.max)}(e,t):void 0}
781function Fo(e,t,n){return e instanceof Ro?zo(e,t):e instanceof Bo?Vo(e,t):n}function Io(e,t){return e instanceof Uo?yo(t)?t:{integerValue:0}:null}var Lo=class extends No{},Ro=class extends No{constructor(e){super(),this.elements=e}};function zo(e,t){let n=Jo(t);for(let t of e.elements)n.some((e=>so(e,t)))||n.push(t);return{arrayValue:{values:n}}}var Bo=class extends No{constructor(e){super(),this.elements=e}};function Vo(e,t){let n=Jo(t);for(let t of e.elements)n=n.filter((e=>!so(e,t)));return{arrayValue:{values:n}}}var Ho=class extends No{constructor(e,t){super(),this.serializer=e,this.Re=t}},Uo=class extends Ho{},Wo=class extends Ho{},Go=class extends Ho{};function Ko(e,t,n){if(!yo(t))return e.Re;let r=n(qo(t),qo(e.Re));return _o(t)&&_o(e.Re)?jo(r):Ao(e.serializer,r)}function qo(e){return Va(e.integerValue||e.doubleValue)}function Jo(e){return bo(e)&&e.arrayValue.values?e.arrayValue.values.slice():[]}function Yo(e,t){return e.field.isEqual(t.field)&&function(e,t){return e instanceof Ro&&t instanceof Ro||e instanceof Bo&&t instanceof Bo?Hi(e.elements,t.elements,so):e instanceof Uo&&t instanceof Uo||e instanceof Wo&&t instanceof Wo||e instanceof Go&&t instanceof Go?so(e.Re,t.Re):e instanceof Lo&&t instanceof Lo}(e.transform,t.transform)}var Xo=class{constructor(e,t){this.version=e,this.transformResults=t}},Zo=class e{constructor(e,t){this.updateTime=e,this.exists=t}static none(){return new e}static exists(t){return new e(void 0,t)}static updateTime(t){return new e(t)}get isNone(){return this.updateTime===void 0&&this.exists===void 0}isEqual(e){return this.exists===e.exists&&(this.updateTime?!!e.updateTime&&this.updateTime.isEqual(e.updateTime):!e.updateTime)}};function Qo(e,t){return e.updateTime===void 0?e.exists===void 0||e.exists===t.isFoundDocument():t.isFoundDocument()&&t.version.isEqual(e.updateTime)}var $o=class{};function es(e,t){if(!e.hasLocalMutations||t&&t.fields.length===0)return null;if(t===null)return e.isNoDocument()?new us(e.key,Zo.none()):new as(e.key,e.data,Zo.none());{let n=e.data,r=Oo.empty(),i=new Aa(qi.comparator);for(let e of t.fields)if(!i.has(e)){let t=n.field(e);t===null&&e.length>1&&(e=e.popLast(),t=n.field(e)),t===null?r.delete(e):r.set(e,t),i=i.add(e)}return new os(e.key,r,new Ma(i.toArray()),Zo.none())}}function ts(e,t,n){e instanceof as?function(e,t,n){let r=e.value.clone(),i=cs(e.fieldTransforms,t,n.transformResults);r.setAll(i),t.convertToFoundDocument(n.version,r).setHasCommittedMutations()}(e,t,n):e instanceof os?function(e,t,n){if(!Qo(e.precondition,t))return void t.convertToUnknownDocument(n.version);let r=cs(e.fieldTransforms,t,n.transformResults),i=t.data;i.setAll(ss(e)),i.setAll(r),t.convertToFoundDocument(n.version,i).setHasCommittedMutations()}(e,t,n):function(e,t,n){t.convertToNoDocument(n.version).setHasCommittedMutations()}(0,t,n)}function ns(e,t,n,r){return e instanceof as?function(e,t,n,r){if(!Qo(e.precondition,t))return n;let i=e.value.clone(),a=ls(e.fieldTransforms,r,t);return i.setAll(a),t.convertToFoundDocument(t.version,i).setHasLocalMutations(),null}(e,t,n,r):e instanceof os?function(e,t,n,r){if(!Qo(e.precondition,t))return n;let i=ls(e.fieldTransforms,r,t),a=t.data;return a.setAll(ss(e)),a.setAll(i),t.convertToFoundDocument(t.version,a).setHasLocalMutations(),n===null?null:n.unionWith(e.fieldMask.fields).unionWith(e.fieldTransforms.map((e=>e.field)))}(e,t,n,r):function(e,t,n){return Qo(e.precondition,t)?(t.convertToNoDocument(t.version).setHasLocalMutations(),null):n}(e,t,n)}function rs(e,t){let n=null;for(let r of e.fieldTransforms){let e=t.data.field(r.field),i=Io(r.transform,e||null);i!=null&&(n===null&&(n=Oo.empty()),n.set(r.field,i))}return n||null}function is(e,t){return e.type===t.type&&!!e.key.isEqual(t.key)&&!!e.precondition.isEqual(t.precondition)&&!!function(e,t){return e===void 0&&t===void 0||!(!e||!t)&&Hi(e,t,((e,t)=>Yo(e,t)))}(e.fieldTransforms,t.fieldTransforms)&&(e.type===0?e.value.isEqual(t.value):e.type!==1||e.data.isEqual(t.data)&&e.fieldMask.isEqual(t.fieldMask))}var as=class extends $o{constructor(e,t,n,r=[]){super(),this.key=e,this.value=t,this.prec
781ondition=n,this.fieldTransforms=r,this.type=0}getFieldMask(){return null}},os=class extends $o{constructor(e,t,n,r,i=[]){super(),this.key=e,this.data=t,this.fieldMask=n,this.precondition=r,this.fieldTransforms=i,this.type=1}getFieldMask(){return this.fieldMask}};function ss(e){let t=new Map;return e.fieldMask.fields.forEach((n=>{if(!n.isEmpty()){let r=e.data.field(n);t.set(n,r)}})),t}function cs(e,t,n){let r=new Map;V(e.length===n.length,32656,{Ie:n.length,Ae:e.length});for(let i=0;i<n.length;i++){let a=e[i],o=a.transform,s=t.data.field(a.field);r.set(a.field,Fo(o,s,n[i]))}return r}function ls(e,t,n){let r=new Map;for(let i of e){let e=i.transform,a=n.data.field(i.field);r.set(i.field,Po(e,a,t))}return r}var us=class extends $o{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}},ds=class extends $o{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}},fs=class{constructor(e,t){this.position=e,this.inclusive=t}};function ps(e,t,n){let r=0;for(let i=0;i<e.position.length;i++){let a=t[i],o=e.position[i];if(r=a.field.isKeyField()?W.comparator(W.fromName(o.referenceValue),n.key):lo(o,n.data.field(a.field)),a.dir===`desc`&&(r*=-1),r!==0)break}return r}function ms(e,t){if(e===null)return t===null;if(t===null||e.inclusive!==t.inclusive||e.position.length!==t.position.length)return!1;for(let n=0;n<e.position.length;n++)if(!so(e.position[n],t.position[n]))return!1;return!0}var hs=class{},gs=class e extends hs{constructor(e,t,n){super(),this.field=e,this.op=t,this.value=n}static create(t,n,r){return t.isKeyField()?n===`in`||n===`not-in`?this.createKeyFieldInFilter(t,n,r):new ws(t,n,r):n===`array-contains`?new Os(t,r):n===`in`?new ks(t,r):n===`not-in`?new As(t,r):n===`array-contains-any`?new js(t,r):new e(t,n,r)}static createKeyFieldInFilter(e,t,n){return t===`in`?new Ts(e,n):new Es(e,n)}matches(e){let t=e.data.field(this.field);return this.op===`!=`?t!==null&&t.nullValue===void 0&&this.matchesComparison(lo(t,this.value)):t!==null&&oo(this.value)===oo(t)&&this.matchesComparison(lo(t,this.value))}matchesComparison(e){switch(this.op){case`<`:return e<0;case`<=`:return e<=0;case`==`:return e===0;case`!=`:return e!==0;case`>`:return e>0;case`>=`:return e>=0;default:return Ci(47266,{operator:this.op})}}isInequality(){return[`<`,`<=`,`>`,`>=`,`!=`,`not-in`].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}},_s=class e extends hs{constructor(e,t){super(),this.filters=e,this.op=t,this.Ve=null}static create(t,n){return new e(t,n)}matches(e){return vs(this)?this.filters.find((t=>!t.matches(e)))===void 0:this.filters.find((t=>t.matches(e)))!==void 0}getFlattenedFilters(){return this.Ve!==null||(this.Ve=this.filters.reduce(((e,t)=>e.concat(t.getFlattenedFilters())),[])),this.Ve}getFilters(){return Object.assign([],this.filters)}};function vs(e){return e.op===`and`}function ys(e){return bs(e)&&vs(e)}function bs(e){for(let t of e.filters)if(t instanceof _s)return!1;return!0}function xs(e){if(e instanceof gs)return e.field.canonicalString()+e.op.toString()+po(e.value);if(ys(e))return e.filters.map((e=>xs(e))).join(`,`);{let t=e.filters.map((e=>xs(e))).join(`,`);return`${e.op}(${t})`}}function Ss(e,t){return e instanceof gs?function(e,t){return t instanceof gs&&e.op===t.op&&e.field.isEqual(t.field)&&so(e.value,t.value)}(e,t):e instanceof _s?function(e,t){return t instanceof _s&&e.op===t.op&&e.filters.length===t.filters.length&&e.filters.reduce(((e,n,r)=>e&&Ss(n,t.filters[r])),!0)}(e,t):void Ci(19439)}function Cs(e){return e instanceof gs?function(e){return`${e.field.canonicalString()} ${e.op} ${po(e.value)}`}(e):e instanceof _s?function(e){return e.op.toString()+` {`+e.getFilters().map(Cs).join(` ,`)+`}`}(e):`Filter`}var ws=class extends gs{constructor(e,t,n){super(e,t,n),this.key=W.fromName(n.referenceValue)}matches(e){let t=W.comparator(e.key,this.key);return this.matchesComparison(t)}},Ts=class extends gs{constructor(e,t){super(e,`in`,t),this.keys=Ds(`in`,t)}matches(e){return this.keys.some((t=>t.isEqual(e.key)))}},Es=class extends gs{constructor(e,t){super(e,`not-in`,t),this.keys=Ds(`not-in`,t)}matches(e){return!this.keys.some((t=>t.isEqual(e.key)))}};function Ds(e,t){return(t.arrayValue?.values||[]).map((e=>W.fromName(e.referenceValue)))}var Os=class extends gs{constructor(e,t){super(e,`array-contains`,t)}matches(e){let t=e.data.field(this.field);return bo(t)&&co(t.arrayValue,this.value)}},ks=class extends gs{constructor(e,t){super(e,`in`,t)}matches(e){let t=e.data.field(this.field);return t!==null&&co(this.value.arrayValue,t)}},As=class extends gs{constructor(e,t){super(e,`not-in`,t)}matches(e){if(co(this.value.arrayValue,{nullValue:`NULL_VALUE`}))return!1;let t=e.data.field(this.field);return t!==null&&t.nullValue===void 0&&!co(this.value.arrayValue,t)}},js=class extends gs{constructor(e,t){super(e,`array-contains-any`,t)}matches(e){let t=e.data.field(this.field);return!(!bo(t)||!t.arrayValue.values)&&t.arrayValue.values.some((e=>co(this.value.arrayValue,e)))}},Ms=class{constructor(e,t=`asc`){this.field=e,this.dir=t}};function Ns(e,t){return e.dir===t.dir&&e.field.isEqual(t.field)}var Ps=class e{constructor(e,t,n,r,i,a,o){this.key=e,this.documentType=t,this.version=n,this.readTime=r,this.createTime=i,this.data=a,this.documentState=o}static newInvalidDocument(t){return new e(t,0,oa.min(),oa.min(),oa.min(),Oo.empty(),0)}static newFoundDocument(t,n,r,i){return new e(t,1,n,oa.min(),r,i,0)}static newNoDocument(t,n){return new e(t,2,n,oa.min(),oa.min(),Oo.empty(),0)}static newUnknownDocument(t,n){return new e(t,3,n,oa.min(),oa.min(),Oo.empty(),2)}convertToFoundDocument(e,t){return!this.createTime.isEqual(oa.min())||this.documentType!==2&&this.documentType!==0||(this.createTime=e),this.version=e,this.documentType=1,this.data=t,this.documentState=0,this}convertToNoDocument(e){return this.version=e,this.documentType=2,this.data=Oo.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=Oo.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=oa.min(),this}setReadTime(e){return this.readTime=e,this}get hasLocalMutations(){return this.documentState===1}get hasCommittedMutations(){return this.documentState===2}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return this.documentType!==0}isFoundDocument(){return this.documentType===1}isNoDocument(){return this.documentType===2}isUnknownDocument(){return this.documentType===3}isEqual(t){return t instanceof e&&this.key.isEqual(t.key)&&this.version.isEqual(t.version)&&this.documentType===t.documentType&&this.documentState===t.documentState&&this.data.isEqual(t.data)}mutableCopy(){return new e(this.key,this.documentType,this.version,this.readTime,this.createTime,this.data.clone(),this.documentState)}toString(){return`Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {createTime: ${this.createTime}}), {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`}}
781,Fs=class{constructor(e,t=null,n=[],r=[],i=null,a=null,o=null){this.path=e,this.collectionGroup=t,this.orderBy=n,this.filters=r,this.limit=i,this.startAt=a,this.endAt=o,this.de=null}};function Is(e,t=null,n=[],r=[],i=null,a=null,o=null){return new Fs(e,t,n,r,i,a,o)}function Ls(e){let t=Ti(e);if(t.de===null){let e=t.path.canonicalString();t.collectionGroup!==null&&(e+=`|cg:`+t.collectionGroup),e+=`|f:`,e+=t.filters.map((e=>xs(e))).join(`,`),e+=`|ob:`,e+=t.orderBy.map((e=>function(e){return e.field.canonicalString()+e.dir}(e))).join(`,`),ya(t.limit)||(e+=`|l:`,e+=t.limit),t.startAt&&(e+=`|lb:`,e+=t.startAt.inclusive?`b:`:`a:`,e+=t.startAt.position.map((e=>po(e))).join(`,`)),t.endAt&&(e+=`|ub:`,e+=t.endAt.inclusive?`a:`:`b:`,e+=t.endAt.position.map((e=>po(e))).join(`,`)),t.de=e}return t.de}function Rs(e,t){if(e.limit!==t.limit||e.orderBy.length!==t.orderBy.length)return!1;for(let n=0;n<e.orderBy.length;n++)if(!Ns(e.orderBy[n],t.orderBy[n]))return!1;if(e.filters.length!==t.filters.length)return!1;for(let n=0;n<e.filters.length;n++)if(!Ss(e.filters[n],t.filters[n]))return!1;return e.collectionGroup===t.collectionGroup&&!!e.path.isEqual(t.path)&&!!ms(e.startAt,t.startAt)&&ms(e.endAt,t.endAt)}function zs(e){return!!e.isCorePipeline}function Bs(e){return!!e.path&&W.isDocumentKey(e.path)&&e.collectionGroup===null&&e.filters.length===0}var Vs=class{constructor(e,t=null,n=[],r=[],i=null,a=`F`,o=null,s=null){this.path=e,this.collectionGroup=t,this.explicitOrderBy=n,this.filters=r,this.limit=i,this.limitType=a,this.startAt=o,this.endAt=s,this.fe=null,this.me=null,this.pe=null,this.startAt,this.endAt}};function Hs(e,t,n,r,i,a,o,s){return new Vs(e,t,n,r,i,a,o,s)}function Us(e){return new Vs(e)}function Ws(e){return e.filters.length===0&&e.limit===null&&e.startAt==null&&e.endAt==null&&(e.explicitOrderBy.length===0||e.explicitOrderBy.length===1&&e.explicitOrderBy[0].field.isKeyField())}function Gs(e){return W.isDocumentKey(e.path)&&e.collectionGroup===null&&e.filters.length===0}function Ks(e){return e.collectionGroup!==null}function qs(e){let t=Ti(e);if(t.fe===null){t.fe=[];let e=new Set;for(let n of t.explicitOrderBy)t.fe.push(n),e.add(n.field.canonicalString());let n=t.explicitOrderBy.length>0?t.explicitOrderBy[t.explicitOrderBy.length-1].dir:`asc`;(function(e){let t=new Aa(qi.comparator);return e.filters.forEach((e=>{e.getFlattenedFilters().forEach((e=>{e.isInequality()&&(t=t.add(e.field))}))})),t})(t).forEach((r=>{e.has(r.canonicalString())||r.isKeyField()||t.fe.push(new Ms(r,n))})),e.has(qi.keyField().canonicalString())||t.fe.push(new Ms(qi.keyField(),n))}return t.fe}function Js(e){let t=Ti(e);return t.me||=Ys(t,qs(e)),t.me}function Ys(e,t){if(e.limitType===`F`)return Is(e.path,e.collectionGroup,t,e.filters,e.limit,e.startAt,e.endAt);{t=t.map((e=>{let t=e.dir===`desc`?`asc`:`desc`;return new Ms(e.field,t)}));let n=e.endAt?new fs(e.endAt.position,e.endAt.inclusive):null,r=e.startAt?new fs(e.startAt.position,e.startAt.inclusive):null;return Is(e.path,e.collectionGroup,t,e.filters,e.limit,n,r)}}function Xs(e,t){let n=e.filters.concat([t]);return new Vs(e.path,e.collectionGroup,e.explicitOrderBy.slice(),n,e.limit,e.limitType,e.startAt,e.endAt)}function Zs(e,t){let n=e.explicitOrderBy.concat([t]);return new Vs(e.path,e.collectionGroup,n,e.filters.slice(),e.limit,e.limitType,e.startAt,e.endAt)}function Qs(e,t,n){return new Vs(e.path,e.collectionGroup,e.explicitOrderBy.slice(),e.filters.slice(),t,n,e.startAt,e.endAt)}function $s(e,t){return Rs(Js(e),Js(t))&&e.limitType===t.limitType}function ec(e){return`Query(target=${function(e){let t=e.path.canonicalString();return e.collectionGroup!==null&&(t+=` collectionGroup=`+e.collectionGroup),e.filters.length>0&&(t+=`, filters: [${e.filters.map((e=>Cs(e))).join(`, `)}]`),ya(e.limit)||(t+=`, limit: `+e.limit),e.orderBy.length>0&&(t+=`, orderBy: [${e.orderBy.map((e=>function(e){return`${e.field.canonicalString()} (${e.dir})`}(e))).join(`, `)}]`),e.startAt&&(t+=`, startAt: `,t+=e.startAt.inclusive?`b:`:`a:`,t+=e.startAt.position.map((e=>po(e))).join(`,`)),e.endAt&&(t+=`, endAt: `,t+=e.endAt.inclusive?`a:`:`b:`,t+=e.endAt.position.map((e=>po(e))).join(`,`)),`Target(${t})`}(Js(e))}; limitType=${e.limitType})`}function tc(e,t){return t.isFoundDocument()&&function(e,t){let n=t.key.path;return e.collectionGroup===null?W.isDocumentKey(e.path)?e.path.isEqual(n):e.path.isImmediateParentOf(n):t.key.hasCollectionId(e.collectionGroup)&&e.path.isPrefixOf(n)}(e,t)&&function(e,t){for(let n of qs(e))if(!n.field.isKeyField()&&t.data.field(n.field)===null)return!1;return!0}(e,t)&&function(e,t){for(let n of e.filters)if(!n.matches(t))return!1;return!0}(e,t)&&function(e,t){return!(e.startAt&&!function(e,t,n){let r=ps(e,t,n);return e.inclusive?r<=0:r<0}(e.startAt,qs(e),t)||e.endAt&&!function(e,t,n){let r=ps(e,t,n);return e.inclusive?r>=0:r>0}(e.endAt,qs(e),t))}(e,t)}function nc(e){return(t,n)=>{let r=!1;for(let i of qs(e)){let e=rc(i,t,n);if(e!==0)return e;r||=i.field.isKeyField()}return 0}}
781function rc(e,t,n){let r=e.field.isKeyField()?W.comparator(t.key,n.key):function(e,t,n){let r=t.data.field(e),i=n.data.field(e);return r!==null&&i!==null?lo(r,i):Ci(42886)}(e.field,t,n);switch(e.dir){case`asc`:return r;case`desc`:return-1*r;default:return Ci(19790,{direction:e.dir})}}var ic=class{constructor(e,t){this.count=e,this.unchangedNames=t}},ac,oc;function sc(e){switch(e){case H.OK:return Ci(64938);case H.CANCELLED:case H.UNKNOWN:case H.DEADLINE_EXCEEDED:case H.RESOURCE_EXHAUSTED:case H.INTERNAL:case H.UNAVAILABLE:case H.UNAUTHENTICATED:return!1;case H.INVALID_ARGUMENT:case H.NOT_FOUND:case H.ALREADY_EXISTS:case H.PERMISSION_DENIED:case H.FAILED_PRECONDITION:case H.ABORTED:case H.OUT_OF_RANGE:case H.UNIMPLEMENTED:case H.DATA_LOSS:return!0;default:return Ci(15467,{code:e})}}function cc(e){if(e===void 0)return bi(`GRPC error has no .code`),H.UNKNOWN;switch(e){case ac.OK:return H.OK;case ac.CANCELLED:return H.CANCELLED;case ac.UNKNOWN:return H.UNKNOWN;case ac.DEADLINE_EXCEEDED:return H.DEADLINE_EXCEEDED;case ac.RESOURCE_EXHAUSTED:return H.RESOURCE_EXHAUSTED;case ac.INTERNAL:return H.INTERNAL;case ac.UNAVAILABLE:return H.UNAVAILABLE;case ac.UNAUTHENTICATED:return H.UNAUTHENTICATED;case ac.INVALID_ARGUMENT:return H.INVALID_ARGUMENT;case ac.NOT_FOUND:return H.NOT_FOUND;case ac.ALREADY_EXISTS:return H.ALREADY_EXISTS;case ac.PERMISSION_DENIED:return H.PERMISSION_DENIED;case ac.FAILED_PRECONDITION:return H.FAILED_PRECONDITION;case ac.ABORTED:return H.ABORTED;case ac.OUT_OF_RANGE:return H.OUT_OF_RANGE;case ac.UNIMPLEMENTED:return H.UNIMPLEMENTED;case ac.DATA_LOSS:return H.DATA_LOSS;default:return Ci(39323,{code:e})}}(oc=ac||={})[oc.OK=0]=`OK`,oc[oc.CANCELLED=1]=`CANCELLED`,oc[oc.UNKNOWN=2]=`UNKNOWN`,oc[oc.INVALID_ARGUMENT=3]=`INVALID_ARGUMENT`,oc[oc.DEADLINE_EXCEEDED=4]=`DEADLINE_EXCEEDED`,oc[oc.NOT_FOUND=5]=`NOT_FOUND`,oc[oc.ALREADY_EXISTS=6]=`ALREADY_EXISTS`,oc[oc.PERMISSION_DENIED=7]=`PERMISSION_DENIED`,oc[oc.UNAUTHENTICATED=16]=`UNAUTHENTICATED`,oc[oc.RESOURCE_EXHAUSTED=8]=`RESOURCE_EXHAUSTED`,oc[oc.FAILED_PRECONDITION=9]=`FAILED_PRECONDITION`,oc[oc.ABORTED=10]=`ABORTED`,oc[oc.OUT_OF_RANGE=11]=`OUT_OF_RANGE`,oc[oc.UNIMPLEMENTED=12]=`UNIMPLEMENTED`,oc[oc.INTERNAL=13]=`INTERNAL`,oc[oc.UNAVAILABLE=14]=`UNAVAILABLE`,oc[oc.DATA_LOSS=15]=`DATA_LOSS`;var lc=class{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.innerSize=0}get(e){let t=this.mapKeyFn(e),n=this.inner[t];if(n!==void 0){for(let[t,r]of n)if(this.equalsFn(t,e))return r}}has(e){return this.get(e)!==void 0}set(e,t){let n=this.mapKeyFn(e),r=this.inner[n];if(r===void 0)return this.inner[n]=[[e,t]],void this.innerSize++;for(let n=0;n<r.length;n++)if(this.equalsFn(r[n][0],e))return void(r[n]=[e,t]);r.push([e,t]),this.innerSize++}delete(e){let t=this.mapKeyFn(e),n=this.inner[t];if(n===void 0)return!1;for(let r=0;r<n.length;r++)if(this.equalsFn(n[r][0],e))return n.length===1?delete this.inner[t]:n.splice(r,1),this.innerSize--,!0;return!1}forEach(e){Pa(this.inner,((t,n)=>{for(let[t,r]of n)e(t,r)}))}isEmpty(){return Ia(this.inner)}size(){return this.innerSize}},uc=new Da(W.comparator);function dc(){return uc}var fc=new Da(W.comparator);function pc(...e){let t=fc;for(let n of e)t=t.insert(n.key,n);return t}function mc(e){let t=fc;return e.forEach(((e,n)=>t=t.insert(e,n.overlayedDocument))),t}function hc(){return _c()}function gc(){return _c()}function _c(){return new lc((e=>e.toString()),((e,t)=>e.isEqual(t)))}var vc=new Da(W.comparator),yc=new Aa(W.comparator);function bc(...e){let t=yc;for(let n of e)t=t.add(n);return t}var xc=new Aa(Li);function Sc(){return xc}var Cc=null;function wc(){return new TextEncoder}var Tc=new ar([4294967295,4294967295],0);function Ec(e){let t=wc().encode(e),n=new or;return n.update(t),new Uint8Array(n.digest())}function Dc(e){let t=new DataView(e.buffer),n=t.getUint32(0,!0),r=t.getUint32(4,!0),i=t.getUint32(8,!0),a=t.getUint32(12,!0);return[new ar([n,r],0),new ar([i,a],0)]}var Oc=class e{constructor(e,t,n){if(this.bitmap=e,this.padding=t,this.hashCount=n,t<0||t>=8)throw new kc(`Invalid padding: ${t}`);if(n<0||e.length>0&&this.hashCount===0)throw new kc(`Invalid hash count: ${n}`);if(e.length===0&&t!==0)throw new kc(`Invalid padding when bitmap length is 0: ${t}`);this.ge=8*e.length-t,this.ye=ar.fromNumber(this.ge)}we(e,t,n){let r=e.add(t.multiply(ar.fromNumber(n)));return r.compare(Tc)===1&&(r=new ar([r.getBits(0),r.getBits(1)],0)),r.modulo(this.ye).toNumber()}be(e){return!!(this.bitmap[Math.floor(e/8)]&1<<e%8)}mightContain(e){if(this.ge===0)return!1;let[t,n]=Dc(Ec(e));for(let e=0;e<this.hashCount;e++){let r=this.we(t,n,e);if(!this.be(r))return!1}return!0}static create(t,n,r){let i=t%8==0?0:8-t%8,a=new Uint8Array(Math.ceil(t/8)),o=new e(a,i,n);return r.forEach((e=>o.insert(e))),o}insert(e){if(this.ge===0)return;let[t,n]=Dc(Ec(e));for(let e=0;e<this.hashCount;e++){let r=this.we(t,n,e);this.ve(r)}}ve(e){let t=Math.floor(e/8),n=e%8;this.bitmap[t]|=1<<n}}
781,kc=class extends Error{constructor(){super(...arguments),this.name=`BloomFilterError`}},Ac=class e{constructor(e,t,n,r,i,a){this.snapshotVersion=e,this.targetChanges=t,this.targetMismatches=n,this.documentUpdates=r,this.augmentedDocumentUpdates=i,this.resolvedLimboDocuments=a}static createSynthesizedRemoteEventForCurrentChange(t,n,r){let i=new Map;return i.set(t,jc.createSynthesizedTargetChangeForCurrentChange(t,n,r)),new e(oa.min(),i,new Da(Li),dc(),dc(),bc())}},jc=class e{constructor(e,t,n,r,i){this.resumeToken=e,this.current=t,this.addedDocuments=n,this.modifiedDocuments=r,this.removedDocuments=i}static createSynthesizedTargetChangeForCurrentChange(t,n,r){return new e(r,n,bc(),bc(),bc())}},Mc=class{constructor(e,t,n,r){this.Se=e,this.removedTargetIds=t,this.key=n,this.De=r}},Nc=class{constructor(e,t){this.targetId=e,this.xe=t}},Pc=class{constructor(e,t,n=Ra.EMPTY_BYTE_STRING,r=null){this.state=e,this.targetIds=t,this.resumeToken=n,this.cause=r}},Fc=class{constructor(e){this.targetId=e,this.Ce=0,this.Fe=zc(),this.Oe=Ra.EMPTY_BYTE_STRING,this.Me=!1,this.Ne=!0}get current(){return this.Me}get resumeToken(){return this.Oe}get Le(){return this.Ce!==0}get Be(){return this.Ne}Ue(e){e.approximateByteSize()>0&&(this.Ne=!0,this.Oe=e)}ke(){let e=bc(),t=bc(),n=bc();return this.Fe.forEach(((r,i)=>{switch(i){case 0:e=e.add(r);break;case 2:t=t.add(r);break;case 1:n=n.add(r);break;default:Ci(38017,{changeType:i})}})),new jc(this.Oe,this.Me,e,t,n)}qe(){this.Ne=!1,this.Fe=zc()}$e(e,t){this.Ne=!0,this.Fe=this.Fe.insert(e,t)}Ke(e){this.Ne=!0,this.Fe=this.Fe.remove(e)}We(){this.Ce+=1}Qe(){--this.Ce,V(this.Ce>=0,3241,{Ce:this.Ce,targetId:this.targetId})}Ge(){this.Ne=!0,this.Me=!0}},Ic=`WatchChangeAggregator`,Lc=class{constructor(e){this.ze=e,this.je=new Map,this.He=dc(),this.Je=Rc(),this.Ye=dc(),this.Ze=Rc(),this.Xe=new Da(Li)}et(e){for(let t of e.Se)e.De&&e.De.isFoundDocument()?this.tt(t,e.De):this.nt(t,e.key,e.De);for(let t of e.removedTargetIds)this.nt(t,e.key,e.De)}rt(e){this.forEachTarget(e,(t=>{let n=this.je.get(t);if(n)switch(e.state){case 0:this.it(t)&&n.Ue(e.resumeToken);break;case 1:n.Qe(),n.Le||n.qe(),n.Ue(e.resumeToken);break;case 2:n.Qe(),n.Le||this.removeTarget(t);break;case 3:this.it(t)&&(n.Ge(),n.Ue(e.resumeToken));break;case 4:this.it(t)&&(this.st(t),n.Ue(e.resumeToken));break;default:Ci(56790,{state:e.state})}else B(Ic,`handleTargetChange received targetChange for untracked target ID (${t}) with state (${e.state})`)}))}forEachTarget(e,t){e.targetIds.length>0?e.targetIds.forEach(t):this.je.forEach(((e,n)=>{this.it(n)&&t(n)}))}_t(e){return zs(e)?e.getPipelineSourceType()===`documents`&&e.getPipelineDocuments()?.length===1:Bs(e)}ot(e){let t=e.targetId,n=e.xe.count,r=this.ut(t);if(r){let i=r.target;if(this._t(i))if(n===0){let e=new W(zs(i)?Gi.fromString(i.getPipelineDocuments()[0]):i.path);this.nt(t,e,Ps.newNoDocument(e,oa.min()))}else V(n===1,20013,`Single document existence filter with count: `+n);else{let r=this.ct(t);if(r!==n){let n=this.lt(e),i=n?this.Et(n,e,r):1;if(i!==0){this.st(t);let e=i===2?`TargetPurposeExistenceFilterMismatchBloom`:`TargetPurposeExistenceFilterMismatch`;this.Xe=this.Xe.insert(t,e)}Cc?.u(function(e,t,n,r,i){let a={localCacheCount:e,existenceFilterCount:t.count,databaseId:n.database,projectId:n.projectId},o=t.unchangedNames;return o&&(a.bloomFilter={applied:i===0,hashCount:o?.hashCount??0,bitmapLength:o?.bits?.bitmap?.length??0,padding:o?.bits?.padding??0,mightContain:e=>r?.mightContain(e)??!1}),a}(r,e.xe,this.ze.Tt(),n,i))}}}}lt(e){let t=e.xe.unchangedNames;if(!t||!t.bits)return null;let{bits:{bitmap:n=``,padding:r=0},hashCount:i=0}=t,a,o;try{a=Ha(n).toUint8Array()}catch(e){if(e instanceof La)return xi(`Decoding the base64 bloom filter in existence filter failed (`+e.message+`); ignoring the bloom filter and falling back to full re-query.`),null;throw e}try{o=new Oc(a,r,i)}catch(e){return xi(e instanceof kc?`BloomFilter error: `:`Applying bloom filter failed: `,e),null}return o.ge===0?null:o}Et(e,t,n){return t.xe.count===n-this.Pt(e,t.targetId)?0:2}Pt(e,t){let n=this.ze.getRemoteKeysForTarget(t),r=0;
781return n.forEach((n=>{let i=this.ze.Tt(),a=`projects/${i.projectId}/databases/${i.database}/documents/${n.path.canonicalString()}`;e.mightContain(a)||(this.nt(t,n,null),r++)})),r}Rt(e){let t=new Map;this.je.forEach(((n,r)=>{let i=this.ut(r);if(i){if(n.current&&this._t(i.target)){let t=new W(zs(i.target)?Gi.fromString(i.target.getPipelineDocuments()[0]):i.target.path);this.It(t).has(r)||this.At(r,t)||this.nt(r,t,Ps.newNoDocument(t,e))}n.Be&&(t.set(r,n.ke()),n.qe())}}));let n=bc();this.Ze.forEach(((e,t)=>{let r=!0;t.forEachWhile((e=>{let t=this.ut(e);return!t||t.purpose===`TargetPurposeLimboResolution`||(r=!1,!1)})),r&&(n=n.add(e))})),this.He.forEach(((t,n)=>n.setReadTime(e))),this.Ye.forEach(((t,n)=>n.setReadTime(e)));let r=new Ac(e,t,this.Xe,this.He,this.Ye,n);return this.He=dc(),this.Je=Rc(),this.Ye=dc(),this.Ze=Rc(),this.Xe=new Da(Li),r}tt(e,t){let n=this.je.get(e);if(!n||!this.it(e))return void B(Ic,`addDocumentToTarget received document for unknown inactive target (${e})`);let r=this.At(e,t.key)?2:0;n.$e(t.key,r),zs(this.ut(e).target)&&this.ut(e).target.getPipelineFlavor()!==`exact`?this.Ye=this.Ye.insert(t.key,t):this.He=this.He.insert(t.key,t),this.Je=this.Je.insert(t.key,this.It(t.key).add(e)),this.Ze=this.Ze.insert(t.key,this.Vt(t.key).add(e))}nt(e,t,n){let r=this.je.get(e);r&&this.it(e)?(this.At(e,t)?r.$e(t,1):r.Ke(t),this.Ze=this.Ze.insert(t,this.Vt(t).delete(e)),this.Ze=this.Ze.insert(t,this.Vt(t).add(e)),n&&(zs(this.ut(e).target)&&this.ut(e).target.getPipelineFlavor()!==`exact`?this.Ye=this.Ye.insert(t,n):this.He=this.He.insert(t,n))):B(Ic,`removeDocumentFromTarget received document for unknown or inactive target (${e})`)}removeTarget(e){this.je.delete(e)}ct(e){let t=this.je.get(e);if(!t)return 0;let n=t.ke();return this.ze.getRemoteKeysForTarget(e).size+n.addedDocuments.size-n.removedDocuments.size}We(e){let t=this.je.get(e);t||(B(Ic,`recordPendingTargetRequest set up tracking for target ID ${e}`),t=new Fc(e),this.je.set(e,t)),t.We()}Vt(e){let t=this.Ze.get(e);return t||(t=new Aa(Li),this.Ze=this.Ze.insert(e,t)),t}It(e){let t=this.Je.get(e);return t||(t=new Aa(Li),this.Je=this.Je.insert(e,t)),t}it(e){let t=this.ut(e)!==null;return t||B(Ic,`Detected inactive target`,e),t}ut(e){let t=this.je.get(e);return t===void 0||t.Le?null:this.ze.dt(e)}st(e){this.je.set(e,new Fc(e)),this.ze.getRemoteKeysForTarget(e).forEach((t=>{this.nt(e,t,null)}))}At(e,t){return this.ze.getRemoteKeysForTarget(e).has(t)}};function Rc(){return new Da(W.comparator)}function zc(){return new Da(W.comparator)}var Bc={asc:`ASCENDING`,desc:`DESCENDING`},Vc={"<":`LESS_THAN`,"<=":`LESS_THAN_OR_EQUAL`,">":`GREATER_THAN`,">=":`GREATER_THAN_OR_EQUAL`,"==":`EQUAL`,"!=":`NOT_EQUAL`,"array-contains":`ARRAY_CONTAINS`,in:`IN`,"not-in":`NOT_IN`,"array-contains-any":`ARRAY_CONTAINS_ANY`},Hc={and:`AND`,or:`OR`},Uc=class{constructor(e,t){this.databaseId=e,this.useProto3Json=t}};function Wc(e,t){return e.useProto3Json||ya(t)?t:{value:t}}function Gc(e,t){return e.useProto3Json?`${new Date(1e3*t.seconds).toISOString().replace(/\.\d*/,``).replace(`Z`,``)}.${(`000000000`+t.nanoseconds).slice(-9)}Z`:{seconds:``+t.seconds,nanos:t.nanoseconds}}function Kc(e){let t=Ba(e);return new aa(t.seconds,t.nanos)}function qc(e,t){return e.useProto3Json?t.toBase64():t.toUint8Array()}function Jc(e,t){return Gc(e,t.toTimestamp())}function Yc(e){return V(!!e,49232),oa.fromTimestamp(Kc(e))}function Xc(e,t){return Zc(e,t).canonicalString()}function Zc(e,t){let n=function(e){return new Gi([`projects`,e.projectId,`databases`,e.database])}(e).child(`documents`);return t===void 0?n:n.child(t)}function Qc(e){let t=Gi.fromString(e);return V(Sl(t),10190,{key:t.toString()}),t}function $c(e,t){return Xc(e.databaseId,t.path)}function el(e,t){let n=Qc(t);if(n.get(1)!==e.databaseId.projectId)throw new U(H.INVALID_ARGUMENT,`Tried to deserialize key from different project: `+n.get(1)+` vs `+e.databaseId.projectId);if(n.get(3)!==e.databaseId.database)throw new U(H.INVALID_ARGUMENT,`Tried to deserialize key from different database: `+n.get(3)+` vs `+e.databaseId.database);return new W(il(n))}function tl(e,t){return Xc(e.databaseId,t)}function nl(e){let t=Qc(e);return t.length===4?Gi.emptyPath():il(t)}function rl(e){return new Gi([`projects`,e.databaseId.projectId,`databases`,e.databaseId.database]).canonicalString()}function il(e){return V(e.length>4&&e.get(4)===`documents`,29091,{key:e.toString()}),e.popFirst(5)}function al(e,t,n){return{name:$c(e,t),fields:n.value.mapValue.fields}}function ol(e,t){let n;if(`targetChange`in t){t.targetChange;let r=function(e){return e===`NO_CHANGE`?0:e===`ADD`?1:e===`REMOVE`?2:e===`CURRENT`?3:e===`RESET`?4:Ci(39313,{state:e})}(t.targetChange.targetChangeType||`NO_CHANGE`),i=t.targetChange.targetIds||[],a=function(e,t){return e.useProto3Json?(V(t===void 0||typeof t==`string`,58123),Ra.fromBase64String(t||``)):(V(t===void 0||t instanceof Buffer||t instanceof Uint8Array,16193),Ra.fromUint8Array(t||new Uint8Array))}(e,t.targetChange.resumeToken),o=t.targetChange.cause;n=new Pc(r,i,a,o&&function(e){return new U(e.code===void 0?H.UNKNOWN:cc(e.code),e.message||``)}(o)||null)}else if(`documentChange`in t){t.documentChange;let r=t.documentChange;r.document,r.document.name,r.document.updateTime;let i=el(e,r.document.name),a=Yc(r.document.updateTime),o=r.document.createTime?Yc(r.document.createTime):oa.min(),s=new Oo({mapValue:{fields:r.document.fields}}),c=Ps.newFoundDocument(i,a,o,s);n=new Mc(r.targetIds||[],r.removedTargetIds||[],c.key,c)}else if(`documentDelete`in t){t.documentDelete;let r=t.documentDelete;r.document;let i=el(e,r.document),a=r.readTime?Yc(r.readTime):oa.min(),o=Ps.newNoDocument(i,a);n=new Mc([],r.removedTargetIds||[],o.key,o)}else if(`documentRemove`in t){t.documentRemove;let r=t.documentRemove;r.document;let i=el(e,r.document);n=new Mc([],r.removedTargetIds||[],i,null)}else{if(!(`filter`in t))return Ci(11601,{ft:t});{t.filter;let e=t.filter;e.targetId;
781let{count:r=0,unchangedNames:i}=e,a=new ic(r,i),o=e.targetId;n=new Nc(o,a)}}return n}function sl(e,t){let n;if(t instanceof as)n={update:al(e,t.key,t.value)};else if(t instanceof us)n={delete:$c(e,t.key)};else if(t instanceof os)n={update:al(e,t.key,t.data),updateMask:xl(t.fieldMask)};else{if(!(t instanceof ds))return Ci(16599,{gt:t.type});n={verify:$c(e,t.key)}}return t.fieldTransforms.length>0&&(n.updateTransforms=t.fieldTransforms.map((e=>function(e,t){let n=t.transform;if(n instanceof Lo)return{fieldPath:t.field.canonicalString(),setToServerValue:`REQUEST_TIME`};if(n instanceof Ro)return{fieldPath:t.field.canonicalString(),appendMissingElements:{values:n.elements}};if(n instanceof Bo)return{fieldPath:t.field.canonicalString(),removeAllFromArray:{values:n.elements}};if(n instanceof Uo)return{fieldPath:t.field.canonicalString(),increment:n.Re};if(n instanceof Wo)return{fieldPath:t.field.canonicalString(),minimum:n.Re};if(n instanceof Go)return{fieldPath:t.field.canonicalString(),maximum:n.Re};throw Ci(20930,{transform:t.transform})}(0,e)))),t.precondition.isNone||(n.currentDocument=function(e,t){return t.updateTime===void 0?t.exists===void 0?Ci(27497):{exists:t.exists}:{updateTime:Jc(e,t.updateTime)}}(e,t.precondition)),n}function cl(e,t){return e&&e.length>0?(V(t!==void 0,14353),e.map((e=>function(e,t){let n=e.updateTime?Yc(e.updateTime):Yc(t);return n.isEqual(oa.min())&&(n=Yc(t)),new Xo(n,e.transformResults||[])}(e,t)))):[]}function ll(e,t){return{documents:[tl(e,t.path)]}}function ul(e,t){let n={structuredQuery:{}},r=t.path,i;t.collectionGroup===null?(i=r.popLast(),n.structuredQuery.from=[{collectionId:r.lastSegment()}]):(i=r,n.structuredQuery.from=[{collectionId:t.collectionGroup,allDescendants:!0}]),n.parent=tl(e,i);let a=function(e){if(e.length!==0)return bl(_s.create(e,`and`))}(t.filters);a&&(n.structuredQuery.where=a);let o=function(e){if(e.length!==0)return e.map((e=>function(e){return{field:vl(e.field),direction:hl(e.dir)}}(e)))}(t.orderBy);o&&(n.structuredQuery.orderBy=o);let s=Wc(e,t.limit);return s!==null&&(n.structuredQuery.limit=s),t.startAt&&(n.structuredQuery.startAt=function(e){return{before:e.inclusive,values:e.position}}(t.startAt)),t.endAt&&(n.structuredQuery.endAt=function(e){return{before:!e.inclusive,values:e.position}}(t.endAt)),{yt:n,parent:i}}function dl(e){let t=nl(e.parent),n=e.structuredQuery,r=n.from?n.from.length:0,i=null;if(r>0){V(r===1,65062);let e=n.from[0];e.allDescendants?i=e.collectionId:t=t.child(e.collectionId)}let a=[];n.where&&(a=function(e){let t=ml(e);return t instanceof _s&&ys(t)?t.getFilters():[t]}(n.where));let o=[];n.orderBy&&(o=function(e){return e.map((e=>function(e){return new Ms(yl(e.field),function(e){switch(e){case`ASCENDING`:return`asc`;case`DESCENDING`:return`desc`;default:return}}(e.direction))}(e)))}(n.orderBy));let s=null;n.limit&&(s=function(e){let t;return t=typeof e==`object`?e.value:e,ya(t)?null:t}(n.limit));let c=null;n.startAt&&(c=function(e){let t=!!e.before;return new fs(e.values||[],t)}(n.startAt));let l=null;return n.endAt&&(l=function(e){let t=!e.before;return new fs(e.values||[],t)}(n.endAt)),Hs(t,i,o,a,s,`F`,c,l)}function fl(e,t){let n=function(e){switch(e){case`TargetPurposeListen`:return null;case`TargetPurposeExistenceFilterMismatch`:return`existence-filter-mismatch`;case`TargetPurposeExistenceFilterMismatchBloom`:return`existence-filter-mismatch-bloom`;case`TargetPurposeLimboResolution`:return`limbo-document`;default:return Ci(28987,{purpose:e})}}(t.purpose);return n==null?null:{"goog-listen-tags":n}}function pl(e,t){return{structuredPipeline:{pipeline:{stages:t.stages.map((t=>t._toProto(e)))}}}}function ml(e){return e.unaryFilter===void 0?e.fieldFilter===void 0?e.compositeFilter===void 0?Ci(30097,{filter:e}):function(e){return _s.create(e.compositeFilter.filters.map((e=>ml(e))),function(e){switch(e){case`AND`:return`and`;case`OR`:return`or`;default:return Ci(1026)}}(e.compositeFilter.op))}(e):function(e){return gs.create(yl(e.fieldFilter.field),function(e){switch(e){case`EQUAL`:return`==`;case`NOT_EQUAL`:return`!=`;case`GREATER_THAN`:return`>`;case`GREATER_THAN_OR_EQUAL`:return`>=`;case`LESS_THAN`:return`<`;case`LESS_THAN_OR_EQUAL`:return`<=`;case`ARRAY_CONTAINS`:return`array-contains`;case`IN`:return`in`;case`NOT_IN`:return`not-in`;case`ARRAY_CONTAINS_ANY`:return`array-contains-any`;case`OPERATOR_UNSPECIFIED`:return Ci(58110);default:return Ci(50506)}}(e.fieldFilter.op),e.fieldFilter.value)}(e):function(e){switch(e.unaryFilter.op){case`IS_NAN`:let t=yl(e.unaryFilter.field);return gs.create(t,`==`,{doubleValue:NaN});case`IS_NULL`:let n=yl(e.unaryFilter.field);return gs.create(n,`==`,{nullValue:`NULL_VALUE`});
781case`IS_NOT_NAN`:let r=yl(e.unaryFilter.field);return gs.create(r,`!=`,{doubleValue:NaN});case`IS_NOT_NULL`:let i=yl(e.unaryFilter.field);return gs.create(i,`!=`,{nullValue:`NULL_VALUE`});case`OPERATOR_UNSPECIFIED`:return Ci(61313);default:return Ci(60726)}}(e)}function hl(e){return Bc[e]}function gl(e){return Vc[e]}function _l(e){return Hc[e]}function vl(e){return{fieldPath:e.canonicalString()}}function yl(e){return qi.fromServerFormat(e.fieldPath)}function bl(e){return e instanceof gs?function(e){if(e.op===`==`){if(So(e.value))return{unaryFilter:{field:vl(e.field),op:`IS_NAN`}};if(xo(e.value))return{unaryFilter:{field:vl(e.field),op:`IS_NULL`}}}else if(e.op===`!=`){if(So(e.value))return{unaryFilter:{field:vl(e.field),op:`IS_NOT_NAN`}};if(xo(e.value))return{unaryFilter:{field:vl(e.field),op:`IS_NOT_NULL`}}}return{fieldFilter:{field:vl(e.field),op:gl(e.op),value:e.value}}}(e):e instanceof _s?function(e){let t=e.getFilters().map((e=>bl(e)));return t.length===1?t[0]:{compositeFilter:{op:_l(e.op),filters:t}}}(e):Ci(54877,{filter:e})}function xl(e){let t=[];return e.fields.forEach((e=>t.push(e.canonicalString()))),{fieldPaths:t}}function Sl(e){return e.length>=4&&e.get(0)===`projects`&&e.get(2)===`databases`}function Cl(e){return!!e&&typeof e._toProto==`function`&&e._protoValueType===`ProtoValue`}function wl(e,t){let n={fields:{}};return t.forEach(((t,r)=>{if(typeof r!=`string`)throw Error(`Cannot encode map with non-string key: ${r}`);n.fields[r]=t._toProto(e)})),{mapValue:n}}function Tl(e){return{stringValue:e}}function El(e){return new Uc(e,!0)}var Dl=class e{constructor(e){this._byteString=e}static fromBase64String(t){try{return new e(Ra.fromBase64String(t))}catch(e){throw new U(H.INVALID_ARGUMENT,`Failed to construct data from Base64 string: `+e)}}static fromUint8Array(t){return new e(Ra.fromUint8Array(t))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return`Bytes(base64: `+this.toBase64()+`)`}isEqual(e){return this._byteString.isEqual(e._byteString)}toJSON(){return{type:e._jsonSchemaVersion,bytes:this.toBase64()}}static fromJSON(t){if(na(t,e._jsonSchema))return e.fromBase64String(t.bytes)}};Dl._jsonSchemaVersion=`firestore/bytes/1.0`,Dl._jsonSchema={type:ta(`string`,Dl._jsonSchemaVersion),bytes:ta(`string`)};var Ol=class{constructor(...e){for(let t=0;t<e.length;++t)if(e[t].length===0)throw new U(H.INVALID_ARGUMENT,`Invalid field name at argument $(i + 1). Field names must not be empty.`);this._internalPath=new qi(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}};function kl(){return new Ol(Ui)}var Al=class{constructor(e){this._methodName=e}},jl=class e{constructor(e,t){if(!isFinite(e)||e<-90||e>90)throw new U(H.INVALID_ARGUMENT,`Latitude must be a number between -90 and 90, but was: `+e);if(!isFinite(t)||t<-180||t>180)throw new U(H.INVALID_ARGUMENT,`Longitude must be a number between -180 and 180, but was: `+t);this._lat=e,this._long=t}get latitude(){return this._lat}get longitude(){return this._long}isEqual(e){return this._lat===e._lat&&this._long===e._long}_compareTo(e){return Li(this._lat,e._lat)||Li(this._long,e._long)}toJSON(){return{latitude:this._lat,longitude:this._long,type:e._jsonSchemaVersion}}static fromJSON(t){if(na(t,e._jsonSchema))return new e(t.latitude,t.longitude)}};function Ml(e){let t={};return e.timeoutSeconds!==void 0&&(t.timeoutSeconds=e.timeoutSeconds),t}jl._jsonSchemaVersion=`firestore/geoPoint/1.0`,jl._jsonSchema={type:ta(`string`,jl._jsonSchemaVersion),latitude:ta(`number`),longitude:ta(`number`)};var Nl=class{bt(e){}shutdown(){}},Pl=`ConnectivityMonitor`,Fl=class{constructor(){this.vt=()=>this.St(),this.Dt=()=>this.xt(),this.Ct=[],this.Ft()}bt(e){this.Ct.push(e)}shutdown(){window.removeEventListener(`online`,this.vt),window.removeEventListener(`offline`,this.Dt)}Ft(){window.addEventListener(`online`,this.vt),window.addEventListener(`offline`,this.Dt)}St(){B(Pl,`Network connectivity changed: AVAILABLE`);for(let e of this.Ct)e(0)}xt(){B(Pl,`Network connectivity changed: UNAVAILABLE`);for(let e of this.Ct)e(1)}static C(){return typeof window<`u`&&window.addEventListener!==void 0&&window.removeEventListener!==void 0}},Il=null;function Ll(){return Il===null?Il=function(){return 268435456+Math.round(2147483648*Math.random())}():Il++,`0x`+Il.toString(16)}var Rl=`RestConnection`,zl={BatchGetDocuments:`batchGet`,Commit:`commit`,RunQuery:`runQuery`,RunAggregation
781Query:`runAggregationQuery`,ExecutePipeline:`executePipeline`},Bl=class{get Ot(){return!1}constructor(e){this.databaseInfo=e,this.databaseId=e.databaseId;let t=e.ssl?`https`:`http`,n=encodeURIComponent(this.databaseId.projectId),r=encodeURIComponent(this.databaseId.database);this.Mt=t+`://`+e.host,this.Nt=`projects/${n}/databases/${r}`,this.Lt=this.databaseId.database===J?`project_id=${n}`:`project_id=${n}&database_id=${r}`}Bt(e,t,n,r,i){let a=Ll(),o=this.Ut(e,t.toUriEncodedString());B(Rl,`Sending RPC '${e}' ${a}:`,o,n);let s={"google-cloud-resource-prefix":this.Nt,"x-goog-request-params":this.Lt};this.kt(s,r,i);let{host:c}=new URL(o),l=ct(c);return this.qt(e,o,s,n,l).then((t=>(B(Rl,`Received RPC '${e}' ${a}: `,t),t)),(t=>{throw xi(Rl,`RPC '${e}' ${a} failed with error: `,t,`url: `,o,`request:`,n),t}))}$t(e,t,n,r,i,a){return this.Bt(e,t,n,r,i)}kt(e,t,n){e[`X-Goog-Api-Client`]=function(){return`gl-js/ fire/`+gi}(),e[`Content-Type`]=`text/plain`,this.databaseInfo.appId&&(e[`X-Firebase-GMPID`]=this.databaseInfo.appId),t&&t.headers.forEach(((t,n)=>e[n]=t)),n&&n.headers.forEach(((t,n)=>e[n]=t))}Ut(e,t){let n=zl[e],r=`${this.Mt}/v1/${t}:${n}`;return this.databaseInfo.apiKey&&(r=`${r}?key=${encodeURIComponent(this.databaseInfo.apiKey)}`),r}terminate(){}},Vl=class{constructor(e){this.Kt=e.Kt,this.Wt=e.Wt}Qt(e){this.Gt=e}zt(e){this.jt=e}Ht(e){this.Jt=e}onMessage(e){this.Yt=e}close(){this.Wt()}send(e){this.Kt(e)}Zt(){this.Gt()}Xt(){this.jt()}en(e){this.Jt(e)}tn(e){this.Yt(e)}},Hl=`WebChannelConnection`,Ul=(e,t,n)=>{e.listen(t,(e=>{try{n(e)}catch(e){setTimeout((()=>{throw e}),0)}}))},Wl=class e extends Bl{constructor(e){super(e),this.nn=[],this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}static rn(){e.sn||=(Ul(hr(),mr.STAT_EVENT,(e=>{e.stat===pr.PROXY?B(Hl,`STAT_EVENT: detected buffering proxy`):e.stat===pr.NOPROXY&&B(Hl,`STAT_EVENT: detected no buffering proxy`)})),!0)}qt(e,t,n,r,i){let a=Ll();return new Promise(((i,o)=>{let s=new lr;s.setWithCredentials(!0),s.listenOnce(dr.COMPLETE,(()=>{try{switch(s.getLastErrorCode()){case fr.NO_ERROR:let t=s.getResponseJson();B(Hl,`XHR for RPC '${e}' ${a} received:`,JSON.stringify(t)),i(t);break;case fr.TIMEOUT:B(Hl,`RPC '${e}' ${a} timed out`),o(new U(H.DEADLINE_EXCEEDED,`Request time out`));break;case fr.HTTP_ERROR:let n=s.getStatus();if(B(Hl,`RPC '${e}' ${a} failed with status:`,n,`response text:`,s.getResponseText()),n>0){let e=s.getResponseJson();Array.isArray(e)&&(e=e[0]);let t=e?.error;t&&t.status&&t.message?o(new U(function(e){let t=e.toLowerCase().replace(/_/g,`-`);return Object.values(H).indexOf(t)>=0?t:H.UNKNOWN}(t.status),t.message)):o(new U(H.UNKNOWN,`Server responded with status `+s.getStatus()))}else o(new U(H.UNAVAILABLE,`Connection failed.`));break;default:Ci(9055,{_n:e,streamId:a,an:s.getLastErrorCode(),un:s.getLastError()})}}finally{B(Hl,`RPC '${e}' ${a} completed.`)}}));let c=JSON.stringify(r);B(Hl,`RPC '${e}' ${a} sending request:`,r),s.send(t,`POST`,c,n,15)}))}cn(t,n,r){let i=Ll(),a=[this.Mt,`/`,`google.firestore.v1.Firestore`,`/`,t,`/channel`],o=this.createWebChannelTransport(),s={httpSessionIdParam:`gsessionid`,initMessageHeaders:{},messageUrlParams:{database:`projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling},c=this.longPollingOptions.timeoutSeconds;c!==void 0&&(s.longPollingTimeout=Math.round(1e3*c)),this.useFetchStreams&&(s.useFetchStreams=!0),this.kt(s.initMessageHeaders,n,r),s.encodeInitMessageHeaders=!0;let l=a.join(``);B(Hl,`Creating RPC '${t}' stream ${i}: ${l}`,s);let u=o.createWebChannel(l,s);this.En(u);let d=!1,f=!1,p=new Vl({Kt:e=>{f?B(Hl,`Not sending because RPC '${t}' stream ${i} is closed:`,e):(d||=(B(Hl,`Opening RPC '${t}' stream ${i} transport.`),u.open(),!0),B(Hl,`RPC '${t}' stream ${i} sending:`,e),u.send(e))},Wt:()=>u.close()});return Ul(u,ur.EventType.OPEN,(()=>{f||(B(Hl,`RPC '${t}' stream ${i} transport opened.`),p.Zt())})),Ul(u,ur.EventType.CLOSE,(()=>{f||(f=!0,B(Hl,`RPC '${t}' stream ${i} transport closed`),p.en(),this.hn(u))}
781)),Ul(u,ur.EventType.ERROR,(e=>{f||(f=!0,xi(Hl,`RPC '${t}' stream ${i} transport errored. Name:`,e.name,`Message:`,e.message),p.en(new U(H.UNAVAILABLE,`The operation could not be completed`)))})),Ul(u,ur.EventType.MESSAGE,(e=>{if(!f){let n=e.data[0];V(!!n,16349);let r=n,a=r?.error||r[0]?.error;if(a){B(Hl,`RPC '${t}' stream ${i} received error:`,a);let e=a.status,n=function(e){let t=ac[e];if(t!==void 0)return cc(t)}(e),r=a.message;e===`NOT_FOUND`&&r.includes(`database`)&&r.includes(`does not exist`)&&r.includes(this.databaseId.database)&&xi(`Database '${this.databaseId.database}' not found. Please check your project configuration.`),n===void 0&&(n=H.INTERNAL,r=`Unknown error status: `+e+` with message `+a.message),f=!0,p.en(new U(n,r)),u.close()}else B(Hl,`RPC '${t}' stream ${i} received:`,n),p.tn(n)}})),e.rn(),setTimeout((()=>{p.Xt()}),0),p}terminate(){this.nn.forEach((e=>e.close())),this.nn=[]}En(e){this.nn.push(e)}hn(e){this.nn=this.nn.filter((t=>t===e))}kt(e,t,n){super.kt(e,t,n),this.databaseInfo.apiKey&&(e[`x-goog-api-key`]=this.databaseInfo.apiKey)}createWebChannelTransport(){return gr()}};function Gl(e){return new Wl(e)}Wl.sn=!1;var Kl=class{constructor(e,t,n=1e3,r=1.5,i=6e4){this.Tn=e,this.timerId=t,this.Pn=n,this.Rn=r,this.In=i,this.An=0,this.Vn=null,this.dn=Date.now(),this.reset()}reset(){this.An=0}fn(){this.An=this.In}mn(e){this.cancel();let t=Math.floor(this.An+this.pn()),n=Math.max(0,Date.now()-this.dn),r=Math.max(0,t-n);r>0&&B(`ExponentialBackoff`,`Backing off for ${r} ms (base delay: ${this.An} ms, delay with jitter: ${t} ms, last attempt: ${n} ms ago)`),this.Vn=this.Tn.enqueueAfterDelay(this.timerId,r,(()=>(this.dn=Date.now(),e()))),this.An*=this.Rn,this.An<this.Pn&&(this.An=this.Pn),this.An>this.In&&(this.An=this.In)}gn(){this.Vn!==null&&(this.Vn.skipDelay(),this.Vn=null)}cancel(){this.Vn!==null&&(this.Vn.cancel(),this.Vn=null)}pn(){return(Math.random()-.5)*this.An}},ql=`PersistentStream`,Jl=class{constructor(e,t,n,r,i,a,o,s){this.Tn=e,this.yn=n,this.wn=r,this.connection=i,this.authCredentialsProvider=a,this.appCheckCredentialsProvider=o,this.listener=s,this.state=0,this.bn=0,this.vn=null,this.Sn=null,this.stream=null,this.Dn=0,this.xn=new Kl(e,t)}Cn(){return this.state===1||this.state===5||this.Fn()}Fn(){return this.state===2||this.state===3}start(){this.Dn=0,this.state===4?this.On():this.auth()}async stop(){this.Cn()&&await this.close(0)}Mn(){this.state=0,this.xn.reset()}Nn(){this.Fn()&&this.vn===null&&(this.vn=this.Tn.enqueueAfterDelay(this.yn,6e4,(()=>this.Ln())))}Bn(e){this.Un(),this.stream.send(e)}async Ln(){if(this.Fn())return this.close(0)}Un(){this.vn&&=(this.vn.cancel(),null)}kn(){this.Sn&&=(this.Sn.cancel(),null)}async close(e,t){this.Un(),this.kn(),this.xn.cancel(),this.bn++,e===4?t&&t.code===H.RESOURCE_EXHAUSTED?(bi(t.toString()),bi(`Using maximum backoff delay to prevent overloading the backend.`),this.xn.fn()):t&&t.code===H.UNAUTHENTICATED&&this.state!==3&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()):this.xn.reset(),this.stream!==null&&(this.qn(),this.stream.close(),this.stream=null),this.state=e,await this.listener.Ht(t)}qn(){}auth(){this.state=1;let e=this.$n(this.bn),t=this.bn;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then((([e,n])=>{this.bn===t&&this.Kn(e,n)}),(t=>{e((()=>{let e=new U(H.UNKNOWN,`Fetching auth token failed: `+t.message);return this.Wn(e)}))}))}Kn(e,t){let n=this.$n(this.bn);this.stream=this.Qn(e,t),this.stream.Qt((()=>{n((()=>this.listener.Qt()))})),this.stream.zt((()=>{n((()=>(this.state=2,this.Sn=this.Tn.enqueueAfterDelay(this.wn,1e4,(()=>(this.Fn()&&(this.state=3),Promise.resolve()))),this.listener.zt())))})),this.stream.Ht((e=>{n((()=>this.Wn(e)))})),this.stream.onMessage((e=>{n((()=>++this.Dn==1?this.Gn(e):this.onNext(e)))}))}On(){this.state=5,this.xn.mn((async()=>{this.state=0,this.start()}))}Wn(e){return B(ql,`close with error: ${e}`),this.stream=null,this.close(4,e)}$n(e){return t=>{this.Tn.enqueueAndForget((()=>this.bn===e?t():(B(ql,`stream callback skipped by getCloseGuardedDispatcher.`),Promise.resolve())))}}},Yl=class extends Jl{constructor(e,t,n,r,i,a){super(e,`listen_stream_connection_backoff`,`listen_stream_idle`,`health_check_timeout`,t,n,r,a),this.serializer
781=i}Qn(e,t){return this.connection.cn(`Listen`,e,t)}Gn(e){return this.onNext(e)}onNext(e){this.xn.reset();let t=ol(this.serializer,e),n=function(e){if(!(`targetChange`in e))return oa.min();let t=e.targetChange;return t.targetIds&&t.targetIds.length?oa.min():t.readTime?Yc(t.readTime):oa.min()}(e);return this.listener.zn(t,n)}jn(e){let t={};t.database=rl(this.serializer),t.addTarget=function(e,t){let n,r=t.target;if(n=zs(r)?{pipelineQuery:pl(e,r)}:Bs(r)?{documents:ll(e,r)}:{query:ul(e,r).yt},n.targetId=t.targetId,t.resumeToken.approximateByteSize()>0){n.resumeToken=qc(e,t.resumeToken);let r=Wc(e,t.expectedCount);r!==null&&(n.expectedCount=r)}else if(t.snapshotVersion.compareTo(oa.min())>0){n.readTime=Gc(e,t.snapshotVersion.toTimestamp());let r=Wc(e,t.expectedCount);r!==null&&(n.expectedCount=r)}return n}(this.serializer,e);let n=fl(this.serializer,e);n&&(t.labels=n),this.Bn(t)}Hn(e){let t={};t.database=rl(this.serializer),t.removeTarget=e,this.Bn(t)}},Xl=class extends Jl{constructor(e,t,n,r,i,a){super(e,`write_stream_connection_backoff`,`write_stream_idle`,`health_check_timeout`,t,n,r,a),this.serializer=i}get Jn(){return this.Dn>0}start(){this.lastStreamToken=void 0,super.start()}qn(){this.Jn&&this.Yn([])}Qn(e,t){return this.connection.cn(`Write`,e,t)}Gn(e){return V(!!e.streamToken,31322),this.lastStreamToken=e.streamToken,V(!e.writeResults||e.writeResults.length===0,55816),this.listener.Zn()}onNext(e){V(!!e.streamToken,12678),this.lastStreamToken=e.streamToken,this.xn.reset();let t=cl(e.writeResults,e.commitTime),n=Yc(e.commitTime);return this.listener.Xn(n,t)}er(){let e={};e.database=rl(this.serializer),this.Bn(e)}Yn(e){let t={streamToken:this.lastStreamToken,writes:e.map((e=>sl(this.serializer,e)))};this.Bn(t)}},Zl=class{},Ql=class extends Zl{constructor(e,t,n,r){super(),this.authCredentials=e,this.appCheckCredentials=t,this.connection=n,this.serializer=r,this.tr=!1}nr(){if(this.tr)throw new U(H.FAILED_PRECONDITION,`The client has already been terminated.`)}Bt(e,t,n,r){return this.nr(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([i,a])=>this.connection.Bt(e,Zc(t,n),r,i,a))).catch((e=>{throw e.name===`FirebaseError`?(e.code===H.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),e):new U(H.UNKNOWN,e.toString())}))}$t(e,t,n,r,i){return this.nr(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([a,o])=>this.connection.$t(e,Zc(t,n),r,a,o,i))).catch((e=>{throw e.name===`FirebaseError`?(e.code===H.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),e):new U(H.UNKNOWN,e.toString())}))}terminate(){this.tr=!0,this.connection.terminate()}};function $l(e,t,n,r){return new Ql(e,t,n,r)}var eu=`ComponentProvider`,tu=new Map;function nu(e,t,n,r,i){return new q(e,t,n,i.host,i.ssl,i.experimentalForceLongPolling,i.experimentalAutoDetectLongPolling,Ml(i.experimentalLongPollingOptions),i.useFetchStreams,i.isUsingEmulator,r)}var ru={didRun:!1,sequenceNumbersCollected:0,targetsRemoved:0,documentsRemoved:0},iu=41943040,au=class e{static withCacheSize(t){return new e(t,e.DEFAULT_COLLECTION_PERCENTILE,e.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}constructor(e,t,n){this.cacheSizeCollectionThreshold=e,this.percentileToCollect=t,this.maximumSequenceNumbersToCollect=n}};au.DEFAULT_COLLECTION_PERCENTILE=10,au.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,au.DEFAULT=new au(iu,au.DEFAULT_COLLECTION_PERCENTILE,au.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),au.DISABLED=new au(-1,0,0);var ou=`LruGarbageCollector`,su=1048576;function cu([e,t],[n,r]){let i=Li(e,n);return i===0?Li(t,r):i}var lu=class{constructor(e){this.rr=e,this.buffer=new Aa(cu),this.ir=0}sr(){return++this.ir}_r(e){let t=[e,this.sr()];if(this.buffer.size<this.rr)this.buffer=this.buffer.add(t);else{let e=this.buffer.last();cu(t,e)<0&&(this.buffer=this.buffer.delete(e).add(t))}}get maxValue(){return this.buffer.last()[0]}},uu=class{constructor(e,t,n){this.garbageCollector=e,this.asyncQueue=t,this.localStore=n,this.ar=null}start(){this.garbageCollector.params.cacheSizeCollectionThreshold!==-1&&this.ur(6e4)}stop(){this.ar&&=(this.ar.cancel(),null)}get started(){return this.ar!==null}ur(e){B(ou,`Garbage collection scheduled in ${e}ms`),this.ar=this.asyncQueue.enqueueAfterDelay(`lru_garbage_collection`,e,(async()=>{this.ar=null;try{await this.localStore.collectGarbage(this.garbageCollector)}catch(e){_a(e)?B(ou,`Ignoring IndexedDB error during garbage collection: `,e):await ha(e)}await this.ur(3e5)}))}},du=class{constructor(e,t){this.cr=e,this.params=t}calculateTargetCount(e,t){return this.cr.lr(e).next((e=>Math.floor(t/100*e)))}nthSequenceNumber(e,t){if(t===0)return G.resolve(va.ce);let n=new lu(t);return this.cr.forEachTarget(e,(e=>n._r(e.sequenceNumber))).next((()=>this.cr.Er(e,(e=>n._r(e))))).next((()=>n.maxValue))}removeTargets(e,t,n){return this.cr.removeTargets(e,t,n)}removeOrphanedDocuments(e,t){return this.cr.removeOrphanedDocuments(e,t)}collect(e,t){return this.params.cacheSizeCollectionThreshold===-1?(
781B(`LruGarbageCollector`,`Garbage collection skipped; disabled`),G.resolve(ru)):this.getCacheSize(e).next((n=>n<this.params.cacheSizeCollectionThreshold?(B(`LruGarbageCollector`,`Garbage collection skipped; Cache size ${n} is lower than threshold ${this.params.cacheSizeCollectionThreshold}`),ru):this.hr(e,t)))}getCacheSize(e){return this.cr.getCacheSize(e)}hr(e,t){let n,r,i,a,o,s,c,l=Date.now();return this.calculateTargetCount(e,this.params.percentileToCollect).next((t=>(t>this.params.maximumSequenceNumbersToCollect?(B(`LruGarbageCollector`,`Capping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${t}`),r=this.params.maximumSequenceNumbersToCollect):r=t,a=Date.now(),this.nthSequenceNumber(e,r)))).next((r=>(n=r,o=Date.now(),this.removeTargets(e,n,t)))).next((t=>(i=t,s=Date.now(),this.removeOrphanedDocuments(e,n)))).next((e=>(c=Date.now(),yi()<=_t.DEBUG&&B(`LruGarbageCollector`,`LRU Garbage Collection\n\tCounted targets in ${a-l}ms\n\tDetermined least recently used ${r} in `+(o-a)+`ms
782\tRemoved ${i} targets in `+(s-o)+`ms
783\tRemoved ${e} documents in `+(c-s)+`ms
784Total Duration: ${c-l}ms`),G.resolve({didRun:!0,sequenceNumbersCollected:r,targetsRemoved:i,documentsRemoved:e}))))}};function fu(e,t){return new du(e,t)}var pu=`firestore.googleapis.com`,mu=!0,hu=class{constructor(e){if(e.host===void 0){if(e.ssl!==void 0)throw new U(H.INVALID_ARGUMENT,`Can't provide ssl option if host option is not set`);this.host=pu,this.ssl=mu}else this.host=e.host,this.ssl=e.ssl??mu;if(this.isUsingEmulator=e.emulatorOptions!==void 0,this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,e.cacheSizeBytes===void 0)this.cacheSizeBytes=iu;else{if(e.cacheSizeBytes!==-1&&e.cacheSizeBytes<su)throw new U(H.INVALID_ARGUMENT,`cacheSizeBytes must be at least 1048576`);this.cacheSizeBytes=e.cacheSizeBytes}Yi(`experimentalForceLongPolling`,e.experimentalForceLongPolling,`experimentalAutoDetectLongPolling`,e.experimentalAutoDetectLongPolling),this.experimentalForceLongPolling=!!e.experimentalForceLongPolling,this.experimentalForceLongPolling?this.experimentalAutoDetectLongPolling=!1:e.experimentalAutoDetectLongPolling===void 0?this.experimentalAutoDetectLongPolling=!0:this.experimentalAutoDetectLongPolling=!!e.experimentalAutoDetectLongPolling,this.experimentalLongPollingOptions=Ml(e.experimentalLongPollingOptions??{}),function(e){if(e.timeoutSeconds!==void 0){if(isNaN(e.timeoutSeconds))throw new U(H.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (must not be NaN)`);if(e.timeoutSeconds<5)throw new U(H.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (minimum allowed value is 5)`);if(e.timeoutSeconds>30)throw new U(H.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (maximum allowed value is 30)`)}}(this.experimentalLongPollingOptions),this.useFetchStreams=!!e.useFetchStreams}isEqual(e){return this.host===e.host&&this.ssl===e.ssl&&this.credentials===e.credentials&&this.cacheSizeBytes===e.cacheSizeBytes&&this.experimentalForceLongPolling===e.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===e.experimentalAutoDetectLongPolling&&function(e,t){return e.timeoutSeconds===t.timeoutSeconds}(this.experimentalLongPollingOptions,e.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}},gu=class{constructor(e,t,n,r){this._authCredentials=e,this._appCheckCredentials=t,this._databaseId=n,this._app=r,this.type=`firestore-lite`,this._persistenceKey=`(lite)`,this._settings=new hu({}),this._settingsFrozen=!1,this._emulatorOptions={},this._terminateTask=`notTerminated`}get app(){if(!this._app)throw new U(H.FAILED_PRECONDITION,`Firestore was not initialized using the Firebase SDK. 'app' is not available`);return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return this._terminateTask!==`notTerminated`}_setSettings(e){if(this._settingsFrozen)throw new U(H.FAILED_PRECONDITION,`Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.`);this._settings=new hu(e),this._emulatorOptions=e.emulatorOptions||{},e.credentials!==void 0&&(this._authCredentials=function(e){if(!e)return new Oi;switch(e.type){case`firstParty`:return new Mi(e.sessionIndex||`0`,e.iamToken||null,e.authTokenFactory||null);case`provider`:return e.client;default:throw new U(H.INVALID_ARGUMENT,`makeAuthCredentialsProvider failed due to invali
784d credential type`)}}(e.credentials))}_getSettings(){return this._settings}_getEmulatorOptions(){return this._emulatorOptions}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask===`notTerminated`&&(this._terminateTask=this._terminate()),this._terminateTask}async _restart(){this._terminateTask===`notTerminated`?await this._terminate():this._terminateTask=`notTerminated`}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(e){let t=tu.get(e);t&&(B(eu,`Removing Datastore`),tu.delete(e),t.terminate())}(this),Promise.resolve()}};function _u(e,t,n,r={}){e=ea(e,gu);let i=ct(t),a=e._getSettings(),o={...a,emulatorOptions:e._getEmulatorOptions()},s=`${t}:${n}`;i&&lt(`https://${s}`),a.host!==pu&&a.host!==s&&xi(`Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used.`);let c={...a,host:s,ssl:i,emulatorOptions:r};if(!$e(c,o)&&(e._setSettings(c),r.mockUserToken)){let t,n;if(typeof r.mockUserToken==`string`)t=r.mockUserToken,n=hi.MOCK_USER;else{t=Re(r.mockUserToken,e._app?.options.projectId);let i=r.mockUserToken.sub||r.mockUserToken.user_id;if(!i)throw new U(H.INVALID_ARGUMENT,`mockUserToken must contain 'sub' or 'user_id' field!`);n=new hi(i)}e._authCredentials=new ki(new Di(t,n))}}var vu=class e{constructor(e,t,n){this.converter=t,this._query=n,this.type=`query`,this.firestore=e}withConverter(t){return new e(this.firestore,t,this._query)}},yu=class e{constructor(e,t,n){this.converter=t,this._key=n,this.type=`document`,this.firestore=e}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new bu(this.firestore,this.converter,this._key.path.popLast())}withConverter(t){return new e(this.firestore,t,this._key)}toJSON(){return{type:e._jsonSchemaVersion,referencePath:this._key.toString()}}static fromJSON(t,n,r){if(na(n,e._jsonSchema))return new e(t,r||null,new W(Gi.fromString(n.referencePath)))}};yu._jsonSchemaVersion=`firestore/documentReference/1.0`,yu._jsonSchema={type:ta(`string`,yu._jsonSchemaVersion),referencePath:ta(`string`)};var bu=class e extends vu{constructor(e,t,n){super(e,t,Us(n)),this._path=n,this.type=`collection`}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){let e=this._path.popLast();return e.isEmpty()?null:new yu(this.firestore,null,new W(e))}withConverter(t){return new e(this.firestore,t,this._path)}};function xu(e,t,...n){if(e=st(e),Ji(`collection`,`path`,t),e instanceof gu){let r=Gi.fromString(t,...n);return Zi(r),new bu(e,null,r)}{if(!(e instanceof yu||e instanceof bu))throw new U(H.INVALID_ARGUMENT,`Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore`);let r=e._path.child(Gi.fromString(t,...n));return Zi(r),new bu(e.firestore,null,r)}}function Su(e,t,...n){if(e=st(e),arguments.length===1&&(t=Ii.newId()),Ji(`doc`,`path`,t),e instanceof gu){let r=Gi.fromString(t,...n);return Xi(r),new yu(e,null,new W(r))}{if(!(e instanceof yu||e instanceof bu))throw new U(H.INVALID_ARGUMENT,`Expected first argument to doc() to be a CollectionReference, a DocumentReference or FirebaseFirestore`);let r=e._path.child(Gi.fromString(t,...n));return Xi(r),new yu(e.firestore,e instanceof bu?e.converter:null,new W(r))}}var Cu=class e{constructor(e){this._values=(e||[]).map((e=>e))}toArray(){return this._values.map((e=>e))}isEqual(e){return function(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;++n)if(e[n]!==t[n])return!1;return!0}(this._values,e._values)}toJSON(){return{type:e._jsonSchemaVersion,vectorValues:this._values}}static fromJSON(t){if(na(t,e._jsonSchema)){if(Array.isArray(t.vectorValues)&&t.vectorValues.every((e=>typeof e==`number`)))return new e(t.vectorValues);throw new U(H.INVALID_ARGUMENT,`Expected 'vectorValues' field to be a number array`)}}};Cu._jsonSchemaVersion=`firestore/vectorValue/1.0`,Cu._jsonSchema={type:ta(`string`,Cu._jsonSchemaVersion),vectorValues:ta(`object`)};var wu=/^__.*__$/,Tu=class{constructor(e,t,n){this.data=e,this.fieldMask=t,this.fieldTransforms=n}toMutation(e,t){return this.fieldMask===null?new as(e,this.data,t,this.fieldTransforms):new os(e,this.data,this.fieldMask,t,this.fieldTransforms)}};function Eu(e){switch(e){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw Ci(40011,{dataSource:e})}}var Du=class e{constructor(e,t,n,r,i,a){this.settings=e,this.databaseId=t,this.serializer
784=n,this.ignoreUndefinedProperties=r,i===void 0&&this.validatePath(),this.fieldTransforms=i||[],this.fieldMask=a||[]}get path(){return this.settings.path}get dataSource(){return this.settings.dataSource}contextWith(t){return new e({...this.settings,...t},this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}childContextForField(e){let t=this.path?.child(e),n=this.contextWith({path:t,arrayElement:!1});return n.validatePathSegment(e),n}childContextForFieldPath(e){let t=this.path?.child(e),n=this.contextWith({path:t,arrayElement:!1});return n.validatePath(),n}childContextForArray(e){return this.contextWith({path:void 0,arrayElement:!0})}createError(e){return zu(e,this.settings.methodName,this.settings.hasConverter||!1,this.path,this.settings.targetDoc)}contains(e){return this.fieldMask.find((t=>e.isPrefixOf(t)))!==void 0||this.fieldTransforms.find((t=>e.isPrefixOf(t.field)))!==void 0}validatePath(){if(this.path)for(let e=0;e<this.path.length;e++)this.validatePathSegment(this.path.get(e))}validatePathSegment(e){if(e.length===0)throw this.createError(`Document fields must not be empty`);if(Eu(this.dataSource)&&wu.test(e))throw this.createError(`Document fields cannot begin and end with "__"`)}},Ou=class{constructor(e,t,n){this.databaseId=e,this.ignoreUndefinedProperties=t,this.serializer=n||El(e)}createContext(e,t,n,r=!1){return new Du({dataSource:e,methodName:t,targetDoc:n,path:qi.emptyPath(),arrayElement:!1,hasConverter:r},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}};function ku(e){let t=e._freezeSettings(),n=El(e._databaseId);return new Ou(e._databaseId,!!t.ignoreUndefinedProperties,n)}function Au(e,t,n,r,i,a={}){let o=e.createContext(a.merge||a.mergeFields?2:0,t,n,i);Fu(`Data must be an object, but it was:`,o,r);let s=Nu(r,o),c,l;if(a.merge)c=new Ma(o.fieldMask),l=o.fieldTransforms;else if(a.mergeFields){let e=[];for(let r of a.mergeFields){let i=Iu(t,r,n);if(!o.contains(i))throw new U(H.INVALID_ARGUMENT,`Field '${i}' is specified in your field mask but missing from your input data.`);Bu(e,i)||e.push(i)}c=new Ma(e),l=o.fieldTransforms.filter((e=>c.covers(e.field)))}else c=null,l=o.fieldTransforms;return new Tu(new Oo(s),c,l)}function ju(e,t,n,r=!1){return Mu(n,e.createContext(r?4:3,t))}function Mu(e,t,n){if(Pu(e=st(e)))return Fu(`Unsupported field value:`,t,e),Nu(e,t);if(e instanceof Al)return function(e,t){if(!Eu(t.dataSource))throw t.createError(`${e._methodName}() can only be used with update() and set()`);if(!t.path)throw t.createError(`${e._methodName}() is not currently supported inside arrays`);let n=e._toFieldTransform(t);n&&t.fieldTransforms.push(n)}(e,t),null;if(e===void 0&&t.ignoreUndefinedProperties)return null;if(t.path&&t.fieldMask.push(t.path),e instanceof Array){if(t.settings.arrayElement&&t.dataSource!==4)throw t.createError(`Nested arrays are not supported`);return function(e,t){let n=[],r=0;for(let i of e){let e=Mu(i,t.childContextForArray(r));e??={nullValue:`NULL_VALUE`},n.push(e),r++}return{arrayValue:{values:n}}}(e,t)}return function(e,t,n){if((e=st(e))===null)return{nullValue:`NULL_VALUE`};if(typeof e==`number`)return Mo(t.serializer,e,n);if(typeof e==`boolean`)return{booleanValue:e};if(typeof e==`string`)return{stringValue:e};if(e instanceof Date){let n=aa.fromDate(e);return{timestampValue:Gc(t.serializer,n)}}if(e instanceof aa){let n=new aa(e.seconds,1e3*Math.floor(e.nanoseconds/1e3));return{timestampValue:Gc(t.serializer,n)}}if(e instanceof jl)return{geoPointValue:{latitude:e.latitude,longitude:e.longitude}};if(e instanceof Dl)return{bytesValue:qc(t.serializer,e._byteString)};if(e instanceof yu){let n=t.databaseId,r=e.firestore._databaseId;if(!r.isEqual(n))throw t.createError(`Document reference is for database ${r.projectId}/${r.database} but should be for database ${n.projectId}/${n.database}`);return{referenceValue:Xc(e.firestore._databaseId||t.databaseId,e._key.path)}}if(e instanceof Cu)return function(e,t){let n=e instanceof Cu?e.toArray():e;return{mapValue:{fields:{[Qa]:{stringValue:to},[no]:{arrayValue:{values:n.map((e=>{if(typeof e!=`number`)throw t.createError(`VectorValues must only contain numeric values.`);return Ao(t.serializer,e)}))}}}}}}(e,t);if(Cl(e))return e._toProto(t.serializer);throw t.createError(`Unsupported field value: ${$i(e)}`)}(e,t,n)}function Nu(e,t){let n={};return Ia(e)?t.path&&t.path.length>0&&t.fieldMask.push(t.path):Pa(e,((e,r)=>{let i=Mu(r,t.childContextForField(e));i!=null&&(n[e]=i)})),{mapValue:{fields:n}}}function Pu(e){return!(typeof e!=`object`||!e||e instanceof Array||e instanceof Date||e instanceof aa||e instanceof jl||e instanceof Dl||e instanceof yu||e instanceof Al||e instanceof Cu||Cl(e))}function Fu(e,t,n){if(!Pu(n)||!Qi(n)){let r=$i(n);throw r===`an object`?t.createError(e+` a custom object`):t.createError(e+` `+r)}}function Iu(e,t,n){if((t=st(t))instanceof Ol)return t._internalPath;if(typeof t==`string`)return Ru(e,t);throw zu(`Field path arguments must be of type string or `,e,!1,void 0,n)}var Lu=RegExp(`[~\\*/\\[\\]]`);function Ru(e,t,n){if(t.search(Lu)>=0)throw zu(`Invalid field path (${t}). Paths must not contain '~', '*', '/', '[', or ']'`,e,!1,void 0,n);try{return new Ol(...t.split(`.`))._internalPath}catch{throw zu(`Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,e,!1,void 0,n)}}function zu(e,t,n,r,i){let a=r&&!r.isEmpty(),o=i!==void 0,s=`Function ${t}
784() called with invalid data`;n&&(s+=" (via `toFirestore()`)"),s+=`. `;let c=``;return(a||o)&&(c+=` (found`,a&&(c+=` in field ${r}`),o&&(c+=` in document ${i}`),c+=`)`),new U(H.INVALID_ARGUMENT,s+e+c)}function Bu(e,t){return e.some((e=>e.isEqual(t)))}function Vu(e){return typeof e._readUserData==`function`}var Hu=class e{constructor(e){this.optionDefinitions=e}_getKnownOptions(t,n){let r=Oo.empty();for(let i in this.optionDefinitions)if(this.optionDefinitions.hasOwnProperty(i)){let a=this.optionDefinitions[i];if(i in t){let o=t[i],s;a.nestedOptions&&Qi(o)?s={mapValue:{fields:new e(a.nestedOptions).getOptionsProto(n,o)}}:o&&(s=Mu(o,n)??void 0),s&&r.set(qi.fromServerFormat(a.serverName),s)}}return r}getOptionsProto(e,t,n){let r=this._getKnownOptions(t,e);if(n){let t=new Map(Fa(n,((t,n)=>[qi.fromServerFormat(n),t===void 0?null:Mu(t,e)])));r.setAll(t)}return r.value.mapValue.fields??{}}};function Uu(e){return typeof e==`object`&&!!e&&!!(`nullValue`in e&&(e.nullValue===null||e.nullValue===`NULL_VALUE`)||`booleanValue`in e&&(e.booleanValue===null||typeof e.booleanValue==`boolean`)||`integerValue`in e&&(e.integerValue===null||typeof e.integerValue==`number`||typeof e.integerValue==`string`)||`doubleValue`in e&&(e.doubleValue===null||typeof e.doubleValue==`number`)||`timestampValue`in e&&(e.timestampValue===null||function(e){return typeof e==`object`&&!!e&&`seconds`in e&&(e.seconds===null||typeof e.seconds==`number`||typeof e.seconds==`string`)&&`nanos`in e&&(e.nanos===null||typeof e.nanos==`number`)}(e.timestampValue))||`stringValue`in e&&(e.stringValue===null||typeof e.stringValue==`string`)||`bytesValue`in e&&(e.bytesValue===null||e.bytesValue instanceof Uint8Array)||`referenceValue`in e&&(e.referenceValue===null||typeof e.referenceValue==`string`)||`geoPointValue`in e&&(e.geoPointValue===null||function(e){return typeof e==`object`&&!!e&&`latitude`in e&&(e.latitude===null||typeof e.latitude==`number`)&&`longitude`in e&&(e.longitude===null||typeof e.longitude==`number`)}(e.geoPointValue))||`arrayValue`in e&&(e.arrayValue===null||function(e){return typeof e==`object`&&!!e&&!(!(`values`in e)||e.values!==null&&!Array.isArray(e.values))}(e.arrayValue))||`mapValue`in e&&(e.mapValue===null||function(e){return typeof e==`object`&&!!e&&!(!(`fields`in e)||e.fields!==null&&!Qi(e.fields))}(e.mapValue))||`fieldReferenceValue`in e&&(e.fieldReferenceValue===null||typeof e.fieldReferenceValue==`string`)||`functionValue`in e&&(e.functionValue===null||function(e){return typeof e==`object`&&!!e&&!(!(`name`in e)||e.name!==null&&typeof e.name!=`string`||!(`args`in e)||e.args!==null&&!Array.isArray(e.args))}(e.functionValue))||`pipelineValue`in e&&(e.pipelineValue===null||function(e){return typeof e==`object`&&!!e&&!(!(`stages`in e)||e.stages!==null&&!Array.isArray(e.stages))}(e.pipelineValue)))}function Wu(e){return new Cu(e)}function Y(e){let t;return e instanceof qu?e:(t=Qi(e)?cd(e):e instanceof Array?ld(e):rd(e,void 0),t)}function Gu(e){if(e instanceof qu)return e;if(e instanceof Cu)return nd(e);if(Array.isArray(e))return nd(Wu(e));throw Error(`Unsupported value: `+typeof e)}function Ku(e){return Sa(e)?$u(e):Y(e)}var qu=class{constructor(){this._protoValueType=`ProtoValue`}add(e){return new X(`add`,[this,Y(e)],`add`)}asBoolean(){if(this instanceof id)return this;if(this instanceof td)return new od(this);if(this instanceof Qu)return new sd(this);if(this instanceof X)return new ad(this);throw new U(`invalid-argument`,`Conversion of type ${typeof this} to BooleanExpression not supported.`)}subtract(e){return new X(`subtract`,[this,Y(e)],`subtract`)}multiply(e){return new X(`multiply`,[this,Y(e)],`multiply`)}divide(e){return new X(`divide`,[this,Y(e)],`divide`)}mod(e){return new X(`mod`,[this,Y(e)],`mod`)}equal(e){return new X(`equal`,[this,Y(e)],`equal`).asBoolean()}notEqual(e){return new X(`not_equal`,[this,Y(e)],`notEqual`).asBoolean()}lessThan(e){return new X(`less_than`,[this,Y(e)],`lessThan`).asBoolean()}lessThanOrEqual(e){return new X(`less_than_or_equal`,[this,Y(e)],`lessThanOrEqual`).asBoolean()}greaterThan(e){return new X(`greater_than`,[this,Y(e)],`greaterThan`).asBoolean()}greaterThanOrEqual(e){return new X(`greater_than_or_equal`,[this,Y(e)],`greaterThanOrEqual`).asBoolean()}arrayConcat(e,...t){let n=[e,...t].map((e=>Y(e)));return new X(`array_concat`,[this,...n],`arrayConcat`)}arrayContains(e){return new X(`array_contains`,[this,Y(e)],`arrayContains`).asBoolean()}arrayContainsAll(e){let t=Array.isArray(e)?new Zu(e.map(Y),`arrayContainsAll`):e;return new X(`array_contains_all`,[this,t],`arrayContainsAll`).asBoolean()}arrayContainsAny(e){let t=Array.isArray(e)?new Zu(e.map(Y),`arrayContainsAny`):e;return new X(`array_contains_any`,[this,t],`arrayContainsAny`).asBoolean()}arrayReverse(){return new X(`array_reverse`,[this])}arrayLength(){return new X(`array_length`,[this],`arrayLength`)}equalAny(e){let t=Array.isArray(e)?new Zu(e.map(Y),`equalAny`):e;return new X(`equal_any`,[this,t],`equalAny`).asBoolean()}notEqualAny(e){let t=Array.isArray(e)?new Zu(e.map(Y),`notEqualAny`):e;return new X(`not_equal_any`,[this,t],`notEqualAny`).asBoolean()}exists(){return new X(`exists`,[this],`exists`).asBoolean()}charLength(){return new X(`char_length`,[this],`charLength`)}like(e){return new X(`like`,[this,Y(e)],`like`).asBoolean()}regexContains(e){return new X(`regex_contains`,[this,Y(e)],`regexContains`).asBoolean()}regexFind(e){return new X(`regex_find`,[this,Y(e)],`regexFind`)}regexFindAll(e){return new X(`regex_find_all`,[this,Y(e)],`regexFindAll`)}regexMatch(e){return new X(`regex_match`,[this,Y(e)],`regexMatch`).asBoolean()}stringContains(e){return new X(`string_contains`,[this,Y(e)],`str
784ingContains`).asBoolean()}startsWith(e){return new X(`starts_with`,[this,Y(e)],`startsWith`).asBoolean()}endsWith(e){return new X(`ends_with`,[this,Y(e)],`endsWith`).asBoolean()}toLower(){return new X(`to_lower`,[this],`toLower`)}toUpper(){return new X(`to_upper`,[this],`toUpper`)}trim(e){let t=[this];return e&&t.push(Y(e)),new X(`trim`,t,`trim`)}ltrim(e){let t=[this];return e&&t.push(Y(e)),new X(`ltrim`,t,`ltrim`)}rtrim(e){let t=[this];return e&&t.push(Y(e)),new X(`rtrim`,t,`rtrim`)}type(){return new X(`type`,[this])}isType(e){return new X(`is_type`,[this,nd(e)],`isType`).asBoolean()}stringConcat(e,...t){let n=[e,...t].map(Y);return new X(`string_concat`,[this,...n],`stringConcat`)}stringIndexOf(e){return new X(`string_index_of`,[this,Y(e)],`stringIndexOf`)}stringRepeat(e){return new X(`string_repeat`,[this,Y(e)],`stringRepeat`)}stringReplaceAll(e,t){return new X(`string_replace_all`,[this,Y(e),Y(t)],`stringReplaceAll`)}stringReplaceOne(e,t){return new X(`string_replace_one`,[this,Y(e),Y(t)],`stringReplaceOne`)}concat(e,...t){let n=[e,...t].map(Y);return new X(`concat`,[this,...n],`concat`)}reverse(){return new X(`reverse`,[this],`reverse`)}arrayFilter(e,t){return new X(`array_filter`,[this,Y(e),t],`arrayFilter`)}arrayTransform(e,t){return new X(`array_transform`,[this,Y(e),t],`arrayTransform`)}arrayTransformWithIndex(e,t,n){return new X(`array_transform`,[this,Y(e),Y(t),n],`arrayTransformWithIndex`)}arraySlice(e,t){let n=[this,Y(e)];return t!==void 0&&n.push(Y(t)),new X(`array_slice`,n,`arraySlice`)}arrayFirst(){return new X(`array_first`,[this],`arrayFirst`)}arrayFirstN(e){return new X(`array_first_n`,[this,Y(e)],`arrayFirstN`)}arrayLast(){return new X(`array_last`,[this],`arrayLast`)}arrayLastN(e){return new X(`array_last_n`,[this,Y(e)],`arrayLastN`)}arrayMaximum(){return new X(`maximum`,[this],`arrayMaximum`)}arrayMaximumN(e){return new X(`maximum_n`,[this,Y(e)],`arrayMaximumN`)}arrayMinimum(){return new X(`minimum`,[this],`arrayMinimum`)}arrayMinimumN(e){return new X(`minimum_n`,[this,Y(e)],`arrayMinimumN`)}arrayIndexOf(e){return new X(`array_index_of`,[this,Y(e),Y(`first`)],`arrayIndexOf`)}arrayLastIndexOf(e){return new X(`array_index_of`,[this,Y(e),Y(`last`)],`arrayLastIndexOf`)}arrayIndexOfAll(e){return new X(`array_index_of_all`,[this,Y(e)],`arrayIndexOfAll`)}byteLength(){return new X(`byte_length`,[this],`byteLength`)}ceil(){return new X(`ceil`,[this])}floor(){return new X(`floor`,[this])}abs(){return new X(`abs`,[this])}exp(){return new X(`exp`,[this])}mapGet(e){return new X(`map_get`,[this,nd(e)],`mapGet`)}mapSet(e,t,...n){return new X(`map_set`,[this,Y(e),Y(t),...n.map(Y)],`mapSet`)}mapKeys(){return new X(`map_keys`,[this],`mapKeys`)}mapValues(){return new X(`map_values`,[this],`mapValues`)}mapEntries(){return new X(`map_entries`,[this],`mapEntries`)}getField(e){return new X(`get_field`,[this,Y(e)],`get_field`)}count(){return Ju._create(`count`,[this],`count`)}sum(){return Ju._create(`sum`,[this],`sum`)}average(){return Ju._create(`average`,[this],`average`)}minimum(){return Ju._create(`minimum`,[this],`minimum`)}maximum(){return Ju._create(`maximum`,[this],`maximum`)}first(){return Ju._create(`first`,[this],`first`)}last(){return Ju._create(`last`,[this],`last`)}arrayAgg(){return Ju._create(`array_agg`,[this],`arrayAgg`)}arrayAggDistinct(){return Ju._create(`array_agg_distinct`,[this],`arrayAggDistinct`)}countDistinct(){return Ju._create(`count_distinct`,[this],`countDistinct`)}logicalMaximum(e,...t){let n=[e,...t];return new X(`maximum`,[this,...n.map(Y)],`logicalMaximum`)}logicalMinimum(e,...t){let n=[e,...t];return new X(`minimum`,[this,...n.map(Y)],`minimum`)}vectorLength(){return new X(`vector_length`,[this],`vectorLength`)}cosineDistance(e){return new X(`cosine_distance`,[this,Gu(e)],`cosineDistance`)}dotProduct(e){return new X(`dot_product`,[this,Gu(e)],`dotProduct`)}euclideanDistance(e){return new X(`euclidean_distance`,[this,Gu(e)],`euclideanDistance`)}unixMicrosToTimestamp(){return new X(`unix_micros_to_timestamp`,[this],`unixMicrosToTimestamp`)}timestampToUnixMicros(){return new X(`timestamp_to_unix_micros`,[this],`timestampToUnixMicros`)}unixMillisToTimestamp(){return new X(`unix_millis_to_timestamp`,[this],`unixMillisToTimestamp`)}timestampToUnixMillis(){return new X(`timestamp_to_unix_millis`,[this],`timestampToUnixMillis`)}unixSecondsToTimestamp(){return new X(`unix_seconds_to_timestamp`,[this],`unixSecondsToTimestamp`)}timestampToUnixSeconds(){return new X(`timestamp_to_unix_seconds`,[this],`timestampToUnixSeconds`)}timestampAdd(e,t){return new X(`timestamp_add`,[this,Y(e),Y(t)],`timestampAdd`)}timestampSubtract(e,t){return new X(`timestamp_subtract`,[this,Y(e),Y(t)],`timestampSubtract`)}timestampDiff(e,t){return new X(`timestamp_diff`,[this,Ku(e),Y(t)],`timestampDiff`)}timestampExtract(e,t){let n=[this,Y(e)];return t&&n.push(Y(t)),new X(`timestamp_extract`,n,`timestampExtract`)}documentId(){return new X(`document_id`,[this],`documentId`)}parent(){return new X(`parent`,[this],`parent`)}
784substring(e,t){let n=Y(e);return new X(`substring`,t===void 0?[this,n]:[this,n,Y(t)],`substring`)}arrayGet(e){return new X(`array_get`,[this,Y(e)],`arrayGet`)}isError(){return new X(`is_error`,[this],`isError`).asBoolean()}ifError(e){let t=new X(`if_error`,[this,Y(e)],`ifError`);return e instanceof id?t.asBoolean():t}isAbsent(){return new X(`is_absent`,[this],`isAbsent`).asBoolean()}mapRemove(e){return new X(`map_remove`,[this,Y(e)],`mapRemove`)}mapMerge(e,...t){let n=Y(e),r=t.map(Y);return new X(`map_merge`,[this,n,...r],`mapMerge`)}pow(e){return new X(`pow`,[this,Y(e)])}trunc(e){return e===void 0?new X(`trunc`,[this]):new X(`trunc`,[this,Y(e)],`trunc`)}round(e){return e===void 0?new X(`round`,[this]):new X(`round`,[this,Y(e)],`round`)}collectionId(){return new X(`collection_id`,[this])}length(){return new X(`length`,[this])}ln(){return new X(`ln`,[this])}sqrt(){return new X(`sqrt`,[this])}stringReverse(){return new X(`string_reverse`,[this])}ifAbsent(e){return new X(`if_absent`,[this,Y(e)],`ifAbsent`)}ifNull(e){return new X(`if_null`,[this,Y(e)],`ifNull`)}coalesce(e,...t){return new X(`coalesce`,[this,Y(e),...t.map(Y)],`coalesce`)}join(e){return new X(`join`,[this,Y(e)],`join`)}log10(){return new X(`log10`,[this])}arraySum(){return new X(`sum`,[this])}split(e){return new X(`split`,[this,Y(e)])}timestampTruncate(e,t){let n=[this,Y(e)];return t&&n.push(Y(t)),new X(`timestamp_trunc`,n)}ascending(){return ud(this)}descending(){return dd(this)}as(e){return new Xu(this,e,`as`)}},Ju=class e{constructor(e,t){this.name=e,this.params=t,this.exprType=`AggregateFunction`,this._protoValueType=`ProtoValue`}static _create(t,n,r){let i=new e(t,n);return i._methodName=r,i}as(e){return new Yu(this,e,`as`)}_toProto(e){return{functionValue:{name:this.name,args:this.params.map((t=>t._toProto(e)))}}}_readUserData(e){e=this._methodName?e.contextWith({methodName:this._methodName}):e,this.params.forEach((t=>t._readUserData(e)))}},Yu=class{constructor(e,t,n){this.aggregate=e,this.alias=t,this._methodName=n}_readUserData(e){this.aggregate._readUserData(e)}},Xu=class{constructor(e,t,n){this.expr=e,this.alias=t,this._methodName=n,this.exprType=`AliasedExpression`,this.selectable=!0}_readUserData(e){this.expr._readUserData(e)}},Zu=class extends qu{constructor(e,t){super(),this.Rr=e,this._methodName=t,this.expressionType=`ListOfExpressions`}_toProto(e){return{arrayValue:{values:this.Rr.map((t=>t._toProto(e)))}}}_readUserData(e){this.Rr.forEach((t=>t._readUserData(e)))}},Qu=class extends qu{constructor(e,t){super(),this.fieldPath=e,this._methodName=t,this.expressionType=`Field`,this.selectable=!0}get _fieldPath(){return this.fieldPath}get fieldName(){return this.fieldPath.canonicalString()}get alias(){return this.fieldName}get expr(){return this}geoDistance(e){return new X(`geo_distance`,[this,Y(e)],`geoDistance`)}_toProto(e){return{fieldReferenceValue:this.fieldPath.canonicalString()}}_readUserData(e){}};function $u(e){return ed(e,`field`)}function ed(e,t){return new Qu(typeof e==`string`?Ui===e?kl()._internalPath:Iu(`field`,e):e._internalPath,t)}var td=class e extends qu{constructor(e,t){super(),this.value=e,this._methodName=t,this.expressionType=`Constant`}static _fromProto(t){let n=new e(t,void 0);return n._protoValue=t,n}_toProto(e){return V(this._protoValue!==void 0,237),this._protoValue}_getValue(){return this._protoValue}_readUserData(e){e=this._methodName?e.contextWith({methodName:this._methodName}):e,Uu(this._protoValue)||(this._protoValue=Mu(this.value,e))}};function nd(e,t){return rd(e,`constant`)}function rd(e,t){let n=new td(e,t);return typeof e==`boolean`?new od(n):n}var X=class extends qu{constructor(e,t,n,r){super(),this.name=e,this.params=t,this.expressionType=`Function`,this._optionsProto=void 0,n!==void 0&&(this._methodName=n),r!==void 0&&(this._options=r)}get _optionsUtil(){return new Hu({})}_toProto(e){let t={functionValue:{name:this.name,args:this.params.map((t=>t._toProto(e)))}};return this._optionsProto&&(t.functionValue.options=this._optionsProto),t}_readUserData(e){e=this._methodName?e.contextWith({methodName:this._methodName}
784):e,this.params.forEach((t=>t._readUserData(e))),this._options&&(this._optionsProto=this._optionsUtil.getOptionsProto(e,this._options))}},id=class e extends qu{get _methodName(){return this._expr._methodName}countIf(){return Ju._create(`count_if`,[this],`countIf`)}not(){return new X(`not`,[this],`not`).asBoolean()}conditional(e,t){return new X(`conditional`,[this,e,t],`conditional`)}ifError(t){let n=Y(t),r=new X(`if_error`,[this,n],`ifError`);return n instanceof e?r.asBoolean():r}_toProto(e){return this._expr._toProto(e)}_readUserData(e){this._expr._readUserData(e)}},ad=class extends id{constructor(e){super(),this._expr=e,this.expressionType=`Function`}},od=class extends id{constructor(e){super(),this._expr=e,this.expressionType=`Constant`}_getValue(){return this._expr._getValue()}},sd=class extends id{constructor(e){super(),this._expr=e,this.expressionType=`Field`}};function cd(e,t){let n=[];for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let r=e[t];n.push(nd(t)),n.push(Y(r))}return new X(`map`,n,`map`)}function ld(e){return function(e,t){return new X(`array`,e.map((e=>Y(e))),t)}(e,`array`)}function ud(e){return new fd(Ku(e),`ascending`,`ascending`)}function dd(e){return new fd(Ku(e),`descending`,`descending`)}var fd=class{constructor(e,t,n){this.expr=e,this.direction=t,this._methodName=n,this._protoValueType=`ProtoValue`}_toProto(e){return{mapValue:{fields:{direction:Tl(this.direction),expression:this.expr._toProto(e)}}}}_readUserData(e){this.expr._readUserData(e)}},pd=class{constructor(e){this.optionsProto=void 0,{rawOptions:this.rawOptions,...this.knownOptions}=e}_readUserData(e){this.optionsProto=this._optionsUtil.getOptionsProto(e,this.knownOptions,this.rawOptions)}_toProto(e){return{name:this._name,options:this.optionsProto}}},md=class extends pd{get _name(){return`add_fields`}get _optionsUtil(){return new Hu({})}constructor(e,t){super(t),this.fields=e}_toProto(e){return{...super._toProto(e),args:[wl(e,this.fields)]}}_readUserData(e){super._readUserData(e),Dd(this.fields,e)}},hd=class extends pd{get _name(){return`aggregate`}get _optionsUtil(){return new Hu({})}constructor(e,t,n){super(n),this.groups=e,this.accumulators=t}_toProto(e){return{...super._toProto(e),args:[wl(e,this.accumulators),wl(e,this.groups)]}}_readUserData(e){super._readUserData(e),Dd(this.groups,e),Dd(this.accumulators,e)}},gd=class extends pd{get _name(){return`distinct`}get _optionsUtil(){return new Hu({})}constructor(e,t){super(t),this.groups=e}_toProto(e){return{...super._toProto(e),args:[wl(e,this.groups)]}}_readUserData(e){super._readUserData(e),Dd(this.groups,e)}},_d=class extends pd{get _name(){return`collection`}get _optionsUtil(){return new Hu({forceIndex:{serverName:`force_index`}})}constructor(e,t){super(t),this.Vr=e.startsWith(`/`)?e:`/`+e}_toProto(e){return{...super._toProto(e),args:[{referenceValue:this.Vr}]}}_readUserData(e){super._readUserData(e)}},vd=class extends pd{get _name(){return`collection_group`}get _optionsUtil(){return new Hu({forceIndex:{serverName:`force_index`}})}constructor(e,t){super(t),this.collectionId=e}_toProto(e){return{...super._toProto(e),args:[{referenceValue:``},{stringValue:this.collectionId}]}}_readUserData(e){super._readUserData(e)}},yd=class extends pd{get _name(){return`database`}get _optionsUtil(){return new Hu({})}_toProto(e){return{...super._toProto(e)}}_readUserData(e){super._readUserData(e)}},bd=class extends pd{get _name(){return`documents`}get _optionsUtil(){return new Hu({})}constructor(e,t){if(super(t),!e||e.length===0)throw new U(H.INVALID_ARGUMENT,`Empty document paths are not allowed in DocumentsSource`);let n=e.map((e=>e.startsWith(`/`)?e:`/`+e)),r=new Set(n);if(r.size!==n.length)throw new U(H.INVALID_ARGUMENT,`Duplicate document paths are not allowed in DocumentsSource`);this.dr=n,this.mr=r}_toProto(e){return{...super._toProto(e),args:this.dr.map((e=>({referenceValue:e})))}}_readUserData(e){super._readUserData(e)}},xd=class extends pd{get _name(){return`where`}get _optionsUtil(){return new Hu({})}constructor(e,t){super(t),this.condition=e}_toProto(e){return{...super._toProto(e),args:[this.condition._toProto(e)]}}_readUserData(e){super._readUserData(e),Dd(this.condition,e)}},Sd=class extends pd{get _name(){return`limit`}get _optionsUtil(){return new Hu({})}constructor(e,t){V(!isNaN(e)&&e!==1/0&&e!==-1/0,34860),super(t),this.limit=e}_toProto(e){return{...super._toProto(e),args:[Mo(e,this.limit)]}}},Cd=class extends pd{get _name(){return`offset`}get _optionsUtil(){return new Hu({})}constructor(e,t){super(t),this.offset=e}_toProto(e){return{...super._toProto(e),args:[Mo(e,this.offset)]}}},wd=class extends pd{get _name(){return`select`}get _optionsUtil(){return new Hu({})}constructor(e,t){super(t),this.selections=e}_toProto(e){return{...super._toProto(e),args:[wl(e,this.selections)]}}_readUserData(e){super._readUserData(e),Dd(this.selections,e)}},Td=class extends pd{get _name(){return`sort`}get _optionsUtil(){return new Hu({})}constructor(e,t){super(t),this.orderings=e}_toProto(e){return{...super._toProto(e),args:this.orderings.map((t=>t._toProto(e)))}}_readUserData(e){super._readUserData(e),Dd(this.orderings,e)}},Ed=class e extends pd{get _name(){return`replace_with`}get _optionsUtil(){return new Hu({})}constructor(e,t){super(t),this.map=e}_toProto(t){return{...super._toProto(t),args:[this.map._toProto(t),Tl(e.pr)]}}_readUserData(e){super._readUserData(e),Dd(this.map,e)}};Ed.pr=`full_replace`;function Dd(e,t){return Vu(e)?e._readUserData(t):Array.isArray(e)||e instanceof Map?e.forEach((e=>e._readUserData(t))):Object.values(e).forEach((e=>e._readUserData(t))),e}
784var Od=class{constructor(e,t,n){this.serializer=e,this.stages=t,this.listenOptions=n,this.isCorePipeline=!0}getPipelineCollection(){return Ad(this)}getPipelineCollectionGroup(){return jd(this)}getPipelineCollectionId(){return Md(this)}getPipelineDocuments(){return Nd(this)}getPipelineFlavor(){return function(e){let t=`exact`;return e.stages.forEach(((n,r)=>{n._name!==gd.name&&n._name!==hd.name||(t=`keyless`),n._name===wd.name&&t===`exact`&&(t=`augmented`),n._name===md.name&&r<e.stages.length-1&&t===`exact`&&(t=`augmented`)})),t}(this)}getPipelineSourceType(){return kd(this)}};function kd(e){let t=e.stages[0];return t instanceof _d||t instanceof vd||t instanceof yd||t instanceof bd?t._name:`unknown`}function Ad(e){if(kd(e)===`collection`)return e.stages[0].Vr}function jd(e){if(kd(e)===`collection_group`)return e.stages[0].collectionId}function Md(e){switch(kd(e)){case`collection`:return Gi.fromString(Ad(e)).lastSegment();case`collection_group`:return jd(e);default:return}}function Nd(e){if(kd(e)===`documents`)return e.stages[0].dr}var Z=class e{constructor(e,t){this.type=e,this.value=t}static vr(){return new e(`ERROR`,void 0)}static Sr(){return new e(`UNSET`,void 0)}static Dr(){return new e(`NULL`,ro)}static newValue(t){return xo(t)?new e(`NULL`,ro):function(e){return!!e&&`booleanValue`in e}(t)?new e(`BOOLEAN`,t):_o(t)?new e(`INT`,t):vo(t)?new e(`DOUBLE`,t):function(e){return!!e&&`timestampValue`in e&&!!e.timestampValue}(t)?new e(`TIMESTAMP`,t):function(e){return!!e&&`stringValue`in e}(t)?new e(`STRING`,t):function(e){return!!e&&`bytesValue`in e}(t)?new e(`BYTES`,t):t.referenceValue?new e(`REFERENCE`,t):t.geoPointValue?new e(`GEO_POINT`,t):bo(t)?new e(`ARRAY`,t):wo(t)?new e(`VECTOR`,t):Co(t)?new e(`MAP`,t):new e(`ERROR`,void 0)}Cr(){return this.type===`ERROR`||this.type===`UNSET`}Fr(){return this.type===`NULL`}};function Pd(e){if(!e.Cr())return e.value}function Fd(e){return e instanceof id?e._expr:e}function Q(e){if((e=Fd(e))instanceof Qu)return new Id(e);if(e instanceof td)return new Ld(e);if(e instanceof Zu)return new Rd(e);if(e instanceof X){if(e.name===`add`)return new Gd(e);if(e.name===`subtract`)return new Kd(e);if(e.name===`multiply`)return new qd(e);if(e.name===`divide`)return new Jd(e);if(e.name===`mod`)return new Yd(e);if(e.name===`and`)return new Xd(e);if(e.name===`equal`)return new pf(e);if(e.name===`not_equal`)return new mf(e);if(e.name===`less_than`)return new hf(e);if(e.name===`less_than_or_equal`)return new gf(e);if(e.name===`greater_than`)return new _f(e);if(e.name===`greater_than_or_equal`)return new vf(e);if(e.name===`array_concat`)return new yf(e);if(e.name===`array_reverse`)return new bf(e);if(e.name===`array_contains`)return new xf(e);if(e.name===`array_contains_all`)return new Sf(e);if(e.name===`array_contains_any`)return new Cf(e);if(e.name===`array_length`)return new wf(e);
784if(e.name===`array_element`)return new Tf(e);if(e.name===`equal_any`)return new ef(e);if(e.name===`not_equal_any`)return new tf(e);if(e.name===`is_nan`)return new nf(e);if(e.name===`is_not_nan`)return new rf(e);if(e.name===`is_null`)return new af(e);if(e.name===`is_not_null`)return new of(e);if(e.name===`is_error`)return new sf(e);if(e.name===`exists`)return new cf(e);if(e.name===`not`)return new Zd(e);if(e.name===`or`)return new Qd(e);if(e.name===`xor`)return new $d(e);if(e.name===`conditional`)return new lf(e);if(e.name===`maximum`)return new uf(e);if(e.name===`minimum`)return new df(e);if(e.name===`reverse`)return new Ef(e);if(e.name===`replace_first`)return new Df(e);if(e.name===`replace_all`)return new Of(e);if(e.name===`char_length`)return new kf(e);if(e.name===`byte_length`)return new Af(e);if(e.name===`like`)return new Mf(e);if(e.name===`regex_contains`)return new Nf(e);if(e.name===`regex_match`)return new Pf(e);if(e.name===`string_contains`)return new Ff(e);if(e.name===`starts_with`)return new If(e);if(e.name===`ends_with`)return new Lf(e);if(e.name===`to_lower`)return new Rf(e);if(e.name===`to_upper`)return new zf(e);if(e.name===`trim`)return new Bf(e);if(e.name===`string_concat`)return new Vf(e);if(e.name===`map_get`)return new Hf(e);if(e.name===`cosine_distance`)return new Wf(e);if(e.name===`dot_product`)return new Gf(e);if(e.name===`euclidean_distance`)return new Kf(e);if(e.name===`vector_length`)return new qf(e);if(e.name===`unix_micros_to_timestamp`)return new cp(e);if(e.name===`timestamp_to_unix_micros`)return new fp(e);if(e.name===`unix_millis_to_timestamp`)return new lp(e);if(e.name===`timestamp_to_unix_millis`)return new pp(e);if(e.name===`unix_seconds_to_timestamp`)return new up(e);if(e.name===`timestamp_to_unix_seconds`)return new mp(e);if(e.name===`timestamp_add`)return new gp(e);if(e.name===`timestamp_subtract`)return new _p(e)}throw Error(`Unknown Expr : ${e}`)}var Id=class{constructor(e){this.expr=e}evaluate(e,t){if(this.expr.fieldName===Ui)return Z.newValue({referenceValue:$c(e.serializer,t.key)});if(this.expr.fieldName===`__update_time__`)return Z.newValue({timestampValue:Jc(e.serializer,t.version)});if(this.expr.fieldName===`__create_time__`)return Z.newValue({timestampValue:Jc(e.serializer,t.createTime)});let n=t.data.field(this.expr._fieldPath);return n?qa(n)?Z.newValue(function(e,t){if(e.serverTimestampBehavior===`estimate`)return{timestampValue:Jc(e.serializer,oa.fromTimestamp(Ya(t)))};if(e.serverTimestampBehavior===`previous`){let e=Ja(t);if(e)return e}return{nullValue:`NULL_VALUE`}}(e,n)):Z.newValue(n):Z.Sr()}},Ld=class{constructor(e){this.expr=e}evaluate(e,t){return Z.newValue(this.expr._getValue())}},Rd=class{constructor(e){this.expr=e}evaluate(e,t){let n=this.expr.Rr.map((n=>Q(n).evaluate(e,t)));return n.some((e=>e.Cr()))?Z.vr():Z.newValue({arrayValue:{values:n.map((e=>e.value))}})}};function zd(e){return vo(e)?Number(e.doubleValue):Number(e.integerValue)}function Bd(e){return BigInt(e.integerValue)}var Vd=BigInt(`0x7fffffffffffffff`),Hd=-BigInt(`0x8000000000000000`),Ud=class{constructor(e){this.expr=e}evaluate(e,t){V(this.expr.params.length>=2,24778);let n=Q(this.expr.params[0]).evaluate(e,t),r=Q(this.expr.params[1]).evaluate(e,t),i=this.Or(n,r);for(let n of this.expr.params.slice(2)){let r=Q(n).evaluate(e,t);i=this.Or(i,r)}return i}Or(e,t){if(e.Cr()||t.Cr())return Z.vr();if(e.Fr()||t.Fr())return Z.Dr();let n=e.value,r=t.value;if(!vo(n)&&!_o(n)||!vo(r)&&!_o(r))return Z.vr();if(vo(n)||vo(r)){let e=this.Mr(n,r);return e?Z.newValue(e):Z.vr()}if(_o(n)&&_o(r)){let e=this.Nr(n,r);return e===void 0?Z.vr():typeof e==`number`?Z.newValue({doubleValue:e}):e<Hd||e>Vd?Z.vr():Z.newValue({integerValue:`${e}`})}return Z.vr()}};function Wd(e,t){return oo(e)===oo(t)?So(e)||So(t)?`NOT_EQ`:xo(e)&&xo(t)?`EQ`:xo(e)||xo(t)?`NULL`:bo(e)&&bo(t)?function(e,t){if(e.values?.length!==t.values?.length)return`NOT_EQ`;let n=!1;for(let r=0;r<(e.values?.length??0);r++){let i=e.values[r],a=t.values[r];switch(Wd(i,a)){case`EQ`:break;case`NOT_EQ`:case`TYPE_MISMATCH`:return`NOT_EQ`;case`NULL`:n=!0;break;default:Ci(44609,{Lr:i,Br:a})}}return n?`NULL`:`EQ`}(e.arrayValue,t.arrayValue):wo(e)&&wo(t)||Co(e)&&Co(t)?function(e,t){let n=e.fields||{},r=t.fields||{};if(Na(n)!==Na(r))return`NOT_EQ`;let i=!1;for(let e in n)if(n.hasOwnProperty(e)){if(r[e]===void 0)return`NOT_EQ`;switch(Wd(n[e],r[e])){case`NOT_EQ`:case`TYPE_MISMATCH`:return`NOT_EQ`;case`NULL`:i=!0}}return i?`NULL`:`EQ`}(e.mapValue,t.mapValue):function(e,t){return so(e,t,{Te:!1,Ee:!0,he:!0})}(e,t)?`EQ`:`NOT_EQ`:`TYPE_MISMATCH`}var Gd=class extends Ud{Nr(e,t){return Bd(e)+Bd(t)}Mr(e,t){return{doubleValue:zd(e)+zd(t)}}},Kd=class extends Ud{constructor(e){super(e),this.expr=e}Nr(e,t){return Bd(e)-Bd(t)}Mr(e,t){return{doubleValue:zd(e)-zd(t)}}},qd=class extends Ud{constructor(e){super(e),this.expr=e}Nr(e,t){return Bd(e)*Bd(t)}Mr(e,t){return{doubleValue:zd(e)*zd(t)}}},Jd=class extends Ud{constructor(e){super(e),this.expr=e}Nr(e,t){let n=Bd(t);if(n!==BigInt(0))return Bd(e)/n}Mr(e,t){let n=zd(t);return n===0?{doubleValue:ba(n)?-1/0:1/0}:{doubleValue:zd(e)/n}}},Yd=class extends Ud{constructor(e){super(e),this.expr=e}Nr(e,t){let n=Bd(t);if(n!==BigInt(0))return Bd(e)%n}Mr(e,t){let n=zd(t);if(n!==0)return{doubleValue:zd(e)%n}}},Xd=class{constructor(e){this.expr=e}evaluate(e,t){let n=!1,r=!1;for(let i of this.expr.params){let a=Q(i).evaluate(e,t);switch(a.type){case`BOOLEAN`:if(!a.value?.booleanValue)return Z.newValue(ao);break;case`NULL`:r=!0;break;default:n=!0}
784}return n?Z.vr():r?Z.Dr():Z.newValue(io)}},Zd=class{constructor(e){this.expr=e}evaluate(e,t){V(this.expr.params.length===1,9634);let n=Q(this.expr.params[0]).evaluate(e,t);switch(n.type){case`BOOLEAN`:return Z.newValue({booleanValue:!n.value?.booleanValue});case`NULL`:return Z.Dr();default:return Z.vr()}}},Qd=class{constructor(e){this.expr=e}evaluate(e,t){let n=!1,r=!1;for(let i of this.expr.params){let a=Q(i).evaluate(e,t);switch(a.type){case`BOOLEAN`:if(a.value?.booleanValue)return Z.newValue(io);break;case`NULL`:r=!0;break;default:n=!0}}return n?Z.vr():r?Z.Dr():Z.newValue(ao)}},$d=class e{constructor(e){this.expr=e}evaluate(t,n){let r=!1,i=!1;for(let a of this.expr.params){let o=Q(a).evaluate(t,n);switch(o.type){case`BOOLEAN`:r=e.xor(r,!!o.value?.booleanValue);break;case`NULL`:i=!0;break;default:return Z.vr()}}return i?Z.Dr():Z.newValue({booleanValue:r})}static xor(e,t){return(e||t)&&!(e&&t)}},ef=class{constructor(e){this.expr=e}evaluate(e,t){V(this.expr.params.length===2,55094);let n=!1,r=Q(this.expr.params[0]).evaluate(e,t);switch(r.type){case`NULL`:n=!0;break;case`ERROR`:case`UNSET`:return Z.vr()}let i=Q(this.expr.params[1]).evaluate(e,t);switch(i.type){case`ARRAY`:break;case`NULL`:n=!0;break;default:return Z.vr()}if(n)return Z.Dr();for(let e of i.value?.arrayValue?.values??[])switch(xo(r.value)&&xo(e)?`EQ`:Wd(r.value,e)){case`EQ`:return Z.newValue(io);case`NOT_EQ`:case`TYPE_MISMATCH`:break;case`NULL`:n=!0;break;default:Ci(44608,{value:r.value,candidate:e})}return n?Z.Dr():Z.newValue(ao)}},tf=class{constructor(e){this.expr=e}evaluate(e,t){return new Zd(new X(`not`,[new X(`equal_any`,this.expr.params)])).evaluate(e,t)}},nf=class{constructor(e){this.expr=e}evaluate(e,t){V(this.expr.params.length===1,23322);let n=Q(this.expr.params[0]).evaluate(e,t);switch(n.type){case`INT`:return Z.newValue(ao);case`DOUBLE`:return Z.newValue({booleanValue:isNaN(zd(n.value))});case`NULL`:return Z.Dr();default:return Z.vr()}}},rf=class{constructor(e){this.expr=e}evaluate(e,t){return V(this.expr.params.length===1,50406),new Zd(new X(`not`,[new X(`is_nan`,this.expr.params)])).evaluate(e,t)}},af=class{constructor(e){this.expr=e}evaluate(e,t){switch(V(this.expr.params.length===1,23123),Q(this.expr.params[0]).evaluate(e,t).type){case`NULL`:return Z.newValue(io);case`UNSET`:case`ERROR`:return Z.vr();default:return Z.newValue(ao)}}},of=class{constructor(e){this.expr=e}evaluate(e,t){return V(this.expr.params.length===1,23167),new Zd(new X(`not`,[new X(`is_null`,this.expr.params)])).evaluate(e,t)}},sf=class{constructor(e){this.expr=e}evaluate(e,t){return V(this.expr.params.length===1,5228),Q(this.expr.params[0]).evaluate(e,t).type===`ERROR`?Z.newValue(io):Z.newValue(ao)}},cf=class{constructor(e){this.expr=e}evaluate(e,t){switch(V(this.expr.params.length===1,6877),Q(this.expr.params[0]).evaluate(e,t).type){case`ERROR`:return Z.vr();case`UNSET`:return Z.newValue(ao);default:return Z.newValue(io)}}},lf=class{constructor(e){this.expr=e}evaluate(e,t){V(this.expr.params.length===3,11706);let n=Q(this.expr.params[0]).evaluate(e,t);switch(n.type){case`BOOLEAN`:return n.value?.booleanValue?Q(this.expr.params[1]).evaluate(e,t):Q(this.expr.params[2]).evaluate(e,t);case`NULL`:return Q(this.expr.params[2]).evaluate(e,t);default:return Z.vr()}}},uf=class{constructor(e){this.expr=e}evaluate(e,t){let n=this.expr.params.map((n=>Q(n).evaluate(e,t))),r;for(let e of n)switch(e.type){case`ERROR`:case`UNSET`:case`NULL`:continue;default:r=r===void 0||lo(e.value,r.value)>0?e:r}return r===void 0?Z.Dr():r}},df=class{constructor(e){this.expr=e}evaluate(e,t){let n=this.expr.params.map((n=>Q(n).evaluate(e,t))),r;for(let e of n)switch(e.type){case`ERROR`:case`UNSET`:case`NULL`:continue;default:r=r===void 0||lo(e.value,r.value)<0?e:r}return r===void 0?Z.Dr():r}},ff=class{constructor(e){this.expr=e}evaluate(e,t){V(this.expr.params.length===2,31033,`${this.expr.name}() function should have exactly 2 params`);let n=Q(this.expr.params[0]).evaluate(e,t);switch(n.type){case`ERROR`:case`UNSET`:return Z.vr()}let r=Q(this.expr.params[1]).evaluate(e,t);switch(r.type){case`ERROR`:case`UNSET`:return Z.vr()}return this.Ur(n,r)}},pf=class extends ff{constructor(e){super(e),this.expr=e}Ur(e,t){if(e.Fr()&&t.Fr())return Z.newValue(io);if(e.Fr()||t.Fr()||So(e.value)||So(t.value)||oo(e.value)!==oo(t.value))return Z.newValue(ao);switch(Wd(e.value,t.value)){case`EQ`:return Z.newValue(io);case`NOT_EQ`:return Z.newValue(ao);case`NULL`:return Z.Dr();default:Ci(44615,{left:e,right:t})}}},mf=class extends ff{constructor(e){super(e),this.expr=e}Ur(e,t){switch(Wd(e.value,t.value)){case`EQ`:return Z.newValue(ao);case`NOT_EQ`:case`TYPE_MISMATCH`:return Z.newValue(io);case`NULL`:return Z.Dr();default:Ci(44614,{left:e,right:t})}}},hf=class extends ff{constructor(e){super(e),this.expr=e}Ur(e,t){return oo(e.value)!==oo(t.value)||So(e.value)||So(t.value)?Z.newValue(ao):Z.newValue({booleanValue:lo(e.value,t.value)<0})}},gf=class extends ff{constructor(e){super(e),this.expr=e}Ur(e,t){return oo(e.value)!==oo(t.value)||So(e.value)||So(t.value)?Z.newValue(ao):Wd(e.value,t.value)===`EQ`?Z.newValue(io):Z.newValue({booleanValue:lo(e.value,t.value)<0})}},_f=class extends ff{constructor(e){super(e),this.expr=e}Ur(e,t){return oo(e.value)!==oo(t.value)||So(e.value)||So(t.value)?Z.newValue(ao):Z.newValue({booleanValue:lo(e.value,t.value)>0})}},vf=class extends ff{constructor(e){super(e),this.expr=e}Ur(e,t){return oo(e.value)!==oo(t.value)||So(e.value)||So(t.value)?Z.newValue(ao):Wd(e.value,t.value)===`EQ`?Z.newValue(io):Z.newValue({booleanValue:lo(e.value,t.value)>0})}},yf=class{constructor(e){this.expr=e}evaluate(e,t){throw Error(`Unimplemented`)}},bf=class{constructor(e){this.expr=e}evaluate(e,t){V(this.expr.params.length===1,216);let n=Q(this.expr.params[0]).evaluate(e,t);switch(n.type){case`NULL`:return Z.Dr();case`ARRAY`:{let e=n.value.arrayValue?.values??[];return Z.newValue({arrayValue:{values:[...e].reverse()}})}default:return Z.vr()}}},xf=class{constructor(e){this.expr=e}evaluate(e,t){return V(this.expr.params.length===2,52884),new ef(ne
784w X(`eq_any`,[this.expr.params[1],this.expr.params[0]])).evaluate(e,t)}},Sf=class{constructor(e){this.expr=e}evaluate(e,t){V(this.expr.params.length===2,1392);let n=!1,r=Q(this.expr.params[0]).evaluate(e,t);switch(r.type){case`ARRAY`:break;case`NULL`:n=!0;break;default:return Z.vr()}let i=Q(this.expr.params[1]).evaluate(e,t);switch(i.type){case`ARRAY`:break;case`NULL`:n=!0;break;default:return Z.vr()}if(n)return Z.Dr();let a=i.value?.arrayValue?.values??[],o=r.value?.arrayValue?.values??[];for(let e of a){let t=!1;n=!1;for(let r of o){switch(xo(e)&&xo(r)?`EQ`:Wd(e,r)){case`EQ`:t=!0;break;case`NOT_EQ`:case`TYPE_MISMATCH`:break;case`NULL`:n=!0;break;default:Ci(44613,{value:r,search:e})}if(t)break}if(!t)return Z.newValue(ao)}return Z.newValue(io)}},Cf=class{constructor(e){this.expr=e}evaluate(e,t){V(this.expr.params.length===2,2680);let n=!1,r=Q(this.expr.params[0]).evaluate(e,t);switch(r.type){case`ARRAY`:break;case`NULL`:n=!0;break;default:return Z.vr()}let i=Q(this.expr.params[1]).evaluate(e,t);switch(i.type){case`ARRAY`:break;case`NULL`:n=!0;break;default:return Z.vr()}if(n)return Z.Dr();let a=i.value?.arrayValue?.values??[],o=r.value?.arrayValue?.values??[];for(let e of o)for(let t of a)switch(xo(e)&&xo(t)?`EQ`:Wd(e,t)){case`EQ`:return Z.newValue(io);case`NOT_EQ`:case`TYPE_MISMATCH`:break;case`NULL`:n=!0;break;default:Ci(44608,{value:e,search:t})}return n?Z.Dr():Z.newValue(ao)}},wf=class{constructor(e){this.expr=e}evaluate(e,t){V(this.expr.params.length===1,38605);let n=Q(this.expr.params[0]).evaluate(e,t);switch(n.type){case`NULL`:return Z.Dr();case`ARRAY`:return Z.newValue({integerValue:`${n.value?.arrayValue?.values?.length??0}`});default:return Z.vr()}}},Tf=class{constructor(e){this.expr=e}evaluate(e,t){throw Error(`Unimplemented`)}},Ef=class{constructor(e){this.expr=e}evaluate(e,t){V(this.expr.params.length===1,1508);let n=Q(this.expr.params[0]).evaluate(e,t);switch(n.type){case`NULL`:return Z.Dr();case`BYTES`:{let e=n.value?.bytesValue;if(typeof e==`string`){let t=Ra.fromBase64String(e).toUint8Array();return t.reverse(),Z.newValue({bytesValue:Ra.fromUint8Array(t).toBase64()})}return Z.newValue({bytesValue:new Uint8Array(e).reverse()})}case`STRING`:{let e=n.value?.stringValue,t=new Intl.__PRIVATE_Segmenter(void 0,{granularity:`grapheme`}).segment(e),r=Array.from(t,(e=>e.segment)).reverse();return Z.newValue({stringValue:r.join(``)})}default:return Z.vr()}}},Df=class{constructor(e){this.expr=e}evaluate(e,t){throw Error(`Unimplemented`)}},Of=class{constructor(e){this.expr=e}evaluate(e,t){throw Error(`Unimplemented`)}},kf=class{constructor(e){this.expr=e}evaluate(e,t){V(this.expr.params.length===1,19400);let n=Q(this.expr.params[0]).evaluate(e,t);switch(n.type){case`NULL`:return Z.Dr();case`STRING`:{let e=function(e){let t=0;for(let n=0;n<e.length;n++){let r=e.codePointAt(n);if(r===void 0)return;if(r<=65535)if(r>=55296&&r<=57343)if(r<=56319){let r=e.codePointAt(n+1);r!==void 0&&r>=56320&&r<=57343?(t+=1,n++):t+=1}else t+=1;else t+=1;else{if(!(r<=1114111))return;t+=1,n++}}return t}(n.value.stringValue);return e===void 0?Z.vr():Z.newValue({integerValue:e})}default:return Z.vr()}}},Af=class{constructor(e){this.expr=e}evaluate(e,t){V(this.expr.params.length===1,8486);let n=Q(this.expr.params[0]).evaluate(e,t);switch(n.type){case`BYTES`:{let e=n.value?.bytesValue;return typeof e==`string`?Z.newValue({integerValue:Ra.fromBase64String(e).toUint8Array().length}):Z.newValue({integerValue:new Uint8Array(e).length})}case`STRING`:{let e=function(e){let t=0;for(let n=0;n<e.length;n++){let r=e.codePointAt(n);if(r===void 0)return;if(r>=55296&&r<=57343){if(!(r<=56319))return;{let r=e.codePointAt(n+1);if(r===void 0||!(r>=56320&&r<=57343))return;t+=4,n++}}else if(r<=127)t+=1;else if(r<=2047)t+=2;else if(r<=65535)t+=3;else{if(!(r<=1114111))return;t+=4,n++}}return t}(n.value?.stringValue);return e===void 0?Z.vr():Z.newValue({integerValue:e})}case`NULL`:return Z.Dr();default:return Z.vr()}}},jf=class{constructor(e){this.expr=e}evaluate(e,t){V(this.expr.params.length===2,39773,`${this.expr.name}() function should have exactly two parameters`);let n=!1,r=Q(this.expr.params[0]).evaluate(e,t);switch(r.type){case`STRING`:break;case`NULL`:n=!0;break;default:return Z.vr()}let i=Q(this.expr.params[1]).evaluate(e,t);switch(i.type){case`STRING`:break;case`NULL`:n=!0;break;default:return Z.vr()}return n?Z.Dr():this.kr(r.value?.stringValue,i.value?.stringValue)}},Mf=class extends jf{kr(e,t){try{let n=function(e){let t=``;for(let n=0;n<e.length;n++){let r=e.charAt(n);switch(r){case`_`:t+=`.`;break;case`%`:t+=`.*`;break;case`\\`:case`.`:case`*`:case`?`:case`+`:case`^`:case`$`:case`|`:case`(`:case`)`:case`[`:case`]`:case`{`:case`}`:t+=`\\`+r;break;default:t+=r}}return`^`+t+`$`}(t),r=mi.compile(n);return Z.newValue({booleanValue:r.matches(e)})}catch(e){return xi(`Invalid LIKE pattern converted to regex: ${t}, returning error. Error: ${e}`),Z.vr()}}},Nf=class extends jf{kr(e,t){try{let n=mi.compile(t);return Z.newValue({booleanValue:n.matcher(e).find()})}catch{return xi(`Invalid regex pattern found in regex_contains: ${t}, returning error`),Z.vr()}}},Pf=class extends jf{kr(e,t){try{return Z.newValue({booleanValue:mi.compile(t).matches(e)})}catch{return xi(`Invalid regex pattern found in regex_match: ${t}, returning error`),Z.vr()}}},Ff=class extends jf{kr(e,t){return Z.newValue({booleanValue:e.includes(t)})}},If=class extends jf{kr(e,t){return Z.newValue({booleanValue:e.startsWith(t)})}},Lf=class extends jf{kr(e,t){return Z.newValue({booleanValue:e.endsWith(t)})}},Rf=class{constructor(e){this.expr=e}evaluate(e,t){V(this.expr.params.length===1,29079);let n=Q(this.expr.params[0]).evaluate(e,t);switch(n.type){case`STRING`:return Z.newValue({stringValue:n.value?.stringValue?.toLowerCase()});case`NULL`:return Z.Dr();default:return Z.vr()}}},zf=class{constructor(e){this.expr=e}evaluate(e,t){V(this.expr.params.length===1,60487);let n=Q(this.expr.params[0]).evaluate(e,t);switch(n.type){case`STRING`:return Z.newValue({stringValue:n.value?.stringValue?.toUpperCase()});case`NULL`:return Z.Dr();default:return Z.vr()}}},Bf=class{constructor(e){this.expr=e}evaluate(e,t){V(this.expr.params.length===1,28544);let n=Q(this.expr.params[0]).evaluate(e,t);switch(n.type){case`STRING`:return Z.newValue({stringValue:n.value?.stringValue?.trim()});case`NULL`:return Z.Dr();default:return Z.vr()}}},Vf=class{constructor(e){this.expr=e}evaluate(e,t){let n=this.expr.params.map((n=>Q(n).evaluate(e,t))),r=``,i=!1;for(let e of n)switch(e.type){case`STRING`:r+=e.value.stringValue;break;case`NULL`:i=!0;break;default:return Z.vr()}return i?Z.Dr():Z.newValue({stringValue:r})}},Hf=class{constructor(e){this.expr=e}evaluate(e,t){V(this.expr.params.length===2,4483);let n=Q(this.expr.params[0]).evaluate(e,t);switch(n.type){case`UNSET`:return Z.Sr();case`MAP`:break;default:return Z.vr()}let r=Q(this.expr.params[1]).evaluate(e,t);if(r.type!==`STRING`)return Z.vr();let i=n.value?.mapValue?.fields?.[r.value?.stringValue];return i===void 0?Z.Sr():Z.newValue(i)}},Uf=class{constructor(e){this.expr=e}evaluate(e,t){V(this.expr.params.length===2,25231,`${this.expr.name}() function should have exactly 2 params`);let n=!1,r=Q(this.expr.params[0]).evaluate(e,t);switch(r.type){case`VECTOR`:break;case`NULL`:n=!0;break;default:return Z.vr()}let i=Q(this.expr.params[1]).evaluate(e,t);switch(i.type){case`VECTOR`:break;case`NULL`:n=!0;break;default:return Z.vr()}if(n)return Z.Dr();let a=To(r.value),o=To(i.value);if(a===void 0||o===void 0||a.values?.length!==o.values?.length)return Z.vr();let s=this.qr(a,o);return s===void 0||isNaN(s)?Z.vr():Z.newValue({doubleValue:s})}},Wf=class extends Uf{qr(e,t){let n=e?.values??[],r=t?.values??[];if(n.length===0)return;let i=0,a=0,o=0;for(let e=0;e<n.length;e++){if(!yo(n[e])||!yo(r[e]))return;let t=zd(n[e]),s=zd(r[e]);i+=t*s,a+=t*t,o+=s*s}let s=Math.sqrt(a)*Math.sqrt(o);if(s!==0)return 1-Math.max(-1,Math.min(1,i/s))}},Gf=class extends Uf{qr(e,t){let n=e?.values??[],r=t?.values??[];if(n.length===0)return 0;let i=0;for(let e=0;e<n.length;e++){if(!yo(n[e])||!yo(r[e]))return;i+=zd(n[e])*zd(r[e])}return i}},Kf=class extends Uf{qr(e,t){let n=e?.values??[],r=t?.values??[];if(n.length===0)return 0;let i=0;for(let e=0;e<n.length;e++){if(!yo(n[e])||!yo(r[e]))return;let t=zd(n[e]),a=zd(r[e]);i+=(t-a)**2}return Math.sqrt(i)}},qf=class{constructor(e){this.expr=e}evaluate(e,t){V(this.expr.params.length===1,39044);let n=Q(this.expr.params[0]).evaluate(e,t);switch(n.type){case`VECTOR`:{let e=To(n.value);return Z.newValue({integerValue:e?.values?.length??0})}case`NULL`:return Z.Dr();default:return Z.vr()}}},Jf=BigInt(-62135596800),Yf=BigInt(253402300799),Xf=BigInt(1e3),Zf=BigInt(1e6),Qf=Jf*Xf,$f=Yf*Xf+BigInt(999),ep=Jf*Zf,tp=Yf*Zf+BigInt(999999);function np(e){return e>=ep&&e<=tp}function rp(e){return e>=Jf&&e<=Yf}function ip(e,t){let n=BigInt(e);return!(n<Jf||n>Yf)&&!(t<0||t>=1e9)&&(n!==Jf||t===0)&&!(n===Yf&&t>999999999)}function ap(e,t){return t<0?{seconds:e-1,nanos:t+1e9}:{seconds:e,nanos:t}}function op(e){return BigInt(e.seconds)*Zf+BigInt(Math.trunc(e.nanoseconds/1e3))}var sp=class{constructor(e){this.expr=e}evaluate(e,t){V(this.expr.params.length===1,49262,`${this.expr.name}() function should have exactly one parameter`);let n=Q(this.expr.params[0]).evaluate(e,t);switch(n.type){case`INT`:return this.toTimestamp(BigInt(n.value.integerValue));case`NULL`:return Z.Dr();default:return Z.vr()}}},cp=class extends sp{toTimestamp(e){if(!np(e))return Z.vr();let t=Number(e/Zf),n=Number(e%Zf*BigInt(1e3)),r=ap(t,n);return t=r.seconds,n=r.nanos,ip(t,n)?Z.newValue({timestampValue:{seconds:t,nanos:n}}):Z.vr()}},lp=class extends sp{toTimestamp(e){if(!function(e){return e>=Qf&&e<=$f}(e))return Z.vr();let t=Number(e/Xf),n=Number(e%Xf*BigInt(1e6)),r=ap(t,n);return t=r.seconds,n=r.nanos,ip(t,n)?Z.newValue({timestampValue:{seconds:t,nanos:n}}):Z.vr()}},up=class extends sp{toTimestamp(e){if(!rp(e))return Z.vr();let t=Number(e);return Z.newValue({timestampValue:{seconds:t,nanos:0}})}},dp=class{constructor(e){this.expr=e}evaluate(e,t){V(this.expr.params.length===1,1265,`${this.expr.name}() function should have exactly one parameter`);let n=Q(this.expr.params[0]).evaluate(e,t);switch(n.type){case`TIMESTAMP`:break;case`NULL`:return Z.Dr();default:return Z.vr()}let r=Kc(n.value.timestampValue);return ip(r.seconds,r.nanoseconds)?this.$r(r):Z.vr()}},fp=class extends dp{$r(e){let t=op(e);return np(t)?Z.newValue({integerValue:`${t.toString()}`}):Z.vr()}}
784,pp=class extends dp{$r(e){let t=op(e),n=t/BigInt(1e3),r=t%BigInt(1e3);return n>BigInt(0)||r===BigInt(0)?Z.newValue({integerValue:n.toString()}):Z.newValue({integerValue:(n-BigInt(1)).toString()})}},mp=class extends dp{$r(e){let t=BigInt(e.seconds);return rp(t)?Z.newValue({integerValue:t.toString()}):Z.vr()}},hp=class{constructor(e){this.expr=e}evaluate(e,t){V(this.expr.params.length===3,2775,`${this.expr.name}() function should have exactly 3 parameters`);let n=!1,r=Q(this.expr.params[0]).evaluate(e,t);switch(r.type){case`TIMESTAMP`:break;case`NULL`:n=!0;break;default:return Z.vr()}let i=Q(this.expr.params[1]).evaluate(e,t),a;switch(i.type){case`STRING`:if(a=function(e){switch(e){case`microsecond`:return`microsecond`;case`millisecond`:return`millisecond`;case`second`:return`second`;case`minute`:return`minute`;case`hour`:return`hour`;case`day`:return`day`;default:return}}(i.value.stringValue),a===void 0)return Z.vr();break;case`NULL`:n=!0;break;default:return Z.vr()}let o=Q(this.expr.params[2]).evaluate(e,t);switch(o.type){case`INT`:break;case`NULL`:n=!0;break;default:return Z.vr()}if(n)return Z.Dr();let s=BigInt(o.value.integerValue),c;try{switch(a){case`microsecond`:c=s;break;case`millisecond`:c=s*BigInt(1e3);break;case`second`:c=s*BigInt(1e6);break;case`minute`:c=s*BigInt(6e7);break;case`hour`:c=s*BigInt(36e8);break;case`day`:c=s*BigInt(864e8);break;default:return Z.vr()}if(a!==`microsecond`&&s!==BigInt(0)&&c/s!==BigInt(this.Kr(a)))return Z.vr()}catch(e){return xi(`Error during timestamp arithmetic: ${e}`),Z.vr()}let l=Kc(r.value.timestampValue);if(!ip(l.seconds,l.nanoseconds))return Z.vr();let u=op(l),d=this.Wr(u,c);if(!np(d))return Z.vr();let f=Number(d/Zf),p=d%Zf,m=Number((p<0?p+Zf:p)*BigInt(1e3)),h=p<0?f-1:f;return ip(h,m)?Z.newValue({timestampValue:{seconds:h,nanos:m}}):Z.vr()}Kr(e){switch(e){case`millisecond`:return 1e3;case`second`:return 1e6;case`minute`:return 6e7;case`hour`:return 36e8;case`day`:return 864e8;default:return 1}}},gp=class extends hp{Wr(e,t){return e+t}},_p=class extends hp{Wr(e,t){return e-t}};function vp(e){if((e=Fd(e))instanceof Qu)return`fld(${e.fieldName})`;if(e instanceof td)return`cst(${function(e){return e===null?`null`:typeof e==`number`?e.toString():typeof e==`string`?`"${e}"`:e instanceof yu?`ref(${e.path})`:e instanceof Cu?`vec(${JSON.stringify(e)})`:JSON.stringify(e)}(e.value)})`;if(e instanceof X)return`fn(${e.name},[${e.params.map(vp).join(`,`)}])`;if(e.expressionType===`ListOfExpressions`)return`list([${e.Rr.map(vp).join(`,`)}])`;throw Error(`Unrecognized expr ${JSON.stringify(e,null,2)}`)}function yp(e){if(e instanceof md)return`${e._name}(${bp(e.fields)})`;if(e instanceof hd){let t=`${e._name}(${bp(e.accumulators)})`;return e.groups.size>0&&(t+=`grouping(${bp(e.groups)})`),t}if(e instanceof gd)return`${e._name}(${bp(e.groups)})`;if(e instanceof _d)return`${e._name}(${e.Vr})`;if(e instanceof vd)return`${e._name}(${e.collectionId})`;if(e instanceof yd)return`${e._name}()`;if(e instanceof bd)return`${e._name}(${e.dr.sort()})`;if(e instanceof xd)return`${e._name}(${vp(e.condition)})`;if(e instanceof Sd)return`${e._name}(${e.limit})`;if(e instanceof Td)return`${e._name}(${function(e){return e.map((e=>`${vp(e.expr)}${e.direction}`)).join(`,`)}(e.orderings)})`;throw Error(`Unrecognized stage ${e._name}`)}function bp(e){return`${Array.from(e.entries()).sort().map((([e,t])=>`${e}=${vp(t)}`)).join(`,`)}`}function xp(e){return e.stages.map((e=>yp(e))).join(`|`)}function Sp(e,t){return xp(e)===xp(t)}function Cp(e){return e instanceof Od}function wp(e){return Cp(e)?xp(e):ec(e)}function Tp(e){return Cp(e)?xp(e):function(e){return`${Ls(Js(e))}|lt:${e.limitType}`}(e)}function Ep(e,t){return e instanceof Od&&t instanceof Od?Sp(e,t):!(e instanceof Od&&!(t instanceof Od)||!(e instanceof Od)&&t instanceof Od)&&$s(e,t)}function Dp(e){return zs(e)?xp(e):Ls(e)}function Op(e,t){return e instanceof Od&&t instanceof Od?Sp(e,t):!(e instanceof Od&&!(t instanceof Od)||!(e instanceof Od)&&t instanceof Od)&&Rs(e,t)}var kp=class{constructor(e,t,n,r){this.batchId=e,this.localWriteTime=t,this.baseMutations=n,this.mutations=r}applyToRemoteDocument(e,t){let n=t.mutationResults;for(let t=0;t<this.mutations.length;t++){let r=this.mutations[t];r.key.isEqual(e.key)&&ts(r,e,n[t])}}applyToLocalView(e,t){for(let n of this.baseMutations)n.key.isEqual(e.key)&&
784(t=ns(n,e,t,this.localWriteTime));for(let n of this.mutations)n.key.isEqual(e.key)&&(t=ns(n,e,t,this.localWriteTime));return t}applyToLocalDocumentSet(e,t){let n=gc();return this.mutations.forEach((r=>{let i=e.get(r.key),a=i.overlayedDocument,o=this.applyToLocalView(a,i.mutatedFields);o=t.has(r.key)?null:o;let s=es(a,o);s!==null&&n.set(r.key,s),a.isValidDocument()||a.convertToNoDocument(oa.min())})),n}keys(){return this.mutations.reduce(((e,t)=>e.add(t.key)),bc())}isEqual(e){return this.batchId===e.batchId&&Hi(this.mutations,e.mutations,((e,t)=>is(e,t)))&&Hi(this.baseMutations,e.baseMutations,((e,t)=>is(e,t)))}},Ap=class e{constructor(e,t,n,r){this.batch=e,this.commitVersion=t,this.mutationResults=n,this.docVersions=r}static from(t,n,r){V(t.mutations.length===r.length,58842,{Qr:t.mutations.length,Gr:r.length});let i=function(){return vc}(),a=t.mutations;for(let e=0;e<a.length;e++)i=i.insert(a[e].key,r[e].version);return new e(t,n,r,i)}},jp=class{constructor(e,t){this.largestBatchId=e,this.mutation=t}getKey(){return this.mutation.key}isEqual(e){return e!==null&&this.mutation===e.mutation}toString(){return`Overlay{\n      largestBatchId: ${this.largestBatchId},\n      mutation: ${this.mutation.toString()}\n    }`}},Mp=class e{constructor(e,t,n,r,i=oa.min(),a=oa.min(),o=Ra.EMPTY_BYTE_STRING,s=null){this.target=e,this.targetId=t,this.purpose=n,this.sequenceNumber=r,this.snapshotVersion=i,this.lastLimboFreeSnapshotVersion=a,this.resumeToken=o,this.expectedCount=s}withSequenceNumber(t){return new e(this.target,this.targetId,this.purpose,t,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(t,n){return new e(this.target,this.targetId,this.purpose,this.sequenceNumber,n,this.lastLimboFreeSnapshotVersion,t,null)}withExpectedCount(t){return new e(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,t)}withLastLimboFreeSnapshotVersion(t){return new e(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,t,this.resumeToken,this.expectedCount)}},Np=class{constructor(e){this.zr=e}};function Pp(e){let t=dl({parent:e.parent,structuredQuery:e.structuredQuery});return e.limitType===`LAST`?Qs(t,t.limit,`L`):t}var Fp=class{constructor(){}Yr(e,t){this.Zr(e,t),t.Xr()}Zr(e,t){if(`nullValue`in e)this.ei(t,5);else if(`booleanValue`in e)this.ei(t,10),t.ti(+!!e.booleanValue);else if(`integerValue`in e)this.ei(t,15),t.ti(Va(e.integerValue));else if(`doubleValue`in e){let n=Va(e.doubleValue);
784isNaN(n)?this.ei(t,13):(this.ei(t,15),ba(n)?t.ti(0):t.ti(n))}else if(`timestampValue`in e){let n=e.timestampValue;this.ei(t,20),typeof n==`string`&&(n=Ba(n)),t.ni(`${n.seconds||``}`),t.ti(n.nanos||0)}else if(`stringValue`in e)this.ri(e.stringValue,t),this.ii(t);else if(`bytesValue`in e)this.ei(t,30),t.si(Ha(e.bytesValue)),this.ii(t);else if(`referenceValue`in e)this._i(e.referenceValue,t);else if(`geoPointValue`in e){let n=e.geoPointValue;this.ei(t,45),t.ti(n.latitude||0),t.ti(n.longitude||0)}else`mapValue`in e?Do(e)?this.ei(t,2**53-1):wo(e)?this.oi(e.mapValue,t):(this.ai(e.mapValue,t),this.ii(t)):`arrayValue`in e?(this.ui(e.arrayValue,t),this.ii(t)):Ci(19022,{ci:e})}ri(e,t){this.ei(t,25),this.li(e,t)}li(e,t){t.ni(e)}ai(e,t){let n=e.fields||{};this.ei(t,55);for(let e of Object.keys(n))this.ri(e,t),this.Zr(n[e],t)}oi(e,t){let n=e.fields||{};this.ei(t,53);let r=no,i=n[r].arrayValue?.values?.length||0;this.ei(t,15),t.ti(Va(i)),this.ri(r,t),this.Zr(n[r],t)}ui(e,t){let n=e.values||[];this.ei(t,50);for(let e of n)this.Zr(e,t)}_i(e,t){this.ei(t,37),W.fromName(e).path.forEach((e=>{this.ei(t,60),this.li(e,t)}))}ei(e,t){e.ti(t)}ii(e){e.ti(2)}};Fp.Ei=new Fp;var Ip=class{constructor(){this.Hi=new Lp}addToCollectionParentIndex(e,t){return this.Hi.add(t),G.resolve()}getCollectionParents(e,t){return G.resolve(this.Hi.getEntries(t))}addFieldIndex(e,t){return G.resolve()}deleteFieldIndex(e,t){return G.resolve()}deleteAllFieldIndexes(e){return G.resolve()}createTargetIndexes(e,t){return G.resolve()}getDocumentsMatchingTarget(e,t){return G.resolve(null)}getIndexType(e,t){return G.resolve(0)}getFieldIndexes(e,t){return G.resolve([])}getNextCollectionGroupToUpdate(e){return G.resolve(null)}getMinOffset(e,t){return G.resolve(da.min())}getMinOffsetFromCollectionGroup(e,t){return G.resolve(da.min())}updateCollectionGroup(e,t,n){return G.resolve()}updateIndexEntries(e,t){return G.resolve()}},Lp=class{constructor(){this.index={}}add(e){let t=e.lastSegment(),n=e.popLast(),r=this.index[t]||new Aa(Gi.comparator),i=!r.has(n);return this.index[t]=r.add(n),i}has(e){let t=e.lastSegment(),n=e.popLast(),r=this.index[t];return r&&r.has(n)}getEntries(e){return(this.index[e]||new Aa(Gi.comparator)).toArray()}},Rp=class e{constructor(e){this.Ds=e}next(){return this.Ds+=2,this.Ds}static xs(){return new e(0)}static Cs(){return new e(-1)}};function zp(e,t){let n=t;for(let t of e.stages)n=Hp({serializer:e.serializer,serverTimestampBehavior:e.listenOptions?.serverTimestampBehavior},t,n);return n}function Bp(e,t){return zp(e,[t]).length>0}function Vp(e,t){return Cp(e)?Bp(e,t):tc(e,t)}function Hp(e,t,n){if(t instanceof _d)return function(e,t,n){return n.filter((e=>e.isFoundDocument()&&`/${e.key.getCollectionPath().canonicalString()}`===t.Vr))}(0,t,n);if(t instanceof xd)return function(e,t,n){return n.filter((n=>{let r=Pd(Q(t.condition).evaluate(e,n));return r!==void 0&&so(r,io)}))}(e,t,n);if(t instanceof vd)return function(e,t,n){return n.filter((e=>e.isFoundDocument()&&e.key.getCollectionPath().lastSegment()===t.collectionId))}(0,t,n);if(t instanceof yd)return function(e,t,n){return n.filter((e=>e.isFoundDocument()))}(0,0,n);if(t instanceof bd)return function(e,t,n){return n.filter((e=>e.isFoundDocument()&&t.mr.has(e.key.path.toStringWithLeadingSlash())))}(0,t,n);if(t instanceof Sd)return function(e,t,n){return n.slice(0,t.limit)}(0,t,n);if(t instanceof Td)return function(e,t,n){let r=t.orderings.map((e=>({ks:Q(e.expr),direction:e.direction})));return[...n].sort(((t,n)=>{for(let{ks:i,direction:a}of r){let r=Pd(i.evaluate(e,t)),o=Pd(i.evaluate(e,n)),s=lo(r??ro,o??ro);if(s!==0)return a===`ascending`?s:-s}return 0}))}(e,t,n);throw Error(`Unknown stage: ${t._name}`)}function Up(e){let t=function(e){for(let t=e.stages.length-1;t>=0;t--){let n=e.stages[t];if(n instanceof Td)return n.orderings}throw Error(`Pipeline must contain at least one Sort stage`)}(e);return(n,r)=>{for(let i of t){let t=Pd(Q(i.expr).evaluate({serializer:e.serializer},n)),a=Pd(Q(i.expr).evaluate({serializer:e.serializer},r)),o=lo(t||ro,a||ro);if(o!==0)return i.direction===`ascending`?o:-o}return 0}}function Wp(e){for(let t=e.stages.length-1;t>=0;t--){let n=e.stages[t];if(n instanceof Sd)return{limit:n.limit}}}var Gp=class{constructor(){this.changes=new lc((e=>e.toString()),((e,t)=>e.isEqual(t))),this.changesApplied=!1}addEntry(e){this.assertNotApplied(),this.changes.set(e.key,e)}removeEntry(e,t){this.assertNotApplied(),this.changes.set(e,Ps.newInvalidDocument(e).setReadTime(t))}getEntry(e,t){this.assertNotApplied();let n=this.changes.get(t);return n===void 0?this.getFromCache(e,t):G.resolve(n)}getEntries(e,t){return this.getAllFromCache(e,t)}apply(e){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(e)}
784assertNotApplied(){}},Kp=class{constructor(e,t){this.overlayedDocument=e,this.mutatedFields=t}},qp=class{constructor(e,t,n,r){this.remoteDocumentCache=e,this.mutationQueue=t,this.documentOverlayCache=n,this.indexManager=r}getDocument(e,t){let n=null;return this.documentOverlayCache.getOverlay(e,t).next((r=>(n=r,this.remoteDocumentCache.getEntry(e,t)))).next((e=>(n!==null&&ns(n.mutation,e,Ma.empty(),aa.now()),e)))}getDocuments(e,t){return this.remoteDocumentCache.getEntries(e,t).next((t=>this.getLocalViewOfDocuments(e,t,bc()).next((()=>t))))}getLocalViewOfDocuments(e,t,n=bc()){let r=hc();return this.populateOverlays(e,r,t).next((()=>this.computeViews(e,t,r,n).next((e=>{let t=pc();return e.forEach(((e,n)=>{t=t.insert(e,n.overlayedDocument)})),t}))))}getOverlayedDocuments(e,t){let n=hc();return this.populateOverlays(e,n,t).next((()=>this.computeViews(e,t,n,bc())))}populateOverlays(e,t,n){let r=[];return n.forEach((e=>{t.has(e)||r.push(e)})),this.documentOverlayCache.getOverlays(e,r).next((e=>{e.forEach(((e,n)=>{t.set(e,n)}))}))}computeViews(e,t,n,r){let i=dc(),a=_c(),o=function(){return _c()}();return t.forEach(((e,t)=>{let o=n.get(t.key);r.has(t.key)&&(o===void 0||o.mutation instanceof os)?i=i.insert(t.key,t):o===void 0?a.set(t.key,Ma.empty()):(a.set(t.key,o.mutation.getFieldMask()),ns(o.mutation,t,o.mutation.getFieldMask(),aa.now()))})),this.recalculateAndSaveOverlays(e,i).next((e=>(e.forEach(((e,t)=>a.set(e,t))),t.forEach(((e,t)=>o.set(e,new Kp(t,a.get(e)??null)))),o)))}recalculateAndSaveOverlays(e,t){let n=_c(),r=new Da(((e,t)=>e-t)),i=bc();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,t).next((e=>{for(let i of e)i.keys().forEach((e=>{let a=t.get(e);if(a===null)return;let o=n.get(e)||Ma.empty();o=i.applyToLocalView(a,o),n.set(e,o);let s=(r.get(i.batchId)||bc()).add(e);r=r.insert(i.batchId,s)}))})).next((()=>{let a=[],o=r.getReverseIterator();for(;o.hasNext();){let r=o.getNext(),s=r.key,c=r.value,l=gc();c.forEach((e=>{if(!i.has(e)){let r=es(t.get(e),n.get(e));r!==null&&l.set(e,r),i=i.add(e)}})),a.push(this.documentOverlayCache.saveOverlays(e,s,l))}return G.waitFor(a)})).next((()=>n))}recalculateAndSaveOverlaysForDocumentKeys(e,t){return this.remoteDocumentCache.getEntries(e,t).next((t=>this.recalculateAndSaveOverlays(e,t)))}getDocumentsMatchingQuery(e,t,n,r){return Cp(t)?this.getDocumentsMatchingPipeline(e,t,n,r):Gs(t)?this.getDocumentsMatchingDocumentQuery(e,t.path):Ks(t)?this.getDocumentsMatchingCollectionGroupQuery(e,t,n,r):this.getDocumentsMatchingCollectionQuery(e,t,n,r)}getNextDocuments(e,t,n,r){return this.remoteDocumentCache.getAllFromCollectionGroup(e,t,n,r).next((i=>{let a=r-i.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,t,n.largestBatchId,r-i.size):G.resolve(hc()),o=sa,s=i;return a.next((t=>G.forEach(t,((t,n)=>(o<n.largestBatchId&&(o=n.largestBatchId),i.get(t)?G.resolve():this.remoteDocumentCache.getEntry(e,t).next((e=>{s=s.insert(t,e)}))))).next((()=>this.populateOverlays(e,t,i))).next((()=>this.computeViews(e,s,t,bc()))).next((e=>({batchId:o,changes:mc(e)})))))}))}getDocumentsMatchingDocumentQuery(e,t){return this.getDocument(e,new W(t)).next((e=>{let t=pc();return e.isFoundDocument()&&(t=t.insert(e.key,e)),t}))}getDocumentsMatchingCollectionGroupQuery(e,t,n,r){let i=t.collectionGroup,a=pc();return this.indexManager.getCollectionParents(e,i).next((o=>G.forEach(o,(o=>{let s=function(e,t){return new Vs(t,null,e.explicitOrderBy.slice(),e.filters.slice(),e.limit,e.limitType,e.startAt,e.endAt)}(t,o.child(i));return this.getDocumentsMatchingCollectionQuery(e,s,n,r).next((e=>{e.forEach(((e,t)=>{a=a.insert(e,t)}))}))})).next((()=>a))))}getDocumentsMatchingCollectionQuery(e,t,n,r){let i;return this.documentOverlayCache.getOverlaysForCollection(e,t.path,n.largestBatchId).next((a=>(i=a,this.remoteDocumentCache.getDocumentsMatchingQuery(e,t,n,i,r)))).next((e=>this.retrieveMatchingLocalDocuments(i,e,(e=>tc(t,e)))))}getDocumentsMatchingPipeline(e,t,n,r){if(kd(t)===`collection_group`){let i=jd(t),a=pc();return this.indexManager.getCollectionParents(e,i).next((o=>G.forEach(o,(o=>{let s=function(e,t){let n=e.stages.map((e=>e instanceof vd?new _d(t.canonicalString(),{}):e));return new Od(e.serializer,n)}(t,o.child(i));return this.getDocumentsMatchingPipeline(e,s,n,r).next((e=>{e.forEach(((e,t)=>{a=a.insert(e,t)}))}))})).next((()=>a))))}{let i;return this.getOverlaysForPipeline(e,t,n.largestBatchId).next((a=>{switch(i=a,kd(t)){case`collection`:return this.remoteDocumentCache.getDocumentsMatchingQuery(e,t,n,i,r);case`documents`:let a=bc();for(let e of Nd(t))a=a.add(W.fromPath(e));return this.remoteDocumentCache.getEntries(e,a);case`database`:return this.remoteDocumentCache.getAllEntries(e);
784default:throw new U(`invalid-argument`,`Invalid pipeline source to execute offline: ${xp(t)}`)}})).next((e=>this.retrieveMatchingLocalDocuments(i,e,(e=>Bp(t,e)))))}}retrieveMatchingLocalDocuments(e,t,n){e.forEach(((e,n)=>{let r=n.getKey();t.get(r)===null&&(t=t.insert(r,Ps.newInvalidDocument(r)))}));let r=pc();return t.forEach(((t,i)=>{let a=e.get(t);a!==void 0&&ns(a.mutation,i,Ma.empty(),aa.now()),n(i)&&(r=r.insert(t,i))})),r}getOverlaysForPipeline(e,t,n){switch(kd(t)){case`collection`:return this.documentOverlayCache.getOverlaysForCollection(e,Gi.fromString(Ad(t)),n);case`collection_group`:throw new U(`invalid-argument`,`Unexpected collection group pipeline: ${xp(t)}`);case`documents`:return this.documentOverlayCache.getOverlays(e,Nd(t).map((e=>W.fromPath(e))));case`database`:return this.documentOverlayCache.getAllOverlays(e,n);default:throw new U(`invalid-argument`,`Failed to get overlays for pipeline: ${xp(t)}`)}}},Jp=class{constructor(e){this.serializer=e,this.Hs=new Map,this.Js=new Map}getBundleMetadata(e,t){return G.resolve(this.Hs.get(t))}saveBundleMetadata(e,t){return this.Hs.set(t.id,function(e){return{id:e.id,version:e.version,createTime:Yc(e.createTime)}}(t)),G.resolve()}getNamedQuery(e,t){return G.resolve(this.Js.get(t))}saveNamedQuery(e,t){return this.Js.set(t.name,function(e){return{name:e.name,query:Pp(e.bundledQuery),readTime:Yc(e.readTime)}}(t)),G.resolve()}},Yp=class{constructor(){this.overlays=new Da(W.comparator),this.Ys=new Map}getOverlay(e,t){return G.resolve(this.overlays.get(t))}getOverlays(e,t){let n=hc();return G.forEach(t,(t=>this.getOverlay(e,t).next((e=>{e!==null&&n.set(t,e)})))).next((()=>n))}getAllOverlays(e,t){let n=hc();return this.overlays.forEach(((e,r)=>{r.largestBatchId>t&&n.set(e,r)})),G.resolve(n)}saveOverlays(e,t,n){return n.forEach(((n,r)=>{this.Hr(e,t,r)})),G.resolve()}removeOverlaysForBatchId(e,t,n){let r=this.Ys.get(n);return r!==void 0&&(r.forEach((e=>this.overlays=this.overlays.remove(e))),this.Ys.delete(n)),G.resolve()}getOverlaysForCollection(e,t,n){let r=hc(),i=t.length+1,a=new W(t.child(``)),o=this.overlays.getIteratorFrom(a);for(;o.hasNext();){let e=o.getNext().value,a=e.getKey();if(!t.isPrefixOf(a.path))break;a.path.length===i&&e.largestBatchId>n&&r.set(e.getKey(),e)}return G.resolve(r)}getOverlaysForCollectionGroup(e,t,n,r){let i=new Da(((e,t)=>e-t)),a=this.overlays.getIterator();for(;a.hasNext();){let e=a.getNext().value;if(e.getKey().getCollectionGroup()===t&&e.largestBatchId>n){let t=i.get(e.largestBatchId);t===null&&(t=hc(),i=i.insert(e.largestBatchId,t)),t.set(e.getKey(),e)}}let o=hc(),s=i.getIterator();for(;s.hasNext()&&(s.getNext().value.forEach(((e,t)=>o.set(e,t))),!(o.size()>=r)););return G.resolve(o)}Hr(e,t,n){let r=this.overlays.get(n.key);if(r!==null){let e=this.Ys.get(r.largestBatchId).delete(n.key);this.Ys.set(r.largestBatchId,e)}this.overlays=this.overlays.insert(n.key,new jp(t,n));let i=this.Ys.get(t);i===void 0&&(i=bc(),this.Ys.set(t,i)),this.Ys.set(t,i.add(n.key))}},Xp=class{constructor(){this.sessionToken=Ra.EMPTY_BYTE_STRING}getSessionToken(e){return G.resolve(this.sessionToken)}setSessionToken(e,t){return this.sessionToken=t,G.resolve()}},Zp=class{constructor(){this.Zs=new Aa(Qp.Xs),this.e_=new Aa(Qp.t_)}isEmpty(){return this.Zs.isEmpty()}addReference(e,t){let n=new Qp(e,t);this.Zs=this.Zs.add(n),this.e_=this.e_.add(n)}n_(e,t){e.forEach((e=>this.addReference(e,t)))}removeReference(e,t){this.r_(new Qp(e,t))}i_(e,t){e.forEach((e=>this.removeReference(e,t)))}s_(e){let t=new W(new Gi([])),n=new Qp(t,e),r=new Qp(t,e+1),i=[];return this.e_.forEachInRange([n,r],(e=>{this.r_(e),i.push(e.key)})),i}__(){this.Zs.forEach((e=>this.r_(e)))}r_(e){this.Zs=this.Zs.delete(e),this.e_=this.e_.delete(e)}o_(e){let t=new W(new Gi([])),n=new Qp(t,e),r=new Qp(t,e+1),i=bc();return this.e_.forEachInRange([n,r],(e=>{i=i.add(e.key)})),i}containsKey(e){let t=new Qp(e,0),n=this.Zs.firstAfterOrEqual(t);return n!==null&&e.isEqual(n.key)}},Qp=class{constructor(e,t){this.key=e,this.a_=t}static Xs(e,t){return W.comparator(e.key,t.key)||Li(e.a_,t.a_)}static t_(e,t){return Li(e.a_,t.a_)||W.comparator(e.key,t.key)}},$p=class{constructor(e,t){this.indexManager=e,this.referenceDelegate=t,this.mutation
784Queue=[],this.gs=1,this.u_=new Aa(Qp.Xs)}checkEmpty(e){return G.resolve(this.mutationQueue.length===0)}addMutationBatch(e,t,n,r){let i=this.gs;this.gs++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];let a=new kp(i,t,n,r);this.mutationQueue.push(a);for(let t of r)this.u_=this.u_.add(new Qp(t.key,i)),this.indexManager.addToCollectionParentIndex(e,t.key.path.popLast());return G.resolve(a)}lookupMutationBatch(e,t){return G.resolve(this.c_(t))}getNextMutationBatchAfterBatchId(e,t){let n=t+1,r=this.l_(n),i=r<0?0:r;return G.resolve(this.mutationQueue.length>i?this.mutationQueue[i]:null)}getHighestUnacknowledgedBatchId(){return G.resolve(this.mutationQueue.length===0?K:this.gs-1)}getAllMutationBatches(e){return G.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,t){let n=new Qp(t,0),r=new Qp(t,1/0),i=[];return this.u_.forEachInRange([n,r],(e=>{let t=this.c_(e.a_);i.push(t)})),G.resolve(i)}getAllMutationBatchesAffectingDocumentKeys(e,t){let n=new Aa(Li);return t.forEach((e=>{let t=new Qp(e,0),r=new Qp(e,1/0);this.u_.forEachInRange([t,r],(e=>{n=n.add(e.a_)}))})),G.resolve(this.E_(n))}getAllMutationBatchesAffectingQuery(e,t){let n=t.path,r=n.length+1,i=n;W.isDocumentKey(i)||(i=i.child(``));let a=new Qp(new W(i),0),o=new Aa(Li);return this.u_.forEachWhile((e=>{let t=e.key.path;return!!n.isPrefixOf(t)&&(t.length===r&&(o=o.add(e.a_)),!0)}),a),G.resolve(this.E_(o))}E_(e){let t=[];return e.forEach((e=>{let n=this.c_(e);n!==null&&t.push(n)})),t}removeMutationBatch(e,t){V(this.h_(t.batchId,`removed`)===0,55003),this.mutationQueue.shift();let n=this.u_;return G.forEach(t.mutations,(r=>{let i=new Qp(r.key,t.batchId);return n=n.delete(i),this.referenceDelegate.markPotentiallyOrphaned(e,r.key)})).next((()=>{this.u_=n}))}bs(e){}containsKey(e,t){let n=new Qp(t,0),r=this.u_.firstAfterOrEqual(n);return G.resolve(t.isEqual(r&&r.key))}performConsistencyCheck(e){return this.mutationQueue.length,G.resolve()}h_(e,t){return this.l_(e)}l_(e){return this.mutationQueue.length===0?0:e-this.mutationQueue[0].batchId}c_(e){let t=this.l_(e);return t<0||t>=this.mutationQueue.length?null:this.mutationQueue[t]}},em=class{constructor(e){this.T_=e,this.docs=function(){return new Da(W.comparator)}(),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,t){let n=t.key,r=this.docs.get(n),i=r?r.size:0,a=this.T_(t);return this.docs=this.docs.insert(n,{document:t.mutableCopy(),size:a}),this.size+=a-i,this.indexManager.addToCollectionParentIndex(e,n.path.popLast())}removeEntry(e){let t=this.docs.get(e);t&&(this.docs=this.docs.remove(e),this.size-=t.size)}getEntry(e,t){let n=this.docs.get(t);return G.resolve(n?n.document.mutableCopy():Ps.newInvalidDocument(t))}getEntries(e,t){let n=dc();return t.forEach((e=>{let t=this.docs.get(e);n=n.insert(e,t?t.document.mutableCopy():Ps.newInvalidDocument(e))})),G.resolve(n)}getAllEntries(e){let t=dc();return this.docs.forEach(((e,n)=>{t=t.insert(e,n.document)})),G.resolve(t)}getDocumentsMatchingQuery(e,t,n,r){let i,a;Cp(t)?(i=Gi.fromString(Ad(t)),a=e=>Bp(t,e)):(i=t.path,a=e=>tc(t,e));let o=dc(),s=new W(i.child(`__id-9223372036854775808__`)),c=this.docs.getIteratorFrom(s);for(;c.hasNext();){let{key:e,value:{document:t}}=c.getNext();if(!i.isPrefixOf(e.path))break;e.path.length>i.length+1||fa(ua(t),n)<=0||(r.has(t.key)||a(t))&&(o=o.insert(t.key,t.mutableCopy()))}return G.resolve(o)}getAllFromCollectionGroup(e,t,n,r){Ci(9500)}P_(e,t){return G.forEach(this.docs,(e=>t(e)))}newChangeBuffer(e){return new tm(this)}getSize(e){return G.resolve(this.size)}},tm=class extends Gp{constructor(e){super(),this.zs=e}applyChanges(e){let t=[];
784return this.changes.forEach(((n,r)=>{r.isValidDocument()?t.push(this.zs.addEntry(e,r)):this.zs.removeEntry(n)})),G.waitFor(t)}getFromCache(e,t){return this.zs.getEntry(e,t)}getAllFromCache(e,t){return this.zs.getEntries(e,t)}},nm=class{constructor(e){this.persistence=e,this.R_=new lc((e=>Dp(e)),Op),this.lastRemoteSnapshotVersion=oa.min(),this.highestTargetId=0,this.I_=0,this.A_=new Zp,this.targetCount=0,this.V_=Rp.xs()}forEachTarget(e,t){return this.R_.forEach(((e,n)=>t(n))),G.resolve()}getLastRemoteSnapshotVersion(e){return G.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return G.resolve(this.I_)}allocateTargetId(e){return this.highestTargetId=this.V_.next(),G.resolve(this.highestTargetId)}setTargetsMetadata(e,t,n){return n&&(this.lastRemoteSnapshotVersion=n),t>this.I_&&(this.I_=t),G.resolve()}Ms(e){this.R_.set(e.target,e);let t=e.targetId;t>this.highestTargetId&&(this.V_=new Rp(t),this.highestTargetId=t),e.sequenceNumber>this.I_&&(this.I_=e.sequenceNumber)}addTargetData(e,t){return this.Ms(t),this.targetCount+=1,G.resolve()}updateTargetData(e,t){return this.Ms(t),G.resolve()}removeTargetData(e,t){return this.R_.delete(t.target),this.A_.s_(t.targetId),--this.targetCount,G.resolve()}removeTargets(e,t,n){let r=0,i=[];return this.R_.forEach(((a,o)=>{o.sequenceNumber<=t&&n.get(o.targetId)===null&&(this.R_.delete(a),i.push(this.removeMatchingKeysForTargetId(e,o.targetId)),r++)})),G.waitFor(i).next((()=>r))}getTargetCount(e){return G.resolve(this.targetCount)}getTargetData(e,t){let n=this.R_.get(t)||null;return G.resolve(n)}addMatchingKeys(e,t,n){return this.A_.n_(t,n),G.resolve()}removeMatchingKeys(e,t,n){this.A_.i_(t,n);let r=this.persistence.referenceDelegate,i=[];return r&&t.forEach((t=>{i.push(r.markPotentiallyOrphaned(e,t))})),G.waitFor(i)}removeMatchingKeysForTargetId(e,t){return this.A_.s_(t),G.resolve()}getMatchingKeysForTargetId(e,t){let n=this.A_.o_(t);return G.resolve(n)}containsKey(e,t){return G.resolve(this.A_.containsKey(t))}},rm=class{constructor(e,t){this.d_={},this.overlays={},this.f_=new va(0),this.m_=!1,this.m_=!0,this.p_=new Xp,this.referenceDelegate=e(this),this.g_=new nm(this),this.indexManager=new Ip,this.remoteDocumentCache=function(e){return new em(e)}((e=>this.referenceDelegate.y_(e))),this.serializer=new Np(t),this.w_=new Jp(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.m_=!1,Promise.resolve()}get started(){return this.m_}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let t=this.overlays[e.toKey()];return t||(t=new Yp,this.overlays[e.toKey()]=t),t}getMutationQueue(e,t){let n=this.d_[e.toKey()];return n||(n=new $p(t,this.referenceDelegate),this.d_[e.toKey()]=n),n}getGlobalsCache(){return this.p_}getTargetCache(){return this.g_}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.w_}runTransaction(e,t,n){B(`MemoryPersistence`,`Starting transaction:`,e);let r=new im(this.f_.next());return this.referenceDelegate.b_(),n(r).next((e=>this.referenceDelegate.v_(r).next((()=>e)))).toPromise().then((e=>(r.raiseOnCommittedEvent(),e)))}S_(e,t){return G.or(Object.values(this.d_).map((n=>()=>n.containsKey(e,t))))}},im=class extends ma{constructor(e){super(),this.currentSequenceNumber=e}},am=class e{constructor(e){this.persistence=e,this.D_=new Zp,this.x_=null}static C_(t){return new e(t)}get F_(){if(this.x_)return this.x_;throw Ci(60996)}addReference(e,t,n){return this.D_.addReference(n,t),this.F_.delete(n.toString()),G.resolve()}removeReference(e,t,n){return this.D_.removeReference(n,t),this.F_.add(n.toString()),G.resolve()}markPotentiallyOrphaned(e,t){return this.F_.add(t.toString()),G.resolve()}removeTarget(e,t){this.D_.s_(t.targetId).forEach((e=>this.F_.add(e.toString())));let n=this.persistence.getTargetCache();return n.getMatchingKeysForTargetId(e,t.targetId).next((e=>{e.forEach((e=>this.F_.add(e.toString())))})).next((()=>n.removeTargetData(e,t)))}b_(){this.x_=new Set}v_(e){let t=this.persistence.getRemoteDocumentCache().newChangeBuffer();return G.forEach(this.F_,(n=>{let r=W.fromPath(n);return this.O_(e,r).next((e=>{e||t.removeEntry(r,oa.min())}))})).next((()=>(this.x_=null,t.apply(e))))}updateLimboDocument(e,t){return this.O_(e,t).next((e=>{e?this.F_.delete(t.toString()):this.F_.add(t.toString())}))}y_(e){return 0}O_(e,t){return G.or([()=>G.resolve(this.D_.containsKey(t)),()=>this.persistence.getTargetCache().containsKey(e,t),()=>this.persistence.S_(e,t)])}},om=class e{constructor(e,t){this.persistence=e,this.M_=new lc((e=>wa(e.path)),((e,t)=>e.isEqual(t))),this.garbageCollector=fu(this,t)}static C_(t,n){return new e(t,n)}b_(){}v_(e){return G.resolve()}forEachTarget(e,t){return this.persistence.getTargetCache().forEac
784hTarget(e,t)}lr(e){let t=this.Ls(e);return this.persistence.getTargetCache().getTargetCount(e).next((e=>t.next((t=>e+t))))}Ls(e){let t=0;return this.Er(e,(e=>{t++})).next((()=>t))}Er(e,t){return G.forEach(this.M_,((n,r)=>this.Us(e,n,r).next((e=>e?G.resolve():t(r)))))}removeTargets(e,t,n){return this.persistence.getTargetCache().removeTargets(e,t,n)}removeOrphanedDocuments(e,t){let n=0,r=this.persistence.getRemoteDocumentCache(),i=r.newChangeBuffer();return r.P_(e,(r=>this.Us(e,r,t).next((e=>{e||(n++,i.removeEntry(r,oa.min()))})))).next((()=>i.apply(e))).next((()=>n))}markPotentiallyOrphaned(e,t){return this.M_.set(t,e.currentSequenceNumber),G.resolve()}removeTarget(e,t){let n=t.withSequenceNumber(e.currentSequenceNumber);return this.persistence.getTargetCache().updateTargetData(e,n)}addReference(e,t,n){return this.M_.set(n,e.currentSequenceNumber),G.resolve()}removeReference(e,t,n){return this.M_.set(n,e.currentSequenceNumber),G.resolve()}updateLimboDocument(e,t){return this.M_.set(t,e.currentSequenceNumber),G.resolve()}y_(e){let t=e.key.toString().length;return e.isFoundDocument()&&(t+=ho(e.data.value)),t}Us(e,t,n){return G.or([()=>this.persistence.S_(e,t),()=>this.persistence.getTargetCache().containsKey(e,t),()=>{let e=this.M_.get(t);return G.resolve(e!==void 0&&e>n)}])}getCacheSize(e){return this.persistence.getRemoteDocumentCache().getSize(e)}},sm=class e{constructor(e,t,n,r){this.targetId=e,this.fromCache=t,this.wo=n,this.bo=r}static vo(t,n){let r=bc(),i=bc();for(let e of n.docChanges)switch(e.type){case 0:r=r.add(e.doc.key);break;case 1:i=i.add(e.doc.key)}return new e(t,n.fromCache,r,i)}};function cm(e,t){return W.comparator(e.key,t.key)}var lm=class{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}},um=class{constructor(){this.So=!1,this.Do=!1,this.xo=100,this.Co=function(){return Ge()?8:ga(ze())>0?6:4}()}initialize(e,t){this.Fo=e,this.indexManager=t,this.So=!0}getDocumentsMatchingQuery(e,t,n,r){let i={result:null};return this.Oo(e,t).next((e=>{i.result=e})).next((()=>{if(!i.result)return this.Mo(e,t,r,n).next((e=>{i.result=e}))})).next((()=>{if(i.result)return;let n=new lm;return this.No(e,t,n).next((r=>{if(i.result=r,this.Do)return this.Lo(e,t,n,r.size)}))})).next((()=>i.result))}Lo(e,t,n,r){return Cp(t)?G.resolve():n.documentReadCount<this.xo?(yi()<=_t.DEBUG&&B(`QueryEngine`,`SDK will not create cache indexes for query:`,ec(t),`since it only creates cache indexes for collection contains`,`more than or equal to`,this.xo,`documents`),G.resolve()):(yi()<=_t.DEBUG&&B(`QueryEngine`,`Query:`,ec(t),`scans`,n.documentReadCount,`local documents and returns`,r,`documents as results.`),n.documentReadCount>this.Co*r?(yi()<=_t.DEBUG&&B(`QueryEngine`,`The SDK decides to create cache indexes for query:`,ec(t),`as using cache indexes may help improve performance.`),this.indexManager.createTargetIndexes(e,Js(t))):G.resolve())}Oo(e,t){if(Cp(t))return G.resolve(null);let n=t;if(Ws(n))return G.resolve(null);let r=Js(n);return this.indexManager.getIndexType(e,r).next((t=>t===0?null:(n.limit!==null&&t===1&&(n=Qs(n,null,`F`),r=Js(n)),this.indexManager.getDocumentsMatchingTarget(e,r).next((t=>{let i=bc(...t);return this.Fo.getDocuments(e,i).next((t=>this.indexManager.getMinOffset(e,r).next((r=>{let a=this.Bo(n,t);return this.Uo(n,a,i,r.readTime)?this.Oo(e,Qs(n,null,`F`)):this.ko(e,a,n,r)}))))})))))}Mo(e,t,n,r){return(Cp(t)?function(e){for(let t of e.stages){if(t instanceof Sd||t instanceof Cd)return!1;if(t instanceof xd){if(t.condition instanceof ad&&t.condition._expr.name===`exists`&&t.condition._expr.params[0]instanceof Qu&&t.condition._expr.params[0].fieldName===Ui)continue;return!1}}return!0}(t):Ws(t))||r.isEqual(oa.min())?G.resolve(null):this.Fo.getDocuments(e,n).next((i=>{let a=this.Bo(t,i);return this.Uo(t,a,n,r)?G.resolve(null):(yi()<=_t.DEBUG&&B(`QueryEngine`,`Re-using previous result from %s to execute query: %s`,r.toString(),wp(t)),this.ko(e,a,t,la(r,sa)).next((e=>e)))}))}Bo(e,t){let n,r;return Cp(e)?(n=new Aa(cm),r=t=>Bp(e,t)):(n=new Aa(nc(e)),r=t=>tc(e,t)),t.forEach(((e,t)=>{r(t)&&(n=n.add(t))})),n}Uo(e,t,n,r){if(Cp(e))return function(e){return e.stages.some((e=>e instanceof Sd||e instanceof Cd))}(e);if(e.limit===null)return!1;if(n.size!==t.size)return!0;let i=e.limitType===`F`?t.last():t.first();return!!i&&(i.hasPendingWrites||i.version.compareTo(r)>0)}
784No(e,t,n){return yi()<=_t.DEBUG&&B(`QueryEngine`,`Using full collection scan to execute query:`,wp(t)),this.Fo.getDocumentsMatchingQuery(e,t,da.min(),n)}ko(e,t,n,r){return this.Fo.getDocumentsMatchingQuery(e,n,r).next((e=>(t.forEach((t=>{e=e.insert(t.key,t)})),e)))}},dm=`LocalStore`,fm=3e8,pm=class{constructor(e,t,n,r){this.persistence=e,this.qo=t,this.serializer=r,this.$o=new Da(Li),this.Ko=new lc((e=>Dp(e)),Op),this.Wo=new Map,this.Qo=e.getRemoteDocumentCache(),this.g_=e.getTargetCache(),this.w_=e.getBundleCache(),this.Go(n)}Go(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new qp(this.Qo,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.Qo.setIndexManager(this.indexManager),this.qo.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction(`Collect garbage`,`readwrite-primary`,(t=>e.collect(t,this.$o)))}};function mm(e,t,n,r){return new pm(e,t,n,r)}async function hm(e,t){let n=Ti(e);return await n.persistence.runTransaction(`Handle user change`,`readonly`,(e=>{let r;
784return n.mutationQueue.getAllMutationBatches(e).next((i=>(r=i,n.Go(t),n.mutationQueue.getAllMutationBatches(e)))).next((t=>{let i=[],a=[],o=bc();for(let e of r){i.push(e.batchId);for(let t of e.mutations)o=o.add(t.key)}for(let e of t){a.push(e.batchId);for(let t of e.mutations)o=o.add(t.key)}return n.localDocuments.getDocuments(e,o).next((e=>({zo:e,removedBatchIds:i,addedBatchIds:a})))}))}))}function gm(e,t){let n=Ti(e);return n.persistence.runTransaction(`Acknowledge batch`,`readwrite-primary`,(e=>{let r=t.batch.keys(),i=n.Qo.newChangeBuffer({trackRemovals:!0});return function(e,t,n,r){let i=n.batch,a=i.keys(),o=G.resolve();return a.forEach((e=>{o=o.next((()=>r.getEntry(t,e))).next((t=>{let a=n.docVersions.get(e);V(a!==null,48541),t.version.compareTo(a)<0&&(i.applyToRemoteDocument(t,n),t.isValidDocument()&&(t.setReadTime(n.commitVersion),r.addEntry(t)))}))})),o.next((()=>e.mutationQueue.removeMutationBatch(t,i)))}(n,e,t,i).next((()=>i.apply(e))).next((()=>n.mutationQueue.performConsistencyCheck(e))).next((()=>n.documentOverlayCache.removeOverlaysForBatchId(e,r,t.batch.batchId))).next((()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(e,function(e){let t=bc();for(let n=0;n<e.mutationResults.length;++n)e.mutationResults[n].transformResults.length>0&&(t=t.add(e.batch.mutations[n].key));return t}(t)))).next((()=>n.localDocuments.getDocuments(e,r)))}))}function _m(e){let t=Ti(e);return t.persistence.runTransaction(`Get last remote snapshot version`,`readonly`,(e=>t.g_.getLastRemoteSnapshotVersion(e)))}function vm(e,t){let n=Ti(e),r=t.snapshotVersion,i=n.$o;return n.persistence.runTransaction(`Apply remote event`,`readwrite-primary`,(e=>{let a=n.Qo.newChangeBuffer({trackRemovals:!0});i=n.$o;let o=[];
784t.targetChanges.forEach(((a,s)=>{let c=i.get(s);if(!c)return;o.push(n.g_.removeMatchingKeys(e,a.removedDocuments,s).next((()=>n.g_.addMatchingKeys(e,a.addedDocuments,s))));let l=c.withSequenceNumber(e.currentSequenceNumber);t.targetMismatches.get(s)===null?a.resumeToken.approximateByteSize()>0&&(l=l.withResumeToken(a.resumeToken,r)):l=l.withResumeToken(Ra.EMPTY_BYTE_STRING,oa.min()).withLastLimboFreeSnapshotVersion(oa.min()),i=i.insert(s,l),function(e,t,n){return e.resumeToken.approximateByteSize()===0||t.snapshotVersion.toMicroseconds()-e.snapshotVersion.toMicroseconds()>=fm||n.addedDocuments.size+n.modifiedDocuments.size+n.removedDocuments.size>0}(c,l,a)&&o.push(n.g_.updateTargetData(e,l))}));let s=dc(),c=bc();if(t.documentUpdates.forEach((r=>{t.resolvedLimboDocuments.has(r)&&o.push(n.persistence.referenceDelegate.updateLimboDocument(e,r))})),o.push(ym(e,a,t.documentUpdates).next((e=>{s=e.jo,c=e.Ho}))),!r.isEqual(oa.min())){let t=n.g_.getLastRemoteSnapshotVersion(e).next((t=>n.g_.setTargetsMetadata(e,e.currentSequenceNumber,r)));o.push(t)}return G.waitFor(o).next((()=>a.apply(e))).next((()=>n.localDocuments.getLocalViewOfDocuments(e,s,c))).next((()=>s))})).then((e=>(n.$o=i,e)))}function ym(e,t,n){let r=bc(),i=bc();return n.forEach((e=>r=r.add(e))),t.getEntries(e,r).next((e=>{let r=dc();return n.forEach(((n,a)=>{let o=e.get(n);a.isFoundDocument()!==o.isFoundDocument()&&(i=i.add(n)),a.isNoDocument()&&a.version.isEqual(oa.min())?(t.removeEntry(n,a.readTime),r=r.insert(n,a)):!o.isValidDocument()||a.version.compareTo(o.version)>0||a.version.compareTo(o.version)===0&&o.hasPendingWrites?(t.addEntry(a),r=r.insert(n,a)):B(dm,`Ignoring outdated watch update for `,n,`. Current version:`,o.version,` Watch version:`,a.version)})),{jo:r,Ho:i}}))}function bm(e,t){let n=Ti(e);return n.persistence.runTransaction(`Get next mutation batch`,`readonly`,(e=>(t===void 0&&(t=K),n.mutationQueue.getNextMutationBatchAfterBatchId(e,t))))}function xm(e,t){let n=Ti(e);return n.persistence.runTransaction(`Allocate target`,`readwrite`,(e=>{let r;return n.g_.getTargetData(e,t).next((i=>i?(r=i,G.resolve(r)):n.g_.allocateTargetId(e).next((i=>(r=new Mp(t,i,`TargetPurposeListen`,e.currentSequenceNumber),n.g_.addTargetData(e,r).next((()=>r)))))))})).then((e=>{let r=n.$o.get(e.targetId);return(r===null||e.snapshotVersion.compareTo(r.snapshotVersion)>0)&&(n.$o=n.$o.insert(e.targetId,e),n.Ko.set(t,e.targetId)),e}))}async function Sm(e,t,n){let r=Ti(e),i=r.$o.get(t),a=n?`readwrite`:`readwrite-primary`;try{n||await r.persistence.runTransaction(`Release target`,a,(e=>r.persistence.referenceDelegate.removeTarget(e,i)))}catch(e){if(!_a(e))throw e;B(dm,`Failed to update sequence numbers for target ${t}: ${e}`)}r.$o=r.$o.remove(t),r.Ko.delete(i.target)}function Cm(e,t,n){let r=Ti(e),i=oa.min(),a=bc();return r.persistence.runTransaction(`Execute query`,`readwrite`,(e=>function(e,t,n){let r=Ti(e),i=r.Ko.get(n);return i===void 0?r.g_.getTargetData(t,n):G.resolve(r.$o.get(i))}(r,e,Cp(t)?t:Js(t)).next((t=>{if(t)return i=t.lastLimboFreeSnapshotVersion,r.g_.getMatchingKeysForTargetId(e,t.targetId).next((e=>{a=e}))})).next((()=>r.qo.getDocumentsMatchingQuery(e,t,n?i:oa.min(),n?a:bc()))).next((e=>(wm(r,e),{documents:e,Jo:a})))))}function wm(e,t){t.forEach(((t,n)=>{let r=n.key.getCollectionGroup(),i=e.Wo.get(r)||oa.min();n.readTime.compareTo(i)>0&&e.Wo.set(r,n.readTime)}))}var Tm=class{constructor(){this.activeTargetIds=Sc()}na(e){this.activeTargetIds=this.activeTargetIds.add(e)}ra(e){this.activeTargetIds=this.activeTargetIds.delete(e)}ta(){let e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}},Em=class{constructor(){this.Ua=new Tm,this.ka={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,t,n){}addLocalQueryTarget(e,t=!0){return t&&this.Ua.na(e),this.ka[e]||`not-current`}updateQueryState(e,t,n){this.ka[e]=t}removeLocalQueryTarget(e){this.Ua.ra(e)}isLocalQueryTarget(e){return this.Ua.activeTargetIds.has(e)}clearQueryState(e){delete this.ka[e]}getAllActiveQueryTargets(){return this.Ua.activeTargetIds}isActiveQueryTarget(e){return this.Ua.activeTargetIds.has(e)}start(){return this.Ua=new Tm,Promise.resolve()}handleUserChange(e,t,n){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}};function Dm(){return typeof document<`u`?document:null}var Om=class{constructor(e,t){this.asyncQueue=e,this.onlineStateHandler=t,this.state=`Unknown`,this.qa=0,this.$a=null,this.Ka=!0}Wa(){this.qa===0&&(this.Qa(`Unknown`),this.$a=this.asyncQueue.enqueueAfterDelay(`online_state_timeout`,1e4,(()=>(this.$a=null,this.Ga(`Backend didn't respond within 10 seconds.`),this.Qa(`Offline`),Promise.resolve()))))}za(e){this.state===`Online`?this.Qa(`Unknown`):(this.qa++,this.qa>=1&&(this.ja(),this.Ga(`Connection failed 1 times. Most recent error: ${e.toString()}`),this.Qa(`Offline`)))}set(e){this.ja(),this.qa=0,e===`Online`&&(this.Ka=!1),this.Qa(e)}Qa(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}Ga(e){let t=`Could not reach Cloud Firestore backend. ${e}\nThis typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.`;this.Ka?(bi(t),this.Ka=!1):B(`OnlineStateTracker`,t)}ja(){this.$a!==null&&(this.$a.cancel(),this.$a=null)}},km=`RemoteStore`,Am=class{constructor(e,t,n,r,i){this.localStore=e,this.datastore=t,this.asyncQueue=n,this.remoteSyncer={},this.Ha=[],this.Ja=new Map,this.Ya=new Map,this.Za=new Map,this.Xa=new Rp(1e3),this.eu=new Rp(1001),this.tu=new Set,this.nu=[],this.ru=i,this.ru.bt((e=>{n.enqueueAndForget((async()=>
784{Bm(this)&&(B(km,`Restarting streams for network reachability change.`),await async function(e){let t=Ti(e);t.tu.add(4),await Mm(t),t.iu.set(`Unknown`),t.tu.delete(4),await jm(t)}(this))}))})),this.iu=new Om(n,r)}};async function jm(e){if(Bm(e))for(let t of e.nu)await t(!0)}async function Mm(e){for(let t of e.nu)await t(!1)}function Nm(e,t){return e.Ya.get(t)||void 0}function Pm(e,t){let n=Ti(e),r=Nm(n,t.targetId);if(r!==void 0&&n.Ja.has(r))return;let i=function(e,t){let n=Nm(e,t);n!==void 0&&e.Za.delete(n);let r=function(e,t){return t%2==0?e.Xa.next():e.eu.next()}(e,t);return e.Ya.set(t,r),e.Za.set(r,t),r}(n,t.targetId);B(km,`remoteStoreListen mapping SDK target ID to remote`,t.targetId,i);let a=new Mp(t.target,i,t.purpose,t.sequenceNumber,t.snapshotVersion,t.lastLimboFreeSnapshotVersion,t.resumeToken);n.Ja.set(i,a),zm(n)?Rm(n):ah(n).Fn()&&Im(n,a)}function Fm(e,t){let n=Ti(e),r=ah(n),i=Nm(n,t);B(km,`remoteStoreUnlisten removing mapping of SDK target ID to remote`,t,i),n.Ja.delete(i),n.Ya.delete(t),n.Za.delete(i),r.Fn()&&Lm(n,i),n.Ja.size===0&&(r.Fn()?r.Nn():Bm(n)&&n.iu.set(`Unknown`))}function Im(e,t){if(e.su.We(t.targetId),t.resumeToken.approximateByteSize()>0||t.snapshotVersion.compareTo(oa.min())>0){let n=e.Za.get(t.targetId);if(n===void 0)return void B(km,`SDK target ID not found for remote ID: `+t.targetId);let r=e.remoteSyncer.getRemoteKeysForTarget(n).size;t=t.withExpectedCount(r)}ah(e).jn(t)}function Lm(e,t){e.su.We(t),ah(e).Hn(t)}function Rm(e){e.su=new Lc({getRemoteKeysForTarget:t=>{let n=e.Za.get(t);return n===void 0?bc():e.remoteSyncer.getRemoteKeysForTarget(n)},dt:t=>e.Ja.get(t)||null,Tt:()=>e.datastore.serializer.databaseId}),ah(e).start(),e.iu.Wa()}function zm(e){return Bm(e)&&!ah(e).Cn()&&e.Ja.size>0}function Bm(e){return Ti(e).tu.size===0}function Vm(e){e.su=void 0}async function Hm(e){e.iu.set(`Online`)}async function Um(e){e.Ja.forEach(((t,n)=>{Im(e,t)}))}async function Wm(e,t){Vm(e),zm(e)?(e.iu.za(t),Rm(e)):e.iu.set(`Unknown`)}async function Gm(e,t,n){if(e.iu.set(`Online`),t instanceof Pc&&t.state===2&&t.cause)try{await async function(e,t){let n=t.cause;for(let r of t.targetIds){if(e.Ja.has(r)){let t=e.Za.get(r);t!==void 0&&(await e.remoteSyncer.rejectListen(t,n),e.Ya.delete(t),e.Za.delete(r)),e.Ja.delete(r)}e.su.removeTarget(r)}}(e,t)}catch(n){B(km,`Failed to remove targets %s: %s `,t.targetIds.join(`,`),n),await Km(e,n)}else if(t instanceof Mc?e.su.et(t):t instanceof Nc?e.su.ot(t):e.su.rt(t),!n.isEqual(oa.min()))try{let t=await _m(e.localStore);n.compareTo(t)>=0&&await function(e,t){let n=e.su.Rt(t);
784n.targetChanges.forEach(((n,r)=>{if(n.resumeToken.approximateByteSize()>0){let i=e.Ja.get(r);i&&e.Ja.set(r,i.withResumeToken(n.resumeToken,t))}})),n.targetMismatches.forEach(((t,n)=>{let r=e.Ja.get(t);r&&(e.Ja.set(t,r.withResumeToken(Ra.EMPTY_BYTE_STRING,r.snapshotVersion)),Lm(e,t),Im(e,new Mp(r.target,t,n,r.sequenceNumber)))}));let r=function(e,t){let n=new Map;t.targetChanges.forEach(((t,r)=>{let i=e.Za.get(r);i!==void 0&&n.set(i,t)}));let r=new Da(Li);return t.targetMismatches.forEach(((t,n)=>{let i=e.Za.get(t);i!==void 0&&(r=r.insert(i,n))})),new Ac(t.snapshotVersion,n,r,t.documentUpdates,t.augmentedDocumentUpdates,t.resolvedLimboDocuments)}(e,n);return e.remoteSyncer.applyRemoteEvent(r)}(e,n)}catch(t){B(km,`Failed to raise snapshot:`,t),await Km(e,t)}}async function Km(e,t,n){if(!_a(t))throw t;e.tu.add(1),await Mm(e),e.iu.set(`Offline`),n||=()=>_m(e.localStore),e.asyncQueue.enqueueRetryable((async()=>{B(km,`Retrying IndexedDB access`),await n(),e.tu.delete(1),await jm(e)}))}function qm(e,t){return t().catch((n=>Km(e,n,t)))}async function Jm(e){let t=Ti(e),n=oh(t),r=t.Ha.length>0?t.Ha[t.Ha.length-1].batchId:K;for(;Ym(t);)try{let e=await bm(t.localStore,r);if(e===null){t.Ha.length===0&&n.Nn();break}r=e.batchId,Xm(t,e)}catch(e){await Km(t,e)}Zm(t)&&Qm(t)}function Ym(e){return Bm(e)&&e.Ha.length<10}function Xm(e,t){e.Ha.push(t);let n=oh(e);n.Fn()&&n.Jn&&n.Yn(t.mutations)}function Zm(e){return Bm(e)&&!oh(e).Cn()&&e.Ha.length>0}function Qm(e){oh(e).start()}async function $m(e){oh(e).er()}async function eh(e){let t=oh(e);for(let n of e.Ha)t.Yn(n.mutations)}async function th(e,t,n){let r=e.Ha.shift(),i=Ap.from(r,t,n);await qm(e,(()=>e.remoteSyncer.applySuccessfulWrite(i))),await Jm(e)}async function nh(e,t){t&&oh(e).Jn&&await async function(e,t){if(function(e){return sc(e)&&e!==H.ABORTED}(t.code)){let n=e.Ha.shift();oh(e).Mn(),await qm(e,(()=>e.remoteSyncer.rejectFailedWrite(n.batchId,t))),await Jm(e)}}(e,t),Zm(e)&&Qm(e)}async function rh(e,t){let n=Ti(e);n.asyncQueue.verifyOperationInProgress(),B(km,`RemoteStore received new credentials`);let r=Bm(n);n.tu.add(3),await Mm(n),r&&n.iu.set(`Unknown`),await n.remoteSyncer.handleCredentialChange(t),n.tu.delete(3),await jm(n)}async function ih(e,t){let n=Ti(e);t?(n.tu.delete(2),await jm(n)):t||(n.tu.add(2),await Mm(n),n.iu.set(`Unknown`))}function ah(e){return e._u||(e._u=function(e,t,n){let r=Ti(e);return r.nr(),new Yl(t,r.connection,r.authCredentials,r.appCheckCredentials,r.serializer,n)}(e.datastore,e.asyncQueue,{Qt:Hm.bind(null,e),zt:Um.bind(null,e),Ht:Wm.bind(null,e),zn:Gm.bind(null,e)}
784),e.nu.push((async t=>{t?(e._u.Mn(),zm(e)?Rm(e):e.iu.set(`Unknown`)):(await e._u.stop(),Vm(e))}))),e._u}function oh(e){return e.ou||(e.ou=function(e,t,n){let r=Ti(e);return r.nr(),new Xl(t,r.connection,r.authCredentials,r.appCheckCredentials,r.serializer,n)}(e.datastore,e.asyncQueue,{Qt:()=>Promise.resolve(),zt:$m.bind(null,e),Ht:nh.bind(null,e),Zn:eh.bind(null,e),Xn:th.bind(null,e)}),e.nu.push((async t=>{t?(e.ou.Mn(),await Jm(e)):(await e.ou.stop(),e.Ha.length>0&&(B(km,`Stopping write stream with ${e.Ha.length} pending writes`),e.Ha=[]))}))),e.ou}var sh=class e{constructor(e,t,n,r,i){this.asyncQueue=e,this.timerId=t,this.targetTimeMs=n,this.op=r,this.removalCallback=i,this.deferred=new Ei,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch((e=>{}))}get promise(){return this.deferred.promise}static createAndSchedule(t,n,r,i,a){let o=Date.now()+r,s=new e(t,n,o,i,a);return s.start(r),s}start(e){this.timerHandle=setTimeout((()=>this.handleDelayElapsed()),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){this.timerHandle!==null&&(this.clearTimeout(),this.deferred.reject(new U(H.CANCELLED,`Operation cancelled`+(e?`: `+e:``))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget((()=>this.timerHandle===null?Promise.resolve():(this.clearTimeout(),this.op().then((e=>this.deferred.resolve(e))))))}clearTimeout(){this.timerHandle!==null&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}};function ch(e,t){if(bi(`AsyncQueue`,`${t}: ${e}`),_a(e))return new U(H.UNAVAILABLE,`${t}: ${e}`);throw e}var lh=class e{static emptySet(t){return new e(t.comparator)}constructor(e){this.comparator=e?(t,n)=>e(t,n)||W.comparator(t.key,n.key):(e,t)=>W.comparator(e.key,t.key),this.keyedMap=pc(),this.sortedSet=new Da(this.comparator)}has(e){return this.keyedMap.get(e)!=null}get(e){return this.keyedMap.get(e)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(e){let t=this.keyedMap.get(e);return t?this.sortedSet.indexOf(t):-1}get size(){return this.sortedSet.size}forEach(e){this.sortedSet.inorderTraversal(((t,n)=>(e(t),!1)))}add(e){let t=this.delete(e.key);return t.copy(t.keyedMap.insert(e.key,e),t.sortedSet.insert(e,null))}delete(e){let t=this.get(e);return t?this.copy(this.keyedMap.remove(e),this.sortedSet.remove(t)):this}isEqual(t){if(!(t instanceof e)||this.size!==t.size)return!1;let n=this.sortedSet.getIterator(),r=t.sortedSet.getIterator();for(;n.hasNext();){let e=n.getNext().key,t=r.getNext().key;if(!e.isEqual(t))return!1}return!0}toString(){let e=[];return this.forEach((t=>{e.push(t.toString())})),e.length===0?`DocumentSet ()`:`DocumentSet (
785  `+e.join(`  
786`)+`
787)`}copy(t,n){let r=new e;return r.comparator=this.comparator,r.keyedMap=t,r.sortedSet=n,r}},uh=class{constructor(){this.au=new Da(W.comparator)}track(e){let t=e.doc.key,n=this.au.get(t);n?e.type!==0&&n.type===3?this.au=this.au.insert(t,e):e.type===3&&n.type!==1?this.au=this.au.insert(t,{type:n.type,doc:e.doc}):e.type===2&&n.type===2?this.au=this.au.insert(t,{type:2,doc:e.doc}):e.type===2&&n.type===0?this.au=this.au.insert(t,{type:0,doc:e.doc}):e.type===1&&n.type===0?this.au=this.au.remove(t):e.type===1&&n.type===2?this.au=this.au.insert(t,{type:1,doc:n.doc}):e.type===0&&n.type===1?this.au=this.au.insert(t,{type:2,doc:e.doc}):Ci(63341,{ft:e,uu:n}):this.au=this.au.insert(t,e)}cu(){let e=[];return this.au.inorderTraversal(((t,n)=>{e.push(n)})),e}},dh=class e{constructor(e,t,n,r,i,a,o,s,c){this.query=e,this.docs=t,this.oldDocs=n,this.docChanges=r,this.mutatedKeys=i,this.fromCache=a,this.syncStateChanged=o,this.excludesMetadataChanges=s,this.hasCachedResults=c}static fromInitialDocuments(t,n,r,i,a){let o=[];return n.forEach((e=>{o.push({type:0,doc:e})})),new e(t,n,lh.emptySet(n),o,r,i,!0,!1,a)}get hasPendingWrites(){return!this.mutatedKeys.isEmpty()}isEqual(e){if(!(this.fromCache===e.fromCache&&this.hasCachedResults===e.hasCachedResults&&this.syncStateChanged===e.syncStateChanged&&this.mutatedKeys.isEqual(e.mutatedKeys)&&Ep(this.query,e.query)&&this.docs.isEqual(e.docs)&&this.oldDocs.isEqual(e.oldDocs)))return!1;let t=this.docChanges,n=e.docChanges;if(t.length!==n.length)return!1;for(let e=0;e<t.length;e++)if(t[e].type!==n[e].type||!t[e].doc.isEqual(n[e].doc))return!1;return!0}},fh=class{constructor(){this.lu=void 0,this.Eu=[]}hu(){return this.Eu.some((e=>e.Tu()))}},ph=class{constructor(){this.queries=mh(),this.onlineState=`Unknown`,this.Pu=new Set}terminate(){(function(e,t){let n=Ti(e),r=n.queries;n.queries=mh(),r.forEach(((e,n)=>{for(let e of n.Eu)e.onError(t)}))})(this,new U(H.ABORTED,`Firestore shutting down`))}};function mh(){return new lc((e=>Tp(e)),Ep)}async function hh(e,t){let n=Ti(e),r=3,i=t.query,a=n.queries.get(i);a?!a.hu()&&t.Tu()&&(r=2):(a=new fh,r=+!t.Tu());try{switch(r){case 0:a.lu=await n.onListen(i,!0);break;case 1:a.lu=await n.onListen(i,!1);break;case 2:await n.onFirstRemoteStoreListen(i)}}catch(e){let n=ch(e,`Initialization of query '${Cp(t.query)?xp(t.query):ec(t.query)}' failed`);t.onError(n);return}n.queries.set(i,a),a.Eu.push(t),t.Ru(n.onlineState),a.lu&&t.Iu(a.lu)&&yh(n)}async function gh(e,t){let n=Ti(e),r=t.query,i=3,a=n.queries.get(r);if(a){let e=a.Eu.indexOf(t);e>=0&&(a.Eu.splice(e,1),a.Eu.length===0?i=+!t.Tu():!a.hu()&&t.Tu()&&(i=2))}switch(i){case 0:return n.queries.delete(r),n.onUnlisten(r,!0);case 1:return n.queries.delete(r),n.onUnlisten(r,!1);case 2:return n.onLastRemoteStoreUnlisten(r);default:return}}function _h(e,t){let n=Ti(e),r=!1;for(let e of t){let t=e.query,i=n.queries.get(t);if(i){for(let t of i.Eu)t.Iu(e)&&(r=!0);i.lu=e}}r&&yh(n)}function vh(e,t,n){let r=Ti(e),i=r.queries.get(t);if(i)for(let e of i.Eu)e.onError(n);r.queries.delete(t)}function yh(e){e.Pu.forEach((e=>{e.next()}))}var bh;(function(e){e.Default=`default`,e.Cache=`cache`})(bh||={});var xh=class{constructor(e,t,n){this.query=e,this.Au=t,this.Vu=!1,this.du=null,this.onlineState=`Unknown`,this.options=n||{}}Iu(e){if(!this.options.includeMetadataChanges){let t=[];for(let n of e.docChanges)n.type!==3&&t.push(n);e=new dh(e.query,e.docs,e.oldDocs,t,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let t=!1;return this.Vu?this.fu(e)&&(this.Au.next(e),t=!0):this.mu(e,this.onlineState)&&(this.pu(e),t=!0),this.du=e,t}onError(e){this.Au.error(e)}Ru(e){this.onlineState=e;let t=!1;return this.du&&!this.Vu&&this.mu(this.du,e)&&(this.pu(this.du),t=!0),t}mu(e,t){if(!e.fromCache||!this.Tu())return!0;let n=t!==`Offline`;
787return(!this.options.waitForSyncWhenOnline||!n)&&(!e.docs.isEmpty()||e.hasCachedResults||t===`Offline`)}fu(e){if(e.docChanges.length>0)return!0;let t=this.du&&this.du.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!t)&&!0===this.options.includeMetadataChanges}pu(e){e=dh.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.Vu=!0,this.Au.next(e)}Tu(){return this.options.source!==bh.Cache}},Sh=class{constructor(e){this.key=e}},Ch=class{constructor(e){this.key=e}},wh=class{constructor(e,t){this.query=e,this.Ou=t,this.Mu=null,this.hasCachedResults=!1,this.current=!1,this.Nu=bc(),this.mutatedKeys=bc(),this.Lu=Cp(e)?Up(e):nc(e),this.Bu=new lh(this.Lu)}get Uu(){return this.Ou}ku(e,t){let n=t?t.qu:new uh,r=t?t.Bu:this.Bu,i=t?t.mutatedKeys:this.mutatedKeys,a=r,o=!1,[s,c]=this.$u(this.query,r);e.inorderTraversal(((e,t)=>{let l=r.get(e),u=Vp(this.query,t)?t:null,d=!!l&&this.mutatedKeys.has(l.key),f=!!u&&(u.hasLocalMutations||this.mutatedKeys.has(u.key)&&u.hasCommittedMutations),p=!1;l&&u?l.data.isEqual(u.data)?d!==f&&(n.track({type:3,doc:u}),p=!0):this.Ku(l,u)||(n.track({type:2,doc:u}),p=!0,(s&&this.Lu(u,s)>0||c&&this.Lu(u,c)<0)&&(o=!0)):!l&&u?(n.track({type:0,doc:u}),p=!0):l&&!u&&(n.track({type:1,doc:l}),p=!0,(s||c)&&(o=!0)),p&&(u?(a=a.add(u),i=f?i.add(e):i.delete(e)):(a=a.delete(e),i=i.delete(e)))}));let l=this.Wu(this.query);if(l)if(Cp(this.query)){let e=[];a.forEach((t=>e.push(t)));let t=zp(this.query,e),r=new lh(Up(this.query));for(let e of t)r=r.add(e);a.forEach((e=>{r.has(e.key)||(i=i.delete(e.key),n.track({type:1,doc:e}))})),a=r}else{let e=this.Qu(this.query);for(;a.size>l;){let t=e===`F`?a.last():a.first();a=a.delete(t.key),i=i.delete(t.key),n.track({type:1,doc:t})}}return{Bu:a,qu:n,Uo:o,mutatedKeys:i}}Wu(e){return Cp(e)?Wp(e)?.limit:e.limit||void 0}Qu(e){if(Cp(e)){let t=Wp(e);return t&&t.limit<0?`L`:`F`}return e.limitType}$u(e,t){if(Cp(e)){let n=Wp(e)?.limit;return[t.size===n?t.last():null,null]}return[e.limitType===`F`&&t.size===this.Wu(this.query)?t.last():null,e.limitType===`L`&&t.size===this.Wu(this.query)?t.first():null]}Ku(e,t){return e.hasLocalMutations&&t.hasCommittedMutations&&!t.hasLocalMutations}applyChanges(e,t,n,r){let i=this.Bu;this.Bu=e.Bu,this.mutatedKeys=e.mutatedKeys;let a=e.qu.cu();a.sort(((e,t)=>function(e,t){let n=e=>{switch(e){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return Ci(20277,{ft:e})}};return n(e)-n(t)}(e.type,t.type)||this.Lu(e.doc,t.doc))),this.Gu(n),r??=!1;let o=t&&!r?this.zu():[],s=this.Nu.size===0&&this.current&&!r?1:0,c=s!==this.Mu;return this.Mu=s,a.length!==0||c?{snapshot:new dh(this.query,e.Bu,i,a,e.mutatedKeys,s===0,c,!1,!!n&&n.resumeToken.approximateByteSize()>0),ju:o}:{ju:o}}Ru(e){return this.current&&e===`Offline`?(this.current=!1,this.applyChanges({Bu:this.Bu,qu:new uh,mutatedKeys:this.mutatedKeys,Uo:!1},!1)):{ju:[]}}Hu(e){return!this.Ou.has(e)&&!!this.Bu.has(e)&&!this.Bu.get(e).hasLocalMutations}Gu(e){e&&(e.addedDocuments.forEach((e=>this.Ou=this.Ou.add(e))),e.modifiedDocuments.forEach((e=>{})),e.removedDocuments.forEach((e=>this.Ou=this.Ou.delete(e))),this.current=e.current)}zu(){if(!this.current)return[];let e=this.Nu;this.Nu=bc(),this.Bu.forEach((e=>{this.Hu(e.key)&&(this.Nu=this.Nu.add(e.key))}));let t=[];return e.forEach((e=>{this.Nu.has(e)||t.push(new Ch(e))})),this.Nu.forEach((n=>{e.has(n)||t.push(new Sh(n))})),t}Ju(e){this.Ou=e.Jo,this.Nu=bc();let t=this.ku(e.documents);return this.applyChanges(t,!0)}Yu(){return dh.fromInitialDocuments(this.query,this.Bu,this.mutatedKeys,this.Mu===0,this.hasCachedResults)}},Th=`SyncEngine`,Eh=class{constructor(e,t,n){this.query=e,this.targetId=t,this.view=n}},Dh=class{constructor(e){this.key=e,this.Zu=!1}},Oh=class{constructor(e,t,n,r,i,a){this.localStore=e,this.remoteStore=t,this.eventManager=n,this.sharedClientState=r,this.currentUser=i,this.maxConcurrentLimboResolutions=a,this.Xu={},this.ec=new lc((e=>Tp(e)),Ep),this.tc=new Map,this.nc=new Set,this.rc=new Da(W.comparator),this.sc=new Map,this._c=new Zp,this.oc={},this.ac=new Map,this.uc=Rp.Cs(),this.onlineState=`Unknown`,this.cc=void 0}get isPrimaryClient(){return!0===this.cc}};async function kh(e,t,n=!0){let r=Zh(e),i,a=r.ec.get(t);
787return a?(r.sharedClientState.addLocalQueryTarget(a.targetId),i=a.view.Yu()):i=await jh(r,t,n,!0),i}async function Ah(e,t){await jh(Zh(e),t,!0,!1)}async function jh(e,t,n,r){let i=await xm(e.localStore,Cp(t)?t:Js(t)),a=i.targetId,o=e.sharedClientState.addLocalQueryTarget(a,n),s;return r&&(s=await Mh(e,t,a,o===`current`,i.resumeToken)),e.isPrimaryClient&&n&&Pm(e.remoteStore,i),s}async function Mh(e,t,n,r,i){e.lc=(t,n,r)=>async function(e,t,n,r){let i=t.view.ku(n);i.Uo&&(i=await Cm(e.localStore,t.query,!1).then((({documents:e})=>t.view.ku(e,i))));let a=r&&r.targetChanges.get(t.targetId),o=r&&r.targetMismatches.get(t.targetId)!=null,s=t.view.applyChanges(i,e.isPrimaryClient,a,o);return Gh(e,t.targetId,s.ju),s.snapshot}(e,t,n,r);let a=await Cm(e.localStore,t,!0),o=new wh(t,a.Jo),s=o.ku(a.documents),c=jc.createSynthesizedTargetChangeForCurrentChange(n,r&&e.onlineState!==`Offline`,i),l=o.applyChanges(s,e.isPrimaryClient,c);Gh(e,n,l.ju);let u=new Eh(t,n,o);return e.ec.set(t,u),e.tc.has(n)?e.tc.get(n).push(t):e.tc.set(n,[t]),l.snapshot}async function Nh(e,t,n){let r=Ti(e),i=r.ec.get(t),a=r.tc.get(i.targetId);if(a.length>1)return r.tc.set(i.targetId,a.filter((e=>!Ep(e,t)))),void r.ec.delete(t);r.isPrimaryClient?(r.sharedClientState.removeLocalQueryTarget(i.targetId),r.sharedCl
787ientState.isActiveQueryTarget(i.targetId)||await Sm(r.localStore,i.targetId,!1).then((()=>{r.sharedClientState.clearQueryState(i.targetId),n&&Fm(r.remoteStore,i.targetId),Uh(r,i.targetId)})).catch(ha)):(Uh(r,i.targetId),await Sm(r.localStore,i.targetId,!0))}async function Ph(e,t){let n=Ti(e),r=n.ec.get(t),i=n.tc.get(r.targetId);n.isPrimaryClient&&i.length===1&&(n.sharedClientState.removeLocalQueryTarget(r.targetId),Fm(n.remoteStore,r.targetId))}async function Fh(e,t,n){let r=Qh(e);try{let e=await function(e,t){let n=Ti(e),r=aa.now(),i=t.reduce(((e,t)=>e.add(t.key)),bc()),a,o;return n.persistence.runTransaction(`Locally write mutations`,`readwrite`,(e=>{let s=dc(),c=bc();return n.Qo.getEntries(e,i).next((e=>{s=e,s.forEach(((e,t)=>{t.isValidDocument()||(c=c.add(e))}))})).next((()=>n.localDocuments.getOverlayedDocuments(e,s))).next((i=>{a=i;let o=[];for(let e of t){let t=rs(e,a.get(e.key).overlayedDocument);t!=null&&o.push(new os(e.key,t,ko(t.value.mapValue),Zo.exists(!0)))}return n.mutationQueue.addMutationBatch(e,r,o,t)})).next((t=>{o=t;let r=t.applyToLocalDocumentSet(a,c);return n.documentOverlayCache.saveOverlays(e,t.batchId,r)}))})).then((()=>({batchId:o.batchId,changes:mc(a)})))}(r.localStore,t);r.sharedClientState.addPendingMutation(e.batchId),function(e,t,n){let r=e.oc[e.currentUser.toKey()];r||=new Da(Li),r=r.insert(t,n),e.oc[e.currentUser.toKey()]=r}(r,e.batchId,n),await Jh(r,e.changes),await Jm(r.remoteStore)}catch(e){let t=ch(e,`Failed to persist write`);n.reject(t)}}async function Ih(e,t){let n=Ti(e);try{let e=await vm(n.localStore,t);
787t.targetChanges.forEach(((e,t)=>{let r=n.sc.get(t);r&&(V(e.addedDocuments.size+e.modifiedDocuments.size+e.removedDocuments.size<=1,22616),e.addedDocuments.size>0?r.Zu=!0:e.modifiedDocuments.size>0?V(r.Zu,14607):e.removedDocuments.size>0&&(V(r.Zu,42227),r.Zu=!1))})),await Jh(n,e,t)}catch(e){await ha(e)}}function Lh(e,t,n){let r=Ti(e);if(r.isPrimaryClient&&n===0||!r.isPrimaryClient&&n===1){let e=[];r.ec.forEach(((n,r)=>{let i=r.view.Ru(t);i.snapshot&&e.push(i.snapshot)})),function(e,t){let n=Ti(e);n.onlineState=t;let r=!1;n.queries.forEach(((e,n)=>{for(let e of n.Eu)e.Ru(t)&&(r=!0)})),r&&yh(n)}(r.eventManager,t),e.length&&r.Xu.zn(e),r.onlineState=t,r.isPrimaryClient&&r.sharedClientState.setOnlineState(t)}}async function Rh(e,t,n){let r=Ti(e);r.sharedClientState.updateQueryState(t,`rejected`,n);let i=r.sc.get(t),a=i&&i.key;if(a){let e=new Da(W.comparator);e=e.insert(a,Ps.newNoDocument(a,oa.min()));let n=bc().add(a);await Ih(r,new Ac(oa.min(),new Map,new Da(Li),e,dc(),n)),r.rc=r.rc.remove(a),r.sc.delete(t),qh(r)}else await Sm(r.localStore,t,!1).then((()=>Uh(r,t,n))).catch(ha)}async function zh(e,t){let n=Ti(e),r=t.batch.batchId;try{let e=await gm(n.localStore,t);Hh(n,r,null),Vh(n,r),n.sharedClientState.updateMutationState(r,`acknowledged`),await Jh(n,e)}catch(e){await ha(e)}}async function Bh(e,t,n){let r=Ti(e);try{let e=await function(e,t){let n=Ti(e);return n.persistence.runTransaction(`Reject batch`,`readwrite-primary`,(e=>{let r;
787return n.mutationQueue.lookupMutationBatch(e,t).next((t=>(V(t!==null,37113),r=t.keys(),n.mutationQueue.removeMutationBatch(e,t)))).next((()=>n.mutationQueue.performConsistencyCheck(e))).next((()=>n.documentOverlayCache.removeOverlaysForBatchId(e,r,t))).next((()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(e,r))).next((()=>n.localDocuments.getDocuments(e,r)))}))}(r.localStore,t);Hh(r,t,n),Vh(r,t),r.sharedClientState.updateMutationState(t,`rejected`,n),await Jh(r,e)}catch(e){await ha(e)}}function Vh(e,t){(e.ac.get(t)||[]).forEach((e=>{e.resolve()})),e.ac.delete(t)}function Hh(e,t,n){let r=Ti(e),i=r.oc[r.currentUser.toKey()];if(i){let e=i.get(t);e&&(n?e.reject(n):e.resolve(),i=i.remove(t)),r.oc[r.currentUser.toKey()]=i}}function Uh(e,t,n=null){e.sharedClientState.removeLocalQueryTarget(t);for(let r of e.tc.get(t))e.ec.delete(r),n&&e.Xu.Ec(r,n);e.tc.delete(t),e.isPrimaryClient&&e._c.s_(t).forEach((t=>{e._c.containsKey(t)||Wh(e,t)}))}function Wh(e,t){e.nc.delete(t.path.canonicalString());let n=e.rc.get(t);n!==null&&(Fm(e.remoteStore,n),e.rc=e.rc.remove(t),e.sc.delete(n),qh(e))}function Gh(e,t,n){for(let r of n)r instanceof Sh?(e._c.addReference(r.key,t),Kh(e,r)):r instanceof Ch?(B(Th,`Document no longer in limbo: `+r.key),e._c.removeReference(r.key,t),e._c.containsKey(r.key)||Wh(e,r.key)):Ci(19791,{hc:r})}function Kh(e,t){let n=t.key,r=n.path.canonicalString();e.rc.get(n)||e.nc.has(r)||(B(Th,`New document in limbo: `+n),e.nc.add(r),qh(e))}function qh(e){for(;e.nc.size>0&&e.rc.size<e.maxConcurrentLimboResolutions;){let t=e.nc.values().next().value;e.nc.delete(t);let n=new W(Gi.fromString(t)),r=e.uc.next();e.sc.set(r,new Dh(n)),e.rc=e.rc.insert(n,r),Pm(e.remoteStore,new Mp(Js(Us(n.path)),r,`TargetPurposeLimboResolution`,va.ce))}}async function Jh(e,t,n){let r=Ti(e),i=[],a=[],o=[];r.ec.isEmpty()||(r.ec.forEach(((e,s)=>{o.push(r.lc(s,t,n).then((e=>{if((e||n)&&r.isPrimaryClient){let t=e?!e.fromCache:n?.targetChanges.get(s.targetId)?.current;
787r.sharedClientState.updateQueryState(s.targetId,t?`current`:`not-current`)}if(e){i.push(e);let t=sm.vo(s.targetId,e);a.push(t)}})))})),await Promise.all(o),r.Xu.zn(i),await async function(e,t){let n=Ti(e);try{await n.persistence.runTransaction(`notifyLocalViewChanges`,`readwrite`,(e=>G.forEach(t,(t=>G.forEach(t.wo,(r=>n.persistence.referenceDelegate.addReference(e,t.targetId,r))).next((()=>G.forEach(t.bo,(r=>n.persistence.referenceDelegate.removeReference(e,t.targetId,r)))))))))}catch(e){if(!_a(e))throw e;B(dm,`Failed to update sequence numbers: `+e)}for(let e of t){let t=e.targetId;if(!e.fromCache){let e=n.$o.get(t),r=e.snapshotVersion,i=e.withLastLimboFreeSnapshotVersion(r);n.$o=n.$o.insert(t,i)}}}(r.localStore,a))}async function Yh(e,t){let n=Ti(e);if(!n.currentUser.isEqual(t)){B(Th,`User change. New user:`,t.toKey());let e=await hm(n.localStore,t);n.currentUser=t,function(e,t){e.ac.forEach((e=>{e.forEach((e=>{e.reject(new U(H.CANCELLED,t))}))})),e.ac.clear()}(n,`'waitForPendingWrites' promise is rejected due to a user change.`),n.sharedClientState.handleUserChange(t,e.removedBatchIds,e.addedBatchIds),await Jh(n,e.zo)}}function Xh(e,t){let n=Ti(e),r=n.sc.get(t);if(r&&r.Zu)return bc().add(r.key);{let e=bc(),r=n.tc.get(t);if(!r)return e;for(let t of r??[]){let r=n.ec.get(t);e=e.unionWith(r.view.Uu)}return e}}function Zh(e){let t=Ti(e);return t.remoteStore.remoteSyncer.applyRemoteEvent=Ih.bind(null,t),t.remoteStore.remoteSyncer.getRemoteKeysForTarget=Xh.bind(null,t),t.remoteStore.remoteSyncer.rejectListen=Rh.bind(null,t),t.Xu.zn=_h.bind(null,t.eventManager),t.Xu.Ec=vh.bind(null,t.eventManager),t}function Qh(e){let t=Ti(e);return t.remoteStore.remoteSyncer.applySuccessfulWrite=zh.bind(null,t),t.remoteStore.remoteSyncer.rejectFailedWrite=Bh.bind(null,t),t}var $h=class{constructor(){this.kind=`memory`,this.synchronizeTabs=!1}async initialize(e){this.serializer=El(e.databaseInfo.databaseId),this.sharedClientState=this.Rc(e),this.persistence=this.Ic(e),await this.persistence.start(),this.localStore=this.Ac(e),this.gcScheduler=this.Vc(e,this.localStore),this.indexBackfillerScheduler=this.dc(e,this.localStore)}Vc(e,t){return null}dc(e,t){return null}Ac(e){return mm(this.persistence,new um,e.initialUser,this.serializer)}Ic(e){return new rm(am.C_,this.serializer)}Rc(e){return new Em}async terminate(){this.gcScheduler?.stop(),this.indexBackfillerScheduler?.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}};$h.provider={build:()=>new $h};var eg=class extends $h{constructor(e){super(),this.cacheSizeBytes=e}Vc(e,t){V(this.persistence.referenceDelegate instanceof om,46915);let n=this.persistence.referenceDelegate.garbageCollector;return new uu(n,e.asyncQueue,t)}Ic(e){let t=this.cacheSizeBytes===void 0?au.DEFAULT:au.withCacheSize(this.cacheSizeBytes);return new rm((e=>om.C_(e,t)),this.serializer)}},tg=class{async initialize(e,t){this.localStore||(this.localStore=e.localStore,this.sharedClientState=e.sharedClientState,this.datastore=this.createDatastore(t),this.remoteStore=this.createRemoteStore(t),this.eventManager=this.createEventManager(t),this.syncEngine=this.createSyncEngine(t,!e.synchronizeTabs),this.sharedClientState.onlineStateHandler=e=>Lh(this.syncEngine,e,1),this.remoteStore.remoteSyncer.handleCredentialChange=Yh.bind(null,this.syncEngine),await ih(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return function(){return new ph}()}createDatastore(e){let t=El(e.databaseInfo.databaseId),n=Gl(e.databaseInfo);return $l(e.authCredentials,e.appCheckCredentials,n,t)}createRemoteStore(e){return function(e,t,n,r,i){return new Am(e,t,n,r,i)}(this.localStore,this.datastore,e.asyncQueue,(e=>Lh(this.syncEngine,e,0)),function(){return Fl.C()?new Fl:new Nl}())}createSyncEngine(e,t){return function(e,t,n,r,i,a,o){let s=new Oh(e,t,n,r,i,a);return o&&(s.cc=!0),s}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,t)}async terminate(){await async function(e){let t=Ti(e);B(km,`RemoteStore shutting down.`),t.tu.add(5),await Mm(t),t.ru.shutdown(),t.iu.set(`Unknown`)}(this.remoteStore),this.datastore?.terminate(),this.eventManager?.terminate()}};tg.provider={build:()=>new tg};var ng=class{constructor(e){this.observer=e,this.muted=!1}next(e){this.muted||this.observer.next&&this.mc(this.observer.next,e)}error(e){this.muted||(this.observer.error?this.mc(this.observer.error,e):bi(`Uncaught Error in snapshot listener:`,e.toString()))}gc(){this.muted=!0}
787mc(e,t){setTimeout((()=>{this.muted||e(t)}),0)}},rg=`FirestoreClient`,ig=class{constructor(e,t,n,r,i){this.authCredentials=e,this.appCheckCredentials=t,this.asyncQueue=n,this._databaseInfo=r,this.user=hi.UNAUTHENTICATED,this.clientId=Ii.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=i,this.authCredentials.start(n,(async e=>{B(rg,`Received user=`,e.uid),await this.authCredentialListener(e),this.user=e})),this.appCheckCredentials.start(n,(e=>(B(rg,`Received new app check token=`,e),this.appCheckCredentialListener(e,this.user))))}get configuration(){return{asyncQueue:this.asyncQueue,databaseInfo:this._databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(e){this.authCredentialListener=e}setAppCheckTokenChangeListener(e){this.appCheckCredentialListener=e}terminate(){this.asyncQueue.enterRestrictedMode();let e=new Ei;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted((async()=>{try{this._onlineComponents&&await this._onlineComponents.terminate(),this._offlineComponents&&await this._offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),e.resolve()}catch(t){let n=ch(t,`Failed to shutdown persistence`);e.reject(n)}})),e.promise}};async function ag(e,t){e.asyncQueue.verifyOperationInProgress(),B(rg,`Initializing OfflineComponentProvider`);let n=e.configuration;await t.initialize(n);let r=n.initialUser;e.setCredentialChangeListener((async e=>{r.isEqual(e)||(await hm(t.localStore,e),r=e)})),t.persistence.setDatabaseDeletedListener((()=>e.terminate())),e._offlineComponents=t}async function og(e,t){e.asyncQueue.verifyOperationInProgress();let n=await sg(e);B(rg,`Initializing OnlineComponentProvider`),await t.initialize(n,e.configuration),e.setCredentialChangeListener((e=>rh(t.remoteStore,e))),e.setAppCheckTokenChangeListener(((e,n)=>rh(t.remoteStore,n))),e._onlineComponents=t}async function sg(e){if(!e._offlineComponents)if(e._uninitializedComponentsProvider){B(rg,`Using user provided OfflineComponentProvider`);try{await ag(e,e._uninitializedComponentsProvider._offline)}catch(t){let n=t;if(!function(e){return e.name===`FirebaseError`?e.code===H.FAILED_PRECONDITION||e.code===H.UNIMPLEMENTED:!(typeof DOMException<`u`&&e instanceof DOMException)||e.code===22||e.code===20||e.code===11}(n))throw n;xi(`Error using user provided cache. Falling back to memory cache: `+n),await ag(e,new $h)}}else B(rg,`Using default OfflineComponentProvider`),await ag(e,new eg(void 0));return e._offlineComponents}async function cg(e){return e._onlineComponents||(e._uninitializedComponentsProvider?(B(rg,`Using user provided OnlineComponentProvider`),await og(e,e._uninitializedComponentsProvider._online)):(B(rg,`Using default OnlineComponentProvider`),await og(e,new tg))),e._onlineComponents}function lg(e){return cg(e).then((e=>e.syncEngine))}async function ug(e){let t=await cg(e),n=t.eventManager;return n.onListen=kh.bind(null,t.syncEngine),n.onUnlisten=Nh.bind(null,t.syncEngine),n.onFirstRemoteStoreListen=Ah.bind(null,t.syncEngine),n.onLastRemoteStoreUnlisten=Ph.bind(null,t.syncEngine),n}function dg(e,t,n,r){let i=new ng(r),a=new xh(t,i,n);return e.asyncQueue.enqueueAndForget((async()=>hh(await ug(e),a))),()=>{i.gc(),e.asyncQueue.enqueueAndForget((async()=>gh(await ug(e),a)))}}function fg(e,t){let n=new Ei;return e.asyncQueue.enqueueAndForget((async()=>Fh(await lg(e),t,n))),n.promise}var pg=`AsyncQueue`,mg=class{constructor(e=Promise.resolve()){this.qc=[],this.$c=!1,this.Kc=[],this.Wc=null,this.Qc=!1,this.Gc=!1,this.zc=[],this.xn=new Kl(this,`async_queue_retry`),this.jc=()=>{let e=Dm();e&&B(pg,`Visibility state changed to `+e.visibilityState),this.xn.gn()},this.Hc=e;let t=Dm();t&&typeof t.addEventListener==`function`&&t.addEventListener(`visibilitychange`,this.jc)}get isShuttingDown(){return this.$c}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.Jc(),this.Yc(e)}enterRestrictedMode(e){if(!this.$c){this.$c=!0,this.Gc=e||!1;let t=Dm();t&&typeof t.removeEventListener==`function`&&t.removeEventListener(`visibilitychange`,this.jc)}}enqueue(e){if(this.Jc(),this.$c)return new Promise((()=>{}));let t=new Ei;
787return this.Yc((()=>this.$c&&this.Gc?Promise.resolve():(e().then(t.resolve,t.reject),t.promise))).then((()=>t.promise))}enqueueRetryable(e){this.enqueueAndForget((()=>(this.qc.push(e),this.Zc())))}async Zc(){if(this.qc.length!==0){try{await this.qc[0](),this.qc.shift(),this.xn.reset()}catch(e){if(!_a(e))throw e;B(pg,`Operation failed with retryable error: `+e)}this.qc.length>0&&this.xn.mn((()=>this.Zc()))}}Yc(e){let t=this.Hc.then((()=>(this.Qc=!0,e().catch((e=>{throw this.Wc=e,this.Qc=!1,bi(`INTERNAL UNHANDLED ERROR: `,hg(e)),e})).then((e=>(this.Qc=!1,e))))));return this.Hc=t,t}enqueueAfterDelay(e,t,n){this.Jc(),this.zc.indexOf(e)>-1&&(t=0);let r=sh.createAndSchedule(this,e,t,n,(e=>this.Xc(e)));return this.Kc.push(r),r}Jc(){this.Wc&&Ci(47125,{el:hg(this.Wc)})}verifyOperationInProgress(){}async tl(){let e;do e=this.Hc,await e;while(e!==this.Hc)}nl(e){for(let t of this.Kc)if(t.timerId===e)return!0;return!1}rl(e){return this.tl().then((()=>{this.Kc.sort(((e,t)=>e.targetTimeMs-t.targetTimeMs));for(let t of this.Kc)if(t.skipDelay(),e!==`all`&&t.timerId===e)break;return this.tl()}))}il(e){this.zc.push(e)}Xc(e){let t=this.Kc.indexOf(e);this.Kc.splice(t,1)}};function hg(e){let t=e.message||``;return e.stack&&(t=e.stack.includes(e.message)?e.stack:e.message+`
788`+e.stack),t}var gg=class extends gu{constructor(e,t,n,r){super(e,t,n,r),this.type=`firestore`,this._queue=new mg,this._persistenceKey=r?.name||`[DEFAULT]`}async _terminate(){if(this._firestoreClient){let e=this._firestoreClient.terminate();this._queue=new mg(e),this._firestoreClient=void 0,await e}}};function _g(e,t){let n=typeof e==`object`?e:Rn(),r=typeof e==`string`?e:t||J,i=Mn(n,`firestore`).getImmediate({identifier:r});if(!i._initialized){let e=Pe(`firestore`);e&&_u(i,...e)}return i}function vg(e){if(e._terminated)throw new U(H.FAILED_PRECONDITION,`The client has already been terminated.`);return e._firestoreClient||yg(e),e._firestoreClient}function yg(e){let t=e._freezeSettings(),n=nu(e._databaseId,e._app?.options.appId||``,e._persistenceKey,e._app?.options.apiKey,t);e._componentsProvider||t.localCache?._offlineComponentProvider&&t.localCache?._onlineComponentProvider&&(e._componentsProvider={_offline:t.localCache._offlineComponentProvider,_online:t.localCache._onlineComponentProvider}),e._firestoreClient=new ig(e._authCredentials,e._appCheckCredentials,e._queue,n,e._componentsProvider&&function(e){let t=e?._online.build();return{_offline:e?._offline.build(t),_online:t}}(e._componentsProvider))}var bg=class{convertValue(e,t=`none`){switch(oo(e)){case 0:return null;case 1:return e.booleanValue;case 2:return Va(e.integerValue||e.doubleValue);case 3:return this.convertTimestamp(e.timestampValue);case 4:return this.convertServerTimestamp(e,t);case 5:return e.stringValue;case 6:return this.convertBytes(Ha(e.bytesValue));case 7:return this.convertReference(e.referenceValue);case 8:return this.convertGeoPoint(e.geoPointValue);case 9:return this.convertArray(e.arrayValue,t);case 11:return this.convertObject(e.mapValue,t);case 10:return this.convertVectorValue(e.mapValue);default:throw Ci(62114,{value:e})}}convertObject(e,t){return this.convertObjectMap(e.fields,t)}convertObjectMap(e,t=`none`){let n={};return Pa(e,((e,r)=>{n[e]=this.convertValue(r,t)})),n}convertVectorValue(e){let t=e.fields?.[no].arrayValue?.values?.map((e=>Va(e.doubleValue)));return new Cu(t)}convertGeoPoint(e){return new jl(Va(e.latitude),Va(e.longitude))}convertArray(e,t){return(e.values||[]).map((e=>this.convertValue(e,t)))}convertServerTimestamp(e,t){switch(t){case`previous`:let n=Ja(e);return n==null?null:this.convertValue(n,t);case`estimate`:return this.convertTimestamp(Ya(e));default:return null}}convertTimestamp(e){let t=Ba(e);return new aa(t.seconds,t.nanos)}convertDocumentKey(e,t){let n=Gi.fromString(e);V(Sl(n),9688,{name:e});let r=new Xa(n.get(1),n.get(3)),i=new W(n.popFirst(5));return r.isEqual(t)||bi(`Document ${i} contains a document reference within a different database (${r.projectId}/${r.database}) which is not supported. It will be treated as a reference in the current database (${t.projectId}/${t.database}) instead.`),i}},xg=class extends bg{constructor(e){super(),this.firestore=e}convertBytes(e){return new Dl(e)}convertReference(e){let t=this.convertDocumentKey(e,this.firestore._databaseId);
788return new yu(this.firestore,null,t)}},Sg=`@firebase/firestore`,Cg=`4.16.0`;function wg(e){return function(e,t){if(typeof e!=`object`||!e)return!1;let n=e;for(let e of t)if(e in n&&typeof n[e]==`function`)return!0;return!1}(e,[`next`,`error`,`complete`])}var Tg=class{constructor(e,t,n,r,i){this._firestore=e,this._userDataWriter=t,this._key=n,this._document=r,this._converter=i}get id(){return this._key.path.lastSegment()}get ref(){return new yu(this._firestore,this._converter,this._key)}exists(){return this._document!==null}data(){if(this._document){if(this._converter){let e=new Eg(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}_fieldsProto(){return this._document?.data.clone().value.mapValue.fields??void 0}get(e){if(this._document){let t=this._document.data.field(Iu(`DocumentSnapshot.get`,e));if(t!==null)return this._userDataWriter.convertValue(t)}}},Eg=class extends Tg{data(){return super.data()}};function Dg(e){if(e.limitType===`L`&&e.explicitOrderBy.length===0)throw new U(H.UNIMPLEMENTED,`limitToLast() queries require specifying at least one orderBy() clause`)}var Og=class{},kg=class extends Og{};function Ag(e,t,...n){let r=[];t instanceof Og&&r.push(t),r=r.concat(n),function(e){let t=e.filter((e=>e instanceof Mg)).length,n=e.filter((e=>e instanceof jg)).length;if(t>1||t>0&&n>0)throw new U(H.INVALID_ARGUMENT,"InvalidQuery. When using composite filters, you cannot use more than one filter at the top level. Consider nesting the multiple filters within an `and(...)` statement. For example: change `query(query, where(...), or(...))` to `query(query, and(where(...), or(...)))`.")}(r);for(let t of r)e=t._apply(e);return e}var jg=class e extends kg{constructor(e,t,n){super(),this._field=e,this._op=t,this._value=n,this.type=`where`}static _create(t,n,r){return new e(t,n,r)}_apply(e){let t=this._parse(e);return Lg(e._query,t),new vu(e.firestore,e.converter,Xs(e._query,t))}_parse(e){let t=ku(e.firestore);return function(e,t,n,r,i,a,o){let s;if(i.isKeyField()){if(a===`array-contains`||a===`array-contains-any`)throw new U(H.INVALID_ARGUMENT,`Invalid Query. You can't perform '${a}' queries on documentId().`);if(a===`in`||a===`not-in`){Ig(o,a);let t=[];for(let n of o)t.push(Fg(r,e,n));s={arrayValue:{values:t}}}else s=Fg(r,e,o)}else a!==`in`&&a!==`not-in`&&a!==`array-contains-any`||Ig(o,a),s=ju(n,t,o,a===`in`||a===`not-in`);return gs.create(i,a,s)}(e._query,`where`,t,e.firestore._databaseId,this._field,this._op,this._value)}},Mg=class e extends Og{constructor(e,t){super(),this.type=e,this._queryConstraints=t}static _create(t,n){return new e(t,n)}_parse(e){let t=this._queryConstraints.map((t=>t._parse(e))).filter((e=>e.getFilters().length>0));return t.length===1?t[0]:_s.create(t,this._getOperator())}_apply(e){let t=this._parse(e);return t.getFilters().length===0?e:(function(e,t){let n=e,r=t.getFlattenedFilters();for(let e of r)Lg(n,e),n=Xs(n,e)}(e._query,t),new vu(e.firestore,e.converter,Xs(e._query,t)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return this.type===`and`?`and`:`or`}},Ng=class e extends kg{constructor(e,t){super(),this._field=e,this._direction=t,this.type=`orderBy`}static _create(t,n){return new e(t,n)}_apply(e){let t=function(e,t,n){if(e.startAt!==null)throw new U(H.INVALID_ARGUMENT,`Invalid query. You must not call startAt() or startAfter() before calling orderBy().`);if(e.endAt!==null)throw new U(H.INVALID_ARGUMENT,`Invalid query. You must not call endAt() or endBefore() before calling orderBy().`);return new Ms(t,n)}(e._query,this._field,this._direction);return new vu(e.firestore,e.converter,Zs(e._query,t))}};function Pg(e,t=`asc`){let n=t,r=Iu(`orderBy`,e);return Ng._create(r,n)}function Fg(e,t,n){if(typeof(n=st(n))==`string`){if(n===``)throw new U(H.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.`);if(!Ks(t)&&n.indexOf(`/`)!==-1)throw new U(H.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);let r=t.path.child(Gi.fromString(n));if(!W.isDocumentKey(r))throw new U(H.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${r}' is not because it has an odd number of segments (${r.length}).`);return go(e,new W(r))}if(n instanceof yu)return go(e,n._key);throw new U(H.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${$i(n)}.`)}function Ig(e,t){if(!Array.isArray(e)||e.length===0)throw new U(H.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${t.toString()}' filters.`)}function Lg(e,t){let n=function(e,t){for(let n of e)for(let e of n.getFlattenedFilters())if(t.indexOf(e.op)>=0)return e.op;return null}(e.filters,function(e){switch(e){case`!=`:return[`!=`,`not-in`];case`array-contains-any`:case`in`:return[`not-in`];case`not-in`:return[`array-contains-any`,`in`,`not-in`,`!=`];default:return[]}}(t.op));if(n!==null)throw n===t.op?new U(H.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${t.op.toString()}' filter.`):new U(H.INVALID_ARGUMENT,`Invalid query. You cannot use '${t.op.toString()}' filters with '${n.toString()}' filters.`)}function Rg(e,t,n){let r;return r=e?n&&(n.merge||n.mergeFields)?e.toFirestore(t,n):e.toFirestore(t):t,r}var zg=class{constructor(e,t){this.hasPendingWrites=e,this.fromCache=t}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}},Bg=class e extends Tg{constructor(e,t,n,r,i,a){super(e,t,n,r,a),this._firestore=e,this._firestoreImpl=e,this.metadata=i}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){let t=new Vg(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(t,e)}return this._userDataWriter.convertValue(this._document.data.value,e.serverTimestamps)}}get(e,t={}){if(this._document){let n=this._document.data.field(Iu(`DocumentSnapshot.get`,e));if(n!==null)return this._userDataWriter.convertValue(n,t.serverTimestamps)}}toJSON(){if(this.metadata.hasPendingWrites)throw new U(H.FAILED_PRECONDITION,`DocumentSnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().`);let t=this._document,n={};return n.type=e._jsonSchemaVersion,n.bundle=``,n.bundleSource=`DocumentSnapshot`,n.bundleName=this._key.toString(),!t||!t.isValidDocument()||!t.isFoundDocument()?n:(this._userDataWriter.convertObjectMap(t.data.value.mapValue.fields,`previous`),n.bundle=(this._firestore,this.ref.path,`NOT SUPPORTED`),n)}};Bg._jsonSchemaVersion=`firestore/documentSnapshot/1.0`,Bg._jsonSchema={type:ta(`string`,Bg._jsonSchemaVersion),bundleSource:ta(`string`,`DocumentSnapshot`),bundleName:ta(`string`),bundle:ta(`string`)};var Vg=class extends Bg{data(e={}){return super.data(e)}},Hg=class e{constructor(e,t,n,r){this._firestore=e,this._userDataWriter=t,this._snapshot=r,this.metadata=new zg(r.hasPendingWrites,r.fromCache),this.query=n}get docs(){let e=[];return this.forEach((t=>e.push(t))),e}get size(){return this._snapshot.docs.size}get empty(){return this.size===0}forEach(e,t){this._snapshot.docs.forEach((n=>{e.call(t,new Vg(this._firestore,this._userDataWriter,n.key,n,new zg(this._snapshot.mutatedKeys.has(n.key),this._snapshot.fromCache),this.query.converter))}))}docChanges(e={}){let t=!!e.includeMetadataChanges;if(t&&this._snapshot.excludesMetadataChanges)throw new U(H.INVALID_ARGUMENT,`To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().`);return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===t||(this._cachedChanges=function(e,t){if(e._snapshot.oldDocs.isEmpty()){let t=0;return e._snapshot.docChanges.map((n=>{Cp(e._snapshot.query)?Up(e._snapshot.query):e.query._query;let r=new Vg(e._firestore,e._userDataWriter,n.doc.key,n.doc,new zg(e._snapshot.mutatedKeys.has(n.doc.key),e._snapshot.fromCache),e.query.converter);return n.doc,{type:`added`,doc:r,oldIndex:-1,newIndex:t++}}))}{let n=e._snapshot.oldDocs;return e._snapshot.docChanges.filter((e=>t||e.type!==3)).map((t=>{let r=new Vg(e._firestore,e._userDataWriter,t.doc.key,t.doc,new zg(e._snapshot.mutatedKeys.has(t.doc.key),e._snapshot.fromCache),e.query.converter),i=-1,a=-1;return t.type!==0&&(i=n.indexOf(t.doc.key),n=n.delete(t.doc.key)),t.type!==1&&(n=n.add(t.doc),a=n.indexOf(t.doc.key)),{type:Ug(t.type),doc:r,oldIndex:i,newIndex:a}}))}}(this,t),this._cachedChangesIncludeMetadataChanges=t),this._cachedChanges}toJSON(){if(this.metadata.hasPendingWrites)throw new U(H.FAILED_PRECONDITION,`QuerySnapsh
788ot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().`);let t={};t.type=e._jsonSchemaVersion,t.bundleSource=`QuerySnapshot`,t.bundleName=Ii.newId(),this._firestore._databaseId.database,this._firestore._databaseId.projectId;let n=[],r=[],i=[];return this.docs.forEach((e=>{e._document!==null&&(n.push(e._document),r.push(this._userDataWriter.convertObjectMap(e._document.data.value.mapValue.fields,`previous`)),i.push(e.ref.path))})),t.bundle=(this._firestore,this.query._query,t.bundleName,`NOT SUPPORTED`),t}};function Ug(e){switch(e){case 0:return`added`;case 2:case 3:return`modified`;case 1:return`removed`;default:return Ci(61501,{type:e})}}Hg._jsonSchemaVersion=`firestore/querySnapshot/1.0`,Hg._jsonSchema={type:ta(`string`,Hg._jsonSchemaVersion),bundleSource:ta(`string`,`QuerySnapshot`),bundleName:ta(`string`),bundle:ta(`string`)};function Wg(e,t,n){e=ea(e,yu);let r=ea(e.firestore,gg),i=Rg(e.converter,t,n);return Jg(r,[Au(ku(r),`setDoc`,e._key,i,e.converter!==null,n).toMutation(e._key,Zo.none())])}function Gg(e){return Jg(ea(e.firestore,gg),[new us(e._key,Zo.none())])}function Kg(e,t){let n=ea(e.firestore,gg),r=Su(e),i=Rg(e.converter,t);return Jg(n,[Au(ku(e.firestore),`addDoc`,r._key,i,e.converter!==null,{}).toMutation(r._key,Zo.exists(!1))]).then((()=>r))}function qg(e,...t){e=st(e);let n={includeMetadataChanges:!1,source:`default`},r=0;typeof t[r]!=`object`||wg(t[r])||(n=t[r++]);let i={includeMetadataChanges:n.includeMetadataChanges,source:n.source};if(wg(t[r])){let e=t[r];t[r]=e.next?.bind(e),t[r+1]=e.error?.bind(e),t[r+2]=e.complete?.bind(e)}let a,o,s;if(e instanceof yu)o=ea(e.firestore,gg),s=Us(e._key.path),a={next:n=>{t[r]&&t[r](Yg(o,e,n))},error:t[r+1],complete:t[r+2]};else{let n=ea(e,vu);o=ea(n.firestore,gg),s=n._query;let i=new xg(o);a={next:e=>{t[r]&&t[r](new Hg(o,i,n,e))},error:t[r+1],complete:t[r+2]},Dg(e._query)}return dg(vg(o),s,i,a)}function Jg(e,t){return fg(vg(e),t)}function Yg(e,t,n){let r=n.docs.get(t._key);return new Bg(e,new xg(e),t._key,r,new zg(n.hasPendingWrites,n.fromCache),t.converter)}(function(e,t=!0){_i(In),jn(new ut(`firestore`,((e,{instanceIdentifier:n,options:r})=>{let i=e.getProvider(`app`).getImmediate(),a=new gg(new Ai(e.getProvider(`auth-internal`)),new Pi(i,e.getProvider(`app-check-internal`)),Za(i,n),i);return r={useFetchStreams:t,...r},a._setSettings(r),a}),`PUBLIC`).setMultipleInstances(!0)),zn(Sg,Cg,e),zn(Sg,Cg,`esm2020`)})();function Xg(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}var Zg=Xg,Qg=new Xe(`auth`,`Firebase`,Xg()),$g=new St(`@firebase/auth`);function e_(e,...t){$g.logLevel<=_t.WARN&&$g.warn(`Auth (${In}): ${e}`,...t)}function t_(e,...t){$g.logLevel<=_t.ERROR&&$g.error(`Auth (${In}): ${e}`,...t)}function n_(e,...t){throw o_(e,...t)}function r_(e,...t){return o_(e,...t)}function i_(e,t,n){return new Xe(`auth`,`Firebase`,{...Zg(),[t]:n}).create(t,{appName:e.name})}function a_(e){return i_(e,`operation-not-supported-in-this-environment`,`Operations that alter the current user are not supported in conjunction with FirebaseServerApp`)}function o_(e,...t){if(typeof e!=`string`){let n=t[0],r=[...t.slice(1)];return r[0]&&(r[0].appName=e.name),e._errorFactory.create(n,...r)}return Qg.create(e,...t)}function s_(e,t,...n){if(!e)throw o_(t,...n)}function c_(e){let t=`INTERNAL ASSERTION FAILED: `+e;throw t_(t),Error(t)}function l_(e,t){e||c_(t)}function u_(){return typeof self<`u`&&self.location?.href||``}function d_(){return f_()===`http:`||f_()===`https:`}function f_(){return typeof self<`u`&&self.location?.protocol||null}function p_(){return typeof navigator<`u`&&navigator&&`onLine`in navigator&&typeof navigator.onLine==`boolean`&&(d_()||He()||`connection`in navigator)?navigator.onLine:!0}function m_(){if(typeof navigator>`u`)return null;let e=navigator;return e.languages&&e.languages[0]||e.language||null}var h_=class{constructor(e,t){this.shortDelay=e,this.longDelay=t,l_(t>
vendor: 3,609 bytes, line 788
788e,`Short delay should be less than long delay!`),this.isMobile=Be()||Ue()}get(){return p_()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}};function g_(e,t){l_(e.emulator,`Emulator should always be set here`);let{url:n}=e.emulator;return t?`${n}${t.startsWith(`/`)?t.slice(1):t}`:n}var __=class{static initialize(e,t,n){this.fetchImpl=e,t&&(this.headersImpl=t),n&&(this.responseImpl=n)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<`u`&&`fetch`in self)return self.fetch;if(typeof globalThis<`u`&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<`u`)return fetch;c_(`Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill`)}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<`u`&&`Headers`in self)return self.Headers;if(typeof globalThis<`u`&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<`u`)return Headers;c_(`Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill`)}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<`u`&&`Response`in self)return self.Response;if(typeof globalThis<`u`&&globalThis.Response)return globalThis.Response;if(typeof Response<`u`)return Response;c_(`Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill`)}},v_={CREDENTIAL_MISMATCH:`custom-token-mismatch`,MISSING_CUSTOM_TOKEN:`internal-error`,INVALID_IDENTIFIER:`invalid-email`,MISSING_CONTINUE_URI:`internal-error`,INVALID_PASSWORD:`wrong-password`,MISSING_PASSWORD:`missing-password`,INVALID_LOGIN_CREDENTIALS:`invalid-credential`,EMAIL_EXISTS:`email-already-in-use`,PASSWORD_LOGIN_DISABLED:`operation-not-allowed`,INVALID_IDP_RESPONSE:`invalid-credential`,INVALID_PENDING_TOKEN:`invalid-credential`,FEDERATED_USER_ID_ALREADY_LINKED:`credential-already-in-use`,MISSING_REQ_TYPE:`internal-error`,EMAIL_NOT_FOUND:`user-not-found`,RESET_PASSWORD_EXCEED_LIMIT:`too-many-requests`,EXPIRED_OOB_CODE:`expired-action-code`,INVALID_OOB_CODE:`invalid-action-code`,MISSING_OOB_CODE:`internal-error`,CREDENTIAL_TOO_OLD_LOGIN_AGAIN:`requires-recent-login`,INVALID_ID_TOKEN:`invalid-user-token`,TOKEN_EXPIRED:`user-token-expired`,USER_NOT_FOUND:`user-token-expired`,TOO_MANY_ATTEMPTS_TRY_LATER:`too-many-requests`,PASSWORD_DOES_NOT_MEET_REQUIREMENTS:`password-does-not-meet-requirements`,INVALID_CODE:`invalid-verification-code`,INVALID_SESSION_INFO:`invalid-verification-id`,INVALID_TEMPORARY_PROOF:`invalid-credential`,MISSING_SESSION_INFO:`missing-verification-id`,SESSION_EXPIRED:`code-expired`,MISSING_ANDROID_PACKAGE_NAME:`missing-android-pkg-name`,UNAUTHORIZED_DOMAIN:`unauthorized-continue-uri`,INVALID_OAUTH_CLIENT_ID:`invalid-oauth-client-id`,ADMIN_ONLY_OPERATION:`admin-restricted-operation`,INVALID_MFA_PENDING_CREDENTIAL:`invalid-multi-factor-session`,MFA_ENROLLMENT_NOT_FOUND:`multi-factor-info-not-found`,MISSING_MFA_ENROLLMENT_ID:`missing-multi-factor-info`,MISSING_MFA_PENDING_CREDENTIAL:`missing-multi-factor-session`,SECOND_FACTOR_EXISTS:`second-factor-already-in-use`,SECOND_FACTOR_LIMIT_EXCEEDED:`maximum-second-factor-count-exceeded`,BLOCKING_FUNCTION_ERROR_RESPONSE:`internal-error`,RECAPTCHA_NOT_ENABLED:`recaptcha-not-enabled`,MISSING_RECAPTCHA_TOKEN:`missing-recaptcha-token`,INVALID_RECAPTCHA_TOKEN:`invalid-recaptcha-token`,INVALID_RECAPTCHA_ACTION:`invalid-recaptcha-action`,MISSING_CLIENT_TYPE:`missing-client-type`,MISSING_RECAPTCHA_VERSION:`missing-recaptcha-version`,INVALID_RECAPTCHA_VERSION:`invali
788d-recaptcha-version`,INVALID_REQ_TYPE:`invalid-req-type`},y_=[`/v1/accounts:signInWithCustomToken`,`/v1/accounts:signInWithEmailLink`,`/v1/accounts:signInWithIdp`,`/v1/accounts:signInWithPassword`,`/v1/accounts:signInWithPhoneNumber`,`/v1/token`],b_=new h_(3e4,6e4);function x_(e,t){return e.tenantId&&!t.tenantId?{...t,tenantId:e.tenantId}:t}async function S_(e,t,n,r,i={}){return C_(e,i,async()=>{let i={},a={};r&&(t===`GET`?a=r:i={body:JSON.stringify(r)});let o=tt({...a,key:e.config.apiKey}).slice(1),s=await e._getAdditionalHeaders();s[`Content-Type`]=`application/json`,e.languageCode&&(s[`X-Firebase-Locale`]=e.languageCode);let c={method:t,headers:s,...i};return Ve()||(c.referrerPolicy=`strict-origin-when-cross-origin`),e.emulatorConfig&&ct(e.emulatorConfig.host)&&(c.credentials=`include`),__.fetch()(await T_(e,e.config.apiHost,n,o),c)})}async function C_(e,t,n){e._canInitEmulator=!1;let r={...v_,...t};try{let t=new D_(e),i=await Promise.race([n(),t.promise]);t.clearNetworkTimeout();let a=await i.json();if(`needConfirmation`in a)throw O_(e,`account-exists-with-different-credential`,a);if(i.ok&&!(`errorMessage`in a))return a;{let[t,n]=(i.ok?a.errorMessage:a.error.message).split(` : `);if(t===`FEDERATED_USER_ID_ALREADY_LINKED`)throw O_(e,`credential-already-in-use`,a);if(t===`EMAIL_EXISTS`)throw O_(e,`email-already-in-use`,a);if(t===`USER_DISABLED`)throw O_(e,`user-disabled`,a);let o=r[t]||t.toLowerCase().replace(/[_\s]+/g,`-`);if(n)throw i_(e,o,n);n_(e,o)}}catch(t){if(t instanceof Ye)throw t;n_(e,`network-request-failed`,{message:String(t)})}}async function w_(e,t,n,r,i={}){let a=await S_(e,t,n,r,i);return`mfaPendingCredential`in a&&n_(e,`multi-factor-auth-required`,{_serverResponse:a}),a}async function T_(e,t,n,r){let i=`${t}${n}?${r}`,a=e,o=a.config.emulator?g_(e.config,i):`${e.config.apiScheme}://${i}`;return y_.includes(n)&&(await a._persistenceManagerAvailable,a._getPersistenceType()===`COOKIE`)?a._getPersistence()._getFinalTarget(o).toString():o}function E_(e){switch(e){case`ENFORCE`:return`ENFORCE`;case`AUDIT`:return`AUDIT`;case`OFF`:return`OFF`;default:return`ENFORCEMENT_STATE_UNSPECIFIED`}}var D_=class{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((e,t)=>{this.timer=setTimeout(()=>t(r_(this.auth,`network-request-failed`)),b_.get())})}};function O_(e,t,n){let r={appName:e.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);let i=r_(e,t,r);return i.customData._tokenResponse=n,i}function k_(e){return e!==void 0&&e.enterprise!==void 0}var A_=class{constructor(e){if(this.siteKey=``,this.recaptchaEnforcementState=[],e.recaptchaKey===void 0)throw Error(`recaptchaKey undefined`);this.siteKey=e.recaptchaKey.split(`/`)[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||this.recaptchaEnforcementState.length===0)return null;for(let t of this.recaptchaEnforcementState)if(t.provider&&t.provider===e)return E_(t.enforcementState);return null}isProviderEnabled(e){return this.getProviderEnforcementState(e)===`ENFORCE`||this.getProviderEnforcementState(e)===`AUDIT`}isAnyProviderEnabled(){return this.isProviderEnabled(`EMAIL_PASSWORD_PROVIDER`)||this.isProviderEnabled(`PHONE_PROVIDER`)}};async function j_(e,t){return S_(e,`GET`,`/v2/recaptchaConfig`,x_(e,t))}async function M_(e,t){return S_(e,`POST`,`/v1/accounts:delete`,t)}async function N_(e,t){return S_(e,`POST`,`/v1/accounts:lookup`,t)}function P_(e){if(e)try{let t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch{}}async function F_(e,t=!1){let n=st(e),r=await n.getIdToken(t),i=L_(r);s_(i&&i.exp&&i.auth_time&&i.iat,n.auth,`internal-error`);let a=typeof i.firebase==`object`?i.firebase:void 0,o=a?.sign_in_provider;return{claims:i,token:r,authTime:P_(I_(i.auth_time)),issuedAtTime:P_(I_(i.iat)),expirationTime:P_(I_(i.exp)),signInProvider:o||null,signInSecondFactor:a?.sign_in_second_factor||null}}function I_(e){return Number(e)*1e3}function L_(e){let[t,n,r]=e.split(`.`);if(t===void 0||n===void 0||r===void 0)return t_(`JWT malformed, contained fewer than 3 sections`),null;try{let e=De(n);return e?JSON.parse(e):(t_(`Failed to decode base64 JWT payload`),null)}catch(e){return t_(`Caught error parsing JWT payload as JSON`,e?.toString()),null}}function R_(e){let t=L_(e);return s_(t,`internal-error`),s_(t.exp!==void 0,`internal-error`),s_(t.iat!==void 0,`internal-error`),Number(t.exp)-Number(t.iat)}async function z_(e,t,n=!1){if(n)return t;try{return await t}catch(t){throw t instanceof Ye&&B_(t)&&e.auth.currentUser===e&&await e.auth.signOut(),t}}function B_({code:e}){return e===`auth/user-disabled`||e===`auth/user-token-expired`}var V_=class{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){if(e){let e=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),e}else{this.errorBackoff=3e4;let e=(this.user.stsTokenManager.expirationTime??0)-Date.now()-3e5;return Math.max(0,e)}}schedule(e=!1){if(!this.isRunning)return;let t=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},t)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){e?.code===`auth/network-request-failed`&&this.schedule(!0);return}this.schedule()}},H_=class{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=P_(this.lastLoginAt),this.creationTime=P_(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}};async function U_(e){let t=e.auth,n=await z_(e,N_(t,{idToken:await e.getIdToken()}));s_(n?.users.length,t,`internal-error`);let r=n.users[0];e._notifyReloadListener(r);let i=r.providerUserInfo?.length?K_(r.providerUserInfo):[],a=G_(e.providerData,i),o=e.isAnonymous,s=!(e.email&&r.passwordHash)&&!a?.length,c=o?s:!1,l={uid:r.localId,displayName:r.displayName||null,photoURL:r.photoUrl||null,email:r.email||null,emailVerified:r.emailVerified||!1,phoneNumber:r.phoneNumber||null,tenantId:r.tenantId||null,providerData:a,metadata:new H_(r.createdAt,r.lastLoginAt),isAnonymous:c};Object.assign(e,l)}async function W_(e){let t=st(e);await U_(t),await t.auth._persistUserIfCurrent(t),t.auth._notifyListenersIfCurrent(t)}function G_(e,t){return[...e.filter(e=>!t.some(t=>t.providerId===e.providerId)),...t]}function K_(e){return e.map(({providerId:e,...t})=>({providerId:e,uid:t.rawId||``,displayName:t.displayName||null,email:t.email||null,phoneNumber:t.phoneNumber||null,photoURL:t.photoUrl||null}))}async function q_(e,t){let n=await C_(e,{},async()=>{let n=tt({grant_type:`refresh_token`,refresh_token:t}).slice(1),{tokenApiHost:r,apiKey:i}=e.config,a=await T_(e,r,`/v1/token`,`key=${i}`),o=await e._getAdditionalHeaders();o[`Content-Type`]=`application/x-www-form-urlencoded`;let s={method:`POST`,headers:o,body:n};return e.emulatorConfig&&ct(e.emulatorConfig.host)&&(s.credentials=`include`),__.fetch()(a,s)});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function J_(e,t){return S_(e,`POST`,`/v2/accounts:revokeToken`,x_(e,t))}var Y_=class e{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){s_(e.idToken,`internal-error`),s_(e.idToken!==void 0,`internal-error`),s_(e.refreshToken!==void 0,`internal-error`);
788let t=`expiresIn`in e&&e.expiresIn!==void 0?Number(e.expiresIn):R_(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}updateFromIdToken(e){s_(e.length!==0,`internal-error`);let t=R_(e);this.updateTokensAndExpiration(e,null,t)}async getToken(e,t=!1){return!t&&this.accessToken&&!this.isExpired?this.accessToken:(s_(this.refreshToken,e,`user-token-expired`),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,t){let{accessToken:n,refreshToken:r,expiresIn:i}=await q_(e,t);this.updateTokensAndExpiration(n,r,Number(i))}updateTokensAndExpiration(e,t,n){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+n*1e3}static fromJSON(t,n){let{refreshToken:r,accessToken:i,expirationTime:a}=n,o=new e;return r&&(s_(typeof r==`string`,`internal-error`,{appName:t}),o.refreshToken=r),i&&(s_(typeof i==`string`,`internal-error`,{appName:t}),o.accessToken=i),a&&(s_(typeof a==`number`,`internal-error`,{appName:t}),o.expirationTime=a),o}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new e,this.toJSON())}_performRefresh(){return c_(`not implemented`)}};function X_(e,t){s_(typeof e==`string`||e===void 0,`internal-error`,{appName:t})}var Z_=class e{constructor({uid:e,auth:t,stsTokenManager:n,...r}){this.providerId=`firebase`,this.proactiveRefresh=new V_(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=t,this.stsTokenManager=n,this.accessToken=n.accessToken,this.displayName=r.displayName||null,this.email=r.email||null,this.emailVerified=r.emailVerified||!1,this.phoneNumber=r.phoneNumber||null,this.photoURL=r.photoURL||null,this.isAnonymous=r.isAnonymous||!1,this.tenantId=r.tenantId||null,this.providerData=r.providerData?[...r.providerData]:[],this.metadata=new H_(r.createdAt||void 0,r.lastLoginAt||void 0)}async getIdToken(e){let t=await z_(this,this.stsTokenManager.getToken(this.auth,e));return s_(t,this.auth,`internal-error`),this.accessToken!==t&&(this.accessToken=t,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){return F_(this,e)}reload(){return W_(this)}_assign(e){this!==e&&(s_(this.uid===e.uid,this.auth,`internal-error`),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(e=>({...e})),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(t){let n=new e({...this,auth:t,stsTokenManager:this.stsTokenManager._clone()});return n.metadata._copy(this.metadata),n}_onReload(e){s_(!this.reloadListener,this.auth,`internal-error`),this.reloadListener=e,this.reloadUserInfo&&=(this._notifyReloadListener(this.reloadUserInfo),null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,t=!1){let n=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),n=!0),t&&await U_(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(Nn(this.auth.app))return Promise.reject(a_(this.auth));let e=await this.getIdToken();return await z_(this,M_(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return{uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>({...e})),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId,...this.metadata.toJSON(),apiKey:this.auth.config.apiKey,appName:this.auth.name}}get refreshToken(){return this.stsTokenManager.refreshToken||``}static _fromJSON(t,n){let r=n.displayName??void 0,i=n.email??void 0,a=n.phoneNumber??void 0,o=n.photoURL??void 0,s=n.tenantId??void 0,c=n._redirectEventId??void 0,l=n.createdAt??void 0,u=n.lastLoginAt??void 0,{uid:d,emailVerified:f,isAnonymous:p,providerData:m,stsTokenManager:h}=n;s_(d&&h,t,`internal-error`);let g=Y_.fromJSON(this.name,h);s_(typeof d==`string`,t,`internal-error`),X_(r,t.name),X_(i,t.name),s_(typeof f==`boolean`,t,`internal-error`),s_(typeof p==`boolean`,t,`internal-error`),X_(a,t.name),X_(o,t.name),X_(s,t.name),X_(c,t.name),X_(l,t.name),X_(u,t.name);let _=new e({uid:d,auth:t,email:i,emailVerified:f,displayName:r,isAnonymous:p,photoURL:o,phoneNumber:a,tenantId:s,stsTokenManager:g,createdAt:l,lastLoginAt:u});return m&&Array.isArray(m)&&(_.providerData=m.map(e=>({...e}))),c&&(_._redirectEventId=c),_}static async _fromIdTokenResponse(t,n,r=!1){let i=new Y_;i.updateFromServerResponse(n);let a=new e({uid:n.localId,auth:t,stsTokenManager:i,isAnonymous:r});return await U_(a),a}static async _fromGetAccountInfoResponse(t,n,r){let i=n.users[0];s_(i.localId!==void 0,`internal-error`);let a=i.providerUserInfo===void 0?[]:K_(i.providerUserInfo),o=!(i.email&&i.passwordHash)&&!a?.length,s=new Y_;s.updateFromIdToken(r);let c=new e({uid:i.localId,auth:t,stsTokenManager:s,isAnonymous:o}),l={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:a,metadata:new H_(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash)&&!a?.length};return Object.assign(c,l),c}},Q_=new Map;function $_(e){l_(e instanceof Function,`Expected a class definition`);let t=Q_.get(e);return t?(l_(t instanceof e,`Instance stored in cache mismatched with class`),t):(t=new e,Q_.set(e,t),t)}var ev=class{constructor(){this.type=`NONE`,this.storage={}}async _isAvailable(){return!0}async _set(e,t){this.storage[e]=t}async _get(e){let t=this.storage[e];return t===void 0?null:t}async _remove(e){delete this.storage[e]}_addListener(e,t){}_removeListener(e,t){}};ev.type=`NONE`;var tv=ev;function nv(e,t,n){return`firebase:${e}:${t}:${n}`}var rv=class e{constructor(e,t,n){this.persistence=e,this.auth=t,this.userKey=n;let{config:r,name:i}=this.auth;this.fullUserKey=nv(this.userKey,r.apiKey,i),this.fullPersistenceKey=nv(`persistence`,r.apiKey,i),this.boundEventHandler=t._onStorageEvent.bind(t),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){let e=await this.persistence._get(this.fullUserKey);if(!e)return null;if(typeof e==`string`){let t=await N_(this.auth,{idToken:e}).catch(()=>void 0);return t?Z_._fromGetAccountInfoResponse(this.auth,t,e):null}return Z_._fromJSON(this.auth,e)}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;let t=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,t)return this.setCurrentUser(t)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(t,n,r=`authUser`){if(!n.length)return new e($_(tv),t,r);let i=(await Promise.all(n.map(async e=>{if(await e._isAvailable())return e}))).filter(e=>e),a=i[0]||$_(tv),o=nv(r,t.config.apiKey,t.name),s=null;for(let e of n)try{let n=await e._get(o);if(n){let r;if(typeof n==`string`){let e=await N_(t,{idToken:n}).catch(()=>void 0);if(!e)break;r=await Z_._fromGetAccountInfoResponse(t,e,n)}else r=Z_._fromJSON(t,n);e!==a&&(s=r),a=e;break}}catch{}let c=i.filter(e=>e._shouldAllowMigration);return!a._shouldAllowMigration||!c.length?new e(a,t,r):(a=c[0],s&&await a._set(o,s.toJSON()),await Promise.all(n.map(async e=>{if(e!==a)try{await e._remove(o)}catch{}})),new e(a,t,r))}};function iv(e){let t=e.toLowerCase();if(t.includes(`opera/`)||t.includes(`opr/`)||t.includes(`opios/`))return`Opera`;if(cv(t))return`IEMobile`;if(t.includes(`msie`)||t.includes(`trident/`))return`IE`;if(t.includes(`edge/`))return`Edge`;if(av(t))return`Firefox`;if(t.includes(`silk/`))return`Silk`;if(uv(t))return`Blackberry`;if(dv(t))return`Webos`;if(ov(t))return`Safari`;if((t.includes(`chrome/`)||sv(t))&&!t.includes(`edge/`))return`Chrome`;if(lv(t))return`Android`;{let t=e.match(/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/);if(t?.length===2)return t[1]}return`Other`}function av(e=ze()){return/firefox\//i.test(e)}function ov(e=ze()){let t=e.toLowerCase();return t.includes(`safari/`)&&!t.includes(`chrome/`)&&!t.includes(`crios/`)&&!t.includes(`android`)}function sv(e=ze()){return/crios\//i.test(e)}function cv(e=ze()){return/iemobile/i.test(e)}function lv(e=ze()){return/android/i.test(e)}function uv(e=ze()){return/blackberry/i.test(e)}function dv(e=ze()){return/webos/i.test(e)}function fv(e=ze()){return/iphone|ipad|ipod/i.test(e)||/macintosh/i.test(e)&&/mobile/i.test(e)}function pv(e=ze()){return fv(e)&&!!window.navigator?.standalone}function mv(){return We()&&document.documentMode===10}function hv(e=ze()){return fv(e)||lv(e)||dv(e)||uv(e)||/windows phone/i.test(e)||cv(e)}
788function gv(e,t=[]){let n;switch(e){case`Browser`:n=iv(ze());break;case`Worker`:n=`${iv(ze())}-${e}`;break;default:n=e}let r=t.length?t.join(`,`):`FirebaseCore-web`;return`${n}/JsCore/${In}/${r}`}var _v=class{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){let n=t=>new Promise((n,r)=>{try{n(e(t))}catch(e){r(e)}});n.onAbort=t,this.queue.push(n);let r=this.queue.length-1;return()=>{this.queue[r]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;let t=[];try{for(let n of this.queue)await n(e),n.onAbort&&t.push(n.onAbort)}catch(e){t.reverse();for(let e of t)try{e()}catch{}throw this.auth._errorFactory.create(`login-blocked`,{originalMessage:e?.message})}}};async function vv(e,t={}){return S_(e,`GET`,`/v2/passwordPolicy`,x_(e,t))}var yv=6,bv=class{constructor(e){let t=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=t.minPasswordLength??yv,t.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=t.maxPasswordLength),t.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=t.containsLowercaseCharacter),t.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=t.containsUppercaseCharacter),t.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=t.containsNumericCharacter),t.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=t.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState===`ENFORCEMENT_STATE_UNSPECIFIED`&&(this.enforcementState=`OFF`),this.allowedNonAlphanumericCharacters=e.allowedNonAlphanumericCharacters?.join(``)??``,this.forceUpgradeOnSignin=e.forceUpgradeOnSignin??!1,this.schemaVersion=e.schemaVersion}validatePassword(e){let t={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,t),this.validatePasswordCharacterOptions(e,t),t.isValid&&=t.meetsMinPasswordLength??!0,t.isValid&&=t.meetsMaxPasswordLength??!0,t.isValid&&=t.containsLowercaseLetter??!0,t.isValid&&=t.containsUppercaseLetter??!0,t.isValid&&=t.containsNumericCharacter??!0,t.isValid&&=t.containsNonAlphanumericCharacter??!0,t}validatePasswordLengthOptions(e,t){let n=this.customStrengthOptions.minPasswordLength,r=this.customStrengthOptions.maxPasswordLength;n&&(t.meetsMinPasswordLength=e.length>=n),r&&(t.meetsMaxPasswordLength=e.length<=r)}validatePasswordCharacterOptions(e,t){this.updatePasswordCharacterOptionsStatuses(t,!1,!1,!1,!1);let n;for(let r=0;r<e.length;r++)n=e.charAt(r),this.updatePasswordCharacterOptionsStatuses(t,n>=`a`&&n<=`z`,n>=`A`&&n<=`Z`,n>=`0`&&n<=`9`,this.allowedNonAlphanumericCharacters.includes(n))}updatePasswordCharacterOptionsStatuses(e,t,n,r,i){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||=t),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||=n),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||=r),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||=i)}},xv=class{constructor(e,t,n,r){this.app=e,this.heartbeatServiceProvider=t,this.appCheckServiceProvider=n,this.config=r,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Cv(this),this.idTokenSubscription=new Cv(this),this.beforeStateQueue=new _v(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=Qg,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this._resolvePersistenceManagerAvailable=void 0,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=r.sdkClientVersion,this._persistenceManagerAvailable=new Promise(e=>this._resolvePersistenceManagerAvailable=e)}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=$_(t)),this._initializationPromise=this.queue(async()=>
788{if(!this._deleted&&(this.persistenceManager=await rv.create(this,e),this._resolvePersistenceManagerAvailable?.(),!this._deleted)){if(this._popupRedirectResolver?._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(t),this.lastNotifiedUid=this.currentUser?.uid||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;let e=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUserFromIdToken(e){try{let t=await N_(this,{idToken:e}),n=await Z_._fromGetAccountInfoResponse(this,t,e);await this.directlySetCurrentUser(n)}catch(e){console.warn(`FirebaseServerApp could not login user with provided authIdToken: `,e),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){if(Nn(this.app)){let e=this.app.settings.authIdToken;return e?new Promise(t=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(e).then(t,t))}):this.directlySetCurrentUser(null)}let t=await this.assertedPersistence.getCurrentUser(),n=t,r=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();let t=this.redirectUser?._redirectEventId,i=n?._redirectEventId,a=await this.tryRedirectSignIn(e);(!t||t===i)&&a?.user&&(n=a.user,r=!0)}if(!n)return this.directlySetCurrentUser(null);if(!n._redirectEventId){if(r)try{await this.beforeStateQueue.runMiddleware(n)}catch(e){n=t,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(e))}return n?this.reloadAndSetCurrentUserOrClear(n):this.directlySetCurrentUser(null)}return s_(this._popupRedirectResolver,this,`argument-error`),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===n._redirectEventId?this.directlySetCurrentUser(n):this.reloadAndSetCurrentUserOrClear(n)}async tryRedirectSignIn(e){let t=null;try{t=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return t}async reloadAndSetCurrentUserOrClear(e){try{await U_(e)}catch(e){if(e?.code!==`auth/network-request-failed`)return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=m_()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(Nn(this.app))return Promise.reject(a_(this));let t=e?st(e):null;return t&&s_(t.auth.config.apiKey===this.config.apiKey,this,`invalid-user-token`),this._updateCurrentUser(t&&t._clone(this))}async _updateCurrentUser(e,t=!1){if(!this._deleted)return e&&s_(this.tenantId===e.tenantId,this,`tenant-id-mismatch`),t||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return Nn(this.app)?Promise.reject(a_(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return Nn(this.app)?Promise.reject(a_(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence($_(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();let t=this._getPasswordPolicyInternal();return t.schemaVersion===this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?t.validatePassword(e):Promise.reject(this._errorFactory.create(`unsupported-password-policy-schema-version`,{}))}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){let e=new bv(await vv(this));this.tenantId===null?this._projectPasswordPolicy=e:this._tenantPasswordPolicies[this.tenantId]=e}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(e){this._errorFactory=new Xe(`auth`,`Firebase`,e())}onAuthStateChanged(e,t,n){return this.registerStateListener(this.authStateSubscription,e,t,n)}beforeAuthStateChanged(e,t){return this.beforeStateQueue.pushCallback(e,t)}onIdTokenChanged(e,t,n){return this.registerStateListener(this.idTokenSubscription,e,t,n)}authStateReady(){return new Promise((e,t)=>
788{if(this.currentUser)e();else{let n=this.onAuthStateChanged(()=>{n(),e()},t)}})}async revokeAccessToken(e){if(this.currentUser){let t={providerId:`apple.com`,tokenType:`ACCESS_TOKEN`,token:e,idToken:await this.currentUser.getIdToken()};this.tenantId!=null&&(t.tenantId=this.tenantId),await J_(this,t)}}toJSON(){return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:this._currentUser?.toJSON()}}async _setRedirectUser(e,t){let n=await this.getOrInitRedirectPersistenceManager(t);return e===null?n.removeCurrentUser():n.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){let t=e&&$_(e)||this._popupRedirectResolver;s_(t,this,`argument-error`),this.redirectPersistenceManager=await rv.create(this,[$_(t._redirectPersistence)],`redirectUser`),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){return this._isInitialized&&await this.queue(async()=>{}),this._currentUser?._redirectEventId===e?this._currentUser:this.redirectUser?._redirectEventId===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);let e=this.currentUser?.uid??null;this.lastNotifiedUid!==e&&(this.lastNotifiedUid=e,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,t,n,r){if(this._deleted)return()=>{};let i=typeof t==`function`?t:t.next.bind(t),a=!1,o=this._isInitialized?Promise.resolve():this._initializationPromise;if(s_(o,this,`internal-error`),o.then(()=>{a||i(this.currentUser)}),typeof t==`function`){let i=e.addObserver(t,n,r);return()=>{a=!0,i()}}else{let n=e.addObserver(t);return()=>{a=!0,n()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return s_(this.persistenceManager,this,`internal-error`),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=gv(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){let e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e[`X-Firebase-gmpid`]=this.app.options.appId);let t=await this.heartbeatServiceProvider.getImmediate({optional:!0})?.getHeartbeatsHeader();t&&(e[`X-Firebase-Client`]=t);let n=await this._getAppCheckToken();return n&&(e[`X-Firebase-AppCheck`]=n),e}async _getAppCheckToken(){if(Nn(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;let e=await this.appCheckServiceProvider.getImmediate({optional:!0})?.getToken();return e?.error&&e_(`Error while retrieving App Check token: ${e.error}`),e?.token}};function Sv(e){return st(e)}var Cv=class{constructor(e){this.auth=e,this.observer=null,this.addObserver=rt(e=>this.observer=e)}get next(){return s_(this.observer,this.auth,`internal-error`),this.observer.next.bind(this.observer)}},wv={async loadJS(){throw Error(`Unable to load external scripts`)},recaptchaV2Script:``,recaptchaEnterpriseScript:``,gapiScript:``};function Tv(e){wv=e}function Ev(e){return wv.loadJS(e)}function Dv(){return wv.recaptchaEnterpriseScript}function Ov(){return wv.gapiScript}function kv(e){return`__${e}${Math.floor(Math.random()*1e6)}`}var Av=class{constructor(){this.enterprise=new jv}ready(e){e()}execute(e,t){return Promise.resolve(`token`)}render(e,t){return``}},jv=class{ready(e){e()}execute(e,t){return Promise.resolve(`token`)}render(e,t){return``}},Mv=`recaptcha-enterprise`,Nv=`NO_RECAPTCHA`,Pv=`onFirebaseAuthREInstanceReady`,Fv=class e{constructor(e){this.type=Mv,this.auth=Sv(e)}
788async verify(t=`verify`,n=!1){async function r(e){if(!n){if(e.tenantId==null&&e._agentRecaptchaConfig!=null)return e._agentRecaptchaConfig.siteKey;if(e.tenantId!=null&&e._tenantRecaptchaConfigs[e.tenantId]!==void 0)return e._tenantRecaptchaConfigs[e.tenantId].siteKey}return new Promise(async(t,n)=>{j_(e,{clientType:`CLIENT_TYPE_WEB`,version:`RECAPTCHA_ENTERPRISE`}).then(r=>{if(r.recaptchaKey===void 0)n(Error(`recaptcha Enterprise site key undefined`));else{let n=new A_(r);return e.tenantId==null?e._agentRecaptchaConfig=n:e._tenantRecaptchaConfigs[e.tenantId]=n,t(n.siteKey)}}).catch(e=>{n(e)})})}function i(e,n,r){let i=window.grecaptcha;k_(i)?i.enterprise.ready(()=>{i.enterprise.execute(e,{action:t}).then(e=>{n(e)}).catch(()=>{n(Nv)})}):r(Error(`No reCAPTCHA enterprise script loaded.`))}return this.auth.settings.appVerificationDisabledForTesting?new Av().execute(`siteKey`,{action:`verify`}):new Promise((t,a)=>{r(this.auth).then(async r=>{if(!n&&k_(window.grecaptcha)&&e.scriptInjectionDeferred)await e.scriptInjectionDeferred.promise,i(r,t,a);else{if(typeof window>`u`){a(Error(`RecaptchaVerifier is only supported in browser`));return}let n=Dv();n.length!==0&&(n+=r+`&onload=${Pv}`),e.scriptInjectionDeferred=new Le,window[Pv]=()=>{e.scriptInjectionDeferred?.resolve()},Ev(n).then(()=>e.scriptInjectionDeferred?.promise).then(()=>{i(r,t,a)}).catch(e=>{a(e)})}}).catch(e=>{a(e)})})}};Fv.scriptInjectionDeferred=null;async function Iv(e,t,n,r=!1,i=!1){let a=new Fv(e),o;if(i)o=Nv;else try{o=await a.verify(n)}catch{o=await a.verify(n,!0)}let s={...t};if(n===`mfaSmsEnrollment`||n===`mfaSmsSignIn`){if(`phoneEnrollmentInfo`in s){let e=s.phoneEnrollmentInfo.phoneNumber,t=s.phoneEnrollmentInfo.recaptchaToken;Object.assign(s,{phoneEnrollmentInfo:{phoneNumber:e,recaptchaToken:t,captchaResponse:o,clientType:`CLIENT_TYPE_WEB`,recaptchaVersion:`RECAPTCHA_ENTERPRISE`}})}else if(`phoneSignInInfo`in s){let e=s.phoneSignInInfo.recaptchaToken;Object.assign(s,{phoneSignInInfo:{recaptchaToken:e,captchaResponse:o,clientType:`CLIENT_TYPE_WEB`,recaptchaVersion:`RECAPTCHA_ENTERPRISE`}})}return s}return r?Object.assign(s,{captchaResp:o}):Object.assign(s,{captchaResponse:o}),Object.assign(s,{clientType:`CLIENT_TYPE_WEB`}),Object.assign(s,{recaptchaVersion:`RECAPTCHA_ENTERPRISE`}),s}async function Lv(e,t,n,r,i){return i===`EMAIL_PASSWORD_PROVIDER`?e._getRecaptchaConfig()?.isProviderEnabled(`EMAIL_PASSWORD_PROVIDER`)?r(e,await Iv(e,t,n,n===`getOobCode`)):r(e,t).catch(async i=>i.code===`auth/missing-recaptcha-token`?(console.log(`${n} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`),r(e,await Iv(e,t,n,n===`getOobCode`))):Promise.reject(i)):i===`PHONE_PROVIDER`?e._getRecaptchaConfig()?.isProviderEnabled(`PHONE_PROVIDER`)?r(e,await Iv(e,t,n)).catch(async i=>e._getRecaptchaConfig()?.getProviderEnforcementState(`PHONE_PROVIDER`)===`AUDIT`&&(i.code===`auth/missing-recaptcha-token`||i.code===`auth/invalid-app-credential`)?(console.log(`Failed to verify with reCAPTCHA Enterprise. Automatically triggering the reCAPTCHA v2 flow to complete the ${n} flow.`),r(e,await Iv(e,t,n,!1,!0))):Promise.reject(i)):r(e,await Iv(e,t,n,!1,!0)):Promise.reject(i+` provider is not supported.`)}async function Rv(e){let t=Sv(e),n=new A_(await j_(t,{clientType:`CLIENT_TYPE_WEB`,version:`RECAPTCHA_ENTERPRISE`}));t.tenantId==null?t._agentRecaptchaConfig=n:t._tenantRecaptchaConfigs[t.tenantId]=n,n.isAnyProviderEnabled()&&new Fv(t).verify()}function zv(e,t){let n=Mn(e,`auth`);if(n.isInitialized()){let e=n.getImmediate();if($e(n.getOptions(),t??{}))return e;n_(e,`already-initialized`)}return n.initialize({options:t})}function Bv(e,t){let n=t?.persistence||[],r=(Array.isArray(n)?n:[n]).map($_);t?.errorMap&&e._updateErrorMap(t.errorMap),e._initializeWithPersistence(r,t?.popupRedirectResolver)}function Vv(e,t,n){let r=Sv(e);s_(/^https?:\/\//.test(t),r,`invalid-emulator-scheme`);let i=!!n?.disableWarnings,a=Hv(t),{host:o,port:s}=Uv(t),c=s===null?``:`:${s}`,l={url:`${a}//${o}${c}/`},u=Object.freeze({host:o,port:s,protocol:a.replace(`:`,``),options:Object.freeze({disableWarnings:i})});if(!r._canInitEmulator){s_(r.config.emulator&&r.emulatorConfig,r,`emulator-config-failed`),s_($e(l,r.config.emulator)&&$e(u,r.emulatorConfig),r,`emulator-config-failed`);return}r.config.emulator=l,r.emulatorConfig=u,r.settings.appVerificationDisabledForTesting=!0,ct(o)?lt(`${a}//${o}${c}`):i||Gv()}function Hv(e){let t=e.indexOf(`:`);return t<0?``:e.substr(0,t+1)}function Uv(e){let t=Hv(e),n=/(\/\/)?([^?#/]+)/.exec(e.substr(t.length));if(!n)return{host:``,port:null};let r=n[2].split(`@`).pop()||``,i=/^(\[[^\]]+\])(:|$)/.exec(r);if(i){let e=i[1];return{host:e,port:Wv(r.substr(e.length+1))}}else{let[e,t]=r.split(`:`);return{host:e,port:Wv(t)}}}function Wv(e){if(!e)return null;let t=Number(e);return isNaN(t)?null:t}function Gv(){function e(){let e=document.createElement(`p`),t=e.style;e.innerText=`Running in emulator mode. Do not use with production credentials.`,t.position=`fixed`,t.width=`100%`,t.backgroundColor=`#ffffff`,t.border=`.1em solid #000000`,t.color=`#b50000`,t.bottom=`0px`,t.left=`0px`,t.margin=`0px`,t.zIndex=`10000`,t.textAlign=`center`,e.classList.add(`firebase-emulator-warning`),document.body.appendChild(e)}typeof console<`u`&&typeof console.info==`function`&&console.info(`WARNING: You are using the Auth Emulator, which is intended for local testing only.  Do not use with production credentials.`),typeof window<`u`&&typeof document<`u`&&(document.readyState===`loading`?window.addEventListener(`DOMContentLoaded`,e):e())}var Kv=class{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return c_(`not implemented`)}_getIdTokenResponse(e){return c_(`not implemented`)}_linkToIdToken(e,t){return c_(`not implemented`)}_getReauthenticationResolver(e){return c_(`not implemented`)}};async function qv(e,t){return S_(e,`POST`,`/v1/accounts:signUp`,t)}async function Jv(e,t){return w_(e,`POST`,`/v1/accounts:signInWithPassword`,x_(e,t))}async function Yv(e,t){return w_(e,`POST`,`/v1/accounts:signInWithEmailLink`,x_(e,t))}async function Xv(e,t){return w_(e,`POST`,`/v1/accounts:signInWithEmailLink`,x_(e,t))}
788var Zv=class e extends Kv{constructor(e,t,n,r=null){super(`password`,n),this._email=e,this._password=t,this._tenantId=r}static _fromEmailAndPassword(t,n){return new e(t,n,`password`)}static _fromEmailAndCode(t,n,r=null){return new e(t,n,`emailLink`,r)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){let t=typeof e==`string`?JSON.parse(e):e;if(t?.email&&t?.password){if(t.signInMethod===`password`)return this._fromEmailAndPassword(t.email,t.password);if(t.signInMethod===`emailLink`)return this._fromEmailAndCode(t.email,t.password,t.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case`password`:return Lv(e,{returnSecureToken:!0,email:this._email,password:this._password,clientType:`CLIENT_TYPE_WEB`},`signInWithPassword`,Jv,`EMAIL_PASSWORD_PROVIDER`);case`emailLink`:return Yv(e,{email:this._email,oobCode:this._password});default:n_(e,`internal-error`)}}async _linkToIdToken(e,t){switch(this.signInMethod){case`password`:return Lv(e,{idToken:t,returnSecureToken:!0,email:this._email,password:this._password,clientType:`CLIENT_TYPE_WEB`},`signUpPassword`,qv,`EMAIL_PASSWORD_PROVIDER`);case`emailLink`:return Xv(e,{idToken:t,email:this._email,oobCode:this._password});default:n_(e,`internal-error`)}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}};async function Qv(e,t){return w_(e,`POST`,`/v1/accounts:signInWithIdp`,x_(e,t))}var $v=`http://localhost`,ey=class e extends Kv{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(t){let n=new e(t.providerId,t.signInMethod);return t.idToken||t.accessToken?(t.idToken&&(n.idToken=t.idToken),t.accessToken&&(n.accessToken=t.accessToken),t.nonce&&!t.pendingToken&&(n.nonce=t.nonce),t.pendingToken&&(n.pendingToken=t.pendingToken)):t.oauthToken&&t.oauthTokenSecret?(n.accessToken=t.oauthToken,n.secret=t.oauthTokenSecret):n_(`argument-error`),n}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,n
788once:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(t){let{providerId:n,signInMethod:r,...i}=typeof t==`string`?JSON.parse(t):t;if(!n||!r)return null;let a=new e(n,r);return a.idToken=i.idToken||void 0,a.accessToken=i.accessToken||void 0,a.secret=i.secret,a.nonce=i.nonce,a.pendingToken=i.pendingToken||null,a}_getIdTokenResponse(e){return Qv(e,this.buildRequest())}_linkToIdToken(e,t){let n=this.buildRequest();return n.idToken=t,Qv(e,n)}_getReauthenticationResolver(e){let t=this.buildRequest();return t.autoCreate=!1,Qv(e,t)}buildRequest(){let e={requestUri:$v,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{let t={};this.idToken&&(t.id_token=this.idToken),this.accessToken&&(t.access_token=this.accessToken),this.secret&&(t.oauth_token_secret=this.secret),t.providerId=this.providerId,this.nonce&&!this.pendingToken&&(t.nonce=this.nonce),e.postBody=tt(t)}return e}};async function ty(e,t){return S_(e,`POST`,`/v1/accounts:sendVerificationCode`,x_(e,t))}async function ny(e,t){return w_(e,`POST`,`/v1/accounts:signInWithPhoneNumber`,x_(e,t))}async function ry(e,t){let n=await w_(e,`POST`,`/v1/accounts:signInWithPhoneNumber`,x_(e,t));if(n.temporaryProof)throw O_(e,`account-exists-with-different-credential`,n);return n}var iy={USER_NOT_FOUND:`user-not-found`};async function ay(e,t){return w_(e,`POST`,`/v1/accounts:signInWithPhoneNumber`,x_(e,{...t,operation:`REAUTH`}),iy)}var oy=class e extends Kv{constructor(e){super(`phone`,`phone`),this.params=e}static _fromVerification(t,n){return new e({verificationId:t,verificationCode:n})}static _fromTokenResponse(t,n){return new e({phoneNumber:t,temporaryProof:n})}_getIdTokenResponse(e){return ny(e,this._makeVerificationRequest())}_linkToIdToken(e,t){return ry(e,{idToken:t,...this._makeVerificationRequest()})}_getReauthenticationResolver(e){return ay(e,this._makeVerificationRequest())}_makeVerificationRequest(){let{temporaryProof:e,phoneNumber:t,verificationId:n,verificationCode:r}=this.params;return e&&t?{temporaryProof:e,phoneNumber:t}:{sessionInfo:n,code:r}}toJSON(){let e={providerId:this.providerId};return this.params.phoneNumber&&(e.phoneNumber=this.params.phoneNumber),this.params.temporaryProof&&(e.temporaryProof=this.params.temporaryProof),this.params.verificationCode&&(e.verificationCode=this.params.verificationCode),this.params.verificationId&&(e.verificationId=this.params.verificationId),e}static fromJSON(t){typeof t==`string`&&(t=JSON.parse(t));let{verificationId:n,verificationCode:r,phoneNumber:i,temporaryProof:a}=t;return!r&&!n&&!i&&!a?null:new e({verificationId:n,verificationCode:r,phoneNumber:i,temporaryProof:a})}};function sy(e){switch(e){case`recoverEmail`:return`RECOVER_EMAIL`;case`resetPassword`:return`PASSWORD_RESET`;case`signIn`:return`EMAIL_SIGNIN`;case`verifyEmail`:return`VERIFY_EMAIL`;case`verifyAndChangeEmail`:return`VERIFY_AND_CHANGE_EMAIL`;case`revertSecondFactorAddition`:return`REVERT_SECOND_FACTOR_ADDITION`;default:return null}}function cy(e){let t=F(nt(e)).link,n=t?F(nt(t)).deep_link_id:null,r=F(nt(e)).deep_link_id;return(r?F(nt(r)).link:null)||r||n||t||e}var ly=class e{constructor(e){let t=F(nt(e)),n=t.apiKey??null,r=t.oobCode??null,i=sy(t.mode??null);s_(n&&r&&i,`argument-error`),this.apiKey=n,this.operation=i,this.code=r,this.continueUrl=t.continueUrl??null,this.languageCode=t.lang??null,this.tenantId=t.tenantId??null}static parseLink(t){let n=cy(t);try{return new e(n)}catch{return null}}},uy=class e{constructor(){this.providerId=e.PROVIDER_ID}static credential(e,t){return Zv._fromEmailAndPassword(e,t)}static credentialWithLink(e,t){let n=ly.parseLink(t);return s_(n,`argument-error`),Zv._fromEmailAndCode(e,n.code,n.tenantId)}};uy.PROVIDER_ID=`password`,uy.EMAIL_PASSWORD_SIGN_IN_METHOD=`password`,uy.EMAIL_LINK_SIGN_IN_METHOD=`emailLink`;var dy=class{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}},fy=class extends dy{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}},py=class e extends fy{constructor(){super(`facebook.com`)}static credential(t){return ey._fromParams({providerId:e.PROVIDER_ID,signInMethod:e.FACEBOOK_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return e.credentialFromTaggedObject(t)}static credentialFromError(t){return e.credentialFromTaggedObject(t.customData||{})}
788static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!(`oauthAccessToken`in t)||!t.oauthAccessToken)return null;try{return e.credential(t.oauthAccessToken)}catch{return null}}};py.FACEBOOK_SIGN_IN_METHOD=`facebook.com`,py.PROVIDER_ID=`facebook.com`;var my=class e extends fy{constructor(){super(`google.com`),this.addScope(`profile`)}static credential(t,n){return ey._fromParams({providerId:e.PROVIDER_ID,signInMethod:e.GOOGLE_SIGN_IN_METHOD,idToken:t,accessToken:n})}static credentialFromResult(t){return e.credentialFromTaggedObject(t)}static credentialFromError(t){return e.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;let{oauthIdToken:n,oauthAccessToken:r}=t;if(!n&&!r)return null;try{return e.credential(n,r)}catch{return null}}};my.GOOGLE_SIGN_IN_METHOD=`google.com`,my.PROVIDER_ID=`google.com`;var hy=class e extends fy{constructor(){super(`github.com`)}static credential(t){return ey._fromParams({providerId:e.PROVIDER_ID,signInMethod:e.GITHUB_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return e.credentialFromTaggedObject(t)}static credentialFromError(t){return e.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!(`oauthAccessToken`in t)||!t.oauthAccessToken)return null;try{return e.credential(t.oauthAccessToken)}catch{return null}}};hy.GITHUB_SIGN_IN_METHOD=`github.com`,hy.PROVIDER_ID=`github.com`;var gy=class e extends fy{constructor(){super(`twitter.com`)}static credential(t,n){return ey._fromParams({providerId:e.PROVIDER_ID,signInMethod:e.TWITTER_SIGN_IN_METHOD,oauthToken:t,oauthTokenSecret:n})}static credentialFromResult(t){return e.credentialFromTaggedObject(t)}static credentialFromError(t){return e.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;let{oauthAccessToken:n,oauthTokenSecret:r}=t;if(!n||!r)return null;try{return e.credential(n,r)}catch{return null}}};gy.TWITTER_SIGN_IN_METHOD=`twitter.com`,gy.PROVIDER_ID=`twitter.com`;async function _y(e,t){return w_(e,`POST`,`/v1/accounts:signUp`,x_(e,t))}var vy=class e{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(t,n,r,i=!1){let a=await Z_._fromIdTokenResponse(t,r,i),o=yy(r);return new e({user:a,providerId:o,_tokenResponse:r,operationType:n})}static async _forOperation(t,n,r){await t._updateTokensIfNecessary(r,!0);let i=yy(r);return new e({user:t,providerId:i,_tokenResponse:r,operationType:n})}};function yy(e){return e.providerId?e.providerId:`phoneNumber`in e?`phone`:null}async function by(e){if(Nn(e.app))return Promise.reject(a_(e));let t=Sv(e);if(await t._initializationPromise,t.currentUser?.isAnonymous)return new vy({user:t.currentUser,providerId:null,operationType:`signIn`});let n=await _y(t,{returnSecureToken:!0}),r=await vy._fromIdTokenResponse(t,`signIn`,n,!0);return await t._updateCurrentUser(r.user),r}var xy=class e extends Ye{constructor(t,n,r,i){super(n.code,n.message),this.operationType=r,this.user=i,Object.setPrototypeOf(this,e.prototype),this.customData={appName:t.name,tenantId:t.tenantId??void 0,_serverResponse:n.customData._serverResponse,operationType:r}}static _fromErrorAndOperation(t,n,r,i){return new e(t,n,r,i)}};function Sy(e,t,n,r){return(t===`reauthenticate`?n._getReauthenticationResolver(e):n._getIdTokenResponse(e)).catch(n=>{throw n.code===`auth/multi-factor-auth-required`?xy._fromErrorAndOperation(e,n,t,r):n})}async function Cy(e,t,n=!1){let r=await z_(e,t._linkToIdToken(e.auth,await e.getIdToken()),n);return vy._forOperation(e,`link`,r)}async function wy(e,t,n=!1){let{auth:r}=e;if(Nn(r.app))return Promise.reject(a_(r));let i=`reauthenticate`;try{let a=await z_(e,Sy(r,i,t,e),n);s_(a.idToken,r,`internal-error`);let o=L_(a.idToken);s_(o,r,`internal-error`);let{sub:s}=o;return s_(e.uid===s,r,`user-mismatch`),vy._forOperation(e,i,a)}catch(e){throw e?.code===`auth/user-not-found`&&n_(r,`user-mismatch`),e}}async function Ty(e,t,n=!1){if(Nn(e.app))return Promise.reject(a_(e));let r=`signIn`,i=await Sy(e,r,t),a=await vy._fromIdTokenResponse(e,r,i);return n||await e._updateCurrentUser(a.user),a}function Ey(e,t,n,r){return st(e).onIdTokenChanged(t,n,r)}function Dy(e,t,n){return st(e).beforeAuthStateChanged(t,n)}function Oy(e,t){return S_(e,`POST`,`/v2/accounts/mfaEnrollment:start`,x_(e,t))}function ky(e,t){return S_(e,`POST`,`/v2/accounts/mfaEnrollment:finalize`,x_(e,t))}function Ay(e,t){return S_(e,`POST`,`/v2/accounts/mfaEnrollment:start`,x_(e,t))}function jy(e,t){return S_(e,`POST`,`/v2/accounts/mfaEnrollment:finalize`,x_(e,t))}var My=`__sak`,Ny=class{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{return this.storage?(this.storage.setItem(My,`1`),this.storage.removeItem(My),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,t){return this.storage.setItem(e,JSON.stringify(t)),Promise.resolve()}_get(e){let t=this.storage.getItem(e);return Promise.resolve(t?JSON.parse(t):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}},Py=1e3,Fy=10,Iy=class extends Ny{constructor(){super(()=>window.localStorage,`LOCAL`),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=hv(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(let t of Object.keys(this.listeners)){let n=this.storage.getItem(t),r=this.localCache[t];n!==r&&e(t,r,n)}}
vendor: 1,238 bytes, line 788
788onStorageEvent(e,t=!1){if(!e.key){this.forAllChangedKeys((e,t,n)=>{this.notifyListeners(e,n)});return}let n=e.key;t?this.detachListener():this.stopPolling();let r=()=>{let e=this.storage.getItem(n);!t&&this.localCache[n]===e||this.notifyListeners(n,e)},i=this.storage.getItem(n);mv()&&i!==e.newValue&&e.newValue!==e.oldValue?setTimeout(r,Fy):r()}notifyListeners(e,t){this.localCache[e]=t;let n=this.listeners[e];if(n)for(let e of Array.from(n))e(t&&JSON.parse(t))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,t,n)=>{this.onStorageEvent(new StorageEvent(`storage`,{key:e,oldValue:t,newValue:n}),!0)})},Py)}stopPolling(){this.pollTimer&&=(clearInterval(this.pollTimer),null)}attachListener(){window.addEventListener(`storage`,this.boundEventHandler)}detachListener(){window.removeEventListener(`storage`,this.boundEventHandler)}_addListener(e,t){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),this.listeners[e].size===0&&delete this.listeners[e]),Ob
788ject.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,t){await super._set(e,t),this.localCache[e]=JSON.stringify(t)}async _get(e){let t=await super._get(e);return this.localCache[e]=JSON.stringify(t),t}async _remove(e){await super._remove(e),delete this.localCache[e]}};Iy.type=`LOCAL`;var Ly=Iy,Ry=1e3;function zy(e){let t=e.replace(/[\\^$.*+?()[\]{}|]/g,`\\$&`),n=RegExp(`${t}=([^;]+)`);return document.cookie.match(n)?.[1]??null}function By(e){return`${window.location.protocol===`http:`?`__dev_`:`__HOST-`}FIREBASE_${e.split(`:`)[3]}`}var Vy=class{constructor(){this.type=`COOKIE`,this.listenerUnsubscribes=new Map}_getFinalTarget(e){let t=new URL(`${window.location.origin}/__cookies__`);return t.searchParams.set(`finalTarget`,e),t}async _isAvailable(){return typeof isSecureContext==`boolean`&&!isSecureContext||typeof navigator>`u`||typeof document>`u`?!1:navigator.cookieEnabled??!0}async _set(e,t){}async _get(e){if(!this._isAvailable())return null;let t=By(e);return window.cookieStore?(await window.cookieStore.get(t))?.value:zy(t)}async _remove(e){if(!this._isAvailable()||!await this._get(e))return;let t=By(e);document.cookie=`${t}=;Max-Age=34560000;Partitioned;Secure;SameSite=Strict;Path=/;Priority=High`,await fetch(`/__cookies__`,{method:`DELETE`}).catch(()=>void 0)}_addListener(e,t){if(!this._isAvailable())return;let n=By(e);if(window.cookieStore){let e=(e=>{let r=e.changed.find(e=>e.name===n);r&&t(r.value),e.deleted.find(e=>e.name===n)&&t(null)});return this.listenerUnsubscribes.set(t,()=>window.cookieStore.removeEventListener(`change`,e)),window.cookieStore.addEventListener(`change`,e)}let r=zy(n),i=setInterval(()=>{let e=zy(n);e!==r&&(t(e),r=e)},Ry);this.listenerUnsubscribes.set(t,()=>clearInterval(i))}_removeListener(e,t){let n=this.listenerUnsubscribes.get(t);n&&(n(),this.listenerUnsubscribes.delete(t))}};Vy.type=`COOKIE`;var Hy=class extends Ny{constructor(){super(()=>window.sessionStorage,`SESSION`)}_addListener(e,t){}_removeListener(e,t){}};Hy.type=`SESSION`;var Uy=Hy;function Wy(e){return Promise.all(e.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(e){return{fulfilled:!1,reason:e}}}))}var Gy=class e{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(t){let n=this.receivers.find(e=>e.isListeningto(t));if(n)return n;let r=new e(t);return this.receivers.push(r),r}isListeningto(e){return this.eventTarget===e}async handleEvent(e){let t=e,{eventId:n,eventType:r,data:i}=t.data,a=this.handlersMap[r];if(!a?.size)return;t.ports[0].postMessage({status:`ack`,eventId:n,eventType:r});let o=await Wy(Array.from(a).map(async e=>e(t.origin,i)));t.ports[0].postMessage({status:`done`,eventId:n,eventType:r,response:o})}_subscribe(e,t){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener(`message`,this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(t)}_unsubscribe(e,t){this.handlersMap[e]&&t&&this.handlersMap[e].delete(t),(!t||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener(`message`,this.boundEventHandler)}};Gy.receivers=[];function Ky(e=``,t=10){let n=``;for(let e=0;e<t;e++)n+=Math.floor(Math.random()*10);return e+n}var qy=class{constructor(e){this.target=e,this.handlers=new Set}removeMessageHandler(e){e.messageChannel&&(e.messageChannel.port1.removeEventListener(`message`,e.onMessage),e.messageChannel.port1.close()),this.handlers.delete(e)}async _send(e,t,n=50){let r=typeof MessageChannel<`u`?new MessageChannel:null;if(!r)throw Error(`connection_unavailable`);let i,a;return new Promise((o,s)=>{let c=Ky(``,20);r.port1.start();let l=setTimeout(()=>{s(Error(`unsupported_event`))},n);a={messageChannel:r,onMessage(e){let t=e;if(t.data.eventId===c)switch(t.data.status){case`ack`:clearTimeout(l),i=setTimeout(()=>{s(Error(`timeout`))},3e3);break;case`done`:clearTimeout(i),o(t.data.response);break;default:clearTimeout(l),clearTimeout(i),s(Error(`invalid_response`));break}}},this.handlers.add(a),r.port1.addEventListener(`message`,a.onMessage),this.target.postMessage({eventType:e,eventId:c,data:t},[r.port2])}).finally(()=>{a&&this.removeMessageHandler(a)})}};function Jy(){return window}
788function Yy(e){Jy().location.href=e}function Xy(){return Jy().WorkerGlobalScope!==void 0&&typeof Jy().importScripts==`function`}async function Zy(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function Qy(){return navigator?.serviceWorker?.controller||null}function $y(){return Xy()?self:null}var eb=`firebaseLocalStorageDb`,tb=1,nb=`firebaseLocalStorage`,rb=`fbase_key`,ib=class{constructor(e){this.request=e}toPromise(){return new Promise((e,t)=>{this.request.addEventListener(`success`,()=>{e(this.request.result)}),this.request.addEventListener(`error`,()=>{t(this.request.error)})})}};function ab(e,t){return e.transaction([nb],t?`readwrite`:`readonly`).objectStore(nb)}function ob(){return new ib(indexedDB.deleteDatabase(eb)).toPromise()}function sb(){let e=indexedDB.open(eb,tb);return new Promise((t,n)=>{e.addEventListener(`error`,()=>{n(e.error)}),e.addEventListener(`upgradeneeded`,()=>{let t=e.result;try{t.createObjectStore(nb,{keyPath:rb})}catch(e){n(e)}}),e.addEventListener(`success`,async()=>{let n=e.result;n.objectStoreNames.contains(nb)?t(n):(n.close(),await ob(),t(await sb()))})})}async function cb(e,t,n){return new ib(ab(e,!0).put({[rb]:t,value:n})).toPromise()}async function lb(e,t){let n=await new ib(ab(e,!1).get(t)).toPromise();return n===void 0?null:n.value}function ub(e,t){return new ib(ab(e,!0).delete(t)).toPromise()}var db=800,fb=3,pb=class{constructor(){this.type=`LOCAL`,this.dbPromise=null,this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.dbPromise?this.dbPromise:(this.dbPromise=sb(),this.dbPromise.catch(()=>{this.dbPromise=null}),this.dbPromise)}async _withRetries(e){let t=0;for(;;)try{return await e(await this._openDb())}catch(e){if(t++>fb)throw e;this.dbPromise&&=((await this.dbPromise).close(),null)}}async initializeServiceWorkerMessaging(){return Xy()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Gy._getInstance($y()),this.receiver._subscribe(`keyChanged`,async(e,t)=>({keyProcessed:(await this._poll()).includes(t.key)})),this.receiver._subscribe(`ping`,async(e,t)=>[`keyChanged`])}async initializeSender(){if(this.activeServiceWorker=await Zy(),!this.activeServiceWorker)return;this.sender=new qy(this.activeServiceWorker);let e=await this.sender._send(`ping`,{},800);e&&e[0]?.fulfilled&&e[0]?.value.includes(`keyChanged`)&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||Qy()!==this.activeServiceWorker))try{await this.sender._send(`keyChanged`,{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{return indexedDB?(await this._withRetries(async e=>{await cb(e,My,`1`),await ub(e,My)}),!0):!1}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,t){return this._withPendingWrite(async()=>(await this._withRetries(n=>cb(n,e,t)),this.localCache[e]=t,this.notifyServiceWorker(e)))}async _get(e){let t=await this._withRetries(t=>lb(t,e));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(t=>ub(t,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){let e=await this._withRetries(e=>new ib(ab(e,!1).getAll()).toPromise());if(!e||this.pendingWrites!==0)return[];let t=[],n=new Set;if(e.length!==0)for(let{fbase_key:r,value:i}of e)n.add(r),JSON.stringify(this.localCache[r])!==JSON.stringify(i)&&(this.notifyListeners(r,i),t.push(r));for(let e of Object.keys(this.localCache))this.localCache[e]&&!n.has(e)&&(this.notifyListeners(e,null),t.push(e));return t}notifyListeners(e,t){this.localCache[e]=t;let n=this.listeners[e];if(n)for(let e of Array.from(n))e(t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),db)}stopPolling(){this.pollTimer&&=(clearInterval(this.pollTimer),null)}_addListener(e,t){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),this.listeners[e].size===0&&delete this.listeners[e]),Ob
788ject.keys(this.listeners).length===0&&this.stopPolling()}};pb.type=`LOCAL`;var mb=pb;function hb(e,t){return S_(e,`POST`,`/v2/accounts/mfaSignIn:start`,x_(e,t))}function gb(e,t){return S_(e,`POST`,`/v2/accounts/mfaSignIn:finalize`,x_(e,t))}function _b(e,t){return S_(e,`POST`,`/v2/accounts/mfaSignIn:finalize`,x_(e,t))}kv(`rcb`),new h_(3e4,6e4);var vb=`recaptcha`;async function yb(e,t,n){if(!e._getRecaptchaConfig())try{await Rv(e)}catch{console.log(`Failed to initialize reCAPTCHA Enterprise config. Triggering the reCAPTCHA v2 verification.`)}try{let r;if(r=typeof t==`string`?{phoneNumber:t}:t,`session`in r){let t=r.session;if(`phoneNumber`in r)return s_(t.type===`enroll`,e,`internal-error`),(await Lv(e,{idToken:t.credential,phoneEnrollmentInfo:{phoneNumber:r.phoneNumber,clientType:`CLIENT_TYPE_WEB`}},`mfaSmsEnrollment`,async(e,t)=>t.phoneEnrollmentInfo.captchaResponse===Nv?(s_(n?.type===vb,e,`argument-error`),Oy(e,await bb(e,t,n))):Oy(e,t),`PHONE_PROVIDER`).catch(e=>Promise.reject(e))).phoneSessionInfo.sessionInfo;{s_(t.type===`signin`,e,`internal-error`);let i=r.multiFactorHint?.uid||r.multiFactorUid;return s_(i,e,`missing-multi-factor-info`),(await Lv(e,{mfaPendingCredential:t.credential,mfaEnrollmentId:i,phoneSignInInfo:{clientType:`CLIENT_TYPE_WEB`}},`mfaSmsSignIn`,async(e,t)=>t.phoneSignInInfo.captchaResponse===Nv?(s_(n?.type===vb,e,`argument-error`),hb(e,await bb(e,t,n))):hb(e,t),`PHONE_PROVIDER`).catch(e=>Promise.reject(e))).phoneResponseInfo.sessionInfo}}else return(await Lv(e,{phoneNumber:r.phoneNumber,clientType:`CLIENT_TYPE_WEB`},`sendVerificationCode`,async(e,t)=>t.captchaResponse===Nv?(s_(n?.type===vb,e,`argument-error`),ty(e,await bb(e,t,n))):ty(e,t),`PHONE_PROVIDER`).catch(e=>Promise.reject(e))).sessionInfo}finally{n?._reset()}}async function bb(e,t,n){s_(n.type===vb,e,`argument-error`);let r=await n.verify();s_(typeof r==`string`,e,`argument-error`);let i={...t};if(`phoneEnrollmentInfo`in i){let e=i.phoneEnrollmentInfo.phoneNumber,t=i.phoneEnrollmentInfo.captchaResponse,n=i.phoneEnrollmentInfo.clientType,a=i.phoneEnrollmentInfo.recaptchaVersion;return Object.assign(i,{phoneEnrollmentInfo:{phoneNumber:e,recaptchaToken:r,captchaResponse:t,clientType:n,recaptchaVersion:a}}),i}else if(`phoneSignInInfo`in i){let e=i.phoneSignInInfo.captchaResponse,t=i.phoneSignInInfo.clientType,n=i.phoneSignInInfo.recaptchaVersion;return Object.assign(i,{phoneSignInInfo:{recaptchaToken:r,captchaResponse:e,clientType:t,recaptchaVersion:n}}),i}else return Object.assign(i,{recaptchaToken:r}),i}var xb=class e{constructor(t){this.providerId=e.PROVIDER_ID,this.auth=Sv(t)}verifyPhoneNumber(e,t){return yb(this.auth,e,st(t))}static credential(e,t){return oy._fromVerification(e,t)}static credentialFromResult(t){let n=t;return e.credentialFromTaggedObject(n)}static credentialFromError(t){return e.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{phoneNumber:t,temporaryProof:n}=e;return t&&n?oy._fromTokenResponse(t,n):null}};xb.PROVIDER_ID=`phone`,xb.PHONE_SIGN_IN_METHOD=`phone`;function Sb(e,t){return t?$_(t):(s_(e._popupRedirectResolver,e,`argument-error`),e._popupRedirectResolver)}var Cb=class extends Kv{constructor(e){super(`custom`,`custom`),this.params=e}_getIdTokenResponse(e){return Qv(e,this._buildIdpRequest())}_linkToIdToken(e,t){return Qv(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return Qv(e,this._buildIdpRequest())}_buildIdpRequest(e){let t={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(t.idToken=e),t}};function wb(e){return Ty(e.auth,new Cb(e),e.bypassAuthState)}function Tb(e){let{auth:t,user:n}=e;return s_(n,t,`internal-error`),wy(n,new Cb(e),e.bypassAuthState)}async function Eb(e){let{auth:t,user:n}=e;return s_(n,t,`internal-error`),Cy(n,new Cb(e),e.bypassAuthState)}var Db=class{constructor(e,t,n,r,i=!1){this.auth=e,this.resolver=n,this.user=r,this.bypassAuthState=i,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(t)?t:[t]}execute(){return new Promise(async(e,t)=>{this.pendingPromise={resolve:e,reject:t};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(e){this.reject(e)}})}async onAuthEvent(e){let{urlResponse:t,sessionId:n,postBody:r,tenantId:i,error:a,type:o}=e;if(a){this.reject(a);return}let s={auth:this.auth,requestUri:t,sessionId:n,tenantId:i||void 0,postBody:r||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(o)(s))}catch(e){this.reject(e)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case`signInViaPopup`:case`signInViaRedirect`:return wb;case`linkViaPopup`:case`linkViaRedirect`:return Eb;case`reauthViaPopup`:case`reauthViaRedirect`:return Tb;default:n_(this.auth,`internal-error`)}}resolve(e){l_(this.pendingPromise,`Pending promise was never set`),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){l_(this.pendingPromise,`Pending promise was never set`),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}},Ob=new h_(2e3,1e4),kb=class e extends Db{constructor(t,n,r,i,a){super(t,n,i,a),this.provider=r,this.authWindow=null,this.pollId=null,e.currentPopupAction&&e.currentPopupAction.cancel(),e.currentPopupAction=this}async executeNotNull(){let e=await this.execute();return s_(e,this.auth,`internal-error`),e}async onExecution(){l_(this.filter.length===1,`Popup operations only handle one event`);let e=Ky();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(e=>{this.reject(e)}),this.resolver._isIframeWebStorageSupported(this.auth,e=>{e||this.reject(r_(this.auth,`web-storage-unsupported`))}),this.pollUserCancellation()}get eventId(){return this.authWindow?.associatedEvent||null}cancel(){this.reject(r_(this.auth,`cancelled-popup-request`))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,e.currentPopupAction=null}pollUserCancellation(){let e=()=>{if(this.authWindow?.window?.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(r_(this.auth,`popup-closed-by-user`))},8e3);return}this.pollId=window.setTimeout(e,Ob.get())};e()}};kb.currentPopupAction=null;var Ab=`pendingRedirect`,jb=new Map,Mb=class extends Db{constructor(e,t,n=!1){super(e,[`signInViaRedirect`,`linkViaRedirect`,`reauthViaRedirect`,`unknown`],t,void 0,n),this.eventId=null}async execute(){let e=jb.get(this.auth._key());if(!e){try{let t=await Nb(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(t)}catch(t){e=()=>Promise.reject(t)}jb.set(this.auth._key(),e)}return this.bypassAuthState||jb.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if(e.type===`signInViaRedirect`)return super.onAuthEvent(e);
788if(e.type===`unknown`){this.resolve(null);return}if(e.eventId){let t=await this.auth._redirectUserForId(e.eventId);if(t)return this.user=t,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}};async function Nb(e,t){let n=Ib(t),r=Fb(e);if(!await r._isAvailable())return!1;let i=await r._get(n)===`true`;return await r._remove(n),i}function Pb(e,t){jb.set(e._key(),t)}function Fb(e){return $_(e._redirectPersistence)}function Ib(e){return nv(Ab,e.config.apiKey,e.name)}async function Lb(e,t,n=!1){if(Nn(e.app))return Promise.reject(a_(e));let r=Sv(e),i=await new Mb(r,Sb(r,t),n).execute();return i&&!n&&(delete i.user._redirectEventId,await r._persistUserIfCurrent(i.user),await r._setRedirectUser(null,t)),i}var Rb=600*1e3,zb=class{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let t=!1;return this.consumers.forEach(n=>{this.isEventForConsumer(e,n)&&(t=!0,this.sendToConsumer(e,n),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!Hb(e)?t:(this.hasHandledPotentialRedirect=!0,t||=(this.queuedRedirectEvent=e,!0),t)}sendToConsumer(e,t){if(e.error&&!Vb(e)){let n=e.error.code?.split(`auth/`)[1]||`internal-error`;t.onError(r_(this.auth,n))}else t.onAuthEvent(e)}isEventForConsumer(e,t){let n=t.eventId===null||!!e.eventId&&e.eventId===t.eventId;return t.filter.includes(e.type)&&n}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=Rb&&this.cachedEventUids.clear(),this.cachedEventUids.has(Bb(e))}saveEventToCache(e){this.cachedEventUids.add(Bb(e)),this.lastProcessedEventTime=Date.now()}};function Bb(e){return[e.type,e.eventId,e.sessionId,e.tenantId].filter(e=>e).join(`-`)}function Vb({type:e,error:t}){return e===`unknown`&&t?.code===`auth/no-auth-event`}function Hb(e){switch(e.type){case`signInViaRedirect`:case`linkViaRedirect`:case`reauthViaRedirect`:return!0;case`unknown`:return Vb(e);default:return!1}}async function Ub(e,t={}){return S_(e,`GET`,`/v1/projects`,t)}var Wb=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Gb=/^https?/;async function Kb(e){if(e.config.emulator)return;let{authorizedDomains:t}=await Ub(e);for(let e of t)try{if(qb(e))return}catch{}n_(e,`unauthorized-domain`)}function qb(e){let t=u_(),{protocol:n,hostname:r}=new URL(t);if(e.startsWith(`chrome-extension://`)){let i=new URL(e);return i.hostname===``&&r===``?n===`chrome-extension:`&&e.replace(`chrome-extension://`,``)===t.replace(`chrome-extension://`,``):n===`chrome-extension:`&&i.hostname===r}if(!Gb.test(n))return!1;if(Wb.test(e))return r===e;let i=e.replace(/\./g,`\\.`);return RegExp(`^(.+\\.`+i+`|`+i+`)$`,`i`).test(r)}var Jb=new h_(3e4,6e4);function Yb(){let e=Jy().___jsl;if(e?.H){for(let t of Object.keys(e.H))if(e.H[t].r=e.H[t].r||[],e.H[t].L=e.H[t].L||[],e.H[t].r=[...e.H[t].L],e.CP)for(let t=0;t<e.CP.length;t++)e.CP[t]=null}}function Xb(e){return new Promise((t,n)=>{function r(){Yb(),gapi.load(`gapi.iframes`,{callback:()=>{t(gapi.iframes.getContext())},ontimeout:()=>{Yb(),n(r_(e,`network-request-failed`))},timeout:Jb.get()})}if(Jy().gapi?.iframes?.Iframe)t(gapi.iframes.getContext());else if(Jy().gapi?.load)r();else{let t=kv(`iframefcb`);return Jy()[t]=()=>{gapi.load?r():n(r_(e,`network-request-failed`))},Ev(`${Ov()}?onload=${t}`).catch(e=>n(e))}}).catch(e=>{throw Zb=null,e})}var Zb=null;function Qb(e){return Zb||=Xb(e),Zb}var $b=new h_(5e3,15e3),ex=`__/auth/iframe`,tx=`emulator/auth/iframe`,nx={style:{position:`absolute`,top:`-100px`,width:`1px`,height:`1px`},"aria-hidden":`true`,tabindex:`-1`},rx=new Map([[`identitytoolkit.googleapis.com`,`p`],[`staging-identitytoolkit.sandbox.googleapis.com`,`s`],[`test-identitytoolkit.sandbox.googleapis.com`,`t`]]);function ix(e){let t=e.config;s_(t.authDomain,e,`auth-domain-config-required`);let n=t.emulator?g_(t,tx):`https://${e.config.authDomain}/${ex}
788`,r={apiKey:t.apiKey,appName:e.name,v:In},i=rx.get(e.config.apiHost);i&&(r.eid=i);let a=e._getFrameworks();return a.length&&(r.fw=a.join(`,`)),`${n}?${tt(r).slice(1)}`}async function ax(e){let t=await Qb(e),n=Jy().gapi;return s_(n,e,`internal-error`),t.open({where:document.body,url:ix(e),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:nx,dontclear:!0},t=>new Promise(async(n,r)=>{await t.restyle({setHideOnLeave:!1});let i=r_(e,`network-request-failed`),a=Jy().setTimeout(()=>{r(i)},$b.get());function o(){Jy().clearTimeout(a),n(t)}t.ping(o).then(o,()=>{r(i)})}))}var ox={location:`yes`,resizable:`yes`,statusbar:`yes`,toolbar:`no`},sx=500,cx=600,lx=`_blank`,ux=`http://localhost`,dx=class{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}};function fx(e,t,n,r=sx,i=cx){let a=Math.max((window.screen.availHeight-i)/2,0).toString(),o=Math.max((window.screen.availWidth-r)/2,0).toString(),s=``,c={...ox,width:r.toString(),height:i.toString(),top:a,left:o},l=ze().toLowerCase();n&&(s=sv(l)?lx:n),av(l)&&(t||=ux,c.scrollbars=`yes`);let u=Object.entries(c).reduce((e,[t,n])=>`${e}${t}=${n},`,``);if(pv(l)&&s!==`_self`)return px(t||``,s),new dx(null);let d=window.open(t||``,s,u);s_(d,e,`popup-blocked`);try{d.focus()}catch{}return new dx(d)}function px(e,t){let n=document.createElement(`a`);n.href=e,n.target=t;let r=document.createEvent(`MouseEvent`);r.initMouseEvent(`click`,!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(r)}var mx=`__/auth/handler`,hx=`emulator/auth/handler`,gx=`fac`;async function _x(e,t,n,r,i,a){s_(e.config.authDomain,e,`auth-domain-config-required`),s_(e.config.apiKey,e,`invalid-api-key`);let o={apiKey:e.config.apiKey,appName:e.name,authType:n,redirectUrl:r,v:In,eventId:i};if(t instanceof dy){t.setDefaultLanguage(e.languageCode),o.providerId=t.providerId||``,Qe(t.getCustomParameters())||(o.customParameters=JSON.stringify(t.getCustomParameters()));for(let[e,t]of Object.entries(a||{}))o[e]=t}if(t instanceof fy){let e=t.getScopes().filter(e=>e!==``);e.length>0&&(o.scopes=e.join(`,`))}e.tenantId&&(o.tid=e.tenantId);let s=o;for(let e of Object.keys(s))s[e]===void 0&&delete s[e];let c=await e._getAppCheckToken(),l=c?`#${gx}=${encodeURIComponent(c)}`:``;return`${vx(e)}?${tt(s).slice(1)}${l}`}function vx({config:e}){return e.emulator?g_(e,hx):`https://${e.authDomain}/${mx}`}var yx=`webStorageSupport`,bx=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=Uy,this._completeRedirectFn=Lb,this._overrideRedirectResult=Pb}async _openPopup(e,t,n,r){return l_(this.eventManagers[e._key()]?.manager,`_initialize() not called before _openPopup()`),fx(e,await _x(e,t,n,u_(),r),Ky())}async _openRedirect(e,t,n,r){return await this._originValidation(e),Yy(await _x(e,t,n,u_(),r)),new Promise(()=>{})}_initialize(e){let t=e._key();if(this.eventManagers[t]){let{manager:e,promise:n}=this.eventManagers[t];return e?Promise.resolve(e):(l_(n,`If manager is not set, promise should be`),n)}let n=this.initAndGetManager(e);return this.eventManagers[t]={promise:n},n.catch(()=>{delete this.eventManagers[t]}),n}async initAndGetManager(e){let t=await ax(e),n=new zb(e);return t.register(`authEvent`,t=>(s_(t?.authEvent,e,`invalid-auth-event`),{status:n.onEvent(t.authEvent)?`ACK`:`ERROR`}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:n},this.iframes[e._key()]=t,n}_isIframeWebStorageSupported(e,t){this.iframes[e._key()].send(yx,{type:yx},n=>{let r=n?.[0]?.[yx];r!==void 0&&t(!!r),n_(e,`internal-error`)},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){let t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=Kb(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return hv()||ov()||fv()}},xx=class{constructor(e){this.factorId=e}_process(e,t,n){switch(t.type){case`enroll`:return this._finalizeEnroll(e,t.credential,n);case`signin`:return this._finalizeSignIn(e,t.credential);default:return c_(`unexpected MultiFactorSessionType`)}}}
788,Sx=class e extends xx{constructor(e){super(`phone`),this.credential=e}static _fromCredential(t){return new e(t)}_finalizeEnroll(e,t,n){return ky(e,{idToken:t,displayName:n,phoneVerificationInfo:this.credential._makeVerificationRequest()})}_finalizeSignIn(e,t){return gb(e,{mfaPendingCredential:t,phoneVerificationInfo:this.credential._makeVerificationRequest()})}},Cx=class{constructor(){}static assertion(e){return Sx._fromCredential(e)}};Cx.FACTOR_ID=`phone`;var wx=class{static assertionForEnrollment(e,t){return Tx._fromSecret(e,t)}static assertionForSignIn(e,t){return Tx._fromEnrollmentId(e,t)}static async generateSecret(e){let t=e;s_(t.user?.auth!==void 0,`internal-error`);let n=await Ay(t.user.auth,{idToken:t.credential,totpEnrollmentInfo:{}});return Ex._fromStartTotpMfaEnrollmentResponse(n,t.user.auth)}};wx.FACTOR_ID=`totp`;var Tx=class e extends xx{constructor(e,t,n){super(`totp`),this.otp=e,this.enrollmentId=t,this.secret=n}static _fromSecret(t,n){return new e(n,void 0,t)}static _fromEnrollmentId(t,n){return new e(n,t)}async _finalizeEnroll(e,t,n){return s_(this.secret!==void 0,e,`argument-error`),jy(e,{idToken:t,displayName:n,totpVerificationInfo:this.secret._makeTotpVerificationInfo(this.otp)})}async _finalizeSignIn(e,t){s_(this.enrollmentId!==void 0&&this.otp!==void 0,e,`argument-error`);let n={verificationCode:this.otp};return _b(e,{mfaPendingCredential:t,mfaEnrollmentId:this.enrollmentId,totpVerificationInfo:n})}},Ex=class e{constructor(e,t,n,r,i,a,o){this.sessionInfo=a,this.auth=o,this.secretKey=e,this.hashingAlgorithm=t,this.codeLength=n,this.codeIntervalSeconds=r,this.enrollmentCompletionDeadline=i}static _fromStartTotpMfaEnrollmentResponse(t,n){return new e(t.totpSessionInfo.sharedSecretKey,t.totpSessionInfo.hashingAlgorithm,t.totpSessionInfo.verificationCodeLength,t.totpSessionInfo.periodSec,new Date(t.totpSessionInfo.finalizeEnrollmentTime).toUTCString(),t.totpSessionInfo.sessionInfo,n)}_makeTotpVerificationInfo(e){return{sessionInfo:this.sessionInfo,verificationCode:e}}generateQrCodeUrl(e,t){let n=!1;return(Dx(e)||Dx(t))&&(n=!0),n&&(Dx(e)&&(e=this.auth.currentUser?.email||`unknownuser`),Dx(t)&&(t=this.auth.name)),`otpauth://totp/${t}:${e}?secret=${this.secretKey}&issuer=${t}&algorithm=${this.hashingAlgorithm}&digits=${this.codeLength}`}};function Dx(e){return e===void 0||e?.length===0}var Ox=`@firebase/auth`,kx=`1.13.3`,Ax=class{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){return this.assertAuthConfigured(),this.auth.currentUser?.uid||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;let t=this.auth.onIdTokenChanged(t=>{e(t?.stsTokenManager.accessToken||null)});this.internalListeners.set(e,t),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();let t=this.internalListeners.get(e);t&&(this.internalListeners.delete(e),t(),this.updateProactiveRefresh())}assertAuthConfigured(){s_(this.auth._initializationPromise,`dependent-sdk-initialized-before-auth`)}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}};function jx(e){switch(e){case`Node`:return`node`;case`ReactNative`:return`rn`;case`Worker`:return`webworker`;case`Cordova`:return`cordova`;case`WebExtension`:return`web-extension`;default:return}}function Mx(e){jn(new ut(`auth`,(t,{options:n})=>{let r=t.getProvider(`app`).getImmediate(),i=t.getProvider(`heartbeat`),a=t.getProvider(`app-check-internal`),{apiKey:o,authDomain:s}=r.options;s_(o&&!o.includes(`:`),`invalid-api-key`,{appName:r.name});let c=new xv(r,i,a,{apiKey:o,authDomain:s,clientPlatform:e,apiHost:`identitytoolkit.googleapis.com`,tokenApiHost:`securetoken.googleapis.com`,apiScheme:`https`,sdkClientVersion:gv(e)});return Bv(c,n),c},`PUBLIC`).setInstantiationMode(`EXPLICIT`).setInstanceCreatedCallback((e,t,n)=>{e.getProvider(`auth-internal`).initialize()})),jn(new ut(`auth-internal`,e=>(e=>new Ax(e))(Sv(e.getProvider(`auth`).getImmediate())),`PRIVATE`).setInstantiationMode(`EXPLICIT`)),zn(Ox,kx,jx(e)),zn(Ox,kx,`esm2020`)}var Nx=Ie(`authIdTokenMaxAge`)||300,Px=null,Fx=e=>async t=>{let n=t&&await t.getIdTokenResult(),r=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(r&&r>Nx)return;let i=n?.token;
788Px!==i&&(Px=i,await fetch(e,{method:i?`POST`:`DELETE`,headers:i?{Authorization:`Bearer ${i}`}:{}}))};function Ix(e=Rn()){let t=Mn(e,`auth`);if(t.isInitialized())return t.getImmediate();let n=zv(e,{popupRedirectResolver:bx,persistence:[mb,Ly,Uy]}),r=Ie(`authTokenSyncURL`);if(r&&typeof isSecureContext==`boolean`&&isSecureContext){let e=new URL(r,location.origin);if(location.origin===e.origin){let t=Fx(e.toString());Dy(n,t,()=>t(n.currentUser)),Ey(n,e=>t(e))}}let i=Ne(`auth`);return i&&Vv(n,`http://${i}`),n}function Lx(){return document.getElementsByTagName(`head`)?.[0]??document}Tv({loadJS(e){return new Promise((t,n)=>{let r=document.createElement(`script`);r.setAttribute(`src`,e),r.onload=t,r.onerror=e=>{let t=r_(`internal-error`);t.customData=e,n(t)},r.type=`text/javascript`,r.charset=`UTF-8`,Lx().appendChild(r)})},gapiScript:`https://apis.google.com/js/api.js`,recaptchaV2Script:`https://www.google.com/recaptcha/api.js`,recaptchaEnterpriseScript:`https://www.google.com/recaptcha/enterprise.js?render=`}),Mx(`Browser`);var Rx=`@firebase/ai`,zx=`2.13.1`,Bx=`AI`,Vx=`us-central1`,Hx=`firebasevertexai.googleapis.com`,Ux=`v1beta`,Wx=zx,Gx=`gl-js`,Kx=`hybrid`,qx=180*1e3,Jx=`gemini-2.5-flash-lite`,Yx=class e extends Ye{constructor(t,n,r){let i=Bx,a=`${i}: ${n} (${`${i}/${t}`})`;super(t,a),this.code=t,this.customErrorData=r,Error.captureStackTrace&&Error.captureStackTrace(this,e),Object.setPrototypeOf(this,e.prototype),this.toString=()=>a}},Xx=[`user`,`model`,`function`,`system`],Zx={HARM_SEVERITY_NEGLIGIBLE:`HARM_SEVERITY_NEGLIGIBLE`,HARM_SEVERITY_LOW:`HARM_SEVERITY_LOW`,HARM_SEVERITY_MEDIUM:`HARM_SEVERITY_MEDIUM`,HARM_SEVERITY_HIGH:`HARM_SEVERITY_HIGH`,HARM_SEVERITY_UNSUPPORTED:`HARM_SEVERITY_UNSUPPORTED`},Qx={STOP:`STOP`,MAX_TOKENS:`MAX_TOKENS`,SAFETY:`SAFETY`,RECITATION:`RECITATION`,OTHER:`OTHER`,BLOCKLIST:`BLOCKLIST`,PROHIBITED_CONTENT:`PROHIBITED_CONTENT`,SPII:`SPII`,MALFORMED_FUNCTION_CALL:`MALFORMED_FUNCTION_CALL`,IMAGE_SAFETY:`IMAGE_SAFETY`,IMAGE_PROHIBITED_CONTENT:`IMAGE_PROHIBITED_CONTENT`,IMAGE_OTHER:`IMAGE_OTHER`,NO_IMAGE:`NO_IMAGE`,IMAGE_RECITATION:`IMAGE_RECITATION`,LANGUAGE:`LANGUAGE`,UNEXPECTED_TOOL_CALL:`UNEXPECTED_TOOL_CALL`,TOO_MANY_TOOL_CALLS:`TOO_MANY_TOOL_CALLS`,MISSING_THOUGHT_SIGNATURE:`MISSING_THOUGHT_SIGNATURE`,MALFORMED_RESPONSE:`MALFORMED_RESPONSE`},$x={PREFER_ON_DEVICE:`prefer_on_device`,ONLY_ON_DEVICE:`only_on_device`,ONLY_IN_CLOUD:`only_in_cloud`,PREFER_IN_CLOUD:`prefer_in_cloud`},eS={ON_DEVICE:`on_device`,IN_CLOUD:`in_cloud`},tS={ERROR:`error`,REQUEST_ERROR:`request-error`,RESPONSE_ERROR:`response-error`,FETCH_ERROR:`fetch-error`,SESSION_CLOSED:`session-closed`,INVALID_CONTENT:`invalid-content`,API_NOT_ENABLED:`api-not-enabled`,INVALID_SCHEMA:`invalid-schema`,NO_API_KEY:`no-api-key`,NO_APP_ID:`no-app-id`,NO_MODEL:`no-model`,NO_PROJECT_ID:`no-project-id`,PARSE_FAILED:`parse-failed`,UNSUPPORTED:`unsupported`},nS={VERTEX_AI:`VERTEX_AI`,GOOGLE_AI:`GOOGLE_AI`},rS=class{constructor(e){this.backendType=e}},iS=class extends rS{constructor(){super(nS.GOOGLE_AI)}_getModelPath(e,t){return`/${Ux}/projects/${e}/${t}`}_getTemplatePath(e,t){return`/${Ux}/projects/${e}/templates/${t}`}},aS=class extends rS{constructor(e=Vx){super(nS.VERTEX_AI),e?this.location=e:this.location=Vx}_getModelPath(e,t){return`/${Ux}/projects/${e}/locations/${this.location}/${t}`}_getTemplatePath(e,t){return`/${Ux}/projects/${e}/locations/${this.location}/templates/${t}`}};function oS(e){if(e instanceof iS)return`${Bx}/googleai`;if(e instanceof aS)return`${Bx}/vertexai/${e.location}`;throw new Yx(tS.ERROR,`Invalid backend: ${JSON.stringify(e.backendType)}`)}function sS(e){let t=e.split(`/`);if(t[0]!==Bx)throw new Yx(tS.ERROR,`Invalid instance identifier, unknown prefix '${t[0]}'`);switch(t[1]){case`vertexai`:let n=t[2];if(!n)throw new Yx(tS.ERROR,`Invalid instance identifier, unknown location '${e}'`);return new aS(n);case`googleai`:return new iS;default:throw new Yx(tS.ERROR,`Invalid instance identifier string: '${e}'`)}}var cS=new St(`@firebase/vertexai`),lS;(function(e){e.UNAVAILABLE=`unavailable`,e.DOWNLOADABLE=`downloadable`,e.DOWNLOADING=`downloading`,e.AVAILABLE=`available`})(lS||={});var uS={type:`text`,languages:[`en`]},dS=[uS,{type:`image`}],fS=[uS],pS=class e{constructor(e,t,n){this.languageModelProvider=e,this.mode=t,this.downloadPromise=null,this.onDeviceParams={createOptions:{expectedInputs:dS,expectedOutputs:fS}},n&&(this.onDeviceParams=n,this.onDeviceParams.createOptions?(this.onDeviceParams.createOptions.expectedInputs||(this.onDeviceParams.createOptions.expectedInputs=dS),this.onDeviceParams.createOptions.expectedOutputs||(this.onDeviceParams.createOptions.expectedOutputs=fS)):this.onDeviceParams.createOptions={expectedInputs:dS,expectedOutputs:fS})}async isAvailable(t){if(!this.mode)return cS.debug(`On-device inference unavailable because mode is undefined.`),!1;if(this.mode===$x.ONLY_IN_CLOUD)return cS.debug(`On-device inference unavailable because mode is "only_in_cloud".`),!1;let n=await this.languageModelProvider?.availability(this.onDeviceParams.createOptions);if(this.mode===$x.ONLY_ON_DEVICE){if(n===lS.UNAVAILABLE)throw new Yx(tS.API_NOT_ENABLED,`Local LanguageModel API not available in this environment.`);if(n===lS.DOWNLOADABLE||n===lS.DOWNLOADING){cS.debug(`Waiting for download of LanguageModel to complete.`);try{await this.downloadPromise}catch(e){throw new Yx(tS.ERROR,e.message)}return!0}return!0}
788return n===lS.AVAILABLE?e.isOnDeviceRequest(t)?!0:(cS.debug(`On-device inference unavailable because request is incompatible.`),!1):(cS.debug(`On-device inference unavailable because availability is "${n}".`),!1)}async generateContent(t){let n=await this.createSession(),r=await Promise.all(t.contents.map(e.toLanguageModelMessage)),i=await n.prompt(r,this.onDeviceParams.promptOptions);return e.toResponse(i)}async generateContentStream(t){let n=await this.createSession(),r=await Promise.all(t.contents.map(e.toLanguageModelMessage)),i=n.promptStreaming(r,this.onDeviceParams.promptOptions);return e.toStreamResponse(i)}async countTokens(e){throw new Yx(tS.REQUEST_ERROR,`Count Tokens is not yet available for on-device model.`)}static isOnDeviceRequest(t){if(t.contents.length===0)return cS.debug(`Empty prompt rejected for on-device inference.`),!1;for(let n of t.contents){if(n.role===`function`)return cS.debug(`"Function" role rejected for on-device inference.`),!1;for(let t of n.parts)if(t.inlineData&&e.SUPPORTED_MIME_TYPES.indexOf(t.inlineData.mimeType)===-1)return cS.debug(`Unsupported mime type "${t.inlineData.mimeType}" rejected for on-device inference.`),!1}return!0}async downloadIfAvailable(e){let t=await this.languageModelProvider?.availability(this.onDeviceParams.createOptions);return(t===lS.DOWNLOADABLE||t===lS.DOWNLOADING)&&this.download(e),t}download(e){if(this.downloadPromise)return;let t={...this.onDeviceParams.createOptions};t&&!t.monitor&&e&&(t.monitor=t=>{t.addEventListener(`downloadprogress`,t=>{e(t.loaded)})}),this.downloadPromise=this.languageModelProvider?.create(t).finally(()=>{this.downloadPromise=null})}static async toLanguageModelMessage(t){let n=await Promise.all(t.parts.map(e.toLanguageModelMessageContent));return{role:e.toLanguageModelMessageRole(t.role),content:n}}static async toLanguageModelMessageContent(e){if(e.text)return{type:`text`,value:e.text};if(e.inlineData){let t=await(await fetch(`data:${e.inlineData.mimeType};base64,${e.inlineData.data}`)).blob();return{type:`image`,value:await createImageBitmap(t)}}throw new Yx(tS.REQUEST_ERROR,`Processing of this Part type is not currently supported.`)}static toLanguageModelMessageRole(e){return e===`model`?`assistant`:`user`}async createSession(){if(!this.languageModelProvider)throw new Yx(tS.UNSUPPORTED,`Chrome AI requested for unsupported browser version.`);let e=await this.languageModelProvider.create(this.onDeviceParams.createOptions);return this.oldSession&&this.oldSession.destroy(),this.oldSession=e,e}static toResponse(e){return{json:async()=>({candidates:[{content:{parts:[{text:e}]}}]})}}static toStreamResponse(e){let t=new TextEncoder;return{body:e.pipeThrough(new TransformStream({transform(e,n){let r=JSON.stringify({candidates:[{content:{role:`model`,parts:[{text:e}]}}]});n.enqueue(t.encode(`data: ${r}\n\n`))}}))}}};pS.SUPPORTED_MIME_TYPES=[`image/jpeg`,`image/png`];function mS(e,t,n){if(t!==void 0&&e)return new pS(t.LanguageModel,e,n)}var hS=class{constructor(e,t,n,r,i){this.app=e,this.backend=t,this.chromeAdapterFactory=i;let a=r?.getImmediate({optional:!0}),o=n?.getImmediate({optional:!0});this.auth=o||null,this.appCheck=a||null,t instanceof aS?this.location=t.location:this.location=``}_delete(){return Promise.resolve()}set options(e){this._options=e}get options(){return this._options}};function gS(e,{instanceIdentifier:t}){if(!t)throw new Yx(tS.ERROR,`AIService instance identifier is undefined.`);let n=sS(t);return new hS(e.getProvider(`app`).getImmediate(),n,e.getProvider(`auth-internal`),e.getProvider(`app-check-internal`),mS)}function _S(e){if(!e.app?.options?.apiKey)throw new Yx(tS.NO_API_KEY,`The "apiKey" field is empty in the local Firebase config. Firebase AI requires this field to contain a valid API key.`);if(!e.app?.options?.projectId)throw new Yx(tS.NO_PROJECT_ID,`The "projectId" field is empty in the local Firebase config. Firebase AI requires this field to contain a valid project ID.`);if(!e.app?.options?.appId)throw new Yx(tS.NO_APP_ID,`The "appId" field is empty in the local Firebase config. Firebase AI requires this field to contain a valid app ID.`);let t={apiKey:e.app.options.apiKey,project:e.app.options.projectId,appId:e.app.options.appId,automaticDataCollectionEnabled:e.app.automaticDataCollectionEnabled,location:e.location,backend:e.backend};if(Nn(e.app)&&e.app.settings.appCheckToken){let n=e.app.settings.appCheckToken;t.getAppCheckToken=()=>Promise.resolve({token:n})}
788else e.appCheck&&(e.options?.useLimitedUseAppCheckTokens?t.getAppCheckToken=()=>e.appCheck.getLimitedUseToken():t.getAppCheckToken=()=>e.appCheck.getToken());return e.auth&&(t.getAuthToken=()=>e.auth.getToken()),t}var vS=class e{constructor(t,n){this._apiSettings=_S(t),this.model=e.normalizeModelName(n,this._apiSettings.backend.backendType)}static normalizeModelName(t,n){return n===nS.GOOGLE_AI?e.normalizeGoogleAIModelName(t):e.normalizeVertexAIModelName(t)}static normalizeGoogleAIModelName(e){return`models/${e}`}static normalizeVertexAIModelName(e){let t;return t=e.includes(`/`)?e.startsWith(`models/`)?`publishers/google/${e}`:e:`publishers/google/models/${e}`,t}},yS=`Timeout has expired.`,bS=`AbortError`,xS=class{constructor(e){this.params=e}toString(){let e=new URL(this.baseUrl);return e.pathname=this.pathname,e.search=this.queryParams.toString(),e.toString()}get pathname(){return this.params.templateId?`${this.params.apiSettings.backend._getTemplatePath(this.params.apiSettings.project,this.params.templateId)}:${this.params.task}`:`${this.params.apiSettings.backend._getModelPath(this.params.apiSettings.project,this.params.model)}:${this.params.task}`}get baseUrl(){return this.params.singleRequestOptions?.baseUrl??`https://${Hx}`}get queryParams(){let e=new URLSearchParams;return this.params.stream&&e.set(`alt`,`sse`),e}};function SS(e){let t=[];return t.push(`${Gx}/${Wx}`),t.push(`fire/${Wx}`),(e.params.apiSettings.inferenceMode===$x.PREFER_ON_DEVICE||e.params.apiSettings.inferenceMode===$x.PREFER_IN_CLOUD)&&t.push(Kx),t.join(` `)}async function CS(e){let t=new Headers;if(t.append(`Content-Type`,`application/json`),t.append(`x-goog-api-client`,SS(e)),t.append(`x-goog-api-key`,e.params.apiSettings.apiKey),e.params.apiSettings.automaticDataCollectionEnabled&&t.append(`X-Firebase-Appid`,e.params.apiSettings.appId),e.params.apiSettings.getAppCheckToken){let n=await e.params.apiSettings.getAppCheckToken();n&&(t.append(`X-Firebase-AppCheck`,n.token),n.error&&cS.warn(`Unable to obtain a valid App Check token: ${n.error.message}`))}if(e.params.apiSettings.getAuthToken){let n=await e.params.apiSettings.getAuthToken();n&&t.append(`Authorization`,`Firebase ${n.accessToken}`)}return t}async function wS(e,t){let n=new xS(e),r,i=e.singleRequestOptions?.signal,a=e.singleRequestOptions?.timeout!=null&&e.singleRequestOptions.timeout>=0?e.singleRequestOptions.timeout:qx,o=new AbortController,s=setTimeout(()=>{o.abort(new DOMException(yS,bS)),cS.debug(`Aborting request to ${n} due to timeout (${a}ms)`)},a),c=AbortSignal.any(i?[i,o.signal]:[o.signal]);if(i&&i.aborted)throw clearTimeout(s),new DOMException(i.reason??`Aborted externally before fetch`,bS);try{let e={method:`POST`,headers:await CS(n),signal:c,body:t};if(r=await fetch(n.toString(),e),!r.ok){let e=``,t;try{let n=await r.json();e=n.error.message,n.error.details&&(e+=` ${JSON.stringify(n.error.details)}`,t=n.error.details)}catch{}throw r.status===403&&t&&t.some(e=>e.reason===`SERVICE_DISABLED`)&&t.some(e=>e.links?.[0]?.description.includes(`Google developers console API activation`))?new Yx(tS.API_NOT_ENABLED,`The Firebase AI SDK requires the Firebase AI API ('firebasevertexai.googleapis.com') to be enabled in your Firebase project. Enable this API by visiting the Firebase Console at https://console.firebase.google.com/project/${n.params.apiSettings.project}/ailogic/ and clicking "Get started". If you enabled this API recently, wait a few minutes for the action to propagate to our systems and then retry.`,{status:r.status,statusText:r.statusText,errorDetails:t}):new Yx(tS.FETCH_ERROR,`Error fetching from ${n}: [${r.status} ${r.statusText}] ${e}`,{status:r.status,statusText:r.statusText,errorDetails:t})}}catch(e){let t=e;throw e.code!==tS.FETCH_ERROR&&e.code!==tS.API_NOT_ENABLED&&e instanceof Error&&e.name!==bS&&(t=new Yx(tS.ERROR,`Error fetching from ${n.toString()}: ${e.message}`),t.stack=e.stack),t}finally{clearTimeout(s)}return r}function TS(e){if(e.candidates&&e.candidates.length>0){if(e.candidates.length>1&&cS.warn(`This response had ${e.candidates.length} candidates. Returning text from the first candidate only. Access response.candidates directly to use the other candidates.`),MS(e.candidates[0]))throw new Yx(tS.RESPONSE_E
788RROR,`Response error: ${NS(e)}. Response body stored in error.response`,{response:e});return!0}else return!1}function ES(e,t=eS.IN_CLOUD){e.candidates&&!e.candidates[0].hasOwnProperty(`index`)&&(e.candidates[0].index=0);let n=DS(e);return n.inferenceSource=t,n}function DS(e){return e.text=()=>{if(TS(e))return OS(e,e=>!e.thought);if(e.promptFeedback)throw new Yx(tS.RESPONSE_ERROR,`Text not available. ${NS(e)}`,{response:e});return``},e.thoughtSummary=()=>{if(TS(e)){let t=OS(e,e=>!!e.thought);return t===``?void 0:t}else if(e.promptFeedback)throw new Yx(tS.RESPONSE_ERROR,`Thought summary not available. ${NS(e)}`,{response:e})},e.inlineDataParts=()=>{if(TS(e))return AS(e);if(e.promptFeedback)throw new Yx(tS.RESPONSE_ERROR,`Data not available. ${NS(e)}`,{response:e})},e.functionCalls=()=>{if(TS(e))return kS(e);if(e.promptFeedback)throw new Yx(tS.RESPONSE_ERROR,`Function call not available. ${NS(e)}`,{response:e})},e}function OS(e,t){let n=[];if(e.candidates?.[0].content?.parts)for(let r of e.candidates?.[0].content?.parts)r.text&&t(r)&&n.push(r.text);return n.length>0?n.join(``):``}function kS(e){if(!e)return;let t=[];if(e.candidates?.[0].content?.parts)for(let n of e.candidates?.[0].content?.parts)n.functionCall&&t.push(n.functionCall);if(t.length>0)return t}function AS(e){let t=[];if(e.candidates?.[0].content?.parts)for(let n of e.candidates?.[0].content?.parts)n.inlineData&&t.push(n);if(t.length>0)return t}var jS=[Qx.RECITATION,Qx.SAFETY,Qx.BLOCKLIST,Qx.PROHIBITED_CONTENT,Qx.SPII,Qx.MALFORMED_FUNCTION_CALL,Qx.IMAGE_SAFETY,Qx.IMAGE_PROHIBITED_CONTENT,Qx.IMAGE_OTHER,Qx.NO_IMAGE,Qx.IMAGE_RECITATION,Qx.LANGUAGE,Qx.UNEXPECTED_TOOL_CALL,Qx.TOO_MANY_TOOL_CALLS,Qx.MISSING_THOUGHT_SIGNATURE,Qx.MALFORMED_RESPONSE];function MS(e){return!!e.finishReason&&jS.some(t=>t===e.finishReason)}function NS(e){let t=``;if((!e.candidates||e.candidates.length===0)&&e.promptFeedback)t+=`Response was blocked`,e.promptFeedback?.blockReason&&(t+=` due to ${e.promptFeedback.blockReason}`),e.promptFeedback?.blockReasonMessage&&(t+=`: ${e.promptFeedback.blockReasonMessage}`);else if(e.candidates?.[0]){let n=e.candidates[0];MS(n)&&(t+=`Candidate was blocked due to ${n.finishReason}`,n.finishMessage&&(t+=`: ${n.finishMessage}`))}return t}function PS(e){if(e.safetySettings?.forEach(e=>{if(e.method)throw new Yx(tS.UNSUPPORTED,`SafetySetting.method is not supported in the the Gemini Developer API. Please remove this property.`)}),e.generationConfig?.topK){let t=Math.round(e.generationConfig.topK);t!==e.generationConfig.topK&&(cS.warn(`topK in GenerationConfig has been rounded to the nearest integer to match the format for requests to the Gemini Developer API.`),e.generationConfig.topK=t)}return e}function FS(e){return{candidates:e.candidates?LS(e.candidates):void 0,prompt:e.promptFeedback?RS(e.promptFeedback):void 0,usageMetadata:e.usageMetadata}}function IS(e,t){return{generateContentRequest:{model:t,...e}}}function LS(e){let t=[],n;return t&&e.forEach(e=>{let r;if(e.citationMetadata&&(r={citations:e.citationMetadata.citationSources}),e.safetyRatings&&(n=e.safetyRatings.map(e=>({...e,severity:e.severity??Zx.HARM_SEVERITY_UNSUPPORTED,probabilityScore:e.probabilityScore??0,severityScore:e.severityScore??0}))),e.content?.parts?.some(e=>e?.videoMetadata))throw new Yx(tS.UNSUPPORTED,`Part.videoMetadata is not supported in the Gemini Developer API. Please remove this property.`);let i={index:e.index,content:e.content,finishReason:e.finishReason,finishMessage:e.finishMessage,safetyRatings:n,citationMetadata:r,groundingMetadata:e.groundingMetadata,urlContextMetadata:e.urlContextMetadata};t.push(i)}),t}function RS(e){let t=[];return e.safetyRatings.forEach(e=>{t.push({category:e.category,probability:e.probability,severity:e.severity??Zx.HARM_SEVERITY_UNSUPPORTED,probabilityScore:e.probabilityScore??0,severityScore:e.severityScore??0,blocked:e.blocked})}),{blockReason:e.blockReason,safetyRatings:t,blockReasonMessage:e.blockReasonMessage}}var zS=/^data\: (.*)(?:\n\n|\r\r|\r\n\r\n)/;async function BS(e,t,n){let[r,i]=WS(e.body.pipeThrough(new TextDecoderStream(`utf8`,{fatal:!0}))).tee(),{response:a,firstValue:o}=await VS(i,t,n);
788return{stream:US(r,t,n),response:a,firstValue:o}}async function VS(e,t,n){let[r,i]=e.tee(),{value:a}=await r.getReader().read();return{firstValue:a,response:HS(i,t,n)}}async function HS(e,t,n){let r=[],i=e.getReader();for(;;){let{done:e,value:a}=await i.read();if(e){let e=GS(r);return t.backend.backendType===nS.GOOGLE_AI&&(e=FS(e)),ES(e,n)}r.push(a)}}async function*US(e,t,n){let r=e.getReader();for(;;){let{value:e,done:i}=await r.read();if(i)break;let a;a=t.backend.backendType===nS.GOOGLE_AI?ES(FS(e),n):ES(e,n);let o=a.candidates?.[0];!o?.content?.parts&&!o?.finishReason&&!o?.citationMetadata&&!o?.urlContextMetadata||(yield a)}}function WS(e){let t=e.getReader();return new ReadableStream({start(e){let n=``;return r();function r(){return t.read().then(({value:t,done:i})=>{if(i){if(n.trim()){e.error(new Yx(tS.PARSE_FAILED,`Failed to parse stream`));return}e.close();return}n+=t;let a=n.match(zS),o;for(;a;){try{o=JSON.parse(a[1])}catch{e.error(new Yx(tS.PARSE_FAILED,`Error parsing JSON response: "${a[1]}`));return}e.enqueue(o),n=n.substring(a[0].length),a=n.match(zS)}return r()})}}})}function GS(e){let t={promptFeedback:e[e.length-1]?.promptFeedback};for(let n of e)if(n.candidates)for(let e of n.candidates){let n=e.index||0;t.candidates||=[],t.candidates[n]||(t.candidates[n]={index:e.index}),t.candidates[n].citationMetadata=e.citationMetadata,t.candidates[n].finishReason=e.finishReason,t.candidates[n].finishMessage=e.finishMessage,t.candidates[n].safetyRatings=e.safetyRatings,t.candidates[n].groundingMetadata=e.groundingMetadata;let r=e.urlContextMetadata;if(typeof r==`object`&&r&&Object.keys(r).length>0&&(t.candidates[n].urlContextMetadata=r),e.content){if(!e.content.parts)continue;t.candidates[n].content||(t.candidates[n].content={role:e.content.role||`user`,parts:[]});for(let r of e.content.parts){let e={...r};r.text!==``&&Object.keys(e).length>0&&t.candidates[n].content.parts.push(e)}}}return t}var KS=[tS.FETCH_ERROR,tS.ERROR,tS.API_NOT_ENABLED];async function qS(e,t,n,r){if(!t)return{response:await r(),inferenceSource:eS.IN_CLOUD};switch(t.mode){case $x.ONLY_ON_DEVICE:if(await t.isAvailable(e))return{response:await n(),inferenceSource:eS.ON_DEVICE};throw new Yx(tS.UNSUPPORTED,`Inference mode is ONLY_ON_DEVICE, but an on-device model is not available.`);case $x.ONLY_IN_CLOUD:return{response:await r(),inferenceSource:eS.IN_CLOUD};case $x.PREFER_IN_CLOUD:try{return{response:await r(),inferenceSource:eS.IN_CLOUD}}catch(r){if(r instanceof Yx&&KS.includes(r.code)&&await t.isAvailable(e))return{response:await n(),inferenceSource:eS.ON_DEVICE};throw r}case $x.PREFER_ON_DEVICE:return await t.isAvailable(e)?{response:await n(),inferenceSource:eS.ON_DEVICE}:{response:await r(),inferenceSource:eS.IN_CLOUD};default:throw new Yx(tS.ERROR,`Unexpected infererence mode: ${t.mode}`)}}async function JS(e,t,n,r){return e.backend.backendType===nS.GOOGLE_AI&&(n=PS(n)),wS({task:`streamGenerateContent`,model:t,apiSettings:e,stream:!0,singleRequestOptions:r},JSON.stringify(n))}async function YS(e,t,n,r,i){let a=await qS(n,r,()=>r.generateContentStream(n),()=>JS(e,t,n,i));return BS(a.response,e,a.inferenceSource)}async function XS(e,t,n,r){return e.backend.backendType===nS.GOOGLE_AI&&(n=PS(n)),wS({model:t,task:`generateContent`,apiSettings:e,stream:!1,singleRequestOptions:r},JSON.stringify(n))}async function ZS(e,t,n,r,i){let a=await qS(n,r,()=>r.generateContent(n),()=>XS(e,t,n,i));return{response:ES(await QS(a.response,e),a.inferenceSource)}}async function QS(e,t){let n=await e.json();return t.backend.backendType===nS.GOOGLE_AI?FS(n):n}function $S(e){if(e!=null){if(typeof e==`string`)return{role:`system`,parts:[{text:e}]};if(e.text)return{role:`system`,parts:[e]};if(e.parts)return e.role?e:{role:`system`,parts:e.parts}}}function eC(e){let t=[];if(typeof e==`string`)t=[{text:e}];else for(let n of e)typeof n==`string`?t.push({text:n}):t.push(n);return tC(t)}function tC(e){let t={role:`user`,parts:[]},n={role:`function`,parts:[]}
788,r=!1,i=!1;for(let a of e)`functionResponse`in a?(n.parts.push(a),i=!0):(t.parts.push(a),r=!0);if(r&&i)throw new Yx(tS.INVALID_CONTENT,`Within a single message, FunctionResponse cannot be mixed with other type of Part in the request for sending chat message.`);if(!r&&!i)throw new Yx(tS.INVALID_CONTENT,`No Content is provided for sending chat message.`);return r?t:n}function nC(e){let t;return t=e.contents?e:{contents:[eC(e)]},e.systemInstruction&&(t.systemInstruction=$S(e.systemInstruction)),t}var rC=`SILENT_ERROR`,iC=10,aC=class{constructor(e,t,n){this.params=t,this.requestOptions=n,this._history=[],this._sendPromise=Promise.resolve(),this._apiSettings=e}async getHistory(){return await this._sendPromise,this._history}async _sendMessage(e,t){let n={};await this._sendPromise;let r=[];return this._sendPromise=this._sendPromise.then(async()=>{let i,a=0,o=this.requestOptions?.maxSequentialFunctionCalls??iC;do{let o;i?(a++,o=eC(await this._callFunctionsAsNeeded(i))):o=eC(e);let s=this._formatRequest(o,[...r]);r.push(o);let c=await this._callGenerateContent(s,t);if(c)if(n=c,i=this._getCallableFunctionCalls(c.response),c.response.candidates&&c.response.candidates.length>0){let e={parts:c.response.candidates?.[0].content.parts||[],role:c.response.candidates?.[0].content.role||`model`};r.push(e)}else{let e=NS(c.response);e&&cS.warn(`sendMessage() was unsuccessful. ${e}. Inspect response object for details.`)}else i=void 0}while(i&&a<o);i&&a>=o&&cS.warn(`Automatic function calling exceeded the limit of ${o} function calls. Returning last model response.`)}),await this._sendPromise,this._history=this._history.concat(r),n}async _sendMessageStream(e,t){await this._sendPromise;let n=[],r=(async()=>{let r,i=0,a=this.requestOptions?.maxSequentialFunctionCalls??iC,o;do{let a;r?(i++,a=eC(await this._callFunctionsAsNeeded(r))):a=eC(e);let s=this._formatRequest(a,[...n]);if(n.push(a),o=await this._callGenerateContentStream(s,t),r=this._getCallableFunctionCalls(o.firstValue),r&&o.firstValue&&o.firstValue.candidates&&o.firstValue.candidates.length>0){let e={...o.firstValue.candidates[0].content};e.role||=`model`,n.push(e)}}while(r&&i<a);return r&&i>=a&&cS.warn(`Automatic function calling exceeded the limit of ${a} function calls. Returning last model response.`),{stream:o.stream,response:o.response}})();return this._sendPromise=this._sendPromise.then(async()=>r).catch(e=>{throw Error(rC)}).then(e=>e.response).then(e=>{if(e.candidates&&e.candidates.length>0){this._history=this._history.concat(n);let t={...e.candidates[0].content};t.role||=`model`,this._history.push(t)}else{let t=NS(e);t&&cS.warn(`sendMessageStream() was unsuccessful. ${t}. Inspect response object for details.`)}}).catch(e=>{e.message!==rC&&e.name!==`AbortError`&&cS.error(e)}),r}_getCallableFunctionCalls(e){let t=this.params?.tools?.find(e=>e.functionDeclarations);if(!t?.functionDeclarations)return;let n=kS(e);if(n){for(let e of n)if(!t.functionDeclarations?.some(t=>t.name===e.name&&typeof t.functionReference==`function`))return;return n}}async _callFunctionsAsNeeded(e){let t=[],n=[],r=this.params?.tools?.find(e=>e.functionDeclarations);if(r&&r.functionDeclarations){for(let i of e){let e=r.functionDeclarations.find(e=>e.name===i.name);if(e?.functionReference){let r=Promise.resolve(e.functionReference(i.args)).catch(t=>{let n=new Yx(tS.ERROR,`Error in user-defined function "${e.name}": ${t.message}`);throw n.stack=t.stack,n});t.push({name:i.name,id:i.id,results:r}),n.push(r)}}await Promise.all(n);let i=[];for(let{name:e,id:n,results:r}of t){let t={name:e,response:await r};n&&(t.id=n),i.push({functionResponse:t})}return i}else throw new Yx(tS.REQUEST_ERROR,`No function declarations were provided in "tools".`)}},oC=[`text`,`inlineData`,`functionCall`,`functionResponse`,`thought`,`thoughtSignature`],sC={user:[`text`,`inlineData`],function:[`functionResponse`],model:[`text`,`functionCall`,`thought`,`thoughtSignature`],system:[`text`]},cC={user:[`model`],function:[`model`],model:[`user`,`function`],system:[]};function lC(e){let t=null;for(let n of e){let{role:e,parts:r}=n;if(!t&&e!==`user`)throw new Yx(tS.INVALID_CONTENT,`First Content should be with role 'user', got ${e}`);if(!Xx.includes(e))throw new Yx(tS.INVALID_CONTENT,`Each item should include role field. Got ${e} but valid roles are: ${JSON.stringify(Xx)}`);if(!Array.isArray(r))throw new Yx(tS.INVALID_CONTENT,`Content should have 'parts' property with an array of Parts`);
788if(r.length===0)throw new Yx(tS.INVALID_CONTENT,`Each Content should have at least one part`);let i={text:0,inlineData:0,functionCall:0,functionResponse:0,thought:0,thoughtSignature:0,executableCode:0,codeExecutionResult:0};for(let e of r)for(let t of oC)t in e&&(i[t]+=1);let a=sC[e];for(let t of oC)if(!a.includes(t)&&i[t]>0)throw new Yx(tS.INVALID_CONTENT,`Content with role '${e}' can't contain '${t}' part`);if(t&&!cC[e].includes(t.role))throw new Yx(tS.INVALID_CONTENT,`Content with role '${e}' can't follow '${t.role}'. Valid previous roles: ${JSON.stringify(cC)}`);t=n}}var uC=class extends aC{constructor(e,t,n,r,i){super(e,r,i),this.model=t,this.chromeAdapter=n,this.params=r,this.requestOptions=i,r?.history&&(lC(r.history),this._history=r.history),this.params?.systemInstruction!=null&&(this.params={...this.params,systemInstruction:$S(this.params.systemInstruction)})}_formatRequest(e,t){return{safetySettings:this.params?.safetySettings,generationConfig:this.params?.generationConfig,tools:this.params?.tools,toolConfig:this.params?.toolConfig,systemInstruction:this.params?.systemInstruction,contents:[...this._history,...t,e]}}_callGenerateContent(e,t){return ZS(this._apiSettings,this.model,e,this.chromeAdapter,{...this.requestOptions,...t})}_callGenerateContentStream(e,t){return YS(this._apiSettings,this.model,e,this.chromeAdapter,{...this.requestOptions,...t})}async sendMessage(e,t){return this._sendMessage(e,t)}async sendMessageStream(e,t){return this._sendMessageStream(e,t)}};async function dC(e,t,n,r){let i=``;if(e.backend.backendType===nS.GOOGLE_AI){let e=IS(n,t);i=JSON.stringify(e)}else i=JSON.stringify(n);return(await wS({model:t,task:`countTokens`,apiSettings:e,stream:!1,singleRequestOptions:r},i)).json()}async function fC(e,t,n,r,i){if(r?.mode===$x.ONLY_ON_DEVICE)throw new Yx(tS.UNSUPPORTED,`countTokens() is not supported for on-device models.`);return dC(e,t,n,i)}var pC=class extends vS{constructor(e,t,n,r){super(e,t.model),this.chromeAdapter=r,this.generationConfig=t.generationConfig||{},mC(this.generationConfig),this.safetySettings=t.safetySettings||[],this.tools=t.tools,this.toolConfig=t.toolConfig,this.systemInstruction=$S(t.systemInstruction),this.requestOptions=n||{}}async initializeDeviceModel(e){if(!(!this.chromeAdapter||this.chromeAdapter.mode===$x.ONLY_IN_CLOUD)){if(await this.chromeAdapter.downloadIfAvailable(e)===lS.UNAVAILABLE){let e=new Yx(tS.API_NOT_ENABLED,`Local LanguageModel API not available in this environment.`);if(this.chromeAdapter.mode===$x.ONLY_ON_DEVICE)throw e;cS.debug(e.message)}await this.chromeAdapter.downloadPromise}}async generateContent(e,t){let n=nC(e);return ZS(this._apiSettings,this.model,{generationConfig:this.generationConfig,safetySettings:this.safetySettings,tools:this.tools,toolConfig:this.toolConfig,systemInstruction:this.systemInstruction,...n},this.chromeAdapter,{...this.requestOptions,...t})}async generateContentStream(e,t){let n=nC(e),{stream:r,response:i}=await YS(this._apiSettings,this.model,{generationConfig:this.generationConfig,safetySettings:this.safetySettings,tools:this.tools,toolConfig:this.toolConfig,systemInstruction:this.systemInstruction,...n},this.chromeAdapter,{...this.requestOptions,...t});return{stream:r,response:i}}startChat(e){return new uC(this._apiSettings,this.model,this.chromeAdapter,{tools:this.tools,toolConfig:this.toolConfig,systemInstruction:this.systemInstruction,generationConfig:this.generationConfig,safetySettings:this.safetySettings,...e},this.requestOptions)}async countTokens(e,t){let n=nC(e);return fC(this._apiSettings,this.model,n,this.chromeAdapter,{...this.requestOptions,...t})}};function mC(e){if(e.thinkingConfig?.thinkingBudget!=null&&e.thinkingConfig?.thinkingLevel)throw new Yx(tS.UNSUPPORTED,`Cannot set both thinkingBudget and thinkingLevel in a config.`);if(e.responseSchema!=null&&e.responseJsonSchema!=null)throw new Yx(tS.UNSUPPORTED,`Cannot set both responseSchema and responseJsonSchema in a config.`);if((e.responseSchema!=null||e.responseJsonSchema!=null)&&e.responseMimeType!==`application/json`)throw new Yx(tS.UNSUPPORTED,`responseMimeType must be set to "application/json" if responseSchema or responseJsonSchema are set.`)}function hC(e=Rn(),t){e=st(e);let n=Mn(e,Bx),r=t?.backend??new iS,i={useLimitedUseAppCheckTokens:t?.useLimitedUseAppCheckTokens??!1},a=oS(r),o=n.getImmediate({identifier:a});return o.options=i,o}var gC=[`mode`,`onDeviceParams`,`inCloudParams`];function _C(e,t,n){let r=t,i;if(r.mode){for(let e of Object.keys(t))gC.includes(e)||cS.warn(`When a hybrid inference mode is specified (mode is currently set to ${r.mode}), "${e}" cannot be configured at the top level. Configuration for in-cloud and on-device must be done separately in inCloudParams and onDeviceParams. Configuration values set outside of inCloudParams and onDeviceParams will be ignored.`);i=r.inCloudParams||{model:Jx}}else i=t;if(!i.model)throw new Yx(tS.NO_MODEL,`Must provide a model name. Example: getGenerativeModel({ model: 'my-model-name' })`);let a=e.chromeAdapterFactory?.(r.mode,typeof window>`u`?void 0:window,r.onDeviceParams),o=new pC(e,i,n,a);return o._apiSettings.inferenceMode=r.mode,o}function vC(){jn(new ut(Bx,gS,`PUBLIC`).setMultipleInstances(!0)),zn(Rx,zx),zn(Rx,zx,`esm2020`)}vC();var yC=Ln({apiKey:`AIzaSyDummyKeyPlaceholderForCentinela`,authDomain:`betamarribe-tribe.firebaseapp.com`,projectId:`betamarribe-tribe`,storageBucket:`betamarribe-tribe.firebasestorage.app`,messagingSenderId:`123456789012`,appId:`1:123456789012:web:12345abcdef`}),bC=_g(yC);by(Ix(yC)).then(e=>{console.log(`Anonymous authentication active. Session user UID:`,e.user.uid)}).catch(e=>{console.error(`Firebase Anonymous Auth failed:`,e)});var xC=_C(hC(yC,{backend:new iS}),{model:`gemini-2.5-flash-lite`,generationConfig:{temperature:.6,maxOutputTokens:1024}}),SC=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),$=o(((e,t)=>{t.exports=SC()}))(),CC={"ICE checkpoint":{color:`#ef4444`,icon:`🚨`},raid:{color:`#dc2626`,icon:`🚔`},detention:{color:`#991b1b`,icon:`⛓️`},"rapid-response":{color:`#3b82f6`,icon:`📞`},"community-alert":{color:`#eab308`,icon:`🔔`},"general-safety":{color:`#10b981`,icon:`🟢`}};function wC({dict:e,currentLang:t,theme:n=`light`,apiBase:r=`http://127.0.0.1:3001`}){let i={"ICE checkpoint":e.optIce?e.optIce.replace(/^🚨\s*/,``):`ICE Checkpoint`,raid:e.optRaid?e.optRaid.replace(/^🚔\s*/,``):`Active Raid`,detention:e.optDetention?e.optDetention.replace(/^⛓️\s*/,``):`Detention Activity`,"rapid-response":e.optResponse?e.optResponse.replace(/^📞\s*/,``):`Rapid-Response Callout`,"community-alert":e.optAlert?e.optAlert.replace(/^🔔\s*/,``):`Community Security Alert`,"general-safety":e.optSafety?e.optSafety.replace(/^🟢\s*/,``):`General Safety Area Notice`},a=(0,_.useRef)(null),o=(0,_.useRef)(null),s=(0,_.useRef)([]),c=(0,_.useRef)(null),[l,u]=(0,_.useState)([]),[d,f]=(0,_.useState)(``),[p,m]=(0,_.useState)([]),[h,g]=(0,_.useState)(!1),[v,b]=(0,_.useState)(!1),[x,S]=(0,_.useState)(37.7748),[C,w]=(0,_.useState)(-122.2241),[T,E]=(0,_.useState)(`ICE checkpoint`),[D,O]=(0,_.useState)(``),[k,A]=(0,_.useState)(!1),[ee,te]=(0,_.useState)(``),[ne,re]=(0,_.useState)(!1),[ie,M]=(0,_.useState)(null),[ae,oe]=(0,_.useState)(null),[se,ce]=(0,_.useState)(null);(0,_.useEffect)(()=>{let e=()=>{};try{e=qg(Ag(xu(bC,`incidents`),Pg(`timestamp`,`desc`)),e=>{let t=e.docs.map(e=>({id:e.id,...e.data(),timestamp:e.data().timestamp?.toDate()||new Date}));u(t)},e=>{console.warn(`Firestore error, activating in-memory fallback:`,e),u([{id:`report-1`,category:`ICE checkpoint`,description:`Active vehicle checkpoint reported at Fruitvale Ave & E 14th St. 2 agent SUVs sitting near the BART entrance checking papers.`,latitude:37.7748,longitude:-122.2241,address:`Fruitvale Ave & E 14th St, Oakland, CA`,timestamp:new Date,verifiedStatus:`Verified`,confidenceScore:.9}])})}catch(e){console.error(`Firebase not initialized or accessible. Fallback activated.`,e)}return()=>e()},[]),(0,_.useEffect)(()=>{o.current&&=(o.current.remove(),null);let e=new y.default.Map({container:a.current,style:{version:8,sources:{"carto-tiles":{type:`raster`,tiles:[`https://basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}{r}.png`],tileSize:256,attribution:`© CARTO, © OpenStreetMap contributors`}},layers:[{id:`carto-tiles-layer`,type:`raster`,source:`carto-tiles`,minzoom:0,maxzoom:20}]},center:[-122.2241,37.7748],zoom:12});return e.addControl(new y.default.NavigationControl({showCompass:!1}),`top-left`),o.current=e,()=>{o.current&&=(o.current.remove(),null)}},[n]),(0,_.useEffect)(()=>{let e=o.current;
788e&&(s.current.forEach(e=>e.remove()),s.current=[],l.forEach(t=>{let{latitude:n,longitude:r,category:i,description:a,verifiedStatus:o,photo:c}=t,l=CC[i]||{color:`#6b7280`,icon:`❓`},u=document.createElement(`div`);u.className=`custom-map-marker`,u.style.width=`28px`,u.style.height=`28px`,u.style.backgroundColor=l.color,u.style.borderRadius=`50%`,u.style.border=`2px solid #fff`,u.style.display=`flex`,u.style.alignItems=`center`,u.style.justifyContent=`center`,u.style.cursor=`pointer`,u.style.fontSize=`14px`,u.style.boxShadow=`0 4px 12px rgba(0,0,0,0.5)`,u.innerHTML=l.icon,(i===`ICE checkpoint`||i===`raid`)&&(u.style.animation=`marker-pulse-danger 2s infinite`);let d=o===`Verified`?`status-verified`:o===`Community-reported`?`status-community`:`status-unverified`,f=c?`<div style="margin-top: 4px; font-size: 0.7rem; color: var(--accent); font-weight: bold;">📷 Attachment Included</div>`:``,p=`
789        <div class="map-popup-card">
790          <div class="popup-header">
791            <span class="popup-badge ${d}">${o}</span>
792            <strong style="color: ${l.color};">${i.toUpperCase()}</strong>
793          </div>
794          <p class="popup-desc">${a}</p>
795          ${f}
796          <div class="popup-meta">
797            <span>📍 ${t.address||`Bay Area`}</span>
798          </div>
799        </div>
800      `,m=new y.default.Popup({offset:12,closeButton:!1}).setHTML(p),h=new y.default.Marker(u).setLngLat([r,n]).setPopup(m).addTo(e);s.current.push(h)}))},[l]);let ue=async e=>{if(e.preventDefault(),d.trim()){g(!0),m([]);try{let e=d.toLowerCase().includes(`oakland`)||d.toLowerCase().includes(`ca`)||d.toLowerCase().includes(`berkeley`)||d.toLowerCase().includes(`sf`)||d.toLowerCase().includes(`san francisco`)||d.includes(`,`)?d:`${d}, Oakland, CA`,t=await fetch(`https://nominatim.openstreetmap.org/search?format=json&q=${encodeURIComponent(e)}&limit=5`);if(t.ok){let e=await t.json();if(m(e),e.length>0){let t=e[0],n=parseFloat(t.lat),r=parseFloat(t.lon),i=o.current;i&&i.flyTo({center:[r,n],zoom:14})}}}catch(e){console.error(`Nominatim search failed:`,e)}finally{g(!1)}}},de=(e,t)=>{let n=o.current;if(!n)return;let r=parseFloat(e),i=parseFloat(t);n.flyTo({center:[i,r],zoom:15}),m([]),f(``)},me=e=>{let t=o.current;if(!t)return;c.current&&c.current.remove();let n=document.createElement(`div`);n.style.width=`36px`,n.style.height=`36px`,n.style.fontSize=`28px`,n.style.cursor=`grab`,n.innerHTML=`📍`;let r=new y.default.Marker({element:n,draggable:!0}).setLngLat(e).addTo(t);r.on(`dragend`,()=>{let e=r.getLngLat();S(e.lat),w(e.lng)}),c.current=r},he=()=>{let e=o.current;if(!e)return;let t=e.getCenter();S(t.lat),w(t.lng),me(t),b(!0),re(!1),te(``)};return(0,$.jsxs)(`div`,{className:`map-view-section`,children:[(0,$.jsxs)(`div`,{className:`map-top-bar`,style:{padding:`16px`,background:`var(--bg-card)`,borderBottom:`1px solid var(--border-muted)`},children:[(0,$.jsxs)(`h2`,{style:{fontSize:`1.25rem`,fontWeight:`800`,color:`var(--text-white)`,display:`flex`,alignItems:`center`,gap:`8px`},children:[(0,$.jsx)(ge,{style:{color:`var(--accent)`}}),e.mapTitle]}),(0,$.jsx)(`p`,{style:{fontSize:`0.85rem`,color:`var(--text-muted)`,marginTop:`4px`},children:e.mapDesc})]}),(0,$.jsxs)(`div`,{className:`map-search-container`,style:{position:`relative`,zIndex:10,margin:`12px`},children:[(0,$.jsxs)(`form`,{onSubmit:ue,style:{display:`flex`,gap:`8px`},children:[(0,$.jsxs)(`div`,{style:{flex:1,position:`relative`},children:[(0,$.jsx)(`input`,{type:`text`,className:`chat-input`,style:{width:`100%`,paddingLeft:`40px`,background:`var(--bg-charcoal)`,border:`1px solid var(--border-muted)`,borderRadius:`12px`,color:`var(--text-white)`},placeholder:t===`es`?`Buscar un área (ej. Oakland, Berkeley)...`:t===`ar`?`البحث عن منطقة...`:`Search for an area (e.g. Oakland, Berkeley)...`,value:d,onChange:e=>f(e.target.value)}),(0,$.jsx)(pe,{style:{position:`absolute`,left:`14px`,top:`50%`,transform:`translateY(-50%)`,width:`16px`,color:`var(--text-muted)`}})]}),(0,$.jsx)(`button`,{type:`submit`,className:`global-lang-btn active`,style:{borderRadius:`12px`},children:h?`...`:(0,$.jsx)(le,{size:16})})]}),p.length>0&&(0,$.jsx)(`div`,{className:`search-results-dropdown`,style:{position:`absolute`,top:`100%`,left:0,right:0,background:`var(--bg-card)`,border:`1px solid var(--border-muted)`,borderRadius:`12px`,marginTop:`4px`,overflow:`hidden`,zIndex:200},children:p.map(e=>(0,$.jsxs)(`div`,{className:`search-result-item`,onClick:()=>de(e.lat,e.lon),style:{padding:`12px`,borderBottom:`1px solid var(--border-muted)`,cursor:`pointer`,fontSize:`0.85rem`,color:`var(--text-white)`},children:[`📍 `,e.display_name]},e.place_id))})]}),(0,$.jsxs)(`div`,{style:{position:`relative`,width:`100%`,height:`360px`},children:[(0,$.jsx)(`div`,{ref:a,style:{width:`100%`,height:`100%`}}),(0,$.jsxs)(`button`,{onClick:()=>{v?(c.current&&=(c.current.remove(),null),b(!1),M(null),ce(null)):re(!0)},className:`action-btn ${v?`cancel-btn`:``}`,style:{position:`absolute`,bottom:`24px`,right:`16px`,background:v?`var(--danger-red)`:`var(--accent)`,color:`#fff`,border:`none`,borderRadius:`50px`,padding:`12px 20px`,fontWeight:`800`,fontSize:`0.85rem`,cursor:`pointer`,boxShadow:`0 8px 24px rgba(0,0,0,0.5)`,display:`flex`,alignItems:`center`,gap:`8px`,zIndex:100},children:[v?e.cancelPinDropBtn:e.reportSightingBtn,(0,$.jsx)(fe,{size:16})]}),ne&&(0,$.jsx)(`div`,{style:{position:`absolute`,top:0,left:0,right:0,bottom:0,background:`rgba(0, 0, 0, 0.75)`,backdropFilter:`blur(4px)`,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`16px`,zIndex:1e3,animation:`fadeIn 0.2s ease`},children:(0,$.jsxs)(`div`,{className:`dashboard-card`,style:{background:`var(--bg-card)`,border:`1px solid var(--border-muted)`,borderRadius:`16px`,padding:`18px`,width:`100%`,maxWidth:`320px`,boxShadow:`0 8px 32px rgba(0,0,0,0.5)`,display:`flex`,flexDirection:`column`,gap:`12px`},children:[(0,$.jsxs)(`h4`,{style:{margin:0,fontSize:`0.95rem`,fontWeight:`800`,color:`var(--text-white)`,dis
800play:`flex`,alignItems:`center`,gap:`8px`},children:[(0,$.jsx)(j,{style:{color:`var(--oakland-gold)`}}),`Secure Geolocation Auto-Pin`]}),(0,$.jsx)(`p`,{style:{margin:0,fontSize:`0.75rem`,color:`var(--text-muted)`,lineHeight:`1.4`},children:`Would you like Centinela to securely auto-pin your current location? This accesses your GPS coordinates for no more than 30 seconds to position the marker precisely.`}),(0,$.jsxs)(`div`,{style:{background:`var(--danger-red-glow)`,border:`1px solid var(--danger-red)`,borderRadius:`8px`,padding:`8px`,fontSize:`0.65rem`,color:`var(--danger-text)`,lineHeight:`1.3`},children:[(0,$.jsx)(`strong`,{children:`🔒 Strict Privacy Guarantee:`}),` Coordinates are processed strictly in-memory and are permanently deleted immediately upon report submission.`]}),(0,$.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`8px`,marginTop:`4px`},children:[(0,$.jsx)(`button`,{onClick:()=>{let e=o.current;e&&(te(`Acquiring secure location...`),re(!1),navigator.geolocation.getCurrentPosition(t=>{let{latitude:n,longitude:r}=t.coords;S(n),w(r),e.flyTo({center:[r,n],zoom:15}),me([r,n]),b(!0),te(``),ce(30);let i=setInterval(()=>{ce(e=>e<=1?(clearInterval(i),null):e-1)},1e3)},e=>{console.warn(`Geolocation access blocked or failed, dropping fallback manual pin.`,e),te(`GPS access failed or denied. Manual pin dropped at screen center.`),he()},{enableHighAccuracy:!0,timeout:8e3}))},className:`global-lang-btn active`,style:{width:`100%`,padding:`10px`,fontSize:`0.75rem`,fontWeight:`800`,borderRadius:`8px`},children:`📍 Yes, Auto-Pin Securely`}),(0,$.jsx)(`button`,{onClick:he,className:`global-lang-btn`,style:{width:`100%`,padding:`10px`,fontSize:`0.75rem`,fontWeight:`700`,borderRadius:`8px`,border:`1px solid var(--border-muted)`,background:`transparent`},children:`✋ No, Pin Manually`}),(0,$.jsx)(`button`,{onClick:()=>re(!1),style:{width:`100%`,background:`transparent`,border:`none`,color:`var(--text-muted)`,fontSize:`0.7rem`,cursor:`pointer`,textAlign:`center`,textDecoration:`underline`},children:`Cancel`})]})]})})]}),v&&(0,$.jsxs)(`div`,{className:`dashboard-card`,style:{margin:`16px`,animation:`slideUp 0.3s ease`,background:`var(--bg-surface)`,border:`2px solid var(--oakland-gold)`,padding:`16px`},children:[(0,$.jsxs)(`h3`,{style:{fontSize:`1rem`,fontWeight:`800`,display:`flex`,alignItems:`center`,gap:`8px`,marginBottom:`12px`,color:`var(--text-primary)`},children:[(0,$.jsx)(j,{style:{color:`var(--oakland-gold)`}}),e.anonymousSubmitterTitle]}),se!==null&&(0,$.jsxs)(`div`,{style:{background:`var(--green-bg)`,border:`1px solid var(--green)`,borderRadius:`8px`,padding:`6px 12px`,fontSize:`0.7rem`,color:`var(--success-text)`,fontWeight:`700`,marginBottom:`12px`,display:`flex`,alignItems:`center`,justifyContent:`space-between`},children:[(0,$.jsx)(`span`,{children:`⏱️ GPS Location access closed. Pin coordinates locked in local memory.`}),(0,$.jsxs)(`span`,{style:{fontFamily:`monospace`},children:[se,`s`]})]}),(0,$.jsx)(`p`,{style:{fontSize:`0.8rem`,color:`var(--text-secondary)`,marginBottom:`16px`},children:e.dragPinDesc}),(0,$.jsxs)(`form`,{onSubmit:async e=>{if(e.preventDefault(),D.trim().length<10){te(`Description must be at least 10 characters long.`);return}A(!0),te(``);try{await Kg(xu(bC,`incidents`),{category:T,description:D,latitude:x,longitude:C,address:`Bay Area, Zone (${x.toFixed(4)}, ${C.toFixed(4)})`,timestamp:new Date,verifiedStatus:`Community-reported`,confidenceScore:.8,photo:ie||null}),te(`Report submitted successfully! Placed in verification check.`),O(``),M(null),ce(null),c.current&&=(c.current.remove(),null),b(!1)}catch(e){console.error(`Firestore report write failed, utilizing fallback:`,e),te(`Report submitted successfully! (Local Memory Fallback Mode)`),O(``),M(null),ce(null),c.current&&=(c.current.remove(),null),b(!1)}finally{A(!1)}},style:{display:`flex`,flexDirection:`column`,gap:`12px`},children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`label`,{style:{fontSize:`0.75rem`,fontWeight:`700`,textTransform:`uppercase`,color:`var(--text-secondary)`},children:e.sightingCategoryLabel}),(0,$.jsxs)(`select`,{className:`chat-input`,style:{width:`100%`,marginTop:`4px`,background:`var(--bg-subtle)`,color:`var(--text-primary)`,border:`1px solid var(--border)`,borderRadius:`8px`,padding:`8px`},value:T,onChange:e=>E(e.target.value),children:[(0,$.jsx)(`option`,{value:`ICE checkpoint`,children:e.optIce}),(0,$.jsx)(`option`,{value:`raid`,children:e.optRaid}),(0,$.jsx)(`option`,{value:`detention`,children:e.optDetention}),(0,$.jsx)(`option`,{value:`rapid-response`,children:e.optResponse}),(0,$.jsx)(`option`,{value:`community-alert`,children:e.optAlert}),(0,$.jsx)(`option`,{value:`general-safety`,children:e.optSafety})]})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`label`,{style:{fontSize:`0.75rem`,fontWeight:`700`,textTransform:`uppercase`,color:`var(--text-secondary)`},children:e.detailsContextLabel}),(0,$.jsx)(`textarea`,{className:`chat-input`,rows:`3`,style:{width:`100%`,marginTop:`4px`,background:`var(--bg-subtle)`,color:`var(--text-primary)`,border:`1px solid var(--border)`,borderRadius:`8px`,padding:`8px`},placeholder:`Describe what is happening (minimum 10 characters). Avoid names, addresses of homes, or identity clues...`,value:D,onChange:e=>O(e.target.value)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`label`,{style:{fontSize:`0.75rem`,fontWeight:`700`,textTransform:`uppercase`,color:`var(--text-secondary)`,display:`flex`,alignItems:`center`,gap:`4px`},children:`📷 Sighting Photo / Attachment (Optional)`}),(0,$.jsx)(`p`,{style:{fontSize:`0.7rem`,color:`var(--text-muted)`,margin:`4px 0 8px 0`,lineHeight:`1.3`},children:`Capture undercover vehicles, checkpoints, or agent deployment. Avoid capturing faces to protect community anonymity.`}),ie?(0,$.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`8px`},children:[(0,$.jsxs)(`div`,{style:{position:`relative`,width:`120px`,height:`90px`,borderRadius:`8px`,overflow:`hidden`,border:`1px solid var(--border)`},children:[(0,$.jsx)(`img`,{src:ie,alt:`Sighting Preview`,style:{width:`100%`,height:`100%`,objectFit:`cover`}}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>M(null),style:{position:`absolute`,top:`4px`,right:`4px`,background:`rgba(0,0,0,0.6)`,color:`#fff`,border:`none`,borderRadius:`50%`,width:`18px`,he
800ight:`18px`,fontSize:`10px`,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,fontWeight:`bold`},children:`✕`})]}),(0,$.jsx)(`span`,{style:{fontSize:`0.65rem`,color:`var(--text-muted)`},children:`✓ Photo loaded. All EXIF/GPS metadata is automatically stripped. Auto-deletes in 48 hours.`})]}):(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>document.getElementById(`sighting-photo-input`).click(),className:`global-lang-btn`,style:{padding:`8px 12px`,borderRadius:`8px`,fontSize:`0.75rem`,background:`var(--bg-subtle)`,border:`1px solid var(--border)`,color:`var(--text-primary)`,cursor:`pointer`,fontWeight:`700`},children:`Take Photo or Upload Image`}),(0,$.jsx)(`input`,{type:`file`,id:`sighting-photo-input`,accept:`image/*`,capture:`environment`,style:{display:`none`},onChange:e=>{let t=e.target.files[0];if(t){let e=new FileReader;e.onloadend=()=>{M(e.result)},e.readAsDataURL(t)}}})]})]}),(0,$.jsx)(`button`,{type:`submit`,className:`action-btn`,disabled:k,style:{backgroundColor:`var(--oakland-gold)`,color:`#000`,fontWeight:`800`,marginTop:`4px`},children:k?e.verifyingSightingTxt:e.submitReportBtn}),ee&&(0,$.jsx)(`div`,{style:{fontSize:`0.85rem`,color:ee.includes(`successfully`)?`var(--oakland-green-light)`:`var(--danger-red)`,fontWeight:`700`,marginTop:`8px`},children:ee})]})]}),(0,$.jsxs)(`div`,{style:{padding:`16px`},children:[(0,$.jsx)(`h4`,{style:{fontSize:`0.9rem`,marginBottom:`8px`,fontWeight:`700`},children:e.liveMapFeedTitle}),(0,$.jsx)(`div`,{className:`sighting-feed`,style:{display:`flex`,flexDirection:`column`,gap:`10px`},children:l.length===0?(0,$.jsx)(`p`,{style:{fontSize:`0.85rem`,color:`var(--text-muted)`,textAlign:`center`,padding:`12px`},children:e.townQuietMsg}):l.map(e=>{let t=CC[e.category]||{color:`#6b7280`,icon:`❓`};return(0,$.jsxs)(`div`,{className:`sighting-item`,style:{borderLeft:`3px solid ${t.color}`,padding:`12px`,background:`var(--bg-card)`,borderRadius:`8px`,border:`1px solid var(--border-muted)`,borderLeftWidth:`4px`,display:`flex`,justifyContent:`space-between`,alignItems:`flex-start`,gap:`12px`},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`4px`,flex:1},children:[(0,$.jsxs)(`span`,{style:{fontSize:`0.85rem`,display:`flex`,alignItems:`center`,gap:`6px`,color:`var(--text-white)`,fontWeight:`700`},children:[t.icon,` `,(i[e.category]||e.category).toUpperCase()]}),(0,$.jsx)(`p`,{style:{fontSize:`0.8rem`,color:`var(--text-muted)`,margin:`4px 0`,lineHeight:`1.4`},children:e.description}),e.photo&&(0,$.jsx)(`div`,{style:{marginTop:`8px`},children:(0,$.jsx)(`img`,{src:e.photo,alt:`Sighting Attachment`,onClick:()=>oe(e.photo),style:{maxWidth:`120px`,maxHeight:`90px`,borderRadius:`8px`,cursor:`pointer`,border:`1px solid var(--border-muted)`,objectFit:`cover`,display:`block`,transition:`transform 0.15s ease`},onMouseOver:e=>e.target.style.transform=`scale(1.03)`,onMouseOut:e=>e.target.style.transform=`scale(1)`})}),(0,$.jsxs)(`span`,{style:{fontSize:`0.75rem`,color:`var(--text-muted)`,marginTop:`4px`,display:`flex`,alignItems:`center`,gap:`4px`},children:[`📍 `,e.address||`Bay Area`]})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,alignItems:`flex-end`,gap:`4px`,flexShrink:0},children:[(0,$.jsx)(`span`,{className:`popup-badge ${e.verifiedStatus===`Verified`?`status-verified`:e.verifiedStatus===`Community-reported`?`status-community`:`status-unverified`}`,style:{fontSize:`0.65rem`,padding:`2px 6px`},children:e.verifiedStatus}),(0,$.jsx)(`span`,{style:{fontSize:`0.75rem`,color:`var(--text-muted)`},children:new Date(e.timestamp).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})})]})]},e.id)})})]}),ae&&(0,$.jsx)(`div`,{onClick:()=>oe(null),style:{position:`fixed`,top:0,left:0,right:0,bottom:0,background:`rgba(0,0,0,0.85)`,display:`flex`,alignItems:`center`,justifyContent:`center`,zIndex:9999,animation:`fadeIn 0.2s ease`,cursor:`zoom-out`},children:(0,$.jsxs)(`div`,{style:{position:`relative`,maxWidth:`90%`,maxHeight:`80%`},children:[(0,$.jsx)(`img`,{src:ae,alt:`Enlarged Sighting`,style:{width:`100%`,height:`100%`,borderRadius:`12px`,border:`2px solid #fff`,objectFit:`contain`}}
800),(0,$.jsx)(`span`,{style:{position:`absolute`,bottom:`-28px`,left:`50%`,transform:`translateX(-50%)`,color:`#fff`,fontSize:`0.8rem`,whiteSpace:`nowrap`},children:`Tap anywhere to close`})]})})]})}var TC=[{id:`clinic-1`,category:`healthcare`,name:`West Oakland Health Center`,description:`Providing comprehensive family medicine, mental health, and dental care without requiring health insurance or federal IDs.`,address:`700 Adeline St, Oakland, CA 94607`,hours:`Mon-Fri 8:30 AM - 5:00 PM`,safetyProtocol:`Strict "Don't Ask, Don't Tell" policy. Sanctuary certified. Safe zone.`},{id:`clinic-2`,category:`healthcare`,name:`La Clínica de la Raza (Fruitvale)`,description:`Bilingual clinics offering low-cost healthcare, mental health, dental, and preventive medical services with absolute client confidentiality.`,address:`3434 E 12th St, Oakland, CA 94601`,hours:`Mon-Fri 8:30 AM - 5:30 PM, Sat 9:00 AM - 1:00 PM`,safetyProtocol:`SB 54 certified. Patient legal data is never stored or shared with immigration authorities.`},{id:`clinic-3`,category:`healthcare`,name:`Tiburcio Vasquez Health Center (Hayward)`,description:`Safe sliding-scale medical, dental, and women health care services for community members regardless of legal status.`,address:`22405 Foothill Blvd, Hayward, CA 94541`,hours:`Mon-Fri 8:00 AM - 6:00 PM`,safetyProtocol:`Healthcare sanctuary. Strictly no data sharing policies.`},{id:`clinic-4`,category:`healthcare`,name:`Berkeley Free Clinic`,description:`Entirely free healthcare, counseling, and dental services offered on a completely anonymous and confidential basis.`,address:`2336 Channing Way, Berkeley, CA 94704`,hours:`Varies by service - Check calendar online`,safetyProtocol:`100% anonymous. No name, ID, or citizenship verification requested.`},{id:`legal-1`,category:`legal`,name:`Centro Legal de la Raza`,description:`Comprehensive immigration legal defense, deportation representation, tenants rights advocacy, and Know Your Rights preparation.`,address:`3400 E 12th St, Oakland, CA 94601`,hours:`Mon-Thu 9:00 AM - 5:00 PM`,safetyProtocol:`Full attorney-client consultation confidentiality. Strictly trusted sanctuary.`},{id:`legal-2`,category:`legal`,name:`East Bay Sanctuary Covenant (EBSCO)`,description:`Providing low-cost legal aid, asylum representation, residency, citizenship assistance, and powerful advocacy for immigrants.`,address:`2362 Bancroft Way, Berkeley, CA 94704`,hours:`Mon-Thu 10:00 AM - 4:00 PM`,safetyProtocol:`Officially designated sanctuary office, highly trusted for over 40 years.`},{id:`legal-3`,category:`legal`,name:`Alameda County Rapid Response Network`,description:`Emergency legal hotline and rapid defense dispatch for individuals facing active ICE arrests or raids.`,address:`Emergency Hotline: (510) 241-4011`,hours:`24 Hours / 7 Days Active Support`,safetyProtocol:`Immediate dispatch and fully secure phone tracking. No user records are stored.`},{id:`legal-4`,category:`legal`,name:`Bay Area Legal Aid (Oakland)`,description:`Free legal representation for domestic violence survivors, housing security issues, and securing public benefits.`,address:`1735 Telegraph Ave, Oakland, CA 94612`,hours:`Mon-Fri 9:00 AM - 12:00 PM (Hotline)`,safetyProtocol:`Fully confidential legal advocacy and representation.`},{id:`food-1`,category:`food`,name:`Oakland Food Pantry`,description:`Large-scale food and fresh produce pantry distribution provided by the Alameda County Community Food Bank.`,address:`7900 Edgewater Dr, Oakland, CA 94621`,hours:`Mon-Fri 9:00 AM - 3:00 PM`,safetyProtocol:`No ID, social security, or status information is ever recorded or asked.`},{id:`food-2`,category:`food`,name:`Berkeley Food Pantry`,description:`Emergency grocery bag distributions for families in need of immediate nutritional support.`,address:`2000 University Ave, Berkeley, CA 94704`,hours:`Mon, Wed, Fri 2:00 PM - 4:00 PM`,safetyProtocol:`Strict sanctuary-aligned food pantry. Safe and respectful distribution.`},{id:`food-3`,category:`food`,name:`Hayward Seventh-day Adventist Food Pantry`,description:`Free weekly hot meals and healthy emergency groceries distributed to local families.`,address:`26400 Gading Rd, Hayward, CA 94544`,hours:`Wednesdays 11:00 AM - 1:00 PM`,safetyProtocol:`Safe community pantry, sanctuary certified.`},{id:`food-4`,category:`food`,name:`Tri-City Volunteers Food Bank`,description:`The largest non-governmental food program in Alameda County, distributing groceries to low-income families.`,address:`37350 Joseph St, Fremont, CA 94536`,hours:`Mon-Fri 10:00 AM - 2
800:00 PM`,safetyProtocol:`Open and completely confidential food distribution. Fully anonymous options.`},{id:`sanctuary-1`,category:`sanctuary`,name:`First Presbyterian Church of Oakland`,description:`Active sanctuary congregation offering temporary shelter, protective physical custody, and holistic community support.`,address:`2610 Broadway, Oakland, CA 94612`,hours:`Varies - Contact via pastor or network coordinator`,safetyProtocol:`Officially declared national sanctuary. Under federal directive guidelines, ICE cannot raid churches.`},{id:`sanctuary-2`,category:`sanctuary`,name:`St. Mary's Center`,description:`A designated community safe space and social sanctuary providing housing placement and peer counseling.`,address:`925 Brockhurst St, Oakland, CA 94608`,hours:`Mon-Fri 8:00 AM - 4:00 PM`,safetyProtocol:`Strong immigrant advocate base, complete sanctuary-certified facility.`},{id:`sanctuary-3`,category:`sanctuary`,name:`St. Elizabeth Catholic Church (Fruitvale)`,description:`Vibrant local sanctuary parish supporting families with safe gathering spaces and essential resources.`,address:`1500 34th Ave, Oakland, CA 94601`,hours:`Daily 9:00 AM - 6:00 PM`,safetyProtocol:`Fully committed sanctuary church. Dedicated Spanish-language assistance and legal referral.`},{id:`housing-1`,category:`housing`,name:`East Oakland Community Project (EOCP)`,description:`Comprehensive emergency shelter and transitional housing assistance for families and individuals in need.`,address:`7515 International Blvd, Oakland, CA 94621`,hours:`24-Hour Active Assistance`,safetyProtocol:`Designated safe harbor zone. Strict participant privacy standards.`},{id:`housing-2`,category:`housing`,name:`Abode Services (Hayward)`,description:`Safe transitional housing, rapid housing placements, and emergency shelter coordination programs.`,address:`1065 A St, Hayward, CA 94541`,hours:`Mon-Fri 9:00 AM - 5:00 PM`,safetyProtocol:`Secure housing counseling and advocacy. Free of federal inquiries.`},{id:`housing-3`,category:`housing`,name:`Berkeley Food & Housing Project`,description:`Emergency shelter, nutritional programs, and safe housing assistance for homeless veterans and families.`,address:`1901 Fairview St, Berkeley, CA 94703`,hours:`24 Hours Emergency Intake`,safetyProtocol:`Strict sanctuary-compliant shelter. No data disclosure.`},{id:`economic-1`,category:`economic`,name:`California Department of Social Services (CAPI)`,description:`The Cash Assistance Program for Immigrants (CAPI) provides monthly cash benefits to aged, blind, or disabled legal immigrants.`,address:`1111 Jackson St, Oakland, CA 94607`,hours:`Mon-Fri 8:00 AM - 5:00 PM`,safetyProtocol:`State public support program. Shielded by SB 54, no federal data sharing.`},{id:`economic-2`,category:`economic`,name:`Centro Legal de la Raza - Emergency Relief Fund`,description:`Direct financial assistance programs distributing emergency cash grants directly to low-income immigrant families.`,address:`3400 E 12th St, Oakland, CA 94601`,hours:`By appointment`,safetyProtocol:`100% private. Audited and distributed securely with no public registries.`}];function EC({dict:e,apiBase:t=`http://127.0.0.1:3001`}){let n={healthcare:e.optHealthcare?e.optHealthcare.replace(/^🏥\s*/,``):`Healthcare & Wellness`,legal:e.optLegal?e.optLegal.replace(/^⚖️\s*/,``):`Legal Aid & Counsel`,food:e.optFood?e.optFood.replace(/^🍎\s*/,``):`Food Pantries & Kitchens`,sanctuary:e.optSanctuary?e.optSanctuary.replace(/^⛪\s*/,``):`Safe Sanctuaries`,housing:e.optHousing?e.optHousing.replace(/^🏠\s*/,``):`Emergency Housing`,economic:e.optEconomic?e.optEconomic.replace(/^💵\s*/,``):`Cash Support (CAPI)`},[r,i]=(0,_.useState)([]),[a,o]=(0,_.useState)([]),[s,c]=(0,_.useState)(`all`),[l,u]=(0,_.useState)(!1),[d,f]=(0,_.useState)(!1),[p,m]=(0,_.useState)(!1),[h,g]=(0,_.useState)(``),[v,y]=(0,_.useState)(``),b=e=>{e.preventDefault(),h===`CentinelaAdmin2026`?(m(!0),y(``)):y(`Access Denied: Invalid administrator passcode.`)},[x,S]=(0,_.useState)(`healthcare`),[C,w]=(0,_.useState)(``),[T,E]=(0,_.useState)(``),[D,O]=(0,_.useState)(``),[k,A]=(0,_.useState)(``),[M,ae]=(0,_.useState)(``),[oe,se]=(0,_.useState)(``),[ce,le]=(0,_.useState)(!1);(0,_.useEffect)(()=>{let e=()=>{};try{e=qg(Ag(xu(bC,`safeResources`)),e=>{let t=e.docs.map(e=>({id:e.id,...e.data()}));if(t.length===0)i(TC);else{let e=[...t];
800TC.forEach(t=>{e.some(e=>e.name.toLowerCase()===t.name.toLowerCase())||e.push(t)}),i(e)}},e=>{console.warn(`Firestore safeResources read failed. Activating default fallback.`,e),i(TC)})}catch(e){console.error(`Firebase resources integration inactive. Using local placeholders.`,e)}return()=>{e()}},[]),(0,_.useEffect)(()=>{if(!p){o([]);return}let e=()=>{};try{e=qg(Ag(xu(bC,`pendingResources`)),e=>{let t=e.docs.map(e=>({id:e.id,...e.data()}));o(t)},e=>{console.warn(`Firestore pendingResources read failed.`,e),o([])})}catch(e){console.error(`Firestore pendingResources subscription error:`,e)}return()=>{e()}},[p]);let ue=async e=>{if(e.preventDefault(),!C||!T||!D){se(`Please fill in the Name, Description, and Address fields.`);return}le(!0),se(``);try{await Kg(xu(bC,`pendingResources`),{category:x,name:C,description:T,address:D,hours:k,safetyProtocol:M,timestamp:new Date}),se(`Suggestion submitted successfully! Our developers will review this safe zone shortly.`),w(``),E(``),O(``),A(``),ae(``)}catch(e){console.error(`Firestore pendingResources write failed, utilizing fallback:`,e),se(`Suggestion submitted successfully! (Local Fallback Mode active)`),w(``),E(``),O(``),A(``),ae(``)}finally{le(!1)}},de=async(e,t)=>{try{if(t===`approve`){let t=a.find(t=>t.id===e);if(t){let{id:n,...r}=t;await Wg(Su(bC,`safeResources`,e),r)}}await Gg(Su(bC,`pendingResources`,e))}catch(e){console.error(`Error during Firestore moderation command execution:`,e),alert(`Failed to execute moderator command.`)}},pe=s===`all`?r:r.filter(e=>e.category===s);return(0,$.jsxs)(`div`,{style:{padding:`16px`},children:[(0,$.jsxs)(`div`,{style:{borderBottom:`1px solid var(--border-muted)`,paddingBottom:`16px`,marginBottom:`16px`},children:[(0,$.jsxs)(`h2`,{style:{fontSize:`1.25rem`,fontWeight:`800`,color:`var(--text-white)`,display:`flex`,alignItems:`center`,gap:`8px`},children:[(0,$.jsx)(re,{style:{color:`var(--accent)`}}),e.vettedDirectoryTitle]}),(0,$.jsx)(`p`,{style:{fontSize:`0.85rem`,color:`var(--text-muted)`,marginTop:`4px`},children:e.vettedDirectoryDesc})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,gap:`8px`,marginBottom:`16px`},children:[(0,$.jsxs)(`button`,{onClick:()=>{u(!l),f(!1)},className:`global-lang-btn active`,style:{flex:1,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:`6px`,fontSize:`0.8rem`,borderRadius:`12px`,padding:`10px`},children:[(0,$.jsx)(fe,{size:16}),` `,e.addResourceBtn]}),(0,$.jsxs)(`button`,{onClick:()=>{f(!d),u(!1)},className:`global-lang-btn`,style:{flex:1,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:`6px`,fontSize:`0.8rem`,borderRadius:`12px`,padding:`10px`,border:`1px solid var(--border-muted)`,background:`transparent`},children:[(0,$.jsx)(ge,{size:16}),` `,e.modQueueBtn]})]}),l&&(0,$.jsxs)(`div`,{className:`dashboard-card`,style:{background:`var(--bg-card)`,border:`2px solid var(--oakland-gold)`,marginBottom:`20px`,animation:`slideUp 0.2s ease`},children:[(0,$.jsxs)(`h3`,{style:{fontSize:`1rem`,fontWeight:`800`,display:`flex`,alignItems:`center`,gap:`6px`,marginBottom:`12px`,color:`var(--text-white)`},children:[(0,$.jsx)(ie,{style:{color:`var(--oakland-gold)`},size:16}),` `,e.submitResourceTitle]}),(0,$.jsx)(`p`,{style:{fontSize:`0.75rem`,color:`var(--text-muted)`,marginBottom:`16px`},children:e.privacyWarningDesc}),(0,$.jsxs)(`form`,{onSubmit:ue,style:{display:`flex`,flexDirection:`column`,gap:`12px`},children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`label`,{style:{fontSize:`0.75rem`,fontWeight:`700`,textTransform:`uppercase`,color:`var(--text-muted)`},children:e.formCategoryLabel}),(0,$.jsxs)(`select`,{className:`chat-input`,style:{width:`100%`,marginTop:`4px`,background:`var(--bg-charcoal)`,border:`1px solid var(--border-muted)`},value:x,onChange:e=>S(e.target.value),children:[(0,$.jsx)(`option`,{value:`healthcare`,children:e.optHealthcare}),(0,$.jsx)(`option`,{value:`legal`,children:e.optLegal}),(0,$.jsx)(`option`,{value:`food`,children:e.optFood}),(0,$.jsx)(`option`,{value:`sanctuary`,children:e.optSanctuary}),(0,$.jsx)(`option`,{value:`housing`,children:e.optHousing}),(0,$.jsx)(`option`,{value:`economic`,children:e.optEconomic})]})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`label`,{style:{fontSize:`0.75rem`,fontWeight:`700`,textTransform:`uppercase`,color:`var(--text-muted)`},children:e.formNameLabel}),(0,$.jsx)(`input`,{type:`text`,className:`chat-input`,style:{width:`100%`,marginTop:`4px`,background:`var(--bg-charcoal)`,border:`1px solid var(--border-muted)`,color:`var(--text-white)`},placeholder:`e.g. West Oakland Community Kitchen`,value:C,onChange:e=>w(e.target.value)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`label`,{style:{fontSize:`0.75rem`,fontWeight:`700`,textTransform:`uppercase`,color:`var(--text-muted)`},children:e.formDescLabel}),(0,$.jsx)(`textarea`,{className:`chat-input`,rows:`3`,style:{width:`100%`,marginTop:`4px`,background:`var(--bg-charcoal)`,border:`1px solid var(--border-muted)`,color:`var(--text-white)`},placeholder:`Describe services, language support, and why this is a safe place...`,value:T,onChange:e=>E(e.target.value)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`label`,{style:{fontSize:`0.75rem`,fontWeight:`700`,textTransform:`uppercase`,color:`var(--text-muted)`},children:e.formAddressLabel}),(0,$.jsx)(`input`,{type:`text`,className:`chat-input`,style:{width:`100%`,marginTop:`4px`,background:`var(--bg-charcoal)`,border:`1px solid var(--border-muted)`,color:`var(--text-white)`},placeholder:`e.g. 1035 7th St, Oakland, CA`,value:D,onChange:e=>O(e.target.value)})]}),(0,$.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:`12px`},children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`label`,{style:{fontSize:`0.75rem`,fontWeight:`700`,textTransform:`uppercase`,color:`var(--text-muted)`},children:e.formHoursLabel}),(0,$.jsx)(`input`,{type:`text`,className:`chat-input`,style:{width:`100%`,marginTop:`4px`,background:`var(--bg-charcoal)`,border:`1px solid var(--border-muted)`,color:`var(--text-white)`},placeholder:`e.g. Mon, Wed, Fri 10am-2pm`,value:k,onChange:e=>A(e.target.value)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`label`,{style:{fontSize:`0.75rem`,fontWeight:`700`,textTransform:`uppercase`,color:`var(--text-muted)`},children:e.formProtocolLabel}),(0,$.jsx)(`input`,{type:`text`,className:`chat-input`,style:{width:`100%`,marginTop:`4px`,background:`var(--bg-charcoal)`,border:`1px solid var(--border-muted)`,color:`var(--text-white)`},placeholder:`e.g. Zero data logs. No ID required.`,value:M,onChange:e=>ae(e.target.value)})]})]}),(0,$.jsx)(`button`,{type:`submit`,className:`action-btn`,disabled:ce,style:{backgroundColor:`var(--accent)`,color:`#fff`,fontWeight:`800`},children:ce?e.submittingTxt:e.submitResourceBtn}),oe&&(0,$.jsx)(`div`,{style:{fontSize:`0.8rem`,color:oe.includes(`successfully`)?`var(--oakland-green-light)`:`var(--danger-red)`,fontWeight:`700`,marginTop:`4px`},children:oe})]})]}),d&&(0,$.jsx)(`div`,{className:`dashboard-card`,style:{background:`var(--bg-card)`,border:`2px solid var(--border-muted)`,marginBottom:`20px`,animation:`slideUp 0.2s ease`},children:p?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`h3`,{style:{fontSize:`1rem`,fontWeight:`800`,display:`flex`,alignItems:`center`,gap:`6px`,marginBottom:`8px`,color:`var(--oakland-gold)`},children:[(0,$.jsx)(ge,{size:16}),` `,e.modConsoleTitle]}),(0,$.jsx)(`p`,{style:{fontSize:`0.75rem`,color:`var(--text-muted)`,marginBottom:`16px`},children:e.modConsoleDesc}),(0,$.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`10px`,maxH:`300px`,overflowY:`auto`}
800,children:a.length===0?(0,$.jsx)(`p`,{style:{fontSize:`0.8rem`,color:`var(--text-muted)`,textAlign:`center`,padding:`12px`},children:e.modQueueEmpty}):a.map(e=>(0,$.jsxs)(`div`,{style:{background:`var(--bg-charcoal)`,border:`1px solid var(--border-muted)`,padding:`10px`,borderRadius:`8px`},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,$.jsx)(`span`,{style:{fontSize:`0.75rem`,fontWeight:`800`,textTransform:`uppercase`,color:`var(--oakland-gold)`},children:n[e.category]||e.category}),(0,$.jsx)(`span`,{style:{fontSize:`0.65rem`,fontWeight:`800`,padding:`2px 6px`,borderRadius:`4px`,background:e.status===`Approved`?`var(--oakland-green)`:e.status===`Pending`?`#b25e00`:`var(--danger-red)`,color:`#fff`},children:e.status})]}),(0,$.jsx)(`strong`,{style:{fontSize:`0.85rem`,display:`block`,margin:`4px 0 2px`,color:`var(--text-white)`},children:e.name}),(0,$.jsx)(`p`,{style:{fontSize:`0.75rem`,color:`var(--text-muted)`},children:e.description}),(0,$.jsxs)(`span`,{style:{fontSize:`0.7rem`,display:`block`,marginTop:`4px`,color:`var(--text-muted)`},children:[`📍 `,e.address]}),e.status===`Pending`&&(0,$.jsxs)(`div`,{style:{display:`flex`,gap:`6px`,marginTop:`10px`},children:[(0,$.jsxs)(`button`,{onClick:()=>de(e.id,`approve`),style:{flex:1,padding:`4px 8px`,fontSize:`0.75rem`,fontWeight:`800`,background:`var(--oakland-green)`,border:`none`,borderRadius:`4px`,color:`#fff`,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:`4px`},children:[(0,$.jsx)(ee,{size:12}),` Approve`]}),(0,$.jsxs)(`button`,{onClick:()=>de(e.id,`reject`),style:{flex:1,padding:`4px 8px`,fontSize:`0.75rem`,fontWeight:`800`,background:`var(--danger-red)`,border:`none`,borderRadius:`4px`,color:`#fff`,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:`4px`},children:[(0,$.jsx)(ye,{size:12}),` Reject`]})]})]},e.id))})]}):(0,$.jsxs)(`form`,{onSubmit:b,style:{padding:`4px 0`},children:[(0,$.jsxs)(`h3`,{style:{fontSize:`1rem`,fontWeight:`800`,display:`flex`,alignItems:`center`,gap:`6px`,marginBottom:`8px`,color:`var(--oakland-gold)`},children:[(0,$.jsx)(ge,{size:16}),` Admin Access Required`]}),(0,$.jsx)(`p`,{style:{fontSize:`0.75rem`,color:`var(--text-muted)`,marginBottom:`16px`,lineHeight:`1.4`},children:`The Developer Audit Console and resource moderation queues are restricted to authorized administrators. Please verify your administrative passcode to proceed.`}),(0,$.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`8px`},children:[(0,$.jsx)(`input`,{type:`password`,placeholder:`Enter Admin Passcode...`,value:h,onChange:e=>g(e.target.value),style:{background:`var(--bg-charcoal)`,border:`1px solid var(--border-muted)`,borderRadius:`8px`,padding:`10px 12px`,fontSize:`0.8rem`,color:`var(--text-white)`,outline:`none`,width:`100%`}}),v&&(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`4px`,fontSize:`0.7rem`,color:`var(--danger-red)`,fontWeight:`700`},children:[(0,$.jsx)(te,{size:12}),` `,v]}),(0,$.jsxs)(`div`,{style:{display:`flex`,gap:`6px`,marginTop:`4px`},children:[(0,$.jsx)(`button`,{type:`submit`,style:{flex:1,padding:`8px 12px`,fontSize:`0.75rem`,fontWeight:`800`,background:`var(--oakland-gold)`,border:`none`,borderRadius:`8px`,color:`#000`,cursor:`pointer`},children:`Verify Passcode`}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>{f(!1),g(``),y(``)},style:{padding:`8px 12px`,fontSize:`0.75rem`,fontWeight:`800`,background:`transparent`,border:`1px solid var(--border-muted)`,borderRadius:`8px`,color:`var(--text-muted)`,cursor:`pointer`},children:`Cancel`})]})]})]})}),(0,$.jsxs)(`div`,{className:`filter-slider`,style:{display:`flex`,gap:`6px`,overflowX:`auto`,paddingBottom:`12px`,marginBottom:`16px`},children:[(0,$.jsx)(`button`,{onClick:()=>c(`all`),className:`global-lang-btn ${s===`all`?`active`:``}`,style:{borderRadius:`50px`,padding:`6px 12px`,fontSize:`0.75rem`,flexShrink:0},children:e.allSafeZonesBtn}),Object.entries(n).map(([e,t])=>(0,$.jsx)(`button`,{onClick:()=>c(e),className:`global-lang-btn ${s===e?`active`:``}`,style:{borderRadius:`50px`,padding:`6px 12px`,fontSize:`0.75rem`,flexShrink:0},children:t},e))]}),(0,$.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`12px`},children:pe.length===0?(0,$.jsx)(`p`,{style:{fontSize:`0.85rem`,color:`var(--text-muted)`,textAlign:`center`,padding:`20px`},children:e.emptyDirectoryMsg}):pe.map(t=>(0,$.jsxs)(`div`,{className:`dashboard-card`,style:{background:`var(--bg-card)`,border:`1px solid var(--border-muted)`,padding:`16px`,position:`relative`},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:`8px`},children:[(0,$.jsx)(`span`,{style:{fontSize:`0.7rem`,textTransform:`uppercase`,background:`var(--gold-bg)`,color:`var(--warning-text)`,padding:`2px 8px`,borderRadius:`50px`,fontWeight:`800`},children:n[t.category]||t.category}),(0,$.jsxs)(`span`,{style:{fontSize:`0.7rem`,display:`flex`,alignItems:`center`,gap:`4px`,color:`var(--oakland-green-light)`,fontWeight:`700`},children:[(0,$.jsx)(ge,{size:12}),` `,e.privacyGuaranteed]})]}),(0,$.jsx)(`h3`,{style:{fontSize:`1rem`,fontWeight:`800`,marginBottom:`6px`,color:`var(--text-white)`},children:t.name}),(0,$.jsx)(`p`,{style:{fontSize:`0.8rem`,color:`var(--text-muted)`,lineHeight:`1.4`,marginBottom:`12px`},children:t.description}),(0,$.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`6px`,borderTop:`1px solid var(--border-muted)`,paddingTop:`10px`},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`6px`,fontSize:`0.75rem`,color:`var(--text-muted)`},children:[(0,$.jsx)(j,{size:12,style:{color:`var(--oakland-gold)`}}),(0,$.jsx)(`span`,{children:t.address})]}),t.hours&&(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`6px`,fontSize:`0.75rem`,color:`var(--text-muted)`},children:[(0,$.jsx)(ne,{size:12,style:{color:`var(--oakland-gold)`}}),(0,$.jsx)(`span`,{children:t.hours})]}),t.safetyProtocol&&(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:`6px`,fontSize:`0.75rem`,color:`var(--success-text)`,background:`var(--green-bg)`,padding:`8px`,borderRadius:`6px`,marginTop:`4px`},children:[(0,$.jsx)(ie,{size:12,style:{flexShrink:0,marginTop:`2px`,color:`var(--green)`}}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`strong`,{children:e.securityProtocolLabel}),` `,t.safetyProtocol]})]})]})]},t.id))})]})}var DC={en:[{id:`news-1`,title:`California Expands CAPI Cash Relief Eligibility for Seniors`,summary:`The California Department of Social Services announced updated income thresholds for the Cash Assistance Program for Immigrants (CAPI). Eligible older adults and disabled non-citizens in Oakland, Berkeley, and Hayward can access cash relief entirely without risking public charge issues under current guidelines.`,source:`California DSS (CDSS)`,region:`Oakland`,date:`July 20, 2026`,verified:!0,reliability:`Official / Policy Source`},{id:`news-2`,title:`Vetted Legal Clinics Announce Free Consultations in Berkeley`,summary:`Several non-
800profit legal coalitions are hosting a weekend walk-in clinic on Shattuck Ave. Services include free Know Your Rights materials, family safety plan preparation, and certified translation help for immigration documentation.`,source:`Immigrant Transit Coalition`,region:`Berkeley`,date:`July 18, 2026`,verified:!0,reliability:`Community Partner`},{id:`news-3`,title:`Alert: Unverified Checkpoint Claims circulating on Social Media`,summary:`We have received reports of potential ICE checkpoint activities near Hayward. However, our rapid response partners have searched the area and found zero active enforcement vehicles. Please do not spread unverified screenshots which cause panic.`,source:`Bay Area Rapid Response`,region:`Hayward`,date:`July 17, 2026`,verified:!1,reliability:`Debunked / Uncorroborated`}],es:[{id:`news-1`,title:`California amplía la elegibilidad de ayuda en efectivo CAPI para personas mayores`,summary:`El Departamento de Servicios Sociales de California anunció límites de ingresos actualizados para el Programa de Asistencia de Efectivo para Inmigrantes (CAPI). Las personas mayores y no ciudadanos con discapacidades elegibles en Oakland, Berkeley y Hayward pueden acceder a la ayuda en efectivo sin riesgos bajo las pautas actuales.`,source:`Servicios Sociales (CDSS)`,region:`Oakland`,date:`20 de julio de 2026`,verified:!0,reliability:`Oficial / Fuente de política`},{id:`news-2`,title:`Clínicas legales verificadas anuncian consultas gratuitas en Berkeley`,summary:`Varias coaliciones legales sin fines de lucro ofrecerán una clínica sin cita previa este fin de semana en Shattuck Ave. Los servicios incluyen materiales de Conozca sus derechos, preparación de planes de seguridad y ayuda de traducción certificada.`,source:`Coalición de Tránsito de Inmigrantes`,region:`Berkeley`,date:`18 de julio de 2026`,verified:!0,reliability:`Socio de la comunidad`},{id:`news-3`,title:`Alerta: Rumores falsos sobre puestos de control circulan en redes sociales`,summary:`Hemos recibido reportes sobre posibles actividades de control de ICE cerca de Hayward. Sin embargo, nuestros socios de respuesta rápida inspeccionaron el área y no hallaron patrullas de control activas. Rogamos no difundir capturas no verificadas que causen pánico.`,source:`Respuesta Rápida de la Bahía`,region:`Hayward`,date:`17 de julio de 2026`,verified:!1,reliability:`Desmentido / Sin confirmar`}],zh:[{id:`news-1`,title:`加州擴大長者CAPI現金救濟資格`,summary:`加州社會服務部宣布了更新的移民現金援助計劃(CAPI)收入門檻。符合條件的Oakland、Berkeley和Hayward老年人及殘疾非公民在現行指南下,可完全在不承擔公共負擔風險的前提下獲取現金救濟。`,source:`加州社會服務部 (CDSS)`,region:`Oakland`,date:`2026年7月20日`,verified:!0,reliability:`官方 / 政策來源`},{id:`news-2`,title:`經認證的法律診所在Berkeley宣布免費諮詢`,summary:`多個非營利法律聯盟正在Shattuck Ave舉辦週末免預約診所。服務包括免費的「了解您的權利」材料、家庭安全計劃制定,以及移民文件的認證翻譯服務。`,source:`移民過境聯盟`,region:`Berkeley`,date:`2026年7月18日`,verified:!0,reliability:`社區合作夥伴`},{id:`news-3`,title:`警報:社交媒體上流傳未經證實的執法檢查站傳言`,summary:`我們收到關於Hayward附近潛在ICE檢查站活動的報告。然而,我們的快速響應合作夥伴已搜索該區域,未發現任何活躍的執法車輛。請勿傳播未經證實的截圖,以免造成恐慌。`,source:`灣區快速響應聯盟`,region:`Hayward`,date:`2026年7月17日`,verified:!1,reliability:`已被澄清 / 未經證實`}],ht:[{id:`news-1`,title:`Kalifòni Elaji Elijiblite pou Kòb Sekou CAPI pou Granmoun`,summary:`Depatman Sèvis Sosyal Kalifòni anonse chanjman nan nivo revni pou Pwogram Asistans Lajan Kach pou Imigran (CAPI). Granmoun ak moun andikape ki elijib nan Oakland, Berkeley ak Hayward kapab jwenn sekou sa a san okenn risk anba direktiv aktyèl yo.`,source:`Kalifòni DSS (CDSS)`,region:`Oakland`,date:`20 Jiyè 2026`,verified:!0,reliability:`Sous Ofisyèl / Règleman`},{id:`news-2`,title:`Klinik Legal Verifye Anonse Konsiltasyon Gratis nan Berkeley`,summary:`Plizyè koalisyon legal ap òganize yon klinik gratis wikenn sa a sou Shattuck Ave. Sèvis yo gen ladan yo dokiman gratis sou "Koni Dwa Ou", preparasyon plan sekirite fanm
800i, ak tradiksyon sètifye pou dokiman imigrasyon.`,source:`Kominote Transit Imigran`,region:`Berkeley`,date:`18 Jiyè 2026`,verified:!0,reliability:`Patnè Kominote`},{id:`news-3`,title:`Alèt: Move Enfòmasyon sou Chèk ICE k ap Sikile sou Rezo Sosyo`,summary:`Nou te resevwa rapò sou aktivite chèk ICE toupre Hayward. Men, patnè repons rapid nou yo te fouye zòn nan epi yo pa jwenn okenn machin aktif. Tanpri pa pataje foto ki pa verifye ki ka lakòz panik.`,source:`Repons Rapid Zòn Bay`,region:`Hayward`,date:`17 Jiyè 2026`,verified:!1,reliability:`Demanti / San Prèv`}],ar:[{id:`news-1`,title:`كاليفورنيا توسع نطاق الأهلية لبرنامج المساعدة النقدية (CAPI) لكبار السن`,summary:`أعلنت إدارة الخدمات الاجتماعية بكاليفورنيا عن تحديث حدود الدخل لبرنامج المساعدة النقدية للمهاجرين (CAPI). يمكن لكبار السن المؤهلين وغير المواطنين ذوي الإعاقة في أوكلاند وبيركلي وهايوارد الحصول على الإغاثة النقدية بالكامل دون مخاطر بموجب التوجيهات الحالية.`,source:`إدارة الخدمات الاجتماعية (CDSS)`,region:`أوكلاند`,date:`٢٠ يوليو ٢٠٢٦`,verified:!0,reliability:`مصدر رسمي / سياسي`},{id:`news-2`,title:`العيادات القانونية المعتمدة تعلن عن استشارات مجانية في بيركلي`,summary:`تنظم عدة تحالفات قانونية غير ربحية عيادة مجانية في عطلة نهاية الأسبوع في شارع شاتوك (Shattuck Ave). وتشمل الخدمات مواد مجانية لمعرفة حقوقك، وإعداد خطط السلامة الأسرية، ومساعدة الترجمة المعتمدة لوثائق الهجرة.`,source:`تحالف عبور المهاجرين`,region:`بيركلي`,date:`١٨ يوليو ٢٠٢٦`,verified:!0,reliability:`شريك مجتمعي`},{id:`news-3`,title:`تنبيه: شائعات غير مؤكدة عن نقاط تفتيش تتداول على وسائل التواصل الاجتماعي`,summary:`تلقينا تقارير عن احتمال وجود أنشطة لنقاط تفتيش تابعة لـ ICE بالقرب من هايوارد. ومع ذلك، قام شركاؤنا في الاستجابة السريعة بتمشيط المنطقة ولم يجدوا أي مركبات نشطة. يرجى عدم نشر لقطات شاشة غير مؤكدة تسبب الذعر.`,source:`الاستجابة السريعة للخليج`,region:`هايوارد`,date:`١٧ يوليو ٢٠٢٦`,verified:!1,reliability:`مكشوفة / غير مؤكدة`}],pt:[{id:`news-1`,title:`Califórnia amplia elegibilidade para ajuda financeira CAPI para idosos`,summary:`O Departamento de Serviços Sociais da Califórnia anunciou limites de renda atualizados para o Programa de Assistência Financeira para Imigrantes (CAPI). Idosos elegíveis e não cidadãos com deficiência em Oakland, Berkeley e Hayward podem acessar a ajuda financeira sem risco de cargo público sob as diretrizes atuais.`,source:`DSS da Califórnia (CDSS)`,region:`Oakland`,date:`20 de julho de 2026`,verified:!0,reliability:`Oficial / Fonte de Política`},{id:`news-2`,title:`Clínicas jurídicas parceiras anunciam consultas gratuitas em Berkeley`,summary:`Várias coalizões jurídicas sem fins lucrativos estão organizando uma clínica gratuita no fim de semana na Shattuck Ave. Os serviços incluem materiais gratuitos de "Conheça Seus Direitos", preparação de plano de segurança familiar e traduções juramentadas para imigração.`,source:`Coalizão de Trânsito de Imigrantes`,region:`Berkeley`,date:`18 de julho de 2026`,verified:!0,reliability:`Parceiro Comunitário`},{id:`news-3`,title:`Alerta: Boatos de postos de controle não verificados circulando nas redes sociais`,summary:`Recebemos relatos de possíveis postos de controle do ICE perto de Hayward. No entanto, nossos parceiros de resposta rápida inspecionaram a área e não encontraram veículos ativos. Por favor, não espalhe capturas de tela não confirmadas para evitar pânico.`,source:`Resposta Rápida da Baía`,region:`Hayward`,date:`17 de julho de 2026`,verified:!1,reliability:`Desmentido / Não Confirmado`}],fr:[{id:`news-1`,title:`La Californie élargit l'éligibilité à l'aide financière CAPI pour les seniors`,summary:`Le Département des services sociaux de Californie a annoncé de nouveaux seuils de revenus pour le programme d’assistance financière aux immigrés (CAPI). Les personnes âgées et non-citoyens handicapés éligibles à Oakland, Berkeley et Hayward peuvent accéder à cette aide sans aucun risque d’impact sous les directives actuelles.`,source:`DSS de Californie (CDSS)`,region:`Oakland`,date:`20 juillet 2026`,verified:!0,reliability:`Officiel / Source Politique`},{id:`news-2`,title:`Des cliniques juridiques agréées annoncent des consultations gratuites à Berkeley`,summary:`Plusieurs coalitions juridiques à but non lucratif organisent une clinique gratuite ce week-end sur Shattuck Ave. Les services comprennent des documents gratuits sur vos droits, l’élaboration de plans de sécurité familiale et une aide à la traduction certifiée pour l’immigration.`,source:`Coalition Transit des Immigrés`,region:`Berkeley`,date:`18 juillet 2026`,verified:!0,reliability:`Partenaire Communautaire`},{id:`news-3`,title:`Alerte : Rumeurs non vérifiées de points de contrôle sur les réseaux sociaux`,summary:`Des rapports font état de possibles activités de contrôle de l’ICE près de Hayward. Cependant, nos partenaires de réponse rapide ont inspecté la zone et n’ont trouvé aucun véhicule actif. Veuillez ne pas partager de captures d’écran non vérifiées qui provoquent la panique.`,source:`Réponse Rapide de la Baie`,regi
800on:`Hayward`,date:`17 juillet 2026`,verified:!1,reliability:`Démenti / Non Corroboré`}],vi:[{id:`news-1`,title:`California Mở Rộng Quyền Lợi Cứu Trợ Tiền Mặt CAPI Cho Người Cao Niên`,summary:`Sở Dịch Vụ Xã Hội California đã công bố cập nhật ngưỡng thu nhập cho Chương Trình Hỗ Trợ Tiền Mặt Cho Người Nhập Cư (CAPI). Người cao tuổi và người không phải công dân bị khuyết tật đủ điều kiện ở Oakland, Berkeley, và Hayward có thể tiếp cận cứu trợ mà không gặp rủi ro gánh nặng công cộng.`,source:`Sở Xã Hội California (CDSS)`,region:`Oakland`,date:`20 Tháng Bảy, 2026`,verified:!0,reliability:`Nguồn Chính Thức / Chính Sách`},{id:`news-2`,title:`Phòng Khám Pháp Lý Xác Minh Công Bố Tư Vấn Miễn Phí Tại Berkeley`,summary:`Nhiều liên minh pháp lý phi lợi nhuận đang tổ chức phòng khám cuối tuần trên Đại lộ Shattuck. Các dịch vụ bao gồm tài liệu "Biết Quyền Của Bạn" miễn phí, chuẩn bị kế hoạch an toàn gia đình và hỗ trợ dịch thuật công chứng giấy tờ nhập cư.`,source:`Liên Minh Quá Cảnh Nhập Cư`,region:`Berkeley`,date:`18 Tháng Bảy, 2026`,verified:!0,reliability:`Đối Tác Cộng Đồng`},{id:`news-3`,title:`Cảnh Báo: Tin Đồn Trạm Kiểm Soát Chưa Xác Minh Lan Truyền Trên Mạng`,summary:`Chúng tôi đã nhận được báo cáo về các hoạt động trạm kiểm soát ICE tiềm ẩn gần Hayward. Tuy nhiên, đối tác phản ứng nhanh đã tìm kiếm khu vực và không tìm thấy phương tiện nào hoạt động. Xin vui lòng không chia sẻ ảnh màn hình chưa được xác minh.`,source:`Phản Ứng Nhanh Vùng Vịnh`,region:`Hayward`,date:`17 Tháng Bảy, 2026`,verified:!1,reliability:`Bác Bỏ / Chưa Xác Minh`}],tl:[{id:`news-1`,title:`Pinalawak ng California ang Kwalipikasyon sa CAPI Cash Relief para sa mga Senior`,summary:`Inanunsyo ng California Department of Social Services ang binagong mga threshold ng kita para sa Cash Assistance Program for Immigrants (CAPI). Ang mga karapat-dapat na matatanda at may kapansanan na hindi mamamayan sa Oakland, Berkeley, at Hayward ay makakakuha ng tulong nang walang panganib sa public charge.`,source:`California DSS (CDSS)`,region:`Oakland`,date:`Hulyo 20, 2026`,verified:!0,reliability:`Opisyal / Patakaran`},{id:`news-2`,title:`Mga Vetted Legal Clinic, Nag-anunsyo ng Libreng Konsultasyon sa Berkeley`,summary:`Maraming non-profit legal coalitions ang magho-host ng walk-in clinic ngayong weekend sa Shattuck Ave. Kabilang sa mga serbisyo ang libreng Know Your Rights materials, paghahanda ng plano sa kaligtasan ng pamilya, at sertipikadong tulong sa pagsasalin ng dokumento.`,source:`Immigrant Transit Coalition`,region:`Berkeley`,date:`Hulyo 18, 2026`,verified:!0,reliability:`Kasosyo sa Komunidad`},{id:`news-3`,title:`Babala: Mga Unverified Checkpoint Claims na Kumakalat sa Social Media`,summary:`May mga natanggap kaming ulat ng posibleng ICE checkpoint sa Hayward. Gayunpaman, hinanap ng aming rapid response partners ang lugar at walang nakitang aktibong sasakyan. Mangyaring huwag magbahagi ng hindi beripikadong mga screenshot para maiwasan ang takot.`,source:`Bay Area Rapid Response`,region:`Hayward`,date:`Hulyo 17, 2026`,verified:!1,reliability:`Pinasinungalingan / Hindi Beripikado`}],ru:[{id:`news-1`,title:`Калифорния расширяет право на получение денежной помощи CAPI для пожилых людей`,summary:`Департамент социального обеспечения Калифорнии объявил об обновлении порогов дохода для Программы денежной помощи иммигрантам (CAPI). Пожилые люди и неграждане с инвалидностью в Окленде, Беркли и Хейворде могут получить помощь без каких-либо рисков под санкции.`,source:`Департамент соцслужб (CDSS)`,region:`Oakland`,date:`20 июля 2026`,verified:!0,reliability:`Официальный источник`},{id:`news-2`,title:`Проверенные юридические клиники объявляют о бесплатных консультация
800х в Беркли`,summary:`Несколько некоммерческих юридических коалиций проводят бесплатные консультации на этих выходных на Шаттак-авеню. Услуги включают предоставление материалов "Знай свои права", подготовку планов семейной безопасности и заверенный перевод иммиграционных документов.`,source:`Коалиция транзита иммигрантов`,region:`Berkeley`,date:`18 июля 2026`,verified:!0,reliability:`Партнер сообщества`},{id:`news-3`,title:`Предупреждение: Неподтвержденные слухи о блокпостах распространяются в соцсетях`,summary:`Мы получили сообщения о возможной активности блокпостов ICE в районе Хейворда. Однако наши партнеры по быстрому реагированию проверили этот район и не обнаружили активных машин спецслужб. Пожалуйста, не распространяйте непроверенные скриншоты.`,source:`Быстрое реагирование залива`,region:`Hayward`,date:`17 июля 2026`,verified:!1,reliability:`Опровергнуто / Нет улик`}]},OC={en:{all:`Bay Area`,oakland:`Oakland`,berkeley:`Berkeley`,hayward:`Hayward`,searchPlaceholder:`Filter articles or warnings...`,antiMisinfoTitle:`Combating Misinformation`,antiMisinfoDesc:`Unverified social media posts cause unnecessary panic. Every article below carries a reliability rating from trust networks to protect you from scare tactics.`,noArticles:`No articles match your search criteria. Check back later for updates.`},es:{all:`Área de la Bahía`,oakland:`Oakland`,berkeley:`Berkeley`,hayward:`Hayward`,searchPlaceholder:`Filtrar artículos o alertas...`,antiMisinfoTitle:`Combatir la desinformación`,antiMisinfoDesc:`Las publicaciones no verificadas causan pánico innecesario. Cada artículo cuenta con una calificación de confiabilidad para protegerlo de tácticas de miedo.`,noArticles:`Ningún artículo coincide con su búsqueda. Inténtelo más tarde.`},zh:{all:`灣區 (Bay Area)`,oakland:`屋崙 (Oakland)`,berkeley:`伯克利 (Berkeley)`,hayward:`海沃德 (Hayward)`,searchPlaceholder:`篩選文章或警報...`,antiMisinfoTitle:`打擊虛假信息`,antiMisinfoDesc:`未經證實的社交媒體帖子會造成不必要的恐慌。以下每篇文章都帶有信任網絡的可靠性評級,以保護您免受恐嚇手段的影響。`,noArticles:`沒有文章符合您的搜索條件。請稍後再回來查看。`},ht:{all:`Zòn Bay`,oakland:`Oakland`,berkeley:`Berkeley`,hayward:`Hayward`,searchPlaceholder:`Filtre nouvèl oswa avètisman...`,antiMisinfoTitle:`Goumen kont Dezenfòmasyon`,antiMisinfoDesc:`Piblikasyon rezo sosyal ki pa verifye lakòz panik san nesesite. Chak atik ki anba a gen yon evalyasyon konfyans pou pwoteje ou kont taktik pè.`,noArticles:`Pa gen okenn nouvèl ki koresponn ak rechèch ou a. Tcheke ankò pita.`},ar:{all:`منطقة الخليج (Bay Area)`,oakland:`أوكلاند (Oakland)`,berkeley:`بيركلي (Berkeley)`,hayward:`هايوارد (Hayward)`,searchPlaceholder:`تصفية المقالات أو التحذيرات...`,antiMisinfoTitle:`محاربة المعلومات المضللة`,antiMisinfoDesc:`تتسبب المنشورات غير المؤكدة على وسائل التواصل الاجتماعي في ذعر غير ضروري. تحمل كل مقالة تصنيف موثوقية من شبكات موثوقة لحمايتك.`,noArticles:`لا توجد مقالات تطابق معايير البحث الخاصة بك. تحقق لاحقًا.`},pt:{all:`Área da Baía`,oakland:`Oakland`,berkeley:`Berkeley`,hayward:`Hayward`,searchPlaceholder:`Filtrar artigos ou alertas...`,antiMisinfoTitle:`Combatendo a Desinformação`,antiMisinfoDesc:`Postagens não confirmadas nas redes sociais causam pânico desnecessário. Cada artigo possui uma classificação de confiabilidade de redes de confiança.`,noArticles:`Nenhum artigo corresponde aos seus critérios de busca. Tente novamente mais tarde.`},fr:{all:`Région de la Baie`,oakland:`Oakland`,berkeley:`Berkeley`,hayward:`Hayward`,searchPlaceholder:`Filtrer les articles ou alertes...`,antiMisinfoTitle:`Combattre la Désinformation`,antiMisinfoDesc:`Les publications non vérifiées sur les réseaux sociaux provoquent une panique inutile. Chaque article porte une évaluation de fiabilité de réseaux de confiance.`,noArticles:`Aucun article ne correspond à votre recherche. Veuillez réessayer plus tard.`},vi:{all:`Vùng Vịnh (Bay Area)`,oakland:`Oakland`,berkeley:`Berkeley`,hayward:`Hayward`,searchPlaceholder:`Lọc bài viết hoặc cảnh báo...`,antiMisinfoTitle:`Chống Tin Giả`,antiMisinfoDesc:`Các bài viết chưa xác minh trên mạng xã hội gây hoang mang không cần thiết. Mỗi bài viết đều có đánh giá độ tin cậy để bảo vệ bạn.`,noArticles:`Không có bài viết nào khớp với tìm kiếm của bạn. Hãy quay lại sau.`},tl:{all:`Bay Area`,oakland:`Oakland`,berkeley:`Berkeley`,hayward:`Hayward`,searchPlaceholder:`I-filter ang mga artikulo...`,antiMisinfoTitle:`Labanan ang Maling Impormasyon`,antiMisinfoDesc:`Ang mga hindi beripikadong post ay nagdudulot ng takot. Bawat artikulo ay may rating ng pagiging maaasahan mula sa mga pinagkakatiwalaang network.`,noArticles:`Walang mga artikulong tugma sa iyong hinahanap. Mag-check muli mamaya.`},ru:{all:`Район Залива`,oakland:`Окленд`,berkeley:`Беркли`,hayward:`Хейворд`,searchPlaceholder:`Фильтровать статьи...`,antiMisinfoTitle:`Борьба с дезинформацией`,antiMisinfoDesc:`Неподтвержденные посты вызывают панику. Каждая статья снабжена рейтингом надежности, чтобы оградить вас от тактики запугивания.`,noArticles:`Нет статей, соответствующих вашему запросу. Проверьте позже.`}};function kC({dict:e,currentLang:t}){let[n,r]=(0,_.useState)([]),[i,a]=(0,_.useState)(`all`),[o,s]=(0,_.useState)(``),c=DC[t]?t:`en`,l=OC[c]||OC.en;(0,_.useEffect)(()=>{let e=()=>{};try{e=qg(Ag(xu(bC,`newsAlerts`)),e=>{let t=e.docs.map(e=>({id:e.id,...e.data()}));if(t.length===0)r(DC[c]||DC.en);else{let e=t.filter(e=>!e.lang||e.lang===c);if(e.length===0){let e=t.filter(e=>e.lang===`en`||!e.lang);r(e.length>0?e:DC[c]||DC.en)}else r(e)}},e=>{console.warn(`Firestore newsAlerts read failed. Activating default fallback.`,e),r(DC[c]||DC.en)})}catch(e){console.error(`Firebase newsAlerts integration failed. Using local news.`,e),r(DC[c]||DC.en)}return()=>{e()}},[c]);let u=n,d=[{id:`all`,emoji:`🌐`,label:l.all},{id:`Oakland`,emoji:`🌳`,label:l.oakland||`Oakland`},{id:`San Francisco`,emoji:`Bridge`,label:`San Francisco`},{id:`San Jose`,emoji:`💻`,label:`San Jose`},{id:`Berkeley`,emoji:`🎓`,label:l.berkeley||`Berkeley`},{id:`Hayward`,emoji:`☀️`,label:l.hayward||`Hayward`},{id:`Richmond`,emoji:`⚓`,label:`Richmond`},{id:`Fremont`,emoji:`⛰️`,label:`Fremont`},{id:`Vallejo`,emoji:`🎡`,label:`Vallejo`},{id:`Concord`,emoji:`🌳`,label:`Concord`},{id:`San Mateo`,emoji:`🌲`,label:`San Mateo`}],f=u.filter(e=>
800{let t=i===`all`||e.region.toLowerCase()===i.toLowerCase(),n=!o||e.title.toLowerCase().includes(o.toLowerCase())||e.summary.toLowerCase().includes(o.toLowerCase());return t&&n});return(0,$.jsxs)(`div`,{style:{padding:`16px`},children:[(0,$.jsxs)(`div`,{style:{borderBottom:`1px solid var(--border-muted)`,paddingBottom:`16px`,marginBottom:`16px`},children:[(0,$.jsxs)(`h2`,{style:{fontSize:`1.25rem`,fontWeight:`800`,color:`var(--text-white)`,display:`flex`,alignItems:`center`,gap:`8px`},children:[(0,$.jsx)(ue,{style:{color:`var(--accent)`}}),e.tabNews||`Immigrant Safety News`]}),(0,$.jsx)(`p`,{style:{fontSize:`0.85rem`,color:`var(--text-muted)`,marginTop:`4px`},children:e.mainSubtitle||`Grounded summaries of immigration-enforcement notices and guidelines.`})]}),(0,$.jsxs)(`div`,{style:{marginBottom:`16px`},children:[(0,$.jsx)(`label`,{style:{fontSize:`0.75rem`,fontWeight:`700`,textTransform:`uppercase`,color:`var(--text-muted)`,display:`block`,marginBottom:`6px`},children:`📍 Filter by Location:`}),(0,$.jsxs)(`div`,{style:{position:`relative`},children:[(0,$.jsx)(`select`,{value:i,onChange:e=>a(e.target.value),className:`chat-input`,style:{width:`100%`,background:`var(--bg-charcoal)`,color:`var(--text-white)`,border:`1px solid var(--border-muted)`,borderRadius:`12px`,padding:`10px 14px`,fontSize:`0.85rem`,fontWeight:`700`,cursor:`pointer`,appearance:`none`,WebkitAppearance:`none`},children:d.map(e=>(0,$.jsxs)(`option`,{value:e.id,children:[e.emoji===`Bridge`?`🌉`:e.emoji,` `,e.label]},e.id))}),(0,$.jsx)(`div`,{style:{position:`absolute`,right:`14px`,top:`50%`,transform:`translateY(-50%)`,pointerEvents:`none`,color:`var(--accent)`,fontSize:`0.75rem`},children:`▼`})]})]}),(0,$.jsxs)(`div`,{style:{position:`relative`,marginBottom:`16px`},children:[(0,$.jsx)(`input`,{type:`text`,className:`chat-input`,style:{width:`100%`,paddingLeft:`40px`,background:`var(--bg-charcoal)`,border:`1px solid var(--border-muted)`,borderRadius:`12px`,color:`var(--text-white)`},placeholder:l.searchPlaceholder,value:o,onChange:e=>s(e.target.value)}),(0,$.jsx)(pe,{style:{position:`absolute`,left:`14px`,top:`50%`,transform:`translateY(-50%)`,width:`16px`,color:`var(--text-muted)`}})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,gap:`10px`,background:`var(--green-bg)`,border:`1px solid var(--green)`,padding:`12px`,borderRadius:`12px`,marginBottom:`20px`},children:[(0,$.jsx)(he,{style:{color:`var(--green)`,flexShrink:0,marginTop:`2px`},size:18}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`strong`,{style:{fontSize:`0.85rem`,color:`var(--success-text)`,display:`block`},children:l.antiMisinfoTitle}),(0,$.jsx)(`span`,{style:{fontSize:`0.75rem`,color:`var(--text-muted)`,lineHeight:`1.4`},children:l.antiMisinfoDesc})]})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`16px`},children:[f.map(e=>(0,$.jsxs)(`div`,{className:`dashboard-card`,style:{background:`var(--bg-card)`,border:`1px solid var(--border-muted)`,padding:`16px`},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:`10px`},children:[(0,$.jsxs)(`span`,{style:{fontSize:`0.75rem`,color:`var(--text-muted)`,display:`flex`,alignItems:`center`,gap:`4px`,fontWeight:`700`},children:[(0,$.jsx)(j,{size:12,style:{color:`var(--oakland-gold)`}}),e.region]}),(0,$.jsx)(`span`,{style:{fontSize:`0.7rem`,fontWeight:`800`,padding:`2px 8px`,borderRadius:`50px`,background:e.verified?`var(--green-bg)`:`var(--danger-bg)`,color:e.verified?`var(--success-text)`:`var(--danger-text)`,border:e.verified?`1px solid var(--green)`:`1px solid var(--danger)`},children:e.reliability})]}),(0,$.jsx)(`h3`,{style:{fontSize:`1rem`,fontWeight:`800`,marginBottom:`8px`,lineHeight:`1.3`,color:`var(--text-white)`},children:e.title}),(0,$.jsx)(`p`,{style:{fontSize:`0.8rem`,color:`var(--text-muted)`,lineHeight:`1.5`,marginBottom:`12px`},children:e.summary}),(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,borderTop:`1px solid var(--border-muted)`,paddingTop:`10px`,fontSize:`0.7rem`,color:`var(--text-muted)`},children:[(0,$.jsxs)(`span`,{children:[`Source: `,(0,$.jsx)(`strong`,{children:e.source})]}),(0,$.jsx)(`span`,{children:e.date})]})]},e.id)),f.length===0&&(0,$.jsx)(`p`,{style:{fontSize:`0.85rem`,color:`var(--text-muted)`,textAlign:`center`,padding:`24px`},children:l.noArticles})]})]})}var AC={en:`en-US`,es:`es-ES`,zh:`zh-CN`,ht:`fr-FR`,ar:`ar-SA`,pt:`pt-PT`,fr:`fr-FR`,vi:`vi-VN`,tl:`fil-PH`,ru:`ru-RU`},jC={en:{rights:`Remember: You have the right to remain silent. Do not sign anything without a lawyer. Do not open the door unless they slip a warrant signed by a judge under the door.`,help:`For legal emergencie
800s, tap the Quick Dial button to contact the Oakland Rapid Response hotline immediately.`,benefits:`Yes! In California, you are eligible for food assistance and the CAPI cash relief program regardless of your immigration status.`,clinics:`La Clínica de La Raza in Fruitvale offers multi-lingual medical services. They never share records with federal authorities.`},es:{rights:`Recuerde: Tiene derecho a guardar silencio. No firme nada sin un abogado. No abra la puerta a menos que pasen una orden firmada por un juez por debajo de la puerta.`,help:`Para emergencias legales, llame de inmediato a la línea directa de Respuesta Rápida de Oakland.`,benefits:`¡Sí! En California, es elegible para asistencia alimentaria y alivio en efectivo de CAPI independientemente de su estatus migratorio.`,clinics:`La Clínica de La Raza en Fruitvale ofrece servicios médicos bilingües. Nunca comparten registros con las autoridades.`},ar:{rights:`تذكر: لديك الحق في البقاء صامتاً. لا توقع على أي شيء بدون محامٍ. لا تفتح الباب إلا إذا مرروا مذكرة موقعة من قاضٍ من تحت الباب.`,help:`لحالات الطوارئ القانونية، اتصل بخط الاستجابة السريعة في أوكلاند فوراً.`,benefits:`نعم! في كاليفورنيا، أنت مؤهل للحصول على المساعدات الغذائية وبرنامج المساعدات النقدية (CAPI) بغض النظر عن وضعك القانوني.`,clinics:`تقدم عيادة La Clínica de La Raza في فروتفيل خدمات طبية بلغات متعددة. ولا يشاركون السجلات أبداً مع السلطات الفيدرالية.`}},MC={"i am exercising my first amendment":`Estoy ejerciendo mi primera enmienda.`,"i am remaining silent and wish to 
800speak to my lawyer":`Tengo derecho a permanecer en silencio y deseo hablar con mi abogado.`,"i have the right to remain silent":`Tengo el derecho a permanecer en silencio.`,"i want to see a warrant":`Quiero ver una orden de arresto o registro.`,"am i being detained":`¿Estoy detenido?`,"i do not consent to this search":`No doy mi consentimiento para este registro o requisa.`,"i wish to speak with my attorney":`Deseo hablar con mi abogado.`,hello:`Hola`,"good morning":`Buenos días`,"good afternoon":`Buenas tardes`,"good evening":`Buenas noches`,"please help me":`Por favor ayúdeme`,"where is the nearest shelter":`¿Dónde está el refugio más cercano?`,"where can i find food":`¿Dónde puedo encontrar comida?`,"safe place":`Lugar seguro`,"estoy ejerciendo mi primera enmienda":`I am exercising my first amendment.`,"tengo derecho a permanecer en silencio y deseo hablar con mi abogado":`I have the right to remain silent and wish to speak with my attorney.`,"tengo derecho a permanecer en silencio":`I have the right to remain silent.`,"quiero ver una orden":`I want to see a warrant.`,"estoy detenido":`Am I being detained?`,"no doy mi consentimiento para este registro":`I do not consent to this search.`,"deseo hablar con mi abogado":`I wish to speak with my attorney.`,"dígale al oficial que exijo hablar con mi abogado":`Tell the officer that I demand to speak with my attorney.`,"quiero hablar con mi abogado":`I want to speak with my lawyer.`,hola:`Hello`,ayuda:`Help`,"donde puedo encontrar comida":`Where can I find food?`,"donde hay un lugar seguro":`Where is a safe place?`},NC=e=>{let t=e.toLowerCase().trim(),n=e;for(let r of[`translate to spanish`,`translate to english`,`translate`,`traduce al ingles`,`traduce al inglés`,`traduce al español`,`traduce`,`tell the officer in spanish that`,`tell the officer that`,`dígale al oficial que`,`digale al oficial que`,`can you tell the officer in spanish that`,`can you tell the officer that`,`how do you say`,`como se dice`])if(t.startsWith(r)){n=e.slice(r.length).trim();break}n=n.replace(/^[:,\s]+/,``).replace(/^that\s+/i,``);let r=n.toLowerCase().replace(/[.,\/#!$%?\^&\*;:{}=\-_`~()]/g,``).trim();if(MC[r])return MC[r];for(let e of Object.keys(MC))if(r.includes(e)||e.includes(r))return MC[e];let i=r.split(/\s+/),a={i:`yo`,am:`estoy`,remaining:`permaneciendo`,silent:`en silencio`,and:`y`,wish:`deseo`,to:`a`,speak:`hablar`,with:`con`,my:`mi`,lawyer:`abogado`,attorney:`abogado`,officer:`oficial`,first:`primera`,amendment:`enmienda`,exercising:`ejerciendo`,rights:`derechos`,not:`no`,guilty:`culpable`,detained:`detenido`,free:`libre`,go:`ir`,food:`comida`,safe:`seguro`,place:`lugar`,stop:`deténgase`,help:`ayuda`,document:`documento`,warrant:`orden`,tengo:`i have`,derecho:`right`,permanecer:`to remain`,silencio:`silent`,hablar:`to speak`,abogado:`lawyer`,oficial:`officer`};return i.map(e=>a[e]||e).join(` `)};function PC({dict:e,currentLang:t,apiBase:n=`http://127.0.0.1:3001`}){let[r,i]=(0,_.useState)(`Level1`),[a,o]=(0,_.useState)(!1),[s,c]=(0,_.useState)(`idle`),[l,u]=(0,_.useState)(!1),[d,f]=(0,_.useState)([]),[p,m]=(0,_.useState)(``),[h,g]=(0,_.useState)(null);(0,_.useEffect)(()=>{try{if(xC){let e=xC.startChat({history:[{role:`user`,parts:[{text:`Hello Centinela`}]},{role:`model`,parts:[{text:`¡Hola! I am Centinela, your bilingual safety companion. Your conversation is secure and completely anonymous. How can I help you today?`}]}],systemInstruction:{parts:[{text:`You are Centinela, a compassionate, bilingual, and highly-trained immigrant safety companion and legal rights advisor for the Oakland community. Keep your responses comforting, extremely concise, and in the user's selected language: ${t||`en`}.`}]}});g(e)}}catch(e){console.warn(`Could not initialize Gemini Chat Session. Fallback active.`,e)}},[t]);let[v,y]=(0,_.useState)(!1),[b,x]=(0,_.useState)([{id:`1`,sender:`assistant`,text:`Beta: Hi officer, I'm Beta. I am this user's personal assistant, legal helper, and translator. I am translating this conversation in real-time to ensure clear, lawful communication.`},{id:`2`,sender:`officer`,text:`Officer: Please show me your identification papers.`},{id:`3`,sender:`user`,text:`User: Quisiera hablar con mi abogado antes de responder. (I would like to speak to my lawyer before answering.)`}]),[S,C]=(0,_.useState)(`es`);(0,_.useRef)(null),(0,_.useRef)(null);let w=(0,_.useRef)(null),T=(0,_.useRef)(null),E=(0,_.useRef)(null),D=(0,_.useRef)(null),O=(0,_.useRef)(null),k=(0,_.useRef)(null),ee=(0,_.useRef)(!1),te=()=>{let e=D.current;if(!e)return;let t=e.getContext(`2d`),n=e.width,r=e.height,i=E.current?E.current.frequencyBinCount:64,a=(E.current,new Uint8Array(i)),o=()=>{O.current=requestAnimationFrame(o),E.current&&l&&E.current.getByteFrequencyData(a),t.fillStyle=`#0a0a0c`,t.fillRect(0,0,n,r);let e=t.createLinearGradient(0,0,n,0);e.addColorStop(0,`#0f5132`),e.addColorStop(.5,`#d8a43f`),e.addColorStop(1,`#0f5132`),t.lineWidth=3,t.strokeStyle=e,t.beginPath();let s=n/i,c=0;for(let e=0;e<i;e++){let n=(a[e]||0)/255,i=l?n*r*.9:Math.sin(e*.15+Date.now()/150)*4,o=r/2+(e%2==0?i:-i)/2;e===0?t.moveTo(c,o):t.lineTo(c,o),c+=s}t.lineTo(n,r/2),t.stroke()};o()};(0,_.useEffect)(()=>
800(te(),()=>{O.current&&cancelAnimationFrame(O.current)}),[l]);let ne=async()=>{try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});w.current=e;let t=new(window.AudioContext||window.webkitAudioContext);T.current=t;let n=t.createMediaStreamSource(e),r=t.createAnalyser();r.fftSize=128,n.connect(r),E.current=r,u(!0)}catch(e){console.warn(`Microphone access denied or unavailable.`,e)}},re=()=>{w.current&&=(w.current.getTracks().forEach(e=>e.stop()),null),T.current&&T.current.state!==`closed`&&T.current.close(),E.current=null,u(!1)},ie=()=>{let e=window.SpeechRecognition||window.webkitSpeechRecognition;if(!e){alert(`Your browser does not support Speech Recognition. Please use Chrome or Safari.`);return}let n=new e;k.current=n,n.lang=AC[t]||`en-US`,n.continuous=!1,n.interimResults=!1,n.onstart=()=>{c(`listening`),ne()},n.onerror=e=>{console.error(`Gemini speech capture error:`,e.error),c(`idle`),re()},n.onend=()=>{c(`idle`),re()},n.onresult=async e=>{let t=e.results[0][0].transcript;f(e=>[...e,{sender:`user`,text:t}]),await M(t)},n.start()},j=async e=>{ee.current=!1,c(`speaking`);let n=e.toLowerCase(),r=``,i=!1;if(n.includes(`translat`)||n.includes(`traduc`)||n.includes(`traduz`)||n.includes(`tell the officer`)||n.includes(`dígale`)||n.includes(`digale`)){i=!0;let a=NC(e),o=n.includes(`spanish`)||n.includes(`espanol`)||n.includes(`español`)||n.includes(`traduc`)||n.includes(`traduz`)||n.includes(`dígale`)||n.includes(`digale`);r=t===`es`||!o?`He traducido eso al inglés para ti: "${a}".`:`I have translated that to Spanish for you: "${a}".`}else r=n.includes(`food`)||n.includes(`snack`)||n.includes(`eat`)||n.includes(`pantry`)||n.includes(`hungry`)||n.includes(`comida`)||n.includes(`alimento`)||n.includes(`bocado`)?t===`es`?`Aquí tienes despensas de alimentos seguras en el Área de la Bahía donde nunca te pedirán identificación o estatus migratorio:
801• Oakland Food Pantry: 2201 Broadway, Oakland, CA 94612.
802• Berkeley Food Pantry: 2000 University Ave, Berkeley, CA 94704.
803• Centro de Alimentos de Fruitvale (La Clínica): 3434 E 12th St, Oakland, CA 94601.
804Todas estas ubicaciones siguen protocolos estrictos de santuario (sin compartir datos con el gobierno).`:`Here are trusted Bay Area food resources and pantries where no ID, paperwork, or immigration status is ever requested:
805• Oakland Food Pantry: 2201 Broadway, Oakland, CA 94612.
806• Berkeley Food Pantry: 2000 University Ave, Berkeley, CA 94704.
807• Fruitvale Food Pantry (La Clínica): 3434 E 12th St, Oakland, CA 94601.
808These locations are certified safe spaces and follow strict local sanctuary guidelines.`:n.includes(`safe place`)||n.includes(`shelter`)||n.includes(`refugio`)||n.includes(`lugar seguro`)||n.includes(`haven`)||n.includes(`housing`)||n.includes(`somewhere safe`)?t===`es`?`Aquí tienes santuarios oficiales y refugios de emergencia seguros en el Área de la Bahía que son 100% confidenciales:
809• First Presbyterian Church of Oakland: 2610 Broadway, Oakland, CA 94612 (Santuario nacional seguro).
810• St. Mary's Center: 925 Brockhurst St, Oakland, CA 94608 (Refugio familiar seguro).
811• East Oakland Community Project: 7515 International Blvd, Oakland, CA 94621 (Hospedaje de emergencia).
812Bajo la ley santuario de California (SB 54), las agencias de policía locales tienen prohibido compartir tu información con ICE en estos lugares.`:`Here are officially designated safe sanctuaries and emergency shelters in the Bay Area that are 100% confidential:
813• First Presbyterian Church of Oakland: 2610 Broadway, Oakland, CA 94612 (National sanctuary safe space).
814• St. Mary's Center: 925 Brockhurst St, Oakland, CA 94608 (Safe shelter for families & seniors).
815• East Oakland Community Project: 7515 International Blvd, Oakland, CA 94621 (Emergency housing & shelter).
816Under California SB 54, local authorities are strictly prohibited from collaborating with ICE or sharing your data at these designated safe zones.`:n.includes(`ice`)||n.includes(`arrest`)||n.includes(`migra`)||n.includes(`retén`)||n.includes(`reten`)||n.includes(`oficial`)||n.includes(`polic`)||n.includes(`encuentr`)||n.includes(`raid`)||n.includes(`checkpoint`)||n.includes(`stop`)?t===`es`?`Si te encuentras con agentes de ICE o la policía, recuerda: 1) Tienes el derecho absoluto a permanecer en silencio. No respondas preguntas sobre tu origen. 2) No abras la puerta de tu hogar a menos que deslicen una orden judicial firmada por un juez de bajo de la puerta. 3) No firmes ningún papel sin que tu abogado lo revise.`:`If you encounter ICE or law enforcement, stay calm and remember your rights: 1) You have the absolute right to remain silent—you do not have to discu
816ss your citizenship or entry status. 2) Never open your door unless they slide a warrant signed by a judicial judge under the door. 3) Do not sign any administrative papers without a lawyer.`:n.includes(`hola`)||n.includes(`buenos`)||n.includes(`tardes`)||n.includes(`saludo`)||n.includes(`quién eres`)||n.includes(`quien eres`)||n.includes(`hello`)||n.includes(`hi`)||n.includes(`hey`)||n.includes(`greetings`)||n.includes(`who are you`)?t===`es`?`¡Hola! Soy Centinela, tu asistente y compañero de seguridad bilingüe en vivo. Estoy aquí para informarte de manera confidencial sobre tus derechos constitucionales y recursos comunitarios seguros. ¿De qué te gustaría hablar hoy?`:`Hello! I am Centinela, your live secure safety companion. I am fully operational and ready to guide you on your constitutional protections, safe health centers, and emergency community resources. How can I assist you today?`:n.includes(`clínic`)||n.includes(`clinic`)||n.includes(`salud`)||n.includes(`med`)||n.includes(`hospital`)||n.includes(`enfermo`)||n.includes(`doctor`)?t===`es`?`Puedes acudir de forma totalmente segura a centros como La Clínica de la Raza en Fruitvale (3434 E 12th St, Oakland, CA 94601). Bajo las leyes santuario de California (SB 54), los centros de salud pública son espacios seguros y nunca compartirán tus datos médicos ni estatus migratorio.`:`Safe health centers like West Oakland Health Center (700 Adeline St, Oakland, CA 94607) and La Clínica de la Raza offer compassionate care without asking for immigration details. Under California sanctuary laws, your medical records remain completely secure.`:n.includes(`derech`)||n.includes(`abogad`)||n.includes(`lawyer`)||n.includes(`silenc`)||n.includes(`ley`)||n.includes(`attorney`)||n.includes(`legal`)?t===`es`?`Tienes derechos constitucionales garantizados sin importar tu estatus. Puedes decir claramente: 'Estoy ejerciendo mi derecho a permanecer en silencio y exijo hablar con un abogado'. Organizaciones como Centro Legal de la Raza (3400 E 12th St, Oakland, CA 94601) brindan asesoramiento legal confidencial.`:`You have powerful constitutional rights under the U.S. Constitution regardless of legal status. If stopped, state clearly: 'I am remaining silent and I want to speak to an attorney.' Free or low-cost services are available through local partners like Centro Legal de la Raza (3400 E 12th St, Oakland, CA 94601).`:n.includes(`gracias`)||n.includes(`ok`)||n.includes(`bien`)||n.includes(`thank`)||n.includes(`thanks`)||n.includes(`cool`)?t===`es`?`¡No hay de qué! Estoy aquí para apoyarte de forma completamente anónima. Recuerda que no guardamos registros de tus conversaciones ni datos personales para tu total privacidad y tranquilidad.`:`You are very welcome! I am here to help keep you safe and informed in total privacy. Remember that your session here is completely anonymous and transient.`:t===`es`?`Entendido. Recuerda que, bajo las leyes santuario de California (SB 54), las agencias de policía locales tienen prohibido colaborar con ICE o compartir tus datos personales. Estoy aquí para guiarte en seguridad legal, clínicas médicas o despensas de alimentos. ¿En qué puedo ayudarte?`:`Under California's Sanctuary State Law (SB 54), local police are strictly prohibited from sharing your information or collaborating with ICE agents. I can guide you securely on legal aid, food distribution sites, or health services. What would you like to ask?`;if(ee.current)return;m(``),f(e=>[...e,{sender:`assistant`,text:``,isStreaming:!0}]);let a=r.split(` `),o=``;for(let e=0;e<a.length&&!ee.current;e++)o+=(e===0?``:` `)+a[e],m(o),f(e=>{let t=[...e],n=t.findIndex(e=>e.isStreaming);return n!==-1&&(t[n]={sender:`assistant`,text:o,isStreaming:!0}),t}),await new Promise(e=>setTimeout(e,60));if(ee.current){c(`idle`);return}f(e=>{let t=[...e],n=t.findIndex(e=>e.isStreaming);return n!==-1&&(t[n]={sender:`assistant`,text:r}),t}),i||de(r,t),c(`idle`)},M=async e=>{ee.current=!1,c(`connecting`),m(`Centinela is thinking...`);let n=``;try{if(h){c(`speaking`);let r=await h.sendMessageStream(e);if(ee.current){c(`idle`);return}m(``),f(e=>[...e,{sender:`assistant`,text:``,isStreaming:!0}]);for await(let e of r.stream){if(ee.current)break;let t=e.text();n+=t,m(n),f(e=>{let t=[...e],r=t.findIndex(e=>e.isStreaming);return r!==-1&&(t[r]={sender:`assistant`,text:n,isStreaming:!0}),t})}if(ee.current){c(`idle`);return}f(e=>{let t=[...e],r=t.findIndex(e=>e.isStreaming);return r!==-1&&(t[r]={sender:`assistant`,text:n}),t}),de(n,t),c(`idle`);return}else throw Error(`Chat session not initialized`)}catch(r){if(ee.current){c(`idle`);return}
816console.warn(`Gemini Live SDK failed, trying direct Google Developer REST API...`,r);try{let r=`AIzaSyDummyKeyPlaceholderForCentinela`;if(r.includes(`Dummy`)||r.includes(`Placeholder`))throw Error(`API key is placeholder`);let i=await fetch(`https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:generateContent?key=${r}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({contents:[{parts:[{text:e}]}],systemInstruction:{parts:[{text:`You are Centinela, a compassionate, bilingual, and highly-trained immigrant safety companion, translator, and legal rights advisor for the Bay Area community. Keep your responses comforting, extremely concise, factual, and 100% accurate (with absolutely no false information). Respond in the user's selected language: ${t||`en`}.`}]},generationConfig:{temperature:.5,maxOutputTokens:800}})});if(ee.current){c(`idle`);return}if(!i.ok)throw Error(`REST API returned status ${i.status}`);let a=await i.json();if(ee.current){c(`idle`);return}if(a.candidates&&a.candidates[0]&&a.candidates[0].content&&a.candidates[0].content.parts[0]){n=a.candidates[0].content.parts[0].text,m(n),f(e=>[...e,{sender:`assistant`,text:n}]),de(n,t),c(`idle`);return}else throw Error(`Invalid response shape`)}catch(t){if(ee.current){c(`idle`);return}console.warn(`Gemini REST API failed, utilizing upgraded on-device conversational fallback:`,t),await j(e)}}},ce=()=>{re(),k.current&&k.current.stop(),c(`idle`)},le=()=>{let e=window.SpeechRecognition||window.webkitSpeechRecognition;if(!e){alert(`Your browser does not support local Speech Recognition. Please use Chrome or Safari.`);return}let n=new e;k.current=n,n.lang=AC[t]||`en-US`,n.continuous=!1,n.interimResults=!1,n.onstart=()=>{c(`listening`),ne()},n.onerror=e=>{console.error(`Local speech recognition error:`,e.error),c(`idle`),re()},n.onend=()=>{c(`idle`),re()},n.onresult=e=>{let t=e.results[0][0].transcript;f(e=>[...e,{sender:`user`,text:t}]),ue(t)},n.start()},ue=e=>{c(`speaking`);let n=e.toLowerCase(),r=jC[t]||jC.en,i=`I am operating in strict offline Local-Only Mode. I can assist you with your legal r
816ights, food resources, or medical safe zones. What is your question?`;n.includes(`right`)||n.includes(`derecho`)||n.includes(`silencio`)||n.includes(`silent`)||n.includes(`lawyer`)||n.includes(`abogado`)||n.includes(`door`)||n.includes(`puerta`)?i=r.rights:n.includes(`food`)||n.includes(`comida`)||n.includes(`pantry`)||n.includes(`benefits`)||n.includes(`beneficio`)||n.includes(`capi`)||n.includes(`cash`)?i=r.benefits:n.includes(`clinic`)||n.includes(`clínica`)||n.includes(`médico`)||n.includes(`medical`)||n.includes(`health`)||n.includes(`salud`)?i=r.clinics:(n.includes(`help`)||n.includes(`auxilio`)||n.includes(`ayuda`))&&(i=r.help),m(i),f(e=>[...e,{sender:`assistant`,text:i}]),de(i,t),c(`idle`)},de=(e,t)=>{if(!ee.current&&window.speechSynthesis){window.speechSynthesis.cancel();let n=new SpeechSynthesisUtterance(e);n.lang=AC[t]||`en-US`,window.speechSynthesis.speak(n)}};return(0,$.jsxs)(`div`,{style:{padding:`16px`},children:[(0,$.jsxs)(`div`,{style:{borderBottom:`1px solid var(--border-muted)`,paddingBottom:`16px`,marginBottom:`16px`},children:[(0,$.jsxs)(`h2`,{style:{fontSize:`1.25rem`,fontWeight:`800`,color:`var(--text-white)`,display:`flex`,alignItems:`center`,gap:`8px`},children:[(0,$.jsx)(se,{style:{color:`var(--accent)`}}),`Centinela`]}),(0,$.jsx)(`p`,{style:{fontSize:`0.85rem`,color:`var(--text-muted)`,marginTop:`4px`},children:`Dual-mode interactive speech companion. Supports Quick Responses (Offline) answering or Live Assistant (Gemini Cloud) channels.`})]}),(0,$.jsxs)(`div`,{className:`filter-slider`,style:{display:`flex`,gap:`8px`,marginBottom:`16px`},children:[(0,$.jsx)(`button`,{onClick:()=>{i(`Level1`),ce()},className:`global-lang-btn ${r===`Level1`?`active`:``}`,style:{flex:1,borderRadius:`12px`,fontSize:`0.8rem`,padding:`10px`},children:`🟢 Quick Responses (Offline)`}),(0,$.jsx)(`button`,{onClick:()=>i(`Level3`),className:`global-lang-btn ${r===`Level3`?`active`:``}`,style:{flex:1,borderRadius:`12px`,fontSize:`0.8rem`,padding:`10px`},children:`⚡ Live Assistant (Gemini Cloud)`})]}),r===`Level3`&&!a&&(0,$.jsxs)(`div`,{className:`dashboard-card`,style:{background:`var(--danger-red-glow)`,border:`1px solid var(--danger-red)`,marginBottom:`16px`,animation:`slideUp 0.2s ease`,padding:`16px`},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,gap:`10px`,marginBottom:`12px`},children:[(0,$.jsx)(me,{style:{color:`var(--danger-red)`,flexShrink:0},size:24}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`strong`,{style:{fontSize:`0.9rem`,color:`var(--danger-text)`,display:`block`},children:`Consent Required for Live Gemini Assistant`}),(0,$.jsx)(`p`,{style:{fontSize:`0.75rem`,color:`var(--danger-text)`,opacity:.95,marginTop:`4px`,lineHeight:`1.4`},children:`Live Assistant connects securely to Google Cloud Gemini models via Firebase AI Logic. Your speech is translated locally on-device and securely processed to provide real-time, helpful safety answers. No databases or identity logs are written on our end. Do you consent?`})]})]}),(0,$.jsx)(`button`,{onClick:()=>o(!0),style:{background:`var(--danger-red)`,color:`#fff`,fontSize:`0.8rem`,fontWeight:`800`,border:`none`,borderRadius:`8px`,padding:`10px 20px`,cursor:`pointer`,display:`inline-block`,boxShadow:`0 4px 12px rgba(0,0,0,0.15)`,transition:`transform 0.1s ease`,marginTop:`4px`},children:`I Explicitly Consent & Opt-In`})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,alignItems:`center`,background:`var(--bg-charcoal)`,padding:`24px`,borderRadius:`16px`,border:`1px solid var(--border-muted)`,marginBottom:`20px`},children:[(0,$.jsx)(`canvas`,{ref:D,width:`280`,height:`80`,style:{width:`100%`,maxHeight:`80px`,borderRadius:`8px`}}),(0,$.jsx)(`button`,{onClick:()=>{if(s===`speaking`){if(window.speechSynthesis&&window.speechSynthesis.cancel(),ee.current=!0,c(`idle`),r===`Level3`){if(!a)return;ie()}else le();return}if(s===`listening`||s===`connected`)r===`Level3`?ce():k.current&&k.current.stop();else if(r===`Level3`){if(!a)return;ie()}else le()},className:`speech-mic-trigger ${s===`listening`?`pulsing-listening`:s===`speaking`?`pulsing-speaking`:``}`,style:{width:`64px`,height:`64px`,borderRadius:`50%`,background:s===`listening`?`var(--danger-red)`:s===`speaking`?`var(--oakland-green)`:`var(--accent)`,color:`#fff`,border:`none`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,boxShadow:`0 8px 24px rgba(0,0,0,0.1)`,marginTop:`16px`,transition:`all 0.2s ease`},children:s===`listening`?(0,$.jsx)(oe,{size:24}):(0,$.jsx)(se,{size:24})}),(0,$.jsx)(`span`,{style:{fontSize:`0.8rem`,fontWeight:`700`,color:`var(--text-muted)`,marginTop:`12px`,textTransform:`uppercase`},children:s===`idle`?`Tap Mic to Speak`:s===`connecting`?`Establishing secure lane...`:s===`listening`?`Assistant listening...`:`Assistant responding...`})]}),(0,$.jsxs)(`div`,{className:`dashboard-card`,style:{background:`var(--bg-card)`,border:`1px solid var(--border-muted)`,maxHeight:`180px`,overflowY:`auto`,marginBottom:`20px`},children:[(0,$.jsxs)(`h4`,{style:{fontSize:`0.8rem`,fontWeight:`800`,color:`var(--text-muted)`,marginBottom:`8px`,textTransform:`uppercase`,display:`flex`,alignItems:`center`,gap:`4px`},children:[(0,$.jsx)(ae,{size:12}
816),` Running Transcript Log`]}),(0,$.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`8px`},children:d.length===0?(0,$.jsx)(`p`,{style:{fontSize:`0.75rem`,color:`var(--text-muted)`,fontStyle:`italic`},children:`Logs are empty. Speak to start recording.`}):d.map((e,t)=>(0,$.jsxs)(`div`,{style:{fontSize:`0.75rem`,borderBottom:`1px solid var(--border-muted)`,paddingBottom:`4px`},children:[(0,$.jsxs)(`strong`,{style:{color:e.sender===`user`?`var(--accent)`:e.sender===`assistant`?`var(--oakland-green-light)`:`var(--text-muted)`},children:[e.sender.toUpperCase(),`:`]}),` `,(0,$.jsx)(`span`,{style:{color:`var(--text-white)`},children:e.text})]},t))})]}),(0,$.jsxs)(`div`,{style:{borderTop:`1px solid var(--border-muted)`,paddingTop:`16px`,marginTop:`16px`},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:`12px`},children:[(0,$.jsxs)(`h3`,{style:{fontSize:`0.95rem`,fontWeight:`800`,display:`flex`,alignItems:`center`,gap:`6px`,color:`var(--text-white)`},children:[(0,$.jsx)(A,{size:16,style:{color:`var(--accent)`}}),`Live Translator Details`]}),(0,$.jsx)(`button`,{onClick:()=>y(!v),className:`global-lang-btn`,style:{fontSize:`0.7rem`,padding:`4px 10px`,borderRadius:`8px`},children:v?`Hide Details`:`Show Details`})]}),v&&(0,$.jsxs)(`div`,{className:`dashboard-card`,style:{background:`var(--bg-card)`,border:`1px solid var(--border-muted)`,animation:`slideUp 0.2s ease`,padding:`14px`},children:[(0,$.jsxs)(`div`,{style:{background:`var(--bg-charcoal)`,borderLeft:`3px solid var(--accent)`,padding:`12px 14px`,borderRadius:`8px`,marginBottom:`14px`},children:[(0,$.jsx)(`strong`,{style:{fontSize:`0.85rem`,color:`var(--text-white)`,display:`block`,marginBottom:`6px`},children:`🛡️ Integrated Translation Support`}),(0,$.jsx)(`p`,{style:{fontSize:`0.78rem`,color:`var(--text-muted)`,lineHeight:`1.5`,margin:0},children:t===`es`?`Centinela funciona de manera integral como tu traductor y defensor en tiempo real. En lugar de interfaces complejas durante paradas policiales estresantes, puedes usar la sección principal de chat superior para traducir cualquier frase o diálogo de inmediato.`:`Centinela operates seamlessly as your real-time translator and safety advisor. Rather than managing complex toggles during high-stress police encounters, you can use the main chat assistant panel above to handle all your translation needs directly.`}),(0,$.jsx)(`strong`,{style:{fontSize:`0.8rem`,color:`var(--accent)`,display:`block`,marginTop:`12px`,marginBottom:`4px`},children:`⚙️ How to Translate with Centinela:`}),(0,$.jsxs)(`ul`,{style:{margin:0,paddingLeft:`18px`,fontSize:`0.75rem`,color:`var(--text-muted)`,lineHeight:`1.5`,display:`flex`,flexDirection:`column`,gap:`6px`},children:[(0,$.jsxs)(`li`,{children:[(0,$.jsx)(`strong`,{children:t===`es`?`Activar por Voz:`:`Voice Activation:`}),` `,t===`es`?`Presiona el botón del Micrófono y di en español lo que deseas comunicar (por ejemplo: 'Dígale al oficial que exijo hablar con mi abogado'). Centinela traducirá tu frase de inmediato al inglés y la reproduciría en voz alta para el oficial.`:`Tap the Microphone trigger above and speak your phrase. Centinela will translate it instantly and speak the translated response out loud to ensure clear communication.`]}),(0,$.jsxs)(`li`,{children:[(0,$.jsx)(`strong`,{children:t===`es`?`Consultas Rápidas por Chat:`:`Direct Translation Prompts:`}),` `,t===`es`?`Puedes escribir solicitudes de traducción en la barra de chat, por ejemplo: 'Traducción: Quiero ver su orden de registro'.`:`You can type translation requests directly into the chat assistant. For example, enter: 'Translate: I am remaining silent until my attorney arrives.'`]})]})]}),(0,$.jsxs)(`div`,{style:{background:`var(--danger-red-glow)`,border:`1px solid var(--danger-red)`,padding:`12px`,borderRadius:`8px`,display:`flex`,gap:`10px`},children:[(0,$.jsx)(me,{size:18,style:{color:`var(--danger-red)`,flexShrink:0,marginTop:`2px`}}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`strong`,{style:{fontSize:`0.8rem`,color:`var(--danger-text)`},children:t===`es`?`Regla Legal Crucial:`:`Critical Legal Rule:`}),(0,$.jsx)(`span`,{style:{fontSize:`0.75rem`,color:`var(--danger-text)`,opacity:.95,display:`block`,marginTop:`4px`,lineHeight:`1.4`},children:t===`es`?`Si los agentes te piden firmar documentos oficiales, di claramente en voz alta o mediante Centinela: "Quiero hablar con mi abogado antes de firmar nada." (I want to speak with my lawyer before signing anything). Nunca firmes formularios administrativos de ICE sin asesoramiento legal.`:`If enforcement agents ask you to sign any paperwork, say clearly or play via Centinela: "Quiero hablar con mi abogado antes de firmar nada." (I want to speak with my lawyer before signing anything). Never sign ICE administrative forms without counsel.`})]})]})]})]})]})}var FC={en:{navBrand:`CENTINELA`,badge:`ANONYMOUS & PRIVATE`,mainSubtitle:`OAKLAND SAFETY HUB — ALERTS, RESOURCE MAPS, AND PRIVATE TRANSLATIONS.`,privacyBanner:`Your Privacy is Protected. We do not track you, and we do not ask for names, emails, or addresses.`,mapTitle:`Centinela Watch Map`,mapDesc:`Interactive map of active checkpoints and community sightings. No tracking, purely crowdsourced.`,footerCredit:`© 2026 Centinela Immigrant Safety Hub. Designed with love and West Oakland community focus.`,footerLogs:`Zero tracking, zero cookies, zero database logs.`,rightsReminder:`Remember: You have the right to remain silent. Do not sign anything without a lawyer. Do not open the door unless agents show a warrant signed by a judge.`,rapidResponse:`Oakland Rapid Response legal team: 510-241-4011`,clearDataBtn:`Wipe All Device Data`,clearDataConfirm:`All local caches, data logs, and memory storage have been successfully wiped from this device. Stay safe! 💚`,tabMap:`Map`,tabNews:`News`,tabDirectory:`Resources`,tabPrivacy:`Privacy`,privacyConsoleTitle:`Anonymous Security Console`,privacyConsoleDesc:`Manage local privacy modes, check data logs, and purge active caches instantly.`,privacyPolicyTitle:`Privacy Policy & Audit Disclosure`,privacyPolicyDesc:`Centinela is designed strictly around data minimization. We do not set persistent cookie identifiers, read browser canvase
816s, or log client-side IP details on our Express relay backends. The application works completely without login credentials or accounts.`,deviceCleanseTitle:`Device Cleanse`,deviceCleanseDesc:`Clicking the button below instantly purges all localStorage variables, language keys, text templates, and reload caches, returning the device to a pristine state.`,vettedDirectoryTitle:`Vetted Resources`,vettedDirectoryDesc:`Safe zones, clinic centers, and food support directories in Oakland. Verified safe under strict non-tracking protocol guards.`,addResourceBtn:`Add Safe Resource`,modQueueBtn:`Moderator Queue`,allSafeZonesBtn:`All Safe Zones`,submitResourceTitle:`Submit Safe Resource Anonymously`,privacyWarningDesc:`Privacy Warning: Do not submit any identifying details of individuals. All suggestions are checked before listing.`,formCategoryLabel:`Resource Category`,formNameLabel:`Organization Name`,formDescLabel:`Service Description`,formAddressLabel:`Address (Oakland, CA)`,formHoursLabel:`Operating Hours`,formProtocolLabel:`Safety Guard / Protocol`,submitResourceBtn:`Submit Resource`,submittingTxt:`Submitting...`,modConsoleTitle:`Centinela Developer Audit Console`,modConsoleDesc:`Manage crowdsourced listings. Approving a listing updates the database and publishes it to the main directory instantly.`,modQueueEmpty:`Queue is currently empty.`,privacyGuaranteed:`Privacy Guaranteed`,securityProtocolLabel:`Security Protocol:`,emptyDirectoryMsg:`No safe resources found in this category. Be the first to suggest one anonymously!`,optHealthcare:`🏥 Healthcare & Medical Clinics`,optLegal:`⚖️ Legal Aid & Know Your Rights Counsel`,optFood:`🍎 Food Pantries & Free Kitchens`,optSanctuary:`⛪ Safe Sanctuaries & Community Spaces`,optHousing:`🏠 Emergency Housing & Safe Shelters`,optEconomic:`💵 Cash and Economic Relief (CAPI)`,cancelPinDropBtn:`Cancel Pin Drop`,reportSightingBtn:`Report Sighting`,anonymousSubmitterTitle:`Anonymous Incident Submitter`,dragPinDesc:`Drag the yellow pin on the map to mark the exact spot. Your report passes an automated credibility check. No identities are logged.`,sightingCategoryLabel:`Sighting Category`,detailsContextLabel:`Details & Context`,submitReportBtn:`Submit Report Anonymously`,verifyingSightingTxt:`Verifying Sighting...`,liveMapFeedTitle:`Live Verification Map Feed:`,townQuietMsg:`Zero active checkpoints reported right now. The Town is quiet. 💚`,optIce:`🚨 ICE Checkpoint Sighting`,optRaid:`🚔 Active Raid Sighting`,optDetention:`⛓️ Detention Activity`,optResponse:`📞 Rapid-Response Callout`,optAlert:`🔔 Community Security Alert`,optSafety:`🟢 General Safety Area Notice`},es:{navBrand:`CENTINELA`,badge:`ANÓNIMO Y PRIVADO`,mainSubtitle:`CENTRO DE SEGURIDAD DE OAKLAND — ALERTAS, MAPAS DE RECURSOS Y TRADUCCIONES PRIVADAS.`,privacyBanner:`Tu Privacidad está Protegida. No te rastreamos y no pedimos nombres, correos electrónicos ni direcciones.`,mapTitle:`Mapa de Vigilancia Centinela`,mapDesc:`Mapa interactivo de puntos de control activos y avistamientos de la comunidad. Sin rastreo, puramente colaborativo.`,footerCredit:`© 2026 Centro de Seguridad Centinela. Diseñado con amor y enfoque comunitario en West Oakland.`,footerLogs:`Cero rastreo, cero cookies, cero registros de base de datos.`,rightsReminder:`Recuerde: Tiene derecho a guardar silencio. No firme nada sin un abogado. No abra la puerta a menos que los agentes muestren una orden firmada por un juez.`,rapidResponse:`Equipo legal de Respuesta Rápida de Oakland: 510-241-4011`,clearDataBtn:`Borrar todos los datos del dispositivo`,clearDataConfirm:`Todos los cachés locales, registros de datos y almacenamiento de memoria se han borrado con éxito de este dispositivo. ¡Manténgase seguro! 💚`,tabMap:`Mapa`,tabNews:`Noticias`,tabDirectory:`Recursos`,tabPrivacy:`Privacidad`,privacyConsoleTitle:`Consola de Seguridad Anónima`,privacyConsoleDesc:`Administre modos de privacidad locales, verifique registros de datos y limpie cachés activos al instante.`,privacyPolicyTitle:`Política de Privacidad y Divulgación de Auditoría`,privacyPolicyDesc:`Centinela está diseña
816do estrictamente en torno a la minimización de datos. No configuramos identificadores de cookies persistentes, ni leemos lienzos de navegador, ni registramos detalles de IP del lado del cliente en nuestros servidores. La aplicación funciona completamente sin credenciales de inicio de sesión o cuentas.`,deviceCleanseTitle:`Limpieza del Dispositivo`,deviceCleanseDesc:`Al hacer clic en el botón de abajo se purgan instantáneamente todas las variables de localStorage, claves de idioma, plantillas de texto y cachés de recarga, devolviendo el dispositivo a un estado prístino.`,vettedDirectoryTitle:`Recursos Verificados`,vettedDirectoryDesc:`Zonas seguras, centros clínicos y directorios de apoyo alimentario en Oakland. Verificados como seguros bajo estrictas protecciones de protocolo sin rastreo.`,addResourceBtn:`Agregar Recurso Seguro`,modQueueBtn:`Cola de Moderadores`,allSafeZonesBtn:`Todas las Zonas Seguras`,submitResourceTitle:`Enviar Recurso Seguro de Forma Anónima`,privacyWarningDesc:`Advertencia de Privacidad: No envíe ningún detalle de identificación de personas. Todas las sugerencias se verifican antes de ser publicadas.`,formCategoryLabel:`Categoría de Recurso`,formNameLabel:`Nombre de la Organización`,formDescLabel:`Descripción del Servicio`,formAddressLabel:`Dirección (Oakland, CA)`,formHoursLabel:`Horas de Operación`,formProtocolLabel:`Guardia / Protocolo de Seguridad`,submitResourceBtn:`Enviar Recurso`,submittingTxt:`Enviando...`,modConsoleTitle:`Consola de Auditoría de Desarrolladores de Centinela`,modConsoleDesc:`Administre listados de la comunidad. Aprobar un listado actualiza la base de datos y lo publica en el directorio principal al instante.`,modQueueEmpty:`La cola de moderación está vacía.`,privacyGuaranteed:`Privacidad Garantizada`,securityProtocolLabel:`Protocolo de Seguridad:`,emptyDirectoryMsg:`No se encontraron recursos seguros en esta categoría. ¡Sé el primero en sugerir uno de forma anónima!`,optHealthcare:`🏥 Clínicas Médicas y de Salud`,optLegal:`⚖️ Asesoría Legal y de Conozca Sus Derechos`,optFood:`🍎 Despensas de Alimentos y Comedores Gratuitos`,optSanctuary:`⛪ Espacios Comunitarios y Santuarios Seguros`,optHousing:`🏠 Refugios Seguros y Viviendas de Emergencia`,optEconomic:`💵 Programa de Alivio Económico en Efectivo (CAPI)`,cancelPinDropBtn:`Cancelar Colocación`,reportSightingBtn:`Reportar Avistamiento`,anonymousSubmitterTitle:`Presentador de Incidentes Anónimo`,dragPinDesc:`Arrastra el pin amarillo en el mapa para marcar el punto exacto. Tu reporte pasa una verificación automática de credibilidad. No se registran identidades.`,sightingCategoryLabel:`Categoría de Avistamiento`,detailsContextLabel:`Detalles y Contexto`,submitReportBtn:`Enviar Reporte de Forma Anónima`,verifyingSightingTxt:`Verificando Avistamiento...`,liveMapFeedTitle:`Canal de Mapa de Verificación en Vivo:`,townQuietMsg:`Cero puntos de control activos reportados en este momento. La ciudad está tranquila. 💚`,optIce:`🚨 Avistamiento de Punto de Control de ICE`,optRaid:`🚔 Avistamiento de Redada Activa`,optDetention:`⛓️ Actividad de Detención`,optResponse:`📞 Llamado de Respuesta Rápida`,optAlert:`🔔 Alerta de Seguridad Comunitaria`,optSafety:`🟢 Aviso de Área de Seguridad General`},zh:{navBrand:`哨兵 (CENTINELA)`,badge:`匿名與嚴格隱私`,mainSubtitle:`屋崙安全中心 — 執法警報、資源地圖、語音翻譯`,privacyBanner:`您的隱私受法律保護。我們絕不追蹤您的定位,也絕不要求提供姓名、電子郵件或家庭住址。`,mapTitle:`Centinela 安全監測地圖`,mapDesc:`屋崙執法地點及社區安全互助地圖。不記錄任何個人隱私。`,footerCredit:`© 2026 Centinela 移民安全中心。以愛與屋崙社區為核心打造。`,footerLogs:`零追蹤、零日誌、零Cookie緩存。`,rightsReminder:`請記住:您有權保持沉默。未經律師看過,請勿簽署任何文件。除非執法人員出示法官簽署的搜查令,否則請勿開門。`,rapidResponse:`屋崙緊急法律援助熱線:510-241-4011`,clearDataBtn:`清除本機所有數據`,clearDataConfirm:`本機緩存、歷史記錄與所有隱私數據已徹底清除。祝您平安!💚`,tabMap:`地圖`,tabNews:`資訊`,tabDirectory:`安全資源`,tabPrivacy:`隱私`,privacyConsoleTitle:`匿名安全控制台`,privacyConsoleDesc:`管理本地隱私模式,檢查數據日誌,並立即清除活動緩存。`,privacyPolicyTitle:`隱私政策與審計揭露`,privacyPolicyDesc:`Centinela 嚴格遵
816循數據最小化原則。我們不在後端設置持久性 Cookie 標識符、不讀取瀏覽器畫布,亦不記錄客戶端 IP。本應用完全無需登錄帳號即可使用。`,deviceCleanseTitle:`設備數據清理`,deviceCleanseDesc:`點擊下方按鈕將立即清除本機所有的 localStorage 變量、語言設置、文本模板及加載緩存,使設備恢復到初始安全狀態。`,vettedDirectoryTitle:`已認證的安全資源`,vettedDirectoryDesc:`屋崙(Oakland)地區的安全區域、診所及食物援助名錄。在嚴格的無追蹤協議保護下經確認安全。`,addResourceBtn:`添加安全資源`,modQueueBtn:`審核隊列`,allSafeZonesBtn:`所有安全區域`,submitResourceTitle:`匿名提交安全資源`,privacyWarningDesc:`隱私警告:請勿提交任何個人的身份識別資訊。所有建議均需在審核後方可上線名錄。`,formCategoryLabel:`資源類別`,formNameLabel:`機構名稱`,formDescLabel:`服務描述`,formAddressLabel:`地址(屋崙,加州)`,formHoursLabel:`開放時間`,formProtocolLabel:`安全保障/協議`,submitResourceBtn:`提交資源`,submittingTxt:`正在提交...`,modConsoleTitle:`Centinela 開發者審核主頁`,modConsoleDesc:`管理群眾外包名錄。批准某條資源會更新數據庫並立即將其發佈到主名錄。`,modQueueEmpty:`審核隊列目前為空。`,privacyGuaranteed:`隱私得到保障`,securityProtocolLabel:`安全協議:`,emptyDirectoryMsg:`此類別下暫無安全資源。成為第一個匿名推薦資源的人吧!`,optHealthcare:`🏥 醫療與健康診所`,optLegal:`⚖️ 法律援助與民權諮詢`,optFood:`🍎 免費食品分發處與廚房`,optSanctuary:`⛪ 社區避難所與安全空間`,optHousing:`🏠 緊急避難所與安全住宅`,optEconomic:`💵 現金與經濟救濟 (CAPI)`,cancelPinDropBtn:`取消標記`,reportSightingBtn:`回報目擊`,anonymousSubmitterTitle:`匿名事件提交器`,dragPinDesc:`在地圖上拖動黃色大頭針以標記精確位置。您的報告將通過自動可信度檢查,不記錄任何身份。`,sightingCategoryLabel:`目擊類別`,detailsContextLabel:`詳情與上下文`,submitReportBtn:`匿名提交報告`,verifyingSightingTxt:`正在驗證目擊報告...`,liveMapFeedTitle:`實時驗證地圖動態:`,townQuietMsg:`目前未收到任何活動中的執法點回報。社區很安靜。💚`,optIce:`🚨 ICE 執法目擊報告`,optRaid:`🚔 活動中的突襲目擊報告`,optDetention:`⛓️ 拘留活動`,optResponse:`📞 快速響應呼叫`,optAlert:`🔔 社區安全警報`,optSafety:`🟢 一般安全區域聲明`},ht:{navBrand:`CENTINELA`,badge:`ANONIM AK PRIVAT`,mainSubtitle:`SANT SEKIRITE OAKLAND — ALÈT, KAT RESOUS, AK TRADIKASYON PRIVAT.`,privacyBanner:`Privasite ou Pwoteje. Nou pa swiv ou, epi nou pa mande non, imèl, oswa adrès.`,mapTitle:`Kat Siveyans Centinela`,mapDesc:`Kat entèaktif nan pwen kontwòl aktif ak rapò kominote a. Pa gen swiv.`,footerCredit:`© 2026 Centinela Immigrant Safety Hub. Ki fèt ak renmen ak kominote West Oakland.`,footerLogs:`Zero swiv, zero bonbon, zero boutèy demi lit.`,rightsReminder:`Sonje byen: Ou gen dwa rete silans. Pa siyen anyen san yon avoka. Pa ouvri pòt la sof si ajan yo montre yon manda yon jij siyen.`,rapidResponse:`Ekip legal Oakland Rapid Response: 510-241-4011`,clearDataBtn:`Efase Tout Done Aparèy`,clearDataConfirm:`All kach lokal yo, mòso bwa done yo, ak memwa aparèy yo fin efase nèt. Rete an sekirite! 💚`,tabMap:`Kat`,tabNews:`Nouvèl`,tabDirectory:`Resous`,tabPrivacy:`Privasite`,privacyConsoleTitle:`Konsole Sekirite Anonim`,privacyConsoleDesc:`Jere mòd privasite lokal yo, tcheke mòso bwa done yo, epi netwaye kach aktif yo imedyatman.`,privacyPolicyTitle:`Règleman sou Privasite ak Diksyonè Odit`,privacyPolicyDesc:`Centinela fèt sèlman pou minimize done yo. Nou pa mete idantifyan bonbon ki pèsistan, li twal navigatè a, oswa log adrès IP sou sèvè nou yo. Aplikasyon an travay nèt san kont oswa koneksyon.`,deviceCleanseTitle:`Netwaye Aparèy`,deviceCleanseDesc:`Klike sou bouton ki anba a pou efase imedyatman tout varyab localStorage, lang, modèl tèks, ak kach, pou retounen aparèy la nan eta orijinal li.`,vettedDirectoryTitle:`Resous Sekirite Jwenn Verifikasyon`,vettedDirectoryDesc:`Zòn sekirite, klinik, ak sipò manje nan Oakland. Verifye san danje anba pwoteksyon pwotokòl strik san swiv.`,addResourceBtn:`Ajoute Resous Sekirite`,modQueueBtn:`Kou l pou Moderatè`,allSafeZonesBtn:`Tout Zòn Sekirite`,submitResourceTitle:`Voye Resous Sekirite Anonim`,privacyWarningDesc:`Avètisman sou Privasite: Pa voye okenn detay ki ka idantifye moun. Tout sijesyon yo tcheke anvan yo pibliye.`,formCategoryLabel:`Kategori Resous`,formNameLabel:`Non Sèvis la / Òganizasyon`,formDescLabel:`Deskripsyon Sèvis la`,formAddressLabel:`Adrès (Oakland, CA)`,formHoursLabel:`Lè Sèvis la Louvri`,formProtocolLabel:`Pwotokòl Sekirite`,submitResourceBtn:`Voye Resous`,submittingTxt:`Ap voye...`,modConsoleTitle:`Konsole Odit pou Devlopè Centinela`,modConsoleDesc:`Jere lis kominote yo. Apwouve yon resous mete baz done a ajou epi pibliye l imedyatman.`,modQueueEmpty:`Kou l pou moderatè a vid.`,privacyGuaranteed:`Privasite Garanti`,securityProtocolLabel:`Pwotokòl Sekirite:`,emptyDirectoryMsg:`Pa gen resous sekirite nan kategori sa a. Se pou premye moun ki voye yonn anonim!`,optHealthcare:`🏥 Klinik Sante ak Medikal`,optLegal:`⚖️ Èd Legal ak Konsèy sobre Dwa Ou`,optFood:`🍎 Distribisyon Manje ak Kwizin Gratis`,optSanctuary:`⛪ Espas Kominotè ak Sanctuaires Sekirite`,optHousing:`🏠 Kay pou Ijans ak Abri Sekirite`,optEconomic:`💵 Èd Finansye ak Sekou Ekonomik (CAPI)`,cancelPinDropBtn:`Anile Depoze`,reportSightingBtn:`Rapòte Yon Avistman`,anonymousSubmitterTitle:`Rapòte Anonim`,dragPinDesc:`Trennen pin jòn nan sou kat la pou make kote egzak la. Rapò ou a a
816p pase yon verifikasyon otomatik. Pa gen okenn idantite ki anrejistre.`,sightingCategoryLabel:`Kategori Avistman`,detailsContextLabel:`Detay ak Kontèks`,submitReportBtn:`Voye Rapò Anonim`,verifyingSightingTxt:`Ap verifye avistman...`,liveMapFeedTitle:`Kanal Kat Verifikasyon an Direct:`,townQuietMsg:`Pa gen okenn pwen kontwòl aktif rapòte kounye a. Vil la an sekirite epi kalm. 💚`,optIce:`🚨 Avistman Checkpoint ICE`,optRaid:`🚔 Avistman Atak Aktif`,optDetention:`⛓️ Aktivite Detansyon`,optResponse:`📞 Repons Rapid Rele`,optAlert:`🔔 Alèt Sekirite Kominotè`,optSafety:`🟢 Avi sou Zòn Sekirite Jeneral`},ar:{navBrand:`سينتينيلا (CENTINELA)`,badge:`مجهول وخاص بالكامل`,mainSubtitle:`مركز أمان أوكلاند — تنبيهات، خرائط الموارد، وترجمات صوتية فورية خاصة.`,privacyBanner:`خصوصيتك محمية بالكامل. نحن لا نتتبعك، ولا نطلب أسماءً أو بريداً إلكترونياً أو عناوين سكن.`,mapTitle:`خارطة مراقبة سينتينيلا`,mapDesc:`خريطة تفاعلية لنقاط التفتيش النشطة وبلاغات المجتمع المحلي. خالية تماماً من التتبع.`,footerCredit:`© 2026 مركز أمان المهاجرين سينتينيلا. صُمم بكل حب ودعم لمجتمع غرب أوكلاند.`,footerLogs:`بدون تتبع، بدون كوكيز، بدون تخزين أي سجلات.`,rightsReminder:`تذكر: لديك الحق في البقاء صامتاً. لا توقع على أي شيء دون حضور محامٍ. لا تفتح الباب إلا إذا أبرز الضباط أمر تفتيش موقع من قاضٍ.`,rapidResponse:`فريق الاستجابة القانونية السريعة في أوكلاند: 510-241-4011`,clearDataBtn:`مسح كافة البيانات من الجهاز فوراً`,clearDataConfirm:`تم مسح كافة ذاكرات التخزين المؤقتة وسجلات البيانات والذاكرة المحلية بنجاح من هذا الجهاز. ابقَ آمناً! 💚`,tabMap:`الخريطة`,tabNews:`الأخبار`,tabDirectory:`الموارد`,tabPrivacy:`الخصوصية`,privacyConsoleTitle:`لوحة تحكم الأمان المجهول`,privacyConsoleDesc:`إدارة أوضاع الخصوصية المحلية، التحقق من سجلات البيانات، ومسح ذاكرة التخزين المؤقت فوراً.`,privacyPolicyTitle:`سياسة الخصوصية والإفصاح عن التدقيق`,privacyPolicyDesc:`تم تصميم سينتينيلا بدقة لتقليل استهلاك البيانات. نحن لا نستخدم ملفات تعريف الارتباط الدائمة، ولا نقرأ بصمات المتصفح، ولا نسجل عناوين IP الخاصة بالمستخدمين. التطبيق يعمل بالكامل دون الحاجة لتسجيل حساب.`,deviceCleanseTitle:`تطهير الجهاز`,deviceCleanseDesc:`النقر على الزر أدناه يؤدي لمسح جميع متغيرات localStorage وإعدادات اللغة والقوالب النصية فوراً، مما يعيد الجهاز لحالته الأمنية النظيفة الأولى.`,vettedDirectoryTitle:`الموارد الأمنية المعتمدة`,vettedDirectoryDesc:`المناطق الآمنة، العيادات الصحية، ومراكز الدعم الغذائي المعتمدة في أوكلاند. تم التحقق من أمانها تحت بروتوكول صارم يمنع التتبع.`,addResourceBtn:`إضافة مورد آمن`,modQueueBtn:`قائمة المراجعة`,allSafeZonesBtn:`جميع المناطق الآمنة`,submitResourceTitle:`إرسال مورد آمن دون هوية`,privacyWarningDesc:`تحذير الخصوصية: يرجى عدم إرسال أي تفاصيل شخصية تدل على الأفراد. يتم فحص جميع المقترحات بدقة قبل نشرها.`,formCategoryLabel:`فئة المورد`,formNameLabel:`اسم المؤسسة`,formDescLabel:`وصف الخدمة`,formAddressLabel:`العنوان (أوكلاند، كاليفورنيا)`,formHoursLabel:`ساعات العمل`,formProtocolLabel:`بروتوكول / حماية الأمان`,submitResourceBtn:`إرØ
816³Ø§Ù„ المورد`,submittingTxt:`جاري الإرسال...`,modConsoleTitle:`لوحة تدقيق مطوري سينتينيلا`,modConsoleDesc:`إدارة الموارد المرسلة من قبل المجتمع. الموافقة تنشر المورد وتحدث قاعدة البيانات في نفس اللحظة.`,modQueueEmpty:`قائمة المراجعة فارغة حالياً.`,privacyGuaranteed:`الخصوصية مضمونة`,securityProtocolLabel:`بروتوكول الأمان:`,emptyDirectoryMsg:`لا توجد موارد آمنة في هذه الفئة حالياً. كن أول من يقترح مورداً بشكل مجهول!`,optHealthcare:`🏥 الرعاية الطبية والعيادات الصحية`,optLegal:`⚖️ المساعدات القانونية والمشورة الحقوقية`,optFood:`🍎 بنوك ومطابخ الطعام المجانية`,optSanctuary:`⛪ المساحات المجتمعية والملاجئ الآمنة`,optHousing:`🏠 الإسكان الطارئ والملاجئ الآمنة`,optEconomic:`💵 الإغاثة الاقتصادية والنقدية (CAPI)`,cancelPinDropBtn:`إلغاء وضع الدبوس`,reportSightingBtn:`الإبلاغ عن رصد`,anonymousSubmitterTitle:`مبلغ البلاغات الآمن`,dragPinDesc:`اسحب الدبوس الأصفر على الخريطة لتحديد الموقع بدقة. بلاغك يمر عبر تدقيق آلي، ولا يتم الاحتفاظ بهويتك أبداً.`,sightingCategoryLabel:`فئة البلاغ`,detailsContextLabel:`التفاصيل والسياق`,submitReportBtn:`إرØ
816³Ø§Ù„ البلاغ بشكل مجهول`,verifyingSightingTxt:`جاري التحقق من البلاغ...`,liveMapFeedTitle:`بث الخريطة المباشر المعتمد:`,townQuietMsg:`لا توجد بلاغات نشطة في الوقت الحالي. المدينة هادئة وآمنة. 💚`,optIce:`🚨 رصد نقاط تفتيش ICE`,optRaid:`🚔 رصد مداهمات نشطة`,optDetention:`⛓️ نشاط احتجاز`,optResponse:`📞 نداء الاستجابة السريعة`,optAlert:`🔔 تنبيه أمني مجتمعي`,optSafety:`🟢 منطقة أمان عامة`},pt:{navBrand:`CENTINELA`,badge:`ANÔNIMO E PRIVADO`,mainSubtitle:`CENTRO DE SEGURANÇA DE OAKLAND — ALERTAS, MAPAS DE RECURSOS E TRADUÇÕES PRIVADAS.`,privacyBanner:`Sua Privacidade está Protegida. Não rastreamos você e não solicitamos nomes, e-mails ou endereços.`,mapTitle:`Mapa de Monitoramento Centinela`,mapDesc:`Mapa interativo de postos de controle ativos e alertas comunitários. Sem rastreamento, totalmente descentralizado.`,footerCredit:`© 2026 Centro de Segurança Centinela. Projetado com carinho focado na comunidade de West Oakland.`,footerLogs:`Zero cookies, zero rastros, zero logs de dados.`,rightsReminder:`Lembre-se: Você tem o direito de permanecer em silêncio. Não assine nada sem um advogado. Não abra a porta a menos que mostrem um mandado assinado por um juiz.`,rapidResponse:`Equipe legal de Resposta Rápida de Oakland: 510-241-4011`,clearDataBtn:`Limpar todos os dados locais`,clearDataConfirm:`Todos os dados temporários e cache foram apagados permanentemente deste dispositivo. Fique seguro! 💚`,tabMap:`Mapa`,tabNews:`Notícias`,tabDirectory:`Recursos`,tabPrivacy:`Privacidade`,privacyConsoleTitle:`Painel de Segurança Anônimo`,privacyConsoleDesc:`Gerencie modos de privacidade locais, examine logs de transição e limpe os caches do dispositivo instantaneamente.`,privacyPolicyTitle:`Política de Privacidade e Termo de Auditoria`,privacyPolicyDesc:`O Centinela foi criado em torno do princípio de minimização absoluta de dados. Não coletamos cookies, não salvamos dados de IP e trabalhamos inteiramente sem contas ou registros de perfis.`,deviceCleanseTitle:`Limpeza de Histórico`,deviceCleanseDesc:`Clique no botão abaixo para deletar todas as variáveis locais, caches de tradução e dados salvos no navegador, voltando ao estado inicial de segurança máxima.`,vettedDirectoryTitle:`Recursos de Segurança Verificados`,vettedDirectoryDesc:`Zonas seguras, clínicas e cozinhas comunitárias de Oakland. Confirmadas como seguras sob protocolos rígidos de não rastreamento.`,addResourceBtn:`Adicionar Recurso Seguro`,modQueueBtn:`Fila de Moderadores`,allSafeZonesBtn:`Todas as Zonas Seguras`,submitResourceTitle:`Sugerir Recurso Anonimamente`,privacyWarningDesc:`Aviso de Privacidade: Nunca submeta nomes ou dados de identificação pessoal. Tudo passa por moderação antes de ser publicado.`,formCategoryLabel:`Categoria de Recurso`,formNameLabel:`Nome da Organização`,formDescLabel:`Descrição do Serviço`,formAddressLabel:`Endereço (Oakland, CA)`,formHoursLabel:`Horário de Funcionamento`,formProtocolLabel:`Protocolo de Segurança`,submitResourceBtn:`Submeter Recurso`,submittingTxt:`Enviando...`,modConsoleTitle:`Painel de Auditoria Centinela`,modConsoleDesc:`Gerencie listagens pendentes de validação. Aprovar atualiza a base e publica as informações instantaneamente.`,modQueueEmpty:`A fila de moderadores está vazia no momento.`,privacyGuaranteed:`Privacidade Garantida`,securityProtocolLabel:`Protocolo de Segurança:`,emptyDirectoryMsg:`Nenhum recurso seguro cadastrado nesta categoria. Seja o primeiro a sugerir um anonimamente!`,optHealthcare:`🏥 Clínicas Médicas e de Saúde`,optLegal:`⚖️ Auxílio Jurídico e Direitos Humanos`,optFood:`🍎 Bancos de Alimentos e Cozinhas Gratuitas`,optSanctuary:`⛪ Espaços Comunitários e Santuários`,optHousing:`🏠 Abrigos e Habitação de Emergência`,optEconomic:`💵 Programas de Alívio Financeiro (CAPI)`,cancelPinDropBtn:`Cancelar Pin`,reportSightingBtn:`Reportar Avistamento`,anonymousSubmitterTitle:`Submissão Anônima de Alerta`,dragPinDesc:`Arraste o marcador amarelo no mapa para fixar a localização. O relatório passa por uma verificação automatizada sem armazenar sua identidade.`,sightingCategoryLabel:`Categoria do Alerta`,detailsContextLabel:`Detalhes e Contexto`,submitReportBtn:`Submeter Alerta Anonimamente`,verifyingSightingTxt:`Verificando informações...`,liveMapFeedTitle:`Histórico de Alertas Verificados:`,townQuietMsg:`Nenhum posto ativo ou atividade de vigilância reportada no momento. A cidade está calma. 💚`,optIce:`🚨 Atividade de Fiscalização ICE`,optRaid:`🚔 Atividade de Batida / Batida Policial Ativa`,optDetention:`⛓️ Atividade de Detenção`,optResponse:`📞 Chamado de Resposta Rápida`,optAlert:`🔔 Alerta de Segurança Comunitária`,optSafety:`🟢 Aviso de Segurança Geral`},fr:{navBrand:`CENTINELA`,badge:`ANONYME & STRICTEMENT PRIVÉ`,mainSubtitle:`PORTAIL DE SÉCURITÉ D'OAKLAND — ALERTES, CARTOGRAPHIE ET TRADUCTIONS CONFIDENTIELLES.`,privacyBanner:`Votre vie privée est protégée. Aucun suivi de localisation, aucune demande d'identité, d'e-mail ou d'adresse.`,mapTitle:`Carte de Veille Centinela`,mapDesc:`Carte interactive signalant les contrôles et patrouilles. Confidentialité totale garantie.`,footerCredit:`© 2026 Centinela Immigrant Safety Hub. Réalisé bénévolement pour la communauté d'Oakland.`,footerLogs:`Aucun traceur, aucun cookie, aucun stockage de données privées.`,rightsReminder:`Rappel : Vous avez le droit de garder le silence. Ne signez rien sans avocat. N'ouvrez pas la porte 
816à moins qu'un mandat signé par un juge ne soit présenté.`,rapidResponse:`Assistance d'urgence légale d'Oakland : 510-241-4011`,clearDataBtn:`Effacer l'historique du téléphone`,clearDataConfirm:`Toutes les traces, historiques de conversation et caches ont été purgés de cet appareil. Restez en sécurité ! 💚`,tabMap:`Carte`,tabNews:`Infos`,tabDirectory:`Ressources`,tabPrivacy:`Sécurité`,privacyConsoleTitle:`Console de Sécurité Anonyme`,privacyConsoleDesc:`Gérez les options de confidentialité locales, vérifiez l'activité et purgez vos traces en un clic.`,privacyPolicyTitle:`Charte de Confidentialité et Audit`,privacyPolicyDesc:`Centinela est développé sous une charte stricte de minimalisation des données. Nous ne stockons pas de cookies, ne traquons pas vos IP et l'application fonctionne sans aucun compte requis.`,deviceCleanseTitle:`Purger l'historique local`,deviceCleanseDesc:`Cliquez ci-dessous pour vider le localStorage, l'historique d'apprentissage vocal et restaurer le téléphone dans son état de confidentialité d'origine.`,vettedDirectoryTitle:`Ressources Sécurisées`,vettedDirectoryDesc:`Centres de santé, banques alimentaires et sanctuaires de confiance à Oakland, audités sous notre protocole de sécurité strict.`,addResourceBtn:`Suggérer un lieu`,modQueueBtn:`Modération`,allSafeZonesBtn:`Tous les Lieux Sûrs`,submitResourceTitle:`Suggérer un lieu anonymement`,privacyWarningDesc:`Confidentialité : Ne mentionnez aucune coordonnée de personnes physiques. Les lieux sont validés manuellement par nos équipes.`,formCategoryLabel:`Type de ressource`,formNameLabel:`Nom de l'établissement`,formDescLabel:`Prestations proposées`,formAddressLabel:`Adresse (Oakland, CA)`,formHoursLabel:`Horaires d'ouverture`,formProtocolLabel:`Mesure de protection / Sécurité`,submitResourceBtn:`Suggérer la ressource`,submittingTxt:`Envoi en cours...`,modConsoleTitle:`Console de Modération Centinela`,modConsoleDesc:`Validez les suggestions d'établissements. Approuver publie directement la ressource dans l'annuaire.`,modQueueEmpty:`La file d'attente de modération est vide.`,privacyGuaranteed:`Sécurité Garantie`,securityProtocolLabel:`Mesure de Sécurité :`,emptyDirectoryMsg:`Aucun lieu répertorié dans cette catégorie. Soyez le premier à nous soumettre un signalement !`,optHealthcare:`🏥 Cliniques Médicales et de Santé`,optLegal:`⚖️ Aide Juridique et Défense des Droits`,optFood:`🍎 Banques Alimentaires et Soupes Populaires`,optSanctuary:`⛪ Espaces Communautaires et Sanctuaires`,optHousing:`🏠 Hébergement d'urgence et Logements Sûrs`,optEconomic:`💵 Soutien Économique et Financier (CAPI)`,cancelPinDropBtn:`Annuler le repère`,reportSightingBtn:`Signaler un événement`,anonymousSubmitterTitle:`Formulaire de Signalement Anonyme`,dragPinDesc:`Déplacez l'épingle jaune pour cibler précisément l'emplacement. Le signalement est traité sans collecter vos métadonnées.`,sightingCategoryLabel:`Catégorie de signalement`,detailsContextLabel:`Description des faits`,submitReportBtn:`Soumettre anonymement`,verifyingSightingTxt:`Vérification en cours...`,liveMapFeedTitle:`Flux d'alertes validées :`,townQuietMsg:`Aucune patrouille ou contrôle signalé actuellement. La ville est calme. 💚`,optIce:`🚨 Signalement de patrouille ICE`,optRaid:`🚔 Signalement de descente active`,optDetention:`⛓️ Arrestations ou Détention`,optResponse:`📞 Mobilisation de Réponse Rapide`,optAlert:`🔔 Alerte Sécurité Quartier`,optSafety:`🟢 Périmètre sans danger`},vi:{navBrand:`CENTINELA`,badge:`ẨN DANH & RIÊNG TƯ`,mainSubtitle:`TRUNG TÂM AN TOÀN OAKLAND — CẢNH BÁO, BẢN ĐỒ VÀ TRÌNH DỊCH THOẠI BẢO MẬT.`,privacyBanner:`Quyền Riêng Tư Của Bạn Được Bảo Vệ. Chúng tôi không theo dõi bạn, không yêu cầu tên, email hoặc địa chỉ.`,mapTitle:`Bản Đồ Giám Sát Centinela`,mapDesc:`Bản đồ tương tác về các điểm kiểm soát của ICE và báo cáo cộng đồng. Không theo dõi.`,footerCredit:`© 2026 Trung Tâm An Toàn Centinela. Được thiết kế vì cộng đồ
816ng West Oakland.`,footerLogs:`Không theo dõi, không lưu cookie, không ghi nhật ký dữ liệu.`,rightsReminder:`Hãy nhớ: Bạn có quyền giữ im lặng. Không ký bất cứ giấy tờ gì nếu không có luật sư. Không mở cửa trừ khi nhân viên xuất trình lệnh của tòa án có chữ ký của thẩm phán.`,rapidResponse:`Đội ngũ pháp lý Phản Ứng Nhanh Oakland: 510-241-4011`,clearDataBtn:`Xóa Toàn Bộ Dữ Liệu Thiết Bị`,clearDataConfirm:`Tất cả các tệp tạm thời, bộ nhớ cache và lịch sử hội thoại đã được xóa sạch hoàn toàn khỏi thiết bị này. Chúc bạn an toàn! 💚`,tabMap:`Bản đồ`,tabNews:`Tin tức`,tabDirectory:`Hỗ trợ`,tabPrivacy:`Riêng tư`,privacyConsoleTitle:`Bảng điều khiển Bảo mật Ẩn danh`,privacyConsoleDesc:`Quản lý quyền riêng tư, kiểm tra nhật ký và xóa sạch bộ nhớ tạm thời trên thiết bị ngay lập tức.`,privacyPolicyTitle:`Chính sách Bảo mật & Cam kết`,privacyPolicyDesc:`Centinela hoạt động trên nguyên tắc giảm thiểu dữ liệu tối đa. Chúng tôi cam kết không theo dõi cookie, IP và bạn có thể sử dụng ứng dụng mà không cần tài khoản.`,deviceCleanseTitle:`Xóa dấu vết`,deviceCleanseDesc:`Bấm nút dưới để xóa sạch các cài đặt, ngôn ngữ, bản dịch và bộ nhớ lưu trữ, đưa thiết bị về trạng thái an toàn bảo mật ban đầu.`,vettedDirectoryTitle:`Nguồn Hỗ trợ An toàn`,vettedDirectoryDesc:`Các địa điểm cứu trợ, y tế, thực phẩm đáng tin cậy tại Oakland đã được xác minh dưới quy trình bảo mật không theo vết.`,addResourceBtn:`Thêm điểm hỗ trợ`,modQueueBtn:`Duyệt thông tin`,allSafeZonesBtn:`Tất cả vùng an toàn`,submitResourceTitle:`Gửi địa điểm ẩn danh`,privacyWarningDesc:`Lưu ý bảo mật: Không gửi thông tin cá nhân của bất kỳ ai. Các địa điểm sẽ được kiểm duyệt trước khi hiển thị.`,formCategoryLabel:`Phân loại`,formNameLabel:`Tên tổ chức`,formDescLabel:`Mô tả dịch vụ`,formAddressLabel:`Địa chỉ (Oakland, CA)`,formHoursLabel:`Giờ hoạt động`,formProtocolLabel:`Cam kết bảo mật / An toàn`,submitResourceBtn:`Gửi thông tin`,submittingTxt:`Đang gửi...`,modConsoleTitle:`Hệ thống Kiểm duyệt Centinela`,modConsoleDesc:`Quản lý thông tin được đóng góp bởi cộng đồng. Bấm phê duyệt sẽ công khai địa điểm ngay lập tức.`,modQueueEmpty:`Không có thông tin chờ duyệt.`,privacyGuaranteed:`Bảo Mật Được Cam Kết`,securityProtocolLabel:`Giao thức An toàn:`,emptyDirectoryMsg:`Chưa có địa điểm nào được cập nhật trong mục này. Hãy là người đầu tiên gửi đóng góp ẩn danh!`,optHealthcare:`🏥 Trạm Y tế & Phòng khám Sức khỏe`,optLegal:`⚖️ Luật sư & Tư vấn Pháp lý`,optFood:`🍎 Phát Thực phẩm & Bếp ăn Miễn phí`,optSanctuary:`⛪ Địa điểm Cộng đồng & Thánh đường An toàn`,optHousing:`🏠 Nhà tạm lánh & Nơi ở Khân cấp`,optEconomic:`💵 Chương trình Hỗ trợ Tài chính (CAPI)`,cancelPinDropBtn:`Hủy thả ghim`,reportSightingBtn:`Báo cáo sự việc`,anonymousSubmitterTitle:`Báo cáo sự việc ẩn danh`,dragPinDesc:`Kéo thả kim màu vàng đến vị trí chính xác cần báo cáo. Thông tin gửi lên được kiểm tra tự động mà không lưu danh tính của bạn.`,sightingCategoryLabel:`Loại sự việc`,detailsContextLabel:`Chi tiết sự việc`,submitReportBtn:`Gửi báo cáo ẩn danh`,verifyingSightingTxt:`Đang kiểm tra thông tin...`,liveMapFeedTitle:`Thông tin báo cáo trực tiếp:`,townQuietMsg:`Không ghi nhận chốt kiểm soát hoặc hoạt động ICE nào lúc này. Thành phố hiện yên bình. 💚`,optIce:`🚨 Phát hiện Chốt kiểm soát ICE`,optRaid:`🚔 Phát hiện Đột kích / Đột kích Đang diễn ra`,optDetention:`⛓️ Hoạt động Bắt giữ`,optResponse:`📞 Gọi đội phản ứng nhanh`,optAlert:`🔔 Cảnh báo An ninh Cộng đồ
816ng`,optSafety:`🟢 Thông báo Khu vá»±c An toàn`},tl:{navBrand:`CENTINELA`,badge:`ANONYMOUS & PRIVADO`,mainSubtitle:`SENTRO NG KALIGTASAN SA OAKLAND — MGA ALERT, MAPA, AT MUTUAL VOICE TRANSLATION.`,privacyBanner:`Protektado ang Iyong Privacy. Hindi ka namin tina-track, at hindi kami humihingi ng pangalan, email, o address.`,mapTitle:`Mapa ng Pagmamatyag sa Centinela`,mapDesc:`Interactive na mapa ng mga aktibong checkpoint at sighting ng komunidad. Walang pag-track.`,footerCredit:`© 2026 Centinela Immigrant Safety Hub. Idinisenyo nang may pagmamahal para sa komunidad ng West Oakland.`,footerLogs:`Walang tracking, walang cookies, walang database logs.`,rightsReminder:`Tandaan: May karapatan kang manahimik. Huwag pumirma ng kahit ano nang walang abogado. Huwag buksan ang pinto maliban kung may search warrant na pirma ng hudis.`,rapidResponse:`Oakland Rapid Response legal team: 510-241-4011`,clearDataBtn:`Burahin Lahat ng Data sa Device`,clearDataConfirm:`Lahat ng lokal na cache, data logs, at memory storage ay matagumpay na nabura sa device na ito. Manatiling ligtas! 💚`,tabMap:`Mapa`,tabNews:`Balita`,tabDirectory:`Resources`,tabPrivacy:`Privacy`,privacyConsoleTitle:`Konsole ng Anonymous na Seguridad`,privacyConsoleDesc:`Pamahalaan ang mga lokal na privacy mode, suriin ang data logs, at i-clear ang cache ng device agad.`,privacyPolicyTitle:`Polisiya sa Privacy at Pag-audit`,privacyPolicyDesc:`Ang Centinela ay binuo batay sa minimal na koleksyon ng data. Hindi kami gumagamit ng mga persistent cookie, hindi kinukuha ang IP ng device, at ganap na walang accounts o login.`,deviceCleanseTitle:`Panglinis ng Device`,deviceCleanseDesc:`I-click ang button sa ibaba upang burahin ang localStorage, mga setting ng wika, at kasaysayan ng boses, ibabalik ang device sa pinaka-ligtas na estado.`,vettedDirectoryTitle:`Mga Ligtas na Resources`,vettedDirectoryDesc:`Mga safe zones, klinika, at rasyon ng pagkain sa Oakland. Kumpirmadong ligtas sa ilalim ng strict non-tracking protocol.`,addResourceBtn:`Magdagdag ng Safe Resource`,modQueueBtn:`Queue ng Moderator`,allSafeZonesBtn:`Lahat ng Ligtas na Lugar`,submitResourceTitle:`Magsumite ng Resource nang Anonymous`,privacyWarningDesc:`Babala: Huwag magsumite ng pangalan o kahit anong pagkakakilanlan ng tao. Lahat ay sinusuri bago i-publish.`,formCategoryLabel:`Kategori ng Resource`,formNameLabel:`Pangalan ng Organisasyon`,formDescLabel:`Serbisyong Inaalok`,formAddressLabel:`Address (Oakland, CA)`,formHoursLabel:`Oras ng Serbisyo`,formProtocolLabel:`Protocol sa Seguridad`,submitResourceBtn:`Isumite ang Resource`,submittingTxt:`Ipi-prisinta...`,modConsoleTitle:`Developer Audit Dashboard ng Centinela`,modConsoleDesc:`Pamahalaan ang mga isinumiteng lugar ng komunidad. Ang pag-apruba ay magpapakita sa resource directory agad.`,modQueueEmpty:`Walang nakapila para sa moderasyon sa kasalukuyan.`,privacyGuaranteed:`Garantisadong Ligtas`,securityProtocolLabel:`Protocol sa Seguridad:`,emptyDirectoryMsg:`Walang nakalistang safe resources sa kategoryang ito. Maging una sa pagmungkahi nang anonymous!`,optHealthcare:`🏥 Mga Klinika at Pangkalusugan`,optLegal:`⚖️ Legal Aid at Payo sa Karapatan`,optFood:`🍎 Libreng Pagkain at Pantry`,optSanctuary:`⛪ Mga Santuwaryo at Komunidad`,optHousing:`🏠 Emergency Shelters at Pabahay`,optEconomic:`💵 Pinansyal na Tulong (CAPI)`,cancelPinDropBtn:`Kanselahin ang Pin`,reportSightingBtn:`Mag-ulat ng Sighting`,anonymousSubmitterTitle:`Anonymous Sighting Submitter`,dragPinDesc:`I-drag ang dilaw na pin sa mapa upang markahan ang eksaktong lugar. Walang ipapakitang pagkakakilanlan ang iyong ulat.`,sightingCategoryLabel:`Kategorya ng Sighting`,detailsContextLabel:`Detalye ng Pangyayari`,submitReportBtn:`Isumite ang Ulat nang Anonymous`,verifyingSightingTxt:`Sinusuri ang sighting...`,liveMapFeedTitle:`Live Sighting Feed:`,townQuietMsg:`Walang aktibong checkpoints o pagsisiyasat ngayon. Payapa ang lungsod. 💚`,optIce:`🚨 ICE Checkpoint Sighting`,optRaid:`🚔 Aktibong Raid Sighting`,optDetention:`⛓️ Detention na Aktibidad`,optResponse:`📞 Rapid-Response Callout`,optAlert:`🔔 Babala para sa Komunidad`,optSafety:`🟢 Safe na Lugar Area Notice`},ru:{navBrand:`CENTINELA`,badge:`АНОНИМНО И КОНФИДЕНЦИАЛЬНО`,mainSubtitle:`ЦЕНТР БЕЗОПАСНОСТИ ОКЛЕНДА — ОПЕРАТИВНЫЕ СВОДКИ, КАРТЫ РЕСУРСОВ И ПЕРЕВОДЧИК.`,privacyBanner:`Ваша конфиденциальность защищена. Мы не отслеживаем вас и не запрашиваем имена, почту или адреса.`,mapTitle:`Карта безопасности Centinela`,mapDesc:`Интерактивная карта контрольно-пропускных пунктов и сообщений сообщества. Без слежки.`,footerCredit:`© 2026 Centinela Immigrant Safety Hub. Разработано с любовью для жителей Западного Окленда.`,footerLogs:`Никакого отслеживания, файлов cookie и системных журналов на серверах.`,rightsReminder:`Помните: у вас есть право хранить молчание. Ничего не подписывайте без адвоката. Не открывайте дверь, если агенты не предъявили ордер с подписью судьи.`,rapidResponse:`Команда экстренной правовой помощи Окленда: 510-241-4011`,clearDataBtn:`Стереть все данные с устройства`,clearDataConfirm:`Все файлы кэша, журналы активности и локальные хранилища были успешно стерты с этого устройства. Берегите себя! 💚`,tabMap:`Карта`,tabNews:`Сводки`,tabDirectory:`Ресурсы`,tabPrivacy:`Защита`,privacyConsoleTitle:`Анонимная панель безопасности`,privacyConsoleDesc:`Управляйте локальными режимами конфиденциальности, проверяйте журналы и мгновенно очищайте кэш.`,privacyPolicyTitle:`Политика конфиденциальности и аудит`,privacyPolicyDesc:`Centinela создана строго по принципу минимизации данных. Мы не собираем cookies, не отслеживаем IP и полностью исключаем учетные записи и регистрацию.`,deviceCleanseTitle:`Очистка устройства`,deviceCleanseDesc:`Нажмите кнопку ниже для очистки localStorage, настроек языка и голосового кэша, вернув устройство к исходному уровню защиты.`,vettedDirectoryTitle:`Проверенные ресурсы`,vettedDirectoryDesc:`Безопасные зоны, клиники и раздача еды в Окленде. Проверено в условиях строгой защиты конфиденциальности.`,addResourceBtn:`Добавить безопасное место`,modQueueBtn:`Очередь модерации`,allSafeZonesBtn:`Все безопасные зоны`,submitResourceTitle:`Добавить ресурс анонимно`,privacyWarningDesc:`Внимание: не отправляйте имена или личные данные людей. Все заявки проходят проверку перед публикацией.`,formCategoryLabel:`Категория ресурса`,formNameLabel:`Название организации`,formDescLabel:`Описание услуг`,formAddressLabel:`Адрес (Окленд, Калифорния)`,formHoursLabel:`Часы работы`,formProtocolLabel:`Протоколы безопасности / защиты`,submitResourceBtn:`Отправить ресурс`,submittingTxt:`Отправка...`,modConsoleTitle:`Консоль модератора Centinela`,modConsoleDesc:`Управляйте предложенными местами. Одобрение публикует информацию на главной карте мгновенно.`,modQueueEmpty:`Очередь модерации пуста.`,privacyGuaranteed:`Конфиденциальность гарантирована`,securityProtocolLabel:`Протокол безопасности:`,emptyDirectoryMsg:`В этой категории пока нет проверенных мест. Будьте первыми, кто предложит безопасный ресурс анонимно!`,optHealthcare:`🏥 Клиники и медицинская помощь`,optLegal:`⚖️ Юридическая поддержка и защита прав`,optFood:`🍎 Бесплатная еда и пищевые склады`,optSanctuary:`⛪ Общественные центры и убежища`,optHousing:`🏠 Временное жилье и шелтеры`,optEconomic:`💵 Программы финансовой помощи (CAPI)`,cancelPinDropBtn:`Отмена отметки`,reportSightingBtn:`Сообщить о патруле`,anonymousSubmitterTitle:`Анонимная отправка отчета`,dragPinDesc:`Перетащите желтый маркер на карте, чтобы отметить место. Отчет проверяется автоматически, личные данные не запрашиваются.`,sightingCategoryLabel:`Категория происшествия`,detailsContextLabel:`Подробности происшествия`,submitReportBtn:`Отправить отчет анонимно`,verifyingSightingTxt:`Проверка отчета...`,liveMapFeedTitle:`Лента активности в реальном времени:`,townQuietMsg:`Контрольно-пропускных пунктов и активности ICE сейчас не обнаружено. Ð
816’ городе спокойно. 💚`,optIce:`🚨 Обнаружен пост ICE`,optRaid:`🚔 Обнаружен активный рейд`,optDetention:`⛓️ Зафиксированы задержания`,optResponse:`📞 Вызов группы быстрого реагирования`,optAlert:`🔔 Тревога безопасности района`,optSafety:`🟢 Безопасная территория`}},IC=[{code:`en`,name:`English (EN)`},{code:`es`,name:`Español (ES)`},{code:`zh`,name:`繁體中文 (ZH)`},{code:`ht`,name:`Kreyòl Ayisyen (HT)`},{code:`ar`,name:`العربية (AR)`},{code:`pt`,name:`Português (PT)`},{code:`fr`,name:`Français (FR)`},{code:`vi`,name:`Tiếng Việt (VI)`},{code:`tl`,name:`Tagalog (TL)`},{code:`ru`,name:`Русский (RU)`}];function LC(){let[e,t]=(0,_.useState)(()=>localStorage.getItem(`sanctuary_lang`)||`en`),[n,r]=(0,_.useState)(`map`),[i,a]=(0,_.useState)(()=>localStorage.getItem(`centinela_theme`)||`light`);(0,_.useEffect)(()=>{document.documentElement.setAttribute(`data-theme`,i),localStorage.setItem(`centinela_theme`,i)},[i]);let o=`http://${window.location.hostname}:3001`;(0,_.useEffect)(()=>{localStorage.setItem(`sanctuary_lang`,e)},[e]);let s={...FC.en,...FC[e]||{}},c=e===`ar`;return(0,$.jsx)(`div`,{className:`app-container`,dir:c?`rtl`:`ltr`,style:{minHeight:`100vh`,background:`var(--bg-dark)`},children:(0,$.jsxs)(`div`,{className:`app-wrapper`,children:[(0,$.jsxs)(`header`,{className:`global-navbar`,style:{padding:`12px 0`,borderBottom:`1px solid var(--border-muted)`,marginBottom:`20px`},children:[(0,$.jsxs)(`div`,{className:`nav-brand`,style:{display:`flex`,alignItems:`center`,gap:`12px`},children:[(0,$.jsx)(`img`,{src:`/logo.jpg`,alt:`Centinela Logo`,style:{width:`40px`,height:`40px`,objectFit:`contain`,borderRadius:`50%`,border:`1px solid var(--oakland-gold)`,mixBlendMode:i===`light`?`multiply`:`screen`,filter:i===`light`?`none`:`invert(1)`}}),(0,$.jsx)(`span`,{style:{fontSize:`1.35rem`,fontWeight:`800`,letterSpacing:`1.5px`,color:`var(--text-white)`},children:s.navBrand})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`8px`},children:[(0,$.jsxs)(`button`,{onClick:()=>a(e=>e===`light`?`dark`:`light`),style:{background:`var(--bg-charcoal)`,border:`1px solid var(--border-muted)`,borderRadius:`50px`,padding:`6px 12px`,color:`var(--text-white)`,fontSize:`0.75rem`,fontWeight:`bold`,cursor:`pointer`,display:`flex`,alignItems:`center`,gap:`6px`,boxShadow:`0 2px 6px rgba(0,0,0,0.05)`,transition:`all 0.2s ease`},"aria-label":`Toggle Theme`,children:[i===`light`?(0,$.jsx)(ce,{size:13,style:{color:`var(--text-muted)`}}):(0,$.jsx)(_e,{size:13,style:{color:`var(--oakland-gold)`}}),(0,$.jsx)(`span`,{style:{fontSize:`0.75rem`},children:i===`light`?`Dark`:`Light`})]}),(0,$.jsx)(`select`,{className:`chat-input`,style:{padding:`8px 12px`,background:`var(--bg-charcoal)`,border:`1px solid var(--border-muted)`,borderRadius:`50px`,color:`var(--text-white)`,fontSize:`0.8rem`,fontWeight:`bold`,cursor:`pointer`},value:e,onChange:e=>t(e.target.value),children:IC.map(e=>(0,$.jsx)(`option`,{value:e.code,children:e.name},e.code))})]})]}),(0,$.jsxs)(`div`,{className:`privacy-banner`,style:{background:`var(--green-bg)`,border:`1px solid var(--oakland-green-light)`,borderRadius:`14px`,padding:`16px 20px`,marginBottom:`24px`,display:`flex`,gap:`12px`,alignItems:`center`},children:[(0,$.jsx)(`div`,{style:{fontSize:`1.5rem`,color:`var(--oakland-green-light)`},children:`🛡️`}),(0,$.jsx)(`p`,{style:{fontSize:`0.9rem`,fontWeight:`700`,color:`var(--success-text)`,margin:0},children:s.privacyBanner})]}),(0,$.jsxs)(`main`,{className:`main-content-canvas`,style:{minHeight:`440px`,background:`var(--bg-card)`,borderRadius:`16px`,border:`1px solid var(--border-muted)`,overflow:`hidden`,boxShadow:`0 8px 32px rgba(0,0,0,0.05)`,marginBottom:`90px`},children:[(0,$.jsx)(`div`,{style:{display:n===`map`?`block`:`none`},children:(0,$.jsx)(wC,{dict:s,currentLang:e,theme:i,apiBase:o})}),(0,$.jsx)(`div`,{style:{display:n===`news`?`block`:`none`},children:(0,$.jsx)(kC,{dict:s,currentLang:e})}),(0,$.jsx)(`div`,{style:{display:n===`voice`?`block`:`none`},children:(0,$.jsx)(PC,{dict:s,currentLang:e,apiBase:o})}),(0,$.jsx)(`div`,{style:{display:n===`resources`?`block`:`none`},children:(0,$.jsx)(EC,{dict:s,apiBase:o})}),(0,$.jsxs)(`div`,{style:{display:n===`profile`?`block`:`none`,padding:`20px`},children:[(0,$.jsxs)(`div`,{style:{borderBottom:`1px solid var(--border-muted)`,paddingBottom:`16px`,marginBottom:`16px`},children:[(0,$.jsxs)(`h2`,{style:{fontSize:`1.25rem`,fontWeight:`800`,color:`var(--text-white)`,dis
816play:`flex`,alignItems:`center`,gap:`8px`},children:[(0,$.jsx)(ve,{style:{color:`var(--accent)`}}),s.privacyConsoleTitle]}),(0,$.jsx)(`p`,{style:{fontSize:`0.85rem`,color:`var(--text-muted)`,marginTop:`4px`},children:s.privacyConsoleDesc})]}),(0,$.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`16px`},children:[(0,$.jsxs)(`div`,{style:{background:`var(--bg-charcoal)`,border:`1px solid var(--border-muted)`,padding:`16px`,borderRadius:`12px`},children:[(0,$.jsx)(`strong`,{style:{fontSize:`0.9rem`,color:`var(--text-white)`,display:`block`,marginBottom:`6px`},children:s.privacyPolicyTitle}),(0,$.jsx)(`span`,{style:{fontSize:`0.8rem`,color:`var(--text-muted)`,lineHeight:`1.5`},children:s.privacyPolicyDesc})]}),(0,$.jsxs)(`div`,{style:{background:`var(--bg-charcoal)`,border:`1px solid var(--border-muted)`,padding:`16px`,borderRadius:`12px`},children:[(0,$.jsx)(`strong`,{style:{fontSize:`0.9rem`,color:`var(--text-white)`,display:`block`,marginBottom:`6px`},children:s.deviceCleanseTitle}),(0,$.jsx)(`span`,{style:{fontSize:`0.8rem`,color:`var(--text-muted)`,display:`block`,marginBottom:`12px`,lineHeight:`1.5`},children:s.deviceCleanseDesc}),(0,$.jsx)(`button`,{onClick:()=>{localStorage.clear(),sessionStorage.clear(),alert(s.clearDataConfirm),window.location.reload()},className:`action-btn`,style:{background:`var(--danger-red)`,color:`#fff`,fontWeight:`800`,border:`none`,borderRadius:`8px`,padding:`12px`,cursor:`pointer`,fontSize:`0.85rem`},children:s.clearDataBtn})]})]})]})]}),(0,$.jsxs)(`nav`,{style:{position:`fixed`,bottom:0,left:0,right:0,background:`var(--bg-card)`,borderTop:`1px solid var(--border-muted)`,display:`flex`,justifyContent:`space-around`,alignItems:`center`,padding:`10px 0`,zIndex:1e3,boxShadow:`0 -4px 16px rgba(0,0,0,0.05)`},children:[(0,$.jsxs)(`button`,{onClick:()=>r(`map`),style:{background:`transparent`,border:`none`,display:`flex`,flexDirection:`column`,alignItems:`center`,gap:`4px`,cursor:`pointer`,color:n===`map`?`var(--accent)`:`var(--text-muted)`},children:[(0,$.jsx)(M,{size:20}),(0,$.jsx)(`span`,{style:{fontSize:`0.65rem`,fontWeight:`700`},children:s.tabMap})]}),(0,$.jsxs)(`button`,{onClick:()=>r(`news`),style:{background:`transparent`,border:`none`,display:`flex`,flexDirection:`column`,alignItems:`center`,gap:`4px`,cursor:`pointer`,color:n===`news`?`var(--accent)`:`var(--text-muted)`},children:[(0,$.jsx)(ue,{size:20}),(0,$.jsx)(`span`,{style:{fontSize:`0.65rem`,fontWeight:`700`},children:s.tabNews})]}),(0,$.jsx)(`button`,{onClick:()=>r(`voice`),style:{background:n===`voice`?`var(--accent)`:`var(--bg-charcoal)`,border:`none`,width:`48px`,height:`48px`,borderRadius:`50%`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`,color:n===`voice`?`#fff`:`var(--text-white)`,marginTop:`-24px`,boxShadow:`0 4px 12px rgba(0,0,0,0.1)`,transition:`all 0.2s ease`},children:(0,$.jsx)(se,{size:24})}),(0,$.jsxs)(`button`,{onClick:()=>r(`resources`),style:{background:`transparent`,border:`none`,display:`flex`,flexDirection:`column`,alignItems:`center`,gap:`4px`,cursor:`pointer`,color:n===`resources`?`var(--accent)`:`var(--text-muted)`},children:[(0,$.jsx)(re,{size:20}),(0,$.jsx)(`span`,{style:{fontSize:`0.65rem`,fontWeight:`700`},children:s.tabDirectory})]}),(0,$.jsxs)(`button`,{onClick:()=>r(`profile`),style:{background:`transparent`,border:`none`,display:`flex`,flexDirection:`column`,alignItems:`center`,gap:`4px`,cursor:`pointer`,color:n===`profile`?`var(--accent)`:`var(--text-muted)`},children:[(0,$.jsx)(ve,{size:20}),(0,$.jsx)(`span`,{style:{fontSize:`0.65rem`,fontWeight:`700`},children:s.tabPrivacy})]})]}),(0,$.jsxs)(`div`,{style:{background:`var(--danger-red-glow)`,border:`1px solid var(--danger-red)`,borderRadius:`12px`,padding:`12px`,marginTop:`24px`,display:`flex`,justifyContent:`space-between`,alignItems:`center`,gap:`10px`},children:[(0,$.jsxs)(`div`,{style:{display:`flex`,gap:`8px`,alignItems:`center`},children:[(0,$.jsx)(me,{size:20,style:{color:`var(--danger-red)`,flexShrink:0}}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`strong`,{style:{fontSize:`0.8rem`,color:`var(--danger-text)`,dis
816play:`block`},children:`Emergency Rapid Response legal line`}),(0,$.jsx)(`span`,{style:{fontSize:`0.75rem`,color:`var(--danger-text)`,opacity:.9},children:s.rightsReminder})]})]}),(0,$.jsxs)(`a`,{href:`tel:510-241-4011`,style:{background:`var(--danger-red)`,color:`#fff`,textDecoration:`none`,padding:`10px 16px`,borderRadius:`8px`,fontWeight:`800`,fontSize:`0.75rem`,display:`flex`,alignItems:`center`,gap:`6px`,flexShrink:0},children:[(0,$.jsx)(de,{size:14}),` Call 510-241-4011`]})]}),(0,$.jsxs)(`footer`,{className:`global-footer`,style:{marginTop:`48px`,paddingBottom:`32px`},children:[(0,$.jsxs)(`div`,{className:`security-note`,children:[(0,$.jsx)(`span`,{className:`security-dot`}),s.footerLogs]}),(0,$.jsx)(`p`,{className:`global-footer-text`,children:s.footerCredit})]})]})})}(0,v.createRoot)(document.getElementById(`root`)).render((0,$.jsx)(_.StrictMode,{children:(0,$.jsx)(LC,{})}));

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.