diff --git a/dist/speedscope.js b/dist/speedscope.js index fcba735..5dabd53 100644 --- a/dist/speedscope.js +++ b/dist/speedscope.js @@ -65,36 +65,36 @@ require = (function (modules, cache, entry) { // Override the current require with this new one return newRequire; -})({5:[function(require,module,exports) { +})({3:[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;x2?[].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}(); -},{}],3:[function(require,module,exports) { +},{}],4:[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":5}],25:[function(require,module,exports) { +},{"preact":3}],23:[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-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":48}],38:[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":48}],39:[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; -},{}],40:[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; -},{}],41:[function(require,module,exports) { +},{}],36:[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":48}],42:[function(require,module,exports) { +},{"css-in-js-utils/lib/isPrefixedValue":48}],37:[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":48}],38:[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; +},{}],39:[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; +},{}],40:[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; -},{}],43:[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; +},{}],41:[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; +},{}],42:[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":48}],43:[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; },{}],44:[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":48}],45:[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; +"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; },{}],46:[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; +"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":48}],35:[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; },{}],50:[function(require,module,exports) { @@ -103,53 +103,53 @@ require = (function (modules, cache, entry) { "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":50}],47:[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-1&&"order"!==p)for(var d=e[f],c=0,b=d.length;c-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":35,"css-in-js-utils/lib/hyphenateProperty":49,"css-in-js-utils/lib/isPrefixedValue":48}],26:[function(require,module,exports) { +},{"../../utils/capitalizeString":35,"css-in-js-utils/lib/isPrefixedValue":48,"css-in-js-utils/lib/hyphenateProperty":49}],25:[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/cursor":36,"inline-style-prefixer/static/plugins/filter":37,"inline-style-prefixer/static/plugins/crossFade":38,"inline-style-prefixer/static/plugins/flexboxIE":39,"inline-style-prefixer/static/plugins/flexboxOld":40,"inline-style-prefixer/static/plugins/calc":41,"inline-style-prefixer/static/plugins/flex":42,"inline-style-prefixer/static/plugins/sizing":43,"inline-style-prefixer/static/plugins/gradient":44,"inline-style-prefixer/static/plugins/position":45,"inline-style-prefixer/static/plugins/imageSet":46,"inline-style-prefixer/static/plugins/transition":47}],28:[function(require,module,exports) { +},{"inline-style-prefixer/static/plugins/calc":36,"inline-style-prefixer/static/plugins/crossFade":37,"inline-style-prefixer/static/plugins/flexboxIE":38,"inline-style-prefixer/static/plugins/cursor":39,"inline-style-prefixer/static/plugins/flex":40,"inline-style-prefixer/static/plugins/position":41,"inline-style-prefixer/static/plugins/imageSet":42,"inline-style-prefixer/static/plugins/flexboxOld":43,"inline-style-prefixer/static/plugins/gradient":44,"inline-style-prefixer/static/plugins/sizing":45,"inline-style-prefixer/static/plugins/filter":46,"inline-style-prefixer/static/plugins/transition":47}],28:[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; },{}],24:[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;i0&&(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":31,"../utils/prefixValue":32,"../utils/addNewValuesOnly":33,"../utils/isObject":34}],21:[function(require,module,exports) { +},{"../utils/prefixProperty":31,"../utils/addNewValuesOnly":32,"../utils/prefixValue":33,"../utils/isObject":34}],20:[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;rc){for(var t=0,n=u.length-i;t0&&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;r1&&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;o0,"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;n65535)<<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>>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=0&&e.yOffset0&&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=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>=a,r.height>>=a,d(r,n[a]),e.mipmask|=1<=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;r0)continue;n.unit=-1}ce[r]=this,t=r;break}t>=fe&&Ae.raise("insufficient number of texture units"),o.profile&&i.maxTextureUnits>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<>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<>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>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;r1)for(var h=0;he&&(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=0&&u=0&&s0&&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=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=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=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;s1?_(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;r0&&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=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<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>l,p=o>>l;r(s.mipmask&1<=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=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;r0)return s.call(this,function(e){for(;l.length=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;a0){var u;if(Array.isArray(t[0])){f=Ne(t);for(var s=1,c=1;c0)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=Rr&&t=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=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=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;r0&&(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=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}}); },{}],17:[function(require,module,exports) { "use strict";function t(t,i,s){return ts?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)}hasInteractionWith(t){const i=Math.max(this.top(),t.top());if(Math.max(i,Math.min(this.bottom(),t.bottom()))-i==0)return!1;const s=Math.max(this.left(),t.left());return Math.max(s,Math.min(this.right(),t.right()))-s!=0}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; },{}],18:[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e=require("./math");exports.rectangleBatchRenderer=((t,o,i,n=1)=>{function r(e,t,o,i){const n=s++;c[2*n]=t,c[2*n+1]=e,f[2*n]=o.x,f[2*n+1]=o.y,a[3*n]=i[0],a[3*n+1]=i[1],a[3*n+2]=i[2]}const c=new Float32Array(6*o.length*2),f=new Float32Array(6*o.length*2),a=new Float32Array(6*o.length*3),l={topLeft:new e.Vec2(n,-n),topRight:new e.Vec2(-n,-n),bottomRight:new e.Vec2(-n,n),bottomLeft:new e.Vec2(n,n)};let s=0;for(let e=0;et.configSpaceToNDC.flatten(),physicalSize:(e,t)=>t.physicalSize.flatten()},primitive:"triangles",count:a.length/3})}); },{"./math":17}],14:[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; -},{}],20:[function(require,module,exports) { +},{}],19:[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":8}],22:[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.length1&&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;o0,"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;n65535)<<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>>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=0&&e.yOffset0&&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=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>=a,r.height>>=a,d(r,n[a]),e.mipmask|=1<=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;r0)continue;n.unit=-1}ce[r]=this,t=r;break}t>=fe&&Ae.raise("insufficient number of texture units"),o.profile&&i.maxTextureUnits>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<>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<>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>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;r1)for(var h=0;he&&(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=0&&u=0&&s0&&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=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=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=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;s1?_(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;r0&&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=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<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>l,p=o>>l;r(s.mipmask&1<=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=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;r0)return s.call(this,function(e){for(;l.length=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;a0){var u;if(Array.isArray(t[0])){f=Ne(t);for(var s=1,c=1;c0)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=Rr&&t=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=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=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;r0&&(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=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}}); -},{}],16:[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;re({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})); -},{"preact":5,"aphrodite":13,"./math":17,"./rectangle-batch-renderer":18,"./utils":14,"./style":8,"./flamechart-style":20,"regl":22}],4:[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)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;on.x&&(o=o.withSize(o.size.withX(n.x-o.left()))),o=o.withOrigin(o.origin.plus(p)).withSize(o.size.minus(u));const r=i(e,s.node.frame.name,o.width());e.fillText(r,o.left(),o.top())}const v=this.props.configSpaceViewportRect.left(),g=this.props.configSpaceViewportRect.right(),m=(this.configSpaceToPhysicalViewSpace().inverted()||new a.AffineTransform).times(this.logicalToPhysicalViewSpace()).transformVector(new a.Vec2(200,1)).x;let V=Math.pow(10,Math.floor(Math.log10(m)));m/V>5?V*=5:m/V>2&&(V*=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(v/V)*V;i{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{if(this.maybeClearInteractionLock(),!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.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.onWheel=(e=>{e.preventDefault(),this.frameHadWheelEvent=!0;if((e.metaKey||e.ctrlKey)&&"pan"!==this.interactionLock){let i=1+e.deltaY/100;e.ctrlKey&&(i=1+e.deltaY/40),i=s.clamp(i,.1,10),this.zoom(i)}else"zoom"!==this.interactionLock&&this.pan(new s.Vec2(e.deltaX,e.deltaY));this.renderCanvas()}),this.dragStartConfigSpaceMouse=null,this.dragConfigSpaceViewportOffset=null,this.draggingMode=null,this.onMouseDown=(e=>{if(!this.canvas)return;const i=this.configSpaceMouse(e);i&&(this.props.configSpaceViewportRect.contains(i)?(this.draggingMode=h.TRANSLATE_VIEWPORT,this.dragConfigSpaceViewportOffset=i.minus(this.props.configSpaceViewportRect.origin)):this.draggingMode=h.DRAW_NEW_VIEWPORT,this.dragStartConfigSpaceMouse=i,window.addEventListener("mousemove",this.onWindowMouseMove),window.addEventListener("mouseup",this.onWindowMouseUp),this.updateCursor(i))}),this.onWindowMouseMove=(e=>{if(!this.dragStartConfigSpaceMouse||!this.canvas)return;let i=this.configSpaceMouse(e);if(i)if(this.updateCursor(i),i=new s.Rect(new s.Vec2(0,0),this.configSpaceSize()).closestPointTo(i),this.draggingMode===h.DRAW_NEW_VIEWPORT){const e=this.dragStartConfigSpaceMouse;let t=i;if(!e||!t)return;const n=Math.min(e.x,t.x),o=Math.max(e.x,t.x)-n,a=this.props.configSpaceViewportRect.height();this.props.setConfigSpaceViewportRect(new s.Rect(new s.Vec2(n,t.y-a/2),new s.Vec2(o,a)))}else if(this.draggingMode===h.TRANSLATE_VIEWPORT){if(!this.dragConfigSpaceViewportOffset)return;const e=i.minus(this.dragConfigSpaceViewportOffset);this.props.setConfigSpaceViewportRect(this.props.configSpaceViewportRect.withOrigin(e))}}),this.updateCursor=(e=>{this.draggingMode===h.TRANSLATE_VIEWPORT?(document.body.style.cursor="grabbing",document.body.style.cursor="-webkit-grabbing"):this.draggingMode===h.DRAW_NEW_VIEWPORT?document.body.style.cursor="col-resize":this.props.configSpaceViewportRect.contains(e)?(document.body.style.cursor="grab",document.body.style.cursor="-webkit-grab"):document.body.style.cursor="col-resize"}),this.onMouseMove=(e=>{if(!this.canvas)return;const i=this.configSpaceMouse(e);i&&this.updateCursor(i)}),this.onWindowMouseUp=(e=>{this.draggingMode=null,window.removeEventListener("mousemove",this.onWindowMouseMove),window.removeEventListener("mouseup",this.onWindowMouseUp);const i=this.configSpaceMouse(e);i&&this.updateCursor(i)}),this.overlayCanvasRef=(e=>{e?(this.overlayCanvas=e,this.overlayCtx=this.overlayCanvas.getContext("2d"),this.renderCanvas()):(this.overlayCanvas=null,this.overlayCtx=null)})}physicalViewSize(){return new s.Vec2(this.canvas?this.canvas.width:0,this.canvas?this.canvas.height:0)}configSpaceSize(){return new s.Vec2(this.props.flamechart.getTotalWeight(),this.props.flamechart.getLayers().length)}configSpaceToPhysicalViewSpace(){const e=new s.Vec2(0,a.Sizes.FRAME_HEIGHT*c);return s.AffineTransform.betweenRects(new s.Rect(new s.Vec2(0,0),this.configSpaceSize()),new s.Rect(e,this.physicalViewSize().minus(e)))}physicalViewSpaceToNDC(){return s.AffineTransform.withScale(new s.Vec2(1,-1)).times(s.AffineTransform.betweenRects(new s.Rect(new s.Vec2(0,0),this.physicalViewSize()),new s.Rect(new s.Vec2(-1,-1),new s.Vec2(2,2))))}logicalToPhysicalViewSpace(){return s.AffineTransform.withScale(new s.Vec2(c,c))}windowToLogicalViewSpace(){if(!this.canvas)return new s.AffineTransform;const e=this.canvas.getBoundingClientRect();return s.AffineTransform.withTranslation(new s.Vec2(-e.left,-e.top))}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(),n=this.configSpaceSize().x,h=(this.configSpaceToPhysicalViewSpace().inverted()||new s.AffineTransform).times(this.logicalToPhysicalViewSpace()).transformVector(new s.Vec2(200,1)).x,l=a.Sizes.FRAME_HEIGHT*c,p=r.FontSize.LABEL*c,f=(l-p)/2;e.font=`${p}px/${l}px ${r.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=r.Colors.GRAY;for(let a=Math.ceil(0/g)*g;ae({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":22,"preact":3,"aphrodite":13,"./math":17,"./rectangle-batch-renderer":18,"./utils":14,"./flamechart-style":19,"./style":8}],5:[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)h.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"),h=require("./utils"),c=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=h.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=>{this.lastDragPos=new a.Vec2(e.offsetX,e.offsetY),this.updateCursor(),window.addEventListener("mouseup",this.onWindowMouseUp)}),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=>{this.lastDragPos=null,this.updateCursor(),window.removeEventListener("mouseup",this.onWindowMouseUp)}),this.onMouseMove=(e=>{if(this.updateCursor(),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;on.x&&(o=o.withSize(o.size.withX(n.x-o.left()))),o=o.withOrigin(o.origin.plus(p)).withSize(o.size.minus(u));const r=i(e,s.node.frame.name,o.width());e.fillText(r,o.left(),o.top())}const v=this.props.configSpaceViewportRect.left(),g=this.props.configSpaceViewportRect.right(),m=(this.configSpaceToPhysicalViewSpace().inverted()||new a.AffineTransform).times(this.logicalToPhysicalViewSpace()).transformVector(new a.Vec2(200,1)).x;let V=Math.pow(10,Math.floor(Math.log10(m)));m/V>5?V*=5:m/V>2&&(V*=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(v/V)*V;i{const t=new a.Rect(new a.Vec2(0,0),a.Vec2.max(new a.Vec2(0,0),this.configSpaceSize().minus(e.size))),i=new a.Rect(new a.Vec2(this.minConfigSpaceViewportRectWidth(),e.height()),new a.Vec2(this.configSpaceSize().x,e.height()));this.setState({configSpaceViewportRect:new a.Rect(t.closestPointTo(e.origin),i.closestPointTo(e.size))})}),this.transformViewport=(e=>{const t=e.transformRect(this.state.configSpaceViewportRect);this.setConfigSpaceViewportRect(t)}),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.state={hoveredNode:null,configSpaceViewportRect:new a.Rect,logicalSpaceMouse:new a.Vec2}}configSpaceSize(){return new a.Vec2(this.props.flamechart.getTotalWeight(),this.props.flamechart.getLayers().length)}minConfigSpaceViewportRectWidth(){return 3*this.props.flamechart.getMinFrameWidth()}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{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":14}],9:[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{this.props.setSortOrder(c.CHRONO)}),this.setLeftHeavyOrder=(()=>{this.props.setSortOrder(c.LEFT_HEAVY)})}render(){const r=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===c.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===c.LEFT_HEAVY&&p.toolbarTabActive),onClick:this.setLeftHeavyOrder},e.h("span",{className:t.css(p.emoji)},"⬅️"),"Left Heavy"),r),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)},r),"🔬speedscope")}}exports.Toolbar=d;class m extends r.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:c.CHRONO}):"2"===e.key&&this.setState({sortOrder:c.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:c.CHRONO}}importJSON(e){return Array.isArray(e)&&"CpuProfile"===e[e.length-1].name?a.importFromChromeTimeline(e):s.importFromStackprof(e)}loadFromString(e,t){const r=e.endsWith("json")?this.importJSON(JSON.parse(t)):e.endsWith("cpuprofile")?a.importFromChromeCPUProfile(JSON.parse(t)):o.importFromBGFlameGraph(t);r.setName(e),document.title=`${e} - speedscope`;const s=[];r.forEachFrame(e=>s.push(e));const l=new h.FrameColorGenerator(s),n=new i.Flamechart({getTotalWeight:r.getTotalWeight.bind(r),forEachCall:r.forEachCall.bind(r),formatValue:r.formatValue.bind(r),getColorForFrame:l.getColorForFrame.bind(l)}),c=new i.Flamechart({getTotalWeight:r.getTotalNonIdleWeight.bind(r),forEachCall:r.forEachCallGrouped.bind(r),formatValue:r.formatValue.bind(r),getColorForFrame:l.getColorForFrame.bind(l)});this.setState({profile:r,flamechart:n,sortedFlamechart:c},()=>{})}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, an interactive"," ",e.h("a",{className:t.css(p.link),href:"http://www.brendangregg.com/FlameGraphs/cpuflamegraphs.html"},"flamegraph")," visualizer. Use it to help you make your software faster."),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:r,sortedFlamechart:o,sortOrder:s}=this.state,a=s==c.CHRONO?r:o;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,lineHeight:"20px"},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"}}); -},{"./reloadable":3,"./flamechart-view":4,"./flamechart":7,"./style":8,"./color":9,"./import/bg-flamegraph":10,"./import/stackprof":11,"./import/chrome":12,"preact":5,"aphrodite":13}],1:[function(require,module,exports) { +},{"./reloadable":4,"./flamechart-view":5,"./flamechart":7,"./style":8,"./color":9,"./import/bg-flamegraph":10,"./import/stackprof":11,"./import/chrome":12,"preact":3,"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":5}]},{},[1]) \ No newline at end of file +},{"./application":2,"preact":3}]},{},[1]) \ No newline at end of file