dat.gui/build/dat-gui.js

12 lines
141 KiB
JavaScript
Raw Normal View History

document.write(['',
2014-09-09 20:58:42 +00:00
'<script>(function(scope){var Gui=function(params){if(!ready){Gui.error("Gui not ready. Put your code inside Gui.ready()")}params=params||{};this.vars={};this.localStorage=params.localStorage||false;this.panel=document.createElement("dat-gui");this.panel.autoPlace=params.autoPlace!==false;if(this.panel.autoPlace){document.body.appendChild(this.panel)}};Gui.prototype.add=function(object,path){var value=Path.get(path).getValueFrom(object);if(value===null||value===undefined){return Gui.error(object+" doesn\'t have a value for path \\""+path+\'".\')}var args=Array.prototype.slice.call(arguments,2);var controller;if(args[0]instanceof Array||typeof args[0]=="object"){controller=document.createElement("dat-gui-option")}else{controller=Gui.getController(value)}if(!controller){return Gui.error("Unrecognized type:",value)}controller.watch(object,path);controller.init.apply(controller,args);var row=document.createElement("gui-row");row.name=path;controller.row=row;controller.name=function(name){row.name=name};controller.comment=function(comment){row.comment=comment};row.appendChild(controller);this.panel.appendChild(row);return controller};Gui.prototype.remember=function(object){};Gui.prototype.var=function(){var name,initialValue,args;if(arguments.length==1){name=arguments[0];return this.vars[name]}initialValue=arguments[1];name=arguments[0];args=[this.vars,name];args=args.concat(Array.prototype.slice.call(arguments,2));this.vars[name]=initialValue;return this.add.apply(this,args)};Gui.prototype.listenAll=function(){Gui.warn("controller.listenAll() is deprecated. All controllers are listened for free.")};var controllers={};Gui.register=function(elementName,test){controllers[elementName]=test};Gui.getController=function(value){for(var type in controllers){var test=controllers[type];if(test(value)){return document.createElement(type)}}};var ready=false;var readyHandlers=[];document.addEventListener("polymer-ready",function(){ready=true;readyHandlers.forEach(function(fnc){fnc()})});Gui.ready=function(fnc){if(ready){fnc()}else{readyHandlers.push(fnc)}};Gui.error=function(){var args=Array.prototype.slice.apply(arguments);args.unshift("dat-gui ::");console.error.apply(console,args)};Gui.warn=function(){var args=Array.prototype.slice.apply(arguments);args.unshift("dat-gui ::");console.warn.apply(console,args)};var dat={};dat.gui={};dat.gui.GUI=Gui;dat.GUI=dat.gui.GUI;dat.color={};dat.color.Color=function(){};dat.dom={};dat.dom.dom=function(){};dat.controllers={};dat.controllers.Controller=constructor("dat-gui-base");dat.controllers.NumberController=constructor("dat-gui-number");dat.controllers.FunctionController=constructor("dat-gui-function");dat.controllers.ColorController=constructor("dat-gui-color");dat.controllers.BooleanController=constructor("dat-gui-boolean");dat.controllers.OptionController=constructor("dat-gui-option");dat.controllers.NumberControllerBox=dat.controllers.NumberController;dat.controllers.NumberControllerSlider=dat.controllers.NumberController;function constructor(elementName){return function(object,path){var el=document.createElement(elementName);el.watch(object,path);return el}}scope.dat=dat;scope.Gui=Gui})(this);</script>',
2014-09-10 22:40:55 +00:00
'<div hidden><style shim-shadowdom="">html /deep/ [layout][horizontal],html /deep/ [layout][vertical]{display:-ms-flexbox;display:-webkit-flex;display:flex}html /deep/ [layout][horizontal][inline],html /deep/ [layout][vertical][inline]{display:-ms-inline-flexbox;display:-webkit-inline-flex;display:inline-flex}html /deep/ [layout][horizontal]{-ms-flex-direction:row;-webkit-flex-direction:row;flex-direction:row}html /deep/ [layout][horizontal][reverse]{-ms-flex-direction:row-reverse;-webkit-flex-direction:row-reverse;flex-direction:row-reverse}html /deep/ [layout][vertical]{-ms-flex-direction:column;-webkit-flex-direction:column;flex-direction:column}html /deep/ [layout][vertical][reverse]{-ms-flex-direction:column-reverse;-webkit-flex-direction:column-reverse;flex-direction:column-reverse}html /deep/ [layout][wrap]{-ms-flex-wrap:wrap;-webkit-flex-wrap:wrap;flex-wrap:wrap}html /deep/ [layout][wrap-reverse]{-ms-flex-wrap:wrap-reverse;-webkit-flex-wrap:wrap-reverse;flex-wrap:wrap-reverse}html /deep/ [flex]{-ms-flex:1 1 0;-webkit-flex:1;flex:1;-webkit-flex-basis:0;flex-basis:0}html /deep/ [vertical][layout]>[flex][auto-vertical],html /deep/ [vertical][layout]::shadow [flex][auto-vertical]{-ms-flex:1 1 auto;-webkit-flex-basis:auto;flex-basis:auto}html /deep/ [flex][auto]{-ms-flex:1 1 auto;-webkit-flex-basis:auto;flex-basis:auto}html /deep/ [flex][none]{-ms-flex:none;-webkit-flex:none;flex:none}html /deep/ [flex][one]{-ms-flex:1;-webkit-flex:1;flex:1}html /deep/ [flex][two]{-ms-flex:2;-webkit-flex:2;flex:2}html /deep/ [flex][three]{-ms-flex:3;-webkit-flex:3;flex:3}html /deep/ [flex][four]{-ms-flex:4;-webkit-flex:4;flex:4}html /deep/ [flex][five]{-ms-flex:5;-webkit-flex:5;flex:5}html /deep/ [flex][six]{-ms-flex:6;-webkit-flex:6;flex:6}html /deep/ [flex][seven]{-ms-flex:7;-webkit-flex:7;flex:7}html /deep/ [flex][eight]{-ms-flex:8;-webkit-flex:8;flex:8}html /deep/ [flex][nine]{-ms-flex:9;-webkit-flex:9;flex:9}html /deep/ [flex][ten]{-ms-flex:10;-webkit-flex:10;flex:10}html /deep/ [flex][eleven]{-ms-flex:11;-webkit-flex:11;flex:11}html /deep/ [flex][twelve]{-ms-flex:12;-webkit-flex:12;flex:12}html /deep/ [layout][start]{-ms-flex-align:start;-webkit-align-items:flex-start;align-items:flex-start}html /deep/ [layout][center],html /deep/ [layout][center-center]{-ms-flex-align:center;-webkit-align-items:center;align-items:center}html /deep/ [layout][end]{-ms-flex-align:end;-webkit-align-items:flex-end;align-items:flex-end}html /deep/ [layout][start-justified]{-ms-flex-pack:start;-webkit-justify-content:flex-start;justify-content:flex-start}html /deep/ [layout][center-justified],html /deep/ [layout][center-center]{-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center}html /deep/ [layout][end-justified]{-ms-flex-pack:end;-webkit-justify-content:flex-end;justify-content:flex-end}html /deep/ [layout][around-justified]{-ms-flex-pack:distribute;-webkit-justify-content:space-around;justify-content:space-around}html /deep/ [layout][justified]{-ms-flex-pack:justify;-webkit-justify-content:space-between;justify-content:space-between}html /deep/ [self-start]{-ms-align-self:flex-start;-webkit-align-self:flex-start;align-self:flex-start}html /deep/ [self-center]{-ms-align-self:center;-webkit-align-self:center;align-self:center}html /deep/ [self-end]{-ms-align-self:flex-end;-webkit-align-self:flex-end;align-self:flex-end}html /deep/ [self-stretch]{-ms-align-self:stretch;-webkit-align-self:stretch;align-self:stretch}html /deep/ [block]{display:block}html /deep/ [hidden]{display:none!important}html /deep/ [relative]{position:relative}html /deep/ [fit]{position:absolute;top:0;right:0;bottom:0;left:0}body[fullbleed]{margin:0;height:100vh}html /deep/ [segment],html /deep/ segment{display:block;position:relative;-webkit-box-sizing:border-box;-ms-box-sizing:border-box;box-sizing:border-box;margin:1em .5em;padding:1em;background-color:#fff;-webkit-box-shadow:0 0 0 1px rgba(0,0,0,.1);box-shadow:0 0 0 1px rgba(0,0,0,.1);border-radius:5px 5px 5px 5px}</style><script>window.PolymerGestures={},function(a){var b=!1,c=document.createElement("m
'}else{var b=Path.get(this.property.name);this.valueFn_=function(c,d,e){var f=a(c,d,e);return d&&d.addPath(f,b),b.getValueFrom(f)}}}return this.valueFn_},setValue:function(a,b){if(this.simplePath)return this.fullPath.setValueFrom(a,b),b;var c=this.object(a),d=this.property instanceof e?this.property.name:this.property(a);return c[d]=b}},g.prototype={transform:function(a,b,c,d,e){var f=c[this.name],g=a;if(f)g=void 0;else if(f=g[this.name],!f)return void console.error("Cannot find function or filter: "+this.name);if(d?f=f.toModel:"function"==typeof f.toDOM&&(f=f.toDOM),"function"!=typeof f)return void console.error("Cannot find function or filter: "+this.name);for(var h=e||[],j=0;j<this.args.length;j++)h.push(i(this.args[j])(a,b,c));return f.apply(g,h)}};var r={"+":function(a){return+a},"-":function(a){return-a},"!":function(a){return!a}},s={"+":function(a,b){return a+b},"-":function(a,b){return a-b},"*":function(a,b){return a*b},"/":function(a,b){return a/b},"%":function(a,b){return a%b},"<":function(a,b){return b>a},">":function(a,b){return a>b},"<=":function(a,b){return b>=a},">=":function(a,b){return a>=b},"==":function(a,b){return a==b},"!=":function(a,b){return a!=b},"===":function(a,b){return a===b},"!==":function(a,b){return a!==b},"&&":function(a,b){return a&&b},"||":function(a,b){return a||b}};j.prototype={createUnaryExpression:function(a,b){if(!r[a])throw Error("Disallowed operator: "+a);return b=i(b),function(c,d,e){return r[a](b(c,d,e))}},createBinaryExpression:function(a,b,c){if(!s[a])throw Error("Disallowed operator: "+a);switch(b=i(b),c=i(c),a){case"||":return this.dynamicDeps=!0,function(a,d,e){return b(a,d,e)||c(a,d,e)};case"&&":return this.dynamicDeps=!0,function(a,d,e){return b(a,d,e)&&c(a,d,e)}}return function(d,e,f){return s[a](b(d,e,f),c(d,e,f))}},createConditionalExpression:function(a,b,c){return a=i(a),b=i(b),c=i(c),this.dynamicDeps=!0,function(d,e,f){return a(d,e,f)?b(d,e,f):c(d,e,f)}},createIdentifier:function(a){var b=new e(a);return b.type="Identifier",b},createMemberExpression:function(a,b,c){var d=new f(b,c,a);return d.dynamicDeps&&(this.dynamicDeps=!0),d},createCallExpression:function(a,b){if(!(a instanceof e))throw Error("Only identifier function invocations are allowed");var c=new g(a.name,b);return function(a,b,d){return c.transform(a,b,d,!1)}},createLiteral:function(a){return new d(a.value)},createArrayExpression:function(a){for(var b=0;b<a.length;b++)a[b]=i(a[b]);return function(b,c,d){for(var e=[],f=0;f<a.length;f++)e.push(a[f](b,c,d));return e}},createProperty:function(a,b,c){return{key:b instanceof e?b.name:b.value,value:c}},createObjectExpression:function(a){for(var b=0;b<a.length;b++)a[b].value=i(a[b].value);return function(b,c,d){for(var e={},f=0;f<a.length;f++)e[a[f].key]=a[f].value(b,c,d);return e}},createFilter:function(a,b){this.filters.push(new g(a,b))},createAsExpression:function(a,b){this.expression=a,this.scopeIdent=b},createInExpression:function(a,b,c){this.expression=c,this.scopeIdent=a,this.indexIdent=b},createTopLevel:function(a){this.expression=a},createThisExpression:h},k.prototype={open:function(){return this.value_},discardChanges:function(){return this.value_},deliver:function(){},close:function(){}},l.prototype={getBinding:function(a,b,c){function d(){if(h)return h=!1,g;i.dynamicDeps&&f.startReset();var c=i.getValue(a,i.dynamicDeps?f:void 0,b);return i.dynamicDeps&&f.finishReset(),c}function e(c){return i.setValue(a,c,b),c}if(c)return this.getValue(a,void 0,b);var f=new CompoundObserver,g=this.getValue(a,f,b),h=!0,i=this;return new ObserverTransform(f,d,e,!0)},getValue:function(a,b,c){for(var d=i(this.expression)(a,b,c),e=0;e<this.filters.length;e++)d=this.filters[e].transform(a,b,c,!1,[d]);return d},setValue:function(a,b,c){for(var d=this.filters?this.filters.length:0;d-->0;)b=this.filters[d].transform(a,void 0,c,!0,[b]);return this.expression.setValue?this.expression.setValue(a,b):void 0}};var t="@"+Math.random().toString(36).slice(2);p.prototype={styleObject:function(a){var b=[];for(var c in a)b.push(m(c)+": "+a[c]);return b.join("; ")},tokenList:function(a){
'return q(this,d.open(r(this))),t(this,a,e)},HTMLSelectElement.prototype.bind=function(a,c,d){if("selectedindex"===a&&(a="selectedIndex"),"selectedIndex"!==a&&"value"!==a)return HTMLElement.prototype.bind.call(this,a,c,d);if(this.removeAttribute(a),d)return j(this,a,c);var e=c,f=m(this,a,e);return j(this,a,e.open(k(this,a))),b(this,a,f)}}(this),function(a){"use strict";function b(a){if(!a)throw new Error("Assertion failed")}function c(a){for(var b;b=a.parentNode;)a=b;return a}function d(a,b){if(b){for(var d,e="#"+b;!d&&(a=c(a),a.protoContent_?d=a.protoContent_.querySelector(e):a.getElementById&&(d=a.getElementById(b)),!d&&a.templateCreator_);)a=a.templateCreator_;return d}}function e(a){return"template"==a.tagName&&"http://www.w3.org/2000/svg"==a.namespaceURI}function f(a){return"TEMPLATE"==a.tagName&&"http://www.w3.org/1999/xhtml"==a.namespaceURI}function g(a){return Boolean(L[a.tagName]&&a.hasAttribute("template"))}function h(a){return void 0===a.isTemplate_&&(a.isTemplate_="TEMPLATE"==a.tagName||g(a)),a.isTemplate_}function i(a,b){var c=a.querySelectorAll(N);h(a)&&b(a),G(c,b)}function j(a){function b(a){HTMLTemplateElement.decorate(a)||j(a.content)}i(a,b)}function k(a,b){Object.getOwnPropertyNames(b).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))})}function l(a){var b=a.ownerDocument;if(!b.defaultView)return b;var c=b.templateContentsOwner_;if(!c){for(c=b.implementation.createHTMLDocument("");c.lastChild;)c.removeChild(c.lastChild);b.templateContentsOwner_=c}return c}function m(a){if(!a.stagingDocument_){var b=a.ownerDocument;if(!b.stagingDocument_){b.stagingDocument_=b.implementation.createHTMLDocument(""),b.stagingDocument_.isStagingDocument=!0;var c=b.stagingDocument_.createElement("base");c.href=document.baseURI,b.stagingDocument_.head.appendChild(c),b.stagingDocument_.stagingDocument_=b.stagingDocument_}a.stagingDocument_=b.stagingDocument_}return a.stagingDocument_}function n(a){var b=a.ownerDocument.createElement("template");a.parentNode.insertBefore(b,a);for(var c=a.attributes,d=c.length;d-->0;){var e=c[d];K[e.name]&&("template"!==e.name&&b.setAttribute(e.name,e.value),a.removeAttribute(e.name))}return b}function o(a){var b=a.ownerDocument.createElement("template");a.parentNode.insertBefore(b,a);for(var c=a.attributes,d=c.length;d-->0;){var e=c[d];b.setAttribute(e.name,e.value),a.removeAttribute(e.name)}return a.parentNode.removeChild(a),b}function p(a,b,c){var d=a.content;if(c)return void d.appendChild(b);for(var e;e=b.firstChild;)d.appendChild(e)}function q(a){P?a.__proto__=HTMLTemplateElement.prototype:k(a,HTMLTemplateElement.prototype)}function r(a){a.setModelFn_||(a.setModelFn_=function(){a.setModelFnScheduled_=!1;var b=z(a,a.delegate_&&a.delegate_.prepareBinding);w(a,b,a.model_)}),a.setModelFnScheduled_||(a.setModelFnScheduled_=!0,Observer.runEOM_(a.setModelFn_))}function s(a,b,c,d){if(a&&a.length){for(var e,f=a.length,g=0,h=0,i=0,j=!0;f>h;){var g=a.indexOf("{{",h),k=a.indexOf("[[",h),l=!1,m="}}";if(k>=0&&(0>g||g>k)&&(g=k,l=!0,m="]]"),i=0>g?-1:a.indexOf(m,g+2),0>i){if(!e)return;e.push(a.slice(h));break}e=e||[],e.push(a.slice(h,g));var n=a.slice(g+2,i).trim();e.push(l),j=j&&l;var o=d&&d(n,b,c);e.push(null==o?Path.get(n):null),e.push(o),h=i+2}return h===f&&e.push(""),e.hasOnePath=5===e.length,e.isSimplePath=e.hasOnePath&&""==e[0]&&""==e[4],e.onlyOneTime=j,e.combinator=function(a){for(var b=e[0],c=1;c<e.length;c+=4){var d=e.hasOnePath?a:a[(c-1)/4];void 0!==d&&(b+=d),b+=e[c+3]}return b},e}}function t(a,b,c,d){if(b.hasOnePath){var e=b[3],f=e?e(d,c,!0):b[2].getValueFrom(d);return b.isSimplePath?f:b.combinator(f)}for(var g=[],h=1;h<b.length;h+=4){var e=b[h+2];g[(h-1)/4]=e?e(d,c):b[h+1].getValueFrom(d)}return b.combinator(g)}function u(a,b,c,d){var e=b[3],f=e?e(d,c,!1):new PathObserver(d,b[2]);return b.isSimplePath?f:new ObserverTransform(f,b.combinator)}function v(a,b,c,d){if(b.onlyOneTime)return t(a,b,c,d);if(b.hasOnePath)return u(a,b,c,d);for(var e=new CompoundObserver,f=1;f<b.length;f+=4){var g=b[f],h=b[f+2];if(h){var i=h(d,c,g);g?e.addPath(i):e.addObserver(i)}else{var j
'},parseDeclarations:function(a){a&&a.element&&(this.parseDeclarations(a.__proto__),a.parseDeclaration.call(this,a.element))},parseDeclaration:function(a){var b=this.fetchTemplate(a);if(b){var c=this.shadowFromTemplate(b);this.shadowRoots[a.name]=c}},fetchTemplate:function(a){return a.querySelector("template")},shadowFromTemplate:function(a){if(a){var b=this.createShadowRoot(),c=this.instanceTemplate(a);return b.appendChild(c),this.shadowRootReady(b,a),b}},lightFromTemplate:function(a,b){if(a){this.eventController=this;var c=this.instanceTemplate(a);return b?this.insertBefore(c,b):this.appendChild(c),this.shadowRootReady(this),c}},shadowRootReady:function(a){this.marshalNodeReferences(a)},marshalNodeReferences:function(a){var b=this.$=this.$||{};if(a)for(var c,d=a.querySelectorAll("[id]"),e=0,f=d.length;f>e&&(c=d[e]);e++)b[c.id]=c},attributeChangedCallback:function(a){"class"!==a&&"style"!==a&&this.attributeToProperty(a,this.getAttribute(a)),this.attributeChanged&&this.attributeChanged.apply(this,arguments)},onMutation:function(a,b){var c=new MutationObserver(function(a){b.call(this,c,a),c.disconnect()}.bind(this));c.observe(a,{childList:!0,subtree:!0})}};c.prototype=d,d.constructor=c,a.Base=c,a.isBase=b,a.api.instance.base=d}(Polymer),function(a){function b(a){return a.__proto__}function c(a,b){var c="",d=!1;b&&(c=b.localName,d=b.hasAttribute("is"));var e=Platform.ShadowCSS.makeScopeSelector(c,d);return Platform.ShadowCSS.shimCssText(a,e)}var d=(window.logFlags||{},window.ShadowDOMPolyfill),e="element",f="controller",g={STYLE_SCOPE_ATTRIBUTE:e,installControllerStyles:function(){var a=this.findStyleScope();if(a&&!this.scopeHasNamedStyle(a,this.localName)){for(var c=b(this),d="";c&&c.element;)d+=c.element.cssTextForScope(f),c=b(c);d&&this.installScopeCssText(d,a)}},installScopeStyle:function(a,b,c){var c=c||this.findStyleScope(),b=b||"";if(c&&!this.scopeHasNamedStyle(c,this.localName+b)){var d="";if(a instanceof Array)for(var e,f=0,g=a.length;g>f&&(e=a[f]);f++)d+=e.textContent+"\\n\\n";else d=a.textContent;this.installScopeCssText(d,c,b)}},installScopeCssText:function(a,b,e){if(b=b||this.findStyleScope(),e=e||"",b){d&&(a=c(a,b.host));var g=this.element.cssTextToScopeStyle(a,f);Polymer.applyStyleToScope(g,b),this.styleCacheForScope(b)[this.localName+e]=!0}},findStyleScope:function(a){for(var b=a||this;b.parentNode;)b=b.parentNode;return b},scopeHasNamedStyle:function(a,b){var c=this.styleCacheForScope(a);return c[b]},styleCacheForScope:function(a){if(d){var b=a.host?a.host.localName:a.localName;return h[b]||(h[b]={})}return a._scopeStyles=a._scopeStyles||{}}},h={};a.api.instance.styles=g}(Polymer),function(a){function b(a,b){if("string"!=typeof a){var c=b||document._currentScript;if(b=a,a=c&&c.parentNode&&c.parentNode.getAttribute?c.parentNode.getAttribute("name"):"",!a)throw"Element name could not be inferred."}if(f[a])throw"Already registered (Polymer) prototype for element "+a;e(a,b),d(a)}function c(a,b){h[a]=b}function d(a){h[a]&&(h[a].registerWhenReady(),delete h[a])}function e(a,b){return i[a]=b||{}}function f(a){return i[a]}var g=a.extend,h=(a.api,{}),i={};a.getRegisteredPrototype=f,a.waitingForPrototype=c,window.Polymer=b,g(Polymer,a),Platform.consumeDeclarations&&Platform.consumeDeclarations(function(a){if(a)for(var c,d=0,e=a.length;e>d&&(c=a[d]);d++)b.apply(null,c)})}(Polymer),function(a){var b={resolveElementPaths:function(a){Polymer.urlResolver.resolveDom(a)},addResolvePathApi:function(){var a=this.getAttribute("assetpath")||"",b=new URL(a,this.ownerDocument.baseURI);this.prototype.resolvePath=function(a,c){var d=new URL(a,c||b);return d.href}}};a.api.declaration.path=b}(Polymer),function(a){function b(a,b){var c=new URL(a.getAttribute("href"),b).href;return"@import \'"+c+"\';"}function c(a,b){if(a){b===document&&(b=document.head),i&&(b=document.head);var c=d(a.textContent),e=a.getAttribute(h);e&&c.setAttribute(h,e);var f=b.firstElementChild;if(b===document.head){var g="style["+h+"]",j=document.head.querySelectorAll(g);j.length&&(f=j[j.length-1].nextElementSibling)}b.insertBefore(c,f)}}function d(a,b){b=b||doc
2014-09-09 19:53:30 +00:00
'<div hidden><script>Polymer("dat-gui-base",{ready:function(){this.update()},update:function(){},init:function(){},watch:function(object,path){this.object=object;this.path=path;this.bind("value",new PathObserver(this.object,this.path))},valueChanged:function(){this.fire("change",this.value);this.update()},on:function(event,listener){this.addEventListener(event,listener);return this},map:function(x,a,b,c,d){return(x-a)/(b-a)*(d-c)+c},listen:function(){Gui.warn("controller.listen() is deprecated. All controllers are listened for free.");return this},getValue:function(){return this.value},setValue:function(v){this.value=v;return this},onChange:function(v){this.addEventListener("change",function(e){v(e.detail)});return this}});</script><polymer-element name="dat-gui-base" attributes="object path value" assetpath="../elements/dat-gui-base/"></polymer-element><script>Gui.register("dat-gui-number",function(value){return typeof value=="number"});Polymer("dat-gui-number",{value:0,decimals:3,computed:{slider:"min !== undefined && max !== undefined"},ready:function(){var _this=this;window.addEventListener("keydown",function(e){if(e.keyCode==18){_this._alt=true}},false);window.addEventListener("keyup",function(e){if(e.keyCode==18){_this._alt=false}},false)},init:function(min,max,step){this.min=min;this.max=max;this.step=step},valueChanged:function(newValue){if(this.step!==undefined){this.value=Math.round(this.value/this.step)*this.step}if(this.min!==undefined){this.value=Math.max(this.value,this.min)}if(this.max!==undefined){this.value=Math.min(this.value,this.max)}this.super()},minChanged:function(){this.value=Math.max(this.value,this.min);this.update()},maxChanged:function(){this.value=Math.min(this.value,this.max);this.update()},update:function(){var ratio=this.map(this.value,this.min,this.max,0,1);if(this.min<0&&this.max>0){this.$.container.classList.add("straddle-zero");var zero=this.map(0,this.min,this.max,0,1);if(this.value>=0){this.$.fill.style.left=zero*100+"%";this.$.fill.style.width=(ratio-zero)*100+"%";this.$.fill.style.right=""}else{this.$.fill.style.left="";this.$.fill.style.width=(zero-ratio)*100+"%";this.$.fill.style.right=(1-zero)*100+"%"}}else{this.$.container.classList.remove("straddle-zero");if(this.max>0){this.$.fill.style.left=0;this.$.fill.style.width=ratio*100+"%";this.$.fill.style.right=""}else{this.$.fill.style.left="";this.$.fill.style.width=(1-ratio)*100+"%";this.$.fill.style.right=0}}this.$.knob.style.left=ratio*100+"%";this.$.container.classList.toggle("positive",this.value>=0);this.$.container.classList.toggle("negative",this.value<0);this.super()},click:function(e){this.$.input.select()},keydown:function(e){if(e.keyCode==13){this.$.input.blur()}},down:function(e){e.preventDefault();this._rect=this.$.track.getBoundingClientRect();if(!this._alt){this.value=this.valueFromX(e.x)}this.fire("sliderDown")},up:function(e){this.fire("sliderUp")},trackstart:function(e){this._dragFriction=1},trackx:function(e){if(this.step===undefined){var dv=this.valueFromDX(e.ddx);if(this._alt){dv/=10}this.value+=dv*this._dragFriction}else{this.value=this.valueFromX(e.pageX)}},tracky:function(e){this._dragFriction=Math.max(.01,Math.min(1,this.map(e.dy,50,300,1,.1)))},blur:function(e){var v=parseFloat(this.$.input.value);if(v===v){this.value=v}},truncate:function(v){if(v%1!==0&&this.decimals!==undefined){return this.limitDecimals(v,this.decimals)}else{return v}},limitDecimals:function(v,maxDecimals){var str=v.toString();var numDecimals=str.substring(str.indexOf(".")+1).length;str=v.toFixed(Math.min(numDecimals,this.decimals));for(var z,i=0,l=str.length;i<l;i++){if(str.charAt(i)!=="0"){z=i}}return str.substring(0,z+1)},valueFromX:function(x){return this.map(x,this._rect.left,this._rect.right,this.min,this.max)},valueFromDX:function(dx){return this.map(dx,0,this._rect.width,0,this.max-this.min)}});</script><polymer-element name="dat-gui-number" attributes="min max value step" extends="dat-gui-base" assetpath="../elements/dat-gui-number/"><template><style>input{font:10px \'Lucida Grande\',sans-serif;color:#ecebe0;-webkit-font-smo
'<div hidden><script>Gui.register("dat-gui-string",function(value){return typeof value=="string"});Polymer("dat-gui-string",{click:function(e){this.$.input.select()},keydown:function(e){if(e.keyCode==13){this.$.input.blur()}}});</script><polymer-element name="dat-gui-string" extends="dat-gui-base" assetpath="../elements/dat-gui-string/"><template><style>input{font:10px \'Lucida Grande\',sans-serif;color:#ecebe0;-webkit-font-smoothing:antialiased;height:100%;width:100%;display:inline-block;background-color:transparent;border:0;-webkit-border-radius:0;border-radius:0;padding:0;outline:0;-webkit-transition:background-color .15s linear;-moz-transition:background-color .15s linear;-o-transition:background-color .15s linear;-ms-transition:background-color .15s linear;transition:background-color .15s linear;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}:host-context(.touch-true) input{font-size:13.5px}input:focus{background:rgba(255,255,255,.05)}:host-context(.touch-false) input:hover{background:rgba(255,255,255,.05)}</style><style>input{color:#1ebd6e;padding-left:8px}</style><input id="input" type="text" value="{{ value }}" on-click="{{ click }}" on-keydown="{{ keydown }}"></template></polymer-element></div>',
'<div hidden><script>Gui.register("dat-gui-boolean",function(value){return typeof value=="boolean"});Polymer("dat-gui-boolean",{ready:function(){},toggle:function(){this.value=!this.value}});</script><polymer-element name="dat-gui-boolean" extends="dat-gui-base" assetpath="../elements/dat-gui-boolean/"><template><style>input{font:10px \'Lucida Grande\',sans-serif;color:#ecebe0;-webkit-font-smoothing:antialiased;height:100%;width:100%;display:inline-block;background-color:transparent;border:0;-webkit-border-radius:0;border-radius:0;padding:0;outline:0;-webkit-transition:background-color .15s linear;-moz-transition:background-color .15s linear;-o-transition:background-color .15s linear;-ms-transition:background-color .15s linear;transition:background-color .15s linear;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}:host-context(.touch-true) input{font-size:13.5px}input:focus{background:rgba(255,255,255,.05)}:host-context(.touch-false) input:hover{background:rgba(255,255,255,.05)}</style><style>#container{height:100%;cursor:pointer;padding-left:8px}#switch-track{width:2em;height:.8em;background:rgba(255,255,255,.25);border-radius:999px;-webkit-transition:background .1s linear;-moz-transition:background .1s linear;-o-transition:background .1s linear;-ms-transition:background .1s linear;transition:background .1s linear}#switch-knob{height:.8em;width:.8em;border-radius:100%;background:#ecebe0;-webkit-transition:-webkit-transform .15s cubic-bezier(0.25,.25,0,1);-moz-transition:-moz-transform .15s cubic-bezier(0.25,.25,0,1);-o-transition:-o-transform .15s cubic-bezier(0.25,.25,0,1);-ms-transition:-ms-transform .15s cubic-bezier(0.25,.25,0,1);transition:transform .15s cubic-bezier(0.25,.25,0,1)}.value-true #switch-track{background:#864694}.value-true #switch-knob{-webkit-transform:translate3d(1.2em,0,0);-moz-transform:translate3d(1.2em,0,0);-o-transform:translate3d(1.2em,0,0);-ms-transform:translate3d(1.2em,0,0);transform:translate3d(1.2em,0,0)}:host-context(.touch-false) .value-false:hover #switch-knob{-webkit-transform:scale(1.5);-moz-transform:scale(1.5);-o-transform:scale(1.5);-ms-transform:scale(1.5);transform:scale(1.5)}:host-context(.touch-false) .value-true:hover #switch-knob{-webkit-transform:translate3d(1.2em,0,0) scale(1.5);-moz-transform:translate3d(1.2em,0,0) scale(1.5);-o-transform:translate3d(1.2em,0,0) scale(1.5);-ms-transform:translate3d(1.2em,0,0) scale(1.5);transform:translate3d(1.2em,0,0) scale(1.5)}#text{margin-left:8px}.value-false #text{color:rgba(255,255,255,.25)}</style><div id="container" horizontal="" layout="" center="" on-tap="{{ toggle }}" class="value-{{ value }}"><div id="switch-track"><div id="switch-knob"></div></div></div></template></polymer-element></div>',
'<div hidden><script>Gui.register("dat-gui-function",function(value){return typeof value=="function"});Polymer("dat-gui-function",{});</script><polymer-element name="dat-gui-function" extends="dat-gui-base" assetpath="../elements/dat-gui-function/"><template><style>input{font:10px \'Lucida Grande\',sans-serif;color:#ecebe0;-webkit-font-smoothing:antialiased;height:100%;width:100%;display:inline-block;background-color:transparent;border:0;-webkit-border-radius:0;border-radius:0;padding:0;outline:0;-webkit-transition:background-color .15s linear;-moz-transition:background-color .15s linear;-o-transition:background-color .15s linear;-ms-transition:background-color .15s linear;transition:background-color .15s linear;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}:host-context(.touch-true) input{font-size:13.5px}input:focus{background:rgba(255,255,255,.05)}:host-context(.touch-false) input:hover{background:rgba(255,255,255,.05)}</style><style></style><div id="container"></div></template></polymer-element></div>',
'<div hidden><script>Polymer("dat-gui-option",{key:null,ready:function(){this.options={}},init:function(options){if(Array.isArray(options)){options.forEach(function(opt){this.options[opt]=opt},this)}else{this.options=options}},valueChanged:function(){for(var i in this.options){if(this.options[i]===this.value){this.key=i;break}}this.super()},keyChanged:function(){this.value=this.options[this.key]},keys:function(object){if(object){return Object.keys(object)}}});</script><polymer-element name="dat-gui-option" extends="dat-gui-base" attributes="options key" assetpath="../elements/dat-gui-option/"><template><style>#container{height:100%;cursor:pointer;padding-left:8px}select{outline:0}</style><div id="container" horizontal="" layout="" center=""><select value="{{ key }}" on-change="{{ change }}"><template repeat="{{ name in options | keys }}"><option value="{{ name }}">{{ name }}</option></template></select></div></template></polymer-element></div>',
'',].join("\n"))