dat.gui/build/dat-gui.js

15 lines
269 KiB
JavaScript
Raw Normal View History

2014-09-10 22:40:55 +00:00
document.write(['<script>window.Platform=window.Platform||{},window.logFlags=window.logFlags||{},function(a){var b=a.flags||{};location.search.slice(1).split("&").forEach(function(a){a=a.split("="),a[0]&&(b[a[0]]=a[1]||!0)});var c=document.currentScript||document.querySelector(\'script[src*="platform.js"]\');if(c)for(var d,e=c.attributes,f=0;f<e.length;f++)d=e[f],"src"!==d.name&&(b[d.name]=d.value||!0);b.log&&b.log.split(",").forEach(function(a){window.logFlags[a]=!0}),b.shadow=b.shadow||b.shadowdom||b.polyfill,b.shadow="native"===b.shadow?!1:b.shadow||!HTMLElement.prototype.createShadowRoot,b.shadow&&document.querySelectorAll("script").length>1&&console.warn("platform.js is not the first script on the page. See http://www.polymer-project.org/docs/start/platform.html#setup for details."),b.register&&(window.CustomElements=window.CustomElements||{flags:{}},window.CustomElements.flags.register=b.register),b.imports&&(window.HTMLImports=window.HTMLImports||{flags:{}},window.HTMLImports.flags.imports=b.imports),a.flags=b}(Platform),"undefined"==typeof WeakMap&&!function(){var a=Object.defineProperty,b=Date.now()%1e9,c=function(){this.name="__st"+(1e9*Math.random()>>>0)+(b++ +"__")};c.prototype={set:function(b,c){var d=b[this.name];d&&d[0]===b?d[1]=c:a(b,this.name,{value:[b,c],writable:!0})},get:function(a){var b;return(b=a[this.name])&&b[0]===a?b[1]:void 0},"delete":function(a){var b=a[this.name];if(!b)return!1;var c=b[0]===a;return b[0]=b[1]=void 0,c},has:function(a){var b=a[this.name];return b?b[0]===a:!1}},window.WeakMap=c}(),Platform.flags.shadow?(!function(global){"use strict";function detectObjectObserve(){function a(a){b=a}if("function"!=typeof Object.observe||"function"!=typeof Array.observe)return!1;var b=[],c={},d=[];return Object.observe(c,a),Array.observe(d,a),c.id=1,c.id=2,delete c.id,d.push(1,2),d.length=0,Object.deliverChangeRecords(a),5!==b.length?!1:"add"!=b[0].type||"update"!=b[1].type||"delete"!=b[2].type||"splice"!=b[3].type||"splice"!=b[4].type?!1:(Object.unobserve(c,a),Array.unobserve(d,a),!0)}function detectEval(){if("undefined"!=typeof chrome&&chrome.app&&chrome.app.runtime)return!1;if(navigator.getDeviceStorage)return!1;try{var a=new Function("","return true;");return a()}catch(b){return!1}}function isIndex(a){return+a===a>>>0}function toNumber(a){return+a}function isObject(a){return a===Object(a)}function areSameValue(a,b){return a===b?0!==a||1/a===1/b:numberIsNaN(a)&&numberIsNaN(b)?!0:a!==a&&b!==b}function getPathCharType(a){if(void 0===a)return"eof";var b=a.charCodeAt(0);switch(b){case 91:case 93:case 46:case 34:case 39:case 48:return a;case 95:case 36:return"ident";case 32:case 9:case 10:case 13:case 160:case 65279:case 8232:case 8233:return"ws"}return b>=97&&122>=b||b>=65&&90>=b?"ident":b>=49&&57>=b?"number":"else"}function noop(){}function parsePath(a){function b(){if(!(k>=a.length)){var b=a[k+1];return"inSingleQuote"==l&&"\'"==b||"inDoubleQuote"==l&&\'"\'==b?(k++,d=b,m.append(),!0):void 0}}for(var c,d,e,f,g,h,i,j=[],k=-1,l="beforePath",m={push:function(){void 0!==e&&(j.push(e),e=void 0)},append:function(){void 0===e?e=d:e+=d}};l;)if(k++,c=a[k],"\\\\"!=c||!b(l)){if(f=getPathCharType(c),i=pathStateMachine[l],g=i[f]||i["else"]||"error","error"==g)return;if(l=g[0],h=m[g[1]]||noop,d=void 0===g[2]?c:g[2],h(),"afterPath"===l)return j}}function isIdent(a){return identRegExp.test(a)}function Path(a,b){if(b!==constructorIsPrivate)throw Error("Use Path.get to retrieve path objects");for(var c=0;c<a.length;c++)this.push(String(a[c]));hasEval&&this.length&&(this.getValueFrom=this.compiledGetValueFromFn())}function getPath(a){if(a instanceof Path)return a;if((null==a||0==a.length)&&(a=""),"string"!=typeof a){if(isIndex(a.length))return new Path(a,constructorIsPrivate);a=String(a)}var b=pathCache[a];if(b)return b;var c=parsePath(a);if(!c)return invalidPath;var b=new Path(c,constructorIsPrivate);return pathCache[a]=b,b}function formatAccessor(a){return isIndex(a)?"["+a+"]":\'["\'+a.replace(/"/g,\'\\\\"\')+\'"]\'}function dirtyCheck(a){for(var b=0;MAX_DIRTY_CHECK_CYCLES>b&&a.check_();)b++;return testingExpose
'}function o(a,b,c,d){var e=db;if(c&&!r(c,a,e,b,d))return!1;for(var f=b.length-1;f>0;f--)if(!r(b[f],a,e,b,d))return!1;return!0}function p(a,b,c,d){var e=eb,f=b[0]||c;return r(f,a,e,b,d)}function q(a,b,c,d){for(var e=fb,f=1;f<b.length;f++)if(!r(b[f],a,e,b,d))return;c&&b.length>0&&r(c,a,e,b,d)}function r(a,b,c,d,e){var f=T.get(a);if(!f)return!0;var g=e||h(d,a);if(g===a){if(c===db)return!0;c===fb&&(c=eb)}else if(c===fb&&!b.bubbles)return!0;if("relatedTarget"in b){var i=Q(b),j=i.relatedTarget;if(j){if(j instanceof Object&&j.addEventListener){var l=R(j),m=k(b,a,l);if(m===g)return!0}else m=null;Y.set(b,m)}}Z.set(b,c);var n=b.type,o=!1;W.set(b,g),X.set(b,a),f.depth++;for(var p=0,q=f.length;q>p;p++){var r=f[p];if(r.removed)o=!0;else if(!(r.type!==n||!r.capture&&c===db||r.capture&&c===fb))try{if("function"==typeof r.handler?r.handler.call(a,b):r.handler.handleEvent(b),_.get(b))return!1}catch(s){J||(J=s)}}if(f.depth--,o&&0===f.depth){var t=f.slice();f.length=0;for(var p=0;p<t.length;p++)t[p].removed||f.push(t[p])}return!$.get(b)}function s(a,b,c){this.type=a,this.handler=b,this.capture=Boolean(c)}function t(a,b){if(!(a instanceof gb))return R(x(gb,"Event",a,b));var c=a;return rb||"beforeunload"!==c.type?void O(c,this):new y(c)}function u(a){return a&&a.relatedTarget?Object.create(a,{relatedTarget:{value:Q(a.relatedTarget)}}):a}function v(a,b,c){var d=window[a],e=function(b,c){return b instanceof d?void O(b,this):R(x(d,a,b,c))};if(e.prototype=Object.create(b.prototype),c&&M(e.prototype,c),d)try{N(d,e,new d("temp"))}catch(f){N(d,e,document.createEvent(a))}return e}function w(a,b){return function(){arguments[b]=Q(arguments[b]);var c=Q(this);c[a].apply(c,arguments)}}function x(a,b,c,d){if(pb)return new a(c,u(d));var e=Q(document.createEvent(b)),f=ob[b],g=[c];return Object.keys(f).forEach(function(a){var b=null!=d&&a in d?d[a]:f[a];"relatedTarget"===a&&(b=Q(b)),g.push(b)}),e["init"+b].apply(e,g),e}function y(a){t.call(this,a)}function z(a){return"function"==typeof a?!0:a&&a.handleEvent}function A(a){switch(a){case"DOMAttrModified":case"DOMAttributeNameChanged":case"DOMCharacterDataModified":case"DOMElementNameChanged":case"DOMNodeInserted":case"DOMNodeInsertedIntoDocument":case"DOMNodeRemoved":case"DOMNodeRemovedFromDocument":case"DOMSubtreeModified":return!0}return!1}function B(a){O(a,this)}function C(a){return a instanceof S.ShadowRoot&&(a=a.host),Q(a)}function D(a,b){var c=T.get(a);if(c)for(var d=0;d<c.length;d++)if(!c[d].removed&&c[d].type===b)return!0;return!1}function E(a,b){for(var c=Q(a);c;c=c.parentNode)if(D(R(c),b))return!0;return!1}function F(a){K(a,tb)}function G(b,c,e,f){a.renderAllPending();var g=R(ub.call(P(c),e,f));if(!g)return null;var i=d(g,null),j=i.lastIndexOf(b);return-1==j?null:(i=i.slice(0,j),h(i,b))}function H(a){return function(){var b=ab.get(this);return b&&b[a]&&b[a].value||null}}function I(a){var b=a.slice(2);return function(c){var d=ab.get(this);d||(d=Object.create(null),ab.set(this,d));var e=d[a];if(e&&this.removeEventListener(b,e.wrapped,!1),"function"==typeof c){var f=function(b){var d=c.call(this,b);d===!1?b.preventDefault():"onbeforeunload"===a&&"string"==typeof d&&(b.returnValue=d)};this.addEventListener(b,f,!1),d[a]={value:c,wrapped:f}}}}var J,K=a.forwardMethodsToWrapper,L=a.getTreeScope,M=a.mixin,N=a.registerWrapper,O=a.setWrapper,P=a.unsafeUnwrap,Q=a.unwrap,R=a.wrap,S=a.wrappers,T=(new WeakMap,new WeakMap),U=new WeakMap,V=new WeakMap,W=new WeakMap,X=new WeakMap,Y=new WeakMap,Z=new WeakMap,$=new WeakMap,_=new WeakMap,ab=new WeakMap,bb=new WeakMap,cb=0,db=1,eb=2,fb=3;s.prototype={equals:function(a){return this.handler===a.handler&&this.type===a.type&&this.capture===a.capture},get removed(){return null===this.handler},remove:function(){this.handler=null}};var gb=window.Event;gb.prototype.polymerBlackList_={returnValue:!0,keyLocation:!0},t.prototype={get target(){return W.get(this)},get currentTarget(){return X.get(this)},get eventPhase(){return Z.get(this)},get path(){var a=bb.get(this);return a?a.slice():[]},stopPropagation:function(){$.set(this,!0)},stopImmediatePropagation:function(){$.set(this,!0
'},get rows(){return h(f(this).rows)},insertRow:function(a){return g(f(this).insertRow(a))}}),e(i,b,document.createElement("table")),a.wrappers.HTMLTableElement=b}(window.ShadowDOMPolyfill),function(a){"use strict";function b(a){c.call(this,a)}var c=a.wrappers.HTMLElement,d=a.mixin,e=a.registerWrapper,f=a.wrapHTMLCollection,g=a.unwrap,h=a.wrap,i=window.HTMLTableSectionElement;b.prototype=Object.create(c.prototype),d(b.prototype,{constructor:b,get rows(){return f(g(this).rows)},insertRow:function(a){return h(g(this).insertRow(a))}}),e(i,b,document.createElement("thead")),a.wrappers.HTMLTableSectionElement=b}(window.ShadowDOMPolyfill),function(a){"use strict";function b(a){c.call(this,a)}var c=a.wrappers.HTMLElement,d=a.mixin,e=a.registerWrapper,f=a.wrapHTMLCollection,g=a.unwrap,h=a.wrap,i=window.HTMLTableRowElement;b.prototype=Object.create(c.prototype),d(b.prototype,{get cells(){return f(g(this).cells)},insertCell:function(a){return h(g(this).insertCell(a))}}),e(i,b,document.createElement("tr")),a.wrappers.HTMLTableRowElement=b}(window.ShadowDOMPolyfill),function(a){"use strict";function b(a){switch(a.localName){case"content":return new c(a);case"shadow":return new e(a);case"template":return new f(a)}d.call(this,a)}var c=a.wrappers.HTMLContentElement,d=a.wrappers.HTMLElement,e=a.wrappers.HTMLShadowElement,f=a.wrappers.HTMLTemplateElement,g=(a.mixin,a.registerWrapper),h=window.HTMLUnknownElement;b.prototype=Object.create(d.prototype),g(h,b),a.wrappers.HTMLUnknownElement=b}(window.ShadowDOMPolyfill),function(a){"use strict";var b=a.wrappers.Element,c=a.wrappers.HTMLElement,d=a.registerObject,e="http://www.w3.org/2000/svg",f=document.createElementNS(e,"title"),g=d(f),h=Object.getPrototypeOf(g.prototype).constructor;if(!("classList"in f)){var i=Object.getOwnPropertyDescriptor(b.prototype,"classList");Object.defineProperty(c.prototype,"classList",i),delete b.prototype.classList}a.wrappers.SVGElement=h}(window.ShadowDOMPolyfill),function(a){"use strict";function b(a){m.call(this,a)}var c=a.mixin,d=a.registerWrapper,e=a.unwrap,f=a.wrap,g=window.SVGUseElement,h="http://www.w3.org/2000/svg",i=f(document.createElementNS(h,"g")),j=document.createElementNS(h,"use"),k=i.constructor,l=Object.getPrototypeOf(k.prototype),m=l.constructor;b.prototype=Object.create(l),"instanceRoot"in j&&c(b.prototype,{get instanceRoot(){return f(e(this).instanceRoot)},get animatedInstanceRoot(){return f(e(this).animatedInstanceRoot)}}),d(g,b,j),a.wrappers.SVGUseElement=b}(window.ShadowDOMPolyfill),function(a){"use strict";function b(a){c.call(this,a)}var c=a.wrappers.EventTarget,d=a.mixin,e=a.registerWrapper,f=a.unsafeUnwrap,g=a.wrap,h=window.SVGElementInstance;h&&(b.prototype=Object.create(c.prototype),d(b.prototype,{get correspondingElement(){return g(f(this).correspondingElement)},get correspondingUseElement(){return g(f(this).correspondingUseElement)},get parentNode(){return g(f(this).parentNode)},get childNodes(){throw new Error("Not implemented")},get firstChild(){return g(f(this).firstChild)},get lastChild(){return g(f(this).lastChild)},get previousSibling(){return g(f(this).previousSibling)},get nextSibling(){return g(f(this).nextSibling)}}),e(h,b),a.wrappers.SVGElementInstance=b)}(window.ShadowDOMPolyfill),function(a){"use strict";function b(a){e(a,this)}var c=a.mixin,d=a.registerWrapper,e=a.setWrapper,f=a.unsafeUnwrap,g=a.unwrap,h=a.unwrapIfNeeded,i=a.wrap,j=window.CanvasRenderingContext2D;c(b.prototype,{get canvas(){return i(f(this).canvas)},drawImage:function(){arguments[0]=h(arguments[0]),f(this).drawImage.apply(f(this),arguments)},createPattern:function(){return arguments[0]=g(arguments[0]),f(this).createPattern.apply(f(this),arguments)}}),d(j,b,document.createElement("canvas").getContext("2d")),a.wrappers.CanvasRenderingContext2D=b}(window.ShadowDOMPolyfill),function(a){"use strict";function b(a){e(a,this)}var c=a.mixin,d=a.registerWrapper,e=a.setWrapper,f=a.unsafeUnwrap,g=a.unwrapIfNeeded,h=a.wrap,i=window.WebGLRenderingContext;if(i){c(b.prototype,{get canvas(){return h(f(this).canvas)},texImage2D:function(){arguments[5]=g(arguments[5]),f
'}};var e=HTMLImports.parser.hasResource;HTMLImports.parser.hasResource=function(a){return"link"===a.localName&&"stylesheet"===a.rel&&a.hasAttribute(y)?a.__resource:e.call(this,a)}}})}a.ShadowCSS=k}(window.Platform)):!function(){window.wrap=window.unwrap=function(a){return a},addEventListener("DOMContentLoaded",function(){if(CustomElements.useNative===!1){var a=Element.prototype.createShadowRoot;Element.prototype.createShadowRoot=function(){var b=a.call(this);return CustomElements.watchShadow(this),b}}})}(window.Platform),function(a){"use strict";function b(a){return void 0!==m[a]}function c(){h.call(this),this._isInvalid=!0}function d(a){return""==a&&c.call(this),a.toLowerCase()}function e(a){var b=a.charCodeAt(0);return b>32&&127>b&&-1==[34,35,60,62,63,96].indexOf(b)?a:encodeURIComponent(a)}function f(a){var b=a.charCodeAt(0);return b>32&&127>b&&-1==[34,35,60,62,96].indexOf(b)?a:encodeURIComponent(a)}function g(a,g,h){function i(a){t.push(a)}var j=g||"scheme start",k=0,l="",r=!1,s=!1,t=[];a:for(;(a[k-1]!=o||0==k)&&!this._isInvalid;){var u=a[k];switch(j){case"scheme start":if(!u||!p.test(u)){if(g){i("Invalid scheme.");break a}l="",j="no scheme";continue}l+=u.toLowerCase(),j="scheme";break;case"scheme":if(u&&q.test(u))l+=u.toLowerCase();else{if(":"!=u){if(g){if(o==u)break a;i("Code point not allowed in scheme: "+u);break a}l="",k=0,j="no scheme";continue}if(this._scheme=l,l="",g)break a;b(this._scheme)&&(this._isRelative=!0),j="file"==this._scheme?"relative":this._isRelative&&h&&h._scheme==this._scheme?"relative or authority":this._isRelative?"authority first slash":"scheme data"}break;case"scheme data":"?"==u?(query="?",j="query"):"#"==u?(this._fragment="#",j="fragment"):o!=u&&" "!=u&&"\\n"!=u&&"\\r"!=u&&(this._schemeData+=e(u));break;case"no scheme":if(h&&b(h._scheme)){j="relative";continue}i("Missing scheme."),c.call(this);break;case"relative or authority":if("/"!=u||"/"!=a[k+1]){i("Expected /, got: "+u),j="relative";continue}j="authority ignore slashes";break;case"relative":if(this._isRelative=!0,"file"!=this._scheme&&(this._scheme=h._scheme),o==u){this._host=h._host,this._port=h._port,this._path=h._path.slice(),this._query=h._query;break a}if("/"==u||"\\\\"==u)"\\\\"==u&&i("\\\\ is an invalid code point."),j="relative slash";else if("?"==u)this._host=h._host,this._port=h._port,this._path=h._path.slice(),this._query="?",j="query";else{if("#"!=u){var v=a[k+1],w=a[k+2];("file"!=this._scheme||!p.test(u)||":"!=v&&"|"!=v||o!=w&&"/"!=w&&"\\\\"!=w&&"?"!=w&&"#"!=w)&&(this._host=h._host,this._port=h._port,this._path=h._path.slice(),this._path.pop()),j="relative path";continue}this._host=h._host,this._port=h._port,this._path=h._path.slice(),this._query=h._query,this._fragment="#",j="fragment"}break;case"relative slash":if("/"!=u&&"\\\\"!=u){"file"!=this._scheme&&(this._host=h._host,this._port=h._port),j="relative path";continue}"\\\\"==u&&i("\\\\ is an invalid code point."),j="file"==this._scheme?"file host":"authority ignore slashes";break;case"authority first slash":if("/"!=u){i("Expected \'/\', got: "+u),j="authority ignore slashes";continue}j="authority second slash";break;case"authority second slash":if(j="authority ignore slashes","/"!=u){i("Expected \'/\', got: "+u);continue}break;case"authority ignore slashes":if("/"!=u&&"\\\\"!=u){j="authority";continue}i("Expected authority, got: "+u);break;case"authority":if("@"==u){r&&(i("@ already seen."),l+="%40"),r=!0;for(var x=0;x<l.length;x++){var y=l[x];if(" "!=y&&"\\n"!=y&&"\\r"!=y)if(":"!=y||null!==this._password){var z=e(y);null!==this._password?this._password+=z:this._username+=z}else this._password="";else i("Invalid whitespace in authority.")}l=""}else{if(o==u||"/"==u||"\\\\"==u||"?"==u||"#"==u){k-=l.length,l="",j="host";continue}l+=u}break;case"file host":if(o==u||"/"==u||"\\\\"==u||"?"==u||"#"==u){2!=l.length||!p.test(l[0])||":"!=l[1]&&"|"!=l[1]?0==l.length?j="relative path start":(this._host=d.call(this,l),l="",j="relative path start"):j="relative path";continue}" "==u||"\\n"==u||"\\r"==u?i("Invalid whitespace in file host."):l+=u;break;case"host":case"hostname":if(
'document.registerElement=b,document.createElement=r,document.createElementNS=q,Node.prototype.cloneNode=t,a.registry=z,a.upgrade=s}var E;E=Object.__proto__||w?function(a,b){return a instanceof b}:function(a,b){for(var c=a;c;){if(c===b.prototype)return!0;c=c.__proto__}return!1},a.instanceof=E,a.reservedTagList=y,document.register=document.registerElement,a.hasNative=v,a.useNative=w}(window.CustomElements),function(a){function b(a){return"link"===a.localName&&a.getAttribute("rel")===c}var c=a.IMPORT_LINK_TYPE,d={selectors:["link[rel="+c+"]"],map:{link:"parseLink"},parse:function(a){if(!a.__parsed){a.__parsed=!0;var b=a.querySelectorAll(d.selectors);e(b,function(a){d[d.map[a.localName]](a)}),CustomElements.upgradeDocument(a),CustomElements.observeDocument(a)}},parseLink:function(a){b(a)&&this.parseImport(a)},parseImport:function(a){a.import&&d.parse(a.import)}},e=Array.prototype.forEach.call.bind(Array.prototype.forEach);a.parser=d,a.IMPORT_LINK_TYPE=c}(window.CustomElements),function(a){function b(){CustomElements.parser.parse(document),CustomElements.upgradeDocument(document),window.HTMLImports&&(HTMLImports.__importsParsingHook=function(a){CustomElements.parser.parse(a.import)}),CustomElements.ready=!0,setTimeout(function(){CustomElements.readyTime=Date.now(),window.HTMLImports&&(CustomElements.elapsed=CustomElements.readyTime-HTMLImports.readyTime),document.dispatchEvent(new CustomEvent("WebComponentsReady",{bubbles:!0}))})}if("function"!=typeof window.CustomEvent&&(window.CustomEvent=function(a,b){b=b||{};var c=document.createEvent("CustomEvent");return c.initCustomEvent(a,Boolean(b.bubbles),Boolean(b.cancelable),b.detail),c},window.CustomEvent.prototype=window.Event.prototype),"complete"===document.readyState||a.flags.eager)b();else if("interactive"!==document.readyState||window.attachEvent||window.HTMLImports&&!window.HTMLImports.ready){var c=window.HTMLImports&&!HTMLImports.ready?"HTMLImportsLoaded":"DOMContentLoaded";window.addEventListener(c,b)}else b()}(window.CustomElements),function(){if(window.ShadowDOMPolyfill){var a=["upgradeAll","upgradeSubtree","observeDocument","upgradeDocument"],b={};a.forEach(function(a){b[a]=CustomElements[a]}),a.forEach(function(a){CustomElements[a]=function(c){return b[a](wrap(c))}})}}(),function(){var a=document.createElement("style");a.textContent="body {transition: opacity ease-in 0.2s; } \\nbody[unresolved] {opacity: 0; display: block; overflow: hidden; } \\n";var b=document.querySelector("head");b.insertBefore(a,b.firstChild)}(Platform),function(a){function b(a,b){return b=b||[],b.map||(b=[b]),a.apply(this,b.map(d))}function c(a,c,d){var e;switch(arguments.length){case 0:return;case 1:e=null;break;case 2:e=c.apply(this);break;default:e=b(d,c)}f[a]=e}function d(a){return f[a]}function e(a,c){HTMLImports.whenImportsReady(function(){b(c,a)})}var f={};a.marshal=d,a.modularize=c,a.using=e}(window);</script>',
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"))