text: !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.GlslCanvas=t()}(this,function(){"use strict";var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var t="undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{},n=function(e){var t=i.call(e);return"[object Function]"===t||"function"==typeof e&&"[object RegExp]"!==t||"undefined"!=typeof window&&(e===window.setTimeout||e===window.alert||e===window.confirm||e===window.prompt)},i=Object.prototype.toString;var r,o=(function(e,t){(t=e.exports=function(e){return e.replace(/^\s*|\s*$/g,"")}).left=function(e){return e.replace(/^\s*/,"")},t.right=function(e){return e.replace(/\s*$/,"")}}(r={exports:{}},r.exports),r.exports),a=function(e,t,i){if(!n(t))throw new TypeError("iterator must be a function");arguments.length<3&&(i=this);"[object Array]"===s.call(e)?function(e,t,n){for(var i=0,r=e.length;i<r;i++)l.call(e,i)&&t.call(n,e[i],i,e)}(e,t,i):"string"==typeof e?function(e,t,n){for(var i=0,r=e.length;i<r;i++)t.call(n,e.charAt(i),i,e)}(e,t,i):function(e,t,n){for(var i in e)l.call(e,i)&&t.call(n,e[i],i,e)}(e,t,i)},s=Object.prototype.toString,l=Object.prototype.hasOwnProperty;var u=function(e){if(!e)return{};var t={};return a(o(e).split("\n"),function(e){var n,i=e.indexOf(":"),r=o(e.slice(0,i)).toLowerCase(),a=o(e.slice(i+1));void 0===t[r]?t[r]=a:(n=t[r],"[object Array]"===Object.prototype.toString.call(n)?t[r].push(a):t[r]=[t[r],a])}),t},d=function(){for(var e={},t=0;t<arguments.length;t++){var n=arguments[t];for(var i in n)c.call(n,i)&&(e[i]=n[i])}return e},c=Object.prototype.hasOwnProperty;var f=_,h=_;function p(e,t,i){var r=e;return n(t)?(i=t,"string"==typeof e&&(r={uri:e})):r=d(t,{uri:e}),r.callback=i,r}function _(e,t,n){return m(t=p(e,t,n))}function m(e){if(void 0===e.callback)throw new Error("callback argument missing");var t=!1,n=function(n,i,r){t||(t=!0,e.callback(n,i,r))};function i(e){return clearTimeout(l),e instanceof Error||(e=new Error(""+(e||"Unknown XMLHttpRequest Error"))),e.statusCode=0,n(e,g)}function r(){if(!a){var t;clearTimeout(l),t=e.useXDR&&void 0===s.status?200:1223===s.status?204:s.status;var i=g,r=null;return 0!==t?(i={body:function(){var e=void 0;if(e=s.response?s.response:s.responseText||function(e){try{if("document"===e.responseType)return e.responseXML;var t=e.responseXML&&"parsererror"===e.responseXML.documentElement.nodeName;if(""===e.responseType&&!t)return e.responseXML}catch(e){}return null}(s),m)try{e=JSON.parse(e)}catch(e){}return e}(),statusCode:t,method:c,headers:{},url:d,rawRequest:s},s.getAllResponseHeaders&&(i.headers=u(s.getAllResponseHeaders()))):r=new Error("Internal XMLHttpRequest Error"),n(r,i,i.body)}}var o,a,s=e.xhr||null;s||(s=e.cors||e.useXDR?new _.XDomainRequest:new _.XMLHttpRequest);var l,d=s.url=e.uri||e.url,c=s.method=e.method||"GET",f=e.body||e.data,h=s.headers=e.headers||{},p=!!e.sync,m=!1,g={body:void 0,headers:{},statusCode:0,method:c,url:d,rawRequest:s};if("json"in e&&!1!==e.json&&(m=!0,h.accept||h.Accept||(h.Accept="application/json"),"GET"!==c&&"HEAD"!==c&&(h["content-type"]||h["Content-Type"]||(h["Content-Type"]="application/json"),f=JSON.stringify(!0===e.json?f:e.json))),s.onreadystatechange=function(){4===s.readyState&&setTimeout(r,0)},s.onload=r,s.onerror=i,s.onprogress=function(){},s.onabort=function(){a=!0},s.ontimeout=i,s.open(c,d,!p,e.username,e.password),p||(s.withCredentials=!!e.withCredentials),!p&&e.timeout>0&&(l=setTimeout(function(){if(!a){a=!0,s.abort("timeout");var e=new Error("XMLHttpRequest timeout");e.code="ETIMEDOUT",i(e)}},e.timeout)),s.setRequestHeader)for(o in h)h.hasOwnProperty(o)&&s.setRequestHeader(o,h[o]);else if(e.headers&&!function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}(e.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in e&&(s.responseType=e.responseType),"beforeSend"in e&&"function"==typeof e.beforeSend&&e.beforeSend(s),s.send(f||null),s}_.XMLHttpRequest=t.XMLHttpRequest||function(){},_.XDomainRequest="withCredentials"in new _.XMLHttpRequest?_.XMLHttpRequest:t.XDomainRequest,function(e,t){for(var n=0;n<e.length;n++)t(e[n])}(["get","put","post","patch","head","delete"],function(e){_["delete"===e?"del":e]=function(t,n,i){return(n=p(t,n,i)).method=e.toUpperCase(),m(n)}}),f.default=h;var g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},v=(function(){function e(e){this.value=e}function t(t){var n,i;function r(n,i){try{var a=t[n](i),s=a.value;s instanceof e?Promise.resolve(s.value).then(function(e){r("next",e)},function(e){r("throw",e)}):o(a.done?"return":"normal",a.value)}catch(e){o("throw",e)}}function o(e,t){switch(e){case"return":n.resolve({value:t,done:!0});break;case"throw":n.reject(t);break;default:n.resolve({value:t,done:!1})}(n=n.next)?r(n.key,n.arg):i=null}this._invoke=function(e,t){return new Promise(function(o,a){var s={key:e,arg:t,resolve:o,reject:a,next:null};i?i=i.next=s:(n=i=s,r(e,t))})},"function"!=typeof t.return&&(this.return=void 0)}"function"==typeof Symbol&&Symbol.asyncIterator&&(t.prototype[Symbol.asyncIterator]=function(){return this}),t.prototype.next=function(e){return this._invoke("next",e)},t.prototype.throw=function(e){return this._invoke("throw",e)},t.prototype.return=function(e){return this._invoke("return",e)}}(),function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}),b=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),y=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)},E="";var x='\n\tThis page requires a browser that supports WebGL.<br/>\n\t<a href="http://get.webgl.org">Click here to upgrade your browser.</a>\n',w='\n\tIt does not appear your computer can support WebGL.<br/>\n\t<a href="http://get.webgl.org/troubleshooting/">Click here for more information.</a>\n',T=1,A=2;function S(e,t,n){function i(t,i){var r,o;"function"==typeof n?n(t):(r=i,(o=e.parentNode)&&(o.innerHTML='\n<table style="background-color: #8CE; width: 100%; height: 100%;"><tr>\n<td align="center">\n<div style="display: table-cell; vertical-align: middle;">\n<div style="">'+r+"</div>\n</div>\n</td></tr></table>\n"))}if(!window.WebGLRenderingContext)return i(T,x),null;var r=function(e,t){for(var n=["webgl","experimental-webgl"],i=null,r=0;r<n.length;++r)try{i=e.getContext(n[r],t)}catch(e){if(i)break}return i}(e,t);return r?r.getExtension("OES_standard_derivatives"):i(A,w),r}function R(e,t,n,i){var r=e.gl,o=r.createShader(n);return r.shaderSource(o,t),r.compileShader(o),r.getShaderParameter(o,r.COMPILE_STATUS)?o:(E=r.getShaderInfoLog(o),console.error("*** Error compiling shader "+o+":"+E),e.trigger("error",{shader:o,source:t,type:n,error:E,offset:i||0}),r.deleteShader(o),null)}function C(e,t,n,i){for(var r=e.gl,o=r.createProgram(),a=0;a<t.length;++a)r.attachShader(o,t[a]);if(n)for(var s=0;s<n.length;++s)r.bindAttribLocation(o,i?i[s]:s,n[s]);return r.linkProgram(o),r.getProgramParameter(o,r.LINK_STATUS)?o:(E=r.getProgramInfoLog(o),console.log("Error in program linking:"+E),r.deleteProgram(o),null)}function k(e){return 0==(e&e-1)}function O(e){var t=new Set;return Object.assign(e,{on:function(e,n){var i={};i[e]=n,t.add(i)},off:function(e,n){if(n){var i={};i[e]=n,t.delete(i)}else{var r=!0,o=!1,a=void 0;try{for(var s,l=t[Symbol.iterator]();!(r=(s=l.next()).done);r=!0){var u=s.value,d=!0,c=!1,f=void 0;try{for(var h,p=Object.keys(u)[Symbol.iterator]();!(d=(h=p.next()).done);d=!0){if(h.value===e)return void t.delete(u)}}catch(e){c=!0,f=e}finally{try{!d&&p.return&&p.return()}finally{if(c)throw f}}}}catch(e){o=!0,a=e}finally{try{!r&&l.return&&l.return()}finally{if(o)throw a}}}},listSubscriptions:function(){var e=!0,n=!1,i=void 0;try{for(var r,o=t[Symbol.iterator]();!(e=(r=o.next()).done);e=!0){var a=r.value;console.log(a)}}catch(e){n=!0,i=e}finally{try{!e&&o.return&&o.return()}finally{if(n)throw i}}},subscribe:function(e){t.add(e)},unsubscribe:function(e){t.delete(e)},unsubscribeAll:function(){t.clear()},trigger:function(e){for(var n=arguments.length,i=Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];var o=!0,a=!1,s=void 0;try{for(var l,u=t[Symbol.iterator]();!(o=(l=u.next()).done);o=!0){var d=l.value;"function"==typeof d[e]&&d[e].apply(d,y(i))}}catch(e){a=!0,s=e}finally{try{!o&&u.return&&u.return()}finally{if(a)throw s}}}})}var L=function(){function e(t,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};v(this,e),O(this),this.gl=t,this.texture=t.createTexture(),this.texture&&(this.valid=!0),this.bind(),this.name=n,this.source=null,this.sourceType=null,this.loading=null,this.setData(1,1,new Uint8Array([0,0,0,255]),{filtering:"linear"}),this.setFiltering(i.filtering),this.load(i)}return b(e,[{key:"destroy",value:function(){this.valid&&(this.gl.deleteTexture(this.texture),this.texture=null,delete this.data,this.data=null,this.valid=!1)}},{key:"bind",value:function(t){this.valid&&("number"==typeof t&&e.activeUnit!==t&&(this.gl.activeTexture(this.gl.TEXTURE0+t),e.activeUnit=t),e.activeTexture!==this.texture&&(this.gl.bindTexture(this.gl.TEXTURE_2D,this.texture),e.activeTexture=this.texture))}},{key:"load",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.loading=null,"string"==typeof e.url?void 0!==this.url&&e.url===this.url||this.setUrl(e.url,e):e.element?this.setElement(e.element,e):e.data&&e.width&&e.height&&this.setData(e.width,e.height,e.data,e)}},{key:"setUrl",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.valid)return this.url=e,this.source=this.url,this.sourceType="url",this.loading=new Promise(function(i,r){var o=e.split(".").pop().toLowerCase(),a="ogv"===o||"webm"===o||"mp4"===o,s=void 0;a?((s=document.createElement("video")).autoplay=!0,n.filtering="nearest"):s=new Image,s.onload=function(){try{t.setElement(s,n)}catch(e){console.log("Texture '"+t.name+"': failed to load url: '"+t.source+"'",e,n)}i(t)},s.onerror=function(e){console.log("Texture '"+t.name+"': failed to load url: '"+t.source+"'",e,n),i(t)},/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&"data:"===t.source.slice(0,5)||(s.crossOrigin="anonymous"),s.src=t.source,a&&t.setElement(s,n)}),this.loading}},{key:"setData",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.width=e,this.height=t,this.source=n,this.sourceType="data",this.update(i),this.setFiltering(i),this.loading=Promise.resolve(this),this.loading}},{key:"setElement",value:function(e,t){var n=this,i=e;if("string"==typeof e&&(e=document.querySelector(e)),e instanceof HTMLCanvasElement||e instanceof HTMLImageElement||e instanceof HTMLVideoElement)this.source=e,this.sourceType="element",e instanceof HTMLVideoElement?(e.addEventListener("canplaythrough",function(){n.intervalID=setInterval(function(){n.update(t)},15)},!0),e.addEventListener("ended",function(){e.currentTime=0,e.play()},!0)):this.update(t),this.setFiltering(t);else{var r="the 'element' parameter (`element: "+JSON.stringify(i)+"`) must be a CSS ";r+="selector string, or a <canvas>, <image> or <video> object",console.log("Texture '"+this.name+"': "+r,t)}return this.loading=Promise.resolve(this),this.loading}},{key:"update",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.valid&&(this.bind(),this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1!==e.UNPACK_FLIP_Y_WEBGL),this.gl.pixelStorei(this.gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.UNPACK_PREMULTIPLY_ALPHA_WEBGL||!1),"element"===this.sourceType&&(this.source instanceof HTMLCanvasElement||this.source instanceof HTMLVideoElement||this.source instanceof HTMLImageElement&&this.source.complete)?(this.source instanceof HTMLVideoElement?(this.width=this.source.videoWidth,this.height=this.source.videoHeight):(this.width=this.source.width,this.height=this.source.height),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,this.source)):"data"===this.sourceType&&this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.width,this.height,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,this.source),this.trigger("loaded",this))}},{key:"setFiltering",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.valid){this.powerOf2=k(this.width)&&k(this.height);var t=this.powerOf2?"mipmap":"linear";this.filtering=e.filtering||t;var n=this.gl;this.bind(),this.powerOf2?(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,e.TEXTURE_WRAP_S||e.repeat&&n.REPEAT||n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,e.TEXTURE_WRAP_T||e.repeat&&n.REPEAT||n.CLAMP_TO_EDGE),"mipmap"===this.filtering?(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR_MIPMAP_LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.generateMipmap(n.TEXTURE_2D)):"linear"===this.filtering?(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR)):"nearest"===this.filtering&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.NEAREST))):(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),"mipmap"===this.filtering&&(this.filtering="linear"),"nearest"===this.filtering?(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.NEAREST)):(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR)))}}}]),e}();L.getMaxTextureSize=function(e){return e.getParameter(e.MAX_TEXTURE_SIZE)},L.activeUnit=-1;var P=function(){function e(t,n,i){var r=this;v(this,e),O(this),n=n||{},i=i||{},this.width=t.clientWidth,this.height=t.clientHeight,this.canvas=t,this.gl=void 0,this.program=void 0,this.textures={},this.buffers={},this.uniforms={},this.vbo={},this.isValid=!1,this.BUFFER_COUNT=0,this.vertexString=n.vertexString||"\n#ifdef GL_ES\nprecision mediump float;\n#endif\n\nattribute vec2 a_position;\nattribute vec2 a_texcoord;\n\nvarying vec2 v_texcoord;\n\nvoid main() {\n    gl_Position = vec4(a_position, 0.0, 1.0);\n    v_texcoord = a_texcoord;\n}\n",this.fragmentString=n.fragmentString||"\n#ifdef GL_ES\nprecision mediump float;\n#endif\n\nvarying vec2 v_texcoord;\n\nvoid main(){\n    gl_FragColor = vec4(0.0);\n}\n";var o=S(t,n,i.onError);if(o){if(this.gl=o,this.timeLoad=this.timePrev=performance.now(),this.timeDelta=0,this.forceRender=!0,this.paused=!1,this.realToCSSPixels=window.devicePixelRatio||1,t.style.backgroundColor=n.backgroundColor||"rgba(1,1,1,0)",t.hasAttribute("data-fragment"))this.fragmentString=t.getAttribute("data-fragment");else if(t.hasAttribute("data-fragment-url")){var a=t.getAttribute("data-fragment-url");f.get(a,function(e,t,n){r.load(n,r.vertexString)})}if(t.hasAttribute("data-vertex"))this.vertexString=t.getAttribute("data-vertex");else if(t.hasAttribute("data-vertex-url")){var s=t.getAttribute("data-vertex-url");f.get(s,function(e,t,n){r.load(r.fragmentString,n)})}if(this.load(),this.program){var l=o.getAttribLocation(this.program,"a_texcoord");this.vbo.texCoords=o.createBuffer(),this.gl.bindBuffer(o.ARRAY_BUFFER,this.vbo.texCoords),this.gl.bufferData(o.ARRAY_BUFFER,new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]),o.STATIC_DRAW),this.gl.enableVertexAttribArray(l),this.gl.vertexAttribPointer(l,2,o.FLOAT,!1,0,0);var u=o.getAttribLocation(this.program,"a_position");if(this.vbo.vertices=o.createBuffer(),this.gl.bindBuffer(o.ARRAY_BUFFER,this.vbo.vertices),this.gl.bufferData(o.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]),o.STATIC_DRAW),this.gl.enableVertexAttribArray(u),this.gl.vertexAttribPointer(u,2,o.FLOAT,!1,0,0),t.hasAttribute("data-textures")){var d=t.getAttribute("data-textures").split(",");for(var c in d)this.setUniform("u_tex"+c,d[c])}var h={x:0,y:0};document.addEventListener("mousemove",function(e){h.x=e.clientX||e.pageX,h.y=e.clientY||e.pageY},!1);var p=this;return this.setMouse({x:0,y:0}),function e(){p.nMouse>1&&p.setMouse(h),p.forceRender=p.resize(),p.render(),window.requestAnimationFrame(e)}(),this}}}return b(e,[{key:"destroy",value:function(){for(var e in this.animated=!1,this.isValid=!1,this.textures)e.destroy&&e.destroy();for(var t in this.textures={},this.attribs)this.gl.deleteBuffer(this.attribs[t]);for(var n in this.gl.useProgram(null),this.gl.deleteProgram(this.program),this.buffers){var i=this.buffers[n];this.gl.deleteProgram(i.program)}this.program=null,this.gl=null}},{key:"load",value:function(e,t){if(t&&(this.vertexString=t),e&&(this.fragmentString=e),this.animated=!1,this.nDelta=(this.fragmentString.match(/u_delta/g)||[]).length,this.nTime=(this.fragmentString.match(/u_time/g)||[]).length,this.nDate=(this.fragmentString.match(/u_date/g)||[]).length,this.nMouse=(this.fragmentString.match(/u_mouse/g)||[]).length,this.animated=this.nDate>1||this.nTime>1||this.nMouse>1,this.fragmentString.search(/sampler2D/g))for(var n=this.fragmentString.split("\n"),i=0;i<n.length;i++){var r=n[i].match(/uniform\s*sampler2D\s*([\w]*);\s*\/\/\s*([\w|\:\/\/|\.|\-|\_]*)/i);if(r){var o=r[2].split(".").pop().toLowerCase();r[1]&&r[2]&&("jpg"===o||"jpeg"===o||"png"===o||"ogv"===o||"webm"===o||"mp4"===o)&&this.setUniform(r[1],r[2])}if(n[i].match(/\s*void\s*main\s*/g))break}var a=R(this,this.vertexString,this.gl.VERTEX_SHADER),s=R(this,this.fragmentString,this.gl.FRAGMENT_SHADER);s?this.isValid=!0:(s=R(this,"void main(){\n\tgl_FragColor = vec4(1.0);\n}",this.gl.FRAGMENT_SHADER),this.isValid=!1);var l=C(this,[a,s]);this.gl.useProgram(l),this.gl.deleteShader(a),this.gl.deleteShader(s),this.program=l,this.change=!0,this.BUFFER_COUNT=0;var u=this.getBuffers(this.fragmentString);Object.keys(u).length&&this.loadPrograms(u),this.buffers=u,this.texureIndex=this.BUFFER_COUNT,this.trigger("load",{}),this.forceRender=!0}},{key:"test",value:function(e,t,n){var i=this.vertexString,r=this.fragmentString,o=this.paused,a=this.gl.getExtension("EXT_disjoint_timer_query"),s=a.createQueryEXT(),l=this.isValid;(t||n)&&(this.load(t,n),l=this.isValid,this.forceRender=!0,this.render()),this.paused=!0,a.beginQueryEXT(a.TIME_ELAPSED_EXT,s),this.forceRender=!0,this.render(),a.endQueryEXT(a.TIME_ELAPSED_EXT);var u=this;!function d(){u.forceRender=!0,u.render();var c=a.getQueryObjectEXT(s,a.QUERY_RESULT_AVAILABLE_EXT),f=u.gl.getParameter(a.GPU_DISJOINT_EXT);if(c&&!f){var h={wasValid:l,frag:t||u.fragmentString,vert:n||u.vertexString,timeElapsedMs:a.getQueryObjectEXT(s,a.QUERY_RESULT_EXT)/1e6};u.paused=o,(t||n)&&u.load(r,i),e(h)}else window.requestAnimationFrame(d)}()}},{key:"loadTexture",value:function(e,t,n){var i=this;n||(n={}),"string"==typeof t?n.url=t:"object"===(void 0===t?"undefined":g(t))&&t.data&&t.width&&t.height?(n.data=t.data,n.width=t.width,n.height=t.height):"object"===(void 0===t?"undefined":g(t))&&(n.element=t),this.textures[e]?this.textures[e]&&(this.textures[e].load(n),this.textures[e].on("loaded",function(e){i.forceRender=!0})):(this.textures[e]=new L(this.gl,e,n),this.textures[e].on("loaded",function(e){i.forceRender=!0}))}},{key:"refreshUniforms",value:function(){this.uniforms={}}},{key:"setUniform",value:function(e){for(var t={},n=arguments.length,i=Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];t[e]=i,this.setUniforms(t)}},{key:"setUniforms",value:function(e){var t=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=[];for(var r in t){var o=t[r],a=void 0;if(n&&(r=n+"."+r),"number"==typeof o)i.push({type:"float",method:"1f",name:r,value:o});else if(Array.isArray(o)){if("number"==typeof o[0])1===o.length?i.push({type:"float",method:"1f",name:r,value:o}):o.length>=2&&o.length<=4?i.push({type:"vec"+o.length,method:o.length+"fv",name:r,value:o}):o.length>4&&i.push({type:"float[]",method:"1fv",name:r+"[0]",value:o});else if("string"==typeof o[0])i.push({type:"sampler2D",method:"1i",name:r,value:o});else if(Array.isArray(o[0])&&"number"==typeof o[0][0]){if(o[0].length>=2&&o[0].length<=4)for(a=0;a<o.length;a++)i.push({type:"vec"+o[0].length,method:o[a].length+"fv",name:r+"["+a+"]",value:o[a]})}else if("object"===g(o[0]))for(a=0;a<o.length;a++)i.push.apply(i,y(e(o[a],r+"["+a+"]")))}else"boolean"==typeof o?i.push({type:"bool",method:"1i",name:r,value:o}):"string"==typeof o?i.push({type:"sampler2D",method:"1i",name:r,value:o}):"object"===(void 0===o?"undefined":g(o))&&i.push.apply(i,y(e(o,r)))}return i}(e);for(var n in t)"sampler2D"===t[n].type?this.loadTexture(t[n].name,t[n].value[0]):this.uniform(t[n].method,t[n].type,t[n].name,t[n].value);this.forceRender=!0}},{key:"setMouse",value:function(e){var t=this.canvas.getBoundingClientRect();if(e&&e.x&&e.x>=t.left&&e.x<=t.right&&e.y&&e.y>=t.top&&e.y<=t.bottom){var n=(e.x-t.left)*this.realToCSSPixels,i=this.canvas.height-(e.y-t.top)*this.realToCSSPixels;this.uniform("2f","vec2","u_mouse",n,i)}}},{key:"uniform",value:function(e,t,n){this.uniforms[n]=this.uniforms[n]||{};for(var i=this.uniforms[n],r=arguments.length,o=Array(r>3?r-3:0),a=3;a<r;a++)o[a-3]=arguments[a];var s,l;if((s=i.value,l=o,!(!s||!l)&&s.toString()!==l.toString())||this.change||!i.location||!i.value)for(var u in i.name=n,i.type=t,i.value=o,i.method="uniform"+e,this.gl.useProgram(this.program),i.location=this.gl.getUniformLocation(this.program,n),this.gl[i.method].apply(this.gl,[i.location].concat(i.value)),this.buffers){var d=this.buffers[u];this.gl.useProgram(d.program);var c=this.gl.getUniformLocation(d.program,n);this.gl[i.method].apply(this.gl,[c].concat(i.value))}}},{key:"uniformTexture",value:function(e,t,n){if(void 0===this.textures[e])this.loadTexture(e,t,n);else{for(var i in this.uniform("1i","sampler2D",e,this.texureIndex),this.buffers){var r=this.buffers[i];this.gl.useProgram(r.program),this.gl.activeTexture(this.gl.TEXTURE0+this.texureIndex),this.gl.bindTexture(this.gl.TEXTURE_2D,this.textures[e].texture)}this.gl.useProgram(this.program),this.gl.activeTexture(this.gl.TEXTURE0+this.texureIndex),this.gl.bindTexture(this.gl.TEXTURE_2D,this.textures[e].texture),this.uniform("2f","vec2",e+"Resolution",this.textures[e].width,this.textures[e].height)}}},{key:"resize",value:function(){if(this.width!==this.canvas.clientWidth||this.height!==this.canvas.clientHeight){this.realToCSSPixels=window.devicePixelRatio||1;var e=Math.floor(this.gl.canvas.clientWidth*this.realToCSSPixels),t=Math.floor(this.gl.canvas.clientHeight*this.realToCSSPixels);return this.gl.canvas.width===e&&this.gl.canvas.height===t||(this.gl.canvas.width=e,this.gl.canvas.height=t,this.gl.viewport(0,0,this.gl.canvas.width,this.gl.canvas.height)),this.width=this.canvas.clientWidth,this.height=this.canvas.clientHeight,this.resizeSwappableBuffers(),!0}return!1}},{key:"render",value:function(){var e;if(this.visible=(e=this.canvas).getBoundingClientRect().top+e.height>0&&e.getBoundingClientRect().top<(window.innerHeight||document.documentElement.clientHeight),this.forceRender||this.animated&&this.visible&&!this.paused){var t=new Date,n=performance.now();for(var i in this.timeDelta=(n-this.timePrev)/1e3,this.timePrev=n,this.nDelta>1&&this.uniform("1f","float","u_delta",this.timeDelta),this.nTime>1&&this.uniform("1f","float","u_time",(n-this.timeLoad)/1e3),this.nDate&&this.uniform("4f","float","u_date",t.getFullYear(),t.getMonth(),t.getDate(),3600*t.getHours()+60*t.getMinutes()+t.getSeconds()+.001*t.getMilliseconds()),this.uniform("2f","vec2","u_resolution",this.canvas.width,this.canvas.height),this.buffers){var r=this.buffers[i];this.uniform("1i","sampler2D",r.name,r.bundle.input.index)}for(var o in this.texureIndex=this.BUFFER_COUNT,this.textures)this.uniformTexture(o),this.texureIndex++;this.renderPrograms(),this.trigger("render",{}),this.change=!1,this.forceRender=!1}}},{key:"pause",value:function(){this.paused=!0}},{key:"play",value:function(){this.paused=!1}},{key:"renderPrograms",value:function(){var e=this.gl,t=e.canvas.width,n=e.canvas.height;for(var i in e.viewport(0,0,t,n),this.buffers){var r=this.buffers[i];r.bundle.render(t,n,r.program,r.name),e.bindFramebuffer(e.FRAMEBUFFER,null)}e.useProgram(this.program),e.drawArrays(e.TRIANGLES,0,6)}},{key:"getBuffers",value:function(e){var t={};return e&&e.replace(/(?:^\s*)((?:#if|#elif)(?:\s*)(defined\s*\(\s*BUFFER_)(\d+)(?:\s*\))|(?:#ifdef)(?:\s*BUFFER_)(\d+)(?:\s*))/gm,function(){var n=arguments[3]||arguments[4];t["u_buffer"+n]={fragment:"#define BUFFER_"+n+"\n"+e}}),t}},{key:"loadPrograms",value:function(e){var t=this,n=this.gl,i=R(t,t.vertexString,n.VERTEX_SHADER);for(var r in e){var o=e[r],a=R(t,o.fragment,n.FRAGMENT_SHADER,1);a?t.isValid=!0:(a=R(t,"void main(){\n\tgl_FragColor = vec4(1.0);\n}",n.FRAGMENT_SHADER),t.isValid=!1);var s=C(t,[i,a]);o.name=r,o.program=s,o.bundle=t.createSwappableBuffer(t.canvas.width,t.canvas.height,s),n.deleteShader(a)}n.deleteShader(i)}},{key:"createSwappableBuffer",value:function(e,t,n){var i=this.createBuffer(e,t,n),r=this.createBuffer(e,t,n),o=this.gl;return{input:i,output:r,swap:function(){var e=i;i=r,r=e,this.input=i,this.output=r},render:function(e,t,n,i){o.useProgram(n),o.viewport(0,0,e,t),o.bindFramebuffer(o.FRAMEBUFFER,this.input.buffer),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,this.output.texture,0),o.drawArrays(o.TRIANGLES,0,6),this.swap()},resize:function(e,t,n,i){o.useProgram(n),o.viewport(0,0,e,t),this.input.resize(e,t),this.output.resize(e,t)}}}},{key:"createBuffer",value:function(e,t,n){var i=this.gl,r=this.BUFFER_COUNT;this.BUFFER_COUNT+=2,i.getExtension("OES_texture_float");var o=i.createTexture();i.activeTexture(i.TEXTURE0+r),i.bindTexture(i.TEXTURE_2D,o),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,e,t,0,i.RGBA,i.FLOAT,null),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.NEAREST),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE);var a=i.createFramebuffer();return{index:r,texture:o,buffer:a,W:e,H:t,resize:function(e,t){i.bindFramebuffer(i.FRAMEBUFFER,a);var n=Math.min(e,this.W),s=Math.min(t,this.H),l=new Float32Array(n*s*4);i.readPixels(0,0,n,s,i.RGBA,i.FLOAT,l),i.bindFramebuffer(i.FRAMEBUFFER,null);var u=r+1,d=i.createTexture();i.activeTexture(i.TEXTURE0+u),i.bindTexture(i.TEXTURE_2D,d),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,e,t,0,i.RGBA,i.FLOAT,null),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.NEAREST),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.texSubImage2D(i.TEXTURE_2D,0,0,0,n,s,i.RGBA,i.FLOAT,l);var c=i.createFramebuffer();i.bindFramebuffer(i.FRAMEBUFFER,null),i.deleteTexture(o),i.activeTexture(i.TEXTURE0+r),i.bindTexture(i.TEXTURE_2D,d),r=this.index=r,o=this.texture=d,a=this.buffer=c,this.W=e,this.H=t}}}},{key:"resizeSwappableBuffers",value:function(){var e=this.gl,t=e.canvas.width,n=e.canvas.height;for(var i in e.viewport(0,0,t,n),this.buffers){var r=this.buffers[i];r.bundle.resize(t,n,r.program,r.name)}e.useProgram(this.program)}},{key:"version",value:function(){return"0.1.4"}}]),e}();return window.addEventListener("load",function(){!function(){var e=document.getElementsByClassName("glslCanvas");if(e.length>0){window.glslCanvases=[];for(var t=0;t<e.length;t++){var n=new P(e[t]);n.isValid&&window.glslCanvases.push(n)}}}()}),P}),function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.Stats=t()}(this,function(){var e=function(){function t(e){return r.appendChild(e.dom),e}function n(e){for(var t=0;t<r.children.length;t++)r.children[t].style.display=t===e?"block":"none";i=e}var i=0,r=document.createElement("div");r.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",r.addEventListener("click",function(e){e.preventDefault(),n(++i%r.children.length)},!1);var o=(performance||Date).now(),a=o,s=0,l=t(new e.Panel("FPS","#0ff","#002")),u=t(new e.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var d=t(new e.Panel("MB","#f08","#201"));return n(0),{REVISION:16,dom:r,addPanel:t,showPanel:n,begin:function(){o=(performance||Date).now()},end:function(){s++;var e=(performance||Date).now();if(u.update(e-o,200),e>a+1e3&&(l.update(1e3*s/(e-a),100),a=e,s=0,d)){var t=performance.memory;d.update(t.usedJSHeapSize/1048576,t.jsHeapSizeLimit/1048576)}return e},update:function(){o=this.end()},domElement:r,setMode:n}};return e.Panel=function(e,t,n){var i=1/0,r=0,o=Math.round,a=o(window.devicePixelRatio||1),s=80*a,l=48*a,u=3*a,d=2*a,c=3*a,f=15*a,h=74*a,p=30*a,_=document.createElement("canvas");_.width=s,_.height=l,_.style.cssText="width:80px;height:48px";var m=_.getContext("2d");return m.font="bold "+9*a+"px Helvetica,Arial,sans-serif",m.textBaseline="top",m.fillStyle=n,m.fillRect(0,0,s,l),m.fillStyle=t,m.fillText(e,u,d),m.fillRect(c,f,h,p),m.fillStyle=n,m.globalAlpha=.9,m.fillRect(c,f,h,p),{dom:_,update:function(l,g){i=Math.min(i,l),r=Math.max(r,l),m.fillStyle=n,m.globalAlpha=1,m.fillRect(0,0,s,f),m.fillStyle=t,m.fillText(o(l)+" "+e+" ("+o(i)+"-"+o(r)+")",u,d),m.drawImage(_,c+a,f,h-a,p,c,f,h-a,p),m.fillRect(c+h-a,f,a,p),m.fillStyle=n,m.globalAlpha=.9,m.fillRect(c+h-a,f,a,o((1-l/g)*p))}}},e}),function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.dat=t():e.dat=t()}(this,function(){return function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={exports:{},id:i,loaded:!1};return e[i].call(r.exports,r,r.exports,n),r.loaded=!0,r.exports}return n.m=e,n.c=t,n.p="",n(0)}([function(e,t,n){"use strict";t.__esModule=!0;var i,r=n(1),o=(i=r)&&i.__esModule?i:{default:i};t.default=o.default,e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0;var i=g(n(2)),r=g(n(6)),o=g(n(3)),a=g(n(7)),s=g(n(8)),l=g(n(10)),u=g(n(11)),d=g(n(12)),c=g(n(13)),f=g(n(14)),h=g(n(15)),p=g(n(16)),_=g(n(9)),m=g(n(17));function g(e){return e&&e.__esModule?e:{default:e}}t.default={color:{Color:i.default,math:r.default,interpret:o.default},controllers:{Controller:a.default,BooleanController:s.default,OptionController:l.default,StringController:u.default,NumberController:d.default,NumberControllerBox:c.default,NumberControllerSlider:f.default,FunctionController:h.default,ColorController:p.default},dom:{dom:_.default},gui:{GUI:m.default},GUI:m.default},e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0;var i=s(n(3)),r=s(n(6)),o=s(n(4)),a=s(n(5));function s(e){return e&&e.__esModule?e:{default:e}}var l=function(){function e(){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.__state=i.default.apply(this,arguments),!1===this.__state)throw new Error("Failed to interpret color arguments");this.__state.a=this.__state.a||1}return e.prototype.toString=function(){return(0,o.default)(this)},e.prototype.toHexString=function(){return(0,o.default)(this,!0)},e.prototype.toOriginal=function(){return this.__state.conversion.write(this)},e}();function u(e,t,n){Object.defineProperty(e,t,{get:function(){return"RGB"===this.__state.space?this.__state[t]:(l.recalculateRGB(this,t,n),this.__state[t])},set:function(e){"RGB"!==this.__state.space&&(l.recalculateRGB(this,t,n),this.__state.space="RGB"),this.__state[t]=e}})}function d(e,t){Object.defineProperty(e,t,{get:function(){return"HSV"===this.__state.space?this.__state[t]:(l.recalculateHSV(this),this.__state[t])},set:function(e){"HSV"!==this.__state.space&&(l.recalculateHSV(this),this.__state.space="HSV"),this.__state[t]=e}})}l.recalculateRGB=function(e,t,n){if("HEX"===e.__state.space)e.__state[t]=r.default.component_from_hex(e.__state.hex,n);else{if("HSV"!==e.__state.space)throw new Error("Corrupted color state");a.default.extend(e.__state,r.default.hsv_to_rgb(e.__state.h,e.__state.s,e.__state.v))}},l.recalculateHSV=function(e){var t=r.default.rgb_to_hsv(e.r,e.g,e.b);a.default.extend(e.__state,{s:t.s,v:t.v}),a.default.isNaN(t.h)?a.default.isUndefined(e.__state.h)&&(e.__state.h=0):e.__state.h=t.h},l.COMPONENTS=["r","g","b","h","s","v","hex","a"],u(l.prototype,"r",2),u(l.prototype,"g",1),u(l.prototype,"b",0),d(l.prototype,"h"),d(l.prototype,"s"),d(l.prototype,"v"),Object.defineProperty(l.prototype,"a",{get:function(){return this.__state.a},set:function(e){this.__state.a=e}}),Object.defineProperty(l.prototype,"hex",{get:function(){return"HEX"!==!this.__state.space&&(this.__state.hex=r.default.rgb_to_hex(this.r,this.g,this.b)),this.__state.hex},set:function(e){this.__state.space="HEX",this.__state.hex=e}}),t.default=l,e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0;var i=o(n(4)),r=o(n(5));function o(e){return e&&e.__esModule?e:{default:e}}var a=[{litmus:r.default.isString,conversions:{THREE_CHAR_HEX:{read:function(e){var t=e.match(/^#([A-F0-9])([A-F0-9])([A-F0-9])$/i);return null!==t&&{space:"HEX",hex:parseInt("0x"+t[1].toString()+t[1].toString()+t[2].toString()+t[2].toString()+t[3].toString()+t[3].toString(),0)}},write:i.default},SIX_CHAR_HEX:{read:function(e){var t=e.match(/^#([A-F0-9]{6})$/i);return null!==t&&{space:"HEX",hex:parseInt("0x"+t[1].toString(),0)}},write:i.default},CSS_RGB:{read:function(e){var t=e.match(/^rgb\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/);return null!==t&&{space:"RGB",r:parseFloat(t[1]),g:parseFloat(t[2]),b:parseFloat(t[3])}},write:i.default},CSS_RGBA:{read:function(e){var t=e.match(/^rgba\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/);return null!==t&&{space:"RGB",r:parseFloat(t[1]),g:parseFloat(t[2]),b:parseFloat(t[3]),a:parseFloat(t[4])}},write:i.default}}},{litmus:r.default.isNumber,conversions:{HEX:{read:function(e){return{space:"HEX",hex:e,conversionName:"HEX"}},write:function(e){return e.hex}}}},{litmus:r.default.isArray,conversions:{RGB_ARRAY:{read:function(e){return 3===e.length&&{space:"RGB",r:e[0],g:e[1],b:e[2]}},write:function(e){return[e.r,e.g,e.b]}},RGBA_ARRAY:{read:function(e){return 4===e.length&&{space:"RGB",r:e[0],g:e[1],b:e[2],a:e[3]}},write:function(e){return[e.r,e.g,e.b,e.a]}}}},{litmus:r.default.isObject,conversions:{RGBA_OBJ:{read:function(e){return!!(r.default.isNumber(e.r)&&r.default.isNumber(e.g)&&r.default.isNumber(e.b)&&r.default.isNumber(e.a))&&{space:"RGB",r:e.r,g:e.g,b:e.b,a:e.a}},write:function(e){return{r:e.r,g:e.g,b:e.b,a:e.a}}},RGB_OBJ:{read:function(e){return!!(r.default.isNumber(e.r)&&r.default.isNumber(e.g)&&r.default.isNumber(e.b))&&{space:"RGB",r:e.r,g:e.g,b:e.b}},write:function(e){return{r:e.r,g:e.g,b:e.b}}},HSVA_OBJ:{read:function(e){return!!(r.default.isNumber(e.h)&&r.default.isNumber(e.s)&&r.default.isNumber(e.v)&&r.default.isNumber(e.a))&&{space:"HSV",h:e.h,s:e.s,v:e.v,a:e.a}},write:function(e){return{h:e.h,s:e.s,v:e.v,a:e.a}}},HSV_OBJ:{read:function(e){return!!(r.default.isNumber(e.h)&&r.default.isNumber(e.s)&&r.default.isNumber(e.v))&&{space:"HSV",h:e.h,s:e.s,v:e.v}},write:function(e){return{h:e.h,s:e.s,v:e.v}}}}}],s=void 0,l=void 0;t.default=function(){l=!1;var e=arguments.length>1?r.default.toArray(arguments):arguments[0];return r.default.each(a,function(t){if(t.litmus(e))return r.default.each(t.conversions,function(t,n){if(s=t.read(e),!1===l&&!1!==s)return l=s,s.conversionName=n,s.conversion=t,r.default.BREAK}),r.default.BREAK}),l},e.exports=t.default},function(e,t){"use strict";t.__esModule=!0,t.default=function(e,t){var n=e.__state.conversionName.toString(),i=Math.round(e.r),r=Math.round(e.g),o=Math.round(e.b),a=e.a,s=Math.round(e.h),l=e.s.toFixed(1),u=e.v.toFixed(1);if(t||"THREE_CHAR_HEX"===n||"SIX_CHAR_HEX"===n){for(var d=e.hex.toString(16);d.length<6;)d="0"+d;return"#"+d}return"CSS_RGB"===n?"rgb("+i+","+r+","+o+")":"CSS_RGBA"===n?"rgba("+i+","+r+","+o+","+a+")":"HEX"===n?"0x"+e.hex.toString(16):"RGB_ARRAY"===n?"["+i+","+r+","+o+"]":"RGBA_ARRAY"===n?"["+i+","+r+","+o+","+a+"]":"RGB_OBJ"===n?"{r:"+i+",g:"+r+",b:"+o+"}":"RGBA_OBJ"===n?"{r:"+i+",g:"+r+",b:"+o+",a:"+a+"}":"HSV_OBJ"===n?"{h:"+s+",s:"+l+",v:"+u+"}":"HSVA_OBJ"===n?"{h:"+s+",s:"+l+",v:"+u+",a:"+a+"}":"unknown format"},e.exports=t.default},function(e,t){"use strict";t.__esModule=!0;var n=Array.prototype.forEach,i=Array.prototype.slice,r={BREAK:{},extend:function(e){return this.each(i.call(arguments,1),function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(t[n])||(e[n]=t[n])}.bind(this))},this),e},defaults:function(e){return this.each(i.call(arguments,1),function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(n){this.isUndefined(e[n])&&(e[n]=t[n])}.bind(this))},this),e},compose:function(){var e=i.call(arguments);return function(){for(var t=i.call(arguments),n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},each:function(e,t,i){if(e)if(n&&e.forEach&&e.forEach===n)e.forEach(t,i);else if(e.length===e.length+0){var r,o=void 0;for(o=0,r=e.length;o<r;o++)if(o in e&&t.call(i,e[o],o)===this.BREAK)return}else for(var a in e)if(t.call(i,e[a],a)===this.BREAK)return},defer:function(e){setTimeout(e,0)},debounce:function(e,t,n){var i=void 0;return function(){var r=this,o=arguments;var a=n||!i;clearTimeout(i),i=setTimeout(function(){i=null,n||e.apply(r,o)},t),a&&e.apply(r,o)}},toArray:function(e){return e.toArray?e.toArray():i.call(e)},isUndefined:function(e){return void 0===e},isNull:function(e){return null===e},isNaN:function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(e){return isNaN(e)}),isArray:Array.isArray||function(e){return e.constructor===Array},isObject:function(e){return e===Object(e)},isNumber:function(e){return e===e+0},isString:function(e){return e===e+""},isBoolean:function(e){return!1===e||!0===e},isFunction:function(e){return"[object Function]"===Object.prototype.toString.call(e)}};t.default=r,e.exports=t.default},function(e,t){"use strict";t.__esModule=!0;var n=void 0,i={hsv_to_rgb:function(e,t,n){var i=Math.floor(e/60)%6,r=e/60-Math.floor(e/60),o=n*(1-t),a=n*(1-r*t),s=n*(1-(1-r)*t),l=[[n,s,o],[a,n,o],[o,n,s],[o,a,n],[s,o,n],[n,o,a]][i];return{r:255*l[0],g:255*l[1],b:255*l[2]}},rgb_to_hsv:function(e,t,n){var i=Math.min(e,t,n),r=Math.max(e,t,n),o=r-i,a=void 0;return 0===r?{h:NaN,s:0,v:0}:(a=e===r?(t-n)/o:t===r?2+(n-e)/o:4+(e-t)/o,(a/=6)<0&&(a+=1),{h:360*a,s:o/r,v:r/255})},rgb_to_hex:function(e,t,n){var i=this.hex_with_component(0,2,e);return i=this.hex_with_component(i,1,t),i=this.hex_with_component(i,0,n)},component_from_hex:function(e,t){return e>>8*t&255},hex_with_component:function(e,t,i){return i<<(n=8*t)|e&~(255<<n)}};t.default=i,e.exports=t.default},function(e,t){"use strict";t.__esModule=!0;var n=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.initialValue=t[n],this.domElement=document.createElement("div"),this.object=t,this.property=n,this.__onChange=void 0,this.__onFinishChange=void 0}return e.prototype.onChange=function(e){return this.__onChange=e,this},e.prototype.onFinishChange=function(e){return this.__onFinishChange=e,this},e.prototype.setValue=function(e){return this.object[this.property]=e,this.__onChange&&this.__onChange.call(this,e),this.updateDisplay(),this},e.prototype.getValue=function(){return this.object[this.property]},e.prototype.updateDisplay=function(){return this},e.prototype.isModified=function(){return this.initialValue!==this.getValue()},e}();t.default=n,e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0;var i=o(n(7)),r=o(n(9));function o(e){return e&&e.__esModule?e:{default:e}}var a=function(e){function t(n,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var o=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}(this,e.call(this,n,i)),a=o;return o.__prev=o.getValue(),o.__checkbox=document.createElement("input"),o.__checkbox.setAttribute("type","checkbox"),r.default.bind(o.__checkbox,"change",function(){a.setValue(!a.__prev)},!1),o.domElement.appendChild(o.__checkbox),o.updateDisplay(),o}return 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)}(t,e),t.prototype.setValue=function(t){var n=e.prototype.setValue.call(this,t);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),this.__prev=this.getValue(),n},t.prototype.updateDisplay=function(){return!0===this.getValue()?(this.__checkbox.setAttribute("checked","checked"),this.__checkbox.checked=!0,this.__prev=!0):(this.__checkbox.checked=!1,this.__prev=!1),e.prototype.updateDisplay.call(this)},t}(i.default);t.default=a,e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0;var i,r=n(5),o=(i=r)&&i.__esModule?i:{default:i};var a={};o.default.each({HTMLEvents:["change"],MouseEvents:["click","mousemove","mousedown","mouseup","mouseover"],KeyboardEvents:["keydown"]},function(e,t){o.default.each(e,function(e){a[e]=t})});var s=/(\d+(\.\d+)?)px/;function l(e){if("0"===e||o.default.isUndefined(e))return 0;var t=e.match(s);return o.default.isNull(t)?0:parseFloat(t[1])}var u={makeSelectable:function(e,t){void 0!==e&&void 0!==e.style&&(e.onselectstart=t?function(){return!1}:function(){},e.style.MozUserSelect=t?"auto":"none",e.style.KhtmlUserSelect=t?"auto":"none",e.unselectable=t?"on":"off")},makeFullscreen:function(e,t,n){var i=n,r=t;o.default.isUndefined(r)&&(r=!0),o.default.isUndefined(i)&&(i=!0),e.style.position="absolute",r&&(e.style.left=0,e.style.right=0),i&&(e.style.top=0,e.style.bottom=0)},fakeEvent:function(e,t,n,i){var r=n||{},s=a[t];if(!s)throw new Error("Event type "+t+" not supported.");var l=document.createEvent(s);switch(s){case"MouseEvents":var u=r.x||r.clientX||0,d=r.y||r.clientY||0;l.initMouseEvent(t,r.bubbles||!1,r.cancelable||!0,window,r.clickCount||1,0,0,u,d,!1,!1,!1,!1,0,null);break;case"KeyboardEvents":var c=l.initKeyboardEvent||l.initKeyEvent;o.default.defaults(r,{cancelable:!0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,keyCode:void 0,charCode:void 0}),c(t,r.bubbles||!1,r.cancelable,window,r.ctrlKey,r.altKey,r.shiftKey,r.metaKey,r.keyCode,r.charCode);break;default:l.initEvent(t,r.bubbles||!1,r.cancelable||!0)}o.default.defaults(l,i),e.dispatchEvent(l)},bind:function(e,t,n,i){var r=i||!1;return e.addEventListener?e.addEventListener(t,n,r):e.attachEvent&&e.attachEvent("on"+t,n),u},unbind:function(e,t,n,i){var r=i||!1;return e.removeEventListener?e.removeEventListener(t,n,r):e.detachEvent&&e.detachEvent("on"+t,n),u},addClass:function(e,t){if(void 0===e.className)e.className=t;else if(e.className!==t){var n=e.className.split(/ +/);-1===n.indexOf(t)&&(n.push(t),e.className=n.join(" ").replace(/^\s+/,"").replace(/\s+$/,""))}return u},removeClass:function(e,t){if(t)if(e.className===t)e.removeAttribute("class");else{var n=e.className.split(/ +/),i=n.indexOf(t);-1!==i&&(n.splice(i,1),e.className=n.join(" "))}else e.className=void 0;return u},hasClass:function(e,t){return new RegExp("(?:^|\\s+)"+t+"(?:\\s+|$)").test(e.className)||!1},getWidth:function(e){var t=getComputedStyle(e);return l(t["border-left-width"])+l(t["border-right-width"])+l(t["padding-left"])+l(t["padding-right"])+l(t.width)},getHeight:function(e){var t=getComputedStyle(e);return l(t["border-top-width"])+l(t["border-bottom-width"])+l(t["padding-top"])+l(t["padding-bottom"])+l(t.height)},getOffset:function(e){var t=e,n={left:0,top:0};if(t.offsetParent)do{n.left+=t.offsetLeft,n.top+=t.offsetTop,t=t.offsetParent}while(t);return n},isActive:function(e){return e===document.activeElement&&(e.type||e.href)}};t.default=u,e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0;var i=a(n(7)),r=a(n(9)),o=a(n(5));function a(e){return e&&e.__esModule?e:{default:e}}var s=function(e){function t(n,i,a){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var s=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}(this,e.call(this,n,i)),l=a,u=s;if(s.__select=document.createElement("select"),o.default.isArray(l)){var d={};o.default.each(l,function(e){d[e]=e}),l=d}return o.default.each(l,function(e,t){var n=document.createElement("option");n.innerHTML=t,n.setAttribute("value",e),u.__select.appendChild(n)}),s.updateDisplay(),r.default.bind(s.__select,"change",function(){var e=this.options[this.selectedIndex].value;u.setValue(e)}),s.domElement.appendChild(s.__select),s}return 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)}(t,e),t.prototype.setValue=function(t){var n=e.prototype.setValue.call(this,t);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),n},t.prototype.updateDisplay=function(){return r.default.isActive(this.__select)?this:(this.__select.value=this.getValue(),e.prototype.updateDisplay.call(this))},t}(i.default);t.default=s,e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0;var i=o(n(7)),r=o(n(9));function o(e){return e&&e.__esModule?e:{default:e}}var a=function(e){function t(n,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var o=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}(this,e.call(this,n,i)),a=o;function s(){a.setValue(a.__input.value)}return o.__input=document.createElement("input"),o.__input.setAttribute("type","text"),r.default.bind(o.__input,"keyup",s),r.default.bind(o.__input,"change",s),r.default.bind(o.__input,"blur",function(){a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}),r.default.bind(o.__input,"keydown",function(e){13===e.keyCode&&this.blur()}),o.updateDisplay(),o.domElement.appendChild(o.__input),o}return 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)}(t,e),t.prototype.updateDisplay=function(){return r.default.isActive(this.__input)||(this.__input.value=this.getValue()),e.prototype.updateDisplay.call(this)},t}(i.default);t.default=a,e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0;var i=o(n(7)),r=o(n(5));function o(e){return e&&e.__esModule?e:{default:e}}function a(e){var t=e.toString();return t.indexOf(".")>-1?t.length-t.indexOf(".")-1:0}var s=function(e){function t(n,i,o){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var s=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}(this,e.call(this,n,i)),l=o||{};return s.__min=l.min,s.__max=l.max,s.__step=l.step,r.default.isUndefined(s.__step)?0===s.initialValue?s.__impliedStep=1:s.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(s.initialValue))/Math.LN10))/10:s.__impliedStep=s.__step,s.__precision=a(s.__impliedStep),s}return 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)}(t,e),t.prototype.setValue=function(t){var n=t;return void 0!==this.__min&&n<this.__min?n=this.__min:void 0!==this.__max&&n>this.__max&&(n=this.__max),void 0!==this.__step&&n%this.__step!=0&&(n=Math.round(n/this.__step)*this.__step),e.prototype.setValue.call(this,n)},t.prototype.min=function(e){return this.__min=e,this},t.prototype.max=function(e){return this.__max=e,this},t.prototype.step=function(e){return this.__step=e,this.__impliedStep=e,this.__precision=a(e),this},t}(i.default);t.default=s,e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0;var i=a(n(12)),r=a(n(9)),o=a(n(5));function a(e){return e&&e.__esModule?e:{default:e}}var s=function(e){function t(n,i,a){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var s=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}(this,e.call(this,n,i,a));s.__truncationSuspended=!1;var l=s,u=void 0;function d(){l.__onFinishChange&&l.__onFinishChange.call(l,l.getValue())}function c(e){var t=u-e.clientY;l.setValue(l.getValue()+t*l.__impliedStep),u=e.clientY}function f(){r.default.unbind(window,"mousemove",c),r.default.unbind(window,"mouseup",f),d()}return s.__input=document.createElement("input"),s.__input.setAttribute("type","text"),r.default.bind(s.__input,"change",function(){var e=parseFloat(l.__input.value);o.default.isNaN(e)||l.setValue(e)}),r.default.bind(s.__input,"blur",function(){d()}),r.default.bind(s.__input,"mousedown",function(e){r.default.bind(window,"mousemove",c),r.default.bind(window,"mouseup",f),u=e.clientY}),r.default.bind(s.__input,"keydown",function(e){13===e.keyCode&&(l.__truncationSuspended=!0,this.blur(),l.__truncationSuspended=!1,d())}),s.updateDisplay(),s.domElement.appendChild(s.__input),s}return 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)}(t,e),t.prototype.updateDisplay=function(){var t,n,i;return this.__input.value=this.__truncationSuspended?this.getValue():(t=this.getValue(),n=this.__precision,i=Math.pow(10,n),Math.round(t*i)/i),e.prototype.updateDisplay.call(this)},t}(i.default);t.default=s,e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0;var i=o(n(12)),r=o(n(9));function o(e){return e&&e.__esModule?e:{default:e}}var a=function(e){function t(n,i,o,a,s){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var l=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}(this,e.call(this,n,i,{min:o,max:a,step:s})),u=l;function d(e){e.preventDefault();var t,n,i,r,o,a=u.__background.getBoundingClientRect();return u.setValue((t=e.clientX,n=a.left,i=a.right,r=u.__min,o=u.__max,r+(t-n)/(i-n)*(o-r))),!1}function c(){r.default.unbind(window,"mousemove",d),r.default.unbind(window,"mouseup",c),u.__onFinishChange&&u.__onFinishChange.call(u,u.getValue())}return l.__background=document.createElement("div"),l.__foreground=document.createElement("div"),r.default.bind(l.__background,"mousedown",function(e){document.activeElement.blur(),r.default.bind(window,"mousemove",d),r.default.bind(window,"mouseup",c),d(e)}),r.default.addClass(l.__background,"slider"),r.default.addClass(l.__foreground,"slider-fg"),l.updateDisplay(),l.__background.appendChild(l.__foreground),l.domElement.appendChild(l.__background),l}return 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)}(t,e),t.prototype.updateDisplay=function(){var t=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*t+"%",e.prototype.updateDisplay.call(this)},t}(i.default);t.default=a,e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0;var i=o(n(7)),r=o(n(9));function o(e){return e&&e.__esModule?e:{default:e}}var a=function(e){function t(n,i,o){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var a=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}(this,e.call(this,n,i)),s=a;return a.__button=document.createElement("div"),a.__button.innerHTML=void 0===o?"Fire":o,r.default.bind(a.__button,"click",function(e){return e.preventDefault(),s.fire(),!1}),r.default.addClass(a.__button,"button"),a.domElement.appendChild(a.__button),a}return 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)}(t,e),t.prototype.fire=function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())},t}(i.default);t.default=a,e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0;var i=l(n(7)),r=l(n(9)),o=l(n(2)),a=l(n(3)),s=l(n(5));function l(e){return e&&e.__esModule?e:{default:e}}var u=function(e){function t(n,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var l=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}(this,e.call(this,n,i));l.__color=new o.default(l.getValue()),l.__temp=new o.default(0);var u=l;l.domElement=document.createElement("div"),r.default.makeSelectable(l.domElement,!1),l.__selector=document.createElement("div"),l.__selector.className="selector",l.__saturation_field=document.createElement("div"),l.__saturation_field.className="saturation-field",l.__field_knob=document.createElement("div"),l.__field_knob.className="field-knob",l.__field_knob_border="2px solid ",l.__hue_knob=document.createElement("div"),l.__hue_knob.className="hue-knob",l.__hue_field=document.createElement("div"),l.__hue_field.className="hue-field",l.__input=document.createElement("input"),l.__input.type="text",l.__input_textShadow="0 1px 1px ",r.default.bind(l.__input,"keydown",function(e){13===e.keyCode&&_.call(this)}),r.default.bind(l.__input,"blur",_),r.default.bind(l.__selector,"mousedown",function(){r.default.addClass(this,"drag").bind(window,"mouseup",function(){r.default.removeClass(u.__selector,"drag")})});var d,f=document.createElement("div");function h(e){v(e),r.default.bind(window,"mousemove",v),r.default.bind(window,"mouseup",p)}function p(){r.default.unbind(window,"mousemove",v),r.default.unbind(window,"mouseup",p),g()}function _(){var e=(0,a.default)(this.value);!1!==e?(u.__color.__state=e,u.setValue(u.__color.toOriginal())):this.value=u.__color.toString()}function m(){r.default.unbind(window,"mousemove",b),r.default.unbind(window,"mouseup",m),g()}function g(){u.__onFinishChange&&u.__onFinishChange.call(u,u.__color.toOriginal())}function v(e){e.preventDefault();var t=u.__saturation_field.getBoundingClientRect(),n=(e.clientX-t.left)/(t.right-t.left),i=1-(e.clientY-t.top)/(t.bottom-t.top);return i>1?i=1:i<0&&(i=0),n>1?n=1:n<0&&(n=0),u.__color.v=i,u.__color.s=n,u.setValue(u.__color.toOriginal()),!1}function b(e){e.preventDefault();var t=u.__hue_field.getBoundingClientRect(),n=1-(e.clientY-t.top)/(t.bottom-t.top);return n>1?n=1:n<0&&(n=0),u.__color.h=360*n,u.setValue(u.__color.toOriginal()),!1}return s.default.extend(l.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),s.default.extend(l.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:l.__field_knob_border+(l.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),s.default.extend(l.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),s.default.extend(l.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),s.default.extend(f.style,{width:"100%",height:"100%",background:"none"}),c(f,"top","rgba(0,0,0,0)","#000"),s.default.extend(l.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),(d=l.__hue_field).style.background="",d.style.cssText+="background: -moz-linear-gradient(top,  #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",d.style.cssText+="background: -webkit-linear-gradient(top,  #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",d.style.cssText+="background: -o-linear-gradient(top,  #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",d.style.cssText+="background: -ms-linear-gradient(top,  #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",d.style.cssText+="background: linear-gradient(top,  #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",s.default.extend(l.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:l.__input_textShadow+"rgba(0,0,0,0.7)"}),r.default.bind(l.__saturation_field,"mousedown",h),r.default.bind(l.__field_knob,"mousedown",h),r.default.bind(l.__hue_field,"mousedown",function(e){b(e),r.default.bind(window,"mousemove",b),r.default.bind(window,"mouseup",m)}),l.__saturation_field.appendChild(f),l.__selector.appendChild(l.__field_knob),l.__selector.appendChild(l.__saturation_field),l.__selector.appendChild(l.__hue_field),l.__hue_field.appendChild(l.__hue_knob),l.domElement.appendChild(l.__input),l.domElement.appendChild(l.__selector),l.updateDisplay(),l}return 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)}(t,e),t.prototype.updateDisplay=function(){var e=(0,a.default)(this.getValue());if(!1!==e){var t=!1;s.default.each(o.default.COMPONENTS,function(n){if(!s.default.isUndefined(e[n])&&!s.default.isUndefined(this.__color.__state[n])&&e[n]!==this.__color.__state[n])return t=!0,{}},this),t&&s.default.extend(this.__color.__state,e)}s.default.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var n=this.__color.v<.5||this.__color.s>.5?255:0,i=255-n;s.default.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toHexString(),border:this.__field_knob_border+"rgb("+n+","+n+","+n+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,c(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),s.default.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+n+","+n+","+n+")",textShadow:this.__input_textShadow+"rgba("+i+","+i+","+i+",.7)"})},t}(i.default),d=["-moz-","-o-","-webkit-","-ms-",""];function c(e,t,n,i){e.style.background="",s.default.each(d,function(r){e.style.cssText+="background: "+r+"linear-gradient("+t+", "+n+" 0%, "+i+" 100%); "})}t.default=u,e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0;var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=v(n(18)),o=v(n(19)),a=v(n(20)),s=v(n(7)),l=v(n(8)),u=v(n(15)),d=v(n(13)),c=v(n(14)),f=v(n(16)),h=v(n(21)),p=v(n(22)),_=v(n(9)),m=v(n(5)),g=v(n(23));function v(e){return e&&e.__esModule?e:{default:e}}r.default.inject(g.default);var b="Default",y=function(){try{return"localStorage"in window&&null!==window.localStorage}catch(e){return!1}}(),E=void 0,x=!0,w=void 0,T=!1,A=[],S=function e(t){var n=this,i=t||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),_.default.addClass(this.domElement,"dg"),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],i=m.default.defaults(i,{closeOnTop:!1,autoPlace:!0,width:e.DEFAULT_WIDTH}),i=m.default.defaults(i,{resizable:i.autoPlace,hideable:i.autoPlace}),m.default.isUndefined(i.load)?i.load={preset:b}:i.preset&&(i.load.preset=i.preset),m.default.isUndefined(i.parent)&&i.hideable&&A.push(this),i.resizable=m.default.isUndefined(i.parent)&&i.resizable,i.autoPlace&&m.default.isUndefined(i.scrollable)&&(i.scrollable=!0);var r,o=y&&"true"===localStorage.getItem(L(this,"isLocal")),a=void 0;if(Object.defineProperties(this,{parent:{get:function(){return i.parent}},scrollable:{get:function(){return i.scrollable}},autoPlace:{get:function(){return i.autoPlace}},closeOnTop:{get:function(){return i.closeOnTop}},preset:{get:function(){return n.parent?n.getRoot().preset:i.load.preset},set:function(e){n.parent?n.getRoot().preset=e:i.load.preset=e,function(e){for(var t=0;t<e.__preset_select.length;t++)e.__preset_select[t].value===e.preset&&(e.__preset_select.selectedIndex=t)}(this),n.revert()}},width:{get:function(){return i.width},set:function(e){i.width=e,D(n,e)}},name:{get:function(){return i.name},set:function(e){i.name=e,titleRowName&&(titleRowName.innerHTML=i.name)}},closed:{get:function(){return i.closed},set:function(t){i.closed=t,i.closed?_.default.addClass(n.__ul,e.CLASS_CLOSED):_.default.removeClass(n.__ul,e.CLASS_CLOSED),this.onResize(),n.__closeButton&&(n.__closeButton.innerHTML=t?e.TEXT_OPEN:e.TEXT_CLOSED)}},load:{get:function(){return i.load}},useLocalStorage:{get:function(){return o},set:function(e){y&&(o=e,e?_.default.bind(window,"unload",a):_.default.unbind(window,"unload",a),localStorage.setItem(L(n,"isLocal"),e))}}}),m.default.isUndefined(i.parent)){if(i.closed=!1,_.default.addClass(this.domElement,e.CLASS_MAIN),_.default.makeSelectable(this.domElement,!1),y&&o){n.useLocalStorage=!0;var s=localStorage.getItem(L(this,"gui"));s&&(i.load=JSON.parse(s))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=e.TEXT_CLOSED,_.default.addClass(this.__closeButton,e.CLASS_CLOSE_BUTTON),i.closeOnTop?(_.default.addClass(this.__closeButton,e.CLASS_CLOSE_TOP),this.domElement.insertBefore(this.__closeButton,this.domElement.childNodes[0])):(_.default.addClass(this.__closeButton,e.CLASS_CLOSE_BOTTOM),this.domElement.appendChild(this.__closeButton)),_.default.bind(this.__closeButton,"click",function(){n.closed=!n.closed})}else{void 0===i.closed&&(i.closed=!0);var l=document.createTextNode(i.name);_.default.addClass(l,"controller-name");var u=R(n,l);_.default.addClass(this.__ul,e.CLASS_CLOSED),_.default.addClass(u,"title"),_.default.bind(u,"click",function(e){return e.preventDefault(),n.closed=!n.closed,!1}),i.closed||(this.closed=!1)}i.autoPlace&&(m.default.isUndefined(i.parent)&&(x&&(w=document.createElement("div"),_.default.addClass(w,"dg"),_.default.addClass(w,e.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(w),x=!1),w.appendChild(this.domElement),_.default.addClass(this.domElement,e.CLASS_AUTO_PLACE)),this.parent||D(n,i.width)),this.__resizeHandler=function(){n.onResizeDebounced()},_.default.bind(window,"resize",this.__resizeHandler),_.default.bind(this.__ul,"webkitTransitionEnd",this.__resizeHandler),_.default.bind(this.__ul,"transitionend",this.__resizeHandler),_.default.bind(this.__ul,"oTransitionEnd",this.__resizeHandler),this.onResize(),i.resizable&&function(e){var t=void 0;function n(n){return n.preventDefault(),e.width+=t-n.clientX,e.onResize(),t=n.clientX,!1}function i(){_.default.removeClass(e.__closeButton,S.CLASS_DRAG),_.default.unbind(window,"mousemove",n),_.default.unbind(window,"mouseup",i)}function r(r){return r.preventDefault(),t=r.clientX,_.default.addClass(e.__closeButton,S.CLASS_DRAG),_.default.bind(window,"mousemove",n),_.default.bind(window,"mouseup",i),!1}e.__resize_handle=document.createElement("div"),m.default.extend(e.__resize_handle.style,{width:"6px",marginLeft:"-3px",height:"200px",cursor:"ew-resize",position:"absolute"}),_.default.bind(e.__resize_handle,"mousedown",r),_.default.bind(e.__closeButton,"mousedown",r),e.domElement.insertBefore(e.__resize_handle,e.domElement.firstElementChild)}(this),a=function(){y&&"true"===localStorage.getItem(L(n,"isLocal"))&&localStorage.setItem(L(n,"gui"),JSON.stringify(n.getSaveObject()))},this.saveToLocalStorageIfPossible=a,i.parent||((r=n.getRoot()).width+=1,m.default.defer(function(){r.width-=1}))};function R(e,t,n){var i=document.createElement("li");return t&&i.appendChild(t),n?e.__ul.insertBefore(i,n):e.__ul.appendChild(i),e.onResize(),i}function C(e,t){var n=e.__preset_select[e.__preset_select.selectedIndex];n.innerHTML=t?n.value+"*":n.value}function k(e,t){var n=e.getRoot(),i=n.__rememberedObjects.indexOf(t.object);if(-1!==i){var r=n.__rememberedObjectIndecesToControllers[i];if(void 0===r&&(r={},n.__rememberedObjectIndecesToControllers[i]=r),r[t.property]=t,n.load&&n.load.remembered){var o=n.load.remembered,a=void 0;if(o[e.preset])a=o[e.preset];else{if(!o[b])return;a=o[b]}if(a[i]&&void 0!==a[i][t.property]){var s=a[i][t.property];t.initialValue=s,t.setValue(s)}}}}function O(e,t,n,r){if(void 0===t[n])throw new Error('Object "'+t+'" has no property "'+n+'"');var o=void 0;if(r.color)o=new f.default(t,n);else{var h=[t,n].concat(r.factoryArgs);o=a.default.apply(e,h)}r.before instanceof s.default&&(r.before=r.before.__li),k(e,o),_.default.addClass(o.domElement,"c");var p=document.createElement("span");_.default.addClass(p,"property-name"),p.innerHTML=o.property;var g=document.createElement("div");g.appendChild(p),g.appendChild(o.domElement);var v=R(e,g,r.before);return _.default.addClass(v,S.CLASS_CONTROLLER_ROW),o instanceof f.default?_.default.addClass(v,"color"):_.default.addClass(v,i(o.getValue())),function(e,t,n){if(n.__li=t,n.__gui=e,m.default.extend(n,{options:function(t){if(arguments.length>1){var i=n.__li.nextElementSibling;return n.remove(),O(e,n.object,n.property,{before:i,factoryArgs:[m.default.toArray(arguments)]})}if(m.default.isArray(t)||m.default.isObject(t)){var r=n.__li.nextElementSibling;return n.remove(),O(e,n.object,n.property,{before:r,factoryArgs:[t]})}},name:function(e){return n.__li.firstElementChild.firstElementChild.innerHTML=e,n},listen:function(){return n.__gui.listen(n),n},remove:function(){return n.__gui.remove(n),n}}),n instanceof c.default){var i=new d.default(n.object,n.property,{min:n.__min,max:n.__max,step:n.__step});m.default.each(["updateDisplay","onChange","onFinishChange","step"],function(e){var t=n[e],r=i[e];n[e]=i[e]=function(){var e=Array.prototype.slice.call(arguments);return r.apply(i,e),t.apply(n,e)}}),_.default.addClass(t,"has-slider"),n.domElement.insertBefore(i.domElement,n.domElement.firstElementChild)}else if(n instanceof d.default){var r=function(t){if(m.default.isNumber(n.__min)&&m.default.isNumber(n.__max)){var i=n.__li.firstElementChild.firstElementChild.innerHTML,r=n.__gui.__listening.indexOf(n)>-1;n.remove();var o=O(e,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[n.__min,n.__max,n.__step]});return o.name(i),r&&o.listen(),o}return t};n.min=m.default.compose(r,n.min),n.max=m.default.compose(r,n.max)}else n instanceof l.default?(_.default.bind(t,"click",function(){_.default.fakeEvent(n.__checkbox,"click")}),_.default.bind(n.__checkbox,"click",function(e){e.stopPropagation()})):n instanceof u.default?(_.default.bind(t,"click",function(){_.default.fakeEvent(n.__button,"click")}),_.default.bind(t,"mouseover",function(){_.default.addClass(n.__button,"hover")}),_.default.bind(t,"mouseout",function(){_.default.removeClass(n.__button,"hover")})):n instanceof f.default&&(_.default.addClass(t,"color"),n.updateDisplay=m.default.compose(function(e){return t.style.borderLeftColor=n.__color.toString(),e},n.updateDisplay),n.updateDisplay());n.setValue=m.default.compose(function(t){return e.getRoot().__preset_select&&n.isModified()&&C(e.getRoot(),!0),t},n.setValue)}(e,v,o),e.__controllers.push(o),o}function L(e,t){return document.location.href+"."+t}function P(e,t,n){var i=document.createElement("option");i.innerHTML=t,i.value=t,e.__preset_select.appendChild(i),n&&(e.__preset_select.selectedIndex=e.__preset_select.length-1)}function M(e,t){t.style.display=e.useLocalStorage?"block":"none"}function D(e,t){e.domElement.style.width=t+"px",e.__save_row&&e.autoPlace&&(e.__save_row.style.width=t+"px"),e.__closeButton&&(e.__closeButton.style.width=t+"px")}function U(e,t){var n={};return m.default.each(e.__rememberedObjects,function(i,r){var o={},a=e.__rememberedObjectIndecesToControllers[r];m.default.each(a,function(e,n){o[n]=t?e.initialValue:e.getValue()}),n[r]=o}),n}S.toggleHide=function(){T=!T,m.default.each(A,function(e){e.domElement.style.display=T?"none":""})},S.CLASS_AUTO_PLACE="a",S.CLASS_AUTO_PLACE_CONTAINER="ac",S.CLASS_MAIN="main",S.CLASS_CONTROLLER_ROW="cr",S.CLASS_TOO_TALL="taller-than-window",S.CLASS_CLOSED="closed",S.CLASS_CLOSE_BUTTON="close-button",S.CLASS_CLOSE_TOP="close-top",S.CLASS_CLOSE_BOTTOM="close-bottom",S.CLASS_DRAG="drag",S.DEFAULT_WIDTH=245,S.TEXT_CLOSED="Close Controls",S.TEXT_OPEN="Open Controls",S._keydownHandler=function(e){"text"===document.activeElement.type||72!==e.which&&72!==e.keyCode||S.toggleHide()},_.default.bind(window,"keydown",S._keydownHandler,!1),m.default.extend(S.prototype,{add:function(e,t){return O(this,e,t,{factoryArgs:Array.prototype.slice.call(arguments,2)})},addColor:function(e,t){return O(this,e,t,{color:!0})},remove:function(e){this.__ul.removeChild(e.__li),this.__controllers.splice(this.__controllers.indexOf(e),1);var t=this;m.default.defer(function(){t.onResize()})},destroy:function(){this.autoPlace&&w.removeChild(this.domElement),_.default.unbind(window,"keydown",S._keydownHandler,!1),_.default.unbind(window,"resize",this.__resizeHandler),this.saveToLocalStorageIfPossible&&_.default.unbind(window,"unload",this.saveToLocalStorageIfPossible)},addFolder:function(e){if(void 0!==this.__folders[e])throw new Error('You already have a folder in this GUI by the name "'+e+'"');var t={name:e,parent:this};t.autoPlace=this.autoPlace,this.load&&this.load.folders&&this.load.folders[e]&&(t.closed=this.load.folders[e].closed,t.load=this.load.folders[e]);var n=new S(t);this.__folders[e]=n;var i=R(this,n.domElement);return _.default.addClass(i,"folder"),n},open:function(){this.closed=!1},close:function(){this.closed=!0},onResize:function(){var e=this.getRoot();if(e.scrollable){var t=_.default.getOffset(e.__ul).top,n=0;m.default.each(e.__ul.childNodes,function(t){e.autoPlace&&t===e.__save_row||(n+=_.default.getHeight(t))}),window.innerHeight-t-20<n?(_.default.addClass(e.domElement,S.CLASS_TOO_TALL),e.__ul.style.height=window.innerHeight-t-20+"px"):(_.default.removeClass(e.domElement,S.CLASS_TOO_TALL),e.__ul.style.height="auto")}e.__resize_handle&&m.default.defer(function(){e.__resize_handle.style.height=e.__ul.offsetHeight+"px"}),e.__closeButton&&(e.__closeButton.style.width=e.width+"px")},onResizeDebounced:m.default.debounce(function(){this.onResize()},50),remember:function(){if(m.default.isUndefined(E)&&((E=new p.default).domElement.innerHTML=o.default),this.parent)throw new Error("You can only call remember on a top level GUI.");var e=this;m.default.each(Array.prototype.slice.call(arguments),function(t){0===e.__rememberedObjects.length&&function(e){var t=e.__save_row=document.createElement("li");_.default.addClass(e.domElement,"has-save"),e.__ul.insertBefore(t,e.__ul.firstChild),_.default.addClass(t,"save-row");var n=document.createElement("span");n.innerHTML="&nbsp;",_.default.addClass(n,"button gears");var i=document.createElement("span");i.innerHTML="Save",_.default.addClass(i,"button"),_.default.addClass(i,"save");var r=document.createElement("span");r.innerHTML="New",_.default.addClass(r,"button"),_.default.addClass(r,"save-as");var o=document.createElement("span");o.innerHTML="Revert",_.default.addClass(o,"button"),_.default.addClass(o,"revert");var a=e.__preset_select=document.createElement("select");e.load&&e.load.remembered?m.default.each(e.load.remembered,function(t,n){P(e,n,n===e.preset)}):P(e,b,!1);if(_.default.bind(a,"change",function(){for(var t=0;t<e.__preset_select.length;t++)e.__preset_select[t].innerHTML=e.__preset_select[t].value;e.preset=this.value}),t.appendChild(a),t.appendChild(n),t.appendChild(i),t.appendChild(r),t.appendChild(o),y){var s=document.getElementById("dg-local-explain"),l=document.getElementById("dg-local-storage"),u=document.getElementById("dg-save-locally");u.style.display="block","true"===localStorage.getItem(L(e,"isLocal"))&&l.setAttribute("checked","checked"),M(e,s),_.default.bind(l,"change",function(){e.useLocalStorage=!e.useLocalStorage,M(e,s)})}var d=document.getElementById("dg-new-constructor");_.default.bind(d,"keydown",function(e){!e.metaKey||67!==e.which&&67!==e.keyCode||E.hide()}),_.default.bind(n,"click",function(){d.innerHTML=JSON.stringify(e.getSaveObject(),void 0,2),E.show(),d.focus(),d.select()}),_.default.bind(i,"click",function(){e.save()}),_.default.bind(r,"click",function(){var t=prompt("Enter a new preset name.");t&&e.saveAs(t)}),_.default.bind(o,"click",function(){e.revert()})}(e),-1===e.__rememberedObjects.indexOf(t)&&e.__rememberedObjects.push(t)}),this.autoPlace&&D(this,this.width)},getRoot:function(){for(var e=this;e.parent;)e=e.parent;return e},getSaveObject:function(){var e=this.load;return e.closed=this.closed,this.__rememberedObjects.length>0&&(e.preset=this.preset,e.remembered||(e.remembered={}),e.remembered[this.preset]=U(this)),e.folders={},m.default.each(this.__folders,function(t,n){e.folders[n]=t.getSaveObject()}),e},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=U(this),C(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(e){this.load.remembered||(this.load.remembered={},this.load.remembered[b]=U(this,!0)),this.load.remembered[e]=U(this),this.preset=e,P(this,e,!0),this.saveToLocalStorageIfPossible()},revert:function(e){m.default.each(this.__controllers,function(t){this.getRoot().load.remembered?k(e||this.getRoot(),t):t.setValue(t.initialValue),t.__onFinishChange&&t.__onFinishChange.call(t,t.getValue())},this),m.default.each(this.__folders,function(e){e.revert(e)}),e||C(this.getRoot(),!1)},listen:function(e){var t=0===this.__listening.length;this.__listening.push(e),t&&function e(t){0!==t.length&&h.default.call(window,function(){e(t)});m.default.each(t,function(e){e.updateDisplay()})}(this.__listening)},updateDisplay:function(){m.default.each(this.__controllers,function(e){e.updateDisplay()}),m.default.each(this.__folders,function(e){e.updateDisplay()})}}),t.default=S,e.exports=t.default},function(e,t){"use strict";e.exports={load:function(e,t){var n=t||document,i=n.createElement("link");i.type="text/css",i.rel="stylesheet",i.href=e,n.getElementsByTagName("head")[0].appendChild(i)},inject:function(e,t){var n=t||document,i=document.createElement("style");i.type="text/css",i.innerHTML=e;var r=n.getElementsByTagName("head")[0];try{r.appendChild(i)}catch(e){}}}},function(e,t){e.exports='<div id="dg-save" class="dg dialogue">\n\n  Here\'s the new load parameter for your <code>GUI</code>\'s constructor:\n\n  <textarea id="dg-new-constructor"></textarea>\n\n  <div id="dg-save-locally">\n\n    <input id="dg-local-storage" type="checkbox"/> Automatically save\n    values to <code>localStorage</code> on exit.\n\n    <div id="dg-local-explain">The values saved to <code>localStorage</code> will\n      override those passed to <code>dat.GUI</code>\'s constructor. This makes it\n      easier to work incrementally, but <code>localStorage</code> is fragile,\n      and your friends may not see the same values you do.\n\n    </div>\n\n  </div>\n\n</div>'},function(e,t,n){"use strict";t.__esModule=!0;var i=d(n(10)),r=d(n(13)),o=d(n(14)),a=d(n(11)),s=d(n(15)),l=d(n(8)),u=d(n(5));function d(e){return e&&e.__esModule?e:{default:e}}t.default=function(e,t){var n=e[t];return u.default.isArray(arguments[2])||u.default.isObject(arguments[2])?new i.default(e,t,arguments[2]):u.default.isNumber(n)?u.default.isNumber(arguments[2])&&u.default.isNumber(arguments[3])?u.default.isNumber(arguments[4])?new o.default(e,t,arguments[2],arguments[3],arguments[4]):new o.default(e,t,arguments[2],arguments[3]):u.default.isNumber(arguments[4])?new r.default(e,t,{min:arguments[2],max:arguments[3],step:arguments[4]}):new r.default(e,t,{min:arguments[2],max:arguments[3]}):u.default.isString(n)?new a.default(e,t):u.default.isFunction(n)?new s.default(e,t,""):u.default.isBoolean(n)?new l.default(e,t):null},e.exports=t.default},function(e,t){"use strict";t.__esModule=!0,t.default=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(e){setTimeout(e,1e3/60)},e.exports=t.default},function(e,t,n){"use strict";t.__esModule=!0;var i=o(n(9)),r=o(n(5));function o(e){return e&&e.__esModule?e:{default:e}}var a=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.backgroundElement=document.createElement("div"),r.default.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),i.default.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),r.default.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var t=this;i.default.bind(this.backgroundElement,"click",function(){t.hide()})}return e.prototype.show=function(){var e=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),r.default.defer(function(){e.backgroundElement.style.opacity=1,e.domElement.style.opacity=1,e.domElement.style.webkitTransform="scale(1)"})},e.prototype.hide=function(){var e=this,t=function t(){e.domElement.style.display="none",e.backgroundElement.style.display="none",i.default.unbind(e.domElement,"webkitTransitionEnd",t),i.default.unbind(e.domElement,"transitionend",t),i.default.unbind(e.domElement,"oTransitionEnd",t)};i.default.bind(this.domElement,"webkitTransitionEnd",t),i.default.bind(this.domElement,"transitionend",t),i.default.bind(this.domElement,"oTransitionEnd",t),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"},e.prototype.layout=function(){this.domElement.style.left=window.innerWidth/2-i.default.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-i.default.getHeight(this.domElement)/2+"px"},e}();t.default=a,e.exports=t.default},function(e,t,n){(e.exports=n(24)()).push([e.id,".dg {\n  /** Clear list styles */\n  /* Auto-place container */\n  /* Auto-placed GUI's */\n  /* Line items that don't contain folders. */\n  /** Folder names */\n  /** Hides closed items */\n  /** Controller row */\n  /** Name-half (left) */\n  /** Controller-half (right) */\n  /** Controller placement */\n  /** Shorter number boxes when slider is present. */\n  /** Ensure the entire boolean and function row shows a hand */\n  /** allow overflow for color selector */ }\n  .dg ul {\n    list-style: none;\n    margin: 0;\n    padding: 0;\n    width: 100%;\n    clear: both; }\n  .dg.ac {\n    position: fixed;\n    top: 0;\n    left: 0;\n    right: 0;\n    height: 0;\n    z-index: 0; }\n  .dg:not(.ac) .main {\n    /** Exclude mains in ac so that we don't hide close button */\n    overflow: hidden; }\n  .dg.main {\n    -webkit-transition: opacity 0.1s linear;\n    -o-transition: opacity 0.1s linear;\n    -moz-transition: opacity 0.1s linear;\n    transition: opacity 0.1s linear; }\n    .dg.main.taller-than-window {\n      overflow-y: auto; }\n      .dg.main.taller-than-window .close-button {\n        opacity: 1;\n        /* TODO, these are style notes */\n        margin-top: -1px;\n        border-top: 1px solid #2c2c2c; }\n    .dg.main ul.closed .close-button {\n      opacity: 1 !important; }\n    .dg.main:hover .close-button,\n    .dg.main .close-button.drag {\n      opacity: 1; }\n    .dg.main .close-button {\n      /*opacity: 0;*/\n      -webkit-transition: opacity 0.1s linear;\n      -o-transition: opacity 0.1s linear;\n      -moz-transition: opacity 0.1s linear;\n      transition: opacity 0.1s linear;\n      border: 0;\n      line-height: 19px;\n      height: 20px;\n      /* TODO, these are style notes */\n      cursor: pointer;\n      text-align: center;\n      background-color: #000; }\n      .dg.main .close-button.close-top {\n        position: relative; }\n      .dg.main .close-button.close-bottom {\n        position: absolute; }\n      .dg.main .close-button:hover {\n        background-color: #111; }\n  .dg.a {\n    float: right;\n    margin-right: 15px;\n    overflow-y: visible; }\n    .dg.a.has-save > ul.close-top {\n      margin-top: 0; }\n    .dg.a.has-save > ul.close-bottom {\n      margin-top: 27px; }\n    .dg.a.has-save > ul.closed {\n      margin-top: 0; }\n    .dg.a .save-row {\n      top: 0;\n      z-index: 1002; }\n      .dg.a .save-row.close-top {\n        position: relative; }\n      .dg.a .save-row.close-bottom {\n        position: fixed; }\n  .dg li {\n    -webkit-transition: height 0.1s ease-out;\n    -o-transition: height 0.1s ease-out;\n    -moz-transition: height 0.1s ease-out;\n    transition: height 0.1s ease-out;\n    -webkit-transition: overflow 0.1s linear;\n    -o-transition: overflow 0.1s linear;\n    -moz-transition: overflow 0.1s linear;\n    transition: overflow 0.1s linear; }\n  .dg li:not(.folder) {\n    cursor: auto;\n    height: 27px;\n    line-height: 27px;\n    padding: 0 4px 0 5px; }\n  .dg li.folder {\n    padding: 0;\n    border-left: 4px solid transparent; }\n  .dg li.title {\n    cursor: pointer;\n    margin-left: -4px; }\n  .dg .closed li:not(.title),\n  .dg .closed ul li,\n  .dg .closed ul li > * {\n    height: 0;\n    overflow: hidden;\n    border: 0; }\n  .dg .cr {\n    clear: both;\n    padding-left: 3px;\n    height: 27px;\n    overflow: hidden; }\n  .dg .property-name {\n    cursor: default;\n    float: left;\n    clear: left;\n    width: 40%;\n    overflow: hidden;\n    text-overflow: ellipsis; }\n  .dg .c {\n    float: left;\n    width: 60%;\n    position: relative; }\n  .dg .c input[type=text] {\n    border: 0;\n    margin-top: 4px;\n    padding: 3px;\n    width: 100%;\n    float: right; }\n  .dg .has-slider input[type=text] {\n    width: 30%;\n    /*display: none;*/\n    margin-left: 0; }\n  .dg .slider {\n    float: left;\n    width: 66%;\n    margin-left: -5px;\n    margin-right: 0;\n    height: 19px;\n    margin-top: 4px; }\n  .dg .slider-fg {\n    height: 100%; }\n  .dg .c input[type=checkbox] {\n    margin-top: 7px; }\n  .dg .c select {\n    margin-top: 5px; }\n  .dg .cr.function,\n  .dg .cr.function .property-name,\n  .dg .cr.function *,\n  .dg .cr.boolean,\n  .dg .cr.boolean * {\n    cursor: pointer; }\n  .dg .cr.color {\n    overflow: visible; }\n  .dg .selector {\n    display: none;\n    position: absolute;\n    margin-left: -9px;\n    margin-top: 23px;\n    z-index: 10; }\n  .dg .c:hover .selector,\n  .dg .selector.drag {\n    display: block; }\n  .dg li.save-row {\n    padding: 0; }\n    .dg li.save-row .button {\n      display: inline-block;\n      padding: 0px 6px; }\n  .dg.dialogue {\n    background-color: #222;\n    width: 460px;\n    padding: 15px;\n    font-size: 13px;\n    line-height: 15px; }\n\n/* TODO Separate style and structure */\n#dg-new-constructor {\n  padding: 10px;\n  color: #222;\n  font-family: Monaco, monospace;\n  font-size: 10px;\n  border: 0;\n  resize: none;\n  box-shadow: inset 1px 1px 1px #888;\n  word-wrap: break-word;\n  margin: 12px 0;\n  display: block;\n  width: 440px;\n  overflow-y: scroll;\n  height: 100px;\n  position: relative; }\n\n#dg-local-explain {\n  display: none;\n  font-size: 11px;\n  line-height: 17px;\n  border-radius: 3px;\n  background-color: #333;\n  padding: 8px;\n  margin-top: 10px; }\n  #dg-local-explain code {\n    font-size: 10px; }\n\n#dat-gui-save-locally {\n  display: none; }\n\n/** Main type */\n.dg {\n  color: #eee;\n  font: 11px 'Lucida Grande', sans-serif;\n  text-shadow: 0 -1px 0 #111;\n  /** Auto place */\n  /* Controller row, <li> */\n  /** Controllers */ }\n  .dg.main {\n    /** Scrollbar */ }\n    .dg.main::-webkit-scrollbar {\n      width: 5px;\n      background: #1a1a1a; }\n    .dg.main::-webkit-scrollbar-corner {\n      height: 0;\n      display: none; }\n    .dg.main::-webkit-scrollbar-thumb {\n      border-radius: 5px;\n      background: #676767; }\n  .dg li:not(.folder) {\n    background: #1a1a1a;\n    border-bottom: 1px solid #2c2c2c; }\n  .dg li.save-row {\n    line-height: 25px;\n    background: #dad5cb;\n    border: 0; }\n    .dg li.save-row select {\n      margin-left: 5px;\n      width: 108px; }\n    .dg li.save-row .button {\n      margin-left: 5px;\n      margin-top: 1px;\n      border-radius: 2px;\n      font-size: 9px;\n      line-height: 7px;\n      padding: 4px 4px 5px 4px;\n      background: #c5bdad;\n      color: #fff;\n      text-shadow: 0 1px 0 #b0a58f;\n      box-shadow: 0 -1px 0 #b0a58f;\n      cursor: pointer; }\n      .dg li.save-row .button.gears {\n        background: #c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;\n        height: 7px;\n        width: 8px; }\n      .dg li.save-row .button:hover {\n        background-color: #bab19e;\n        box-shadow: 0 -1px 0 #b0a58f; }\n  .dg li.folder {\n    border-bottom: 0; }\n  .dg li.title {\n    padding-left: 16px;\n    background: #000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;\n    cursor: pointer;\n    border-bottom: 1px solid rgba(255, 255, 255, 0.2); }\n  .dg .closed li.title {\n    background-image: url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==); }\n  .dg .cr.boolean {\n    border-left: 3px solid #806787; }\n  .dg .cr.color {\n    border-left: 3px solid; }\n  .dg .cr.function {\n    border-left: 3px solid #e61d5f; }\n  .dg .cr.number {\n    border-left: 3px solid #2FA1D6; }\n    .dg .cr.number input[type=text] {\n      color: #2FA1D6; }\n  .dg .cr.string {\n    border-left: 3px solid #1ed36f; }\n    .dg .cr.string input[type=text] {\n      color: #1ed36f; }\n  .dg .cr.function:hover, .dg .cr.boolean:hover {\n    background: #111; }\n  .dg .c input[type=text] {\n    background: #303030;\n    outline: none; }\n    .dg .c input[type=text]:hover {\n      background: #3c3c3c; }\n    .dg .c input[type=text]:focus {\n      background: #494949;\n      color: #fff; }\n  .dg .c .slider {\n    background: #303030;\n    cursor: ew-resize; }\n  .dg .c .slider-fg {\n    background: #2FA1D6;\n    max-width: 100%; }\n  .dg .c .slider:hover {\n    background: #3c3c3c; }\n    .dg .c .slider:hover .slider-fg {\n      background: #44abda; }\n",""])},function(e,t){e.exports=function(){var e=[];return e.toString=function(){for(var e=[],t=0;t<this.length;t++){var n=this[t];n[2]?e.push("@media "+n[2]+"{"+n[1]+"}"):e.push(n[1])}return e.join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var i={},r=0;r<this.length;r++){var o=this[r][0];"number"==typeof o&&(i[o]=!0)}for(r=0;r<t.length;r++){var a=t[r];"number"==typeof a[0]&&i[a[0]]||(n&&!a[2]?a[2]=n:n&&(a[2]="("+a[2]+") and ("+n+")"),e.push(a))}},e}}])});
  //# sourceMappingURL=vendors.min.js.map
  