UNPKG

jeri

Version:

JavaScript Extended-Range Image viewer

1 lines 106 kB
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define("Jeri",["react","react-dom"],t):"object"==typeof exports?exports.Jeri=t(require("react"),require("react-dom")):e.Jeri=t(e.React,e.ReactDOM)}(this,function(e,t){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="./",t(t.s=14)}([function(t,n){t.exports=e},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});for(var r=new Float32Array(16),o=0;o<4;++o)r[o+4*o]=1;var i=function(){function e(e){void 0===e&&(e=r),this.data=new Float32Array(e)}return e.create=function(){return new e},e.fromScaling=function(e,t){if(3!==t.length)throw new Error("Matrix4x4.fromScaling requires a 3-dimentional vector as input");t.forEach(function(t,n){e.data[n+4*n]=t})},e.multiply=function(e,t,n){for(var r=new Float32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),o=0;o<4;++o)for(var i=0;i<4;++i)for(var a=0;a<4;++a)r[4*i+o]+=t.data[4*a+o]*n.data[4*i+a];e.data=r},e.scale=function(e,t,n){if(3!==n.length)throw new Error("Matrix4x4.scale expects the third argument to have 3 numbers");for(var r=new Float32Array(t.data),o=0;o<3;++o)for(var i=0;i<4;++i)r[4*o+i]*=n[o];e.data=r},e.translate=function(e,t,n){if(3!==n.length)throw new Error("Matrix4x4.translate expects the third argument to have 3 numbers");for(var r=new Float32Array(t.data),o=0;o<4;++o)for(var i=0;i<3;++i)r[12+o]+=t.data[4*i+o]*n[i];e.data=r},e.clone=function(t){return new e(t.data)},e.invert=function(e,t){var n=t.data,r=e.data;r[0]=-n[7]*n[10]*n[13]+n[6]*n[11]*n[13]+n[7]*n[9]*n[14]-n[5]*n[11]*n[14]-n[6]*n[9]*n[15]+n[5]*n[10]*n[15],r[1]=n[3]*n[10]*n[13]-n[2]*n[11]*n[13]-n[3]*n[9]*n[14]+n[1]*n[11]*n[14]+n[2]*n[9]*n[15]-n[1]*n[10]*n[15],r[2]=-n[3]*n[6]*n[13]+n[2]*n[7]*n[13]+n[3]*n[5]*n[14]-n[1]*n[7]*n[14]-n[2]*n[5]*n[15]+n[1]*n[6]*n[15],r[3]=n[3]*n[6]*n[9]-n[2]*n[7]*n[9]-n[3]*n[5]*n[10]+n[1]*n[7]*n[10]+n[2]*n[5]*n[11]-n[1]*n[6]*n[11],r[4]=n[7]*n[10]*n[12]-n[6]*n[11]*n[12]-n[7]*n[8]*n[14]+n[4]*n[11]*n[14]+n[6]*n[8]*n[15]-n[4]*n[10]*n[15],r[5]=-n[3]*n[10]*n[12]+n[2]*n[11]*n[12]+n[3]*n[8]*n[14]-n[0]*n[11]*n[14]-n[2]*n[8]*n[15]+n[0]*n[10]*n[15],r[6]=n[3]*n[6]*n[12]-n[2]*n[7]*n[12]-n[3]*n[4]*n[14]+n[0]*n[7]*n[14]+n[2]*n[4]*n[15]-n[0]*n[6]*n[15],r[7]=-n[3]*n[6]*n[8]+n[2]*n[7]*n[8]+n[3]*n[4]*n[10]-n[0]*n[7]*n[10]-n[2]*n[4]*n[11]+n[0]*n[6]*n[11],r[8]=-n[7]*n[9]*n[12]+n[5]*n[11]*n[12]+n[7]*n[8]*n[13]-n[4]*n[11]*n[13]-n[5]*n[8]*n[15]+n[4]*n[9]*n[15],r[9]=n[3]*n[9]*n[12]-n[1]*n[11]*n[12]-n[3]*n[8]*n[13]+n[0]*n[11]*n[13]+n[1]*n[8]*n[15]-n[0]*n[9]*n[15],r[10]=-n[3]*n[5]*n[12]+n[1]*n[7]*n[12]+n[3]*n[4]*n[13]-n[0]*n[7]*n[13]-n[1]*n[4]*n[15]+n[0]*n[5]*n[15],r[11]=n[3]*n[5]*n[8]-n[1]*n[7]*n[8]-n[3]*n[4]*n[9]+n[0]*n[7]*n[9]+n[1]*n[4]*n[11]-n[0]*n[5]*n[11],r[12]=n[6]*n[9]*n[12]-n[5]*n[10]*n[12]-n[6]*n[8]*n[13]+n[4]*n[10]*n[13]+n[5]*n[8]*n[14]-n[4]*n[9]*n[14],r[13]=-n[2]*n[9]*n[12]+n[1]*n[10]*n[12]+n[2]*n[8]*n[13]-n[0]*n[10]*n[13]-n[1]*n[8]*n[14]+n[0]*n[9]*n[14],r[14]=n[2]*n[5]*n[12]-n[1]*n[6]*n[12]-n[2]*n[4]*n[13]+n[0]*n[6]*n[13]+n[1]*n[4]*n[14]-n[0]*n[5]*n[14],r[15]=-n[2]*n[5]*n[8]+n[1]*n[6]*n[8]+n[2]*n[4]*n[9]-n[0]*n[6]*n[9]-n[1]*n[4]*n[10]+n[0]*n[5]*n[10];var o=n[0]*r[0]+n[1]*r[4]+n[2]*r[8]+n[3]*r[12];if(0===o)throw new Error("Matrix is not invertible.");for(var i=1/o,a=0;a<16;++a)r[a]*=i},e}();t.Matrix4x4=i;var a=function(){function e(){this.data=new Float32Array([0,0,0,0])}return e.create=function(){return new e},e.set=function(e,t,n,r,o){e.data[0]=t,e.data[1]=n,e.data[2]=r,e.data[3]=o},e.fromValues=function(t,n,r,o){var i=new e;return e.set(i,t,n,r,o),i},e.transformMat4=function(e,t,n){for(var r=t.data,o=n.data,i=new Float32Array([0,0,0,0]),a=0;a<4;++a)for(var s=0;s<4;++s)i[a]+=r[s]*o[4*s+a];e.data=i},e}();t.Vector4=a},function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function o(e){if(l===setTimeout)return setTimeout(e,0);if((l===n||!l)&&setTimeout)return l=setTimeout,setTimeout(e,0);try{return l(e,0)}catch(t){try{return l.call(null,e,0)}catch(t){return l.call(this,e,0)}}}function i(e){if(f===clearTimeout)return clearTimeout(e);if((f===r||!f)&&clearTimeout)return f=clearTimeout,clearTimeout(e);try{return f(e)}catch(t){try{return f.call(null,e)}catch(t){return f.call(this,e)}}}function a(){m&&p&&(m=!1,p.length?d=p.concat(d):g=-1,d.length&&s())}function s(){if(!m){var e=o(a);m=!0;for(var t=d.length;t;){for(p=d,d=[];++g<t;)p&&p[g].run();g=-1,t=d.length}p=null,m=!1,i(e)}}function c(e,t){this.fun=e,this.array=t}function u(){}var l,f,h=e.exports={};!function(){try{l="function"==typeof setTimeout?setTimeout:n}catch(e){l=n}try{f="function"==typeof clearTimeout?clearTimeout:r}catch(e){f=r}}();var p,d=[],m=!1,g=-1;h.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];d.push(new c(e,t)),1!==d.length||m||o(s)},c.prototype.run=function(){this.fun.apply(null,this.array)},h.title="browser",h.browser=!0,h.env={},h.argv=[],h.version="",h.versions={},h.on=u,h.addListener=u,h.once=u,h.off=u,h.removeListener=u,h.removeAllListeners=u,h.emit=u,h.prependListener=u,h.prependOnceListener=u,h.listeners=function(e){return[]},h.binding=function(e){throw new Error("process.binding is not supported")},h.cwd=function(){return"/"},h.chdir=function(e){throw new Error("process.chdir is not supported")},h.umask=function(){return 0}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){function r(e){return e.replace(S,"-$1").toLowerCase()}function o(e){return M(e).replace(A,"-ms-")}function i(e){return"string"==typeof e}function a(e){return"function"==typeof e&&"string"==typeof e.styledComponentId}function s(e){return e.displayName||e.name||"Component"}function c(e,t){for(var n=1540483477,r=t^e.length,o=e.length,i=0;o>=4;){var a=u(e,i);a=f(a,n),a^=a>>>24,a=f(a,n),r=f(r,n),r^=a,i+=4,o-=4}switch(o){case 3:r^=l(e,i),r^=e.charCodeAt(i+2)<<16,r=f(r,n);break;case 2:r^=l(e,i),r=f(r,n);break;case 1:r^=e.charCodeAt(i),r=f(r,n)}return r^=r>>>13,r=f(r,n),(r^=r>>>15)>>>0}function u(e,t){return e.charCodeAt(t++)+(e.charCodeAt(t++)<<8)+(e.charCodeAt(t++)<<16)+(e.charCodeAt(t)<<24)}function l(e,t){return e.charCodeAt(t++)+(e.charCodeAt(t++)<<8)}function f(e,t){return e|=0,t|=0,(65535&e)*t+(((e>>>16)*t&65535)<<16)|0}n.d(t,"css",function(){return N}),n.d(t,"keyframes",function(){return Pe}),n.d(t,"injectGlobal",function(){return _e}),n.d(t,"ThemeProvider",function(){return we}),n.d(t,"withTheme",function(){return Me}),n.d(t,"ServerStyleSheet",function(){return ae}),n.d(t,"StyleSheetManager",function(){return ne});var h,p=n(23),d=n.n(p),m=n(25),g=n.n(m),v=n(0),y=n.n(v),b=n(26),w=n.n(b),x=n(31),E=n.n(x),T=n(32),C=n.n(T),S=/([A-Z])/g,k=r,M=k,A=/^ms-/,O=o,R=function e(t,n){var r=Object.keys(t).filter(function(e){var n=t[e];return void 0!==n&&null!==n&&!1!==n&&""!==n}).map(function(n){return d()(t[n])?e(t[n],n):O(n)+": "+t[n]+";"}).join(" ");return n?n+" {\n "+r+"\n}":r},P=function e(t,n){return t.reduce(function(t,r){return void 0===r||null===r||!1===r||""===r?t:Array.isArray(r)?[].concat(t,e(r,n)):r.hasOwnProperty("styledComponentId")?[].concat(t,["."+r.styledComponentId]):"function"==typeof r?n?t.concat.apply(t,e([r(n)],n)):t.concat(r):t.concat(d()(r)?R(r):r.toString())},[])},_=new g.a({global:!1,cascade:!0,keyframe:!1,prefix:!0,compress:!1,semicolon:!0}),I=function(e,t,n){var r=e.join("").replace(/^\s*\/\/.*$/gm,""),o=t&&n?n+" "+t+" { "+r+" }":r;return _(n||!t?"":t,o)},D="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""),F=D.length,L=function(e){var t="",n=void 0;for(n=e;n>F;n=Math.floor(n/F))t=D[n%F]+t;return D[n%F]+t},j=function(e,t){return t.reduce(function(t,n,r){return t.concat(n,e[r+1])},[e[0]])},N=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return P(j(e,n))},U=/^[^\S\n]*?\/\* sc-component-id:\s+(\S+)\s+\*\//gm,B=function(e){var t=""+(e||""),n=[];return t.replace(U,function(e,t,r){return n.push({componentId:t,matchIndex:r}),e}),n.map(function(e,r){var o=e.componentId,i=e.matchIndex,a=n[r+1];return{componentId:o,cssFromDOM:a?t.slice(i,a.matchIndex):t.slice(i)}})},V=function(){return n.nc},W=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},X=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),H=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},q=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},G=function(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n},z=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},Y=function(){function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";W(this,e),this.el=t,this.isLocal=n,this.ready=!1;var o=B(r);this.size=o.length,this.components=o.reduce(function(e,t){return e[t.componentId]=t,e},{})}return e.prototype.isFull=function(){return this.size>=40},e.prototype.addComponent=function(e){if(this.ready||this.replaceElement(),this.components[e])throw new Error("Trying to add Component '"+e+"' twice!");var t={componentId:e,textNode:document.createTextNode("")};this.el.appendChild(t.textNode),this.size+=1,this.components[e]=t},e.prototype.inject=function(e,t,n){this.ready||this.replaceElement();var r=this.components[e];if(!r)throw new Error("Must add a new component before you can inject css into it");if(""===r.textNode.data&&r.textNode.appendData("\n/* sc-component-id: "+e+" */\n"),r.textNode.appendData(t),n){var o=this.el.getAttribute($);this.el.setAttribute($,o?o+" "+n:n)}var i=V();i&&this.el.setAttribute("nonce",i)},e.prototype.toHTML=function(){return this.el.outerHTML},e.prototype.toReactElement=function(){throw new Error("BrowserTag doesn't implement toReactElement!")},e.prototype.clone=function(){throw new Error("BrowserTag cannot be cloned!")},e.prototype.replaceElement=function(){var e=this;if(this.ready=!0,0!==this.size){var t=this.el.cloneNode();if(t.appendChild(document.createTextNode("\n")),Object.keys(this.components).forEach(function(n){var r=e.components[n];r.textNode=document.createTextNode(r.cssFromDOM),t.appendChild(r.textNode)}),!this.el.parentNode)throw new Error("Trying to replace an element that wasn't mounted!");this.el.parentNode.replaceChild(t,this.el),this.el=t}},e}(),K={create:function(){for(var e=[],t={},n=document.querySelectorAll("["+$+"]"),r=n.length,o=0;o<r;o+=1){var i=n[o];e.push(new Y(i,"true"===i.getAttribute(J),i.innerHTML));var a=i.getAttribute($);a&&a.trim().split(/\s+/).forEach(function(e){t[e]=!0})}return new te(function(e){var t=document.createElement("style");if(t.type="text/css",t.setAttribute($,""),t.setAttribute(J,e?"true":"false"),!document.head)throw new Error("Missing document <head>");return document.head.appendChild(t),new Y(t,e)},e,t)}},$="data-styled-components",J="data-styled-components-is-local",Z="__styled-components-stylesheet__",Q=null,ee=[],te=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};W(this,e),this.hashes={},this.deferredInjections={},this.stylesCacheable="undefined"!=typeof document,this.tagConstructor=t,this.tags=n,this.names=r,this.constructComponentTagMap()}return e.prototype.constructComponentTagMap=function(){var e=this;this.componentTags={},this.tags.forEach(function(t){Object.keys(t.components).forEach(function(n){e.componentTags[n]=t})})},e.prototype.getName=function(e){return this.hashes[e.toString()]},e.prototype.alreadyInjected=function(e,t){return!!this.names[t]&&(this.hashes[e.toString()]=t,!0)},e.prototype.hasInjectedComponent=function(e){return!!this.componentTags[e]},e.prototype.deferredInject=function(e,t,n){this===Q&&ee.forEach(function(r){r.deferredInject(e,t,n)}),this.getOrCreateTag(e,t),this.deferredInjections[e]=n},e.prototype.inject=function(e,t,n,r,o){this===Q&&ee.forEach(function(r){r.inject(e,t,n)});var i=this.getOrCreateTag(e,t),a=this.deferredInjections[e];a&&(i.inject(e,a),delete this.deferredInjections[e]),i.inject(e,n,o),r&&o&&(this.hashes[r.toString()]=o)},e.prototype.toHTML=function(){return this.tags.map(function(e){return e.toHTML()}).join("")},e.prototype.toReactElements=function(){return this.tags.map(function(e,t){return e.toReactElement("sc-"+t)})},e.prototype.getOrCreateTag=function(e,t){var n=this.componentTags[e];if(n)return n;var r=this.tags[this.tags.length-1],o=!r||r.isFull()||r.isLocal!==t?this.createNewTag(t):r;return this.componentTags[e]=o,o.addComponent(e),o},e.prototype.createNewTag=function(e){var t=this.tagConstructor(e);return this.tags.push(t),t},e.reset=function(t){Q=e.create(t)},e.create=function(){return((arguments.length>0&&void 0!==arguments[0]?arguments[0]:"undefined"==typeof document)?ae:K).create()},e.clone=function(t){var n=new e(t.tagConstructor,t.tags.map(function(e){return e.clone()}),H({},t.names));return n.hashes=H({},t.hashes),n.deferredInjections=H({},t.deferredInjections),ee.push(n),n},X(e,null,[{key:"instance",get:function(){return Q||(Q=e.create())}}]),e}(),ne=function(e){function t(){return W(this,t),z(this,e.apply(this,arguments))}return q(t,e),t.prototype.getChildContext=function(){var e;return e={},e[Z]=this.props.sheet,e},t.prototype.render=function(){return y.a.Children.only(this.props.children)},t}(v.Component);ne.childContextTypes=(h={},h[Z]=w.a.oneOfType([w.a.instanceOf(te),w.a.instanceOf(ae)]).isRequired,h),ne.propTypes={sheet:w.a.oneOfType([w.a.instanceOf(te),w.a.instanceOf(ae)]).isRequired};var re,oe,ie=function(){function e(t){W(this,e),this.isLocal=t,this.components={},this.size=0,this.names=[]}return e.prototype.isFull=function(){return!1},e.prototype.addComponent=function(e){if(this.components[e])throw new Error("Trying to add Component '"+e+"' twice!");this.components[e]={componentId:e,css:""},this.size+=1},e.prototype.concatenateCSS=function(){var e=this;return Object.keys(this.components).reduce(function(t,n){return t+e.components[n].css},"")},e.prototype.inject=function(e,t,n){var r=this.components[e];if(!r)throw new Error("Must add a new component before you can inject css into it");""===r.css&&(r.css="/* sc-component-id: "+e+" */\n"),r.css+=t.replace(/\n*$/,"\n"),n&&this.names.push(n)},e.prototype.toHTML=function(){var e=['type="text/css"',$+'="'+this.names.join(" ")+'"',J+'="'+(this.isLocal?"true":"false")+'"'],t=V();return t&&e.push('nonce="'+t+'"'),"<style "+e.join(" ")+">"+this.concatenateCSS()+"</style>"},e.prototype.toReactElement=function(e){var t,n=(t={},t[$]=this.names.join(" "),t[J]=this.isLocal.toString(),t),r=V();return r&&(n.nonce=r),y.a.createElement("style",H({key:e,type:"text/css"},n,{dangerouslySetInnerHTML:{__html:this.concatenateCSS()}}))},e.prototype.clone=function(){var t=this,n=new e(this.isLocal);return n.names=[].concat(this.names),n.size=this.size,n.components=Object.keys(this.components).reduce(function(e,n){return e[n]=H({},t.components[n]),e},{}),n},e}(),ae=function(){function e(){W(this,e),this.instance=te.clone(te.instance)}return e.prototype.collectStyles=function(e){if(this.closed)throw new Error("Can't collect styles once you've called getStyleTags!");return y.a.createElement(ne,{sheet:this.instance},e)},e.prototype.getStyleTags=function(){return this.closed||(ee.splice(ee.indexOf(this.instance),1),this.closed=!0),this.instance.toHTML()},e.prototype.getStyleElement=function(){return this.closed||(ee.splice(ee.indexOf(this.instance),1),this.closed=!0),this.instance.toReactElements()},e.create=function(){return new te(function(e){return new ie(e)})},e}(),se=function(e){var t={},n=!1;return function(r){n||(t[r]=!0,Object.keys(t).length>=200&&(console.warn("Over 200 classes were generated for component "+e+". \nConsider using the attrs method, together with a style object for frequently changed styles.\nExample:\n const Component = styled.div.attrs({\n style: ({ background }) => ({\n background,\n }),\n })`width: 100%;`\n\n <Component />"),n=!0,t={}))}},ce={children:!0,dangerouslySetInnerHTML:!0,key:!0,ref:!0,autoFocus:!0,defaultValue:!0,valueLink:!0,defaultChecked:!0,checkedLink:!0,innerHTML:!0,suppressContentEditableWarning:!0,onFocusIn:!0,onFocusOut:!0,className:!0,onCopy:!0,onCut:!0,onPaste:!0,onCompositionEnd:!0,onCompositionStart:!0,onCompositionUpdate:!0,onKeyDown:!0,onKeyPress:!0,onKeyUp:!0,onFocus:!0,onBlur:!0,onChange:!0,onInput:!0,onSubmit:!0,onReset:!0,onClick:!0,onContextMenu:!0,onDoubleClick:!0,onDrag:!0,onDragEnd:!0,onDragEnter:!0,onDragExit:!0,onDragLeave:!0,onDragOver:!0,onDragStart:!0,onDrop:!0,onMouseDown:!0,onMouseEnter:!0,onMouseLeave:!0,onMouseMove:!0,onMouseOut:!0,onMouseOver:!0,onMouseUp:!0,onSelect:!0,onTouchCancel:!0,onTouchEnd:!0,onTouchMove:!0,onTouchStart:!0,onScroll:!0,onWheel:!0,onAbort:!0,onCanPlay:!0,onCanPlayThrough:!0,onDurationChange:!0,onEmptied:!0,onEncrypted:!0,onEnded:!0,onError:!0,onLoadedData:!0,onLoadedMetadata:!0,onLoadStart:!0,onPause:!0,onPlay:!0,onPlaying:!0,onProgress:!0,onRateChange:!0,onSeeked:!0,onSeeking:!0,onStalled:!0,onSuspend:!0,onTimeUpdate:!0,onVolumeChange:!0,onWaiting:!0,onLoad:!0,onAnimationStart:!0,onAnimationEnd:!0,onAnimationIteration:!0,onTransitionEnd:!0,onCopyCapture:!0,onCutCapture:!0,onPasteCapture:!0,onCompositionEndCapture:!0,onCompositionStartCapture:!0,onCompositionUpdateCapture:!0,onKeyDownCapture:!0,onKeyPressCapture:!0,onKeyUpCapture:!0,onFocusCapture:!0,onBlurCapture:!0,onChangeCapture:!0,onInputCapture:!0,onSubmitCapture:!0,onResetCapture:!0,onClickCapture:!0,onContextMenuCapture:!0,onDoubleClickCapture:!0,onDragCapture:!0,onDragEndCapture:!0,onDragEnterCapture:!0,onDragExitCapture:!0,onDragLeaveCapture:!0,onDragOverCapture:!0,onDragStartCapture:!0,onDropCapture:!0,onMouseDownCapture:!0,onMouseEnterCapture:!0,onMouseLeaveCapture:!0,onMouseMoveCapture:!0,onMouseOutCapture:!0,onMouseOverCapture:!0,onMouseUpCapture:!0,onSelectCapture:!0,onTouchCancelCapture:!0,onTouchEndCapture:!0,onTouchMoveCapture:!0,onTouchStartCapture:!0,onScrollCapture:!0,onWheelCapture:!0,onAbortCapture:!0,onCanPlayCapture:!0,onCanPlayThroughCapture:!0,onDurationChangeCapture:!0,onEmptiedCapture:!0,onEncryptedCapture:!0,onEndedCapture:!0,onErrorCapture:!0,onLoadedDataCapture:!0,onLoadedMetadataCapture:!0,onLoadStartCapture:!0,onPauseCapture:!0,onPlayCapture:!0,onPlayingCapture:!0,onProgressCapture:!0,onRateChangeCapture:!0,onSeekedCapture:!0,onSeekingCapture:!0,onStalledCapture:!0,onSuspendCapture:!0,onTimeUpdateCapture:!0,onVolumeChangeCapture:!0,onWaitingCapture:!0,onLoadCapture:!0,onAnimationStartCapture:!0,onAnimationEndCapture:!0,onAnimationIterationCapture:!0,onTransitionEndCapture:!0},ue={accept:!0,acceptCharset:!0,accessKey:!0,action:!0,allowFullScreen:!0,allowTransparency:!0,alt:!0,as:!0,async:!0,autoComplete:!0,autoPlay:!0,capture:!0,cellPadding:!0,cellSpacing:!0,charSet:!0,challenge:!0,checked:!0,cite:!0,classID:!0,className:!0,cols:!0,colSpan:!0,content:!0,contentEditable:!0,contextMenu:!0,controls:!0,coords:!0,crossOrigin:!0,data:!0,dateTime:!0,default:!0,defer:!0,dir:!0,disabled:!0,download:!0,draggable:!0,encType:!0,form:!0,formAction:!0,formEncType:!0,formMethod:!0,formNoValidate:!0,formTarget:!0,frameBorder:!0,headers:!0,height:!0,hidden:!0,high:!0,href:!0,hrefLang:!0,htmlFor:!0,httpEquiv:!0,icon:!0,id:!0,inputMode:!0,integrity:!0,is:!0,keyParams:!0,keyType:!0,kind:!0,label:!0,lang:!0,list:!0,loop:!0,low:!0,manifest:!0,marginHeight:!0,marginWidth:!0,max:!0,maxLength:!0,media:!0,mediaGroup:!0,method:!0,min:!0,minLength:!0,multiple:!0,muted:!0,name:!0,nonce:!0,noValidate:!0,open:!0,optimum:!0,pattern:!0,placeholder:!0,playsInline:!0,poster:!0,preload:!0,profile:!0,radioGroup:!0,readOnly:!0,referrerPolicy:!0,rel:!0,required:!0,reversed:!0,role:!0,rows:!0,rowSpan:!0,sandbox:!0,scope:!0,scoped:!0,scrolling:!0,seamless:!0,selected:!0,shape:!0,size:!0,sizes:!0,span:!0,spellCheck:!0,src:!0,srcDoc:!0,srcLang:!0,srcSet:!0,start:!0,step:!0,style:!0,summary:!0,tabIndex:!0,target:!0,title:!0,type:!0,useMap:!0,value:!0,width:!0,wmode:!0,wrap:!0,about:!0,datatype:!0,inlist:!0,prefix:!0,property:!0,resource:!0,typeof:!0,vocab:!0,autoCapitalize:!0,autoCorrect:!0,autoSave:!0,color:!0,itemProp:!0,itemScope:!0,itemType:!0,itemID:!0,itemRef:!0,results:!0,security:!0,unselectable:0},le={accentHeight:!0,accumulate:!0,additive:!0,alignmentBaseline:!0,allowReorder:!0,alphabetic:!0,amplitude:!0,arabicForm:!0,ascent:!0,attributeName:!0,attributeType:!0,autoReverse:!0,azimuth:!0,baseFrequency:!0,baseProfile:!0,baselineShift:!0,bbox:!0,begin:!0,bias:!0,by:!0,calcMode:!0,capHeight:!0,clip:!0,clipPath:!0,clipRule:!0,clipPathUnits:!0,colorInterpolation:!0,colorInterpolationFilters:!0,colorProfile:!0,colorRendering:!0,contentScriptType:!0,contentStyleType:!0,cursor:!0,cx:!0,cy:!0,d:!0,decelerate:!0,descent:!0,diffuseConstant:!0,direction:!0,display:!0,divisor:!0,dominantBaseline:!0,dur:!0,dx:!0,dy:!0,edgeMode:!0,elevation:!0,enableBackground:!0,end:!0,exponent:!0,externalResourcesRequired:!0,fill:!0,fillOpacity:!0,fillRule:!0,filter:!0,filterRes:!0,filterUnits:!0,floodColor:!0,floodOpacity:!0,focusable:!0,fontFamily:!0,fontSize:!0,fontSizeAdjust:!0,fontStretch:!0,fontStyle:!0,fontVariant:!0,fontWeight:!0,format:!0,from:!0,fx:!0,fy:!0,g1:!0,g2:!0,glyphName:!0,glyphOrientationHorizontal:!0,glyphOrientationVertical:!0,glyphRef:!0,gradientTransform:!0,gradientUnits:!0,hanging:!0,horizAdvX:!0,horizOriginX:!0,ideographic:!0,imageRendering:!0,in:!0,in2:!0,intercept:!0,k:!0,k1:!0,k2:!0,k3:!0,k4:!0,kernelMatrix:!0,kernelUnitLength:!0,kerning:!0,keyPoints:!0,keySplines:!0,keyTimes:!0,lengthAdjust:!0,letterSpacing:!0,lightingColor:!0,limitingConeAngle:!0,local:!0,markerEnd:!0,markerMid:!0,markerStart:!0,markerHeight:!0,markerUnits:!0,markerWidth:!0,mask:!0,maskContentUnits:!0,maskUnits:!0,mathematical:!0,mode:!0,numOctaves:!0,offset:!0,opacity:!0,operator:!0,order:!0,orient:!0,orientation:!0,origin:!0,overflow:!0,overlinePosition:!0,overlineThickness:!0,paintOrder:!0,panose1:!0,pathLength:!0,patternContentUnits:!0,patternTransform:!0,patternUnits:!0,pointerEvents:!0,points:!0,pointsAtX:!0,pointsAtY:!0,pointsAtZ:!0,preserveAlpha:!0,preserveAspectRatio:!0,primitiveUnits:!0,r:!0,radius:!0,refX:!0,refY:!0,renderingIntent:!0,repeatCount:!0,repeatDur:!0,requiredExtensions:!0,requiredFeatures:!0,restart:!0,result:!0,rotate:!0,rx:!0,ry:!0,scale:!0,seed:!0,shapeRendering:!0,slope:!0,spacing:!0,specularConstant:!0,specularExponent:!0,speed:!0,spreadMethod:!0,startOffset:!0,stdDeviation:!0,stemh:!0,stemv:!0,stitchTiles:!0,stopColor:!0,stopOpacity:!0,strikethroughPosition:!0,strikethroughThickness:!0,string:!0,stroke:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeLinecap:!0,strokeLinejoin:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0,surfaceScale:!0,systemLanguage:!0,tableValues:!0,targetX:!0,targetY:!0,textAnchor:!0,textDecoration:!0,textRendering:!0,textLength:!0,to:!0,transform:!0,u1:!0,u2:!0,underlinePosition:!0,underlineThickness:!0,unicode:!0,unicodeBidi:!0,unicodeRange:!0,unitsPerEm:!0,vAlphabetic:!0,vHanging:!0,vIdeographic:!0,vMathematical:!0,values:!0,vectorEffect:!0,version:!0,vertAdvY:!0,vertOriginX:!0,vertOriginY:!0,viewBox:!0,viewTarget:!0,visibility:!0,widths:!0,wordSpacing:!0,writingMode:!0,x:!0,xHeight:!0,x1:!0,x2:!0,xChannelSelector:!0,xlinkActuate:!0,xlinkArcrole:!0,xlinkHref:!0,xlinkRole:!0,xlinkShow:!0,xlinkTitle:!0,xlinkType:!0,xmlBase:!0,xmlns:!0,xmlnsXlink:!0,xmlLang:!0,xmlSpace:!0,y:!0,y1:!0,y2:!0,yChannelSelector:!0,z:!0,zoomAndPan:!0},fe=RegExp.prototype.test.bind(new RegExp("^(data|aria)-[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$")),he={}.hasOwnProperty,pe=function(e){return he.call(ue,e)||he.call(le,e)||fe(e.toLowerCase())||he.call(ce,e)},de=function(e,t,n){var r=n&&e.theme===n.theme;return e.theme&&!r?e.theme:t},me=function(e){function t(e){a=e;for(var t in o){var n=o[t];void 0!==n&&n(a)}}function n(e){var t=i;return o[t]=e,i+=1,e(a),t}function r(e){o[e]=void 0}var o={},i=0,a=e;return{publish:t,subscribe:n,unsubscribe:r}},ge="__styled-components__",ve=ge+"next__",ye=w.a.shape({getTheme:w.a.func,subscribe:w.a.func,unsubscribe:w.a.func}),be=function(e){var t=!1;return function(){t||(t=!0,e())}}(function(){console.error("Warning: Usage of `context."+ge+"` as a function is deprecated. It will be replaced with the object on `.context."+ve+"` in a future version.")}),we=function(e){function t(){W(this,t);var n=z(this,e.call(this));return n.unsubscribeToOuterId=-1,n.getTheme=n.getTheme.bind(n),n}return q(t,e),t.prototype.componentWillMount=function(){var e=this,t=this.context[ve];void 0!==t&&(this.unsubscribeToOuterId=t.subscribe(function(t){e.outerTheme=t})),this.broadcast=me(this.getTheme())},t.prototype.getChildContext=function(){var e,t=this;return H({},this.context,(e={},e[ve]={getTheme:this.getTheme,subscribe:this.broadcast.subscribe,unsubscribe:this.broadcast.unsubscribe},e[ge]=function(e){be();var n=t.broadcast.subscribe(e);return function(){return t.broadcast.unsubscribe(n)}},e))},t.prototype.componentWillReceiveProps=function(e){this.props.theme!==e.theme&&this.broadcast.publish(this.getTheme(e.theme))},t.prototype.componentWillUnmount=function(){-1!==this.unsubscribeToOuterId&&this.context[ve].unsubscribe(this.unsubscribeToOuterId)},t.prototype.getTheme=function(e){var t=e||this.props.theme;if(E()(t)){var n=t(this.outerTheme);if(!d()(n))throw new Error("[ThemeProvider] Please return an object from your theme function, i.e. theme={() => ({})}!");return n}if(!d()(t))throw new Error("[ThemeProvider] Please make your theme prop a plain object");return H({},this.outerTheme,t)},t.prototype.render=function(){return this.props.children?y.a.Children.only(this.props.children):null},t}(v.Component);we.childContextTypes=(re={},re[ge]=w.a.func,re[ve]=ye,re),we.contextTypes=(oe={},oe[ve]=ye,oe);var xe=/[[\].#*$><+~=|^:(),"'`]/g,Ee=/--+/g,Te={},Ce=function e(t,n){for(var r=0;r<t.length;r+=1){var o=t[r];if(Array.isArray(o)&&!e(o))return!1;if("function"==typeof o&&!a(o))return!1}if(void 0!==n)for(var i in n){var s=n[i];if("function"==typeof s)return!1}return!0},Se=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"],ke=function(e){return e.replace(/\s|\\n/g,"")},Me=function(t){var n,r=t.displayName||t.name||"Component",o=a(t),i=function(n){function r(){var e,t,o;W(this,r);for(var i=arguments.length,a=Array(i),s=0;s<i;s++)a[s]=arguments[s];return e=t=z(this,n.call.apply(n,[this].concat(a))),t.state={},t.unsubscribeId=-1,o=e,z(t,o)}return q(r,n),r.prototype.componentWillMount=function(){var t=this,n=this.constructor.defaultProps,r=this.context[ve],o=de(this.props,void 0,n);if(void 0===r&&void 0===o&&"production"!==e.env.NODE_ENV)console.warn("[withTheme] You are not using a ThemeProvider nor passing a theme prop or a theme in defaultProps");else if(void 0===r&&void 0!==o)this.setState({theme:o});else{var i=r.subscribe;this.unsubscribeId=i(function(e){var r=de(t.props,e,n);t.setState({theme:r})})}},r.prototype.componentWillReceiveProps=function(e){var t=this.constructor.defaultProps;this.setState(function(n){return{theme:de(e,n.theme,t)}})},r.prototype.componentWillUnmount=function(){-1!==this.unsubscribeId&&this.context[ve].unsubscribe(this.unsubscribeId)},r.prototype.render=function(){var e=this.props.innerRef,n=this.state.theme;return y.a.createElement(t,H({theme:n},this.props,{innerRef:o?e:void 0,ref:o?void 0:e}))},r}(y.a.Component);return i.displayName="WithTheme("+r+")",i.styledComponentId="withTheme",i.contextTypes=(n={},n[ge]=w.a.func,n[ve]=ye,n),C()(i,t)},Ae=function(t,n,r){return function(){function o(t,n,r){if(W(this,o),this.rules=t,this.isStatic=Ce(t,n),this.componentId=r,!te.instance.hasInjectedComponent(this.componentId)){var i="production"!==e.env.NODE_ENV?"."+r+" {}":"";te.instance.deferredInject(r,!0,i)}}return o.prototype.generateAndInjectStyles=function(e,o){var i=this.isStatic,a=this.lastClassName;if(i&&void 0!==a)return a;var s=n(this.rules,e),u=c(this.componentId+s.join("")),l=o.getName(u);if(void 0!==l)return o.stylesCacheable&&(this.lastClassName=l),l;var f=t(u);if(o.stylesCacheable&&(this.lastClassName=l),o.alreadyInjected(u,f))return f;var h="\n"+r(s,"."+f);return o.inject(this.componentId,!0,h,u,f),f},o.generateName=function(e){return t(c(e))},o}()}(L,P,I),Oe=function(e){return function t(n,r){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if("string"!=typeof r&&"function"!=typeof r)throw new Error("Cannot create styled-component for component: "+r);var i=function(t){for(var i=arguments.length,a=Array(i>1?i-1:0),s=1;s<i;s++)a[s-1]=arguments[s];return n(r,o,e.apply(void 0,[t].concat(a)))};return i.withConfig=function(e){return t(n,r,H({},o,e))},i.attrs=function(e){return t(n,r,H({},o,{attrs:H({},o.attrs||{},e)}))},i}}(N),Re=function(t,n){var r={},o=function(e,n){var o="string"!=typeof e?"sc":e.replace(xe,"-").replace(Ee,"-"),i=(r[o]||0)+1;r[o]=i;var a=t.generateName(o+i),s=o+"-"+a;return void 0!==n?n+"-"+s:s},c=function(e){function t(){var n,r,o;W(this,t);for(var i=arguments.length,a=Array(i),s=0;s<i;s++)a[s]=arguments[s];return n=r=z(this,e.call.apply(e,[this].concat(a))),r.attrs={},r.state={theme:null,generatedClassName:""},r.unsubscribeId=-1,o=n,z(r,o)}return q(t,e),t.prototype.unsubscribeFromContext=function(){-1!==this.unsubscribeId&&this.context[ve].unsubscribe(this.unsubscribeId)},t.prototype.buildExecutionContext=function(e,t){var n=this.constructor.attrs,r=H({},t,{theme:e});return void 0===n?r:(this.attrs=Object.keys(n).reduce(function(e,t){var o=n[t];return e[t]="function"==typeof o?o(r):o,e},{}),H({},r,this.attrs))},t.prototype.generateAndInjectStyles=function(e,t){var n=this.constructor,r=n.attrs,o=n.componentStyle,i=n.warnTooManyClasses,a=this.context[Z]||te.instance;if(o.isStatic&&void 0===r)return o.generateAndInjectStyles(Te,a);var s=this.buildExecutionContext(e,t),c=o.generateAndInjectStyles(s,a);return void 0!==i&&i(c),c},t.prototype.componentWillMount=function(){var e=this,t=this.constructor.componentStyle,n=this.context[ve];if(t.isStatic){var r=this.generateAndInjectStyles(Te,this.props);this.setState({generatedClassName:r})}else if(void 0!==n){var o=n.subscribe;this.unsubscribeId=o(function(t){var n=de(e.props,t,e.constructor.defaultProps),r=e.generateAndInjectStyles(n,e.props);e.setState({theme:n,generatedClassName:r})})}else{var i=this.props.theme||{},a=this.generateAndInjectStyles(i,this.props);this.setState({theme:i,generatedClassName:a})}},t.prototype.componentWillReceiveProps=function(e){var t=this;this.constructor.componentStyle.isStatic||this.setState(function(n){var r=de(e,n.theme,t.constructor.defaultProps);return{theme:r,generatedClassName:t.generateAndInjectStyles(r,e)}})},t.prototype.componentWillUnmount=function(){this.unsubscribeFromContext()},t.prototype.render=function(){var e=this,t=this.props.innerRef,n=this.state.generatedClassName,r=this.constructor,o=r.styledComponentId,s=r.target,c=i(s),u=[this.props.className,o,this.attrs.className,n].filter(Boolean).join(" "),l=H({},this.attrs,{className:u});a(s)?l.innerRef=t:l.ref=t;var f=Object.keys(this.props).reduce(function(t,n){return"innerRef"===n||"className"===n||c&&!pe(n)||(t[n]=e.props[n]),t},l);return Object(v.createElement)(s,f)},t}(v.Component);return function r(a,u,l){var f,h=u.displayName,p=void 0===h?i(a)?"styled."+a:"Styled("+s(a)+")":h,d=u.componentId,m=void 0===d?o(u.displayName,u.parentComponentId):d,g=u.ParentComponent,v=void 0===g?c:g,y=u.rules,b=u.attrs,x=u.displayName&&u.componentId?u.displayName+"-"+u.componentId:m,E=void 0;"production"!==e.env.NODE_ENV&&(E=se(p));var T=new t(void 0===y?l:y.concat(l),b,x),C=function(e){function t(){return W(this,t),z(this,e.apply(this,arguments))}return q(t,e),t.withComponent=function(e){var n=u.componentId,o=G(u,["componentId"]),a=n&&n+"-"+(i(e)?e:s(e)),c=H({},o,{componentId:a,ParentComponent:t});return r(e,c,l)},X(t,null,[{key:"extend",get:function(){var e=u.rules,o=u.componentId,i=G(u,["rules","componentId"]),s=void 0===e?l:e.concat(l),c=H({},i,{rules:s,parentComponentId:o,ParentComponent:t});return n(r,a,c)}}]),t}(v);return C.contextTypes=(f={},f[ge]=w.a.func,f[ve]=ye,f[Z]=w.a.oneOfType([w.a.instanceOf(te),w.a.instanceOf(ae)]),f),C.displayName=p,C.styledComponentId=x,C.attrs=b,C.componentStyle=T,C.warnTooManyClasses=E,C.target=a,C}}(Ae,Oe),Pe=function(e,t,n){return function(r){for(var o=arguments.length,i=Array(o>1?o-1:0),a=1;a<o;a++)i[a-1]=arguments[a];var s=n.apply(void 0,[r].concat(i)),u=c(ke(JSON.stringify(s))),l=te.instance.getName(u);if(l)return l;var f=e(u);if(te.instance.alreadyInjected(u,f))return f;var h=t(s,f,"@keyframes");return te.instance.inject("sc-keyframes-"+f,!0,h,u,f),f}}(L,I,N),_e=function(e,t){return function(n){for(var r=arguments.length,o=Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];var a=t.apply(void 0,[n].concat(o)),s=c(JSON.stringify(a)),u="sc-global-"+s;te.instance.hasInjectedComponent(u)||te.instance.inject(u,!1,e(a))}}(I,N),Ie=function(e,t){var n=function(n){return t(e,n)};return Se.forEach(function(e){n[e]=n(e)}),n}(Re,Oe);t.default=Ie}.call(t,n(2))},function(e,t,n){"use strict";function r(e){if(s.hasOwnProperty(e))return s[e];throw Error("Loss function "+e+" is invalid. Available options: "+Object.keys(s))}Object.defineProperty(t,"__esModule",{value:!0});var o=n(1),i=function(){function e(e,t){this.canvas=e,this.image=t,this.transformation=o.Matrix4x4.create(),this.aspectMatrixBuffer=o.Matrix4x4.create(),this.viewMatrixBuffer=o.Matrix4x4.create(),this.image=t,this.resize()}return e.prototype.resize=function(){var e=Math.floor(this.canvas.clientWidth*window.devicePixelRatio),t=Math.floor(this.canvas.clientHeight*window.devicePixelRatio);return(this.canvas.width!==e||this.canvas.height!==t)&&(this.canvas.width=e,this.canvas.height=t,!0)},e.prototype.getAspect=function(){var e=this.canvas.clientWidth/this.canvas.clientHeight,t=this.image.width/this.image.height;return e>t?{x:t/e,y:1}:{x:1,y:e/t}},e.prototype.getViewMatrix=function(){var e=this.getAspect();return o.Matrix4x4.fromScaling(this.aspectMatrixBuffer,[e.x,e.y,1]),o.Matrix4x4.multiply(this.viewMatrixBuffer,this.aspectMatrixBuffer,this.transformation),this.viewMatrixBuffer},e}();t.default=i;var a;!function(e){e[e.L1=1]="L1",e[e.L2=2]="L2",e[e.MAPE=3]="MAPE",e[e.MRSE=4]="MRSE",e[e.SMAPE=5]="SMAPE",e[e.SSIM=6]="SSIM"}(a=t.LossFunction||(t.LossFunction={}));var s={L1:a.L1,L2:a.L2,MAPE:a.MAPE,MRSE:a.MRSE,SMAPE:a.SMAPE,SSIM:a.SSIM};t.lossFunctionFromString=r},function(e,t,n){"use strict";function r(e,t){return f.parse(e,t)}function o(e){var t=e.split(".").pop();return t&&"exr"===t.toLocaleLowerCase()?i(e):a(e)}function i(e){return console.time("Downloading '"+e+"'"),fetch(e).then(function(t){return console.timeEnd("Downloading '"+e+"'"),t}).then(function(e){return e.arrayBuffer()}).then(function(t){return r(e,t)})}function a(e){return console.time("Downloading '"+e+"'"),new Promise(function(t,n){var r=new Image;r.onerror=function(t){return n(new Error("Failed to load '"+e+"'."))},r.onload=function(){console.timeEnd("Downloading '"+e+"'");try{var o=document.createElement("canvas");o.width=r.width,o.height=r.height;var i=o.getContext("2d");if(!i)return void n(new Error("Failed to get 2d canvas context."));i.drawImage(r,0,0),t({url:e,width:r.width,height:r.height,nChannels:4,data:r,type:"LdrImage"})}catch(t){n(new Error("Failed to load image '"+e+"': "+t))}},r.src=e})}function s(e,t,n,r){if("HdrImage"===e.type)return e.data[(t+n*e.width)*e.nChannels+r];var o=h.get(e);if(null==o){var i=document.createElement("canvas");i.width=e.width,i.height=e.height;var a=i.getContext("2d");if(!a)throw new Error("Failed to create 2d context to retrieve LDR image data");a.drawImage(e.data,0,0,e.width,e.height),o=function(e,t,n){return a.getImageData(e,t,1,1).data[n]/256},h.set(e,o)}return o(t,n,r)}var c=this&&this.__assign||Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e};Object.defineProperty(t,"__esModule",{value:!0});var u=n(17),l=function(){function e(e){this.nWorkers=e,this.nextWorkerId=0,this.jobId=0,this.returnHandlers={},this.workers=[];for(var t=0;t<e;++t){var n=new u;this.workers.push(n),n.onmessage=this.handleResult.bind(this)}}return e.prototype.parse=function(e,t){var n=this;return new Promise(function(r,o){var i=n.nextWorker(),a=n.jobId++;n.returnHandlers[a]=function(t){t.data.success?r(c({url:e},t.data.image)):o(new Error(t.data.message))},i.postMessage({jobId:a,data:t},[t])})},e.prototype.handleResult=function(e){if(null==e.data.jobId)throw new Error("Got a message from the webworker without job id.");var t=this.returnHandlers[e.data.jobId];delete this.returnHandlers[e.data.jobId],t(e)},e.prototype.nextWorker=function(){var e=this.workers[this.nextWorkerId];return this.nextWorkerId=(this.nextWorkerId+1)%this.nWorkers,e},e}(),f=new l(2);t.loadImage=o,t.loadExr=i,t.loadLdr=a;var h=new Map;t.getPixelColor=s;var p=function(){function e(){this.images={},this.downloading={}}return e.prototype.contains=function(e){return this.images.hasOwnProperty(e)},e.prototype.currentlyDownloading=function(e){return this.downloading.hasOwnProperty(e)},e.prototype.size=function(){return Object.keys(this.images).length},e.prototype.get=function(e){return this.contains(e)?Promise.resolve(this.images[e]):this.currentlyDownloading(e)?this.downloading[e]:this.load(e)},e.prototype.store=function(e,t){return this.currentlyDownloading(e)&&delete this.currentlyDownloading[e],this.images[e]=t,t},e.prototype.load=function(e){var t=this,n=o(e);return this.downloading[e]=n,n.then(function(n){return t.store(e,n)})},e}();t.ImageCache=p},function(e,t,n){"use strict";function r(e){return function(){return e}}var o=function(){};o.thatReturns=r,o.thatReturnsFalse=r(!1),o.thatReturnsTrue=r(!0),o.thatReturnsNull=r(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(e){return e},e.exports=o},function(e,t,n){"use strict";(function(t){function n(e,t,n,o,i,a,s,c){if(r(t),!e){var u;if(void 0===t)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[n,o,i,a,s,c],f=0;u=new Error(t.replace(/%s/g,function(){return l[f++]})),u.name="Invariant Violation"}throw u.framesToPop=1,u}}var r=function(e){};"production"!==t.env.NODE_ENV&&(r=function(e){if(void 0===e)throw new Error("invariant requires an error message argument")}),e.exports=n}).call(t,n(2))},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,n){"use strict";var r=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=n(0),i=n(1),a=n(10),s=n(11),c=n(12),u=n(3),l=(p=["\n position: absolute;\n top: 0; bottom: 0;\n left: 0; right: 0;\n width: 100%; height: 100%;\n"],p.raw=["\n position: absolute;\n top: 0; bottom: 0;\n left: 0; right: 0;\n width: 100%; height: 100%;\n"],u.default.canvas(p)),f=(d=["\n position: absolute;\n top: 0; bottom: 0;\n left: 0; right: 0;\n width: 100%; height: 100%;\n"],d.raw=["\n position: absolute;\n top: 0; bottom: 0;\n left: 0; right: 0;\n width: 100%; height: 100%;\n"],u.default.div(d)),h=function(e){function t(t){var n=e.call(this,t)||this;return n.transformation=i.Matrix4x4.create(),n.defaultTransformation=i.Matrix4x4.create(),n.handleTransformationChange=n.handleTransformationChange.bind(n),n}return r(t,e),t.prototype.componentDidMount=function(){this.imageLayer=new a.default(this.imageLayerElement,this.props.image),this.textLayer=new s.default(this.textLayerElement,this.props.image),this.mouseLayer=new c.default(this.mouseLayerElement,this.props.image,this.props.enableMouseEvents),this.mouseLayer.onTransformationChange(this.handleTransformationChange),this.updateCanvasProps(),this.handleTransformationChange(this.transformation)},t.prototype.componentDidUpdate=function(e){this.updateCanvasProps(e),this.mouseLayer.setEnableMouseEvents(this.props.enableMouseEvents)},t.prototype.componentWillUnmount=function(){this.mouseLayer.onPointAt(void 0),this.mouseLayer.onTransformationChange(void 0),this.mouseLayer.destruct()},t.prototype.setDefaultTransformation=function(e){this.defaultTransformation=e},t.prototype.reset=function(){this.handleTransformationChange(this.defaultTransformation)},t.prototype.setTransformation=function(e){this.handleTransformationChange(e)},t.prototype.getTransformation=function(){return this.transformation},t.prototype.render=function(){var e=this;return o.createElement(f,null,o.createElement(l,{innerRef:function(t){return e.imageLayerElement=t}}),o.createElement(l,{innerRef:function(t){return e.textLayerElement=t}}),o.createElement(l,{innerRef:function(t){return e.mouseLayerElement=t}}))},t.prototype.handleTransformationChange=function(e){this.props.allowMovement&&(this.transformation=e,this.imageLayer.setTransformation(e),this.textLayer.setTransformation(e),this.mouseLayer.setTransformation(e),null!=this.props.onTransform&&this.props.onTransform(e))},t.prototype.updateCanvasProps=function(e){void 0===e&&(e=null),e&&e.viewTransform===this.props.viewTransform&&e.exposure===this.props.exposure&&e.gamma===this.props.gamma&&e.offset===this.props.offset||this.imageLayer.setTonemapping({viewTransform:this.props.viewTransform,exposure:this.props.exposure,offset:this.props.offset,gamma:this.props.gamma}),e&&e.image===this.props.image||(this.imageLayer.setImage(this.props.image),this.textLayer.setImage(this.props.image),this.mouseLayer.setImage(this.props.image)),this.mouseLayer.onPointAt(this.props.onPoint)},t}(o.Component);t.default=h;var p,d},function(e,t,n){"use strict";function r(e,t,n){var r=n.createShader(t);if(n.shaderSource(r,e),n.compileShader(r),!r||!n.getShaderParameter(r,n.COMPILE_STATUS))throw new Error("Compiling shader failed with error '"+n.getShaderInfoLog(r)+"'.");return r}var o=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(t,"__esModule",{value:!0});var i,a=n(16),s=n(4);!function(e){e[e.LDR=0]="LDR",e[e.HDR=1]="HDR",e[e.ColorMap=2]="ColorMap"}(i||(i={}));var c;!function(e){e[e.None=-1]="None",e[e.Gamma22=0]="Gamma22",e[e.K1S1=1]="K1S1"}(c||(c={}));var u="\nprecision mediump float;\nuniform int viewTransform;\nuniform float exposure;\nuniform float offset;\nuniform float gamma;\nuniform int mode;\nuniform int nChannels;\nuniform int lossFunction;\nuniform int imageHeight; // Height and width are used to access neighboring pixels\nuniform int imageWidth;\nvarying vec2 vTextureCoord;\nuniform sampler2D imASampler;\nuniform sampler2D imBSampler;\nuniform sampler2D cmapSampler;\n\nvec3 lookupOffset(sampler2D sampler, vec2 position, vec2 offset) {\n // Read neighbouring pixels from an image texture\n // Takes 'position' (range 0 - 1) and an integer pixel offset 'offset'\n vec2 imageSize = vec2(imageWidth, imageHeight);\n return texture2D(sampler, position + offset / imageSize).rgb;\n}\n\nfloat log10(float a) {\n const float logBase10 = 1.0 / log2( 10.0 );\n\n return log2(a) * logBase10;\n}\n\nfloat luminance(vec3 rgb) {\n return dot(vec3(0.2126, 0.7152, 0.0722), rgb);\n}\n\nvec3 GOG(vec3 rgb, float gain, float offset, float gamma) {\n return pow(gain * rgb + offset, vec3(1.0 / gamma));\n}\n\nfloat logEncodingLogC(float a) {\n float LogC = a >= 0.01059106816664 ? 0.385537 + 0.2471896 * log10(a * 5.555556 + 0.052272) : a * 5.367655 + 0.092809;\n\n return LogC;\n}\n\nfloat sigmoidK1S1(float a) {\n float sigmoid = 1.0 / (1.0 + pow(2.718281828459045, -8.9 * (a - 0.435)));\n\n return sigmoid;\n}\n\nvec3 viewTransformNone(vec3 rgb) {\n return rgb;\n}\n\nvec3 viewTransformGamma22(vec3 rgb) {\n const float exponent = 1.0 / 2.2;\n\n return pow(max(rgb, 0.0), vec3(exponent, exponent, exponent));\n}\n\nvec3 viewTransformK1S1(vec3 rgb) {\n vec3 LogC = vec3(logEncodingLogC(rgb.x), logEncodingLogC(rgb.y), logEncodingLogC(rgb.z));\n\n return vec3(sigmoidK1S1(LogC.x), sigmoidK1S1(LogC.y), sigmoidK1S1(LogC.z));\n}\n\nvec3 applyViewTransform(vec3 rgb, int which) {\n if (which == "+c.None+") {\n return viewTransformNone(rgb);\n } else if (which == "+c.Gamma22+") {\n return viewTransformGamma22(rgb);\n } else if (which == "+c.K1S1+") {\n return viewTransformK1S1(rgb);\n }\n}\n\nvoid main(void) {\n vec3 col;\n vec2 position = vec2(vTextureCoord.s, vTextureCoord.t);\n if (lossFunction == "+s.LossFunction.L1+") {\n col = texture2D(imASampler, position).rgb;\n col = col - texture2D(imBSampler, position).rgb;\n col = abs(col);\n } else if (lossFunction == "+s.LossFunction.MAPE+") {\n vec3 img = texture2D(imASampler, position).rgb;\n vec3 ref = texture2D(imBSampler, position).rgb;\n vec3 diff = img - ref;\n col = abs(diff) / (abs(ref) + 1e-2);\n } else if (lossFunction == "+s.LossFunction.SMAPE+") {\n vec3 img = texture2D(imASampler, position).rgb;\n vec3 ref = texture2D(imBSampler, position).rgb;\n vec3 diff = img - ref;\n col = 2.0 * abs(diff) / (abs(ref) + abs(img) + 2e-2);\n } else if (lossFunction == "+s.LossFunction.MRSE+") {\n vec3 img = texture2D(imASampler, position).rgb;\n vec3 ref = texture2D(imBSampler, position).rgb;\n vec3 diff = img - ref;\n col = diff * diff / (ref * ref + 1e-4);\n } else if (lossFunction == "+s.LossFunction.L2+") {\n vec3 img = texture2D(imASampler, position).rgb;\n vec3 ref = texture2D(imBSampler, position).rgb;\n vec3 diff = img - ref;\n col = diff * diff;\n } else if (lossFunction == "+s.LossFunction.SSIM+") {\n const int windowRadius = 2; // We use a symmetric 5x5 window as opposed to the customary 8x8 (wiki)\n const float L = 1.; // The dynamic range\n const float k1 = 0.01, k2 = 0.03; // Default constants\n const float c1 = (k1*L)*(k1*L), c2 = (k2*L)*(k2*L);\n const float n = float((2 * windowRadius + 1) * (2 * windowRadius + 1));\n\n // Compute means and standard deviations of both images\n float aSum, aaSum, bSum, bbSum, abSum;\n for (int x = 0; x <= 2 * windowRadius; ++x) {\n for (int y = 0; y <= 2 * windowRadius; ++y) {\n vec2 offset = vec2(float(x - windowRadius), float(y - windowRadius));\n float a = luminance(applyViewTransform(lookupOffset(imASampler, position, offset), viewTransform));\n float b = luminance(applyViewTransform(lookupOffset(imBSampler, position, offset), viewTransform));\n aSum += a; bSum += b;\n aaSum += a * a; bbSum += b * b;\n abSum += a * b;\n }\n }\n float aMean = aSum / n, bMean = bSum / n;\n float aVar = (aaSum - n * aMean * aMean) / (n + 1.);\n float bVar = (bbSum - n * bMean * bMean) / (n + 1.);\n float abCovar = (abSum - n * aMean * bMean) / (n + 1.);\n\n float numerator = (2. * aMean * bMean + c1) * (2. * abCovar + c2);\n float denominator = (aMean * aMean + bMean * bMean + c1) * (aVar + bVar + c2);\n float ssim = numerator / denominator;\n col = vec3(1. - ssim, 1. - ssim, 1. - ssim);\n } else {\n col = texture2D(imASampler, position).rgb;\n