1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[388],{2558:(e,t,o)=>{let r;o.d(t,{AH:()=>eA,Jh:()=>eF,KI:()=>e$,KY:()=>eR,_M:()=>eO,_Q:()=>eH,cT:()=>tU,eZ:()=>tN,fZ:()=>eX,kX:()=>eL,oR:()=>eB,pR:()=>eI,pU:()=>eM});var l,a,s,n,h,u,c,v,m,d,f,x,p,g,y,T,S,_,w,C,M,E,P,b,R,A,z,F,I,D,N,O,W,U,G,k,L,$,V,B,Y,Z,j,X,H,q,K,J,Q,ee,et=o(16743),ei=o(43410),eo=o(37811),er=Object.defineProperty,el=e=>{throw TypeError(e)},ea=(e,t,o)=>{let r;return(r="symbol"!=typeof t?t+"":t)in e?er(e,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[r]=o},es=(e,t,o)=>t.has(e)||el("Cannot "+o),en=(e,t,o)=>(es(e,t,"read from private field"),o?o.call(e):t.get(e)),eh=(e,t,o)=>t.has(e)?el("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,o),eu=(e,t,o,r)=>(es(e,t,"write to private field"),r?r.call(e,o):t.set(e,o),o),ec=(e,t,o)=>(es(e,t,"access private method"),o),ev=(e,t,o,r)=>({set _(i){eu(e,t,i,o)},get _(){return en(e,t,r)}});function em(e,t,o){let r=Math.acos(Math.min(Math.max(e[0]*t[0]+e[1]*t[1]+e[2]*t[2],-1),1));if(r<1e-6)return e;let l=Math.sin(r),a=Math.sin((1-o)*r)/l,s=Math.sin(o*r)/l;return[e[0]*a+t[0]*s,e[1]*a+t[1]*s,e[2]*a+t[2]*s]}let ed="object"==typeof performance&&performance&&"function"==typeof performance.now?performance:Date,ef=new Set,ex="object"==typeof eo&&eo?eo:{},ep=(e,t,o,r)=>{"function"==typeof ex.emitWarning?ex.emitWarning(e,t,o,r):console.error(`[${o}] ${t}: ${e}`)},eg=globalThis.AbortController,ey=globalThis.AbortSignal;if(typeof eg>"u"){ey=class{constructor(){ea(this,"onabort"),ea(this,"_onabort",[]),ea(this,"reason"),ea(this,"aborted",!1)}addEventListener(e,t){this._onabort.push(t)}},eg=class{constructor(){ea(this,"signal",new ey),t()}abort(e){var t,o;if(!this.signal.aborted){for(let t of(this.signal.reason=e,this.signal.aborted=!0,this.signal._onabort))t(e);null==(o=(t=this.signal).onabort)||o.call(t,e)}}};let e=(null==(s=ex.env)?void 0:s.LRU_CACHE_IGNORE_AC_WARNING)!=="1",t=()=>{e&&(e=!1,ep("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t))}}let eT=e=>e&&e===Math.floor(e)&&e>0&&isFinite(e),eS=e=>eT(e)?e<=256?Uint8Array:e<=65536?Uint16Array:e<=0x100000000?Uint32Array:e<=Number.MAX_SAFE_INTEGER?e_:null:null;class e_ extends Array{constructor(e){super(e),this.fill(0)}}let ew=class e{constructor(t,o){if(ea(this,"heap"),ea(this,"length"),!en(e,n))throw TypeError("instantiate Stack using Stack.create(n)");this.heap=new o(t),this.length=0}static create(t){let o=eS(t);if(!o)return[];eu(e,n,!0);let r=new e(t,o);return eu(e,n,!1),r}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}};eh(ew,n=new WeakMap,!1);let eC=(ee=class{constructor(e){eh(this,D),eh(this,c),eh(this,v),eh(this,m),eh(this,d),eh(this,f),eh(this,x),ea(this,"ttl"),ea(this,"ttlResolution"),ea(this,"ttlAutopurge"),ea(this,"updateAgeOnGet"),ea(this,"updateAgeOnHas"),ea(this,"allowStale"),ea(this,"noDisposeOnSet"),ea(this,"noUpdateTTL"),ea(this,"maxEntrySize"),ea(this,"sizeCalculation"),ea(this,"noDeleteOnFetchRejection"),ea(this,"noDeleteOnStaleGet"),ea(this,"allowStaleOnFetchAbort"),ea(this,"allowStaleOnFetchRejection"),ea(this,"ignoreFetchAbort"),eh(this,p),eh(this,g),eh(this,y),eh(this,T),eh(this,S),eh(this,_),eh(this,w),eh(this,C),eh(this,M),eh(this,E),eh(this,P),eh(this,b),eh(this,R),eh(this,A),eh(this,z),eh(this,F),eh(this,I),eh(this,O,()=>{}),eh(this,W,()=>{}),eh(this,U,()=>{}),eh(this,G,()=>!1),eh(this,L,e=>{}),eh(this,$,(e,t,o)=>{}),eh(this,V,(e,t,o,r)=>{if(o||r)throw TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0}),ea(this,h,"LRUCache");const{max:t=0,ttl:o,ttlResolution:r=1,ttlAutopurge:l,updateAgeOnGet:a,updateAgeOnHas:s,allowStale:n,dispose:u,disposeAfter:B,noDisposeOnSet:Y,noUpdateTTL:Z,maxSize:j=0,maxEntrySize:X=0,sizeCalculation:H,fetchMethod:q,memoMethod:K,noDeleteOnFetchRejection:J,noDeleteOnStaleGet:Q,allowStaleOnFetchRejection:et,allowStaleOnFetchAbort:ei,ignoreFetchAbort:eo}=e;if(0!==t&&!eT(t))throw TypeError("max option must be a nonnegative integer");const er=t?eS(t):Array;if(!er)throw Error("invalid max value: "+t);if(eu(this,c,t),eu(this,v,j),this.maxEntrySize=X||en(this,v),this.sizeCalculation=H,this.sizeCalculation){if(!en(this,v)&&!this.maxEntrySize)throw TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if("function"!=typeof this.sizeCalculation)throw TypeError("sizeCalculation set to non-function")}if(void 0!==K&&"function"!=typeof K)throw TypeError("memoMethod must be a function if defined");if(eu(this,x,K),void 0!==q&&"function"!=typeof q)throw TypeError("fetchMethod must be a function if specified");if(eu(this,f,q),eu(this,F,!!q),eu(this,y,new Map),eu(this,T,Array(t).fill(void 0)),eu(this,S,Array(t).fill(void 0)),eu(this,_,new er(t)),eu(this,w,new er(t)),eu(this,C,0),eu(this,M,0),eu(this,E,ew.create(t)),eu(this,p,0),eu(this,g,0),"function"==typeof u&&eu(this,m,u),"function"==typeof B?(eu(this,d,B),eu(this,P,[])):(eu(this,d,void 0),eu(this,P,void 0)),eu(this,z,!!en(this,m)),eu(this,I,!!en(this,d)),this.noDisposeOnSet=!!Y,this.noUpdateTTL=!!Z,this.noDeleteOnFetchRejection=!!J,this.allowStaleOnFetchRejection=!!et,this.allowStaleOnFetchAbort=!!ei,this.ignoreFetchAbort=!!eo,0!==this.maxEntrySize){if(0!==en(this,v)&&!eT(en(this,v)))throw TypeError("maxSize must be a positive integer if specified");if(!eT(this.maxEntrySize))throw TypeError("maxEntrySize must be a positive integer if specified");ec(this,D,k).call(this)}if(this.allowStale=!!n,this.noDeleteOnStaleGet=!!Q,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!s,this.ttlResolution=eT(r)||0===r?r:1,this.ttlAutopurge=!!l,this.ttl=o||0,this.ttl){if(!eT(this.ttl))throw TypeError("ttl must be a positive integer if specified");ec(this,D,N).call(this)}if(0===en(this,c)&&0===this.ttl&&0===en(this,v))throw TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!en(this,c)&&!en(this,v)){const e="LRU_CACHE_UNBOUNDED";(e=>!ef.has(e))(e)&&(ef.add(e),ep("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",e,ee))}}static unsafeExposeInternals(e){return{starts:en(e,R),ttls:en(e,A),sizes:en(e,b),keyMap:en(e,y),keyList:en(e,T),valList:en(e,S),next:en(e,_),prev:en(e,w),get head(){return en(e,C)},get tail(){return en(e,M)}
1,free:en(e,E),isBackgroundFetch:t=>ec(e,D,H).call(e,t),backgroundFetch:(t,o,r,l)=>ec(e,D,X).call(e,t,o,r,l),moveToTail:t=>ec(e,D,K).call(e,t),indexes:t=>ec(e,D,B).call(e,t),rindexes:t=>ec(e,D,Y).call(e,t),isStale:t=>en(e,G).call(e,t)}}get max(){return en(this,c)}get maxSize(){return en(this,v)}get calculatedSize(){return en(this,g)}get size(){return en(this,p)}get fetchMethod(){return en(this,f)}get memoMethod(){return en(this,x)}get dispose(){return en(this,m)}get disposeAfter(){return en(this,d)}getRemainingTTL(e){return en(this,y).has(e)?1/0:0}*entries(){for(let e of ec(this,D,B).call(this))void 0===en(this,S)[e]||void 0===en(this,T)[e]||ec(this,D,H).call(this,en(this,S)[e])||(yield[en(this,T)[e],en(this,S)[e]])}*rentries(){for(let e of ec(this,D,Y).call(this))void 0===en(this,S)[e]||void 0===en(this,T)[e]||ec(this,D,H).call(this,en(this,S)[e])||(yield[en(this,T)[e],en(this,S)[e]])}*keys(){for(let e of ec(this,D,B).call(this)){let t=en(this,T)[e];void 0===t||ec(this,D,H).call(this,en(this,S)[e])||(yield t)}}*rkeys(){for(let e of ec(this,D,Y).call(this)){let t=en(this,T)[e];void 0===t||ec(this,D,H).call(this,en(this,S)[e])||(yield t)}}*values(){for(let e of ec(this,D,B).call(this))void 0===en(this,S)[e]||ec(this,D,H).call(this,en(this,S)[e])||(yield en(this,S)[e])}*rvalues(){for(let e of ec(this,D,Y).call(this))void 0===en(this,S)[e]||ec(this,D,H).call(this,en(this,S)[e])||(yield en(this,S)[e])}[(u=Symbol.iterator,h=Symbol.toStringTag,u)](){return this.entries()}find(e,t={}){for(let o of ec(this,D,B).call(this)){let r=en(this,S)[o],l=ec(this,D,H).call(this,r)?r.__staleWhileFetching:r;if(void 0!==l&&e(l,en(this,T)[o],this))return this.get(en(this,T)[o],t)}}forEach(e,t=this){for(let o of ec(this,D,B).call(this)){let r=en(this,S)[o],l=ec(this,D,H).call(this,r)?r.__staleWhileFetching:r;void 0!==l&&e.call(t,l,en(this,T)[o],this)}}rforEach(e,t=this){for(let o of ec(this,D,Y).call(this)){let r=en(this,S)[o],l=ec(this,D,H).call(this,r)?r.__staleWhileFetching:r;void 0!==l&&e.call(t,l,en(this,T)[o],this)}}purgeStale(){let e=!1;for(let t of ec(this,D,Y).call(this,{allowStale:!0}))en(this,G).call(this,t)&&(ec(this,D,J).call(this,en(this,T)[t],"expire"),e=!0);return e}info(e){let t=en(this,y).get(e);if(void 0===t)return;let o=en(this,S)[t],r=ec(this,D,H).call(this,o)?o.__staleWhileFetching:o;if(void 0===r)return;let l={value:r};if(en(this,A)&&en(this,R)){let e=en(this,A)[t],o=en(this,R)[t];e&&o&&(l.ttl=e-(ed.now()-o),l.start=Date.now())}return en(this,b)&&(l.size=en(this,b)[t]),l}dump(){let e=[];for(let t of ec(this,D,B).call(this,{allowStale:!0})){let o=en(this,T)[t],r=en(this,S)[t],l=ec(this,D,H).call(this,r)?r.__staleWhileFetching:r;if(void 0===l||void 0===o)continue;let a={value:l};if(en(this,A)&&en(this,R)){a.ttl=en(this,A)[t];let e=ed.now()-en(this,R)[t];a.start=Math.floor(Date.now()-e)}en(this,b)&&(a.size=en(this,b)[t]),e.unshift([o,a])}return e}load(e){for(let[t,o]of(this.clear(),e)){if(o.start){let e=Date.now()-o.start;o.start=ed.now()-e}this.set(t,o.value,o)}}set(e,t,o={}){var r,l,a,s,n;if(void 0===t)return this.delete(e),this;let{ttl:h=this.ttl,start:u,noDisposeOnSet:v=this.noDisposeOnSet,sizeCalculation:f=this.sizeCalculation,status:x}=o,{noUpdateTTL:g=this.noUpdateTTL}=o,C=en(this,V).call(this,e,t,o.size||0,f);if(this.maxEntrySize&&C>this.maxEntrySize)return x&&(x.set="miss",x.maxEntrySizeExceeded=!0),ec(this,D,J).call(this,e,"set"),this;let b=0===en(this,p)?void 0:en(this,y).get(e);if(void 0===b)b=0===en(this,p)?en(this,M):0!==en(this,E).length?en(this,E).pop():en(this,p)===en(this,c)?ec(this,D,j).call(this,!1):en(this,p),en(this,T)[b]=e,en(this,S)[b]=t,en(this,y).set(e,b),en(this,_)[en(this,M)]=b,en(this,w)[b]=en(this,M),eu(this,M,b),ev(this,p)._++,en(this,$).call(this,b,C,x),x&&(x.set="add"),g=!1;else{ec(this,D,K).call(this,b);let o=en(this,S)[b];if(t!==o){if(en(this,F)&&ec(this,D,H).call(this,o)){o.__abortController.abort(Error("replaced"));let{__staleWhileFetching:t}=o;void 0!==t&&!v&&(en(this,z)&&(null==(r=en(this,m))||r.call(this,t,e,"set")),en(this,I)&&(null==(l=en(this,P))||l.push([t,e,"set"])))}else v||(en(this,z)&&(null==(a=en(this,m))||a.call(this,o,e,"set")),en(this,I)&&(null==(s=en(this,P))||s.push([o,e,"set"])));
1if(en(this,L).call(this,b),en(this,$).call(this,b,C,x),en(this,S)[b]=t,x){x.set="replace";let e=o&&ec(this,D,H).call(this,o)?o.__staleWhileFetching:o;void 0!==e&&(x.oldValue=e)}}else x&&(x.set="update")}if(0===h||en(this,A)||ec(this,D,N).call(this),en(this,A)&&(g||en(this,U).call(this,b,h,u),x&&en(this,W).call(this,x,b)),!v&&en(this,I)&&en(this,P)){let e,t=en(this,P);for(;e=null==t?void 0:t.shift();)null==(n=en(this,d))||n.call(this,...e)}return this}pop(){var e;try{for(;en(this,p);){let e=en(this,S)[en(this,C)];if(ec(this,D,j).call(this,!0),ec(this,D,H).call(this,e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(void 0!==e)return e}}finally{if(en(this,I)&&en(this,P)){let t,o=en(this,P);for(;t=null==o?void 0:o.shift();)null==(e=en(this,d))||e.call(this,...t)}}}has(e,t={}){let{updateAgeOnHas:o=this.updateAgeOnHas,status:r}=t,l=en(this,y).get(e);if(void 0!==l){let e=en(this,S)[l];if(ec(this,D,H).call(this,e)&&void 0===e.__staleWhileFetching)return!1;if(!en(this,G).call(this,l))return o&&en(this,O).call(this,l),r&&(r.has="hit",en(this,W).call(this,r,l)),!0;r&&(r.has="stale",en(this,W).call(this,r,l))}else r&&(r.has="miss");return!1}peek(e,t={}){let{allowStale:o=this.allowStale}=t,r=en(this,y).get(e);if(void 0===r||!o&&en(this,G).call(this,r))return;let l=en(this,S)[r];return ec(this,D,H).call(this,l)?l.__staleWhileFetching:l}async fetch(e,t={}){let{allowStale:o=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:l=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:s=this.noDisposeOnSet,size:n=0,sizeCalculation:h=this.sizeCalculation,noUpdateTTL:u=this.noUpdateTTL,noDeleteOnFetchRejection:c=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:v=this.allowStaleOnFetchRejection,ignoreFetchAbort:m=this.ignoreFetchAbort,allowStaleOnFetchAbort:d=this.allowStaleOnFetchAbort,context:f,forceRefresh:x=!1,status:p,signal:g}=t;if(!en(this,F))return p&&(p.fetch="get"),this.get(e,{allowStale:o,updateAgeOnGet:r,noDeleteOnStaleGet:l,status:p});let T={allowStale:o,updateAgeOnGet:r,noDeleteOnStaleGet:l,ttl:a,noDisposeOnSet:s,size:n,sizeCalculation:h,noUpdateTTL:u,noDeleteOnFetchRejection:c,allowStaleOnFetchRejection:v,allowStaleOnFetchAbort:d,ignoreFetchAbort:m,status:p,signal:g},_=en(this,y).get(e);if(void 0===_){p&&(p.fetch="miss");let t=ec(this,D,X).call(this,e,_,T,f);return t.__returned=t}{let t=en(this,S)[_];if(ec(this,D,H).call(this,t)){let e=o&&void 0!==t.__staleWhileFetching;return p&&(p.fetch="inflight",e&&(p.returnedStale=!0)),e?t.__staleWhileFetching:t.__returned=t}let l=en(this,G).call(this,_);if(!x&&!l)return p&&(p.fetch="hit"),ec(this,D,K).call(this,_),r&&en(this,O).call(this,_),p&&en(this,W).call(this,p,_),t;let a=ec(this,D,X).call(this,e,_,T,f),s=void 0!==a.__staleWhileFetching&&o;return p&&(p.fetch=l?"stale":"refresh",s&&l&&(p.returnedStale=!0)),s?a.__staleWhileFetching:a.__returned=a}}async forceFetch(e,t={}){let o=await this.fetch(e,t);if(void 0===o)throw Error("fetch() returned undefined");return o}memo(e,t={}){let o=en(this,x);if(!o)throw Error("no memoMethod provided to constructor");let{context:r,forceRefresh:l,...a}=t,s=this.get(e,a);if(!l&&void 0!==s)return s;let n=o(e,s,{options:a,context:r});return this.set(e,n,a),n}get(e,t={}){let{allowStale:o=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:l=this.noDeleteOnStaleGet,status:a}=t,s=en(this,y).get(e);if(void 0!==s){let t=en(this,S)[s],n=ec(this,D,H).call(this,t);return a&&en(this,W).call(this,a,s),en(this,G).call(this,s)?(a&&(a.get="stale"),n?(a&&o&&void 0!==t.__staleWhileFetching&&(a.returnedStale=!0),o?t.__staleWhileFetching:void 0):(l||ec(this,D,J).call(this,e,"expire"),a&&o&&(a.returnedStale=!0),o?t:void 0)):(a&&(a.get="hit"),n?t.__staleWhileFetching:(ec(this,D,K).call(this,s),r&&en(this,O).call(this,s),t))}a&&(a.get="miss")}delete(e){return ec(this,D,J).call(this,e,"delete")}clear(){return ec(this,D,Q).call(this,"delete")}},c=new WeakMap,v=new WeakMap,m=new WeakMap,d=new WeakMap,f=new WeakMap,x=new WeakMap,p=new WeakMap,g=new WeakMap,y=new WeakMap,T=new WeakMap,S=new WeakMap,_=new WeakMap,w=new WeakMap,C=new WeakMap,M=new WeakMap,E=new WeakMap,P=new WeakMap,b=new WeakMap,R=new WeakMap,A=new WeakMap,z=new WeakMap,F=new WeakMap,I=new WeakMap,D=new WeakSet,N=function(){let e=new e_(en(this,c)),t=new e_(en(this,c));eu(this,A,e),eu(this,R,t),eu(this,U,(o,r,l=ed.now())=>{if(t[o]=0!==r?l:0,e[o]=r,0!==r&&this.ttlAutopurge){let e=setTimeout(()=>
1{en(this,G).call(this,o)&&ec(this,D,J).call(this,en(this,T)[o],"expire")},r+1);e.unref&&e.unref()}}),eu(this,O,o=>{t[o]=0!==e[o]?ed.now():0}),eu(this,W,(l,a)=>{if(e[a]){let s=e[a],n=t[a];if(!s||!n)return;l.ttl=s,l.start=n,l.now=o||r();let h=l.now-n;l.remainingTTL=s-h}});let o=0,r=()=>{let e=ed.now();if(this.ttlResolution>0){o=e;let t=setTimeout(()=>o=0,this.ttlResolution);t.unref&&t.unref()}return e};this.getRemainingTTL=l=>{let a=en(this,y).get(l);if(void 0===a)return 0;let s=e[a],n=t[a];return s&&n?s-((o||r())-n):1/0},eu(this,G,l=>{let a=t[l],s=e[l];return!!s&&!!a&&(o||r())-a>s})},O=new WeakMap,W=new WeakMap,U=new WeakMap,G=new WeakMap,k=function(){let e=new e_(en(this,c));eu(this,g,0),eu(this,b,e),eu(this,L,t=>{eu(this,g,en(this,g)-e[t]),e[t]=0}),eu(this,V,(e,t,o,r)=>{if(ec(this,D,H).call(this,t))return 0;if(!eT(o))if(r){if("function"!=typeof r)throw TypeError("sizeCalculation must be a function");if(!eT(o=r(t,e)))throw TypeError("sizeCalculation return invalid (expect positive integer)")}else throw TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return o}),eu(this,$,(t,o,r)=>{if(e[t]=o,en(this,v)){let o=en(this,v)-e[t];for(;en(this,g)>o;)ec(this,D,j).call(this,!0)}eu(this,g,en(this,g)+e[t]),r&&(r.entrySize=o,r.totalCalculatedSize=en(this,g))})},L=new WeakMap,$=new WeakMap,V=new WeakMap,B=function*({allowStale:e=this.allowStale}={}){if(en(this,p))for(let t=en(this,M);!(!ec(this,D,Z).call(this,t)||((e||!en(this,G).call(this,t))&&(yield t),t===en(this,C)));)t=en(this,w)[t]},Y=function*({allowStale:e=this.allowStale}={}){if(en(this,p))for(let t=en(this,C);!(!ec(this,D,Z).call(this,t)||((e||!en(this,G).call(this,t))&&(yield t),t===en(this,M)));)t=en(this,_)[t]},Z=function(e){return void 0!==e&&en(this,y).get(en(this,T)[e])===e},j=function(e){var t,o;let r=en(this,C),l=en(this,T)[r],a=en(this,S)[r];return en(this,F)&&ec(this,D,H).call(this,a)?a.__abortController.abort(Error("evicted")):(en(this,z)||en(this,I))&&(en(this,z)&&(null==(t=en(this,m))||t.call(this,a,l,"evict")),en(this,I)&&(null==(o=en(this,P))||o.push([a,l,"evict"]))),en(this,L).call(this,r),e&&(en(this,T)[r]=void 0,en(this,S)[r]=void 0,en(this,E).push(r)),1===en(this,p)?(eu(this,C,eu(this,M,0)),en(this,E).length=0):eu(this,C,en(this,_)[r]),en(this,y).delete(l),ev(this,p)._--,r},X=function(e,t,o,r){let l=void 0===t?void 0:en(this,S)[t];if(ec(this,D,H).call(this,l))return l;let a=new eg,{signal:s}=o;null==s||s.addEventListener("abort",()=>a.abort(s.reason),{signal:a.signal});let n={signal:a.signal,options:o,context:r},h=(r,l=!1)=>{let{aborted:s}=a.signal,h=o.ignoreFetchAbort&&void 0!==r;return(o.status&&(s&&!l?(o.status.fetchAborted=!0,o.status.fetchError=a.signal.reason,h&&(o.status.fetchAbortIgnored=!0)):o.status.fetchResolved=!0),!s||h||l)?(en(this,S)[t]===v&&(void 0===r?v.__staleWhileFetching?en(this,S)[t]=v.__staleWhileFetching:ec(this,D,J).call(this,e,"fetch"):(o.status&&(o.status.fetchUpdated=!0),this.set(e,r,n.options))),r):u(a.signal.reason)},u=r=>{let{aborted:l}=a.signal,s=l&&o.allowStaleOnFetchAbort,n=s||o.allowStaleOnFetchRejection,h=n||o.noDeleteOnFetchRejection;if(en(this,S)[t]===v&&(h&&void 0!==v.__staleWhileFetching?s||(en(this,S)[t]=v.__staleWhileFetching):ec(this,D,J).call(this,e,"fetch")),n)return o.status&&void 0!==v.__staleWhileFetching&&(o.status.returnedStale=!0),v.__staleWhileFetching;if(v.__returned===v)throw r},c=(t,r)=>{var s;let u=null==(s=en(this,f))?void 0:s.call(this,e,l,n);u&&u instanceof Promise&&u.then(e=>t(void 0===e?void 0:e),r),a.signal.addEventListener("abort",()=>{(!o.ignoreFetchAbort||o.allowStaleOnFetchAbort)&&(t(void 0),o.allowStaleOnFetchAbort&&(t=e=>h(e,!0)))})};o.status&&(o.status.fetchDispatched=!0);let v=new Promise(c).then(h,e=>(o.status&&(o.status.fetchRejected=!0,o.status.fetchError=e),u(e))),m=Object.assign(v,{__abortController:a,__staleWhileFetching:l,__returned:void 0});return void 0===t?(this.set(e,m,{...n.options,status:void 0}),t=en(this,y).get(e)):en(this,S)[t]=m,m},H=function(e){return!!en(this,F)&&!!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof eg},q=function(e,t){en(this,w)[t]=e,en(this,_)[e]=t},K=function(e){e!==en(this,M)&&(e===en(this,C)?eu(this,C,en(this,_)[e]):ec(this,D,q).call(this,en(this,w)[e],en(this,_)[e]),ec(this,D,q).call(this,en(this,M),e),eu(this,M,e))},J=function(e,t){var o,r,l,a;let s=!1;if(0!==en(this,p)){let l=en(this,y).get(e);if(void 0!==l)if(s=!0,1===en(this,p))ec(this,D,Q).call(this,t);else{en(this,L).call(this,l);let a=en(this,S)[l];if(ec(this,D,H).call(this,a)?a.__abortController.abort(Error("deleted")):(en(this,z)||en(this,I))&&(en(this,z)&&(null==(o=en(this,m))||o.call(this,a,e,t)),en(this,I)&&(null==(r=en(this,P))||r.push([a,e,t]))),en(this,y).delete(e),en(this,T)[l]=void 0,en(this,S)[l]=void 0,l===en(this,M))eu(this,M,en(this,w)[l]);else if(l===en(this,C))eu(this,C,en(this,_)[l]);else{let e=en(this,w)[l];en(this,_)[e]=en(this,_)[l];let t=en(this,_)[l];en(this,w)[t]=en(this,w)[l]}ev(this,p)._--,en(this,E).push(l)}}if(en(this,I)&&null!=(l=en(this,P))&&l.length){let e,t=en(this,P);for(;e=null==t?void 0:t.shift();)null==(a=en(this,d))||a.call(this,...e)}return s},Q=function(e){var t,o,r;for(let r of ec(this,D,Y).call(this,{allowStale:!0})){let l=en(this,S)[r];if(ec(this,D,H).call(this,l))l.__abortController.abort(Error("deleted"));else{let a=en(this,T)[r];en(this,z)&&(null==(t=en(this,m))||t.call(this,l,a,e)),en(this,I)&&(null==(o=en(this,P))||o.push([l,a,e]))}}if(en(this,y).clear(),en(this,S).fill(void 0),en(this,T).fill(void 0),en(this,A)&&en(this,R)&&(en(this,A).fill(0),en(this,R).fill(0)),en(this,b)&&en(this,b).fill(0),eu(this,C,0),eu(this,M,0),en(this,E).length=0,eu(this,g,0),eu(this,p,0),en(this,I)&&en(this,P)){let e,t=en(this,P);for(;e=null==t?void 0:t.shift();)null==(r=en(this,d))||r.call(this,...e)}},ee);var eM=((r=eM||{})[r.r=0]="r",r[r.g=1]="g",r[r.b=2]="b",r[r.a=3]="a",r);let eE=null,eP=null,eb=null;function eR(e){return`vec4(${(e[0]/255).toFixed(3)},${(e[1]/255).toFixed(3)},${(e[2]/255).toFixed(3)},${((e[3]??255)/255).toFixed(3)})`}function eA(e){return[e[0]/255,e[1]/255,e[2]/255,(e[3]??255)/255]}function ez(e,t){return[e/360,180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360))/360]}function eF(e,t){let o;
1return((0,Math.atan)((0,Math.exp)(-.5*(e/t*2-1)*2*(o=Math.PI)))-o/4)*360/o}let eI=2*Math.PI*6378137;function eD(e,t){return ez(e,t).map(e=>e*eI)}function eN(e,t,o){let r,l=Math.floor(t*e.width),a=Math.floor(o*e.height),s=function e(){return eP&&eb||(eE=new eC({max:null==(eb=(eP=document.createElement("canvas")).getContext("webgl2"))?void 0:eb.getParameter(eb.MAX_TEXTURE_IMAGE_UNITS),dispose:(t,o)=>{e().deleteTexture(t)}})),eb}();if(null==s)throw Error("Failed to obtain WebGL2 context");if(!eE)throw Error("Could not initialize texture cache");s.activeTexture(s.TEXTURE0),eE.has(e)?r=eE.get(e):(r=s.createTexture(),s.bindTexture(s.TEXTURE_2D,r),s.texImage2D(s.TEXTURE_2D,0,s.RGBA,s.RGBA,s.UNSIGNED_BYTE,e),eE.set(e,r));let n=s.createFramebuffer();s.bindFramebuffer(s.FRAMEBUFFER,n),s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,r,0),s.drawBuffers([s.COLOR_ATTACHMENT0]);let h=new Uint8Array(4);return s.readPixels(l,a,1,1,s.RGBA,s.UNSIGNED_BYTE,h),s.deleteFramebuffer(n),{r:h[0]/255,g:h[1]/255,b:h[2]/255,a:h[3]/255}}function eO(e){return["N","NNE","NE","ENE","E","ESE","SE","SSE","S","SSW","SW","WSW","W","WNW","NW","NNW"][Math.round((e+360)%360/22.5)%16]}function eW(e,t){let o,r=[(o=ez(e.lng,e.lat))[0]+.5,-1*o[1]+.5],l=2**t;return{z:t,x:r[0]*l,y:r[1]*l}}var eU=`precision highp float;precision highp sampler2D; 2#define USES_CATEGORIES <uses_categories> 3#define VALUE_NUMBER_CHANNELS <value_number_channels> 4uniform float opacity;uniform float time;uniform sampler2D tex0;uniform sampler2D tex1;uniform float tex0size;uniform float tex1size;uniform float tilePixelSize;uniform bool categorySmoothTransition;uniform bool timeInterpolation;uniform bool interpolateTileEdge;uniform sampler2D texN0;uniform sampler2D texN1;uniform bool availableN;uniform sampler2D texE0;uniform sampler2D texE1;uniform bool availableE;uniform sampler2D texS0;uniform sampler2D texS1;uniform bool availableS;uniform sampler2D texW0;uniform sampler2D texW1;uniform bool availableW;in vec2 tex0coord;in vec2 tex1coord;out vec4 fragColor;<gradient_function_definitions><getColor_code>float xNoTileEdgeInterpolation(sampler2D tex,vec2 texCoord){vec4 texColorFull=texture(tex,texCoord);vec3 texColorFull255=texColorFull.rgb*255.; 5#if (VALUE_NUMBER_CHANNELS == 3) 6vec3 texColor=texColorFull255.<value_channels>;return texColor.r*256.*256.+texColor.g*256.+texColor.b; 7#endif 8#if (VALUE_NUMBER_CHANNELS == 2) 9vec2 texColor=texColorFull255.<value_channels>;return texColor.r*256.+texColor.g; 10#endif 11#if (VALUE_NUMBER_CHANNELS == 1) 12return texColorFull255.<value_channels>; 13#endif 14}vec4 blerp(vec4 color_x0_y0,vec4 color_x0_y1,vec4 color_x1_y0,vec4 color_x1_y1,float x0,float y0,float x1,float y1,float x,float y){vec4 q11=(((x1-x)*(y1-y))/((x1-x0)*(y1-y0)))*color_x0_y0;vec4 q21=(((x-x0)*(y1-y))/((x1-x0)*(y1-y0)))*color_x1_y0;vec4 q12=(((x1-x)*(y-y0))/((x1-x0)*(y1-y0)))*color_x0_y1;vec4 q22=(((x-x0)*(y-y0))/((x1-x0)*(y1-y0)))*color_x1_y1;return q11+q21+q12+q22;}void main(){vec2 tileImageCoord=tex0coord*tilePixelSize;vec2 centerPixelUV=(floor(tileImageCoord)+0.5)/tilePixelSize;float xTex0=xNoTileEdgeInterpolation(tex0,tex0coord);float xTex1=xNoTileEdgeInterpolation(tex1,tex1coord);if(interpolateTileEdge){if(tileImageCoord.x<0.5&&availableW){float xTexW0=xNoTileEdgeInterpolation(texW0,vec2(1.,tex0coord.y));float xTexW1=xNoTileEdgeInterpolation(texW1,vec2(1.,tex0coord.y));float ratioCurrentTile=tileImageCoord.x+0.5;xTex0=ratioCurrentTile*xTex0+(1.-ratioCurrentTile)*xTexW0;xTex1=ratioCurrentTile*xTex1+(1.-ratioCurrentTile)*xTexW1;}else if(tileImageCoord.x>(tilePixelSize-0.5)&&availableE){float xTexE0=xNoTileEdgeInterpolation(texE0,vec2(0.,tex0coord.y));float xTexE1=xNoTileEdgeInterpolation(texE1,vec2(0.,tex0coord.y));float ratioCurrentTile=1.+((tilePixelSize-0.5)-tileImageCoord.x);xTex0=ratioCurrentTile*xTex0+(1.-ratioCurrentTile)*xTexE0;xTex1=ratioCurrentTile*xTex1+(1.-ratioCurrentTile)*xTexE1;}if(tileImageCoord.y<0.5&&availableS){float xTexS0=xNoTileEdgeInterpolation(texS0,vec2(tex0coord.x,1.));float xTexS1=xNoTileEdgeInterpolation(texS1,vec2(tex0coord.x,1.));float ratioCurrentTile=tileImageCoord.y+0.5;xTex0=ratioCurrentTile*xTex0+(1.-ratioCurrentTile)*xTexS0;xTex1=ratioCurrentTile*xTex1+(1.-ratioCurrentTile)*xTexS1;}else if(tileImageCoord.y>(tilePixelSize-0.5)&&availableN){float xTexN0=xNoTileEdgeInterpolation(texN0,vec2(tex0coord.x,0.));float xTexN1=xNoTileEdgeInterpolation(texN1,vec2(tex0coord.x,0.));float ratioCurrentTile=1.+((tilePixelSize-0.5)-tileImageCoord.y);xTex0=ratioCurrentTile*xTex0+(1.-ratioCurrentTile)*xTexN0;xTex1=ratioCurrentTile*xTex1+(1.-ratioCurrentTile)*xTexN1;}}
14float x=timeInterpolation ? mix(xTex0,xTex1,time):(time<0.5 ? xTex0 : xTex1);float polynomialCoefDegree2=<polynomialCoefDegree2>;float polynomialCoefDegree1=<polynomialCoefDegree1>;float polynomialConstant=<polynomialConstant>;float y=polynomialCoefDegree2*x*x+polynomialCoefDegree1*x+polynomialConstant;int category=0; 15#if (USES_CATEGORIES == 1) 16category=int((time<0.5 ? texture(tex0,centerPixelUV).a : texture(tex1,centerPixelUV).a)*255.); 17#endif 18vec4 color_Center=getColor(category,y);vec4 color=vec4(0.,0.,0.,0.);if(categorySmoothTransition){vec2 centerPixelUV_N=vec2((floor(tex0coord.x*tilePixelSize)+0.5)/tilePixelSize,(floor(tex0coord.y*tilePixelSize)+0.5+1.)/tilePixelSize);vec2 centerPixelUV_S=vec2((floor(tex0coord.x*tilePixelSize)+0.5)/tilePixelSize,(floor(tex0coord.y*tilePixelSize)+0.5-1.)/tilePixelSize);vec2 centerPixelUV_E=vec2((floor(tex0coord.x*tilePixelSize)+0.5+1.)/tilePixelSize,(floor(tex0coord.y*tilePixelSize)+0.5)/tilePixelSize);vec2 centerPixelUV_W=vec2((floor(tex0coord.x*tilePixelSize)+0.5-1.)/tilePixelSize,(floor(tex0coord.y*tilePixelSize)+0.5)/tilePixelSize);if(tex0coord.x>=centerPixelUV.x){int category_E=0; 19#if (USES_CATEGORIES == 1) 20category_E=int((time<0.5 ? texture(tex0,centerPixelUV_E).<category_channel>: texture(tex1,centerPixelUV_E).<category_channel>)*255.); 21#endif 22vec4 color_E=getColor(category_E,y);if(tex0coord.y>=centerPixelUV.y){int category_N=0; 23#if (USES_CATEGORIES == 1) 24category_N=int((time<0.5 ? texture(tex0,centerPixelUV_N).<category_channel>: texture(tex1,centerPixelUV_N).<category_channel>)*255.); 25#endif 26vec4 color_N=getColor(category_N,y);vec2 centerPixelUV_NE=vec2((floor(tex0coord.x*tilePixelSize)+0.5+1.)/tilePixelSize,(floor(tex0coord.y*tilePixelSize)+0.5+1.)/tilePixelSize);int category_NE=0; 27#if (USES_CATEGORIES == 1) 28category_NE=int((time<0.5 ? texture(tex0,centerPixelUV_NE).<category_channel>: texture(tex1,centerPixelUV_NE).<category_channel>)*255.); 29#endif 30vec4 color_NE=getColor(category_NE,y);color=blerp(color_Center,color_N,color_E,color_NE,centerPixelUV.x,centerPixelUV.y,centerPixelUV_NE.x,centerPixelUV_NE.y,tex0coord.x,tex0coord.y);}else{int category_S=0; 31#if (USES_CATEGORIES == 1) 32category_S=int((time<0.5 ? texture(tex0,centerPixelUV_S).<category_channel>: texture(tex1,centerPixelUV_S).<category_channel>)*255.); 33#endif 34vec4 color_S=getColor(category_S,y);vec2 centerPixelUV_SE=vec2((floor(tex0coord.x*tilePixelSize)+0.5+1.)/tilePixelSize,(floor(tex0coord.y*tilePixelSize)+0.5-1.)/tilePixelSize);int category_SE=0; 35#if (USES_CATEGORIES == 1) 36category_SE=int((time<0.5 ? texture(tex0,centerPixelUV_SE).<category_channel>: texture(tex1,centerPixelUV_SE).<category_channel>)*255.); 37#endif 38vec4 color_SE=getColor(category_SE,y);
38color=blerp(color_S,color_Center,color_SE,color_E,centerPixelUV_S.x,centerPixelUV_S.y,centerPixelUV_E.x,centerPixelUV_E.y,tex0coord.x,tex0coord.y);}}else{int category_W=0; 39#if (USES_CATEGORIES == 1) 40category_W=int((time<0.5 ? texture(tex0,centerPixelUV_W).<category_channel>: texture(tex1,centerPixelUV_W).<category_channel>)*255.); 41#endif 42vec4 color_W=getColor(category_W,y);if(tex0coord.y>=centerPixelUV.y){int category_N=0; 43#if (USES_CATEGORIES == 1) 44category_N=int((time<0.5 ? texture(tex0,centerPixelUV_N).<category_channel>: texture(tex1,centerPixelUV_N).<category_channel>)*255.); 45#endif 46vec4 color_N=getColor(category_N,y);vec2 centerPixelUV_NW=vec2((floor(tex0coord.x*tilePixelSize)+0.5-1.)/tilePixelSize,(floor(tex0coord.y*tilePixelSize)+0.5+1.)/tilePixelSize);int category_NW=0; 47#if (USES_CATEGORIES == 1) 48category_NW=int((time<0.5 ? texture(tex0,centerPixelUV_NW).<category_channel>: texture(tex1,centerPixelUV_NW).<category_channel>)*255.); 49#endif 50vec4 color_NW=getColor(category_NW,y);color=blerp(color_W,color_NW,color_Center,color_N,centerPixelUV_W.x,centerPixelUV_W.y,centerPixelUV_N.x,centerPixelUV_N.y,tex0coord.x,tex0coord.y);}else{int category_S=0; 51#if (USES_CATEGORIES == 1) 52category_S=int((time<0.5 ? texture(tex0,centerPixelUV_S).<category_channel>: texture(tex1,centerPixelUV_S).<category_channel>)*255.); 53#endif 54vec4 color_S=getColor(category_S,y);vec2 centerPixelUV_SW=vec2((floor(tex0coord.x*tilePixelSize)+0.5-1.)/tilePixelSize,(floor(tex0coord.y*tilePixelSize)+0.5-1.)/tilePixelSize);int category_SW=0; 55#if (USES_CATEGORIES == 1) 56category_SW=int((time<0.5 ? texture(tex0,centerPixelUV_SW).<category_channel>: texture(tex1,centerPixelUV_SW).<category_channel>)*255.); 57#endif 58vec4 color_SW=getColor(category_SW,y);color=blerp(color_SW,color_W,color_S,color_Center,centerPixelUV_SW.x,centerPixelUV_SW.y,centerPixelUV.x,centerPixelUV.y,tex0coord.x,tex0coord.y);}}}else{color=color_Center;}color.a*=opacity;fragColor=color;}`;function eG(e,t,o={inputName:"v",outputName:"c"}){let r=function e(t,o=50){return t.length<=o?t:e(t.filter((e,o)=>0===o||o%2||o===t.length-1),o)}(e),l="";for(let e=0;e<r.length;e++){let a=r[e];0===e&&(l+=`vec4 ${o.outputName}=${eR(a.color)}; 59`);let s=a.value,n=eR(a.color);if(t&&e+1<r.length){let t=r[e+1].value,a=eR(r[e+1].color),h=0===Number.parseFloat((s-t).toFixed(7))?"0.":`(${o.inputName} - ${s.toFixed(7)}) / (${(t-s).toFixed(7)})`;l+=`${e>0?" else ":""} if(${o.inputName}>=${s.toFixed(7)}&&${o.inputName}<${t.toFixed(7)}) { ${o.outputName}=mix(${n},${a}, ${h} ); } 60`}else l+=`if(${o.inputName}>=${s.toFixed(7)})${o.outputName}=${n}; 61`}return l}class ek{constructor(e,t){this.code=e,this.decode=t,this.decode.min=this.decode.min??0,this.decode.max=this.decode.max??1}codeValue(e){return(e-this.decode.min)/(this.decode.max-this.decode.min)}decodeValue(e){return this.decode.min+e*(this.decode.max-this.decode.min)}decodeChannel(e){if(this.decode.channel.length>1){let t=this.decodeValue(e[this.decode.channel[0]]),o=this.decodeValue(e[this.decode.channel[1]]);return[t,o,Math.sqrt(t*t+o*o)]}return this.decodeValue(e[this.decode.channel])}getBlendCode(e){let t=`${this.code} d.rgb=(d.rgb*d.a*(1.-c.a)+c.rgb*c.a)/(d.a*(1.-c.a)+c.a); d.a=d.a+c.a*(1.-d.a);`;return`vec4 ${e}(vec4 d,vec4 data){${t}return d;}`}getCode(e){return`vec4 ${e}(vec4 data){${this.code}return c;}`}}class eL extends ek{constructor(e){const t=e.decode,o=e.stops||[{value:t.min,color:[0,0,0,0]},{value:t.max,color:[255,255,255,255]}],r=e.smooth??!0,l=e.opacity??1;let a=function({channel:e="r",min:t=0,max:o=1}){let r=`${t.toFixed(7)}+data.${e}*${(o-t).toFixed(7)}`;return e.length>1&&(r=`length(${r})`),`float v=${r};`}(t);a+=eG(o,r),super(a+=`c.a*=${l.toFixed(3)};`,t)}}class e${constructor(e){ea(this,"decode",{polynomialCoefDegree2:0,polynomialCoefDegree1:1,polynomialConstant:0}),ea(this,"stopsPerCategory",[{category:"all",stops:[{value:0,color:[0,0,0]},{value:255,color:[255,255,255]}]}]),ea(this,"smooth"),ea(this,"opacity"),ea(this,"code"),ea(this,"categoryChannel"),ea(this,"valueChannels"),ea(this,"valueNumberOfChannels"),this.decode=e.decode,this.stopsPerCategory=e.stopsPerCategory,this.smooth=e.smooth??!0,this.opacity=e.opacity??1,this.categoryChannel=e.categoryChannel??"a",this.valueChannels=e.valueChannels??"rgb",this.valueNumberOfChannels=this.valueChannels.length;const t=this.stopsPerCategory.filter(e=>{if("all"!==e.category&&"number"!=typeof e.category)throw Error("The category can only be a number or the string 'all'.");return"all"===e.category});let o=this.stopsPerCategory;t.length&&(o=t);const r=o.map(e=>`vec4 _mccf_${e.category}(float v) { 62${eG(e.stops,this.smooth)}return c;} 63`).join(` 64`);let l=`vec4 getColor(int category, float v) { 65`;l+=`vec4 outputColor; 66`,t.length?l+=`outputColor = _mccf_all(v); 67`:(l+=this.stopsPerCategory.map((e,t)=>`${0===t?"":"else "}if (category == ${e.category}) outputColor = _mccf_${e.category}(v);`).join(` 68`),l+=` 69 else outputColor = vec4(0., 0., 0., 0.); 70`),l+=`outputColor.a *= ${this.opacity.toFixed(3)}; 71`,l+=`return outputColor;}
72`,this.code=eU.replace("<gradient_function_definitions>",r).replace("<getColor_code>",l).replace("<polynomialCoefDegree2>",this.decode.polynomialCoefDegree2.toFixed(7)).replace("<polynomialCoefDegree1>",this.decode.polynomialCoefDegree1.toFixed(7)).replace("<polynomialConstant>",this.decode.polynomialConstant.toFixed(7)).replace("<uses_categories>",t.length?"0":"1").replace("<value_number_channels>",this.valueNumberOfChannels.toFixed()).replaceAll("<category_channel>",this.categoryChannel).replaceAll("<value_channels>",this.valueChannels)}getCode(){return this.code}decodeChannel_ORIG(e){let t={r:255*e.r,g:255*e.g,b:255*e.b,a:255*e.a},o=256*t.r*256+256*t.g+t.b;return[this.decode.polynomialCoefDegree2*o*o+this.decode.polynomialCoefDegree1*o+this.decode.polynomialConstant,t.a]}decodeChannel(e){let t={r:255*e.r,g:255*e.g,b:255*e.b,a:255*e.a},o=this.valueChannels.split(""),r=0;return 1===this.valueNumberOfChannels?r=t[o[0]]:2===this.valueNumberOfChannels?r=256*t[o[0]]+t[o[1]]:3===this.valueNumberOfChannels&&(r=256*t[o[0]]*256+256*t[o[1]]+t[o[2]]),[this.decode.polynomialCoefDegree2*r*r+this.decode.polynomialCoefDegree1*r+this.decode.polynomialConstant,t[this.categoryChannel]]}}let eV=class e extends Array{constructor(e={}){super(),ea(this,"min",0),ea(this,"max",1),"min"in e&&(this.min=e.min),"max"in e&&(this.max=e.max),"stops"in e&&this.setStops(e.stops,{clone:!1})}static fromArrayDefinition(t){return new e({stops:t.map(e=>({value:e[0],color:e[1]}))})}setStops(e,t={clone:!0}){let o=t.clone?this.clone():this;o.length=0;let r=1/0,l=-1/0;for(let t=0;t<e.length;t+=1)r=Math.min(r,e[t].value),l=Math.max(l,e[t].value),o.push({value:e[t].value,color:e[t].color.slice()});return o.sort((e,t)=>e.value<t.value?-1:1),this.min=r,this.max=l,o}scale(t,o,r={clone:!0}){let l=r.clone,a=this[0].value,s=this.at(-1).value-a,n=o-t,h=[];for(let e=0;e<this.length;e+=1){let o=(this[e].value-a)/s*n+t;l?h.push({value:o,color:this[e].color.slice()}):this[e].value=o}return l?new e({stops:h}):this}at(e){return e<0?this[this.length+e]:this[e]}clone(){return new e({stops:this.getRawColorStops()})}getRawColorStops(){let e=[];for(let t=0;t<this.length;t+=1)e.push(this[t]);return e}reverse(e={clone:!0}){let t=e.clone?this.clone():this;for(let e=0;e<~~(t.length/2);e+=1){let o=t[e].color;t[e].color=t.at(-(e+1)).color,t.at(-(e+1)).color=o}return t}getBounds(){return{min:this.min,max:this.max}}getColor(e,t={smooth:!0}){if(e<=this[0].value)return this[0].color;if(e>=this.at(-1).value)return this.at(-1).color;for(let o=0;o<this.length-1;o+=1){if(e>this[o+1].value)continue;let r=this[o].color;if(!t.smooth)return r.slice();let l=this[o].value,a=this[o+1].value,s=this[o+1].color,n=(a-e)/(a-l);return r.map((e,t)=>Math.round(e*n+s[t]*(1-n)))}return[0,0,0]}getCanvasStrip(e={horizontal:!0,size:512,smooth:!0}){let t=document.createElement("canvas");t.width=e.horizontal?e.size:1,t.height=e.horizontal?1:e.size;let o=t.getContext("2d");if(!o)throw Error("Canvs context is missing");let r=o.getImageData(0,0,t.width,t.height),l=r.data,a=e.size,s=this[0].value,n=(this.at(-1).value-s)/a;for(let t=0;t<a;t+=1){let o=this.getColor(s+t*n,{smooth:e.smooth});l[4*t]=o[0],l[4*t+1]=o[1],l[4*t+2]=o[2],l[4*t+3]=o.length>3?o[3]:255}return o.putImageData(r,0,0),t}};ea(eV,"builtin",{NULL:new eV({stops:[{value:0,color:[0,0,0,0]},{value:1,color:[0,0,0,0]}]}),JET:new eV({stops:[{value:0,color:[0,0,131]},{value:.125,color:[0,60,170]},{value:.375,color:[5,255,255]},{value:.625,color:[255,255,0]},{value:.875,color:[250,0,0]},{value:1,color:[128,0,0]}]}),HSV:new eV({stops:[{value:0,color:[255,0,0]},{value:.169,color:[253,255,2]},{value:.173,color:[247,255,2]},{value:.337,color:[0,252,4]},{value:.341,color:[0,252,10]},{value:.506,color:[1,249,255]},{value:.671,color:[2,0,253]},{value:.675,color:[8,0,253]},{value:.839,color:[255,0,251]},{value:.843,color:[255,0,245]},{value:1,color:[255,0,6]}]}),HOT:new eV({stops:[{value:0,color:[0,0,0]},{value:.3,color:[230,0,0]},{value:.6,color:[255,210,0]},{value:1,color:[255,255,255]}]}),SPRING:new eV({stops:[{value:0,color:[255,0,255]},{value:1,color:[255,255,0]}]}),SUMMER:new eV({stops:[{value:0,color:[0,128,102]},{value:1,color:[255,255,102]}]}),AUTOMN:new eV({stops:[{value:0,color:[255,0,0]},{value:1,color:[255,255,0]}]}),WINTER:new eV({stops:[{value:0,color:[0,0,255]},{value:1,color:[0,255,128]}]}),BONE:new eV({stops:[{value:0,color:[0,0,0]},{value:.376,color:[84,84,116]},{value:.753,color:[169,200,200]},{value:1,color:[255,255,255]}]}),COPPER:new eV({stops:[{value:0,color:[0,0,0]},{value:.804,color:[255,160,102]},{value:1,color:[255,199,127]}]}),GREYS:new eV({stops:[{value:0,color:[0,0,0]},{value:1,color:[255,255,255]}]}),YIGNBU:new eV({stops:[{value:0,color:[8,29,88]},{value:.125,color:[37,52,148]},{value:.25,color:[34,94,168]},{value:.375,color:[29,145,192]},{value:.5,color:[65,182,196]},{value:.625,color:[127,205,187]}
72,{value:.75,color:[199,233,180]},{value:.875,color:[237,248,217]},{value:1,color:[255,255,217]}]}),GREENS:new eV({stops:[{value:0,color:[0,68,27]},{value:.125,color:[0,109,44]},{value:.25,color:[35,139,69]},{value:.375,color:[65,171,93]},{value:.5,color:[116,196,118]},{value:.625,color:[161,217,155]},{value:.75,color:[199,233,192]},{value:.875,color:[229,245,224]},{value:1,color:[247,252,245]}]}),YIORRD:new eV({stops:[{value:0,color:[128,0,38]},{value:.125,color:[189,0,38]},{value:.25,color:[227,26,28]},{value:.375,color:[252,78,42]},{value:.5,color:[253,141,60]},{value:.625,color:[254,178,76]},{value:.75,color:[254,217,118]},{value:.875,color:[255,237,160]},{value:1,color:[255,255,204]}]}),BLUERED:new eV({stops:[{value:0,color:[0,0,255]},{value:1,color:[255,0,0]}]}),RDBU:new eV({stops:[{value:0,color:[5,10,172]},{value:.35,color:[106,137,247]},{value:.5,color:[190,190,190]},{value:.6,color:[220,170,132]},{value:.7,color:[230,145,90]},{value:1,color:[178,10,28]}]}),PICNIC:new eV({stops:[{value:0,color:[0,0,255]},{value:.1,color:[51,153,255]},{value:.2,color:[102,204,255]},{value:.3,color:[153,204,255]},{value:.4,color:[204,204,255]},{value:.5,color:[255,255,255]},{value:.6,color:[255,204,255]},{value:.7,color:[255,153,255]},{value:.8,color:[255,102,204]},{value:.9,color:[255,102,102]},{value:1,color:[255,0,0]}]}),RAINBOW:new eV({stops:[{value:0,color:[150,0,90]},{value:.125,color:[0,0,200]},{value:.25,color:[0,25,255]},{value:.375,color:[0,152,255]},{value:.5,color:[44,255,150]},{value:.625,color:[151,255,0]},{value:.75,color:[255,234,0]},{value:.875,color:[255,111,0]},{value:1,color:[255,0,0]}]}),PORTLAND:new eV({stops:[{value:0,color:[12,51,131]},{value:.25,color:[10,136,186]},{value:.5,color:[242,211,56]},{value:.75,color:[242,143,56]},{value:1,color:[217,30,30]}]}),BLACKBODY:new eV({stops:[{value:0,color:[0,0,0]},{value:.2,color:[230,0,0]},{value:.4,color:[230,210,0]},{value:.7,color:[255,255,255]},{value:1,color:[160,200,255]}]}),EARTH:new eV({stops:[{value:0,color:[0,0,130]},{value:.1,color:[0,180,180]},{value:.2,color:[40,210,40]},{value:.4,color:[230,230,50]},{value:.6,color:[120,70,20]},{value:1,color:[255,255,255]}]}),ELECTRIC:new eV({stops:[{value:0,color:[0,0,0]},{value:.15,color:[30,0,100]},{value:.4,color:[120,0,100]},{value:.6,color:[160,90,0]},{value:.8,color:[230,200,0]},{value:1,color:[255,250,220]}]}),VIRIDIS:new eV({stops:[{value:0,color:[68,1,84]},{value:.13,color:[71,44,122]},{value:.25,color:[59,81,139]},{value:.38,color:[44,113,142]},{value:.5,color:[33,144,141]},{value:.63,color:[39,173,129]},{value:.75,color:[92,200,99]},{value:.88,color:[170,220,50]},{value:1,color:[253,231,37]}]}),INFERNO:new eV({stops:[{value:0,color:[0,0,4]},{value:.13,color:[31,12,72]},{value:.25,color:[85,15,109]},{value:.38,color:[136,34,106]},{value:.5,color:[186,54,85]},{value:.63,color:[227,89,51]},{value:.75,color:[249,140,10]},{value:.88,color:[249,201,50]},{value:1,color:[252,255,164]}]}),MAGMA:new eV({stops:[{value:0,color:[0,0,4]},{value:.13,color:[28,16,68]},{value:.25,color:[79,18,123]},{value:.38,color:[129,37,129]},{value:.5,color:[181,54,122]},{value:.63,color:[229,80,100]},{value:.75,color:[251,135,97]},{value:.88,color:[254,194,135]},{value:1,color:[252,253,191]}]}),PLASMA:new eV({stops:[{value:0,color:[13,8,135]},{value:.13,color:[75,3,161]},{value:.25,color:[125,3,168]},{value:.38,color:[168,34,150]},{value:.5,color:[203,70,121]},{value:.63,color:[229,107,93]},{value:.75,color:[248,148,65]},{value:.88,color:[253,195,40]},{value:1,color:[240,249,33]}]}),WARM:new eV({stops:[{value:0,color:[125,0,179]},{value:.13,color:[172,0,187]},{value:.25,color:[219,0,170]},{value:.38,color:[255,0,130]},{value:.5,color:[255,63,74]},{value:.63,color:[255,123,0]},{value:.75,color:[234,176,0]},{value:.88,color:[190,228,0]},{value:1,color:[147,255,0]}]}),COOL:new eV({stops:[{value:0,color:[125,0,179]},{value:.13,color:[116,0,218]},{value:.25,color:[98,74,237]},{value:.38,color:[68,146,231]},{value:.5,color:[0,204,197]},{value:.63,color:[0,247,146]},{value:.75,color:[0,255,88]},{value:.88,color:[40,255,8]},{value:1,color:[147,255,0]}]}),RAINBOW_SOFT:new eV({stops:[{value:0,color:[125,0,179]},{value:.1,color:[199,0,180]},{value:.2,color:[255,0,121]},{value:.3,color:[255,108,0]},{value:.4,color:[222,194,0]},{value:.5,color:[150,255,0]},{value:.6,color:[0,255,55]},{value:.7,color:[0,246,150]},{value:.8,color:[50,167,222]},{value:.9,color:[103,51,235]},{value:1,color:[124,0,186]}]}),BATHYMETRY:new eV({stops:[{value:0,color:[40,26,44]},{value:.13,color:[59,49,90]},{value:.25,color:[64,76,139]},{value:.38,color:[63,110,151]},{value:.5,color:[72,142,158]},{value:.63,color:[85,174,163]}
72,{value:.75,color:[120,206,163]},{value:.88,color:[187,230,172]},{value:1,color:[253,254,204]}]}),CDOM:new eV({stops:[{value:0,color:[47,15,62]},{value:.13,color:[87,23,86]},{value:.25,color:[130,28,99]},{value:.38,color:[171,41,96]},{value:.5,color:[206,67,86]},{value:.63,color:[230,106,84]},{value:.75,color:[242,149,103]},{value:.88,color:[249,193,135]},{value:1,color:[254,237,176]}]}),CHLOROPHYLL:new eV({stops:[{value:0,color:[18,36,20]},{value:.13,color:[25,63,41]},{value:.25,color:[24,91,59]},{value:.38,color:[13,119,72]},{value:.5,color:[18,148,80]},{value:.63,color:[80,173,89]},{value:.75,color:[132,196,122]},{value:.88,color:[175,221,162]},{value:1,color:[215,249,208]}]}),DENSITY:new eV({stops:[{value:0,color:[54,14,36]},{value:.13,color:[89,23,80]},{value:.25,color:[110,45,132]},{value:.38,color:[120,77,178]},{value:.5,color:[120,113,213]},{value:.63,color:[115,151,228]},{value:.75,color:[134,185,227]},{value:.88,color:[177,214,227]},{value:1,color:[230,241,241]}]}),FREESURFACE_BLUE:new eV({stops:[{value:0,color:[30,4,110]},{value:.13,color:[47,14,176]},{value:.25,color:[41,45,236]},{value:.38,color:[25,99,212]},{value:.5,color:[68,131,200]},{value:.63,color:[114,156,197]},{value:.75,color:[157,181,203]},{value:.88,color:[200,208,216]},{value:1,color:[241,237,236]}]}),FREESURFACE_RED:new eV({stops:[{value:0,color:[60,9,18]},{value:.13,color:[100,17,27]},{value:.25,color:[142,20,29]},{value:.38,color:[177,43,27]},{value:.5,color:[192,87,63]},{value:.63,color:[205,125,105]},{value:.75,color:[216,162,148]},{value:.88,color:[227,199,193]},{value:1,color:[241,237,236]}]}),OXYGEN:new eV({stops:[{value:0,color:[64,5,5]},{value:.13,color:[106,6,15]},{value:.25,color:[144,26,7]},{value:.38,color:[168,64,3]},{value:.5,color:[188,100,4]},{value:.63,color:[206,136,11]},{value:.75,color:[220,174,25]},{value:.88,color:[231,215,44]},{value:1,color:[248,254,105]}]}),PAR:new eV({stops:[{value:0,color:[51,20,24]},{value:.13,color:[90,32,35]},{value:.25,color:[129,44,34]},{value:.38,color:[159,68,25]},{value:.5,color:[182,99,19]},{value:.63,color:[199,134,22]},{value:.75,color:[212,171,35]},{value:.88,color:[221,210,54]},{value:1,color:[225,253,75]}]}),PHASE:new eV({stops:[{value:0,color:[145,105,18]},{value:.13,color:[184,71,38]},{value:.25,color:[186,58,115]},{value:.38,color:[160,71,185]},{value:.5,color:[110,97,218]},{value:.63,color:[50,123,164]},{value:.75,color:[31,131,110]},{value:.88,color:[77,129,34]},{value:1,color:[145,105,18]}]}),SALINITY:new eV({stops:[{value:0,color:[42,24,108]},{value:.13,color:[33,50,162]},{value:.25,color:[15,90,145]},{value:.38,color:[40,118,137]},{value:.5,color:[59,146,135]},{value:.63,color:[79,175,126]},{value:.75,color:[120,203,104]},{value:.88,color:[193,221,100]},{value:1,color:[253,239,154]}]}),TEMPERATURE:new eV({stops:[{value:0,color:[4,35,51]},{value:.13,color:[23,51,122]},{value:.25,color:[85,59,157]},{value:.38,color:[129,79,143]},{value:.5,color:[175,95,130]},{value:.63,color:[222,112,101]},{value:.75,color:[249,146,66]},{value:.88,color:[249,196,65]},{value:1,color:[232,250,91]}]}),TURBIDITY:new eV({stops:[{value:0,color:[34,31,27]},{value:.13,color:[65,50,41]},{value:.25,color:[98,69,52]},{value:.38,color:[131,89,57]},{value:.5,color:[161,112,59]},{value:.63,color:[185,140,66]},{value:.75,color:[202,174,88]},{value:.88,color:[216,209,126]},{value:1,color:[233,246,171]}]}),VELOCITY_BLUE:new eV({stops:[{value:0,color:[17,32,64]},{value:.13,color:[35,52,116]},{value:.25,color:[29,81,156]},{value:.38,color:[31,113,162]},{value:.5,color:[50,144,169]},{value:.63,color:[87,173,176]},{value:.75,color:[149,196,189]},{value:.88,color:[203,221,211]},{value:1,color:[254,251,230]}]}),VELOCITY_GREEN:new eV({stops:[{value:0,color:[23,35,19]},{value:.13,color:[24,64,38]},{value:.25,color:[11,95,45]},{value:.38,color:[39,123,35]},{value:.5,color:[95,146,12]},{value:.63,color:[152,165,18]},{value:.75,color:[201,186,69]},{value:.88,color:[233,216,137]},{value:1,color:[255,253,205]}]}),CUBEHELIX:new eV({stops:[{value:0,color:[0,0,0]},{value:.07,color:[22,5,59]},{value:.13,color:[60,4,105]},{value:.2,color:[109,1,135]},{value:.27,color:[161,0,147]},{value:.33,color:[210,2,142]},{value:.4,color:[251,11,123]},{value:.47,color:[255,29,97]},{value:.53,color:[255,54,69]},{value:.6,color:[255,85,46]},{value:.67,color:[255,120,34]},{value:.73,color:[255,157,37]},{value:.8,color:[241,191,57]},{value:.87,color:[224,220,93]},{value:.93,color:[218,241,142]},{value:1,color:[227,253,198]}]}),CIVIDIS:new eV({stops:[{value:0,color:[0,32,77,255]},{value:.125,color:[5,54,110,255]},{value:.25,color:[65,77,108,255]},{value:.375,color:[97,100,111,255]},{value:.5,color:[125,124,121,255]},{value:.625,color:[156,149,120,255]}
72,{value:.75,color:[190,175,111,255]},{value:.875,color:[225,204,94,255]},{value:1,color:[255,235,70,255]}]}),TURBO:new eV({stops:[{value:0,color:[48,18,59,255]},{value:.125,color:[70,107,227,255]},{value:.25,color:[40,187,236,255]},{value:.375,color:[49,242,153,255]},{value:.5,color:[162,252,60,255]},{value:.625,color:[237,208,58,255]},{value:.75,color:[251,128,34,255]},{value:.875,color:[210,49,5,255]},{value:1,color:[122,4,3,255]}]}),ROCKET:new eV({stops:[{value:0,color:[250,235,221,0]},{value:.133,color:[250,235,221,255]},{value:.266,color:[246,170,130,255]},{value:.4,color:[240,96,67,255]},{value:.533,color:[203,27,79,255]},{value:.666,color:[132,30,90,255]},{value:.8,color:[63,27,68,255]},{value:1,color:[3,5,26,255]}]}),MAKO:new eV({stops:[{value:0,color:[11,4,5,255]},{value:.125,color:[43,28,53,255]},{value:.25,color:[62,53,107,255]},{value:.375,color:[59,86,152,255]},{value:.5,color:[53,123,162,255]},{value:.625,color:[53,158,170,255]},{value:.75,color:[73,193,173,255]},{value:.875,color:[150,221,181,255]},{value:1,color:[222,245,229,255]}]}),TERRAIN:new eV({stops:[{value:-10001,color:[0,20,60]},{value:-5e3,color:[0,10,30]},{value:-1e3,color:[0,30,80]},{value:-100,color:[0,38,115]},{value:0,color:[122,200,255]},{value:10,color:[51,102,0]},{value:500,color:[129,195,31]},{value:800,color:[255,255,204]},{value:1200,color:[244,189,69]},{value:2e3,color:[132,75,0]},{value:3e3,color:[102,51,12]},{value:8e3,color:[255,255,255]}]}),PRESSURE:new eV({stops:[{value:900,color:[0,0,100,250]},{value:950,color:[0,0,255,250]},{value:980,color:[0,0,255,120]},{value:1e3,color:[255,255,255,0]},{value:1020,color:[255,0,0,120]},{value:1080,color:[255,0,0,250]}]}),PRESSURE_2:new eV({stops:[{value:900,color:[8,16,48,255]},{value:950,color:[0,32,96,255]},{value:976,color:[0,52,146,255]},{value:986,color:[0,90,148,255]},{value:995,color:[0,117,146,255]},{value:1002,color:[26,140,147,255]},{value:1007,color:[103,162,155,255]},{value:1011,color:[155,183,172,255]},{value:1013,color:[182,182,182,255]},{value:1015,color:[176,174,152,255]},{value:1019,color:[167,147,107,255]},{value:1024,color:[163,116,67,255]},{value:1030,color:[159,81,44,255]},{value:1038,color:[142,47,57,255]},{value:1046,color:[111,24,64,255]},{value:1080,color:[48,8,24,255]}]}),PRESSURE_3:new eV({stops:[{value:900,color:[40,46,117,255]},{value:950,color:[40,51,121,255]},{value:976,color:[42,63,125,255]},{value:986,color:[55,97,141,255]},{value:995,color:[69,115,150,255]},{value:1002,color:[87,144,168,255]},{value:1007,color:[125,184,194,255]},{value:1011,color:[195,226,226,255]},{value:1013,color:[245,220,196,255]},{value:1015,color:[232,191,160,255]},{value:1019,color:[219,154,125,255]},{value:1024,color:[210,115,98,255]},{value:1030,color:[194,72,67,255]},{value:1038,color:[199,61,60,255]},{value:1046,color:[177,50,54,255]},{value:1080,color:[159,42,48,255]}]}),PRESSURE_4:new eV({stops:[{value:900,color:[40,46,117,255]},{value:950,color:[40,51,121,255]},{value:976,color:[42,63,125,255]},{value:986,color:[55,97,141,255]},{value:995,color:[69,115,150,255]},{value:1002,color:[87,144,168,255]},{value:1007,color:[125,184,194,255]},{value:1012.5,color:[226,226,226,255]},{value:1013.5,color:[226,226,226,255]},{value:1015,color:[232,191,160,255]},{value:1019,color:[219,154,125,255]},{value:1024,color:[210,115,98,255]},{value:1030,color:[194,72,67,255]},{value:1038,color:[199,61,60,255]},{value:1046,color:[177,50,54,255]},{value:1080,color:[159,42,48,255]}]}),TEMPERATURE_2:new eV({stops:[{value:-70.15,color:[115,70,105,255]},{value:-55.15,color:[202,172,195,255]},{value:-40.15,color:[162,70,145,255]},{value:-25.15,color:[143,89,169,255]},{value:-15.15,color:[157,219,217,255]},{value:-8.15,color:[106,191,181,255]},{value:-4.15,color:[100,166,189,255]},{value:0,color:[93,133,198,255]},{value:.85,color:[68,125,99,255]},{value:9.85,color:[128,147,24,255]},{value:20.85,color:[243,183,4,255]},{value:29.85,color:[232,83,25,255]},{value:46.85,color:[71,14,0,255]}]}),TEMPERATURE_3:new eV({stops:[{value:-65,color:[3,78,77,255]},{value:-55,color:[4,98,96,255]},{value:-40,color:[5,122,120,255]},{value:-30,color:[6,152,149,255]},{value:-20,color:[8,201,198,255]},{value:-15,color:[20,245,241,255]}
72,{value:-10,color:[108,237,249,255]},{value:-5,color:[133,205,250,255]},{value:0,color:[186,227,252,255]},{value:5,color:[238,221,145,255]},{value:10,color:[232,183,105,255]},{value:15,color:[232,137,69,255]},{value:20,color:[231,107,24,255]},{value:25,color:[236,84,19,255]},{value:30,color:[236,44,19,255]},{value:40,color:[123,23,10,255]},{value:55,color:[91,11,0,255]}]}),PRECIPITATION:new eV({stops:[{value:0,color:[111,111,111,0]},{value:.6,color:[60,116,160,180]},{value:6,color:[59,161,161,255]},{value:8,color:[59,161,61,255]},{value:10,color:[130,161,59,255]},{value:15,color:[161,161,59,255]},{value:20,color:[161,59,59,255]},{value:31,color:[161,59,161,255]},{value:50,color:[168,168,168,255]}]}),PRECIPITATION_2:new eV({stops:[{value:0,color:[255,255,255,0]},{value:.1,color:[171,218,252,255]},{value:1,color:[98,186,249,255]},{value:2,color:[87,160,240,255]},{value:4,color:[112,128,250,255]},{value:6,color:[128,102,245,255]},{value:8,color:[152,102,245,255]},{value:10,color:[154,87,172,255]},{value:15,color:[228,88,126,255]},{value:20,color:[247,135,95,255]},{value:30,color:[249,206,64,255]},{value:50,color:[250,248,168,52]}]}),RADAR:new eV({stops:[{value:0,color:[7,235,236,0]},{value:4,color:[7,235,236,80]},{value:5,color:[7,235,236,255]},{value:10,color:[0,159,246,255]},{value:15,color:[0,0,247,255]},{value:20,color:[3,255,0,255]},{value:25,color:[0,200,2,255]},{value:30,color:[1,144,0,255]},{value:35,color:[255,255,0,255]},{value:40,color:[231,192,0,255]},{value:45,color:[255,145,3,255]},{value:50,color:[255,0,0,255]},{value:55,color:[215,0,0,255]},{value:60,color:[192,0,0,255]},{value:65,color:[255,0,255,255]},{value:70,color:[155,85,200,255]},{value:75,color:[235,235,235,255]}]}),RADAR_CLOUD:new eV({stops:[{value:4,color:[134,134,176,0]},{value:7,color:[134,134,176,30]},{value:10,color:[134,134,176,60]},{value:20,color:[110,110,145,80]},{value:35,color:[77,77,105,140]},{value:45,color:[58,58,87,180]},{value:60,color:[26,26,51,220]}]}),PRESSURE_CIVIDIS:new eV({stops:[{value:900,color:[0,32,77,255]},{value:950,color:[0,37,82,255]},{value:976,color:[15,56,110,255]},{value:986,color:[49,68,107,255]},{value:995,color:[70,80,107,255]},{value:1002,color:[87,92,109,255]},{value:1007,color:[102,105,112,255]},{value:1011,color:[117,117,117,255]},{value:1013,color:[132,130,121,255]},{value:1015,color:[149,143,120,255]},{value:1019,color:[166,157,117,255]},{value:1024,color:[184,171,112,255]},{value:1030,color:[203,186,105,255]},{value:1038,color:[221,201,95,255]},{value:1046,color:[250,229,65,255]},{value:1080,color:[255,234,70,255]}]}),RADAR_ROCKET:new eV({stops:[{value:0,color:[250,235,221,0]},{value:.1,color:[250,235,221,255]},{value:10,color:[246,180,142,255]},{value:20,color:[243,118,81,255]},{value:30,color:[225,51,66,255]},{value:40,color:[174,23,89,255]},{value:50,color:[112,31,87,255]},{value:60,color:[54,25,62,255]},{value:75,color:[3,5,26,255]}]}),WIND_ROCKET:new eV({stops:[{value:0,color:[250,235,221,255]},{value:1,color:[246,187,151,255]},{value:3,color:[244,135,94,255]},{value:5,color:[236,75,62,255]},{value:10,color:[203,27,79,255]},{value:15,color:[150,28,91,255]},{value:20,color:[97,31,83,255]},{value:25,color:[48,23,58,255]},{value:30,color:[3,5,26,255]}]}),MAKO_PRECIPITATION:new eV({stops:[{value:0,color:[255,255,255,0]},{value:.1,color:[222,245,229,255]},{value:1,color:[168,225,188,255]},{value:2,color:[96,206,172,255]},{value:4,color:[61,180,173,255]},{value:6,color:[52,151,169,255]},{value:8,color:[53,123,162,255]},{value:10,color:[57,93,156,255]},{value:15,color:[65,64,129,255]},{value:20,color:[56,42,84,255]},{value:30,color:[38,23,42,255]},{value:50,color:[11,4,5,255]}]}),TEMPERATURE_TURBO:new eV({stops:[{value:-65,color:[48,18,59,255]},{value:-55,color:[64,64,162,255]},{value:-40,color:[70,107,227,255]},{value:-30,color:[66,147,255,255]},{value:-20,color:[40,187,236,255]},{value:-15,color:[24,220,195,255]},{value:-10,color:[49,242,153,255]},{value:-5,color:[107,254,100,255]},{value:0,color:[162,252,60,255]},{value:5,color:[204,237,52,255]},{value:10,color:[237,208,58,255]},{value:15,color:[253,173,53,255]},{value:20,color:[231,107,24,255]},{value:25,color:[236,82,15,255]},{value:30,color:[210,49,5,255]},{value:40,color:[172,23,1,255]},{value:55,color:[122,4,3,255]}]})});let eB=eV,eY="api.maptiler.com",eZ={maptilerApiHost:eY,endpoint:`https://${eY}/weather/latest.json`,tileSourceUrlSchema:`https://${eY}/tiles/{tileset_id}/{zxy}.{format}`};Object.freeze(eZ);let ej={latest:null};
72class eX{static async fetchLatest(e,t){let o=`${eZ.endpoint}?key=${e}&mtsid=${t}`,r=await fetch(o,{cache:"no-store"});ej.latest=await r.json()}static getDataForWeatherVariableID(e){if(!ej.latest)return null;let t=ej.latest.variables.filter(t=>t.metadata.weather_variable.variable_id===e);return t.length?t[0]:null}static hasData(){return!!ej.latest}static getTemperatureData(){return eX.getDataForWeatherVariableID("temperature-2m:gfs")}static getPressureData(){return eX.getDataForWeatherVariableID("pressure-msl:gfs")}static getPrecipitationData(){return eX.getDataForWeatherVariableID("precipitation-1h:gfs")}static getCloudCoverData(){return eX.getDataForWeatherVariableID("cloud_cover-total:gfs")}static getFrozenPrecipitationData(){return eX.getDataForWeatherVariableID("frozen_precipitation-1h:gfs")}static getRadarData(){return eX.getDataForWeatherVariableID("radar-composite:gfs")}static getWindData(){return eX.getDataForWeatherVariableID("wind-10m:gfs")}static getSourcesAndTimestamps(e,t,o){return e.keyframes.map(r=>({source:`${eZ.tileSourceUrlSchema.replace("{tileset_id}",r.id).replace("{format}",e.tile_format)}?key=${t}&mtsid=${o}`,timestamp:new Date(r.timestamp)/1e3}))}}class eH{constructor(){ea(this,"allInstances",[]),ea(this,"availableInstances",[])}add(e,t=!1){return this.allInstances.push(e),t&&this.availableInstances.push(e),e}isEmpty(){return 0===this.availableInstances.length}pop(){if(this.isEmpty())throw Error("No more instances available ini the pool.");return this.availableInstances.pop()}init(){this.availableInstances=this.allInstances.slice()}reset(){this.availableInstances=[],this.allInstances=[]}}function eq(e,t){let o=e[0],r=e[1],l=e[2],a=e[3],s=t[0],n=t[1],h=0;return s<o?h|=16:s>l&&(h|=4),n<r?h|=8:n>a&&(h|=2),0===h&&(h=1),h}function eK(){return[1/0,1/0,-1/0,-1/0]}function eJ(e,t,o,r,l){return l?(l[0]=e,l[1]=t,l[2]=o,l[3]=r,l):[e,t,o,r]}function eQ(e){var t,o,r;let l=0;return(t=e)[2]<t[0]||t[3]<t[1]||(l=((o=e)[2]-o[0])*((r=e)[3]-r[1])),l}function e1(e,t,o){let r=o||eK();return e0(e,t)?(e[0]>t[0]?r[0]=e[0]:r[0]=t[0],e[1]>t[1]?r[1]=e[1]:r[1]=t[1],e[2]<t[2]?r[2]=e[2]:r[2]=t[2],e[3]<t[3]?r[3]=e[3]:r[3]=t[3]):eJ(1/0,1/0,-1/0,-1/0,r),r}function e0(e,t){return e[0]<=t[2]&&e[2]>=t[0]&&e[1]<=t[3]&&e[3]>=t[1]}class e2{constructor(e,t,o,r){this.minX=e,this.maxX=t,this.minY=o,this.maxY=r}contains(e){return this.containsXY(e[1],e[2])}containsTileRange(e){return this.minX<=e.minX&&e.maxX<=this.maxX&&this.minY<=e.minY&&e.maxY<=this.maxY}containsXY(e,t){return this.minX<=e&&e<=this.maxX&&this.minY<=t&&t<=this.maxY}equals(e){return this.minX==e.minX&&this.minY==e.minY&&this.maxX==e.maxX&&this.maxY==e.maxY}extend(e){e.minX<this.minX&&(this.minX=e.minX),e.maxX>this.maxX&&(this.maxX=e.maxX),e.minY<this.minY&&(this.minY=e.minY),e.maxY>this.maxY&&(this.maxY=e.maxY)}
72getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(e){return this.minX<=e.maxX&&this.maxX>=e.minX&&this.minY<=e.maxY&&this.maxY>=e.minY}}function e5(e,t,o,r,l){return void 0!==l?(l.minX=e,l.maxX=t,l.minY=o,l.maxY=r,l):new e2(e,t,o,r)}function e3(e,t){if(!e)throw Error(t)}function e4(e,t){let o=Math.pow(10,t);return Math.round(e*o)/o}function e6(e,t){return Math.floor(e4(e,t))}function e8(e,t){return Math.ceil(e4(e,t))}function e7(e,t,o,r){return void 0!==r?(r[0]=e,r[1]=t,r[2]=o,r):[e,t,o]}function e9(e,t,o,r,l,a){let s=0,n=e[o-r],h=e[o-r+1];for(;t<o;t+=r){let o=e[t],r=e[t+1];h<=a?r>a&&(o-n)*(a-h)-(l-n)*(r-h)>0&&s++:r<=a&&(o-n)*(a-h)-(l-n)*(r-h)<0&&s--,n=o,h=r}return 0!==s}function te(e,t){return e>t?1:e<t?-1:0}function tt(e,t){return Array.isArray(e)?e:(void 0===t?t=[e,e]:(t[0]=e,t[1]=e),t)}let ti=[0,0,0];class to{constructor(e){let t;if(this.minZoom=void 0!==e.minZoom?e.minZoom:0,this.resolutions_=e.resolutions,e3(function(e,t){let o=t||te;return e.every(function(t,r){if(0===r)return!0;let l=o(e[r-1],t);return!(l>0||0===l)})}(this.resolutions_,(e,t)=>t-e),"`resolutions` must be sorted in descending order"),!e.origins)for(let e=0,o=this.resolutions_.length-1;e<o;++e)if(t){if(this.resolutions_[e]/this.resolutions_[e+1]!==t){t=void 0;break}}else t=this.resolutions_[e]/this.resolutions_[e+1];this.zoomFactor_=t,this.maxZoom=this.resolutions_.length-1,this.origin_=void 0!==e.origin?e.origin:null,this.origins_=null,void 0!==e.origins&&(this.origins_=e.origins,e3(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));const o=e.extent;void 0===o||this.origin_||this.origins_||(this.origin_=function(e){return[e[0],e[3]]}(o)),e3(!this.origin_&&this.origins_||this.origin_&&!this.origins_,"Either `origin` or `origins` must be configured, never both"),this.tileSizes_=null,void 0!==e.tileSizes&&(this.tileSizes_=e.tileSizes,e3(this.tileSizes_.length==this.resolutions_.length,"Number of `tileSizes` and `resolutions` must be equal")),this.tileSize_=void 0!==e.tileSize?e.tileSize:this.tileSizes_?null:256,e3(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=void 0!==o?o:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],void 0!==e.sizes?this.fullTileRanges_=e.sizes.map((e,t)=>{let r=new e2(Math.min(0,e[0]),Math.max(e[0]-1,-1),Math.min(0,e[1]),Math.max(e[1]-1,-1));if(o){let e=this.getTileRangeForExtentAndZ(o,t);r.minX=Math.max(e.minX,r.minX),r.maxX=Math.min(e.maxX,r.maxX),r.minY=Math.max(e.minY,r.minY),r.maxY=Math.min(e.maxY,r.maxY)}return r}):o&&this.calculateTileRanges_(o)}forEachTileCoord(e,t,o){let r=this.getTileRangeForExtentAndZ(e,t);for(let e=r.minX,l=r.maxX;e<=l;++e)for(let l=r.minY,a=r.maxY;l<=a;++l)o([t,e,l])}forEachTileCoordParentTileRange(e,t,o,r){let l,a,s,n=null,h=e[0]-1;for(2===this.zoomFactor_?(a=e[1],s=e[2]):n=this.getTileCoordExtent(e,r);h>=this.minZoom;){if(l=void 0!==a&&void 0!==s?e5(a=Math.floor(a/2),a,s=Math.floor(s/2),s,o):this.getTileRangeForExtentAndZ(n,h,o),t(h,l))return!0;--h}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(e){return this.origin_?this.origin_:this.origins_[e]}getResolution(e){return this.resolutions_[e]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(e,t,o){if(e[0]<this.maxZoom){if(2===this.zoomFactor_){let o=2*e[1],r=2*e[2];return e5(o,o+1,r,r+1,t)}let r=this.getTileCoordExtent(e,o||this.tmpExtent_);return this.getTileRangeForExtentAndZ(r,e[0]+1,t)}return null}getTileRangeForTileCoordAndZ(e,t,o){if(t>this.maxZoom||t<this.minZoom)return null;let r=e[0],l=e[1],a=e[2];if(t===r)return e5(l,a,l,a,o);if(this.zoomFactor_){let e=Math.pow(this.zoomFactor_,t-r),s=Math.floor(l*e),n=Math.floor(a*e);return t<r?e5(s,s,n,n,o):e5(s,Math.floor(e*(l+1))-1,n,Math.floor(e*(a+1))-1,o)}let s=this.getTileCoordExtent(e,this.tmpExtent_);return this.getTileRangeForExtentAndZ(s,t,o)}getTileRangeForExtentAndZ(e,t,o){this.getTileCoordForXYAndZ_(e[0],e[3],t,!1,ti);let r=ti[1],l=ti[2];return this.getTileCoordForXYAndZ_(e[2],e[1],t,!0,ti),e5(r,ti[1],l,ti[2],o)}getTileCoordCenter(e){let t=this.getOrigin(e[0]),o=this.getResolution(e[0]),r=tt(this.getTileSize(e[0]),this.tmpSize_);return[t[0]+(e[1]+.5)*r[0]*o,t[1]-(e[2]+.5)*r[1]*o]}getTileCoordExtent(e,t){let o=this.getOrigin(e[0]),r=this.getResolution(e[0]),l=tt(this.getTileSize(e[0]),this.tmpSize_),a=o[0]+e[1]*l[0]*r,s=o[1]-(e[2]+1)*l[1]*r,n=a+l[0]*r,h=s+l[1]*r;return eJ(a,s,n,h,t)}getTileCoordForCoordAndResolution(e,t,o){return this.getTileCoordForXYAndResolution_(e[0],e[1],t,!1,o)}getTileCoordForXYAndResolution_(e,t,o,r,l){let a=this.getZForResolution(o),s=o/this.getResolution(a),n=this.getOrigin(a),h=tt(this.getTileSize(a),this.tmpSize_),u=s*(e-n[0])/o/h[0],c=s*(n[1]-t)/o/h[1];return r?(u=e8(u,5)-1,c=e8(c,5)-1):(u=e6(u,5),c=e6(c,5)),e7(a,u,c,l)}getTileCoordForXYAndZ_(e,t,o,r,l){let a=this.getOrigin(o),s=this.getResolution(o),n=tt(this.getTileSize(o),this.tmpSize_),h=(e-a[0])/s/n[0],u=(a[1]-t)/s/n[1];return r?(h=e8(h,5)-1,u=e8(u,5)-1):(h=e6(h,5),u=e6(u,5)),e7(o,h,u,l)}getTileCoordForCoordAndZ(e,t,o){return this.getTileCoordForXYAndZ_(e[0],e[1],t,!1,o)}getTileCoordResolution(e){return this.resolutions_[e[0]]}getTileSize(e){return this.tileSize_?this.tileSize_:this.tileSizes_[e]}getFullTileRange(e){return this.fullTileRanges_?this.fullTileRanges_[e]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,e):null}getZForResolution(e,t){var o;return o=function(e,t,o){if(e[0]<=t)return 0;let r=e.length;if(t<=e[r-1])return r-1;if("function"==typeof o){for(let l=1;l<r;++l){let r=e[l];if(r===t)return l;if(r<t)return o(t,e[l-1],r)>0?l-1:l}return r-1}if(o>0){for(let o=1;o<r;++o)if(e[o]<t)return o-1;return r-1}if(o<0){for(let o=1;o<r;++o)if(e[o]<=t)return o;return r-1}for(let o=1;o<r;++o){if(e[o]==t)return o;if(e[o]<t)return e[o-1]-t<t-e[o]?o-1:o}return r-1}(this.resolutions_,e,t||0),Math.min(Math.max(o,this.minZoom),this.maxZoom)}tileCoordIntersectsViewport(e,t){var o,r;let l;return o=t.length,r=this.getTileCoordExtent(e),!!(e0(r,l=function(e,t,o,r){for(;o<r;o+=2){var l,a,s;l=e,a=t[o],s=t[o+1],l[0]=Math.min(l[0],a),l[1]=Math.min(l[1],s),l[2]=Math.max(l[2],a),l[3]=Math.max(l[3],s)}return e}(eK(),t,0,o))&&(r[0]<=l[0]&&l[2]<=r[2]&&r[1]<=l[1]&&l[3]<=r[3]||l[0]>=r[0]&&l[2]<=r[2]||l[1]>=r[1]&&l[3]<=r[3]||function(e,t,o,r){let l;for(t+=2;t<o;t+=2)if(l=r(e.slice(t-2,t),e.slice(t,t+2)))return l;return!1}(t,0,o,function(e,t){return function(e,t,o){let r=!1,l=eq(e,t),a=eq(e,o);if(1===l||1===a)r=!0;else{let s,n,h=e[0],u=e[1],c=e[2],v=e[3],m=t[0],d=t[1],f=o[0],x=o[1],p=(x-d)/(f-m);2&a&&!(2&l)&&(r=(s=f-(x-v)/p)>=h&&s<=c),r||!(4&a)||4&l||(r=(n=x-(f-c)*p)>=u&&n<=v),r||!(8&a)||8&l||(r=(s=f-(x-u)/p)>=h&&s<=c),r||!(16&a)||16&l||(r=(n=x-(f-h)*p)>=u&&n<=v)}return r}(r,e,t)}))||e9(t,0,o,2,r[0],r[1])||e9(t,0,o,2,r[0],r[3])||e9(t,0,o,2,r[2],r[1])||e9(t,0,o,2,r[2],r[3]))}calculateTileRanges_(e){let t=this.resolutions_.length,o=Array(t);for(let r=this.minZoom;r<t;++r)o[r]=this.getTileRangeForExtentAndZ(e,r);this.fullTileRanges_=o}}let tr={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};
72class tl{constructor(e){this.code_=e.code,this.units_=e.units,this.extent_=void 0!==e.extent?e.extent:null,this.worldExtent_=void 0!==e.worldExtent?e.worldExtent:null,this.axisOrientation_=void 0!==e.axisOrientation?e.axisOrientation:"enu",this.global_=void 0!==e.global&&e.global,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=e.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=e.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||tr[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(e){this.global_=e,this.canWrapX_=!!(e&&this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(e){this.defaultTileGrid_=e}setExtent(e){this.extent_=e,this.canWrapX_=!!(this.global_&&e)}setWorldExtent(e){this.worldExtent_=e}setGetPointResolution(e){this.getPointResolutionFunc_=e}getPointResolutionFunc(){return this.getPointResolutionFunc_}}let ta=6378137*Math.PI,ts=[-ta,-ta,ta,ta],tn=[-180,-85,180,85],th=6378137*Math.log(Math.tan(Math.PI/2));class tu extends tl{constructor(e){super({code:e,units:"m",extent:ts,global:!0,worldExtent:tn,getPointResolution:function(e,t){return e/Math.cosh(t[1]/6378137)}})}}let tc=[new tu("EPSG:3857"),new tu("EPSG:102100"),new tu("EPSG:102113"),new tu("EPSG:900913"),new tu("http://www.opengis.net/def/crs/EPSG/0/3857"),new tu("http://www.opengis.net/gml/srs/epsg.xml#3857")],tv=[-180,-90,180,90],tm=6378137*Math.PI/180;class td extends tl{constructor(e,t){super({code:e,units:"degrees",extent:tv,axisOrientation:t,global:!0,metersPerUnit:tm,worldExtent:tv})}}let tf=[new td("CRS:84"),new td("EPSG:4326","neu"),new td("urn:ogc:def:crs:OGC:1.3:CRS84"),new td("urn:ogc:def:crs:OGC:2:84"),new td("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new td("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new td("http://www.opengis.net/def/crs/EPSG/0/4326","neu")],tx={},tp={};function tg(e,t,o){let r=e.getCode(),l=t.getCode();r in tp||(tp[r]={}),tp[r][l]=o}let ty=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/],tT=[function(e){return!function(e){let t=0;for(let o of ty){let r=e.match(o);if(r){t=parseInt(r[1]);break}}if(!t)return null;let o=0,r=!1;return t>32700&&t<32761?o=t-32700:t>32600&&t<32661&&(r=!0,o=t-32600),o?{number:o,north:r}:null}(e)?null:new tl({code:e,units:"m"})}];function tS(e,t){if(void 0!==t)for(let o=0,r=e.length;o<r;++o)t[o]=e[o];else t=e.slice();return t}function t_(e){var t;t=e.getCode(),tx[t]=e,tg(e,e,tS)}function tw(e){e.forEach(t_),e.forEach(function(t){e.forEach(function(e){t!==e&&tg(t,e,tS)})})}tw(tc),tw(tf),l=function(e,t,o,r){let l=e.length;o=o>1?o:2,r=r??o,void 0===t&&(t=o>2?e.slice():Array(l));for(let o=0;o<l;o+=r){t[o]=ta*e[o]/180;let r=6378137*Math.log(Math.tan(Math.PI*(+e[o+1]+90)/360));r>th?r=th:r<-th&&(r=-th),t[o+1]=r}return t},a=function(e,t,o,r){let l=e.length;o=o>1?o:2,r=r??o,void 0===t&&(t=o>2?e.slice():Array(l));for(let o=0;o<l;o+=r)t[o]=180*e[o]/ta,t[o+1]=360*Math.atan(Math.exp(e[o+1]/6378137))/Math.PI-90;return t},tf.forEach(function(e){tc.forEach(function(t){tg(e,t,l),tg(t,e,a)})});var tC="precision highp float;precision highp int;precision highp sampler2D;uniform vec2 direction;uniform int kernelSize;uniform sampler2D imgToBlur;in vec2 vUv;out vec4 fragColor;vec4 blur5(sampler2D image,vec2 uv,vec2 resolution,vec2 direction){vec4 color=vec4(0.0);vec2 off1=vec2(1.3333333333333333)*direction;color+=texture(image,uv)*0.29411764705882354;color+=texture(image,uv+(off1/resolution))*0.35294117647058826;color+=texture(image,uv-(off1/resolution))*0.35294117647058826;return color;}vec4 blur9(sampler2D image,vec2 uv,vec2 resolution,vec2 direction){vec4 color=vec4(0.0);vec2 off1=vec2(1.3846153846)*direction;vec2 off2=vec2(3.2307692308)*direction;color+=texture(image,uv)*0.2270270270;color+=texture(image,uv+(off1/resolution))*0.3162162162;color+=texture(image,uv-(off1/resolution))*0.3162162162;color+=texture(image,uv+(off2/resolution))*0.0702702703;color+=texture(image,uv-(off2/resolution))*0.0702702703;return color;}vec4 blur13(sampler2D image,vec2 uv,vec2 resolution,vec2 direction){vec4 color=vec4(0.0);
72vec2 off1=vec2(1.411764705882353)*direction;vec2 off2=vec2(3.2941176470588234)*direction;vec2 off3=vec2(5.176470588235294)*direction;color+=texture(image,uv)*0.1964825501511404;color+=texture(image,uv+(off1/resolution))*0.2969069646728344;color+=texture(image,uv-(off1/resolution))*0.2969069646728344;color+=texture(image,uv+(off2/resolution))*0.09447039785044732;color+=texture(image,uv-(off2/resolution))*0.09447039785044732;color+=texture(image,uv+(off3/resolution))*0.010381362401148057;color+=texture(image,uv-(off3/resolution))*0.010381362401148057;return color;}vec4 blur19(sampler2D image,vec2 uv,vec2 resolution,vec2 direction){vec4 color=vec4(0.0);vec2 off1=vec2(1.434782608695652)*direction;vec2 off2=vec2(3.347826086956522)*direction;vec2 off3=vec2(5.260869565217392)*direction;vec2 off4=vec2(7.173913043478261)*direction;color+=texture(image,uv)*0.16818993967466953;color+=texture(image,uv+(off1/resolution))*0.2727695816518679;color+=texture(image,uv-(off1/resolution))*0.2727695816518679;color+=texture(image,uv+(off2/resolution))*0.11690124927937194;color+=texture(image,uv-(off2/resolution))*0.11690124927937194;color+=texture(image,uv+(off3/resolution))*0.024067904263400105;color+=texture(image,uv-(off3/resolution))*0.024067904263400105;color+=texture(image,uv+(off4/resolution))*0.0021112196722280793;color+=texture(image,uv-(off4/resolution))*0.0021112196722280793;return color;}void main(){vec4 color=vec4(1.,0,0,1.);vec2 textureResolution=vec2(textureSize(imgToBlur,0));if(kernelSize==5){color=blur5(imgToBlur,vUv,textureResolution,direction);}else if(kernelSize==9){color=blur9(imgToBlur,vUv,textureResolution,direction);}else if(kernelSize==13){color=blur13(imgToBlur,vUv,textureResolution,direction);}else if(kernelSize==19){color=blur19(imgToBlur,vUv,textureResolution,direction);}fragColor=color;}";let tM=null;class tE{constructor(e,t,o=(tM||(tM=new et.JeP({alpha:!0,premultipliedAlpha:!1})),tM)){ea(this,"renderer"),ea(this,"camera",new et.qUd(-1,1,1,-1,0,1)),ea(this,"scene",new et.Z58),ea(this,"renderTarget"),ea(this,"material",new et.D$Q({glslVersion:et.Wdf,vertexShader:"precision highp float;precision highp int;uniform mat4 modelViewMatrix;uniform mat4 projectionMatrix;in vec3 position;in vec2 uv;out vec2 vUv;void main(){vUv=uv;gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1.0);}",fragmentShader:"precision highp float;precision highp int;precision highp sampler2D;in vec2 vUv;out vec4 fragColor;void main(){fragColor=vec4(1.,0.,0.,1.);}",depthWrite:!1,transparent:!0})),ea(this,"size"),this.size=new et.I9Y(e,t),this.renderTarget=new et.nWS(e,t,{minFilter:et.k6q,magFilter:et.k6q,format:et.GWd}),this.camera.matrixAutoUpdate=!1,this.renderer=o,this.renderer.setPixelRatio(1),this.renderer.autoClear=!1;const r=new et.eaF(new et.bdM(2,2),this.material);this.scene.add(r)}getOutputTexture(e=!1){return e?new et.GYF(this.getPixelData(),this.size.x,this.size.y,et.GWd):this.renderTarget.texture}setSize(e,t){e===this.size.x&&t===this.size.y||(this.size.x=e,this.size.y=t,this.renderTarget=new et.nWS(e,t,{minFilter:et.k6q,magFilter:et.k6q,format:et.GWd}),this.renderer.setRenderTarget(this.renderTarget))}setVertexShader(e){this.material.vertexShader=e.trim(),this.material.needsUpdate=!0}setFragmentShader(e){this.material.fragmentShader=e.trim(),this.material.needsUpdate=!0}setUniform(e,t){this.material.uniforms[e]={value:t}}setDefine(e,t){this.material.fragmentShader=this.material.fragmentShader.replace(RegExp(e,"g"),t.toString()),this.material.vertexShader=this.material.vertexShader.replace(RegExp(e,"g"),t.toString()),this.material.needsUpdate=!0}getPixelData(){let e=this.size,t=new Uint8Array(e.x*e.y*4);return this.renderer.readRenderTargetPixels(this.renderTarget,0,0,e.x,e.y,t),t}getSize(){return this.size.clone()}process(){return this.material.needsUpdate=!0,this.renderer.setRenderTarget(this.renderTarget),this.renderer.clear(),this.renderer.render(this.scene,this.camera),this.renderTarget.texture}debugAsPNG(){let e=this.getSize(),t=this.getPixelData(),o=document.createElement("canvas");o.width=e.x,o.height=e.y;let r=o.getContext("2d");if(!r)return;let l=r.getImageData(0,0,o.width,o.height);l.data.set(t),r.putImageData(l,0,0);let a=window.open();a&&a.document.write(`<iframe src="${o.toDataURL("image/png")}" frameborder="0" style="border:0; top:0px; left:0px; bottom:0px; right:0px; width:100%; height:100%;" allowfullscreen></iframe>`)}dispose(){this.renderTarget.texture.dispose(),this.renderTarget.dispose()}}class tP{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}class tb{constructor(e){this.highWaterMark=void 0!==e?e:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}deleteOldest(){let e=this.pop();e instanceof tP&&e.dispose()}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(e){for(;this.canExpireCache();)this.deleteOldest()}clear(){for(;this.oldest_;)this.deleteOldest()}containsKey(e){return this.entries_.hasOwnProperty(e)}forEach(e){let t=this.oldest_;for(;t;)e(t.value_,t.key_,this),t=t.newer}get(e,t){let o=this.entries_[e];return e3(void 0!==o,"Tried to get a value for a key that does not exist in the cache"),o===this.newest_||(o===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(o.newer.older=o.older,o.older.newer=
72o.newer),o.newer=null,o.older=this.newest_,this.newest_.newer=o,this.newest_=o),o.value_}remove(e){let t=this.entries_[e];return e3(void 0!==t,"Tried to get a value for a key that does not exist in the cache"),t===this.newest_?(this.newest_=t.older,this.newest_&&(this.newest_.newer=null)):t===this.oldest_?(this.oldest_=t.newer,this.oldest_&&(this.oldest_.older=null)):(t.newer.older=t.older,t.older.newer=t.newer),delete this.entries_[e],--this.count_,t.value_}getCount(){return this.count_}getKeys(){let e=Array(this.count_),t=0,o;for(o=this.newest_;o;o=o.older)e[t++]=o.key_;return e}getValues(){let e=Array(this.count_),t=0,o;for(o=this.newest_;o;o=o.older)e[t++]=o.value_;return e}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(e){var t;return null==(t=this.entries_[e])?void 0:t.value_}pop(){let e=this.oldest_;return delete this.entries_[e.key_],e.newer&&(e.newer.older=null),this.oldest_=e.newer,this.oldest_||(this.newest_=null),--this.count_,e.value_}replace(e,t){this.get(e),this.entries_[e].value_=t}set(e,t){e3(!(e in this.entries_),"Tried to set a value for a key that is used already");let o={key_:e,newer:null,older:this.newest_,value_:t};this.newest_?this.newest_.newer=o:this.oldest_=o,this.newest_=o,this.entries_[e]=o,++this.count_}setSize(e){this.highWaterMark=e}}class tR{constructor(e,t){ea(this,"loader",new et.Tap),ea(this,"lru",new tb(32)),ea(this,"apiKey",""),ea(this,"sessionId",""),this.url=e,this.onTileLoad=t}setMaptilerParams(e,t){this.apiKey=e,this.sessionId=t}urlPatternToUrl(e){let t;try{t=new URL(this.url.replace("{zxy}",e))}catch{t=new URL(this.url.replace("{zxy}",e),document.baseURI)}return t.host===eZ.maptilerApiHost&&(this.apiKey&&!t.searchParams.has("key")&&t.searchParams.append("key",this.apiKey),this.sessionId&&!t.searchParams.has("mtsid")&&t.searchParams.append("mtsid",this.sessionId)),t.href}getTile(e,t){if(e.split("/").map(e=>Number.parseInt(e)).some(e=>e<0))return null;if(this.lru.containsKey(e))return this.lru.get(e);if(t){let t=this.createTile(e);return this.lru.set(e,t),t}return null}createTile(e){let t=this.urlPatternToUrl(e),o={ready:!1,texture:null,zxy:e};return o.texture=this.loader.load(t,()=>{o.ready=!0,null!=this.onTileLoad&&this.onTileLoad(o,t,null)},void 0,e=>{null!=this.onTileLoad&&this.onTileLoad(o,t,e)}),o.texture.minFilter=et.k6q,o.texture.needsUpdate=!0,o}disposeTile(e){e.texture&&e.texture.dispose()}expireCache(e){for(;this.lru.canExpireCache()&&!(this.lru.peekLast().zxy in e);)this.disposeTile(this.lru.pop())}dispose(){for(let e of this.lru.getValues())this.disposeTile(e);this.lru.clear()}}class tA extends ei.EventEmitter{constructor(){super(...arguments),ea(this,"frames",[]),ea(this,"time",0),ea(this,"animationSpeed",0),ea(this,"lastTickTime",0)}addFrame(e,t){let o=this.findSmallerFrameIndex(e);if(o<0)this.frames.unshift({time:e,data:t});else{if(this.frames[o].time===e)throw Error("Frame with this time already exists");this.frames.splice(o+1,0,{time:e,data:t})}this.clampAnimation()}removeFrame(e){let t=this.frames.filter(t=>t.time===e);return this.frames=this.frames.filter(t=>t.time!==e),this.clampAnimation(),t}forEachFrame(e){for(let t of this.frames)e(t)}getAnimationStart(){return this.frames.length?this.frames[0].time:1/0}getAnimationStartDate(){return new Date(1e3*this.getAnimationStart())}getAnimationEnd(){return this.frames.length?this.frames[this.frames.length-1].time:-1/0}getAnimationEndDate(){return new Date(1e3*this.getAnimationEnd())}getAnimationTime(){return this.time}getAnimationTimeDate(){return new Date(1e3*this.getAnimationTime())}setAnimationTime(e){this.time=e,this.clampAnimation(),this.emit("animationTimeSet",{time:this.time})}clampAnimation(){this.time=Math.max(this.getAnimationStart(),Math.min(this.getAnimationEnd(),this.time))}animateByFactor(e){this.animate(e)}animate(e){e>0&&0===this.animationSpeed?this.emit("playAnimation",{time:this.time}):0===e&&this.animationSpeed>0&&this.emit("pauseAnimation",{time:this.time}),this.animationSpeed=e,0!==this.animationSpeed&&(this.lastTickTime=performance.now())}getAnimationSpeed(){return this.animationSpeed}isPlaying(){return this.animationSpeed>0}animationTick(){let e=performance.now();if(this.animationSpeed>0&&this.lastTickTime){let t=e-this.lastTickTime;this.time+=this.animationSpeed*(t/1e3);let o=this.getAnimationStart(),r=this.getAnimationEnd();this.time=o+(this.time-o)%(r-o),Number.isNaN(this.time)&&(this.time=o),this.emit
72("tick",{time:this.time})}this.lastTickTime=e}findSmallerFrameIndex(e){for(let t=this.frames.length-1;t>=0;--t)if(this.frames[t].time<=e)return t;return -1}getCurrentFrames(){if(0===this.frames.length)return{frameA:null,frameB:null,mix:0};let e=this.findSmallerFrameIndex(this.time);e<0&&(e=0);let t=this.frames[e],o=this.frames[Math.min(this.frames.length-1,e+1)],r=o.time-t.time,l=0===r?0:(this.time-t.time)/r;return{frameA:t,frameB:o,mix:l}}getNextFrame(e,t){let o=this.frames.findIndex(t=>t===e);return o<0?null:t<0?o>0?this.frames[o-1]:null:o<this.frames.length-1?this.frames[o+1]:null}}let tz=new et.V9B({transparent:!0,opacity:1,side:et.hB5,depthTest:!1,depthWrite:!1});function tF({color:e}){let t=function({color:e}){let t=new et.Gu$(1,32,32),o=new et.V9B({color:e});return new et.eaF(t,o)}({color:e});for(let e of Array.isArray(t.material)?t.material:[t.material])e.transparent=!0,e.depthTest=!1,e.depthWrite=!1;return t.renderOrder=9999,t}function tI(e,t){var o,r;let l=t.getZoom(),{width:a,height:s}=t.getCanvas().getBoundingClientRect(),n=(o=l,r={width:a,height:s},o<=3||r.width<918&&r.height>1020||r.width<918?1:2);return{gridSize:e>30?9:3*n,resolutionScaleFactor:n}}class tD{constructor(){ea(this,"object3D",new et.YJl),ea(this,"helpersObject3D",new et.YJl),ea(this,"map"),ea(this,"currentTiles",[]),ea(this,"currentTilesMeshes",new Map),ea(this,"visibleTilesAreaMesh",new et.eaF),ea(this,"areaGeometryVerticesRows",new Map),ea(this,"minZoom",0),ea(this,"maxZoom",24),ea(this,"isGeometryNeedRefresh",!1);const e=function(){let e=new et.YJl,t=tF({color:0xff0000});t.scale.setScalar(.01),t.position.set(0,1.01,0);let o=tF({color:255});o.scale.setScalar(.01),o.position.set(0,-1.01,0);let r=tF({color:65280});return r.scale.setScalar(.01),r.position.set(0,0,1.01),e.add(t),e.add(o),e.add(r),e}();this.helpersObject3D.add(e),this.object3D.add(this.visibleTilesAreaMesh),this.visibleTilesAreaMesh.material=((e={})=>{let{color:t=0xffffff*Math.random(),wireframe:o=!1,opacity:r=1}=e,l=tz.clone();return l.color=new et.Q1f(t),l.wireframe=o,l.opacity=r,l})({color:0xffffff,wireframe:!1}),this.visibleTilesAreaMesh.renderOrder=2,this.visibleTilesAreaMesh.visible=!1}
72init({map:e,minZoom:t,maxZoom:o}){this.map=e,this.minZoom=t,this.maxZoom=o}update(){var e,t;if(void 0===this.map)return;let o=Math.floor(this.map.getZoom());o=Math.min(Math.max(o,this.minZoom),this.maxZoom);let r=this.map.getCenter(),{gridSize:l}=tI(this.map.getPitch(),this.map),a=function(e,t){let o=2**t,{lat:r,lng:l}=e,a=r*Math.PI/180,s=(l+180)/360*o,n=(1-Math.log(Math.tan(a)+1/Math.cos(a))/Math.PI)/2*o;return s=Math.floor((s%o+o)%o),n=Math.floor(Math.max(0,Math.min(n,o-1))),{id:`${t}/${s}/${n}`,x:s,y:n,z:t}}(r,o),s=o<=3?function(e){let t=2**e,o=[];for(let r=0;r<t;r++)for(let l=0;l<t;l++)o.push({id:`${e}/${r}/${l}`,x:r,y:l,z:e});return o}(o):function(e,t){let{x:o,y:r,z:l}=e,a=2**l,s=Math.floor(Math.min(t,a)/2),n=[],h=new Set;for(let e=-s;e<=s;e++)for(let t=-s;t<=s;t++){let s=(o+e+a)%a,u=(r+t+a)%a,c=`${l}/${s}/${u}`;h.has(c)||(h.add(c),n.push({id:c,x:s,y:u,z:l}))}return n}(a,l);e=this.currentTiles.map(({id:e})=>e),t=s.map(({id:e})=>e),e.length===t.length&&e.every((e,o)=>e===t[o])||(this.currentTiles=s,this.isGeometryNeedRefresh=!0,this.object3D.remove(this.visibleTilesAreaMesh))}recreateGlobeMeshes(){!1!==this.isGeometryNeedRefresh&&(this.isGeometryNeedRefresh=!1,this.object3D.clear(),this.helpersObject3D.clear(),this.currentTilesMeshes.clear(),this.areaGeometryVerticesRows.clear(),this.recreateGlobeTiles(),this.recreateAreaMesh())}recreateGlobeTiles(){let e=this.currentTiles.reduce((e,t)=>Math.min(e,t.x),1/0),t=this.currentTiles.reduce((e,t)=>Math.min(e,t.y),1/0);for(let o of this.currentTiles){let{z:r,x:l,y:a}=o,s=2**r-1,n=new et.LoY,h=[],u=[],c=[];for(let o=0;o<=16;o++){let n=o;for(let v=0;v<=16;v++){let m=v,d=v/16,f=o/16,x=1-f,p=function(e,t,o,r,l){var a;let s=1/(1<<l),n=(((e/8192*s+o*s)*Math.PI*2+Math.PI)%(a=2*Math.PI)+a)%a,h=2*Math.atan(Math.exp(Math.PI-(t/8192*s+r*s)*Math.PI*2))-.5*Math.PI,u=Math.cos(h),c=new Float64Array(3);return c[0]=Math.sin(n)*u,c[1]=Math.sin(h),c[2]=Math.cos(n)*u,c}(8192*d,8192*f,l,a,r);0===a&&n<=4&&(p=em(p,[0,1,0],1-n/4)),a===s&&n>=12&&(p=em(p,[0,-1,0],1-(16-n)/4)),h.push(p[0],p[1],p[2]),c.push(d,x);let g=0===n,y=0===m,T=a===t,S=l===e;if(!1===g&&!1===y||!0===g&&!1===y&&!0===T||!0===y&&!1===g&&!0===S||!0===T&&!0===S){let e=`tileY:${a}__vertexRow:${n}`;!1===this.areaGeometryVerticesRows.has(e)&&this.areaGeometryVerticesRows.set(e,[]),(function(e,t){let o=e.get(t);if(void 0===o)throw Error(`Element with key ${t} not found in map`);return o})(this.areaGeometryVerticesRows,e).push(p)}if(16!==o&&16!==v){let e=17*o+v,t=(o+1)*17+v,r=(o+1)*17+(v+1),l=17*o+(v+1);u.push(e,t,l),u.push(t,r,l)}}}n.setAttribute("position",new et.qtW(h,3)),n.setAttribute("uv",new et.qtW(c,2)),n.setIndex(u);let v=new et.eaF;v.geometry=n,v.renderOrder=1,this.object3D.add(v),this.currentTilesMeshes.set(o.id,v)}}recreateAreaMesh(){let e=Array.from(this.areaGeometryVerticesRows.keys()).sort((e,t)=>{let[o,r]=e.split("__").map(e=>Number(e.split(":")[1])),[l,a]=t.split("__").map(e=>Number(e.split(":")[1]));return o===l?r-a:o-l}).map(e=>this.areaGeometryVerticesRows.get(e)),t=e.length,o=e[0].length;if(t<2)return void console.error("Not enough rows to create sphere fragment:",{rowsAmount:t});if(t!==o)return void console.warn("Rows amount is not equal to columns amount:",{rowsAmount:t,columnsAmount:o});let r=[],l=[],a=[],s=new Map;for(let a=0;a<t;a++)for(let n=0;n<o;n++){let h=e[a][n],u=`${h[0]},${h[1]},${h[2]}`;s.has(u)&&(h[0]+=1e-4*Math.random(),h[1]+=1e-4*Math.random(),h[2]+=1e-4*Math.random(),u=`${h[0]},${h[1]},${h[2]}`),s.set(u,s.size),r.push(h[0],h[1],h[2]);let c=n/(o-1),v=1-a/(t-1);l.push(c,v)}for(let r=0;r<t-1;r++){let t=e[r],l=e[r+1];for(let e=0;e<o-1;e++){let o=`${t[e][0]},${t[e][1]},${t[e][2]}`,r=`${t[e+1][0]},${t[e+1][1]},${t[e+1][2]}`,n=`${l[e][0]},${l[e][1]},${l[e][2]}`,h=`${l[e+1][0]},${l[e+1][1]},${l[e+1][2]}`,u=s.get(o),c=s.get(r),v=s.get(n),m=s.get(h);if(void 0===u||void 0===c||void 0===v||void 0===m){console.error("Undefined index:",{topLeftIndex:u,topRightIndex:c,bottomLeftIndex:v,bottomRightIndex:m});continue}a.push(u,v,c),a.push(v,m,c)}}let n=new et.LoY;n.setAttribute("position",new et.qtW(r,3)),n.setAttribute("uv",new et.qtW(l,2)),n.setIndex(a),this.visibleTilesAreaMesh.geometry=n,this.object3D.add(this.visibleTilesAreaMesh)}}class tN extends tA{constructor(e,t,o=null,r=null){super(),ea(this,"id"),ea(this,"type","custom"),ea(this,"renderingMode","3d"),ea(this,"map",null),ea(this,"dataMinZoom",0),ea(this,"dataMaxZoom",4),ea(this,"slippyTiles",[]),ea(this,"renderer",null),ea(this,"camera",new et.i7d),ea(this,"scene",new et.Z58),ea(this,"material"),ea(this,"geometry",new et.bdM(1,1)),ea(this,"tilegrid"),ea(this,"extent",null),ea(this,"repaintOnPausedAnimation",!0),ea(this,"materialPool",new eH),ea(this,"bluringNodePasses",[]),ea(this,"extentScale",1),ea(this,"extentChangedThreshold",.7
725),ea(this,"lastExtent",[0,0,0,0]),ea(this,"timeInterpolation",!0),ea(this,"isReady",!1),ea(this,"defaultTexture",new et.GYF(new Uint8Array([128,128,128,255]),1,1,et.GWd)),ea(this,"onMoveEndListener"),ea(this,"onResizeListener"),ea(this,"onMoveListener"),ea(this,"onProjectionChangedListener"),ea(this,"coloringFragments",null),ea(this,"multiChannelColoringFragment"),ea(this,"loadLowerZoomLevels"),ea(this,"interpolateTileEdge",!1),ea(this,"flusher"),ea(this,"globeTilesService"),ea(this,"threeWorldGroup",new et.YJl),ea(this,"slippyTilesGroup",new et.YJl),ea(this,"getMapOrThrow",()=>{if(null==this.map)throw Error("Accessing map on detached layer");return this.map}),ea(this,"getRendererOrThrow",()=>{if(null==this.renderer)throw Error("Accessing renderer on detached layer");return this.renderer}),this.defaultTexture.needsUpdate=!0,this.id=e,t&&this.init(t,o,r),this.onMoveEndListener=this.onMoveEnd.bind(this),this.onResizeListener=this.onResize.bind(this),this.onMoveListener=this.onMove.bind(this),this.onProjectionChangedListener=this.onProjectionChanged.bind(this),this.flusher=new et.eaF(new et.bdM(1,1),new et.V9B({colorWrite:!1,depthWrite:!1})),this.flusher.frustumCulled=!1,this.scene.add(this.flusher),this.threeWorldGroup.add(this.slippyTilesGroup),this.globeTilesService=new tD,this.threeWorldGroup.add(this.globeTilesService.object3D)}init(e,t=null,o=null){let r,l;this.interpolateTileEdge=e.interpolateTileEdge??!1,this.loadLowerZoomLevels=e.loadLowerZoomLevels??!0,this.coloringFragments=t,this.multiChannelColoringFragment=o,this.repaintOnPausedAnimation=e.repaintOnPausedAnimation??!0,this.dataMinZoom=e.minZoom??this.dataMinZoom,this.dataMaxZoom=e.maxZoom??this.dataMaxZoom,this.tilegrid=new to({extent:l=(r={minZoom:this.dataMinZoom,maxZoom:this.dataMaxZoom}).extent||(function(e){let t=tx[e]||tx[e.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null;if(t)return t;for(let t of tT){let o=t(e);if(o)return o}return null})("EPSG:3857").getExtent(),minZoom:r.minZoom,tileSize:r.tileSize,resolutions:function(e,t,o,r){t=void 0!==t?t:42,o=tt(void 0!==o?o:256);let l=e[3]-e[1],a=e[2]-e[0];r=r>0?r:Math.max(a/o[0],l/o[1]);let s=t+1,n=Array(s);for(let e=0;e<s;++e)n[e]=r/Math.pow(2,e);return n}(l,r.maxZoom,r.tileSize,r.maxResolution)}),e.bounds&&(this.extent=eD(e.bounds[0],e.bounds[1]).concat(eD(e.bounds[2],e.bounds[3])));let a="";if(this.coloringFragments){let e=this.coloringFragments.map((e,t)=>e.getBlendCode(`_cf_${t}`)),t="fragColor";for(let e=0;e<this.coloringFragments.length;e++)t=`_cf_${e}(${t},inter)`;t=`fragColor=${t};`,a="precision highp float;precision highp sampler2D;COLORING_FRAGMENT_DEFSout vec4 fragColor;uniform float opacity;uniform float zoom;uniform float time;uniform sampler2D tex0;uniform sampler2D tex1;uniform float tilePixelSize;uniform sampler2D texN0;uniform sampler2D texN1;uniform bool availableN;uniform sampler2D texE0;uniform sampler2D texE1;uniform bool availableE;uniform sampler2D texS0;uniform sampler2D texS1;uniform bool availableS;uniform sampler2D texW0;uniform sampler2D texW1;uniform bool availableW;uniform float maxSmoothingDistance;uniform float smoothingDistanceDecayFactor;uniform bool localSmoothing;uniform float zoomDelta;in vec2 tex0coord;in vec2 tex1coord;in vec2 mercCoord;float PI=3.141592;const int halfNbSmoothingBins=int(ceil(float(NB_SMOOTHING_BINS))/2.);void textPositionToInternalTexPosition(vec2 uv,out vec2 newUv,out int texturePositionIndex){if(uv.x>=0.&&uv.x<=1.){if(uv.y>=0.&&uv.y<=1.){newUv=uv;texturePositionIndex=0;}else if(uv.y<0.&&availableS){newUv=vec2(uv.x,1.+uv.y);texturePositionIndex=5;}else if(uv.y>1.&&availableN){newUv=vec2(uv.x,1.-uv.y);texturePositionIndex=1;}else{newUv=uv;texturePositionIndex=0;}}else if(uv.x<0.){if(uv.y>=0.&&uv.y<=1.&&availableW){newUv=vec2(1.+uv.x,uv.y);texturePositionIndex=7;}else{newUv=uv;texturePositionIndex=0;}}else if(uv.x>1.){if(uv.y>=0.&&uv.y<=1.&&availableE){newUv=vec2(uv.x-1.,uv.y);texturePositionIndex=3;}else{newUv=uv;texturePositionIndex=0;}}}vec4 getTextureColorByIndex(int textureTimeIndex,int texturePositionIndex,vec2 uv){if(textureTimeIndex==0){if(texturePositionIndex==0){return texture(tex0,uv);}else if(texturePositionIndex==1){return texture(texN0,uv);}else if(texturePositionIndex==3){return texture(texE0,uv);}else if(texturePositionIndex==5){return texture(texS0,uv);}else if(texturePositionIndex==7){return texture(texW0,uv);}}else if(textureTimeIndex==1){if(texturePositionIndex==0){return texture(tex1,uv);}else if(texturePositionIndex==1){return texture(texN1,uv);}else if(texturePositionIndex==3){return texture(texE1,uv);}else if(texturePositionIndex==5){return texture(texS1,uv);}else if(texturePositionIndex==7){return texture(texW1,uv);}}else{return vec4(1.,0.,0.,1.);}}vec4 getColor(int textureTimeIndex,vec2 uv){int texturePositionIndex=0;vec2 localUV=vec2(0.,0.);textPositionToInternalTexPosition(uv,localUV,texturePositionIndex);return getTextureColorByIndex(textureTimeIndex,texturePositionIndex,localUV);}vec4 circularSampleSmoothing(int textureTimeIndex,vec2 uv,float resolution,float distance,out bool isTransparant){vec4 colorRGBA=getColor(textureTimeIndex,uv);int weightCenter=3;vec4 color=colorRGBA*float(weightCenter);isTransparant=colorRGBA.a<1.;float angularStep=2.*PI/float(halfNbSmoothingBins);for(int i=0;i<halfNbSmoothingBins;i++){float angle=angularStep*float(i);vec2 offset=vec2(cos(angle),sin(angle))*distance*0.5;vec2 pos=uv+offset/resolution;vec4 c=getColor(textureTimeIndex,pos);color+=c;isTransparant=isTransparant||c.a<1.;angle=angularStep/2.+angularStep*float(i);offset=vec2(cos(angle),sin(angle))*distance;pos=uv+offset/resolution;c=getColor(textureTimeIndex,pos);color+=c;isTransparant=isTransparant||c.a<1.;}return color/float(2*halfNbSmoothingBins+weightCenter);}void main(){float scaledSamplingDistance=(maxSmoothingDistance*smoothingDistanceDecayFactor/(smoothingDistanceDecayFactor+zoom))*max(1.,2.-zoomDelta);bool isTransparant0=false;bool isTransparant1=false;vec4 tex0Color;vec4 tex1Color;if(localSmoothing&&halfNbSmoothingBins!=0){tex0Color=circularSampleSmoothing(0,tex0coord,tilePixelSize,scaledSamplingDistance,isTransparant0);tex1Color=circularSampleSmoothing(1,tex1coord,tilePixelSize,scaledSamplingDistance,isTransparant1);}else{tex0Color=texture(tex0,tex0coord);tex1Color=texture(tex1,tex1coord);}vec4 inter=mix(tex0Color,tex1Color,time);if(inter.a<1.0&&!RENDER_TRANSPARENT)discard;COLORING_FRAGMENT_CALLSfragColor.a*=opacity;}".replace("COLORING_FRAGMENT_DEFS",e.join(` 73`)).replace("COLORING_FRAGMENT_CALLS",t)}else o&&(a=o.getCode());let s=(e.nbSmoothingBins??16).toFixed(0);this.timeInterpolation=e.timeInterpolation??!0,this.material=new et.D$Q({glslVersion:et.Wdf,uniforms:{opacity:{value:1},time:{value:0},zoom:{value:0},tex0xy:{value:[0,0]},tex1xy:{value:[0,0]},tex0size:{value:1},tex1size:{value:1},tilePixelSize:{value:1},categorySmoothTransition:{value:e.categorySmoothTransition??!1},timeInterpolation:{value:this.timeInterpolation},tex0:{value:null},tex1:{value:null},zoomDelta:{value:0},localSmoothing:{value:e.localSmoothing??!1},maxSmoothingDistance:{value:e.maxSmoothingDistance??12},smoothingDistanceDecayFactor:{value:e.smoothingDistanceDecayFactor??10},texN0:{value:this.defaultTexture},texN1:{value:this.defaultTexture},availableN:{value:!1},texE0:{value:this.defaultTexture},texE1:{value:this.defaultTexture},availableE:{value:!1},texS0:{value:this.defaultTexture},texS1:{value:this.defaultTexture},availableS:{value:!1},texW0:{value:this.defaultTexture},texW1:{value:this.defaultTexture},availableW:{value:!1},interpolateTileEdge:{value:this.interpolateTileEdge}},vertexShader:"precision highp float;precision highp sampler2D;uniform mat4 modelViewMatrix;uniform mat4 projectionMatrix;in vec3 position;in vec2 uv;uniform vec2 tex0xy;uniform vec2 tex1xy;uniform float tex0size;uniform float tex1size;out vec2 tex0coord;out vec2 tex1coord;out vec2 mercCoord;void main(){tex0coord=tex0xy+uv*tex0size;tex1coord=tex1xy+uv*tex1size;mercCoord=(modelViewMatrix*vec4(position,1.0)).xy*vec2(1.0,-1.0);gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1.);}",fragmentShader:a,depthTest:!1,depthWrite:!1,transparent:!0,side:et.hB5,defines:{RENDER_TRANSPARENT:e.renderTransparentArea?"true":"false",NB_SMOOTHING_BINS:s}}),this.scene.add(this.threeWorldGroup),this.updateSlippyTileGrid(8,8),this.on("playAnimation",()=>{this.forceRepaint()}),this.on("animationTimeSet",()=>{this.forceRepaint()}),this.isReady=!0}onResize(){if(!this.isReady)return;let{width:e,height:t}=this.getMapOrThrow().getCanvas();
73this.getRendererOrThrow().setViewport(0,0,e,t),this.updateSlippyTileGrid(Math.ceil(e/512)+2,Math.ceil(t/512)+2)}onMove(){if(!this.isReady)return;let e=this.getVisibleExtent(this.extentScale);if(!e)throw Error("New extent is null");let t=eQ([Math.min(e[0],this.lastExtent[0]),Math.min(e[1],this.lastExtent[1]),Math.max(e[2],this.lastExtent[2]),Math.max(e[3],this.lastExtent[3])]);eQ(e1(this.lastExtent,e))/t<=this.extentChangedThreshold&&(this.lastExtent=e,this.emit("extentChanged"))}onMoveEnd(){this.refresh()}onProjectionChanged(e){this.globeTilesService.object3D.visible=!1,this.slippyTilesGroup.visible=!1,this.onResize(),this.refresh(),"globe"===e.newProjection?this.globeTilesService.object3D.visible=!0:this.slippyTilesGroup.visible=!0}updateSlippyTileGrid(e,t){this.slippyTilesGroup.clear(),this.slippyTiles.length=0;for(let o=0;o<e;o++){this.slippyTiles[o]=[];for(let e=0;e<t;e++){let t=new et.eaF(this.geometry);t.frustumCulled=!1,this.slippyTiles[o][e]=t,this.slippyTilesGroup.add(t)}}}validateSource(e){let t;try{t=new URL(e)}catch{t=new URL(e,document.baseURI)}if(t.host!==eZ.maptilerApiHost)throw Error(` 74 75MapTiler Weather library can only source data from MapTiler Cloud. 76Please use our MapTiler Plus library for self hosting: https://www.maptiler.com/weather/ 77or host your data with our generous free plan at MapTiler Cloud: https://cloud.maptiler.com 78`)}addSource(e,t,o=null){this.validateSource(t);let r=new tR(t,(e,t,r)=>{o&&o(e,t,r),this.forceRepaint()});if(this.map){let e=this.map.getSdkConfig().apiKey,t=this.map.getMaptilerSessionId();r.setMaptilerParams(e,t)}super.addFrame(e,r)}removeSource(e){for(let t of super.removeFrame(e))t.data.dispose();this.forceRepaint()}getVisibleExtent(e){var t;let o,r;if(!this.isReady)return null;let l=this.getMapOrThrow().getBounds(),a=eD(l.getWest(),l.getSouth()).concat(eD(l.getEast(),l.getNorth()));return this.extent&&(a=e1(this.extent,a)),e&&(o=((t=a)[2]-t[0])/2*(e-1),r=(t[3]-t[1])/2*(e-1),t[0]-=o,t[2]+=o,t[1]-=r,t[3]+=r),a}getWantedTiles(e,t,o){let r=Math.ceil(e),l={},a=this.getMapOrThrow().getBounds(),s=Math.min(o,Math.max(t,r-1)),n=Math.min(o,Math.max(t,r));for(let e=s;e<=n;++e)for(let t of function(e,t){let o=~~t,r=eW(e.getNorthWest(),o),l=eW(e.getSouthEast(),o),a=[];for(let e=Math.floor(r.x);e<=l.x;e+=1)for(let o=Math.floor(r.y);o<=Math.floor(l.y);o+=1)a.push(`${t}/${e}/${o}`);return a}(a,e))l[t]=!0;return l}setOpacity(e){this.isReady&&(this.material.uniforms.opacity.value=e,this.forceRepaint())}onAdd(e,t){this.registerTelemetry(e),this.map=e,this.map.on("resize",this.onResizeListener),this.map.on("projectiontransition",this.onProjectionChangedListener),this.map.on("move",this.onMoveListener),this.map.on("moveend",this.onMoveEndListener);let o=this.map.getSdkConfig().apiKey,r=this.map.getMaptilerSessionId();this.forEachFrame(e=>{e.data.setMaptilerParams(o,r)}),eX.hasData()||eX.fetchLatest(o,r),this.renderer=new et.JeP({canvas:e.getCanvas(),context:t,depth:!1,stencil:!1,antialias:!1,powerPreference:"high-performance"}),this.renderer.autoClear=!1,this.renderer.compile(this.scene,this.camera),this.globeTilesService.init({map:this.map,minZoom:1,maxZoom:this.map.getMaxZoom()});let l=this.getVisibleExtent(this.extentScale);if(null===l)throw Error("The last extent is null");this.lastExtent=l,this.forceRepaint(),this.onProjectionChanged({type:"projectiontransition",newProjection:e.isGlobeProjection()?"globe":"mercator"})}refresh(){this.getMapOrThrow().isGlobeProjection()&&(this.globeTilesService.update(),this.globeTilesService.recreateGlobeMeshes())}onRemove(e,t){this.isReady&&(null!=this.map&&(this.map.off("resize",this.onResizeListener),this.map.off("projectiontransition",this.onProjectionChangedListener),this.map.off("move",this.onMoveListener),this.map.off("moveend",this.onMoveEndListener),this.map=null),null!=this.renderer&&(this.renderer.dispose(),this.renderer=null),this.forEachFrame(e=>{e.data.dispose()}),this.disposeObjects())}disposeObjects(){if(this.isReady)for(let e of(this.geometry.dispose(),this.material.dispose(),this.bluringNodePasses))e.dispose()}getTilePlacement(e,t,o,r,l,a){if(!this.isReady)return null;let s=`${o}/${r}/${l}`,n=0!==o&&o>=this.dataMaxZoom?null:e.getTile(s,t);if(!n||!n.ready)return this.loadLowerZoomLevels&&o>this.tilegrid.getMinZoom()?this.getTilePlacement(e,t,o-1,Math.floor(r/2),Math.floor(l/2),a||{z:o,x:r,y:l}):null;let h={tile:n,xy:[0,0],size:1};if(void 0!==a){let e=2**(a.z-o);h.size/=e,h.xy[0]=a.x%e/e,h.xy[1]=(2**a.z-a.y-1)%e/e}return h}updateTilesMaterials(){var e;let t=this.getMapOrThrow();if(!1===t.isGlobeProjection())return void console.warn("For mercator projection use legacy waether tiles flow");
78let o=t.getZoom(),r=this.tilegrid.getMinZoom(),l=Math.min(this.tilegrid.getMaxZoom(),Math.max(r,Math.floor(o))),a=o-l,{frameA:s,frameB:n,mix:h}=this.getCurrentFrames();if(!s||!n){this.scene.visible=!1;return}for(let[t,r]of(this.scene.visible=!0,this.materialPool.init(),this.globeTilesService.currentTilesMeshes)){let l=this.getTilesPair(s,n,t);if(null===l){r.visible=!1;continue}r.visible=!0;let{tileA:u,tileB:c}=l,v=this.materialPool.isEmpty()?this.materialPool.add(this.material.clone()):this.materialPool.pop();r.material=v,v.uniforms.localSmoothing.value=this.material.uniforms.localSmoothing.value,v.uniforms.maxSmoothingDistance.value=this.material.uniforms.maxSmoothingDistance.value,v.uniforms.smoothingDistanceDecayFactor.value=this.material.uniforms.smoothingDistanceDecayFactor.value,v.uniforms.timeInterpolation.value=this.material.uniforms.timeInterpolation.value,v.uniforms.categorySmoothTransition.value=this.material.uniforms.categorySmoothTransition.value,v.uniforms.opacity.value=this.material.uniforms.opacity.value,v.uniforms.tex0.value=u.tile.texture,v.uniforms.tex0xy.value=u.xy,v.uniforms.tex0size.value=u.size,v.uniforms.tex1.value=c.tile.texture,v.uniforms.tex1xy.value=c.xy,v.uniforms.tex1size.value=c.size,v.uniforms.tilePixelSize.value=null==(e=u.tile.texture)?void 0:e.image.width,v.uniforms.time.value=h,v.uniforms.zoomDelta.value=a,v.uniforms.zoom.value=o}}updateSlippyTiles(){var e,t,o,r,l,a,s,n,h,u,c,v,m,d,f,x,p;if(!this.isReady)return;let{frameA:g,frameB:y,mix:T}=this.getCurrentFrames();if(!g||!y){this.scene.visible=!1;return}this.scene.visible=!0;let S=g.data,_=y.data,w=this.getMapOrThrow().getZoom(),C=this.tilegrid.getMinZoom(),M=this.tilegrid.getMaxZoom(),E=this.getWantedTiles(w,C,M),P={},b=Math.min(M,Math.max(C,Math.floor(w))),R=2**b,A=1/R,z=this.getMapOrThrow().getCenter(),F=this.tilegrid.getTileCoordForCoordAndZ(eD(z.lng,z.lat),b),I=w-b,D=this.slippyTiles.length;this.materialPool.init();let N=new Map;for(let t=0;t<D;t++){let o=this.slippyTiles[0].length;for(let r=0;r<o;r++){let l=this.slippyTiles[t][r],a=F[1]+t-Math.floor(D/2),s=F[2]+r-Math.floor(o/2),n=`${b}/${a}/${s}`;if(s<0||s>=R||!E[n]){l.visible=!1;continue}l.visible=!0;let h=(a%R+R)%R;P[`${b}/${h}/${s}`]=!0;let u=R-s-1;l.scale.x=A,l.scale.y=A,l.position.x=A*(a+.5),l.position.y=A*(u+.5)-1;let c=this.getTilePlacement(S,!0,b,h,s),v=this.getTilePlacement(_,!0,b,h,s);if(c&&!v&&(v=c),!c&&v&&(c=v),!c||!v){let e=g;for(;!c&&(e=this.getNextFrame(e,-1));)c=v=this.getTilePlacement(e.data,!1,b,h,s);if(!c||!v){l.visible=!1;continue}}let m=this.materialPool.isEmpty()?this.materialPool.add(this.material.clone()):this.materialPool.pop();m.uniforms.localSmoothing.value=this.material.uniforms.localSmoothing.value,m.uniforms.maxSmoothingDistance.value=this.material.uniforms.maxSmoothingDistance.value,m.uniforms.smoothingDistanceDecayFactor.value=this.material.uniforms.smoothingDistanceDecayFactor.value,m.uniforms.timeInterpolation.value=this.material.uniforms.timeInterpolation.value,m.uniforms.categorySmoothTransition.value=this.material.uniforms.categorySmoothTransition.value,m.uniforms.opacity.value=this.material.uniforms.opacity.value,m.uniforms.tex0.value=c.tile.texture,m.uniforms.tex0xy.value=c.xy,m.uniforms.tex0size.value=c.size,m.uniforms.tex1.value=v.tile.texture,m.uniforms.tex1xy.value=v.xy,m.uniforms.tex1size.value=v.size,m.uniforms.tilePixelSize.value=null==(e=c.tile.texture)?void 0:e.image.width,m.uniforms.time.value=T,m.uniforms.zoomDelta.value=I,m.uniforms.zoom.value=w,l.material=m,N.set(`${t} ${r}`,{material:m,tileA:c,tileB:v,x:t,y:r,z:b})}}if(this.material.uniforms.localSmoothing.value||this.interpolateTileEdge)for(let e of N){let g=e[1],y=g.x,T=g.y,S=g.material,_={x:y,y:T-1},w={x:y+1,y:T},C={x:y,y:T+1},M={x:y-1,y:T},E=`${_.x} ${_.y}`,P=`${w.x} ${w.y}`,b=`${C.x} ${C.y}`,R=`${M.x} ${M.y}`,A=N.get(E);null!=(o=null==(t=null==A?void 0:A.tileA)?void 0:t.tile)&&o.ready&&null!=(l=null==(r=null==A?void 0:A.tileB)?void 0:r.tile)&&l.ready?(S.uniforms.texN0.value=A.tileA.tile.texture,S.uniforms.texN1.value=A.tileB.tile.texture,S.uniforms.availableN.value=!0):(S.uniforms.texN0.value=null,S.uniforms.texN1.value=null,S.uniforms.availableN.value=!1),null!=(s=null==(a=null==(A=N.get(P))?void 0:A.tileA)?void 0:a.tile)&&s.ready&&null!=(h=null==(n=null==A?void 0:A.tileB)?void 0:n.tile)&&h.ready?(S.uniforms.texE0.value=A.tileA.tile.texture,S.uniforms.texE1.value=A.tileB.tile.texture,S.uniforms.availableE.value=!0):(S.uniforms.texE0.value=null,S.uniforms.texE1.value=null,S.uniforms.availableE.value=!1),null!=(c=null==(u=null==(A=N.get(b))?void 0:A.tileA)?void 0:u.tile)&&c.ready&&null!=(m=null==(v=null==A?void 0:A.tileB)?void 0:v.tile)&&m.ready?(S.uniforms.texS0.value=A.tileA.tile.texture,S.uniforms.texS1.value=A.tileB.tile.texture,S.uniforms.availableS.value=!0):(S.uniforms.texS0.value=null,S.uniforms.texS1.value=null,S.uniforms.availableS.value=!1),null!=(f=null==(d=null==(A=N.get(R))?void 0:A.tileA)?void 0:d.tile)&&f.ready&&null!=(p=null==(x=null==A?void 0:A.tileB)?void 0:x.tile)&&p.ready?(S.uniforms.texW0.value=A.tileA.tile.texture,S.uniforms.texW1.value=A.tileB.tile.texture,S.uniforms.availableW.value=!0):(S.uniforms.texW0.value=null,S.uniforms.texW1.value=null,S.uniforms.availableW.value=!1)}setTimeout(()=>{S.expireCache(P),_.expireCache(P);let e=this.getNextFrame(y,1);if(null!=e&&e.data)for(let t of Object.keys(P))e.data.getTile(t,!0)},0)}getTilesPair(e,t,o){let r=e.data,l=t.data,a=o.split("/").map(e=>Number.parseInt(e)),s=a[0],n=a[1],h=a[2],u=this.getTilePlacement(r,!0,s,n,h),c=this.getTilePlacement(l,!0,s,n,h);if(null===u){let t=e;for(;null===u&&null!==(t=this.getNextFrame(t,-1));)u=this.getTilePlacement(t.data,!1,s,n,h)}return null===c&&(c=u),null===u||null===c?null:{tileA:u,tileB:c}}prerender(e,t){if(!this.isReady)return;this.animationTick();let o=new et.kn4().fromArray(t.defaultProjectionData.mainMatrix);if(this.getMapOrThrow().isGlobeProjection())this.camera.projectionMatrix=o,this.updateTilesMaterials();else{let e=new et.kn4().scale(new et.Pq0(1,-1,1));this.camera.projectionMatrix=o.multiply(e),this.updateSlippyTiles()}this.prerenderInternal()}prerenderInternal(){}render(e,t){if(!this.isReady)return;let o=this.getRendererOrThrow();o.state.reset(),this.renderInternal(),o.render(this.scene,this.camera),(this.getAnimationSpeed()>0||this.repaintOnPausedAnimation)&&this.forceRepaint()}renderInternal(){}pickFrame(e,t,o,r={}){var l;if(!this.isReady)return null;let a=ez(e,t);if(!this.map)return null;let s=r.load??!1,n=r.highestRes?this.tilegrid.getMaxZoom():Math.min(~~(null==(l=this.map)?void 0:l.getZoom()),this.tilegrid.getMaxZoom()),h=2**n,u=(.5+a[0])%1*h,c=(1-(a[1]+.5))*h,v=this.getTilePlacement(o,s,n,Math.floor(u),Math.floor(c));if(null==v||null==v.tile.texture)return null;if(this.coloringFragments){let e=eN(v.tile.texture.image,v.xy[0]+v.size*(u%1),1-v.xy[1]-v.size+v.size*(c%1));return this.coloringFragments.flatMap(t=>t.decodeChannel(e))}if(this.multiChannelColoringFragment){let e=eN(v.tile.texture.image,v.xy[0]+v.size*(u%1),1-v.xy[1]-v.size+v.size*(c%1));return this.multiChannelColoringFragment.decodeChannel(e)}return null}pickFrameBilinear(e,t,o,r={}){var l;let a=r.load??!1,s=r.highestRes??!1,n=ez(e,t);if(!this.map)return null;let h=s?this.tilegrid.getMaxZoom():Math.min(~~(null==(l=this.map)?void 0:l.getZoom()),this.tilegrid.getMaxZoom()),u=2**h,c=(.5+n[0])%1*u,v=(1-(n[1]+.5))*u,m=this.getTilePlacement(o,a,h,Math.floor(c),Math.floor(v));if(null==m||null==m.tile.texture)return null;let d=1/m.tile.texture.image.width;c-=d/2,v-=d/2;let f={x:~~(c/d)*d,y:~~(v/d)*d},x={x:f.x+d,y:f.y},p={x:f.x+d,y:f.y+d},g={x:f.x,y:f.y+d},y=this.getTilePlacement(o,a,h,Math.floor(f.x),Math.floor(f.y)),T=this.getTilePlacement(o,a,h,Math.floor(x.x),Math.floor(x.y)),S=this.getTilePlacement(o,a,h,Math.floor(p.x),Math.floor(p.y)),_=this.getTilePlacement(o,a,h,Math.floor(g.x),Math.floor(g.y));if(null==y||null==y.tile.texture||null==T||null==T.tile.texture||null==S||null==S.tile.texture||null==_||null==_.tile.texture)return null;let w=eN(m.tile.texture.image,m.xy[0]+m.size*(c%1),1-m.xy[1]-m.size+m.size*(v%1)),C=eN(y.tile.texture.image,y.xy[0]+y.size*(f.x%1),1-y.xy[1]-y.size+y.size*(f.y%1)),M=eN(T.tile.texture.image,T.xy[0]+T.size*(x.x%1),1-T.xy[1]-T.size+T.size*(x.y%1)),E=eN(S.tile.texture.image,S.xy[0]+S.size*(p.x%1),1-S.xy[1]-S.size+S.size*(p.y%1)),P=eN(_.tile.texture.image,_.xy[0]+_.size*(g.x%1),1-_.xy[1]-_.size+_.size*(g.y%1)),b=(v-f.y)/(g.y-f.y),R=1-b,A=(c-f.x)/(x.x-f.x),z=1-A;if(this.coloringFragments){let e={r:C.r*R+P.r*b,g:C.g*R+P.g*b,b:C.b*R+P.b*b,a:C.a*R+P.a*b},t={r:M.r*R+E.r*b,g:M.g*R+E.g*b,b:M.b*R+E.b*b,a:M.a*R+E.a*b},o={r:e.r*z+t.r*A,g:e.g*z+t.g*A,b:e.b*z+t.b*A,a:e.a*z+t.a*A};return this.coloringFragments.flatMap(e=>e.decodeChannel(o))}if(this.multiChannelColoringFragment){if(C.a!==M.a||C.a!==E.a||C.a!==P.a)return this.multiChannelColoringFragment.decodeChannel(w);let e=this.multiChannelColoringFragment.decodeChannel(C),t=this.multiChannelColoringFragment.decodeChannel(M),o=this.multiChannelColoringFragment.decodeChannel(E),r=this.multiChannelColoringFragment.decodeChannel(P);return[(e[0]*R+r[0]*b)*z+(t[0]*R+o[0]*b)*A,e[1]]}return null}pick(e,t,o={}){if(!this.isReady)return null;let{frameA:r,frameB:l,mix:a}=this.getCurrentFrames();if(!r||!l)return null;let s=!!o.bilinear,n=o.load??!1,h=o.highestRes??!1,u=s?this.pickFrameBilinear(e,t,r.data,{load:n,highestRes:h}):this.pickFrame(e,t,r.data,{load:n,highestRes:h}),c=u;return r.data!==l.data&&(c=s?this.pickFrameBilinear(e,t,l.data,{load:n,highestRes:h}):this.pickFrame(e,t,l.data,{load:n,highestRes:h})),u?c?this.coloringFragments?u.flatMap((e,t)=>{let o=c[t];return Array.isArray(e)&&Array.isArray(o)?e.map((e,t)=>e*(1-a)+o[t]*a):e*(1-a)+o*a}):this.multiChannelColoringFragment?this.timeInterpolation?[u[0]*(1-a)+c[0]*a,a<.5?u[1]:c[1]]:[a<.5?u[0]:c[0],a<.5?u[1]:c[1]]:null:u:c}forceRepaint(){try{this.getMapOrThrow().triggerRepaint()}catch{}}computeCurrentMixedImage({zxy:e="0/0/0",blurKernel:t=0,outputSize:o=-1,channel:r="r"}){var l,a,s,n;if(!this.isReady)return null;let h=this.getCurrentFrames(),u=h.mix,c=null==(a=null==(l=h.frameA)?void 0:l.data.getTile(e,!1))?void 0:a.texture,v=null==(n=null==(s=h.frameB)?void 0:s.data.getTile(e,!1))?void 0:n.texture,m=o<0?Number.parseInt(null==c?void 0:c.image.width):o,d=o<0?Number.parseInt(null==c?void 0:c.image.height):o;this.bluringNodePasses.length||this.bluringNodePasses.push(new tE(m,d),new tE(m,d),new tE(m,d));let f=this.bluringNodePasses[0],x=this.bluringNodePasses[1],p=this.bluringNodePasses[2];if(f.setSize(m,d),x.setSize(m,d),x.setSize(m,d),f.setFragmentShader("precision highp float;precision highp int;precision highp sampler2D;uniform sampler2D imageA;uniform sampler2D imageB;uniform float mixValue;in vec2 vUv;out vec4 fragColor;void main(){fragColor=mix(texture(imageA,vUv),texture(imageB,vUv),mixValue);}"),f.setDefine("CHANNEL",r),f.setUniform("imageA",c),f.setUniform("imageB",v),f.setUniform("mixValue",u),f.process(),0===t){let e=f.getPixelData();return{data:e,channels:e.length/(m*d),width:m,height:d}}if(![5,9,13,19].includes(t))throw Error(`The kernel bluring kernel size ${t} is not available.`);x.setUniform("direction",new et.I9Y(1,0)),x.setUniform("kernelSize",t),x.setUniform("imgToBlur",f.getOutputTexture()),x.setFragmentShader(tC),x.process(),p.setUniform("direction",new et.I9Y(0,1)),p.setUniform("kernelSize",t),p.setUniform("imgToBlur",x.getOutputTexture()),p.setFragmentShader(tC),p.process();let g=p.getPixelData();for(let e of this.bluringNodePasses)e.dispose();return{data:g,channels:g.length/(m*d),width:m,height:d}}setTimeInterpolation(e){this.isReady&&(this.material.uniforms.timeInterpolation.value=e)}setCategorySmoothTransition(e){this.isReady&&(this.material.uniforms.categorySmoothTransition.value=e,this.forceRepaint())}setLocalSmoothing(e){this.material.uniforms.localSmoothing.value=e,this.forceRepaint()}setMaxSmoothingDistance(e){this.material.uniforms.maxSmoothingDistance.value=e,this.forceRepaint()}setSmoothingDistanceDecayFactor(e){this.material.uniforms.smoothingDistanceDecayFactor.value=e,this.forceRepaint()}getRepaintOnPausedAnimation(){return this.repaintOnPausedAnimation}setRepaintOnPausedAnimation(e){this.repaintOnPausedAnimation=e,this.forceRepaint()}registerTelemetry(e){e.telemetry.registerModule("@maptiler/weather","3.1.1")}}var tO=`#version 300 es 79precision highp float;uniform sampler2D rttTexture;uniform sampler2D rttTexturePrev;uniform float rttSize;uniform float screenSize;uniform float extrapolationFactor;uniform float renderStepSize;out float speed;vec4 advance(float position_){if(position_>(DENSITY/1000.0)*screenSize*screenSize){speed=0.0;return vec4(0.0);}float x=fract(position_/rttSize);float y=floor(position_/rttSize)/rttSize;vec4 color=texture(rttTexture,vec2(x,y));vec2 pos=color.ba+color.rg/255.0;vec4 colorPrev=texture(rttTexturePrev,vec2(x,y));vec2 posPrev=colorPrev.ba+colorPrev.rg/255.0;vec2 diff=pos-posPrev;pos+=diff*extrapolationFactor;speed=renderStepSize*step(0.0001,dot(posPrev,posPrev))*length(diff*screenSize);return vec4(pos,diff);}void main(){float position_=floor(position/2.0);float vertex=2.0*fract(position/2.0);vec4 posdiff=advance(position_);vec2 pos=posdiff.xy;vec2 dir=normalize(posdiff.zw);vec2 uv=(float(SIZE)/screenSize)*vec2(vertex,-vertex)*dir.yx;pos=2.0*(pos-uv)-1.0;gl_Position=vec4(pos.x,-pos.y,0.,1.);}`,tW=`precision highp float;precision highp sampler2D; 80#define M_PI 3.14159265358 81uniform float tileScale;uniform vec2 tilePosition;uniform vec2 tex0xy;uniform vec2 tex1xy;uniform float tex0size;uniform float tex1size;uniform bool useAlphaAsMask;uniform sampler2D rttTexture;uniform vec2 rttXY;uniform float rttScale;uniform float time;uniform sampler2D tex0;uniform sampler2D tex1;uniform float timestep;uniform float canvasDiagonal;uniform float angleDirectionShiftSkip;uniform bool uniformSpeed;uniform float tileGridPass;in vec2 rttCoord;out vec4 fragColor;float modI(float a,float b){float m=a-floor((a+0.5)/b)*b;return floor(m+0.5);}void main(){vec4 color=texture(rttTexture,rttCoord);if(tileGridPass==0.&&modI(floor(color.r*255.),2.)==0.){fragColor=color;return;}if(tileGridPass==1.&&modI(floor(color.r*255.),2.)!=0.){fragColor=color;return;}vec2 pos=color.ba+color.rg/255.0;vec2 posInTile=(rttXY+rttScale*pos)/tileScale-tilePosition;float uniformSpeedFactor=uniformSpeed ?(4000./canvasDiagonal): 1.;if(posInTile.x>=0.&&posInTile.x<=1.&&posInTile.y>=0.&&posInTile.y<=1.){posInTile.y=1.0-posInTile.y;vec2 tex0coord=tex0xy+posInTile*tex0size;vec2 tex1coord=tex1xy+posInTile*tex1size;vec4 tex0Color=texture(tex0,tex0coord);vec4 tex1Color=texture(tex1,tex1coord);if(useAlphaAsMask&&(tex0Color.a<1.||tex1Color.a<1.)){fragColor=color;return;}vec2 uv;bool skipRendering=false;if(D_WAVES){vec2 value0=tex0Color.D_CHANNELS;vec2 value1=tex1Color.D_CHANNELS;float dir0=2.0*M_PI*(-value0.x-0.25);float dir1=2.0*M_PI*(-value1.x-0.25);float speed=sqrt(1.0/mix(value0.y,value1.y,time));uv=vec2(mix(cos(dir0),cos(dir1),time),mix(sin(dir0),sin(dir1),time))*(D_MIN+(D_MAX-D_MIN)*speed);}else{vec4 lookup=mix(tex0Color,tex1Color,time);vec2 value=lookup.D_CHANNELS;uv=D_MIN+(D_MAX-D_MIN)*value;if(angleDirectionShiftSkip<89.999){vec2 offset=vec2(uv.x,-uv.y)*timestep*uniformSpeedFactor;vec2 nextPos=pos+offset;vec2 posNextInTile=(rttXY+rttScale*nextPos)/tileScale-tilePosition;posNextInTile.y=1.0-posNextInTile.y;vec2 tex0coordNext=tex0xy+posNextInTile*tex0size;vec2 tex1coordNext=tex1xy+posNextInTile*tex1size;vec4 tex0ColorNext=texture(tex0,tex0coordNext);vec4 tex1ColorNext=texture(tex1,tex1coordNext);vec4 lookupNext=mix(tex0ColorNext,tex1ColorNext,time);vec2 valueNext=lookupNext.D_CHANNELS;vec2 uvNext=D_MIN+(D_MAX-D_MIN)*valueNext;skipRendering=dot(normalize(uv),normalize(uvNext))<cos(angleDirectionShiftSkip*M_PI/180.);}}vec2 offset=vec2(uv.x,-uv.y)*timestep*uniformSpeedFactor;if(skipRendering){offset=vec2(0.,0.);}vec2 newPos=pos+offset;fragColor=vec4(fract(newPos*255.0),floor(newPos*255.0)/255.0);float red255=floor(fragColor.r*255.);
81if(tileGridPass==0.){if(modI(red255,2.)!=0.){red255-=1.;}}else{if(modI(red255,2.)==0.){red255+=1.;}}fragColor.r=red255/255.;}else{fragColor=color;}}`;class tU extends tN{constructor(e,t,o,r){super(e,null,null),ea(this,"rttScene",new et.Z58),ea(this,"rttCamera"),ea(this,"rttMaterial"),ea(this,"rttMesh"),ea(this,"particleTexturePrev"),ea(this,"particleTexture0"),ea(this,"particleTexture1"),ea(this,"particleMaterial"),ea(this,"particles"),ea(this,"particleBackground"),ea(this,"accumulator"),ea(this,"accumulatorDrawMesh"),ea(this,"flipFlop",!1),ea(this,"numParticles"),ea(this,"particleDensity"),ea(this,"refreshInterval"),ea(this,"fadeFactor"),ea(this,"particleColor"),ea(this,"particleFastColor"),ea(this,"particleFastSpeed"),ea(this,"particleSize"),ea(this,"drawAsLines"),ea(this,"particleSpeed"),ea(this,"pixelRatio"),ea(this,"prevRenderTime",0),ea(this,"lastRenderTime",0),ea(this,"forceRender",!0),ea(this,"rttTimestep",200),ea(this,"tileGridPass",0),ea(this,"particlesTexturePreview"),t&&o&&this.initParticle(t,o,r)}initParticle(e,t,o){if(this.init(e,o,null),this.extentScale=1.2,this.numParticles=128,null!=t.maxAmount)if(t.maxAmount>=4&&t.maxAmount&&!(t.maxAmount&t.maxAmount-1))this.numParticles=t.maxAmount;else throw Error("The number of particles needs to be power of two and at least 4");let r=window.devicePixelRatio;this.particleDensity=t.density??2,this.particleDensity/=r*r,this.refreshInterval=t.refreshInterval??800,this.fadeFactor=t.fadeFactor??.1,this.particleColor=eR(t.color??[255,255,255,192]),this.particleFastColor=t.fastColor?eR(t.fastColor):this.particleColor,this.particleFastSpeed=(t.fastSpeed??2)*r,this.particleSize=t.size??1.5,this.drawAsLines=t.drawAsLines??!1,this.particleSpeed=(t.speed??.001)/1e3,this.pixelRatio=t.pixelRatio??(r>1?1:2),this.particleTexturePrev=this.generateRandomizeParticleTexture(this.numParticles,this.numParticles),this.particleTexture0=new et.nWS(this.numParticles,this.numParticles,{stencilBuffer:!1,depthBuffer:!1}),this.particleTexture0.texture=this.particleTexturePrev.clone(),this.particleTexture1=this.particleTexture0.clone(),this.rttMaterial=new et.D$Q({glslVersion:et.Wdf,uniforms:{tileGridPass:{value:this.tileGridPass},uniformSpeed:{value:t.uniformSpeed??!1},canvasDiagonal:{value:0},angleDirectionShiftSkip:{value:t.angleDirectionShiftSkip??90},rttXY:{value:[0,0]},rttScale:{value:1},rttTexture:{value:this.particleTexture0.texture},tileScale:{value:0},useAlphaAsMask:{value:t.useAlphaAsMask??!1},tilePosition:{value:[0,0]},time:{value:0},timestep:{value:0},tex0xy:{value:[0,0]},tex1xy:{value:[0,0]},tex0size:{value:1},tex1size:{value:1},tex0:{value:null},tex1:{value:null}},vertexShader:"precision highp float;uniform mat4 modelViewMatrix;uniform mat4 projectionMatrix;in vec3 position;in vec2 uv;out vec2 rttCoord;void main(){rttCoord=uv;gl_Position=projectionMatrix*vec4(position,1.);}",fragmentShader:tW,defines:{D_MIN:(t.decodeMin??0).toFixed(2),D_MAX:(t.decodeMax??1).toFixed(2),D_CHANNELS:t.decodeChannels??"rg",D_WAVES:t.decodeAsWaves?"true":"false"},depthTest:!1,depthWrite:!1}),this.rttCamera=new et.qUd(-this.numParticles/2,this.numParticles/2,this.numParticles/2,-this.numParticles/2,-100,100),this.rttMesh=new et.eaF(new et.bdM(this.numParticles,this.numParticles),this.rttMaterial),this.rttScene.add(this.rttMesh),this.accumulator=new et.nWS(16,16,{minFilter:et.k6q,magFilter:et.k6q,stencilBuffer:!1,format:et.GWd,depthBuffer:!1}),this.particleBackground=new et.eaF(new et.bdM(2,2),new et.D$Q({glslVersion:et.Wdf,transparent:!0,blending:et.bCz,blendEquationAlpha:et.nST,vertexShader:"precision highp float;in vec3 position;void main(){gl_Position=vec4(position,1.);}",fragmentShader:`precision highp float;out vec4 fragColor;void main(){fragColor=vec4(.0,.0,.0,${this.fadeFactor.toFixed(2)});}`}));let l=r*this.pixelRatio*this.particleSize,a=r*this.particleSize;if(this.particleMaterial=new et.D$Q({glslVersion:et.Wdf,uniforms:{fastIsLarger:{value:t.fastIsLarger??!1},rttSize:{value:this.numParticles},rttTexture:{value:this.particleTexture1.texture},rttTexturePrev:{value:this.particleTexturePrev},screenSize:{value:1},extrapolationFactor:{value:0},renderStepSize:{value:0}},vertexShader:this.drawAsLines?tO:"precision highp float;precision highp sampler2D;in float position;uniform sampler2D rttTexture;uniform sampler2D rttTexturePrev;uniform float rttSize;uniform float screenSize;uniform float extrapolationFactor;uniform float renderStepSize;uniform bool fastIsLarger;out float speed;float factor=1.;vec4 advance(float position_){if(position_>(DENSITY/1000.0)*screenSize*screenSize){speed=0.0;return vec4(0.0);}float x=fract(position_/rttSize);float y=floor(position_/rttSize)/rttSize;vec4 color=texture(rttTexture,vec2(x,y));vec2 pos=color.ba+color.rg/255.0;vec4 colorPrev=texture(rttTexturePrev,vec2(x,y));vec2 posPrev=colorPrev.ba+colorPrev.rg/255.0;vec2 diff=pos-posPrev;pos+=diff*extrapolationFactor;speed=renderStepSize*step(0.0001,dot(posPrev,posPrev))*length(diff*screenSize);return vec4(pos,diff);}void main(){vec4 posdiff=advance(position);gl_PointSize=fastIsLarger ?(SIZE+SIZE*log(speed+1.))/2. : SIZE;gl_Position=vec4(2.0*posdiff.x-1.0,-(2.0*posdiff.y-1.0),0.,1.);}",fragmentShader:"precision highp float;precision highp sampler2D;out vec4 fragColor;in float speed;void main(){vec2 uv=vec2(gl_PointCoord.x-0.5,1.0-gl_PointCoord.y-0.5);float dFromCenter=sqrt(uv.x*uv.x+uv.y*uv.y);if(dFromCenter>0.5){discard;return;}if(speed==0.){discard;return;}float colorFactor=min(1.0,speed/COLOR_SPEED);fragColor=mix(COLOR_A,COLOR_B,colorFactor);float opacityFactor=smoothstep(0.05,0.1,speed);fragColor.a*=opacityFactor;}",defines:{COLOR_A:this.particleColor,COLOR_B:this.particleFastColor,COLOR_SPEED:this.particleFastSpeed.toFixed(2),DENSITY:this.particleDensity.toFixed(2),SIZE:(this.drawAsLines?a:l).toFixed(1)},transparent:!0,depthTest:!1,depthWrite:!1,linewidth:this.pixelRatio}),this.drawAsLines){let e=new Float32Array(Array(2*this.numParticles*this.numParticles).keys()),t=new et.LoY;t.setAttribute("position",new et.qtW(e,1)),this.particles=new et.DXC(t,this.particleMaterial)}else{let e=new Float32Array(Array(this.numParticles*this.numParticles).keys()),t=new et.LoY;t.setAttribute("position",new et.qtW(e,1)),this.particles=new et.ONl(t,this.particleMaterial)}this.particles.frustumCulled=!1;let s=new et.D$Q({glslVersion:et.Wdf,premultipliedAlpha:!0,transparent:!0,depthTest:!1,depthWrite:!1,uniforms:{opacity:{value:1},tex0:{value:this.accumulator.texture}},vertexShader:"precision highp float;uniform mat4 modelViewMatrix;uniform mat4 projectionMatrix;in vec3 position;in vec2 uv;out vec2 coord;void main(){coord=uv;gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1.);}",fragmentShader:"precision highp float;precision highp sampler2D;uniform float opacity;uniform sampler2D tex0;in vec2 coord;out vec4 fragColor;void main(){vec4 c=texture(tex0,coord);if(c.a<1.0/16.0){discard;}if(opacity<0.0001){discard;}fragColor=c;fragColor.a*=opacity;}"});this.accumulatorDrawMesh=new et.eaF(new et.bdM(1,1),s),this.accumulatorDrawMesh.renderOrder=2,this.slippyTilesGroup.add(this.accumulatorDrawMesh),this.globeTilesService.visibleTilesAreaMesh.visible=!0,this.globeTilesService.visibleTilesAreaMesh.material=s,setInterval(()=>{this.renderer&&this.randomizeParticles(!1)},this.refreshInterval),this.on("extentChanged",()=>{this.refresh()})}generateRandomizeParticleTexture(e,t){let o=new Uint8Array(4*e*t);for(let e=0;e<o.length;
81e++)o[e]=Math.floor(256*Math.random());return new et.GYF(o,e,t)}randomizeParticles(e){if(!this.renderer)return;let t=this.numParticles,o=this.numParticles,r=new et.I9Y(0,0);if(!e){let e=this.numParticles/4;t=e,o=e,r.x=Math.floor(Math.random()*this.numParticles/e)*e,r.y=Math.floor(Math.random()*this.numParticles/e)*e}let l=this.generateRandomizeParticleTexture(t,o);this.renderer.copyTextureToTexture(r,l,this.particleTexturePrev),this.renderer.copyTextureToTexture(r,l,this.particleTexture0.texture),this.renderer.copyTextureToTexture(r,l,this.particleTexture1.texture),l.dispose(),this.forceRender=e}getParticleUtilization(){let e=this.particleMaterial.uniforms.screenSize.value;return this.particleDensity/1e3*e*e/(this.numParticles*this.numParticles)}setOpacity(e){super.setOpacity(e),this.accumulatorDrawMesh.material.uniforms.opacity.value=e}disposeObjects(){super.disposeObjects(),this.particleTexturePrev.dispose(),this.particleTexture0.texture.dispose(),this.particleTexture0.dispose(),this.particleTexture1.texture.dispose(),this.particleTexture1.dispose(),this.accumulator.texture.dispose(),this.accumulator.dispose(),this.rttMesh.geometry.dispose(),this.rttMesh.material.dispose(),this.particleBackground.geometry.dispose(),this.particleBackground.material.dispose(),this.particles.geometry.dispose(),this.particles.material.dispose(),this.accumulatorDrawMesh.geometry.dispose(),this.accumulatorDrawMesh.material.dispose()}updateRenderingSize(){let e=this.getMapOrThrow(),t=e.getZoom(),o=e.getPitch(),r=e.getCanvas(),l=r.width,a=r.height,{resolutionScaleFactor:s}=tI(o,e),n=2048*this.pixelRatio*s,h=n;h=Math.min(h=!0===this.getMapOrThrow().isGlobeProjection()?t>5?n:Math.max(.75*t*n,1024):Math.round(this.pixelRatio*this.extentScale*Math.max(l,a)),this.getRendererOrThrow().capabilities.maxTextureSize);let u=Math.sqrt(l*l+a*a)*(1===devicePixelRatio?2:1);this.rttMaterial.uniforms.canvasDiagonal.value=u,this.particleMaterial.uniforms.screenSize.value=h,this.accumulator.setSize(h,h),this.slippyTilesGroup.remove(this.accumulatorDrawMesh),this.slippyTilesGroup.add(this.accumulatorDrawMesh)}refresh(){super.refresh(),!1===this.getMapOrThrow().isGlobeProjection()?this.refreshMercator():this.refreshGlobe(),this.updateRenderingSize();let e=this.getRendererOrThrow();e.setRenderTarget(this.accumulator),e.setClearAlpha(0),e.clearColor(),e.setRenderTarget(null),this.randomizeParticles(!0)}prerenderInternal(){let e=performance.now(),t=e-this.lastRenderTime,o=this.forceRender||t>this.rttTimestep||!this.prevRenderTime;o&&(this.forceRender=!1,this.rttMaterial.uniforms.timestep.value=this.particleSpeed*t,this.getRendererOrThrow().setRenderTarget(this.flipFlop?this.particleTexture1:this.particleTexture0),this.getRendererOrThrow().copyFramebufferToTexture(new et.I9Y(0,0),this.particleTexturePrev),this.prevRenderTime=this.lastRenderTime,this.lastRenderTime=e,!1===this.getMapOrThrow().isGlobeProjection()?this.prerenderInternalMercator():this.prerenderInternalGlobe(),this.particleMaterial.uniforms.rttTexture.value=(this.flipFlop?this.particleTexture1:this.particleTexture0).texture,this.tileGridPass=+(0===this.tileGridPass));let r=this.lastRenderTime-this.prevRenderTime;this.particleMaterial.uniforms.extrapolationFactor.value=o?0:t/r,this.particleMaterial.uniforms.renderStepSize.value=r/1e3;let l=this.getRendererOrThrow();if(l.setRenderTarget(this.accumulator),l.render(this.particleBackground,this.camera),l.render(this.particles,this.camera),l.setRenderTarget(null),void 0!==this.particlesTexturePreview){let e=this.accumulator.width,t=this.accumulator.height,o=new Uint8Array(e*t*4);l.readRenderTargetPixels(this.accumulator,0,0,e,t,o),this.particlesTexturePreview.update(o,e,t)}}refreshMercator(){let e=this.getVisibleExtent(this.extentScale);if(!e)throw Error("The extent is null");let t=Math.max(e[2]-e[0],e[3]-e[1])/eI,o=[.5+(e[2]+e[0])/2/eI-t/2,.5-(e[3]+e[1])/2/eI-t/2];this.rttMaterial.uniforms.rttScale.value=t,this.rttMaterial.uniforms.rttXY.value=o}prerenderInternalMercator(){let e=this.slippyTiles.length;for(let t=0;t<e;t++){let e=this.slippyTiles[0].length;for(let o=0;o<e;o++){let e=this.slippyTiles[t][o];if(!e.visible)continue;let r=e.material.uniforms;if(!r)continue;let l=e.scale.x;this.rttMaterial.uniforms.tileScale.value=l,this.rttMaterial.uniforms.tilePosition.value=[e.position.x/l-.5,-e.position.y/l-.5],this.rttMaterial.uniforms.tileGridPass.value=this.tileGridPass,this.rttMaterial.uniforms.time.value=r.time.value,this.rttMaterial.uniforms.tex0.value=r.tex0.value,this.rttMaterial.uniforms.tex0xy.value=r.tex0xy.value,this.rttMaterial.uniforms.tex0size.value=r.tex0size.value,this.rttMaterial.uniforms.tex1.value=r.tex1.value,this.rttMaterial.uniforms.tex1xy.value=r.tex1xy.value,this.rttMaterial.uniforms.tex1size.value=r.tex1size.value,this.rttMaterial.uniforms.rttTexture.value=(this.flipFlop?this.particleTexture1:this.particleTexture0).texture;let a=this.getRendererOrThrow();a.setRenderTarget(this.flipFlop?this.particleTexture0:this.particleTexture1),a.render(this.rttScene,this.rttCamera),this.flipFlop=!this.flipFlop}}}refreshGlobe(){this.rttMaterial.uniforms.rttScale.value=1,this.rttMaterial.uniforms.rttXY.value=[0,0]}prerenderInternalGlobe(){let e=[...this.globeTilesService.currentTilesMeshes.entries()].map(([e])=>e),t=this.getMapOrThrow().getCenter(),o=this.getMapOrThrow().getZoom(),r
81=Math.floor(Math.sqrt(e.length)),l=t.lng>=0?Math.floor(t.lng/90):-1*Math.floor(Math.abs(t.lng)/90),a=0;if(this.globeTilesService.visibleTilesAreaMesh.rotation.y=0,o<=4){let e=l*et.cj9.degToRad(180);this.globeTilesService.visibleTilesAreaMesh.rotation.y=e,a=r/2*l}let{frameA:s,frameB:n,mix:h}=this.getCurrentFrames();if(!(!s||!n))for(let t of e){let o=e.indexOf(t),l=(Math.floor(o/r)+a+r)%r,u=o%r;this.rttMaterial.uniforms.tileScale.value=1/r,this.rttMaterial.uniforms.tilePosition.value=[l,u];let c=this.getTilesPair(s,n,t);if(null===c)continue;let{tileA:v,tileB:m}=c;this.rttMaterial.uniforms.tileGridPass.value=this.tileGridPass,this.rttMaterial.uniforms.time.value=h,this.rttMaterial.uniforms.tex0.value=v.tile.texture,this.rttMaterial.uniforms.tex0xy.value=v.xy,this.rttMaterial.uniforms.tex0size.value=v.size,this.rttMaterial.uniforms.tex1.value=m.tile.texture,this.rttMaterial.uniforms.tex1xy.value=m.xy,this.rttMaterial.uniforms.tex1size.value=m.size,this.rttMaterial.uniforms.rttTexture.value=(this.flipFlop?this.particleTexture1:this.particleTexture0).texture;let d=this.getRendererOrThrow();d.setRenderTarget(this.flipFlop?this.particleTexture0:this.particleTexture1),d.render(this.rttScene,this.rttCamera),this.flipFlop=!this.flipFlop}}renderInternal(){if(!1===this.getMapOrThrow().isGlobeProjection()){let e=this.rttMaterial.uniforms.rttScale.value;this.accumulatorDrawMesh.position.x=.5*e+this.rttMaterial.uniforms.rttXY.value[0],this.accumulatorDrawMesh.position.y=-.5*e-this.rttMaterial.uniforms.rttXY.value[1],this.accumulatorDrawMesh.scale.x=this.accumulatorDrawMesh.scale.y=e}}}eB.builtin.VIRIDIS}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.