-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbundle.js
2 lines (2 loc) · 60.3 KB
/
bundle.js
1
2
!function(e){function t(i){if(n[i])return n[i].exports;var o=n[i]={exports:{},id:i,loaded:!1};return e[i].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function o(){g.fixNode(0),g.fixNode(14),g.fixNode(29)}var r=n(1),s=i(r),a=n(8),l=i(a),d=n(5),c=i(d);n(10);var u=new l["default"];u.setMode(0),u.domElement.style.position="absolute",u.domElement.style.left="0px",u.domElement.style.top="0px";var h=document.createElement("canvas");h.width=window.innerWidth,h.height=window.innerHeight,document.body.appendChild(h),document.body.appendChild(u.domElement);var f=30,p=15,_=(h.width-f*p)/2,m=(h.height-f*p)/2-100,g=new s["default"](h,_,m,30,15);o(),g.beforeRender=function(){return u.begin()},g.afterRender=function(){return u.end()};var b=new c["default"].GUI;b.add(g,"gravity").min(0).max(1).step(.1).name("Gravity"),b.add(g,"accuracy").min(2).max(10).step(1).name("Speed"),b.add(g,"friction").min(0).max(1).step(.01).name("Friction"),b.add(g,"colorRange").min(0).max(360).step(.01).name("Color Range").onChange(function(){g.reset(),o()});var v={Reset:function(){g.reset(),o()}};b.add(v,"Reset")},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=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}}(),r=n(2),s=function(){function e(t,n,o,r,s){i(this,e),"string"==typeof t&&(t=document.getElementById(t)),this.x=n,this.y=o,this.canvas=t,this.context=this.canvas.getContext("2d"),this.width=t.width,this.height=t.height,this.sideLength=r,this.nodeDistance=s,this.nodes=[],this.sticks=[],this.accuracy=4,this.friction=.99,this.bounce=.5,this.gravity=.2,this.colorRange=100,this.elasticity=15,this.fabric(),this.render()}return o(e,[{key:"colorGenerator",value:function(e){var t=this.sideLength*this.sideLength;return"hsla("+r.map(e,0,t,0,this.colorRange)+", 100%, 50%, 1)"}},{key:"distance",value:function(e,t){var n=e.x-t.x,i=e.y-t.y;return Math.sqrt(n*n+i*i)}},{key:"reset",value:function(){this.nodes=[],this.sticks=[],this.fabric()}},{key:"fabric",value:function(){for(var e=0;e<this.sideLength;e++)for(var t=e*this.nodeDistance+this.y,n=0;n<this.sideLength;n++){var i=n*this.nodeDistance+this.x;if(this.addNode({x:i,y:t,color:this.colorGenerator(this.nodes.length)}),n){var o=this.nodes[this.nodes.length-2],r=this.nodes[this.nodes.length-1];this.addStick({firstNode:o,secondNode:r,length:this.distance(o,r)})}if(e){var o=this.nodes[this.nodes.length-this.sideLength-1],r=this.nodes[this.nodes.length-1];this.addStick({firstNode:o,secondNode:r,length:this.distance(o,r)})}}}},{key:"addNode",value:function(e){return this.nodes.push({x:e.x,y:e.y,oldx:e.oldx||e.x,oldy:e.oldy||e.y,fixed:e.fixed||!1,color:e.color})-1}},{key:"addStick",value:function(e){return this.sticks.push({firstNode:e.firstNode,secondNode:e.secondNode,length:e.length})-1}},{key:"fixNode",value:function(e){var t=this.nodes[e];t&&(t.fixed=!0)}},{key:"clear",value:function(){this.context.clearRect(0,0,this.width,this.height)}},{key:"render",value:function(){this.beforeRender&&this.beforeRender();for(var e=this.accuracy;--e;)this.updateSticks(),this.updateNodes();this.clear(),this.renderNodes(),this.renderSticks(),this.afterRender&&this.afterRender(),window.requestAnimationFrame(this.render.bind(this))}},{key:"updateNodes",value:function(){for(var e=0,t=this.nodes.length;t>e;e++){var n=this.nodes[e];if(!n.fixed){var i=(n.x-n.oldx)*this.friction,o=(n.y-n.oldy)*this.friction;n.oldx=n.x,n.oldy=n.y,n.x+=i,n.y+=o+this.gravity,n.x>this.width?(n.x=this.width,n.oldx=n.x+i*this.bounce):n.x<0&&(n.x=0,n.oldx=n.x+i*this.bounce),n.y>this.height?(n.y=this.height,n.oldy=n.y+o*this.bounce):n.y<0&&(n.y=0,n.oldy=n.y+o*this.bounce)}}}},{key:"updateSticks",value:function(){for(var e=0,t=this.sticks.length;t>e;e++){var n=this.sticks[e],i=n.secondNode.x-n.firstNode.x,o=n.secondNode.y-n.firstNode.y,r=Math.sqrt(i*i+o*o),s=(n.length-r)/r/2,a=i*s,l=o*s;r>n.length*this.elasticity&&(n.removed=!0),n.firstNode.fixed||n.removed||(n.firstNode.x-=a,n.firstNode.y-=l),n.secondNode.fixed||n.removed||(n.secondNode.x+=a,n.secondNode.y+=l)}}},{key:"renderNodes",value:function(){for(var e=this.context,t=0,n=this.nodes.length;n>t;t++){var i=this.nodes[t];e.beginPath(),e.arc(i.x,i.y,3,0,2*Math.PI),e.fillStyle=i.color,e.fill()}}},{key:"renderSticks",value:function(){var e=this.context;e.beginPath();for(var t=0,n=this.sticks.length;n>t;t++){var i=this.sticks[t];i.removed||(e.moveTo(i.firstNode.x,i.firstNode.y),e.lineTo(i.secondNode.x,i.secondNode.y))}e.strokeStyle="hsla(260, 100%, 100%, 0.6)",e.stroke()}}]),e}();t["default"]=s,e.exports=t["default"]},function(e,t){"use strict";function n(e,t,n,i,o){return(o-i)*((e-t)/(n-t))+i}Object.defineProperty(t,"__esModule",{value:!0}),t.map=n},function(e,t,n){t=e.exports=n(4)(),t.push([e.id,"body{margin:0;padding:0;background-color:#000}canvas{display:block;margin:0 auto}",""])},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={},o=0;o<this.length;o++){var r=this[o][0];"number"==typeof r&&(i[r]=!0)}for(o=0;o<t.length;o++){var s=t[o];"number"==typeof s[0]&&i[s[0]]||(n&&!s[2]?s[2]=n:n&&(s[2]="("+s[2]+") and ("+n+")"),e.push(s))}},e}},function(e,t,n){e.exports=n(7),e.exports.color=n(6)},function(e,t){var n=e.exports=n||{};n.color=n.color||{},n.utils=n.utils||{},n.utils.common=function(){var e=Array.prototype.forEach,t=Array.prototype.slice;return{BREAK:{},extend:function(e){return this.each(t.call(arguments,1),function(t){for(var n in t)this.isUndefined(t[n])||(e[n]=t[n])},this),e},defaults:function(e){return this.each(t.call(arguments,1),function(t){for(var n in t)this.isUndefined(e[n])&&(e[n]=t[n])},this),e},compose:function(){var e=t.call(arguments);return function(){for(var n=t.call(arguments),i=e.length-1;i>=0;i--)n=[e[i].apply(this,n)];return n[0]}},each:function(t,n,i){if(e&&t.forEach===e)t.forEach(n,i);else if(t.length===t.length+0){for(var o=0,r=t.length;r>o;o++)if(o in t&&n.call(i,t[o],o)===this.BREAK)return}else for(var o in t)if(n.call(i,t[o],o)===this.BREAK)return},defer:function(e){setTimeout(e,0)},toArray:function(e){return e.toArray?e.toArray():t.call(e)},isUndefined:function(e){return void 0===e},isNull:function(e){return null===e},isNaN:function(e){return e!==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 e===!1||e===!0},isFunction:function(e){return"[object Function]"===Object.prototype.toString.call(e)}}}(),n.color.toString=function(e){return function(t){if(1==t.a||e.isUndefined(t.a)){for(var n=t.hex.toString(16);n.length<6;)n="0"+n;return"#"+n}return"rgba("+Math.round(t.r)+","+Math.round(t.g)+","+Math.round(t.b)+","+t.a+")"}}(n.utils.common),n.Color=n.color.Color=function(e,t,n,i){function o(e,t,n){Object.defineProperty(e,t,{get:function(){return"RGB"===this.__state.space?this.__state[t]:(s(this,t,n),this.__state[t])},set:function(e){"RGB"!==this.__state.space&&(s(this,t,n),this.__state.space="RGB"),this.__state[t]=e}})}function r(e,t){Object.defineProperty(e,t,{get:function(){return"HSV"===this.__state.space?this.__state[t]:(a(this),this.__state[t])},set:function(e){"HSV"!==this.__state.space&&(a(this),this.__state.space="HSV"),this.__state[t]=e}})}function s(e,n,o){if("HEX"===e.__state.space)e.__state[n]=t.component_from_hex(e.__state.hex,o);else{if("HSV"!==e.__state.space)throw"Corrupted color state";i.extend(e.__state,t.hsv_to_rgb(e.__state.h,e.__state.s,e.__state.v))}}function a(e){var n=t.rgb_to_hsv(e.r,e.g,e.b);i.extend(e.__state,{s:n.s,v:n.v}),i.isNaN(n.h)?i.isUndefined(e.__state.h)&&(e.__state.h=0):e.__state.h=n.h}var l=function(){if(this.__state=e.apply(this,arguments),this.__state===!1)throw"Failed to interpret color arguments";this.__state.a=this.__state.a||1};return l.COMPONENTS=["r","g","b","h","s","v","hex","a"],i.extend(l.prototype,{toString:function(){return n(this)},toOriginal:function(){return this.__state.conversion.write(this)}}),o(l.prototype,"r",2),o(l.prototype,"g",1),o(l.prototype,"b",0),r(l.prototype,"h"),r(l.prototype,"s"),r(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=t.rgb_to_hex(this.r,this.g,this.b)),this.__state.hex},set:function(e){this.__state.space="HEX",this.__state.hex=e}}),l}(n.color.interpret=function(e,t){var n,i,o=function(){i=!1;var e=arguments.length>1?t.toArray(arguments):arguments[0];return t.each(r,function(o){return o.litmus(e)?(t.each(o.conversions,function(o,r){return n=o.read(e),i===!1&&n!==!1?(i=n,n.conversionName=r,n.conversion=o,t.BREAK):void 0}),t.BREAK):void 0}),i},r=[{litmus:t.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?!1:{space:"HEX",hex:parseInt("0x"+t[1].toString()+t[1].toString()+t[2].toString()+t[2].toString()+t[3].toString()+t[3].toString())}},write:e},SIX_CHAR_HEX:{read:function(e){var t=e.match(/^#([A-F0-9]{6})$/i);return null===t?!1:{space:"HEX",hex:parseInt("0x"+t[1].toString())}},write:e},CSS_RGB:{read:function(e){var t=e.match(/^rgb\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/);return null===t?!1:{space:"RGB",r:parseFloat(t[1]),g:parseFloat(t[2]),b:parseFloat(t[3])}},write:e},CSS_RGBA:{read:function(e){var t=e.match(/^rgba\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\,\s*(.+)\s*\)/);return null===t?!1:{space:"RGB",r:parseFloat(t[1]),g:parseFloat(t[2]),b:parseFloat(t[3]),a:parseFloat(t[4])}},write:e}}},{litmus:t.isNumber,conversions:{HEX:{read:function(e){return{space:"HEX",hex:e,conversionName:"HEX"}},write:function(e){return e.hex}}}},{litmus:t.isArray,conversions:{RGB_ARRAY:{read:function(e){return 3!=e.length?!1:{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?!1:{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:t.isObject,conversions:{RGBA_OBJ:{read:function(e){return t.isNumber(e.r)&&t.isNumber(e.g)&&t.isNumber(e.b)&&t.isNumber(e.a)?{space:"RGB",r:e.r,g:e.g,b:e.b,a:e.a}:!1},write:function(e){return{r:e.r,g:e.g,b:e.b,a:e.a}}},RGB_OBJ:{read:function(e){return t.isNumber(e.r)&&t.isNumber(e.g)&&t.isNumber(e.b)?{space:"RGB",r:e.r,g:e.g,b:e.b}:!1},write:function(e){return{r:e.r,g:e.g,b:e.b}}},HSVA_OBJ:{read:function(e){return t.isNumber(e.h)&&t.isNumber(e.s)&&t.isNumber(e.v)&&t.isNumber(e.a)?{space:"HSV",h:e.h,s:e.s,v:e.v,a:e.a}:!1},write:function(e){return{h:e.h,s:e.s,v:e.v,a:e.a}}},HSV_OBJ:{read:function(e){return t.isNumber(e.h)&&t.isNumber(e.s)&&t.isNumber(e.v)?{space:"HSV",h:e.h,s:e.s,v:e.v}:!1},write:function(e){return{h:e.h,s:e.s,v:e.v}}}}}];return o}(n.color.toString,n.utils.common),n.color.math=function(){var e;return{hsv_to_rgb:function(e,t,n){var i=Math.floor(e/60)%6,o=e/60-Math.floor(e/60),r=n*(1-t),s=n*(1-o*t),a=n*(1-(1-o)*t),l=[[n,a,r],[s,n,r],[r,n,a],[r,s,n],[a,r,n],[n,r,s]][i];return{r:255*l[0],g:255*l[1],b:255*l[2]}},rgb_to_hsv:function(e,t,n){var i,o,r=Math.min(e,t,n),s=Math.max(e,t,n),a=s-r;return 0==s?{h:NaN,s:0,v:0}:(o=a/s,i=e==s?(t-n)/a:t==s?2+(n-e)/a:4+(e-t)/a,i/=6,0>i&&(i+=1),{h:360*i,s:o,v:s/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(t,n,i){return i<<(e=8*n)|t&~(255<<e)}}}(),n.color.toString,n.utils.common)},function(e,t){var n=e.exports=n||{};n.gui=n.gui||{},n.utils=n.utils||{},n.controllers=n.controllers||{},n.dom=n.dom||{},n.color=n.color||{},n.utils.css=function(){return{load:function(e,t){t=t||document;var n=t.createElement("link");n.type="text/css",n.rel="stylesheet",n.href=e,t.getElementsByTagName("head")[0].appendChild(n)},inject:function(e,t){t=t||document;var n=document.createElement("style");n.type="text/css",n.innerHTML=e,t.getElementsByTagName("head")[0].appendChild(n)}}}(),n.utils.common=function(){var e=Array.prototype.forEach,t=Array.prototype.slice;return{BREAK:{},extend:function(e){return this.each(t.call(arguments,1),function(t){for(var n in t)this.isUndefined(t[n])||(e[n]=t[n])},this),e},defaults:function(e){return this.each(t.call(arguments,1),function(t){for(var n in t)this.isUndefined(e[n])&&(e[n]=t[n])},this),e},compose:function(){var e=t.call(arguments);return function(){for(var n=t.call(arguments),i=e.length-1;i>=0;i--)n=[e[i].apply(this,n)];return n[0]}},each:function(t,n,i){if(e&&t.forEach===e)t.forEach(n,i);else if(t.length===t.length+0){for(var o=0,r=t.length;r>o;o++)if(o in t&&n.call(i,t[o],o)===this.BREAK)return}else for(var o in t)if(n.call(i,t[o],o)===this.BREAK)return},defer:function(e){setTimeout(e,0)},toArray:function(e){return e.toArray?e.toArray():t.call(e)},isUndefined:function(e){return void 0===e},isNull:function(e){return null===e},isNaN:function(e){return e!==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 e===!1||e===!0},isFunction:function(e){return"[object Function]"===Object.prototype.toString.call(e)}}}(),n.controllers.Controller=function(e){var t=function(e,t){this.initialValue=e[t],this.domElement=document.createElement("div"),this.object=e,this.property=t,this.__onChange=void 0,this.__onFinishChange=void 0};return e.extend(t.prototype,{onChange:function(e){return this.__onChange=e,this},onFinishChange:function(e){return this.__onFinishChange=e,this},setValue:function(e){return this.object[this.property]=e,this.__onChange&&this.__onChange.call(this,e),this.updateDisplay(),this},getValue:function(){return this.object[this.property]},updateDisplay:function(){return this},isModified:function(){return this.initialValue!==this.getValue()}}),t}(n.utils.common),n.dom.dom=function(e){function t(t){if("0"===t||e.isUndefined(t))return 0;var n=t.match(o);return e.isNull(n)?0:parseFloat(n[1])}var n={HTMLEvents:["change"],MouseEvents:["click","mousemove","mousedown","mouseup","mouseover"],KeyboardEvents:["keydown"]},i={};e.each(n,function(t,n){e.each(t,function(e){i[e]=n})});var o=/(\d+(\.\d+)?)px/,r={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(t,n,i){e.isUndefined(n)&&(n=!0),e.isUndefined(i)&&(i=!0),t.style.position="absolute",n&&(t.style.left=0,t.style.right=0),i&&(t.style.top=0,t.style.bottom=0)},fakeEvent:function(t,n,o,r){o=o||{};var s=i[n];if(!s)throw new Error("Event type "+n+" not supported.");var a=document.createEvent(s);switch(s){case"MouseEvents":var l=o.x||o.clientX||0,d=o.y||o.clientY||0;a.initMouseEvent(n,o.bubbles||!1,o.cancelable||!0,window,o.clickCount||1,0,0,l,d,!1,!1,!1,!1,0,null);break;case"KeyboardEvents":var c=a.initKeyboardEvent||a.initKeyEvent;e.defaults(o,{cancelable:!0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,keyCode:void 0,charCode:void 0}),c(n,o.bubbles||!1,o.cancelable,window,o.ctrlKey,o.altKey,o.shiftKey,o.metaKey,o.keyCode,o.charCode);break;default:a.initEvent(n,o.bubbles||!1,o.cancelable||!0)}e.defaults(a,r),t.dispatchEvent(a)},bind:function(e,t,n,i){return i=i||!1,e.addEventListener?e.addEventListener(t,n,i):e.attachEvent&&e.attachEvent("on"+t,n),r},unbind:function(e,t,n,i){return i=i||!1,e.removeEventListener?e.removeEventListener(t,n,i):e.detachEvent&&e.detachEvent("on"+t,n),r},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 r},removeClass:function(e,t){if(t)if(void 0===e.className);else 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 r},hasClass:function(e,t){return new RegExp("(?:^|\\s+)"+t+"(?:\\s+|$)").test(e.className)||!1},getWidth:function(e){var n=getComputedStyle(e);return t(n["border-left-width"])+t(n["border-right-width"])+t(n["padding-left"])+t(n["padding-right"])+t(n.width)},getHeight:function(e){var n=getComputedStyle(e);return t(n["border-top-width"])+t(n["border-bottom-width"])+t(n["padding-top"])+t(n["padding-bottom"])+t(n.height)},getOffset:function(e){var t={left:0,top:0};if(e.offsetParent)do t.left+=e.offsetLeft,t.top+=e.offsetTop;while(e=e.offsetParent);return t},isActive:function(e){return e===document.activeElement&&(e.type||e.href)}};return r}(n.utils.common),n.controllers.OptionController=function(e,t,n){var i=function(e,o,r){i.superclass.call(this,e,o);var s=this;if(this.__select=document.createElement("select"),n.isArray(r)){var a={};n.each(r,function(e){a[e]=e}),r=a}n.each(r,function(e,t){var n=document.createElement("option");n.innerHTML=t,n.setAttribute("value",e),s.__select.appendChild(n)}),this.updateDisplay(),t.bind(this.__select,"change",function(){var e=this.options[this.selectedIndex].value;s.setValue(e)}),this.domElement.appendChild(this.__select)};return i.superclass=e,n.extend(i.prototype,e.prototype,{setValue:function(e){var t=i.superclass.prototype.setValue.call(this,e);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),t},updateDisplay:function(){return this.__select.value=this.getValue(),i.superclass.prototype.updateDisplay.call(this)}}),i}(n.controllers.Controller,n.dom.dom,n.utils.common),n.controllers.NumberController=function(e,t){function n(e){return e=e.toString(),e.indexOf(".")>-1?e.length-e.indexOf(".")-1:0}var i=function(e,o,r){i.superclass.call(this,e,o),r=r||{},this.__min=r.min,this.__max=r.max,this.__step=r.step,t.isUndefined(this.__step)?0==this.initialValue?this.__impliedStep=1:this.__impliedStep=Math.pow(10,Math.floor(Math.log(this.initialValue)/Math.LN10))/10:this.__impliedStep=this.__step,this.__precision=n(this.__impliedStep)};return i.superclass=e,t.extend(i.prototype,e.prototype,{setValue:function(e){return void 0!==this.__min&&e<this.__min?e=this.__min:void 0!==this.__max&&e>this.__max&&(e=this.__max),void 0!==this.__step&&e%this.__step!=0&&(e=Math.round(e/this.__step)*this.__step),i.superclass.prototype.setValue.call(this,e)},min:function(e){return this.__min=e,this},max:function(e){return this.__max=e,this},step:function(e){return this.__step=e,this}}),i}(n.controllers.Controller,n.utils.common),n.controllers.NumberControllerBox=function(e,t,n){function i(e,t){var n=Math.pow(10,t);return Math.round(e*n)/n}var o=function(e,i,r){function s(){var e=parseFloat(h.__input.value);n.isNaN(e)||h.setValue(e)}function a(){s(),h.__onFinishChange&&h.__onFinishChange.call(h,h.getValue())}function l(e){t.bind(window,"mousemove",d),t.bind(window,"mouseup",c),u=e.clientY}function d(e){var t=u-e.clientY;h.setValue(h.getValue()+t*h.__impliedStep),u=e.clientY}function c(){t.unbind(window,"mousemove",d),t.unbind(window,"mouseup",c)}this.__truncationSuspended=!1,o.superclass.call(this,e,i,r);var u,h=this;this.__input=document.createElement("input"),this.__input.setAttribute("type","text"),t.bind(this.__input,"change",s),t.bind(this.__input,"blur",a),t.bind(this.__input,"mousedown",l),t.bind(this.__input,"keydown",function(e){13===e.keyCode&&(h.__truncationSuspended=!0,this.blur(),h.__truncationSuspended=!1)}),this.updateDisplay(),this.domElement.appendChild(this.__input)};return o.superclass=e,n.extend(o.prototype,e.prototype,{updateDisplay:function(){return this.__input.value=this.__truncationSuspended?this.getValue():i(this.getValue(),this.__precision),o.superclass.prototype.updateDisplay.call(this)}}),o}(n.controllers.NumberController,n.dom.dom,n.utils.common),n.controllers.NumberControllerSlider=function(e,t,n,i,o){function r(e,t,n,i,o){return i+(o-i)*((e-t)/(n-t))}var s=function(e,n,i,o,a){function l(e){t.bind(window,"mousemove",d),t.bind(window,"mouseup",c),d(e)}function d(e){e.preventDefault();var n=t.getOffset(u.__background),i=t.getWidth(u.__background);return u.setValue(r(e.clientX,n.left,n.left+i,u.__min,u.__max)),!1}function c(){t.unbind(window,"mousemove",d),t.unbind(window,"mouseup",c),u.__onFinishChange&&u.__onFinishChange.call(u,u.getValue())}s.superclass.call(this,e,n,{min:i,max:o,step:a});var u=this;this.__background=document.createElement("div"),this.__foreground=document.createElement("div"),t.bind(this.__background,"mousedown",l),t.addClass(this.__background,"slider"),t.addClass(this.__foreground,"slider-fg"),this.updateDisplay(),this.__background.appendChild(this.__foreground),this.domElement.appendChild(this.__background)};return s.superclass=e,s.useDefaultStyles=function(){n.inject(o)},i.extend(s.prototype,e.prototype,{updateDisplay:function(){var e=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*e+"%",s.superclass.prototype.updateDisplay.call(this)}}),s}(n.controllers.NumberController,n.dom.dom,n.utils.css,n.utils.common,".slider {\n box-shadow: inset 0 2px 4px rgba(0,0,0,0.15);\n height: 1em;\n border-radius: 1em;\n background-color: #eee;\n padding: 0 0.5em;\n overflow: hidden;\n}\n\n.slider-fg {\n padding: 1px 0 2px 0;\n background-color: #aaa;\n height: 1em;\n margin-left: -0.5em;\n padding-right: 0.5em;\n border-radius: 1em 0 0 1em;\n}\n\n.slider-fg:after {\n display: inline-block;\n border-radius: 1em;\n background-color: #fff;\n border: 1px solid #aaa;\n content: '';\n float: right;\n margin-right: -1em;\n margin-top: -1px;\n height: 0.9em;\n width: 0.9em;\n}"),n.controllers.FunctionController=function(e,t,n){var i=function(e,n,o){i.superclass.call(this,e,n);var r=this;this.__button=document.createElement("div"),this.__button.innerHTML=void 0===o?"Fire":o,t.bind(this.__button,"click",function(e){return e.preventDefault(),r.fire(),!1}),t.addClass(this.__button,"button"),this.domElement.appendChild(this.__button)};return i.superclass=e,n.extend(i.prototype,e.prototype,{fire:function(){this.__onChange&&this.__onChange.call(this),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),this.getValue().call(this.object)}}),i}(n.controllers.Controller,n.dom.dom,n.utils.common),n.controllers.BooleanController=function(e,t,n){var i=function(e,n){function o(){r.setValue(!r.__prev)}i.superclass.call(this,e,n);var r=this;this.__prev=this.getValue(),this.__checkbox=document.createElement("input"),this.__checkbox.setAttribute("type","checkbox"),t.bind(this.__checkbox,"change",o,!1),this.domElement.appendChild(this.__checkbox),this.updateDisplay()};return i.superclass=e,n.extend(i.prototype,e.prototype,{setValue:function(e){var t=i.superclass.prototype.setValue.call(this,e);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),this.__prev=this.getValue(),t},updateDisplay:function(){return this.getValue()===!0?(this.__checkbox.setAttribute("checked","checked"),this.__checkbox.checked=!0):this.__checkbox.checked=!1,i.superclass.prototype.updateDisplay.call(this)}}),i}(n.controllers.Controller,n.dom.dom,n.utils.common),n.color.toString=function(e){return function(t){if(1==t.a||e.isUndefined(t.a)){for(var n=t.hex.toString(16);n.length<6;)n="0"+n;return"#"+n}return"rgba("+Math.round(t.r)+","+Math.round(t.g)+","+Math.round(t.b)+","+t.a+")"}}(n.utils.common),n.color.interpret=function(e,t){var n,i,o=function(){i=!1;var e=arguments.length>1?t.toArray(arguments):arguments[0];return t.each(r,function(o){return o.litmus(e)?(t.each(o.conversions,function(o,r){return n=o.read(e),i===!1&&n!==!1?(i=n,n.conversionName=r,n.conversion=o,t.BREAK):void 0}),t.BREAK):void 0}),i},r=[{litmus:t.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?!1:{space:"HEX",hex:parseInt("0x"+t[1].toString()+t[1].toString()+t[2].toString()+t[2].toString()+t[3].toString()+t[3].toString())}},write:e},SIX_CHAR_HEX:{read:function(e){var t=e.match(/^#([A-F0-9]{6})$/i);return null===t?!1:{space:"HEX",hex:parseInt("0x"+t[1].toString())}},write:e},CSS_RGB:{read:function(e){var t=e.match(/^rgb\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/);return null===t?!1:{space:"RGB",r:parseFloat(t[1]),g:parseFloat(t[2]),b:parseFloat(t[3])}},write:e},CSS_RGBA:{read:function(e){var t=e.match(/^rgba\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\,\s*(.+)\s*\)/);return null===t?!1:{space:"RGB",r:parseFloat(t[1]),g:parseFloat(t[2]),b:parseFloat(t[3]),a:parseFloat(t[4])}},write:e}}},{litmus:t.isNumber,conversions:{HEX:{read:function(e){return{space:"HEX",hex:e,conversionName:"HEX"}},write:function(e){return e.hex}}}},{litmus:t.isArray,conversions:{RGB_ARRAY:{read:function(e){return 3!=e.length?!1:{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?!1:{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:t.isObject,conversions:{RGBA_OBJ:{read:function(e){return t.isNumber(e.r)&&t.isNumber(e.g)&&t.isNumber(e.b)&&t.isNumber(e.a)?{space:"RGB",r:e.r,g:e.g,b:e.b,a:e.a}:!1},write:function(e){return{r:e.r,g:e.g,b:e.b,a:e.a}}},RGB_OBJ:{read:function(e){return t.isNumber(e.r)&&t.isNumber(e.g)&&t.isNumber(e.b)?{space:"RGB",r:e.r,g:e.g,b:e.b}:!1},write:function(e){return{r:e.r,g:e.g,b:e.b}}},HSVA_OBJ:{read:function(e){return t.isNumber(e.h)&&t.isNumber(e.s)&&t.isNumber(e.v)&&t.isNumber(e.a)?{space:"HSV",h:e.h,s:e.s,v:e.v,a:e.a}:!1},write:function(e){return{h:e.h,s:e.s,v:e.v,a:e.a}}},HSV_OBJ:{read:function(e){return t.isNumber(e.h)&&t.isNumber(e.s)&&t.isNumber(e.v)?{space:"HSV",h:e.h,s:e.s,v:e.v}:!1},write:function(e){return{h:e.h,s:e.s,v:e.v}}}}}];return o}(n.color.toString,n.utils.common),n.GUI=n.gui.GUI=function(e,t,n,i,o,r,s,a,l,d,c,u,h,f,p){function _(e,t,n,r){if(void 0===t[n])throw new Error("Object "+t+' has no property "'+n+'"');var s;if(r.color)s=new c(t,n);else{var a=[t,n].concat(r.factoryArgs);s=i.apply(e,a)}r.before instanceof o&&(r.before=r.before.__li),b(e,s),f.addClass(s.domElement,"c");var l=document.createElement("span");f.addClass(l,"property-name"),l.innerHTML=s.property;var d=document.createElement("div");d.appendChild(l),d.appendChild(s.domElement);var u=m(e,d,r.before);return f.addClass(u,D.CLASS_CONTROLLER_ROW),f.addClass(u,typeof s.getValue()),g(e,u,s),e.__controllers.push(s),s}function m(e,t,n){var i=document.createElement("li");return t&&i.appendChild(t),n?e.__ul.insertBefore(i,params.before):e.__ul.appendChild(i),e.onResize(),i}function g(e,t,n){if(n.__li=t,n.__gui=e,p.extend(n,{options:function(t){return arguments.length>1?(n.remove(),_(e,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[p.toArray(arguments)]})):p.isArray(t)||p.isObject(t)?(n.remove(),_(e,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[t]})):void 0},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 l){var i=new a(n.object,n.property,{min:n.__min,max:n.__max,step:n.__step});p.each(["updateDisplay","onChange","onFinishChange"],function(e){var t=n[e],o=i[e];n[e]=i[e]=function(){var e=Array.prototype.slice.call(arguments);return t.apply(n,e),o.apply(i,e)}}),f.addClass(t,"has-slider"),n.domElement.insertBefore(i.domElement,n.domElement.firstElementChild)}else if(n instanceof a){var o=function(t){return p.isNumber(n.__min)&&p.isNumber(n.__max)?(n.remove(),_(e,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[n.__min,n.__max,n.__step]})):t};n.min=p.compose(o,n.min),n.max=p.compose(o,n.max)}else n instanceof r?(f.bind(t,"click",function(){f.fakeEvent(n.__checkbox,"click")}),f.bind(n.__checkbox,"click",function(e){e.stopPropagation()})):n instanceof s?(f.bind(t,"click",function(){f.fakeEvent(n.__button,"click")}),f.bind(t,"mouseover",function(){f.addClass(n.__button,"hover")}),f.bind(t,"mouseout",function(){f.removeClass(n.__button,"hover")})):n instanceof c&&(f.addClass(t,"color"),n.updateDisplay=p.compose(function(e){return t.style.borderLeftColor=n.__color.toString(),e},n.updateDisplay),n.updateDisplay());n.setValue=p.compose(function(t){return e.getRoot().__preset_select&&n.isModified()&&k(e.getRoot(),!0),t},n.setValue)}function b(e,t){var n=e.getRoot(),i=n.__rememberedObjects.indexOf(t.object);if(-1!=i){var o=n.__rememberedObjectIndecesToControllers[i];if(void 0===o&&(o={},n.__rememberedObjectIndecesToControllers[i]=o),o[t.property]=t,n.load&&n.load.remembered){var r,s=n.load.remembered;if(s[e.preset])r=s[e.preset];else{if(!s[B])return;r=s[B]}if(r[i]&&void 0!==r[i][t.property]){var a=r[i][t.property];t.initialValue=a,t.setValue(a)}}}}function v(e,t){return document.location.href+"."+t}function y(e){function t(){d.style.display=e.useLocalStorage?"block":"none"}var n=e.__save_row=document.createElement("li");f.addClass(e.domElement,"has-save"),e.__ul.insertBefore(n,e.__ul.firstChild),f.addClass(n,"save-row");var i=document.createElement("span");i.innerHTML=" ",f.addClass(i,"button gears");var o=document.createElement("span");o.innerHTML="Save",f.addClass(o,"button"),f.addClass(o,"save");var r=document.createElement("span");r.innerHTML="New",f.addClass(r,"button"),f.addClass(r,"save-as");var s=document.createElement("span");s.innerHTML="Revert",f.addClass(s,"button"),f.addClass(s,"revert");var a=e.__preset_select=document.createElement("select");if(e.load&&e.load.remembered?p.each(e.load.remembered,function(t,n){E(e,n,n==e.preset)}):E(e,B,!1),f.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}),n.appendChild(a),n.appendChild(i),n.appendChild(o),n.appendChild(r),n.appendChild(s),M){var l=document.getElementById("dg-save-locally"),d=document.getElementById("dg-local-explain");l.style.display="block";var c=document.getElementById("dg-local-storage");"true"===localStorage.getItem(v(e,"isLocal"))&&c.setAttribute("checked","checked"),t(),f.bind(c,"change",function(){e.useLocalStorage=!e.useLocalStorage,t()})}var u=document.getElementById("dg-new-constructor");f.bind(u,"keydown",function(e){!e.metaKey||67!==e.which&&67!=e.keyCode||N.hide()}),f.bind(i,"click",function(){u.innerHTML=JSON.stringify(e.getSaveObject(),void 0,2),N.show(),u.focus(),u.select()}),f.bind(o,"click",function(){e.save()}),f.bind(r,"click",function(){var t=prompt("Enter a new preset name.");t&&e.saveAs(t)}),f.bind(s,"click",function(){e.revert()})}function x(e){function t(t){return t.preventDefault(),o=t.clientX,f.addClass(e.__closeButton,D.CLASS_DRAG),f.bind(window,"mousemove",n),f.bind(window,"mouseup",i),!1}function n(t){return t.preventDefault(),e.width+=o-t.clientX,e.onResize(),o=t.clientX,!1}function i(){f.removeClass(e.__closeButton,D.CLASS_DRAG),f.unbind(window,"mousemove",n),f.unbind(window,"mouseup",i)}e.__resize_handle=document.createElement("div"),p.extend(e.__resize_handle.style,{width:"6px",marginLeft:"-3px",height:"200px",cursor:"ew-resize",position:"absolute"});var o;f.bind(e.__resize_handle,"mousedown",t),f.bind(e.__closeButton,"mousedown",t),e.domElement.insertBefore(e.__resize_handle,e.domElement.firstElementChild)}function w(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 C(e,t){var n={};return p.each(e.__rememberedObjects,function(i,o){var r={},s=e.__rememberedObjectIndecesToControllers[o];p.each(s,function(e,n){r[n]=t?e.initialValue:e.getValue()}),n[o]=r}),n}function E(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 A(e){for(var t=0;t<e.__preset_select.length;t++)e.__preset_select[t].value==e.preset&&(e.__preset_select.selectedIndex=t)}function k(e,t){var n=e.__preset_select[e.__preset_select.selectedIndex];t?n.innerHTML=n.value+"*":n.innerHTML=n.value}function S(e){0!=e.length&&u(function(){S(e)}),p.each(e,function(e){e.updateDisplay()})}e.inject(n);var N,R,O="dg",L=72,T=20,B="Default",M=function(){try{return"localStorage"in window&&null!==window.localStorage}catch(e){return!1}}(),H=!0,F=!1,V=[],D=function(e){function t(){localStorage.setItem(v(i,"gui"),JSON.stringify(i.getSaveObject()))}function n(){var e=i.getRoot();e.width+=1,p.defer(function(){e.width-=1})}var i=this;this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),f.addClass(this.domElement,O),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],e=e||{},e=p.defaults(e,{autoPlace:!0,width:D.DEFAULT_WIDTH}),e=p.defaults(e,{resizable:e.autoPlace,hideable:e.autoPlace}),p.isUndefined(e.load)?e.load={preset:B}:e.preset&&(e.load.preset=e.preset),p.isUndefined(e.parent)&&e.hideable&&V.push(this),e.resizable=p.isUndefined(e.parent)&&e.resizable,e.autoPlace&&p.isUndefined(e.scrollable)&&(e.scrollable=!0);var o=M&&"true"===localStorage.getItem(v(this,"isLocal"));if(Object.defineProperties(this,{parent:{get:function(){return e.parent}},scrollable:{get:function(){return e.scrollable}},autoPlace:{get:function(){return e.autoPlace}},preset:{get:function(){return i.parent?i.getRoot().preset:e.load.preset},set:function(t){i.parent?i.getRoot().preset=t:e.load.preset=t,A(this),i.revert()}},width:{get:function(){return e.width},set:function(t){e.width=t,w(i,t)}},name:{get:function(){return e.name},set:function(t){e.name=t,s&&(s.innerHTML=e.name)}},closed:{get:function(){return e.closed},set:function(t){e.closed=t,e.closed?f.addClass(i.__ul,D.CLASS_CLOSED):f.removeClass(i.__ul,D.CLASS_CLOSED),this.onResize(),i.__closeButton&&(i.__closeButton.innerHTML=t?D.TEXT_OPEN:D.TEXT_CLOSED)}},load:{get:function(){return e.load}},useLocalStorage:{get:function(){return o},set:function(e){M&&(o=e,e?f.bind(window,"unload",t):f.unbind(window,"unload",t),localStorage.setItem(v(i,"isLocal"),e))}}}),p.isUndefined(e.parent)){if(e.closed=!1,f.addClass(this.domElement,D.CLASS_MAIN),f.makeSelectable(this.domElement,!1),M&&o){i.useLocalStorage=!0;var r=localStorage.getItem(v(this,"gui"));r&&(e.load=JSON.parse(r))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=D.TEXT_CLOSED,f.addClass(this.__closeButton,D.CLASS_CLOSE_BUTTON),this.domElement.appendChild(this.__closeButton),f.bind(this.__closeButton,"click",function(){i.closed=!i.closed})}else{void 0===e.closed&&(e.closed=!0);var s=document.createTextNode(e.name);f.addClass(s,"controller-name");var a=m(i,s),l=function(e){return e.preventDefault(),i.closed=!i.closed,!1};f.addClass(this.__ul,D.CLASS_CLOSED),f.addClass(a,"title"),f.bind(a,"click",l),e.closed||(this.closed=!1)}e.autoPlace&&(p.isUndefined(e.parent)&&(H&&(R=document.createElement("div"),f.addClass(R,O),f.addClass(R,D.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(R),H=!1),R.appendChild(this.domElement),f.addClass(this.domElement,D.CLASS_AUTO_PLACE)),this.parent||w(i,e.width)),f.bind(window,"resize",function(){i.onResize()}),f.bind(this.__ul,"webkitTransitionEnd",function(){i.onResize()}),f.bind(this.__ul,"transitionend",function(){i.onResize()}),f.bind(this.__ul,"oTransitionEnd",function(){i.onResize()}),this.onResize(),e.resizable&&x(this);i.getRoot();e.parent||n()};return D.toggleHide=function(){F=!F,p.each(V,function(e){e.domElement.style.zIndex=F?-999:999,e.domElement.style.opacity=F?0:1})},D.CLASS_AUTO_PLACE="a",D.CLASS_AUTO_PLACE_CONTAINER="ac",D.CLASS_MAIN="main",D.CLASS_CONTROLLER_ROW="cr",D.CLASS_TOO_TALL="taller-than-window",D.CLASS_CLOSED="closed",D.CLASS_CLOSE_BUTTON="close-button",D.CLASS_DRAG="drag",D.DEFAULT_WIDTH=245,D.TEXT_CLOSED="Close Controls",D.TEXT_OPEN="Open Controls",f.bind(window,"keydown",function(e){"text"===document.activeElement.type||e.which!==L&&e.keyCode!=L||D.toggleHide()},!1),p.extend(D.prototype,{add:function(e,t){return _(this,e,t,{factoryArgs:Array.prototype.slice.call(arguments,2)})},addColor:function(e,t){return _(this,e,t,{color:!0})},remove:function(e){this.__ul.removeChild(e.__li),this.__controllers.slice(this.__controllers.indexOf(e),1);var t=this;p.defer(function(){t.onResize()})},destroy:function(){this.autoPlace&&R.removeChild(this.domElement)},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 D(t);this.__folders[e]=n;var i=m(this,n.domElement);return f.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=f.getOffset(e.__ul).top,n=0;p.each(e.__ul.childNodes,function(t){e.autoPlace&&t===e.__save_row||(n+=f.getHeight(t))}),window.innerHeight-t-T<n?(f.addClass(e.domElement,D.CLASS_TOO_TALL),e.__ul.style.height=window.innerHeight-t-T+"px"):(f.removeClass(e.domElement,D.CLASS_TOO_TALL),e.__ul.style.height="auto")}e.__resize_handle&&p.defer(function(){e.__resize_handle.style.height=e.__ul.offsetHeight+"px"}),e.__closeButton&&(e.__closeButton.style.width=e.width+"px")},remember:function(){if(p.isUndefined(N)&&(N=new h,N.domElement.innerHTML=t),this.parent)throw new Error("You can only call remember on a top level GUI.");var e=this;p.each(Array.prototype.slice.call(arguments),function(t){0==e.__rememberedObjects.length&&y(e),-1==e.__rememberedObjects.indexOf(t)&&e.__rememberedObjects.push(t)}),this.autoPlace&&w(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]=C(this)),e.folders={},p.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]=C(this),k(this,!1)},saveAs:function(e){this.load.remembered||(this.load.remembered={},this.load.remembered[B]=C(this,!0)),this.load.remembered[e]=C(this),this.preset=e,E(this,e,!0)},revert:function(e){p.each(this.__controllers,function(t){this.getRoot().load.remembered?b(e||this.getRoot(),t):t.setValue(t.initialValue)},this),p.each(this.__folders,function(e){e.revert(e)}),e||k(this.getRoot(),!1)},listen:function(e){var t=0==this.__listening.length;this.__listening.push(e),t&&S(this.__listening)}}),D}(n.utils.css,'<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>',".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity 0.1s linear;-o-transition:opacity 0.1s linear;-moz-transition:opacity 0.1s linear;transition:opacity 0.1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity 0.1s linear;-o-transition:opacity 0.1s linear;-moz-transition:opacity 0.1s linear;transition:opacity 0.1s linear;border:0;position:absolute;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-x:hidden}.dg.a.has-save ul{margin-top:27px}.dg.a.has-save ul.closed{margin-top:0}.dg.a .save-row{position:fixed;top:0;z-index:1002}.dg li{-webkit-transition:height 0.1s ease-out;-o-transition:height 0.1s ease-out;-moz-transition:height 0.1s ease-out;transition:height 0.1s ease-out}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;overflow:hidden;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li > *{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .c{float:left;width:60%}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:9px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{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;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2fa1d6}.dg .cr.number input[type=text]{color:#2fa1d6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2fa1d6}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n",n.controllers.factory=function(e,t,n,i,o,r,s){return function(a,l){var d=a[l];return s.isArray(arguments[2])||s.isObject(arguments[2])?new e(a,l,arguments[2]):s.isNumber(d)?s.isNumber(arguments[2])&&s.isNumber(arguments[3])?new n(a,l,arguments[2],arguments[3]):new t(a,l,{min:arguments[2],max:arguments[3]}):s.isString(d)?new i(a,l):s.isFunction(d)?new o(a,l,""):s.isBoolean(d)?new r(a,l):void 0}}(n.controllers.OptionController,n.controllers.NumberControllerBox,n.controllers.NumberControllerSlider,n.controllers.StringController=function(e,t,n){var i=function(e,n){function o(){s.setValue(s.__input.value)}function r(){s.__onFinishChange&&s.__onFinishChange.call(s,s.getValue())}i.superclass.call(this,e,n);var s=this;this.__input=document.createElement("input"),this.__input.setAttribute("type","text"),t.bind(this.__input,"keyup",o),t.bind(this.__input,"change",o),t.bind(this.__input,"blur",r),t.bind(this.__input,"keydown",function(e){13===e.keyCode&&this.blur()}),this.updateDisplay(),this.domElement.appendChild(this.__input)};return i.superclass=e,n.extend(i.prototype,e.prototype,{updateDisplay:function(){return t.isActive(this.__input)||(this.__input.value=this.getValue()),i.superclass.prototype.updateDisplay.call(this)}}),i}(n.controllers.Controller,n.dom.dom,n.utils.common),n.controllers.FunctionController,n.controllers.BooleanController,n.utils.common),n.controllers.Controller,n.controllers.BooleanController,n.controllers.FunctionController,n.controllers.NumberControllerBox,n.controllers.NumberControllerSlider,n.controllers.OptionController,n.controllers.ColorController=function(e,t,n,i,o){function r(e,t,n,i){e.style.background="",o.each(l,function(o){e.style.cssText+="background: "+o+"linear-gradient("+t+", "+n+" 0%, "+i+" 100%); "})}function s(e){e.style.background="",e.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",e.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",e.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);"}var a=function(e,l){function d(e){f(e),t.bind(window,"mousemove",f),t.bind(window,"mouseup",c)}function c(){t.unbind(window,"mousemove",f),t.unbind(window,"mouseup",c)}function u(){var e=i(this.value);e!==!1?(_.__color.__state=e,_.setValue(_.__color.toOriginal())):this.value=_.__color.toString()}function h(){t.unbind(window,"mousemove",p),t.unbind(window,"mouseup",h)}function f(e){e.preventDefault();var n=t.getWidth(_.__saturation_field),i=t.getOffset(_.__saturation_field),o=(e.clientX-i.left+document.body.scrollLeft)/n,r=1-(e.clientY-i.top+document.body.scrollTop)/n;return r>1?r=1:0>r&&(r=0),o>1?o=1:0>o&&(o=0),_.__color.v=r,_.__color.s=o,_.setValue(_.__color.toOriginal()),!1}function p(e){e.preventDefault();var n=t.getHeight(_.__hue_field),i=t.getOffset(_.__hue_field),o=1-(e.clientY-i.top+document.body.scrollTop)/n;return o>1?o=1:0>o&&(o=0),_.__color.h=360*o,_.setValue(_.__color.toOriginal()),!1}a.superclass.call(this,e,l),this.__color=new n(this.getValue()),this.__temp=new n(0);var _=this;this.domElement=document.createElement("div"),t.makeSelectable(this.domElement,!1),this.__selector=document.createElement("div"),this.__selector.className="selector",this.__saturation_field=document.createElement("div"),this.__saturation_field.className="saturation-field",this.__field_knob=document.createElement("div"),this.__field_knob.className="field-knob",this.__field_knob_border="2px solid ",this.__hue_knob=document.createElement("div"),this.__hue_knob.className="hue-knob",this.__hue_field=document.createElement("div"),this.__hue_field.className="hue-field",this.__input=document.createElement("input"),this.__input.type="text",this.__input_textShadow="0 1px 1px ",t.bind(this.__input,"keydown",function(e){13===e.keyCode&&u.call(this)}),t.bind(this.__input,"blur",u),t.bind(this.__selector,"mousedown",function(e){t.addClass(this,"drag").bind(window,"mouseup",function(e){t.removeClass(_.__selector,"drag")})});var m=document.createElement("div");o.extend(this.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),o.extend(this.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:this.__field_knob_border+(this.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),o.extend(this.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),o.extend(this.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),o.extend(m.style,{width:"100%",height:"100%",background:"none"}),r(m,"top","rgba(0,0,0,0)","#000"),o.extend(this.__hue_field.style,{width:"15px",height:"100px",display:"inline-block",border:"1px solid #555",cursor:"ns-resize"}),s(this.__hue_field),o.extend(this.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:this.__input_textShadow+"rgba(0,0,0,0.7)"}),t.bind(this.__saturation_field,"mousedown",d),t.bind(this.__field_knob,"mousedown",d),t.bind(this.__hue_field,"mousedown",function(e){p(e),t.bind(window,"mousemove",p),t.bind(window,"mouseup",h)}),this.__saturation_field.appendChild(m),this.__selector.appendChild(this.__field_knob),this.__selector.appendChild(this.__saturation_field),this.__selector.appendChild(this.__hue_field),this.__hue_field.appendChild(this.__hue_knob),this.domElement.appendChild(this.__input),this.domElement.appendChild(this.__selector),this.updateDisplay()};a.superclass=e,o.extend(a.prototype,e.prototype,{updateDisplay:function(){var e=i(this.getValue());if(e!==!1){var t=!1;o.each(n.COMPONENTS,function(n){return o.isUndefined(e[n])||o.isUndefined(this.__color.__state[n])||e[n]===this.__color.__state[n]?void 0:(t=!0,{})},this),t&&o.extend(this.__color.__state,e)}o.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var s=this.__color.v<.5||this.__color.s>.5?255:0,a=255-s;o.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toString(),border:this.__field_knob_border+"rgb("+s+","+s+","+s+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,r(this.__saturation_field,"left","#fff",this.__temp.toString()),o.extend(this.__input.style,{backgroundColor:this.__input.value=this.__color.toString(),color:"rgb("+s+","+s+","+s+")",textShadow:this.__input_textShadow+"rgba("+a+","+a+","+a+",.7)"})}});var l=["-moz-","-o-","-webkit-","-ms-",""];return a}(n.controllers.Controller,n.dom.dom,n.color.Color=function(e,t,n,i){function o(e,t,n){Object.defineProperty(e,t,{get:function(){return"RGB"===this.__state.space?this.__state[t]:(s(this,t,n),this.__state[t])},set:function(e){"RGB"!==this.__state.space&&(s(this,t,n),this.__state.space="RGB"),this.__state[t]=e}})}function r(e,t){Object.defineProperty(e,t,{get:function(){return"HSV"===this.__state.space?this.__state[t]:(a(this),this.__state[t])},set:function(e){"HSV"!==this.__state.space&&(a(this),this.__state.space="HSV"),this.__state[t]=e}})}function s(e,n,o){if("HEX"===e.__state.space)e.__state[n]=t.component_from_hex(e.__state.hex,o);else{if("HSV"!==e.__state.space)throw"Corrupted color state";i.extend(e.__state,t.hsv_to_rgb(e.__state.h,e.__state.s,e.__state.v))}}function a(e){var n=t.rgb_to_hsv(e.r,e.g,e.b);i.extend(e.__state,{s:n.s,v:n.v}),i.isNaN(n.h)?i.isUndefined(e.__state.h)&&(e.__state.h=0):e.__state.h=n.h}var l=function(){if(this.__state=e.apply(this,arguments),this.__state===!1)throw"Failed to interpret color arguments";this.__state.a=this.__state.a||1};return l.COMPONENTS=["r","g","b","h","s","v","hex","a"],i.extend(l.prototype,{toString:function(){return n(this)},toOriginal:function(){return this.__state.conversion.write(this)}}),o(l.prototype,"r",2),o(l.prototype,"g",1),o(l.prototype,"b",0),r(l.prototype,"h"),r(l.prototype,"s"),r(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=t.rgb_to_hex(this.r,this.g,this.b)),this.__state.hex},set:function(e){this.__state.space="HEX",this.__state.hex=e}}),l}(n.color.interpret,n.color.math=function(){var e;return{hsv_to_rgb:function(e,t,n){var i=Math.floor(e/60)%6,o=e/60-Math.floor(e/60),r=n*(1-t),s=n*(1-o*t),a=n*(1-(1-o)*t),l=[[n,a,r],[s,n,r],[r,n,a],[r,s,n],[a,r,n],[n,r,s]][i];return{r:255*l[0],g:255*l[1],b:255*l[2]}},rgb_to_hsv:function(e,t,n){var i,o,r=Math.min(e,t,n),s=Math.max(e,t,n),a=s-r;return 0==s?{h:NaN,s:0,v:0}:(o=a/s,i=e==s?(t-n)/a:t==s?2+(n-e)/a:4+(e-t)/a,i/=6,0>i&&(i+=1),{h:360*i,s:o,v:s/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(t,n,i){return i<<(e=8*n)|t&~(255<<e)}}}(),n.color.toString,n.utils.common),n.color.interpret,n.utils.common),n.utils.requestAnimationFrame=function(){return window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(e,t){window.setTimeout(e,1e3/60)}}(),n.dom.CenteredDiv=function(e,t){var n=function(){this.backgroundElement=document.createElement("div"),t.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"}),e.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),t.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var n=this;e.bind(this.backgroundElement,"click",function(){n.hide()})};return n.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(),t.defer(function(){e.backgroundElement.style.opacity=1,e.domElement.style.opacity=1,e.domElement.style.webkitTransform="scale(1)"})},n.prototype.hide=function(){var t=this,n=function(){t.domElement.style.display="none",t.backgroundElement.style.display="none",e.unbind(t.domElement,"webkitTransitionEnd",n),e.unbind(t.domElement,"transitionend",n),e.unbind(t.domElement,"oTransitionEnd",n)};e.bind(this.domElement,"webkitTransitionEnd",n),e.bind(this.domElement,"transitionend",n),e.bind(this.domElement,"oTransitionEnd",n),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"},n.prototype.layout=function(){this.domElement.style.left=window.innerWidth/2-e.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-e.getHeight(this.domElement)/2+"px"},n}(n.dom.dom,n.utils.common),n.dom.dom,n.utils.common)},function(e,t,n){var i=function(){function e(e,t,n){var i=document.createElement(e);return i.id=t,i.style.cssText=n,i}function t(t,n,i){var o=e("div",t,"padding:0 0 3px 3px;text-align:left;background:"+i),r=e("div",t+"Text","font-family:Helvetica,Arial,sans-serif;font-size:9px;font-weight:bold;line-height:15px;color:"+n);r.innerHTML=t.toUpperCase(),o.appendChild(r);var s=e("div",t+"Graph","width:74px;height:30px;background:"+n);o.appendChild(s);for(var a=0;74>a;a++)s.appendChild(e("span","","width:1px;height:30px;float:left;opacity:0.9;background:"+i));return o}function n(e){for(var t=d.children,n=0;n<t.length;n++)t[n].style.display=n===e?"block":"none";l=e}function i(e,t){var n=e.appendChild(e.firstChild);n.style.height=Math.min(30,30-30*t)+"px"}var o=self.performance&&self.performance.now?self.performance.now.bind(performance):Date.now,r=o(),s=r,a=0,l=0,d=e("div","stats","width:80px;opacity:0.9;cursor:pointer");d.addEventListener("mousedown",function(e){e.preventDefault(),n(++l%d.children.length)},!1);var c=0,u=1/0,h=0,f=t("fps","#0ff","#002"),p=f.children[0],_=f.children[1];d.appendChild(f);var m=0,g=1/0,b=0,v=t("ms","#0f0","#020"),y=v.children[0],x=v.children[1];if(d.appendChild(v),self.performance&&self.performance.memory){var w=0,C=1/0,E=0,A=t("mb","#f08","#201"),k=A.children[0],S=A.children[1];d.appendChild(A)}return n(l),{REVISION:14,domElement:d,setMode:n,begin:function(){r=o()},end:function(){var e=o();if(m=e-r,g=Math.min(g,m),b=Math.max(b,m),y.textContent=(0|m)+" MS ("+(0|g)+"-"+(0|b)+")",i(x,m/200),a++,e>s+1e3&&(c=Math.round(1e3*a/(e-s)),u=Math.min(u,c),h=Math.max(h,c),p.textContent=c+" FPS ("+u+"-"+h+")",i(_,c/100),s=e,a=0,void 0!==w)){var t=performance.memory.usedJSHeapSize,n=performance.memory.jsHeapSizeLimit;w=Math.round(9.54e-7*t),C=Math.min(C,w),E=Math.max(E,w),k.textContent=w+" MB ("+C+"-"+E+")",i(S,t/n)}return e},update:function(){r=this.end()}}};e.exports=i},function(e,t,n){function i(e,t){for(var n=0;n<e.length;n++){var i=e[n],o=u[i.id];if(o){o.refs++;for(var r=0;r<o.parts.length;r++)o.parts[r](i.parts[r]);for(;r<i.parts.length;r++)o.parts.push(a(i.parts[r],t))}else{for(var s=[],r=0;r<i.parts.length;r++)s.push(a(i.parts[r],t));u[i.id]={id:i.id,refs:1,parts:s}}}}function o(e){for(var t=[],n={},i=0;i<e.length;i++){var o=e[i],r=o[0],s=o[1],a=o[2],l=o[3],d={css:s,media:a,sourceMap:l};n[r]?n[r].parts.push(d):t.push(n[r]={id:r,parts:[d]})}return t}function r(){var e=document.createElement("style"),t=p();return e.type="text/css",t.appendChild(e),e}function s(){var e=document.createElement("link"),t=p();return e.rel="stylesheet",t.appendChild(e),e}function a(e,t){var n,i,o;if(t.singleton){var a=m++;n=_||(_=r()),i=l.bind(null,n,a,!1),o=l.bind(null,n,a,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=s(),i=c.bind(null,n),o=function(){n.parentNode.removeChild(n),n.href&&URL.revokeObjectURL(n.href)}):(n=r(),i=d.bind(null,n),o=function(){n.parentNode.removeChild(n)});return i(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;i(e=t)}else o()}}function l(e,t,n,i){var o=n?"":i.css;if(e.styleSheet)e.styleSheet.cssText=g(t,o);else{var r=document.createTextNode(o),s=e.childNodes;s[t]&&e.removeChild(s[t]),s.length?e.insertBefore(r,s[t]):e.appendChild(r)}}function d(e,t){var n=t.css,i=t.media;t.sourceMap;if(i&&e.setAttribute("media",i),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}function c(e,t){var n=t.css,i=(t.media,t.sourceMap);i&&(n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(i))))+" */");var o=new Blob([n],{type:"text/css"}),r=e.href;e.href=URL.createObjectURL(o),r&&URL.revokeObjectURL(r)}var u={},h=function(e){var t;return function(){return"undefined"==typeof t&&(t=e.apply(this,arguments)),t}},f=h(function(){return/msie [6-9]\b/.test(window.navigator.userAgent.toLowerCase())}),p=h(function(){return document.head||document.getElementsByTagName("head")[0]}),_=null,m=0;e.exports=function(e,t){t=t||{},"undefined"==typeof t.singleton&&(t.singleton=f());var n=o(e);return i(n,t),function(e){for(var r=[],s=0;s<n.length;s++){var a=n[s],l=u[a.id];l.refs--,r.push(l)}if(e){var d=o(e);i(d,t)}for(var s=0;s<r.length;s++){var l=r[s];if(0===l.refs){for(var c=0;c<l.parts.length;c++)l.parts[c]();delete u[l.id]}}}};var g=function(){var e=[];return function(t,n){return e[t]=n,e.filter(Boolean).join("\n")}}()},function(e,t,n){var i=n(3);"string"==typeof i&&(i=[[e.id,i,""]]);n(9)(i,{});i.locals&&(e.exports=i.locals)}]);