168 lines
180 KiB
JavaScript
168 lines
180 KiB
JavaScript
// modules are defined as an array
|
|
// [ module function, map of requires ]
|
|
//
|
|
// map of requires is short require name -> numeric require
|
|
//
|
|
// anything defined in a previous bundle is accessed via the
|
|
// orig method which is the require for previous bundles
|
|
|
|
require = (function (modules, cache, entry) {
|
|
// Save the require from previous bundle to this closure if any
|
|
var previousRequire = typeof require === "function" && require;
|
|
|
|
function newRequire(name, jumped) {
|
|
if (!cache[name]) {
|
|
if (!modules[name]) {
|
|
// if we cannot find the module within our internal map or
|
|
// cache jump to the current global require ie. the last bundle
|
|
// that was added to the page.
|
|
var currentRequire = typeof require === "function" && require;
|
|
if (!jumped && currentRequire) {
|
|
return currentRequire(name, true);
|
|
}
|
|
|
|
// If there are other bundles on this page the require from the
|
|
// previous one is saved to 'previousRequire'. Repeat this as
|
|
// many times as there are bundles until the module is found or
|
|
// we exhaust the require chain.
|
|
if (previousRequire) {
|
|
return previousRequire(name, true);
|
|
}
|
|
|
|
var err = new Error('Cannot find module \'' + name + '\'');
|
|
err.code = 'MODULE_NOT_FOUND';
|
|
throw err;
|
|
}
|
|
|
|
function localRequire(x) {
|
|
return newRequire(localRequire.resolve(x));
|
|
}
|
|
|
|
localRequire.resolve = function (x) {
|
|
return modules[name][1][x] || x;
|
|
};
|
|
|
|
var module = cache[name] = new newRequire.Module;
|
|
modules[name][0].call(module.exports, localRequire, module, module.exports);
|
|
}
|
|
|
|
return cache[name].exports;
|
|
}
|
|
|
|
function Module() {
|
|
this.bundle = newRequire;
|
|
this.exports = {};
|
|
}
|
|
|
|
newRequire.Module = Module;
|
|
newRequire.modules = modules;
|
|
newRequire.cache = cache;
|
|
newRequire.parent = previousRequire;
|
|
|
|
for (var i = 0; i < entry.length; i++) {
|
|
newRequire(entry[i]);
|
|
}
|
|
|
|
// Override the current require with this new one
|
|
return newRequire;
|
|
})({4:[function(require,module,exports) {
|
|
!function(){"use strict";function e(e,t){var n,o,r,i,l=N;for(i=arguments.length;i-- >2;)x.push(arguments[i]);for(t&&null!=t.children&&(x.length||x.push(t.children),delete t.children);x.length;)if((o=x.pop())&&void 0!==o.pop)for(i=o.length;i--;)x.push(o[i]);else"boolean"==typeof o&&(o=null),(r="function"!=typeof e)&&(null==o?o="":"number"==typeof o?o=String(o):"string"!=typeof o&&(r=!1)),r&&n?l[l.length-1]+=o:l===N?l=[o]:l.push(o),n=r;var a=new function(){};return a.nodeName=e,a.children=l,a.attributes=null==t?void 0:t,a.key=null==t?void 0:t.key,void 0!==C.vnode&&C.vnode(a),a}function t(e,t){for(var n in t)e[n]=t[n];return e}function n(e){!e.__d&&(e.__d=!0)&&1==U.push(e)&&(C.debounceRendering||w)(o)}function o(){var e,t=U;for(U=[];e=t.pop();)e.__d&&b(e)}function r(e,t,n){return"string"==typeof t||"number"==typeof t?void 0!==e.splitText:"string"==typeof t.nodeName?!e._componentConstructor&&i(e,t.nodeName):n||e._componentConstructor===t.nodeName}function i(e,t){return e.__n===t||e.nodeName.toLowerCase()===t.toLowerCase()}function l(e){var n=t({},e.attributes);n.children=e.children;var o=e.nodeName.defaultProps;if(void 0!==o)for(var r in o)void 0===n[r]&&(n[r]=o[r]);return n}function a(e){var t=e.parentNode;t&&t.removeChild(e)}function u(e,t,n,o,r){if("className"===t&&(t="class"),"key"===t);else if("ref"===t)n&&n(null),o&&o(e);else if("class"!==t||r)if("style"===t){if(o&&"string"!=typeof o&&"string"!=typeof n||(e.style.cssText=o||""),o&&"object"==typeof o){if("string"!=typeof n)for(var i in n)i in o||(e.style[i]="");for(var i in o)e.style[i]="number"==typeof o[i]&&!1===k.test(i)?o[i]+"px":o[i]}}else if("dangerouslySetInnerHTML"===t)o&&(e.innerHTML=o.__html||"");else if("o"==t[0]&&"n"==t[1]){var l=t!==(t=t.replace(/Capture$/,""));t=t.toLowerCase().substring(2),o?n||e.addEventListener(t,_,l):e.removeEventListener(t,_,l),(e.__l||(e.__l={}))[t]=o}else if("list"!==t&&"type"!==t&&!r&&t in e)!function(e,t,n){try{e[t]=n}catch(e){}}(e,t,null==o?"":o),null!=o&&!1!==o||e.removeAttribute(t);else{var a=r&&t!==(t=t.replace(/^xlink\:?/,""));null==o||!1===o?a?e.removeAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase()):e.removeAttribute(t):"function"!=typeof o&&(a?e.setAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase(),o):e.setAttribute(t,o))}else e.className=o||""}function _(e){return this.__l[e.type](C.event&&C.event(e)||e)}function p(){for(var e;e=S.pop();)C.afterMount&&C.afterMount(e),e.componentDidMount&&e.componentDidMount()}function c(e,t,n,o,r,i){L++||(T=null!=r&&void 0!==r.ownerSVGElement,M=null!=e&&!("__preactattr_"in e));var l=s(e,t,n,o,i);return r&&l.parentNode!==r&&r.appendChild(l),--L||(M=!1,i||p()),l}function s(e,t,n,o,_){var p=e,c=T;if(null!=t&&"boolean"!=typeof t||(t=""),"string"==typeof t||"number"==typeof t)return e&&void 0!==e.splitText&&e.parentNode&&(!e._component||_)?e.nodeValue!=t&&(e.nodeValue=t):(p=document.createTextNode(t),e&&(e.parentNode&&e.parentNode.replaceChild(p,e),f(e,!0))),p.__preactattr_=!0,p;var d=t.nodeName;if("function"==typeof d)return function(e,t,n,o){var r=e&&e._component,i=r,a=e,u=r&&e._componentConstructor===t.nodeName,_=u,p=l(t);for(;r&&!_&&(r=r.__u);)_=r.constructor===t.nodeName;r&&_&&(!o||r._component)?(v(r,p,3,n,o),e=r.base):(i&&!u&&(y(i),e=a=null),r=h(t.nodeName,p,n),e&&!r.__b&&(r.__b=e,a=null),v(r,p,1,n,o),e=r.base,a&&e!==a&&(a._component=null,f(a,!1)));return e}(e,t,n,o);if(T="svg"===d||"foreignObject"!==d&&T,d=String(d),(!e||!i(e,d))&&(p=function(e,t){var n=t?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e);return n.__n=e,n}(d,T),e)){for(;e.firstChild;)p.appendChild(e.firstChild);e.parentNode&&e.parentNode.replaceChild(p,e),f(e,!0)}var m=p.firstChild,b=p.__preactattr_,g=t.children;if(null==b){b=p.__preactattr_={};for(var C=p.attributes,x=C.length;x--;)b[C[x].name]=C[x].value}return!M&&g&&1===g.length&&"string"==typeof g[0]&&null!=m&&void 0!==m.splitText&&null==m.nextSibling?m.nodeValue!=g[0]&&(m.nodeValue=g[0]):(g&&g.length||null!=m)&&function(e,t,n,o,i){var l,u,_,p,c,d=e.childNodes,h=[],m={},v=0,b=0,y=d.length,g=0,C=t?t.length:0;if(0!==y)for(var x=0;x<y;x++){var N=d[x],w=N.__preactattr_,k=C&&w?N._component?N._component.__k:w.key:null;null!=k?(v++,m[k]=N):(w||(void 0!==N.splitText?!i||N.nodeValue.trim():i))&&(h[g++]=N)}if(0!==C)for(var x=0;x<C;x++){p=t[x],c=null;var k=p.key;if(null!=k)v&&void 0!==m[k]&&(c=m[k],m[k]=void 0,v--);else if(!c&&b<g)for(l=b;l<g;l++)if(void 0!==h[l]&&r(u=h[l],p,i)){c=u,h[l]=void 0,l===g-1&&g--,l===b&&b++;break}c=s(c,p,n,o),_=d[x],c&&c!==e&&c!==_&&(null==_?e.appendChild(c):c===_.nextSibling?a(_):e.insertBefore(c,_))}if(v)for(var x in m)void 0!==m[x]&&f(m[x],!1);for(;b<=g;)void 0!==(c=h[g--])&&f(c,!1)}(p,g,n,o,M||null!=b.dangerouslySetInnerHTML),function(e,t,n){var o;for(o in n)t&&null!=t[o]||null==n[o]||u(e,o,n[o],n[o]=void 0,T);for(o in t)"children"===o||"innerHTML"===o||o in n&&t[o]===("value"===o||"checked"===o?e[o]:n[o])||u(e,o,n[o],n[o]=t[o],T)}(p,t.attributes,b),T=c,p}function f(e,t){var n=e._component;n?y(n):(null!=e.__preactattr_&&e.__preactattr_.ref&&e.__preactattr_.ref(null),!1!==t&&null!=e.__preactattr_||a(e),d(e))}function d(e){for(e=e.lastChild;e;){var t=e.previousSibling;f(e,!0),e=t}}function h(e,t,n){var o,r=W[e.name];if(e.prototype&&e.prototype.render?(o=new e(t,n),g.call(o,t,n)):((o=new g(t,n)).constructor=e,o.render=m),r)for(var i=r.length;i--;)if(r[i].constructor===e){o.__b=r[i].__b,r.splice(i,1);break}return o}function m(e,t,n){return this.constructor(e,n)}function v(e,t,o,r,i){e.__x||(e.__x=!0,(e.__r=t.ref)&&delete t.ref,(e.__k=t.key)&&delete t.key,!e.base||i?e.componentWillMount&&e.componentWillMount():e.componentWillReceiveProps&&e.componentWillReceiveProps(t,r),r&&r!==e.context&&(e.__c||(e.__c=e.context),e.context=r),e.__p||(e.__p=e.props),e.props=t,e.__x=!1,0!==o&&(1!==o&&!1===C.syncComponentUpdates&&e.base?n(e):b(e,1,i)),e.__r&&e.__r(e))}function b(e,n,o,r){if(!e.__x){var i,a,u,_=e.props,s=e.state,d=e.context,m=e.__p||_,g=e.__s||s,x=e.__c||d,N=e.base,w=e.__b,k=N||w,U=e._component,T=!1;if(N&&(e.props=m,e.state=g,e.context=x,2!==n&&e.shouldComponentUpdate&&!1===e.shouldComponentUpdate(_,s,d)?T=!0:e.componentWillUpdate&&e.componentWillUpdate(_,s,d),e.props=_,e.state=s,e.context=d),e.__p=e.__s=e.__c=e.__b=null,e.__d=!1,!T){i=e.render(_,s,d),e.getChildContext&&(d=t(t({},d),e.getChildContext()));var M,W,E=i&&i.nodeName;if("function"==typeof E){var P=l(i);(a=U)&&a.constructor===E&&P.key==a.__k?v(a,P,1,d,!1):(M=a,e._component=a=h(E,P,d),a.__b=a.__b||w,a.__u=e,v(a,P,0,d,!1),b(a,1,o,!0)),W=a.base}else u=k,(M=U)&&(u=e._component=null),(k||1===n)&&(u&&(u._component=null),W=c(u,i,d,o||!N,k&&k.parentNode,!0));if(k&&W!==k&&a!==U){var V=k.parentNode;V&&W!==V&&(V.replaceChild(W,k),M||(k._component=null,f(k,!1)))}if(M&&y(M),e.base=W,W&&!r){for(var A=e,D=e;D=D.__u;)(A=D).base=W;W._component=A,W._componentConstructor=A.constructor}}if(!N||o?S.unshift(e):T||(e.componentDidUpdate&&e.componentDidUpdate(m,g,x),C.afterUpdate&&C.afterUpdate(e)),null!=e.__h)for(;e.__h.length;)e.__h.pop().call(e);L||r||p()}}function y(e){C.beforeUnmount&&C.beforeUnmount(e);var t=e.base;e.__x=!0,e.componentWillUnmount&&e.componentWillUnmount(),e.base=null;var n=e._component;n?y(n):t&&(t.__preactattr_&&t.__preactattr_.ref&&t.__preactattr_.ref(null),e.__b=t,a(t),function(e){var t=e.constructor.name;(W[t]||(W[t]=[])).push(e)}(e),d(t)),e.__r&&e.__r(null)}function g(e,t){this.__d=!0,this.context=t,this.props=e,this.state=this.state||{}}var C={},x=[],N=[],w="function"==typeof Promise?Promise.resolve().then.bind(Promise.resolve()):setTimeout,k=/acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i,U=[],S=[],L=0,T=!1,M=!1,W={};t(g.prototype,{setState:function(e,o){var r=this.state;this.__s||(this.__s=t({},r)),t(r,"function"==typeof e?e(r,this.props):e),o&&(this.__h=this.__h||[]).push(o),n(this)},forceUpdate:function(e){e&&(this.__h=this.__h||[]).push(e),b(this,2)},render:function(){}});var E={h:e,createElement:e,cloneElement:function(n,o){return e(n.nodeName,t(t({},n.attributes),o),arguments.length>2?[].slice.call(arguments,2):n.children)},Component:g,render:function(e,t,n){return c(n,e,{},!1,t,!1)},rerender:o,options:C};"undefined"!=typeof module?module.exports=E:self.preact=E}();
|
|
},{}],5:[function(require,module,exports) {
|
|
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e=require("preact");class t extends e.Component{serialize(){const e=Object.create(null),s=this.subcomponents();for(const n in s){const o=s[n];o&&o instanceof t&&(e[n]=o.serialize())}return{state:this.state,serializedSubcomponents:e}}rehydrate(e){this.setState(e.state,()=>{const s=this.subcomponents();for(const n in s){const o=s[n],r=e.serializedSubcomponents[n];r&&o&&o instanceof t&&o.rehydrate(r)}})}subcomponents(){return Object.create(null)}}exports.ReloadableComponent=t;
|
|
},{"preact":4}],42:[function(require,module,exports) {
|
|
"use strict";function e(e){return"string"==typeof e&&t.test(e)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=e;var t=/-webkit-|-moz-|-ms-/;module.exports=exports.default;
|
|
},{}],30:[function(require,module,exports) {
|
|
"use strict";function e(e){return e&&e.__esModule?e:{default:e}}function t(e,t){if("string"==typeof t&&!(0,u.default)(t)&&t.indexOf("calc(")>-1)return i.map(function(e){return t.replace(/calc\(/g,e+"calc(")})}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=t;var r=require("css-in-js-utils/lib/isPrefixedValue"),u=e(r),i=["-webkit-","-moz-",""];module.exports=exports.default;
|
|
},{"css-in-js-utils/lib/isPrefixedValue":42}],31:[function(require,module,exports) {
|
|
"use strict";function e(e){return e&&e.__esModule?e:{default:e}}function t(e,t){if("string"==typeof t&&!(0,i.default)(t)&&t.indexOf("filter(")>-1)return u.map(function(e){return t.replace(/filter\(/g,e+"filter(")})}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=t;var r=require("css-in-js-utils/lib/isPrefixedValue"),i=e(r),u=["-webkit-",""];module.exports=exports.default;
|
|
},{"css-in-js-utils/lib/isPrefixedValue":42}],32:[function(require,module,exports) {
|
|
"use strict";function e(e){return e&&e.__esModule?e:{default:e}}function r(e,r){if("string"==typeof r&&!(0,s.default)(r)&&r.indexOf("cross-fade(")>-1)return u.map(function(e){return r.replace(/cross-fade\(/g,e+"cross-fade(")})}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=r;var t=require("css-in-js-utils/lib/isPrefixedValue"),s=e(t),u=["-webkit-",""];module.exports=exports.default;
|
|
},{"css-in-js-utils/lib/isPrefixedValue":42}],33:[function(require,module,exports) {
|
|
"use strict";function e(e,t){if("cursor"===e&&o.hasOwnProperty(t))return r.map(function(e){return e+t})}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=e;var r=["-webkit-","-moz-",""],o={"zoom-in":!0,"zoom-out":!0,grab:!0,grabbing:!0};module.exports=exports.default;
|
|
},{}],34:[function(require,module,exports) {
|
|
"use strict";function e(e,l){if("display"===e&&i.hasOwnProperty(l))return i[l]}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=e;var i={flex:["-webkit-box","-moz-box","-ms-flexbox","-webkit-flex","flex"],"inline-flex":["-webkit-inline-box","-moz-inline-box","-ms-inline-flexbox","-webkit-inline-flex","inline-flex"]};module.exports=exports.default;
|
|
},{}],35:[function(require,module,exports) {
|
|
"use strict";function e(e,l,r){s.hasOwnProperty(e)&&(r[s[e]]=t[l]||l)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=e;var t={"space-around":"distribute","space-between":"justify","flex-start":"start","flex-end":"end"},s={alignContent:"msFlexLinePack",alignSelf:"msFlexItemAlign",alignItems:"msFlexAlign",justifyContent:"msFlexPack",order:"msFlexOrder",flexGrow:"msFlexPositive",flexShrink:"msFlexNegative",flexBasis:"msFlexPreferredSize"};module.exports=exports.default;
|
|
},{}],36:[function(require,module,exports) {
|
|
"use strict";function e(e,r,o){"flexDirection"===e&&"string"==typeof r&&(r.indexOf("column")>-1?o.WebkitBoxOrient="vertical":o.WebkitBoxOrient="horizontal",r.indexOf("reverse")>-1?o.WebkitBoxDirection="reverse":o.WebkitBoxDirection="normal"),i.hasOwnProperty(e)&&(o[i[e]]=t[r]||r)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=e;var t={"space-around":"justify","space-between":"justify","flex-start":"start","flex-end":"end","wrap-reverse":"multiple",wrap:"multiple"},i={alignItems:"WebkitBoxAlign",justifyContent:"WebkitBoxPack",flexWrap:"WebkitBoxLines"};module.exports=exports.default;
|
|
},{}],37:[function(require,module,exports) {
|
|
"use strict";function e(e,t){if("position"===e&&"sticky"===t)return["-webkit-sticky","sticky"]}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=e,module.exports=exports.default;
|
|
},{}],38:[function(require,module,exports) {
|
|
"use strict";function e(e){return e&&e.__esModule?e:{default:e}}function t(e,t){if("string"==typeof t&&!(0,i.default)(t)&&n.test(t))return a.map(function(e){return e+t})}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=t;var r=require("css-in-js-utils/lib/isPrefixedValue"),i=e(r),a=["-webkit-","-moz-",""],n=/linear-gradient|radial-gradient|repeating-linear-gradient|repeating-radial-gradient/;module.exports=exports.default;
|
|
},{"css-in-js-utils/lib/isPrefixedValue":42}],39:[function(require,module,exports) {
|
|
"use strict";function e(e){return e&&e.__esModule?e:{default:e}}function t(e,t){if("string"==typeof t&&!(0,i.default)(t)&&t.indexOf("image-set(")>-1)return u.map(function(e){return t.replace(/image-set\(/g,e+"image-set(")})}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=t;var r=require("css-in-js-utils/lib/isPrefixedValue"),i=e(r),u=["-webkit-",""];module.exports=exports.default;
|
|
},{"css-in-js-utils/lib/isPrefixedValue":42}],40:[function(require,module,exports) {
|
|
"use strict";function t(t,o){if(n.hasOwnProperty(t)&&i.hasOwnProperty(o))return e.map(function(t){return t+o})}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=t;var e=["-webkit-","-moz-",""],n={maxHeight:!0,maxWidth:!0,width:!0,height:!0,columnWidth:!0,minWidth:!0,minHeight:!0},i={"min-content":!0,"max-content":!0,"fill-available":!0,"fit-content":!0,"contain-floats":!0};module.exports=exports.default;
|
|
},{}],29:[function(require,module,exports) {
|
|
"use strict";function e(e){return e.charAt(0).toUpperCase()+e.slice(1)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=e,module.exports=exports.default;
|
|
},{}],44:[function(require,module,exports) {
|
|
"use strict";function e(e){return e in t?t[e]:t[e]=e.replace(r,"-$&").toLowerCase().replace(s,"-ms-")}var r=/[A-Z]/g,s=/^ms-/,t={};module.exports=e;
|
|
},{}],43:[function(require,module,exports) {
|
|
"use strict";function e(e){return e&&e.__esModule?e:{default:e}}function t(e){return(0,u.default)(e)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=t;var r=require("hyphenate-style-name"),u=e(r);module.exports=exports.default;
|
|
},{"hyphenate-style-name":44}],41:[function(require,module,exports) {
|
|
"use strict";function t(t){return t&&t.__esModule?t:{default:t}}function e(t,e){if((0,s.default)(t))return t;for(var r=t.split(/,(?![^()]*(?:\([^()]*\))?\))/g),i=0,o=r.length;i<o;++i){var u=r[i],a=[u];for(var f in e){var p=(0,n.default)(f);if(u.indexOf(p)>-1&&"order"!==p)for(var d=e[f],c=0,b=d.length;c<b;++c)a.unshift(u.replace(p,l[d[c]]+p))}r[i]=a.join(",")}return r.join(",")}function r(t,r,i,n){if("string"==typeof r&&f.hasOwnProperty(t)){var o=e(r,n),s=o.split(/,(?![^()]*(?:\([^()]*\))?\))/g).filter(function(t){return!/-moz-|-ms-/.test(t)}).join(",");if(t.indexOf("Webkit")>-1)return s;var u=o.split(/,(?![^()]*(?:\([^()]*\))?\))/g).filter(function(t){return!/-webkit-|-ms-/.test(t)}).join(",");return t.indexOf("Moz")>-1?u:(i["Webkit"+(0,a.default)(t)]=s,i["Moz"+(0,a.default)(t)]=u,o)}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=r;var i=require("css-in-js-utils/lib/hyphenateProperty"),n=t(i),o=require("css-in-js-utils/lib/isPrefixedValue"),s=t(o),u=require("../../utils/capitalizeString"),a=t(u),f={transition:!0,transitionProperty:!0,WebkitTransition:!0,WebkitTransitionProperty:!0,MozTransition:!0,MozTransitionProperty:!0},l={Webkit:"-webkit-",Moz:"-moz-",ms:"-ms-"};module.exports=exports.default;
|
|
},{"../../utils/capitalizeString":29,"css-in-js-utils/lib/hyphenateProperty":43,"css-in-js-utils/lib/isPrefixedValue":42}],17:[function(require,module,exports) {
|
|
var e=require("inline-style-prefixer/static/plugins/calc"),i=require("inline-style-prefixer/static/plugins/crossFade"),t=require("inline-style-prefixer/static/plugins/cursor"),r=require("inline-style-prefixer/static/plugins/filter"),s=require("inline-style-prefixer/static/plugins/flex"),o=require("inline-style-prefixer/static/plugins/flexboxIE"),n=require("inline-style-prefixer/static/plugins/flexboxOld"),a=require("inline-style-prefixer/static/plugins/gradient"),k=require("inline-style-prefixer/static/plugins/imageSet"),m=require("inline-style-prefixer/static/plugins/position"),l=require("inline-style-prefixer/static/plugins/sizing"),b=require("inline-style-prefixer/static/plugins/transition");module.exports={plugins:[e,i,t,r,s,o,n,a,k,m,l,b],prefixMap:{transform:["Webkit","ms"],transformOrigin:["Webkit","ms"],transformOriginX:["Webkit","ms"],transformOriginY:["Webkit","ms"],backfaceVisibility:["Webkit"],perspective:["Webkit"],perspectiveOrigin:["Webkit"],transformStyle:["Webkit"],transformOriginZ:["Webkit"],animation:["Webkit"],animationDelay:["Webkit"],animationDirection:["Webkit"],animationFillMode:["Webkit"],animationDuration:["Webkit"],animationIterationCount:["Webkit"],animationName:["Webkit"],animationPlayState:["Webkit"],animationTimingFunction:["Webkit"],appearance:["Webkit","Moz"],userSelect:["Webkit","Moz","ms"],fontKerning:["Webkit"],textEmphasisPosition:["Webkit"],textEmphasis:["Webkit"],textEmphasisStyle:["Webkit"],textEmphasisColor:["Webkit"],boxDecorationBreak:["Webkit"],clipPath:["Webkit"],maskImage:["Webkit"],maskMode:["Webkit"],maskRepeat:["Webkit"],maskPosition:["Webkit"],maskClip:["Webkit"],maskOrigin:["Webkit"],maskSize:["Webkit"],maskComposite:["Webkit"],mask:["Webkit"],maskBorderSource:["Webkit"],maskBorderMode:["Webkit"],maskBorderSlice:["Webkit"],maskBorderWidth:["Webkit"],maskBorderOutset:["Webkit"],maskBorderRepeat:["Webkit"],maskBorder:["Webkit"],maskType:["Webkit"],textDecorationStyle:["Webkit","Moz"],textDecorationSkip:["Webkit","Moz"],textDecorationLine:["Webkit","Moz"],textDecorationColor:["Webkit","Moz"],filter:["Webkit"],fontFeatureSettings:["Webkit","Moz"],breakAfter:["Webkit","Moz","ms"],breakBefore:["Webkit","Moz","ms"],breakInside:["Webkit","Moz","ms"],columnCount:["Webkit","Moz"],columnFill:["Webkit","Moz"],columnGap:["Webkit","Moz"],columnRule:["Webkit","Moz"],columnRuleColor:["Webkit","Moz"],columnRuleStyle:["Webkit","Moz"],columnRuleWidth:["Webkit","Moz"],columns:["Webkit","Moz"],columnSpan:["Webkit","Moz"],columnWidth:["Webkit","Moz"],flex:["Webkit","ms"],flexBasis:["Webkit"],flexDirection:["Webkit","ms"],flexGrow:["Webkit"],flexFlow:["Webkit","ms"],flexShrink:["Webkit"],flexWrap:["Webkit","ms"],alignContent:["Webkit"],alignItems:["Webkit"],alignSelf:["Webkit"],justifyContent:["Webkit"],order:["Webkit"],transitionDelay:["Webkit"],transitionDuration:["Webkit"],transitionProperty:["Webkit"],transitionTimingFunction:["Webkit"],backdropFilter:["Webkit"],scrollSnapType:["Webkit","ms"],scrollSnapPointsX:["Webkit","ms"],scrollSnapPointsY:["Webkit","ms"],scrollSnapDestination:["Webkit","ms"],scrollSnapCoordinate:["Webkit","ms"],shapeImageThreshold:["Webkit"],shapeImageMargin:["Webkit"],shapeImageOutside:["Webkit"],hyphens:["Webkit","Moz","ms"],flowInto:["Webkit","ms"],flowFrom:["Webkit","ms"],regionFragment:["Webkit","ms"],boxSizing:["Moz"],textAlignLast:["Moz"],tabSize:["Moz"],wrapFlow:["ms"],wrapThrough:["ms"],wrapMargin:["ms"],touchAction:["ms"],gridTemplateColumns:["ms"],gridTemplateRows:["ms"],gridTemplateAreas:["ms"],gridTemplate:["ms"],gridAutoColumns:["ms"],gridAutoRows:["ms"],gridAutoFlow:["ms"],grid:["ms"],gridRowStart:["ms"],gridColumnStart:["ms"],gridRowEnd:["ms"],gridRow:["ms"],gridColumn:["ms"],gridColumnEnd:["ms"],gridColumnGap:["ms"],gridRowGap:["ms"],gridArea:["ms"],gridGap:["ms"],textSizeAdjust:["Webkit","ms"],borderImage:["Webkit"],borderImageOutset:["Webkit"],borderImageRepeat:["Webkit"],borderImageSlice:["Webkit"],borderImageSource:["Webkit"],borderImageWidth:["Webkit"]}};
|
|
},{"inline-style-prefixer/static/plugins/calc":30,"inline-style-prefixer/static/plugins/filter":31,"inline-style-prefixer/static/plugins/crossFade":32,"inline-style-prefixer/static/plugins/cursor":33,"inline-style-prefixer/static/plugins/flex":34,"inline-style-prefixer/static/plugins/flexboxIE":35,"inline-style-prefixer/static/plugins/flexboxOld":36,"inline-style-prefixer/static/plugins/position":37,"inline-style-prefixer/static/plugins/gradient":38,"inline-style-prefixer/static/plugins/imageSet":39,"inline-style-prefixer/static/plugins/sizing":40,"inline-style-prefixer/static/plugins/transition":41}],18:[function(require,module,exports) {
|
|
"use strict";function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(exports,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n="undefined"!=typeof Map,r=function(){function r(){e(this,r),this.elements={},this.keyOrder=[]}return t(r,[{key:"forEach",value:function(e){for(var t=0;t<this.keyOrder.length;t++)e(this.elements[this.keyOrder[t]],this.keyOrder[t])}},{key:"set",value:function(e,t,s){var i=this;if(this.elements.hasOwnProperty(e)){if(s){var o=this.keyOrder.indexOf(e);this.keyOrder.splice(o,1),this.keyOrder.push(e)}}else this.keyOrder.push(e);if(null!=t){if(n&&t instanceof Map||t instanceof r){var a=function(){var n=i.elements.hasOwnProperty(e)?i.elements[e]:new r;return t.forEach(function(e,t){n.set(t,e,s)}),i.elements[e]=n,{v:void 0}}();if("object"==typeof a)return a.v}if(Array.isArray(t)||"object"!=typeof t)this.elements[e]=t;else{for(var f=this.elements.hasOwnProperty(e)?this.elements[e]:new r,l=Object.keys(t),u=0;u<l.length;u+=1)f.set(l[u],t[l[u]],s);this.elements[e]=f}}else this.elements[e]=t}},{key:"get",value:function(e){return this.elements[e]}},{key:"has",value:function(e){return this.elements.hasOwnProperty(e)}},{key:"addStyleType",value:function(e){var t=this;if(n&&e instanceof Map||e instanceof r)e.forEach(function(e,n){t.set(n,e,!0)});else for(var s=Object.keys(e),i=0;i<s.length;i++)this.set(s[i],e[s[i]],!0)}}]),r}();exports.default=r,module.exports=exports.default;
|
|
},{}],21:[function(require,module,exports) {
|
|
"use strict";function r(r){for(var t=5381,e=r.length;e;)t=33*t^r.charCodeAt(--e);return t>>>0}module.exports=r;
|
|
},{}],19:[function(require,module,exports) {
|
|
"use strict";function r(r){return r&&r.__esModule?r:{default:r}}function t(r,t){return r+t.charAt(0).toUpperCase()+t.substring(1)}Object.defineProperty(exports,"__esModule",{value:!0});var e=function(){return function(r,t){if(Array.isArray(r))return r;if(Symbol.iterator in Object(r))return function(r,t){var e=[],n=!0,o=!1,i=void 0;try{for(var a,u=r[Symbol.iterator]();!(n=(a=u.next()).done)&&(e.push(a.value),!t||e.length!==t);n=!0);}catch(r){o=!0,i=r}finally{try{!n&&u.return&&u.return()}finally{if(o)throw i}}return e}(r,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),n=require("string-hash"),o=r(n),i=function(r,t){for(var n=Object.keys(r),o={},i=0;i<n.length;i+=1){var a=t([n[i],r[n[i]]]),u=e(a,2),f=u[0],s=u[1];o[f]=s}return o};exports.mapObj=i;var a=/([A-Z])/g,u=function(r){return"-"+r.toLowerCase()},f=function(r){var t=r.replace(a,u);return"m"===t[0]&&"s"===t[1]&&"-"===t[2]?"-"+t:t};exports.kebabifyStyleName=f;var s={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridColumn:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},l=["Webkit","ms","Moz","O"];Object.keys(s).forEach(function(r){l.forEach(function(e){s[t(e,r)]=s[r]})});var c=function(r,t){return"number"==typeof t?s[r]?""+t:t+"px":""+t};exports.stringifyValue=c;var p=function(r,t){return d(c(r,t))};exports.stringifyAndImportantifyValue=p;var y=function(r){return(0,o.default)(r).toString(36)};exports.hashString=y;var h=function(r){return y(JSON.stringify(r))};exports.hashObject=h;var d=function(r){return"!"===r[r.length-10]&&" !important"===r.slice(-11)?r:r+" !important"};
|
|
},{"string-hash":21}],25:[function(require,module,exports) {
|
|
"use strict";function e(e){return e&&e.__esModule?e:{default:e}}function t(e,t,r){if(e.hasOwnProperty(t))for(var o=e[t],a=0,l=o.length;a<l;++a)r[o[a]+(0,u.default)(t)]=r[t]}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=t;var r=require("./capitalizeString"),u=e(r);module.exports=exports.default;
|
|
},{"./capitalizeString":29}],26:[function(require,module,exports) {
|
|
"use strict";function e(e,t,r,o,u){for(var s=0,f=e.length;s<f;++s){var l=e[s](t,r,o,u);if(l)return l}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=e,module.exports=exports.default;
|
|
},{}],27:[function(require,module,exports) {
|
|
"use strict";function e(e,r){-1===e.indexOf(r)&&e.push(r)}function r(r,t){if(Array.isArray(t))for(var o=0,s=t.length;o<s;++o)e(r,t[o]);else e(r,t)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=r,module.exports=exports.default;
|
|
},{}],28:[function(require,module,exports) {
|
|
"use strict";function e(e){return e instanceof Object&&!Array.isArray(e)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=e,module.exports=exports.default;
|
|
},{}],24:[function(require,module,exports) {
|
|
"use strict";function e(e){return e&&e.__esModule?e:{default:e}}function r(e){function r(e){for(var i in e){var s=e[i];if((0,n.default)(s))e[i]=r(s);else if(Array.isArray(s)){for(var d=[],o=0,p=s.length;o<p;++o){var v=(0,a.default)(l,i,s[o],e,t);(0,f.default)(d,v||s[o])}d.length>0&&(e[i]=d)}else{var x=(0,a.default)(l,i,s,e,t);x&&(e[i]=x),(0,u.default)(t,i,e)}}return e}var t=e.prefixMap,l=e.plugins;return r}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=r;var t=require("../utils/prefixProperty"),u=e(t),l=require("../utils/prefixValue"),a=e(l),i=require("../utils/addNewValuesOnly"),f=e(i),s=require("../utils/isObject"),n=e(s);module.exports=exports.default;
|
|
},{"../utils/prefixProperty":25,"../utils/prefixValue":26,"../utils/addNewValuesOnly":27,"../utils/isObject":28}],15:[function(require,module,exports) {
|
|
"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(exports,"__esModule",{value:!0});var r=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},t=require("inline-style-prefixer/static/createPrefixer"),n=e(t),a=require("../lib/staticPrefixData"),i=e(a),l=require("./ordered-elements"),u=e(l),o=require("./util"),f=(0,n.default)(i.default),s=[function(e,r,t){return":"!==e[0]?null:t(r+e)},function(e,r,t){if("@"!==e[0])return null;return e+"{"+t(r)+"}"}];exports.defaultSelectorHandlers=s;var c=function e(r,t,n,a,i){for(var l=new u.default,o=0;o<t.length;o++)l.addStyleType(t[o]);var f=new u.default,s="";return l.forEach(function(t,l){n.some(function(u){var o=u(l,r,function(r){return e(r,[t],n,a,i)});if(null!=o)return s+=o,!0})||f.set(l,t,!0)}),v(r,f,a,i,n)+s};exports.generateCSS=c;var d=function(e,r,t){if(r)for(var n=Object.keys(r),a=0;a<n.length;a++){var i=n[a];e.has(i)&&e.set(i,r[i](e.get(i),t),!1)}},y=function(e,r,t){return(0,o.kebabifyStyleName)(e)+":"+t(e,r)+";"},v=function(e,t,n,a,i){d(t,n,i);var l=r({},t.elements),u=f(t.elements),s=Object.keys(u);if(s.length!==t.keyOrder.length)for(var c=0;c<s.length;c++)if(!l.hasOwnProperty(s[c])){var v=void 0;if((v="W"===s[c][0]?s[c][6].toLowerCase()+s[c].slice(7):"o"===s[c][1]?s[c][3].toLowerCase()+s[c].slice(4):s[c][2].toLowerCase()+s[c].slice(3))&&l.hasOwnProperty(v)){var h=t.keyOrder.indexOf(v);t.keyOrder.splice(h,0,s[c])}else t.keyOrder.unshift(s[c])}var p=!1===a?o.stringifyValue:o.stringifyAndImportantifyValue,g=[];for(c=0;c<t.keyOrder.length;c++){var O=t.keyOrder[c],k=u[O];if(Array.isArray(k))for(var b=0;b<k.length;b++)g.push(y(O,k[b],p));else g.push(y(O,k,p))}return g.length?e+"{"+g.join("")+"}":""};exports.generateCSSRuleset=v;
|
|
},{"../lib/staticPrefixData":17,"./ordered-elements":18,"./util":19,"inline-style-prefixer/static/createPrefixer":24}],23:[function(require,module,exports) {
|
|
var global = (1,eval)("this");
|
|
function e(e){u.length||(o(),l=!0),u[u.length]=e}function t(){for(;i<u.length;){var e=i;if(i+=1,u[e].call(),i>c){for(var t=0,n=u.length-i;t<n;t++)u[t]=u[t+i];u.length-=i,i=0}}u.length=0,i=0,l=!1}function n(e){var t=1,n=new v(e),r=document.createTextNode("");return n.observe(r,{characterData:!0}),function(){t=-t,r.data=t}}function r(e){return function(){function t(){clearTimeout(n),clearInterval(r),e()}var n=setTimeout(t,0),r=setInterval(t,50)}}var a=(0,eval)("this");module.exports=e;var o,u=[],l=!1,i=0,c=1024,f=void 0!==a?a:self,v=f.MutationObserver||f.WebKitMutationObserver;o="function"==typeof v?n(t):r(t),e.requestFlush=o,e.makeRequestCallFromTimer=r;
|
|
},{}],22:[function(require,module,exports) {
|
|
"use strict";function t(){if(o.length)throw o.shift()}function r(t){var r;(r=l.length?l.pop():new n).task=t,e(r)}function n(){this.task=null}var e=require("./raw"),l=[],o=[],i=e.makeRequestCallFromTimer(t);module.exports=r,n.prototype.call=function(){try{this.task.call()}catch(t){r.onerror?r.onerror(t):(o.push(t),i())}finally{this.task=null,l[l.length]=this}};
|
|
},{"./raw":23}],20:[function(require,module,exports) {
|
|
"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("asap"),n=e(t),r=require("./ordered-elements"),a=e(r),i=require("./generate"),o=require("./util"),s=null,u=function(e){if(null==s&&null==(s=document.querySelector("style[data-aphrodite]"))){var t=document.head||document.getElementsByTagName("head")[0];(s=document.createElement("style")).type="text/css",s.setAttribute("data-aphrodite",""),t.appendChild(s)}s.styleSheet?s.styleSheet.cssText+=e:s.appendChild(document.createTextNode(e))},f={fontFamily:function e(t){return Array.isArray(t)?t.map(e).join(","):"object"==typeof t?(h(t.src,"@font-face",[t],!1),'"'+t.fontFamily+'"'):t},animationName:function e(t,n){if(Array.isArray(t))return t.map(function(t){return e(t,n)}).join(",");if("object"==typeof t){var r="keyframe_"+(0,o.hashObject)(t),s="@keyframes "+r+"{";return t instanceof a.default?t.forEach(function(e,t){s+=(0,i.generateCSS)(t,[e],n,f,!1)}):Object.keys(t).forEach(function(e){s+=(0,i.generateCSS)(e,[t[e]],n,f,!1)}),s+="}",m(r,s),r}return t}},c={},l="",d=!1,m=function(e,t){if(!c[e]){if(!d){if("undefined"==typeof document)throw new Error("Cannot automatically buffer without a document");d=!0,(0,n.default)(g)}l+=t,c[e]=!0}},h=function(e,t,n,r){var a=arguments.length<=4||void 0===arguments[4]?[]:arguments[4];if(!c[e]){var o=(0,i.generateCSS)(t,n,a,f,r);m(e,o)}};exports.injectStyleOnce=h;var y=function(){l="",c={},d=!1,s=null};exports.reset=y;var p=function(){if(d)throw new Error("Cannot buffer while already buffering");d=!0};exports.startBuffering=p;var v=function(){d=!1;var e=l;return l="",e};exports.flushToString=v;var g=function(){var e=v();e.length>0&&u(e)};exports.flushToStyleTag=g;var S=function(){return Object.keys(c)};exports.getRenderedClassNames=S;var x=function(e){e.forEach(function(e){c[e]=!0})};exports.addRenderedClassNames=x;var N=function e(t,n){for(var r=0;r<t.length;r+=1)t[r]&&(Array.isArray(t[r])?e(t[r],n):(n.classNameBits.push(t[r]._name),n.definitionBits.push(t[r]._definition)))},j=function(e){return(e.reduce(function(e,t){return e+(t?t._len:0)},0)%36).toString(36)},B=function(e,t,n){var r={classNameBits:[],definitionBits:[]};if(N(t,r),0===r.classNameBits.length)return"";var a=void 0;return a=1===r.classNameBits.length?"_"+r.classNameBits[0]:"_"+(0,o.hashString)(r.classNameBits.join())+j(t),h(a,"."+a,r.definitionBits,e,n),a};exports.injectAndGetClassName=B;
|
|
},{"./ordered-elements":18,"./generate":15,"./util":19,"asap":22}],16:[function(require,module,exports) {
|
|
"use strict";var e=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,i=!1,a=void 0;try{for(var u,o=e[Symbol.iterator]();!(n=(u=o.next()).done)&&(r.push(u.value),!t||r.length!==t);n=!0);}catch(e){i=!0,a=e}finally{try{!n&&o.return&&o.return()}finally{if(i)throw a}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},r=require("./util"),n=require("./inject"),i={create:function(t){return(0,r.mapObj)(t,function(t){var n=e(t,2),i=n[0],a=n[1],u=JSON.stringify(a);return[i,{_len:u.length,_name:(0,r.hashString)(u),_definition:a}]})},rehydrate:function(){var e=arguments.length<=0||void 0===arguments[0]?[]:arguments[0];(0,n.addRenderedClassNames)(e)}},a={renderStatic:function(e){(0,n.reset)(),(0,n.startBuffering)();return{html:e(),css:{content:(0,n.flushToString)(),renderedClassNames:(0,n.getRenderedClassNames)()}}}},u={suppressStyleInjection:function(){(0,n.reset)(),(0,n.startBuffering)()},clearBufferAndResumeStyleInjection:function(){(0,n.reset)()}},o=function e(r,o){return{StyleSheet:t({},i,{extend:function(t){var n=t.map(function(e){return e.selectorHandler}).filter(function(e){return e});return e(r,o.concat(n))}}),StyleSheetServer:a,StyleSheetTestUtils:u,css:function(){for(var e=arguments.length,t=Array(e),i=0;i<e;i++)t[i]=arguments[i];return(0,n.injectAndGetClassName)(r,t,o)}}};module.exports=o;
|
|
},{"./util":19,"./inject":20}],13:[function(require,module,exports) {
|
|
"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(exports,"__esModule",{value:!0});var r=require("./generate"),t=require("./exports"),u=e(t),l=!0;exports.default=(0,u.default)(l,r.defaultSelectorHandlers),module.exports=exports.default;
|
|
},{"./generate":15,"./exports":16}],45:[function(require,module,exports) {
|
|
"use strict";function e(e){let t=null;return function(...n){null==t&&(t=requestAnimationFrame(function(){e(...n),t=null}))}}function t(e){return e[e.length-1]||null}function n(e,t){return r.has(t)||r.set(t,e.measureText(t).width),r.get(t)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.atMostOnceAFrame=e,exports.lastOf=t;const r=new Map;exports.cachedMeasureTextWidth=n;
|
|
},{}],9:[function(require,module,exports) {
|
|
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var o;(o=exports.FontFamily||(exports.FontFamily={})).MONOSPACE="Courier, monospace";var e;!function(o){o[o.LABEL=10]="LABEL",o[o.TITLE=12]="TITLE",o[o.BIG_BUTTON=36]="BIG_BUTTON"}(e=exports.FontSize||(exports.FontSize={}));var r;!function(o){o.LIGHT_GRAY="#C4C4C4",o.MEDIUM_GRAY="#BDBDBD",o.GRAY="#666666",o.DARK_GRAY="#333333",o.LIGHT_BLUE="#56CCF2",o.DARK_BLUE="#2F80ED"}(r=exports.Colors||(exports.Colors={}));
|
|
},{}],50:[function(require,module,exports) {
|
|
var global = (1,eval)("this");
|
|
var e=(0,eval)("this");!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.createREGL=t()}(this,function(){"use strict";function e(e){return"undefined"!=typeof btoa?btoa(e):"base64:"+e}function t(e){var t=new Error("(regl) "+e);throw t}function r(e,r){e||t(r)}function n(e){return e?": "+e:""}function a(e,r,a){r.indexOf(e)<0&&t("invalid value"+n(a)+". must be one of: "+r)}function i(e,t){for(e+="";e.length<t;)e=" "+e;return e}function o(){this.name="unknown",this.lines=[],this.index={},this.hasErrors=!1}function f(e,t){this.number=e,this.line=t,this.errors=[]}function u(e,t,r){this.file=e,this.line=t,this.message=r}function s(){var e=new Error,t=(e.stack||e).toString(),r=/compileProcedure.*\n\s*at.*\((.*)\)/.exec(t);if(r)return r[1];var n=/compileProcedure.*\n\s*at\s+(.*)(\n|$)/.exec(t);return n?n[1]:"unknown"}function c(){var e=new Error,t=(e.stack||e).toString(),r=/at REGLCommand.*\n\s+at.*\((.*)\)/.exec(t);if(r)return r[1];var n=/at REGLCommand.*\n\s+at\s+(.*)\n/.exec(t);return n?n[1]:"unknown"}function l(t,r){var n=t.split("\n"),a=1,i=0,u={unknown:new o,0:new o};u.unknown.name=u[0].name=r||s(),u.unknown.lines.push(new f(0,""));for(var c=0;c<n.length;++c){var l=n[c],d=/^\s*\#\s*(\w+)\s+(.+)\s*$/.exec(l);if(d)switch(d[1]){case"line":var m=/(\d+)(\s+\d+)?/.exec(d[2]);m&&(a=0|m[1],m[2]&&((i=0|m[2])in u||(u[i]=new o)));break;case"define":var p=/SHADER_NAME(_B64)?\s+(.*)$/.exec(d[2]);p&&(u[i].name=p[1]?e(p[2]):p[2])}u[i].lines.push(new f(a++,l))}return Object.keys(u).forEach(function(e){var t=u[e];t.lines.forEach(function(e){t.index[e.number]=e})}),u}function d(e){e._commandRef=s()}function m(e,r){var n=c();t(e+" in command "+(r||s())+("unknown"===n?"":" called from "+n))}function p(e,t,r,a){typeof e!==t&&m("invalid parameter type"+n(r)+". expected "+t+", got "+typeof e,a||s())}function h(e,t){return e===ye||e===ve||e===xe?2:e===we?4:ke[e]*t}function b(e){return!(e&e-1||!e)}function g(e,t){this.id=Se++,this.type=e,this.data=t}function v(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function y(e){if(0===e.length)return[];var t=e.charAt(0),r=e.charAt(e.length-1);if(e.length>1&&t===r&&('"'===t||"'"===t))return['"'+v(e.substr(1,e.length-2))+'"'];var n=/\[(false|true|null|\d+|'[^']*'|"[^"]*")\]/.exec(e);if(n)return y(e.substr(0,n.index)).concat(y(n[1])).concat(y(e.substr(n.index+n[0].length)));var a=e.split(".");if(1===a.length)return['"'+v(e)+'"'];for(var i=[],o=0;o<a.length;++o)i=i.concat(y(a[o]));return i}function x(e){return"["+y(e).join("][")+"]"}function w(e){return"string"==typeof e?e.split():(Ae(Array.isArray(e),"invalid extension array"),e)}function k(e){return"string"==typeof e?(Ae("undefined"!=typeof document,"not supported outside of DOM"),document.querySelector(e)):e}function A(e){var t,r,n,a,i=e||{},o={},f=[],u=[],s="undefined"==typeof window?1:window.devicePixelRatio,c=!1,l=function(e){e&&Ae.raise(e)},d=function(){};if("string"==typeof i?(Ae("undefined"!=typeof document,"selector queries only supported in DOM enviroments"),t=document.querySelector(i),Ae(t,"invalid query string for element")):"object"==typeof i?!function(e){return"string"==typeof e.nodeName&&"function"==typeof e.appendChild&&"function"==typeof e.getBoundingClientRect}(i)?!function(e){return"function"==typeof e.drawArrays||"function"==typeof e.drawElements}(i)?(Ae.constructor(i),"gl"in i?a=i.gl:"canvas"in i?n=k(i.canvas):"container"in i&&(r=k(i.container)),"attributes"in i&&(o=i.attributes,Ae.type(o,"object","invalid context attributes")),"extensions"in i&&(f=w(i.extensions)),"optionalExtensions"in i&&(u=w(i.optionalExtensions)),"onDone"in i&&(Ae.type(i.onDone,"function","invalid or missing onDone callback"),l=i.onDone),"profile"in i&&(c=!!i.profile),"pixelRatio"in i&&Ae((s=+i.pixelRatio)>0,"invalid pixel ratio")):n=(a=i).canvas:t=i:Ae.raise("invalid arguments to regl"),t&&("canvas"===t.nodeName.toLowerCase()?n=t:r=t),!a){if(!n){Ae("undefined"!=typeof document,"must manually specify webgl context outside of DOM environments");var m=function(e,t,r){function n(){var t=window.innerWidth,n=window.innerHeight;if(e!==document.body){var i=e.getBoundingClientRect();t=i.right-i.left,n=i.bottom-i.top}a.width=r*t,a.height=r*n,se(a.style,{width:t+"px",height:n+"px"})}var a=document.createElement("canvas");return se(a.style,{border:0,margin:0,padding:0,top:0,left:0}),e.appendChild(a),e===document.body&&(a.style.position="absolute",se(e.style,{margin:0,padding:0})),window.addEventListener("resize",n,!1),n(),{canvas:a,onDestroy:function(){window.removeEventListener("resize",n),e.removeChild(a)}}}(r||document.body,0,s);if(!m)return null;n=m.canvas,d=m.onDestroy}a=function(e,t){function r(r){try{return e.getContext(r,t)}catch(e){return null}}return r("webgl")||r("experimental-webgl")||r("webgl-experimental")}(n,o)}return a?{gl:a,canvas:n,container:r,extensions:f,optionalExtensions:u,pixelRatio:s,profile:c,onDone:l,onDestroy:d}:(d(),l("webgl not supported, try upgrading your browser or graphics drivers http://get.webgl.org"),null)}function S(e){return!!e&&"object"==typeof e&&Array.isArray(e.shape)&&Array.isArray(e.stride)&&"number"==typeof e.offset&&e.shape.length===e.stride.length&&(Array.isArray(e.data)||ue(e.data))}function _(e,t){for(var r=Array(e),n=0;n<e;++n)r[n]=t(n);return r}function E(e){var t,r;return t=(e>65535)<<4,e>>>=t,r=(e>255)<<3,e>>>=r,t|=r,r=(e>15)<<2,e>>>=r,t|=r,r=(e>3)<<1,e>>>=r,(t|=r)|e>>1}function T(e){var t=function(e){for(var t=16;t<=1<<28;t*=16)if(e<=t)return t;return 0}(e),r=Ie[E(t)>>2];return r.length>0?r.pop():new ArrayBuffer(t)}function D(e){Ie[E(e.byteLength)>>2].push(e)}function j(e,t,r,n,a,i){for(var o=i,f=0;f<t;++f)for(var u=e[f],s=0;s<r;++s)for(var c=u[s],l=0;l<n;++l)a[o++]=c[l]}function O(e,t,r,n,a){for(var i=1,o=r+1;o<t.length;++o)i*=t[o];var f=t[r];if(t.length-r==4){var u=t[r+1],s=t[r+2],c=t[r+3];for(o=0;o<f;++o)j(e[o],u,s,c,n,a),a+=i}else for(o=0;o<f;++o)O(e[o],t,r+1,n,a),a+=i}function C(e){return 0|fe[Object.prototype.toString.call(e)]}function F(e,t){for(var r=0;r<t.length;++r)e[r]=t[r]}function z(e,t,r,n,a,i,o){for(var f=0,u=0;u<r;++u)for(var s=0;s<n;++s)e[f++]=t[a*u+i*s+o]}function B(e){for(var t=Me.allocType(lt,e.length),r=0;r<e.length;++r)if(isNaN(e[r]))t[r]=65535;else if(e[r]===1/0)t[r]=31744;else if(e[r]===-1/0)t[r]=64512;else{st[0]=e[r];var n=ct[0],a=n>>>31<<15,i=(n<<1>>>24)-127,o=n>>13&1023;if(i<-24)t[r]=a;else if(i<-14){var f=-14-i;t[r]=a+(o+1024>>f)}else t[r]=i>15?a+31744:a+(i+15<<10)+o}return t}function P(e){return Array.isArray(e)||ue(e)}function R(e){return"[object "+e+"]"}function L(e){return Array.isArray(e)&&(0===e.length||"number"==typeof e[0])}function I(e){if(!Array.isArray(e))return!1;return!(0===e.length||!P(e[0]))}function M(e){return Object.prototype.toString.call(e)}function W(e){return M(e)===kr}function H(e){if(!e)return!1;var t=M(e);return Er.indexOf(t)>=0||(L(e)||I(e)||S(e))}function G(e){return 0|fe[Object.prototype.toString.call(e)]}function U(e,t){return Me.allocType(e.type===Ft?Yt:e.type,t)}function N(e,t){e.type===Ft?(e.data=B(t),Me.freeType(t)):e.data=t}function q(e,t,r,n,a,i){var o;if(o=void 0!==Dr[e]?Dr[e]:wr[e]*Tr[t],i&&(o*=6),a){for(var f=0,u=r;u>=1;)f+=o*u*u,u/=2;return f}return o*r*n}function Q(e,t,r,n,a,i,o){function f(){this.internalformat=bt,this.format=bt,this.type=qt,this.compressed=!1,this.premultiplyAlpha=!1,this.flipY=!1,this.unpackAlignment=1,this.colorSpace=0,this.width=0,this.height=0,this.channels=0}function u(e,t){e.internalformat=t.internalformat,e.format=t.format,e.type=t.type,e.compressed=t.compressed,e.premultiplyAlpha=t.premultiplyAlpha,e.flipY=t.flipY,e.unpackAlignment=t.unpackAlignment,e.colorSpace=t.colorSpace,e.width=t.width,e.height=t.height,e.channels=t.channels}function s(e,n){if("object"==typeof n&&n){if("premultiplyAlpha"in n&&(Ae.type(n.premultiplyAlpha,"boolean","invalid premultiplyAlpha"),e.premultiplyAlpha=n.premultiplyAlpha),"flipY"in n&&(Ae.type(n.flipY,"boolean","invalid texture flip"),e.flipY=n.flipY),"alignment"in n&&(Ae.oneOf(n.alignment,[1,2,4,8],"invalid texture unpack alignment"),e.unpackAlignment=n.alignment),"colorSpace"in n&&(Ae.parameter(n.colorSpace,R,"invalid colorSpace"),e.colorSpace=R[n.colorSpace]),"type"in n){var a=n.type;Ae(t.oes_texture_float||!("float"===a||"float32"===a),"you must enable the OES_texture_float extension in order to use floating point textures."),Ae(t.oes_texture_half_float||!("half float"===a||"float16"===a),"you must enable the OES_texture_half_float extension in order to use 16-bit floating point textures."),Ae(t.webgl_depth_texture||!("uint16"===a||"uint32"===a||"depth stencil"===a),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),Ae.parameter(a,Q,"invalid texture type"),e.type=Q[a]}var i=e.width,o=e.height,f=e.channels,u=!1;"shape"in n?(Ae(Array.isArray(n.shape)&&n.shape.length>=2,"shape must be an array"),i=n.shape[0],o=n.shape[1],3===n.shape.length&&(f=n.shape[2],Ae(f>0&&f<=4,"invalid number of channels"),u=!0),Ae(i>=0&&i<=r.maxTextureSize,"invalid width"),Ae(o>=0&&o<=r.maxTextureSize,"invalid height")):("radius"in n&&(i=o=n.radius,Ae(i>=0&&i<=r.maxTextureSize,"invalid radius")),"width"in n&&(i=n.width,Ae(i>=0&&i<=r.maxTextureSize,"invalid width")),"height"in n&&(o=n.height,Ae(o>=0&&o<=r.maxTextureSize,"invalid height")),"channels"in n&&(f=n.channels,Ae(f>0&&f<=4,"invalid number of channels"),u=!0)),e.width=0|i,e.height=0|o,e.channels=0|f;var s=!1;if("format"in n){var c=n.format;Ae(t.webgl_depth_texture||!("depth"===c||"depth stencil"===c),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),Ae.parameter(c,V,"invalid texture format");var l=e.internalformat=V[c];e.format=re[l],c in Q&&("type"in n||(e.type=Q[c])),c in Y&&(e.compressed=!0),s=!0}!u&&s?e.channels=wr[e.format]:u&&!s?e.channels!==xr[e.format]&&(e.format=e.internalformat=xr[e.channels]):s&&u&&Ae(e.channels===wr[e.format],"number of channels inconsistent with specified format")}}function c(t){e.pixelStorei(pr,t.flipY),e.pixelStorei(hr,t.premultiplyAlpha),e.pixelStorei(br,t.colorSpace),e.pixelStorei(mr,t.unpackAlignment)}function l(){f.call(this),this.xOffset=0,this.yOffset=0,this.data=null,this.needsFree=!1,this.element=null,this.needsCopy=!1}function d(e,t){var n=null;if(H(t)?n=t:t&&(Ae.type(t,"object","invalid pixel data type"),s(e,t),"x"in t&&(e.xOffset=0|t.x),"y"in t&&(e.yOffset=0|t.y),H(t.data)&&(n=t.data)),Ae(!e.compressed||n instanceof Uint8Array,"compressed texture data must be stored in a uint8array"),t.copy){Ae(!n,"can not specify copy and data field for the same texture");var i=a.viewportWidth,o=a.viewportHeight;e.width=e.width||i-e.xOffset,e.height=e.height||o-e.yOffset,e.needsCopy=!0,Ae(e.xOffset>=0&&e.xOffset<i&&e.yOffset>=0&&e.yOffset<o&&e.width>0&&e.width<=i&&e.height>0&&e.height<=o,"copy texture read out of bounds")}else if(n){if(ue(n))e.channels=e.channels||4,e.data=n,"type"in t||e.type!==qt||(e.type=G(n));else if(L(n))e.channels=e.channels||4,function(e,t){var r=t.length;switch(e.type){case qt:case Qt:case Vt:case Yt:var n=Me.allocType(e.type,r);n.set(t),e.data=n;break;case Ft:e.data=B(t);break;default:Ae.raise("unsupported texture type, must specify a typed array")}}(e,n),e.alignment=1,e.needsFree=!0;else if(S(n)){var f=n.data;Array.isArray(f)||e.type!==qt||(e.type=G(f));var u,c,l,d,m,p,h=n.shape,b=n.stride;3===h.length?(l=h[2],p=b[2]):(Ae(2===h.length,"invalid ndarray pixel data, must be 2 or 3D"),l=1,p=1),u=h[0],c=h[1],d=b[0],m=b[1],e.alignment=1,e.width=u,e.height=c,e.channels=l,e.format=e.internalformat=xr[l],e.needsFree=!0,function(e,t,r,n,a,i){for(var o=e.width,f=e.height,u=e.channels,s=U(e,o*f*u),c=0,l=0;l<f;++l)for(var d=0;d<o;++d)for(var m=0;m<u;++m)s[c++]=t[r*d+n*l+a*m+i];N(e,s)}(e,f,d,m,p,n.offset)}else if(W(n)||function(e){return M(e)===Ar}(n))W(n)?e.element=n:e.element=n.canvas,e.width=e.element.width,e.height=e.element.height,e.channels=4;else if(function(e){return M(e)===Sr}(n))e.element=n,e.width=n.naturalWidth,e.height=n.naturalHeight,e.channels=4;else if(function(e){return M(e)===_r}(n))e.element=n,e.width=n.videoWidth,e.height=n.videoHeight,e.channels=4;else if(I(n)){var g=e.width||n[0].length,v=e.height||n.length,y=e.channels;y=P(n[0][0])?y||n[0][0].length:y||1;for(var x=We.shape(n),w=1,k=0;k<x.length;++k)w*=x[k];var A=U(e,w);We.flatten(n,x,"",A),N(e,A),e.alignment=1,e.width=g,e.height=v,e.channels=y,e.format=e.internalformat=xr[y],e.needsFree=!0}}else e.width=e.width||1,e.height=e.height||1,e.channels=e.channels||4;e.type===Yt?Ae(r.extensions.indexOf("oes_texture_float")>=0,"oes_texture_float extension not enabled"):e.type===Ft&&Ae(r.extensions.indexOf("oes_texture_half_float")>=0,"oes_texture_half_float extension not enabled")}function m(t,r,a){var i=t.element,o=t.data,f=t.internalformat,u=t.format,s=t.type,l=t.width,d=t.height;c(t),i?e.texImage2D(r,a,u,u,s,i):t.compressed?e.compressedTexImage2D(r,a,f,l,d,0,o):t.needsCopy?(n(),e.copyTexImage2D(r,a,u,t.xOffset,t.yOffset,l,d,0)):e.texImage2D(r,a,u,l,d,0,u,s,o)}function p(t,r,a,i,o){var f=t.element,u=t.data,s=t.internalformat,l=t.format,d=t.type,m=t.width,p=t.height;c(t),f?e.texSubImage2D(r,o,a,i,l,d,f):t.compressed?e.compressedTexSubImage2D(r,o,a,i,s,m,p,u):t.needsCopy?(n(),e.copyTexSubImage2D(r,o,a,i,t.xOffset,t.yOffset,m,p)):e.texSubImage2D(r,o,a,i,m,p,l,d,u)}function h(){return ne.pop()||new l}function b(e){e.needsFree&&Me.freeType(e.data),l.call(e),ne.push(e)}function g(e,t,r){var n=e.images[0]=h();e.mipmask=1,n.width=e.width=t,n.height=e.height=r,n.channels=e.channels=4}function v(e,t){var r=null;if(H(t))u(r=e.images[0]=h(),e),d(r,t),e.mipmask=1;else if(s(e,t),Array.isArray(t.mipmap))for(var n=t.mipmap,a=0;a<n.length;++a)u(r=e.images[a]=h(),e),r.width>>=a,r.height>>=a,d(r,n[a]),e.mipmask|=1<<a;else u(r=e.images[0]=h(),e),d(r,t),e.mipmask=1;u(e,e.images[0]),(e.compressed&&e.internalformat===zt||e.internalformat===Bt||e.internalformat===Pt||e.internalformat===Rt)&&Ae(e.width%4==0&&e.height%4==0,"for compressed texture formats, mipmap level 0 must have width and height that are a multiple of 4")}function y(e,t){for(var r=e.images,n=0;n<r.length;++n){if(!r[n])return;m(r[n],t,n)}}function x(){var e=ae.pop()||new function(){f.call(this),this.genMipmaps=!1,this.mipmapHint=sr,this.mipmask=0,this.images=Array(16)};f.call(e),e.mipmask=0;for(var t=0;t<16;++t)e.images[t]=null;return e}function w(e){for(var t=e.images,r=0;r<t.length;++r)t[r]&&b(t[r]),t[r]=null;ae.push(e)}function k(){this.minFilter=rr,this.magFilter=rr,this.wrapS=Jt,this.wrapT=Jt,this.anisotropic=1,this.genMipmaps=!1,this.mipmapHint=sr}function A(e,t){if("min"in t){var n=t.min;Ae.parameter(n,z),e.minFilter=z[n],yr.indexOf(e.minFilter)>=0&&(e.genMipmaps=!0)}if("mag"in t){var a=t.mag;Ae.parameter(a,F),e.magFilter=F[a]}var i=e.wrapS,o=e.wrapT;if("wrap"in t){var f=t.wrap;"string"==typeof f?(Ae.parameter(f,C),i=o=C[f]):Array.isArray(f)&&(Ae.parameter(f[0],C),Ae.parameter(f[1],C),i=C[f[0]],o=C[f[1]])}else{if("wrapS"in t){var u=t.wrapS;Ae.parameter(u,C),i=C[u]}if("wrapT"in t){var s=t.wrapT;Ae.parameter(s,C),o=C[s]}}if(e.wrapS=i,e.wrapT=o,"anisotropic"in t){var c=t.anisotropic;Ae("number"==typeof c&&c>=1&&c<=r.maxAnisotropic,"aniso samples must be between 1 and "),e.anisotropic=t.anisotropic}if("mipmap"in t){var l=!1;switch(typeof t.mipmap){case"string":Ae.parameter(t.mipmap,O,"invalid mipmap hint"),e.mipmapHint=O[t.mipmap],e.genMipmaps=!0,l=!0;break;case"boolean":l=e.genMipmaps=t.mipmap;break;case"object":Ae(Array.isArray(t.mipmap),"invalid mipmap type"),e.genMipmaps=!1,l=!0;break;default:Ae.raise("invalid mipmap type")}!l||"min"in t||(e.minFilter=ar)}}function _(r,n){e.texParameteri(n,tr,r.minFilter),e.texParameteri(n,er,r.magFilter),e.texParameteri(n,Xt,r.wrapS),e.texParameteri(n,$t,r.wrapT),t.ext_texture_filter_anisotropic&&e.texParameteri(n,dr,r.anisotropic),r.genMipmaps&&(e.hint(ur,r.mipmapHint),e.generateMipmap(n))}function E(t){f.call(this),this.mipmask=0,this.internalformat=bt,this.id=ie++,this.refCount=1,this.target=t,this.texture=e.createTexture(),this.unit=-1,this.bindCount=0,this.texInfo=new k,o.profile&&(this.stats={size:0})}function T(t){e.activeTexture(vr),e.bindTexture(t.target,t.texture)}function D(){var t=ce[0];t?e.bindTexture(t.target,t.texture):e.bindTexture(mt,null)}function j(t){var r=t.texture;Ae(r,"must not double destroy texture");var n=t.unit,a=t.target;n>=0&&(e.activeTexture(vr+n),e.bindTexture(a,null),ce[n]=null),e.deleteTexture(r),t.texture=null,t.params=null,t.pixels=null,t.refCount=0,delete oe[t.id],i.textureCount--}var O={"don't care":sr,"dont care":sr,nice:lr,fast:cr},C={repeat:Kt,clamp:Jt,mirror:Zt},F={nearest:rr,linear:nr},z=se({mipmap:fr,"nearest mipmap nearest":ar,"linear mipmap nearest":ir,"nearest mipmap linear":or,"linear mipmap linear":fr},F),R={none:0,browser:gr},Q={uint8:qt,rgba4:St,rgb565:Et,"rgb5 a1":_t},V={alpha:gt,luminance:yt,"luminance alpha":xt,rgb:vt,rgba:bt,rgba4:wt,"rgb5 a1":kt,rgb565:At},Y={};t.ext_srgb&&(V.srgb=Ot,V.srgba=Ct),t.oes_texture_float&&(Q.float32=Q.float=Yt),t.oes_texture_half_float&&(Q.float16=Q["half float"]=Ft),t.webgl_depth_texture&&(se(V,{depth:Dt,"depth stencil":jt}),se(Q,{uint16:Qt,uint32:Vt,"depth stencil":Tt})),t.webgl_compressed_texture_s3tc&&se(Y,{"rgb s3tc dxt1":zt,"rgba s3tc dxt1":Bt,"rgba s3tc dxt3":Pt,"rgba s3tc dxt5":Rt}),t.webgl_compressed_texture_atc&&se(Y,{"rgb atc":Lt,"rgba atc explicit alpha":It,"rgba atc interpolated alpha":Mt}),t.webgl_compressed_texture_pvrtc&&se(Y,{"rgb pvrtc 4bppv1":Wt,"rgb pvrtc 2bppv1":Ht,"rgba pvrtc 4bppv1":Gt,"rgba pvrtc 2bppv1":Ut}),t.webgl_compressed_texture_etc1&&(Y["rgb etc1"]=Nt);var X=Array.prototype.slice.call(e.getParameter(dt));Object.keys(Y).forEach(function(e){var t=Y[e];X.indexOf(t)>=0&&(V[e]=t)});var $=Object.keys(V);r.textureFormats=$;var K=[];Object.keys(V).forEach(function(e){var t=V[e];K[t]=e});var J=[];Object.keys(Q).forEach(function(e){var t=Q[e];J[t]=e});var Z=[];Object.keys(F).forEach(function(e){var t=F[e];Z[t]=e});var ee=[];Object.keys(z).forEach(function(e){var t=z[e];ee[t]=e});var te=[];Object.keys(C).forEach(function(e){var t=C[e];te[t]=e});var re=$.reduce(function(e,t){var r=V[t];return r===yt||r===gt||r===yt||r===xt||r===Dt||r===jt?e[r]=r:r===kt||t.indexOf("rgba")>=0?e[r]=bt:e[r]=vt,e},{}),ne=[],ae=[],ie=0,oe={},fe=r.maxTextureUnits,ce=Array(fe).map(function(){return null});return se(E.prototype,{bind:function(){this.bindCount+=1;var t=this.unit;if(t<0){for(var r=0;r<fe;++r){var n=ce[r];if(n){if(n.bindCount>0)continue;n.unit=-1}ce[r]=this,t=r;break}t>=fe&&Ae.raise("insufficient number of texture units"),o.profile&&i.maxTextureUnits<t+1&&(i.maxTextureUnits=t+1),this.unit=t,e.activeTexture(vr+t),e.bindTexture(this.target,this.texture)}return t},unbind:function(){this.bindCount-=1},decRef:function(){--this.refCount<=0&&j(this)}}),o.profile&&(i.getTotalTextureSize=function(){var e=0;return Object.keys(oe).forEach(function(t){e+=oe[t].stats.size}),e}),{create2D:function(t,n){function a(e,t){var n=f.texInfo;k.call(n);var i=x();return"number"==typeof e?g(i,0|e,"number"==typeof t?0|t:0|e):e?(Ae.type(e,"object","invalid arguments to regl.texture"),A(n,e),v(i,e)):g(i,1,1),n.genMipmaps&&(i.mipmask=(i.width<<1)-1),f.mipmask=i.mipmask,u(f,i),Ae.texture2D(n,i,r),f.internalformat=i.internalformat,a.width=i.width,a.height=i.height,T(f),y(i,mt),_(n,mt),D(),w(i),o.profile&&(f.stats.size=q(f.internalformat,f.type,i.width,i.height,n.genMipmaps,!1)),a.format=K[f.internalformat],a.type=J[f.type],a.mag=Z[n.magFilter],a.min=ee[n.minFilter],a.wrapS=te[n.wrapS],a.wrapT=te[n.wrapT],a}var f=new E(mt);return oe[f.id]=f,i.textureCount++,a(t,n),a.subimage=function(e,t,r,n){Ae(!!e,"must specify image data");var i=0|t,o=0|r,s=0|n,c=h();return u(c,f),c.width=0,c.height=0,d(c,e),c.width=c.width||(f.width>>s)-i,c.height=c.height||(f.height>>s)-o,Ae(f.type===c.type&&f.format===c.format&&f.internalformat===c.internalformat,"incompatible format for texture.subimage"),Ae(i>=0&&o>=0&&i+c.width<=f.width&&o+c.height<=f.height,"texture.subimage write out of bounds"),Ae(f.mipmask&1<<s,"missing mipmap data"),Ae(c.data||c.element||c.needsCopy,"missing image data"),T(f),p(c,mt,i,o,s),D(),b(c),a},a.resize=function(t,r){var n=0|t,i=0|r||n;if(n===f.width&&i===f.height)return a;a.width=f.width=n,a.height=f.height=i,T(f);for(var u=0;f.mipmask>>u;++u)e.texImage2D(mt,u,f.format,n>>u,i>>u,0,f.format,f.type,null);return D(),o.profile&&(f.stats.size=q(f.internalformat,f.type,n,i,!1,!1)),a},a._reglType="texture2d",a._texture=f,o.profile&&(a.stats=f.stats),a.destroy=function(){f.decRef()},a},createCube:function(t,n,a,f,c,l){function m(e,t,n,a,i,f){var c,l=S.texInfo;for(k.call(l),c=0;c<6;++c)j[c]=x();if("number"!=typeof e&&e)if("object"==typeof e)if(t)v(j[0],e),v(j[1],t),v(j[2],n),v(j[3],a),v(j[4],i),v(j[5],f);else if(A(l,e),s(S,e),"faces"in e){var d=e.faces;for(Ae(Array.isArray(d)&&6===d.length,"cube faces must be a length 6 array"),c=0;c<6;++c)Ae("object"==typeof d[c]&&!!d[c],"invalid input for cube map face"),u(j[c],S),v(j[c],d[c])}else for(c=0;c<6;++c)v(j[c],e);else Ae.raise("invalid arguments to cube map");else{var p=0|e||1;for(c=0;c<6;++c)g(j[c],p,p)}for(u(S,j[0]),l.genMipmaps?S.mipmask=(j[0].width<<1)-1:S.mipmask=j[0].mipmask,Ae.textureCube(S,l,j,r),S.internalformat=j[0].internalformat,m.width=j[0].width,m.height=j[0].height,T(S),c=0;c<6;++c)y(j[c],ht+c);for(_(l,pt),D(),o.profile&&(S.stats.size=q(S.internalformat,S.type,m.width,m.height,l.genMipmaps,!0)),m.format=K[S.internalformat],m.type=J[S.type],m.mag=Z[l.magFilter],m.min=ee[l.minFilter],m.wrapS=te[l.wrapS],m.wrapT=te[l.wrapT],c=0;c<6;++c)w(j[c]);return m}var S=new E(pt);oe[S.id]=S,i.cubeCount++;var j=new Array(6);return m(t,n,a,f,c,l),m.subimage=function(e,t,r,n,a){Ae(!!t,"must specify image data"),Ae("number"==typeof e&&e===(0|e)&&e>=0&&e<6,"invalid face");var i=0|r,o=0|n,f=0|a,s=h();return u(s,S),s.width=0,s.height=0,d(s,t),s.width=s.width||(S.width>>f)-i,s.height=s.height||(S.height>>f)-o,Ae(S.type===s.type&&S.format===s.format&&S.internalformat===s.internalformat,"incompatible format for texture.subimage"),Ae(i>=0&&o>=0&&i+s.width<=S.width&&o+s.height<=S.height,"texture.subimage write out of bounds"),Ae(S.mipmask&1<<f,"missing mipmap data"),Ae(s.data||s.element||s.needsCopy,"missing image data"),T(S),p(s,ht+e,i,o,f),D(),b(s),m},m.resize=function(t){var r=0|t;if(r!==S.width){m.width=S.width=r,m.height=S.height=r,T(S);for(var n=0;n<6;++n)for(var a=0;S.mipmask>>a;++a)e.texImage2D(ht+n,a,S.format,r>>a,r>>a,0,S.format,S.type,null);return D(),o.profile&&(S.stats.size=q(S.internalformat,S.type,m.width,m.height,!1,!0)),m}},m._reglType="textureCube",m._texture=S,o.profile&&(m.stats=S.stats),m.destroy=function(){S.decRef()},m},clear:function(){for(var t=0;t<fe;++t)e.activeTexture(vr+t),e.bindTexture(mt,null),ce[t]=null;Oe(oe).forEach(j),i.cubeCount=0,i.textureCount=0},getTexture:function(e){return null},restore:function(){Oe(oe).forEach(function(t){t.texture=e.createTexture(),e.bindTexture(t.target,t.texture);for(var r=0;r<32;++r)if(0!=(t.mipmask&1<<r))if(t.target===mt)e.texImage2D(mt,r,t.internalformat,t.width>>r,t.height>>r,0,t.internalformat,t.type,null);else for(var n=0;n<6;++n)e.texImage2D(ht+n,r,t.internalformat,t.width>>r,t.height>>r,0,t.internalformat,t.type,null);_(t.texInfo,t.target)})}}}function V(e,t,r){return Cr[e]*t*r}function Y(){this.state=0,this.x=0,this.y=0,this.z=0,this.w=0,this.buffer=null,this.size=0,this.normalized=!1,this.type=Kr,this.offset=0,this.stride=0,this.divisor=0}function X(e,t,r,n){function a(e,t,r,n){this.name=e,this.id=t,this.location=r,this.info=n}function i(e,t){for(var r=0;r<e.length;++r)if(e[r].id===t.id)return void(e[r].location=t.location);e.push(t)}function o(r,n,a){var i=r===Jr?u:s,o=i[n];if(!o){var f=t.str(n);o=e.createShader(r),e.shaderSource(o,f),e.compileShader(o),Ae.shaderError(e,o,f,r,a),i[n]=o}return o}function f(r,f){var u,s,c=o(Jr,r.fragId),l=o(Zr,r.vertId),d=r.program=e.createProgram();e.attachShader(d,c),e.attachShader(d,l),e.linkProgram(d),Ae.linkError(e,d,t.str(r.fragId),t.str(r.vertId),f);var m=e.getProgramParameter(d,en);n.profile&&(r.stats.uniformsCount=m);var p=r.uniforms;for(u=0;u<m;++u)if(s=e.getActiveUniform(d,u))if(s.size>1)for(var h=0;h<s.size;++h){var b=s.name.replace("[0]","["+h+"]");i(p,new a(b,t.id(b),e.getUniformLocation(d,b),s))}else i(p,new a(s.name,t.id(s.name),e.getUniformLocation(d,s.name),s));var g=e.getProgramParameter(d,tn);n.profile&&(r.stats.attributesCount=g);var v=r.attributes;for(u=0;u<g;++u)(s=e.getActiveAttrib(d,u))&&i(v,new a(s.name,t.id(s.name),e.getAttribLocation(d,s.name),s))}var u={},s={},c={},l=[],d=0;return n.profile&&(r.getMaxUniformsCount=function(){var e=0;return l.forEach(function(t){t.stats.uniformsCount>e&&(e=t.stats.uniformsCount)}),e},r.getMaxAttributesCount=function(){var e=0;return l.forEach(function(t){t.stats.attributesCount>e&&(e=t.stats.attributesCount)}),e}),{clear:function(){var t=e.deleteShader.bind(e);Oe(u).forEach(t),u={},Oe(s).forEach(t),s={},l.forEach(function(t){e.deleteProgram(t.program)}),l.length=0,c={},r.shaderCount=0},program:function(e,t,a){Ae.command(e>=0,"missing vertex shader",a),Ae.command(t>=0,"missing fragment shader",a);var i=c[t];i||(i=c[t]={});var o=i[e];return o||(o=new function(e,t){this.id=d++,this.fragId=e,this.vertId=t,this.program=null,this.uniforms=[],this.attributes=[],n.profile&&(this.stats={uniformsCount:0,attributesCount:0})}(t,e),r.shaderCount++,f(o,a),i[e]=o,l.push(o)),o},restore:function(){u={},s={};for(var e=0;e<l.length;++e)f(l[e])},shader:o,frag:-1,vert:-1}}function $(e,t,r,n,a,i){function o(o){var f;null===t.next?(Ae(a.preserveDrawingBuffer,'you must create a webgl context with "preserveDrawingBuffer":true in order to read pixels from the drawing buffer'),f=nn):(Ae(null!==t.next.colorAttachments[0].texture,"You cannot read from a renderbuffer"),f=t.next.colorAttachments[0].texture._texture.type,i.oes_texture_float?Ae(f===nn||f===on,"Reading from a framebuffer is only allowed for the types 'uint8' and 'float'"):Ae(f===nn,"Reading from a framebuffer is only allowed for the type 'uint8'"));var u=0,s=0,c=n.framebufferWidth,l=n.framebufferHeight,d=null;ue(o)?d=o:o&&(Ae.type(o,"object","invalid arguments to regl.read()"),u=0|o.x,s=0|o.y,Ae(u>=0&&u<n.framebufferWidth,"invalid x offset for regl.read"),Ae(s>=0&&s<n.framebufferHeight,"invalid y offset for regl.read"),c=0|(o.width||n.framebufferWidth-u),l=0|(o.height||n.framebufferHeight-s),d=o.data||null),d&&(f===nn?Ae(d instanceof Uint8Array,"buffer must be 'Uint8Array' when reading from a framebuffer of type 'uint8'"):f===on&&Ae(d instanceof Float32Array,"buffer must be 'Float32Array' when reading from a framebuffer of type 'float'")),Ae(c>0&&c+u<=n.framebufferWidth,"invalid width for read pixels"),Ae(l>0&&l+s<=n.framebufferHeight,"invalid height for read pixels"),r();var m=c*l*4;return d||(f===nn?d=new Uint8Array(m):f===on&&(d=d||new Float32Array(m))),Ae.isTypedArray(d,"data buffer for regl.read() must be a typedarray"),Ae(d.byteLength>=m,"data buffer for regl.read() too small"),e.pixelStorei(an,4),e.readPixels(u,s,c,l,rn,f,d),d}return function(e){return e&&"framebuffer"in e?function(e){var r;return t.setFBO({framebuffer:e.framebuffer},function(){r=o(e)}),r}(e):o(e)}}function K(e){return Array.prototype.slice.call(e)}function J(e){return K(e).join("")}function Z(e){return Array.isArray(e)||ue(e)||S(e)}function ee(e){return e.sort(function(e,t){return e===Gn?-1:t===Gn?1:e<t?-1:1})}function te(e,t,r,n){this.thisDep=e,this.contextDep=t,this.propDep=r,this.append=n}function re(e){return e&&!(e.thisDep||e.contextDep||e.propDep)}function ne(e){return new te(!1,!1,!1,e)}function ae(e,t){var r=e.type;if(r===ln){var n=e.data.length;return new te(!0,n>=1,n>=2,t)}if(r===hn){var a=e.data;return new te(a.thisDep,a.contextDep,a.propDep,t)}return new te(r===pn,r===mn,r===dn,t)}function ie(e,t,r,n,a,i,o,f,u,s,c,l,d,m,p){function h(e){return e.replace(".","_")}function b(e,t,r){var n=h(e);G.push(e),H[n]=W[n]=!!r,U[n]=t}function g(e,t,r){var n=h(e);G.push(e),Array.isArray(r)?(W[n]=r.slice(),H[n]=r.slice()):W[n]=H[n]=r,N[n]=t}function v(){var e=function(){function e(){var e=[],t=[];return se(function(){e.push.apply(e,K(arguments))},{def:function(){var n="v"+r++;return t.push(n),arguments.length>0&&(e.push(n,"="),e.push.apply(e,K(arguments)),e.push(";")),n},toString:function(){return J([t.length>0?"var "+t+";":"",J(e)])}})}function t(){function t(e,t){n(e,t,"=",r.def(e,t),";")}var r=e(),n=e(),a=r.toString,i=n.toString;return se(function(){r.apply(r,K(arguments))},{def:r.def,entry:r,exit:n,save:t,set:function(e,n,a){t(e,n),r(e,n,"=",a,";")},toString:function(){return a()+i()}})}var r=0,n=[],a=[],i=e(),o={};return{global:i,link:function(e){for(var t=0;t<a.length;++t)if(a[t]===e)return n[t];var i="g"+r++;return n.push(i),a.push(e),i},block:e,proc:function(e,r){function n(){var e="a"+a.length;return a.push(e),e}var a=[];r=r||0;for(var i=0;i<r;++i)n();var f=t(),u=f.toString;return o[e]=se(f,{arg:n,toString:function(){return J(["function(",a.join(),"){",u(),"}"])}})},scope:t,cond:function(){var e=J(arguments),r=t(),n=t(),a=r.toString,i=n.toString;return se(r,{then:function(){return r.apply(r,K(arguments)),this},else:function(){return n.apply(n,K(arguments)),this},toString:function(){var t=i();return t&&(t="else{"+t+"}"),J(["if(",e,"){",a(),"}",t])}})},compile:function(){var e=['"use strict";',i,"return {"];Object.keys(o).forEach(function(t){e.push('"',t,'":',o[t].toString(),",")}),e.push("}");var t=J(e).replace(/;/g,";\n").replace(/}/g,"}\n").replace(/{/g,"{\n");return Function.apply(null,n.concat(t)).apply(null,a)}}}(),r=e.link,n=e.global;e.id=V++,e.batchId="0";var a=r(q),i=e.shared={props:"a0"};Object.keys(q).forEach(function(e){i[e]=n.def(a,".",e)}),Ae.optional(function(){e.CHECK=r(Ae),e.commandStr=Ae.guessCommand(),e.command=r(e.commandStr),e.assert=function(e,t,n){e("if(!(",t,"))",this.CHECK,".commandRaise(",r(n),",",this.command,");")},Q.invalidBlendCombinations=Ka});var o=e.next={},f=e.current={};Object.keys(N).forEach(function(e){Array.isArray(W[e])&&(o[e]=n.def(i.next,".",e),f[e]=n.def(i.current,".",e))});var u=e.constants={};Object.keys(Q).forEach(function(e){u[e]=n.def(JSON.stringify(Q[e]))}),e.invoke=function(t,n){switch(n.type){case ln:var a=["this",i.context,i.props,e.batchId];return t.def(r(n.data),".call(",a.slice(0,Math.max(n.data.length+1,4)),")");case dn:return t.def(i.props,n.data);case mn:return t.def(i.context,n.data);case pn:return t.def("this",n.data);case hn:return n.data.append(e,t),n.data.ref}},e.attribCache={};var c={};return e.scopeAttrib=function(e){var n=t.id(e);if(n in c)return c[n];var a=s.scope[n];a||(a=s.scope[n]=new R);return c[n]=r(a)},e}function y(e,r,o,u,s){function l(e){var t=b[e];t&&(v[e]=t)}var d=e.static,m=e.dynamic;Ae.optional(function(){function e(e){Object.keys(e).forEach(function(e){Ae.command(t.indexOf(e)>=0,'unknown parameter "'+e+'"',s.commandStr)})}var t=[Nn,qn,Qn,Vn,Yn,$n,Xn,Kn,Un].concat(G);e(d),e(m)});var p=function(e,t){var r=e.static,n=e.dynamic;if(Nn in r){var a=r[Nn];return a?(a=f.getFramebuffer(a),Ae.command(a,"invalid framebuffer object"),ne(function(e,t){var r=e.link(a),n=e.shared;t.set(n.framebuffer,".next",r);var i=n.context;return t.set(i,"."+Jn,r+".width"),t.set(i,"."+Zn,r+".height"),r})):ne(function(e,t){var r=e.shared;t.set(r.framebuffer,".next","null");var n=r.context;return t.set(n,"."+Jn,n+"."+ra),t.set(n,"."+Zn,n+"."+na),"null"})}if(Nn in n){var i=n[Nn];return ae(i,function(e,t){var r=e.invoke(t,i),n=e.shared,a=n.framebuffer,o=t.def(a,".getFramebuffer(",r,")");Ae.optional(function(){e.assert(t,"!"+r+"||"+o,"invalid framebuffer object")}),t.set(a,".next",o);var f=n.context;return t.set(f,"."+Jn,o+"?"+o+".width:"+f+"."+ra),t.set(f,"."+Zn,o+"?"+o+".height:"+f+"."+na),o})}return null}(e),b=function(e,t,r){function n(e){if(e in a){var n=a[e];Ae.commandType(n,"object","invalid "+e,r.commandStr);var o,f,u=!0,s=0|n.x,c=0|n.y;return"width"in n?(o=0|n.width,Ae.command(o>=0,"invalid "+e,r.commandStr)):u=!1,"height"in n?(f=0|n.height,Ae.command(f>=0,"invalid "+e,r.commandStr)):u=!1,new te(!u&&t&&t.thisDep,!u&&t&&t.contextDep,!u&&t&&t.propDep,function(e,t){var r=e.shared.context,a=o;"width"in n||(a=t.def(r,".",Jn,"-",s));var i=f;return"height"in n||(i=t.def(r,".",Zn,"-",c)),[s,c,a,i]})}if(e in i){var l=i[e],d=ae(l,function(t,r){var n=t.invoke(r,l);Ae.optional(function(){t.assert(r,n+"&&typeof "+n+'==="object"',"invalid "+e)});var a=t.shared.context,i=r.def(n,".x|0"),o=r.def(n,".y|0"),f=r.def('"width" in ',n,"?",n,".width|0:","(",a,".",Jn,"-",i,")"),u=r.def('"height" in ',n,"?",n,".height|0:","(",a,".",Zn,"-",o,")");return Ae.optional(function(){t.assert(r,f+">=0&&"+u+">=0","invalid "+e)}),[i,o,f,u]});return t&&(d.thisDep=d.thisDep||t.thisDep,d.contextDep=d.contextDep||t.contextDep,d.propDep=d.propDep||t.propDep),d}return t?new te(t.thisDep,t.contextDep,t.propDep,function(e,t){var r=e.shared.context;return[0,0,t.def(r,".",Jn),t.def(r,".",Zn)]}):null}var a=e.static,i=e.dynamic,o=n(Gn);if(o){var f=o;o=new te(o.thisDep,o.contextDep,o.propDep,function(e,t){var r=f.append(e,t),n=e.shared.context;return t.set(n,"."+ea,r[2]),t.set(n,"."+ta,r[3]),r})}return{viewport:o,scissor_box:n(Hn)}}(e,p,s),g=function(e,t){function r(e,r){if(e in n){var i=0|n[e];return Ae.command(!r||i>=0,"invalid "+e,t.commandStr),ne(function(e,t){return r&&(e.OFFSET=i),i})}if(e in a){var f=a[e];return ae(f,function(t,n){var a=t.invoke(n,f);return r&&(t.OFFSET=a,Ae.optional(function(){t.assert(n,a+">=0","invalid "+e)})),a})}return r&&o?ne(function(e,t){return e.OFFSET="0",0}):null}var n=e.static,a=e.dynamic,o=function(){if(Vn in n){var e=n[Vn];Z(e)?e=i.getElements(i.create(e,!0)):e&&(e=i.getElements(e),Ae.command(e,"invalid elements",t.commandStr));var r=ne(function(t,r){if(e){var n=t.link(e);return t.ELEMENTS=n,n}return t.ELEMENTS=null,null});return r.value=e,r}if(Vn in a){var o=a[Vn];return ae(o,function(e,t){var r=e.shared,n=r.isBufferArgs,a=r.elements,i=e.invoke(t,o),f=t.def("null"),u=t.def(n,"(",i,")"),s=e.cond(u).then(f,"=",a,".createStream(",i,");").else(f,"=",a,".getElements(",i,");");return Ae.optional(function(){e.assert(s.else,"!"+i+"||"+f,"invalid elements")}),t.entry(s),t.exit(e.cond(u).then(a,".destroyStream(",f,");")),e.ELEMENTS=f,f})}return null}(),f=r($n,!0);return{elements:o,primitive:function(){if(Yn in n){var e=n[Yn];return Ae.commandParameter(e,$e,"invalid primitve",t.commandStr),ne(function(t,r){return $e[e]})}if(Yn in a){var r=a[Yn];return ae(r,function(e,t){var n=e.constants.primTypes,a=e.invoke(t,r);return Ae.optional(function(){e.assert(t,a+" in "+n,"invalid primitive, must be one of "+Object.keys($e))}),t.def(n,"[",a,"]")})}return o?re(o)?o.value?ne(function(e,t){return t.def(e.ELEMENTS,".primType")}):ne(function(){return Pa}):new te(o.thisDep,o.contextDep,o.propDep,function(e,t){var r=e.ELEMENTS;return t.def(r,"?",r,".primType:",Pa)}):null}(),count:function(){if(Xn in n){var e=0|n[Xn];return Ae.command("number"==typeof e&&e>=0,"invalid vertex count",t.commandStr),ne(function(){return e})}if(Xn in a){var r=a[Xn];return ae(r,function(e,t){var n=e.invoke(t,r);return Ae.optional(function(){e.assert(t,"typeof "+n+'==="number"&&'+n+">=0&&"+n+"===("+n+"|0)","invalid vertex count")}),n})}if(o){if(re(o)){if(o)return f?new te(f.thisDep,f.contextDep,f.propDep,function(e,t){var r=t.def(e.ELEMENTS,".vertCount-",e.OFFSET);return Ae.optional(function(){e.assert(t,r+">=0","invalid vertex offset/element buffer too small")}),r}):ne(function(e,t){return t.def(e.ELEMENTS,".vertCount")});var i=ne(function(){return-1});return Ae.optional(function(){i.MISSING=!0}),i}var u=new te(o.thisDep||f.thisDep,o.contextDep||f.contextDep,o.propDep||f.propDep,function(e,t){var r=e.ELEMENTS;return e.OFFSET?t.def(r,"?",r,".vertCount-",e.OFFSET,":-1"):t.def(r,"?",r,".vertCount:-1")});return Ae.optional(function(){u.DYNAMIC=!0}),u}return null}(),instances:r(Kn,!1),offset:f}}(e,s),v=function(e,t){var r=e.static,a=e.dynamic,i={};return G.forEach(function(e){function o(t,n){if(e in r){var o=t(r[e]);i[f]=ne(function(){return o})}else if(e in a){var u=a[e];i[f]=ae(u,function(e,t){return n(e,t,e.invoke(t,u))})}}var f=h(e);switch(e){case En:case gn:case bn:case Pn:case wn:case Wn:case On:case Fn:case zn:case Sn:return o(function(r){return Ae.commandType(r,"boolean",e,t.commandStr),r},function(t,r,n){return Ae.optional(function(){t.assert(r,"typeof "+n+'==="boolean"',"invalid flag "+e,t.commandStr)}),n});case kn:return o(function(r){return Ae.commandParameter(r,Ja,"invalid "+e,t.commandStr),Ja[r]},function(t,r,n){var a=t.constants.compareFuncs;return Ae.optional(function(){t.assert(r,n+" in "+a,"invalid "+e+", must be one of "+Object.keys(Ja))}),r.def(a,"[",n,"]")});case An:return o(function(e){return Ae.command(P(e)&&2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]&&e[0]<=e[1],"depth range is 2d array",t.commandStr),e},function(e,t,r){return Ae.optional(function(){e.assert(t,e.shared.isArrayLike+"("+r+")&&"+r+".length===2&&typeof "+r+'[0]==="number"&&typeof '+r+'[1]==="number"&&'+r+"[0]<="+r+"[1]","depth range must be a 2d array")}),[t.def("+",r,"[0]"),t.def("+",r,"[1]")]});case xn:return o(function(e){Ae.commandType(e,"object","blend.func",t.commandStr);var r="srcRGB"in e?e.srcRGB:e.src,n="srcAlpha"in e?e.srcAlpha:e.src,a="dstRGB"in e?e.dstRGB:e.dst,i="dstAlpha"in e?e.dstAlpha:e.dst;return Ae.commandParameter(r,$a,f+".srcRGB",t.commandStr),Ae.commandParameter(n,$a,f+".srcAlpha",t.commandStr),Ae.commandParameter(a,$a,f+".dstRGB",t.commandStr),Ae.commandParameter(i,$a,f+".dstAlpha",t.commandStr),Ae.command(-1===Ka.indexOf(r+", "+a),"unallowed blending combination (srcRGB, dstRGB) = ("+r+", "+a+")",t.commandStr),[$a[r],$a[a],$a[n],$a[i]]},function(t,r,n){function a(a,o){var f=r.def('"',a,o,'" in ',n,"?",n,".",a,o,":",n,".",a);return Ae.optional(function(){t.assert(r,f+" in "+i,"invalid "+e+"."+a+o+", must be one of "+Object.keys($a))}),f}var i=t.constants.blendFuncs;Ae.optional(function(){t.assert(r,n+"&&typeof "+n+'==="object"',"invalid blend func, must be an object")});var o=a("src","RGB"),f=a("dst","RGB");Ae.optional(function(){var e=t.constants.invalidBlendCombinations;t.assert(r,e+".indexOf("+o+'+", "+'+f+") === -1 ","unallowed blending combination for (srcRGB, dstRGB)")});var u=r.def(i,"[",o,"]"),s=r.def(i,"[",a("src","Alpha"),"]");return[u,r.def(i,"[",f,"]"),s,r.def(i,"[",a("dst","Alpha"),"]")]});case yn:return o(function(r){return"string"==typeof r?(Ae.commandParameter(r,L,"invalid "+e,t.commandStr),[L[r],L[r]]):"object"==typeof r?(Ae.commandParameter(r.rgb,L,e+".rgb",t.commandStr),Ae.commandParameter(r.alpha,L,e+".alpha",t.commandStr),[L[r.rgb],L[r.alpha]]):void Ae.commandRaise("invalid blend.equation",t.commandStr)},function(t,r,n){var a=t.constants.blendEquations,i=r.def(),o=r.def(),f=t.cond("typeof ",n,'==="string"');return Ae.optional(function(){function r(e,r,n){t.assert(e,n+" in "+a,"invalid "+r+", must be one of "+Object.keys(L))}r(f.then,e,n),t.assert(f.else,n+"&&typeof "+n+'==="object"',"invalid "+e),r(f.else,e+".rgb",n+".rgb"),r(f.else,e+".alpha",n+".alpha")}),f.then(i,"=",o,"=",a,"[",n,"];"),f.else(i,"=",a,"[",n,".rgb];",o,"=",a,"[",n,".alpha];"),r(f),[i,o]});case vn:return o(function(e){return Ae.command(P(e)&&4===e.length,"blend.color must be a 4d array",t.commandStr),_(4,function(t){return+e[t]})},function(e,t,r){return Ae.optional(function(){e.assert(t,e.shared.isArrayLike+"("+r+")&&"+r+".length===4","blend.color must be a 4d array")}),_(4,function(e){return t.def("+",r,"[",e,"]")})});case Rn:return o(function(e){return Ae.commandType(e,"number",f,t.commandStr),0|e},function(e,t,r){return Ae.optional(function(){e.assert(t,"typeof "+r+'==="number"',"invalid stencil.mask")}),t.def(r,"|0")});case Ln:return o(function(r){Ae.commandType(r,"object",f,t.commandStr);var n=r.cmp||"keep",a=r.ref||0,i="mask"in r?r.mask:-1;return Ae.commandParameter(n,Ja,e+".cmp",t.commandStr),Ae.commandType(a,"number",e+".ref",t.commandStr),Ae.commandType(i,"number",e+".mask",t.commandStr),[Ja[n],a,i]},function(e,t,r){var n=e.constants.compareFuncs;return Ae.optional(function(){function a(){e.assert(t,Array.prototype.join.call(arguments,""),"invalid stencil.func")}a(r+"&&typeof ",r,'==="object"'),a('!("cmp" in ',r,")||(",r,".cmp in ",n,")")}),[t.def('"cmp" in ',r,"?",n,"[",r,".cmp]",":",Ua),t.def(r,".ref|0"),t.def('"mask" in ',r,"?",r,".mask|0:-1")]});case In:case Mn:return o(function(r){Ae.commandType(r,"object",f,t.commandStr);var n=r.fail||"keep",a=r.zfail||"keep",i=r.zpass||"keep";return Ae.commandParameter(n,Za,e+".fail",t.commandStr),Ae.commandParameter(a,Za,e+".zfail",t.commandStr),Ae.commandParameter(i,Za,e+".zpass",t.commandStr),[e===Mn?La:Ra,Za[n],Za[a],Za[i]]},function(t,r,n){function a(a){return Ae.optional(function(){t.assert(r,'!("'+a+'" in '+n+")||("+n+"."+a+" in "+i+")","invalid "+e+"."+a+", must be one of "+Object.keys(Za))}),r.def('"',a,'" in ',n,"?",i,"[",n,".",a,"]:",Ua)}var i=t.constants.stencilOps;return Ae.optional(function(){t.assert(r,n+"&&typeof "+n+'==="object"',"invalid "+e)}),[e===Mn?La:Ra,a("fail"),a("zfail"),a("zpass")]});case Cn:return o(function(e){Ae.commandType(e,"object",f,t.commandStr);var r=0|e.factor,n=0|e.units;return Ae.commandType(r,"number",f+".factor",t.commandStr),Ae.commandType(n,"number",f+".units",t.commandStr),[r,n]},function(t,r,n){return Ae.optional(function(){t.assert(r,n+"&&typeof "+n+'==="object"',"invalid "+e)}),[r.def(n,".factor|0"),r.def(n,".units|0")]});case Tn:return o(function(e){var r=0;return"front"===e?r=Ra:"back"===e&&(r=La),Ae.command(!!r,f,t.commandStr),r},function(e,t,r){return Ae.optional(function(){e.assert(t,r+'==="front"||'+r+'==="back"',"invalid cull.face")}),t.def(r,'==="front"?',Ra,":",La)});case jn:return o(function(e){return Ae.command("number"==typeof e&&e>=n.lineWidthDims[0]&&e<=n.lineWidthDims[1],"invalid line width, must positive number between "+n.lineWidthDims[0]+" and "+n.lineWidthDims[1],t.commandStr),e},function(e,t,r){return Ae.optional(function(){e.assert(t,"typeof "+r+'==="number"&&'+r+">="+n.lineWidthDims[0]+"&&"+r+"<="+n.lineWidthDims[1],"invalid line width")}),r});case Dn:return o(function(e){return Ae.commandParameter(e,ti,f,t.commandStr),ti[e]},function(e,t,r){return Ae.optional(function(){e.assert(t,r+'==="cw"||'+r+'==="ccw"',"invalid frontFace, must be one of cw,ccw")}),t.def(r+'==="cw"?'+Ia+":"+Ma)});case _n:return o(function(e){return Ae.command(P(e)&&4===e.length,"color.mask must be length 4 array",t.commandStr),e.map(function(e){return!!e})},function(e,t,r){return Ae.optional(function(){e.assert(t,e.shared.isArrayLike+"("+r+")&&"+r+".length===4","invalid color.mask")}),_(4,function(e){return"!!"+r+"["+e+"]"})});case Bn:return o(function(e){Ae.command("object"==typeof e&&e,f,t.commandStr);var r="value"in e?e.value:1,n=!!e.invert;return Ae.command("number"==typeof r&&r>=0&&r<=1,"sample.coverage.value must be a number between 0 and 1",t.commandStr),[r,n]},function(e,t,r){return Ae.optional(function(){e.assert(t,r+"&&typeof "+r+'==="object"',"invalid sample.coverage")}),[t.def('"value" in ',r,"?+",r,".value:1"),t.def("!!",r,".invert")]})}}),i}(e,s),y=function(e){function r(e){if(e in a){var r=t.id(a[e]);Ae.optional(function(){c.shader(ei[e],r,Ae.guessCommand())});var n=ne(function(){return r});return n.id=r,n}if(e in i){var o=i[e];return ae(o,function(t,r){var n=t.invoke(r,o),a=r.def(t.shared.strings,".id(",n,")");return Ae.optional(function(){r(t.shared.shader,".shader(",ei[e],",",a,",",t.command,");")}),a})}return null}var n,a=e.static,i=e.dynamic,o=r(Qn),f=r(qn),u=null;return re(o)&&re(f)?(u=c.program(f.id,o.id),n=ne(function(e,t){return e.link(u)})):n=new te(o&&o.thisDep||f&&f.thisDep,o&&o.contextDep||f&&f.contextDep,o&&o.propDep||f&&f.propDep,function(e,t){var r,n=e.shared.shader;r=o?o.append(e,t):t.def(n,".",Qn);var a=n+".program("+(f?f.append(e,t):t.def(n,".",qn))+","+r;return Ae.optional(function(){a+=","+e.command}),t.def(a+")")}),{frag:o,vert:f,progVar:n,program:u}}(e);l(Gn),l(h(Hn));var x=Object.keys(v).length>0,w={framebuffer:p,draw:g,shader:y,state:v,dirty:x};return w.profile=function(e){var t,r=e.static,n=e.dynamic;if(Un in r){var a=!!r[Un];(t=ne(function(e,t){return a})).enable=a}else if(Un in n){var i=n[Un];t=ae(i,function(e,t){return e.invoke(t,i)})}return t}(e),w.uniforms=function(e,t){var r=e.static,n=e.dynamic,a={};return Object.keys(r).forEach(function(e){var n,i=r[e];if("number"==typeof i||"boolean"==typeof i)n=ne(function(){return i});else if("function"==typeof i){var o=i._reglType;"texture2d"===o||"textureCube"===o?n=ne(function(e){return e.link(i)}):"framebuffer"===o||"framebufferCube"===o?(Ae.command(i.color.length>0,'missing color attachment for framebuffer sent to uniform "'+e+'"',t.commandStr),n=ne(function(e){return e.link(i.color[0])})):Ae.commandRaise('invalid data for uniform "'+e+'"',t.commandStr)}else P(i)?n=ne(function(t){return t.global.def("[",_(i.length,function(r){return Ae.command("number"==typeof i[r]||"boolean"==typeof i[r],"invalid uniform "+e,t.commandStr),i[r]}),"]")}):Ae.commandRaise('invalid or missing data for uniform "'+e+'"',t.commandStr);n.value=i,a[e]=n}),Object.keys(n).forEach(function(e){var t=n[e];a[e]=ae(t,function(e,r){return e.invoke(r,t)})}),a}(o,s),w.attributes=function(e,r){var n=e.static,i=e.dynamic,o={};return Object.keys(n).forEach(function(e){var i=n[e],f=t.id(e),u=new R;if(Z(i))u.state=sn,u.buffer=a.getBuffer(a.create(i,ia,!1,!0)),u.type=0;else{var s=a.getBuffer(i);if(s)u.state=sn,u.buffer=s,u.type=0;else if(Ae.command("object"==typeof i&&i,"invalid data for attribute "+e,r.commandStr),i.constant){var c=i.constant;u.buffer="null",u.state=cn,"number"==typeof c?u.x=c:(Ae.command(P(c)&&c.length>0&&c.length<=4,"invalid constant for attribute "+e,r.commandStr),fn.forEach(function(e,t){t<c.length&&(u[e]=c[t])}))}else{s=Z(i.buffer)?a.getBuffer(a.create(i.buffer,ia,!1,!0)):a.getBuffer(i.buffer),Ae.command(!!s,'missing buffer for attribute "'+e+'"',r.commandStr);var l=0|i.offset;Ae.command(l>=0,'invalid offset for attribute "'+e+'"',r.commandStr);var d=0|i.stride;Ae.command(d>=0&&d<256,'invalid stride for attribute "'+e+'", must be integer betweeen [0, 255]',r.commandStr);var m=0|i.size;Ae.command(!("size"in i)||m>0&&m<=4,'invalid size for attribute "'+e+'", must be 1,2,3,4',r.commandStr);var p=!!i.normalized,h=0;"type"in i&&(Ae.commandParameter(i.type,He,"invalid type for attribute "+e,r.commandStr),h=He[i.type]);var b=0|i.divisor;"divisor"in i&&(Ae.command(0===b||I,'cannot specify divisor for attribute "'+e+'", instancing not supported',r.commandStr),Ae.command(b>=0,'invalid divisor for attribute "'+e+'"',r.commandStr)),Ae.optional(function(){var t=r.commandStr,n=["buffer","offset","divisor","normalized","type","size","stride"];Object.keys(i).forEach(function(r){Ae.command(n.indexOf(r)>=0,'unknown parameter "'+r+'" for attribute pointer "'+e+'" (valid parameters are '+n+")",t)})}),u.buffer=s,u.state=sn,u.size=m,u.normalized=p,u.type=h||s.dtype,u.offset=l,u.stride=d,u.divisor=b}}o[e]=ne(function(e,t){var r=e.attribCache;if(f in r)return r[f];var n={isStream:!1};return Object.keys(u).forEach(function(e){n[e]=u[e]}),u.buffer&&(n.buffer=e.link(u.buffer),n.type=n.type||n.buffer+".dtype"),r[f]=n,n})}),Object.keys(i).forEach(function(e){var t=i[e];o[e]=ae(t,function(r,n){function a(e){n(s[e],"=",i,".",e,"|0;")}var i=r.invoke(n,t),o=r.shared,f=o.isBufferArgs,u=o.buffer;Ae.optional(function(){r.assert(n,i+"&&(typeof "+i+'==="object"||typeof '+i+'==="function")&&('+f+"("+i+")||"+u+".getBuffer("+i+")||"+u+".getBuffer("+i+".buffer)||"+f+"("+i+'.buffer)||("constant" in '+i+"&&(typeof "+i+'.constant==="number"||'+o.isArrayLike+"("+i+".constant))))",'invalid dynamic attribute "'+e+'"')});var s={isStream:n.def(!1)},c=new R;c.state=sn,Object.keys(c).forEach(function(e){s[e]=n.def(""+c[e])});var l=s.buffer,d=s.type;return n("if(",f,"(",i,")){",s.isStream,"=true;",l,"=",u,".createStream(",ia,",",i,");",d,"=",l,".dtype;","}else{",l,"=",u,".getBuffer(",i,");","if(",l,"){",d,"=",l,".dtype;",'}else if("constant" in ',i,"){",s.state,"=",cn,";","if(typeof "+i+'.constant === "number"){',s[fn[0]],"=",i,".constant;",fn.slice(1).map(function(e){return s[e]}).join("="),"=0;","}else{",fn.map(function(e,t){return s[e]+"="+i+".constant.length>="+t+"?"+i+".constant["+t+"]:0;"}).join(""),"}}else{","if(",f,"(",i,".buffer)){",l,"=",u,".createStream(",ia,",",i,".buffer);","}else{",l,"=",u,".getBuffer(",i,".buffer);","}",d,'="type" in ',i,"?",o.glTypes,"[",i,".type]:",l,".dtype;",s.normalized,"=!!",i,".normalized;"),a("size"),a("offset"),a("stride"),a("divisor"),n("}}"),n.exit("if(",s.isStream,"){",u,".destroyStream(",l,");","}"),s})}),o}(r,s),w.context=function(e){var t=e.static,r=e.dynamic,n={};return Object.keys(t).forEach(function(e){var r=t[e];n[e]=ne(function(e,t){return"number"==typeof r||"boolean"==typeof r?""+r:e.link(r)})}),Object.keys(r).forEach(function(e){var t=r[e];n[e]=ae(t,function(e,r){return e.invoke(r,t)})}),n}(u),w}function x(e,t,r){var n=e.shared.context,a=e.scope();Object.keys(r).forEach(function(i){t.save(n,"."+i);var o=r[i];a(n,".",i,"=",o.append(e,t),";")}),t(a)}function w(e,t,r,n){var a,i=e.shared,o=i.gl,f=i.framebuffer;M&&(a=t.def(i.extensions,".webgl_draw_buffers"));var u,s=e.constants,c=s.drawBuffer,l=s.backBuffer;u=r?r.append(e,t):t.def(f,".next"),n||t("if(",u,"!==",f,".cur){"),t("if(",u,"){",o,".bindFramebuffer(",Ya,",",u,".framebuffer);"),M&&t(a,".drawBuffersWEBGL(",c,"[",u,".colorAttachments.length]);"),t("}else{",o,".bindFramebuffer(",Ya,",null);"),M&&t(a,".drawBuffersWEBGL(",l,");"),t("}",f,".cur=",u,";"),n||t("}")}function k(e,t,r){var n=e.shared,a=n.gl,i=e.current,o=e.next,f=n.current,u=n.next,s=e.cond(f,".dirty");G.forEach(function(t){var n=h(t);if(!(n in r.state)){var c,l;if(n in o){c=o[n],l=i[n];var d=_(W[n].length,function(e){return s.def(c,"[",e,"]")});s(e.cond(d.map(function(e,t){return e+"!=="+l+"["+t+"]"}).join("||")).then(a,".",N[n],"(",d,");",d.map(function(e,t){return l+"["+t+"]="+e}).join(";"),";"))}else{c=s.def(u,".",n);var m=e.cond(c,"!==",f,".",n);s(m),n in U?m(e.cond(c).then(a,".enable(",U[n],");").else(a,".disable(",U[n],");"),f,".",n,"=",c,";"):m(a,".",N[n],"(",c,");",f,".",n,"=",c,";")}}}),0===Object.keys(r.state).length&&s(f,".dirty=false;"),t(s)}function A(e,t,r,n){var a=e.shared,i=e.current,o=a.current,f=a.gl;ee(Object.keys(r)).forEach(function(a){var u=r[a];if(!n||n(u)){var s=u.append(e,t);if(U[a]){var c=U[a];re(u)?t(f,s?".enable(":".disable(",c,");"):t(e.cond(s).then(f,".enable(",c,");").else(f,".disable(",c,");")),t(o,".",a,"=",s,";")}else if(P(s)){var l=i[a];t(f,".",N[a],"(",s,");",s.map(function(e,t){return l+"["+t+"]="+e}).join(";"),";")}else t(f,".",N[a],"(",s,");",o,".",a,"=",s,";")}})}function S(e,t){I&&(e.instancing=t.def(e.shared.extensions,".angle_instanced_arrays"))}function E(e,t,r,n,a){function i(){return"undefined"==typeof performance?"Date.now()":"performance.now()"}function o(e){e(s=t.def(),"=",i(),";"),"string"==typeof a?e(p,".count+=",a,";"):e(p,".count++;"),m&&(n?e(c=t.def(),"=",b,".getNumPendingQueries();"):e(b,".beginQuery(",p,");"))}function f(e){e(p,".cpuTime+=",i(),"-",s,";"),m&&(n?e(b,".pushScopeStats(",c,",",b,".getNumPendingQueries(),",p,");"):e(b,".endQuery();"))}function u(e){var r=t.def(h,".profile");t(h,".profile=",e,";"),t.exit(h,".profile=",r,";")}var s,c,l,d=e.shared,p=e.stats,h=d.current,b=d.timer,g=r.profile;if(g){if(re(g))return void(g.enable?(o(t),f(t.exit),u("true")):u("false"));u(l=g.append(e,t))}else l=t.def(h,".profile");var v=e.block();o(v),t("if(",l,"){",v,"}");var y=e.block();f(y),t.exit("if(",l,"){",y,"}")}function T(e,t,r,n,a){var i=e.shared;n.forEach(function(n){var o,f=n.name,u=r.attributes[f];if(u){if(!a(u))return;o=u.append(e,t)}else{if(!a(ri))return;var s=e.scopeAttrib(f);Ae.optional(function(){e.assert(t,s+".state","missing attribute "+f)}),o={},Object.keys(new R).forEach(function(e){o[e]=t.def(s,".",e)})}!function(r,n,a){function o(){t("if(!",c,".buffer){",u,".enableVertexAttribArray(",s,");}");var r,i=a.type;if(r=a.size?t.def(a.size,"||",n):n,t("if(",c,".type!==",i,"||",c,".size!==",r,"||",p.map(function(e){return c+"."+e+"!=="+a[e]}).join("||"),"){",u,".bindBuffer(",ia,",",d,".buffer);",u,".vertexAttribPointer(",[s,r,i,a.normalized,a.stride,a.offset],");",c,".type=",i,";",c,".size=",r,";",p.map(function(e){return c+"."+e+"="+a[e]+";"}).join(""),"}"),I){var o=a.divisor;t("if(",c,".divisor!==",o,"){",e.instancing,".vertexAttribDivisorANGLE(",[s,o],");",c,".divisor=",o,";}")}}function f(){t("if(",c,".buffer){",u,".disableVertexAttribArray(",s,");","}if(",fn.map(function(e,t){return c+"."+e+"!=="+m[t]}).join("||"),"){",u,".vertexAttrib4f(",s,",",m,");",fn.map(function(e,t){return c+"."+e+"="+m[t]+";"}).join(""),"}")}var u=i.gl,s=t.def(r,".location"),c=t.def(i.attributes,"[",s,"]"),l=a.state,d=a.buffer,m=[a.x,a.y,a.z,a.w],p=["buffer","normalized","offset","stride"];l===sn?o():l===cn?f():(t("if(",l,"===",sn,"){"),o(),t("}else{"),f(),t("}"))}(e.link(n),function(e){switch(e){case ya:case Aa:case Ta:return 2;case xa:case Sa:case Da:return 3;case wa:case _a:case ja:return 4;default:return 1}}(n.info.type),o)})}function D(e,r,n,a,i){for(var o,f=e.shared,u=f.gl,s=0;s<a.length;++s){var c,l=a[s],d=l.name,m=l.info.type,p=n.uniforms[d],h=e.link(l)+".location";if(p){if(!i(p))continue;if(re(p)){var b=p.value;if(Ae.command(null!==b&&void 0!==b,'missing uniform "'+d+'"',e.commandStr),m===za||m===Ba){Ae.command("function"==typeof b&&(m===za&&("texture2d"===b._reglType||"framebuffer"===b._reglType)||m===Ba&&("textureCube"===b._reglType||"framebufferCube"===b._reglType)),"invalid texture for uniform "+d,e.commandStr);var g=e.link(b._texture||b.color[0]._texture);r(u,".uniform1i(",h,",",g+".bind());"),r.exit(g,".unbind();")}else if(m===Oa||m===Ca||m===Fa){Ae.optional(function(){Ae.command(P(b),"invalid matrix for uniform "+d,e.commandStr),Ae.command(m===Oa&&4===b.length||m===Ca&&9===b.length||m===Fa&&16===b.length,"invalid length for matrix uniform "+d,e.commandStr)});var v=e.global.def("new Float32Array(["+Array.prototype.slice.call(b)+"])"),y=2;m===Ca?y=3:m===Fa&&(y=4),r(u,".uniformMatrix",y,"fv(",h,",false,",v,");")}else{switch(m){case va:Ae.commandType(b,"number","uniform "+d,e.commandStr),o="1f";break;case ya:Ae.command(P(b)&&2===b.length,"uniform "+d,e.commandStr),o="2f";break;case xa:Ae.command(P(b)&&3===b.length,"uniform "+d,e.commandStr),o="3f";break;case wa:Ae.command(P(b)&&4===b.length,"uniform "+d,e.commandStr),o="4f";break;case Ea:Ae.commandType(b,"boolean","uniform "+d,e.commandStr),o="1i";break;case ka:Ae.commandType(b,"number","uniform "+d,e.commandStr),o="1i";break;case Ta:case Aa:Ae.command(P(b)&&2===b.length,"uniform "+d,e.commandStr),o="2i";break;case Da:case Sa:Ae.command(P(b)&&3===b.length,"uniform "+d,e.commandStr),o="3i";break;case ja:case _a:Ae.command(P(b)&&4===b.length,"uniform "+d,e.commandStr),o="4i"}r(u,".uniform",o,"(",h,",",P(b)?Array.prototype.slice.call(b):b,");")}continue}c=p.append(e,r)}else{if(!i(ri))continue;c=r.def(f.uniforms,"[",t.id(d),"]")}m===za?r("if(",c,"&&",c,'._reglType==="framebuffer"){',c,"=",c,".color[0];","}"):m===Ba&&r("if(",c,"&&",c,'._reglType==="framebufferCube"){',c,"=",c,".color[0];","}"),Ae.optional(function(){function t(t,n){e.assert(r,t,'bad data or missing for uniform "'+d+'". '+n)}function n(e){t("typeof "+c+'==="'+e+'"',"invalid type, expected "+e)}function a(r,n){t(f.isArrayLike+"("+c+")&&"+c+".length==="+r,"invalid vector, should have length "+r,e.commandStr)}function i(r){t("typeof "+c+'==="function"&&'+c+'._reglType==="texture'+(r===fa?"2d":"Cube")+'"',"invalid texture type",e.commandStr)}switch(m){case ka:n("number");break;case Aa:a(2);break;case Sa:a(3);break;case _a:a(4);break;case va:n("number");break;case ya:a(2);break;case xa:a(3);break;case wa:a(4);break;case Ea:n("boolean");break;case Ta:a(2);break;case Da:a(3);break;case ja:case Oa:a(4);break;case Ca:a(9);break;case Fa:a(16);break;case za:i(fa);break;case Ba:i(ua)}});var x=1;switch(m){case za:case Ba:var w=r.def(c,"._texture");r(u,".uniform1i(",h,",",w,".bind());"),r.exit(w,".unbind();");continue;case ka:case Ea:o="1i";break;case Aa:case Ta:o="2i",x=2;break;case Sa:case Da:o="3i",x=3;break;case _a:case ja:o="4i",x=4;break;case va:o="1f";break;case ya:o="2f",x=2;break;case xa:o="3f",x=3;break;case wa:o="4f",x=4;break;case Oa:o="Matrix2fv";break;case Ca:o="Matrix3fv";break;case Fa:o="Matrix4fv"}if(r(u,".uniform",o,"(",h,","),"M"===o.charAt(0)){var k=Math.pow(m-Oa+2,2),A=e.global.def("new Float32Array(",k,")");r("false,(Array.isArray(",c,")||",c," instanceof Float32Array)?",c,":(",_(k,function(e){return A+"["+e+"]="+c+"["+e+"]"}),",",A,")")}else r(x>1?_(x,function(e){return c+"["+e+"]"}):c);r(");")}}function j(e,t,r,n){function a(a){var i=c[a];return i?i.contextDep&&n.contextDynamic||i.propDep?i.append(e,r):i.append(e,t):t.def(s,".",a)}function i(){function e(){r(b,".drawElementsInstancedANGLE(",[d,p,g,m+"<<(("+g+"-"+un+")>>1)",h],");")}function t(){r(b,".drawArraysInstancedANGLE(",[d,m,p,h],");")}l?v?e():(r("if(",l,"){"),e(),r("}else{"),t(),r("}")):t()}function o(){function e(){r(u+".drawElements("+[d,p,g,m+"<<(("+g+"-"+un+")>>1)"]+");")}function t(){r(u+".drawArrays("+[d,m,p]+");")}l?v?e():(r("if(",l,"){"),e(),r("}else{"),t(),r("}")):t()}var f=e.shared,u=f.gl,s=f.draw,c=n.draw,l=function(){var a,i=c.elements,o=t;return i?((i.contextDep&&n.contextDynamic||i.propDep)&&(o=r),a=i.append(e,o)):a=o.def(s,".",Vn),a&&o("if("+a+")"+u+".bindBuffer("+oa+","+a+".buffer.buffer);"),a}(),d=a(Yn),m=a($n),p=function(){var a,i=c.count,o=t;return i?((i.contextDep&&n.contextDynamic||i.propDep)&&(o=r),a=i.append(e,o),Ae.optional(function(){i.MISSING&&e.assert(t,"false","missing vertex count"),i.DYNAMIC&&e.assert(o,a+">=0","missing vertex count")})):(a=o.def(s,".",Xn),Ae.optional(function(){e.assert(o,a+">=0","missing vertex count")})),a}();if("number"==typeof p){if(0===p)return}else r("if(",p,"){"),r.exit("}");var h,b;I&&(h=a(Kn),b=e.instancing);var g=l+".type",v=c.elements&&re(c.elements);I&&("number"!=typeof h||h>=0)?"string"==typeof h?(r("if(",h,">0){"),i(),r("}else if(",h,"<0){"),o(),r("}")):i():o()}function O(e,t,r,n,a){var i=v(),o=i.proc("body",a);return Ae.optional(function(){i.commandStr=t.commandStr,i.command=i.link(t.commandStr)}),I&&(i.instancing=o.def(i.shared.extensions,".angle_instanced_arrays")),e(i,o,r,n),i.compile().body}function C(e,t,r,n){S(e,t),T(e,t,r,n.attributes,function(){return!0}),D(e,t,r,n.uniforms,function(){return!0}),j(e,t,t,r)}function F(e,t,r,n){function a(){return!0}e.batchId="a1",S(e,t),T(e,t,r,n.attributes,a),D(e,t,r,n.uniforms,a),j(e,t,t,r)}function z(e,t,r,n){function a(e){return e.contextDep&&o||e.propDep}function i(e){return!a(e)}S(e,t);var o=r.contextDep,f=t.def(),u=t.def();e.shared.props=u,e.batchId=f;var s=e.scope(),c=e.scope();if(t(s.entry,"for(",f,"=0;",f,"<","a1",";++",f,"){",u,"=","a0","[",f,"];",c,"}",s.exit),r.needsContext&&x(e,c,r.context),r.needsFramebuffer&&w(e,c,r.framebuffer),A(e,c,r.state,a),r.profile&&a(r.profile)&&E(e,c,r,!1,!0),n)T(e,s,r,n.attributes,i),T(e,c,r,n.attributes,a),D(e,s,r,n.uniforms,i),D(e,c,r,n.uniforms,a),j(e,s,c,r);else{var l=e.global.def("{}"),d=r.shader.progVar.append(e,c),m=c.def(d,".id"),p=c.def(l,"[",m,"]");c(e.shared.gl,".useProgram(",d,".program);","if(!",p,"){",p,"=",l,"[",m,"]=",e.link(function(t){return O(F,e,r,t,2)}),"(",d,");}",p,".call(this,a0[",f,"],",f,");")}}function B(e,t,r){var n=t.static[r];if(n&&function(e){if("object"==typeof e&&!P(e)){for(var t=Object.keys(e),r=0;r<t.length;++r)if(Ee.isDynamic(e[t[r]]))return!0;return!1}}(n)){var a=e.global,i=Object.keys(n),o=!1,f=!1,u=!1,s=e.global.def("{}");i.forEach(function(t){var r=n[t];if(Ee.isDynamic(r)){"function"==typeof r&&(r=n[t]=Ee.unbox(r));var i=ae(r,null);o=o||i.thisDep,u=u||i.propDep,f=f||i.contextDep}else{switch(a(s,".",t,"="),typeof r){case"number":a(r);break;case"string":a('"',r,'"');break;case"object":Array.isArray(r)&&a("[",r.join(),"]");break;default:a(e.link(r))}a(";")}}),t.dynamic[r]=new Ee.DynamicVariable(hn,{thisDep:o,contextDep:f,propDep:u,ref:s,append:function(e,t){i.forEach(function(r){var a=n[r];if(Ee.isDynamic(a)){var i=e.invoke(t,a);t(s,".",r,"=",i,";")}})}}),delete t.static[r]}}var R=s.Record,L={add:32774,subtract:32778,"reverse subtract":32779};r.ext_blend_minmax&&(L.min=Wa,L.max=Ha);var I=r.angle_instanced_arrays,M=r.webgl_draw_buffers,W={dirty:!0,profile:p.profile},H={},G=[],U={},N={};b(bn,la),b(gn,ca),g(vn,"blendColor",[0,0,0,0]),g(yn,"blendEquationSeparate",[Qa,Qa]),g(xn,"blendFuncSeparate",[qa,Na,qa,Na]),b(wn,ma,!0),g(kn,"depthFunc",Va),g(An,"depthRange",[0,1]),g(Sn,"depthMask",!0),g(_n,_n,[!0,!0,!0,!0]),b(En,sa),g(Tn,"cullFace",La),g(Dn,Dn,Ma),g(jn,jn,1),b(On,ha),g(Cn,"polygonOffset",[0,0]),b(Fn,ba),b(zn,ga),g(Bn,"sampleCoverage",[1,!1]),b(Pn,da),g(Rn,"stencilMask",-1),g(Ln,"stencilFunc",[Ga,0,-1]),g(In,"stencilOpSeparate",[Ra,Ua,Ua,Ua]),g(Mn,"stencilOpSeparate",[La,Ua,Ua,Ua]),b(Wn,pa),g(Hn,"scissor",[0,0,e.drawingBufferWidth,e.drawingBufferHeight]),g(Gn,Gn,[0,0,e.drawingBufferWidth,e.drawingBufferHeight]);var q={gl:e,context:d,strings:t,next:H,current:W,draw:l,elements:i,buffer:a,shader:c,attributes:s.state,uniforms:u,framebuffer:f,extensions:r,timer:m,isBufferArgs:Z},Q={primTypes:$e,compareFuncs:Ja,blendFuncs:$a,blendEquations:L,stencilOps:Za,glTypes:He,orientationType:ti};Ae.optional(function(){q.isArrayLike=P}),M&&(Q.backBuffer=[La],Q.drawBuffer=_(n.maxDrawbuffers,function(e){return 0===e?[0]:_(e,function(e){return Xa+e})}));var V=0;return{next:H,current:W,procs:function(){var t=v(),r=t.proc("poll"),a=t.proc("refresh"),i=t.block();r(i),a(i);var o=t.shared,f=o.gl,u=o.next,s=o.current;i(s,".dirty=false;"),w(t,r),w(t,a,null,!0);var c,l=e.getExtension("angle_instanced_arrays");l&&(c=t.link(l));for(var d=0;d<n.maxAttributes;++d){var m=a.def(o.attributes,"[",d,"]"),p=t.cond(m,".buffer");p.then(f,".enableVertexAttribArray(",d,");",f,".bindBuffer(",ia,",",m,".buffer.buffer);",f,".vertexAttribPointer(",d,",",m,".size,",m,".type,",m,".normalized,",m,".stride,",m,".offset);").else(f,".disableVertexAttribArray(",d,");",f,".vertexAttrib4f(",d,",",m,".x,",m,".y,",m,".z,",m,".w);",m,".buffer=null;"),a(p),l&&a(c,".vertexAttribDivisorANGLE(",d,",",m,".divisor);")}return Object.keys(U).forEach(function(e){var n=U[e],o=i.def(u,".",e),c=t.block();c("if(",o,"){",f,".enable(",n,")}else{",f,".disable(",n,")}",s,".",e,"=",o,";"),a(c),r("if(",o,"!==",s,".",e,"){",c,"}")}),Object.keys(N).forEach(function(e){var n,o,c=N[e],l=W[e],d=t.block();if(d(f,".",c,"("),P(l)){var m=l.length;n=t.global.def(u,".",e),o=t.global.def(s,".",e),d(_(m,function(e){return n+"["+e+"]"}),");",_(m,function(e){return o+"["+e+"]="+n+"["+e+"];"}).join("")),r("if(",_(m,function(e){return n+"["+e+"]!=="+o+"["+e+"]"}).join("||"),"){",d,"}")}else n=i.def(u,".",e),o=i.def(s,".",e),d(n,");",s,".",e,"=",n,";"),r("if(",n,"!==",o,"){",d,"}");a(d)}),t.compile()}(),compile:function(e,r,n,a,i){var o=v();o.stats=o.link(i),Object.keys(r.static).forEach(function(e){B(o,r,e)}),aa.forEach(function(t){B(o,e,t)});var f=y(e,r,n,a,o);return function(e,t){var r=e.proc("draw",1);S(e,r),x(e,r,t.context),w(e,r,t.framebuffer),k(e,r,t),A(e,r,t.state),E(e,r,t,!1,!0);var n=t.shader.progVar.append(e,r);if(r(e.shared.gl,".useProgram(",n,".program);"),t.shader.program)C(e,r,t,t.shader.program);else{var a=e.global.def("{}"),i=r.def(n,".id"),o=r.def(a,"[",i,"]");r(e.cond(o).then(o,".call(this,a0);").else(o,"=",a,"[",i,"]=",e.link(function(r){return O(C,e,t,r,1)}),"(",n,");",o,".call(this,a0);"))}Object.keys(t.state).length>0&&r(e.shared.current,".dirty=true;")}(o,f),function(e,r){function n(t){var n=r.shader[t];n&&a.set(i.shader,"."+t,n.append(e,a))}var a=e.proc("scope",3);e.batchId="a2";var i=e.shared,o=i.current;x(e,a,r.context),r.framebuffer&&r.framebuffer.append(e,a),ee(Object.keys(r.state)).forEach(function(t){var n=r.state[t].append(e,a);P(n)?n.forEach(function(r,n){a.set(e.next[t],"["+n+"]",r)}):a.set(i.next,"."+t,n)}),E(e,a,r,!0,!0),[Vn,$n,Xn,Kn,Yn].forEach(function(t){var n=r.draw[t];n&&a.set(i.draw,"."+t,""+n.append(e,a))}),Object.keys(r.uniforms).forEach(function(n){a.set(i.uniforms,"["+t.id(n)+"]",r.uniforms[n].append(e,a))}),Object.keys(r.attributes).forEach(function(t){var n=r.attributes[t].append(e,a),i=e.scopeAttrib(t);Object.keys(new R).forEach(function(e){a.set(i,"."+e,n[e])})}),n(qn),n(Qn),Object.keys(r.state).length>0&&(a(o,".dirty=true;"),a.exit(o,".dirty=true;")),a("a1(",e.shared.context,",a0,",e.batchId,");")}(o,f),function(e,t){function r(e){return e.contextDep&&a||e.propDep}var n=e.proc("batch",2);e.batchId="0",S(e,n);var a=!1,i=!0;Object.keys(t.context).forEach(function(e){a=a||t.context[e].propDep}),a||(x(e,n,t.context),i=!1);var o=t.framebuffer,f=!1;o?(o.propDep?a=f=!0:o.contextDep&&a&&(f=!0),f||w(e,n,o)):w(e,n,null),t.state.viewport&&t.state.viewport.propDep&&(a=!0),k(e,n,t),A(e,n,t.state,function(e){return!r(e)}),t.profile&&r(t.profile)||E(e,n,t,!1,"a1"),t.contextDep=a,t.needsContext=i,t.needsFramebuffer=f;var u=t.shader.progVar;if(u.contextDep&&a||u.propDep)z(e,n,t,null);else{var s=u.append(e,n);if(n(e.shared.gl,".useProgram(",s,".program);"),t.shader.program)z(e,n,t,t.shader.program);else{var c=e.global.def("{}"),l=n.def(s,".id"),d=n.def(c,"[",l,"]");n(e.cond(d).then(d,".call(this,a0,a1);").else(d,"=",c,"[",l,"]=",e.link(function(r){return O(z,e,t,r,2)}),"(",s,");",d,".call(this,a0,a1);"))}}Object.keys(t.state).length>0&&n(e.shared.current,".dirty=true;")}(o,f),o.compile()}}}function oe(e,t){for(var r=0;r<e.length;++r)if(e[r]===t)return r;return-1}var fe={"[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},ue=function(e){return Object.prototype.toString.call(e)in fe},se=function(e,t){for(var r=Object.keys(t),n=0;n<r.length;++n)e[r[n]]=t[r[n]];return e},ce=["gl","canvas","container","attributes","pixelRatio","extensions","optionalExtensions","profile","onDone"],le=33071,de=9728,me=9984,pe=9985,he=9986,be=9987,ge=5126,ve=32819,ye=32820,xe=33635,we=34042,ke={};ke[5120]=ke[5121]=1,ke[5122]=ke[5123]=ke[36193]=ke[xe]=ke[ve]=ke[ye]=2,ke[5124]=ke[5125]=ke[ge]=ke[we]=4;var Ae=se(r,{optional:function(e){e()},raise:t,commandRaise:m,command:function(e,t,r){e||m(t,r||s())},parameter:function(e,r,a){e in r||t("unknown parameter ("+e+")"+n(a)+". possible values: "+Object.keys(r).join())},commandParameter:function(e,t,r,a){e in t||m("unknown parameter ("+e+")"+n(r)+". possible values: "+Object.keys(t).join(),a||s())},constructor:function(e){Object.keys(e).forEach(function(e){ce.indexOf(e)<0&&t('invalid regl constructor argument "'+e+'". must be one of '+ce)})},type:function(e,r,a){typeof e!==r&&t("invalid parameter type"+n(a)+". expected "+r+", got "+typeof e)},commandType:p,isTypedArray:function(e,r){ue(e)||t("invalid parameter type"+n(r)+". must be a typed array")},nni:function(e,r){e>=0&&(0|e)===e||t("invalid parameter type, ("+e+")"+n(r)+". must be a nonnegative integer")},oneOf:a,shaderError:function(e,t,n,a,o){if(!e.getShaderParameter(t,e.COMPILE_STATUS)){var f=e.getShaderInfoLog(t),s=a===e.FRAGMENT_SHADER?"fragment":"vertex";p(n,"string",s+" shader source must be a string",o);var c=l(n,o),d=function(e){var t=[];return e.split("\n").forEach(function(e){if(!(e.length<5)){var r=/^ERROR\:\s+(\d+)\:(\d+)\:\s*(.*)$/.exec(e);r?t.push(new u(0|r[1],0|r[2],r[3].trim())):e.length>0&&t.push(new u("unknown",0,e))}}),t}(f);!function(e,t){t.forEach(function(t){var r=e[t.file];if(r){var n=r.index[t.line];if(n)return n.errors.push(t),void(r.hasErrors=!0)}e.unknown.hasErrors=!0,e.unknown.lines[0].errors.push(t)})}(c,d),Object.keys(c).forEach(function(e){function t(e,t){n.push(e),a.push(t||"")}var r=c[e];if(r.hasErrors){var n=[""],a=[""];t("file number "+e+": "+r.name+"\n","color:red;text-decoration:underline;font-weight:bold"),r.lines.forEach(function(e){if(e.errors.length>0){t(i(e.number,4)+"| ","background-color:yellow; font-weight:bold"),t(e.line+"\n","color:red; background-color:yellow; font-weight:bold");var r=0;e.errors.forEach(function(n){var a=n.message,o=/^\s*\'(.*)\'\s*\:\s*(.*)$/.exec(a);if(o){var f=o[1];switch(a=o[2],f){case"assign":f="="}r=Math.max(e.line.indexOf(f,r),0)}else r=0;t(i("| ",6)),t(i("^^^",r+3)+"\n","font-weight:bold"),t(i("| ",6)),t(a+"\n","font-weight:bold")}),t(i("| ",6)+"\n")}else t(i(e.number,4)+"| "),t(e.line+"\n","color:red")}),"undefined"!=typeof document&&(a[0]=n.join("%c"))}}),r.raise("Error compiling "+s+" shader, "+c[0].name)}},linkError:function(e,t,n,a,i){if(!e.getProgramParameter(t,e.LINK_STATUS)){e.getProgramInfoLog(t);var o=l(n,i),f='Error linking program with vertex shader, "'+l(a,i)[0].name+'", and fragment shader "'+o[0].name+'"';r.raise(f)}},callSite:c,saveCommandRef:d,saveDrawInfo:function(e,t,r,n){function a(e){return e?n.id(e):0}function i(e,t){Object.keys(t).forEach(function(t){e[n.id(t)]=!0})}d(e),e._fragId=a(e.static.frag),e._vertId=a(e.static.vert);var o=e._uniformSet={};i(o,t.static),i(o,t.dynamic);var f=e._attributeSet={};i(f,r.static),i(f,r.dynamic),e._hasCount="count"in e.static||"count"in e.dynamic||"elements"in e.static||"elements"in e.dynamic},framebufferFormat:function(e,t,r){e.texture?a(e.texture._texture.internalformat,t,"unsupported texture format for attachment"):a(e.renderbuffer._renderbuffer.format,r,"unsupported renderbuffer format for attachment")},guessCommand:s,texture2D:function(e,t,n){var a,i=t.width,o=t.height,f=t.channels;r(i>0&&i<=n.maxTextureSize&&o>0&&o<=n.maxTextureSize,"invalid texture shape"),e.wrapS===le&&e.wrapT===le||r(b(i)&&b(o),"incompatible wrap mode for texture, both width and height must be power of 2"),1===t.mipmask?1!==i&&1!==o&&r(e.minFilter!==me&&e.minFilter!==he&&e.minFilter!==pe&&e.minFilter!==be,"min filter requires mipmap"):(r(b(i)&&b(o),"texture must be a square power of 2 to support mipmapping"),r(t.mipmask===(i<<1)-1,"missing or incomplete mipmap data")),t.type===ge&&(n.extensions.indexOf("oes_texture_float_linear")<0&&r(e.minFilter===de&&e.magFilter===de,"filter not supported, must enable oes_texture_float_linear"),r(!e.genMipmaps,"mipmap generation not supported with float textures"));var u=t.images;for(a=0;a<16;++a)if(u[a]){var s=i>>a,c=o>>a;r(t.mipmask&1<<a,"missing mipmap data");var l=u[a];if(r(l.width===s&&l.height===c,"invalid shape for mip images"),r(l.format===t.format&&l.internalformat===t.internalformat&&l.type===t.type,"incompatible type for mip image"),l.compressed);else if(l.data){var d=Math.ceil(h(l.type,f)*s/l.unpackAlignment)*l.unpackAlignment;r(l.data.byteLength===d*c,"invalid data for image, buffer size is inconsistent with image format")}else l.element||l.copy}else e.genMipmaps||r(0==(t.mipmask&1<<a),"extra mipmap data");t.compressed&&r(!e.genMipmaps,"mipmap generation for compressed images not supported")},textureCube:function(e,t,n,a){var i=e.width,o=e.height,f=e.channels;r(i>0&&i<=a.maxTextureSize&&o>0&&o<=a.maxTextureSize,"invalid texture shape"),r(i===o,"cube map must be square"),r(t.wrapS===le&&t.wrapT===le,"wrap mode not supported by cube map");for(var u=0;u<n.length;++u){var s=n[u];r(s.width===i&&s.height===o,"inconsistent cube map face shape"),t.genMipmaps&&(r(!s.compressed,"can not generate mipmap for compressed textures"),r(1===s.mipmask,"can not specify mipmaps and generate mipmaps"));for(var c=s.images,l=0;l<16;++l){var d=c[l];if(d){var m=i>>l,p=o>>l;r(s.mipmask&1<<l,"missing mipmap data"),r(d.width===m&&d.height===p,"invalid shape for mip images"),r(d.format===e.format&&d.internalformat===e.internalformat&&d.type===e.type,"incompatible type for mip image"),d.compressed||(d.data?r(d.data.byteLength===m*p*Math.max(h(d.type,f),d.unpackAlignment),"invalid data for image, buffer size is inconsistent with image format"):d.element||d.copy)}}}}}),Se=0,_e=0,Ee={DynamicVariable:g,define:function(e,t){return new g(e,x(t+""))},isDynamic:function(e){return"function"==typeof e&&!e._reglType||e instanceof g},unbox:function(e,t){return"function"==typeof e?new g(_e,e):e},accessor:x},Te={next:"function"==typeof requestAnimationFrame?function(e){return requestAnimationFrame(e)}:function(e){return setTimeout(e,16)},cancel:"function"==typeof cancelAnimationFrame?function(e){return cancelAnimationFrame(e)}:clearTimeout},De="undefined"!=typeof performance&&performance.now?function(){return performance.now()}:function(){return+new Date},je=function(e,t){var r=1;t.ext_texture_filter_anisotropic&&(r=e.getParameter(34047));var n=1,a=1;return t.webgl_draw_buffers&&(n=e.getParameter(34852),a=e.getParameter(36063)),{colorBits:[e.getParameter(3410),e.getParameter(3411),e.getParameter(3412),e.getParameter(3413)],depthBits:e.getParameter(3414),stencilBits:e.getParameter(3415),subpixelBits:e.getParameter(3408),extensions:Object.keys(t).filter(function(e){return!!t[e]}),maxAnisotropic:r,maxDrawbuffers:n,maxColorAttachments:a,pointSizeDims:e.getParameter(33901),lineWidthDims:e.getParameter(33902),maxViewportDims:e.getParameter(3386),maxCombinedTextureUnits:e.getParameter(35661),maxCubeMapSize:e.getParameter(34076),maxRenderbufferSize:e.getParameter(34024),maxTextureUnits:e.getParameter(34930),maxTextureSize:e.getParameter(3379),maxAttributes:e.getParameter(34921),maxVertexUniforms:e.getParameter(36347),maxVertexTextureUnits:e.getParameter(35660),maxVaryingVectors:e.getParameter(36348),maxFragmentUniforms:e.getParameter(36349),glsl:e.getParameter(35724),renderer:e.getParameter(7937),vendor:e.getParameter(7936),version:e.getParameter(7938)}},Oe=function(e){return Object.keys(e).map(function(t){return e[t]})},Ce=5120,Fe=5121,ze=5122,Be=5123,Pe=5124,Re=5125,Le=5126,Ie=_(8,function(){return[]}),Me={alloc:T,free:D,allocType:function(e,t){var r=null;switch(e){case Ce:r=new Int8Array(T(t),0,t);break;case Fe:r=new Uint8Array(T(t),0,t);break;case ze:r=new Int16Array(T(2*t),0,t);break;case Be:r=new Uint16Array(T(2*t),0,t);break;case Pe:r=new Int32Array(T(4*t),0,t);break;case Re:r=new Uint32Array(T(4*t),0,t);break;case Le:r=new Float32Array(T(4*t),0,t);break;default:return null}return r.length!==t?r.subarray(0,t):r},freeType:function(e){D(e.buffer)}},We={shape:function(e){for(var t=[],r=e;r.length;r=r[0])t.push(r.length);return t},flatten:function(e,t,r,n){var a=1;if(t.length)for(var i=0;i<t.length;++i)a*=t[i];else a=0;var o=n||Me.allocType(r,a);switch(t.length){case 0:break;case 1:!function(e,t,r){for(var n=0;n<t;++n)r[n]=e[n]}(e,t[0],o);break;case 2:!function(e,t,r,n){for(var a=0,i=0;i<t;++i)for(var o=e[i],f=0;f<r;++f)n[a++]=o[f]}(e,t[0],t[1],o);break;case 3:j(e,t[0],t[1],t[2],o,0);break;default:O(e,t,0,o,0)}return o}},He={int8:5120,int16:5122,int32:5124,uint8:5121,uint16:5123,uint32:5125,float:5126,float32:5126},Ge={dynamic:35048,stream:35040,static:35044},Ue=We.flatten,Ne=We.shape,qe=35044,Qe=35040,Ve=5121,Ye=5126,Xe=[];Xe[5120]=1,Xe[5122]=2,Xe[5124]=4,Xe[5121]=1,Xe[5123]=2,Xe[5125]=4,Xe[5126]=4;var $e={points:0,point:0,lines:1,line:1,triangles:4,triangle:4,"line loop":2,"line strip":3,"triangle strip":5,"triangle fan":6},Ke=0,Je=1,Ze=4,et=5120,tt=5121,rt=5122,nt=5123,at=5124,it=5125,ot=34963,ft=35040,ut=35044,st=new Float32Array(1),ct=new Uint32Array(st.buffer),lt=5123,dt=34467,mt=3553,pt=34067,ht=34069,bt=6408,gt=6406,vt=6407,yt=6409,xt=6410,wt=32854,kt=32855,At=36194,St=32819,_t=32820,Et=33635,Tt=34042,Dt=6402,jt=34041,Ot=35904,Ct=35906,Ft=36193,zt=33776,Bt=33777,Pt=33778,Rt=33779,Lt=35986,It=35987,Mt=34798,Wt=35840,Ht=35841,Gt=35842,Ut=35843,Nt=36196,qt=5121,Qt=5123,Vt=5125,Yt=5126,Xt=10242,$t=10243,Kt=10497,Jt=33071,Zt=33648,er=10240,tr=10241,rr=9728,nr=9729,ar=9984,ir=9985,or=9986,fr=9987,ur=33170,sr=4352,cr=4353,lr=4354,dr=34046,mr=3317,pr=37440,hr=37441,br=37443,gr=37444,vr=33984,yr=[ar,or,ir,fr],xr=[0,yt,xt,vt,bt],wr={};wr[yt]=wr[gt]=wr[Dt]=1,wr[jt]=wr[xt]=2,wr[vt]=wr[Ot]=3,wr[bt]=wr[Ct]=4;var kr=R("HTMLCanvasElement"),Ar=R("CanvasRenderingContext2D"),Sr=R("HTMLImageElement"),_r=R("HTMLVideoElement"),Er=Object.keys(fe).concat([kr,Ar,Sr,_r]),Tr=[];Tr[qt]=1,Tr[Yt]=4,Tr[Ft]=2,Tr[Qt]=2,Tr[Vt]=4;var Dr=[];Dr[wt]=2,Dr[kt]=2,Dr[At]=2,Dr[jt]=4,Dr[zt]=.5,Dr[Bt]=.5,Dr[Pt]=1,Dr[Rt]=1,Dr[Lt]=.5,Dr[It]=1,Dr[Mt]=1,Dr[Wt]=.5,Dr[Ht]=.25,Dr[Gt]=.5,Dr[Ut]=.25,Dr[Nt]=.5;var jr=36161,Or=32854,Cr=[];Cr[Or]=2,Cr[32855]=2,Cr[36194]=2,Cr[33189]=2,Cr[36168]=1,Cr[34041]=4,Cr[35907]=4,Cr[34836]=16,Cr[34842]=8,Cr[34843]=6;var Fr=function(e,t,r,n,a){function i(e){this.id=s++,this.refCount=1,this.renderbuffer=e,this.format=Or,this.width=0,this.height=0,a.profile&&(this.stats={size:0})}function o(t){var r=t.renderbuffer;Ae(r,"must not double destroy renderbuffer"),e.bindRenderbuffer(jr,null),e.deleteRenderbuffer(r),t.renderbuffer=null,t.refCount=0,delete c[t.id],n.renderbufferCount--}var f={rgba4:Or,rgb565:36194,"rgb5 a1":32855,depth:33189,stencil:36168,"depth stencil":34041};t.ext_srgb&&(f.srgba=35907),t.ext_color_buffer_half_float&&(f.rgba16f=34842,f.rgb16f=34843),t.webgl_color_buffer_float&&(f.rgba32f=34836);var u=[];Object.keys(f).forEach(function(e){var t=f[e];u[t]=e});var s=0,c={};return i.prototype.decRef=function(){--this.refCount<=0&&o(this)},a.profile&&(n.getTotalRenderbufferSize=function(){var e=0;return Object.keys(c).forEach(function(t){e+=c[t].stats.size}),e}),{create:function(t,o){function s(t,n){var i=0,o=0,c=Or;if("object"==typeof t&&t){var d=t;if("shape"in d){var m=d.shape;Ae(Array.isArray(m)&&m.length>=2,"invalid renderbuffer shape"),i=0|m[0],o=0|m[1]}else"radius"in d&&(i=o=0|d.radius),"width"in d&&(i=0|d.width),"height"in d&&(o=0|d.height);"format"in d&&(Ae.parameter(d.format,f,"invalid renderbuffer format"),c=f[d.format])}else"number"==typeof t?(i=0|t,o="number"==typeof n?0|n:i):t?Ae.raise("invalid arguments to renderbuffer constructor"):i=o=1;if(Ae(i>0&&o>0&&i<=r.maxRenderbufferSize&&o<=r.maxRenderbufferSize,"invalid renderbuffer size"),i!==l.width||o!==l.height||c!==l.format)return s.width=l.width=i,s.height=l.height=o,l.format=c,e.bindRenderbuffer(jr,l.renderbuffer),e.renderbufferStorage(jr,c,i,o),a.profile&&(l.stats.size=V(l.format,l.width,l.height)),s.format=u[l.format],s}var l=new i(e.createRenderbuffer());return c[l.id]=l,n.renderbufferCount++,s(t,o),s.resize=function(t,n){var i=0|t,o=0|n||i;return i===l.width&&o===l.height?s:(Ae(i>0&&o>0&&i<=r.maxRenderbufferSize&&o<=r.maxRenderbufferSize,"invalid renderbuffer size"),s.width=l.width=i,s.height=l.height=o,e.bindRenderbuffer(jr,l.renderbuffer),e.renderbufferStorage(jr,l.format,i,o),a.profile&&(l.stats.size=V(l.format,l.width,l.height)),s)},s._reglType="renderbuffer",s._renderbuffer=l,a.profile&&(s.stats=l.stats),s.destroy=function(){l.decRef()},s},clear:function(){Oe(c).forEach(o)},restore:function(){Oe(c).forEach(function(t){t.renderbuffer=e.createRenderbuffer(),e.bindRenderbuffer(jr,t.renderbuffer),e.renderbufferStorage(jr,t.format,t.width,t.height)}),e.bindRenderbuffer(jr,null)}}},zr=36160,Br=36161,Pr=3553,Rr=34069,Lr=36064,Ir=36096,Mr=36128,Wr=33306,Hr=36053,Gr=6402,Ur=[6408],Nr=[];Nr[6408]=4;var qr=[];qr[5121]=1,qr[5126]=4,qr[36193]=2;var Qr=33189,Vr=36168,Yr=34041,Xr=[32854,32855,36194,35907,34842,34843,34836],$r={};$r[Hr]="complete",$r[36054]="incomplete attachment",$r[36057]="incomplete dimensions",$r[36055]="incomplete, missing attachment",$r[36061]="unsupported";var Kr=5126,Jr=35632,Zr=35633,en=35718,tn=35721,rn=6408,nn=5121,an=3333,on=5126,fn="xyzw".split(""),un=5121,sn=1,cn=2,ln=0,dn=1,mn=2,pn=3,hn=4,bn="dither",gn="blend.enable",vn="blend.color",yn="blend.equation",xn="blend.func",wn="depth.enable",kn="depth.func",An="depth.range",Sn="depth.mask",_n="colorMask",En="cull.enable",Tn="cull.face",Dn="frontFace",jn="lineWidth",On="polygonOffset.enable",Cn="polygonOffset.offset",Fn="sample.alpha",zn="sample.enable",Bn="sample.coverage",Pn="stencil.enable",Rn="stencil.mask",Ln="stencil.func",In="stencil.opFront",Mn="stencil.opBack",Wn="scissor.enable",Hn="scissor.box",Gn="viewport",Un="profile",Nn="framebuffer",qn="vert",Qn="frag",Vn="elements",Yn="primitive",Xn="count",$n="offset",Kn="instances",Jn=Nn+"Width",Zn=Nn+"Height",ea=Gn+"Width",ta=Gn+"Height",ra="drawingBufferWidth",na="drawingBufferHeight",aa=[xn,yn,Ln,In,Mn,Bn,Gn,Hn,Cn],ia=34962,oa=34963,fa=3553,ua=34067,sa=2884,ca=3042,la=3024,da=2960,ma=2929,pa=3089,ha=32823,ba=32926,ga=32928,va=5126,ya=35664,xa=35665,wa=35666,ka=5124,Aa=35667,Sa=35668,_a=35669,Ea=35670,Ta=35671,Da=35672,ja=35673,Oa=35674,Ca=35675,Fa=35676,za=35678,Ba=35680,Pa=4,Ra=1028,La=1029,Ia=2304,Ma=2305,Wa=32775,Ha=32776,Ga=519,Ua=7680,Na=0,qa=1,Qa=32774,Va=513,Ya=36160,Xa=36064,$a={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},Ka=["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"],Ja={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},Za={0:0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},ei={frag:35632,vert:35633},ti={cw:Ia,ccw:Ma},ri=new te(!1,!1,!1,function(){}),ni=34918,ai=34919,ii=35007,oi=function(e,t){function r(e){o.push(e)}function n(e){u.push(e)}function a(e,t,r){var n=u.pop()||new function(){this.startQueryIndex=-1,this.endQueryIndex=-1,this.sum=0,this.stats=null};n.startQueryIndex=e,n.endQueryIndex=t,n.sum=0,n.stats=r,s.push(n)}var i=t.ext_disjoint_timer_query;if(!i)return null;var o=[],f=[],u=[],s=[],c=[],l=[];return{beginQuery:function(e){var t=o.pop()||i.createQueryEXT();i.beginQueryEXT(ii,t),f.push(t),a(f.length-1,f.length,e)},endQuery:function(){i.endQueryEXT(ii)},pushScopeStats:a,update:function(){var e,t,a=f.length;if(0!==a){l.length=Math.max(l.length,a+1),c.length=Math.max(c.length,a+1),c[0]=0,l[0]=0;var o=0;for(e=0,t=0;t<f.length;++t){var u=f[t];i.getQueryObjectEXT(u,ai)?(o+=i.getQueryObjectEXT(u,ni),r(u)):f[e++]=u,c[t+1]=o,l[t+1]=e}for(f.length=e,e=0,t=0;t<s.length;++t){var d=s[t],m=d.startQueryIndex,p=d.endQueryIndex;d.sum+=c[p]-c[m];var h=l[m],b=l[p];b===h?(d.stats.gpuTime+=d.sum/1e6,n(d)):(d.startQueryIndex=h,d.endQueryIndex=b,s[e++]=d)}s.length=e}},getNumPendingQueries:function(){return f.length},clear:function(){o.push.apply(o,f);for(var e=0;e<o.length;e++)i.deleteQueryEXT(o[e]);f.length=0,o.length=0},restore:function(){f.length=0,o.length=0}}},fi=16384,ui=256,si=1024,ci=34962,li="webglcontextlost",di="webglcontextrestored",mi=1,pi=2,hi=3;return function(e){function t(){if(0===U.length)return w&&w.update(),void(K=null);K=Te.next(t),c();for(var e=U.length-1;e>=0;--e){var r=U[e];r&&r(T,null,0)}p.flush(),w&&w.update()}function r(){!K&&U.length>0&&(K=Te.next(t))}function n(){K&&(Te.cancel(t),K=null)}function a(e){e.preventDefault(),b=!0,n(),N.forEach(function(e){e()})}function i(e){p.getError(),b=!1,g.restore(),P.restore(),j.restore(),R.restore(),L.restore(),I.restore(),w&&w.restore(),M.procs.refresh(),r(),q.forEach(function(e){e()})}function o(e){function t(e){var t={},r={};return Object.keys(e).forEach(function(n){var a=e[n];Ee.isDynamic(a)?r[n]=Ee.unbox(a,n):t[n]=a}),{dynamic:r,static:t}}Ae(!!e,"invalid args to regl({...})"),Ae.type(e,"object","invalid args to regl({...})");var r=t(e.context||{}),n=t(e.uniforms||{}),a=t(e.attributes||{}),i=t(function(e){function t(e){if(e in r){var t=r[e];delete r[e],Object.keys(t).forEach(function(n){r[e+"."+n]=t[n]})}}var r=se({},e);return delete r.uniforms,delete r.attributes,delete r.context,"stencil"in r&&r.stencil.op&&(r.stencil.opBack=r.stencil.opFront=r.stencil.op,delete r.stencil.op),t("blend"),t("depth"),t("cull"),t("stencil"),t("polygonOffset"),t("scissor"),t("sample"),r}(e)),o={gpuTime:0,cpuTime:0,count:0},f=M.compile(i,a,n,r,o),u=f.draw,s=f.batch,c=f.scope,l=[];return se(function(e,t){var r;if(b&&Ae.raise("context lost"),"function"==typeof e)return c.call(this,null,e,0);if("function"==typeof t){if("number"==typeof e){for(r=0;r<e;++r)c.call(this,null,t,r);return}if(Array.isArray(e)){for(r=0;r<e.length;++r)c.call(this,e[r],t,r);return}return c.call(this,e,t,0)}if("number"==typeof e){if(e>0)return s.call(this,function(e){for(;l.length<e;)l.push(null);return l}(0|e),0|e)}else{if(!Array.isArray(e))return u.call(this,e);if(e.length)return s.call(this,e,e.length)}},{stats:o})}function f(e,t){var r=0;M.procs.poll();var n=t.color;n&&(p.clearColor(+n[0]||0,+n[1]||0,+n[2]||0,+n[3]||0),r|=fi),"depth"in t&&(p.clearDepth(+t.depth),r|=ui),"stencil"in t&&(p.clearStencil(0|t.stencil),r|=si),Ae(!!r,"called regl.clear with no buffer specified"),p.clear(r)}function u(e){return Ae.type(e,"function","regl.frame() callback must be a function"),U.push(e),r(),{cancel:function(){function t(){var e=oe(U,t);U[e]=U[U.length-1],U.length-=1,U.length<=0&&n()}var r=oe(U,e);Ae(r>=0,"cannot cancel a frame twice"),U[r]=t}}}function s(){var e=H.viewport,t=H.scissor_box;e[0]=e[1]=t[0]=t[1]=0,T.viewportWidth=T.framebufferWidth=T.drawingBufferWidth=e[2]=t[2]=p.drawingBufferWidth,T.viewportHeight=T.framebufferHeight=T.drawingBufferHeight=e[3]=t[3]=p.drawingBufferHeight}function c(){T.tick+=1,T.time=d(),s(),M.procs.poll()}function l(){s(),M.procs.refresh(),w&&w.update()}function d(){return(De()-k)/1e3}var m=A(e);if(!m)return null;var p=m.gl,h=p.getContextAttributes(),b=p.isContextLost(),g=function(e,t){function r(t){Ae.type(t,"string","extension name must be string");var r,a=t.toLowerCase();try{r=n[a]=e.getExtension(a)}catch(e){}return!!r}for(var n={},a=0;a<t.extensions.length;++a){var i=t.extensions[a];if(!r(i))return t.onDestroy(),t.onDone('"'+i+'" extension is not supported by the current WebGL context, try upgrading your system or a different browser'),null}return t.optionalExtensions.forEach(r),{extensions:n,restore:function(){Object.keys(n).forEach(function(e){if(!r(e))throw new Error("(regl): error restoring extension "+e)})}}}(p,m);if(!g)return null;var v=function(){var e={"":0},t=[""];return{id:function(r){var n=e[r];return n||(n=e[r]=t.length,t.push(r),n)},str:function(e){return t[e]}}}(),y={bufferCount:0,elementsCount:0,framebufferCount:0,shaderCount:0,textureCount:0,cubeCount:0,renderbufferCount:0,maxTextureUnits:0},x=g.extensions,w=oi(p,x),k=De(),_=p.drawingBufferWidth,E=p.drawingBufferHeight,T={tick:0,time:0,viewportWidth:_,viewportHeight:E,framebufferWidth:_,framebufferHeight:E,drawingBufferWidth:_,drawingBufferHeight:E,pixelRatio:m.pixelRatio},D=je(p,x),j=function(e,t,r){function n(t){this.id=f++,this.buffer=e.createBuffer(),this.type=t,this.usage=qe,this.byteLength=0,this.dimension=1,this.dtype=Ve,this.persistentData=null,r.profile&&(this.stats={size:0})}function a(t,r,n){t.byteLength=r.byteLength,e.bufferData(t.type,r,n)}function i(e,t,r,n,i,o){var f;if(e.usage=r,Array.isArray(t)){if(e.dtype=n||Ye,t.length>0){var u;if(Array.isArray(t[0])){f=Ne(t);for(var s=1,c=1;c<f.length;++c)s*=f[c];e.dimension=s,a(e,u=Ue(t,f,e.dtype),r),o?e.persistentData=u:Me.freeType(u)}else if("number"==typeof t[0]){e.dimension=i;var l=Me.allocType(e.dtype,t.length);F(l,t),a(e,l,r),o?e.persistentData=l:Me.freeType(l)}else ue(t[0])?(e.dimension=t[0].length,e.dtype=n||C(t[0])||Ye,a(e,u=Ue(t,[t.length,t[0].length],e.dtype),r),o?e.persistentData=u:Me.freeType(u)):Ae.raise("invalid buffer data")}}else if(ue(t))e.dtype=n||C(t),e.dimension=i,a(e,t,r),o&&(e.persistentData=new Uint8Array(new Uint8Array(t.buffer)));else if(S(t)){f=t.shape;var d=t.stride,m=t.offset,p=0,h=0,b=0,g=0;1===f.length?(p=f[0],h=1,b=d[0],g=0):2===f.length?(p=f[0],h=f[1],b=d[0],g=d[1]):Ae.raise("invalid shape"),e.dtype=n||C(t.data)||Ye,e.dimension=h;var v=Me.allocType(e.dtype,p*h);z(v,t.data,p,h,b,g,m),a(e,v,r),o?e.persistentData=v:Me.freeType(v)}else Ae.raise("invalid buffer data")}function o(r){t.bufferCount--;var n=r.buffer;Ae(n,"buffer must not be deleted already"),e.deleteBuffer(n),r.buffer=null,delete u[r.id]}var f=0,u={};n.prototype.bind=function(){e.bindBuffer(this.type,this.buffer)},n.prototype.destroy=function(){o(this)};var s=[];return r.profile&&(t.getTotalBufferSize=function(){var e=0;return Object.keys(u).forEach(function(t){e+=u[t].stats.size}),e}),{create:function(a,f,s,c){function l(t){var n=qe,a=null,o=0,f=0,u=1;return Array.isArray(t)||ue(t)||S(t)?a=t:"number"==typeof t?o=0|t:t&&(Ae.type(t,"object","buffer arguments must be an object, a number or an array"),"data"in t&&(Ae(null===a||Array.isArray(a)||ue(a)||S(a),"invalid data for buffer"),a=t.data),"usage"in t&&(Ae.parameter(t.usage,Ge,"invalid buffer usage"),n=Ge[t.usage]),"type"in t&&(Ae.parameter(t.type,He,"invalid buffer type"),f=He[t.type]),"dimension"in t&&(Ae.type(t.dimension,"number","invalid dimension"),u=0|t.dimension),"length"in t&&(Ae.nni(o,"buffer length must be a nonnegative integer"),o=0|t.length)),m.bind(),a?i(m,a,n,f,u,c):(e.bufferData(m.type,o,n),m.dtype=f||Ve,m.usage=n,m.dimension=u,m.byteLength=o),r.profile&&(m.stats.size=m.byteLength*Xe[m.dtype]),l}function d(t,r){Ae(r+t.byteLength<=m.byteLength,"invalid buffer subdata call, buffer is too small. Can't write data of size "+t.byteLength+" starting from offset "+r+" to a buffer of size "+m.byteLength),e.bufferSubData(m.type,r,t)}t.bufferCount++;var m=new n(f);return u[m.id]=m,s||l(a),l._reglType="buffer",l._buffer=m,l.subdata=function(e,t){var r,n=0|(t||0);if(m.bind(),Array.isArray(e)){if(e.length>0)if("number"==typeof e[0]){var a=Me.allocType(m.dtype,e.length);F(a,e),d(a,n),Me.freeType(a)}else if(Array.isArray(e[0])||ue(e[0])){r=Ne(e);var i=Ue(e,r,m.dtype);d(i,n),Me.freeType(i)}else Ae.raise("invalid buffer data")}else if(ue(e))d(e,n);else if(S(e)){r=e.shape;var o=e.stride,f=0,u=0,s=0,c=0;1===r.length?(f=r[0],u=1,s=o[0],c=0):2===r.length?(f=r[0],u=r[1],s=o[0],c=o[1]):Ae.raise("invalid shape");var p=Array.isArray(e.data)?m.dtype:C(e.data),h=Me.allocType(p,f*u);z(h,e.data,f,u,s,c,e.offset),d(h,n),Me.freeType(h)}else Ae.raise("invalid data for buffer subdata");return l},r.profile&&(l.stats=m.stats),l.destroy=function(){o(m)},l},createStream:function(e,t){var r=s.pop();return r||(r=new n(e)),r.bind(),i(r,t,Qe,0,1,!1),r},destroyStream:function(e){s.push(e)},clear:function(){Oe(u).forEach(o),s.forEach(o)},getBuffer:function(e){return e&&e._buffer instanceof n?e._buffer:null},restore:function(){Oe(u).forEach(function(t){t.buffer=e.createBuffer(),e.bindBuffer(t.type,t.buffer),e.bufferData(t.type,t.persistentData||t.byteLength,t.usage)})},_initBuffer:i}}(p,y,m),O=function(e,t,r,n){function a(e){this.id=u++,f[this.id]=this,this.buffer=e,this.primType=Ze,this.vertCount=0,this.type=0}function i(n,a,i,o,f,u,s){if(n.buffer.bind(),a){var c=s;s||ue(a)&&(!S(a)||ue(a.data))||(c=t.oes_element_index_uint?it:nt),r._initBuffer(n.buffer,a,i,c,3)}else e.bufferData(ot,u,i),n.buffer.dtype=l||tt,n.buffer.usage=i,n.buffer.dimension=3,n.buffer.byteLength=u;var l=s;if(!s){switch(n.buffer.dtype){case tt:case et:l=tt;break;case nt:case rt:l=nt;break;case it:case at:l=it;break;default:Ae.raise("unsupported type for element array")}n.buffer.dtype=l}n.type=l,Ae(l!==it||!!t.oes_element_index_uint,"32 bit element buffers not supported, enable oes_element_index_uint first");var d=f;d<0&&(d=n.buffer.byteLength,l===nt?d>>=1:l===it&&(d>>=2)),n.vertCount=d;var m=o;if(o<0){m=Ze;var p=n.buffer.dimension;1===p&&(m=Ke),2===p&&(m=Je),3===p&&(m=Ze)}n.primType=m}function o(e){n.elementsCount--,Ae(null!==e.buffer,"must not double destroy elements"),delete f[e.id],e.buffer.destroy(),e.buffer=null}var f={},u=0,s={uint8:tt,uint16:nt};t.oes_element_index_uint&&(s.uint32=it),a.prototype.bind=function(){this.buffer.bind()};var c=[];return{create:function(e,t){function f(e){if(e)if("number"==typeof e)u(e),c.primType=Ze,c.vertCount=0|e,c.type=tt;else{var t=null,r=ut,n=-1,a=-1,o=0,l=0;Array.isArray(e)||ue(e)||S(e)?t=e:(Ae.type(e,"object","invalid arguments for elements"),"data"in e&&(t=e.data,Ae(Array.isArray(t)||ue(t)||S(t),"invalid data for element buffer")),"usage"in e&&(Ae.parameter(e.usage,Ge,"invalid element buffer usage"),r=Ge[e.usage]),"primitive"in e&&(Ae.parameter(e.primitive,$e,"invalid element buffer primitive"),n=$e[e.primitive]),"count"in e&&(Ae("number"==typeof e.count&&e.count>=0,"invalid vertex count for elements"),a=0|e.count),"type"in e&&(Ae.parameter(e.type,s,"invalid buffer type"),l=s[e.type]),"length"in e?o=0|e.length:(o=a,l===nt||l===rt?o*=2:l!==it&&l!==at||(o*=4))),i(c,t,r,n,a,o,l)}else u(),c.primType=Ze,c.vertCount=0,c.type=tt;return f}var u=r.create(null,ot,!0),c=new a(u._buffer);return n.elementsCount++,f(e),f._reglType="elements",f._elements=c,f.subdata=function(e,t){return u.subdata(e,t),f},f.destroy=function(){o(c)},f},createStream:function(e){var t=c.pop();return t||(t=new a(r.create(null,ot,!0,!1)._buffer)),i(t,e,ft,-1,-1,0,0),t},destroyStream:function(e){c.push(e)},getElements:function(e){return"function"==typeof e&&e._elements instanceof a?e._elements:null},clear:function(){Oe(f).forEach(o)}}}(p,x,j,y),B=function(e,t,r,n,a){for(var i=r.maxAttributes,o=new Array(i),f=0;f<i;++f)o[f]=new Y;return{Record:Y,scope:{},state:o}}(0,0,D),P=X(p,v,y,m),R=Q(p,x,D,function(){M.procs.poll()},T,y,m),L=Fr(p,x,D,y,m),I=function(e,t,r,n,a,i){function o(e,t,r){this.target=e,this.texture=t,this.renderbuffer=r;var n=0,a=0;t?(n=t.width,a=t.height):r&&(n=r.width,a=r.height),this.width=n,this.height=a}function f(e){e&&(e.texture&&e.texture._texture.decRef(),e.renderbuffer&&e.renderbuffer._renderbuffer.decRef())}function u(e,t,r){if(e)if(e.texture){var n=e.texture._texture,a=Math.max(1,n.width),i=Math.max(1,n.height);Ae(a===t&&i===r,"inconsistent width/height for supplied texture"),n.refCount+=1}else{var o=e.renderbuffer._renderbuffer;Ae(o.width===t&&o.height===r,"inconsistent width/height for renderbuffer"),o.refCount+=1}}function s(t,r){r&&(r.texture?e.framebufferTexture2D(zr,t,r.target,r.texture._texture.texture,0):e.framebufferRenderbuffer(zr,t,Br,r.renderbuffer._renderbuffer.renderbuffer))}function c(e){var t=Pr,r=null,n=null,a=e;"object"==typeof e&&(a=e.data,"target"in e&&(t=0|e.target)),Ae.type(a,"function","invalid attachment data");var i=a._reglType;return"texture2d"===i?(r=a,Ae(t===Pr)):"textureCube"===i?(r=a,Ae(t>=Rr&&t<Rr+6,"invalid cube map target")):"renderbuffer"===i?(n=a,t=Br):Ae.raise("invalid regl object for attachment"),new o(t,r,n)}function l(e,t,r,i,f){if(r){var u=n.create2D({width:e,height:t,format:i,type:f});return u._texture.refCount=0,new o(Pr,u,null)}var s=a.create({width:e,height:t,format:i});return s._renderbuffer.refCount=0,new o(Br,null,s)}function d(e){return e&&(e.texture||e.renderbuffer)}function m(e,t,r){e&&(e.texture?e.texture.resize(t,r):e.renderbuffer&&e.renderbuffer.resize(t,r))}function p(){this.id=A++,S[this.id]=this,this.framebuffer=e.createFramebuffer(),this.width=0,this.height=0,this.colorAttachments=[],this.depthAttachment=null,this.stencilAttachment=null,this.depthStencilAttachment=null}function h(e){e.colorAttachments.forEach(f),f(e.depthAttachment),f(e.stencilAttachment),f(e.depthStencilAttachment)}function b(t){var r=t.framebuffer;Ae(r,"must not double destroy framebuffer"),e.deleteFramebuffer(r),t.framebuffer=null,i.framebufferCount--,delete S[t.id]}function g(t){var n;e.bindFramebuffer(zr,t.framebuffer);var a=t.colorAttachments;for(n=0;n<a.length;++n)s(Lr+n,a[n]);for(n=a.length;n<r.maxColorAttachments;++n)e.framebufferTexture2D(zr,Lr+n,Pr,null,0);e.framebufferTexture2D(zr,Wr,Pr,null,0),e.framebufferTexture2D(zr,Ir,Pr,null,0),e.framebufferTexture2D(zr,Mr,Pr,null,0),s(Ir,t.depthAttachment),s(Mr,t.stencilAttachment),s(Wr,t.depthStencilAttachment);var i=e.checkFramebufferStatus(zr);i!==Hr&&Ae.raise("framebuffer configuration not supported, status = "+$r[i]),e.bindFramebuffer(zr,y.next),y.cur=y.next,e.getError()}function v(e,n){function a(e,n){var i;Ae(y.next!==o,"can not update framebuffer which is currently in use");var f=t.webgl_draw_buffers,s=0,m=0,p=!0,b=!0,v=null,A=!0,S="rgba",_="uint8",E=1,T=null,D=null,j=null,O=!1;if("number"==typeof e)s=0|e,m=0|n||s;else if(e){Ae.type(e,"object","invalid arguments for framebuffer");var C=e;if("shape"in C){var F=C.shape;Ae(Array.isArray(F)&&F.length>=2,"invalid shape for framebuffer"),s=F[0],m=F[1]}else"radius"in C&&(s=m=C.radius),"width"in C&&(s=C.width),"height"in C&&(m=C.height);("color"in C||"colors"in C)&&(v=C.color||C.colors,Array.isArray(v)&&Ae(1===v.length||f,"multiple render targets not supported")),v||("colorCount"in C&&(E=0|C.colorCount,Ae(E>0,"invalid color buffer count")),"colorTexture"in C&&(A=!!C.colorTexture,S="rgba4"),"colorType"in C&&(_=C.colorType,A?(Ae(t.oes_texture_float||!("float"===_||"float32"===_),"you must enable OES_texture_float in order to use floating point framebuffer objects"),Ae(t.oes_texture_half_float||!("half float"===_||"float16"===_),"you must enable OES_texture_half_float in order to use 16-bit floating point framebuffer objects")):"half float"===_||"float16"===_?(Ae(t.ext_color_buffer_half_float,"you must enable EXT_color_buffer_half_float to use 16-bit render buffers"),S="rgba16f"):"float"!==_&&"float32"!==_||(Ae(t.webgl_color_buffer_float,"you must enable WEBGL_color_buffer_float in order to use 32-bit floating point renderbuffers"),S="rgba32f"),Ae.oneOf(_,k,"invalid color type")),"colorFormat"in C&&(S=C.colorFormat,x.indexOf(S)>=0?A=!0:w.indexOf(S)>=0?A=!1:A?Ae.oneOf(C.colorFormat,x,"invalid color format for texture"):Ae.oneOf(C.colorFormat,w,"invalid color format for renderbuffer"))),("depthTexture"in C||"depthStencilTexture"in C)&&(O=!(!C.depthTexture&&!C.depthStencilTexture),Ae(!O||t.webgl_depth_texture,"webgl_depth_texture extension not supported")),"depth"in C&&("boolean"==typeof C.depth?p=C.depth:(T=C.depth,b=!1)),"stencil"in C&&("boolean"==typeof C.stencil?b=C.stencil:(D=C.stencil,p=!1)),"depthStencil"in C&&("boolean"==typeof C.depthStencil?p=b=C.depthStencil:(j=C.depthStencil,p=!1,b=!1))}else s=m=1;var z=null,B=null,P=null,R=null;if(Array.isArray(v))z=v.map(c);else if(v)z=[c(v)];else for(z=new Array(E),i=0;i<E;++i)z[i]=l(s,m,A,S,_);Ae(t.webgl_draw_buffers||z.length<=1,"you must enable the WEBGL_draw_buffers extension in order to use multiple color buffers."),Ae(z.length<=r.maxColorAttachments,"too many color attachments, not supported"),s=s||z[0].width,m=m||z[0].height,T?B=c(T):p&&!b&&(B=l(s,m,O,"depth","uint32")),D?P=c(D):b&&!p&&(P=l(s,m,!1,"stencil","uint8")),j?R=c(j):!T&&!D&&b&&p&&(R=l(s,m,O,"depth stencil","depth stencil")),Ae(!!T+!!D+!!j<=1,"invalid framebuffer configuration, can specify exactly one depth/stencil attachment");var L=null;for(i=0;i<z.length;++i)if(u(z[i],s,m),Ae(!z[i]||z[i].texture&&Ur.indexOf(z[i].texture._texture.format)>=0||z[i].renderbuffer&&Xr.indexOf(z[i].renderbuffer._renderbuffer.format)>=0,"framebuffer color attachment "+i+" is invalid"),z[i]&&z[i].texture){var I=Nr[z[i].texture._texture.format]*qr[z[i].texture._texture.type];null===L?L=I:Ae(L===I,"all color attachments much have the same number of bits per pixel.")}return u(B,s,m),Ae(!B||B.texture&&B.texture._texture.format===Gr||B.renderbuffer&&B.renderbuffer._renderbuffer.format===Qr,"invalid depth attachment for framebuffer object"),u(P,s,m),Ae(!P||P.renderbuffer&&P.renderbuffer._renderbuffer.format===Vr,"invalid stencil attachment for framebuffer object"),u(R,s,m),Ae(!R||R.texture&&R.texture._texture.format===Yr||R.renderbuffer&&R.renderbuffer._renderbuffer.format===Yr,"invalid depth-stencil attachment for framebuffer object"),h(o),o.width=s,o.height=m,o.colorAttachments=z,o.depthAttachment=B,o.stencilAttachment=P,o.depthStencilAttachment=R,a.color=z.map(d),a.depth=d(B),a.stencil=d(P),a.depthStencil=d(R),a.width=o.width,a.height=o.height,g(o),a}var o=new p;return i.framebufferCount++,a(e,n),se(a,{resize:function(e,t){Ae(y.next!==o,"can not resize a framebuffer which is currently in use");var r=0|e,n=0|t||r;if(r===o.width&&n===o.height)return a;for(var i=o.colorAttachments,f=0;f<i.length;++f)m(i[f],r,n);return m(o.depthAttachment,r,n),m(o.stencilAttachment,r,n),m(o.depthStencilAttachment,r,n),o.width=a.width=r,o.height=a.height=n,g(o),a},_reglType:"framebuffer",_framebuffer:o,destroy:function(){b(o),h(o)},use:function(e){y.setFBO({framebuffer:a},e)}})}var y={cur:null,next:null,dirty:!1,setFBO:null},x=["rgba"],w=["rgba4","rgb565","rgb5 a1"];t.ext_srgb&&w.push("srgba"),t.ext_color_buffer_half_float&&w.push("rgba16f","rgb16f"),t.webgl_color_buffer_float&&w.push("rgba32f");var k=["uint8"];t.oes_texture_half_float&&k.push("half float","float16"),t.oes_texture_float&&k.push("float","float32");var A=0,S={};return se(y,{getFramebuffer:function(e){if("function"==typeof e&&"framebuffer"===e._reglType){var t=e._framebuffer;if(t instanceof p)return t}return null},create:v,createCube:function(e){function a(e){var r;Ae(i.indexOf(y.next)<0,"can not update framebuffer which is currently in use");var o=t.webgl_draw_buffers,f={color:null},u=0,s=null,c="rgba",l="uint8",d=1;if("number"==typeof e)u=0|e;else if(e){Ae.type(e,"object","invalid arguments for framebuffer");var m=e;if("shape"in m){var p=m.shape;Ae(Array.isArray(p)&&p.length>=2,"invalid shape for framebuffer"),Ae(p[0]===p[1],"cube framebuffer must be square"),u=p[0]}else"radius"in m&&(u=0|m.radius),"width"in m?(u=0|m.width,"height"in m&&Ae(m.height===u,"must be square")):"height"in m&&(u=0|m.height);("color"in m||"colors"in m)&&(s=m.color||m.colors,Array.isArray(s)&&Ae(1===s.length||o,"multiple render targets not supported")),s||("colorCount"in m&&(d=0|m.colorCount,Ae(d>0,"invalid color buffer count")),"colorType"in m&&(Ae.oneOf(m.colorType,k,"invalid color type"),l=m.colorType),"colorFormat"in m&&(c=m.colorFormat,Ae.oneOf(m.colorFormat,x,"invalid color format for texture"))),"depth"in m&&(f.depth=m.depth),"stencil"in m&&(f.stencil=m.stencil),"depthStencil"in m&&(f.depthStencil=m.depthStencil)}else u=1;var h;if(s)if(Array.isArray(s))for(h=[],r=0;r<s.length;++r)h[r]=s[r];else h=[s];else{h=Array(d);var b={radius:u,format:c,type:l};for(r=0;r<d;++r)h[r]=n.createCube(b)}for(f.color=Array(h.length),r=0;r<h.length;++r){var g=h[r];Ae("function"==typeof g&&"textureCube"===g._reglType,"invalid cube map"),u=u||g.width,Ae(g.width===u&&g.height===u,"invalid cube map shape"),f.color[r]={target:Rr,data:h[r]}}for(r=0;r<6;++r){for(var w=0;w<h.length;++w)f.color[w].target=Rr+r;r>0&&(f.depth=i[0].depth,f.stencil=i[0].stencil,f.depthStencil=i[0].depthStencil),i[r]?i[r](f):i[r]=v(f)}return se(a,{width:u,height:u,color:h})}var i=Array(6);return a(e),se(a,{faces:i,resize:function(e){var t,n=0|e;if(Ae(n>0&&n<=r.maxCubeMapSize,"invalid radius for cube fbo"),n===a.width)return a;var o=a.color;for(t=0;t<o.length;++t)o[t].resize(n);for(t=0;t<6;++t)i[t].resize(n);return a.width=a.height=n,a},_reglType:"framebufferCube",destroy:function(){i.forEach(function(e){e.destroy()})}})},clear:function(){Oe(S).forEach(b)},restore:function(){Oe(S).forEach(function(t){t.framebuffer=e.createFramebuffer(),g(t)})}})}(p,x,D,R,L,y),M=ie(p,v,x,D,j,O,0,I,{},B,P,{elements:null,primitive:4,count:-1,offset:0,instances:-1},T,w,m),W=$(p,I,M.procs.poll,T,h,x),H=M.next,G=p.canvas,U=[],N=[],q=[],V=[m.onDestroy],K=null;G&&(G.addEventListener(li,a,!1),G.addEventListener(di,i,!1));var J=I.setFBO=o({framebuffer:Ee.define.call(null,mi,"framebuffer")});l();var Z=se(o,{clear:function(e){if(Ae("object"==typeof e&&e,"regl.clear() takes an object as input"),"framebuffer"in e)if(e.framebuffer&&"framebufferCube"===e.framebuffer_reglType)for(var t=0;t<6;++t)J(se({framebuffer:e.framebuffer.faces[t]},e),f);else J(e,f);else f(0,e)},prop:Ee.define.bind(null,mi),context:Ee.define.bind(null,pi),this:Ee.define.bind(null,hi),draw:o({}),buffer:function(e){return j.create(e,ci,!1,!1)},elements:function(e){return O.create(e,!1)},texture:R.create2D,cube:R.createCube,renderbuffer:L.create,framebuffer:I.create,framebufferCube:I.createCube,attributes:h,frame:u,on:function(e,t){Ae.type(t,"function","listener callback must be a function");var r;switch(e){case"frame":return u(t);case"lost":r=N;break;case"restore":r=q;break;case"destroy":r=V;break;default:Ae.raise("invalid event, must be one of frame,lost,restore,destroy")}return r.push(t),{cancel:function(){for(var e=0;e<r.length;++e)if(r[e]===t)return r[e]=r[r.length-1],void r.pop()}}},limits:D,hasExtension:function(e){return D.extensions.indexOf(e.toLowerCase())>=0},read:W,destroy:function(){U.length=0,n(),G&&(G.removeEventListener(li,a),G.removeEventListener(di,i)),P.clear(),I.clear(),L.clear(),R.clear(),O.clear(),j.clear(),w&&w.clear(),V.forEach(function(e){e()})},_gl:p,_refresh:l,poll:function(){c(),w&&w.update()},now:d,stats:y});return m.onDone(null,Z),Z}});
|
|
},{}],48:[function(require,module,exports) {
|
|
"use strict";function t(t,i,s){return t<i?i:t>s?s:t}Object.defineProperty(exports,"__esModule",{value:!0}),exports.clamp=t;class i{constructor(t=0,i=0){this.x=t,this.y=i}withX(t){return new i(t,this.y)}withY(t){return new i(this.x,t)}plus(t){return new i(this.x+t.x,this.y+t.y)}minus(t){return new i(this.x-t.x,this.y-t.y)}times(t){return new i(this.x*t,this.y*t)}timesPointwise(t){return new i(this.x*t.x,this.y*t.y)}dividedByPointwise(t){return new i(this.x/t.x,this.y/t.y)}dot(t){return this.x*t.x+this.y*t.y}length2(){return this.dot(this)}length(){return Math.sqrt(this.length2())}static min(t,s){return new i(Math.min(t.x,s.x),Math.min(t.y,s.y))}static max(t,s){return new i(Math.max(t.x,s.x),Math.max(t.y,s.y))}flatten(){return[this.x,this.y]}}exports.Vec2=i;class s{constructor(t=1,i=0,s=0,e=0,r=1,n=0){this.m00=t,this.m01=i,this.m02=s,this.m10=e,this.m11=r,this.m12=n}withScale(t){let{m00:i,m01:e,m02:r,m10:n,m11:h,m12:m}=this;return i=t.x,h=t.y,new s(i,e,r,n,h,m)}static withScale(t){return(new s).withScale(t)}scaledBy(t){return s.withScale(t).times(this)}getScale(){return new i(this.m00,this.m11)}withTranslation(t){let{m00:i,m01:e,m02:r,m10:n,m11:h,m12:m}=this;return r=t.x,m=t.y,new s(i,e,r,n,h,m)}static withTranslation(t){return(new s).withTranslation(t)}getTranslation(){return new i(this.m02,this.m12)}translatedBy(t){return s.withTranslation(t).times(this)}static betweenRects(t,e){return s.withTranslation(t.origin.times(-1)).scaledBy(new i(e.size.x/t.size.x,e.size.y/t.size.y)).translatedBy(e.origin)}times(t){const i=this.m00*t.m00+this.m01*t.m10,e=this.m00*t.m01+this.m01*t.m11,r=this.m00*t.m02+this.m01*t.m12+this.m02,n=this.m10*t.m00+this.m11*t.m10,h=this.m10*t.m01+this.m11*t.m11,m=this.m10*t.m02+this.m11*t.m12+this.m12;return new s(i,e,r,n,h,m)}timesScalar(t){const{m00:i,m01:e,m02:r,m10:n,m11:h,m12:m}=this;return new s(t*i,t*e,t*r,t*n,t*h,t*m)}det(){const{m00:t,m01:i,m02:s,m10:e,m11:r,m12:n}=this;return t*(1*r-0*n)-i*(1*e-0*n)+s*(0*e-0*r)}adj(){const{m00:t,m01:i,m02:e,m10:r,m11:n,m12:h}=this;return new s(+(1*n-0*h),-(1*i-0*e),+(i*h-e*n),-(1*r-0*h),+(1*t-0*e),-(t*h-e*r))}inverted(){const t=this.det();if(0===t)return null;return this.adj().timesScalar(1/t)}transformVector(t){return new i(t.x*this.m00+t.y*this.m01,t.x*this.m10+t.y*this.m11)}inverseTransformVector(t){const i=this.inverted();return i?i.transformVector(t):null}transformPosition(t){return new i(t.x*this.m00+t.y*this.m01+this.m02,t.x*this.m10+t.y*this.m11+this.m12)}inverseTransformPosition(t){const i=this.inverted();return i?i.transformPosition(t):null}transformRect(t){return new e(this.transformPosition(t.origin),this.transformVector(t.size))}flatten(){return[this.m00,this.m10,0,this.m01,this.m11,0,this.m02,this.m12,1]}}exports.AffineTransform=s;class e{constructor(t=new i,s=new i){this.origin=t,this.size=s}isEmpty(){return 0==this.width()||0==this.height()}width(){return this.size.x}height(){return this.size.y}left(){return this.origin.x}right(){return this.left()+this.width()}top(){return this.origin.y}bottom(){return this.top()+this.height()}topLeft(){return this.origin}topRight(){return this.origin.plus(new i(this.width(),0))}bottomRight(){return this.origin.plus(this.size)}bottomLeft(){return this.origin.plus(new i(0,this.height()))}withOrigin(t){return new e(t,this.size)}withSize(t){return new e(this.origin,t)}closestPointTo(s){return new i(t(s.x,this.left(),this.right()),t(s.y,this.top(),this.bottom()))}distanceFrom(t){return t.minus(this.closestPointTo(t)).length()}contains(t){return 0===this.distanceFrom(t)}intersectWith(t){const s=i.max(this.topLeft(),t.topLeft()),r=i.max(s,i.min(this.bottomRight(),t.bottomRight()));return new e(s,r.minus(s))}}exports.Rect=e;
|
|
},{}],47:[function(require,module,exports) {
|
|
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const t=require("./math");exports.rectangleBatchRenderer=((e,o,i,n=1)=>{const c=[],a=[],r=[],l={topLeft:new t.Vec2(n,-n),topRight:new t.Vec2(-n,-n),bottomRight:new t.Vec2(-n,n),bottomLeft:new t.Vec2(n,n)},p=(t,e)=>{function o(t,o){c.push(t.flatten()),a.push(o.flatten()),r.push(e)}o(t.topLeft(),l.topLeft),o(t.bottomLeft(),l.bottomLeft),o(t.topRight(),l.topRight),o(t.bottomLeft(),l.bottomLeft),o(t.topRight(),l.topRight),o(t.bottomRight(),l.bottomRight)};for(let t=0;t<o.length;t++)p(o[t],i[t]);return e({vert:"\n uniform mat3 configSpaceToNDC;\n uniform vec2 physicalSize;\n attribute vec2 position;\n attribute vec3 color;\n attribute vec2 physicalSpaceOffset;\n varying vec3 vColor;\n void main() {\n vColor = color;\n vec2 roundedPosition = (configSpaceToNDC * vec3(position.xy, 1)).xy;\n vec2 halfSize = physicalSize / 2.0;\n vec2 physicalPixelSize = 2.0 / physicalSize;\n roundedPosition = floor(roundedPosition * halfSize) / halfSize;\n gl_Position = vec4(roundedPosition + physicalPixelSize * physicalSpaceOffset, 0, 1);\n }\n ",depth:{enable:!1},frag:"\n precision mediump float;\n varying vec3 vColor;\n void main() {\n gl_FragColor = vec4(vColor, 1);\n }\n ",attributes:{position:c,physicalSpaceOffset:a,color:r},uniforms:{configSpaceToNDC:(t,e)=>e.configSpaceToNDC.flatten(),physicalSize:(t,e)=>e.physicalSize.flatten()},primitive:"triangles",count:r.length})});
|
|
},{"./math":48}],49:[function(require,module,exports) {
|
|
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e=require("aphrodite"),o=require("./style"),i=2;var t;!function(e){e.MINIMAP_HEIGHT=100,e.TOOLTIP_WIDTH_MAX=300,e.TOOLTIP_HEIGHT_MAX=75,e.SEPARATOR_HEIGHT=2,e.FRAME_HEIGHT=16}(t=exports.Sizes||(exports.Sizes={})),exports.style=e.StyleSheet.create({hoverTip:{position:"absolute",background:"white",border:"1px solid black",maxWidth:t.TOOLTIP_WIDTH_MAX,paddingTop:2,paddingBottom:2,pointerEvents:"none",userSelect:"none",fontSize:o.FontSize.LABEL,fontFamily:o.FontFamily.MONOSPACE},hoverTipRow:{textOverflow:"ellipsis",whiteSpace:"nowrap",overflowX:"hidden",paddingLeft:2,paddingRight:2,maxWidth:t.TOOLTIP_WIDTH_MAX},hoverCount:{color:"#6FCF97"},clip:{overflow:"hidden"},vbox:{display:"flex",flexDirection:"column",position:"relative"},fill:{width:"100%",height:"100%",position:"absolute",left:0,top:0},minimap:{height:t.MINIMAP_HEIGHT,borderBottom:`${t.SEPARATOR_HEIGHT}px solid ${o.Colors.MEDIUM_GRAY}`},panZoomView:{flex:1}});
|
|
},{"aphrodite":13,"./style":9}],46:[function(require,module,exports) {
|
|
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e=require("regl"),i=require("preact"),t=require("aphrodite"),n=require("./math"),s=require("./rectangle-batch-renderer"),a=require("./utils"),r=require("./flamechart-style"),o=require("./style"),c=window.devicePixelRatio;class h extends i.Component{constructor(){super(...arguments),this.renderer=null,this.viewportRectRenderer=null,this.ctx=null,this.regl=null,this.canvas=null,this.overlayCanvas=null,this.overlayCtx=null,this.renderCanvas=a.atMostOnceAFrame(()=>{if(!this.canvas||this.canvas.getBoundingClientRect().width<2)requestAnimationFrame(()=>this.renderCanvas());else{if(!this.regl)return;this.renderer||this.preprocess(this.props.flamechart),this.regl.clear({color:[1,1,1,1],depth:1}),this.renderRects(),this.renderOverlays()}}),this.canvasRef=(i=>{i?(this.canvas=i,this.ctx=this.canvas.getContext("webgl"),this.regl=e(this.ctx),this.renderCanvas()):this.canvas=null}),this.onWheel=(e=>{e.preventDefault(),this.pan(new n.Vec2(e.deltaX,e.deltaY)),this.renderCanvas()}),this.dragStartPos=null,this.onMouseDown=(e=>{this.dragStartPos=new n.Vec2(e.offsetX,e.offsetY)}),this.onMouseDrag=(e=>{if(!this.dragStartPos)return;const i=this.dragStartPos,t=this.logicalToPhysicalViewSpace().transformPosition(i),s=this.configSpaceToPhysicalViewSpace().inverseTransformPosition(t),a=new n.Vec2(e.offsetX,e.offsetY),r=this.logicalToPhysicalViewSpace().transformPosition(a),o=this.configSpaceToPhysicalViewSpace().inverseTransformPosition(r);if(!s||!o)return;const c=Math.min(s.x,o.x),h=Math.max(s.x,o.x)-c,l=this.props.configSpaceViewportRect.height();this.setConfigSpaceViewportRect(new n.Rect(new n.Vec2(c,o.y-l/2),new n.Vec2(h,l)))}),this.onMouseMove=(e=>{if(this.dragStartPos)return e.preventDefault(),void this.onMouseDrag(e)}),this.onWindowMouseUp=(e=>{document.body.style.cursor="default",this.dragStartPos=null}),this.overlayCanvasRef=(e=>{e?(this.overlayCanvas=e,this.overlayCtx=this.overlayCanvas.getContext("2d"),this.renderCanvas()):(this.overlayCanvas=null,this.overlayCtx=null)})}physicalViewSize(){return new n.Vec2(this.canvas?this.canvas.width:0,this.canvas?this.canvas.height:0)}configSpaceSize(){return new n.Vec2(this.props.flamechart.getTotalWeight(),this.props.flamechart.getLayers().length)}configSpaceToPhysicalViewSpace(){const e=new n.Vec2(0,r.Sizes.FRAME_HEIGHT*c);return n.AffineTransform.betweenRects(new n.Rect(new n.Vec2(0,0),this.configSpaceSize()),new n.Rect(e,this.physicalViewSize().minus(e)))}physicalViewSpaceToNDC(){return n.AffineTransform.withScale(new n.Vec2(1,-1)).times(n.AffineTransform.betweenRects(new n.Rect(new n.Vec2(0,0),this.physicalViewSize()),new n.Rect(new n.Vec2(-1,-1),new n.Vec2(2,2))))}renderRects(){if(!this.renderer||!this.canvas||!this.viewportRectRenderer)return;this.resizeCanvasIfNeeded();const e=this.physicalViewSpaceToNDC().times(this.configSpaceToPhysicalViewSpace());this.renderer({configSpaceToNDC:e,physicalSize:this.physicalViewSize()}),this.viewportRectRenderer({configSpaceViewportRect:this.props.configSpaceViewportRect,configSpaceToPhysicalViewSpace:this.configSpaceToPhysicalViewSpace(),physicalSize:this.physicalViewSize()})}renderOverlays(){const e=this.overlayCtx;if(!e)return;const i=this.physicalViewSize();e.clearRect(0,0,i.x,i.y),this.resizeOverlayCanvasIfNeeded();const t=this.configSpaceToPhysicalViewSpace(),s=this.configSpaceSize().x,h=(this.configSpaceToPhysicalViewSpace().inverted()||new n.AffineTransform).times(this.logicalToPhysicalViewSpace()).transformVector(new n.Vec2(200,1)).x,l=r.Sizes.FRAME_HEIGHT*c,p=o.FontSize.LABEL*c,f=(l-p)/2;e.font=`${p}px/${l}px ${o.FontFamily.MONOSPACE}`,e.textBaseline="top";let g=Math.pow(10,Math.floor(Math.log10(h)));h/g>5?g*=5:h/g>2&&(g*=2),e.fillStyle="rgba(255, 255, 255, 0.8)",e.fillRect(0,0,i.x,l),e.fillStyle=o.Colors.GRAY;for(let r=Math.ceil(0/g)*g;r<s;r+=g){const s=Math.round(t.transformPosition(new n.Vec2(r,0)).x),o=this.props.flamechart.formatValue(r),c=Math.ceil(a.cachedMeasureTextWidth(e,o));e.fillText(o,s-c-f,f),e.fillRect(s,0,1,i.y)}}componentWillReceiveProps(e){this.props.flamechart!==e.flamechart?(this.renderer=null,this.renderCanvas()):this.props.configSpaceViewportRect!=e.configSpaceViewportRect&&this.renderCanvas()}resizeCanvasIfNeeded(){if(!this.canvas||!this.ctx)return;let{width:e,height:i}=this.canvas.getBoundingClientRect();if(e=Math.floor(e)*c,i=Math.floor(i)*c,0===e||0===i)return;const t=this.canvas.width,n=this.canvas.height;e===t&&i===n||(this.canvas.width=e,this.canvas.height=i,this.ctx.viewport(0,0,e,i))}resizeOverlayCanvasIfNeeded(){if(!this.overlayCanvas)return;let{width:e,height:i}=this.overlayCanvas.getBoundingClientRect();if(e=Math.floor(e),i=Math.floor(i),0===e||0===i)return;const t=e*c,n=i*c;t===this.overlayCanvas.width&&n===this.overlayCanvas.height||(this.overlayCanvas.width=t,this.overlayCanvas.height=n)}minConfigSpaceViewportRectWidth(){return 3*this.props.flamechart.getMinFrameWidth()}transformViewport(e){const i=e.transformRect(this.props.configSpaceViewportRect);this.setConfigSpaceViewportRect(i)}setConfigSpaceViewportRect(e){const i=new n.Rect(new n.Vec2(0,0),n.Vec2.max(new n.Vec2(0,0),this.configSpaceSize().minus(e.size))),t=new n.Rect(new n.Vec2(this.minConfigSpaceViewportRectWidth(),e.height()),new n.Vec2(this.configSpaceSize().x,e.height()));this.props.setConfigSpaceViewportRect(new n.Rect(i.closestPointTo(e.origin),t.closestPointTo(e.size)))}logicalToPhysicalViewSpace(){return n.AffineTransform.withScale(new n.Vec2(c,c))}pan(e){const i=this.logicalToPhysicalViewSpace().transformVector(e),t=this.configSpaceToPhysicalViewSpace().inverseTransformVector(i);t&&this.transformViewport(n.AffineTransform.withTranslation(t))}preprocess(e){if(!this.canvas||!this.regl)return;const i=[],t=[],a=e.getLayers();for(let s=0;s<a.length;s++){const r=a[s];for(let a of r){const r=new n.Rect(new n.Vec2(a.start,s),new n.Vec2(a.end-a.start,1));i.push(r);const o=e.getColorForFrame(a.node.frame);t.push([o.r,o.g,o.b])}}this.renderer=s.rectangleBatchRenderer(this.regl,i,t,0),this.viewportRectRenderer=exports.viewportRectangleRenderer(this.regl)}componentDidMount(){window.addEventListener("mouseup",this.onWindowMouseUp)}componentWillUnmount(){window.removeEventListener("mouseup",this.onWindowMouseUp)}render(){return i.h("div",{onWheel:this.onWheel,onMouseDown:this.onMouseDown,onMouseMove:this.onMouseMove,className:t.css(r.style.minimap,r.style.vbox)},i.h("canvas",{width:1,height:1,ref:this.canvasRef,className:t.css(r.style.fill)}),i.h("canvas",{width:1,height:1,ref:this.overlayCanvasRef,className:t.css(r.style.fill)}))}}exports.FlamechartMinimapView=h,exports.viewportRectangleRenderer=(e=>e({vert:"\n attribute vec2 position;\n\n void main() {\n gl_Position = vec4(position, 0, 1);\n }\n ",frag:"\n precision mediump float;\n\n uniform mat3 configSpaceToPhysicalViewSpace;\n uniform vec2 physicalSize;\n uniform vec2 configSpaceViewportOrigin;\n uniform vec2 configSpaceViewportSize;\n\n void main() {\n vec2 origin = (configSpaceToPhysicalViewSpace * vec3(configSpaceViewportOrigin, 1.0)).xy;\n vec2 size = (configSpaceToPhysicalViewSpace * vec3(configSpaceViewportSize, 0.0)).xy;\n\n vec2 halfSize = physicalSize / 2.0;\n\n float borderWidth = 2.0;\n\n origin = floor(origin * halfSize) / halfSize + borderWidth * vec2(1.0, 1.0);\n size = floor(size * halfSize) / halfSize - 2.0 * borderWidth * vec2(1.0, 1.0);\n\n vec2 coord = gl_FragCoord.xy;\n coord.y = physicalSize.y - coord.y;\n vec2 clamped = clamp(coord, origin, origin + size);\n vec2 gap = clamped - coord;\n float maxdist = max(abs(gap.x), abs(gap.y));\n\n // TOOD(jlfwong): Could probably optimize this to use mix somehow.\n if (maxdist == 0.0) {\n // Inside viewport rectangle\n gl_FragColor = vec4(0, 0, 0, 0);\n } else if (maxdist < borderWidth) {\n // Inside viewport rectangle at border\n gl_FragColor = vec4(0.7, 0.7, 0.7, 0.8);\n } else {\n // Outside viewport rectangle\n gl_FragColor = vec4(0.7, 0.7, 0.7, 0.5);\n }\n }\n ",blend:{enable:!0,func:{srcRGB:"src alpha",srcAlpha:"one",dstRGB:"one minus src alpha",dstAlpha:"one"}},depth:{enable:!1},attributes:{position:[[-1,1],[1,1],[-1,-1],[1,-1]]},uniforms:{configSpaceToPhysicalViewSpace:(e,i)=>i.configSpaceToPhysicalViewSpace.flatten(),configSpaceViewportOrigin:(e,i)=>i.configSpaceViewportRect.origin.flatten(),configSpaceViewportSize:(e,i)=>i.configSpaceViewportRect.size.flatten(),physicalSize:(e,i)=>i.physicalSize.flatten()},primitive:"triangle strip",count:4}));
|
|
},{"regl":50,"preact":4,"aphrodite":13,"./math":48,"./rectangle-batch-renderer":47,"./utils":45,"./flamechart-style":49,"./style":9}],6:[function(require,module,exports) {
|
|
"use strict";function e(e,t,i,s,o=1){for(;;){if(t-e<=o)return[e,t];const n=(t+e)/2;i(n)<s?e=n:t=n}}function t(e,t){const i=Math.floor(t/2),s=e.substr(0,i),o=e.substr(e.length-i,i);return s+w+o}function i(i,s,o){if(c.cachedMeasureTextWidth(i,s)<=o)return s;const[n]=e(0,s.length,e=>c.cachedMeasureTextWidth(i,t(s,e)),o);return t(s,n)}Object.defineProperty(exports,"__esModule",{value:!0});const s=require("preact"),o=require("aphrodite"),n=require("./reloadable"),r=require("regl"),a=require("./math"),c=require("./utils"),h=require("./rectangle-batch-renderer"),l=require("./flamechart-minimap-view"),p=require("./flamechart-style"),f=require("./style"),w="…",d=window.devicePixelRatio;class u extends n.ReloadableComponent{constructor(){super(...arguments),this.renderer=null,this.ctx=null,this.regl=null,this.canvas=null,this.overlayCanvas=null,this.overlayCtx=null,this.labels=[],this.hoveredLabel=null,this.canvasRef=(e=>{e?(this.canvas=e,this.ctx=this.canvas.getContext("webgl"),this.regl=r(this.ctx),this.renderCanvas()):this.canvas=null}),this.overlayCanvasRef=(e=>{e?(this.overlayCanvas=e,this.overlayCtx=this.overlayCanvas.getContext("2d"),this.renderCanvas()):(this.overlayCanvas=null,this.overlayCtx=null)}),this.LOGICAL_VIEW_SPACE_FRAME_HEIGHT=16,this.onWindowResize=(()=>{this.resizeCanvasIfNeeded(!0),this.renderCanvas()}),this.frameHadWheelEvent=!1,this.framesWithoutWheelEvents=0,this.interactionLock=null,this.maybeClearInteractionLock=(()=>{this.interactionLock&&(this.frameHadWheelEvent||(this.framesWithoutWheelEvents++,this.framesWithoutWheelEvents>=2&&(this.interactionLock=null,this.framesWithoutWheelEvents=0)),requestAnimationFrame(this.renderCanvas)),this.frameHadWheelEvent=!1}),this.renderCanvas=c.atMostOnceAFrame(()=>{this.maybeClearInteractionLock(),!this.canvas||this.canvas.getBoundingClientRect().width<2?requestAnimationFrame(()=>this.renderCanvas()):(this.renderer||this.preprocess(this.props.flamechart),this.renderRects(),this.renderOverlays())}),this.lastDragPos=null,this.onMouseDown=(e=>{document.body.style.cursor="grabbing",document.body.style.cursor="-webkit-grabbing",this.lastDragPos=new a.Vec2(e.offsetX,e.offsetY)}),this.onMouseDrag=(e=>{if(!this.lastDragPos)return;const t=new a.Vec2(e.offsetX,e.offsetY);this.pan(this.lastDragPos.minus(t)),this.lastDragPos=t,this.hoveredLabel&&this.props.setNodeHover(this.hoveredLabel.node,t)}),this.onWindowMouseUp=(e=>{document.body.style.cursor="default",this.lastDragPos=null}),this.onMouseMove=(e=>{if(this.lastDragPos)return e.preventDefault(),void this.onMouseDrag(e);this.hoveredLabel=null;const t=new a.Vec2(e.offsetX,e.offsetY),i=this.logicalToPhysicalViewSpace().transformPosition(t),s=this.configSpaceToPhysicalViewSpace().inverseTransformPosition(i);if(s){for(let e of this.labels)if(e.configSpaceBounds.contains(s)){this.hoveredLabel=e;break}this.props.setNodeHover(this.hoveredLabel?this.hoveredLabel.node:null,t),this.renderCanvas()}}),this.onMouseLeave=(e=>{this.hoveredLabel=null,this.props.setNodeHover(null,new a.Vec2),this.renderCanvas()}),this.onWheel=(e=>{e.preventDefault(),this.frameHadWheelEvent=!0;if((e.metaKey||e.ctrlKey)&&"pan"!==this.interactionLock){let t=1+e.deltaY/100;e.ctrlKey&&(t=1+e.deltaY/40),t=a.clamp(t,.1,10),this.zoom(new a.Vec2(e.offsetX,e.offsetY),t)}else"zoom"!==this.interactionLock&&this.pan(new a.Vec2(e.deltaX,e.deltaY));this.renderCanvas()}),this.onWindowKeyPress=(e=>{if(!this.canvas)return;const{width:t,height:i}=this.canvas.getBoundingClientRect();"="===e.key||"+"===e.key?(this.zoom(new a.Vec2(t/2,i/2),.5),e.preventDefault()):"-"===e.key||"_"===e.key?(this.zoom(new a.Vec2(t/2,i/2),2),e.preventDefault()):"0"===e.key?this.zoom(new a.Vec2(t/2,i/2),1e9):"ArrowRight"===e.key||"d"===e.key?this.pan(new a.Vec2(100,0)):"ArrowLeft"===e.key||"a"===e.key?this.pan(new a.Vec2(-100,0)):"ArrowUp"===e.key||"w"===e.key?this.pan(new a.Vec2(0,-100)):"ArrowDown"!==e.key&&"s"!==e.key||this.pan(new a.Vec2(0,100))})}setConfigSpaceViewportRect(e){this.props.setConfigSpaceViewportRect(e)}preprocess(e){if(!this.canvas||!this.regl)return;const t=[],i=[],s=e.getLayers();this.labels=[];for(let o=0;o<s.length;o++){const n=s[o];for(let s of n){const n=new a.Rect(new a.Vec2(s.start,o+1),new a.Vec2(s.end-s.start,1));t.push(n);const r=e.getColorForFrame(s.node.frame);i.push([r.r,r.g,r.b]),this.labels.push({configSpaceBounds:n,node:s.node})}}this.renderer=h.rectangleBatchRenderer(this.regl,t,i),this.setConfigSpaceViewportRect(new a.Rect),this.hoveredLabel=null}configSpaceSize(){return new a.Vec2(this.props.flamechart.getTotalWeight(),this.props.flamechart.getLayers().length)}physicalViewSize(){return new a.Vec2(this.canvas?this.canvas.width:0,this.canvas?this.canvas.height:0)}configSpaceToPhysicalViewSpace(){return a.AffineTransform.betweenRects(this.props.configSpaceViewportRect,new a.Rect(new a.Vec2(0,0),this.physicalViewSize()))}physicalViewSpaceToNDC(){return a.AffineTransform.withScale(new a.Vec2(1,-1)).times(a.AffineTransform.betweenRects(new a.Rect(new a.Vec2(0,0),this.physicalViewSize()),new a.Rect(new a.Vec2(-1,-1),new a.Vec2(2,2))))}logicalToPhysicalViewSpace(){return a.AffineTransform.withScale(new a.Vec2(d,d))}resizeOverlayCanvasIfNeeded(){if(!this.overlayCanvas)return;let{width:e,height:t}=this.overlayCanvas.getBoundingClientRect();if(e=Math.floor(e),t=Math.floor(t),0===e||0===t)return;const i=e*d,s=t*d;i===this.overlayCanvas.width&&s===this.overlayCanvas.height||(this.overlayCanvas.width=i,this.overlayCanvas.height=s)}renderOverlays(){const e=this.overlayCtx;if(!e)return;if(this.resizeOverlayCanvasIfNeeded(),this.props.configSpaceViewportRect.isEmpty())return;const t=this.configSpaceToPhysicalViewSpace(),s=f.FontSize.LABEL*d,o=this.LOGICAL_VIEW_SPACE_FRAME_HEIGHT*d,n=this.physicalViewSize(),r=new a.Rect(new a.Vec2(0,0),n);if(e.clearRect(0,0,n.x,n.y),e.strokeStyle="rgba(15, 10, 5, 0.5)",e.lineWidth=2,this.hoveredLabel){const i=t.transformRect(this.hoveredLabel.configSpaceBounds);e.strokeRect(Math.floor(i.left()),Math.floor(i.top()),Math.floor(i.width()),Math.floor(i.height()))}e.font=`${s}px/${o}px ${f.FontFamily.MONOSPACE}`,e.fillStyle=f.Colors.GRAY,e.textBaseline="top";const h=c.cachedMeasureTextWidth(e,"M"+w+"M"),l=(o-s)/2;for(let s of this.labels){let o=t.transformRect(s.configSpaceBounds);if((o=o.withOrigin(o.origin.plus(new a.Vec2(l,l))).withSize(o.size.minus(new a.Vec2(2*l,2*l))).intersectWith(new a.Rect(new a.Vec2(l,-1/0),new a.Vec2(n.x,1/0)))).width()<h)continue;if(r.intersectWith(o).isEmpty())continue;o.origin.x<0&&(o=o.withOrigin(new a.Vec2(0,o.origin.y)));const c=i(e,s.node.frame.name,o.width());e.fillText(c,o.left(),o.top())}const p=this.props.configSpaceViewportRect.left(),u=this.props.configSpaceViewportRect.right(),v=(this.configSpaceToPhysicalViewSpace().inverted()||new a.AffineTransform).times(this.logicalToPhysicalViewSpace()).transformVector(new a.Vec2(200,1)).x;let g=Math.pow(10,Math.floor(Math.log10(v)));v/g>5?g*=5:v/g>2&&(g*=2),e.fillStyle="rgba(255, 255, 255, 0.8)",e.fillRect(0,0,n.x,o),e.fillStyle=f.Colors.GRAY;for(let i=Math.ceil(p/g)*g;i<u;i+=g){const s=Math.round(t.transformPosition(new a.Vec2(i,0)).x),o=this.props.flamechart.formatValue(i),r=c.cachedMeasureTextWidth(e,o);e.fillText(o,s-r-5,2),e.fillRect(s,0,1,n.y)}}resizeCanvasIfNeeded(e=!1){if(!this.canvas||!this.ctx)return;let{width:t,height:i}=this.canvas.getBoundingClientRect();const s=i;if(t=Math.floor(t)*d,i=Math.floor(i)*d,t<2||i<2)return;const o=this.canvas.width,n=this.canvas.height;this.props.configSpaceViewportRect.isEmpty()?this.setConfigSpaceViewportRect(new a.Rect(new a.Vec2(0,0),new a.Vec2(this.configSpaceSize().x,s/this.LOGICAL_VIEW_SPACE_FRAME_HEIGHT))):e&&this.setConfigSpaceViewportRect(this.props.configSpaceViewportRect.withSize(this.props.configSpaceViewportRect.size.timesPointwise(new a.Vec2(t/o,i/n)))),t===o&&i===n||(this.canvas.width=t,this.canvas.height=i,this.ctx.viewport(0,0,t,i))}renderRects(){if(!this.renderer||!this.canvas)return;if(this.resizeCanvasIfNeeded(),this.props.configSpaceViewportRect.isEmpty())return;const e=this.physicalViewSpaceToNDC().times(this.configSpaceToPhysicalViewSpace());this.renderer({configSpaceToNDC:e,physicalSize:this.physicalViewSize()})}minConfigSpaceViewportRectWidth(){return 3*this.props.flamechart.getMinFrameWidth()}transformViewport(e){const t=e.transformRect(this.props.configSpaceViewportRect),i=new a.Rect(new a.Vec2(0,0),a.Vec2.max(new a.Vec2(0,0),this.configSpaceSize().minus(t.size))),s=new a.Rect(new a.Vec2(this.minConfigSpaceViewportRectWidth(),t.height()),new a.Vec2(this.configSpaceSize().x,t.height()));this.setConfigSpaceViewportRect(new a.Rect(i.closestPointTo(t.origin),s.closestPointTo(t.size))),this.hoveredLabel=null,this.props.setNodeHover(null,new a.Vec2)}pan(e){this.interactionLock="pan";const t=this.logicalToPhysicalViewSpace().transformVector(e),i=this.configSpaceToPhysicalViewSpace().inverseTransformVector(t);i&&this.transformViewport(a.AffineTransform.withTranslation(i))}zoom(e,t){this.interactionLock="zoom";const i=this.logicalToPhysicalViewSpace().transformPosition(e),s=this.configSpaceToPhysicalViewSpace().inverseTransformPosition(i);if(!s)return;if(t<1&&this.props.configSpaceViewportRect.width()<=this.minConfigSpaceViewportRectWidth())return;const o=a.AffineTransform.withTranslation(s.times(-1)).scaledBy(new a.Vec2(t,1)).translatedBy(s);this.transformViewport(o)}shouldComponentUpdate(){return!1}componentWillReceiveProps(e){this.props.flamechart!==e.flamechart?(this.renderer=null,this.renderCanvas()):this.props.configSpaceViewportRect!==e.configSpaceViewportRect&&this.renderCanvas()}componentDidMount(){window.addEventListener("mouseup",this.onWindowMouseUp),window.addEventListener("resize",this.onWindowResize),window.addEventListener("keydown",this.onWindowKeyPress)}componentWillUnmount(){window.removeEventListener("mouseup",this.onWindowMouseUp),window.removeEventListener("resize",this.onWindowResize),window.removeEventListener("keydown",this.onWindowKeyPress)}render(){return s.h("div",{className:o.css(p.style.panZoomView,p.style.vbox),onMouseDown:this.onMouseDown,onMouseMove:this.onMouseMove,onMouseLeave:this.onMouseLeave,onWheel:this.onWheel},s.h("canvas",{width:1,height:1,ref:this.canvasRef,className:o.css(p.style.fill)}),s.h("canvas",{width:1,height:1,ref:this.overlayCanvasRef,className:o.css(p.style.fill)}))}}exports.FlamechartPanZoomView=u;class v extends n.ReloadableComponent{constructor(){super(),this.container=null,this.onNodeHover=((e,t)=>{this.setState({hoveredNode:e,logicalSpaceMouse:t.plus(new a.Vec2(0,p.Sizes.MINIMAP_HEIGHT))})}),this.containerRef=(e=>{this.container=e||null}),this.panZoomRef=(e=>{this.panZoomView=e}),this.setConfigSpaceViewportRect=(e=>{this.setState({configSpaceViewportRect:e})}),this.state={hoveredNode:null,configSpaceViewportRect:new a.Rect,logicalSpaceMouse:new a.Vec2}}formatValue(e){const t=100*e/this.props.flamechart.getTotalWeight();let i=`${t.toFixed(0)}%`;return 100===t?i="100%":t>99?i=">99%":t<1?i=`${t.toFixed(2)}%`:t<10&&(i=`${t.toFixed(1)}%`),`${this.props.flamechart.formatValue(e)} (${i})`}renderTooltip(){if(!this.container)return null;const{hoveredNode:e,logicalSpaceMouse:t}=this.state;if(!e)return null;const{width:i,height:n}=this.container.getBoundingClientRect(),r={};return t.x+7+p.Sizes.TOOLTIP_WIDTH_MAX<i?r.left=t.x+7:r.right=i-t.x+1,t.y+7+p.Sizes.TOOLTIP_HEIGHT_MAX<n?r.top=t.y+7:r.bottom=n-t.y+1,s.h("div",{className:o.css(p.style.hoverTip),style:r},s.h("div",{className:o.css(p.style.hoverTipRow)},s.h("span",{className:o.css(p.style.hoverCount)},this.formatValue(e.getTotalWeight()))," ",e.frame.name))}subcomponents(){return{panZoom:this.panZoomView}}render(){return s.h("div",{className:o.css(p.style.fill,p.style.clip,p.style.vbox),ref:this.containerRef},s.h(l.FlamechartMinimapView,{configSpaceViewportRect:this.state.configSpaceViewportRect,setConfigSpaceViewportRect:this.setConfigSpaceViewportRect,flamechart:this.props.flamechart}),s.h(u,{ref:this.panZoomRef,flamechart:this.props.flamechart,setNodeHover:this.onNodeHover,configSpaceViewportRect:this.state.configSpaceViewportRect,setConfigSpaceViewportRect:this.setConfigSpaceViewportRect}),this.renderTooltip())}}exports.FlamechartView=v;
|
|
},{"preact":4,"aphrodite":13,"./reloadable":5,"./utils":45,"./style":9,"./flamechart-minimap-view":46,"./rectangle-batch-renderer":47,"./math":48,"./flamechart-style":49,"regl":50}],7:[function(require,module,exports) {
|
|
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const t=require("./utils");class e{constructor(e){this.source=e,this.layers=[],this.totalWeight=0,this.minFrameWidth=1;const r=[];this.minFrameWidth=1/0;this.totalWeight=e.getTotalWeight(),e.forEachCall((e,s)=>{const i=t.lastOf(r),h={node:e,parent:i,children:[],start:s,end:s};i&&i.children.push(h),r.push(h)},t=>{const e=r.pop();if(e.end=t,e.end-e.start==0)return;const s=r.length;for(;this.layers.length<=s;)this.layers.push([]);this.layers[s].push(e),this.minFrameWidth=Math.min(this.minFrameWidth,e.end-e.start)})}getTotalWeight(){return this.totalWeight}getLayers(){return this.layers}getColorForFrame(t){return this.source.getColorForFrame(t)}getMinFrameWidth(){return this.minFrameWidth}formatValue(t){return this.source.formatValue(t)}}exports.Flamechart=e;
|
|
},{"./utils":45}],8:[function(require,module,exports) {
|
|
"use strict";function t(t){return t-Math.floor(t)}Object.defineProperty(exports,"__esModule",{value:!0});class o{constructor(t=0,o=0,r=0,e=1){this.r=t,this.g=o,this.b=r,this.a=e}static fromLumaChromaHue(t,r,e){const s=e/60,n=r*(1-Math.abs(s%2-1)),[a,l,u]=s<1?[r,n,0]:s<2?[n,r,0]:s<3?[0,r,n]:s<4?[0,n,r]:s<5?[n,0,r]:[r,0,n],c=t-(.3*a+.59*l+.11*u);return new o(a+c,l+c,u+c,1)}}exports.Color=o;class r{constructor(r){function e(t){return(t.file||"")+t.name}function s(t,o){return e(t)>e(o)?1:-1}this.frameToColor=new Map,(r=[...r]).sort(s);const n=[];let a=0;for(let t=0;t<r.length;t++){const o=a+Math.abs(s(r[t],r[(t+1)%r.length]));n.push(o),a=o}const l=n[n.length-1]||1;for(let e=0;e<n.length;e++){const s=n[e]/l,a=2*t(100*s)-1,u=.85-.1*a,c=.2+.1*a,h=360*s;this.frameToColor.set(r[e],o.fromLumaChromaHue(u,c,h))}}getColorForFrame(t){return this.frameToColor.get(t)||new o}}exports.FrameColorGenerator=r;
|
|
},{}],14:[function(require,module,exports) {
|
|
"use strict";function e(e,t,r){return e.has(t)||e.set(t,r),e.get(t)}Object.defineProperty(exports,"__esModule",{value:!0});const t=require("./utils");class r{constructor(){this.selfWeight=0,this.totalWeight=0}getSelfWeight(){return this.selfWeight}getTotalWeight(){return this.totalWeight}addToTotalWeight(e){this.totalWeight+=e}addToSelfWeight(e){this.selfWeight+=e}}exports.HasWeights=r;class s extends r{constructor(e){super(),this.key=e.key,this.name=e.name,this.file=e.file,this.line=e.line,this.col=e.col}}exports.Frame=s;class o extends r{constructor(e,t){super(),this.frame=e,this.parent=t,this.children=[]}}exports.CallTreeNode=o;const a=new s({key:"(speedscope root)",name:"(speedscope root)"});class i{format(e){return e.toLocaleString()}}exports.RawValueFormatter=i;class l{constructor(e){this.multiplier="nanoseconds"===e?1e-9:"microseconds"===e?1e-6:"milliseconds"===e?.001:1}format(e){const t=e*this.multiplier;return t/1>=1?`${t.toFixed(2)}s`:t/.001>=1?`${(t/.001).toFixed(2)}ms`:t/1e-6>=1?`${(t/1e-6).toFixed(2)}µs`:`${(t/1e-9).toFixed(2)}ms`}}exports.TimeFormatter=l;class h{constructor(e){this.frames=new Map,this.appendOrderCalltreeRoot=new o(a,null),this.groupedCalltreeRoot=new o(a,null),this.samples=[],this.weights=[],this.valueFormatter=new i,this.totalWeight=e}formatValue(e){return this.valueFormatter.format(e)}setValueFormatter(e){this.valueFormatter=e}getName(){return this.name}setName(e){this.name=e}getTotalWeight(){return this.totalWeight}getTotalNonIdleWeight(){return this.groupedCalltreeRoot.children.reduce((e,t)=>e+t.getTotalWeight(),0)}forEachCallGrouped(e,t){function r(s,o){s.frame!==a&&e(s,o);let i=0;const l=[...s.children];l.sort((e,t)=>e.getTotalWeight()>t.getTotalWeight()?-1:1),l.forEach(function(e){r(e,o+i),i+=e.getTotalWeight()}),s.frame!==a&&t(o+s.getTotalWeight())}r(this.groupedCalltreeRoot,0)}forEachCall(e,r){let s=[],o=0,i=0;for(let l of this.samples){let h=null;for(h=l;h&&h.frame!=a&&-1===s.indexOf(h);h=h.parent);for(;s.length>0&&t.lastOf(s)!=h;)s.pop(),r(o);const n=[];for(let e=l;e&&e.frame!=a&&e!=h;e=e.parent)n.push(e);n.reverse();for(let t of n)e(t,o);s=s.concat(n),o+=this.weights[i++]}for(let e=s.length-1;e>=0;e--)r(o)}forEachFrame(e){this.frames.forEach(e)}_appendSample(r,a,i){if(isNaN(a))throw new Error("invalid weight");let l=i?this.appendOrderCalltreeRoot:this.groupedCalltreeRoot,h=new Set;for(let n of r){const r=e(this.frames,n.key,new s(n)),f=i?t.lastOf(l.children):l.children.find(e=>e.frame===r);if(f&&f.frame==r)l=f;else{const e=l;l=new o(r,l),e.children.push(l)}l.addToTotalWeight(a),h.add(l.frame)}if(l.addToSelfWeight(a),i){l.frame.addToSelfWeight(a);for(let e of h)e.addToTotalWeight(a);this.samples.push(l),this.weights.push(a)}}appendSample(e,t){this._appendSample(e,t,!0),this._appendSample(e,t,!1)}}exports.Profile=h;
|
|
},{"./utils":45}],10:[function(require,module,exports) {
|
|
"use strict";function e(e){const r=e.raw_timestamp_deltas.reduce((e,t)=>e+t,0),o=new t.Profile(r),{frames:s,raw:a,raw_timestamp_deltas:n}=e;let l=0;for(let e=0;e<a.length;){const t=a[e++],r=[];for(let o=0;o<t;o++){const t=a[e++];r.push(Object.assign({key:t},s[t]))}const c=a[e++];let i=0;for(let e=0;e<c;e++)i+=n[l++];o.appendSample(r,i)}return o.setValueFormatter(new t.TimeFormatter("microseconds")),o}Object.defineProperty(exports,"__esModule",{value:!0});const t=require("../profile");exports.importFromStackprof=e;
|
|
},{"../profile":14}],11:[function(require,module,exports) {
|
|
"use strict";function e(e){const o=e[e.length-1].args.data.cpuProfile,n=new t.Profile(o.endTime-o.startTime),r=new Map;for(let e of o.nodes)r.set(e.id,e);for(let e of o.nodes)if(e.children)for(let t of e.children){const o=r.get(t);o&&(o.parent=e)}const l=[],a=[];let s=0,i=NaN;for(let e=0;e<o.samples.length;e++){const t=o.samples[e];t!=i&&(l.push(t),a.push(s),s=0),s+=o.timeDeltas[e],i=t}isNaN(i)||(l.push(i),a.push(s));for(let e=0;e<l.length;e++){const t=a[e+1]||0,o=l[e];if(!r.get(o))continue;const s=[];for(let e=r.get(o);e;e=e.parent){if("(root)"===e.callFrame.functionName)continue;if("(idle)"===e.callFrame.functionName)continue;const t=e.callFrame.functionName||"(anonymous)",o=e.callFrame.url,n=e.callFrame.lineNumber,r=e.callFrame.columnNumber;s.push({key:`${t}:${o}:${n}:${r}`,name:t,file:o,line:n,col:r})}s.reverse(),n.appendSample(s,t)}return n.setValueFormatter(new t.TimeFormatter("microseconds")),n}Object.defineProperty(exports,"__esModule",{value:!0});const t=require("../profile");exports.importFromChrome=e;
|
|
},{"../profile":14}],12:[function(require,module,exports) {
|
|
"use strict";function e(e){const r=[];return e.replace(/^(.*) (\d+)$/gm,(e,t,o)=>(r.push({stack:t.split(";").map(e=>({key:e,name:e})),duration:parseInt(o,10)}),e)),r}function r(r){const o=e(r),n=o.reduce((e,r)=>e+r.duration,0),a=new t.Profile(n);for(let e of o)a.appendSample(e.stack,e.duration);return a}Object.defineProperty(exports,"__esModule",{value:!0});const t=require("../profile");exports.importFromBGFlameGraph=r;
|
|
},{"../profile":14}],2:[function(require,module,exports) {
|
|
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e=require("preact"),t=require("aphrodite"),o=require("./reloadable"),r=require("./import/bg-flamegraph"),s=require("./import/stackprof"),a=require("./import/chrome"),i=require("./flamechart"),l=require("./flamechart-view"),n=require("./style"),c=require("./color");var h;!function(e){e[e.CHRONO=0]="CHRONO",e[e.LEFT_HEAVY=1]="LEFT_HEAVY"}(h||(h={}));class d extends o.ReloadableComponent{constructor(){super(...arguments),this.setTimeOrder=(()=>{this.props.setSortOrder(h.CHRONO)}),this.setLeftHeavyOrder=(()=>{this.props.setSortOrder(h.LEFT_HEAVY)})}render(){const o=e.h("div",{className:t.css(p.toolbarTab)},e.h("a",{href:"https://github.com/jlfwong/speedscope#usage",className:t.css(p.noLinkStyle),target:"_blank"},e.h("span",{className:t.css(p.emoji)},"❓"),"Help"));return this.props.profile?e.h("div",{className:t.css(p.toolbar)},e.h("div",{className:t.css(p.toolbarLeft)},e.h("div",{className:t.css(p.toolbarTab,this.props.sortOrder===h.CHRONO&&p.toolbarTabActive),onClick:this.setTimeOrder},e.h("span",{className:t.css(p.emoji)},"🕰"),"Time Order"),e.h("div",{className:t.css(p.toolbarTab,this.props.sortOrder===h.LEFT_HEAVY&&p.toolbarTabActive),onClick:this.setLeftHeavyOrder},e.h("span",{className:t.css(p.emoji)},"⬅️"),"Left Heavy"),o),this.props.profile.getName(),e.h("div",{className:t.css(p.toolbarRight)},"🔬speedscope")):e.h("div",{className:t.css(p.toolbar)},e.h("div",{className:t.css(p.toolbarLeft)},o),"🔬speedscope")}}exports.Toolbar=d;class m extends o.ReloadableComponent{constructor(){super(),this.loadExample=(()=>{fetch("dist/perf-vertx-stacks-01-collapsed-all.txt").then(e=>e.text()).then(e=>{this.loadFromString("perf-vertx-stacks-01-collapsed-all.txt",e)})}),this.onDrop=(e=>{this.loadFromFile(e.dataTransfer.files.item(0)),e.preventDefault()}),this.onDragOver=(e=>{e.preventDefault()}),this.onWindowKeyPress=(e=>{"1"===e.key?this.setState({sortOrder:h.CHRONO}):"2"===e.key&&this.setState({sortOrder:h.LEFT_HEAVY})}),this.flamechartRef=(e=>this.flamechartView=e),this.onFileSelect=(e=>{this.loadFromFile(e.target.files.item(0))}),this.setSortOrder=(e=>{this.setState({sortOrder:e})}),this.state={profile:null,flamechart:null,sortedFlamechart:null,sortOrder:h.CHRONO}}importJSON(e){return Array.isArray(e)&&"CpuProfile"===e[e.length-1].name?a.importFromChrome(e):s.importFromStackprof(e)}loadFromString(e,t){const o=e.endsWith("json")?this.importJSON(JSON.parse(t)):r.importFromBGFlameGraph(t);o.setName(e),document.title=`${e} - speedscope`;const s=[];o.forEachFrame(e=>s.push(e));const a=new c.FrameColorGenerator(s),l=new i.Flamechart({getTotalWeight:o.getTotalWeight.bind(o),forEachCall:o.forEachCall.bind(o),formatValue:o.formatValue.bind(o),getColorForFrame:a.getColorForFrame.bind(a)}),n=new i.Flamechart({getTotalWeight:o.getTotalNonIdleWeight.bind(o),forEachCall:o.forEachCallGrouped.bind(o),formatValue:o.formatValue.bind(o),getColorForFrame:a.getColorForFrame.bind(a)});this.setState({profile:o,flamechart:l,sortedFlamechart:n},()=>{})}loadFromFile(e){const t=new FileReader;t.addEventListener("loadend",()=>{this.loadFromString(e.name,t.result)}),t.readAsText(e)}componentDidMount(){window.addEventListener("keypress",this.onWindowKeyPress)}componentWillUnmount(){window.removeEventListener("keypress",this.onWindowKeyPress)}subcomponents(){return{flamechart:this.flamechartView}}renderLanding(){return e.h("div",{className:t.css(p.landingContainer)},e.h("div",{className:t.css(p.landingMessage)},e.h("p",{className:t.css(p.landingP)},"👋 Hi there! Welcome to 🔬speedscope."),e.h("p",{className:t.css(p.landingP)},"Drag and drop a profile file onto this window to get started, click the big blue button below to browse for a profile to explore, or"," ",e.h("a",{className:t.css(p.link),onClick:this.loadExample},"click here")," ","to load an example profile."),e.h("div",{className:t.css(p.browseButtonContainer)},e.h("input",{type:"file",name:"file",id:"file",onChange:this.onFileSelect,className:t.css(p.hide)}),e.h("label",{for:"file",className:t.css(p.browseButton)},"Browse")),e.h("p",{className:t.css(p.landingP)},"See the ",e.h("a",{className:t.css(p.link),href:"https://github.com/jlfwong/speedscope#usage",target:"_blank"},"documentation")," for information about supported file formats, keyboard shortcuts, and how to navigate around the profile."),e.h("p",{className:t.css(p.landingP)},"speedscope is open source. Please ",e.h("a",{className:t.css(p.link),target:"_blank",href:"https://github.com/jlfwong/speedscope/issues"},"report any issues on GitHub"),".")))}render(){const{flamechart:o,sortedFlamechart:r,sortOrder:s}=this.state,a=s==h.CHRONO?o:r;return e.h("div",{onDrop:this.onDrop,onDragOver:this.onDragOver,className:t.css(p.root)},e.h(d,Object.assign({setSortOrder:this.setSortOrder},this.state)),a?e.h(l.FlamechartView,{ref:this.flamechartRef,flamechart:a}):this.renderLanding())}}exports.Application=m;const p=t.StyleSheet.create({root:{width:"100vw",height:"100vh",overflow:"hidden",display:"flex",flexDirection:"column",position:"relative",fontFamily:n.FontFamily.MONOSPACE},landingContainer:{display:"flex",alignItems:"center",justifyContent:"center",flex:1},landingMessage:{maxWidth:600},landingP:{marginBottom:16},hide:{display:"none"},browseButtonContainer:{display:"flex",alignItems:"center",justifyContent:"center"},browseButton:{marginBottom:16,height:72,flex:1,maxWidth:256,textAlign:"center",fontSize:n.FontSize.BIG_BUTTON,lineHeight:"72px",background:n.Colors.DARK_BLUE,color:"white",cursor:"pointer"},link:{color:n.Colors.LIGHT_BLUE,cursor:"pointer",textDecoration:"none"},toolbar:{height:18,background:"black",color:"white",textAlign:"center",fontFamily:n.FontFamily.MONOSPACE,fontSize:n.FontSize.TITLE,lineHeight:"18px",userSelect:"none"},toolbarLeft:{position:"absolute",height:18,overflow:"hidden",top:0,left:0,marginRight:2,textAlign:"left"},toolbarRight:{height:18,overflow:"hidden",position:"absolute",top:0,right:0,marginRight:2,textAlign:"right"},toolbarTab:{background:n.Colors.DARK_GRAY,marginTop:2,height:16,lineHeight:"16px",paddingLeft:2,paddingRight:8,display:"inline-block",marginLeft:2,":hover":{background:n.Colors.GRAY,cursor:"pointer"}},toolbarTabActive:{background:n.Colors.LIGHT_BLUE,":hover":{background:n.Colors.LIGHT_BLUE}},noLinkStyle:{textDecoration:"none",color:"inherit"},emoji:{display:"inline-block",verticalAlign:"middle",paddingTop:"0px",marginRight:"0.3em"}});
|
|
},{"preact":4,"./reloadable":5,"./flamechart-view":6,"./flamechart":7,"./color":8,"./style":9,"./import/stackprof":10,"./import/chrome":11,"./import/bg-flamegraph":12,"aphrodite":13}],1:[function(require,module,exports) {
|
|
"use strict";function e(e){d=e,e&&i&&e.rehydrate(i)}Object.defineProperty(exports,"__esModule",{value:!0});const t=require("preact"),o=require("./application");let d=null;const i=window.__retained__;module.hot&&(module.hot.dispose(()=>{d&&(window.__retained__=d.serialize())}),module.hot.accept()),t.render(t.h(o.Application,{ref:e}),document.body,document.body.lastElementChild||void 0);
|
|
},{"./application":2,"preact":4}]},{},[1]) |