1 |
- (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d210fa1"],{b9d8:function(e,t,n){"use strict";function o(e){if(e&&"undefined"!==typeof window){var t=document.createElement("style");return t.setAttribute("type","text/css"),t.innerHTML=e,document.head.appendChild(t),e}}function i(e,t){var n=e.__state.conversionName.toString(),o=Math.round(e.r),i=Math.round(e.g),r=Math.round(e.b),s=e.a,a=Math.round(e.h),l=e.s.toFixed(1),d=e.v.toFixed(1);if(t||"THREE_CHAR_HEX"===n||"SIX_CHAR_HEX"===n){var c=e.hex.toString(16);while(c.length<6)c="0"+c;return"#"+c}return"CSS_RGB"===n?"rgb("+o+","+i+","+r+")":"CSS_RGBA"===n?"rgba("+o+","+i+","+r+","+s+")":"HEX"===n?"0x"+e.hex.toString(16):"RGB_ARRAY"===n?"["+o+","+i+","+r+"]":"RGBA_ARRAY"===n?"["+o+","+i+","+r+","+s+"]":"RGB_OBJ"===n?"{r:"+o+",g:"+i+",b:"+r+"}":"RGBA_OBJ"===n?"{r:"+o+",g:"+i+",b:"+r+",a:"+s+"}":"HSV_OBJ"===n?"{h:"+a+",s:"+l+",v:"+d+"}":"HSVA_OBJ"===n?"{h:"+a+",s:"+l+",v:"+d+",a:"+s+"}":"unknown format"}n.d(t,"a",(function(){return xe}));var r=Array.prototype.forEach,s=Array.prototype.slice,a={BREAK:{},extend:function(e){return this.each(s.call(arguments,1),(function(t){var n=this.isObject(t)?Object.keys(t):[];n.forEach(function(n){this.isUndefined(t[n])||(e[n]=t[n])}.bind(this))}),this),e},defaults:function(e){return this.each(s.call(arguments,1),(function(t){var n=this.isObject(t)?Object.keys(t):[];n.forEach(function(n){this.isUndefined(e[n])&&(e[n]=t[n])}.bind(this))}),this),e},compose:function(){var e=s.call(arguments);return function(){for(var t=s.call(arguments),n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},each:function(e,t,n){if(e)if(r&&e.forEach&&e.forEach===r)e.forEach(t,n);else if(e.length===e.length+0){var o=void 0,i=void 0;for(o=0,i=e.length;o<i;o++)if(o in e&&t.call(n,e[o],o)===this.BREAK)return}else for(var s in e)if(t.call(n,e[s],s)===this.BREAK)return},defer:function(e){setTimeout(e,0)},debounce:function(e,t,n){var o=void 0;return function(){var i=this,r=arguments;function s(){o=null,n||e.apply(i,r)}var a=n||!o;clearTimeout(o),o=setTimeout(s,t),a&&e.apply(i,r)}},toArray:function(e){return e.toArray?e.toArray():s.call(e)},isUndefined:function(e){return void 0===e},isNull:function(e){return null===e},isNaN:function(e){function 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 e instanceof Function}},l=[{litmus:a.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},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},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},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}}},{litmus:a.isNumber,conversions:{HEX:{read:function(e){return{space:"HEX",hex:e,conversionName:"HEX"}},write:function(e){return e.hex}}}},{litmus:a.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:a.isObject,conversions:{RGBA_OBJ:{read:function(e){return!!(a.isNumber(e.r)&&a.isNumber(e.g)&&a.isNumber(e.b)&&a.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!!(a.isNumber(e.r)&&a.isNumber(e.g)&&a.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!!(a.isNumber(e.h)&&a.isNumber(e.s)&&a.isNumber(e.v)&&a.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!!(a.isNumber(e.h)&&a.isNumber(e.s)&&a.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}}}}}],d=void 0,c=void 0,u=function(){c=!1;var e=arguments.length>1?a.toArray(arguments):arguments[0];return a.each(l,(function(t){if(t.litmus(e))return a.each(t.conversions,(function(t,n){if(d=t.read(e),!1===c&&!1!==d)return c=d,d.conversionName=n,d.conversion=t,a.BREAK})),a.BREAK})),c},_=void 0,h={hsv_to_rgb:function(e,t,n){var o=Math.floor(e/60)%6,i=e/60-Math.floor(e/60),r=n*(1-t),s=n*(1-i*t),a=n*(1-(1-i)*t),l=[[n,a,r],[s,n,r],[r,n,a],[r,s,n],[a,r,n],[n,r,s]][o];return{r:255*l[0],g:255*l[1],b:255*l[2]}},rgb_to_hsv:function(e,t,n){var o=Math.min(e,t,n),i=Math.max(e,t,n),r=i-o,s=void 0,a=void 0;return 0===i?{h:NaN,s:0,v:0}:(a=r/i,s=e===i?(t-n)/r:t===i?2+(n-e)/r:4+(e-t)/r,s/=6,s<0&&(s+=1),{h:360*s,s:a,v:i/255})},rgb_to_hex:function(e,t,n){var o=this.hex_with_component(0,2,e);return o=this.hex_with_component(o,1,t),o=this.hex_with_component(o,0,n),o},component_from_hex:function(e,t){return e>>8*t&255},hex_with_component:function(e,t,n){return n<<(_=8*t)|e&~(255<<_)}},p="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},f=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},m=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),g=function e(t,n,o){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var r=Object.getPrototypeOf(t);return null===r?void 0:e(r,n,o)}if("value"in i)return i.value;var s=i.get;return void 0!==s?s.call(o):void 0},b=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)},v=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t},y=function(){function e(){if(f(this,e),this.__state=u.apply(this,arguments),!1===this.__state)throw new Error("Failed to interpret color arguments");this.__state.a=this.__state.a||1}return m(e,[{key:"toString",value:function(){return i(this)}},{key:"toHexString",value:function(){return i(this,!0)}},{key:"toOriginal",value:function(){return this.__state.conversion.write(this)}}]),e}();function w(e,t,n){Object.defineProperty(e,t,{get:function(){return"RGB"===this.__state.space||y.recalculateRGB(this,t,n),this.__state[t]},set:function(e){"RGB"!==this.__state.space&&(y.recalculateRGB(this,t,n),this.__state.space="RGB"),this.__state[t]=e}})}function x(e,t){Object.defineProperty(e,t,{get:function(){return"HSV"===this.__state.space||y.recalculateHSV(this),this.__state[t]},set:function(e){"HSV"!==this.__state.space&&(y.recalculateHSV(this),this.__state.space="HSV"),this.__state[t]=e}})}y.recalculateRGB=function(e,t,n){if("HEX"===e.__state.space)e.__state[t]=h.component_from_hex(e.__state.hex,n);else{if("HSV"!==e.__state.space)throw new Error("Corrupted color state");a.extend(e.__state,h.hsv_to_rgb(e.__state.h,e.__state.s,e.__state.v))}},y.recalculateHSV=function(e){var t=h.rgb_to_hsv(e.r,e.g,e.b);a.extend(e.__state,{s:t.s,v:t.v}),a.isNaN(t.h)?a.isUndefined(e.__state.h)&&(e.__state.h=0):e.__state.h=t.h},y.COMPONENTS=["r","g","b","h","s","v","hex","a"],w(y.prototype,"r",2),w(y.prototype,"g",1),w(y.prototype,"b",0),x(y.prototype,"h"),x(y.prototype,"s"),x(y.prototype,"v"),Object.defineProperty(y.prototype,"a",{get:function(){return this.__state.a},set:function(e){this.__state.a=e}}),Object.defineProperty(y.prototype,"hex",{get:function(){return"HEX"!==this.__state.space&&(this.__state.hex=h.rgb_to_hex(this.r,this.g,this.b),this.__state.space="HEX"),this.__state.hex},set:function(e){this.__state.space="HEX",this.__state.hex=e}});var E=function(){function e(t,n){f(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 m(e,[{key:"onChange",value:function(e){return this.__onChange=e,this}},{key:"onFinishChange",value:function(e){return this.__onFinishChange=e,this}},{key:"setValue",value:function(e){return this.object[this.property]=e,this.__onChange&&this.__onChange.call(this,e),this.updateDisplay(),this}},{key:"getValue",value:function(){return this.object[this.property]}},{key:"updateDisplay",value:function(){return this}},{key:"isModified",value:function(){return this.initialValue!==this.getValue()}}]),e}(),C={HTMLEvents:["change"],MouseEvents:["click","mousemove","mousedown","mouseup","mouseover"],KeyboardEvents:["keydown"]},A={};a.each(C,(function(e,t){a.each(e,(function(e){A[e]=t}))}));var k=/(\d+(\.\d+)?)px/;function S(e){if("0"===e||a.isUndefined(e))return 0;var t=e.match(k);return a.isNull(t)?0:parseFloat(t[1])}var O={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 o=n,i=t;a.isUndefined(i)&&(i=!0),a.isUndefined(o)&&(o=!0),e.style.position="absolute",i&&(e.style.left=0,e.style.right=0),o&&(e.style.top=0,e.style.bottom=0)},fakeEvent:function(e,t,n,o){var i=n||{},r=A[t];if(!r)throw new Error("Event type "+t+" not supported.");var s=document.createEvent(r);switch(r){case"MouseEvents":var l=i.x||i.clientX||0,d=i.y||i.clientY||0;s.initMouseEvent(t,i.bubbles||!1,i.cancelable||!0,window,i.clickCount||1,0,0,l,d,!1,!1,!1,!1,0,null);break;case"KeyboardEvents":var c=s.initKeyboardEvent||s.initKeyEvent;a.defaults(i,{cancelable:!0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,keyCode:void 0,charCode:void 0}),c(t,i.bubbles||!1,i.cancelable,window,i.ctrlKey,i.altKey,i.shiftKey,i.metaKey,i.keyCode,i.charCode);break;default:s.initEvent(t,i.bubbles||!1,i.cancelable||!0);break}a.defaults(s,o),e.dispatchEvent(s)},bind:function(e,t,n,o){var i=o||!1;return e.addEventListener?e.addEventListener(t,n,i):e.attachEvent&&e.attachEvent("on"+t,n),O},unbind:function(e,t,n,o){var i=o||!1;return e.removeEventListener?e.removeEventListener(t,n,i):e.detachEvent&&e.detachEvent("on"+t,n),O},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 O},removeClass:function(e,t){if(t)if(e.className===t)e.removeAttribute("class");else{var n=e.className.split(/ +/),o=n.indexOf(t);-1!==o&&(n.splice(o,1),e.className=n.join(" "))}else e.className=void 0;return O},hasClass:function(e,t){return new RegExp("(?:^|\\s+)"+t+"(?:\\s+|$)").test(e.className)||!1},getWidth:function(e){var t=getComputedStyle(e);return S(t["border-left-width"])+S(t["border-right-width"])+S(t["padding-left"])+S(t["padding-right"])+S(t.width)},getHeight:function(e){var t=getComputedStyle(e);return S(t["border-top-width"])+S(t["border-bottom-width"])+S(t["padding-top"])+S(t["padding-bottom"])+S(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=function(e){function t(e,n){f(this,t);var o=v(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),i=o;function r(){i.setValue(!i.__prev)}return o.__prev=o.getValue(),o.__checkbox=document.createElement("input"),o.__checkbox.setAttribute("type","checkbox"),O.bind(o.__checkbox,"change",r,!1),o.domElement.appendChild(o.__checkbox),o.updateDisplay(),o}return b(t,e),m(t,[{key:"setValue",value:function(e){var n=g(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,e);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),this.__prev=this.getValue(),n}},{key:"updateDisplay",value:function(){return!0===this.getValue()?(this.__checkbox.setAttribute("checked","checked"),this.__checkbox.checked=!0,this.__prev=!0):(this.__checkbox.checked=!1,this.__prev=!1),g(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(E),L=function(e){function t(e,n,o){f(this,t);var i=v(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),r=o,s=i;if(i.__select=document.createElement("select"),a.isArray(r)){var l={};a.each(r,(function(e){l[e]=e})),r=l}return a.each(r,(function(e,t){var n=document.createElement("option");n.innerHTML=t,n.setAttribute("value",e),s.__select.appendChild(n)})),i.updateDisplay(),O.bind(i.__select,"change",(function(){var e=this.options[this.selectedIndex].value;s.setValue(e)})),i.domElement.appendChild(i.__select),i}return b(t,e),m(t,[{key:"setValue",value:function(e){var n=g(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,e);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),n}},{key:"updateDisplay",value:function(){return O.isActive(this.__select)?this:(this.__select.value=this.getValue(),g(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this))}}]),t}(E),R=function(e){function t(e,n){f(this,t);var o=v(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),i=o;function r(){i.setValue(i.__input.value)}function s(){i.__onFinishChange&&i.__onFinishChange.call(i,i.getValue())}return o.__input=document.createElement("input"),o.__input.setAttribute("type","text"),O.bind(o.__input,"keyup",r),O.bind(o.__input,"change",r),O.bind(o.__input,"blur",s),O.bind(o.__input,"keydown",(function(e){13===e.keyCode&&this.blur()})),o.updateDisplay(),o.domElement.appendChild(o.__input),o}return b(t,e),m(t,[{key:"updateDisplay",value:function(){return O.isActive(this.__input)||(this.__input.value=this.getValue()),g(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(E);function B(e){var t=e.toString();return t.indexOf(".")>-1?t.length-t.indexOf(".")-1:0}var N=function(e){function t(e,n,o){f(this,t);var i=v(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),r=o||{};return i.__min=r.min,i.__max=r.max,i.__step=r.step,a.isUndefined(i.__step)?0===i.initialValue?i.__impliedStep=1:i.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(i.initialValue))/Math.LN10))/10:i.__impliedStep=i.__step,i.__precision=B(i.__impliedStep),i}return b(t,e),m(t,[{key:"setValue",value:function(e){var n=e;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),g(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,n)}},{key:"min",value:function(e){return this.__min=e,this}},{key:"max",value:function(e){return this.__max=e,this}},{key:"step",value:function(e){return this.__step=e,this.__impliedStep=e,this.__precision=B(e),this}}]),t}(E);function H(e,t){var n=Math.pow(10,t);return Math.round(e*n)/n}var F=function(e){function t(e,n,o){f(this,t);var i=v(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,o));i.__truncationSuspended=!1;var r=i,s=void 0;function l(){var e=parseFloat(r.__input.value);a.isNaN(e)||r.setValue(e)}function d(){r.__onFinishChange&&r.__onFinishChange.call(r,r.getValue())}function c(){d()}function u(e){var t=s-e.clientY;r.setValue(r.getValue()+t*r.__impliedStep),s=e.clientY}function _(){O.unbind(window,"mousemove",u),O.unbind(window,"mouseup",_),d()}function h(e){O.bind(window,"mousemove",u),O.bind(window,"mouseup",_),s=e.clientY}return i.__input=document.createElement("input"),i.__input.setAttribute("type","text"),O.bind(i.__input,"change",l),O.bind(i.__input,"blur",c),O.bind(i.__input,"mousedown",h),O.bind(i.__input,"keydown",(function(e){13===e.keyCode&&(r.__truncationSuspended=!0,this.blur(),r.__truncationSuspended=!1,d())})),i.updateDisplay(),i.domElement.appendChild(i.__input),i}return b(t,e),m(t,[{key:"updateDisplay",value:function(){return this.__input.value=this.__truncationSuspended?this.getValue():H(this.getValue(),this.__precision),g(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(N);function P(e,t,n,o,i){return o+(e-t)/(n-t)*(i-o)}var D=function(e){function t(e,n,o,i,r){f(this,t);var s=v(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,{min:o,max:i,step:r})),a=s;function l(e){document.activeElement.blur(),O.bind(window,"mousemove",d),O.bind(window,"mouseup",c),d(e)}function d(e){e.preventDefault();var t=a.__background.getBoundingClientRect();return a.setValue(P(e.clientX,t.left,t.right,a.__min,a.__max)),!1}function c(){O.unbind(window,"mousemove",d),O.unbind(window,"mouseup",c),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}function u(e){1===e.touches.length&&(O.bind(window,"touchmove",_),O.bind(window,"touchend",h),_(e))}function _(e){var t=e.touches[0].clientX,n=a.__background.getBoundingClientRect();a.setValue(P(t,n.left,n.right,a.__min,a.__max))}function h(){O.unbind(window,"touchmove",_),O.unbind(window,"touchend",h),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}return s.__background=document.createElement("div"),s.__foreground=document.createElement("div"),O.bind(s.__background,"mousedown",l),O.bind(s.__background,"touchstart",u),O.addClass(s.__background,"slider"),O.addClass(s.__foreground,"slider-fg"),s.updateDisplay(),s.__background.appendChild(s.__foreground),s.domElement.appendChild(s.__background),s}return b(t,e),m(t,[{key:"updateDisplay",value:function(){var e=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*e+"%",g(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(N),V=function(e){function t(e,n,o){f(this,t);var i=v(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n)),r=i;return i.__button=document.createElement("div"),i.__button.innerHTML=void 0===o?"Fire":o,O.bind(i.__button,"click",(function(e){return e.preventDefault(),r.fire(),!1})),O.addClass(i.__button,"button"),i.domElement.appendChild(i.__button),i}return b(t,e),m(t,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),t}(E),j=function(e){function t(e,n){f(this,t);var o=v(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));o.__color=new y(o.getValue()),o.__temp=new y(0);var i=o;o.domElement=document.createElement("div"),O.makeSelectable(o.domElement,!1),o.__selector=document.createElement("div"),o.__selector.className="selector",o.__saturation_field=document.createElement("div"),o.__saturation_field.className="saturation-field",o.__field_knob=document.createElement("div"),o.__field_knob.className="field-knob",o.__field_knob_border="2px solid ",o.__hue_knob=document.createElement("div"),o.__hue_knob.className="hue-knob",o.__hue_field=document.createElement("div"),o.__hue_field.className="hue-field",o.__input=document.createElement("input"),o.__input.type="text",o.__input_textShadow="0 1px 1px ",O.bind(o.__input,"keydown",(function(e){13===e.keyCode&&_.call(this)})),O.bind(o.__input,"blur",_),O.bind(o.__selector,"mousedown",(function(){O.addClass(this,"drag").bind(window,"mouseup",(function(){O.removeClass(i.__selector,"drag")}))})),O.bind(o.__selector,"touchstart",(function(){O.addClass(this,"drag").bind(window,"touchend",(function(){O.removeClass(i.__selector,"drag")}))}));var r=document.createElement("div");function s(e){p(e),O.bind(window,"mousemove",p),O.bind(window,"touchmove",p),O.bind(window,"mouseup",d),O.bind(window,"touchend",d)}function l(e){m(e),O.bind(window,"mousemove",m),O.bind(window,"touchmove",m),O.bind(window,"mouseup",c),O.bind(window,"touchend",c)}function d(){O.unbind(window,"mousemove",p),O.unbind(window,"touchmove",p),O.unbind(window,"mouseup",d),O.unbind(window,"touchend",d),h()}function c(){O.unbind(window,"mousemove",m),O.unbind(window,"touchmove",m),O.unbind(window,"mouseup",c),O.unbind(window,"touchend",c),h()}function _(){var e=u(this.value);!1!==e?(i.__color.__state=e,i.setValue(i.__color.toOriginal())):this.value=i.__color.toString()}function h(){i.__onFinishChange&&i.__onFinishChange.call(i,i.__color.toOriginal())}function p(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=i.__saturation_field.getBoundingClientRect(),n=e.touches&&e.touches[0]||e,o=n.clientX,r=n.clientY,s=(o-t.left)/(t.right-t.left),a=1-(r-t.top)/(t.bottom-t.top);return a>1?a=1:a<0&&(a=0),s>1?s=1:s<0&&(s=0),i.__color.v=a,i.__color.s=s,i.setValue(i.__color.toOriginal()),!1}function m(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=i.__hue_field.getBoundingClientRect(),n=e.touches&&e.touches[0]||e,o=n.clientY,r=1-(o-t.top)/(t.bottom-t.top);return r>1?r=1:r<0&&(r=0),i.__color.h=360*r,i.setValue(i.__color.toOriginal()),!1}return a.extend(o.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),a.extend(o.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:o.__field_knob_border+(o.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),a.extend(o.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),a.extend(o.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),a.extend(r.style,{width:"100%",height:"100%",background:"none"}),I(r,"top","rgba(0,0,0,0)","#000"),a.extend(o.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),M(o.__hue_field),a.extend(o.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:o.__input_textShadow+"rgba(0,0,0,0.7)"}),O.bind(o.__saturation_field,"mousedown",s),O.bind(o.__saturation_field,"touchstart",s),O.bind(o.__field_knob,"mousedown",s),O.bind(o.__field_knob,"touchstart",s),O.bind(o.__hue_field,"mousedown",l),O.bind(o.__hue_field,"touchstart",l),o.__saturation_field.appendChild(r),o.__selector.appendChild(o.__field_knob),o.__selector.appendChild(o.__saturation_field),o.__selector.appendChild(o.__hue_field),o.__hue_field.appendChild(o.__hue_knob),o.domElement.appendChild(o.__input),o.domElement.appendChild(o.__selector),o.updateDisplay(),o}return b(t,e),m(t,[{key:"updateDisplay",value:function(){var e=u(this.getValue());if(!1!==e){var t=!1;a.each(y.COMPONENTS,(function(n){if(!a.isUndefined(e[n])&&!a.isUndefined(this.__color.__state[n])&&e[n]!==this.__color.__state[n])return t=!0,{}}),this),t&&a.extend(this.__color.__state,e)}a.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var n=this.__color.v<.5||this.__color.s>.5?255:0,o=255-n;a.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,I(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),a.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+n+","+n+","+n+")",textShadow:this.__input_textShadow+"rgba("+o+","+o+","+o+",.7)"})}}]),t}(E),z=["-moz-","-o-","-webkit-","-ms-",""];function I(e,t,n,o){e.style.background="",a.each(z,(function(i){e.style.cssText+="background: "+i+"linear-gradient("+t+", "+n+" 0%, "+o+" 100%); "}))}function M(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 G={load:function(e,t){var n=t||document,o=n.createElement("link");o.type="text/css",o.rel="stylesheet",o.href=e,n.getElementsByTagName("head")[0].appendChild(o)},inject:function(e,t){var n=t||document,o=document.createElement("style");o.type="text/css",o.innerHTML=e;var i=n.getElementsByTagName("head")[0];try{i.appendChild(o)}catch(r){}}},U='<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>',X=function(e,t){var n=e[t];return a.isArray(arguments[2])||a.isObject(arguments[2])?new L(e,t,arguments[2]):a.isNumber(n)?a.isNumber(arguments[2])&&a.isNumber(arguments[3])?a.isNumber(arguments[4])?new D(e,t,arguments[2],arguments[3],arguments[4]):new D(e,t,arguments[2],arguments[3]):a.isNumber(arguments[4])?new F(e,t,{min:arguments[2],max:arguments[3],step:arguments[4]}):new F(e,t,{min:arguments[2],max:arguments[3]}):a.isString(n)?new R(e,t):a.isFunction(n)?new V(e,t,""):a.isBoolean(n)?new T(e,t):null};function J(e){setTimeout(e,1e3/60)}var K=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||J,Y=function(){function e(){f(this,e),this.backgroundElement=document.createElement("div"),a.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"}),O.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),a.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;O.bind(this.backgroundElement,"click",(function(){t.hide()}))}return m(e,[{key:"show",value: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(),a.defer((function(){e.backgroundElement.style.opacity=1,e.domElement.style.opacity=1,e.domElement.style.webkitTransform="scale(1)"}))}},{key:"hide",value:function(){var e=this,t=function t(){e.domElement.style.display="none",e.backgroundElement.style.display="none",O.unbind(e.domElement,"webkitTransitionEnd",t),O.unbind(e.domElement,"transitionend",t),O.unbind(e.domElement,"oTransitionEnd",t)};O.bind(this.domElement,"webkitTransitionEnd",t),O.bind(this.domElement,"transitionend",t),O.bind(this.domElement,"oTransitionEnd",t),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"}},{key:"layout",value:function(){this.domElement.style.left=window.innerWidth/2-O.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-O.getHeight(this.domElement)/2+"px"}}]),e}(),W=o(".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 .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .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 .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;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;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .c{float:left;width:60%;position:relative}.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:7px}.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 .cr.color{overflow:visible}.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.color{border-left:3px solid}.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;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n");G.inject(W);var Q="dg",q=72,Z=20,$="Default",ee=function(){try{return!!window.localStorage}catch(e){return!1}}(),te=void 0,ne=!0,oe=void 0,ie=!1,re=[],se=function e(t){var n=this,o=t||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),O.addClass(this.domElement,Q),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],o=a.defaults(o,{closeOnTop:!1,autoPlace:!0,width:e.DEFAULT_WIDTH}),o=a.defaults(o,{resizable:o.autoPlace,hideable:o.autoPlace}),a.isUndefined(o.load)?o.load={preset:$}:o.preset&&(o.load.preset=o.preset),a.isUndefined(o.parent)&&o.hideable&&re.push(this),o.resizable=a.isUndefined(o.parent)&&o.resizable,o.autoPlace&&a.isUndefined(o.scrollable)&&(o.scrollable=!0);var i=ee&&"true"===localStorage.getItem(he(this,"isLocal")),r=void 0,s=void 0;if(Object.defineProperties(this,{parent:{get:function(){return o.parent}},scrollable:{get:function(){return o.scrollable}},autoPlace:{get:function(){return o.autoPlace}},closeOnTop:{get:function(){return o.closeOnTop}},preset:{get:function(){return n.parent?n.getRoot().preset:o.load.preset},set:function(e){n.parent?n.getRoot().preset=e:o.load.preset=e,ye(this),n.revert()}},width:{get:function(){return o.width},set:function(e){o.width=e,be(n,e)}},name:{get:function(){return o.name},set:function(e){o.name=e,s&&(s.innerHTML=o.name)}},closed:{get:function(){return o.closed},set:function(t){o.closed=t,o.closed?O.addClass(n.__ul,e.CLASS_CLOSED):O.removeClass(n.__ul,e.CLASS_CLOSED),this.onResize(),n.__closeButton&&(n.__closeButton.innerHTML=t?e.TEXT_OPEN:e.TEXT_CLOSED)}},load:{get:function(){return o.load}},useLocalStorage:{get:function(){return i},set:function(e){ee&&(i=e,e?O.bind(window,"unload",r):O.unbind(window,"unload",r),localStorage.setItem(he(n,"isLocal"),e))}}}),a.isUndefined(o.parent)){if(this.closed=o.closed||!1,O.addClass(this.domElement,e.CLASS_MAIN),O.makeSelectable(this.domElement,!1),ee&&i){n.useLocalStorage=!0;var l=localStorage.getItem(he(this,"gui"));l&&(o.load=JSON.parse(l))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=e.TEXT_CLOSED,O.addClass(this.__closeButton,e.CLASS_CLOSE_BUTTON),o.closeOnTop?(O.addClass(this.__closeButton,e.CLASS_CLOSE_TOP),this.domElement.insertBefore(this.__closeButton,this.domElement.childNodes[0])):(O.addClass(this.__closeButton,e.CLASS_CLOSE_BOTTOM),this.domElement.appendChild(this.__closeButton)),O.bind(this.__closeButton,"click",(function(){n.closed=!n.closed}))}else{void 0===o.closed&&(o.closed=!0);var d=document.createTextNode(o.name);O.addClass(d,"controller-name"),s=ae(n,d);var c=function(e){return e.preventDefault(),n.closed=!n.closed,!1};O.addClass(this.__ul,e.CLASS_CLOSED),O.addClass(s,"title"),O.bind(s,"click",c),o.closed||(this.closed=!1)}function u(){var e=n.getRoot();e.width+=1,a.defer((function(){e.width-=1}))}o.autoPlace&&(a.isUndefined(o.parent)&&(ne&&(oe=document.createElement("div"),O.addClass(oe,Q),O.addClass(oe,e.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(oe),ne=!1),oe.appendChild(this.domElement),O.addClass(this.domElement,e.CLASS_AUTO_PLACE)),this.parent||be(n,o.width)),this.__resizeHandler=function(){n.onResizeDebounced()},O.bind(window,"resize",this.__resizeHandler),O.bind(this.__ul,"webkitTransitionEnd",this.__resizeHandler),O.bind(this.__ul,"transitionend",this.__resizeHandler),O.bind(this.__ul,"oTransitionEnd",this.__resizeHandler),this.onResize(),o.resizable&&ge(this),r=function(){ee&&"true"===localStorage.getItem(he(n,"isLocal"))&&localStorage.setItem(he(n,"gui"),JSON.stringify(n.getSaveObject()))},this.saveToLocalStorageIfPossible=r,o.parent||u()};function ae(e,t,n){var o=document.createElement("li");return t&&o.appendChild(t),n?e.__ul.insertBefore(o,n):e.__ul.appendChild(o),e.onResize(),o}function le(e){O.unbind(window,"resize",e.__resizeHandler),e.saveToLocalStorageIfPossible&&O.unbind(window,"unload",e.saveToLocalStorageIfPossible)}function de(e,t){var n=e.__preset_select[e.__preset_select.selectedIndex];n.innerHTML=t?n.value+"*":n.value}function ce(e,t,n){if(n.__li=t,n.__gui=e,a.extend(n,{options:function(t){if(arguments.length>1){var o=n.__li.nextElementSibling;return n.remove(),_e(e,n.object,n.property,{before:o,factoryArgs:[a.toArray(arguments)]})}if(a.isArray(t)||a.isObject(t)){var i=n.__li.nextElementSibling;return n.remove(),_e(e,n.object,n.property,{before:i,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 D){var o=new F(n.object,n.property,{min:n.__min,max:n.__max,step:n.__step});a.each(["updateDisplay","onChange","onFinishChange","step","min","max"],(function(e){var t=n[e],i=o[e];n[e]=o[e]=function(){var e=Array.prototype.slice.call(arguments);return i.apply(o,e),t.apply(n,e)}})),O.addClass(t,"has-slider"),n.domElement.insertBefore(o.domElement,n.domElement.firstElementChild)}else if(n instanceof F){var i=function(t){if(a.isNumber(n.__min)&&a.isNumber(n.__max)){var o=n.__li.firstElementChild.firstElementChild.innerHTML,i=n.__gui.__listening.indexOf(n)>-1;n.remove();var r=_e(e,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[n.__min,n.__max,n.__step]});return r.name(o),i&&r.listen(),r}return t};n.min=a.compose(i,n.min),n.max=a.compose(i,n.max)}else n instanceof T?(O.bind(t,"click",(function(){O.fakeEvent(n.__checkbox,"click")})),O.bind(n.__checkbox,"click",(function(e){e.stopPropagation()}))):n instanceof V?(O.bind(t,"click",(function(){O.fakeEvent(n.__button,"click")})),O.bind(t,"mouseover",(function(){O.addClass(n.__button,"hover")})),O.bind(t,"mouseout",(function(){O.removeClass(n.__button,"hover")}))):n instanceof j&&(O.addClass(t,"color"),n.updateDisplay=a.compose((function(e){return t.style.borderLeftColor=n.__color.toString(),e}),n.updateDisplay),n.updateDisplay());n.setValue=a.compose((function(t){return e.getRoot().__preset_select&&n.isModified()&&de(e.getRoot(),!0),t}),n.setValue)}function ue(e,t){var n=e.getRoot(),o=n.__rememberedObjects.indexOf(t.object);if(-1!==o){var i=n.__rememberedObjectIndecesToControllers[o];if(void 0===i&&(i={},n.__rememberedObjectIndecesToControllers[o]=i),i[t.property]=t,n.load&&n.load.remembered){var r=n.load.remembered,s=void 0;if(r[e.preset])s=r[e.preset];else{if(!r[$])return;s=r[$]}if(s[o]&&void 0!==s[o][t.property]){var a=s[o][t.property];t.initialValue=a,t.setValue(a)}}}}function _e(e,t,n,o){if(void 0===t[n])throw new Error('Object "'+t+'" has no property "'+n+'"');var i=void 0;if(o.color)i=new j(t,n);else{var r=[t,n].concat(o.factoryArgs);i=X.apply(e,r)}o.before instanceof E&&(o.before=o.before.__li),ue(e,i),O.addClass(i.domElement,"c");var s=document.createElement("span");O.addClass(s,"property-name"),s.innerHTML=i.property;var a=document.createElement("div");a.appendChild(s),a.appendChild(i.domElement);var l=ae(e,a,o.before);return O.addClass(l,se.CLASS_CONTROLLER_ROW),i instanceof j?O.addClass(l,"color"):O.addClass(l,p(i.getValue())),ce(e,l,i),e.__controllers.push(i),i}function he(e,t){return document.location.href+"."+t}function pe(e,t,n){var o=document.createElement("option");o.innerHTML=t,o.value=t,e.__preset_select.appendChild(o),n&&(e.__preset_select.selectedIndex=e.__preset_select.length-1)}function fe(e,t){t.style.display=e.useLocalStorage?"block":"none"}function me(e){var t=e.__save_row=document.createElement("li");O.addClass(e.domElement,"has-save"),e.__ul.insertBefore(t,e.__ul.firstChild),O.addClass(t,"save-row");var n=document.createElement("span");n.innerHTML=" ",O.addClass(n,"button gears");var o=document.createElement("span");o.innerHTML="Save",O.addClass(o,"button"),O.addClass(o,"save");var i=document.createElement("span");i.innerHTML="New",O.addClass(i,"button"),O.addClass(i,"save-as");var r=document.createElement("span");r.innerHTML="Revert",O.addClass(r,"button"),O.addClass(r,"revert");var s=e.__preset_select=document.createElement("select");if(e.load&&e.load.remembered?a.each(e.load.remembered,(function(t,n){pe(e,n,n===e.preset)})):pe(e,$,!1),O.bind(s,"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(s),t.appendChild(n),t.appendChild(o),t.appendChild(i),t.appendChild(r),ee){var l=document.getElementById("dg-local-explain"),d=document.getElementById("dg-local-storage"),c=document.getElementById("dg-save-locally");c.style.display="block","true"===localStorage.getItem(he(e,"isLocal"))&&d.setAttribute("checked","checked"),fe(e,l),O.bind(d,"change",(function(){e.useLocalStorage=!e.useLocalStorage,fe(e,l)}))}var u=document.getElementById("dg-new-constructor");O.bind(u,"keydown",(function(e){!e.metaKey||67!==e.which&&67!==e.keyCode||te.hide()})),O.bind(n,"click",(function(){u.innerHTML=JSON.stringify(e.getSaveObject(),void 0,2),te.show(),u.focus(),u.select()})),O.bind(o,"click",(function(){e.save()})),O.bind(i,"click",(function(){var t=prompt("Enter a new preset name.");t&&e.saveAs(t)})),O.bind(r,"click",(function(){e.revert()}))}function ge(e){var t=void 0;function n(n){return n.preventDefault(),e.width+=t-n.clientX,e.onResize(),t=n.clientX,!1}function o(){O.removeClass(e.__closeButton,se.CLASS_DRAG),O.unbind(window,"mousemove",n),O.unbind(window,"mouseup",o)}function i(i){return i.preventDefault(),t=i.clientX,O.addClass(e.__closeButton,se.CLASS_DRAG),O.bind(window,"mousemove",n),O.bind(window,"mouseup",o),!1}e.__resize_handle=document.createElement("div"),a.extend(e.__resize_handle.style,{width:"6px",marginLeft:"-3px",height:"200px",cursor:"ew-resize",position:"absolute"}),O.bind(e.__resize_handle,"mousedown",i),O.bind(e.__closeButton,"mousedown",i),e.domElement.insertBefore(e.__resize_handle,e.domElement.firstElementChild)}function be(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 ve(e,t){var n={};return a.each(e.__rememberedObjects,(function(o,i){var r={},s=e.__rememberedObjectIndecesToControllers[i];a.each(s,(function(e,n){r[n]=t?e.initialValue:e.getValue()})),n[i]=r})),n}function ye(e){for(var t=0;t<e.__preset_select.length;t++)e.__preset_select[t].value===e.preset&&(e.__preset_select.selectedIndex=t)}function we(e){0!==e.length&&K.call(window,(function(){we(e)})),a.each(e,(function(e){e.updateDisplay()}))}se.toggleHide=function(){ie=!ie,a.each(re,(function(e){e.domElement.style.display=ie?"none":""}))},se.CLASS_AUTO_PLACE="a",se.CLASS_AUTO_PLACE_CONTAINER="ac",se.CLASS_MAIN="main",se.CLASS_CONTROLLER_ROW="cr",se.CLASS_TOO_TALL="taller-than-window",se.CLASS_CLOSED="closed",se.CLASS_CLOSE_BUTTON="close-button",se.CLASS_CLOSE_TOP="close-top",se.CLASS_CLOSE_BOTTOM="close-bottom",se.CLASS_DRAG="drag",se.DEFAULT_WIDTH=245,se.TEXT_CLOSED="Close Controls",se.TEXT_OPEN="Open Controls",se._keydownHandler=function(e){"text"===document.activeElement.type||e.which!==q&&e.keyCode!==q||se.toggleHide()},O.bind(window,"keydown",se._keydownHandler,!1),a.extend(se.prototype,{add:function(e,t){return _e(this,e,t,{factoryArgs:Array.prototype.slice.call(arguments,2)})},addColor:function(e,t){return _e(this,e,t,{color:!0})},remove:function(e){this.__ul.removeChild(e.__li),this.__controllers.splice(this.__controllers.indexOf(e),1);var t=this;a.defer((function(){t.onResize()}))},destroy:function(){if(this.parent)throw new Error("Only the root GUI should be removed with .destroy(). For subfolders, use gui.removeFolder(folder) instead.");this.autoPlace&&oe.removeChild(this.domElement);var e=this;a.each(this.__folders,(function(t){e.removeFolder(t)})),O.unbind(window,"keydown",se._keydownHandler,!1),le(this)},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 se(t);this.__folders[e]=n;var o=ae(this,n.domElement);return O.addClass(o,"folder"),n},removeFolder:function(e){this.__ul.removeChild(e.domElement.parentElement),delete this.__folders[e.name],this.load&&this.load.folders&&this.load.folders[e.name]&&delete this.load.folders[e.name],le(e);var t=this;a.each(e.__folders,(function(t){e.removeFolder(t)})),a.defer((function(){t.onResize()}))},open:function(){this.closed=!1},close:function(){this.closed=!0},hide:function(){this.domElement.style.display="none"},show:function(){this.domElement.style.display=""},onResize:function(){var e=this.getRoot();if(e.scrollable){var t=O.getOffset(e.__ul).top,n=0;a.each(e.__ul.childNodes,(function(t){e.autoPlace&&t===e.__save_row||(n+=O.getHeight(t))})),window.innerHeight-t-Z<n?(O.addClass(e.domElement,se.CLASS_TOO_TALL),e.__ul.style.height=window.innerHeight-t-Z+"px"):(O.removeClass(e.domElement,se.CLASS_TOO_TALL),e.__ul.style.height="auto")}e.__resize_handle&&a.defer((function(){e.__resize_handle.style.height=e.__ul.offsetHeight+"px"})),e.__closeButton&&(e.__closeButton.style.width=e.width+"px")},onResizeDebounced:a.debounce((function(){this.onResize()}),50),remember:function(){if(a.isUndefined(te)&&(te=new Y,te.domElement.innerHTML=U),this.parent)throw new Error("You can only call remember on a top level GUI.");var e=this;a.each(Array.prototype.slice.call(arguments),(function(t){0===e.__rememberedObjects.length&&me(e),-1===e.__rememberedObjects.indexOf(t)&&e.__rememberedObjects.push(t)})),this.autoPlace&&be(this,this.width)},getRoot:function(){var e=this;while(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]=ve(this)),e.folders={},a.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]=ve(this),de(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(e){this.load.remembered||(this.load.remembered={},this.load.remembered[$]=ve(this,!0)),this.load.remembered[e]=ve(this),this.preset=e,pe(this,e,!0),this.saveToLocalStorageIfPossible()},revert:function(e){a.each(this.__controllers,(function(t){this.getRoot().load.remembered?ue(e||this.getRoot(),t):t.setValue(t.initialValue),t.__onFinishChange&&t.__onFinishChange.call(t,t.getValue())}),this),a.each(this.__folders,(function(e){e.revert(e)})),e||de(this.getRoot(),!1)},listen:function(e){var t=0===this.__listening.length;this.__listening.push(e),t&&we(this.__listening)},updateDisplay:function(){a.each(this.__controllers,(function(e){e.updateDisplay()})),a.each(this.__folders,(function(e){e.updateDisplay()}))}});var xe=se}}]);
|