forked from zqianem/virtual-ice-homepage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webcomponent.js
5 lines (5 loc) · 135 KB
/
webcomponent.js
1
2
3
4
5
/**
* Includes code from some of the following libraries:
* https://fev2r.netlify.app/legal/THIRD_PARTY
*/
!function(){"use strict";function t(){}function e(t){return t()}function o(){return Object.create(null)}function r(t){t.forEach(e)}function n(t){return"function"==typeof t}function i(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function a(t,e){t.appendChild(e)}function l(t,e,o){t.insertBefore(e,o||null)}function s(t){t.parentNode.removeChild(t)}function c(t){return document.createElement(t)}function u(){return t=" ",document.createTextNode(t);var t}function f(t,e,o){null==o?t.removeAttribute(e):t.getAttribute(e)!==o&&t.setAttribute(e,o)}function d(t){const e={};for(const o of t)e[o.name]=o.value;return e}let h;function p(t){h=t}function m(t){(function(){if(!h)throw new Error("Function called outside component initialization");return h})().$$.on_mount.push(t)}const _=[],y=[],x=[],g=[],v=Promise.resolve();let L=!1;function b(t){x.push(t)}let P=!1;const A=new Set;function C(){if(!P){P=!0;do{for(let t=0;t<_.length;t+=1){const e=_[t];p(e),w(e.$$)}for(p(null),_.length=0;y.length;)y.pop()();for(let t=0;t<x.length;t+=1){const e=x[t];A.has(e)||(A.add(e),e())}x.length=0}while(_.length);for(;g.length;)g.pop()();L=!1,P=!1,A.clear()}}function w(t){if(null!==t.fragment){t.update(),r(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(b)}}const F=new Set;function E(t,e){-1===t.$$.dirty[0]&&(_.push(t),L||(L=!0,v.then(C)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function I(i,a,l,c,u,f,d=[-1]){const m=h;p(i);const _=i.$$={fragment:null,ctx:null,props:f,update:t,not_equal:u,bound:o(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(m?m.$$.context:a.context||[]),callbacks:o(),dirty:d,skip_bound:!1};let y=!1;if(_.ctx=l?l(i,a.props||{},((t,e,...o)=>{const r=o.length?o[0]:e;return _.ctx&&u(_.ctx[t],_.ctx[t]=r)&&(!_.skip_bound&&_.bound[t]&&_.bound[t](r),y&&E(i,t)),e})):[],_.update(),y=!0,r(_.before_update),_.fragment=!!c&&c(_.ctx),a.target){if(a.hydrate){const t=function(t){return Array.from(t.childNodes)}(a.target);_.fragment&&_.fragment.l(t),t.forEach(s)}else _.fragment&&_.fragment.c();a.intro&&((x=i.$$.fragment)&&x.i&&(F.delete(x),x.i(g))),function(t,o,i,a){const{fragment:l,on_mount:s,on_destroy:c,after_update:u}=t.$$;l&&l.m(o,i),a||b((()=>{const o=s.map(e).filter(n);c?c.push(...o):r(o),t.$$.on_mount=[]})),u.forEach(b)}(i,a.target,a.anchor,a.customElement),C()}var x,g;p(m)}let S;"function"==typeof HTMLElement&&(S=class extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"})}connectedCallback(){const{on_mount:t}=this.$$;this.$$.on_disconnect=t.map(e).filter(n);for(const t in this.$$.slotted)this.appendChild(this.$$.slotted[t])}attributeChangedCallback(t,e,o){this[t]=o}disconnectedCallback(){r(this.$$.on_disconnect)}$destroy(){!function(t,e){const o=t.$$;null!==o.fragment&&(r(o.on_destroy),o.fragment&&o.fragment.d(e),o.on_destroy=o.fragment=null,o.ctx=[])}(this,1),this.$destroy=t}$on(t,e){const o=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return o.push(e),()=>{const t=o.indexOf(e);-1!==t&&o.splice(t,1)}}$set(t){var e;this.$$set&&(e=t,0!==Object.keys(e).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}});const z=5120,T=5121,D=5122,M=5123,R=5124,j=5125,$=5126,B={};{const t=B;t[z]=Int8Array,t[5121]=Uint8Array,t[5122]=Int16Array,t[5123]=Uint16Array,t[R]=Int32Array,t[5125]=Uint32Array,t[5126]=Float32Array,t[32819]=Uint16Array,t[32820]=Uint16Array,t[33635]=Uint16Array,t[5131]=Uint16Array,t[33640]=Uint32Array,t[35899]=Uint32Array,t[35902]=Uint32Array,t[36269]=Uint32Array,t[34042]=Uint32Array}function O(t){if(t instanceof Int8Array)return z;if(t instanceof Uint8Array)return T;if(t instanceof Uint8ClampedArray)return T;if(t instanceof Int16Array)return D;if(t instanceof Uint16Array)return M;if(t instanceof Int32Array)return R;if(t instanceof Uint32Array)return j;if(t instanceof Float32Array)return $;throw new Error("unsupported typed array type")}const k="undefined"!=typeof SharedArrayBuffer?function(t){return t&&t.buffer&&(t.buffer instanceof ArrayBuffer||t.buffer instanceof SharedArrayBuffer)}:function(t){return t&&t.buffer&&t.buffer instanceof ArrayBuffer};function N(...t){console.error(...t)}function U(t,e){return"undefined"!=typeof WebGLRenderbuffer&&e instanceof WebGLRenderbuffer}function H(t,e){return"undefined"!=typeof WebGLTexture&&e instanceof WebGLTexture}const G=34962,W="";function V(t,e,o,r){if(n=e,"undefined"!=typeof WebGLBuffer&&n instanceof WebGLBuffer)return e;var n;o=o||G;const i=t.createBuffer();return function(t,e,o,r,n){t.bindBuffer(e,o),t.bufferData(e,r,n||35044)}(t,o,i,e,r),i}function q(t){return"indices"===t}const X=/coord|texture/i,Y=/color|colour/i;function Z(t,e){let o;if(o=X.test(t)?2:Y.test(t)?4:3,e%o>0)throw new Error(`Can not guess numComponents for attribute '${t}'. Tried ${o} but ${e} values is not evenly divisible by ${o}. You should specify it.`);return o}function K(t,e){if(k(t))return t;if(k(t.data))return t.data;Array.isArray(t)&&(t={data:t});let o=t.type;return o||(o=q(e)?Uint16Array:Float32Array),new o(t.data)}function Q(t,e){const o={};return Object.keys(e).forEach((function(r){if(!q(r)){const i=e[r],a=i.attrib||i.name||i.attribName||W+r;if(i.value){if(!Array.isArray(i.value)&&!k(i.value))throw new Error("array.value is not array or typedarray");o[a]={value:i.value}}else{let e,l,s,c;if(i.buffer&&i.buffer instanceof WebGLBuffer)e=i.buffer,c=i.numComponents||i.size,l=i.type,s=i.normalize;else if("number"==typeof i||"number"==typeof i.data){const o=i.data||i,a=i.type||Float32Array,u=o*a.BYTES_PER_ELEMENT;l=function(t){if(t===Int8Array)return z;if(t===Uint8Array)return T;if(t===Uint8ClampedArray)return T;if(t===Int16Array)return D;if(t===Uint16Array)return M;if(t===Int32Array)return R;if(t===Uint32Array)return j;if(t===Float32Array)return $;throw new Error("unsupported typed array type")}(a),s=void 0!==i.normalize?i.normalize:(n=a)===Int8Array||n===Uint8Array,c=i.numComponents||i.size||Z(r,o),e=t.createBuffer(),t.bindBuffer(G,e),t.bufferData(G,u,i.drawType||35044)}else{const o=K(i,r);e=V(t,o,void 0,i.drawType),l=O(o),s=void 0!==i.normalize?i.normalize:function(t){return t instanceof Int8Array||t instanceof Uint8Array}(o),c=function(t,e){return t.numComponents||t.size||Z(e,function(t){return t.length?t:t.data}(t).length)}(i,r)}o[a]={buffer:e,numComponents:c,type:l,normalize:s,stride:i.stride||0,offset:i.offset||0,divisor:void 0===i.divisor?void 0:i.divisor,drawType:i.drawType}}}var n})),t.bindBuffer(G,null),o}const J=["position","positions","a_position"];function tt(t,e,o){const r=Q(t,e),n=Object.assign({},o||{});n.attribs=Object.assign({},o?o.attribs:{},r);const i=e.indices;if(i){const e=K(i,"indices");n.indices=V(t,e,34963),n.numElements=e.length,n.elementType=O(e)}else n.numElements||(n.numElements=function(t,e){let o,r;for(r=0;r<J.length&&(o=J[r],!(o in e))&&(o=W+o,!(o in e));++r);r===J.length&&(o=Object.keys(e)[0]);const n=e[o];t.bindBuffer(G,n.buffer);const i=t.getBufferParameter(G,34660);var a;t.bindBuffer(G,null);const l=i/(5120===(a=n.type)||5121===a?1:5122===a||5123===a?2:5124===a||5125===a||5126===a?4:0),s=n.numComponents||n.size,c=l/s;if(c%1!=0)throw new Error(`numComponents ${s} not correct for length ${length}`);return c}(t,n.attribs));return n}function et(t){return!!t.texStorage2D}const ot=function(){const t={},e={};return function(o,r){return function(o){const r=o.constructor.name;if(!t[r]){for(const t in o)if("number"==typeof o[t]){const r=e[o[t]];e[o[t]]=r?`${r} | ${t}`:t}t[r]=!0}}(o),e[r]||("number"==typeof r?`0x${r.toString(16)}`:r)}}(),rt={textureColor:new Uint8Array([128,192,255,255]),textureOptions:{},crossOrigin:void 0},nt=k,it=function(){let t;return function(){return t=t||("undefined"!=typeof document&&document.createElement?document.createElement("canvas").getContext("2d"):null),t}}(),at=6407,lt=6408,st=6402,ct=33071,ut=3553,ft=34067,dt=32879,ht=35866,pt=34069,mt=10241,_t=10240,yt=10242,xt=10243,gt=3317,vt=5120,Lt=5121,bt=5122,Pt=5123,At=5124,Ct=5125,wt=5126,Ft=5131,Et=36193,It=33640,St=33319,zt=33320,Tt=6403,Dt=36244,Mt=36248,Rt=36249;let jt;function $t(t){if(!jt){const t={};t[6406]={textureFormat:6406,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[1,2,2,4],type:[Lt,Ft,Et,wt]},t[6409]={textureFormat:6409,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[1,2,2,4],type:[Lt,Ft,Et,wt]},t[6410]={textureFormat:6410,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[2,4,4,8],type:[Lt,Ft,Et,wt]},t[at]={textureFormat:at,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[3,6,6,12,2],type:[Lt,Ft,Et,wt,33635]},t[lt]={textureFormat:lt,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4,8,8,16,2,2],type:[Lt,Ft,Et,wt,32819,32820]},t[6402]={textureFormat:st,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[2,4],type:[Ct,Pt]},t[33321]={textureFormat:Tt,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[1],type:[Lt]},t[36756]={textureFormat:Tt,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[1],type:[vt]},t[33325]={textureFormat:Tt,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[4,2],type:[wt,Ft]},t[33326]={textureFormat:Tt,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[4],type:[wt]},t[33330]={textureFormat:Dt,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[1],type:[Lt]},t[33329]={textureFormat:Dt,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[1],type:[vt]},t[33332]={textureFormat:Dt,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[2],type:[Pt]},t[33331]={textureFormat:Dt,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[2],type:[bt]},t[33334]={textureFormat:Dt,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[Ct]},t[33333]={textureFormat:Dt,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[At]},t[33323]={textureFormat:St,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[2],type:[Lt]},t[36757]={textureFormat:St,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[2],type:[vt]},t[33327]={textureFormat:St,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[8,4],type:[wt,Ft]},t[33328]={textureFormat:St,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[8],type:[wt]},t[33336]={textureFormat:zt,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[2],type:[Lt]},t[33335]={textureFormat:zt,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[2],type:[vt]},t[33338]={textureFormat:zt,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[Pt]},t[33337]={textureFormat:zt,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[bt]},t[33340]={textureFormat:zt,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[8],type:[Ct]},t[33339]={textureFormat:zt,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[8],type:[At]},t[32849]={textureFormat:at,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[3],type:[Lt]},t[35905]={textureFormat:at,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[3],type:[Lt]},t[36194]={textureFormat:at,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[3,2],type:[Lt,33635]},t[36758]={textureFormat:at,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[3],type:[vt]},t[35898]={textureFormat:at,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[12,6,4],type:[wt,Ft,35899]},t[35901]={textureFormat:at,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[12,6,4],type:[wt,Ft,35902]},t[34843]={textureFormat:at,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[12,6],type:[wt,Ft]},t[34837]={textureFormat:at,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[12],type:[wt]},t[36221]={textureFormat:Mt,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[3],type:[Lt]},t[36239]={textureFormat:Mt,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[3],type:[vt]},t[36215]={textureFormat:Mt,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[6],type:[Pt]},t[36233]={textureFormat:Mt,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[6],type:[bt]},t[36209]={textureFormat:Mt,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[12],type:[Ct]},t[36227]={textureFormat:Mt,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[12],type:[At]},t[32856]={textureFormat:lt,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4],type:[Lt]},t[35907]={textureFormat:lt,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4],type:[Lt]},t[36759]={textureFormat:lt,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[4],type:[vt]},t[32855]={textureFormat:lt,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4,2,4],type:[Lt,32820,It]},t[32854]={textureFormat:lt,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4,2],type:[Lt,32819]},t[32857]={textureFormat:lt,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4],type:[It]},t[34842]={textureFormat:lt,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[16,8],type:[wt,Ft]},t[34836]={textureFormat:lt,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[16],type:[wt]},t[36220]={textureFormat:Rt,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[Lt]},t[36238]={textureFormat:Rt,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[vt]},t[36975]={textureFormat:Rt,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[It]},t[36214]={textureFormat:Rt,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[8],type:[Pt]},t[36232]={textureFormat:Rt,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[8],type:[bt]},t[36226]={textureFormat:Rt,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[16],type:[At]},t[36208]={textureFormat:Rt,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[16],type:[Ct]},t[33189]={textureFormat:st,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[2,4],type:[Pt,Ct]},t[33190]={textureFormat:st,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[Ct]},t[36012]={textureFormat:st,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[wt]},t[35056]={textureFormat:34041,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[34042]},t[36013]={textureFormat:34041,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[36269]},Object.keys(t).forEach((function(e){const o=t[e];o.bytesPerElementMap={},o.bytesPerElement.forEach((function(t,e){const r=o.type[e];o.bytesPerElementMap[r]=t}))})),jt=t}return jt[t]}function Bt(t){const e=$t(t);if(!e)throw"unknown internal format";return{format:e.textureFormat,type:e.type[0]}}function Ot(t){return 0==(t&t-1)}function kt(t,e,o){return nt(e)?O(e):o||Lt}function Nt(t,e,o,r,n){if(n%1!=0)throw"can't guess dimensions";if(o||r){if(r){if(!o&&(o=n/r)%1)throw"can't guess dimensions"}else if((r=n/o)%1)throw"can't guess dimensions"}else{const t=Math.sqrt(n/(e===ft?6:1));t%1==0?(o=t,r=t):(o=n,r=1)}return{width:o,height:r}}function Ut(t,e){void 0!==e.colorspaceConversion&&t.pixelStorei(37443,e.colorspaceConversion),void 0!==e.premultiplyAlpha&&t.pixelStorei(37441,e.premultiplyAlpha),void 0!==e.flipY&&t.pixelStorei(37440,e.flipY)}function Ht(t){t.pixelStorei(gt,4),et(t)&&(t.pixelStorei(3314,0),t.pixelStorei(32878,0),t.pixelStorei(3316,0),t.pixelStorei(3315,0),t.pixelStorei(32877,0))}function Gt(t,e,o,r){var n;r.minMag&&(o.call(t,e,mt,r.minMag),o.call(t,e,_t,r.minMag)),r.min&&o.call(t,e,mt,r.min),r.mag&&o.call(t,e,_t,r.mag),r.wrap&&(o.call(t,e,yt,r.wrap),o.call(t,e,xt,r.wrap),(e===dt||(n=e,"undefined"!=typeof WebGLSampler&&n instanceof WebGLSampler))&&o.call(t,e,32882,r.wrap)),r.wrapR&&o.call(t,e,32882,r.wrapR),r.wrapS&&o.call(t,e,yt,r.wrapS),r.wrapT&&o.call(t,e,xt,r.wrapT),r.minLod&&o.call(t,e,33082,r.minLod),r.maxLod&&o.call(t,e,33083,r.maxLod),r.baseLevel&&o.call(t,e,33084,r.baseLevel),r.maxLevel&&o.call(t,e,33085,r.maxLevel)}function Wt(t,e,o){const r=o.target||ut;t.bindTexture(r,e),Gt(t,r,t.texParameteri,o)}function Vt(t,e,o,r,n,i){i=i||lt;const a=(o=o||rt.textureOptions).target||ut;if(r=r||o.width,n=n||o.height,t.bindTexture(a,e),function(t,e,o,r){if(!et(t))return Ot(e)&&Ot(o);const n=$t(r);if(!n)throw"unknown internal format";return n.colorRenderable&&n.textureFilterable}(t,r,n,i))t.generateMipmap(a);else{const e=function(t){const e=$t(t);if(!e)throw"unknown internal format";return e.textureFilterable}(i)?9729:9728;t.texParameteri(a,mt,e),t.texParameteri(a,_t,e),t.texParameteri(a,yt,ct),t.texParameteri(a,xt,ct)}}function qt(t){return!0===t.auto||void 0===t.auto&&void 0===t.level}function Xt(t,e){return(e=e||{}).cubeFaceOrder||[pt,34070,34071,34072,34073,34074]}function Yt(t,e){const o=Xt(0,e).map((function(t,e){return{face:t,ndx:e}}));return o.sort((function(t,e){return t.face-e.face})),o}function Zt(t,e,o,r){const n=(r=r||rt.textureOptions).target||ut,i=r.level||0;let a=o.width,l=o.height;const s=r.internalFormat||r.format||lt,c=Bt(s),u=r.format||c.format,f=r.type||c.type;if(Ut(t,r),t.bindTexture(n,e),n===ft){const c=o.width,d=o.height;let h,p;if(c/6===d)h=d,p=[0,0,1,0,2,0,3,0,4,0,5,0];else if(d/6===c)h=c,p=[0,0,0,1,0,2,0,3,0,4,0,5];else if(c/3==d/2)h=c/3,p=[0,0,1,0,2,0,0,1,1,1,2,1];else{if(c/2!=d/3)throw"can't figure out cube map from element: "+(o.src?o.src:o.nodeName);h=c/2,p=[0,0,1,0,0,1,1,1,0,2,1,2]}const m=it();m?(m.canvas.width=h,m.canvas.height=h,a=h,l=h,Yt(0,r).forEach((function(e){const r=p[2*e.ndx+0]*h,n=p[2*e.ndx+1]*h;m.drawImage(o,r,n,h,h,0,0,h,h),t.texImage2D(e.face,i,s,u,f,m.canvas)})),m.canvas.width=1,m.canvas.height=1):"undefined"!=typeof createImageBitmap&&(a=h,l=h,Yt(0,r).forEach((function(c){const d=p[2*c.ndx+0]*h,m=p[2*c.ndx+1]*h;t.texImage2D(c.face,i,s,h,h,0,u,f,null),createImageBitmap(o,d,m,h,h,{premultiplyAlpha:"none",colorSpaceConversion:"none"}).then((function(o){Ut(t,r),t.bindTexture(n,e),t.texImage2D(c.face,i,s,u,f,o),qt(r)&&Vt(t,e,r,a,l,s)}))})))}else if(n===dt||n===ht){const e=Math.min(o.width,o.height),r=Math.max(o.width,o.height),a=r/e;if(a%1!=0)throw"can not compute 3D dimensions of element";const l=o.width===r?1:0,c=o.height===r?1:0;t.pixelStorei(gt,1),t.pixelStorei(3314,o.width),t.pixelStorei(32878,0),t.pixelStorei(32877,0),t.texImage3D(n,i,s,e,e,e,0,u,f,null);for(let r=0;r<a;++r){const a=r*e*l,s=r*e*c;t.pixelStorei(3316,a),t.pixelStorei(3315,s),t.texSubImage3D(n,i,0,0,r,e,e,1,u,f,o)}Ht(t)}else t.texImage2D(n,i,s,u,f,o);qt(r)&&Vt(t,e,r,a,l,s),Wt(t,e,r)}function Kt(){}function Qt(t,e){return void 0!==e||function(t){if("undefined"!=typeof document){const e=document.createElement("a");return e.href=t,e.hostname===location.hostname&&e.port===location.port&&e.protocol===location.protocol}{const e=new URL(location.href).origin;return new URL(t,location.href).origin===e}}(t)?e:"anonymous"}function Jt(t){return"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap||"undefined"!=typeof ImageData&&t instanceof ImageData||"undefined"!=typeof HTMLElement&&t instanceof HTMLElement}function te(t,e,o){return Jt(t)?(setTimeout((function(){o(null,t)})),t):function(t,e,o){let r;if(o=o||Kt,e=Qt(t,e=void 0!==e?e:rt.crossOrigin),"undefined"!=typeof Image){r=new Image,void 0!==e&&(r.crossOrigin=e);const n=function(){r.removeEventListener("error",i),r.removeEventListener("load",a),r=null},i=function(){const e="couldn't load image: "+t;N(e),o(e,r),n()},a=function(){o(null,r),n()};return r.addEventListener("error",i),r.addEventListener("load",a),r.src=t,r}if("undefined"!=typeof ImageBitmap){let n,i;const a=function(){o(n,i)},l={};e&&(l.mode="cors"),fetch(t,l).then((function(t){if(!t.ok)throw t;return t.blob()})).then((function(t){return createImageBitmap(t,{premultiplyAlpha:"none",colorSpaceConversion:"none"})})).then((function(t){i=t,setTimeout(a)})).catch((function(t){n=t,setTimeout(a)})),r=null}return r}(t,e,o)}function ee(t,e,o){const r=(o=o||rt.textureOptions).target||ut;if(t.bindTexture(r,e),!1===o.color)return;const n=function(t){return nt(t=t||rt.textureColor)?t:new Uint8Array([255*t[0],255*t[1],255*t[2],255*t[3]])}(o.color);if(r===ft)for(let e=0;e<6;++e)t.texImage2D(pt+e,0,lt,1,1,0,lt,Lt,n);else r===dt||r===ht?t.texImage3D(r,0,lt,1,1,1,0,lt,Lt,n):t.texImage2D(r,0,lt,1,1,0,lt,Lt,n)}function oe(t,e,o,r){r=r||Kt;const n=o.src;if(6!==n.length)throw"there must be 6 urls for a cubemap";const i=o.level||0,a=o.internalFormat||o.format||lt,l=Bt(a),s=o.format||l.format,c=o.type||Lt,u=o.target||ut;if(u!==ft)throw"target must be TEXTURE_CUBE_MAP";ee(t,e,o),o=Object.assign({},o);let f=6;const d=[],h=Xt(0,o);let p;p=n.map((function(n,l){return te(n,o.crossOrigin,(m=h[l],function(n,l){--f,n?d.push(n):l.width!==l.height?d.push("cubemap face img is not a square: "+l.src):(Ut(t,o),t.bindTexture(u,e),5===f?Xt().forEach((function(e){t.texImage2D(e,i,a,s,c,l)})):t.texImage2D(m,i,a,s,c,l),qt(o)&&t.generateMipmap(u)),0===f&&r(d.length?d:void 0,e,p)}));var m}))}function re(t,e,o,r){r=r||Kt;const n=o.src,i=o.internalFormat||o.format||lt,a=Bt(i),l=o.format||a.format,s=o.type||Lt,c=o.target||ht;if(c!==dt&&c!==ht)throw"target must be TEXTURE_3D or TEXTURE_2D_ARRAY";ee(t,e,o),o=Object.assign({},o);let u=n.length;const f=[];let d;const h=o.level||0;let p=o.width,m=o.height;const _=n.length;let y=!0;d=n.map((function(n,a){return te(n,o.crossOrigin,(x=a,function(n,a){if(--u,n)f.push(n);else{if(Ut(t,o),t.bindTexture(c,e),y){y=!1,p=o.width||a.width,m=o.height||a.height,t.texImage3D(c,h,i,p,m,_,0,l,s,null);for(let e=0;e<_;++e)t.texSubImage3D(c,h,0,0,e,p,m,1,l,s,a)}else{let e,o=a;a.width===p&&a.height===m||(e=it(),o=e.canvas,e.canvas.width=p,e.canvas.height=m,e.drawImage(a,0,0,p,m)),t.texSubImage3D(c,h,0,0,x,p,m,1,l,s,o),e&&o===e.canvas&&(e.canvas.width=0,e.canvas.height=0)}qt(o)&&t.generateMipmap(c)}0===u&&r(f.length?f:void 0,e,d)}));var x}))}function ne(t,e,o,r){const n=(r=r||rt.textureOptions).target||ut;t.bindTexture(n,e);let i=r.width,a=r.height,l=r.depth;const s=r.level||0,c=r.internalFormat||r.format||lt,u=Bt(c),f=r.format||u.format,d=r.type||kt(0,o,u.type);if(nt(o))o instanceof Uint8ClampedArray&&(o=new Uint8Array(o.buffer));else{const t=function(t){const e=B[t];if(!e)throw new Error("unknown gl type");return e}(d);o=new t(o)}const h=function(t,e){const o=$t(t);if(!o)throw"unknown internal format";const r=o.bytesPerElementMap[e];if(void 0===r)throw"unknown internal format";return r}(c,d),p=o.byteLength/h;if(p%1)throw"length wrong size for format: "+ot(t,f);let m;if(n===dt||n===ht)if(i||a||l)!i||a&&l?!a||i&&l?(m=Nt(0,n,i,a,p/l),i=m.width,a=m.height):(m=Nt(0,n,i,l,p/a),i=m.width,l=m.height):(m=Nt(0,n,a,l,p/i),a=m.width,l=m.height);else{const t=Math.cbrt(p);if(t%1!=0)throw"can't guess cube size of array of numElements: "+p;i=t,a=t,l=t}else m=Nt(0,n,i,a,p),i=m.width,a=m.height;if(Ht(t),t.pixelStorei(gt,r.unpackAlignment||1),Ut(t,r),n===ft){const e=p/6*(h/o.BYTES_PER_ELEMENT);Yt(0,r).forEach((r=>{const n=e*r.ndx,l=o.subarray(n,n+e);t.texImage2D(r.face,s,c,i,a,0,f,d,l)}))}else n===dt||n===ht?t.texImage3D(n,s,c,i,a,l,0,f,d,o):t.texImage2D(n,s,c,i,a,0,f,d,o);return{width:i,height:a,depth:l,type:d}}function ie(t,e,o){o=o||Kt,e=e||rt.textureOptions;const r=t.createTexture(),n=e.target||ut;let i=e.width||1,a=e.height||1;const l=e.internalFormat||lt;t.bindTexture(n,r),n===ft&&(t.texParameteri(n,yt,ct),t.texParameteri(n,xt,ct));let s=e.src;if(s)if("function"==typeof s&&(s=s(t,e)),"string"==typeof s)!function(t,e,o,r){r=r||Kt,ee(t,e,o=o||rt.textureOptions),te((o=Object.assign({},o)).src,o.crossOrigin,(function(n,i){n?r(n,e,i):(Zt(t,e,i,o),r(null,e,i))}))}(t,r,e,o);else if(nt(s)||Array.isArray(s)&&("number"==typeof s[0]||Array.isArray(s[0])||nt(s[0]))){const o=ne(t,r,s,e);i=o.width,a=o.height}else Array.isArray(s)&&("string"==typeof s[0]||Jt(s[0]))?n===ft?oe(t,r,e,o):re(t,r,e,o):(Zt(t,r,s,e),i=s.width,a=s.height);else!function(t,e,o){const r=o.target||ut;t.bindTexture(r,e);const n=o.level||0,i=o.internalFormat||o.format||lt,a=Bt(i),l=o.format||a.format,s=o.type||a.type;if(Ut(t,o),r===ft)for(let e=0;e<6;++e)t.texImage2D(pt+e,n,i,o.width,o.height,0,l,s,null);else r===dt||r===ht?t.texImage3D(r,n,i,o.width,o.height,o.depth,0,l,s,null):t.texImage2D(r,n,i,o.width,o.height,0,l,s,null)}(t,r,e);return qt(e)&&Vt(t,r,e,i,a,l),Wt(t,r,e),r}const ae=N;function le(t){return"undefined"!=typeof document&&document.getElementById?document.getElementById(t):null}const se=33984,ce=34962,ue=5126,fe=5124,de=5125,he=3553,pe=34067,me=32879,_e=35866,ye={};function xe(t,e){return ye[e].bindPoint}function ge(t,e){return function(o){t.uniform1i(e,o)}}function ve(t,e){return function(o){t.uniform1iv(e,o)}}function Le(t,e){return function(o){t.uniform2iv(e,o)}}function be(t,e){return function(o){t.uniform3iv(e,o)}}function Pe(t,e){return function(o){t.uniform4iv(e,o)}}function Ae(t,e,o,r){const n=xe(0,e);return et(t)?function(e){let i,a;H(0,e)?(i=e,a=null):(i=e.texture,a=e.sampler),t.uniform1i(r,o),t.activeTexture(se+o),t.bindTexture(n,i),t.bindSampler(o,a)}:function(e){t.uniform1i(r,o),t.activeTexture(se+o),t.bindTexture(n,e)}}function Ce(t,e,o,r,n){const i=xe(0,e),a=new Int32Array(n);for(let t=0;t<n;++t)a[t]=o+t;return et(t)?function(e){t.uniform1iv(r,a),e.forEach((function(e,r){let n,l;t.activeTexture(se+a[r]),H(0,e)?(n=e,l=null):(n=e.texture,l=e.sampler),t.bindSampler(o,l),t.bindTexture(i,n)}))}:function(e){t.uniform1iv(r,a),e.forEach((function(e,o){t.activeTexture(se+a[o]),t.bindTexture(i,e)}))}}function we(t,e){return function(o){if(o.value)switch(t.disableVertexAttribArray(e),o.value.length){case 4:t.vertexAttrib4fv(e,o.value);break;case 3:t.vertexAttrib3fv(e,o.value);break;case 2:t.vertexAttrib2fv(e,o.value);break;case 1:t.vertexAttrib1fv(e,o.value);break;default:throw new Error("the length of a float constant value must be between 1 and 4!")}else t.bindBuffer(ce,o.buffer),t.enableVertexAttribArray(e),t.vertexAttribPointer(e,o.numComponents||o.size,o.type||ue,o.normalize||!1,o.stride||0,o.offset||0),void 0!==o.divisor&&t.vertexAttribDivisor(e,o.divisor)}}function Fe(t,e){return function(o){if(o.value){if(t.disableVertexAttribArray(e),4!==o.value.length)throw new Error("The length of an integer constant value must be 4!");t.vertexAttrib4iv(e,o.value)}else t.bindBuffer(ce,o.buffer),t.enableVertexAttribArray(e),t.vertexAttribIPointer(e,o.numComponents||o.size,o.type||fe,o.stride||0,o.offset||0),void 0!==o.divisor&&t.vertexAttribDivisor(e,o.divisor)}}function Ee(t,e){return function(o){if(o.value){if(t.disableVertexAttribArray(e),4!==o.value.length)throw new Error("The length of an unsigned integer constant value must be 4!");t.vertexAttrib4uiv(e,o.value)}else t.bindBuffer(ce,o.buffer),t.enableVertexAttribArray(e),t.vertexAttribIPointer(e,o.numComponents||o.size,o.type||de,o.stride||0,o.offset||0),void 0!==o.divisor&&t.vertexAttribDivisor(e,o.divisor)}}function Ie(t,e,o){const r=o.size,n=o.count;return function(o){t.bindBuffer(ce,o.buffer);const i=o.size||o.numComponents||r,a=i/n,l=o.type||ue,s=ye[l].size*i,c=o.normalize||!1,u=o.offset||0,f=s/n;for(let r=0;r<n;++r)t.enableVertexAttribArray(e+r),t.vertexAttribPointer(e+r,a,l,c,s,u+f*r),void 0!==o.divisor&&t.vertexAttribDivisor(e+r,o.divisor)}}ye[5126]={Type:Float32Array,size:4,setter:function(t,e){return function(o){t.uniform1f(e,o)}},arraySetter:function(t,e){return function(o){t.uniform1fv(e,o)}}},ye[35664]={Type:Float32Array,size:8,setter:function(t,e){return function(o){t.uniform2fv(e,o)}}},ye[35665]={Type:Float32Array,size:12,setter:function(t,e){return function(o){t.uniform3fv(e,o)}}},ye[35666]={Type:Float32Array,size:16,setter:function(t,e){return function(o){t.uniform4fv(e,o)}}},ye[5124]={Type:Int32Array,size:4,setter:ge,arraySetter:ve},ye[35667]={Type:Int32Array,size:8,setter:Le},ye[35668]={Type:Int32Array,size:12,setter:be},ye[35669]={Type:Int32Array,size:16,setter:Pe},ye[5125]={Type:Uint32Array,size:4,setter:function(t,e){return function(o){t.uniform1ui(e,o)}},arraySetter:function(t,e){return function(o){t.uniform1uiv(e,o)}}},ye[36294]={Type:Uint32Array,size:8,setter:function(t,e){return function(o){t.uniform2uiv(e,o)}}},ye[36295]={Type:Uint32Array,size:12,setter:function(t,e){return function(o){t.uniform3uiv(e,o)}}},ye[36296]={Type:Uint32Array,size:16,setter:function(t,e){return function(o){t.uniform4uiv(e,o)}}},ye[35670]={Type:Uint32Array,size:4,setter:ge,arraySetter:ve},ye[35671]={Type:Uint32Array,size:8,setter:Le},ye[35672]={Type:Uint32Array,size:12,setter:be},ye[35673]={Type:Uint32Array,size:16,setter:Pe},ye[35674]={Type:Float32Array,size:16,setter:function(t,e){return function(o){t.uniformMatrix2fv(e,!1,o)}}},ye[35675]={Type:Float32Array,size:36,setter:function(t,e){return function(o){t.uniformMatrix3fv(e,!1,o)}}},ye[35676]={Type:Float32Array,size:64,setter:function(t,e){return function(o){t.uniformMatrix4fv(e,!1,o)}}},ye[35685]={Type:Float32Array,size:24,setter:function(t,e){return function(o){t.uniformMatrix2x3fv(e,!1,o)}}},ye[35686]={Type:Float32Array,size:32,setter:function(t,e){return function(o){t.uniformMatrix2x4fv(e,!1,o)}}},ye[35687]={Type:Float32Array,size:24,setter:function(t,e){return function(o){t.uniformMatrix3x2fv(e,!1,o)}}},ye[35688]={Type:Float32Array,size:48,setter:function(t,e){return function(o){t.uniformMatrix3x4fv(e,!1,o)}}},ye[35689]={Type:Float32Array,size:32,setter:function(t,e){return function(o){t.uniformMatrix4x2fv(e,!1,o)}}},ye[35690]={Type:Float32Array,size:48,setter:function(t,e){return function(o){t.uniformMatrix4x3fv(e,!1,o)}}},ye[35678]={Type:null,size:0,setter:Ae,arraySetter:Ce,bindPoint:he},ye[35680]={Type:null,size:0,setter:Ae,arraySetter:Ce,bindPoint:pe},ye[35679]={Type:null,size:0,setter:Ae,arraySetter:Ce,bindPoint:me},ye[35682]={Type:null,size:0,setter:Ae,arraySetter:Ce,bindPoint:he},ye[36289]={Type:null,size:0,setter:Ae,arraySetter:Ce,bindPoint:_e},ye[36292]={Type:null,size:0,setter:Ae,arraySetter:Ce,bindPoint:_e},ye[36293]={Type:null,size:0,setter:Ae,arraySetter:Ce,bindPoint:pe},ye[36298]={Type:null,size:0,setter:Ae,arraySetter:Ce,bindPoint:he},ye[36299]={Type:null,size:0,setter:Ae,arraySetter:Ce,bindPoint:me},ye[36300]={Type:null,size:0,setter:Ae,arraySetter:Ce,bindPoint:pe},ye[36303]={Type:null,size:0,setter:Ae,arraySetter:Ce,bindPoint:_e},ye[36306]={Type:null,size:0,setter:Ae,arraySetter:Ce,bindPoint:he},ye[36307]={Type:null,size:0,setter:Ae,arraySetter:Ce,bindPoint:me},ye[36308]={Type:null,size:0,setter:Ae,arraySetter:Ce,bindPoint:pe},ye[36311]={Type:null,size:0,setter:Ae,arraySetter:Ce,bindPoint:_e};const Se={};Se[5126]={size:4,setter:we},Se[35664]={size:8,setter:we},Se[35665]={size:12,setter:we},Se[35666]={size:16,setter:we},Se[5124]={size:4,setter:Fe},Se[35667]={size:8,setter:Fe},Se[35668]={size:12,setter:Fe},Se[35669]={size:16,setter:Fe},Se[5125]={size:4,setter:Ee},Se[36294]={size:8,setter:Ee},Se[36295]={size:12,setter:Ee},Se[36296]={size:16,setter:Ee},Se[35670]={size:4,setter:Fe},Se[35671]={size:8,setter:Fe},Se[35672]={size:12,setter:Fe},Se[35673]={size:16,setter:Fe},Se[35674]={size:4,setter:Ie,count:2},Se[35675]={size:9,setter:Ie,count:3},Se[35676]={size:16,setter:Ie,count:4};const ze=/ERROR:\s*\d+:(\d+)/gi;function Te(t,e="",o=0){const r=[...e.matchAll(ze)],n=new Map(r.map(((t,o)=>{const n=parseInt(t[1]),i=r[o+1],a=i?i.index:e.length;return[n-1,e.substring(t.index,a)]})));return t.split("\n").map(((t,e)=>{const r=n.get(e);return`${e+1+o}: ${t}${r?`\n\n^^^ ${r}`:""}`})).join("\n")}const De=/^[ \t]*\n/;function Me(t,e,o,r){const n=r||ae,i=t.createShader(o);let a=0;De.test(e)&&(a=1,e=e.replace(De,"")),t.shaderSource(i,e),t.compileShader(i);if(!t.getShaderParameter(i,35713)){const r=t.getShaderInfoLog(i);return n(`${Te(e,r,a)}\nError compiling ${ot(t,o)}: ${r}`),t.deleteShader(i),null}return i}function Re(t,e,o){let r,n;if("function"==typeof e&&(o=e,e=void 0),"function"==typeof t)o=t,t=void 0;else if(t&&!Array.isArray(t)){if(t.errorCallback)return t;const e=t;o=e.errorCallback,t=e.attribLocations,r=e.transformFeedbackVaryings,n=e.transformFeedbackMode}const i={errorCallback:o||ae,transformFeedbackVaryings:r,transformFeedbackMode:n};if(t){let o={};Array.isArray(t)?t.forEach((function(t,r){o[t]=e?e[r]:r})):o=t,i.attribLocations=o}return i}const je=["VERTEX_SHADER","FRAGMENT_SHADER"];function $e(t,e){e.forEach((function(e){t.deleteShader(e)}))}function Be(t,e,o,r,n){const i=Re(o,r,n),a=[];for(let o=0;o<e.length;++o){const r=Me(t,e[o],t[je[o]],i.errorCallback);if(!r)return null;a.push(r)}return function(t,e,o,r,n){const i=Re(o,r,n),a=[],l=[];for(let o=0;o<e.length;++o){let r=e[o];if("string"==typeof r){const e=le(r),n=e?e.text:r;let a=t[je[o]];e&&e.type&&(a=((s=e.type).indexOf("frag")>=0?35632:s.indexOf("vert")>=0?35633:void 0)||a),r=Me(t,n,a,i.errorCallback),l.push(r)}"undefined"!=typeof WebGLShader&&r instanceof WebGLShader&&a.push(r)}var s;if(a.length!==e.length)return i.errorCallback("not enough shaders for program"),$e(t,l),null;const c=t.createProgram();a.forEach((function(e){t.attachShader(c,e)})),i.attribLocations&&Object.keys(i.attribLocations).forEach((function(e){t.bindAttribLocation(c,i.attribLocations[e],e)}));let u=i.transformFeedbackVaryings;if(u&&(u.attribs&&(u=u.attribs),Array.isArray(u)||(u=Object.keys(u)),t.transformFeedbackVaryings(c,u,i.transformFeedbackMode||35981)),t.linkProgram(c),!t.getProgramParameter(c,35714)){const e=t.getProgramInfoLog(c);return i.errorCallback(`${a.map((e=>{const o=Te(t.getShaderSource(e),"",0),r=t.getShaderParameter(e,t.SHADER_TYPE);return`${ot(t,r)}\n${o}}`})).join("\n")}\nError in program linking: ${e}`),t.deleteProgram(c),$e(t,l),null}return c}(t,a,i)}function Oe(t){const e=t.name;return e.startsWith("gl_")||e.startsWith("webgl_")}const ke=function t(e,o){const r=e.uniformSetters||e,n=arguments.length;for(let e=1;e<n;++e){const o=arguments[e];if(Array.isArray(o)){const e=o.length;for(let n=0;n<e;++n)t(r,o[n])}else for(const t in o){const e=r[t];e&&e(o[t])}}};function Ne(t,e){const o={program:e,uniformSetters:function(t,e){let o=0;function r(e,r,n){const i=r.name.endsWith("[0]"),a=r.type,l=ye[a];if(!l)throw new Error(`unknown type: 0x${a.toString(16)}`);let s;if(l.bindPoint){const e=o;o+=r.size,s=i?l.arraySetter(t,a,e,n,r.size):l.setter(t,a,e,n,r.size)}else s=l.arraySetter&&i?l.arraySetter(t,n):l.setter(t,n);return s.location=n,s}const n={},i=t.getProgramParameter(e,35718);for(let o=0;o<i;++o){const i=t.getActiveUniform(e,o);if(Oe(i))continue;let a=i.name;a.endsWith("[0]")&&(a=a.substr(0,a.length-3));const l=t.getUniformLocation(e,i.name);l&&(n[a]=r(0,i,l))}return n}(t,e),attribSetters:function(t,e){const o={},r=t.getProgramParameter(e,35721);for(let n=0;n<r;++n){const r=t.getActiveAttrib(e,n);if(Oe(r))continue;const i=t.getAttribLocation(e,r.name),a=Se[r.type],l=a.setter(t,i,a);l.location=i,o[r.name]=l}return o}(t,e)};return et(t)&&(o.uniformBlockSpec=function(t,e){const o=t.getProgramParameter(e,35718),r=[],n=[];for(let i=0;i<o;++i){n.push(i),r.push({});const o=t.getActiveUniform(e,i);if(Oe(o))break;r[i].name=o.name}[["UNIFORM_TYPE","type"],["UNIFORM_SIZE","size"],["UNIFORM_BLOCK_INDEX","blockNdx"],["UNIFORM_OFFSET","offset"]].forEach((function(o){const i=o[0],a=o[1];t.getActiveUniforms(e,n,t[i]).forEach((function(t,e){r[e][a]=t}))}));const i={},a=t.getProgramParameter(e,35382);for(let o=0;o<a;++o){const r=t.getActiveUniformBlockName(e,o),n={index:t.getUniformBlockIndex(e,r),usedByVertexShader:t.getActiveUniformBlockParameter(e,o,35396),usedByFragmentShader:t.getActiveUniformBlockParameter(e,o,35398),size:t.getActiveUniformBlockParameter(e,o,35392),uniformIndices:t.getActiveUniformBlockParameter(e,o,35395)};n.used=n.usedByVertexShader||n.usedByFragmentShader,i[r]=n}return{blockSpecs:i,uniformData:r}}(t,e),o.transformFeedbackInfo=function(t,e){const o={},r=t.getProgramParameter(e,35971);for(let n=0;n<r;++n){const r=t.getTransformFeedbackVarying(e,n);o[r.name]={index:n,type:r.type,size:r.size}}return o}(t,e)),o}function Ue(t,e,o,r,n){const i=Re(o,r,n);let a=!0;if(e=e.map((function(t){if(t.indexOf("\n")<0){const e=le(t);e?t=e.text:(i.errorCallback("no element with id: "+t),a=!1)}return t})),!a)return null;const l=Be(t,e,i);return l?Ne(t,l):null}const He=36161,Ge=34041,We=36096,Ve=33306,qe=33071,Xe=9729,Ye=[{format:6408,type:5121,min:Xe,wrap:qe},{format:Ge}],Ze={};Ze[34041]=Ve,Ze[6401]=36128,Ze[36168]=36128,Ze[6402]=We,Ze[33189]=We,Ze[33190]=We,Ze[36012]=We,Ze[35056]=Ve,Ze[36013]=Ve;const Ke={};function Qe(t,e,o,r){const n=36160,i=t.createFramebuffer();t.bindFramebuffer(n,i),o=o||t.drawingBufferWidth,r=r||t.drawingBufferHeight;let a=0;const l={framebuffer:i,attachments:[],width:o,height:r};return(e=e||Ye).forEach((function(e){let i=e.attachment;const s=e.format;let c=e.attachmentPoint||function(t,e){return Ze[t]||Ze[e]}(s,e.internalFormat);if(c||(c=36064+a++),!i)if(function(t){return Ke[t]}(s))i=t.createRenderbuffer(),t.bindRenderbuffer(He,i),t.renderbufferStorage(He,s,o,r);else{const n=Object.assign({},e);n.width=o,n.height=r,void 0===n.auto&&(n.auto=!1,n.min=n.min||n.minMag||Xe,n.mag=n.mag||n.minMag||Xe,n.wrapS=n.wrapS||n.wrap||qe,n.wrapT=n.wrapT||n.wrap||qe),i=ie(t,n)}if(U(0,i))t.framebufferRenderbuffer(n,c,He,i);else{if(!H(0,i))throw new Error("unknown attachment type");void 0!==e.layer?t.framebufferTextureLayer(n,c,i,e.level||0,e.layer):t.framebufferTexture2D(n,c,e.target||3553,i,e.level||0)}l.attachments.push(i)})),l}function Je(t,e,o,r,n){r=r||t.drawingBufferWidth,n=n||t.drawingBufferHeight,e.width=r,e.height=n,(o=o||Ye).forEach((function(o,i){const a=e.attachments[i],l=o.format;if(U(0,a))t.bindRenderbuffer(He,a),t.renderbufferStorage(He,l,r,n);else{if(!H(0,a))throw new Error("unknown attachment type");!function(t,e,o,r,n,i){r=r||o.width,n=n||o.height,i=i||o.depth;const a=o.target||ut;t.bindTexture(a,e);const l=o.level||0,s=o.internalFormat||o.format||lt,c=Bt(s),u=o.format||c.format;let f;const d=o.src;if(f=d&&(nt(d)||Array.isArray(d)&&"number"==typeof d[0])?o.type||kt(0,d,c.type):o.type||c.type,a===ft)for(let e=0;e<6;++e)t.texImage2D(pt+e,l,s,r,n,0,u,f,null);else a===dt||a===ht?t.texImage3D(a,l,s,r,n,i,0,u,f,null):t.texImage2D(a,l,s,r,n,0,u,f,null)}(t,a,o,r,n)}}))}function to(t,e,o){o=o||36160,e?(t.bindFramebuffer(o,e.framebuffer),t.viewport(0,0,e.width,e.height)):(t.bindFramebuffer(o,null),t.viewport(0,0,t.drawingBufferWidth,t.drawingBufferHeight))}function eo(t){return t}function oo(t,e){var o=function(t){if(null==t)return eo;var e,o,r=t.scale[0],n=t.scale[1],i=t.translate[0],a=t.translate[1];return function(t,l){l||(e=o=0);var s=2,c=t.length,u=new Array(c);for(u[0]=(e+=t[0])*r+i,u[1]=(o+=t[1])*n+a;s<c;)u[s]=t[s],++s;return u}}(t.transform),r=t.arcs;function n(t,e){e.length&&e.pop();for(var n=r[t<0?~t:t],i=0,a=n.length;i<a;++i)e.push(o(n[i],i));t<0&&function(t,e){for(var o,r=t.length,n=r-e;n<--r;)o=t[n],t[n++]=t[r],t[r]=o}(e,a)}function i(t){return o(t)}function a(t){for(var e=[],o=0,r=t.length;o<r;++o)n(t[o],e);return e.length<2&&e.push(e[0]),e}function l(t){for(var e=a(t);e.length<4;)e.push(e[0]);return e}function s(t){return t.map(l)}return function t(e){var o,r=e.type;switch(r){case"GeometryCollection":return{type:r,geometries:e.geometries.map(t)};case"Point":o=i(e.coordinates);break;case"MultiPoint":o=e.coordinates.map(i);break;case"LineString":o=a(e.arcs);break;case"MultiLineString":o=e.arcs.map(a);break;case"Polygon":o=s(e.arcs);break;case"MultiPolygon":o=e.arcs.map(s);break;default:return null}return{type:r,coordinates:o}}(e)}function ro(t,e){var o={},r={},n={},i=[],a=-1;function l(t,e){for(var r in t){var n=t[r];delete e[n.start],delete n.start,delete n.end,n.forEach((function(t){o[t<0?~t:t]=1})),i.push(n)}}return e.forEach((function(o,r){var n,i=t.arcs[o<0?~o:o];i.length<3&&!i[1][0]&&!i[1][1]&&(n=e[++a],e[a]=o,e[r]=n)})),e.forEach((function(e){var o,i,a=function(e){var o,r=t.arcs[e<0?~e:e],n=r[0];t.transform?(o=[0,0],r.forEach((function(t){o[0]+=t[0],o[1]+=t[1]}))):o=r[r.length-1];return e<0?[o,n]:[n,o]}(e),l=a[0],s=a[1];if(o=n[l])if(delete n[o.end],o.push(e),o.end=s,i=r[s]){delete r[i.start];var c=i===o?o:o.concat(i);r[c.start=o.start]=n[c.end=i.end]=c}else r[o.start]=n[o.end]=o;else if(o=r[s])if(delete r[o.start],o.unshift(e),o.start=l,i=n[l]){delete n[i.end];var u=i===o?o:i.concat(o);r[u.start=i.start]=n[u.end=o.end]=u}else r[o.start]=n[o.end]=o;else r[(o=[e]).start=l]=n[o.end=s]=o})),l(n,r),l(r,n),e.forEach((function(t){o[t<0?~t:t]||i.push([t])})),i}function no(t){return oo(t,io.apply(this,arguments))}function io(t,e,o){var r,n,i;if(arguments.length>1)r=ao(t,e,o);else for(n=0,r=new Array(i=t.arcs.length);n<i;++n)r[n]=n;return{type:"MultiLineString",arcs:ro(t,r)}}function ao(t,e,o){var r,n=[],i=[];function a(t){var e=t<0?~t:t;(i[e]||(i[e]=[])).push({i:t,g:r})}function l(t){t.forEach(a)}function s(t){t.forEach(l)}return function t(e){switch(r=e,e.type){case"GeometryCollection":e.geometries.forEach(t);break;case"LineString":l(e.arcs);break;case"MultiLineString":case"Polygon":s(e.arcs);break;case"MultiPolygon":!function(t){t.forEach(s)}(e.arcs)}}(e),i.forEach(null==o?function(t){n.push(t[0].i)}:function(t){o(t[0].g,t[t.length-1].g)&&n.push(t[0].i)}),n}Ke[32854]=!0,Ke[32855]=!0,Ke[36194]=!0,Ke[34041]=!0,Ke[33189]=!0,Ke[6401]=!0,Ke[36168]=!0;var lo="#define GLSLIFY 1\nattribute vec2 a_position;varying vec2 v_position;void main(){v_position=a_position;gl_Position=vec4(a_position,0,1);}",so="precision mediump float;\n#define GLSLIFY 1\nuniform sampler2D u_data;uniform sampler2D u_colormap;uniform float u_colormapN;uniform vec2 u_domain;uniform vec4 u_baseColor;varying vec2 v_position;void main(){float value=texture2D(u_data,(v_position+1.0)/2.0).a;if(value<-1e99){gl_FragColor=u_baseColor;return;}float t=clamp((value-u_domain.x)/(u_domain.y-u_domain.x),0.0,1.0);float tOffset=(u_colormapN-1.0)/u_colormapN*(t-0.5)+0.5;gl_FragColor=texture2D(u_colormap,vec2(tOffset,0));}";const co={a_position:{numComponents:2,data:[-1,-1,-1,1,1,-1,1,1,1,-1,-1,1]}};function uo(t,e,o,r,n){t.useProgram(e.program),function(t,e,o){o.vertexArrayObject?t.bindVertexArray(o.vertexArrayObject):(function(t,e){for(const o in e){const r=t[o];r&&r(e[o])}}(e.attribSetters||e,o.attribs),o.indices&&t.bindBuffer(34963,o.indices))}(t,e,o),ke(e,r),function(t,e,o,r,n,i){o=void 0===o?4:o;const a=e.indices,l=e.elementType,s=void 0===r?e.numElements:r;n=void 0===n?0:n,l||a?void 0!==i?t.drawElementsInstanced(o,s,void 0===l?5123:e.elementType,n,i):t.drawElements(o,s,void 0===l?5123:e.elementType,n):void 0!==i?t.drawArraysInstanced(o,n,s,i):t.drawArrays(o,n,s)}(t,o,n)}class fo{constructor(t,e){this._data=e.data,this._colormap=e.colormap,this._domain=e.domain,this._baseColor=e.baseColor,this._gl=t,this._webgl2=e.webgl2,this._gl.enable(t.BLEND),this._gl.blendFunc(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA),this._ext=this._gl.getExtension("OES_texture_half_float"),this._gl.getExtension("OES_texture_float"),this._programs=this._createPrograms(),this._buffers=this._createBuffers(e.vectorData),this._textures=this._createTextures(),this._framebuffers=this._createFramebuffers(),this._mapDataToColors(),this._dataNeedsRecolor=!1}set data(t){let e=this._data.width,o=this._data.width;this._data=t,e===this._data.width&&o===this._data.height||(this._textures.gridded=this._createGriddedTexture()),this._textures.data=this._createDataTexture(),this._framebuffers=this._createFramebuffers(),this._dataNeedsRecolor=!0}set colormap(t){this._colormap=t,this._textures.colormap=this._createColormapTexture(),this._dataNeedsRecolor=!0}set domain(t){this._domain=t,this._dataNeedsRecolor=!0}set baseColor(t){this._baseColor=t,this._dataNeedsRecolor=!0}set vectorData(t){this._buffers.vectors=this._createVectorBuffers(t)}drawGriddedData(t){this._dataNeedsRecolor&&(this._mapDataToColors(),this._dataNeedsRecolor=!1),uo(this._gl,this._programs.gridded,this._buffers.gridded,{u_texture:this._textures.gridded,u_gridWidth:this._data.width,u_gridHeight:this._data.height,...t})}drawVectorData(t,e){for(const[o,r]of Object.entries(e)){let e=this._buffers.vectors[o];void 0!==e&&uo(this._gl,this._programs.vector,e,{u_color:r.map(((t,e)=>3===e?t:t/255)),...t},this._gl.LINES)}}_createPrograms(){let t=this._webgl2?so.replace(/\)\.a;/g,").r;"):so;return{gridded:Ue(this._gl,[lo,"precision highp float;\n#define GLSLIFY 1\nconst float PI_3=radians(180.0);const float PI_2_1540259130=radians(90.0);void rotate_2(in vec2 lonLat0,inout vec2 lonLat){if(lonLat.x<-PI_3||lonLat.x>PI_3||lonLat.y<-PI_2_1540259130||lonLat.y>PI_2_1540259130){return;}vec3 xyzCoord=vec3(cos(lonLat.x)*cos(lonLat.y),sin(lonLat.x)*cos(lonLat.y),sin(lonLat.y));mat3 rotateLatitude=mat3(cos(-lonLat0.y),0,-sin(-lonLat0.y),0,1,0,sin(-lonLat0.y),0,cos(-lonLat0.y));xyzCoord=rotateLatitude*xyzCoord;lonLat=vec2(atan(xyzCoord.y,xyzCoord.x),asin(xyzCoord.z));lonLat.x+=lonLat0.x;lonLat.x=mod(lonLat.x+PI_3,2.0*PI_3)-PI_3;}void equirectangular(in vec2 coord,in vec2 lonLat0,out vec2 lonLat){lonLat.x=coord.x;lonLat.y=coord.y;rotate_2(lonLat0,lonLat);}const float PI_4=radians(180.0);const float PI_2_1604150559=radians(90.0);void rotate_3(in vec2 lonLat0,inout vec2 lonLat){if(lonLat.x<-PI_4||lonLat.x>PI_4||lonLat.y<-PI_2_1604150559||lonLat.y>PI_2_1604150559){return;}vec3 xyzCoord=vec3(cos(lonLat.x)*cos(lonLat.y),sin(lonLat.x)*cos(lonLat.y),sin(lonLat.y));mat3 rotateLatitude=mat3(cos(-lonLat0.y),0,-sin(-lonLat0.y),0,1,0,sin(-lonLat0.y),0,cos(-lonLat0.y));xyzCoord=rotateLatitude*xyzCoord;lonLat=vec2(atan(xyzCoord.y,xyzCoord.x),asin(xyzCoord.z));lonLat.x+=lonLat0.x;lonLat.x=mod(lonLat.x+PI_4,2.0*PI_4)-PI_4;}void mercator(in vec2 coord,in vec2 lonLat0,out vec2 lonLat){lonLat.x=coord.x;lonLat.y=2.0*atan(exp(coord.y))-radians(90.0);rotate_3(lonLat0,lonLat);}const float PI_1117569599=radians(180.0);const float PI_2_1117569599=radians(90.0);void rotate_1(in vec2 lonLat0,inout vec2 lonLat){if(lonLat.x<-PI_1117569599||lonLat.x>PI_1117569599||lonLat.y<-PI_2_1117569599||lonLat.y>PI_2_1117569599){return;}vec3 xyzCoord=vec3(cos(lonLat.x)*cos(lonLat.y),sin(lonLat.x)*cos(lonLat.y),sin(lonLat.y));mat3 rotateLatitude=mat3(cos(-lonLat0.y),0,-sin(-lonLat0.y),0,1,0,sin(-lonLat0.y),0,cos(-lonLat0.y));xyzCoord=rotateLatitude*xyzCoord;lonLat=vec2(atan(xyzCoord.y,xyzCoord.x),asin(xyzCoord.z));lonLat.x+=lonLat0.x;lonLat.x=mod(lonLat.x+PI_1117569599,2.0*PI_1117569599)-PI_1117569599;}const float A1=1.340264;const float A2=-0.081106;const float A3=0.000893;const float A4=0.003796;const float M=sqrt(3.0)/2.0;const int iterations=12;void equalEarth(in vec2 coord,in vec2 lonLat0,out vec2 lonLat){float l=coord.y;float l2=l*l;float l6=l2*l2*l2;float delta,fy,fpy;for(int i=0;i<iterations;i++){fy=l*(A1+A2*l2+l6*(A3+A4*l2))-coord.y;fpy=A1+3.0*A2*l2+l6*(7.0*A3+9.0*A4*l2);delta=fy/fpy;l-=delta;l2=l*l;l6=l2*l2*l2;}lonLat.x=M*coord.x*(A1+3.0*A2*l2+l6*(7.0*A3+9.0*A4*l2))/cos(l);float sinY=sin(l)/M;if(sinY<-1.0||sinY>1.0){lonLat.y=100.0;}else{lonLat.y=asin(sinY);}rotate_1(lonLat0,lonLat);}const float PI_5=radians(180.0);void orthographic(in vec2 coord,in vec2 lonLat0,out vec2 lonLat){float rho=sqrt(pow(coord.x,2.0)+pow(coord.y,2.0));if(rho==0.0){lonLat=lonLat0;return;}if(rho>1.0){lonLat=vec2(100,100);return;}float c=asin(rho);float lon0=lonLat0.x;float lat0=lonLat0.y;float x=coord.x*sin(c);float y=rho*cos(c)*cos(lat0)-coord.y*sin(c)*sin(lat0);lonLat.x=lon0+atan(x,y);lonLat.y=asin(cos(c)*sin(lat0)+coord.y*sin(c)*cos(lat0)/rho);lonLat.x=mod(lonLat.x+PI_5,2.0*PI_5)-PI_5;}const float PI_0=radians(180.0);const float FOV_SCALAR_529295689=7.0;void verticalPerspective(in vec2 coord,in vec2 lonLat0,out vec2 lonLat,in float zoom){float rho2=pow(coord.x,2.0)+pow(coord.y,2.0);float rho=sqrt(rho2);if(rho==0.0){lonLat=lonLat0;return;}float P=1.0+(FOV_SCALAR_529295689/zoom);float squaredVal=1.0-rho2*(P+1.0)/(P-1.0);float sinc=(P-sqrt(squaredVal))/((P-1.0)/rho+rho/(P-1.0));if(sinc>1.0||squaredVal<0.0){lonLat=vec2(100,100);return;}float c=asin(sinc);float lon0=lonLat0.x;float lat0=lonLat0.y;float x=coord.x*sin(c);float y=rho*cos(c)*cos(lat0)-coord.y*sin(c)*sin(lat0);lonLat.x=lon0+atan(x,y);lonLat.y=asin(cos(c)*sin(lat0)+coord.y*sin(c)*cos(lat0)/rho);lonLat.x=mod(lonLat.x+PI_0,2.0*PI_0)-PI_0;}const float PI_1=radians(180.0);const float PI_2_1062606552=radians(90.0);void rotate_0(in vec2 lonLat0,inout vec2 lonLat){if(lonLat.x<-PI_1||lonLat.x>PI_1||lonLat.y<-PI_2_1062606552||lonLat.y>PI_2_1062606552){return;}vec3 xyzCoord=vec3(cos(lonLat.x)*cos(lonLat.y),sin(lonLat.x)*cos(lonLat.y),sin(lonLat.y));mat3 rotateLatitude=mat3(cos(-lonLat0.y),0,-sin(-lonLat0.y),0,1,0,sin(-lonLat0.y),0,cos(-lonLat0.y));xyzCoord=rotateLatitude*xyzCoord;lonLat=vec2(atan(xyzCoord.y,xyzCoord.x),asin(xyzCoord.z));lonLat.x+=lonLat0.x;lonLat.x=mod(lonLat.x+PI_1,2.0*PI_1)-PI_1;}void sterographic(in vec2 coord,in vec2 lonLat0,out vec2 lonLat){float z=sqrt(pow(coord.x,2.0)+pow(coord.y,2.0));float c=2.0*atan(z);float sc=sin(c);float cc=cos(c);lonLat.x=atan(coord.x*sc,z*cc);if(z==0.0){lonLat.y=0.0;}else{lonLat.y=asin(coord.y*sc/z);}rotate_0(lonLat0,lonLat);}void invertProject(in vec2 displayCoord,in vec2 lonLat0,out vec2 lonLat,in float zoom,in int projection){if(projection==0){equirectangular(displayCoord,lonLat0,lonLat);}else if(projection==1){mercator(displayCoord,lonLat0,lonLat);}else if(projection==2){equalEarth(displayCoord,lonLat0,lonLat);}else if(projection==3){orthographic(displayCoord,lonLat0,lonLat);}else if(projection==4){verticalPerspective(displayCoord,lonLat0,lonLat,zoom);}else if(projection==5){sterographic(displayCoord,lonLat0,lonLat);}}const float PI_6=radians(180.0);const float PI_2_2315452051=radians(90.0);void projectToTexture(out vec2 textureCoord,in vec2 lonLat,in float gridWidth,in float gridHeight,in int projection){if(projection==0){textureCoord=(lonLat+vec2(0,PI_2_2315452051))/vec2(2.0*PI_6,PI_6);float xOffset=0.5/gridWidth;float yScale=(gridHeight-1.0)/gridHeight;textureCoord.x=mod(textureCoord.x+xOffset,1.0);textureCoord.y=yScale*(textureCoord.y-0.5)+0.5;}else if(projection==1){textureCoord=(lonLat+vec2(0,PI_2_2315452051))/vec2(2.0*PI_6,PI_6);textureCoord.x=mod(textureCoord.x,1.0);}else if(projection==3){textureCoord=(lonLat+vec2(PI_6,PI_2_2315452051))/vec2(2.0*PI_6,PI_6);float xOffset=0.5/gridWidth;float yScale=(gridHeight-1.0)/gridHeight;textureCoord.x=mod(textureCoord.x+xOffset,1.0);textureCoord.y=yScale*(textureCoord.y-0.5)+0.5;}else if(projection==2){textureCoord=(lonLat+vec2(radians(-20.0),PI_2_2315452051))/vec2(2.0*PI_6,PI_6);float xOffset=0.5/gridWidth;float xScale=1080.0/gridWidth;float yScale=(90.0/80.0)*(gridHeight-1.0)/gridHeight;textureCoord.x=mod(xScale*(textureCoord.x+xOffset),xScale);textureCoord.y=1.0-(yScale*(textureCoord.y-0.5)+0.5);if(textureCoord.y>1.0||textureCoord.y<0.0){textureCoord=vec2(0.0,0.5);}}}uniform float u_canvasRatio;uniform float u_lon0;uniform float u_lat0;uniform float u_zoom;uniform int u_projection;uniform int u_griddedDataProjection;uniform bool u_offsetGridded;uniform sampler2D u_texture;uniform float u_gridWidth;uniform float u_gridHeight;varying vec2 v_position;const float PI=radians(180.0);const float PI_2=radians(90.0);void main(){vec2 displayCoord=vec2(u_canvasRatio*PI_2,PI_2)*v_position;displayCoord=displayCoord/u_zoom;vec2 lonLat;vec2 lonLat0=radians(vec2(u_lon0,u_lat0));invertProject(displayCoord,lonLat0,lonLat,u_zoom,u_projection);if(lonLat.x>PI||lonLat.x<-PI||lonLat.y>PI_2||lonLat.y<-PI_2){gl_FragColor=vec4(0,0,0,0);return;}vec2 textureCoord;projectToTexture(textureCoord,lonLat,u_gridWidth,u_gridHeight,u_griddedDataProjection);gl_FragColor=texture2D(u_texture,textureCoord);}"]),vector:Ue(this._gl,["#define GLSLIFY 1\nconst float PI_1540259130=radians(180.0);void rotate_2(in vec2 lonLat0,inout vec2 lonLat,out bool clip){vec3 xyzCoord=vec3(cos(lonLat.x)*cos(lonLat.y),sin(lonLat.x)*cos(lonLat.y),sin(lonLat.y));mat3 rotateLongitude=mat3(cos(lonLat0.x),-sin(lonLat0.x),0,sin(lonLat0.x),cos(lonLat0.x),0,0,0,1);mat3 rotateLatitude=mat3(cos(lonLat0.y),0,-sin(lonLat0.y),0,1,0,sin(lonLat0.y),0,cos(lonLat0.y));xyzCoord=rotateLatitude*rotateLongitude*xyzCoord;lonLat=vec2(atan(xyzCoord.y,xyzCoord.x),asin(xyzCoord.z));float distanceFromMeridian=abs(lonLat.x);clip=distanceFromMeridian>PI_1540259130-radians(1.0);}void equirectangular(out vec2 coord,in vec2 lonLat0,in vec2 lonLat,out bool clip){rotate_2(lonLat0,lonLat,clip);coord.x=lonLat.x;coord.y=lonLat.y;}const float PI_3=radians(180.0);void rotate_3(in vec2 lonLat0,inout vec2 lonLat,out bool clip){vec3 xyzCoord=vec3(cos(lonLat.x)*cos(lonLat.y),sin(lonLat.x)*cos(lonLat.y),sin(lonLat.y));mat3 rotateLongitude=mat3(cos(lonLat0.x),-sin(lonLat0.x),0,sin(lonLat0.x),cos(lonLat0.x),0,0,0,1);mat3 rotateLatitude=mat3(cos(lonLat0.y),0,-sin(lonLat0.y),0,1,0,sin(lonLat0.y),0,cos(lonLat0.y));xyzCoord=rotateLatitude*rotateLongitude*xyzCoord;lonLat=vec2(atan(xyzCoord.y,xyzCoord.x),asin(xyzCoord.z));float distanceFromMeridian=abs(lonLat.x);clip=distanceFromMeridian>PI_3-radians(1.0);}const float PI_2_1535977339=radians(90.0);void mercator(out vec2 coord,in vec2 lonLat0,in vec2 lonLat,out bool clip){rotate_3(lonLat0,lonLat,clip);coord.x=lonLat.x;coord.y=log(tan((PI_2_1535977339+lonLat.y)/2.0));}const float PI_1=radians(180.0);void rotate_1(in vec2 lonLat0,inout vec2 lonLat,out bool clip){vec3 xyzCoord=vec3(cos(lonLat.x)*cos(lonLat.y),sin(lonLat.x)*cos(lonLat.y),sin(lonLat.y));mat3 rotateLongitude=mat3(cos(lonLat0.x),-sin(lonLat0.x),0,sin(lonLat0.x),cos(lonLat0.x),0,0,0,1);mat3 rotateLatitude=mat3(cos(lonLat0.y),0,-sin(lonLat0.y),0,1,0,sin(lonLat0.y),0,cos(lonLat0.y));xyzCoord=rotateLatitude*rotateLongitude*xyzCoord;lonLat=vec2(atan(xyzCoord.y,xyzCoord.x),asin(xyzCoord.z));float distanceFromMeridian=abs(lonLat.x);clip=distanceFromMeridian>PI_1-radians(1.0);}const float A1=1.340264;const float A2=-0.081106;const float A3=0.000893;const float A4=0.003796;const float M=sqrt(3.0)/2.0;void equalEarth(out vec2 coord,in vec2 lonLat0,in vec2 lonLat,out bool clip){rotate_1(lonLat0,lonLat,clip);float l=asin(M*sin(lonLat.y));float l2=l*l;float l6=l2*l2*l2;coord.x=(lonLat.x)*cos(l)/(M*(A1+3.0*A2*l2+l6*(7.0*A3+9.0*A4*l2)));coord.y=l*(A1+A2*l2+l6*(A3+A4*l2));}void orthographic(out vec2 coord,in vec2 lonLat0,in vec2 lonLat,out bool clip){float c=sin(lonLat0.y)*sin(lonLat.y)+cos(lonLat0.y)*cos(lonLat.y)*cos(lonLat.x-lonLat0.x);clip=c<0.0;coord.x=cos(lonLat.y)*sin(lonLat.x-lonLat0.x);coord.y=cos(lonLat0.y)*sin(lonLat.y)-sin(lonLat0.y)*cos(lonLat.y)*cos(lonLat.x-lonLat0.x);}const float FOV_SCALAR_529295689=7.0;void verticalPerspective(out vec2 coord,in vec2 lonLat0,in vec2 lonLat,out bool clip,in float zoom){float c=sin(lonLat0.y)*sin(lonLat.y)+cos(lonLat0.y)*cos(lonLat.y)*cos(lonLat.x-lonLat0.x);float P=1.0+(FOV_SCALAR_529295689/zoom);float k=(P-1.0)/(P-c);clip=c<1.0/P;coord.x=k*cos(lonLat.y)*sin(lonLat.x-lonLat0.x);coord.y=k*(cos(lonLat0.y)*sin(lonLat.y)-sin(lonLat0.y)*cos(lonLat.y)*cos(lonLat.x-lonLat0.x));}const float PI_0=radians(180.0);void rotate_0(in vec2 lonLat0,inout vec2 lonLat,out bool clip){vec3 xyzCoord=vec3(cos(lonLat.x)*cos(lonLat.y),sin(lonLat.x)*cos(lonLat.y),sin(lonLat.y));mat3 rotateLongitude=mat3(cos(lonLat0.x),-sin(lonLat0.x),0,sin(lonLat0.x),cos(lonLat0.x),0,0,0,1);mat3 rotateLatitude=mat3(cos(lonLat0.y),0,-sin(lonLat0.y),0,1,0,sin(lonLat0.y),0,cos(lonLat0.y));xyzCoord=rotateLatitude*rotateLongitude*xyzCoord;lonLat=vec2(atan(xyzCoord.y,xyzCoord.x),asin(xyzCoord.z));float distanceFromMeridian=abs(lonLat.x);clip=distanceFromMeridian>PI_0-radians(1.0);}void stereographic(out vec2 coord,in vec2 lonLat0,in vec2 lonLat,out bool clip){rotate_0(lonLat0,lonLat,clip);clip=false;float cy=cos(lonLat.y);float k=1.0+cos(lonLat.x)*cy;coord.x=cy*sin(lonLat.x)/k;coord.y=sin(lonLat.y)/k;}void forwardProject(out vec2 displayCoord,in vec2 lonLat0,in vec2 lonLat,out bool clip,in float zoom,in int projection){if(projection==0){equirectangular(displayCoord,lonLat0,lonLat,clip);}else if(projection==1){mercator(displayCoord,lonLat0,lonLat,clip);}else if(projection==2){equalEarth(displayCoord,lonLat0,lonLat,clip);}else if(projection==3){orthographic(displayCoord,lonLat0,lonLat,clip);}else if(projection==4){verticalPerspective(displayCoord,lonLat0,lonLat,clip,zoom);}else if(projection==5){stereographic(displayCoord,lonLat0,lonLat,clip);}}attribute vec2 a_lonLat;uniform float u_canvasRatio;uniform float u_lon0;uniform float u_lat0;uniform float u_zoom;uniform int u_projection;varying float v_clip;const float PI_2=radians(90.0);void main(){vec2 displayCoord;vec2 lonLat0=radians(vec2(u_lon0,u_lat0));vec2 lonLat=radians(a_lonLat);bool clip;forwardProject(displayCoord,lonLat0,lonLat,clip,u_zoom,u_projection);if(clip){v_clip=1.0;}else{v_clip=0.0;}displayCoord=u_zoom*displayCoord/PI_2;displayCoord.x=displayCoord.x/u_canvasRatio;gl_Position=vec4(displayCoord,0,1);}","precision mediump float;\n#define GLSLIFY 1\nuniform vec4 u_color;varying float v_clip;void main(){if(v_clip>0.0){gl_FragColor=vec4(0,0,0,0);}else{gl_FragColor=u_color;}}"]),colormap:Ue(this._gl,[lo,t])}}_createBuffers(t){let e=tt(this._gl,co);return{gridded:e,vectors:this._createVectorBuffers(t),colormap:e}}_createVectorBuffers(t){let e={};for(const[o,r]of Object.entries(t.objects))e[o]=ho(this._gl,t,r);return e}_createTextures(){return{gridded:this._createGriddedTexture(),data:this._createDataTexture(),colormap:this._createColormapTexture()}}_createGriddedTexture(){return ie(this._gl,{mag:this._gl.NEAREST,min:this._gl.LINEAR,width:this._data.width,height:this._data.height})}_createDataTexture(){let t,e,o;return"Float32Array"!==this._data.floatArray.constructor.name?(t=new Uint16Array(this._data.floatArray.buffer),e=this._webgl2?this._gl.HALF_FLOAT:this._ext.HALF_FLOAT_OES,o=this._webgl2?this._gl.R16F:this._gl.ALPHA):(t=this._data.floatArray,e=this._gl.FLOAT,o=this._webgl2?this._gl.R32F:this._gl.ALPHA),ie(this._gl,{src:t,type:e,format:this._webgl2?this._gl.RED:this._gl.ALPHA,internalFormat:o,minMag:this._gl.NEAREST,width:this._data.width,height:this._data.height})}_createColormapTexture(){return ie(this._gl,{src:this._colormap.lut.flat(),format:this._gl.RGB,minMag:this._gl.LINEAR,width:this._colormap.lut.length,height:1})}_createFramebuffers(){return{gridded:Qe(this._gl,[{attachment:this._textures.gridded}],this._data.width,this._data.height)}}_mapDataToColors(){to(this._gl,this._framebuffers.gridded),uo(this._gl,this._programs.colormap,this._buffers.colormap,{u_data:this._textures.data,u_colormap:this._textures.colormap,u_colormapN:this._colormap.lut.length,u_domain:this._domain,u_baseColor:this._baseColor.map(((t,e)=>3===e?t:t/255))}),to(this._gl,null)}}function ho(t,e,o){let r=no(e,o),n=0,i=[];for(let t=0;t<r.coordinates.length;t++){let e=n+r.coordinates[t].length-1;for(;n<e;n++)i.push(n),i.push(n+1);n=e+1}return tt(t,{a_lonLat:{numComponents:2,data:r.coordinates.flat(2)},indices:i})}var po="precision highp float;\n#define GLSLIFY 1\nconst float PI=radians(180.0);const float PI_2_1540259130=radians(90.0);void projectToTexture(out vec2 textureCoord,in vec2 lonLat,in float gridWidth,in float gridHeight,in int projection){if(projection==0){textureCoord=(lonLat+vec2(0,PI_2_1540259130))/vec2(2.0*PI,PI);float xOffset=0.5/gridWidth;float yScale=(gridHeight-1.0)/gridHeight;textureCoord.x=mod(textureCoord.x+xOffset,1.0);textureCoord.y=yScale*(textureCoord.y-0.5)+0.5;}else if(projection==1){textureCoord=(lonLat+vec2(0,PI_2_1540259130))/vec2(2.0*PI,PI);textureCoord.x=mod(textureCoord.x,1.0);}else if(projection==3){textureCoord=(lonLat+vec2(PI,PI_2_1540259130))/vec2(2.0*PI,PI);float xOffset=0.5/gridWidth;float yScale=(gridHeight-1.0)/gridHeight;textureCoord.x=mod(textureCoord.x+xOffset,1.0);textureCoord.y=yScale*(textureCoord.y-0.5)+0.5;}else if(projection==2){textureCoord=(lonLat+vec2(radians(-20.0),PI_2_1540259130))/vec2(2.0*PI,PI);float xOffset=0.5/gridWidth;float xScale=1080.0/gridWidth;float yScale=(90.0/80.0)*(gridHeight-1.0)/gridHeight;textureCoord.x=mod(xScale*(textureCoord.x+xOffset),xScale);textureCoord.y=1.0-(yScale*(textureCoord.y-0.5)+0.5);if(textureCoord.y>1.0||textureCoord.y<0.0){textureCoord=vec2(0.0,0.5);}}}uniform sampler2D u_particleData;uniform sampler2D u_vectorFieldU;uniform sampler2D u_vectorFieldV;uniform sampler2D u_random;uniform vec2 u_randLonLatOffsets;uniform float u_gridWidth;uniform float u_gridHeight;uniform int u_particleDataProjection;uniform float u_particleLifetime;uniform float u_timeDelta;uniform float u_rate;varying vec2 v_position;const vec2 DIM=vec2(360.0,180.0);const vec2 DIM_2=vec2(180.0,90.0);const float M_PER_DEG=111319.5;void main(){vec2 id=(v_position+1.0)/2.0;vec4 data=texture2D(u_particleData,id);vec2 lonLat=data.rg;float lifetime=data.b+u_timeDelta;vec2 textureCoord;projectToTexture(textureCoord,radians(lonLat),u_gridWidth,u_gridHeight,u_particleDataProjection);vec2 velocity;velocity.x=texture2D(u_vectorFieldU,textureCoord).a;velocity.y=texture2D(u_vectorFieldV,textureCoord).a;float speed=length(velocity);if(lifetime>u_particleLifetime){float rx=texture2D(u_random,mod(id+10.0*u_randLonLatOffsets,1.0)).a;float ry=texture2D(u_random,mod(id-u_randLonLatOffsets.yx,1.0)).a;lonLat.x=DIM.x*rx-DIM_2.x;lonLat.y=(DIM.y/radians(DIM.y))*asin(2.0*ry-1.0);speed=0.0;lifetime-=u_particleLifetime;}else{float multiplier=u_rate*(u_timeDelta/1000.0)/M_PER_DEG;lonLat.x+=multiplier*velocity.x/cos(radians(lonLat.y));lonLat.y+=multiplier*velocity.y;}lonLat.x=mod(lonLat.x+DIM_2.x,DIM.x)-DIM_2.x;lonLat.y=clamp(lonLat.y,-DIM_2.y,DIM_2.y);gl_FragColor=vec4(lonLat,lifetime,speed);}",mo="precision mediump float;\n#define GLSLIFY 1\nuniform vec4 u_color;uniform float u_opacitySpeedDecay;varying float v_clip;varying float v_speed;void main(){if(v_clip>0.0||length(gl_PointCoord-vec2(0.5))>0.5){discard;}gl_FragColor=u_color;gl_FragColor.a*=1.0-pow(u_opacitySpeedDecay,v_speed);}",_o="precision mediump float;\n#define GLSLIFY 1\nuniform sampler2D u_texture;uniform float u_fade;varying vec2 v_position;const float MIN_FADE=512.0;void main(){gl_FragColor=texture2D(u_texture,(v_position+1.0)/2.0);gl_FragColor.a=floor(MIN_FADE*gl_FragColor.a*u_fade)/MIN_FADE;}";function yo(t){let e=new Float32Array(t);for(let t=0;t<e.length;t++)e[t]=360*Math.random()-180;return e}function xo(t){let e=new Float32Array(t);for(let t=0;t<e.length;t++)e[t]=180/Math.PI*Math.asin(2*Math.random()-1);return e}function go(t,e){let o=new Float32Array(e);for(let e=0;e<o.length;e++)o[e]=t*Math.random();return o}class vo{constructor(t,e){this._count=this._roundToSquareNumber(e.count),this._lifetime=e.lifetime,this._data=e.data,this._gl=t,this._webgl2=e.webgl2,this._gl.enable(t.BLEND),this._webgl2||(this._ext=this._gl.getExtension("OES_texture_half_float"),this._gl.getExtension("OES_texture_half_float_linear"),this._gl.getExtension("OES_texture_float")),this._gl.getExtension("OES_texture_float_linear"),this._programs=this._createPrograms(),this._buffers=this._createBuffers(),this._textures=this._createTextures(),this._framebuffers=this._createFramebuffers(),this._majorPerformanceCaveat=e.majorPerformanceCaveat,this._majorPerformanceCaveat?this._gl.blendFunc(t.ONE,t.ONE_MINUS_SRC_ALPHA):this._gl.blendFunc(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA)}set count(t){this._count=this._roundToSquareNumber(t),this._gl.deleteBuffer(this._buffers.draw.indices),this._gl.deleteTexture(this._textures.simA),this._gl.deleteTexture(this._textures.simB),this._gl.deleteFramebuffer(this._framebuffers.simA.framebuffer),this._gl.deleteFramebuffer(this._framebuffers.simB.framebuffer),this._buffers.draw=this._createDrawBuffer(),this._textures.simA=this._createSimATexture(),this._textures.simB=this._createSimBTexture(),this._framebuffers=this._createFramebuffers()}set lifetime(t){this._lifetime=t,this._textures.simA=this._createSimATexture(),this._framebuffers=this._createFramebuffers()}set data(t){this._data=t,this._gl.deleteTexture(this._textures.vectorField),this._textures.vectorFieldU=this._createVectorFieldTexture(this._data.uVelocities),this._textures.vectorFieldV=this._createVectorFieldTexture(this._data.vVelocities)}step(t,e,o){to(this._gl,this._framebuffers.simB),this._gl.disable(this._gl.BLEND),uo(this._gl,this._programs.sim,this._buffers.sim,{u_particleData:this._textures.simA,u_vectorFieldU:this._textures.vectorFieldU,u_vectorFieldV:this._textures.vectorFieldV,u_random:this._textures.random,u_particleLifetime:this._lifetime,u_randLonLatOffsets:[Math.random(),Math.random()],u_gridWidth:this._data.width,u_gridHeight:this._data.height,u_timeDelta:e,u_rate:o,...t}),this._gl.enable(this._gl.BLEND),to(this._gl,null),[this._textures.simA,this._textures.simB]=[this._textures.simB,this._textures.simA],[this._framebuffers.simA,this._framebuffers.simB]=[this._framebuffers.simB,this._framebuffers.simA]}draw(t,e,o,r){uo(this._gl,this._programs.draw,this._buffers.draw,{u_particlePositions:this._textures.simA,u_particleCountSqrt:Math.sqrt(this._count),u_size:e,u_color:[1,1,1,o],u_opacitySpeedDecay:r,...t},this._gl.POINTS)}drawWithTrails(t,e,o,r,n){to(this._gl,this._framebuffers.particleTrailsB),this._majorPerformanceCaveat?(this._gl.clear(this._gl.COLOR_BUFFER_BIT),o/=4):this._gl.disable(this._gl.BLEND),uo(this._gl,this._programs.texture,this._buffers.texture,{u_texture:this._textures.particleTrailsA,u_fade:n}),this._majorPerformanceCaveat||this._gl.enable(this._gl.BLEND),this.draw(t,e,o,r),to(this._gl,null),uo(this._gl,this._programs.texture,this._buffers.texture,{u_texture:this._textures.particleTrailsB,u_fade:1}),[this._textures.particleTrailsA,this._textures.particleTrailsB]=[this._textures.particleTrailsB,this._textures.particleTrailsA],[this._framebuffers.particleTrailsA,this._framebuffers.particleTrailsB]=[this._framebuffers.particleTrailsB,this._framebuffers.particleTrailsA]}resetTrails(){Je(this._gl,this._framebuffers.particleTrailsA,[{attachment:this._textures.particleTrailsA}]),Je(this._gl,this._framebuffers.particleTrailsB,[{attachment:this._textures.particleTrailsB}]),to(this._gl,this._framebuffers.particleTrailsA),this._gl.clear(this._gl.COLOR_BUFFER_BIT),to(this._gl,null)}_createPrograms(){let t=this._webgl2?po.replace(/\)\.a;/g,").r;"):po;return{sim:Ue(this._gl,[lo,t]),draw:Ue(this._gl,["#define GLSLIFY 1\nconst float PI_1540259130=radians(180.0);void rotate_2(in vec2 lonLat0,inout vec2 lonLat,out bool clip){vec3 xyzCoord=vec3(cos(lonLat.x)*cos(lonLat.y),sin(lonLat.x)*cos(lonLat.y),sin(lonLat.y));mat3 rotateLongitude=mat3(cos(lonLat0.x),-sin(lonLat0.x),0,sin(lonLat0.x),cos(lonLat0.x),0,0,0,1);mat3 rotateLatitude=mat3(cos(lonLat0.y),0,-sin(lonLat0.y),0,1,0,sin(lonLat0.y),0,cos(lonLat0.y));xyzCoord=rotateLatitude*rotateLongitude*xyzCoord;lonLat=vec2(atan(xyzCoord.y,xyzCoord.x),asin(xyzCoord.z));float distanceFromMeridian=abs(lonLat.x);clip=distanceFromMeridian>PI_1540259130-radians(1.0);}void equirectangular(out vec2 coord,in vec2 lonLat0,in vec2 lonLat,out bool clip){rotate_2(lonLat0,lonLat,clip);coord.x=lonLat.x;coord.y=lonLat.y;}const float PI_3=radians(180.0);void rotate_3(in vec2 lonLat0,inout vec2 lonLat,out bool clip){vec3 xyzCoord=vec3(cos(lonLat.x)*cos(lonLat.y),sin(lonLat.x)*cos(lonLat.y),sin(lonLat.y));mat3 rotateLongitude=mat3(cos(lonLat0.x),-sin(lonLat0.x),0,sin(lonLat0.x),cos(lonLat0.x),0,0,0,1);mat3 rotateLatitude=mat3(cos(lonLat0.y),0,-sin(lonLat0.y),0,1,0,sin(lonLat0.y),0,cos(lonLat0.y));xyzCoord=rotateLatitude*rotateLongitude*xyzCoord;lonLat=vec2(atan(xyzCoord.y,xyzCoord.x),asin(xyzCoord.z));float distanceFromMeridian=abs(lonLat.x);clip=distanceFromMeridian>PI_3-radians(1.0);}const float PI_2_1535977339=radians(90.0);void mercator(out vec2 coord,in vec2 lonLat0,in vec2 lonLat,out bool clip){rotate_3(lonLat0,lonLat,clip);coord.x=lonLat.x;coord.y=log(tan((PI_2_1535977339+lonLat.y)/2.0));}const float PI_1=radians(180.0);void rotate_1(in vec2 lonLat0,inout vec2 lonLat,out bool clip){vec3 xyzCoord=vec3(cos(lonLat.x)*cos(lonLat.y),sin(lonLat.x)*cos(lonLat.y),sin(lonLat.y));mat3 rotateLongitude=mat3(cos(lonLat0.x),-sin(lonLat0.x),0,sin(lonLat0.x),cos(lonLat0.x),0,0,0,1);mat3 rotateLatitude=mat3(cos(lonLat0.y),0,-sin(lonLat0.y),0,1,0,sin(lonLat0.y),0,cos(lonLat0.y));xyzCoord=rotateLatitude*rotateLongitude*xyzCoord;lonLat=vec2(atan(xyzCoord.y,xyzCoord.x),asin(xyzCoord.z));float distanceFromMeridian=abs(lonLat.x);clip=distanceFromMeridian>PI_1-radians(1.0);}const float A1=1.340264;const float A2=-0.081106;const float A3=0.000893;const float A4=0.003796;const float M=sqrt(3.0)/2.0;void equalEarth(out vec2 coord,in vec2 lonLat0,in vec2 lonLat,out bool clip){rotate_1(lonLat0,lonLat,clip);float l=asin(M*sin(lonLat.y));float l2=l*l;float l6=l2*l2*l2;coord.x=(lonLat.x)*cos(l)/(M*(A1+3.0*A2*l2+l6*(7.0*A3+9.0*A4*l2)));coord.y=l*(A1+A2*l2+l6*(A3+A4*l2));}void orthographic(out vec2 coord,in vec2 lonLat0,in vec2 lonLat,out bool clip){float c=sin(lonLat0.y)*sin(lonLat.y)+cos(lonLat0.y)*cos(lonLat.y)*cos(lonLat.x-lonLat0.x);clip=c<0.0;coord.x=cos(lonLat.y)*sin(lonLat.x-lonLat0.x);coord.y=cos(lonLat0.y)*sin(lonLat.y)-sin(lonLat0.y)*cos(lonLat.y)*cos(lonLat.x-lonLat0.x);}const float FOV_SCALAR_529295689=7.0;void verticalPerspective(out vec2 coord,in vec2 lonLat0,in vec2 lonLat,out bool clip,in float zoom){float c=sin(lonLat0.y)*sin(lonLat.y)+cos(lonLat0.y)*cos(lonLat.y)*cos(lonLat.x-lonLat0.x);float P=1.0+(FOV_SCALAR_529295689/zoom);float k=(P-1.0)/(P-c);clip=c<1.0/P;coord.x=k*cos(lonLat.y)*sin(lonLat.x-lonLat0.x);coord.y=k*(cos(lonLat0.y)*sin(lonLat.y)-sin(lonLat0.y)*cos(lonLat.y)*cos(lonLat.x-lonLat0.x));}const float PI_0=radians(180.0);void rotate_0(in vec2 lonLat0,inout vec2 lonLat,out bool clip){vec3 xyzCoord=vec3(cos(lonLat.x)*cos(lonLat.y),sin(lonLat.x)*cos(lonLat.y),sin(lonLat.y));mat3 rotateLongitude=mat3(cos(lonLat0.x),-sin(lonLat0.x),0,sin(lonLat0.x),cos(lonLat0.x),0,0,0,1);mat3 rotateLatitude=mat3(cos(lonLat0.y),0,-sin(lonLat0.y),0,1,0,sin(lonLat0.y),0,cos(lonLat0.y));xyzCoord=rotateLatitude*rotateLongitude*xyzCoord;lonLat=vec2(atan(xyzCoord.y,xyzCoord.x),asin(xyzCoord.z));float distanceFromMeridian=abs(lonLat.x);clip=distanceFromMeridian>PI_0-radians(1.0);}void stereographic(out vec2 coord,in vec2 lonLat0,in vec2 lonLat,out bool clip){rotate_0(lonLat0,lonLat,clip);clip=false;float cy=cos(lonLat.y);float k=1.0+cos(lonLat.x)*cy;coord.x=cy*sin(lonLat.x)/k;coord.y=sin(lonLat.y)/k;}void forwardProject(out vec2 displayCoord,in vec2 lonLat0,in vec2 lonLat,out bool clip,in float zoom,in int projection){if(projection==0){equirectangular(displayCoord,lonLat0,lonLat,clip);}else if(projection==1){mercator(displayCoord,lonLat0,lonLat,clip);}else if(projection==2){equalEarth(displayCoord,lonLat0,lonLat,clip);}else if(projection==3){orthographic(displayCoord,lonLat0,lonLat,clip);}else if(projection==4){verticalPerspective(displayCoord,lonLat0,lonLat,clip,zoom);}else if(projection==5){stereographic(displayCoord,lonLat0,lonLat,clip);}}attribute vec2 a_particleIndex;uniform sampler2D u_particlePositions;uniform float u_particleCountSqrt;uniform float u_canvasRatio;uniform float u_screenRatio;uniform float u_lon0;uniform float u_lat0;uniform float u_zoom;uniform int u_projection;uniform float u_size;varying float v_clip;varying float v_speed;const float PI_2=radians(90.0);void main(){vec2 displayCoord;vec2 lonLat0=radians(vec2(u_lon0,u_lat0));vec2 texCoord=a_particleIndex/u_particleCountSqrt;vec4 data=texture2D(u_particlePositions,texCoord);vec2 lonLat=radians(data.rg);v_speed=data.a;bool clip;forwardProject(displayCoord,lonLat0,lonLat,clip,u_zoom,u_projection);if(clip){v_clip=1.0;}else{v_clip=0.0;}displayCoord=u_zoom*displayCoord/PI_2;displayCoord.x=displayCoord.x/u_canvasRatio;gl_PointSize=u_size*u_zoom*u_screenRatio;gl_Position=vec4(displayCoord,0,1);}",mo]),texture:Ue(this._gl,[lo,_o])}}_createBuffers(){let t=tt(this._gl,co);return{sim:t,draw:this._createDrawBuffer(),texture:t}}_createDrawBuffer(){let t=new Float32Array(2*this._count);for(let e=0;e<t.length;e++){let o=Math.floor(e/2);t[e]=e%2==0?Math.floor(o/Math.sqrt(this._count)):o%Math.sqrt(this._count)}return tt(this._gl,{a_particleIndex:{numComponents:2,data:t}})}_createTextures(){return{random:ie(this._gl,{src:go(1,Math.pow(128,2)),type:this._gl.FLOAT,format:this._webgl2?this._gl.RED:this._gl.ALPHA,internalFormat:this._webgl2?this._gl.R32F:this._gl.ALPHA,minMag:this._gl.NEAREST,width:128,height:128}),simA:this._createSimATexture(),simB:this._createSimBTexture(),vectorFieldU:this._createVectorFieldTexture(this._data.uVelocities),vectorFieldV:this._createVectorFieldTexture(this._data.vVelocities),particleTrailsA:this._createParticleTrailsTexture(),particleTrailsB:this._createParticleTrailsTexture()}}_createSimATexture(){return ie(this._gl,{type:this._gl.FLOAT,format:this._gl.RGBA,internalFormat:this._webgl2?this._gl.RGBA32F:this._gl.RGBA,minMag:this._gl.NEAREST,width:Math.sqrt(this._count),height:Math.sqrt(this._count),src:Lo(yo(this._count),xo(this._count),go(this._lifetime,this._count))})}_createSimBTexture(){return ie(this._gl,{type:this._gl.FLOAT,format:this._gl.RGBA,internalFormat:this._webgl2?this._gl.RGBA32F:this._gl.RGBA,minMag:this._gl.NEAREST,width:Math.sqrt(this._count),height:Math.sqrt(this._count)})}_createVectorFieldTexture(t){let e,o,r;return"Float32Array"!==this._data.uVelocities.constructor.name?(t=new Uint16Array(t.buffer),e=this._webgl2?this._gl.HALF_FLOAT:this._ext.HALF_FLOAT_OES,o=this._webgl2?this._gl.RED:this._gl.ALPHA,r=this._webgl2?this._gl.R16F:this._gl.ALPHA):(e=this._gl.FLOAT,o=this._webgl2?this._gl.RED:this._gl.ALPHA,r=this._webgl2?this._gl.R32F:this._gl.ALPHA),ie(this._gl,{src:t,type:e,format:o,internalFormat:r,minMag:this._gl.LINEAR,width:this._data.width,height:this._data.height})}_createParticleTrailsTexture(){return ie(this._gl,{minMag:this._gl.NEAREST,width:this._gl.canvas.width*window.devicePixelRatio,height:this._gl.canvas.height*window.devicePixelRatio})}_createFramebuffers(){return{...this._createSimFramebuffers(),particleTrailsA:this._createParticleTrailsFramebuffer(this._textures.particleTrailsA),particleTrailsB:this._createParticleTrailsFramebuffer(this._textures.particleTrailsB)}}_createSimFramebuffers(){return{simA:Qe(this._gl,[{attachment:this._textures.simA}],Math.sqrt(this._count),Math.sqrt(this._count)),simB:Qe(this._gl,[{attachment:this._textures.simB}],Math.sqrt(this._count),Math.sqrt(this._count))}}_createParticleTrailsFramebuffer(t){return Qe(this._gl,[{attachment:t}],this._gl.canvas.width*window.devicePixelRatio,this._gl.canvas.height*window.devicePixelRatio)}_roundToSquareNumber(t){return Math.pow(Math.floor(Math.sqrt(t)),2)}}function Lo(t,e,o,r){let n=new Float32Array(4*t.length);for(let i=0;i<n.length;i++)i%4==0?n[i]=t[i/4]:i%4==1?n[i]=e[Math.floor(i/4)]:i%4==2&&o?n[i]=o[Math.floor(i/4)]:r&&(n[i]=r[Math.floor(i/4)]);return n}var bo="precision highp float;\n#define GLSLIFY 1\nvec4 encodeToRGBA(in float value,in float scale,in float off){float normalizedVal=(value-off)/scale;vec4 rgba;float v=normalizedVal;v*=256.0;rgba.a=floor(v);v=fract(v);v*=256.0;rgba.b=floor(v);v=fract(v);v*=256.0;rgba.g=floor(v);v=fract(v);v*=256.0;rgba.r=floor(v+0.5);return rgba/255.0;}const vec4 bitPlaces=vec4(pow(256.0,4.0),pow(256.0,3.0),pow(256.0,2.0),pow(256.0,1.0));float decodeFromRGBA(in vec4 rgba,in float scale,in float off){vec4 integers=floor(255.0*rgba+0.5);return scale*dot(integers,1.0/bitPlaces)+off;}const float PI=radians(180.0);const float PI_2_1117569599=radians(90.0);void projectToTexture(out vec2 textureCoord,in vec2 lonLat,in float gridWidth,in float gridHeight,in int projection){if(projection==0){textureCoord=(lonLat+vec2(0,PI_2_1117569599))/vec2(2.0*PI,PI);float xOffset=0.5/gridWidth;float yScale=(gridHeight-1.0)/gridHeight;textureCoord.x=mod(textureCoord.x+xOffset,1.0);textureCoord.y=yScale*(textureCoord.y-0.5)+0.5;}else if(projection==1){textureCoord=(lonLat+vec2(0,PI_2_1117569599))/vec2(2.0*PI,PI);textureCoord.x=mod(textureCoord.x,1.0);}else if(projection==3){textureCoord=(lonLat+vec2(PI,PI_2_1117569599))/vec2(2.0*PI,PI);float xOffset=0.5/gridWidth;float yScale=(gridHeight-1.0)/gridHeight;textureCoord.x=mod(textureCoord.x+xOffset,1.0);textureCoord.y=yScale*(textureCoord.y-0.5)+0.5;}else if(projection==2){textureCoord=(lonLat+vec2(radians(-20.0),PI_2_1117569599))/vec2(2.0*PI,PI);float xOffset=0.5/gridWidth;float xScale=1080.0/gridWidth;float yScale=(90.0/80.0)*(gridHeight-1.0)/gridHeight;textureCoord.x=mod(xScale*(textureCoord.x+xOffset),xScale);textureCoord.y=1.0-(yScale*(textureCoord.y-0.5)+0.5);if(textureCoord.y>1.0||textureCoord.y<0.0){textureCoord=vec2(0.0,0.5);}}}uniform sampler2D u_particleLongitudes;uniform sampler2D u_particleLatitudes;uniform sampler2D u_particleLifetimes;uniform sampler2D u_vectorFieldU;uniform sampler2D u_random;uniform vec2 u_randLonLatOffsets;uniform float u_gridWidth;uniform float u_gridHeight;uniform int u_particleDataProjection;uniform float u_particleLifetime;uniform float u_timeDelta;uniform float u_rate;varying vec2 v_position;const vec2 DIM=vec2(360.0,180.0);const vec2 DIM_2=vec2(180.0,90.0);const float M_PER_DEG=111319.5;void main(){vec2 id=(v_position+1.0)/2.0;vec2 lonLat=vec2(decodeFromRGBA(texture2D(u_particleLongitudes,id),DIM.x,-DIM_2.x),decodeFromRGBA(texture2D(u_particleLatitudes,id),DIM.y,-DIM_2.y));float lifetime=decodeFromRGBA(texture2D(u_particleLifetimes,id),u_particleLifetime,0.0);lifetime+=u_timeDelta;vec2 textureCoord;projectToTexture(textureCoord,radians(lonLat),u_gridWidth,u_gridHeight,u_particleDataProjection);float velocity=texture2D(u_vectorFieldU,textureCoord).a;if(lifetime>u_particleLifetime){float rx=texture2D(u_random,mod(id+10.0*u_randLonLatOffsets,1.0)).a;float ry=texture2D(u_random,mod(id-u_randLonLatOffsets.yx,1.0)).a;lonLat.x=DIM.x*rx-DIM_2.x;}else{float multiplier=u_rate*(u_timeDelta/1000.0)/M_PER_DEG;lonLat.x+=multiplier*velocity/cos(radians(lonLat.y));}lonLat.x=mod(lonLat.x+DIM_2.x,DIM.x)-DIM_2.x;gl_FragColor=encodeToRGBA(lonLat.x,DIM.x,-DIM_2.x);}",Po="precision highp float;\n#define GLSLIFY 1\nvec4 encodeToRGBA(in float value,in float scale,in float off){float normalizedVal=(value-off)/scale;vec4 rgba;float v=normalizedVal;v*=256.0;rgba.a=floor(v);v=fract(v);v*=256.0;rgba.b=floor(v);v=fract(v);v*=256.0;rgba.g=floor(v);v=fract(v);v*=256.0;rgba.r=floor(v+0.5);return rgba/255.0;}const vec4 bitPlaces=vec4(pow(256.0,4.0),pow(256.0,3.0),pow(256.0,2.0),pow(256.0,1.0));float decodeFromRGBA(in vec4 rgba,in float scale,in float off){vec4 integers=floor(255.0*rgba+0.5);return scale*dot(integers,1.0/bitPlaces)+off;}const float PI=radians(180.0);const float PI_2_1117569599=radians(90.0);void projectToTexture(out vec2 textureCoord,in vec2 lonLat,in float gridWidth,in float gridHeight,in int projection){if(projection==0){textureCoord=(lonLat+vec2(0,PI_2_1117569599))/vec2(2.0*PI,PI);float xOffset=0.5/gridWidth;float yScale=(gridHeight-1.0)/gridHeight;textureCoord.x=mod(textureCoord.x+xOffset,1.0);textureCoord.y=yScale*(textureCoord.y-0.5)+0.5;}else if(projection==1){textureCoord=(lonLat+vec2(0,PI_2_1117569599))/vec2(2.0*PI,PI);textureCoord.x=mod(textureCoord.x,1.0);}else if(projection==3){textureCoord=(lonLat+vec2(PI,PI_2_1117569599))/vec2(2.0*PI,PI);float xOffset=0.5/gridWidth;float yScale=(gridHeight-1.0)/gridHeight;textureCoord.x=mod(textureCoord.x+xOffset,1.0);textureCoord.y=yScale*(textureCoord.y-0.5)+0.5;}else if(projection==2){textureCoord=(lonLat+vec2(radians(-20.0),PI_2_1117569599))/vec2(2.0*PI,PI);float xOffset=0.5/gridWidth;float xScale=1080.0/gridWidth;float yScale=(90.0/80.0)*(gridHeight-1.0)/gridHeight;textureCoord.x=mod(xScale*(textureCoord.x+xOffset),xScale);textureCoord.y=1.0-(yScale*(textureCoord.y-0.5)+0.5);if(textureCoord.y>1.0||textureCoord.y<0.0){textureCoord=vec2(0.0,0.5);}}}uniform sampler2D u_particleLongitudes;uniform sampler2D u_particleLatitudes;uniform sampler2D u_particleLifetimes;uniform sampler2D u_vectorFieldV;uniform sampler2D u_random;uniform vec2 u_randLonLatOffsets;uniform float u_gridWidth;uniform float u_gridHeight;uniform int u_particleDataProjection;uniform float u_particleLifetime;uniform float u_timeDelta;uniform float u_rate;varying vec2 v_position;const vec2 DIM=vec2(360.0,180.0);const vec2 DIM_2=vec2(180.0,90.0);const float M_PER_DEG=111319.5;void main(){vec2 id=(v_position+1.0)/2.0;vec2 lonLat=vec2(decodeFromRGBA(texture2D(u_particleLongitudes,id),DIM.x,-DIM_2.x),decodeFromRGBA(texture2D(u_particleLatitudes,id),DIM.y,-DIM_2.y));float lifetime=decodeFromRGBA(texture2D(u_particleLifetimes,id),u_particleLifetime,0.0);lifetime+=u_timeDelta;vec2 textureCoord;projectToTexture(textureCoord,radians(lonLat),u_gridWidth,u_gridHeight,u_particleDataProjection);float velocity=texture2D(u_vectorFieldV,textureCoord).a;if(lifetime>u_particleLifetime){float ry=texture2D(u_random,mod(id-u_randLonLatOffsets.yx,1.0)).a;lonLat.y=(DIM.y/radians(DIM.y))*asin(2.0*ry-1.0);}else{float multiplier=u_rate*(u_timeDelta/1000.0)/M_PER_DEG;lonLat.y+=multiplier*velocity;}lonLat.y=clamp(lonLat.y,-DIM_2.y,DIM_2.y);gl_FragColor=encodeToRGBA(lonLat.y,DIM.y,-DIM_2.y);}",Ao="precision highp float;\n#define GLSLIFY 1\nvec4 encodeToRGBA(in float value,in float scale,in float off){float normalizedVal=(value-off)/scale;vec4 rgba;float v=normalizedVal;v*=256.0;rgba.a=floor(v);v=fract(v);v*=256.0;rgba.b=floor(v);v=fract(v);v*=256.0;rgba.g=floor(v);v=fract(v);v*=256.0;rgba.r=floor(v+0.5);return rgba/255.0;}const vec4 bitPlaces=vec4(pow(256.0,4.0),pow(256.0,3.0),pow(256.0,2.0),pow(256.0,1.0));float decodeFromRGBA(in vec4 rgba,in float scale,in float off){vec4 integers=floor(255.0*rgba+0.5);return scale*dot(integers,1.0/bitPlaces)+off;}const float MAX_SPEED_1117569599=10000.0;const float PI=radians(180.0);const float PI_2_2281831123=radians(90.0);void projectToTexture(out vec2 textureCoord,in vec2 lonLat,in float gridWidth,in float gridHeight,in int projection){if(projection==0){textureCoord=(lonLat+vec2(0,PI_2_2281831123))/vec2(2.0*PI,PI);float xOffset=0.5/gridWidth;float yScale=(gridHeight-1.0)/gridHeight;textureCoord.x=mod(textureCoord.x+xOffset,1.0);textureCoord.y=yScale*(textureCoord.y-0.5)+0.5;}else if(projection==1){textureCoord=(lonLat+vec2(0,PI_2_2281831123))/vec2(2.0*PI,PI);textureCoord.x=mod(textureCoord.x,1.0);}else if(projection==3){textureCoord=(lonLat+vec2(PI,PI_2_2281831123))/vec2(2.0*PI,PI);float xOffset=0.5/gridWidth;float yScale=(gridHeight-1.0)/gridHeight;textureCoord.x=mod(textureCoord.x+xOffset,1.0);textureCoord.y=yScale*(textureCoord.y-0.5)+0.5;}else if(projection==2){textureCoord=(lonLat+vec2(radians(-20.0),PI_2_2281831123))/vec2(2.0*PI,PI);float xOffset=0.5/gridWidth;float xScale=1080.0/gridWidth;float yScale=(90.0/80.0)*(gridHeight-1.0)/gridHeight;textureCoord.x=mod(xScale*(textureCoord.x+xOffset),xScale);textureCoord.y=1.0-(yScale*(textureCoord.y-0.5)+0.5);if(textureCoord.y>1.0||textureCoord.y<0.0){textureCoord=vec2(0.0,0.5);}}}uniform sampler2D u_particleLongitudes;uniform sampler2D u_particleLatitudes;uniform sampler2D u_particleLifetimes;uniform sampler2D u_vectorFieldU;uniform sampler2D u_vectorFieldV;uniform float u_gridWidth;uniform float u_gridHeight;uniform int u_particleDataProjection;uniform float u_particleLifetime;uniform float u_timeDelta;varying vec2 v_position;const vec2 DIM=vec2(360.0,180.0);const vec2 DIM_2=vec2(180.0,90.0);void main(){vec2 id=(v_position+1.0)/2.0;vec2 lonLat=vec2(decodeFromRGBA(texture2D(u_particleLongitudes,id),DIM.x,-DIM_2.x),decodeFromRGBA(texture2D(u_particleLatitudes,id),DIM.y,-DIM_2.y));float lifetime=decodeFromRGBA(texture2D(u_particleLifetimes,id),u_particleLifetime,0.0);lifetime+=u_timeDelta;vec2 textureCoord;projectToTexture(textureCoord,radians(lonLat),u_gridWidth,u_gridHeight,u_particleDataProjection);vec2 velocity;velocity.x=texture2D(u_vectorFieldU,textureCoord).a;velocity.y=texture2D(u_vectorFieldV,textureCoord).a;float speed=length(velocity);if(lifetime>u_particleLifetime){speed=0.0;}gl_FragColor=encodeToRGBA(speed,MAX_SPEED_1117569599,0.0);}";class Co extends vo{set count(t){this._count=this._roundToSquareNumber(t),this._gl.deleteBuffer(this._buffers.draw.indices),this._gl.deleteTexture(this._textures.simA.longitudes),this._gl.deleteTexture(this._textures.simA.latitudes),this._gl.deleteTexture(this._textures.simA.lifetimes),this._gl.deleteTexture(this._textures.simA.speeds),this._gl.deleteTexture(this._textures.simB.longitudes),this._gl.deleteTexture(this._textures.simB.latitudes),this._gl.deleteTexture(this._textures.simB.lifetimes),this._gl.deleteTexture(this._textures.simB.speeds),this._gl.deleteFramebuffer(this._framebuffers.simA.longitudes.framebuffer),this._gl.deleteFramebuffer(this._framebuffers.simA.latitudes.framebuffer),this._gl.deleteFramebuffer(this._framebuffers.simA.lifetimes.framebuffer),this._gl.deleteFramebuffer(this._framebuffers.simA.speeds.framebuffer),this._gl.deleteFramebuffer(this._framebuffers.simB.longitudes.framebuffer),this._gl.deleteFramebuffer(this._framebuffers.simB.latitudes.framebuffer),this._gl.deleteFramebuffer(this._framebuffers.simB.lifetimes.framebuffer),this._gl.deleteFramebuffer(this._framebuffers.simB.speeds.framebuffer),this._buffers.draw=this._createDrawBuffer(),this._textures.simA=this._createSimATexture(),this._textures.simB=this._createSimBTexture(),this._framebuffers=this._createFramebuffers()}step(t,e,o){const r={u_particleLongitudes:this._textures.simA.longitudes,u_particleLatitudes:this._textures.simA.latitudes,u_particleLifetimes:this._textures.simA.lifetimes,u_vectorFieldU:this._textures.vectorFieldU,u_vectorFieldV:this._textures.vectorFieldV,u_random:this._textures.random,u_particleLifetime:this._lifetime,u_randLonLatOffsets:[Math.random(),Math.random()],u_gridWidth:this._data.width,u_gridHeight:this._data.height,u_timeDelta:e,u_rate:o,...t};this._gl.disable(this._gl.BLEND),to(this._gl,this._framebuffers.simB.longitudes),uo(this._gl,this._programs.sim.longitudes,this._buffers.sim,r),to(this._gl,this._framebuffers.simB.latitudes),uo(this._gl,this._programs.sim.latitudes,this._buffers.sim,r),to(this._gl,this._framebuffers.simB.lifetimes),uo(this._gl,this._programs.sim.lifetimes,this._buffers.sim,r),to(this._gl,this._framebuffers.simB.speeds),uo(this._gl,this._programs.sim.speeds,this._buffers.sim,r),this._gl.enable(this._gl.BLEND),to(this._gl,null),[this._textures.simA.longitudes,this._textures.simB.longitudes]=[this._textures.simB.longitudes,this._textures.simA.longitudes],[this._textures.simA.latitudes,this._textures.simB.latitudes]=[this._textures.simB.latitudes,this._textures.simA.latitudes],[this._textures.simA.lifetimes,this._textures.simB.lifetimes]=[this._textures.simB.lifetimes,this._textures.simA.lifetimes],[this._textures.simA.speeds,this._textures.simB.speeds]=[this._textures.simB.speeds,this._textures.simA.speeds],[this._framebuffers.simA,this._framebuffers.simB]=[this._framebuffers.simB,this._framebuffers.simA]}draw(t,e,o,r){super.draw({u_particleLongitudes:this._textures.simA.longitudes,u_particleLatitudes:this._textures.simA.latitudes,u_particleSpeeds:this._textures.simA.speeds,...t},e,o,r)}drawWithTrails(t,e,o,r,n){super.drawWithTrails({u_particleLongitudes:this._textures.simA.longitudes,u_particleLatitudes:this._textures.simA.latitudes,u_particleSpeeds:this._textures.simA.speeds,...t},e,o,r,n)}_createPrograms(){let t=this._webgl2?bo.replace(/\)\.a;/g,").r;"):bo,e=this._webgl2?Po.replace(/\)\.a;/g,").r;"):Po,o=this._webgl2?Ao.replace(/\)\.a;/g,").r;"):Ao;return{sim:{longitudes:Ue(this._gl,[lo,t]),latitudes:Ue(this._gl,[lo,e]),lifetimes:Ue(this._gl,[lo,"precision highp float;\n#define GLSLIFY 1\nvec4 encodeToRGBA(in float value,in float scale,in float off){float normalizedVal=(value-off)/scale;vec4 rgba;float v=normalizedVal;v*=256.0;rgba.a=floor(v);v=fract(v);v*=256.0;rgba.b=floor(v);v=fract(v);v*=256.0;rgba.g=floor(v);v=fract(v);v*=256.0;rgba.r=floor(v+0.5);return rgba/255.0;}const vec4 bitPlaces=vec4(pow(256.0,4.0),pow(256.0,3.0),pow(256.0,2.0),pow(256.0,1.0));float decodeFromRGBA(in vec4 rgba,in float scale,in float off){vec4 integers=floor(255.0*rgba+0.5);return scale*dot(integers,1.0/bitPlaces)+off;}uniform sampler2D u_particleLifetimes;uniform float u_particleLifetime;uniform float u_timeDelta;varying vec2 v_position;void main(){vec2 id=(v_position+1.0)/2.0;float lifetime=decodeFromRGBA(texture2D(u_particleLifetimes,id),u_particleLifetime,0.0);lifetime+=u_timeDelta;if(lifetime>u_particleLifetime){lifetime-=u_particleLifetime;}gl_FragColor=encodeToRGBA(lifetime,u_particleLifetime,0.0);}"]),speeds:Ue(this._gl,[lo,o])},draw:Ue(this._gl,["#define GLSLIFY 1\nconst float PI_1540259130=radians(180.0);void rotate_2(in vec2 lonLat0,inout vec2 lonLat,out bool clip){vec3 xyzCoord=vec3(cos(lonLat.x)*cos(lonLat.y),sin(lonLat.x)*cos(lonLat.y),sin(lonLat.y));mat3 rotateLongitude=mat3(cos(lonLat0.x),-sin(lonLat0.x),0,sin(lonLat0.x),cos(lonLat0.x),0,0,0,1);mat3 rotateLatitude=mat3(cos(lonLat0.y),0,-sin(lonLat0.y),0,1,0,sin(lonLat0.y),0,cos(lonLat0.y));xyzCoord=rotateLatitude*rotateLongitude*xyzCoord;lonLat=vec2(atan(xyzCoord.y,xyzCoord.x),asin(xyzCoord.z));float distanceFromMeridian=abs(lonLat.x);clip=distanceFromMeridian>PI_1540259130-radians(1.0);}void equirectangular(out vec2 coord,in vec2 lonLat0,in vec2 lonLat,out bool clip){rotate_2(lonLat0,lonLat,clip);coord.x=lonLat.x;coord.y=lonLat.y;}const float PI_3=radians(180.0);void rotate_3(in vec2 lonLat0,inout vec2 lonLat,out bool clip){vec3 xyzCoord=vec3(cos(lonLat.x)*cos(lonLat.y),sin(lonLat.x)*cos(lonLat.y),sin(lonLat.y));mat3 rotateLongitude=mat3(cos(lonLat0.x),-sin(lonLat0.x),0,sin(lonLat0.x),cos(lonLat0.x),0,0,0,1);mat3 rotateLatitude=mat3(cos(lonLat0.y),0,-sin(lonLat0.y),0,1,0,sin(lonLat0.y),0,cos(lonLat0.y));xyzCoord=rotateLatitude*rotateLongitude*xyzCoord;lonLat=vec2(atan(xyzCoord.y,xyzCoord.x),asin(xyzCoord.z));float distanceFromMeridian=abs(lonLat.x);clip=distanceFromMeridian>PI_3-radians(1.0);}const float PI_2_870892966=radians(90.0);void mercator(out vec2 coord,in vec2 lonLat0,in vec2 lonLat,out bool clip){rotate_3(lonLat0,lonLat,clip);coord.x=lonLat.x;coord.y=log(tan((PI_2_870892966+lonLat.y)/2.0));}const float PI_1=radians(180.0);void rotate_1(in vec2 lonLat0,inout vec2 lonLat,out bool clip){vec3 xyzCoord=vec3(cos(lonLat.x)*cos(lonLat.y),sin(lonLat.x)*cos(lonLat.y),sin(lonLat.y));mat3 rotateLongitude=mat3(cos(lonLat0.x),-sin(lonLat0.x),0,sin(lonLat0.x),cos(lonLat0.x),0,0,0,1);mat3 rotateLatitude=mat3(cos(lonLat0.y),0,-sin(lonLat0.y),0,1,0,sin(lonLat0.y),0,cos(lonLat0.y));xyzCoord=rotateLatitude*rotateLongitude*xyzCoord;lonLat=vec2(atan(xyzCoord.y,xyzCoord.x),asin(xyzCoord.z));float distanceFromMeridian=abs(lonLat.x);clip=distanceFromMeridian>PI_1-radians(1.0);}const float A1=1.340264;const float A2=-0.081106;const float A3=0.000893;const float A4=0.003796;const float M=sqrt(3.0)/2.0;void equalEarth(out vec2 coord,in vec2 lonLat0,in vec2 lonLat,out bool clip){rotate_1(lonLat0,lonLat,clip);float l=asin(M*sin(lonLat.y));float l2=l*l;float l6=l2*l2*l2;coord.x=(lonLat.x)*cos(l)/(M*(A1+3.0*A2*l2+l6*(7.0*A3+9.0*A4*l2)));coord.y=l*(A1+A2*l2+l6*(A3+A4*l2));}void orthographic(out vec2 coord,in vec2 lonLat0,in vec2 lonLat,out bool clip){float c=sin(lonLat0.y)*sin(lonLat.y)+cos(lonLat0.y)*cos(lonLat.y)*cos(lonLat.x-lonLat0.x);clip=c<0.0;coord.x=cos(lonLat.y)*sin(lonLat.x-lonLat0.x);coord.y=cos(lonLat0.y)*sin(lonLat.y)-sin(lonLat0.y)*cos(lonLat.y)*cos(lonLat.x-lonLat0.x);}const float FOV_SCALAR_529295689=7.0;void verticalPerspective(out vec2 coord,in vec2 lonLat0,in vec2 lonLat,out bool clip,in float zoom){float c=sin(lonLat0.y)*sin(lonLat.y)+cos(lonLat0.y)*cos(lonLat.y)*cos(lonLat.x-lonLat0.x);float P=1.0+(FOV_SCALAR_529295689/zoom);float k=(P-1.0)/(P-c);clip=c<1.0/P;coord.x=k*cos(lonLat.y)*sin(lonLat.x-lonLat0.x);coord.y=k*(cos(lonLat0.y)*sin(lonLat.y)-sin(lonLat0.y)*cos(lonLat.y)*cos(lonLat.x-lonLat0.x));}const float PI_0=radians(180.0);void rotate_0(in vec2 lonLat0,inout vec2 lonLat,out bool clip){vec3 xyzCoord=vec3(cos(lonLat.x)*cos(lonLat.y),sin(lonLat.x)*cos(lonLat.y),sin(lonLat.y));mat3 rotateLongitude=mat3(cos(lonLat0.x),-sin(lonLat0.x),0,sin(lonLat0.x),cos(lonLat0.x),0,0,0,1);mat3 rotateLatitude=mat3(cos(lonLat0.y),0,-sin(lonLat0.y),0,1,0,sin(lonLat0.y),0,cos(lonLat0.y));xyzCoord=rotateLatitude*rotateLongitude*xyzCoord;lonLat=vec2(atan(xyzCoord.y,xyzCoord.x),asin(xyzCoord.z));float distanceFromMeridian=abs(lonLat.x);clip=distanceFromMeridian>PI_0-radians(1.0);}void stereographic(out vec2 coord,in vec2 lonLat0,in vec2 lonLat,out bool clip){rotate_0(lonLat0,lonLat,clip);clip=false;float cy=cos(lonLat.y);float k=1.0+cos(lonLat.x)*cy;coord.x=cy*sin(lonLat.x)/k;coord.y=sin(lonLat.y)/k;}void forwardProject(out vec2 displayCoord,in vec2 lonLat0,in vec2 lonLat,out bool clip,in float zoom,in int projection){if(projection==0){equirectangular(displayCoord,lonLat0,lonLat,clip);}else if(projection==1){mercator(displayCoord,lonLat0,lonLat,clip);}else if(projection==2){equalEarth(displayCoord,lonLat0,lonLat,clip);}else if(projection==3){orthographic(displayCoord,lonLat0,lonLat,clip);}else if(projection==4){verticalPerspective(displayCoord,lonLat0,lonLat,clip,zoom);}else if(projection==5){stereographic(displayCoord,lonLat0,lonLat,clip);}}const vec4 bitPlaces=vec4(pow(256.0,4.0),pow(256.0,3.0),pow(256.0,2.0),pow(256.0,1.0));float decodeFromRGBA(in vec4 rgba,in float scale,in float off){vec4 integers=floor(255.0*rgba+0.5);return scale*dot(integers,1.0/bitPlaces)+off;}const float MAX_SPEED_1535977339=10000.0;attribute vec2 a_particleIndex;uniform sampler2D u_particleLongitudes;uniform sampler2D u_particleLatitudes;uniform sampler2D u_particleSpeeds;uniform float u_particleCountSqrt;uniform float u_canvasRatio;uniform float u_screenRatio;uniform float u_lon0;uniform float u_lat0;uniform float u_zoom;uniform int u_projection;uniform float u_size;varying float v_clip;varying float v_speed;const float PI_2=radians(90.0);const vec2 DIM=vec2(360.0,180.0);const vec2 DIM_2=vec2(180.0,90.0);void main(){vec2 displayCoord;vec2 lonLat0=radians(vec2(u_lon0,u_lat0));vec2 texCoord=a_particleIndex/u_particleCountSqrt;vec2 lonLat=radians(vec2(decodeFromRGBA(texture2D(u_particleLongitudes,texCoord),DIM.x,-DIM_2.x),decodeFromRGBA(texture2D(u_particleLatitudes,texCoord),DIM.y,-DIM_2.y)));v_speed=decodeFromRGBA(texture2D(u_particleSpeeds,texCoord),MAX_SPEED_1535977339,0.0);bool clip;forwardProject(displayCoord,lonLat0,lonLat,clip,u_zoom,u_projection);if(clip){v_clip=1.0;}else{v_clip=0.0;}displayCoord=u_zoom*displayCoord/PI_2;displayCoord.x=displayCoord.x/u_canvasRatio;gl_PointSize=u_size*u_zoom*u_screenRatio;gl_Position=vec4(displayCoord,0,1);}",mo]),texture:Ue(this._gl,[lo,_o])}}_createSimATexture(){let t={minMag:this._gl.NEAREST,width:Math.sqrt(this._count),height:Math.sqrt(this._count)};return{longitudes:ie(this._gl,{src:wo(yo(this._count),360,-180),...t}),latitudes:ie(this._gl,{src:wo(xo(this._count),180,-90),...t}),lifetimes:ie(this._gl,{src:wo(go(this._lifetime,this._count),this._lifetime,0),...t}),speeds:ie(this._gl,t)}}_createSimBTexture(){let t={minMag:this._gl.NEAREST,width:Math.sqrt(this._count),height:Math.sqrt(this._count)};return{longitudes:ie(this._gl,t),latitudes:ie(this._gl,t),lifetimes:ie(this._gl,t),speeds:ie(this._gl,t)}}_createSimFramebuffers(){let t=Math.sqrt(this._count);return{simA:{longitudes:Qe(this._gl,[{attachment:this._textures.simA.longitudes}],t,t),latitudes:Qe(this._gl,[{attachment:this._textures.simA.latitudes}],t,t),lifetimes:Qe(this._gl,[{attachment:this._textures.simA.lifetimes}],t,t),speeds:Qe(this._gl,[{attachment:this._textures.simA.speeds}],t,t)},simB:{longitudes:Qe(this._gl,[{attachment:this._textures.simB.longitudes}],t,t),latitudes:Qe(this._gl,[{attachment:this._textures.simB.latitudes}],t,t),lifetimes:Qe(this._gl,[{attachment:this._textures.simB.lifetimes}],t,t),speeds:Qe(this._gl,[{attachment:this._textures.simB.speeds}],t,t)}}}}function wo(t,e,o){let r=new Uint32Array(t.length);for(let n=0;n<t.length;n++){let i=(t[n]-o)/e;r[n]=Math.round(Math.pow(256,4)*i)}return new Uint8Array(r.buffer)}class Fo{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){const e=this._partials;let o=0;for(let r=0;r<this._n&&r<32;r++){const n=e[r],i=t+n,a=Math.abs(t)<Math.abs(n)?t-(i-n):n-(i-t);a&&(e[o++]=a),t=i}return e[o]=t,this._n=o+1,this}valueOf(){const t=this._partials;let e,o,r,n=this._n,i=0;if(n>0){for(i=t[--n];n>0&&(e=i,o=t[--n],i=e+o,r=o-(i-e),!r););n>0&&(r<0&&t[n-1]<0||r>0&&t[n-1]>0)&&(o=2*r,e=i+o,o==e-i&&(i=e))}return i}}function Eo(t){return Array.from(function*(t){for(const e of t)yield*e}(t))}var Io=1e-6,So=Math.PI,zo=So/2,To=So/4,Do=2*So,Mo=180/So,Ro=So/180,jo=Math.abs,$o=Math.atan,Bo=Math.atan2,Oo=Math.cos,ko=Math.exp,No=Math.log,Uo=Math.sin,Ho=Math.sign||function(t){return t>0?1:t<0?-1:0},Go=Math.sqrt,Wo=Math.tan;function Vo(t){return t>1?zo:t<-1?-zo:Math.asin(t)}function qo(){}function Xo(t,e){t&&Zo.hasOwnProperty(t.type)&&Zo[t.type](t,e)}var Yo={Feature:function(t,e){Xo(t.geometry,e)},FeatureCollection:function(t,e){for(var o=t.features,r=-1,n=o.length;++r<n;)Xo(o[r].geometry,e)}},Zo={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var o=t.coordinates,r=-1,n=o.length;++r<n;)t=o[r],e.point(t[0],t[1],t[2])},LineString:function(t,e){Ko(t.coordinates,e,0)},MultiLineString:function(t,e){for(var o=t.coordinates,r=-1,n=o.length;++r<n;)Ko(o[r],e,0)},Polygon:function(t,e){Qo(t.coordinates,e)},MultiPolygon:function(t,e){for(var o=t.coordinates,r=-1,n=o.length;++r<n;)Qo(o[r],e)},GeometryCollection:function(t,e){for(var o=t.geometries,r=-1,n=o.length;++r<n;)Xo(o[r],e)}};function Ko(t,e,o){var r,n=-1,i=t.length-o;for(e.lineStart();++n<i;)r=t[n],e.point(r[0],r[1],r[2]);e.lineEnd()}function Qo(t,e){var o=-1,r=t.length;for(e.polygonStart();++o<r;)Ko(t[o],e,1);e.polygonEnd()}function Jo(t,e){t&&Yo.hasOwnProperty(t.type)?Yo[t.type](t,e):Xo(t,e)}function tr(t){return[Bo(t[1],t[0]),Vo(t[2])]}function er(t){var e=t[0],o=t[1],r=Oo(o);return[r*Oo(e),r*Uo(e),Uo(o)]}function or(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function rr(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function nr(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function ir(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function ar(t){var e=Go(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function lr(t,e){function o(o,r){return o=t(o,r),e(o[0],o[1])}return t.invert&&e.invert&&(o.invert=function(o,r){return(o=e.invert(o,r))&&t.invert(o[0],o[1])}),o}function sr(t,e){return[jo(t)>So?t+Math.round(-t/Do)*Do:t,e]}function cr(t,e,o){return(t%=Do)?e||o?lr(fr(t),dr(e,o)):fr(t):e||o?dr(e,o):sr}function ur(t){return function(e,o){return[(e+=t)>So?e-Do:e<-So?e+Do:e,o]}}function fr(t){var e=ur(t);return e.invert=ur(-t),e}function dr(t,e){var o=Oo(t),r=Uo(t),n=Oo(e),i=Uo(e);function a(t,e){var a=Oo(e),l=Oo(t)*a,s=Uo(t)*a,c=Uo(e),u=c*o+l*r;return[Bo(s*n-u*i,l*o-c*r),Vo(u*n+s*i)]}return a.invert=function(t,e){var a=Oo(e),l=Oo(t)*a,s=Uo(t)*a,c=Uo(e),u=c*n-s*i;return[Bo(s*n+c*i,l*o+u*r),Vo(u*o-l*r)]},a}function hr(t,e){(e=er(e))[0]-=t,ar(e);var o,r=(o=-e[1])>1?0:o<-1?So:Math.acos(o);return((-e[2]<0?-r:r)+Do-Io)%Do}function pr(){var t,e=[];return{point:function(e,o,r){t.push([e,o,r])},lineStart:function(){e.push(t=[])},lineEnd:qo,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var o=e;return e=[],t=null,o}}}function mr(t,e){return jo(t[0]-e[0])<Io&&jo(t[1]-e[1])<Io}function _r(t,e,o,r){this.x=t,this.z=e,this.o=o,this.e=r,this.v=!1,this.n=this.p=null}function yr(t,e,o,r,n){var i,a,l=[],s=[];if(t.forEach((function(t){if(!((e=t.length-1)<=0)){var e,o,r=t[0],a=t[e];if(mr(r,a)){if(!r[2]&&!a[2]){for(n.lineStart(),i=0;i<e;++i)n.point((r=t[i])[0],r[1]);return void n.lineEnd()}a[0]+=2e-6}l.push(o=new _r(r,t,null,!0)),s.push(o.o=new _r(r,null,o,!1)),l.push(o=new _r(a,t,null,!1)),s.push(o.o=new _r(a,null,o,!0))}})),l.length){for(s.sort(e),xr(l),xr(s),i=0,a=s.length;i<a;++i)s[i].e=o=!o;for(var c,u,f=l[0];;){for(var d=f,h=!0;d.v;)if((d=d.n)===f)return;c=d.z,n.lineStart();do{if(d.v=d.o.v=!0,d.e){if(h)for(i=0,a=c.length;i<a;++i)n.point((u=c[i])[0],u[1]);else r(d.x,d.n.x,1,n);d=d.n}else{if(h)for(c=d.p.z,i=c.length-1;i>=0;--i)n.point((u=c[i])[0],u[1]);else r(d.x,d.p.x,-1,n);d=d.p}c=(d=d.o).z,h=!h}while(!d.v);n.lineEnd()}}}function xr(t){if(e=t.length){for(var e,o,r=0,n=t[0];++r<e;)n.n=o=t[r],o.p=n,n=o;n.n=o=t[0],o.p=n}}function gr(t){return jo(t[0])<=So?t[0]:Ho(t[0])*((jo(t[0])+So)%Do-So)}function vr(t,e,o,r){return function(n){var i,a,l,s=e(n),c=pr(),u=e(c),f=!1,d={point:h,lineStart:m,lineEnd:_,polygonStart:function(){d.point=y,d.lineStart=x,d.lineEnd=g,a=[],i=[]},polygonEnd:function(){d.point=h,d.lineStart=m,d.lineEnd=_,a=Eo(a);var t=function(t,e){var o=gr(e),r=e[1],n=Uo(r),i=[Uo(o),-Oo(o),0],a=0,l=0,s=new Fo;1===n?r=zo+Io:-1===n&&(r=-zo-Io);for(var c=0,u=t.length;c<u;++c)if(d=(f=t[c]).length)for(var f,d,h=f[d-1],p=gr(h),m=h[1]/2+To,_=Uo(m),y=Oo(m),x=0;x<d;++x,p=v,_=b,y=P,h=g){var g=f[x],v=gr(g),L=g[1]/2+To,b=Uo(L),P=Oo(L),A=v-p,C=A>=0?1:-1,w=C*A,F=w>So,E=_*b;if(s.add(Bo(E*C*Uo(w),y*P+E*Oo(w))),a+=F?A+C*Do:A,F^p>=o^v>=o){var I=rr(er(h),er(g));ar(I);var S=rr(i,I);ar(S);var z=(F^A>=0?-1:1)*Vo(S[2]);(r>z||r===z&&(I[0]||I[1]))&&(l+=F^A>=0?1:-1)}}return(a<-1e-6||a<Io&&s<-1e-12)^1&l}(i,r);a.length?(f||(n.polygonStart(),f=!0),yr(a,br,t,o,n)):t&&(f||(n.polygonStart(),f=!0),n.lineStart(),o(null,null,1,n),n.lineEnd()),f&&(n.polygonEnd(),f=!1),a=i=null},sphere:function(){n.polygonStart(),n.lineStart(),o(null,null,1,n),n.lineEnd(),n.polygonEnd()}};function h(e,o){t(e,o)&&n.point(e,o)}function p(t,e){s.point(t,e)}function m(){d.point=p,s.lineStart()}function _(){d.point=h,s.lineEnd()}function y(t,e){l.push([t,e]),u.point(t,e)}function x(){u.lineStart(),l=[]}function g(){y(l[0][0],l[0][1]),u.lineEnd();var t,e,o,r,s=u.clean(),d=c.result(),h=d.length;if(l.pop(),i.push(l),l=null,h)if(1&s){if((e=(o=d[0]).length-1)>0){for(f||(n.polygonStart(),f=!0),n.lineStart(),t=0;t<e;++t)n.point((r=o[t])[0],r[1]);n.lineEnd()}}else h>1&&2&s&&d.push(d.pop().concat(d.shift())),a.push(d.filter(Lr))}return d}}function Lr(t){return t.length>1}function br(t,e){return((t=t.x)[0]<0?t[1]-zo-Io:zo-t[1])-((e=e.x)[0]<0?e[1]-zo-Io:zo-e[1])}sr.invert=sr;var Pr=vr((function(){return!0}),(function(t){var e,o=NaN,r=NaN,n=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(i,a){var l=i>0?So:-So,s=jo(i-o);jo(s-So)<Io?(t.point(o,r=(r+a)/2>0?zo:-zo),t.point(n,r),t.lineEnd(),t.lineStart(),t.point(l,r),t.point(i,r),e=0):n!==l&&s>=So&&(jo(o-n)<Io&&(o-=n*Io),jo(i-l)<Io&&(i-=l*Io),r=function(t,e,o,r){var n,i,a=Uo(t-o);return jo(a)>Io?$o((Uo(e)*(i=Oo(r))*Uo(o)-Uo(r)*(n=Oo(e))*Uo(t))/(n*i*a)):(e+r)/2}(o,r,i,a),t.point(n,r),t.lineEnd(),t.lineStart(),t.point(l,r),e=0),t.point(o=i,r=a),n=l},lineEnd:function(){t.lineEnd(),o=r=NaN},clean:function(){return 2-e}}}),(function(t,e,o,r){var n;if(null==t)n=o*zo,r.point(-So,n),r.point(0,n),r.point(So,n),r.point(So,0),r.point(So,-n),r.point(0,-n),r.point(-So,-n),r.point(-So,0),r.point(-So,n);else if(jo(t[0]-e[0])>Io){var i=t[0]<e[0]?So:-So;n=o*i/2,r.point(-i,n),r.point(0,n),r.point(i,n)}else r.point(e[0],e[1])}),[-So,-zo]);function Ar(t){var e=Oo(t),o=6*Ro,r=e>0,n=jo(e)>Io;function i(t,o){return Oo(t)*Oo(o)>e}function a(t,o,r){var n=[1,0,0],i=rr(er(t),er(o)),a=or(i,i),l=i[0],s=a-l*l;if(!s)return!r&&t;var c=e*a/s,u=-e*l/s,f=rr(n,i),d=ir(n,c);nr(d,ir(i,u));var h=f,p=or(d,h),m=or(h,h),_=p*p-m*(or(d,d)-1);if(!(_<0)){var y=Go(_),x=ir(h,(-p-y)/m);if(nr(x,d),x=tr(x),!r)return x;var g,v=t[0],L=o[0],b=t[1],P=o[1];L<v&&(g=v,v=L,L=g);var A=L-v,C=jo(A-So)<Io;if(!C&&P<b&&(g=b,b=P,P=g),C||A<Io?C?b+P>0^x[1]<(jo(x[0]-v)<Io?b:P):b<=x[1]&&x[1]<=P:A>So^(v<=x[0]&&x[0]<=L)){var w=ir(h,(-p+y)/m);return nr(w,d),[x,tr(w)]}}}function l(e,o){var n=r?t:So-t,i=0;return e<-n?i|=1:e>n&&(i|=2),o<-n?i|=4:o>n&&(i|=8),i}return vr(i,(function(t){var e,o,s,c,u;return{lineStart:function(){c=s=!1,u=1},point:function(f,d){var h,p=[f,d],m=i(f,d),_=r?m?0:l(f,d):m?l(f+(f<0?So:-So),d):0;if(!e&&(c=s=m)&&t.lineStart(),m!==s&&(!(h=a(e,p))||mr(e,h)||mr(p,h))&&(p[2]=1),m!==s)u=0,m?(t.lineStart(),h=a(p,e),t.point(h[0],h[1])):(h=a(e,p),t.point(h[0],h[1],2),t.lineEnd()),e=h;else if(n&&e&&r^m){var y;_&o||!(y=a(p,e,!0))||(u=0,r?(t.lineStart(),t.point(y[0][0],y[0][1]),t.point(y[1][0],y[1][1]),t.lineEnd()):(t.point(y[1][0],y[1][1]),t.lineEnd(),t.lineStart(),t.point(y[0][0],y[0][1],3)))}!m||e&&mr(e,p)||t.point(p[0],p[1]),e=p,s=m,o=_},lineEnd:function(){s&&t.lineEnd(),e=null},clean:function(){return u|(c&&s)<<1}}}),(function(e,r,n,i){!function(t,e,o,r,n,i){if(o){var a=Oo(e),l=Uo(e),s=r*o;null==n?(n=e+r*Do,i=e-s/2):(n=hr(a,n),i=hr(a,i),(r>0?n<i:n>i)&&(n+=r*Do));for(var c,u=n;r>0?u>i:u<i;u-=s)c=tr([a,-l*Oo(u),-l*Uo(u)]),t.point(c[0],c[1])}}(i,t,o,n,e,r)}),r?[0,-t]:[-So,t-So])}var Cr=1e9,wr=-Cr;function Fr(t,e,o,r){function n(n,i){return t<=n&&n<=o&&e<=i&&i<=r}function i(n,i,l,c){var u=0,f=0;if(null==n||(u=a(n,l))!==(f=a(i,l))||s(n,i)<0^l>0)do{c.point(0===u||3===u?t:o,u>1?r:e)}while((u=(u+l+4)%4)!==f);else c.point(i[0],i[1])}function a(r,n){return jo(r[0]-t)<Io?n>0?0:3:jo(r[0]-o)<Io?n>0?2:1:jo(r[1]-e)<Io?n>0?1:0:n>0?3:2}function l(t,e){return s(t.x,e.x)}function s(t,e){var o=a(t,1),r=a(e,1);return o!==r?o-r:0===o?e[1]-t[1]:1===o?t[0]-e[0]:2===o?t[1]-e[1]:e[0]-t[0]}return function(a){var s,c,u,f,d,h,p,m,_,y,x,g=a,v=pr(),L={point:b,lineStart:function(){L.point=P,c&&c.push(u=[]);y=!0,_=!1,p=m=NaN},lineEnd:function(){s&&(P(f,d),h&&_&&v.rejoin(),s.push(v.result()));L.point=b,_&&g.lineEnd()},polygonStart:function(){g=v,s=[],c=[],x=!0},polygonEnd:function(){var e=function(){for(var e=0,o=0,n=c.length;o<n;++o)for(var i,a,l=c[o],s=1,u=l.length,f=l[0],d=f[0],h=f[1];s<u;++s)i=d,a=h,d=(f=l[s])[0],h=f[1],a<=r?h>r&&(d-i)*(r-a)>(h-a)*(t-i)&&++e:h<=r&&(d-i)*(r-a)<(h-a)*(t-i)&&--e;return e}(),o=x&&e,n=(s=Eo(s)).length;(o||n)&&(a.polygonStart(),o&&(a.lineStart(),i(null,null,1,a),a.lineEnd()),n&&yr(s,l,e,i,a),a.polygonEnd());g=a,s=c=u=null}};function b(t,e){n(t,e)&&g.point(t,e)}function P(i,a){var l=n(i,a);if(c&&u.push([i,a]),y)f=i,d=a,h=l,y=!1,l&&(g.lineStart(),g.point(i,a));else if(l&&_)g.point(i,a);else{var s=[p=Math.max(wr,Math.min(Cr,p)),m=Math.max(wr,Math.min(Cr,m))],v=[i=Math.max(wr,Math.min(Cr,i)),a=Math.max(wr,Math.min(Cr,a))];!function(t,e,o,r,n,i){var a,l=t[0],s=t[1],c=0,u=1,f=e[0]-l,d=e[1]-s;if(a=o-l,f||!(a>0)){if(a/=f,f<0){if(a<c)return;a<u&&(u=a)}else if(f>0){if(a>u)return;a>c&&(c=a)}if(a=n-l,f||!(a<0)){if(a/=f,f<0){if(a>u)return;a>c&&(c=a)}else if(f>0){if(a<c)return;a<u&&(u=a)}if(a=r-s,d||!(a>0)){if(a/=d,d<0){if(a<c)return;a<u&&(u=a)}else if(d>0){if(a>u)return;a>c&&(c=a)}if(a=i-s,d||!(a<0)){if(a/=d,d<0){if(a>u)return;a>c&&(c=a)}else if(d>0){if(a<c)return;a<u&&(u=a)}return c>0&&(t[0]=l+c*f,t[1]=s+c*d),u<1&&(e[0]=l+u*f,e[1]=s+u*d),!0}}}}}(s,v,t,e,o,r)?l&&(g.lineStart(),g.point(i,a),x=!1):(_||(g.lineStart(),g.point(s[0],s[1])),g.point(v[0],v[1]),l||g.lineEnd(),x=!1)}p=i,m=a,_=l}return L}}var Er,Ir,Sr,zr,Tr=t=>t,Dr=new Fo,Mr=new Fo,Rr={point:qo,lineStart:qo,lineEnd:qo,polygonStart:function(){Rr.lineStart=jr,Rr.lineEnd=Or},polygonEnd:function(){Rr.lineStart=Rr.lineEnd=Rr.point=qo,Dr.add(jo(Mr)),Mr=new Fo},result:function(){var t=Dr/2;return Dr=new Fo,t}};function jr(){Rr.point=$r}function $r(t,e){Rr.point=Br,Er=Sr=t,Ir=zr=e}function Br(t,e){Mr.add(zr*t-Sr*e),Sr=t,zr=e}function Or(){Br(Er,Ir)}var kr=1/0,Nr=kr,Ur=-kr,Hr=Ur,Gr={point:function(t,e){t<kr&&(kr=t);t>Ur&&(Ur=t);e<Nr&&(Nr=e);e>Hr&&(Hr=e)},lineStart:qo,lineEnd:qo,polygonStart:qo,polygonEnd:qo,result:function(){var t=[[kr,Nr],[Ur,Hr]];return Ur=Hr=-(Nr=kr=1/0),t}};var Wr,Vr,qr,Xr,Yr=0,Zr=0,Kr=0,Qr=0,Jr=0,tn=0,en=0,on=0,rn=0,nn={point:an,lineStart:ln,lineEnd:un,polygonStart:function(){nn.lineStart=fn,nn.lineEnd=dn},polygonEnd:function(){nn.point=an,nn.lineStart=ln,nn.lineEnd=un},result:function(){var t=rn?[en/rn,on/rn]:tn?[Qr/tn,Jr/tn]:Kr?[Yr/Kr,Zr/Kr]:[NaN,NaN];return Yr=Zr=Kr=Qr=Jr=tn=en=on=rn=0,t}};function an(t,e){Yr+=t,Zr+=e,++Kr}function ln(){nn.point=sn}function sn(t,e){nn.point=cn,an(qr=t,Xr=e)}function cn(t,e){var o=t-qr,r=e-Xr,n=Go(o*o+r*r);Qr+=n*(qr+t)/2,Jr+=n*(Xr+e)/2,tn+=n,an(qr=t,Xr=e)}function un(){nn.point=an}function fn(){nn.point=hn}function dn(){pn(Wr,Vr)}function hn(t,e){nn.point=pn,an(Wr=qr=t,Vr=Xr=e)}function pn(t,e){var o=t-qr,r=e-Xr,n=Go(o*o+r*r);Qr+=n*(qr+t)/2,Jr+=n*(Xr+e)/2,tn+=n,en+=(n=Xr*t-qr*e)*(qr+t),on+=n*(Xr+e),rn+=3*n,an(qr=t,Xr=e)}function mn(t){this._context=t}mn.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,Do)}},result:qo};var _n,yn,xn,gn,vn,Ln=new Fo,bn={point:qo,lineStart:function(){bn.point=Pn},lineEnd:function(){_n&&An(yn,xn),bn.point=qo},polygonStart:function(){_n=!0},polygonEnd:function(){_n=null},result:function(){var t=+Ln;return Ln=new Fo,t}};function Pn(t,e){bn.point=An,yn=gn=t,xn=vn=e}function An(t,e){gn-=t,vn-=e,Ln.add(Go(gn*gn+vn*vn)),gn=t,vn=e}function Cn(){this._string=[]}function wn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Fn(t){return function(e){var o=new En;for(var r in t)o[r]=t[r];return o.stream=e,o}}function En(){}function In(t,e,o){var r=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=r&&t.clipExtent(null),Jo(o,t.stream(Gr)),e(Gr.result()),null!=r&&t.clipExtent(r),t}function Sn(t,e,o){return In(t,(function(o){var r=e[1][0]-e[0][0],n=e[1][1]-e[0][1],i=Math.min(r/(o[1][0]-o[0][0]),n/(o[1][1]-o[0][1])),a=+e[0][0]+(r-i*(o[1][0]+o[0][0]))/2,l=+e[0][1]+(n-i*(o[1][1]+o[0][1]))/2;t.scale(150*i).translate([a,l])}),o)}Cn.prototype={_radius:4.5,_circle:wn(4.5),pointRadius:function(t){return(t=+t)!==this._radius&&(this._radius=t,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._string.push("M",t,",",e),this._point=1;break;case 1:this._string.push("L",t,",",e);break;default:null==this._circle&&(this._circle=wn(this._radius)),this._string.push("M",t,",",e,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}},En.prototype={constructor:En,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var zn=Oo(30*Ro);function Tn(t,e){return+e?function(t,e){function o(r,n,i,a,l,s,c,u,f,d,h,p,m,_){var y=c-r,x=u-n,g=y*y+x*x;if(g>4*e&&m--){var v=a+d,L=l+h,b=s+p,P=Go(v*v+L*L+b*b),A=Vo(b/=P),C=jo(jo(b)-1)<Io||jo(i-f)<Io?(i+f)/2:Bo(L,v),w=t(C,A),F=w[0],E=w[1],I=F-r,S=E-n,z=x*I-y*S;(z*z/g>e||jo((y*I+x*S)/g-.5)>.3||a*d+l*h+s*p<zn)&&(o(r,n,i,a,l,s,F,E,C,v/=P,L/=P,b,m,_),_.point(F,E),o(F,E,C,v,L,b,c,u,f,d,h,p,m,_))}}return function(e){var r,n,i,a,l,s,c,u,f,d,h,p,m={point:_,lineStart:y,lineEnd:g,polygonStart:function(){e.polygonStart(),m.lineStart=v},polygonEnd:function(){e.polygonEnd(),m.lineStart=y}};function _(o,r){o=t(o,r),e.point(o[0],o[1])}function y(){u=NaN,m.point=x,e.lineStart()}function x(r,n){var i=er([r,n]),a=t(r,n);o(u,f,c,d,h,p,u=a[0],f=a[1],c=r,d=i[0],h=i[1],p=i[2],16,e),e.point(u,f)}function g(){m.point=_,e.lineEnd()}function v(){y(),m.point=L,m.lineEnd=b}function L(t,e){x(r=t,e),n=u,i=f,a=d,l=h,s=p,m.point=x}function b(){o(u,f,c,d,h,p,n,i,r,a,l,s,16,e),m.lineEnd=g,g()}return m}}(t,e):function(t){return Fn({point:function(e,o){e=t(e,o),this.stream.point(e[0],e[1])}})}(t)}var Dn=Fn({point:function(t,e){this.stream.point(t*Ro,e*Ro)}});function Mn(t,e,o,r,n,i){if(!i)return function(t,e,o,r,n){function i(i,a){return[e+t*(i*=r),o-t*(a*=n)]}return i.invert=function(i,a){return[(i-e)/t*r,(o-a)/t*n]},i}(t,e,o,r,n);var a=Oo(i),l=Uo(i),s=a*t,c=l*t,u=a/t,f=l/t,d=(l*o-a*e)/t,h=(l*e+a*o)/t;function p(t,i){return[s*(t*=r)-c*(i*=n)+e,o-c*t-s*i]}return p.invert=function(t,e){return[r*(u*t-f*e+d),n*(h-f*t-u*e)]},p}function Rn(t){return jn((function(){return t}))()}function jn(t){var e,o,r,n,i,a,l,s,c,u,f=150,d=480,h=250,p=0,m=0,_=0,y=0,x=0,g=0,v=1,L=1,b=null,P=Pr,A=null,C=Tr,w=.5;function F(t){return s(t[0]*Ro,t[1]*Ro)}function E(t){return(t=s.invert(t[0],t[1]))&&[t[0]*Mo,t[1]*Mo]}function I(){var t=Mn(f,0,0,v,L,g).apply(null,e(p,m)),r=Mn(f,d-t[0],h-t[1],v,L,g);return o=cr(_,y,x),l=lr(e,r),s=lr(o,l),a=Tn(l,w),S()}function S(){return c=u=null,F}return F.stream=function(t){return c&&u===t?c:c=Dn(function(t){return Fn({point:function(e,o){var r=t(e,o);return this.stream.point(r[0],r[1])}})}(o)(P(a(C(u=t)))))},F.preclip=function(t){return arguments.length?(P=t,b=void 0,S()):P},F.postclip=function(t){return arguments.length?(C=t,A=r=n=i=null,S()):C},F.clipAngle=function(t){return arguments.length?(P=+t?Ar(b=t*Ro):(b=null,Pr),S()):b*Mo},F.clipExtent=function(t){return arguments.length?(C=null==t?(A=r=n=i=null,Tr):Fr(A=+t[0][0],r=+t[0][1],n=+t[1][0],i=+t[1][1]),S()):null==A?null:[[A,r],[n,i]]},F.scale=function(t){return arguments.length?(f=+t,I()):f},F.translate=function(t){return arguments.length?(d=+t[0],h=+t[1],I()):[d,h]},F.center=function(t){return arguments.length?(p=t[0]%360*Ro,m=t[1]%360*Ro,I()):[p*Mo,m*Mo]},F.rotate=function(t){return arguments.length?(_=t[0]%360*Ro,y=t[1]%360*Ro,x=t.length>2?t[2]%360*Ro:0,I()):[_*Mo,y*Mo,x*Mo]},F.angle=function(t){return arguments.length?(g=t%360*Ro,I()):g*Mo},F.reflectX=function(t){return arguments.length?(v=t?-1:1,I()):v<0},F.reflectY=function(t){return arguments.length?(L=t?-1:1,I()):L<0},F.precision=function(t){return arguments.length?(a=Tn(l,w=t*t),S()):Go(w)},F.fitExtent=function(t,e){return Sn(F,t,e)},F.fitSize=function(t,e){return function(t,e,o){return Sn(t,[[0,0],e],o)}(F,t,e)},F.fitWidth=function(t,e){return function(t,e,o){return In(t,(function(o){var r=+e,n=r/(o[1][0]-o[0][0]),i=(r-n*(o[1][0]+o[0][0]))/2,a=-n*o[0][1];t.scale(150*n).translate([i,a])}),o)}(F,t,e)},F.fitHeight=function(t,e){return function(t,e,o){return In(t,(function(o){var r=+e,n=r/(o[1][1]-o[0][1]),i=-n*o[0][0],a=(r-n*(o[1][1]+o[0][1]))/2;t.scale(150*n).translate([i,a])}),o)}(F,t,e)},function(){return e=t.apply(this,arguments),F.invert=e.invert&&E,I()}}function $n(t){return function(e,o){var r=Go(e*e+o*o),n=t(r),i=Uo(n),a=Oo(n);return[Bo(e*i,r*a),Vo(r&&o*i/r)]}}function Bn(t,e){return[t,No(Wo((zo+e)/2))]}function On(t,e){return[t,e]}Bn.invert=function(t,e){return[t,2*$o(ko(e))-zo]},On.invert=On;var kn=1.340264,Nn=-.081106,Un=893e-6,Hn=.003796,Gn=Go(3)/2;function Wn(t,e){var o=Vo(Gn*Uo(e)),r=o*o,n=r*r*r;return[t*Oo(o)/(Gn*(kn+3*Nn*r+n*(7*Un+9*Hn*r))),o*(kn+Nn*r+n*(Un+Hn*r))]}function Vn(t,e){return[Oo(e)*Uo(t),Uo(e)]}function qn(t,e){var o=Oo(e),r=1+Oo(t)*o;return[o*Uo(t)/r,Uo(e)/r]}Wn.invert=function(t,e){for(var o,r=e,n=r*r,i=n*n*n,a=0;a<12&&(i=(n=(r-=o=(r*(kn+Nn*n+i*(Un+Hn*n))-e)/(kn+3*Nn*n+i*(7*Un+9*Hn*n)))*r)*n*n,!(jo(o)<1e-12));++a);return[Gn*t*(kn+3*Nn*n+i*(7*Un+9*Hn*n))/Oo(r),Vo(Uo(r)/Gn)]},Vn.invert=$n(Vo),qn.invert=$n((function(t){return 2*$o(t)}));var Xn=Math.atan2,Yn=Math.cos,Zn=Math.sin,Kn=1e-6,Qn=Math.PI,Jn=Qn/2,ti=180/Qn,ei=Qn/180;function oi(t){return t>1?Jn:t<-1?-Jn:Math.asin(t)}function ri(t){return t>1?0:t<-1?Qn:Math.acos(t)}function ni(t){return t>0?Math.sqrt(t):0}function ii(t,e){var o=function(t){function e(e,o){var r=Yn(o),n=(t-1)/(t-r*Yn(e));return[n*r*Zn(e),n*Zn(o)]}return e.invert=function(e,o){var r=e*e+o*o,n=ni(r),i=(t-ni(1-r*(t+1)/(t-1)))/((t-1)/n+n/(t-1));return[Xn(e*i,n*ni(1-i*i)),n?oi(o*i/n):0]},e}(t);if(!e)return o;var r=Yn(e),n=Zn(e);function i(e,i){var a=o(e,i),l=a[1],s=l*n/(t-1)+r;return[a[0]*r/s,l/s]}return i.invert=function(e,i){var a=(t-1)/(t-1-i*n);return o.invert(a*e,a*i*r)},i}var ai,li,si,ci,ui=Object.freeze({EQUIRECTANGULAR:{name:"equirectangular",id:0,function:Rn(On).scale(152.63)},MERCATOR:{name:"Mercator",id:1,function:function(t){var e,o,r,n=Rn(t),i=n.center,a=n.scale,l=n.translate,s=n.clipExtent,c=null;function u(){var i=So*a(),l=n(function(t){function e(e){return(e=t(e[0]*Ro,e[1]*Ro))[0]*=Mo,e[1]*=Mo,e}return t=cr(t[0]*Ro,t[1]*Ro,t.length>2?t[2]*Ro:0),e.invert=function(e){return(e=t.invert(e[0]*Ro,e[1]*Ro))[0]*=Mo,e[1]*=Mo,e},e}(n.rotate()).invert([0,0]));return s(null==c?[[l[0]-i,l[1]-i],[l[0]+i,l[1]+i]]:t===Bn?[[Math.max(l[0]-i,c),e],[Math.min(l[0]+i,o),r]]:[[c,Math.max(l[1]-i,e)],[o,Math.min(l[1]+i,r)]])}return n.scale=function(t){return arguments.length?(a(t),u()):a()},n.translate=function(t){return arguments.length?(l(t),u()):l()},n.center=function(t){return arguments.length?(i(t),u()):i()},n.clipExtent=function(t){return arguments.length?(null==t?c=e=o=r=null:(c=+t[0][0],e=+t[0][1],o=+t[1][0],r=+t[1][1]),u()):null==c?null:[[c,e],[o,r]]},u()}(Bn).scale(961/Do)},EQUAL_EARTH:{name:"Equal Earth",id:2,function:Rn(Wn).scale(177.158)},ORTHOGRAPHIC:{name:"orthographic",id:3,function:Rn(Vn).scale(249.5).clipAngle(90.000001)},VERTICAL_PERSPECTIVE:{name:"vertical perspective",id:4,function:(ai=2,li=0,si=jn(ii),ci=si(ai,li),ci.distance=function(t){return arguments.length?si(ai=+t,li).clipAngle(ri(1/ai)*ti-Kn):ai},ci.tilt=function(t){return arguments.length?si(ai,li=t*ei):li*ti},ci.scale(432.147).clipAngle(ri(1/ai)*ti-Kn))},STEREOGRAPHIC:{name:"stereographic",id:5,function:Rn(qn).scale(250).clipAngle(142).clipAngle(null),particleSizeFactor:.5}});function fi(t,e){return!function(t,e){var o,r,n=4.5;function i(t){return t&&("function"==typeof n&&r.pointRadius(+n.apply(this,arguments)),Jo(t,o(r))),r.result()}return i.area=function(t){return Jo(t,o(Rr)),Rr.result()},i.measure=function(t){return Jo(t,o(bn)),bn.result()},i.bounds=function(t){return Jo(t,o(Gr)),Gr.result()},i.centroid=function(t){return Jo(t,o(nn)),nn.result()},i.projection=function(e){return arguments.length?(o=null==e?(t=null,Tr):(t=e).stream,i):t},i.context=function(t){return arguments.length?(r=null==t?(e=null,new Cn):new mn(e=t),"function"!=typeof n&&r.pointRadius(n),i):e},i.pointRadius=function(t){return arguments.length?(n="function"==typeof t?t:(r.pointRadius(+t),+t),i):n},i.projection(t).context(e)}(t)({type:"Point",coordinates:e})}var di=Object.freeze({GFS:{id:0,function:(t,e)=>{const o=t.width/360,r=(t.height-1)/180,n=Math.round((e[0]+360)*o)%t.width;return Math.round((e[1]+90)*r)*t.width+n}},RTGSSTHR:{id:1,function:(t,e)=>{const o=t.width/360,r=t.height/180,n=Math.floor((e[0]+360)*o)%t.width;return Math.min(Math.floor((e[1]+90)*r),t.height-1)*t.width+n}},OSCAR:{id:2,function:(t,e)=>{const o=(t.width-1)/400,r=(t.height-1)/160,n=Math.round((e[0]+340)*o)%(360*o);return Math.round((80-e[1])*r)*t.width+n}},GEOS:{id:3,function:(t,e)=>{const o=t.width/360,r=(t.height-1)/180,n=Math.round((e[0]+540)*o)%t.width;return Math.round((e[1]+90)*r)*t.width+n}}});const hi=new ArrayBuffer(4),pi=new Float32Array(hi),mi=new Uint32Array(hi),_i=new Uint32Array(512),yi=new Uint32Array(512);for(let t=0;t<256;++t){const e=t-127;e<-27?(_i[0|t]=0,_i[256|t]=32768,yi[0|t]=24,yi[256|t]=24):e<-14?(_i[0|t]=1024>>-e-14,_i[256|t]=1024>>-e-14|32768,yi[0|t]=-e-1,yi[256|t]=-e-1):e<=15?(_i[0|t]=e+15<<10,_i[256|t]=e+15<<10|32768,yi[0|t]=13,yi[256|t]=13):e<128?(_i[0|t]=31744,_i[256|t]=64512,yi[0|t]=24,yi[256|t]=24):(_i[0|t]=31744,_i[256|t]=64512,yi[0|t]=13,yi[256|t]=13)}function xi(t){pi[0]=t;const e=mi[0],o=e>>23&511;return _i[o]+((8388607&e)>>yi[o])}const gi=new Uint32Array(2048),vi=new Uint32Array(64),Li=new Uint32Array(64);gi[0]=0;for(let t=1;t<1024;++t){let e=t<<13,o=0;for(;0==(8388608&e);)o-=8388608,e<<=1;e&=-8388609,o+=947912704,gi[t]=e|o}for(let t=1024;t<2048;++t)gi[t]=939524096+(t-1024<<13);vi[0]=0;for(let t=1;t<31;++t)vi[t]=t<<23;vi[31]=1199570944,vi[32]=2147483648;for(let t=33;t<63;++t)vi[t]=2147483648+(t-32<<23);vi[63]=3347054592,Li[0]=0;for(let t=1;t<64;++t)Li[t]=32===t?0:1024;function bi(t){const e=t>>10;return mi[0]=gi[Li[e]+(1023&t)]+vi[e],pi[0]}var Pi="object"==typeof global&&global&&global.Object===Object&&global,Ai="object"==typeof self&&self&&self.Object===Object&&self,Ci=Pi||Ai||Function("return this")(),wi=Ci.Symbol,Fi=Object.prototype,Ei=Fi.hasOwnProperty,Ii=Fi.toString,Si=wi?wi.toStringTag:void 0;var zi=Object.prototype.toString;var Ti=wi?wi.toStringTag:void 0;function Di(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":Ti&&Ti in Object(t)?function(t){var e=Ei.call(t,Si),o=t[Si];try{t[Si]=void 0;var r=!0}catch(t){}var n=Ii.call(t);return r&&(e?t[Si]=o:delete t[Si]),n}(t):function(t){return zi.call(t)}(t)}function Mi(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}var Ri,ji=Ci["__core-js_shared__"],$i=(Ri=/[^.]+$/.exec(ji&&ji.keys&&ji.keys.IE_PROTO||""))?"Symbol(src)_1."+Ri:"";var Bi=Function.prototype.toString;var Oi=/^\[object .+?Constructor\]$/,ki=Function.prototype,Ni=Object.prototype,Ui=ki.toString,Hi=Ni.hasOwnProperty,Gi=RegExp("^"+Ui.call(Hi).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Wi(t){return!(!Mi(t)||(e=t,$i&&$i in e))&&(function(t){if(!Mi(t))return!1;var e=Di(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}(t)?Gi:Oi).test(function(t){if(null!=t){try{return Bi.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t));var e}function Vi(t,e){var o=function(t,e){return null==t?void 0:t[e]}(t,e);return Wi(o)?o:void 0}var qi=Vi(Object,"create");var Xi=Object.prototype.hasOwnProperty;var Yi=Object.prototype.hasOwnProperty;function Zi(t){var e=-1,o=null==t?0:t.length;for(this.clear();++e<o;){var r=t[e];this.set(r[0],r[1])}}function Ki(t,e){for(var o,r,n=t.length;n--;)if((o=t[n][0])===(r=e)||o!=o&&r!=r)return n;return-1}Zi.prototype.clear=function(){this.__data__=qi?qi(null):{},this.size=0},Zi.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},Zi.prototype.get=function(t){var e=this.__data__;if(qi){var o=e[t];return"__lodash_hash_undefined__"===o?void 0:o}return Xi.call(e,t)?e[t]:void 0},Zi.prototype.has=function(t){var e=this.__data__;return qi?void 0!==e[t]:Yi.call(e,t)},Zi.prototype.set=function(t,e){var o=this.__data__;return this.size+=this.has(t)?0:1,o[t]=qi&&void 0===e?"__lodash_hash_undefined__":e,this};var Qi=Array.prototype.splice;function Ji(t){var e=-1,o=null==t?0:t.length;for(this.clear();++e<o;){var r=t[e];this.set(r[0],r[1])}}Ji.prototype.clear=function(){this.__data__=[],this.size=0},Ji.prototype.delete=function(t){var e=this.__data__,o=Ki(e,t);return!(o<0)&&(o==e.length-1?e.pop():Qi.call(e,o,1),--this.size,!0)},Ji.prototype.get=function(t){var e=this.__data__,o=Ki(e,t);return o<0?void 0:e[o][1]},Ji.prototype.has=function(t){return Ki(this.__data__,t)>-1},Ji.prototype.set=function(t,e){var o=this.__data__,r=Ki(o,t);return r<0?(++this.size,o.push([t,e])):o[r][1]=e,this};var ta=Vi(Ci,"Map");function ea(t,e){var o,r,n=t.__data__;return("string"==(r=typeof(o=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==o:null===o)?n["string"==typeof e?"string":"hash"]:n.map}function oa(t){var e=-1,o=null==t?0:t.length;for(this.clear();++e<o;){var r=t[e];this.set(r[0],r[1])}}oa.prototype.clear=function(){this.size=0,this.__data__={hash:new Zi,map:new(ta||Ji),string:new Zi}},oa.prototype.delete=function(t){var e=ea(this,t).delete(t);return this.size-=e?1:0,e},oa.prototype.get=function(t){return ea(this,t).get(t)},oa.prototype.has=function(t){return ea(this,t).has(t)},oa.prototype.set=function(t,e){var o=ea(this,t),r=o.size;return o.set(t,e),this.size+=o.size==r?0:1,this};function ra(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var o=function(){var r=arguments,n=e?e.apply(this,r):r[0],i=o.cache;if(i.has(n))return i.get(n);var a=t.apply(this,r);return o.cache=i.set(n,a)||i,a};return o.cache=new(ra.Cache||oa),o}ra.Cache=oa;const na=Object.getOwnPropertyDescriptor(new Uint8Array(1),0).writable;function ia(t){let e="number"!=typeof t?Number(t):t;return Number.isNaN(e)&&(e=0),Math.trunc(e)}function aa(t,e){const[o,r]=[Number.isNaN(t),Number.isNaN(e)];if(o&&r)return 0;if(o)return 1;if(r)return-1;if(t<e)return-1;if(t>e)return 1;if(0===t&&0===e){const[o,r]=[Object.is(t,0),Object.is(e,0)];if(!o&&r)return-1;if(o&&!r)return 1}return 0}var la,sa="object"==typeof exports&&exports&&!exports.nodeType&&exports,ca=sa&&"object"==typeof module&&module&&!module.nodeType&&module,ua=ca&&ca.exports===sa&&Pi.process,fa=function(){try{var t=ca&&ca.require&&ca.require("util").types;return t||ua&&ua.binding&&ua.binding("util")}catch(t){}}(),da=fa&&fa.isArrayBuffer,ha=da?(la=da,function(t){return la(t)}):function(t){return function(t){return null!=t&&"object"==typeof t}(t)&&"[object ArrayBuffer]"==Di(t)};function pa(t){return"string"==typeof t&&t===ia(t)+""}const ma=function(){const t=new WeakMap;return e=>{let o=t.get(e);return o||(o=Object.create(null),t.set(e,o),o)}}();function _a(t){return t instanceof La}function ya(t){if(!_a(t))throw new TypeError("This is not a Float16Array")}function xa(t){const e=t.length,o=new Array(e);for(let r=0;r<e;++r)o[r]=bi(t[r]);return o}const ga={apply(t,e,o){return _a(e)&&("function"==typeof(r=t)&&Pa.has(r))?Reflect.apply(t,ma(e).target,o):Reflect.apply(t,e,o);var r}},va={get(t,e){let o=null;if(na||(o=t,t=ma(o).target),pa(e))return Reflect.has(t,e)?bi(Reflect.get(t,e)):void 0;{const r=null!==o&&Reflect.has(o,e)?Reflect.get(o,e):Reflect.get(t,e);if("function"!=typeof r)return r;let n=ma(r).proxy;return void 0===n&&(n=ma(r).proxy=new Proxy(r,ga)),n}},set(t,e,o){let r=null;return na||(r=t,t=ma(r).target),pa(e)?Reflect.set(t,e,xi(o)):null===r||Reflect.has(t,e)&&!Object.isFrozen(r)?Reflect.set(t,e,o):Reflect.set(r,e,o)}};na||(va.getPrototypeOf=t=>Reflect.getPrototypeOf(ma(t).target),va.setPrototypeOf=(t,e)=>Reflect.setPrototypeOf(ma(t).target,e),va.defineProperty=(t,e,o)=>{const r=ma(t).target;return!Reflect.has(r,e)||Object.isFrozen(t)?Reflect.defineProperty(t,e,o):Reflect.defineProperty(r,e,o)},va.deleteProperty=(t,e)=>{const o=ma(t).target;return Reflect.has(t,e)?Reflect.deleteProperty(t,e):Reflect.deleteProperty(o,e)},va.has=(t,e)=>Reflect.has(t,e)||Reflect.has(ma(t).target,e),va.isExtensible=t=>Reflect.isExtensible(t),va.preventExtensions=t=>Reflect.preventExtensions(t),va.getOwnPropertyDescriptor=(t,e)=>Reflect.getOwnPropertyDescriptor(t,e),va.ownKeys=t=>Reflect.ownKeys(t));class La extends Uint16Array{constructor(t,e,o){if(_a(t))super(ma(t).target);else if(null===t||"object"!=typeof t||ha(t))switch(arguments.length){case 0:super();break;case 1:super(t);break;case 2:super(t,e);break;case 3:super(t,e,o);break;default:super(...arguments)}else{const e=Reflect.has(t,"length")||void 0===t[Symbol.iterator]?t:[...t],o=e.length;super(o);for(let t=0;t<o;++t)this[t]=xi(e[t])}let r;if(na)r=new Proxy(this,va);else{const t=Object.create(null);ma(t).target=this,r=new Proxy(t,va)}return ma(r).target=this,ma(this).proxy=r,r}static from(t,...e){if(0===e.length)return new La(Uint16Array.from(t,xi).buffer);const o=e[0],r=e[1];return new La(Uint16Array.from(t,(function(t,...e){return xi(o.call(this,t,...e))}),r).buffer)}static of(...t){return new La(t)}*[Symbol.iterator](){for(const t of super[Symbol.iterator]())yield bi(t)}keys(){return super.keys()}*values(){for(const t of super.values())yield bi(t)}*entries(){for(const[t,e]of super.entries())yield[t,bi(e)]}map(t,...e){ya(this);const o=e[0],r=[];for(let e=0,n=this.length;e<n;++e){const n=bi(this[e]);r.push(t.call(o,n,e,ma(this).proxy))}return new La(r)}filter(t,...e){ya(this);const o=e[0],r=[];for(let e=0,n=this.length;e<n;++e){const n=bi(this[e]);t.call(o,n,e,ma(this).proxy)&&r.push(n)}return new La(r)}reduce(t,...e){let o,r;ya(this),0===e.length?(o=bi(this[0]),r=1):(o=e[0],r=0);for(let e=r,n=this.length;e<n;++e)o=t(o,bi(this[e]),e,ma(this).proxy);return o}reduceRight(t,...e){let o,r;ya(this);const n=this.length;0===e.length?(o=bi(this[n-1]),r=n-1):(o=e[0],r=n);for(let e=r;e--;)o=t(o,bi(this[e]),e,ma(this).proxy);return o}forEach(t,...e){ya(this);const o=e[0];for(let e=0,r=this.length;e<r;++e)t.call(o,bi(this[e]),e,ma(this).proxy)}find(t,...e){ya(this);const o=e[0];for(let e=0,r=this.length;e<r;++e){const r=bi(this[e]);if(t.call(o,r,e,ma(this).proxy))return r}}findIndex(t,...e){ya(this);const o=e[0];for(let e=0,r=this.length;e<r;++e){const r=bi(this[e]);if(t.call(o,r,e,ma(this).proxy))return e}return-1}every(t,...e){ya(this);const o=e[0];for(let e=0,r=this.length;e<r;++e)if(!t.call(o,bi(this[e]),e,ma(this).proxy))return!1;return!0}some(t,...e){ya(this);const o=e[0];for(let e=0,r=this.length;e<r;++e)if(t.call(o,bi(this[e]),e,ma(this).proxy))return!0;return!1}set(t,...e){ya(this);const o=e[0];let r;if(_a(t))r=ma(t).target;else{const e=Reflect.has(t,"length")||void 0===t[Symbol.iterator]?t:[...t],o=e.length;r=new Uint16Array(o);for(let t=0,o=e.length;t<o;++t)r[t]=xi(e[t])}super.set(r,o)}reverse(){return ya(this),super.reverse(),ma(this).proxy}fill(t,...e){return ya(this),super.fill(xi(t),...e),ma(this).proxy}copyWithin(t,e,...o){return ya(this),super.copyWithin(t,e,...o),ma(this).proxy}sort(...t){ya(this);let e=t[0];void 0===e&&(e=aa);const o=ra(bi);return super.sort(((t,r)=>e(o(t),o(r)))),ma(this).proxy}slice(...t){let e;ya(this);try{e=super.slice(...t)}catch(o){if(!(o instanceof TypeError))throw o;e=new Uint16Array(this.buffer,this.byteOffset,this.length).slice(...t)}return new La(e.buffer)}subarray(...t){let e;ya(this);try{e=super.subarray(...t)}catch(o){if(!(o instanceof TypeError))throw o;e=new Uint16Array(this.buffer,this.byteOffset,this.length).subarray(...t)}return new La(e.buffer,e.byteOffset,e.length)}indexOf(t,...e){ya(this);const o=this.length;let r=ia(e[0]);r<0&&(r+=o,r<0&&(r=0));for(let e=r,n=o;e<n;++e)if(bi(this[e])===t)return e;return-1}lastIndexOf(t,...e){ya(this);const o=this.length;let r=ia(e[0]);r=0===r?o:r+1,r>=0?r=r<o?r:o:r+=o;for(let e=r;e--;)if(bi(this[e])===t)return e;return-1}includes(t,...e){ya(this);const o=this.length;let r=ia(e[0]);r<0&&(r+=o,r<0&&(r=0));const n=Number.isNaN(t);for(let e=r,i=o;e<i;++e){const o=bi(this[e]);if(n&&Number.isNaN(o))return!0;if(o===t)return!0}return!1}join(...t){ya(this);return xa(this).join(...t)}toLocaleString(...t){ya(this);return xa(this).toLocaleString(...t)}get[Symbol.toStringTag](){if(_a(this))return"Float16Array"}}const ba=La.prototype,Pa=new WeakSet;for(const t of Reflect.ownKeys(ba)){const e=ba[t];"function"==typeof e&&Pa.add(e)}function Aa(e){let o,r,n,i,d,h,p,m,_,y,x,g;return{c(){o=c("div"),r=c("canvas"),n=u(),i=c("canvas"),d=u(),h=c("slot"),p=u(),m=c("canvas"),_=u(),y=c("canvas"),x=u(),g=c("slot"),this.c=t,r.hidden=!0,i.hidden=!0,f(h,"name","background"),f(o,"class","layers")},m(t,s){l(t,o,s),a(o,r),e[33](r),a(o,n),a(o,i),e[34](i),a(o,d),a(o,h),a(o,p),a(o,m),e[35](m),a(o,_),a(o,y),e[36](y),a(o,x),a(o,g)},p:t,i:t,o:t,d(t){t&&s(o),e[33](null),e[34](null),e[35](null),e[36](null)}}}function Ca(t,e,o){let r,n,i,a,l,s,c,u,f,d,h,p,_,x,g,v,{centerLongitude:L=0}=e,{centerLatitude:b=0}=e,{zoom:P=1}=e,{projection:A=ui.VERTICAL_PERSPECTIVE}=e,{griddedData:C={floatArray:new La([-1/0]),width:1,height:1,projection:di.GFS}}=e,{griddedColormap:w={lut:[[0,0,0],[127,127,127]]}}=e,{griddedDomain:F=[0,1]}=e,{griddedBaseColor:E=[38,38,38,1]}=e,{particleData:I={uVelocities:new La([0]),vVelocities:new La([0]),width:1,height:1,projection:di.GFS}}=e,{particlesShown:S=!1}=e,{particlesPaused:z=!1}=e,{particleLifetime:T=1e3}=e,{particleCount:D=1e5}=e,{particleDisplay:M={size:.8,rate:5e4,opacity:.4,opacitySpeedDecay:.8,fade:.96}}=e,{vectorData:R={objects:{}}}=e,{vectorColors:j={}}=e,$=A.function,{forwardProjectionFunction:B}=e,{inverseProjectionFunction:O}=e,{syncWithAnimationHook:k=(()=>{})}=e,{MAX_TEXTURE_SIZE:N=1/0}=e,U={},H={},G=!1;m((()=>{const t=null===c.getContext("webgl",{failIfMajorPerformanceCaveat:!0});c.remove();const e=null!==u.getContext("webgl2"),r=e?"webgl2":"webgl";u.remove(),p=f.getContext(r,{alpha:!0}),_=d.getContext(r,{premultipliedAlpha:!t}),o(6,N=p.getParameter(p.MAX_TEXTURE_SIZE)),U=new fo(p,{data:C,colormap:w,domain:F,baseColor:E,vectorData:R,webgl2:e});let n={count:D,lifetime:T,data:I,majorPerformanceCaveat:t,webgl2:e},i=_.getExtension("EXT_color_buffer_float")||_.getExtension("WEBGL_color_buffer_float");H=!i||navigator.userAgent.includes("Mobi")?new Co(_,n):new vo(_,n),Z(p,!0),Z(_,!0),requestAnimationFrame(Y)}));let W,V,q,X=!1;function Y(t){let e=v?t-v:0;v=t,o(26,a=f.clientWidth),o(27,l=f.clientHeight);let r=window.devicePixelRatio,n={u_canvasRatio:a/l,u_screenRatio:r*l/1080,...h};a!==W||l!==V||r!==q?(x=!0,g=!0,X=!0):X&&(X=!1,Z(p),Z(_)),W=a,V=l,q=r,s&&(o(28,$=function(t,e,o,r,n,i){let a=t.function.scale(n*i/Math.PI).translate([r/2,n/2]).rotate([-e,-o,0]);return 4===t.id&&(a=a.distance(1+7/i)),a}(A,L,b,a,l,P)),s=!1),x&&(U.drawGriddedData(n),U.drawVectorData(n,j),k(),x=!1),S&&(g&&H.resetTrails(),(!z||z&&g)&&H.drawWithTrails(n,M.size*(A.particleSizeFactor||1),M.opacity,M.opacitySpeedDecay,M.fade),z||H.step(n,Math.min(e,100),M.rate),g&&(g=!1)),G&&(_.clear(_.COLOR_BUFFER_BIT),G=!1),requestAnimationFrame(Y)}function Z(t,e){const o=window.devicePixelRatio;(function(t,e){e=e||1,e=Math.max(0,e);const o=t.clientWidth*e|0,r=t.clientHeight*e|0;return(t.width!==o||t.height!==r)&&(t.width=o,t.height=r,!0)}(t.canvas,o)||e)&&(t.viewport(0,0,t.canvas.width,t.canvas.height),x=!0,g=!0)}return t.$$set=t=>{"centerLongitude"in t&&o(9,L=t.centerLongitude),"centerLatitude"in t&&o(10,b=t.centerLatitude),"zoom"in t&&o(11,P=t.zoom),"projection"in t&&o(12,A=t.projection),"griddedData"in t&&o(13,C=t.griddedData),"griddedColormap"in t&&o(14,w=t.griddedColormap),"griddedDomain"in t&&o(15,F=t.griddedDomain),"griddedBaseColor"in t&&o(16,E=t.griddedBaseColor),"particleData"in t&&o(17,I=t.particleData),"particlesShown"in t&&o(18,S=t.particlesShown),"particlesPaused"in t&&o(19,z=t.particlesPaused),"particleLifetime"in t&&o(20,T=t.particleLifetime),"particleCount"in t&&o(21,D=t.particleCount),"particleDisplay"in t&&o(22,M=t.particleDisplay),"vectorData"in t&&o(23,R=t.vectorData),"vectorColors"in t&&o(24,j=t.vectorColors),"forwardProjectionFunction"in t&&o(4,B=t.forwardProjectionFunction),"inverseProjectionFunction"in t&&o(5,O=t.inverseProjectionFunction),"syncWithAnimationHook"in t&&o(25,k=t.syncWithAnimationHook),"MAX_TEXTURE_SIZE"in t&&o(6,N=t.MAX_TEXTURE_SIZE)},t.$$.update=()=>{201334272&t.$$.dirty[0]&&(s=!0),268435456&t.$$.dirty[0]&&o(4,B=t=>fi($,t)?null:$(t)),268435456&t.$$.dirty[0]&&o(5,O=t=>{let e=$.invert(t);return function(t,e,o){let r=t(o);return Math.round(e[0])===Math.round(r[0])&&Math.round(e[1])===Math.round(r[1])}($,t,e)?e:null}),8192&t.$$.dirty[0]&&o(30,r=C.projection.id),131072&t.$$.dirty[0]&&o(31,n=I.projection.id),4096&t.$$.dirty[0]&&o(32,i=A.id),1073745408&t.$$.dirty[0]|3&t.$$.dirty[1]&&o(29,h={u_lon0:L,u_lat0:b,u_zoom:P,u_projection:i,u_griddedDataProjection:r,u_particleDataProjection:n}),8192&t.$$.dirty[0]&&(U.data=C),16384&t.$$.dirty[0]&&(U.colormap=w),32768&t.$$.dirty[0]&&(U.domain=F),65536&t.$$.dirty[0]&&(U.baseColor=E),8388608&t.$$.dirty[0]&&(U.vectorData=R),131072&t.$$.dirty[0]&&(H.data=I),2097152&t.$$.dirty[0]&&(H.count=D),1048576&t.$$.dirty[0]&&(H.lifetime=T),545382400&t.$$.dirty[0]&&(x=!0),544342016&t.$$.dirty[0]&&(g=!0),262144&t.$$.dirty[0]&&(S||(G=!0))},[c,u,f,d,B,O,N,ui,di,L,b,P,A,C,w,F,E,I,S,z,T,D,M,R,j,k,a,l,$,h,r,n,i,function(t){y[t?"unshift":"push"]((()=>{c=t,o(0,c)}))},function(t){y[t?"unshift":"push"]((()=>{u=t,o(1,u)}))},function(t){y[t?"unshift":"push"]((()=>{f=t,o(2,f)}))},function(t){y[t?"unshift":"push"]((()=>{d=t,o(3,d)}))}]}customElements.define("earth-map",class extends S{constructor(t){super(),this.shadowRoot.innerHTML="<style>:host{display:flex !important;width:300px;height:300px}div.layers{position:relative;flex:1}div.layers>:global(*){width:100%;height:100%;position:absolute}div.layers>*,::slotted(*){width:100%;height:100%;position:absolute}</style>",I(this,{target:this.shadowRoot,props:d(this.attributes),customElement:!0},Ca,Aa,i,{projections:7,dataProjections:8,centerLongitude:9,centerLatitude:10,zoom:11,projection:12,griddedData:13,griddedColormap:14,griddedDomain:15,griddedBaseColor:16,particleData:17,particlesShown:18,particlesPaused:19,particleLifetime:20,particleCount:21,particleDisplay:22,vectorData:23,vectorColors:24,forwardProjectionFunction:4,inverseProjectionFunction:5,syncWithAnimationHook:25,MAX_TEXTURE_SIZE:6},[-1,-1]),t&&(t.target&&l(t.target,this,t.anchor),t.props&&(this.$set(t.props),C()))}static get observedAttributes(){return["projections","dataProjections","centerLongitude","centerLatitude","zoom","projection","griddedData","griddedColormap","griddedDomain","griddedBaseColor","particleData","particlesShown","particlesPaused","particleLifetime","particleCount","particleDisplay","vectorData","vectorColors","forwardProjectionFunction","inverseProjectionFunction","syncWithAnimationHook","MAX_TEXTURE_SIZE"]}get projections(){return ui}get dataProjections(){return di}get centerLongitude(){return this.$$.ctx[9]}set centerLongitude(t){this.$set({centerLongitude:t}),C()}get centerLatitude(){return this.$$.ctx[10]}set centerLatitude(t){this.$set({centerLatitude:t}),C()}get zoom(){return this.$$.ctx[11]}set zoom(t){this.$set({zoom:t}),C()}get projection(){return this.$$.ctx[12]}set projection(t){this.$set({projection:t}),C()}get griddedData(){return this.$$.ctx[13]}set griddedData(t){this.$set({griddedData:t}),C()}get griddedColormap(){return this.$$.ctx[14]}set griddedColormap(t){this.$set({griddedColormap:t}),C()}get griddedDomain(){return this.$$.ctx[15]}set griddedDomain(t){this.$set({griddedDomain:t}),C()}get griddedBaseColor(){return this.$$.ctx[16]}set griddedBaseColor(t){this.$set({griddedBaseColor:t}),C()}get particleData(){return this.$$.ctx[17]}set particleData(t){this.$set({particleData:t}),C()}get particlesShown(){return this.$$.ctx[18]}set particlesShown(t){this.$set({particlesShown:t}),C()}get particlesPaused(){return this.$$.ctx[19]}set particlesPaused(t){this.$set({particlesPaused:t}),C()}get particleLifetime(){return this.$$.ctx[20]}set particleLifetime(t){this.$set({particleLifetime:t}),C()}get particleCount(){return this.$$.ctx[21]}set particleCount(t){this.$set({particleCount:t}),C()}get particleDisplay(){return this.$$.ctx[22]}set particleDisplay(t){this.$set({particleDisplay:t}),C()}get vectorData(){return this.$$.ctx[23]}set vectorData(t){this.$set({vectorData:t}),C()}get vectorColors(){return this.$$.ctx[24]}set vectorColors(t){this.$set({vectorColors:t}),C()}get forwardProjectionFunction(){return this.$$.ctx[4]}set forwardProjectionFunction(t){this.$set({forwardProjectionFunction:t}),C()}get inverseProjectionFunction(){return this.$$.ctx[5]}set inverseProjectionFunction(t){this.$set({inverseProjectionFunction:t}),C()}get syncWithAnimationHook(){return this.$$.ctx[25]}set syncWithAnimationHook(t){this.$set({syncWithAnimationHook:t}),C()}get MAX_TEXTURE_SIZE(){return this.$$.ctx[6]}set MAX_TEXTURE_SIZE(t){this.$set({MAX_TEXTURE_SIZE:t}),C()}})}();