text: (function(v,Y){"object"===typeof exports&&"undefined"!==typeof module?Y(exports):"function"===typeof define&&define.amd?define(["exports"],Y):(v=v||self,Y(v.mapvgl={}))})(this,function(v){function Y(q){return q&&q.__esModule&&Object.prototype.hasOwnProperty.call(q,"default")?q["default"]:q}function ha(q,h){return h={exports:{}},q(h,h.exports),h.exports}function Cc(q,h){return function(c){return h(q(c))}}function Dc(q){var h=function(c){if(void 0===c||null===c)return c;1<arguments.length&&(c=Array.prototype.slice.call(arguments));
  return q(c)};"conversion"in q&&(h.conversion=q.conversion);return h}function Ec(q){var h=function(c){if(void 0===c||null===c)return c;1<arguments.length&&(c=Array.prototype.slice.call(arguments));var d=q(c);if("object"===("undefined"===typeof d?"undefined":X(d)))for(var b=d.length,a=0;a<b;a++)d[a]=Math.round(d[a]);return d};"conversion"in q&&(h.conversion=q.conversion);return h}function U(q,h){if(!(this instanceof U))return new U(q,h);h&&h in $b&&(h=null);if(h&&!(h in na))throw Error("Unknown model: "+
  h);if("undefined"===typeof q)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(q instanceof U)this.model=q.model,this.color=q.color.slice(),this.valpha=q.valpha;else if("string"===typeof q){h=gb.get(q);if(null===h)throw Error("Unable to parse color from string: "+q);this.model=h.model;var c=na[this.model].channels;this.color=h.value.slice(0,c);this.valpha="number"===typeof h.value[c]?h.value[c]:1}else if(q.length)this.model=h||"rgb",c=na[this.model].channels,h=rb.call(q,0,c),this.color=Hb(h,
  c),this.valpha="number"===typeof q[c]?q[c]:1;else if("number"===typeof q)q&=16777215,this.model="rgb",this.color=[q>>16&255,q>>8&255,q&255],this.valpha=1;else{this.valpha=1;h=Object.keys(q);"alpha"in q&&(h.splice(h.indexOf("alpha"),1),this.valpha="number"===typeof q.alpha?q.alpha:0);h=h.sort().join("");if(!(h in sb))throw Error("Unable to parse color from object: "+JSON.stringify(q));this.model=sb[h];c=na[this.model].labels;var d=[];for(h=0;h<c.length;h++)d.push(q[c[h]]);this.color=Hb(d)}if(Oa[this.model])for(c=
  na[this.model].channels,h=0;h<c;h++)(q=Oa[this.model][h])&&(this.color[h]=q(this.color[h]));this.valpha=Math.max(0,Math.min(1,this.valpha));Object.freeze&&Object.freeze(this)}function Fc(q){return function(h){return Number(h.toFixed(q))}}function Q(q,h,c){q=Array.isArray(q)?q:[q];q.forEach(function(d){(Oa[d]||(Oa[d]=[]))[h]=c});q=q[0];return function(d){if(arguments.length){c&&(d=c(d));var b=this[q]();b.color[h]=d;return b}b=this[q]().color[h];c&&(b=c(b));return b}}function R(q){return function(h){return Math.max(0,
  Math.min(q,h))}}function Hb(q,h){for(var c=0;c<h;c++)"number"!==typeof q[c]&&(q[c]=0);return q}function pa(){}function ac(q,h){for(var c in h)q[c]=h[c]}function va(q,h){this.lng=q;this.lat=h}function bc(q,h){this.x=q;this.y=h}function hb(q){return q*Math.PI/180}function Ib(q,h){var c=document.createElement("canvas");q&&(c.width=q);h&&(c.height=h);return c}function O(q){q=q||{};this.gradient=q.gradient||{"0.25":"rgba(0, 0, 255, 1)","0.55":"rgba(0, 255, 0, 1)","0.85":"rgba(255, 255, 0, 1)",1:"rgba(255, 0, 0, 1)"};
  this.maxSize=void 0===q.maxSize?35:q.maxSize;this.minSize=q.minSize||0;this.max=q.max||100;this.min=q.min||0;this.initPalette()}function ja(q){this.options=q||{};this._initialize()}function ib(q,h,c,d,b){var a=1-q,f=1-q;return a*a*a*h+3*f*f*q*c+3*(1-q)*q*q*d+q*q*q*b}function cc(q){for(var h=["webgl2","experimental-webgl2","webgl","experimental-webgl"],c,d=0;d<h.length;d++)try{if(c=q.getContext(h[d]))break}catch(b){}return c}function dc(q,h,c){var d=q.createShader(q.VERTEX_SHADER);q.shaderSource(d,
  h);q.compileShader(d);if(!q.getShaderParameter(d,q.COMPILE_STATUS))return q="Vertex shader failed to compile.  The error log is:"+q.getShaderInfoLog(d),console.error(q),-1;h=q.createShader(q.FRAGMENT_SHADER);q.shaderSource(h,c);q.compileShader(h);if(!q.getShaderParameter(h,q.COMPILE_STATUS))return q="Fragment shader failed to compile.  The error log is:"+q.getShaderInfoLog(h),console.error(q),-1;c=q.createProgram();q.attachShader(c,d);q.attachShader(c,h);q.linkProgram(c);return q.getProgramParameter(c,
  q.LINK_STATUS)?c:(q="Shader program failed to link.  The error log is:"+q.getProgramInfoLog(c),console.error(q),-1)}function S(q,h,c){this.gl=q;c&&(this.map=c.map);c=h.vertexShader;var d="";this.map&&"cesium"===this.map.type&&(d="#define LOG_DEPTH\n");c=(d+"\n        uniform float log2FarDistance ;\n        void afterMain() {\n            #if defined(LOG_DEPTH)\n                gl_Position.z = log2(max(1e-6, 1.0 + gl_Position.w)) * log2FarDistance - 1.0;\n                gl_Position.z *= gl_Position.w;\n            #endif\n        }\n    "+
  c).replace("void main","void originMain");h=this.program=dc(q,c+"void main() {originMain(); afterMain();}",h.fragmentShader);c={};d=q.getProgramParameter(h,q.ACTIVE_ATTRIBUTES);for(var b=0;b<d;b++){var a=q.getActiveAttrib(h,b);c[a.name]=q.getAttribLocation(h,a.name)}d={};b=q.getProgramParameter(h,q.ACTIVE_UNIFORMS);for(a=0;a<b;a++){var f=q.getActiveUniform(h,a);d[f.name]=q.getUniformLocation(h,f.name)}this.attributes=c;this.uniforms=d}function tb(q,h){var c=q.createTexture();q.bindTexture(q.TEXTURE_2D,
  c);q.pixelStorei(q.UNPACK_FLIP_Y_WEBGL,!0);q.texImage2D(q.TEXTURE_2D,0,q.RGBA,q.RGBA,q.UNSIGNED_BYTE,h);q.texParameteri(q.TEXTURE_2D,q.TEXTURE_MAG_FILTER,q.LINEAR);q.texParameteri(q.TEXTURE_2D,q.TEXTURE_MIN_FILTER,q.LINEAR);q.texParameteri(q.TEXTURE_2D,q.TEXTURE_WRAP_S,q.REPEAT);q.texParameteri(q.TEXTURE_2D,q.TEXTURE_WRAP_T,q.REPEAT);q.bindTexture(q.TEXTURE_2D,null);return c}function ub(q,h,c){if("object"===("undefined"===typeof h?"undefined":X(h)))h=tb(q,h),c(h,null);else{var d=new Image;d.crossOrigin=
  "anonymous";d.onload=function(){var b=tb(q,this);c(b,d)};d.src=h}}function vb(q,h){return function(c){var d=this;if(h){if(Ua&&!c)return c=(""+h).replace(/^function.+?{/,"").slice(0,-1),c=ec(c),this[fc]=new Ua(c),Va.revokeObjectURL(c),this[fc];var b={postMessage:function(a){d.onmessage&&setTimeout(function(){return d.onmessage({data:a,target:b})})}};h.call(b);this.postMessage=function(a){setTimeout(function(){return b.onmessage({data:a,target:d})})};this.isThisThread=!0}else return new Ua(q)}}function ec(q){try{return Va.createObjectURL(new Blob([q],
  {type:"application/javascript"}))}catch(c){var h=new Gc;h.append(q);return Va.createObjectURL(h.getBlob(type))}}function sa(q,h,c){this.heatmapLayer=c;this.options=h||{};this.map=q;q=document.createElement("canvas");this.data=[];this.canvas=q;this.scale(1)}function wb(q,h,c){this.layer=q;this.map=h;this.gl=c;this.initWorker()}function Jb(q,h,c){this.layer=q;this.map=h;this.gl=c;this.initWorker()}function Ga(q,h,c){c=c||2;var d=h&&h.length,b=d?h[0]*c:q.length,a=gc(q,0,b,c,!0),f=[];if(!a||a.next===
  a.prev)return f;var k;if(d){var e=c;d=[];var l;var n=0;for(l=h.length;n<l;n++){var p=h[n]*e;var g=n<l-1?h[n+1]*e:q.length;p=gc(q,p,g,e,!1);p===p.next&&(p.steiner=!0);d.push(Hc(p))}d.sort(Ic);for(n=0;n<d.length;n++){h=d[n];e=a;if(e=Jc(h,e))h=hc(e,h),Wa(h,h.next);a=Wa(a,a.next)}}if(q.length>80*c){var r=k=q[0];var m=d=q[1];for(e=c;e<b;e+=c)n=q[e],h=q[e+1],n<r&&(r=n),h<m&&(m=h),n>k&&(k=n),h>d&&(d=h);k=Math.max(k-r,d-m);k=0!==k?1/k:0}jb(a,f,c,r,m,k);return f}function gc(q,h,c,d,b){if(b===0<Kb(q,h,c,d))for(b=
  h;b<c;b+=d)var a=ic(b,q[b],q[b+1],a);else for(b=c-d;b>=h;b-=d)a=ic(b,q[b],q[b+1],a);a&&Ba(a,a.next)&&(Xa(a),a=a.next);return a}function Wa(q,h){if(!q)return q;h||(h=q);do{var c=!1;if(q.steiner||!Ba(q,q.next)&&0!==ea(q.prev,q,q.next))q=q.next;else{Xa(q);q=h=q.prev;if(q===q.next)break;c=!0}}while(c||q!==h);return h}function jb(q,h,c,d,b,a,f){if(q){if(!f&&a){var k=q,e=k;do null===e.z&&(e.z=Lb(e.x,e.y,d,b,a)),e.prevZ=e.prev,e=e.nextZ=e.next;while(e!==k);e.prevZ.nextZ=null;e.prevZ=null;k=e;var l,n,p,g,
  r=1;do{e=k;var m=k=null;for(n=0;e;){n++;var t=e;for(l=p=0;l<r&&(p++,t=t.nextZ,t);l++);for(g=r;0<p||0<g&&t;)0!==p&&(0===g||!t||e.z<=t.z)?(l=e,e=e.nextZ,p--):(l=t,t=t.nextZ,g--),m?m.nextZ=l:k=l,l.prevZ=m,m=l;e=t}m.nextZ=null;r*=2}while(1<n)}for(k=q;q.prev!==q.next;){e=q.prev;t=q.next;if(a)m=Kc(q,d,b,a);else a:if(m=q,n=m.prev,p=m,r=m.next,0<=ea(n,p,r))m=!1;else{for(l=m.next.next;l!==m.prev;){if(Pa(n.x,n.y,p.x,p.y,r.x,r.y,l.x,l.y)&&0<=ea(l.prev,l,l.next)){m=!1;break a}l=l.next}m=!0}if(m)h.push(e.i/c),
  h.push(q.i/c),h.push(t.i/c),Xa(q),k=q=t.next;else if(q=t,q===k){if(!f)jb(Wa(q),h,c,d,b,a,1);else if(1===f){f=h;k=c;e=q;do t=e.prev,m=e.next.next,!Ba(t,m)&&jc(t,e,e.next,m)&&Ya(t,m)&&Ya(m,t)&&(f.push(t.i/k),f.push(e.i/k),f.push(m.i/k),Xa(e),Xa(e.next),e=q=m),e=e.next;while(e!==q);q=e;jb(q,h,c,d,b,a,2)}else if(2===f)a:{f=q;do{for(k=f.next.next;k!==f.prev;){if(e=f.i!==k.i){e=f;t=k;if(m=e.next.i!==t.i&&e.prev.i!==t.i){b:{m=e;do{if(m.i!==e.i&&m.next.i!==e.i&&m.i!==t.i&&m.next.i!==t.i&&jc(m,m.next,e,t)){m=
  !0;break b}m=m.next}while(m!==e);m=!1}m=!m}if(m=m&&Ya(e,t)&&Ya(t,e)){m=e;n=!1;p=(e.x+t.x)/2;t=(e.y+t.y)/2;do m.y>t!==m.next.y>t&&m.next.y!==m.y&&p<(m.next.x-m.x)*(t-m.y)/(m.next.y-m.y)+m.x&&(n=!n),m=m.next;while(m!==e);m=n}e=m}if(e){q=hc(f,k);f=Wa(f,f.next);q=Wa(q,q.next);jb(f,h,c,d,b,a);jb(q,h,c,d,b,a);break a}k=k.next}f=f.next}while(f!==q)}break}}}}function Kc(q,h,c,d){var b=q.prev,a=q.next;if(0<=ea(b,q,a))return!1;var f=b.x>q.x?b.x>a.x?b.x:a.x:q.x>a.x?q.x:a.x,k=b.y>q.y?b.y>a.y?b.y:a.y:q.y>a.y?
  q.y:a.y,e=Lb(b.x<q.x?b.x<a.x?b.x:a.x:q.x<a.x?q.x:a.x,b.y<q.y?b.y<a.y?b.y:a.y:q.y<a.y?q.y:a.y,h,c,d);h=Lb(f,k,h,c,d);c=q.prevZ;for(d=q.nextZ;c&&c.z>=e&&d&&d.z<=h;){if(c!==q.prev&&c!==q.next&&Pa(b.x,b.y,q.x,q.y,a.x,a.y,c.x,c.y)&&0<=ea(c.prev,c,c.next))return!1;c=c.prevZ;if(d!==q.prev&&d!==q.next&&Pa(b.x,b.y,q.x,q.y,a.x,a.y,d.x,d.y)&&0<=ea(d.prev,d,d.next))return!1;d=d.nextZ}for(;c&&c.z>=e;){if(c!==q.prev&&c!==q.next&&Pa(b.x,b.y,q.x,q.y,a.x,a.y,c.x,c.y)&&0<=ea(c.prev,c,c.next))return!1;c=c.prevZ}for(;d&&
  d.z<=h;){if(d!==q.prev&&d!==q.next&&Pa(b.x,b.y,q.x,q.y,a.x,a.y,d.x,d.y)&&0<=ea(d.prev,d,d.next))return!1;d=d.nextZ}return!0}function Ic(q,h){return q.x-h.x}function Jc(q,h){var c=h,d=q.x,b=q.y,a=-Infinity;do{if(b<=c.y&&b>=c.next.y&&c.next.y!==c.y){var f=c.x+(b-c.y)*(c.next.x-c.x)/(c.next.y-c.y);if(f<=d&&f>a){a=f;if(f===d){if(b===c.y)return c;if(b===c.next.y)return c.next}var k=c.x<c.next.x?c:c.next}}c=c.next}while(c!==h);if(!k)return null;if(d===a)return k.prev;h=k;f=k.x;var e=k.y,l=Infinity;for(c=
  k.next;c!==h;){if(d>=c.x&&c.x>=f&&d!==c.x&&Pa(b<e?d:a,b,f,e,b<e?a:d,b,c.x,c.y)){var n=Math.abs(b-c.y)/(d-c.x);(n<l||n===l&&c.x>k.x)&&Ya(c,q)&&(k=c,l=n)}c=c.next}return k}function Lb(q,h,c,d,b){q=32767*(q-c)*b;h=32767*(h-d)*b;q=(q|q<<8)&16711935;q=(q|q<<4)&252645135;q=(q|q<<2)&858993459;h=(h|h<<8)&16711935;h=(h|h<<4)&252645135;h=(h|h<<2)&858993459;return(q|q<<1)&1431655765|((h|h<<1)&1431655765)<<1}function Hc(q){var h=q,c=q;do{if(h.x<c.x||h.x===c.x&&h.y<c.y)c=h;h=h.next}while(h!==q);return c}function Pa(q,
  h,c,d,b,a,f,k){return 0<=(b-f)*(h-k)-(q-f)*(a-k)&&0<=(q-f)*(d-k)-(c-f)*(h-k)&&0<=(c-f)*(a-k)-(b-f)*(d-k)}function ea(q,h,c){return(h.y-q.y)*(c.x-h.x)-(h.x-q.x)*(c.y-h.y)}function Ba(q,h){return q.x===h.x&&q.y===h.y}function jc(q,h,c,d){return Ba(q,h)&&Ba(c,d)||Ba(q,d)&&Ba(c,h)?!0:0<ea(q,h,c)!==0<ea(q,h,d)&&0<ea(c,d,q)!==0<ea(c,d,h)}function Ya(q,h){return 0>ea(q.prev,q,q.next)?0<=ea(q,h,q.next)&&0<=ea(q,q.prev,h):0>ea(q,h,q.prev)||0>ea(q,q.next,h)}function hc(q,h){var c=new kb(q.i,q.x,q.y),d=new kb(h.i,
  h.x,h.y),b=q.next,a=h.prev;q.next=h;h.prev=q;c.next=b;b.prev=c;d.next=c;c.prev=d;a.next=d;d.prev=a;return d}function ic(q,h,c,d){q=new kb(q,h,c);d?(q.next=d.next,q.prev=d,d.next.prev=q,d.next=q):(q.prev=q,q.next=q);return q}function Xa(q){q.next.prev=q.prev;q.prev.next=q.next;q.prevZ&&(q.prevZ.nextZ=q.nextZ);q.nextZ&&(q.nextZ.prevZ=q.prevZ)}function kb(q,h,c){this.i=q;this.x=h;this.y=c;this.nextZ=this.prevZ=this.z=this.next=this.prev=null;this.steiner=!1}function Kb(q,h,c,d){for(var b=0,a=c-d;h<c;h+=
  d)b+=(q[a]-q[h])*(q[h+1]+q[a+1]),a=h;return b}function Ha(q,h){this.shapeLayer=q;this.gl=h;this.initData()}var Lc="undefined"!==typeof globalThis?globalThis:"undefined"!==typeof window?window:"undefined"!==typeof global?global:"undefined"!==typeof self?self:{},qa={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],
  brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,
  150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,
  255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,
  178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,
  25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],
  rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,
  130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},lb=ha(function(q){var h=Array.prototype.concat,c=Array.prototype.slice,d=q.exports=function(b){for(var a=[],f=0,k=b.length;f<k;f++){var e=b[f];var l=(l=e)&&"string"!==typeof l?l instanceof Array||Array.isArray(l)||0<=l.length&&(l.splice instanceof Function||Object.getOwnPropertyDescriptor(l,l.length-1)&&"String"!==l.constructor.name):!1;l?a=h.call(a,c.call(e)):a.push(e)}return a};
  d.wrap=function(b){return function(){return b(d(arguments))}}}),gb=ha(function(q){function h(a,b,e){return Math.min(Math.max(b,a),e)}function c(a){a=a.toString(16).toUpperCase();return 2>a.length?"0"+a:a}var d={},b;for(b in qa)qa.hasOwnProperty(b)&&(d[qa[b]]=b);var a=q.exports={to:{},get:{}};a.get=function(f){switch(f.substring(0,3).toLowerCase()){case "hsl":f=a.get.hsl(f);var b="hsl";break;case "hwb":f=a.get.hwb(f);b="hwb";break;default:f=a.get.rgb(f),b="rgb"}return f?{model:b,value:f}:null};a.get.rgb=
  function(a){if(!a)return null;var f=/^#([a-f0-9]{3,4})$/i,e=/^rgba?\(\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/,b=/^rgba?\(\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/,c=/(\D+)/,d=[0,0,0,1],g;if(g=a.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){f=g[2];g=g[1];for(a=0;3>a;a++)e=2*a,d[a]=parseInt(g.slice(e,e+2),16);f&&(d[3]=Math.round(parseInt(f,16)/255*100)/100)}else if(g=a.match(f)){g=g[1];f=g[3];for(a=0;3>a;a++)d[a]=
  parseInt(g[a]+g[a],16);f&&(d[3]=Math.round(parseInt(f+f,16)/255*100)/100)}else if(g=a.match(e)){for(a=0;3>a;a++)d[a]=parseInt(g[a+1],0);g[4]&&(d[3]=parseFloat(g[4]))}else if(g=a.match(b)){for(a=0;3>a;a++)d[a]=Math.round(2.55*parseFloat(g[a+1]));g[4]&&(d[3]=parseFloat(g[4]))}else{if(g=a.match(c)){if("transparent"===g[1])return[0,0,0,0];d=qa[g[1]];if(!d)return null;d[3]=1;return d}return null}for(a=0;3>a;a++)d[a]=h(d[a],0,255);d[3]=h(d[3],0,1);return d};a.get.hsl=function(a){if(!a)return null;var f=
  a.match(/^hsla?\(\s*([+-]?(?:\d*\.)?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/);if(f){var e=parseFloat(f[4]);a=(parseFloat(f[1])+360)%360;var b=h(parseFloat(f[2]),0,100);f=h(parseFloat(f[3]),0,100);e=h(isNaN(e)?1:e,0,1);return[a,b,f,e]}return null};a.get.hwb=function(a){if(!a)return null;var f=a.match(/^hwb\(\s*([+-]?\d*[\.]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/);if(f){var e=parseFloat(f[4]);a=(parseFloat(f[1])%
  360+360)%360;var b=h(parseFloat(f[2]),0,100);f=h(parseFloat(f[3]),0,100);e=h(isNaN(e)?1:e,0,1);return[a,b,f,e]}return null};a.to.hex=function(){var a=lb(arguments);return"#"+c(a[0])+c(a[1])+c(a[2])+(1>a[3]?c(Math.round(255*a[3])):"")};a.to.rgb=function(){var a=lb(arguments);return 4>a.length||1===a[3]?"rgb("+Math.round(a[0])+", "+Math.round(a[1])+", "+Math.round(a[2])+")":"rgba("+Math.round(a[0])+", "+Math.round(a[1])+", "+Math.round(a[2])+", "+a[3]+")"};a.to.rgb.percent=function(){var a=lb(arguments),
  b=Math.round(a[0]/255*100),e=Math.round(a[1]/255*100),c=Math.round(a[2]/255*100);return 4>a.length||1===a[3]?"rgb("+b+"%, "+e+"%, "+c+"%)":"rgba("+b+"%, "+e+"%, "+c+"%, "+a[3]+")"};a.to.hsl=function(){var a=lb(arguments);return 4>a.length||1===a[3]?"hsl("+a[0]+", "+a[1]+"%, "+a[2]+"%)":"hsla("+a[0]+", "+a[1]+"%, "+a[2]+"%, "+a[3]+")"};a.to.hwb=function(){var a=lb(arguments),b="";4<=a.length&&1!==a[3]&&(b=", "+a[3]);return"hwb("+a[0]+", "+a[1]+"%, "+a[2]+"%"+b+")"};a.to.keyword=function(a){return d[a.slice(0,
  3)]}}),wa=ha(function(q){var h={};for(b in qa)qa.hasOwnProperty(b)&&(h[qa[b]]=b);var c=q.exports={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,
  labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}},d;for(d in c)if(c.hasOwnProperty(d)){if(!("channels"in c[d]))throw Error("missing channels property: "+d);if(!("labels"in c[d]))throw Error("missing channel labels property: "+d);if(c[d].labels.length!==c[d].channels)throw Error("channel and label counts mismatch: "+d);q=c[d].channels;var b=c[d].labels;delete c[d].channels;delete c[d].labels;Object.defineProperty(c[d],"channels",{value:q});Object.defineProperty(c[d],
  "labels",{value:b})}c.rgb.hsl=function(a){var f=a[0]/255,b=a[1]/255,e=a[2]/255;a=Math.min(f,b,e);var c=Math.max(f,b,e),d=c-a,h;c===a?h=0:f===c?h=(b-e)/d:b===c?h=2+(e-f)/d:e===c&&(h=4+(f-b)/d);h=Math.min(60*h,360);0>h&&(h+=360);f=(a+c)/2;return[h,100*(c===a?0:.5>=f?d/(c+a):d/(2-c-a)),100*f]};c.rgb.hsv=function(a){var f,b=a[0]/255,e=a[1]/255,c=a[2]/255,d=Math.max(b,e,c);var h=d-Math.min(b,e,c);if(0===h)var g=f=0;else{f=h/d;a=(d-b)/6/h+.5;var r=(d-e)/6/h+.5;h=(d-c)/6/h+.5;b===d?g=h-r:e===d?g=1/3+a-h:
  c===d&&(g=2/3+r-a);0>g?g+=1:1<g&&--g}return[360*g,100*f,100*d]};c.rgb.hwb=function(a){var f=a[0],b=a[1],e=a[2];a=c.rgb.hsl(a)[0];var l=1/255*Math.min(f,Math.min(b,e));e=1-1/255*Math.max(f,Math.max(b,e));return[a,100*l,100*e]};c.rgb.cmyk=function(a){var f=a[0]/255,b=a[1]/255;a=a[2]/255;var e=Math.min(1-f,1-b,1-a);return[100*((1-f-e)/(1-e)||0),100*((1-b-e)/(1-e)||0),100*((1-a-e)/(1-e)||0),100*e]};c.rgb.keyword=function(a){var f=h[a];if(f)return f;f=Infinity;var b;for(b in qa)if(qa.hasOwnProperty(b)){var e=
  qa[b];e=Math.pow(a[0]-e[0],2)+Math.pow(a[1]-e[1],2)+Math.pow(a[2]-e[2],2);if(e<f){f=e;var c=b}}return c};c.keyword.rgb=function(a){return qa[a]};c.rgb.xyz=function(a){var f=a[0]/255,b=a[1]/255;a=a[2]/255;f=.04045<f?Math.pow((f+.055)/1.055,2.4):f/12.92;b=.04045<b?Math.pow((b+.055)/1.055,2.4):b/12.92;a=.04045<a?Math.pow((a+.055)/1.055,2.4):a/12.92;return[100*(.4124*f+.3576*b+.1805*a),100*(.2126*f+.7152*b+.0722*a),100*(.0193*f+.1192*b+.9505*a)]};c.rgb.lab=function(a){var f=c.rgb.xyz(a);a=f[0];var b=
  f[1];f=f[2];a/=95.047;b/=100;f/=108.883;a=.008856<a?Math.pow(a,1/3):7.787*a+16/116;b=.008856<b?Math.pow(b,1/3):7.787*b+16/116;f=.008856<f?Math.pow(f,1/3):7.787*f+16/116;return[116*b-16,500*(a-b),200*(b-f)]};c.hsl.rgb=function(a){var f=a[0]/360,b=a[1]/100;a=a[2]/100;if(0===b){var e=255*a;return[e,e,e]}b=.5>a?a*(1+b):a+b-a*b;a=2*a-b;var c=[0,0,0];for(var d=0;3>d;d++)e=f+1/3*-(d-1),0>e&&e++,1<e&&e--,e=1>6*e?a+6*(b-a)*e:1>2*e?b:2>3*e?a+(b-a)*(2/3-e)*6:a,c[d]=255*e;return c};c.hsl.hsv=function(a){var f=
  a[0],b=a[1]/100;a=a[2]/100;var e=b,c=Math.max(a,.01);a*=2;b*=1>=a?a:2-a;e*=1>=c?c:2-c;return[f,100*(0===a?2*e/(c+e):2*b/(a+b)),(a+b)/2*100]};c.hsv.rgb=function(a){var f=a[0]/60,b=a[1]/100;a=a[2]/100;var e=Math.floor(f)%6,c=f-Math.floor(f);f=255*a*(1-b);var d=255*a*(1-b*c);b=255*a*(1-b*(1-c));a*=255;switch(e){case 0:return[a,b,f];case 1:return[d,a,f];case 2:return[f,a,b];case 3:return[f,d,a];case 4:return[b,f,a];case 5:return[a,f,d]}};c.hsv.hsl=function(a){var f=a[0],b=a[1]/100;a=a[2]/100;var e=Math.max(a,
  .01);var c=(2-b)*e;e=b*e/(1>=c?c:2-c)||0;return[f,100*e,(2-b)*a/2*100]};c.hwb.rgb=function(a){var f=a[0]/360,b=a[1]/100;a=a[2]/100;var e=b+a;1<e&&(b/=e,a/=e);e=Math.floor(6*f);a=1-a;f=6*f-e;0!==(e&1)&&(f=1-f);f=b+f*(a-b);switch(e){default:case 6:case 0:e=a;var c=f;break;case 1:e=f;c=a;break;case 2:e=b;c=a;b=f;break;case 3:e=b;c=f;b=a;break;case 4:e=f;c=b;b=a;break;case 5:e=a,c=b,b=f}return[255*e,255*c,255*b]};c.cmyk.rgb=function(a){var f=a[3]/100;return[255*(1-Math.min(1,a[0]/100*(1-f)+f)),255*(1-
  Math.min(1,a[1]/100*(1-f)+f)),255*(1-Math.min(1,a[2]/100*(1-f)+f))]};c.xyz.rgb=function(a){var f=a[0]/100,b=a[1]/100,e=a[2]/100;a=3.2406*f+-1.5372*b+-.4986*e;var c=-.9689*f+1.8758*b+.0415*e;f=.0557*f+-.204*b+1.057*e;a=.0031308<a?1.055*Math.pow(a,1/2.4)-.055:12.92*a;c=.0031308<c?1.055*Math.pow(c,1/2.4)-.055:12.92*c;f=.0031308<f?1.055*Math.pow(f,1/2.4)-.055:12.92*f;a=Math.min(Math.max(0,a),1);c=Math.min(Math.max(0,c),1);f=Math.min(Math.max(0,f),1);return[255*a,255*c,255*f]};c.xyz.lab=function(a){var f=
  a[0],b=a[1];a=a[2];f/=95.047;b/=100;a/=108.883;f=.008856<f?Math.pow(f,1/3):7.787*f+16/116;b=.008856<b?Math.pow(b,1/3):7.787*b+16/116;a=.008856<a?Math.pow(a,1/3):7.787*a+16/116;return[116*b-16,500*(f-b),200*(b-a)]};c.lab.xyz=function(a){var f=a[1],b=a[2];a=(a[0]+16)/116;f=f/500+a;b=a-b/200;var e=Math.pow(a,3),c=Math.pow(f,3),d=Math.pow(b,3);return[95.047*(.008856<c?c:(f-16/116)/7.787),100*(.008856<e?e:(a-16/116)/7.787),108.883*(.008856<d?d:(b-16/116)/7.787)]};c.lab.lch=function(a){var f=a[0],b=a[1];
  a=a[2];var e=360*Math.atan2(a,b)/2/Math.PI;0>e&&(e+=360);return[f,Math.sqrt(b*b+a*a),e]};c.lch.lab=function(a){var f=a[0],b=a[1];a=a[2]/360*2*Math.PI;return[f,b*Math.cos(a),b*Math.sin(a)]};c.rgb.ansi16=function(a){var f=a[0],b=a[1],e=a[2],l=1 in arguments?arguments[1]:c.rgb.hsv(a)[2];l=Math.round(l/50);if(0===l)return 30;f=30+(Math.round(e/255)<<2|Math.round(b/255)<<1|Math.round(f/255));2===l&&(f+=60);return f};c.hsv.ansi16=function(a){return c.rgb.ansi16(c.hsv.rgb(a),a[2])};c.rgb.ansi256=function(a){var f=
  a[0],b=a[1];a=a[2];return f===b&&b===a?8>f?16:248<f?231:Math.round((f-8)/247*24)+232:16+36*Math.round(f/255*5)+6*Math.round(b/255*5)+Math.round(a/255*5)};c.ansi16.rgb=function(a){var f=a%10;if(0===f||7===f)return 50<a&&(f+=3.5),f=f/10.5*255,[f,f,f];a=.5*(~~(50<a)+1);return[(f&1)*a*255,(f>>1&1)*a*255,(f>>2&1)*a*255]};c.ansi256.rgb=function(a){if(232<=a){var f=10*(a-232)+8;return[f,f,f]}a-=16;f=Math.floor(a/36)/5*255;var b=Math.floor((a%=36)/6)/5*255;return[f,b,a%6/5*255]};c.rgb.hex=function(a){a=(((Math.round(a[0])&
  255)<<16)+((Math.round(a[1])&255)<<8)+(Math.round(a[2])&255)).toString(16).toUpperCase();return"000000".substring(a.length)+a};c.hex.rgb=function(a){a=a.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!a)return[0,0,0];var f=a[0];3===a[0].length&&(f=f.split("").map(function(a){return a+a}).join(""));a=parseInt(f,16);return[a>>16&255,a>>8&255,a&255]};c.rgb.hcg=function(a){var f=a[0]/255,b=a[1]/255;a=a[2]/255;var e=Math.max(Math.max(f,b),a),c=Math.min(Math.min(f,b),a),d=e-c;return[(0>=d?0:e===f?(b-
  a)/d%6:e===b?2+(a-f)/d:(f-b)/d+8)/6%1*360,100*d,100*(1>d?c/(1-d):0)]};c.hsl.hcg=function(a){var f=a[1]/100,b=a[2]/100,e=0;f=.5>b?2*f*b:2*f*(1-b);1>f&&(e=(b-.5*f)/(1-f));return[a[0],100*f,100*e]};c.hsv.hcg=function(a){var f=a[2]/100,b=a[1]/100*f,e=0;1>b&&(e=(f-b)/(1-b));return[a[0],100*b,100*e]};c.hcg.rgb=function(a){var f=a[1]/100,b=a[2]/100;if(0===f)return[255*b,255*b,255*b];var e=[0,0,0];a=a[0]/360%1*6;var c=a%1,d=1-c;switch(Math.floor(a)){case 0:e[0]=1;e[1]=c;e[2]=0;break;case 1:e[0]=d;e[1]=1;
  e[2]=0;break;case 2:e[0]=0;e[1]=1;e[2]=c;break;case 3:e[0]=0;e[1]=d;e[2]=1;break;case 4:e[0]=c;e[1]=0;e[2]=1;break;default:e[0]=1,e[1]=0,e[2]=d}b*=1-f;return[255*(f*e[0]+b),255*(f*e[1]+b),255*(f*e[2]+b)]};c.hcg.hsv=function(a){var f=a[1]/100,b=f+a[2]/100*(1-f),e=0;0<b&&(e=f/b);return[a[0],100*e,100*b]};c.hcg.hsl=function(a){var f=a[1]/100,b=a[2]/100*(1-f)+.5*f,e=0;0<b&&.5>b?e=f/(2*b):.5<=b&&1>b&&(e=f/(2*(1-b)));return[a[0],100*e,100*b]};c.hcg.hwb=function(a){var f=a[1]/100,b=f+a[2]/100*(1-f);return[a[0],
  100*(b-f),100*(1-b)]};c.hwb.hcg=function(a){var f=1-a[2]/100,b=f-a[1]/100,e=0;1>b&&(e=(f-b)/(1-b));return[a[0],100*b,100*e]};c.apple.rgb=function(a){return[a[0]/65535*255,a[1]/65535*255,a[2]/65535*255]};c.rgb.apple=function(a){return[a[0]/255*65535,a[1]/255*65535,a[2]/255*65535]};c.gray.rgb=function(a){return[a[0]/100*255,a[0]/100*255,a[0]/100*255]};c.gray.hsl=c.gray.hsv=function(a){return[0,0,a[0]]};c.gray.hwb=function(a){return[0,100,a[0]]};c.gray.cmyk=function(a){return[0,0,0,a[0]]};c.gray.lab=
  function(a){return[a[0],0,0]};c.gray.hex=function(a){a=Math.round(a[0]/100*255)&255;a=((a<<16)+(a<<8)+a).toString(16).toUpperCase();return"000000".substring(a.length)+a};c.rgb.gray=function(a){return[(a[0]+a[1]+a[2])/3/255*100]}}),Mc=function(q){for(var h={},c=Object.keys(wa),d=c.length,b=0;b<d;b++)h[c[b]]={distance:-1,parent:null};c=[q];for(h[q].distance=0;c.length;){q=c.pop();d=Object.keys(wa[q]);b=d.length;for(var a=0;a<b;a++){var f=d[a],k=h[f];-1===k.distance&&(k.distance=h[q].distance+1,k.parent=
  q,c.unshift(f))}}c={};q=Object.keys(h);d=q.length;for(b=0;b<d;b++){var e=q[b];if(null!==h[e].parent){a=e;f=h;k=[f[e].parent,e];var l=wa[f[e].parent][e];for(e=f[e].parent;f[e].parent;)k.unshift(f[e].parent),l=Cc(wa[f[e].parent][e],l),e=f[e].parent;l.conversion=k;c[a]=l}}return c},X="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(q){return typeof q}:function(q){return q&&"function"===typeof Symbol&&q.constructor===Symbol&&q!==Symbol.prototype?"symbol":typeof q},y=function(q,h){if(!(q instanceof
  h))throw new TypeError("Cannot call a class as a function");},D=function(){function q(h,c){for(var d=0;d<c.length;d++){var b=c[d];b.enumerable=b.enumerable||!1;b.configurable=!0;"value"in b&&(b.writable=!0);Object.defineProperty(h,b.key,b)}}return function(h,c,d){c&&q(h.prototype,c);d&&q(h,d);return h}}(),Za=function(q,h,c){h in q?Object.defineProperty(q,h,{value:c,enumerable:!0,configurable:!0,writable:!0}):q[h]=c;return q},mb=function b(h,c,d){null===h&&(h=Function.prototype);var a=Object.getOwnPropertyDescriptor(h,
  c);if(void 0===a){if(h=Object.getPrototypeOf(h),null!==h)return b(h,c,d)}else{if("value"in a)return a.value;c=a.get;return void 0===c?void 0:c.call(d)}},M=function(h,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);h.prototype=Object.create(c&&c.prototype,{constructor:{value:h,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(h,c):h.__proto__=c)},K=function(h,c){if(!h)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  return!c||"object"!==typeof c&&"function"!==typeof c?h:c},Qa=function(h){if(Array.isArray(h)){for(var c=0,d=Array(h.length);c<h.length;c++)d[c]=h[c];return d}return Array.from(h)},$a={};Object.keys(wa).forEach(function(h){$a[h]={};Object.defineProperty($a[h],"channels",{value:wa[h].channels});Object.defineProperty($a[h],"labels",{value:wa[h].labels});var c=Mc(h);Object.keys(c).forEach(function(d){var b=c[d];$a[h][d]=Ec(b);$a[h][d].raw=Dc(b)})});var na=$a,rb=[].slice,$b=["keyword","gray","hex"],sb=
  {};Object.keys(na).forEach(function(h){sb[rb.call(na[h].labels).sort().join("")]=h});var Oa={};U.prototype={toString:function(){return this.string()},toJSON:function(){return this[this.model]()},string:function(h){var c=this.model in gb.to?this:this.rgb();c=c.round("number"===typeof h?h:1);h=1===c.valpha?c.color:c.color.concat(this.valpha);return gb.to[c.model](h)},percentString:function(h){h=this.rgb().round("number"===typeof h?h:1);h=1===h.valpha?h.color:h.color.concat(this.valpha);return gb.to.rgb.percent(h)},
  array:function(){return 1===this.valpha?this.color.slice():this.color.concat(this.valpha)},object:function(){for(var h={},c=na[this.model].channels,d=na[this.model].labels,b=0;b<c;b++)h[d[b]]=this.color[b];1!==this.valpha&&(h.alpha=this.valpha);return h},unitArray:function(){var h=this.rgb().color;h[0]/=255;h[1]/=255;h[2]/=255;1!==this.valpha&&h.push(this.valpha);return h},unitObject:function(){var h=this.rgb().object();h.r/=255;h.g/=255;h.b/=255;1!==this.valpha&&(h.alpha=this.valpha);return h},round:function(h){h=
  Math.max(h||0,0);return new U(this.color.map(Fc(h)).concat(this.valpha),this.model)},alpha:function(h){return arguments.length?new U(this.color.concat(Math.max(0,Math.min(1,h))),this.model):this.valpha},red:Q("rgb",0,R(255)),green:Q("rgb",1,R(255)),blue:Q("rgb",2,R(255)),hue:Q(["hsl","hsv","hsl","hwb","hcg"],0,function(h){return(h%360+360)%360}),saturationl:Q("hsl",1,R(100)),lightness:Q("hsl",2,R(100)),saturationv:Q("hsv",1,R(100)),value:Q("hsv",2,R(100)),chroma:Q("hcg",1,R(100)),gray:Q("hcg",2,R(100)),
  white:Q("hwb",1,R(100)),wblack:Q("hwb",2,R(100)),cyan:Q("cmyk",0,R(100)),magenta:Q("cmyk",1,R(100)),yellow:Q("cmyk",2,R(100)),black:Q("cmyk",3,R(100)),x:Q("xyz",0,R(100)),y:Q("xyz",1,R(100)),z:Q("xyz",2,R(100)),l:Q("lab",0,R(100)),a:Q("lab",1),b:Q("lab",2),keyword:function(h){return arguments.length?new U(h):na[this.model].keyword(this.color)},hex:function(h){return arguments.length?new U(h):gb.to.hex(this.rgb().round().color)},rgbNumber:function(){var h=this.rgb().color;return(h[0]&255)<<16|(h[1]&
  255)<<8|h[2]&255},luminosity:function(){for(var h=this.rgb().color,c=[],d=0;d<h.length;d++){var b=h[d]/255;c[d]=.03928>=b?b/12.92:Math.pow((b+.055)/1.055,2.4)}return.2126*c[0]+.7152*c[1]+.0722*c[2]},contrast:function(h){var c=this.luminosity();h=h.luminosity();return c>h?(c+.05)/(h+.05):(h+.05)/(c+.05)},level:function(h){h=this.contrast(h);return 7.1<=h?"AAA":4.5<=h?"AA":""},isDark:function(){var h=this.rgb().color;return 128>(299*h[0]+587*h[1]+114*h[2])/1E3},isLight:function(){return!this.isDark()},
  negate:function(){for(var h=this.rgb(),c=0;3>c;c++)h.color[c]=255-h.color[c];return h},lighten:function(h){var c=this.hsl();c.color[2]+=c.color[2]*h;return c},darken:function(h){var c=this.hsl();c.color[2]-=c.color[2]*h;return c},saturate:function(h){var c=this.hsl();c.color[1]+=c.color[1]*h;return c},desaturate:function(h){var c=this.hsl();c.color[1]-=c.color[1]*h;return c},whiten:function(h){var c=this.hwb();c.color[1]+=c.color[1]*h;return c},blacken:function(h){var c=this.hwb();c.color[2]+=c.color[2]*
  h;return c},grayscale:function(){var h=this.rgb().color;h=.3*h[0]+.59*h[1]+.11*h[2];return U.rgb(h,h,h)},fade:function(h){return this.alpha(this.valpha-this.valpha*h)},opaquer:function(h){return this.alpha(this.valpha+this.valpha*h)},rotate:function(h){var c=this.hsl(),d=c.color[0];d=(d+h)%360;c.color[0]=0>d?360+d:d;return c},mix:function(h,c){if(!h||!h.rgb)throw Error('Argument to "mix" was not a Color instance, but rather an instance of '+("undefined"===typeof h?"undefined":X(h)));h=h.rgb();var d=
  this.rgb();c=void 0===c?.5:c;var b=2*c-1,a=h.alpha()-d.alpha();b=((-1===b*a?b:(b+a)/(1+b*a))+1)/2;a=1-b;return U.rgb(b*h.red()+a*d.red(),b*h.green()+a*d.green(),b*h.blue()+a*d.blue(),h.alpha()*c+d.alpha()*(1-c))}};Object.keys(na).forEach(function(h){if(-1===$b.indexOf(h)){var c=na[h].channels;U.prototype[h]=function(){if(this.model===h)return new U(this);if(arguments.length)return new U(arguments,h);var d="number"===typeof arguments[c]?c:this.valpha;var b=na[this.model][h].raw(this.color);b=Array.isArray(b)?
  b:[b];return new U(b.concat(d),h)};U[h]=function(d){"number"===typeof d&&(d=Hb(rb.call(arguments),c));return new U(d,h)}}});var ka=ha(function(h,c){Object.defineProperty(c,"__esModule",{value:!0});c.setMatrixArrayType=function(a){c.ARRAY_TYPE=b=a};c.toRadian=function(f){return f*a};c.equals=function(a,b){return Math.abs(a-b)<=d*Math.max(1,Math.abs(a),Math.abs(b))};c.RANDOM=c.ARRAY_TYPE=c.EPSILON=void 0;var d=1E-6;c.EPSILON=d;var b="undefined"!==typeof Float32Array?Float32Array:Array;c.ARRAY_TYPE=
  b;c.RANDOM=Math.random;var a=Math.PI/180});Y(ka);var kc=ha(function(h,c){function d(a,b,e){var f=b[0],c=b[1],d=b[2];b=b[3];var g=e[0],k=e[1],m=e[2];e=e[3];a[0]=f*g+d*k;a[1]=c*g+b*k;a[2]=f*m+d*e;a[3]=c*m+b*e;return a}function b(a,b,e){a[0]=b[0]-e[0];a[1]=b[1]-e[1];a[2]=b[2]-e[2];a[3]=b[3]-e[3];return a}Object.defineProperty(c,"__esModule",{value:!0});c.create=function(){var f=new a.ARRAY_TYPE(4);a.ARRAY_TYPE!=Float32Array&&(f[1]=0,f[2]=0);f[0]=1;f[3]=1;return f};c.clone=function(f){var b=new a.ARRAY_TYPE(4);
  b[0]=f[0];b[1]=f[1];b[2]=f[2];b[3]=f[3];return b};c.copy=function(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];return a};c.identity=function(a){a[0]=1;a[1]=0;a[2]=0;a[3]=1;return a};c.fromValues=function(f,b,e,c){var l=new a.ARRAY_TYPE(4);l[0]=f;l[1]=b;l[2]=e;l[3]=c;return l};c.set=function(a,b,e,c,d){a[0]=b;a[1]=e;a[2]=c;a[3]=d;return a};c.transpose=function(a,b){if(a===b){var e=b[1];a[1]=b[2];a[2]=e}else a[0]=b[0],a[1]=b[2],a[2]=b[1],a[3]=b[3];return a};c.invert=function(a,b){var e=b[0],f=b[1],
  c=b[2];b=b[3];var d=e*b-c*f;if(!d)return null;d=1/d;a[0]=b*d;a[1]=-f*d;a[2]=-c*d;a[3]=e*d;return a};c.adjoint=function(a,b){var e=b[0];a[0]=b[3];a[1]=-b[1];a[2]=-b[2];a[3]=e;return a};c.determinant=function(a){return a[0]*a[3]-a[2]*a[1]};c.multiply=d;c.rotate=function(a,b,e){var f=b[0],c=b[1],d=b[2];b=b[3];var g=Math.sin(e);e=Math.cos(e);a[0]=f*e+d*g;a[1]=c*e+b*g;a[2]=f*-g+d*e;a[3]=c*-g+b*e;return a};c.scale=function(a,b,e){var f=b[1],c=b[2],d=b[3],g=e[0];e=e[1];a[0]=b[0]*g;a[1]=f*g;a[2]=c*e;a[3]=
  d*e;return a};c.fromRotation=function(a,b){var e=Math.sin(b);b=Math.cos(b);a[0]=b;a[1]=e;a[2]=-e;a[3]=b;return a};c.fromScaling=function(a,b){a[0]=b[0];a[1]=0;a[2]=0;a[3]=b[1];return a};c.str=function(a){return"mat2("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+")"};c.frob=function(a){return Math.sqrt(Math.pow(a[0],2)+Math.pow(a[1],2)+Math.pow(a[2],2)+Math.pow(a[3],2))};c.LDU=function(a,b,e,c){a[2]=c[2]/c[0];e[0]=c[0];e[1]=c[1];e[3]=c[3]-a[2]*e[1];return[a,b,e]};c.add=function(a,b,e){a[0]=b[0]+e[0];a[1]=b[1]+
  e[1];a[2]=b[2]+e[2];a[3]=b[3]+e[3];return a};c.subtract=b;c.exactEquals=function(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]};c.equals=function(b,c){var e=b[0],f=b[1],d=b[2];b=b[3];var k=c[0],g=c[1],r=c[2];c=c[3];return Math.abs(e-k)<=a.EPSILON*Math.max(1,Math.abs(e),Math.abs(k))&&Math.abs(f-g)<=a.EPSILON*Math.max(1,Math.abs(f),Math.abs(g))&&Math.abs(d-r)<=a.EPSILON*Math.max(1,Math.abs(d),Math.abs(r))&&Math.abs(b-c)<=a.EPSILON*Math.max(1,Math.abs(b),Math.abs(c))};c.multiplyScalar=
  function(a,b,e){a[0]=b[0]*e;a[1]=b[1]*e;a[2]=b[2]*e;a[3]=b[3]*e;return a};c.multiplyScalarAndAdd=function(a,b,e,c){a[0]=b[0]+e[0]*c;a[1]=b[1]+e[1]*c;a[2]=b[2]+e[2]*c;a[3]=b[3]+e[3]*c;return a};c.sub=c.mul=void 0;var a=function(a){if(a&&a.__esModule)return a;var b={};if(null!=a)for(var e in a)if(Object.prototype.hasOwnProperty.call(a,e)){var f=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(a,e):{};f.get||f.set?Object.defineProperty(b,e,f):b[e]=a[e]}b.default=
  a;return b}(ka);c.mul=d;c.sub=b});Y(kc);var lc=ha(function(h,c){function d(a,b,e){var f=b[0],c=b[1],d=b[2],g=b[3],r=b[4];b=b[5];var m=e[0],t=e[1],k=e[2],h=e[3],z=e[4];e=e[5];a[0]=f*m+d*t;a[1]=c*m+g*t;a[2]=f*k+d*h;a[3]=c*k+g*h;a[4]=f*z+d*e+r;a[5]=c*z+g*e+b;return a}function b(a,b,e){a[0]=b[0]-e[0];a[1]=b[1]-e[1];a[2]=b[2]-e[2];a[3]=b[3]-e[3];a[4]=b[4]-e[4];a[5]=b[5]-e[5];return a}Object.defineProperty(c,"__esModule",{value:!0});c.create=function(){var b=new a.ARRAY_TYPE(6);a.ARRAY_TYPE!=Float32Array&&
  (b[1]=0,b[2]=0,b[4]=0,b[5]=0);b[0]=1;b[3]=1;return b};c.clone=function(b){var f=new a.ARRAY_TYPE(6);f[0]=b[0];f[1]=b[1];f[2]=b[2];f[3]=b[3];f[4]=b[4];f[5]=b[5];return f};c.copy=function(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];a[4]=b[4];a[5]=b[5];return a};c.identity=function(a){a[0]=1;a[1]=0;a[2]=0;a[3]=1;a[4]=0;a[5]=0;return a};c.fromValues=function(b,c,e,l,d,h){var f=new a.ARRAY_TYPE(6);f[0]=b;f[1]=c;f[2]=e;f[3]=l;f[4]=d;f[5]=h;return f};c.set=function(a,b,e,c,d,h,g){a[0]=b;a[1]=e;a[2]=c;a[3]=
  d;a[4]=h;a[5]=g;return a};c.invert=function(a,b){var e=b[0],f=b[1],c=b[2],d=b[3],g=b[4];b=b[5];var r=e*d-f*c;if(!r)return null;r=1/r;a[0]=d*r;a[1]=-f*r;a[2]=-c*r;a[3]=e*r;a[4]=(c*b-d*g)*r;a[5]=(f*g-e*b)*r;return a};c.determinant=function(a){return a[0]*a[3]-a[1]*a[2]};c.multiply=d;c.rotate=function(a,b,e){var f=b[0],c=b[1],d=b[2],g=b[3],r=b[4];b=b[5];var m=Math.sin(e);e=Math.cos(e);a[0]=f*e+d*m;a[1]=c*e+g*m;a[2]=f*-m+d*e;a[3]=c*-m+g*e;a[4]=r;a[5]=b;return a};c.scale=function(a,b,e){var f=b[1],c=b[2],
  d=b[3],g=b[4],r=b[5],m=e[0];e=e[1];a[0]=b[0]*m;a[1]=f*m;a[2]=c*e;a[3]=d*e;a[4]=g;a[5]=r;return a};c.translate=function(a,b,e){var f=b[0],c=b[1],d=b[2],g=b[3],r=b[4];b=b[5];var m=e[0];e=e[1];a[0]=f;a[1]=c;a[2]=d;a[3]=g;a[4]=f*m+d*e+r;a[5]=c*m+g*e+b;return a};c.fromRotation=function(a,b){var e=Math.sin(b);b=Math.cos(b);a[0]=b;a[1]=e;a[2]=-e;a[3]=b;a[4]=0;a[5]=0;return a};c.fromScaling=function(a,b){a[0]=b[0];a[1]=0;a[2]=0;a[3]=b[1];a[4]=0;a[5]=0;return a};c.fromTranslation=function(a,b){a[0]=1;a[1]=
  0;a[2]=0;a[3]=1;a[4]=b[0];a[5]=b[1];return a};c.str=function(a){return"mat2d("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", "+a[4]+", "+a[5]+")"};c.frob=function(a){return Math.sqrt(Math.pow(a[0],2)+Math.pow(a[1],2)+Math.pow(a[2],2)+Math.pow(a[3],2)+Math.pow(a[4],2)+Math.pow(a[5],2)+1)};c.add=function(a,b,e){a[0]=b[0]+e[0];a[1]=b[1]+e[1];a[2]=b[2]+e[2];a[3]=b[3]+e[3];a[4]=b[4]+e[4];a[5]=b[5]+e[5];return a};c.subtract=b;c.multiplyScalar=function(a,b,e){a[0]=b[0]*e;a[1]=b[1]*e;a[2]=b[2]*e;a[3]=b[3]*e;a[4]=
  b[4]*e;a[5]=b[5]*e;return a};c.multiplyScalarAndAdd=function(a,b,e,c){a[0]=b[0]+e[0]*c;a[1]=b[1]+e[1]*c;a[2]=b[2]+e[2]*c;a[3]=b[3]+e[3]*c;a[4]=b[4]+e[4]*c;a[5]=b[5]+e[5]*c;return a};c.exactEquals=function(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]&&a[4]===b[4]&&a[5]===b[5]};c.equals=function(b,c){var e=b[0],f=b[1],d=b[2],k=b[3],g=b[4];b=b[5];var r=c[0],m=c[1],t=c[2],B=c[3],h=c[4];c=c[5];return Math.abs(e-r)<=a.EPSILON*Math.max(1,Math.abs(e),Math.abs(r))&&Math.abs(f-m)<=a.EPSILON*
  Math.max(1,Math.abs(f),Math.abs(m))&&Math.abs(d-t)<=a.EPSILON*Math.max(1,Math.abs(d),Math.abs(t))&&Math.abs(k-B)<=a.EPSILON*Math.max(1,Math.abs(k),Math.abs(B))&&Math.abs(g-h)<=a.EPSILON*Math.max(1,Math.abs(g),Math.abs(h))&&Math.abs(b-c)<=a.EPSILON*Math.max(1,Math.abs(b),Math.abs(c))};c.sub=c.mul=void 0;var a=function(a){if(a&&a.__esModule)return a;var b={};if(null!=a)for(var e in a)if(Object.prototype.hasOwnProperty.call(a,e)){var c=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(a,
  e):{};c.get||c.set?Object.defineProperty(b,e,c):b[e]=a[e]}b.default=a;return b}(ka);c.mul=d;c.sub=b});Y(lc);var Mb=ha(function(h,c){function d(a,b,e){var c=b[0],f=b[1],d=b[2],g=b[3],r=b[4],m=b[5],t=b[6],k=b[7];b=b[8];var h=e[0],z=e[1],w=e[2],G=e[3],A=e[4],C=e[5],H=e[6],F=e[7];e=e[8];a[0]=h*c+z*g+w*t;a[1]=h*f+z*r+w*k;a[2]=h*d+z*m+w*b;a[3]=G*c+A*g+C*t;a[4]=G*f+A*r+C*k;a[5]=G*d+A*m+C*b;a[6]=H*c+F*g+e*t;a[7]=H*f+F*r+e*k;a[8]=H*d+F*m+e*b;return a}function b(a,b,e){a[0]=b[0]-e[0];a[1]=b[1]-e[1];a[2]=b[2]-
  e[2];a[3]=b[3]-e[3];a[4]=b[4]-e[4];a[5]=b[5]-e[5];a[6]=b[6]-e[6];a[7]=b[7]-e[7];a[8]=b[8]-e[8];return a}Object.defineProperty(c,"__esModule",{value:!0});c.create=function(){var b=new a.ARRAY_TYPE(9);a.ARRAY_TYPE!=Float32Array&&(b[1]=0,b[2]=0,b[3]=0,b[5]=0,b[6]=0,b[7]=0);b[0]=1;b[4]=1;b[8]=1;return b};c.fromMat4=function(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[4];a[4]=b[5];a[5]=b[6];a[6]=b[8];a[7]=b[9];a[8]=b[10];return a};c.clone=function(b){var c=new a.ARRAY_TYPE(9);c[0]=b[0];c[1]=b[1];c[2]=b[2];
  c[3]=b[3];c[4]=b[4];c[5]=b[5];c[6]=b[6];c[7]=b[7];c[8]=b[8];return c};c.copy=function(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];a[4]=b[4];a[5]=b[5];a[6]=b[6];a[7]=b[7];a[8]=b[8];return a};c.fromValues=function(b,c,e,d,h,p,g,r,m){var f=new a.ARRAY_TYPE(9);f[0]=b;f[1]=c;f[2]=e;f[3]=d;f[4]=h;f[5]=p;f[6]=g;f[7]=r;f[8]=m;return f};c.set=function(a,b,e,c,d,h,g,r,m,t){a[0]=b;a[1]=e;a[2]=c;a[3]=d;a[4]=h;a[5]=g;a[6]=r;a[7]=m;a[8]=t;return a};c.identity=function(a){a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=1;a[5]=
  0;a[6]=0;a[7]=0;a[8]=1;return a};c.transpose=function(a,b){if(a===b){var e=b[1],c=b[2],f=b[5];a[1]=b[3];a[2]=b[6];a[3]=e;a[5]=b[7];a[6]=c;a[7]=f}else a[0]=b[0],a[1]=b[3],a[2]=b[6],a[3]=b[1],a[4]=b[4],a[5]=b[7],a[6]=b[2],a[7]=b[5],a[8]=b[8];return a};c.invert=function(a,b){var e=b[0],c=b[1],f=b[2],d=b[3],g=b[4],r=b[5],m=b[6],t=b[7];b=b[8];var B=b*g-r*t,h=-b*d+r*m,k=t*d-g*m,w=e*B+c*h+f*k;if(!w)return null;w=1/w;a[0]=B*w;a[1]=(-b*c+f*t)*w;a[2]=(r*c-f*g)*w;a[3]=h*w;a[4]=(b*e-f*m)*w;a[5]=(-r*e+f*d)*w;
  a[6]=k*w;a[7]=(-t*e+c*m)*w;a[8]=(g*e-c*d)*w;return a};c.adjoint=function(a,b){var e=b[0],c=b[1],f=b[2],d=b[3],g=b[4],r=b[5],m=b[6],t=b[7];b=b[8];a[0]=g*b-r*t;a[1]=f*t-c*b;a[2]=c*r-f*g;a[3]=r*m-d*b;a[4]=e*b-f*m;a[5]=f*d-e*r;a[6]=d*t-g*m;a[7]=c*m-e*t;a[8]=e*g-c*d;return a};c.determinant=function(a){var b=a[3],e=a[4],c=a[5],f=a[6],d=a[7],g=a[8];return a[0]*(g*e-c*d)+a[1]*(-g*b+c*f)+a[2]*(d*b-e*f)};c.multiply=d;c.translate=function(a,b,e){var c=b[0],f=b[1],d=b[2],g=b[3],r=b[4],m=b[5],t=b[6],B=b[7];b=
  b[8];var h=e[0];e=e[1];a[0]=c;a[1]=f;a[2]=d;a[3]=g;a[4]=r;a[5]=m;a[6]=h*c+e*g+t;a[7]=h*f+e*r+B;a[8]=h*d+e*m+b;return a};c.rotate=function(a,b,e){var c=b[0],f=b[1],d=b[2],g=b[3],r=b[4],m=b[5],t=b[6],B=b[7];b=b[8];var h=Math.sin(e);e=Math.cos(e);a[0]=e*c+h*g;a[1]=e*f+h*r;a[2]=e*d+h*m;a[3]=e*g-h*c;a[4]=e*r-h*f;a[5]=e*m-h*d;a[6]=t;a[7]=B;a[8]=b;return a};c.scale=function(a,b,e){var c=e[0];e=e[1];a[0]=c*b[0];a[1]=c*b[1];a[2]=c*b[2];a[3]=e*b[3];a[4]=e*b[4];a[5]=e*b[5];a[6]=b[6];a[7]=b[7];a[8]=b[8];return a};
  c.fromTranslation=function(a,b){a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=1;a[5]=0;a[6]=b[0];a[7]=b[1];a[8]=1;return a};c.fromRotation=function(a,b){var e=Math.sin(b);b=Math.cos(b);a[0]=b;a[1]=e;a[2]=0;a[3]=-e;a[4]=b;a[5]=0;a[6]=0;a[7]=0;a[8]=1;return a};c.fromScaling=function(a,b){a[0]=b[0];a[1]=0;a[2]=0;a[3]=0;a[4]=b[1];a[5]=0;a[6]=0;a[7]=0;a[8]=1;return a};c.fromMat2d=function(a,b){a[0]=b[0];a[1]=b[1];a[2]=0;a[3]=b[2];a[4]=b[3];a[5]=0;a[6]=b[4];a[7]=b[5];a[8]=1;return a};c.fromQuat=function(a,b){var e=
  b[0],c=b[1],f=b[2];b=b[3];var d=e+e,g=c+c,r=f+f;e*=d;var m=c*d;c*=g;var t=f*d,B=f*g;f*=r;d*=b;g*=b;b*=r;a[0]=1-c-f;a[3]=m-b;a[6]=t+g;a[1]=m+b;a[4]=1-e-f;a[7]=B-d;a[2]=t-g;a[5]=B+d;a[8]=1-e-c;return a};c.normalFromMat4=function(a,b){var e=b[0],c=b[1],f=b[2],d=b[3],g=b[4],r=b[5],m=b[6],t=b[7],B=b[8],h=b[9],k=b[10],w=b[11],G=b[12],A=b[13],C=b[14];b=b[15];var H=e*r-c*g,F=e*m-f*g,ab=e*t-d*g,P=c*m-f*r,I=c*t-d*r,J=f*t-d*m,v=B*A-h*G,y=B*C-k*G;B=B*b-w*G;var D=h*C-k*A;h=h*b-w*A;k=k*b-w*C;w=H*k-F*h+ab*D+P*B-
  I*y+J*v;if(!w)return null;w=1/w;a[0]=(r*k-m*h+t*D)*w;a[1]=(m*B-g*k-t*y)*w;a[2]=(g*h-r*B+t*v)*w;a[3]=(f*h-c*k-d*D)*w;a[4]=(e*k-f*B+d*y)*w;a[5]=(c*B-e*h-d*v)*w;a[6]=(A*J-C*I+b*P)*w;a[7]=(C*ab-G*J-b*F)*w;a[8]=(G*I-A*ab+b*H)*w;return a};c.projection=function(a,b,e){a[0]=2/b;a[1]=0;a[2]=0;a[3]=0;a[4]=-2/e;a[5]=0;a[6]=-1;a[7]=1;a[8]=1;return a};c.str=function(a){return"mat3("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", "+a[4]+", "+a[5]+", "+a[6]+", "+a[7]+", "+a[8]+")"};c.frob=function(a){return Math.sqrt(Math.pow(a[0],
  2)+Math.pow(a[1],2)+Math.pow(a[2],2)+Math.pow(a[3],2)+Math.pow(a[4],2)+Math.pow(a[5],2)+Math.pow(a[6],2)+Math.pow(a[7],2)+Math.pow(a[8],2))};c.add=function(a,b,e){a[0]=b[0]+e[0];a[1]=b[1]+e[1];a[2]=b[2]+e[2];a[3]=b[3]+e[3];a[4]=b[4]+e[4];a[5]=b[5]+e[5];a[6]=b[6]+e[6];a[7]=b[7]+e[7];a[8]=b[8]+e[8];return a};c.subtract=b;c.multiplyScalar=function(a,b,e){a[0]=b[0]*e;a[1]=b[1]*e;a[2]=b[2]*e;a[3]=b[3]*e;a[4]=b[4]*e;a[5]=b[5]*e;a[6]=b[6]*e;a[7]=b[7]*e;a[8]=b[8]*e;return a};c.multiplyScalarAndAdd=function(a,
  b,e,c){a[0]=b[0]+e[0]*c;a[1]=b[1]+e[1]*c;a[2]=b[2]+e[2]*c;a[3]=b[3]+e[3]*c;a[4]=b[4]+e[4]*c;a[5]=b[5]+e[5]*c;a[6]=b[6]+e[6]*c;a[7]=b[7]+e[7]*c;a[8]=b[8]+e[8]*c;return a};c.exactEquals=function(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]&&a[4]===b[4]&&a[5]===b[5]&&a[6]===b[6]&&a[7]===b[7]&&a[8]===b[8]};c.equals=function(b,c){var e=b[0],d=b[1],f=b[2],h=b[3],g=b[4],r=b[5],m=b[6],t=b[7];b=b[8];var B=c[0],Ca=c[1],k=c[2],w=c[3],G=c[4],A=c[5],C=c[6],H=c[7];c=c[8];return Math.abs(e-B)<=
  a.EPSILON*Math.max(1,Math.abs(e),Math.abs(B))&&Math.abs(d-Ca)<=a.EPSILON*Math.max(1,Math.abs(d),Math.abs(Ca))&&Math.abs(f-k)<=a.EPSILON*Math.max(1,Math.abs(f),Math.abs(k))&&Math.abs(h-w)<=a.EPSILON*Math.max(1,Math.abs(h),Math.abs(w))&&Math.abs(g-G)<=a.EPSILON*Math.max(1,Math.abs(g),Math.abs(G))&&Math.abs(r-A)<=a.EPSILON*Math.max(1,Math.abs(r),Math.abs(A))&&Math.abs(m-C)<=a.EPSILON*Math.max(1,Math.abs(m),Math.abs(C))&&Math.abs(t-H)<=a.EPSILON*Math.max(1,Math.abs(t),Math.abs(H))&&Math.abs(b-c)<=a.EPSILON*
  Math.max(1,Math.abs(b),Math.abs(c))};c.sub=c.mul=void 0;var a=function(a){if(a&&a.__esModule)return a;var b={};if(null!=a)for(var e in a)if(Object.prototype.hasOwnProperty.call(a,e)){var c=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(a,e):{};c.get||c.set?Object.defineProperty(b,e,c):b[e]=a[e]}b.default=a;return b}(ka);c.mul=d;c.sub=b});Y(Mb);var Nb=ha(function(h,c){function d(a){a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=1;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=1;
  a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a}function b(a,b,c){var e=b[0],g=b[1],d=b[2],f=b[3],l=b[4],B=b[5],h=b[6],n=b[7],k=b[8],G=b[9],A=b[10],C=b[11],H=b[12],F=b[13],ab=b[14];b=b[15];var P=c[0],I=c[1],J=c[2],v=c[3];a[0]=P*e+I*l+J*k+v*H;a[1]=P*g+I*B+J*G+v*F;a[2]=P*d+I*h+J*A+v*ab;a[3]=P*f+I*n+J*C+v*b;P=c[4];I=c[5];J=c[6];v=c[7];a[4]=P*e+I*l+J*k+v*H;a[5]=P*g+I*B+J*G+v*F;a[6]=P*d+I*h+J*A+v*ab;a[7]=P*f+I*n+J*C+v*b;P=c[8];I=c[9];J=c[10];v=c[11];a[8]=P*e+I*l+J*k+v*H;a[9]=P*g+I*B+J*G+v*F;a[10]=P*d+
  I*h+J*A+v*ab;a[11]=P*f+I*n+J*C+v*b;P=c[12];I=c[13];J=c[14];v=c[15];a[12]=P*e+I*l+J*k+v*H;a[13]=P*g+I*B+J*G+v*F;a[14]=P*d+I*h+J*A+v*ab;a[15]=P*f+I*n+J*C+v*b;return a}function a(a,b,c){var e=b[0],g=b[1],d=b[2],f=b[3],l=e+e,B=g+g,h=d+d;b=e*l;var n=e*B;e*=h;var k=g*B;g*=h;d*=h;l*=f;B*=f;f*=h;a[0]=1-(k+d);a[1]=n+f;a[2]=e-B;a[3]=0;a[4]=n-f;a[5]=1-(b+d);a[6]=g+l;a[7]=0;a[8]=e+B;a[9]=g-l;a[10]=1-(b+k);a[11]=0;a[12]=c[0];a[13]=c[1];a[14]=c[2];a[15]=1;return a}function f(a,b,c){a[0]=b[0]-c[0];a[1]=b[1]-c[1];
  a[2]=b[2]-c[2];a[3]=b[3]-c[3];a[4]=b[4]-c[4];a[5]=b[5]-c[5];a[6]=b[6]-c[6];a[7]=b[7]-c[7];a[8]=b[8]-c[8];a[9]=b[9]-c[9];a[10]=b[10]-c[10];a[11]=b[11]-c[11];a[12]=b[12]-c[12];a[13]=b[13]-c[13];a[14]=b[14]-c[14];a[15]=b[15]-c[15];return a}Object.defineProperty(c,"__esModule",{value:!0});c.create=function(){var a=new k.ARRAY_TYPE(16);k.ARRAY_TYPE!=Float32Array&&(a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[11]=0,a[12]=0,a[13]=0,a[14]=0);a[0]=1;a[5]=1;a[10]=1;a[15]=1;return a};c.clone=function(a){var b=
  new k.ARRAY_TYPE(16);b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]=a[8];b[9]=a[9];b[10]=a[10];b[11]=a[11];b[12]=a[12];b[13]=a[13];b[14]=a[14];b[15]=a[15];return b};c.copy=function(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];a[4]=b[4];a[5]=b[5];a[6]=b[6];a[7]=b[7];a[8]=b[8];a[9]=b[9];a[10]=b[10];a[11]=b[11];a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=b[15];return a};c.fromValues=function(a,b,c,d,g,f,m,t,B,h,z,w,G,A,C,H){var e=new k.ARRAY_TYPE(16);e[0]=a;e[1]=b;
  e[2]=c;e[3]=d;e[4]=g;e[5]=f;e[6]=m;e[7]=t;e[8]=B;e[9]=h;e[10]=z;e[11]=w;e[12]=G;e[13]=A;e[14]=C;e[15]=H;return e};c.set=function(a,b,c,d,g,f,m,t,B,h,k,w,G,A,C,H,F){a[0]=b;a[1]=c;a[2]=d;a[3]=g;a[4]=f;a[5]=m;a[6]=t;a[7]=B;a[8]=h;a[9]=k;a[10]=w;a[11]=G;a[12]=A;a[13]=C;a[14]=H;a[15]=F;return a};c.identity=d;c.transpose=function(a,b){if(a===b){var e=b[1],c=b[2],g=b[3],d=b[6],f=b[7],t=b[11];a[1]=b[4];a[2]=b[8];a[3]=b[12];a[4]=e;a[6]=b[9];a[7]=b[13];a[8]=c;a[9]=d;a[11]=b[14];a[12]=g;a[13]=f;a[14]=t}else a[0]=
  b[0],a[1]=b[4],a[2]=b[8],a[3]=b[12],a[4]=b[1],a[5]=b[5],a[6]=b[9],a[7]=b[13],a[8]=b[2],a[9]=b[6],a[10]=b[10],a[11]=b[14],a[12]=b[3],a[13]=b[7],a[14]=b[11],a[15]=b[15];return a};c.invert=function(a,b){var c=b[0],e=b[1],g=b[2],d=b[3],f=b[4],t=b[5],l=b[6],h=b[7],k=b[8],w=b[9],G=b[10],A=b[11],C=b[12],H=b[13],F=b[14];b=b[15];var v=c*t-e*f,P=c*l-g*f,I=c*h-d*f,J=e*l-g*t,y=e*h-d*t,D=g*h-d*l,M=k*H-w*C,K=k*F-G*C,Q=k*b-A*C,S=w*F-G*H,T=w*b-A*H,X=G*b-A*F,N=v*X-P*T+I*S+J*Q-y*K+D*M;if(!N)return null;N=1/N;a[0]=
  (t*X-l*T+h*S)*N;a[1]=(g*T-e*X-d*S)*N;a[2]=(H*D-F*y+b*J)*N;a[3]=(G*y-w*D-A*J)*N;a[4]=(l*Q-f*X-h*K)*N;a[5]=(c*X-g*Q+d*K)*N;a[6]=(F*I-C*D-b*P)*N;a[7]=(k*D-G*I+A*P)*N;a[8]=(f*T-t*Q+h*M)*N;a[9]=(e*Q-c*T-d*M)*N;a[10]=(C*y-H*I+b*v)*N;a[11]=(w*I-k*y-A*v)*N;a[12]=(t*K-f*S-l*M)*N;a[13]=(c*S-e*K+g*M)*N;a[14]=(H*P-C*J-F*v)*N;a[15]=(k*J-w*P+G*v)*N;return a};c.adjoint=function(a,b){var c=b[0],e=b[1],g=b[2],d=b[3],f=b[4],t=b[5],l=b[6],h=b[7],k=b[8],w=b[9],G=b[10],A=b[11],C=b[12],H=b[13],F=b[14];b=b[15];a[0]=t*(G*
  b-A*F)-w*(l*b-h*F)+H*(l*A-h*G);a[1]=-(e*(G*b-A*F)-w*(g*b-d*F)+H*(g*A-d*G));a[2]=e*(l*b-h*F)-t*(g*b-d*F)+H*(g*h-d*l);a[3]=-(e*(l*A-h*G)-t*(g*A-d*G)+w*(g*h-d*l));a[4]=-(f*(G*b-A*F)-k*(l*b-h*F)+C*(l*A-h*G));a[5]=c*(G*b-A*F)-k*(g*b-d*F)+C*(g*A-d*G);a[6]=-(c*(l*b-h*F)-f*(g*b-d*F)+C*(g*h-d*l));a[7]=c*(l*A-h*G)-f*(g*A-d*G)+k*(g*h-d*l);a[8]=f*(w*b-A*H)-k*(t*b-h*H)+C*(t*A-h*w);a[9]=-(c*(w*b-A*H)-k*(e*b-d*H)+C*(e*A-d*w));a[10]=c*(t*b-h*H)-f*(e*b-d*H)+C*(e*h-d*t);a[11]=-(c*(t*A-h*w)-f*(e*A-d*w)+k*(e*h-d*t));
  a[12]=-(f*(w*F-G*H)-k*(t*F-l*H)+C*(t*G-l*w));a[13]=c*(w*F-G*H)-k*(e*F-g*H)+C*(e*G-g*w);a[14]=-(c*(t*F-l*H)-f*(e*F-g*H)+C*(e*l-g*t));a[15]=c*(t*G-l*w)-f*(e*G-g*w)+k*(e*l-g*t);return a};c.determinant=function(a){var b=a[0],c=a[1],e=a[2],g=a[3],d=a[4],f=a[5],t=a[6],h=a[7],k=a[8],z=a[9],w=a[10],G=a[11],A=a[12],C=a[13],H=a[14];a=a[15];return(b*f-c*d)*(w*a-G*H)-(b*t-e*d)*(z*a-G*C)+(b*h-g*d)*(z*H-w*C)+(c*t-e*f)*(k*a-G*A)-(c*h-g*f)*(k*H-w*A)+(e*h-g*t)*(k*C-z*A)};c.multiply=b;c.translate=function(a,b,c){var e=
  c[0],g=c[1];c=c[2];if(b===a)a[12]=b[0]*e+b[4]*g+b[8]*c+b[12],a[13]=b[1]*e+b[5]*g+b[9]*c+b[13],a[14]=b[2]*e+b[6]*g+b[10]*c+b[14],a[15]=b[3]*e+b[7]*g+b[11]*c+b[15];else{var d=b[0];var f=b[1];var t=b[2];var l=b[3];var h=b[4];var k=b[5];var n=b[6];var G=b[7];var A=b[8];var C=b[9];var H=b[10];var F=b[11];a[0]=d;a[1]=f;a[2]=t;a[3]=l;a[4]=h;a[5]=k;a[6]=n;a[7]=G;a[8]=A;a[9]=C;a[10]=H;a[11]=F;a[12]=d*e+h*g+A*c+b[12];a[13]=f*e+k*g+C*c+b[13];a[14]=t*e+n*g+H*c+b[14];a[15]=l*e+G*g+F*c+b[15]}return a};c.scale=
  function(a,b,c){var e=c[0],g=c[1];c=c[2];a[0]=b[0]*e;a[1]=b[1]*e;a[2]=b[2]*e;a[3]=b[3]*e;a[4]=b[4]*g;a[5]=b[5]*g;a[6]=b[6]*g;a[7]=b[7]*g;a[8]=b[8]*c;a[9]=b[9]*c;a[10]=b[10]*c;a[11]=b[11]*c;a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=b[15];return a};c.rotate=function(a,b,c,d){var e=d[0],f=d[1];d=d[2];var m=Math.sqrt(e*e+f*f+d*d);if(m<k.EPSILON)return null;m=1/m;e*=m;f*=m;d*=m;var t=Math.sin(c);var h=Math.cos(c);var l=1-h;c=b[0];m=b[1];var n=b[2];var w=b[3];var p=b[4];var A=b[5];var C=b[6];var H=b[7];
  var F=b[8];var v=b[9];var P=b[10];var I=b[11];var J=e*e*l+h;var y=f*e*l+d*t;var D=d*e*l-f*t;var M=e*f*l-d*t;var K=f*f*l+h;var Q=d*f*l+e*t;var S=e*d*l+f*t;e=f*d*l-e*t;f=d*d*l+h;a[0]=c*J+p*y+F*D;a[1]=m*J+A*y+v*D;a[2]=n*J+C*y+P*D;a[3]=w*J+H*y+I*D;a[4]=c*M+p*K+F*Q;a[5]=m*M+A*K+v*Q;a[6]=n*M+C*K+P*Q;a[7]=w*M+H*K+I*Q;a[8]=c*S+p*e+F*f;a[9]=m*S+A*e+v*f;a[10]=n*S+C*e+P*f;a[11]=w*S+H*e+I*f;b!==a&&(a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15]);return a};c.rotateX=function(a,b,c){var e=Math.sin(c);c=Math.cos(c);
  var g=b[4],d=b[5],f=b[6],t=b[7],h=b[8],l=b[9],k=b[10],n=b[11];b!==a&&(a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[3],a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15]);a[4]=g*c+h*e;a[5]=d*c+l*e;a[6]=f*c+k*e;a[7]=t*c+n*e;a[8]=h*c-g*e;a[9]=l*c-d*e;a[10]=k*c-f*e;a[11]=n*c-t*e;return a};c.rotateY=function(a,b,c){var e=Math.sin(c);c=Math.cos(c);var g=b[0],d=b[1],f=b[2],t=b[3],h=b[8],l=b[9],k=b[10],n=b[11];b!==a&&(a[4]=b[4],a[5]=b[5],a[6]=b[6],a[7]=b[7],a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15]);a[0]=g*c-
  h*e;a[1]=d*c-l*e;a[2]=f*c-k*e;a[3]=t*c-n*e;a[8]=g*e+h*c;a[9]=d*e+l*c;a[10]=f*e+k*c;a[11]=t*e+n*c;return a};c.rotateZ=function(a,b,c){var e=Math.sin(c);c=Math.cos(c);var d=b[0],f=b[1],m=b[2],t=b[3],h=b[4],l=b[5],k=b[6],n=b[7];b!==a&&(a[8]=b[8],a[9]=b[9],a[10]=b[10],a[11]=b[11],a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15]);a[0]=d*c+h*e;a[1]=f*c+l*e;a[2]=m*c+k*e;a[3]=t*c+n*e;a[4]=h*c-d*e;a[5]=l*c-f*e;a[6]=k*c-m*e;a[7]=n*c-t*e;return a};c.fromTranslation=function(a,b){a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=
  0;a[5]=1;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=1;a[11]=0;a[12]=b[0];a[13]=b[1];a[14]=b[2];a[15]=1;return a};c.fromScaling=function(a,b){a[0]=b[0];a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=b[1];a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=b[2];a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a};c.fromRotation=function(a,b,c){var e=c[0],d=c[1];c=c[2];var f=Math.sqrt(e*e+d*d+c*c);if(f<k.EPSILON)return null;f=1/f;e*=f;d*=f;c*=f;f=Math.sin(b);b=Math.cos(b);var m=1-b;a[0]=e*e*m+b;a[1]=d*e*m+c*f;a[2]=c*e*m-d*f;a[3]=0;a[4]=e*d*m-
  c*f;a[5]=d*d*m+b;a[6]=c*d*m+e*f;a[7]=0;a[8]=e*c*m+d*f;a[9]=d*c*m-e*f;a[10]=c*c*m+b;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a};c.fromXRotation=function(a,b){var c=Math.sin(b);b=Math.cos(b);a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=b;a[6]=c;a[7]=0;a[8]=0;a[9]=-c;a[10]=b;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a};c.fromYRotation=function(a,b){var c=Math.sin(b);b=Math.cos(b);a[0]=b;a[1]=0;a[2]=-c;a[3]=0;a[4]=0;a[5]=1;a[6]=0;a[7]=0;a[8]=c;a[9]=0;a[10]=b;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=
  1;return a};c.fromZRotation=function(a,b){var c=Math.sin(b);b=Math.cos(b);a[0]=b;a[1]=c;a[2]=0;a[3]=0;a[4]=-c;a[5]=b;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=1;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a};c.fromRotationTranslation=a;c.fromQuat2=function(b,c){var e=new k.ARRAY_TYPE(3),d=-c[0],g=-c[1],f=-c[2],m=c[3],t=c[4],h=c[5],l=c[6],z=c[7],w=d*d+g*g+f*f+m*m;0<w?(e[0]=2*(t*m+z*d+h*f-l*g)/w,e[1]=2*(h*m+z*g+l*d-t*f)/w,e[2]=2*(l*m+z*f+t*g-h*d)/w):(e[0]=2*(t*m+z*d+h*f-l*g),e[1]=2*(h*m+z*g+l*d-t*f),e[2]=
  2*(l*m+z*f+t*g-h*d));a(b,c,e);return b};c.getTranslation=function(a,b){a[0]=b[12];a[1]=b[13];a[2]=b[14];return a};c.getScaling=function(a,b){var c=b[0],e=b[1],d=b[2],f=b[4],m=b[5],t=b[6],h=b[8],l=b[9];b=b[10];a[0]=Math.sqrt(c*c+e*e+d*d);a[1]=Math.sqrt(f*f+m*m+t*t);a[2]=Math.sqrt(h*h+l*l+b*b);return a};c.getRotation=function(a,b){var c=b[0]+b[5]+b[10];0<c?(c=2*Math.sqrt(c+1),a[3]=.25*c,a[0]=(b[6]-b[9])/c,a[1]=(b[8]-b[2])/c,a[2]=(b[1]-b[4])/c):b[0]>b[5]&&b[0]>b[10]?(c=2*Math.sqrt(1+b[0]-b[5]-b[10]),
  a[3]=(b[6]-b[9])/c,a[0]=.25*c,a[1]=(b[1]+b[4])/c,a[2]=(b[8]+b[2])/c):b[5]>b[10]?(c=2*Math.sqrt(1+b[5]-b[0]-b[10]),a[3]=(b[8]-b[2])/c,a[0]=(b[1]+b[4])/c,a[1]=.25*c,a[2]=(b[6]+b[9])/c):(c=2*Math.sqrt(1+b[10]-b[0]-b[5]),a[3]=(b[1]-b[4])/c,a[0]=(b[8]+b[2])/c,a[1]=(b[6]+b[9])/c,a[2]=.25*c);return a};c.fromRotationTranslationScale=function(a,b,c,d){var e=b[0],f=b[1],m=b[2],t=b[3],h=e+e,l=f+f,k=m+m;b=e*h;var n=e*l;e*=k;var p=f*l;f*=k;m*=k;h*=t;l*=t;t*=k;k=d[0];var A=d[1];d=d[2];a[0]=(1-(p+m))*k;a[1]=(n+
  t)*k;a[2]=(e-l)*k;a[3]=0;a[4]=(n-t)*A;a[5]=(1-(b+m))*A;a[6]=(f+h)*A;a[7]=0;a[8]=(e+l)*d;a[9]=(f-h)*d;a[10]=(1-(b+p))*d;a[11]=0;a[12]=c[0];a[13]=c[1];a[14]=c[2];a[15]=1;return a};c.fromRotationTranslationScaleOrigin=function(a,b,c,d,g){var e=b[0],f=b[1],t=b[2],h=b[3],l=e+e,k=f+f,n=t+t;b=e*l;var p=e*k,A=e*n;e=f*k;f*=n;var C=t*n;t=h*l;k*=h;var H=h*n,F=d[0],v=d[1];n=d[2];d=g[0];h=g[1];g=g[2];l=(1-(e+C))*F;var P=(p+H)*F;F*=A-k;p=(p-H)*v;C=(1-(b+C))*v;v*=f+t;A=(A+k)*n;f=(f-t)*n;b=(1-(b+e))*n;a[0]=l;a[1]=
  P;a[2]=F;a[3]=0;a[4]=p;a[5]=C;a[6]=v;a[7]=0;a[8]=A;a[9]=f;a[10]=b;a[11]=0;a[12]=c[0]+d-(l*d+p*h+A*g);a[13]=c[1]+h-(P*d+C*h+f*g);a[14]=c[2]+g-(F*d+v*h+b*g);a[15]=1;return a};c.fromQuat=function(a,b){var c=b[0],e=b[1],d=b[2];b=b[3];var f=c+c,m=e+e,t=d+d;c*=f;var h=e*f;e*=m;var l=d*f,k=d*m;d*=t;f*=b;m*=b;b*=t;a[0]=1-e-d;a[1]=h+b;a[2]=l-m;a[3]=0;a[4]=h-b;a[5]=1-c-d;a[6]=k+f;a[7]=0;a[8]=l+m;a[9]=k-f;a[10]=1-c-e;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a};c.frustum=function(a,b,c,d,f,r,m){var e=1/
  (c-b),g=1/(f-d),h=1/(r-m);a[0]=2*r*e;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=2*r*g;a[6]=0;a[7]=0;a[8]=(c+b)*e;a[9]=(f+d)*g;a[10]=(m+r)*h;a[11]=-1;a[12]=0;a[13]=0;a[14]=m*r*2*h;a[15]=0;return a};c.perspective=function(a,b,c,d,f){b=1/Math.tan(b/2);a[0]=b/c;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=b;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[11]=-1;a[12]=0;a[13]=0;a[15]=0;null!=f&&Infinity!==f?(c=1/(d-f),a[10]=(f+d)*c,a[14]=2*f*d*c):(a[10]=-1,a[14]=-2*d);return a};c.perspectiveFromFieldOfView=function(a,b,c,d){var e=Math.tan(b.upDegrees*
  Math.PI/180),f=Math.tan(b.downDegrees*Math.PI/180),m=Math.tan(b.leftDegrees*Math.PI/180);b=Math.tan(b.rightDegrees*Math.PI/180);var t=2/(m+b),h=2/(e+f);a[0]=t;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=h;a[6]=0;a[7]=0;a[8]=-((m-b)*t*.5);a[9]=(e-f)*h*.5;a[10]=d/(c-d);a[11]=-1;a[12]=0;a[13]=0;a[14]=d*c/(c-d);a[15]=0;return a};c.ortho=function(a,b,c,d,f,r,m){var e=1/(b-c),g=1/(d-f),h=1/(r-m);a[0]=-2*e;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=-2*g;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=2*h;a[11]=0;a[12]=(b+c)*e;a[13]=(f+d)*
  g;a[14]=(m+r)*h;a[15]=1;return a};c.lookAt=function(a,b,c,f){var e=b[0],r=b[1];b=b[2];var m=f[0];var t=f[1];var h=f[2];var l=c[0];f=c[1];var n=c[2];if(Math.abs(e-l)<k.EPSILON&&Math.abs(r-f)<k.EPSILON&&Math.abs(b-n)<k.EPSILON)return d(a);c=e-l;f=r-f;l=b-n;var w=1/Math.sqrt(c*c+f*f+l*l);c*=w;f*=w;l*=w;n=t*l-h*f;h=h*c-m*l;m=m*f-t*c;(w=Math.sqrt(n*n+h*h+m*m))?(w=1/w,n*=w,h*=w,m*=w):m=h=n=0;t=f*m-l*h;var p=l*n-c*m;var A=c*h-f*n;(w=Math.sqrt(t*t+p*p+A*A))?(w=1/w,t*=w,p*=w,A*=w):A=p=t=0;a[0]=n;a[1]=t;a[2]=
  c;a[3]=0;a[4]=h;a[5]=p;a[6]=f;a[7]=0;a[8]=m;a[9]=A;a[10]=l;a[11]=0;a[12]=-(n*e+h*r+m*b);a[13]=-(t*e+p*r+A*b);a[14]=-(c*e+f*r+l*b);a[15]=1;return a};c.targetTo=function(a,b,c,d){var f=b[0],e=b[1];b=b[2];var m=d[0],t=d[1],h=d[2];d=f-c[0];var k=e-c[1];c=b-c[2];var l=d*d+k*k+c*c;0<l&&(l=1/Math.sqrt(l),d*=l,k*=l,c*=l);var n=t*c-h*k;h=h*d-m*c;m=m*k-t*d;l=n*n+h*h+m*m;0<l&&(l=1/Math.sqrt(l),n*=l,h*=l,m*=l);a[0]=n;a[1]=h;a[2]=m;a[3]=0;a[4]=k*m-c*h;a[5]=c*n-d*m;a[6]=d*h-k*n;a[7]=0;a[8]=d;a[9]=k;a[10]=c;a[11]=
  0;a[12]=f;a[13]=e;a[14]=b;a[15]=1;return a};c.str=function(a){return"mat4("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", "+a[4]+", "+a[5]+", "+a[6]+", "+a[7]+", "+a[8]+", "+a[9]+", "+a[10]+", "+a[11]+", "+a[12]+", "+a[13]+", "+a[14]+", "+a[15]+")"};c.frob=function(a){return Math.sqrt(Math.pow(a[0],2)+Math.pow(a[1],2)+Math.pow(a[2],2)+Math.pow(a[3],2)+Math.pow(a[4],2)+Math.pow(a[5],2)+Math.pow(a[6],2)+Math.pow(a[7],2)+Math.pow(a[8],2)+Math.pow(a[9],2)+Math.pow(a[10],2)+Math.pow(a[11],2)+Math.pow(a[12],2)+
  Math.pow(a[13],2)+Math.pow(a[14],2)+Math.pow(a[15],2))};c.add=function(a,b,c){a[0]=b[0]+c[0];a[1]=b[1]+c[1];a[2]=b[2]+c[2];a[3]=b[3]+c[3];a[4]=b[4]+c[4];a[5]=b[5]+c[5];a[6]=b[6]+c[6];a[7]=b[7]+c[7];a[8]=b[8]+c[8];a[9]=b[9]+c[9];a[10]=b[10]+c[10];a[11]=b[11]+c[11];a[12]=b[12]+c[12];a[13]=b[13]+c[13];a[14]=b[14]+c[14];a[15]=b[15]+c[15];return a};c.subtract=f;c.multiplyScalar=function(a,b,c){a[0]=b[0]*c;a[1]=b[1]*c;a[2]=b[2]*c;a[3]=b[3]*c;a[4]=b[4]*c;a[5]=b[5]*c;a[6]=b[6]*c;a[7]=b[7]*c;a[8]=b[8]*c;a[9]=
  b[9]*c;a[10]=b[10]*c;a[11]=b[11]*c;a[12]=b[12]*c;a[13]=b[13]*c;a[14]=b[14]*c;a[15]=b[15]*c;return a};c.multiplyScalarAndAdd=function(a,b,c,d){a[0]=b[0]+c[0]*d;a[1]=b[1]+c[1]*d;a[2]=b[2]+c[2]*d;a[3]=b[3]+c[3]*d;a[4]=b[4]+c[4]*d;a[5]=b[5]+c[5]*d;a[6]=b[6]+c[6]*d;a[7]=b[7]+c[7]*d;a[8]=b[8]+c[8]*d;a[9]=b[9]+c[9]*d;a[10]=b[10]+c[10]*d;a[11]=b[11]+c[11]*d;a[12]=b[12]+c[12]*d;a[13]=b[13]+c[13]*d;a[14]=b[14]+c[14]*d;a[15]=b[15]+c[15]*d;return a};c.exactEquals=function(a,b){return a[0]===b[0]&&a[1]===b[1]&&
  a[2]===b[2]&&a[3]===b[3]&&a[4]===b[4]&&a[5]===b[5]&&a[6]===b[6]&&a[7]===b[7]&&a[8]===b[8]&&a[9]===b[9]&&a[10]===b[10]&&a[11]===b[11]&&a[12]===b[12]&&a[13]===b[13]&&a[14]===b[14]&&a[15]===b[15]};c.equals=function(a,b){var c=a[0],d=a[1],f=a[2],e=a[3],m=a[4],t=a[5],h=a[6],l=a[7],z=a[8],w=a[9],G=a[10],A=a[11],C=a[12],H=a[13],F=a[14];a=a[15];var v=b[0],P=b[1],I=b[2],J=b[3],y=b[4],D=b[5],M=b[6],K=b[7],Q=b[8],S=b[9],T=b[10],X=b[11],N=b[12],U=b[13],R=b[14];b=b[15];return Math.abs(c-v)<=k.EPSILON*Math.max(1,
  Math.abs(c),Math.abs(v))&&Math.abs(d-P)<=k.EPSILON*Math.max(1,Math.abs(d),Math.abs(P))&&Math.abs(f-I)<=k.EPSILON*Math.max(1,Math.abs(f),Math.abs(I))&&Math.abs(e-J)<=k.EPSILON*Math.max(1,Math.abs(e),Math.abs(J))&&Math.abs(m-y)<=k.EPSILON*Math.max(1,Math.abs(m),Math.abs(y))&&Math.abs(t-D)<=k.EPSILON*Math.max(1,Math.abs(t),Math.abs(D))&&Math.abs(h-M)<=k.EPSILON*Math.max(1,Math.abs(h),Math.abs(M))&&Math.abs(l-K)<=k.EPSILON*Math.max(1,Math.abs(l),Math.abs(K))&&Math.abs(z-Q)<=k.EPSILON*Math.max(1,Math.abs(z),
  Math.abs(Q))&&Math.abs(w-S)<=k.EPSILON*Math.max(1,Math.abs(w),Math.abs(S))&&Math.abs(G-T)<=k.EPSILON*Math.max(1,Math.abs(G),Math.abs(T))&&Math.abs(A-X)<=k.EPSILON*Math.max(1,Math.abs(A),Math.abs(X))&&Math.abs(C-N)<=k.EPSILON*Math.max(1,Math.abs(C),Math.abs(N))&&Math.abs(H-U)<=k.EPSILON*Math.max(1,Math.abs(H),Math.abs(U))&&Math.abs(F-R)<=k.EPSILON*Math.max(1,Math.abs(F),Math.abs(R))&&Math.abs(a-b)<=k.EPSILON*Math.max(1,Math.abs(a),Math.abs(b))};c.sub=c.mul=void 0;var k=function(a){if(a&&a.__esModule)return a;
  var b={};if(null!=a)for(var c in a)if(Object.prototype.hasOwnProperty.call(a,c)){var d=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(a,c):{};d.get||d.set?Object.defineProperty(b,c,d):b[c]=a[c]}b.default=a;return b}(ka);c.mul=b;c.sub=f});Y(Nb);var Ob=ha(function(h,c){function d(){var a=new m.ARRAY_TYPE(3);m.ARRAY_TYPE!=Float32Array&&(a[0]=0,a[1]=0,a[2]=0);return a}function b(a){var b=a[0],c=a[1];a=a[2];return Math.sqrt(b*b+c*c+a*a)}function a(a,b,c){var d=new m.ARRAY_TYPE(3);
  d[0]=a;d[1]=b;d[2]=c;return d}function f(a,b,c){a[0]=b[0]-c[0];a[1]=b[1]-c[1];a[2]=b[2]-c[2];return a}function k(a,b,c){a[0]=b[0]*c[0];a[1]=b[1]*c[1];a[2]=b[2]*c[2];return a}function e(a,b,c){a[0]=b[0]/c[0];a[1]=b[1]/c[1];a[2]=b[2]/c[2];return a}function l(a,b){var c=b[0]-a[0],d=b[1]-a[1];a=b[2]-a[2];return Math.sqrt(c*c+d*d+a*a)}function n(a,b){var c=b[0]-a[0],d=b[1]-a[1];a=b[2]-a[2];return c*c+d*d+a*a}function p(a){var b=a[0],c=a[1];a=a[2];return b*b+c*c+a*a}function g(a,b){var c=b[0],d=b[1],f=
  b[2];c=c*c+d*d+f*f;0<c&&(c=1/Math.sqrt(c));a[0]=b[0]*c;a[1]=b[1]*c;a[2]=b[2]*c;return a}function r(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]}Object.defineProperty(c,"__esModule",{value:!0});c.create=d;c.clone=function(a){var b=new m.ARRAY_TYPE(3);b[0]=a[0];b[1]=a[1];b[2]=a[2];return b};c.length=b;c.fromValues=a;c.copy=function(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2];return a};c.set=function(a,b,c,d){a[0]=b;a[1]=c;a[2]=d;return a};c.add=function(a,b,c){a[0]=b[0]+c[0];a[1]=b[1]+c[1];a[2]=b[2]+c[2];return a};
  c.subtract=f;c.multiply=k;c.divide=e;c.ceil=function(a,b){a[0]=Math.ceil(b[0]);a[1]=Math.ceil(b[1]);a[2]=Math.ceil(b[2]);return a};c.floor=function(a,b){a[0]=Math.floor(b[0]);a[1]=Math.floor(b[1]);a[2]=Math.floor(b[2]);return a};c.min=function(a,b,c){a[0]=Math.min(b[0],c[0]);a[1]=Math.min(b[1],c[1]);a[2]=Math.min(b[2],c[2]);return a};c.max=function(a,b,c){a[0]=Math.max(b[0],c[0]);a[1]=Math.max(b[1],c[1]);a[2]=Math.max(b[2],c[2]);return a};c.round=function(a,b){a[0]=Math.round(b[0]);a[1]=Math.round(b[1]);
  a[2]=Math.round(b[2]);return a};c.scale=function(a,b,c){a[0]=b[0]*c;a[1]=b[1]*c;a[2]=b[2]*c;return a};c.scaleAndAdd=function(a,b,c,d){a[0]=b[0]+c[0]*d;a[1]=b[1]+c[1]*d;a[2]=b[2]+c[2]*d;return a};c.distance=l;c.squaredDistance=n;c.squaredLength=p;c.negate=function(a,b){a[0]=-b[0];a[1]=-b[1];a[2]=-b[2];return a};c.inverse=function(a,b){a[0]=1/b[0];a[1]=1/b[1];a[2]=1/b[2];return a};c.normalize=g;c.dot=r;c.cross=function(a,b,c){var d=b[0],f=b[1];b=b[2];var g=c[0],e=c[1];c=c[2];a[0]=f*c-b*e;a[1]=b*g-d*
  c;a[2]=d*e-f*g;return a};c.lerp=function(a,b,c,d){var f=b[0],g=b[1];b=b[2];a[0]=f+d*(c[0]-f);a[1]=g+d*(c[1]-g);a[2]=b+d*(c[2]-b);return a};c.hermite=function(a,b,c,d,f,g){var e=g*g,m=e*(2*g-3)+1,h=e*(g-2)+g,r=e*(g-1);g=e*(3-2*g);a[0]=b[0]*m+c[0]*h+d[0]*r+f[0]*g;a[1]=b[1]*m+c[1]*h+d[1]*r+f[1]*g;a[2]=b[2]*m+c[2]*h+d[2]*r+f[2]*g;return a};c.bezier=function(a,b,c,d,f,g){var e=1-g,m=e*e,h=g*g,r=m*e;m*=3*g;e*=3*h;g*=h;a[0]=b[0]*r+c[0]*m+d[0]*e+f[0]*g;a[1]=b[1]*r+c[1]*m+d[1]*e+f[1]*g;a[2]=b[2]*r+c[2]*m+
  d[2]*e+f[2]*g;return a};c.random=function(a,b){b=b||1;var c=2*m.RANDOM()*Math.PI,d=2*m.RANDOM()-1,f=Math.sqrt(1-d*d)*b;a[0]=Math.cos(c)*f;a[1]=Math.sin(c)*f;a[2]=d*b;return a};c.transformMat4=function(a,b,c){var d=b[0],f=b[1];b=b[2];var g=c[3]*d+c[7]*f+c[11]*b+c[15];g=g||1;a[0]=(c[0]*d+c[4]*f+c[8]*b+c[12])/g;a[1]=(c[1]*d+c[5]*f+c[9]*b+c[13])/g;a[2]=(c[2]*d+c[6]*f+c[10]*b+c[14])/g;return a};c.transformMat3=function(a,b,c){var d=b[0],f=b[1];b=b[2];a[0]=d*c[0]+f*c[3]+b*c[6];a[1]=d*c[1]+f*c[4]+b*c[7];
  a[2]=d*c[2]+f*c[5]+b*c[8];return a};c.transformQuat=function(a,b,c){var d=c[0],f=c[1],g=c[2],e=b[0],m=b[1];b=b[2];var h=f*b-g*m,r=g*e-d*b,t=d*m-f*e;c=2*c[3];a[0]=e+h*c+2*(f*t-g*r);a[1]=m+r*c+2*(g*h-d*t);a[2]=b+t*c+2*(d*r-f*h);return a};c.rotateX=function(a,b,c,d){var f=[],g=[];f[0]=b[0]-c[0];f[1]=b[1]-c[1];f[2]=b[2]-c[2];g[0]=f[0];g[1]=f[1]*Math.cos(d)-f[2]*Math.sin(d);g[2]=f[1]*Math.sin(d)+f[2]*Math.cos(d);a[0]=g[0]+c[0];a[1]=g[1]+c[1];a[2]=g[2]+c[2];return a};c.rotateY=function(a,b,c,d){var f=[],
  g=[];f[0]=b[0]-c[0];f[1]=b[1]-c[1];f[2]=b[2]-c[2];g[0]=f[2]*Math.sin(d)+f[0]*Math.cos(d);g[1]=f[1];g[2]=f[2]*Math.cos(d)-f[0]*Math.sin(d);a[0]=g[0]+c[0];a[1]=g[1]+c[1];a[2]=g[2]+c[2];return a};c.rotateZ=function(a,b,c,d){var f=[],g=[];f[0]=b[0]-c[0];f[1]=b[1]-c[1];f[2]=b[2]-c[2];g[0]=f[0]*Math.cos(d)-f[1]*Math.sin(d);g[1]=f[0]*Math.sin(d)+f[1]*Math.cos(d);g[2]=f[2];a[0]=g[0]+c[0];a[1]=g[1]+c[1];a[2]=g[2]+c[2];return a};c.angle=function(b,c){b=a(b[0],b[1],b[2]);c=a(c[0],c[1],c[2]);g(b,b);g(c,c);c=
  r(b,c);return 1<c?0:-1>c?Math.PI:Math.acos(c)};c.zero=function(a){a[0]=0;a[1]=0;a[2]=0;return a};c.str=function(a){return"vec3("+a[0]+", "+a[1]+", "+a[2]+")"};c.exactEquals=function(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]};c.equals=function(a,b){var c=a[0],d=a[1];a=a[2];var f=b[0],g=b[1];b=b[2];return Math.abs(c-f)<=m.EPSILON*Math.max(1,Math.abs(c),Math.abs(f))&&Math.abs(d-g)<=m.EPSILON*Math.max(1,Math.abs(d),Math.abs(g))&&Math.abs(a-b)<=m.EPSILON*Math.max(1,Math.abs(a),Math.abs(b))};c.forEach=
  c.sqrLen=c.len=c.sqrDist=c.dist=c.div=c.mul=c.sub=void 0;var m=function(a){if(a&&a.__esModule)return a;var b={};if(null!=a)for(var c in a)if(Object.prototype.hasOwnProperty.call(a,c)){var d=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(a,c):{};d.get||d.set?Object.defineProperty(b,c,d):b[c]=a[c]}b.default=a;return b}(ka);c.sub=f;c.mul=k;c.div=e;c.dist=l;c.sqrDist=n;c.len=b;c.sqrLen=p;h=function(){var a=d();return function(b,c,d,f,g,e){c||(c=3);d||(d=0);for(f=
  f?Math.min(f*c+d,b.length):b.length;d<f;d+=c)a[0]=b[d],a[1]=b[d+1],a[2]=b[d+2],g(a,a,e),b[d]=a[0],b[d+1]=a[1],b[d+2]=a[2];return b}}();c.forEach=h});Y(Ob);var xb=ha(function(h,c){function d(){var a=new p.ARRAY_TYPE(4);p.ARRAY_TYPE!=Float32Array&&(a[0]=0,a[1]=0,a[2]=0,a[3]=0);return a}function b(a,b,c){a[0]=b[0]-c[0];a[1]=b[1]-c[1];a[2]=b[2]-c[2];a[3]=b[3]-c[3];return a}function a(a,b,c){a[0]=b[0]*c[0];a[1]=b[1]*c[1];a[2]=b[2]*c[2];a[3]=b[3]*c[3];return a}function f(a,b,c){a[0]=b[0]/c[0];a[1]=b[1]/
  c[1];a[2]=b[2]/c[2];a[3]=b[3]/c[3];return a}function k(a,b){var c=b[0]-a[0],d=b[1]-a[1],f=b[2]-a[2];a=b[3]-a[3];return Math.sqrt(c*c+d*d+f*f+a*a)}function e(a,b){var c=b[0]-a[0],d=b[1]-a[1],f=b[2]-a[2];a=b[3]-a[3];return c*c+d*d+f*f+a*a}function l(a){var b=a[0],c=a[1],d=a[2];a=a[3];return Math.sqrt(b*b+c*c+d*d+a*a)}function n(a){var b=a[0],c=a[1],d=a[2];a=a[3];return b*b+c*c+d*d+a*a}Object.defineProperty(c,"__esModule",{value:!0});c.create=d;c.clone=function(a){var b=new p.ARRAY_TYPE(4);b[0]=a[0];
  b[1]=a[1];b[2]=a[2];b[3]=a[3];return b};c.fromValues=function(a,b,c,d){var f=new p.ARRAY_TYPE(4);f[0]=a;f[1]=b;f[2]=c;f[3]=d;return f};c.copy=function(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];return a};c.set=function(a,b,c,d,f){a[0]=b;a[1]=c;a[2]=d;a[3]=f;return a};c.add=function(a,b,c){a[0]=b[0]+c[0];a[1]=b[1]+c[1];a[2]=b[2]+c[2];a[3]=b[3]+c[3];return a};c.subtract=b;c.multiply=a;c.divide=f;c.ceil=function(a,b){a[0]=Math.ceil(b[0]);a[1]=Math.ceil(b[1]);a[2]=Math.ceil(b[2]);a[3]=Math.ceil(b[3]);
  return a};c.floor=function(a,b){a[0]=Math.floor(b[0]);a[1]=Math.floor(b[1]);a[2]=Math.floor(b[2]);a[3]=Math.floor(b[3]);return a};c.min=function(a,b,c){a[0]=Math.min(b[0],c[0]);a[1]=Math.min(b[1],c[1]);a[2]=Math.min(b[2],c[2]);a[3]=Math.min(b[3],c[3]);return a};c.max=function(a,b,c){a[0]=Math.max(b[0],c[0]);a[1]=Math.max(b[1],c[1]);a[2]=Math.max(b[2],c[2]);a[3]=Math.max(b[3],c[3]);return a};c.round=function(a,b){a[0]=Math.round(b[0]);a[1]=Math.round(b[1]);a[2]=Math.round(b[2]);a[3]=Math.round(b[3]);
  return a};c.scale=function(a,b,c){a[0]=b[0]*c;a[1]=b[1]*c;a[2]=b[2]*c;a[3]=b[3]*c;return a};c.scaleAndAdd=function(a,b,c,d){a[0]=b[0]+c[0]*d;a[1]=b[1]+c[1]*d;a[2]=b[2]+c[2]*d;a[3]=b[3]+c[3]*d;return a};c.distance=k;c.squaredDistance=e;c.length=l;c.squaredLength=n;c.negate=function(a,b){a[0]=-b[0];a[1]=-b[1];a[2]=-b[2];a[3]=-b[3];return a};c.inverse=function(a,b){a[0]=1/b[0];a[1]=1/b[1];a[2]=1/b[2];a[3]=1/b[3];return a};c.normalize=function(a,b){var c=b[0],d=b[1],f=b[2];b=b[3];var e=c*c+d*d+f*f+b*
  b;0<e&&(e=1/Math.sqrt(e));a[0]=c*e;a[1]=d*e;a[2]=f*e;a[3]=b*e;return a};c.dot=function(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]};c.cross=function(a,b,c,d){var f=c[0]*d[1]-c[1]*d[0],e=c[0]*d[2]-c[2]*d[0],g=c[0]*d[3]-c[3]*d[0],h=c[1]*d[2]-c[2]*d[1],m=c[1]*d[3]-c[3]*d[1];c=c[2]*d[3]-c[3]*d[2];d=b[0];var r=b[1],k=b[2];b=b[3];a[0]=r*c-k*m+b*h;a[1]=-(d*c)+k*g-b*e;a[2]=d*m-r*g+b*f;a[3]=-(d*h)+r*e-k*f;return a};c.lerp=function(a,b,c,d){var f=b[0],e=b[1],g=b[2];b=b[3];a[0]=f+d*(c[0]-f);a[1]=e+d*
  (c[1]-e);a[2]=g+d*(c[2]-g);a[3]=b+d*(c[3]-b);return a};c.random=function(a,b){b=b||1;do{var c=2*p.RANDOM()-1;var d=2*p.RANDOM()-1;var f=c*c+d*d}while(1<=f);do{var e=2*p.RANDOM()-1;var g=2*p.RANDOM()-1;var h=e*e+g*g}while(1<=h);f=Math.sqrt((1-f)/h);a[0]=b*c;a[1]=b*d;a[2]=b*e*f;a[3]=b*g*f;return a};c.transformMat4=function(a,b,c){var d=b[0],f=b[1],e=b[2];b=b[3];a[0]=c[0]*d+c[4]*f+c[8]*e+c[12]*b;a[1]=c[1]*d+c[5]*f+c[9]*e+c[13]*b;a[2]=c[2]*d+c[6]*f+c[10]*e+c[14]*b;a[3]=c[3]*d+c[7]*f+c[11]*e+c[15]*b;return a};
  c.transformQuat=function(a,b,c){var d=b[0],f=b[1],e=b[2],g=c[0],h=c[1],m=c[2];c=c[3];var r=c*d+h*e-m*f,k=c*f+m*d-g*e,l=c*e+g*f-h*d;d=-g*d-h*f-m*e;a[0]=r*c+d*-g+k*-m-l*-h;a[1]=k*c+d*-h+l*-g-r*-m;a[2]=l*c+d*-m+r*-h-k*-g;a[3]=b[3];return a};c.zero=function(a){a[0]=0;a[1]=0;a[2]=0;a[3]=0;return a};c.str=function(a){return"vec4("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+")"};c.exactEquals=function(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]};c.equals=function(a,b){var c=a[0],d=a[1],f=a[2];
  a=a[3];var e=b[0],g=b[1],h=b[2];b=b[3];return Math.abs(c-e)<=p.EPSILON*Math.max(1,Math.abs(c),Math.abs(e))&&Math.abs(d-g)<=p.EPSILON*Math.max(1,Math.abs(d),Math.abs(g))&&Math.abs(f-h)<=p.EPSILON*Math.max(1,Math.abs(f),Math.abs(h))&&Math.abs(a-b)<=p.EPSILON*Math.max(1,Math.abs(a),Math.abs(b))};c.forEach=c.sqrLen=c.len=c.sqrDist=c.dist=c.div=c.mul=c.sub=void 0;var p=function(a){if(a&&a.__esModule)return a;var b={};if(null!=a)for(var c in a)if(Object.prototype.hasOwnProperty.call(a,c)){var d=Object.defineProperty&&
  Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(a,c):{};d.get||d.set?Object.defineProperty(b,c,d):b[c]=a[c]}b.default=a;return b}(ka);c.sub=b;c.mul=a;c.div=f;c.dist=k;c.sqrDist=e;c.len=l;c.sqrLen=n;h=function(){var a=d();return function(b,c,d,f,e,g){c||(c=4);d||(d=0);for(f=f?Math.min(f*c+d,b.length):b.length;d<f;d+=c)a[0]=b[d],a[1]=b[d+1],a[2]=b[d+2],a[3]=b[d+3],e(a,a,g),b[d]=a[0],b[d+1]=a[1],b[d+2]=a[2],b[d+3]=a[3];return b}}();c.forEach=h});Y(xb);var yb=ha(function(h,c){function d(a){if(a&&
  a.__esModule)return a;var b={};if(null!=a)for(var c in a)if(Object.prototype.hasOwnProperty.call(a,c)){var d=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(a,c):{};d.get||d.set?Object.defineProperty(b,c,d):b[c]=a[c]}b.default=a;return b}function b(){var a=new l.ARRAY_TYPE(4);l.ARRAY_TYPE!=Float32Array&&(a[0]=0,a[1]=0,a[2]=0);a[3]=1;return a}function a(a,b,c){c*=.5;var d=Math.sin(c);a[0]=d*b[0];a[1]=d*b[1];a[2]=d*b[2];a[3]=Math.cos(c);return a}function f(a,b,
  c){var d=b[0],f=b[1],e=b[2];b=b[3];var g=c[0],h=c[1],m=c[2];c=c[3];a[0]=d*c+b*g+f*m-e*h;a[1]=f*c+b*h+e*g-d*m;a[2]=e*c+b*m+d*h-f*g;a[3]=b*c-d*g-f*h-e*m;return a}function k(a,b,c,d){var f=b[0],e=b[1],g=b[2];b=b[3];var h=c[0],m=c[1],r=c[2];c=c[3];var k=f*h+e*m+g*r+b*c;0>k&&(k=-k,h=-h,m=-m,r=-r,c=-c);if(1-k>l.EPSILON){var t=Math.acos(k);var n=Math.sin(t);k=Math.sin((1-d)*t)/n;d=Math.sin(d*t)/n}else k=1-d;a[0]=k*f+d*h;a[1]=k*e+d*m;a[2]=k*g+d*r;a[3]=k*b+d*c;return a}function e(a,b){var c=b[0]+b[4]+b[8];
  if(0<c)c=Math.sqrt(c+1),a[3]=.5*c,c=.5/c,a[0]=(b[5]-b[7])*c,a[1]=(b[6]-b[2])*c,a[2]=(b[1]-b[3])*c;else{var d=0;b[4]>b[0]&&(d=1);b[8]>b[3*d+d]&&(d=2);var f=(d+1)%3,e=(d+2)%3;c=Math.sqrt(b[3*d+d]-b[3*f+f]-b[3*e+e]+1);a[d]=.5*c;c=.5/c;a[3]=(b[3*f+e]-b[3*e+f])*c;a[f]=(b[3*f+d]+b[3*d+f])*c;a[e]=(b[3*e+d]+b[3*d+e])*c}return a}Object.defineProperty(c,"__esModule",{value:!0});c.create=b;c.identity=function(a){a[0]=0;a[1]=0;a[2]=0;a[3]=1;return a};c.setAxisAngle=a;c.getAxisAngle=function(a,b){var c=2*Math.acos(b[3]),
  d=Math.sin(c/2);d>l.EPSILON?(a[0]=b[0]/d,a[1]=b[1]/d,a[2]=b[2]/d):(a[0]=1,a[1]=0,a[2]=0);return c};c.multiply=f;c.rotateX=function(a,b,c){c*=.5;var d=b[0],f=b[1],e=b[2];b=b[3];var g=Math.sin(c);c=Math.cos(c);a[0]=d*c+b*g;a[1]=f*c+e*g;a[2]=e*c-f*g;a[3]=b*c-d*g;return a};c.rotateY=function(a,b,c){c*=.5;var d=b[0],f=b[1],e=b[2];b=b[3];var g=Math.sin(c);c=Math.cos(c);a[0]=d*c-e*g;a[1]=f*c+b*g;a[2]=e*c+d*g;a[3]=b*c-f*g;return a};c.rotateZ=function(a,b,c){c*=.5;var d=b[0],f=b[1],e=b[2];b=b[3];var g=Math.sin(c);
  c=Math.cos(c);a[0]=d*c+f*g;a[1]=f*c-d*g;a[2]=e*c+b*g;a[3]=b*c-e*g;return a};c.calculateW=function(a,b){var c=b[0],d=b[1];b=b[2];a[0]=c;a[1]=d;a[2]=b;a[3]=Math.sqrt(Math.abs(1-c*c-d*d-b*b));return a};c.slerp=k;c.random=function(a){var b=l.RANDOM(),c=l.RANDOM(),d=l.RANDOM(),f=Math.sqrt(1-b);b=Math.sqrt(b);a[0]=f*Math.sin(2*Math.PI*c);a[1]=f*Math.cos(2*Math.PI*c);a[2]=b*Math.sin(2*Math.PI*d);a[3]=b*Math.cos(2*Math.PI*d);return a};c.invert=function(a,b){var c=b[0],d=b[1],f=b[2];b=b[3];var e=c*c+d*d+f*
  f+b*b;e=e?1/e:0;a[0]=-c*e;a[1]=-d*e;a[2]=-f*e;a[3]=b*e;return a};c.conjugate=function(a,b){a[0]=-b[0];a[1]=-b[1];a[2]=-b[2];a[3]=b[3];return a};c.fromMat3=e;c.fromEuler=function(a,b,c,d){var f=.5*Math.PI/180;b*=f;c*=f;d*=f;f=Math.sin(b);b=Math.cos(b);var e=Math.sin(c);c=Math.cos(c);var g=Math.sin(d);d=Math.cos(d);a[0]=f*c*d-b*e*g;a[1]=b*e*d+f*c*g;a[2]=b*c*g-f*e*d;a[3]=b*c*d+f*e*g;return a};c.str=function(a){return"quat("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+")"};c.setAxes=c.sqlerp=c.rotationTo=c.equals=
  c.exactEquals=c.normalize=c.sqrLen=c.squaredLength=c.len=c.length=c.lerp=c.dot=c.scale=c.mul=c.add=c.set=c.copy=c.fromValues=c.clone=void 0;var l=d(ka),n=d(Mb),p=d(Ob);h=d(xb);c.clone=h.clone;c.fromValues=h.fromValues;c.copy=h.copy;c.set=h.set;c.add=h.add;c.mul=f;c.scale=h.scale;c.dot=h.dot;c.lerp=h.lerp;var g=h.length;c.length=g;c.len=g;g=h.squaredLength;c.squaredLength=g;c.sqrLen=g;var r=h.normalize;c.normalize=r;c.exactEquals=h.exactEquals;c.equals=h.equals;h=function(){var b=p.create(),c=p.fromValues(1,
  0,0),d=p.fromValues(0,1,0);return function(f,e,g){var h=p.dot(e,g);if(-.999999>h)return p.cross(b,c,e),1E-6>p.len(b)&&p.cross(b,d,e),p.normalize(b,b),a(f,b,Math.PI),f;if(.999999<h)return f[0]=0,f[1]=0,f[2]=0,f[3]=1,f;p.cross(b,e,g);f[0]=b[0];f[1]=b[1];f[2]=b[2];f[3]=1+h;return r(f,f)}}();c.rotationTo=h;h=function(){var a=b(),c=b();return function(b,d,f,e,g,h){k(a,d,g,h);k(c,f,e,h);k(b,a,c,2*h*(1-h));return b}}();c.sqlerp=h;h=function(){var a=n.create();return function(b,c,d,f){a[0]=d[0];a[3]=d[1];
  a[6]=d[2];a[1]=f[0];a[4]=f[1];a[7]=f[2];a[2]=-c[0];a[5]=-c[1];a[8]=-c[2];return r(b,e(b,a))}}();c.setAxes=h});Y(yb);var mc=ha(function(h,c){function d(a){if(a&&a.__esModule)return a;var b={};if(null!=a)for(var c in a)if(Object.prototype.hasOwnProperty.call(a,c)){var d=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(a,c):{};d.get||d.set?Object.defineProperty(b,c,d):b[c]=a[c]}b.default=a;return b}function b(a,b,c){var d=.5*c[0],f=.5*c[1];c=.5*c[2];var e=b[0],g=
  b[1],h=b[2];b=b[3];a[0]=e;a[1]=g;a[2]=h;a[3]=b;a[4]=d*b+f*h-c*g;a[5]=f*b+c*e-d*h;a[6]=c*b+d*g-f*e;a[7]=-d*e-f*g-c*h;return a}function a(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];a[4]=b[4];a[5]=b[5];a[6]=b[6];a[7]=b[7];return a}function f(a,b,c){var d=b[0],f=b[1],e=b[2],g=b[3],h=c[4],r=c[5],m=c[6],k=c[7],l=b[4],n=b[5],p=b[6];b=b[7];var v=c[0],I=c[1],J=c[2];c=c[3];a[0]=d*c+g*v+f*J-e*I;a[1]=f*c+g*I+e*v-d*J;a[2]=e*c+g*J+d*I-f*v;a[3]=g*c-d*v-f*I-e*J;a[4]=d*k+g*h+f*m-e*r+l*c+b*v+n*J-p*I;a[5]=f*k+g*r+
  e*h-d*m+n*c+b*I+p*v-l*J;a[6]=e*k+g*m+d*r-f*h+p*c+b*J+l*I-n*v;a[7]=g*k-d*h-f*r-e*m+b*c-l*v-n*I-p*J;return a}Object.defineProperty(c,"__esModule",{value:!0});c.create=function(){var a=new k.ARRAY_TYPE(8);k.ARRAY_TYPE!=Float32Array&&(a[0]=0,a[1]=0,a[2]=0,a[4]=0,a[5]=0,a[6]=0,a[7]=0);a[3]=1;return a};c.clone=function(a){var b=new k.ARRAY_TYPE(8);b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];return b};c.fromValues=function(a,b,c,d,f,e,h,l){var g=new k.ARRAY_TYPE(8);g[0]=
  a;g[1]=b;g[2]=c;g[3]=d;g[4]=f;g[5]=e;g[6]=h;g[7]=l;return g};c.fromRotationTranslationValues=function(a,b,c,d,f,e,h){var g=new k.ARRAY_TYPE(8);g[0]=a;g[1]=b;g[2]=c;g[3]=d;f*=.5;e*=.5;h*=.5;g[4]=f*d+e*c-h*b;g[5]=e*d+h*a-f*c;g[6]=h*d+f*b-e*a;g[7]=-f*a-e*b-h*c;return g};c.fromRotationTranslation=b;c.fromTranslation=function(a,b){a[0]=0;a[1]=0;a[2]=0;a[3]=1;a[4]=.5*b[0];a[5]=.5*b[1];a[6]=.5*b[2];a[7]=0;return a};c.fromRotation=function(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];a[4]=0;a[5]=0;a[6]=0;
  a[7]=0;return a};c.fromMat4=function(a,c){var d=e.create();l.getRotation(d,c);var f=new k.ARRAY_TYPE(3);l.getTranslation(f,c);b(a,d,f);return a};c.copy=a;c.identity=function(a){a[0]=0;a[1]=0;a[2]=0;a[3]=1;a[4]=0;a[5]=0;a[6]=0;a[7]=0;return a};c.set=function(a,b,c,d,f,e,h,k,l){a[0]=b;a[1]=c;a[2]=d;a[3]=f;a[4]=e;a[5]=h;a[6]=k;a[7]=l;return a};c.getDual=function(a,b){a[0]=b[4];a[1]=b[5];a[2]=b[6];a[3]=b[7];return a};c.setDual=function(a,b){a[4]=b[0];a[5]=b[1];a[6]=b[2];a[7]=b[3];return a};c.getTranslation=
  function(a,b){var c=b[4],d=b[5],f=b[6],e=b[7],g=-b[0],h=-b[1],k=-b[2];b=b[3];a[0]=2*(c*b+e*g+d*k-f*h);a[1]=2*(d*b+e*h+f*g-c*k);a[2]=2*(f*b+e*k+c*h-d*g);return a};c.translate=function(a,b,c){var d=b[0],f=b[1],e=b[2],h=b[3],g=.5*c[0],k=.5*c[1];c=.5*c[2];var m=b[4],r=b[5],l=b[6];b=b[7];a[0]=d;a[1]=f;a[2]=e;a[3]=h;a[4]=h*g+f*c-e*k+m;a[5]=h*k+e*g-d*c+r;a[6]=h*c+d*k-f*g+l;a[7]=-d*g-f*k-e*c+b;return a};c.rotateX=function(a,b,c){var d=-b[0],f=-b[1],h=-b[2],g=b[3],k=b[4],m=b[5],r=b[6],l=b[7],n=k*g+l*d+m*h-
  r*f,p=m*g+l*f+r*d-k*h,v=r*g+l*h+k*f-m*d;k=l*g-k*d-m*f-r*h;e.rotateX(a,b,c);d=a[0];f=a[1];h=a[2];g=a[3];a[4]=n*g+k*d+p*h-v*f;a[5]=p*g+k*f+v*d-n*h;a[6]=v*g+k*h+n*f-p*d;a[7]=k*g-n*d-p*f-v*h;return a};c.rotateY=function(a,b,c){var d=-b[0],f=-b[1],h=-b[2],g=b[3],k=b[4],m=b[5],r=b[6],l=b[7],n=k*g+l*d+m*h-r*f,p=m*g+l*f+r*d-k*h,v=r*g+l*h+k*f-m*d;k=l*g-k*d-m*f-r*h;e.rotateY(a,b,c);d=a[0];f=a[1];h=a[2];g=a[3];a[4]=n*g+k*d+p*h-v*f;a[5]=p*g+k*f+v*d-n*h;a[6]=v*g+k*h+n*f-p*d;a[7]=k*g-n*d-p*f-v*h;return a};c.rotateZ=
  function(a,b,c){var d=-b[0],f=-b[1],h=-b[2],g=b[3],k=b[4],m=b[5],r=b[6],l=b[7],n=k*g+l*d+m*h-r*f,p=m*g+l*f+r*d-k*h,v=r*g+l*h+k*f-m*d;k=l*g-k*d-m*f-r*h;e.rotateZ(a,b,c);d=a[0];f=a[1];h=a[2];g=a[3];a[4]=n*g+k*d+p*h-v*f;a[5]=p*g+k*f+v*d-n*h;a[6]=v*g+k*h+n*f-p*d;a[7]=k*g-n*d-p*f-v*h;return a};c.rotateByQuatAppend=function(a,b,c){var d=c[0],f=c[1],e=c[2];c=c[3];var h=b[0],g=b[1],k=b[2],m=b[3];a[0]=h*c+m*d+g*e-k*f;a[1]=g*c+m*f+k*d-h*e;a[2]=k*c+m*e+h*f-g*d;a[3]=m*c-h*d-g*f-k*e;h=b[4];g=b[5];k=b[6];m=b[7];
  a[4]=h*c+m*d+g*e-k*f;a[5]=g*c+m*f+k*d-h*e;a[6]=k*c+m*e+h*f-g*d;a[7]=m*c-h*d-g*f-k*e;return a};c.rotateByQuatPrepend=function(a,b,c){var d=b[0],f=b[1],e=b[2];b=b[3];var h=c[0],g=c[1],k=c[2],m=c[3];a[0]=d*m+b*h+f*k-e*g;a[1]=f*m+b*g+e*h-d*k;a[2]=e*m+b*k+d*g-f*h;a[3]=b*m-d*h-f*g-e*k;h=c[4];g=c[5];k=c[6];m=c[7];a[4]=d*m+b*h+f*k-e*g;a[5]=f*m+b*g+e*h-d*k;a[6]=e*m+b*k+d*g-f*h;a[7]=b*m-d*h-f*g-e*k;return a};c.rotateAroundAxis=function(b,c,d,f){if(Math.abs(f)<k.EPSILON)return a(b,c);var e=Math.sqrt(d[0]*d[0]+
  d[1]*d[1]+d[2]*d[2]);f*=.5;var h=Math.sin(f),g=h*d[0]/e,m=h*d[1]/e;d=h*d[2]/e;f=Math.cos(f);e=c[0];h=c[1];var l=c[2],r=c[3];b[0]=e*f+r*g+h*d-l*m;b[1]=h*f+r*m+l*g-e*d;b[2]=l*f+r*d+e*m-h*g;b[3]=r*f-e*g-h*m-l*d;e=c[4];h=c[5];l=c[6];c=c[7];b[4]=e*f+c*g+h*d-l*m;b[5]=h*f+c*m+l*g-e*d;b[6]=l*f+c*d+e*m-h*g;b[7]=c*f-e*g-h*m-l*d;return b};c.add=function(a,b,c){a[0]=b[0]+c[0];a[1]=b[1]+c[1];a[2]=b[2]+c[2];a[3]=b[3]+c[3];a[4]=b[4]+c[4];a[5]=b[5]+c[5];a[6]=b[6]+c[6];a[7]=b[7]+c[7];return a};c.multiply=f;c.scale=
  function(a,b,c){a[0]=b[0]*c;a[1]=b[1]*c;a[2]=b[2]*c;a[3]=b[3]*c;a[4]=b[4]*c;a[5]=b[5]*c;a[6]=b[6]*c;a[7]=b[7]*c;return a};c.lerp=function(a,b,c,d){var f=1-d;0>n(b,c)&&(d=-d);a[0]=b[0]*f+c[0]*d;a[1]=b[1]*f+c[1]*d;a[2]=b[2]*f+c[2]*d;a[3]=b[3]*f+c[3]*d;a[4]=b[4]*f+c[4]*d;a[5]=b[5]*f+c[5]*d;a[6]=b[6]*f+c[6]*d;a[7]=b[7]*f+c[7]*d;return a};c.invert=function(a,b){var c=p(b);a[0]=-b[0]/c;a[1]=-b[1]/c;a[2]=-b[2]/c;a[3]=b[3]/c;a[4]=-b[4]/c;a[5]=-b[5]/c;a[6]=-b[6]/c;a[7]=b[7]/c;return a};c.conjugate=function(a,
  b){a[0]=-b[0];a[1]=-b[1];a[2]=-b[2];a[3]=b[3];a[4]=-b[4];a[5]=-b[5];a[6]=-b[6];a[7]=b[7];return a};c.normalize=function(a,b){var c=p(b);if(0<c){c=Math.sqrt(c);var d=b[0]/c,f=b[1]/c,e=b[2]/c,h=b[3]/c,g=b[4],k=b[5],l=b[6];b=b[7];var r=d*g+f*k+e*l+h*b;a[0]=d;a[1]=f;a[2]=e;a[3]=h;a[4]=(g-d*r)/c;a[5]=(k-f*r)/c;a[6]=(l-e*r)/c;a[7]=(b-h*r)/c}return a};c.str=function(a){return"quat2("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", "+a[4]+", "+a[5]+", "+a[6]+", "+a[7]+")"};c.exactEquals=function(a,b){return a[0]===
  b[0]&&a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]&&a[4]===b[4]&&a[5]===b[5]&&a[6]===b[6]&&a[7]===b[7]};c.equals=function(a,b){var c=a[0],d=a[1],f=a[2],e=a[3],h=a[4],g=a[5],l=a[6];a=a[7];var r=b[0],n=b[1],p=b[2],v=b[3],y=b[4],D=b[5],I=b[6];b=b[7];return Math.abs(c-r)<=k.EPSILON*Math.max(1,Math.abs(c),Math.abs(r))&&Math.abs(d-n)<=k.EPSILON*Math.max(1,Math.abs(d),Math.abs(n))&&Math.abs(f-p)<=k.EPSILON*Math.max(1,Math.abs(f),Math.abs(p))&&Math.abs(e-v)<=k.EPSILON*Math.max(1,Math.abs(e),Math.abs(v))&&Math.abs(h-
  y)<=k.EPSILON*Math.max(1,Math.abs(h),Math.abs(y))&&Math.abs(g-D)<=k.EPSILON*Math.max(1,Math.abs(g),Math.abs(D))&&Math.abs(l-I)<=k.EPSILON*Math.max(1,Math.abs(l),Math.abs(I))&&Math.abs(a-b)<=k.EPSILON*Math.max(1,Math.abs(a),Math.abs(b))};c.sqrLen=c.squaredLength=c.len=c.length=c.dot=c.mul=c.setReal=c.getReal=void 0;var k=d(ka),e=d(yb),l=d(Nb);c.getReal=e.copy;c.setReal=e.copy;c.mul=f;var n=e.dot;c.dot=n;h=e.length;c.length=h;c.len=h;var p=e.squaredLength;c.squaredLength=p;c.sqrLen=p});Y(mc);var nc=
  ha(function(h,c){function d(){var a=new p.ARRAY_TYPE(2);p.ARRAY_TYPE!=Float32Array&&(a[0]=0,a[1]=0);return a}function b(a,b,c){a[0]=b[0]-c[0];a[1]=b[1]-c[1];return a}function a(a,b,c){a[0]=b[0]*c[0];a[1]=b[1]*c[1];return a}function f(a,b,c){a[0]=b[0]/c[0];a[1]=b[1]/c[1];return a}function k(a,b){var c=b[0]-a[0];a=b[1]-a[1];return Math.sqrt(c*c+a*a)}function e(a,b){var c=b[0]-a[0];a=b[1]-a[1];return c*c+a*a}function l(a){var b=a[0];a=a[1];return Math.sqrt(b*b+a*a)}function n(a){var b=a[0];a=a[1];return b*
  b+a*a}Object.defineProperty(c,"__esModule",{value:!0});c.create=d;c.clone=function(a){var b=new p.ARRAY_TYPE(2);b[0]=a[0];b[1]=a[1];return b};c.fromValues=function(a,b){var c=new p.ARRAY_TYPE(2);c[0]=a;c[1]=b;return c};c.copy=function(a,b){a[0]=b[0];a[1]=b[1];return a};c.set=function(a,b,c){a[0]=b;a[1]=c;return a};c.add=function(a,b,c){a[0]=b[0]+c[0];a[1]=b[1]+c[1];return a};c.subtract=b;c.multiply=a;c.divide=f;c.ceil=function(a,b){a[0]=Math.ceil(b[0]);a[1]=Math.ceil(b[1]);return a};c.floor=function(a,
  b){a[0]=Math.floor(b[0]);a[1]=Math.floor(b[1]);return a};c.min=function(a,b,c){a[0]=Math.min(b[0],c[0]);a[1]=Math.min(b[1],c[1]);return a};c.max=function(a,b,c){a[0]=Math.max(b[0],c[0]);a[1]=Math.max(b[1],c[1]);return a};c.round=function(a,b){a[0]=Math.round(b[0]);a[1]=Math.round(b[1]);return a};c.scale=function(a,b,c){a[0]=b[0]*c;a[1]=b[1]*c;return a};c.scaleAndAdd=function(a,b,c,d){a[0]=b[0]+c[0]*d;a[1]=b[1]+c[1]*d;return a};c.distance=k;c.squaredDistance=e;c.length=l;c.squaredLength=n;c.negate=
  function(a,b){a[0]=-b[0];a[1]=-b[1];return a};c.inverse=function(a,b){a[0]=1/b[0];a[1]=1/b[1];return a};c.normalize=function(a,b){var c=b[0],d=b[1];c=c*c+d*d;0<c&&(c=1/Math.sqrt(c));a[0]=b[0]*c;a[1]=b[1]*c;return a};c.dot=function(a,b){return a[0]*b[0]+a[1]*b[1]};c.cross=function(a,b,c){b=b[0]*c[1]-b[1]*c[0];a[0]=a[1]=0;a[2]=b;return a};c.lerp=function(a,b,c,d){var f=b[0];b=b[1];a[0]=f+d*(c[0]-f);a[1]=b+d*(c[1]-b);return a};c.random=function(a,b){b=b||1;var c=2*p.RANDOM()*Math.PI;a[0]=Math.cos(c)*
  b;a[1]=Math.sin(c)*b;return a};c.transformMat2=function(a,b,c){var d=b[0];b=b[1];a[0]=c[0]*d+c[2]*b;a[1]=c[1]*d+c[3]*b;return a};c.transformMat2d=function(a,b,c){var d=b[0];b=b[1];a[0]=c[0]*d+c[2]*b+c[4];a[1]=c[1]*d+c[3]*b+c[5];return a};c.transformMat3=function(a,b,c){var d=b[0];b=b[1];a[0]=c[0]*d+c[3]*b+c[6];a[1]=c[1]*d+c[4]*b+c[7];return a};c.transformMat4=function(a,b,c){var d=b[0];b=b[1];a[0]=c[0]*d+c[4]*b+c[12];a[1]=c[1]*d+c[5]*b+c[13];return a};c.rotate=function(a,b,c,d){var f=b[0]-c[0];b=
  b[1]-c[1];var e=Math.sin(d);d=Math.cos(d);a[0]=f*d-b*e+c[0];a[1]=f*e+b*d+c[1];return a};c.angle=function(a,b){var c=a[0];a=a[1];var d=b[0];b=b[1];var f=c*c+a*a;0<f&&(f=1/Math.sqrt(f));var e=d*d+b*b;0<e&&(e=1/Math.sqrt(e));c=(c*d+a*b)*f*e;return 1<c?0:-1>c?Math.PI:Math.acos(c)};c.zero=function(a){a[0]=0;a[1]=0;return a};c.str=function(a){return"vec2("+a[0]+", "+a[1]+")"};c.exactEquals=function(a,b){return a[0]===b[0]&&a[1]===b[1]};c.equals=function(a,b){var c=a[0];a=a[1];var d=b[0];b=b[1];return Math.abs(c-
  d)<=p.EPSILON*Math.max(1,Math.abs(c),Math.abs(d))&&Math.abs(a-b)<=p.EPSILON*Math.max(1,Math.abs(a),Math.abs(b))};c.forEach=c.sqrLen=c.sqrDist=c.dist=c.div=c.mul=c.sub=c.len=void 0;var p=function(a){if(a&&a.__esModule)return a;var b={};if(null!=a)for(var c in a)if(Object.prototype.hasOwnProperty.call(a,c)){var d=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(a,c):{};d.get||d.set?Object.defineProperty(b,c,d):b[c]=a[c]}b.default=a;return b}(ka);c.len=l;c.sub=b;
  c.mul=a;c.div=f;c.dist=k;c.sqrDist=e;c.sqrLen=n;h=function(){var a=d();return function(b,c,d,f,e,h){c||(c=2);d||(d=0);for(f=f?Math.min(f*c+d,b.length):b.length;d<f;d+=c)a[0]=b[d],a[1]=b[d+1],e(a,a,h),b[d]=a[0],b[d+1]=a[1];return b}}();c.forEach=h});Y(nc);var ra=ha(function(h,c){function d(b){if(b&&b.__esModule)return b;var a={};if(null!=b)for(var c in b)if(Object.prototype.hasOwnProperty.call(b,c)){var d=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(b,c):{};
  d.get||d.set?Object.defineProperty(a,c,d):a[c]=b[c]}a.default=b;return a}Object.defineProperty(c,"__esModule",{value:!0});c.vec4=c.vec3=c.vec2=c.quat2=c.quat=c.mat4=c.mat3=c.mat2d=c.mat2=c.glMatrix=void 0;h=d(ka);c.glMatrix=h;h=d(kc);c.mat2=h;h=d(lc);c.mat2d=h;h=d(Mb);c.mat3=h;h=d(Nb);c.mat4=h;h=d(yb);c.quat=h;h=d(mc);c.quat2=h;h=d(nc);c.vec2=h;h=d(Ob);c.vec3=h;h=d(xb);c.vec4=h});Y(ra);var Nc=ra.vec4,bb=ra.vec3,Oc=ra.vec2,Pc=ra.quat2,Qc=ra.quat,T=ra.mat4,Rc=ra.mat3,Sc=ra.mat2d,Tc=ra.mat2,Uc=ra.glMatrix;
  ac(pa,{EARTHRADIUS:6370996.81,MCBAND:[1.289059486E7,8362377.87,5591021,3481989.83,1678043.12,0],LLBAND:[75,60,45,30,15,0],MC2LL:[[1.410526172116255E-8,8.98305509648872E-6,-1.9939833816331,200.9824383106796,-187.2403703815547,91.6087516669843,-23.38765649603339,2.57121317296198,-.03801003308653,1.73379812E7],[-7.435856389565537E-9,8.983055097726239E-6,-.78625201886289,96.32687599759846,-1.85204757529826,-59.36935905485877,47.40033549296737,-16.50741931063887,2.28786674699375,1.026014486E7],[-3.030883460898826E-8,
  8.98305509983578E-6,.30071316287616,59.74293618442277,7.357984074871,-25.38371002664745,13.45380521110908,-3.29883767235584,.32710905363475,6856817.37],[-1.981981304930552E-8,8.983055099779535E-6,.03278182852591,40.31678527705744,.65659298677277,-4.44255534477492,.85341911805263,.12923347998204,-.04625736007561,4482777.06],[3.09191371068437E-9,8.983055096812155E-6,6.995724062E-5,23.10934304144901,-2.3663490511E-4,-.6321817810242,-.00663494467273,.03430082397953,-.00466043876332,2555164.4],[2.890871144776878E-9,
  8.983055095805407E-6,-3.068298E-8,7.47137025468032,-3.53937994E-6,-.02145144861037,-1.234426596E-5,1.0322952773E-4,-3.23890364E-6,826088.5]],LL2MC:[[-.0015702102444,111320.7020616939,0x60e374c3105a3,-0x24bb4115e2e164,0x5cc55543bb0ae8,-0x7ce070193f3784,0x5e7ca61ddf8150,-0x261a578d8b24d0,0x665d60f3742ca,82.5],[8.277824516172526E-4,111320.7020463578,6.477955746671607E8,-4.082003173641316E9,1.077490566351142E10,-1.517187553151559E10,1.205306533862167E10,-5.124939663577472E9,9.133119359512032E8,67.5],
  [.00337398766765,111320.7020202162,4481351.045890365,-2.339375119931662E7,7.968221547186455E7,-1.159649932797253E8,9.723671115602145E7,-4.366194633752821E7,8477230.501135234,52.5],[.00220636496208,111320.7020209128,51751.86112841131,3796837.749470245,992013.7397791013,-1221952.21711287,1340652.697009075,-620943.6990984312,144416.9293806241,37.5],[-3.441963504368392E-4,111320.7020576856,278.2353980772752,2485758.690035394,6070.750963243378,54821.18345352118,9540.606633304236,-2710.55326746645,1405.483844121726,
  22.5],[-3.218135878613132E-4,111320.7020701615,.00369383431289,823725.6402795718,.46104986909093,2351.343141331292,1.58060784298199,8.77738589078284,.37238884252424,7.45]],getDistanceByMC:function(h,c){if(!h||!c)return 0;h=this.convertMC2LL(h);if(!h)return 0;var d=this.toRadians(h.lng);h=this.toRadians(h.lat);c=this.convertMC2LL(c);if(!c)return 0;var b=this.toRadians(c.lng);c=this.toRadians(c.lat);return this.getDistance(d,b,h,c)},getDistanceByLL:function(h,c){if(!h||!c)return 0;h.lng=this.getLoop(h.lng,
  -180,180);h.lat=this.getRange(h.lat,-74,74);c.lng=this.getLoop(c.lng,-180,180);c.lat=this.getRange(c.lat,-74,74);var d=this.toRadians(h.lng);var b=this.toRadians(h.lat);h=this.toRadians(c.lng);c=this.toRadians(c.lat);return this.getDistance(d,h,b,c)},convertMC2LL:function(h){if(null===h||void 0===h)return new va(0,0);var c=new va(Math.abs(h.lng),Math.abs(h.lat));for(var d=0;d<this.MCBAND.length;d++)if(c.lat>=this.MCBAND[d]){var b=this.MC2LL[d];break}h=this.convertor(h,b);return h=new va(h.lng.toFixed(6),
  h.lat.toFixed(6))},convertLL2MC:function(h){if(null===h||void 0===h)return new va(0,0);if(180<h.lng||-180>h.lng||90<h.lat||-90>h.lat)return h;h.lng=this.getLoop(h.lng,-180,180);h.lat=this.getRange(h.lat,-74,74);var c=new va(h.lng,h.lat);for(var d=0;d<this.LLBAND.length;d++)if(c.lat>=this.LLBAND[d]){var b=this.LL2MC[d];break}if(!b)for(d=0;d<this.LLBAND.length;d++)if(c.lat<=-this.LLBAND[d]){b=this.LL2MC[d];break}h=this.convertor(h,b);return h=new va(Number(h.lng.toFixed(2)),Number(h.lat.toFixed(2)))},
  convertor:function(h,c){if(h&&c){var d=c[0]+c[1]*Math.abs(h.lng),b=Math.abs(h.lat)/c[9];c=c[2]+c[3]*b+c[4]*b*b+c[5]*b*b*b+c[6]*b*b*b*b+c[7]*b*b*b*b*b+c[8]*b*b*b*b*b*b;d*=0>h.lng?-1:1;c*=0>h.lat?-1:1;return new va(d,c)}},getDistance:function(h,c,d,b){return this.EARTHRADIUS*Math.acos(Math.sin(d)*Math.sin(b)+Math.cos(d)*Math.cos(b)*Math.cos(c-h))},toRadians:function(h){return Math.PI*h/180},toDegrees:function(h){return 180*h/Math.PI},getRange:function(h,c,d){null!=c&&(h=Math.max(h,c));null!=d&&(h=Math.min(h,
  d));return h},getLoop:function(h,c,d){for(;h>d;)h-=d-c;for(;h<c;)h+=d-c;return h}});ac(pa.prototype,{lngLatToMercator:function(h){return pa.convertLL2MC(h)},lngLatToPoint:function(h){h=pa.convertLL2MC(h);return new bc(h.lng,h.lat)},mercatorToLngLat:function(h){return pa.convertMC2LL(h)},pointToLngLat:function(h){h=new va(h.x,h.y);return pa.convertMC2LL(h)},pointToPixel:function(h,c,d,b,a){if(h)return h=this.lngLatToMercator(h,a),c=this.getZoomUnits(c),new bc(Math.round((h.lng-d.lng)/c+b.width/2),
  Math.round((d.lat-h.lat)/c+b.height/2))},pixelToPoint:function(h,c,d,b,a){if(h)return c=this.getZoomUnits(c),h=new va(d.lng+c*(h.x-b.width/2),d.lat-c*(h.y-b.height/2)),this.mercatorToLngLat(h,a)},getZoomUnits:function(h){return Math.pow(2,18-h)}});O.prototype.setMax=function(h){this.max=h||100};O.prototype.setMin=function(h){this.min=h||0};O.prototype.setMaxSize=function(h){this.maxSize=h||35};O.prototype.setMinSize=function(h){this.minSize=h||0};O.prototype.initPalette=function(){var h=this.gradient,
  c=this.paletteCtx=(new Ib(256,1)).getContext("2d"),d=c.createLinearGradient(0,0,256,1);Object.keys(h).forEach(function(b){d.addColorStop(parseFloat(b),h[b])});c.fillStyle=d;c.fillRect(0,0,256,1);c.imageData=c.getImageData(0,0,256,1).data};O.prototype.getColor=function(h){h=this.getImageData(h);return"rgba("+h[0]+", "+h[1]+", "+h[2]+", "+h[3]/256+")"};O.prototype.getImageData=function(h){var c=this.paletteCtx.imageData;if(void 0===h)return c;var d=this.max,b=this.min;h>d&&(h=d);h<b&&(h=b);h=4*Math.floor((h-
  b)/(d-b)*255);return[c[h],c[h+1],c[h+2],c[h+3]]};O.prototype.getSize=function(h){var c=this.max,d=this.min,b=this.maxSize,a=this.minSize;h>c&&(h=c);h<d&&(h=d);return a+(h-d)/(c-d)*(b-a)};ja.prototype._initialize=function(){this.v0=this._normalizaCoord(this.options.start);this.v3=this._normalizaCoord(this.options.end);this.v1=this._getControlPoint(this.v0,this.v3,4);this.v2=this._getControlPoint(this.v3,this.v0,5);this.v0[2]||(this.v0[2]=0);this.v3[2]||(this.v3[2]=0)};ja.prototype.setOptions=function(h){this.options=
  h||{};this._initialize()};ja.prototype.getPoints=function(h){void 0===h&&(h=20);for(var c=[],d=0;d<=h;d++)c.push(this._getPoint(d/h));return c};ja.prototype._normalizaCoord=function(h){if(!h)return[];h=pa.convertLL2MC({lng:Number(h[0]),lat:Number(h[1])});return[h.lng,h.lat]};ja.prototype._getControlPoint=function(h,c){var d=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1;return[].concat(Qa(this._getQuarter(h,c)),[this._getDistance(h,c)/d])};ja.prototype._getQuarter=function(h,c){return[(3*
  h[0]+c[0])/4,(3*h[1]+c[1])/4]};ja.prototype._getDistance=function(h,c){return Math.sqrt(Math.pow(h[0]-c[0],2)+Math.pow(h[1]-c[1],2))};ja.prototype._getPoint=function(h){var c=[],d=this.v0,b=this.v1,a=this.v2,f=this.v3;c.push(ib(h,d[0],b[0],a[0],f[0]),ib(h,d[1],b[1],a[1],f[1]),ib(h,d[2],b[2],a[2],f[2]));return c};var nb=function(){function h(c){y(this,h);this.options=this.getDefaultOptions();this.autoUpdate=!1;Object.assign(this.options,c);this.options.data&&(this.data=this.options.data)}D(h,[{key:"getDefaultOptions",
  value:function(){return{}}},{key:"initialize",value:function(c){}},{key:"destroy",value:function(){this.onDestroy&&this.onDestroy()}},{key:"render",value:function(){}},{key:"setData",value:function(c,d){d=d||{};this.data=c;this.onDataChanged&&this.onDataChanged(this.getData());this.onChanged&&this.onChanged(this.getOptions(),this.getData());!1!==d.autoRender&&this.webglLayer&&this.webglLayer.render()}},{key:"getData",value:function(){return this.data||[]}},{key:"setOptions",value:function(c){c=c||
  {};Object.assign(this.options,c);this.onOptionsChanged&&this.onOptionsChanged(this.getOptions());this.onChanged&&this.onChanged(this.getOptions(),this.getData());c.data?this.setData(c.data):this.webglLayer&&this.webglLayer.render()}},{key:"getOptions",value:function(){return this.options||{}}},{key:"onOptionsChanged",value:function(c){}},{key:"onDataChanged",value:function(c){}},{key:"onChanged",value:function(c,d){}},{key:"onDestroy",value:function(){}},{key:"lnglatToMercator",value:function(c,d){}},
  {key:"setWebglLayer",value:function(c){this.webglLayer=c}},{key:"getWebglLayer",value:function(){return this.webglLayer}},{key:"isRequestAnimation",value:function(){return this.autoUpdate}}]);return h}();S.prototype.use=function(h,c){h.useProgram(this.program);this.map&&"cesium"===this.map.type&&h.uniform1f(this.uniforms.log2FarDistance,this.map.map.scene.context._us.log2FarDistance)};var ob=function a(c,d,b){y(this,a);d=d||c.canvas.width;b=b||c.canvas.height;var f=c.createFramebuffer(),k=c.createTexture();
  c.bindTexture(c.TEXTURE_2D,k);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,d,b,0,c.RGBA,c.UNSIGNED_BYTE,null);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.LINEAR);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.LINEAR);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);f.texture=k;var e=c.createRenderbuffer();c.bindRenderbuffer(c.RENDERBUFFER,e);c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,d,b);f.depthBuffer=e;
  c.bindFramebuffer(c.FRAMEBUFFER,f);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,k,0);c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_ATTACHMENT,c.RENDERBUFFER,e);d=c.checkFramebufferStatus(c.FRAMEBUFFER);c.FRAMEBUFFER_COMPLETE===d&&(c.bindFramebuffer(c.FRAMEBUFFER,null),c.bindTexture(c.TEXTURE_2D,null),c.bindRenderbuffer(c.RENDERBUFFER,null),this.framebuffer=f)},zb=function(){function c(d){y(this,c);this.options={};Object.assign(this.options,d);this.vertex=[-1,1,0,-1,-1,0,
  1,1,0,1,1,0,-1,-1,0,1,-1,0];this.sampleCoord=[0,1,0,0,1,1,1,1,0,0,1,0]}D(c,[{key:"getOptions",value:function(){return this.options}},{key:"render",value:function(c){var b=c.gl;c=c.texture;var a=this.programSample;b.useProgram(a.program);var d=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,d);var k=[-1,-1,0,-1,1,0,1,1,0,1,1,0,-1,-1,0,1,-1,0];b.bufferData(b.ARRAY_BUFFER,new Float32Array(k),b.STATIC_DRAW);b.enableVertexAttribArray(a.attributes.aPos);b.vertexAttribPointer(a.attributes.aPos,3,b.FLOAT,!1,
  0,0);d=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,d);b.bufferData(b.ARRAY_BUFFER,new Float32Array([0,0,0,1,1,1,1,1,0,0,1,0]),b.STATIC_DRAW);b.enableVertexAttribArray(a.attributes.aTextureCoord);b.vertexAttribPointer(a.attributes.aTextureCoord,2,b.FLOAT,!1,0,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,c);b.uniform1i(a.uniforms.uSampler,0);b.drawArrays(b.TRIANGLES,0,k.length/3)}}]);return c}(),Vc=function(c){function d(b){y(this,d);return K(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,
  b))}M(d,c);D(d,[{key:"getProgram",value:function(b){this.programSample||(this.programSample=new S(b,{vertexShader:"attribute vec3 aPos;attribute vec2 aTextureCoord;varying vec2 vTextureCoord;void main(){vTextureCoord=aTextureCoord;gl_Position=vec4(aPos,1.0);}",fragmentShader:"precision mediump float;uniform sampler2D uSampler;varying vec2 vTextureCoord;void main(){float fStep=1.0/512.0;vec4 sample11=texture2D(uSampler,vec2(vTextureCoord.s-1.0*fStep,vTextureCoord.t+1.0*fStep));vec4 sample12=texture2D(uSampler,vec2(vTextureCoord.s,vTextureCoord.t+1.0*fStep));vec4 sample13=texture2D(uSampler,vec2(vTextureCoord.s+1.0*fStep,vTextureCoord.t+1.0*fStep));vec4 sample21=texture2D(uSampler,vec2(vTextureCoord.s-1.0*fStep,vTextureCoord.t));vec4 sample22=texture2D(uSampler,vec2(vTextureCoord.s,vTextureCoord.t));vec4 sample23=texture2D(uSampler,vec2(vTextureCoord.s+1.0*fStep,vTextureCoord.t));vec4 sample31=texture2D(uSampler,vec2(vTextureCoord.s-1.0*fStep,vTextureCoord.t-1.0*fStep));vec4 sample32=texture2D(uSampler,vec2(vTextureCoord.s,vTextureCoord.t-1.0*fStep));vec4 sample33=texture2D(uSampler,vec2(vTextureCoord.s+1.0*fStep,vTextureCoord.t-1.0*fStep));vec4 blurSample=(sample11+sample12+sample13+sample21+2.0*sample22+sample23+sample31+sample32+sample33)/10.0;gl_FragColor=blurSample;}"}));
  return this.programSample}},{key:"render",value:function(b){var a=b.gl;b=b.texture;a.clearColor(0,0,0,0);a.clear(a.COLOR_BUFFER_BIT|a.DEPTH_BUFFER_BIT);var c=this.getProgram(a);a.useProgram(c.program);var d=a.createBuffer();a.bindBuffer(a.ARRAY_BUFFER,d);a.bufferData(a.ARRAY_BUFFER,new Float32Array(this.vertex),a.STATIC_DRAW);a.enableVertexAttribArray(c.attributes.aPos);a.vertexAttribPointer(c.attributes.aPos,3,a.FLOAT,!1,0,0);d=a.createBuffer();a.bindBuffer(a.ARRAY_BUFFER,d);a.bufferData(a.ARRAY_BUFFER,
  new Float32Array(this.sampleCoord),a.STATIC_DRAW);a.enableVertexAttribArray(c.attributes.aTextureCoord);a.vertexAttribPointer(c.attributes.aTextureCoord,2,a.FLOAT,!1,0,0);a.activeTexture(a.TEXTURE1);a.bindTexture(a.TEXTURE_2D,b);a.uniform1i(c.uniforms.uSampler,1);a.drawArrays(a.TRIANGLES,0,this.vertex.length/3)}}]);return d}(zb),Wc=function(c){function d(b){y(this,d);return K(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b))}M(d,c);D(d,[{key:"getProgram",value:function(b){this.programBright||
  (this.programBright=new S(b,{vertexShader:"attribute vec3 aPos;attribute vec2 aTextureCoord;varying vec2 vTextureCoord;void main(){vTextureCoord=aTextureCoord;gl_Position=vec4(aPos,1.0);}",fragmentShader:"precision mediump float;uniform sampler2D uSampler;uniform float threshold;varying vec2 vTextureCoord;void main(){vec4 color=texture2D(uSampler,vTextureCoord);vec4 lightColor=max(vec4(0.0),(color-(1.0-threshold)/5.0));float brightness=dot(color.rgb,vec3(0.2126,0.7152,0.0722));if(brightness>threshold){color=lightColor;}else{color=vec4(0.0);}gl_FragColor=color;}"}));
  this.programBloom||(this.programBloom=new S(b,{vertexShader:"attribute vec3 aPos;attribute vec2 aTextureCoord;varying vec2 vTextureCoord;void main(){vTextureCoord=aTextureCoord;gl_Position=vec4(aPos,1.0);}",fragmentShader:"precision mediump float;uniform sampler2D uSampler;uniform bool isVertical;uniform vec2 canvasSize;uniform float blurSize;varying vec2 vTextureCoord;void main(){float weight[5];weight[0]=0.2270270270;weight[1]=0.1945945946;weight[2]=0.1216216216;weight[3]=0.0540540541;weight[4]=0.0162162162;vec2 offset=vec2(blurSize/canvasSize.x,blurSize/canvasSize.y);vec4 result=texture2D(uSampler,vTextureCoord)*weight[0];if(isVertical){for(int i=0;i<5;++i){result+=texture2D(uSampler,vTextureCoord+vec2(0.0,offset.y*float(i)))*weight[i];result+=texture2D(uSampler,vTextureCoord-vec2(0.0,offset.y*float(i)))*weight[i];}}else{for(int i=0;i<5;++i){result+=texture2D(uSampler,vTextureCoord+vec2(offset.x*float(i),0.0))*weight[i];result+=texture2D(uSampler,vTextureCoord-vec2(offset.x*float(i),0.0))*weight[i];}}gl_FragColor=result;}"}));
  this.programResult||(this.programResult=new S(b,{vertexShader:"attribute vec3 aPos;attribute vec2 aTextureCoord;varying vec2 vTextureCoord;void main(){vTextureCoord=aTextureCoord;gl_Position=vec4(aPos,1.0);}",fragmentShader:"precision mediump float;uniform sampler2D originalTexture;uniform sampler2D bloomTexture;uniform float toneScale;varying vec2 vTextureCoord;void main(){vec4 color=texture2D(originalTexture,vTextureCoord);vec4 bloomColor=texture2D(bloomTexture,vTextureCoord);color+=bloomColor;gl_FragColor=color;}"}));
  return{programBright:this.programBright,programBloom:this.programBloom,programResult:this.programResult}}},{key:"getExtraFbo",value:function(b){this.collectBrightBuffer||(this.collectBrightBuffer=new ob(b));this.bloomBuffer||(this.bloomBuffer=new ob(b));return{collectBrightBuffer:this.collectBrightBuffer.framebuffer,bloomBuffer:this.bloomBuffer.framebuffer}}},{key:"render",value:function(b){var a=b.gl,c=b.texture;b=b.fbo;var d=this.getOptions();a.clearColor(0,0,0,0);a.clear(a.COLOR_BUFFER_BIT|a.DEPTH_BUFFER_BIT);
  var e=this.getProgram(a),l=e.programBright,n=e.programBloom;e=e.programResult;var p=this.getExtraFbo(a),g=p.collectBrightBuffer;p=p.bloomBuffer;var r=a.createBuffer();a.bindBuffer(a.ARRAY_BUFFER,r);a.bufferData(a.ARRAY_BUFFER,new Float32Array(this.vertex),a.STATIC_DRAW);a.enableVertexAttribArray(l.attributes.aPos);a.vertexAttribPointer(l.attributes.aPos,3,a.FLOAT,!1,0,0);a.enableVertexAttribArray(n.attributes.aPos);a.vertexAttribPointer(n.attributes.aPos,3,a.FLOAT,!1,0,0);a.enableVertexAttribArray(e.attributes.aPos);
  a.vertexAttribPointer(e.attributes.aPos,3,a.FLOAT,!1,0,0);r=a.createBuffer();a.bindBuffer(a.ARRAY_BUFFER,r);a.bufferData(a.ARRAY_BUFFER,new Float32Array(this.sampleCoord),a.STATIC_DRAW);a.enableVertexAttribArray(l.attributes.aTextureCoord);a.vertexAttribPointer(l.attributes.aTextureCoord,2,a.FLOAT,!1,0,0);a.enableVertexAttribArray(n.attributes.aTextureCoord);a.vertexAttribPointer(n.attributes.aTextureCoord,2,a.FLOAT,!1,0,0);a.enableVertexAttribArray(e.attributes.aTextureCoord);a.vertexAttribPointer(e.attributes.aTextureCoord,
  2,a.FLOAT,!1,0,0);a.useProgram(l.program);a.bindFramebuffer(a.FRAMEBUFFER,g);a.clearColor(0,0,0,0);a.clear(a.COLOR_BUFFER_BIT|a.DEPTH_BUFFER_BIT);a.activeTexture(a.TEXTURE1);a.bindTexture(a.TEXTURE_2D,c);a.uniform1i(l.uniforms.uSampler,1);a.uniform1f(l.uniforms.threshold,d.threshold||0);a.drawArrays(a.TRIANGLES,0,this.vertex.length/3);a.useProgram(n.program);a.bindFramebuffer(a.FRAMEBUFFER,p);a.clearColor(0,0,0,0);a.clear(a.COLOR_BUFFER_BIT|a.DEPTH_BUFFER_BIT);a.activeTexture(a.TEXTURE1);a.bindTexture(a.TEXTURE_2D,
  g.texture);a.uniform1i(n.uniforms.uSampler,1);a.uniform1i(n.uniforms.isVertical,!0);a.uniform1f(n.uniforms.blurSize,d.blurSize||2);a.uniform2fv(n.uniforms.canvasSize,[a.canvas.width,a.canvas.height]);a.drawArrays(a.TRIANGLES,0,this.vertex.length/3);a.useProgram(n.program);a.bindFramebuffer(a.FRAMEBUFFER,g);a.clearColor(0,0,0,0);a.clear(a.COLOR_BUFFER_BIT|a.DEPTH_BUFFER_BIT);a.activeTexture(a.TEXTURE1);a.bindTexture(a.TEXTURE_2D,p.texture);a.uniform1i(n.uniforms.uSampler,1);a.uniform1i(n.uniforms.isVertical,
  !1);a.uniform1f(n.uniforms.blurSize,d.blurSize||2);a.uniform2fv(n.uniforms.canvasSize,[a.canvas.width,a.canvas.height]);a.drawArrays(a.TRIANGLES,0,this.vertex.length/3);a.useProgram(e.program);a.bindFramebuffer(a.FRAMEBUFFER,b);a.clearColor(0,0,0,0);a.clear(a.COLOR_BUFFER_BIT|a.DEPTH_BUFFER_BIT);a.activeTexture(a.TEXTURE1);a.bindTexture(a.TEXTURE_2D,c);a.uniform1i(e.uniforms.originalTexture,1);a.uniform1f(e.uniforms.toneScale,.5);a.activeTexture(a.TEXTURE0);a.bindTexture(a.TEXTURE_2D,g.texture);a.uniform1i(e.uniforms.bloomTexture,
  0);a.drawArrays(a.TRIANGLES,0,this.vertex.length/3);a.bindBuffer(a.ARRAY_BUFFER,null);a.useProgram(null)}}]);return d}(zb),Xc=function(c){function d(b){y(this,d);return K(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b))}M(d,c);D(d,[{key:"getProgram",value:function(b){this.programSample||(this.programSample=new S(b,{vertexShader:"attribute vec3 aPos;attribute vec2 aTextureCoord;varying vec2 vTextureCoord;void main(){vTextureCoord=aTextureCoord;gl_Position=vec4(aPos,1.0);}",fragmentShader:"precision mediump float;uniform sampler2D uSampler;uniform vec2 canvasSize;varying vec2 vTextureCoord;void main(){float fStep=1.0/312.0;vec4 sample11=texture2D(uSampler,vec2(vTextureCoord.s-1.0*fStep,vTextureCoord.t+1.0*fStep));vec4 sample12=texture2D(uSampler,vec2(vTextureCoord.s,vTextureCoord.t+1.0*fStep));vec4 sample13=texture2D(uSampler,vec2(vTextureCoord.s+1.0*fStep,vTextureCoord.t+1.0*fStep));vec4 sample21=texture2D(uSampler,vec2(vTextureCoord.s-1.0*fStep,vTextureCoord.t));vec4 sample22=texture2D(uSampler,vec2(vTextureCoord.s,vTextureCoord.t));vec4 sample23=texture2D(uSampler,vec2(vTextureCoord.s+1.0*fStep,vTextureCoord.t));vec4 sample31=texture2D(uSampler,vec2(vTextureCoord.s-1.0*fStep,vTextureCoord.t-1.0*fStep));vec4 sample32=texture2D(uSampler,vec2(vTextureCoord.s,vTextureCoord.t-1.0*fStep));vec4 sample33=texture2D(uSampler,vec2(vTextureCoord.s+1.0*fStep,vTextureCoord.t-1.0*fStep));vec4 blurSample=(sample11+sample12+sample13+sample21+2.0*sample22+sample23+sample31+sample32+sample33)/10.0;float desX=abs((gl_FragCoord.x-canvasSize.x/2.0)/(canvasSize.x/2.0));float desY=abs((gl_FragCoord.y-canvasSize.y/2.0)/(canvasSize.y/2.0));float factor=max(desX,desY);gl_FragColor=(sample22*(1.0-factor)+blurSample*factor);}"}));
  return this.programSample}},{key:"render",value:function(b){var a=b.gl;b=b.texture;var c=this.getProgram(a);a.useProgram(c.program);var d=a.createBuffer();a.bindBuffer(a.ARRAY_BUFFER,d);a.bufferData(a.ARRAY_BUFFER,new Float32Array(this.vertex),a.STATIC_DRAW);a.enableVertexAttribArray(c.attributes.aPos);a.vertexAttribPointer(c.attributes.aPos,3,a.FLOAT,!1,0,0);d=a.createBuffer();a.bindBuffer(a.ARRAY_BUFFER,d);a.bufferData(a.ARRAY_BUFFER,new Float32Array(this.sampleCoord),a.STATIC_DRAW);a.enableVertexAttribArray(c.attributes.aTextureCoord);
  a.vertexAttribPointer(c.attributes.aTextureCoord,2,a.FLOAT,!1,0,0);a.activeTexture(a.TEXTURE1);a.bindTexture(a.TEXTURE_2D,b);a.uniform1i(c.uniforms.uSampler,1);a.uniform2fv(c.uniforms.canvasSize,[a.canvas.width,a.canvas.height]);a.drawArrays(a.TRIANGLES,0,this.vertex.length/3)}}]);return d}(zb),oc=function(){function c(d){y(this,c);this.gl=d;this.effects=[];this.initFbo()}D(c,[{key:"addEffect",value:function(c){this.effects.push(c)}},{key:"removeEffect",value:function(c){}},{key:"setEffects",value:function(c){this.effects=
  c}},{key:"initFbo",value:function(){var c=this.gl;this.fbo=[new ob(c),new ob(c)]}},{key:"render",value:function(){var c=this.gl,b=this.effects;if(b&&0<b.length)for(var a={},f=0;f<b.length;f++){var k=this.fbo[f%2].framebuffer;f===b.length-1&&(k=null);c.bindFramebuffer(c.FRAMEBUFFER,k);var e=[0,0,0,0];c.clearColor(e[0],e[1],e[2],e[3]);c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT);b[f].render({gl:c,texture:a.texture,fbo:k});a=k}}}]);return c}(),Ia=function(){function c(d){y(this,c);this.map=d}D(c,[{key:"onResize",
  value:function(c){}},{key:"onUpdate",value:function(c){throw"\u672a\u5b9e\u73b0onUpdate\u65b9\u6cd5";}},{key:"getContainer",value:function(){throw"\u672a\u5b9e\u73b0getContainer\u65b9\u6cd5";}},{key:"getSize",value:function(){throw"\u672a\u5b9e\u73b0getSize\u65b9\u6cd5";}},{key:"getTilt",value:function(){throw"\u672a\u5b9e\u73b0getTilt\u65b9\u6cd5";}},{key:"getHeading",value:function(){throw"\u672a\u5b9e\u73b0getHeading\u65b9\u6cd5";}},{key:"getZoomUnits",value:function(){throw"\u672a\u5b9e\u73b0getZoomUnits\u65b9\u6cd5";
  }},{key:"getCenter",value:function(){throw"\u672a\u5b9e\u73b0getCenter\u65b9\u6cd5";}},{key:"lnglatToMercator",value:function(c,b){c=pa.convertLL2MC({lng:c,lat:b});return[c.lng,c.lat]}}]);return c}(),Yc=function(c){function d(b){y(this,d);return K(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b))}M(d,c);D(d,[{key:"onResize",value:function(b){this.map.addEventListener("resize",b)}},{key:"onUpdate",value:function(b){this.map.addEventListener("update",b);this.map.addEventListener("onearthstatuschange",
  b)}},{key:"getContainer",value:function(){return this.map.getContainer()}},{key:"getSize",value:function(){return this.map.getSize()}},{key:"getTilt",value:function(){return this.map.getTilt()}},{key:"getHeading",value:function(){return this.map.getHeading()}},{key:"getZoomUnits",value:function(){return this.map.getZoomUnits()}},{key:"getCenter",value:function(){var b=this.map.getCenter();-180<=b.lng&&180>=b.lng&&(b=this.map.lnglatToMercator(b.lng,b.lat),b={lng:b[0],lat:b[1]});return b}},{key:"lnglatToMercator",
  value:function(b,a){return this.map.lnglatToMercator(b,a)}}]);return d}(Ia),Zc=function(c){function d(b){y(this,d);b=K(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b));b.div=document.createElement("div");b.div.style.position="absolute";b.div.style.userSelect="none";b.map.getPanes().mapPane.appendChild(b.div);return b}M(d,c);D(d,[{key:"onResize",value:function(b){this.map.addEventListener("resize",b)}},{key:"changeCanvas",value:function(){var b=this.map,a=b.getSize(),c=b.getCenter();b=b.pointToOverlayPixel(c);
  this.div.style.left=b.x-a.width/2+"px";this.div.style.top=b.y-a.height/2+"px"}},{key:"onUpdate",value:function(b){var a=this;this.map.addEventListener("moveend",function(){a.changeCanvas();b()});this.map.addEventListener("moving",function(){a.changeCanvas();b()});this.map.addEventListener("zoomend",function(){a.changeCanvas();b()})}},{key:"getContainer",value:function(){return this.div}},{key:"getSize",value:function(){return this.map.getSize()}},{key:"getTilt",value:function(){return 0}},{key:"getHeading",
  value:function(){return 0}},{key:"getZoomUnits",value:function(){return Math.pow(2,18-this.map.getZoom())}},{key:"getCenter",value:function(){var b=this.map.getMapType().getProjection().lngLatToPoint(this.map.getCenter());return{lng:b.x,lat:b.y}}}]);return d}(Ia),$c=function(c){function d(b){y(this,d);return K(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b))}M(d,c);D(d,[{key:"onResize",value:function(b){window.addEventListener("resize",b)}},{key:"onUpdate",value:function(b){}},{key:"getContainer",
  value:function(){return this.map.container.getElementsByClassName("cesium-widget")[0]}},{key:"getSize",value:function(){var b=this.map;return{width:b.canvas.clientWidth,height:b.canvas.clientHeight}}},{key:"getTilt",value:function(){return 180*this.map.camera.pitch/Math.PI+90}},{key:"getHeading",value:function(){return 360-180*this.map.camera.heading/Math.PI}},{key:"getZoomUnits",value:function(){var b=this.map;return 6.8*b.scene.globe.ellipsoid.cartesianToCartographic(b.camera.position).height/6500}},
  {key:"getCenter",value:function(){var b=this.map;b=b.camera.pickEllipsoid(new Cesium.Cartesian2(b.canvas.clientWidth/2,b.canvas.clientHeight/2));b=Cesium.Ellipsoid.WGS84.cartesianToCartographic(b);b=this.getMercator([180*b.longitude/Math.PI,180*b.latitude/Math.PI]);return{lng:b[0],lat:b[1]}}},{key:"getMercator",value:function(b){var a=[];a[0]=b[0]*Math.PI/180*6378137;b=b[1]*Math.PI/180;a[1]=3189068.5*Math.log((1+Math.sin(b))/(1-Math.sin(b)));return a}}]);return d}(Ia),ad=function(c){function d(b){y(this,
  d);return K(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b))}M(d,c);D(d,[{key:"onResize",value:function(b){window.addEventListener("resize",b)}},{key:"onUpdate",value:function(b){}},{key:"getContainer",value:function(){return this.map.container}},{key:"getSize",value:function(){return{width:this.map.container.clientWidth,height:this.map.container.clientHeight}}},{key:"getTilt",value:function(){return this.map.tilt}},{key:"getHeading",value:function(){return this.map.heading}},{key:"getZoomUnits",
  value:function(){return this.map.zoomUnits}},{key:"getCenter",value:function(){return this.map.center}}]);return d}(Ia),bd=function(c){function d(b){y(this,d);return K(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b))}M(d,c);D(d,[{key:"onResize",value:function(b){window.addEventListener("resize",b)}},{key:"onUpdate",value:function(b){}},{key:"getContainer",value:function(){return this.map.container}},{key:"getSize",value:function(){return{width:this.map.container.clientWidth,height:this.map.container.clientHeight}}},
  {key:"getTilt",value:function(){return this.map.tilt}},{key:"getHeading",value:function(){return this.map.heading}},{key:"getZoomUnits",value:function(){return this.map.zoomUnits}},{key:"getCenter",value:function(){return this.map.center}}]);return d}(Ia),pc=function(){function c(d,b){y(this,c);b=b||{};this.map="bmap"===b.mapType?new Zc(d,this):"blank"===b.mapType?new ad(d):"cesium"===b.mapType?new $c(d):"three"===b.mapType?new bd(d):new Yc(d);this.map.type=b.mapType;this.options=b||{};this.renderArr=
  [];(d=b.canvas)||(d=document.createElement("canvas"));this.canvas=d;this.gl=b.gl?b.gl:cc(d);this.changeSize();this.pMatrix=T.create(Float64Array);this.oMatrix=T.create(Float64Array);this.matrix=T.create(Float64Array);this.viewMatrix=T.create(Float64Array);this.fovy=35;this._animation=this.animation.bind(this);this._update=this.update.bind(this);this.onInitialize(this.options.onInitialize);this.options.onRender&&this.renderArr.push(this.options.onRender);this.transferOptions={};this.bindBMapGL()}D(c,
  [{key:"bindBMapGL",value:function(){var c=this,b=this.map;b.onResize(function(){c.changeSize();c.render()});b.onUpdate(this._update);this.options.canvas||b.getContainer().appendChild(this.canvas)}},{key:"setOptions",value:function(c){this.options=c}},{key:"onInitialize",value:function(c){c&&(this.transferOptions=c.bind(this)(this.gl)||{})}},{key:"onRender",value:function(c){this.renderArr.push(c)}},{key:"changeSize",value:function(){var c=this.canvas;if(c){var b=c.style,a=this.map.getSize(),f=window.devicePixelRatio;
  c.width=a.width*f;c.height=a.height*f;b.cssText="position: absolute;left:0;top:0;width:"+a.width+"px;height:"+a.height+"px;z-index:2;";a=this.options;"cesium"!==a.mapType||a.canvas||(b.pointerEvents="none");this.gl.viewport(0,0,c.width,c.height)}}},{key:"update",value:function(){!1===this.options.autoUpdate||this.isAnimation||this.render()}},{key:"render",value:function(){if(this.map){var c=this.options,b=this.pMatrix,a=this.viewMatrix;if("three"===c.mapType)a=this.map.map.camera,b=a.projectionMatrix.elements,
  a=a.matrixWorldInverse.elements;else if("cesium"===c.mapType){a=this.map.map;var f=a.camera.frustum.projectionMatrix;b=new Float32Array([f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7],f[8],f[9],f[10],f[11],f[12],f[13],f[14],f[15]]);f=a.camera.viewMatrix;a=new Float32Array([f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7],f[8],f[9],f[10],f[11],f[12],f[13],f[14],f[15]])}else this.updateProjectionMatrix(),this.updateModelViewMatrix();f=T.multiply(this.matrix,b,a);Object.assign(this.transferOptions,{gl:this.gl,matrix:f,
  projectionMatrix:b,orthoMatrix:this.oMatrix,viewMatrix:a});"three"!==c.mapType&&"cesium"!==c.mapType&&this.clear();for(c=0;c<this.renderArr.length;c++)this.renderArr[c]&&this.renderArr[c].bind(this)(this.transferOptions)}}},{key:"clear",value:function(c){var b=this.gl,a=this.options.clearColor||[0,0,0,0];b.clearColor(a[0],a[1],a[2],a[3]);c&&(c instanceof Array||(c=U(c).unitArray()),b.clearColor(c[0],c[1],c[2],c[3]));b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT)}},{key:"updateProjectionMatrix",value:function(){var c=
  this.gl.canvas.width/this.gl.canvas.height;T.perspective(this.pMatrix,hb(this.fovy),c,1,4E3);this.map.getSize();T.ortho(this.oMatrix,0,this.gl.canvas.width,0,this.gl.canvas.height,1,4E3)}},{key:"updateModelViewMatrix",value:function(){var c=this.map,b=this.viewMatrix;T.identity(b);var a=c.getSize();a=Math.round(-a.height/(2*Math.tan(hb(this.fovy)/2)));T.translate(b,b,[0,0,a]);T.rotate(b,b,hb(c.getTilt()),[-1,0,0]);T.translate(b,b,[0,0,-a]);T.rotate(b,b,hb(c.getHeading()),[0,0,-1]);var f=c.getCenter(),
  k=this.options.pointOffset||[0,0];c=c.getZoomUnits();T.translate(b,b,[(k[0]-f.lng)/c,(k[1]-f.lat)/c,a]);c=1/c;T.scale(b,b,[c,c,c])}},{key:"destroy",value:function(){this.stopAnimation();this.map.getContainer().removeChild(this.canvas);this.canvas=null}},{key:"animation",value:function(){this.isAnimation&&(this.render(),window.requestAnimationFrame(this._animation))}},{key:"startAnimation",value:function(){this.isAnimation||(this.isAnimation=!0,window.requestAnimationFrame(this._animation))}},{key:"stopAnimation",
  value:function(){this.isAnimation=!1}}]);return c}(),fa=function(c){function d(b){y(this,d);return K(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b))}M(d,c);D(d,[{key:"normizedColor",value:function(b){var a=b;b instanceof Array||(a=U(b).unitArray());void 0===a[3]&&(a[3]=1);return a}},{key:"normizedPoint",value:function(b){if(!b||!b[0]||!b[1])return[0,0,0];var a=[0,0],c=this.getOptions();this.webglLayer&&this.webglLayer.options.pointOffset?a=this.webglLayer.options.pointOffset:c.pointOffset&&
  (a=c.pointOffset);c=Number(b[0]);var d=Number(b[1]);-180<=c&&180>=c&&-90<=d&&90>=d&&(d=this.webglLayer.map.lnglatToMercator(c,d),c=d[0],d=d[1]);var e=Number(b[2])||0;this.webglLayer&&"cesium"===this.webglLayer.options.mapType&&window.Cesium&&(c=this.convertLngLat([c,d]),e=window.Cesium.Cartesian3.fromDegrees(c[0],c[1],e),c=e.x,d=e.y,e=e.z);return 3<b.length?[c-a[0],d-a[1],e].concat(Qa(b.slice(3))):[c-a[0],d-a[1],e]}},{key:"convertLngLat",value:function(b){return[b[0]/2.003750834E7*180,180/Math.PI*
  (2*Math.atan(Math.exp(b[1]/2.003750834E7*180*Math.PI/180))-Math.PI/2)]}},{key:"getPointOffset",value:function(){return this.webglLayer&&this.webglLayer.options.pointOffset?this.webglLayer.options.pointOffset:[0,0]}}]);return d}(nb),fc="undefined"===typeof Symbol?"__target":Symbol(),Gc=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder,Va=window.URL||window.webkitURL,Ua=window.Worker;if(Ua){var qc=ec("self.onmessage = function () {}"),rc=new Uint8Array(1);try{if(/(?:Trident|Edge)\/(?:[567]|12)/i.test(navigator.userAgent))throw Error("Not available");
  var Pb=new Ua(qc);Pb.postMessage(rc,[rc.buffer])}catch(c){Ua=null}finally{Va.revokeObjectURL(qc),Pb&&Pb.terminate()}}var cd=new vb("./worker.js",function(c,d){function b(b){function c(a,c){for(var e=0;e<B;e++){var g=a*B+e,l=g-A,m=f.vertex.length-1;g=k.data[4*g+3];var n=15*g+10;void 0!==b.vertexHeight&&("[object Function]"===Object.prototype.toString.call(b.vertexHeight)?n=b.vertexHeight({opacity:g}):-1!==b.vertexHeight&&(n=b.vertexHeight));f.vertex[m].push(t[0]+z*e/B-G[0],t[1]-w*a/v-G[1],n);f.color[m].push(d[4*
  g]/255,d[4*g+1]/255,d[4*g+2]/255,g/255);e<B-1&&a<v-1&&!1!==c&&(f.index[m].push(l+B,l+1,l),f.index[m].push(l+1,l+B,l+B+1))}}var d=b.intensity;f=null;f={vertex:[[]],vertexBuffer:[],color:[[]],colorBuffer:[],index:[[]],indexBuffer:[]};var k=b.ctx,p=b.bound,g=b.canvasWidth,r=b.canvasHeight,m=b.zoomUnit,t=[p.minX,p.maxY],B=g,v=r,z=g/b.totalScale*m,w=r/b.totalScale*m,G=b.pointOffset||[0,0],A=0;for(p=0;p<v;p++)65536<f.vertex[f.vertex.length-1].length/3+2*B&&(A+=f.vertex[f.vertex.length-1].length/3,c(p,!1),
  f.vertex.push([]),f.color.push([]),f.index.push([])),c(p);for(p=0;p<f.vertex.length;p++)f.vertexBuffer[p]=new Float32Array(f.vertex[p]),f.colorBuffer[p]=new Float32Array(f.color[p]),f.indexBuffer[p]=new Uint16Array(f.index[p]);a.postMessage(f)}var a=this,f=null;a.addEventListener("message",function(a){b(a.data)},!1)});sa.prototype.scale=function(c,d){this.totalScale=c;this.canvasScale=d;c=this.canvas;var b=c.style;this.map.getSize();var a=this.heatmapLayer.getBounds(),f=this.map.getZoomUnits();var k=
  (a.maxX-a.minX)/f;a=(a.maxY-a.minY)/f;k=k*d*this.totalScale;a=a*d*this.totalScale;c.width=k;c.height=a;b.cssText="background: white; position: absolute;left:0;top:0;width:"+k+"px;height:"+a+"px;z-index:3;";this.ctx=c.getContext("2d")};sa.prototype.getImageData=function(){var c=this.ctx;return c.getImageData(0,0,c.canvas.width,c.canvas.height)};sa.prototype.setData=function(c){this.data=c;this._update()};sa.prototype.update=function(c){var d=this;this.clear();this._draw&&clearTimeout(this._draw);var b=
  this;this._draw=setTimeout(function(){b._draw=null;d._update();c&&c()},500)};sa.prototype.clear=function(){this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height)};sa.prototype._update=function(){this.drawHeatmap(this.ctx)};sa.prototype.drawHeatmap=function(c){var d=this.options;c=this.ctx;c.clearRect(0,0,c.canvas.width,c.canvas.height);c.save();d=d.scale||1;c.scale(d,d);this.drawGray();c.restore()};sa.prototype.drawGray=function(){var c=this.map,d=this.ctx,b=this.options,a=b.max||100,
  f=b.size||600,k=f/=this.map.getZoomUnits(),e=k/2,l=k+e;f=new Ib(2*l,2*l);var n=f.getContext("2d");n.shadowBlur=e;n.shadowColor="black";n.shadowOffsetX=n.shadowOffsetY=1E4;n.beginPath();n.arc(l-1E4,l-1E4,k,0,2*Math.PI,!0);n.closePath();n.fill();k=f.width/2;e=f.height/2;l=this.data;c=c.getZoomUnits();n=this.heatmapLayer.getBounds();var p=n.minX,g=n.maxY,r=100*c;if(l)for(var m=this.heatmapLayer.getPointOffset(),t=0;t<l.length;t++){var B=l[t];if(B.geometry){var v=this.heatmapLayer.normizedPoint(B.geometry.coordinates);
  v[0]+=m[0];v[1]+=m[1];if(!(~~v[0]<n.minX-r||~~v[0]>n.maxX+r||~~v[1]>n.maxY+r||~~v[1]<n.minY-r)){var z=void 0===B.count?1:B.count;"properties"in B&&"count"in B.properties&&(z=B.properties.count);B=Math.min(1,z/a);d.globalAlpha=void 0!==b.globalAlpha?b.globalAlpha:B;B=(v[0]-p)/c;v=(g-v[1])/c;0<f.width&&0<f.height&&d.drawImage(f,B-k,v-e)}}}};sa.prototype.destroy=function(){this.canvas=null};wb.prototype.initWorker=function(){var c=this;this.worker=new cd;var d=this.gl;this.worker.onmessage=function(b){c.output=
  b.data;for(b=0;b<c.output.vertex.length;b++){var a=d.createBuffer();d.bindBuffer(d.ARRAY_BUFFER,a);d.bufferData(d.ARRAY_BUFFER,c.output.vertexBuffer[b],d.STATIC_DRAW);c.output.vertexBuffer[b]=a;d.bindBuffer(d.ARRAY_BUFFER,null);a=d.createBuffer();d.bindBuffer(d.ARRAY_BUFFER,a);d.bufferData(d.ARRAY_BUFFER,c.output.colorBuffer[b],d.STATIC_DRAW);c.output.colorBuffer[b]=a;d.bindBuffer(d.ARRAY_BUFFER,null);a=d.createBuffer();d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,a);d.bufferData(d.ELEMENT_ARRAY_BUFFER,c.output.indexBuffer[b],
  d.STATIC_DRAW);c.output.indexBuffer[b]=a;d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,null)}c.layer.webglLayer.render()}};wb.prototype.getData=function(){return this.output};var dd=function(c){function d(b){y(this,d);b=K(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b));b.totalScale=1/3;return b}M(d,c);D(d,[{key:"getDefaultOptions",value:function(){return{scale:1/3,size:600,max:40,gradient:{"0.25":"rgba(0, 0, 255, 1)","0.55":"rgba(0, 255, 0, 1)","0.85":"rgba(255, 255, 0, 1)",1:"rgba(255, 0, 0, 1)"}}}},
  {key:"initialize",value:function(b){var a=this.map;this.intensity=new O({gradient:this.options.gradient});this._canvasScale=1.1;this._isShow=!0;this.canvasLayer=new sa(a,this.options,this);this.canvasLayer.scale(this.totalScale,this._canvasScale);this._update=this.update.bind(this);a.map.addEventListener("update",this._update);this.gl=b;this.dataMgr=new wb(this,this.map,this.gl);this.program=new S(this.gl,{vertexShader:"attribute vec3 aPos;attribute vec4 aColor;uniform mat4 u_matrix;varying vec4 vColor;void main(void){gl_Position=u_matrix*vec4(aPos,1);gl_PointSize=10.0;vColor=aColor;}",
  fragmentShader:"precision highp float;varying vec4 vColor;void main(void){gl_FragColor=vColor;}"})}},{key:"onChanged",value:function(b,a){this.intensity=new O({gradient:b.gradient});this.canvasLayer.setData(a);this.updateHeatmapModel()}},{key:"render",value:function(b){var a=b.gl,c=b.matrix;b=this.program;a.useProgram(b.program);a.uniformMatrix4fv(b.uniforms.u_matrix,!1,c);a.lineWidth(100);a.enable(a.BLEND);a.disable(a.CULL_FACE);a.blendFunc(a.SRC_ALPHA,a.ONE_MINUS_SRC_ALPHA);if(c=this.dataMgr.getData())for(var d=
  0;d<c.vertexBuffer.length;d++)a.bindBuffer(a.ARRAY_BUFFER,c.vertexBuffer[d]),a.vertexAttribPointer(b.attributes.aPos,3,a.FLOAT,!1,0,0),a.enableVertexAttribArray(b.attributes.aPos),a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,null),a.bindBuffer(a.ARRAY_BUFFER,c.colorBuffer[d]),a.vertexAttribPointer(b.attributes.aColor,4,a.FLOAT,!1,0,0),a.enableVertexAttribArray(b.attributes.aColor),a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,null),a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,c.indexBuffer[d]),a.drawElements(a.TRIANGLES,c.index[d].length,
  a.UNSIGNED_SHORT,0),a.bindBuffer(a.ARRAY_BUFFER,null);a.disable(a.BLEND)}},{key:"update",value:function(b){var a=this;a._isShow?(a.canvasLayer.scale(a.totalScale,a._canvasScale),a.canvasLayer.update(function(){a.updateHeatmapModel()}),a.webglLayer.render()):a.webglLayer.clear()}},{key:"destroy",value:function(){this.setData([]);this.map.map.removeEventListener("update",this._update);this.canvasLayer.destroy()}},{key:"updateHeatmapModel",value:function(){var b=this.getOptions(),a=this.canvasLayer.ctx;
  if(!(0>=a.canvas.width||0>=a.canvas.height)){var c=this.map;this.dataMgr.worker.postMessage({intensity:this.intensity.getImageData(),vertexHeight:b.vertexHeight,ctx:a.getImageData(0,0,a.canvas.width,a.canvas.height),totalScale:this.totalScale,canvasScale:this._canvasScale,canvasWidth:a.canvas.width,pointOffset:this.webglLayer.options.pointOffset||[0,0],canvasHeight:a.canvas.height,bound:this.getBounds(),mapSize:c.getSize(),center:c.getCenter(),zoomUnit:c.getZoomUnits()});this.webglLayer.render()}}},
  {key:"getBounds",value:function(){var b=this.map.map.getBounds(),a=b.getNorthEast();b=b.getSouthWest();-180<a.lng&&180>a.lat&&(b=pa.convertLL2MC({lng:b.lng,lat:b.lat}),a=pa.convertLL2MC({lng:a.lng,lat:a.lat}));return{minX:b.lng,minY:b.lat,maxX:a.lng,maxY:a.lat}}}]);return d}(fa),ed=new vb("./worker.js",function(c,d){function b(a){this.canvasScale=1.1;this.options=a||{};var b=new OffscreenCanvas(100,1);this.data=[];this.canvas=b;this.ctx=b.getContext("2d");this.circleSize=a.size||600}function a(a){function b(b,
  d){for(var f=0;f<z;f++){var e=b*z+f,g=e-H,m=k.vertex.length-1;e=l.data[4*e+3];var n=15*e+10;void 0!==a.vertexHeight&&("[object Function]"===Object.prototype.toString.call(a.vertexHeight)?n=a.vertexHeight({opacity:e}):-1!==a.vertexHeight&&(n=a.vertexHeight));k.vertex[m].push(y[0]+G*f/z-C[0],y[1]-A*b/w-C[1],n);k.color[m].push(c[4*e]/255,c[4*e+1]/255,c[4*e+2]/255,e/255);f<z-1&&b<w-1&&!1!==d&&(k.index[m].push(g+z,g+1,g),k.index[m].push(g+1,g+z,g+z+1))}}if(e){e.circleSize=a.canvasData.circleSize;e.setSize(a.canvasSize);
  e.setData(a.canvasData.data);e.update();var c=a.intensity;k=null;k={vertex:[[]],vertexBuffer:[],color:[[]],colorBuffer:[],index:[[]],indexBuffer:[]};var d=e.ctx,l=d.getImageData(0,0,d.canvas.width,d.canvas.height),m=a.bound,t=d.canvas.width;d=d.canvas.height;var v=a.zoomUnit,y=[m.minX,m.maxY],z=t,w=d,G=t/a.totalScale*v,A=d/a.totalScale*v,C=a.pointOffset||[0,0],H=0;for(m=0;m<w;m++)65536<k.vertex[k.vertex.length-1].length/3+2*z&&(H+=k.vertex[k.vertex.length-1].length/3,b(m,!1),k.vertex.push([]),k.color.push([]),
  k.index.push([])),b(m);for(m=0;m<k.vertex.length;m++)k.vertexBuffer[m]=new Float32Array(k.vertex[m]),k.colorBuffer[m]=new Float32Array(k.color[m]),k.indexBuffer[m]=new Uint16Array(k.index[m]);f.postMessage(k)}}var f=this;b.prototype.setSize=function(a){var b=this.canvas;b.width=a.width;b.height=a.height};b.prototype.getImageData=function(){var a=this.ctx;return a.getImageData(0,0,a.canvas.width,a.canvas.height)};b.prototype.setData=function(a){this.data=a};b.prototype.update=function(){this.clear();
  this._update()};b.prototype.clear=function(){this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height)};b.prototype._update=function(){this.drawHeatmap(this.ctx)};b.prototype.drawHeatmap=function(a){var b=this.options;a=this.ctx;a.clearRect(0,0,a.canvas.width,a.canvas.height);a.save();b=b.scale||1;a.scale(b,b);this.drawGray();a.restore()};b.prototype.drawGray=function(){var a=this.ctx,b=this.circleSize,c=b/2,d=b+c,f=new OffscreenCanvas(2*d,2*d),e=f.getContext("2d");e.shadowBlur=c;e.shadowColor=
  "black";e.shadowOffsetX=e.shadowOffsetY=1E4;e.beginPath();e.arc(d-1E4,d-1E4,b,0,2*Math.PI,!0);e.closePath();e.fill();if(b=this.data)for(c=0;c<b.length;c++)d=b[c],a.globalAlpha=d.alpha,0<f.width&&0<f.height&&a.drawImage(f,d.x,d.y)};b.prototype.destroy=function(){this.canvas=null};var k=null,e;f.addEventListener("message",function(c){c=c.data;"updateHeatmapModel"===c.type?a(c):"initialize"===c.type&&(e=new b(c.options),e.setSize(c.canvasSize))},!1)});Jb.prototype.initWorker=function(){var c=this;this.worker=
  new ed;var d=this.gl;this.worker.onmessage=function(b){c.output=b.data;for(b=0;b<c.output.vertex.length;b++){var a=d.createBuffer();d.bindBuffer(d.ARRAY_BUFFER,a);d.bufferData(d.ARRAY_BUFFER,c.output.vertexBuffer[b],d.STATIC_DRAW);c.output.vertexBuffer[b]=a;d.bindBuffer(d.ARRAY_BUFFER,null);a=d.createBuffer();d.bindBuffer(d.ARRAY_BUFFER,a);d.bufferData(d.ARRAY_BUFFER,c.output.colorBuffer[b],d.STATIC_DRAW);c.output.colorBuffer[b]=a;d.bindBuffer(d.ARRAY_BUFFER,null);a=d.createBuffer();d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,
  a);d.bufferData(d.ELEMENT_ARRAY_BUFFER,c.output.indexBuffer[b],d.STATIC_DRAW);c.output.indexBuffer[b]=a;d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,null)}c.layer.webglLayer.render()}};Jb.prototype.getData=function(){return this.output};var fd=function(c){function d(b){y(this,d);b=K(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b));b.canvasScale=1.1;b.totalScale=1/3;return b}M(d,c);D(d,[{key:"getDefaultOptions",value:function(){return{scale:1/3,size:600,max:40,gradient:{"0.25":"rgba(0, 0, 255, 1)",
  "0.55":"rgba(0, 255, 0, 1)","0.85":"rgba(255, 255, 0, 1)",1:"rgba(255, 0, 0, 1)"}}}},{key:"initialize",value:function(b){var a=this.map;this.intensity=new O({gradient:this.options.gradient});this._isShow=!0;this._update=this.update.bind(this);a.map.addEventListener("update",this._update);this.gl=b;this.dataMgr=new Jb(this,this.map,this.gl);this.dataMgr.worker.postMessage({type:"initialize",canvasSize:this.getCanvasSize(),options:this.options});this.program=new S(this.gl,{vertexShader:"attribute vec3 aPos;attribute vec4 aColor;uniform mat4 u_matrix;varying vec4 vColor;void main(void){gl_Position=u_matrix*vec4(aPos,1);gl_PointSize=10.0;vColor=aColor;}",
  fragmentShader:"precision highp float;varying vec4 vColor;void main(void){gl_FragColor=vColor;}"})}},{key:"getCanvasSize",value:function(){var b=this.getBounds(),a=this.map.getZoomUnits();this.map.getSize();var c=(b.maxX-b.minX)/a;b=(b.maxY-b.minY)/a;c=c*this.canvasScale*this.totalScale;b=b*this.canvasScale*this.totalScale;return{width:c,height:b}}},{key:"getCanvasData",value:function(b,a){var c=[],d=this.map.getZoomUnits(),e=this.getBounds(),l=this.getPointOffset(),n=e.minX,p=e.maxY,g=b.size||600,
  r=g/=this.map.getZoomUnits(),m=3*g;g*=3;for(var t=b.max||100,v=100*d,y=0;y<a.length;y++){var z=a[y];if(z.geometry){var w=this.normizedPoint(z.geometry.coordinates);w[0]+=l[0];w[1]+=l[1];if(!(~~w[0]<e.minX-v||~~w[0]>e.maxX+v||~~w[1]>e.maxY+v||~~w[1]<e.minY-v)){var G=void 0===z.count?1:z.count;"properties"in z&&"count"in z.properties&&(G=z.properties.count);z=Math.min(1,G/t);c.push({x:(w[0]-n)/d-m,y:(p-w[1])/d-g,alpha:void 0!==b.globalAlpha?b.globalAlpha:z})}}}return{circleSize:r,data:c}}},{key:"onChanged",
  value:function(b,a){this.intensity=new O({gradient:b.gradient})}},{key:"render",value:function(b){var a=b.gl,c=b.matrix;b=this.program;a.useProgram(b.program);a.uniformMatrix4fv(b.uniforms.u_matrix,!1,c);a.lineWidth(100);a.enable(a.BLEND);a.disable(a.CULL_FACE);a.blendFunc(a.SRC_ALPHA,a.ONE_MINUS_SRC_ALPHA);if(c=this.dataMgr.getData())for(var d=0;d<c.vertexBuffer.length;d++)a.bindBuffer(a.ARRAY_BUFFER,c.vertexBuffer[d]),a.vertexAttribPointer(b.attributes.aPos,3,a.FLOAT,!1,0,0),a.enableVertexAttribArray(b.attributes.aPos),
  a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,null),a.bindBuffer(a.ARRAY_BUFFER,c.colorBuffer[d]),a.vertexAttribPointer(b.attributes.aColor,4,a.FLOAT,!1,0,0),a.enableVertexAttribArray(b.attributes.aColor),a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,null),a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,c.indexBuffer[d]),a.drawElements(a.TRIANGLES,c.index[d].length,a.UNSIGNED_SHORT,0),a.bindBuffer(a.ARRAY_BUFFER,null);a.disable(a.BLEND)}},{key:"update",value:function(b){var a=this;this._isShow?(this.canvasUpdate(function(){a.updateHeatmapModel()}),
  this.webglLayer.render()):this.webglLayer.clear()}},{key:"canvasUpdate",value:function(b){this._draw&&clearTimeout(this._draw);this._draw=setTimeout(function(){b&&b()},500)}},{key:"destroy",value:function(){this.setData([]);this.map.map.removeEventListener("update",this._update)}},{key:"updateHeatmapModel",value:function(){var b=this.getOptions(),a=this.map;this.dataMgr.worker.postMessage({type:"updateHeatmapModel",intensity:this.intensity.getImageData(),canvasData:this.getCanvasData(this.options,
  this.getData()),canvasSize:this.getCanvasSize(),vertexHeight:b.vertexHeight,totalScale:this.totalScale,canvasScale:this.canvasScale,pointOffset:this.webglLayer.options.pointOffset||[0,0],bound:this.getBounds(),mapSize:a.getSize(),center:a.getCenter(),zoomUnit:a.getZoomUnits()});this.webglLayer.render()}},{key:"getBounds",value:function(){var b=this.map.map.getBounds(),a=b.getNorthEast();b=b.getSouthWest();-180<a.lng&&180>a.lat&&(b=pa.convertLL2MC({lng:b.lng,lat:b.lat}),a=pa.convertLL2MC({lng:a.lng,
  lat:a.lat}));return{minX:b.lng,minY:b.lat,maxX:a.lng,maxY:a.lat}}}]);return d}(fa);Ga.deviation=function(c,d,b,a){var f=d&&d.length,k=Math.abs(Kb(c,0,f?d[0]*b:c.length,b));if(f){f=0;for(var e=d.length;f<e;f++)k-=Math.abs(Kb(c,d[f]*b,f<e-1?d[f+1]*b:c.length,b))}for(f=d=0;f<a.length;f+=3){e=a[f]*b;var l=a[f+1]*b,n=a[f+2]*b;d+=Math.abs((c[e]-c[n])*(c[l+1]-c[e+1])-(c[e]-c[l])*(c[n+1]-c[e+1]))}return 0===k&&0===d?0:Math.abs((d-k)/k)};Ga.flatten=function(c){for(var d=c[0][0].length,b={vertices:[],holes:[],
  dimensions:d},a=0,f=0;f<c.length;f++){for(var k=0;k<c[f].length;k++)for(var e=0;e<d;e++)b.vertices.push(c[f][k][e]);0<f&&(a+=c[f-1].length,b.holes.push(a))}return b};Ga.default=Ga;var gd=new vb("./worker.js",function(c,d){}),sc={window:1,windowAnimation:2,gradual:3,ripple:4},tc=function(c){function d(b,a){y(this,d);b=K(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,a));b._isShow=!0;a=b.getOptions();if("windowAnimation"===a.style||"ripple"===a.style||0<a.riseTime)b.autoUpdate=!0;b.textureCache=
  {};return b}M(d,c);D(d,[{key:"getDefaultOptions",value:function(){return{opacity:.8,isTextureFull:!1,topColor:"rgba(76, 76, 76, 76)",textureScale:1,useLight:!0,riseTime:0}}},{key:"initialize",value:function(b){this.gl=b;this.dataMgr=new Ha(this,this.gl);this.texture=null;this.isUseTexture=!1;this.vertexLength=14;this.program=new S(this.gl,{vertexShader:"precision highp float;attribute vec3 a_pos;attribute vec3 a_normal;attribute vec3 a_color;attribute vec3 a_pre_color;attribute float a_height;attribute float a_pre_height;attribute vec2 a_texture_coord;uniform mat4 u_proj_matrix;uniform mat4 u_mv_matrix;uniform mat4 u_normal_matrix;uniform vec3 u_side_light_dir;uniform bool u_use_lighting;uniform bool u_use_texture;uniform vec3 u_ripple_center;uniform float u_radius;uniform float style;uniform float alpha;uniform float time;uniform float dataTime;uniform float riseTime;uniform vec2 uMapCenter;uniform float uMapZoom;varying float v_height;varying vec3 v_color;varying vec3 v_position;varying vec2 v_texture_coord;const vec3 point_color=vec3(0.06,0.06,0.06);const vec3 light_color=vec3(0.53,0.53,0.53);const vec3 light_color_2=vec3(0.4,0.4,0.4);const vec3 uAmbientColor=vec3(0.2,0.2,0.2);const vec3 uLightingDirection=vec3(0.0,1.0,1.0);const vec3 uDirectionalColor=vec3(1.0,1.0,1.0);float getTransitionValue(float pre_value,float to_value,float dataTime,float riseTime){float result=0.0;if(pre_value==to_value){result=to_value;}else{if(riseTime>0.0&&dataTime<riseTime){result=(pre_value+(to_value-pre_value)*(dataTime/riseTime));}else{result=to_value;}}return result;}void main(){vec3 pos=a_pos;pos.z=pos.z*getTransitionValue(a_pre_height,a_height,dataTime,riseTime);v_position=pos;v_height=a_height;if(u_use_texture){v_texture_coord=a_texture_coord;}vec4 position=u_proj_matrix*u_mv_matrix*vec4(pos,1.0);gl_Position=position;vec3 icolor=a_color;if(u_use_lighting){vec3 N=normalize(vec3(u_normal_matrix*vec4(a_normal,1.0)));vec4 point_dir=u_mv_matrix*vec4(0,1,0,0);vec3 L_point=normalize(point_dir.xyz);float lambert_point=max(0.0,dot(N,-L_point));vec4 light_dir=u_mv_matrix*vec4(u_side_light_dir,0);vec3 L=normalize(light_dir.xyz);float lambert=max(0.0,dot(N,-L));if(pos.z<5.0){float deepGradientColor=(5.0-pos.z)/8.0;lambert=lambert-deepGradientColor;}vec4 light_dir_2=u_mv_matrix*vec4(0,0,-1,0);vec3 L2=normalize(light_dir_2.xyz);float lambert_2=max(0.0,dot(N,-L2));if(a_pre_color.r==a_color.r&&a_pre_color.g==a_color.g&&a_pre_color.b==a_color.b){}else{if(riseTime>0.0&&dataTime<riseTime){icolor.r=a_pre_color.r+(a_color.r-a_pre_color.r)*(dataTime/riseTime);icolor.g=a_pre_color.g+(a_color.g-a_pre_color.g)*(dataTime/riseTime);icolor.b=a_pre_color.b+(a_color.b-a_pre_color.b)*(dataTime/riseTime);}}v_color=icolor+icolor*light_color*lambert+icolor*light_color_2*lambert_2+icolor*point_color*lambert_point;if(u_use_texture){mat3 normalMatrix=mat3(u_normal_matrix);vec3 transformedNormal=normalMatrix*a_normal;vec3 dir=uLightingDirection;dir=vec3(normalMatrix*vec3(0.0,-1.0,2.0));float directionalLightWeighting=max(dot(normalize(transformedNormal),normalize(dir)),0.0);vec3 vLightWeighting;vLightWeighting=uAmbientColor+uDirectionalColor*directionalLightWeighting;v_color=vLightWeighting;}}else{v_color=icolor;}}",
  fragmentShader:"precision highp float;varying vec3 v_color;varying vec3 v_position;varying float v_height;varying vec2 v_texture_coord;uniform vec3 u_ripple_center;uniform vec4 top_color;uniform float u_radius;uniform float style;uniform float alpha;uniform float time;uniform sampler2D u_sampler;uniform bool u_use_lighting;uniform bool u_use_texture;void main(){vec4 color=vec4(v_color,alpha);vec4 textureColor=vec4(1.0,1.0,1.0,1.0);if(u_use_texture){textureColor=texture2D(u_sampler,vec2(v_texture_coord.s,v_texture_coord.t));if(u_use_lighting){color=vec4(textureColor.rgb*v_color,textureColor.a);}else{color=textureColor;}}if(style==1.0||style==2.0){float t=time/1000.0;float diffDistance=5.0;float modX=mod(v_position.x,diffDistance*2.0);float modZ=mod(v_position.z,diffDistance*2.0);if(modX<diffDistance&&modZ<diffDistance&&v_position.z<v_height){color*=1.05;if(time>0.0&&style==2.0){float iX=ceil(v_position.x/diffDistance);float iZ=ceil(v_position.z/diffDistance);float timeDistance=8.0;t+=tan(sin(iZ));color*=(1.0+mod(t,timeDistance)/timeDistance);}}color.a=alpha;}else if(style==5.0){float t=time/1000.0;float diffDistance=10.0;float modZ=mod(v_position.z-t*40.0,diffDistance*2.0);color.a=1.0-pow(v_position.z/v_height,0.5);if(v_position.z/v_height<0.3){color.r+=0.2;color.g+=0.2;color.b+=0.2;}if(modZ<diffDistance*2.0-4.0){discard;}}else if(style==3.0){float diffDistance=10.0;float modX=mod(v_position.x,diffDistance*2.0);color.a=1.0-pow(v_position.z/v_height,0.3);}else if(style==4.0){float dis=distance(u_ripple_center,v_position);float rSize=400.0;if(v_position.z>=v_height){color=top_color;}if(dis>u_radius-rSize&&dis<u_radius+rSize){color*=(1.0-abs(dis-u_radius)/rSize)*2.0+1.0;}}gl_FragColor=color;}"});
  this.initializeTime=new Date;this.normalMatrix=T.create()}},{key:"onChanged",value:function(b,a){var c=this;this.gl&&(this.loadTextureTime&&clearTimeout(this.loadTextureTime),this.loadTextureTime=setTimeout(function(){c.loadTexture(function(){c.dataMgr.parseData(a);c.dataTime=new Date;c.webglLayer.render()})},0))}},{key:"render",value:function(b){var a=b.gl,c=b.projectionMatrix,d=b.viewMatrix;if(this._isShow){if((b=this.getData())&&!(0>=b.length)){b=this.program;var e=b.uniforms;b=b.attributes;a.useProgram(this.program.program);
  var l=this.getOptions();if(l.texture)if(this.texture)a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,this.texture),a.uniform1i(e.u_sampler,0);else return;a.enable(a.DEPTH_TEST);a.enable(a.POLYGON_OFFSET_FILL);a.polygonOffset(1,1);var n=a.isEnabled(a.BLEND),p=a.isEnabled(a.CULL_FACE);a.disable(a.CULL_FACE);l.blend&&(a.enable(a.BLEND),a.blendFunc(a.ONE,a.ONE),a.blendEquation(a.FUNC_ADD));a.uniformMatrix4fv(e.u_proj_matrix,!1,c);a.uniformMatrix4fv(e.u_mv_matrix,!1,d);c=0;l.style&&sc[l.style]&&
  (c=sc[l.style]);"gradual"===l.style?(a.depthMask(!1),a.enable(a.BLEND),a.blendFunc(a.SRC_ALPHA,a.ONE_MINUS_SRC_ALPHA)):a.depthMask(!0);a.uniform1f(e.style,c);c=this.normizedColor(l.topColor);a.uniform4f(e.top_color,c[0],c[1],c[2],void 0===c[3]?1:c[3]);a.uniform1i(e.u_use_lighting,l.useLight);a.uniform1i(e.u_use_texture,this.isUseTexture);a.uniform1f(e.alpha,void 0===l.opacity?.8:parseFloat(l.opacity));a.uniform1f(e.time,new Date-this.initializeTime);a.uniform1f(e.dataTime,new Date-this.dataTime);
  a.uniform1f(e.riseTime,l.riseTime);"ripple"===l.style&&l.rippleLayer&&l.rippleLayer.data&&l.rippleLayer.data[0]&&(c=this.normizedPoint(l.rippleLayer.data[0].geometry.coordinates),a.uniform3fv(e.u_ripple_center,[c[0],c[1],0]),a.uniform1f(e.u_radius,l.rippleLayer.options.size*l.rippleLayer.currentScale));c=bb.fromValues(0,-1,2);l.lightDir&&(c=bb.fromValues(l.lightDir[0],l.lightDir[1],l.lightDir[2]));a.uniform3fv(e.u_side_light_dir,c);a.enableVertexAttribArray(b.a_pos);a.enableVertexAttribArray(b.a_normal);
  a.enableVertexAttribArray(b.a_color);a.enableVertexAttribArray(b.a_pre_color);a.enableVertexAttribArray(b.a_height);a.enableVertexAttribArray(b.a_pre_height);l.texture?a.enableVertexAttribArray(b.a_texture_coord):a.disableVertexAttribArray(b.a_texture_coord);c=this.normalMatrix;T.invert(c,d);T.transpose(c,c);a.uniformMatrix4fv(e.u_normal_matrix,!1,c);d=this.dataMgr.getData();e=4*this.vertexLength;for(c=0;c<d.vertex.length;c++)0>=d.vertex[c].length||(a.bindBuffer(a.ARRAY_BUFFER,d.vertexBuffer[c]),
  a.vertexAttribPointer(b.a_pos,3,a.FLOAT,!1,e,0),a.vertexAttribPointer(b.a_normal,3,a.FLOAT,!1,e,12),a.vertexAttribPointer(b.a_color,3,a.FLOAT,!1,e,24),a.vertexAttribPointer(b.a_pre_color,3,a.FLOAT,!1,e,36),a.vertexAttribPointer(b.a_height,1,a.FLOAT,!1,e,48),a.vertexAttribPointer(b.a_pre_height,1,a.FLOAT,!1,e,52),l.texture&&a.vertexAttribPointer(b.a_texture_coord,2,a.FLOAT,!1,e,56),a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,d.indexBuffer[c]),a.drawElements(a.TRIANGLES,d.index[c].length,a.UNSIGNED_SHORT,0),
  a.bindBuffer(a.ARRAY_BUFFER,null),a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,null));l.blend&&!1===n&&a.disable(a.BLEND);p&&a.enable(a.CULL_FACE);a.disable(a.DEPTH_TEST);a.depthMask(!0);a.disable(a.POLYGON_OFFSET_FILL)}}else this.webglLayer.clear()}},{key:"loadTexture",value:function(b){var a=this,c=this.getOptions();c.texture?(this.vertexLength=16,this.isUseTexture=!0,ub(this.gl,c.texture,function(c,d){a.image=d;a.texture=c;b&&b();a.webglLayer.render()})):(this.vertexLength=14,this.isUseTexture=!1,this.image=
  this.texture=null,b&&b())}}]);return d}(fa);Ha.prototype.initData=function(){this.outBuilding3d={vertex:[[]],vertexBuffer:[],index:[[]],indexBuffer:[]}};Ha.prototype.getData=function(){return this.outBuilding3d};Ha.prototype.initWorker=function(){this.worker=new gd;this.worker.onmessage=function(c){}};Ha.prototype.parseData=function(c){var d=this;this.initData();for(var b=this.gl,a=this.shapeLayer.getOptions(),f=0;f<c.length;f++){var k=c[f],e=k.height||0;"properties"in k&&"height"in k.properties&&
  (e=k.properties.height);e*=1;var l=k.color||a.color||[.1,.1,.1];"properties"in k&&"color"in k.properties&&(l=k.properties.color);"[object Function]"===Object.prototype.toString.call(l)&&(l=l(k));l=this.shapeLayer.normizedColor(l);var n=void 0,p=void 0;a.riseTime&&(p=k.preColor,"properties"in k&&"preColor"in k.properties&&(p=k.properties.preColor),n=k.preHeight,"properties"in k&&"preHeight"in k.properties&&(n=k.properties.preHeight),void 0===n&&(n=0));if(k.geometry.coordinates)if("MultiPolygon"===
  k.geometry.type)for(var g=k.geometry.coordinates,r=function(a){var b=[];k.geometry.coordinates[a][0].forEach(function(a){a=d.shapeLayer.normizedPoint(a);b.push(a[0],a[1])});d.parseBuilding3d(b,n,e,p,l,d.outBuilding3d)},m=0;m<g.length;m++)r(m);else(function(){var a=[];k.geometry.coordinates[0].forEach(function(b){b=d.shapeLayer.normizedPoint(b);a.push(b[0],b[1])});d.parseBuilding3d(a,n,e,p,l,d.outBuilding3d)})()}for(c=0;c<this.outBuilding3d.vertex.length;c++){a=[];f=this.outBuilding3d.vertex[c].length;
  for(m=0;m<f;m++)for(g=this.outBuilding3d.vertex[c][m].length,a.push(this.outBuilding3d.vertex[c][m][0]),a.push(this.outBuilding3d.vertex[c][m][1]),r=2;r<g;r++)a.push(this.outBuilding3d.vertex[c][m][r]);m=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,m);b.bufferData(b.ARRAY_BUFFER,new Float32Array(a),b.STATIC_DRAW);this.outBuilding3d.vertexBuffer[c]=m;b.bindBuffer(b.ARRAY_BUFFER,null);m=b.createBuffer();b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,m);b.bufferData(b.ELEMENT_ARRAY_BUFFER,new Uint16Array(this.outBuilding3d.index[c]),
  b.STATIC_DRAW);this.outBuilding3d.indexBuffer[c]=m;b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,null)}};Ha.prototype.getBounds=function(c){for(var d=c[0],b=c[1],a=c[0],f=c[1],k=0;k<c.length;k+=2)d=Math.min(c[k],d),b=Math.min(c[k+1],b),a=Math.max(c[k],a),f=Math.max(c[k+1],f);return{minX:d,minY:b,maxX:a,maxY:f,width:a-d,height:f-b}};Ha.prototype.parseBuilding3d=function(c,d,b,a,f,k){void 0===d&&(d=b);var e=this.shapeLayer.options,l=k.vertex[k.vertex.length-1],n=k.index[k.index.length-1];f=f||[.328125,.51953125,
  .8125];void 0===a&&(a=f);65536<=l.length+2*c.length&&(l=[],n=[],k.vertex.push(l),k.index.push(n));if("gradual"!=e.style){k=Ga(c);var p=k[0],g=k[1],r=k[2];p=[c[2*p],c[2*p+1],1];g=[c[2*g],c[2*g+1],1];var m=[c[2*r],c[2*r+1],1];r=[];bb.cross(r,[m[0]-g[0],m[1]-g[1],m[2]-g[2]],[p[0]-g[0],p[1]-g[1],p[2]-g[2]]);p=l.length;if(e.texture)var t=this.getBounds(c);g=0;for(m=c.length;g<m;g+=2){var v=[c[g],c[g+1],1,r[0],r[1],r[2],f[0],f[1],f[2],a[0],a[1],a[2]];v.push(b);v.push(d);e.texture&&(v.push((c[g]-t.minX)/
  t.width),v.push(-(t.maxY-c[g+1])/t.height));l.push(v)}t=0;for(r=k.length;t<r;t++)n.push(k[t]+p)}if(!(b===d&&0>=b))for(t=k=0,this.shapeLayer.image&&(k=this.shapeLayer.image.width*e.textureScale,t=this.shapeLayer.image.height*e.textureScale),r=0,p=c.length;r<p;r+=2){var y=c[r],z=c[r+1];g=[y,z,0];m=[y,z,1];v=r+2;var w=r+3;r===p-2&&(v=0,w=1);v=c[v];w=c[w];z=Math.sqrt(Math.pow(v-y,2),Math.pow(w-z,2));y=[v,w,0];v=[v,w,1];w=[];bb.cross(w,[y[0]-g[0],y[1]-g[1],y[2]-g[2]],[m[0]-g[0],m[1]-g[1],m[2]-g[2]]);g.push(w[0],
  w[1],w[2]);m.push(w[0],w[1],w[2]);y.push(w[0],w[1],w[2]);v.push(w[0],w[1],w[2]);g.push(f[0],f[1],f[2]);g.push(a[0],a[1],a[2]);m.push(f[0],f[1],f[2]);m.push(a[0],a[1],a[2]);y.push(f[0],f[1],f[2]);y.push(a[0],a[1],a[2]);v.push(f[0],f[1],f[2]);v.push(a[0],a[1],a[2]);g.push(b);g.push(d);m.push(b);m.push(d);y.push(b);y.push(d);v.push(b);v.push(d);e.texture&&(e.isTextureFull?(g.push(0,0),m.push(0,1),y.push(1,0),v.push(1,1)):(g.push(0,0),m.push(0,b/t),y.push(z/k,0),v.push(z/k,b/t)));z=l.length;l.push(g);
  l.push(m);l.push(y);l.push(v);n.push(z,z+2,z+3,z,z+3,z+1)}};var uc=function(c){function d(b,a){y(this,d);b=K(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,a));b.preHeightMapper={};b.preColorMapper={};return b}M(d,c);D(d,[{key:"getDefaultOptions",value:function(){return Object.assign(mb(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"getDefaultOptions",this).call(this),{style:"grid",gridSize:500,height:function(){return 1E3},color:function(){return"rgb(200, 200, 20)"}})}},{key:"generateGrid",
  value:function(b,a){var c=a.gridSize,d=[],e={};a=b.length;for(var l=this.getPointOffset(),n=0;n<a;n++){var p=this.normizedPoint(b[n].geometry.coordinates);p=~~((p[0]+l[0])/c)+"_"+~~((p[1]+l[1])/c);void 0===e[p]&&(e[p]=0);var g=~~b[n].count||1;"properties"in b[n]&&"count"in b[n].properties&&(g=~~b[n].properties.count);e[p]+=g}Object.keys(e).forEach(function(a){var b=a.split("_");d.push([b[0]*c+c/2,b[1]*c+c/2,e[a]])});return d}},{key:"onChanged",value:function(b,a){a=this.processData(a);mb(d.prototype.__proto__||
  Object.getPrototypeOf(d.prototype),"onChanged",this).call(this,b,a)}},{key:"getGridDataRange",value:function(){var b=this.gridData,a=void 0,c=void 0;b[0]&&(a=b[0][2],c=b[0][2]);for(var d=b.length,e=0;e<d;e++){var l=b[e];a=Math.max(l[2],a);c=Math.min(l[2],c)}return{max:a/2,min:c}}},{key:"processData",value:function(b){var a=this.getOptions(),c=a.style,d=a.gridSize,e=[];this.gridData=e;if("normal"===c){c=this.getPointOffset();for(var l=0;l<b.length;l++){var n=this.normizedPoint(b[l].geometry.coordinates),
  p=n[0]+c[0];n=n[1]+c[1];var g=~~b[l].count||1;"properties"in b[l]&&"count"in b[l].properties&&(g=~~b[l].properties.count);var r=b[l].color;"properties"in b[l]&&"color"in b[l].properties&&(r=~~b[l].properties.color);e.push([p,n,g,r])}}else e=this.generateGrid(b,a);b=[];this._preHeightMapper={};this._preColorMapper={};for(c=0;c<e.length;c++)l=e[c],l[0]=l[0],l[1]=l[1],p=l[2],a.height&&(p="function"===typeof a.height?a.height({count:l[2]}):a.height),n=d/2-5,g=l[3],a.color&&(g="function"===typeof a.color?
  a.color({count:l[2],color:l[3]}):U(g).unitArray()),r="p"+l[0]+l[1],b.push({geometry:{type:"Polygon",coordinates:[[[l[0]-n,l[1]-n],[l[0]-n,l[1]+n],[l[0]+n,l[1]+n],[l[0]+n,l[1]-n]]]},color:g,preHeight:this.preHeightMapper[r],preColor:this.preColorMapper[r],height:p}),this._preHeightMapper[r]=p,this._preColorMapper[r]=g;this.preHeightMapper=this._preHeightMapper;this.preColorMapper=this._preColorMapper;return b}}]);return d}(tc),vc=function(c){function d(b){y(this,d);return K(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,
  b))}M(d,c);D(d,[{key:"initialize",value:function(b){var a=this;this.children&&this.children.forEach(function(c){c.setWebglLayer(a.getWebglLayer());c.initialize&&c.initialize(b)})}},{key:"isRequestAnimation",value:function(){if(void 0!==this.autoUpdate)return mb(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"isRequestAnimation",this).call(this);for(var b=!1,a=0;a<this.children.length;a++)if(this.children[a].isRequestAnimation()){b=!0;break}return b}},{key:"render",value:function(b){this.children&&
  this.children.forEach(function(a){a.render(b)})}}]);return d}(nb),hd=function(c){function d(b,a){y(this,d);b=K(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,a));b.gridLayer=new uc(b.getGridOptions());b.children=[b.gridLayer];b.options.riseTime&&(b.autoUpdate=!0);return b}M(d,c);D(d,[{key:"onDataChanged",value:function(b){this.gridLayer.setData(b)}},{key:"getGridOptions",value:function(){var b=this.getOptions(),a=b.max,c=b.min;void 0===a&&(c=this.gridLayer.getGridDataRange(),a=c.max,c=c.min);
  var d=new O({max:a,min:c,gradient:b.gradient,maxSize:b.maxHeight,minSize:b.minHeight});b.height=function(a){var b=d.getSize(a.count);"properties"in a&&"count"in a.properties&&(b=d.getSize(a.properties.count));return b};b.color=function(a){var b=d.getImageData(a.count);"properties"in a&&"count"in a.properties&&(b=d.getImageData(a.properties.count));return[b[0]/255,b[1]/255,b[2]/255]};return b}},{key:"onOptionsChanged",value:function(b){this.gridLayer.setOptions(this.getGridOptions())}},{key:"getDefaultOptions",
  value:function(){return{style:"grid",gridSize:500,maxHeight:8E3,minHeight:200,gradient:{0:"rgb(50, 50, 256)","0.1":"rgb(50, 250, 56)","0.5":"rgb(250, 250, 56)",1:"rgb(250, 50, 56)"}}}}]);return d}(vc),wc=function(c){function d(b,a){y(this,d);b=K(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,a));b.bufferData=[];return b}M(d,c);D(d,[{key:"initialize",value:function(b){this.gl=b;this.program=new S(this.gl,{vertexShader:"uniform mat4 u_matrix;attribute vec3 aPos;attribute vec4 aColor;varying vec4 vColor;void main(){if(aColor.w>=0.0&&aColor.w<=1.0){vColor=aColor;}else{vColor=vec4(aColor.xyz,1.0);}gl_Position=u_matrix*vec4(aPos,1.0);}",
  fragmentShader:"precision highp float;varying vec4 vColor;void main(){gl_FragColor=vColor;}"},this);this.f32BufferData=new Float32Array;this.buffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,this.buffer)}},{key:"onChanged",value:function(b,a){var c=this,d=this.gl;if(d){this.buffer=d.createBuffer();d.bindBuffer(d.ARRAY_BUFFER,this.buffer);var e=[],l=function(a,b){if(a)for(var d=0;d<a.length-1;d++){var f=c.normizedPoint(a[d]);e.push(f[0]);e.push(f[1]);e.push(f[2]);e.push(b[0],b[1],b[2],b[3]);f=c.normizedPoint(a[d+
  1]);e.push(f[0]);e.push(f[1]);e.push(f[2]);e.push(b[0],b[1],b[2],b[3])}};b=b.color;for(var n=0;n<a.length;n++){var p=a[n].color||b;"properties"in a[n]&&"color"in a[n].properties&&(p=a[n].properties.color);"[object Function]"===Object.prototype.toString.call(p)&&(p=p(a[n]));p=this.normizedColor(p);var g=a[n].geometry,r=g.coordinates;if("MultiPolygon"===g.type){if(r)for(g=0;g<r.length;g++)l(r[g][0],p)}else"Polygon"===g.type?r&&l(r[0],p):l(r,p)}this.bufferData=e;this.f32BufferData=new Float32Array(e);
  d.bufferData(d.ARRAY_BUFFER,this.f32BufferData,d.STATIC_DRAW)}}},{key:"render",value:function(b){var a=b.gl,c=b.matrix;!this.bufferData||0>=this.bufferData.length||(b=this.program,b.use(a),a.uniformMatrix4fv(b.uniforms.u_matrix,!1,c),a.bindBuffer(a.ARRAY_BUFFER,this.buffer),c=this.f32BufferData.BYTES_PER_ELEMENT,a.enableVertexAttribArray(b.attributes.aPos),a.vertexAttribPointer(b.attributes.aPos,3,a.FLOAT,!1,7*c,0),a.enableVertexAttribArray(b.attributes.aColor),a.vertexAttribPointer(b.attributes.aColor,
  4,a.FLOAT,!1,7*c,3*c),b=this.getOptions().blend,a.enable(a.BLEND),a.enable(a.DEPTH_TEST),a.depthFunc(a.LEQUAL),a.blendEquation(a.FUNC_ADD),b&&"lighter"===b?a.blendFunc(a.SRC_ALPHA,a.ONE):a.blendFunc(a.SRC_ALPHA,a.ONE_MINUS_SRC_ALPHA),a.drawArrays(a.LINES,0,this.bufferData.length/7),a.bindBuffer(a.ARRAY_BUFFER,null),a.disable(a.BLEND),a.disable(a.DEPTH_TEST),a.useProgram(null))}}]);return d}(fa);ha(function(c,d){(function(b,a){c.exports=a()})(Lc,function(){function b(a){return"undefined"!==typeof atob?
  atob(a):"base64:"+a}function a(a){a=Error("(regl) "+a);console.error(a);throw a;}function c(b,c){b||a(c)}function d(a){return a?": "+a:""}function e(b,c,f){0>c.indexOf(b)&&a("invalid value"+d(f)+". must be one of: "+c)}function l(a,b){for(a+="";a.length<b;)a=" "+a;return a}function n(){this.name="unknown";this.lines=[];this.index={};this.hasErrors=!1}function p(a,b){this.number=a;this.line=b;this.errors=[]}function g(a,b,c){this.file=a;this.line=b;this.message=c}function r(){var a=Error();a=(a.stack||
  a).toString();var b=/compileProcedure.*\n\s*at.*\((.*)\)/.exec(a);return b?b[1]:(a=/compileProcedure.*\n\s*at\s+(.*)(\n|$)/.exec(a))?a[1]:"unknown"}function m(){var a=Error();a=(a.stack||a).toString();var b=/at REGLCommand.*\n\s+at.*\((.*)\)/.exec(a);return b?b[1]:(a=/at REGLCommand.*\n\s+at\s+(.*)\n/.exec(a))?a[1]:"unknown"}function t(a,c){a=a.split("\n");var d=1,f=0,e={unknown:new n,0:new n};e.unknown.name=e[0].name=c||r();e.unknown.lines.push(new p(0,""));for(c=0;c<a.length;++c){var g=a[c],k=/^\s*#\s*(\w+)\s+(.+)\s*$/.exec(g);
  if(k)switch(k[1]){case "line":if(k=/(\d+)(\s+\d+)?/.exec(k[2]))d=k[1]|0,k[2]&&(f=k[2]|0,f in e||(e[f]=new n));break;case "define":if(k=/SHADER_NAME(_B64)?\s+(.*)$/.exec(k[2]))e[f].name=k[1]?b(k[2]):k[2]}e[f].lines.push(new p(d++,g))}Object.keys(e).forEach(function(a){var b=e[a];b.lines.forEach(function(a){b.index[a.number]=a})});return e}function v(a){var b=[];a.split("\n").forEach(function(a){if(!(5>a.length)){var c=/^ERROR:\s+(\d+):(\d+):\s*(.*)$/.exec(a);c?b.push(new g(c[1]|0,c[2]|0,c[3].trim())):
  0<a.length&&b.push(new g("unknown",0,a))}});return b}function y(a,b){b.forEach(function(b){var c=a[b.file];if(c){var d=c.index[b.line];if(d){d.errors.push(b);c.hasErrors=!0;return}}a.unknown.hasErrors=!0;a.unknown.lines[0].errors.push(b)})}function z(a){a._commandRef=r()}function w(b,c){var d=m();a(b+" in command "+(c||r())+("unknown"===d?"":" called from "+d))}function G(a,b,c,f){("undefined"===typeof a?"undefined":X(a))!==b&&w("invalid parameter type"+d(c)+". expected "+b+", got "+("undefined"===
  typeof a?"undefined":X(a)),f||r())}function A(a,b){return 32820===a||32819===a||33635===a?2:34042===a?4:ta[a]*b}function C(a,b){this.id=lb++;this.type=a;this.data=b}function H(a){if(0===a.length)return[];var b=a.charAt(0),c=a.charAt(a.length-1);if(1<a.length&&b===c&&('"'===b||"'"===b))return['"'+a.substr(1,a.length-2).replace(/\\/g,"\\\\").replace(/"/g,'\\"')+'"'];if(b=/\[(false|true|null|\d+|'[^']*'|"[^"]*")\]/.exec(a))return H(a.substr(0,b.index)).concat(H(b[1])).concat(H(a.substr(b.index+b[0].length)));
  b=a.split(".");if(1===b.length)return['"'+a.replace(/\\/g,"\\\\").replace(/"/g,'\\"')+'"'];a=[];for(c=0;c<b.length;++c)a=a.concat(H(b[c]));return a}function D(a){return"["+H(a).join("][")+"]"}function M(){var a={"":0},b=[""];return{id:function(c){var d=a[c];if(d)return d;d=a[c]=b.length;b.push(c);return d},str:function(a){return b[a]}}}function K(a,b,c){function d(){var b=window.innerWidth,d=window.innerHeight;a!==document.body&&(d=a.getBoundingClientRect(),b=d.right-d.left,d=d.bottom-d.top);f.width=
  c*b;f.height=c*d;Z(f.style,{width:b+"px",height:d+"px"})}var f=document.createElement("canvas");Z(f.style,{border:0,margin:0,padding:0,top:0,left:0});a.appendChild(f);a===document.body&&(f.style.position="absolute",Z(a.style,{margin:0,padding:0}));window.addEventListener("resize",d,!1);d();return{canvas:f,onDestroy:function(){window.removeEventListener("resize",d);a.removeChild(f)}}}function I(a,b){function c(c){try{return a.getContext(c,b)}catch(da){return null}}return c("webgl")||c("experimental-webgl")||
  c("webgl-experimental")}function J(a){if("string"===typeof a)return a.split();u(Array.isArray(a),"invalid extension array");return a}function Q(a){return"string"===typeof a?(u("undefined"!==typeof document,"not supported outside of DOM"),document.querySelector(a)):a}function S(a){var b=a||{},c;a={};var d=[],f=[],e="undefined"===typeof window?1:window.devicePixelRatio,g=!1,k=function(a){a&&u.raise(a)},l=function(){};if("string"===typeof b){u("undefined"!==typeof document,"selector queries only supported in DOM enviroments");
  var m=document.querySelector(b);u(m,"invalid query string for element")}else if("object"===("undefined"===typeof b?"undefined":X(b)))if("string"===typeof b.nodeName&&"function"===typeof b.appendChild&&"function"===typeof b.getBoundingClientRect)m=b;else if("function"===typeof b.drawArrays||"function"===typeof b.drawElements){var x=b;var n=x.canvas}else u.constructor(b),"gl"in b?x=b.gl:"canvas"in b?n=Q(b.canvas):"container"in b&&(c=Q(b.container)),"attributes"in b&&(a=b.attributes,u.type(a,"object",
  "invalid context attributes")),"extensions"in b&&(d=J(b.extensions)),"optionalExtensions"in b&&(f=J(b.optionalExtensions)),"onDone"in b&&(u.type(b.onDone,"function","invalid or missing onDone callback"),k=b.onDone),"profile"in b&&(g=!!b.profile),"pixelRatio"in b&&(e=+b.pixelRatio,u(0<e,"invalid pixel ratio"));else u.raise("invalid arguments to regl");m&&("canvas"===m.nodeName.toLowerCase()?n=m:c=m);if(!x){if(!n){u("undefined"!==typeof document,"must manually specify webgl context outside of DOM environments");
  m=K(c||document.body,k,e);if(!m)return null;n=m.canvas;l=m.onDestroy}x=I(n,a)}return x?{gl:x,canvas:n,container:c,extensions:d,optionalExtensions:f,pixelRatio:e,profile:g,onDone:k,onDestroy:l}:(l(),k("webgl not supported, try upgrading your browser or graphics drivers http://get.webgl.org"),null)}function T(a,b){function c(b){u.type(b,"string","extension name must be string");b=b.toLowerCase();try{var c=d[b]=a.getExtension(b)}catch(Sa){}return!!c}for(var d={},f=0;f<b.extensions.length;++f){var e=
  b.extensions[f];if(!c(e))return b.onDestroy(),b.onDone('"'+e+'" extension is not supported by the current WebGL context, try upgrading your system or a different browser'),null}b.optionalExtensions.forEach(c);return{extensions:d,restore:function(){Object.keys(d).forEach(function(a){if(d[a]&&!c(a))throw Error("(regl): error restoring extension "+a);})}}}function U(a,b){for(var c=Array(a),d=0;d<a;++d)c[d]=b(d);return c}function R(a){var b=(65535<a)<<4;a>>>=b;var c=(255<a)<<3;a>>>=c;b|=c;c=(15<a)<<2;
  a>>>=c;b|=c;c=(3<a)<<1;return b|c|a>>>c>>1}function ea(){function a(a){a:{for(var b=16;268435456>=b;b*=16)if(a<=b){a=b;break a}a=0}b=c[R(a)>>2];return 0<b.length?b.pop():new ArrayBuffer(a)}function b(a){c[R(a.byteLength)>>2].push(a)}var c=U(8,function(){return[]});return{alloc:a,free:b,allocType:function(b,c){switch(b){case 5120:b=new Int8Array(a(c),0,c);break;case 5121:b=new Uint8Array(a(c),0,c);break;case 5122:b=new Int16Array(a(2*c),0,c);break;case 5123:b=new Uint16Array(a(2*c),0,c);break;case 5124:b=
  new Int32Array(a(4*c),0,c);break;case 5125:b=new Uint32Array(a(4*c),0,c);break;case 5126:b=new Float32Array(a(4*c),0,c);break;default:return null}return b.length!==c?b.subarray(0,c):b},freeType:function(a){b(a.buffer)}}}function O(a){return!!a&&"object"===("undefined"===typeof a?"undefined":X(a))&&Array.isArray(a.shape)&&Array.isArray(a.stride)&&"number"===typeof a.offset&&a.shape.length===a.stride.length&&(Array.isArray(a.data)||oa(a.data))}function fa(a,b,c,d,f,e){for(var g=0;g<b;++g)for(var k=
  a[g],l=0;l<c;++l)for(var m=k[l],x=0;x<d;++x)f[e++]=m[x]}function N(a,b,c,d,f){for(var e=1,g=c+1;g<b.length;++g)e*=b[g];var k=b[c];if(4===b.length-c){var l=b[c+1],m=b[c+2];b=b[c+3];for(g=0;g<k;++g)fa(a[g],l,m,b,d,f),f+=e}else for(g=0;g<k;++g)N(a[g],b,c+1,d,f),f+=e}function Y(a){return Na[Object.prototype.toString.call(a)]|0}function ha(a,b){for(var c=0;c<b.length;++c)a[c]=b[c]}function na(a,b,c,d,f,e,g){for(var k=0,l=0;l<c;++l)for(var m=0;m<d;++m)a[k++]=b[f*l+e*m+g]}function pa(a,b,c,d){function f(b){this.id=
  l++;this.buffer=a.createBuffer();this.type=b;this.usage=35044;this.byteLength=0;this.dimension=1;this.dtype=5121;this.persistentData=null;c.profile&&(this.stats={size:0})}function e(b,c,d){b.byteLength=c.byteLength;a.bufferData(b.type,c,d)}function g(a,b,c,d,f,g){a.usage=c;if(Array.isArray(b)){if(a.dtype=d||5126,0<b.length)if(Array.isArray(b[0])){f=mb(b);for(var k=d=1;k<f.length;++k)d*=f[k];a.dimension=d;b=Va(b,f,a.dtype);e(a,b,c);g?a.persistentData=b:V.freeType(b)}else"number"===typeof b[0]?(a.dimension=
  f,f=V.allocType(a.dtype,b.length),ha(f,b),e(a,f,c),g?a.persistentData=f:V.freeType(f)):oa(b[0])?(a.dimension=b[0].length,a.dtype=d||Y(b[0])||5126,b=Va(b,[b.length,b[0].length],a.dtype),e(a,b,c),g?a.persistentData=b:V.freeType(b)):u.raise("invalid buffer data")}else if(oa(b))a.dtype=d||Y(b),a.dimension=f,e(a,b,c),g&&(a.persistentData=new Uint8Array(new Uint8Array(b.buffer)));else if(O(b)){f=b.shape;var l=b.stride;k=b.offset;var m=0,x=0,n=0,r=0;1===f.length?(m=f[0],x=1,n=l[0],r=0):2===f.length?(m=f[0],
  x=f[1],n=l[0],r=l[1]):u.raise("invalid shape");a.dtype=d||Y(b.data)||5126;a.dimension=x;f=V.allocType(a.dtype,m*x);na(f,b.data,m,x,n,r,k);e(a,f,c);g?a.persistentData=f:V.freeType(f)}else u.raise("invalid buffer data")}function k(c){b.bufferCount--;for(var f=0;f<d.state.length;++f){var e=d.state[f];e.buffer===c&&(a.disableVertexAttribArray(f),e.buffer=null)}f=c.buffer;u(f,"buffer must not be deleted already");a.deleteBuffer(f);c.buffer=null;delete m[c.id]}var l=0,m={};f.prototype.bind=function(){a.bindBuffer(this.type,
  this.buffer)};f.prototype.destroy=function(){k(this)};var x=[];c.profile&&(b.getTotalBufferSize=function(){var a=0;Object.keys(m).forEach(function(b){a+=m[b].stats.size});return a});return{create:function(d,e,l,x){function n(b){var d=35044,f=null,e=0,k=0,l=1;Array.isArray(b)||oa(b)||O(b)?f=b:"number"===typeof b?e=b|0:b&&(u.type(b,"object","buffer arguments must be an object, a number or an array"),"data"in b&&(u(null===f||Array.isArray(f)||oa(f)||O(f),"invalid data for buffer"),f=b.data),"usage"in
  b&&(u.parameter(b.usage,Oa,"invalid buffer usage"),d=Oa[b.usage]),"type"in b&&(u.parameter(b.type,Fa,"invalid buffer type"),k=Fa[b.type]),"dimension"in b&&(u.type(b.dimension,"number","invalid dimension"),l=b.dimension|0),"length"in b&&(u.nni(e,"buffer length must be a nonnegative integer"),e=b.length|0));p.bind();f?g(p,f,d,k,l,x):(e&&a.bufferData(p.type,e,d),p.dtype=k||5121,p.usage=d,p.dimension=l,p.byteLength=e);c.profile&&(p.stats.size=p.byteLength*cb[p.dtype]);return n}function r(b,c){u(c+b.byteLength<=
  p.byteLength,"invalid buffer subdata call, buffer is too small.  Can't write data of size "+b.byteLength+" starting from offset "+c+" to a buffer of size "+p.byteLength);a.bufferSubData(p.type,c,b)}b.bufferCount++;var p=new f(e);m[p.id]=p;l||n(d);n._reglType="buffer";n._buffer=p;n.subdata=function(a,b){b=(b||0)|0;p.bind();if(oa(a))r(a,b);else if(Array.isArray(a)){if(0<a.length)if("number"===typeof a[0]){var c=V.allocType(p.dtype,a.length);ha(c,a);r(c,b);V.freeType(c)}else if(Array.isArray(a[0])||
  oa(a[0])){var d=mb(a);a=Va(a,d,p.dtype);r(a,b);V.freeType(a)}else u.raise("invalid buffer data")}else if(O(a)){d=a.shape;var f=a.stride,e=c=0,g=0,k=0;1===d.length?(c=d[0],e=1,g=f[0],k=0):2===d.length?(c=d[0],e=d[1],g=f[0],k=f[1]):u.raise("invalid shape");d=Array.isArray(a.data)?p.dtype:Y(a.data);d=V.allocType(d,c*e);na(d,a.data,c,e,g,k,a.offset);r(d,b);V.freeType(d)}else u.raise("invalid data for buffer subdata");return n};c.profile&&(n.stats=p.stats);n.destroy=function(){k(p)};return n},createStream:function(a,
  b){var c=x.pop();c||(c=new f(a));c.bind();g(c,b,35040,0,1,!1);return c},destroyStream:function(a){x.push(a)},clear:function(){Da(m).forEach(k);x.forEach(k)},getBuffer:function(a){return a&&a._buffer instanceof f?a._buffer:null},restore:function(){Da(m).forEach(function(b){b.buffer=a.createBuffer();a.bindBuffer(b.type,b.buffer);a.bufferData(b.type,b.persistentData||b.byteLength,b.usage)})},_initBuffer:g}}function ra(a,b,c,d){function f(a){this.id=l++;k[this.id]=this;this.buffer=a;this.primType=4;this.type=
  this.vertCount=0}function e(d,f,e,g,k,l,m){d.buffer.bind();if(f){var n=m;m||oa(f)&&(!O(f)||oa(f.data))||(n=b.oes_element_index_uint?5125:5123);c._initBuffer(d.buffer,f,e,n,3)}else a.bufferData(34963,l,e),d.buffer.dtype=n||5121,d.buffer.usage=e,d.buffer.dimension=3,d.buffer.byteLength=l;n=m;if(!m){switch(d.buffer.dtype){case 5121:case 5120:n=5121;break;case 5123:case 5122:n=5123;break;case 5125:case 5124:n=5125;break;default:u.raise("unsupported type for element array")}d.buffer.dtype=n}d.type=n;u(5125!==
  n||!!b.oes_element_index_uint,"32 bit element buffers not supported, enable oes_element_index_uint first");f=k;0>f&&(f=d.buffer.byteLength,5123===n?f>>=1:5125===n&&(f>>=2));d.vertCount=f;f=g;0>g&&(f=4,g=d.buffer.dimension,1===g&&(f=0),2===g&&(f=1),3===g&&(f=4));d.primType=f}function g(a){d.elementsCount--;u(null!==a.buffer,"must not double destroy elements");delete k[a.id];a.buffer.destroy();a.buffer=null}var k={},l=0,m={uint8:5121,uint16:5123};b.oes_element_index_uint&&(m.uint32=5125);f.prototype.bind=
  function(){this.buffer.bind()};var n=[];return{create:function(a,b){function k(a){if(a)if("number"===typeof a)l(a),n.primType=4,n.vertCount=a|0,n.type=5121;else{var b=null,c=35044,d=-1,f=-1,g=0,x=0;if(Array.isArray(a)||oa(a)||O(a))b=a;else if(u.type(a,"object","invalid arguments for elements"),"data"in a&&(b=a.data,u(Array.isArray(b)||oa(b)||O(b),"invalid data for element buffer")),"usage"in a&&(u.parameter(a.usage,Oa,"invalid element buffer usage"),c=Oa[a.usage]),"primitive"in a&&(u.parameter(a.primitive,
  Bb,"invalid element buffer primitive"),d=Bb[a.primitive]),"count"in a&&(u("number"===typeof a.count&&0<=a.count,"invalid vertex count for elements"),f=a.count|0),"type"in a&&(u.parameter(a.type,m,"invalid buffer type"),x=m[a.type]),"length"in a)g=a.length|0;else if(g=f,5123===x||5122===x)g*=2;else if(5125===x||5124===x)g*=4;e(n,b,c,d,f,g,x)}else l(),n.primType=4,n.vertCount=0,n.type=5121;return k}var l=c.create(null,34963,!0),n=new f(l._buffer);d.elementsCount++;k(a);k._reglType="elements";k._elements=
  n;k.subdata=function(a,b){l.subdata(a,b);return k};k.destroy=function(){g(n)};return k},createStream:function(a){var b=n.pop();b||(b=new f(c.create(null,34963,!0,!1)._buffer));e(b,a,35040,-1,-1,0,0);return b},destroyStream:function(a){n.push(a)},getElements:function(a){return"function"===typeof a&&a._elements instanceof f?a._elements:null},clear:function(){Da(k).forEach(g)}}}function qa(a){for(var b=V.allocType(5123,a.length),c=0;c<a.length;++c)if(isNaN(a[c]))b[c]=65535;else if(Infinity===a[c])b[c]=
  31744;else if(-Infinity===a[c])b[c]=64512;else{rb[0]=a[c];var d=Hb[0],f=d>>>31<<15,e=(d<<1>>>24)-127;d=d>>13&1023;b[c]=-24>e?f:-14>e?f+(d+1024>>-14-e):15<e?f+31744:f+(e+15<<10)+d}return b}function aa(a){return Array.isArray(a)||oa(a)}function ka(a){return"[object "+a+"]"}function sa(a){return Array.isArray(a)&&(0===a.length||"number"===typeof a[0])}function va(a){return Array.isArray(a)&&0!==a.length&&aa(a[0])?!0:!1}function ja(a){return Object.prototype.toString.call(a)}function Ba(a){if(!a)return!1;
  var b=ja(a);return 0<=Jb.indexOf(b)?!0:sa(a)||va(a)||O(a)}function Ha(a,b){36193===a.type?(a.data=qa(b),V.freeType(b)):a.data=b}function wa(a,b,c,d,f,e){a="undefined"!==typeof ia[a]?ia[a]:xa[a]*Cb[b];e&&(a*=6);if(f){for(d=0;1<=c;)d+=a*c*c,c/=2;return d}return a*c*d}function Ta(a,b,c,d,f,e,g){function k(){this.format=this.internalformat=6408;this.type=5121;this.flipY=this.premultiplyAlpha=this.compressed=!1;this.unpackAlignment=1;this.colorSpace=37444;this.channels=this.height=this.width=0}function l(a,
  b){a.internalformat=b.internalformat;a.format=b.format;a.type=b.type;a.compressed=b.compressed;a.premultiplyAlpha=b.premultiplyAlpha;a.flipY=b.flipY;a.unpackAlignment=b.unpackAlignment;a.colorSpace=b.colorSpace;a.width=b.width;a.height=b.height;a.channels=b.channels}function m(a,d){if("object"===("undefined"===typeof d?"undefined":X(d))&&d){"premultiplyAlpha"in d&&(u.type(d.premultiplyAlpha,"boolean","invalid premultiplyAlpha"),a.premultiplyAlpha=d.premultiplyAlpha);"flipY"in d&&(u.type(d.flipY,"boolean",
  "invalid texture flip"),a.flipY=d.flipY);"alignment"in d&&(u.oneOf(d.alignment,[1,2,4,8],"invalid texture unpack alignment"),a.unpackAlignment=d.alignment);"colorSpace"in d&&(u.parameter(d.colorSpace,C,"invalid colorSpace"),a.colorSpace=C[d.colorSpace]);if("type"in d){var f=d.type;u(b.oes_texture_float||!("float"===f||"float32"===f),"you must enable the OES_texture_float extension in order to use floating point textures.");u(b.oes_texture_half_float||!("half float"===f||"float16"===f),"you must enable the OES_texture_half_float extension in order to use 16-bit floating point textures.");
  u(b.webgl_depth_texture||!("uint16"===f||"uint32"===f||"depth stencil"===f),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures.");u.parameter(f,D,"invalid texture type");a.type=D[f]}var e=a.width,g=a.height,k=a.channels;f=!1;"shape"in d?(u(Array.isArray(d.shape)&&2<=d.shape.length,"shape must be an array"),e=d.shape[0],g=d.shape[1],3===d.shape.length&&(k=d.shape[2],u(0<k&&4>=k,"invalid number of channels"),f=!0),u(0<=e&&e<=c.maxTextureSize,"invalid width"),u(0<=
  g&&g<=c.maxTextureSize,"invalid height")):("radius"in d&&(e=g=d.radius,u(0<=e&&e<=c.maxTextureSize,"invalid radius")),"width"in d&&(e=d.width,u(0<=e&&e<=c.maxTextureSize,"invalid width")),"height"in d&&(g=d.height,u(0<=g&&g<=c.maxTextureSize,"invalid height")),"channels"in d&&(k=d.channels,u(0<k&&4>=k,"invalid number of channels"),f=!0));a.width=e|0;a.height=g|0;a.channels=k|0;e=!1;"format"in d&&(e=d.format,u(b.webgl_depth_texture||!("depth"===e||"depth stencil"===e),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),
  u.parameter(e,La,"invalid texture format"),g=a.internalformat=La[e],a.format=Q[g],e in D&&!("type"in d)&&(a.type=D[e]),e in F&&(a.compressed=!0),e=!0);!f&&e?a.channels=xa[a.format]:f&&!e?a.channels!==Vb[a.format]&&(a.format=a.internalformat=Vb[a.channels]):e&&f&&u(a.channels===xa[a.format],"number of channels inconsistent with specified format")}}function n(b){a.pixelStorei(37440,b.flipY);a.pixelStorei(37441,b.premultiplyAlpha);a.pixelStorei(37443,b.colorSpace);a.pixelStorei(3317,b.unpackAlignment)}
  function x(){k.call(this);this.yOffset=this.xOffset=0;this.data=null;this.needsFree=!1;this.element=null;this.needsCopy=!1}function r(a,b){var d=null;Ba(b)?d=b:b&&(u.type(b,"object","invalid pixel data type"),m(a,b),"x"in b&&(a.xOffset=b.x|0),"y"in b&&(a.yOffset=b.y|0),Ba(b.data)&&(d=b.data));u(!a.compressed||d instanceof Uint8Array,"compressed texture data must be stored in a uint8array");if(b.copy)u(!d,"can not specify copy and data field for the same texture"),b=f.viewportWidth,d=f.viewportHeight,
  a.width=a.width||b-a.xOffset,a.height=a.height||d-a.yOffset,a.needsCopy=!0,u(0<=a.xOffset&&a.xOffset<b&&0<=a.yOffset&&a.yOffset<d&&0<a.width&&a.width<=b&&0<a.height&&a.height<=d,"copy texture read out of bounds");else if(!d)a.width=a.width||1,a.height=a.height||1,a.channels=a.channels||4;else if(oa(d))a.channels=a.channels||4,a.data=d,"type"in b||5121!==a.type||(a.type=Na[Object.prototype.toString.call(d)]|0);else if(sa(d)){a.channels=a.channels||4;b=d;d=b.length;switch(a.type){case 5121:case 5123:case 5125:case 5126:d=
  V.allocType(a.type,d);d.set(b);a.data=d;break;case 36193:a.data=qa(b);break;default:u.raise("unsupported texture type, must specify a typed array")}a.alignment=1;a.needsFree=!0}else if(O(d)){b=d.data;Array.isArray(b)||5121!==a.type||(a.type=Na[Object.prototype.toString.call(b)]|0);var e=d.shape,g=d.stride;if(3===e.length){var k=e[2];var l=g[2]}else u(2===e.length,"invalid ndarray pixel data, must be 2 or 3D"),l=k=1;var n=e[0];var W=e[1];e=g[0];g=g[1];a.alignment=1;a.width=n;a.height=W;a.channels=
  k;a.format=a.internalformat=Vb[k];a.needsFree=!0;n=l;d=d.offset;k=a.width;l=a.height;W=a.channels;for(var x=V.allocType(36193===a.type?5126:a.type,k*l*W),r=0,p=0;p<l;++p)for(var t=0;t<k;++t)for(var Zb=0;Zb<W;++Zb)x[r++]=b[e*t+g*p+n*Zb+d];Ha(a,x)}else if(ja(d)===ib||ja(d)===tb)ja(d)===ib?a.element=d:a.element=d.canvas,a.width=a.element.width,a.height=a.element.height,a.channels=4;else if(ja(d)===ub)a.element=d,a.width=d.width,a.height=d.height,a.channels=4;else if(ja(d)===vb)a.element=d,a.width=d.naturalWidth,
  a.height=d.naturalHeight,a.channels=4;else if(ja(d)===wb)a.element=d,a.width=d.videoWidth,a.height=d.videoHeight,a.channels=4;else if(va(d)){b=a.width||d[0].length;e=a.height||d.length;g=a.channels;g=aa(d[0][0])?g||d[0][0].length:g||1;n=Ia.shape(d);k=1;for(l=0;l<n.length;++l)k*=n[l];k=V.allocType(36193===a.type?5126:a.type,k);Ia.flatten(d,n,"",k);Ha(a,k);a.alignment=1;a.width=b;a.height=e;a.channels=g;a.format=a.internalformat=Vb[g];a.needsFree=!0}5126===a.type?u(0<=c.extensions.indexOf("oes_texture_float"),
  "oes_texture_float extension not enabled"):36193===a.type&&u(0<=c.extensions.indexOf("oes_texture_half_float"),"oes_texture_half_float extension not enabled")}function p(b,c,f,e,g){var k=b.element,l=b.data,m=b.internalformat,W=b.format,x=b.type,r=b.width,p=b.height;n(b);k?a.texSubImage2D(c,g,f,e,W,x,k):b.compressed?a.compressedTexSubImage2D(c,g,f,e,m,r,p,l):b.needsCopy?(d(),a.copyTexSubImage2D(c,g,f,e,b.xOffset,b.yOffset,r,p)):a.texSubImage2D(c,g,f,e,r,p,W,x,l)}function t(){return S.pop()||new x}
  function v(a){a.needsFree&&V.freeType(a.data);x.call(a);S.push(a)}function E(){k.call(this);this.genMipmaps=!1;this.mipmapHint=4352;this.mipmask=0;this.images=Array(16)}function w(a,b,c){var d=a.images[0]=t();a.mipmask=1;d.width=a.width=b;d.height=a.height=c;d.channels=a.channels=4}function ca(a,b){if(Ba(b)){var c=a.images[0]=t();l(c,a);r(c,b);a.mipmask=1}else if(m(a,b),Array.isArray(b.mipmap)){b=b.mipmap;for(var d=0;d<b.length;++d)c=a.images[d]=t(),l(c,a),c.width>>=d,c.height>>=d,r(c,b[d]),a.mipmask|=
  1<<d}else c=a.images[0]=t(),l(c,a),r(c,b),a.mipmask=1;l(a,a.images[0]);(a.compressed&&33776===a.internalformat||33777===a.internalformat||33778===a.internalformat||33779===a.internalformat)&&u(0===a.width%4&&0===a.height%4,"for compressed texture formats, mipmap level 0 must have width and height that are a multiple of 4")}function B(b,c){b=b.images;for(var f=0;f<b.length&&b[f];++f){var e=b[f],g=c,k=f,l=e.element,m=e.data,W=e.internalformat,x=e.format,r=e.type,p=e.width,u=e.height,t=e.channels;n(e);
  l?a.texImage2D(g,k,x,x,r,l):e.compressed?a.compressedTexImage2D(g,k,W,p,u,0,m):e.needsCopy?(d(),a.copyTexImage2D(g,k,x,e.xOffset,e.yOffset,p,u,0)):((e=!m)&&(m=V.zero.allocType(r,p*u*t)),a.texImage2D(g,k,x,p,u,0,x,r,m),e&&m&&V.zero.freeType(m))}}function Ja(){var a=P.pop()||new E;k.call(a);for(var b=a.mipmask=0;16>b;++b)a.images[b]=null;return a}function A(a){for(var b=a.images,c=0;c<b.length;++c)b[c]&&v(b[c]),b[c]=null;P.push(a)}function y(){this.magFilter=this.minFilter=9728;this.wrapT=this.wrapS=
  33071;this.anisotropic=1;this.genMipmaps=!1;this.mipmapHint=4352}function z(a,b){if("min"in b){var d=b.min;u.parameter(d,Wb);a.minFilter=Wb[d];0<=Ib.indexOf(a.minFilter)&&!("faces"in b)&&(a.genMipmaps=!0)}"mag"in b&&(d=b.mag,u.parameter(d,H),a.magFilter=H[d]);d=a.wrapS;var f=a.wrapT;if("wrap"in b){var e=b.wrap;"string"===typeof e?(u.parameter(e,ya),d=f=ya[e]):Array.isArray(e)&&(u.parameter(e[0],ya),u.parameter(e[1],ya),d=ya[e[0]],f=ya[e[1]])}else"wrapS"in b&&(d=b.wrapS,u.parameter(d,ya),d=ya[d]),
  "wrapT"in b&&(f=b.wrapT,u.parameter(f,ya),f=ya[f]);a.wrapS=d;a.wrapT=f;"anisotropic"in b&&(d=b.anisotropic,u("number"===typeof d&&1<=d&&d<=c.maxAnisotropic,"aniso samples must be between 1 and "),a.anisotropic=b.anisotropic);if("mipmap"in b){d=!1;switch(X(b.mipmap)){case "string":u.parameter(b.mipmap,L,"invalid mipmap hint");a.mipmapHint=L[b.mipmap];d=a.genMipmaps=!0;break;case "boolean":d=a.genMipmaps=b.mipmap;break;case "object":u(Array.isArray(b.mipmap),"invalid mipmap type");a.genMipmaps=!1;d=
  !0;break;default:u.raise("invalid mipmap type")}!d||"min"in b||(a.minFilter=9984)}}function da(c,d){a.texParameteri(d,10241,c.minFilter);a.texParameteri(d,10240,c.magFilter);a.texParameteri(d,10242,c.wrapS);a.texParameteri(d,10243,c.wrapT);b.ext_texture_filter_anisotropic&&a.texParameteri(d,34046,c.anisotropic);c.genMipmaps&&(a.hint(33170,c.mipmapHint),a.generateMipmap(d))}function Yb(b){k.call(this);this.mipmask=0;this.internalformat=6408;this.id=U++;this.refCount=1;this.target=b;this.texture=a.createTexture();
  this.unit=-1;this.bindCount=0;this.texInfo=new y;g.profile&&(this.stats={size:0})}function Ka(b){a.activeTexture(33984);a.bindTexture(b.target,b.texture)}function G(){var b=N[0];b?a.bindTexture(b.target,b.texture):a.bindTexture(3553,null)}function yc(b){var c=b.texture;u(c,"must not double destroy texture");var d=b.unit,f=b.target;0<=d&&(a.activeTexture(33984+d),a.bindTexture(f,null),N[d]=null);a.deleteTexture(c);b.texture=null;b.params=null;b.pixels=null;b.refCount=0;delete T[b.id];e.textureCount--}
  var L={"don't care":4352,"dont care":4352,nice:4354,fast:4353},ya={repeat:10497,clamp:33071,mirror:33648},H={nearest:9728,linear:9729},Wb=Z({mipmap:9987,"nearest mipmap nearest":9984,"linear mipmap nearest":9985,"nearest mipmap linear":9986,"linear mipmap linear":9987},H),C={none:0,browser:37444},D={uint8:5121,rgba4:32819,rgb565:33635,"rgb5 a1":32820},La={alpha:6406,luminance:6409,"luminance alpha":6410,rgb:6407,rgba:6408,rgba4:32854,"rgb5 a1":32855,rgb565:36194},F={};b.ext_srgb&&(La.srgb=35904,La.srgba=
  35906);b.oes_texture_float&&(D.float32=D.float=5126);b.oes_texture_half_float&&(D.float16=D["half float"]=36193);b.webgl_depth_texture&&(Z(La,{depth:6402,"depth stencil":34041}),Z(D,{uint16:5123,uint32:5125,"depth stencil":34042}));b.webgl_compressed_texture_s3tc&&Z(F,{"rgb s3tc dxt1":33776,"rgba s3tc dxt1":33777,"rgba s3tc dxt3":33778,"rgba s3tc dxt5":33779});b.webgl_compressed_texture_atc&&Z(F,{"rgb atc":35986,"rgba atc explicit alpha":35987,"rgba atc interpolated alpha":34798});b.webgl_compressed_texture_pvrtc&&
  Z(F,{"rgb pvrtc 4bppv1":35840,"rgb pvrtc 2bppv1":35841,"rgba pvrtc 4bppv1":35842,"rgba pvrtc 2bppv1":35843});b.webgl_compressed_texture_etc1&&(F["rgb etc1"]=36196);var I=Array.prototype.slice.call(a.getParameter(34467));Object.keys(F).forEach(function(a){var b=F[a];0<=I.indexOf(b)&&(La[a]=b)});var J=Object.keys(La);c.textureFormats=J;var M=[];Object.keys(La).forEach(function(a){M[La[a]]=a});var K=[];Object.keys(D).forEach(function(a){K[D[a]]=a});var Tb=[];Object.keys(H).forEach(function(a){Tb[H[a]]=
  a});var qb=[];Object.keys(Wb).forEach(function(a){qb[Wb[a]]=a});var la=[];Object.keys(ya).forEach(function(a){la[ya[a]]=a});var Q=J.reduce(function(a,b){var c=La[b];6409===c||6406===c||6409===c||6410===c||6402===c||34041===c?a[c]=c:32855===c||0<=b.indexOf("rgba")?a[c]=6408:a[c]=6407;return a},{}),S=[],P=[],U=0,T={},R=c.maxTextureUnits,N=Array(R).map(function(){return null});Z(Yb.prototype,{bind:function(){this.bindCount+=1;var b=this.unit;if(0>b){for(var c=0;c<R;++c){var d=N[c];if(d){if(0<d.bindCount)continue;
  d.unit=-1}N[c]=this;b=c;break}b>=R&&u.raise("insufficient number of texture units");g.profile&&e.maxTextureUnits<b+1&&(e.maxTextureUnits=b+1);this.unit=b;a.activeTexture(33984+b);a.bindTexture(this.target,this.texture)}return b},unbind:function(){--this.bindCount},decRef:function(){0>=--this.refCount&&yc(this)}});g.profile&&(e.getTotalTextureSize=function(){var a=0;Object.keys(T).forEach(function(b){a+=T[b].stats.size});return a});return{create2D:function(b,d){function f(a,b){var d=k.texInfo;y.call(d);
  var e=Ja();"number"===typeof a?"number"===typeof b?w(e,a|0,b|0):w(e,a|0,a|0):a?(u.type(a,"object","invalid arguments to regl.texture"),z(d,a),ca(e,a)):w(e,1,1);d.genMipmaps&&(e.mipmask=(e.width<<1)-1);k.mipmask=e.mipmask;l(k,e);u.texture2D(d,e,c);k.internalformat=e.internalformat;f.width=e.width;f.height=e.height;Ka(k);B(e,3553);da(d,3553);G();A(e);g.profile&&(k.stats.size=wa(k.internalformat,k.type,e.width,e.height,d.genMipmaps,!1));f.format=M[k.internalformat];f.type=K[k.type];f.mag=Tb[d.magFilter];
  f.min=qb[d.minFilter];f.wrapS=la[d.wrapS];f.wrapT=la[d.wrapT];return f}var k=new Yb(3553);T[k.id]=k;e.textureCount++;f(b,d);f.subimage=function(a,b,c,d){u(!!a,"must specify image data");b|=0;c|=0;d|=0;var e=t();l(e,k);e.width=0;e.height=0;r(e,a);e.width=e.width||(k.width>>d)-b;e.height=e.height||(k.height>>d)-c;u(k.type===e.type&&k.format===e.format&&k.internalformat===e.internalformat,"incompatible format for texture.subimage");u(0<=b&&0<=c&&b+e.width<=k.width&&c+e.height<=k.height,"texture.subimage write out of bounds");
  u(k.mipmask&1<<d,"missing mipmap data");u(e.data||e.element||e.needsCopy,"missing image data");Ka(k);p(e,3553,b,c,d);G();v(e);return f};f.resize=function(b,c){b|=0;c=c|0||b;if(b===k.width&&c===k.height)return f;f.width=k.width=b;f.height=k.height=c;Ka(k);for(var d,e=k.channels,l=k.type,m=0;k.mipmask>>m;++m){var n=b>>m,x=c>>m;if(!n||!x)break;d=V.zero.allocType(l,n*x*e);a.texImage2D(3553,m,k.format,n,x,0,k.format,k.type,d);d&&V.zero.freeType(d)}G();g.profile&&(k.stats.size=wa(k.internalformat,k.type,
  b,c,!1,!1));return f};f._reglType="texture2d";f._texture=k;g.profile&&(f.stats=k.stats);f.destroy=function(){k.decRef()};return f},createCube:function(b,d,f,k,n,x){function E(a,b,d,f,e,k){var n,x=L.texInfo;y.call(x);for(n=0;6>n;++n)W[n]=Ja();if("number"!==typeof a&&a)if("object"===("undefined"===typeof a?"undefined":X(a)))if(b)ca(W[0],a),ca(W[1],b),ca(W[2],d),ca(W[3],f),ca(W[4],e),ca(W[5],k);else if(z(x,a),m(L,a),"faces"in a)for(a=a.faces,u(Array.isArray(a)&&6===a.length,"cube faces must be a length 6 array"),
  n=0;6>n;++n)u("object"===X(a[n])&&!!a[n],"invalid input for cube map face"),l(W[n],L),ca(W[n],a[n]);else for(n=0;6>n;++n)ca(W[n],a);else u.raise("invalid arguments to cube map");else for(a=a|0||1,n=0;6>n;++n)w(W[n],a,a);l(L,W[0]);c.npotTextureCube||u(sb(L.width)&&sb(L.height),"your browser does not support non power or two texture dimensions");L.mipmask=x.genMipmaps?(W[0].width<<1)-1:W[0].mipmask;u.textureCube(L,x,W,c);L.internalformat=W[0].internalformat;E.width=W[0].width;E.height=W[0].height;Ka(L);
  for(n=0;6>n;++n)B(W[n],34069+n);da(x,34067);G();g.profile&&(L.stats.size=wa(L.internalformat,L.type,E.width,E.height,x.genMipmaps,!0));E.format=M[L.internalformat];E.type=K[L.type];E.mag=Tb[x.magFilter];E.min=qb[x.minFilter];E.wrapS=la[x.wrapS];E.wrapT=la[x.wrapT];for(n=0;6>n;++n)A(W[n]);return E}var L=new Yb(34067);T[L.id]=L;e.cubeCount++;var W=Array(6);E(b,d,f,k,n,x);E.subimage=function(a,b,c,d,f){u(!!b,"must specify image data");u("number"===typeof a&&a===(a|0)&&0<=a&&6>a,"invalid face");c|=0;
  d|=0;f|=0;var e=t();l(e,L);e.width=0;e.height=0;r(e,b);e.width=e.width||(L.width>>f)-c;e.height=e.height||(L.height>>f)-d;u(L.type===e.type&&L.format===e.format&&L.internalformat===e.internalformat,"incompatible format for texture.subimage");u(0<=c&&0<=d&&c+e.width<=L.width&&d+e.height<=L.height,"texture.subimage write out of bounds");u(L.mipmask&1<<f,"missing mipmap data");u(e.data||e.element||e.needsCopy,"missing image data");Ka(L);p(e,34069+a,c,d,f);G();v(e);return E};E.resize=function(b){b|=0;
  if(b!==L.width){E.width=L.width=b;E.height=L.height=b;Ka(L);for(var c=0;6>c;++c)for(var d=0;L.mipmask>>d;++d)a.texImage2D(34069+c,d,L.format,b>>d,b>>d,0,L.format,L.type,null);G();g.profile&&(L.stats.size=wa(L.internalformat,L.type,E.width,E.height,!1,!0));return E}};E._reglType="textureCube";E._texture=L;g.profile&&(E.stats=L.stats);E.destroy=function(){L.decRef()};return E},clear:function(){for(var b=0;b<R;++b)a.activeTexture(33984+b),a.bindTexture(3553,null),N[b]=null;Da(T).forEach(yc);e.cubeCount=
  0;e.textureCount=0},getTexture:function(a){return null},restore:function(){for(var b=0;b<R;++b){var c=N[b];c&&(c.bindCount=0,c.unit=-1,N[b]=null)}Da(T).forEach(function(b){b.texture=a.createTexture();a.bindTexture(b.target,b.texture);for(var c=0;32>c;++c)if(0!==(b.mipmask&1<<c))if(3553===b.target)a.texImage2D(3553,c,b.internalformat,b.width>>c,b.height>>c,0,b.internalformat,b.type,null);else for(var d=0;6>d;++d)a.texImage2D(34069+d,c,b.internalformat,b.width>>c,b.height>>c,0,b.internalformat,b.type,
  null);da(b.texInfo,b.target)})}}}function Ua(a,b,c,d,f,e){function g(a,b,c){this.target=a;this.texture=b;this.renderbuffer=c;var d=a=0;b?(a=b.width,d=b.height):c&&(a=c.width,d=c.height);this.width=a;this.height=d}function k(a){a&&(a.texture&&a.texture._texture.decRef(),a.renderbuffer&&a.renderbuffer._renderbuffer.decRef())}function l(a,b,c){if(a)if(a.texture){a=a.texture._texture;var d=Math.max(1,a.height);u(Math.max(1,a.width)===b&&d===c,"inconsistent width/height for supplied texture");a.refCount+=
  1}else a=a.renderbuffer._renderbuffer,u(a.width===b&&a.height===c,"inconsistent width/height for renderbuffer"),a.refCount+=1}function m(b,c){c&&(c.texture?a.framebufferTexture2D(36160,b,c.target,c.texture._texture.texture,0):a.framebufferRenderbuffer(36160,b,36161,c.renderbuffer._renderbuffer.renderbuffer))}function n(a){var b=3553,c=null,d=null,f=a;"object"===("undefined"===typeof a?"undefined":X(a))&&(f=a.data,"target"in a&&(b=a.target|0));u.type(f,"function","invalid attachment data");a=f._reglType;
  "texture2d"===a?(c=f,u(3553===b)):"textureCube"===a?(c=f,u(34069<=b&&34075>b,"invalid cube map target")):"renderbuffer"===a?(d=f,b=36161):u.raise("invalid regl object for attachment");return new g(b,c,d)}function x(a,b,c,e,k){if(c)return a=d.create2D({width:a,height:b,format:e,type:k}),a._texture.refCount=0,new g(3553,a,null);a=f.create({width:a,height:b,format:e});a._renderbuffer.refCount=0;return new g(36161,null,a)}function r(a){return a&&(a.texture||a.renderbuffer)}function p(a,b,c){a&&(a.texture?
  a.texture.resize(b,c):a.renderbuffer&&a.renderbuffer.resize(b,c),a.width=b,a.height=c)}function t(){this.id=z++;da[this.id]=this;this.framebuffer=a.createFramebuffer();this.height=this.width=0;this.colorAttachments=[];this.depthStencilAttachment=this.stencilAttachment=this.depthAttachment=null}function v(a){a.colorAttachments.forEach(k);k(a.depthAttachment);k(a.stencilAttachment);k(a.depthStencilAttachment)}function E(b){var c=b.framebuffer;u(c,"must not double destroy framebuffer");a.deleteFramebuffer(c);
  b.framebuffer=null;e.framebufferCount--;delete da[b.id]}function w(b){var d;a.bindFramebuffer(36160,b.framebuffer);var f=b.colorAttachments;for(d=0;d<f.length;++d)m(36064+d,f[d]);for(d=f.length;d<c.maxColorAttachments;++d)a.framebufferTexture2D(36160,36064+d,3553,null,0);a.framebufferTexture2D(36160,33306,3553,null,0);a.framebufferTexture2D(36160,36096,3553,null,0);a.framebufferTexture2D(36160,36128,3553,null,0);m(36096,b.depthAttachment);m(36128,b.stencilAttachment);m(33306,b.depthStencilAttachment);
  b=a.checkFramebufferStatus(36160);a.isContextLost()||36053===b||u.raise("framebuffer configuration not supported, status = "+Nb[b]);a.bindFramebuffer(36160,B.next?B.next.framebuffer:null);B.cur=B.next;a.getError()}function ca(a,d){function f(a,d){u(B.next!==g,"can not update framebuffer which is currently in use");var e=0,k=0,m=!0,p=!0;var t=null;var E=!0,ca="rgba",ma="uint8",Ra=1,Rb=null,L=null,Ab=null,pb=!1;if("number"===typeof a)e=a|0,k=d|0||e;else if(a){u.type(a,"object","invalid arguments for framebuffer");
  "shape"in a?(k=a.shape,u(Array.isArray(k)&&2<=k.length,"invalid shape for framebuffer"),e=k[0],k=k[1]):("radius"in a&&(e=k=a.radius),"width"in a&&(e=a.width),"height"in a&&(k=a.height));if("color"in a||"colors"in a)t=a.color||a.colors,Array.isArray(t)&&u(1===t.length||b.webgl_draw_buffers,"multiple render targets not supported");if(!t){"colorCount"in a&&(Ra=a.colorCount|0,u(0<Ra,"invalid color buffer count"));"colorTexture"in a&&(E=!!a.colorTexture,ca="rgba4");if("colorType"in a){ma=a.colorType;if(E)u(b.oes_texture_float||
  !("float"===ma||"float32"===ma),"you must enable OES_texture_float in order to use floating point framebuffer objects"),u(b.oes_texture_half_float||!("half float"===ma||"float16"===ma),"you must enable OES_texture_half_float in order to use 16-bit floating point framebuffer objects");else if("half float"===ma||"float16"===ma)u(b.ext_color_buffer_half_float,"you must enable EXT_color_buffer_half_float to use 16-bit render buffers"),ca="rgba16f";else if("float"===ma||"float32"===ma)u(b.webgl_color_buffer_float,
  "you must enable WEBGL_color_buffer_float in order to use 32-bit floating point renderbuffers"),ca="rgba32f";u.oneOf(ma,Ja,"invalid color type")}if("colorFormat"in a)if(ca=a.colorFormat,0<=y.indexOf(ca))E=!0;else if(0<=A.indexOf(ca))E=!1;else if(E)u.oneOf(a.colorFormat,y,"invalid color format for texture");else u.oneOf(a.colorFormat,A,"invalid color format for renderbuffer")}if("depthTexture"in a||"depthStencilTexture"in a)pb=!(!a.depthTexture&&!a.depthStencilTexture),u(!pb||b.webgl_depth_texture,
  "webgl_depth_texture extension not supported");"depth"in a&&("boolean"===typeof a.depth?m=a.depth:(Rb=a.depth,p=!1));"stencil"in a&&("boolean"===typeof a.stencil?p=a.stencil:(L=a.stencil,m=!1));"depthStencil"in a&&("boolean"===typeof a.depthStencil?m=p=a.depthStencil:(Ab=a.depthStencil,p=m=!1))}else e=k=1;var da=d=a=null;if(Array.isArray(t))var z=t.map(n);else if(t)z=[n(t)];else for(z=Array(Ra),t=0;t<Ra;++t)z[t]=x(e,k,E,ca,ma);u(b.webgl_draw_buffers||1>=z.length,"you must enable the WEBGL_draw_buffers extension in order to use multiple color buffers.");
  u(z.length<=c.maxColorAttachments,"too many color attachments, not supported");e=e||z[0].width;k=k||z[0].height;Rb?a=n(Rb):m&&!p&&(a=x(e,k,pb,"depth","uint32"));L?d=n(L):p&&!m&&(d=x(e,k,!1,"stencil","uint8"));Ab?da=n(Ab):!Rb&&!L&&p&&m&&(da=x(e,k,pb,"depth stencil","depth stencil"));u(1>=!!Rb+!!L+!!Ab,"invalid framebuffer configuration, can specify exactly one depth/stencil attachment");m=null;for(t=0;t<z.length;++t)l(z[t],e,k),u(!z[t]||z[t].texture&&0<=Lb.indexOf(z[t].texture._texture.format)||z[t].renderbuffer&&
  0<=Mb.indexOf(z[t].renderbuffer._renderbuffer.format),"framebuffer color attachment "+t+" is invalid"),z[t]&&z[t].texture&&(p=kb[z[t].texture._texture.format]*Xb[z[t].texture._texture.type],null===m?m=p:u(m===p,"all color attachments much have the same number of bits per pixel."));l(a,e,k);u(!a||a.texture&&6402===a.texture._texture.format||a.renderbuffer&&33189===a.renderbuffer._renderbuffer.format,"invalid depth attachment for framebuffer object");l(d,e,k);u(!d||d.renderbuffer&&36168===d.renderbuffer._renderbuffer.format,
  "invalid stencil attachment for framebuffer object");l(da,e,k);u(!da||da.texture&&34041===da.texture._texture.format||da.renderbuffer&&34041===da.renderbuffer._renderbuffer.format,"invalid depth-stencil attachment for framebuffer object");v(g);g.width=e;g.height=k;g.colorAttachments=z;g.depthAttachment=a;g.stencilAttachment=d;g.depthStencilAttachment=da;f.color=z.map(r);f.depth=r(a);f.stencil=r(d);f.depthStencil=r(da);f.width=g.width;f.height=g.height;w(g);return f}var g=new t;e.framebufferCount++;
  f(a,d);return Z(f,{resize:function(a,b){u(B.next!==g,"can not resize a framebuffer which is currently in use");a=Math.max(a|0,1);b=Math.max(b|0||a,1);if(a===g.width&&b===g.height)return f;for(var c=g.colorAttachments,d=0;d<c.length;++d)p(c[d],a,b);p(g.depthAttachment,a,b);p(g.stencilAttachment,a,b);p(g.depthStencilAttachment,a,b);g.width=f.width=a;g.height=f.height=b;w(g);return f},_reglType:"framebuffer",_framebuffer:g,destroy:function(){E(g);v(g)},use:function(a){B.setFBO({framebuffer:f},a)}})}
  var B={cur:null,next:null,dirty:!1,setFBO:null},y=["rgba"],A=["rgba4","rgb565","rgb5 a1"];b.ext_srgb&&A.push("srgba");b.ext_color_buffer_half_float&&A.push("rgba16f","rgb16f");b.webgl_color_buffer_float&&A.push("rgba32f");var Ja=["uint8"];b.oes_texture_half_float&&Ja.push("half float","float16");b.oes_texture_float&&Ja.push("float","float32");var z=0,da={};return Z(B,{getFramebuffer:function(a){return"function"===typeof a&&"framebuffer"===a._reglType&&(a=a._framebuffer,a instanceof t)?a:null},create:ca,
  createCube:function(a){function f(a){u(0>e.indexOf(B.next),"can not update framebuffer which is currently in use");var c={color:null},g=0,k=null;var l="rgba";var m="uint8",n=1;if("number"===typeof a)g=a|0;else if(a){u.type(a,"object","invalid arguments for framebuffer");"shape"in a?(g=a.shape,u(Array.isArray(g)&&2<=g.length,"invalid shape for framebuffer"),u(g[0]===g[1],"cube framebuffer must be square"),g=g[0]):("radius"in a&&(g=a.radius|0),"width"in a?(g=a.width|0,"height"in a&&u(a.height===g,"must be square")):
  "height"in a&&(g=a.height|0));if("color"in a||"colors"in a)k=a.color||a.colors,Array.isArray(k)&&u(1===k.length||b.webgl_draw_buffers,"multiple render targets not supported");k||("colorCount"in a&&(n=a.colorCount|0,u(0<n,"invalid color buffer count")),"colorType"in a&&(u.oneOf(a.colorType,Ja,"invalid color type"),m=a.colorType),"colorFormat"in a&&(l=a.colorFormat,u.oneOf(a.colorFormat,y,"invalid color format for texture")));"depth"in a&&(c.depth=a.depth);"stencil"in a&&(c.stencil=a.stencil);"depthStencil"in
  a&&(c.depthStencil=a.depthStencil)}else g=1;if(k)if(Array.isArray(k))for(a=[],l=0;l<k.length;++l)a[l]=k[l];else a=[k];else for(a=Array(n),k={radius:g,format:l,type:m},l=0;l<n;++l)a[l]=d.createCube(k);c.color=Array(a.length);for(l=0;l<a.length;++l)n=a[l],u("function"===typeof n&&"textureCube"===n._reglType,"invalid cube map"),g=g||n.width,u(n.width===g&&n.height===g,"invalid cube map shape"),c.color[l]={target:34069,data:a[l]};for(l=0;6>l;++l){for(n=0;n<a.length;++n)c.color[n].target=34069+l;0<l&&
  (c.depth=e[0].depth,c.stencil=e[0].stencil,c.depthStencil=e[0].depthStencil);if(e[l])e[l](c);else e[l]=ca(c)}return Z(f,{width:g,height:g,color:a})}var e=Array(6);f(a);return Z(f,{faces:e,resize:function(a){var b=a|0;u(0<b&&b<=c.maxCubeMapSize,"invalid radius for cube fbo");if(b===f.width)return f;var d=f.color;for(a=0;a<d.length;++a)d[a].resize(b);for(a=0;6>a;++a)e[a].resize(b);f.width=f.height=b;return f},_reglType:"framebufferCube",destroy:function(){e.forEach(function(a){a.destroy()})}})},clear:function(){Da(da).forEach(E)},
  restore:function(){B.cur=null;B.next=null;B.dirty=!0;Da(da).forEach(function(b){b.framebuffer=a.createFramebuffer();w(b)})}})}function Pa(){this.w=this.z=this.y=this.x=this.state=0;this.buffer=null;this.size=0;this.normalized=!1;this.type=5126;this.divisor=this.stride=this.offset=0}function Za(a,b,c,d){a=c.maxAttributes;b=Array(a);for(c=0;c<a;++c)b[c]=new Pa;return{Record:Pa,scope:{},state:b}}function $a(a,b,c,d){function f(a,b,c,d){this.name=a;this.id=b;this.location=c;this.info=d}function e(a,b){for(var c=
  0;c<a.length;++c)if(a[c].id===b.id){a[c].location=b.location;return}a.push(b)}function g(c,d,f){var e=35632===c?m:n,g=e[d];if(!g){var k=b.str(d);g=a.createShader(c);a.shaderSource(g,k);a.compileShader(g);u.shaderError(a,g,k,c,f);e[d]=g}return g}function k(a,b){this.id=x++;this.fragId=a;this.vertId=b;this.program=null;this.uniforms=[];this.attributes=[];d.profile&&(this.stats={uniformsCount:0,attributesCount:0})}function l(c,k){var l=g(35632,c.fragId);var m=g(35633,c.vertId),n=c.program=a.createProgram();
  a.attachShader(n,l);a.attachShader(n,m);a.linkProgram(n);u.linkError(a,n,b.str(c.fragId),b.str(c.vertId),k);m=a.getProgramParameter(n,35718);d.profile&&(c.stats.uniformsCount=m);var p=c.uniforms;for(k=0;k<m;++k)if(l=a.getActiveUniform(n,k))if(1<l.size)for(var r=0;r<l.size;++r){var x=l.name.replace("[0]","["+r+"]");e(p,new f(x,b.id(x),a.getUniformLocation(n,x),l))}else e(p,new f(l.name,b.id(l.name),a.getUniformLocation(n,l.name),l));m=a.getProgramParameter(n,35721);d.profile&&(c.stats.attributesCount=
  m);c=c.attributes;for(k=0;k<m;++k)(l=a.getActiveAttrib(n,k))&&e(c,new f(l.name,b.id(l.name),a.getAttribLocation(n,l.name),l))}var m={},n={},p={},r=[],x=0;d.profile&&(c.getMaxUniformsCount=function(){var a=0;r.forEach(function(b){b.stats.uniformsCount>a&&(a=b.stats.uniformsCount)});return a},c.getMaxAttributesCount=function(){var a=0;r.forEach(function(b){b.stats.attributesCount>a&&(a=b.stats.attributesCount)});return a});return{clear:function(){var b=a.deleteShader.bind(a);Da(m).forEach(b);m={};Da(n).forEach(b);
  n={};r.forEach(function(b){a.deleteProgram(b.program)});r.length=0;p={};c.shaderCount=0},program:function(a,b,d){u.command(0<=a,"missing vertex shader",d);u.command(0<=b,"missing fragment shader",d);var f=p[b];f||(f=p[b]={});var e=f[a];e||(e=new k(b,a),c.shaderCount++,l(e,d),f[a]=e,r.push(e));return e},restore:function(){m={};n={};for(var a=0;a<r.length;++a)l(r[a])},shader:g,frag:-1,vert:-1}}function gb(a,b,c,d,f,e,g){function k(k){if(null===b.next){u(f.preserveDrawingBuffer,'you must create a webgl context with "preserveDrawingBuffer":true in order to read pixels from the drawing buffer');
  var l=5121}else u(null!==b.next.colorAttachments[0].texture,"You cannot read from a renderbuffer"),l=b.next.colorAttachments[0].texture._texture.type,e.oes_texture_float?(u(5121===l||5126===l,"Reading from a framebuffer is only allowed for the types 'uint8' and 'float'"),5126===l&&u(g.readFloat,"Reading 'float' values is not permitted in your browser. For a fallback, please see: https://www.npmjs.com/package/glsl-read-float")):u(5121===l,"Reading from a framebuffer is only allowed for the type 'uint8'");
  var m=0,n=0,p=d.framebufferWidth,r=d.framebufferHeight,x=null;oa(k)?x=k:k&&(u.type(k,"object","invalid arguments to regl.read()"),m=k.x|0,n=k.y|0,u(0<=m&&m<d.framebufferWidth,"invalid x offset for regl.read"),u(0<=n&&n<d.framebufferHeight,"invalid y offset for regl.read"),p=(k.width||d.framebufferWidth-m)|0,r=(k.height||d.framebufferHeight-n)|0,x=k.data||null);x&&(5121===l?u(x instanceof Uint8Array,"buffer must be 'Uint8Array' when reading from a framebuffer of type 'uint8'"):5126===l&&u(x instanceof
  Float32Array,"buffer must be 'Float32Array' when reading from a framebuffer of type 'float'"));u(0<p&&p+m<=d.framebufferWidth,"invalid width for read pixels");u(0<r&&r+n<=d.framebufferHeight,"invalid height for read pixels");c();k=p*r*4;x||(5121===l?x=new Uint8Array(k):5126===l&&(x=x||new Float32Array(k)));u.isTypedArray(x,"data buffer for regl.read() must be a typedarray");u(x.byteLength>=k,"data buffer for regl.read() too small");a.pixelStorei(3333,4);a.readPixels(m,n,p,r,6408,l,x);return x}function l(a){var c;
  b.setFBO({framebuffer:a.framebuffer},function(){c=k(a)});return c}return function(a){return a&&"framebuffer"in a?l(a):k(a)}}function Db(a){return Array.prototype.slice.call(a)}function Eb(a){return Db(a).join("")}function hb(){function a(){var a=[],b=[];return Z(function(){a.push.apply(a,Db(arguments))},{def:function(){var d="v"+c++;b.push(d);0<arguments.length&&(a.push(d,"="),a.push.apply(a,Db(arguments)),a.push(";"));return d},toString:function(){return Eb([0<b.length?"var "+b+";":"",Eb(a)])}})}
  function b(){function b(a,b){d(a,b,"=",c.def(a,b),";")}var c=a(),d=a(),f=c.toString,e=d.toString;return Z(function(){c.apply(c,Db(arguments))},{def:c.def,entry:c,exit:d,save:b,set:function(a,d,f){b(a,d);c(a,d,"=",f,";")},toString:function(){return f()+e()}})}var c=0,d=[],f=[],e=a(),g={};return{global:e,link:function(a){for(var b=0;b<f.length;++b)if(f[b]===a)return d[b];b="g"+c++;d.push(b);f.push(a);return b},block:a,proc:function(a,c){function d(){var a="a"+f.length;f.push(a);return a}var f=[];c=
  c||0;for(var e=0;e<c;++e)d();c=b();var k=c.toString;return g[a]=Z(c,{arg:d,toString:function(){return Eb(["function(",f.join(),"){",k(),"}"])}})},scope:b,cond:function(){var a=Eb(arguments),c=b(),d=b(),f=c.toString,e=d.toString;return Z(c,{then:function(){c.apply(c,Db(arguments));return this},else:function(){d.apply(d,Db(arguments));return this},toString:function(){var b=e();b&&(b="else{"+b+"}");return Eb(["if(",a,"){",f(),"}",b])}})},compile:function(){var a=['"use strict";',e,"return {"];Object.keys(g).forEach(function(b){a.push('"',
  b,'":',g[b].toString(),",")});a.push("}");var b=Eb(a).replace(/;/g,";\n").replace(/}/g,"}\n").replace(/{/g,"{\n");return Function.apply(null,d.concat(b)).apply(null,f)}}}function Ga(a){return Array.isArray(a)||oa(a)||O(a)}function Wa(a){return a.sort(function(a,b){return"viewport"===a?-1:"viewport"===b?1:a<b?-1:1})}function za(a,b,c,d){this.thisDep=a;this.contextDep=b;this.propDep=c;this.append=d}function eb(a){return a&&!(a.thisDep||a.contextDep||a.propDep)}function ba(a){return new za(!1,!1,!1,
  a)}function ua(a,b){var c=a.type;return 0===c?(a=a.data.length,new za(!0,1<=a,2<=a,b)):4===c?(a=a.data,new za(a.thisDep,a.contextDep,a.propDep,b)):new za(3===c,2===c,1===c,b)}function jb(a,b,c,d,f,e,g,k,l,m,n,p,r,t,v){function x(a){return a.replace(".","_")}function w(a,b,c){var d=x(a);V.push(a);Sb[d]=O[d]=!!c;db[d]=b}function E(a,b,c){var d=x(a);V.push(a);Array.isArray(c)?(O[d]=c.slice(),Sb[d]=c.slice()):O[d]=Sb[d]=c;Sa[d]=b}function B(){var a=hb(),c=a.link,d=a.global;a.id=Y++;a.batchId="0";var f=
  c(Z),e=a.shared={props:"a0"};Object.keys(Z).forEach(function(a){e[a]=d.def(f,".",a)});u.optional(function(){a.CHECK=c(u);a.commandStr=u.guessCommand();a.command=c(a.commandStr);a.assert=function(a,b,d){a("if(!(",b,"))",this.CHECK,".commandRaise(",c(d),",",this.command,");")};Ca.invalidBlendCombinations=xb});var g=a.next={},k=a.current={};Object.keys(Sa).forEach(function(a){Array.isArray(O[a])&&(g[a]=d.def(e.next,".",a),k[a]=d.def(e.current,".",a))});var l=a.constants={};Object.keys(Ca).forEach(function(a){l[a]=
  d.def(JSON.stringify(Ca[a]))});a.invoke=function(b,d){switch(d.type){case 0:var f=["this",e.context,e.props,a.batchId];return b.def(c(d.data),".call(",f.slice(0,Math.max(d.data.length+1,4)),")");case 1:return b.def(e.props,d.data);case 2:return b.def(e.context,d.data);case 3:return b.def("this",d.data);case 4:return d.data.append(a,b),d.data.ref}};a.attribCache={};var n={};a.scopeAttrib=function(a){a=b.id(a);if(a in n)return n[a];var d=m.scope[a];d||(d=m.scope[a]=new Qb);return n[a]=c(d)};return a}
  function z(a){var b=a.static;a=a.dynamic;if("profile"in b){var c=!!b.profile;var d=ba(function(a,b){return c});d.enable=c}else if("profile"in a){var f=a.profile;d=ua(f,function(a,b){return a.invoke(b,f)})}return d}function A(a,b){b=a.static;a=a.dynamic;if("framebuffer"in b){var c=b.framebuffer;return c?(c=k.getFramebuffer(c),u.command(c,"invalid framebuffer object"),ba(function(a,b){var d=a.link(c);a=a.shared;b.set(a.framebuffer,".next",d);a=a.context;b.set(a,".framebufferWidth",d+".width");b.set(a,
  ".framebufferHeight",d+".height");return d})):ba(function(a,b){a=a.shared;b.set(a.framebuffer,".next","null");a=a.context;b.set(a,".framebufferWidth",a+".drawingBufferWidth");b.set(a,".framebufferHeight",a+".drawingBufferHeight");return"null"})}if("framebuffer"in a){var d=a.framebuffer;return ua(d,function(a,b){var c=a.invoke(b,d),f=a.shared,e=f.framebuffer,g=b.def(e,".getFramebuffer(",c,")");u.optional(function(){a.assert(b,"!"+c+"||"+g,"invalid framebuffer object")});b.set(e,".next",g);f=f.context;
  b.set(f,".framebufferWidth",g+"?"+g+".width:"+f+".drawingBufferWidth");b.set(f,".framebufferHeight",g+"?"+g+".height:"+f+".drawingBufferHeight");return g})}return null}function y(a,b,c){function d(a){if(a in f){var d=f[a];u.commandType(d,"object","invalid "+a,c.commandStr);var g=!0,k=d.x|0,l=d.y|0;if("width"in d){var m=d.width|0;u.command(0<=m,"invalid "+a,c.commandStr)}else g=!1;if("height"in d){var n=d.height|0;u.command(0<=n,"invalid "+a,c.commandStr)}else g=!1;return new za(!g&&b&&b.thisDep,!g&&
  b&&b.contextDep,!g&&b&&b.propDep,function(a,b){a=a.shared.context;var c=m;"width"in d||(c=b.def(a,".","framebufferWidth","-",k));var f=n;"height"in d||(f=b.def(a,".","framebufferHeight","-",l));return[k,l,c,f]})}if(a in e){var p=e[a];g=ua(p,function(b,c){var d=b.invoke(c,p);u.optional(function(){b.assert(c,d+"&&typeof "+d+'==="object"',"invalid "+a)});var f=b.shared.context,e=c.def(d,".x|0"),g=c.def(d,".y|0"),k=c.def('"width" in ',d,"?",d,".width|0:","(",f,".","framebufferWidth","-",e,")"),l=c.def('"height" in ',
  d,"?",d,".height|0:","(",f,".","framebufferHeight","-",g,")");u.optional(function(){b.assert(c,k+">=0&&"+l+">=0","invalid "+a)});return[e,g,k,l]});b&&(g.thisDep=g.thisDep||b.thisDep,g.contextDep=g.contextDep||b.contextDep,g.propDep=g.propDep||b.propDep);return g}return b?new za(b.thisDep,b.contextDep,b.propDep,function(a,b){a=a.shared.context;return[0,0,b.def(a,".","framebufferWidth"),b.def(a,".","framebufferHeight")]}):null}var f=a.static,e=a.dynamic;if(a=d("viewport")){var g=a;a=new za(a.thisDep,
  a.contextDep,a.propDep,function(a,b){var c=g.append(a,b);a=a.shared.context;b.set(a,".viewportWidth",c[2]);b.set(a,".viewportHeight",c[3]);return c})}return{viewport:a,scissor_box:d("scissor.box")}}function ca(a){function c(a){if(a in d){var c=b.id(d[a]);u.optional(function(){n.shader(yb[a],c,u.guessCommand())});var e=ba(function(){return c});e.id=c;return e}if(a in f){var g=f[a];return ua(g,function(b,c){var d=b.invoke(c,g),f=c.def(b.shared.strings,".id(",d,")");u.optional(function(){c(b.shared.shader,
  ".shader(",yb[a],",",f,",",b.command,");")});return f})}return null}var d=a.static,f=a.dynamic,e=c("frag"),g=c("vert"),k=null;eb(e)&&eb(g)?(k=n.program(g.id,e.id),a=ba(function(a,b){return a.link(k)})):a=new za(e&&e.thisDep||g&&g.thisDep,e&&e.contextDep||g&&g.contextDep,e&&e.propDep||g&&g.propDep,function(a,b){var c=a.shared.shader;var d=e?e.append(a,b):b.def(c,".","frag");var f=g?g.append(a,b):b.def(c,".","vert");var k=c+".program("+f+","+d;u.optional(function(){k+=","+a.command});return b.def(k+
  ")")});return{frag:e,vert:g,progVar:a,program:k}}function G(a,b){function c(a,c){if(a in d){var e=d[a]|0;u.command(!c||0<=e,"invalid "+a,b.commandStr);return ba(function(a,b){c&&(a.OFFSET=e);return e})}if(a in f){var k=f[a];return ua(k,function(b,d){var f=b.invoke(d,k);c&&(b.OFFSET=f,u.optional(function(){b.assert(d,f+">=0","invalid "+a)}));return f})}return c&&g?ba(function(a,b){a.OFFSET="0";return 0}):null}var d=a.static,f=a.dynamic,g=function(){if("elements"in d){var a=d.elements;Ga(a)?a=e.getElements(e.create(a,
  !0)):a&&(a=e.getElements(a),u.command(a,"invalid elements",b.commandStr));var c=ba(function(b,c){return a?(c=b.link(a),b.ELEMENTS=c):b.ELEMENTS=null});c.value=a;return c}if("elements"in f){var g=f.elements;return ua(g,function(a,b){var c=a.shared,d=c.isBufferArgs;c=c.elements;var f=a.invoke(b,g),e=b.def("null");d=b.def(d,"(",f,")");var k=a.cond(d).then(e,"=",c,".createStream(",f,");").else(e,"=",c,".getElements(",f,");");u.optional(function(){a.assert(k.else,"!"+f+"||"+e,"invalid elements")});b.entry(k);
  b.exit(a.cond(d).then(c,".destroyStream(",e,");"));return a.ELEMENTS=e})}return null}(),k=c("offset",!0);return{elements:g,primitive:function(){if("primitive"in d){var a=d.primitive;u.commandParameter(a,Bb,"invalid primitve",b.commandStr);return ba(function(b,c){return Bb[a]})}if("primitive"in f){var c=f.primitive;return ua(c,function(a,b){var d=a.constants.primTypes,f=a.invoke(b,c);u.optional(function(){a.assert(b,f+" in "+d,"invalid primitive, must be one of "+Object.keys(Bb))});return b.def(d,
  "[",f,"]")})}return g?eb(g)?g.value?ba(function(a,b){return b.def(a.ELEMENTS,".primType")}):ba(function(){return 4}):new za(g.thisDep,g.contextDep,g.propDep,function(a,b){a=a.ELEMENTS;return b.def(a,"?",a,".primType:",4)}):null}(),count:function(){if("count"in d){var a=d.count|0;u.command("number"===typeof a&&0<=a,"invalid vertex count",b.commandStr);return ba(function(){return a})}if("count"in f){var c=f.count;return ua(c,function(a,b){var d=a.invoke(b,c);u.optional(function(){a.assert(b,"typeof "+
  d+'==="number"&&'+d+">=0&&"+d+"===("+d+"|0)","invalid vertex count")});return d})}if(g){if(eb(g)){if(g)return k?new za(k.thisDep,k.contextDep,k.propDep,function(a,b){var c=b.def(a.ELEMENTS,".vertCount-",a.OFFSET);u.optional(function(){a.assert(b,c+">=0","invalid vertex offset/element buffer too small")});return c}):ba(function(a,b){return b.def(a.ELEMENTS,".vertCount")});var e=ba(function(){return-1});u.optional(function(){e.MISSING=!0});return e}var l=new za(g.thisDep||k.thisDep,g.contextDep||k.contextDep,
  g.propDep||k.propDep,function(a,b){var c=a.ELEMENTS;return a.OFFSET?b.def(c,"?",c,".vertCount-",a.OFFSET,":-1"):b.def(c,"?",c,".vertCount:-1")});u.optional(function(){l.DYNAMIC=!0});return l}return null}(),instances:c("instances",!1),offset:k}}function D(a,b){var c=a.static,f=a.dynamic,e={};V.forEach(function(a){function g(b,d){if(a in c){var g=b(c[a]);e[k]=ba(function(){return g})}else if(a in f){var l=f[a];e[k]=ua(l,function(a,b){return d(a,b,a.invoke(b,l))})}}var k=x(a);switch(a){case "cull.enable":case "blend.enable":case "dither":case "stencil.enable":case "depth.enable":case "scissor.enable":case "polygonOffset.enable":case "sample.alpha":case "sample.enable":case "depth.mask":return g(function(c){u.commandType(c,
  "boolean",a,b.commandStr);return c},function(b,c,d){u.optional(function(){b.assert(c,"typeof "+d+'==="boolean"',"invalid flag "+a,b.commandStr)});return d});case "depth.func":return g(function(c){u.commandParameter(c,Fb,"invalid "+a,b.commandStr);return Fb[c]},function(b,c,d){var f=b.constants.compareFuncs;u.optional(function(){b.assert(c,d+" in "+f,"invalid "+a+", must be one of "+Object.keys(Fb))});return c.def(f,"[",d,"]")});case "depth.range":return g(function(a){u.command(aa(a)&&2===a.length&&
  "number"===typeof a[0]&&"number"===typeof a[1]&&a[0]<=a[1],"depth range is 2d array",b.commandStr);return a},function(a,b,c){u.optional(function(){a.assert(b,a.shared.isArrayLike+"("+c+")&&"+c+".length===2&&typeof "+c+'[0]==="number"&&typeof '+c+'[1]==="number"&&'+c+"[0]<="+c+"[1]","depth range must be a 2d array")});var d=b.def("+",c,"[0]"),f=b.def("+",c,"[1]");return[d,f]});case "blend.func":return g(function(a){u.commandType(a,"object","blend.func",b.commandStr);var c="srcRGB"in a?a.srcRGB:a.src,
  d="srcAlpha"in a?a.srcAlpha:a.src,f="dstRGB"in a?a.dstRGB:a.dst;a="dstAlpha"in a?a.dstAlpha:a.dst;u.commandParameter(c,Ma,k+".srcRGB",b.commandStr);u.commandParameter(d,Ma,k+".srcAlpha",b.commandStr);u.commandParameter(f,Ma,k+".dstRGB",b.commandStr);u.commandParameter(a,Ma,k+".dstAlpha",b.commandStr);u.command(-1===xb.indexOf(c+", "+f),"unallowed blending combination (srcRGB, dstRGB) = ("+c+", "+f+")",b.commandStr);return[Ma[c],Ma[f],Ma[d],Ma[a]]},function(b,c,d){function f(f,g){var k=c.def('"',f,
  g,'" in ',d,"?",d,".",f,g,":",d,".",f);u.optional(function(){b.assert(c,k+" in "+e,"invalid "+a+"."+f+g+", must be one of "+Object.keys(Ma))});return k}var e=b.constants.blendFuncs;u.optional(function(){b.assert(c,d+"&&typeof "+d+'==="object"',"invalid blend func, must be an object")});var g=f("src","RGB"),k=f("dst","RGB");u.optional(function(){b.assert(c,b.constants.invalidBlendCombinations+".indexOf("+g+'+", "+'+k+") === -1 ","unallowed blending combination for (srcRGB, dstRGB)")});var l=c.def(e,
  "[",g,"]"),m=c.def(e,"[",f("src","Alpha"),"]"),n=c.def(e,"[",k,"]"),p=c.def(e,"[",f("dst","Alpha"),"]");return[l,n,m,p]});case "blend.equation":return g(function(c){if("string"===typeof c)return u.commandParameter(c,la,"invalid "+a,b.commandStr),[la[c],la[c]];if("object"===("undefined"===typeof c?"undefined":X(c)))return u.commandParameter(c.rgb,la,a+".rgb",b.commandStr),u.commandParameter(c.alpha,la,a+".alpha",b.commandStr),[la[c.rgb],la[c.alpha]];u.commandRaise("invalid blend.equation",b.commandStr)},
  function(b,c,d){var f=b.constants.blendEquations,e=c.def(),g=c.def(),k=b.cond("typeof ",d,'==="string"');u.optional(function(){function c(a,c,d){b.assert(a,d+" in "+f,"invalid "+c+", must be one of "+Object.keys(la))}c(k.then,a,d);b.assert(k.else,d+"&&typeof "+d+'==="object"',"invalid "+a);c(k.else,a+".rgb",d+".rgb");c(k.else,a+".alpha",d+".alpha")});k.then(e,"=",g,"=",f,"[",d,"];");k.else(e,"=",f,"[",d,".rgb];",g,"=",f,"[",d,".alpha];");c(k);return[e,g]});case "blend.color":return g(function(a){u.command(aa(a)&&
  4===a.length,"blend.color must be a 4d array",b.commandStr);return U(4,function(b){return+a[b]})},function(a,b,c){u.optional(function(){a.assert(b,a.shared.isArrayLike+"("+c+")&&"+c+".length===4","blend.color must be a 4d array")});return U(4,function(a){return b.def("+",c,"[",a,"]")})});case "stencil.mask":return g(function(a){u.commandType(a,"number",k,b.commandStr);return a|0},function(a,b,c){u.optional(function(){a.assert(b,"typeof "+c+'==="number"',"invalid stencil.mask")});return b.def(c,"|0")});
  case "stencil.func":return g(function(c){u.commandType(c,"object",k,b.commandStr);var d=c.cmp||"keep",f=c.ref||0;c="mask"in c?c.mask:-1;u.commandParameter(d,Fb,a+".cmp",b.commandStr);u.commandType(f,"number",a+".ref",b.commandStr);u.commandType(c,"number",a+".mask",b.commandStr);return[Fb[d],f,c]},function(a,b,c){var d=a.constants.compareFuncs;u.optional(function(){function f(){a.assert(b,Array.prototype.join.call(arguments,""),"invalid stencil.func")}f(c+"&&typeof ",c,'==="object"');f('!("cmp" in ',
  c,")||(",c,".cmp in ",d,")")});var f=b.def('"cmp" in ',c,"?",d,"[",c,".cmp]",":",7680),e=b.def(c,".ref|0"),g=b.def('"mask" in ',c,"?",c,".mask|0:-1");return[f,e,g]});case "stencil.opFront":case "stencil.opBack":return g(function(c){u.commandType(c,"object",k,b.commandStr);var d=c.fail||"keep",f=c.zfail||"keep";c=c.zpass||"keep";u.commandParameter(d,fb,a+".fail",b.commandStr);u.commandParameter(f,fb,a+".zfail",b.commandStr);u.commandParameter(c,fb,a+".zpass",b.commandStr);return["stencil.opBack"===
  a?1029:1028,fb[d],fb[f],fb[c]]},function(b,c,d){function f(f){u.optional(function(){b.assert(c,'!("'+f+'" in '+d+")||("+d+"."+f+" in "+e+")","invalid "+a+"."+f+", must be one of "+Object.keys(fb))});return c.def('"',f,'" in ',d,"?",e,"[",d,".",f,"]:",7680)}var e=b.constants.stencilOps;u.optional(function(){b.assert(c,d+"&&typeof "+d+'==="object"',"invalid "+a)});return["stencil.opBack"===a?1029:1028,f("fail"),f("zfail"),f("zpass")]});case "polygonOffset.offset":return g(function(a){u.commandType(a,
  "object",k,b.commandStr);var c=a.factor|0;a=a.units|0;u.commandType(c,"number",k+".factor",b.commandStr);u.commandType(a,"number",k+".units",b.commandStr);return[c,a]},function(b,c,d){u.optional(function(){b.assert(c,d+"&&typeof "+d+'==="object"',"invalid "+a)});var f=c.def(d,".factor|0"),e=c.def(d,".units|0");return[f,e]});case "cull.face":return g(function(a){var c=0;"front"===a?c=1028:"back"===a&&(c=1029);u.command(!!c,k,b.commandStr);return c},function(a,b,c){u.optional(function(){a.assert(b,
  c+'==="front"||'+c+'==="back"',"invalid cull.face")});return b.def(c,'==="front"?',1028,":",1029)});case "lineWidth":return g(function(a){u.command("number"===typeof a&&a>=d.lineWidthDims[0]&&a<=d.lineWidthDims[1],"invalid line width, must be a positive number between "+d.lineWidthDims[0]+" and "+d.lineWidthDims[1],b.commandStr);return a},function(a,b,c){u.optional(function(){a.assert(b,"typeof "+c+'==="number"&&'+c+">="+d.lineWidthDims[0]+"&&"+c+"<="+d.lineWidthDims[1],"invalid line width")});return c});
  case "frontFace":return g(function(a){u.commandParameter(a,nb,k,b.commandStr);return nb[a]},function(a,b,c){u.optional(function(){a.assert(b,c+'==="cw"||'+c+'==="ccw"',"invalid frontFace, must be one of cw,ccw")});return b.def(c+'==="cw"?2304:2305')});case "colorMask":return g(function(a){u.command(aa(a)&&4===a.length,"color.mask must be length 4 array",b.commandStr);return a.map(function(a){return!!a})},function(a,b,c){u.optional(function(){a.assert(b,a.shared.isArrayLike+"("+c+")&&"+c+".length===4",
  "invalid color.mask")});return U(4,function(a){return"!!"+c+"["+a+"]"})});case "sample.coverage":return g(function(a){u.command("object"===("undefined"===typeof a?"undefined":X(a))&&a,k,b.commandStr);var c="value"in a?a.value:1;a=!!a.invert;u.command("number"===typeof c&&0<=c&&1>=c,"sample.coverage.value must be a number between 0 and 1",b.commandStr);return[c,a]},function(a,b,c){u.optional(function(){a.assert(b,c+"&&typeof "+c+'==="object"',"invalid sample.coverage")});var d=b.def('"value" in ',
  c,"?+",c,".value:1"),f=b.def("!!",c,".invert");return[d,f]})}});return e}function H(a,b){var c=a.static,d=a.dynamic,f={};Object.keys(c).forEach(function(a){var d=c[a];if("number"===typeof d||"boolean"===typeof d)var e=ba(function(){return d});else if("function"===typeof d){var g=d._reglType;"texture2d"===g||"textureCube"===g?e=ba(function(a){return a.link(d)}):"framebuffer"===g||"framebufferCube"===g?(u.command(0<d.color.length,'missing color attachment for framebuffer sent to uniform "'+a+'"',b.commandStr),
  e=ba(function(a){return a.link(d.color[0])})):u.commandRaise('invalid data for uniform "'+a+'"',b.commandStr)}else aa(d)?e=ba(function(b){return b.global.def("[",U(d.length,function(c){u.command("number"===typeof d[c]||"boolean"===typeof d[c],"invalid uniform "+a,b.commandStr);return d[c]}),"]")}):u.commandRaise('invalid or missing data for uniform "'+a+'"',b.commandStr);e.value=d;f[a]=e});Object.keys(d).forEach(function(a){var b=d[a];f[a]=ua(b,function(a,c){return a.invoke(c,b)})});return f}function da(a,
  c){var d=a.static,e=a.dynamic,g={};Object.keys(d).forEach(function(a){var e=d[a],k=b.id(a),l=new Qb;if(Ga(e))l.state=1,l.buffer=f.getBuffer(f.create(e,34962,!1,!0)),l.type=0;else{var m=f.getBuffer(e);if(m)l.state=1,l.buffer=m,l.type=0;else if(u.command("object"===("undefined"===typeof e?"undefined":X(e))&&e,"invalid data for attribute "+a,c.commandStr),"constant"in e){var n=e.constant;l.buffer="null";l.state=2;"number"===typeof n?l.x=n:(u.command(aa(n)&&0<n.length&&4>=n.length,"invalid constant for attribute "+
  a,c.commandStr),Gb.forEach(function(a,b){b<n.length&&(l[a]=n[b])}))}else{m=Ga(e.buffer)?f.getBuffer(f.create(e.buffer,34962,!1,!0)):f.getBuffer(e.buffer);u.command(!!m,'missing buffer for attribute "'+a+'"',c.commandStr);var p=e.offset|0;u.command(0<=p,'invalid offset for attribute "'+a+'"',c.commandStr);var r=e.stride|0;u.command(0<=r&&256>r,'invalid stride for attribute "'+a+'", must be integer betweeen [0, 255]',c.commandStr);var x=e.size|0;u.command(!("size"in e)||0<x&&4>=x,'invalid size for attribute "'+
  a+'", must be 1,2,3,4',c.commandStr);var t=!!e.normalized,W=0;"type"in e&&(u.commandParameter(e.type,Fa,"invalid type for attribute "+a,c.commandStr),W=Fa[e.type]);var v=e.divisor|0;"divisor"in e&&(u.command(0===v||N,'cannot specify divisor for attribute "'+a+'", instancing not supported',c.commandStr),u.command(0<=v,'invalid divisor for attribute "'+a+'"',c.commandStr));u.optional(function(){var b=c.commandStr,d="buffer offset divisor normalized type size stride".split(" ");Object.keys(e).forEach(function(c){u.command(0<=
  d.indexOf(c),'unknown parameter "'+c+'" for attribute pointer "'+a+'" (valid parameters are '+d+")",b)})});l.buffer=m;l.state=1;l.size=x;l.normalized=t;l.type=W||m.dtype;l.offset=p;l.stride=r;l.divisor=v}}g[a]=ba(function(a,b){b=a.attribCache;if(k in b)return b[k];var c={isStream:!1};Object.keys(l).forEach(function(a){c[a]=l[a]});l.buffer&&(c.buffer=a.link(l.buffer),c.type=c.type||c.buffer+".dtype");return b[k]=c})});Object.keys(e).forEach(function(a){var b=e[a];g[a]=ua(b,function(c,d){function f(a){d(m[a],
  "=",e,".",a,"|0;")}var e=c.invoke(d,b),g=c.shared,k=g.isBufferArgs,l=g.buffer;u.optional(function(){c.assert(d,e+"&&(typeof "+e+'==="object"||typeof '+e+'==="function")&&('+k+"("+e+")||"+l+".getBuffer("+e+")||"+l+".getBuffer("+e+".buffer)||"+k+"("+e+'.buffer)||("constant" in '+e+"&&(typeof "+e+'.constant==="number"||'+g.isArrayLike+"("+e+".constant))))",'invalid dynamic attribute "'+a+'"')});var m={isStream:d.def(!1)},n=new Qb;n.state=1;Object.keys(n).forEach(function(a){m[a]=d.def(""+n[a])});var p=
  m.buffer,r=m.type;d("if(",k,"(",e,")){",m.isStream,"=true;",p,"=",l,".createStream(",34962,",",e,");",r,"=",p,".dtype;","}else{",p,"=",l,".getBuffer(",e,");","if(",p,"){",r,"=",p,".dtype;",'}else if("constant" in ',e,"){",m.state,"=",2,";","if(typeof "+e+'.constant === "number"){',m[Gb[0]],"=",e,".constant;",Gb.slice(1).map(function(a){return m[a]}).join("="),"=0;","}else{",Gb.map(function(a,b){return m[a]+"="+e+".constant.length>"+b+"?"+e+".constant["+b+"]:0;"}).join(""),"}}else{","if(",k,"(",e,
  ".buffer)){",p,"=",l,".createStream(",34962,",",e,".buffer);","}else{",p,"=",l,".getBuffer(",e,".buffer);","}",r,'="type" in ',e,"?",g.glTypes,"[",e,".type]:",p,".dtype;",m.normalized,"=!!",e,".normalized;");f("size");f("offset");f("stride");f("divisor");d("}}");d.exit("if(",m.isStream,"){",l,".destroyStream(",p,");","}");return m})});return g}function Ab(a){var b=a.static,c=a.dynamic,d={};Object.keys(b).forEach(function(a){var c=b[a];d[a]=ba(function(a,b){return"number"===typeof c||"boolean"===typeof c?
  ""+c:a.link(c)})});Object.keys(c).forEach(function(a){var b=c[a];d[a]=ua(b,function(a,c){return a.invoke(c,b)})});return d}function C(a,b,c,d,f){function e(a){var b=m[a];b&&(p[a]=b)}var g=a.static,k=a.dynamic;u.optional(function(){function a(a){Object.keys(a).forEach(function(a){u.command(0<=b.indexOf(a),'unknown parameter "'+a+'"',f.commandStr)})}var b="framebuffer vert frag elements primitive offset count instances profile".split(" ").concat(V);a(g);a(k)});var l=A(a,f),m=y(a,l,f),n=G(a,f),p=D(a,
  f),r=ca(a,f);e("viewport");e(x("scissor.box"));var t=0<Object.keys(p).length;l={framebuffer:l,draw:n,shader:r,state:p,dirty:t};l.profile=z(a,f);l.uniforms=H(c,f);l.attributes=da(b,f);l.context=Ab(d,f);return l}function Ra(a,b,c){var d=a.shared.context,f=a.scope();Object.keys(c).forEach(function(e){b.save(d,"."+e);f(d,".",e,"=",c[e].append(a,b),";")});b(f)}function F(a,b,c,d){var f=a.shared,e=f.gl,g=f.framebuffer,k;R&&(k=b.def(f.extensions,".webgl_draw_buffers"));var l=a.constants;f=l.drawBuffer;l=
  l.backBuffer;a=c?c.append(a,b):b.def(g,".next");d||b("if(",a,"!==",g,".cur){");b("if(",a,"){",e,".bindFramebuffer(",36160,",",a,".framebuffer);");R&&b(k,".drawBuffersWEBGL(",f,"[",a,".colorAttachments.length]);");b("}else{",e,".bindFramebuffer(",36160,",null);");R&&b(k,".drawBuffersWEBGL(",l,");");b("}",g,".cur=",a,";");d||b("}")}function Ja(a,b,c){var d=a.shared,f=d.gl,e=a.current,g=a.next,k=d.current,l=d.next,m=a.cond(k,".dirty");V.forEach(function(b){b=x(b);if(!(b in c.state))if(b in g){var d=
  g[b];var n=e[b];var p=U(O[b].length,function(a){return m.def(d,"[",a,"]")});m(a.cond(p.map(function(a,b){return a+"!=="+n+"["+b+"]"}).join("||")).then(f,".",Sa[b],"(",p,");",p.map(function(a,b){return n+"["+b+"]="+a}).join(";"),";"))}else d=m.def(l,".",b),p=a.cond(d,"!==",k,".",b),m(p),b in db?p(a.cond(d).then(f,".enable(",db[b],");").else(f,".disable(",db[b],");"),k,".",b,"=",d,";"):p(f,".",Sa[b],"(",d,");",k,".",b,"=",d,";")});0===Object.keys(c.state).length&&m(k,".dirty=false;");b(m)}function Ka(a,
  b,c,d){var f=a.shared,e=a.current,g=f.current,k=f.gl;Wa(Object.keys(c)).forEach(function(f){var l=c[f];if(!d||d(l)){var m=l.append(a,b);if(db[f]){var n=db[f];eb(l)?m?b(k,".enable(",n,");"):b(k,".disable(",n,");"):b(a.cond(m).then(k,".enable(",n,");").else(k,".disable(",n,");"));b(g,".",f,"=",m,";")}else if(aa(m)){var p=e[f];b(k,".",Sa[f],"(",m,");",m.map(function(a,b){return p+"["+b+"]="+a}).join(";"),";")}else b(k,".",Sa[f],"(",m,");",g,".",f,"=",m,";")}})}function ma(a,b){N&&(a.instancing=b.def(a.shared.extensions,
  ".angle_instanced_arrays"))}function I(a,b,c,d,f){function e(){return"undefined"===typeof performance?"Date.now()":"performance.now()"}function g(a){x=b.def();a(x,"=",e(),";");"string"===typeof f?a(n,".count+=",f,";"):a(n,".count++;");t&&(d?(u=b.def(),a(u,"=",r,".getNumPendingQueries();")):a(r,".beginQuery(",n,");"))}function k(a){a(n,".cpuTime+=",e(),"-",x,";");t&&(d?a(r,".pushScopeStats(",u,",",r,".getNumPendingQueries(),",n,");"):a(r,".endQuery();"))}function l(a){var c=b.def(p,".profile");b(p,
  ".profile=",a,";");b.exit(p,".profile=",c,";")}var m=a.shared,n=a.stats,p=m.current,r=m.timer;c=c.profile;var x,u;if(c){if(eb(c)){c.enable?(g(b),k(b.exit),l("true")):l("false");return}c=c.append(a,b);l(c)}else c=b.def(p,".profile");m=a.block();g(m);b("if(",c,"){",m,"}");a=a.block();k(a);b.exit("if(",c,"){",a,"}")}function J(a,b,c,d,f){function e(a){switch(a){case 35664:case 35667:case 35671:return 2;case 35665:case 35668:case 35672:return 3;case 35666:case 35669:case 35673:return 4;default:return 1}}
  function g(c,d,f){function e(){b("if(!",n,".buffer){",l,".enableVertexAttribArray(",m,");}");var c=f.type;var e=f.size?b.def(f.size,"||",d):d;b("if(",n,".type!==",c,"||",n,".size!==",e,"||",x.map(function(a){return n+"."+a+"!=="+f[a]}).join("||"),"){",l,".bindBuffer(",34962,",",p,".buffer);",l,".vertexAttribPointer(",[m,e,c,f.normalized,f.stride,f.offset],");",n,".type=",c,";",n,".size=",e,";",x.map(function(a){return n+"."+a+"="+f[a]+";"}).join(""),"}");N&&(c=f.divisor,b("if(",n,".divisor!==",c,
  "){",a.instancing,".vertexAttribDivisorANGLE(",[m,c],");",n,".divisor=",c,";}"))}function g(){b("if(",n,".buffer){",l,".disableVertexAttribArray(",m,");","}if(",Gb.map(function(a,b){return n+"."+a+"!=="+r[b]}).join("||"),"){",l,".vertexAttrib4f(",m,",",r,");",Gb.map(function(a,b){return n+"."+a+"="+r[b]+";"}).join(""),"}")}var l=k.gl,m=b.def(c,".location"),n=b.def(k.attributes,"[",m,"]");c=f.state;var p=f.buffer,r=[f.x,f.y,f.z,f.w],x=["buffer","normalized","offset","stride"];1===c?e():2===c?g():(b("if(",
  c,"===",1,"){"),e(),b("}else{"),g(),b("}"))}var k=a.shared;d.forEach(function(d){var k=d.name,l=c.attributes[k];if(l){if(!f(l))return;var m=l.append(a,b)}else{if(!f(zb))return;var n=a.scopeAttrib(k);u.optional(function(){a.assert(b,n+".state","missing attribute "+k)});m={};Object.keys(new Qb).forEach(function(a){m[a]=b.def(n,".",a)})}g(a.link(d),e(d.info.type),m)})}function Ub(a,c,d,f,e){for(var g=a.shared,k=g.gl,l,m=0;m<f.length;++m){var n=f[m],p=n.name,r=n.info.type,x=d.uniforms[p];n=a.link(n)+
  ".location";if(x){if(!e(x))continue;if(eb(x)){var t=x.value;u.command(null!==t&&"undefined"!==typeof t,'missing uniform "'+p+'"',a.commandStr);if(35678===r||35680===r)u.command("function"===typeof t&&(35678===r&&("texture2d"===t._reglType||"framebuffer"===t._reglType)||35680===r&&("textureCube"===t._reglType||"framebufferCube"===t._reglType)),"invalid texture for uniform "+p,a.commandStr),x=a.link(t._texture||t.color[0]._texture),c(k,".uniform1i(",n,",",x+".bind());"),c.exit(x,".unbind();");else if(35674===
  r||35675===r||35676===r){u.optional(function(){u.command(aa(t),"invalid matrix for uniform "+p,a.commandStr);u.command(35674===r&&4===t.length||35675===r&&9===t.length||35676===r&&16===t.length,"invalid length for matrix uniform "+p,a.commandStr)});x=a.global.def("new Float32Array(["+Array.prototype.slice.call(t)+"])");var v=2;35675===r?v=3:35676===r&&(v=4);c(k,".uniformMatrix",v,"fv(",n,",false,",x,");")}else{switch(r){case 5126:u.commandType(t,"number","uniform "+p,a.commandStr);l="1f";break;case 35664:u.command(aa(t)&&
  2===t.length,"uniform "+p,a.commandStr);l="2f";break;case 35665:u.command(aa(t)&&3===t.length,"uniform "+p,a.commandStr);l="3f";break;case 35666:u.command(aa(t)&&4===t.length,"uniform "+p,a.commandStr);l="4f";break;case 35670:u.commandType(t,"boolean","uniform "+p,a.commandStr);l="1i";break;case 5124:u.commandType(t,"number","uniform "+p,a.commandStr);l="1i";break;case 35671:u.command(aa(t)&&2===t.length,"uniform "+p,a.commandStr);l="2i";break;case 35667:u.command(aa(t)&&2===t.length,"uniform "+p,
  a.commandStr);l="2i";break;case 35672:u.command(aa(t)&&3===t.length,"uniform "+p,a.commandStr);l="3i";break;case 35668:u.command(aa(t)&&3===t.length,"uniform "+p,a.commandStr);l="3i";break;case 35673:u.command(aa(t)&&4===t.length,"uniform "+p,a.commandStr);l="4i";break;case 35669:u.command(aa(t)&&4===t.length,"uniform "+p,a.commandStr),l="4i"}c(k,".uniform",l,"(",n,",",aa(t)?Array.prototype.slice.call(t):t,");")}continue}else var E=x.append(a,c)}else{if(!e(zb))continue;E=c.def(g.uniforms,"[",b.id(p),
  "]")}35678===r?c("if(",E,"&&",E,'._reglType==="framebuffer"){',E,"=",E,".color[0];","}"):35680===r&&c("if(",E,"&&",E,'._reglType==="framebufferCube"){',E,"=",E,".color[0];","}");u.optional(function(){function b(b,d){a.assert(c,b,'bad data or missing for uniform "'+p+'".  '+d)}function d(a){b("typeof "+E+'==="'+a+'"',"invalid type, expected "+a)}function f(c,d){b(g.isArrayLike+"("+E+")&&"+E+".length==="+c,"invalid vector, should have length "+c,a.commandStr)}function e(c){b("typeof "+E+'==="function"&&'+
  E+'._reglType==="texture'+(3553===c?"2d":"Cube")+'"',"invalid texture type",a.commandStr)}switch(r){case 5124:d("number");break;case 35667:f(2,"number");break;case 35668:f(3,"number");break;case 35669:f(4,"number");break;case 5126:d("number");break;case 35664:f(2,"number");break;case 35665:f(3,"number");break;case 35666:f(4,"number");break;case 35670:d("boolean");break;case 35671:f(2,"boolean");break;case 35672:f(3,"boolean");break;case 35673:f(4,"boolean");break;case 35674:f(4,"number");break;case 35675:f(9,
  "number");break;case 35676:f(16,"number");break;case 35678:e(3553);break;case 35680:e(34067)}});x=1;switch(r){case 35678:case 35680:x=c.def(E,"._texture");c(k,".uniform1i(",n,",",x,".bind());");c.exit(x,".unbind();");continue;case 5124:case 35670:l="1i";break;case 35667:case 35671:l="2i";x=2;break;case 35668:case 35672:l="3i";x=3;break;case 35669:case 35673:l="4i";x=4;break;case 5126:l="1f";break;case 35664:l="2f";x=2;break;case 35665:l="3f";x=3;break;case 35666:l="4f";x=4;break;case 35674:l="Matrix2fv";
  break;case 35675:l="Matrix3fv";break;case 35676:l="Matrix4fv"}c(k,".uniform",l,"(",n,",");if("M"===l.charAt(0)){n=Math.pow(r-35674+2,2);var w=a.global.def("new Float32Array(",n,")");c("false,(Array.isArray(",E,")||",E," instanceof Float32Array)?",E,":(",U(n,function(a){return w+"["+a+"]="+E+"["+a+"]"}),",",w,")")}else 1<x?c(U(x,function(a){return E+"["+a+"]"})):c(E);c(");")}}function M(a,b,c,d){function f(f){var e=n[f];return e?e.contextDep&&d.contextDynamic||e.propDep?e.append(a,c):e.append(a,b):
  b.def(m,".",f)}function e(){function a(){c(E,".drawElementsInstancedANGLE(",[r,x,w,t+"<<(("+w+"-5121)>>1)",v],");")}function b(){c(E,".drawArraysInstancedANGLE(",[r,t,x,v],");")}p?W?a():(c("if(",p,"){"),a(),c("}else{"),b(),c("}")):b()}function g(){function a(){c(l+".drawElements("+[r,x,w,t+"<<(("+w+"-5121)>>1)"]+");")}function b(){c(l+".drawArrays("+[r,t,x]+");")}p?W?a():(c("if(",p,"){"),a(),c("}else{"),b(),c("}")):b()}var k=a.shared,l=k.gl,m=k.draw,n=d.draw,p=function(){var f=n.elements,e=b;if(f){if(f.contextDep&&
  d.contextDynamic||f.propDep)e=c;f=f.append(a,e)}else f=e.def(m,".","elements");f&&e("if("+f+")"+l+".bindBuffer(34963,"+f+".buffer.buffer);");return f}(),r=f("primitive"),t=f("offset"),x=function(){var f=n.count,e=b;if(f){if(f.contextDep&&d.contextDynamic||f.propDep)e=c;var g=f.append(a,e);u.optional(function(){f.MISSING&&a.assert(b,"false","missing vertex count");f.DYNAMIC&&a.assert(e,g+">=0","missing vertex count")})}else g=e.def(m,".","count"),u.optional(function(){a.assert(e,g+">=0","missing vertex count")});
  return g}();if("number"===typeof x){if(0===x)return}else c("if(",x,"){"),c.exit("}");if(N){var v=f("instances");var E=a.instancing}var w=p+".type",W=n.elements&&eb(n.elements);N&&("number"!==typeof v||0<=v)?"string"===typeof v?(c("if(",v,">0){"),e(),c("}else if(",v,"<0){"),g(),c("}")):e():g()}function K(a,b,c,d,f){var e=B();f=e.proc("body",f);u.optional(function(){e.commandStr=b.commandStr;e.command=e.link(b.commandStr)});N&&(e.instancing=f.def(e.shared.extensions,".angle_instanced_arrays"));a(e,
  f,c,d);return e.compile().body}function xc(a,b,c,d){ma(a,b);J(a,b,c,d.attributes,function(){return!0});Ub(a,b,c,d.uniforms,function(){return!0});M(a,b,b,c)}function Q(a,b){var c=a.proc("draw",1);ma(a,c);Ra(a,c,b.context);F(a,c,b.framebuffer);Ja(a,c,b);Ka(a,c,b.state);I(a,c,b,!1,!0);var d=b.shader.progVar.append(a,c);c(a.shared.gl,".useProgram(",d,".program);");if(b.shader.program)xc(a,c,b,b.shader.program);else{var f=a.global.def("{}"),e=c.def(d,".id"),g=c.def(f,"[",e,"]");c(a.cond(g).then(g,".call(this,a0);").else(g,
  "=",f,"[",e,"]=",a.link(function(c){return K(xc,a,b,c,1)}),"(",d,");",g,".call(this,a0);"))}0<Object.keys(b.state).length&&c(a.shared.current,".dirty=true;")}function Tb(a,b,c,d){function f(){return!0}a.batchId="a1";ma(a,b);J(a,b,c,d.attributes,f);Ub(a,b,c,d.uniforms,f);M(a,b,b,c)}function qb(a,b,c,d){function f(a){return a.contextDep&&g||a.propDep}function e(a){return!f(a)}ma(a,b);var g=c.contextDep,k=b.def(),l=b.def();a.shared.props=l;a.batchId=k;var m=a.scope(),n=a.scope();b(m.entry,"for(",k,"=0;",
  k,"<","a1",";++",k,"){",l,"=","a0","[",k,"];",n,"}",m.exit);c.needsContext&&Ra(a,n,c.context);c.needsFramebuffer&&F(a,n,c.framebuffer);Ka(a,n,c.state,f);c.profile&&f(c.profile)&&I(a,n,c,!1,!0);d?(J(a,m,c,d.attributes,e),J(a,n,c,d.attributes,f),Ub(a,m,c,d.uniforms,e),Ub(a,n,c,d.uniforms,f),M(a,m,n,c)):(b=a.global.def("{}"),d=c.shader.progVar.append(a,n),l=n.def(d,".id"),m=n.def(b,"[",l,"]"),n(a.shared.gl,".useProgram(",d,".program);","if(!",m,"){",m,"=",b,"[",l,"]=",a.link(function(b){return K(Tb,
  a,c,b,2)}),"(",d,");}",m,".call(this,a0[",k,"],",k,");"))}function S(a,b){function c(a){return a.contextDep&&f||a.propDep}var d=a.proc("batch",2);a.batchId="0";ma(a,d);var f=!1,e=!0;Object.keys(b.context).forEach(function(a){f=f||b.context[a].propDep});f||(Ra(a,d,b.context),e=!1);var g=b.framebuffer,k=!1;g?(g.propDep?f=k=!0:g.contextDep&&f&&(k=!0),k||F(a,d,g)):F(a,d,null);b.state.viewport&&b.state.viewport.propDep&&(f=!0);Ja(a,d,b);Ka(a,d,b.state,function(a){return!c(a)});b.profile&&c(b.profile)||
  I(a,d,b,!1,"a1");b.contextDep=f;b.needsContext=e;b.needsFramebuffer=k;e=b.shader.progVar;if(e.contextDep&&f||e.propDep)qb(a,d,b,null);else if(e=e.append(a,d),d(a.shared.gl,".useProgram(",e,".program);"),b.shader.program)qb(a,d,b,b.shader.program);else{g=a.global.def("{}");k=d.def(e,".id");var l=d.def(g,"[",k,"]");d(a.cond(l).then(l,".call(this,a0,a1);").else(l,"=",g,"[",k,"]=",a.link(function(c){return K(qb,a,b,c,2)}),"(",e,");",l,".call(this,a0,a1);"))}0<Object.keys(b.state).length&&d(a.shared.current,
  ".dirty=true;")}function P(a,c){function d(b){var d=c.shader[b];d&&f.set(e.shader,"."+b,d.append(a,f))}var f=a.proc("scope",3);a.batchId="a2";var e=a.shared,g=e.current;Ra(a,f,c.context);c.framebuffer&&c.framebuffer.append(a,f);Wa(Object.keys(c.state)).forEach(function(b){var d=c.state[b].append(a,f);aa(d)?d.forEach(function(c,d){f.set(a.next[b],"["+d+"]",c)}):f.set(e.next,"."+b,d)});I(a,f,c,!0,!0);["elements","offset","count","instances","primitive"].forEach(function(b){var d=c.draw[b];d&&f.set(e.draw,
  "."+b,""+d.append(a,f))});Object.keys(c.uniforms).forEach(function(d){f.set(e.uniforms,"["+b.id(d)+"]",c.uniforms[d].append(a,f))});Object.keys(c.attributes).forEach(function(b){var d=c.attributes[b].append(a,f),e=a.scopeAttrib(b);Object.keys(new Qb).forEach(function(a){f.set(e,"."+a,d[a])})});d("vert");d("frag");0<Object.keys(c.state).length&&(f(g,".dirty=true;"),f.exit(g,".dirty=true;"));f("a1(",a.shared.context,",a0,",a.batchId,");")}function T(a){if("object"===("undefined"===typeof a?"undefined":
  X(a))&&!aa(a)){for(var b=Object.keys(a),c=0;c<b.length;++c)if(Ea.isDynamic(a[b[c]]))return!0;return!1}}function pb(a,b,c){var d=b.static[c];if(d&&T(d)){var f=a.global,e=Object.keys(d),g=!1,k=!1,l=!1,m=a.global.def("{}");e.forEach(function(b){var c=d[b];if(Ea.isDynamic(c))"function"===typeof c&&(c=d[b]=Ea.unbox(c)),b=ua(c,null),g=g||b.thisDep,l=l||b.propDep,k=k||b.contextDep;else{f(m,".",b,"=");switch("undefined"===typeof c?"undefined":X(c)){case "number":f(c);break;case "string":f('"',c,'"');break;
  case "object":Array.isArray(c)&&f("[",c.join(),"]");break;default:f(a.link(c))}f(";")}});b.dynamic[c]=new Ea.DynamicVariable(4,{thisDep:g,contextDep:k,propDep:l,ref:m,append:function(a,b){e.forEach(function(c){var f=d[c];Ea.isDynamic(f)&&(f=a.invoke(b,f),b(m,".",c,"=",f,";"))})}});delete b.static[c]}}var Qb=m.Record,la={add:32774,subtract:32778,"reverse subtract":32779};c.ext_blend_minmax&&(la.min=32775,la.max=32776);var N=c.angle_instanced_arrays,R=c.webgl_draw_buffers,O={dirty:!0,profile:v.profile},
  Sb={},V=[],db={},Sa={};w("dither",3024);w("blend.enable",3042);E("blend.color","blendColor",[0,0,0,0]);E("blend.equation","blendEquationSeparate",[32774,32774]);E("blend.func","blendFuncSeparate",[1,0,1,0]);w("depth.enable",2929,!0);E("depth.func","depthFunc",513);E("depth.range","depthRange",[0,1]);E("depth.mask","depthMask",!0);E("colorMask","colorMask",[!0,!0,!0,!0]);w("cull.enable",2884);E("cull.face","cullFace",1029);E("frontFace","frontFace",2305);E("lineWidth","lineWidth",1);w("polygonOffset.enable",
  32823);E("polygonOffset.offset","polygonOffset",[0,0]);w("sample.alpha",32926);w("sample.enable",32928);E("sample.coverage","sampleCoverage",[1,!1]);w("stencil.enable",2960);E("stencil.mask","stencilMask",-1);E("stencil.func","stencilFunc",[519,0,-1]);E("stencil.opFront","stencilOpSeparate",[1028,7680,7680,7680]);E("stencil.opBack","stencilOpSeparate",[1029,7680,7680,7680]);w("scissor.enable",3089);E("scissor.box","scissor",[0,0,a.drawingBufferWidth,a.drawingBufferHeight]);E("viewport","viewport",
  [0,0,a.drawingBufferWidth,a.drawingBufferHeight]);var Z={gl:a,context:r,strings:b,next:Sb,current:O,draw:p,elements:e,buffer:f,shader:n,attributes:m.state,uniforms:l,framebuffer:k,extensions:c,timer:t,isBufferArgs:Ga},Ca={primTypes:Bb,compareFuncs:Fb,blendFuncs:Ma,blendEquations:la,stencilOps:fb,glTypes:Fa,orientationType:nb};u.optional(function(){Z.isArrayLike=aa});R&&(Ca.backBuffer=[1029],Ca.drawBuffer=U(d.maxDrawbuffers,function(a){return 0===a?[0]:U(a,function(a){return 36064+a})}));var Y=0;return{next:Sb,
  current:O,procs:function(){var a=B(),b=a.proc("poll"),c=a.proc("refresh"),f=a.block();b(f);c(f);var e=a.shared,g=e.gl,k=e.next,l=e.current;f(l,".dirty=false;");F(a,b);F(a,c,null,!0);var m;N&&(m=a.link(N));for(var n=0;n<d.maxAttributes;++n){var p=c.def(e.attributes,"[",n,"]"),r=a.cond(p,".buffer");r.then(g,".enableVertexAttribArray(",n,");",g,".bindBuffer(",34962,",",p,".buffer.buffer);",g,".vertexAttribPointer(",n,",",p,".size,",p,".type,",p,".normalized,",p,".stride,",p,".offset);").else(g,".disableVertexAttribArray(",
  n,");",g,".vertexAttrib4f(",n,",",p,".x,",p,".y,",p,".z,",p,".w);",p,".buffer=null;");c(r);N&&c(m,".vertexAttribDivisorANGLE(",n,",",p,".divisor);")}Object.keys(db).forEach(function(d){var e=db[d],m=f.def(k,".",d),n=a.block();n("if(",m,"){",g,".enable(",e,")}else{",g,".disable(",e,")}",l,".",d,"=",m,";");c(n);b("if(",m,"!==",l,".",d,"){",n,"}")});Object.keys(Sa).forEach(function(d){var e=Sa[d],m=O[d],n=a.block();n(g,".",e,"(");if(aa(m)){e=m.length;var p=a.global.def(k,".",d);var r=a.global.def(l,
  ".",d);n(U(e,function(a){return p+"["+a+"]"}),");",U(e,function(a){return r+"["+a+"]="+p+"["+a+"];"}).join(""));b("if(",U(e,function(a){return p+"["+a+"]!=="+r+"["+a+"]"}).join("||"),"){",n,"}")}else p=f.def(k,".",d),r=f.def(l,".",d),n(p,");",l,".",d,"=",p,";"),b("if(",p,"!==",r,"){",n,"}");c(n)});return a.compile()}(),compile:function(a,b,c,d,f){var e=B();e.stats=e.link(f);Object.keys(b.static).forEach(function(a){pb(e,b,a)});Ob.forEach(function(b){pb(e,a,b)});c=C(a,b,c,d,e);Q(e,c);P(e,c);S(e,c);
  return e.compile()}}}function Xa(a,b){for(var c=0;c<a.length;++c)if(a[c]===b)return c;return-1}var oa=function(a){return a instanceof Uint8Array||a instanceof Uint16Array||a instanceof Uint32Array||a instanceof Int8Array||a instanceof Int16Array||a instanceof Int32Array||a instanceof Float32Array||a instanceof Float64Array||a instanceof Uint8ClampedArray},Z=function(a,b){for(var c=Object.keys(b),d=0;d<c.length;++d)a[c[d]]=b[c[d]];return a},Ya="gl canvas container attributes pixelRatio extensions optionalExtensions profile onDone".split(" "),
  ta={};ta[5120]=ta[5121]=1;ta[5122]=ta[5123]=ta[36193]=ta[33635]=ta[32819]=ta[32820]=2;ta[5124]=ta[5125]=ta[5126]=ta[34042]=4;var u=Z(c,{optional:function(a){a()},raise:a,commandRaise:w,command:function(a,b,c){a||w(b,c||r())},parameter:function(b,c,f){b in c||a("unknown parameter ("+b+")"+d(f)+". possible values: "+Object.keys(c).join())},commandParameter:function(a,b,c,f){a in b||w("unknown parameter ("+a+")"+d(c)+". possible values: "+Object.keys(b).join(),f||r())},constructor:function(b){Object.keys(b).forEach(function(b){0>
  Ya.indexOf(b)&&a('invalid regl constructor argument "'+b+'". must be one of '+Ya)})},type:function(b,c,f){("undefined"===typeof b?"undefined":X(b))!==c&&a("invalid parameter type"+d(f)+". expected "+c+", got "+("undefined"===typeof b?"undefined":X(b)))},commandType:G,isTypedArray:function(b,c){oa(b)||a("invalid parameter type"+d(c)+". must be a typed array")},nni:function(b,c){0<=b&&(b|0)===b||a("invalid parameter type, ("+b+")"+d(c)+". must be a nonnegative integer")},oneOf:e,shaderError:function(a,
  b,d,f,e){if(!a.getShaderParameter(b,a.COMPILE_STATUS)){b=a.getShaderInfoLog(b);a=f===a.FRAGMENT_SHADER?"fragment":"vertex";G(d,"string",a+" shader source must be a string",e);var g=t(d,e);d=v(b);y(g,d);Object.keys(g).forEach(function(a){function b(a,b){d.push(a);f.push(b||"")}var c=g[a];if(c.hasErrors){var d=[""],f=[""];b("file number "+a+": "+c.name+"\n","color:red;text-decoration:underline;font-weight:bold");c.lines.forEach(function(a){if(0<a.errors.length){b(l(a.number,4)+"|  ","background-color:yellow; font-weight:bold");
  b(a.line+"\n","color:red; background-color:yellow; font-weight:bold");var c=0;a.errors.forEach(function(d){d=d.message;var f=/^\s*'(.*)'\s*:\s*(.*)$/.exec(d);if(f){var e=f[1];d=f[2];switch(e){case "assign":e="="}c=Math.max(a.line.indexOf(e,c),0)}else c=0;b(l("| ",6));b(l("^^^",c+3)+"\n","font-weight:bold");b(l("| ",6));b(d+"\n","font-weight:bold")});b(l("| ",6)+"\n")}else b(l(a.number,4)+"|  "),b(a.line+"\n","color:red")});"undefined"===typeof document||window.chrome||(f[0]=d.join("%c"))}});c.raise("Error compiling "+
  a+" shader, "+g[0].name)}},linkError:function(a,b,d,f,e){a.getProgramParameter(b,a.LINK_STATUS)||(a.getProgramInfoLog(b),a=t(d,e),f='Error linking program with vertex shader, "'+t(f,e)[0].name+'", and fragment shader "'+a[0].name+'"',c.raise(f))},callSite:m,saveCommandRef:z,saveDrawInfo:function(a,b,c,d){function f(a){return a?d.id(a):0}function e(a,b){Object.keys(b).forEach(function(b){a[d.id(b)]=!0})}z(a);a._fragId=f(a.static.frag);a._vertId=f(a.static.vert);var g=a._uniformSet={};e(g,b.static);
  e(g,b.dynamic);b=a._attributeSet={};e(b,c.static);e(b,c.dynamic);a._hasCount="count"in a.static||"count"in a.dynamic||"elements"in a.static||"elements"in a.dynamic},framebufferFormat:function(a,b,c){a.texture?e(a.texture._texture.internalformat,b,"unsupported texture format for attachment"):e(a.renderbuffer._renderbuffer.format,c,"unsupported renderbuffer format for attachment")},guessCommand:r,texture2D:function(a,b,d){var f=b.width,e=b.height,g=b.channels;c(0<f&&f<=d.maxTextureSize&&0<e&&e<=d.maxTextureSize,
  "invalid texture shape");33071===a.wrapS&&33071===a.wrapT||c(!(f&f-1)&&!!f&&!(e&e-1)&&!!e,"incompatible wrap mode for texture, both width and height must be power of 2");1===b.mipmask?1!==f&&1!==e&&c(9984!==a.minFilter&&9986!==a.minFilter&&9985!==a.minFilter&&9987!==a.minFilter,"min filter requires mipmap"):(c(!(f&f-1)&&!!f&&!(e&e-1)&&!!e,"texture must be a square power of 2 to support mipmapping"),c(b.mipmask===(f<<1)-1,"missing or incomplete mipmap data"));5126===b.type&&(0>d.extensions.indexOf("oes_texture_float_linear")&&
  c(9728===a.minFilter&&9728===a.magFilter,"filter not supported, must enable oes_texture_float_linear"),c(!a.genMipmaps,"mipmap generation not supported with float textures"));var k=b.images;for(d=0;16>d;++d)if(k[d]){var l=f>>d,m=e>>d;c(b.mipmask&1<<d,"missing mipmap data");var n=k[d];c(n.width===l&&n.height===m,"invalid shape for mip images");c(n.format===b.format&&n.internalformat===b.internalformat&&n.type===b.type,"incompatible type for mip image");!n.compressed&&n.data&&(l=Math.ceil(A(n.type,
  g)*l/n.unpackAlignment)*n.unpackAlignment,c(n.data.byteLength===l*m,"invalid data for image, buffer size is inconsistent with image format"))}else a.genMipmaps||c(0===(b.mipmask&1<<d),"extra mipmap data");b.compressed&&c(!a.genMipmaps,"mipmap generation for compressed images not supported")},textureCube:function(a,b,d,f){var e=a.width,g=a.height,k=a.channels;c(0<e&&e<=f.maxTextureSize&&0<g&&g<=f.maxTextureSize,"invalid texture shape");c(e===g,"cube map must be square");c(33071===b.wrapS&&33071===
  b.wrapT,"wrap mode not supported by cube map");for(f=0;f<d.length;++f){var l=d[f];c(l.width===e&&l.height===g,"inconsistent cube map face shape");b.genMipmaps&&(c(!l.compressed,"can not generate mipmap for compressed textures"),c(1===l.mipmask,"can not specify mipmaps and generate mipmaps"));for(var m=l.images,n=0;16>n;++n){var p=m[n];if(p){var r=e>>n,t=g>>n;c(l.mipmask&1<<n,"missing mipmap data");c(p.width===r&&p.height===t,"invalid shape for mip images");c(p.format===a.format&&p.internalformat===
  a.internalformat&&p.type===a.type,"incompatible type for mip image");p.compressed||p.data&&c(p.data.byteLength===r*t*Math.max(A(p.type,k),p.unpackAlignment),"invalid data for image, buffer size is inconsistent with image format")}}}}}),lb=0,Ea={DynamicVariable:C,define:function(a,b){return new C(a,D(b+""))},isDynamic:function(a){return"function"===typeof a&&!a._reglType||a instanceof C},unbox:function(a,b){return"function"===typeof a?new C(0,a):a},accessor:D},Qa={next:"function"===typeof requestAnimationFrame?
  function(a){return requestAnimationFrame(a)}:function(a){return setTimeout(a,16)},cancel:"function"===typeof cancelAnimationFrame?function(a){return cancelAnimationFrame(a)}:clearTimeout},bb="undefined"!==typeof performance&&performance.now?function(){return performance.now()}:function(){return+new Date},V=ea();V.zero=ea();var ob=function(a,b){var c=1;b.ext_texture_filter_anisotropic&&(c=a.getParameter(34047));var d=1,f=1;b.webgl_draw_buffers&&(d=a.getParameter(34852),f=a.getParameter(36063));var e=
  !!b.oes_texture_float;if(e){e=a.createTexture();a.bindTexture(3553,e);a.texImage2D(3553,0,6408,1,1,0,6408,5126,null);var g=a.createFramebuffer();a.bindFramebuffer(36160,g);a.framebufferTexture2D(36160,36064,3553,e,0);a.bindTexture(3553,null);if(36053!==a.checkFramebufferStatus(36160))e=!1;else{a.viewport(0,0,1,1);a.clearColor(1,0,0,1);a.clear(16384);var k=V.allocType(5126,4);a.readPixels(0,0,1,1,6408,5126,k);a.getError()?e=!1:(a.deleteFramebuffer(g),a.deleteTexture(e),e=1===k[0]);V.freeType(k)}}k=
  !0;"undefined"!==typeof navigator&&(/MSIE/.test(navigator.userAgent)||/Trident\//.test(navigator.appVersion)||/Edge/.test(navigator.userAgent))||(k=a.createTexture(),g=V.allocType(5121,36),a.activeTexture(33984),a.bindTexture(34067,k),a.texImage2D(34069,0,6408,3,3,0,6408,5121,g),V.freeType(g),a.bindTexture(34067,null),a.deleteTexture(k),k=!a.getError());return{colorBits:[a.getParameter(3410),a.getParameter(3411),a.getParameter(3412),a.getParameter(3413)],depthBits:a.getParameter(3414),stencilBits:a.getParameter(3415),
  subpixelBits:a.getParameter(3408),extensions:Object.keys(b).filter(function(a){return!!b[a]}),maxAnisotropic:c,maxDrawbuffers:d,maxColorAttachments:f,pointSizeDims:a.getParameter(33901),lineWidthDims:a.getParameter(33902),maxViewportDims:a.getParameter(3386),maxCombinedTextureUnits:a.getParameter(35661),maxCubeMapSize:a.getParameter(34076),maxRenderbufferSize:a.getParameter(34024),maxTextureUnits:a.getParameter(34930),maxTextureSize:a.getParameter(3379),maxAttributes:a.getParameter(34921),maxVertexUniforms:a.getParameter(36347),
  maxVertexTextureUnits:a.getParameter(35660),maxVaryingVectors:a.getParameter(36348),maxFragmentUniforms:a.getParameter(36349),glsl:a.getParameter(35724),renderer:a.getParameter(7937),vendor:a.getParameter(7936),version:a.getParameter(7938),readFloat:e,npotTextureCube:k}},Da=function(a){return Object.keys(a).map(function(b){return a[b]})},Ia={shape:function(a){for(var b=[];a.length;a=a[0])b.push(a.length);return b},flatten:function(a,b,c,d){var f=1;if(b.length)for(var e=0;e<b.length;++e)f*=b[e];else f=
  0;c=d||V.allocType(c,f);switch(b.length){case 0:break;case 1:d=b[0];for(b=0;b<d;++b)c[b]=a[b];break;case 2:d=b[0];b=b[1];for(e=f=0;e<d;++e)for(var g=a[e],k=0;k<b;++k)c[f++]=g[k];break;case 3:fa(a,b[0],b[1],b[2],c,0);break;default:N(a,b,0,c,0)}return c}},Na={"[object Int8Array]":5120,"[object Int16Array]":5122,"[object Int32Array]":5124,"[object Uint8Array]":5121,"[object Uint8ClampedArray]":5121,"[object Uint16Array]":5123,"[object Uint32Array]":5125,"[object Float32Array]":5126,"[object Float64Array]":5121,
  "[object ArrayBuffer]":5121},Fa={int8:5120,int16:5122,int32:5124,uint8:5121,uint16:5123,uint32:5125,float:5126,float32:5126},Oa={dynamic:35048,stream:35040,"static":35044},Va=Ia.flatten,mb=Ia.shape,cb=[];cb[5120]=1;cb[5122]=2;cb[5124]=4;cb[5121]=1;cb[5123]=2;cb[5125]=4;cb[5126]=4;var Bb={points:0,point:0,lines:1,line:1,triangles:4,triangle:4,"line loop":2,"line strip":3,"triangle strip":5,"triangle fan":6},rb=new Float32Array(1),Hb=new Uint32Array(rb.buffer),sb=function(a){return!(a&a-1)&&!!a},Ib=
  [9984,9986,9985,9987],Vb=[0,6409,6410,6407,6408],xa={};xa[6409]=xa[6406]=xa[6402]=1;xa[34041]=xa[6410]=2;xa[6407]=xa[35904]=3;xa[6408]=xa[35906]=4;var ib=ka("HTMLCanvasElement"),tb=ka("CanvasRenderingContext2D"),ub=ka("ImageBitmap"),vb=ka("HTMLImageElement"),wb=ka("HTMLVideoElement"),Jb=Object.keys(Na).concat([ib,tb,ub,vb,wb]),Cb=[];Cb[5121]=1;Cb[5126]=4;Cb[36193]=2;Cb[5123]=2;Cb[5125]=4;var ia=[];ia[32854]=2;ia[32855]=2;ia[36194]=2;ia[34041]=4;ia[33776]=.5;ia[33777]=.5;ia[33778]=1;ia[33779]=1;ia[35986]=
  .5;ia[35987]=1;ia[34798]=1;ia[35840]=.5;ia[35841]=.25;ia[35842]=.5;ia[35843]=.25;ia[36196]=.5;var Aa=[];Aa[32854]=2;Aa[32855]=2;Aa[36194]=2;Aa[33189]=2;Aa[36168]=1;Aa[34041]=4;Aa[35907]=4;Aa[34836]=16;Aa[34842]=8;Aa[34843]=6;var Kb=function(a,b,c,d,f){function e(a){this.id=m++;this.refCount=1;this.renderbuffer=a;this.format=32854;this.height=this.width=0;f.profile&&(this.stats={size:0})}function g(b){var c=b.renderbuffer;u(c,"must not double destroy renderbuffer");a.bindRenderbuffer(36161,null);a.deleteRenderbuffer(c);
  b.renderbuffer=null;b.refCount=0;delete n[b.id];d.renderbufferCount--}var k={rgba4:32854,rgb565:36194,"rgb5 a1":32855,depth:33189,stencil:36168,"depth stencil":34041};b.ext_srgb&&(k.srgba=35907);b.ext_color_buffer_half_float&&(k.rgba16f=34842,k.rgb16f=34843);b.webgl_color_buffer_float&&(k.rgba32f=34836);var l=[];Object.keys(k).forEach(function(a){l[k[a]]=a});var m=0,n={};e.prototype.decRef=function(){0>=--this.refCount&&g(this)};f.profile&&(d.getTotalRenderbufferSize=function(){var a=0;Object.keys(n).forEach(function(b){a+=
  n[b].stats.size});return a});return{create:function(b,g){function m(b,d){var e=0,g=0,n=32854;"object"===("undefined"===typeof b?"undefined":X(b))&&b?("shape"in b?(d=b.shape,u(Array.isArray(d)&&2<=d.length,"invalid renderbuffer shape"),e=d[0]|0,g=d[1]|0):("radius"in b&&(e=g=b.radius|0),"width"in b&&(e=b.width|0),"height"in b&&(g=b.height|0)),"format"in b&&(u.parameter(b.format,k,"invalid renderbuffer format"),n=k[b.format])):"number"===typeof b?(e=b|0,g="number"===typeof d?d|0:e):b?u.raise("invalid arguments to renderbuffer constructor"):
  e=g=1;u(0<e&&0<g&&e<=c.maxRenderbufferSize&&g<=c.maxRenderbufferSize,"invalid renderbuffer size");if(e!==p.width||g!==p.height||n!==p.format)return m.width=p.width=e,m.height=p.height=g,p.format=n,a.bindRenderbuffer(36161,p.renderbuffer),a.renderbufferStorage(36161,n,e,g),u(0===a.getError(),"invalid render buffer format"),f.profile&&(p.stats.size=Aa[p.format]*p.width*p.height),m.format=l[p.format],m}var p=new e(a.createRenderbuffer());n[p.id]=p;d.renderbufferCount++;m(b,g);m.resize=function(b,d){b|=
  0;d=d|0||b;if(b===p.width&&d===p.height)return m;u(0<b&&0<d&&b<=c.maxRenderbufferSize&&d<=c.maxRenderbufferSize,"invalid renderbuffer size");m.width=p.width=b;m.height=p.height=d;a.bindRenderbuffer(36161,p.renderbuffer);a.renderbufferStorage(36161,p.format,b,d);u(0===a.getError(),"invalid render buffer format");f.profile&&(p.stats.size=Aa[p.format]*p.width*p.height);return m};m._reglType="renderbuffer";m._renderbuffer=p;f.profile&&(m.stats=p.stats);m.destroy=function(){p.decRef()};return m},clear:function(){Da(n).forEach(g)},
  restore:function(){Da(n).forEach(function(b){b.renderbuffer=a.createRenderbuffer();a.bindRenderbuffer(36161,b.renderbuffer);a.renderbufferStorage(36161,b.format,b.width,b.height)});a.bindRenderbuffer(36161,null)}}},Lb=[6407,6408],kb=[];kb[6408]=4;kb[6407]=3;var Xb=[];Xb[5121]=1;Xb[5126]=4;Xb[36193]=2;var Mb=[32854,32855,36194,35907,34842,34843,34836],Nb={36053:"complete",36054:"incomplete attachment",36057:"incomplete dimensions",36055:"incomplete, missing attachment",36061:"unsupported"},Gb=["x",
  "y","z","w"],Ob="blend.func blend.equation stencil.func stencil.opFront stencil.opBack sample.coverage viewport scissor.box polygonOffset.offset".split(" "),Ma={0:0,1:1,zero:0,one:1,"src color":768,"one minus src color":769,"src alpha":770,"one minus src alpha":771,"dst color":774,"one minus dst color":775,"dst alpha":772,"one minus dst alpha":773,"constant color":32769,"one minus constant color":32770,"constant alpha":32771,"one minus constant alpha":32772,"src alpha saturate":776},xb="constant color, constant alpha;one minus constant color, constant alpha;constant color, one minus constant alpha;one minus constant color, one minus constant alpha;constant alpha, constant color;constant alpha, one minus constant color;one minus constant alpha, constant color;one minus constant alpha, one minus constant color".split(";"),
  Fb={never:512,less:513,"<":513,equal:514,"=":514,"==":514,"===":514,lequal:515,"<=":515,greater:516,">":516,notequal:517,"!=":517,"!==":517,gequal:518,">=":518,always:519},fb={0:0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},yb={frag:35632,vert:35633},nb={cw:2304,ccw:2305},zb=new za(!1,!1,!1,function(){}),Pb=function(a,b){function c(){this.endQueryIndex=this.startQueryIndex=-1;this.sum=0;this.stats=null}function d(a,b,d){var f=
  g.pop()||new c;f.startQueryIndex=a;f.endQueryIndex=b;f.sum=0;f.stats=d;k.push(f)}if(!b.ext_disjoint_timer_query)return null;var f=[],e=[],g=[],k=[],l=[],m=[];return{beginQuery:function(a){var c=f.pop()||b.ext_disjoint_timer_query.createQueryEXT();b.ext_disjoint_timer_query.beginQueryEXT(35007,c);e.push(c);d(e.length-1,e.length,a)},endQuery:function(){b.ext_disjoint_timer_query.endQueryEXT(35007)},pushScopeStats:d,update:function(){var a;var c=e.length;if(0!==c){m.length=Math.max(m.length,c+1);l.length=
  Math.max(l.length,c+1);l[0]=0;var d=m[0]=0;for(a=c=0;a<e.length;++a){var n=e[a];b.ext_disjoint_timer_query.getQueryObjectEXT(n,34919)?(d+=b.ext_disjoint_timer_query.getQueryObjectEXT(n,34918),f.push(n)):e[c++]=n;l[a+1]=d;m[a+1]=c}e.length=c;for(a=c=0;a<k.length;++a){d=k[a];var p=d.startQueryIndex;n=d.endQueryIndex;d.sum+=l[n]-l[p];p=m[p];n=m[n];n===p?(d.stats.gpuTime+=d.sum/1E6,g.push(d)):(d.startQueryIndex=p,d.endQueryIndex=n,k[c++]=d)}k.length=c}},getNumPendingQueries:function(){return e.length},
  clear:function(){f.push.apply(f,e);for(var a=0;a<f.length;a++)b.ext_disjoint_timer_query.deleteQueryEXT(f[a]);e.length=0;f.length=0},restore:function(){e.length=0;f.length=0}}};return function(a){function b(){if(0===O.length)y&&y.update(),Y=null;else{Y=Qa.next(b);n();for(var a=O.length-1;0<=a;--a){var c=O[a];c&&c(C,null,0)}t.flush();y&&y.update()}}function c(){!Y&&0<O.length&&(Y=Qa.next(b))}function d(){Y&&(Qa.cancel(b),Y=null)}function f(a){a.preventDefault();w=!0;d();V.forEach(function(a){a()})}
  function e(a){t.getError();w=!1;x.restore();K.restore();I.restore();L.restore();Q.restore();P.restore();y&&y.restore();N.procs.refresh();c();Ca.forEach(function(a){a()})}function g(a){function b(a){var b={},c={};Object.keys(a).forEach(function(d){var f=a[d];Ea.isDynamic(f)?c[d]=Ea.unbox(f,d):b[d]=f});return{dynamic:c,static:b}}function c(a){for(;n.length<a;)n.push(null);return n}u(!!a,"invalid args to regl({...})");u.type(a,"object","invalid args to regl({...})");var d=b(a.context||{}),f=b(a.uniforms||
  {}),e=b(a.attributes||{}),g=b(function(a){function b(a){if(a in c){var b=c[a];delete c[a];Object.keys(b).forEach(function(d){c[a+"."+d]=b[d]})}}var c=Z({},a);delete c.uniforms;delete c.attributes;delete c.context;"stencil"in c&&c.stencil.op&&(c.stencil.opBack=c.stencil.opFront=c.stencil.op,delete c.stencil.op);b("blend");b("depth");b("cull");b("stencil");b("polygonOffset");b("scissor");b("sample");return c}(a));a={gpuTime:0,cpuTime:0,count:0};d=N.compile(g,e,f,d,a);var k=d.draw,l=d.batch,m=d.scope,
  n=[];return Z(function(a,b){var d;w&&u.raise("context lost");if("function"===typeof a)return m.call(this,null,a,0);if("function"===typeof b)if("number"===typeof a)for(d=0;d<a;++d)m.call(this,null,b,d);else if(Array.isArray(a))for(d=0;d<a.length;++d)m.call(this,a[d],b,d);else return m.call(this,a,b,0);else if("number"===typeof a){if(0<a)return l.call(this,c(a|0),a|0)}else if(Array.isArray(a)){if(a.length)return l.call(this,a,a.length)}else return k.call(this,a)},{stats:a})}function k(a,b){a=0;N.procs.poll();
  var c=b.color;c&&(t.clearColor(+c[0]||0,+c[1]||0,+c[2]||0,+c[3]||0),a|=16384);"depth"in b&&(t.clearDepth(+b.depth),a|=256);"stencil"in b&&(t.clearStencil(b.stencil|0),a|=1024);u(!!a,"called regl.clear with no buffer specified");t.clear(a)}function l(a){u.type(a,"function","regl.frame() callback must be a function");O.push(a);c();return{cancel:function(){function b(){var a=Xa(O,b);O[a]=O[O.length-1];--O.length;0>=O.length&&d()}var c=Xa(O,a);u(0<=c,"cannot cancel a frame twice");O[c]=b}}}function m(){var a=
  U.viewport,b=U.scissor_box;a[0]=a[1]=b[0]=b[1]=0;C.viewportWidth=C.framebufferWidth=C.drawingBufferWidth=a[2]=b[2]=t.drawingBufferWidth;C.viewportHeight=C.framebufferHeight=C.drawingBufferHeight=a[3]=b[3]=t.drawingBufferHeight}function n(){C.tick+=1;C.time=r();m();N.procs.poll()}function p(){m();N.procs.refresh();y&&y.update()}function r(){return(bb()-G)/1E3}a=S(a);if(!a)return null;var t=a.gl,v=t.getContextAttributes(),w=t.isContextLost(),x=T(t,a);if(!x)return null;var B=M(),z={bufferCount:0,elementsCount:0,
  framebufferCount:0,shaderCount:0,textureCount:0,cubeCount:0,renderbufferCount:0,maxTextureUnits:0},A=x.extensions,y=Pb(t,A),G=bb(),D=t.drawingBufferWidth,H=t.drawingBufferHeight,C={tick:0,time:0,viewportWidth:D,viewportHeight:H,framebufferWidth:D,framebufferHeight:H,drawingBufferWidth:D,drawingBufferHeight:H,pixelRatio:a.pixelRatio},F=ob(t,A);D=Za(t,A,F,B);var I=pa(t,z,a,D),J=ra(t,A,I,z),K=$a(t,B,z,a),L=Ta(t,A,F,function(){N.procs.poll()},C,z,a),Q=Kb(t,A,F,z,a),P=Ua(t,A,F,L,Q,z),N=jb(t,B,A,F,I,J,
  L,P,{},D,K,{elements:null,primitive:4,count:-1,offset:0,instances:-1},C,y,a);B=gb(t,P,N.procs.poll,C,v,A,F);var U=N.next,R=t.canvas,O=[],V=[],Ca=[],aa=[a.onDestroy],Y=null;R&&(R.addEventListener("webglcontextlost",f,!1),R.addEventListener("webglcontextrestored",e,!1));var ba=P.setFBO=g({framebuffer:Ea.define.call(null,1,"framebuffer")});p();v=Z(g,{clear:function(a){u("object"===("undefined"===typeof a?"undefined":X(a))&&a,"regl.clear() takes an object as input");if("framebuffer"in a)if(a.framebuffer&&
  "framebufferCube"===a.framebuffer_reglType)for(var b=0;6>b;++b)ba(Z({framebuffer:a.framebuffer.faces[b]},a),k);else ba(a,k);else k(null,a)},prop:Ea.define.bind(null,1),context:Ea.define.bind(null,2),this:Ea.define.bind(null,3),draw:g({}),buffer:function(a){return I.create(a,34962,!1,!1)},elements:function(a){return J.create(a,!1)},texture:L.create2D,cube:L.createCube,renderbuffer:Q.create,framebuffer:P.create,framebufferCube:P.createCube,attributes:v,frame:l,on:function(a,b){u.type(b,"function","listener callback must be a function");
  switch(a){case "frame":return l(b);case "lost":var c=V;break;case "restore":c=Ca;break;case "destroy":c=aa;break;default:u.raise("invalid event, must be one of frame,lost,restore,destroy")}c.push(b);return{cancel:function(){for(var a=0;a<c.length;++a)if(c[a]===b){c[a]=c[c.length-1];c.pop();break}}}},limits:F,hasExtension:function(a){return 0<=F.extensions.indexOf(a.toLowerCase())},read:B,destroy:function(){O.length=0;d();R&&(R.removeEventListener("webglcontextlost",f),R.removeEventListener("webglcontextrestored",
  e));K.clear();P.clear();Q.clear();L.clear();J.clear();I.clear();y&&y.clear();aa.forEach(function(a){a()})},_gl:t,_refresh:p,poll:function(){n();y&&y.update()},now:r,stats:z});a.onDone(null,v);return v}})});var id=function(c){function d(b,a){y(this,d);b=K(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,a));b.bufferData=[];return b}M(d,c);D(d,[{key:"initialize",value:function(b){this.gl=b;this.program=new S(this.gl,{vertexShader:"uniform mat4 u_matrix;attribute vec3 aPos;attribute vec4 aColor;varying vec4 vColor;void main(){if(aColor.w>=0.0&&aColor.w<=1.0){vColor=aColor;}else{vColor=vec4(aColor.xyz,1.0);}gl_Position=u_matrix*vec4(aPos,1.0);}",
  fragmentShader:"precision highp float;varying vec4 vColor;void main(){gl_FragColor=vColor;}"});this.f32BufferData=new Float32Array;this.buffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,this.buffer)}},{key:"getDefaultOptions",value:function(){return{blend:"lighter",color:"rgb(100,150,150)"}}},{key:"onChanged",value:function(b,a){var c=this.gl;if(c){this.buffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,this.buffer);var d=[];b=b.color;for(var e=0;e<a.length;e++){var l=a[e].geometry.coordinates,
  n=a[e].color||b;"[object Function]"===Object.prototype.toString.call(n)&&(n=n(a[e]));n=this.normizedColor(n);for(var p=0;p<l.length-1;p++){var g=this.normizedPoint(l[p]);d.push(g[0]);d.push(g[1]);d.push(Number(l[p][2]||0));d.push(n[0],n[1],n[2],n[3]);g=this.normizedPoint(l[p+1]);d.push(g[0]);d.push(g[1]);d.push(Number(l[p+1][2]||0));d.push(n[0],n[1],n[2],n[3])}}this.bufferData=d;this.f32BufferData=new Float32Array(d);c.bufferData(c.ARRAY_BUFFER,this.f32BufferData,c.STATIC_DRAW)}}},{key:"render",value:function(b){var a=
  b.gl,c=b.matrix;!this.bufferData||0>=this.bufferData.length||(b=this.program,a.useProgram(b.program),a.uniformMatrix4fv(b.uniforms.u_matrix,!1,c),a.bindBuffer(a.ARRAY_BUFFER,this.buffer),c=this.f32BufferData.BYTES_PER_ELEMENT,a.enableVertexAttribArray(b.attributes.aPos),a.vertexAttribPointer(b.attributes.aPos,3,a.FLOAT,!1,7*c,0),a.enableVertexAttribArray(b.attributes.aColor),a.vertexAttribPointer(b.attributes.aColor,4,a.FLOAT,!1,7*c,3*c),b=this.getOptions().blend,a.enable(a.BLEND),a.enable(a.DEPTH_TEST),
  a.depthFunc(a.LEQUAL),a.blendEquation(a.FUNC_ADD),b&&"lighter"===b?a.blendFunc(a.SRC_ALPHA,a.ONE):a.blendFunc(a.SRC_ALPHA,a.ONE_MINUS_SRC_ALPHA),a.drawArrays(a.LINES,0,this.bufferData.length/7),a.bindBuffer(a.ARRAY_BUFFER,null),a.disable(a.BLEND),a.disable(a.DEPTH_TEST))}}]);return d}(fa),jd=function(){function c(d,b){y(this,c);this.layer=d;this.gl=b;this.initData()}D(c,[{key:"initData",value:function(){this.outWall3d={vertex:[],vertexBuffer:[],index:[],indexBuffer:[]};this.maxLength=0}},{key:"getData",
  value:function(){return this.outWall3d}},{key:"getMaxDataLength",value:function(){return this.maxLength}},{key:"onLayerChange",value:function(c,b){this.initData();var a=c.color,d=c.height,k=c.gradient;c=this.gl;for(var e=0;e<b.length;e++){var l=b[e].geometry.coordinates,n=l.length;this.maxLength=n>this.maxLength?n:this.maxLength;for(var p=[],g=0;g<n;g++){var r=this.layer.normizedPoint(l[g]);p.push(r)}n=b[e].color||a;"properties"in b[e]&&"color"in b[e].properties&&(n=b[e].properties.color);k||"[object Function]"!==
  Object.prototype.toString.call(n)||(n=n(b[e]));l=this.layer.normizedColor(k?k[0]:n);n=this.layer.normizedColor(k?k[1]:n);g=b[e].height||d;"properties"in b[e]&&"height"in b[e].properties&&(g=b[e].properties.height);"[object Function]"===Object.prototype.toString.call(g)&&(g=g(b[e]));this.processData(this.outWall3d,p,l,n,g)}for(b=0;b<this.outWall3d.vertex.length;b++){a=[];d=this.outWall3d.vertex[b].length;for(k=0;k<d;k++)a.push.apply(a,Qa(this.outWall3d.vertex[b][k]));d=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,
  d);c.bufferData(c.ARRAY_BUFFER,new Float32Array(a),c.STATIC_DRAW);this.outWall3d.vertexBuffer[b]=d;c.bindBuffer(c.ARRAY_BUFFER,null);d=c.createBuffer();c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,d);c.bufferData(c.ELEMENT_ARRAY_BUFFER,new Uint16Array(this.outWall3d.index[b]),c.STATIC_DRAW);this.outWall3d.indexBuffer[b]=d;c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,null)}}},{key:"processData",value:function(c,b,a,f,k){var d=c.vertex[c.vertex.length-1],l=c.index[c.index.length-1],n=b.length;if(!d||65536<=d.length+
  2*n+2)d=[],l=[],c.vertex.push(d),c.index.push(l);(c=d.length)&&l.push(c-1,c);for(var p=c=0;p<n;p++){var g=[],r=[],m=b[p];g.push(m[0],m[1]);g.push(m[2]?Number(m[2])+k:k);g.push(m[3]?Number(m[3]):p);g.push(c);g.push(a[0],a[1],a[2],a[3]);r.push(m[0],m[1]);r.push(m[2]?Number(m[2]):0);r.push(m[3]?Number(m[3]):p);r.push(c);r.push(f[0],f[1],f[2],f[3]);m=d.length;d.push(g,r);l.push(m,m+1);p<n-1&&(c+=this.getDistance(b[p],b[p+1]))}}},{key:"getDistance",value:function(c,b){return Math.sqrt(Math.pow(Math.abs(c[0]-
  b[0]),2)+Math.pow(Math.abs(c[1]-b[1]),2))}}]);return c}(),kd=function(c){function d(b,a){y(this,d);b=K(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,a));b.startTime=b.options.startTime||0;b.endTime=b.options.endTime;b.time=b.startTime;b.autoUpdate=!0;return b}M(d,c);D(d,[{key:"getDefaultOptions",value:function(){return{height:100,color:[1,1,1,1],trailLength:3,step:.1}}},{key:"initialize",value:function(b){this.gl=b;this.dataMgr=new jd(this,this.gl);this.program=new S(this.gl,{vertexShader:"uniform mat4 u_matrix;uniform float currentTime;uniform float trailLength;attribute vec4 aPos;attribute float aDistance;attribute vec4 aColor;varying vec4 vColor;varying float vHeight;varying float vTime;varying float vDistance;void main(){vTime=1.0-((currentTime-aPos.w)/trailLength);vHeight=aPos.z;vColor=aColor;vDistance=aDistance;gl_Position=u_matrix*vec4(aPos.xyz,1.0);}",
  fragmentShader:"precision highp float;varying vec4 vColor;varying float vTime;varying float vDistance;varying float vHeight;uniform float currentTime;void main(){if(vTime>1.0||vTime<0.0){}float radius=2.5;float distance=vDistance+currentTime*20.0;float modDistance=mod(distance,9.0);float alpha=1.0;if(modDistance>radius*2.0){discard;}else{float x=abs(modDistance-radius);float y=abs(vHeight-radius);float dis=sqrt(pow(x,2.0)+pow(y,2.0));if(dis>radius){discard;}alpha=dis/radius;}gl_FragColor=vec4(vColor.rgb,1.0-alpha);}"})}},
  {key:"onChanged",value:function(b,a){this.gl&&(this.dataMgr.onLayerChange(b,a),void 0===b.endTime&&(this.endTime=this.dataMgr.getMaxDataLength()))}},{key:"render",value:function(b){var a=b.gl,c=b.matrix;if((b=this.dataMgr.getData())&&!(0>=b.vertex.length)){var d=this.getOptions(),e=this.program;a.useProgram(e.program);a.enable(a.BLEND);a.enable(a.DEPTH_TEST);a.depthFunc(a.LEQUAL);a.blendEquation(a.FUNC_ADD);a.blendFunc(a.SRC_ALPHA,a.ONE_MINUS_SRC_ALPHA);a.enableVertexAttribArray(e.attributes.aPos);
  a.enableVertexAttribArray(e.attributes.aDistance);a.enableVertexAttribArray(e.attributes.aColor);a.uniformMatrix4fv(e.uniforms.u_matrix,!1,c);a.uniform1f(e.uniforms.currentTime,this.time);a.uniform1f(e.uniforms.trailLength,d.trailLength);for(c=0;c<b.vertex.length;c++)if(!(0>=b.vertex[c].length)){var l=b.vertex[c],n=(new Float32Array(l[0])).BYTES_PER_ELEMENT;l=n*l[0].length;a.bindBuffer(a.ARRAY_BUFFER,b.vertexBuffer[c]);a.vertexAttribPointer(e.attributes.aPos,4,a.FLOAT,!1,l,0);a.vertexAttribPointer(e.attributes.aDistance,
  1,a.FLOAT,!1,l,4*n);a.vertexAttribPointer(e.attributes.aColor,4,a.FLOAT,!1,l,5*n);a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,b.indexBuffer[c]);a.drawElements(a.TRIANGLE_STRIP,b.index[c].length,a.UNSIGNED_SHORT,0);a.bindBuffer(a.ARRAY_BUFFER,null);a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,null)}a.disable(a.BLEND);a.disable(a.DEPTH_TEST);this.time+=d.step;this.time>this.endTime&&(this.time=this.startTime);a.useProgram(null)}}}]);return d}(fa),Na,Fa,ld=(Na={},Za(Na,1,1),Za(Na,2,1),Za(Na,3,1),Na),md=(Fa={},Za(Fa,
  1,1),Za(Fa,2,1),Za(Fa,3,1),Fa),Ta=function(c){function d(b,a){y(this,d);b=K(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,a));b.bufferMap={};b.bufferData=[];b.autoUpdate=!0;return b}M(d,c);D(d,[{key:"getDefaultOptions",value:function(){return{color:[1,1,1,.8],speed:1,size:5,pointFade:!0,pointFadeBuffer:1,minLineLength:2,animationType:2,shapeType:2,depthTest:!1}}},{key:"initialize",value:function(b){this.gl=b;var a=this.getOptions();this.updateUniformsFromOptions(a);this.program=new S(this.gl,
  {vertexShader:"precision highp float;attribute vec3 aPos;attribute vec3 aNextPos;attribute float aIndex;attribute float aNextIndex;attribute float aLength;uniform float uSize;uniform mat4 u_matrix;uniform float uElapsedSteps;uniform int uAnimationType;uniform int uPointFade;uniform float uPointFadeBuffer;varying float vAddOpacity;void main(){if(uAnimationType==1){if(abs(aIndex-mod(uElapsedSteps,aLength))>.1){gl_Position=vec4(-2.,-2.,0,1.0);return;}gl_Position=u_matrix*vec4(aPos.xyz,1.0);vAddOpacity=1.;}else if(uAnimationType==2){float lineLength=aLength-1.;float cIndex=mod(uElapsedSteps,lineLength);float rest=cIndex-aIndex;if(rest<1.&&rest>=0.){if(uPointFade==1){if(cIndex<uPointFadeBuffer){vAddOpacity=cIndex/uPointFadeBuffer;}else if(cIndex>lineLength-uPointFadeBuffer){vAddOpacity=(lineLength-cIndex)/uPointFadeBuffer;}else{vAddOpacity=1.;}}else{vAddOpacity=1.;}gl_Position=u_matrix*vec4(aPos.x+(aNextPos.x-aPos.x)*rest,aPos.y+(aNextPos.y-aPos.y)*rest,aPos.z+(aNextPos.z-aPos.z)*rest,1.0);}else{gl_Position=vec4(-2.,-2.,0,1.0);return;}}else if(uAnimationType==3){float percent=mod(uElapsedSteps,aLength)/aLength;if(percent<=aNextIndex&&percent>=aIndex){if(uPointFade==1){float fadePercent=uPointFadeBuffer*1000./aLength;if(percent<fadePercent){vAddOpacity=percent/fadePercent;}else if(percent>1.-fadePercent){vAddOpacity=(1.-percent)/fadePercent;}else{vAddOpacity=1.;}}else{vAddOpacity=1.;}float rest=(percent-aIndex)/(aNextIndex-aIndex);gl_Position=u_matrix*vec4(aPos.x+(aNextPos.x-aPos.x)*rest,aPos.y+(aNextPos.y-aPos.y)*rest,aPos.z+(aNextPos.z-aPos.z)*rest,1.0);}else{gl_Position=vec4(-2.,-2.,0,1.0);return;}}gl_PointSize=uSize;}",
  fragmentShader:"precision highp float;uniform vec4 uColor;uniform int ushapeType;varying float vAddOpacity;void main(){if(ushapeType==2){float d=distance(gl_PointCoord,vec2(0.5,0.5));if(d>0.5){discard;}gl_FragColor=vec4(uColor.rgb,uColor.a*vAddOpacity);}else if(ushapeType==3){float d=distance(gl_PointCoord,vec2(0.5,0.5));if(d>0.5){discard;}gl_FragColor=vec4(uColor.rgb,uColor.a*smoothstep(1.0,0.0,d*2.)*vAddOpacity);}else{gl_FragColor=vec4(uColor.rgb,uColor.a*vAddOpacity);}}"});this.buffer=b.createBuffer();
  b.bindBuffer(b.ARRAY_BUFFER,this.buffer)}},{key:"bindAttributeBufferData",value:function(b,a,c,d){var f=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,f);c=new Float32Array(c);b.bufferData(b.ARRAY_BUFFER,c,b.STATIC_DRAW);this.bufferMap[a]={buffer:f,data:c,elementSize:d}}},{key:"onChanged",value:function(b,a){var c=this.gl;if(c){Array.isArray(a)||(a=[]);this.updateUniformsFromOptions(b);var d=[],e=[],l=[],n=[],p=[];b=b.minLineLength;for(var g=0;g<a.length;g++){var r=a[g].geometry.coordinates,m=r.length;
  if(!(m<b)){for(var t=0;t<m;++t){var v=this.normizedPoint(r[t]);d.push(v[0]);d.push(v[1]);d.push(v[2]||0);3!==this.animationType&&(e.push(t),n.push(m))}if(1!==this.animationType){v=d.length-3*m+3;t=d.length;for(r=v;r<t;++r)p.push(d[r]);d.splice(t-3,3);if(2===this.animationType)e.pop(),n.pop();else if(3===this.animationType){v-=3;t=d.length-3;r=0;m=[];for(var y=v;y<=t;y+=3)v=Math.sqrt(Math.pow(p[y]-d[y],2)+Math.pow(p[y+1]-d[y+1],2)+Math.pow(p[y+2]-d[y+2],2)),r+=v,m.push(v);e.push(0);y=t=0;for(var z=
  m.length-1;y<z;++y)t+=m[y],v=t/r,e.push(v),l.push(v),n.push(r);l.push(1);n.push(r)}}}}this.bindAttributeBufferData(c,"aPos",d,3);this.bindAttributeBufferData(c,"aIndex",e,1);this.bindAttributeBufferData(c,"aLength",n,1);1!==this.animationType&&(this.bindAttributeBufferData(c,"aNextPos",p,3),3===this.animationType&&this.bindAttributeBufferData(c,"aNextIndex",l,1));this.vertCount=d.length/3}}},{key:"updateUniformsFromOptions",value:function(b){this.color=this.normizedColor(b.color);this.startTime=(new Date).getTime();
  ld[b.animationType]||(b.animationType=2);md[b.shapeType]||(b.shapeType=2);if(isNaN(b.minLineLength)||2>b.minLineLength)b.minLineLength=2;this.animationType=b.animationType}},{key:"renderAttributeArr",value:function(b,a,c){if(void 0!==a.attributes[c]){var d=this.bufferMap[c];d&&(b.bindBuffer(b.ARRAY_BUFFER,d.buffer),b.enableVertexAttribArray(a.attributes[c]),b.vertexAttribPointer(a.attributes[c],d.elementSize,b.FLOAT,!1,d.data.BYTES_PER_ELEMENT*d.elementSize,0))}}},{key:"render",value:function(b){var a=
  b.gl;b=b.matrix;if(!(0>=this.vertCount)){var c=this.program;a.useProgram(c.program);this.renderAttributeArr(a,c,"aPos");this.renderAttributeArr(a,c,"aIndex");this.renderAttributeArr(a,c,"aLength");1!==this.animationType&&(this.renderAttributeArr(a,c,"aNextPos"),3===this.animationType&&this.renderAttributeArr(a,c,"aNextIndex"));var d=(new Date).getTime()-this.startTime;d=1===this.animationType?Math.round(d/1E3*this.options.speed*20):3===this.animationType?d/1E3*this.options.speed*1E3:d/1E3*this.options.speed;
  a.uniformMatrix4fv(c.uniforms.u_matrix,!1,b);a.uniform4f(c.uniforms.uColor,this.color[0],this.color[1],this.color[2],this.color[3]);a.uniform1f(c.uniforms.uSize,this.options.size);a.uniform1f(c.uniforms.uElapsedSteps,d);a.uniform1i(c.uniforms.uAnimationType,this.animationType);a.uniform1i(c.uniforms.ushapeType,this.options.shapeType);a.uniform1i(c.uniforms.uPointFade,this.options.pointFade?1:0);a.uniform1f(c.uniforms.uPointFadeBuffer,this.options.pointFadeBuffer);b=this.options.blend;c=this.options.depthTest;
  a.enable(a.BLEND);c&&(a.enable(a.DEPTH_TEST),a.depthFunc(a.LEQUAL));a.blendEquation(a.FUNC_ADD);b&&"lighter"===b?a.blendFunc(a.SRC_ALPHA,a.ONE):a.blendFunc(a.SRC_ALPHA,a.ONE_MINUS_SRC_ALPHA);a.drawArrays(a.POINTS,0,this.vertCount);a.bindBuffer(a.ARRAY_BUFFER,null);a.disable(a.BLEND);a.disable(a.DEPTH_TEST);a.useProgram(null)}}}]);return d}(fa);Ta.ANIMATION_TYPE_LEAP=1;Ta.ANIMATION_TYPE_SMOOTH=2;Ta.ANIMATION_TYPE_UNIFORM_SPEED=3;Ta.SHAPE_TYPE_SQUARE=1;Ta.SHAPE_TYPE_CIRCLE=2;Ta.SHAPE_TYPE_CIRCLE_GRADIENT=
  3;var nd=function(){function c(d,b){y(this,c);this.layer=d;this.gl=b;this.initData()}D(c,[{key:"initData",value:function(){this.outWall3d={vertex:[],vertexBuffer:[],index:[],indexBuffer:[]}}},{key:"getData",value:function(){return this.outWall3d}},{key:"onLayerChange",value:function(c,b){this.initData();for(var a=c.color,d=c.height,k=c.gradient,e=c.enablePreciseMap,l=this.gl,n=0;n<b.length;n++){for(var p=b[n].geometry.coordinates,g=p.length,r=[],m=[],t=0,v=0;v<g;v++){var y=this.layer.normizedPoint(p[v]);
  if(0<v&&e){var z=this.layer.normizedPoint(p[v-1]);t+=Math.sqrt(Math.pow(y[0]-z[0],2),Math.pow(y[1]-z[1],2))}r.push(y);m.push(t)}g=b[n].color||a;"properties"in b[n]&&"color"in b[n].properties&&(g=b[n].properties.color);k||"[object Function]"!==Object.prototype.toString.call(g)||(g=g(b[n]));p=this.layer.normizedColor(k?k[0]:g);g=this.layer.normizedColor(k?k[1]:g);t=b[n].height||d;"properties"in b[n]&&"height"in b[n].properties&&(t=b[n].properties.height);"[object Function]"===Object.prototype.toString.call(t)&&
  (t=t(b[n]));this.processData(this.outWall3d,c,r,m,p,g,t)}for(c=0;c<this.outWall3d.vertex.length;c++){b=[];a=this.outWall3d.vertex[c].length;for(d=0;d<a;d++)b.push.apply(b,Qa(this.outWall3d.vertex[c][d]));a=l.createBuffer();l.bindBuffer(l.ARRAY_BUFFER,a);l.bufferData(l.ARRAY_BUFFER,new Float32Array(b),l.STATIC_DRAW);this.outWall3d.vertexBuffer[c]=a;l.bindBuffer(l.ARRAY_BUFFER,null);a=l.createBuffer();l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,a);l.bufferData(l.ELEMENT_ARRAY_BUFFER,new Uint16Array(this.outWall3d.index[c]),
  l.STATIC_DRAW);this.outWall3d.indexBuffer[c]=a;l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,null)}}},{key:"processData",value:function(c,b,a,f,k,e,l){var d=f[f.length-1],p=c.vertex[c.vertex.length-1],g=c.index[c.index.length-1],r=a.length;if(!p||65536<=p.length+2*r+2)p=[],g=[],c.vertex.push(p),c.index.push(g);(c=p.length)&&g.push(c-1,c);for(c=0;c<r;c++){var m=[],t=[],v=a[c];m.push(v[0],v[1],l);m.push(k[0],k[1],k[2],k[3]);t.push(v[0],v[1],0);t.push(e[0],e[1],e[2],e[3]);b.texture&&(v=f[c],b.enablePreciseMap?
  (m.push(v/d,1),t.push(v/d,0)):(m.push(c/(r-1),1),t.push(c/(r-1),0)));v=p.length;p.push(m,t);g.push(v,v+1)}}}]);return c}(),od=function(c){function d(b,a){y(this,d);return K(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,a))}M(d,c);D(d,[{key:"getDefaultOptions",value:function(){return{texture:null,enablePreciseMap:!1,height:100,color:[1,1,1,1]}}},{key:"initialize",value:function(b){this.gl=b;this.dataMgr=new nd(this,this.gl);this.texture=null;this.isUseTexture=!1;this.vertexLength=10;this.program=
  new S(this.gl,{vertexShader:"uniform mat4 u_matrix;uniform bool uUseTexture;attribute vec3 aPos;attribute vec4 aColor;attribute vec2 aTextureCoords;varying vec2 vTextureCoords;varying vec4 vColor;void main(){if(aColor.w>=0.0&&aColor.w<=1.0){vColor=aColor;}else{vColor=vec4(aColor.xyz,1.0);}if(uUseTexture){vTextureCoords=aTextureCoords;}gl_Position=u_matrix*vec4(aPos,1.0);}",fragmentShader:"precision highp float;uniform bool uUseTexture;uniform sampler2D uSampler;varying vec2 vTextureCoords;varying vec4 vColor;void main(){if(uUseTexture){gl_FragColor=vec4(1.0,1.0,1.0,1.0)*texture2D(uSampler,vTextureCoords);}else{gl_FragColor=vColor;}}"});
  this.loadTexture()}},{key:"onChanged",value:function(b,a){var c=this;this.gl&&(this.loadTextureTime&&clearTimeout(this.loadTextureTime),this.loadTextureTime=setTimeout(function(){c.loadTexture(function(){c.dataMgr.onLayerChange(b,a);c.webglLayer.render()})},0))}},{key:"render",value:function(b){var a=b.gl,c=b.matrix;if((b=this.dataMgr.getData())&&!(0>=b.vertex.length)){var d=this.getOptions(),e=this.program;a.useProgram(e.program);a.enable(a.BLEND);a.enable(a.DEPTH_TEST);a.blendEquation(a.FUNC_ADD);
  a.blendFunc(a.SRC_ALPHA,a.ONE_MINUS_SRC_ALPHA);if(d.texture){if(!this.texture)return;a.activeTexture(a.TEXTURE0);a.bindTexture(a.TEXTURE_2D,this.texture);a.uniform1i(e.uniforms.uSampler,0);a.depthMask(!0);a.depthFunc(a.LESS)}else a.depthMask(!1),a.depthFunc(a.LEQUAL);d.texture?a.enableVertexAttribArray(e.attributes.aTextureCoords):a.disableVertexAttribArray(e.attributes.aTextureCoords);a.enableVertexAttribArray(e.attributes.aPos);a.enableVertexAttribArray(e.attributes.aColor);a.uniformMatrix4fv(e.uniforms.u_matrix,
  !1,c);a.uniform1i(e.uniforms.uUseTexture,this.isUseTexture);for(c=0;c<b.vertex.length;c++)if(!(0>=b.vertex[c].length)){var l=b.vertex[c],n=(new Float32Array(l[0])).BYTES_PER_ELEMENT;l=n*l[0].length;a.bindBuffer(a.ARRAY_BUFFER,b.vertexBuffer[c]);a.vertexAttribPointer(e.attributes.aPos,3,a.FLOAT,!1,l,0);a.vertexAttribPointer(e.attributes.aColor,4,a.FLOAT,!1,l,3*n);d.texture&&a.vertexAttribPointer(e.attributes.aTextureCoords,2,a.FLOAT,!1,l,7*n);a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,b.indexBuffer[c]);a.drawElements(a.TRIANGLE_STRIP,
  b.index[c].length,a.UNSIGNED_SHORT,0);a.bindBuffer(a.ARRAY_BUFFER,null);a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,null)}a.disable(a.BLEND);a.disable(a.DEPTH_TEST);a.useProgram(null)}}},{key:"loadTexture",value:function(b){var a=this,c=this.getOptions();c.texture?(this.isUseTexture=!0,ub(this.gl,c.texture,function(c,d){a.image=d;a.texture=c;b&&b();a.webglLayer.render()})):(this.isUseTexture=!1,this.image=this.texture=null,b&&b())}}]);return d}(fa),pd=function(){function c(d,b){y(this,c);this.layer=d;this.gl=
  b;this.initData()}D(c,[{key:"initData",value:function(){this.outWall3d={vertex:[],vertexBuffer:[],index:[],indexBuffer:[]};this.maxLength=0}},{key:"getData",value:function(){return this.outWall3d}},{key:"getMaxDataLength",value:function(){return this.maxLength}},{key:"onLayerChange",value:function(c,b){this.initData();var a=c.color,d=c.height,k=c.gradient;c=this.gl;for(var e=0;e<b.length;e++){var l=b[e].geometry.coordinates,n=l.length;this.maxLength=n>this.maxLength?n:this.maxLength;for(var p=[],
  g=0;g<n;g++){var r=this.layer.normizedPoint(l[g]);p.push(r)}n=b[e].color||a;"properties"in b[e]&&"color"in b[e].properties&&(n=b[e].properties.color);k||"[object Function]"!==Object.prototype.toString.call(n)||(n=n(b[e]));l=this.layer.normizedColor(k?k[0]:n);n=this.layer.normizedColor(k?k[1]:n);g=b[e].height||d;"properties"in b[e]&&"height"in b[e].properties&&(g=b[e].properties.height);"[object Function]"===Object.prototype.toString.call(g)&&(g=g(b[e]));this.processData(this.outWall3d,p,l,n,g)}for(b=
  0;b<this.outWall3d.vertex.length;b++){a=[];d=this.outWall3d.vertex[b].length;for(k=0;k<d;k++)a.push.apply(a,Qa(this.outWall3d.vertex[b][k]));d=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,d);c.bufferData(c.ARRAY_BUFFER,new Float32Array(a),c.STATIC_DRAW);this.outWall3d.vertexBuffer[b]=d;c.bindBuffer(c.ARRAY_BUFFER,null);d=c.createBuffer();c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,d);c.bufferData(c.ELEMENT_ARRAY_BUFFER,new Uint16Array(this.outWall3d.index[b]),c.STATIC_DRAW);this.outWall3d.indexBuffer[b]=
  d;c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,null)}}},{key:"processData",value:function(c,b,a,f,k){var d=c.vertex[c.vertex.length-1],l=c.index[c.index.length-1],n=b.length;if(!d||65536<=d.length+2*n+2)d=[],l=[],c.vertex.push(d),c.index.push(l);(c=d.length)&&l.push(c-1,c);for(c=0;c<n;c++){var p=[],g=[],r=b[c];p.push(r[0],r[1]);p.push(r[2]?Number(r[2])+k:k);p.push(r[3]?Number(r[3]):c);p.push(a[0],a[1],a[2],a[3]);g.push(r[0],r[1]);g.push(r[2]?Number(r[2]):0);g.push(r[3]?Number(r[3]):c);g.push(f[0],f[1],f[2],
  f[3]);r=d.length;d.push(p,g);l.push(r,r+1)}}}]);return c}(),qd=function(c){function d(b,a){y(this,d);b=K(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,a));b.startTime=b.options.startTime||0;b.endTime=b.options.endTime;b.time=b.startTime;b.autoUpdate=!0;return b}M(d,c);D(d,[{key:"getDefaultOptions",value:function(){return{height:100,color:[1,1,1,1],trailLength:3,step:.1}}},{key:"initialize",value:function(b){this.gl=b;this.dataMgr=new pd(this,this.gl);this.program=new S(this.gl,{vertexShader:"uniform mat4 u_matrix;uniform float currentTime;uniform float trailLength;attribute vec4 aPos;attribute vec4 aColor;varying vec4 vColor;varying float vTime;void main(){vTime=1.0-((currentTime-aPos.w)/trailLength);vColor=aColor;gl_Position=u_matrix*vec4(aPos.xyz,1.0);}",
  fragmentShader:"precision highp float;varying vec4 vColor;varying float vTime;void main(){if(vTime>1.0||vTime<0.0){discard;}gl_FragColor=vec4(vColor.rgb,1.0*vTime);}"})}},{key:"onChanged",value:function(b,a){this.gl&&(this.dataMgr.onLayerChange(b,a),void 0===b.endTime&&(this.endTime=this.dataMgr.getMaxDataLength()))}},{key:"render",value:function(b){var a=b.gl,c=b.matrix;if((b=this.dataMgr.getData())&&!(0>=b.vertex.length)){var d=this.getOptions(),e=this.program;a.useProgram(e.program);a.enable(a.BLEND);
  a.enable(a.DEPTH_TEST);a.depthFunc(a.LEQUAL);a.blendEquation(a.FUNC_ADD);a.blendFunc(a.SRC_ALPHA,a.ONE_MINUS_SRC_ALPHA);a.enableVertexAttribArray(e.attributes.aPos);a.enableVertexAttribArray(e.attributes.aColor);a.uniformMatrix4fv(e.uniforms.u_matrix,!1,c);a.uniform1f(e.uniforms.currentTime,this.time);a.uniform1f(e.uniforms.trailLength,d.trailLength);for(c=0;c<b.vertex.length;c++)if(!(0>=b.vertex[c].length)){var l=b.vertex[c],n=(new Float32Array(l[0])).BYTES_PER_ELEMENT;l=n*l[0].length;a.bindBuffer(a.ARRAY_BUFFER,
  b.vertexBuffer[c]);a.vertexAttribPointer(e.attributes.aPos,4,a.FLOAT,!1,l,0);a.vertexAttribPointer(e.attributes.aColor,4,a.FLOAT,!1,l,4*n);a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,b.indexBuffer[c]);a.drawElements(a.TRIANGLE_STRIP,b.index[c].length,a.UNSIGNED_SHORT,0);a.bindBuffer(a.ARRAY_BUFFER,null);a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,null)}a.disable(a.BLEND);a.disable(a.DEPTH_TEST);this.time+=d.step;this.time>this.endTime&&(this.time=this.startTime);a.useProgram(null)}}}]);return d}(fa),rd=function(c){function d(b,
  a){y(this,d);b=K(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,a));b.simpleLineLayer=new wc(b.getHeatOptions());b.children=[b.simpleLineLayer];return b}M(d,c);D(d,[{key:"getDefaultOptions",value:function(){return{blend:"normal",gradient:{0:"rgb(50, 50, 256)","0.1":"rgb(50, 250, 56)","0.5":"rgb(250, 250, 56)",1:"rgb(250, 50, 56)"}}}},{key:"onDataChanged",value:function(b){this.simpleLineLayer.setData(b)}},{key:"onOptionsChanged",value:function(b){this.simpleLineLayer.setOptions(this.getHeatOptions())}},
  {key:"getHeatOptions",value:function(){var b=this.getOptions(),a=b.max,c=b.min;void 0===a&&(c=this.getDataRange(),a=c.max,c=c.min);var d=new O({max:a,min:c,gradient:b.gradient});b.color=function(a){var b=~~a.count||1;"properties"in a&&"count"in a.properties&&(b=~~a.properties.count);a=d.getImageData(b);return[a[0]/255,a[1]/255,a[2]/255,a[3]/255]};return b}},{key:"getDataRange",value:function(){var b=this.getData(),a=0,c=0;b[0]&&(a=~~b[0].count||1,c=~~b[0].count||1);"properties"in b[0]&&"count"in b[0].properties&&
  (a=~~b[0].properties.count,c=~~b[0].properties.count);for(var d=b.length,e=0;e<d;e++){var l=~~b[e].count||1;"properties"in b[e]&&"count"in b[e].properties&&(l=~~b[e].properties.count);a=Math.max(l,a);c=Math.min(l,c)}return{max:a/2,min:c}}}]);return d}(vc),zc={circle:1,square:2},Ac=function(c){function d(b){y(this,d);b=K(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b));b.bufferData=[];return b}M(d,c);D(d,[{key:"getDefaultOptions",value:function(){return{color:[.1,.1,.9,1],blend:"normal",
  shape:"circle",size:5}}},{key:"initialize",value:function(b){this.gl=b;this.program=new S(this.gl,{vertexShader:"attribute vec3 aPos;attribute vec4 aColor;attribute float aSize;uniform mat4 u_matrix;varying vec4 vColor;void main(void){if(aColor.w>=0.0&&aColor.w<=1.0){vColor=aColor;}else{vColor=vec4(aColor.xyz,1.0);}gl_Position=u_matrix*vec4(aPos.xyz,1.0);gl_PointSize=aSize;}",fragmentShader:"precision highp float;varying vec4 vColor;uniform int uShape;void main(void){if(uShape==1){float d=distance(gl_PointCoord,vec2(0.5,0.5));if(d<0.5){gl_FragColor=vColor;}else{discard;}}else{gl_FragColor=vColor;}}"},
  this);this.f32BufferData=new Float32Array;this.buffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,this.buffer)}},{key:"onChanged",value:function(b,a){var c=this.gl;if(c){this.buffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,this.buffer);var d=[],e=b.color;b=b.size;for(var l=0;l<a.length;l++){var n=a[l].geometry.coordinates,p=a[l].color||e;"properties"in a[l]&&"color"in a[l].properties&&(p=a[l].properties.color);"[object Function]"===Object.prototype.toString.call(p)&&(p=p(a[l]));p=this.normizedColor(p);
  n=this.normizedPoint(n);var g=b;g="[object Function]"===Object.prototype.toString.call(g)?g(a[l]):Number(g);d.push(n[0],n[1],Number(n[2]||0));d.push(p[0],p[1],p[2],p[3]);d.push(g*window.devicePixelRatio)}this.bufferData=d;this.f32BufferData=new Float32Array(d);c.bufferData(c.ARRAY_BUFFER,this.f32BufferData,c.STATIC_DRAW)}}},{key:"destroy",value:function(){this.buffer=this.program=this.f32BufferData=this.bufferData=null}},{key:"render",value:function(b){var a=b.gl,c=b.matrix;0>=this.bufferData.length||
  (b=this.program,b.use(a),a.uniformMatrix4fv(b.uniforms.u_matrix,!1,c),a.bindBuffer(a.ARRAY_BUFFER,this.buffer),c=this.f32BufferData.BYTES_PER_ELEMENT,a.enableVertexAttribArray(b.attributes.aPos),a.vertexAttribPointer(b.attributes.aPos,3,a.FLOAT,!1,8*c,0),a.enableVertexAttribArray(b.attributes.aColor),a.vertexAttribPointer(b.attributes.aColor,4,a.FLOAT,!1,8*c,3*c),a.enableVertexAttribArray(b.attributes.aSize),a.vertexAttribPointer(b.attributes.aSize,1,a.FLOAT,!1,8*c,7*c),c=1,this.options.shape&&zc[this.options.shape]&&
  (c=zc[this.options.shape]),a.uniform1i(b.uniforms.uShape,c),b=this.options.blend,a.enable(a.BLEND),a.enable(a.DEPTH_TEST),a.depthFunc(a.LEQUAL),a.blendEquation(a.FUNC_ADD),b&&"lighter"===b?a.blendFunc(a.SRC_ALPHA,a.ONE):a.blendFunc(a.SRC_ALPHA,a.ONE_MINUS_SRC_ALPHA),a.drawArrays(a.POINTS,0,this.bufferData.length/8),a.bindBuffer(a.ARRAY_BUFFER,null),a.disable(a.BLEND),a.disable(a.DEPTH_TEST),a.useProgram(null))}}]);return d}(fa),sd=function(c){function d(b,a){y(this,d);b=K(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,
  b,a));b.bufferDataArr=[];b.indexDataArr=[];b.vertexBuffer=[];b.indexBuffer=[];b.position=[];b.opacity=1;b.currentScale=1;b.autoUpdate=!0;return b}M(d,c);D(d,[{key:"getDefaultOptions",value:function(){return{color:[.1,.1,.9,1],size:5,segs:32,scale:2,unit:"m",step:.1}}},{key:"initialize",value:function(b){this.gl=b;this.program=new S(this.gl,{vertexShader:"uniform mat4 u_projectionMatrix;uniform mat4 u_modelViewMatrix;uniform mat4 u_modelMatrix;uniform float u_opacity;attribute vec4 aPos;attribute vec4 aColor;varying vec4 vColor;void main(){vColor=aColor;vColor.a=u_opacity;gl_Position=u_projectionMatrix*u_modelViewMatrix*u_modelMatrix*vec4(aPos.xyz,1.0);}",
  fragmentShader:"precision highp float;varying vec4 vColor;void main(){gl_FragColor=vColor;}"})}},{key:"onChanged",value:function(b,a){var c=this.gl;if(c&&(this.currentScale=this.opacity=1,(this.data=a)&&a.length)){var d=b.color,e=b.segs;b=b.size;for(var l=360/e,n=0;n<a.length;n++){var p=[],g=[],r=this.normizedPoint(a[n].geometry.coordinates),m=a[n].color||d;"properties"in a[n]&&"color"in a[n].properties&&(m=a[n].properties.color);m=this.normizedColor(m);var t="[object Function]"===Object.prototype.toString.call(b)?
  b(a[n]):Number(b);var v=r[0],y=r[1];p.push(0,0,-.5);p.push(m[0],m[1],m[2],0);for(var z=1,w=0;z<=e;z++,w+=l)p.push(r[0]-v+Math.cos(Math.PI/180*w)*t,r[1]-y+Math.sin(Math.PI/180*w)*t,-.5),p.push(m[0],m[1],m[2],this.opacity),z===e?g.push(0,0+z,1):g.push(0,0+z,0+z+1);m=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,m);c.bufferData(c.ARRAY_BUFFER,new Float32Array(p),c.STATIC_DRAW);this.vertexBuffer[n]=m;this.bufferDataArr[n]=p;c.bindBuffer(c.ARRAY_BUFFER,null);p=c.createBuffer();c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,
  p);c.bufferData(c.ELEMENT_ARRAY_BUFFER,new Uint16Array(g),c.STATIC_DRAW);this.indexBuffer[n]=p;this.indexDataArr[n]=g;c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,null);this.position[n]=[r[0],r[1]]}this.webglLayer&&this.webglLayer.render()}}},{key:"render",value:function(b){var a=b.gl,c=b.projectionMatrix,d=b.viewMatrix;b=this.program;a.useProgram(b.program);a.enable(a.DEPTH_TEST);a.enable(a.POLYGON_OFFSET_FILL);a.polygonOffset(-1,-1);a.depthFunc(a.LEQUAL);a.uniformMatrix4fv(b.uniforms.u_projectionMatrix,
  !1,c);a.uniformMatrix4fv(b.uniforms.u_modelViewMatrix,!1,d);c=this.opacity;void 0!==this.options.opacity&&(c=this.options.opacity);a.uniform1f(b.uniforms.u_opacity,c);a.enable(a.BLEND);a.blendFunc(a.SRC_ALPHA,a.DST_ALPHA);a.blendEquation(a.FUNC_ADD);a.enableVertexAttribArray(b.attributes.aPos);a.enableVertexAttribArray(b.attributes.aColor);for(c=0;c<this.bufferDataArr.length;c++)if(!(0>=this.bufferDataArr[c].length)){d=(new Float32Array(this.bufferDataArr[c])).BYTES_PER_ELEMENT;a.bindBuffer(a.ARRAY_BUFFER,
  this.vertexBuffer[c]);a.vertexAttribPointer(b.attributes.aColor,4,a.FLOAT,!1,7*d,3*d);a.vertexAttribPointer(b.attributes.aPos,3,a.FLOAT,!1,7*d,0);d=this.position[c];var e=T.create(),l=[this.currentScale,this.currentScale,this.currentScale];"px"===this.options.unit&&this.map&&(l=this.map.getZoomUnits(),l=[this.currentScale*l,this.currentScale*l,this.currentScale]);T.identity(e);T.translate(e,e,[d[0],d[1],0]);T.scale(e,e,l);a.uniformMatrix4fv(b.uniforms.u_modelMatrix,!1,e);a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,
  this.indexBuffer[c]);a.drawElements(a.TRIANGLES,this.indexDataArr[c].length,a.UNSIGNED_SHORT,0);a.bindBuffer(a.ARRAY_BUFFER,null);a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,null)}a.disable(a.BLEND);a.disable(a.DEPTH_TEST);a.disable(a.POLYGON_OFFSET_FILL);c=this.getOptions();b=c.scale;c=c.step;this.opacity-=c/10;this.currentScale+=b*c;0>this.opacity&&(this.currentScale=this.opacity=1);a.useProgram(null)}}]);return d}(fa),td=function(c){function d(b,a){y(this,d);b=K(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,
  b,a));b.bufferData=[];b.startTime=b.options.startTime||0;b.endTime=b.options.endTime;b.time=b.startTime;b.segs=b.options.segs||10;b.autoUpdate=!0;return b}M(d,c);D(d,[{key:"getDefaultOptions",value:function(){return{color:[.9,.1,.1,1],trailLength:3,height:100,step:.1,segs:10}}},{key:"setTime",value:function(b){this.time=b}},{key:"initialize",value:function(b){this.gl=b;this.program=new S(this.gl,{vertexShader:"precision mediump float;attribute vec4 aPos;uniform mat4 u_matrix;uniform float currentTime;uniform float trailLength;varying float vTime;void main(){gl_Position=u_matrix*vec4(aPos.xyz,1.0);vTime=1.0-((currentTime-aPos.w)/trailLength);}",
  fragmentShader:"precision mediump float;uniform vec3 uFragColor;varying float vTime;void main(){if(vTime>1.0||vTime<0.0){discard;}gl_FragColor=vec4(uFragColor,1.0*vTime);}"});this.buffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,this.buffer)}},{key:"onChanged",value:function(b,a){var c=this.gl;if(c){this.buffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,this.buffer);for(var d=[],e=b.height,l=0;l<a.length;l++){var n=a[l].geometry.coordinates;var p="[object Function]"===Object.prototype.toString.call(e)?
  e(a[l]):Number(e);for(var g=0,r=0;r<this.segs;r++){var m=this.normizedPoint(n);d.push(m[0],m[1],g);void 0===n[2]?d.push(r):d.push(Number(n[2]));g+=p/this.segs;d.push(m[0],m[1],g);void 0===n[2]?d.push(r+1):d.push(Number(n[2]))}}void 0===b.endTime&&(this.endTime=this.segs);this.bufferData=d;c.bufferData(c.ARRAY_BUFFER,new Float32Array(d),c.STATIC_DRAW);this.webglLayer&&this.webglLayer.render()}}},{key:"render",value:function(b){var a=b.gl,c=b.matrix;b=this.program;a.useProgram(b.program);a.uniformMatrix4fv(b.uniforms.u_matrix,
  !1,c);a.bindBuffer(a.ARRAY_BUFFER,this.buffer);a.enableVertexAttribArray(b.attributes.aPos);a.vertexAttribPointer(b.attributes.aPos,4,a.FLOAT,!1,0,0);c=this.normizedColor(this.options.color);a.uniform3f(b.uniforms.uFragColor,c[0],c[1],c[2]);a.uniform1f(b.uniforms.currentTime,this.time);a.uniform1f(b.uniforms.trailLength,this.options.trailLength);a.enable(a.BLEND);a.enable(a.POLYGON_OFFSET_FILL);a.enable(a.DEPTH_TEST);a.depthFunc(a.LEQUAL);a.polygonOffset(2,1);a.blendFunc(a.SRC_ALPHA,a.ONE);a.blendEquation(a.FUNC_ADD);
  a.drawArrays(a.LINES,0,this.bufferData.length/4);a.bindBuffer(a.ARRAY_BUFFER,null);a.disable(a.BLEND);a.disable(a.DEPTH_TEST);a.disable(a.POLYGON_OFFSET_FILL);this.time+=this.options.step;this.time>1.5*this.endTime&&(this.time=this.startTime);a.useProgram(null)}}]);return d}(fa),ud=function(c){function d(b,a){y(this,d);return K(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,a))}M(d,c);D(d,[{key:"getDefaultOptions",value:function(){return{style:"grid",gridSize:500,gradient:{0:"rgb(50, 50, 256)",
  "0.1":"rgb(50, 250, 56)","0.5":"rgb(250, 250, 56)",1:"rgb(250, 50, 56)"}}}},{key:"onChanged",value:function(b,a){this.gl&&(a=this.processData(a,b),mb(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"onChanged",this).call(this,b,a))}},{key:"generateGrid",value:function(b,a){var c=a.gridSize,d=[],e={};a=b.length;for(var l=this.getPointOffset(),n=0;n<a;n++){var p=this.normizedPoint(b[n].geometry.coordinates);p=~~((p[0]+l[0])/c)+"_"+~~((p[1]+l[1])/c);void 0===e[p]&&(e[p]=0);var g=~~b[n].count||
  1;"properties"in b[n]&&"count"in b[n].properties&&(g=~~b[n].properties.count);e[p]+=g}Object.keys(e).forEach(function(a){var b=a.split("_");d.push([b[0]*c+c/2,b[1]*c+c/2,e[a]])});return d}},{key:"processData",value:function(b,a){var c=[];if("normal"===a.style)for(var d=this.getPointOffset(),e=0;e<b.length;e++){var l=this.normizedPoint(b[e].geometry.coordinates);c.push([l[0]+d[0],l[1]+d[1],~~b[e].count||1])}else c=this.generateGrid(b,a);d=b=0;if(void 0!==a.max&&void 0!==a.min)b=a.max,d=a.min;else{c[0]&&
  (b=c[0][2],d=c[0][2]);e=c.length;for(l=0;l<e;l++){var n=c[l];b=Math.max(n[2],b);d=Math.min(n[2],d)}b/=2}a=new O({max:~~b,min:d,gradient:a.gradient});b=[];for(d=0;d<c.length;d++)e=c[d],e[0]=e[0],e[1]=e[1],l=a.getImageData(e[2]),b.push({geometry:{type:"Point",coordinates:[e[0],e[1]]},color:[l[0]/255,l[1]/255,l[2]/255,l[3]/255]});return b}}]);return d}(Ac),vd=function(c){function d(b,a){y(this,d);b=K(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,a));b.bufferData=[];return b}M(d,c);D(d,[{key:"getDefaultOptions",
  value:function(){return{color:[1,.05,.05,1]}}},{key:"onChanged",value:function(b,a){if(b=this.gl){this.buffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,this.buffer);for(var c=[],d=0;20>d;d++)for(var e=5*d,l=0;l<a.length;l++)for(var n=a[l].geometry.coordinates,p=0;p<n.length-1;p++){var g=this.normizedPoint(n[p]);c.push(g[0]);c.push(g[1]);c.push(Number(e));g=this.normizedPoint(n[p+1]);c.push(g[0]);c.push(g[1]);c.push(Number(e))}b.bufferData(b.ARRAY_BUFFER,new Float32Array(c),b.STATIC_DRAW);this.bufferData=
  c;b.bindBuffer(b.ARRAY_BUFFER,null)}}},{key:"initialize",value:function(b){this.gl=b;this.program=new S(b,{vertexShader:"uniform mat4 uMatrix;attribute vec3 aPos;void main(){gl_PointSize=10.0;gl_Position=uMatrix*vec4(aPos,1.0);}",fragmentShader:"precision mediump float;uniform vec4 uFragColor;void main(){gl_FragColor=uFragColor;}"});this.buffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,this.buffer)}},{key:"render",value:function(b){var a=b.gl;b=b.matrix;var c=this.program;a.useProgram(c.program);
  var d=this.normizedColor(this.options.color);a.uniform4f(c.uniforms.uFragColor,d[0],d[1],d[2],d[3]);a.enable(a.DEPTH_TEST);a.uniformMatrix4fv(c.uniforms.uMatrix,!1,b);a.bindBuffer(a.ARRAY_BUFFER,this.buffer);a.enableVertexAttribArray(c.attributes.aPos);a.vertexAttribPointer(c.attributes.aPos,3,a.FLOAT,!1,0,0);a.enable(a.BLEND);a.blendEquation(a.FUNC_ADD);a.blendFunc(a.ONE,a.ONE);a.drawArrays(a.LINES,0,this.bufferData.length/3);a.bindBuffer(a.ARRAY_BUFFER,null);a.disable(a.DEPTH_TEST)}}]);return d}(fa),
  Bc={circle:1,square:2},wd=function(c){function d(b,a){y(this,d);b=K(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,a));b.bufferData=[];b.startTime=b.options.startTime||0;b.endTime=b.options.endTime;b.time=b.startTime;b.autoUpdate=!0;return b}M(d,c);D(d,[{key:"initialize",value:function(b){this.gl=b;this.program=new S(this.gl,{vertexShader:"attribute vec4 aPos;attribute vec4 aColor;attribute float aSize;uniform mat4 u_matrix;varying vec4 vColor;uniform float currentTime;uniform float trailLength;varying float vTime;void main(void){if(aColor.w>=0.0&&aColor.w<=1.0){vColor=aColor;}else{vColor=vec4(aColor.xyz,1.0);}gl_Position=u_matrix*vec4(aPos.xyz,1.0);gl_PointSize=aSize;vTime=1.0-((currentTime-aPos.w)/trailLength);}",
  fragmentShader:"precision highp float;varying vec4 vColor;uniform int uShape;varying float vTime;void main(void){if(vTime>1.0||vTime<0.0){discard;}if(uShape==1){float d=distance(gl_PointCoord,vec2(0.5,0.5));if(d<0.5){gl_FragColor=vColor;}else{discard;}}else{gl_FragColor=vec4(vColor.rgb,vColor.a*vTime);}}"});this.f32BufferData=new Float32Array;this.buffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,this.buffer)}},{key:"onChanged",value:function(b,a){var c=this.gl;if(c){this.buffer=c.createBuffer();
  c.bindBuffer(c.ARRAY_BUFFER,this.buffer);for(var d=[],e=b.color||[.1,.1,.9,1],l=b.size||5,n=0;n<a.length;n++){var p=a[n].geometry.coordinates,g=a[n].color||e;"[object Function]"===Object.prototype.toString.call(g)&&(g=g(a[n]));"properties"in a[n]&&"color"in a[n].properties&&(g=a[n].properties.color);g=this.normizedColor(g);var r=this.normizedPoint(p),m=l;m="[object Function]"===Object.prototype.toString.call(m)?m(a[n]):Number(m);var t=a[n].time||n;"properties"in a[n]&&"time"in a[n].properties&&(t=
  a[n].properties.time);d.push(r[0],r[1],Number(p[2]||0),t);d.push(g[0],g[1],g[2],g[3]);d.push(m*window.devicePixelRatio)}void 0===b.endTime&&(this.endTime=a.length);this.bufferData=d;this.f32BufferData=new Float32Array(d);c.bufferData(c.ARRAY_BUFFER,this.f32BufferData,c.STATIC_DRAW)}}},{key:"render",value:function(b){var a=b.gl,c=b.matrix;0>=this.bufferData.length||(b=this.program,a.useProgram(b.program),a.uniformMatrix4fv(b.uniforms.u_matrix,!1,c),a.bindBuffer(a.ARRAY_BUFFER,this.buffer),c=this.f32BufferData.BYTES_PER_ELEMENT,
  a.enableVertexAttribArray(b.attributes.aPos),a.vertexAttribPointer(b.attributes.aPos,4,a.FLOAT,!1,9*c,0),a.enableVertexAttribArray(b.attributes.aColor),a.vertexAttribPointer(b.attributes.aColor,4,a.FLOAT,!1,9*c,4*c),a.enableVertexAttribArray(b.attributes.aSize),a.vertexAttribPointer(b.attributes.aSize,1,a.FLOAT,!1,9*c,8*c),a.uniform1f(b.uniforms.currentTime,this.time),a.uniform1f(b.uniforms.trailLength,this.options.trailLength||3),c=1,this.options.shape&&Bc[this.options.shape]&&(c=Bc[this.options.shape]),
  a.uniform1i(b.uniforms.uShape,c),b=this.options.blend,a.enable(a.BLEND),a.enable(a.DEPTH_TEST),a.depthFunc(a.LEQUAL),a.blendEquation(a.FUNC_ADD),b&&"lighter"===b?a.blendFunc(a.SRC_ALPHA,a.ONE):a.blendFunc(a.SRC_ALPHA,a.ONE_MINUS_SRC_ALPHA),a.drawArrays(a.POINTS,0,this.bufferData.length/9),a.bindBuffer(a.ARRAY_BUFFER,null),a.disable(a.BLEND),a.disable(a.DEPTH_TEST),a.useProgram(null),this.time+=this.options.step||.1,this.time>this.endTime&&(this.time=this.startTime))}}]);return d}(fa),xd=function(c){function d(b,
  a){y(this,d);b=K(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,a));b.bufferData=[];b.startTime=b.options.startTime||0;b.endTime=b.options.endTime;b.time=b.startTime;b.autoUpdate=!0;return b}M(d,c);D(d,[{key:"getDefaultOptions",value:function(){return{color:[1,.05,.05,1],trailLength:3,step:.1}}},{key:"initialize",value:function(b){this.gl=b;this.program=new S(this.gl,{vertexShader:"precision highp float;attribute vec4 aPos;attribute vec4 aColor;uniform mat4 u_matrix;uniform float currentTime;uniform float trailLength;varying float vTime;varying vec4 vColor;void main(){gl_Position=u_matrix*vec4(aPos.xyz,1.0);vColor=aColor;vTime=1.0-((currentTime-aPos.w)/trailLength);}",
  fragmentShader:"precision highp float;uniform vec3 uFragColor;varying vec4 vColor;varying float vTime;void main(){if(vTime>1.0||vTime<0.0){discard;}gl_FragColor=vec4(vColor.rgb,1.0*vTime);}"},this);this.buffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,this.buffer)}},{key:"setTime",value:function(b){this.time=b}},{key:"onChanged",value:function(b,a){var c=this.gl;if(c){this.buffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,this.buffer);for(var d=[],e=0,l=this.options.color,n=0;n<a.length;n++){var p=
  a[n].geometry.coordinates;a[n].color&&(l=a[n].color);"properties"in a[n]&&"color"in a[n].properties&&(l=a[n].properties.color);"[object Function]"===Object.prototype.toString.call(l)&&(l=l(a[n]));l=this.normizedColor(l);p.length>e&&(e=p.length);for(var g=0;g<p.length-1;g++){var r=this.normizedPoint(p[g]);d.push(r[0]);d.push(r[1]);d.push(r[2]);void 0===p[g][3]?d.push(g):d.push(Number(p[g][3]));d.push(l[0]);d.push(l[1]);d.push(l[2]);d.push(l[3]);r=this.normizedPoint(p[g+1]);d.push(r[0]);d.push(r[1]);
  d.push(r[2]);void 0===p[g+1][3]?d.push(g+1):d.push(Number(p[g+1][3]));d.push(l[0]);d.push(l[1]);d.push(l[2]);d.push(l[3])}}void 0===b.endTime&&(this.endTime=e);this.bufferData=d;this.f32BufferData=new Float32Array(d);c.bufferData(c.ARRAY_BUFFER,this.f32BufferData,c.STATIC_DRAW)}}},{key:"render",value:function(b){var a=b.gl,c=b.matrix;b=this.program;b.use(a);a.uniformMatrix4fv(b.uniforms.u_matrix,!1,c);a.bindBuffer(a.ARRAY_BUFFER,this.buffer);c=this.f32BufferData.BYTES_PER_ELEMENT;a.enableVertexAttribArray(b.attributes.aPos);
  a.vertexAttribPointer(b.attributes.aPos,4,a.FLOAT,!1,8*c,0);a.enableVertexAttribArray(b.attributes.aColor);a.vertexAttribPointer(b.attributes.aColor,4,a.FLOAT,!1,8*c,4*c);c=this.normizedColor(this.options.color);a.uniform3f(b.uniforms.uFragColor,c[0],c[1],c[2]);a.uniform1f(b.uniforms.currentTime,this.time);a.uniform1f(b.uniforms.trailLength,this.options.trailLength);a.enable(a.BLEND);a.enable(a.POLYGON_OFFSET_FILL);a.enable(a.DEPTH_TEST);a.depthFunc(a.LEQUAL);a.polygonOffset(2,1);"lighter"===this.options.blend?
  a.blendFunc(a.ONE,a.ONE):a.blendFunc(a.SRC_ALPHA,a.ONE);a.blendEquation(a.FUNC_ADD);a.drawArrays(a.LINES,0,this.bufferData.length/8);a.bindBuffer(a.ARRAY_BUFFER,null);a.disable(a.BLEND);a.disable(a.DEPTH_TEST);this.time+=this.options.step;this.time>this.endTime&&(this.time=this.startTime);a.useProgram(null)}}]);return d}(fa);v.HeatmapLayer=dd;"OffscreenCanvas"in window&&(v.HeatmapLayer=fd);var yd=function(){function c(d){var b=this;y(this,c);this.options={autoUpdate:!0};Object.assign(this.options,
  d);this.layers=[];var a=d.pointOffset;this.webglLayer=d.webglLayer||new pc(d.map,this.options);this.effectManager=new oc(this.webglLayer.gl);this.webglRender={render:function(){}};this.options.effects&&this.effectManager.setEffects([this.webglRender].concat(this.options.effects));this.webglLayer.onRender(function(a){b._render(a)});a||"cesium"===this.webglLayer.options.mapType||(a=this.webglLayer.map.getCenter(),this.webglLayer.options.pointOffset=[a.lng,a.lat]);this.webglLayer.map.onResize(function(){b.effectManager.initFbo()});
  if(this.postProcessing=d.postProcessing)this.postProcessing.setWebglLayer(this.webglLayer),d=this.postProcessing.getThreeLayer(),this.addLayer(d),this.postProcessing.initialize(d),d.postProcessing=this.postProcessing}D(c,[{key:"renderCanvas",value:function(c){var b=this;this.postProcessing?(this.postProcessing.addRender(function(){b.renderGLLayers(c)}),this.renderThreeLayers(c),this.renderThreeLayer(c)):(this.renderThreeLayers(c),this.renderThreeLayer(c),this.renderGLLayers(c))}},{key:"renderGLLayers",
  value:function(c){for(var b=0;b<this.layers.length;b++){var a=this.layers[b];"threeLayer"!==a.layerType&&"ThreeLayer"!==a.layerType&&(this.beforeRender(c),c.gl.enable(c.gl.DEPTH_TEST),c.gl.disable(c.gl.BLEND),a.render(c),this.afterRender(c))}}},{key:"renderThreeLayer",value:function(c){for(var b=0;b<this.layers.length;b++){var a=this.layers[b];"ThreeLayer"===a.layerType&&a.render(c)}}},{key:"renderThreeLayers",value:function(c){for(var b=0;b<this.layers.length;b++){var a=this.layers[b];"threeLayer"===
  a.layerType&&(this.beforeRender(c),a.render(c),this.afterRender(c))}}},{key:"beforeRender",value:function(c,b){if(c=c.gl)this.preBlendState=c.isEnabled(c.BLEND),this.preDepthState=c.isEnabled(c.DEPTH_TEST),this.preCullFaceState=c.isEnabled(c.CULL_FACE),c.enable(c.BLEND)}},{key:"afterRender",value:function(c){if(c=c.gl)!1===this.preBlendState?c.disable(c.BLEND):c.enable(c.BLEND),!1===this.preDepthState?c.disable(c.DEPTH_TEST):c.enable(c.DEPTH_TEST),!1===this.preCullFaceState?c.disable(c.CULL_FACE):
  c.enable(c.CULL_FACE)}},{key:"render",value:function(){this.webglLayer.render()}},{key:"_render",value:function(c){var b=this,a=this.options.effects;a&&0<a.length?(this.webglRender.render=function(){b.renderCanvas(c)},this.effectManager.render()):this.renderCanvas(c)}},{key:"addLayer",value:function(c){for(var b=!1,a=0;a<this.layers.length;a++)if(this.layers[a]===c){b=!0;break}b||(c.map=this.webglLayer.map,"threeLayer"===c.layerType?(c.setWebglLayer(this.webglLayer),b=c.getThreeLayer(),this.addLayer(b),
  c.initialize&&c.initialize(b)):(c.setWebglLayer(this.webglLayer),c.initialize&&c.initialize(this.webglLayer.gl),c.onOptionsChanged(c.getOptions()),c.onDataChanged(c.getData()),c.onChanged(c.getOptions(),c.getData())),this.layers.push(c));this.options.autoUpdate&&(this.isRequestAnimation()?this.webglLayer.startAnimation():this.webglLayer.stopAnimation());this.webglLayer.render()}},{key:"removeLayer",value:function(c){for(var b=0;b<this.layers.length;b++)this.layers[b]===c&&(c.destroy&&c.destroy(),
  this.layers.splice(b,1));this.options.autoUpdate&&(this.isRequestAnimation()?this.webglLayer.startAnimation():this.webglLayer.stopAnimation());this.webglLayer.render()}},{key:"onRender",value:function(c){this.webglLayer.onRender(c)}},{key:"removeAllLayers",value:function(){for(var c=0;c<this.layers.length;c++){var b=this.layers[c];b.destroy&&b.destroy();this.layers.splice(c,1)}this.webglLayer.render()}},{key:"destroy",value:function(){this.stopAnimation();this.removeAllLayers();this.webglLayer.destroy()}},
  {key:"isRequestAnimation",value:function(){for(var c=!1,b=0;b<this.layers.length;b++)if(this.layers[b].isRequestAnimation()){c=!0;break}return c}},{key:"startAnimation",value:function(){this.webglLayer.startAnimation()}},{key:"stopAnimation",value:function(){this.webglLayer.stopAnimation()}}]);return c}();window._hmt=window._hmt||[];(function(){var c=document.createElement("script");c.src="https://hm.baidu.com/hm.js?e8002ef3d9e0d8274b5b74cc4a027d08";var d=document.getElementsByTagName("script")[0];
  d.parentNode.insertBefore(c,d)})();v.View=yd;v.GridLayer=uc;v.HeatGridLayer=hd;v.ShapeLayer=tc;v.SimpleLineLayer=wc;v.LineLayer=id;v.WallSpriteLayer=kd;v.LinePointLayer=Ta;v.WallLayer=od;v.WallTripLayer=qd;v.HeatLineLayer=rd;v.WebglLayer=pc;v.PointLayer=Ac;v.RippleLayer=sd;v.SparkLayer=td;v.HeatPointLayer=ud;v.ShapeLineLayer=vd;v.PointTripLayer=wd;v.LineTripLayer=xd;v.Layer=fa;v.BlurEffect=Vc;v.BloomEffect=Wc;v.DepthEffect=Xc;v.EffectManager=oc;v.getContext=cc;v.createProgram=dc;v.Program=S;v.createTexture=
  tb;v.loadTextureImage=ub;v.FrameBufferObject=ob;v.CommonLayer=nb;v.MercatorProjection=pa;v.toRadian=hb;v.Canvas=Ib;v.Intensity=O;v.BezierCurve=ja;v.__moduleExports=ra;v.vec4=Nc;v.vec3=bb;v.vec2=Oc;v.quat2=Pc;v.quat=Qc;v.mat4=T;v.mat3=Rc;v.mat2d=Sc;v.mat2=Tc;v.glMatrix=Uc;Object.defineProperty(v,"__esModule",{value:!0})});
  