>>1;ro(l,n))co(u,l)?(t[r]=u,t[c]=n,r=c):(t[r]=l,t[a]=n,r=a);else{if(!(co(u,n)))break t;t[r]=u,t[c]=n,r=c}}}return e}function o(t,e){var n=t.sortIndex-e.sortIndex;return 0!==n?n:t.id-e.id}if("object"===typeof performance&&"function"===typeof performance.now){var s=performance;e.unstable_now=function(){return s.now()}}else{var a=Date,l=a.now();e.unstable_now=function(){return a.now()-l}}var c=[],u=[],d=1,h=null,f=3,p=!1,g=!1,m=!1,v="function"===typeof setTimeout?setTimeout:null,b="function"===typeof clearTimeout?clearTimeout:null,y="undefined"!==typeof setImmediate?setImmediate:null;function x(t){for(var e=r(u);null!==e;){if(null===e.callback)i(u);else{if(!(e.startTime<=t))break;i(u),e.sortIndex=e.expirationTime,n(c,e)}e=r(u)}}function A(t){if(m=!1,x(t),!g)if(null!==r(c))g=!0,I(_);else{var e=r(u);null!==e&&B(A,e.startTime-t)}}function _(t,n){g=!1,m&&(m=!1,b(E),E=-1),p=!0;var o=f;try{for(x(n),h=r(c);null!==h&&(!(h.expirationTime>n)||t&&!T());){var s=h.callback;if("function"===typeof s){h.callback=null,f=h.priorityLevel;var a=s(h.expirationTime<=n);n=e.unstable_now(),"function"===typeof a?h.callback=a:h===r(c)&&i(c),x(n)}else i(c);h=r(c)}if(null!==h)var l=!0;else{var d=r(u);null!==d&&B(A,d.startTime-n),l=!1}return l}finally{h=null,f=o,p=!1}}"undefined"!==typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var w,S=!1,C=null,E=-1,P=5,M=-1;function T(){return!(e.unstable_now()-Mt||125s?(t.sortIndex=o,n(u,t),null===r(c)&&t===r(u)&&(m?(b(E),E=-1):m=!0,B(A,o-s))):(t.sortIndex=a,n(c,t),g||p||(g=!0,I(_))),t},e.unstable_shouldYield=T,e.unstable_wrapCallback=function(t){var e=f;return function(){var n=f;f=e;try{return t.apply(this,arguments)}finally{f=n}}}},8853:(t,e,n)=>{"use strict";t.exports=n(7234)},1289:t=>{"use strict";t.exports=(t,e)=>{if("string"!==typeof t||"string"!==typeof e)throw new TypeError("Expected the arguments to be of type `string`");if(""===e)return[t];const n=t.indexOf(e);return-1===n?[t]:[t.slice(0,n),t.slice(n+e.length)]}},7491:t=>{"use strict";t.exports=t=>encodeURIComponent(t).replace(/[!'()*]/g,(t=>"%".concat(t.charCodeAt(0).toString(16).toUpperCase())))},5956:(t,e,n)=>{"use strict";var r=n(5043);var i="function"===typeof Object.is?Object.is:function(t,e){return t===e&&(0!==t||1/t===1/e)||t!==t&&e!==e},o=r.useState,s=r.useEffect,a=r.useLayoutEffect,l=r.useDebugValue;function c(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!i(t,n)}catch(r){return!0}}var u="undefined"===typeof window||"undefined"===typeof window.document||"undefined"===typeof window.document.createElement?function(t,e){return e()}:function(t,e){var n=e(),r=o({inst:{value:n,getSnapshot:e}}),i=r[0].inst,u=r[1];return a((function(){i.value=n,i.getSnapshot=e,c(i)&&u({inst:i})}),[t,n,e]),s((function(){return c(i)&&u({inst:i}),t((function(){c(i)&&u({inst:i})}))}),[t]),l(n),n};e.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:u},5039:(t,e,n)=>{"use strict";var r=n(5043),i=n(9461);var o="function"===typeof Object.is?Object.is:function(t,e){return t===e&&(0!==t||1/t===1/e)||t!==t&&e!==e},s=i.useSyncExternalStore,a=r.useRef,l=r.useEffect,c=r.useMemo,u=r.useDebugValue;e.useSyncExternalStoreWithSelector=function(t,e,n,r,i){var d=a(null);if(null===d.current){var h={hasValue:!1,value:null};d.current=h}else h=d.current;d=c((function(){function t(t){if(!l){if(l=!0,s=t,t=r(t),void 0!==i&&h.hasValue){var e=h.value;if(i(e,t))return a=e}return a=t}if(e=a,o(s,t))return e;var n=r(t);return void 0!==i&&i(e,n)?e:(s=t,a=n)}var s,a,l=!1,c=void 0===n?null:n;return[function(){return t(e())},null===c?void 0:function(){return t(c())}]}),[e,n,r,i]);var f=s(t,d[0],d[1]);return l((function(){h.hasValue=!0,h.value=f}),[f]),u(f),f}},9461:(t,e,n)=>{"use strict";t.exports=n(5956)},8443:(t,e,n)=>{"use strict";t.exports=n(5039)},4634:t=>{function e(){return t.exports=e=Object.assign?Object.assign.bind():function(t){for(var e=1;e{t.exports=function(t){return t&&t.__esModule?t:{default:t}},t.exports.__esModule=!0,t.exports.default=t.exports},4893:t=>{t.exports=function(t,e){if(null==t)return{};var n,r,i={},o=Object.keys(t);for(r=0;r=0||(i[n]=t[n]);return i},t.exports.__esModule=!0,t.exports.default=t.exports},8168:(t,e,n)=>{"use strict";function r(){return r=Object.assign?Object.assign.bind():function(t){for(var e=1;er})},8587:(t,e,n)=>{"use strict";function r(t,e){if(null==t)return{};var n,r,i={},o=Object.keys(t);for(r=0;r=0||(i[n]=t[n]);return i}n.d(e,{A:()=>r})},8387:(t,e,n)=>{"use strict";function r(t){var e,n,i="";if("string"==typeof t||"number"==typeof t)i+=t;else if("object"==typeof t)if(Array.isArray(t)){var o=t.length;for(e=0;ei});const i=function(){for(var t,e,n=0,i="",o=arguments.length;n{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},(()=>{var t,e=Object.getPrototypeOf?t=>Object.getPrototypeOf(t):t=>t.__proto__;n.t=function(r,i){if(1&i&&(r=this(r)),8&i)return r;if("object"===typeof r&&r){if(4&i&&r.__esModule)return r;if(16&i&&"function"===typeof r.then)return r}var o=Object.create(null);n.r(o);var s={};t=t||[null,e({}),e([]),e(e)];for(var a=2&i&&r;"object"==typeof a&&!~t.indexOf(a);a=e(a))Object.getOwnPropertyNames(a).forEach((t=>s[t]=()=>r[t]));return s.default=()=>r,n.d(o,s),o}})(),n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.f={},n.e=t=>Promise.all(Object.keys(n.f).reduce(((e,r)=>(n.f[r](t,e),e)),[])),n.u=t=>"static/js/"+t+".18025603.chunk.js",n.miniCssF=t=>{},n.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"===typeof window)return window}}(),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{var t={},e="cityscopejs:";n.l=(r,i,o,s)=>{if(t[r])t[r].push(i);else{var a,l;if(void 0!==o)for(var c=document.getElementsByTagName("script"),u=0;u{a.onerror=a.onload=null,clearTimeout(f);var i=t[r];if(delete t[r],a.parentNode&&a.parentNode.removeChild(a),i&&i.forEach((t=>t(n))),e)return e(n)},f=setTimeout(h.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=h.bind(null,a.onerror),a.onload=h.bind(null,a.onload),l&&document.head.appendChild(a)}}})(),n.r=t=>{"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.p="https://cityscope.media.mit.edu/CS_cityscopeJS/",(()=>{var t={792:0};n.f.j=(e,r)=>{var i=n.o(t,e)?t[e]:void 0;if(0!==i)if(i)r.push(i[2]);else{var o=new Promise(((n,r)=>i=t[e]=[n,r]));r.push(i[2]=o);var s=n.p+n.u(e),a=new Error;n.l(s,(r=>{if(n.o(t,e)&&(0!==(i=t[e])&&(t[e]=void 0),i)){var o=r&&("load"===r.type?"missing":r.type),s=r&&r.target&&r.target.src;a.message="Loading chunk "+e+" failed.\n("+o+": "+s+")",a.name="ChunkLoadError",a.type=o,a.request=s,i[1](a)}}),"chunk-"+e,e)}};var e=(e,r)=>{var i,o,s=r[0],a=r[1],l=r[2],c=0;if(s.some((e=>0!==t[e]))){for(i in a)n.o(a,i)&&(n.m[i]=a[i]);if(l)l(n)}for(e&&e(r);c{"use strict";var t={};n.r(t),n.d(t,{readFileAsArrayBuffer:()=>LN,readFileAsText:()=>DN,requireFromFile:()=>FN,requireFromString:()=>NN});var e={};n.r(e),n.d(e,{decode:()=>Zj,name:()=>Qj});var r={};n.r(r),n.d(r,{name:()=>iz,preprocess:()=>oz});var i={};n.r(i),n.d(i,{name:()=>az,preprocess:()=>lz});var o={};n.r(o),n.d(o,{decode:()=>Tz,encode:()=>Oz,name:()=>Pz,preprocess:()=>Mz});var s={};n.r(s),n.d(s,{decode:()=>Uz,name:()=>Fz});var a={};n.r(a),n.d(a,{decode:()=>Kz,encode:()=>Xz,name:()=>Jz});var l={};n.r(l),n.d(l,{decode:()=>Qz,encode:()=>Zz,name:()=>Yz});var c={};n.r(c),n.d(c,{decode:()=>eU,encode:()=>nU,name:()=>tU});var u={};n.r(u),n.d(u,{decode:()=>sU,name:()=>oU});var d={};n.r(d),n.d(d,{hasBrowserEnv:()=>uQ,hasStandardBrowserEnv:()=>dQ,hasStandardBrowserWebWorkerEnv:()=>fQ});var h=n(5043),f=n(8168),p=n(2876),g=n(869),m=n(5527),v=n(579);const b=function(t){let{styles:e,themeId:n,defaultTheme:r={}}=t;const i=(0,m.A)(r),o="function"===typeof e?e(n&&i[n]||i):e;return(0,v.jsx)(g.A,{styles:o})};var y=n(5170),x=n(3375);const A=function(t){return(0,v.jsx)(b,(0,f.A)({},t,{defaultTheme:y.A,themeId:x.A}))},_=(t,e)=>(0,f.A)({WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale",boxSizing:"border-box",WebkitTextSizeAdjust:"100%"},e&&!t.vars&&{colorScheme:t.palette.mode}),w=t=>(0,f.A)({color:(t.vars||t).palette.text.primary},t.typography.body1,{backgroundColor:(t.vars||t).palette.background.default,"@media print":{backgroundColor:(t.vars||t).palette.common.white}});const S=function(t){const e=(0,p.A)({props:t,name:"MuiCssBaseline"}),{children:n,enableColorScheme:r=!1}=e;return(0,v.jsxs)(h.Fragment,{children:[(0,v.jsx)(A,{styles:t=>function(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var n;const r={};e&&t.colorSchemes&&Object.entries(t.colorSchemes).forEach((e=>{let[n,i]=e;var o;r[t.getColorSchemeSelector(n).replace(/\s*&/,"")]={colorScheme:null==(o=i.palette)?void 0:o.mode}}));let i=(0,f.A)({html:_(t,e),"*, *::before, *::after":{boxSizing:"inherit"},"strong, b":{fontWeight:t.typography.fontWeightBold},body:(0,f.A)({margin:0},w(t),{"&::backdrop":{backgroundColor:(t.vars||t).palette.background.default}})},r);const o=null==(n=t.components)||null==(n=n.MuiCssBaseline)?void 0:n.styleOverrides;return o&&(i=[i,o]),i}(t,r)}),n]})};var C=n(8587);const E=h.createContext(null);function P(){return h.useContext(E)}const M="function"===typeof Symbol&&Symbol.for?Symbol.for("mui.nested"):"__THEME_NESTED__";const T=function(t){const{children:e,theme:n}=t,r=P(),i=h.useMemo((()=>{const t=null===r?n:function(t,e){if("function"===typeof e)return e(t);return(0,f.A)({},t,e)}(r,n);return null!=t&&(t[M]=null!==r),t}),[n,r]);return(0,v.jsx)(E.Provider,{value:i,children:e})};var O=n(5756),k=n(7082);const R=["value"],I=h.createContext();const B=()=>{const t=h.useContext(I);return null!=t&&t},L=function(t){let{value:e}=t,n=(0,C.A)(t,R);return(0,v.jsx)(I.Provider,(0,f.A)({value:null==e||e},n))},D={};function F(t,e,n){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return h.useMemo((()=>{const i=t&&e[t]||e;if("function"===typeof n){const o=n(i),s=t?(0,f.A)({},e,{[t]:o}):o;return r?()=>s:s}return t?(0,f.A)({},e,{[t]:n}):(0,f.A)({},e,n)}),[t,e,n,r])}const N=function(t){const{children:e,theme:n,themeId:r}=t,i=(0,k.A)(D),o=P()||D,s=F(r,i,n),a=F(r,o,n,!0),l="rtl"===s.direction;return(0,v.jsx)(T,{theme:a,children:(0,v.jsx)(O.T.Provider,{value:s,children:(0,v.jsx)(L,{value:l,children:e})})})},j=["theme"];function z(t){let{theme:e}=t,n=(0,C.A)(t,j);const r=e[x.A];return(0,v.jsx)(N,(0,f.A)({},n,{themeId:r?x.A:void 0,theme:r||e}))}var U=n(9461),V=n(8443),G=n(7950);let W=function(t){t()};const H=()=>W,J=Symbol.for("react-redux-context"),K="undefined"!==typeof globalThis?globalThis:{};function X(){var t;if(!h.createContext)return{};const e=null!=(t=K[J])?t:K[J]=new Map;let n=e.get(h.createContext);return n||(n=h.createContext(null),e.set(h.createContext,n)),n}const q=X();function Y(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:q;return function(){return(0,h.useContext)(t)}}const Q=Y();let Z=()=>{throw new Error("uSES not initialized!")};const $=(t,e)=>t===e;function tt(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:q;const e=t===q?Q:Y(t);return function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{equalityFn:r=$,stabilityCheck:i,noopCheck:o}="function"===typeof n?{equalityFn:n}:n;const{store:s,subscription:a,getServerState:l,stabilityCheck:c,noopCheck:u}=e(),d=((0,h.useRef)(!0),(0,h.useCallback)({[t.name]:e=>t(e)}[t.name],[t,c,i])),f=Z(a.addNestedSub,s.getState,l||s.getState,d,r);return(0,h.useDebugValue)(f),f}}const et=tt();n(219),n(2086);const nt={notify(){},get:()=>[]};function rt(t,e){let n,r=nt,i=0,o=!1;function s(){c.onStateChange&&c.onStateChange()}function a(){i++,n||(n=e?e.addNestedSub(s):t.subscribe(s),r=function(){const t=H();let e=null,n=null;return{clear(){e=null,n=null},notify(){t((()=>{let t=e;for(;t;)t.callback(),t=t.next}))},get(){let t=[],n=e;for(;n;)t.push(n),n=n.next;return t},subscribe(t){let r=!0,i=n={callback:t,next:null,prev:n};return i.prev?i.prev.next=i:e=i,function(){r&&null!==e&&(r=!1,i.next?i.next.prev=i.prev:n=i.prev,i.prev?i.prev.next=i.next:e=i.next)}}}}())}function l(){i--,n&&0===i&&(n(),n=void 0,r.clear(),r=nt)}const c={addNestedSub:function(t){a();const e=r.subscribe(t);let n=!1;return()=>{n||(n=!0,e(),l())}},notifyNestedSubs:function(){r.notify()},handleChangeWrapper:s,isSubscribed:function(){return o},trySubscribe:function(){o||(o=!0,a())},tryUnsubscribe:function(){o&&(o=!1,l())},getListeners:()=>r};return c}const it=!("undefined"===typeof window||"undefined"===typeof window.document||"undefined"===typeof window.document.createElement)?h.useLayoutEffect:h.useEffect;let ot=null;const st=function(t){let{store:e,context:n,children:r,serverState:i,stabilityCheck:o="once",noopCheck:s="once"}=t;const a=h.useMemo((()=>{const t=rt(e);return{store:e,subscription:t,getServerState:i?()=>i:void 0,stabilityCheck:o,noopCheck:s}}),[e,i,o,s]),l=h.useMemo((()=>e.getState()),[e]);it((()=>{const{subscription:t}=a;return t.onStateChange=t.notifyNestedSubs,t.trySubscribe(),l!==e.getState()&&t.notifyNestedSubs(),()=>{t.tryUnsubscribe(),t.onStateChange=void 0}}),[a,l]);const c=n||q;return h.createElement(c.Provider,{value:a},r)};function at(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:q;const e=t===q?Q:Y(t);return function(){const{store:t}=e();return t}}const lt=at();function ct(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:q;const e=t===q?lt:at(t);return function(){return e().dispatch}}const ut=ct();var dt;function ht(t){for(var e=arguments.length,n=Array(e>1?e-1:0),r=1;r3?e.i-4:e.i:Array.isArray(t)?1:At(t)?2:_t(t)?3:0}function vt(t,e){return 2===mt(t)?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function bt(t,e){return 2===mt(t)?t.get(e):t[e]}function yt(t,e,n){var r=mt(t);2===r?t.set(e,n):3===r?t.add(n):t[e]=n}function xt(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e}function At(t){return Qt&&t instanceof Map}function _t(t){return Zt&&t instanceof Set}function wt(t){return t.o||t.t}function St(t){if(Array.isArray(t))return Array.prototype.slice.call(t);var e=oe(t);delete e[ne];for(var n=ie(e),r=0;r1&&(t.set=t.add=t.clear=t.delete=Et),Object.freeze(t),e&>(t,(function(t,e){return Ct(e,!0)}),!0)),t}function Et(){ht(2)}function Pt(t){return null==t||"object"!=typeof t||Object.isFrozen(t)}function Mt(t){var e=se[t];return e||ht(18,t),e}function Tt(t,e){se[t]||(se[t]=e)}function Ot(){return qt}function kt(t,e){e&&(Mt("Patches"),t.u=[],t.s=[],t.v=e)}function Rt(t){It(t),t.p.forEach(Lt),t.p=null}function It(t){t===qt&&(qt=t.l)}function Bt(t){return qt={p:[],l:qt,h:t,m:!0,_:0}}function Lt(t){var e=t[ne];0===e.i||1===e.i?e.j():e.g=!0}function Dt(t,e){e._=e.p.length;var n=e.p[0],r=void 0!==t&&t!==n;return e.h.O||Mt("ES5").S(e,t,r),r?(n[ne].P&&(Rt(e),ht(4)),pt(t)&&(t=Ft(e,t),e.l||jt(e,t)),e.u&&Mt("Patches").M(n[ne].t,t,e.u,e.s)):t=Ft(e,n,[]),Rt(e),e.u&&e.v(e.u,e.s),t!==te?t:void 0}function Ft(t,e,n){if(Pt(e))return e;var r=e[ne];if(!r)return gt(e,(function(i,o){return Nt(t,r,e,i,o,n)}),!0),e;if(r.A!==t)return e;if(!r.P)return jt(t,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var i=4===r.i||5===r.i?r.o=St(r.k):r.o,o=i,s=!1;3===r.i&&(o=new Set(i),i.clear(),s=!0),gt(o,(function(e,o){return Nt(t,r,i,e,o,n,s)})),jt(t,i,!1),n&&t.u&&Mt("Patches").N(r,n,t.u,t.s)}return r.o}function Nt(t,e,n,r,i,o,s){if(ft(i)){var a=Ft(t,i,o&&e&&3!==e.i&&!vt(e.R,r)?o.concat(r):void 0);if(yt(n,r,a),!ft(a))return;t.m=!1}else s&&n.add(i);if(pt(i)&&!Pt(i)){if(!t.h.D&&t._<1)return;Ft(t,i),e&&e.A.l||jt(t,i)}}function jt(t,e,n){void 0===n&&(n=!1),!t.l&&t.h.D&&t.m&&Ct(e,n)}function zt(t,e){var n=t[ne];return(n?wt(n):t)[e]}function Ut(t,e){if(e in t)for(var n=Object.getPrototypeOf(t);n;){var r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=Object.getPrototypeOf(n)}}function Vt(t){t.P||(t.P=!0,t.l&&Vt(t.l))}function Gt(t){t.o||(t.o=St(t.t))}function Wt(t,e,n){var r=At(e)?Mt("MapSet").F(e,n):_t(e)?Mt("MapSet").T(e,n):t.O?function(t,e){var n=Array.isArray(t),r={i:n?1:0,A:e?e.A:Ot(),P:!1,I:!1,R:{},l:e,t:t,k:null,o:null,j:null,C:!1},i=r,o=ae;n&&(i=[r],o=le);var s=Proxy.revocable(i,o),a=s.revoke,l=s.proxy;return r.k=l,r.j=a,l}(e,n):Mt("ES5").J(e,n);return(n?n.A:Ot()).p.push(r),r}function Ht(t){return ft(t)||ht(22,t),function t(e){if(!pt(e))return e;var n,r=e[ne],i=mt(e);if(r){if(!r.P&&(r.i<4||!Mt("ES5").K(r)))return r.t;r.I=!0,n=Jt(e,i),r.I=!1}else n=Jt(e,i);return gt(n,(function(e,i){r&&bt(r.t,e)===i||yt(n,e,t(i))})),3===i?new Set(n):n}(t)}function Jt(t,e){switch(e){case 2:return new Map(t);case 3:return Array.from(t)}return St(t)}function Kt(){function t(t,e){var n=i[t];return n?n.enumerable=e:i[t]=n={configurable:!0,enumerable:e,get:function(){var e=this[ne];return ae.get(e,t)},set:function(e){var n=this[ne];ae.set(n,t,e)}},n}function e(t){for(var e=t.length-1;e>=0;e--){var i=t[e][ne];if(!i.P)switch(i.i){case 5:r(i)&&Vt(i);break;case 4:n(i)&&Vt(i)}}}function n(t){for(var e=t.t,n=t.k,r=ie(n),i=r.length-1;i>=0;i--){var o=r[i];if(o!==ne){var s=e[o];if(void 0===s&&!vt(e,o))return!0;var a=n[o],l=a&&a[ne];if(l?l.t!==s:!xt(a,s))return!0}}var c=!!e[ne];return r.length!==ie(e).length+(c?0:1)}function r(t){var e=t.k;if(e.length!==t.t.length)return!0;var n=Object.getOwnPropertyDescriptor(e,e.length-1);if(n&&!n.get)return!0;for(var r=0;r{Z=t})(V.useSyncExternalStoreWithSelector),(t=>{ot=t})(U.useSyncExternalStore),dt=G.unstable_batchedUpdates,W=dt;var Xt,qt,Yt="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),Qt="undefined"!=typeof Map,Zt="undefined"!=typeof Set,$t="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,te=Yt?Symbol.for("immer-nothing"):((Xt={})["immer-nothing"]=!0,Xt),ee=Yt?Symbol.for("immer-draftable"):"__$immer_draftable",ne=Yt?Symbol.for("immer-state"):"__$immer_state",re=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),ie="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:Object.getOwnPropertyNames,oe=Object.getOwnPropertyDescriptors||function(t){var e={};return ie(t).forEach((function(n){e[n]=Object.getOwnPropertyDescriptor(t,n)})),e},se={},ae={get:function(t,e){if(e===ne)return t;var n=wt(t);if(!vt(n,e))return function(t,e,n){var r,i=Ut(e,n);return i?"value"in i?i.value:null===(r=i.get)||void 0===r?void 0:r.call(t.k):void 0}(t,n,e);var r=n[e];return t.I||!pt(r)?r:r===zt(t.t,e)?(Gt(t),t.o[e]=Wt(t.A.h,r,t)):r},has:function(t,e){return e in wt(t)},ownKeys:function(t){return Reflect.ownKeys(wt(t))},set:function(t,e,n){var r=Ut(wt(t),e);if(null==r?void 0:r.set)return r.set.call(t.k,n),!0;if(!t.P){var i=zt(wt(t),e),o=null==i?void 0:i[ne];if(o&&o.t===n)return t.o[e]=n,t.R[e]=!1,!0;if(xt(n,i)&&(void 0!==n||vt(t.t,e)))return!0;Gt(t),Vt(t)}return t.o[e]===n&&(void 0!==n||e in t.o)||Number.isNaN(n)&&Number.isNaN(t.o[e])||(t.o[e]=n,t.R[e]=!0),!0},deleteProperty:function(t,e){return void 0!==zt(t.t,e)||e in t.t?(t.R[e]=!1,Gt(t),Vt(t)):delete t.R[e],t.o&&delete t.o[e],!0},getOwnPropertyDescriptor:function(t,e){var n=wt(t),r=Reflect.getOwnPropertyDescriptor(n,e);return r?{writable:!0,configurable:1!==t.i||"length"!==e,enumerable:r.enumerable,value:n[e]}:r},defineProperty:function(){ht(11)},getPrototypeOf:function(t){return Object.getPrototypeOf(t.t)},setPrototypeOf:function(){ht(12)}},le={};gt(ae,(function(t,e){le[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}})),le.deleteProperty=function(t,e){return le.set.call(this,t,e,void 0)},le.set=function(t,e,n){return ae.set.call(this,t[0],e,n,t[0])};var ce=function(){function t(t){var e=this;this.O=$t,this.D=!0,this.produce=function(t,n,r){if("function"==typeof t&&"function"!=typeof n){var i=n;n=t;var o=e;return function(t){var e=this;void 0===t&&(t=i);for(var r=arguments.length,s=Array(r>1?r-1:0),a=1;a1?r-1:0),o=1;o=0;n--){var r=e[n];if(0===r.path.length&&"replace"===r.op){t=r.value;break}}n>-1&&(e=e.slice(n+1));var i=Mt("Patches").$;return ft(t)?i(t,e):this.produce(t,(function(t){return i(t,e)}))},t}(),ue=new ce,de=ue.produce;ue.produceWithPatches.bind(ue),ue.setAutoFreeze.bind(ue),ue.setUseProxies.bind(ue),ue.applyPatches.bind(ue),ue.createDraft.bind(ue),ue.finishDraft.bind(ue);const he=de;function fe(t){return fe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},fe(t)}function pe(t){var e=function(t,e){if("object"!=fe(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=fe(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==fe(e)?e:e+""}function ge(t,e,n){return(e=pe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function me(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function ve(t){for(var e=1;e0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]{t.cityIOdata=e.payload},toggleCityIOisDone:(t,e)=>{t.cityIOisDone=e.payload},updateCityIOtableName:(t,e)=>{t.cityIOtableName=e.payload}}}),{updateCityIOdata:cn,toggleCityIOisDone:un,updateCityIOtableName:dn}=ln.actions,hn=ln.reducer;var fn=n(9370);const pn={fontFamily:'"Roboto Mono", sans-serif',fontSize:11,fontWeightLight:100,fontWeightRegular:500,fontWeightMedium:700,h1:{fontWeight:700,fontSize:45,letterSpacing:"-1px"},h2:{fontWeight:800,fontSize:29,letterSpacing:"-0.24px"},h3:{fontWeight:700,fontSize:24,letterSpacing:"-0.06px"},h4:{fontWeight:500,fontSize:20,letterSpacing:"-0.06px"},h5:{fontWeight:500,fontSize:16,letterSpacing:"-0.05px"},h6:{fontWeight:500,fontSize:14,letterSpacing:"-0.05px"},overline:{fontWeight:500}};var gn=n(7344);const mn=(0,gn.A)({typography:pn,palette:{mode:"dark"}}),vn={csjsURL:(()=>{const t=window.location,e="cityscopejs_local"in fn.parse(t.search)?"http://localhost:3000":"https://cityscope.media.mit.edu/CS_cityscopeJS";return console.log("cityScopeJS location: ",e),e})()},bn={docsURL:"https://raw.githubusercontent.com/CityScope/CS_cityscopeJS/master/docs/",cityIO:{baseURL:(()=>{const t=window.location,e="cityio_local"in fn.parse(t.search)?"http://localhost:8080/api/":"https://cityio.media.mit.edu/cityio/api/";return console.log("cityIO server location: ",e),e})(),websocketURL:(()=>{const t=window.location,e="cityio_local"in fn.parse(t.search)?"ws://localhost:8080/interface":"wss://cityio.media.mit.edu/cityio/interface";return console.log("cityIO websocket server location: ",e),e})(),ListOfTables:"table/list/",headers:"table/headers/",interval:500,cityIOmodules:[{name:"header",expectUpdate:!1},{name:"GEOGRID",expectUpdate:!1},{name:"ABM2",expectUpdate:!0},{name:"geojson",expectUpdate:!0},{name:"grid",expectUpdate:!1},{name:"access",expectUpdate:!0},{name:"GEOGRIDDATA",expectUpdate:!1},{name:"indicators",expectUpdate:!0},{name:"textual",expectUpdate:!0},{name:"scenarios",expectUpdate:!0},{name:"tui",expectUpdate:!0},{name:"geo_heatmap",expectUpdate:!0},{name:"traffic",expectUpdate:!0}]}},yn={map:{mapboxLink:"mapbox://styles/relnox/",mapboxRefreshString:"?fresh=true",mapStyles:{Dark:"ck0h5xn701bpr1dqs3he2lecq",Inverse:"cjlu6w5sc1dy12rmn4kl2zljn",Normal:"cl8dv36nv000t14qik9yg4ys6"},layers:{ABM:{endTime:86400,startTime:43200,animationSpeed:100}},initialViewState:{maxZoom:22,pitch:0,bearing:0,longitude:-122.41669,latitude:37.7853,zoom:13}}},xn={GRID_LAYER_CHECKBOX:{displayName:"CS Grid",cityIOmoduleName:"GEOGRID",initState:!0,initSliderValue:50},ABM_LAYER_CHECKBOX:{displayName:"Trips Volume",cityIOmoduleName:"ABM2",initState:!1,initSliderValue:5},AGGREGATED_TRIPS_LAYER_CHECKBOX:{displayName:"Origin-Destination",cityIOmoduleName:"ABM2",initState:!1,initSliderValue:20},ACCESS_LAYER_CHECKBOX:{displayName:"Heatmap",cityIOmoduleName:"access",initState:!1,initSliderValue:50,selected:0}},An={RESET_VIEW_BUTTON:{displayName:"Reset View",initState:!1},ORTHO_VIEW_BUTTON:{displayName:"Ortho View",initState:!1},NORTH_VIEW_BUTTON:{displayName:"North View",initState:!1}};var _n=n(5332),wn=n(8387),Sn=n(3174),Cn=n(8812),En=n(8698);const Pn=["className","component"];var Mn=n(5430),Tn=n(7056);const On=(0,Tn.A)("MuiBox",["root"]),kn=(0,gn.A)(),Rn=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{themeId:e,defaultTheme:n,defaultClassName:r="MuiBox-root",generateClassName:i}=t,o=(0,Sn.default)("div",{shouldForwardProp:t=>"theme"!==t&&"sx"!==t&&"as"!==t})(Cn.A),s=h.forwardRef((function(t,s){const a=(0,m.A)(n),l=(0,En.A)(t),{className:c,component:u="div"}=l,d=(0,C.A)(l,Pn);return(0,v.jsx)(o,(0,f.A)({as:u,ref:s,className:(0,wn.A)(c,i?i(r):r),theme:e&&a[e]||a},d))}));return s}({themeId:x.A,defaultTheme:kn,defaultClassName:On.root,generateClassName:Mn.A.generate}),In=Rn;var Bn=n(8606),Ln=n(4535),Dn=n(6803),Fn=n(2400);function Nn(t){return(0,Fn.Ay)("MuiTypography",t)}(0,Tn.A)("MuiTypography",["root","h1","h2","h3","h4","h5","h6","subtitle1","subtitle2","body1","body2","inherit","button","caption","overline","alignLeft","alignRight","alignCenter","alignJustify","noWrap","gutterBottom","paragraph"]);const jn=["align","className","component","gutterBottom","noWrap","paragraph","variant","variantMapping"],zn=(0,Ln.Ay)("span",{name:"MuiTypography",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,n.variant&&e[n.variant],"inherit"!==n.align&&e["align".concat((0,Dn.A)(n.align))],n.noWrap&&e.noWrap,n.gutterBottom&&e.gutterBottom,n.paragraph&&e.paragraph]}})((t=>{let{theme:e,ownerState:n}=t;return(0,f.A)({margin:0},"inherit"===n.variant&&{font:"inherit"},"inherit"!==n.variant&&e.typography[n.variant],"inherit"!==n.align&&{textAlign:n.align},n.noWrap&&{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},n.gutterBottom&&{marginBottom:"0.35em"},n.paragraph&&{marginBottom:16})})),Un={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",subtitle1:"h6",subtitle2:"h6",body1:"p",body2:"p",inherit:"p"},Vn={primary:"primary.main",textPrimary:"text.primary",secondary:"secondary.main",textSecondary:"text.secondary",error:"error.main"},Gn=h.forwardRef((function(t,e){const n=(0,p.A)({props:t,name:"MuiTypography"}),r=(t=>Vn[t]||t)(n.color),i=(0,En.A)((0,f.A)({},n,{color:r})),{align:o="inherit",className:s,component:a,gutterBottom:l=!1,noWrap:c=!1,paragraph:u=!1,variant:d="body1",variantMapping:h=Un}=i,g=(0,C.A)(i,jn),m=(0,f.A)({},i,{align:o,color:r,className:s,component:a,gutterBottom:l,noWrap:c,paragraph:u,variant:d,variantMapping:h}),b=a||(u?"p":h[d]||Un[d])||"span",y=(t=>{const{align:e,gutterBottom:n,noWrap:r,paragraph:i,variant:o,classes:s}=t,a={root:["root",o,"inherit"!==t.align&&"align".concat((0,Dn.A)(e)),n&&"gutterBottom",r&&"noWrap",i&&"paragraph"]};return(0,Bn.A)(a,Nn,s)})(m);return(0,v.jsx)(zn,(0,f.A)({as:b,ref:e,ownerState:m,className:(0,wn.A)(y.root,s)},g))})),Wn=Gn;function Hn(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}var Jn=n(3290),Kn=n(7266);function Xn(t){return(0,Fn.Ay)("MuiLinearProgress",t)}(0,Tn.A)("MuiLinearProgress",["root","colorPrimary","colorSecondary","determinate","indeterminate","buffer","query","dashed","dashedColorPrimary","dashedColorSecondary","bar","barColorPrimary","barColorSecondary","bar1Indeterminate","bar1Determinate","bar1Buffer","bar2Indeterminate","bar2Buffer"]);var qn,Yn,Qn,Zn,$n,tr;const er=["className","color","value","valueBuffer","variant"];let nr,rr,ir,or,sr,ar;const lr=(0,Jn.i7)(nr||(nr=qn||(qn=Hn(["\n 0% {\n left: -35%;\n right: 100%;\n }\n\n 60% {\n left: 100%;\n right: -90%;\n }\n\n 100% {\n left: 100%;\n right: -90%;\n }\n"])))),cr=(0,Jn.i7)(rr||(rr=Yn||(Yn=Hn(["\n 0% {\n left: -200%;\n right: 100%;\n }\n\n 60% {\n left: 107%;\n right: -8%;\n }\n\n 100% {\n left: 107%;\n right: -8%;\n }\n"])))),ur=(0,Jn.i7)(ir||(ir=Qn||(Qn=Hn(["\n 0% {\n opacity: 1;\n background-position: 0 -23px;\n }\n\n 60% {\n opacity: 0;\n background-position: 0 -23px;\n }\n\n 100% {\n opacity: 1;\n background-position: -200px -23px;\n }\n"])))),dr=(t,e)=>"inherit"===e?"currentColor":t.vars?t.vars.palette.LinearProgress["".concat(e,"Bg")]:"light"===t.palette.mode?(0,Kn.a)(t.palette[e].main,.62):(0,Kn.e$)(t.palette[e].main,.5),hr=(0,Ln.Ay)("span",{name:"MuiLinearProgress",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,e["color".concat((0,Dn.A)(n.color))],e[n.variant]]}})((t=>{let{ownerState:e,theme:n}=t;return(0,f.A)({position:"relative",overflow:"hidden",display:"block",height:4,zIndex:0,"@media print":{colorAdjust:"exact"},backgroundColor:dr(n,e.color)},"inherit"===e.color&&"buffer"!==e.variant&&{backgroundColor:"none","&::before":{content:'""',position:"absolute",left:0,top:0,right:0,bottom:0,backgroundColor:"currentColor",opacity:.3}},"buffer"===e.variant&&{backgroundColor:"transparent"},"query"===e.variant&&{transform:"rotate(180deg)"})})),fr=(0,Ln.Ay)("span",{name:"MuiLinearProgress",slot:"Dashed",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.dashed,e["dashedColor".concat((0,Dn.A)(n.color))]]}})((t=>{let{ownerState:e,theme:n}=t;const r=dr(n,e.color);return(0,f.A)({position:"absolute",marginTop:0,height:"100%",width:"100%"},"inherit"===e.color&&{opacity:.3},{backgroundImage:"radial-gradient(".concat(r," 0%, ").concat(r," 16%, transparent 42%)"),backgroundSize:"10px 10px",backgroundPosition:"0 -23px"})}),(0,Jn.AH)(or||(or=Zn||(Zn=Hn(["\n animation: "," 3s infinite linear;\n "]))),ur)),pr=(0,Ln.Ay)("span",{name:"MuiLinearProgress",slot:"Bar1",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.bar,e["barColor".concat((0,Dn.A)(n.color))],("indeterminate"===n.variant||"query"===n.variant)&&e.bar1Indeterminate,"determinate"===n.variant&&e.bar1Determinate,"buffer"===n.variant&&e.bar1Buffer]}})((t=>{let{ownerState:e,theme:n}=t;return(0,f.A)({width:"100%",position:"absolute",left:0,bottom:0,top:0,transition:"transform 0.2s linear",transformOrigin:"left",backgroundColor:"inherit"===e.color?"currentColor":(n.vars||n).palette[e.color].main},"determinate"===e.variant&&{transition:"transform .".concat(4,"s linear")},"buffer"===e.variant&&{zIndex:1,transition:"transform .".concat(4,"s linear")})}),(t=>{let{ownerState:e}=t;return("indeterminate"===e.variant||"query"===e.variant)&&(0,Jn.AH)(sr||(sr=$n||($n=Hn(["\n width: auto;\n animation: "," 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite;\n "]))),lr)})),gr=(0,Ln.Ay)("span",{name:"MuiLinearProgress",slot:"Bar2",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.bar,e["barColor".concat((0,Dn.A)(n.color))],("indeterminate"===n.variant||"query"===n.variant)&&e.bar2Indeterminate,"buffer"===n.variant&&e.bar2Buffer]}})((t=>{let{ownerState:e,theme:n}=t;return(0,f.A)({width:"100%",position:"absolute",left:0,bottom:0,top:0,transition:"transform 0.2s linear",transformOrigin:"left"},"buffer"!==e.variant&&{backgroundColor:"inherit"===e.color?"currentColor":(n.vars||n).palette[e.color].main},"inherit"===e.color&&{opacity:.3},"buffer"===e.variant&&{backgroundColor:dr(n,e.color),transition:"transform .".concat(4,"s linear")})}),(t=>{let{ownerState:e}=t;return("indeterminate"===e.variant||"query"===e.variant)&&(0,Jn.AH)(ar||(ar=tr||(tr=Hn(["\n width: auto;\n animation: "," 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) 1.15s infinite;\n "]))),cr)})),mr=h.forwardRef((function(t,e){const n=(0,p.A)({props:t,name:"MuiLinearProgress"}),{className:r,color:i="primary",value:o,valueBuffer:s,variant:a="indeterminate"}=n,l=(0,C.A)(n,er),c=(0,f.A)({},n,{color:i,variant:a}),u=(t=>{const{classes:e,variant:n,color:r}=t,i={root:["root","color".concat((0,Dn.A)(r)),n],dashed:["dashed","dashedColor".concat((0,Dn.A)(r))],bar1:["bar","barColor".concat((0,Dn.A)(r)),("indeterminate"===n||"query"===n)&&"bar1Indeterminate","determinate"===n&&"bar1Determinate","buffer"===n&&"bar1Buffer"],bar2:["bar","buffer"!==n&&"barColor".concat((0,Dn.A)(r)),"buffer"===n&&"color".concat((0,Dn.A)(r)),("indeterminate"===n||"query"===n)&&"bar2Indeterminate","buffer"===n&&"bar2Buffer"]};return(0,Bn.A)(i,Xn,e)})(c),d=B(),h={},g={bar1:{},bar2:{}};if("determinate"===a||"buffer"===a)if(void 0!==o){h["aria-valuenow"]=Math.round(o),h["aria-valuemin"]=0,h["aria-valuemax"]=100;let t=o-100;d&&(t=-t),g.bar1.transform="translateX(".concat(t,"%)")}else 0;if("buffer"===a)if(void 0!==s){let t=(s||0)-100;d&&(t=-t),g.bar2.transform="translateX(".concat(t,"%)")}else 0;return(0,v.jsxs)(hr,(0,f.A)({className:(0,wn.A)(u.root,r),ownerState:c,role:"progressbar"},h,{ref:e},l,{children:["buffer"===a?(0,v.jsx)(fr,{className:u.dashed,ownerState:c}):null,(0,v.jsx)(pr,{className:u.bar1,ownerState:c,style:g.bar1}),"determinate"===a?null:(0,v.jsx)(gr,{className:u.bar2,ownerState:c,style:g.bar2})]}))})),vr=mr,br=t=>{let{loadingModules:e,barHeight:n}=t;const r=n||2;return(0,v.jsx)(v.Fragment,{children:e.map(((t,e)=>{const n=10+e*r*10;return(0,v.jsxs)(In,{sx:{bottom:"".concat(n,"px"),width:"15vw",zIndex:999,position:"fixed",left:"1vw"},children:[(0,v.jsxs)(Wn,{variant:"caption",color:"secondary",style:{marginRight:"1vw"},children:[t,"..."]}),(0,v.jsx)(vr,{sx:{height:r},color:"secondary"})]},"box_"+t)}))})},yr=t=>{const e=ut(),n=et((t=>t.cityIOdataState.cityIOdata)),{tableName:r}=t,i=bn.cityIO.cityIOmodules.map((t=>t.name)),[o,s]=(0,h.useState)([]),{sendJsonMessage:a,lastJsonMessage:l,readyState:c}=(0,_n.Ay)(bn.cityIO.websocketURL,{share:!0,shouldReconnect:()=>!0});return(0,h.useEffect)((()=>{console.log("Connection state changed"),c===_n.vj.OPEN&&(a({type:"LISTEN",content:{gridId:r}}),s(["Loading ".concat(r," data.")]))}),[c]),(0,h.useEffect)((()=>{if(null==l)return;console.log("Got a new message: ".concat(JSON.stringify(l)));let t=l.type;if("TABLE_SNAPSHOT"===t){console.log(" --- trying to update GEOGRID --- ".concat(JSON.stringify(l.content))),s([]);let t={...n,GEOGRID:l.content.GEOGRID,GEOGRIDDATA:l.content.GEOGRIDDATA,tableName:r};Object.keys(l.content).forEach((e=>{i.includes(e)&&"scenarios"!==e&&"indicators"!==e?t[e]=l.content[e]:"LAYERS"===e?t={...t,layers:l.content[e]}:"NUMERICINDICATORS"===e&&(t={...t,indicators:l.content[e]})})),a({type:"REQUEST_CORE_MODULES_LIST",content:{}}),a({type:"LIST_SCENARIOS",content:{}}),e(cn(t)),console.log("%c --- done updating from cityIO ---","color: rgb(0, 255, 0)"),e(un(!0))}else if("GEOGRIDDATA_UPDATE"===t){console.log(" --- trying to update GEOGRIDDATA --- ".concat(JSON.stringify(l.content)));let t={...n,GEOGRIDDATA:l.content};e(cn(t)),console.log("%c --- done updating from cityIO ---","color: rgb(0, 255, 0)"),e(un(!0))}else if("MODULE"===t){console.log(" --- trying to update MODULE data --- ".concat(JSON.stringify(l.content)));let t={...n};if("numeric"in l.content.moduleData){var o=[],c=[];l.content.moduleData.numeric.forEach((t=>{c.push(t),o.push(t.name)}));const e=t.indicators;e&&e.forEach((t=>{o.includes(t.name)||c.push(t)})),t={...t,indicators:c}}if("layers"in l.content.moduleData){var u=[],d=[];l.content.moduleData.layers.forEach((t=>{d.push(t),u.push(t.id)}));const e=t.layers;e&&e.forEach((t=>{u.includes(t.id)||d.push(t)})),t={...t,layers:d}}e(cn(t)),console.log("%c --- done updating from cityIO ---","color: rgb(0, 255, 0)"),e(un(!0))}else if("CORE_MODULES_LIST"===t){console.log(" --- trying to update CORE_MODULES_LIST --- ".concat(JSON.stringify(l.content)));let t={...n,core_modules:l.content};e(cn(t)),console.log("%c --- done updating from cityIO ---","color: rgb(0, 255, 0)"),e(un(!0))}else if("SCENARIOS"===t){console.log(" --- trying to update SCENARIOS --- ".concat(JSON.stringify(l.content)));let t={...n,scenarios:l.content};e(cn(t)),console.log("%c --- done updating from cityIO ---","color: rgb(0, 255, 0)"),e(un(!0))}}),[l]),(0,v.jsx)(br,{loadingModules:o})};var xr=n(9751);function Ar(){const t=(0,m.A)(y.A);return t[x.A]||t}const _r=h.createContext();function wr(t){return(0,Fn.Ay)("MuiGrid",t)}const Sr=["auto",!0,1,2,3,4,5,6,7,8,9,10,11,12],Cr=(0,Tn.A)("MuiGrid",["root","container","item","zeroMinWidth",...[0,1,2,3,4,5,6,7,8,9,10].map((t=>"spacing-xs-".concat(t))),...["column-reverse","column","row-reverse","row"].map((t=>"direction-xs-".concat(t))),...["nowrap","wrap-reverse","wrap"].map((t=>"wrap-xs-".concat(t))),...Sr.map((t=>"grid-xs-".concat(t))),...Sr.map((t=>"grid-sm-".concat(t))),...Sr.map((t=>"grid-md-".concat(t))),...Sr.map((t=>"grid-lg-".concat(t))),...Sr.map((t=>"grid-xl-".concat(t)))]),Er=Cr,Pr=["className","columns","columnSpacing","component","container","direction","item","rowSpacing","spacing","wrap","zeroMinWidth"];function Mr(t){const e=parseFloat(t);return"".concat(e).concat(String(t).replace(String(e),"")||"px")}function Tr(t){let{breakpoints:e,values:n}=t,r="";Object.keys(n).forEach((t=>{""===r&&0!==n[t]&&(r=t)}));const i=Object.keys(e).sort(((t,n)=>e[t]-e[n]));return i.slice(0,i.indexOf(r))}const Or=(0,Ln.Ay)("div",{name:"MuiGrid",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t,{container:r,direction:i,item:o,spacing:s,wrap:a,zeroMinWidth:l,breakpoints:c}=n;let u=[];r&&(u=function(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t||t<=0)return[];if("string"===typeof t&&!Number.isNaN(Number(t))||"number"===typeof t)return[n["spacing-xs-".concat(String(t))]];const r=[];return e.forEach((e=>{const i=t[e];Number(i)>0&&r.push(n["spacing-".concat(e,"-").concat(String(i))])})),r}(s,c,e));const d=[];return c.forEach((t=>{const r=n[t];r&&d.push(e["grid-".concat(t,"-").concat(String(r))])})),[e.root,r&&e.container,o&&e.item,l&&e.zeroMinWidth,...u,"row"!==i&&e["direction-xs-".concat(String(i))],"wrap"!==a&&e["wrap-xs-".concat(String(a))],...d]}})((t=>{let{ownerState:e}=t;return(0,f.A)({boxSizing:"border-box"},e.container&&{display:"flex",flexWrap:"wrap",width:"100%"},e.item&&{margin:0},e.zeroMinWidth&&{minWidth:0},"wrap"!==e.wrap&&{flexWrap:e.wrap})}),(function(t){let{theme:e,ownerState:n}=t;const r=(0,xr.kW)({values:n.direction,breakpoints:e.breakpoints.values});return(0,xr.NI)({theme:e},r,(t=>{const e={flexDirection:t};return 0===t.indexOf("column")&&(e["& > .".concat(Er.item)]={maxWidth:"none"}),e}))}),(function(t){let{theme:e,ownerState:n}=t;const{container:r,rowSpacing:i}=n;let o={};if(r&&0!==i){const t=(0,xr.kW)({values:i,breakpoints:e.breakpoints.values});let n;"object"===typeof t&&(n=Tr({breakpoints:e.breakpoints.values,values:t})),o=(0,xr.NI)({theme:e},t,((t,r)=>{var i;const o=e.spacing(t);return"0px"!==o?{marginTop:"-".concat(Mr(o)),["& > .".concat(Er.item)]:{paddingTop:Mr(o)}}:null!=(i=n)&&i.includes(r)?{}:{marginTop:0,["& > .".concat(Er.item)]:{paddingTop:0}}}))}return o}),(function(t){let{theme:e,ownerState:n}=t;const{container:r,columnSpacing:i}=n;let o={};if(r&&0!==i){const t=(0,xr.kW)({values:i,breakpoints:e.breakpoints.values});let n;"object"===typeof t&&(n=Tr({breakpoints:e.breakpoints.values,values:t})),o=(0,xr.NI)({theme:e},t,((t,r)=>{var i;const o=e.spacing(t);return"0px"!==o?{width:"calc(100% + ".concat(Mr(o),")"),marginLeft:"-".concat(Mr(o)),["& > .".concat(Er.item)]:{paddingLeft:Mr(o)}}:null!=(i=n)&&i.includes(r)?{}:{width:"100%",marginLeft:0,["& > .".concat(Er.item)]:{paddingLeft:0}}}))}return o}),(function(t){let e,{theme:n,ownerState:r}=t;return n.breakpoints.keys.reduce(((t,i)=>{let o={};if(r[i]&&(e=r[i]),!e)return t;if(!0===e)o={flexBasis:0,flexGrow:1,maxWidth:"100%"};else if("auto"===e)o={flexBasis:"auto",flexGrow:0,flexShrink:0,maxWidth:"none",width:"auto"};else{const s=(0,xr.kW)({values:r.columns,breakpoints:n.breakpoints.values}),a="object"===typeof s?s[i]:s;if(void 0===a||null===a)return t;const l="".concat(Math.round(e/a*1e8)/1e6,"%");let c={};if(r.container&&r.item&&0!==r.columnSpacing){const t=n.spacing(r.columnSpacing);if("0px"!==t){const e="calc(".concat(l," + ").concat(Mr(t),")");c={flexBasis:e,maxWidth:e}}}o=(0,f.A)({flexBasis:l,flexGrow:0,maxWidth:l},c)}return 0===n.breakpoints.values[i]?Object.assign(t,o):t[n.breakpoints.up(i)]=o,t}),{})}));const kr=t=>{const{classes:e,container:n,direction:r,item:i,spacing:o,wrap:s,zeroMinWidth:a,breakpoints:l}=t;let c=[];n&&(c=function(t,e){if(!t||t<=0)return[];if("string"===typeof t&&!Number.isNaN(Number(t))||"number"===typeof t)return["spacing-xs-".concat(String(t))];const n=[];return e.forEach((e=>{const r=t[e];if(Number(r)>0){const t="spacing-".concat(e,"-").concat(String(r));n.push(t)}})),n}(o,l));const u=[];l.forEach((e=>{const n=t[e];n&&u.push("grid-".concat(e,"-").concat(String(n)))}));const d={root:["root",n&&"container",i&&"item",a&&"zeroMinWidth",...c,"row"!==r&&"direction-xs-".concat(String(r)),"wrap"!==s&&"wrap-xs-".concat(String(s)),...u]};return(0,Bn.A)(d,wr,e)},Rr=h.forwardRef((function(t,e){const n=(0,p.A)({props:t,name:"MuiGrid"}),{breakpoints:r}=Ar(),i=(0,En.A)(n),{className:o,columns:s,columnSpacing:a,component:l="div",container:c=!1,direction:u="row",item:d=!1,rowSpacing:g,spacing:m=0,wrap:b="wrap",zeroMinWidth:y=!1}=i,x=(0,C.A)(i,Pr),A=g||m,_=a||m,w=h.useContext(_r),S=c?s||12:w,E={},P=(0,f.A)({},x);r.keys.forEach((t=>{null!=x[t]&&(E[t]=x[t],delete P[t])}));const M=(0,f.A)({},i,{columns:S,container:c,direction:u,item:d,rowSpacing:A,columnSpacing:_,wrap:b,zeroMinWidth:y,spacing:m},E,{breakpoints:r.keys}),T=kr(M);return(0,v.jsx)(_r.Provider,{value:S,children:(0,v.jsx)(Or,(0,f.A)({ownerState:M,className:(0,wn.A)(T.root,o),as:l,ref:e},P))})}));const Ir=Rr;function Br(t){return"string"===typeof t}var Lr=n(5849),Dr=n(3319),Fr=n(7844);function Nr(t,e){return Nr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Nr(t,e)}function jr(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,Nr(t,e)}const zr=h.createContext(null);function Ur(t,e){var n=Object.create(null);return t&&h.Children.map(t,(function(t){return t})).forEach((function(t){n[t.key]=function(t){return e&&(0,h.isValidElement)(t)?e(t):t}(t)})),n}function Vr(t,e,n){return null!=n[e]?n[e]:t.props[e]}function Gr(t,e,n){var r=Ur(t.children),i=function(t,e){function n(n){return n in e?e[n]:t[n]}t=t||{},e=e||{};var r,i=Object.create(null),o=[];for(var s in t)s in e?o.length&&(i[s]=o,o=[]):o.push(s);var a={};for(var l in e){if(i[l])for(r=0;r{if(!a&&null!=l){const t=setTimeout(l,c);return()=>{clearTimeout(t)}}}),[l,a,c]),(0,v.jsx)("span",{className:f,style:p,children:(0,v.jsx)("span",{className:g})})};const qr=(0,Tn.A)("MuiTouchRipple",["root","ripple","rippleVisible","ripplePulsate","child","childLeaving","childPulsate"]);var Yr,Qr,Zr,$r;const ti=["center","classes","className"];let ei,ni,ri,ii;const oi=(0,Jn.i7)(ei||(ei=Yr||(Yr=Hn(["\n 0% {\n transform: scale(0);\n opacity: 0.1;\n }\n\n 100% {\n transform: scale(1);\n opacity: 0.3;\n }\n"])))),si=(0,Jn.i7)(ni||(ni=Qr||(Qr=Hn(["\n 0% {\n opacity: 1;\n }\n\n 100% {\n opacity: 0;\n }\n"])))),ai=(0,Jn.i7)(ri||(ri=Zr||(Zr=Hn(["\n 0% {\n transform: scale(1);\n }\n\n 50% {\n transform: scale(0.92);\n }\n\n 100% {\n transform: scale(1);\n }\n"])))),li=(0,Ln.Ay)("span",{name:"MuiTouchRipple",slot:"Root"})({overflow:"hidden",pointerEvents:"none",position:"absolute",zIndex:0,top:0,right:0,bottom:0,left:0,borderRadius:"inherit"}),ci=(0,Ln.Ay)(Xr,{name:"MuiTouchRipple",slot:"Ripple"})(ii||(ii=$r||($r=Hn(["\n opacity: 0;\n position: absolute;\n\n &."," {\n opacity: 0.3;\n transform: scale(1);\n animation-name: ",";\n animation-duration: ","ms;\n animation-timing-function: ",";\n }\n\n &."," {\n animation-duration: ","ms;\n }\n\n & ."," {\n opacity: 1;\n display: block;\n width: 100%;\n height: 100%;\n border-radius: 50%;\n background-color: currentColor;\n }\n\n & ."," {\n opacity: 0;\n animation-name: ",";\n animation-duration: ","ms;\n animation-timing-function: ",";\n }\n\n & ."," {\n position: absolute;\n /* @noflip */\n left: 0px;\n top: 0;\n animation-name: ",";\n animation-duration: 2500ms;\n animation-timing-function: ",";\n animation-iteration-count: infinite;\n animation-delay: 200ms;\n }\n"]))),qr.rippleVisible,oi,550,(t=>{let{theme:e}=t;return e.transitions.easing.easeInOut}),qr.ripplePulsate,(t=>{let{theme:e}=t;return e.transitions.duration.shorter}),qr.child,qr.childLeaving,si,550,(t=>{let{theme:e}=t;return e.transitions.easing.easeInOut}),qr.childPulsate,ai,(t=>{let{theme:e}=t;return e.transitions.easing.easeInOut})),ui=h.forwardRef((function(t,e){const n=(0,p.A)({props:t,name:"MuiTouchRipple"}),{center:r=!1,classes:i={},className:o}=n,s=(0,C.A)(n,ti),[a,l]=h.useState([]),c=h.useRef(0),u=h.useRef(null);h.useEffect((()=>{u.current&&(u.current(),u.current=null)}),[a]);const d=h.useRef(!1),g=(0,Kr.A)(),m=h.useRef(null),b=h.useRef(null),y=h.useCallback((t=>{const{pulsate:e,rippleX:n,rippleY:r,rippleSize:o,cb:s}=t;l((t=>[...t,(0,v.jsx)(ci,{classes:{ripple:(0,wn.A)(i.ripple,qr.ripple),rippleVisible:(0,wn.A)(i.rippleVisible,qr.rippleVisible),ripplePulsate:(0,wn.A)(i.ripplePulsate,qr.ripplePulsate),child:(0,wn.A)(i.child,qr.child),childLeaving:(0,wn.A)(i.childLeaving,qr.childLeaving),childPulsate:(0,wn.A)(i.childPulsate,qr.childPulsate)},timeout:550,pulsate:e,rippleX:n,rippleY:r,rippleSize:o},c.current)])),c.current+=1,u.current=s}),[i]),x=h.useCallback((function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:()=>{};const{pulsate:i=!1,center:o=r||e.pulsate,fakeElement:s=!1}=e;if("mousedown"===(null==t?void 0:t.type)&&d.current)return void(d.current=!1);"touchstart"===(null==t?void 0:t.type)&&(d.current=!0);const a=s?null:b.current,l=a?a.getBoundingClientRect():{width:0,height:0,left:0,top:0};let c,u,h;if(o||void 0===t||0===t.clientX&&0===t.clientY||!t.clientX&&!t.touches)c=Math.round(l.width/2),u=Math.round(l.height/2);else{const{clientX:e,clientY:n}=t.touches&&t.touches.length>0?t.touches[0]:t;c=Math.round(e-l.left),u=Math.round(n-l.top)}if(o)h=Math.sqrt((2*l.width**2+l.height**2)/3),h%2===0&&(h+=1);else{const t=2*Math.max(Math.abs((a?a.clientWidth:0)-c),c)+2,e=2*Math.max(Math.abs((a?a.clientHeight:0)-u),u)+2;h=Math.sqrt(t**2+e**2)}null!=t&&t.touches?null===m.current&&(m.current=()=>{y({pulsate:i,rippleX:c,rippleY:u,rippleSize:h,cb:n})},g.start(80,(()=>{m.current&&(m.current(),m.current=null)}))):y({pulsate:i,rippleX:c,rippleY:u,rippleSize:h,cb:n})}),[r,y,g]),A=h.useCallback((()=>{x({},{pulsate:!0})}),[x]),_=h.useCallback(((t,e)=>{if(g.clear(),"touchend"===(null==t?void 0:t.type)&&m.current)return m.current(),m.current=null,void g.start(0,(()=>{_(t,e)}));m.current=null,l((t=>t.length>0?t.slice(1):t)),u.current=e}),[g]);return h.useImperativeHandle(e,(()=>({pulsate:A,start:x,stop:_})),[A,x,_]),(0,v.jsx)(li,(0,f.A)({className:(0,wn.A)(qr.root,i.root,o),ref:b},s,{children:(0,v.jsx)(Jr,{component:null,exit:!0,children:a})}))})),di=ui;function hi(t){return(0,Fn.Ay)("MuiButtonBase",t)}const fi=(0,Tn.A)("MuiButtonBase",["root","disabled","focusVisible"]),pi=["action","centerRipple","children","className","component","disabled","disableRipple","disableTouchRipple","focusRipple","focusVisibleClassName","LinkComponent","onBlur","onClick","onContextMenu","onDragLeave","onFocus","onFocusVisible","onKeyDown","onKeyUp","onMouseDown","onMouseLeave","onMouseUp","onTouchEnd","onTouchMove","onTouchStart","tabIndex","TouchRippleProps","touchRippleRef","type"],gi=(0,Ln.Ay)("button",{name:"MuiButtonBase",slot:"Root",overridesResolver:(t,e)=>e.root})({display:"inline-flex",alignItems:"center",justifyContent:"center",position:"relative",boxSizing:"border-box",WebkitTapHighlightColor:"transparent",backgroundColor:"transparent",outline:0,border:0,margin:0,borderRadius:0,padding:0,cursor:"pointer",userSelect:"none",verticalAlign:"middle",MozAppearance:"none",WebkitAppearance:"none",textDecoration:"none",color:"inherit","&::-moz-focus-inner":{borderStyle:"none"},["&.".concat(fi.disabled)]:{pointerEvents:"none",cursor:"default"},"@media print":{colorAdjust:"exact"}}),mi=h.forwardRef((function(t,e){const n=(0,p.A)({props:t,name:"MuiButtonBase"}),{action:r,centerRipple:i=!1,children:o,className:s,component:a="button",disabled:l=!1,disableRipple:c=!1,disableTouchRipple:u=!1,focusRipple:d=!1,LinkComponent:g="a",onBlur:m,onClick:b,onContextMenu:y,onDragLeave:x,onFocus:A,onFocusVisible:_,onKeyDown:w,onKeyUp:S,onMouseDown:E,onMouseLeave:P,onMouseUp:M,onTouchEnd:T,onTouchMove:O,onTouchStart:k,tabIndex:R=0,TouchRippleProps:I,touchRippleRef:B,type:L}=n,D=(0,C.A)(n,pi),F=h.useRef(null),N=h.useRef(null),j=(0,Lr.A)(N,B),{isFocusVisibleRef:z,onFocus:U,onBlur:V,ref:G}=(0,Fr.A)(),[W,H]=h.useState(!1);l&&W&&H(!1),h.useImperativeHandle(r,(()=>({focusVisible:()=>{H(!0),F.current.focus()}})),[]);const[J,K]=h.useState(!1);h.useEffect((()=>{K(!0)}),[]);const X=J&&!c&&!l;function q(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:u;return(0,Dr.A)((r=>{e&&e(r);return!n&&N.current&&N.current[t](r),!0}))}h.useEffect((()=>{W&&d&&!c&&J&&N.current.pulsate()}),[c,d,W,J]);const Y=q("start",E),Q=q("stop",y),Z=q("stop",x),$=q("stop",M),tt=q("stop",(t=>{W&&t.preventDefault(),P&&P(t)})),et=q("start",k),nt=q("stop",T),rt=q("stop",O),it=q("stop",(t=>{V(t),!1===z.current&&H(!1),m&&m(t)}),!1),ot=(0,Dr.A)((t=>{F.current||(F.current=t.currentTarget),U(t),!0===z.current&&(H(!0),_&&_(t)),A&&A(t)})),st=()=>{const t=F.current;return a&&"button"!==a&&!("A"===t.tagName&&t.href)},at=h.useRef(!1),lt=(0,Dr.A)((t=>{d&&!at.current&&W&&N.current&&" "===t.key&&(at.current=!0,N.current.stop(t,(()=>{N.current.start(t)}))),t.target===t.currentTarget&&st()&&" "===t.key&&t.preventDefault(),w&&w(t),t.target===t.currentTarget&&st()&&"Enter"===t.key&&!l&&(t.preventDefault(),b&&b(t))})),ct=(0,Dr.A)((t=>{d&&" "===t.key&&N.current&&W&&!t.defaultPrevented&&(at.current=!1,N.current.stop(t,(()=>{N.current.pulsate(t)}))),S&&S(t),b&&t.target===t.currentTarget&&st()&&" "===t.key&&!t.defaultPrevented&&b(t)}));let ut=a;"button"===ut&&(D.href||D.to)&&(ut=g);const dt={};"button"===ut?(dt.type=void 0===L?"button":L,dt.disabled=l):(D.href||D.to||(dt.role="button"),l&&(dt["aria-disabled"]=l));const ht=(0,Lr.A)(e,G,F);const ft=(0,f.A)({},n,{centerRipple:i,component:a,disabled:l,disableRipple:c,disableTouchRipple:u,focusRipple:d,tabIndex:R,focusVisible:W}),pt=(t=>{const{disabled:e,focusVisible:n,focusVisibleClassName:r,classes:i}=t,o={root:["root",e&&"disabled",n&&"focusVisible"]},s=(0,Bn.A)(o,hi,i);return n&&r&&(s.root+=" ".concat(r)),s})(ft);return(0,v.jsxs)(gi,(0,f.A)({as:ut,className:(0,wn.A)(pt.root,s),ownerState:ft,onBlur:it,onClick:b,onContextMenu:Q,onFocus:ot,onKeyDown:lt,onKeyUp:ct,onMouseDown:Y,onMouseLeave:tt,onMouseUp:$,onDragLeave:Z,onTouchEnd:nt,onTouchMove:rt,onTouchStart:et,ref:ht,tabIndex:l?-1:R,type:L},dt,D,{children:[o,X?(0,v.jsx)(di,(0,f.A)({ref:j,center:i},I)):null]}))}));var vi=n(154),bi=n(5013);const yi=h.createContext({});function xi(t){return(0,Fn.Ay)("MuiListItem",t)}const Ai=(0,Tn.A)("MuiListItem",["root","container","focusVisible","dense","alignItemsFlexStart","disabled","divider","gutters","padding","button","secondaryAction","selected"]);const _i=(0,Tn.A)("MuiListItemButton",["root","focusVisible","dense","alignItemsFlexStart","disabled","divider","gutters","selected"]);function wi(t){return(0,Fn.Ay)("MuiListItemSecondaryAction",t)}(0,Tn.A)("MuiListItemSecondaryAction",["root","disableGutters"]);const Si=["className"],Ci=(0,Ln.Ay)("div",{name:"MuiListItemSecondaryAction",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,n.disableGutters&&e.disableGutters]}})((t=>{let{ownerState:e}=t;return(0,f.A)({position:"absolute",right:16,top:"50%",transform:"translateY(-50%)"},e.disableGutters&&{right:0})})),Ei=h.forwardRef((function(t,e){const n=(0,p.A)({props:t,name:"MuiListItemSecondaryAction"}),{className:r}=n,i=(0,C.A)(n,Si),o=h.useContext(yi),s=(0,f.A)({},n,{disableGutters:o.disableGutters}),a=(t=>{const{disableGutters:e,classes:n}=t,r={root:["root",e&&"disableGutters"]};return(0,Bn.A)(r,wi,n)})(s);return(0,v.jsx)(Ci,(0,f.A)({className:(0,wn.A)(a.root,r),ownerState:s,ref:e},i))}));Ei.muiName="ListItemSecondaryAction";const Pi=Ei,Mi=["className"],Ti=["alignItems","autoFocus","button","children","className","component","components","componentsProps","ContainerComponent","ContainerProps","dense","disabled","disableGutters","disablePadding","divider","focusVisibleClassName","secondaryAction","selected","slotProps","slots"],Oi=(0,Ln.Ay)("div",{name:"MuiListItem",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,n.dense&&e.dense,"flex-start"===n.alignItems&&e.alignItemsFlexStart,n.divider&&e.divider,!n.disableGutters&&e.gutters,!n.disablePadding&&e.padding,n.button&&e.button,n.hasSecondaryAction&&e.secondaryAction]}})((t=>{let{theme:e,ownerState:n}=t;return(0,f.A)({display:"flex",justifyContent:"flex-start",alignItems:"center",position:"relative",textDecoration:"none",width:"100%",boxSizing:"border-box",textAlign:"left"},!n.disablePadding&&(0,f.A)({paddingTop:8,paddingBottom:8},n.dense&&{paddingTop:4,paddingBottom:4},!n.disableGutters&&{paddingLeft:16,paddingRight:16},!!n.secondaryAction&&{paddingRight:48}),!!n.secondaryAction&&{["& > .".concat(_i.root)]:{paddingRight:48}},{["&.".concat(Ai.focusVisible)]:{backgroundColor:(e.vars||e).palette.action.focus},["&.".concat(Ai.selected)]:{backgroundColor:e.vars?"rgba(".concat(e.vars.palette.primary.mainChannel," / ").concat(e.vars.palette.action.selectedOpacity,")"):(0,Kn.X4)(e.palette.primary.main,e.palette.action.selectedOpacity),["&.".concat(Ai.focusVisible)]:{backgroundColor:e.vars?"rgba(".concat(e.vars.palette.primary.mainChannel," / calc(").concat(e.vars.palette.action.selectedOpacity," + ").concat(e.vars.palette.action.focusOpacity,"))"):(0,Kn.X4)(e.palette.primary.main,e.palette.action.selectedOpacity+e.palette.action.focusOpacity)}},["&.".concat(Ai.disabled)]:{opacity:(e.vars||e).palette.action.disabledOpacity}},"flex-start"===n.alignItems&&{alignItems:"flex-start"},n.divider&&{borderBottom:"1px solid ".concat((e.vars||e).palette.divider),backgroundClip:"padding-box"},n.button&&{transition:e.transitions.create("background-color",{duration:e.transitions.duration.shortest}),"&:hover":{textDecoration:"none",backgroundColor:(e.vars||e).palette.action.hover,"@media (hover: none)":{backgroundColor:"transparent"}},["&.".concat(Ai.selected,":hover")]:{backgroundColor:e.vars?"rgba(".concat(e.vars.palette.primary.mainChannel," / calc(").concat(e.vars.palette.action.selectedOpacity," + ").concat(e.vars.palette.action.hoverOpacity,"))"):(0,Kn.X4)(e.palette.primary.main,e.palette.action.selectedOpacity+e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:e.vars?"rgba(".concat(e.vars.palette.primary.mainChannel," / ").concat(e.vars.palette.action.selectedOpacity,")"):(0,Kn.X4)(e.palette.primary.main,e.palette.action.selectedOpacity)}}},n.hasSecondaryAction&&{paddingRight:48})})),ki=(0,Ln.Ay)("li",{name:"MuiListItem",slot:"Container",overridesResolver:(t,e)=>e.container})({position:"relative"}),Ri=h.forwardRef((function(t,e){const n=(0,p.A)({props:t,name:"MuiListItem"}),{alignItems:r="center",autoFocus:i=!1,button:o=!1,children:s,className:a,component:l,components:c={},componentsProps:u={},ContainerComponent:d="li",ContainerProps:{className:g}={},dense:m=!1,disabled:b=!1,disableGutters:y=!1,disablePadding:x=!1,divider:A=!1,focusVisibleClassName:_,secondaryAction:w,selected:S=!1,slotProps:E={},slots:P={}}=n,M=(0,C.A)(n.ContainerProps,Mi),T=(0,C.A)(n,Ti),O=h.useContext(yi),k=h.useMemo((()=>({dense:m||O.dense||!1,alignItems:r,disableGutters:y})),[r,O.dense,m,y]),R=h.useRef(null);(0,bi.A)((()=>{i&&R.current&&R.current.focus()}),[i]);const I=h.Children.toArray(s),B=I.length&&(0,vi.A)(I[I.length-1],["ListItemSecondaryAction"]),L=(0,f.A)({},n,{alignItems:r,autoFocus:i,button:o,dense:k.dense,disabled:b,disableGutters:y,disablePadding:x,divider:A,hasSecondaryAction:B,selected:S}),D=(t=>{const{alignItems:e,button:n,classes:r,dense:i,disabled:o,disableGutters:s,disablePadding:a,divider:l,hasSecondaryAction:c,selected:u}=t,d={root:["root",i&&"dense",!s&&"gutters",!a&&"padding",l&&"divider",o&&"disabled",n&&"button","flex-start"===e&&"alignItemsFlexStart",c&&"secondaryAction",u&&"selected"],container:["container"]};return(0,Bn.A)(d,xi,r)})(L),F=(0,Lr.A)(R,e),N=P.root||c.Root||Oi,j=E.root||u.root||{},z=(0,f.A)({className:(0,wn.A)(D.root,j.className,a),disabled:b},T);let U=l||"li";return o&&(z.component=l||"div",z.focusVisibleClassName=(0,wn.A)(Ai.focusVisible,_),U=mi),B?(U=z.component||l?U:"div","li"===d&&("li"===U?U="div":"li"===z.component&&(z.component="div")),(0,v.jsx)(yi.Provider,{value:k,children:(0,v.jsxs)(ki,(0,f.A)({as:d,className:(0,wn.A)(D.container,g),ref:F,ownerState:L},M,{children:[(0,v.jsx)(N,(0,f.A)({},j,!Br(N)&&{as:U,ownerState:(0,f.A)({},L,j.ownerState)},z,{children:I})),I.pop()]}))})):(0,v.jsx)(yi.Provider,{value:k,children:(0,v.jsxs)(N,(0,f.A)({},j,{as:U,ref:F},!Br(N)&&{ownerState:(0,f.A)({},L,j.ownerState)},z,{children:[I,w&&(0,v.jsx)(Pi,{children:w})]}))})})),Ii=Ri;var Bi=n(2018),Li=n(1475);function Di(t){return(0,Fn.Ay)("MuiButton",t)}const Fi=(0,Tn.A)("MuiButton",["root","text","textInherit","textPrimary","textSecondary","textSuccess","textError","textInfo","textWarning","outlined","outlinedInherit","outlinedPrimary","outlinedSecondary","outlinedSuccess","outlinedError","outlinedInfo","outlinedWarning","contained","containedInherit","containedPrimary","containedSecondary","containedSuccess","containedError","containedInfo","containedWarning","disableElevation","focusVisible","disabled","colorInherit","colorPrimary","colorSecondary","colorSuccess","colorError","colorInfo","colorWarning","textSizeSmall","textSizeMedium","textSizeLarge","outlinedSizeSmall","outlinedSizeMedium","outlinedSizeLarge","containedSizeSmall","containedSizeMedium","containedSizeLarge","sizeMedium","sizeSmall","sizeLarge","fullWidth","startIcon","endIcon","icon","iconSizeSmall","iconSizeMedium","iconSizeLarge"]);const Ni=h.createContext({});const ji=h.createContext(void 0),zi=["children","color","component","className","disabled","disableElevation","disableFocusRipple","endIcon","focusVisibleClassName","fullWidth","size","startIcon","type","variant"],Ui=t=>(0,f.A)({},"small"===t.size&&{"& > *:nth-of-type(1)":{fontSize:18}},"medium"===t.size&&{"& > *:nth-of-type(1)":{fontSize:20}},"large"===t.size&&{"& > *:nth-of-type(1)":{fontSize:22}}),Vi=(0,Ln.Ay)(mi,{shouldForwardProp:t=>(0,Li.A)(t)||"classes"===t,name:"MuiButton",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,e[n.variant],e["".concat(n.variant).concat((0,Dn.A)(n.color))],e["size".concat((0,Dn.A)(n.size))],e["".concat(n.variant,"Size").concat((0,Dn.A)(n.size))],"inherit"===n.color&&e.colorInherit,n.disableElevation&&e.disableElevation,n.fullWidth&&e.fullWidth]}})((t=>{let{theme:e,ownerState:n}=t;var r,i;const o="light"===e.palette.mode?e.palette.grey[300]:e.palette.grey[800],s="light"===e.palette.mode?e.palette.grey.A100:e.palette.grey[700];return(0,f.A)({},e.typography.button,{minWidth:64,padding:"6px 16px",borderRadius:(e.vars||e).shape.borderRadius,transition:e.transitions.create(["background-color","box-shadow","border-color","color"],{duration:e.transitions.duration.short}),"&:hover":(0,f.A)({textDecoration:"none",backgroundColor:e.vars?"rgba(".concat(e.vars.palette.text.primaryChannel," / ").concat(e.vars.palette.action.hoverOpacity,")"):(0,Kn.X4)(e.palette.text.primary,e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},"text"===n.variant&&"inherit"!==n.color&&{backgroundColor:e.vars?"rgba(".concat(e.vars.palette[n.color].mainChannel," / ").concat(e.vars.palette.action.hoverOpacity,")"):(0,Kn.X4)(e.palette[n.color].main,e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},"outlined"===n.variant&&"inherit"!==n.color&&{border:"1px solid ".concat((e.vars||e).palette[n.color].main),backgroundColor:e.vars?"rgba(".concat(e.vars.palette[n.color].mainChannel," / ").concat(e.vars.palette.action.hoverOpacity,")"):(0,Kn.X4)(e.palette[n.color].main,e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},"contained"===n.variant&&{backgroundColor:e.vars?e.vars.palette.Button.inheritContainedHoverBg:s,boxShadow:(e.vars||e).shadows[4],"@media (hover: none)":{boxShadow:(e.vars||e).shadows[2],backgroundColor:(e.vars||e).palette.grey[300]}},"contained"===n.variant&&"inherit"!==n.color&&{backgroundColor:(e.vars||e).palette[n.color].dark,"@media (hover: none)":{backgroundColor:(e.vars||e).palette[n.color].main}}),"&:active":(0,f.A)({},"contained"===n.variant&&{boxShadow:(e.vars||e).shadows[8]}),["&.".concat(Fi.focusVisible)]:(0,f.A)({},"contained"===n.variant&&{boxShadow:(e.vars||e).shadows[6]}),["&.".concat(Fi.disabled)]:(0,f.A)({color:(e.vars||e).palette.action.disabled},"outlined"===n.variant&&{border:"1px solid ".concat((e.vars||e).palette.action.disabledBackground)},"contained"===n.variant&&{color:(e.vars||e).palette.action.disabled,boxShadow:(e.vars||e).shadows[0],backgroundColor:(e.vars||e).palette.action.disabledBackground})},"text"===n.variant&&{padding:"6px 8px"},"text"===n.variant&&"inherit"!==n.color&&{color:(e.vars||e).palette[n.color].main},"outlined"===n.variant&&{padding:"5px 15px",border:"1px solid currentColor"},"outlined"===n.variant&&"inherit"!==n.color&&{color:(e.vars||e).palette[n.color].main,border:e.vars?"1px solid rgba(".concat(e.vars.palette[n.color].mainChannel," / 0.5)"):"1px solid ".concat((0,Kn.X4)(e.palette[n.color].main,.5))},"contained"===n.variant&&{color:e.vars?e.vars.palette.text.primary:null==(r=(i=e.palette).getContrastText)?void 0:r.call(i,e.palette.grey[300]),backgroundColor:e.vars?e.vars.palette.Button.inheritContainedBg:o,boxShadow:(e.vars||e).shadows[2]},"contained"===n.variant&&"inherit"!==n.color&&{color:(e.vars||e).palette[n.color].contrastText,backgroundColor:(e.vars||e).palette[n.color].main},"inherit"===n.color&&{color:"inherit",borderColor:"currentColor"},"small"===n.size&&"text"===n.variant&&{padding:"4px 5px",fontSize:e.typography.pxToRem(13)},"large"===n.size&&"text"===n.variant&&{padding:"8px 11px",fontSize:e.typography.pxToRem(15)},"small"===n.size&&"outlined"===n.variant&&{padding:"3px 9px",fontSize:e.typography.pxToRem(13)},"large"===n.size&&"outlined"===n.variant&&{padding:"7px 21px",fontSize:e.typography.pxToRem(15)},"small"===n.size&&"contained"===n.variant&&{padding:"4px 10px",fontSize:e.typography.pxToRem(13)},"large"===n.size&&"contained"===n.variant&&{padding:"8px 22px",fontSize:e.typography.pxToRem(15)},n.fullWidth&&{width:"100%"})}),(t=>{let{ownerState:e}=t;return e.disableElevation&&{boxShadow:"none","&:hover":{boxShadow:"none"},["&.".concat(Fi.focusVisible)]:{boxShadow:"none"},"&:active":{boxShadow:"none"},["&.".concat(Fi.disabled)]:{boxShadow:"none"}}})),Gi=(0,Ln.Ay)("span",{name:"MuiButton",slot:"StartIcon",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.startIcon,e["iconSize".concat((0,Dn.A)(n.size))]]}})((t=>{let{ownerState:e}=t;return(0,f.A)({display:"inherit",marginRight:8,marginLeft:-4},"small"===e.size&&{marginLeft:-2},Ui(e))})),Wi=(0,Ln.Ay)("span",{name:"MuiButton",slot:"EndIcon",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.endIcon,e["iconSize".concat((0,Dn.A)(n.size))]]}})((t=>{let{ownerState:e}=t;return(0,f.A)({display:"inherit",marginRight:-4,marginLeft:8},"small"===e.size&&{marginRight:-2},Ui(e))})),Hi=h.forwardRef((function(t,e){const n=h.useContext(Ni),r=h.useContext(ji),i=(0,Bi.A)(n,t),o=(0,p.A)({props:i,name:"MuiButton"}),{children:s,color:a="primary",component:l="button",className:c,disabled:u=!1,disableElevation:d=!1,disableFocusRipple:g=!1,endIcon:m,focusVisibleClassName:b,fullWidth:y=!1,size:x="medium",startIcon:A,type:_,variant:w="text"}=o,S=(0,C.A)(o,zi),E=(0,f.A)({},o,{color:a,component:l,disabled:u,disableElevation:d,disableFocusRipple:g,fullWidth:y,size:x,type:_,variant:w}),P=(t=>{const{color:e,disableElevation:n,fullWidth:r,size:i,variant:o,classes:s}=t,a={root:["root",o,"".concat(o).concat((0,Dn.A)(e)),"size".concat((0,Dn.A)(i)),"".concat(o,"Size").concat((0,Dn.A)(i)),"color".concat((0,Dn.A)(e)),n&&"disableElevation",r&&"fullWidth"],label:["label"],startIcon:["icon","startIcon","iconSize".concat((0,Dn.A)(i))],endIcon:["icon","endIcon","iconSize".concat((0,Dn.A)(i))]},l=(0,Bn.A)(a,Di,s);return(0,f.A)({},s,l)})(E),M=A&&(0,v.jsx)(Gi,{className:P.startIcon,ownerState:E,children:A}),T=m&&(0,v.jsx)(Wi,{className:P.endIcon,ownerState:E,children:m}),O=r||"";return(0,v.jsxs)(Vi,(0,f.A)({ownerState:E,className:(0,wn.A)(n.className,P.root,c,O),component:l,disabled:u,focusRipple:!g,focusVisibleClassName:(0,wn.A)(P.focusVisible,b),ref:e,type:_},S,{classes:P,children:[M,s,T]}))})),Ji=Hi,Ki=t=>{let e;return e=t<1?5.11916*t**2:4.5*Math.log(t+1)+2,(e/100).toFixed(2)};function Xi(t){return(0,Fn.Ay)("MuiPaper",t)}(0,Tn.A)("MuiPaper",["root","rounded","outlined","elevation","elevation0","elevation1","elevation2","elevation3","elevation4","elevation5","elevation6","elevation7","elevation8","elevation9","elevation10","elevation11","elevation12","elevation13","elevation14","elevation15","elevation16","elevation17","elevation18","elevation19","elevation20","elevation21","elevation22","elevation23","elevation24"]);const qi=["className","component","elevation","square","variant"],Yi=(0,Ln.Ay)("div",{name:"MuiPaper",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,e[n.variant],!n.square&&e.rounded,"elevation"===n.variant&&e["elevation".concat(n.elevation)]]}})((t=>{let{theme:e,ownerState:n}=t;var r;return(0,f.A)({backgroundColor:(e.vars||e).palette.background.paper,color:(e.vars||e).palette.text.primary,transition:e.transitions.create("box-shadow")},!n.square&&{borderRadius:e.shape.borderRadius},"outlined"===n.variant&&{border:"1px solid ".concat((e.vars||e).palette.divider)},"elevation"===n.variant&&(0,f.A)({boxShadow:(e.vars||e).shadows[n.elevation]},!e.vars&&"dark"===e.palette.mode&&{backgroundImage:"linear-gradient(".concat((0,Kn.X4)("#fff",Ki(n.elevation)),", ").concat((0,Kn.X4)("#fff",Ki(n.elevation)),")")},e.vars&&{backgroundImage:null==(r=e.vars.overlays)?void 0:r[n.elevation]}))})),Qi=h.forwardRef((function(t,e){const n=(0,p.A)({props:t,name:"MuiPaper"}),{className:r,component:i="div",elevation:o=1,square:s=!1,variant:a="elevation"}=n,l=(0,C.A)(n,qi),c=(0,f.A)({},n,{component:i,elevation:o,square:s,variant:a}),u=(t=>{const{square:e,elevation:n,variant:r,classes:i}=t,o={root:["root",r,!e&&"rounded","elevation"===r&&"elevation".concat(n)]};return(0,Bn.A)(o,Xi,i)})(c);return(0,v.jsx)(Yi,(0,f.A)({as:i,ownerState:c,className:(0,wn.A)(u.root,r),ref:e},l))}));function Zi(t){return(0,Fn.Ay)("MuiCard",t)}(0,Tn.A)("MuiCard",["root"]);const $i=["className","raised"],to=(0,Ln.Ay)(Qi,{name:"MuiCard",slot:"Root",overridesResolver:(t,e)=>e.root})((()=>({overflow:"hidden"}))),eo=h.forwardRef((function(t,e){const n=(0,p.A)({props:t,name:"MuiCard"}),{className:r,raised:i=!1}=n,o=(0,C.A)(n,$i),s=(0,f.A)({},n,{raised:i}),a=(t=>{const{classes:e}=t;return(0,Bn.A)({root:["root"]},Zi,e)})(s);return(0,v.jsx)(to,(0,f.A)({className:(0,wn.A)(a.root,r),elevation:i?8:void 0,ref:e,ownerState:s},o))}));function no(t){return(0,Fn.Ay)("MuiCardContent",t)}(0,Tn.A)("MuiCardContent",["root"]);const ro=["className","component"],io=(0,Ln.Ay)("div",{name:"MuiCardContent",slot:"Root",overridesResolver:(t,e)=>e.root})((()=>({padding:16,"&:last-child":{paddingBottom:24}}))),oo=h.forwardRef((function(t,e){const n=(0,p.A)({props:t,name:"MuiCardContent"}),{className:r,component:i="div"}=n,o=(0,C.A)(n,ro),s=(0,f.A)({},n,{component:i}),a=(t=>{const{classes:e}=t;return(0,Bn.A)({root:["root"]},no,e)})(s);return(0,v.jsx)(io,(0,f.A)({as:i,className:(0,wn.A)(a.root,r),ownerState:s,ref:e},o))}));function so(t){return(0,Fn.Ay)("MuiDivider",t)}(0,Tn.A)("MuiDivider",["root","absolute","fullWidth","inset","middle","flexItem","light","vertical","withChildren","withChildrenVertical","textAlignRight","textAlignLeft","wrapper","wrapperVertical"]);const ao=["absolute","children","className","component","flexItem","light","orientation","role","textAlign","variant"],lo=(0,Ln.Ay)("div",{name:"MuiDivider",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,n.absolute&&e.absolute,e[n.variant],n.light&&e.light,"vertical"===n.orientation&&e.vertical,n.flexItem&&e.flexItem,n.children&&e.withChildren,n.children&&"vertical"===n.orientation&&e.withChildrenVertical,"right"===n.textAlign&&"vertical"!==n.orientation&&e.textAlignRight,"left"===n.textAlign&&"vertical"!==n.orientation&&e.textAlignLeft]}})((t=>{let{theme:e,ownerState:n}=t;return(0,f.A)({margin:0,flexShrink:0,borderWidth:0,borderStyle:"solid",borderColor:(e.vars||e).palette.divider,borderBottomWidth:"thin"},n.absolute&&{position:"absolute",bottom:0,left:0,width:"100%"},n.light&&{borderColor:e.vars?"rgba(".concat(e.vars.palette.dividerChannel," / 0.08)"):(0,Kn.X4)(e.palette.divider,.08)},"inset"===n.variant&&{marginLeft:72},"middle"===n.variant&&"horizontal"===n.orientation&&{marginLeft:e.spacing(2),marginRight:e.spacing(2)},"middle"===n.variant&&"vertical"===n.orientation&&{marginTop:e.spacing(1),marginBottom:e.spacing(1)},"vertical"===n.orientation&&{height:"100%",borderBottomWidth:0,borderRightWidth:"thin"},n.flexItem&&{alignSelf:"stretch",height:"auto"})}),(t=>{let{ownerState:e}=t;return(0,f.A)({},e.children&&{display:"flex",whiteSpace:"nowrap",textAlign:"center",border:0,"&::before, &::after":{content:'""',alignSelf:"center"}})}),(t=>{let{theme:e,ownerState:n}=t;return(0,f.A)({},n.children&&"vertical"!==n.orientation&&{"&::before, &::after":{width:"100%",borderTop:"thin solid ".concat((e.vars||e).palette.divider)}})}),(t=>{let{theme:e,ownerState:n}=t;return(0,f.A)({},n.children&&"vertical"===n.orientation&&{flexDirection:"column","&::before, &::after":{height:"100%",borderLeft:"thin solid ".concat((e.vars||e).palette.divider)}})}),(t=>{let{ownerState:e}=t;return(0,f.A)({},"right"===e.textAlign&&"vertical"!==e.orientation&&{"&::before":{width:"90%"},"&::after":{width:"10%"}},"left"===e.textAlign&&"vertical"!==e.orientation&&{"&::before":{width:"10%"},"&::after":{width:"90%"}})})),co=(0,Ln.Ay)("span",{name:"MuiDivider",slot:"Wrapper",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.wrapper,"vertical"===n.orientation&&e.wrapperVertical]}})((t=>{let{theme:e,ownerState:n}=t;return(0,f.A)({display:"inline-block",paddingLeft:"calc(".concat(e.spacing(1)," * 1.2)"),paddingRight:"calc(".concat(e.spacing(1)," * 1.2)")},"vertical"===n.orientation&&{paddingTop:"calc(".concat(e.spacing(1)," * 1.2)"),paddingBottom:"calc(".concat(e.spacing(1)," * 1.2)")})})),uo=h.forwardRef((function(t,e){const n=(0,p.A)({props:t,name:"MuiDivider"}),{absolute:r=!1,children:i,className:o,component:s=(i?"div":"hr"),flexItem:a=!1,light:l=!1,orientation:c="horizontal",role:u=("hr"!==s?"separator":void 0),textAlign:d="center",variant:h="fullWidth"}=n,g=(0,C.A)(n,ao),m=(0,f.A)({},n,{absolute:r,component:s,flexItem:a,light:l,orientation:c,role:u,textAlign:d,variant:h}),b=(t=>{const{absolute:e,children:n,classes:r,flexItem:i,light:o,orientation:s,textAlign:a,variant:l}=t,c={root:["root",e&&"absolute",l,o&&"light","vertical"===s&&"vertical",i&&"flexItem",n&&"withChildren",n&&"vertical"===s&&"withChildrenVertical","right"===a&&"vertical"!==s&&"textAlignRight","left"===a&&"vertical"!==s&&"textAlignLeft"],wrapper:["wrapper","vertical"===s&&"wrapperVertical"]};return(0,Bn.A)(c,so,r)})(m);return(0,v.jsx)(lo,(0,f.A)({as:s,className:(0,wn.A)(b.root,o),role:u,ref:e,ownerState:m},g,{children:i?(0,v.jsx)(co,{className:b.wrapper,ownerState:m,children:i}):null}))}));uo.muiSkipListHighlight=!0;const ho=uo;var fo=n(7042);function po(t,e,n){return void 0===t||Br(t)?e:(0,f.A)({},e,{ownerState:(0,f.A)({},e.ownerState,n)})}function go(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(void 0===t)return{};const n={};return Object.keys(t).filter((n=>n.match(/^on[A-Z]/)&&"function"===typeof t[n]&&!e.includes(n))).forEach((e=>{n[e]=t[e]})),n}function mo(t){if(void 0===t)return{};const e={};return Object.keys(t).filter((e=>!(e.match(/^on[A-Z]/)&&"function"===typeof t[e]))).forEach((n=>{e[n]=t[n]})),e}const vo=["elementType","externalSlotProps","ownerState","skipResolvingSlotProps"];function bo(t){var e;const{elementType:n,externalSlotProps:r,ownerState:i,skipResolvingSlotProps:o=!1}=t,s=(0,C.A)(t,vo),a=o?{}:function(t,e,n){return"function"===typeof t?t(e,n):t}(r,i),{props:l,internalRef:c}=function(t){const{getSlotProps:e,additionalProps:n,externalSlotProps:r,externalForwardedProps:i,className:o}=t;if(!e){const t=(0,wn.A)(null==n?void 0:n.className,o,null==i?void 0:i.className,null==r?void 0:r.className),e=(0,f.A)({},null==n?void 0:n.style,null==i?void 0:i.style,null==r?void 0:r.style),s=(0,f.A)({},n,i,r);return t.length>0&&(s.className=t),Object.keys(e).length>0&&(s.style=e),{props:s,internalRef:void 0}}const s=go((0,f.A)({},i,r)),a=mo(r),l=mo(i),c=e(s),u=(0,wn.A)(null==c?void 0:c.className,null==n?void 0:n.className,o,null==i?void 0:i.className,null==r?void 0:r.className),d=(0,f.A)({},null==c?void 0:c.style,null==n?void 0:n.style,null==i?void 0:i.style,null==r?void 0:r.style),h=(0,f.A)({},c,n,l,a);return u.length>0&&(h.className=u),Object.keys(d).length>0&&(h.style=d),{props:h,internalRef:c.ref}}((0,f.A)({},s,{externalSlotProps:a})),u=(0,fo.A)(c,null==a?void 0:a.ref,null==(e=t.additionalProps)?void 0:e.ref);return po(n,(0,f.A)({},l,{ref:u}),i)}var yo=n(2144),xo=n(1944),Ao=n(7040),_o=n(932),wo=n(3844),So=n(4626);const Co={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",whiteSpace:"nowrap",width:"1px"};function Eo(t,e){return t-e}function Po(t,e){var n;const{index:r}=null!=(n=t.reduce(((t,n,r)=>{const i=Math.abs(e-n);return null===t||i2&&void 0!==arguments[2]?arguments[2]:(t,e)=>t===e;return t.length===e.length&&t.every(((t,r)=>n(t,e[r])))}(t,e)}const Bo={horizontal:{offset:t=>({left:"".concat(t,"%")}),leap:t=>({width:"".concat(t,"%")})},"horizontal-reverse":{offset:t=>({right:"".concat(t,"%")}),leap:t=>({width:"".concat(t,"%")})},vertical:{offset:t=>({bottom:"".concat(t,"%")}),leap:t=>({height:"".concat(t,"%")})}},Lo=t=>t;let Do;function Fo(){return void 0===Do&&(Do="undefined"===typeof CSS||"function"!==typeof CSS.supports||CSS.supports("touch-action","none")),Do}function No(t){const{"aria-labelledby":e,defaultValue:n,disabled:r=!1,disableSwap:i=!1,isRtl:o=!1,marks:s=!1,max:a=100,min:l=0,name:c,onChange:u,onChangeCommitted:d,orientation:p="horizontal",rootRef:g,scale:m=Lo,step:v=1,shiftStep:b=10,tabIndex:y,value:x}=t,A=h.useRef(),[_,w]=h.useState(-1),[S,C]=h.useState(-1),[E,P]=h.useState(!1),M=h.useRef(0),[T,O]=(0,xo.A)({controlled:x,default:null!=n?n:l,name:"Slider"}),k=u&&((t,e,n)=>{const r=t.nativeEvent||t,i=new r.constructor(r.type,r);Object.defineProperty(i,"target",{writable:!0,value:{value:e,name:c}}),u(i,e,n)}),R=Array.isArray(T);let I=R?T.slice().sort(Eo):[T];I=I.map((t=>null==t?l:(0,Ao.A)(t,l,a)));const B=!0===s&&null!==v?[...Array(Math.floor((a-l)/v)+1)].map(((t,e)=>({value:l+v*e}))):s||[],L=B.map((t=>t.value)),{isFocusVisibleRef:D,onBlur:F,onFocus:N,ref:j}=(0,_o.A)(),[z,U]=h.useState(-1),V=h.useRef(),G=(0,fo.A)(j,V),W=(0,fo.A)(g,G),H=t=>e=>{var n;const r=Number(e.currentTarget.getAttribute("data-index"));N(e),!0===D.current&&U(r),C(r),null==t||null==(n=t.onFocus)||n.call(t,e)},J=t=>e=>{var n;F(e),!1===D.current&&U(-1),C(-1),null==t||null==(n=t.onBlur)||n.call(t,e)},K=(t,e)=>{const n=Number(t.currentTarget.getAttribute("data-index")),r=I[n],o=L.indexOf(r);let s=e;if(B&&null==v){const t=L[L.length-1];s=s>t?t:se=>{var n;if(null!==v){const t=Number(e.currentTarget.getAttribute("data-index")),n=I[t];let r=null;("ArrowLeft"===e.key||"ArrowDown"===e.key)&&e.shiftKey||"PageDown"===e.key?r=Math.max(n-b,l):(("ArrowRight"===e.key||"ArrowUp"===e.key)&&e.shiftKey||"PageUp"===e.key)&&(r=Math.min(n+b,a)),null!==r&&(K(e,r),e.preventDefault())}null==t||null==(n=t.onKeyDown)||n.call(t,e)};(0,wo.A)((()=>{var t;r&&V.current.contains(document.activeElement)&&(null==(t=document.activeElement)||t.blur())}),[r]),r&&-1!==_&&w(-1),r&&-1!==z&&U(-1);const q=h.useRef();let Y=p;o&&"horizontal"===p&&(Y+="-reverse");const Q=t=>{let{finger:e,move:n=!1}=t;const{current:r}=V,{width:o,height:s,bottom:c,left:u}=r.getBoundingClientRect();let d,h;if(d=0===Y.indexOf("vertical")?(c-e.y)/s:(e.x-u)/o,-1!==Y.indexOf("-reverse")&&(d=1-d),h=function(t,e,n){return(n-e)*t+e}(d,l,a),v)h=Oo(h,v,l);else{const t=Po(L,h);h=L[t]}h=(0,Ao.A)(h,l,a);let f=0;if(R){f=n?q.current:Po(I,h),i&&(h=(0,Ao.A)(h,I[f-1]||-1/0,I[f+1]||1/0));const t=h;h=ko({values:I,newValue:h,index:f}),i&&n||(f=h.indexOf(t),q.current=f)}return{newValue:h,activeIndex:f}},Z=(0,So.A)((t=>{const e=Mo(t,A);if(!e)return;if(M.current+=1,"mousemove"===t.type&&0===t.buttons)return void $(t);const{newValue:n,activeIndex:r}=Q({finger:e,move:!0});Ro({sliderRef:V,activeIndex:r,setActive:w}),O(n),!E&&M.current>2&&P(!0),k&&!Io(n,T)&&k(t,n,r)})),$=(0,So.A)((t=>{const e=Mo(t,A);if(P(!1),!e)return;const{newValue:n}=Q({finger:e,move:!0});w(-1),"touchend"===t.type&&C(-1),d&&d(t,n),A.current=void 0,et()})),tt=(0,So.A)((t=>{if(r)return;Fo()||t.preventDefault();const e=t.changedTouches[0];null!=e&&(A.current=e.identifier);const n=Mo(t,A);if(!1!==n){const{newValue:e,activeIndex:r}=Q({finger:n});Ro({sliderRef:V,activeIndex:r,setActive:w}),O(e),k&&!Io(e,T)&&k(t,e,r)}M.current=0;const i=(0,yo.A)(V.current);i.addEventListener("touchmove",Z,{passive:!0}),i.addEventListener("touchend",$,{passive:!0})})),et=h.useCallback((()=>{const t=(0,yo.A)(V.current);t.removeEventListener("mousemove",Z),t.removeEventListener("mouseup",$),t.removeEventListener("touchmove",Z),t.removeEventListener("touchend",$)}),[$,Z]);h.useEffect((()=>{const{current:t}=V;return t.addEventListener("touchstart",tt,{passive:Fo()}),()=>{t.removeEventListener("touchstart",tt),et()}}),[et,tt]),h.useEffect((()=>{r&&et()}),[r,et]);const nt=To(R?I[0]:l,l,a),rt=To(I[I.length-1],l,a)-nt,it=t=>e=>{var n;null==(n=t.onMouseLeave)||n.call(t,e),C(-1)};return{active:_,axis:Y,axisProps:Bo,dragging:E,focusedThumbIndex:z,getHiddenInputProps:function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var i;const s=go(n),u={onChange:(d=s||{},t=>{var e;null==(e=d.onChange)||e.call(d,t),K(t,t.target.valueAsNumber)}),onFocus:H(s||{}),onBlur:J(s||{}),onKeyDown:X(s||{})};var d;const h=(0,f.A)({},s,u);return(0,f.A)({tabIndex:y,"aria-labelledby":e,"aria-orientation":p,"aria-valuemax":m(a),"aria-valuemin":m(l),name:c,type:"range",min:t.min,max:t.max,step:null===t.step&&t.marks?"any":null!=(i=t.step)?i:void 0,disabled:r},n,h,{style:(0,f.A)({},Co,{direction:o?"rtl":"ltr",width:"100%",height:"100%"})})},getRootProps:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e=go(t),n={onMouseDown:(i=e||{},t=>{var e;if(null==(e=i.onMouseDown)||e.call(i,t),r)return;if(t.defaultPrevented)return;if(0!==t.button)return;t.preventDefault();const n=Mo(t,A);if(!1!==n){const{newValue:e,activeIndex:r}=Q({finger:n});Ro({sliderRef:V,activeIndex:r,setActive:w}),O(e),k&&!Io(e,T)&&k(t,e,r)}M.current=0;const o=(0,yo.A)(V.current);o.addEventListener("mousemove",Z,{passive:!0}),o.addEventListener("mouseup",$)})};var i;const o=(0,f.A)({},e,n);return(0,f.A)({},t,{ref:W},o)},getThumbProps:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e=go(t),n={onMouseOver:(r=e||{},t=>{var e;null==(e=r.onMouseOver)||e.call(r,t);const n=Number(t.currentTarget.getAttribute("data-index"));C(n)}),onMouseLeave:it(e||{})};var r;return(0,f.A)({},t,e,n)},marks:B,open:S,range:R,rootRef:W,trackLeap:rt,trackOffset:nt,values:I,getThumbStyle:t=>({pointerEvents:-1!==_&&_!==t?"none":void 0})}}function jo(t){return p.A}var zo=n(7123);const Uo=t=>!t||!Br(t);function Vo(t){return(0,Fn.Ay)("MuiSlider",t)}const Go=(0,Tn.A)("MuiSlider",["root","active","colorPrimary","colorSecondary","colorError","colorInfo","colorSuccess","colorWarning","disabled","dragging","focusVisible","mark","markActive","marked","markLabel","markLabelActive","rail","sizeSmall","thumb","thumbColorPrimary","thumbColorSecondary","thumbColorError","thumbColorSuccess","thumbColorInfo","thumbColorWarning","track","trackInverted","trackFalse","thumbSizeSmall","valueLabel","valueLabelOpen","valueLabelCircle","valueLabelLabel","vertical"]);const Wo=["aria-label","aria-valuetext","aria-labelledby","component","components","componentsProps","color","classes","className","disableSwap","disabled","getAriaLabel","getAriaValueText","marks","max","min","name","onChange","onChangeCommitted","orientation","shiftStep","size","step","scale","slotProps","slots","tabIndex","track","value","valueLabelDisplay","valueLabelFormat"],Ho=jo();function Jo(t){return t}const Ko=(0,Ln.Ay)("span",{name:"MuiSlider",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,e["color".concat((0,Dn.A)(n.color))],"medium"!==n.size&&e["size".concat((0,Dn.A)(n.size))],n.marked&&e.marked,"vertical"===n.orientation&&e.vertical,"inverted"===n.track&&e.trackInverted,!1===n.track&&e.trackFalse]}})((t=>{let{theme:e}=t;var n;return{borderRadius:12,boxSizing:"content-box",display:"inline-block",position:"relative",cursor:"pointer",touchAction:"none",WebkitTapHighlightColor:"transparent","@media print":{colorAdjust:"exact"},["&.".concat(Go.disabled)]:{pointerEvents:"none",cursor:"default",color:(e.vars||e).palette.grey[400]},["&.".concat(Go.dragging)]:{["& .".concat(Go.thumb,", & .").concat(Go.track)]:{transition:"none"}},variants:[...Object.keys((null!=(n=e.vars)?n:e).palette).filter((t=>{var n;return(null!=(n=e.vars)?n:e).palette[t].main})).map((t=>({props:{color:t},style:{color:(e.vars||e).palette[t].main}}))),{props:{orientation:"horizontal"},style:{height:4,width:"100%",padding:"13px 0","@media (pointer: coarse)":{padding:"20px 0"}}},{props:{orientation:"horizontal",size:"small"},style:{height:2}},{props:{orientation:"horizontal",marked:!0},style:{marginBottom:20}},{props:{orientation:"vertical"},style:{height:"100%",width:4,padding:"0 13px","@media (pointer: coarse)":{padding:"0 20px"}}},{props:{orientation:"vertical",size:"small"},style:{width:2}},{props:{orientation:"vertical",marked:!0},style:{marginRight:44}}]}})),Xo=(0,Ln.Ay)("span",{name:"MuiSlider",slot:"Rail",overridesResolver:(t,e)=>e.rail})({display:"block",position:"absolute",borderRadius:"inherit",backgroundColor:"currentColor",opacity:.38,variants:[{props:{orientation:"horizontal"},style:{width:"100%",height:"inherit",top:"50%",transform:"translateY(-50%)"}},{props:{orientation:"vertical"},style:{height:"100%",width:"inherit",left:"50%",transform:"translateX(-50%)"}},{props:{track:"inverted"},style:{opacity:1}}]}),qo=(0,Ln.Ay)("span",{name:"MuiSlider",slot:"Track",overridesResolver:(t,e)=>e.track})((t=>{let{theme:e}=t;var n;return{display:"block",position:"absolute",borderRadius:"inherit",border:"1px solid currentColor",backgroundColor:"currentColor",transition:e.transitions.create(["left","width","bottom","height"],{duration:e.transitions.duration.shortest}),variants:[{props:{size:"small"},style:{border:"none"}},{props:{orientation:"horizontal"},style:{height:"inherit",top:"50%",transform:"translateY(-50%)"}},{props:{orientation:"vertical"},style:{width:"inherit",left:"50%",transform:"translateX(-50%)"}},{props:{track:!1},style:{display:"none"}},...Object.keys((null!=(n=e.vars)?n:e).palette).filter((t=>{var n;return(null!=(n=e.vars)?n:e).palette[t].main})).map((t=>({props:{color:t,track:"inverted"},style:(0,f.A)({},e.vars?{backgroundColor:e.vars.palette.Slider["".concat(t,"Track")],borderColor:e.vars.palette.Slider["".concat(t,"Track")]}:(0,f.A)({backgroundColor:(0,Kn.a)(e.palette[t].main,.62),borderColor:(0,Kn.a)(e.palette[t].main,.62)},e.applyStyles("dark",{backgroundColor:(0,Kn.e$)(e.palette[t].main,.5)}),e.applyStyles("dark",{borderColor:(0,Kn.e$)(e.palette[t].main,.5)})))})))]}})),Yo=(0,Ln.Ay)("span",{name:"MuiSlider",slot:"Thumb",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.thumb,e["thumbColor".concat((0,Dn.A)(n.color))],"medium"!==n.size&&e["thumbSize".concat((0,Dn.A)(n.size))]]}})((t=>{let{theme:e}=t;var n;return{position:"absolute",width:20,height:20,boxSizing:"border-box",borderRadius:"50%",outline:0,backgroundColor:"currentColor",display:"flex",alignItems:"center",justifyContent:"center",transition:e.transitions.create(["box-shadow","left","bottom"],{duration:e.transitions.duration.shortest}),"&::before":{position:"absolute",content:'""',borderRadius:"inherit",width:"100%",height:"100%",boxShadow:(e.vars||e).shadows[2]},"&::after":{position:"absolute",content:'""',borderRadius:"50%",width:42,height:42,top:"50%",left:"50%",transform:"translate(-50%, -50%)"},["&.".concat(Go.disabled)]:{"&:hover":{boxShadow:"none"}},variants:[...Object.keys((null!=(n=e.vars)?n:e).palette).filter((t=>{var n;return(null!=(n=e.vars)?n:e).palette[t].main})).map((t=>({props:{color:t},style:{["&:hover, &.".concat(Go.focusVisible)]:(0,f.A)({},e.vars?{boxShadow:"0px 0px 0px 8px rgba(".concat(e.vars.palette[t].mainChannel," / 0.16)")}:{boxShadow:"0px 0px 0px 8px ".concat((0,Kn.X4)(e.palette[t].main,.16))},{"@media (hover: none)":{boxShadow:"none"}}),["&.".concat(Go.active)]:(0,f.A)({},e.vars?{boxShadow:"0px 0px 0px 14px rgba(".concat(e.vars.palette[t].mainChannel," / 0.16)}")}:{boxShadow:"0px 0px 0px 14px ".concat((0,Kn.X4)(e.palette[t].main,.16))})}}))),{props:{size:"small"},style:{width:12,height:12,"&::before":{boxShadow:"none"}}},{props:{orientation:"horizontal"},style:{top:"50%",transform:"translate(-50%, -50%)"}},{props:{orientation:"vertical"},style:{left:"50%",transform:"translate(-50%, 50%)"}}]}})),Qo=(0,Ln.Ay)((function(t){const{children:e,className:n,value:r}=t,i=(t=>{const{open:e}=t;return{offset:(0,wn.A)(e&&Go.valueLabelOpen),circle:Go.valueLabelCircle,label:Go.valueLabelLabel}})(t);return e?h.cloneElement(e,{className:(0,wn.A)(e.props.className)},(0,v.jsxs)(h.Fragment,{children:[e.props.children,(0,v.jsx)("span",{className:(0,wn.A)(i.offset,n),"aria-hidden":!0,children:(0,v.jsx)("span",{className:i.circle,children:(0,v.jsx)("span",{className:i.label,children:r})})})]})):null}),{name:"MuiSlider",slot:"ValueLabel",overridesResolver:(t,e)=>e.valueLabel})((t=>{let{theme:e}=t;return(0,f.A)({zIndex:1,whiteSpace:"nowrap"},e.typography.body2,{fontWeight:500,transition:e.transitions.create(["transform"],{duration:e.transitions.duration.shortest}),position:"absolute",backgroundColor:(e.vars||e).palette.grey[600],borderRadius:2,color:(e.vars||e).palette.common.white,display:"flex",alignItems:"center",justifyContent:"center",padding:"0.25rem 0.75rem",variants:[{props:{orientation:"horizontal"},style:{transform:"translateY(-100%) scale(0)",top:"-10px",transformOrigin:"bottom center","&::before":{position:"absolute",content:'""',width:8,height:8,transform:"translate(-50%, 50%) rotate(45deg)",backgroundColor:"inherit",bottom:0,left:"50%"},["&.".concat(Go.valueLabelOpen)]:{transform:"translateY(-100%) scale(1)"}}},{props:{orientation:"vertical"},style:{transform:"translateY(-50%) scale(0)",right:"30px",top:"50%",transformOrigin:"right center","&::before":{position:"absolute",content:'""',width:8,height:8,transform:"translate(-50%, -50%) rotate(45deg)",backgroundColor:"inherit",right:-8,top:"50%"},["&.".concat(Go.valueLabelOpen)]:{transform:"translateY(-50%) scale(1)"}}},{props:{size:"small"},style:{fontSize:e.typography.pxToRem(12),padding:"0.25rem 0.5rem"}},{props:{orientation:"vertical",size:"small"},style:{right:"20px"}}]})})),Zo=(0,Ln.Ay)("span",{name:"MuiSlider",slot:"Mark",shouldForwardProp:t=>(0,zo.A)(t)&&"markActive"!==t,overridesResolver:(t,e)=>{const{markActive:n}=t;return[e.mark,n&&e.markActive]}})((t=>{let{theme:e}=t;return{position:"absolute",width:2,height:2,borderRadius:1,backgroundColor:"currentColor",variants:[{props:{orientation:"horizontal"},style:{top:"50%",transform:"translate(-1px, -50%)"}},{props:{orientation:"vertical"},style:{left:"50%",transform:"translate(-50%, 1px)"}},{props:{markActive:!0},style:{backgroundColor:(e.vars||e).palette.background.paper,opacity:.8}}]}})),$o=(0,Ln.Ay)("span",{name:"MuiSlider",slot:"MarkLabel",shouldForwardProp:t=>(0,zo.A)(t)&&"markLabelActive"!==t,overridesResolver:(t,e)=>e.markLabel})((t=>{let{theme:e}=t;return(0,f.A)({},e.typography.body2,{color:(e.vars||e).palette.text.secondary,position:"absolute",whiteSpace:"nowrap",variants:[{props:{orientation:"horizontal"},style:{top:30,transform:"translateX(-50%)","@media (pointer: coarse)":{top:40}}},{props:{orientation:"vertical"},style:{left:36,transform:"translateY(50%)","@media (pointer: coarse)":{left:44}}},{props:{markLabelActive:!0},style:{color:(e.vars||e).palette.text.primary}}]})})),ts=t=>{let{children:e}=t;return e},es=h.forwardRef((function(t,e){var n,r,i,o,s,a,l,c,u,d,p,g,m,b,y,x,A,_,w,S,E,P,M,T;const O=Ho({props:t,name:"MuiSlider"}),k=B(),{"aria-label":R,"aria-valuetext":I,"aria-labelledby":L,component:D="span",components:F={},componentsProps:N={},color:j="primary",classes:z,className:U,disableSwap:V=!1,disabled:G=!1,getAriaLabel:W,getAriaValueText:H,marks:J=!1,max:K=100,min:X=0,orientation:q="horizontal",shiftStep:Y=10,size:Q="medium",step:Z=1,scale:$=Jo,slotProps:tt,slots:et,track:nt="normal",valueLabelDisplay:rt="off",valueLabelFormat:it=Jo}=O,ot=(0,C.A)(O,Wo),st=(0,f.A)({},O,{isRtl:k,max:K,min:X,classes:z,disabled:G,disableSwap:V,orientation:q,marks:J,color:j,size:Q,step:Z,shiftStep:Y,scale:$,track:nt,valueLabelDisplay:rt,valueLabelFormat:it}),{axisProps:at,getRootProps:lt,getHiddenInputProps:ct,getThumbProps:ut,open:dt,active:ht,axis:ft,focusedThumbIndex:pt,range:gt,dragging:mt,marks:vt,values:bt,trackOffset:yt,trackLeap:xt,getThumbStyle:At}=No((0,f.A)({},st,{rootRef:e}));st.marked=vt.length>0&&vt.some((t=>t.label)),st.dragging=mt,st.focusedThumbIndex=pt;const _t=(t=>{const{disabled:e,dragging:n,marked:r,orientation:i,track:o,classes:s,color:a,size:l}=t,c={root:["root",e&&"disabled",n&&"dragging",r&&"marked","vertical"===i&&"vertical","inverted"===o&&"trackInverted",!1===o&&"trackFalse",a&&"color".concat((0,Dn.A)(a)),l&&"size".concat((0,Dn.A)(l))],rail:["rail"],track:["track"],mark:["mark"],markActive:["markActive"],markLabel:["markLabel"],markLabelActive:["markLabelActive"],valueLabel:["valueLabel"],thumb:["thumb",e&&"disabled",l&&"thumbSize".concat((0,Dn.A)(l)),a&&"thumbColor".concat((0,Dn.A)(a))],active:["active"],disabled:["disabled"],focusVisible:["focusVisible"]};return(0,Bn.A)(c,Vo,s)})(st),wt=null!=(n=null!=(r=null==et?void 0:et.root)?r:F.Root)?n:Ko,St=null!=(i=null!=(o=null==et?void 0:et.rail)?o:F.Rail)?i:Xo,Ct=null!=(s=null!=(a=null==et?void 0:et.track)?a:F.Track)?s:qo,Et=null!=(l=null!=(c=null==et?void 0:et.thumb)?c:F.Thumb)?l:Yo,Pt=null!=(u=null!=(d=null==et?void 0:et.valueLabel)?d:F.ValueLabel)?u:Qo,Mt=null!=(p=null!=(g=null==et?void 0:et.mark)?g:F.Mark)?p:Zo,Tt=null!=(m=null!=(b=null==et?void 0:et.markLabel)?b:F.MarkLabel)?m:$o,Ot=null!=(y=null!=(x=null==et?void 0:et.input)?x:F.Input)?y:"input",kt=null!=(A=null==tt?void 0:tt.root)?A:N.root,Rt=null!=(_=null==tt?void 0:tt.rail)?_:N.rail,It=null!=(w=null==tt?void 0:tt.track)?w:N.track,Bt=null!=(S=null==tt?void 0:tt.thumb)?S:N.thumb,Lt=null!=(E=null==tt?void 0:tt.valueLabel)?E:N.valueLabel,Dt=null!=(P=null==tt?void 0:tt.mark)?P:N.mark,Ft=null!=(M=null==tt?void 0:tt.markLabel)?M:N.markLabel,Nt=null!=(T=null==tt?void 0:tt.input)?T:N.input,jt=bo({elementType:wt,getSlotProps:lt,externalSlotProps:kt,externalForwardedProps:ot,additionalProps:(0,f.A)({},Uo(wt)&&{as:D}),ownerState:(0,f.A)({},st,null==kt?void 0:kt.ownerState),className:[_t.root,U]}),zt=bo({elementType:St,externalSlotProps:Rt,ownerState:st,className:_t.rail}),Ut=bo({elementType:Ct,externalSlotProps:It,additionalProps:{style:(0,f.A)({},at[ft].offset(yt),at[ft].leap(xt))},ownerState:(0,f.A)({},st,null==It?void 0:It.ownerState),className:_t.track}),Vt=bo({elementType:Et,getSlotProps:ut,externalSlotProps:Bt,ownerState:(0,f.A)({},st,null==Bt?void 0:Bt.ownerState),className:_t.thumb}),Gt=bo({elementType:Pt,externalSlotProps:Lt,ownerState:(0,f.A)({},st,null==Lt?void 0:Lt.ownerState),className:_t.valueLabel}),Wt=bo({elementType:Mt,externalSlotProps:Dt,ownerState:st,className:_t.mark}),Ht=bo({elementType:Tt,externalSlotProps:Ft,ownerState:st,className:_t.markLabel}),Jt=bo({elementType:Ot,getSlotProps:ct,externalSlotProps:Nt,ownerState:st});return(0,v.jsxs)(wt,(0,f.A)({},jt,{children:[(0,v.jsx)(St,(0,f.A)({},zt)),(0,v.jsx)(Ct,(0,f.A)({},Ut)),vt.filter((t=>t.value>=X&&t.value<=K)).map(((t,e)=>{const n=To(t.value,X,K),r=at[ft].offset(n);let i;return i=!1===nt?-1!==bt.indexOf(t.value):"normal"===nt&&(gt?t.value>=bt[0]&&t.value<=bt[bt.length-1]:t.value<=bt[0])||"inverted"===nt&&(gt?t.value<=bt[0]||t.value>=bt[bt.length-1]:t.value>=bt[0]),(0,v.jsxs)(h.Fragment,{children:[(0,v.jsx)(Mt,(0,f.A)({"data-index":e},Wt,!Br(Mt)&&{markActive:i},{style:(0,f.A)({},r,Wt.style),className:(0,wn.A)(Wt.className,i&&_t.markActive)})),null!=t.label?(0,v.jsx)(Tt,(0,f.A)({"aria-hidden":!0,"data-index":e},Ht,!Br(Tt)&&{markLabelActive:i},{style:(0,f.A)({},r,Ht.style),className:(0,wn.A)(_t.markLabel,Ht.className,i&&_t.markLabelActive),children:t.label})):null]},e)})),bt.map(((t,e)=>{const n=To(t,X,K),r=at[ft].offset(n),i="off"===rt?ts:Pt;return(0,v.jsx)(i,(0,f.A)({},!Br(i)&&{valueLabelFormat:it,valueLabelDisplay:rt,value:"function"===typeof it?it($(t),e):it,index:e,open:dt===e||ht===e||"on"===rt,disabled:G},Gt,{children:(0,v.jsx)(Et,(0,f.A)({"data-index":e},Vt,{className:(0,wn.A)(_t.thumb,Vt.className,ht===e&&_t.active,pt===e&&_t.focusVisible),style:(0,f.A)({},r,At(e),Vt.style),children:(0,v.jsx)(Ot,(0,f.A)({"data-index":e,"aria-label":W?W(e):R,"aria-valuenow":$(t),"aria-labelledby":L,"aria-valuetext":H?H($(t),e):I,value:bt[e]},Jt))}))}),e)}))]}))})),ns=es;function rs(t){return(0,Fn.Ay)("MuiList",t)}(0,Tn.A)("MuiList",["root","padding","dense","subheader"]);const is=["children","className","component","dense","disablePadding","subheader"],os=(0,Ln.Ay)("ul",{name:"MuiList",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,!n.disablePadding&&e.padding,n.dense&&e.dense,n.subheader&&e.subheader]}})((t=>{let{ownerState:e}=t;return(0,f.A)({listStyle:"none",margin:0,padding:0,position:"relative"},!e.disablePadding&&{paddingTop:8,paddingBottom:8},e.subheader&&{paddingTop:0})})),ss=h.forwardRef((function(t,e){const n=(0,p.A)({props:t,name:"MuiList"}),{children:r,className:i,component:o="ul",dense:s=!1,disablePadding:a=!1,subheader:l}=n,c=(0,C.A)(n,is),u=h.useMemo((()=>({dense:s})),[s]),d=(0,f.A)({},n,{component:o,dense:s,disablePadding:a}),g=(t=>{const{classes:e,disablePadding:n,dense:r,subheader:i}=t,o={root:["root",!n&&"padding",r&&"dense",i&&"subheader"]};return(0,Bn.A)(o,rs,e)})(d);return(0,v.jsx)(yi.Provider,{value:u,children:(0,v.jsxs)(os,(0,f.A)({as:o,className:(0,wn.A)(g.root,i),ref:e,ownerState:d},c,{children:[l,r]}))})})),as=Qe({name:"menuState",initialState:{editMenuState:{},typesMenuState:{},layersMenuState:{},viewSettingsMenuState:{},animationMenuState:{toggleAnimationState:!1,animationSpeedSliderValue:10}},reducers:{updateLayersMenuState:(t,e)=>{t.layersMenuState=e.payload},updateTypesMenuState:(t,e)=>{t.typesMenuState=e.payload},updateEditMenuState:(t,e)=>{t.editMenuState=e.payload},updateViewSettingsMenuState:(t,e)=>{t.viewSettingsMenuState=e.payload},updateAnimationMenuState:(t,e)=>{t.animationMenuState=e.payload}}}),{updateLayersMenuState:ls,updateTypesMenuState:cs,updateEditMenuState:us,updateViewSettingsMenuState:ds,updateAnimationMenuState:hs}=as.actions,fs=as.reducer;function ps(){var t,e,n;const r=ut(),i=et((t=>t.cityIOdataState.cityIOdata)),o=i.GEOGRID.properties.types,s=null===i||void 0===i||null===(t=i.GEOGRID)||void 0===t||null===(e=t.properties)||void 0===e||null===(n=e.header)||void 0===n?void 0:n.cellSize,a=s*s,[l,c]=(0,h.useState)(),[u,d]=(0,h.useState)();(0,h.useEffect)((()=>{r(cs({SELECTED_TYPE:l}))}),[l]);const f=l&&l.LBCS,p=l&&l.NAICS;let g=l&&l.description?l.description:null;return(0,v.jsx)(v.Fragment,{children:(t=>{let e=[];return Object.keys(t).forEach(((n,r)=>{let i=t[n].color;"string"!==typeof i&&(i="rgb("+t[n].color[0]+","+t[n].color[1]+","+t[n].color[2]+")"),e.push((0,v.jsxs)("div",{children:[(0,v.jsx)(Ii,{children:(0,v.jsx)(Ji,{fullWidth:!0,size:"small",variant:"outlined",sx:{"&.MuiButton-text":{color:{col:i}},border:"solid 1px "+i},onClick:()=>{return e=t[n],r=n,e={...e,thisTypeName:r},void c(e);var e,r},children:(0,v.jsx)(Wn,{color:i,variant:"caption",children:n})},Math.random())},"li_menu_".concat(r)),l&&l.thisTypeName===n&&(0,v.jsx)(Ii,{children:(0,v.jsx)(eo,{variant:"outlined",sx:{width:"100%"},children:(0,v.jsxs)(oo,{children:[g&&(0,v.jsx)(Wn,{variant:"caption",children:g}),(0,v.jsx)(ho,{sx:{marginTop:"10px",marginBottom:"10px"}}),l&&l.thisTypeName&&l.height&&(0,v.jsxs)("div",{children:[(0,v.jsx)(Wn,{children:"Set Floors"}),u&&Array.isArray(u.height)&&(0,v.jsxs)(Wn,{variant:"caption",children:["Each cell adds"," ",a*u.height[1],"m\xb2"]}),(0,v.jsx)(ns,{valueLabelDisplay:"auto",size:"small",onChange:(t,e)=>d((t=>{const n={...t},r=[l.height[0],e,l.height[2]];return Object.assign(n,{height:r}),n})),onChangeCommitted:(t,e)=>{c({...l,height:[l.height[0],e,l.height[2]]})},min:l.height[0],value:u&&u[l]&&u[l].height[1],max:l.height[2]},"li_types_slider_".concat(l.thisTypeName))]},"li_types_div_".concat(r)),f&&(0,v.jsxs)("div",{children:[(0,v.jsx)(Wn,{children:"LBCS"}),(0,v.jsx)(Wn,{variant:"caption",children:JSON.stringify(f,null,"\t")})]}),p&&(0,v.jsxs)("div",{children:[(0,v.jsx)(Wn,{children:"NAICS"}),(0,v.jsx)(Wn,{variant:"caption",children:JSON.stringify(p,null,"\t")})]})]})},"li_types_card_".concat(r))},"li_types_".concat(r))]},"li_types_top_div_".concat(r)))})),(0,v.jsx)(ss,{sx:{display:"flex",flexDirection:"column",maxHeight:400,overflow:"hidden",overflowY:"scroll"},children:e})})(o)})}const gs=h.createContext(void 0);function ms(){return h.useContext(gs)}var vs=n(3216),bs=n(8280);const ys=["ownerState"],xs=["variants"],As=["name","slot","skipVariantsResolver","skipSx","overridesResolver"];function _s(t){return"ownerState"!==t&&"theme"!==t&&"sx"!==t&&"as"!==t}const ws=(0,bs.A)(),Ss=t=>t?t.charAt(0).toLowerCase()+t.slice(1):t;function Cs(t){let{defaultTheme:e,theme:n,themeId:r}=t;return i=n,0===Object.keys(i).length?e:n[r]||n;var i}function Es(t){return t?(e,n)=>n[t]:null}function Ps(t,e){let{ownerState:n}=e,r=(0,C.A)(e,ys);const i="function"===typeof t?t((0,f.A)({ownerState:n},r)):t;if(Array.isArray(i))return i.flatMap((t=>Ps(t,(0,f.A)({ownerState:n},r))));if(i&&"object"===typeof i&&Array.isArray(i.variants)){const{variants:t=[]}=i;let e=(0,C.A)(i,xs);return t.forEach((t=>{let i=!0;"function"===typeof t.props?i=t.props((0,f.A)({ownerState:n},r,n)):Object.keys(t.props).forEach((e=>{(null==n?void 0:n[e])!==t.props[e]&&r[e]!==t.props[e]&&(i=!1)})),i&&(Array.isArray(e)||(e=[e]),e.push("function"===typeof t.style?t.style((0,f.A)({ownerState:n},r,n)):t.style))})),e}return i}const Ms=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{themeId:e,defaultTheme:n=ws,rootShouldForwardProp:r=_s,slotShouldForwardProp:i=_s}=t,o=t=>(0,Cn.A)((0,f.A)({},t,{theme:Cs((0,f.A)({},t,{defaultTheme:n,themeId:e}))}));return o.__mui_systemSx=!0,function(t){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(0,Sn.internal_processStyles)(t,(t=>t.filter((t=>!(null!=t&&t.__mui_systemSx)))));const{name:a,slot:l,skipVariantsResolver:c,skipSx:u,overridesResolver:d=Es(Ss(l))}=s,h=(0,C.A)(s,As),p=void 0!==c?c:l&&"Root"!==l&&"root"!==l||!1,g=u||!1;let m=_s;"Root"===l||"root"===l?m=r:l?m=i:function(t){return"string"===typeof t&&t.charCodeAt(0)>96}(t)&&(m=void 0);const v=(0,Sn.default)(t,(0,f.A)({shouldForwardProp:m,label:undefined},h)),b=t=>"function"===typeof t&&t.__emotion_real!==t||(0,vs.Q)(t)?r=>Ps(t,(0,f.A)({},r,{theme:Cs({theme:r.theme,defaultTheme:n,themeId:e})})):t,y=function(r){let i=b(r);for(var s=arguments.length,l=new Array(s>1?s-1:0),c=1;c{const r=Cs((0,f.A)({},t,{defaultTheme:n,themeId:e}));if(!r.components||!r.components[a]||!r.components[a].styleOverrides)return null;const i=r.components[a].styleOverrides,o={};return Object.entries(i).forEach((e=>{let[n,i]=e;o[n]=Ps(i,(0,f.A)({},t,{theme:r}))})),d(t,o)})),a&&!p&&u.push((t=>{var r;const i=Cs((0,f.A)({},t,{defaultTheme:n,themeId:e}));return Ps({variants:null==i||null==(r=i.components)||null==(r=r[a])?void 0:r.variants},(0,f.A)({},t,{theme:i}))})),g||u.push(o);const h=u.length-l.length;if(Array.isArray(r)&&h>0){const t=new Array(h).fill("");i=[...r,...t],i.raw=[...r.raw,...t]}const m=v(i,...u);return t.muiName&&(m.muiName=t.muiName),m};return v.withConfig&&(y.withConfig=v.withConfig),y}}(),Ts=Ms;var Os=n(2919),ks=n(8604);const Rs=["component","direction","spacing","divider","children","className","useFlexGap"],Is=(0,bs.A)(),Bs=Ts("div",{name:"MuiStack",slot:"Root",overridesResolver:(t,e)=>e.root});function Ls(t){return(0,Os.A)({props:t,name:"MuiStack",defaultTheme:Is})}function Ds(t,e){const n=h.Children.toArray(t).filter(Boolean);return n.reduce(((t,r,i)=>(t.push(r),i{let{ownerState:e,theme:n}=t,r=(0,f.A)({display:"flex",flexDirection:"column"},(0,xr.NI)({theme:n},(0,xr.kW)({values:e.direction,breakpoints:n.breakpoints.values}),(t=>({flexDirection:t}))));if(e.spacing){const t=(0,ks.LX)(n),i=Object.keys(n.breakpoints.values).reduce(((t,n)=>(("object"===typeof e.spacing&&null!=e.spacing[n]||"object"===typeof e.direction&&null!=e.direction[n])&&(t[n]=!0),t)),{}),o=(0,xr.kW)({values:e.direction,base:i}),s=(0,xr.kW)({values:e.spacing,base:i});"object"===typeof o&&Object.keys(o).forEach(((t,e,n)=>{if(!o[t]){const r=e>0?o[n[e-1]]:"column";o[t]=r}}));const a=(n,r)=>{return e.useFlexGap?{gap:(0,ks._W)(t,n)}:{"& > :not(style):not(style)":{margin:0},"& > :not(style) ~ :not(style)":{["margin".concat((i=r?o[r]:e.direction,{row:"Left","row-reverse":"Right",column:"Top","column-reverse":"Bottom"}[i]))]:(0,ks._W)(t,n)}};var i};r=(0,vs.A)(r,(0,xr.NI)({theme:n},s,a))}return r=(0,xr.iZ)(n.breakpoints,r),r};const Ns=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{createStyledComponent:e=Bs,useThemeProps:n=Ls,componentName:r="MuiStack"}=t,i=e(Fs),o=h.forwardRef((function(t,e){const o=n(t),s=(0,En.A)(o),{component:a="div",direction:l="column",spacing:c=0,divider:u,children:d,className:h,useFlexGap:p=!1}=s,g=(0,C.A)(s,Rs),m={direction:l,spacing:c,useFlexGap:p},b=(0,Bn.A)({root:["root"]},(t=>(0,Fn.Ay)(r,t)),{});return(0,v.jsx)(i,(0,f.A)({as:a,ownerState:m,ref:e,className:(0,wn.A)(b.root,h)},g,{children:u?Ds(d,u):d}))}));return o}({createStyledComponent:(0,Ln.Ay)("div",{name:"MuiStack",slot:"Root",overridesResolver:(t,e)=>e.root}),useThemeProps:t=>(0,p.A)({props:t,name:"MuiStack"})}),js=Ns;function zs(t){return(0,Fn.Ay)("MuiFormControlLabel",t)}const Us=(0,Tn.A)("MuiFormControlLabel",["root","labelPlacementStart","labelPlacementTop","labelPlacementBottom","disabled","label","error","required","asterisk"]);function Vs(t){let{props:e,states:n,muiFormControl:r}=t;return n.reduce(((t,n)=>(t[n]=e[n],r&&"undefined"===typeof e[n]&&(t[n]=r[n]),t)),{})}const Gs=["checked","className","componentsProps","control","disabled","disableTypography","inputRef","label","labelPlacement","name","onChange","required","slotProps","value"],Ws=(0,Ln.Ay)("label",{name:"MuiFormControlLabel",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[{["& .".concat(Us.label)]:e.label},e.root,e["labelPlacement".concat((0,Dn.A)(n.labelPlacement))]]}})((t=>{let{theme:e,ownerState:n}=t;return(0,f.A)({display:"inline-flex",alignItems:"center",cursor:"pointer",verticalAlign:"middle",WebkitTapHighlightColor:"transparent",marginLeft:-11,marginRight:16,["&.".concat(Us.disabled)]:{cursor:"default"}},"start"===n.labelPlacement&&{flexDirection:"row-reverse",marginLeft:16,marginRight:-11},"top"===n.labelPlacement&&{flexDirection:"column-reverse",marginLeft:16},"bottom"===n.labelPlacement&&{flexDirection:"column",marginLeft:16},{["& .".concat(Us.label)]:{["&.".concat(Us.disabled)]:{color:(e.vars||e).palette.text.disabled}}})})),Hs=(0,Ln.Ay)("span",{name:"MuiFormControlLabel",slot:"Asterisk",overridesResolver:(t,e)=>e.asterisk})((t=>{let{theme:e}=t;return{["&.".concat(Us.error)]:{color:(e.vars||e).palette.error.main}}})),Js=h.forwardRef((function(t,e){var n,r;const i=(0,p.A)({props:t,name:"MuiFormControlLabel"}),{className:o,componentsProps:s={},control:a,disabled:l,disableTypography:c,label:u,labelPlacement:d="end",required:g,slotProps:m={}}=i,b=(0,C.A)(i,Gs),y=ms(),x=null!=(n=null!=l?l:a.props.disabled)?n:null==y?void 0:y.disabled,A=null!=g?g:a.props.required,_={disabled:x,required:A};["checked","name","onChange","value","inputRef"].forEach((t=>{"undefined"===typeof a.props[t]&&"undefined"!==typeof i[t]&&(_[t]=i[t])}));const w=Vs({props:i,muiFormControl:y,states:["error"]}),S=(0,f.A)({},i,{disabled:x,labelPlacement:d,required:A,error:w.error}),E=(t=>{const{classes:e,disabled:n,labelPlacement:r,error:i,required:o}=t,s={root:["root",n&&"disabled","labelPlacement".concat((0,Dn.A)(r)),i&&"error",o&&"required"],label:["label",n&&"disabled"],asterisk:["asterisk",i&&"error"]};return(0,Bn.A)(s,zs,e)})(S),P=null!=(r=m.typography)?r:s.typography;let M=u;return null==M||M.type===Wn||c||(M=(0,v.jsx)(Wn,(0,f.A)({component:"span"},P,{className:(0,wn.A)(E.label,null==P?void 0:P.className),children:M}))),(0,v.jsxs)(Ws,(0,f.A)({className:(0,wn.A)(E.root,o),ownerState:S,ref:e},b,{children:[h.cloneElement(a,_),A?(0,v.jsxs)(js,{display:"block",children:[M,(0,v.jsxs)(Hs,{ownerState:S,"aria-hidden":!0,className:E.asterisk,children:["\u2009","*"]})]}):M]}))})),Ks=Js;var Xs=n(4516);function qs(t){return(0,Fn.Ay)("PrivateSwitchBase",t)}(0,Tn.A)("PrivateSwitchBase",["root","checked","disabled","input","edgeStart","edgeEnd"]);const Ys=["autoFocus","checked","checkedIcon","className","defaultChecked","disabled","disableFocusRipple","edge","icon","id","inputProps","inputRef","name","onBlur","onChange","onFocus","readOnly","required","tabIndex","type","value"],Qs=(0,Ln.Ay)(mi)((t=>{let{ownerState:e}=t;return(0,f.A)({padding:9,borderRadius:"50%"},"start"===e.edge&&{marginLeft:"small"===e.size?-3:-12},"end"===e.edge&&{marginRight:"small"===e.size?-3:-12})})),Zs=(0,Ln.Ay)("input",{shouldForwardProp:Li.A})({cursor:"inherit",position:"absolute",opacity:0,width:"100%",height:"100%",top:0,left:0,margin:0,padding:0,zIndex:1}),$s=h.forwardRef((function(t,e){const{autoFocus:n,checked:r,checkedIcon:i,className:o,defaultChecked:s,disabled:a,disableFocusRipple:l=!1,edge:c=!1,icon:u,id:d,inputProps:h,inputRef:p,name:g,onBlur:m,onChange:b,onFocus:y,readOnly:x,required:A=!1,tabIndex:_,type:w,value:S}=t,E=(0,C.A)(t,Ys),[P,M]=(0,Xs.A)({controlled:r,default:Boolean(s),name:"SwitchBase",state:"checked"}),T=ms();let O=a;T&&"undefined"===typeof O&&(O=T.disabled);const k="checkbox"===w||"radio"===w,R=(0,f.A)({},t,{checked:P,disabled:O,disableFocusRipple:l,edge:c}),I=(t=>{const{classes:e,checked:n,disabled:r,edge:i}=t,o={root:["root",n&&"checked",r&&"disabled",i&&"edge".concat((0,Dn.A)(i))],input:["input"]};return(0,Bn.A)(o,qs,e)})(R);return(0,v.jsxs)(Qs,(0,f.A)({component:"span",className:(0,wn.A)(I.root,o),centerRipple:!0,focusRipple:!l,disabled:O,tabIndex:null,role:void 0,onFocus:t=>{y&&y(t),T&&T.onFocus&&T.onFocus(t)},onBlur:t=>{m&&m(t),T&&T.onBlur&&T.onBlur(t)},ownerState:R,ref:e},E,{children:[(0,v.jsx)(Zs,(0,f.A)({autoFocus:n,checked:r,defaultChecked:s,className:I.input,disabled:O,id:k?d:void 0,name:g,onChange:t=>{if(t.nativeEvent.defaultPrevented)return;const e=t.target.checked;M(e),b&&b(t,e)},readOnly:x,ref:p,required:A,ownerState:R,tabIndex:_,type:w},"checkbox"===w&&void 0===S?{}:{value:S},h)),P?i:u]}))}));var ta=n(9662);const ea=(0,ta.A)((0,v.jsx)("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"}),"CheckBoxOutlineBlank"),na=(0,ta.A)((0,v.jsx)("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"}),"CheckBox"),ra=(0,ta.A)((0,v.jsx)("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-2 10H7v-2h10v2z"}),"IndeterminateCheckBox");function ia(t){return(0,Fn.Ay)("MuiCheckbox",t)}const oa=(0,Tn.A)("MuiCheckbox",["root","checked","disabled","indeterminate","colorPrimary","colorSecondary","sizeSmall","sizeMedium"]),sa=["checkedIcon","color","icon","indeterminate","indeterminateIcon","inputProps","size","className"],aa=(0,Ln.Ay)($s,{shouldForwardProp:t=>(0,Li.A)(t)||"classes"===t,name:"MuiCheckbox",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,n.indeterminate&&e.indeterminate,e["size".concat((0,Dn.A)(n.size))],"default"!==n.color&&e["color".concat((0,Dn.A)(n.color))]]}})((t=>{let{theme:e,ownerState:n}=t;return(0,f.A)({color:(e.vars||e).palette.text.secondary},!n.disableRipple&&{"&:hover":{backgroundColor:e.vars?"rgba(".concat("default"===n.color?e.vars.palette.action.activeChannel:e.vars.palette[n.color].mainChannel," / ").concat(e.vars.palette.action.hoverOpacity,")"):(0,Kn.X4)("default"===n.color?e.palette.action.active:e.palette[n.color].main,e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}}},"default"!==n.color&&{["&.".concat(oa.checked,", &.").concat(oa.indeterminate)]:{color:(e.vars||e).palette[n.color].main},["&.".concat(oa.disabled)]:{color:(e.vars||e).palette.action.disabled}})})),la=(0,v.jsx)(na,{}),ca=(0,v.jsx)(ea,{}),ua=(0,v.jsx)(ra,{}),da=h.forwardRef((function(t,e){var n,r;const i=(0,p.A)({props:t,name:"MuiCheckbox"}),{checkedIcon:o=la,color:s="primary",icon:a=ca,indeterminate:l=!1,indeterminateIcon:c=ua,inputProps:u,size:d="medium",className:g}=i,m=(0,C.A)(i,sa),b=l?c:a,y=l?c:o,x=(0,f.A)({},i,{color:s,indeterminate:l,size:d}),A=(t=>{const{classes:e,indeterminate:n,color:r,size:i}=t,o={root:["root",n&&"indeterminate","color".concat((0,Dn.A)(r)),"size".concat((0,Dn.A)(i))]},s=(0,Bn.A)(o,ia,e);return(0,f.A)({},e,s)})(x);return(0,v.jsx)(aa,(0,f.A)({type:"checkbox",inputProps:(0,f.A)({"data-indeterminate":l},u),icon:h.cloneElement(b,{fontSize:null!=(n=b.props.fontSize)?n:d}),checkedIcon:h.cloneElement(y,{fontSize:null!=(r=y.props.fontSize)?r:d}),ownerState:x,ref:e,className:(0,wn.A)(A.root,g)},m,{classes:A}))})),ha=da;const fa=function(){const t=ut(),e=et((t=>t.cityIOdataState.cityIOdata)),n=et((t=>t.menuState.layersMenuState)),r=Object.keys(e),[i,o]=(0,h.useState)((()=>{const t={};for(const e in xn)t[e]=xn[e].initSliderValue;return t}));let s={};const[a,l]=(0,h.useState)((()=>{for(const t in xn)s[t]={isOn:xn[t].initState,slider:xn[t].initSliderValue};return s}));(0,h.useEffect)((()=>{t(ls(a))}),[a]);const c=(t,e)=>{o({...i,[t]:e})},u=(t,e)=>{l({...n,[t]:{...n[t],isOn:e}})},d=(t,e)=>{l({...n,[t]:{...n[t],slider:e}})},f=[];return(()=>{for(const e in xn){const n=xn[e].cityIOmoduleName;var t;if(r.includes(n))f.push((0,v.jsxs)(In,{children:[(0,v.jsx)(Ks,{control:(0,v.jsx)(ha,{checked:a[e]&&a[e].isOn||!1,color:"primary",onChange:t=>u(e,t.target.checked)},"checkbox_"+e),label:(0,v.jsx)(Wn,{variant:"caption",children:xn[e].displayName},"label_"+e)},"formControl_"+e),a[e]&&a[e].isOn&&(0,v.jsx)(ns,{size:"small",valueLabelDisplay:"auto",onChangeCommitted:(t,n)=>d(e,n),onChange:(t,n)=>c(e,n),value:null!==(t=i[e])&&void 0!==t?t:0},"slider_"+e)]},"box_"+e))}if(e.layers)for(let r=0;ru(t,e.target.checked)},"checkbox_"+t),label:(0,v.jsx)(Wn,{variant:"caption",children:t},"label_"+t)},"formControl_"+t),a[t]&&a[t].isOn&&(0,v.jsx)(ns,{size:"small",valueLabelDisplay:"auto",onChangeCommitted:(e,n)=>d(t,n),onChange:(e,n)=>c(t,n),value:null!==(n=i[t])&&void 0!==n?n:50},"slider_"+t)]},"box_"+t))}return f})()};function pa(t){return(0,Fn.Ay)("MuiButtonGroup",t)}const ga=(0,Tn.A)("MuiButtonGroup",["root","contained","outlined","text","disableElevation","disabled","firstButton","fullWidth","vertical","grouped","groupedHorizontal","groupedVertical","groupedText","groupedTextHorizontal","groupedTextVertical","groupedTextPrimary","groupedTextSecondary","groupedOutlined","groupedOutlinedHorizontal","groupedOutlinedVertical","groupedOutlinedPrimary","groupedOutlinedSecondary","groupedContained","groupedContainedHorizontal","groupedContainedVertical","groupedContainedPrimary","groupedContainedSecondary","lastButton","middleButton"]),ma=["children","className","color","component","disabled","disableElevation","disableFocusRipple","disableRipple","fullWidth","orientation","size","variant"],va=(0,Ln.Ay)("div",{name:"MuiButtonGroup",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[{["& .".concat(ga.grouped)]:e.grouped},{["& .".concat(ga.grouped)]:e["grouped".concat((0,Dn.A)(n.orientation))]},{["& .".concat(ga.grouped)]:e["grouped".concat((0,Dn.A)(n.variant))]},{["& .".concat(ga.grouped)]:e["grouped".concat((0,Dn.A)(n.variant)).concat((0,Dn.A)(n.orientation))]},{["& .".concat(ga.grouped)]:e["grouped".concat((0,Dn.A)(n.variant)).concat((0,Dn.A)(n.color))]},{["& .".concat(ga.firstButton)]:e.firstButton},{["& .".concat(ga.lastButton)]:e.lastButton},{["& .".concat(ga.middleButton)]:e.middleButton},e.root,e[n.variant],!0===n.disableElevation&&e.disableElevation,n.fullWidth&&e.fullWidth,"vertical"===n.orientation&&e.vertical]}})((t=>{let{theme:e,ownerState:n}=t;return(0,f.A)({display:"inline-flex",borderRadius:(e.vars||e).shape.borderRadius},"contained"===n.variant&&{boxShadow:(e.vars||e).shadows[2]},n.disableElevation&&{boxShadow:"none"},n.fullWidth&&{width:"100%"},"vertical"===n.orientation&&{flexDirection:"column"},{["& .".concat(ga.grouped)]:(0,f.A)({minWidth:40,"&:hover":(0,f.A)({},"contained"===n.variant&&{boxShadow:"none"})},"contained"===n.variant&&{boxShadow:"none"}),["& .".concat(ga.firstButton,",& .").concat(ga.middleButton)]:(0,f.A)({},"horizontal"===n.orientation&&{borderTopRightRadius:0,borderBottomRightRadius:0},"vertical"===n.orientation&&{borderBottomRightRadius:0,borderBottomLeftRadius:0},"text"===n.variant&&"horizontal"===n.orientation&&{borderRight:e.vars?"1px solid rgba(".concat(e.vars.palette.common.onBackgroundChannel," / 0.23)"):"1px solid ".concat("light"===e.palette.mode?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)"),["&.".concat(ga.disabled)]:{borderRight:"1px solid ".concat((e.vars||e).palette.action.disabled)}},"text"===n.variant&&"vertical"===n.orientation&&{borderBottom:e.vars?"1px solid rgba(".concat(e.vars.palette.common.onBackgroundChannel," / 0.23)"):"1px solid ".concat("light"===e.palette.mode?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)"),["&.".concat(ga.disabled)]:{borderBottom:"1px solid ".concat((e.vars||e).palette.action.disabled)}},"text"===n.variant&&"inherit"!==n.color&&{borderColor:e.vars?"rgba(".concat(e.vars.palette[n.color].mainChannel," / 0.5)"):(0,Kn.X4)(e.palette[n.color].main,.5)},"outlined"===n.variant&&"horizontal"===n.orientation&&{borderRightColor:"transparent"},"outlined"===n.variant&&"vertical"===n.orientation&&{borderBottomColor:"transparent"},"contained"===n.variant&&"horizontal"===n.orientation&&{borderRight:"1px solid ".concat((e.vars||e).palette.grey[400]),["&.".concat(ga.disabled)]:{borderRight:"1px solid ".concat((e.vars||e).palette.action.disabled)}},"contained"===n.variant&&"vertical"===n.orientation&&{borderBottom:"1px solid ".concat((e.vars||e).palette.grey[400]),["&.".concat(ga.disabled)]:{borderBottom:"1px solid ".concat((e.vars||e).palette.action.disabled)}},"contained"===n.variant&&"inherit"!==n.color&&{borderColor:(e.vars||e).palette[n.color].dark},{"&:hover":(0,f.A)({},"outlined"===n.variant&&"horizontal"===n.orientation&&{borderRightColor:"currentColor"},"outlined"===n.variant&&"vertical"===n.orientation&&{borderBottomColor:"currentColor"})}),["& .".concat(ga.lastButton,",& .").concat(ga.middleButton)]:(0,f.A)({},"horizontal"===n.orientation&&{borderTopLeftRadius:0,borderBottomLeftRadius:0},"vertical"===n.orientation&&{borderTopRightRadius:0,borderTopLeftRadius:0},"outlined"===n.variant&&"horizontal"===n.orientation&&{marginLeft:-1},"outlined"===n.variant&&"vertical"===n.orientation&&{marginTop:-1})})})),ba=h.forwardRef((function(t,e){const n=(0,p.A)({props:t,name:"MuiButtonGroup"}),{children:r,className:i,color:o="primary",component:s="div",disabled:a=!1,disableElevation:l=!1,disableFocusRipple:c=!1,disableRipple:u=!1,fullWidth:d=!1,orientation:g="horizontal",size:m="medium",variant:b="outlined"}=n,y=(0,C.A)(n,ma),x=(0,f.A)({},n,{color:o,component:s,disabled:a,disableElevation:l,disableFocusRipple:c,disableRipple:u,fullWidth:d,orientation:g,size:m,variant:b}),A=(t=>{const{classes:e,color:n,disabled:r,disableElevation:i,fullWidth:o,orientation:s,variant:a}=t,l={root:["root",a,"vertical"===s&&"vertical",o&&"fullWidth",i&&"disableElevation"],grouped:["grouped","grouped".concat((0,Dn.A)(s)),"grouped".concat((0,Dn.A)(a)),"grouped".concat((0,Dn.A)(a)).concat((0,Dn.A)(s)),"grouped".concat((0,Dn.A)(a)).concat((0,Dn.A)(n)),r&&"disabled"],firstButton:["firstButton"],lastButton:["lastButton"],middleButton:["middleButton"]};return(0,Bn.A)(l,pa,e)})(x),_=h.useMemo((()=>({className:A.grouped,color:o,disabled:a,disableElevation:l,disableFocusRipple:c,disableRipple:u,fullWidth:d,size:m,variant:b})),[o,a,l,c,u,d,m,b,A.grouped]),w=function(t){return h.Children.toArray(t).filter((t=>h.isValidElement(t)))}(r),S=w.length,E=t=>{const e=0===t,n=t===S-1;return e&&n?"":e?A.firstButton:n?A.lastButton:A.middleButton};return(0,v.jsx)(va,(0,f.A)({as:s,role:"group",className:(0,wn.A)(A.root,i),ref:e,ownerState:x},y,{children:(0,v.jsx)(Ni.Provider,{value:_,children:w.map(((t,e)=>(0,v.jsx)(ji.Provider,{value:E(e),children:t},e)))})}))})),ya=ba;const xa=function(){const t=ut(),[e,n]=(0,h.useState)();(0,h.useLayoutEffect)((()=>{t(ds(e))}),[e]);const r=t=>{n({...e,VIEW_CONTROL_BUTTONS:t})};return(0,v.jsx)(ss,{children:(t=>{const e=[];for(const n in t)e.push((0,v.jsx)(Ji,{size:"small",onClick:()=>r(n),children:t[n].displayName},Math.random()));return(0,v.jsx)(ya,{fullWidth:!0,sx:{width:"100%"},color:"primary",children:e})})(An)})};const Aa=function(){return(0,v.jsx)(ss,{children:(0,v.jsx)(xa,{})})},_a=!1;var wa="unmounted",Sa="exited",Ca="entering",Ea="entered",Pa="exiting",Ma=function(t){function e(e,n){var r;r=t.call(this,e,n)||this;var i,o=n&&!n.isMounting?e.enter:e.appear;return r.appearStatus=null,e.in?o?(i=Sa,r.appearStatus=Ca):i=Ea:i=e.unmountOnExit||e.mountOnEnter?wa:Sa,r.state={status:i},r.nextCallback=null,r}jr(e,t),e.getDerivedStateFromProps=function(t,e){return t.in&&e.status===wa?{status:Sa}:null};var n=e.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(t){var e=null;if(t!==this.props){var n=this.state.status;this.props.in?n!==Ca&&n!==Ea&&(e=Ca):n!==Ca&&n!==Ea||(e=Pa)}this.updateStatus(!1,e)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var t,e,n,r=this.props.timeout;return t=e=n=r,null!=r&&"number"!==typeof r&&(t=r.exit,e=r.enter,n=void 0!==r.appear?r.appear:e),{exit:t,enter:e,appear:n}},n.updateStatus=function(t,e){if(void 0===t&&(t=!1),null!==e)if(this.cancelNextCallback(),e===Ca){if(this.props.unmountOnExit||this.props.mountOnEnter){var n=this.props.nodeRef?this.props.nodeRef.current:G.findDOMNode(this);n&&function(t){t.scrollTop}(n)}this.performEnter(t)}else this.performExit();else this.props.unmountOnExit&&this.state.status===Sa&&this.setState({status:wa})},n.performEnter=function(t){var e=this,n=this.props.enter,r=this.context?this.context.isMounting:t,i=this.props.nodeRef?[r]:[G.findDOMNode(this),r],o=i[0],s=i[1],a=this.getTimeouts(),l=r?a.appear:a.enter;!t&&!n||_a?this.safeSetState({status:Ea},(function(){e.props.onEntered(o)})):(this.props.onEnter(o,s),this.safeSetState({status:Ca},(function(){e.props.onEntering(o,s),e.onTransitionEnd(l,(function(){e.safeSetState({status:Ea},(function(){e.props.onEntered(o,s)}))}))})))},n.performExit=function(){var t=this,e=this.props.exit,n=this.getTimeouts(),r=this.props.nodeRef?void 0:G.findDOMNode(this);e&&!_a?(this.props.onExit(r),this.safeSetState({status:Pa},(function(){t.props.onExiting(r),t.onTransitionEnd(n.exit,(function(){t.safeSetState({status:Sa},(function(){t.props.onExited(r)}))}))}))):this.safeSetState({status:Sa},(function(){t.props.onExited(r)}))},n.cancelNextCallback=function(){null!==this.nextCallback&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(t,e){e=this.setNextCallback(e),this.setState(t,e)},n.setNextCallback=function(t){var e=this,n=!0;return this.nextCallback=function(r){n&&(n=!1,e.nextCallback=null,t(r))},this.nextCallback.cancel=function(){n=!1},this.nextCallback},n.onTransitionEnd=function(t,e){this.setNextCallback(e);var n=this.props.nodeRef?this.props.nodeRef.current:G.findDOMNode(this),r=null==t&&!this.props.addEndListener;if(n&&!r){if(this.props.addEndListener){var i=this.props.nodeRef?[this.nextCallback]:[n,this.nextCallback],o=i[0],s=i[1];this.props.addEndListener(o,s)}null!=t&&setTimeout(this.nextCallback,t)}else setTimeout(this.nextCallback,0)},n.render=function(){var t=this.state.status;if(t===wa)return null;var e=this.props,n=e.children,r=(e.in,e.mountOnEnter,e.unmountOnExit,e.appear,e.enter,e.exit,e.timeout,e.addEndListener,e.onEnter,e.onEntering,e.onEntered,e.onExit,e.onExiting,e.onExited,e.nodeRef,(0,C.A)(e,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]));return h.createElement(zr.Provider,{value:null},"function"===typeof n?n(t,r):h.cloneElement(h.Children.only(n),r))},e}(h.Component);function Ta(){}Ma.contextType=zr,Ma.propTypes={},Ma.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:Ta,onEntering:Ta,onEntered:Ta,onExit:Ta,onExiting:Ta,onExited:Ta},Ma.UNMOUNTED=wa,Ma.EXITED=Sa,Ma.ENTERING=Ca,Ma.ENTERED=Ea,Ma.EXITING=Pa;const Oa=Ma,ka=t=>t.scrollTop;function Ra(t,e){var n,r;const{timeout:i,easing:o,style:s={}}=t;return{duration:null!=(n=s.transitionDuration)?n:"number"===typeof i?i:i[e.mode]||0,easing:null!=(r=s.transitionTimingFunction)?r:"object"===typeof o?o[e.mode]:o,delay:s.transitionDelay}}const Ia=["addEndListener","appear","children","easing","in","onEnter","onEntered","onEntering","onExit","onExited","onExiting","style","timeout","TransitionComponent"];function Ba(t){return"scale(".concat(t,", ").concat(t**2,")")}const La={entering:{opacity:1,transform:Ba(1)},entered:{opacity:1,transform:"none"}},Da="undefined"!==typeof navigator&&/^((?!chrome|android).)*(safari|mobile)/i.test(navigator.userAgent)&&/(os |version\/)15(.|_)4/i.test(navigator.userAgent),Fa=h.forwardRef((function(t,e){const{addEndListener:n,appear:r=!0,children:i,easing:o,in:s,onEnter:a,onEntered:l,onEntering:c,onExit:u,onExited:d,onExiting:p,style:g,timeout:m="auto",TransitionComponent:b=Oa}=t,y=(0,C.A)(t,Ia),x=(0,Kr.A)(),A=h.useRef(),_=Ar(),w=h.useRef(null),S=(0,Lr.A)(w,i.ref,e),E=t=>e=>{if(t){const n=w.current;void 0===e?t(n):t(n,e)}},P=E(c),M=E(((t,e)=>{ka(t);const{duration:n,delay:r,easing:i}=Ra({style:g,timeout:m,easing:o},{mode:"enter"});let s;"auto"===m?(s=_.transitions.getAutoHeightDuration(t.clientHeight),A.current=s):s=n,t.style.transition=[_.transitions.create("opacity",{duration:s,delay:r}),_.transitions.create("transform",{duration:Da?s:.666*s,delay:r,easing:i})].join(","),a&&a(t,e)})),T=E(l),O=E(p),k=E((t=>{const{duration:e,delay:n,easing:r}=Ra({style:g,timeout:m,easing:o},{mode:"exit"});let i;"auto"===m?(i=_.transitions.getAutoHeightDuration(t.clientHeight),A.current=i):i=e,t.style.transition=[_.transitions.create("opacity",{duration:i,delay:n}),_.transitions.create("transform",{duration:Da?i:.666*i,delay:Da?n:n||.333*i,easing:r})].join(","),t.style.opacity=0,t.style.transform=Ba(.75),u&&u(t)})),R=E(d);return(0,v.jsx)(b,(0,f.A)({appear:r,in:s,nodeRef:w,onEnter:M,onEntered:T,onEntering:P,onExit:k,onExited:R,onExiting:O,addEndListener:t=>{"auto"===m&&x.start(A.current||0,t),n&&n(w.current,t)},timeout:"auto"===m?null:m},y,{children:(t,e)=>h.cloneElement(i,(0,f.A)({style:(0,f.A)({opacity:0,transform:Ba(.75),visibility:"exited"!==t||s?void 0:"hidden"},La[t],g,i.props.style),ref:S},e))}))}));Fa.muiSupportAuto=!0;const Na=Fa;function ja(t){if(null==t)return window;if("[object Window]"!==t.toString()){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function za(t){return t instanceof ja(t).Element||t instanceof Element}function Ua(t){return t instanceof ja(t).HTMLElement||t instanceof HTMLElement}function Va(t){return"undefined"!==typeof ShadowRoot&&(t instanceof ja(t).ShadowRoot||t instanceof ShadowRoot)}var Ga=Math.max,Wa=Math.min,Ha=Math.round;function Ja(){var t=navigator.userAgentData;return null!=t&&t.brands&&Array.isArray(t.brands)?t.brands.map((function(t){return t.brand+"/"+t.version})).join(" "):navigator.userAgent}function Ka(){return!/^((?!chrome|android).)*safari/i.test(Ja())}function Xa(t,e,n){void 0===e&&(e=!1),void 0===n&&(n=!1);var r=t.getBoundingClientRect(),i=1,o=1;e&&Ua(t)&&(i=t.offsetWidth>0&&Ha(r.width)/t.offsetWidth||1,o=t.offsetHeight>0&&Ha(r.height)/t.offsetHeight||1);var s=(za(t)?ja(t):window).visualViewport,a=!Ka()&&n,l=(r.left+(a&&s?s.offsetLeft:0))/i,c=(r.top+(a&&s?s.offsetTop:0))/o,u=r.width/i,d=r.height/o;return{width:u,height:d,top:c,right:l+u,bottom:c+d,left:l,x:l,y:c}}function qa(t){var e=ja(t);return{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function Ya(t){return t?(t.nodeName||"").toLowerCase():null}function Qa(t){return((za(t)?t.ownerDocument:t.document)||window.document).documentElement}function Za(t){return Xa(Qa(t)).left+qa(t).scrollLeft}function $a(t){return ja(t).getComputedStyle(t)}function tl(t){var e=$a(t),n=e.overflow,r=e.overflowX,i=e.overflowY;return/auto|scroll|overlay|hidden/.test(n+i+r)}function el(t,e,n){void 0===n&&(n=!1);var r=Ua(e),i=Ua(e)&&function(t){var e=t.getBoundingClientRect(),n=Ha(e.width)/t.offsetWidth||1,r=Ha(e.height)/t.offsetHeight||1;return 1!==n||1!==r}(e),o=Qa(e),s=Xa(t,i,n),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(r||!r&&!n)&&(("body"!==Ya(e)||tl(o))&&(a=function(t){return t!==ja(t)&&Ua(t)?{scrollLeft:(e=t).scrollLeft,scrollTop:e.scrollTop}:qa(t);var e}(e)),Ua(e)?((l=Xa(e,!0)).x+=e.clientLeft,l.y+=e.clientTop):o&&(l.x=Za(o))),{x:s.left+a.scrollLeft-l.x,y:s.top+a.scrollTop-l.y,width:s.width,height:s.height}}function nl(t){var e=Xa(t),n=t.offsetWidth,r=t.offsetHeight;return Math.abs(e.width-n)<=1&&(n=e.width),Math.abs(e.height-r)<=1&&(r=e.height),{x:t.offsetLeft,y:t.offsetTop,width:n,height:r}}function rl(t){return"html"===Ya(t)?t:t.assignedSlot||t.parentNode||(Va(t)?t.host:null)||Qa(t)}function il(t){return["html","body","#document"].indexOf(Ya(t))>=0?t.ownerDocument.body:Ua(t)&&tl(t)?t:il(rl(t))}function ol(t,e){var n;void 0===e&&(e=[]);var r=il(t),i=r===(null==(n=t.ownerDocument)?void 0:n.body),o=ja(r),s=i?[o].concat(o.visualViewport||[],tl(r)?r:[]):r,a=e.concat(s);return i?a:a.concat(ol(rl(s)))}function sl(t){return["table","td","th"].indexOf(Ya(t))>=0}function al(t){return Ua(t)&&"fixed"!==$a(t).position?t.offsetParent:null}function ll(t){for(var e=ja(t),n=al(t);n&&sl(n)&&"static"===$a(n).position;)n=al(n);return n&&("html"===Ya(n)||"body"===Ya(n)&&"static"===$a(n).position)?e:n||function(t){var e=/firefox/i.test(Ja());if(/Trident/i.test(Ja())&&Ua(t)&&"fixed"===$a(t).position)return null;var n=rl(t);for(Va(n)&&(n=n.host);Ua(n)&&["html","body"].indexOf(Ya(n))<0;){var r=$a(n);if("none"!==r.transform||"none"!==r.perspective||"paint"===r.contain||-1!==["transform","perspective"].indexOf(r.willChange)||e&&"filter"===r.willChange||e&&r.filter&&"none"!==r.filter)return n;n=n.parentNode}return null}(t)||e}var cl="top",ul="bottom",dl="right",hl="left",fl="auto",pl=[cl,ul,dl,hl],gl="start",ml="end",vl="clippingParents",bl="viewport",yl="popper",xl="reference",Al=pl.reduce((function(t,e){return t.concat([e+"-"+gl,e+"-"+ml])}),[]),_l=[].concat(pl,[fl]).reduce((function(t,e){return t.concat([e,e+"-"+gl,e+"-"+ml])}),[]),wl=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function Sl(t){var e=new Map,n=new Set,r=[];function i(t){n.add(t.name),[].concat(t.requires||[],t.requiresIfExists||[]).forEach((function(t){if(!n.has(t)){var r=e.get(t);r&&i(r)}})),r.push(t)}return t.forEach((function(t){e.set(t.name,t)})),t.forEach((function(t){n.has(t.name)||i(t)})),r}function Cl(t){var e;return function(){return e||(e=new Promise((function(n){Promise.resolve().then((function(){e=void 0,n(t())}))}))),e}}var El={placement:"bottom",modifiers:[],strategy:"absolute"};function Pl(){for(var t=arguments.length,e=new Array(t),n=0;n=0?"x":"y"}function Bl(t){var e,n=t.reference,r=t.element,i=t.placement,o=i?kl(i):null,s=i?Rl(i):null,a=n.x+n.width/2-r.width/2,l=n.y+n.height/2-r.height/2;switch(o){case cl:e={x:a,y:n.y-r.height};break;case ul:e={x:a,y:n.y+n.height};break;case dl:e={x:n.x+n.width,y:l};break;case hl:e={x:n.x-r.width,y:l};break;default:e={x:n.x,y:n.y}}var c=o?Il(o):null;if(null!=c){var u="y"===c?"height":"width";switch(s){case gl:e[c]=e[c]-(n[u]/2-r[u]/2);break;case ml:e[c]=e[c]+(n[u]/2-r[u]/2)}}return e}var Ll={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Dl(t){var e,n=t.popper,r=t.popperRect,i=t.placement,o=t.variation,s=t.offsets,a=t.position,l=t.gpuAcceleration,c=t.adaptive,u=t.roundOffsets,d=t.isFixed,h=s.x,f=void 0===h?0:h,p=s.y,g=void 0===p?0:p,m="function"===typeof u?u({x:f,y:g}):{x:f,y:g};f=m.x,g=m.y;var v=s.hasOwnProperty("x"),b=s.hasOwnProperty("y"),y=hl,x=cl,A=window;if(c){var _=ll(n),w="clientHeight",S="clientWidth";if(_===ja(n)&&"static"!==$a(_=Qa(n)).position&&"absolute"===a&&(w="scrollHeight",S="scrollWidth"),i===cl||(i===hl||i===dl)&&o===ml)x=ul,g-=(d&&_===A&&A.visualViewport?A.visualViewport.height:_[w])-r.height,g*=l?1:-1;if(i===hl||(i===cl||i===ul)&&o===ml)y=dl,f-=(d&&_===A&&A.visualViewport?A.visualViewport.width:_[S])-r.width,f*=l?1:-1}var C,E=Object.assign({position:a},c&&Ll),P=!0===u?function(t,e){var n=t.x,r=t.y,i=e.devicePixelRatio||1;return{x:Ha(n*i)/i||0,y:Ha(r*i)/i||0}}({x:f,y:g},ja(n)):{x:f,y:g};return f=P.x,g=P.y,l?Object.assign({},E,((C={})[x]=b?"0":"",C[y]=v?"0":"",C.transform=(A.devicePixelRatio||1)<=1?"translate("+f+"px, "+g+"px)":"translate3d("+f+"px, "+g+"px, 0)",C)):Object.assign({},E,((e={})[x]=b?g+"px":"",e[y]=v?f+"px":"",e.transform="",e))}const Fl={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(t){var e=t.state,n=t.options,r=n.gpuAcceleration,i=void 0===r||r,o=n.adaptive,s=void 0===o||o,a=n.roundOffsets,l=void 0===a||a,c={placement:kl(e.placement),variation:Rl(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:i,isFixed:"fixed"===e.options.strategy};null!=e.modifiersData.popperOffsets&&(e.styles.popper=Object.assign({},e.styles.popper,Dl(Object.assign({},c,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:s,roundOffsets:l})))),null!=e.modifiersData.arrow&&(e.styles.arrow=Object.assign({},e.styles.arrow,Dl(Object.assign({},c,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})},data:{}};const Nl={name:"applyStyles",enabled:!0,phase:"write",fn:function(t){var e=t.state;Object.keys(e.elements).forEach((function(t){var n=e.styles[t]||{},r=e.attributes[t]||{},i=e.elements[t];Ua(i)&&Ya(i)&&(Object.assign(i.style,n),Object.keys(r).forEach((function(t){var e=r[t];!1===e?i.removeAttribute(t):i.setAttribute(t,!0===e?"":e)})))}))},effect:function(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow),function(){Object.keys(e.elements).forEach((function(t){var r=e.elements[t],i=e.attributes[t]||{},o=Object.keys(e.styles.hasOwnProperty(t)?e.styles[t]:n[t]).reduce((function(t,e){return t[e]="",t}),{});Ua(r)&&Ya(r)&&(Object.assign(r.style,o),Object.keys(i).forEach((function(t){r.removeAttribute(t)})))}))}},requires:["computeStyles"]};const jl={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(t){var e=t.state,n=t.options,r=t.name,i=n.offset,o=void 0===i?[0,0]:i,s=_l.reduce((function(t,n){return t[n]=function(t,e,n){var r=kl(t),i=[hl,cl].indexOf(r)>=0?-1:1,o="function"===typeof n?n(Object.assign({},e,{placement:t})):n,s=o[0],a=o[1];return s=s||0,a=(a||0)*i,[hl,dl].indexOf(r)>=0?{x:a,y:s}:{x:s,y:a}}(n,e.rects,o),t}),{}),a=s[e.placement],l=a.x,c=a.y;null!=e.modifiersData.popperOffsets&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=c),e.modifiersData[r]=s}};var zl={left:"right",right:"left",bottom:"top",top:"bottom"};function Ul(t){return t.replace(/left|right|bottom|top/g,(function(t){return zl[t]}))}var Vl={start:"end",end:"start"};function Gl(t){return t.replace(/start|end/g,(function(t){return Vl[t]}))}function Wl(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(n&&Va(n)){var r=e;do{if(r&&t.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function Hl(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function Jl(t,e,n){return e===bl?Hl(function(t,e){var n=ja(t),r=Qa(t),i=n.visualViewport,o=r.clientWidth,s=r.clientHeight,a=0,l=0;if(i){o=i.width,s=i.height;var c=Ka();(c||!c&&"fixed"===e)&&(a=i.offsetLeft,l=i.offsetTop)}return{width:o,height:s,x:a+Za(t),y:l}}(t,n)):za(e)?function(t,e){var n=Xa(t,!1,"fixed"===e);return n.top=n.top+t.clientTop,n.left=n.left+t.clientLeft,n.bottom=n.top+t.clientHeight,n.right=n.left+t.clientWidth,n.width=t.clientWidth,n.height=t.clientHeight,n.x=n.left,n.y=n.top,n}(e,n):Hl(function(t){var e,n=Qa(t),r=qa(t),i=null==(e=t.ownerDocument)?void 0:e.body,o=Ga(n.scrollWidth,n.clientWidth,i?i.scrollWidth:0,i?i.clientWidth:0),s=Ga(n.scrollHeight,n.clientHeight,i?i.scrollHeight:0,i?i.clientHeight:0),a=-r.scrollLeft+Za(t),l=-r.scrollTop;return"rtl"===$a(i||n).direction&&(a+=Ga(n.clientWidth,i?i.clientWidth:0)-o),{width:o,height:s,x:a,y:l}}(Qa(t)))}function Kl(t,e,n,r){var i="clippingParents"===e?function(t){var e=ol(rl(t)),n=["absolute","fixed"].indexOf($a(t).position)>=0&&Ua(t)?ll(t):t;return za(n)?e.filter((function(t){return za(t)&&Wl(t,n)&&"body"!==Ya(t)})):[]}(t):[].concat(e),o=[].concat(i,[n]),s=o[0],a=o.reduce((function(e,n){var i=Jl(t,n,r);return e.top=Ga(i.top,e.top),e.right=Wa(i.right,e.right),e.bottom=Wa(i.bottom,e.bottom),e.left=Ga(i.left,e.left),e}),Jl(t,s,r));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function Xl(t){return Object.assign({},{top:0,right:0,bottom:0,left:0},t)}function ql(t,e){return e.reduce((function(e,n){return e[n]=t,e}),{})}function Yl(t,e){void 0===e&&(e={});var n=e,r=n.placement,i=void 0===r?t.placement:r,o=n.strategy,s=void 0===o?t.strategy:o,a=n.boundary,l=void 0===a?vl:a,c=n.rootBoundary,u=void 0===c?bl:c,d=n.elementContext,h=void 0===d?yl:d,f=n.altBoundary,p=void 0!==f&&f,g=n.padding,m=void 0===g?0:g,v=Xl("number"!==typeof m?m:ql(m,pl)),b=h===yl?xl:yl,y=t.rects.popper,x=t.elements[p?b:h],A=Kl(za(x)?x:x.contextElement||Qa(t.elements.popper),l,u,s),_=Xa(t.elements.reference),w=Bl({reference:_,element:y,strategy:"absolute",placement:i}),S=Hl(Object.assign({},y,w)),C=h===yl?S:_,E={top:A.top-C.top+v.top,bottom:C.bottom-A.bottom+v.bottom,left:A.left-C.left+v.left,right:C.right-A.right+v.right},P=t.modifiersData.offset;if(h===yl&&P){var M=P[i];Object.keys(E).forEach((function(t){var e=[dl,ul].indexOf(t)>=0?1:-1,n=[cl,ul].indexOf(t)>=0?"y":"x";E[t]+=M[n]*e}))}return E}const Ql={name:"flip",enabled:!0,phase:"main",fn:function(t){var e=t.state,n=t.options,r=t.name;if(!e.modifiersData[r]._skip){for(var i=n.mainAxis,o=void 0===i||i,s=n.altAxis,a=void 0===s||s,l=n.fallbackPlacements,c=n.padding,u=n.boundary,d=n.rootBoundary,h=n.altBoundary,f=n.flipVariations,p=void 0===f||f,g=n.allowedAutoPlacements,m=e.options.placement,v=kl(m),b=l||(v===m||!p?[Ul(m)]:function(t){if(kl(t)===fl)return[];var e=Ul(t);return[Gl(t),e,Gl(e)]}(m)),y=[m].concat(b).reduce((function(t,n){return t.concat(kl(n)===fl?function(t,e){void 0===e&&(e={});var n=e,r=n.placement,i=n.boundary,o=n.rootBoundary,s=n.padding,a=n.flipVariations,l=n.allowedAutoPlacements,c=void 0===l?_l:l,u=Rl(r),d=u?a?Al:Al.filter((function(t){return Rl(t)===u})):pl,h=d.filter((function(t){return c.indexOf(t)>=0}));0===h.length&&(h=d);var f=h.reduce((function(e,n){return e[n]=Yl(t,{placement:n,boundary:i,rootBoundary:o,padding:s})[kl(n)],e}),{});return Object.keys(f).sort((function(t,e){return f[t]-f[e]}))}(e,{placement:n,boundary:u,rootBoundary:d,padding:c,flipVariations:p,allowedAutoPlacements:g}):n)}),[]),x=e.rects.reference,A=e.rects.popper,_=new Map,w=!0,S=y[0],C=0;C=0,O=T?"width":"height",k=Yl(e,{placement:E,boundary:u,rootBoundary:d,altBoundary:h,padding:c}),R=T?M?dl:hl:M?ul:cl;x[O]>A[O]&&(R=Ul(R));var I=Ul(R),B=[];if(o&&B.push(k[P]<=0),a&&B.push(k[R]<=0,k[I]<=0),B.every((function(t){return t}))){S=E,w=!1;break}_.set(E,B)}if(w)for(var L=function(t){var e=y.find((function(e){var n=_.get(e);if(n)return n.slice(0,t).every((function(t){return t}))}));if(e)return S=e,"break"},D=p?3:1;D>0;D--){if("break"===L(D))break}e.placement!==S&&(e.modifiersData[r]._skip=!0,e.placement=S,e.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}};function Zl(t,e,n){return Ga(t,Wa(e,n))}const $l={name:"preventOverflow",enabled:!0,phase:"main",fn:function(t){var e=t.state,n=t.options,r=t.name,i=n.mainAxis,o=void 0===i||i,s=n.altAxis,a=void 0!==s&&s,l=n.boundary,c=n.rootBoundary,u=n.altBoundary,d=n.padding,h=n.tether,f=void 0===h||h,p=n.tetherOffset,g=void 0===p?0:p,m=Yl(e,{boundary:l,rootBoundary:c,padding:d,altBoundary:u}),v=kl(e.placement),b=Rl(e.placement),y=!b,x=Il(v),A="x"===x?"y":"x",_=e.modifiersData.popperOffsets,w=e.rects.reference,S=e.rects.popper,C="function"===typeof g?g(Object.assign({},e.rects,{placement:e.placement})):g,E="number"===typeof C?{mainAxis:C,altAxis:C}:Object.assign({mainAxis:0,altAxis:0},C),P=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,M={x:0,y:0};if(_){if(o){var T,O="y"===x?cl:hl,k="y"===x?ul:dl,R="y"===x?"height":"width",I=_[x],B=I+m[O],L=I-m[k],D=f?-S[R]/2:0,F=b===gl?w[R]:S[R],N=b===gl?-S[R]:-w[R],j=e.elements.arrow,z=f&&j?nl(j):{width:0,height:0},U=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},V=U[O],G=U[k],W=Zl(0,w[R],z[R]),H=y?w[R]/2-D-W-V-E.mainAxis:F-W-V-E.mainAxis,J=y?-w[R]/2+D+W+G+E.mainAxis:N+W+G+E.mainAxis,K=e.elements.arrow&&ll(e.elements.arrow),X=K?"y"===x?K.clientTop||0:K.clientLeft||0:0,q=null!=(T=null==P?void 0:P[x])?T:0,Y=I+J-q,Q=Zl(f?Wa(B,I+H-q-X):B,I,f?Ga(L,Y):L);_[x]=Q,M[x]=Q-I}if(a){var Z,$="x"===x?cl:hl,tt="x"===x?ul:dl,et=_[A],nt="y"===A?"height":"width",rt=et+m[$],it=et-m[tt],ot=-1!==[cl,hl].indexOf(v),st=null!=(Z=null==P?void 0:P[A])?Z:0,at=ot?rt:et-w[nt]-S[nt]-st+E.altAxis,lt=ot?et+w[nt]+S[nt]-st-E.altAxis:it,ct=f&&ot?function(t,e,n){var r=Zl(t,e,n);return r>n?n:r}(at,et,lt):Zl(f?at:rt,et,f?lt:it);_[A]=ct,M[A]=ct-et}e.modifiersData[r]=M}},requiresIfExists:["offset"]};const tc={name:"arrow",enabled:!0,phase:"main",fn:function(t){var e,n=t.state,r=t.name,i=t.options,o=n.elements.arrow,s=n.modifiersData.popperOffsets,a=kl(n.placement),l=Il(a),c=[hl,dl].indexOf(a)>=0?"height":"width";if(o&&s){var u=function(t,e){return Xl("number"!==typeof(t="function"===typeof t?t(Object.assign({},e.rects,{placement:e.placement})):t)?t:ql(t,pl))}(i.padding,n),d=nl(o),h="y"===l?cl:hl,f="y"===l?ul:dl,p=n.rects.reference[c]+n.rects.reference[l]-s[l]-n.rects.popper[c],g=s[l]-n.rects.reference[l],m=ll(o),v=m?"y"===l?m.clientHeight||0:m.clientWidth||0:0,b=p/2-g/2,y=u[h],x=v-d[c]-u[f],A=v/2-d[c]/2+b,_=Zl(y,A,x),w=l;n.modifiersData[r]=((e={})[w]=_,e.centerOffset=_-A,e)}},effect:function(t){var e=t.state,n=t.options.element,r=void 0===n?"[data-popper-arrow]":n;null!=r&&("string"!==typeof r||(r=e.elements.popper.querySelector(r)))&&Wl(e.elements.popper,r)&&(e.elements.arrow=r)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function ec(t,e,n){return void 0===n&&(n={x:0,y:0}),{top:t.top-e.height-n.y,right:t.right-e.width+n.x,bottom:t.bottom-e.height+n.y,left:t.left-e.width-n.x}}function nc(t){return[cl,dl,ul,hl].some((function(e){return t[e]>=0}))}var rc=Ml({defaultModifiers:[Ol,{name:"popperOffsets",enabled:!0,phase:"read",fn:function(t){var e=t.state,n=t.name;e.modifiersData[n]=Bl({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})},data:{}},Fl,Nl,jl,Ql,$l,tc,{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(t){var e=t.state,n=t.name,r=e.rects.reference,i=e.rects.popper,o=e.modifiersData.preventOverflow,s=Yl(e,{elementContext:"reference"}),a=Yl(e,{altBoundary:!0}),l=ec(s,r),c=ec(a,i,o),u=nc(l),d=nc(c);e.modifiersData[n]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:u,hasPopperEscaped:d},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":d})}}]}),ic=n(9184);const oc=h.forwardRef((function(t,e){const{children:n,container:r,disablePortal:i=!1}=t,[o,s]=h.useState(null),a=(0,fo.A)(h.isValidElement(n)?n.ref:null,e);if((0,wo.A)((()=>{i||s(function(t){return"function"===typeof t?t():t}(r)||document.body)}),[r,i]),(0,wo.A)((()=>{if(o&&!i)return(0,ic.A)(e,o),()=>{(0,ic.A)(e,null)}}),[e,o,i]),i){if(h.isValidElement(n)){const t={ref:a};return h.cloneElement(n,t)}return(0,v.jsx)(h.Fragment,{children:n})}return(0,v.jsx)(h.Fragment,{children:o?G.createPortal(n,o):o})}));const sc="base";function ac(t,e){const n=Fn.li[e];return n?(r=n,"".concat(sc,"--").concat(r)):function(t,e){return"".concat(sc,"-").concat(t,"-").concat(e)}(t,e);var r}const lc="Popper";function cc(t){return ac(lc,t)}!function(t,e){const n={};e.forEach((e=>{n[e]=ac(t,e)}))}(lc,["root"]);const uc={disableDefaultClasses:!1},dc=h.createContext(uc);const hc=["anchorEl","children","direction","disablePortal","modifiers","open","placement","popperOptions","popperRef","slotProps","slots","TransitionProps","ownerState"],fc=["anchorEl","children","container","direction","disablePortal","keepMounted","modifiers","open","placement","popperOptions","popperRef","style","transition","slotProps","slots"];function pc(t){return"function"===typeof t?t():t}function gc(t){return void 0!==t.nodeType}const mc=()=>(0,Bn.A)({root:["root"]},function(t){const{disableDefaultClasses:e}=h.useContext(dc);return n=>e?"":t(n)}(cc)),vc={},bc=h.forwardRef((function(t,e){var n;const{anchorEl:r,children:i,direction:o,disablePortal:s,modifiers:a,open:l,placement:c,popperOptions:u,popperRef:d,slotProps:p={},slots:g={},TransitionProps:m}=t,b=(0,C.A)(t,hc),y=h.useRef(null),x=(0,fo.A)(y,e),A=h.useRef(null),_=(0,fo.A)(A,d),w=h.useRef(_);(0,wo.A)((()=>{w.current=_}),[_]),h.useImperativeHandle(d,(()=>A.current),[]);const S=function(t,e){if("ltr"===e)return t;switch(t){case"bottom-end":return"bottom-start";case"bottom-start":return"bottom-end";case"top-end":return"top-start";case"top-start":return"top-end";default:return t}}(c,o),[E,P]=h.useState(S),[M,T]=h.useState(pc(r));h.useEffect((()=>{A.current&&A.current.forceUpdate()})),h.useEffect((()=>{r&&T(pc(r))}),[r]),(0,wo.A)((()=>{if(!M||!l)return;let t=[{name:"preventOverflow",options:{altBoundary:s}},{name:"flip",options:{altBoundary:s}},{name:"onUpdate",enabled:!0,phase:"afterWrite",fn:t=>{let{state:e}=t;P(e.placement)}}];null!=a&&(t=t.concat(a)),u&&null!=u.modifiers&&(t=t.concat(u.modifiers));const e=rc(M,y.current,(0,f.A)({placement:S},u,{modifiers:t}));return w.current(e),()=>{e.destroy(),w.current(null)}}),[M,s,a,l,u,S]);const O={placement:E};null!==m&&(O.TransitionProps=m);const k=mc(),R=null!=(n=g.root)?n:"div",I=bo({elementType:R,externalSlotProps:p.root,externalForwardedProps:b,additionalProps:{role:"tooltip",ref:x},ownerState:t,className:k.root});return(0,v.jsx)(R,(0,f.A)({},I,{children:"function"===typeof i?i(O):i}))})),yc=h.forwardRef((function(t,e){const{anchorEl:n,children:r,container:i,direction:o="ltr",disablePortal:s=!1,keepMounted:a=!1,modifiers:l,open:c,placement:u="bottom",popperOptions:d=vc,popperRef:p,style:g,transition:m=!1,slotProps:b={},slots:y={}}=t,x=(0,C.A)(t,fc),[A,_]=h.useState(!0);if(!a&&!c&&(!m||A))return null;let w;if(i)w=i;else if(n){const t=pc(n);w=t&&gc(t)?(0,yo.A)(t).body:(0,yo.A)(null).body}const S=c||!a||m&&!A?void 0:"none",E=m?{in:c,onEnter:()=>{_(!1)},onExited:()=>{_(!0)}}:void 0;return(0,v.jsx)(oc,{disablePortal:s,container:w,children:(0,v.jsx)(bc,(0,f.A)({anchorEl:n,direction:o,disablePortal:s,modifiers:l,ref:e,open:m?!A:c,placement:u,popperOptions:d,popperRef:p,slotProps:b,slots:y},x,{style:(0,f.A)({position:"fixed",top:0,left:0,display:S},g),TransitionProps:E,children:r}))})}));var xc=n(2374);const Ac=["anchorEl","component","components","componentsProps","container","disablePortal","keepMounted","modifiers","open","placement","popperOptions","popperRef","transition","slots","slotProps"],_c=(0,Ln.Ay)(yc,{name:"MuiPopper",slot:"Root",overridesResolver:(t,e)=>e.root})({}),wc=h.forwardRef((function(t,e){var n;const r=(0,xc.A)(),i=(0,p.A)({props:t,name:"MuiPopper"}),{anchorEl:o,component:s,components:a,componentsProps:l,container:c,disablePortal:u,keepMounted:d,modifiers:h,open:g,placement:m,popperOptions:b,popperRef:y,transition:x,slots:A,slotProps:_}=i,w=(0,C.A)(i,Ac),S=null!=(n=null==A?void 0:A.root)?n:null==a?void 0:a.Root,E=(0,f.A)({anchorEl:o,container:c,disablePortal:u,keepMounted:d,modifiers:h,open:g,placement:m,popperOptions:b,popperRef:y,transition:x},w);return(0,v.jsx)(_c,(0,f.A)({as:s,direction:null==r?void 0:r.direction,slots:{root:S},slotProps:null!=_?_:l},E,{ref:e}))})),Sc=wc;var Cc=n(5879);function Ec(t){return(0,Fn.Ay)("MuiTooltip",t)}const Pc=(0,Tn.A)("MuiTooltip",["popper","popperInteractive","popperArrow","popperClose","tooltip","tooltipArrow","touch","tooltipPlacementLeft","tooltipPlacementRight","tooltipPlacementTop","tooltipPlacementBottom","arrow"]),Mc=["arrow","children","classes","components","componentsProps","describeChild","disableFocusListener","disableHoverListener","disableInteractive","disableTouchListener","enterDelay","enterNextDelay","enterTouchDelay","followCursor","id","leaveDelay","leaveTouchDelay","onClose","onOpen","open","placement","PopperComponent","PopperProps","slotProps","slots","title","TransitionComponent","TransitionProps"];const Tc=(0,Ln.Ay)(Sc,{name:"MuiTooltip",slot:"Popper",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.popper,!n.disableInteractive&&e.popperInteractive,n.arrow&&e.popperArrow,!n.open&&e.popperClose]}})((t=>{let{theme:e,ownerState:n,open:r}=t;return(0,f.A)({zIndex:(e.vars||e).zIndex.tooltip,pointerEvents:"none"},!n.disableInteractive&&{pointerEvents:"auto"},!r&&{pointerEvents:"none"},n.arrow&&{['&[data-popper-placement*="bottom"] .'.concat(Pc.arrow)]:{top:0,marginTop:"-0.71em","&::before":{transformOrigin:"0 100%"}},['&[data-popper-placement*="top"] .'.concat(Pc.arrow)]:{bottom:0,marginBottom:"-0.71em","&::before":{transformOrigin:"100% 0"}},['&[data-popper-placement*="right"] .'.concat(Pc.arrow)]:(0,f.A)({},n.isRtl?{right:0,marginRight:"-0.71em"}:{left:0,marginLeft:"-0.71em"},{height:"1em",width:"0.71em","&::before":{transformOrigin:"100% 100%"}}),['&[data-popper-placement*="left"] .'.concat(Pc.arrow)]:(0,f.A)({},n.isRtl?{left:0,marginLeft:"-0.71em"}:{right:0,marginRight:"-0.71em"},{height:"1em",width:"0.71em","&::before":{transformOrigin:"0 0"}})})})),Oc=(0,Ln.Ay)("div",{name:"MuiTooltip",slot:"Tooltip",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.tooltip,n.touch&&e.touch,n.arrow&&e.tooltipArrow,e["tooltipPlacement".concat((0,Dn.A)(n.placement.split("-")[0]))]]}})((t=>{let{theme:e,ownerState:n}=t;return(0,f.A)({backgroundColor:e.vars?e.vars.palette.Tooltip.bg:(0,Kn.X4)(e.palette.grey[700],.92),borderRadius:(e.vars||e).shape.borderRadius,color:(e.vars||e).palette.common.white,fontFamily:e.typography.fontFamily,padding:"4px 8px",fontSize:e.typography.pxToRem(11),maxWidth:300,margin:2,wordWrap:"break-word",fontWeight:e.typography.fontWeightMedium},n.arrow&&{position:"relative",margin:0},n.touch&&{padding:"8px 16px",fontSize:e.typography.pxToRem(14),lineHeight:"".concat((r=16/14,Math.round(1e5*r)/1e5),"em"),fontWeight:e.typography.fontWeightRegular},{[".".concat(Pc.popper,'[data-popper-placement*="left"] &')]:(0,f.A)({transformOrigin:"right center"},n.isRtl?(0,f.A)({marginLeft:"14px"},n.touch&&{marginLeft:"24px"}):(0,f.A)({marginRight:"14px"},n.touch&&{marginRight:"24px"})),[".".concat(Pc.popper,'[data-popper-placement*="right"] &')]:(0,f.A)({transformOrigin:"left center"},n.isRtl?(0,f.A)({marginRight:"14px"},n.touch&&{marginRight:"24px"}):(0,f.A)({marginLeft:"14px"},n.touch&&{marginLeft:"24px"})),[".".concat(Pc.popper,'[data-popper-placement*="top"] &')]:(0,f.A)({transformOrigin:"center bottom",marginBottom:"14px"},n.touch&&{marginBottom:"24px"}),[".".concat(Pc.popper,'[data-popper-placement*="bottom"] &')]:(0,f.A)({transformOrigin:"center top",marginTop:"14px"},n.touch&&{marginTop:"24px"})});var r})),kc=(0,Ln.Ay)("span",{name:"MuiTooltip",slot:"Arrow",overridesResolver:(t,e)=>e.arrow})((t=>{let{theme:e}=t;return{overflow:"hidden",position:"absolute",width:"1em",height:"0.71em",boxSizing:"border-box",color:e.vars?e.vars.palette.Tooltip.bg:(0,Kn.X4)(e.palette.grey[700],.9),"&::before":{content:'""',margin:"auto",display:"block",width:"100%",height:"100%",backgroundColor:"currentColor",transform:"rotate(45deg)"}}}));let Rc=!1;const Ic=new Kr.E;let Bc={x:0,y:0};function Lc(t,e){return function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o{void 0!==yt.current&&(document.body.style.WebkitUserSelect=yt.current,yt.current=void 0),pt.clear()}));h.useEffect((()=>xt),[xt]);const At=t=>{Ic.clear(),Rc=!0,mt(!0),H&&!vt&&H(t)},_t=(0,Dr.A)((t=>{Ic.start(800+V,(()=>{Rc=!1})),mt(!1),W&&vt&&W(t),dt.start(rt.transitions.duration.shortest,(()=>{ct.current=!1}))})),wt=t=>{ct.current&&"touchstart"!==t.type||(ot&&ot.removeAttribute("title"),ht.clear(),ft.clear(),F||Rc&&N?ht.start(Rc?N:F,(()=>{At(t)})):At(t))},St=t=>{ht.clear(),ft.start(V,(()=>{_t(t)}))},{isFocusVisibleRef:Ct,onBlur:Et,onFocus:Pt,ref:Mt}=(0,Fr.A)(),[,Tt]=h.useState(!1),Ot=t=>{Et(t),!1===Ct.current&&(Tt(!1),St(t))},kt=t=>{ot||st(t.currentTarget),Pt(t),!0===Ct.current&&(Tt(!0),wt(t))},Rt=t=>{ct.current=!0;const e=nt.props;e.onTouchStart&&e.onTouchStart(t)},It=t=>{Rt(t),ft.clear(),dt.clear(),xt(),yt.current=document.body.style.WebkitUserSelect,document.body.style.WebkitUserSelect="none",pt.start(j,(()=>{document.body.style.WebkitUserSelect=yt.current,wt(t)}))},Bt=t=>{nt.props.onTouchEnd&&nt.props.onTouchEnd(t),xt(),ft.start(G,(()=>{_t(t)}))};h.useEffect((()=>{if(vt)return document.addEventListener("keydown",t),()=>{document.removeEventListener("keydown",t)};function t(t){"Escape"!==t.key&&"Esc"!==t.key||_t(t)}}),[_t,vt]);const Lt=(0,Lr.A)(nt.ref,Mt,st,e);Z||0===Z||(vt=!1);const Dt=h.useRef(),Ft={},Nt="string"===typeof Z;k?(Ft.title=vt||!Nt||I?null:Z,Ft["aria-describedby"]=vt?bt:null):(Ft["aria-label"]=Nt?Z:null,Ft["aria-labelledby"]=vt&&!Nt?bt:null);const jt=(0,f.A)({},Ft,et,nt.props,{className:(0,wn.A)(et.className,nt.props.className),onTouchStart:Rt,ref:Lt},z?{onMouseMove:t=>{const e=nt.props;e.onMouseMove&&e.onMouseMove(t),Bc={x:t.clientX,y:t.clientY},Dt.current&&Dt.current.update()}}:{});const zt={};D||(jt.onTouchStart=It,jt.onTouchEnd=Bt),I||(jt.onMouseOver=Lc(wt,jt.onMouseOver),jt.onMouseLeave=Lc(St,jt.onMouseLeave),ut||(zt.onMouseOver=wt,zt.onMouseLeave=St)),R||(jt.onFocus=Lc(kt,jt.onFocus),jt.onBlur=Lc(Ot,jt.onBlur),ut||(zt.onFocus=kt,zt.onBlur=Ot));const Ut=h.useMemo((()=>{var t;let e=[{name:"arrow",enabled:Boolean(at),options:{element:at,padding:4}}];return null!=(t=q.popperOptions)&&t.modifiers&&(e=e.concat(q.popperOptions.modifiers)),(0,f.A)({},q.popperOptions,{modifiers:e})}),[at,q]),Vt=(0,f.A)({},E,{isRtl:it,arrow:P,disableInteractive:ut,placement:K,PopperComponentProp:X,touch:ct.current}),Gt=(t=>{const{classes:e,disableInteractive:n,arrow:r,touch:i,placement:o}=t,s={popper:["popper",!n&&"popperInteractive",r&&"popperArrow"],tooltip:["tooltip",r&&"tooltipArrow",i&&"touch","tooltipPlacement".concat((0,Dn.A)(o.split("-")[0]))],arrow:["arrow"]};return(0,Bn.A)(s,Ec,e)})(Vt),Wt=null!=(n=null!=(r=Q.popper)?r:T.Popper)?n:Tc,Ht=null!=(i=null!=(o=null!=(s=Q.transition)?s:T.Transition)?o:$)?i:Na,Jt=null!=(a=null!=(l=Q.tooltip)?l:T.Tooltip)?a:Oc,Kt=null!=(c=null!=(u=Q.arrow)?u:T.Arrow)?c:kc,Xt=po(Wt,(0,f.A)({},q,null!=(d=Y.popper)?d:O.popper,{className:(0,wn.A)(Gt.popper,null==q?void 0:q.className,null==(g=null!=(m=Y.popper)?m:O.popper)?void 0:g.className)}),Vt),qt=po(Ht,(0,f.A)({},tt,null!=(b=Y.transition)?b:O.transition),Vt),Yt=po(Jt,(0,f.A)({},null!=(y=Y.tooltip)?y:O.tooltip,{className:(0,wn.A)(Gt.tooltip,null==(x=null!=(A=Y.tooltip)?A:O.tooltip)?void 0:x.className)}),Vt),Qt=po(Kt,(0,f.A)({},null!=(_=Y.arrow)?_:O.arrow,{className:(0,wn.A)(Gt.arrow,null==(w=null!=(S=Y.arrow)?S:O.arrow)?void 0:w.className)}),Vt);return(0,v.jsxs)(h.Fragment,{children:[h.cloneElement(nt,jt),(0,v.jsx)(Wt,(0,f.A)({as:null!=X?X:Sc,placement:K,anchorEl:z?{getBoundingClientRect:()=>({top:Bc.y,left:Bc.x,right:Bc.x,bottom:Bc.y,width:0,height:0})}:ot,popperRef:Dt,open:!!ot&&vt,id:bt,transition:!0},zt,Xt,{popperOptions:Ut,children:t=>{let{TransitionProps:e}=t;return(0,v.jsx)(Ht,(0,f.A)({timeout:rt.transitions.duration.shorter},e,qt,{children:(0,v.jsxs)(Jt,(0,f.A)({},Yt,{children:[Z,P?(0,v.jsx)(Kt,(0,f.A)({},Qt,{ref:lt})):null]}))}))}}))]})})),Fc=Dc;function Nc(t){return(0,Fn.Ay)("MuiIconButton",t)}const jc=(0,Tn.A)("MuiIconButton",["root","disabled","colorInherit","colorPrimary","colorSecondary","colorError","colorInfo","colorSuccess","colorWarning","edgeStart","edgeEnd","sizeSmall","sizeMedium","sizeLarge"]),zc=["edge","children","className","color","disabled","disableFocusRipple","size"],Uc=(0,Ln.Ay)(mi,{name:"MuiIconButton",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,"default"!==n.color&&e["color".concat((0,Dn.A)(n.color))],n.edge&&e["edge".concat((0,Dn.A)(n.edge))],e["size".concat((0,Dn.A)(n.size))]]}})((t=>{let{theme:e,ownerState:n}=t;return(0,f.A)({textAlign:"center",flex:"0 0 auto",fontSize:e.typography.pxToRem(24),padding:8,borderRadius:"50%",overflow:"visible",color:(e.vars||e).palette.action.active,transition:e.transitions.create("background-color",{duration:e.transitions.duration.shortest})},!n.disableRipple&&{"&:hover":{backgroundColor:e.vars?"rgba(".concat(e.vars.palette.action.activeChannel," / ").concat(e.vars.palette.action.hoverOpacity,")"):(0,Kn.X4)(e.palette.action.active,e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}}},"start"===n.edge&&{marginLeft:"small"===n.size?-3:-12},"end"===n.edge&&{marginRight:"small"===n.size?-3:-12})}),(t=>{let{theme:e,ownerState:n}=t;var r;const i=null==(r=(e.vars||e).palette)?void 0:r[n.color];return(0,f.A)({},"inherit"===n.color&&{color:"inherit"},"inherit"!==n.color&&"default"!==n.color&&(0,f.A)({color:null==i?void 0:i.main},!n.disableRipple&&{"&:hover":(0,f.A)({},i&&{backgroundColor:e.vars?"rgba(".concat(i.mainChannel," / ").concat(e.vars.palette.action.hoverOpacity,")"):(0,Kn.X4)(i.main,e.palette.action.hoverOpacity)},{"@media (hover: none)":{backgroundColor:"transparent"}})}),"small"===n.size&&{padding:5,fontSize:e.typography.pxToRem(18)},"large"===n.size&&{padding:12,fontSize:e.typography.pxToRem(28)},{["&.".concat(jc.disabled)]:{backgroundColor:"transparent",color:(e.vars||e).palette.action.disabled}})})),Vc=h.forwardRef((function(t,e){const n=(0,p.A)({props:t,name:"MuiIconButton"}),{edge:r=!1,children:i,className:o,color:s="default",disabled:a=!1,disableFocusRipple:l=!1,size:c="medium"}=n,u=(0,C.A)(n,zc),d=(0,f.A)({},n,{edge:r,color:s,disabled:a,disableFocusRipple:l,size:c}),h=(t=>{const{classes:e,disabled:n,color:r,edge:i,size:o}=t,s={root:["root",n&&"disabled","default"!==r&&"color".concat((0,Dn.A)(r)),i&&"edge".concat((0,Dn.A)(i)),"size".concat((0,Dn.A)(o))]};return(0,Bn.A)(s,Nc,e)})(d);return(0,v.jsx)(Uc,(0,f.A)({className:(0,wn.A)(h.root,o),centerRipple:!0,focusRipple:!l,disabled:a,ref:e},u,{ownerState:d,children:i}))})),Gc=Vc,Wc=t=>{const e=h.useRef({});return h.useEffect((()=>{e.current=t})),e.current};function Hc(t){return(0,Fn.Ay)("MuiBadge",t)}const Jc=(0,Tn.A)("MuiBadge",["root","badge","dot","standard","anchorOriginTopRight","anchorOriginBottomRight","anchorOriginTopLeft","anchorOriginBottomLeft","invisible","colorError","colorInfo","colorPrimary","colorSecondary","colorSuccess","colorWarning","overlapRectangular","overlapCircular","anchorOriginTopLeftCircular","anchorOriginTopLeftRectangular","anchorOriginTopRightCircular","anchorOriginTopRightRectangular","anchorOriginBottomLeftCircular","anchorOriginBottomLeftRectangular","anchorOriginBottomRightCircular","anchorOriginBottomRightRectangular"]),Kc=["anchorOrigin","className","classes","component","components","componentsProps","children","overlap","color","invisible","max","badgeContent","slots","slotProps","showZero","variant"],Xc=jo(),qc=(0,Ln.Ay)("span",{name:"MuiBadge",slot:"Root",overridesResolver:(t,e)=>e.root})({position:"relative",display:"inline-flex",verticalAlign:"middle",flexShrink:0}),Yc=(0,Ln.Ay)("span",{name:"MuiBadge",slot:"Badge",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.badge,e[n.variant],e["anchorOrigin".concat((0,Dn.A)(n.anchorOrigin.vertical)).concat((0,Dn.A)(n.anchorOrigin.horizontal)).concat((0,Dn.A)(n.overlap))],"default"!==n.color&&e["color".concat((0,Dn.A)(n.color))],n.invisible&&e.invisible]}})((t=>{let{theme:e}=t;var n;return{display:"flex",flexDirection:"row",flexWrap:"wrap",justifyContent:"center",alignContent:"center",alignItems:"center",position:"absolute",boxSizing:"border-box",fontFamily:e.typography.fontFamily,fontWeight:e.typography.fontWeightMedium,fontSize:e.typography.pxToRem(12),minWidth:20,lineHeight:1,padding:"0 6px",height:20,borderRadius:10,zIndex:1,transition:e.transitions.create("transform",{easing:e.transitions.easing.easeInOut,duration:e.transitions.duration.enteringScreen}),variants:[...Object.keys((null!=(n=e.vars)?n:e).palette).filter((t=>{var n,r;return(null!=(n=e.vars)?n:e).palette[t].main&&(null!=(r=e.vars)?r:e).palette[t].contrastText})).map((t=>({props:{color:t},style:{backgroundColor:(e.vars||e).palette[t].main,color:(e.vars||e).palette[t].contrastText}}))),{props:{variant:"dot"},style:{borderRadius:4,height:8,minWidth:8,padding:0}},{props:t=>{let{ownerState:e}=t;return"top"===e.anchorOrigin.vertical&&"right"===e.anchorOrigin.horizontal&&"rectangular"===e.overlap},style:{top:0,right:0,transform:"scale(1) translate(50%, -50%)",transformOrigin:"100% 0%",["&.".concat(Jc.invisible)]:{transform:"scale(0) translate(50%, -50%)"}}},{props:t=>{let{ownerState:e}=t;return"bottom"===e.anchorOrigin.vertical&&"right"===e.anchorOrigin.horizontal&&"rectangular"===e.overlap},style:{bottom:0,right:0,transform:"scale(1) translate(50%, 50%)",transformOrigin:"100% 100%",["&.".concat(Jc.invisible)]:{transform:"scale(0) translate(50%, 50%)"}}},{props:t=>{let{ownerState:e}=t;return"top"===e.anchorOrigin.vertical&&"left"===e.anchorOrigin.horizontal&&"rectangular"===e.overlap},style:{top:0,left:0,transform:"scale(1) translate(-50%, -50%)",transformOrigin:"0% 0%",["&.".concat(Jc.invisible)]:{transform:"scale(0) translate(-50%, -50%)"}}},{props:t=>{let{ownerState:e}=t;return"bottom"===e.anchorOrigin.vertical&&"left"===e.anchorOrigin.horizontal&&"rectangular"===e.overlap},style:{bottom:0,left:0,transform:"scale(1) translate(-50%, 50%)",transformOrigin:"0% 100%",["&.".concat(Jc.invisible)]:{transform:"scale(0) translate(-50%, 50%)"}}},{props:t=>{let{ownerState:e}=t;return"top"===e.anchorOrigin.vertical&&"right"===e.anchorOrigin.horizontal&&"circular"===e.overlap},style:{top:"14%",right:"14%",transform:"scale(1) translate(50%, -50%)",transformOrigin:"100% 0%",["&.".concat(Jc.invisible)]:{transform:"scale(0) translate(50%, -50%)"}}},{props:t=>{let{ownerState:e}=t;return"bottom"===e.anchorOrigin.vertical&&"right"===e.anchorOrigin.horizontal&&"circular"===e.overlap},style:{bottom:"14%",right:"14%",transform:"scale(1) translate(50%, 50%)",transformOrigin:"100% 100%",["&.".concat(Jc.invisible)]:{transform:"scale(0) translate(50%, 50%)"}}},{props:t=>{let{ownerState:e}=t;return"top"===e.anchorOrigin.vertical&&"left"===e.anchorOrigin.horizontal&&"circular"===e.overlap},style:{top:"14%",left:"14%",transform:"scale(1) translate(-50%, -50%)",transformOrigin:"0% 0%",["&.".concat(Jc.invisible)]:{transform:"scale(0) translate(-50%, -50%)"}}},{props:t=>{let{ownerState:e}=t;return"bottom"===e.anchorOrigin.vertical&&"left"===e.anchorOrigin.horizontal&&"circular"===e.overlap},style:{bottom:"14%",left:"14%",transform:"scale(1) translate(-50%, 50%)",transformOrigin:"0% 100%",["&.".concat(Jc.invisible)]:{transform:"scale(0) translate(-50%, 50%)"}}},{props:{invisible:!0},style:{transition:e.transitions.create("transform",{easing:e.transitions.easing.easeInOut,duration:e.transitions.duration.leavingScreen})}}]}})),Qc=h.forwardRef((function(t,e){var n,r,i,o,s,a;const l=Xc({props:t,name:"MuiBadge"}),{anchorOrigin:c={vertical:"top",horizontal:"right"},className:u,component:d,components:h={},componentsProps:p={},children:g,overlap:m="rectangular",color:b="default",invisible:y=!1,max:x=99,badgeContent:A,slots:_,slotProps:w,showZero:S=!1,variant:E="standard"}=l,P=(0,C.A)(l,Kc),{badgeContent:M,invisible:T,max:O,displayValue:k}=function(t){const{badgeContent:e,invisible:n=!1,max:r=99,showZero:i=!1}=t,o=Wc({badgeContent:e,max:r});let s=n;!1!==n||0!==e||i||(s=!0);const{badgeContent:a,max:l=r}=s?o:t;return{badgeContent:a,invisible:s,max:l,displayValue:a&&Number(a)>l?"".concat(l,"+"):a}}({max:x,invisible:y,badgeContent:A,showZero:S}),R=Wc({anchorOrigin:c,color:b,overlap:m,variant:E,badgeContent:A}),I=T||null==M&&"dot"!==E,{color:B=b,overlap:L=m,anchorOrigin:D=c,variant:F=E}=I?R:l,N="dot"!==F?k:void 0,j=(0,f.A)({},l,{badgeContent:M,invisible:I,max:O,displayValue:N,showZero:S,anchorOrigin:D,color:B,overlap:L,variant:F}),z=(t=>{const{color:e,anchorOrigin:n,invisible:r,overlap:i,variant:o,classes:s={}}=t,a={root:["root"],badge:["badge",o,r&&"invisible","anchorOrigin".concat((0,Dn.A)(n.vertical)).concat((0,Dn.A)(n.horizontal)),"anchorOrigin".concat((0,Dn.A)(n.vertical)).concat((0,Dn.A)(n.horizontal)).concat((0,Dn.A)(i)),"overlap".concat((0,Dn.A)(i)),"default"!==e&&"color".concat((0,Dn.A)(e))]};return(0,Bn.A)(a,Hc,s)})(j),U=null!=(n=null!=(r=null==_?void 0:_.root)?r:h.Root)?n:qc,V=null!=(i=null!=(o=null==_?void 0:_.badge)?o:h.Badge)?i:Yc,G=null!=(s=null==w?void 0:w.root)?s:p.root,W=null!=(a=null==w?void 0:w.badge)?a:p.badge,H=bo({elementType:U,externalSlotProps:G,externalForwardedProps:P,additionalProps:{ref:e,as:d},ownerState:j,className:(0,wn.A)(null==G?void 0:G.className,z.root,u)}),J=bo({elementType:V,externalSlotProps:W,ownerState:j,className:(0,wn.A)(z.badge,null==W?void 0:W.className)});return(0,v.jsxs)(U,(0,f.A)({},H,{children:[g,(0,v.jsx)(V,(0,f.A)({},J,{children:N}))]}))})),Zc=Qc;var $c=n(992),tu=n(4708),eu=n(6288);function nu(t){const e=t.documentElement.clientWidth;return Math.abs(window.innerWidth-e)}function ru(t,e){e?t.setAttribute("aria-hidden","true"):t.removeAttribute("aria-hidden")}function iu(t){return parseInt((0,eu.A)(t).getComputedStyle(t).paddingRight,10)||0}function ou(t,e,n,r,i){const o=[e,n,...r];[].forEach.call(t.children,(t=>{const e=-1===o.indexOf(t),n=!function(t){const e=-1!==["TEMPLATE","SCRIPT","STYLE","LINK","MAP","META","NOSCRIPT","PICTURE","COL","COLGROUP","PARAM","SLOT","SOURCE","TRACK"].indexOf(t.tagName),n="INPUT"===t.tagName&&"hidden"===t.getAttribute("type");return e||n}(t);e&&n&&ru(t,i)}))}function su(t,e){let n=-1;return t.some(((t,r)=>!!e(t)&&(n=r,!0))),n}function au(t,e){const n=[],r=t.container;if(!e.disableScrollLock){if(function(t){const e=(0,yo.A)(t);return e.body===t?(0,eu.A)(t).innerWidth>e.documentElement.clientWidth:t.scrollHeight>t.clientHeight}(r)){const t=nu((0,yo.A)(r));n.push({value:r.style.paddingRight,property:"padding-right",el:r}),r.style.paddingRight="".concat(iu(r)+t,"px");const e=(0,yo.A)(r).querySelectorAll(".mui-fixed");[].forEach.call(e,(e=>{n.push({value:e.style.paddingRight,property:"padding-right",el:e}),e.style.paddingRight="".concat(iu(e)+t,"px")}))}let t;if(r.parentNode instanceof DocumentFragment)t=(0,yo.A)(r).body;else{const e=r.parentElement,n=(0,eu.A)(r);t="HTML"===(null==e?void 0:e.nodeName)&&"scroll"===n.getComputedStyle(e).overflowY?e:r}n.push({value:t.style.overflow,property:"overflow",el:t},{value:t.style.overflowX,property:"overflow-x",el:t},{value:t.style.overflowY,property:"overflow-y",el:t}),t.style.overflow="hidden"}return()=>{n.forEach((t=>{let{value:e,el:n,property:r}=t;e?n.style.setProperty(r,e):n.style.removeProperty(r)}))}}const lu=new class{constructor(){this.containers=void 0,this.modals=void 0,this.modals=[],this.containers=[]}add(t,e){let n=this.modals.indexOf(t);if(-1!==n)return n;n=this.modals.length,this.modals.push(t),t.modalRef&&ru(t.modalRef,!1);const r=function(t){const e=[];return[].forEach.call(t.children,(t=>{"true"===t.getAttribute("aria-hidden")&&e.push(t)})),e}(e);ou(e,t.mount,t.modalRef,r,!0);const i=su(this.containers,(t=>t.container===e));return-1!==i?(this.containers[i].modals.push(t),n):(this.containers.push({modals:[t],container:e,restore:null,hiddenSiblings:r}),n)}mount(t,e){const n=su(this.containers,(e=>-1!==e.modals.indexOf(t))),r=this.containers[n];r.restore||(r.restore=au(r,e))}remove(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const n=this.modals.indexOf(t);if(-1===n)return n;const r=su(this.containers,(e=>-1!==e.modals.indexOf(t))),i=this.containers[r];if(i.modals.splice(i.modals.indexOf(t),1),this.modals.splice(n,1),0===i.modals.length)i.restore&&i.restore(),t.modalRef&&ru(t.modalRef,e),ou(i.container,t.mount,t.modalRef,i.hiddenSiblings,!1),this.containers.splice(r,1);else{const t=i.modals[i.modals.length-1];t.modalRef&&ru(t.modalRef,!1)}return n}isTopModal(t){return this.modals.length>0&&this.modals[this.modals.length-1]===t}};function cu(t){const{container:e,disableEscapeKeyDown:n=!1,disableScrollLock:r=!1,manager:i=lu,closeAfterTransition:o=!1,onTransitionEnter:s,onTransitionExited:a,children:l,onClose:c,open:u,rootRef:d}=t,p=h.useRef({}),g=h.useRef(null),m=h.useRef(null),v=(0,fo.A)(m,d),[b,y]=h.useState(!u),x=function(t){return!!t&&t.props.hasOwnProperty("in")}(l);let A=!0;"false"!==t["aria-hidden"]&&!1!==t["aria-hidden"]||(A=!1);const _=()=>(p.current.modalRef=m.current,p.current.mount=g.current,p.current),w=()=>{i.mount(_(),{disableScrollLock:r}),m.current&&(m.current.scrollTop=0)},S=(0,So.A)((()=>{const t=function(t){return"function"===typeof t?t():t}(e)||(0,yo.A)(g.current).body;i.add(_(),t),m.current&&w()})),C=h.useCallback((()=>i.isTopModal(_())),[i]),E=(0,So.A)((t=>{g.current=t,t&&(u&&C()?w():m.current&&ru(m.current,A))})),P=h.useCallback((()=>{i.remove(_(),A)}),[A,i]);h.useEffect((()=>()=>{P()}),[P]),h.useEffect((()=>{u?S():x&&o||P()}),[u,P,x,o,S]);const M=t=>e=>{var r;null==(r=t.onKeyDown)||r.call(t,e),"Escape"===e.key&&229!==e.which&&C()&&(n||(e.stopPropagation(),c&&c(e,"escapeKeyDown")))},T=t=>e=>{var n;null==(n=t.onClick)||n.call(t,e),e.target===e.currentTarget&&c&&c(e,"backdropClick")};return{getRootProps:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=go(t);delete n.onTransitionEnter,delete n.onTransitionExited;const r=(0,f.A)({},n,e);return(0,f.A)({role:"presentation"},r,{onKeyDown:M(r),ref:v})},getBackdropProps:function(){const t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(0,f.A)({"aria-hidden":!0},t,{onClick:T(t),open:u})},getTransitionProps:()=>({onEnter:(0,tu.A)((()=>{y(!1),s&&s()}),null==l?void 0:l.props.onEnter),onExited:(0,tu.A)((()=>{y(!0),a&&a(),o&&P()}),null==l?void 0:l.props.onExited)}),rootRef:v,portalRef:E,isTopModal:C,exited:b,hasTransition:x}}const uu=["input","select","textarea","a[href]","button","[tabindex]","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable="false"])'].join(",");function du(t){const e=[],n=[];return Array.from(t.querySelectorAll(uu)).forEach(((t,r)=>{const i=function(t){const e=parseInt(t.getAttribute("tabindex")||"",10);return Number.isNaN(e)?"true"===t.contentEditable||("AUDIO"===t.nodeName||"VIDEO"===t.nodeName||"DETAILS"===t.nodeName)&&null===t.getAttribute("tabindex")?0:t.tabIndex:e}(t);-1!==i&&function(t){return!(t.disabled||"INPUT"===t.tagName&&"hidden"===t.type||function(t){if("INPUT"!==t.tagName||"radio"!==t.type)return!1;if(!t.name)return!1;const e=e=>t.ownerDocument.querySelector('input[type="radio"]'.concat(e));let n=e('[name="'.concat(t.name,'"]:checked'));return n||(n=e('[name="'.concat(t.name,'"]'))),n!==t}(t))}(t)&&(0===i?e.push(t):n.push({documentOrder:r,tabIndex:i,node:t}))})),n.sort(((t,e)=>t.tabIndex===e.tabIndex?t.documentOrder-e.documentOrder:t.tabIndex-e.tabIndex)).map((t=>t.node)).concat(e)}function hu(){return!0}function fu(t){const{children:e,disableAutoFocus:n=!1,disableEnforceFocus:r=!1,disableRestoreFocus:i=!1,getTabbable:o=du,isEnabled:s=hu,open:a}=t,l=h.useRef(!1),c=h.useRef(null),u=h.useRef(null),d=h.useRef(null),f=h.useRef(null),p=h.useRef(!1),g=h.useRef(null),m=(0,fo.A)(e.ref,g),b=h.useRef(null);h.useEffect((()=>{a&&g.current&&(p.current=!n)}),[n,a]),h.useEffect((()=>{if(!a||!g.current)return;const t=(0,yo.A)(g.current);return g.current.contains(t.activeElement)||(g.current.hasAttribute("tabIndex")||g.current.setAttribute("tabIndex","-1"),p.current&&g.current.focus()),()=>{i||(d.current&&d.current.focus&&(l.current=!0,d.current.focus()),d.current=null)}}),[a]),h.useEffect((()=>{if(!a||!g.current)return;const t=(0,yo.A)(g.current),e=e=>{b.current=e,!r&&s()&&"Tab"===e.key&&t.activeElement===g.current&&e.shiftKey&&(l.current=!0,u.current&&u.current.focus())},n=()=>{const e=g.current;if(null===e)return;if(!t.hasFocus()||!s()||l.current)return void(l.current=!1);if(e.contains(t.activeElement))return;if(r&&t.activeElement!==c.current&&t.activeElement!==u.current)return;if(t.activeElement!==f.current)f.current=null;else if(null!==f.current)return;if(!p.current)return;let n=[];if(t.activeElement!==c.current&&t.activeElement!==u.current||(n=o(g.current)),n.length>0){var i,a;const t=Boolean((null==(i=b.current)?void 0:i.shiftKey)&&"Tab"===(null==(a=b.current)?void 0:a.key)),e=n[0],r=n[n.length-1];"string"!==typeof e&&"string"!==typeof r&&(t?r.focus():e.focus())}else e.focus()};t.addEventListener("focusin",n),t.addEventListener("keydown",e,!0);const i=setInterval((()=>{t.activeElement&&"BODY"===t.activeElement.tagName&&n()}),50);return()=>{clearInterval(i),t.removeEventListener("focusin",n),t.removeEventListener("keydown",e,!0)}}),[n,r,i,s,a,o]);const y=t=>{null===d.current&&(d.current=t.relatedTarget),p.current=!0};return(0,v.jsxs)(h.Fragment,{children:[(0,v.jsx)("div",{tabIndex:a?0:-1,onFocus:y,ref:c,"data-testid":"sentinelStart"}),h.cloneElement(e,{ref:m,onFocus:t=>{null===d.current&&(d.current=t.relatedTarget),p.current=!0,f.current=t.target;const n=e.props.onFocus;n&&n(t)}}),(0,v.jsx)("div",{tabIndex:a?0:-1,onFocus:y,ref:u,"data-testid":"sentinelEnd"})]})}const pu=["addEndListener","appear","children","easing","in","onEnter","onEntered","onEntering","onExit","onExited","onExiting","style","timeout","TransitionComponent"],gu={entering:{opacity:1},entered:{opacity:1}},mu=h.forwardRef((function(t,e){const n=Ar(),r={enter:n.transitions.duration.enteringScreen,exit:n.transitions.duration.leavingScreen},{addEndListener:i,appear:o=!0,children:s,easing:a,in:l,onEnter:c,onEntered:u,onEntering:d,onExit:p,onExited:g,onExiting:m,style:b,timeout:y=r,TransitionComponent:x=Oa}=t,A=(0,C.A)(t,pu),_=h.useRef(null),w=(0,Lr.A)(_,s.ref,e),S=t=>e=>{if(t){const n=_.current;void 0===e?t(n):t(n,e)}},E=S(d),P=S(((t,e)=>{ka(t);const r=Ra({style:b,timeout:y,easing:a},{mode:"enter"});t.style.webkitTransition=n.transitions.create("opacity",r),t.style.transition=n.transitions.create("opacity",r),c&&c(t,e)})),M=S(u),T=S(m),O=S((t=>{const e=Ra({style:b,timeout:y,easing:a},{mode:"exit"});t.style.webkitTransition=n.transitions.create("opacity",e),t.style.transition=n.transitions.create("opacity",e),p&&p(t)})),k=S(g);return(0,v.jsx)(x,(0,f.A)({appear:o,in:l,nodeRef:_,onEnter:P,onEntered:M,onEntering:E,onExit:O,onExited:k,onExiting:T,addEndListener:t=>{i&&i(_.current,t)},timeout:y},A,{children:(t,e)=>h.cloneElement(s,(0,f.A)({style:(0,f.A)({opacity:0,visibility:"exited"!==t||l?void 0:"hidden"},gu[t],b,s.props.style),ref:w},e))}))})),vu=mu;function bu(t){return(0,Fn.Ay)("MuiBackdrop",t)}(0,Tn.A)("MuiBackdrop",["root","invisible"]);const yu=["children","className","component","components","componentsProps","invisible","open","slotProps","slots","TransitionComponent","transitionDuration"],xu=(0,Ln.Ay)("div",{name:"MuiBackdrop",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,n.invisible&&e.invisible]}})((t=>{let{ownerState:e}=t;return(0,f.A)({position:"fixed",display:"flex",alignItems:"center",justifyContent:"center",right:0,bottom:0,top:0,left:0,backgroundColor:"rgba(0, 0, 0, 0.5)",WebkitTapHighlightColor:"transparent"},e.invisible&&{backgroundColor:"transparent"})})),Au=h.forwardRef((function(t,e){var n,r,i;const o=(0,p.A)({props:t,name:"MuiBackdrop"}),{children:s,className:a,component:l="div",components:c={},componentsProps:u={},invisible:d=!1,open:h,slotProps:g={},slots:m={},TransitionComponent:b=vu,transitionDuration:y}=o,x=(0,C.A)(o,yu),A=(0,f.A)({},o,{component:l,invisible:d}),_=(t=>{const{classes:e,invisible:n}=t,r={root:["root",n&&"invisible"]};return(0,Bn.A)(r,bu,e)})(A),w=null!=(n=g.root)?n:u.root;return(0,v.jsx)(b,(0,f.A)({in:h,timeout:y},x,{children:(0,v.jsx)(xu,(0,f.A)({"aria-hidden":!0},w,{as:null!=(r=null!=(i=m.root)?i:c.Root)?r:l,className:(0,wn.A)(_.root,a,null==w?void 0:w.className),ownerState:(0,f.A)({},A,null==w?void 0:w.ownerState),classes:_,ref:e,children:s}))}))}));function _u(t){return(0,Fn.Ay)("MuiModal",t)}(0,Tn.A)("MuiModal",["root","hidden","backdrop"]);const wu=["BackdropComponent","BackdropProps","classes","className","closeAfterTransition","children","container","component","components","componentsProps","disableAutoFocus","disableEnforceFocus","disableEscapeKeyDown","disablePortal","disableRestoreFocus","disableScrollLock","hideBackdrop","keepMounted","onBackdropClick","onClose","onTransitionEnter","onTransitionExited","open","slotProps","slots","theme"],Su=(0,Ln.Ay)("div",{name:"MuiModal",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,!n.open&&n.exited&&e.hidden]}})((t=>{let{theme:e,ownerState:n}=t;return(0,f.A)({position:"fixed",zIndex:(e.vars||e).zIndex.modal,right:0,bottom:0,top:0,left:0},!n.open&&n.exited&&{visibility:"hidden"})})),Cu=(0,Ln.Ay)(Au,{name:"MuiModal",slot:"Backdrop",overridesResolver:(t,e)=>e.backdrop})({zIndex:-1}),Eu=h.forwardRef((function(t,e){var n,r,i,o,s,a;const l=(0,p.A)({name:"MuiModal",props:t}),{BackdropComponent:c=Cu,BackdropProps:u,className:d,closeAfterTransition:g=!1,children:m,container:b,component:y,components:x={},componentsProps:A={},disableAutoFocus:_=!1,disableEnforceFocus:w=!1,disableEscapeKeyDown:S=!1,disablePortal:E=!1,disableRestoreFocus:P=!1,disableScrollLock:M=!1,hideBackdrop:T=!1,keepMounted:O=!1,onBackdropClick:k,open:R,slotProps:I,slots:B}=l,L=(0,C.A)(l,wu),D=(0,f.A)({},l,{closeAfterTransition:g,disableAutoFocus:_,disableEnforceFocus:w,disableEscapeKeyDown:S,disablePortal:E,disableRestoreFocus:P,disableScrollLock:M,hideBackdrop:T,keepMounted:O}),{getRootProps:F,getBackdropProps:N,getTransitionProps:j,portalRef:z,isTopModal:U,exited:V,hasTransition:G}=cu((0,f.A)({},D,{rootRef:e})),W=(0,f.A)({},D,{exited:V}),H=(t=>{const{open:e,exited:n,classes:r}=t,i={root:["root",!e&&n&&"hidden"],backdrop:["backdrop"]};return(0,Bn.A)(i,_u,r)})(W),J={};if(void 0===m.props.tabIndex&&(J.tabIndex="-1"),G){const{onEnter:t,onExited:e}=j();J.onEnter=t,J.onExited=e}const K=null!=(n=null!=(r=null==B?void 0:B.root)?r:x.Root)?n:Su,X=null!=(i=null!=(o=null==B?void 0:B.backdrop)?o:x.Backdrop)?i:c,q=null!=(s=null==I?void 0:I.root)?s:A.root,Y=null!=(a=null==I?void 0:I.backdrop)?a:A.backdrop,Q=bo({elementType:K,externalSlotProps:q,externalForwardedProps:L,getSlotProps:F,additionalProps:{ref:e,as:y},ownerState:W,className:(0,wn.A)(d,null==q?void 0:q.className,null==H?void 0:H.root,!W.open&&W.exited&&(null==H?void 0:H.hidden))}),Z=bo({elementType:X,externalSlotProps:Y,additionalProps:u,getSlotProps:t=>N((0,f.A)({},t,{onClick:e=>{k&&k(e),null!=t&&t.onClick&&t.onClick(e)}})),className:(0,wn.A)(null==Y?void 0:Y.className,null==u?void 0:u.className,null==H?void 0:H.backdrop),ownerState:W});return O||R||G&&!V?(0,v.jsx)(oc,{ref:z,container:b,disablePortal:E,children:(0,v.jsxs)(K,(0,f.A)({},Q,{children:[!T&&c?(0,v.jsx)(X,(0,f.A)({},Z)):null,(0,v.jsx)(fu,{disableEnforceFocus:w,disableAutoFocus:_,disableRestoreFocus:P,isEnabled:U,open:R,children:h.cloneElement(m,J)})]}))}):null})),Pu=Eu;function Mu(t){return(0,Fn.Ay)("MuiDialog",t)}const Tu=(0,Tn.A)("MuiDialog",["root","scrollPaper","scrollBody","container","paper","paperScrollPaper","paperScrollBody","paperWidthFalse","paperWidthXs","paperWidthSm","paperWidthMd","paperWidthLg","paperWidthXl","paperFullWidth","paperFullScreen"]);const Ou=h.createContext({}),ku=["aria-describedby","aria-labelledby","BackdropComponent","BackdropProps","children","className","disableEscapeKeyDown","fullScreen","fullWidth","maxWidth","onBackdropClick","onClose","open","PaperComponent","PaperProps","scroll","TransitionComponent","transitionDuration","TransitionProps"],Ru=(0,Ln.Ay)(Au,{name:"MuiDialog",slot:"Backdrop",overrides:(t,e)=>e.backdrop})({zIndex:-1}),Iu=(0,Ln.Ay)(Pu,{name:"MuiDialog",slot:"Root",overridesResolver:(t,e)=>e.root})({"@media print":{position:"absolute !important"}}),Bu=(0,Ln.Ay)("div",{name:"MuiDialog",slot:"Container",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.container,e["scroll".concat((0,Dn.A)(n.scroll))]]}})((t=>{let{ownerState:e}=t;return(0,f.A)({height:"100%","@media print":{height:"auto"},outline:0},"paper"===e.scroll&&{display:"flex",justifyContent:"center",alignItems:"center"},"body"===e.scroll&&{overflowY:"auto",overflowX:"hidden",textAlign:"center","&::after":{content:'""',display:"inline-block",verticalAlign:"middle",height:"100%",width:"0"}})})),Lu=(0,Ln.Ay)(Qi,{name:"MuiDialog",slot:"Paper",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.paper,e["scrollPaper".concat((0,Dn.A)(n.scroll))],e["paperWidth".concat((0,Dn.A)(String(n.maxWidth)))],n.fullWidth&&e.paperFullWidth,n.fullScreen&&e.paperFullScreen]}})((t=>{let{theme:e,ownerState:n}=t;return(0,f.A)({margin:32,position:"relative",overflowY:"auto","@media print":{overflowY:"visible",boxShadow:"none"}},"paper"===n.scroll&&{display:"flex",flexDirection:"column",maxHeight:"calc(100% - 64px)"},"body"===n.scroll&&{display:"inline-block",verticalAlign:"middle",textAlign:"left"},!n.maxWidth&&{maxWidth:"calc(100% - 64px)"},"xs"===n.maxWidth&&{maxWidth:"px"===e.breakpoints.unit?Math.max(e.breakpoints.values.xs,444):"max(".concat(e.breakpoints.values.xs).concat(e.breakpoints.unit,", 444px)"),["&.".concat(Tu.paperScrollBody)]:{[e.breakpoints.down(Math.max(e.breakpoints.values.xs,444)+64)]:{maxWidth:"calc(100% - 64px)"}}},n.maxWidth&&"xs"!==n.maxWidth&&{maxWidth:"".concat(e.breakpoints.values[n.maxWidth]).concat(e.breakpoints.unit),["&.".concat(Tu.paperScrollBody)]:{[e.breakpoints.down(e.breakpoints.values[n.maxWidth]+64)]:{maxWidth:"calc(100% - 64px)"}}},n.fullWidth&&{width:"calc(100% - 64px)"},n.fullScreen&&{margin:0,width:"100%",maxWidth:"100%",height:"100%",maxHeight:"none",borderRadius:0,["&.".concat(Tu.paperScrollBody)]:{margin:0,maxWidth:"100%"}})})),Du=h.forwardRef((function(t,e){const n=(0,p.A)({props:t,name:"MuiDialog"}),r=Ar(),i={enter:r.transitions.duration.enteringScreen,exit:r.transitions.duration.leavingScreen},{"aria-describedby":o,"aria-labelledby":s,BackdropComponent:a,BackdropProps:l,children:c,className:u,disableEscapeKeyDown:d=!1,fullScreen:g=!1,fullWidth:m=!1,maxWidth:b="sm",onBackdropClick:y,onClose:x,open:A,PaperComponent:_=Qi,PaperProps:w={},scroll:S="paper",TransitionComponent:E=vu,transitionDuration:P=i,TransitionProps:M}=n,T=(0,C.A)(n,ku),O=(0,f.A)({},n,{disableEscapeKeyDown:d,fullScreen:g,fullWidth:m,maxWidth:b,scroll:S}),k=(t=>{const{classes:e,scroll:n,maxWidth:r,fullWidth:i,fullScreen:o}=t,s={root:["root"],container:["container","scroll".concat((0,Dn.A)(n))],paper:["paper","paperScroll".concat((0,Dn.A)(n)),"paperWidth".concat((0,Dn.A)(String(r))),i&&"paperFullWidth",o&&"paperFullScreen"]};return(0,Bn.A)(s,Mu,e)})(O),R=h.useRef(),I=(0,$c.A)(s),B=h.useMemo((()=>({titleId:I})),[I]);return(0,v.jsx)(Iu,(0,f.A)({className:(0,wn.A)(k.root,u),closeAfterTransition:!0,components:{Backdrop:Ru},componentsProps:{backdrop:(0,f.A)({transitionDuration:P,as:a},l)},disableEscapeKeyDown:d,onClose:x,open:A,ref:e,onClick:t=>{R.current&&(R.current=null,y&&y(t),x&&x(t,"backdropClick"))},ownerState:O},T,{children:(0,v.jsx)(E,(0,f.A)({appear:!0,in:A,timeout:P,role:"presentation"},M,{children:(0,v.jsx)(Bu,{className:(0,wn.A)(k.container),onMouseDown:t=>{R.current=t.target===t.currentTarget},ownerState:O,children:(0,v.jsx)(Lu,(0,f.A)({as:_,elevation:24,role:"dialog","aria-describedby":o,"aria-labelledby":I},w,{className:(0,wn.A)(k.paper,w.className),ownerState:O,children:(0,v.jsx)(Ou.Provider,{value:B,children:c})}))})}))}))})),Fu=Du;function Nu(t){return(0,Fn.Ay)("MuiDialogTitle",t)}const ju=(0,Tn.A)("MuiDialogTitle",["root"]),zu=["className","id"],Uu=(0,Ln.Ay)(Wn,{name:"MuiDialogTitle",slot:"Root",overridesResolver:(t,e)=>e.root})({padding:"16px 24px",flex:"0 0 auto"}),Vu=h.forwardRef((function(t,e){const n=(0,p.A)({props:t,name:"MuiDialogTitle"}),{className:r,id:i}=n,o=(0,C.A)(n,zu),s=n,a=(t=>{const{classes:e}=t;return(0,Bn.A)({root:["root"]},Nu,e)})(s),{titleId:l=i}=h.useContext(Ou);return(0,v.jsx)(Uu,(0,f.A)({component:"h2",className:(0,wn.A)(a.root,r),ownerState:s,ref:e,variant:"h6",id:null!=i?i:l},o))}));function Gu(t){return(0,Fn.Ay)("MuiDialogContent",t)}(0,Tn.A)("MuiDialogContent",["root","dividers"]);const Wu=["className","dividers"],Hu=(0,Ln.Ay)("div",{name:"MuiDialogContent",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,n.dividers&&e.dividers]}})((t=>{let{theme:e,ownerState:n}=t;return(0,f.A)({flex:"1 1 auto",WebkitOverflowScrolling:"touch",overflowY:"auto",padding:"20px 24px"},n.dividers?{padding:"16px 24px",borderTop:"1px solid ".concat((e.vars||e).palette.divider),borderBottom:"1px solid ".concat((e.vars||e).palette.divider)}:{[".".concat(ju.root," + &")]:{paddingTop:0}})})),Ju=h.forwardRef((function(t,e){const n=(0,p.A)({props:t,name:"MuiDialogContent"}),{className:r,dividers:i=!1}=n,o=(0,C.A)(n,Wu),s=(0,f.A)({},n,{dividers:i}),a=(t=>{const{classes:e,dividers:n}=t,r={root:["root",n&&"dividers"]};return(0,Bn.A)(r,Gu,e)})(s);return(0,v.jsx)(Hu,(0,f.A)({className:(0,wn.A)(a.root,r),ownerState:s,ref:e},o))}));function Ku(t){return(0,Fn.Ay)("MuiDialogContentText",t)}(0,Tn.A)("MuiDialogContentText",["root"]);const Xu=["children","className"],qu=(0,Ln.Ay)(Wn,{shouldForwardProp:t=>(0,Li.A)(t)||"classes"===t,name:"MuiDialogContentText",slot:"Root",overridesResolver:(t,e)=>e.root})({}),Yu=h.forwardRef((function(t,e){const n=(0,p.A)({props:t,name:"MuiDialogContentText"}),{className:r}=n,i=(0,C.A)(n,Xu),o=(t=>{const{classes:e}=t,n=(0,Bn.A)({root:["root"]},Ku,e);return(0,f.A)({},e,n)})(i);return(0,v.jsx)(qu,(0,f.A)({component:"p",variant:"body1",color:"text.secondary",ref:e,ownerState:i,className:(0,wn.A)(o.root,r)},n,{classes:o}))}));var Qu=n(6632),Zu=n(6440);const $u=["onChange","maxRows","minRows","style","value"];function td(t){return parseInt(t,10)||0}const ed={visibility:"hidden",position:"absolute",overflow:"hidden",height:0,top:0,left:0,transform:"translateZ(0)"};const nd=h.forwardRef((function(t,e){const{onChange:n,maxRows:r,minRows:i=1,style:o,value:s}=t,a=(0,C.A)(t,$u),{current:l}=h.useRef(null!=s),c=h.useRef(null),u=(0,fo.A)(e,c),d=h.useRef(null),p=h.useCallback((()=>{const e=c.current,n=(0,eu.A)(e).getComputedStyle(e);if("0px"===n.width)return{outerHeightStyle:0,overflowing:!1};const o=d.current;o.style.width=n.width,o.value=e.value||t.placeholder||"x","\n"===o.value.slice(-1)&&(o.value+=" ");const s=n.boxSizing,a=td(n.paddingBottom)+td(n.paddingTop),l=td(n.borderBottomWidth)+td(n.borderTopWidth),u=o.scrollHeight;o.value="x";const h=o.scrollHeight;let f=u;i&&(f=Math.max(Number(i)*h,f)),r&&(f=Math.min(Number(r)*h,f)),f=Math.max(f,h);return{outerHeightStyle:f+("border-box"===s?a+l:0),overflowing:Math.abs(f-u)<=1}}),[r,i,t.placeholder]),g=h.useCallback((()=>{const t=p();if(void 0===(e=t)||null===e||0===Object.keys(e).length||0===e.outerHeightStyle&&!e.overflowing)return;var e;const n=c.current;n.style.height="".concat(t.outerHeightStyle,"px"),n.style.overflow=t.overflowing?"hidden":""}),[p]);(0,wo.A)((()=>{const t=()=>{g()};let e;const n=(0,Zu.A)(t),r=c.current,i=(0,eu.A)(r);let o;return i.addEventListener("resize",n),"undefined"!==typeof ResizeObserver&&(o=new ResizeObserver(t),o.observe(r)),()=>{n.clear(),cancelAnimationFrame(e),i.removeEventListener("resize",n),o&&o.disconnect()}}),[p,g]),(0,wo.A)((()=>{g()}));return(0,v.jsxs)(h.Fragment,{children:[(0,v.jsx)("textarea",(0,f.A)({value:s,onChange:t=>{l||g(),n&&n(t)},ref:u,rows:i,style:o},a)),(0,v.jsx)("textarea",{"aria-hidden":!0,className:t.className,readOnly:!0,ref:d,tabIndex:-1,style:(0,f.A)({},ed,o,{paddingTop:0,paddingBottom:0})})]})}));function rd(t){return null!=t&&!(Array.isArray(t)&&0===t.length)}function id(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return t&&(rd(t.value)&&""!==t.value||e&&rd(t.defaultValue)&&""!==t.defaultValue)}function od(t){return(0,Fn.Ay)("MuiInputBase",t)}const sd=(0,Tn.A)("MuiInputBase",["root","formControl","focused","disabled","adornedStart","adornedEnd","error","sizeSmall","multiline","colorSecondary","fullWidth","hiddenLabel","readOnly","input","inputSizeSmall","inputMultiline","inputTypeSearch","inputAdornedStart","inputAdornedEnd","inputHiddenLabel"]),ad=["aria-describedby","autoComplete","autoFocus","className","color","components","componentsProps","defaultValue","disabled","disableInjectingGlobalStyles","endAdornment","error","fullWidth","id","inputComponent","inputProps","inputRef","margin","maxRows","minRows","multiline","name","onBlur","onChange","onClick","onFocus","onKeyDown","onKeyUp","placeholder","readOnly","renderSuffix","rows","size","slotProps","slots","startAdornment","type","value"],ld=(t,e)=>{const{ownerState:n}=t;return[e.root,n.formControl&&e.formControl,n.startAdornment&&e.adornedStart,n.endAdornment&&e.adornedEnd,n.error&&e.error,"small"===n.size&&e.sizeSmall,n.multiline&&e.multiline,n.color&&e["color".concat((0,Dn.A)(n.color))],n.fullWidth&&e.fullWidth,n.hiddenLabel&&e.hiddenLabel]},cd=(t,e)=>{const{ownerState:n}=t;return[e.input,"small"===n.size&&e.inputSizeSmall,n.multiline&&e.inputMultiline,"search"===n.type&&e.inputTypeSearch,n.startAdornment&&e.inputAdornedStart,n.endAdornment&&e.inputAdornedEnd,n.hiddenLabel&&e.inputHiddenLabel]},ud=(0,Ln.Ay)("div",{name:"MuiInputBase",slot:"Root",overridesResolver:ld})((t=>{let{theme:e,ownerState:n}=t;return(0,f.A)({},e.typography.body1,{color:(e.vars||e).palette.text.primary,lineHeight:"1.4375em",boxSizing:"border-box",position:"relative",cursor:"text",display:"inline-flex",alignItems:"center",["&.".concat(sd.disabled)]:{color:(e.vars||e).palette.text.disabled,cursor:"default"}},n.multiline&&(0,f.A)({padding:"4px 0 5px"},"small"===n.size&&{paddingTop:1}),n.fullWidth&&{width:"100%"})})),dd=(0,Ln.Ay)("input",{name:"MuiInputBase",slot:"Input",overridesResolver:cd})((t=>{let{theme:e,ownerState:n}=t;const r="light"===e.palette.mode,i=(0,f.A)({color:"currentColor"},e.vars?{opacity:e.vars.opacity.inputPlaceholder}:{opacity:r?.42:.5},{transition:e.transitions.create("opacity",{duration:e.transitions.duration.shorter})}),o={opacity:"0 !important"},s=e.vars?{opacity:e.vars.opacity.inputPlaceholder}:{opacity:r?.42:.5};return(0,f.A)({font:"inherit",letterSpacing:"inherit",color:"currentColor",padding:"4px 0 5px",border:0,boxSizing:"content-box",background:"none",height:"1.4375em",margin:0,WebkitTapHighlightColor:"transparent",display:"block",minWidth:0,width:"100%",animationName:"mui-auto-fill-cancel",animationDuration:"10ms","&::-webkit-input-placeholder":i,"&::-moz-placeholder":i,"&:-ms-input-placeholder":i,"&::-ms-input-placeholder":i,"&:focus":{outline:0},"&:invalid":{boxShadow:"none"},"&::-webkit-search-decoration":{WebkitAppearance:"none"},["label[data-shrink=false] + .".concat(sd.formControl," &")]:{"&::-webkit-input-placeholder":o,"&::-moz-placeholder":o,"&:-ms-input-placeholder":o,"&::-ms-input-placeholder":o,"&:focus::-webkit-input-placeholder":s,"&:focus::-moz-placeholder":s,"&:focus:-ms-input-placeholder":s,"&:focus::-ms-input-placeholder":s},["&.".concat(sd.disabled)]:{opacity:1,WebkitTextFillColor:(e.vars||e).palette.text.disabled},"&:-webkit-autofill":{animationDuration:"5000s",animationName:"mui-auto-fill"}},"small"===n.size&&{paddingTop:1},n.multiline&&{height:"auto",resize:"none",padding:0,paddingTop:0},"search"===n.type&&{MozAppearance:"textfield"})})),hd=(0,v.jsx)(A,{styles:{"@keyframes mui-auto-fill":{from:{display:"block"}},"@keyframes mui-auto-fill-cancel":{from:{display:"block"}}}}),fd=h.forwardRef((function(t,e){var n;const r=(0,p.A)({props:t,name:"MuiInputBase"}),{"aria-describedby":i,autoComplete:o,autoFocus:s,className:a,components:l={},componentsProps:c={},defaultValue:u,disabled:d,disableInjectingGlobalStyles:g,endAdornment:m,fullWidth:b=!1,id:y,inputComponent:x="input",inputProps:A={},inputRef:_,maxRows:w,minRows:S,multiline:E=!1,name:P,onBlur:M,onChange:T,onClick:O,onFocus:k,onKeyDown:R,onKeyUp:I,placeholder:B,readOnly:L,renderSuffix:D,rows:F,slotProps:N={},slots:j={},startAdornment:z,type:U="text",value:V}=r,G=(0,C.A)(r,ad),W=null!=A.value?A.value:V,{current:H}=h.useRef(null!=W),J=h.useRef(),K=h.useCallback((t=>{0}),[]),X=(0,Lr.A)(J,_,A.ref,K),[q,Y]=h.useState(!1),Q=ms();const Z=Vs({props:r,muiFormControl:Q,states:["color","disabled","error","hiddenLabel","size","required","filled"]});Z.focused=Q?Q.focused:q,h.useEffect((()=>{!Q&&d&&q&&(Y(!1),M&&M())}),[Q,d,q,M]);const $=Q&&Q.onFilled,tt=Q&&Q.onEmpty,et=h.useCallback((t=>{id(t)?$&&$():tt&&tt()}),[$,tt]);(0,bi.A)((()=>{H&&et({value:W})}),[W,et,H]);h.useEffect((()=>{et(J.current)}),[]);let nt=x,rt=A;E&&"input"===nt&&(rt=F?(0,f.A)({type:void 0,minRows:F,maxRows:F},rt):(0,f.A)({type:void 0,maxRows:w,minRows:S},rt),nt=nd);h.useEffect((()=>{Q&&Q.setAdornedStart(Boolean(z))}),[Q,z]);const it=(0,f.A)({},r,{color:Z.color||"primary",disabled:Z.disabled,endAdornment:m,error:Z.error,focused:Z.focused,formControl:Q,fullWidth:b,hiddenLabel:Z.hiddenLabel,multiline:E,size:Z.size,startAdornment:z,type:U}),ot=(t=>{const{classes:e,color:n,disabled:r,error:i,endAdornment:o,focused:s,formControl:a,fullWidth:l,hiddenLabel:c,multiline:u,readOnly:d,size:h,startAdornment:f,type:p}=t,g={root:["root","color".concat((0,Dn.A)(n)),r&&"disabled",i&&"error",l&&"fullWidth",s&&"focused",a&&"formControl",h&&"medium"!==h&&"size".concat((0,Dn.A)(h)),u&&"multiline",f&&"adornedStart",o&&"adornedEnd",c&&"hiddenLabel",d&&"readOnly"],input:["input",r&&"disabled","search"===p&&"inputTypeSearch",u&&"inputMultiline","small"===h&&"inputSizeSmall",c&&"inputHiddenLabel",f&&"inputAdornedStart",o&&"inputAdornedEnd",d&&"readOnly"]};return(0,Bn.A)(g,od,e)})(it),st=j.root||l.Root||ud,at=N.root||c.root||{},lt=j.input||l.Input||dd;return rt=(0,f.A)({},rt,null!=(n=N.input)?n:c.input),(0,v.jsxs)(h.Fragment,{children:[!g&&hd,(0,v.jsxs)(st,(0,f.A)({},at,!Br(st)&&{ownerState:(0,f.A)({},it,at.ownerState)},{ref:e,onClick:t=>{J.current&&t.currentTarget===t.target&&J.current.focus(),O&&O(t)}},G,{className:(0,wn.A)(ot.root,at.className,a,L&&"MuiInputBase-readOnly"),children:[z,(0,v.jsx)(gs.Provider,{value:null,children:(0,v.jsx)(lt,(0,f.A)({ownerState:it,"aria-invalid":Z.error,"aria-describedby":i,autoComplete:o,autoFocus:s,defaultValue:u,disabled:Z.disabled,id:y,onAnimationStart:t=>{et("mui-auto-fill-cancel"===t.animationName?J.current:{value:"x"})},name:P,placeholder:B,readOnly:L,required:Z.required,rows:F,value:W,onKeyDown:R,onKeyUp:I,type:U},rt,!Br(lt)&&{as:nt,ownerState:(0,f.A)({},it,rt.ownerState)},{ref:X,className:(0,wn.A)(ot.input,rt.className,L&&"MuiInputBase-readOnly"),onBlur:t=>{M&&M(t),A.onBlur&&A.onBlur(t),Q&&Q.onBlur?Q.onBlur(t):Y(!1)},onChange:function(t){if(!H){const e=t.target||J.current;if(null==e)throw new Error((0,Qu.A)(1));et({value:e.value})}for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r{Z.disabled?t.stopPropagation():(k&&k(t),A.onFocus&&A.onFocus(t),Q&&Q.onFocus?Q.onFocus(t):Y(!0))}}))}),m,D?D((0,f.A)({},Z,{startAdornment:z})):null]}))]})})),pd=fd;function gd(t){return(0,Fn.Ay)("MuiInput",t)}const md=(0,f.A)({},sd,(0,Tn.A)("MuiInput",["root","underline","input"])),vd=["disableUnderline","components","componentsProps","fullWidth","inputComponent","multiline","slotProps","slots","type"],bd=(0,Ln.Ay)(ud,{shouldForwardProp:t=>(0,Li.A)(t)||"classes"===t,name:"MuiInput",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[...ld(t,e),!n.disableUnderline&&e.underline]}})((t=>{let{theme:e,ownerState:n}=t;let r="light"===e.palette.mode?"rgba(0, 0, 0, 0.42)":"rgba(255, 255, 255, 0.7)";return e.vars&&(r="rgba(".concat(e.vars.palette.common.onBackgroundChannel," / ").concat(e.vars.opacity.inputUnderline,")")),(0,f.A)({position:"relative"},n.formControl&&{"label + &":{marginTop:16}},!n.disableUnderline&&{"&::after":{borderBottom:"2px solid ".concat((e.vars||e).palette[n.color].main),left:0,bottom:0,content:'""',position:"absolute",right:0,transform:"scaleX(0)",transition:e.transitions.create("transform",{duration:e.transitions.duration.shorter,easing:e.transitions.easing.easeOut}),pointerEvents:"none"},["&.".concat(md.focused,":after")]:{transform:"scaleX(1) translateX(0)"},["&.".concat(md.error)]:{"&::before, &::after":{borderBottomColor:(e.vars||e).palette.error.main}},"&::before":{borderBottom:"1px solid ".concat(r),left:0,bottom:0,content:'"\\00a0"',position:"absolute",right:0,transition:e.transitions.create("border-bottom-color",{duration:e.transitions.duration.shorter}),pointerEvents:"none"},["&:hover:not(.".concat(md.disabled,", .").concat(md.error,"):before")]:{borderBottom:"2px solid ".concat((e.vars||e).palette.text.primary),"@media (hover: none)":{borderBottom:"1px solid ".concat(r)}},["&.".concat(md.disabled,":before")]:{borderBottomStyle:"dotted"}})})),yd=(0,Ln.Ay)(dd,{name:"MuiInput",slot:"Input",overridesResolver:cd})({}),xd=h.forwardRef((function(t,e){var n,r,i,o;const s=(0,p.A)({props:t,name:"MuiInput"}),{disableUnderline:a,components:l={},componentsProps:c,fullWidth:u=!1,inputComponent:d="input",multiline:h=!1,slotProps:g,slots:m={},type:b="text"}=s,y=(0,C.A)(s,vd),x=(t=>{const{classes:e,disableUnderline:n}=t,r={root:["root",!n&&"underline"],input:["input"]},i=(0,Bn.A)(r,gd,e);return(0,f.A)({},e,i)})(s),A={root:{ownerState:{disableUnderline:a}}},_=(null!=g?g:c)?(0,vs.A)(null!=g?g:c,A):A,w=null!=(n=null!=(r=m.root)?r:l.Root)?n:bd,S=null!=(i=null!=(o=m.input)?o:l.Input)?i:yd;return(0,v.jsx)(pd,(0,f.A)({slots:{root:w,input:S},slotProps:_,fullWidth:u,inputComponent:d,multiline:h,ref:e,type:b},y,{classes:x}))}));xd.muiName="Input";const Ad=xd;function _d(t){return(0,Fn.Ay)("MuiFilledInput",t)}const wd=(0,f.A)({},sd,(0,Tn.A)("MuiFilledInput",["root","underline","input"])),Sd=["disableUnderline","components","componentsProps","fullWidth","hiddenLabel","inputComponent","multiline","slotProps","slots","type"],Cd=(0,Ln.Ay)(ud,{shouldForwardProp:t=>(0,Li.A)(t)||"classes"===t,name:"MuiFilledInput",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[...ld(t,e),!n.disableUnderline&&e.underline]}})((t=>{let{theme:e,ownerState:n}=t;var r;const i="light"===e.palette.mode,o=i?"rgba(0, 0, 0, 0.42)":"rgba(255, 255, 255, 0.7)",s=i?"rgba(0, 0, 0, 0.06)":"rgba(255, 255, 255, 0.09)",a=i?"rgba(0, 0, 0, 0.09)":"rgba(255, 255, 255, 0.13)",l=i?"rgba(0, 0, 0, 0.12)":"rgba(255, 255, 255, 0.12)";return(0,f.A)({position:"relative",backgroundColor:e.vars?e.vars.palette.FilledInput.bg:s,borderTopLeftRadius:(e.vars||e).shape.borderRadius,borderTopRightRadius:(e.vars||e).shape.borderRadius,transition:e.transitions.create("background-color",{duration:e.transitions.duration.shorter,easing:e.transitions.easing.easeOut}),"&:hover":{backgroundColor:e.vars?e.vars.palette.FilledInput.hoverBg:a,"@media (hover: none)":{backgroundColor:e.vars?e.vars.palette.FilledInput.bg:s}},["&.".concat(wd.focused)]:{backgroundColor:e.vars?e.vars.palette.FilledInput.bg:s},["&.".concat(wd.disabled)]:{backgroundColor:e.vars?e.vars.palette.FilledInput.disabledBg:l}},!n.disableUnderline&&{"&::after":{borderBottom:"2px solid ".concat(null==(r=(e.vars||e).palette[n.color||"primary"])?void 0:r.main),left:0,bottom:0,content:'""',position:"absolute",right:0,transform:"scaleX(0)",transition:e.transitions.create("transform",{duration:e.transitions.duration.shorter,easing:e.transitions.easing.easeOut}),pointerEvents:"none"},["&.".concat(wd.focused,":after")]:{transform:"scaleX(1) translateX(0)"},["&.".concat(wd.error)]:{"&::before, &::after":{borderBottomColor:(e.vars||e).palette.error.main}},"&::before":{borderBottom:"1px solid ".concat(e.vars?"rgba(".concat(e.vars.palette.common.onBackgroundChannel," / ").concat(e.vars.opacity.inputUnderline,")"):o),left:0,bottom:0,content:'"\\00a0"',position:"absolute",right:0,transition:e.transitions.create("border-bottom-color",{duration:e.transitions.duration.shorter}),pointerEvents:"none"},["&:hover:not(.".concat(wd.disabled,", .").concat(wd.error,"):before")]:{borderBottom:"1px solid ".concat((e.vars||e).palette.text.primary)},["&.".concat(wd.disabled,":before")]:{borderBottomStyle:"dotted"}},n.startAdornment&&{paddingLeft:12},n.endAdornment&&{paddingRight:12},n.multiline&&(0,f.A)({padding:"25px 12px 8px"},"small"===n.size&&{paddingTop:21,paddingBottom:4},n.hiddenLabel&&{paddingTop:16,paddingBottom:17},n.hiddenLabel&&"small"===n.size&&{paddingTop:8,paddingBottom:9}))})),Ed=(0,Ln.Ay)(dd,{name:"MuiFilledInput",slot:"Input",overridesResolver:cd})((t=>{let{theme:e,ownerState:n}=t;return(0,f.A)({paddingTop:25,paddingRight:12,paddingBottom:8,paddingLeft:12},!e.vars&&{"&:-webkit-autofill":{WebkitBoxShadow:"light"===e.palette.mode?null:"0 0 0 100px #266798 inset",WebkitTextFillColor:"light"===e.palette.mode?null:"#fff",caretColor:"light"===e.palette.mode?null:"#fff",borderTopLeftRadius:"inherit",borderTopRightRadius:"inherit"}},e.vars&&{"&:-webkit-autofill":{borderTopLeftRadius:"inherit",borderTopRightRadius:"inherit"},[e.getColorSchemeSelector("dark")]:{"&:-webkit-autofill":{WebkitBoxShadow:"0 0 0 100px #266798 inset",WebkitTextFillColor:"#fff",caretColor:"#fff"}}},"small"===n.size&&{paddingTop:21,paddingBottom:4},n.hiddenLabel&&{paddingTop:16,paddingBottom:17},n.startAdornment&&{paddingLeft:0},n.endAdornment&&{paddingRight:0},n.hiddenLabel&&"small"===n.size&&{paddingTop:8,paddingBottom:9},n.multiline&&{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0})})),Pd=h.forwardRef((function(t,e){var n,r,i,o;const s=(0,p.A)({props:t,name:"MuiFilledInput"}),{components:a={},componentsProps:l,fullWidth:c=!1,inputComponent:u="input",multiline:d=!1,slotProps:h,slots:g={},type:m="text"}=s,b=(0,C.A)(s,Sd),y=(0,f.A)({},s,{fullWidth:c,inputComponent:u,multiline:d,type:m}),x=(t=>{const{classes:e,disableUnderline:n}=t,r={root:["root",!n&&"underline"],input:["input"]},i=(0,Bn.A)(r,_d,e);return(0,f.A)({},e,i)})(s),A={root:{ownerState:y},input:{ownerState:y}},_=(null!=h?h:l)?(0,vs.A)(A,null!=h?h:l):A,w=null!=(n=null!=(r=g.root)?r:a.Root)?n:Cd,S=null!=(i=null!=(o=g.input)?o:a.Input)?i:Ed;return(0,v.jsx)(pd,(0,f.A)({slots:{root:w,input:S},componentsProps:_,fullWidth:c,inputComponent:u,multiline:d,ref:e,type:m},b,{classes:x}))}));Pd.muiName="Input";const Md=Pd;var Td;const Od=["children","classes","className","label","notched"],kd=(0,Ln.Ay)("fieldset",{shouldForwardProp:Li.A})({textAlign:"left",position:"absolute",bottom:0,right:0,top:-5,left:0,margin:0,padding:"0 8px",pointerEvents:"none",borderRadius:"inherit",borderStyle:"solid",borderWidth:1,overflow:"hidden",minWidth:"0%"}),Rd=(0,Ln.Ay)("legend",{shouldForwardProp:Li.A})((t=>{let{ownerState:e,theme:n}=t;return(0,f.A)({float:"unset",width:"auto",overflow:"hidden"},!e.withLabel&&{padding:0,lineHeight:"11px",transition:n.transitions.create("width",{duration:150,easing:n.transitions.easing.easeOut})},e.withLabel&&(0,f.A)({display:"block",padding:0,height:11,fontSize:"0.75em",visibility:"hidden",maxWidth:.01,transition:n.transitions.create("max-width",{duration:50,easing:n.transitions.easing.easeOut}),whiteSpace:"nowrap","& > span":{paddingLeft:5,paddingRight:5,display:"inline-block",opacity:0,visibility:"visible"}},e.notched&&{maxWidth:"100%",transition:n.transitions.create("max-width",{duration:100,easing:n.transitions.easing.easeOut,delay:50})}))}));function Id(t){return(0,Fn.Ay)("MuiOutlinedInput",t)}const Bd=(0,f.A)({},sd,(0,Tn.A)("MuiOutlinedInput",["root","notchedOutline","input"])),Ld=["components","fullWidth","inputComponent","label","multiline","notched","slots","type"],Dd=(0,Ln.Ay)(ud,{shouldForwardProp:t=>(0,Li.A)(t)||"classes"===t,name:"MuiOutlinedInput",slot:"Root",overridesResolver:ld})((t=>{let{theme:e,ownerState:n}=t;const r="light"===e.palette.mode?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)";return(0,f.A)({position:"relative",borderRadius:(e.vars||e).shape.borderRadius,["&:hover .".concat(Bd.notchedOutline)]:{borderColor:(e.vars||e).palette.text.primary},"@media (hover: none)":{["&:hover .".concat(Bd.notchedOutline)]:{borderColor:e.vars?"rgba(".concat(e.vars.palette.common.onBackgroundChannel," / 0.23)"):r}},["&.".concat(Bd.focused," .").concat(Bd.notchedOutline)]:{borderColor:(e.vars||e).palette[n.color].main,borderWidth:2},["&.".concat(Bd.error," .").concat(Bd.notchedOutline)]:{borderColor:(e.vars||e).palette.error.main},["&.".concat(Bd.disabled," .").concat(Bd.notchedOutline)]:{borderColor:(e.vars||e).palette.action.disabled}},n.startAdornment&&{paddingLeft:14},n.endAdornment&&{paddingRight:14},n.multiline&&(0,f.A)({padding:"16.5px 14px"},"small"===n.size&&{padding:"8.5px 14px"}))})),Fd=(0,Ln.Ay)((function(t){const{className:e,label:n,notched:r}=t,i=(0,C.A)(t,Od),o=null!=n&&""!==n,s=(0,f.A)({},t,{notched:r,withLabel:o});return(0,v.jsx)(kd,(0,f.A)({"aria-hidden":!0,className:e,ownerState:s},i,{children:(0,v.jsx)(Rd,{ownerState:s,children:o?(0,v.jsx)("span",{children:n}):Td||(Td=(0,v.jsx)("span",{className:"notranslate",children:"\u200b"}))})}))}),{name:"MuiOutlinedInput",slot:"NotchedOutline",overridesResolver:(t,e)=>e.notchedOutline})((t=>{let{theme:e}=t;const n="light"===e.palette.mode?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)";return{borderColor:e.vars?"rgba(".concat(e.vars.palette.common.onBackgroundChannel," / 0.23)"):n}})),Nd=(0,Ln.Ay)(dd,{name:"MuiOutlinedInput",slot:"Input",overridesResolver:cd})((t=>{let{theme:e,ownerState:n}=t;return(0,f.A)({padding:"16.5px 14px"},!e.vars&&{"&:-webkit-autofill":{WebkitBoxShadow:"light"===e.palette.mode?null:"0 0 0 100px #266798 inset",WebkitTextFillColor:"light"===e.palette.mode?null:"#fff",caretColor:"light"===e.palette.mode?null:"#fff",borderRadius:"inherit"}},e.vars&&{"&:-webkit-autofill":{borderRadius:"inherit"},[e.getColorSchemeSelector("dark")]:{"&:-webkit-autofill":{WebkitBoxShadow:"0 0 0 100px #266798 inset",WebkitTextFillColor:"#fff",caretColor:"#fff"}}},"small"===n.size&&{padding:"8.5px 14px"},n.multiline&&{padding:0},n.startAdornment&&{paddingLeft:0},n.endAdornment&&{paddingRight:0})})),jd=h.forwardRef((function(t,e){var n,r,i,o,s;const a=(0,p.A)({props:t,name:"MuiOutlinedInput"}),{components:l={},fullWidth:c=!1,inputComponent:u="input",label:d,multiline:g=!1,notched:m,slots:b={},type:y="text"}=a,x=(0,C.A)(a,Ld),A=(t=>{const{classes:e}=t,n=(0,Bn.A)({root:["root"],notchedOutline:["notchedOutline"],input:["input"]},Id,e);return(0,f.A)({},e,n)})(a),_=ms(),w=Vs({props:a,muiFormControl:_,states:["color","disabled","error","focused","hiddenLabel","size","required"]}),S=(0,f.A)({},a,{color:w.color||"primary",disabled:w.disabled,error:w.error,focused:w.focused,formControl:_,fullWidth:c,hiddenLabel:w.hiddenLabel,multiline:g,size:w.size,type:y}),E=null!=(n=null!=(r=b.root)?r:l.Root)?n:Dd,P=null!=(i=null!=(o=b.input)?o:l.Input)?i:Nd;return(0,v.jsx)(pd,(0,f.A)({slots:{root:E,input:P},renderSuffix:t=>(0,v.jsx)(Fd,{ownerState:S,className:A.notchedOutline,label:null!=d&&""!==d&&w.required?s||(s=(0,v.jsxs)(h.Fragment,{children:[d,"\u2009","*"]})):d,notched:"undefined"!==typeof m?m:Boolean(t.startAdornment||t.filled||t.focused)}),fullWidth:c,inputComponent:u,multiline:g,ref:e,type:y},x,{classes:(0,f.A)({},A,{notchedOutline:null})}))}));jd.muiName="Input";const zd=jd;function Ud(t){return(0,Fn.Ay)("MuiFormLabel",t)}const Vd=(0,Tn.A)("MuiFormLabel",["root","colorSecondary","focused","disabled","error","filled","required","asterisk"]),Gd=["children","className","color","component","disabled","error","filled","focused","required"],Wd=(0,Ln.Ay)("label",{name:"MuiFormLabel",slot:"Root",overridesResolver:(t,e)=>{let{ownerState:n}=t;return(0,f.A)({},e.root,"secondary"===n.color&&e.colorSecondary,n.filled&&e.filled)}})((t=>{let{theme:e,ownerState:n}=t;return(0,f.A)({color:(e.vars||e).palette.text.secondary},e.typography.body1,{lineHeight:"1.4375em",padding:0,position:"relative",["&.".concat(Vd.focused)]:{color:(e.vars||e).palette[n.color].main},["&.".concat(Vd.disabled)]:{color:(e.vars||e).palette.text.disabled},["&.".concat(Vd.error)]:{color:(e.vars||e).palette.error.main}})})),Hd=(0,Ln.Ay)("span",{name:"MuiFormLabel",slot:"Asterisk",overridesResolver:(t,e)=>e.asterisk})((t=>{let{theme:e}=t;return{["&.".concat(Vd.error)]:{color:(e.vars||e).palette.error.main}}})),Jd=h.forwardRef((function(t,e){const n=(0,p.A)({props:t,name:"MuiFormLabel"}),{children:r,className:i,component:o="label"}=n,s=(0,C.A)(n,Gd),a=Vs({props:n,muiFormControl:ms(),states:["color","required","focused","disabled","error","filled"]}),l=(0,f.A)({},n,{color:a.color||"primary",component:o,disabled:a.disabled,error:a.error,filled:a.filled,focused:a.focused,required:a.required}),c=(t=>{const{classes:e,color:n,focused:r,disabled:i,error:o,filled:s,required:a}=t,l={root:["root","color".concat((0,Dn.A)(n)),i&&"disabled",o&&"error",s&&"filled",r&&"focused",a&&"required"],asterisk:["asterisk",o&&"error"]};return(0,Bn.A)(l,Ud,e)})(l);return(0,v.jsxs)(Wd,(0,f.A)({as:o,ownerState:l,className:(0,wn.A)(c.root,i),ref:e},s,{children:[r,a.required&&(0,v.jsxs)(Hd,{ownerState:l,"aria-hidden":!0,className:c.asterisk,children:["\u2009","*"]})]}))})),Kd=Jd;function Xd(t){return(0,Fn.Ay)("MuiInputLabel",t)}(0,Tn.A)("MuiInputLabel",["root","focused","disabled","error","required","asterisk","formControl","sizeSmall","shrink","animated","standard","filled","outlined"]);const qd=["disableAnimation","margin","shrink","variant","className"],Yd=(0,Ln.Ay)(Kd,{shouldForwardProp:t=>(0,Li.A)(t)||"classes"===t,name:"MuiInputLabel",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[{["& .".concat(Vd.asterisk)]:e.asterisk},e.root,n.formControl&&e.formControl,"small"===n.size&&e.sizeSmall,n.shrink&&e.shrink,!n.disableAnimation&&e.animated,n.focused&&e.focused,e[n.variant]]}})((t=>{let{theme:e,ownerState:n}=t;return(0,f.A)({display:"block",transformOrigin:"top left",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"100%"},n.formControl&&{position:"absolute",left:0,top:0,transform:"translate(0, 20px) scale(1)"},"small"===n.size&&{transform:"translate(0, 17px) scale(1)"},n.shrink&&{transform:"translate(0, -1.5px) scale(0.75)",transformOrigin:"top left",maxWidth:"133%"},!n.disableAnimation&&{transition:e.transitions.create(["color","transform","max-width"],{duration:e.transitions.duration.shorter,easing:e.transitions.easing.easeOut})},"filled"===n.variant&&(0,f.A)({zIndex:1,pointerEvents:"none",transform:"translate(12px, 16px) scale(1)",maxWidth:"calc(100% - 24px)"},"small"===n.size&&{transform:"translate(12px, 13px) scale(1)"},n.shrink&&(0,f.A)({userSelect:"none",pointerEvents:"auto",transform:"translate(12px, 7px) scale(0.75)",maxWidth:"calc(133% - 24px)"},"small"===n.size&&{transform:"translate(12px, 4px) scale(0.75)"})),"outlined"===n.variant&&(0,f.A)({zIndex:1,pointerEvents:"none",transform:"translate(14px, 16px) scale(1)",maxWidth:"calc(100% - 24px)"},"small"===n.size&&{transform:"translate(14px, 9px) scale(1)"},n.shrink&&{userSelect:"none",pointerEvents:"auto",maxWidth:"calc(133% - 32px)",transform:"translate(14px, -9px) scale(0.75)"}))})),Qd=h.forwardRef((function(t,e){const n=(0,p.A)({name:"MuiInputLabel",props:t}),{disableAnimation:r=!1,shrink:i,className:o}=n,s=(0,C.A)(n,qd),a=ms();let l=i;"undefined"===typeof l&&a&&(l=a.filled||a.focused||a.adornedStart);const c=Vs({props:n,muiFormControl:a,states:["size","variant","required","focused"]}),u=(0,f.A)({},n,{disableAnimation:r,formControl:a,shrink:l,size:c.size,variant:c.variant,required:c.required,focused:c.focused}),d=(t=>{const{classes:e,formControl:n,size:r,shrink:i,disableAnimation:o,variant:s,required:a}=t,l={root:["root",n&&"formControl",!o&&"animated",i&&"shrink",r&&"normal"!==r&&"size".concat((0,Dn.A)(r)),s],asterisk:[a&&"asterisk"]},c=(0,Bn.A)(l,Xd,e);return(0,f.A)({},e,c)})(u);return(0,v.jsx)(Yd,(0,f.A)({"data-shrink":l,ownerState:u,ref:e,className:(0,wn.A)(d.root,o)},s,{classes:d}))}));function Zd(t){return(0,Fn.Ay)("MuiFormControl",t)}(0,Tn.A)("MuiFormControl",["root","marginNone","marginNormal","marginDense","fullWidth","disabled"]);const $d=["children","className","color","component","disabled","error","focused","fullWidth","hiddenLabel","margin","required","size","variant"],th=(0,Ln.Ay)("div",{name:"MuiFormControl",slot:"Root",overridesResolver:(t,e)=>{let{ownerState:n}=t;return(0,f.A)({},e.root,e["margin".concat((0,Dn.A)(n.margin))],n.fullWidth&&e.fullWidth)}})((t=>{let{ownerState:e}=t;return(0,f.A)({display:"inline-flex",flexDirection:"column",position:"relative",minWidth:0,padding:0,margin:0,border:0,verticalAlign:"top"},"normal"===e.margin&&{marginTop:16,marginBottom:8},"dense"===e.margin&&{marginTop:8,marginBottom:4},e.fullWidth&&{width:"100%"})})),eh=h.forwardRef((function(t,e){const n=(0,p.A)({props:t,name:"MuiFormControl"}),{children:r,className:i,color:o="primary",component:s="div",disabled:a=!1,error:l=!1,focused:c,fullWidth:u=!1,hiddenLabel:d=!1,margin:g="none",required:m=!1,size:b="medium",variant:y="outlined"}=n,x=(0,C.A)(n,$d),A=(0,f.A)({},n,{color:o,component:s,disabled:a,error:l,fullWidth:u,hiddenLabel:d,margin:g,required:m,size:b,variant:y}),_=(t=>{const{classes:e,margin:n,fullWidth:r}=t,i={root:["root","none"!==n&&"margin".concat((0,Dn.A)(n)),r&&"fullWidth"]};return(0,Bn.A)(i,Zd,e)})(A),[w,S]=h.useState((()=>{let t=!1;return r&&h.Children.forEach(r,(e=>{if(!(0,vi.A)(e,["Input","Select"]))return;const n=(0,vi.A)(e,["Select"])?e.props.input:e;n&&n.props.startAdornment&&(t=!0)})),t})),[E,P]=h.useState((()=>{let t=!1;return r&&h.Children.forEach(r,(e=>{(0,vi.A)(e,["Input","Select"])&&(id(e.props,!0)||id(e.props.inputProps,!0))&&(t=!0)})),t})),[M,T]=h.useState(!1);a&&M&&T(!1);const O=void 0===c||a?M:c;let k;const R=h.useMemo((()=>({adornedStart:w,setAdornedStart:S,color:o,disabled:a,error:l,filled:E,focused:O,fullWidth:u,hiddenLabel:d,size:b,onBlur:()=>{T(!1)},onEmpty:()=>{P(!1)},onFilled:()=>{P(!0)},onFocus:()=>{T(!0)},registerEffect:k,required:m,variant:y})),[w,o,a,l,E,O,u,d,k,m,b,y]);return(0,v.jsx)(gs.Provider,{value:R,children:(0,v.jsx)(th,(0,f.A)({as:s,ownerState:A,className:(0,wn.A)(_.root,i),ref:e},x,{children:r}))})})),nh=eh;function rh(t){return(0,Fn.Ay)("MuiFormHelperText",t)}const ih=(0,Tn.A)("MuiFormHelperText",["root","error","disabled","sizeSmall","sizeMedium","contained","focused","filled","required"]);var oh;const sh=["children","className","component","disabled","error","filled","focused","margin","required","variant"],ah=(0,Ln.Ay)("p",{name:"MuiFormHelperText",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,n.size&&e["size".concat((0,Dn.A)(n.size))],n.contained&&e.contained,n.filled&&e.filled]}})((t=>{let{theme:e,ownerState:n}=t;return(0,f.A)({color:(e.vars||e).palette.text.secondary},e.typography.caption,{textAlign:"left",marginTop:3,marginRight:0,marginBottom:0,marginLeft:0,["&.".concat(ih.disabled)]:{color:(e.vars||e).palette.text.disabled},["&.".concat(ih.error)]:{color:(e.vars||e).palette.error.main}},"small"===n.size&&{marginTop:4},n.contained&&{marginLeft:14,marginRight:14})})),lh=h.forwardRef((function(t,e){const n=(0,p.A)({props:t,name:"MuiFormHelperText"}),{children:r,className:i,component:o="p"}=n,s=(0,C.A)(n,sh),a=Vs({props:n,muiFormControl:ms(),states:["variant","size","disabled","error","filled","focused","required"]}),l=(0,f.A)({},n,{component:o,contained:"filled"===a.variant||"outlined"===a.variant,variant:a.variant,size:a.size,disabled:a.disabled,error:a.error,filled:a.filled,focused:a.focused,required:a.required}),c=(t=>{const{classes:e,contained:n,size:r,disabled:i,error:o,filled:s,focused:a,required:l}=t,c={root:["root",i&&"disabled",o&&"error",r&&"size".concat((0,Dn.A)(r)),n&&"contained",a&&"focused",s&&"filled",l&&"required"]};return(0,Bn.A)(c,rh,e)})(l);return(0,v.jsx)(ah,(0,f.A)({as:o,ownerState:l,className:(0,wn.A)(c.root,i),ref:e},s,{children:" "===r?oh||(oh=(0,v.jsx)("span",{className:"notranslate",children:"\u200b"})):r}))})),ch=lh;var uh=n(2427);const dh=nu,hh=["actions","autoFocus","autoFocusItem","children","className","disabledItemsFocusable","disableListWrap","onKeyDown","variant"];function fh(t,e,n){return t===e?t.firstChild:e&&e.nextElementSibling?e.nextElementSibling:n?null:t.firstChild}function ph(t,e,n){return t===e?n?t.firstChild:t.lastChild:e&&e.previousElementSibling?e.previousElementSibling:n?null:t.lastChild}function gh(t,e){if(void 0===e)return!0;let n=t.innerText;return void 0===n&&(n=t.textContent),n=n.trim().toLowerCase(),0!==n.length&&(e.repeating?n[0]===e.keys[0]:0===n.indexOf(e.keys.join("")))}function mh(t,e,n,r,i,o){let s=!1,a=i(t,e,!!e&&n);for(;a;){if(a===t.firstChild){if(s)return!1;s=!0}const e=!r&&(a.disabled||"true"===a.getAttribute("aria-disabled"));if(a.hasAttribute("tabindex")&&gh(a,o)&&!e)return a.focus(),!0;a=i(t,a,n)}return!1}const vh=h.forwardRef((function(t,e){const{actions:n,autoFocus:r=!1,autoFocusItem:i=!1,children:o,className:s,disabledItemsFocusable:a=!1,disableListWrap:l=!1,onKeyDown:c,variant:u="selectedMenu"}=t,d=(0,C.A)(t,hh),p=h.useRef(null),g=h.useRef({keys:[],repeating:!0,previousKeyMatched:!0,lastTime:null});(0,bi.A)((()=>{r&&p.current.focus()}),[r]),h.useImperativeHandle(n,(()=>({adjustStyleForScrollbar:(t,e)=>{let{direction:n}=e;const r=!p.current.style.width;if(t.clientHeight{h.isValidElement(t)?(t.props.disabled||("selectedMenu"===u&&t.props.selected||-1===b)&&(b=e),b===e&&(t.props.disabled||t.props.muiSkipListHighlight||t.type.muiSkipListHighlight)&&(b+=1,b>=o.length&&(b=-1))):b===e&&(b+=1,b>=o.length&&(b=-1))}));const y=h.Children.map(o,((t,e)=>{if(e===b){const e={};return i&&(e.autoFocus=!0),void 0===t.props.tabIndex&&"selectedMenu"===u&&(e.tabIndex=0),h.cloneElement(t,e)}return t}));return(0,v.jsx)(ss,(0,f.A)({role:"menu",ref:m,className:s,onKeyDown:t=>{const e=p.current,n=t.key,r=(0,uh.A)(e).activeElement;if("ArrowDown"===n)t.preventDefault(),mh(e,r,l,a,fh);else if("ArrowUp"===n)t.preventDefault(),mh(e,r,l,a,ph);else if("Home"===n)t.preventDefault(),mh(e,null,l,a,fh);else if("End"===n)t.preventDefault(),mh(e,null,l,a,ph);else if(1===n.length){const i=g.current,o=n.toLowerCase(),s=performance.now();i.keys.length>0&&(s-i.lastTime>500?(i.keys=[],i.repeating=!0,i.previousKeyMatched=!0):i.repeating&&o!==i.keys[0]&&(i.repeating=!1)),i.lastTime=s,i.keys.push(o);const l=r&&!i.repeating&&gh(r,i);i.previousKeyMatched&&(l||mh(e,r,!1,a,fh,i))?t.preventDefault():i.previousKeyMatched=!1}c&&c(t)},tabIndex:r?0:-1},d,{children:y}))})),bh=vh;var yh=n(950),xh=n(6078);function Ah(t){return(0,Fn.Ay)("MuiPopover",t)}(0,Tn.A)("MuiPopover",["root","paper"]);const _h=["onEntering"],wh=["action","anchorEl","anchorOrigin","anchorPosition","anchorReference","children","className","container","elevation","marginThreshold","open","PaperProps","slots","slotProps","transformOrigin","TransitionComponent","transitionDuration","TransitionProps","disableScrollLock"],Sh=["slotProps"];function Ch(t,e){let n=0;return"number"===typeof e?n=e:"center"===e?n=t.height/2:"bottom"===e&&(n=t.height),n}function Eh(t,e){let n=0;return"number"===typeof e?n=e:"center"===e?n=t.width/2:"right"===e&&(n=t.width),n}function Ph(t){return[t.horizontal,t.vertical].map((t=>"number"===typeof t?"".concat(t,"px"):t)).join(" ")}function Mh(t){return"function"===typeof t?t():t}const Th=(0,Ln.Ay)(Pu,{name:"MuiPopover",slot:"Root",overridesResolver:(t,e)=>e.root})({}),Oh=(0,Ln.Ay)(Qi,{name:"MuiPopover",slot:"Paper",overridesResolver:(t,e)=>e.paper})({position:"absolute",overflowY:"auto",overflowX:"hidden",minWidth:16,minHeight:16,maxWidth:"calc(100% - 32px)",maxHeight:"calc(100% - 32px)",outline:0}),kh=h.forwardRef((function(t,e){var n,r,i;const o=(0,p.A)({props:t,name:"MuiPopover"}),{action:s,anchorEl:a,anchorOrigin:l={vertical:"top",horizontal:"left"},anchorPosition:c,anchorReference:u="anchorEl",children:d,className:g,container:m,elevation:b=8,marginThreshold:y=16,open:x,PaperProps:A={},slots:_,slotProps:w,transformOrigin:S={vertical:"top",horizontal:"left"},TransitionComponent:E=Na,transitionDuration:P="auto",TransitionProps:{onEntering:M}={},disableScrollLock:T=!1}=o,O=(0,C.A)(o.TransitionProps,_h),k=(0,C.A)(o,wh),R=null!=(n=null==w?void 0:w.paper)?n:A,I=h.useRef(),B=(0,Lr.A)(I,R.ref),L=(0,f.A)({},o,{anchorOrigin:l,anchorReference:u,elevation:b,marginThreshold:y,externalPaperSlotProps:R,transformOrigin:S,TransitionComponent:E,transitionDuration:P,TransitionProps:O}),D=(t=>{const{classes:e}=t;return(0,Bn.A)({root:["root"],paper:["paper"]},Ah,e)})(L),F=h.useCallback((()=>{if("anchorPosition"===u)return c;const t=Mh(a),e=(t&&1===t.nodeType?t:(0,uh.A)(I.current).body).getBoundingClientRect();return{top:e.top+Ch(e,l.vertical),left:e.left+Eh(e,l.horizontal)}}),[a,l.horizontal,l.vertical,c,u]),N=h.useCallback((t=>({vertical:Ch(t,S.vertical),horizontal:Eh(t,S.horizontal)})),[S.horizontal,S.vertical]),j=h.useCallback((t=>{const e={width:t.offsetWidth,height:t.offsetHeight},n=N(e);if("none"===u)return{top:null,left:null,transformOrigin:Ph(n)};const r=F();let i=r.top-n.vertical,o=r.left-n.horizontal;const s=i+e.height,l=o+e.width,c=(0,xh.A)(Mh(a)),d=c.innerHeight-y,h=c.innerWidth-y;if(null!==y&&id){const t=s-d;i-=t,n.vertical+=t}if(null!==y&&oh){const t=l-h;o-=t,n.horizontal+=t}return{top:"".concat(Math.round(i),"px"),left:"".concat(Math.round(o),"px"),transformOrigin:Ph(n)}}),[a,u,F,N,y]),[z,U]=h.useState(x),V=h.useCallback((()=>{const t=I.current;if(!t)return;const e=j(t);null!==e.top&&(t.style.top=e.top),null!==e.left&&(t.style.left=e.left),t.style.transformOrigin=e.transformOrigin,U(!0)}),[j]);h.useEffect((()=>(T&&window.addEventListener("scroll",V),()=>window.removeEventListener("scroll",V))),[a,T,V]);h.useEffect((()=>{x&&V()})),h.useImperativeHandle(s,(()=>x?{updatePosition:()=>{V()}}:null),[x,V]),h.useEffect((()=>{if(!x)return;const t=(0,yh.A)((()=>{V()})),e=(0,xh.A)(a);return e.addEventListener("resize",t),()=>{t.clear(),e.removeEventListener("resize",t)}}),[a,x,V]);let G=P;"auto"!==P||E.muiSupportAuto||(G=void 0);const W=m||(a?(0,uh.A)(Mh(a)).body:void 0),H=null!=(r=null==_?void 0:_.root)?r:Th,J=null!=(i=null==_?void 0:_.paper)?i:Oh,K=bo({elementType:J,externalSlotProps:(0,f.A)({},R,{style:z?R.style:(0,f.A)({},R.style,{opacity:0})}),additionalProps:{elevation:b,ref:B},ownerState:L,className:(0,wn.A)(D.paper,null==R?void 0:R.className)}),X=bo({elementType:H,externalSlotProps:(null==w?void 0:w.root)||{},externalForwardedProps:k,additionalProps:{ref:e,slotProps:{backdrop:{invisible:!0}},container:W,open:x},ownerState:L,className:(0,wn.A)(D.root,g)}),{slotProps:q}=X,Y=(0,C.A)(X,Sh);return(0,v.jsx)(H,(0,f.A)({},Y,!Br(H)&&{slotProps:q,disableScrollLock:T},{children:(0,v.jsx)(E,(0,f.A)({appear:!0,in:x,onEntering:(t,e)=>{M&&M(t,e),V()},onExited:()=>{U(!1)},timeout:G},O,{children:(0,v.jsx)(J,(0,f.A)({},K,{children:d}))}))}))})),Rh=kh;function Ih(t){return(0,Fn.Ay)("MuiMenu",t)}(0,Tn.A)("MuiMenu",["root","paper","list"]);const Bh=["onEntering"],Lh=["autoFocus","children","className","disableAutoFocusItem","MenuListProps","onClose","open","PaperProps","PopoverClasses","transitionDuration","TransitionProps","variant","slots","slotProps"],Dh={vertical:"top",horizontal:"right"},Fh={vertical:"top",horizontal:"left"},Nh=(0,Ln.Ay)(Rh,{shouldForwardProp:t=>(0,Li.A)(t)||"classes"===t,name:"MuiMenu",slot:"Root",overridesResolver:(t,e)=>e.root})({}),jh=(0,Ln.Ay)(Oh,{name:"MuiMenu",slot:"Paper",overridesResolver:(t,e)=>e.paper})({maxHeight:"calc(100% - 96px)",WebkitOverflowScrolling:"touch"}),zh=(0,Ln.Ay)(bh,{name:"MuiMenu",slot:"List",overridesResolver:(t,e)=>e.list})({outline:0}),Uh=h.forwardRef((function(t,e){var n,r;const i=(0,p.A)({props:t,name:"MuiMenu"}),{autoFocus:o=!0,children:s,className:a,disableAutoFocusItem:l=!1,MenuListProps:c={},onClose:u,open:d,PaperProps:g={},PopoverClasses:m,transitionDuration:b="auto",TransitionProps:{onEntering:y}={},variant:x="selectedMenu",slots:A={},slotProps:_={}}=i,w=(0,C.A)(i.TransitionProps,Bh),S=(0,C.A)(i,Lh),E=B(),P=(0,f.A)({},i,{autoFocus:o,disableAutoFocusItem:l,MenuListProps:c,onEntering:y,PaperProps:g,transitionDuration:b,TransitionProps:w,variant:x}),M=(t=>{const{classes:e}=t;return(0,Bn.A)({root:["root"],paper:["paper"],list:["list"]},Ih,e)})(P),T=o&&!l&&d,O=h.useRef(null);let k=-1;h.Children.map(s,((t,e)=>{h.isValidElement(t)&&(t.props.disabled||("selectedMenu"===x&&t.props.selected||-1===k)&&(k=e))}));const R=null!=(n=A.paper)?n:jh,I=null!=(r=_.paper)?r:g,L=bo({elementType:A.root,externalSlotProps:_.root,ownerState:P,className:[M.root,a]}),D=bo({elementType:R,externalSlotProps:I,ownerState:P,className:M.paper});return(0,v.jsx)(Nh,(0,f.A)({onClose:u,anchorOrigin:{vertical:"bottom",horizontal:E?"right":"left"},transformOrigin:E?Dh:Fh,slots:{paper:R,root:A.root},slotProps:{root:L,paper:D},open:d,ref:e,transitionDuration:b,TransitionProps:(0,f.A)({onEntering:(t,e)=>{O.current&&O.current.adjustStyleForScrollbar(t,{direction:E?"rtl":"ltr"}),y&&y(t,e)}},w),ownerState:P},S,{classes:m,children:(0,v.jsx)(zh,(0,f.A)({onKeyDown:t=>{"Tab"===t.key&&(t.preventDefault(),u&&u(t,"tabKeyDown"))},actions:O,autoFocus:o&&(-1===k||l),autoFocusItem:T,variant:x},c,{className:(0,wn.A)(M.list,c.className),children:s}))}))})),Vh=Uh;function Gh(t){return(0,Fn.Ay)("MuiNativeSelect",t)}const Wh=(0,Tn.A)("MuiNativeSelect",["root","select","multiple","filled","outlined","standard","disabled","icon","iconOpen","iconFilled","iconOutlined","iconStandard","nativeInput","error"]),Hh=["className","disabled","error","IconComponent","inputRef","variant"],Jh=t=>{let{ownerState:e,theme:n}=t;return(0,f.A)({MozAppearance:"none",WebkitAppearance:"none",userSelect:"none",borderRadius:0,cursor:"pointer","&:focus":(0,f.A)({},n.vars?{backgroundColor:"rgba(".concat(n.vars.palette.common.onBackgroundChannel," / 0.05)")}:{backgroundColor:"light"===n.palette.mode?"rgba(0, 0, 0, 0.05)":"rgba(255, 255, 255, 0.05)"},{borderRadius:0}),"&::-ms-expand":{display:"none"},["&.".concat(Wh.disabled)]:{cursor:"default"},"&[multiple]":{height:"auto"},"&:not([multiple]) option, &:not([multiple]) optgroup":{backgroundColor:(n.vars||n).palette.background.paper},"&&&":{paddingRight:24,minWidth:16}},"filled"===e.variant&&{"&&&":{paddingRight:32}},"outlined"===e.variant&&{borderRadius:(n.vars||n).shape.borderRadius,"&:focus":{borderRadius:(n.vars||n).shape.borderRadius},"&&&":{paddingRight:32}})},Kh=(0,Ln.Ay)("select",{name:"MuiNativeSelect",slot:"Select",shouldForwardProp:Li.A,overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.select,e[n.variant],n.error&&e.error,{["&.".concat(Wh.multiple)]:e.multiple}]}})(Jh),Xh=t=>{let{ownerState:e,theme:n}=t;return(0,f.A)({position:"absolute",right:0,top:"calc(50% - .5em)",pointerEvents:"none",color:(n.vars||n).palette.action.active,["&.".concat(Wh.disabled)]:{color:(n.vars||n).palette.action.disabled}},e.open&&{transform:"rotate(180deg)"},"filled"===e.variant&&{right:7},"outlined"===e.variant&&{right:7})},qh=(0,Ln.Ay)("svg",{name:"MuiNativeSelect",slot:"Icon",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.icon,n.variant&&e["icon".concat((0,Dn.A)(n.variant))],n.open&&e.iconOpen]}})(Xh),Yh=h.forwardRef((function(t,e){const{className:n,disabled:r,error:i,IconComponent:o,inputRef:s,variant:a="standard"}=t,l=(0,C.A)(t,Hh),c=(0,f.A)({},t,{disabled:r,variant:a,error:i}),u=(t=>{const{classes:e,variant:n,disabled:r,multiple:i,open:o,error:s}=t,a={select:["select",n,r&&"disabled",i&&"multiple",s&&"error"],icon:["icon","icon".concat((0,Dn.A)(n)),o&&"iconOpen",r&&"disabled"]};return(0,Bn.A)(a,Gh,e)})(c);return(0,v.jsxs)(h.Fragment,{children:[(0,v.jsx)(Kh,(0,f.A)({ownerState:c,className:(0,wn.A)(u.select,n),disabled:r,ref:s||e},l)),t.multiple?null:(0,v.jsx)(qh,{as:o,ownerState:c,className:u.icon})]})})),Qh=Yh;function Zh(t){return(0,Fn.Ay)("MuiSelect",t)}const $h=(0,Tn.A)("MuiSelect",["root","select","multiple","filled","outlined","standard","disabled","focused","icon","iconOpen","iconFilled","iconOutlined","iconStandard","nativeInput","error"]);var tf;const ef=["aria-describedby","aria-label","autoFocus","autoWidth","children","className","defaultOpen","defaultValue","disabled","displayEmpty","error","IconComponent","inputRef","labelId","MenuProps","multiple","name","onBlur","onChange","onClose","onFocus","onOpen","open","readOnly","renderValue","SelectDisplayProps","tabIndex","type","value","variant"],nf=(0,Ln.Ay)("div",{name:"MuiSelect",slot:"Select",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[{["&.".concat($h.select)]:e.select},{["&.".concat($h.select)]:e[n.variant]},{["&.".concat($h.error)]:e.error},{["&.".concat($h.multiple)]:e.multiple}]}})(Jh,{["&.".concat($h.select)]:{height:"auto",minHeight:"1.4375em",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden"}}),rf=(0,Ln.Ay)("svg",{name:"MuiSelect",slot:"Icon",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.icon,n.variant&&e["icon".concat((0,Dn.A)(n.variant))],n.open&&e.iconOpen]}})(Xh),of=(0,Ln.Ay)("input",{shouldForwardProp:t=>(0,zo.A)(t)&&"classes"!==t,name:"MuiSelect",slot:"NativeInput",overridesResolver:(t,e)=>e.nativeInput})({bottom:0,left:0,position:"absolute",opacity:0,pointerEvents:"none",width:"100%",boxSizing:"border-box"});function sf(t,e){return"object"===typeof e&&null!==e?t===e:String(t)===String(e)}function af(t){return null==t||"string"===typeof t&&!t.trim()}const lf=h.forwardRef((function(t,e){var n;const{"aria-describedby":r,"aria-label":i,autoFocus:o,autoWidth:s,children:a,className:l,defaultOpen:c,defaultValue:u,disabled:d,displayEmpty:p,error:g=!1,IconComponent:m,inputRef:b,labelId:y,MenuProps:x={},multiple:A,name:_,onBlur:w,onChange:S,onClose:E,onFocus:P,onOpen:M,open:T,readOnly:O,renderValue:k,SelectDisplayProps:R={},tabIndex:I,value:B,variant:L="standard"}=t,D=(0,C.A)(t,ef),[F,N]=(0,Xs.A)({controlled:B,default:u,name:"Select"}),[j,z]=(0,Xs.A)({controlled:T,default:c,name:"Select"}),U=h.useRef(null),V=h.useRef(null),[G,W]=h.useState(null),{current:H}=h.useRef(null!=T),[J,K]=h.useState(),X=(0,Lr.A)(e,b),q=h.useCallback((t=>{V.current=t,t&&W(t)}),[]),Y=null==G?void 0:G.parentNode;h.useImperativeHandle(X,(()=>({focus:()=>{V.current.focus()},node:U.current,value:F})),[F]),h.useEffect((()=>{c&&j&&G&&!H&&(K(s?null:Y.clientWidth),V.current.focus())}),[G,s]),h.useEffect((()=>{o&&V.current.focus()}),[o]),h.useEffect((()=>{if(!y)return;const t=(0,uh.A)(V.current).getElementById(y);if(t){const e=()=>{getSelection().isCollapsed&&V.current.focus()};return t.addEventListener("click",e),()=>{t.removeEventListener("click",e)}}}),[y]);const Q=(t,e)=>{t?M&&M(e):E&&E(e),H||(K(s?null:Y.clientWidth),z(t))},Z=h.Children.toArray(a),$=t=>e=>{let n;if(e.currentTarget.hasAttribute("tabindex")){if(A){n=Array.isArray(F)?F.slice():[];const e=F.indexOf(t.props.value);-1===e?n.push(t.props.value):n.splice(e,1)}else n=t.props.value;if(t.props.onClick&&t.props.onClick(e),F!==n&&(N(n),S)){const r=e.nativeEvent||e,i=new r.constructor(r.type,r);Object.defineProperty(i,"target",{writable:!0,value:{value:n,name:_}}),S(i,t)}A||Q(!1,e)}},tt=null!==G&&j;let et,nt;delete D["aria-invalid"];const rt=[];let it=!1,ot=!1;(id({value:F})||p)&&(k?et=k(F):it=!0);const st=Z.map((t=>{if(!h.isValidElement(t))return null;let e;if(A){if(!Array.isArray(F))throw new Error((0,Qu.A)(2));e=F.some((e=>sf(e,t.props.value))),e&&it&&rt.push(t.props.children)}else e=sf(F,t.props.value),e&&it&&(nt=t.props.children);return e&&(ot=!0),h.cloneElement(t,{"aria-selected":e?"true":"false",onClick:$(t),onKeyUp:e=>{" "===e.key&&e.preventDefault(),t.props.onKeyUp&&t.props.onKeyUp(e)},role:"option",selected:e,value:void 0,"data-value":t.props.value})}));it&&(et=A?0===rt.length?null:rt.reduce(((t,e,n)=>(t.push(e),n{const{classes:e,variant:n,disabled:r,multiple:i,open:o,error:s}=t,a={select:["select",n,r&&"disabled",i&&"multiple",s&&"error"],icon:["icon","icon".concat((0,Dn.A)(n)),o&&"iconOpen",r&&"disabled"],nativeInput:["nativeInput"]};return(0,Bn.A)(a,Zh,e)})(ut),ht=(0,f.A)({},x.PaperProps,null==(n=x.slotProps)?void 0:n.paper),ft=(0,$c.A)();return(0,v.jsxs)(h.Fragment,{children:[(0,v.jsx)(nf,(0,f.A)({ref:q,tabIndex:at,role:"combobox","aria-controls":ft,"aria-disabled":d?"true":void 0,"aria-expanded":tt?"true":"false","aria-haspopup":"listbox","aria-label":i,"aria-labelledby":[y,ct].filter(Boolean).join(" ")||void 0,"aria-describedby":r,onKeyDown:t=>{if(!O){-1!==[" ","ArrowUp","ArrowDown","Enter"].indexOf(t.key)&&(t.preventDefault(),Q(!0,t))}},onMouseDown:d||O?null:t=>{0===t.button&&(t.preventDefault(),V.current.focus(),Q(!0,t))},onBlur:t=>{!tt&&w&&(Object.defineProperty(t,"target",{writable:!0,value:{value:F,name:_}}),w(t))},onFocus:P},R,{ownerState:ut,className:(0,wn.A)(R.className,dt.select,l),id:ct,children:af(et)?tf||(tf=(0,v.jsx)("span",{className:"notranslate",children:"\u200b"})):et})),(0,v.jsx)(of,(0,f.A)({"aria-invalid":g,value:Array.isArray(F)?F.join(","):F,name:_,ref:U,"aria-hidden":!0,onChange:t=>{const e=Z.find((e=>e.props.value===t.target.value));void 0!==e&&(N(e.props.value),S&&S(t,e))},tabIndex:-1,disabled:d,className:dt.nativeInput,autoFocus:o,ownerState:ut},D)),(0,v.jsx)(rf,{as:m,className:dt.icon,ownerState:ut}),(0,v.jsx)(Vh,(0,f.A)({id:"menu-".concat(_||""),anchorEl:Y,open:tt,onClose:t=>{Q(!1,t)},anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"}},x,{MenuListProps:(0,f.A)({"aria-labelledby":y,role:"listbox","aria-multiselectable":A?"true":void 0,disableListWrap:!0,id:ft},x.MenuListProps),slotProps:(0,f.A)({},x.slotProps,{paper:(0,f.A)({},ht,{style:(0,f.A)({minWidth:lt},null!=ht?ht.style:null)})}),children:st}))]})})),cf=lf,uf=(0,ta.A)((0,v.jsx)("path",{d:"M7 10l5 5 5-5z"}),"ArrowDropDown"),df=["autoWidth","children","classes","className","defaultOpen","displayEmpty","IconComponent","id","input","inputProps","label","labelId","MenuProps","multiple","native","onClose","onOpen","open","renderValue","SelectDisplayProps","variant"],hf=["root"],ff={name:"MuiSelect",overridesResolver:(t,e)=>e.root,shouldForwardProp:t=>(0,Li.A)(t)&&"variant"!==t,slot:"Root"},pf=(0,Ln.Ay)(Ad,ff)(""),gf=(0,Ln.Ay)(zd,ff)(""),mf=(0,Ln.Ay)(Md,ff)(""),vf=h.forwardRef((function(t,e){const n=(0,p.A)({name:"MuiSelect",props:t}),{autoWidth:r=!1,children:i,classes:o={},className:s,defaultOpen:a=!1,displayEmpty:l=!1,IconComponent:c=uf,id:u,input:d,inputProps:g,label:m,labelId:b,MenuProps:y,multiple:x=!1,native:A=!1,onClose:_,onOpen:w,open:S,renderValue:E,SelectDisplayProps:P,variant:M="outlined"}=n,T=(0,C.A)(n,df),O=A?Qh:cf,k=Vs({props:n,muiFormControl:ms(),states:["variant","error"]}),R=k.variant||M,I=(0,f.A)({},n,{variant:R,classes:o}),B=(t=>{const{classes:e}=t;return e})(I),L=(0,C.A)(B,hf),D=d||{standard:(0,v.jsx)(pf,{ownerState:I}),outlined:(0,v.jsx)(gf,{label:m,ownerState:I}),filled:(0,v.jsx)(mf,{ownerState:I})}[R],F=(0,Lr.A)(e,D.ref);return(0,v.jsx)(h.Fragment,{children:h.cloneElement(D,(0,f.A)({inputComponent:O,inputProps:(0,f.A)({children:i,error:k.error,IconComponent:c,variant:R,type:void 0,multiple:x},A?{id:u}:{autoWidth:r,defaultOpen:a,displayEmpty:l,labelId:b,MenuProps:y,onClose:_,onOpen:w,open:S,renderValue:E,SelectDisplayProps:(0,f.A)({id:u},P)},g,{classes:g?(0,vs.A)(L,g.classes):L},d?d.props.inputProps:{})},(x&&A||l)&&"outlined"===R?{notched:!0}:{},{ref:F,className:(0,wn.A)(D.props.className,s,B.root)},!d&&{variant:R},T))})}));vf.muiName="Select";const bf=vf;function yf(t){return(0,Fn.Ay)("MuiTextField",t)}(0,Tn.A)("MuiTextField",["root"]);const xf=["autoComplete","autoFocus","children","className","color","defaultValue","disabled","error","FormHelperTextProps","fullWidth","helperText","id","InputLabelProps","inputProps","InputProps","inputRef","label","maxRows","minRows","multiline","name","onBlur","onChange","onFocus","placeholder","required","rows","select","SelectProps","type","value","variant"],Af={standard:Ad,filled:Md,outlined:zd},_f=(0,Ln.Ay)(nh,{name:"MuiTextField",slot:"Root",overridesResolver:(t,e)=>e.root})({}),wf=h.forwardRef((function(t,e){const n=(0,p.A)({props:t,name:"MuiTextField"}),{autoComplete:r,autoFocus:i=!1,children:o,className:s,color:a="primary",defaultValue:l,disabled:c=!1,error:u=!1,FormHelperTextProps:d,fullWidth:h=!1,helperText:g,id:m,InputLabelProps:b,inputProps:y,InputProps:x,inputRef:A,label:_,maxRows:w,minRows:S,multiline:E=!1,name:P,onBlur:M,onChange:T,onFocus:O,placeholder:k,required:R=!1,rows:I,select:B=!1,SelectProps:L,type:D,value:F,variant:N="outlined"}=n,j=(0,C.A)(n,xf),z=(0,f.A)({},n,{autoFocus:i,color:a,disabled:c,error:u,fullWidth:h,multiline:E,required:R,select:B,variant:N}),U=(t=>{const{classes:e}=t;return(0,Bn.A)({root:["root"]},yf,e)})(z);const V={};"outlined"===N&&(b&&"undefined"!==typeof b.shrink&&(V.notched=b.shrink),V.label=_),B&&(L&&L.native||(V.id=void 0),V["aria-describedby"]=void 0);const G=(0,$c.A)(m),W=g&&G?"".concat(G,"-helper-text"):void 0,H=_&&G?"".concat(G,"-label"):void 0,J=Af[N],K=(0,v.jsx)(J,(0,f.A)({"aria-describedby":W,autoComplete:r,autoFocus:i,defaultValue:l,fullWidth:h,multiline:E,name:P,rows:I,maxRows:w,minRows:S,type:D,value:F,id:G,inputRef:A,onBlur:M,onChange:T,onFocus:O,placeholder:k,inputProps:y},V,x));return(0,v.jsxs)(_f,(0,f.A)({className:(0,wn.A)(U.root,s),disabled:c,error:u,fullWidth:h,ref:e,required:R,color:a,variant:N,ownerState:z},j,{children:[null!=_&&""!==_&&(0,v.jsx)(Qd,(0,f.A)({htmlFor:G,id:H},b,{children:_})),B?(0,v.jsx)(bf,(0,f.A)({"aria-describedby":W,id:G,labelId:H,value:F,input:K},L,{children:o})):K,g&&(0,v.jsx)(ch,(0,f.A)({id:W},d,{children:g}))]}))})),Sf=wf;function Cf(t){return(0,Fn.Ay)("MuiDialogActions",t)}(0,Tn.A)("MuiDialogActions",["root","spacing"]);const Ef=["className","disableSpacing"],Pf=(0,Ln.Ay)("div",{name:"MuiDialogActions",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,!n.disableSpacing&&e.spacing]}})((t=>{let{ownerState:e}=t;return(0,f.A)({display:"flex",alignItems:"center",padding:8,justifyContent:"flex-end",flex:"0 0 auto"},!e.disableSpacing&&{"& > :not(style) ~ :not(style)":{marginLeft:8}})})),Mf=h.forwardRef((function(t,e){const n=(0,p.A)({props:t,name:"MuiDialogActions"}),{className:r,disableSpacing:i=!1}=n,o=(0,C.A)(n,Ef),s=(0,f.A)({},n,{disableSpacing:i}),a=(t=>{const{classes:e,disableSpacing:n}=t,r={root:["root",!n&&"spacing"]};return(0,Bn.A)(r,Cf,e)})(s);return(0,v.jsx)(Pf,(0,f.A)({className:(0,wn.A)(a.root,r),ownerState:s,ref:e},o))}));var Tf=n(6577),Of=n(3471),kf=n(4681);function Rf(){const[t,e]=(0,h.useState)([]),[n,r]=(0,h.useState)([]),[i,o]=(0,h.useState)(),[s,a]=(0,h.useState)(!1),[l,c]=(0,h.useState)(!1),[u,d]=(0,h.useState)(!1),[f,p]=(0,h.useState)({name:"",description:""}),g=et((t=>t.cityIOdataState.cityIOdata)),{sendJsonMessage:m}=(0,_n.Ay)(bn.cityIO.websocketURL,{share:!0,shouldReconnect:()=>!0}),b=()=>{c(!1),a(!1),d(!1)},y=()=>{const t=g.scenarios.filter((t=>!t.isInBin)).map(((t,e)=>(0,v.jsxs)(Ii,{children:[(0,v.jsx)(Fc,{sx:{width:"100%"},arrow:!0,placement:"right",title:t.description||"No description",children:(0,v.jsx)(Ji,{fullWidth:!0,sx:{width:"100%"},size:"small",variant:"outlined",onClick:()=>(t=>{o(t),c(!0)})(t),children:(0,v.jsxs)(ss,{children:[(0,v.jsx)(Ii,{children:(0,v.jsx)(Wn,{children:t.name.substring(0,15)+"..."})}),(0,v.jsx)(Ii,{children:(0,v.jsx)(Wn,{variant:"caption",children:t.description.substring(0,20)+"..."})})]})},"scenario_button_"+e)},"scenario_tt_"+e),(0,v.jsx)(Gc,{onClick:e=>{(t=>{const e=[...g.scenarios];var n=e.filter((e=>e.hash===t.hash)),r=e.indexOf(n[0]);if(-1!==r){let t=e[r];m({type:"MODIFY_SCENARIO",content:{name:t.name,isInBin:!0}})}b()})(t)},"aria-label":"delete",size:"medium",children:(0,v.jsx)(Of.A,{color:"primary",fontSize:"inherit"},"scenario_delicon_"+e)},"scenario_ib_"+e)]},"scenario_grid_item_".concat(e))));return t},x=()=>{const t=g.scenarios.filter((t=>t.isInBin)).map(((t,e)=>(0,v.jsxs)(Ii,{children:[(0,v.jsx)(Fc,{sx:{width:"100%"},arrow:!0,placement:"right",title:t.description||"No description",children:(0,v.jsx)(Ji,{fullWidth:!0,sx:{width:"100%"},size:"small",variant:"outlined",children:(0,v.jsxs)(ss,{children:[(0,v.jsx)(Ii,{children:(0,v.jsx)(Wn,{children:t.name.substring(0,15)+"..."})}),(0,v.jsx)(Ii,{children:(0,v.jsx)(Wn,{variant:"caption",children:t.description.substring(0,20)+"..."})})]})},"scenario_button_"+e)},"scenario_tt_"+e),(0,v.jsx)(Gc,{onClick:e=>{(t=>{const e=[...g.scenarios];var n=e.filter((e=>e.hash===t.hash)),r=e.indexOf(n[0]);if(-1!==r){let t=e[r];m({type:"MODIFY_SCENARIO",content:{name:t.name,isInBin:!1}})}b()})(t)},"aria-label":"delete",size:"large",children:(0,v.jsx)(kf.A,{color:"primary",fontSize:"inherit"},"scenario_resticon_"+e)},"scenario_ib_"+e)]},"scenario_grid_item_".concat(e))));return t};return(0,h.useEffect)((()=>{if(!g.scenarios)return;const t=y();e(t);const n=x();r(n)}),[g]),(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(Zc,{sx:{width:"100%"},badgeContent:g.scenarios&&g.scenarios.length||0,color:"primary",children:[(0,v.jsx)(Ji,{fullWidth:!0,variant:"outlined",onClick:()=>a(!0),children:(0,v.jsx)(Wn,{children:"Save This Scenario"})},"save_state_button"),(0,v.jsx)(Ji,{onClick:()=>d(!0),children:(0,v.jsx)(Tf.A,{})})]}),(0,v.jsx)(ss,{children:t}),(0,v.jsxs)(Fu,{open:s,onClose:b,children:[(0,v.jsx)(Vu,{id:"save-dialog-title",children:"Save this Scenario"}),(0,v.jsxs)(Ju,{children:[(0,v.jsx)(Yu,{id:"alert-dialog-description",children:"Give your scenario a name and a description to help you remember what it is about."}),(0,v.jsxs)(ss,{children:[(0,v.jsx)(Ii,{children:(0,v.jsx)(Sf,{id:"name-basic",label:"Scenario Name",variant:"outlined",fullWidth:!0,onChange:t=>p({...f,name:t.target.value})})}),(0,v.jsx)(Ii,{children:(0,v.jsx)(Sf,{id:"desc-basic",label:"Description (optional)",fullWidth:!0,variant:"outlined",onChange:t=>p({...f,description:t.target.value})})})]})]}),(0,v.jsxs)(Mf,{children:[(0,v.jsx)(Ji,{onClick:b,children:"Cancel"}),(0,v.jsx)(Ji,{onClick:()=>{b();const t={name:f.name||"noname",description:f.description||"no description yet."};m({type:"SAVE_SCENARIO",content:t})},autoFocus:!0,children:"Save"})]})]}),(0,v.jsxs)(Fu,{open:l,onClose:b,children:[(0,v.jsx)(Vu,{id:"alert-dialog-title",children:"Revert to saved scenario?"}),(0,v.jsx)(Ju,{children:(0,v.jsx)(Yu,{id:"alert-dialog-description",children:"You can revert to this saved scenario by clicking the button below. Reverting will delete all changes made since the last commit."})}),(0,v.jsxs)(Mf,{children:[(0,v.jsx)(Ji,{onClick:b,children:"Cancel"}),(0,v.jsx)(Ji,{onClick:async()=>{i&&(m({type:"RESTORE_SCENARIO",content:{name:i.name}}),b())},autoFocus:!0,children:"Revert"})]})]}),(0,v.jsxs)(Fu,{open:u,onClose:b,children:[(0,v.jsx)(Vu,{id:"alert-dialog-title",children:"Bin"}),(0,v.jsx)(Yu,{id:"alert-dialog-description",sx:{padding:2},children:"The scenarios in the bin will be permanently deleted after 15 days."}),(0,v.jsx)(Ju,{children:(0,v.jsx)(ss,{children:n})}),(0,v.jsx)(Mf,{children:(0,v.jsx)(Ji,{onClick:b,children:"Cancel"})})]})]})}const If=["addEndListener","appear","children","container","direction","easing","in","onEnter","onEntered","onEntering","onExit","onExited","onExiting","style","timeout","TransitionComponent"];function Bf(t,e,n){var r;const i=function(t,e,n){const r=e.getBoundingClientRect(),i=n&&n.getBoundingClientRect(),o=(0,xh.A)(e);let s;if(e.fakeTransform)s=e.fakeTransform;else{const t=o.getComputedStyle(e);s=t.getPropertyValue("-webkit-transform")||t.getPropertyValue("transform")}let a=0,l=0;if(s&&"none"!==s&&"string"===typeof s){const t=s.split("(")[1].split(")")[0].split(",");a=parseInt(t[4],10),l=parseInt(t[5],10)}return"left"===t?"translateX(".concat(i?i.right+a-r.left:o.innerWidth+a-r.left,"px)"):"right"===t?"translateX(-".concat(i?r.right-i.left-a:r.left+r.width-a,"px)"):"up"===t?"translateY(".concat(i?i.bottom+l-r.top:o.innerHeight+l-r.top,"px)"):"translateY(-".concat(i?r.top-i.top+r.height-l:r.top+r.height-l,"px)")}(t,e,"function"===typeof(r=n)?r():r);i&&(e.style.webkitTransform=i,e.style.transform=i)}const Lf=h.forwardRef((function(t,e){const n=Ar(),r={enter:n.transitions.easing.easeOut,exit:n.transitions.easing.sharp},i={enter:n.transitions.duration.enteringScreen,exit:n.transitions.duration.leavingScreen},{addEndListener:o,appear:s=!0,children:a,container:l,direction:c="down",easing:u=r,in:d,onEnter:p,onEntered:g,onEntering:m,onExit:b,onExited:y,onExiting:x,style:A,timeout:_=i,TransitionComponent:w=Oa}=t,S=(0,C.A)(t,If),E=h.useRef(null),P=(0,Lr.A)(a.ref,E,e),M=t=>e=>{t&&(void 0===e?t(E.current):t(E.current,e))},T=M(((t,e)=>{Bf(c,t,l),ka(t),p&&p(t,e)})),O=M(((t,e)=>{const r=Ra({timeout:_,style:A,easing:u},{mode:"enter"});t.style.webkitTransition=n.transitions.create("-webkit-transform",(0,f.A)({},r)),t.style.transition=n.transitions.create("transform",(0,f.A)({},r)),t.style.webkitTransform="none",t.style.transform="none",m&&m(t,e)})),k=M(g),R=M(x),I=M((t=>{const e=Ra({timeout:_,style:A,easing:u},{mode:"exit"});t.style.webkitTransition=n.transitions.create("-webkit-transform",e),t.style.transition=n.transitions.create("transform",e),Bf(c,t,l),b&&b(t)})),B=M((t=>{t.style.webkitTransition="",t.style.transition="",y&&y(t)})),L=h.useCallback((()=>{E.current&&Bf(c,E.current,l)}),[c,l]);return h.useEffect((()=>{if(d||"down"===c||"right"===c)return;const t=(0,yh.A)((()=>{E.current&&Bf(c,E.current,l)})),e=(0,xh.A)(E.current);return e.addEventListener("resize",t),()=>{t.clear(),e.removeEventListener("resize",t)}}),[c,d,l]),h.useEffect((()=>{d||L()}),[d,L]),(0,v.jsx)(w,(0,f.A)({nodeRef:E,onEnter:T,onEntered:k,onEntering:O,onExit:I,onExited:B,onExiting:R,addEndListener:t=>{o&&o(E.current,t)},appear:s,in:d,timeout:_},S,{children:(t,e)=>h.cloneElement(a,(0,f.A)({ref:P,style:(0,f.A)({visibility:"exited"!==t||d?void 0:"hidden"},A,a.props.style)},e))}))})),Df=Lf;function Ff(t){return(0,Fn.Ay)("MuiDrawer",t)}(0,Tn.A)("MuiDrawer",["root","docked","paper","paperAnchorLeft","paperAnchorRight","paperAnchorTop","paperAnchorBottom","paperAnchorDockedLeft","paperAnchorDockedRight","paperAnchorDockedTop","paperAnchorDockedBottom","modal"]);const Nf=["BackdropProps"],jf=["anchor","BackdropProps","children","className","elevation","hideBackdrop","ModalProps","onClose","open","PaperProps","SlideProps","TransitionComponent","transitionDuration","variant"],zf=(t,e)=>{const{ownerState:n}=t;return[e.root,("permanent"===n.variant||"persistent"===n.variant)&&e.docked,e.modal]},Uf=(0,Ln.Ay)(Pu,{name:"MuiDrawer",slot:"Root",overridesResolver:zf})((t=>{let{theme:e}=t;return{zIndex:(e.vars||e).zIndex.drawer}})),Vf=(0,Ln.Ay)("div",{shouldForwardProp:Li.A,name:"MuiDrawer",slot:"Docked",skipVariantsResolver:!1,overridesResolver:zf})({flex:"0 0 auto"}),Gf=(0,Ln.Ay)(Qi,{name:"MuiDrawer",slot:"Paper",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.paper,e["paperAnchor".concat((0,Dn.A)(n.anchor))],"temporary"!==n.variant&&e["paperAnchorDocked".concat((0,Dn.A)(n.anchor))]]}})((t=>{let{theme:e,ownerState:n}=t;return(0,f.A)({overflowY:"auto",display:"flex",flexDirection:"column",height:"100%",flex:"1 0 auto",zIndex:(e.vars||e).zIndex.drawer,WebkitOverflowScrolling:"touch",position:"fixed",top:0,outline:0},"left"===n.anchor&&{left:0},"top"===n.anchor&&{top:0,left:0,right:0,height:"auto",maxHeight:"100%"},"right"===n.anchor&&{right:0},"bottom"===n.anchor&&{top:"auto",left:0,bottom:0,right:0,height:"auto",maxHeight:"100%"},"left"===n.anchor&&"temporary"!==n.variant&&{borderRight:"1px solid ".concat((e.vars||e).palette.divider)},"top"===n.anchor&&"temporary"!==n.variant&&{borderBottom:"1px solid ".concat((e.vars||e).palette.divider)},"right"===n.anchor&&"temporary"!==n.variant&&{borderLeft:"1px solid ".concat((e.vars||e).palette.divider)},"bottom"===n.anchor&&"temporary"!==n.variant&&{borderTop:"1px solid ".concat((e.vars||e).palette.divider)})})),Wf={left:"right",right:"left",top:"down",bottom:"up"};const Hf=h.forwardRef((function(t,e){const n=(0,p.A)({props:t,name:"MuiDrawer"}),r=Ar(),i=B(),o={enter:r.transitions.duration.enteringScreen,exit:r.transitions.duration.leavingScreen},{anchor:s="left",BackdropProps:a,children:l,className:c,elevation:u=16,hideBackdrop:d=!1,ModalProps:{BackdropProps:g}={},onClose:m,open:b=!1,PaperProps:y={},SlideProps:x,TransitionComponent:A=Df,transitionDuration:_=o,variant:w="temporary"}=n,S=(0,C.A)(n.ModalProps,Nf),E=(0,C.A)(n,jf),P=h.useRef(!1);h.useEffect((()=>{P.current=!0}),[]);const M=function(t,e){let{direction:n}=t;return"rtl"===n&&function(t){return-1!==["left","right"].indexOf(t)}(e)?Wf[e]:e}({direction:i?"rtl":"ltr"},s),T=s,O=(0,f.A)({},n,{anchor:T,elevation:u,open:b,variant:w},E),k=(t=>{const{classes:e,anchor:n,variant:r}=t,i={root:["root"],docked:[("permanent"===r||"persistent"===r)&&"docked"],modal:["modal"],paper:["paper","paperAnchor".concat((0,Dn.A)(n)),"temporary"!==r&&"paperAnchorDocked".concat((0,Dn.A)(n))]};return(0,Bn.A)(i,Ff,e)})(O),R=(0,v.jsx)(Gf,(0,f.A)({elevation:"temporary"===w?u:0,square:!0},y,{className:(0,wn.A)(k.paper,y.className),ownerState:O,children:l}));if("permanent"===w)return(0,v.jsx)(Vf,(0,f.A)({className:(0,wn.A)(k.root,k.docked,c),ownerState:O,ref:e},E,{children:R}));const I=(0,v.jsx)(A,(0,f.A)({in:b,direction:Wf[M],timeout:_,appear:P.current},x,{children:R}));return"persistent"===w?(0,v.jsx)(Vf,(0,f.A)({className:(0,wn.A)(k.root,k.docked,c),ownerState:O,ref:e},E,{children:I})):(0,v.jsx)(Uf,(0,f.A)({BackdropProps:(0,f.A)({},a,g,{transitionDuration:_}),className:(0,wn.A)(k.root,k.modal,c),open:b,ownerState:O,onClose:m,hideBackdrop:d,ref:e},E,S,{children:I}))})),Jf=Hf,Kf=20,Xf=Math.max(document.documentElement.clientWidth||0,window.innerWidth||0)-10,qf=5;function Yf(t){let{children:e,direction:n,width:r}=t;const[i,o]=(0,h.useState)(r||Math.max(document.documentElement.clientWidth||0,window.innerWidth||0)/2),s=t=>{document.addEventListener("mouseup",a,!0),document.addEventListener("mousemove",l,!0),t.preventDefault()},a=t=>{document.removeEventListener("mouseup",a,!0),document.removeEventListener("mousemove",l,!0),t.preventDefault()},l=(0,h.useCallback)((t=>{let e=null;"right"===n?e=document.body.offsetLeft+document.body.offsetWidth-t.clientX+20:"left"===n||void 0===n?e=document.body.offsetLeft+t.clientX+20:"bottom"===n&&(e=document.documentElement.scrollHeight-t.clientY),e>qf&&edocument.documentElement.scrollHeight-Kf&&o(document.documentElement.scrollHeight-Kf-10)}),[]);return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(In,{onMouseDown:t=>s(t),sx:{padding:Kf+"px 0 0",position:"fixed",width:()=>"right"===n||"left"===n||void 0===n?"".concat(Kf,"px"):"bottom"===n?"100vw":void 0,height:"bottom"===n?"".concat(Kf,"px"):"100vh",left:"left"===n?i+"px":void 0,right:"right"===n?i+"px":void 0,bottom:"bottom"===n?i+"px":void 0,zIndex:"bottom"===n?9999:100,cursor:"move",backgroundColor:"rgba(0,0,0,0.8)"}}),("right"===n||"left"===n||void 0===n)&&(0,v.jsx)(In,{onMouseDown:t=>s(t),onTouchStart:t=>s(t),onClick:t=>o(i<30?Xf/2:15),sx:{position:"fixed",top:"45%",width:Kf+5,height:"10vh",left:"left"===n?i+"px":void 0,right:"right"===n?i+"px":void 0,zIndex:1e3,borderRadius:"30px",cursor:"move"},children:(0,v.jsx)(In,{sx:{transform:"rotate(90deg)",position:"absolute",top:"40%",left:"40%"},children:"..."})}),(0,v.jsx)(Jf,{anchor:n,open:!0,variant:"persistent",ModalProps:{keepMounted:!0},PaperProps:"bottom"===n?{style:{height:i,zIndex:9999}}:{style:{width:i,zIndex:100}},children:(0,v.jsx)(Qi,{children:e})})]})}var Qf=n(5540),Zf=n(2954);function $f(){const t=ut(),[e,n]=(0,h.useState)({EDIT_BUTTON:!1});return(0,h.useEffect)((()=>{t(us(e))}),[e]),(0,v.jsx)(Ji,{fullWidth:!0,id:"EDIT_BUTTON",variant:"outlined",endIcon:e.EDIT_BUTTON?(0,v.jsx)(Zf.A,{}):(0,v.jsx)(Qf.A,{}),onClick:t=>{return r=t,void n({...e,[r.currentTarget.id]:!e[r.currentTarget.id]});var r},children:(0,v.jsx)(Wn,{children:e.EDIT_BUTTON?"submit edits":"start editing"})})}const tp=function(){const t=et((t=>t.cityIOdataState.cityIOtableName));return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(Wn,{gutterBottom:!0,children:"CityScope"}),(0,v.jsx)(Wn,{variant:"h3",children:t})]})},ep=(0,ta.A)((0,v.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}),"RadioButtonUnchecked"),np=(0,ta.A)((0,v.jsx)("path",{d:"M8.465 8.465C9.37 7.56 10.62 7 12 7C14.76 7 17 9.24 17 12C17 13.38 16.44 14.63 15.535 15.535C14.63 16.44 13.38 17 12 17C9.24 17 7 14.76 7 12C7 10.62 7.56 9.37 8.465 8.465Z"}),"RadioButtonChecked"),rp=(0,Ln.Ay)("span",{shouldForwardProp:Li.A})({position:"relative",display:"flex"}),ip=(0,Ln.Ay)(ep)({transform:"scale(1)"}),op=(0,Ln.Ay)(np)((t=>{let{theme:e,ownerState:n}=t;return(0,f.A)({left:0,position:"absolute",transform:"scale(0)",transition:e.transitions.create("transform",{easing:e.transitions.easing.easeIn,duration:e.transitions.duration.shortest})},n.checked&&{transform:"scale(1)",transition:e.transitions.create("transform",{easing:e.transitions.easing.easeOut,duration:e.transitions.duration.shortest})})}));const sp=function(t){const{checked:e=!1,classes:n={},fontSize:r}=t,i=(0,f.A)({},t,{checked:e});return(0,v.jsxs)(rp,{className:n.root,ownerState:i,children:[(0,v.jsx)(ip,{fontSize:r,className:n.background,ownerState:i}),(0,v.jsx)(op,{fontSize:r,className:n.dot,ownerState:i})]})};var ap=n(6593);const lp=h.createContext(void 0);function cp(t){return(0,Fn.Ay)("MuiRadio",t)}const up=(0,Tn.A)("MuiRadio",["root","checked","disabled","colorPrimary","colorSecondary","sizeSmall"]),dp=["checked","checkedIcon","color","icon","name","onChange","size","className"],hp=(0,Ln.Ay)($s,{shouldForwardProp:t=>(0,Li.A)(t)||"classes"===t,name:"MuiRadio",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,"medium"!==n.size&&e["size".concat((0,Dn.A)(n.size))],e["color".concat((0,Dn.A)(n.color))]]}})((t=>{let{theme:e,ownerState:n}=t;return(0,f.A)({color:(e.vars||e).palette.text.secondary},!n.disableRipple&&{"&:hover":{backgroundColor:e.vars?"rgba(".concat("default"===n.color?e.vars.palette.action.activeChannel:e.vars.palette[n.color].mainChannel," / ").concat(e.vars.palette.action.hoverOpacity,")"):(0,Kn.X4)("default"===n.color?e.palette.action.active:e.palette[n.color].main,e.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}}},"default"!==n.color&&{["&.".concat(up.checked)]:{color:(e.vars||e).palette[n.color].main}},{["&.".concat(up.disabled)]:{color:(e.vars||e).palette.action.disabled}})}));const fp=(0,v.jsx)(sp,{checked:!0}),pp=(0,v.jsx)(sp,{}),gp=h.forwardRef((function(t,e){var n,r;const i=(0,p.A)({props:t,name:"MuiRadio"}),{checked:o,checkedIcon:s=fp,color:a="primary",icon:l=pp,name:c,onChange:u,size:d="medium",className:g}=i,m=(0,C.A)(i,dp),b=(0,f.A)({},i,{color:a,size:d}),y=(t=>{const{classes:e,color:n,size:r}=t,i={root:["root","color".concat((0,Dn.A)(n)),"medium"!==r&&"size".concat((0,Dn.A)(r))]};return(0,f.A)({},e,(0,Bn.A)(i,cp,e))})(b),x=h.useContext(lp);let A=o;const _=(0,ap.A)(u,x&&x.onChange);let w=c;return x&&("undefined"===typeof A&&(A=function(t,e){return"object"===typeof e&&null!==e?t===e:String(t)===String(e)}(x.value,i.value)),"undefined"===typeof w&&(w=x.name)),(0,v.jsx)(hp,(0,f.A)({type:"radio",icon:h.cloneElement(l,{fontSize:null!=(n=pp.props.fontSize)?n:d}),checkedIcon:h.cloneElement(s,{fontSize:null!=(r=fp.props.fontSize)?r:d}),ownerState:b,classes:y,name:w,checked:A,onChange:_,ref:e,className:(0,wn.A)(y.root,g)},m))})),mp=gp;function vp(t){return(0,Fn.Ay)("MuiFormGroup",t)}(0,Tn.A)("MuiFormGroup",["root","row","error"]);const bp=["className","row"],yp=(0,Ln.Ay)("div",{name:"MuiFormGroup",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,n.row&&e.row]}})((t=>{let{ownerState:e}=t;return(0,f.A)({display:"flex",flexDirection:"column",flexWrap:"wrap"},e.row&&{flexDirection:"row"})})),xp=h.forwardRef((function(t,e){const n=(0,p.A)({props:t,name:"MuiFormGroup"}),{className:r,row:i=!1}=n,o=(0,C.A)(n,bp),s=Vs({props:n,muiFormControl:ms(),states:["error"]}),a=(0,f.A)({},n,{row:i,error:s.error}),l=(t=>{const{classes:e,row:n,error:r}=t,i={root:["root",n&&"row",r&&"error"]};return(0,Bn.A)(i,vp,e)})(a);return(0,v.jsx)(yp,(0,f.A)({className:(0,wn.A)(l.root,r),ownerState:a,ref:e},o))})),Ap=xp;function _p(t){return(0,Fn.Ay)("MuiRadioGroup",t)}(0,Tn.A)("MuiRadioGroup",["root","row","error"]);const wp=["actions","children","className","defaultValue","name","onChange","value"],Sp=h.forwardRef((function(t,e){const{actions:n,children:r,className:i,defaultValue:o,name:s,onChange:a,value:l}=t,c=(0,C.A)(t,wp),u=h.useRef(null),d=(t=>{const{classes:e,row:n,error:r}=t,i={root:["root",n&&"row",r&&"error"]};return(0,Bn.A)(i,_p,e)})(t),[p,g]=(0,Xs.A)({controlled:l,default:o,name:"RadioGroup"});h.useImperativeHandle(n,(()=>({focus:()=>{let t=u.current.querySelector("input:not(:disabled):checked");t||(t=u.current.querySelector("input:not(:disabled)")),t&&t.focus()}})),[]);const m=(0,Lr.A)(e,u),b=(0,Cc.A)(s),y=h.useMemo((()=>({name:b,onChange(t){g(t.target.value),a&&a(t,t.target.value)},value:p})),[b,a,g,p]);return(0,v.jsx)(lp.Provider,{value:y,children:(0,v.jsx)(Ap,(0,f.A)({role:"radiogroup",ref:m,className:(0,wn.A)(d.root,i)},c,{children:r}))})})),Cp=Sp;var Ep=n(4318);function Pp(t){return(0,Fn.Ay)("MuiCollapse",t)}(0,Tn.A)("MuiCollapse",["root","horizontal","vertical","entered","hidden","wrapper","wrapperInner"]);const Mp=["addEndListener","children","className","collapsedSize","component","easing","in","onEnter","onEntered","onEntering","onExit","onExited","onExiting","orientation","style","timeout","TransitionComponent"],Tp=(0,Ln.Ay)("div",{name:"MuiCollapse",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,e[n.orientation],"entered"===n.state&&e.entered,"exited"===n.state&&!n.in&&"0px"===n.collapsedSize&&e.hidden]}})((t=>{let{theme:e,ownerState:n}=t;return(0,f.A)({height:0,overflow:"hidden",transition:e.transitions.create("height")},"horizontal"===n.orientation&&{height:"auto",width:0,transition:e.transitions.create("width")},"entered"===n.state&&(0,f.A)({height:"auto",overflow:"visible"},"horizontal"===n.orientation&&{width:"auto"}),"exited"===n.state&&!n.in&&"0px"===n.collapsedSize&&{visibility:"hidden"})})),Op=(0,Ln.Ay)("div",{name:"MuiCollapse",slot:"Wrapper",overridesResolver:(t,e)=>e.wrapper})((t=>{let{ownerState:e}=t;return(0,f.A)({display:"flex",width:"100%"},"horizontal"===e.orientation&&{width:"auto",height:"100%"})})),kp=(0,Ln.Ay)("div",{name:"MuiCollapse",slot:"WrapperInner",overridesResolver:(t,e)=>e.wrapperInner})((t=>{let{ownerState:e}=t;return(0,f.A)({width:"100%"},"horizontal"===e.orientation&&{width:"auto",height:"100%"})})),Rp=h.forwardRef((function(t,e){const n=(0,p.A)({props:t,name:"MuiCollapse"}),{addEndListener:r,children:i,className:o,collapsedSize:s="0px",component:a,easing:l,in:c,onEnter:u,onEntered:d,onEntering:g,onExit:m,onExited:b,onExiting:y,orientation:x="vertical",style:A,timeout:_=Ep.p0.standard,TransitionComponent:w=Oa}=n,S=(0,C.A)(n,Mp),E=(0,f.A)({},n,{orientation:x,collapsedSize:s}),P=(t=>{const{orientation:e,classes:n}=t,r={root:["root","".concat(e)],entered:["entered"],hidden:["hidden"],wrapper:["wrapper","".concat(e)],wrapperInner:["wrapperInner","".concat(e)]};return(0,Bn.A)(r,Pp,n)})(E),M=Ar(),T=(0,Kr.A)(),O=h.useRef(null),k=h.useRef(),R="number"===typeof s?"".concat(s,"px"):s,I="horizontal"===x,B=I?"width":"height",L=h.useRef(null),D=(0,Lr.A)(e,L),F=t=>e=>{if(t){const n=L.current;void 0===e?t(n):t(n,e)}},N=()=>O.current?O.current[I?"clientWidth":"clientHeight"]:0,j=F(((t,e)=>{O.current&&I&&(O.current.style.position="absolute"),t.style[B]=R,u&&u(t,e)})),z=F(((t,e)=>{const n=N();O.current&&I&&(O.current.style.position="");const{duration:r,easing:i}=Ra({style:A,timeout:_,easing:l},{mode:"enter"});if("auto"===_){const e=M.transitions.getAutoHeightDuration(n);t.style.transitionDuration="".concat(e,"ms"),k.current=e}else t.style.transitionDuration="string"===typeof r?r:"".concat(r,"ms");t.style[B]="".concat(n,"px"),t.style.transitionTimingFunction=i,g&&g(t,e)})),U=F(((t,e)=>{t.style[B]="auto",d&&d(t,e)})),V=F((t=>{t.style[B]="".concat(N(),"px"),m&&m(t)})),G=F(b),W=F((t=>{const e=N(),{duration:n,easing:r}=Ra({style:A,timeout:_,easing:l},{mode:"exit"});if("auto"===_){const n=M.transitions.getAutoHeightDuration(e);t.style.transitionDuration="".concat(n,"ms"),k.current=n}else t.style.transitionDuration="string"===typeof n?n:"".concat(n,"ms");t.style[B]=R,t.style.transitionTimingFunction=r,y&&y(t)}));return(0,v.jsx)(w,(0,f.A)({in:c,onEnter:j,onEntered:U,onEntering:z,onExit:V,onExited:G,onExiting:W,addEndListener:t=>{"auto"===_&&T.start(k.current||0,t),r&&r(L.current,t)},nodeRef:L,timeout:"auto"===_?null:_},S,{children:(t,e)=>(0,v.jsx)(Tp,(0,f.A)({as:a,className:(0,wn.A)(P.root,o,{entered:P.entered,exited:!c&&"0px"===R&&P.hidden}[t]),style:(0,f.A)({[I?"minWidth":"minHeight"]:R},A),ref:D},e,{ownerState:(0,f.A)({},E,{state:t}),children:(0,v.jsx)(Op,{ownerState:(0,f.A)({},E,{state:t}),className:P.wrapper,ref:O,children:(0,v.jsx)(kp,{ownerState:(0,f.A)({},E,{state:t}),className:P.wrapperInner,children:i})})}))}))}));Rp.muiSupportAuto=!0;const Ip=Rp,Bp=(0,ta.A)((0,v.jsx)("path",{d:"m7 10 5 5 5-5z"}),"ArrowDropDown");var Lp=n(7058);function Dp(t){let{children:e,variant:n,title:r,subheader:i,collapse:o,toolTipInfo:s}=t;const[a,l]=(0,h.useState)(o);return(0,v.jsxs)("div",{children:[(0,v.jsx)(ho,{sx:{mt:1}}),(0,v.jsx)(Ir,{container:!0,justifyContent:"center",children:(0,v.jsxs)(Ji,{fullWidth:!0,onClick:()=>l(!a),sx:{justifyContent:"flex-start"},children:[(0,v.jsxs)(Ir,{item:!0,container:!0,xs:10,direction:"row",children:[(0,v.jsx)(Bp,{}),(0,v.jsxs)("div",{style:{display:"block",textAlign:"left"},children:[(0,v.jsx)(Wn,{variant:"h6",style:{color:"white",fontWeight:"bold",fontSize:"10px"},children:r||""}),(0,v.jsx)(Wn,{style:{color:"gray",fontSize:"10px"},children:i||""})]})]}),(0,v.jsx)(Ir,{item:!0,container:!0,xs:2,alignItems:"end",direction:"column",children:s&&(0,v.jsx)(Fc,{placement:"top",title:(0,v.jsx)(Wn,{children:s}),children:(0,v.jsx)(Lp.A,{})})})]})}),(0,v.jsx)(Qi,{children:(0,v.jsx)(Ip,{in:a,children:(0,v.jsx)(eo,{variant:n||"outlined",sx:{width:"100%"},children:(0,v.jsx)(oo,{children:e})})})})]})}function Fp(){const t=et((t=>t.menuState)).layersMenuState,e=ut(),n=et((t=>t.cityIOdataState.cityIOdata)).access,[r,i]=(0,h.useState)(),o=(n,r)=>{i(n);const o={...t,ACCESS_LAYER_CHECKBOX:{...t.ACCESS_LAYER_CHECKBOX,selected:r}};e(ls(o))};(0,h.useEffect)((()=>{o(n.properties[0],0)}),[]);const s=()=>{const t=n.properties.map(((t,e)=>(0,v.jsx)(Ks,{control:(0,v.jsx)(mp,{}),label:(0,v.jsx)(Wn,{variant:"caption",children:t}),onChange:()=>o(t,e),checked:r===t},e+"_access_checkboxFormControlLabel")));return(0,v.jsx)(nh,{children:(0,v.jsx)(Cp,{value:r,defaultValue:n.properties[0],children:t})})};return(0,v.jsx)(v.Fragment,{children:(0,v.jsx)(Dp,{variant:"outlined",subheader:"Select Heatmap Sub-Layer",collapse:!0,children:(0,v.jsx)(s,{})})})}function Np(){const t=et((t=>t.menuState)).layersMenuState,e=ut(),n=et((t=>t.cityIOdataState.cityIOdata)).ABM2,r=n.attr.mode,i=n.attr.profile,[o,s]=(0,h.useState)(null),a=(n,r,i)=>{s(r);const o={...t,ABM_LAYER_CHECKBOX:{...t.ABM_LAYER_CHECKBOX,selected:{[n]:i}}};e(ls(o))};(0,h.useEffect)((()=>{a("mode",r[1].name,1)}),[]);const l=(t,e)=>{let n=[];for(const r in e)n.push((0,v.jsx)(Ks,{control:(0,v.jsx)(mp,{sx:{color:e[r].color}}),label:(0,v.jsx)(Wn,{variant:"caption",children:e[r].name}),onChange:()=>a(t,e[r].name,parseInt(r)),checked:o===e[r].name},r+"_access_checkboxFormControlLabel"));return(0,v.jsx)(nh,{children:(0,v.jsx)(Cp,{value:o,children:n})})};return(0,v.jsx)(v.Fragment,{children:(0,v.jsxs)(Dp,{variant:"outlined",subheader:"Select ABM Sub-Layer",collapse:!0,children:[l("mode",r),l("profile",i)]})})}function jp(){const t=et((t=>t.menuState)).layersMenuState;return(0,v.jsxs)(v.Fragment,{children:[t.ACCESS_LAYER_CHECKBOX&&t.ACCESS_LAYER_CHECKBOX.isOn&&(0,v.jsx)(Fp,{}),(()=>{if(t.AGGREGATED_TRIPS_LAYER_CHECKBOX&&t.AGGREGATED_TRIPS_LAYER_CHECKBOX.isOn||t.ABM_LAYER_CHECKBOX&&t.ABM_LAYER_CHECKBOX.isOn)return(0,v.jsx)(Np,{})})()]})}const zp=function(){const t=[{component:(0,v.jsx)(tp,{}),collapse:!0},{component:(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)($f,{}),(0,v.jsx)(ps,{})]}),collapse:!1,title:"Edit Mode",subheader:"Select Types & Edit"},{component:(0,v.jsx)(Rf,{}),collapse:!1,title:"Scenarios",subheader:"Save and Load Scenarios"},{component:(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(fa,{}),(0,v.jsx)(jp,{})]}),collapse:!0,title:"Layers",subheader:"Layers visibility"},{component:(0,v.jsx)(Aa,{}),collapse:!1,title:"View Settings",subheader:"Toggle different visibility settings"}],e=()=>{const e=[];return t.forEach(((t,n)=>{e.push((0,v.jsx)(Ir,{item:!0,xs:12,md:12,lg:12,xl:12,children:(0,v.jsx)(Dp,{variant:"outlined",title:t.title,subheader:t.subheader,collapse:t.collapse,children:t.component})},t.title+"_grid"))})),e};return(0,v.jsx)(Yf,{direction:"left",width:300,children:(0,v.jsx)(In,{p:1,children:(0,v.jsx)(Ir,{container:!0,children:(0,v.jsx)(e,{})})})})};function Up(t){var e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return e?[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]:null}const Vp=t=>/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/i.test(t),Gp=(bn.cityIO.baseURL,t=>{var e,n,r,i,o,s,a,l;const c=null===t||void 0===t||null===(e=t.GEOGRID)||void 0===e||null===(n=e.features[(null===t||void 0===t||null===(i=t.GEOGRID)||void 0===i||null===(o=i.features)||void 0===o?void 0:o.length)-1])||void 0===n||null===(r=n.geometry)||void 0===r?void 0:r.coordinates[0][0],u=null===t||void 0===t||null===(s=t.GEOGRID)||void 0===s||null===(a=s.features[0])||void 0===a||null===(l=a.geometry)||void 0===l?void 0:l.coordinates[0][0];return[(u[0]+c[0])/2,(u[1]+c[1])/2]});function Wp(t,e,n){var r=t;if(e>0||n<1)if(tn)r=1;else{r=(t-e)/(n-e)}var i=function(t,e,n){var r,i,o;function s(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}if(0===e)r=i=o=n;else{var a=n<.5?n*(1+e):n+e-n*e,l=2*n-a;r=s(l,a,t+1/3),i=s(l,a,t),o=s(l,a,t-1/3)}return[Math.floor(255*r),Math.floor(255*i),Math.floor(255*o)]}(1.2*r/3.6,1,.5);return[i[0],i[1],i[2]]}var Hp=n(7948);const Jp=t=>{if(!t.mousePos||!t.hoveredCells)return null;const e=t.selectedType,n=t.hoveredCells.object.properties.interactive,r=t.mousePos,i=t.divSize;let o=e.color;Vp(o)&&(o=Up(o));const s="rgb("+o[0]+","+o[1]+","+o[2]+")",a="rgba("+o[0]+","+o[1]+","+o[2]+",0.6)";let l=r.clientX-i/2,c=r.clientY-i/2;return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(In,{sx:{border:n?"3px solid":"1px dashed",borderRadius:"5%",position:"fixed",backgroundColor:t.mouseDown&&n?a:"rgba(0,0,0,0)",padding:"1vw",color:s,borderColor:s,zIndex:10,pointerEvents:"none",width:i,height:i,left:l,top:c}}),(0,v.jsxs)(In,{sx:{borderRadius:"5%",position:"fixed",left:l+i+10,top:c-10,display:"flex",flexDirection:"column",m:1,p:1,pointerEvents:"none",zIndex:10,color:s,backgroundColor:"rgba(0,0,0,0.8)"},children:[(0,v.jsx)(Wn,{variant:"caption",children:n&&(0,v.jsx)("strong",{children:e.thisTypeName})}),!n&&(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(Hp.A,{sx:{color:s}}),(0,v.jsx)(Wn,{variant:"caption",children:(0,v.jsx)("strong",{children:e.thisTypeName})}),(0,v.jsxs)(Wn,{variant:"caption",children:["Cell ",t.hoveredCells.object.properties.id," is not interactive"]})]})]})]})},Kp=t=>{if(!t.mousePos)return null;const e=t.mousePos,n=t.hoveredObj;let r=n.object.properties.color;Vp(r)&&(r=Up(r));const i="rgb("+r[0]+","+r[1]+","+r[2]+")";return(0,v.jsxs)(In,{sx:{borderRadius:"5%",position:"fixed",padding:"0.25vw",zIndex:10,left:e.clientX+10,top:e.clientY+10,display:"flex",flexDirection:"column",pointerEvents:"none",backgroundColor:"rgba(0,0,0,0.8)",color:i,border:n.object.properties.interactive?"3px solid":"1px dashed",minWidth:"100px",minHeight:"50px"},children:[(0,v.jsx)(Wn,{children:n.object.properties.name}),(0,v.jsxs)(Wn,{variant:"caption",children:["height: ",n.object.properties.height]}),(0,v.jsxs)(Wn,{variant:"caption",children:["ID: ",n.object.properties.id]}),!n.object.properties.interactive&&(0,v.jsxs)("div",{style:{display:"flex",alignItems:"left"},children:[(0,v.jsx)(Hp.A,{sx:{color:i,fontSize:"1rem"}}),(0,v.jsx)(Wn,{variant:"caption",children:"Non-interactive"})]})]})};function Xp(t){let{editOn:e,mousePos:n,selectedType:r,pickingRadius:i,mouseDown:o,hoveredObj:s}=t;const a=()=>e&&r&&Object.keys(r).length&&s?(0,v.jsx)(Jp,{mousePos:n,selectedType:r,divSize:i,mouseDown:o,hoveredCells:s}):s?(0,v.jsx)(Kp,{mousePos:n,hoveredObj:s}):null;return(0,v.jsx)(a,{})}const qp=t=>{if(!t.mousePos)return null;const e=t.mousePos,n=t.layerHoveredData;return(0,v.jsx)(In,{sx:{borderRadius:"5%",position:"fixed",backgroundColor:"primary.opacityDarkBackground",padding:"1vw",color:"primary.main",zIndex:10,left:e.clientX-100,top:e.clientY,display:"flex",flexDirection:"column",pointerEvents:"none"},children:(0,v.jsx)(Wn,{variant:"caption",children:n&&n})})};let Yp=1,Qp=1;class Zp{constructor(){this.time=0,this.channels=new Map,this.animations=new Map,this.playing=!1,this.lastEngineTime=-1}addChannel(t){const{delay:e=0,duration:n=Number.POSITIVE_INFINITY,rate:r=1,repeat:i=1}=t,o=Yp++,s={time:0,delay:e,duration:n,rate:r,repeat:i};return this._setChannelTime(s,this.time),this.channels.set(o,s),o}removeChannel(t){this.channels.delete(t);for(const[e,n]of this.animations)n.channel===t&&this.detachAnimation(e)}isFinished(t){const e=this.channels.get(t);return void 0!==e&&this.time>=e.delay+e.duration*e.repeat}getTime(t){if(void 0===t)return this.time;const e=this.channels.get(t);return void 0===e?-1:e.time}setTime(t){this.time=Math.max(0,t);const e=this.channels.values();for(const r of e)this._setChannelTime(r,this.time);const n=this.animations.values();for(const r of n){const{animation:t,channel:e}=r;t.setTime(this.getTime(e))}}play(){this.playing=!0}pause(){this.playing=!1,this.lastEngineTime=-1}reset(){this.setTime(0)}attachAnimation(t,e){const n=Qp++;return this.animations.set(n,{animation:t,channel:e}),t.setTime(this.getTime(e)),n}detachAnimation(t){this.animations.delete(t)}update(t){this.playing&&(-1===this.lastEngineTime&&(this.lastEngineTime=t),this.setTime(this.time+(t-this.lastEngineTime)),this.lastEngineTime=t)}_setChannelTime(t,e){const n=e-t.delay;n>=t.duration*t.repeat?t.time=t.duration*t.rate:(t.time=Math.max(0,n)%t.duration,t.time*=t.rate)}}const $p="Awaiting state",tg="Matched. State transferred from previous layer",eg="Initialized",ng="Discarded. Awaiting garbage collection",rg="No longer matched. Awaiting garbage collection",ig="Finalized! Awaiting garbage collection",og=Symbol.for("component"),sg=Symbol.for("propTypes"),ag=Symbol.for("deprecatedProps"),lg=Symbol.for("asyncPropDefaults"),cg=Symbol.for("asyncPropOriginal"),ug=Symbol.for("asyncPropResolved");function dg(t){if("undefined"!==typeof window&&"object"===typeof window.process&&"renderer"===window.process.type)return!0;if("undefined"!==typeof process&&"object"===typeof process.versions&&Boolean(process.versions.electron))return!0;const e="object"===typeof navigator&&"string"===typeof navigator.userAgent&&navigator.userAgent,n=t||e;return!!(n&&n.indexOf("Electron")>=0)}function hg(){return!("object"===typeof process&&"[object process]"===String(process)&&!process.browser)||dg()}const fg="undefined"!==typeof __VERSION__?__VERSION__:"untranspiled source";hg();class pg{constructor(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"sessionStorage";ge(this,"storage",void 0),ge(this,"id",void 0),ge(this,"config",void 0),this.storage=function(t){try{const e=window[t],n="__storage_test__";return e.setItem(n,n),e.removeItem(n),e}catch(e){return null}}(n),this.id=t,this.config=e,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){const t=JSON.stringify(this.config);this.storage.setItem(this.id,t)}}_loadConfiguration(){let t={};if(this.storage){const e=this.storage.getItem(this.id);t=e?JSON.parse(e):{}}return Object.assign(this.config,t),this}}function gg(t,e,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:600;const i=t.src.replace(/\(/g,"%28").replace(/\)/g,"%29");t.width>r&&(n=Math.min(n,r/t.width));const o=t.width*n,s=t.height*n,a=["font-size:1px;","padding:".concat(Math.floor(s/2),"px ").concat(Math.floor(o/2),"px;"),"line-height:".concat(s,"px;"),"background:url(".concat(i,");"),"background-size:".concat(o,"px ").concat(s,"px;"),"color:transparent;"].join("");return["".concat(e," %c+"),a]}let mg;function vg(t){return"string"===typeof t?mg[t.toUpperCase()]||mg.WHITE:t}function bg(t,e){if(!t)throw new Error(e||"Assertion failed")}!function(t){t[t.BLACK=30]="BLACK",t[t.RED=31]="RED",t[t.GREEN=32]="GREEN",t[t.YELLOW=33]="YELLOW",t[t.BLUE=34]="BLUE",t[t.MAGENTA=35]="MAGENTA",t[t.CYAN=36]="CYAN",t[t.WHITE=37]="WHITE",t[t.BRIGHT_BLACK=90]="BRIGHT_BLACK",t[t.BRIGHT_RED=91]="BRIGHT_RED",t[t.BRIGHT_GREEN=92]="BRIGHT_GREEN",t[t.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",t[t.BRIGHT_BLUE=94]="BRIGHT_BLUE",t[t.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",t[t.BRIGHT_CYAN=96]="BRIGHT_CYAN",t[t.BRIGHT_WHITE=97]="BRIGHT_WHITE"}(mg||(mg={}));const yg={self:"undefined"!==typeof self&&self,window:"undefined"!==typeof window&&window,global:"undefined"!==typeof n.g&&n.g,document:"undefined"!==typeof document&&document,process:"object"===typeof process&&process},xg=yg.window||yg.self||yg.global,Ag=yg.process||{};function _g(){let t;var e,n;if(hg&&"performance"in xg)t=null===xg||void 0===xg||null===(e=xg.performance)||void 0===e||null===(n=e.now)||void 0===n?void 0:n.call(e);else if("hrtime"in Ag){var r;const e=null===Ag||void 0===Ag||null===(r=Ag.hrtime)||void 0===r?void 0:r.call(Ag);t=1e3*e[0]+e[1]/1e6}else t=Date.now();return t}const wg={debug:hg&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Sg={enabled:!0,level:0};function Cg(){}const Eg={},Pg={once:!0};class Mg{constructor(){let{id:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{id:""};ge(this,"id",void 0),ge(this,"VERSION",fg),ge(this,"_startTs",_g()),ge(this,"_deltaTs",_g()),ge(this,"_storage",void 0),ge(this,"userData",{}),ge(this,"LOG_THROTTLE_TIMEOUT",0),this.id=t,this.userData={},this._storage=new pg("__probe-".concat(this.id,"__"),Sg),this.timeStamp("".concat(this.id," started")),function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["constructor"];const n=Object.getPrototypeOf(t),r=Object.getOwnPropertyNames(n);for(const i of r)"function"===typeof t[i]&&(e.find((t=>i===t))||(t[i]=t[i].bind(t)))}(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((_g()-this._startTs).toPrecision(10))}getDelta(){return Number((_g()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._storage.setConfiguration({enabled:t}),this}setLevel(t){return this._storage.setConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,e){this._storage.setConfiguration({[t]:e})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,e){bg(t,e)}warn(t){return this._getLogFunction(0,t,wg.warn,arguments,Pg)}error(t){return this._getLogFunction(0,t,wg.error,arguments)}deprecated(t,e){return this.warn("`".concat(t,"` is deprecated and will be removed in a later version. Use `").concat(e,"` instead"))}removed(t,e){return this.error("`".concat(t,"` has been removed. Use `").concat(e,"` instead"))}probe(t,e){return this._getLogFunction(t,e,wg.log,arguments,{time:!0,once:!0})}log(t,e){return this._getLogFunction(t,e,wg.debug,arguments)}info(t,e){return this._getLogFunction(t,e,console.info,arguments)}once(t,e){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i{const e=gg(t,n,r);console.log(...e)},t.src=e,Cg}const i=e.nodeName||"";if("img"===i.toLowerCase())return console.log(...gg(e,n,r)),Cg;if("canvas"===i.toLowerCase()){const t=new Image;return t.onload=()=>console.log(...gg(t,n,r)),t.src=e.toDataURL(),Cg}return Cg}({image:r,message:i,scale:o}):function(t){let{image:e,message:n="",scale:r=1}=t;return console.warn("removed"),Cg}({image:r,message:i,scale:o}):Cg}time(t,e){return this._getLogFunction(t,e,console.time?console.time:console.info)}timeEnd(t,e){return this._getLogFunction(t,e,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,e){return this._getLogFunction(t,e,console.timeStamp||Cg)}group(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{collapsed:!1};const r=Og({logLevel:t,message:e,opts:n}),{collapsed:i}=n;return r.method=(i?console.groupCollapsed:console.group)||console.info,this._getLogFunction(r)}groupCollapsed(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.group(t,e,Object.assign({},n,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||Cg)}withGroup(t,e,n){this.group(t,e)();try{n()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=Tg(t)}_getLogFunction(t,e,n,r,i){if(this._shouldLog(t)){i=Og({logLevel:t,message:e,args:r,opts:i}),bg(n=n||i.method),i.total=this.getTotal(),i.delta=this.getDelta(),this._deltaTs=_g();const o=i.tag||i.message;if(i.once){if(Eg[o])return Cg;Eg[o]=_g()}return e=function(t,e,n){if("string"===typeof e){const r=n.time?function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;const n=Math.max(e-t.length,0);return"".concat(" ".repeat(n)).concat(t)}(function(t){let e;return e=t<10?"".concat(t.toFixed(2),"ms"):t<100?"".concat(t.toFixed(1),"ms"):t<1e3?"".concat(t.toFixed(0),"ms"):"".concat((t/1e3).toFixed(2),"s"),e}(n.total)):"";e=function(t,e,n){return hg||"string"!==typeof t||(e&&(e=vg(e),t="\x1b[".concat(e,"m").concat(t,"\x1b[39m")),n&&(e=vg(n),t="\x1b[".concat(n+10,"m").concat(t,"\x1b[49m"))),t}(e=n.time?"".concat(t,": ").concat(r," ").concat(e):"".concat(t,": ").concat(e),n.color,n.background)}return e}(this.id,i.message,i),n.bind(console,e,...i.args)}return Cg}}function Tg(t){if(!t)return 0;let e;switch(typeof t){case"number":e=t;break;case"object":e=t.logLevel||t.priority||0;break;default:return 0}return bg(Number.isFinite(e)&&e>=0),e}function Og(t){const{logLevel:e,message:n}=t;t.logLevel=Tg(e);const r=t.args?Array.from(t.args):[];for(;r.length&&r.shift()!==n;);switch(typeof e){case"string":case"function":void 0!==n&&r.unshift(n),t.message=e;break;case"object":Object.assign(t,e)}"function"===typeof t.message&&(t.message=t.message());const i=typeof t.message;return bg("string"===i||"object"===i),Object.assign(t,{args:r},t.opts)}function kg(t){for(const e in t)for(const n in t[e])return n||"untitled";return"empty"}ge(Mg,"VERSION",fg);const Rg=new Mg({id:"deck"});let Ig={};function Bg(t){Ig=t}function Lg(t,e,n,r){Rg.level>0&&Ig[t]&&Ig[t].call(null,e,n,r)}function Dg(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>!0;return Array.isArray(t)?Fg(t,e,[]):e(t)?[t]:[]}function Fg(t,e,n){let r=-1;for(;++r0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}}class Ug{constructor(t){ge(this,"id",void 0),ge(this,"stats",{}),this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"count";return this._getOrCreate({name:t,type:e})}get size(){return Object.keys(this.stats).length}reset(){for(const t in this.stats)this.stats[t].reset();return this}forEach(t){for(const e in this.stats)t(this.stats[e])}getTable(){const t={};return this.forEach((e=>{t[e.name]={time:e.time||0,count:e.count||0,average:e.getAverageTime()||0,hz:e.getHz()||0}})),t}_initializeStats(){(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).forEach((t=>this._getOrCreate(t)))}_getOrCreate(t){if(!t||!t.name)return null;const{name:e,type:n}=t;return this.stats[e]||(this.stats[e]=t instanceof zg?t:new zg(e,n)),this.stats[e]}}const Vg=t=>"boolean"===typeof t,Gg=t=>"function"===typeof t,Wg=t=>null!==t&&"object"===typeof t,Hg=t=>Wg(t)&&t.constructor==={}.constructor,Jg=t=>t&&"function"===typeof t[Symbol.iterator],Kg=t=>t&&"function"===typeof t[Symbol.asyncIterator],Xg=t=>"undefined"!==typeof Response&&t instanceof Response||t&&t.arrayBuffer&&t.text&&t.json,qg=t=>"undefined"!==typeof Blob&&t instanceof Blob,Yg=t=>t&&"object"===typeof t&&t.isBuffer,Qg=t=>(t=>"undefined"!==typeof ReadableStream&&t instanceof ReadableStream||Wg(t)&&Gg(t.tee)&&Gg(t.cancel)&&Gg(t.getReader))(t)||(t=>Wg(t)&&Gg(t.read)&&Gg(t.pipe)&&Vg(t.readable))(t);function Zg(t,e){if(!t)throw new Error(e||"loader assertion failed.")}function $g(t){var e;if(!t)return!1;Array.isArray(t)&&(t=t[0]);return Array.isArray(null===(e=t)||void 0===e?void 0:e.extensions)}function tm(t){var e,n;let r;return Zg(t,"null loader"),Zg($g(t),"invalid loader"),Array.isArray(t)&&(r=t[1],t=t[0],t={...t,options:{...t.options,...r}}),(null!==(e=t)&&void 0!==e&&e.parseTextSync||null!==(n=t)&&void 0!==n&&n.parseText)&&(t.text=!0),t.text||(t.binary=!0),t}let em="";const nm={};const rm=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,im=/^([-\w.]+\/[-\w.+]+)/;function om(t){const e=rm.exec(t);return e?e[1]:""}const sm=/\?.*/;function am(t){return t.replace(sm,"")}function lm(t){if(Xg(t)){return t.url}if(qg(t)){return t.name||""}return"string"===typeof t?t:""}function cm(t){if(Xg(t)){const e=t,n=e.headers.get("content-type")||"",r=am(e.url);return function(t){const e=im.exec(t);return e?e[1]:t}(n)||om(r)}if(qg(t)){return t.type||""}return"string"===typeof t?om(t):""}async function um(t){if(Xg(t))return t;const e={},n=function(t){if(Xg(t))return t.headers["content-length"]||-1;if(qg(t))return t.size;return"string"===typeof t?t.length:t instanceof ArrayBuffer||ArrayBuffer.isView(t)?t.byteLength:-1}(t);n>=0&&(e["content-length"]=String(n));const r=lm(t),i=cm(t);i&&(e["content-type"]=i);const o=await async function(t){const e=5;if("string"===typeof t)return"data:,".concat(t.slice(0,e));if(t instanceof Blob){const e=t.slice(0,5);return await new Promise((t=>{const n=new FileReader;n.onload=e=>{var n;return t(null===e||void 0===e||null===(n=e.target)||void 0===n?void 0:n.result)},n.readAsDataURL(e)}))}if(t instanceof ArrayBuffer){const n=function(t){let e="";const n=new Uint8Array(t);for(let r=0;r{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}}"undefined"!==typeof self&&self,"undefined"!==typeof window&&window,"undefined"!==typeof n.g&&n.g,"undefined"!==typeof document&&document;const pm=Boolean("object"!==typeof process||"[object process]"!==String(process)||process.browser),gm="undefined"!==typeof process&&process.version&&/v([0-9]*)/.exec(process.version),mm=(gm&&parseFloat(gm[1]),{fetch:null,mimeType:void 0,nothrow:!1,log:new class{constructor(){ge(this,"console",void 0),this.console=console}log(){for(var t=arguments.length,e=new Array(t),n=0;n{const t=bm();return t.globalOptions=t.globalOptions||{...mm},t.globalOptions};function xm(t,e,n,r){return n=n||[],function(t,e){Am(t,null,mm,vm,e);for(const n of e){const r=t&&t[n.id]||{},i=n.options&&n.options[n.id]||{},o=n.deprecatedOptions&&n.deprecatedOptions[n.id]||{};Am(r,n.id,i,o,e)}}(t,n=Array.isArray(n)?n:[n]),wm(e,t,r)}function Am(t,e,n,r,i){const o=e||"Top level",s=e?"".concat(e,"."):"";for(const a in t){const l=!e&&Wg(t[a]);if(!(a in n)&&!("baseUri"===a&&!e)&&!("workerUrl"===a&&e))if(a in r)hm.warn("".concat(o," loader option '").concat(s).concat(a,"' no longer supported, use '").concat(r[a],"'"))();else if(!l){const t=_m(a,i);hm.warn("".concat(o," loader option '").concat(s).concat(a,"' not recognized. ").concat(t))()}}}function _m(t,e){const n=t.toLowerCase();let r="";for(const i of e)for(const e in i.options){if(t===e)return"Did you mean '".concat(i.id,".").concat(e,"'?");const o=e.toLowerCase();(n.startsWith(o)||o.startsWith(n))&&(r=r||"Did you mean '".concat(i.id,".").concat(e,"'?"))}return r}function wm(t,e,n){const r={...t.options||{}};return function(t,e){e&&!("baseUri"in t)&&(t.baseUri=e)}(r,n),null===r.log&&(r.log=new fm),Sm(r,ym()),Sm(r,e),r}function Sm(t,e){for(const n in e)if(n in e){const r=e[n];Hg(r)&&Hg(t[n])?t[n]={...t[n],...e[n]}:t[n]=e[n]}}function Cm(t,e){const n=ym(),r=t||n;return"function"===typeof r.fetch?r.fetch:Wg(r.fetch)?t=>dm(t,r):null!==e&&void 0!==e&&e.fetch?null===e||void 0===e?void 0:e.fetch:dm}function Em(t,e){if(!t)throw new Error(e||"loaders.gl assertion failed.")}const Pm="3.4.15";const Mm={self:"undefined"!==typeof self&&self,window:"undefined"!==typeof window&&window,global:"undefined"!==typeof n.g&&n.g,document:"undefined"!==typeof document&&document},Tm=Mm.global||Mm.self||Mm.window||{},Om="object"!==typeof process||"[object process]"!==String(process)||process.browser,km="function"===typeof importScripts,Rm="undefined"!==typeof window&&"undefined"!==typeof window.orientation,Im="undefined"!==typeof process&&process.version&&/v([0-9]*)/.exec(process.version);Im&&parseFloat(Im[1]);class Bm{terminate(){}}const Lm=new Map;function Dm(t){Em(t.source&&!t.url||!t.source&&t.url);let e=Lm.get(t.source||t.url);return e||(t.url&&(e=function(t){if(!t.startsWith("http"))return t;return Fm((e=t,"try {\n importScripts('".concat(e,"');\n} catch (error) {\n console.error(error);\n throw error;\n}")));var e}(t.url),Lm.set(t.url,e)),t.source&&(e=Fm(t.source),Lm.set(t.source,e))),Em(e),e}function Fm(t){const e=new Blob([t],{type:"application/javascript"});return URL.createObjectURL(e)}function Nm(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2?arguments[2]:void 0;const r=n||new Set;if(t){if(jm(t))r.add(t);else if(jm(t.buffer))r.add(t.buffer);else if(ArrayBuffer.isView(t));else if(e&&"object"===typeof t)for(const i in t)Nm(t[i],e,r)}else;return void 0===n?Array.from(r):[]}function jm(t){return!!t&&(t instanceof ArrayBuffer||("undefined"!==typeof MessagePort&&t instanceof MessagePort||("undefined"!==typeof ImageBitmap&&t instanceof ImageBitmap||"undefined"!==typeof OffscreenCanvas&&t instanceof OffscreenCanvas)))}const zm=()=>{};class Um{static isSupported(){return"undefined"!==typeof Worker&&Om||"undefined"!==typeof Bm&&!Om}constructor(t){ge(this,"name",void 0),ge(this,"source",void 0),ge(this,"url",void 0),ge(this,"terminated",!1),ge(this,"worker",void 0),ge(this,"onMessage",void 0),ge(this,"onError",void 0),ge(this,"_loadableURL","");const{name:e,source:n,url:r}=t;Em(n||r),this.name=e,this.source=n,this.url=r,this.onMessage=zm,this.onError=t=>console.log(t),this.worker=Om?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=zm,this.onError=zm,this.worker.terminate(),this.terminated=!0}get isRunning(){return Boolean(this.onMessage)}postMessage(t,e){e=e||Nm(t),this.worker.postMessage(t,e)}_getErrorFromErrorEvent(t){let e="Failed to load ";return e+="worker ".concat(this.name," from ").concat(this.url,". "),t.message&&(e+="".concat(t.message," in ")),t.lineno&&(e+=":".concat(t.lineno,":").concat(t.colno)),new Error(e)}_createBrowserWorker(){this._loadableURL=Dm({source:this.source,url:this.url});const t=new Worker(this._loadableURL,{name:this.name});return t.onmessage=t=>{t.data?this.onMessage(t.data):this.onError(new Error("No data received"))},t.onerror=t=>{this.onError(this._getErrorFromErrorEvent(t)),this.terminated=!0},t.onmessageerror=t=>console.error(t),t}_createNodeWorker(){let t;if(this.url){const e=this.url.includes(":/")||this.url.startsWith("/")?this.url:"./".concat(this.url);t=new Bm(e,{eval:!1})}else{if(!this.source)throw new Error("no worker");t=new Bm(this.source,{eval:!0})}return t.on("message",(t=>{this.onMessage(t)})),t.on("error",(t=>{this.onError(t)})),t.on("exit",(t=>{})),t}}class Vm{constructor(t,e){ge(this,"name",void 0),ge(this,"workerThread",void 0),ge(this,"isRunning",!0),ge(this,"result",void 0),ge(this,"_resolve",(()=>{})),ge(this,"_reject",(()=>{})),this.name=t,this.workerThread=e,this.result=new Promise(((t,e)=>{this._resolve=t,this._reject=e}))}postMessage(t,e){this.workerThread.postMessage({source:"loaders.gl",type:t,payload:e})}done(t){Em(this.isRunning),this.isRunning=!1,this._resolve(t)}error(t){Em(this.isRunning),this.isRunning=!1,this._reject(t)}}class Gm{static isSupported(){return Um.isSupported()}constructor(t){ge(this,"name","unnamed"),ge(this,"source",void 0),ge(this,"url",void 0),ge(this,"maxConcurrency",1),ge(this,"maxMobileConcurrency",1),ge(this,"onDebug",(()=>{})),ge(this,"reuseWorkers",!0),ge(this,"props",{}),ge(this,"jobQueue",[]),ge(this,"idleQueue",[]),ge(this,"count",0),ge(this,"isDestroyed",!1),this.source=t.source,this.url=t.url,this.setProps(t)}destroy(){this.idleQueue.forEach((t=>t.destroy())),this.isDestroyed=!0}setProps(t){this.props={...this.props,...t},void 0!==t.name&&(this.name=t.name),void 0!==t.maxConcurrency&&(this.maxConcurrency=t.maxConcurrency),void 0!==t.maxMobileConcurrency&&(this.maxMobileConcurrency=t.maxMobileConcurrency),void 0!==t.reuseWorkers&&(this.reuseWorkers=t.reuseWorkers),void 0!==t.onDebug&&(this.onDebug=t.onDebug)}async startJob(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(t,e,n)=>t.done(n),n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:(t,e)=>t.error(e);const r=new Promise((r=>(this.jobQueue.push({name:t,onMessage:e,onError:n,onStart:r}),this)));return this._startQueuedJob(),await r}async _startQueuedJob(){if(!this.jobQueue.length)return;const t=this._getAvailableWorker();if(!t)return;const e=this.jobQueue.shift();if(e){this.onDebug({message:"Starting job",name:e.name,workerThread:t,backlog:this.jobQueue.length});const n=new Vm(e.name,t);t.onMessage=t=>e.onMessage(n,t.type,t.payload),t.onError=t=>e.onError(n,t),e.onStart(n);try{await n.result}finally{this.returnWorkerToQueue(t)}}}returnWorkerToQueue(t){this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(t.destroy(),this.count--):this.idleQueue.push(t),this.isDestroyed||this._startQueuedJob()}_getAvailableWorker(){if(this.idleQueue.length>0)return this.idleQueue.shift()||null;if(this.count{}};class Hm{static isSupported(){return Um.isSupported()}static getWorkerFarm(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Hm._workerFarm=Hm._workerFarm||new Hm({}),Hm._workerFarm.setProps(t),Hm._workerFarm}constructor(t){ge(this,"props",void 0),ge(this,"workerPools",new Map),this.props={...Wm},this.setProps(t),this.workerPools=new Map}destroy(){for(const t of this.workerPools.values())t.destroy();this.workerPools=new Map}setProps(t){this.props={...this.props,...t};for(const e of this.workerPools.values())e.setProps(this._getWorkerPoolProps())}getWorkerPool(t){const{name:e,source:n,url:r}=t;let i=this.workerPools.get(e);return i||(i=new Gm({name:e,source:n,url:r}),i.setProps(this._getWorkerPoolProps()),this.workerPools.set(e,i)),i}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}}ge(Hm,"_workerFarm",void 0);const Jm="latest";async function Km(t,e,n,r,i){const o=t.id,s=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=e[t.id]||{},r="".concat(t.id,"-worker.js");let i=n.workerUrl;if(i||"compression"!==t.id||(i=e.workerUrl),"test"===e._workerType&&(i="modules/".concat(t.module,"/dist/").concat(r)),!i){let e=t.version;"latest"===e&&(e=Jm);const n=e?"@".concat(e):"";i="https://unpkg.com/@loaders.gl/".concat(t.module).concat(n,"/dist/").concat(r)}return Em(i),i}(t,n),a=Hm.getWorkerFarm(n).getWorkerPool({name:o,url:s});n=JSON.parse(JSON.stringify(n)),r=JSON.parse(JSON.stringify(r||{}));const l=await a.startJob("process-on-worker",Xm.bind(null,i));l.postMessage("process",{input:e,options:n,context:r});const c=await l.result;return await c.result}async function Xm(t,e,n,r){switch(n){case"done":e.done(r);break;case"error":e.error(new Error(r.error));break;case"process":const{id:o,input:s,options:a}=r;try{const n=await t(s,a);e.postMessage("done",{id:o,result:n})}catch(i){const t=i instanceof Error?i.message:"unknown error";e.postMessage("error",{id:o,error:t})}break;default:console.warn("parse-with-worker unknown message ".concat(n))}}function qm(t,e,n){const r=void 0!==n?new Uint8Array(t).subarray(e,e+n):new Uint8Array(t).subarray(e);return new Uint8Array(r).buffer}async function Ym(t){const e=[];for await(const n of t)e.push(n);return function(){for(var t=arguments.length,e=new Array(t),n=0;nt instanceof ArrayBuffer?new Uint8Array(t):t)),i=r.reduce(((t,e)=>t+e.byteLength),0),o=new Uint8Array(i);let s=0;for(const a of r)o.set(a,s),s+=a.byteLength;return o.buffer}(...e)}const Qm=262144;const Zm=262144;const $m=1048576;function tv(t){if((e=t)&&"object"===typeof e&&e.isBuffer)return t;var e;if(t instanceof ArrayBuffer)return t;if(ArrayBuffer.isView(t))return 0===t.byteOffset&&t.byteLength===t.buffer.byteLength?t.buffer:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength);if("string"===typeof t){const e=t;return(new TextEncoder).encode(e).buffer}if(t&&"object"===typeof t&&t._toArrayBuffer)return t._toArrayBuffer();throw new Error("toArrayBuffer")}function ev(t,e){return pm?async function*(t,e){const n=t.getReader();let r;try{for(;;){const t=r||n.read();null!==e&&void 0!==e&&e._streamReadAhead&&(r=n.read());const{done:i,value:o}=await t;if(i)return;yield tv(o)}}catch(i){n.releaseLock()}}(t,e):async function*(t,e){for await(const n of t)yield tv(n)}(t)}function nv(t,e){if("string"===typeof t)return function*(t,e){const n=(null===e||void 0===e?void 0:e.chunkSize)||Qm;let r=0;const i=new TextEncoder;for(;r1&&void 0!==arguments[1]?arguments[1]:{};return function*(){const{chunkSize:n=Zm}=e;let r=0;for(;r60?"".concat(e.slice(0,60),"..."):e}catch(n){}return e}(t);throw new Error(e)}}(n),e.binary?await n.arrayBuffer():await n.text()}if(Qg(t)&&(t=nv(t,n)),Jg(t)||Kg(t))return Ym(t);throw new Error(rv)}function ov(t){const e=t?t.lastIndexOf("/"):-1;return e>=0?t.substr(e+1):""}function sv(t,e,n){if(n)return n;const r={fetch:Cm(e,t),...t};if(r.url){const t=am(r.url);r.baseUrl=t,r.queryString=function(t){const e=t.match(sm);return e&&e[0]}(r.url),r.filename=ov(t),r.baseUrl=function(t){const e=t?t.lastIndexOf("/"):-1;return e>=0?t.substr(0,e):""}(t)}return Array.isArray(r.loaders)||(r.loaders=null),r}const av=new Mg({id:"loaders.gl"}),lv=()=>{const t=bm();return t.loaderRegistry=t.loaderRegistry||[],t.loaderRegistry};const cv=/\.([^.]+)$/;function uv(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;if(!dv(t))return null;if(e&&!Array.isArray(e))return tm(e);let i=[];e&&(i=i.concat(e)),null!==n&&void 0!==n&&n.ignoreRegisteredLoaders||i.push(...lv()),function(t){for(const e of t)tm(e)}(i);const o=function(t,e,n,r){const i=lm(t),o=cm(t),s=am(i)||(null===r||void 0===r?void 0:r.url);let a=null,l="";null!==n&&void 0!==n&&n.mimeType&&(a=fv(e,null===n||void 0===n?void 0:n.mimeType),l="match forced by supplied MIME type ".concat(null===n||void 0===n?void 0:n.mimeType));var c;a=a||function(t,e){const n=e&&cv.exec(e),r=n&&n[1];return r?function(t,e){e=e.toLowerCase();for(const n of t)for(const t of n.extensions)if(t.toLowerCase()===e)return n;return null}(t,r):null}(e,s),l=l||(a?"matched url ".concat(s):""),a=a||fv(e,o),l=l||(a?"matched MIME type ".concat(o):""),a=a||function(t,e){if(!e)return null;for(const n of t)if("string"===typeof e){if(pv(e,n))return n}else if(ArrayBuffer.isView(e)){if(gv(e.buffer,e.byteOffset,n))return n}else if(e instanceof ArrayBuffer){if(gv(e,0,n))return n}return null}(e,t),l=l||(a?"matched initial data ".concat(mv(t)):""),a=a||fv(e,null===n||void 0===n?void 0:n.fallbackMimeType),l=l||(a?"matched fallback MIME type ".concat(o):""),l&&av.log(1,"selectLoader selected ".concat(null===(c=a)||void 0===c?void 0:c.name,": ").concat(l,"."));return a}(t,i,n,r);if(!o&&(null===n||void 0===n||!n.nothrow))throw new Error(hv(t));return o}function dv(t){return!(t instanceof Response&&204===t.status)}function hv(t){const e=lm(t),n=cm(t);let r="No valid loader found (";r+=e?"".concat(ov(e),", "):"no url provided, ",r+="MIME type: ".concat(n?'"'.concat(n,'"'):"not provided",", ");const i=t?mv(t):"";return r+=i?' first bytes: "'.concat(i,'"'):"first bytes: not available",r+=")",r}function fv(t,e){for(const n of t){if(n.mimeTypes&&n.mimeTypes.includes(e))return n;if(e==="application/x.".concat(n.id))return n}return null}function pv(t,e){if(e.testText)return e.testText(t);return(Array.isArray(e.tests)?e.tests:[e.tests]).some((e=>t.startsWith(e)))}function gv(t,e,n){return(Array.isArray(n.tests)?n.tests:[n.tests]).some((r=>function(t,e,n,r){if(r instanceof ArrayBuffer)return function(t,e,n){if(n=n||t.byteLength,t.byteLength1&&void 0!==arguments[1]?arguments[1]:5;if("string"===typeof t)return t.slice(0,e);if(ArrayBuffer.isView(t))return vv(t.buffer,t.byteOffset,e);if(t instanceof ArrayBuffer){return vv(t,0,e)}return""}function vv(t,e,n){if(t.byteLength1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;if(!dv(t))return null;let i=uv(t,e,{...n,nothrow:!0},r);if(i)return i;if(qg(t)&&(i=uv(t=await t.slice(0,10).arrayBuffer(),e,n,r)),!i&&(null===n||void 0===n||!n.nothrow))throw new Error(hv(t));return i}(t,o,n);return s?(r=sv({url:i,parse:bv,loaders:o},n=xm(n,s,o,i),r||null),await async function(t,e,n,r){if(function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Pm;Em(t,"no worker provided");const n=t.version}(t),Xg(e)){const t=e,{ok:n,redirected:i,status:o,statusText:s,type:a,url:l}=t,c=Object.fromEntries(t.headers.entries());r.response={headers:c,ok:n,redirected:i,status:o,statusText:s,type:a,url:l}}if(e=await iv(e,t,n),t.parseTextSync&&"string"===typeof e)return n.dataType="text",t.parseTextSync(e,n,r,t);if(function(t,e){return!!Hm.isSupported()&&!!(Om||null!==e&&void 0!==e&&e._nodeWorkers)&&t.worker&&(null===e||void 0===e?void 0:e.worker)}(t,n))return await Km(t,e,n,r,bv);if(t.parseText&&"string"===typeof e)return await t.parseText(e,n,r,t);if(t.parse)return await t.parse(e,n,r,t);throw Em(!t.parseSync),new Error("".concat(t.id," loader - no parser found and worker is disabled"))}(s,t,n,r)):null}async function yv(t,e,n,r){Array.isArray(e)||$g(e)||(void 0,n=e,e=void 0);const i=Cm(n);let o=t;return"string"===typeof t&&(o=await i(t)),qg(t)&&(o=await i(t)),await bv(o,e,n)}class xv{constructor(t,e,n){ge(this,"id",void 0),ge(this,"context",void 0),ge(this,"isLoaded",void 0),ge(this,"persistent",void 0),ge(this,"_loadCount",0),ge(this,"_subscribers",new Set),ge(this,"_data",void 0),ge(this,"_loader",void 0),ge(this,"_error",void 0),ge(this,"_content",void 0),this.id=t,this.context=n,this.setData(e)}subscribe(t){this._subscribers.add(t)}unsubscribe(t){this._subscribers.delete(t)}inUse(){return this._subscribers.size>0}delete(){}getData(){return this.isLoaded?this._error?Promise.reject(this._error):this._content:this._loader.then((()=>this.getData()))}setData(t,e){if(t===this._data&&!e)return;this._data=t;const n=++this._loadCount;let r=t;"string"===typeof t&&(r=yv(t)),r instanceof Promise?(this.isLoaded=!1,this._loader=r.then((t=>{this._loadCount===n&&(this.isLoaded=!0,this._error=void 0,this._content=t)})).catch((t=>{this._loadCount===n&&(this.isLoaded=!0,this._error=t||!0)}))):(this.isLoaded=!0,this._error=void 0,this._content=t);for(const i of this._subscribers)i.onChange(this.getData())}}class Av{constructor(t){let{gl:e,protocol:n}=t;ge(this,"protocol",void 0),ge(this,"_context",void 0),ge(this,"_resources",void 0),ge(this,"_consumers",void 0),ge(this,"_pruneRequest",void 0),this.protocol=n||"resource://",this._context={gl:e,resourceManager:this},this._resources={},this._consumers={},this._pruneRequest=null}contains(t){return!!t.startsWith(this.protocol)||t in this._resources}add(t){let{resourceId:e,data:n,forceUpdate:r=!1,persistent:i=!0}=t,o=this._resources[e];o?o.setData(n,r):(o=new xv(e,n,this._context),this._resources[e]=o),o.persistent=i}remove(t){const e=this._resources[t];e&&(e.delete(),delete this._resources[t])}unsubscribe(t){let{consumerId:e}=t;const n=this._consumers[e];if(n){for(const t in n){const e=n[t],r=this._resources[e.resourceId];r&&r.unsubscribe(e)}delete this._consumers[e],this.prune()}}subscribe(t){let{resourceId:e,onChange:n,consumerId:r,requestId:i="default"}=t;const{_resources:o,protocol:s}=this;e.startsWith(s)&&(e=e.replace(s,""),o[e]||this.add({resourceId:e,data:null,persistent:!1}));const a=o[e];if(this._track(r,i,a,n),a)return a.getData()}prune(){this._pruneRequest||(this._pruneRequest=setTimeout((()=>this._prune()),0))}finalize(){for(const t in this._resources)this._resources[t].delete()}_track(t,e,n,r){const i=this._consumers,o=i[t]=i[t]||{},s=o[e]||{},a=s.resourceId&&this._resources[s.resourceId];a&&(a.unsubscribe(s),this.prune()),n&&(o[e]=s,s.onChange=r,s.resourceId=n.id,n.subscribe(s))}_prune(){this._pruneRequest=null;for(const t of Object.keys(this._resources)){const e=this._resources[t];e.persistent||e.inUse()||(e.delete(),delete this._resources[t])}}}const _v=new class{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};ge(this,"_pool",[]),ge(this,"opts",{overAlloc:2,poolSize:100}),this.setOptions(t)}setOptions(t){Object.assign(this.opts,t)}allocate(t,e,n){let{size:r=1,type:i,padding:o=0,copy:s=!1,initialize:a=!1,maxCount:l}=n;const c=i||t&&t.constructor||Float32Array,u=e*r+o;if(ArrayBuffer.isView(t)){if(u<=t.length)return t;if(u*t.BYTES_PER_ELEMENT<=t.buffer.byteLength)return new c(t.buffer,0,u)}let d=1/0;l&&(d=l*r+o);const h=this._allocate(c,u,a,d);return t&&s?h.set(t):a||h.fill(0,0,4),this._release(t),h}release(t){this._release(t)}_allocate(t,e,n,r){let i=Math.max(Math.ceil(e*this.opts.overAlloc),1);i>r&&(i=r);const o=this._pool,s=t.BYTES_PER_ELEMENT*i,a=o.findIndex((t=>t.byteLength>=s));if(a>=0){const e=new t(o.splice(a,1)[0],0,i);return n&&e.fill(0),e}return new t(i)}_release(t){if(!ArrayBuffer.isView(t))return;const e=this._pool,{buffer:n}=t,{byteLength:r}=n,i=e.findIndex((t=>t.byteLength>=r));i<0?e.push(n):(i>0||e.lengththis.opts.poolSize&&e.shift()}},wv=(Math.PI,Math.PI,{EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0});function Sv(t){let{precision:e=wv.precision}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t=function(t){return Math.round(t/wv.EPSILON)*wv.EPSILON}(t),"".concat(parseFloat(t.toPrecision(e)))}function Cv(t){return Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Ev(t,e,n){return Tv(t,(t=>Math.max(e,Math.min(n,t))))}function Pv(t,e,n){return Cv(t)?t.map(((t,r)=>Pv(t,e[r],n))):n*e+(1-n)*t}function Mv(t,e,n){const r=wv.EPSILON;n&&(wv.EPSILON=n);try{if(t===e)return!0;if(Cv(t)&&Cv(e)){if(t.length!==e.length)return!1;for(let n=0;n1&&void 0!==arguments[1]?arguments[1]:0;for(let n=0;n0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;for(let n=0;n0?", ":"")+Sv(this[n],t);return"".concat(t.printTypes?this.constructor.name:"","[").concat(e,"]")}equals(t){if(!t||this.length!==t.length)return!1;for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:"";if(wv.debug&&!function(t,e){if(t.length!==e)return!1;for(let n=0;n=0&&t=0&&t0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;super(-0,-0,-0),1===arguments.length&&Cv(t)?this.copy(t):(wv.debug&&(kv(t),kv(e),kv(n)),this[0]=t,this[1]=e,this[2]=n)}set(t,e,n){return this[0]=t,this[1]=e,this[2]=n,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this.check()}fromObject(t){return wv.debug&&(kv(t.x),kv(t.y),kv(t.z)),this[0]=t.x,this[1]=t.y,this[2]=t.z,this.check()}toObject(t){return t.x=this[0],t.y=this[1],t.z=this[2],t}get ELEMENTS(){return 3}get z(){return this[2]}set z(t){this[2]=kv(t)}angle(t){return function(t,e){var n=t[0],r=t[1],i=t[2],o=e[0],s=e[1],a=e[2],l=Math.sqrt(n*n+r*r+i*i)*Math.sqrt(o*o+s*s+a*a),c=l&&jv(t,e)/l;return Math.acos(Math.min(Math.max(c,-1),1))}(this,t)}cross(t){return zv(this,this,t),this.check()}rotateX(t){let{radians:e,origin:n=qv}=t;return function(t,e,n,r){var i=[],o=[];i[0]=e[0]-n[0],i[1]=e[1]-n[1],i[2]=e[2]-n[2],o[0]=i[0],o[1]=i[1]*Math.cos(r)-i[2]*Math.sin(r),o[2]=i[1]*Math.sin(r)+i[2]*Math.cos(r),t[0]=o[0]+n[0],t[1]=o[1]+n[1],t[2]=o[2]+n[2]}(this,this,n,e),this.check()}rotateY(t){let{radians:e,origin:n=qv}=t;return function(t,e,n,r){var i=[],o=[];i[0]=e[0]-n[0],i[1]=e[1]-n[1],i[2]=e[2]-n[2],o[0]=i[2]*Math.sin(r)+i[0]*Math.cos(r),o[1]=i[1],o[2]=i[2]*Math.cos(r)-i[0]*Math.sin(r),t[0]=o[0]+n[0],t[1]=o[1]+n[1],t[2]=o[2]+n[2]}(this,this,n,e),this.check()}rotateZ(t){let{radians:e,origin:n=qv}=t;return function(t,e,n,r){var i=[],o=[];i[0]=e[0]-n[0],i[1]=e[1]-n[1],i[2]=e[2]-n[2],o[0]=i[0]*Math.cos(r)-i[1]*Math.sin(r),o[1]=i[0]*Math.sin(r)+i[1]*Math.cos(r),o[2]=i[2],t[0]=o[0]+n[0],t[1]=o[1]+n[1],t[2]=o[2]+n[2]}(this,this,n,e),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return Uv(this,this,t),this.check()}transformAsVector(t){return Kv(this,this,t),this.check()}transformByMatrix3(t){return Vv(this,this,t),this.check()}transformByMatrix2(t){return function(t,e,n){const r=e[0],i=e[1];t[0]=n[0]*r+n[2]*i,t[1]=n[1]*r+n[3]*i,t[2]=e[2]}(this,this,t),this.check()}transformByQuaternion(t){return Gv(this,this,t),this.check()}}const Zv=new Qv;function $v(t,e,n,r){Zv.set(t,e,n);const i=Zv.len();return{distance:r/i,normal:new Qv(-t/i,-e/i,-n/i)}}function tb(t){return t-Math.fround(t)}let eb;function nb(t,e){const{size:n=1,startIndex:r=0}=e,i=void 0!==e.endIndex?e.endIndex:t.length,o=(i-r)/n;eb=_v.allocate(eb,o,{type:Float32Array,size:2*n});let s=r,a=0;for(;s1&&void 0!==arguments[1]?arguments[1]:new Array(this.RANK).fill(-0);const n=t*this.RANK;for(let r=0;r0&&void 0!==arguments[0]?arguments[0]:[-0,-0,-0];return t[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),t[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),t[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),t}getTranslation(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[-0,-0,-0];return t[0]=this[12],t[1]=this[13],t[2]=this[14],t}getRotation(t,e){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],e=e||[-0,-0,-0];const n=this.getScale(e),r=1/n[0],i=1/n[1],o=1/n[2];return t[0]=this[0]*r,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=0,t[4]=this[4]*r,t[5]=this[5]*i,t[6]=this[6]*o,t[7]=0,t[8]=this[8]*r,t[9]=this[9]*i,t[10]=this[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}getRotationMatrix3(t,e){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0],e=e||[-0,-0,-0];const n=this.getScale(e),r=1/n[0],i=1/n[1],o=1/n[2];return t[0]=this[0]*r,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=this[4]*r,t[4]=this[5]*i,t[5]=this[6]*o,t[6]=this[8]*r,t[7]=this[9]*i,t[8]=this[10]*o,t}transpose(){return function(t,e){if(t===e){var n=e[1],r=e[2],i=e[3],o=e[6],s=e[7],a=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=n,t[6]=e[9],t[7]=e[13],t[8]=r,t[9]=o,t[11]=e[14],t[12]=i,t[13]=s,t[14]=a}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15]}(this,this),this.check()}invert(){return ob(this,this),this.check()}multiplyLeft(t){return sb(this,t,this),this.check()}multiplyRight(t){return sb(this,this,t),this.check()}rotateX(t){return cb(this,this,t),this.check()}rotateY(t){return function(t,e,n){var r=Math.sin(n),i=Math.cos(n),o=e[0],s=e[1],a=e[2],l=e[3],c=e[8],u=e[9],d=e[10],h=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*i-c*r,t[1]=s*i-u*r,t[2]=a*i-d*r,t[3]=l*i-h*r,t[8]=o*r+c*i,t[9]=s*r+u*i,t[10]=a*r+d*i,t[11]=l*r+h*i}(this,this,t),this.check()}rotateZ(t){return ub(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,e){return function(t,e,n,r){var i,o,s,a,l,c,u,d,h,f,p,g,m,v,b,y,x,A,_,w,S,C,E,P,M=r[0],T=r[1],O=r[2],k=Math.hypot(M,T,O);k2*Math.PI)throw Error("expected radians")}function Rb(t,e){const n=Ab([],e,t);return bb(n,n,1/n[3]),n}function Ib(t,e){const n=t%e;return n<0?e+n:n}function Bb(t,e,n){return n*e+(1-n)*t}function Lb(t,e,n){return tn?n:t}const Db=Math.log2||function(t){return Math.log(t)*Math.LOG2E};function Fb(t,e){if(!t)throw new Error(e||"@math.gl/web-mercator: assertion failed.")}const Nb=Math.PI,jb=Nb/4,zb=Nb/180,Ub=180/Nb,Vb=512,Gb=4003e4,Wb=85.051129,Hb=1.5;function Jb(t){return Math.pow(2,t)}function Kb(t){return Db(t)}function Xb(t){const[e,n]=t;Fb(Number.isFinite(e)),Fb(Number.isFinite(n)&&n>=-90&&n<=90,"invalid latitude");const r=n*zb;return[Vb*(e*zb+Nb)/(2*Nb),Vb*(Nb+Math.log(Math.tan(jb+.5*r)))/(2*Nb)]}function qb(t){const[e,n]=t,r=e/Vb*(2*Nb)-Nb,i=2*(Math.atan(Math.exp(n/Vb*(2*Nb)-Nb))-jb);return[r*Ub,i*Ub]}function Yb(t){const e=Math.cos(t*zb);return Vb/Gb/e}function Qb(t){const{latitude:e,longitude:n,highPrecision:r=!1}=t;Fb(Number.isFinite(e)&&Number.isFinite(n));const i=Vb,o=Math.cos(e*zb),s=i/360,a=s/o,l=i/Gb/o,c={unitsPerMeter:[l,l,l],metersPerUnit:[1/l,1/l,1/l],unitsPerDegree:[s,a,l],degreesPerUnit:[1/s,1/a,1/l]};if(r){const t=zb*Math.tan(e*zb)/o,n=s*t/2,r=i/Gb*t,u=r/a*l;c.unitsPerDegree2=[0,n,r],c.unitsPerMeter2=[u,0,u]}return c}function Zb(t,e){const[n,r,i]=t,[o,s,a]=e,{unitsPerMeter:l,unitsPerMeter2:c}=Qb({longitude:n,latitude:r,highPrecision:!0}),u=Xb(t);u[0]+=o*(l[0]+c[0]*s),u[1]+=s*(l[1]+c[1]*s);const d=qb(u),h=(i||0)+(a||0);return Number.isFinite(i)||Number.isFinite(a)?[d[0],d[1],h]:d}function $b(t){const{width:e,height:n,altitude:r,pitch:i=0,offset:o,center:s,scale:a,nearZMultiplier:l=1,farZMultiplier:c=1}=t;let{fovy:u=ty(Hb)}=t;void 0!==r&&(u=ty(r));const d=u*zb,h=i*zb,f=ey(u);let p=f;s&&(p+=s[2]*a/Math.cos(h)/n);const g=d*(.5+(o?o[1]:0)/n),m=Math.sin(g)*p/Math.sin(Lb(Math.PI/2-h-g,.01,Math.PI-.01)),v=Math.sin(h)*m+p,b=10*p;return{fov:d,aspect:e/n,focalDistance:f,near:l,far:Math.min(v*c,b)}}function ty(t){return 2*Math.atan(.5/t)*Ub}function ey(t){return.5/Math.tan(.5*t*zb)}function ny(t,e){const[n,r,i=0]=t;return Fb(Number.isFinite(n)&&Number.isFinite(r)&&Number.isFinite(i)),Rb(e,[n,r,i,1])}function ry(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const[r,i,o]=t;if(Fb(Number.isFinite(r)&&Number.isFinite(i),"invalid pixel coordinate"),Number.isFinite(o)){return Rb(e,[r,i,o,1])}const s=Rb(e,[r,i,0,1]),a=Rb(e,[r,i,1,1]),l=s[2],c=a[2];return mb([],s,a,l===c?0:((n||0)-l)/(c-l))}function iy(t){const{width:e,height:n,bounds:r,minExtent:i=0,maxZoom:o=24,offset:s=[0,0]}=t,[[a,l],[c,u]]=r,d=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if("number"===typeof t)return{top:t,bottom:t,left:t,right:t};return Fb(Number.isFinite(t.top)&&Number.isFinite(t.bottom)&&Number.isFinite(t.left)&&Number.isFinite(t.right)),t}(t.padding),h=Xb([a,Lb(u,-85.051129,Wb)]),f=Xb([c,Lb(l,-85.051129,Wb)]),p=[Math.max(Math.abs(f[0]-h[0]),i),Math.max(Math.abs(f[1]-h[1]),i)],g=[e-d.left-d.right-2*Math.abs(s[0]),n-d.top-d.bottom-2*Math.abs(s[1])];Fb(g[0]>0&&g[1]>0);const m=g[0]/p[0],v=g[1]/p[1],b=(d.right-d.left)/2/m,y=(d.top-d.bottom)/2/v,x=qb([(f[0]+h[0])/2+b,(f[1]+h[1])/2+y]),A=Math.min(o,Db(Math.abs(Math.min(m,v))));return Fb(Number.isFinite(A)),{longitude:x[0],latitude:x[1],zoom:A}}const oy=Math.PI/180;function sy(t,e,n){const{pixelUnprojectionMatrix:r}=t,i=Rb(r,[e,0,1,1]),o=Rb(r,[e,t.height,1,1]),s=qb(mb([],i,o,(n*t.distanceScales.unitsPerMeter[2]-i[2])/(o[2]-i[2])));return s.push(n),s}const ay=.01,ly=["longitude","latitude","zoom"],cy={curve:1.414,speed:1.2};function uy(t,e,n){const r=(n=Object.assign({},cy,n)).curve,i=t.zoom,o=[t.longitude,t.latitude],s=Jb(i),a=e.zoom,l=[e.longitude,e.latitude],c=Jb(a-i),u=Xb(o),d=Xb(l),h=vb([],d,u),f=Math.max(t.width,t.height),p=f/c,g=gb(h)*s,m=Math.max(g,ay),v=r*r,b=(p*p-f*f+v*v*m*m)/(2*f*v*m),y=(p*p-f*f-v*v*m*m)/(2*p*v*m),x=Math.log(Math.sqrt(b*b+1)-b),A=Math.log(Math.sqrt(y*y+1)-y);return{startZoom:i,startCenterXY:u,uDelta:h,w0:f,u1:g,S:(A-x)/r,rho:r,rho2:v,r0:x,r1:A}}const dy={DEFAULT:-1,LNGLAT:1,METER_OFFSETS:2,LNGLAT_OFFSETS:3,CARTESIAN:0};Object.defineProperty(dy,"IDENTITY",{get:()=>(Rg.deprecated("COORDINATE_SYSTEM.IDENTITY","COORDINATE_SYSTEM.CARTESIAN")(),0)});const hy={WEB_MERCATOR:1,GLOBE:2,WEB_MERCATOR_AUTO_OFFSET:4,IDENTITY:0},fy={common:0,meters:1,pixels:2},py={click:{handler:"onClick"},panstart:{handler:"onDragStart"},panmove:{handler:"onDrag"},panend:{handler:"onDragEnd"}},gy=Math.PI/180,my=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],vy=[0,0,0],by={unitsPerMeter:[1,1,1],metersPerUnit:[1,1,1]};class yy{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};ge(this,"id",void 0),ge(this,"x",void 0),ge(this,"y",void 0),ge(this,"width",void 0),ge(this,"height",void 0),ge(this,"padding",void 0),ge(this,"isGeospatial",void 0),ge(this,"zoom",void 0),ge(this,"focalDistance",void 0),ge(this,"position",void 0),ge(this,"modelMatrix",void 0),ge(this,"distanceScales",void 0),ge(this,"scale",void 0),ge(this,"center",void 0),ge(this,"cameraPosition",void 0),ge(this,"projectionMatrix",void 0),ge(this,"viewMatrix",void 0),ge(this,"viewMatrixUncentered",void 0),ge(this,"viewMatrixInverse",void 0),ge(this,"viewProjectionMatrix",void 0),ge(this,"pixelProjectionMatrix",void 0),ge(this,"pixelUnprojectionMatrix",void 0),ge(this,"resolution",void 0),ge(this,"_frustumPlanes",{}),this.id=t.id||this.constructor.displayName||"viewport",this.x=t.x||0,this.y=t.y||0,this.width=t.width||1,this.height=t.height||1,this.zoom=t.zoom||0,this.padding=t.padding,this.distanceScales=t.distanceScales||by,this.focalDistance=t.focalDistance||1,this.position=t.position||vy,this.modelMatrix=t.modelMatrix||null;const{longitude:e,latitude:n}=t;this.isGeospatial=Number.isFinite(n)&&Number.isFinite(e),this._initProps(t),this._initMatrices(t),this.equals=this.equals.bind(this),this.project=this.project.bind(this),this.unproject=this.unproject.bind(this),this.projectPosition=this.projectPosition.bind(this),this.unprojectPosition=this.unprojectPosition.bind(this),this.projectFlat=this.projectFlat.bind(this),this.unprojectFlat=this.unprojectFlat.bind(this)}get subViewports(){return null}get metersPerPixel(){return this.distanceScales.metersPerUnit[2]/this.scale}get projectionMode(){return this.isGeospatial?this.zoom<12?hy.WEB_MERCATOR:hy.WEB_MERCATOR_AUTO_OFFSET:hy.IDENTITY}equals(t){return t instanceof yy&&(this===t||t.width===this.width&&t.height===this.height&&t.scale===this.scale&&Mv(t.projectionMatrix,this.projectionMatrix)&&Mv(t.viewMatrix,this.viewMatrix))}project(t){let{topLeft:e=!0}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=ny(this.projectPosition(t),this.pixelProjectionMatrix),[r,i]=n,o=e?i:this.height-i;return 2===t.length?[r,o]:[r,o,n[2]]}unproject(t){let{topLeft:e=!0,targetZ:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const[r,i,o]=t,s=e?i:this.height-i,a=n&&n*this.distanceScales.unitsPerMeter[2],l=ry([r,s,o],this.pixelUnprojectionMatrix,a),[c,u,d]=this.unprojectPosition(l);return Number.isFinite(o)?[c,u,d]:Number.isFinite(n)?[c,u,n]:[c,u]}projectPosition(t){const[e,n]=this.projectFlat(t);return[e,n,(t[2]||0)*this.distanceScales.unitsPerMeter[2]]}unprojectPosition(t){const[e,n]=this.unprojectFlat(t);return[e,n,(t[2]||0)*this.distanceScales.metersPerUnit[2]]}projectFlat(t){if(this.isGeospatial){const e=Xb(t);return e[1]=Ev(e[1],-318,830),e}return t}unprojectFlat(t){return this.isGeospatial?qb(t):t}getBounds(){const t={targetZ:(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).z||0},e=this.unproject([0,0],t),n=this.unproject([this.width,0],t),r=this.unproject([0,this.height],t),i=this.unproject([this.width,this.height],t);return[Math.min(e[0],n[0],r[0],i[0]),Math.min(e[1],n[1],r[1],i[1]),Math.max(e[0],n[0],r[0],i[0]),Math.max(e[1],n[1],r[1],i[1])]}getDistanceScales(t){return t?Qb({longitude:t[0],latitude:t[1],highPrecision:!0}):this.distanceScales}containsPixel(t){let{x:e,y:n,width:r=1,height:i=1}=t;return eNumber.isFinite(t)&&(!("max"in e)||t<=e.max)&&(!("min"in e)||t>=e.min)},array:{validate:(t,e)=>Array.isArray(t)||ArrayBuffer.isView(t)}};function Sy(t){let e=Cy(t);return"object"===e?t?"type"in t?Object.assign({},t,wy[t.type]):"value"in t?(e=Cy(t.value),Object.assign({type:e},t,wy[e])):{type:"object",value:t}:{type:"object",value:null}:Object.assign({type:e,value:t},wy[e])}function Cy(t){return Array.isArray(t)||ArrayBuffer.isView(t)?"array":typeof t}class Ey{constructor(t){let{name:e,vs:n,fs:r,dependencies:i=[],uniforms:o,getUniforms:s,deprecations:a=[],defines:l={},inject:c={},vertexShader:u,fragmentShader:d}=t;_y("string"===typeof e),this.name=e,this.vs=n||u,this.fs=r||d,this.getModuleUniforms=s,this.dependencies=i,this.deprecations=this._parseDeprecationDefinitions(a),this.defines=l,this.injections=function(t){const e={vs:{},fs:{}};for(const n in t){let r=t[n];"string"===typeof r&&(r={order:0,injection:r}),e[n.slice(0,2)][n]=r}return e}(c),o&&(this.uniforms=function(t){const e={};for(const n in t){const r=Sy(t[n]);e[n]=r}return e}(o))}getModuleSource(t){let e;switch(t){case"vs":e=this.vs||"";break;case"fs":e=this.fs||"";break;default:_y(!1)}return"#define MODULE_".concat(this.name.toUpperCase().replace(/[^0-9a-z]/gi,"_"),"\n").concat(e,"// END MODULE_").concat(this.name,"\n\n")}getUniforms(t,e){return this.getModuleUniforms?this.getModuleUniforms(t,e):this.uniforms?this._defaultGetUniforms(t):{}}getDefines(){return this.defines}checkDeprecations(t,e){this.deprecations.forEach((n=>{n.regex.test(t)&&(n.deprecated?e.deprecated(n.old,n.new)():e.removed(n.old,n.new)())}))}_parseDeprecationDefinitions(t){return t.forEach((t=>{if("function"===t.type)t.regex=new RegExp("\\b".concat(t.old,"\\("));else t.regex=new RegExp("".concat(t.type," ").concat(t.old,";"))})),t}_defaultGetUniforms(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e={},n=this.uniforms;for(const r in n){const i=n[r];r in t&&!i.private?(i.validate&&_y(i.validate(t[r],i),"".concat(this.name,": invalid ").concat(r)),e[r]=t[r]):e[r]=i.value}return e}}function Py(t){return My(Oy(t))}function My(t){const e={},n={};return Ty({modules:t,level:0,moduleMap:e,moduleDepth:n}),Object.keys(n).sort(((t,e)=>n[e]-n[t])).map((t=>e[t]))}function Ty(t){let{modules:e,level:n,moduleMap:r,moduleDepth:i}=t;if(n>=5)throw new Error("Possible loop in shader dependency graph");for(const o of e)r[o.name]=o,(void 0===i[o.name]||i[o.name](t instanceof Ey||(_y("string"!==typeof t,"Shader module use by name is deprecated. Import shader module '".concat(t,"' and use it directly.")),_y(t.name,"shader module has no name"),(t=new Ey(t)).dependencies=Oy(t.dependencies)),t)))}const ky=7936,Ry=7937,Iy=7938,By=35724,Ly={GLSL_FRAG_DATA:["WEBGL_draw_buffers",!0],GLSL_FRAG_DEPTH:["EXT_frag_depth",!0],GLSL_DERIVATIVES:["OES_standard_derivatives",!0],GLSL_TEXTURE_LOD:["EXT_shader_texture_lod",!0]},Dy={};Object.keys(Ly).forEach((t=>{Dy[t]=t}));const Fy={};function Ny(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=Ly[e];if(_y(r,e),!function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e="undefined"!==typeof window&&window.navigator||{},n=t.userAgent||e.userAgent||"",r=-1!==n.indexOf("MSIE "),i=-1!==n.indexOf("Trident/");return r||i}(n))return!0;if(e in Fy)return Fy[e];const i=r[0],o=n.behavior||"enable",s="#extension GL_".concat(i," : ").concat(o,"\nvoid main(void) {}"),a=t.createShader(35633);t.shaderSource(a,s),t.compileShader(a);const l=t.getShaderParameter(a,35713);return t.deleteShader(a),Fy[e]=l,l}function jy(t,e){const n=Ly[e];_y(n,e);const r=function(t){return"undefined"!==typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||Boolean(t&&2===t._version)}(t)&&n[1]||n[0],i="string"===typeof r?Boolean(t.getExtension(r)):r;return _y(!1===i||!0===i),i}function zy(t,e){return(e=Array.isArray(e)?e:[e]).every((e=>jy(t,e)))}function Uy(t){const e=function(t){const e=t.getExtension("WEBGL_debug_renderer_info"),n=t.getParameter(e&&e.UNMASKED_VENDOR_WEBGL||ky),r=t.getParameter(e&&e.UNMASKED_RENDERER_WEBGL||Ry);return{gpuVendor:function(t,e){return t.match(/NVIDIA/i)||e.match(/NVIDIA/i)?"NVIDIA":t.match(/INTEL/i)||e.match(/INTEL/i)?"INTEL":t.match(/AMD/i)||e.match(/AMD/i)||t.match(/ATI/i)||e.match(/ATI/i)?"AMD":"UNKNOWN GPU"}(n,r),vendor:n,renderer:r,version:t.getParameter(Iy),shadingLanguageVersion:t.getParameter(By)}}(t);switch(e.gpuVendor.toLowerCase()){case"nvidia":return"#define NVIDIA_GPU\n// Nvidia optimizes away the calculation necessary for emulated fp64\n#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1\n";case"intel":return"#define INTEL_GPU\n// Intel optimizes away the calculation necessary for emulated fp64\n#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1\n// Intel's built-in 'tan' function doesn't have acceptable precision\n#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1\n// Intel GPU doesn't have full 32 bits precision in same cases, causes overflow\n#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1\n";case"amd":return"#define AMD_GPU\n";default:return"#define DEFAULT_GPU\n// Prevent driver from optimizing away the calculation necessary for emulated fp64\n#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1\n// Intel's built-in 'tan' function doesn't have acceptable precision\n#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1\n// Intel GPU doesn't have full 32 bits precision in same cases, causes overflow\n#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1\n"}}const Vy={[xy]:"#ifdef MODULE_LOGDEPTH\n logdepth_adjustPosition(gl_Position);\n#endif\n",[Ay]:"#ifdef MODULE_MATERIAL\n gl_FragColor = material_filterColor(gl_FragColor);\n#endif\n\n#ifdef MODULE_LIGHTING\n gl_FragColor = lighting_filterColor(gl_FragColor);\n#endif\n\n#ifdef MODULE_FOG\n gl_FragColor = fog_filterColor(gl_FragColor);\n#endif\n\n#ifdef MODULE_PICKING\n gl_FragColor = picking_filterHighlightColor(gl_FragColor);\n gl_FragColor = picking_filterPickingColor(gl_FragColor);\n#endif\n\n#ifdef MODULE_LOGDEPTH\n logdepth_setFragDepth();\n#endif\n"},Gy="__LUMA_INJECT_DECLARATIONS__",Wy=/void\s+main\s*\([^)]*\)\s*\{\n?/,Hy=/}\n?[^{}]*$/,Jy=[];function Ky(t,e,n){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const i=e===xy;for(const o in n){const e=n[o];e.sort(((t,e)=>t.order-e.order)),Jy.length=e.length;for(let t=0,n=e.length;tt+r)));break;case"vs:#main-end":i&&(t=t.replace(Hy,(t=>r+t)));break;case"fs:#decl":i||(t=t.replace(Gy,r));break;case"fs:#main-start":i||(t=t.replace(Wy,(t=>t+r)));break;case"fs:#main-end":i||(t=t.replace(Hy,(t=>r+t)));break;default:t=t.replace(o,(t=>t+r))}}return t=t.replace(Gy,""),r&&(t=t.replace(/\}\s*$/,(t=>t+Vy[e]))),t}function Xy(t){const e={};return _y(Array.isArray(t)&&t.length>1),t.forEach((t=>{for(const n in t)e[n]=e[n]?"".concat(e[n],"\n").concat(t[n]):t[n]})),e}function qy(t){return new RegExp("\\b".concat(t,"[ \\t]+(\\w+[ \\t]+\\w+(\\[\\w+\\])?;)"),"g")}const Yy=[[/^(#version[ \t]+(100|300[ \t]+es))?[ \t]*\n/,"#version 300 es\n"],[/\btexture(2D|2DProj|Cube)Lod(EXT)?\(/g,"textureLod("],[/\btexture(2D|2DProj|Cube)(EXT)?\(/g,"texture("]],Qy=[...Yy,[qy("attribute"),"in $1"],[qy("varying"),"out $1"]],Zy=[...Yy,[qy("varying"),"in $1"]],$y=[[/^#version[ \t]+300[ \t]+es/,"#version 100"],[/\btexture(2D|2DProj|Cube)Lod\(/g,"texture$1LodEXT("],[/\btexture\(/g,"texture2D("],[/\btextureLod\(/g,"texture2DLodEXT("]],tx=[...$y,[qy("in"),"attribute $1"],[qy("out"),"varying $1"]],ex=[...$y,[qy("in"),"varying $1"]],nx="gl_FragColor",rx=/\bout[ \t]+vec4[ \t]+(\w+)[ \t]*;\n?/,ix=/void\s+main\s*\([^)]*\)\s*\{\n?/;function ox(t,e,n){switch(e){case 300:return n?sx(t,Qy):function(t){t=sx(t,Zy);const e=t.match(rx);if(e){const n=e[1];t=t.replace(new RegExp("\\b".concat(nx,"\\b"),"g"),n)}else{const e="fragmentColor";t=t.replace(ix,(t=>"out vec4 ".concat(e,";\n").concat(t))).replace(new RegExp("\\b".concat(nx,"\\b"),"g"),e)}return t}(t);case 100:return n?sx(t,tx):function(t){t=sx(t,ex);const e=t.match(rx);if(e){const n=e[1];t=t.replace(rx,"").replace(new RegExp("\\b".concat(n,"\\b"),"g"),nx)}return t}(t);default:throw new Error("unknown GLSL version ".concat(e))}}function sx(t,e){for(const[n,r]of e)t=t.replace(n,r);return t}const ax="\n\n".concat(Gy,"\n\n"),lx={[xy]:"vertex",[Ay]:"fragment"},cx="precision highp float;\n\n";function ux(t,e){let{id:n,source:r,type:i,modules:o,defines:s={},hookFunctions:a=[],inject:l={},transpileToGLSL100:c=!1,prologue:u=!0,log:d}=e;_y("string"===typeof r,"shader source must be a string");const h=i===xy,f=r.split("\n");let p=100,g="",m=r;0===f[0].indexOf("#version ")?(p=300,g=f[0],m=f.slice(1).join("\n")):g="#version ".concat(p);const v={};o.forEach((t=>{Object.assign(v,t.getDefines())})),Object.assign(v,s);let b=u?"".concat(g,"\n").concat(function(t){let{id:e,source:n,type:r}=t;const i=e&&"string"===typeof e&&-1===n.indexOf("SHADER_NAME");return i?"\n#define SHADER_NAME ".concat(e,"_").concat(lx[r],"\n\n"):""}({id:n,source:r,type:i}),"\n").concat(function(t){let{type:e}=t;return"\n#define SHADER_TYPE_".concat(lx[e].toUpperCase(),"\n")}({type:i}),"\n").concat(Uy(t),"\n").concat(function(t,e,n){let r="#if (__VERSION__ > 120)\n\n# define FEATURE_GLSL_DERIVATIVES\n# define FEATURE_GLSL_DRAW_BUFFERS\n# define FEATURE_GLSL_FRAG_DEPTH\n# define FEATURE_GLSL_TEXTURE_LOD\n\n// DEPRECATED FLAGS, remove in v9\n# define FRAG_DEPTH\n# define DERIVATIVES\n# define DRAW_BUFFERS\n# define TEXTURE_LOD\n\n#endif // __VERSION\n";return zy(t,Dy.GLSL_FRAG_DEPTH)&&(r+="\n// FRAG_DEPTH => gl_FragDepth is available\n#ifdef GL_EXT_frag_depth\n#extension GL_EXT_frag_depth : enable\n# define FEATURE_GLSL_FRAG_DEPTH\n# define FRAG_DEPTH\n# define gl_FragDepth gl_FragDepthEXT\n#endif\n"),zy(t,Dy.GLSL_DERIVATIVES)&&Ny(t,Dy.GLSL_DERIVATIVES)&&(r+="\n// DERIVATIVES => dxdF, dxdY and fwidth are available\n#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives : enable\n# define FEATURE_GLSL_DERIVATIVES\n# define DERIVATIVES\n#endif\n"),zy(t,Dy.GLSL_FRAG_DATA)&&Ny(t,Dy.GLSL_FRAG_DATA,{behavior:"require"})&&(r+="\n// DRAW_BUFFERS => gl_FragData[] is available\n#ifdef GL_EXT_draw_buffers\n#extension GL_EXT_draw_buffers : require\n#define FEATURE_GLSL_DRAW_BUFFERS\n#define DRAW_BUFFERS\n#endif\n"),zy(t,Dy.GLSL_TEXTURE_LOD)&&(r+="// TEXTURE_LOD => texture2DLod etc are available\n#ifdef GL_EXT_shader_texture_lod\n#extension GL_EXT_shader_texture_lod : enable\n\n# define FEATURE_GLSL_TEXTURE_LOD\n# define TEXTURE_LOD\n\n#endif\n"),r}(t),"\n").concat(function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=0,n="";for(const r in t){0===e&&(n+="\n// APPLICATION DEFINES\n"),e++;const i=t[r];(i||Number.isFinite(i))&&(n+="#define ".concat(r.toUpperCase()," ").concat(t[r],"\n"))}0===e&&(n+="\n");return n}(v),"\n").concat(h?"":cx,"\n"):"".concat(g,"\n");const y=function(t){const e={vs:{},fs:{}};return t.forEach((t=>{let n;"string"!==typeof t?(n=t,t=n.hook):n={},t=t.trim();const[r,i]=t.split(":"),o=t.replace(/\(.+/,"");e[r][o]=Object.assign(n,{signature:i})})),e}(a),x={},A={},_={};for(const w in l){const t="string"===typeof l[w]?{injection:l[w],order:0}:l[w],e=w.match(/^(v|f)s:(#)?([\w-]+)$/);if(e){const n=e[2],r=e[3];n?"decl"===r?A[w]=[t]:_[w]=[t]:x[w]=[t]}else _[w]=[t]}for(const w of o){d&&w.checkDeprecations(m,d);b+=w.getModuleSource(i,p);const t=w.injections[i];for(const e in t){const n=e.match(/^(v|f)s:#([\w-]+)$/);if(n){const r="decl"===n[2]?A:_;r[e]=r[e]||[],r[e].push(t[e])}else x[e]=x[e]||[],x[e].push(t[e])}}return b+=ax,b=Ky(b,i,A),b+=function(t,e){let n="";for(const r in t){const i=t[r];if(n+="void ".concat(i.signature," {\n"),i.header&&(n+=" ".concat(i.header)),e[r]){const t=e[r];t.sort(((t,e)=>t.order-e.order));for(const e of t)n+=" ".concat(e.injection,"\n")}i.footer&&(n+=" ".concat(i.footer)),n+="}\n"}return n}(y[i],x),b+=m,b=Ky(b,i,_),b=ox(b,c?100:p,h),b}function dx(t){return function(e){const n={};for(const r of t){const t=r.getUniforms(e,n);Object.assign(n,t)}return n}}const hx=new Mg({id:"luma.gl"});function fx(t,e){if(!t)throw new Error(e||"luma.gl: assertion failed.")}const px="Invalid WebGLRenderingContext",gx="Requires WebGL2";function mx(t){return"undefined"!==typeof WebGLRenderingContext&&t instanceof WebGLRenderingContext||("undefined"!==typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||Boolean(t&&Number.isFinite(t._version)))}function vx(t){return"undefined"!==typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||Boolean(t&&2===t._version)}function bx(t){return fx(mx(t),px),t}function yx(t){return fx(vx(t),gx),t}const xx={};function Ax(t,e){var n;xx[t]=!0,void 0!==e&&(n=e,globalThis.console&&globalThis.console.error&&globalThis.console.error(n))}const _x=function t(e){const n=e.gl;this.ext=e,this.isAlive=!0,this.hasBeenBound=!1,this.elementArrayBuffer=null,this.attribs=new Array(e.maxVertexAttribs);for(let r=0;r{var t;t="OESVertexArrayObject emulation library context restored",globalThis.console&&globalThis.console.log&&globalThis.console.log(t),e.reset_()}),!0),this.reset_()};wx.prototype.VERTEX_ARRAY_BINDING_OES=34229,wx.prototype.reset_=function(){if(void 0!==this.vertexArrayObjects)for(let e=0;evx(t)?void 0:0,Ix={3074:t=>vx(t)?void 0:36064,[Px]:t=>vx(t)?void 0:4352,35977:Rx,32937:Rx,[Mx]:(t,e)=>{const n=vx(t)?t.getExtension("EXT_disjoint_timer_query_webgl2"):t.getExtension("EXT_disjoint_timer_query");return n&&n.GPU_DISJOINT_EXT?e(n.GPU_DISJOINT_EXT):0},[Ox]:(t,e)=>{const n=t.getExtension(Ex);return e(n&&n.UNMASKED_VENDOR_WEBGL||7936)},[kx]:(t,e)=>{const n=t.getExtension(Ex);return e(n&&n.UNMASKED_RENDERER_WEBGL||7937)},[Tx]:(t,e)=>{const n=t.luma.extensions.EXT_texture_filter_anisotropic;return n?e(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):1},32883:Rx,35071:Rx,37447:Rx,36063:(t,e)=>{if(!vx(t)){const n=t.getExtension(Cx);return n?e(n.MAX_COLOR_ATTACHMENTS_WEBGL):0}},35379:Rx,35374:Rx,35377:Rx,34852:t=>{if(!vx(t)){const e=t.getExtension(Cx);return e?e.MAX_DRAW_BUFFERS_WEBGL:0}},36203:t=>t.getExtension(Sx)?2147483647:65535,33001:t=>t.getExtension(Sx)?16777216:65535,33e3:t=>16777216,37157:Rx,35373:Rx,35657:Rx,36183:Rx,37137:Rx,34045:Rx,35978:Rx,35979:Rx,35968:Rx,35376:Rx,35375:Rx,35659:Rx,37154:Rx,35371:Rx,35658:Rx,35076:Rx,35077:Rx,35380:Rx};const Bx="OES_vertex_array_object",Lx="ANGLE_instanced_arrays",Dx="WEBGL_draw_buffers",Fx="EXT_disjoint_timer_query";const Nx={[Bx]:{meta:{suffix:"OES"},createVertexArray:()=>{fx(!1,"VertexArray requires WebGL2 or OES_vertex_array_object extension")},deleteVertexArray:()=>{},bindVertexArray:()=>{},isVertexArray:()=>!1},[Lx]:{meta:{suffix:"ANGLE"},vertexAttribDivisor(t,e){fx(0===e,"WebGL instanced rendering not supported")},drawElementsInstanced:()=>{},drawArraysInstanced:()=>{}},[Dx]:{meta:{suffix:"WEBGL"},drawBuffers:()=>{fx(!1)}},[Fx]:{meta:{suffix:"EXT"},createQuery:()=>{fx(!1)},deleteQuery:()=>{fx(!1)},beginQuery:()=>{fx(!1)},endQuery:()=>{},getQuery(t,e){return this.getQueryObject(t,e)},getQueryParameter(t,e){return this.getQueryObject(t,e)},getQueryObject:()=>{}}},jx={readBuffer:(t,e,n)=>{vx(t)&&e(n)},getVertexAttrib:(t,e,n,r)=>{const{webgl2:i,ext:o}=function(t,e){return{webgl2:vx(t),ext:t.getExtension(e)}}(t,Lx);let s;switch(r){case 35069:s=!!i&&void 0;break;case 35070:s=i||o?void 0:0}return void 0!==s?s:e(n,r)},getProgramParameter:(t,e,n,r)=>{if(!vx(t))switch(r){case 35967:return 35981;case 35971:case 35382:return 0}return e(n,r)},getInternalformatParameter:(t,e,n,r,i)=>vx(t)||32937!==i?t.getInternalformatParameter(n,r,i):new Int32Array([0]),getTexParameter(t,e,n,r){if(34046===r){const{extensions:e}=t.luma,n=e.EXT_texture_filter_anisotropic;r=n&&n.TEXTURE_MAX_ANISOTROPY_EXT||34046}return e(n,r)},getParameter:function(t,e,n){const r=Ix[n],i="function"===typeof r?r(t,e,n):r;return void 0!==i?i:e(n)},hint:(t,e,n,r)=>e(n,r)};function zx(t,e){let{extension:n,target:r,target2:i}=e;const o=Nx[n];fx(o);const{meta:s={}}=o,{suffix:a=""}=s,l=t.getExtension(n);for(const c of Object.keys(o)){const e="".concat(c).concat(a);let n=null;"meta"===c||"function"===typeof t[c]||(l&&"function"===typeof l[e]?n=function(){return l[e](...arguments)}:"function"===typeof o[c]&&(n=o[c].bind(r))),n&&(r[c]=n,i[c]=n)}}globalThis.polyfillContext=function(t){t.luma=t.luma||{};const{luma:e}=t;return e.polyfilled||(!function(t){if("function"===typeof t.createVertexArray)return;const e=t.getSupportedExtensions;t.getSupportedExtensions=function(){const t=e.call(this)||[];return t.indexOf("OES_vertex_array_object")<0&&t.push("OES_vertex_array_object"),t};const n=t.getExtension;t.getExtension=function(e){return n.call(this,e)||("OES_vertex_array_object"!==e?null:(t.__OESVertexArrayObject||(this.__OESVertexArrayObject=new wx(this)),this.__OESVertexArrayObject))}}(t),function(t){t.luma.extensions={};const e=t.getSupportedExtensions()||[];for(const n of e)t.luma[n]=t.getExtension(n)}(t),function(t,e){for(const n of Object.getOwnPropertyNames(e))"overrides"!==n&&zx(t,{extension:n,target:t.luma,target2:t})}(t,Nx),function(t,e){let{target:n,target2:r}=e;Object.keys(jx).forEach((e=>{if("function"===typeof jx[e]){const i=t[e]?t[e].bind(t):()=>{},o=jx[e].bind(null,t,i);n[e]=o,r[e]=o}}))}(t,{target:e,target2:t}),e.polyfilled=!0),t};const Ux={3042:!1,32773:new Float32Array([0,0,0,0]),32777:32774,34877:32774,32969:1,32968:0,32971:1,32970:0,3106:new Float32Array([0,0,0,0]),3107:[!0,!0,!0,!0],2884:!1,2885:1029,2929:!1,2931:1,2932:513,2928:new Float32Array([0,1]),2930:!0,3024:!0,36006:null,2886:2305,33170:4352,2849:1,32823:!1,32824:0,10752:0,32938:1,32939:!1,3089:!1,3088:new Int32Array([0,0,1024,1024]),2960:!1,2961:0,2968:4294967295,36005:4294967295,2962:519,2967:0,2963:4294967295,34816:519,36003:0,36004:4294967295,2964:7680,2965:7680,2966:7680,34817:7680,34818:7680,34819:7680,2978:[0,0,1024,1024],3333:4,3317:4,37440:!1,37441:!1,37443:37444,35723:4352,36010:null,35977:!1,3330:0,3332:0,3331:0,3314:0,32878:0,3316:0,3315:0,32877:0},Vx=(t,e,n)=>e?t.enable(n):t.disable(n),Gx=(t,e,n)=>t.hint(n,e),Wx=(t,e,n)=>t.pixelStorei(n,e);function Hx(t){return Array.isArray(t)||ArrayBuffer.isView(t)}const Jx={3042:Vx,32773:(t,e)=>t.blendColor(...e),32777:"blendEquation",34877:"blendEquation",32969:"blendFunc",32968:"blendFunc",32971:"blendFunc",32970:"blendFunc",3106:(t,e)=>t.clearColor(...e),3107:(t,e)=>t.colorMask(...e),2884:Vx,2885:(t,e)=>t.cullFace(e),2929:Vx,2931:(t,e)=>t.clearDepth(e),2932:(t,e)=>t.depthFunc(e),2928:(t,e)=>t.depthRange(...e),2930:(t,e)=>t.depthMask(e),3024:Vx,35723:Gx,36006:(t,e)=>{const n=vx(t)?36009:36160;return t.bindFramebuffer(n,e)},2886:(t,e)=>t.frontFace(e),33170:Gx,2849:(t,e)=>t.lineWidth(e),32823:Vx,32824:"polygonOffset",10752:"polygonOffset",35977:Vx,32938:"sampleCoverage",32939:"sampleCoverage",3089:Vx,3088:(t,e)=>t.scissor(...e),2960:Vx,2961:(t,e)=>t.clearStencil(e),2968:(t,e)=>t.stencilMaskSeparate(1028,e),36005:(t,e)=>t.stencilMaskSeparate(1029,e),2962:"stencilFuncFront",2967:"stencilFuncFront",2963:"stencilFuncFront",34816:"stencilFuncBack",36003:"stencilFuncBack",36004:"stencilFuncBack",2964:"stencilOpFront",2965:"stencilOpFront",2966:"stencilOpFront",34817:"stencilOpBack",34818:"stencilOpBack",34819:"stencilOpBack",2978:(t,e)=>t.viewport(...e),3333:Wx,3317:Wx,37440:Wx,37441:Wx,37443:Wx,3330:Wx,3332:Wx,3331:Wx,36010:(t,e)=>t.bindFramebuffer(36008,e),3314:Wx,32878:Wx,3316:Wx,3315:Wx,32877:Wx,framebuffer:(t,e)=>{const n=e&&"handle"in e?e.handle:e;return t.bindFramebuffer(36160,n)},blend:(t,e)=>e?t.enable(3042):t.disable(3042),blendColor:(t,e)=>t.blendColor(...e),blendEquation:(t,e)=>{e=Hx(e)?e:[e,e],t.blendEquationSeparate(...e)},blendFunc:(t,e)=>{e=Hx(e)&&2===e.length?[...e,...e]:e,t.blendFuncSeparate(...e)},clearColor:(t,e)=>t.clearColor(...e),clearDepth:(t,e)=>t.clearDepth(e),clearStencil:(t,e)=>t.clearStencil(e),colorMask:(t,e)=>t.colorMask(...e),cull:(t,e)=>e?t.enable(2884):t.disable(2884),cullFace:(t,e)=>t.cullFace(e),depthTest:(t,e)=>e?t.enable(2929):t.disable(2929),depthFunc:(t,e)=>t.depthFunc(e),depthMask:(t,e)=>t.depthMask(e),depthRange:(t,e)=>t.depthRange(...e),dither:(t,e)=>e?t.enable(3024):t.disable(3024),derivativeHint:(t,e)=>{t.hint(35723,e)},frontFace:(t,e)=>t.frontFace(e),mipmapHint:(t,e)=>t.hint(33170,e),lineWidth:(t,e)=>t.lineWidth(e),polygonOffsetFill:(t,e)=>e?t.enable(32823):t.disable(32823),polygonOffset:(t,e)=>t.polygonOffset(...e),sampleCoverage:(t,e)=>t.sampleCoverage(...e),scissorTest:(t,e)=>e?t.enable(3089):t.disable(3089),scissor:(t,e)=>t.scissor(...e),stencilTest:(t,e)=>e?t.enable(2960):t.disable(2960),stencilMask:(t,e)=>{e=Hx(e)?e:[e,e];const[n,r]=e;t.stencilMaskSeparate(1028,n),t.stencilMaskSeparate(1029,r)},stencilFunc:(t,e)=>{e=Hx(e)&&3===e.length?[...e,...e]:e;const[n,r,i,o,s,a]=e;t.stencilFuncSeparate(1028,n,r,i),t.stencilFuncSeparate(1029,o,s,a)},stencilOp:(t,e)=>{e=Hx(e)&&3===e.length?[...e,...e]:e;const[n,r,i,o,s,a]=e;t.stencilOpSeparate(1028,n,r,i),t.stencilOpSeparate(1029,o,s,a)},viewport:(t,e)=>t.viewport(...e)};function Kx(t,e,n){return void 0!==e[t]?e[t]:n[t]}const Xx={blendEquation:(t,e,n)=>t.blendEquationSeparate(Kx(32777,e,n),Kx(34877,e,n)),blendFunc:(t,e,n)=>t.blendFuncSeparate(Kx(32969,e,n),Kx(32968,e,n),Kx(32971,e,n),Kx(32970,e,n)),polygonOffset:(t,e,n)=>t.polygonOffset(Kx(32824,e,n),Kx(10752,e,n)),sampleCoverage:(t,e,n)=>t.sampleCoverage(Kx(32938,e,n),Kx(32939,e,n)),stencilFuncFront:(t,e,n)=>t.stencilFuncSeparate(1028,Kx(2962,e,n),Kx(2967,e,n),Kx(2963,e,n)),stencilFuncBack:(t,e,n)=>t.stencilFuncSeparate(1029,Kx(34816,e,n),Kx(36003,e,n),Kx(36004,e,n)),stencilOpFront:(t,e,n)=>t.stencilOpSeparate(1028,Kx(2964,e,n),Kx(2965,e,n),Kx(2966,e,n)),stencilOpBack:(t,e,n)=>t.stencilOpSeparate(1029,Kx(34817,e,n),Kx(34818,e,n),Kx(34819,e,n))},qx={enable:(t,e)=>t({[e]:!0}),disable:(t,e)=>t({[e]:!1}),pixelStorei:(t,e,n)=>t({[e]:n}),hint:(t,e,n)=>t({[e]:n}),bindFramebuffer:(t,e,n)=>{switch(e){case 36160:return t({36006:n,36010:n});case 36009:return t({36006:n});case 36008:return t({36010:n});default:return null}},blendColor:(t,e,n,r,i)=>t({32773:new Float32Array([e,n,r,i])}),blendEquation:(t,e)=>t({32777:e,34877:e}),blendEquationSeparate:(t,e,n)=>t({32777:e,34877:n}),blendFunc:(t,e,n)=>t({32969:e,32968:n,32971:e,32970:n}),blendFuncSeparate:(t,e,n,r,i)=>t({32969:e,32968:n,32971:r,32970:i}),clearColor:(t,e,n,r,i)=>t({3106:new Float32Array([e,n,r,i])}),clearDepth:(t,e)=>t({2931:e}),clearStencil:(t,e)=>t({2961:e}),colorMask:(t,e,n,r,i)=>t({3107:[e,n,r,i]}),cullFace:(t,e)=>t({2885:e}),depthFunc:(t,e)=>t({2932:e}),depthRange:(t,e,n)=>t({2928:new Float32Array([e,n])}),depthMask:(t,e)=>t({2930:e}),frontFace:(t,e)=>t({2886:e}),lineWidth:(t,e)=>t({2849:e}),polygonOffset:(t,e,n)=>t({32824:e,10752:n}),sampleCoverage:(t,e,n)=>t({32938:e,32939:n}),scissor:(t,e,n,r,i)=>t({3088:new Int32Array([e,n,r,i])}),stencilMask:(t,e)=>t({2968:e,36005:e}),stencilMaskSeparate:(t,e,n)=>t({[1028===e?2968:36005]:n}),stencilFunc:(t,e,n,r)=>t({2962:e,2967:n,2963:r,34816:e,36003:n,36004:r}),stencilFuncSeparate:(t,e,n,r,i)=>t({[1028===e?2962:34816]:n,[1028===e?2967:36003]:r,[1028===e?2963:36004]:i}),stencilOp:(t,e,n,r)=>t({2964:e,2965:n,2966:r,34817:e,34818:n,34819:r}),stencilOpSeparate:(t,e,n,r,i)=>t({[1028===e?2964:34817]:n,[1028===e?2965:34818]:r,[1028===e?2966:34819]:i}),viewport:(t,e,n,r,i)=>t({2978:[e,n,r,i]})},Yx=(t,e)=>t.isEnabled(e),Qx={3042:Yx,2884:Yx,2929:Yx,3024:Yx,32823:Yx,32926:Yx,32928:Yx,3089:Yx,2960:Yx,35977:Yx};function Zx(t){for(const e in t)return!1;return!0}function $x(t,e){if(t===e)return!0;const n=Array.isArray(t)||ArrayBuffer.isView(t),r=Array.isArray(e)||ArrayBuffer.isView(e);if(n&&r&&t.length===e.length){for(let n=0;n{})}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.gl=t,this.program=null,this.stateStack=[],this.enable=!0,this.cache=e?sA(t):Object.assign({},Ux),this.log=n,this._updateCache=this._updateCache.bind(this),Object.seal(this)}push(){this.stateStack.push({})}pop(){fx(this.stateStack.length>0);const t=this.stateStack[this.stateStack.length-1];oA(this.gl,t),this.stateStack.pop()}_updateCache(t){let e,n=!1;const r=this.stateStack.length>0&&this.stateStack[this.stateStack.length-1];for(const i in t){fx(void 0!==i);const o=t[i],s=this.cache[i];$x(o,s)||(n=!0,e=s,r&&!(i in r)&&(r[i]=s),this.cache[i]=o)}return{valueChanged:n,oldValue:e}}}function rA(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{enable:n=!0,copyState:r}=e;if(fx(void 0!==r),!t.state){const{polyfillContext:e}=globalThis;e&&e(t),t.state=new nA(t,{copyState:r}),function(t){const e=t.useProgram.bind(t);t.useProgram=function(n){t.state.program!==n&&(e(n),t.state.program=n)}}(t);for(const n in qx){eA(t,n,qx[n])}tA(t,"getParameter"),tA(t,"isEnabled")}return t.state.enable=n,t}function iA(t){fx(t.state),t.state.pop()}function oA(t,e){if(fx(mx(t),"setParameters requires a WebGL context"),Zx(e))return;const n={};for(const i in e){const r=Number(i),o=Jx[i];o&&("string"===typeof o?n[o]=!0:o(t,e[i],r))}const r=t.state&&t.state.cache;if(r)for(const i in n){(0,Xx[i])(t,e,r)}}function sA(t,e){if("number"===typeof(e=e||Ux)){const n=e,r=Qx[n];return r?r(t,n):t.getParameter(n)}const n=Array.isArray(e)?e:Object.keys(e),r={};for(const i of n){const e=Qx[i];r[i]=e?e(t,Number(i)):t.getParameter(Number(i))}return r}function aA(t,e,n){if(Zx(e))return n(t);const{nocatch:r=!0}=e;let i;if(function(t){t.state||rA(t,{copyState:!1}),t.state.push()}(t),oA(t,e),r)i=n(t),iA(t);else try{i=n(t)}finally{iA(t)}return i}function lA(t){const{luma:e}=t;if(t.canvas&&e){const n=e.canvasSizeInfo,r="clientWidth"in n?n.clientWidth:t.canvas.clientWidth;return r?t.drawingBufferWidth/r:1}return 1}function cA(t,e){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return function(t,e,n,r,i){const o=uA(t[0],e,n);let s=dA(t[1],e,r,i),a=uA(t[0]+1,e,n);const l=a===n-1?a:a-1;let c;a=dA(t[1]+1,e,r,i),i?(a=0===a?a:a+1,c=s,s=a):c=a===r-1?a:a-1;return{x:o,y:s,width:Math.max(l-o+1,1),height:Math.max(c-s+1,1)}}(e,lA(t),t.drawingBufferWidth,t.drawingBufferHeight,n)}function uA(t,e,n){return Math.min(Math.round(t*e),n-1)}function dA(t,e,n,r){return r?Math.max(0,n-1-Math.round(t*e)):Math.min(Math.round(t*e),n-1)}const hA=hg(),fA=hA&&"undefined"!==typeof document,pA={webgl2:!0,webgl1:!0,throwOnError:!0,manageState:!0,canvas:null,debug:!1,width:800,height:600};function gA(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};fx(hA,"createGLContext only available in the browser.\nCreate your own headless context or use 'createHeadlessContext' from @luma.gl/test-utils"),t=Object.assign({},pA,t);const{width:e,height:n}=t;function r(e){if(t.throwOnError)throw new Error(e);return console.error(e),null}let i;t.onError=r;const{canvas:o}=t,s=function(t){let e,{canvas:n,width:r=800,height:i=600,onError:o}=t;if("string"===typeof n){fA&&"complete"===document.readyState||o("createGLContext called on canvas '".concat(n,"' before page was loaded")),e=document.getElementById(n)}else n?e=n:(e=document.createElement("canvas"),e.id="lumagl-canvas",e.style.width=Number.isFinite(r)?"".concat(r,"px"):"100%",e.style.height=Number.isFinite(i)?"".concat(i,"px"):"100%",document.body.insertBefore(e,document.body.firstChild));return e}({canvas:o,width:e,height:n,onError:r});return i=function(t,e){const{onError:n}=e;let r=null;const i=t=>r=t.statusMessage||r;t.addEventListener("webglcontextcreationerror",i,!1);const{webgl1:o=!0,webgl2:s=!0}=e;let a=null;s&&(a=a||t.getContext("webgl2",e),a=a||t.getContext("experimental-webgl2",e));o&&(a=a||t.getContext("webgl",e),a=a||t.getContext("experimental-webgl",e));if(t.removeEventListener("webglcontextcreationerror",i,!1),!a)return n("Failed to create ".concat(s&&!o?"WebGL2":"WebGL"," context: ").concat(r||"Unknown error"));e.onContextLost&&t.addEventListener("webglcontextlost",e.onContextLost,!1);e.onContextRestored&&t.addEventListener("webglcontextrestored",e.onContextRestored,!1);return a}(s,t),i?(i=mA(i,t),function(t){const e=vx(t)?"WebGL2":"WebGL1",n=function(t){const e=t.getParameter(7936),n=t.getParameter(7937),r=t.getExtension("WEBGL_debug_renderer_info"),i=r&&t.getParameter(r.UNMASKED_VENDOR_WEBGL||7936),o=r&&t.getParameter(r.UNMASKED_RENDERER_WEBGL||7937);return{vendor:i||e,renderer:o||n,vendorMasked:e,rendererMasked:n,version:t.getParameter(7938),shadingLanguageVersion:t.getParameter(35724)}}(t),r=n?"(".concat(n.vendor,",").concat(n.renderer,")"):"",i=t.debug?" debug":"";hx.info(1,"".concat(e).concat(i," context ").concat(r))()}(i),i):null}function mA(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!t||t._instrumented)return t;t._version=t._version||function(t){if("undefined"!==typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext)return 2;return 1}(t),t.luma=t.luma||{},t.luma.canvasSizeInfo=t.luma.canvasSizeInfo||{},e=Object.assign({},pA,e);const{manageState:n,debug:r}=e;return n&&rA(t,{copyState:!1,log:function(){for(var t=arguments.length,e=new Array(t),n=0;n1&&void 0!==arguments[1]?arguments[1]:{};if(t.canvas){return void function(t,e,n){let r="width"in n?n.width:t.canvas.clientWidth,i="height"in n?n.height:t.canvas.clientHeight;r&&i||(hx.log(1,"Canvas clientWidth/clientHeight is 0")(),e=1,r=t.canvas.width||1,i=t.canvas.height||1);t.luma=t.luma||{},t.luma.canvasSizeInfo=t.luma.canvasSizeInfo||{};const o=t.luma.canvasSizeInfo;if(o.clientWidth!==r||o.clientHeight!==i||o.devicePixelRatio!==e){let n=e;const o=Math.floor(r*n),s=Math.floor(i*n);t.canvas.width=o,t.canvas.height=s,t.drawingBufferWidth===o&&t.drawingBufferHeight===s||(hx.warn("Device pixel ratio clamped")(),n=Math.min(t.drawingBufferWidth/r,t.drawingBufferHeight/i),t.canvas.width=Math.floor(r*n),t.canvas.height=Math.floor(i*n)),Object.assign(t.luma.canvasSizeInfo,{clientWidth:r,clientHeight:i,devicePixelRatio:e})}}(t,function(t){const e="undefined"===typeof window?1:window.devicePixelRatio||1;return Number.isFinite(t)?t<=0?1:t:t?e:1}(e.useDevicePixels),e)}const n=t.getExtension("STACKGL_resize_drawingbuffer");n&&"width"in e&&"height"in e&&n.resize(e.width,e.height)}const bA="8.5.21";const yA=new class{constructor(){this.stats=new Map}get(t){return this.stats.has(t)||this.stats.set(t,new Ug({id:t})),this.stats.get(t)}};if(globalThis.luma&&globalThis.luma.VERSION!==bA)throw new Error("luma.gl - multiple VERSIONs detected: ".concat(globalThis.luma.VERSION," vs ").concat(bA));globalThis.luma||(hg()&&hx.log(1,"luma.gl ".concat(bA," - ").concat("set luma.log.level=1 (or higher) to trace rendering"))(),globalThis.luma=globalThis.luma||{VERSION:bA,version:bA,log:hx,stats:yA,globals:{modules:{},nodeIO:{}}});globalThis.luma;function xA(t,e){if(!t)throw new Error(e||"luma.gl: assertion failed.")}function AA(t,e){if("string"!==typeof e)return e;const n=Number(e);if(!isNaN(n))return n;const r=t[e=e.replace(/^.*\./,"")];return xA(void 0!==r,"Accessing undefined constant GL.".concat(e)),r}function _A(t,e){e=Number(e);for(const n in t)if(t[n]===e)return"GL.".concat(n);return String(e)}const wA={};function SA(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"id";wA[t]=wA[t]||1;const e=wA[t]++;return"".concat(t,"-").concat(e)}function CA(t){return xA("number"===typeof t,"Input must be a number"),t&&0===(t&t-1)}function EA(t){let e=!0;for(const n in t){e=!1;break}return e}function PA(t,e,n,r){const i="See luma.gl ".concat(n," Upgrade Guide at https://luma.gl/docs/upgrade-guide"),o=Object.getPrototypeOf(t);r.forEach((t=>{o.methodName||(o[t]=()=>{throw hx.removed("Calling removed method ".concat(e,".").concat(t,": "),i)(),new Error(t)})}))}const MA="Resource subclass must define virtual methods";class TA{get[Symbol.toStringTag](){return"Resource"}constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};bx(t);const{id:n,userData:r={}}=e;this.gl=t,this.gl2=t,this.id=n||SA(this[Symbol.toStringTag]),this.userData=r,this._bound=!1,this._handle=e.handle,void 0===this._handle&&(this._handle=this._createHandle()),this.byteLength=0,this._addStats()}toString(){return"".concat(this[Symbol.toStringTag]||this.constructor.name,"(").concat(this.id,")")}get handle(){return this._handle}delete(){let{deleteChildren:t=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e=this._handle&&this._deleteHandle(this._handle);return this._handle&&this._removeStats(),this._handle=null,e&&t&&e.filter(Boolean).forEach((t=>t.delete())),this}bind(){let t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.handle;return"function"!==typeof e?(this._bindHandle(e),this):(this._bound?t=e():(this._bindHandle(this.handle),this._bound=!0,t=e(),this._bound=!1,this._bindHandle(null)),t)}unbind(){this.bind(null)}getParameter(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};xA(t=AA(this.gl,t));const n=(this.constructor.PARAMETERS||{})[t];if(n){const t=vx(this.gl);if(!((!("webgl2"in n)||t)&&(!("extension"in n)||this.gl.getExtension(n.extension)))){const e=n.webgl1,r="webgl2"in n?n.webgl2:n.webgl1;return t?r:e}}return this._getParameter(t,e)}getParameters(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{parameters:e,keys:n}=t,r=this.constructor.PARAMETERS||{},i=vx(this.gl),o={},s=e||Object.keys(r);for(const a of s){const e=r[a];if(e&&(!("webgl2"in e)||i)&&(!("extension"in e)||this.gl.getExtension(e.extension))){const r=n?_A(this.gl,a):a;o[r]=this.getParameter(a,t),n&&"GLenum"===e.type&&(o[r]=_A(this.gl,o[r]))}}return o}setParameter(t,e){xA(t=AA(this.gl,t));const n=(this.constructor.PARAMETERS||{})[t];if(n){const t=vx(this.gl);if(!((!("webgl2"in n)||t)&&(!("extension"in n)||this.gl.getExtension(n.extension))))throw new Error("Parameter not available on this platform");"GLenum"===n.type&&(e=AA(e))}return this._setParameter(t,e),this}setParameters(t){for(const e in t)this.setParameter(e,t[e]);return this}stubRemovedMethods(t,e,n){return PA(this,t,e,n)}initialize(t){}_createHandle(){throw new Error(MA)}_deleteHandle(){throw new Error(MA)}_bindHandle(t){throw new Error(MA)}_getOptsFromHandle(){throw new Error(MA)}_getParameter(t,e){throw new Error(MA)}_setParameter(t,e){throw new Error(MA)}_context(){return this.gl.luma=this.gl.luma||{},this.gl.luma}_addStats(){const t=this[Symbol.toStringTag],e=yA.get("Resource Counts");e.get("Resources Created").incrementCount(),e.get("".concat(t,"s Created")).incrementCount(),e.get("".concat(t,"s Active")).incrementCount()}_removeStats(){const t=this[Symbol.toStringTag];yA.get("Resource Counts").get("".concat(t,"s Active")).decrementCount()}_trackAllocatedMemory(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this[Symbol.toStringTag];this._trackAllocatedMemoryForContext(t,e),this._trackAllocatedMemoryForContext(t,e,this.gl.canvas&&this.gl.canvas.id),this.byteLength=t}_trackAllocatedMemoryForContext(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this[Symbol.toStringTag],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";const r=yA.get("Memory Usage".concat(n));r.get("GPU Memory").addCount(t),r.get("".concat(e," Memory")).addCount(t)}_trackDeallocatedMemory(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this[Symbol.toStringTag];this._trackDeallocatedMemoryForContext(t),this._trackDeallocatedMemoryForContext(t,this.gl.canvas&&this.gl.canvas.id),this.byteLength=0}_trackDeallocatedMemoryForContext(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this[Symbol.toStringTag],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";const n=yA.get("Memory Usage".concat(e));n.get("GPU Memory").subtractCount(this.byteLength),n.get("".concat(t," Memory")).subtractCount(this.byteLength)}}const OA="Failed to deduce GL constant from typed array";function kA(t){switch(ArrayBuffer.isView(t)?t.constructor:t){case Float32Array:return 5126;case Uint16Array:return 5123;case Uint32Array:return 5125;case Uint8Array:case Uint8ClampedArray:return 5121;case Int8Array:return 5120;case Int16Array:return 5122;case Int32Array:return 5124;default:throw new Error(OA)}}function RA(t){let{clamped:e=!0}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};switch(t){case 5126:return Float32Array;case 5123:case 33635:case 32819:case 32820:return Uint16Array;case 5125:return Uint32Array;case 5121:return e?Uint8ClampedArray:Uint8Array;case 5120:return Int8Array;case 5122:return Int16Array;case 5124:return Int32Array;default:throw new Error("Failed to deduce typed array type from GL constant")}}function IA(t){let{data:e,width:n,height:r}=t;const i=Math.round(n/2),o=Math.round(r/2),s=new Uint8Array(i*o*4);for(let a=0;athis._assign(t))),Object.freeze(this)}toString(){return JSON.stringify(this)}get BYTES_PER_ELEMENT(){return FA.getBytesPerElement(this)}get BYTES_PER_VERTEX(){return FA.getBytesPerVertex(this)}_assign(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t=BA("Accessor",t,DA),void 0!==t.type&&(this.type=t.type,5124!==t.type&&5125!==t.type||(this.integer=!0)),void 0!==t.size&&(this.size=t.size),void 0!==t.offset&&(this.offset=t.offset),void 0!==t.stride&&(this.stride=t.stride),void 0!==t.normalized&&(this.normalized=t.normalized),void 0!==t.integer&&(this.integer=t.integer),void 0!==t.divisor&&(this.divisor=t.divisor),void 0!==t.buffer&&(this.buffer=t.buffer),void 0!==t.index&&("boolean"===typeof t.index?this.index=t.index?1:0:this.index=t.index),void 0!==t.instanced&&(this.divisor=t.instanced?1:0),void 0!==t.isInstanced&&(this.divisor=t.isInstanced?1:0),this}}const NA={offset:"accessor.offset",stride:"accessor.stride",type:"accessor.type",size:"accessor.size",divisor:"accessor.divisor",normalized:"accessor.normalized",integer:"accessor.integer",instanced:"accessor.divisor",isInstanced:"accessor.divisor"},jA={removedProps:{},replacedProps:{bytes:"byteLength"},deprecatedProps:NA},zA={removedProps:NA};class UA extends TA{get[Symbol.toStringTag](){return"Buffer"}constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(t,e),this.stubRemovedMethods("Buffer","v6.0",["layout","setLayout","getIndexedParameter"]),this.target=e.target||(this.gl.webgl2?36662:34962),this.initialize(e),Object.seal(this)}getElementCount(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.accessor;return Math.round(this.byteLength/FA.getBytesPerElement(t))}getVertexCount(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.accessor;return Math.round(this.byteLength/FA.getBytesPerVertex(t))}initialize(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return ArrayBuffer.isView(t)&&(t={data:t}),Number.isFinite(t)&&(t={byteLength:t}),t=BA("Buffer",t,jA),this.usage=t.usage||35044,this.debugData=null,this.setAccessor(Object.assign({},t,t.accessor)),t.data?this._setData(t.data,t.offset,t.byteLength):this._setByteLength(t.byteLength||0),this}setProps(t){return"accessor"in(t=BA("Buffer",t,zA))&&this.setAccessor(t.accessor),this}setAccessor(t){return delete(t=Object.assign({},t)).buffer,this.accessor=new FA(t),this}reallocate(t){return t>this.byteLength?(this._setByteLength(t),!0):(this.bytesUsed=t,!1)}setData(t){return this.initialize(t)}subData(t){ArrayBuffer.isView(t)&&(t={data:t});const{data:e,offset:n=0,srcOffset:r=0}=t,i=t.byteLength||t.length;xA(e);const o=this.gl.webgl2?36663:this.target;return this.gl.bindBuffer(o,this.handle),0!==r||void 0!==i?(yx(this.gl),this.gl.bufferSubData(this.target,n,e,r,i)):this.gl.bufferSubData(o,n,e),this.gl.bindBuffer(o,null),this.debugData=null,this._inferType(e),this}copyData(t){let{sourceBuffer:e,readOffset:n=0,writeOffset:r=0,size:i}=t;const{gl:o}=this;return yx(o),o.bindBuffer(36662,e.handle),o.bindBuffer(36663,this.handle),o.copyBufferSubData(36662,36663,n,r,i),o.bindBuffer(36662,null),o.bindBuffer(36663,null),this.debugData=null,this}getData(){let{dstData:t=null,srcByteOffset:e=0,dstOffset:n=0,length:r=0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};yx(this.gl);const i=RA(this.accessor.type||5126,{clamped:!1}),o=this._getAvailableElementCount(e),s=n;let a,l;t?(l=t.length,a=l-s):(a=Math.min(o,r||o),l=s+a);const c=Math.min(o,a);return r=r||c,xA(r<=c),t=t||new i(l),this.gl.bindBuffer(36662,this.handle),this.gl.getBufferSubData(36662,e,t,n,r),this.gl.bindBuffer(36662,null),t}bind(){let{target:t=this.target,index:e=this.accessor&&this.accessor.index,offset:n=0,size:r}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return 35345===t||35982===t?void 0!==r?this.gl.bindBufferRange(t,e,this.handle,n,r):(xA(0===n),this.gl.bindBufferBase(t,e,this.handle)):this.gl.bindBuffer(t,this.handle),this}unbind(){let{target:t=this.target,index:e=this.accessor&&this.accessor.index}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return 35345===t||35982===t?this.gl.bindBufferBase(t,e,null):this.gl.bindBuffer(t,null),this}getDebugData(){return this.debugData?{data:this.debugData,changed:!1}:(this.debugData=this.getData({length:Math.min(10,this.byteLength)}),{data:this.debugData,changed:!0})}invalidateDebugData(){this.debugData=null}_setData(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.byteLength+e;xA(ArrayBuffer.isView(t)),this._trackDeallocatedMemory();const r=this._getTarget();this.gl.bindBuffer(r,this.handle),this.gl.bufferData(r,n,this.usage),this.gl.bufferSubData(r,e,t),this.gl.bindBuffer(r,null),this.debugData=t.slice(0,10),this.bytesUsed=n,this._trackAllocatedMemory(n);const i=kA(t);return xA(i),this.setAccessor(new FA(this.accessor,{type:i})),this}_setByteLength(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.usage;xA(t>=0),this._trackDeallocatedMemory();let n=t;0===t&&(n=new Float32Array(0));const r=this._getTarget();return this.gl.bindBuffer(r,this.handle),this.gl.bufferData(r,n,e),this.gl.bindBuffer(r,null),this.usage=e,this.debugData=null,this.bytesUsed=t,this._trackAllocatedMemory(t),this}_getTarget(){return this.gl.webgl2?36663:this.target}_getAvailableElementCount(t){const e=t/RA(this.accessor.type||5126,{clamped:!1}).BYTES_PER_ELEMENT;return this.getElementCount()-e}_inferType(t){this.accessor.type||this.setAccessor(new FA(this.accessor,{type:kA(t)}))}_createHandle(){return this.gl.createBuffer()}_deleteHandle(){this.gl.deleteBuffer(this.handle),this._trackDeallocatedMemory()}_getParameter(t){this.gl.bindBuffer(this.target,this.handle);const e=this.gl.getBufferParameter(this.target,t);return this.gl.bindBuffer(this.target,null),e}get type(){return hx.deprecated("Buffer.type","Buffer.accessor.type")(),this.accessor.type}get bytes(){return hx.deprecated("Buffer.bytes","Buffer.byteLength")(),this.byteLength}setByteLength(t){return hx.deprecated("setByteLength","reallocate")(),this.reallocate(t)}updateAccessor(t){return hx.deprecated("updateAccessor(...)","setAccessor(new Accessor(buffer.accessor, ...)")(),this.accessor=new FA(this.accessor,t),this}}const VA={6407:{dataFormat:6407,types:[5121,33635]},6408:{dataFormat:6408,types:[5121,32819,32820]},6406:{dataFormat:6406,types:[5121]},6409:{dataFormat:6409,types:[5121]},6410:{dataFormat:6410,types:[5121]},33326:{dataFormat:6403,types:[5126],gl2:!0},33328:{dataFormat:33319,types:[5126],gl2:!0},34837:{dataFormat:6407,types:[5126],gl2:!0},34836:{dataFormat:6408,types:[5126],gl2:!0}},GA={6403:1,36244:1,33319:2,33320:2,6407:3,36248:3,6408:4,36249:4,6402:1,34041:1,6406:1,6409:1,6410:2},WA={5126:4,5125:4,5124:4,5123:2,5122:2,5131:2,5120:1,5121:1};const HA=[9729,9728],JA=globalThis.WebGLBuffer||function(){};class KA extends TA{get[Symbol.toStringTag](){return"Texture"}static isSupported(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{format:n,linearFiltering:r}=e;let i=!0;return n&&(i=i&&function(t,e){const n=VA[e];if(!n)return!1;if(void 0===n.gl1&&void 0===n.gl2)return!0;const r=vx(t)&&n.gl2||n.gl1;return"string"===typeof r?t.getExtension(r):r}(t,n),i=i&&(!r||function(t,e){const n=VA[e];switch(n&&n.types[0]){case 5126:return t.getExtension("OES_texture_float_linear");case 5131:return t.getExtension("OES_texture_half_float_linear");default:return!0}}(t,n))),i}constructor(t,e){const{id:n=SA("texture"),handle:r,target:i}=e;super(t,{id:n,handle:r}),this.target=i,this.textureUnit=void 0,this.loaded=!1,this.width=void 0,this.height=void 0,this.depth=void 0,this.format=void 0,this.type=void 0,this.dataFormat=void 0,this.border=void 0,this.textureUnit=void 0,this.mipmaps=void 0}toString(){return"Texture(".concat(this.id,",").concat(this.width,"x").concat(this.height,")")}initialize(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.data;if(e instanceof Promise)return e.then((e=>this.initialize(Object.assign({},t,{pixels:e,data:e})))),this;const n="undefined"!==typeof HTMLVideoElement&&e instanceof HTMLVideoElement;if(n&&e.readyStatethis.initialize(t))),this;const{pixels:r=null,format:i=6408,border:o=0,recreate:s=!1,parameters:a={},pixelStore:l={},textureUnit:c}=t;e||(e=r);let{width:u,height:d,dataFormat:h,type:f,compressed:p=!1,mipmaps:g=!0}=t;const{depth:m=0}=t;return({width:u,height:d,compressed:p,dataFormat:h,type:f}=this._deduceParameters({format:i,type:f,dataFormat:h,compressed:p,data:e,width:u,height:d})),this.width=u,this.height=d,this.depth=m,this.format=i,this.type=f,this.dataFormat=h,this.border=o,this.textureUnit=c,Number.isFinite(this.textureUnit)&&(this.gl.activeTexture(33984+this.textureUnit),this.gl.bindTexture(this.target,this.handle)),g&&this._isNPOT()&&(hx.warn("texture: ".concat(this," is Non-Power-Of-Two, disabling mipmaping"))(),g=!1,this._updateForNPOT(a)),this.mipmaps=g,this.setImageData({data:e,width:u,height:d,depth:m,format:i,type:f,dataFormat:h,border:o,mipmaps:g,parameters:l,compressed:p}),g&&this.generateMipmap(),this.setParameters(a),s&&(this.data=e),n&&(this._video={video:e,parameters:a,lastTime:e.readyState>=HTMLVideoElement.HAVE_CURRENT_DATA?e.currentTime:-1}),this}update(){if(this._video){const{video:t,parameters:e,lastTime:n}=this._video;if(n===t.currentTime||t.readyState0&&void 0!==arguments[0]?arguments[0]:{};return this._isNPOT()?(hx.warn("texture: ".concat(this," is Non-Power-Of-Two, disabling mipmaping"))(),this):(this.mipmaps=!0,this.gl.bindTexture(this.target,this.handle),aA(this.gl,t,(()=>{this.gl.generateMipmap(this.target)})),this.gl.bindTexture(this.target,null),this)}setImageData(t){this._trackDeallocatedMemory("Texture");const{target:e=this.target,pixels:n=null,level:r=0,format:i=this.format,border:o=this.border,offset:s=0,parameters:a={}}=t;let{data:l=null,type:c=this.type,width:u=this.width,height:d=this.height,dataFormat:h=this.dataFormat,compressed:f=!1}=t;l||(l=n),({type:c,dataFormat:h,compressed:f,width:u,height:d}=this._deduceParameters({format:i,type:c,dataFormat:h,compressed:f,data:l,width:u,height:d}));const{gl:p}=this;p.bindTexture(this.target,this.handle);let g,m=null;({data:l,dataType:m}=this._getDataType({data:l,compressed:f}));let v=0;if(aA(this.gl,a,(()=>{switch(m){case"null":p.texImage2D(e,r,i,u,d,o,h,c,l);break;case"typed-array":p.texImage2D(e,r,i,u,d,o,h,c,l,s);break;case"buffer":g=yx(p),g.bindBuffer(35052,l.handle||l),g.texImage2D(e,r,i,u,d,o,h,c,s),g.bindBuffer(35052,null);break;case"browser-object":vx(p)?p.texImage2D(e,r,i,u,d,o,h,c,l):p.texImage2D(e,r,i,h,c,l);break;case"compressed":for(const[t,n]of l.entries())p.compressedTexImage2D(e,t,n.format,n.width,n.height,o,n.data),v+=n.levelSize;break;default:xA(!1,"Unknown image data type")}})),"compressed"===m)this._trackAllocatedMemory(v,"Texture");else if(l&&l.byteLength)this._trackAllocatedMemory(l.byteLength,"Texture");else{const t=GA[this.dataFormat]||4,e=WA[this.type]||1;this._trackAllocatedMemory(this.width*this.height*t*e,"Texture")}return this.loaded=!0,this}setSubImageData(t){let{target:e=this.target,pixels:n=null,data:r=null,x:i=0,y:o=0,width:s=this.width,height:a=this.height,level:l=0,format:c=this.format,type:u=this.type,dataFormat:d=this.dataFormat,compressed:h=!1,offset:f=0,border:p=this.border,parameters:g={}}=t;if(({type:u,dataFormat:d,compressed:h,width:s,height:a}=this._deduceParameters({format:c,type:u,dataFormat:d,compressed:h,data:r,width:s,height:a})),xA(0===this.depth,"texSubImage not supported for 3D textures"),r||(r=n),r&&r.data){const t=r;r=t.data,s=t.shape[0],a=t.shape[1]}r instanceof UA&&(r=r.handle),this.gl.bindTexture(this.target,this.handle),aA(this.gl,g,(()=>{if(h)this.gl.compressedTexSubImage2D(e,l,i,o,s,a,c,r);else if(null===r)this.gl.texSubImage2D(e,l,i,o,s,a,d,u,null);else if(ArrayBuffer.isView(r))this.gl.texSubImage2D(e,l,i,o,s,a,d,u,r,f);else if(r instanceof JA){const t=yx(this.gl);t.bindBuffer(35052,r),t.texSubImage2D(e,l,i,o,s,a,d,u,f),t.bindBuffer(35052,null)}else if(vx(this.gl)){yx(this.gl).texSubImage2D(e,l,i,o,s,a,d,u,r)}else this.gl.texSubImage2D(e,l,i,o,d,u,r)})),this.gl.bindTexture(this.target,null)}copyFramebuffer(){return hx.error("Texture.copyFramebuffer({...}) is no logner supported, use copyToTexture(source, target, opts})")(),null}getActiveUnit(){return this.gl.getParameter(34016)-33984}bind(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.textureUnit;const{gl:e}=this;return void 0!==t&&(this.textureUnit=t,e.activeTexture(33984+t)),e.bindTexture(this.target,this.handle),t}unbind(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.textureUnit;const{gl:e}=this;return void 0!==t&&(this.textureUnit=t,e.activeTexture(33984+t)),e.bindTexture(this.target,null),t}_getDataType(t){let{data:e,compressed:n=!1}=t;return n?{data:e,dataType:"compressed"}:null===e?{data:e,dataType:"null"}:ArrayBuffer.isView(e)?{data:e,dataType:"typed-array"}:e instanceof UA?{data:e.handle,dataType:"buffer"}:e instanceof JA?{data:e,dataType:"buffer"}:{data:e,dataType:"browser-object"}}_deduceParameters(t){const{format:e,data:n}=t;let{width:r,height:i,dataFormat:o,type:s,compressed:a}=t;const l=VA[e];return o=o||l&&l.dataFormat,s=s||l&&l.types[0],a=a||l&&l.compressed,({width:r,height:i}=this._deduceImageSize(n,r,i)),{dataFormat:o,type:s,compressed:a,width:r,height:i,format:e,data:n}}_deduceImageSize(t,e,n){let r;return r="undefined"!==typeof ImageData&&t instanceof ImageData?{width:t.width,height:t.height}:"undefined"!==typeof HTMLImageElement&&t instanceof HTMLImageElement?{width:t.naturalWidth,height:t.naturalHeight}:"undefined"!==typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&t instanceof ImageBitmap?{width:t.width,height:t.height}:"undefined"!==typeof HTMLVideoElement&&t instanceof HTMLVideoElement?{width:t.videoWidth,height:t.videoHeight}:t?{width:e,height:n}:{width:e>=0?e:1,height:n>=0?n:1},xA(r,"Could not deduced texture size"),xA(void 0===e||r.width===e,"Deduced texture width does not match supplied width"),xA(void 0===n||r.height===n,"Deduced texture height does not match supplied height"),r}_createHandle(){return this.gl.createTexture()}_deleteHandle(){this.gl.deleteTexture(this.handle),this._trackDeallocatedMemory("Texture")}_getParameter(t){switch(t){case 4096:return this.width;case 4097:return this.height;default:this.gl.bindTexture(this.target,this.handle);const e=this.gl.getTexParameter(this.target,t);return this.gl.bindTexture(this.target,null),e}}_setParameter(t,e){switch(this.gl.bindTexture(this.target,this.handle),e=this._getNPOTParam(t,e),t){case 33082:case 33083:this.gl.texParameterf(this.handle,t,e);break;case 4096:case 4097:xA(!1);break;default:this.gl.texParameteri(this.target,t,e)}return this.gl.bindTexture(this.target,null),this}_isNPOT(){return!vx(this.gl)&&(!(!this.width||!this.height)&&(!CA(this.width)||!CA(this.height)))}_updateForNPOT(t){void 0===t[this.gl.TEXTURE_MIN_FILTER]&&(t[this.gl.TEXTURE_MIN_FILTER]=this.gl.LINEAR),void 0===t[this.gl.TEXTURE_WRAP_S]&&(t[this.gl.TEXTURE_WRAP_S]=this.gl.CLAMP_TO_EDGE),void 0===t[this.gl.TEXTURE_WRAP_T]&&(t[this.gl.TEXTURE_WRAP_T]=this.gl.CLAMP_TO_EDGE)}_getNPOTParam(t,e){if(this._isNPOT())switch(t){case 10241:-1===HA.indexOf(e)&&(e=9729);break;case 10242:case 10243:33071!==e&&(e=33071)}return e}}let XA="";class qA extends KA{get[Symbol.toStringTag](){return"Texture2D"}static isSupported(t,e){return KA.isSupported(t,e)}constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var n,r;bx(t),(e instanceof Promise||"string"===typeof e)&&(e={data:e}),"string"===typeof e.data&&(e=Object.assign({},e,{data:(n=e.data,xA("string"===typeof n),n=XA+n,new Promise(((t,e)=>{try{const i=new Image;i.onload=()=>t(i),i.onerror=()=>e(new Error("Could not load image ".concat(n,"."))),i.crossOrigin=r&&r.crossOrigin||"anonymous",i.src=n}catch(i){e(i)}})))})),super(t,Object.assign({},e,{target:3553})),this.initialize(e),Object.seal(this)}}const YA="EXT_color_buffer_float",QA={33189:{bpp:2},33190:{gl2:!0,bpp:3},36012:{gl2:!0,bpp:4},36168:{bpp:1},34041:{bpp:4},35056:{gl2:!0,bpp:4},36013:{gl2:!0,bpp:5},32854:{bpp:2},36194:{bpp:2},32855:{bpp:2},33321:{gl2:!0,bpp:1},33330:{gl2:!0,bpp:1},33329:{gl2:!0,bpp:1},33332:{gl2:!0,bpp:2},33331:{gl2:!0,bpp:2},33334:{gl2:!0,bpp:4},33333:{gl2:!0,bpp:4},33323:{gl2:!0,bpp:2},33336:{gl2:!0,bpp:2},33335:{gl2:!0,bpp:2},33338:{gl2:!0,bpp:4},33337:{gl2:!0,bpp:4},33340:{gl2:!0,bpp:8},33339:{gl2:!0,bpp:8},32849:{gl2:!0,bpp:3},32856:{gl2:!0,bpp:4},32857:{gl2:!0,bpp:4},36220:{gl2:!0,bpp:4},36238:{gl2:!0,bpp:4},36975:{gl2:!0,bpp:4},36214:{gl2:!0,bpp:8},36232:{gl2:!0,bpp:8},36226:{gl2:!0,bpp:16},36208:{gl2:!0,bpp:16},33325:{gl2:YA,bpp:2},33327:{gl2:YA,bpp:4},34842:{gl2:YA,bpp:8},33326:{gl2:YA,bpp:4},33328:{gl2:YA,bpp:8},34836:{gl2:YA,bpp:16},35898:{gl2:YA,bpp:4}};class ZA extends TA{get[Symbol.toStringTag](){return"Renderbuffer"}static isSupported(t){let{format:e}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{format:null};return!e||function(t,e,n){const r=n[e];if(!r)return!1;const i=vx(t)&&r.gl2||r.gl1;return"string"===typeof i?t.getExtension(i):i}(t,e,QA)}static getSamplesForFormat(t,e){let{format:n}=e;return t.getInternalformatParameter(36161,n,32937)}constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(t,e),this.initialize(e),Object.seal(this)}initialize(t){let{format:e,width:n=1,height:r=1,samples:i=0}=t;return xA(e,"Needs format"),this._trackDeallocatedMemory(),this.gl.bindRenderbuffer(36161,this.handle),0!==i&&vx(this.gl)?this.gl.renderbufferStorageMultisample(36161,i,e,n,r):this.gl.renderbufferStorage(36161,e,n,r),this.format=e,this.width=n,this.height=r,this.samples=i,this._trackAllocatedMemory(this.width*this.height*(this.samples||1)*QA[this.format].bpp),this}resize(t){let{width:e,height:n}=t;return e!==this.width||n!==this.height?this.initialize({width:e,height:n,format:this.format,samples:this.samples}):this}_createHandle(){return this.gl.createRenderbuffer()}_deleteHandle(){this.gl.deleteRenderbuffer(this.handle),this._trackDeallocatedMemory()}_bindHandle(t){this.gl.bindRenderbuffer(36161,t)}_syncHandle(t){this.format=this.getParameter(36164),this.width=this.getParameter(36162),this.height=this.getParameter(36163),this.samples=this.getParameter(36011)}_getParameter(t){this.gl.bindRenderbuffer(36161,this.handle);return this.gl.getRenderbufferParameter(36161,t)}}const $A=6144,t_="clear: bad arguments";function e_(t){let{framebuffer:e=null,color:n=null,depth:r=null,stencil:i=null}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const o={};e&&(o.framebuffer=e);let s=0;n&&(s|=16384,!0!==n&&(o.clearColor=n)),r&&(s|=256,!0!==r&&(o.clearDepth=r)),i&&(s|=1024,!0!==r&&(o.clearStencil=r)),xA(0!==s,t_),aA(t,o,(()=>{t.clear(s)}))}function n_(t){switch(t){case 6406:case 33326:case 6403:return 1;case 33328:case 33319:return 2;case 6407:case 34837:return 3;case 6408:case 34836:return 4;default:return xA(!1),0}}const r_=[34069,34070,34071,34072,34073,34074];class i_ extends KA{get[Symbol.toStringTag](){return"TextureCube"}constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};bx(t),super(t,Object.assign({},e,{target:34067})),this.initialize(e),Object.seal(this)}initialize(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{mipmaps:e=!0,parameters:n={}}=t;return this.opts=t,this.setCubeMapImageData(t).then((()=>{this.loaded=!0,e&&this.generateMipmap(t),this.setParameters(n)})),this}subImage(t){let{face:e,data:n,x:r=0,y:i=0,mipmapLevel:o=0}=t;return this._subImage({target:e,data:n,x:r,y:i,mipmapLevel:o})}async setCubeMapImageData(t){let{width:e,height:n,pixels:r,data:i,border:o=0,format:s=6408,type:a=5121}=t;const{gl:l}=this,c=r||i,u=await Promise.all(r_.map((t=>{const e=c[t];return Promise.all(Array.isArray(e)?e:[e])})));this.bind(),r_.forEach(((t,r)=>{u[r].length>1&&!1!==this.opts.mipmaps&&hx.warn("".concat(this.id," has mipmap and multiple LODs."))(),u[r].forEach(((r,i)=>{e&&n?l.texImage2D(t,i,s,e,n,o,s,a,r):l.texImage2D(t,i,s,s,a,r)}))})),this.unbind()}setImageDataForFace(t){const{face:e,width:n,height:r,pixels:i,data:o,border:s=0,format:a=6408,type:l=5121}=t,{gl:c}=this,u=i||o;return this.bind(),u instanceof Promise?u.then((n=>this.setImageDataForFace(Object.assign({},t,{face:e,data:n,pixels:n})))):this.width||this.height?c.texImage2D(e,0,a,n,r,s,a,l,u):c.texImage2D(e,0,a,a,l,u),this}}i_.FACES=r_;class o_ extends KA{get[Symbol.toStringTag](){return"Texture3D"}static isSupported(t){return vx(t)}constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};yx(t),e=Object.assign({depth:1},e,{target:32879,unpackFlipY:!1}),super(t,e),this.initialize(e),Object.seal(this)}setImageData(t){let{level:e=0,dataFormat:n=6408,width:r,height:i,depth:o=1,border:s=0,format:a,type:l=5121,offset:c=0,data:u,parameters:d={}}=t;if(this._trackDeallocatedMemory("Texture"),this.gl.bindTexture(this.target,this.handle),aA(this.gl,d,(()=>{ArrayBuffer.isView(u)&&this.gl.texImage3D(this.target,e,n,r,i,o,s,a,l,u),u instanceof UA&&(this.gl.bindBuffer(35052,u.handle),this.gl.texImage3D(this.target,e,n,r,i,o,s,a,l,c))})),u&&u.byteLength)this._trackAllocatedMemory(u.byteLength,"Texture");else{const t=GA[this.dataFormat]||4,e=WA[this.type]||1;this._trackAllocatedMemory(this.width*this.height*this.depth*t*e,"Texture")}return this.loaded=!0,this}}function s_(t,e){const{gl:n,width:r,height:i,id:o}=t;return new j_(n,Object.assign({},e,{id:"framebuffer-for-".concat(o),width:r,height:i,attachments:{36064:t}}))}function a_(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{sourceX:n=0,sourceY:r=0,sourceFormat:i=6408}=e;let{sourceAttachment:o=36064,target:s=null,sourceWidth:a,sourceHeight:l,sourceType:c}=e;const{framebuffer:u,deleteFramebuffer:d}=u_(t);xA(u);const{gl:h,handle:f,attachments:p}=u;a=a||u.width,l=l||u.height,36064===o&&null===f&&(o=1028),xA(p[o]),c=c||p[o].type,s=function(t,e,n,r,i){if(t)return t;const o=RA(e=e||5121,{clamped:!1}),s=n_(n);return new o(r*i*s)}(s,c,i,a,l),c=c||kA(s);const g=h.bindFramebuffer(36160,f);return h.readPixels(n,r,a,l,i,c,s),h.bindFramebuffer(36160,g||null),d&&u.delete(),s}function l_(t,e){let{sourceX:n=0,sourceY:r=0,sourceFormat:i=6408,target:o=null,targetByteOffset:s=0,sourceWidth:a,sourceHeight:l,sourceType:c}=e;const{framebuffer:u,deleteFramebuffer:d}=u_(t);xA(u),a=a||u.width,l=l||u.height;const h=yx(u.gl);if(c=c||(o?o.type:5121),!o){const t=n_(i),e=function(t){switch(t){case 5121:return 1;case 33635:case 32819:case 32820:return 2;case 5126:return 4;default:return xA(!1),0}}(c);o=new UA(h,{byteLength:s+a*l*t*e,accessor:{type:c,size:t}})}return o.bind({target:35051}),aA(h,{framebuffer:u},(()=>{h.readPixels(n,r,a,l,i,c,s)})),o.unbind({target:35051}),d&&u.delete(),o}function c_(t){let{sourceAttachment:e=36064,targetMaxHeight:n=Number.MAX_SAFE_INTEGER}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=a_(t,{sourceAttachment:e}),{width:i,height:o}=t;for(;o>n;)({data:r,width:i,height:o}=IA({data:r,width:i,height:o}));!function(t){let{data:e,width:n,height:r,bytesPerPixel:i=4,temp:o}=t;const s=n*i;o=o||new Uint8Array(s);for(let a=0;aF_(t,e)))}function F_(t,e){return t.luma=t.luma||{},t.luma.caps=t.luma.caps||{},void 0===t.luma.caps[e]&&(t.luma.caps[e]=function(t,e){const n=I_[e];let r;xA(n,e);const i=vx(t)&&n[1]||n[0];if("function"===typeof i)r=i(t);else if(Array.isArray(i)){r=!0;for(const e of i)r=r&&Boolean(t.getExtension(e))}else"string"===typeof i?r=Boolean(t.getExtension(i)):"boolean"===typeof i?r=i:xA(!1);return r}(t,e)),t.luma.caps[e]||hx.log(B_,"Feature: ".concat(e," not supported"))(),t.luma.caps[e]}const N_="Multiple render targets not supported";class j_ extends TA{get[Symbol.toStringTag](){return"Framebuffer"}static isSupported(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{colorBufferFloat:n,colorBufferHalfFloat:r}=e;let i=!0;return n&&(i=Boolean(t.getExtension("EXT_color_buffer_float")||t.getExtension("WEBGL_color_buffer_float")||t.getExtension("OES_texture_float"))),r&&(i=i&&Boolean(t.getExtension("EXT_color_buffer_float")||t.getExtension("EXT_color_buffer_half_float"))),i}static getDefaultFramebuffer(t){return t.luma=t.luma||{},t.luma.defaultFramebuffer=t.luma.defaultFramebuffer||new j_(t,{id:"default-framebuffer",handle:null,attachments:{}}),t.luma.defaultFramebuffer}get MAX_COLOR_ATTACHMENTS(){const t=yx(this.gl);return t.getParameter(t.MAX_COLOR_ATTACHMENTS)}get MAX_DRAW_BUFFERS(){const t=yx(this.gl);return t.getParameter(t.MAX_DRAW_BUFFERS)}constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(t,e),this.width=null,this.height=null,this.attachments={},this.readBuffer=36064,this.drawBuffers=[36064],this.ownResources=[],this.initialize(e),Object.seal(this)}get color(){return this.attachments[36064]||null}get texture(){return this.attachments[36064]||null}get depth(){return this.attachments[36096]||this.attachments[33306]||null}get stencil(){return this.attachments[36128]||this.attachments[33306]||null}initialize(t){let{width:e=1,height:n=1,attachments:r=null,color:i=!0,depth:o=!0,stencil:s=!1,check:a=!0,readBuffer:l,drawBuffers:c}=t;if(xA(e>=0&&n>=0,"Width and height need to be integers"),this.width=e,this.height=n,r)for(const u in r){const t=r[u];(Array.isArray(t)?t[0]:t).resize({width:e,height:n})}else r=this._createDefaultAttachments(i,o,s,e,n);this.update({clearAttachments:!0,attachments:r,readBuffer:l,drawBuffers:c}),r&&a&&this.checkStatus()}delete(){for(const t of this.ownResources)t.delete();return super.delete(),this}update(t){let{attachments:e={},readBuffer:n,drawBuffers:r,clearAttachments:i=!1,resizeAttachments:o=!0}=t;this.attach(e,{clearAttachments:i,resizeAttachments:o});const{gl:s}=this,a=s.bindFramebuffer(36160,this.handle);return n&&this._setReadBuffer(n),r&&this._setDrawBuffers(r),s.bindFramebuffer(36160,a||null),this}resize(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{width:e,height:n}=t;if(null===this.handle)return xA(void 0===e&&void 0===n),this.width=this.gl.drawingBufferWidth,this.height=this.gl.drawingBufferHeight,this;void 0===e&&(e=this.gl.drawingBufferWidth),void 0===n&&(n=this.gl.drawingBufferHeight),e!==this.width&&n!==this.height&&hx.log(2,"Resizing framebuffer ".concat(this.id," to ").concat(e,"x").concat(n))();for(const r in this.attachments)this.attachments[r].resize({width:e,height:n});return this.width=e,this.height=n,this}attach(t){let{clearAttachments:e=!1,resizeAttachments:n=!0}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r={};e&&Object.keys(this.attachments).forEach((t=>{r[t]=null})),Object.assign(r,t);const i=this.gl.bindFramebuffer(36160,this.handle);for(const o in r){xA(void 0!==o,"Misspelled framebuffer binding point?");const t=Number(o),e=r[t];let i=e;if(i)if(i instanceof ZA)this._attachRenderbuffer({attachment:t,renderbuffer:i});else if(Array.isArray(e)){const[n,r=0,o=0]=e;i=n,this._attachTexture({attachment:t,texture:n,layer:r,level:o})}else this._attachTexture({attachment:t,texture:i,layer:0,level:0});else this._unattach(t);n&&i&&i.resize({width:this.width,height:this.height})}this.gl.bindFramebuffer(36160,i||null),Object.assign(this.attachments,t),Object.keys(this.attachments).filter((t=>!this.attachments[t])).forEach((t=>{delete this.attachments[t]}))}checkStatus(){const{gl:t}=this,e=this.getStatus();if(36053!==e)throw new Error(function(t){return(j_.STATUS||{})[t]||"Framebuffer error ".concat(t)}(e));return this}getStatus(){const{gl:t}=this,e=t.bindFramebuffer(36160,this.handle),n=t.checkFramebufferStatus(36160);return t.bindFramebuffer(36160,e||null),n}clear(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{color:e,depth:n,stencil:r,drawBuffers:i=[]}=t,o=this.gl.bindFramebuffer(36160,this.handle);return(e||n||r)&&e_(this.gl,{color:e,depth:n,stencil:r}),i.forEach(((t,e)=>{!function(t){let{framebuffer:e=null,buffer:n=$A,drawBuffer:r=0,value:i=[0,0,0,0]}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};yx(t),aA(t,{framebuffer:e},(()=>{switch(n){case $A:switch(i.constructor){case Int32Array:t.clearBufferiv(n,r,i);break;case Uint32Array:t.clearBufferuiv(n,r,i);break;case Float32Array:default:t.clearBufferfv(n,r,i)}break;case 6145:t.clearBufferfv(6145,0,[i]);break;case 6146:t.clearBufferiv(6146,0,[i]);break;case 34041:const[e,o]=i;t.clearBufferfi(34041,0,e,o);break;default:xA(!1,t_)}}))}(this.gl,{drawBuffer:e,value:t})})),this.gl.bindFramebuffer(36160,o||null),this}readPixels(){return hx.error("Framebuffer.readPixels() is no logner supported, use readPixelsToArray(framebuffer)")(),null}readPixelsToBuffer(){return hx.error("Framebuffer.readPixelsToBuffer()is no logner supported, use readPixelsToBuffer(framebuffer)")(),null}copyToDataUrl(){return hx.error("Framebuffer.copyToDataUrl() is no logner supported, use copyToDataUrl(framebuffer)")(),null}copyToImage(){return hx.error("Framebuffer.copyToImage() is no logner supported, use copyToImage(framebuffer)")(),null}copyToTexture(){return hx.error("Framebuffer.copyToTexture({...}) is no logner supported, use copyToTexture(source, target, opts})")(),null}blit(){return hx.error("Framebuffer.blit({...}) is no logner supported, use blit(source, target, opts)")(),null}invalidate(t){let{attachments:e=[],x:n=0,y:r=0,width:i,height:o}=t;const s=yx(this.gl),a=s.bindFramebuffer(36008,this.handle);return 0===n&&0===r&&void 0===i&&void 0===o?s.invalidateFramebuffer(36008,e):s.invalidateFramebuffer(36008,e,n,r,i,o),s.bindFramebuffer(36008,a),this}getAttachmentParameter(t,e,n){let r=this._getAttachmentParameterFallback(e);return null===r&&(this.gl.bindFramebuffer(36160,this.handle),r=this.gl.getFramebufferAttachmentParameter(36160,t,e),this.gl.bindFramebuffer(36160,null)),n&&r>1e3&&(r=_A(this.gl,r)),r}getAttachmentParameters(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:36064,e=arguments.length>1?arguments[1]:void 0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.constructor.ATTACHMENT_PARAMETERS||[];const r={};for(const i of n){r[e?_A(this.gl,i):i]=this.getAttachmentParameter(t,i,e)}return r}getParameters(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Object.keys(this.attachments),n={};for(const r of e){const e=Number(r);n[t?_A(this.gl,e):e]=this.getAttachmentParameters(e,t)}return n}show(){return"undefined"!==typeof window&&window.open(c_(this),"luma-debug-texture"),this}log(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(t>hx.level||"undefined"===typeof window)return this;e=e||"Framebuffer ".concat(this.id);const n=c_(this,{targetMaxHeight:100});return hx.image({logLevel:t,message:e,image:n},e)(),this}bind(){let{target:t=36160}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.gl.bindFramebuffer(t,this.handle),this}unbind(){let{target:t=36160}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.gl.bindFramebuffer(t,null),this}_createDefaultAttachments(t,e,n,r,i){let o=null;return t&&(o=o||{},o[36064]=new qA(this.gl,{id:"".concat(this.id,"-color0"),pixels:null,format:6408,type:5121,width:r,height:i,mipmaps:!1,parameters:{10241:9729,10240:9729,10242:33071,10243:33071}}),this.ownResources.push(o[36064])),e&&n?(o=o||{},o[33306]=new ZA(this.gl,{id:"".concat(this.id,"-depth-stencil"),format:35056,width:r,height:111}),this.ownResources.push(o[33306])):e?(o=o||{},o[36096]=new ZA(this.gl,{id:"".concat(this.id,"-depth"),format:33189,width:r,height:i}),this.ownResources.push(o[36096])):n&&xA(!1),o}_unattach(t){const e=this.attachments[t];e&&(e instanceof ZA?this.gl.framebufferRenderbuffer(36160,t,36161,null):this.gl.framebufferTexture2D(36160,t,3553,null,0),delete this.attachments[t])}_attachRenderbuffer(t){let{attachment:e=36064,renderbuffer:n}=t;const{gl:r}=this;r.framebufferRenderbuffer(36160,e,36161,n.handle),this.attachments[e]=n}_attachTexture(t){let{attachment:e=36064,texture:n,layer:r,level:i}=t;const{gl:o}=this;switch(o.bindTexture(n.target,n.handle),n.target){case 35866:case 32879:yx(o).framebufferTextureLayer(36160,e,n.target,i,r);break;case 34067:const t=function(t){return t<34069?t+34069:t}(r);o.framebufferTexture2D(36160,e,t,n.handle,i);break;case 3553:o.framebufferTexture2D(36160,e,3553,n.handle,i);break;default:xA(!1,"Illegal texture type")}o.bindTexture(n.target,null),this.attachments[e]=n}_setReadBuffer(t){const e=vx(n=this.gl)?n:null;var n;e?e.readBuffer(t):xA(36064===t||1029===t,N_),this.readBuffer=t}_setDrawBuffers(t){const{gl:e}=this,n=yx(e);if(n)n.drawBuffers(t);else{const n=e.getExtension("WEBGL_draw_buffers");n?n.drawBuffersWEBGL(t):xA(1===t.length&&(36064===t[0]||1029===t[0]),N_)}this.drawBuffers=t}_getAttachmentParameterFallback(t){const e=function(t){t.luma=t.luma||{},t.luma.caps=t.luma.caps||{};for(const e in I_)void 0===t.luma.caps[e]&&(t.luma.caps[e]=F_(t,e));return t.luma.caps}(this.gl);switch(t){case 36052:return e.WEBGL2?null:0;case 33298:case 33299:case 33300:case 33301:case 33302:case 33303:return e.WEBGL2?null:8;case 33297:return e.WEBGL2?null:5125;case 33296:return e.WEBGL2||e.EXT_sRGB?null:9729;default:return null}}_createHandle(){return this.gl.createFramebuffer()}_deleteHandle(){this.gl.deleteFramebuffer(this.handle)}_bindHandle(t){return this.gl.bindFramebuffer(36160,t)}}j_.ATTACHMENT_PARAMETERS=[36049,36048,33296,33298,33299,33300,33301,33302,33303];const z_={5126:tw.bind(null,"uniform1fv",J_,1,ew),35664:tw.bind(null,"uniform2fv",J_,2,ew),35665:tw.bind(null,"uniform3fv",J_,3,ew),35666:tw.bind(null,"uniform4fv",J_,4,ew),5124:tw.bind(null,"uniform1iv",K_,1,ew),35667:tw.bind(null,"uniform2iv",K_,2,ew),35668:tw.bind(null,"uniform3iv",K_,3,ew),35669:tw.bind(null,"uniform4iv",K_,4,ew),35670:tw.bind(null,"uniform1iv",K_,1,ew),35671:tw.bind(null,"uniform2iv",K_,2,ew),35672:tw.bind(null,"uniform3iv",K_,3,ew),35673:tw.bind(null,"uniform4iv",K_,4,ew),35674:tw.bind(null,"uniformMatrix2fv",J_,4,nw),35675:tw.bind(null,"uniformMatrix3fv",J_,9,nw),35676:tw.bind(null,"uniformMatrix4fv",J_,16,nw),35678:$_,35680:$_,5125:tw.bind(null,"uniform1uiv",X_,1,ew),36294:tw.bind(null,"uniform2uiv",X_,2,ew),36295:tw.bind(null,"uniform3uiv",X_,3,ew),36296:tw.bind(null,"uniform4uiv",X_,4,ew),35685:tw.bind(null,"uniformMatrix2x3fv",J_,6,nw),35686:tw.bind(null,"uniformMatrix2x4fv",J_,8,nw),35687:tw.bind(null,"uniformMatrix3x2fv",J_,6,nw),35688:tw.bind(null,"uniformMatrix3x4fv",J_,12,nw),35689:tw.bind(null,"uniformMatrix4x2fv",J_,8,nw),35690:tw.bind(null,"uniformMatrix4x3fv",J_,12,nw),35678:$_,35680:$_,35679:$_,35682:$_,36289:$_,36292:$_,36293:$_,36298:$_,36299:$_,36300:$_,36303:$_,36306:$_,36307:$_,36308:$_,36311:$_},U_={},V_={},G_={},W_=[0];function H_(t,e,n,r){1===e&&"boolean"===typeof t&&(t=t?1:0),Number.isFinite(t)&&(W_[0]=t,t=W_);const i=t.length;if(i%e&&hx.warn("Uniform size should be multiples of ".concat(e),t)(),t instanceof n)return t;let o=r[i];o||(o=new n(i),r[i]=o);for(let s=0;s{const i=t!==r;return i&&(e.uniform1i(n,r),t=r),i}}function tw(t,e,n,r){let i=null,o=null;return(s,a,l)=>{const c=e(l,n),u=c.length;let d=!1;if(null===i)i=new Float32Array(u),o=u,d=!0;else{xA(o===u,"Uniform length cannot change.");for(let t=0;t1&&void 0!==arguments[1]?arguments[1]:"unnamed";const n=t.match(/#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/);return n?n[1]:e}const iw=35632,ow=35633;function sw(t,e,n,r){const i=t.split(/\r?\n/),o={},s={},a=r||rw(e)||"(unnamed)",l="".concat(function(t){switch(t){case iw:return"fragment";case ow:return"vertex";default:return"unknown type"}}(n)," shader ").concat(a);for(let u=0;u1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:": ";const r=t.split(/\r?\n/),i=String(r.length+e-1).length;return r.map(((t,r)=>{const o=String(r+e),s=o.length;return lw(o,i-s)+n+t}))}(e);return{shaderName:l,errors:aw(o,c),warnings:aw(s,c)}}function aw(t,e){let n="";for(let r=0;r0&&void 0!==arguments[0]?arguments[0]:this.source;t.startsWith("#version ")||(t="#version 100\n".concat(t)),this.source=t,this.gl.shaderSource(this.handle,this.source),this.gl.compileShader(this.handle);if(!this.getParameter(35713)){const t=this.gl.getShaderInfoLog(this.handle),{shaderName:e,errors:n,warnings:r}=sw(t,this.source,this.shaderType,this.id);throw hx.error("GLSL compilation errors in ".concat(e,"\n").concat(n))(),hx.warn("GLSL compilation warnings in ".concat(e,"\n").concat(r))(),new Error("GLSL compilation errors in ".concat(e))}}_deleteHandle(){this.gl.deleteShader(this.handle)}_getOptsFromHandle(){return{type:this.getParameter(35663),source:this.getSource()}}}class uw extends cw{get[Symbol.toStringTag](){return"VertexShader"}constructor(t,e){"string"===typeof e&&(e={source:e}),super(t,Object.assign({},e,{shaderType:35633}))}_createHandle(){return this.gl.createShader(35633)}}class dw extends cw{get[Symbol.toStringTag](){return"FragmentShader"}constructor(t,e){"string"===typeof e&&(e={source:e}),super(t,Object.assign({},e,{shaderType:35632}))}_createHandle(){return this.gl.createShader(35632)}}const hw=5120,fw=5121,pw=5122,gw=5123,mw=0,vw=1,bw=2,yw=3,xw=4,Aw=5,_w=6,ww=5126,Sw=35664,Cw=35665,Ew=35666,Pw=5124,Mw=35667,Tw=35668,Ow=35669,kw=5125,Rw=36294,Iw=36295,Bw=36296,Lw=35670,Dw=35671,Fw=35672,Nw=35673,jw=35674,zw=35675,Uw=35676,Vw=35685,Gw=35686,Ww=35687,Hw=35688,Jw=35689,Kw=35690,Xw={[ww]:[ww,1,"float"],[Sw]:[ww,2,"vec2"],[Cw]:[ww,3,"vec3"],[Ew]:[ww,4,"vec4"],[Pw]:[Pw,1,"int"],[Mw]:[Pw,2,"ivec2"],[Tw]:[Pw,3,"ivec3"],[Ow]:[Pw,4,"ivec4"],[kw]:[kw,1,"uint"],[Rw]:[kw,2,"uvec2"],[Iw]:[kw,3,"uvec3"],[Bw]:[kw,4,"uvec4"],[Lw]:[ww,1,"bool"],[Dw]:[ww,2,"bvec2"],[Fw]:[ww,3,"bvec3"],[Nw]:[ww,4,"bvec4"],[jw]:[ww,8,"mat2"],[Vw]:[ww,8,"mat2x3"],[Gw]:[ww,8,"mat2x4"],[zw]:[ww,12,"mat3"],[Ww]:[ww,12,"mat3x2"],[Hw]:[ww,12,"mat3x4"],[Uw]:[ww,16,"mat4"],[Jw]:[ww,16,"mat4x2"],[Kw]:[ww,16,"mat4x3"]};function qw(t){switch(t){case mw:return mw;case vw:case yw:case bw:return vw;case xw:case Aw:case _w:return xw;default:return xA(!1),0}}function Yw(t){const e=Xw[t];if(!e)return null;const[n,r]=e;return{type:n,components:r}}function Qw(t,e){switch(t){case hw:case fw:case pw:case gw:t=ww}for(const n in Xw){const[r,i,o]=Xw[n];if(r===t&&i===e)return{glType:n,name:o}}return null}class Zw{constructor(t){this.id=t.id,this.attributeInfos=[],this.attributeInfosByName={},this.attributeInfosByLocation=[],this.varyingInfos=[],this.varyingInfosByName={},Object.seal(this),this._readAttributesFromProgram(t),this._readVaryingsFromProgram(t)}getAttributeInfo(t){const e=Number(t);return Number.isFinite(e)?this.attributeInfosByLocation[e]:this.attributeInfosByName[t]||null}getAttributeLocation(t){const e=this.getAttributeInfo(t);return e?e.location:-1}getAttributeAccessor(t){const e=this.getAttributeInfo(t);return e?e.accessor:null}getVaryingInfo(t){const e=Number(t);return Number.isFinite(e)?this.varyingInfos[e]:this.varyingInfosByName[t]||null}getVaryingIndex(t){const e=this.getVaryingInfo();return e?e.location:-1}getVaryingAccessor(t){const e=this.getVaryingInfo();return e?e.accessor:null}_readAttributesFromProgram(t){const{gl:e}=t,n=e.getProgramParameter(t.handle,35721);for(let r=0;r=0&&this._addAttribute(s,n,i,o)}this.attributeInfos.sort(((t,e)=>t.location-e.location))}_readVaryingsFromProgram(t){const{gl:e}=t;if(!vx(e))return;const n=e.getProgramParameter(t.handle,35971);for(let r=0;rt.location-e.location))}_addAttribute(t,e,n,r){const{type:i,components:o}=Yw(n),s={type:i,size:r*o};this._inferProperties(t,e,s);const a={location:t,name:e,accessor:new FA(s)};this.attributeInfos.push(a),this.attributeInfosByLocation[t]=a,this.attributeInfosByName[a.name]=a}_inferProperties(t,e,n){/instance/i.test(e)&&(n.divisor=1)}_addVarying(t,e,n,r){const{type:i,components:o}=Yw(n),s={location:t,name:e,accessor:new FA({type:i,size:r*o})};this.varyingInfos.push(s),this.varyingInfosByName[s.name]=s}}const $w=35981,tS=["setVertexArray","setAttributes","setBuffers","unsetBuffers","use","getUniformCount","getUniformInfo","getUniformLocation","getUniformValue","getVarying","getFragDataLocation","getAttachedShaders","getAttributeCount","getAttributeLocation","getAttributeInfo"];class eS extends TA{get[Symbol.toStringTag](){return"Program"}constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(t,e),this.stubRemovedMethods("Program","v6.0",tS),this._isCached=!1,this.initialize(e),Object.seal(this),this._setId(e.id)}initialize(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{hash:e,vs:n,fs:r,varyings:i,bufferMode:o=$w}=t;return this.hash=e||"",this.vs="string"===typeof n?new uw(this.gl,{id:"".concat(t.id,"-vs"),source:n}):n,this.fs="string"===typeof r?new dw(this.gl,{id:"".concat(t.id,"-fs"),source:r}):r,xA(this.vs instanceof uw),xA(this.fs instanceof dw),this.uniforms={},this._textureUniforms={},i&&i.length>0&&(yx(this.gl),this.varyings=i,this.gl2.transformFeedbackVaryings(this.handle,i,o)),this._compileAndLink(),this._readUniformLocationsFromLinkedProgram(),this.configuration=new Zw(this),this.setProps(t)}delete(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this._isCached?this:super.delete(t)}setProps(t){return"uniforms"in t&&this.setUniforms(t.uniforms),this}draw(t){let{logPriority:e,drawMode:n=4,vertexCount:r,offset:i=0,start:o,end:s,isIndexed:a=!1,indexType:l=5123,instanceCount:c=0,isInstanced:u=c>0,vertexArray:d=null,transformFeedback:h,framebuffer:f,parameters:p={},uniforms:g,samplers:m}=t;if((g||m)&&(hx.deprecated("Program.draw({uniforms})","Program.setUniforms(uniforms)")(),this.setUniforms(g||{})),hx.priority>=e){const t=f?f.id:"default",i="mode=".concat(_A(this.gl,n)," verts=").concat(r," ")+"instances=".concat(c," indexType=").concat(_A(this.gl,l)," ")+"isInstanced=".concat(u," isIndexed=").concat(a," ")+"Framebuffer=".concat(t);hx.log(e,i)()}return xA(d),this.gl.useProgram(this.handle),!(!this._areTexturesRenderable()||0===r||u&&0===c)&&(d.bindForDraw(r,c,(()=>{if(void 0!==f&&(p=Object.assign({},p,{framebuffer:f})),h){const t=qw(n);h.begin(t)}this._bindTextures(),aA(this.gl,p,(()=>{a&&u?this.gl2.drawElementsInstanced(n,r,l,i,c):a&&vx(this.gl)&&!isNaN(o)&&!isNaN(s)?this.gl2.drawRangeElements(n,o,s,r,l,i):a?this.gl.drawElements(n,r,l,i):u?this.gl2.drawArraysInstanced(n,i,r,c):this.gl.drawArrays(n,i,r)})),h&&h.end()})),!0)}setUniforms(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};hx.priority>=2&&function(t,e,n){for(const r in t){const i=t[r];if((!n||Boolean(n[r]))&&!Q_(i))throw e=e?"".concat(e," "):"",console.error("".concat(e," Bad uniform ").concat(r),i),new Error("".concat(e," Bad uniform ").concat(r))}}(t,this.id,this._uniformSetters),this.gl.useProgram(this.handle);for(const e in t){const n=t[e],r=this._uniformSetters[e];if(r){let t=n,i=!1;if(t instanceof j_&&(t=t.texture),t instanceof KA)if(i=this.uniforms[e]!==n,i){void 0===r.textureIndex&&(r.textureIndex=this._textureIndexCounter++);const n=t,{textureIndex:i}=r;n.bind(i),t=i,this._textureUniforms[e]=n}else t=r.textureIndex;else this._textureUniforms[e]&&delete this._textureUniforms[e];(r(t)||i)&&Z_(this.uniforms,e,n)}}return this}_areTexturesRenderable(){let t=!0;for(const e in this._textureUniforms){const n=this._textureUniforms[e];n.update(),t=t&&n.loaded}return t}_bindTextures(){for(const t in this._textureUniforms){const e=this._uniformSetters[t].textureIndex;this._textureUniforms[t].bind(e)}}_createHandle(){return this.gl.createProgram()}_deleteHandle(){this.gl.deleteProgram(this.handle)}_getOptionsFromHandle(t){const e=this.gl.getAttachedShaders(t),n={};for(const r of e){switch(this.gl.getShaderParameter(this.handle,35663)){case 35633:n.vs=new uw({handle:r});break;case 35632:n.fs=new dw({handle:r})}}return n}_getParameter(t){return this.gl.getProgramParameter(this.handle,t)}_setId(t){if(!t){const t=this._getName();this.id=SA(t)}}_getName(){let t=this.vs.getName()||this.fs.getName();return t=t.replace(/shader/i,""),t=t?"".concat(t,"-program"):"program",t}_compileAndLink(){const{gl:t}=this;if(t.attachShader(this.handle,this.vs.handle),t.attachShader(this.handle,this.fs.handle),hx.time(4,"linkProgram for ".concat(this._getName()))(),t.linkProgram(this.handle),hx.timeEnd(4,"linkProgram for ".concat(this._getName()))(),t.debug||hx.level>0){if(!t.getProgramParameter(this.handle,35714))throw new Error("Error linking: ".concat(t.getProgramInfoLog(this.handle)));t.validateProgram(this.handle);if(!t.getProgramParameter(this.handle,35715))throw new Error("Error validating: ".concat(t.getProgramInfoLog(this.handle)))}}_readUniformLocationsFromLinkedProgram(){const{gl:t}=this;this._uniformSetters={},this._uniformCount=this._getParameter(35718);for(let e=0;e1)for(let e=0;ee.name===t.name))||this._defaultModules.push(t),this.stateHash++}removeDefaultModule(t){const e="string"===typeof t?t:t.name;this._defaultModules=this._defaultModules.filter((t=>t.name!==e)),this.stateHash++}addShaderHook(t,e){e&&(t=Object.assign(e,{hook:t})),this._hookFunctions.push(t),this.stateHash++}get(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{vs:e="",fs:n="",defines:r={},inject:i={},varyings:o=[],bufferMode:s=35981,transpileToGLSL100:a=!1}=t,l=this._getModuleList(t.modules),c=this._getHash(e),u=this._getHash(n),d=l.map((t=>this._getHash(t.name))).sort(),h=o.map((t=>this._getHash(t))),f=Object.keys(r).sort(),p=Object.keys(i).sort(),g=[],m=[];for(const b of f)g.push(this._getHash(b)),g.push(this._getHash(r[b]));for(const b of p)m.push(this._getHash(b)),m.push(this._getHash(i[b]));const v="".concat(c,"/").concat(u,"D").concat(g.join("/"),"M").concat(d.join("/"),"I").concat(m.join("/"),"V").concat(h.join("/"),"H").concat(this.stateHash,"B").concat(s).concat(a?"T":"");if(!this._programCache[v]){const t=function(t,e){const{vs:n,fs:r}=e,i=Py(e.modules||[]);return{gl:t,vs:ux(t,Object.assign({},e,{source:n,type:xy,modules:i})),fs:ux(t,Object.assign({},e,{source:r,type:Ay,modules:i})),getUniforms:dx(i)}}(this.gl,{vs:e,fs:n,modules:l,inject:i,defines:r,hookFunctions:this._hookFunctions,transpileToGLSL100:a});this._programCache[v]=new eS(this.gl,{hash:v,vs:t.vs,fs:t.fs,varyings:o,bufferMode:s}),this._getUniforms[v]=t.getUniforms||(t=>{}),this._useCounts[v]=0}return this._useCounts[v]++,this._programCache[v]}getUniforms(t){return this._getUniforms[t.hash]||null}release(t){const e=t.hash;this._useCounts[e]--,0===this._useCounts[e]&&(this._programCache[e].delete(),delete this._programCache[e],delete this._getUniforms[e],delete this._useCounts[e])}_getHash(t){return void 0===this._hashes[t]&&(this._hashes[t]=this._hashCounter++),this._hashes[t]}_getModuleList(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const e=new Array(this._defaultModules.length+t.length),n={};let r=0;for(let i=0,o=this._defaultModules.length;i 2) {\n return 1.0 / 0.0;\n }\n\n t = r - PI_2 * q;\n\n q = floor(t / PI_16 + 0.5);\n int k = int(q);\n int abs_k = int(abs(float(k)));\n\n if (abs_k > 4) {\n return 1.0 / 0.0;\n } else {\n t = t - PI_16 * q;\n }\n\n float u = 0.0;\n float v = 0.0;\n\n float sin_t, cos_t;\n float s, c;\n sincos_taylor_fp32(t, sin_t, cos_t);\n\n if (k == 0) {\n s = sin_t;\n c = cos_t;\n } else {\n if (abs(float(abs_k) - 1.0) < 0.5) {\n u = COS_TABLE_0;\n v = SIN_TABLE_0;\n } else if (abs(float(abs_k) - 2.0) < 0.5) {\n u = COS_TABLE_1;\n v = SIN_TABLE_1;\n } else if (abs(float(abs_k) - 3.0) < 0.5) {\n u = COS_TABLE_2;\n v = SIN_TABLE_2;\n } else if (abs(float(abs_k) - 4.0) < 0.5) {\n u = COS_TABLE_3;\n v = SIN_TABLE_3;\n }\n if (k > 0) {\n s = u * sin_t + v * cos_t;\n c = u * cos_t - v * sin_t;\n } else {\n s = u * sin_t - v * cos_t;\n c = u * cos_t + v * sin_t;\n }\n }\n\n if (j == 0) {\n sin_a = s;\n cos_a = c;\n } else if (j == 1) {\n sin_a = c;\n cos_a = -s;\n } else if (j == -1) {\n sin_a = -c;\n cos_a = s;\n } else {\n sin_a = -s;\n cos_a = -c;\n }\n return sin_a / cos_a;\n}\n#endif\n\nfloat tan_fp32(float a) {\n#ifdef LUMA_FP32_TAN_PRECISION_WORKAROUND\n return tan_taylor_fp32(a);\n#else\n return tan(a);\n#endif\n}\n",fs:null},iS="#define SMOOTH_EDGE_RADIUS 0.5",oS={name:"geometry",vs:"\n".concat(iS,"\n\nstruct VertexGeometry {\n vec4 position;\n vec3 worldPosition;\n vec3 worldPositionAlt;\n vec3 normal;\n vec2 uv;\n vec3 pickingColor;\n} geometry = VertexGeometry(\n vec4(0.0, 0.0, 1.0, 0.0),\n vec3(0.0),\n vec3(0.0),\n vec3(0.0),\n vec2(0.0),\n vec3(0.0)\n);\n"),fs:"\n".concat(iS,"\n\nstruct FragmentGeometry {\n vec2 uv;\n} geometry;\n\nfloat smoothedge(float edge, float x) {\n return smoothstep(edge - SMOOTH_EDGE_RADIUS, edge + SMOOTH_EDGE_RADIUS, x);\n}\n")},sS=Object.keys(dy).map((t=>"const int COORDINATE_SYSTEM_".concat(t," = ").concat(dy[t],";"))).join(""),aS=Object.keys(hy).map((t=>"const int PROJECTION_MODE_".concat(t," = ").concat(hy[t],";"))).join(""),lS=Object.keys(fy).map((t=>"const int UNIT_".concat(t.toUpperCase()," = ").concat(fy[t],";"))).join(""),cS="".concat(sS,"\n").concat(aS,"\n").concat(lS,"\n\nuniform int project_uCoordinateSystem;\nuniform int project_uProjectionMode;\nuniform float project_uScale;\nuniform bool project_uWrapLongitude;\nuniform vec3 project_uCommonUnitsPerMeter;\nuniform vec3 project_uCommonUnitsPerWorldUnit;\nuniform vec3 project_uCommonUnitsPerWorldUnit2;\nuniform vec4 project_uCenter;\nuniform mat4 project_uModelMatrix;\nuniform mat4 project_uViewProjectionMatrix;\nuniform vec2 project_uViewportSize;\nuniform float project_uDevicePixelRatio;\nuniform float project_uFocalDistance;\nuniform vec3 project_uCameraPosition;\nuniform vec3 project_uCoordinateOrigin;\nuniform vec3 project_uCommonOrigin;\nuniform bool project_uPseudoMeters;\n\nconst float TILE_SIZE = 512.0;\nconst float PI = 3.1415926536;\nconst float WORLD_SCALE = TILE_SIZE / (PI * 2.0);\nconst vec3 ZERO_64_LOW = vec3(0.0);\nconst float EARTH_RADIUS = 6370972.0;\nconst float GLOBE_RADIUS = 256.0;\nfloat project_size_at_latitude(float lat) {\n float y = clamp(lat, -89.9, 89.9);\n return 1.0 / cos(radians(y));\n}\n\nfloat project_size() {\n if (project_uProjectionMode == PROJECTION_MODE_WEB_MERCATOR &&\n project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT &&\n project_uPseudoMeters == false) {\n \n if (geometry.position.w == 0.0) {\n return project_size_at_latitude(geometry.worldPosition.y);\n }\n \n float y = geometry.position.y / TILE_SIZE * 2.0 - 1.0;\n float y2 = y * y;\n float y4 = y2 * y2;\n float y6 = y4 * y2;\n return 1.0 + 4.9348 * y2 + 4.0587 * y4 + 1.5642 * y6;\n }\n return 1.0;\n}\n\nfloat project_size_at_latitude(float meters, float lat) {\n return meters * project_uCommonUnitsPerMeter.z * project_size_at_latitude(lat);\n}\nfloat project_size(float meters) {\n return meters * project_uCommonUnitsPerMeter.z * project_size();\n}\n\nvec2 project_size(vec2 meters) {\n return meters * project_uCommonUnitsPerMeter.xy * project_size();\n}\n\nvec3 project_size(vec3 meters) {\n return meters * project_uCommonUnitsPerMeter * project_size();\n}\n\nvec4 project_size(vec4 meters) {\n return vec4(meters.xyz * project_uCommonUnitsPerMeter, meters.w);\n}\nmat3 project_get_orientation_matrix(vec3 up) {\n vec3 uz = normalize(up);\n vec3 ux = abs(uz.z) == 1.0 ? vec3(1.0, 0.0, 0.0) : normalize(vec3(uz.y, -uz.x, 0));\n vec3 uy = cross(uz, ux);\n return mat3(ux, uy, uz);\n}\n\nbool project_needs_rotation(vec3 commonPosition, out mat3 transform) {\n if (project_uProjectionMode == PROJECTION_MODE_GLOBE) {\n transform = project_get_orientation_matrix(commonPosition);\n return true;\n }\n return false;\n}\nvec3 project_normal(vec3 vector) {\n vec4 normal_modelspace = project_uModelMatrix * vec4(vector, 0.0);\n vec3 n = normalize(normal_modelspace.xyz * project_uCommonUnitsPerMeter);\n mat3 rotation;\n if (project_needs_rotation(geometry.position.xyz, rotation)) {\n n = rotation * n;\n }\n return n;\n}\n\nvec4 project_offset_(vec4 offset) {\n float dy = offset.y;\n vec3 commonUnitsPerWorldUnit = project_uCommonUnitsPerWorldUnit + project_uCommonUnitsPerWorldUnit2 * dy;\n return vec4(offset.xyz * commonUnitsPerWorldUnit, offset.w);\n}\nvec2 project_mercator_(vec2 lnglat) {\n float x = lnglat.x;\n if (project_uWrapLongitude) {\n x = mod(x + 180., 360.0) - 180.;\n }\n float y = clamp(lnglat.y, -89.9, 89.9);\n return vec2(\n radians(x) + PI,\n PI + log(tan_fp32(PI * 0.25 + radians(y) * 0.5))\n ) * WORLD_SCALE;\n}\n\nvec3 project_globe_(vec3 lnglatz) {\n float lambda = radians(lnglatz.x);\n float phi = radians(lnglatz.y);\n float cosPhi = cos(phi);\n float D = (lnglatz.z / EARTH_RADIUS + 1.0) * GLOBE_RADIUS;\n\n return vec3(\n sin(lambda) * cosPhi,\n -cos(lambda) * cosPhi,\n sin(phi)\n ) * D;\n}\nvec4 project_position(vec4 position, vec3 position64Low) {\n vec4 position_world = project_uModelMatrix * position;\n if (project_uProjectionMode == PROJECTION_MODE_WEB_MERCATOR) {\n if (project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT) {\n return vec4(\n project_mercator_(position_world.xy),\n project_size_at_latitude(position_world.z, position_world.y),\n position_world.w\n );\n }\n if (project_uCoordinateSystem == COORDINATE_SYSTEM_CARTESIAN) {\n position_world.xyz += project_uCoordinateOrigin;\n }\n }\n if (project_uProjectionMode == PROJECTION_MODE_GLOBE) {\n if (project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT) {\n return vec4(\n project_globe_(position_world.xyz),\n position_world.w\n );\n }\n }\n if (project_uProjectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET) {\n if (project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT) {\n if (abs(position_world.y - project_uCoordinateOrigin.y) > 0.25) {\n return vec4(\n project_mercator_(position_world.xy) - project_uCommonOrigin.xy,\n project_size(position_world.z),\n position_world.w\n );\n }\n }\n }\n if (project_uProjectionMode == PROJECTION_MODE_IDENTITY ||\n (project_uProjectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET &&\n (project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||\n project_uCoordinateSystem == COORDINATE_SYSTEM_CARTESIAN))) {\n position_world.xyz -= project_uCoordinateOrigin;\n }\n return project_offset_(position_world) + project_offset_(project_uModelMatrix * vec4(position64Low, 0.0));\n}\n\nvec4 project_position(vec4 position) {\n return project_position(position, ZERO_64_LOW);\n}\n\nvec3 project_position(vec3 position, vec3 position64Low) {\n vec4 projected_position = project_position(vec4(position, 1.0), position64Low);\n return projected_position.xyz;\n}\n\nvec3 project_position(vec3 position) {\n vec4 projected_position = project_position(vec4(position, 1.0), ZERO_64_LOW);\n return projected_position.xyz;\n}\n\nvec2 project_position(vec2 position) {\n vec4 projected_position = project_position(vec4(position, 0.0, 1.0), ZERO_64_LOW);\n return projected_position.xy;\n}\n\nvec4 project_common_position_to_clipspace(vec4 position, mat4 viewProjectionMatrix, vec4 center) {\n return viewProjectionMatrix * position + center;\n}\nvec4 project_common_position_to_clipspace(vec4 position) {\n return project_common_position_to_clipspace(position, project_uViewProjectionMatrix, project_uCenter);\n}\nvec2 project_pixel_size_to_clipspace(vec2 pixels) {\n vec2 offset = pixels / project_uViewportSize * project_uDevicePixelRatio * 2.0;\n return offset * project_uFocalDistance;\n}\n\nfloat project_size_to_pixel(float meters) {\n return project_size(meters) * project_uScale;\n}\nfloat project_size_to_pixel(float size, int unit) {\n if (unit == UNIT_METERS) return project_size_to_pixel(size);\n if (unit == UNIT_COMMON) return size * project_uScale;\n return size;\n}\nfloat project_pixel_size(float pixels) {\n return pixels / project_uScale;\n}\nvec2 project_pixel_size(vec2 pixels) {\n return pixels / project_uScale;\n}\n");function uS(t,e){if(t===e)return!0;if(Array.isArray(t)){const n=t.length;if(!e||e.length!==n)return!1;for(let r=0;r{for(const i in r)if(!uS(r[i],n[i])){e=t(r),n=r;break}return e}}const hS=[0,0,0,0],fS=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0],pS=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],gS=[0,0,0],mS=[0,0,0],vS=dS((function(t){let{viewport:e,devicePixelRatio:n,coordinateSystem:r,coordinateOrigin:i}=t;const{projectionCenter:o,viewProjectionMatrix:s,originCommon:a,cameraPosCommon:l,shaderCoordinateOrigin:c,geospatialOrigin:u}=function(t,e,n){const{viewMatrixUncentered:r,projectionMatrix:i}=t;let{viewMatrix:o,viewProjectionMatrix:s}=t,a=hS,l=hS,c=t.cameraPosition;const{geospatialOrigin:u,shaderCoordinateOrigin:d,offsetMode:h}=bS(t,e,n);h&&(l=t.projectPosition(u||d),c=[c[0]-l[0],c[1]-l[1],c[2]-l[2]],l[3]=1,a=Ab([],l,s),o=r||o,s=sb([],i,o),s=sb([],s,fS));return{viewMatrix:o,viewProjectionMatrix:s,projectionCenter:a,originCommon:l,cameraPosCommon:c,shaderCoordinateOrigin:d,geospatialOrigin:u}}(e,r,i),d=e.getDistanceScales(),h=[e.width*n,e.height*n],f=Ab([],[0,0,-e.focalDistance,1],e.projectionMatrix)[3]||1,p={project_uCoordinateSystem:r,project_uProjectionMode:e.projectionMode,project_uCoordinateOrigin:c,project_uCommonOrigin:a.slice(0,3),project_uCenter:o,project_uPseudoMeters:Boolean(e._pseudoMeters),project_uViewportSize:h,project_uDevicePixelRatio:n,project_uFocalDistance:f,project_uCommonUnitsPerMeter:d.unitsPerMeter,project_uCommonUnitsPerWorldUnit:d.unitsPerMeter,project_uCommonUnitsPerWorldUnit2:gS,project_uScale:e.scale,project_uWrapLongitude:!1,project_uViewProjectionMatrix:s,project_uModelMatrix:pS,project_uCameraPosition:l};if(u){const t=e.getDistanceScales(u);switch(r){case dy.METER_OFFSETS:p.project_uCommonUnitsPerWorldUnit=t.unitsPerMeter,p.project_uCommonUnitsPerWorldUnit2=t.unitsPerMeter2;break;case dy.LNGLAT:case dy.LNGLAT_OFFSETS:e._pseudoMeters||(p.project_uCommonUnitsPerMeter=t.unitsPerMeter),p.project_uCommonUnitsPerWorldUnit=t.unitsPerDegree,p.project_uCommonUnitsPerWorldUnit2=t.unitsPerDegree2;break;case dy.CARTESIAN:p.project_uCommonUnitsPerWorldUnit=[1,1,t.unitsPerMeter[2]],p.project_uCommonUnitsPerWorldUnit2=[0,0,t.unitsPerMeter2[2]]}}return p}));function bS(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:mS;n.length<3&&(n=[n[0],n[1],0]);let r,i=n,o=!0;switch(r=e===dy.LNGLAT_OFFSETS||e===dy.METER_OFFSETS?n:t.isGeospatial?[Math.fround(t.longitude),Math.fround(t.latitude),0]:null,t.projectionMode){case hy.WEB_MERCATOR:e!==dy.LNGLAT&&e!==dy.CARTESIAN||(r=[0,0,0],o=!1);break;case hy.WEB_MERCATOR_AUTO_OFFSET:e===dy.LNGLAT?i=r:e===dy.CARTESIAN&&(i=[Math.fround(t.center[0]),Math.fround(t.center[1]),0],r=t.unprojectPosition(i),i[0]-=n[0],i[1]-=n[1],i[2]-=n[2]);break;case hy.IDENTITY:i=t.position.map(Math.fround),i[2]=i[2]||0;break;case hy.GLOBE:o=!1,r=null;break;default:o=!1}return{geospatialOrigin:r,shaderCoordinateOrigin:i,offsetMode:o}}const yS={};const xS={name:"project",dependencies:[rS,oS],vs:cS,getUniforms:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:yS;return"viewport"in t?function(t){let{viewport:e,devicePixelRatio:n=1,modelMatrix:r=null,coordinateSystem:i=dy.DEFAULT,coordinateOrigin:o=mS,autoWrapLongitude:s=!1}=t;i===dy.DEFAULT&&(i=e.isGeospatial?dy.LNGLAT:dy.CARTESIAN);const a=vS({viewport:e,devicePixelRatio:n,coordinateSystem:i,coordinateOrigin:o});return a.project_uWrapLongitude=s,a.project_uModelMatrix=r||pS,a}(t):{}}},AS=[xS],_S=["vs:DECKGL_FILTER_SIZE(inout vec3 size, VertexGeometry geometry)","vs:DECKGL_FILTER_GL_POSITION(inout vec4 position, VertexGeometry geometry)","vs:DECKGL_FILTER_COLOR(inout vec4 color, VertexGeometry geometry)","fs:DECKGL_FILTER_COLOR(inout vec4 color, FragmentGeometry geometry)"];function wS(t){const e=nS.getDefaultProgramManager(t);for(const n of AS)e.addDefaultModule(n);for(const n of _S)e.addShaderHook(n);return e}class SS{constructor(t){let{deck:e,stats:n,viewport:r,timeline:i}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};ge(this,"layers",void 0),ge(this,"context",void 0),ge(this,"resourceManager",void 0),ge(this,"_lastRenderedLayers",[]),ge(this,"_needsRedraw",!1),ge(this,"_needsUpdate",!1),ge(this,"_nextLayers",null),ge(this,"_debug",!1),ge(this,"activateViewport",(t=>{Lg("layerManager.activateViewport",this,t),t&&(this.context.viewport=t)})),this.layers=[],this.resourceManager=new Av({gl:t,protocol:"deck://"}),this.context={mousePosition:null,userData:{},layerManager:this,gl:t,deck:e,programManager:t&&wS(t),stats:n||new Ug({id:"deck.gl"}),viewport:r||new yy({id:"DEFAULT-INITIAL-VIEWPORT"}),timeline:i||new Zp,resourceManager:this.resourceManager,onError:void 0},Object.seal(this)}finalize(){this.resourceManager.finalize();for(const t of this.layers)this._finalizeLayer(t)}needsRedraw(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{clearRedrawFlags:!1},e=this._needsRedraw;t.clearRedrawFlags&&(this._needsRedraw=!1);for(const n of this.layers){const r=n.getNeedsRedraw(t);e=e||r}return e}needsUpdate(){return this._nextLayers&&this._nextLayers!==this._lastRenderedLayers?"layers changed":this._needsUpdate}setNeedsRedraw(t){this._needsRedraw=this._needsRedraw||t}setNeedsUpdate(t){this._needsUpdate=this._needsUpdate||t}getLayers(){let{layerIds:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t?this.layers.filter((e=>t.find((t=>0===e.id.indexOf(t))))):this.layers}setProps(t){"debug"in t&&(this._debug=t.debug),"userData"in t&&(this.context.userData=t.userData),"layers"in t&&(this._nextLayers=t.layers),"onError"in t&&(this.context.onError=t.onError)}setLayers(t,e){Lg("layerManager.setLayers",this,e,t),this._lastRenderedLayers=t;const n=Dg(t,Boolean);for(const r of n)r.context=this.context;this._updateLayers(this.layers,n)}updateLayers(){const t=this.needsUpdate();t&&(this.setNeedsRedraw("updating layers: ".concat(t)),this.setLayers(this._nextLayers||this._lastRenderedLayers,t)),this._nextLayers=null}_handleError(t,e,n){n.raiseError(e,"".concat(t," of ").concat(n))}_updateLayers(t,e){const n={};for(const o of t)n[o.id]?Rg.warn("Multiple old layers with same id ".concat(o.id))():n[o.id]=o;const r=[];this._updateSublayersRecursively(e,n,r),this._finalizeOldLayers(n);let i=!1;for(const o of r)if(o.hasUniformTransition()){i="Uniform transition in ".concat(o);break}this._needsUpdate=i,this.layers=r}_updateSublayersRecursively(t,e,n){for(const i of t){i.context=this.context;const t=e[i.id];null===t&&Rg.warn("Multiple new layers with same id ".concat(i.id))(),e[i.id]=null;let o=null;try{this._debug&&t!==i&&i.validateProps(),t?(this._transferLayerState(t,i),this._updateLayer(i)):this._initializeLayer(i),n.push(i),o=i.isComposite?i.getSubLayers():null}catch(r){this._handleError("matching",r,i)}o&&this._updateSublayersRecursively(o,e,n)}}_finalizeOldLayers(t){for(const e in t){const n=t[e];n&&this._finalizeLayer(n)}}_initializeLayer(t){try{t._initialize(),t.lifecycle=eg}catch(e){this._handleError("initialization",e,t)}}_transferLayerState(t,e){e._transferState(t),e.lifecycle=tg,e!==t&&(t.lifecycle=ng)}_updateLayer(t){try{t._update()}catch(e){this._handleError("update",e,t)}}_finalizeLayer(t){this._needsRedraw=this._needsRedraw||"finalized ".concat(t),t.lifecycle=rg;try{t._finalize(),t.lifecycle=ig}catch(e){this._handleError("finalization",e,t)}}}function CS(t,e,n){if(t===e)return!0;if(!n||!t||!e)return!1;if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let r=0;r0&&void 0!==arguments[0]?arguments[0]:{clearRedrawFlags:!1};const e=this._needsRedraw;return t.clearRedrawFlags&&(this._needsRedraw=!1),e}setNeedsUpdate(t){this._needsUpdate=this._needsUpdate||t,this._needsRedraw=this._needsRedraw||t}updateViewStates(){for(const t in this.controllers){const e=this.controllers[t];e&&e.updateTransition()}}getViewports(t){return t?this._viewports.filter((e=>e.containsPixel(t))):this._viewports}getViews(){const t={};return this.views.forEach((e=>{t[e.id]=e})),t}getView(t){return this.views.find((e=>e.id===t))}getViewState(t){const e="string"===typeof t?this.getView(t):t,n=e&&this.viewState[e.getViewStateId()]||this.viewState;return e?e.filterViewState(n):n}getViewport(t){return this._viewportMap[t]}unproject(t,e){const n=this.getViewports(),r={x:t[0],y:t[1]};for(let i=n.length-1;i>=0;--i){const o=n[i];if(o.containsPixel(r)){const n=t.slice();return n[0]-=o.x,n[1]-=o.y,o.unproject(n,e)}}return null}setProps(t){t.views&&this._setViews(t.views),t.viewState&&this._setViewState(t.viewState),("width"in t||"height"in t)&&this._setSize(t.width,t.height),this._isUpdating||this._update()}_update(){this._isUpdating=!0,this._needsUpdate&&(this._needsUpdate=!1,this._rebuildViewports()),this._needsUpdate&&(this._needsUpdate=!1,this._rebuildViewports()),this._isUpdating=!1}_setSize(t,e){t===this.width&&e===this.height||(this.width=t,this.height=e,this.setNeedsUpdate("Size changed"))}_setViews(t){t=Dg(t,Boolean);this._diffViews(t,this.views)&&this.setNeedsUpdate("views changed"),this.views=t}_setViewState(t){if(t){!CS(t,this.viewState,3)&&this.setNeedsUpdate("viewState changed"),this.viewState=t}else Rg.warn("missing `viewState` or `initialViewState`")()}_onViewStateChange(t,e){this._eventCallbacks.onViewStateChange&&this._eventCallbacks.onViewStateChange({...e,viewId:t})}_createController(t,e){return new(0,e.type)({timeline:this.timeline,eventManager:this._eventManager,onViewStateChange:this._onViewStateChange.bind(this,e.id),onStateChange:this._eventCallbacks.onInteractionStateChange,makeViewport:e=>{var n;return null===(n=this.getView(t.id))||void 0===n?void 0:n.makeViewport({viewState:e,width:this.width,height:this.height})}})}_updateController(t,e,n,r){const i=t.controller;if(i&&n){const o={...e,...i,id:t.id,x:n.x,y:n.y,width:n.width,height:n.height};return r&&r.constructor===i.type||(r=this._createController(t,o)),r&&r.setProps(o),r}return null}_rebuildViewports(){const{views:t}=this,e=this.controllers;this._viewports=[],this.controllers={};let n=!1;for(let r=t.length;r--;){const i=t[r],o=this.getViewState(i),s=i.makeViewport({viewState:o,width:this.width,height:this.height});let a=e[i.id];const l=Boolean(i.controller);l&&!a&&(n=!0),!n&&l||!a||(a.finalize(),a=null),this.controllers[i.id]=this._updateController(i,o,s,a),s&&this._viewports.unshift(s)}for(const r in e){const t=e[r];t&&!this.controllers[r]&&t.finalize()}this._buildViewportMap()}_buildViewportMap(){this._viewportMap={},this._viewports.forEach((t=>{t.id&&(this._viewportMap[t.id]=this._viewportMap[t.id]||t)}))}_diffViews(t,e){return t.length!==e.length||t.some(((n,r)=>!t[r].equals(e[r])))}}const PS=/([0-9]+\.?[0-9]*)(%|px)/;function MS(t){switch(typeof t){case"number":return{position:t,relative:!1};case"string":const e=PS.exec(t);if(e&&e.length>=3){const t="%"===e[2],n=parseFloat(e[1]);return{position:t?n/100:n,relative:t}}default:throw new Error("Could not parse position string ".concat(t))}}function TS(t,e){return t.relative?Math.round(t.position*e):t.position}function OS(t,e){if(!t)throw new Error(e||"deck.gl: assertion failed.")}class kS{constructor(t){ge(this,"id",void 0),ge(this,"viewportInstance",void 0),ge(this,"_x",void 0),ge(this,"_y",void 0),ge(this,"_width",void 0),ge(this,"_height",void 0),ge(this,"_padding",void 0),ge(this,"props",void 0);const{id:e,x:n=0,y:r=0,width:i="100%",height:o="100%",padding:s=null,viewportInstance:a}=t||{};OS(!a||a instanceof yy),this.viewportInstance=a,this.id=e||this.constructor.displayName||"view",this.props={...t,id:this.id},this._x=MS(n),this._y=MS(r),this._width=MS(i),this._height=MS(o),this._padding=s&&{left:MS(s.left||0),right:MS(s.right||0),top:MS(s.top||0),bottom:MS(s.bottom||0)},this.equals=this.equals.bind(this),Object.seal(this)}equals(t){return this===t||(this.viewportInstance?!!t.viewportInstance&&this.viewportInstance.equals(t.viewportInstance):this.ViewportType===t.ViewportType&&CS(this.props,t.props,2))}makeViewport(t){let{width:e,height:n,viewState:r}=t;if(this.viewportInstance)return this.viewportInstance;r=this.filterViewState(r);const i=this.getDimensions({width:e,height:n});return i.height&&i.width?new this.ViewportType({...r,...this.props,...i}):null}getViewStateId(){const{viewState:t}=this.props;return"string"===typeof t?t:(null===t||void 0===t?void 0:t.id)||this.id}filterViewState(t){if(this.props.viewState&&"object"===typeof this.props.viewState){if(!this.props.viewState.id)return this.props.viewState;const e={...t};for(const t in this.props.viewState)"id"!==t&&(e[t]=this.props.viewState[t]);return e}return t}getDimensions(t){let{width:e,height:n}=t;const r={x:TS(this._x,e),y:TS(this._y,n),width:TS(this._width,e),height:TS(this._height,n)};return this._padding&&(r.padding={left:TS(this._padding.left,e),top:TS(this._padding.top,n),right:TS(this._padding.right,e),bottom:TS(this._padding.bottom,n)}),r}get controller(){const t=this.props.controller;return t?!0===t?{type:this.ControllerType}:"function"===typeof t?{type:t}:{type:this.ControllerType,...t}:null}}class RS extends yy{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{latitude:e=0,longitude:n=0,zoom:r=0,pitch:i=0,bearing:o=0,nearZMultiplier:s=.1,farZMultiplier:a=1.01,nearZ:l,farZ:c,orthographic:u=!1,projectionMatrix:d,repeat:h=!1,worldOffset:f=0,position:p,padding:g,legacyMeterSizes:m=!1}=t;let{width:v,height:b,altitude:y=1.5}=t;const x=Math.pow(2,r);let A;v=v||1,b=b||1;let _=null;if(d)y=d[5]/2,A=ty(y);else{let n;if(t.fovy?(A=t.fovy,y=ey(A)):A=ty(y),g){const{top:t=0,bottom:e=0}=g;n=[0,Ev((t+b-e)/2,0,b)-b/2]}_=$b({width:v,height:b,scale:x,center:p&&[0,0,p[2]*Yb(e)],offset:n,pitch:i,fovy:A,nearZMultiplier:s,farZMultiplier:a}),Number.isFinite(l)&&(_.near=l),Number.isFinite(c)&&(_.far=c)}let w=function(t){const{height:e,pitch:n,bearing:r,altitude:i,scale:o,center:s}=t,a=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];ab(a,a,[0,0,-i]),cb(a,a,-n*zb),ub(a,a,r*zb);const l=o/e;return lb(a,a,[l,l,l]),s&&ab(a,a,function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t}([],s)),a}({height:b,pitch:i,bearing:o,scale:x,altitude:y});if(f){w=(new Mb).translate([512*f,0,0]).multiplyLeft(w)}super({...t,width:v,height:b,viewMatrix:w,longitude:n,latitude:e,zoom:r,..._,fovy:A,focalDistance:y}),ge(this,"longitude",void 0),ge(this,"latitude",void 0),ge(this,"pitch",void 0),ge(this,"bearing",void 0),ge(this,"altitude",void 0),ge(this,"fovy",void 0),ge(this,"orthographic",void 0),ge(this,"_subViewports",void 0),ge(this,"_pseudoMeters",void 0),this.latitude=e,this.longitude=n,this.zoom=r,this.pitch=i,this.bearing=o,this.altitude=y,this.fovy=A,this.orthographic=u,this._subViewports=h?[]:null,this._pseudoMeters=m,Object.freeze(this)}get subViewports(){if(this._subViewports&&!this._subViewports.length){const t=this.getBounds(),e=Math.floor((t[0]+180)/360),n=Math.ceil((t[2]-180)/360);for(let r=e;r<=n;r++){const t=r?new RS({...this,worldOffset:r}):this;this._subViewports.push(t)}}return this._subViewports}projectPosition(t){if(this._pseudoMeters)return super.projectPosition(t);const[e,n]=this.projectFlat(t);return[e,n,(t[2]||0)*Yb(t[1])]}unprojectPosition(t){if(this._pseudoMeters)return super.unprojectPosition(t);const[e,n]=this.unprojectFlat(t);return[e,n,(t[2]||0)/Yb(n)]}addMetersToLngLat(t,e){return Zb(t,e)}panByPosition(t,e){const n=ry(e,this.pixelUnprojectionMatrix),r=pb([],this.projectFlat(t),function(t,e){return t[0]=-e[0],t[1]=-e[1],t}([],n)),i=pb([],this.center,r),[o,s]=this.unprojectFlat(i);return{longitude:o,latitude:s}}getBounds(){const t=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const{width:n,height:r,unproject:i}=t,o={targetZ:e},s=i([0,r],o),a=i([n,r],o);let l,c;return(t.fovy?.5*t.fovy*oy:Math.atan(.5/t.altitude))>(90-t.pitch)*oy-.01?(l=sy(t,0,e),c=sy(t,n,e)):(l=i([0,0],o),c=i([n,0],o)),[s,a,c,l]}(this,(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).z||0);return[Math.min(t[0][0],t[1][0],t[2][0],t[3][0]),Math.min(t[0][1],t[1][1],t[2][1],t[3][1]),Math.max(t[0][0],t[1][0],t[2][0],t[3][0]),Math.max(t[0][1],t[1][1],t[2][1],t[3][1])]}fitBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{width:n,height:r}=this,{longitude:i,latitude:o,zoom:s}=iy({width:n,height:r,bounds:t,...e});return new RS({width:n,height:r,longitude:i,latitude:o,zoom:s})}}ge(RS,"displayName","WebMercatorViewport");class IS{constructor(t){ge(this,"_inProgress",void 0),ge(this,"_handle",void 0),ge(this,"_timeline",void 0),ge(this,"time",void 0),ge(this,"settings",void 0),this._inProgress=!1,this._handle=null,this._timeline=t,this.time=0,this.settings={duration:0}}get inProgress(){return this._inProgress}start(t){var e,n;this.cancel(),this.settings=t,this._inProgress=!0,null===(e=(n=this.settings).onStart)||void 0===e||e.call(n,this)}end(){var t,e;this._inProgress&&(this._timeline.removeChannel(this._handle),this._handle=null,this._inProgress=!1,null===(t=(e=this.settings).onEnd)||void 0===t||t.call(e,this))}cancel(){var t,e;this._inProgress&&(null===(t=(e=this.settings).onInterrupt)||void 0===t||t.call(e,this),this._timeline.removeChannel(this._handle),this._handle=null,this._inProgress=!1)}update(){var t,e;if(!this._inProgress)return!1;if(null===this._handle){const{_timeline:t,settings:e}=this;this._handle=t.addChannel({delay:t.getTime(),duration:e.duration})}return this.time=this._timeline.getTime(this._handle),this._onUpdate(),null===(t=(e=this.settings).onUpdate)||void 0===t||t.call(e,this),this._timeline.isFinished(this._handle)&&this.end(),!0}_onUpdate(){}}const BS=()=>{},LS=2,DS=3,FS=t=>t,NS=1;class jS{constructor(t){ge(this,"getControllerState",void 0),ge(this,"props",void 0),ge(this,"propsInTransition",void 0),ge(this,"transition",void 0),ge(this,"onViewStateChange",void 0),ge(this,"onStateChange",void 0),ge(this,"_onTransitionUpdate",(t=>{const{time:e,settings:{interpolator:n,startProps:r,endProps:i,duration:o,easing:s}}=t,a=s(e/o),l=n.interpolateProps(r,i,a);this.propsInTransition=this.getControllerState({...this.props,...l}).getViewportProps(),this.onViewStateChange({viewState:this.propsInTransition,oldViewState:this.props})})),this.getControllerState=t.getControllerState,this.propsInTransition=null,this.transition=new IS(t.timeline),this.onViewStateChange=t.onViewStateChange||BS,this.onStateChange=t.onStateChange||BS}finalize(){this.transition.cancel()}getViewportInTransition(){return this.propsInTransition}processViewStateChange(t){let e=!1;const n=this.props;if(this.props=t,!n||this._shouldIgnoreViewportChange(n,t))return!1;if(this._isTransitionEnabled(t)){let r=n;if(this.transition.inProgress){const{interruption:t,endProps:e}=this.transition.settings;r={...n,...t===LS?e:this.propsInTransition||n}}this._triggerTransition(r,t),e=!0}else this.transition.cancel();return e}updateTransition(){this.transition.update()}_isTransitionEnabled(t){const{transitionDuration:e,transitionInterpolator:n}=t;return(e>0||"auto"===e)&&Boolean(n)}_isUpdateDueToCurrentTransition(t){return!(!this.transition.inProgress||!this.propsInTransition)&&this.transition.settings.interpolator.arePropsEqual(t,this.propsInTransition)}_shouldIgnoreViewportChange(t,e){return this.transition.inProgress?this.transition.settings.interruption===DS||this._isUpdateDueToCurrentTransition(e):!this._isTransitionEnabled(e)||e.transitionInterpolator.arePropsEqual(t,e)}_triggerTransition(t,e){const n=this.getControllerState(t),r=this.getControllerState(e).shortestPathFrom(n),i=e.transitionInterpolator,o=i.getDuration?i.getDuration(t,e):e.transitionDuration;if(0===o)return;const s=i.initializeProps(t,r);this.propsInTransition={};const a={duration:o,easing:e.transitionEasing||FS,interpolator:i,interruption:e.transitionInterruption||NS,startProps:s.start,endProps:s.end,onStart:e.onTransitionStart,onUpdate:this._onTransitionUpdate,onInterrupt:this._onTransitionEnd(e.onTransitionInterrupt),onEnd:this._onTransitionEnd(e.onTransitionEnd)};this.transition.start(a),this.onStateChange({inTransition:!0}),this.updateTransition()}_onTransitionEnd(t){return e=>{this.propsInTransition=null,this.onStateChange({inTransition:!1,isZooming:!1,isPanning:!1,isRotating:!1}),null===t||void 0===t||t(e)}}}class zS{constructor(t){ge(this,"_propsToCompare",void 0),ge(this,"_propsToExtract",void 0),ge(this,"_requiredProps",void 0);const{compare:e,extract:n,required:r}=t;this._propsToCompare=e,this._propsToExtract=n||e,this._requiredProps=r}arePropsEqual(t,e){for(const n of this._propsToCompare)if(!(n in t)||!(n in e)||!Mv(t[n],e[n]))return!1;return!0}initializeProps(t,e){const n={},r={};for(const i of this._propsToExtract)(i in t||i in e)&&(n[i]=t[i],r[i]=e[i]);return this._checkRequiredProps(n),this._checkRequiredProps(r),{start:n,end:r}}getDuration(t,e){return e.transitionDuration}_checkRequiredProps(t){this._requiredProps&&this._requiredProps.forEach((e=>{const n=t[e];OS(Number.isFinite(n)||Array.isArray(n),"".concat(e," is required for transition"))}))}}const US=["longitude","latitude","zoom","bearing","pitch"],VS=["longitude","latitude","zoom"];class GS extends zS{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e=Array.isArray(t)?t:t.transitionProps,n=Array.isArray(t)?{}:t;n.transitionProps=Array.isArray(e)?{compare:e,required:e}:e||{compare:US,required:VS},super(n.transitionProps),ge(this,"opts",void 0),this.opts=n}initializeProps(t,e){const n=super.initializeProps(t,e),{makeViewport:r,around:i}=this.opts;if(r&&i){const o=r(t),s=r(e),a=o.unproject(i);n.start.around=i,Object.assign(n.end,{around:s.project(a),aroundPosition:a,width:e.width,height:e.height})}return n}interpolateProps(t,e,n){const r={};for(const i of this._propsToExtract)r[i]=Pv(t[i]||0,e[i]||0,n);if(e.aroundPosition&&this.opts.makeViewport){const i=this.opts.makeViewport({...e,...r});Object.assign(r,i.panByPosition(e.aroundPosition,Pv(t.around,e.around,n)))}return r}}const WS={transitionDuration:0},HS=t=>1-(1-t)*(1-t),JS=["wheel"],KS=["panstart","panmove","panend"],XS=["pinchstart","pinchmove","pinchend"],qS=["tripanstart","tripanmove","tripanend"],YS=["doubletap"],QS=["keydown"],ZS={};class $S{constructor(t){ge(this,"props",void 0),ge(this,"state",{}),ge(this,"transitionManager",void 0),ge(this,"eventManager",void 0),ge(this,"onViewStateChange",void 0),ge(this,"onStateChange",void 0),ge(this,"makeViewport",void 0),ge(this,"_controllerState",void 0),ge(this,"_events",{}),ge(this,"_interactionState",{isDragging:!1}),ge(this,"_customEvents",[]),ge(this,"_eventStartBlocked",null),ge(this,"_panMove",!1),ge(this,"invertPan",!1),ge(this,"dragMode","rotate"),ge(this,"inertia",0),ge(this,"scrollZoom",!0),ge(this,"dragPan",!0),ge(this,"dragRotate",!0),ge(this,"doubleClickZoom",!0),ge(this,"touchZoom",!0),ge(this,"touchRotate",!1),ge(this,"keyboard",!0),this.transitionManager=new jS({...t,getControllerState:t=>new this.ControllerState(t),onViewStateChange:this._onTransition.bind(this),onStateChange:this._setInteractionState.bind(this)}),this.handleEvent=this.handleEvent.bind(this),this.eventManager=t.eventManager,this.onViewStateChange=t.onViewStateChange||(()=>{}),this.onStateChange=t.onStateChange||(()=>{}),this.makeViewport=t.makeViewport}set events(t){this.toggleEvents(this._customEvents,!1),this.toggleEvents(t,!0),this._customEvents=t,this.props&&this.setProps(this.props)}finalize(){for(const e in this._events){var t;if(this._events[e])null===(t=this.eventManager)||void 0===t||t.off(e,this.handleEvent)}this.transitionManager.finalize()}handleEvent(t){this._controllerState=void 0;const e=this._eventStartBlocked;switch(t.type){case"panstart":return!e&&this._onPanStart(t);case"panmove":return this._onPan(t);case"panend":return this._onPanEnd(t);case"pinchstart":return!e&&this._onPinchStart(t);case"pinchmove":return this._onPinch(t);case"pinchend":return this._onPinchEnd(t);case"tripanstart":return!e&&this._onTriplePanStart(t);case"tripanmove":return this._onTriplePan(t);case"tripanend":return this._onTriplePanEnd(t);case"doubletap":return this._onDoubleTap(t);case"wheel":return this._onWheel(t);case"keydown":return this._onKeyDown(t);default:return!1}}get controllerState(){return this._controllerState=this._controllerState||new this.ControllerState({makeViewport:this.makeViewport,...this.props,...this.state}),this._controllerState}getCenter(t){const{x:e,y:n}=this.props,{offsetCenter:r}=t;return[r.x-e,r.y-n]}isPointInBounds(t,e){const{width:n,height:r}=this.props;if(e&&e.handled)return!1;const i=t[0]>=0&&t[0]<=n&&t[1]>=0&&t[1]<=r;return i&&e&&e.stopPropagation(),i}isFunctionKeyPressed(t){const{srcEvent:e}=t;return Boolean(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}isDragging(){return this._interactionState.isDragging||!1}blockEvents(t){const e=setTimeout((()=>{this._eventStartBlocked===e&&(this._eventStartBlocked=null)}),t);this._eventStartBlocked=e}setProps(t){t.dragMode&&(this.dragMode=t.dragMode),this.props=t,"transitionInterpolator"in t||(t.transitionInterpolator=this._getTransitionProps().transitionInterpolator),this.transitionManager.processViewStateChange(t);const{inertia:e}=t;this.inertia=Number.isFinite(e)?e:!0===e?300:0;const{scrollZoom:n=!0,dragPan:r=!0,dragRotate:i=!0,doubleClickZoom:o=!0,touchZoom:s=!0,touchRotate:a=!1,keyboard:l=!0}=t,c=Boolean(this.onViewStateChange);this.toggleEvents(JS,c&&n),this.toggleEvents(KS,c),this.toggleEvents(XS,c&&(s||a)),this.toggleEvents(qS,c&&a),this.toggleEvents(YS,c&&o),this.toggleEvents(QS,c&&l),this.scrollZoom=n,this.dragPan=r,this.dragRotate=i,this.doubleClickZoom=o,this.touchZoom=s,this.touchRotate=a,this.keyboard=l}updateTransition(){this.transitionManager.updateTransition()}toggleEvents(t,e){this.eventManager&&t.forEach((t=>{this._events[t]!==e&&(this._events[t]=e,e?this.eventManager.on(t,this.handleEvent):this.eventManager.off(t,this.handleEvent))}))}updateViewport(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r={...t.getViewportProps(),...e},i=this.controllerState!==t;if(this.state=t.getState(),this._setInteractionState(n),i){const t=this.controllerState&&this.controllerState.getViewportProps();this.onViewStateChange&&this.onViewStateChange({viewState:r,interactionState:this._interactionState,oldViewState:t})}}_onTransition(t){this.onViewStateChange({...t,interactionState:this._interactionState})}_setInteractionState(t){Object.assign(this._interactionState,t),this.onStateChange(this._interactionState)}_onPanStart(t){const e=this.getCenter(t);if(!this.isPointInBounds(e,t))return!1;let n=this.isFunctionKeyPressed(t)||t.rightButton||!1;(this.invertPan||"pan"===this.dragMode)&&(n=!n);const r=this.controllerState[n?"panStart":"rotateStart"]({pos:e});return this._panMove=n,this.updateViewport(r,WS,{isDragging:!0}),!0}_onPan(t){return!!this.isDragging()&&(this._panMove?this._onPanMove(t):this._onPanRotate(t))}_onPanEnd(t){return!!this.isDragging()&&(this._panMove?this._onPanMoveEnd(t):this._onPanRotateEnd(t))}_onPanMove(t){if(!this.dragPan)return!1;const e=this.getCenter(t),n=this.controllerState.pan({pos:e});return this.updateViewport(n,WS,{isDragging:!0,isPanning:!0}),!0}_onPanMoveEnd(t){const{inertia:e}=this;if(this.dragPan&&e&&t.velocity){const n=this.getCenter(t),r=[n[0]+t.velocityX*e/2,n[1]+t.velocityY*e/2],i=this.controllerState.pan({pos:r}).panEnd();this.updateViewport(i,{...this._getTransitionProps(),transitionDuration:e,transitionEasing:HS},{isDragging:!1,isPanning:!0})}else{const t=this.controllerState.panEnd();this.updateViewport(t,null,{isDragging:!1,isPanning:!1})}return!0}_onPanRotate(t){if(!this.dragRotate)return!1;const e=this.getCenter(t),n=this.controllerState.rotate({pos:e});return this.updateViewport(n,WS,{isDragging:!0,isRotating:!0}),!0}_onPanRotateEnd(t){const{inertia:e}=this;if(this.dragRotate&&e&&t.velocity){const n=this.getCenter(t),r=[n[0]+t.velocityX*e/2,n[1]+t.velocityY*e/2],i=this.controllerState.rotate({pos:r}).rotateEnd();this.updateViewport(i,{...this._getTransitionProps(),transitionDuration:e,transitionEasing:HS},{isDragging:!1,isRotating:!0})}else{const t=this.controllerState.rotateEnd();this.updateViewport(t,null,{isDragging:!1,isRotating:!1})}return!0}_onWheel(t){if(!this.scrollZoom)return!1;const e=this.getCenter(t);if(!this.isPointInBounds(e,t))return!1;t.srcEvent.preventDefault();const{speed:n=.01,smooth:r=!1}=!0===this.scrollZoom?{}:this.scrollZoom,{delta:i}=t;let o=2/(1+Math.exp(-Math.abs(i*n)));i<0&&0!==o&&(o=1/o);const s=this.controllerState.zoom({pos:e,scale:o});return this.updateViewport(s,{...this._getTransitionProps({around:e}),transitionDuration:r?250:1},{isZooming:!0,isPanning:!0}),!0}_onTriplePanStart(t){const e=this.getCenter(t);if(!this.isPointInBounds(e,t))return!1;const n=this.controllerState.rotateStart({pos:e});return this.updateViewport(n,WS,{isDragging:!0}),!0}_onTriplePan(t){if(!this.touchRotate)return!1;if(!this.isDragging())return!1;const e=this.getCenter(t);e[0]-=t.deltaX;const n=this.controllerState.rotate({pos:e});return this.updateViewport(n,WS,{isDragging:!0,isRotating:!0}),!0}_onTriplePanEnd(t){if(!this.isDragging())return!1;const{inertia:e}=this;if(this.touchRotate&&e&&t.velocityY){const n=this.getCenter(t),r=[n[0],n[1]+=t.velocityY*e/2],i=this.controllerState.rotate({pos:r});this.updateViewport(i,{...this._getTransitionProps(),transitionDuration:e,transitionEasing:HS},{isDragging:!1,isRotating:!0}),this.blockEvents(e)}else{const t=this.controllerState.rotateEnd();this.updateViewport(t,null,{isDragging:!1,isRotating:!1})}return!0}_onPinchStart(t){const e=this.getCenter(t);if(!this.isPointInBounds(e,t))return!1;const n=this.controllerState.zoomStart({pos:e}).rotateStart({pos:e});return ZS._startPinchRotation=t.rotation,ZS._lastPinchEvent=t,this.updateViewport(n,WS,{isDragging:!0}),!0}_onPinch(t){if(!this.touchZoom&&!this.touchRotate)return!1;if(!this.isDragging())return!1;let e=this.controllerState;if(this.touchZoom){const{scale:n}=t,r=this.getCenter(t);e=e.zoom({pos:r,scale:n})}if(this.touchRotate){const{rotation:n}=t;e=e.rotate({deltaAngleX:ZS._startPinchRotation-n})}return this.updateViewport(e,WS,{isDragging:!0,isPanning:this.touchZoom,isZooming:this.touchZoom,isRotating:this.touchRotate}),ZS._lastPinchEvent=t,!0}_onPinchEnd(t){if(!this.isDragging())return!1;const{inertia:e}=this,{_lastPinchEvent:n}=ZS;if(this.touchZoom&&e&&n&&t.scale!==n.scale){const r=this.getCenter(t);let i=this.controllerState.rotateEnd();const o=Math.log2(t.scale),s=(o-Math.log2(n.scale))/(t.deltaTime-n.deltaTime),a=Math.pow(2,o+s*e/2);i=i.zoom({pos:r,scale:a}).zoomEnd(),this.updateViewport(i,{...this._getTransitionProps({around:r}),transitionDuration:e,transitionEasing:HS},{isDragging:!1,isPanning:this.touchZoom,isZooming:this.touchZoom,isRotating:!1}),this.blockEvents(e)}else{const t=this.controllerState.zoomEnd().rotateEnd();this.updateViewport(t,null,{isDragging:!1,isPanning:!1,isZooming:!1,isRotating:!1})}return ZS._startPinchRotation=null,ZS._lastPinchEvent=null,!0}_onDoubleTap(t){if(!this.doubleClickZoom)return!1;const e=this.getCenter(t);if(!this.isPointInBounds(e,t))return!1;const n=this.isFunctionKeyPressed(t),r=this.controllerState.zoom({pos:e,scale:n?.5:2});return this.updateViewport(r,this._getTransitionProps({around:e}),{isZooming:!0,isPanning:!0}),this.blockEvents(100),!0}_onKeyDown(t){if(!this.keyboard)return!1;const e=this.isFunctionKeyPressed(t),{zoomSpeed:n,moveSpeed:r,rotateSpeedX:i,rotateSpeedY:o}=!0===this.keyboard?{}:this.keyboard,{controllerState:s}=this;let a;const l={};switch(t.srcEvent.code){case"Minus":a=e?s.zoomOut(n).zoomOut(n):s.zoomOut(n),l.isZooming=!0;break;case"Equal":a=e?s.zoomIn(n).zoomIn(n):s.zoomIn(n),l.isZooming=!0;break;case"ArrowLeft":e?(a=s.rotateLeft(i),l.isRotating=!0):(a=s.moveLeft(r),l.isPanning=!0);break;case"ArrowRight":e?(a=s.rotateRight(i),l.isRotating=!0):(a=s.moveRight(r),l.isPanning=!0);break;case"ArrowUp":e?(a=s.rotateUp(o),l.isRotating=!0):(a=s.moveUp(r),l.isPanning=!0);break;case"ArrowDown":e?(a=s.rotateDown(o),l.isRotating=!0):(a=s.moveDown(r),l.isPanning=!0);break;default:return!1}return this.updateViewport(a,this._getTransitionProps(),l),!0}_getTransitionProps(t){const{transition:e}=this;return e&&e.transitionInterpolator?t?{...e,transitionInterpolator:new GS({...t,...e.transitionInterpolator.opts,makeViewport:this.controllerState.makeViewport})}:e:WS}}class tC{constructor(t,e){ge(this,"_viewportProps",void 0),ge(this,"_state",void 0),this._viewportProps=this.applyConstraints(t),this._state=e}getViewportProps(){return this._viewportProps}getState(){return this._state}}class eC extends tC{constructor(t){const{width:e,height:n,latitude:r,longitude:i,zoom:o,bearing:s=0,pitch:a=0,altitude:l=1.5,position:c=[0,0,0],maxZoom:u=20,minZoom:d=0,maxPitch:h=60,minPitch:f=0,startPanLngLat:p,startZoomLngLat:g,startRotatePos:m,startBearing:v,startPitch:b,startZoom:y,normalize:x=!0}=t;OS(Number.isFinite(i)),OS(Number.isFinite(r)),OS(Number.isFinite(o)),super({width:e,height:n,latitude:r,longitude:i,zoom:o,bearing:s,pitch:a,altitude:l,maxZoom:u,minZoom:d,maxPitch:h,minPitch:f,normalize:x,position:c},{startPanLngLat:p,startZoomLngLat:g,startRotatePos:m,startBearing:v,startPitch:b,startZoom:y}),ge(this,"makeViewport",void 0),this.makeViewport=t.makeViewport}panStart(t){let{pos:e}=t;return this._getUpdatedState({startPanLngLat:this._unproject(e)})}pan(t){let{pos:e,startPos:n}=t;const r=this.getState().startPanLngLat||this._unproject(n);if(!r)return this;const i=this.makeViewport(this.getViewportProps()).panByPosition(r,e);return this._getUpdatedState(i)}panEnd(){return this._getUpdatedState({startPanLngLat:null})}rotateStart(t){let{pos:e}=t;return this._getUpdatedState({startRotatePos:e,startBearing:this.getViewportProps().bearing,startPitch:this.getViewportProps().pitch})}rotate(t){let{pos:e,deltaAngleX:n=0,deltaAngleY:r=0}=t;const{startRotatePos:i,startBearing:o,startPitch:s}=this.getState();if(!i||void 0===o||void 0===s)return this;let a;return a=e?this._getNewRotation(e,i,s,o):{bearing:o+n,pitch:s+r},this._getUpdatedState(a)}rotateEnd(){return this._getUpdatedState({startBearing:null,startPitch:null})}zoomStart(t){let{pos:e}=t;return this._getUpdatedState({startZoomLngLat:this._unproject(e),startZoom:this.getViewportProps().zoom})}zoom(t){let{pos:e,startPos:n,scale:r}=t,{startZoom:i,startZoomLngLat:o}=this.getState();if(o||(i=this.getViewportProps().zoom,o=this._unproject(n)||this._unproject(e)),!o)return this;const{maxZoom:s,minZoom:a}=this.getViewportProps();let l=i+Math.log2(r);l=Ev(l,a,s);const c=this.makeViewport({...this.getViewportProps(),zoom:l});return this._getUpdatedState({zoom:l,...c.panByPosition(o,e)})}zoomEnd(){return this._getUpdatedState({startZoomLngLat:null,startZoom:null})}zoomIn(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:2;return this._zoomFromCenter(t)}zoomOut(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:2;return this._zoomFromCenter(1/t)}moveLeft(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100;return this._panFromCenter([t,0])}moveRight(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100;return this._panFromCenter([-t,0])}moveUp(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100;return this._panFromCenter([0,t])}moveDown(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100;return this._panFromCenter([0,-t])}rotateLeft(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:15;return this._getUpdatedState({bearing:this.getViewportProps().bearing-t})}rotateRight(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:15;return this._getUpdatedState({bearing:this.getViewportProps().bearing+t})}rotateUp(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this._getUpdatedState({pitch:this.getViewportProps().pitch+t})}rotateDown(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this._getUpdatedState({pitch:this.getViewportProps().pitch-t})}shortestPathFrom(t){const e=t.getViewportProps(),n={...this.getViewportProps()},{bearing:r,longitude:i}=n;return Math.abs(r-e.bearing)>180&&(n.bearing=r<0?r+360:r-360),Math.abs(i-e.longitude)>180&&(n.longitude=i<0?i+360:i-360),n}applyConstraints(t){const{maxZoom:e,minZoom:n,zoom:r}=t;t.zoom=Ev(r,n,e);const{maxPitch:i,minPitch:o,pitch:s}=t;t.pitch=Ev(s,o,i);const{normalize:a=!0}=t;return a&&Object.assign(t,function(t){const{width:e,height:n,pitch:r=0}=t;let{longitude:i,latitude:o,zoom:s,bearing:a=0}=t;(i<-180||i>180)&&(i=Ib(i+180,360)-180),(a<-180||a>180)&&(a=Ib(a+180,360)-180);const l=Db(n/512);if(s<=l)s=l,o=0;else{const t=n/2/Math.pow(2,s),e=qb([0,t])[1];if(oe&&(o=e)}}return{width:e,height:n,longitude:i,latitude:o,zoom:s,pitch:r,bearing:a}}(t)),t}_zoomFromCenter(t){const{width:e,height:n}=this.getViewportProps();return this.zoom({pos:[e/2,n/2],scale:t})}_panFromCenter(t){const{width:e,height:n}=this.getViewportProps();return this.pan({startPos:[e/2,n/2],pos:[e/2+t[0],n/2+t[1]]})}_getUpdatedState(t){return new this.constructor({makeViewport:this.makeViewport,...this.getViewportProps(),...this.getState(),...t})}_unproject(t){const e=this.makeViewport(this.getViewportProps());return t&&e.unproject(t)}_getNewRotation(t,e,n,r){const i=t[0]-e[0],o=t[1]-e[1],s=t[1],a=e[1],{width:l,height:c}=this.getViewportProps(),u=i/l;let d=0;o>0?Math.abs(c-a)>5&&(d=o/(a-c)*1.2):o<0&&a>5&&(d=1-s/a),d=Ev(d,-1,1);const{minPitch:h,maxPitch:f}=this.getViewportProps();let p=n;return d>0?p=n+d*(f-n):d<0&&(p=n-d*(h-n)),{pitch:p,bearing:r+180*u}}}class nC extends $S{constructor(){super(...arguments),ge(this,"ControllerState",eC),ge(this,"transition",{transitionDuration:300,transitionInterpolator:new GS({transitionProps:{compare:["longitude","latitude","zoom","bearing","pitch","position"],required:["longitude","latitude","zoom"]}})}),ge(this,"dragMode","pan")}setProps(t){t.position=t.position||[0,0,0];const e=this.props;super.setProps(t);(!e||e.height!==t.height)&&this.updateViewport(new this.ControllerState({makeViewport:this.makeViewport,...t,...this.state}))}}class rC extends kS{get ViewportType(){return RS}get ControllerType(){return nC}}ge(rC,"displayName","MapView");const iC=[255,255,255],oC=1;let sC=0;class aC{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};ge(this,"id",void 0),ge(this,"color",void 0),ge(this,"intensity",void 0),ge(this,"type","ambient");const{color:e=iC}=t,{intensity:n=oC}=t;this.id=t.id||"ambient-".concat(sC++),this.color=e,this.intensity=n}}const lC=[255,255,255],cC=1,uC=[0,0,-1];let dC=0;class hC{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};ge(this,"id",void 0),ge(this,"color",void 0),ge(this,"intensity",void 0),ge(this,"type","directional"),ge(this,"direction",void 0),ge(this,"shadow",void 0);const{color:e=lC}=t,{intensity:n=cC}=t,{direction:r=uC}=t,{_shadow:i=!1}=t;this.id=t.id||"directional-".concat(dC++),this.color=e,this.intensity=n,this.type="directional",this.direction=new Qv(r).normalize().toArray(),this.shadow=i}getProjectedLight(t){return this}}class fC{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{id:"pass"};ge(this,"id",void 0),ge(this,"gl",void 0),ge(this,"props",void 0);const{id:n}=e;this.id=n,this.gl=t,this.props={...e}}setProps(t){Object.assign(this.props,t)}render(t){}cleanup(){}}class pC extends fC{constructor(){super(...arguments),ge(this,"_lastRenderIndex",-1)}render(t){return oA(this.gl,{framebuffer:t.target}),this._drawLayers(t)}_drawLayers(t){const{target:e,moduleParameters:n,viewports:r,views:i,onViewportActive:o,clearStack:s=!0,clearCanvas:a=!0}=t;t.pass=t.pass||"unknown";const l=this.gl;a&&function(t,e){const n=e?e.width:t.drawingBufferWidth,r=e?e.height:t.drawingBufferHeight;oA(t,{viewport:[0,0,n,r]}),t.clear(16640)}(l,e),s&&(this._lastRenderIndex=-1);const c=[];for(const u of r){const r=i&&i[u.id];null===o||void 0===o||o(u);const s=this._getDrawLayerParams(u,t),a=u.subViewports||[u];for(const i of a){const o=this._drawLayersInViewport(l,{target:e,moduleParameters:n,viewport:i,view:r,pass:t.pass,layers:t.layers},s);c.push(o)}}return c}_getDrawLayerParams(t,e){let{layers:n,pass:r,isPicking:i=!1,layerFilter:o,cullRect:s,effects:a,moduleParameters:l}=e,c=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const u=[],d=gC(this._lastRenderIndex+1),h={layer:n[0],viewport:t,isPicking:i,renderPass:r,cullRect:s},f={};for(let p=0;pe_(t,e)))}const u={totalCount:r.length,visibleCount:0,compositeCount:0,pickableCount:0};oA(t,{viewport:c});for(let h=0;h0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n={},r=(i,o)=>{const s=i.props._offset,a=i.id,l=i.parent&&i.parent.id;let c;if(l&&!(l in e)&&r(i.parent,!1),l in n){const t=n[l]=n[l]||gC(e[l],e);c=t(i,o),n[a]=t}else Number.isFinite(s)?(c=s+(e[l]||0),n[a]=null):c=t;return o&&c>=t&&(t=c+1),e[a]=c,c};return r}class mC extends pC{constructor(t,e){super(t,e),ge(this,"shadowMap",void 0),ge(this,"depthBuffer",void 0),ge(this,"fbo",void 0),this.shadowMap=new qA(t,{width:1,height:1,parameters:{10241:9729,10240:9729,10242:33071,10243:33071}}),this.depthBuffer=new ZA(t,{format:33189,width:1,height:1}),this.fbo=new j_(t,{id:"shadowmap",width:1,height:1,attachments:{36064:this.shadowMap,36096:this.depthBuffer}})}render(t){const e=this.fbo;aA(this.gl,{depthRange:[0,1],depthTest:!0,blend:!1,clearColor:[1,1,1,1]},(()=>{const n=t.viewports[0],r=lA(this.gl),i=n.width*r,o=n.height*r;i===e.width&&o===e.height||e.resize({width:i,height:o}),super.render({...t,target:e,pass:"shadow"})}))}shouldDrawLayer(t){return!1!==t.props.shadowEnabled}getModuleParameters(){return{drawToShadowMap:!0}}delete(){this.fbo&&(this.fbo.delete(),this.fbo=null),this.shadowMap&&(this.shadowMap.delete(),this.shadowMap=null),this.depthBuffer&&(this.depthBuffer.delete(),this.depthBuffer=null)}}const vC=dS((function(t){let{viewport:e,center:n}=t;return new Mb(e.viewProjectionMatrix).invert().transform(n)})),bC=dS((function(t){let{viewport:e,shadowMatrices:n}=t;const r=[],i=e.pixelUnprojectionMatrix,o=e.isGeospatial?void 0:1,s=[[0,0,o],[e.width,0,o],[0,e.height,o],[e.width,e.height,o],[0,0,-1],[e.width,0,-1],[0,e.height,-1],[e.width,e.height,-1]].map((t=>function(t,e){const[n,r,i]=t,o=ry([n,r,i],e);if(Number.isFinite(i))return o;return[o[0],o[1],0]}(t,i)));for(const a of n){const t=a.clone().translate(new Qv(e.center).negate()),n=s.map((e=>t.transform(e))),i=(new Mb).ortho({left:Math.min(...n.map((t=>t[0]))),right:Math.max(...n.map((t=>t[0]))),bottom:Math.min(...n.map((t=>t[1]))),top:Math.max(...n.map((t=>t[1]))),near:Math.min(...n.map((t=>-t[2]))),far:Math.max(...n.map((t=>-t[2])))});r.push(i.multiplyRight(a))}return r})),yC=[0,0,0,1],xC=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0];const AC={name:"shadow",dependencies:[xS],vs:"\nconst int max_lights = 2;\nuniform mat4 shadow_uViewProjectionMatrices[max_lights];\nuniform vec4 shadow_uProjectCenters[max_lights];\nuniform bool shadow_uDrawShadowMap;\nuniform bool shadow_uUseShadowMap;\nuniform int shadow_uLightId;\nuniform float shadow_uLightCount;\n\nvarying vec3 shadow_vPosition[max_lights];\n\nvec4 shadow_setVertexPosition(vec4 position_commonspace) {\n if (shadow_uDrawShadowMap) {\n return project_common_position_to_clipspace(position_commonspace, shadow_uViewProjectionMatrices[shadow_uLightId], shadow_uProjectCenters[shadow_uLightId]);\n }\n if (shadow_uUseShadowMap) {\n for (int i = 0; i < max_lights; i++) {\n if(i < int(shadow_uLightCount)) {\n vec4 shadowMap_position = project_common_position_to_clipspace(position_commonspace, shadow_uViewProjectionMatrices[i], shadow_uProjectCenters[i]);\n shadow_vPosition[i] = (shadowMap_position.xyz / shadowMap_position.w + 1.0) / 2.0;\n }\n }\n }\n return gl_Position;\n}\n",fs:"\nconst int max_lights = 2;\nuniform bool shadow_uDrawShadowMap;\nuniform bool shadow_uUseShadowMap;\nuniform sampler2D shadow_uShadowMap0;\nuniform sampler2D shadow_uShadowMap1;\nuniform vec4 shadow_uColor;\nuniform float shadow_uLightCount;\n\nvarying vec3 shadow_vPosition[max_lights];\n\nconst vec4 bitPackShift = vec4(1.0, 255.0, 65025.0, 16581375.0);\nconst vec4 bitUnpackShift = 1.0 / bitPackShift;\nconst vec4 bitMask = vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 0.0);\n\nfloat shadow_getShadowWeight(vec3 position, sampler2D shadowMap) {\n vec4 rgbaDepth = texture2D(shadowMap, position.xy);\n\n float z = dot(rgbaDepth, bitUnpackShift);\n return smoothstep(0.001, 0.01, position.z - z);\n}\n\nvec4 shadow_filterShadowColor(vec4 color) {\n if (shadow_uDrawShadowMap) {\n vec4 rgbaDepth = fract(gl_FragCoord.z * bitPackShift);\n rgbaDepth -= rgbaDepth.gbaa * bitMask;\n return rgbaDepth;\n }\n if (shadow_uUseShadowMap) {\n float shadowAlpha = 0.0;\n shadowAlpha += shadow_getShadowWeight(shadow_vPosition[0], shadow_uShadowMap0);\n if(shadow_uLightCount > 1.0) {\n shadowAlpha += shadow_getShadowWeight(shadow_vPosition[1], shadow_uShadowMap1);\n }\n shadowAlpha *= shadow_uColor.a / shadow_uLightCount;\n float blendedAlpha = shadowAlpha + color.a * (1.0 - shadowAlpha);\n\n return vec4(\n mix(color.rgb, shadow_uColor.rgb, shadowAlpha / blendedAlpha),\n blendedAlpha\n );\n }\n return color;\n}\n",inject:{"vs:DECKGL_FILTER_GL_POSITION":"\n position = shadow_setVertexPosition(geometry.position);\n ","fs:DECKGL_FILTER_COLOR":"\n color = shadow_filterShadowColor(color);\n "},getUniforms:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return"viewport"in t&&(t.drawToShadowMap||t.shadowMaps&&t.shadowMaps.length>0)?function(t,e){const{shadowEnabled:n=!0}=t;if(!n||!t.shadowMatrices||!t.shadowMatrices.length)return{shadow_uDrawShadowMap:!1,shadow_uUseShadowMap:!1};const r={shadow_uDrawShadowMap:Boolean(t.drawToShadowMap),shadow_uUseShadowMap:!!t.shadowMaps&&t.shadowMaps.length>0,shadow_uColor:t.shadowColor||yC,shadow_uLightId:t.shadowLightId||0,shadow_uLightCount:t.shadowMatrices.length},i=vC({viewport:t.viewport,center:e.project_uCenter}),o=[],s=bC({shadowMatrices:t.shadowMatrices,viewport:t.viewport}).slice();for(let a=0;a0?r["shadow_uShadowMap".concat(a)]=t.shadowMaps[a]:r["shadow_uShadowMap".concat(a)]=t.dummyShadowMap;return r}(t,e):{}}},_C={color:[255,255,255],intensity:1},wC=[{color:[255,255,255],intensity:1,direction:[-1,3,-1]},{color:[255,255,255],intensity:.9,direction:[1,-8,-2.5]}],SC=[0,0,0,200/255];class CC{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};ge(this,"id","lighting-effect"),ge(this,"props",void 0),ge(this,"shadowColor",SC),ge(this,"shadow",void 0),ge(this,"ambientLight",void 0),ge(this,"directionalLights",void 0),ge(this,"pointLights",void 0),ge(this,"shadowPasses",[]),ge(this,"shadowMaps",[]),ge(this,"dummyShadowMap",null),ge(this,"programManager",void 0),ge(this,"shadowMatrices",void 0),this.setProps(t)}setProps(t){this.ambientLight=null,this.directionalLights=[],this.pointLights=[];for(const e in t){const n=t[e];switch(n.type){case"ambient":this.ambientLight=n;break;case"directional":this.directionalLights.push(n);break;case"point":this.pointLights.push(n)}}this._applyDefaultLights(),this.shadow=this.directionalLights.some((t=>t.shadow)),this.props=t}preRender(t,e){let{layers:n,layerFilter:r,viewports:i,onViewportActive:o,views:s}=e;if(this.shadow){this.shadowMatrices=this._calculateMatrices(),0===this.shadowPasses.length&&this._createShadowPasses(t),this.programManager||(this.programManager=nS.getDefaultProgramManager(t),AC&&this.programManager.addDefaultModule(AC)),this.dummyShadowMap||(this.dummyShadowMap=new qA(t,{width:1,height:1}));for(let t=0;te.getProjectedLight({layer:t}))),pointLights:this.pointLights.map((e=>e.getProjectedLight({layer:t})))},e}cleanup(){for(const t of this.shadowPasses)t.delete();this.shadowPasses.length=0,this.shadowMaps.length=0,this.dummyShadowMap&&(this.dummyShadowMap.delete(),this.dummyShadowMap=null),this.shadow&&this.programManager&&(this.programManager.removeDefaultModule(AC),this.programManager=null)}_calculateMatrices(){const t=[];for(const e of this.directionalLights){const n=(new Mb).lookAt({eye:new Qv(e.direction).negate()});t.push(n)}return t}_createShadowPasses(t){for(let e=0;ee.id===t.id))){const n=e.findIndex((e=>function(t,e){var n,r;return(null!==(n=t.order)&&void 0!==n?n:1/0)-(null!==(r=e.order)&&void 0!==r?r:1/0)}(e,t)>0));n<0?e.push(t):e.splice(n,0,t),this._setEffects(this.effects)}}setProps(t){"effects"in t&&(CS(t.effects,this.effects,1)||this._setEffects(t.effects))}needsRedraw(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{clearRedrawFlags:!1};const e=this._needsRedraw;return t.clearRedrawFlags&&(this._needsRedraw=!1),e}getEffects(){return this._resolvedEffects}_setEffects(t){const e={};for(const r of this.effects)e[r.id]=r;const n=[];for(const r of t){const t=e[r.id];t&&t!==r?t.setProps?(t.setProps(r.props),n.push(t)):(t.cleanup(),n.push(r)):n.push(r),delete e[r.id]}for(const r in e)e[r].cleanup();this.effects=n,this._resolvedEffects=n.concat(this._defaultEffects),t.some((t=>t instanceof CC))||this._resolvedEffects.push(EC),this._needsRedraw="effects changed"}finalize(){for(const t of this._resolvedEffects)t.cleanup();this.effects.length=0,this._resolvedEffects.length=0,this._defaultEffects.length=0}}class MC extends pC{shouldDrawLayer(t){const{operation:e}=t.props;return e.includes("draw")||e.includes("terrain")}}const TC={blendFunc:[1,0,32771,0],blendEquation:32774};class OC extends pC{constructor(){super(...arguments),ge(this,"pickZ",void 0),ge(this,"_colorEncoderState",null)}render(t){return"pickingFBO"in t?this._drawPickingBuffer(t):super.render(t)}_drawPickingBuffer(t){let{layers:e,layerFilter:n,views:r,viewports:i,onViewportActive:o,pickingFBO:s,deviceRect:{x:a,y:l,width:c,height:u},cullRect:d,effects:h,pass:f="picking",pickZ:p,moduleParameters:g}=t;const m=this.gl;this.pickZ=p;const v=this._resetColorEncoder(p),b=aA(m,{scissorTest:!0,scissor:[a,l,c,u],clearColor:[0,0,0,0],depthMask:!0,depthTest:!0,depthRange:[0,1],colorMask:[!0,!0,!0,!0],...TC,blend:!p},(()=>super.render({target:s,layers:e,layerFilter:n,views:r,viewports:i,onViewportActive:o,cullRect:d,effects:null===h||void 0===h?void 0:h.filter((t=>t.useInPicking)),pass:f,isPicking:!0,moduleParameters:g})));this._colorEncoderState=null;return{decodePickingColor:v&&kC.bind(null,v),stats:b}}shouldDrawLayer(t){const{pickable:e,operation:n}=t.props;return e&&n.includes("draw")||n.includes("terrain")||n.includes("mask")}getModuleParameters(){return{pickingActive:1,pickingAttribute:this.pickZ,lightSources:{}}}getLayerParameters(t,e,n){const r={...t.props.parameters},{pickable:i,operation:o}=t.props;return this._colorEncoderState?i&&o.includes("draw")&&(Object.assign(r,TC),r.blend=!0,r.blendColor=function(t,e,n){const{byLayer:r,byAlpha:i}=t;let o,s=r.get(e);s?(s.viewports.push(n),o=s.a):(o=r.size+1,o<=255?(s={a:o,layer:e,viewports:[n]},r.set(e,s),i[o]=s):(Rg.warn("Too many pickable layers, only picking the first 255")(),o=0));return[0,0,0,o/255]}(this._colorEncoderState,t,n)):r.blend=!1,o.includes("terrain")&&(r.blend=!1),r}_resetColorEncoder(t){return this._colorEncoderState=t?null:{byLayer:new Map,byAlpha:[]},this._colorEncoderState}}function kC(t,e){const n=t.byAlpha[e[3]];return n&&{pickedLayer:n.layer,pickedViewports:n.viewports,pickedObjectIndex:n.layer.decodePickingColor(e)}}class RC{constructor(t){ge(this,"gl",void 0),ge(this,"layerFilter",void 0),ge(this,"drawPickingColors",void 0),ge(this,"drawLayersPass",void 0),ge(this,"pickLayersPass",void 0),ge(this,"renderCount",void 0),ge(this,"_needsRedraw",void 0),ge(this,"renderBuffers",void 0),ge(this,"lastPostProcessEffect",void 0),this.gl=t,this.layerFilter=null,this.drawPickingColors=!1,this.drawLayersPass=new MC(t),this.pickLayersPass=new OC(t),this.renderCount=0,this._needsRedraw="Initial render",this.renderBuffers=[],this.lastPostProcessEffect=null}setProps(t){this.layerFilter!==t.layerFilter&&(this.layerFilter=t.layerFilter,this._needsRedraw="layerFilter changed"),this.drawPickingColors!==t.drawPickingColors&&(this.drawPickingColors=t.drawPickingColors,this._needsRedraw="drawPickingColors changed")}renderLayers(t){if(!t.viewports.length)return;const e=this.drawPickingColors?this.pickLayersPass:this.drawLayersPass,n={layerFilter:this.layerFilter,isPicking:this.drawPickingColors,...t,target:t.target||j_.getDefaultFramebuffer(this.gl)};n.effects&&this._preRender(n.effects,n);const r=this.lastPostProcessEffect?this.renderBuffers[0]:n.target,i=e.render({...n,target:r});n.effects&&this._postRender(n.effects,n),this.renderCount++,Lg("deckRenderer.renderLayers",this,i,t)}needsRedraw(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{clearRedrawFlags:!1};const e=this._needsRedraw;return t.clearRedrawFlags&&(this._needsRedraw=!1),e}finalize(){const{renderBuffers:t}=this;for(const e of t)e.delete();t.length=0}_preRender(t,e){this.lastPostProcessEffect=null,e.preRenderStats=e.preRenderStats||{};for(const n of t)e.preRenderStats[n.id]=n.preRender(this.gl,e),n.postRender&&(this.lastPostProcessEffect=n.id);this.lastPostProcessEffect&&this._resizeRenderBuffers()}_resizeRenderBuffers(){const{renderBuffers:t}=this;0===t.length&&t.push(new j_(this.gl),new j_(this.gl));for(const e of t)e.resize()}_postRender(t,e){const{renderBuffers:n}=this,r={...e,inputBuffer:n[0],swapBuffer:n[1],target:null};for(const i of t)if(i.postRender){if(i.id===this.lastPostProcessEffect){r.target=e.target,i.postRender(this.gl,r);break}const t=i.postRender(this.gl,r);r.inputBuffer=t,r.swapBuffer=t===n[0]?n[1]:n[0]}}}const IC={pickedColor:null,pickedObjectIndex:-1};function BC(t){let{pickedColors:e,decodePickingColor:n,deviceX:r,deviceY:i,deviceRadius:o,deviceRect:s}=t;const{x:a,y:l,width:c,height:u}=s;let d=o*o,h=-1,f=0;for(let p=0;pd)f+=4*c;else for(let i=0;i=0){const t=i+a-r,e=t*t+n;e<=d&&(d=e,h=f)}f+=4}}if(h>=0){const t=e.slice(h,h+4),r=n(t);if(r){const e=Math.floor(h/4/c),n=h/4-e*c;return{...r,pickedColor:t,pickedX:a+n,pickedY:l+e}}Rg.error("Picked non-existent layer. Is picking buffer corrupt?")()}return IC}function LC(t){let e,{pickInfo:n,viewports:r,pixelRatio:i,x:o,y:s,z:a}=t,l=r[0];if(r.length>1&&(l=function(t,e){for(let n=t.length-1;n>=0;n--){const r=t[n];if(r.containsPixel(e))return r}return t[0]}((null===n||void 0===n?void 0:n.pickedViewports)||r,{x:o,y:s})),l){const t=[o-l.x,s-l.y];void 0!==a&&(t[2]=a),e=l.unproject(t)}return{color:null,layer:null,viewport:l,index:-1,picked:!1,x:o,y:s,pixel:[o,s],coordinate:e,devicePixel:n&&"pickedX"in n?[n.pickedX,n.pickedY]:void 0,pixelRatio:i}}function DC(t){const{pickInfo:e,lastPickedInfo:n,mode:r,layers:i}=t,{pickedColor:o,pickedLayer:s,pickedObjectIndex:a}=e,l=s?[s]:[];if("hover"===r){const t=n.index,e=n.layerId,r=s?s.props.id:null;if(r!==e||a!==t){if(r!==e){const t=i.find((t=>t.props.id===e));t&&l.unshift(t)}n.layerId=r,n.index=a,n.info=null}}const c=LC(t),u=new Map;return u.set(null,c),l.forEach((t=>{let e={...c};t===s&&(e.color=o,e.index=a,e.picked=!0),e=FC({layer:t,info:e,mode:r});const i=e.layer;t===s&&"hover"===r&&(n.info=e),u.set(i.id,e),"hover"===r&&i.updateAutoHighlight(e)})),u}function FC(t){let{layer:e,info:n,mode:r}=t;for(;e&&n;){const t=n.layer||null;n.sourceLayer=t,n.layer=e,n=e.getPickingInfo({info:n,mode:r,sourceLayer:t}),e=e.parent}return n}class NC{constructor(t){ge(this,"gl",void 0),ge(this,"pickingFBO",void 0),ge(this,"depthFBO",void 0),ge(this,"pickLayersPass",void 0),ge(this,"layerFilter",void 0),ge(this,"lastPickedInfo",void 0),ge(this,"_pickable",!0),this.gl=t,this.pickLayersPass=new OC(t),this.lastPickedInfo={index:-1,layerId:null,info:null}}setProps(t){"layerFilter"in t&&(this.layerFilter=t.layerFilter),"_pickable"in t&&(this._pickable=t._pickable)}finalize(){this.pickingFBO&&this.pickingFBO.delete(),this.depthFBO&&(this.depthFBO.color.delete(),this.depthFBO.delete())}pickObject(t){return this._pickClosestObject(t)}pickObjects(t){return this._pickVisibleObjects(t)}getLastPickedObject(t){let{x:e,y:n,layers:r,viewports:i}=t,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.lastPickedInfo.info;const s=o&&o.layer&&o.layer.id,a=o&&o.viewport&&o.viewport.id,l=s?r.find((t=>t.id===s)):null,c=a&&i.find((t=>t.id===a))||i[0],u=c&&c.unproject([e-c.x,n-c.y]),d={x:e,y:n,viewport:c,coordinate:u,layer:l};return{...o,...d}}_resizeBuffer(){var t,e;const{gl:n}=this;if(!this.pickingFBO&&(this.pickingFBO=new j_(n),j_.isSupported(n,{colorBufferFloat:!0}))){const t=new j_(n);t.attach({36064:new qA(n,{format:vx(n)?34836:6408,type:5126})}),this.depthFBO=t}null===(t=this.pickingFBO)||void 0===t||t.resize({width:n.canvas.width,height:n.canvas.height}),null===(e=this.depthFBO)||void 0===e||e.resize({width:n.canvas.width,height:n.canvas.height})}_getPickable(t){if(!1===this._pickable)return null;const e=t.filter((t=>this.pickLayersPass.shouldDrawLayer(t)&&!t.isComposite));return e.length?e:null}_pickClosestObject(t){let{layers:e,views:n,viewports:r,x:i,y:o,radius:s=0,depth:a=1,mode:l="query",unproject3D:c,onViewportActive:u,effects:d}=t;const h=this._getPickable(e),f=lA(this.gl);if(!h)return{result:[],emptyInfo:LC({viewports:r,x:i,y:o,pixelRatio:f})};this._resizeBuffer();const p=cA(this.gl,[i,o],!0),g=[p.x+Math.floor(p.width/2),p.y+Math.floor(p.height/2)],m=Math.round(s*f),{width:v,height:b}=this.pickingFBO,y=this._getPickingRect({deviceX:g[0],deviceY:g[1],deviceRadius:m,deviceWidth:v,deviceHeight:b}),x={x:i-s,y:o-s,width:2*s+1,height:2*s+1};let A;const _=[],w=new Set;for(let S=0;S=0){const t=e.slice(i,i+4),o=t.join(",");if(!r.has(o)){const e=n(t);e?r.set(o,{...e,color:t}):Rg.error("Picked non-existent layer. Is picking buffer corrupt?")()}}return Array.from(r.values())}(this._drawAndSample({layers:h,views:n,viewports:r,onViewportActive:u,deviceRect:x,cullRect:{x:i,y:o,width:s,height:a},effects:d,pass:"picking:".concat(l)})),_=new Map,w=Number.isFinite(c);for(let C=0;C=c)break;const t=A[C];let e={color:t.pickedColor,layer:null,index:t.pickedObjectIndex,picked:!0,x:i,y:o,pixelRatio:f};e=FC({layer:t.pickedLayer,info:e,mode:l});const n=null!==(S=e.object)&&void 0!==S?S:"".concat(e.layer.id,"[").concat(e.index,"]");_.has(n)||_.set(n,e)}return Array.from(_.values())}_drawAndSample(t){let{layers:e,views:n,viewports:r,onViewportActive:i,deviceRect:o,cullRect:s,effects:a,pass:l}=t,c=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const u=c?this.depthFBO:this.pickingFBO,d={layers:e,layerFilter:this.layerFilter,views:n,viewports:r,onViewportActive:i,pickingFBO:u,deviceRect:o,cullRect:s,effects:a,pass:l,pickZ:c,preRenderStats:{}};for(const b of a)b.useInPicking&&(d.preRenderStats[b.id]=b.preRender(this.gl,d));const{decodePickingColor:h}=this.pickLayersPass.render(d),{x:f,y:p,width:g,height:m}=o,v=new(c?Float32Array:Uint8Array)(g*m*4);return a_(u,{sourceX:f,sourceY:p,sourceWidth:g,sourceHeight:m,target:v}),{pickedColors:v,decodePickingColor:h}}_getPickingRect(t){let{deviceX:e,deviceY:n,deviceRadius:r,deviceWidth:i,deviceHeight:o}=t;const s=Math.max(0,e-r),a=Math.max(0,n-r),l=Math.min(i,e+r+1)-s,c=Math.min(o,n+r+1)-a;return l<=0||c<=0?null:{x:s,y:a,width:l,height:c}}}const jC={zIndex:"1",position:"absolute",pointerEvents:"none",color:"#a0a7b4",backgroundColor:"#29323c",padding:"10px",top:"0",left:"0",display:"none"};class zC{constructor(t){ge(this,"el",null),ge(this,"isVisible",!1);const e=t.parentElement;e&&(this.el=document.createElement("div"),this.el.className="deck-tooltip",Object.assign(this.el.style,jC),e.appendChild(this.el))}setTooltip(t,e,n){const r=this.el;if(r){if("string"===typeof t)r.innerText=t;else{if(!t)return this.isVisible=!1,void(r.style.display="none");t.text&&(r.innerText=t.text),t.html&&(r.innerHTML=t.html),t.className&&(r.className=t.className)}this.isVisible=!0,r.style.display="block",r.style.transform="translate(".concat(e,"px, ").concat(n,"px)"),t&&"object"===typeof t&&"style"in t&&Object.assign(r.style,t.style)}}remove(){this.el&&(this.el.remove(),this.el=null)}}const{_parseImageNode:UC}=globalThis,VC="undefined"!==typeof Image,GC="undefined"!==typeof ImageBitmap,WC=Boolean(UC),HC=!!pm||WC;function JC(t){const e=XC(t);if(!e)throw new Error("Not an image");return e}function KC(t){switch(JC(t)){case"data":return t;case"image":case"imagebitmap":const e=document.createElement("canvas"),n=e.getContext("2d");if(!n)throw new Error("getImageData");return e.width=t.width,e.height=t.height,n.drawImage(t,0,0),n.getImageData(0,0,t.width,t.height);default:throw new Error("getImageData")}}function XC(t){return"undefined"!==typeof ImageBitmap&&t instanceof ImageBitmap?"imagebitmap":"undefined"!==typeof Image&&t instanceof Image?"image":t&&"object"===typeof t&&t.data&&t.width&&t.height?"data":null}const qC=/^data:image\/svg\+xml/,YC=/\.svg((\?|#).*)?$/;function QC(t){return t&&(qC.test(t)||YC.test(t))}function ZC(t,e){if(QC(e))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(t)])}async function $C(t,e,n){const r=function(t,e){if(QC(e)){let e=(new TextDecoder).decode(t);try{"function"===typeof unescape&&"function"===typeof encodeURIComponent&&(e=unescape(encodeURIComponent(e)))}catch(n){throw new Error(n.message)}return"data:image/svg+xml;base64,".concat(btoa(e))}return ZC(t,e)}(t,n),i=self.URL||self.webkitURL,o="string"!==typeof r&&i.createObjectURL(r);try{return await async function(t,e){const n=new Image;if(n.src=t,e.image&&e.image.decode&&n.decode)return await n.decode(),n;return await new Promise(((e,r)=>{try{n.onload=()=>e(n),n.onerror=e=>r(new Error("Could not load image ".concat(t,": ").concat(e)))}catch(i){r(i)}}))}(o||r,e)}finally{o&&i.revokeObjectURL(o)}}const tE={};let eE=!0;async function nE(t,e,n){let r;if(QC(n)){r=await $C(t,e,n)}else r=ZC(t,n);const i=e&&e.imagebitmap;return await async function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;!function(t){for(const e in t||tE)return!1;return!0}(e)&&eE||(e=null);if(e)try{return await createImageBitmap(t,e)}catch(n){console.warn(n),eE=!1}return await createImageBitmap(t)}(r,i)}function rE(t){return function(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const r=(i=e,[...i].map((t=>t.charCodeAt(0))));var i;for(let o=0;o=24&&2303741511===e.getUint32(0,iE);if(!n)return null;return{mimeType:"image/png",width:e.getUint32(16,iE),height:e.getUint32(20,iE)}}(e)||function(t){const e=aE(t),n=e.byteLength>=3&&65496===e.getUint16(0,iE)&&255===e.getUint8(2);if(!n)return null;const{tableMarkers:r,sofMarkers:i}=function(){const t=new Set([65499,65476,65484,65501,65534]);for(let n=65504;n<65520;++n)t.add(n);const e=new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502]);return{tableMarkers:t,sofMarkers:e}}();let o=2;for(;o+9=10&&1195984440===e.getUint32(0,iE);if(!n)return null;return{mimeType:"image/gif",width:e.getUint16(6,oE),height:e.getUint16(8,oE)}}(e)||function(t){const e=aE(t),n=e.byteLength>=14&&16973===e.getUint16(0,iE)&&e.getUint32(2,oE)===e.byteLength;if(!n)return null;return{mimeType:"image/bmp",width:e.getUint32(18,oE),height:e.getUint32(22,oE)}}(e)||function(t){const e=new Uint8Array(t instanceof DataView?t.buffer:t),n=rE(e);if(!n)return null;return{mimeType:n.mimeType,width:0,height:0}}(e)}function aE(t){if(t instanceof DataView)return t;if(ArrayBuffer.isView(t))return new DataView(t.buffer);if(t instanceof ArrayBuffer)return new DataView(t);throw new Error("toDataView")}const lE={id:"image",module:"images",name:"Images",version:"3.4.15",mimeTypes:["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],extensions:["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],parse:async function(t,e,n){const r=((e=e||{}).image||{}).type||"auto",{url:i}=n||{};let o;switch(function(t){switch(t){case"auto":case"data":return function(){if(GC)return"imagebitmap";if(VC)return"image";if(HC)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}();default:return function(t){switch(t){case"auto":return GC||VC||HC;case"imagebitmap":return GC;case"image":return VC;case"data":return HC;default:throw new Error("@loaders.gl/images: image ".concat(t," not supported in this environment"))}}(t),t}}(r)){case"imagebitmap":o=await nE(t,e,i);break;case"image":o=await $C(t,e,i);break;case"data":o=await async function(t,e){const{mimeType:n}=sE(t)||{},r=globalThis._parseImageNode;return Zg(r),await r(t,n)}(t);break;default:Zg(!1)}return"data"===r&&(o=KC(o)),o},tests:[t=>Boolean(sE(new DataView(t)))],options:{image:{type:"auto",decode:!0}}};const cE={id:"JSON",name:"JSON",module:"",version:"",options:{},extensions:["json","geojson"],mimeTypes:["application/json","application/geo+json"],testText:function(t){const e=t[0],n=t[t.length-1];return"{"===e&&"}"===n||"["===e&&"]"===n},parseTextSync:JSON.parse};const uE=function(){const t="8.9.35",e=globalThis.deck&&globalThis.deck.VERSION;if(e&&e!==t)throw new Error("deck.gl - multiple versions detected: ".concat(e," vs ").concat(t));return e||(Rg.log(1,"deck.gl ".concat(t))(),globalThis.deck={...globalThis.deck,VERSION:t,version:t,log:Rg,_registerLoggers:Bg},function(t){const e=lv();t=Array.isArray(t)?t:[t];for(const n of t){const t=tm(n);e.find((e=>t===e))||e.unshift(t)}}([cE,[lE,{imagebitmap:{premultiplyAlpha:"none"}}]])),t}(),dE=globalThis;function hE(t){if(!t&&!hg())return"Node";if(dg(t))return"Electron";const e="undefined"!==typeof navigator?navigator:{},n=t||e.userAgent||"";if(n.indexOf("Edge")>-1)return"Edge";const r=-1!==n.indexOf("MSIE "),i=-1!==n.indexOf("Trident/");return r||i?"IE":dE.chrome?"Chrome":dE.safari?"Safari":dE.mozInnerScreenX?"Firefox":"Unknown"}class fE extends TA{get[Symbol.toStringTag](){return"Query"}static isSupported(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const n=vx(t),r=D_(t,f_);let i=n||r;for(const o of e)switch(o){case"queries":i=i&&n;break;case"timers":i=i&&r;break;default:xA(!1)}return i}constructor(t){super(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}),this.target=null,this._queryPending=!1,this._pollingPromise=null,Object.seal(this)}beginTimeElapsedQuery(){return this.begin(35007)}beginOcclusionQuery(){let{conservative:t=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.begin(t?36202:35887)}beginTransformFeedbackQuery(){return this.begin(35976)}begin(t){return this._queryPending||(this.target=t,this.gl2.beginQuery(this.target,this.handle)),this}end(){return this._queryPending||this.target&&(this.gl2.endQuery(this.target),this.target=null,this._queryPending=!0),this}isResultAvailable(){if(!this._queryPending)return!1;const t=this.gl2.getQueryParameter(this.handle,34919);return t&&(this._queryPending=!1),t}isTimerDisjoint(){return this.gl2.getParameter(36795)}getResult(){return this.gl2.getQueryParameter(this.handle,34918)}getTimerMilliseconds(){return this.getResult()/1e6}createPoll(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.POSITIVE_INFINITY;if(this._pollingPromise)return this._pollingPromise;let e=0;return this._pollingPromise=new Promise(((n,r)=>{const i=()=>{this.isResultAvailable()?(n(this.getResult()),this._pollingPromise=null):e++>t?(r("Timed out"),this._pollingPromise=null):requestAnimationFrame(i)};requestAnimationFrame(i)})),this._pollingPromise}_createHandle(){return fE.isSupported(this.gl)?this.gl2.createQuery():null}_deleteHandle(){this.gl2.deleteQuery(this.handle)}}const pE=hg()&&"undefined"!==typeof document;let gE=0;class mE{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{onCreateContext:e=(t=>gA(t)),onAddHTML:n=null,onInitialize:r=(()=>{}),onRender:i=(()=>{}),onFinalize:o=(()=>{}),onError:s,gl:a=null,glOptions:l={},debug:c=!1,createFramebuffer:u=!1,autoResizeViewport:d=!0,autoResizeDrawingBuffer:h=!0,stats:f=yA.get("animation-loop-".concat(gE++))}=t;let{useDevicePixels:p=!0}=t;"useDevicePixelRatio"in t&&(hx.deprecated("useDevicePixelRatio","useDevicePixels")(),p=t.useDevicePixelRatio),this.props={onCreateContext:e,onAddHTML:n,onInitialize:r,onRender:i,onFinalize:o,onError:s,gl:a,glOptions:l,debug:c,createFramebuffer:u},this.gl=a,this.needsRedraw=null,this.timeline=null,this.stats=f,this.cpuTime=this.stats.get("CPU Time"),this.gpuTime=this.stats.get("GPU Time"),this.frameRate=this.stats.get("Frame Rate"),this._initialized=!1,this._running=!1,this._animationFrameId=null,this._nextFramePromise=null,this._resolveNextFrame=null,this._cpuStartTime=0,this.setProps({autoResizeViewport:d,autoResizeDrawingBuffer:h,useDevicePixels:p}),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this._pageLoadPromise=null,this._onMousemove=this._onMousemove.bind(this),this._onMouseleave=this._onMouseleave.bind(this)}delete(){this.stop(),this._setDisplay(null)}setNeedsRedraw(t){return xA("string"===typeof t),this.needsRedraw=this.needsRedraw||t,this}setProps(t){return"autoResizeViewport"in t&&(this.autoResizeViewport=t.autoResizeViewport),"autoResizeDrawingBuffer"in t&&(this.autoResizeDrawingBuffer=t.autoResizeDrawingBuffer),"useDevicePixels"in t&&(this.useDevicePixels=t.useDevicePixels),this}start(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this._running)return this;this._running=!0;const e=this._getPageLoadPromise().then((()=>!this._running||this._initialized?null:(this._createWebGLContext(t),this._createFramebuffer(),this._startEventHandling(),this._initializeCallbackData(),this._updateCallbackData(),this._resizeCanvasDrawingBuffer(),this._resizeViewport(),this._gpuTimeQuery=fE.isSupported(this.gl,["timers"])?new fE(this.gl):null,this._initialized=!0,this.onInitialize(this.animationProps)))).then((t=>{this._running&&(this._addCallbackData(t||{}),!1!==t&&this._startLoop())}));return this.props.onError&&e.catch(this.props.onError),this}redraw(){return this.isContextLost()||(this._beginTimers(),this._setupFrame(),this._updateCallbackData(),this._renderFrame(this.animationProps),this._clearNeedsRedraw(),this.offScreen&&this.gl.commit&&this.gl.commit(),this._resolveNextFrame&&(this._resolveNextFrame(this),this._nextFramePromise=null,this._resolveNextFrame=null),this._endTimers()),this}stop(){return this._running&&(this._finalizeCallbackData(),this._cancelAnimationFrame(this._animationFrameId),this._nextFramePromise=null,this._resolveNextFrame=null,this._animationFrameId=null,this._running=!1),this}attachTimeline(t){return this.timeline=t,this.timeline}detachTimeline(){this.timeline=null}waitForRender(){return this.setNeedsRedraw("waitForRender"),this._nextFramePromise||(this._nextFramePromise=new Promise((t=>{this._resolveNextFrame=t}))),this._nextFramePromise}async toDataURL(){return this.setNeedsRedraw("toDataURL"),await this.waitForRender(),this.gl.canvas.toDataURL()}isContextLost(){return this.gl.isContextLost()}onCreateContext(){return this.props.onCreateContext(...arguments)}onInitialize(){return this.props.onInitialize(...arguments)}onRender(){return this.props.onRender(...arguments)}onFinalize(){return this.props.onFinalize(...arguments)}getHTMLControlValue(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const n=document.getElementById(t);return n?Number(n.value):e}setViewParameters(){return hx.removed("AnimationLoop.setViewParameters","AnimationLoop.setProps")(),this}_startLoop(){const t=()=>{this._running&&(this.redraw(),this._animationFrameId=this._requestAnimationFrame(t))};this._cancelAnimationFrame(this._animationFrameId),this._animationFrameId=this._requestAnimationFrame(t)}_getPageLoadPromise(){return this._pageLoadPromise||(this._pageLoadPromise=pE?new Promise(((t,e)=>{pE&&"complete"===document.readyState?t(document):window.addEventListener("load",(()=>{t(document)}))})):Promise.resolve({})),this._pageLoadPromise}_setDisplay(t){this.display&&(this.display.delete(),this.display.animationLoop=null),t&&(t.animationLoop=this),this.display=t}_cancelAnimationFrame(t){return this.display&&this.display.cancelAnimationFrame?this.display.cancelAnimationFrame(t):(e=t,"undefined"!==typeof window&&window.cancelAnimationFrame?window.cancelAnimationFrame(e):clearTimeout(e));var e}_requestAnimationFrame(t){if(this._running)return this.display&&this.display.requestAnimationFrame?this.display.requestAnimationFrame(t):function(t){return"undefined"!==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame(t):setTimeout(t,1e3/60)}(t)}_renderFrame(){this.display?this.display._renderFrame(...arguments):this.onRender(...arguments)}_clearNeedsRedraw(){this.needsRedraw=null}_setupFrame(){this._resizeCanvasDrawingBuffer(),this._resizeViewport(),this._resizeFramebuffer()}_initializeCallbackData(){this.animationProps={gl:this.gl,stop:this.stop,canvas:this.gl.canvas,framebuffer:this.framebuffer,useDevicePixels:this.useDevicePixels,needsRedraw:null,startTime:Date.now(),engineTime:0,tick:0,tock:0,time:0,_timeline:this.timeline,_loop:this,_animationLoop:this,_mousePosition:null}}_updateCallbackData(){const{width:t,height:e,aspect:n}=this._getSizeAndAspect();t===this.animationProps.width&&e===this.animationProps.height||this.setNeedsRedraw("drawing buffer resized"),n!==this.animationProps.aspect&&this.setNeedsRedraw("drawing buffer aspect changed"),this.animationProps.width=t,this.animationProps.height=e,this.animationProps.aspect=n,this.animationProps.needsRedraw=this.needsRedraw,this.animationProps.engineTime=Date.now()-this.animationProps.startTime,this.timeline&&this.timeline.update(this.animationProps.engineTime),this.animationProps.tick=Math.floor(this.animationProps.time/1e3*60),this.animationProps.tock++,this.animationProps.time=this.timeline?this.timeline.getTime():this.animationProps.engineTime,this.animationProps._offScreen=this.offScreen}_finalizeCallbackData(){this.onFinalize(this.animationProps)}_addCallbackData(t){"object"===typeof t&&null!==t&&(this.animationProps=Object.assign({},this.animationProps,t))}_createWebGLContext(t){if(this.offScreen=t.canvas&&"undefined"!==typeof OffscreenCanvas&&t.canvas instanceof OffscreenCanvas,t=Object.assign({},t,this.props.glOptions),this.gl=this.props.gl?mA(this.props.gl,t):this.onCreateContext(t),!mx(this.gl))throw new Error("AnimationLoop.onCreateContext - illegal context returned");oA(this.gl,Ux),this._createInfoDiv()}_createInfoDiv(){if(this.gl.canvas&&this.props.onAddHTML){const t=document.createElement("div");document.body.appendChild(t),t.style.position="relative";const e=document.createElement("div");e.style.position="absolute",e.style.left="10px",e.style.bottom="10px",e.style.width="300px",e.style.background="white",t.appendChild(this.gl.canvas),t.appendChild(e);const n=this.props.onAddHTML(e);n&&(e.innerHTML=n)}}_getSizeAndAspect(){const t=this.gl.drawingBufferWidth,e=this.gl.drawingBufferHeight;let n=1;const{canvas:r}=this.gl;return r&&r.clientHeight?n=r.clientWidth/r.clientHeight:t>0&&e>0&&(n=t/e),{width:t,height:e,aspect:n}}_resizeViewport(){this.autoResizeViewport&&this.gl.viewport(0,0,this.gl.drawingBufferWidth,this.gl.drawingBufferHeight)}_resizeCanvasDrawingBuffer(){this.autoResizeDrawingBuffer&&vA(this.gl,{useDevicePixels:this.useDevicePixels})}_createFramebuffer(){this.props.createFramebuffer&&(this.framebuffer=new j_(this.gl))}_resizeFramebuffer(){this.framebuffer&&this.framebuffer.resize({width:this.gl.drawingBufferWidth,height:this.gl.drawingBufferHeight})}_beginTimers(){this.frameRate.timeEnd(),this.frameRate.timeStart(),this._gpuTimeQuery&&this._gpuTimeQuery.isResultAvailable()&&!this._gpuTimeQuery.isTimerDisjoint()&&this.stats.get("GPU Time").addTime(this._gpuTimeQuery.getTimerMilliseconds()),this._gpuTimeQuery&&this._gpuTimeQuery.beginTimeElapsedQuery(),this.cpuTime.timeStart()}_endTimers(){this.cpuTime.timeEnd(),this._gpuTimeQuery&&this._gpuTimeQuery.end()}_startEventHandling(){const{canvas:t}=this.gl;t&&(t.addEventListener("mousemove",this._onMousemove),t.addEventListener("mouseleave",this._onMouseleave))}_onMousemove(t){this.animationProps._mousePosition=[t.offsetX,t.offsetY]}_onMouseleave(t){this.animationProps._mousePosition=null}}var vE=n(6895);const bE={mousedown:1,mousemove:2,mouseup:4};!function(t){const e=t.prototype.handler;t.prototype.handler=function(t){const n=this.store;t.button>0&&"pointerdown"===t.type&&(function(t,e){for(let n=0;ne.pointerId===t.pointerId))||n.push(t)),e.call(this,t)}}(vE.PointerEventInput),vE.MouseInput.prototype.handler=function(t){let e=bE[t.type];1&e&&t.button>=0&&(this.pressed=!0),2&e&&0===t.which&&(e=4),this.pressed&&(4&e&&(this.pressed=!1),this.callback(this.manager,e,{pointers:[t],changedPointers:[t],pointerType:"mouse",srcEvent:t}))};const yE=vE.Manager,xE=vE;class AE{constructor(t,e,n){this.element=t,this.callback=e,this.options={enable:!0,...n}}}const _E=xE?[[xE.Pan,{event:"tripan",pointers:3,threshold:0,enable:!1}],[xE.Rotate,{enable:!1}],[xE.Pinch,{enable:!1}],[xE.Swipe,{enable:!1}],[xE.Pan,{threshold:0,enable:!1}],[xE.Press,{enable:!1}],[xE.Tap,{event:"doubletap",taps:2,enable:!1}],[xE.Tap,{event:"anytap",enable:!1}],[xE.Tap,{enable:!1}]]:null,wE={tripan:["rotate","pinch","pan"],rotate:["pinch"],pinch:["pan"],pan:["press","doubletap","anytap","tap"],doubletap:["anytap"],anytap:["tap"]},SE={doubletap:["tap"]},CE={pointerdown:"pointerdown",pointermove:"pointermove",pointerup:"pointerup",touchstart:"pointerdown",touchmove:"pointermove",touchend:"pointerup",mousedown:"pointerdown",mousemove:"pointermove",mouseup:"pointerup"},EE={KEY_EVENTS:["keydown","keyup"],MOUSE_EVENTS:["mousedown","mousemove","mouseup","mouseover","mouseout","mouseleave"],WHEEL_EVENTS:["wheel","mousewheel"]},PE={tap:"tap",anytap:"anytap",doubletap:"doubletap",press:"press",pinch:"pinch",pinchin:"pinch",pinchout:"pinch",pinchstart:"pinch",pinchmove:"pinch",pinchend:"pinch",pinchcancel:"pinch",rotate:"rotate",rotatestart:"rotate",rotatemove:"rotate",rotateend:"rotate",rotatecancel:"rotate",tripan:"tripan",tripanstart:"tripan",tripanmove:"tripan",tripanup:"tripan",tripandown:"tripan",tripanleft:"tripan",tripanright:"tripan",tripanend:"tripan",tripancancel:"tripan",pan:"pan",panstart:"pan",panmove:"pan",panup:"pan",pandown:"pan",panleft:"pan",panright:"pan",panend:"pan",pancancel:"pan",swipe:"swipe",swipeleft:"swipe",swiperight:"swipe",swipeup:"swipe",swipedown:"swipe"},ME={click:"tap",anyclick:"anytap",dblclick:"doubletap",mousedown:"pointerdown",mousemove:"pointermove",mouseup:"pointerup",mouseover:"pointerover",mouseout:"pointerout",mouseleave:"pointerleave"},TE="undefined"!==typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",OE="undefined"!==typeof window?window:n.g;"undefined"!==typeof n.g?n.g:window,"undefined"!==typeof document&&document;let kE=!1;try{const t={get passive(){return kE=!0,!0}};OE.addEventListener("test",null,t),OE.removeEventListener("test",null)}catch(g$){kE=!1}const RE=-1!==TE.indexOf("firefox"),{WHEEL_EVENTS:IE}=EE,BE="wheel",LE=4.000244140625;class DE extends AE{constructor(t,e,n){super(t,e,n),this.handleEvent=t=>{if(!this.options.enable)return;let e=t.deltaY;OE.WheelEvent&&(RE&&t.deltaMode===OE.WheelEvent.DOM_DELTA_PIXEL&&(e/=OE.devicePixelRatio),t.deltaMode===OE.WheelEvent.DOM_DELTA_LINE&&(e*=40)),0!==e&&e%LE===0&&(e=Math.floor(e/LE)),t.shiftKey&&e&&(e*=.25),this.callback({type:BE,center:{x:t.clientX,y:t.clientY},delta:-e,srcEvent:t,pointerType:"mouse",target:t.target})},this.events=(this.options.events||[]).concat(IE),this.events.forEach((e=>t.addEventListener(e,this.handleEvent,!!kE&&{passive:!1})))}destroy(){this.events.forEach((t=>this.element.removeEventListener(t,this.handleEvent)))}enableEventType(t,e){t===BE&&(this.options.enable=e)}}const{MOUSE_EVENTS:FE}=EE,NE="pointermove",jE="pointerover",zE="pointerout",UE="pointerenter",VE="pointerleave";class GE extends AE{constructor(t,e,n){super(t,e,n),this.handleEvent=t=>{this.handleOverEvent(t),this.handleOutEvent(t),this.handleEnterEvent(t),this.handleLeaveEvent(t),this.handleMoveEvent(t)},this.pressed=!1;const{enable:r}=this.options;this.enableMoveEvent=r,this.enableLeaveEvent=r,this.enableEnterEvent=r,this.enableOutEvent=r,this.enableOverEvent=r,this.events=(this.options.events||[]).concat(FE),this.events.forEach((e=>t.addEventListener(e,this.handleEvent)))}destroy(){this.events.forEach((t=>this.element.removeEventListener(t,this.handleEvent)))}enableEventType(t,e){t===NE&&(this.enableMoveEvent=e),t===jE&&(this.enableOverEvent=e),t===zE&&(this.enableOutEvent=e),t===UE&&(this.enableEnterEvent=e),t===VE&&(this.enableLeaveEvent=e)}handleOverEvent(t){this.enableOverEvent&&"mouseover"===t.type&&this._emit(jE,t)}handleOutEvent(t){this.enableOutEvent&&"mouseout"===t.type&&this._emit(zE,t)}handleEnterEvent(t){this.enableEnterEvent&&"mouseenter"===t.type&&this._emit(UE,t)}handleLeaveEvent(t){this.enableLeaveEvent&&"mouseleave"===t.type&&this._emit(VE,t)}handleMoveEvent(t){if(this.enableMoveEvent)switch(t.type){case"mousedown":t.button>=0&&(this.pressed=!0);break;case"mousemove":0===t.which&&(this.pressed=!1),this.pressed||this._emit(NE,t);break;case"mouseup":this.pressed=!1}}_emit(t,e){this.callback({type:t,center:{x:e.clientX,y:e.clientY},srcEvent:e,pointerType:"mouse",target:e.target})}}const{KEY_EVENTS:WE}=EE,HE="keydown",JE="keyup";class KE extends AE{constructor(t,e,n){super(t,e,n),this.handleEvent=t=>{const e=t.target||t.srcElement;"INPUT"===e.tagName&&"text"===e.type||"TEXTAREA"===e.tagName||(this.enableDownEvent&&"keydown"===t.type&&this.callback({type:HE,srcEvent:t,key:t.key,target:t.target}),this.enableUpEvent&&"keyup"===t.type&&this.callback({type:JE,srcEvent:t,key:t.key,target:t.target}))},this.enableDownEvent=this.options.enable,this.enableUpEvent=this.options.enable,this.events=(this.options.events||[]).concat(WE),t.tabIndex=this.options.tabIndex||0,t.style.outline="none",this.events.forEach((e=>t.addEventListener(e,this.handleEvent)))}destroy(){this.events.forEach((t=>this.element.removeEventListener(t,this.handleEvent)))}enableEventType(t,e){t===HE&&(this.enableDownEvent=e),t===JE&&(this.enableUpEvent=e)}}const XE="contextmenu";class qE extends AE{constructor(t,e,n){super(t,e,n),this.handleEvent=t=>{this.options.enable&&this.callback({type:XE,center:{x:t.clientX,y:t.clientY},srcEvent:t,pointerType:"mouse",target:t.target})},t.addEventListener("contextmenu",this.handleEvent)}destroy(){this.element.removeEventListener("contextmenu",this.handleEvent)}enableEventType(t,e){t===XE&&(this.options.enable=e)}}const YE={pointerdown:1,pointermove:2,pointerup:4,mousedown:1,mousemove:2,mouseup:4};function QE(t){const e=YE[t.srcEvent.type];if(!e)return null;const{buttons:n,button:r,which:i}=t.srcEvent;let o=!1,s=!1,a=!1;return 4===e||2===e&&!Number.isFinite(n)?(o=1===i,s=2===i,a=3===i):2===e?(o=Boolean(1&n),s=Boolean(4&n),a=Boolean(2&n)):1===e&&(o=0===r,s=1===r,a=2===r),{leftButton:o,middleButton:s,rightButton:a}}function ZE(t,e){const n=t.center;if(!n)return null;const r=e.getBoundingClientRect(),i=r.width/e.offsetWidth||1,o=r.height/e.offsetHeight||1;return{center:n,offsetCenter:{x:(n.x-r.left-e.clientLeft)/i,y:(n.y-r.top-e.clientTop)/o}}}const $E={srcElement:"root",priority:0};class tP{constructor(t){this.handleEvent=t=>{if(this.isEmpty())return;const e=this._normalizeEvent(t);let n=t.srcEvent.target;for(;n&&n!==e.rootElement;){if(this._emit(e,n),e.handled)return;n=n.parentNode}this._emit(e,"root")},this.eventManager=t,this.handlers=[],this.handlersByElement=new Map,this._active=!1}isEmpty(){return!this._active}add(t,e,n){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const{handlers:o,handlersByElement:s}=this;let a=$E;"string"===typeof n||n&&n.addEventListener?a={...$E,srcElement:n}:n&&(a={...$E,...n});let l=s.get(a.srcElement);l||(l=[],s.set(a.srcElement,l));const c={type:t,handler:e,srcElement:a.srcElement,priority:a.priority};r&&(c.once=!0),i&&(c.passive=!0),o.push(c),this._active=this._active||!c.passive;let u=l.length-1;for(;u>=0&&!(l[u].priority>=c.priority);)u--;l.splice(u+1,0,c)}remove(t,e){const{handlers:n,handlersByElement:r}=this;for(let i=n.length-1;i>=0;i--){const o=n[i];if(o.type===t&&o.handler===e){n.splice(i,1);const t=r.get(o.srcElement);t.splice(t.indexOf(o),1),0===t.length&&r.delete(o.srcElement)}}this._active=n.some((t=>!t.passive))}_emit(t,e){const n=this.handlersByElement.get(e);if(n){let e=!1;const r=()=>{t.handled=!0},i=()=>{t.handled=!0,e=!0},o=[];for(let s=0;s{t.srcEvent.preventDefault()},stopImmediatePropagation:null,stopPropagation:null,handled:!1,rootElement:e}}}const eP={events:null,recognizers:null,recognizerOptions:{},Manager:yE,touchAction:"none",tabIndex:0};class nP{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1?arguments[1]:void 0;this._onBasicInput=t=>{const{srcEvent:e}=t,n=CE[e.type];n&&this.manager.emit(n,t)},this._onOtherEvent=t=>{this.manager.emit(t.type,t)},this.options={...eP,...e},this.events=new Map,this.setElement(t);const{events:n}=this.options;n&&this.on(n)}getElement(){return this.element}setElement(t){if(this.element&&this.destroy(),this.element=t,!t)return;const{options:e}=this,n=e.Manager;this.manager=new n(t,{touchAction:e.touchAction,recognizers:e.recognizers||_E}).on("hammer.input",this._onBasicInput),e.recognizers||Object.keys(wE).forEach((t=>{const e=this.manager.get(t);e&&wE[t].forEach((t=>{e.recognizeWith(t)}))}));for(const r in e.recognizerOptions){const t=this.manager.get(r);if(t){const n=e.recognizerOptions[r];delete n.enable,t.set(n)}}this.wheelInput=new DE(t,this._onOtherEvent,{enable:!1}),this.moveInput=new GE(t,this._onOtherEvent,{enable:!1}),this.keyInput=new KE(t,this._onOtherEvent,{enable:!1,tabIndex:e.tabIndex}),this.contextmenuInput=new qE(t,this._onOtherEvent,{enable:!1});for(const[r,i]of this.events)i.isEmpty()||(this._toggleRecognizer(i.recognizerName,!0),this.manager.on(r,i.handleEvent))}destroy(){this.element&&(this.wheelInput.destroy(),this.moveInput.destroy(),this.keyInput.destroy(),this.contextmenuInput.destroy(),this.manager.destroy(),this.wheelInput=null,this.moveInput=null,this.keyInput=null,this.contextmenuInput=null,this.manager=null,this.element=null)}on(t,e,n){this._addEventHandler(t,e,n,!1)}once(t,e,n){this._addEventHandler(t,e,n,!0)}watch(t,e,n){this._addEventHandler(t,e,n,!1,!0)}off(t,e){this._removeEventHandler(t,e)}_toggleRecognizer(t,e){const{manager:n}=this;if(!n)return;const r=n.get(t);if(r&&r.options.enable!==e){r.set({enable:e});const i=SE[t];i&&!this.options.recognizers&&i.forEach((i=>{const o=n.get(i);e?(o.requireFailure(t),r.dropRequireFailure(i)):o.dropRequireFailure(t)}))}this.wheelInput.enableEventType(t,e),this.moveInput.enableEventType(t,e),this.keyInput.enableEventType(t,e),this.contextmenuInput.enableEventType(t,e)}_addEventHandler(t,e,n,r,i){if("string"!==typeof t){n=e;for(const e in t)this._addEventHandler(e,t[e],n,r,i);return}const{manager:o,events:s}=this,a=ME[t]||t;let l=s.get(a);l||(l=new tP(this),s.set(a,l),l.recognizerName=PE[a]||a,o&&o.on(a,l.handleEvent)),l.add(t,e,n,r,i),l.isEmpty()||this._toggleRecognizer(l.recognizerName,!0)}_removeEventHandler(t,e){if("string"!==typeof t){for(const e in t)this._removeEventHandler(e,t[e]);return}const{events:n}=this,r=ME[t]||t,i=n.get(r);if(i&&(i.remove(t,e),i.isEmpty())){const{recognizerName:t}=i;let e=!1;for(const r of n.values())if(r.recognizerName===t&&!r.isEmpty()){e=!0;break}e||this._toggleRecognizer(t,!1)}}}function rP(){}const iP={id:"",width:"100%",height:"100%",style:null,viewState:null,initialViewState:null,pickingRadius:0,layerFilter:null,glOptions:{},parameters:{},parent:null,gl:null,canvas:null,layers:[],effects:[],views:null,controller:null,useDevicePixels:!0,touchAction:"none",eventRecognizerOptions:{},_framebuffer:null,_animate:!1,_pickable:!0,_typedArrayManagerProps:{},_customRender:null,onWebGLInitialized:rP,onResize:rP,onViewStateChange:rP,onInteractionStateChange:rP,onBeforeRender:rP,onAfterRender:rP,onLoad:rP,onError:t=>Rg.error(t.message,t.cause)(),onHover:null,onClick:null,onDragStart:null,onDrag:null,onDragEnd:null,_onMetrics:null,getCursor:t=>{let{isDragging:e}=t;return e?"grabbing":"grab"},getTooltip:null,debug:!1,drawPickingColors:!1};class oP{constructor(t){ge(this,"props",void 0),ge(this,"width",0),ge(this,"height",0),ge(this,"userData",{}),ge(this,"canvas",null),ge(this,"viewManager",null),ge(this,"layerManager",null),ge(this,"effectManager",null),ge(this,"deckRenderer",null),ge(this,"deckPicker",null),ge(this,"eventManager",null),ge(this,"tooltip",null),ge(this,"metrics",void 0),ge(this,"animationLoop",void 0),ge(this,"stats",void 0),ge(this,"viewState",void 0),ge(this,"cursorState",void 0),ge(this,"_needsRedraw",void 0),ge(this,"_pickRequest",void 0),ge(this,"_lastPointerDownInfo",null),ge(this,"_metricsCounter",void 0),ge(this,"_onPointerMove",(t=>{const{_pickRequest:e}=this;if("pointerleave"===t.type)e.x=-1,e.y=-1,e.radius=0;else{if(t.leftButton||t.rightButton)return;{const n=t.offsetCenter;if(!n)return;e.x=n.x,e.y=n.y,e.radius=this.props.pickingRadius}}this.layerManager&&(this.layerManager.context.mousePosition={x:e.x,y:e.y}),e.event=t})),ge(this,"_onEvent",(t=>{const e=py[t.type],n=t.offsetCenter;if(!e||!n||!this.layerManager)return;const r=this.layerManager.getLayers(),i=this.deckPicker.getLastPickedObject({x:n.x,y:n.y,layers:r,viewports:this.getViewports(n)},this._lastPointerDownInfo),{layer:o}=i,s=o&&(o[e.handler]||o.props[e.handler]),a=this.props[e.handler];let l=!1;s&&(l=s.call(o,i,t)),!l&&a&&a(i,t)})),ge(this,"_onPointerDown",(t=>{const e=t.offsetCenter,n=this._pick("pickObject","pickObject Time",{x:e.x,y:e.y,radius:this.props.pickingRadius});this._lastPointerDownInfo=n.result[0]||n.emptyInfo})),this.props={...iP,...t},t=this.props,this._needsRedraw="Initial render",this._pickRequest={mode:"hover",x:-1,y:-1,radius:0,event:null},this.cursorState={isHovering:!1,isDragging:!1},t.viewState&&t.initialViewState&&Rg.warn("View state tracking is disabled. Use either `initialViewState` for auto update or `viewState` for manual update.")(),"IE"===hE()&&Rg.warn("IE 11 is not supported")(),this.viewState=t.initialViewState,t.gl||"undefined"!==typeof document&&(this.canvas=this._createCanvas(t)),this.animationLoop=this._createAnimationLoop(t),this.stats=new Ug({id:"deck.gl"}),this.metrics={fps:0,setPropsTime:0,updateAttributesTime:0,framesRedrawn:0,pickTime:0,pickCount:0,gpuTime:0,gpuTimePerFrame:0,cpuTime:0,cpuTimePerFrame:0,bufferMemory:0,textureMemory:0,renderbufferMemory:0,gpuMemory:0},this._metricsCounter=0,this.setProps(t),t._typedArrayManagerProps&&_v.setOptions(t._typedArrayManagerProps),this.animationLoop.start()}finalize(){var t,e,n,r,i,o,s,a,l;(null===(t=this.animationLoop)||void 0===t||t.stop(),this.animationLoop=null,this._lastPointerDownInfo=null,null===(e=this.layerManager)||void 0===e||e.finalize(),this.layerManager=null,null===(n=this.viewManager)||void 0===n||n.finalize(),this.viewManager=null,null===(r=this.effectManager)||void 0===r||r.finalize(),this.effectManager=null,null===(i=this.deckRenderer)||void 0===i||i.finalize(),this.deckRenderer=null,null===(o=this.deckPicker)||void 0===o||o.finalize(),this.deckPicker=null,null===(s=this.eventManager)||void 0===s||s.destroy(),this.eventManager=null,null===(a=this.tooltip)||void 0===a||a.remove(),this.tooltip=null,this.props.canvas||this.props.gl||!this.canvas)||(null===(l=this.canvas.parentElement)||void 0===l||l.removeChild(this.canvas),this.canvas=null)}setProps(t){this.stats.get("setProps Time").timeStart(),"onLayerHover"in t&&Rg.removed("onLayerHover","onHover")(),"onLayerClick"in t&&Rg.removed("onLayerClick","onClick")(),t.initialViewState&&!CS(this.props.initialViewState,t.initialViewState,3)&&(this.viewState=t.initialViewState),Object.assign(this.props,t),this._setCanvasSize(this.props);const e=Object.create(this.props);Object.assign(e,{views:this._getViews(),width:this.width,height:this.height,viewState:this._getViewState()}),this.animationLoop.setProps(e),this.layerManager&&(this.viewManager.setProps(e),this.layerManager.activateViewport(this.getViewports()[0]),this.layerManager.setProps(e),this.effectManager.setProps(e),this.deckRenderer.setProps(e),this.deckPicker.setProps(e)),this.stats.get("setProps Time").timeEnd()}needsRedraw(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{clearRedrawFlags:!1};if(!this.layerManager)return!1;if(this.props._animate)return"Deck._animate";let e=this._needsRedraw;t.clearRedrawFlags&&(this._needsRedraw=!1);const n=this.viewManager.needsRedraw(t),r=this.layerManager.needsRedraw(t),i=this.effectManager.needsRedraw(t),o=this.deckRenderer.needsRedraw(t);return e=e||n||r||i||o,e}redraw(t){if(!this.layerManager)return;let e=this.needsRedraw({clearRedrawFlags:!0});e=t||e,e&&(this.stats.get("Redraw Count").incrementCount(),this.props._customRender?this.props._customRender(e):this._drawLayers(e))}get isInitialized(){return null!==this.viewManager}getViews(){return OS(this.viewManager),this.viewManager.views}getViewports(t){return OS(this.viewManager),this.viewManager.getViewports(t)}getCanvas(){return this.canvas}pickObject(t){const e=this._pick("pickObject","pickObject Time",t).result;return e.length?e[0]:null}pickMultipleObjects(t){return t.depth=t.depth||10,this._pick("pickObject","pickMultipleObjects Time",t).result}pickObjects(t){return this._pick("pickObjects","pickObjects Time",t)}_addResources(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];for(const n in t)this.layerManager.resourceManager.add({resourceId:n,data:t[n],forceUpdate:e})}_removeResources(t){for(const e of t)this.layerManager.resourceManager.remove(e)}_addDefaultEffect(t){this.effectManager.addDefaultEffect(t)}_pick(t,e,n){OS(this.deckPicker);const{stats:r}=this;r.get("Pick Count").incrementCount(),r.get(e).timeStart();const i=this.deckPicker[t]({layers:this.layerManager.getLayers(n),views:this.viewManager.getViews(),viewports:this.getViewports(n),onViewportActive:this.layerManager.activateViewport,effects:this.effectManager.getEffects(),...n});return r.get(e).timeEnd(),i}_createCanvas(t){let e=t.canvas;if("string"===typeof e&&(e=document.getElementById(e),OS(e)),!e){e=document.createElement("canvas"),e.id=t.id||"deckgl-overlay";(t.parent||document.body).appendChild(e)}return Object.assign(e.style,t.style),e}_setCanvasSize(t){if(!this.canvas)return;const{width:e,height:n}=t;if(e||0===e){const t=Number.isFinite(e)?"".concat(e,"px"):e;this.canvas.style.width=t}if(n||0===n){var r;const e=Number.isFinite(n)?"".concat(n,"px"):n;this.canvas.style.position=(null===(r=t.style)||void 0===r?void 0:r.position)||"absolute",this.canvas.style.height=e}}_updateCanvasSize(){var t,e;const{canvas:n}=this;if(!n)return;const r=null!==(t=n.clientWidth)&&void 0!==t?t:n.width,i=null!==(e=n.clientHeight)&&void 0!==e?e:n.height;var o,s;r===this.width&&i===this.height||(this.width=r,this.height=i,null===(o=this.viewManager)||void 0===o||o.setProps({width:r,height:i}),null===(s=this.layerManager)||void 0===s||s.activateViewport(this.getViewports()[0]),this.props.onResize({width:r,height:i}))}_createAnimationLoop(t){const{width:e,height:n,gl:r,glOptions:i,debug:o,onError:s,onBeforeRender:a,onAfterRender:l,useDevicePixels:c}=t;return new mE({width:e,height:n,useDevicePixels:c,autoResizeDrawingBuffer:!r,autoResizeViewport:!1,gl:r,onCreateContext:t=>gA({...i,...t,canvas:this.canvas,debug:o,onContextLost:()=>this._onContextLost()}),onInitialize:t=>this._setGLContext(t.gl),onRender:this._onRenderFrame.bind(this),onBeforeRender:a,onAfterRender:l,onError:s})}_getViewState(){return this.props.viewState||this.viewState}_getViews(){let t=this.props.views||[new rC({id:"default-view"})];return t=Array.isArray(t)?t:[t],t.length&&this.props.controller&&(t[0].props.controller=this.props.controller),t}_onContextLost(){const{onError:t}=this.props;this.animationLoop&&t&&t(new Error("WebGL context is lost"))}_pickAndCallback(){const{_pickRequest:t}=this;if(t.event){const{result:n,emptyInfo:r}=this._pick("pickObject","pickObject Time",t);this.cursorState.isHovering=n.length>0;let i=r,o=!1;for(const s of n){var e;i=s,o=(null===(e=s.layer)||void 0===e?void 0:e.onHover(s,t.event))||o}if(!o&&this.props.onHover&&this.props.onHover(i,t.event),this.props.getTooltip&&this.tooltip){const t=this.props.getTooltip(i);this.tooltip.setTooltip(t,i.x,i.y)}t.event=null}}_updateCursor(){const t=this.props.parent||this.canvas;t&&(t.style.cursor=this.props.getCursor(this.cursorState))}_setGLContext(t){if(this.layerManager)return;this.canvas||(this.canvas=t.canvas,mA(t,{enable:!0,copyState:!0})),this.tooltip=new zC(this.canvas),oA(t,{blend:!0,blendFunc:[770,771,1,771],polygonOffsetFill:!0,depthTest:!0,depthFunc:515}),this.props.onWebGLInitialized(t);const e=new Zp;e.play(),this.animationLoop.attachTimeline(e),this.eventManager=new nP(this.props.parent||t.canvas,{touchAction:this.props.touchAction,recognizerOptions:this.props.eventRecognizerOptions,events:{pointerdown:this._onPointerDown,pointermove:this._onPointerMove,pointerleave:this._onPointerMove}});for(const r in py)this.eventManager.on(r,this._onEvent);this.viewManager=new ES({timeline:e,eventManager:this.eventManager,onViewStateChange:this._onViewStateChange.bind(this),onInteractionStateChange:this._onInteractionStateChange.bind(this),views:this._getViews(),viewState:this._getViewState(),width:this.width,height:this.height});const n=this.viewManager.getViewports()[0];this.layerManager=new SS(t,{deck:this,stats:this.stats,viewport:n,timeline:e}),this.effectManager=new PC,this.deckRenderer=new RC(t),this.deckPicker=new NC(t),this.setProps(this.props),this._updateCanvasSize(),this.props.onLoad()}_drawLayers(t,e){const{gl:n}=this.layerManager.context;oA(n,this.props.parameters),this.props.onBeforeRender({gl:n}),this.deckRenderer.renderLayers({target:this.props._framebuffer,layers:this.layerManager.getLayers(),viewports:this.viewManager.getViewports(),onViewportActive:this.layerManager.activateViewport,views:this.viewManager.getViews(),pass:"screen",effects:this.effectManager.getEffects(),...e}),this.props.onAfterRender({gl:n})}_onRenderFrame(t){this._getFrameStats(),this._metricsCounter++%60===0&&(this._getMetrics(),this.stats.reset(),Rg.table(4,this.metrics)(),this.props._onMetrics&&this.props._onMetrics(this.metrics)),this._updateCanvasSize(),this._updateCursor(),this.tooltip.isVisible&&this.viewManager.needsRedraw()&&this.tooltip.setTooltip(null),this.layerManager.updateLayers(),this._pickAndCallback(),this.redraw(),this.viewManager&&this.viewManager.updateViewStates()}_onViewStateChange(t){const e=this.props.onViewStateChange(t)||t.viewState;this.viewState&&(this.viewState={...this.viewState,[t.viewId]:e},this.props.viewState||this.viewManager&&this.viewManager.setProps({viewState:this.viewState}))}_onInteractionStateChange(t){this.cursorState.isDragging=t.isDragging||!1,this.props.onInteractionStateChange(t)}_getFrameStats(){const{stats:t}=this;t.get("frameRate").timeEnd(),t.get("frameRate").timeStart();const e=this.animationLoop.stats;t.get("GPU Time").addTime(e.get("GPU Time").lastTiming),t.get("CPU Time").addTime(e.get("CPU Time").lastTiming)}_getMetrics(){const{metrics:t,stats:e}=this;t.fps=e.get("frameRate").getHz(),t.setPropsTime=e.get("setProps Time").time,t.updateAttributesTime=e.get("Update Attributes").time,t.framesRedrawn=e.get("Redraw Count").count,t.pickTime=e.get("pickObject Time").time+e.get("pickMultipleObjects Time").time+e.get("pickObjects Time").time,t.pickCount=e.get("Pick Count").count,t.gpuTime=e.get("GPU Time").time,t.cpuTime=e.get("CPU Time").time,t.gpuTimePerFrame=e.get("GPU Time").getAverageTime(),t.cpuTimePerFrame=e.get("CPU Time").getAverageTime();const n=yA.get("Memory Usage");t.bufferMemory=n.get("Buffer Memory").count,t.textureMemory=n.get("Texture Memory").count,t.renderbufferMemory=n.get("Renderbuffer Memory").count,t.gpuMemory=n.get("GPU Memory").count}}ge(oP,"defaultProps",iP),ge(oP,"VERSION",uE);const sP="undefined"!==typeof window?h.useLayoutEffect:h.useEffect;function aP(t,e){for(;t;){if(t===e)return!0;t=Object.getPrototypeOf(t)}return!1}class lP{constructor(t,e){ge(this,"opts",void 0),ge(this,"source",void 0),this.opts=e,this.source=t}get value(){return this.source.value}getValue(){const t=this.source.getBuffer(),e=this.getAccessor();if(t)return[t,e];const{value:n}=this.source,{size:r}=e;let i=n;if(n&&n.length!==r){i=new Float32Array(r);const t=e.elementOffset||0;for(let e=0;e=i){const n=new Array(r).fill(1/0),o=new Array(r).fill(-1/0);for(let t=0;to[i]&&(o[i]=r)}t=[n,o]}}return this.state.bounds=t,t}setData(t){const{state:e}=this;let n;n=ArrayBuffer.isView(t)?{value:t}:t instanceof UA?{buffer:t}:t;const r={...this.settings,...n};if(e.bufferAccessor=r,e.bounds=null,n.constant){let t=n.value;t=this._normalizeValue(t,[],0),this.settings.normalized&&(t=this.normalizeConstant(t));if(!(!e.constant||!this._areValuesEqual(t,this.value)))return!1;e.externalBuffer=null,e.constant=!0,this.value=t}else if(n.buffer){const t=n.buffer;e.externalBuffer=t,e.constant=!1,this.value=n.value||null;const i=n.value instanceof Float64Array;r.type=n.type||t.accessor.type,r.bytesPerElement=t.accessor.BYTES_PER_ELEMENT*(i?2:1),r.stride=cP(r)}else if(n.value){this._checkExternalBuffer(n);let t=n.value;e.externalBuffer=null,e.constant=!1,this.value=t,r.bytesPerElement=t.BYTES_PER_ELEMENT,r.stride=cP(r);const{buffer:i,byteOffset:o}=this;this.doublePrecision&&t instanceof Float64Array&&(t=nb(t,r));const s=t.byteLength+o+2*r.stride;i.byteLength0&&void 0!==arguments[0]?arguments[0]:{};this.state.bounds=null;const e=this.value,{startOffset:n=0,endOffset:r}=t;this.buffer.subData({data:this.doublePrecision&&e instanceof Float64Array?nb(e,{size:this.size,startIndex:n,endIndex:r}):e.subarray(n,r),offset:n*e.BYTES_PER_ELEMENT+this.byteOffset})}allocate(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{state:n}=this,r=n.allocatedValue,i=_v.allocate(r,t+1,{size:this.size,type:this.settings.defaultType,copy:e});this.value=i;const{buffer:o,byteOffset:s}=this;return o.byteLength(t+128)/255*2-1));case 5122:return new Float32Array(t).map((t=>(t+32768)/65535*2-1));case 5121:return new Float32Array(t).map((t=>t/255));case 5123:return new Float32Array(t).map((t=>t/65535));default:return t}}_normalizeValue(t,e,n){const{defaultValue:r,size:i}=this.settings;if(Number.isFinite(t))return e[n]=t,e;if(!t){let t=i;for(;--t>=0;)e[n+t]=r[t];return e}switch(i){case 4:e[n+3]=Number.isFinite(t[3])?t[3]:r[3];case 3:e[n+2]=Number.isFinite(t[2])?t[2]:r[2];case 2:e[n+1]=Number.isFinite(t[1])?t[1]:r[1];case 1:e[n+0]=Number.isFinite(t[0])?t[0]:r[0];break;default:let o=i;for(;--o>=0;)e[n+o]=Number.isFinite(t[o])?t[o]:r[o]}return e}_areValuesEqual(t,e){if(!t||!e)return!1;const{size:n}=this;for(let r=0;r1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1/0,r=hP;const i={index:-1,data:t,target:[]};return t?"function"===typeof t[Symbol.iterator]?r=t:t.length>0&&(fP.length=t.length,r=fP):r=hP,(e>0||Number.isFinite(n))&&(r=(Array.isArray(r)?r:Array.from(r)).slice(e,n),i.index=e-1),{iterable:r,objectInfo:i}}function gP(t){return t&&t[Symbol.asyncIterator]}function mP(t,e){const{size:n,stride:r,offset:i,startIndices:o,nested:s}=e,a=t.BYTES_PER_ELEMENT,l=r?r/a:n,c=i?i/a:0,u=Math.floor((t.length-c)/l);return(e,r)=>{let{index:i,target:a}=r;if(!o){const e=i*l+c;for(let r=0;rl)return void n.set(e.subarray(0,l),r);if(n.set(e,r),!o)return;let c=a;for(;ct},spring:{stiffness:.05,damping:.5}};function AP(t,e){if(!t)return null;Number.isFinite(t)&&(t={type:"interpolation",duration:t});const n=t.type||"interpolation";return{...xP[n],...e,...t,type:n}}function _P(t,e){const n=e.getBuffer();return n?[n,{divisor:0,size:e.size,normalized:e.settings.normalized}]:e.value}function wP(t){switch(t){case 1:return"float";case 2:return"vec2";case 3:return"vec3";case 4:return"vec4";default:throw new Error('No defined attribute type for size "'.concat(t,'"'))}}function SP(t){t.push(t.shift())}function CP(t,e){const{doublePrecision:n,settings:r,value:i,size:o}=t,s=n&&i instanceof Float64Array?2:1;return(r.noAlloc?i.length:e*o)*s}function EP(t){let{buffer:e,numInstances:n,attribute:r,fromLength:i,fromStartIndices:o,getData:s=(t=>t)}=t;const a=r.doublePrecision&&r.value instanceof Float64Array?2:1,l=r.size*a,c=r.byteOffset,u=r.startIndices,d=o&&u,h=CP(r,n),f=r.isConstant;if(!d&&i>=h)return;const p=f?r.value:r.getBuffer().getData({srcByteOffset:c});if(r.settings.normalized&&!f){const t=s;s=(e,n)=>r.normalizeConstant(t(e,n))}const g=f?(t,e)=>s(p,e):(t,e)=>s(p.subarray(t,t+l),e),m=e.getData({length:i}),v=new Float32Array(h);!function(t){let{source:e,target:n,size:r,getData:i,sourceStartIndices:o,targetStartIndices:s}=t;if(!Array.isArray(s))return yP({source:e,target:n,size:r,getData:i}),n;let a=0,l=0;const c=i&&((t,e)=>i(t+l,e)),u=Math.min(o.length,s.length);for(let d=1;d0&&void 0!==arguments[0]?arguments[0]:{};const e=this.state.needsRedraw;return this.state.needsRedraw=e&&!t,e}getUpdateTriggers(){const{accessor:t}=this.settings;return[this.id].concat("function"!==typeof t&&t||[])}supportsTransition(){return Boolean(this.settings.transition)}getTransitionSetting(t){if(!t||!this.supportsTransition())return null;const{accessor:e}=this.settings,n=this.settings.transition,r=Array.isArray(e)?t[e.find((e=>t[e]))]:t[e];return AP(r,n)}setNeedsUpdate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.id,e=arguments.length>1?arguments[1]:void 0;if(this.state.needsUpdate=this.state.needsUpdate||t,this.setNeedsRedraw(t),e){const{startRow:t=0,endRow:n=1/0}=e;this.state.updateRanges=function(t,e){if(t===bP)return t;if(e[0]<0&&(e[0]=0),e[0]>=e[1])return t;const n=[],r=t.length;let i=0;for(let o=0;oe[1]?n.push(r):e=[Math.min(r[0],e[0]),Math.max(r[1],e[1])]}return n.splice(i,0,e),n}(this.state.updateRanges,[t,n])}else this.state.updateRanges=bP}clearNeedsUpdate(){this.state.needsUpdate=!1,this.state.updateRanges=vP}setNeedsRedraw(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.id;this.state.needsRedraw=this.state.needsRedraw||t}allocate(t){const{state:e,settings:n}=this;return!n.noAlloc&&(!!n.update&&(super.allocate(t,e.updateRanges!==bP),!0))}updateBuffer(t){let{numInstances:e,data:n,props:r,context:i}=t;if(!this.needsUpdate())return!1;const{state:{updateRanges:o},settings:{update:s,noAlloc:a}}=this;let l=!0;if(s){for(const[t,a]of o)s.call(i,this,{data:n,startRow:t,endRow:a,props:r,numInstances:e});if(this.value)if(this.constant||this.buffer.byteLength1&&void 0!==arguments[1]?arguments[1]:null;const{state:n,settings:r}=this;if(!t)return n.binaryValue=null,n.binaryAccessor=null,!1;if(r.noAlloc)return!1;if(n.binaryValue===t)return this.clearNeedsUpdate(),!0;n.binaryValue=t,this.setNeedsRedraw();if(r.transform||e!==this.startIndices){ArrayBuffer.isView(t)&&(t={value:t});const i=t;OS(ArrayBuffer.isView(i.value),"invalid ".concat(r.accessor));const o=Boolean(i.size)&&i.size!==this.size;return n.binaryAccessor=mP(i.value,{size:i.size||this.size,stride:i.stride,offset:i.offset,startIndices:e,nested:o}),!1}return this.clearNeedsUpdate(),this.setData(t),!0}getVertexOffset(t){const{startIndices:e}=this;return(e?tu?c.set(e,g):(t._normalizeValue(e,v.target,0),Ng({target:c,source:v.target,start:g,count:n}));g+=n*u}else t._normalizeValue(e,c,g),g+=u}}_validateAttributeUpdaters(){const{settings:t}=this;if(!(t.noAlloc||"function"===typeof t.update))throw new Error("Attribute ".concat(this.id," missing update or accessor"))}_checkAttributeArray(){const{value:t}=this,e=Math.min(4,this.size);if(t&&t.length>=e){let n=!0;switch(e){case 4:n=n&&Number.isFinite(t[3]);case 3:n=n&&Number.isFinite(t[2]);case 2:n=n&&Number.isFinite(t[1]);case 1:n=n&&Number.isFinite(t[0]);break;default:n=!1}if(!n)throw new Error("Illegal attribute generated for ".concat(this.id))}}}const MP="out vec4 transform_output;\nvoid main() {\n transform_output = vec4(0);\n}",TP="#version 300 es\n".concat(MP);function OP(t,e){e=Array.isArray(e)?e:[e];const n=t.replace(/^\s+/,"").split(/\s+/),[r,i,o]=n;if(!e.includes(r)||!i||!o)return null;return{qualifier:r,type:i,name:o.split(";")[0]}}function kP(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{version:e=100,input:n,inputType:r,output:i}=t;if(!n)return 300===e?TP:e>300?"#version ".concat(e,"\n").concat(MP):"void main() {gl_FragColor = vec4(0);}";const o=function(t,e){switch(e){case"float":return"vec4(".concat(t,", 0.0, 0.0, 1.0)");case"vec2":return"vec4(".concat(t,", 0.0, 1.0)");case"vec3":return"vec4(".concat(t,", 1.0)");case"vec4":return t;default:return _y(!1),null}}(n,r);return e>=300?"#version ".concat(e," ").concat(300===e?"es":"","\nin ").concat(r," ").concat(n,";\nout vec4 ").concat(i,";\nvoid main() {\n ").concat(i," = ").concat(o,";\n}"):"varying ".concat(r," ").concat(n,";\nvoid main() {\n gl_FragColor = ").concat(o,";\n}")}class RP extends TA{get[Symbol.toStringTag](){return"TransformFeedback"}static isSupported(t){return vx(t)}constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};yx(t),super(t,e),this.initialize(e),this.stubRemovedMethods("TransformFeedback","v6.0",["pause","resume"]),Object.seal(this)}initialize(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.buffers={},this.unused={},this.configuration=null,this.bindOnUse=!0,EA(this.buffers)||this.bind((()=>this._unbindBuffers())),this.setProps(t),this}setProps(t){"program"in t&&(this.configuration=t.program&&t.program.configuration),"configuration"in t&&(this.configuration=t.configuration),"bindOnUse"in t&&(t=t.bindOnUse),"buffers"in t&&this.setBuffers(t.buffers)}setBuffers(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.bind((()=>{for(const e in t)this.setBuffer(e,t[e])})),this}setBuffer(t,e){const n=this._getVaryingIndex(t),{buffer:r,byteSize:i,byteOffset:o}=this._getBufferParams(e);return n<0?(this.unused[t]=r,hx.warn("".concat(this.id," unused varying buffer ").concat(t))(),this):(this.buffers[n]=e,this.bindOnUse||this._bindBuffer(n,r,o,i),this)}begin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.gl.bindTransformFeedback(36386,this.handle),this._bindBuffers(),this.gl.beginTransformFeedback(t),this}end(){return this.gl.endTransformFeedback(),this._unbindBuffers(),this.gl.bindTransformFeedback(36386,null),this}_getBufferParams(t){let e,n,r;return t instanceof UA===!1?(r=t.buffer,n=t.byteSize,e=t.byteOffset):r=t,void 0===e&&void 0===n||(e=e||0,n=n||r.byteLength-e),{buffer:r,byteOffset:e,byteSize:n}}_getVaryingInfo(t){return this.configuration&&this.configuration.getVaryingInfo(t)}_getVaryingIndex(t){if(this.configuration)return this.configuration.getVaryingInfo(t).location;const e=Number(t);return Number.isFinite(e)?e:-1}_bindBuffers(){if(this.bindOnUse)for(const t in this.buffers){const{buffer:e,byteSize:n,byteOffset:r}=this._getBufferParams(this.buffers[t]);this._bindBuffer(t,e,r,n)}}_unbindBuffers(){if(this.bindOnUse)for(const t in this.buffers)this._bindBuffer(t,null)}_bindBuffer(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3?arguments[3]:void 0;const i=e&&e.handle;return i&&void 0!==r?this.gl.bindBufferRange(35982,t,i,n,r):this.gl.bindBufferBase(35982,t,i),this}_createHandle(){return this.gl.createTransformFeedback()}_deleteHandle(){this.gl.deleteTransformFeedback(this.handle)}_bindHandle(t){this.gl.bindTransformFeedback(36386,this.handle)}}class IP{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.gl=t,this.currentIndex=0,this.feedbackMap={},this.varyings=null,this.bindings=[],this.resources={},this._initialize(e),Object.seal(this)}setupResources(t){for(const e of this.bindings)this._setupTransformFeedback(e,t)}updateModelProps(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{varyings:e}=this;return e.length>0&&(t=Object.assign({},t,{varyings:e})),t}getDrawOptions(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e=this.bindings[this.currentIndex],{sourceBuffers:n,transformFeedback:r}=e;return{attributes:Object.assign({},n,t.attributes),transformFeedback:r}}swap(){return!!this.feedbackMap&&(this.currentIndex=this._getNextIndex(),!0)}update(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this._setupBuffers(t)}getBuffer(t){const{feedbackBuffers:e}=this.bindings[this.currentIndex],n=t?e[t]:null;return n?n instanceof UA?n:n.buffer:null}getData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{varyingName:e}=t,n=this.getBuffer(e);return n?n.getData():null}delete(){for(const t in this.resources)this.resources[t].delete()}_initialize(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this._setupBuffers(t),this.varyings=t.varyings||Object.keys(this.bindings[this.currentIndex].feedbackBuffers),this.varyings.length>0&&xA(vx(this.gl))}_getFeedbackBuffers(t){const{sourceBuffers:e={}}=t,n={};if(this.bindings[this.currentIndex]&&Object.assign(n,this.bindings[this.currentIndex].feedbackBuffers),this.feedbackMap)for(const r in this.feedbackMap){const t=this.feedbackMap[r];r in e&&(n[t]=r)}Object.assign(n,t.feedbackBuffers);for(const r in n){const t=n[r];if("string"===typeof t){const i=e[t],{byteLength:o,usage:s,accessor:a}=i;n[r]=this._createNewBuffer(r,{byteLength:o,usage:s,accessor:a})}}return n}_setupBuffers(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{sourceBuffers:e=null}=t;Object.assign(this.feedbackMap,t.feedbackMap);const n=this._getFeedbackBuffers(t);this._updateBindings({sourceBuffers:e,feedbackBuffers:n})}_setupTransformFeedback(t,e){let{model:n}=e;const{program:r}=n;t.transformFeedback=new RP(this.gl,{program:r,buffers:t.feedbackBuffers})}_updateBindings(t){if(this.bindings[this.currentIndex]=this._updateBinding(this.bindings[this.currentIndex],t),this.feedbackMap){const{sourceBuffers:t,feedbackBuffers:e}=this._swapBuffers(this.bindings[this.currentIndex]),n=this._getNextIndex();this.bindings[n]=this._updateBinding(this.bindings[n],{sourceBuffers:t,feedbackBuffers:e})}}_updateBinding(t,e){return t?(Object.assign(t.sourceBuffers,e.sourceBuffers),Object.assign(t.feedbackBuffers,e.feedbackBuffers),t.transformFeedback&&t.transformFeedback.setBuffers(t.feedbackBuffers),t):{sourceBuffers:Object.assign({},e.sourceBuffers),feedbackBuffers:Object.assign({},e.feedbackBuffers)}}_swapBuffers(t){if(!this.feedbackMap)return null;const e=Object.assign({},t.sourceBuffers),n=Object.assign({},t.feedbackBuffers);for(const r in this.feedbackMap){const i=this.feedbackMap[r];e[r]=t.feedbackBuffers[i],n[i]=t.sourceBuffers[r],xA(n[i]instanceof UA)}return{sourceBuffers:e,feedbackBuffers:n}}_createNewBuffer(t,e){const n=new UA(this.gl,e);return this.resources[t]&&this.resources[t].delete(),this.resources[t]=n,n}_getNextIndex(){return(this.currentIndex+1)%2}}function BP(t){let e=100;const n=t.match(/[^\s]+/g);if(n.length>=2&&"#version"===n[0]){const t=parseInt(n[1],10);Number.isFinite(t)&&(e=t)}return e}const LP={name:"transform",vs:"attribute float transform_elementID;\nvec2 transform_getPixelSizeHalf(vec2 size) {\n return vec2(1.) / (2. * size);\n}\n\nvec2 transform_getPixelIndices(vec2 texSize, vec2 pixelSizeHalf) {\n float yIndex = floor((transform_elementID / texSize[0]) + pixelSizeHalf[1]);\n float xIndex = transform_elementID - (yIndex * texSize[0]);\n return vec2(xIndex, yIndex);\n}\nvec2 transform_getTexCoord(vec2 size) {\n vec2 pixelSizeHalf = transform_getPixelSizeHalf(size);\n vec2 indices = transform_getPixelIndices(size, pixelSizeHalf);\n vec2 coord = indices / size + pixelSizeHalf;\n return coord;\n}\nvec2 transform_getPos(vec2 size) {\n vec2 texCoord = transform_getTexCoord(size);\n vec2 pos = (texCoord * (2.0, 2.0)) - (1., 1.);\n return pos;\n}\nvec4 transform_getInput(sampler2D texSampler, vec2 size) {\n vec2 texCoord = transform_getTexCoord(size);\n vec4 textureColor = texture2D(texSampler, texCoord);\n return textureColor;\n}\n",fs:null},DP="transform_uSampler_",FP="transform_uSize_",NP="transform_position";function jP(t){let{vs:e,sourceTextureMap:n,targetTextureVarying:r,targetTexture:i}=t;let o=Object.keys(n).length,s=null;const a={};let l=e,c={};if(o>0||r){const t=l.split("\n"),e=t.slice();if(t.forEach(((t,i,l)=>{if(o>0){const r=function(t,e){const n={},r=function(t){return OP(t,["attribute","in"])}(t);if(!r)return null;const{type:i,name:o}=r;if(o&&e[o]){const e="// ".concat(t," => Replaced by Transform with a sampler"),{samplerName:r,sizeName:s,uniformDeclerations:a}=function(t){const e="".concat(DP).concat(t),n="".concat(FP).concat(t),r=" uniform sampler2D ".concat(e,";\n uniform vec2 ").concat(n,";");return{samplerName:e,sizeName:n,uniformDeclerations:r}}(o),l=function(t){switch(t){case"float":return"x";case"vec2":return"xy";case"vec3":return"xyz";case"vec4":return"xyzw";default:return _y(!1),null}}(i),c=" ".concat(i," ").concat(o," = transform_getInput(").concat(r,", ").concat(s,").").concat(l,";\n");n[r]=o;return{updatedLine:e,inject:{"vs:#decl":a,"vs:#main-start":c},samplerTextureMap:n}}return null}(t,n);if(r){const{updatedLine:t,inject:n}=r;e[i]=t,c=Xy([c,n]),Object.assign(a,r.samplerTextureMap),o--}}r&&!s&&(s=function(t,e){const n=OP(t,["varying","out"]);if(!n)return null;return n.name===e?n.type:null}(t,r))})),r){xA(i);const t="".concat(FP).concat(r),e="uniform vec2 ".concat(t,";\n"),n=" vec2 ".concat(NP," = transform_getPos(").concat(t,");\n gl_Position = vec4(").concat(NP,", 0, 1.);\n");c=Xy([c,{"vs:#decl":e,"vs:#main-start":n}])}l=e.join("\n")}return{vs:l,targetTextureType:s,inject:c,samplerTextureMap:a}}const zP={10241:9728,10240:9728,10242:33071,10243:33071};class UP{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.gl=t,this.id=this.currentIndex=0,this._swapTexture=null,this.targetTextureVarying=null,this.targetTextureType=null,this.samplerTextureMap=null,this.bindings=[],this.resources={},this._initialize(e),Object.seal(this)}updateModelProps(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e=this._processVertexShader(t);return Object.assign({},t,e)}getDrawOptions(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{sourceBuffers:e,sourceTextures:n,framebuffer:r,targetTexture:i}=this.bindings[this.currentIndex],o=Object.assign({},e,t.attributes),s=Object.assign({},t.uniforms),a=Object.assign({},t.parameters);let l=t.discard;if(this.hasSourceTextures||this.hasTargetTexture){o.transform_elementID=this.elementIDBuffer;for(const e in this.samplerTextureMap){const t=this.samplerTextureMap[e];s[e]=n[t]}this._setSourceTextureParameters();const t=function(t){let{sourceTextureMap:e,targetTextureVarying:n,targetTexture:r}=t;const i={};let o,s;n&&(({width:o,height:s}=r),i["".concat(FP).concat(n)]=[o,s]);for(const a in e)({width:o,height:s}=e[a]),i["".concat(FP).concat(a)]=[o,s];return i}({sourceTextureMap:n,targetTextureVarying:this.targetTextureVarying,targetTexture:i});Object.assign(s,t)}return this.hasTargetTexture&&(l=!1,a.viewport=[0,0,r.width,r.height]),{attributes:o,framebuffer:r,uniforms:s,discard:l,parameters:a}}swap(){return!!this._swapTexture&&(this.currentIndex=this._getNextIndex(),!0)}update(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this._setupTextures(t)}getTargetTexture(){const{targetTexture:t}=this.bindings[this.currentIndex];return t}getData(){let{packed:t=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{framebuffer:e}=this.bindings[this.currentIndex],n=a_(e);if(!t)return n;const r=n.constructor,i=function(t){switch(t){case"float":return 1;case"vec2":return 2;case"vec3":return 3;case"vec4":return 4;default:return _y(!1),null}}(this.targetTextureType),o=new r(n.length*i/4);let s=0;for(let a=0;a0&&void 0!==arguments[0]?arguments[0]:{};const{_targetTextureVarying:e,_swapTexture:n}=t;this._swapTexture=n,this.targetTextureVarying=e,this.hasTargetTexture=e,this._setupTextures(t)}_createTargetTexture(t){const{sourceTextures:e,textureOrReference:n}=t;if(n instanceof qA)return n;const r=e[n];return r?(this._targetRefTexName=n,this._createNewTexture(r)):null}_setupTextures(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{sourceBuffers:e,_sourceTextures:n={},_targetTexture:r}=t,i=this._createTargetTexture({sourceTextures:n,textureOrReference:r});this.hasSourceTextures=this.hasSourceTextures||n&&Object.keys(n).length>0,this._updateBindings({sourceBuffers:e,sourceTextures:n,targetTexture:i}),"elementCount"in t&&this._updateElementIDBuffer(t.elementCount)}_updateElementIDBuffer(t){if("number"!==typeof t||this.elementCount>=t)return;const e=new Float32Array(t);e.forEach(((t,e,n)=>{n[e]=e})),this.elementIDBuffer?this.elementIDBuffer.setData({data:e}):this.elementIDBuffer=new UA(this.gl,{data:e,accessor:{size:1}}),this.elementCount=t}_updateBindings(t){if(this.bindings[this.currentIndex]=this._updateBinding(this.bindings[this.currentIndex],t),this._swapTexture){const{sourceTextures:t,targetTexture:e}=this._swapTextures(this.bindings[this.currentIndex]),n=this._getNextIndex();this.bindings[n]=this._updateBinding(this.bindings[n],{sourceTextures:t,targetTexture:e})}}_updateBinding(t,e){const{sourceBuffers:n,sourceTextures:r,targetTexture:i}=e;if(t||(t={sourceBuffers:{},sourceTextures:{},targetTexture:null}),Object.assign(t.sourceTextures,r),Object.assign(t.sourceBuffers,n),i){t.targetTexture=i;const{width:e,height:n}=i,{framebuffer:r}=t;r?(r.update({attachments:{36064:i},resizeAttachments:!1}),r.resize({width:e,height:n})):t.framebuffer=new j_(this.gl,{id:"transform-framebuffer",width:e,height:n,attachments:{36064:i}})}return t}_setSourceTextureParameters(){const t=this.currentIndex,{sourceTextures:e}=this.bindings[t];for(const n in e)e[n].setParameters(zP)}_swapTextures(t){if(!this._swapTexture)return null;const e=Object.assign({},t.sourceTextures);e[this._swapTexture]=t.targetTexture;return{sourceTextures:e,targetTexture:t.sourceTextures[this._swapTexture]}}_createNewTexture(t){const e=function(t,e){xA(t instanceof qA||t instanceof i_||t instanceof o_);const n=t.constructor,{gl:r,width:i,height:o,format:s,type:a,dataFormat:l,border:c,mipmaps:u}=t;return new n(r,Object.assign({width:i,height:o,format:s,type:a,dataFormat:l,border:c,mipmaps:u},e))}(t,{parameters:{10241:9728,10240:9728,10242:33071,10243:33071},pixelStore:{37440:!1}});return this.ownTexture&&this.ownTexture.delete(),this.ownTexture=e,e}_getNextIndex(){return(this.currentIndex+1)%2}_processVertexShader(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{sourceTextures:e,targetTexture:n}=this.bindings[this.currentIndex],{vs:r,uniforms:i,targetTextureType:o,inject:s,samplerTextureMap:a}=jP({vs:t.vs,sourceTextureMap:e,targetTextureVarying:this.targetTextureVarying,targetTexture:n}),l=Xy([t.inject||{},s]);this.targetTextureType=o,this.samplerTextureMap=a;return{vs:r,fs:t._fs||kP({version:BP(r),input:this.targetTextureVarying,inputType:o,output:"transform_output"}),modules:this.hasSourceTextures||this.targetTextureVarying?[LP].concat(t.modules||[]):t.modules,uniforms:i,inject:l}}}let VP=null;function GP(t,e){var n;return new t((n=t.BYTES_PER_ELEMENT*e,(!VP||VP.byteLength1&&void 0!==arguments[1]?arguments[1]:{}).constantAttributeZero||(vx(t)||"Chrome"===hE())}static getDefaultArray(t){return t.luma=t.luma||{},t.luma.defaultVertexArray||(t.luma.defaultVertexArray=new WP(t,{handle:null,isDefaultArray:!0})),t.luma.defaultVertexArray}static getMaxAttributes(t){return WP.MAX_ATTRIBUTES=WP.MAX_ATTRIBUTES||t.getParameter(34921),WP.MAX_ATTRIBUTES}static setConstant(t,e,n){switch(n.constructor){case Float32Array:WP._setConstantFloatArray(t,e,n);break;case Int32Array:WP._setConstantIntArray(t,e,n);break;case Uint32Array:WP._setConstantUintArray(t,e,n);break;default:xA(!1)}}constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=e.id||e.program&&e.program.id;super(t,Object.assign({},e,{id:n})),this.buffer=null,this.bufferValue=null,this.isDefaultArray=e.isDefaultArray||!1,this.gl2=t,this.initialize(e),Object.seal(this)}delete(){return super.delete(),this.buffer&&this.buffer.delete(),this}get MAX_ATTRIBUTES(){return WP.getMaxAttributes(this.gl)}initialize(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.setProps(t)}setProps(t){return this}setElementBuffer(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return xA(!t||34963===t.target,"elements must be GL.ELEMENT_ARRAY_BUFFER"),this.bind((()=>{this.gl.bindBuffer(34963,t?t.handle:null)})),this}setBuffer(t,e,n){if(34963===e.target)return this.setElementBuffer(e,n);const{size:r,type:i,stride:o,offset:s,normalized:a,integer:l,divisor:c}=n,{gl:u,gl2:d}=this;return t=Number(t),this.bind((()=>{u.bindBuffer(34962,e.handle),l?(xA(vx(u)),d.vertexAttribIPointer(t,r,i,o,s)):u.vertexAttribPointer(t,r,i,a,o,s),u.enableVertexAttribArray(t),d.vertexAttribDivisor(t,c||0)})),this}enable(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return!e&&0===t&&!WP.isSupported(this.gl,{constantAttributeZero:!0})||(t=Number(t),this.bind((()=>e?this.gl.enableVertexAttribArray(t):this.gl.disableVertexAttribArray(t)))),this}getConstantBuffer(t,e){const n=this._normalizeConstantArrayValue(e),r=n.byteLength*t,i=n.length*t;let o=!this.buffer;if(this.buffer=this.buffer||new UA(this.gl,r),o=o||this.buffer.reallocate(r),o=o||!this._compareConstantArrayValues(n,this.bufferValue),o){const t=GP(e.constructor,i);!function(t){let{target:e,source:n,start:r=0,count:i=1}=t;const o=n.length,s=i*o;let a=0;for(let l=r;a34373===t?this.gl.getVertexAttribOffset(n,t):this.gl.getVertexAttrib(n,t)))}}const HP=/^(.+)__LOCATION_([0-9]+)$/,JP=["setBuffers","setGeneric","clearBindings","setLocations","setGenericValues","setDivisor","enable","disable"];class KP{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=e.id||e.program&&e.program.id;this.id=n,this.gl=t,this.configuration=null,this.elements=null,this.elementsAccessor=null,this.values=null,this.accessors=null,this.unused=null,this.drawParams=null,this.buffer=null,this.attributes={},this.vertexArrayObject=new WP(t),PA(this,"VertexArray","v6.0",JP),this.initialize(e),Object.seal(this)}delete(){this.buffer&&this.buffer.delete(),this.vertexArrayObject.delete()}initialize(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.reset(),this.configuration=null,this.bindOnUse=!1,this.setProps(t)}reset(){this.elements=null,this.elementsAccessor=null;const{MAX_ATTRIBUTES:t}=this.vertexArrayObject;return this.values=new Array(t).fill(null),this.accessors=new Array(t).fill(null),this.unused={},this.drawParams=null,this}setProps(t){return"program"in t&&(this.configuration=t.program&&t.program.configuration),"configuration"in t&&(this.configuration=t.configuration),"attributes"in t&&this.setAttributes(t.attributes),"elements"in t&&this.setElementBuffer(t.elements),"bindOnUse"in t&&(t=t.bindOnUse),this}clearDrawParams(){this.drawParams=null}getDrawParams(){return this.drawParams=this.drawParams||this._updateDrawParams(),this.drawParams}setAttributes(t){return Object.assign(this.attributes,t),this.vertexArrayObject.bind((()=>{for(const e in t){const n=t[e];this._setAttribute(e,n)}this.gl.bindBuffer(34962,null)})),this}setElementBuffer(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.elements=t,this.elementsAccessor=e,this.clearDrawParams(),this.vertexArrayObject.setElementBuffer(t,e),this}setBuffer(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(34963===e.target)return this.setElementBuffer(e,n);const{location:r,accessor:i}=this._resolveLocationAndAccessor(t,e,e.accessor,n);return r>=0&&(this.values[r]=e,this.accessors[r]=i,this.clearDrawParams(),this.vertexArrayObject.setBuffer(r,e,i)),this}setConstant(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{location:r,accessor:i}=this._resolveLocationAndAccessor(t,e,Object.assign({size:e.length},n));return r>=0&&(e=this.vertexArrayObject._normalizeConstantArrayValue(e),this.values[r]=e,this.accessors[r]=i,this.clearDrawParams(),this.vertexArrayObject.enable(r,!1)),this}unbindBuffers(){return this.vertexArrayObject.bind((()=>{this.elements&&this.vertexArrayObject.setElementBuffer(null),this.buffer=this.buffer||new UA(this.gl,{accessor:{size:4}});for(let t=0;t{this.elements&&this.setElementBuffer(this.elements);for(let t=0;t{this._setConstantAttributes(t,e),r=n()})),r}_resolveLocationAndAccessor(t,e,n,r){const i={location:-1,accessor:null},{location:o,name:s}=this._getAttributeIndex(t);if(!Number.isFinite(o)||o<0)return this.unused[t]=e,hx.once(3,(()=>"unused value ".concat(t," in ").concat(this.id)))(),i;const a=this._getAttributeInfo(s||o);if(!a)return i;const l=this.accessors[o]||{},c=FA.resolve(a.accessor,l,n,r),{size:u,type:d}=c;return xA(Number.isFinite(u)&&Number.isFinite(d)),{location:o,accessor:c}}_getAttributeInfo(t){return this.configuration&&this.configuration.getAttributeInfo(t)}_getAttributeIndex(t){const e=Number(t);if(Number.isFinite(e))return{location:e};const n=HP.exec(t),r=n?n[1]:t,i=n?Number(n[2]):0;return this.configuration?{location:this.configuration.getAttributeLocation(r)+i,name:r}:{location:-1}}_setAttribute(t,e){if(e instanceof UA)this.setBuffer(t,e);else if(Array.isArray(e)&&e.length&&e[0]instanceof UA){const n=e[0],r=e[1];this.setBuffer(t,n,r)}else if(ArrayBuffer.isView(e)||Array.isArray(e)){const n=e;this.setConstant(t,n)}else{if(!(e.buffer instanceof UA))throw new Error("VertexArray: attributes must be Buffers or constants (i.e. typed array)");{const n=e;this.setBuffer(t,n.buffer,n)}}}_setConstantAttributes(t,e){const n=Math.max(0|t,0|e);let r=this.values[0];ArrayBuffer.isView(r)&&this._setConstantAttributeZero(r,n);for(let i=1;i0;if(t.isInstanced=t.isInstanced||o,n instanceof UA){const e=n;if(o){const n=e.getVertexCount(r);t.instanceCount=Math.min(t.instanceCount,n)}else{const n=e.getVertexCount(r);t.vertexCount=Math.min(t.vertexCount,n)}}}setElements(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return hx.deprecated("setElements","setElementBuffer")(),this.setElementBuffer(t,e)}}function XP(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{isInteger:n=!1}=e;if(Array.isArray(t)||ArrayBuffer.isView(t))return function(t,e){const{maxElts:n=16,size:r=1}=e;let i="[";for(let s=0;s0&&(i+=",".concat(s%r===0?" ":"")),i+=XP(t[s],e);const o=t.length>n?"...":"]";return"".concat(i).concat(o)}(t,e);if(!Number.isFinite(t))return String(t);if(Math.abs(t)<1e-16)return n?"0":"0.";if(n)return t.toFixed(0);if(Math.abs(t)>100&&Math.abs(t)<1e4)return t.toFixed(0);const r=t.toPrecision(2);return r.indexOf(".0")===r.length-2?r.slice(0,-1):r}function qP(t,e,n,r){const{gl:i}=t;if(!e)return{[r]:"null","Format ":"N/A"};let o,s,a,l="NOT PROVIDED",c=1,u=0,d=0;if(n&&(l=n.type,c=n.size,l=String(l).replace("Array",""),o=-1!==l.indexOf("nt")),e instanceof UA){const t=e,{data:h,changed:f}=t.getDebugData();let p;if(s=f?"*":"",a=h,d=t.byteLength,u=d/h.BYTES_PER_ELEMENT/c,n){const t=n.divisor>0;p="".concat(t?"I ":"P "," ").concat(u," (x").concat(c,"=").concat(d," bytes ").concat(_A(i,l),")")}else o=!0,p="".concat(d," bytes");return{[r]:"".concat(s).concat(XP(a,{size:c,isInteger:o})),"Format ":p}}return a=e,c=e.length,l=String(e.constructor.name).replace("Array",""),o=-1!==l.indexOf("nt"),{[r]:"".concat(XP(a,{size:c,isInteger:o})," (constant)"),"Format ":"".concat(c,"x").concat(l," (constant)")}}function YP(t,e){const{type:n,size:r}=e,i=Qw(n,r);return i?"".concat(t," (").concat(i.name,")"):t}function QP(t){let{header:e="Uniforms",program:n,uniforms:r,undefinedOnly:i=!1}=t;xA(n);const o=".*Matrix",s=n._uniformSetters,a={},l=Object.keys(s).sort();let c=0;for(const h of l)h.match(".*_.*")||h.match(o)||ZP({table:a,header:e,uniforms:r,uniformName:h,undefinedOnly:i})&&c++;for(const h of l)h.match(o)&&ZP({table:a,header:e,uniforms:r,uniformName:h,undefinedOnly:i})&&c++;for(const h of l)a[h]||ZP({table:a,header:e,uniforms:r,uniformName:h,undefinedOnly:i})&&c++;let u=0;const d={};if(!i)for(const h in r){const t=r[h];a[h]||(u++,d[h]={Type:"NOT USED: ".concat(t),[e]:XP(t)})}return{table:a,count:c,unusedTable:d,unusedCount:u}}function ZP(t){let{table:e,header:n,uniforms:r,uniformName:i,undefinedOnly:o}=t;const s=r[i],a=function(t){return void 0!==t&&null!==t}(s);return(!o||!a)&&(e[i]={[n]:a?XP(s):"N/A","Uniform Type":a?s:"NOT PROVIDED"},!0)}function $P(t){const{type:e,size:n}=t.accessor,r=Qw(e,n);return r?"".concat(r.name," ").concat(t.name):t.name}const tM={POSITION:"positions",NORMAL:"normals",COLOR_0:"colors",TEXCOORD_0:"texCoords",TEXCOORD_1:"texCoords1",TEXCOORD_2:"texCoords2"};function eM(t,e){const{attributeMap:n=tM}=e||{};return n&&n[t]||t}function nM(t,e){let n;switch(t){case"texCoords":case"texCoord1":case"texCoord2":case"texCoord3":n="uvs";break;case"vertices":case"positions":case"normals":case"pickingColors":n="vectors"}switch(n){case"vectors":e.size=e.size||3;break;case"uvs":e.size=e.size||2}xA(Number.isFinite(e.size),"attribute ".concat(t," needs size"))}const rM=()=>{},iM={};class oM{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{id:n=SA("model")}=e;xA(mx(t)),this.id=n,this.gl=t,this.id=e.id||SA("Model"),this.lastLogTime=0,this.animated=!1,this.initialize(e)}initialize(t){this.props={},this.programManager=t.programManager||nS.getDefaultProgramManager(this.gl),this._programManagerState=-1,this._managedProgram=!1;const{program:e=null,vs:n,fs:r,modules:i,defines:o,inject:s,varyings:a,bufferMode:l,transpileToGLSL100:c}=t;this.programProps={program:e,vs:n,fs:r,modules:i,defines:o,inject:s,varyings:a,bufferMode:l,transpileToGLSL100:c},this.program=null,this.vertexArray=null,this._programDirty=!0,this.userData={},this.needsRedraw=!0,this._attributes={},this.attributes={},this.uniforms={},this.pickable=!0,this._checkProgram(),this.setUniforms(Object.assign({},this.getModuleUniforms(t.moduleSettings))),this.drawMode=void 0!==t.drawMode?t.drawMode:4,this.vertexCount=t.vertexCount||0,this.geometryBuffers={},this.isInstanced=t.isInstanced||t.instanced||t.instanceCount>0,this._setModelProps(t),this.geometry={},xA(void 0!==this.drawMode&&Number.isFinite(this.vertexCount),"Model needs drawMode and vertexCount")}setProps(t){this._setModelProps(t)}delete(){for(const t in this._attributes)this._attributes[t]!==this.attributes[t]&&this._attributes[t].delete();this._managedProgram&&(this.programManager.release(this.program),this._managedProgram=!1),this.vertexArray.delete(),this._deleteGeometryBuffers()}getDrawMode(){return this.drawMode}getVertexCount(){return this.vertexCount}getInstanceCount(){return this.instanceCount}getAttributes(){return this.attributes}getProgram(){return this.program}setProgram(t){const{program:e,vs:n,fs:r,modules:i,defines:o,inject:s,varyings:a,bufferMode:l,transpileToGLSL100:c}=t;this.programProps={program:e,vs:n,fs:r,modules:i,defines:o,inject:s,varyings:a,bufferMode:l,transpileToGLSL100:c},this._programDirty=!0}getUniforms(){return this.uniforms}setDrawMode(t){return this.drawMode=t,this}setVertexCount(t){return xA(Number.isFinite(t)),this.vertexCount=t,this}setInstanceCount(t){return xA(Number.isFinite(t)),this.instanceCount=t,this}setGeometry(t){return this.drawMode=t.drawMode,this.vertexCount=t.getVertexCount(),this._deleteGeometryBuffers(),this.geometryBuffers=function(t,e,n){const r={};let i=e.indices;for(const o in e.attributes){const s=e.attributes[o],a=eM(o,n);if("indices"===o)i=s;else if(s.constant)r[a]=s.value;else{const e=s.value,n={...s};delete n.value,r[a]=[new UA(t,e),n],nM(o,n)}}if(i){const e=i.value||i;xA(e instanceof Uint16Array||e instanceof Uint32Array,'attribute array for "indices" must be of integer type');const n={size:1,isIndexed:void 0===i.isIndexed||i.isIndexed};r.indices=[new UA(t,{data:e,target:34963}),n]}return r}(this.gl,t),this.vertexArray.setAttributes(this.geometryBuffers),this}setAttributes(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(EA(t))return this;const e={};for(const n in t){const r=t[n];e[n]=r.getValue?r.getValue():r}return this.vertexArray.setAttributes(e),this}setUniforms(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object.assign(this.uniforms,t),this}getModuleUniforms(t){this._checkProgram();const e=this.programManager.getUniforms(this.program);return e?e(t):{}}updateModuleSettings(t){const e=this.getModuleUniforms(t||{});return this.setUniforms(e)}clear(t){return e_(this.program.gl,t),this}draw(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this._checkProgram();const{moduleSettings:e=null,framebuffer:n,uniforms:r={},attributes:i={},transformFeedback:o=this.transformFeedback,parameters:s={},vertexArray:a=this.vertexArray}=t;let l;this.setAttributes(i),this.updateModuleSettings(e),this.setUniforms(r),hx.priority>=2&&(l=this._logDrawCallStart(2));const c=this.vertexArray.getDrawParams(),{isIndexed:u=c.isIndexed,indexType:d=c.indexType,indexOffset:h=c.indexOffset,vertexArrayInstanced:f=c.isInstanced}=this.props;f&&!this.isInstanced&&hx.warn("Found instanced attributes on non-instanced model",this.id)();const{isInstanced:p,instanceCount:g}=this,{onBeforeRender:m=rM,onAfterRender:v=rM}=this.props;m(),this.program.setUniforms(this.uniforms);const b=this.program.draw(Object.assign(iM,t,{logPriority:l,uniforms:null,framebuffer:n,parameters:s,drawMode:this.getDrawMode(),vertexCount:this.getVertexCount(),vertexArray:a,transformFeedback:o,isIndexed:u,indexType:d,isInstanced:p,instanceCount:g,offset:u?h:0}));return v(),hx.priority>=2&&this._logDrawCallEnd(l,a,n),b}transform(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{discard:e=!0,feedbackBuffers:n,unbindModels:r=[]}=t;let{parameters:i}=t;n&&this._setFeedbackBuffers(n),e&&(i=Object.assign({},i,{35977:e})),r.forEach((t=>t.vertexArray.unbindBuffers()));try{this.draw(Object.assign({},t,{parameters:i}))}finally{r.forEach((t=>t.vertexArray.bindBuffers()))}return this}render(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return hx.warn("Model.render() is deprecated. Use Model.setUniforms() and Model.draw()")(),this.setUniforms(t).draw()}_setModelProps(t){Object.assign(this.props,t),"uniforms"in t&&this.setUniforms(t.uniforms),"pickable"in t&&(this.pickable=t.pickable),"instanceCount"in t&&(this.instanceCount=t.instanceCount),"geometry"in t&&this.setGeometry(t.geometry),"attributes"in t&&this.setAttributes(t.attributes),"_feedbackBuffers"in t&&this._setFeedbackBuffers(t._feedbackBuffers)}_checkProgram(){if(!(this._programDirty||this.programManager.stateHash!==this._programManagerState))return;let{program:t}=this.programProps;if(t)this._managedProgram=!1;else{const{vs:e,fs:n,modules:r,inject:i,defines:o,varyings:s,bufferMode:a,transpileToGLSL100:l}=this.programProps;t=this.programManager.get({vs:e,fs:n,modules:r,inject:i,defines:o,varyings:s,bufferMode:a,transpileToGLSL100:l}),this.program&&this._managedProgram&&this.programManager.release(this.program),this._programManagerState=this.programManager.stateHash,this._managedProgram=!0}xA(t instanceof eS,"Model needs a program"),this._programDirty=!1,t!==this.program&&(this.program=t,this.vertexArray?this.vertexArray.setProps({program:this.program,attributes:this.vertexArray.attributes}):this.vertexArray=new KP(this.gl,{program:this.program}),this.setUniforms(Object.assign({},this.getModuleUniforms())))}_deleteGeometryBuffers(){for(const t in this.geometryBuffers){const e=this.geometryBuffers[t][0]||this.geometryBuffers[t];e instanceof UA&&e.delete()}}_setAnimationProps(t){this.animated&&xA(t,"Model.draw(): animated uniforms but no animationProps")}_setFeedbackBuffers(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(EA(t))return this;const{gl:e}=this.program;return this.transformFeedback=this.transformFeedback||new RP(e,{program:this.program}),this.transformFeedback.setBuffers(t),this}_logDrawCallStart(t){const e=t>3?0:1e4;if(!(Date.now()-this.lastLogTime>> DRAWING MODEL ".concat(this.id),{collapsed:hx.level<=2})(),t}_logDrawCallEnd(t,e,n,r){if(void 0===t)return;const i=function(t){let{vertexArray:e,header:n="Attributes"}=t;if(!e.configuration)return{};const r={};e.elements&&(r.ELEMENT_ARRAY_BUFFER=qP(e,e.elements,null,n));const i=e.values;for(const o in i){const t=e._getAttributeInfo(o);if(t){let s="".concat(o,": ").concat(t.name);const a=e.accessors[t.location];a&&(s="".concat(o,": ").concat(YP(t.name,a))),r[s]=qP(e,i[o],a,n)}}return r}({vertexArray:e,header:"".concat(this.id," attributes"),attributes:this._attributes}),{table:o,unusedTable:s,unusedCount:a}=QP({header:"".concat(this.id," uniforms"),program:this.program,uniforms:Object.assign({},this.program.uniforms,n)}),{table:l,count:c}=QP({header:"".concat(this.id," uniforms"),program:this.program,uniforms:Object.assign({},this.program.uniforms,n),undefinedOnly:!0});c>0&&hx.log("MISSING UNIFORMS",Object.keys(l))(),a>0&&hx.log("UNUSED UNIFORMS",Object.keys(s))();const u=function(t){const e={},n="Accessors for ".concat(t.id);for(const r of t.attributeInfos)if(r){const t=$P(r);e["in ".concat(t)]={[n]:JSON.stringify(r.accessor)}}for(const r of t.varyingInfos)if(r){const t=$P(r);e["out ".concat(t)]={[n]:JSON.stringify(r.accessor)}}return e}(this.vertexArray.configuration);hx.table(t,i)(),hx.table(t,o)(),hx.table(t+1,u)(),r&&r.log({logLevel:2,message:"Rendered to ".concat(r.id)}),hx.groupEnd(2)()}}class sM{static isSupported(t){return vx(t)}constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.gl=t,this.model=null,this.elementCount=0,this.bufferTransform=null,this.textureTransform=null,this.elementIDBuffer=null,this._initialize(e),Object.seal(this)}delete(){const{model:t,bufferTransform:e,textureTransform:n}=this;t&&t.delete(),e&&e.delete(),n&&n.delete()}run(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{clearRenderTarget:e=!0}=t,n=this._updateDrawOptions(t);e&&n.framebuffer&&n.framebuffer.clear({color:!0}),this.model.transform(n)}swap(){let t=!1;const e=[this.bufferTransform,this.textureTransform].filter(Boolean);for(const n of e)t=t||n.swap();xA(t,"Nothing to swap")}getBuffer(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return this.bufferTransform&&this.bufferTransform.getBuffer(t)}getData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e=[this.bufferTransform,this.textureTransform].filter(Boolean);for(const n of e){const e=n.getData(t);if(e)return e}return null}getFramebuffer(){return this.textureTransform&&this.textureTransform.getFramebuffer()}update(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"elementCount"in t&&this.model.setVertexCount(t.elementCount);const e=[this.bufferTransform,this.textureTransform].filter(Boolean);for(const n of e)n.update(t)}_initialize(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{gl:e}=this;this._buildResourceTransforms(e,t),t=this._updateModelProps(t),this.model=new oM(e,Object.assign({},t,{fs:t.fs||kP({version:BP(t.vs)}),id:t.id||"transform-model",drawMode:t.drawMode||0,vertexCount:t.elementCount})),this.bufferTransform&&this.bufferTransform.setupResources({model:this.model})}_updateModelProps(t){let e=Object.assign({},t);const n=[this.bufferTransform,this.textureTransform].filter(Boolean);for(const r of n)e=r.updateModelProps(e);return e}_buildResourceTransforms(t,e){(function(t){if(!EA(t.feedbackBuffers)||!EA(t.feedbackMap)||t.varyings&&t.varyings.length>0)return!0;return!1})(e)&&(this.bufferTransform=new IP(t,e)),function(t){if(!EA(t._sourceTextures)||t._targetTexture||t._targetTextureVarying)return!0;return!1}(e)&&(this.textureTransform=new UP(t,e)),xA(this.bufferTransform||this.textureTransform,"must provide source/feedback buffers or source/target textures")}_updateDrawOptions(t){let e=Object.assign({},t);const n=[this.bufferTransform,this.textureTransform].filter(Boolean);for(const r of n)e=Object.assign(e,r.getDrawOptions(e));return e}}const aM="\n#define SHADER_NAME interpolation-transition-vertex-shader\n\nuniform float time;\nattribute ATTRIBUTE_TYPE aFrom;\nattribute ATTRIBUTE_TYPE aTo;\nvarying ATTRIBUTE_TYPE vCurrent;\n\nvoid main(void) {\n vCurrent = mix(aFrom, aTo, time);\n gl_Position = vec4(0.0);\n}\n";const lM={interpolation:class{constructor(t){let{gl:e,attribute:n,timeline:r}=t;ge(this,"gl",void 0),ge(this,"type","interpolation"),ge(this,"attributeInTransition",void 0),ge(this,"settings",void 0),ge(this,"attribute",void 0),ge(this,"transition",void 0),ge(this,"currentStartIndices",void 0),ge(this,"currentLength",void 0),ge(this,"transform",void 0),ge(this,"buffers",void 0),this.gl=e,this.transition=new IS(r),this.attribute=n,this.attributeInTransition=new PP(e,n.settings),this.currentStartIndices=n.startIndices,this.currentLength=0,this.transform=function(t,e){const n=wP(e.size);return new sM(t,{vs:aM,defines:{ATTRIBUTE_TYPE:n},varyings:["vCurrent"]})}(e,n);const i={byteLength:0,usage:35050};this.buffers=[new UA(e,i),new UA(e,i)]}get inProgress(){return this.transition.inProgress}start(t,e){if(t.duration<=0)return void this.transition.cancel();this.settings=t;const{gl:n,buffers:r,attribute:i}=this;SP(r);const o={numInstances:e,attribute:i,fromLength:this.currentLength,fromStartIndices:this.currentStartIndices,getData:t.enter};for(const s of r)EP({buffer:s,...o});this.currentStartIndices=i.startIndices,this.currentLength=CP(i,e),this.attributeInTransition.setData({buffer:r[1],value:i.value}),this.transition.start(t),this.transform.update({elementCount:Math.floor(this.currentLength/i.size),sourceBuffers:{aFrom:r[0],aTo:_P(0,i)},feedbackBuffers:{vCurrent:r[1]}})}update(){const t=this.transition.update();if(t){const{duration:t,easing:e}=this.settings,{time:n}=this.transition;let r=n/t;e&&(r=e(r)),this.transform.run({uniforms:{time:r}})}return t}cancel(){this.transition.cancel(),this.transform.delete();for(const t of this.buffers)t.delete();this.buffers.length=0}},spring:class{constructor(t){let{gl:e,attribute:n,timeline:r}=t;ge(this,"gl",void 0),ge(this,"type","spring"),ge(this,"attributeInTransition",void 0),ge(this,"settings",void 0),ge(this,"attribute",void 0),ge(this,"transition",void 0),ge(this,"currentStartIndices",void 0),ge(this,"currentLength",void 0),ge(this,"texture",void 0),ge(this,"framebuffer",void 0),ge(this,"transform",void 0),ge(this,"buffers",void 0),this.gl=e,this.type="spring",this.transition=new IS(r),this.attribute=n,this.attributeInTransition=new PP(e,{...n.settings,normalized:!1}),this.currentStartIndices=n.startIndices,this.currentLength=0,this.texture=function(t){return new qA(t,{data:new Uint8Array(4),format:6408,type:5121,border:0,mipmaps:!1,dataFormat:6408,width:1,height:1})}(e),this.framebuffer=function(t,e){return new j_(t,{id:"spring-transition-is-transitioning-framebuffer",width:1,height:1,attachments:{36064:e}})}(e,this.texture),this.transform=function(t,e,n){const r=wP(e.size);return new sM(t,{framebuffer:n,vs:"\n#define SHADER_NAME spring-transition-vertex-shader\n\n#define EPSILON 0.00001\n\nuniform float stiffness;\nuniform float damping;\nattribute ATTRIBUTE_TYPE aPrev;\nattribute ATTRIBUTE_TYPE aCur;\nattribute ATTRIBUTE_TYPE aTo;\nvarying ATTRIBUTE_TYPE vNext;\nvarying float vIsTransitioningFlag;\n\nATTRIBUTE_TYPE getNextValue(ATTRIBUTE_TYPE cur, ATTRIBUTE_TYPE prev, ATTRIBUTE_TYPE dest) {\n ATTRIBUTE_TYPE velocity = cur - prev;\n ATTRIBUTE_TYPE delta = dest - cur;\n ATTRIBUTE_TYPE spring = delta * stiffness;\n ATTRIBUTE_TYPE damper = velocity * -1.0 * damping;\n return spring + damper + velocity + cur;\n}\n\nvoid main(void) {\n bool isTransitioning = length(aCur - aPrev) > EPSILON || length(aTo - aCur) > EPSILON;\n vIsTransitioningFlag = isTransitioning ? 1.0 : 0.0;\n\n vNext = getNextValue(aCur, aPrev, aTo);\n gl_Position = vec4(0, 0, 0, 1);\n gl_PointSize = 100.0;\n}\n",fs:"\n#define SHADER_NAME spring-transition-is-transitioning-fragment-shader\n\nvarying float vIsTransitioningFlag;\n\nvoid main(void) {\n if (vIsTransitioningFlag == 0.0) {\n discard;\n }\n gl_FragColor = vec4(1.0);\n}",defines:{ATTRIBUTE_TYPE:r},varyings:["vNext"]})}(e,n,this.framebuffer);const i={byteLength:0,usage:35050};this.buffers=[new UA(e,i),new UA(e,i),new UA(e,i)]}get inProgress(){return this.transition.inProgress}start(t,e){const{gl:n,buffers:r,attribute:i}=this,o={numInstances:e,attribute:i,fromLength:this.currentLength,fromStartIndices:this.currentStartIndices,getData:t.enter};for(const s of r)EP({buffer:s,...o});this.settings=t,this.currentStartIndices=i.startIndices,this.currentLength=CP(i,e),this.attributeInTransition.setData({buffer:r[1],value:i.value}),this.transition.start({...t,duration:1/0}),this.transform.update({elementCount:Math.floor(this.currentLength/i.size),sourceBuffers:{aTo:_P(0,i)}})}update(){const{buffers:t,transform:e,framebuffer:n,transition:r}=this;if(!r.update())return!1;const i=this.settings;e.update({sourceBuffers:{aPrev:t[0],aCur:t[1]},feedbackBuffers:{vNext:t[2]}}),e.run({framebuffer:n,discard:!1,clearRenderTarget:!0,uniforms:{stiffness:i.stiffness,damping:i.damping},parameters:{depthTest:!1,blend:!0,viewport:[0,0,1,1],blendFunc:[1,1],blendEquation:[32776,32776]}}),SP(t),this.attributeInTransition.setData({buffer:t[1],value:this.attribute.value});return a_(n)[0]>0||r.end(),!0}cancel(){this.transition.cancel(),this.transform.delete();for(const t of this.buffers)t.delete();this.buffers.length=0,this.texture.delete(),this.framebuffer.delete()}}};class cM{constructor(t,e){let{id:n,timeline:r}=e;ge(this,"id",void 0),ge(this,"isSupported",void 0),ge(this,"gl",void 0),ge(this,"timeline",void 0),ge(this,"transitions",void 0),ge(this,"needsRedraw",void 0),ge(this,"numInstances",void 0),this.id=n,this.gl=t,this.timeline=r,this.transitions={},this.needsRedraw=!1,this.numInstances=1,this.isSupported=sM.isSupported(t)}finalize(){for(const t in this.transitions)this._removeTransition(t)}update(t){let{attributes:e,transitions:n,numInstances:r}=t;this.numInstances=r||1;for(const i in e){const t=e[i],r=t.getTransitionSetting(n);r&&this._updateAttribute(i,t,r)}for(const i in this.transitions){const t=e[i];t&&t.getTransitionSetting(n)||this._removeTransition(i)}}hasAttribute(t){const e=this.transitions[t];return e&&e.inProgress}getAttributes(){const t={};for(const e in this.transitions){const n=this.transitions[e];n.inProgress&&(t[e]=n.attributeInTransition)}return t}run(){if(!this.isSupported||0===this.numInstances)return!1;for(const e in this.transitions){this.transitions[e].update()&&(this.needsRedraw=!0)}const t=this.needsRedraw;return this.needsRedraw=!1,t}_removeTransition(t){this.transitions[t].cancel(),delete this.transitions[t]}_updateAttribute(t,e,n){const r=this.transitions[t];let i=!r||r.type!==n.type;if(i){if(!this.isSupported)return void Rg.warn("WebGL2 not supported by this browser. Transition for ".concat(t," is disabled."))();r&&this._removeTransition(t);const o=lM[n.type];o?this.transitions[t]=new o({attribute:e,timeline:this.timeline,gl:this.gl}):(Rg.error("unsupported transition type '".concat(n.type,"'"))(),i=!1)}(i||e.needsRedraw())&&(this.needsRedraw=!0,this.transitions[t].start(n,this.numInstances))}}const uM="attributeManager.invalidate";class dM{constructor(t){let{id:e="attribute-manager",stats:n,timeline:r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};ge(this,"id",void 0),ge(this,"gl",void 0),ge(this,"attributes",void 0),ge(this,"updateTriggers",void 0),ge(this,"needsRedraw",void 0),ge(this,"userData",void 0),ge(this,"stats",void 0),ge(this,"attributeTransitionManager",void 0),ge(this,"mergeBoundsMemoized",dS(rb)),this.id=e,this.gl=t,this.attributes={},this.updateTriggers={},this.needsRedraw=!0,this.userData={},this.stats=n,this.attributeTransitionManager=new cM(t,{id:"".concat(e,"-transitions"),timeline:r}),Object.seal(this)}finalize(){for(const t in this.attributes)this.attributes[t].delete();this.attributeTransitionManager.finalize()}getNeedsRedraw(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{clearRedrawFlags:!1};const e=this.needsRedraw;return this.needsRedraw=this.needsRedraw&&!t.clearRedrawFlags,e&&this.id}setNeedsRedraw(){this.needsRedraw=!0}add(t){this._add(t)}addInstanced(t){this._add(t,{instanced:1})}remove(t){for(const e of t)void 0!==this.attributes[e]&&(this.attributes[e].delete(),delete this.attributes[e])}invalidate(t,e){const n=this._invalidateTrigger(t,e);Lg(uM,this,t,n)}invalidateAll(t){for(const e in this.attributes)this.attributes[e].setNeedsUpdate(e,t);Lg(uM,this,"all")}update(t){let{data:e,numInstances:n,startIndices:r=null,transitions:i,props:o={},buffers:s={},context:a={}}=t,l=!1;Lg("attributeManager.updateStart",this),this.stats&&this.stats.get("Update Attributes").timeStart();for(const c in this.attributes){const t=this.attributes[c],i=t.settings.accessor;t.startIndices=r,t.numInstances=n,o[c]&&Rg.removed("props.".concat(c),"data.attributes.".concat(c))(),t.setExternalBuffer(s[c])||t.setBinaryValue("string"===typeof i?s[i]:void 0,e.startIndices)||"string"===typeof i&&!s[i]&&t.setConstantValue(o[i])||t.needsUpdate()&&(l=!0,this._updateAttribute({attribute:t,numInstances:n,data:e,props:o,context:a})),this.needsRedraw=this.needsRedraw||t.needsRedraw()}l&&Lg("attributeManager.updateEnd",this,n),this.stats&&this.stats.get("Update Attributes").timeEnd(),this.attributeTransitionManager.update({attributes:this.attributes,numInstances:n,transitions:i})}updateTransition(){const{attributeTransitionManager:t}=this,e=t.run();return this.needsRedraw=this.needsRedraw||e,e}getAttributes(){return this.attributes}getBounds(t){const e=t.map((t=>{var e;return null===(e=this.attributes[t])||void 0===e?void 0:e.getBounds()}));return this.mergeBoundsMemoized(e)}getChangedAttributes(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{clearChangedFlags:!1};const{attributes:e,attributeTransitionManager:n}=this,r={...n.getAttributes()};for(const i in e){const o=e[i];o.needsRedraw(t)&&!n.hasAttribute(i)&&(r[i]=o)}return r}getShaderAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t||(t=this.getAttributes());const n={};for(const r in t)e[r]||Object.assign(n,t[r].getShaderAttributes());return n}_add(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};for(const n in t){const r=t[n];this.attributes[n]=this._createAttribute(n,r,e)}this._mapUpdateTriggersToAttributes()}_createAttribute(t,e,n){const r={...e,id:t,size:(e.isIndexed?1:e.size)||1,divisor:n.instanced?1:e.divisor||0};return new PP(this.gl,r)}_mapUpdateTriggersToAttributes(){const t={};for(const e in this.attributes){this.attributes[e].getUpdateTriggers().forEach((n=>{t[n]||(t[n]=[]),t[n].push(e)}))}this.updateTriggers=t}_invalidateTrigger(t,e){const{attributes:n,updateTriggers:r}=this,i=r[t];return i&&i.forEach((t=>{const r=n[t];r&&r.setNeedsUpdate(r.id,e)})),i}_updateAttribute(t){const{attribute:e,numInstances:n}=t;if(Lg("attribute.updateStart",e),e.constant)return void e.setConstantValue(e.value);e.allocate(n)&&Lg("attribute.allocate",e,n);e.updateBuffer(t)&&(this.needsRedraw=!0,Lg("attribute.updateEnd",e,n))}}const hM=1e-5;function fM(t,e,n,r,i){const o=e-t;return(n-e)*i+-o*r+o+e}function pM(t,e){if(Array.isArray(t)){let n=0;for(let r=0;r0}add(t,e,n,r){const{transitions:i}=this;if(i.has(t)){const n=i.get(t),{value:r=n.settings.fromValue}=n;e=r,this.remove(t)}if(!(r=AP(r)))return;const o=gM[r.type];if(!o)return void Rg.error("unsupported transition type '".concat(r.type,"'"))();const s=new o(this.timeline);s.start({...r,fromValue:e,toValue:n}),i.set(t,s)}remove(t){const{transitions:e}=this;e.has(t)&&(e.get(t).cancel(),e.delete(t))}update(){const t={};for(const[e,n]of this.transitions)n.update(),t[e]=n.value,n.inProgress||this.remove(e);return t}clear(){for(const t of this.transitions.keys())this.remove(t)}}function vM(t,e){const n=yM({newProps:t,oldProps:e,propTypes:t[sg],ignoreProps:{data:null,updateTriggers:null,extensions:null,transitions:null}}),r=function(t,e){if(null===e)return"oldProps is null, initial diff";let n=!1;const{dataComparator:r,_dataDiff:i}=t;r?r(t.data,e.data)||(n="Data comparator detected a change"):t.data!==e.data&&(n="A new data container was supplied");n&&i&&(n=i(t.data,e.data)||n);return n}(t,e);let i=!1;return r||(i=function(t,e){if(null===e)return{all:!0};if("all"in t.updateTriggers){if(_M(t,e,"all"))return{all:!0}}const n={};let r=!1;for(const i in t.updateTriggers)if("all"!==i){_M(t,e,i)&&(n[i]=!0,r=!0)}return!!r&&n}(t,e)),{dataChanged:r,propsChanged:n,updateTriggersChanged:i,extensionsChanged:AM(t,e),transitionsChanged:bM(t,e)}}function bM(t,e){if(!t.transitions)return!1;const n={},r=t[sg];let i=!1;for(const o in t.transitions){const s=r[o],a=s&&s.type;("number"===a||"color"===a||"array"===a)&&xM(t[o],e[o],s)&&(n[o]=!0,i=!0)}return!!i&&n}function yM(t){let{newProps:e,oldProps:n,ignoreProps:r={},propTypes:i={},triggerName:o="props"}=t;if(n===e)return!1;if("object"!==typeof e||null===e)return"".concat(o," changed shallowly");if("object"!==typeof n||null===n)return"".concat(o," changed shallowly");for(const s of Object.keys(e))if(!(s in r)){if(!(s in n))return"".concat(o,".").concat(s," added");const t=xM(e[s],n[s],i[s]);if(t)return"".concat(o,".").concat(s," ").concat(t)}for(const s of Object.keys(n))if(!(s in r)){if(!(s in e))return"".concat(o,".").concat(s," dropped");if(!Object.hasOwnProperty.call(e,s)){const t=xM(e[s],n[s],i[s]);if(t)return"".concat(o,".").concat(s," ").concat(t)}}return!1}function xM(t,e,n){let r=n&&n.equal;return r&&!r(t,e,n)?"changed deeply":r||(r=t&&e&&t.equals,!r||r.call(t,e))?r||e===t?null:"changed shallowly":"changed deeply"}function AM(t,e){if(null===e)return!0;const n=e.extensions,{extensions:r}=t;if(r===n)return!1;if(!n||!r)return!0;if(r.length!==n.length)return!0;for(let i=0;i"project64"===t.name)))){const t=n.modules.findIndex((t=>"project32"===t.name));t>=0&&n.modules.splice(t,1)}if("inject"in e)if(t.inject){const r={...t.inject};for(const t in e.inject)r[t]=(r[t]||"")+e.inject[t];n.inject=r}else n.inject=e.inject;return n}const CM=[0,0,0];function EM(t,e){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r=e.projectPosition(t);if(n&&e instanceof RS){const[n,i,o=0]=t,s=e.getDistanceScales([n,i]);r[2]=o*s.unitsPerMeter[2]}return r}function PM(t,e){let{viewport:n,modelMatrix:r,coordinateSystem:i,coordinateOrigin:o,offsetMode:s}=e,[a,l,c=0]=t;switch(r&&([a,l,c]=Ab([],[a,l,c,1],r)),i){case dy.LNGLAT:return EM([a,l,c],n,s);case dy.LNGLAT_OFFSETS:return EM([a+o[0],l+o[1],c+(o[2]||0)],n,s);case dy.METER_OFFSETS:return EM(Zb(o,[a,l,c]),n,s);case dy.CARTESIAN:default:return n.isGeospatial?[a+o[0],l+o[1],c+o[2]]:n.projectPosition([a,l,c])}}function MM(t,e){const{viewport:n,coordinateSystem:r,coordinateOrigin:i,modelMatrix:o,fromCoordinateSystem:s,fromCoordinateOrigin:a}=function(t){const{viewport:e,modelMatrix:n,coordinateOrigin:r}=t;let{coordinateSystem:i,fromCoordinateSystem:o,fromCoordinateOrigin:s}=t;return i===dy.DEFAULT&&(i=e.isGeospatial?dy.LNGLAT:dy.CARTESIAN),void 0===o&&(o=i),void 0===s&&(s=r),{viewport:e,coordinateSystem:i,coordinateOrigin:r,modelMatrix:n,fromCoordinateSystem:o,fromCoordinateOrigin:s}}(e),{autoOffset:l=!0}=e,{geospatialOrigin:c=CM,shaderCoordinateOrigin:u=CM,offsetMode:d=!1}=l?bS(n,r,i):{},h=PM(t,{viewport:n,modelMatrix:o,coordinateSystem:s,coordinateOrigin:a,offsetMode:d});if(d){const t=n.projectPosition(c||u);Wv(h,h,t)}return h}const TM={10241:9987,10240:9729,10242:33071,10243:33071},OM={};const kM={boolean:{validate:(t,e)=>!0,equal:(t,e,n)=>Boolean(t)===Boolean(e)},number:{validate:(t,e)=>Number.isFinite(t)&&(!("max"in e)||t<=e.max)&&(!("min"in e)||t>=e.min)},color:{validate:(t,e)=>e.optional&&!t||BM(t)&&(3===t.length||4===t.length),equal:(t,e,n)=>CS(t,e,1)},accessor:{validate(t,e){const n=LM(t);return"function"===n||n===LM(e.value)},equal:(t,e,n)=>"function"===typeof e||CS(t,e,1)},array:{validate:(t,e)=>e.optional&&!t||BM(t),equal(t,e,n){const{compare:r}=n,i=Number.isInteger(r)?r:r?1:0;return r?CS(t,e,i):t===e}},object:{equal(t,e,n){if(n.ignore)return!0;const{compare:r}=n,i=Number.isInteger(r)?r:r?1:0;return r?CS(t,e,i):t===e}},function:{validate:(t,e)=>e.optional&&!t||"function"===typeof t,equal:(t,e,n)=>!n.compare&&!1!==n.ignore||t===e},data:{transform:(t,e,n)=>{const{dataTransform:r}=n.props;return r&&t?r(t):t}},image:{transform:(t,e,n)=>{const r=n.context;return r&&r.gl?function(t,e,n,r){if(n instanceof qA)return n;n.constructor&&"Object"!==n.constructor.name&&(n={data:n});let i=null;n.compressed&&(i={10241:n.data.length>1?9985:9729});const o=new qA(e,{...n,parameters:{...TM,...i,...r}});return OM[o.id]=t,o}(n.id,r.gl,t,{...e.parameters,...n.props.textureParameters}):null},release:(t,e,n)=>{var r,i;r=n.id,(i=t)&&i instanceof qA&&OM[i.id]===r&&(i.delete(),delete OM[i.id])}}};function RM(t,e){switch(LM(e)){case"object":return IM(t,e);case"array":return IM(t,{type:"array",value:e,compare:!1});case"boolean":return IM(t,{type:"boolean",value:e});case"number":return IM(t,{type:"number",value:e});case"function":return IM(t,{type:"function",value:e,compare:!0});default:return{name:t,type:"unknown",value:e}}}function IM(t,e){return"type"in e?{name:t,...kM[e.type],...e}:"value"in e?{name:t,type:LM(e.value),...e}:{name:t,type:"object",value:e}}function BM(t){return Array.isArray(t)||ArrayBuffer.isView(t)}function LM(t){return BM(t)?"array":null===t?"null":typeof t}const DM="_mergedDefaultProps";function FM(t,e){let n=DM;if(e)for(const i of e){const t=i.constructor;t&&(n+=":".concat(t.extensionName||t.name))}const r=zM(t,n);return r||(t[n]=function(t,e){const n=t.prototype;if(!n)return null;const r=Object.getPrototypeOf(t),i=FM(r),o=zM(t,"defaultProps")||{},s=function(t){const e={},n={},r={};for(const[i,o]of Object.entries(t)){const t=null===o||void 0===o?void 0:o.deprecatedFor;if(t)r[i]=Array.isArray(t)?t:[t];else{const t=RM(i,o);e[i]=t,n[i]=t.value}}return{propTypes:e,defaultProps:n,deprecatedProps:r}}(o),a=Object.assign(Object.create(null),i,s.defaultProps),l=Object.assign(Object.create(null),null===i||void 0===i?void 0:i[sg],s.propTypes),c=Object.assign(Object.create(null),null===i||void 0===i?void 0:i[ag],s.deprecatedProps);for(const u of e){const t=FM(u.constructor);t&&(Object.assign(a,t),Object.assign(l,t[sg]),Object.assign(c,t[ag]))}(function(t,e){const n=function(t){const e=t.componentName;e||Rg.warn("".concat(t.name,".componentName not specified"))();return e||t.name}(e);Object.defineProperties(t,{id:{writable:!0,value:n}})})(a,t),function(t,e){const n={},r={};for(const i in e){const t=e[i],{name:o,value:s}=t;t.async&&(n[o]=s,r[o]=NM(o))}t[lg]=n,t[cg]={},Object.defineProperties(t,r)}(a,l),function(t,e){for(const n in e)Object.defineProperty(t,n,{enumerable:!1,set(t){const r="".concat(this.id,": ").concat(n);for(const i of e[n])jM(this,i)||(this[i]=t);Rg.deprecated(r,e[n].join("/"))()}})}(a,c),a[sg]=l,a[ag]=c,0!==e.length||jM(t,"_propTypes")||(t._propTypes=l);return a}(t,e||[]))}function NM(t){return{enumerable:!0,set(e){"string"===typeof e||e instanceof Promise||gP(e)?this[cg][t]=e:this[ug][t]=e},get(){if(this[ug]){if(t in this[ug]){return this[ug][t]||this[lg][t]}if(t in this[cg]){const e=this[og]&&this[og].internalState;if(e&&e.hasAsyncProp(t))return e.getAsyncProp(t)||this[lg][t]}}return this[lg][t]}}}function jM(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function zM(t,e){return jM(t,e)&&t[e]}let UM=0;class VM{constructor(){ge(this,"id",void 0),ge(this,"props",void 0),ge(this,"count",void 0);for(var t=arguments.length,e=new Array(t),n=0;n=0;o--){const t=e[o];"extensions"in t&&(n=t.extensions)}const r=FM(t.constructor,n),i=Object.create(r);i[og]=t,i[cg]={},i[ug]={};for(let o=0;o{},this.oldProps=null,this.oldAsyncProps=null}finalize(){for(const t in this.asyncProps){const e=this.asyncProps[t];e&&e.type&&e.type.release&&e.type.release(e.resolvedValue,e.type,this.component)}this.asyncProps={},this.component=null,this.resetOldProps()}getOldProps(){return this.oldAsyncProps||this.oldProps||GM}resetOldProps(){this.oldAsyncProps=null,this.oldProps=this.component?this.component.props:null}hasAsyncProp(t){return t in this.asyncProps}getAsyncProp(t){const e=this.asyncProps[t];return e&&e.resolvedValue}isAsyncPropLoading(t){if(t){const e=this.asyncProps[t];return Boolean(e&&e.pendingLoadCount>0&&e.pendingLoadCount!==e.resolvedLoadCount)}for(const e in this.asyncProps)if(this.isAsyncPropLoading(e))return!0;return!1}reloadAsyncProp(t,e){this._watchPromise(t,Promise.resolve(e))}setAsyncProps(t){this.component=t[og]||this.component;const e=t[ug]||{},n=t[cg]||t,r=t[lg]||{};for(const i in e){const t=e[i];this._createAsyncPropData(i,r[i]),this._updateAsyncProp(i,t),e[i]=this.getAsyncProp(i)}for(const i in n){const t=n[i];this._createAsyncPropData(i,r[i]),this._updateAsyncProp(i,t)}}_fetch(t,e){return null}_onResolve(t,e){}_onError(t,e){}_updateAsyncProp(t,e){this._didAsyncInputValueChange(t,e)&&("string"===typeof e&&(e=this._fetch(t,e)),e instanceof Promise?this._watchPromise(t,e):gP(e)?this._resolveAsyncIterable(t,e):this._setPropValue(t,e))}_freezeAsyncOldProps(){if(!this.oldAsyncProps&&this.oldProps){this.oldAsyncProps=Object.create(this.oldProps);for(const t in this.asyncProps)Object.defineProperty(this.oldAsyncProps,t,{enumerable:!0,value:this.oldProps[t]})}}_didAsyncInputValueChange(t,e){const n=this.asyncProps[t];return e!==n.resolvedValue&&e!==n.lastValue&&(n.lastValue=e,!0)}_setPropValue(t,e){this._freezeAsyncOldProps();const n=this.asyncProps[t];n&&(e=this._postProcessValue(n,e),n.resolvedValue=e,n.pendingLoadCount++,n.resolvedLoadCount=n.pendingLoadCount)}_setAsyncPropValue(t,e,n){const r=this.asyncProps[t];r&&n>=r.resolvedLoadCount&&void 0!==e&&(this._freezeAsyncOldProps(),r.resolvedValue=e,r.resolvedLoadCount=n,this.onAsyncPropUpdated(t,e))}_watchPromise(t,e){const n=this.asyncProps[t];if(n){n.pendingLoadCount++;const r=n.pendingLoadCount;e.then((e=>{this.component&&(e=this._postProcessValue(n,e),this._setAsyncPropValue(t,e,r),this._onResolve(t,e))})).catch((e=>{this._onError(t,e)}))}}async _resolveAsyncIterable(t,e){if("data"!==t)return void this._setPropValue(t,e);const n=this.asyncProps[t];if(!n)return;n.pendingLoadCount++;const r=n.pendingLoadCount;let i=[],o=0;for await(const s of e){if(!this.component)return;const{dataTransform:e}=this.component.props;i=e?e(s,i):i.concat(s),Object.defineProperty(i,"__diff",{enumerable:!1,value:[{startRow:o,endRow:i.length}]}),o=i.length,this._setAsyncPropValue(t,i,r)}this._onResolve(t,i)}_postProcessValue(t,e){const n=t.type;return n&&this.component&&(n.release&&n.release(t.resolvedValue,n,this.component),n.transform)?n.transform(e,n,this.component):e}_createAsyncPropData(t,e){if(!this.asyncProps[t]){const n=this.component&&this.component.props[sg];this.asyncProps[t]={type:n&&n[t],lastValue:null,resolvedValue:e,pendingLoadCount:0,resolvedLoadCount:0}}}}class HM extends WM{constructor(t){let{attributeManager:e,layer:n}=t;super(n),ge(this,"attributeManager",void 0),ge(this,"needsRedraw",void 0),ge(this,"needsUpdate",void 0),ge(this,"subLayers",void 0),ge(this,"usesPickingColorCache",void 0),ge(this,"hasPickingBuffer",void 0),ge(this,"changeFlags",void 0),ge(this,"viewport",void 0),ge(this,"uniformTransitions",void 0),ge(this,"propsInTransition",void 0),this.attributeManager=e,this.needsRedraw=!0,this.needsUpdate=!0,this.subLayers=null,this.usesPickingColorCache=!1}get layer(){return this.component}_fetch(t,e){const n=this.layer,r=null===n||void 0===n?void 0:n.props.fetch;return r?r(e,{propName:t,layer:n}):super._fetch(t,e)}_onResolve(t,e){const n=this.layer;if(n){const r=n.props.onDataLoad;"data"===t&&r&&r(e,{propName:t,layer:n})}}_onError(t,e){const n=this.layer;n&&n.raiseError(e,"loading ".concat(t," of ").concat(this.layer))}}const JM=2**24-1,KM=Object.freeze([]),XM=dS((t=>{let{oldViewport:e,viewport:n}=t;return e.equals(n)}));let qM=new Uint8ClampedArray(0);const YM={data:{type:"data",value:KM,async:!0},dataComparator:{type:"function",value:null,optional:!0},_dataDiff:{type:"function",value:t=>t&&t.__diff,optional:!0},dataTransform:{type:"function",value:null,optional:!0},onDataLoad:{type:"function",value:null,optional:!0},onError:{type:"function",value:null,optional:!0},fetch:{type:"function",value:(t,e)=>{let{propName:n,layer:r,loaders:i,loadOptions:o,signal:s}=e;const{resourceManager:a}=r.context;var l;(o=o||r.getLoadOptions(),i=i||r.props.loaders,s)&&(o={...o,fetch:{...null===(l=o)||void 0===l?void 0:l.fetch,signal:s}});let c=a.contains(t);return c||o||(a.add({resourceId:t,data:yv(t,i),persistent:!1}),c=!0),c?a.subscribe({resourceId:t,onChange:t=>{var e;return null===(e=r.internalState)||void 0===e?void 0:e.reloadAsyncProp(n,t)},consumerId:r.id,requestId:n}):yv(t,i,o)}},updateTriggers:{},visible:!0,pickable:!1,opacity:{type:"number",min:0,max:1,value:1},operation:"draw",onHover:{type:"function",value:null,optional:!0},onClick:{type:"function",value:null,optional:!0},onDragStart:{type:"function",value:null,optional:!0},onDrag:{type:"function",value:null,optional:!0},onDragEnd:{type:"function",value:null,optional:!0},coordinateSystem:dy.DEFAULT,coordinateOrigin:{type:"array",value:[0,0,0],compare:!0},modelMatrix:{type:"array",value:null,compare:!0,optional:!0},wrapLongitude:!1,positionFormat:"XYZ",colorFormat:"RGBA",parameters:{type:"object",value:{},optional:!0,compare:2},loadOptions:{type:"object",value:null,optional:!0,ignore:!0},transitions:null,extensions:[],loaders:{type:"array",value:[],optional:!0,ignore:!0},getPolygonOffset:{type:"function",value:t=>{let{layerIndex:e}=t;return[0,100*-e]}},highlightedObjectIndex:null,autoHighlight:!1,highlightColor:{type:"accessor",value:[0,0,128,128]}};class QM extends VM{constructor(){super(...arguments),ge(this,"internalState",null),ge(this,"lifecycle",$p),ge(this,"context",void 0),ge(this,"state",void 0),ge(this,"parent",null)}static get componentName(){return Object.prototype.hasOwnProperty.call(this,"layerName")?this.layerName:""}get root(){let t=this;for(;t.parent;)t=t.parent;return t}toString(){const t=this.constructor.layerName||this.constructor.name;return"".concat(t,"({id: '").concat(this.props.id,"'})")}project(t){OS(this.internalState);const e=this.internalState.viewport||this.context.viewport,n=PM(t,{viewport:e,modelMatrix:this.props.modelMatrix,coordinateOrigin:this.props.coordinateOrigin,coordinateSystem:this.props.coordinateSystem}),[r,i,o]=ny(n,e.pixelProjectionMatrix);return 2===t.length?[r,i]:[r,i,o]}unproject(t){OS(this.internalState);return(this.internalState.viewport||this.context.viewport).unproject(t)}projectPosition(t,e){OS(this.internalState);return MM(t,{viewport:this.internalState.viewport||this.context.viewport,modelMatrix:this.props.modelMatrix,coordinateOrigin:this.props.coordinateOrigin,coordinateSystem:this.props.coordinateSystem,...e})}get isComposite(){return!1}setState(t){this.setChangeFlags({stateChanged:!0}),Object.assign(this.state,t),this.setNeedsRedraw()}setNeedsRedraw(){this.internalState&&(this.internalState.needsRedraw=!0)}setNeedsUpdate(){this.internalState&&(this.context.layerManager.setNeedsUpdate(String(this)),this.internalState.needsUpdate=!0)}get isLoaded(){return!!this.internalState&&!this.internalState.isAsyncPropLoading()}get wrapLongitude(){return this.props.wrapLongitude}isPickable(){return this.props.pickable&&this.props.visible}getModels(){return this.state&&(this.state.models||this.state.model&&[this.state.model])||[]}setModuleParameters(t){for(const e of this.getModels())e.updateModuleSettings(t)}getAttributeManager(){return this.internalState&&this.internalState.attributeManager}getCurrentLayer(){return this.internalState&&this.internalState.layer}getLoadOptions(){return this.props.loadOptions}use64bitPositions(){const{coordinateSystem:t}=this.props;return t===dy.DEFAULT||t===dy.LNGLAT||t===dy.CARTESIAN}onHover(t,e){return this.props.onHover&&this.props.onHover(t,e)||!1}onClick(t,e){return this.props.onClick&&this.props.onClick(t,e)||!1}nullPickingColor(){return[0,0,0]}encodePickingColor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return e[0]=t+1&255,e[1]=t+1>>8&255,e[2]=t+1>>8>>8&255,e}decodePickingColor(t){OS(t instanceof Uint8Array);const[e,n,r]=t;return e+256*n+65536*r-1}getNumInstances(){return Number.isFinite(this.props.numInstances)?this.props.numInstances:this.state&&void 0!==this.state.numInstances?this.state.numInstances:wM(this.props.data)}getStartIndices(){return this.props.startIndices?this.props.startIndices:this.state&&this.state.startIndices?this.state.startIndices:null}getBounds(){var t;return null===(t=this.getAttributeManager())||void 0===t?void 0:t.getBounds(["positions","instancePositions"])}getShaders(t){for(const e of this.props.extensions)t=SM(t,e.getShaders.call(this,e));return t}shouldUpdateState(t){return t.changeFlags.propsOrDataChanged}updateState(t){const e=this.getAttributeManager(),{dataChanged:n}=t.changeFlags;if(n&&e)if(Array.isArray(n))for(const r of n)e.invalidateAll(r);else e.invalidateAll();if(e){const{props:n}=t,r=this.internalState.hasPickingBuffer,i=Number.isInteger(n.highlightedObjectIndex)||n.pickable||n.extensions.some((t=>t.getNeedsPickingBuffer.call(this,t)));if(r!==i){this.internalState.hasPickingBuffer=i;const{pickingColors:t,instancePickingColors:n}=e.attributes,r=t||n;r&&(i&&r.constant&&(r.constant=!1,e.invalidate(r.id)),r.value||i||(r.constant=!0,r.value=[0,0,0]))}}}finalizeState(t){for(const n of this.getModels())n.delete();const e=this.getAttributeManager();e&&e.finalize(),this.context&&this.context.resourceManager.unsubscribe({consumerId:this.id}),this.internalState&&(this.internalState.uniformTransitions.clear(),this.internalState.finalize())}draw(t){for(const e of this.getModels())e.draw(t)}getPickingInfo(t){let{info:e,mode:n,sourceLayer:r}=t;const{index:i}=e;return i>=0&&Array.isArray(this.props.data)&&(e.object=this.props.data[i]),e}raiseError(t,e){var n,r,i,o;(e&&(t=new Error("".concat(e,": ").concat(t.message),{cause:t})),null!==(n=(r=this.props).onError)&&void 0!==n&&n.call(r,t))||(null===(i=this.context)||void 0===i||null===(o=i.onError)||void 0===o||o.call(i,t,this))}getNeedsRedraw(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{clearRedrawFlags:!1};return this._getNeedsRedraw(t)}needsUpdate(){return!!this.internalState&&(this.internalState.needsUpdate||this.hasUniformTransition()||this.shouldUpdateState(this._getUpdateParams()))}hasUniformTransition(){var t;return(null===(t=this.internalState)||void 0===t?void 0:t.uniformTransitions.active)||!1}activateViewport(t){if(!this.internalState)return;const e=this.internalState.viewport;this.internalState.viewport=t,e&&XM({oldViewport:e,viewport:t})||(this.setChangeFlags({viewportChanged:!0}),this.isComposite?this.needsUpdate()&&this.setNeedsUpdate():this._update())}invalidateAttribute(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"all";const e=this.getAttributeManager();e&&("all"===t?e.invalidateAll():e.invalidate(t))}updateAttributes(t){for(const e of this.getModels())this._setModelAttributes(e,t)}_updateAttributes(){const t=this.getAttributeManager();if(!t)return;const e=this.props,n=this.getNumInstances(),r=this.getStartIndices();t.update({data:e.data,numInstances:n,startIndices:r,props:e,transitions:e.transitions,buffers:e.data.attributes,context:this});const i=t.getChangedAttributes({clearChangedFlags:!0});this.updateAttributes(i)}_updateAttributeTransition(){const t=this.getAttributeManager();t&&t.updateTransition()}_updateUniformTransition(){const{uniformTransitions:t}=this.internalState;if(t.active){const e=t.update(),n=Object.create(this.props);for(const t in e)Object.defineProperty(n,t,{value:e[t]});return n}return this.props}calculateInstancePickingColors(t,e){let{numInstances:n}=e;if(t.constant)return;const r=Math.floor(qM.length/3);if(this.internalState.usesPickingColorCache=!0,rJM&&Rg.warn("Layer has too many data objects. Picking might not be able to distinguish all objects.")(),qM=_v.allocate(qM,n,{size:3,copy:!0,maxCount:Math.max(n,JM)});const t=Math.floor(qM.length/3),e=[];for(let n=r;n(Rg.deprecated("layer.state.attributeManager","layer.getAttributeManager()")(),t)}),this.internalState.uniformTransitions=new mM(this.context.timeline),this.internalState.onAsyncPropUpdated=this._onAsyncPropUpdated.bind(this),this.internalState.setAsyncProps(this.props),this.initializeState(this.context);for(const e of this.props.extensions)e.initializeState.call(this,this.context,e);this.setChangeFlags({dataChanged:"init",propsChanged:"init",viewportChanged:!0,extensionsChanged:!0}),this._update()}_transferState(t){Lg("layer.matched",this,this===t);const{state:e,internalState:n}=t;this!==t&&(this.internalState=n,this.state=e,this.internalState.setAsyncProps(this.props),this._diffProps(this.props,this.internalState.getOldProps()))}_update(){const t=this.needsUpdate();if(Lg("layer.update",this,t),!t)return;const e=this.props,n=this.context,r=this.internalState,i=n.viewport,o=this._updateUniformTransition();r.propsInTransition=o,n.viewport=r.viewport||i,this.props=o;try{const t=this._getUpdateParams(),e=this.getModels();if(n.gl)this.updateState(t);else try{this.updateState(t)}catch(s){}for(const n of this.props.extensions)n.updateState.call(this,t,n);const r=this.getModels()[0]!==e[0];this._postUpdate(t,r)}finally{n.viewport=i,this.props=e,this._clearChangeFlags(),r.needsUpdate=!1,r.resetOldProps()}}_finalize(){Lg("layer.finalize",this),this.finalizeState(this.context);for(const t of this.props.extensions)t.finalizeState.call(this,this.context,t)}_drawLayer(t){let{moduleParameters:e=null,uniforms:n={},parameters:r={}}=t;this._updateAttributeTransition();const i=this.props,o=this.context;this.props=this.internalState.propsInTransition||i;const s=this.props.opacity;n.opacity=Math.pow(s,1/2.2);try{e&&this.setModuleParameters(e);const{getPolygonOffset:t}=this.props,i=t&&t(n)||[0,0];oA(o.gl,{polygonOffset:i}),aA(o.gl,r,(()=>{const t={moduleParameters:e,uniforms:n,parameters:r,context:o};for(const e of this.props.extensions)e.draw.call(this,t,e);this.draw(t)}))}finally{this.props=i}}getChangeFlags(){var t;return null===(t=this.internalState)||void 0===t?void 0:t.changeFlags}setChangeFlags(t){if(!this.internalState)return;const{changeFlags:e}=this.internalState;for(const r in t)if(t[r]){let n=!1;if("dataChanged"===r){const i=t[r],o=e[r];i&&Array.isArray(o)&&(e.dataChanged=Array.isArray(i)?o.concat(i):i,n=!0)}e[r]||(e[r]=t[r],n=!0),n&&Lg("layer.changeFlag",this,r,t)}const n=Boolean(e.dataChanged||e.updateTriggersChanged||e.propsChanged||e.extensionsChanged);e.propsOrDataChanged=n,e.somethingChanged=n||e.viewportChanged||e.stateChanged}_clearChangeFlags(){this.internalState.changeFlags={dataChanged:!1,propsChanged:!1,updateTriggersChanged:!1,viewportChanged:!1,stateChanged:!1,extensionsChanged:!1,propsOrDataChanged:!1,somethingChanged:!1}}_diffProps(t,e){const n=vM(t,e);if(n.updateTriggersChanged)for(const i in n.updateTriggersChanged)n.updateTriggersChanged[i]&&this.invalidateAttribute(i);if(n.transitionsChanged)for(const i in n.transitionsChanged){var r;this.internalState.uniformTransitions.add(i,e[i],t[i],null===(r=t.transitions)||void 0===r?void 0:r[i])}return this.setChangeFlags(n)}validateProps(){!function(t){const e=t[sg];for(const n in e){const r=e[n],{validate:i}=r;if(i&&!i(t[n],r))throw new Error("Invalid prop ".concat(n,": ").concat(t[n]))}}(this.props)}updateAutoHighlight(t){this.props.autoHighlight&&!Number.isInteger(this.props.highlightedObjectIndex)&&this._updateAutoHighlight(t)}_updateAutoHighlight(t){const e={pickingSelectedColor:t.picked?t.color:null},{highlightColor:n}=this.props;t.picked&&"function"===typeof n&&(e.pickingHighlightColor=n(t)),this.setModuleParameters(e),this.setNeedsRedraw()}_getAttributeManager(){const t=this.context;return new dM(t.gl,{id:this.props.id,stats:t.stats,timeline:t.timeline})}_postUpdate(t,e){const{props:n,oldProps:r}=t;this.setNeedsRedraw(),this._updateAttributes();const{model:i}=this.state;null===i||void 0===i||i.setInstanceCount(this.getNumInstances());const{autoHighlight:o,highlightedObjectIndex:s,highlightColor:a}=n;if(e||r.autoHighlight!==o||r.highlightedObjectIndex!==s||r.highlightColor!==a){const t={};o||(t.pickingSelectedColor=null),Array.isArray(a)&&(t.pickingHighlightColor=a),(e||s!==r.highlightedObjectIndex)&&(t.pickingSelectedColor=Number.isFinite(s)&&s>=0?this.encodePickingColor(s):null),this.setModuleParameters(t)}}_getUpdateParams(){return{props:this.props,oldProps:this.internalState.getOldProps(),context:this.context,changeFlags:this.internalState.changeFlags}}_getNeedsRedraw(t){if(!this.internalState)return!1;let e=!1;e=e||this.internalState.needsRedraw&&this.id;const n=this.getAttributeManager(),r=!!n&&n.getNeedsRedraw(t);if(e=e||r,e)for(const i of this.props.extensions)i.onNeedsRedraw.call(this,i);return this.internalState.needsRedraw=this.internalState.needsRedraw&&!t.clearRedrawFlags,e}_onAsyncPropUpdated(){this._diffProps(this.props,this.internalState.getOldProps()),this.setNeedsUpdate()}}ge(QM,"defaultProps",YM),ge(QM,"layerName","Layer");const ZM={position:"absolute",zIndex:-1};function $M(t,e){if("function"===typeof t)return t(e);if(Array.isArray(t))return t.map((t=>$M(t,e)));if(tT(t)){if(function(t){var e;return null===(e=t.props)||void 0===e?void 0:e.mapStyle}(t))return e.style=ZM,(0,h.cloneElement)(t,e);if(function(t){const e=t.type;return e&&e.deckGLViewProps}(t))return(0,h.cloneElement)(t,e)}return t}function tT(t){return t&&"object"===typeof t&&"type"in t||!1}function eT(t){if("function"===typeof t)return(0,h.createElement)(kS,{},t);if(Array.isArray(t))return t.map(eT);if(tT(t)){if(t.type===h.Fragment)return eT(t.props.children);if(aP(t.type,kS))return t}return t}const nT={mixBlendMode:null};function rT(t){t.redrawReason&&(t.deck._drawLayers(t.redrawReason),t.redrawReason=null)}const iT=(0,h.forwardRef)(((t,e)=>{const[n,r]=(0,h.useState)(0),i=(0,h.useRef)({control:null,version:n,forceUpdate:()=>r((t=>t+1))}),o=i.current,s=(0,h.useRef)(null),a=(0,h.useRef)(null),l=(0,h.useMemo)((()=>function(t){let{children:e,layers:n=[],views:r=null}=t;const i=[],o=[],s={};return h.Children.forEach(eT(e),(t=>{if(tT(t)){const e=t.type;if(aP(e,QM)){const n=function(t,e){const n={},r=t.defaultProps||{};for(const i in e)r[i]!==e[i]&&(n[i]=e[i]);return new t(n)}(e,t.props);o.push(n)}else i.push(t);if(aP(e,kS)&&e!==kS&&t.props.id){const n=new e(t.props);s[n.id]=n}}else t&&i.push(t)})),Object.keys(s).length>0&&(Array.isArray(r)?r.forEach((t=>{s[t.id]=t})):r&&(s[r.id]=r),r=Object.values(s)),n=o.length>0?[...o,...n]:n,{layers:n,children:i,views:r}}(t)),[t.layers,t.views,t.children]);let c=!0;const u=e=>{var n;return c&&t.viewState?(o.viewStateUpdateRequested=e,null):(o.viewStateUpdateRequested=null,null===(n=t.onViewStateChange)||void 0===n?void 0:n.call(t,e))},d=e=>{var n;c?o.interactionStateUpdateRequested=e:(o.interactionStateUpdateRequested=null,null===(n=t.onInteractionStateChange)||void 0===n||n.call(t,e))},f=(0,h.useMemo)((()=>{const e={...t,style:null,width:"100%",height:"100%",parent:s.current,canvas:a.current,layers:l.layers,views:l.views,onViewStateChange:u,onInteractionStateChange:d};return delete e._customRender,o.deck&&o.deck.setProps(e),e}),[t]);(0,h.useEffect)((()=>{const e=t.Deck||oP;return o.deck=function(t,e,n){const r=new e({...n,_customRender:e=>{t.redrawReason=e;const n=r.getViewports();t.lastRenderedViewports!==n?t.forceUpdate():rT(t)}});return r}(o,e,{...f,parent:s.current,canvas:a.current}),()=>{var t;return null===(t=o.deck)||void 0===t?void 0:t.finalize()}}),[]),sP((()=>{rT(o);const{viewStateUpdateRequested:t,interactionStateUpdateRequested:e}=o;t&&u(t),e&&d(e)})),(0,h.useImperativeHandle)(e,(()=>function(t){return{get deck(){return t.deck},pickObject:e=>t.deck.pickObject(e),pickMultipleObjects:e=>t.deck.pickMultipleObjects(e),pickObjects:e=>t.deck.pickObjects(e)}}(o)),[]);const p=o.deck&&o.deck.isInitialized?o.deck.getViewports():void 0,{ContextProvider:g,width:m,height:v,id:b,style:y}=t,{containerStyle:x,canvasStyle:A}=(0,h.useMemo)((()=>function(t){let{width:e,height:n,style:r}=t;const i={position:"absolute",zIndex:0,left:0,top:0,width:e,height:n},o={left:0,top:0};if(r)for(const s in r)s in nT?o[s]=r[s]:i[s]=r[s];return{containerStyle:i,canvasStyle:o}}({width:m,height:v,style:y})),[m,v,y]);if(!o.viewStateUpdateRequested&&o.lastRenderedViewports===p||o.version!==n){o.lastRenderedViewports=p,o.version=n;const t=function(t){let{children:e,deck:n,ContextProvider:r}=t;const{viewManager:i}=n||{};if(!i||!i.views.length)return[];const o={},s=i.views[0].id;for(const a of e){let t=s,e=a;tT(a)&&aP(a.type,kS)&&(t=a.props.id||s,e=a.props.children);const n=i.getViewport(t),r=i.getViewState(t);if(n){r.padding=n.padding;const{x:i,y:s,width:a,height:l}=n;e=$M(e,{x:i,y:s,width:a,height:l,viewport:n,viewState:r}),o[t]||(o[t]={viewport:n,children:[]}),o[t].children.push(e)}}return Object.keys(o).map((t=>{const{viewport:e,children:i}=o[t],{x:s,y:a,width:l,height:c}=e,u={position:"absolute",left:s,top:a,width:l,height:c},d="view-".concat(t),f=(0,h.createElement)("div",{key:d,id:d,style:u},...i);if(r){const i={viewport:e,container:n.canvas.offsetParent,eventManager:n.eventManager,onViewStateChange:e=>{e.viewId=t,n._onViewStateChange(e)}};return(0,h.createElement)(r,{key:d,value:i},f)}return f}))}({children:l.children,deck:o.deck,ContextProvider:g}),e=(0,h.createElement)("canvas",{key:"canvas",id:b||"deckgl-overlay",ref:a,style:A});o.control=(0,h.createElement)("div",{id:"".concat(b||"deckgl","-wrapper"),ref:s,style:x},[e,t])}return c=!1,o.control}));iT.defaultProps=oP.defaultProps;const oT=iT,sT=h.createContext(null);function aT(t){return{longitude:t.center.lng,latitude:t.center.lat,zoom:t.zoom,pitch:t.pitch,bearing:t.bearing,padding:t.padding}}function lT(t,e){const n=e.viewState||e;let r=!1;if("longitude"in n&&"latitude"in n){const e=t.center;t.center=new e.constructor(n.longitude,n.latitude),r=r||e!==t.center}if("zoom"in n){const e=t.zoom;t.zoom=n.zoom,r=r||e!==t.zoom}if("bearing"in n){const e=t.bearing;t.bearing=n.bearing,r=r||e!==t.bearing}if("pitch"in n){const e=t.pitch;t.pitch=n.pitch,r=r||e!==t.pitch}return n.padding&&!t.isPaddingEqual(n.padding)&&(r=!0,t.padding=n.padding),r}const cT=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function uT(t){if(!t)return null;if("string"===typeof t)return t;if("toJS"in t&&(t=t.toJS()),!t.layers)return t;const e={};for(const r of t.layers)e[r.id]=r;const n=t.layers.map((t=>{const n=e[t.ref];let r=null;if("interactive"in t&&(r={...t},delete r.interactive),n){r=r||{...t},delete r.ref;for(const t of cT)t in n&&(r[t]=n[t])}return r||t}));return{...t,layers:n}}function dT(t,e){if(t===e)return!0;if(!t||!e)return!1;if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let n=0;n{const e=this.props[pT[t.type]];e&&e(t)},this._onPointerEvent=t=>{"mousemove"!==t.type&&"mouseout"!==t.type||this._updateHover(t);const e=this.props[hT[t.type]];if(e){if(this.props.interactiveLayerIds&&"mouseover"!==t.type&&"mouseout"!==t.type){const e=this._hoveredFeatures||this._map.queryRenderedFeatures(t.point,{layers:this.props.interactiveLayerIds});t.features=e}e(t),delete t.features}},this._onCameraEvent=t=>{if(!this._internalUpdate){const e=this.props[fT[t.type]];e&&e(t)}t.type in this._deferredEvents&&(this._deferredEvents[t.type]=!1)},this._MapClass=t,this.props=e,this._initialize(n)}get map(){return this._map}get transform(){return this._renderTransform}setProps(t){const e=this.props;this.props=t;const n=this._updateSettings(t,e);n&&this._createShadowTransform(this._map);const r=this._updateSize(t),i=this._updateViewState(t,!0);this._updateStyle(t,e),this._updateStyleComponents(t,e),this._updateHandlers(t,e),(n||r||i&&!this._map.isMoving())&&this.redraw()}static reuse(t,e){const n=vT.savedMaps.pop();if(!n)return null;const r=n.map,i=r.getContainer();for(e.className=i.className;i.childNodes.length>0;)e.appendChild(i.childNodes[0]);r._container=e,n.setProps({...t,styleDiffing:!1}),r.resize();const{initialViewState:o}=t;return o&&(o.bounds?r.fitBounds(o.bounds,{...o.fitBoundsOptions,duration:0}):n._updateViewState(o,!1)),r.isStyleLoaded()?r.fire("load"):r.once("styledata",(()=>r.fire("load"))),n}_initialize(t){const{props:e}=this,n={...e,...e.initialViewState,accessToken:e.mapboxAccessToken||bT()||null,container:t,style:uT(e.mapStyle)},r=n.initialViewState||n.viewState||n;if(Object.assign(n,{center:[r.longitude||0,r.latitude||0],zoom:r.zoom||0,pitch:r.pitch||0,bearing:r.bearing||0}),e.gl){const t=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=()=>(HTMLCanvasElement.prototype.getContext=t,e.gl)}const i=new this._MapClass(n);r.padding&&i.setPadding(r.padding),e.cursor&&(i.getCanvas().style.cursor=e.cursor),this._createShadowTransform(i);const o=i._render;i._render=t=>{this._inRender=!0,o.call(i,t),this._inRender=!1};const s=i._renderTaskQueue.run;i._renderTaskQueue.run=t=>{s.call(i._renderTaskQueue,t),this._onBeforeRepaint()},i.on("render",(()=>this._onAfterRepaint()));const a=i.fire;i.fire=this._fireEvent.bind(this,a),i.on("resize",(()=>{this._renderTransform.resize(i.transform.width,i.transform.height)})),i.on("styledata",(()=>this._updateStyleComponents(this.props,{}))),i.on("sourcedata",(()=>this._updateStyleComponents(this.props,{})));for(const l in hT)i.on(l,this._onPointerEvent);for(const l in fT)i.on(l,this._onCameraEvent);for(const l in pT)i.on(l,this._onEvent);this._map=i}recycle(){vT.savedMaps.push(this)}destroy(){this._map.remove()}redraw(){const t=this._map;!this._inRender&&t.style&&(t._frame&&(t._frame.cancel(),t._frame=null),t._render())}_createShadowTransform(t){const e=function(t){const e=t.clone();return e.pixelsToGLUnits=t.pixelsToGLUnits,e}(t.transform);t.painter.transform=e,this._renderTransform=e}_updateSize(t){const{viewState:e}=t;if(e){const t=this._map;if(e.width!==t.transform.width||e.height!==t.transform.height)return t.resize(),!0}return!1}_updateViewState(t,e){if(this._internalUpdate)return!1;const n=this._map,r=this._renderTransform,{zoom:i,pitch:o,bearing:s}=r,a=n.isMoving();a&&(r.cameraElevationReference="sea");const l=lT(r,{...aT(n.transform),...t});if(a&&(r.cameraElevationReference="ground"),l&&e){const t=this._deferredEvents;t.move=!0,t.zoom||(t.zoom=i!==r.zoom),t.rotate||(t.rotate=s!==r.bearing),t.pitch||(t.pitch=o!==r.pitch)}return a||lT(n.transform,t),l}_updateSettings(t,e){const n=this._map;let r=!1;for(const i of gT)i in t&&!dT(t[i],e[i])&&(r=!0,n["set".concat(i[0].toUpperCase()).concat(i.slice(1))](t[i]));return r}_updateStyle(t,e){if(t.cursor!==e.cursor&&(this._map.getCanvas().style.cursor=t.cursor),t.mapStyle!==e.mapStyle){const e={diff:t.styleDiffing};return"localIdeographFontFamily"in t&&(e.localIdeographFontFamily=t.localIdeographFontFamily),this._map.setStyle(uT(t.mapStyle),e),!0}return!1}_updateStyleComponents(t,e){const n=this._map;let r=!1;return n.style.loaded()&&("light"in t&&!dT(t.light,e.light)&&(r=!0,n.setLight(t.light)),"fog"in t&&!dT(t.fog,e.fog)&&(r=!0,n.setFog(t.fog)),"terrain"in t&&!dT(t.terrain,e.terrain)&&(t.terrain&&!n.getSource(t.terrain.source)||(r=!0,n.setTerrain(t.terrain)))),r}_updateHandlers(t,e){const n=this._map;let r=!1;for(const i of mT){const o=t[i];dT(o,e[i])||(r=!0,o?n[i].enable(o):n[i].disable())}return r}_updateHover(t){var e;const{props:n}=this;if(n.interactiveLayerIds&&(n.onMouseMove||n.onMouseEnter||n.onMouseLeave)){const i=t.type,o=(null===(e=this._hoveredFeatures)||void 0===e?void 0:e.length)>0;let s;if("mousemove"===i)try{s=this._map.queryRenderedFeatures(t.point,{layers:n.interactiveLayerIds})}catch(r){s=[]}else s=[];const a=s.length>0;!a&&o&&(t.type="mouseleave",this._onPointerEvent(t)),this._hoveredFeatures=s,a&&!o&&(t.type="mouseenter",this._onPointerEvent(t)),t.type=i}else this._hoveredFeatures=null}_fireEvent(t,e,n){const r=this._map,i=r.transform,o="string"===typeof e?e:e.type;return"move"===o&&this._updateViewState(this.props,!1),o in fT&&("object"===typeof e&&(e.viewState=aT(i)),this._map.isMoving())?(r.transform=this._renderTransform,t.call(r,e,n),r.transform=i,r):(t.call(r,e,n),r)}_onBeforeRepaint(){const t=this._map;this._internalUpdate=!0;for(const n in this._deferredEvents)this._deferredEvents[n]&&t.fire(n);this._internalUpdate=!1;const e=this._map.transform;this._map.transform=this._renderTransform,this._onAfterRepaint=()=>{this._map.transform=e}}}function bT(){let t=null;if("undefined"!==typeof location){const e=/access_token=([^&\/]*)/.exec(location.search);t=e&&e[1]}try{t=t||{NODE_ENV:"production",PUBLIC_URL:"https://cityscope.media.mit.edu/CS_cityscopeJS",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0,REACT_APP_MAPBOX_TOKEN:"pk.eyJ1IjoicmVsbm94IiwiYSI6ImNqd2VwOTNtYjExaHkzeXBzYm1xc3E3dzQifQ.X8r8nj4-baZXSsFgctQMsg"}.MapboxAccessToken}catch(e){}try{t=t||{NODE_ENV:"production",PUBLIC_URL:"https://cityscope.media.mit.edu/CS_cityscopeJS",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0,REACT_APP_MAPBOX_TOKEN:"pk.eyJ1IjoicmVsbm94IiwiYSI6ImNqd2VwOTNtYjExaHkzeXBzYm1xc3E3dzQifQ.X8r8nj4-baZXSsFgctQMsg"}.REACT_APP_MAPBOX_ACCESS_TOKEN}catch(n){}return t}vT.savedMaps=[];const yT=["setMaxBounds","setMinZoom","setMaxZoom","setMinPitch","setMaxPitch","setRenderWorldCopies","setProjection","setStyle","addSource","removeSource","addLayer","removeLayer","setLayerZoomRange","setFilter","setPaintProperty","setLayoutProperty","setLight","setTerrain","setFog","remove"];function xT(t,e){if(!t)return null;const n=t.map,r={getMap:()=>n,getCenter:()=>t.transform.center,getZoom:()=>t.transform.zoom,getBearing:()=>t.transform.bearing,getPitch:()=>t.transform.pitch,getPadding:()=>t.transform.padding,getBounds:()=>t.transform.getBounds(),project:n=>t.transform.locationPoint(e.LngLat.convert(n)),unproject:n=>t.transform.pointLocation(e.Point.convert(n)),queryTerrainElevation:(e,r)=>{const i=n.transform;n.transform=t.transform;const o=n.queryTerrainElevation(e,r);return n.transform=i,o}};for(const i of function(t){const e=new Set;let n=t;for(;n;){for(const r of Object.getOwnPropertyNames(n))"_"!==r[0]&&"function"===typeof t[r]&&"fire"!==r&&"setEventedParent"!==r&&e.add(r);n=Object.getPrototypeOf(n)}return Array.from(e)}(n))i in r||yT.includes(i)||(r[i]=n[i].bind(n));return r}const AT="undefined"!==typeof document?h.useLayoutEffect:h.useEffect,_T=["baseApiUrl","maxParallelImageRequests","workerClass","workerCount","workerUrl"];const wT=h.createContext(null),ST={minZoom:0,maxZoom:22,minPitch:0,maxPitch:60,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,mapStyle:{version:8,sources:{},layers:[]},styleDiffing:!0,projection:"mercator",renderWorldCopies:!0,onError:t=>console.error(t.error),RTLTextPlugin:"https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.js"},CT=(0,h.forwardRef)(((t,e)=>{const r=(0,h.useContext)(sT),[i,o]=(0,h.useState)(null),s=(0,h.useRef)(),{current:a}=(0,h.useRef)({mapLib:null,map:null});(0,h.useEffect)((()=>{const e=t.mapLib;let i,l=!0;return Promise.resolve(e||n.e(879).then(n.t.bind(n,879,23))).then((e=>{if(l){if(e.Map||(e=e.default),!e||!e.Map)throw new Error("Invalid mapLib");if(!e.supported(t))throw new Error("Map is not supported by this browser");!function(t,e){for(const n of _T)n in e&&(t[n]=e[n]);e.RTLTextPlugin&&t.getRTLTextPluginStatus&&"unavailable"===t.getRTLTextPluginStatus()&&t.setRTLTextPlugin(e.RTLTextPlugin,(t=>{t&&console.error(t)}),!1)}(e,t),t.reuseMaps&&(i=vT.reuse(t,s.current)),i||(i=new vT(e.Map,t,s.current)),a.map=xT(i,e),a.mapLib=e,o(i),null===r||void 0===r||r.onMapMount(a.map,t.id)}})).catch((e=>{t.onError({type:"error",target:null,originalEvent:null,error:e})})),()=>{l=!1,i&&(null===r||void 0===r||r.onMapUnmount(t.id),t.reuseMaps?i.recycle():i.destroy())}}),[]),AT((()=>{i&&i.setProps(t)})),(0,h.useImperativeHandle)(e,(()=>a.map),[i]);const l=(0,h.useMemo)((()=>({position:"relative",width:"100%",height:"100%",...t.style})),[t.style]);return h.createElement("div",{id:t.id,ref:s,style:l},i&&h.createElement(wT.Provider,{value:a},t.children))}));CT.displayName="Map",CT.defaultProps=ST;const ET=CT,PT=/box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;function MT(t,e){if(!t||!e)return;const n=t.style;for(const r in e){const t=e[r];Number.isFinite(t)&&!PT.test(r)?n[r]="".concat(t,"px"):n[r]=t}}function TT(t){const{map:e,mapLib:n}=(0,h.useContext)(wT),r=(0,h.useRef)({props:t});r.current.props=t;const i=(0,h.useMemo)((()=>{let e=!1;h.Children.forEach(t.children,(t=>{t&&(e=!0)}));const o={...t,element:e?document.createElement("div"):null},s=new n.Marker(o).setLngLat([t.longitude,t.latitude]);return s.getElement().addEventListener("click",(t=>{var e,n;null===(n=(e=r.current.props).onClick)||void 0===n||n.call(e,{type:"click",target:s,originalEvent:t})})),s.on("dragstart",(t=>{var e,n;const o=t;o.lngLat=i.getLngLat(),null===(n=(e=r.current.props).onDragStart)||void 0===n||n.call(e,o)})),s.on("drag",(t=>{var e,n;const o=t;o.lngLat=i.getLngLat(),null===(n=(e=r.current.props).onDrag)||void 0===n||n.call(e,o)})),s.on("dragend",(t=>{var e,n;const o=t;o.lngLat=i.getLngLat(),null===(n=(e=r.current.props).onDragEnd)||void 0===n||n.call(e,o)})),s}),[]);return(0,h.useEffect)((()=>(i.addTo(e.getMap()),()=>{i.remove()})),[]),(0,h.useEffect)((()=>{MT(i.getElement(),t.style)}),[t.style]),i.getLngLat().lng===t.longitude&&i.getLngLat().lat===t.latitude||i.setLngLat([t.longitude,t.latitude]),t.offset&&!function(t,e){const n=Array.isArray(t)?t[0]:t?t.x:0,r=Array.isArray(t)?t[1]:t?t.y:0,i=Array.isArray(e)?e[0]:e?e.x:0,o=Array.isArray(e)?e[1]:e?e.y:0;return n===i&&r===o}(i.getOffset(),t.offset)&&i.setOffset(t.offset),i.isDraggable()!==t.draggable&&i.setDraggable(t.draggable),i.getRotation()!==t.rotation&&i.setRotation(t.rotation),i.getRotationAlignment()!==t.rotationAlignment&&i.setRotationAlignment(t.rotationAlignment),i.getPitchAlignment()!==t.pitchAlignment&&i.setPitchAlignment(t.pitchAlignment),i.getPopup()!==t.popup&&i.setPopup(t.popup),(0,G.createPortal)(t.children,i.getElement())}TT.defaultProps={draggable:!1,popup:null,rotation:0,rotationAlignment:"auto",pitchAlignment:"auto"};h.memo(TT);function OT(t){return new Set(t?t.trim().split(/\s+/):[])}h.memo((function(t){const{map:e,mapLib:n}=(0,h.useContext)(wT),r=(0,h.useMemo)((()=>document.createElement("div")),[]),i=(0,h.useRef)({props:t});i.current.props=t;const o=(0,h.useMemo)((()=>{const e={...t},r=new n.Popup(e).setLngLat([t.longitude,t.latitude]);return r.once("open",(t=>{var e,n;null===(n=(e=i.current.props).onOpen)||void 0===n||n.call(e,t)})),r}),[]);if((0,h.useEffect)((()=>{const t=t=>{var e,n;null===(n=(e=i.current.props).onClose)||void 0===n||n.call(e,t)};return o.on("close",t),o.setDOMContent(r).addTo(e.getMap()),()=>{o.off("close",t),o.isOpen()&&o.remove()}}),[]),(0,h.useEffect)((()=>{MT(o.getElement(),t.style)}),[t.style]),o.isOpen()&&(o.getLngLat().lng===t.longitude&&o.getLngLat().lat===t.latitude||o.setLngLat([t.longitude,t.latitude]),t.offset&&!dT(o.options.offset,t.offset)&&o.setOffset(t.offset),o.options.anchor===t.anchor&&o.options.maxWidth===t.maxWidth||(o.options.anchor=t.anchor,o.setMaxWidth(t.maxWidth)),o.options.className!==t.className)){const e=OT(o.options.className),n=OT(t.className);for(const t of e)n.has(t)||o.removeClassName(t);for(const t of n)e.has(t)||o.addClassName(t);o.options.className=t.className}return(0,G.createPortal)(t.children,r)}));const kT=function(t,e,n,r){const i=(0,h.useContext)(wT),o=(0,h.useMemo)((()=>t(i)),[]);return(0,h.useEffect)((()=>{const t=r||n||e,s="function"===typeof e&&"function"===typeof n?e:null,a="function"===typeof n?n:"function"===typeof e?e:null,{map:l}=i;return l.hasControl(o)||(l.addControl(o,null===t||void 0===t?void 0:t.position),s&&s(i)),()=>{a&&a(i),l.hasControl(o)&&l.removeControl(o)}}),[]),o};h.memo((function(t){const e=kT((e=>{let{mapLib:n}=e;return new n.AttributionControl(t)}),{position:t.position});return(0,h.useEffect)((()=>{MT(e._container,t.style)}),[t.style]),null}));h.memo((function(t){const e=kT((e=>{let{mapLib:n}=e;return new n.FullscreenControl({container:t.containerId&&document.getElementById(t.containerId)})}),{position:t.position});return(0,h.useEffect)((()=>{MT(e._controlContainer,t.style)}),[t.style]),null}));const RT=(0,h.forwardRef)(((t,e)=>{const n=(0,h.useRef)({props:t}),r=kT((e=>{let{mapLib:r}=e;const i=new r.GeolocateControl(t),o=i._setupUI;return i._setupUI=t=>{i._container.hasChildNodes()||o(t)},i.on("geolocate",(t=>{var e,r;null===(r=(e=n.current.props).onGeolocate)||void 0===r||r.call(e,t)})),i.on("error",(t=>{var e,r;null===(r=(e=n.current.props).onError)||void 0===r||r.call(e,t)})),i.on("outofmaxbounds",(t=>{var e,r;null===(r=(e=n.current.props).onOutOfMaxBounds)||void 0===r||r.call(e,t)})),i.on("trackuserlocationstart",(t=>{var e,r;null===(r=(e=n.current.props).onTrackUserLocationStart)||void 0===r||r.call(e,t)})),i.on("trackuserlocationend",(t=>{var e,r;null===(r=(e=n.current.props).onTrackUserLocationEnd)||void 0===r||r.call(e,t)})),i}),{position:t.position});return n.current.props=t,(0,h.useImperativeHandle)(e,(()=>({trigger:()=>r.trigger()})),[]),(0,h.useEffect)((()=>{MT(r._container,t.style)}),[t.style]),null}));RT.displayName="GeolocateControl";h.memo(RT);h.memo((function(t){const e=kT((e=>{let{mapLib:n}=e;return new n.NavigationControl(t)}),{position:t.position});return(0,h.useEffect)((()=>{MT(e._container,t.style)}),[t.style]),null}));function IT(t){const e=kT((e=>{let{mapLib:n}=e;return new n.ScaleControl(t)}),{position:t.position});return e.options.unit===t.unit&&e.options.maxWidth===t.maxWidth||(e.options.maxWidth=t.maxWidth,e.setUnit(t.unit)),(0,h.useEffect)((()=>{MT(e._container,t.style)}),[t.style]),null}IT.defaultProps={unit:"metric",maxWidth:100};h.memo(IT);function BT(t){var e;let{layers:n,draggingWhileEditing:r,setDeckGLRef:i}=t;const o=et((t=>t.cityIOdataState.cityIOdata)),s=et((t=>t.menuState)),[a,l]=(0,h.useState)(),c=(0,h.useRef)(null);(0,h.useEffect)((()=>{c.current&&i(c)}),[c]);const u=null===s||void 0===s||null===(e=s.viewSettingsMenuState)||void 0===e?void 0:e.VIEW_CONTROL_BUTTONS,d=()=>{const t=o.GEOGRID.properties.header,e=Gp(o);return{...a,longitude:e[0],latitude:e[1],zoom:15,pitch:45,bearing:360-t.rotation,orthographic:!1}};(0,h.useEffect)((()=>{const t=o.GEOGRID.properties.header,e=Gp(o);switch(u){case"RESET_VIEW_BUTTON":l((t=>({...t,longitude:e[0],latitude:e[1],pitch:0,bearing:0,orthographic:!1})));break;case"NORTH_VIEW_BUTTON":l((e=>({...e,bearing:360-t.rotation})));break;case"ORTHO_VIEW_BUTTON":l((t=>({...t,orthographic:!t.orthographic||!t.orthographic})))}}),[u]),(0,h.useEffect)((()=>{document.addEventListener("contextmenu",(t=>t.preventDefault())),d()}),[]);return(0,v.jsx)(oT,{ref:c,viewState:a,initialViewState:d(),onViewStateChange:t=>{let{viewState:e}=t;e.orthographic="ORTHO_VIEW_BUTTON"===u,l(e)},layers:n,controller:{touchZoom:!0,touchRotate:!0,dragPan:!r,dragRotate:!r,keyboard:!1},children:(0,v.jsx)(ET,{mapStyle:"mapbox://styles/relnox/ck0h5xn701bpr1dqs3he2lecq?fresh=true",mapboxAccessToken:"pk.eyJ1IjoicmVsbm94IiwiYSI6ImNqd2VwOTNtYjExaHkzeXBzYm1xc3E3dzQifQ.X8r8nj4-baZXSsFgctQMsg"})})}const LT={name:"project32",dependencies:[xS],vs:"\nvec4 project_position_to_clipspace(\n vec3 position, vec3 position64Low, vec3 offset, out vec4 commonPosition\n) {\n vec3 projectedPosition = project_position(position, position64Low);\n mat3 rotation;\n if (project_needs_rotation(projectedPosition, rotation)) {\n // offset is specified as ENU\n // when in globe projection, rotate offset so that the ground alighs with the surface of the globe\n offset = rotation * offset;\n }\n commonPosition = vec4(projectedPosition + offset, 1.0);\n return project_common_position_to_clipspace(commonPosition);\n}\n\nvec4 project_position_to_clipspace(\n vec3 position, vec3 position64Low, vec3 offset\n) {\n vec4 commonPosition;\n return project_position_to_clipspace(position, position64Low, offset, commonPosition);\n}\n"},DT="#if (defined(SHADER_TYPE_FRAGMENT) && defined(LIGHTING_FRAGMENT)) || (defined(SHADER_TYPE_VERTEX) && defined(LIGHTING_VERTEX))\n\nstruct AmbientLight {\n vec3 color;\n};\n\nstruct PointLight {\n vec3 color;\n vec3 position;\n vec3 attenuation;\n};\n\nstruct DirectionalLight {\n vec3 color;\n vec3 direction;\n};\n\nuniform AmbientLight lighting_uAmbientLight;\nuniform PointLight lighting_uPointLight[MAX_LIGHTS];\nuniform DirectionalLight lighting_uDirectionalLight[MAX_LIGHTS];\nuniform int lighting_uPointLightCount;\nuniform int lighting_uDirectionalLightCount;\n\nuniform bool lighting_uEnabled;\n\nfloat getPointLightAttenuation(PointLight pointLight, float distance) {\n return pointLight.attenuation.x\n + pointLight.attenuation.y * distance\n + pointLight.attenuation.z * distance * distance;\n}\n\n#endif\n",FT={lightSources:{}};function NT(){let{color:t=[0,0,0],intensity:e=1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.map((t=>t*e/255))}const jT={name:"lights",vs:DT,fs:DT,getUniforms:function t(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:FT;if("lightSources"in e){const{ambientLight:t,pointLights:n,directionalLights:r}=e.lightSources||{};return t||n&&n.length>0||r&&r.length>0?Object.assign({},function(t){let{ambientLight:e,pointLights:n=[],directionalLights:r=[]}=t;const i={};return i["lighting_uAmbientLight.color"]=e?NT(e):[0,0,0],n.forEach(((t,e)=>{i["lighting_uPointLight[".concat(e,"].color")]=NT(t),i["lighting_uPointLight[".concat(e,"].position")]=t.position,i["lighting_uPointLight[".concat(e,"].attenuation")]=t.attenuation||[1,0,0]})),i.lighting_uPointLightCount=n.length,r.forEach(((t,e)=>{i["lighting_uDirectionalLight[".concat(e,"].color")]=NT(t),i["lighting_uDirectionalLight[".concat(e,"].direction")]=t.direction})),i.lighting_uDirectionalLightCount=r.length,i}({ambientLight:t,pointLights:n,directionalLights:r}),{lighting_uEnabled:!0}):{lighting_uEnabled:!1}}if("lights"in e){const n={pointLights:[],directionalLights:[]};for(const t of e.lights||[])switch(t.type){case"ambient":n.ambientLight=t;break;case"directional":n.directionalLights.push(t);break;case"point":n.pointLights.push(t)}return t({lightSources:n})}return{}},defines:{MAX_LIGHTS:3}},zT="\nuniform float lighting_uAmbient;\nuniform float lighting_uDiffuse;\nuniform float lighting_uShininess;\nuniform vec3 lighting_uSpecularColor;\n\nvec3 lighting_getLightColor(vec3 surfaceColor, vec3 light_direction, vec3 view_direction, vec3 normal_worldspace, vec3 color) {\n vec3 halfway_direction = normalize(light_direction + view_direction);\n float lambertian = dot(light_direction, normal_worldspace);\n float specular = 0.0;\n if (lambertian > 0.0) {\n float specular_angle = max(dot(normal_worldspace, halfway_direction), 0.0);\n specular = pow(specular_angle, lighting_uShininess);\n }\n lambertian = max(lambertian, 0.0);\n return (lambertian * lighting_uDiffuse * surfaceColor + specular * lighting_uSpecularColor) * color;\n}\n\nvec3 lighting_getLightColor(vec3 surfaceColor, vec3 cameraPosition, vec3 position_worldspace, vec3 normal_worldspace) {\n vec3 lightColor = surfaceColor;\n\n if (lighting_uEnabled) {\n vec3 view_direction = normalize(cameraPosition - position_worldspace);\n lightColor = lighting_uAmbient * surfaceColor * lighting_uAmbientLight.color;\n\n for (int i = 0; i < MAX_LIGHTS; i++) {\n if (i >= lighting_uPointLightCount) {\n break;\n }\n PointLight pointLight = lighting_uPointLight[i];\n vec3 light_position_worldspace = pointLight.position;\n vec3 light_direction = normalize(light_position_worldspace - position_worldspace);\n lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color);\n }\n\n for (int i = 0; i < MAX_LIGHTS; i++) {\n if (i >= lighting_uDirectionalLightCount) {\n break;\n }\n DirectionalLight directionalLight = lighting_uDirectionalLight[i];\n lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);\n }\n }\n return lightColor;\n}\n\nvec3 lighting_getSpecularLightColor(vec3 cameraPosition, vec3 position_worldspace, vec3 normal_worldspace) {\n vec3 lightColor = vec3(0, 0, 0);\n vec3 surfaceColor = vec3(0, 0, 0);\n\n if (lighting_uEnabled) {\n vec3 view_direction = normalize(cameraPosition - position_worldspace);\n\n for (int i = 0; i < MAX_LIGHTS; i++) {\n if (i >= lighting_uPointLightCount) {\n break;\n }\n PointLight pointLight = lighting_uPointLight[i];\n vec3 light_position_worldspace = pointLight.position;\n vec3 light_direction = normalize(light_position_worldspace - position_worldspace);\n lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color);\n }\n\n for (int i = 0; i < MAX_LIGHTS; i++) {\n if (i >= lighting_uDirectionalLightCount) {\n break;\n }\n DirectionalLight directionalLight = lighting_uDirectionalLight[i];\n lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);\n }\n }\n return lightColor;\n}\n",UT={};function VT(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:UT;if(!("material"in t))return{};const{material:e}=t;return e?function(t){const{ambient:e=.35,diffuse:n=.6,shininess:r=32,specularColor:i=[30,30,30]}=t;return{lighting_uAmbient:e,lighting_uDiffuse:n,lighting_uShininess:r,lighting_uSpecularColor:i.map((t=>t/255))}}(e):{lighting_uEnabled:!1}}const GT={name:"gouraud-lighting",dependencies:[jT],vs:zT,defines:{LIGHTING_VERTEX:1},getUniforms:VT},WT={name:"phong-lighting",dependencies:[jT],fs:zT,defines:{LIGHTING_FRAGMENT:1},getUniforms:VT},HT={pickingSelectedColor:null,pickingHighlightColor:new Uint8Array([0,255,255,255]),pickingActive:!1,pickingAttribute:!1};const JT={name:"picking",vs:"uniform bool picking_uActive;\nuniform bool picking_uAttribute;\nuniform vec3 picking_uSelectedColor;\nuniform bool picking_uSelectedColorValid;\n\nout vec4 picking_vRGBcolor_Avalid;\n\nconst float COLOR_SCALE = 1. / 255.;\n\nbool picking_isColorValid(vec3 color) {\n return dot(color, vec3(1.0)) > 0.001;\n}\n\nbool isVertexPicked(vec3 vertexColor) {\n return\n picking_uSelectedColorValid &&\n !picking_isColorValid(abs(vertexColor - picking_uSelectedColor));\n}\n\nvoid picking_setPickingColor(vec3 pickingColor) {\n if (picking_uActive) {\n picking_vRGBcolor_Avalid.a = float(picking_isColorValid(pickingColor));\n\n if (!picking_uAttribute) {\n picking_vRGBcolor_Avalid.rgb = pickingColor * COLOR_SCALE;\n }\n } else {\n picking_vRGBcolor_Avalid.a = float(isVertexPicked(pickingColor));\n }\n}\n\nvoid picking_setPickingAttribute(float value) {\n if (picking_uAttribute) {\n picking_vRGBcolor_Avalid.r = value;\n }\n}\nvoid picking_setPickingAttribute(vec2 value) {\n if (picking_uAttribute) {\n picking_vRGBcolor_Avalid.rg = value;\n }\n}\nvoid picking_setPickingAttribute(vec3 value) {\n if (picking_uAttribute) {\n picking_vRGBcolor_Avalid.rgb = value;\n }\n}\n",fs:"uniform bool picking_uActive;\nuniform vec3 picking_uSelectedColor;\nuniform vec4 picking_uHighlightColor;\n\nin vec4 picking_vRGBcolor_Avalid;\nvec4 picking_filterHighlightColor(vec4 color) {\n if (picking_uActive) {\n return color;\n }\n bool selected = bool(picking_vRGBcolor_Avalid.a);\n\n if (selected) {\n float highLightAlpha = picking_uHighlightColor.a;\n float blendedAlpha = highLightAlpha + color.a * (1.0 - highLightAlpha);\n float highLightRatio = highLightAlpha / blendedAlpha;\n\n vec3 blendedRGB = mix(color.rgb, picking_uHighlightColor.rgb, highLightRatio);\n return vec4(blendedRGB, blendedAlpha);\n } else {\n return color;\n }\n}\nvec4 picking_filterPickingColor(vec4 color) {\n if (picking_uActive) {\n if (picking_vRGBcolor_Avalid.a == 0.0) {\n discard;\n }\n return picking_vRGBcolor_Avalid;\n }\n return color;\n}\nvec4 picking_filterColor(vec4 color) {\n vec4 highightColor = picking_filterHighlightColor(color);\n return picking_filterPickingColor(highightColor);\n}\n\n",getUniforms:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:HT;const e={};if(void 0!==t.pickingSelectedColor)if(t.pickingSelectedColor){const n=t.pickingSelectedColor.slice(0,3);e.picking_uSelectedColorValid=1,e.picking_uSelectedColor=n}else e.picking_uSelectedColorValid=0;if(t.pickingHighlightColor){const n=Array.from(t.pickingHighlightColor,(t=>t/255));Number.isFinite(n[3])||(n[3]=1),e.picking_uHighlightColor=n}return void 0!==t.pickingActive&&(e.picking_uActive=Boolean(t.pickingActive),e.picking_uAttribute=Boolean(t.pickingAttribute)),e}},KT={inject:{"vs:DECKGL_FILTER_GL_POSITION":"\n // for picking depth values\n picking_setPickingAttribute(position.z / position.w);\n ","vs:DECKGL_FILTER_COLOR":"\n picking_setPickingColor(geometry.pickingColor);\n ","fs:#decl":"\nuniform bool picking_uAttribute;\n ","fs:DECKGL_FILTER_COLOR":{order:99,injection:"\n // use highlight color if this fragment belongs to the selected object.\n color = picking_filterHighlightColor(color);\n\n // use picking color if rendering to picking FBO.\n color = picking_filterPickingColor(color);\n "}},...JT},XT={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6};class qT{static get DRAW_MODE(){return XT}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{id:e=SA("geometry"),drawMode:n=XT.TRIANGLES,attributes:r={},indices:i=null,vertexCount:o=null}=t;this.id=e,this.drawMode=0|n,this.attributes={},this.userData={},this._setAttributes(r,i),this.vertexCount=o||this._calculateVertexCount(this.attributes,this.indices)}get mode(){return this.drawMode}getVertexCount(){return this.vertexCount}getAttributes(){return this.indices?{indices:this.indices,...this.attributes}:this.attributes}_print(t){return"Geometry ".concat(this.id," attribute ").concat(t)}_setAttributes(t,e){e&&(this.indices=ArrayBuffer.isView(e)?{value:e,size:1}:e);for(const n in t){let e=t[n];e=ArrayBuffer.isView(e)?{value:e}:e,xA(ArrayBuffer.isView(e.value),"".concat(this._print(n),": must be typed array or object with value as typed array")),"POSITION"!==n&&"positions"!==n||e.size||(e.size=3),"indices"===n?(xA(!this.indices),this.indices=e):this.attributes[n]=e}return this.indices&&void 0!==this.indices.isIndexed&&(this.indices=Object.assign({},this.indices),delete this.indices.isIndexed),this}_calculateVertexCount(t,e){if(e)return e.value.length;let n=1/0;for(const r in t){const e=t[r],{value:i,size:o,constant:s}=e;!s&&i&&o>=1&&(n=Math.min(n,i.length/o))}return xA(Number.isFinite(n)),n}}const YT=Math.PI/180,QT=new Float32Array(16),ZT=new Float32Array(12);function $T(t,e,n){const r=e[0]*YT,i=e[1]*YT,o=e[2]*YT,s=Math.sin(o),a=Math.sin(r),l=Math.sin(i),c=Math.cos(o),u=Math.cos(r),d=Math.cos(i),h=n[0],f=n[1],p=n[2];t[0]=h*d*u,t[1]=h*l*u,t[2]=h*-a,t[3]=f*(-l*c+d*a*s),t[4]=f*(d*c+l*a*s),t[5]=f*u*s,t[6]=p*(l*s+d*a*c),t[7]=p*(-d*s+l*a*c),t[8]=p*u*c}function tO(t){return t[0]=t[0],t[1]=t[1],t[2]=t[2],t[3]=t[4],t[4]=t[5],t[5]=t[6],t[6]=t[8],t[7]=t[9],t[8]=t[10],t[9]=t[12],t[10]=t[13],t[11]=t[14],t.subarray(0,12)}const eO={size:12,accessor:["getOrientation","getScale","getTranslation","getTransformMatrix"],shaderAttributes:{instanceModelMatrix__LOCATION_0:{size:3,elementOffset:0},instanceModelMatrix__LOCATION_1:{size:3,elementOffset:3},instanceModelMatrix__LOCATION_2:{size:3,elementOffset:6},instanceTranslation:{size:3,elementOffset:9}},update(t,e){let{startRow:n,endRow:r}=e;const{data:i,getOrientation:o,getScale:s,getTranslation:a,getTransformMatrix:l}=this.props,c=Array.isArray(l),u=c&&16===l.length,d=Array.isArray(s),h=Array.isArray(o),f=Array.isArray(a),p=u||!c&&Boolean(l(i[0]));t.constant=p?u:h&&d&&f;const g=t.value;if(t.constant){let e;if(p)QT.set(l),e=tO(QT);else{e=ZT;$T(e,o,s),e.set(a,9)}t.value=new Float32Array(e)}else{let e=n*t.size;const{iterable:c,objectInfo:m}=pP(i,n,r);for(const t of c){let n;if(m.index++,p)QT.set(u?l:l(t,m)),n=tO(QT);else{n=ZT;$T(n,h?o:o(t,m),d?s:s(t,m)),n.set(f?a:a(t,m),9)}g[e++]=n[0],g[e++]=n[1],g[e++]=n[2],g[e++]=n[3],g[e++]=n[4],g[e++]=n[5],g[e++]=n[6],g[e++]=n[7],g[e++]=n[8],g[e++]=n[9],g[e++]=n[10],g[e++]=n[11]}}}};function nO(t,e){return e===dy.CARTESIAN||e===dy.METER_OFFSETS||e===dy.DEFAULT&&!t.isGeospatial}function rO(t){let e=1/0,n=1/0,r=1/0,i=-1/0,o=-1/0,s=-1/0;const a=t.POSITION?t.POSITION.value:[],l=a&&a.length;for(let c=0;ci?t:i,o=l>o?l:o,s=u>s?u:s}return[[e,n,r],[i,o,s]]}function iO(t,e){(t.COLOR_0||t.colors)&&e||(t.colors={constant:!0,value:new Float32Array([1,1,1])}),Rg.assert(t.positions||t.POSITION,'no "postions" or "POSITION" attribute in mesh')}function oO(t,e){if(t.attributes)return iO(t.attributes,e),t instanceof qT?t:new qT(t);if(t.positions||t.POSITION)return iO(t,e),new qT({attributes:t});throw Error("Invalid mesh")}const sO={mesh:{type:"object",value:null,async:!0},texture:{type:"image",value:null,async:!0},sizeScale:{type:"number",value:1,min:0},_useMeshColors:{type:"boolean",value:!1},_instanced:!0,wireframe:!1,material:!0,getPosition:{type:"accessor",value:t=>t.position},getColor:{type:"accessor",value:[0,0,0,255]},getOrientation:{type:"accessor",value:[0,0,0]},getScale:{type:"accessor",value:[1,1,1]},getTranslation:{type:"accessor",value:[0,0,0]},getTransformMatrix:{type:"accessor",value:[]},textureParameters:{type:"object",ignore:!0}};class aO extends QM{constructor(){super(...arguments),ge(this,"state",void 0)}getShaders(){const t=!vx(this.context.gl),e={};return L_(this.context.gl,k_)&&(e.DERIVATIVES_AVAILABLE=1),super.getShaders({vs:"#version 300 es\n#define SHADER_NAME simple-mesh-layer-vs\nuniform float sizeScale;\nuniform bool composeModelMatrix;\nin vec3 positions;\nin vec3 normals;\nin vec3 colors;\nin vec2 texCoords;\nin vec3 instancePositions;\nin vec3 instancePositions64Low;\nin vec4 instanceColors;\nin vec3 instancePickingColors;\nin mat3 instanceModelMatrix;\nin vec3 instanceTranslation;\nout vec2 vTexCoord;\nout vec3 cameraPosition;\nout vec3 normals_commonspace;\nout vec4 position_commonspace;\nout vec4 vColor;\n\nvoid main(void) {\n geometry.worldPosition = instancePositions;\n geometry.uv = texCoords;\n geometry.pickingColor = instancePickingColors;\n\n vTexCoord = texCoords;\n cameraPosition = project_uCameraPosition;\n vColor = vec4(colors * instanceColors.rgb, instanceColors.a);\n\n vec3 pos = (instanceModelMatrix * positions) * sizeScale + instanceTranslation;\n\n if (composeModelMatrix) {\n DECKGL_FILTER_SIZE(pos, geometry);\n normals_commonspace = project_normal(instanceModelMatrix * normals);\n geometry.worldPosition += pos;\n gl_Position = project_position_to_clipspace(pos + instancePositions, instancePositions64Low, vec3(0.0), position_commonspace);\n geometry.position = position_commonspace;\n }\n else {\n pos = project_size(pos);\n DECKGL_FILTER_SIZE(pos, geometry);\n gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, pos, position_commonspace);\n geometry.position = position_commonspace;\n normals_commonspace = project_normal(instanceModelMatrix * normals);\n }\n\n geometry.normal = normals_commonspace;\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n\n DECKGL_FILTER_COLOR(vColor, geometry);\n}\n",fs:"#version 300 es\n#define SHADER_NAME simple-mesh-layer-fs\n\nprecision highp float;\n\nuniform bool hasTexture;\nuniform sampler2D sampler;\nuniform bool flatShading;\nuniform float opacity;\n\nin vec2 vTexCoord;\nin vec3 cameraPosition;\nin vec3 normals_commonspace;\nin vec4 position_commonspace;\nin vec4 vColor;\n\nout vec4 fragColor;\n\nvoid main(void) {\n geometry.uv = vTexCoord;\n\n vec3 normal;\n if (flatShading) {\n#ifdef DERIVATIVES_AVAILABLE\n normal = normalize(cross(dFdx(position_commonspace.xyz), dFdy(position_commonspace.xyz)));\n#else\n normal = vec3(0.0, 0.0, 1.0);\n#endif\n } else {\n normal = normals_commonspace;\n }\n\n vec4 color = hasTexture ? texture(sampler, vTexCoord) : vColor;\n DECKGL_FILTER_COLOR(color, geometry);\n\n vec3 lightColor = lighting_getLightColor(color.rgb, cameraPosition, position_commonspace.xyz, normal);\n fragColor = vec4(lightColor, color.a * opacity);\n}\n",modules:[LT,WT,KT],transpileToGLSL100:t,defines:e})}getBounds(){var t;if(this.props._instanced)return super.getBounds();let e=this.state.positionBounds;if(e)return e;const{mesh:n}=this.props;if(!n)return null;if(e=null===(t=n.header)||void 0===t?void 0:t.boundingBox,!e){const{attributes:t}=oO(n,this.props._useMeshColors);t.POSITION=t.POSITION||t.positions,e=rO(t)}return this.state.positionBounds=e,e}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{transition:!0,type:5130,fp64:this.use64bitPositions(),size:3,accessor:"getPosition"},instanceColors:{type:5121,transition:!0,size:this.props.colorFormat.length,normalized:!0,accessor:"getColor",defaultValue:[0,0,0,255]},instanceModelMatrix:eO}),this.setState({emptyTexture:new qA(this.context.gl,{data:new Uint8Array(4),width:1,height:1})})}updateState(t){super.updateState(t);const{props:e,oldProps:n,changeFlags:r}=t;if(e.mesh!==n.mesh||r.extensionsChanged){var i;if(this.state.positionBounds=null,null===(i=this.state.model)||void 0===i||i.delete(),e.mesh){this.state.model=this.getModel(e.mesh);const t=e.mesh.attributes||e.mesh;this.setState({hasNormals:Boolean(t.NORMAL||t.normals)})}this.getAttributeManager().invalidateAll()}e.texture!==n.texture&&this.setTexture(e.texture),this.state.model&&this.state.model.setDrawMode(this.props.wireframe?3:4)}finalizeState(t){super.finalizeState(t),this.state.emptyTexture.delete()}draw(t){let{uniforms:e}=t;if(!this.state.model)return;const{viewport:n}=this.context,{sizeScale:r,coordinateSystem:i,_instanced:o}=this.props;this.state.model.setUniforms(e).setUniforms({sizeScale:r,composeModelMatrix:!o||nO(n,i),flatShading:!this.state.hasNormals}).draw()}get isLoaded(){var t;return(null===(t=this.state)||void 0===t?void 0:t.model)&&super.isLoaded}getModel(t){const e=new oM(this.context.gl,{...this.getShaders(),id:this.props.id,geometry:oO(t,this.props._useMeshColors),isInstanced:!0}),{texture:n}=this.props,{emptyTexture:r}=this.state;return e.setUniforms({sampler:n||r,hasTexture:Boolean(n)}),e}setTexture(t){const{emptyTexture:e,model:n}=this.state;n&&n.setUniforms({sampler:t||e,hasTexture:Boolean(t)})}}ge(aO,"defaultProps",sO),ge(aO,"layerName","SimpleMeshLayer");const lO=new Uint16Array([0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23]),cO=new Float32Array([-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,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,-1,1,-1,1,1,-1,1,-1]),uO=new Float32Array([0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0]),dO=new Float32Array([0,0,1,0,1,1,0,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,1,1,1,0,1,0,0,1,0,1,0,1,1,0,1,0,0,0,0,1,0,1,1,0,1]),hO={POSITION:{size:3,value:new Float32Array(cO)},NORMAL:{size:3,value:new Float32Array(uO)},TEXCOORD_0:{size:2,value:new Float32Array(dO)}};class fO extends qT{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{id:e=SA("cube-geometry")}=t;super({...t,id:e,indices:{size:1,value:new Uint16Array(lO)},attributes:{...hO,...t.attributes}})}}const pO=/^[og]\s*(.+)?/,gO=/^mtllib /,mO=/^usemtl /;class vO{constructor(t){let{index:e,name:n="",mtllib:r,smooth:i,groupStart:o}=t;this.index=e,this.name=n,this.mtllib=r,this.smooth=i,this.groupStart=o,this.groupEnd=-1,this.groupCount=-1,this.inherited=!1}clone(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.index;return new vO({index:t,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0})}}class bO{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this.name=t,this.geometry={vertices:[],normals:[],colors:[],uvs:[]},this.materials=[],this.smooth=!0,this.fromDeclaration=null}startMaterial(t,e){const n=this._finalize(!1);n&&(n.inherited||n.groupCount<=0)&&this.materials.splice(n.index,1);const r=new vO({index:this.materials.length,name:t,mtllib:Array.isArray(e)&&e.length>0?e[e.length-1]:"",smooth:void 0!==n?n.smooth:this.smooth,groupStart:void 0!==n?n.groupEnd:0});return this.materials.push(r),r}currentMaterial(){if(this.materials.length>0)return this.materials[this.materials.length-1]}_finalize(t){const e=this.currentMaterial();if(e&&-1===e.groupEnd&&(e.groupEnd=this.geometry.vertices.length/3,e.groupCount=e.groupEnd-e.groupStart,e.inherited=!1),t&&this.materials.length>1)for(let n=this.materials.length-1;n>=0;n--)this.materials[n].groupCount<=0&&this.materials.splice(n,1);return t&&0===this.materials.length&&this.materials.push({name:"",smooth:this.smooth}),e}}class yO{constructor(){this.objects=[],this.object=null,this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.materialLibraries=[],this.startObject("",!1)}startObject(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.object&&!this.object.fromDeclaration)return this.object.name=t,void(this.object.fromDeclaration=e);const n=this.object&&"function"===typeof this.object.currentMaterial?this.object.currentMaterial():void 0;if(this.object&&"function"===typeof this.object._finalize&&this.object._finalize(!0),this.object=new bO(t),this.object.fromDeclaration=e,n&&n.name&&"function"===typeof n.clone){const t=n.clone(0);t.inherited=!0,this.object.materials.push(t)}this.objects.push(this.object)}finalize(){this.object&&"function"===typeof this.object._finalize&&this.object._finalize(!0)}parseVertexIndex(t,e){const n=parseInt(t);return 3*(n>=0?n-1:n+e/3)}parseNormalIndex(t,e){const n=parseInt(t);return 3*(n>=0?n-1:n+e/3)}parseUVIndex(t,e){const n=parseInt(t);return 2*(n>=0?n-1:n+e/2)}addVertex(t,e,n){const r=this.vertices,i=this.object.geometry.vertices;i.push(r[t+0],r[t+1],r[t+2]),i.push(r[e+0],r[e+1],r[e+2]),i.push(r[n+0],r[n+1],r[n+2])}addVertexPoint(t){const e=this.vertices;this.object.geometry.vertices.push(e[t+0],e[t+1],e[t+2])}addVertexLine(t){const e=this.vertices;this.object.geometry.vertices.push(e[t+0],e[t+1],e[t+2])}addNormal(t,e,n){const r=this.normals,i=this.object.geometry.normals;i.push(r[t+0],r[t+1],r[t+2]),i.push(r[e+0],r[e+1],r[e+2]),i.push(r[n+0],r[n+1],r[n+2])}addColor(t,e,n){const r=this.colors,i=this.object.geometry.colors;i.push(r[t+0],r[t+1],r[t+2]),i.push(r[e+0],r[e+1],r[e+2]),i.push(r[n+0],r[n+1],r[n+2])}addUV(t,e,n){const r=this.uvs,i=this.object.geometry.uvs;i.push(r[t+0],r[t+1]),i.push(r[e+0],r[e+1]),i.push(r[n+0],r[n+1])}addUVLine(t){const e=this.uvs;this.object.geometry.uvs.push(e[t+0],e[t+1])}addFace(t,e,n,r,i,o,s,a,l){const c=this.vertices.length;let u=this.parseVertexIndex(t,c),d=this.parseVertexIndex(e,c),h=this.parseVertexIndex(n,c);if(this.addVertex(u,d,h),void 0!==r&&""!==r){const t=this.uvs.length;u=this.parseUVIndex(r,t),d=this.parseUVIndex(i,t),h=this.parseUVIndex(o,t),this.addUV(u,d,h)}if(void 0!==s&&""!==s){const t=this.normals.length;u=this.parseNormalIndex(s,t),d=s===a?u:this.parseNormalIndex(a,t),h=s===l?u:this.parseNormalIndex(l,t),this.addNormal(u,d,h)}this.colors.length>0&&this.addColor(u,d,h)}addPointGeometry(t){this.object.geometry.type="Points";const e=this.vertices.length;for(const n of t)this.addVertexPoint(this.parseVertexIndex(n,e))}addLineGeometry(t,e){this.object.geometry.type="Line";const n=this.vertices.length,r=this.uvs.length;for(const i of t)this.addVertexLine(this.parseVertexIndex(i,n));for(const i of e)this.addUVLine(this.parseUVIndex(i,r))}}class xO{constructor(t,e){ge(this,"fields",void 0),ge(this,"metadata",void 0),function(t,e){if(!t)throw new Error(e||"loader assertion failed.")}(Array.isArray(t)),function(t){const e={};for(const n of t)e[n.name]&&console.warn("Schema: duplicated field name",n.name,n),e[n.name]=!0}(t),this.fields=t,this.metadata=e||new Map}compareTo(t){if(this.metadata!==t.metadata)return!1;if(this.fields.length!==t.fields.length)return!1;for(let e=0;et[e.name]));return new xO(i,this.metadata)}selectAt(){for(var t=arguments.length,e=new Array(t),n=0;nthis.fields[t])).filter(Boolean);return new xO(r,this.metadata)}assign(t){let e,n=this.metadata;if(t instanceof xO){const r=t;e=r.fields,n=AO(AO(new Map,this.metadata),r.metadata)}else e=t;const r=Object.create(null);for(const o of this.fields)r[o.name]=o;for(const o of e)r[o.name]=o;const i=Object.values(r);return new xO(i,n)}}function AO(t,e){return new Map([...t||new Map,...e||new Map])}let _O,wO,SO,CO,EO,PO,MO,TO,OO=function(t){return t[t.NONE=0]="NONE",t[t.Null=1]="Null",t[t.Int=2]="Int",t[t.Float=3]="Float",t[t.Binary=4]="Binary",t[t.Utf8=5]="Utf8",t[t.Bool=6]="Bool",t[t.Decimal=7]="Decimal",t[t.Date=8]="Date",t[t.Time=9]="Time",t[t.Timestamp=10]="Timestamp",t[t.Interval=11]="Interval",t[t.List=12]="List",t[t.Struct=13]="Struct",t[t.Union=14]="Union",t[t.FixedSizeBinary=15]="FixedSizeBinary",t[t.FixedSizeList=16]="FixedSizeList",t[t.Map=17]="Map",t[t.Dictionary=-1]="Dictionary",t[t.Int8=-2]="Int8",t[t.Int16=-3]="Int16",t[t.Int32=-4]="Int32",t[t.Int64=-5]="Int64",t[t.Uint8=-6]="Uint8",t[t.Uint16=-7]="Uint16",t[t.Uint32=-8]="Uint32",t[t.Uint64=-9]="Uint64",t[t.Float16=-10]="Float16",t[t.Float32=-11]="Float32",t[t.Float64=-12]="Float64",t[t.DateDay=-13]="DateDay",t[t.DateMillisecond=-14]="DateMillisecond",t[t.TimestampSecond=-15]="TimestampSecond",t[t.TimestampMillisecond=-16]="TimestampMillisecond",t[t.TimestampMicrosecond=-17]="TimestampMicrosecond",t[t.TimestampNanosecond=-18]="TimestampNanosecond",t[t.TimeSecond=-19]="TimeSecond",t[t.TimeMillisecond=-20]="TimeMillisecond",t[t.TimeMicrosecond=-21]="TimeMicrosecond",t[t.TimeNanosecond=-22]="TimeNanosecond",t[t.DenseUnion=-23]="DenseUnion",t[t.SparseUnion=-24]="SparseUnion",t[t.IntervalDayTime=-25]="IntervalDayTime",t[t.IntervalYearMonth=-26]="IntervalYearMonth",t}({});class kO{static isNull(t){return t&&t.typeId===OO.Null}static isInt(t){return t&&t.typeId===OO.Int}static isFloat(t){return t&&t.typeId===OO.Float}static isBinary(t){return t&&t.typeId===OO.Binary}static isUtf8(t){return t&&t.typeId===OO.Utf8}static isBool(t){return t&&t.typeId===OO.Bool}static isDecimal(t){return t&&t.typeId===OO.Decimal}static isDate(t){return t&&t.typeId===OO.Date}static isTime(t){return t&&t.typeId===OO.Time}static isTimestamp(t){return t&&t.typeId===OO.Timestamp}static isInterval(t){return t&&t.typeId===OO.Interval}static isList(t){return t&&t.typeId===OO.List}static isStruct(t){return t&&t.typeId===OO.Struct}static isUnion(t){return t&&t.typeId===OO.Union}static isFixedSizeBinary(t){return t&&t.typeId===OO.FixedSizeBinary}static isFixedSizeList(t){return t&&t.typeId===OO.FixedSizeList}static isMap(t){return t&&t.typeId===OO.Map}static isDictionary(t){return t&&t.typeId===OO.Dictionary}get typeId(){return OO.NONE}compareTo(t){return this===t}}Symbol.toStringTag;Symbol.toStringTag;_O=Symbol.toStringTag;class RO extends kO{constructor(t,e){super(),ge(this,"isSigned",void 0),ge(this,"bitWidth",void 0),this.isSigned=t,this.bitWidth=e}get typeId(){return OO.Int}get[_O](){return"Int"}toString(){return"".concat(this.isSigned?"I":"Ui","nt").concat(this.bitWidth)}}class IO extends RO{constructor(){super(!0,8)}}class BO extends RO{constructor(){super(!0,16)}}class LO extends RO{constructor(){super(!0,32)}}class DO extends RO{constructor(){super(!1,8)}}class FO extends RO{constructor(){super(!1,16)}}class NO extends RO{constructor(){super(!1,32)}}const jO=32,zO=64;wO=Symbol.toStringTag;class UO extends kO{constructor(t){super(),ge(this,"precision",void 0),this.precision=t}get typeId(){return OO.Float}get[wO](){return"Float"}toString(){return"Float".concat(this.precision)}}class VO extends UO{constructor(){super(jO)}}class GO extends UO{constructor(){super(zO)}}Symbol.toStringTag;Symbol.toStringTag;SO=Symbol.toStringTag;CO=Symbol.toStringTag;EO=Symbol.toStringTag;PO=Symbol.toStringTag;MO=Symbol.toStringTag;class WO extends kO{constructor(t,e){super(),ge(this,"listSize",void 0),ge(this,"children",void 0),this.listSize=t,this.children=[e]}get typeId(){return OO.FixedSizeList}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get[MO](){return"FixedSizeList"}toString(){return"FixedSizeList[".concat(this.listSize,"]<").concat(this.valueType,">")}}TO=Symbol.toStringTag;function HO(t){switch(t.constructor){case Int8Array:return new IO;case Uint8Array:return new DO;case Int16Array:return new BO;case Uint16Array:return new FO;case Int32Array:return new LO;case Uint32Array:return new NO;case Float32Array:return new VO;case Float64Array:return new GO;default:throw new Error("array type not supported")}}class JO{constructor(t,e){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new Map;ge(this,"name",void 0),ge(this,"type",void 0),ge(this,"nullable",void 0),ge(this,"metadata",void 0),this.name=t,this.type=e,this.nullable=n,this.metadata=r}get typeId(){return this.type&&this.type.typeId}clone(){return new JO(this.name,this.type,this.nullable,this.metadata)}compareTo(t){return this.name===t.name&&this.type===t.type&&this.nullable===t.nullable&&this.metadata===t.metadata}toString(){return"".concat(this.type).concat(this.nullable?", nullable":"").concat(this.metadata?", metadata: ".concat(this.metadata):"")}}function KO(t,e){const n=new Map;for(const o in e)"value"!==o&&n.set(o,JSON.stringify(e[o]));const r=HO(e.value),i=!("size"in e)||1===e.size;return new JO(t,i?r:new WO(e.size,new JO("value",r)),!1,n)}function XO(t,e){const{meshes:n}=function(t){const e=new yO;-1!==t.indexOf("\r\n")&&(t=t.replace(/\r\n/g,"\n")),-1!==t.indexOf("\\\n")&&(t=t.replace(/\\\n/g,""));const n=t.split("\n");let r="",i="",o=0,s=[];const a="function"===typeof"".trimLeft;for(let u=0,d=n.length;u=7&&e.colors.push(parseFloat(t[4]),parseFloat(t[5]),parseFloat(t[6]));break;case"vn":e.normals.push(parseFloat(t[1]),parseFloat(t[2]),parseFloat(t[3]));break;case"vt":e.uvs.push(parseFloat(t[1]),parseFloat(t[2]))}}else if("f"===i){const t=r.substr(1).trim().split(/\s+/),n=[];for(let e=0,r=t.length;e0){const t=r.split("/");n.push(t)}}const i=n[0];for(let r=1,o=n.length-1;r1){const t=s[1].trim().toLowerCase();e.object.smooth="0"!==t&&"off"!==t}else e.object.smooth=!0;const t=e.object.currentMaterial();t&&(t.smooth=e.object.smooth)}}e.finalize();const l=[],c=[];for(const u of e.objects){const{geometry:t}=u;if(0===t.vertices.length)continue;const e={header:{vertexCount:t.vertices.length/3},attributes:{}};switch(t.type){case"Points":e.mode=0;break;case"Line":e.mode=1;break;default:e.mode=4}e.attributes.POSITION={value:new Float32Array(t.vertices),size:3},t.normals.length>0&&(e.attributes.NORMAL={value:new Float32Array(t.normals),size:3}),t.colors.length>0&&(e.attributes.COLOR_0={value:new Float32Array(t.colors),size:3}),t.uvs.length>0&&(e.attributes.TEXCOORD_0={value:new Float32Array(t.uvs),size:2}),e.materials=[];for(const n of u.materials){const t={name:n.name,flatShading:!n.smooth};e.materials.push(t),c.push(t)}e.name=u.name,l.push(e)}return{meshes:l,materials:c}}(t),r=n.reduce(((t,e)=>t+e.header.vertexCount),0),i=function(t,e){const n=new Float32Array(3*e);let r,i,o,s=0;for(const l of t){const{POSITION:t,NORMAL:a,COLOR_0:c,TEXCOORD_0:u}=l.attributes;n.set(t.value,3*s),a&&(r=r||new Float32Array(3*e),r.set(a.value,3*s)),c&&(i=i||new Float32Array(3*e),i.set(c.value,3*s)),u&&(o=o||new Float32Array(2*e),o.set(u.value,2*s)),s+=t.value.length/3}const a={};a.POSITION={value:n,size:3},r&&(a.NORMAL={value:r,size:3});i&&(a.COLOR_0={value:i,size:3});o&&(a.TEXCOORD_0={value:o,size:2});return a}(n,r),o={vertexCount:r,boundingBox:rO(i)},s=function(t){let e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};for(const i in n)e=e||new Map,"value"!==i&&e.set(i,JSON.stringify(n[i]));const r=[];for(const i in t){const e=KO(i,t[i]);r.push(e)}return new xO(r,e)}(i,{mode:4,boundingBox:o.boundingBox});return{loaderData:{header:{}},schema:s,header:o,mode:4,attributes:i}}const qO=/\s+/;function YO(t,e){const n=[];let r={name:"placeholder"};const i=t.split("\n");for(let o of i){if(o.trim(),0===o.length||"#"===o.charAt(0))continue;const t=o.indexOf(" ");let e=t>=0?o.substring(0,t):o;e.toLowerCase();let i=t>=0?o.substring(t+1):"";switch(i.trim(),e){case"newmtl":({name:i}),n.push(r);break;case"ka":r.ambientColor=QO(i);break;case"kd":r.diffuseColor=QO(i);break;case"map_kd":r.diffuseTextureUrl=i;break;case"ks":r.specularColor=QO(i);break;case"map_ks":r.specularTextureUrl=i;break;case"ke":r.emissiveColor=QO(i);break;case"map_ke":r.emissiveTextureUrl=i;break;case"ns":r.shininess=parseFloat(i);break;case"map_ns":default:break;case"ni":r.refraction=parseFloat(i);break;case"illum":r.illumination=parseFloat(i)}}return n}function QO(t,e){const n=t.split(qO,3);return[parseFloat(n[0]),parseFloat(n[1]),parseFloat(n[2])]}const ZO={name:"OBJ",id:"obj",module:"obj",version:"3.4.15",worker:!0,extensions:["obj"],mimeTypes:["text/plain"],testText:function(t){return"v"===t[0]},options:{obj:{}}};const $O={name:"MTL",id:"mtl",module:"mtl",version:"3.4.15",worker:!0,extensions:["mtl"],mimeTypes:["text/plain"],testText:t=>t.includes("newmtl"),options:{mtl:{}}},tk={...ZO,parse:async(t,e)=>XO((new TextDecoder).decode(t)),parseTextSync:(t,e)=>XO(t)};function ek(t){let{data:e,intensity:n,selected:r,setLayerHoveredData:i}=t;const o=e.access&&e.access.features,s=new fO({type:"x,z",xlen:0,ylen:0,zlen:0}),a=e.GEOGRID.properties.header;return new aO({onHover:t=>{t.object&&i("".concat(e.access.properties[r],": ").concat(Math.floor(100*t.object.properties[r]),"%"))},pickable:!0,id:"ACCESS",opacity:.1+n/100,data:o&&o,loaders:[tk],mesh:s,getPosition:t=>[t.geometry.coordinates[0],t.geometry.coordinates[1],1],getColor:t=>{if(void 0===t.properties[r]||null===t.properties[r])return[0,0,0,0];{const e=Wp((t=>t>0&&t<1?t:t>=1?1:0)(t.properties[r]),0,1);return[e[0],e[1],e[2],200]}},getOrientation:t=>[-180,a.rotation,-90],getScale:t=>[e.GEOGRID.properties.header.cellSize/(2+n/100),1+t.properties[r]*n,e.GEOGRID.properties.header.cellSize/(2+n/100)],updateTriggers:{getScale:r},transitions:{getColor:500,getScale:500}})}const nk=[0,0,0,255],rk={getSourcePosition:{type:"accessor",value:t=>t.sourcePosition},getTargetPosition:{type:"accessor",value:t=>t.targetPosition},getSourceColor:{type:"accessor",value:nk},getTargetColor:{type:"accessor",value:nk},getWidth:{type:"accessor",value:1},getHeight:{type:"accessor",value:1},getTilt:{type:"accessor",value:0},greatCircle:!1,numSegments:{type:"number",value:50,min:1},widthUnits:"pixels",widthScale:{type:"number",value:1,min:0},widthMinPixels:{type:"number",value:0,min:0},widthMaxPixels:{type:"number",value:Number.MAX_SAFE_INTEGER,min:0}};class ik extends QM{constructor(){super(...arguments),ge(this,"state",void 0)}getBounds(){var t;return null===(t=this.getAttributeManager())||void 0===t?void 0:t.getBounds(["instanceSourcePositions","instanceTargetPositions"])}getShaders(){return super.getShaders({vs:"#define SHADER_NAME arc-layer-vertex-shader\n\nattribute vec3 positions;\nattribute vec4 instanceSourceColors;\nattribute vec4 instanceTargetColors;\nattribute vec3 instanceSourcePositions;\nattribute vec3 instanceSourcePositions64Low;\nattribute vec3 instanceTargetPositions;\nattribute vec3 instanceTargetPositions64Low;\nattribute vec3 instancePickingColors;\nattribute float instanceWidths;\nattribute float instanceHeights;\nattribute float instanceTilts;\n\nuniform bool greatCircle;\nuniform bool useShortestPath;\nuniform float numSegments;\nuniform float opacity;\nuniform float widthScale;\nuniform float widthMinPixels;\nuniform float widthMaxPixels;\nuniform int widthUnits;\n\nvarying vec4 vColor;\nvarying vec2 uv;\nvarying float isValid;\n\nfloat paraboloid(float distance, float sourceZ, float targetZ, float ratio) {\n\n float deltaZ = targetZ - sourceZ;\n float dh = distance * instanceHeights;\n if (dh == 0.0) {\n return sourceZ + deltaZ * ratio;\n }\n float unitZ = deltaZ / dh;\n float p2 = unitZ * unitZ + 1.0;\n float dir = step(deltaZ, 0.0);\n float z0 = mix(sourceZ, targetZ, dir);\n float r = mix(ratio, 1.0 - ratio, dir);\n return sqrt(r * (p2 - r)) * dh + z0;\n}\nvec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction, float width) {\n vec2 dir_screenspace = normalize(line_clipspace * project_uViewportSize);\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n\n return dir_screenspace * offset_direction * width / 2.0;\n}\n\nfloat getSegmentRatio(float index) {\n return smoothstep(0.0, 1.0, index / (numSegments - 1.0));\n}\n\nvec3 interpolateFlat(vec3 source, vec3 target, float segmentRatio) {\n float distance = length(source.xy - target.xy);\n float z = paraboloid(distance, source.z, target.z, segmentRatio);\n\n float tiltAngle = radians(instanceTilts);\n vec2 tiltDirection = normalize(target.xy - source.xy);\n vec2 tilt = vec2(-tiltDirection.y, tiltDirection.x) * z * sin(tiltAngle);\n\n return vec3(\n mix(source.xy, target.xy, segmentRatio) + tilt,\n z * cos(tiltAngle)\n );\n}\nfloat getAngularDist (vec2 source, vec2 target) {\n vec2 sourceRadians = radians(source);\n vec2 targetRadians = radians(target);\n vec2 sin_half_delta = sin((sourceRadians - targetRadians) / 2.0);\n vec2 shd_sq = sin_half_delta * sin_half_delta;\n\n float a = shd_sq.y + cos(sourceRadians.y) * cos(targetRadians.y) * shd_sq.x;\n return 2.0 * asin(sqrt(a));\n}\n\nvec3 interpolateGreatCircle(vec3 source, vec3 target, vec3 source3D, vec3 target3D, float angularDist, float t) {\n vec2 lngLat;\n if(abs(angularDist - PI) < 0.001) {\n lngLat = (1.0 - t) * source.xy + t * target.xy;\n } else {\n float a = sin((1.0 - t) * angularDist);\n float b = sin(t * angularDist);\n vec3 p = source3D.yxz * a + target3D.yxz * b;\n lngLat = degrees(vec2(atan(p.y, -p.x), atan(p.z, length(p.xy))));\n }\n\n float z = paraboloid(angularDist * EARTH_RADIUS, source.z, target.z, t);\n\n return vec3(lngLat, z);\n}\n\nvoid main(void) {\n geometry.worldPosition = instanceSourcePositions;\n geometry.worldPositionAlt = instanceTargetPositions;\n\n float segmentIndex = positions.x;\n float segmentRatio = getSegmentRatio(segmentIndex);\n float prevSegmentRatio = getSegmentRatio(max(0.0, segmentIndex - 1.0));\n float nextSegmentRatio = getSegmentRatio(min(numSegments - 1.0, segmentIndex + 1.0));\n float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));\n isValid = 1.0;\n\n uv = vec2(segmentRatio, positions.y);\n geometry.uv = uv;\n geometry.pickingColor = instancePickingColors;\n\n vec4 curr;\n vec4 next;\n vec3 source;\n vec3 target;\n\n if ((greatCircle || project_uProjectionMode == PROJECTION_MODE_GLOBE) && project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT) {\n source = project_globe_(vec3(instanceSourcePositions.xy, 0.0));\n target = project_globe_(vec3(instanceTargetPositions.xy, 0.0));\n float angularDist = getAngularDist(instanceSourcePositions.xy, instanceTargetPositions.xy);\n\n vec3 prevPos = interpolateGreatCircle(instanceSourcePositions, instanceTargetPositions, source, target, angularDist, prevSegmentRatio);\n vec3 currPos = interpolateGreatCircle(instanceSourcePositions, instanceTargetPositions, source, target, angularDist, segmentRatio);\n vec3 nextPos = interpolateGreatCircle(instanceSourcePositions, instanceTargetPositions, source, target, angularDist, nextSegmentRatio);\n\n if (abs(currPos.x - prevPos.x) > 180.0) {\n indexDir = -1.0;\n isValid = 0.0;\n } else if (abs(currPos.x - nextPos.x) > 180.0) {\n indexDir = 1.0;\n isValid = 0.0;\n }\n nextPos = indexDir < 0.0 ? prevPos : nextPos;\n nextSegmentRatio = indexDir < 0.0 ? prevSegmentRatio : nextSegmentRatio;\n\n if (isValid == 0.0) {\n nextPos.x += nextPos.x > 0.0 ? -360.0 : 360.0;\n float t = ((currPos.x > 0.0 ? 180.0 : -180.0) - currPos.x) / (nextPos.x - currPos.x);\n currPos = mix(currPos, nextPos, t);\n segmentRatio = mix(segmentRatio, nextSegmentRatio, t);\n }\n\n vec3 currPos64Low = mix(instanceSourcePositions64Low, instanceTargetPositions64Low, segmentRatio);\n vec3 nextPos64Low = mix(instanceSourcePositions64Low, instanceTargetPositions64Low, nextSegmentRatio);\n \n curr = project_position_to_clipspace(currPos, currPos64Low, vec3(0.0), geometry.position);\n next = project_position_to_clipspace(nextPos, nextPos64Low, vec3(0.0));\n \n } else {\n vec3 source_world = instanceSourcePositions;\n vec3 target_world = instanceTargetPositions;\n if (useShortestPath) {\n source_world.x = mod(source_world.x + 180., 360.0) - 180.;\n target_world.x = mod(target_world.x + 180., 360.0) - 180.;\n\n float deltaLng = target_world.x - source_world.x;\n if (deltaLng > 180.) target_world.x -= 360.;\n if (deltaLng < -180.) source_world.x -= 360.;\n }\n source = project_position(source_world, instanceSourcePositions64Low);\n target = project_position(target_world, instanceTargetPositions64Low);\n float antiMeridianX = 0.0;\n\n if (useShortestPath) {\n if (project_uProjectionMode == PROJECTION_MODE_WEB_MERCATOR_AUTO_OFFSET) {\n antiMeridianX = -(project_uCoordinateOrigin.x + 180.) / 360. * TILE_SIZE;\n }\n float thresholdRatio = (antiMeridianX - source.x) / (target.x - source.x);\n\n if (prevSegmentRatio <= thresholdRatio && nextSegmentRatio > thresholdRatio) {\n isValid = 0.0;\n indexDir = sign(segmentRatio - thresholdRatio);\n segmentRatio = thresholdRatio;\n }\n }\n\n nextSegmentRatio = indexDir < 0.0 ? prevSegmentRatio : nextSegmentRatio;\n vec3 currPos = interpolateFlat(source, target, segmentRatio);\n vec3 nextPos = interpolateFlat(source, target, nextSegmentRatio);\n\n if (useShortestPath) {\n if (nextPos.x < antiMeridianX) {\n currPos.x += TILE_SIZE;\n nextPos.x += TILE_SIZE;\n }\n }\n\n curr = project_common_position_to_clipspace(vec4(currPos, 1.0));\n next = project_common_position_to_clipspace(vec4(nextPos, 1.0));\n geometry.position = vec4(currPos, 1.0);\n }\n float widthPixels = clamp(\n project_size_to_pixel(instanceWidths * widthScale, widthUnits),\n widthMinPixels, widthMaxPixels\n );\n vec3 offset = vec3(\n getExtrusionOffset((next.xy - curr.xy) * indexDir, positions.y, widthPixels),\n 0.0);\n DECKGL_FILTER_SIZE(offset, geometry);\n DECKGL_FILTER_GL_POSITION(curr, geometry);\n gl_Position = curr + vec4(project_pixel_size_to_clipspace(offset.xy), 0.0, 0.0);\n\n vec4 color = mix(instanceSourceColors, instanceTargetColors, segmentRatio);\n vColor = vec4(color.rgb, color.a * opacity);\n DECKGL_FILTER_COLOR(vColor, geometry);\n}\n",fs:"#define SHADER_NAME arc-layer-fragment-shader\n\nprecision highp float;\n\nvarying vec4 vColor;\nvarying vec2 uv;\nvarying float isValid;\n\nvoid main(void) {\n if (isValid == 0.0) {\n discard;\n }\n\n gl_FragColor = vColor;\n geometry.uv = uv;\n\n DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n}\n",modules:[LT,KT]})}get wrapLongitude(){return!1}initializeState(){this.getAttributeManager().addInstanced({instanceSourcePositions:{size:3,type:5130,fp64:this.use64bitPositions(),transition:!0,accessor:"getSourcePosition"},instanceTargetPositions:{size:3,type:5130,fp64:this.use64bitPositions(),transition:!0,accessor:"getTargetPosition"},instanceSourceColors:{size:this.props.colorFormat.length,type:5121,normalized:!0,transition:!0,accessor:"getSourceColor",defaultValue:nk},instanceTargetColors:{size:this.props.colorFormat.length,type:5121,normalized:!0,transition:!0,accessor:"getTargetColor",defaultValue:nk},instanceWidths:{size:1,transition:!0,accessor:"getWidth",defaultValue:1},instanceHeights:{size:1,transition:!0,accessor:"getHeight",defaultValue:1},instanceTilts:{size:1,transition:!0,accessor:"getTilt",defaultValue:0}})}updateState(t){super.updateState(t);const{props:e,oldProps:n,changeFlags:r}=t;if(r.extensionsChanged||r.propsChanged&&e.numSegments!==n.numSegments){var i;const{gl:t}=this.context;null===(i=this.state.model)||void 0===i||i.delete(),this.state.model=this._getModel(t),this.getAttributeManager().invalidateAll()}}draw(t){let{uniforms:e}=t;const{widthUnits:n,widthScale:r,widthMinPixels:i,widthMaxPixels:o,greatCircle:s,wrapLongitude:a}=this.props;this.state.model.setUniforms(e).setUniforms({greatCircle:s,widthUnits:fy[n],widthScale:r,widthMinPixels:i,widthMaxPixels:o,useShortestPath:a}).draw()}_getModel(t){const{id:e,numSegments:n}=this.props;let r=[];for(let o=0;o{if(n[t]===e[t])return e.path[0]},getTargetPosition:e=>{if(n[t]===e[t])return e.path[e.path.length-1]},getSourceColor:n=>Up(e.ABM2.attr[t][n[t]].color),getTargetColor:[0,0,0,100],getWidth:5*r,updateTriggers:{getSourcePosition:n,getTargetPosition:n}})}}ge(ik,"layerName","ArcLayer"),ge(ik,"defaultProps",rk);class sk{constructor(t){ge(this,"opts",void 0),ge(this,"typedArrayManager",void 0),ge(this,"indexStarts",[0]),ge(this,"vertexStarts",[0]),ge(this,"vertexCount",0),ge(this,"instanceCount",0),ge(this,"attributes",void 0),ge(this,"_attributeDefs",void 0),ge(this,"data",void 0),ge(this,"getGeometry",void 0),ge(this,"geometryBuffer",void 0),ge(this,"buffers",void 0),ge(this,"positionSize",void 0),ge(this,"normalize",void 0);const{attributes:e={}}=t;this.typedArrayManager=_v,this.attributes={},this._attributeDefs=e,this.opts=t,this.updateGeometry(t)}updateGeometry(t){Object.assign(this.opts,t);const{data:e,buffers:n={},getGeometry:r,geometryBuffer:i,positionFormat:o,dataChanged:s,normalize:a=!0}=this.opts;if(this.data=e,this.getGeometry=r,this.positionSize=i&&i.size||("XY"===o?2:3),this.buffers=n,this.normalize=a,i&&(OS(e.startIndices),this.getGeometry=this.getGeometryFromBuffer(i),a||(n.positions=i)),this.geometryBuffer=n.positions,Array.isArray(s))for(const l of s)this._rebuildGeometry(l);else this._rebuildGeometry()}updatePartialGeometry(t){let{startRow:e,endRow:n}=t;this._rebuildGeometry({startRow:e,endRow:n})}getGeometryFromBuffer(t){const e=t.value||t;return ArrayBuffer.isView(e)?mP(e,{size:this.positionSize,offset:t.offset,stride:t.stride,startIndices:this.data.startIndices}):null}_allocate(t,e){const{attributes:n,buffers:r,_attributeDefs:i,typedArrayManager:o}=this;for(const s in i)if(s in r)o.release(n[s]),n[s]=null;else{const r=i[s];r.copy=e,n[s]=o.allocate(n[s],t,r)}}_forEachGeometry(t,e,n){const{data:r,getGeometry:i}=this,{iterable:o,objectInfo:s}=pP(r,e,n);for(const a of o){s.index++;t(i?i(a,s):null,s.index)}}_rebuildGeometry(t){if(!this.data)return;let{indexStarts:e,vertexStarts:n,instanceCount:r}=this;const{data:i,geometryBuffer:o}=this,{startRow:s=0,endRow:a=1/0}=t||{},l={};if(t||(e=[0],n=[0]),this.normalize||!o)this._forEachGeometry(((t,e)=>{const r=t&&this.normalizeGeometry(t);l[e]=r,n[e+1]=n[e]+(r?this.getGeometrySize(r):0)}),s,a),r=n[n.length-1];else if(n=i.startIndices,r=n[i.length]||0,ArrayBuffer.isView(o))r=r||o.length/this.positionSize;else if(o instanceof UA){const t=o.accessor.stride||4*this.positionSize;r=r||o.byteLength/t}else if(o.buffer){const t=o.stride||4*this.positionSize;r=r||o.buffer.byteLength/t}else if(o.value){const t=o.value,e=o.stride/t.BYTES_PER_ELEMENT||this.positionSize;r=r||t.length/e}this._allocate(r,Boolean(t)),this.indexStarts=e,this.vertexStarts=n,this.instanceCount=r;const c={};this._forEachGeometry(((t,i)=>{const o=l[i]||t;c.vertexStart=n[i],c.indexStart=e[i];const s=i2&&void 0!==arguments[2]?arguments[2]:{};const r=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Math.sign(function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{start:n=0,end:r=t.length}=e,i=e.size||2;let o=0;for(let s=n,a=r-i;s4&&void 0!==arguments[4]?arguments[4]:[];if(8&n)i=(r[3]-t[1])/(e[1]-t[1]),o=3;else if(4&n)i=(r[1]-t[1])/(e[1]-t[1]),o=1;else if(2&n)i=(r[2]-t[0])/(e[0]-t[0]),o=2;else{if(!(1&n))return null;i=(r[0]-t[0])/(e[0]-t[0]),o=0}for(let a=0;ae[2]&&(n|=2),t[1]e[3]&&(n|=8),n}function hk(t,e){const n=e.length,r=t.length;if(r>0){let i=!0;for(let o=0;o4&&void 0!==arguments[4]?arguments[4]:[];const o=r+e*n;for(let s=0;sn&&(c=[],u.push(c),hk(c,d)),f=dk(h,p)}hk(c,h),fk(d,h)}return r?u:u[0]}const mk=0,vk=1;function bk(t,e){for(let n=0;n1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2?arguments[2]:void 0;if(!t.length)return[];const{size:r=2,gridResolution:i=10,gridOffset:o=[0,0],edgeTypes:s=!1}=n||{},a=[],l=[{pos:t,types:s?new Array(t.length/r).fill(vk):null,holes:e||[]}],c=[[],[]];let u=[];for(;l.length;){const{pos:t,types:e,holes:n}=l.shift();wk(t,r,n[0]||t.length,c),u=Ak(c[0],i,o,u);const d=dk(c[1],u);if(d){let i=xk(t,e,r,0,n[0]||t.length,u,d);const o={pos:i[0].pos,types:i[0].types,holes:[]},a={pos:i[1].pos,types:i[1].types,holes:[]};l.push(o,a);for(let l=0;l=0?(hk(c,f)&&d.push(g),x+=p):d.length&&(d[d.length-1]=mk),fk(m,f),v=p,b=g;return[y?{pos:l,types:e&&u}:null,x?{pos:c,types:e&&d}:null]}function Ak(t,e,n,r){const i=Math.floor((t[0]-n[0])/e)*e+n[0],o=Math.floor((t[1]-n[1])/e)*e+n[1];return r[0]=i,r[1]=o,r[2]=i+e,r[3]=o+e,r}function _k(t,e,n){8&n?(t[1]+=e,t[3]+=e):4&n?(t[1]-=e,t[3]-=e):2&n?(t[0]+=e,t[2]+=e):1&n&&(t[0]-=e,t[2]-=e)}function wk(t,e,n,r){let i=1/0,o=-1/0,s=1/0,a=-1/0;for(let l=0;lo?e:o,s=na?n:a}return r[0][0]=i,r[0][1]=s,r[1][0]=o,r[1][1]=a,r}const Sk=85.051129;function Ck(t,e,n,r){let i=-1,o=-1;for(let s=n+1;si&&(i=e,o=s-1)}return o}function Ek(t,e,n,r){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:Sk;const o=t[n],s=t[r-e];if(Math.abs(o-s)>180){const r=pk(t,0,e,n);r[0]+=360*Math.round((s-o)/360),hk(t,r),r[1]=Math.sign(r[1])*i,hk(t,r),r[0]=o,hk(t,r)}}function Pk(t,e,n,r){let i,o=t[0];for(let s=n;s180||e<-180)&&(i-=360*Math.round(e/360)),t[s]=o=i}}function Mk(t,e){let n;const r=t.length/e;for(let o=0;o2&&void 0!==arguments[2]?arguments[2]:[];const{positionSize:r}=this;e*r>=t.length&&(e+=1-t.length/r);const i=e*r;return n[0]=t[i],n[1]=t[i+1],n[2]=3===r&&t[i+2]||0,n}isClosed(t){if(!this.normalize)return Boolean(this.opts.loop);const{positionSize:e}=this,n=t.length-e;return t[0]===t[n]&&t[1]===t[n+1]&&(2===e||t[2]===t[n+2])}}function kk(t){return Array.isArray(t[0])}const Rk=[0,0,0,255],Ik={widthUnits:"meters",widthScale:{type:"number",min:0,value:1},widthMinPixels:{type:"number",min:0,value:0},widthMaxPixels:{type:"number",min:0,value:Number.MAX_SAFE_INTEGER},jointRounded:!1,capRounded:!1,miterLimit:{type:"number",min:0,value:4},billboard:!1,_pathType:null,getPath:{type:"accessor",value:t=>t.path},getColor:{type:"accessor",value:Rk},getWidth:{type:"accessor",value:1},rounded:{deprecatedFor:["jointRounded","capRounded"]}},Bk={enter:(t,e)=>e.length?e.subarray(e.length-t.length):t};class Lk extends QM{constructor(){super(...arguments),ge(this,"state",void 0)}getShaders(){return super.getShaders({vs:"#define SHADER_NAME path-layer-vertex-shader\n\nattribute vec2 positions;\n\nattribute float instanceTypes;\nattribute vec3 instanceStartPositions;\nattribute vec3 instanceEndPositions;\nattribute vec3 instanceLeftPositions;\nattribute vec3 instanceRightPositions;\nattribute vec3 instanceLeftPositions64Low;\nattribute vec3 instanceStartPositions64Low;\nattribute vec3 instanceEndPositions64Low;\nattribute vec3 instanceRightPositions64Low;\nattribute float instanceStrokeWidths;\nattribute vec4 instanceColors;\nattribute vec3 instancePickingColors;\n\nuniform float widthScale;\nuniform float widthMinPixels;\nuniform float widthMaxPixels;\nuniform float jointType;\nuniform float capType;\nuniform float miterLimit;\nuniform bool billboard;\nuniform int widthUnits;\n\nuniform float opacity;\n\nvarying vec4 vColor;\nvarying vec2 vCornerOffset;\nvarying float vMiterLength;\nvarying vec2 vPathPosition;\nvarying float vPathLength;\nvarying float vJointType;\n\nconst float EPSILON = 0.001;\nconst vec3 ZERO_OFFSET = vec3(0.0);\n\nfloat flipIfTrue(bool flag) {\n return -(float(flag) * 2. - 1.);\n}\nvec3 getLineJoinOffset(\n vec3 prevPoint, vec3 currPoint, vec3 nextPoint,\n vec2 width\n) {\n bool isEnd = positions.x > 0.0;\n float sideOfPath = positions.y;\n float isJoint = float(sideOfPath == 0.0);\n\n vec3 deltaA3 = (currPoint - prevPoint);\n vec3 deltaB3 = (nextPoint - currPoint);\n\n mat3 rotationMatrix;\n bool needsRotation = !billboard && project_needs_rotation(currPoint, rotationMatrix);\n if (needsRotation) {\n deltaA3 = deltaA3 * rotationMatrix;\n deltaB3 = deltaB3 * rotationMatrix;\n }\n vec2 deltaA = deltaA3.xy / width;\n vec2 deltaB = deltaB3.xy / width;\n\n float lenA = length(deltaA);\n float lenB = length(deltaB);\n\n vec2 dirA = lenA > 0. ? normalize(deltaA) : vec2(0.0, 0.0);\n vec2 dirB = lenB > 0. ? normalize(deltaB) : vec2(0.0, 0.0);\n\n vec2 perpA = vec2(-dirA.y, dirA.x);\n vec2 perpB = vec2(-dirB.y, dirB.x);\n vec2 tangent = dirA + dirB;\n tangent = length(tangent) > 0. ? normalize(tangent) : perpA;\n vec2 miterVec = vec2(-tangent.y, tangent.x);\n vec2 dir = isEnd ? dirA : dirB;\n vec2 perp = isEnd ? perpA : perpB;\n float L = isEnd ? lenA : lenB;\n float sinHalfA = abs(dot(miterVec, perp));\n float cosHalfA = abs(dot(dirA, miterVec));\n float turnDirection = flipIfTrue(dirA.x * dirB.y >= dirA.y * dirB.x);\n float cornerPosition = sideOfPath * turnDirection;\n\n float miterSize = 1.0 / max(sinHalfA, EPSILON);\n miterSize = mix(\n min(miterSize, max(lenA, lenB) / max(cosHalfA, EPSILON)),\n miterSize,\n step(0.0, cornerPosition)\n );\n\n vec2 offsetVec = mix(miterVec * miterSize, perp, step(0.5, cornerPosition))\n * (sideOfPath + isJoint * turnDirection);\n bool isStartCap = lenA == 0.0 || (!isEnd && (instanceTypes == 1.0 || instanceTypes == 3.0));\n bool isEndCap = lenB == 0.0 || (isEnd && (instanceTypes == 2.0 || instanceTypes == 3.0));\n bool isCap = isStartCap || isEndCap;\n if (isCap) {\n offsetVec = mix(perp * sideOfPath, dir * capType * 4.0 * flipIfTrue(isStartCap), isJoint);\n vJointType = capType;\n } else {\n vJointType = jointType;\n }\n vPathLength = L;\n vCornerOffset = offsetVec;\n vMiterLength = dot(vCornerOffset, miterVec * turnDirection);\n vMiterLength = isCap ? isJoint : vMiterLength;\n\n vec2 offsetFromStartOfPath = vCornerOffset + deltaA * float(isEnd);\n vPathPosition = vec2(\n dot(offsetFromStartOfPath, perp),\n dot(offsetFromStartOfPath, dir)\n );\n geometry.uv = vPathPosition;\n\n float isValid = step(instanceTypes, 3.5);\n vec3 offset = vec3(offsetVec * width * isValid, 0.0);\n\n if (needsRotation) {\n offset = rotationMatrix * offset;\n }\n return offset;\n}\nvoid clipLine(inout vec4 position, vec4 refPosition) {\n if (position.w < EPSILON) {\n float r = (EPSILON - refPosition.w) / (position.w - refPosition.w);\n position = refPosition + (position - refPosition) * r;\n }\n}\n\nvoid main() {\n geometry.pickingColor = instancePickingColors;\n\n vColor = vec4(instanceColors.rgb, instanceColors.a * opacity);\n\n float isEnd = positions.x;\n\n vec3 prevPosition = mix(instanceLeftPositions, instanceStartPositions, isEnd);\n vec3 prevPosition64Low = mix(instanceLeftPositions64Low, instanceStartPositions64Low, isEnd);\n\n vec3 currPosition = mix(instanceStartPositions, instanceEndPositions, isEnd);\n vec3 currPosition64Low = mix(instanceStartPositions64Low, instanceEndPositions64Low, isEnd);\n\n vec3 nextPosition = mix(instanceEndPositions, instanceRightPositions, isEnd);\n vec3 nextPosition64Low = mix(instanceEndPositions64Low, instanceRightPositions64Low, isEnd);\n\n geometry.worldPosition = currPosition;\n vec2 widthPixels = vec2(clamp(\n project_size_to_pixel(instanceStrokeWidths * widthScale, widthUnits),\n widthMinPixels, widthMaxPixels) / 2.0);\n vec3 width;\n\n if (billboard) {\n vec4 prevPositionScreen = project_position_to_clipspace(prevPosition, prevPosition64Low, ZERO_OFFSET);\n vec4 currPositionScreen = project_position_to_clipspace(currPosition, currPosition64Low, ZERO_OFFSET, geometry.position);\n vec4 nextPositionScreen = project_position_to_clipspace(nextPosition, nextPosition64Low, ZERO_OFFSET);\n\n clipLine(prevPositionScreen, currPositionScreen);\n clipLine(nextPositionScreen, currPositionScreen);\n clipLine(currPositionScreen, mix(nextPositionScreen, prevPositionScreen, isEnd));\n\n width = vec3(widthPixels, 0.0);\n DECKGL_FILTER_SIZE(width, geometry);\n\n vec3 offset = getLineJoinOffset(\n prevPositionScreen.xyz / prevPositionScreen.w,\n currPositionScreen.xyz / currPositionScreen.w,\n nextPositionScreen.xyz / nextPositionScreen.w,\n project_pixel_size_to_clipspace(width.xy)\n );\n\n DECKGL_FILTER_GL_POSITION(currPositionScreen, geometry);\n gl_Position = vec4(currPositionScreen.xyz + offset * currPositionScreen.w, currPositionScreen.w);\n } else {\n prevPosition = project_position(prevPosition, prevPosition64Low);\n currPosition = project_position(currPosition, currPosition64Low);\n nextPosition = project_position(nextPosition, nextPosition64Low);\n\n width = vec3(project_pixel_size(widthPixels), 0.0);\n DECKGL_FILTER_SIZE(width, geometry);\n\n vec3 offset = getLineJoinOffset(prevPosition, currPosition, nextPosition, width.xy);\n geometry.position = vec4(currPosition + offset, 1.0);\n gl_Position = project_common_position_to_clipspace(geometry.position);\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n }\n DECKGL_FILTER_COLOR(vColor, geometry);\n}\n",fs:"#define SHADER_NAME path-layer-fragment-shader\n\nprecision highp float;\n\nuniform float miterLimit;\n\nvarying vec4 vColor;\nvarying vec2 vCornerOffset;\nvarying float vMiterLength;\nvarying vec2 vPathPosition;\nvarying float vPathLength;\nvarying float vJointType;\n\nvoid main(void) {\n geometry.uv = vPathPosition;\n\n if (vPathPosition.y < 0.0 || vPathPosition.y > vPathLength) {\n if (vJointType > 0.5 && length(vCornerOffset) > 1.0) {\n discard;\n }\n if (vJointType < 0.5 && vMiterLength > miterLimit + 1.0) {\n discard;\n }\n }\n gl_FragColor = vColor;\n\n DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n}\n",modules:[LT,KT]})}get wrapLongitude(){return!1}initializeState(){const t=!0;this.getAttributeManager().addInstanced({positions:{size:3,vertexOffset:1,type:5130,fp64:this.use64bitPositions(),transition:Bk,accessor:"getPath",update:this.calculatePositions,noAlloc:t,shaderAttributes:{instanceLeftPositions:{vertexOffset:0},instanceStartPositions:{vertexOffset:1},instanceEndPositions:{vertexOffset:2},instanceRightPositions:{vertexOffset:3}}},instanceTypes:{size:1,type:5121,update:this.calculateSegmentTypes,noAlloc:t},instanceStrokeWidths:{size:1,accessor:"getWidth",transition:Bk,defaultValue:1},instanceColors:{size:this.props.colorFormat.length,type:5121,normalized:!0,accessor:"getColor",transition:Bk,defaultValue:Rk},instancePickingColors:{size:3,type:5121,accessor:(t,e)=>{let{index:n,target:r}=e;return this.encodePickingColor(t&&t.__source?t.__source.index:n,r)}}}),this.setState({pathTesselator:new Ok({fp64:this.use64bitPositions()})})}updateState(t){super.updateState(t);const{props:e,changeFlags:n}=t,r=this.getAttributeManager();if(n.dataChanged||n.updateTriggersChanged&&(n.updateTriggersChanged.all||n.updateTriggersChanged.getPath)){const{pathTesselator:t}=this.state,i=e.data.attributes||{};t.updateGeometry({data:e.data,geometryBuffer:i.getPath,buffers:i,normalize:!e._pathType,loop:"loop"===e._pathType,getGeometry:e.getPath,positionFormat:e.positionFormat,wrapLongitude:e.wrapLongitude,resolution:this.context.viewport.resolution,dataChanged:n.dataChanged}),this.setState({numInstances:t.instanceCount,startIndices:t.vertexStarts}),n.dataChanged||r.invalidateAll()}if(n.extensionsChanged){var i;const{gl:t}=this.context;null===(i=this.state.model)||void 0===i||i.delete(),this.state.model=this._getModel(t),r.invalidateAll()}}getPickingInfo(t){const e=super.getPickingInfo(t),{index:n}=e,{data:r}=this.props;return r[0]&&r[0].__source&&(e.object=r.find((t=>t.__source.index===n))),e}disablePickingIndex(t){const{data:e}=this.props;if(e[0]&&e[0].__source)for(let n=0;n{if(n[t]===e[t])return e.path},getColor:n=>Up(e.ABM2.attr[t][n[t]].color),opacity:r/100,getWidth:t=>{let e=t.path.length?t.path.length:1;return e>30&&(e=30+r),e},updateTriggers:{getPath:n,getWidth:r}})}}ge(Lk,"defaultProps",Ik),ge(Lk,"layerName","PathLayer");class Fk extends QM{get isComposite(){return!0}get isLoaded(){return super.isLoaded&&this.getSubLayers().every((t=>t.isLoaded))}getSubLayers(){return this.internalState&&this.internalState.subLayers||[]}initializeState(t){}setState(t){super.setState(t),this.setNeedsUpdate()}getPickingInfo(t){let{info:e}=t;const{object:n}=e;return n&&n.__source&&n.__source.parent&&n.__source.parent.id===this.id?(e.object=n.__source.object,e.index=n.__source.index,e):e}filterSubLayer(t){return!0}shouldRenderSubLayer(t,e){return e&&e.length}getSubLayerClass(t,e){const{_subLayerProps:n}=this.props;return n&&n[t]&&n[t].type||e}getSubLayerRow(t,e,n){return t.__source={parent:this,object:e,index:n},t}getSubLayerAccessor(t){if("function"===typeof t){const e={index:-1,data:this.props.data,target:[]};return(n,r)=>n&&n.__source?(e.index=n.__source.index,t(n.__source.object,e)):t(n,r)}return t}getSubLayerProps(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e;const{opacity:n,pickable:r,visible:i,parameters:o,getPolygonOffset:s,highlightedObjectIndex:a,autoHighlight:l,highlightColor:c,coordinateSystem:u,coordinateOrigin:d,wrapLongitude:h,positionFormat:f,modelMatrix:p,extensions:g,fetch:m,operation:v,_subLayerProps:b}=this.props,y={id:"",updateTriggers:{},opacity:n,pickable:r,visible:i,parameters:o,getPolygonOffset:s,highlightedObjectIndex:a,autoHighlight:l,highlightColor:c,coordinateSystem:u,coordinateOrigin:d,wrapLongitude:h,positionFormat:f,modelMatrix:p,extensions:g,fetch:m,operation:v},x=b&&t.id&&b[t.id],A=x&&x.updateTriggers,_=t.id||"sublayer";if(x){const e=this.props[sg],n=t.type?t.type._propTypes:{};for(const t in x){const r=n[t]||e[t];r&&"accessor"===r.type&&(x[t]=this.getSubLayerAccessor(x[t]))}}Object.assign(y,t,x),y.id="".concat(this.props.id,"-").concat(_),y.updateTriggers={all:null===(e=this.props.updateTriggers)||void 0===e?void 0:e.all,...t.updateTriggers,...A};for(const w of g){const t=w.getSubLayerProps.call(this,w);t&&Object.assign(y,t,{updateTriggers:Object.assign(y.updateTriggers,t.updateTriggers)})}return y}_updateAutoHighlight(t){for(const e of this.getSubLayers())e.updateAutoHighlight(t)}_getAttributeManager(){return null}_postUpdate(t,e){let n=this.internalState.subLayers;const r=!n||this.needsUpdate();if(r){n=Dg(this.renderLayers(),Boolean),this.internalState.subLayers=n}Lg("compositeLayer.renderLayers",this,r,n);for(const i of n)i.parent=this}}function Nk(t){let{data:e,getIndex:n,dataRange:r,replace:i}=t;const{startRow:o=0,endRow:s=1/0}=r,a=e.length;let l=a,c=a;for(let h=0;hh&&t>=o&&(l=h),t>=s){c=h;break}}let u=l;const d=c-l!==i.length?e.slice(c):void 0;for(let h=0;h{},zk={10241:9987,10240:9729,10242:33071,10243:33071};function Uk(t,e,n,r){const i=Math.min(n/e.width,r/e.height),o=Math.floor(e.width*i),s=Math.floor(e.height*i);return 1===i?{data:e,width:o,height:s}:(t.canvas.height=s,t.canvas.width=o,t.clearRect(0,0,o,s),t.drawImage(e,0,0,e.width,e.height,0,0,o,s),{data:t.canvas,width:o,height:s})}function Vk(t){return t&&(t.id||t.url)}function Gk(t,e,n,r){const i=t.width,o=t.height,s=new qA(t.gl,{width:e,height:n,parameters:r});return function(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{sourceX:r=0,sourceY:i=0,targetMipmaplevel:o=0,targetInternalFormat:s=6408}=n;let{targetX:a,targetY:l,targetZ:c,width:u,height:d}=n;const{framebuffer:h,deleteFramebuffer:f}=u_(t);xA(h);const{gl:p,handle:g}=h,m="undefined"!==typeof a||"undefined"!==typeof l||"undefined"!==typeof c;a=a||0,l=l||0,c=c||0;const v=p.bindFramebuffer(36160,g);xA(e);let b=null;if(e instanceof KA&&(b=e,u=Number.isFinite(u)?u:b.width,d=Number.isFinite(d)?d:b.height,b.bind(0),e=b.target),m)switch(e){case 3553:case 34067:p.copyTexSubImage2D(e,o,a,l,r,i,u,d);break;case 35866:case 32879:yx(p).copyTexSubImage3D(e,o,a,l,c,r,i,u,d)}else p.copyTexImage2D(e,o,s,r,i,u,d,0);b&&b.unbind(),p.bindFramebuffer(36160,v||null),f&&h.delete()}(t,s,{targetY:0,width:i,height:o}),t.delete(),s}function Wk(t,e,n){for(let r=0;r0){const{mapping:t,xOffset:e,yOffset:r,rowHeight:i,canvasHeight:o}=function(t){let{icons:e,buffer:n,mapping:r={},xOffset:i=0,yOffset:o=0,rowHeight:s=0,canvasWidth:a}=t,l=[];for(let u=0;ua&&(Wk(r,l,o),i=0,o=s+o+n,s=0,l=[]),l.push({icon:t,xOffset:i}),i=i+c+n,s=Math.max(s,e)}}return l.length>0&&Wk(r,l,o),{mapping:r,rowHeight:s,xOffset:i,yOffset:o,canvasWidth:a,canvasHeight:(c=s+o+n,Math.pow(2,Math.ceil(Math.log2(c))))};var c}({icons:n,buffer:this._buffer,canvasWidth:this._canvasWidth,mapping:this._mapping,rowHeight:this._rowHeight,xOffset:this._xOffset,yOffset:this._yOffset});this._rowHeight=i,this._mapping=t,this._xOffset=e,this._yOffset=r,this._canvasHeight=o,this._texture||(this._texture=new qA(this.gl,{width:this._canvasWidth,height:this._canvasHeight,parameters:this._textureParameters||zk})),this._texture.height!==this._canvasHeight&&(this._texture=Gk(this._texture,this._canvasWidth,this._canvasHeight,this._textureParameters||zk)),this.onUpdate(),this._canvas=this._canvas||document.createElement("canvas"),this._loadIcons(n)}}_loadIcons(t){const e=this._canvas.getContext("2d",{willReadFrequently:!0});for(const n of t)this._pendingCount++,yv(n.url,this._loadOptions).then((t=>{const r=Vk(n),i=this._mapping[r],{x:o,y:s,width:a,height:l}=i,{data:c,width:u,height:d}=Uk(e,t,a,l);this._texture.setSubImageData({data:c,x:o+(a-u)/2,y:s+(l-d)/2,width:u,height:d}),i.width=u,i.height=d,this._texture.generateMipmap(),this.onUpdate()})).catch((t=>{this.onError({url:n.url,source:n.source,sourceIndex:n.sourceIndex,loadOptions:this._loadOptions,error:t})})).finally((()=>{this._pendingCount--}))}}const Jk=[0,0,0,255],Kk={iconAtlas:{type:"image",value:null,async:!0},iconMapping:{type:"object",value:{},async:!0},sizeScale:{type:"number",value:1,min:0},billboard:!0,sizeUnits:"pixels",sizeMinPixels:{type:"number",min:0,value:0},sizeMaxPixels:{type:"number",min:0,value:Number.MAX_SAFE_INTEGER},alphaCutoff:{type:"number",value:.05,min:0,max:1},getPosition:{type:"accessor",value:t=>t.position},getIcon:{type:"accessor",value:t=>t.icon},getColor:{type:"accessor",value:Jk},getSize:{type:"accessor",value:1},getAngle:{type:"accessor",value:0},getPixelOffset:{type:"accessor",value:[0,0]},onIconError:{type:"function",value:null,optional:!0},textureParameters:{type:"object",ignore:!0}};class Xk extends QM{constructor(){super(...arguments),ge(this,"state",void 0)}getShaders(){return super.getShaders({vs:"#define SHADER_NAME icon-layer-vertex-shader\n\nattribute vec2 positions;\n\nattribute vec3 instancePositions;\nattribute vec3 instancePositions64Low;\nattribute float instanceSizes;\nattribute float instanceAngles;\nattribute vec4 instanceColors;\nattribute vec3 instancePickingColors;\nattribute vec4 instanceIconFrames;\nattribute float instanceColorModes;\nattribute vec2 instanceOffsets;\nattribute vec2 instancePixelOffset;\n\nuniform float sizeScale;\nuniform vec2 iconsTextureDim;\nuniform float sizeMinPixels;\nuniform float sizeMaxPixels;\nuniform bool billboard;\nuniform int sizeUnits;\n\nvarying float vColorMode;\nvarying vec4 vColor;\nvarying vec2 vTextureCoords;\nvarying vec2 uv;\n\nvec2 rotate_by_angle(vec2 vertex, float angle) {\n float angle_radian = angle * PI / 180.0;\n float cos_angle = cos(angle_radian);\n float sin_angle = sin(angle_radian);\n mat2 rotationMatrix = mat2(cos_angle, -sin_angle, sin_angle, cos_angle);\n return rotationMatrix * vertex;\n}\n\nvoid main(void) {\n geometry.worldPosition = instancePositions;\n geometry.uv = positions;\n geometry.pickingColor = instancePickingColors;\n uv = positions;\n\n vec2 iconSize = instanceIconFrames.zw;\n float sizePixels = clamp(\n project_size_to_pixel(instanceSizes * sizeScale, sizeUnits), \n sizeMinPixels, sizeMaxPixels\n );\n float instanceScale = iconSize.y == 0.0 ? 0.0 : sizePixels / iconSize.y;\n vec2 pixelOffset = positions / 2.0 * iconSize + instanceOffsets;\n pixelOffset = rotate_by_angle(pixelOffset, instanceAngles) * instanceScale;\n pixelOffset += instancePixelOffset;\n pixelOffset.y *= -1.0;\n\n if (billboard) {\n gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.0), geometry.position);\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n vec3 offset = vec3(pixelOffset, 0.0);\n DECKGL_FILTER_SIZE(offset, geometry);\n gl_Position.xy += project_pixel_size_to_clipspace(offset.xy);\n\n } else {\n vec3 offset_common = vec3(project_pixel_size(pixelOffset), 0.0);\n DECKGL_FILTER_SIZE(offset_common, geometry);\n gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, offset_common, geometry.position); \n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n }\n\n vTextureCoords = mix(\n instanceIconFrames.xy,\n instanceIconFrames.xy + iconSize,\n (positions.xy + 1.0) / 2.0\n ) / iconsTextureDim;\n\n vColor = instanceColors;\n DECKGL_FILTER_COLOR(vColor, geometry);\n\n vColorMode = instanceColorModes;\n}\n",fs:"#define SHADER_NAME icon-layer-fragment-shader\n\nprecision highp float;\n\nuniform float opacity;\nuniform sampler2D iconsTexture;\nuniform float alphaCutoff;\n\nvarying float vColorMode;\nvarying vec4 vColor;\nvarying vec2 vTextureCoords;\nvarying vec2 uv;\n\nvoid main(void) {\n geometry.uv = uv;\n\n vec4 texColor = texture2D(iconsTexture, vTextureCoords);\n vec3 color = mix(texColor.rgb, vColor.rgb, vColorMode);\n float a = texColor.a * opacity * vColor.a;\n\n if (a < alphaCutoff) {\n discard;\n }\n\n gl_FragColor = vec4(color, a);\n DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n}\n",modules:[LT,KT]})}initializeState(){this.state={iconManager:new Hk(this.context.gl,{onUpdate:this._onUpdate.bind(this),onError:this._onError.bind(this)})};this.getAttributeManager().addInstanced({instancePositions:{size:3,type:5130,fp64:this.use64bitPositions(),transition:!0,accessor:"getPosition"},instanceSizes:{size:1,transition:!0,accessor:"getSize",defaultValue:1},instanceOffsets:{size:2,accessor:"getIcon",transform:this.getInstanceOffset},instanceIconFrames:{size:4,accessor:"getIcon",transform:this.getInstanceIconFrame},instanceColorModes:{size:1,type:5121,accessor:"getIcon",transform:this.getInstanceColorMode},instanceColors:{size:this.props.colorFormat.length,type:5121,normalized:!0,transition:!0,accessor:"getColor",defaultValue:Jk},instanceAngles:{size:1,transition:!0,accessor:"getAngle"},instancePixelOffset:{size:2,transition:!0,accessor:"getPixelOffset"}})}updateState(t){super.updateState(t);const{props:e,oldProps:n,changeFlags:r}=t,i=this.getAttributeManager(),{iconAtlas:o,iconMapping:s,data:a,getIcon:l,textureParameters:c}=e,{iconManager:u}=this.state,d=o||this.internalState.isAsyncPropLoading("iconAtlas");if(u.setProps({loadOptions:e.loadOptions,autoPacking:!d,iconAtlas:o,iconMapping:d?s:null,textureParameters:c}),d?n.iconMapping!==e.iconMapping&&i.invalidate("getIcon"):(r.dataChanged||r.updateTriggersChanged&&(r.updateTriggersChanged.all||r.updateTriggersChanged.getIcon))&&u.packIcons(a,l),r.extensionsChanged){var h;const{gl:t}=this.context;null===(h=this.state.model)||void 0===h||h.delete(),this.state.model=this._getModel(t),i.invalidateAll()}}get isLoaded(){return super.isLoaded&&this.state.iconManager.isLoaded}finalizeState(t){super.finalizeState(t),this.state.iconManager.finalize()}draw(t){let{uniforms:e}=t;const{sizeScale:n,sizeMinPixels:r,sizeMaxPixels:i,sizeUnits:o,billboard:s,alphaCutoff:a}=this.props,{iconManager:l}=this.state,c=l.getTexture();c&&this.state.model.setUniforms(e).setUniforms({iconsTexture:c,iconsTextureDim:[c.width,c.height],sizeUnits:fy[o],sizeScale:n,sizeMinPixels:r,sizeMaxPixels:i,billboard:s,alphaCutoff:a}).draw()}_getModel(t){return new oM(t,{...this.getShaders(),id:this.props.id,geometry:new qT({drawMode:6,attributes:{positions:{size:2,value:new Float32Array([-1,-1,-1,1,1,1,1,-1])}}}),isInstanced:!0})}_onUpdate(){this.setNeedsRedraw()}_onError(t){var e;const n=null===(e=this.getCurrentLayer())||void 0===e?void 0:e.props.onIconError;n?n(t):Rg.error(t.error.message)()}getInstanceOffset(t){const{width:e,height:n,anchorX:r=e/2,anchorY:i=n/2}=this.state.iconManager.getIconMapping(t);return[e/2-r,n/2-i]}getInstanceColorMode(t){return this.state.iconManager.getIconMapping(t).mask?1:0}getInstanceIconFrame(t){const{x:e,y:n,width:r,height:i}=this.state.iconManager.getIconMapping(t);return[e,n,r,i]}}ge(Xk,"defaultProps",Kk),ge(Xk,"layerName","IconLayer");const qk=[0,0,0,255],Yk={radiusUnits:"meters",radiusScale:{type:"number",min:0,value:1},radiusMinPixels:{type:"number",min:0,value:0},radiusMaxPixels:{type:"number",min:0,value:Number.MAX_SAFE_INTEGER},lineWidthUnits:"meters",lineWidthScale:{type:"number",min:0,value:1},lineWidthMinPixels:{type:"number",min:0,value:0},lineWidthMaxPixels:{type:"number",min:0,value:Number.MAX_SAFE_INTEGER},stroked:!1,filled:!0,billboard:!1,antialiasing:!0,getPosition:{type:"accessor",value:t=>t.position},getRadius:{type:"accessor",value:1},getFillColor:{type:"accessor",value:qk},getLineColor:{type:"accessor",value:qk},getLineWidth:{type:"accessor",value:1},strokeWidth:{deprecatedFor:"getLineWidth"},outline:{deprecatedFor:"stroked"},getColor:{deprecatedFor:["getFillColor","getLineColor"]}};class Qk extends QM{getShaders(){return super.getShaders({vs:"#define SHADER_NAME scatterplot-layer-vertex-shader\n\nattribute vec3 positions;\n\nattribute vec3 instancePositions;\nattribute vec3 instancePositions64Low;\nattribute float instanceRadius;\nattribute float instanceLineWidths;\nattribute vec4 instanceFillColors;\nattribute vec4 instanceLineColors;\nattribute vec3 instancePickingColors;\n\nuniform float opacity;\nuniform float radiusScale;\nuniform float radiusMinPixels;\nuniform float radiusMaxPixels;\nuniform float lineWidthScale;\nuniform float lineWidthMinPixels;\nuniform float lineWidthMaxPixels;\nuniform float stroked;\nuniform bool filled;\nuniform bool antialiasing;\nuniform bool billboard;\nuniform int radiusUnits;\nuniform int lineWidthUnits;\n\nvarying vec4 vFillColor;\nvarying vec4 vLineColor;\nvarying vec2 unitPosition;\nvarying float innerUnitRadius;\nvarying float outerRadiusPixels;\n\n\nvoid main(void) {\n geometry.worldPosition = instancePositions;\n outerRadiusPixels = clamp(\n project_size_to_pixel(radiusScale * instanceRadius, radiusUnits),\n radiusMinPixels, radiusMaxPixels\n );\n float lineWidthPixels = clamp(\n project_size_to_pixel(lineWidthScale * instanceLineWidths, lineWidthUnits),\n lineWidthMinPixels, lineWidthMaxPixels\n );\n outerRadiusPixels += stroked * lineWidthPixels / 2.0;\n float edgePadding = antialiasing ? (outerRadiusPixels + SMOOTH_EDGE_RADIUS) / outerRadiusPixels : 1.0;\n unitPosition = edgePadding * positions.xy;\n geometry.uv = unitPosition;\n geometry.pickingColor = instancePickingColors;\n\n innerUnitRadius = 1.0 - stroked * lineWidthPixels / outerRadiusPixels;\n \n if (billboard) {\n gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.0), geometry.position);\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n vec3 offset = edgePadding * positions * outerRadiusPixels;\n DECKGL_FILTER_SIZE(offset, geometry);\n gl_Position.xy += project_pixel_size_to_clipspace(offset.xy);\n } else {\n vec3 offset = edgePadding * positions * project_pixel_size(outerRadiusPixels);\n DECKGL_FILTER_SIZE(offset, geometry);\n gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, offset, geometry.position);\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n }\n vFillColor = vec4(instanceFillColors.rgb, instanceFillColors.a * opacity);\n DECKGL_FILTER_COLOR(vFillColor, geometry);\n vLineColor = vec4(instanceLineColors.rgb, instanceLineColors.a * opacity);\n DECKGL_FILTER_COLOR(vLineColor, geometry);\n}\n",fs:"#define SHADER_NAME scatterplot-layer-fragment-shader\n\nprecision highp float;\n\nuniform bool filled;\nuniform float stroked;\nuniform bool antialiasing;\n\nvarying vec4 vFillColor;\nvarying vec4 vLineColor;\nvarying vec2 unitPosition;\nvarying float innerUnitRadius;\nvarying float outerRadiusPixels;\n\nvoid main(void) {\n geometry.uv = unitPosition;\n\n float distToCenter = length(unitPosition) * outerRadiusPixels;\n float inCircle = antialiasing ? \n smoothedge(distToCenter, outerRadiusPixels) : \n step(distToCenter, outerRadiusPixels);\n\n if (inCircle == 0.0) {\n discard;\n }\n\n if (stroked > 0.5) {\n float isLine = antialiasing ? \n smoothedge(innerUnitRadius * outerRadiusPixels, distToCenter) :\n step(innerUnitRadius * outerRadiusPixels, distToCenter);\n\n if (filled) {\n gl_FragColor = mix(vFillColor, vLineColor, isLine);\n } else {\n if (isLine == 0.0) {\n discard;\n }\n gl_FragColor = vec4(vLineColor.rgb, vLineColor.a * isLine);\n }\n } else if (!filled) {\n discard;\n } else {\n gl_FragColor = vFillColor;\n }\n\n gl_FragColor.a *= inCircle;\n DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n}\n",modules:[LT,KT]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:5130,fp64:this.use64bitPositions(),transition:!0,accessor:"getPosition"},instanceRadius:{size:1,transition:!0,accessor:"getRadius",defaultValue:1},instanceFillColors:{size:this.props.colorFormat.length,transition:!0,normalized:!0,type:5121,accessor:"getFillColor",defaultValue:[0,0,0,255]},instanceLineColors:{size:this.props.colorFormat.length,transition:!0,normalized:!0,type:5121,accessor:"getLineColor",defaultValue:[0,0,0,255]},instanceLineWidths:{size:1,transition:!0,accessor:"getLineWidth",defaultValue:1}})}updateState(t){if(super.updateState(t),t.changeFlags.extensionsChanged){var e;const{gl:t}=this.context;null===(e=this.state.model)||void 0===e||e.delete(),this.state.model=this._getModel(t),this.getAttributeManager().invalidateAll()}}draw(t){let{uniforms:e}=t;const{radiusUnits:n,radiusScale:r,radiusMinPixels:i,radiusMaxPixels:o,stroked:s,filled:a,billboard:l,antialiasing:c,lineWidthUnits:u,lineWidthScale:d,lineWidthMinPixels:h,lineWidthMaxPixels:f}=this.props;this.state.model.setUniforms(e).setUniforms({stroked:s?1:0,filled:a,billboard:l,antialiasing:c,radiusUnits:fy[n],radiusScale:r,radiusMinPixels:i,radiusMaxPixels:o,lineWidthUnits:fy[u],lineWidthScale:d,lineWidthMinPixels:h,lineWidthMaxPixels:f}).draw()}_getModel(t){return new oM(t,{...this.getShaders(),id:this.props.id,geometry:new qT({drawMode:6,vertexCount:4,attributes:{positions:{size:3,value:new Float32Array([-1,-1,0,1,-1,0,1,1,0,-1,1,0])}}}),isInstanced:!0})}}ge(Qk,"defaultProps",Yk),ge(Qk,"layerName","ScatterplotLayer");const Zk=.75,$k=[];class tR extends Xk{constructor(){super(...arguments),ge(this,"state",void 0)}getShaders(){return{...super.getShaders(),fs:"#define SHADER_NAME multi-icon-layer-fragment-shader\n\nprecision highp float;\n\nuniform float opacity;\nuniform sampler2D iconsTexture;\nuniform float gamma;\nuniform bool sdf;\nuniform float alphaCutoff;\nuniform float sdfBuffer;\nuniform float outlineBuffer;\nuniform vec4 outlineColor;\n\nvarying vec4 vColor;\nvarying vec2 vTextureCoords;\nvarying vec2 uv;\n\nvoid main(void) {\n geometry.uv = uv;\n\n if (!picking_uActive) {\n float alpha = texture2D(iconsTexture, vTextureCoords).a;\n vec4 color = vColor;\n if (sdf) {\n float distance = alpha;\n alpha = smoothstep(sdfBuffer - gamma, sdfBuffer + gamma, distance);\n\n if (outlineBuffer > 0.0) {\n float inFill = alpha;\n float inBorder = smoothstep(outlineBuffer - gamma, outlineBuffer + gamma, distance);\n color = mix(outlineColor, vColor, inFill);\n alpha = inBorder;\n }\n }\n float a = alpha * color.a;\n \n if (a < alphaCutoff) {\n discard;\n }\n\n gl_FragColor = vec4(color.rgb, a * opacity);\n }\n\n DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n}\n"}}initializeState(){super.initializeState();this.getAttributeManager().addInstanced({instanceOffsets:{size:2,accessor:"getIconOffsets"},instancePickingColors:{type:5121,size:3,accessor:(t,e)=>{let{index:n,target:r}=e;return this.encodePickingColor(n,r)}}})}updateState(t){super.updateState(t);const{props:e,oldProps:n}=t;let{outlineColor:r}=e;r!==n.outlineColor&&(r=r.map((t=>t/255)),r[3]=Number.isFinite(r[3])?r[3]:1,this.setState({outlineColor:r})),!e.sdf&&e.outlineWidth&&Rg.warn("".concat(this.id,": fontSettings.sdf is required to render outline"))()}draw(t){const{sdf:e,smoothing:n,outlineWidth:r}=this.props,{outlineColor:i}=this.state,o=r?Math.max(n,Zk*(1-r)):-1;if(t.uniforms={...t.uniforms,sdfBuffer:Zk,outlineBuffer:o,gamma:n,sdf:Boolean(e),outlineColor:i},super.draw(t),e&&r){const{iconManager:t}=this.state;t.getTexture()&&this.state.model.draw({uniforms:{outlineBuffer:Zk}})}}getInstanceOffset(t){return t?Array.from(t).flatMap((t=>super.getInstanceOffset(t))):$k}getInstanceColorMode(t){return 1}getInstanceIconFrame(t){return t?Array.from(t).flatMap((t=>super.getInstanceIconFrame(t))):$k}}ge(tR,"defaultProps",{getIconOffsets:{type:"accessor",value:t=>t.offsets},alphaCutoff:.001,smoothing:.1,outlineWidth:0,outlineColor:{type:"color",value:[0,0,0,255]}}),ge(tR,"layerName","MultiIconLayer");const eR=1e20;class nR{constructor(){let{fontSize:t=24,buffer:e=3,radius:n=8,cutoff:r=.25,fontFamily:i="sans-serif",fontWeight:o="normal",fontStyle:s="normal"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.buffer=e,this.cutoff=r,this.radius=n;const a=this.size=t+4*e,l=this._createCanvas(a),c=this.ctx=l.getContext("2d",{willReadFrequently:!0});c.font="".concat(s," ").concat(o," ").concat(t,"px ").concat(i),c.textBaseline="alphabetic",c.textAlign="left",c.fillStyle="black",this.gridOuter=new Float64Array(a*a),this.gridInner=new Float64Array(a*a),this.f=new Float64Array(a),this.z=new Float64Array(a+1),this.v=new Uint16Array(a)}_createCanvas(t){const e=document.createElement("canvas");return e.width=e.height=t,e}draw(t){const{width:e,actualBoundingBoxAscent:n,actualBoundingBoxDescent:r,actualBoundingBoxLeft:i,actualBoundingBoxRight:o}=this.ctx.measureText(t),s=Math.ceil(n),a=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(o-i))),l=Math.min(this.size-this.buffer,s+Math.ceil(r)),c=a+2*this.buffer,u=l+2*this.buffer,d=Math.max(c*u,0),h=new Uint8ClampedArray(d),f={data:h,width:c,height:u,glyphWidth:a,glyphHeight:l,glyphTop:s,glyphLeft:0,glyphAdvance:e};if(0===a||0===l)return f;const{ctx:p,buffer:g,gridInner:m,gridOuter:v}=this;p.clearRect(g,g,a,l),p.fillText(t,g,g+s);const b=p.getImageData(g,g,a,l);v.fill(eR,0,d),m.fill(0,0,d);for(let y=0;y0?t*t:0,m[n]=t<0?t*t:0}}rR(v,0,0,c,u,c,this.f,this.v,this.z),rR(m,g,g,a,l,c,this.f,this.v,this.z);for(let y=0;y-1);l++,o[l]=a,s[l]=c,s[l+1]=eR}for(let a=0,l=0;ar&&(s4&&void 0!==arguments[4]?arguments[4]:0,o=arguments.length>5?arguments[5]:void 0;void 0===o&&(o=t.length);const s=[];return"break-all"===e?lR(t,i,o,n,r,s):function(t,e,n,r,i,o){let s=e,a=e,l=e,c=0;for(let u=e;ua){let e=aR(t,a,l,i);c+e>r&&(sr&&(e=lR(t,a,l,r,i,o),s=o[o.length-1])),a=l,c+=e}}(t,i,o,n,r,s),s}function uR(t,e,n,r,i,o){let s=0,a=0;for(let l=e;l0&&void 0!==arguments[0]?arguments[0]:5;ge(this,"limit",void 0),ge(this,"_cache",{}),ge(this,"_order",[]),this.limit=t}get(t){const e=this._cache[t];return e&&(this._deleteOrder(t),this._appendOrder(t)),e}set(t,e){this._cache[t]?(this.delete(t),this._cache[t]=e,this._appendOrder(t)):(Object.keys(this._cache).length===this.limit&&this.delete(this._order[0]),this._cache[t]=e,this._appendOrder(t))}delete(t){this._cache[t]&&(delete this._cache[t],this._deleteOrder(t))}_deleteOrder(t){const e=this._order.indexOf(t);e>=0&&this._order.splice(e,1)}_appendOrder(t){this._order.push(t)}}const hR={fontFamily:"Monaco, monospace",fontWeight:"normal",characterSet:function(){const t=[];for(let e=32;e<128;e++)t.push(String.fromCharCode(e));return t}(),fontSize:64,buffer:4,sdf:!1,cutoff:.25,radius:12,smoothing:.1};let fR=new dR(3);function pR(t,e){for(let n=0;n0&&void 0!==arguments[0]?arguments[0]:{};Object.assign(this.props,t),this._key=this._getKey();const e=function(t,e){let n;n="string"===typeof e?new Set(Array.from(e)):new Set(e);const r=fR.get(t);if(!r)return n;for(const i in r.mapping)n.has(i)&&n.delete(i);return n}(this._key,this.props.characterSet),n=fR.get(this._key);if(n&&0===e.size)return void(this._atlas!==n&&(this._atlas=n));const r=this._generateFontAtlas(e,n);this._atlas=r,fR.set(this._key,r)}_generateFontAtlas(t,e){const{fontFamily:n,fontWeight:r,fontSize:i,buffer:o,sdf:s,radius:a,cutoff:l}=this.props;let c=e&&e.data;c||(c=document.createElement("canvas"),c.width=1024);const u=c.getContext("2d",{willReadFrequently:!0});gR(u,n,i,r);const{mapping:d,canvasHeight:h,xOffset:f,yOffset:p}=function(t){let{characterSet:e,getFontWidth:n,fontHeight:r,buffer:i,maxCanvasWidth:o,mapping:s={},xOffset:a=0,yOffset:l=0}=t,c=0,u=a;const d=r+2*i;for(const f of e)if(!s[f]){const t=n(f);u+t+2*i>o&&(u=0,c++),s[f]={x:u+i,y:l+c*d+i,width:t,height:d,layoutWidth:t,layoutHeight:r},u+=t+2*i}return{mapping:s,xOffset:u,yOffset:l+c*d,canvasHeight:(h=l+(c+1)*d,Math.pow(2,Math.ceil(Math.log2(h))))};var h}({getFontWidth:t=>u.measureText(t).width,fontHeight:1.2*i,buffer:o,characterSet:t,maxCanvasWidth:1024,...e&&{mapping:e.mapping,xOffset:e.xOffset,yOffset:e.yOffset}});if(c.height!==h){const t=u.getImageData(0,0,c.width,c.height);c.height=h,u.putImageData(t,0,0)}if(gR(u,n,i,r),s){const e=new nR({fontSize:i,buffer:o,radius:a,cutoff:l,fontFamily:n,fontWeight:"".concat(r)});for(const n of t){const{data:t,width:r,height:o,glyphTop:s}=e.draw(n);d[n].width=r,d[n].layoutOffsetY=.9*i-s;const a=u.createImageData(r,o);pR(t,a),u.putImageData(a,d[n].x,d[n].y)}}else for(const g of t)u.fillText(g,d[g].x,d[g].y+o+.9*i);return{xOffset:f,yOffset:p,mapping:d,data:c,width:c.width,height:c.height}}_getKey(){const{fontFamily:t,fontWeight:e,fontSize:n,buffer:r,sdf:i,radius:o,cutoff:s}=this.props;return i?"".concat(t," ").concat(e," ").concat(n," ").concat(r," ").concat(o," ").concat(s):"".concat(t," ").concat(e," ").concat(n," ").concat(r)}}const vR={billboard:!0,sizeScale:1,sizeUnits:"pixels",sizeMinPixels:0,sizeMaxPixels:Number.MAX_SAFE_INTEGER,padding:{type:"array",value:[0,0,0,0]},getPosition:{type:"accessor",value:t=>t.position},getSize:{type:"accessor",value:1},getAngle:{type:"accessor",value:0},getPixelOffset:{type:"accessor",value:[0,0]},getBoundingRect:{type:"accessor",value:[0,0,0,0]},getFillColor:{type:"accessor",value:[0,0,0,255]},getLineColor:{type:"accessor",value:[0,0,0,255]},getLineWidth:{type:"accessor",value:1}};class bR extends QM{constructor(){super(...arguments),ge(this,"state",void 0)}getShaders(){return super.getShaders({vs:"#define SHADER_NAME text-background-layer-vertex-shader\n\nattribute vec2 positions;\n\nattribute vec3 instancePositions;\nattribute vec3 instancePositions64Low;\nattribute vec4 instanceRects;\nattribute float instanceSizes;\nattribute float instanceAngles;\nattribute vec2 instancePixelOffsets;\nattribute float instanceLineWidths;\nattribute vec4 instanceFillColors;\nattribute vec4 instanceLineColors;\nattribute vec3 instancePickingColors;\n\nuniform bool billboard;\nuniform float opacity;\nuniform float sizeScale;\nuniform float sizeMinPixels;\nuniform float sizeMaxPixels;\nuniform vec4 padding;\nuniform int sizeUnits;\n\nvarying vec4 vFillColor;\nvarying vec4 vLineColor;\nvarying float vLineWidth;\nvarying vec2 uv;\nvarying vec2 dimensions;\n\nvec2 rotate_by_angle(vec2 vertex, float angle) {\n float angle_radian = radians(angle);\n float cos_angle = cos(angle_radian);\n float sin_angle = sin(angle_radian);\n mat2 rotationMatrix = mat2(cos_angle, -sin_angle, sin_angle, cos_angle);\n return rotationMatrix * vertex;\n}\n\nvoid main(void) {\n geometry.worldPosition = instancePositions;\n geometry.uv = positions;\n geometry.pickingColor = instancePickingColors;\n uv = positions;\n vLineWidth = instanceLineWidths;\n float sizePixels = clamp(\n project_size_to_pixel(instanceSizes * sizeScale, sizeUnits),\n sizeMinPixels, sizeMaxPixels\n );\n\n dimensions = instanceRects.zw * sizePixels + padding.xy + padding.zw;\n\n vec2 pixelOffset = (positions * instanceRects.zw + instanceRects.xy) * sizePixels + mix(-padding.xy, padding.zw, positions);\n pixelOffset = rotate_by_angle(pixelOffset, instanceAngles);\n pixelOffset += instancePixelOffsets;\n pixelOffset.y *= -1.0;\n\n if (billboard) {\n gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, vec3(0.0), geometry.position);\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n vec3 offset = vec3(pixelOffset, 0.0);\n DECKGL_FILTER_SIZE(offset, geometry);\n gl_Position.xy += project_pixel_size_to_clipspace(offset.xy);\n } else {\n vec3 offset_common = vec3(project_pixel_size(pixelOffset), 0.0);\n DECKGL_FILTER_SIZE(offset_common, geometry);\n gl_Position = project_position_to_clipspace(instancePositions, instancePositions64Low, offset_common, geometry.position);\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n }\n vFillColor = vec4(instanceFillColors.rgb, instanceFillColors.a * opacity);\n DECKGL_FILTER_COLOR(vFillColor, geometry);\n vLineColor = vec4(instanceLineColors.rgb, instanceLineColors.a * opacity);\n DECKGL_FILTER_COLOR(vLineColor, geometry);\n}\n",fs:"#define SHADER_NAME text-background-layer-fragment-shader\n\nprecision highp float;\n\nuniform bool stroked;\n\nvarying vec4 vFillColor;\nvarying vec4 vLineColor;\nvarying float vLineWidth;\nvarying vec2 uv;\nvarying vec2 dimensions;\n\nvoid main(void) {\n geometry.uv = uv;\n\n vec2 pixelPosition = uv * dimensions;\n if (stroked) {\n float distToEdge = min(\n min(pixelPosition.x, dimensions.x - pixelPosition.x),\n min(pixelPosition.y, dimensions.y - pixelPosition.y)\n );\n float isBorder = smoothedge(distToEdge, vLineWidth);\n gl_FragColor = mix(vFillColor, vLineColor, isBorder);\n } else {\n gl_FragColor = vFillColor;\n }\n\n DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n}\n",modules:[LT,KT]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:5130,fp64:this.use64bitPositions(),transition:!0,accessor:"getPosition"},instanceSizes:{size:1,transition:!0,accessor:"getSize",defaultValue:1},instanceAngles:{size:1,transition:!0,accessor:"getAngle"},instanceRects:{size:4,accessor:"getBoundingRect"},instancePixelOffsets:{size:2,transition:!0,accessor:"getPixelOffset"},instanceFillColors:{size:4,transition:!0,normalized:!0,type:5121,accessor:"getFillColor",defaultValue:[0,0,0,255]},instanceLineColors:{size:4,transition:!0,normalized:!0,type:5121,accessor:"getLineColor",defaultValue:[0,0,0,255]},instanceLineWidths:{size:1,transition:!0,accessor:"getLineWidth",defaultValue:1}})}updateState(t){super.updateState(t);const{changeFlags:e}=t;if(e.extensionsChanged){var n;const{gl:t}=this.context;null===(n=this.state.model)||void 0===n||n.delete(),this.state.model=this._getModel(t),this.getAttributeManager().invalidateAll()}}draw(t){let{uniforms:e}=t;const{billboard:n,sizeScale:r,sizeUnits:i,sizeMinPixels:o,sizeMaxPixels:s,getLineWidth:a}=this.props;let{padding:l}=this.props;l.length<4&&(l=[l[0],l[1],l[0],l[1]]),this.state.model.setUniforms(e).setUniforms({billboard:n,stroked:Boolean(a),padding:l,sizeUnits:fy[i],sizeScale:r,sizeMinPixels:o,sizeMaxPixels:s}).draw()}_getModel(t){return new oM(t,{...this.getShaders(),id:this.props.id,geometry:new qT({drawMode:6,vertexCount:4,attributes:{positions:{size:2,value:new Float32Array([0,0,1,0,1,1,0,1])}}}),isInstanced:!0})}}ge(bR,"defaultProps",vR),ge(bR,"layerName","TextBackgroundLayer");const yR={start:1,middle:0,end:-1},xR={top:1,center:0,bottom:-1},AR=[0,0,0,255],_R={billboard:!0,sizeScale:1,sizeUnits:"pixels",sizeMinPixels:0,sizeMaxPixels:Number.MAX_SAFE_INTEGER,background:!1,getBackgroundColor:{type:"accessor",value:[255,255,255,255]},getBorderColor:{type:"accessor",value:AR},getBorderWidth:{type:"accessor",value:0},backgroundPadding:{type:"array",value:[0,0,0,0]},characterSet:{type:"object",value:hR.characterSet},fontFamily:hR.fontFamily,fontWeight:hR.fontWeight,lineHeight:1,outlineWidth:{type:"number",value:0,min:0},outlineColor:{type:"color",value:AR},fontSettings:{type:"object",value:{},compare:1},wordBreak:"break-word",maxWidth:{type:"number",value:-1},getText:{type:"accessor",value:t=>t.text},getPosition:{type:"accessor",value:t=>t.position},getColor:{type:"accessor",value:AR},getSize:{type:"accessor",value:32},getAngle:{type:"accessor",value:0},getTextAnchor:{type:"accessor",value:"middle"},getAlignmentBaseline:{type:"accessor",value:"center"},getPixelOffset:{type:"accessor",value:[0,0]},backgroundColor:{deprecatedFor:["background","getBackgroundColor"]}};class wR extends Fk{constructor(){super(...arguments),ge(this,"state",void 0),ge(this,"getBoundingRect",((t,e)=>{let{size:[n,r]}=this.transformParagraph(t,e);const{fontSize:i}=this.state.fontAtlasManager.props;n/=i,r/=i;const{getTextAnchor:o,getAlignmentBaseline:s}=this.props;return[(yR["function"===typeof o?o(t,e):o]-1)*n/2,(xR["function"===typeof s?s(t,e):s]-1)*r/2,n,r]})),ge(this,"getIconOffsets",((t,e)=>{const{getTextAnchor:n,getAlignmentBaseline:r}=this.props,{x:i,y:o,rowWidth:s,size:[a,l]}=this.transformParagraph(t,e),c=yR["function"===typeof n?n(t,e):n],u=xR["function"===typeof r?r(t,e):r],d=i.length,h=new Array(2*d);let f=0;for(let p=0;p0&&Rg.warn("v8.9 breaking change: TextLayer maxWidth is now relative to text size")()}updateState(t){const{props:e,oldProps:n,changeFlags:r}=t;(r.dataChanged||r.updateTriggersChanged&&(r.updateTriggersChanged.all||r.updateTriggersChanged.getText))&&this._updateText();(this._updateFontAtlas()||e.lineHeight!==n.lineHeight||e.wordBreak!==n.wordBreak||e.maxWidth!==n.maxWidth)&&this.setState({styleVersion:this.state.styleVersion+1})}getPickingInfo(t){let{info:e}=t;return e.object=e.index>=0?this.props.data[e.index]:null,e}_updateFontAtlas(){const{fontSettings:t,fontFamily:e,fontWeight:n}=this.props,{fontAtlasManager:r,characterSet:i}=this.state,o={...t,characterSet:i,fontFamily:e,fontWeight:n};if(!r.mapping)return r.setProps(o),!0;for(const s in o)if(o[s]!==r.props[s])return r.setProps(o),!0;return!1}_updateText(){var t;const{data:e,characterSet:n}=this.props,r=null===(t=e.attributes)||void 0===t?void 0:t.getText;let i,{getText:o}=this.props,s=e.startIndices;const a="auto"===n&&new Set;if(r&&s){const{texts:t,characterCount:n}=function(t){let{value:e,length:n,stride:r,offset:i,startIndices:o,characterSet:s}=t;const a=e.BYTES_PER_ELEMENT,l=r?r/a:1,c=i?i/a:0,u=o[n]||Math.ceil((e.length-c)/l),d=s&&new Set,h=new Array(n);let f=e;if(l>1||c>0){f=new(0,e.constructor)(u);for(let t=0;t{let{index:r}=n;return t[r]}}else{const{iterable:t,objectInfo:n}=pP(e);s=[0],i=0;for(const e of t){n.index++;const t=Array.from(o(e,n)||"");a&&t.forEach(a.add,a),i+=t.length,s.push(i)}}this.setState({getText:o,startIndices:s,numInstances:i,characterSet:a||n})}transformParagraph(t,e){const{fontAtlasManager:n}=this.state,r=n.mapping,i=this.state.getText,{wordBreak:o,lineHeight:s,maxWidth:a}=this.props;return function(t,e,n,r,i){const o=Array.from(t),s=o.length,a=new Array(s),l=new Array(s),c=new Array(s),u=("break-word"===n||"break-all"===n)&&isFinite(r)&&r>0,d=[0,0],h=[0,0];let f=0,p=0,g=0;for(let v=0;v<=s;v++){const t=o[v];if("\n"!==t&&v!==s||(g=v),g>p){const t=u?cR(o,n,r,i,p,g):sR;for(let n=0;n<=t.length;n++){const r=0===n?p:t[n-1],s=n=3,"Invalid cache limit"),fR=new dR(t)}(t)}}ge(wR,"defaultProps",_R),ge(wR,"layerName","TextLayer");var SR=n(973),CR=n.n(SR);const ER=ak,PR=lk,MR={isClosed:!0};function TR(t){return"positions"in t?t.positions:t}function OR(t){return"holeIndices"in t?t.holeIndices:null}function kR(t,e,n,r,i){let o=e;const s=n.length;for(let a=0;a4&&void 0!==arguments[4]?arguments[4]:0,o=arguments.length>5?arguments[5]:void 0,s=arguments.length>6?arguments[6]:void 0;o=o||n.length;const a=o-i;if(a<=0)return e;let l=e;for(let c=0;c=1&&t[0].length>=2&&Number.isFinite(t[0][0])}(t)){let i=0;for(const[o,s]of t.entries())i=kR(n,i,s,e,0===o?ER:PR),r.push(i);return r.pop(),{positions:n,holeIndices:r}}return kR(n,0,t,e,ER),n}function BR(t,e,n){const r=t.length/3;let i=0;for(let o=0;o1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2?arguments[2]:void 0;const{size:r=2,normalize:i=!0,edgeTypes:o=!1}=n||{};e=e||[];const s=[],a=[];let l=0,c=0;for(let d=0;d<=e.length;d++){const i=e[d]||t.length,o=c,u=Ck(t,r,l,i);for(let e=u;et/e)));let o=TR(t);const s=r&&3===e;if(n){const t=o.length;o=o.slice();const r=[];for(let i=0;ie&&t>r||(e>r?(n||(o=o.slice()),LR(o,0,2,1)):(n||(o=o.slice()),LR(o,2,0,1)))}return CR()(o,i,e)}(t,this.positionSize,this.opts.preproject,this.opts.full3d);l=a.allocate(l,i+u.length,{copy:!0});for(let d=0;d2?s[l*o+2]:0;i[3*a]=t,i[3*a+1]=e,i[3*a+2]=n}}_updateVertexValid(t,e){let{vertexStart:n,geometrySize:r}=e;const{positionSize:i}=this,o=this.attributes.vertexValid,s=t&&OR(t);if(t&&t.edgeTypes?o.set(t.edgeTypes,n):o.fill(1,n,n+r),s)for(let a=0;a0&&!Number.isFinite(t[0])}const NR="\nattribute vec2 vertexPositions;\nattribute float vertexValid;\n\nuniform bool extruded;\nuniform bool isWireframe;\nuniform float elevationScale;\nuniform float opacity;\n\nvarying vec4 vColor;\n\nstruct PolygonProps {\n vec4 fillColors;\n vec4 lineColors;\n vec3 positions;\n vec3 nextPositions;\n vec3 pickingColors;\n vec3 positions64Low;\n vec3 nextPositions64Low;\n float elevations;\n};\n\nvec3 project_offset_normal(vec3 vector) {\n if (project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||\n project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSETS) {\n return normalize(vector * project_uCommonUnitsPerWorldUnit);\n }\n return project_normal(vector);\n}\n\nvoid calculatePosition(PolygonProps props) {\n#ifdef IS_SIDE_VERTEX\n if(vertexValid < 0.5){\n gl_Position = vec4(0.);\n return;\n }\n#endif\n\n vec3 pos;\n vec3 pos64Low;\n vec3 normal;\n vec4 colors = isWireframe ? props.lineColors : props.fillColors;\n\n geometry.worldPosition = props.positions;\n geometry.worldPositionAlt = props.nextPositions;\n geometry.pickingColor = props.pickingColors;\n\n#ifdef IS_SIDE_VERTEX\n pos = mix(props.positions, props.nextPositions, vertexPositions.x);\n pos64Low = mix(props.positions64Low, props.nextPositions64Low, vertexPositions.x);\n#else\n pos = props.positions;\n pos64Low = props.positions64Low;\n#endif\n\n if (extruded) {\n pos.z += props.elevations * vertexPositions.y * elevationScale;\n }\n gl_Position = project_position_to_clipspace(pos, pos64Low, vec3(0.), geometry.position);\n\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n\n if (extruded) {\n #ifdef IS_SIDE_VERTEX\n normal = vec3(\n props.positions.y - props.nextPositions.y + (props.positions64Low.y - props.nextPositions64Low.y),\n props.nextPositions.x - props.positions.x + (props.nextPositions64Low.x - props.positions64Low.x),\n 0.0);\n normal = project_offset_normal(normal);\n #else\n normal = project_normal(vec3(0.0, 0.0, 1.0));\n #endif\n geometry.normal = normal;\n vec3 lightColor = lighting_getLightColor(colors.rgb, project_uCameraPosition, geometry.position.xyz, normal);\n vColor = vec4(lightColor, colors.a * opacity);\n } else {\n vColor = vec4(colors.rgb, colors.a * opacity);\n }\n DECKGL_FILTER_COLOR(vColor, geometry);\n}\n",jR="#define SHADER_NAME solid-polygon-layer-vertex-shader\n\nattribute vec3 positions;\nattribute vec3 positions64Low;\nattribute float elevations;\nattribute vec4 fillColors;\nattribute vec4 lineColors;\nattribute vec3 pickingColors;\n\n".concat(NR,"\n\nvoid main(void) {\n PolygonProps props;\n\n props.positions = positions;\n props.positions64Low = positions64Low;\n props.elevations = elevations;\n props.fillColors = fillColors;\n props.lineColors = lineColors;\n props.pickingColors = pickingColors;\n\n calculatePosition(props);\n}\n"),zR="#define SHADER_NAME solid-polygon-layer-vertex-shader-side\n#define IS_SIDE_VERTEX\n\n\nattribute vec3 instancePositions;\nattribute vec3 nextPositions;\nattribute vec3 instancePositions64Low;\nattribute vec3 nextPositions64Low;\nattribute float instanceElevations;\nattribute vec4 instanceFillColors;\nattribute vec4 instanceLineColors;\nattribute vec3 instancePickingColors;\n\n".concat(NR,"\n\nvoid main(void) {\n PolygonProps props;\n\n #if RING_WINDING_ORDER_CW == 1\n props.positions = instancePositions;\n props.positions64Low = instancePositions64Low;\n props.nextPositions = nextPositions;\n props.nextPositions64Low = nextPositions64Low;\n #else\n props.positions = nextPositions;\n props.positions64Low = nextPositions64Low;\n props.nextPositions = instancePositions;\n props.nextPositions64Low = instancePositions64Low;\n #endif\n props.elevations = instanceElevations;\n props.fillColors = instanceFillColors;\n props.lineColors = instanceLineColors;\n props.pickingColors = instancePickingColors;\n\n calculatePosition(props);\n}\n"),UR=[0,0,0,255],VR={filled:!0,extruded:!1,wireframe:!1,_normalize:!0,_windingOrder:"CW",_full3d:!1,elevationScale:{type:"number",min:0,value:1},getPolygon:{type:"accessor",value:t=>t.polygon},getElevation:{type:"accessor",value:1e3},getFillColor:{type:"accessor",value:UR},getLineColor:{type:"accessor",value:UR},material:!0},GR={enter:(t,e)=>e.length?e.subarray(e.length-t.length):t};class WR extends QM{constructor(){super(...arguments),ge(this,"state",void 0)}getShaders(t){return super.getShaders({vs:"top"===t?jR:zR,fs:"#define SHADER_NAME solid-polygon-layer-fragment-shader\n\nprecision highp float;\n\nvarying vec4 vColor;\n\nvoid main(void) {\n gl_FragColor = vColor;\n\n DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n}\n",defines:{RING_WINDING_ORDER_CW:this.props._normalize||"CCW"!==this.props._windingOrder?1:0},modules:[LT,GT,KT]})}get wrapLongitude(){return!1}initializeState(){const{gl:t,viewport:e}=this.context;let{coordinateSystem:n}=this.props;const{_full3d:r}=this.props;let i;e.isGeospatial&&n===dy.DEFAULT&&(n=dy.LNGLAT),n===dy.LNGLAT&&(i=r?e.projectPosition.bind(e):e.projectFlat.bind(e)),this.setState({numInstances:0,polygonTesselator:new DR({preproject:i,fp64:this.use64bitPositions(),IndexType:!t||D_(t,m_)?Uint32Array:Uint16Array})});const o=this.getAttributeManager(),s=!0;o.remove(["instancePickingColors"]),o.add({indices:{size:1,isIndexed:!0,update:this.calculateIndices,noAlloc:s},positions:{size:3,type:5130,fp64:this.use64bitPositions(),transition:GR,accessor:"getPolygon",update:this.calculatePositions,noAlloc:s,shaderAttributes:{positions:{vertexOffset:0,divisor:0},instancePositions:{vertexOffset:0,divisor:1},nextPositions:{vertexOffset:1,divisor:1}}},vertexValid:{size:1,divisor:1,type:5121,update:this.calculateVertexValid,noAlloc:s},elevations:{size:1,transition:GR,accessor:"getElevation",shaderAttributes:{elevations:{divisor:0},instanceElevations:{divisor:1}}},fillColors:{size:this.props.colorFormat.length,type:5121,normalized:!0,transition:GR,accessor:"getFillColor",defaultValue:UR,shaderAttributes:{fillColors:{divisor:0},instanceFillColors:{divisor:1}}},lineColors:{size:this.props.colorFormat.length,type:5121,normalized:!0,transition:GR,accessor:"getLineColor",defaultValue:UR,shaderAttributes:{lineColors:{divisor:0},instanceLineColors:{divisor:1}}},pickingColors:{size:3,type:5121,accessor:(t,e)=>{let{index:n,target:r}=e;return this.encodePickingColor(t&&t.__source?t.__source.index:n,r)},shaderAttributes:{pickingColors:{divisor:0},instancePickingColors:{divisor:1}}}})}getPickingInfo(t){const e=super.getPickingInfo(t),{index:n}=e,{data:r}=this.props;return r[0]&&r[0].__source&&(e.object=r.find((t=>t.__source.index===n))),e}disablePickingIndex(t){const{data:e}=this.props;if(e[0]&&e[0].__source)for(let n=0;nt.delete())),this.setState(this._getModels(this.context.gl)),i.invalidateAll())}updateGeometry(t){let{props:e,oldProps:n,changeFlags:r}=t;if(r.dataChanged||r.updateTriggersChanged&&(r.updateTriggersChanged.all||r.updateTriggersChanged.getPolygon)){const{polygonTesselator:t}=this.state,n=e.data.attributes||{};t.updateGeometry({data:e.data,normalize:e._normalize,geometryBuffer:n.getPolygon,buffers:n,getGeometry:e.getPolygon,positionFormat:e.positionFormat,wrapLongitude:e.wrapLongitude,resolution:this.context.viewport.resolution,fp64:this.use64bitPositions(),dataChanged:r.dataChanged,full3d:e._full3d}),this.setState({numInstances:t.instanceCount,startIndices:t.vertexStarts}),r.dataChanged||this.getAttributeManager().invalidateAll()}}_getModels(t){const{id:e,filled:n,extruded:r}=this.props;let i,o;if(n){const n=this.getShaders("top");n.defines.NON_INSTANCED_MODEL=1,i=new oM(t,{...n,id:"".concat(e,"-top"),drawMode:4,attributes:{vertexPositions:new Float32Array([0,1])},uniforms:{isWireframe:!1,isSideVertex:!1},vertexCount:0,isIndexed:!0})}return r&&(o=new oM(t,{...this.getShaders("side"),id:"".concat(e,"-side"),geometry:new qT({drawMode:1,vertexCount:4,attributes:{vertexPositions:{size:2,value:new Float32Array([1,0,0,0,0,1,1,1])}}}),instanceCount:0,isInstanced:1}),o.userData.excludeAttributes={indices:!0}),{models:[o,i].filter(Boolean),topModel:i,sideModel:o}}calculateIndices(t){const{polygonTesselator:e}=this.state;t.startIndices=e.indexStarts,t.value=e.get("indices")}calculatePositions(t){const{polygonTesselator:e}=this.state;t.startIndices=e.vertexStarts,t.value=e.get("positions")}calculateVertexValid(t){t.value=this.state.polygonTesselator.get("vertexValid")}}ge(WR,"defaultProps",VR),ge(WR,"layerName","SolidPolygonLayer");const HR={circle:{type:Qk,props:{filled:"filled",stroked:"stroked",lineWidthMaxPixels:"lineWidthMaxPixels",lineWidthMinPixels:"lineWidthMinPixels",lineWidthScale:"lineWidthScale",lineWidthUnits:"lineWidthUnits",pointRadiusMaxPixels:"radiusMaxPixels",pointRadiusMinPixels:"radiusMinPixels",pointRadiusScale:"radiusScale",pointRadiusUnits:"radiusUnits",pointAntialiasing:"antialiasing",pointBillboard:"billboard",getFillColor:"getFillColor",getLineColor:"getLineColor",getLineWidth:"getLineWidth",getPointRadius:"getRadius"}},icon:{type:Xk,props:{iconAtlas:"iconAtlas",iconMapping:"iconMapping",iconSizeMaxPixels:"sizeMaxPixels",iconSizeMinPixels:"sizeMinPixels",iconSizeScale:"sizeScale",iconSizeUnits:"sizeUnits",iconAlphaCutoff:"alphaCutoff",iconBillboard:"billboard",getIcon:"getIcon",getIconAngle:"getAngle",getIconColor:"getColor",getIconPixelOffset:"getPixelOffset",getIconSize:"getSize"}},text:{type:wR,props:{textSizeMaxPixels:"sizeMaxPixels",textSizeMinPixels:"sizeMinPixels",textSizeScale:"sizeScale",textSizeUnits:"sizeUnits",textBackground:"background",textBackgroundPadding:"backgroundPadding",textFontFamily:"fontFamily",textFontWeight:"fontWeight",textLineHeight:"lineHeight",textMaxWidth:"maxWidth",textOutlineColor:"outlineColor",textOutlineWidth:"outlineWidth",textWordBreak:"wordBreak",textCharacterSet:"characterSet",textBillboard:"billboard",textFontSettings:"fontSettings",getText:"getText",getTextAngle:"getAngle",getTextColor:"getColor",getTextPixelOffset:"getPixelOffset",getTextSize:"getSize",getTextAnchor:"getTextAnchor",getTextAlignmentBaseline:"getAlignmentBaseline",getTextBackgroundColor:"getBackgroundColor",getTextBorderColor:"getBorderColor",getTextBorderWidth:"getBorderWidth"}}},JR={type:Lk,props:{lineWidthUnits:"widthUnits",lineWidthScale:"widthScale",lineWidthMinPixels:"widthMinPixels",lineWidthMaxPixels:"widthMaxPixels",lineJointRounded:"jointRounded",lineCapRounded:"capRounded",lineMiterLimit:"miterLimit",lineBillboard:"billboard",getLineColor:"getColor",getLineWidth:"getWidth"}},KR={type:WR,props:{extruded:"extruded",filled:"filled",wireframe:"wireframe",elevationScale:"elevationScale",material:"material",_full3d:"_full3d",getElevation:"getElevation",getFillColor:"getFillColor",getLineColor:"getLineColor"}};function XR(t){let{type:e,props:n}=t;const r={};for(const i in n)r[i]=e.defaultProps[n[i]];return r}function qR(t,e){const{transitions:n,updateTriggers:r}=t.props,i={updateTriggers:{},transitions:n&&{getPosition:n.geometry}};for(const o in e){const s=e[o];let a=t.props[o];o.startsWith("get")&&(a=t.getSubLayerAccessor(a),i.updateTriggers[s]=r[o],n&&(i.transitions[s]=n[o])),i[s]=a}return i}function YR(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r={pointFeatures:[],lineFeatures:[],polygonFeatures:[],polygonOutlineFeatures:[]},{startRow:i=0,endRow:o=t.length}=n;for(let s=i;s0;)e=e[0];return e&&Number.isFinite(e[0])}(o,s))switch(o){case"Point":a.push(n({geometry:t},r,i));break;case"MultiPoint":s.forEach((t=>{a.push(n({geometry:{type:"Point",coordinates:t}},r,i))}));break;case"LineString":l.push(n({geometry:t},r,i));break;case"MultiLineString":s.forEach((t=>{l.push(n({geometry:{type:"LineString",coordinates:t}},r,i))}));break;case"Polygon":c.push(n({geometry:t},r,i)),s.forEach((t=>{u.push(n({geometry:{type:"LineString",coordinates:t}},r,i))}));break;case"MultiPolygon":s.forEach((t=>{c.push(n({geometry:{type:"Polygon",coordinates:t}},r,i)),t.forEach((t=>{u.push(n({geometry:{type:"LineString",coordinates:t}},r,i))}))}))}else Rg.warn("".concat(o," coordinates are malformed"))()}const ZR={Point:1,MultiPoint:2,LineString:2,MultiLineString:3,Polygon:3,MultiPolygon:4};function $R(t){return t.geometry.coordinates}function tI(t,e){const n={points:{},lines:{},polygons:{},polygonsOutline:{}},{points:r,lines:i,polygons:o}=t,s=function(t,e){const n={points:null,lines:null,polygons:null};for(const r in n){const i=t[r].globalFeatureIds.value;n[r]=new Uint8ClampedArray(3*i.length);const o=[];for(let t=0;tt.properties.icon},getText:{type:"accessor",value:t=>t.properties.text},pointType:"circle",getRadius:{deprecatedFor:"getPointRadius"}};class rI extends Fk{initializeState(){this.state={layerProps:{},features:{}}}updateState(t){let{props:e,changeFlags:n}=t;if(!n.dataChanged)return;const{data:r}=this.props,i=r&&"points"in r&&"polygons"in r&&"lines"in r;this.setState({binary:i}),i?this._updateStateBinary({props:e,changeFlags:n}):this._updateStateJSON({props:e,changeFlags:n})}_updateStateBinary(t){let{props:e,changeFlags:n}=t;const r=tI(e.data,this.encodePickingColor);this.setState({layerProps:r})}_updateStateJSON(t){let{props:e,changeFlags:n}=t;const r=function(t){if(Array.isArray(t))return t;switch(Rg.assert(t.type,"GeoJSON does not have type"),t.type){case"Feature":return[t];case"FeatureCollection":return Rg.assert(Array.isArray(t.features),"GeoJSON does not have features array"),t.features;default:return[{geometry:t}]}}(e.data),i=this.getSubLayerRow.bind(this);let o={};const s={};if(Array.isArray(n.dataChanged)){const t=this.state.features;for(const e in t)o[e]=t[e].slice(),s[e]=[];for(const e of n.dataChanged){const n=YR(r,i,e);for(const r in t)s[r].push(Nk({data:o[r],getIndex:t=>t.__source.index,dataRange:e,replace:n[r]}))}}else o=YR(r,i);const a=function(t,e){const n={points:{},lines:{},polygons:{},polygonsOutline:{}},{pointFeatures:r,lineFeatures:i,polygonFeatures:o,polygonOutlineFeatures:s}=t;return n.points.data=r,n.points._dataDiff=e.pointFeatures&&(()=>e.pointFeatures),n.points.getPosition=$R,n.lines.data=i,n.lines._dataDiff=e.lineFeatures&&(()=>e.lineFeatures),n.lines.getPath=$R,n.polygons.data=o,n.polygons._dataDiff=e.polygonFeatures&&(()=>e.polygonFeatures),n.polygons.getPolygon=$R,n.polygonsOutline.data=s,n.polygonsOutline._dataDiff=e.polygonOutlineFeatures&&(()=>e.polygonOutlineFeatures),n.polygonsOutline.getPath=$R,n}(o,s);this.setState({features:o,featuresDiff:s,layerProps:a})}getPickingInfo(t){const e=super.getPickingInfo(t),{index:n,sourceLayer:r}=e;return e.featureType=eI.find((t=>r.id.startsWith("".concat(this.id,"-").concat(t,"-")))),n>=0&&r.id.startsWith("".concat(this.id,"-points-text"))&&this.state.binary&&(e.index=this.props.data.points.globalFeatureIds.value[n]),e}_updateAutoHighlight(t){const e="".concat(this.id,"-points-"),n="points"===t.featureType;for(const r of this.getSubLayers())r.id.startsWith(e)===n&&r.updateAutoHighlight(t)}_renderPolygonLayer(){const{extruded:t,wireframe:e}=this.props,{layerProps:n}=this.state,r="polygons-fill",i=this.shouldRenderSubLayer(r,n.polygons.data)&&this.getSubLayerClass(r,KR.type);if(i){const o=qR(this,KR.props),s=t&&e;return s||delete o.getLineColor,o.updateTriggers.lineColors=s,new i(o,this.getSubLayerProps({id:r,updateTriggers:o.updateTriggers}),n.polygons)}return null}_renderLineLayers(){const{extruded:t,stroked:e}=this.props,{layerProps:n}=this.state,r="polygons-stroke",i="linestrings",o=!t&&e&&this.shouldRenderSubLayer(r,n.polygonsOutline.data)&&this.getSubLayerClass(r,JR.type),s=this.shouldRenderSubLayer(i,n.lines.data)&&this.getSubLayerClass(i,JR.type);if(o||s){const t=qR(this,JR.props);return[o&&new o(t,this.getSubLayerProps({id:r,updateTriggers:t.updateTriggers}),n.polygonsOutline),s&&new s(t,this.getSubLayerProps({id:i,updateTriggers:t.updateTriggers}),n.lines)]}return null}_renderPointLayers(){const{pointType:t}=this.props,{layerProps:e,binary:n}=this.state;let{highlightedObjectIndex:r}=this.props;!n&&Number.isFinite(r)&&(r=e.points.data.findIndex((t=>t.__source.index===r)));const i=new Set(t.split("+")),o=[];for(const s of i){const t="points-".concat(s),i=HR[s],a=i&&this.shouldRenderSubLayer(t,e.points.data)&&this.getSubLayerClass(t,i.type);if(a){const l=qR(this,i.props);let c=e.points;if("text"===s&&n){const{instancePickingColors:t,...e}=c.data.attributes;c={...c,data:{...c.data,attributes:e}}}o.push(new a(l,this.getSubLayerProps({id:t,updateTriggers:l.updateTriggers,highlightedObjectIndex:r}),c))}}return o}renderLayers(){const{extruded:t}=this.props,e=this._renderPolygonLayer();return[!t&&e,this._renderLineLayers(),this._renderPointLayers(),t&&e]}getSubLayerAccessor(t){const{binary:e}=this.state;return e&&"function"===typeof t?(e,n)=>{const{data:r,index:i}=n,o=function(t,e){if(!t)return null;const n="startIndices"in t?t.startIndices[e]:e,r=t.featureIds.value[n];return-1!==n?function(t,e,n){const r={properties:{...t.properties[e]}};for(const i in t.numericProps)r.properties[i]=t.numericProps[i].value[n];return r}(t,r,n):null}(r,i);return t(o,n)}:super.getSubLayerAccessor(t)}}ge(rI,"layerName","GeoJsonLayer"),ge(rI,"defaultProps",nI);const iI=(t,e,n,r,i)=>{const{height:o,color:s,name:a}=e,l=((t,e,n)=>{const r=e,i=t.x-r/2,o=t.y-r/2;return n.current.pickObjects({x:i,y:o,width:r,height:r})})(t,r,i);l.forEach((t=>{const e=t.object.properties;e&&e.interactive&&(e.color=Vp(s)?Up(s):s,e.height=o,e.name=a)})),n(l)},oI=t=>{const e=JSON.parse(JSON.stringify(t.GEOGRID));for(let i=0;i<(null===t||void 0===t||null===(n=t.GEOGRID)||void 0===n||null===(r=n.features)||void 0===r?void 0:r.length);i++){var n,r;e.features[i].properties=t.GEOGRIDDATA[i],e.features[i].properties={...e.features[i].properties,id:i}}return e};function sI(t){let{data:e,editOn:n,state:{selectedType:r,keyDownState:i,selectedCellsState:o,pickingRadius:s,opacity:a},updaters:{setSelectedCellsState:l,setDraggingWhileEditing:c,setHoveredObj:u},deckGLRef:d}=t;return new rI({opacity:a,id:"GRID",data:e,pickable:!0,extruded:!0,wireframe:!0,elevationScale:5,lineWidthScale:1,lineWidthMinPixels:2,getElevation:t=>t.properties.height[1],getFillColor:t=>t.properties.color,onClick:t=>{r&&n&&"Shift"!==i&&iI(t,r,l,s,d)},onDrag:t=>{r&&n&&"Shift"!==i&&iI(t,r,l,s,d)},onDragStart:()=>{r&&n&&"Shift"!==i&&c(!0)},onHover:t=>{t.object&&u(t)},onDragEnd:()=>{c(!1)},updateTriggers:{getFillColor:o,getElevation:o},transitions:{getFillColor:500,getElevation:150}})}function aI(t){let{data:e,coordinates:n,opacity:r}=t;if(!e||!e.text)return;let i=[];return e.text.forEach((t=>{i.push({coordinates:[n.features[t.id].geometry.coordinates[0][0][0],n.features[t.id].geometry.coordinates[0][0][1],100],info:t.info})})),new wR({opacity:r,id:"text-layer",data:i,pickable:!0,getPosition:t=>t.coordinates,getText:t=>t.info,getColor:[255,255,255],getSize:30,getAngle:0,getTextAnchor:"middle",getAlignmentBaseline:"center"})}function lI(t){let{data:e,opacity:n}=t;if(e.geojson)return new rI({id:"GeojsonLayer",data:e.geojson,opacity:n,pickable:!0,wireframe:!1,stroked:!0,filled:!0,extruded:!0,lineWidthScale:1,getFillColor:t=>Up(t.properties.fill),getLineColor:t=>Up(t.properties.stroke),lineWidthMinPixels:2,getElevation:t=>t.properties.height,updateTriggers:{getFillColor:e,getElevation:e},transitions:{getFillColor:500,getElevation:500}})}const cI={id:"request-scheduler",throttleRequests:!0,maxRequests:6};class uI{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};ge(this,"props",void 0),ge(this,"stats",void 0),ge(this,"activeRequestCount",0),ge(this,"requestQueue",[]),ge(this,"requestMap",new Map),ge(this,"deferredUpdate",null),this.props={...cI,...t},this.stats=new Ug({id:this.props.id}),this.stats.get("Queued Requests"),this.stats.get("Active Requests"),this.stats.get("Cancelled Requests"),this.stats.get("Queued Requests Ever"),this.stats.get("Active Requests Ever")}scheduleRequest(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>0;if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(t))return this.requestMap.get(t);const n={handle:t,priority:0,getPriority:e},r=new Promise((t=>(n.resolve=t,n)));return this.requestQueue.push(n),this.requestMap.set(t,r),this._issueNewRequests(),r}_issueRequest(t){const{handle:e,resolve:n}=t;let r=!1;const i=()=>{r||(r=!0,this.requestMap.delete(e),this.activeRequestCount--,this._issueNewRequests())};return this.activeRequestCount++,n?n({done:i}):Promise.resolve({done:i})}_issueNewRequests(){this.deferredUpdate||(this.deferredUpdate=setTimeout((()=>this._issueNewRequestsAsync()),0))}_issueNewRequestsAsync(){this.deferredUpdate=null;const t=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(0!==t){this._updateAllRequests();for(let e=0;et.priority-e.priority))}_updateRequest(t){return t.priority=t.getPriority(t.handle),!(t.priority<0)||(t.resolve(null),!1)}}class dI{constructor(t){ge(this,"index",void 0),ge(this,"isVisible",void 0),ge(this,"isSelected",void 0),ge(this,"parent",void 0),ge(this,"children",void 0),ge(this,"content",void 0),ge(this,"state",void 0),ge(this,"layers",void 0),ge(this,"id",void 0),ge(this,"zoom",void 0),ge(this,"userData",void 0),ge(this,"boundingBox",void 0),ge(this,"_abortController",void 0),ge(this,"_loader",void 0),ge(this,"_loaderId",void 0),ge(this,"_isLoaded",void 0),ge(this,"_isCancelled",void 0),ge(this,"_needsReload",void 0),ge(this,"_bbox",void 0),this.index=t,this.isVisible=!1,this.isSelected=!1,this.parent=null,this.children=[],this.content=null,this._loader=void 0,this._abortController=null,this._loaderId=0,this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1}get bbox(){return this._bbox}set bbox(t){this._bbox||(this._bbox=t,this.boundingBox="west"in t?[[t.west,t.south],[t.east,t.north]]:[[t.left,t.top],[t.right,t.bottom]])}get data(){return this.isLoading&&this._loader?this._loader.then((()=>this.data)):this.content}get isLoaded(){return this._isLoaded&&!this._needsReload}get isLoading(){return Boolean(this._loader)&&!this._isCancelled}get needsReload(){return this._needsReload||this._isCancelled}get byteLength(){const t=this.content?this.content.byteLength:0;return Number.isFinite(t)||console.error("byteLength not defined in tile data"),t}async _loadData(t){let{getData:e,requestScheduler:n,onLoad:r,onError:i}=t;const{index:o,id:s,bbox:a,userData:l,zoom:c}=this,u=this._loaderId;this._abortController=new AbortController;const{signal:d}=this._abortController,h=await n.scheduleRequest(this,(t=>t.isSelected?1:-1));if(!h)return void(this._isCancelled=!0);if(this._isCancelled)return void h.done();let f,p=null;try{p=await e({index:o,id:s,bbox:a,userData:l,zoom:c,signal:d})}catch(g$){f=g$||!0}finally{h.done()}u===this._loaderId&&(this._loader=void 0,this.content=p,!this._isCancelled||p?(this._isLoaded=!0,this._isCancelled=!1,f?i(f,this):r(this)):this._isLoaded=!1)}loadData(t){return this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1,this._loaderId++,this._loader=this._loadData(t),this._loader}setNeedsReload(){this.isLoading&&(this.abort(),this._loader=void 0),this._needsReload=!0}abort(){var t;this.isLoaded||(this._isCancelled=!0,null===(t=this._abortController)||void 0===t||t.abort())}}const hI=Math.PI/180,fI=180/Math.PI,pI=6370972,gI=256;function mI(){const t=4018225162502676e-20,e=Math.PI/180*gI;return{unitsPerMeter:[t,t,t],unitsPerMeter2:[0,0,0],metersPerUnit:[24886.609375,24886.609375,24886.609375],unitsPerDegree:[e,e,t],unitsPerDegree2:[0,0,0],degreesPerUnit:[1/e,1/e,24886.609375]}}class vI extends yy{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{latitude:e=0,longitude:n=0,zoom:r=0,nearZMultiplier:i=.1,farZMultiplier:o=2,resolution:s=10}=t;let{height:a,altitude:l=1.5}=t;a=a||1,l=Math.max(.75,l);const c=(new Mb).lookAt({eye:[0,-l,0],up:[0,0,1]}),u=Math.pow(2,r);c.rotateX(e*hI),c.rotateZ(-n*hI),c.scale(u/a);const d=Math.atan(.5/l),h=512*u/a;super({...t,height:a,viewMatrix:c,longitude:n,latitude:e,zoom:r,distanceScales:mI(),fovyRadians:2*d,focalDistance:l,near:i,far:Math.min(2,1/h+1)*l*o}),ge(this,"longitude",void 0),ge(this,"latitude",void 0),ge(this,"resolution",void 0),this.latitude=e,this.longitude=n,this.resolution=s}get projectionMode(){return hy.GLOBE}getDistanceScales(){return this.distanceScales}getBounds(){const t={targetZ:(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).z||0},e=this.unproject([0,this.height/2],t),n=this.unproject([this.width/2,0],t),r=this.unproject([this.width,this.height/2],t),i=this.unproject([this.width/2,this.height],t);return r[0]this.longitude&&(e[0]-=360),[Math.min(e[0],r[0],n[0],i[0]),Math.min(e[1],r[1],n[1],i[1]),Math.max(e[0],r[0],n[0],i[0]),Math.max(e[1],r[1],n[1],i[1])]}unproject(t){let{topLeft:e=!0,targetZ:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const[r,i,o]=t,s=e?i:this.height-i,{pixelUnprojectionMatrix:a}=this;let l;if(Number.isFinite(o))l=bI(a,[r,s,o,1]);else{const t=bI(a,[r,s,-1,1]),e=bI(a,[r,s,1,1]),i=((n||0)/pI+1)*gI,o=Jv(Wv([],t,e)),c=Jv(t),u=Jv(e),d=4*((4*c*u-(o-c-u)**2)/16)/o;l=function(t,e,n,r){var i=e[0],o=e[1],s=e[2];return t[0]=i+r*(n[0]-i),t[1]=o+r*(n[1]-o),t[2]=s+r*(n[2]-s),t}([],t,e,(Math.sqrt(c-d)-Math.sqrt(Math.max(0,i*i-d)))/Math.sqrt(o))}const[c,u,d]=this.unprojectPosition(l);return Number.isFinite(o)?[c,u,d]:Number.isFinite(n)?[c,u,n]:[c,u]}projectPosition(t){const[e,n,r=0]=t,i=e*hI,o=n*hI,s=Math.cos(o),a=(r/pI+1)*gI;return[Math.sin(i)*s*a,-Math.cos(i)*s*a,Math.sin(o)*a]}unprojectPosition(t){const[e,n,r]=t,i=Hv(t),o=Math.asin(r/i);return[Math.atan2(e,-n)*fI,o*fI,(i/gI-1)*pI]}projectFlat(t){return t}unprojectFlat(t){return t}panByPosition(t,e){const n=this.unproject(e);return{longitude:t[0]-n[0]+this.longitude,latitude:t[1]-n[1]+this.latitude}}}function bI(t,e){const n=Ab([],e,t);return bb(n,n,1/n[3]),n}const yI=-1,xI=0,AI=1,_I=new Qv,wI=new Qv;class SI{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[0,0,0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0],n=arguments.length>2?arguments[2]:void 0;ge(this,"center",void 0),ge(this,"halfDiagonal",void 0),ge(this,"minimum",void 0),ge(this,"maximum",void 0),n=n||_I.copy(t).add(e).scale(.5),this.center=new Qv(n),this.halfDiagonal=new Qv(e).subtract(this.center),this.minimum=new Qv(t),this.maximum=new Qv(e)}clone(){return new SI(this.minimum,this.maximum,this.center)}equals(t){return this===t||Boolean(t)&&this.minimum.equals(t.minimum)&&this.maximum.equals(t.maximum)}transform(t){return this.center.transformAsPoint(t),this.halfDiagonal.transform(t),this.minimum.transform(t),this.maximum.transform(t),this}intersectPlane(t){const{halfDiagonal:e}=this,n=wI.from(t.normal),r=e.x*Math.abs(n.x)+e.y*Math.abs(n.y)+e.z*Math.abs(n.z),i=this.center.dot(n)+t.distance;return i-r>0?AI:i+r<0?yI:xI}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){const e=_I.from(t).subtract(this.center),{halfDiagonal:n}=this;let r,i=0;return r=Math.abs(e.x)-n.x,r>0&&(i+=r*r),r=Math.abs(e.y)-n.y,r>0&&(i+=r*r),r=Math.abs(e.z)-n.z,r>0&&(i+=r*r),i}}const CI=new Qv,EI=new Qv;class PI{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[0,0,0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;ge(this,"center",void 0),ge(this,"radius",void 0),this.radius=-0,this.center=new Qv,this.fromCenterRadius(t,e)}fromCenterRadius(t,e){return this.center.from(t),this.radius=e,this}fromCornerPoints(t,e){return e=CI.from(e),this.center=(new Qv).from(t).add(e).scale(.5),this.radius=this.center.distance(e),this}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.radius===t.radius}clone(){return new PI(this.center,this.radius)}union(t){const e=this.center,n=this.radius,r=t.center,i=t.radius,o=CI.copy(r).subtract(e),s=o.magnitude();if(n>=s+i)return this.clone();if(i>=s+n)return t.clone();const a=.5*(n+s+i);return EI.copy(o).scale((-n+a)/s).add(e),this.center.copy(EI),this.radius=a,this}expand(t){const e=CI.from(t).subtract(this.center).magnitude();return e>this.radius&&(this.radius=e),this}transform(t){this.center.transform(t);const e=db(CI,t);return this.radius=Math.max(e[0],Math.max(e[1],e[2]))*this.radius,this}distanceSquaredTo(t){const e=this.distanceTo(t);return e*e}distanceTo(t){const e=CI.from(t).subtract(this.center);return Math.max(0,e.len()-this.radius)}intersectPlane(t){const e=this.center,n=this.radius,r=t.normal.dot(e)+t.distance;return r<-n?yI:r1?e-1:0),r=1;r0?this.copy([t,...n]):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this.check()}identity(){return this.copy(kI)}fromObject(t){return this.check()}fromQuaternion(t){return function(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],s=n+n,a=r+r,l=i+i,c=n*s,u=r*s,d=r*a,h=i*s,f=i*a,p=i*l,g=o*s,m=o*a,v=o*l;t[0]=1-d-p,t[3]=u-v,t[6]=h+m,t[1]=u+v,t[4]=1-c-p,t[7]=f-g,t[2]=h-m,t[5]=f+g,t[8]=1-c-d}(this,t),this.check()}set(t,e,n,r,i,o,s,a,l){return this[0]=t,this[1]=e,this[2]=n,this[3]=r,this[4]=i,this[5]=o,this[6]=s,this[7]=a,this[8]=l,this.check()}setRowMajor(t,e,n,r,i,o,s,a,l){return this[0]=t,this[1]=r,this[2]=s,this[3]=e,this[4]=i,this[5]=a,this[6]=n,this[7]=o,this[8]=l,this.check()}determinant(){return function(t){var e=t[0],n=t[1],r=t[2],i=t[3],o=t[4],s=t[5],a=t[6],l=t[7],c=t[8];return e*(c*o-s*l)+n*(-c*i+s*a)+r*(l*i-o*a)}(this)}transpose(){return function(t,e){if(t===e){var n=e[1],r=e[2],i=e[5];t[1]=e[3],t[2]=e[6],t[3]=n,t[5]=e[7],t[6]=r,t[7]=i}else t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8]}(this,this),this.check()}invert(){return function(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],s=e[4],a=e[5],l=e[6],c=e[7],u=e[8],d=u*s-a*c,h=-u*o+a*l,f=c*o-s*l,p=n*d+r*h+i*f;p&&(p=1/p,t[0]=d*p,t[1]=(-u*r+i*c)*p,t[2]=(a*r-i*s)*p,t[3]=h*p,t[4]=(u*n-i*l)*p,t[5]=(-a*n+i*o)*p,t[6]=f*p,t[7]=(-c*n+r*l)*p,t[8]=(s*n-r*o)*p)}(this,this),this.check()}multiplyLeft(t){return MI(this,t,this),this.check()}multiplyRight(t){return MI(this,this,t),this.check()}rotate(t){return function(t,e,n){var r=e[0],i=e[1],o=e[2],s=e[3],a=e[4],l=e[5],c=e[6],u=e[7],d=e[8],h=Math.sin(n),f=Math.cos(n);t[0]=f*r+h*s,t[1]=f*i+h*a,t[2]=f*o+h*l,t[3]=f*s-h*r,t[4]=f*a-h*i,t[5]=f*l-h*o,t[6]=c,t[7]=u,t[8]=d}(this,this,t),this.check()}scale(t){return Array.isArray(t)?TI(this,this,t):TI(this,this,[t,t]),this.check()}translate(t){return function(t,e,n){var r=e[0],i=e[1],o=e[2],s=e[3],a=e[4],l=e[5],c=e[6],u=e[7],d=e[8],h=n[0],f=n[1];t[0]=r,t[1]=i,t[2]=o,t[3]=s,t[4]=a,t[5]=l,t[6]=h*r+f*s+c,t[7]=h*i+f*a+u,t[8]=h*o+f*l+d}(this,this,t),this.check()}transform(t,e){let n;switch(t.length){case 2:n=function(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[3]*i+n[6],t[1]=n[1]*r+n[4]*i+n[7],t}(e||[-0,-0],t,this);break;case 3:n=Vv(e||[-0,-0,-0],t,this);break;case 4:n=Xv(e||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Rv(n,t.length),n}transformVector(t,e){return this.transform(t,e)}transformVector2(t,e){return this.transform(t,e)}transformVector3(t,e){return this.transform(t,e)}}let II,BI,LI;class DI extends Bv{static get ZERO(){return LI||(LI=new DI(0,0,0,0),Object.freeze(LI)),LI}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;super(-0,-0,-0,-0),Cv(t)&&1===arguments.length?this.copy(t):(wv.debug&&(kv(t),kv(e),kv(n),kv(r)),this[0]=t,this[1]=e,this[2]=n,this[3]=r)}set(t,e,n,r){return this[0]=t,this[1]=e,this[2]=n,this[3]=r,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}fromObject(t){return wv.debug&&(kv(t.x),kv(t.y),kv(t.z),kv(t.w)),this[0]=t.x,this[1]=t.y,this[2]=t.z,this[3]=t.w,this}toObject(t){return t.x=this[0],t.y=this[1],t.z=this[2],t.w=this[3],t}get ELEMENTS(){return 4}get z(){return this[2]}set z(t){this[2]=kv(t)}get w(){return this[3]}set w(t){this[3]=kv(t)}transform(t){return Uv(this,this,t),this.check()}transformByMatrix3(t){return Xv(this,this,t),this.check()}transformByMatrix2(t){return function(t,e,n){const r=e[0],i=e[1];t[0]=n[0]*r+n[2]*i,t[1]=n[1]*r+n[3]*i,t[2]=e[2],t[3]=e[3]}(this,this,t),this.check()}transformByQuaternion(t){return Gv(this,this,t),this.check()}applyMatrix4(t){return t.transform(this,this),this}}function FI(){var t=new Dv(4);return Dv!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function NI(t,e,n){n*=.5;var r=Math.sin(n);return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=Math.cos(n),t}function jI(t,e,n){var r=e[0],i=e[1],o=e[2],s=e[3],a=n[0],l=n[1],c=n[2],u=n[3];return t[0]=r*u+s*a+i*c-o*l,t[1]=i*u+s*l+o*a-r*c,t[2]=o*u+s*c+r*l-i*a,t[3]=s*u-r*a-i*l-o*c,t}function zI(t,e,n,r){var i,o,s,a,l,c=e[0],u=e[1],d=e[2],h=e[3],f=n[0],p=n[1],g=n[2],m=n[3];return(o=c*f+u*p+d*g+h*m)<0&&(o=-o,f=-f,p=-p,g=-g,m=-m),1-o>Lv?(i=Math.acos(o),s=Math.sin(i),a=Math.sin((1-r)*i)/s,l=Math.sin(r*i)/s):(a=1-r,l=r),t[0]=a*c+l*f,t[1]=a*u+l*p,t[2]=a*d+l*g,t[3]=a*h+l*m,t}function UI(t,e){var n,r=e[0]+e[4]+e[8];if(r>0)n=Math.sqrt(r+1),t[3]=.5*n,n=.5/n,t[0]=(e[5]-e[7])*n,t[1]=(e[6]-e[2])*n,t[2]=(e[1]-e[3])*n;else{var i=0;e[4]>e[0]&&(i=1),e[8]>e[3*i+i]&&(i=2);var o=(i+1)%3,s=(i+2)%3;n=Math.sqrt(e[3*i+i]-e[3*o+o]-e[3*s+s]+1),t[i]=.5*n,n=.5/n,t[3]=(e[3*o+s]-e[3*s+o])*n,t[o]=(e[3*o+i]+e[3*i+o])*n,t[s]=(e[3*s+i]+e[3*i+s])*n}return t}var VI=function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t},GI=bb,WI=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},HI=function(t,e,n,r){var i=e[0],o=e[1],s=e[2],a=e[3];return t[0]=i+r*(n[0]-i),t[1]=o+r*(n[1]-o),t[2]=s+r*(n[2]-s),t[3]=a+r*(n[3]-a),t},JI=yb,KI=xb,XI=function(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],s=n*n+r*r+i*i+o*o;return s>0&&(s=1/Math.sqrt(s)),t[0]=n*s,t[1]=r*s,t[2]=i*s,t[3]=o*s,t},qI=function(){var t=Fv(),e=Nv(1,0,0),n=Nv(0,1,0);return function(r,i,o){var s=jv(i,o);return s<-.999999?(zv(t,e,i),Hv(t)<1e-6&&zv(t,n,i),function(t,e){var n=e[0],r=e[1],i=e[2],o=n*n+r*r+i*i;o>0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o}(t,t),NI(r,t,Math.PI),r):s>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(zv(t,i,o),r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=1+s,XI(r,r))}}();(function(){var t=FI(),e=FI()})(),function(){var t=function(){var t=new Dv(9);return Dv!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}()}();const YI=[0,0,0,1];class QI extends Ov{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;super(-0,-0,-0,-0),Array.isArray(t)&&1===arguments.length?this.copy(t):this.set(t,e,n,r)}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}set(t,e,n,r){return this[0]=t,this[1]=e,this[2]=n,this[3]=r,this.check()}fromObject(t){return this[0]=t.x,this[1]=t.y,this[2]=t.z,this[3]=t.w,this.check()}fromMatrix3(t){return UI(this,t),this.check()}fromAxisRotation(t,e){return NI(this,t,e),this.check()}identity(){var t;return(t=this)[0]=0,t[1]=0,t[2]=0,t[3]=1,this.check()}setAxisAngle(t,e){return this.fromAxisRotation(t,e)}get ELEMENTS(){return 4}get x(){return this[0]}set x(t){this[0]=kv(t)}get y(){return this[1]}set y(t){this[1]=kv(t)}get z(){return this[2]}set z(t){this[2]=kv(t)}get w(){return this[3]}set w(t){this[3]=kv(t)}len(){return JI(this)}lengthSquared(){return KI(this)}dot(t){return WI(this,t)}rotationTo(t,e){return qI(this,t,e),this.check()}add(t){return VI(this,this,t),this.check()}calculateW(){return function(t,e){var n=e[0],r=e[1],i=e[2];t[0]=n,t[1]=r,t[2]=i,t[3]=Math.sqrt(Math.abs(1-n*n-r*r-i*i))}(this,this),this.check()}conjugate(){return function(t,e){t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3]}(this,this),this.check()}invert(){return function(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],s=n*n+r*r+i*i+o*o,a=s?1/s:0;t[0]=-n*a,t[1]=-r*a,t[2]=-i*a,t[3]=o*a}(this,this),this.check()}lerp(t,e,n){return void 0===n?this.lerp(this,t,e):(HI(this,t,e,n),this.check())}multiplyRight(t){return jI(this,this,t),this.check()}multiplyLeft(t){return jI(this,t,this),this.check()}normalize(){const t=this.len(),e=t>0?1/t:0;return this[0]=this[0]*e,this[1]=this[1]*e,this[2]=this[2]*e,this[3]=this[3]*e,0===t&&(this[3]=1),this.check()}rotateX(t){return function(t,e,n){n*=.5;var r=e[0],i=e[1],o=e[2],s=e[3],a=Math.sin(n),l=Math.cos(n);t[0]=r*l+s*a,t[1]=i*l+o*a,t[2]=o*l-i*a,t[3]=s*l-r*a}(this,this,t),this.check()}rotateY(t){return function(t,e,n){n*=.5;var r=e[0],i=e[1],o=e[2],s=e[3],a=Math.sin(n),l=Math.cos(n);t[0]=r*l-o*a,t[1]=i*l+s*a,t[2]=o*l+r*a,t[3]=s*l-i*a}(this,this,t),this.check()}rotateZ(t){return function(t,e,n){n*=.5;var r=e[0],i=e[1],o=e[2],s=e[3],a=Math.sin(n),l=Math.cos(n);t[0]=r*l+i*a,t[1]=i*l-r*a,t[2]=o*l+s*a,t[3]=s*l-o*a}(this,this,t),this.check()}scale(t){return GI(this,this,t),this.check()}slerp(t,e,n){let r,i,o;switch(arguments.length){case 1:({start:r=YI,target:i,ratio:o}=t);break;case 2:r=this,i=t,o=e;break;default:r=t,i=e,o=n}return zI(this,r,i,o),this.check()}transformVector4(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new DI;return function(t,e,n){var r=e[0],i=e[1],o=e[2],s=n[0],a=n[1],l=n[2],c=n[3],u=c*r+a*o-l*i,d=c*i+l*r-s*o,h=c*o+s*i-a*r,f=-s*r-a*i-l*o;t[0]=u*c+f*-s+d*-l-h*-a,t[1]=d*c+f*-a+h*-s-u*-l,t[2]=h*c+f*-l+u*-a-d*-s,t[3]=e[3]}(e,t,this),Rv(e,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(t,e){return this.setAxisAngle(t,e)}premultiply(t){return this.multiplyLeft(t)}multiply(t){return this.multiplyRight(t)}}const ZI=new Qv,$I=new Qv,tB=new Qv,eB=new Qv,nB=new Qv,rB=new Qv,iB=new Qv,oB=0,sB=1,aB=2,lB=3,cB=4,uB=5,dB=6,hB=7,fB=8;class pB{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[0,0,0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0,0,0,0,0,0,0];ge(this,"center",void 0),ge(this,"halfAxes",void 0),this.center=(new Qv).from(t),this.halfAxes=new RI(e)}get halfSize(){const t=this.halfAxes.getColumn(0),e=this.halfAxes.getColumn(1),n=this.halfAxes.getColumn(2);return[new Qv(t).len(),new Qv(e).len(),new Qv(n).len()]}get quaternion(){const t=this.halfAxes.getColumn(0),e=this.halfAxes.getColumn(1),n=this.halfAxes.getColumn(2),r=new Qv(t).normalize(),i=new Qv(e).normalize(),o=new Qv(n).normalize();return(new QI).fromMatrix3(new RI([...r,...i,...o]))}fromCenterHalfSizeQuaternion(t,e,n){const r=new QI(n),i=(new RI).fromQuaternion(r);return i[0]=i[0]*e[0],i[1]=i[1]*e[0],i[2]=i[2]*e[0],i[3]=i[3]*e[1],i[4]=i[4]*e[1],i[5]=i[5]*e[1],i[6]=i[6]*e[2],i[7]=i[7]*e[2],i[8]=i[8]*e[2],this.center=(new Qv).from(t),this.halfAxes=i,this}clone(){return new pB(this.center,this.halfAxes)}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.halfAxes.equals(t.halfAxes)}getBoundingSphere(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new PI;const e=this.halfAxes,n=e.getColumn(0,tB),r=e.getColumn(1,eB),i=e.getColumn(2,nB),o=ZI.copy(n).add(r).add(i);return t.center.copy(this.center),t.radius=o.magnitude(),t}intersectPlane(t){const e=this.center,n=t.normal,r=this.halfAxes,i=n.x,o=n.y,s=n.z,a=Math.abs(i*r[oB]+o*r[sB]+s*r[aB])+Math.abs(i*r[lB]+o*r[cB]+s*r[uB])+Math.abs(i*r[dB]+o*r[hB]+s*r[fB]),l=n.dot(e)+t.distance;return l<=-a?yI:l>=a?AI:xI}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){const e=$I.from(t).subtract(this.center),n=this.halfAxes,r=n.getColumn(0,tB),i=n.getColumn(1,eB),o=n.getColumn(2,nB),s=r.magnitude(),a=i.magnitude(),l=o.magnitude();r.normalize(),i.normalize(),o.normalize();let c,u=0;return c=Math.abs(e.dot(r))-s,c>0&&(u+=c*c),c=Math.abs(e.dot(i))-a,c>0&&(u+=c*c),c=Math.abs(e.dot(o))-l,c>0&&(u+=c*c),u}computePlaneDistances(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[-0,-0],r=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;const o=this.center,s=this.halfAxes,a=s.getColumn(0,tB),l=s.getColumn(1,eB),c=s.getColumn(2,nB),u=rB.copy(a).add(l).add(c).add(o),d=iB.copy(u).subtract(t);let h=e.dot(d);return r=Math.min(h,r),i=Math.max(h,i),u.copy(o).add(a).add(l).subtract(c),d.copy(u).subtract(t),h=e.dot(d),r=Math.min(h,r),i=Math.max(h,i),u.copy(o).add(a).subtract(l).add(c),d.copy(u).subtract(t),h=e.dot(d),r=Math.min(h,r),i=Math.max(h,i),u.copy(o).add(a).subtract(l).subtract(c),d.copy(u).subtract(t),h=e.dot(d),r=Math.min(h,r),i=Math.max(h,i),o.copy(u).subtract(a).add(l).add(c),d.copy(u).subtract(t),h=e.dot(d),r=Math.min(h,r),i=Math.max(h,i),o.copy(u).subtract(a).add(l).subtract(c),d.copy(u).subtract(t),h=e.dot(d),r=Math.min(h,r),i=Math.max(h,i),o.copy(u).subtract(a).subtract(l).add(c),d.copy(u).subtract(t),h=e.dot(d),r=Math.min(h,r),i=Math.max(h,i),o.copy(u).subtract(a).subtract(l).subtract(c),d.copy(u).subtract(t),h=e.dot(d),r=Math.min(h,r),i=Math.max(h,i),n[0]=r,n[1]=i,n}transform(t){this.center.transformAsPoint(t);const e=this.halfAxes.getColumn(0,tB);e.transformAsPoint(t);const n=this.halfAxes.getColumn(1,eB);n.transformAsPoint(t);const r=this.halfAxes.getColumn(2,nB);return r.transformAsPoint(t),this.halfAxes=new RI([...e,...n,...r]),this}getTransform(){throw new Error("not implemented")}}const gB=new Qv,mB=new Qv;class vB{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[0,0,1],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;ge(this,"normal",void 0),ge(this,"distance",void 0),this.normal=new Qv,this.distance=-0,this.fromNormalDistance(t,e)}fromNormalDistance(t,e){return Iv(Number.isFinite(e)),this.normal.from(t).normalize(),this.distance=e,this}fromPointNormal(t,e){t=gB.from(t),this.normal.from(e).normalize();const n=-this.normal.dot(t);return this.distance=n,this}fromCoefficients(t,e,n,r){return this.normal.set(t,e,n),Iv(Mv(this.normal.len(),1)),this.distance=r,this}clone(){return new vB(this.normal,this.distance)}equals(t){return Mv(this.distance,t.distance)&&Mv(this.normal,t.normal)}getPointDistance(t){return this.normal.dot(t)+this.distance}transform(t){const e=mB.copy(this.normal).transformAsVector(t).normalize(),n=this.normal.scale(-this.distance).transform(t);return this.fromPointNormal(n,e)}projectPointOntoPlane(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0];t=gB.from(t);const n=this.getPointDistance(t),r=mB.copy(this.normal).scale(n);return t.subtract(r).to(e)}}const bB=[new Qv([1,0,0]),new Qv([0,1,0]),new Qv([0,0,1])],yB=new Qv,xB=new Qv;new vB(new Qv(1,0,0),0);class AB{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];ge(this,"planes",void 0),this.planes=t}fromBoundingSphere(t){this.planes.length=2*bB.length;const e=t.center,n=t.radius;let r=0;for(const i of bB){let t=this.planes[r],o=this.planes[r+1];t||(t=this.planes[r]=new vB),o||(o=this.planes[r+1]=new vB);const s=yB.copy(i).scale(-n).add(e);i.dot(s);t.fromPointNormal(s,i);const a=yB.copy(i).scale(n).add(e),l=xB.copy(i).negate();l.dot(a);o.fromPointNormal(a,l),r+=2}return this}computeVisibility(t){let e=AI;for(const n of this.planes){switch(t.intersectPlane(n)){case yI:return yI;case xI:e=xI}}return e}computeVisibilityWithPlaneMask(t,e){if(Iv(Number.isFinite(e),"parentPlaneMask is required."),e===AB.MASK_OUTSIDE||e===AB.MASK_INSIDE)return e;let n=AB.MASK_INSIDE;const r=this.planes;for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:{};const n=_B.EPSILON20;let r=0,i=0;const o=SB,s=CB;o.identity(),s.copy(t);const a=n*function(t){let e=0;for(let n=0;n<9;++n){const r=t[n];e+=r*r}return Math.sqrt(e)}(s);for(;i<10&&kB(s)>a;)RB(s,EB),PB.copy(EB).transpose(),s.multiplyRight(EB),s.multiplyLeft(PB),o.multiplyRight(EB),++r>2&&(++i,r=0);return e.unitary=o.toTarget(e.unitary),e.diagonal=s.toTarget(e.diagonal),e}const TB=[1,0,0],OB=[2,2,1];function kB(t){let e=0;for(let n=0;n<3;++n){const r=t[wB.getElementIndex(OB[n],TB[n])];e+=2*r*r}return Math.sqrt(e)}function RB(t,e){const n=_B.EPSILON15;let r=0,i=1;for(let c=0;c<3;++c){const e=Math.abs(t[wB.getElementIndex(OB[c],TB[c])]);e>r&&(i=c,r=e)}const o=TB[i],s=OB[i];let a=1,l=0;if(Math.abs(t[wB.getElementIndex(s,o)])>n){const e=(t[wB.getElementIndex(s,s)]-t[wB.getElementIndex(o,o)])/2/t[wB.getElementIndex(s,o)];let n;n=e<0?-1/(-e+Math.sqrt(1+e*e)):1/(e+Math.sqrt(1+e*e)),a=1/Math.sqrt(1+n*n),l=n*a}return RI.IDENTITY.to(e),e[wB.getElementIndex(o,o)]=e[wB.getElementIndex(s,s)]=a,e[wB.getElementIndex(s,o)]=l,e[wB.getElementIndex(o,s)]=-l,e}const IB=new Qv,BB=new Qv,LB=new Qv,DB=new Qv,FB=new Qv,NB=new RI,jB={diagonal:new RI,unitary:new RI};const zB=512,UB=3,VB=[[.5,.5],[0,0],[0,1],[1,0],[1,1]],GB=VB.concat([[0,.5],[.5,0],[1,.5],[.5,1]]),WB=GB.concat([[.25,.5],[.75,.5]]);class HB{constructor(t,e,n){ge(this,"x",void 0),ge(this,"y",void 0),ge(this,"z",void 0),ge(this,"childVisible",void 0),ge(this,"selected",void 0),ge(this,"_children",void 0),this.x=t,this.y=e,this.z=n}get children(){if(!this._children){const t=2*this.x,e=2*this.y,n=this.z+1;this._children=[new HB(t,e,n),new HB(t,e+1,n),new HB(t+1,e,n),new HB(t+1,e+1,n)]}return this._children}update(t){const{viewport:e,cullingVolume:n,elevationBounds:r,minZ:i,maxZ:o,bounds:s,offset:a,project:l}=t,c=this.getBoundingVolume(r,a,l);if(s&&!this.insideBounds(s))return!1;if(n.computeVisibility(c)<0)return!1;if(!this.childVisible){let{z:t}=this;if(t=i){const n=c.distanceTo(e.cameraPosition)*e.scale/e.height;t+=Math.floor(Math.log2(n))}if(t>=o)return this.selected=!0,!0}this.selected=!1,this.childVisible=!0;for(const u of this.children)u.update(t);return!0}getSelected(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(this.selected&&t.push(this),this._children)for(const e of this._children)e.getSelected(t);return t}insideBounds(t){let[e,n,r,i]=t;const o=Math.pow(2,this.z),s=zB/o;return this.x*se&&(this.y+1)*s>n}getBoundingVolume(t,e,n){if(n){const e=this.z<1?WB:this.z<2?GB:VB,r=[];for(const i of e){const e=tL(this.x+i[0],this.y+i[1],this.z);e[2]=t[0],r.push(n(e)),t[0]!==t[1]&&(e[2]=t[1],r.push(n(e)))}return function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new pB;if(!t||0===t.length)return e.halfAxes=new RI([0,0,0,0,0,0,0,0,0]),e.center=new Qv,e;const n=t.length,r=new Qv(0,0,0);for(const C of t)r.add(C);const i=1/n;r.multiplyByScalar(i);let o=0,s=0,a=0,l=0,c=0,u=0;for(const C of t){const t=IB.copy(C).subtract(r);o+=t.x*t.x,s+=t.x*t.y,a+=t.x*t.z,l+=t.y*t.y,c+=t.y*t.z,u+=t.z*t.z}o*=i,s*=i,a*=i,l*=i,c*=i,u*=i;const d=NB;d[0]=o,d[1]=s,d[2]=a,d[3]=s,d[4]=l,d[5]=c,d[6]=a,d[7]=c,d[8]=u;const{unitary:h}=MB(d,jB),f=e.halfAxes.copy(h);let p=f.getColumn(0,LB),g=f.getColumn(1,DB),m=f.getColumn(2,FB),v=-Number.MAX_VALUE,b=-Number.MAX_VALUE,y=-Number.MAX_VALUE,x=Number.MAX_VALUE,A=Number.MAX_VALUE,_=Number.MAX_VALUE;for(const C of t)IB.copy(C),v=Math.max(IB.dot(p),v),b=Math.max(IB.dot(g),b),y=Math.max(IB.dot(m),y),x=Math.min(IB.dot(p),x),A=Math.min(IB.dot(g),A),_=Math.min(IB.dot(m),_);p=p.multiplyByScalar(.5*(x+v)),g=g.multiplyByScalar(.5*(A+b)),m=m.multiplyByScalar(.5*(_+y)),e.center.copy(p).add(g).add(m);const w=BB.set(v-x,b-A,y-_).multiplyByScalar(.5),S=new RI([w[0],0,0,0,w[1],0,0,0,w[2]]);return e.halfAxes.multiplyRight(S),e}(r)}const r=Math.pow(2,this.z),i=zB/r,o=this.x*i+e*zB,s=zB-(this.y+1)*i;return new SI([o,s,t[0]],[o+i,s+i,t[1]])}}const JB=512,KB=[-1/0,-1/0,1/0,1/0],XB={type:"object",value:null,validate:(t,e)=>e.optional&&null===t||"string"===typeof t||Array.isArray(t)&&t.every((t=>"string"===typeof t)),equal:(t,e)=>{if(t===e)return!0;if(!Array.isArray(t)||!Array.isArray(e))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;rt[0]))),Math.min(...n.map((t=>t[1]))),Math.max(...n.map((t=>t[0]))),Math.max(...n.map((t=>t[1])))];return r}function YB(t,e){if(!t||!t.length)return null;const{index:n,id:r}=e;if(Array.isArray(t)){const e=function(t){return Math.abs(t.split("").reduce(((t,e)=>(t<<5)-t+e.charCodeAt(0)|0),0))}(r)%t.length;t=t[e]}let i=t;for(const o of Object.keys(n)){const t=new RegExp("{".concat(o,"}"),"g");i=i.replace(t,String(n[o]))}return Number.isInteger(n.y)&&Number.isInteger(n.z)&&(i=i.replace(/\{-y\}/g,String(Math.pow(2,n.z)-n.y-1))),i}function QB(t){let{viewport:e,z:n=0,cullRect:r}=t;return(e.subViewports||[e]).map((t=>ZB(t,n||0,r)))}function ZB(t,e,n){if(!Array.isArray(e)){const r=n.x-t.x,i=n.y-t.y,{width:o,height:s}=n,a={targetZ:e},l=t.unproject([r,i],a),c=t.unproject([r+o,i],a),u=t.unproject([r,i+s],a),d=t.unproject([r+o,i+s],a);return[Math.min(l[0],c[0],u[0],d[0]),Math.min(l[1],c[1],u[1],d[1]),Math.max(l[0],c[0],u[0],d[0]),Math.max(l[1],c[1],u[1],d[1])]}const r=ZB(t,e[0],n),i=ZB(t,e[1],n);return[Math.min(r[0],i[0]),Math.min(r[1],i[1]),Math.max(r[2],i[2]),Math.max(r[3],i[3])]}function $B(t,e){return Math.pow(2,t)*JB/e}function tL(t,e,n){const r=$B(n,JB),i=t/r*360-180,o=Math.PI-2*Math.PI*e/r;return[i,180/Math.PI*Math.atan(.5*(Math.exp(o)-Math.exp(-o)))]}function eL(t,e,n,r){const i=$B(n,r);return[t/i*JB,e/i*JB]}function nL(t,e,n,r){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:JB;if(t.isGeospatial){const[t,i]=tL(e,n,r),[o,s]=tL(e+1,n+1,r);return{west:t,north:i,east:o,south:s}}const[o,s]=eL(e,n,r,i),[a,l]=eL(e+1,n+1,r,i);return{left:o,top:s,right:a,bottom:l}}function rL(t,e,n,r,i){const o=function(t,e,n){let r;if(e&&2===e.length){const[n,i]=e,o=t.getBounds({z:n}),s=t.getBounds({z:i});r=[Math.min(o[0],s[0]),Math.min(o[1],s[1]),Math.max(o[2],s[2]),Math.max(o[3],s[3])]}else r=t.getBounds();return t.isGeospatial?[Math.max(r[0],n[0]),Math.max(r[1],n[1]),Math.min(r[2],n[2]),Math.min(r[3],n[3])]:[Math.max(Math.min(r[0],n[2]),n[0]),Math.max(Math.min(r[1],n[3]),n[1]),Math.min(Math.max(r[2],n[0]),n[2]),Math.min(Math.max(r[3],n[1]),n[3])]}(t,null,r),s=$B(e,n),[a,l,c,u]=function(t,e,n){if(n){const r=qB(t,n).map((t=>t*e/JB));return r}return t.map((t=>t*e/JB))}(o,s,i),d=[];for(let h=Math.floor(a);hn&&(u=n);let d=o;return a&&l&&o&&!e.isGeospatial&&(d=qB(o,a)),e.isGeospatial?function(t,e,n,r){const i=t instanceof vI&&t.resolution?t.projectPosition:null,o=Object.values(t.getFrustumPlanes()).map((t=>{let{normal:e,distance:n}=t;return new vB(e.clone().negate(),n)})),s=new AB(o),a=t.distanceScales.unitsPerMeter[2],l=n&&n[0]*a||0,c=n&&n[1]*a||0,u=t instanceof RS&&t.pitch<=60?e:0;if(r){const[t,e,n,i]=r,o=Xb([t,i]),s=Xb([n,e]);r=[o[0],zB-o[1],s[0],zB-s[1]]}const d=new HB(0,0,0),h={viewport:t,project:i,cullingVolume:s,elevationBounds:[l,c],minZ:u,maxZ:e,bounds:r,offset:0};if(d.update(h),t instanceof RS&&t.subViewports&&t.subViewports.length>1){for(h.offset=-1;d.update(h)&&!(--h.offset<-UB););for(h.offset=1;d.update(h)&&!(++h.offset>UB););}return d.getSelected()}(e,u,i,o):rL(e,u,s,d||KB,l)}function oL(t,e){if(t===e)return!0;if(Array.isArray(t)){const n=t.length;if(!e||e.length!==n)return!1;for(let r=0;rt.zoom-e.zoom));for(const n of e)if(n.isVisible=Boolean(n.state&sL),n.children&&(n.isVisible||1&n.state))for(const t of n.children)t.state=1;else n.isSelected&&fL(n)},[aL]:()=>{}},dL={extent:null,tileSize:512,maxZoom:null,minZoom:null,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:"best-available",zRange:null,maxRequests:6,zoomOffset:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{}};function hL(t){let e=t;for(;e;){if(e.isLoaded||e.content)return e.state|=sL,!0;e=e.parent}return!1}function fL(t){for(const e of t.children)e.isLoaded||e.content?e.state|=sL:fL(e)}const pL={TilesetClass:class{constructor(t){ge(this,"opts",void 0),ge(this,"_requestScheduler",void 0),ge(this,"_cache",void 0),ge(this,"_dirty",void 0),ge(this,"_tiles",void 0),ge(this,"_cacheByteSize",void 0),ge(this,"_viewport",void 0),ge(this,"_zRange",void 0),ge(this,"_selectedTiles",void 0),ge(this,"_frameNumber",void 0),ge(this,"_modelMatrix",void 0),ge(this,"_modelMatrixInverse",void 0),ge(this,"_maxZoom",void 0),ge(this,"_minZoom",void 0),ge(this,"onTileLoad",void 0),ge(this,"_getCullBounds",function(t){let e,n={};return r=>{for(const i in r)if(!oL(r[i],n[i])){e=t(r),n=r;break}return e}}(QB)),this.opts={...dL,...t},this.onTileLoad=t=>{var e,n;null===(e=(n=this.opts).onTileLoad)||void 0===e||e.call(n,t),this.opts.maxCacheByteSize&&(this._cacheByteSize+=t.byteLength,this._resizeCache())},this._requestScheduler=new uI({maxRequests:t.maxRequests,throttleRequests:Boolean(t.maxRequests&&t.maxRequests>0)}),this._cache=new Map,this._tiles=[],this._dirty=!1,this._cacheByteSize=0,this._viewport=null,this._zRange=null,this._selectedTiles=null,this._frameNumber=0,this._modelMatrix=new Mb,this._modelMatrixInverse=new Mb,this.setOptions(t)}get tiles(){return this._tiles}get selectedTiles(){return this._selectedTiles}get isLoaded(){return null!==this._selectedTiles&&this._selectedTiles.every((t=>t.isLoaded))}get needsReload(){return null!==this._selectedTiles&&this._selectedTiles.some((t=>t.needsReload))}setOptions(t){Object.assign(this.opts,t),Number.isFinite(t.maxZoom)&&(this._maxZoom=Math.floor(t.maxZoom)),Number.isFinite(t.minZoom)&&(this._minZoom=Math.ceil(t.minZoom))}finalize(){for(const t of this._cache.values())t.isLoading&&t.abort();this._cache.clear(),this._tiles=[],this._selectedTiles=null}reloadAll(){for(const t of this._cache.keys()){const e=this._cache.get(t);this._selectedTiles&&this._selectedTiles.includes(e)?e.setNeedsReload():this._cache.delete(t)}}update(t){let{zRange:e,modelMatrix:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{zRange:null,modelMatrix:null};const r=n?new Mb(n):new Mb,i=!r.equals(this._modelMatrix);if(this._viewport&&t.equals(this._viewport)&&Mv(this._zRange,e)&&!i)this.needsReload&&(this._selectedTiles=this._selectedTiles.map((t=>this._getTile(t.index,!0))));else{i&&(this._modelMatrixInverse=r.clone().invert(),this._modelMatrix=r),this._viewport=t,this._zRange=e;const n=this.getTileIndices({viewport:t,maxZoom:this._maxZoom,minZoom:this._minZoom,zRange:e,modelMatrix:this._modelMatrix,modelMatrixInverse:this._modelMatrixInverse});this._selectedTiles=n.map((t=>this._getTile(t,!0))),this._dirty&&this._rebuildTree()}const o=this.updateTileStates();return this._pruneRequests(),this._dirty&&this._resizeCache(),o&&this._frameNumber++,this._frameNumber}isTileVisible(t,e){if(!t.isVisible)return!1;if(e&&this._viewport){const n=this._getCullBounds({viewport:this._viewport,z:this._zRange,cullRect:e}),{bbox:r}=t;for(const[t,e,i,o]of n){let n;if("west"in r)n=r.westt&&r.southe;else{const s=Math.min(r.top,r.bottom),a=Math.max(r.top,r.bottom);n=r.leftt&&se}if(n)return!0}return!1}return!0}getTileIndices(t){let{viewport:e,maxZoom:n,minZoom:r,zRange:i,modelMatrix:o,modelMatrixInverse:s}=t;const{tileSize:a,extent:l,zoomOffset:c}=this.opts;return iL({viewport:e,maxZoom:n,minZoom:r,zRange:i,tileSize:a,extent:l,modelMatrix:o,modelMatrixInverse:s,zoomOffset:c})}getTileId(t){return"".concat(t.x,"-").concat(t.y,"-").concat(t.z)}getTileZoom(t){return t.z}getTileMetadata(t){const{tileSize:e}=this.opts;return{bbox:nL(this._viewport,t.x,t.y,t.z,e)}}getParentIndex(t){return{x:Math.floor(t.x/2),y:Math.floor(t.y/2),z:t.z-1}}updateTileStates(){const t=this.opts.refinementStrategy||cL,e=new Array(this._cache.size);let n=0;for(const r of this._cache.values())e[n++]=r.isVisible,r.isSelected=!1,r.isVisible=!1;for(const r of this._selectedTiles)r.isSelected=!0,r.isVisible=!0;("function"===typeof t?t:uL[t])(Array.from(this._cache.values())),n=0;for(const r of this._cache.values())if(e[n++]!==r.isVisible)return!0;return!1}_pruneRequests(){const{maxRequests:t=0}=this.opts,e=[];let n=0;for(const r of this._cache.values())r.isLoading&&(n++,r.isSelected||r.isVisible||e.push(r));for(;t>0&&n>t&&e.length>0;){e.shift().abort(),n--}}_rebuildTree(){const{_cache:t}=this;for(const e of t.values())e.parent=null,e.children&&(e.children.length=0);for(const e of t.values()){const t=this._getNearestAncestor(e);e.parent=t,null!==t&&void 0!==t&&t.children&&t.children.push(e)}}_resizeCache(){const{_cache:t,opts:e}=this,n=e.maxCacheSize||(e.maxCacheByteSize?1/0:5*this.selectedTiles.length),r=e.maxCacheByteSize||1/0;if(t.size>n||this._cacheByteSize>r){for(const[s,a]of t){var i,o;if(!a.isVisible&&!a.isSelected)this._cacheByteSize-=e.maxCacheByteSize?a.byteLength:0,t.delete(s),null===(i=(o=this.opts).onTileUnload)||void 0===i||i.call(o,a);if(t.size<=n&&this._cacheByteSize<=r)break}this._rebuildTree(),this._dirty=!0}this._dirty&&(this._tiles=Array.from(this._cache.values()).sort(((t,e)=>t.zoom-e.zoom)),this._dirty=!1)}_getTile(t,e){const n=this.getTileId(t);let r=this._cache.get(n),i=!1;return!r&&e?(r=new dI(t),Object.assign(r,this.getTileMetadata(r.index)),Object.assign(r,{id:n,zoom:this.getTileZoom(r.index)}),i=!0,this._cache.set(n,r),this._dirty=!0):r&&r.needsReload&&(i=!0),r&&i&&r.loadData({getData:this.opts.getTileData,requestScheduler:this._requestScheduler,onLoad:this.onTileLoad,onError:this.opts.onTileError}),r}_getNearestAncestor(t){const{_minZoom:e=0}=this;let n=t.index;for(;this.getTileZoom(n)>e;){n=this.getParentIndex(n);const t=this._getTile(n);if(t)return t}return null}},data:{type:"data",value:[]},dataComparator:XB.equal,renderSubLayers:{type:"function",value:t=>new rI(t)},getTileData:{type:"function",optional:!0,value:null},onViewportLoad:{type:"function",optional:!0,value:null},onTileLoad:{type:"function",value:t=>{}},onTileUnload:{type:"function",value:t=>{}},onTileError:{type:"function",value:t=>console.error(t)},extent:{type:"array",optional:!0,value:null,compare:!0},tileSize:512,maxZoom:null,minZoom:0,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:cL,zRange:null,maxRequests:6,zoomOffset:0};class gL extends Fk{constructor(){super(...arguments),ge(this,"state",void 0)}initializeState(){this.state={tileset:null,isLoaded:!1}}finalizeState(){var t,e;null===(t=this.state)||void 0===t||null===(e=t.tileset)||void 0===e||e.finalize()}get isLoaded(){var t,e,n;return Boolean(null===(t=this.state)||void 0===t||null===(e=t.tileset)||void 0===e||null===(n=e.selectedTiles)||void 0===n?void 0:n.every((t=>t.isLoaded&&t.layers&&t.layers.every((t=>t.isLoaded)))))}shouldUpdateState(t){let{changeFlags:e}=t;return e.somethingChanged}updateState(t){let{changeFlags:e}=t,{tileset:n}=this.state;const r=e.propsOrDataChanged||e.updateTriggersChanged,i=e.dataChanged||e.updateTriggersChanged&&(e.updateTriggersChanged.all||e.updateTriggersChanged.getTileData);n?r&&(n.setOptions(this._getTilesetOptions()),i?n.reloadAll():n.tiles.forEach((t=>{t.layers=null}))):(n=new this.props.TilesetClass(this._getTilesetOptions()),this.setState({tileset:n})),this._updateTileset()}_getTilesetOptions(){const{tileSize:t,maxCacheSize:e,maxCacheByteSize:n,refinementStrategy:r,extent:i,maxZoom:o,minZoom:s,maxRequests:a,zoomOffset:l}=this.props;return{maxCacheSize:e,maxCacheByteSize:n,maxZoom:o,minZoom:s,tileSize:t,refinementStrategy:r,extent:i,maxRequests:a,zoomOffset:l,getTileData:this.getTileData.bind(this),onTileLoad:this._onTileLoad.bind(this),onTileError:this._onTileError.bind(this),onTileUnload:this._onTileUnload.bind(this)}}_updateTileset(){const t=this.state.tileset,{zRange:e,modelMatrix:n}=this.props,r=t.update(this.context.viewport,{zRange:e,modelMatrix:n}),{isLoaded:i}=t,o=this.state.isLoaded!==i,s=this.state.frameNumber!==r;i&&(o||s)&&this._onViewportLoad(),s&&this.setState({frameNumber:r}),this.state.isLoaded=i}_onViewportLoad(){const{tileset:t}=this.state,{onViewportLoad:e}=this.props;e&&e(t.selectedTiles)}_onTileLoad(t){this.props.onTileLoad(t),t.layers=null,this.setNeedsUpdate()}_onTileError(t,e){this.props.onTileError(t),e.layers=null,this.setNeedsUpdate()}_onTileUnload(t){this.props.onTileUnload(t)}getTileData(t){const{data:e,getTileData:n,fetch:r}=this.props,{signal:i}=t;return t.url="string"===typeof e||Array.isArray(e)?YB(e,t):null,n?n(t):r&&t.url?r(t.url,{propName:"data",layer:this,signal:i}):null}renderSubLayers(t){return this.props.renderSubLayers(t)}getSubLayerPropsByTile(t){return null}getPickingInfo(t){let{info:e,sourceLayer:n}=t;const r=n.props.tile;return e.picked&&(e.tile=r),e.sourceTile=r,e}_updateAutoHighlight(t){const e=t.sourceTile;if(e&&e.layers)for(const n of e.layers)n.updateAutoHighlight(t)}renderLayers(){return this.state.tileset.tiles.map((t=>{const e=this.getSubLayerPropsByTile(t);if(t.isLoaded||t.content)if(t.layers)e&&t.layers[0]&&Object.keys(e).some((n=>t.layers[0].props[n]!==e[n]))&&(t.layers=t.layers.map((t=>t.clone(e))));else{const n=this.renderSubLayers({...this.props,...this.getSubLayerProps({id:t.id,updateTriggers:this.props.updateTriggers}),data:t.content,_offset:0,tile:t});t.layers=Dg(n,Boolean).map((n=>n.clone({tile:t,...e})))}else;return t.layers}))}filterSubLayer(t){let{layer:e,cullRect:n}=t;const{tile:r}=e.props;return this.state.tileset.isTileVisible(r,n)}}ge(gL,"defaultProps",pL),ge(gL,"layerName","TileLayer");const mL=new Uint16Array([0,2,1,0,3,2]),vL=new Float32Array([0,1,0,0,1,0,1,1]);function bL(t,e){if(!e)return function(t){const e=new Float64Array(12);for(let n=0;n0&&n>0&&(a[d++]=u-o,a[d++]=u-o-1,a[d++]=u-1,a[d++]=u-o,a[d++]=u-1,a[d++]=u),u++}}return{vertexCount:s,positions:c,indices:a,texCoords:l}}function yL(t,e,n){return Pv(Pv(t[0],t[1],n),Pv(t[3],t[2],n),e)}const xL="\n#define SHADER_NAME bitmap-layer-fragment-shader\n\n#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform sampler2D bitmapTexture;\n\nvarying vec2 vTexCoord;\nvarying vec2 vTexPos;\n\nuniform float desaturate;\nuniform vec4 transparentColor;\nuniform vec3 tintColor;\nuniform float opacity;\n\nuniform float coordinateConversion;\nuniform vec4 bounds;\n\n/* projection utils */\nconst float TILE_SIZE = 512.0;\nconst float PI = 3.1415926536;\nconst float WORLD_SCALE = TILE_SIZE / PI / 2.0;\n\n// from degrees to Web Mercator\nvec2 lnglat_to_mercator(vec2 lnglat) {\n float x = lnglat.x;\n float y = clamp(lnglat.y, -89.9, 89.9);\n return vec2(\n radians(x) + PI,\n PI + log(tan(PI * 0.25 + radians(y) * 0.5))\n ) * WORLD_SCALE;\n}\n\n// from Web Mercator to degrees\nvec2 mercator_to_lnglat(vec2 xy) {\n xy /= WORLD_SCALE;\n return degrees(vec2(\n xy.x - PI,\n atan(exp(xy.y - PI)) * 2.0 - PI * 0.5\n ));\n}\n/* End projection utils */\n\n// apply desaturation\nvec3 color_desaturate(vec3 color) {\n float luminance = (color.r + color.g + color.b) * 0.333333333;\n return mix(color, vec3(luminance), desaturate);\n}\n\n// apply tint\nvec3 color_tint(vec3 color) {\n return color * tintColor;\n}\n\n// blend with background color\nvec4 apply_opacity(vec3 color, float alpha) {\n if (transparentColor.a == 0.0) {\n return vec4(color, alpha);\n }\n float blendedAlpha = alpha + transparentColor.a * (1.0 - alpha);\n float highLightRatio = alpha / blendedAlpha;\n vec3 blendedRGB = mix(transparentColor.rgb, color, highLightRatio);\n return vec4(blendedRGB, blendedAlpha);\n}\n\nvec2 getUV(vec2 pos) {\n return vec2(\n (pos.x - bounds[0]) / (bounds[2] - bounds[0]),\n (pos.y - bounds[3]) / (bounds[1] - bounds[3])\n );\n}\n\n".concat("\nvec3 packUVsIntoRGB(vec2 uv) {\n // Extract the top 8 bits. We want values to be truncated down so we can add a fraction\n vec2 uv8bit = floor(uv * 256.);\n\n // Calculate the normalized remainders of u and v parts that do not fit into 8 bits\n // Scale and clamp to 0-1 range\n vec2 uvFraction = fract(uv * 256.);\n vec2 uvFraction4bit = floor(uvFraction * 16.);\n\n // Remainder can be encoded in blue channel, encode as 4 bits for pixel coordinates\n float fractions = uvFraction4bit.x + uvFraction4bit.y * 16.;\n\n return vec3(uv8bit, fractions) / 255.;\n}\n","\n\nvoid main(void) {\n vec2 uv = vTexCoord;\n if (coordinateConversion < -0.5) {\n vec2 lnglat = mercator_to_lnglat(vTexPos);\n uv = getUV(lnglat);\n } else if (coordinateConversion > 0.5) {\n vec2 commonPos = lnglat_to_mercator(vTexPos);\n uv = getUV(commonPos);\n }\n vec4 bitmapColor = texture2D(bitmapTexture, uv);\n\n gl_FragColor = apply_opacity(color_tint(color_desaturate(bitmapColor.rgb)), bitmapColor.a * opacity);\n\n geometry.uv = uv;\n DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n\n if (picking_uActive && !picking_uAttribute) {\n // Since instance information is not used, we can use picking color for pixel index\n gl_FragColor.rgb = packUVsIntoRGB(uv);\n }\n}\n"),AL={image:{type:"image",value:null,async:!0},bounds:{type:"array",value:[1,0,0,1],compare:!0},_imageCoordinateSystem:dy.DEFAULT,desaturate:{type:"number",min:0,max:1,value:0},transparentColor:{type:"color",value:[0,0,0,0]},tintColor:{type:"color",value:[255,255,255]},textureParameters:{type:"object",ignore:!0}};class _L extends QM{constructor(){super(...arguments),ge(this,"state",void 0)}getShaders(){return super.getShaders({vs:"\n#define SHADER_NAME bitmap-layer-vertex-shader\n\nattribute vec2 texCoords;\nattribute vec3 positions;\nattribute vec3 positions64Low;\n\nvarying vec2 vTexCoord;\nvarying vec2 vTexPos;\n\nuniform float coordinateConversion;\n\nconst vec3 pickingColor = vec3(1.0, 0.0, 0.0);\n\nvoid main(void) {\n geometry.worldPosition = positions;\n geometry.uv = texCoords;\n geometry.pickingColor = pickingColor;\n\n gl_Position = project_position_to_clipspace(positions, positions64Low, vec3(0.0), geometry.position);\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n\n vTexCoord = texCoords;\n\n if (coordinateConversion < -0.5) {\n vTexPos = geometry.position.xy + project_uCommonOrigin.xy;\n } else if (coordinateConversion > 0.5) {\n vTexPos = geometry.worldPosition.xy;\n }\n\n vec4 color = vec4(0.0);\n DECKGL_FILTER_COLOR(color, geometry);\n}\n",fs:xL,modules:[LT,KT]})}initializeState(){const t=this.getAttributeManager();t.remove(["instancePickingColors"]);const e=!0;t.add({indices:{size:1,isIndexed:!0,update:t=>t.value=this.state.mesh.indices,noAlloc:e},positions:{size:3,type:5130,fp64:this.use64bitPositions(),update:t=>t.value=this.state.mesh.positions,noAlloc:e},texCoords:{size:2,update:t=>t.value=this.state.mesh.texCoords,noAlloc:e}})}updateState(t){let{props:e,oldProps:n,changeFlags:r}=t;const i=this.getAttributeManager();if(r.extensionsChanged){var o;const{gl:t}=this.context;null===(o=this.state.model)||void 0===o||o.delete(),this.state.model=this._getModel(t),i.invalidateAll()}if(e.bounds!==n.bounds){const t=this.state.mesh,e=this._createMesh();this.state.model.setVertexCount(e.vertexCount);for(const n in e)t&&t[n]!==e[n]&&i.invalidate(n);this.setState({mesh:e,...this._getCoordinateUniforms()})}else e._imageCoordinateSystem!==n._imageCoordinateSystem&&this.setState(this._getCoordinateUniforms())}getPickingInfo(t){const{image:e}=this.props,n=t.info;if(!n.color||!e)return n.bitmap=null,n;const{width:r,height:i}=e;n.index=0;const o=function(t){const[e,n,r]=t;return[(e+(15&r)/16)/256,(n+(240&r)/256)/256]}(n.color),s=[Math.floor(o[0]*r),Math.floor(o[1]*i)];return n.bitmap={size:{width:r,height:i},uv:o,pixel:s},n}disablePickingIndex(){this.setState({disablePicking:!0})}restorePickingColors(){this.setState({disablePicking:!1})}_updateAutoHighlight(t){super._updateAutoHighlight({...t,color:this.encodePickingColor(0)})}_createMesh(){const{bounds:t}=this.props;let e=t;return wL(t)&&(e=[[t[0],t[1]],[t[0],t[3]],[t[2],t[3]],[t[2],t[1]]]),bL(e,this.context.viewport.resolution)}_getModel(t){return t?new oM(t,{...this.getShaders(),id:this.props.id,geometry:new qT({drawMode:4,vertexCount:6}),isInstanced:!1}):null}draw(t){const{uniforms:e,moduleParameters:n}=t,{model:r,coordinateConversion:i,bounds:o,disablePicking:s}=this.state,{image:a,desaturate:l,transparentColor:c,tintColor:u}=this.props;n.pickingActive&&s||a&&r&&r.setUniforms(e).setUniforms({bitmapTexture:a,desaturate:l,transparentColor:c.map((t=>t/255)),tintColor:u.slice(0,3).map((t=>t/255)),coordinateConversion:i,bounds:o}).draw()}_getCoordinateUniforms(){const{LNGLAT:t,CARTESIAN:e,DEFAULT:n}=dy;let{_imageCoordinateSystem:r}=this.props;if(r!==n){const{bounds:n}=this.props;if(!wL(n))throw new Error("_imageCoordinateSystem only supports rectangular bounds");const i=this.context.viewport.resolution?t:e;if(r=r===t?t:e,r===t&&i===e)return{coordinateConversion:-1,bounds:n};if(r===e&&i===t){const t=Xb([n[0],n[1]]),e=Xb([n[2],n[3]]);return{coordinateConversion:1,bounds:[t[0],t[1],e[0],e[1]]}}}return{coordinateConversion:0,bounds:[0,0,0,0]}}}function wL(t){return Number.isFinite(t[0])}function SL(){const t=yn.map.mapStyles.Dark;return new gL({data:"https://api.mapbox.com/styles/v1/relnox/".concat(t,"/tiles/256/{z}/{x}/{y}?access_token=")+"pk.eyJ1IjoicmVsbm94IiwiYSI6ImNqd2VwOTNtYjExaHkzeXBzYm1xc3E3dzQifQ.X8r8nj4-baZXSsFgctQMsg&attribution=false&logo=false&fresh=true",minZoom:0,maxZoom:21,tileSize:256,id:"OSM",renderSubLayers:t=>{const{bbox:{west:e,south:n,east:r,north:i}}=t.tile;return new _L(t,{data:null,image:t.data,bounds:[e,n,r,i]})}})}function CL(t){let{data:e,opacity:n,setLayerHoveredData:r}=t;if(e.traffic){let t={type:"FeatureCollection",features:e.traffic.features.map((t=>({type:"Feature",geometry:{type:"Polygon",coordinates:[[[t.geometry.coordinates[0][0]-t.properties.lanes/75e3,t.geometry.coordinates[0][1]-t.properties.lanes/75e3,0],[t.geometry.coordinates[0][0]+t.properties.lanes/75e3,t.geometry.coordinates[0][1]+t.properties.lanes/75e3,0],[t.geometry.coordinates[1][0]+t.properties.lanes/75e3,t.geometry.coordinates[1][1]+t.properties.lanes/75e3,0],[t.geometry.coordinates[1][0]-t.properties.lanes/75e3,t.geometry.coordinates[1][1]-t.properties.lanes/75e3,0]]]},properties:{norm_traffic:t.properties.norm_traffic}})))};return new rI({onHover:t=>{t.object&&r("traffic: ".concat(Math.floor(100*t.object.properties.norm_traffic),"%"))},pickable:!0,id:"TRAFFIC_TRIPS",shadowEnabled:!1,data:t,filled:!0,extruded:!0,getFillColor:t=>{const e=Wp((t=>t>0&&t<1?t:t>=1?1:0)(1-t.properties.norm_traffic),0,1);return[e[0],e[1],e[2],200+55*n]},getElevation:t=>100*t.properties.norm_traffic*n,updateTriggers:{getLineColor:e,getLineWidth:n}})}}ge(_L,"layerName","BitmapLayer"),ge(_L,"defaultProps",AL);class EL extends qT{constructor(t){const{id:e=SA("column-geometry")}=t,{indices:n,attributes:r}=function(t){const{radius:e,height:n=1,nradial:r=10}=t;let{vertices:i}=t;i&&(Rg.assert(i.length>=r),i=i.flatMap((t=>[t[0],t[1]])),ck(i,lk));const o=n>0,s=r+1,a=o?3*s+1:r,l=2*Math.PI/r,c=new Uint16Array(o?3*r*2:0),u=new Float32Array(3*a),d=new Float32Array(3*a);let h=0;if(o){for(let t=0;tt.position},getFillColor:{type:"accessor",value:PL},getLineColor:{type:"accessor",value:PL},getLineWidth:{type:"accessor",value:1},getElevation:{type:"accessor",value:1e3},material:!0,getColor:{deprecatedFor:["getFillColor","getLineColor"]}};class TL extends QM{getShaders(){const{gl:t}=this.context,e=!vx(t),n={},r=this.props.flatShading&&L_(t,k_);return r&&(n.FLAT_SHADING=1),super.getShaders({vs:"#version 300 es\n\n#define SHADER_NAME column-layer-vertex-shader\n\nin vec3 positions;\nin vec3 normals;\n\nin vec3 instancePositions;\nin float instanceElevations;\nin vec3 instancePositions64Low;\nin vec4 instanceFillColors;\nin vec4 instanceLineColors;\nin float instanceStrokeWidths;\n\nin vec3 instancePickingColors;\nuniform float opacity;\nuniform float radius;\nuniform float angle;\nuniform vec2 offset;\nuniform bool extruded;\nuniform bool stroked;\nuniform bool isStroke;\nuniform float coverage;\nuniform float elevationScale;\nuniform float edgeDistance;\nuniform float widthScale;\nuniform float widthMinPixels;\nuniform float widthMaxPixels;\nuniform int radiusUnits;\nuniform int widthUnits;\nout vec4 vColor;\n#ifdef FLAT_SHADING\nout vec4 position_commonspace;\n#endif\n\nvoid main(void) {\n geometry.worldPosition = instancePositions;\n\n vec4 color = isStroke ? instanceLineColors : instanceFillColors;\n mat2 rotationMatrix = mat2(cos(angle), sin(angle), -sin(angle), cos(angle));\n float elevation = 0.0;\n float strokeOffsetRatio = 1.0;\n\n if (extruded) {\n elevation = instanceElevations * (positions.z + 1.0) / 2.0 * elevationScale;\n } else if (stroked) {\n float widthPixels = clamp(\n project_size_to_pixel(instanceStrokeWidths * widthScale, widthUnits),\n widthMinPixels, widthMaxPixels) / 2.0;\n float halfOffset = project_pixel_size(widthPixels) / project_size(edgeDistance * coverage * radius);\n if (isStroke) {\n strokeOffsetRatio -= sign(positions.z) * halfOffset;\n } else {\n strokeOffsetRatio -= halfOffset;\n }\n }\n float shouldRender = float(color.a > 0.0 && instanceElevations >= 0.0);\n float dotRadius = radius * coverage * shouldRender;\n\n geometry.pickingColor = instancePickingColors;\n vec3 centroidPosition = vec3(instancePositions.xy, instancePositions.z + elevation);\n vec3 centroidPosition64Low = instancePositions64Low;\n vec2 offset = (rotationMatrix * positions.xy * strokeOffsetRatio + offset) * dotRadius;\n if (radiusUnits == UNIT_METERS) {\n offset = project_size(offset);\n }\n vec3 pos = vec3(offset, 0.);\n DECKGL_FILTER_SIZE(pos, geometry);\n\n gl_Position = project_position_to_clipspace(centroidPosition, centroidPosition64Low, pos, geometry.position);\n geometry.normal = project_normal(vec3(rotationMatrix * normals.xy, normals.z));\n DECKGL_FILTER_GL_POSITION(gl_Position, geometry);\n if (extruded && !isStroke) {\n#ifdef FLAT_SHADING\n position_commonspace = geometry.position;\n vColor = vec4(color.rgb, color.a * opacity);\n#else\n vec3 lightColor = lighting_getLightColor(color.rgb, project_uCameraPosition, geometry.position.xyz, geometry.normal);\n vColor = vec4(lightColor, color.a * opacity);\n#endif\n } else {\n vColor = vec4(color.rgb, color.a * opacity);\n }\n DECKGL_FILTER_COLOR(vColor, geometry);\n}\n",fs:"#version 300 es\n#define SHADER_NAME column-layer-fragment-shader\n\nprecision highp float;\n\nuniform vec3 project_uCameraPosition;\nuniform bool extruded;\nuniform bool isStroke;\n\nout vec4 fragColor;\n\nin vec4 vColor;\n#ifdef FLAT_SHADING\nin vec4 position_commonspace;\n#endif\n\nvoid main(void) {\n fragColor = vColor;\n#ifdef FLAT_SHADING\n if (extruded && !isStroke && !picking_uActive) {\n vec3 normal = normalize(cross(dFdx(position_commonspace.xyz), dFdy(position_commonspace.xyz)));\n fragColor.rgb = lighting_getLightColor(vColor.rgb, project_uCameraPosition, position_commonspace.xyz, normal);\n }\n#endif\n DECKGL_FILTER_COLOR(fragColor, geometry);\n}\n",defines:n,transpileToGLSL100:e,modules:[LT,r?WT:GT,KT]})}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,type:5130,fp64:this.use64bitPositions(),transition:!0,accessor:"getPosition"},instanceElevations:{size:1,transition:!0,accessor:"getElevation"},instanceFillColors:{size:this.props.colorFormat.length,type:5121,normalized:!0,transition:!0,accessor:"getFillColor",defaultValue:PL},instanceLineColors:{size:this.props.colorFormat.length,type:5121,normalized:!0,transition:!0,accessor:"getLineColor",defaultValue:PL},instanceStrokeWidths:{size:1,accessor:"getLineWidth",transition:!0}})}updateState(t){super.updateState(t);const{props:e,oldProps:n,changeFlags:r}=t,i=r.extensionsChanged||e.flatShading!==n.flatShading;if(i){var o;const{gl:t}=this.context;null===(o=this.state.model)||void 0===o||o.delete(),this.state.model=this._getModel(t),this.getAttributeManager().invalidateAll()}(i||e.diskResolution!==n.diskResolution||e.vertices!==n.vertices||(e.extruded||e.stroked)!==(n.extruded||n.stroked))&&this._updateGeometry(e)}getGeometry(t,e,n){const r=new EL({radius:1,height:n?2:0,vertices:e,nradial:t});let i=0;if(e)for(let o=0;ot.sourcePosition},getTargetPosition:{type:"accessor",value:t=>t.targetPosition},getColor:{type:"accessor",value:[0,0,0,255]},getWidth:{type:"accessor",value:1},widthUnits:"pixels",widthScale:{type:"number",value:1,min:0},widthMinPixels:{type:"number",value:0,min:0},widthMaxPixels:{type:"number",value:Number.MAX_SAFE_INTEGER,min:0}};class kL extends QM{getBounds(){var t;return null===(t=this.getAttributeManager())||void 0===t?void 0:t.getBounds(["instanceSourcePositions","instanceTargetPositions"])}getShaders(){return super.getShaders({vs:"#define SHADER_NAME line-layer-vertex-shader\n\nattribute vec3 positions;\nattribute vec3 instanceSourcePositions;\nattribute vec3 instanceTargetPositions;\nattribute vec3 instanceSourcePositions64Low;\nattribute vec3 instanceTargetPositions64Low;\nattribute vec4 instanceColors;\nattribute vec3 instancePickingColors;\nattribute float instanceWidths;\n\nuniform float opacity;\nuniform float widthScale;\nuniform float widthMinPixels;\nuniform float widthMaxPixels;\nuniform float useShortestPath;\nuniform int widthUnits;\n\nvarying vec4 vColor;\nvarying vec2 uv;\nvec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction, float width) {\n vec2 dir_screenspace = normalize(line_clipspace * project_uViewportSize);\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n\n return dir_screenspace * offset_direction * width / 2.0;\n}\n\nvec3 splitLine(vec3 a, vec3 b, float x) {\n float t = (x - a.x) / (b.x - a.x);\n return vec3(x, mix(a.yz, b.yz, t));\n}\n\nvoid main(void) {\n geometry.worldPosition = instanceSourcePositions;\n geometry.worldPositionAlt = instanceTargetPositions;\n\n vec3 source_world = instanceSourcePositions;\n vec3 target_world = instanceTargetPositions;\n vec3 source_world_64low = instanceSourcePositions64Low;\n vec3 target_world_64low = instanceTargetPositions64Low;\n\n if (useShortestPath > 0.5 || useShortestPath < -0.5) {\n source_world.x = mod(source_world.x + 180., 360.0) - 180.;\n target_world.x = mod(target_world.x + 180., 360.0) - 180.;\n float deltaLng = target_world.x - source_world.x;\n\n if (deltaLng * useShortestPath > 180.) {\n source_world.x += 360. * useShortestPath;\n source_world = splitLine(source_world, target_world, 180. * useShortestPath);\n source_world_64low = vec3(0.0);\n } else if (deltaLng * useShortestPath < -180.) {\n target_world.x += 360. * useShortestPath;\n target_world = splitLine(source_world, target_world, 180. * useShortestPath);\n target_world_64low = vec3(0.0);\n } else if (useShortestPath < 0.) {\n gl_Position = vec4(0.);\n return;\n }\n }\n vec4 source_commonspace;\n vec4 target_commonspace;\n vec4 source = project_position_to_clipspace(source_world, source_world_64low, vec3(0.), source_commonspace);\n vec4 target = project_position_to_clipspace(target_world, target_world_64low, vec3(0.), target_commonspace);\n float segmentIndex = positions.x;\n vec4 p = mix(source, target, segmentIndex);\n geometry.position = mix(source_commonspace, target_commonspace, segmentIndex);\n uv = positions.xy;\n geometry.uv = uv;\n geometry.pickingColor = instancePickingColors;\n float widthPixels = clamp(\n project_size_to_pixel(instanceWidths * widthScale, widthUnits),\n widthMinPixels, widthMaxPixels\n );\n vec3 offset = vec3(\n getExtrusionOffset(target.xy - source.xy, positions.y, widthPixels),\n 0.0);\n DECKGL_FILTER_SIZE(offset, geometry);\n DECKGL_FILTER_GL_POSITION(p, geometry);\n gl_Position = p + vec4(project_pixel_size_to_clipspace(offset.xy), 0.0, 0.0);\n vColor = vec4(instanceColors.rgb, instanceColors.a * opacity);\n DECKGL_FILTER_COLOR(vColor, geometry);\n}\n",fs:"#define SHADER_NAME line-layer-fragment-shader\n\nprecision highp float;\n\nvarying vec4 vColor;\nvarying vec2 uv;\n\nvoid main(void) {\n geometry.uv = uv;\n\n gl_FragColor = vColor;\n\n DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n}\n",modules:[LT,KT]})}get wrapLongitude(){return!1}initializeState(){this.getAttributeManager().addInstanced({instanceSourcePositions:{size:3,type:5130,fp64:this.use64bitPositions(),transition:!0,accessor:"getSourcePosition"},instanceTargetPositions:{size:3,type:5130,fp64:this.use64bitPositions(),transition:!0,accessor:"getTargetPosition"},instanceColors:{size:this.props.colorFormat.length,type:5121,normalized:!0,transition:!0,accessor:"getColor",defaultValue:[0,0,0,255]},instanceWidths:{size:1,transition:!0,accessor:"getWidth",defaultValue:1}})}updateState(t){if(super.updateState(t),t.changeFlags.extensionsChanged){var e;const{gl:t}=this.context;null===(e=this.state.model)||void 0===e||e.delete(),this.state.model=this._getModel(t),this.getAttributeManager().invalidateAll()}}draw(t){let{uniforms:e}=t;const{widthUnits:n,widthScale:r,widthMinPixels:i,widthMaxPixels:o,wrapLongitude:s}=this.props;this.state.model.setUniforms(e).setUniforms({widthUnits:fy[n],widthScale:r,widthMinPixels:i,widthMaxPixels:o,useShortestPath:s?1:0}).draw(),s&&this.state.model.setUniforms({useShortestPath:-1}).draw()}_getModel(t){return new oM(t,{...this.getShaders(),id:this.props.id,geometry:new qT({drawMode:5,attributes:{positions:new Float32Array([0,-1,0,0,1,0,1,-1,0,1,1,0])}}),isInstanced:!0})}}ge(kL,"layerName","LineLayer"),ge(kL,"defaultProps",OL);const RL=.5,IL=1/6,BL={N:[0,RL],E:[RL,0],S:[0,-.5],W:[-.5,0],NE:[RL,RL],NW:[-.5,RL],SE:[RL,-.5],SW:[-.5,-.5]},LL=[BL.W,BL.SW,BL.S],DL=[BL.S,BL.SE,BL.E],FL=[BL.E,BL.NE,BL.N],NL=[BL.NW,BL.W,BL.N],jL=[[-.5,IL],[-.5,-IL],[-IL,-.5],[IL,-.5]],zL=[[-IL,-.5],[IL,-.5],[RL,-IL],[RL,IL]],UL=[[RL,-IL],[RL,IL],[IL,RL],[-IL,RL]],VL=[[-.5,IL],[-.5,-IL],[IL,RL],[-IL,RL]],GL=[BL.W,BL.SW,BL.SE,BL.E],WL=[BL.S,BL.SE,BL.NE,BL.N],HL=[BL.NW,BL.W,BL.E,BL.NE],JL=[BL.NW,BL.SW,BL.S,BL.N],KL=[[-.5,IL],[-.5,-IL],[RL,-IL],[RL,IL]],XL=[[-IL,-.5],[IL,-.5],[IL,RL],[-IL,RL]],qL=[BL.NW,BL.SW,BL.SE,BL.NE],YL=[BL.NW,BL.SW,BL.SE,BL.E,BL.N],QL=[BL.W,BL.SW,BL.SE,BL.NE,BL.N],ZL=[BL.NW,BL.W,BL.S,BL.SE,BL.NE],$L=[BL.NW,BL.SW,BL.S,BL.E,BL.NE],tD=[BL.NW,BL.W,[RL,-IL],[RL,IL],BL.N],eD=[[-IL,-.5],[IL,-.5],BL.E,BL.NE,BL.N],nD=[[-.5,IL],[-.5,-IL],BL.S,BL.SE,BL.E],rD=[BL.W,BL.SW,BL.S,[IL,RL],[-IL,RL]],iD=[BL.NW,BL.W,[-IL,-.5],[IL,-.5],BL.N],oD=[[-.5,IL],[-.5,-IL],BL.E,BL.NE,BL.N],sD=[BL.S,BL.SE,BL.E,[IL,RL],[-IL,RL]],aD=[BL.W,BL.SW,BL.S,[RL,-IL],[RL,IL]],lD=[BL.W,BL.SW,BL.SE,BL.E,[IL,RL],[-IL,RL]],cD=[[-.5,IL],[-.5,-IL],BL.S,BL.SE,BL.NE,BL.N],uD=[BL.NW,BL.W,[-IL,-.5],[IL,-.5],BL.E,BL.NE],dD=[BL.NW,BL.SW,BL.S,[RL,-IL],[RL,IL],BL.N],hD=[BL.W,BL.SW,BL.S,BL.E,BL.NE,BL.N],fD=[BL.NW,BL.W,BL.S,BL.SE,BL.E,BL.N],pD=[[-.5,IL],[-.5,-IL],[-IL,-.5],[IL,-.5],BL.E,BL.NE,BL.N],gD=[BL.W,BL.SW,BL.S,[RL,-IL],[RL,IL],[IL,RL],[-IL,RL]],mD=[BL.NW,BL.W,[-IL,-.5],[IL,-.5],[RL,-IL],[RL,IL],BL.N],vD=[[-.5,IL],[-.5,-IL],BL.S,BL.SE,BL.E,[IL,RL],[-IL,RL]],bD=[[-.5,IL],[-.5,-IL],[-IL,-.5],[IL,-.5],[RL,-IL],[RL,IL],[IL,RL],[-IL,RL]],yD={0:[],1:[[BL.W,BL.S]],2:[[BL.S,BL.E]],3:[[BL.W,BL.E]],4:[[BL.N,BL.E]],5:{0:[[BL.W,BL.S],[BL.N,BL.E]],1:[[BL.W,BL.N],[BL.S,BL.E]]},6:[[BL.N,BL.S]],7:[[BL.W,BL.N]],8:[[BL.W,BL.N]],9:[[BL.N,BL.S]],10:{0:[[BL.W,BL.N],[BL.S,BL.E]],1:[[BL.W,BL.S],[BL.N,BL.E]]},11:[[BL.N,BL.E]],12:[[BL.W,BL.E]],13:[[BL.S,BL.E]],14:[[BL.W,BL.S]],15:[]};function xD(t){return parseInt(t,4)}const AD={[xD("0000")]:[],[xD("2222")]:[],[xD("2221")]:[LL],[xD("2212")]:[DL],[xD("2122")]:[FL],[xD("1222")]:[NL],[xD("0001")]:[LL],[xD("0010")]:[DL],[xD("0100")]:[FL],[xD("1000")]:[NL],[xD("2220")]:[jL],[xD("2202")]:[zL],[xD("2022")]:[UL],[xD("0222")]:[VL],[xD("0002")]:[jL],[xD("0020")]:[zL],[xD("0200")]:[UL],[xD("2000")]:[VL],[xD("0011")]:[GL],[xD("0110")]:[WL],[xD("1100")]:[HL],[xD("1001")]:[JL],[xD("2211")]:[GL],[xD("2112")]:[WL],[xD("1122")]:[HL],[xD("1221")]:[JL],[xD("2200")]:[KL],[xD("2002")]:[XL],[xD("0022")]:[KL],[xD("0220")]:[XL],[xD("1111")]:[qL],[xD("1211")]:[YL],[xD("2111")]:[QL],[xD("1112")]:[ZL],[xD("1121")]:[$L],[xD("1011")]:[YL],[xD("0111")]:[QL],[xD("1110")]:[ZL],[xD("1101")]:[$L],[xD("1200")]:[tD],[xD("0120")]:[eD],[xD("0012")]:[nD],[xD("2001")]:[rD],[xD("1022")]:[tD],[xD("2102")]:[eD],[xD("2210")]:[nD],[xD("0221")]:[rD],[xD("1002")]:[iD],[xD("2100")]:[oD],[xD("0210")]:[sD],[xD("0021")]:[aD],[xD("1220")]:[iD],[xD("0122")]:[oD],[xD("2012")]:[sD],[xD("2201")]:[aD],[xD("0211")]:[lD],[xD("2110")]:[cD],[xD("1102")]:[uD],[xD("1021")]:[dD],[xD("2011")]:[lD],[xD("0112")]:[cD],[xD("1120")]:[uD],[xD("1201")]:[dD],[xD("2101")]:[hD],[xD("0121")]:[hD],[xD("1012")]:[fD],[xD("1210")]:[fD],[xD("0101")]:{0:[LL,FL],1:[hD],2:[hD]},[xD("1010")]:{0:[NL,DL],1:[fD],2:[fD]},[xD("2121")]:{0:[hD],1:[hD],2:[LL,FL]},[xD("1212")]:{0:[fD],1:[fD],2:[NL,DL]},[xD("2120")]:{0:[pD],1:[pD],2:[jL,FL]},[xD("2021")]:{0:[gD],1:[gD],2:[LL,UL]},[xD("1202")]:{0:[mD],1:[mD],2:[NL,zL]},[xD("0212")]:{0:[vD],1:[vD],2:[DL,VL]},[xD("0102")]:{0:[jL,FL],1:[pD],2:[pD]},[xD("0201")]:{0:[LL,UL],1:[gD],2:[gD]},[xD("1020")]:{0:[NL,zL],1:[mD],2:[mD]},[xD("2010")]:{0:[DL,VL],1:[vD],2:[vD]},[xD("2020")]:{0:[VL,zL],1:[bD],2:[jL,UL]},[xD("0202")]:{0:[UL,jL],1:[bD],2:[VL,zL]}},_D={ISO_LINES:1,ISO_BANDS:2},wD={zIndex:0,zOffset:.005};function SD(t,e){return Array.isArray(e)?t=e?1:0}function CD(t){const{cellWeights:e,x:n,y:r,width:i,height:o}=t;let s=t.threshold;t.thresholdValue&&(Rg.deprecated("thresholdValue","threshold")(),s=t.thresholdValue);const a=n<0,l=n>=i-1,c=r<0,u=r>=o-1,d=a||l||c||u,h={},f={};a||u?f.top=0:(h.top=e[(r+1)*i+n],f.top=SD(h.top,s)),l||u?f.topRight=0:(h.topRight=e[(r+1)*i+n+1],f.topRight=SD(h.topRight,s)),l||c?f.right=0:(h.right=e[r*i+n+1],f.right=SD(h.right,s)),a||c?f.current=0:(h.current=e[r*i+n],f.current=SD(h.current,s));const{top:p,topRight:g,right:m,current:v}=f;let b=-1;Number.isFinite(s)&&(b=p<<3|g<<2|m<<1|v),Array.isArray(s)&&(b=p<<6|g<<4|m<<2|v);let y=0;return d||(y=SD((h.top+h.topRight+h.right+h.current)/4,s)),{code:b,meanCode:y}}function ED(t){const{gridOrigin:e,cellSize:n,x:r,y:i,code:o,meanCode:s,type:a=_D.ISO_LINES}=t,l={...wD,...t.thresholdData};let c=a===_D.ISO_BANDS?AD[o]:yD[o];Array.isArray(c)||(c=c[s]);const u=l.zIndex*l.zOffset,d=(r+1)*n[0],h=(i+1)*n[1],f=e[0]+d,p=e[1]+h;if(a===_D.ISO_BANDS){const t=[];return c.forEach((e=>{const r=[];e.forEach((t=>{const e=f+t[0]*n[0],i=p+t[1]*n[1];r.push([e,i,u])})),t.push(r)})),t}const g=[];return c.forEach((t=>{t.forEach((t=>{const e=f+t[0]*n[0],r=p+t[1]*n[1];g.push([e,r,u])}))})),g}function PD(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const r=Math.fround(t),i=t-r;return e[n]=r,e[n+1]=i,e}function MD(t){return t-Math.fround(t)}function TD(t){const e=new Float32Array(32);for(let n=0;n<4;++n)for(let r=0;r<4;++r){const i=4*n+r;PD(t[4*r+n],e,2*i)}return e}const OD={ONE:1};const kD={name:"fp64-arithmetic",vs:"uniform float ONE;\nvec2 split(float a) {\n const float SPLIT = 4097.0;\n float t = a * SPLIT;\n#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)\n float a_hi = t * ONE - (t - a);\n float a_lo = a * ONE - a_hi;\n#else\n float a_hi = t - (t - a);\n float a_lo = a - a_hi;\n#endif\n return vec2(a_hi, a_lo);\n}\nvec2 split2(vec2 a) {\n vec2 b = split(a.x);\n b.y += a.y;\n return b;\n}\nvec2 quickTwoSum(float a, float b) {\n#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)\n float sum = (a + b) * ONE;\n float err = b - (sum - a) * ONE;\n#else\n float sum = a + b;\n float err = b - (sum - a);\n#endif\n return vec2(sum, err);\n}\nvec2 twoSum(float a, float b) {\n float s = (a + b);\n#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)\n float v = (s * ONE - a) * ONE;\n float err = (a - (s - v) * ONE) * ONE * ONE * ONE + (b - v);\n#else\n float v = s - a;\n float err = (a - (s - v)) + (b - v);\n#endif\n return vec2(s, err);\n}\n\nvec2 twoSub(float a, float b) {\n float s = (a - b);\n#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)\n float v = (s * ONE - a) * ONE;\n float err = (a - (s - v) * ONE) * ONE * ONE * ONE - (b + v);\n#else\n float v = s - a;\n float err = (a - (s - v)) - (b + v);\n#endif\n return vec2(s, err);\n}\n\nvec2 twoSqr(float a) {\n float prod = a * a;\n vec2 a_fp64 = split(a);\n#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)\n float err = ((a_fp64.x * a_fp64.x - prod) * ONE + 2.0 * a_fp64.x *\n a_fp64.y * ONE * ONE) + a_fp64.y * a_fp64.y * ONE * ONE * ONE;\n#else\n float err = ((a_fp64.x * a_fp64.x - prod) + 2.0 * a_fp64.x * a_fp64.y) + a_fp64.y * a_fp64.y;\n#endif\n return vec2(prod, err);\n}\n\nvec2 twoProd(float a, float b) {\n float prod = a * b;\n vec2 a_fp64 = split(a);\n vec2 b_fp64 = split(b);\n float err = ((a_fp64.x * b_fp64.x - prod) + a_fp64.x * b_fp64.y +\n a_fp64.y * b_fp64.x) + a_fp64.y * b_fp64.y;\n return vec2(prod, err);\n}\n\nvec2 sum_fp64(vec2 a, vec2 b) {\n vec2 s, t;\n s = twoSum(a.x, b.x);\n t = twoSum(a.y, b.y);\n s.y += t.x;\n s = quickTwoSum(s.x, s.y);\n s.y += t.y;\n s = quickTwoSum(s.x, s.y);\n return s;\n}\n\nvec2 sub_fp64(vec2 a, vec2 b) {\n vec2 s, t;\n s = twoSub(a.x, b.x);\n t = twoSub(a.y, b.y);\n s.y += t.x;\n s = quickTwoSum(s.x, s.y);\n s.y += t.y;\n s = quickTwoSum(s.x, s.y);\n return s;\n}\n\nvec2 mul_fp64(vec2 a, vec2 b) {\n vec2 prod = twoProd(a.x, b.x);\n prod.y += a.x * b.y;\n#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND)\n prod = split2(prod);\n#endif\n prod = quickTwoSum(prod.x, prod.y);\n prod.y += a.y * b.x;\n#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND)\n prod = split2(prod);\n#endif\n prod = quickTwoSum(prod.x, prod.y);\n return prod;\n}\n\nvec2 div_fp64(vec2 a, vec2 b) {\n float xn = 1.0 / b.x;\n#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND)\n vec2 yn = mul_fp64(a, vec2(xn, 0));\n#else\n vec2 yn = a * xn;\n#endif\n float diff = (sub_fp64(a, mul_fp64(b, yn))).x;\n vec2 prod = twoProd(xn, diff);\n return sum_fp64(yn, prod);\n}\n\nvec2 sqrt_fp64(vec2 a) {\n if (a.x == 0.0 && a.y == 0.0) return vec2(0.0, 0.0);\n if (a.x < 0.0) return vec2(0.0 / 0.0, 0.0 / 0.0);\n\n float x = 1.0 / sqrt(a.x);\n float yn = a.x * x;\n#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)\n vec2 yn_sqr = twoSqr(yn) * ONE;\n#else\n vec2 yn_sqr = twoSqr(yn);\n#endif\n float diff = sub_fp64(a, yn_sqr).x;\n vec2 prod = twoProd(x * 0.5, diff);\n#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND)\n return sum_fp64(split(yn), prod);\n#else\n return sum_fp64(vec2(yn, 0.0), prod);\n#endif\n}\n",fs:null,getUniforms:function(){return OD},fp64ify:PD,fp64LowPart:MD,fp64ifyMatrix4:TD},RD={SUM:1,MEAN:2,MIN:3,MAX:4};function ID(t,e){return t+e}function BD(t,e){return e>t?e:t}function LD(t,e){return e1&&void 0!==arguments[1]?arguments[1]:{};if(Number.isFinite(t))return t;return n=>(e.index=n.index,t(n.source,e))}(e,n),r){case RD.MIN:return t=>function(t,e){if(Number.isFinite(e))return t.length?e:null;const n=t.map(e).filter(Number.isFinite);return n.length?n.reduce(LD,1/0):null}(t,e);case RD.SUM:return t=>function(t,e){if(Number.isFinite(e))return t.length?t.length*e:null;const n=t.map(e).filter(Number.isFinite);return n.length?n.reduce(ID,0):null}(t,e);case RD.MEAN:return t=>function(t,e){if(Number.isFinite(e))return t.length?e:null;const n=t.map(e).filter(Number.isFinite);return n.length?n.reduce(ID,0)/n.length:null}(t,e);case RD.MAX:return t=>function(t,e){if(Number.isFinite(e))return t.length?e:null;const n=t.map(e).filter(Number.isFinite);return n.length?n.reduce(BD,-1/0):null}(t,e);default:return null}}function FD(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return n=>(e.indices=n.map((t=>t.index)),t(n.map((t=>t.source)),e))}const ND={projectPoints:!1,viewport:null,createBufferObjects:!0,moduleSettings:{}},jD=3402823466e29,zD=[32775,32774],UD=[32776,32774],VD=[32776,32775],GD={[RD.SUM]:32774,[RD.MEAN]:32774,[RD.MIN]:zD,[RD.MAX]:UD},WD={size:1,operation:RD.SUM,needMin:!1,needMax:!1,combineMaxMin:!1},HD="#define SHADER_NAME gpu-aggregation-to-grid-vs\n\nattribute vec3 positions;\nattribute vec3 positions64Low;\nattribute vec3 weights;\nuniform vec2 cellSize;\nuniform vec2 gridSize;\nuniform bool projectPoints;\nuniform vec2 translation;\nuniform vec3 scaling;\n\nvarying vec3 vWeights;\n\nvec2 project_to_pixel(vec4 pos) {\n vec4 result;\n pos.xy = pos.xy/pos.w;\n result = pos + vec4(translation, 0., 0.);\n result.xy = scaling.z > 0. ? result.xy * scaling.xy : result.xy;\n return result.xy;\n}\n\nvoid main(void) {\n\n vWeights = weights;\n\n vec4 windowPos = vec4(positions, 1.);\n if (projectPoints) {\n windowPos = project_position_to_clipspace(positions, positions64Low, vec3(0));\n }\n\n vec2 pos = project_to_pixel(windowPos);\n\n vec2 pixelXY64[2];\n pixelXY64[0] = vec2(pos.x, 0.);\n pixelXY64[1] = vec2(pos.y, 0.);\n vec2 gridXY64[2];\n gridXY64[0] = div_fp64(pixelXY64[0], vec2(cellSize.x, 0));\n gridXY64[1] = div_fp64(pixelXY64[1], vec2(cellSize.y, 0));\n float x = floor(gridXY64[0].x);\n float y = floor(gridXY64[1].x);\n pos = vec2(x, y);\n pos = (pos * (2., 2.) / (gridSize)) - (1., 1.);\n vec2 offset = 1.0 / gridSize;\n pos = pos + offset;\n\n gl_Position = vec4(pos, 0.0, 1.0);\n gl_PointSize = 1.0;\n}\n",JD="#define SHADER_NAME gpu-aggregation-to-grid-fs\n\nprecision highp float;\n\nvarying vec3 vWeights;\n\nvoid main(void) {\n gl_FragColor = vec4(vWeights, 1.0);\n DECKGL_FILTER_COLOR(gl_FragColor, geometry);\n}\n",KD="#version 300 es\n#define SHADER_NAME gpu-aggregation-all-vs-64\n\nin vec2 position;\nuniform ivec2 gridSize;\nout vec2 vTextureCoord;\n\nvoid main(void) {\n vec2 pos = vec2(-1.0, -1.0);\n vec2 offset = 1.0 / vec2(gridSize);\n pos = pos + offset;\n\n gl_Position = vec4(pos, 0.0, 1.0);\n\n int yIndex = gl_InstanceID / gridSize[0];\n int xIndex = gl_InstanceID - (yIndex * gridSize[0]);\n\n vec2 yIndexFP64 = vec2(float(yIndex), 0.);\n vec2 xIndexFP64 = vec2(float(xIndex), 0.);\n vec2 gridSizeYFP64 = vec2(gridSize[1], 0.);\n vec2 gridSizeXFP64 = vec2(gridSize[0], 0.);\n\n vec2 texCoordXFP64 = div_fp64(yIndexFP64, gridSizeYFP64);\n vec2 texCoordYFP64 = div_fp64(xIndexFP64, gridSizeXFP64);\n\n vTextureCoord = vec2(texCoordYFP64.x, texCoordXFP64.x);\n gl_PointSize = 1.0;\n}\n",XD="#version 300 es\n#define SHADER_NAME gpu-aggregation-all-fs\n\nprecision highp float;\n\nin vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform bool combineMaxMin;\nout vec4 fragColor;\nvoid main(void) {\n vec4 textureColor = texture(uSampler, vec2(vTextureCoord.s, vTextureCoord.t));\n if (textureColor.a == 0.) {\n discard;\n }\n fragColor.rgb = textureColor.rgb;\n fragColor.a = combineMaxMin ? textureColor.r : textureColor.a;\n}\n",qD="#define SHADER_NAME gpu-aggregation-transform-mean-vs\nattribute vec4 aggregationValues;\nvarying vec4 meanValues;\n\nvoid main()\n{\n bool isCellValid = bool(aggregationValues.w > 0.);\n meanValues.xyz = isCellValid ? aggregationValues.xyz/aggregationValues.w : vec3(0, 0, 0);\n meanValues.w = aggregationValues.w;\n gl_PointSize = 1.0;\n}\n",YD={10240:9728,10241:9728};function QD(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{width:n=1,height:r=1,data:i=null,unpackFlipY:o=!0,parameters:s=YD}=e;return new qA(t,{data:i,format:vx(t)?34836:6408,type:5126,border:0,mipmaps:!1,parameters:s,dataFormat:6408,width:n,height:r,unpackFlipY:o})}function ZD(t,e){const{id:n,width:r=1,height:i=1,texture:o}=e;return new j_(t,{id:n,width:r,height:i,attachments:{36064:o}})}const $D=["aggregationBuffer","maxMinBuffer","minBuffer","maxBuffer"],tF={maxData:"maxBuffer",minData:"minBuffer",maxMinData:"maxMinBuffer"},eF=[d_,E_,v_,b_,A_];class nF{static getAggregationData(t){let{aggregationData:e,maxData:n,minData:r,maxMinData:i,pixelIndex:o}=t;const s=4*o,a={};return e&&(a.cellCount=e[s+3],a.cellWeight=e[s]),i?(a.maxCellWieght=i[0],a.minCellWeight=i[3]):(n&&(a.maxCellWieght=n[0],a.totalCount=n[3]),r&&(a.minCellWeight=r[0],a.totalCount=n[3])),a}static getCellData(t){let{countsData:e,size:n=1}=t;const r=e.length/4,i=new Float32Array(r*n),o=new Uint32Array(r);for(let s=0;s1&&void 0!==arguments[1]?arguments[1]:{};this.id=e.id||"gpu-grid-aggregator",this.gl=t,this.state={weightAttributes:{},textures:{},meanTextures:{},buffers:{},framebuffers:{},maxMinFramebuffers:{},minFramebuffers:{},maxFramebuffers:{},equations:{},resources:{},results:{}},this._hasGPUSupport=vx(t)&&D_(this.gl,v_),this._hasGPUSupport&&this._setupModels()}delete(){const{gridAggregationModel:t,allAggregationModel:e,meanTransform:n}=this,{textures:r,framebuffers:i,maxMinFramebuffers:o,minFramebuffers:s,maxFramebuffers:a,meanTextures:l,resources:c}=this.state;null===t||void 0===t||t.delete(),null===e||void 0===e||e.delete(),null===n||void 0===n||n.delete(),function(t){t=Array.isArray(t)?t:[t],t.forEach((t=>{for(const e in t)t[e].delete()}))}([i,r,o,s,a,l,c])}run(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.setState({results:{}});const e=this._normalizeAggregationParams(t);return this._hasGPUSupport||Rg.log(1,"GPUGridAggregator: not supported")(),this._runAggregation(e)}getData(t){const e={},n=this.state.results;n[t].aggregationData||(n[t].aggregationData=n[t].aggregationBuffer.getData()),e.aggregationData=n[t].aggregationData;for(const r in tF){const i=tF[r];(n[t][r]||n[t][i])&&(n[t][r]=n[t][r]||n[t][i].getData(),e[r]=n[t][r])}return e}updateShaders(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.setState({shaderOptions:t,modelDirty:!0})}_normalizeAggregationParams(t){const e={...ND,...t},{weights:n}=e;return n&&(e.weights=function(t){const e={};for(const n in t)e[n]={...WD,...t[n]};return e}(n)),e}setState(t){Object.assign(this.state,t)}_getAggregateData(t){const e={},{textures:n,framebuffers:r,maxMinFramebuffers:i,minFramebuffers:o,maxFramebuffers:s,resources:a}=this.state,{weights:l}=t;for(const c in l){e[c]={};const{needMin:t,needMax:u,combineMaxMin:d}=l[c];e[c].aggregationTexture=n[c],e[c].aggregationBuffer=l_(r[c],{target:l[c].aggregationBuffer,sourceType:5126}),t&&u&&d?(e[c].maxMinBuffer=l_(i[c],{target:l[c].maxMinBuffer,sourceType:5126}),e[c].maxMinTexture=a["".concat(c,"-maxMinTexture")]):(t&&(e[c].minBuffer=l_(o[c],{target:l[c].minBuffer,sourceType:5126}),e[c].minTexture=a["".concat(c,"-minTexture")]),u&&(e[c].maxBuffer=l_(s[c],{target:l[c].maxBuffer,sourceType:5126}),e[c].maxTexture=a["".concat(c,"-maxTexture")]))}return this._trackGPUResultBuffers(e,l),e}_renderAggregateData(t){const{cellSize:e,projectPoints:n,attributes:r,moduleSettings:i,numCol:o,numRow:s,weights:a,translation:l,scaling:c}=t,{maxMinFramebuffers:u,minFramebuffers:d,maxFramebuffers:h}=this.state,f=[o,s],p={blend:!0,depthTest:!1,blendFunc:[1,1]},g={cellSize:e,gridSize:f,projectPoints:n,translation:l,scaling:c};for(const m in a){const{needMin:t,needMax:e}=a[m],n=t&&e&&a[m].combineMaxMin;this._renderToWeightsTexture({id:m,parameters:p,moduleSettings:i,uniforms:g,gridSize:f,attributes:r,weights:a}),n?this._renderToMaxMinTexture({id:m,parameters:{...p,blendEquation:VD},gridSize:f,minOrMaxFb:u[m],clearParams:{clearColor:[0,0,0,jD]},combineMaxMin:n}):(t&&this._renderToMaxMinTexture({id:m,parameters:{...p,blendEquation:zD},gridSize:f,minOrMaxFb:d[m],clearParams:{clearColor:[jD,jD,jD,0]},combineMaxMin:n}),e&&this._renderToMaxMinTexture({id:m,parameters:{...p,blendEquation:UD},gridSize:f,minOrMaxFb:h[m],clearParams:{clearColor:[0,0,0,0]},combineMaxMin:n}))}}_renderToMaxMinTexture(t){const{id:e,parameters:n,gridSize:r,minOrMaxFb:i,combineMaxMin:o,clearParams:s={}}=t,{framebuffers:a}=this.state,{gl:l,allAggregationModel:c}=this;aA(l,{...s,framebuffer:i,viewport:[0,0,r[0],r[1]]},(()=>{l.clear(16384),c.draw({parameters:n,uniforms:{uSampler:a[e].texture,gridSize:r,combineMaxMin:o}})}))}_renderToWeightsTexture(t){const{id:e,parameters:n,moduleSettings:r,uniforms:i,gridSize:o,weights:s}=t,{framebuffers:a,equations:l,weightAttributes:c}=this.state,{gl:u,gridAggregationModel:d}=this,{operation:h}=s[e],f=h===RD.MIN?[jD,jD,jD,0]:[0,0,0,0];if(aA(u,{framebuffer:a[e],viewport:[0,0,o[0],o[1]],clearColor:f},(()=>{u.clear(16384);const t={weights:c[e]};d.draw({parameters:{...n,blendEquation:l[e]},moduleSettings:r,uniforms:i,attributes:t})})),h===RD.MEAN){const{meanTextures:t,textures:n}=this.state,r={_sourceTextures:{aggregationValues:t[e]},_targetTexture:n[e],elementCount:n[e].width*n[e].height};this.meanTransform?this.meanTransform.update(r):this.meanTransform=function(t,e){return new sM(t,{vs:qD,_targetTextureVarying:"meanValues",...e})}(u,r),this.meanTransform.run({parameters:{blend:!1,depthTest:!1}}),a[e].attach({36064:n[e]})}}_runAggregation(t){this._updateModels(t),this._setupFramebuffers(t),this._renderAggregateData(t);const e=this._getAggregateData(t);return this.setState({results:e}),e}_setupFramebuffers(t){const{textures:e,framebuffers:n,maxMinFramebuffers:r,minFramebuffers:i,maxFramebuffers:o,meanTextures:s,equations:a}=this.state,{weights:l}=t,{numCol:c,numRow:u}=t,d={width:c,height:u};for(const h in l){const{needMin:t,needMax:f,combineMaxMin:p,operation:g}=l[h];e[h]=l[h].aggregationTexture||e[h]||QD(this.gl,{id:"".concat(h,"-texture"),width:c,height:u}),e[h].resize(d);let m=e[h];g===RD.MEAN&&(s[h]=s[h]||QD(this.gl,{id:"".concat(h,"-mean-texture"),width:c,height:u}),s[h].resize(d),m=s[h]),n[h]?n[h].attach({36064:m}):n[h]=ZD(this.gl,{id:"".concat(h,"-fb"),width:c,height:u,texture:m}),n[h].resize(d),a[h]=GD[g]||GD.SUM,(t||f)&&(t&&f&&p?r[h]||(m=l[h].maxMinTexture||this._getMinMaxTexture("".concat(h,"-maxMinTexture")),r[h]=ZD(this.gl,{id:"".concat(h,"-maxMinFb"),texture:m})):(t&&(i[h]||(m=l[h].minTexture||this._getMinMaxTexture("".concat(h,"-minTexture")),i[h]=ZD(this.gl,{id:"".concat(h,"-minFb"),texture:m}))),f&&(o[h]||(m=l[h].maxTexture||this._getMinMaxTexture("".concat(h,"-maxTexture")),o[h]=ZD(this.gl,{id:"".concat(h,"-maxFb"),texture:m})))))}}_getMinMaxTexture(t){const{resources:e}=this.state;return e[t]||(e[t]=QD(this.gl,{id:"resourceName"})),e[t]}_setupModels(){let{numCol:t=0,numRow:e=0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var n;const{gl:r}=this,{shaderOptions:i}=this.state;if(null===(n=this.gridAggregationModel)||void 0===n||n.delete(),this.gridAggregationModel=function(t,e){const n=SM({vs:HD,fs:JD,modules:[kD,LT]},e);return new oM(t,{id:"Gird-Aggregation-Model",vertexCount:1,drawMode:0,...n})}(r,i),!this.allAggregationModel){const n=t*e;this.allAggregationModel=function(t,e){return new oM(t,{id:"All-Aggregation-Model",vs:KD,fs:XD,modules:[kD],vertexCount:1,drawMode:0,isInstanced:!0,instanceCount:e,attributes:{position:[0,0]}})}(r,n)}}_setupWeightAttributes(t){const{weightAttributes:e}=this.state,{weights:n}=t;for(const r in n)e[r]=t.attributes[r]}_trackGPUResultBuffers(t,e){const{resources:n}=this.state;for(const r in t)if(t[r])for(const i of $D)if(t[r][i]&&e[r][i]!==t[r][i]){const e="gpu-result-".concat(r,"-").concat(i);n[e]&&n[e].delete(),n[e]=t[r][i]}}_updateModels(t){const{vertexCount:e,attributes:n,numCol:r,numRow:i}=t,{modelDirty:o}=this.state;o&&(this._setupModels(t),this.setState({modelDirty:!1})),this._setupWeightAttributes(t),this.gridAggregationModel.setVertexCount(e),this.gridAggregationModel.setAttributes(n),this.allAggregationModel.setInstanceCount(r*i)}}const rF=6378e3;function iF(t){return Number.isFinite(t)?t:0}function oF(t,e){const n=t.positions.value;let r,i,o=1/0,s=-1/0,a=1/0,l=-1/0;for(let c=0;c