belinghy commited on
Commit
c99696a
1 Parent(s): c959593

migrate project demo

Browse files
index.html CHANGED
@@ -1,24 +1,91 @@
1
  <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>
13
- You can modify this app directly by editing <i>index.html</i> in the
14
- Files and versions tab.
15
- </p>
16
- <p>
17
- Also don't forget to check the
18
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank"
19
- >Spaces documentation</a
20
- >.
21
- </p>
22
- </div>
23
- </body>
24
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1">
6
+ <title>Character Controllers Using Motion VAEs</title>
7
+ <meta name="description" content="Character animation using reinforcement learning on top of learned VAE motion model.">
8
+
9
+ <meta property="og:title" content="Character Controllers Using Motion VAEs">
10
+ <meta property="og:description" content="Character animation using reinforcement learning on top of learned VAE motion model.">
11
+ <meta property="og:image" content="./static/og-mvae.jpg">
12
+ <meta name="twitter:card" content="./static/og-mvae.jpg">
13
+
14
+ <style>
15
+ :root {
16
+ --accent-color: rgb(6, 69, 173);
17
+ --fg-color: rgb(32, 33, 34);
18
+ --bg-color: #fff;
19
+ --max-content-width: 800px;
20
+ }
21
+
22
+ body {
23
+ font-family: sans-serif;
24
+ font-size: calc(12px + 0.05vw);
25
+ color: var(--fg-color);
26
+ background-color: var(--bg-color);
27
+ -webkit-font-smoothing: antialiased;
28
+ }
29
+
30
+ main {
31
+ margin: 0 auto;
32
+ width: 90vw;
33
+ max-width: var(--max-content-width);
34
+ background-color: var(--bg-color);
35
+ min-height: 90vh;
36
+ }
37
+
38
+ h1 {
39
+ font-weight: 600;
40
+ margin-top: 1.3em;
41
+ font-size: 2.4em;
42
+ }
43
+
44
+ p, li {
45
+ font-size: 1.3em;
46
+ line-height: 1.6;
47
+ }
48
+
49
+ a {
50
+ text-decoration: none;
51
+ color: var(--accent-color);
52
+ }
53
+
54
+ a:hover {
55
+ text-decoration: underline;
56
+ }
57
+
58
+ @media (prefers-color-scheme: dark) {
59
+ :root {
60
+ --accent-color: #e1b478;
61
+ --bg-color: #151515;
62
+ --fg-color: #ddd;
63
+ }
64
+ }
65
+ </style>
66
+ <script defer src="./static/demo.min.js"></script>
67
+ </head>
68
+ <body>
69
+ <main style="text-align: center;">
70
+ <h1 >Motion VAEs</h1>
71
+ <p>AI model generating controllable character motions</p>
72
+
73
+ <div id="demoContainer" style="position: relative; background-color: #282c34; padding-bottom: 56.25%;">
74
+ <button id="demoButton" style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 2; cursor: pointer; padding: 0.375rem 0.75rem; font-size: 1.5em; background-color: #1080b5; border-width: 0; color: #fff; border-radius: 0.2rem; box-shadow: 0 0 2pt 2pt orange;">
75
+ Show Demo (8MB)
76
+ </button>
77
+ <div id="guiContainer" style="position: absolute; z-index: 1; width: 25%"></div>
78
+ <div id="mvaeScene" style="position: absolute; width: 100%; height: 100%"></div>
79
+ </div>
80
+ <ul>
81
+ <li>Left-drag to rotate, right-drag to pan, and scroll to zoom</li>
82
+ <li>Place target or change direction: <em>Ctrl-click</em> or <em>Cmd-click</em></li>
83
+ </ul>
84
+ <div>
85
+ <hr>
86
+ <p>Created by <a href="https://hungyuling.com">Hung Yu Ling</a> et al.</p>
87
+ <p><a href="https://github.com/electronicarts/character-motion-vaes">GitHub</a> and <a href="https://hungyuling.com/projects/MVAE/">Project website</a></p>
88
+ </div>
89
+ </main>
90
+ </body>
91
+ </html>
static/demo.min.js ADDED
@@ -0,0 +1 @@
 
1
+ (()=>{const e=document.getElementById("demoButton");e.onclick=async function(t){e.onclick=null,e.innerText="Loading Modules ~10s",await Promise.all([import("./onnx.min.js"),import("./three/build/three.module.min.js"),import("./three/examples/jsm/controls/OrbitControls.min.js"),import("./three/examples/jsm/libs/dat.gui.module.min.js")]).then(e=>{window.THREE=e[1],window.OrbitControls=e[2].OrbitControls,window.GUI=e[3].GUI});const o=await Promise.all([fetch("./static/mvae.onnx").then(e=>e.arrayBuffer()),fetch("./static/target_controller.onnx").then(e=>e.arrayBuffer()),fetch("./static/joystick_controller.onnx").then(e=>e.arrayBuffer())]).then(e=>({mvae:e[0],target:e[1],joystick:e[2]})),n={};for(let[e,t]of Object.entries(o))n[e]=new onnx.InferenceSession({backendHint:"webgl"}),await n[e].loadModel(t);const i=document.getElementById("mvaeScene"),s=new THREE.WebGLRenderer({antialias:!0,alpha:!0});s.setPixelRatio(window.devicePixelRatio),s.setSize(i.clientWidth,i.clientHeight),s.outputEncoding=THREE.sRGBEncoding,s.shadowMap.enabled=!0,s.domElement.style.outline="none",i.appendChild(s.domElement);const a=new THREE.Scene;a.background=new THREE.Color(2632756),a.fog=new THREE.Fog(2632756,10,400);const r=new THREE.PerspectiveCamera(25,i.clientWidth/i.clientHeight,.1,1e3);r.position.set(30,4,30),r.lookAt(0,0,0);const c=new OrbitControls(r,s.domElement);c.enableDamping=!0,c.keys={LEFT:65,UP:87,RIGHT:68,BOTTOM:83},c.minDistance=20,c.maxDistance=200,c.update();const l=new THREE.TextureLoader,d=new THREE.Raycaster,p=new THREE.Vector2;let E=0,h=0,u=0,w=[0,0,0],m=new onnx.Tensor(new Float32Array(32),"float32",[1,32]),f=new onnx.Tensor(new Float32Array(267),"float32",[1,267]);const M=[.2337,.0663,.0614,.9697,.2778,.7038,.9697,.2778,.7038,.1865,.3471,.1654,.2632,.3683,.2215,.3824,.408,.3032,.3247,.3808,.2617,.3247,.3808,.2617,.3628,.3749,.2736,.3628,.3749,.2736,.4146,.3826,.2113,.4146,.3826,.2113,.0048,.3071,.0048,.7615,.3368,.6285,.7615,.3368,.6285,.0158,.3156,.016,.0158,.3156,.016,.4892,.2069,.3532,.4892,.2069,.3532,.0492,.3164,.0526,.12,.3314,.1132,.5161,.4031,.2726,.5161,.4031,.2726,.4056,.1132,.1208,.4056,.1132,.1208,.2268,.054,.0672,.2245,.0548,.0669,.2213,.0567,.0698,.223,.0554,.0677,.223,.0554,.0677,.2255,.0607,.0691,.2255,.0607,.0691,.2488,.1168,.0937,.2488,.1168,.0937,.2337,.0527,.0714,.3489,.1147,.1136,.3489,.1147,.1136,.2348,.0533,.0728,.2348,.0533,.0728,.291,.0778,.081,.291,.0778,.081,.2317,.0529,.0705,.229,.0534,.0686,.2855,.1421,.1301,.2855,.1421,.1301,.4053,.3292,.1624,.4053,.3292,.1624,.0919,.2076,.0945,.1048,.2116,.1123,.1294,.1692,.1227,.1161,.2072,.1589,.1161,.2072,.1589,.2761,.2619,.2591,.2761,.2619,.2591,.397,.3733,.2129,.397,.3733,.2129,.0409,.1883,.0369,.243,.4652,.1788,.243,.4652,.1788,.1376,.3043,.2111,.1376,.3043,.2111,.2872,.3043,.2376,.2872,.3043,.2376,.0686,.2018,.0612,.0799,.2049,.0769,.4131,.4178,.326,.413,.4178,.326,.1946,.2185,.0824,.1946,.2185,.0824,.083,.1624,.0254,.0995,.1588,.0252,.1439,.1504,.0314,.2075,.1172,.1885,.2075,.1172,.1885,.2097,.2119,.1359,.2097,.2119,.1359,.2097,.2119,.1359,.2097,.2119,.1359,.0372,.2014,.0372,.1857,.2257,.0808,.1857,.2257,.0808,.1552,.2805,.094,.1552,.2805,.094,.1552,.2805,.094,.1552,.2805,.094,.052,.1751,.0286,.0664,.1678,.0266,.2818,.2703,.1431,.2818,.2703,.1431],g=[.26107,-4.7486e-7,1.401e-7,-.0028028,.30103,-.36838,-.0027801,.30103,.36839,.14925,3.8383,-8.6033e-7,.24685,4.1773,-6.7364e-7,.41594,4.6868,-2.4816e-8,.28113,4.435,-.088858,.28113,4.435,.088857,.29221,4.4636,-.59573,.29222,4.4636,.59572,-.11323,3.8501,.90934,-.11324,3.8501,-.90934,-5509e-8,2.9514,7.9133e-12,-.31353,.66536,-.27751,-.31351,.66536,.27751,-.049933,2.9565,-.3931,-.049933,2.9565,.3931,.38439,1.6758,-.43913,.3844,1.6758,.43913,.0083124,3.2001,-5.0445e-7,.075637,3.536,-8.0779e-7,.36293,3.3118,-.7784,.36294,3.3118,.7784,.28288,1953e-7,-.013949,.28288,19532e-8,.013949,.25435,-11878e-8,-5.0363e-7,.25261,-10782e-8,-5.3367e-7,.25019,-84664e-9,-5.927e-7,.25142,-1101e-7,8511e-8,.25142,-11008e-8,-86227e-9,.25097,-53605e-9,.0012627,.25097,-53493e-9,-.0012638,.25386,29768e-9,-.0051661,.25386,29656e-9,.0051651,.25973,-12142e-8,-4.7796e-7,.2802,25689e-8,-.011458,.2802,25717e-8,.011458,.25962,-13255e-8,-58587e-8,.25962,-13255e-8,58493e-8,.27278,18581e-9,-.009093,.27278,18695e-9,.0090928,.25799,-12785e-8,-4.7312e-7,.25601,-12486e-8,-4.8496e-7,.25366,6089e-7,.0079774,.25366,60939e-8,-.0079785,-.20331,-.81218,75829e-8,-.20331,-.81218,-75517e-8,.93253,-.26446,-17862e-10,.91736,-.30011,-22849e-10,.83715,-.4886,-9844e-9,.90167,-.32442,-.0079873,.90167,-.32442,.0079802,.66979,-.5487,.1958,.66978,-.5487,-.19581,.51202,.53974,-.32292,.51202,.53974,.32291,.97553,-.099292,-4.7701e-8,-.61732,-.55017,.093872,-.61732,-.55018,-.093873,-.85457,-.27279,.19796,-.85457,-.27279,-.19796,-.7157,.48543,.14351,-.71571,.48542,-.14351,.95673,-.18836,-8.6077e-7,.94572,-.22657,-13113e-10,.46985,.51673,.24654,.46985,.51673,-.24655,-.16761,.039161,-.93701,.16762,-.039163,-.93701,-17539e-10,6.0989e-7,-.98291,-21627e-10,13742e-10,-.98196,-10023e-9,11619e-10,-.97758,-.32096,-.89459,-.066042,.32096,.89459,-.066042,-.37467,-.18443,.84751,.37468,.18443,.8475,.37468,.18443,.8475,-.37467,-.18443,.84751,4.7733e-8,-19534e-10,-.9781,-.16384,.043208,-.93774,.16385,-.04321,-.93774,-.19273,-.020136,-.9224,.19273,.020141,-.9224,-.19272,-.020145,-.9224,.19273,.02015,-.9224,-8.4422e-7,-8.6653e-7,-.98276,-13142e-10,-1.3712e-7,-.98322,-.25745,-.20945,.8467,.25746,.20945,.84669],T=[.37343,.025392,-.0036897,.91467,.20899,-1.0637,-1.6662,.73143,-.88882,.29283,3.852,.27816,.45728,4.1711,.35562,.73643,4.6469,.45095,.54106,4.4424,.32156,.55217,4.4007,.49731,.53249,4.5413,-.19381,.64737,4.3115,1.0057,.088589,3.682,1.3214,.22347,4.0642,-.8903,0,3.0089,0,.41466,.50355,-.9374,-1.4528,1.225,-.63671,-.031384,3.1669,-.37173,-.067839,2.8752,.37637,.66035,1.8958,-.76142,-.1062,1.5319,-.28707,.044212,3.2461,.09468,.1651,3.5656,.19719,.74468,3.3334,-.84051,.64904,3.2906,.73755,.17409,-.12108,.025089,.38499,.28025,.12745,.36488,-.015865,-.0033239,.36296,-.011497,-.016055,.36115,-.0059476,-.03615,.36703,-.014265,-.032338,.35635,-99516e-8,-.027624,.4116,-.069391,-.048794,.30963,.025622,-.011095,.23451,.092727,.0062983,.55357,-.22211,-.038469,.37352,-.028061,.024014,.20644,-.078941,.076509,.49427,.2346,.15348,.37234,-.038626,.019442,.37435,-.018714,.027618,.28971,-.076181,-.01701,.64407,-.034401,-.012438,.37001,-.024745,.017678,.36711,-.020063,.0071973,.74105,-.11856,.037614,.16907,-.22738,.063841,.0089425,-.99831,-.057434,-.98963,-.11627,-.084324,.89335,-.42454,-.14729,.8646,-.47384,-.16715,.75405,-.64569,-.12038,.85399,-.50816,-.1117,.84038,-.48479,-.24236,.65666,-.7256,.20567,.45273,-.68694,-.56846,.45016,.879,-.1572,.46176,.38382,.79967,.97032,-.23754,-.045353,-.49521,-.86664,.060737,-.93292,.33144,.14074,-.85423,-.50399,.12763,-.99094,.08114,-.10699,-.95551,.1355,.26199,-.29873,.87383,.38365,.94078,-.32382,-.10032,.91878,-.37446,-.12497,.46267,.51188,.72382,.60684,.72977,.31492,-.2146,.054182,-.9752,.023719,.44674,-.89435,-.038452,.25434,-.96635,-.061361,.2306,-.97111,.0088725,.19328,-.9811,-.52004,-.8404,-.15259,.51074,.85799,.054759,-.6713,-.43805,.59789,.63929,-.19434,.744,.63929,-.19434,.744,-.6713,-.43805,.59789,.045352,.36296,-.9307,-.2144,.054166,-.97524,.023728,.44659,-.89442,-.23929,.16321,-.95713,.13181,.43593,-.89027,-.23929,.16321,-.95713,.13181,.43593,-.89027,.0032209,.30445,-.95252,-.016893,.279,-.96014,-.35985,-.63774,.68102,.35872,-.60504,.71081],y=[[12,0],[16,12],[14,16],[15,17],[17,13],[13,1],[5,7],[7,10],[10,20],[6,8],[8,9],[9,21],[3,18],[14,15]],R=1/.3048,x=2*Math.PI;function H(){u=0,w=[0,0,0],c.target.x=0,c.target.z=0,B.position.x=15,B.position.z=15,h=0,E=0,function(){for(let e=0;e<f.data.length;e++)f.set((T[e]-g[e])/M[e],[0,e])}()}const k=new GUI({autoPlace:!1});let A={Task:"target",Reset:!1,Pause:!1};k.add(A,"Task",{Target:"target",Joystick:"joystick"}).setValue("target").onChange(()=>{H(),s.domElement.focus()});const z=k.add(A,"Reset");z.onChange(()=>{H(),setTimeout(()=>{A.Reset=!1,z.updateDisplay()},100)}),k.add(A,"Pause"),document.getElementById("guiContainer").appendChild(k.domElement);const j=new THREE.SpotLight(16777215);j.position.set(100,1e3,100),j.castShadow=!0,a.add(j);const v=l.load("./static/grid.png");v.wrapS=v.wrapT=THREE.RepeatWrapping,v.repeat.set(50,50),v.anisotropy=16,v.encoding=THREE.sRGBEncoding;const P=new THREE.Mesh(new THREE.PlaneBufferGeometry(400,400),new THREE.MeshLambertMaterial({map:v}));P.rotation.x=-Math.PI/2,P.receiveShadow=!0,a.add(P);const B=new THREE.Mesh(new THREE.SphereBufferGeometry(.15,16,16),new THREE.MeshBasicMaterial({color:16711680}));a.add(B);const I=new THREE.SphereBufferGeometry(.07,16,16),b=new THREE.MeshBasicMaterial({color:3422263}),C=[];for(let e=0;e<22;e++){const e=new THREE.Mesh(I,b);a.add(e),C.push(e)}C[11];const L=new THREE.CylinderBufferGeometry(.06,.06,1,16),G=new THREE.MeshBasicMaterial({color:4096764}),S=[];for(let e=0;e<y.length;e++){const e=new THREE.Mesh(L,G);a.add(e),S.push(e)}const D=new THREE.Mesh(new THREE.SphereBufferGeometry(.125,16,16),new THREE.MeshBasicMaterial({color:4096764}));a.add(D),H();document.documentElement;function V(e,t){const o=s.domElement,n=o.getBoundingClientRect();p.x=(e-n.x)/o.clientWidth*2-1,p.y=-(t-n.y)/o.clientHeight*2+1,d.setFromCamera(p,r);const i=d.intersectObjects([P]);for(const e of i)B.position.x=e.point.x,B.position.z=e.point.z;"joystick"==A.Task&&(h=Math.atan2(B.position.z-w[2],B.position.x-w[0]))}let q={};window.addEventListener("resize",function(){r.aspect=i.clientWidth/i.clientHeight,r.updateProjectionMatrix(),s.setSize(i.clientWidth,i.clientHeight)},!1),s.domElement.addEventListener("click",function(e){if(!e.ctrlKey&&!e.metaKey)return;e.preventDefault(),E=0,V(e.clientX,e.clientY)},!1),s.domElement.addEventListener("touchstart",function(e){e.preventDefault(),E=0,V(e.touches[0].clientX,e.touches[0].clientY)},!1),s.domElement.addEventListener("keydown",function(e){e.preventDefault(),q[e.code]=!0,"joystick"==A.Task&&(h=0,q.ArrowUp&&q.ArrowLeft?E=7*Math.PI/4:q.ArrowUp&&q.ArrowRight?E=Math.PI/4:q.ArrowDown&&q.ArrowLeft?E=5*Math.PI/4:q.ArrowDown&&q.ArrowRight?E=3*Math.PI/4:q.ArrowLeft?E=3*Math.PI/2:q.ArrowUp?E=0:q.ArrowRight?E=Math.PI/2:q.ArrowDown&&(E=Math.PI))},!1),s.domElement.addEventListener("keyup",function(e){e.preventDefault(),q[e.code]=!1},!1);let O=performance.now();const F=async()=>{requestAnimationFrame(F);let e=performance.now(),t=e-O;if(!A.Pause&&t>1e3/30){O=e-t%(1e3/30);const o=Math.cos(u),i=Math.sin(u),l=-i,d=o;let p=[0,0];if("target"==A.Task){let e=[B.position.x-w[0],B.position.z-w[2]],t=Math.sqrt(e.reduce((e,t)=>e+t*t,0));if(t*R<2)do{B.position.x=.3048*(80*Math.random()-40),B.position.z=.3048*(80*Math.random()-40),e=[B.position.x-w[0],B.position.z-w[2]],t=Math.sqrt(e.reduce((e,t)=>e+t*t,0))}while(t*R<20);p[0]=(o*e[0]+l*e[1])*R,p[1]=(i*e[0]+d*e[1])*R}else if("joystick"==A.Task){B.position.x=w[0]+2*Math.cos(h+E),B.position.z=w[2]+2*Math.sin(h+E);const e=Math.atan2(B.position.z-w[2],B.position.x-w[0])+u;p[0]=.65*Math.cos(e),p[1]=.65*Math.sin(e),c.target.x=w[0],c.target.z=w[2]}else console.log(`Oops, "${A.Task}" if not a supported task.`);let T=new onnx.Tensor(new Float32Array(269),"float32",[1,269]);for(let e=0;e<f.size;e++){const t=f.get([0,e])*M[e]+g[e];T.set(t,[0,e])}for(let e=0;e<p.length;e++){const t=p[e]+1e-5;T.set(t,[0,f.size+e])}await n[A.Task].run([T]).then(e=>{m=e.values().next().value}),await n.mvae.run([m,f]).then(e=>{f=e.values().next().value});const H=f.data.slice(0,69).map((e,t)=>.3048*(e*M[t]+g[t]));H[2]=H[2]/.3048;const k=H[0],z=H[1],j=o*k+i*z,v=l*k+d*z;w[0]+=j,w[2]+=v,u=(u+H[2])%x;for(let e=0;e<C.length;e++){const t=3*(e+1),n=t+1,s=t+2,a=H[t],r=H[s],c=o*a+i*r,p=l*a+d*r;C[e].position.x=c+w[0],C[e].position.y=H[n],C[e].position.z=p+w[2]}for(let e=0;e<S.length;e++){const[t,o]=y[e],[n,i,s]=[C[t].position.x,C[t].position.y,C[t].position.z],[a,r,c]=[C[o].position.x,C[o].position.y,C[o].position.z],l=[(a+n)/2,(r+i)/2,(c+s)/2],d=[a-n,r-i,c-s],p=Math.sqrt(d.reduce((e,t)=>e+t*t,0)),E=[d[2],0,-d[0],p+d[1]],h=Math.sqrt(E.reduce((e,t)=>e+t*t,0));S[e].scale.y=p,S[e].position.x=l[0],S[e].position.y=l[1],S[e].position.z=l[2],S[e].quaternion.x=E[0]/h,S[e].quaternion.y=E[1]/h,S[e].quaternion.z=E[2]/h,S[e].quaternion.w=E[3]/h}D.position.x=1.75*C[4].position.x-.75*C[3].position.x,D.position.y=1.75*C[4].position.y-.75*C[3].position.y,D.position.z=1.75*C[4].position.z-.75*C[3].position.z,c.update(),s.render(a,r)}};e.remove(),F()}})();
static/grid.png ADDED
static/joystick_controller.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a9ca539dbd94eca25474f9fc2aa67a8e2bb9b15924e09004269b82ecba024864
3
+ size 836621
static/mvae.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1ce82e8e1b6c5e335e30c0094b01eaf83cbe1a226da3b9c67f8bda59322ca375
3
+ size 5568335
static/og-mvae.jpg ADDED
static/onnx.min.js ADDED
The diff for this file is too large to render. See raw diff
static/target_controller.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0fc835ddfa66e3070034c008629b5a69842f040405f1525e0ca037a7745a0985
3
+ size 836621
static/three/build/three.module.min.js ADDED
The diff for this file is too large to render. See raw diff
static/three/examples/jsm/controls/.DS_Store ADDED
Binary file (6.15 kB). View file
static/three/examples/jsm/controls/OrbitControls.min.js ADDED
@@ -0,0 +1 @@
 
1
+ import{EventDispatcher,MOUSE,Quaternion,Spherical,TOUCH,Vector2,Vector3}from"../../../build/three.module.min.js";var OrbitControls=function(e,t){var o,n,a,i,r,c;void 0===t&&console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.'),t===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.object=e,this.domElement=t,this.enabled=!0,this.target=new Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.enableKeys=!0,this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40},this.mouseButtons={LEFT:MOUSE.ROTATE,MIDDLE:MOUSE.DOLLY,RIGHT:MOUSE.PAN},this.touches={ONE:TOUCH.ROTATE,TWO:TOUCH.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=function(){return b.phi},this.getAzimuthalAngle=function(){return b.theta},this.saveState=function(){s.target0.copy(s.target),s.position0.copy(s.object.position),s.zoom0=s.object.zoom},this.reset=function(){s.target.copy(s.target0),s.object.position.copy(s.position0),s.object.zoom=s.zoom0,s.object.updateProjectionMatrix(),s.dispatchEvent(u),s.update(),h=p.NONE},this.update=(o=new Vector3,n=(new Quaternion).setFromUnitVectors(e.up,new Vector3(0,1,0)),a=n.clone().inverse(),i=new Vector3,r=new Quaternion,c=2*Math.PI,function(){var e=s.object.position;o.copy(e).sub(s.target),o.applyQuaternion(n),b.setFromVector3(o),s.autoRotate&&h===p.NONE&&C(2*Math.PI/60/60*s.autoRotateSpeed),s.enableDamping?(b.theta+=E.theta*s.dampingFactor,b.phi+=E.phi*s.dampingFactor):(b.theta+=E.theta,b.phi+=E.phi);var t=s.minAzimuthAngle,l=s.maxAzimuthAngle;return isFinite(t)&&isFinite(l)&&(t<-Math.PI?t+=c:t>Math.PI&&(t-=c),l<-Math.PI?l+=c:l>Math.PI&&(l-=c),b.theta=t<l?Math.max(t,Math.min(l,b.theta)):b.theta>(t+l)/2?Math.max(t,b.theta):Math.min(l,b.theta)),b.phi=Math.max(s.minPolarAngle,Math.min(s.maxPolarAngle,b.phi)),b.makeSafe(),b.radius*=O,b.radius=Math.max(s.minDistance,Math.min(s.maxDistance,b.radius)),!0===s.enableDamping?s.target.addScaledVector(f,s.dampingFactor):s.target.add(f),o.setFromSpherical(b),o.applyQuaternion(a),e.copy(s.target).add(o),s.object.lookAt(s.target),!0===s.enableDamping?(E.theta*=1-s.dampingFactor,E.phi*=1-s.dampingFactor,f.multiplyScalar(1-s.dampingFactor)):(E.set(0,0,0),f.set(0,0,0)),O=1,!!(g||i.distanceToSquared(s.object.position)>d||8*(1-r.dot(s.object.quaternion))>d)&&(s.dispatchEvent(u),i.copy(s.object.position),r.copy(s.object.quaternion),g=!1,!0)}),this.dispose=function(){s.domElement.removeEventListener("contextmenu",ee,!1),s.domElement.removeEventListener("pointerdown",B,!1),s.domElement.removeEventListener("wheel",W,!1),s.domElement.removeEventListener("touchstart",Q,!1),s.domElement.removeEventListener("touchend",$,!1),s.domElement.removeEventListener("touchmove",J,!1),s.domElement.ownerDocument.removeEventListener("pointermove",G,!1),s.domElement.ownerDocument.removeEventListener("pointerup",K,!1),s.domElement.removeEventListener("keydown",q,!1)};var s=this,u={type:"change"},l={type:"start"},m={type:"end"},p={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},h=p.NONE,d=1e-6,b=new Spherical,E=new Spherical,O=1,f=new Vector3,g=!1,v=new Vector2,T=new Vector2,y=new Vector2,P=new Vector2,L=new Vector2,w=new Vector2,A=new Vector2,N=new Vector2,M=new Vector2;function j(){return Math.pow(.95,s.zoomSpeed)}function C(e){E.theta-=e}function D(e){E.phi-=e}var S,R=(S=new Vector3,function(e,t){S.setFromMatrixColumn(t,0),S.multiplyScalar(-e),f.add(S)}),k=function(){var e=new Vector3;return function(t,o){!0===s.screenSpacePanning?e.setFromMatrixColumn(o,1):(e.setFromMatrixColumn(o,0),e.crossVectors(s.object.up,e)),e.multiplyScalar(t),f.add(e)}}(),Y=function(){var e=new Vector3;return function(t,o){var n=s.domElement;if(s.object.isPerspectiveCamera){var a=s.object.position;e.copy(a).sub(s.target);var i=e.length();i*=Math.tan(s.object.fov/2*Math.PI/180),R(2*t*i/n.clientHeight,s.object.matrix),k(2*o*i/n.clientHeight,s.object.matrix)}else s.object.isOrthographicCamera?(R(t*(s.object.right-s.object.left)/s.object.zoom/n.clientWidth,s.object.matrix),k(o*(s.object.top-s.object.bottom)/s.object.zoom/n.clientHeight,s.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),s.enablePan=!1)}}();function H(e){s.object.isPerspectiveCamera?O/=e:s.object.isOrthographicCamera?(s.object.zoom=Math.max(s.minZoom,Math.min(s.maxZoom,s.object.zoom*e)),s.object.updateProjectionMatrix(),g=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),s.enableZoom=!1)}function x(e){s.object.isPerspectiveCamera?O*=e:s.object.isOrthographicCamera?(s.object.zoom=Math.max(s.minZoom,Math.min(s.maxZoom,s.object.zoom/e)),s.object.updateProjectionMatrix(),g=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),s.enableZoom=!1)}function U(e){v.set(e.clientX,e.clientY)}function V(e){P.set(e.clientX,e.clientY)}function I(e){if(1==e.touches.length)v.set(e.touches[0].pageX,e.touches[0].pageY);else{var t=.5*(e.touches[0].pageX+e.touches[1].pageX),o=.5*(e.touches[0].pageY+e.touches[1].pageY);v.set(t,o)}}function z(e){if(1==e.touches.length)P.set(e.touches[0].pageX,e.touches[0].pageY);else{var t=.5*(e.touches[0].pageX+e.touches[1].pageX),o=.5*(e.touches[0].pageY+e.touches[1].pageY);P.set(t,o)}}function X(e){var t=e.touches[0].pageX-e.touches[1].pageX,o=e.touches[0].pageY-e.touches[1].pageY,n=Math.sqrt(t*t+o*o);A.set(0,n)}function _(e){if(1==e.touches.length)T.set(e.touches[0].pageX,e.touches[0].pageY);else{var t=.5*(e.touches[0].pageX+e.touches[1].pageX),o=.5*(e.touches[0].pageY+e.touches[1].pageY);T.set(t,o)}y.subVectors(T,v).multiplyScalar(s.rotateSpeed);var n=s.domElement;C(2*Math.PI*y.x/n.clientHeight),D(2*Math.PI*y.y/n.clientHeight),v.copy(T)}function F(e){if(1==e.touches.length)L.set(e.touches[0].pageX,e.touches[0].pageY);else{var t=.5*(e.touches[0].pageX+e.touches[1].pageX),o=.5*(e.touches[0].pageY+e.touches[1].pageY);L.set(t,o)}w.subVectors(L,P).multiplyScalar(s.panSpeed),Y(w.x,w.y),P.copy(L)}function Z(e){var t=e.touches[0].pageX-e.touches[1].pageX,o=e.touches[0].pageY-e.touches[1].pageY,n=Math.sqrt(t*t+o*o);N.set(0,n),M.set(0,Math.pow(N.y/A.y,s.zoomSpeed)),H(M.y),A.copy(N)}function B(e){if(!1!==s.enabled)switch(e.pointerType){case"mouse":case"pen":!function(e){var t;switch(e.preventDefault(),s.domElement.focus?s.domElement.focus():window.focus(),e.button){case 0:t=s.mouseButtons.LEFT;break;case 1:t=s.mouseButtons.MIDDLE;break;case 2:t=s.mouseButtons.RIGHT;break;default:t=-1}switch(t){case MOUSE.DOLLY:if(!1===s.enableZoom)return;!function(e){A.set(e.clientX,e.clientY)}(e),h=p.DOLLY;break;case MOUSE.ROTATE:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===s.enablePan)return;V(e),h=p.PAN}else{if(!1===s.enableRotate)return;U(e),h=p.ROTATE}break;case MOUSE.PAN:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===s.enableRotate)return;U(e),h=p.ROTATE}else{if(!1===s.enablePan)return;V(e),h=p.PAN}break;default:h=p.NONE}h!==p.NONE&&(s.domElement.ownerDocument.addEventListener("pointermove",G,!1),s.domElement.ownerDocument.addEventListener("pointerup",K,!1),s.dispatchEvent(l))}(e)}}function G(e){if(!1!==s.enabled)switch(e.pointerType){case"mouse":case"pen":!function(e){if(!1===s.enabled)return;switch(e.preventDefault(),h){case p.ROTATE:if(!1===s.enableRotate)return;!function(e){T.set(e.clientX,e.clientY),y.subVectors(T,v).multiplyScalar(s.rotateSpeed);var t=s.domElement;C(2*Math.PI*y.x/t.clientHeight),D(2*Math.PI*y.y/t.clientHeight),v.copy(T),s.update()}(e);break;case p.DOLLY:if(!1===s.enableZoom)return;!function(e){N.set(e.clientX,e.clientY),M.subVectors(N,A),M.y>0?H(j()):M.y<0&&x(j()),A.copy(N),s.update()}(e);break;case p.PAN:if(!1===s.enablePan)return;!function(e){L.set(e.clientX,e.clientY),w.subVectors(L,P).multiplyScalar(s.panSpeed),Y(w.x,w.y),P.copy(L),s.update()}(e)}}(e)}}function K(e){if(!1!==s.enabled)switch(e.pointerType){case"mouse":case"pen":!function(e){if(!1===s.enabled)return;s.domElement.ownerDocument.removeEventListener("pointermove",G,!1),s.domElement.ownerDocument.removeEventListener("pointerup",K,!1),s.dispatchEvent(m),h=p.NONE}()}}function W(e){!1===s.enabled||!1===s.enableZoom||h!==p.NONE&&h!==p.ROTATE||(e.preventDefault(),e.stopPropagation(),s.dispatchEvent(l),function(e){e.deltaY<0?x(j()):e.deltaY>0&&H(j()),s.update()}(e),s.dispatchEvent(m))}function q(e){!1!==s.enabled&&!1!==s.enableKeys&&!1!==s.enablePan&&function(e){var t=!1;switch(e.keyCode){case s.keys.UP:Y(0,s.keyPanSpeed),t=!0;break;case s.keys.BOTTOM:Y(0,-s.keyPanSpeed),t=!0;break;case s.keys.LEFT:Y(s.keyPanSpeed,0),t=!0;break;case s.keys.RIGHT:Y(-s.keyPanSpeed,0),t=!0}t&&(e.preventDefault(),s.update())}(e)}function Q(e){if(!1!==s.enabled){switch(e.preventDefault(),e.touches.length){case 1:switch(s.touches.ONE){case TOUCH.ROTATE:if(!1===s.enableRotate)return;I(e),h=p.TOUCH_ROTATE;break;case TOUCH.PAN:if(!1===s.enablePan)return;z(e),h=p.TOUCH_PAN;break;default:h=p.NONE}break;case 2:switch(s.touches.TWO){case TOUCH.DOLLY_PAN:if(!1===s.enableZoom&&!1===s.enablePan)return;!function(e){s.enableZoom&&X(e),s.enablePan&&z(e)}(e),h=p.TOUCH_DOLLY_PAN;break;case TOUCH.DOLLY_ROTATE:if(!1===s.enableZoom&&!1===s.enableRotate)return;!function(e){s.enableZoom&&X(e),s.enableRotate&&I(e)}(e),h=p.TOUCH_DOLLY_ROTATE;break;default:h=p.NONE}break;default:h=p.NONE}h!==p.NONE&&s.dispatchEvent(l)}}function J(e){if(!1!==s.enabled)switch(e.preventDefault(),e.stopPropagation(),h){case p.TOUCH_ROTATE:if(!1===s.enableRotate)return;_(e),s.update();break;case p.TOUCH_PAN:if(!1===s.enablePan)return;F(e),s.update();break;case p.TOUCH_DOLLY_PAN:if(!1===s.enableZoom&&!1===s.enablePan)return;!function(e){s.enableZoom&&Z(e),s.enablePan&&F(e)}(e),s.update();break;case p.TOUCH_DOLLY_ROTATE:if(!1===s.enableZoom&&!1===s.enableRotate)return;!function(e){s.enableZoom&&Z(e),s.enableRotate&&_(e)}(e),s.update();break;default:h=p.NONE}}function $(e){!1!==s.enabled&&(s.dispatchEvent(m),h=p.NONE)}function ee(e){!1!==s.enabled&&e.preventDefault()}s.domElement.addEventListener("contextmenu",ee,!1),s.domElement.addEventListener("pointerdown",B,!1),s.domElement.addEventListener("wheel",W,!1),s.domElement.addEventListener("touchstart",Q,!1),s.domElement.addEventListener("touchend",$,!1),s.domElement.addEventListener("touchmove",J,!1),s.domElement.addEventListener("keydown",q,!1),-1===s.domElement.tabIndex&&(s.domElement.tabIndex=0),this.update()};OrbitControls.prototype=Object.create(EventDispatcher.prototype),OrbitControls.prototype.constructor=OrbitControls;var MapControls=function(e,t){OrbitControls.call(this,e,t),this.screenSpacePanning=!1,this.mouseButtons.LEFT=MOUSE.PAN,this.mouseButtons.RIGHT=MOUSE.ROTATE,this.touches.ONE=TOUCH.PAN,this.touches.TWO=TOUCH.DOLLY_ROTATE};MapControls.prototype=Object.create(EventDispatcher.prototype),MapControls.prototype.constructor=MapControls;export{OrbitControls,MapControls};
static/three/examples/jsm/libs/.DS_Store ADDED
Binary file (6.15 kB). View file
static/three/examples/jsm/libs/dat.gui.module.min.js ADDED
@@ -0,0 +1 @@
 
1
+ function ___$insertStyle(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 colorToString(e,t){var o=e.__state.conversionName.toString(),n=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"===o||"SIX_CHAR_HEX"===o){for(var c=e.hex.toString(16);c.length<6;)c="0"+c;return"#"+c}return"CSS_RGB"===o?"rgb("+n+","+i+","+r+")":"CSS_RGBA"===o?"rgba("+n+","+i+","+r+","+s+")":"HEX"===o?"0x"+e.hex.toString(16):"RGB_ARRAY"===o?"["+n+","+i+","+r+"]":"RGBA_ARRAY"===o?"["+n+","+i+","+r+","+s+"]":"RGB_OBJ"===o?"{r:"+n+",g:"+i+",b:"+r+"}":"RGBA_OBJ"===o?"{r:"+n+",g:"+i+",b:"+r+",a:"+s+"}":"HSV_OBJ"===o?"{h:"+a+",s:"+l+",v:"+d+"}":"HSVA_OBJ"===o?"{h:"+a+",s:"+l+",v:"+d+",a:"+s+"}":"unknown format"}var ARR_EACH=Array.prototype.forEach,ARR_SLICE=Array.prototype.slice,Common={BREAK:{},extend:function(e){return this.each(ARR_SLICE.call(arguments,1),function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(o){this.isUndefined(t[o])||(e[o]=t[o])}.bind(this))},this),e},defaults:function(e){return this.each(ARR_SLICE.call(arguments,1),function(t){(this.isObject(t)?Object.keys(t):[]).forEach(function(o){this.isUndefined(e[o])&&(e[o]=t[o])}.bind(this))},this),e},compose:function(){var e=ARR_SLICE.call(arguments);return function(){for(var t=ARR_SLICE.call(arguments),o=e.length-1;o>=0;o--)t=[e[o].apply(this,t)];return t[0]}},each:function(e,t,o){if(e)if(ARR_EACH&&e.forEach&&e.forEach===ARR_EACH)e.forEach(t,o);else if(e.length===e.length+0){var n,i=void 0;for(i=0,n=e.length;i<n;i++)if(i in e&&t.call(o,e[i],i)===this.BREAK)return}else for(var r in e)if(t.call(o,e[r],r)===this.BREAK)return},defer:function(e){setTimeout(e,0)},debounce:function(e,t,o){var n=void 0;return function(){var i=this,r=arguments;var s=o||!n;clearTimeout(n),n=setTimeout(function(){n=null,o||e.apply(i,r)},t),s&&e.apply(i,r)}},toArray:function(e){return e.toArray?e.toArray():ARR_SLICE.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}},INTERPRETATIONS=[{litmus:Common.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:colorToString},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:colorToString},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:colorToString},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:colorToString}}},{litmus:Common.isNumber,conversions:{HEX:{read:function(e){return{space:"HEX",hex:e,conversionName:"HEX"}},write:function(e){return e.hex}}}},{litmus:Common.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:Common.isObject,conversions:{RGBA_OBJ:{read:function(e){return!!(Common.isNumber(e.r)&&Common.isNumber(e.g)&&Common.isNumber(e.b)&&Common.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!!(Common.isNumber(e.r)&&Common.isNumber(e.g)&&Common.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!!(Common.isNumber(e.h)&&Common.isNumber(e.s)&&Common.isNumber(e.v)&&Common.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!!(Common.isNumber(e.h)&&Common.isNumber(e.s)&&Common.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}}}}}],result=void 0,toReturn=void 0,interpret=function(){toReturn=!1;var e=arguments.length>1?Common.toArray(arguments):arguments[0];return Common.each(INTERPRETATIONS,function(t){if(t.litmus(e))return Common.each(t.conversions,function(t,o){if(result=t.read(e),!1===toReturn&&!1!==result)return toReturn=result,result.conversionName=o,result.conversion=t,Common.BREAK}),Common.BREAK}),toReturn},tmpComponent=void 0,ColorMath={hsv_to_rgb:function(e,t,o){var n=Math.floor(e/60)%6,i=e/60-Math.floor(e/60),r=o*(1-t),s=o*(1-i*t),a=o*(1-(1-i)*t),l=[[o,a,r],[s,o,r],[r,o,a],[r,s,o],[a,r,o],[o,r,s]][n];return{r:255*l[0],g:255*l[1],b:255*l[2]}},rgb_to_hsv:function(e,t,o){var n=Math.min(e,t,o),i=Math.max(e,t,o),r=i-n,s=void 0;return 0===i?{h:NaN,s:0,v:0}:(s=e===i?(t-o)/r:t===i?2+(o-e)/r:4+(e-t)/r,(s/=6)<0&&(s+=1),{h:360*s,s:r/i,v:i/255})},rgb_to_hex:function(e,t,o){var n=this.hex_with_component(0,2,e);return n=this.hex_with_component(n,1,t),n=this.hex_with_component(n,0,o)},component_from_hex:function(e,t){return e>>8*t&255},hex_with_component:function(e,t,o){return o<<(tmpComponent=8*t)|e&~(255<<tmpComponent)}},_typeof="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},classCallCheck=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},createClass=function(){function e(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,o,n){return o&&e(t.prototype,o),n&&e(t,n),t}}(),get=function e(t,o,n){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,o);if(void 0===i){var r=Object.getPrototypeOf(t);return null===r?void 0:e(r,o,n)}if("value"in i)return i.value;var s=i.get;return void 0!==s?s.call(n):void 0},inherits=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)},possibleConstructorReturn=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},Color=function(){function e(){if(classCallCheck(this,e),this.__state=interpret.apply(this,arguments),!1===this.__state)throw new Error("Failed to interpret color arguments");this.__state.a=this.__state.a||1}return createClass(e,[{key:"toString",value:function(){return colorToString(this)}},{key:"toHexString",value:function(){return colorToString(this,!0)}},{key:"toOriginal",value:function(){return this.__state.conversion.write(this)}}]),e}();function defineRGBComponent(e,t,o){Object.defineProperty(e,t,{get:function(){return"RGB"===this.__state.space?this.__state[t]:(Color.recalculateRGB(this,t,o),this.__state[t])},set:function(e){"RGB"!==this.__state.space&&(Color.recalculateRGB(this,t,o),this.__state.space="RGB"),this.__state[t]=e}})}function defineHSVComponent(e,t){Object.defineProperty(e,t,{get:function(){return"HSV"===this.__state.space?this.__state[t]:(Color.recalculateHSV(this),this.__state[t])},set:function(e){"HSV"!==this.__state.space&&(Color.recalculateHSV(this),this.__state.space="HSV"),this.__state[t]=e}})}Color.recalculateRGB=function(e,t,o){if("HEX"===e.__state.space)e.__state[t]=ColorMath.component_from_hex(e.__state.hex,o);else{if("HSV"!==e.__state.space)throw new Error("Corrupted color state");Common.extend(e.__state,ColorMath.hsv_to_rgb(e.__state.h,e.__state.s,e.__state.v))}},Color.recalculateHSV=function(e){var t=ColorMath.rgb_to_hsv(e.r,e.g,e.b);Common.extend(e.__state,{s:t.s,v:t.v}),Common.isNaN(t.h)?Common.isUndefined(e.__state.h)&&(e.__state.h=0):e.__state.h=t.h},Color.COMPONENTS=["r","g","b","h","s","v","hex","a"],defineRGBComponent(Color.prototype,"r",2),defineRGBComponent(Color.prototype,"g",1),defineRGBComponent(Color.prototype,"b",0),defineHSVComponent(Color.prototype,"h"),defineHSVComponent(Color.prototype,"s"),defineHSVComponent(Color.prototype,"v"),Object.defineProperty(Color.prototype,"a",{get:function(){return this.__state.a},set:function(e){this.__state.a=e}}),Object.defineProperty(Color.prototype,"hex",{get:function(){return"HEX"!==this.__state.space&&(this.__state.hex=ColorMath.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 Controller=function(){function e(t,o){classCallCheck(this,e),this.initialValue=t[o],this.domElement=document.createElement("div"),this.object=t,this.property=o,this.__onChange=void 0,this.__onFinishChange=void 0}return createClass(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}(),EVENT_MAP={HTMLEvents:["change"],MouseEvents:["click","mousemove","mousedown","mouseup","mouseover"],KeyboardEvents:["keydown"]},EVENT_MAP_INV={};Common.each(EVENT_MAP,function(e,t){Common.each(e,function(e){EVENT_MAP_INV[e]=t})});var CSS_VALUE_PIXELS=/(\d+(\.\d+)?)px/;function cssValueToPixels(e){if("0"===e||Common.isUndefined(e))return 0;var t=e.match(CSS_VALUE_PIXELS);return Common.isNull(t)?0:parseFloat(t[1])}var dom={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,o){var n=o,i=t;Common.isUndefined(i)&&(i=!0),Common.isUndefined(n)&&(n=!0),e.style.position="absolute",i&&(e.style.left=0,e.style.right=0),n&&(e.style.top=0,e.style.bottom=0)},fakeEvent:function(e,t,o,n){var i=o||{},r=EVENT_MAP_INV[t];if(!r)throw new Error("Event type "+t+" not supported.");var s=document.createEvent(r);switch(r){case"MouseEvents":var a=i.x||i.clientX||0,l=i.y||i.clientY||0;s.initMouseEvent(t,i.bubbles||!1,i.cancelable||!0,window,i.clickCount||1,0,0,a,l,!1,!1,!1,!1,0,null);break;case"KeyboardEvents":var d=s.initKeyboardEvent||s.initKeyEvent;Common.defaults(i,{cancelable:!0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,keyCode:void 0,charCode:void 0}),d(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)}Common.defaults(s,n),e.dispatchEvent(s)},bind:function(e,t,o,n){var i=n||!1;return e.addEventListener?e.addEventListener(t,o,i):e.attachEvent&&e.attachEvent("on"+t,o),dom},unbind:function(e,t,o,n){var i=n||!1;return e.removeEventListener?e.removeEventListener(t,o,i):e.detachEvent&&e.detachEvent("on"+t,o),dom},addClass:function(e,t){if(void 0===e.className)e.className=t;else if(e.className!==t){var o=e.className.split(/ +/);-1===o.indexOf(t)&&(o.push(t),e.className=o.join(" ").replace(/^\s+/,"").replace(/\s+$/,""))}return dom},removeClass:function(e,t){if(t)if(e.className===t)e.removeAttribute("class");else{var o=e.className.split(/ +/),n=o.indexOf(t);-1!==n&&(o.splice(n,1),e.className=o.join(" "))}else e.className=void 0;return dom},hasClass:function(e,t){return new RegExp("(?:^|\\s+)"+t+"(?:\\s+|$)").test(e.className)||!1},getWidth:function(e){var t=getComputedStyle(e);return cssValueToPixels(t["border-left-width"])+cssValueToPixels(t["border-right-width"])+cssValueToPixels(t["padding-left"])+cssValueToPixels(t["padding-right"])+cssValueToPixels(t.width)},getHeight:function(e){var t=getComputedStyle(e);return cssValueToPixels(t["border-top-width"])+cssValueToPixels(t["border-bottom-width"])+cssValueToPixels(t["padding-top"])+cssValueToPixels(t["padding-bottom"])+cssValueToPixels(t.height)},getOffset:function(e){var t=e,o={left:0,top:0};if(t.offsetParent)do{o.left+=t.offsetLeft,o.top+=t.offsetTop,t=t.offsetParent}while(t);return o},isActive:function(e){return e===document.activeElement&&(e.type||e.href)}},BooleanController=function(e){function t(e,o){classCallCheck(this,t);var n=possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,o)),i=n;return n.__prev=n.getValue(),n.__checkbox=document.createElement("input"),n.__checkbox.setAttribute("type","checkbox"),dom.bind(n.__checkbox,"change",function(){i.setValue(!i.__prev)},!1),n.domElement.appendChild(n.__checkbox),n.updateDisplay(),n}return inherits(t,Controller),createClass(t,[{key:"setValue",value:function(e){var o=get(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(),o}},{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),get(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(),OptionController=function(e){function t(e,o,n){classCallCheck(this,t);var i=possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,o)),r=n,s=i;if(i.__select=document.createElement("select"),Common.isArray(r)){var a={};Common.each(r,function(e){a[e]=e}),r=a}return Common.each(r,function(e,t){var o=document.createElement("option");o.innerHTML=t,o.setAttribute("value",e),s.__select.appendChild(o)}),i.updateDisplay(),dom.bind(i.__select,"change",function(){var e=this.options[this.selectedIndex].value;s.setValue(e)}),i.domElement.appendChild(i.__select),i}return inherits(t,Controller),createClass(t,[{key:"setValue",value:function(e){var o=get(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,e);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),o}},{key:"updateDisplay",value:function(){return dom.isActive(this.__select)?this:(this.__select.value=this.getValue(),get(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this))}}]),t}(),StringController=function(e){function t(e,o){classCallCheck(this,t);var n=possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,o)),i=n;function r(){i.setValue(i.__input.value)}return n.__input=document.createElement("input"),n.__input.setAttribute("type","text"),dom.bind(n.__input,"keyup",r),dom.bind(n.__input,"change",r),dom.bind(n.__input,"blur",function(){i.__onFinishChange&&i.__onFinishChange.call(i,i.getValue())}),dom.bind(n.__input,"keydown",function(e){13===e.keyCode&&this.blur()}),n.updateDisplay(),n.domElement.appendChild(n.__input),n}return inherits(t,Controller),createClass(t,[{key:"updateDisplay",value:function(){return dom.isActive(this.__input)||(this.__input.value=this.getValue()),get(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}();function numDecimals(e){var t=e.toString();return t.indexOf(".")>-1?t.length-t.indexOf(".")-1:0}var NumberController=function(e){function t(e,o,n){classCallCheck(this,t);var i=possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,o)),r=n||{};return i.__min=r.min,i.__max=r.max,i.__step=r.step,Common.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=numDecimals(i.__impliedStep),i}return inherits(t,Controller),createClass(t,[{key:"setValue",value:function(e){var o=e;return void 0!==this.__min&&o<this.__min?o=this.__min:void 0!==this.__max&&o>this.__max&&(o=this.__max),void 0!==this.__step&&o%this.__step!=0&&(o=Math.round(o/this.__step)*this.__step),get(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,o)}},{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=numDecimals(e),this}}]),t}();function roundToDecimal(e,t){var o=Math.pow(10,t);return Math.round(e*o)/o}var NumberControllerBox=function(e){function t(e,o,n){classCallCheck(this,t);var i=possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,o,n));i.__truncationSuspended=!1;var r=i,s=void 0;function a(){r.__onFinishChange&&r.__onFinishChange.call(r,r.getValue())}function l(e){var t=s-e.clientY;r.setValue(r.getValue()+t*r.__impliedStep),s=e.clientY}function d(){dom.unbind(window,"mousemove",l),dom.unbind(window,"mouseup",d),a()}return i.__input=document.createElement("input"),i.__input.setAttribute("type","text"),dom.bind(i.__input,"change",function(){var e=parseFloat(r.__input.value);Common.isNaN(e)||r.setValue(e)}),dom.bind(i.__input,"blur",function(){a()}),dom.bind(i.__input,"mousedown",function(e){dom.bind(window,"mousemove",l),dom.bind(window,"mouseup",d),s=e.clientY}),dom.bind(i.__input,"keydown",function(e){13===e.keyCode&&(r.__truncationSuspended=!0,this.blur(),r.__truncationSuspended=!1,a())}),i.updateDisplay(),i.domElement.appendChild(i.__input),i}return inherits(t,NumberController),createClass(t,[{key:"updateDisplay",value:function(){return this.__input.value=this.__truncationSuspended?this.getValue():roundToDecimal(this.getValue(),this.__precision),get(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}();function map(e,t,o,n,i){return n+(e-t)/(o-t)*(i-n)}var NumberControllerSlider=function(e){function t(e,o,n,i,r){classCallCheck(this,t);var s=possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,o,{min:n,max:i,step:r})),a=s;function l(e){e.preventDefault();var t=a.__background.getBoundingClientRect();return a.setValue(map(e.clientX,t.left,t.right,a.__min,a.__max)),!1}function d(){dom.unbind(window,"mousemove",l),dom.unbind(window,"mouseup",d),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}function c(e){var t=e.touches[0].clientX,o=a.__background.getBoundingClientRect();a.setValue(map(t,o.left,o.right,a.__min,a.__max))}function u(){dom.unbind(window,"touchmove",c),dom.unbind(window,"touchend",u),a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}return s.__background=document.createElement("div"),s.__foreground=document.createElement("div"),dom.bind(s.__background,"mousedown",function(e){document.activeElement.blur(),dom.bind(window,"mousemove",l),dom.bind(window,"mouseup",d),l(e)}),dom.bind(s.__background,"touchstart",function(e){if(1!==e.touches.length)return;dom.bind(window,"touchmove",c),dom.bind(window,"touchend",u),c(e)}),dom.addClass(s.__background,"slider"),dom.addClass(s.__foreground,"slider-fg"),s.updateDisplay(),s.__background.appendChild(s.__foreground),s.domElement.appendChild(s.__background),s}return inherits(t,NumberController),createClass(t,[{key:"updateDisplay",value:function(){var e=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*e+"%",get(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(),FunctionController=function(e){function t(e,o,n){classCallCheck(this,t);var i=possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,o)),r=i;return i.__button=document.createElement("div"),i.__button.innerHTML=void 0===n?"Fire":n,dom.bind(i.__button,"click",function(e){return e.preventDefault(),r.fire(),!1}),dom.addClass(i.__button,"button"),i.domElement.appendChild(i.__button),i}return inherits(t,Controller),createClass(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}(),ColorController=function(e){function t(e,o){classCallCheck(this,t);var n=possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,o));n.__color=new Color(n.getValue()),n.__temp=new Color(0);var i=n;n.domElement=document.createElement("div"),dom.makeSelectable(n.domElement,!1),n.__selector=document.createElement("div"),n.__selector.className="selector",n.__saturation_field=document.createElement("div"),n.__saturation_field.className="saturation-field",n.__field_knob=document.createElement("div"),n.__field_knob.className="field-knob",n.__field_knob_border="2px solid ",n.__hue_knob=document.createElement("div"),n.__hue_knob.className="hue-knob",n.__hue_field=document.createElement("div"),n.__hue_field.className="hue-field",n.__input=document.createElement("input"),n.__input.type="text",n.__input_textShadow="0 1px 1px ",dom.bind(n.__input,"keydown",function(e){13===e.keyCode&&c.call(this)}),dom.bind(n.__input,"blur",c),dom.bind(n.__selector,"mousedown",function(){dom.addClass(this,"drag").bind(window,"mouseup",function(){dom.removeClass(i.__selector,"drag")})}),dom.bind(n.__selector,"touchstart",function(){dom.addClass(this,"drag").bind(window,"touchend",function(){dom.removeClass(i.__selector,"drag")})});var r=document.createElement("div");function s(e){m(e),dom.bind(window,"mousemove",m),dom.bind(window,"touchmove",m),dom.bind(window,"mouseup",l),dom.bind(window,"touchend",l)}function a(e){_(e),dom.bind(window,"mousemove",_),dom.bind(window,"touchmove",_),dom.bind(window,"mouseup",d),dom.bind(window,"touchend",d)}function l(){dom.unbind(window,"mousemove",m),dom.unbind(window,"touchmove",m),dom.unbind(window,"mouseup",l),dom.unbind(window,"touchend",l),u()}function d(){dom.unbind(window,"mousemove",_),dom.unbind(window,"touchmove",_),dom.unbind(window,"mouseup",d),dom.unbind(window,"touchend",d),u()}function c(){var e=interpret(this.value);!1!==e?(i.__color.__state=e,i.setValue(i.__color.toOriginal())):this.value=i.__color.toString()}function u(){i.__onFinishChange&&i.__onFinishChange.call(i,i.__color.toOriginal())}function m(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=i.__saturation_field.getBoundingClientRect(),o=e.touches&&e.touches[0]||e,n=o.clientX,r=o.clientY,s=(n-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 _(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=i.__hue_field.getBoundingClientRect(),o=1-((e.touches&&e.touches[0]||e).clientY-t.top)/(t.bottom-t.top);return o>1?o=1:o<0&&(o=0),i.__color.h=360*o,i.setValue(i.__color.toOriginal()),!1}return Common.extend(n.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),Common.extend(n.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:n.__field_knob_border+(n.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),Common.extend(n.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),Common.extend(n.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),Common.extend(r.style,{width:"100%",height:"100%",background:"none"}),linearGradient(r,"top","rgba(0,0,0,0)","#000"),Common.extend(n.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),hueGradient(n.__hue_field),Common.extend(n.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:n.__input_textShadow+"rgba(0,0,0,0.7)"}),dom.bind(n.__saturation_field,"mousedown",s),dom.bind(n.__saturation_field,"touchstart",s),dom.bind(n.__field_knob,"mousedown",s),dom.bind(n.__field_knob,"touchstart",s),dom.bind(n.__hue_field,"mousedown",a),dom.bind(n.__hue_field,"touchstart",a),n.__saturation_field.appendChild(r),n.__selector.appendChild(n.__field_knob),n.__selector.appendChild(n.__saturation_field),n.__selector.appendChild(n.__hue_field),n.__hue_field.appendChild(n.__hue_knob),n.domElement.appendChild(n.__input),n.domElement.appendChild(n.__selector),n.updateDisplay(),n}return inherits(t,Controller),createClass(t,[{key:"updateDisplay",value:function(){var e=interpret(this.getValue());if(!1!==e){var t=!1;Common.each(Color.COMPONENTS,function(o){if(!Common.isUndefined(e[o])&&!Common.isUndefined(this.__color.__state[o])&&e[o]!==this.__color.__state[o])return t=!0,{}},this),t&&Common.extend(this.__color.__state,e)}Common.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var o=this.__color.v<.5||this.__color.s>.5?255:0,n=255-o;Common.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("+o+","+o+","+o+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,linearGradient(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),Common.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+o+","+o+","+o+")",textShadow:this.__input_textShadow+"rgba("+n+","+n+","+n+",.7)"})}}]),t}(),vendors=["-moz-","-o-","-webkit-","-ms-",""];function linearGradient(e,t,o,n){e.style.background="",Common.each(vendors,function(i){e.style.cssText+="background: "+i+"linear-gradient("+t+", "+o+" 0%, "+n+" 100%); "})}function hueGradient(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 css={load:function(e,t){var o=t||document,n=o.createElement("link");n.type="text/css",n.rel="stylesheet",n.href=e,o.getElementsByTagName("head")[0].appendChild(n)},inject:function(e,t){var o=t||document,n=document.createElement("style");n.type="text/css",n.innerHTML=e;var i=o.getElementsByTagName("head")[0];try{i.appendChild(n)}catch(e){}}},saveDialogContents='<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>',ControllerFactory=function(e,t){var o=e[t];return Common.isArray(arguments[2])||Common.isObject(arguments[2])?new OptionController(e,t,arguments[2]):Common.isNumber(o)?Common.isNumber(arguments[2])&&Common.isNumber(arguments[3])?Common.isNumber(arguments[4])?new NumberControllerSlider(e,t,arguments[2],arguments[3],arguments[4]):new NumberControllerSlider(e,t,arguments[2],arguments[3]):Common.isNumber(arguments[4])?new NumberControllerBox(e,t,{min:arguments[2],max:arguments[3],step:arguments[4]}):new NumberControllerBox(e,t,{min:arguments[2],max:arguments[3]}):Common.isString(o)?new StringController(e,t):Common.isFunction(o)?new FunctionController(e,t,""):Common.isBoolean(o)?new BooleanController(e,t):null};function requestAnimationFrame(e){setTimeout(e,1e3/60)}var requestAnimationFrame$1=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||requestAnimationFrame,CenteredDiv=function(){function e(){classCallCheck(this,e),this.backgroundElement=document.createElement("div"),Common.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"}),dom.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),Common.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;dom.bind(this.backgroundElement,"click",function(){t.hide()})}return createClass(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(),Common.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",dom.unbind(e.domElement,"webkitTransitionEnd",t),dom.unbind(e.domElement,"transitionend",t),dom.unbind(e.domElement,"oTransitionEnd",t)};dom.bind(this.domElement,"webkitTransitionEnd",t),dom.bind(this.domElement,"transitionend",t),dom.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-dom.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-dom.getHeight(this.domElement)/2+"px"}}]),e}(),styleSheet=___$insertStyle(".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");css.inject(styleSheet);var CSS_NAMESPACE="dg",HIDE_KEY_CODE=72,CLOSE_BUTTON_HEIGHT=20,DEFAULT_DEFAULT_PRESET_NAME="Default",SUPPORTS_LOCAL_STORAGE=function(){try{return!!window.localStorage}catch(e){return!1}}(),SAVE_DIALOGUE=void 0,autoPlaceVirgin=!0,autoPlaceContainer=void 0,hide=!1,hideableGuis=[],GUI=function e(t){var o=this,n=t||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),dom.addClass(this.domElement,CSS_NAMESPACE),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],n=Common.defaults(n,{closeOnTop:!1,autoPlace:!0,width:e.DEFAULT_WIDTH}),n=Common.defaults(n,{resizable:n.autoPlace,hideable:n.autoPlace}),Common.isUndefined(n.load)?n.load={preset:DEFAULT_DEFAULT_PRESET_NAME}:n.preset&&(n.load.preset=n.preset),Common.isUndefined(n.parent)&&n.hideable&&hideableGuis.push(this),n.resizable=Common.isUndefined(n.parent)&&n.resizable,n.autoPlace&&Common.isUndefined(n.scrollable)&&(n.scrollable=!0);var i,r=SUPPORTS_LOCAL_STORAGE&&"true"===localStorage.getItem(getLocalStorageHash(this,"isLocal")),s=void 0,a=void 0;if(Object.defineProperties(this,{parent:{get:function(){return n.parent}},scrollable:{get:function(){return n.scrollable}},autoPlace:{get:function(){return n.autoPlace}},closeOnTop:{get:function(){return n.closeOnTop}},preset:{get:function(){return o.parent?o.getRoot().preset:n.load.preset},set:function(e){o.parent?o.getRoot().preset=e:n.load.preset=e,setPresetSelectIndex(this),o.revert()}},width:{get:function(){return n.width},set:function(e){n.width=e,setWidth(o,e)}},name:{get:function(){return n.name},set:function(e){n.name=e,a&&(a.innerHTML=n.name)}},closed:{get:function(){return n.closed},set:function(t){n.closed=t,n.closed?dom.addClass(o.__ul,e.CLASS_CLOSED):dom.removeClass(o.__ul,e.CLASS_CLOSED),this.onResize(),o.__closeButton&&(o.__closeButton.innerHTML=t?e.TEXT_OPEN:e.TEXT_CLOSED)}},load:{get:function(){return n.load}},useLocalStorage:{get:function(){return r},set:function(e){SUPPORTS_LOCAL_STORAGE&&(r=e,e?dom.bind(window,"unload",s):dom.unbind(window,"unload",s),localStorage.setItem(getLocalStorageHash(o,"isLocal"),e))}}}),Common.isUndefined(n.parent)){if(this.closed=n.closed||!1,dom.addClass(this.domElement,e.CLASS_MAIN),dom.makeSelectable(this.domElement,!1),SUPPORTS_LOCAL_STORAGE&&r){o.useLocalStorage=!0;var l=localStorage.getItem(getLocalStorageHash(this,"gui"));l&&(n.load=JSON.parse(l))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=e.TEXT_CLOSED,dom.addClass(this.__closeButton,e.CLASS_CLOSE_BUTTON),n.closeOnTop?(dom.addClass(this.__closeButton,e.CLASS_CLOSE_TOP),this.domElement.insertBefore(this.__closeButton,this.domElement.childNodes[0])):(dom.addClass(this.__closeButton,e.CLASS_CLOSE_BOTTOM),this.domElement.appendChild(this.__closeButton)),dom.bind(this.__closeButton,"click",function(){o.closed=!o.closed})}else{void 0===n.closed&&(n.closed=!0);var d=document.createTextNode(n.name);dom.addClass(d,"controller-name"),a=addRow(o,d);dom.addClass(this.__ul,e.CLASS_CLOSED),dom.addClass(a,"title"),dom.bind(a,"click",function(e){return e.preventDefault(),o.closed=!o.closed,!1}),n.closed||(this.closed=!1)}n.autoPlace&&(Common.isUndefined(n.parent)&&(autoPlaceVirgin&&(autoPlaceContainer=document.createElement("div"),dom.addClass(autoPlaceContainer,CSS_NAMESPACE),dom.addClass(autoPlaceContainer,e.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(autoPlaceContainer),autoPlaceVirgin=!1),autoPlaceContainer.appendChild(this.domElement),dom.addClass(this.domElement,e.CLASS_AUTO_PLACE)),this.parent||setWidth(o,n.width)),this.__resizeHandler=function(){o.onResizeDebounced()},dom.bind(window,"resize",this.__resizeHandler),dom.bind(this.__ul,"webkitTransitionEnd",this.__resizeHandler),dom.bind(this.__ul,"transitionend",this.__resizeHandler),dom.bind(this.__ul,"oTransitionEnd",this.__resizeHandler),this.onResize(),n.resizable&&addResizeHandle(this),s=function(){SUPPORTS_LOCAL_STORAGE&&"true"===localStorage.getItem(getLocalStorageHash(o,"isLocal"))&&localStorage.setItem(getLocalStorageHash(o,"gui"),JSON.stringify(o.getSaveObject()))},this.saveToLocalStorageIfPossible=s,n.parent||((i=o.getRoot()).width+=1,Common.defer(function(){i.width-=1}))};function addRow(e,t,o){var n=document.createElement("li");return t&&n.appendChild(t),o?e.__ul.insertBefore(n,o):e.__ul.appendChild(n),e.onResize(),n}function removeListeners(e){dom.unbind(window,"resize",e.__resizeHandler),e.saveToLocalStorageIfPossible&&dom.unbind(window,"unload",e.saveToLocalStorageIfPossible)}function markPresetModified(e,t){var o=e.__preset_select[e.__preset_select.selectedIndex];o.innerHTML=t?o.value+"*":o.value}function augmentController(e,t,o){if(o.__li=t,o.__gui=e,Common.extend(o,{options:function(t){if(arguments.length>1){var n=o.__li.nextElementSibling;return o.remove(),_add(e,o.object,o.property,{before:n,factoryArgs:[Common.toArray(arguments)]})}if(Common.isArray(t)||Common.isObject(t)){var i=o.__li.nextElementSibling;return o.remove(),_add(e,o.object,o.property,{before:i,factoryArgs:[t]})}},name:function(e){return o.__li.firstElementChild.firstElementChild.innerHTML=e,o},listen:function(){return o.__gui.listen(o),o},remove:function(){return o.__gui.remove(o),o}}),o instanceof NumberControllerSlider){var n=new NumberControllerBox(o.object,o.property,{min:o.__min,max:o.__max,step:o.__step});Common.each(["updateDisplay","onChange","onFinishChange","step","min","max"],function(e){var t=o[e],i=n[e];o[e]=n[e]=function(){var e=Array.prototype.slice.call(arguments);return i.apply(n,e),t.apply(o,e)}}),dom.addClass(t,"has-slider"),o.domElement.insertBefore(n.domElement,o.domElement.firstElementChild)}else if(o instanceof NumberControllerBox){var i=function(t){if(Common.isNumber(o.__min)&&Common.isNumber(o.__max)){var n=o.__li.firstElementChild.firstElementChild.innerHTML,i=o.__gui.__listening.indexOf(o)>-1;o.remove();var r=_add(e,o.object,o.property,{before:o.__li.nextElementSibling,factoryArgs:[o.__min,o.__max,o.__step]});return r.name(n),i&&r.listen(),r}return t};o.min=Common.compose(i,o.min),o.max=Common.compose(i,o.max)}else o instanceof BooleanController?(dom.bind(t,"click",function(){dom.fakeEvent(o.__checkbox,"click")}),dom.bind(o.__checkbox,"click",function(e){e.stopPropagation()})):o instanceof FunctionController?(dom.bind(t,"click",function(){dom.fakeEvent(o.__button,"click")}),dom.bind(t,"mouseover",function(){dom.addClass(o.__button,"hover")}),dom.bind(t,"mouseout",function(){dom.removeClass(o.__button,"hover")})):o instanceof ColorController&&(dom.addClass(t,"color"),o.updateDisplay=Common.compose(function(e){return t.style.borderLeftColor=o.__color.toString(),e},o.updateDisplay),o.updateDisplay());o.setValue=Common.compose(function(t){return e.getRoot().__preset_select&&o.isModified()&&markPresetModified(e.getRoot(),!0),t},o.setValue)}function recallSavedValue(e,t){var o=e.getRoot(),n=o.__rememberedObjects.indexOf(t.object);if(-1!==n){var i=o.__rememberedObjectIndecesToControllers[n];if(void 0===i&&(i={},o.__rememberedObjectIndecesToControllers[n]=i),i[t.property]=t,o.load&&o.load.remembered){var r=o.load.remembered,s=void 0;if(r[e.preset])s=r[e.preset];else{if(!r[DEFAULT_DEFAULT_PRESET_NAME])return;s=r[DEFAULT_DEFAULT_PRESET_NAME]}if(s[n]&&void 0!==s[n][t.property]){var a=s[n][t.property];t.initialValue=a,t.setValue(a)}}}}function _add(e,t,o,n){if(void 0===t[o])throw new Error('Object "'+t+'" has no property "'+o+'"');var i=void 0;if(n.color)i=new ColorController(t,o);else{var r=[t,o].concat(n.factoryArgs);i=ControllerFactory.apply(e,r)}n.before instanceof Controller&&(n.before=n.before.__li),recallSavedValue(e,i),dom.addClass(i.domElement,"c");var s=document.createElement("span");dom.addClass(s,"property-name"),s.innerHTML=i.property;var a=document.createElement("div");a.appendChild(s),a.appendChild(i.domElement);var l=addRow(e,a,n.before);return dom.addClass(l,GUI.CLASS_CONTROLLER_ROW),i instanceof ColorController?dom.addClass(l,"color"):dom.addClass(l,_typeof(i.getValue())),augmentController(e,l,i),e.__controllers.push(i),i}function getLocalStorageHash(e,t){return document.location.href+"."+t}function addPresetOption(e,t,o){var n=document.createElement("option");n.innerHTML=t,n.value=t,e.__preset_select.appendChild(n),o&&(e.__preset_select.selectedIndex=e.__preset_select.length-1)}function showHideExplain(e,t){t.style.display=e.useLocalStorage?"block":"none"}function addSaveMenu(e){var t=e.__save_row=document.createElement("li");dom.addClass(e.domElement,"has-save"),e.__ul.insertBefore(t,e.__ul.firstChild),dom.addClass(t,"save-row");var o=document.createElement("span");o.innerHTML="&nbsp;",dom.addClass(o,"button gears");var n=document.createElement("span");n.innerHTML="Save",dom.addClass(n,"button"),dom.addClass(n,"save");var i=document.createElement("span");i.innerHTML="New",dom.addClass(i,"button"),dom.addClass(i,"save-as");var r=document.createElement("span");r.innerHTML="Revert",dom.addClass(r,"button"),dom.addClass(r,"revert");var s=e.__preset_select=document.createElement("select");if(e.load&&e.load.remembered?Common.each(e.load.remembered,function(t,o){addPresetOption(e,o,o===e.preset)}):addPresetOption(e,DEFAULT_DEFAULT_PRESET_NAME,!1),dom.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(o),t.appendChild(n),t.appendChild(i),t.appendChild(r),SUPPORTS_LOCAL_STORAGE){var a=document.getElementById("dg-local-explain"),l=document.getElementById("dg-local-storage");document.getElementById("dg-save-locally").style.display="block","true"===localStorage.getItem(getLocalStorageHash(e,"isLocal"))&&l.setAttribute("checked","checked"),showHideExplain(e,a),dom.bind(l,"change",function(){e.useLocalStorage=!e.useLocalStorage,showHideExplain(e,a)})}var d=document.getElementById("dg-new-constructor");dom.bind(d,"keydown",function(e){!e.metaKey||67!==e.which&&67!==e.keyCode||SAVE_DIALOGUE.hide()}),dom.bind(o,"click",function(){d.innerHTML=JSON.stringify(e.getSaveObject(),void 0,2),SAVE_DIALOGUE.show(),d.focus(),d.select()}),dom.bind(n,"click",function(){e.save()}),dom.bind(i,"click",function(){var t=prompt("Enter a new preset name.");t&&e.saveAs(t)}),dom.bind(r,"click",function(){e.revert()})}function addResizeHandle(e){var t=void 0;function o(o){return o.preventDefault(),e.width+=t-o.clientX,e.onResize(),t=o.clientX,!1}function n(){dom.removeClass(e.__closeButton,GUI.CLASS_DRAG),dom.unbind(window,"mousemove",o),dom.unbind(window,"mouseup",n)}function i(i){return i.preventDefault(),t=i.clientX,dom.addClass(e.__closeButton,GUI.CLASS_DRAG),dom.bind(window,"mousemove",o),dom.bind(window,"mouseup",n),!1}e.__resize_handle=document.createElement("div"),Common.extend(e.__resize_handle.style,{width:"6px",marginLeft:"-3px",height:"200px",cursor:"ew-resize",position:"absolute"}),dom.bind(e.__resize_handle,"mousedown",i),dom.bind(e.__closeButton,"mousedown",i),e.domElement.insertBefore(e.__resize_handle,e.domElement.firstElementChild)}function setWidth(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 getCurrentPreset(e,t){var o={};return Common.each(e.__rememberedObjects,function(n,i){var r={},s=e.__rememberedObjectIndecesToControllers[i];Common.each(s,function(e,o){r[o]=t?e.initialValue:e.getValue()}),o[i]=r}),o}function setPresetSelectIndex(e){for(var t=0;t<e.__preset_select.length;t++)e.__preset_select[t].value===e.preset&&(e.__preset_select.selectedIndex=t)}function updateDisplays(e){0!==e.length&&requestAnimationFrame$1.call(window,function(){updateDisplays(e)}),Common.each(e,function(e){e.updateDisplay()})}GUI.toggleHide=function(){hide=!hide,Common.each(hideableGuis,function(e){e.domElement.style.display=hide?"none":""})},GUI.CLASS_AUTO_PLACE="a",GUI.CLASS_AUTO_PLACE_CONTAINER="ac",GUI.CLASS_MAIN="main",GUI.CLASS_CONTROLLER_ROW="cr",GUI.CLASS_TOO_TALL="taller-than-window",GUI.CLASS_CLOSED="closed",GUI.CLASS_CLOSE_BUTTON="close-button",GUI.CLASS_CLOSE_TOP="close-top",GUI.CLASS_CLOSE_BOTTOM="close-bottom",GUI.CLASS_DRAG="drag",GUI.DEFAULT_WIDTH=245,GUI.TEXT_CLOSED="Close Controls",GUI.TEXT_OPEN="Open Controls",GUI._keydownHandler=function(e){"text"===document.activeElement.type||e.which!==HIDE_KEY_CODE&&e.keyCode!==HIDE_KEY_CODE||GUI.toggleHide()},dom.bind(window,"keydown",GUI._keydownHandler,!1),Common.extend(GUI.prototype,{add:function(e,t){return _add(this,e,t,{factoryArgs:Array.prototype.slice.call(arguments,2)})},addColor:function(e,t){return _add(this,e,t,{color:!0})},remove:function(e){this.__ul.removeChild(e.__li),this.__controllers.splice(this.__controllers.indexOf(e),1);var t=this;Common.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&&autoPlaceContainer.removeChild(this.domElement);var e=this;Common.each(this.__folders,function(t){e.removeFolder(t)}),dom.unbind(window,"keydown",GUI._keydownHandler,!1),removeListeners(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 o=new GUI(t);this.__folders[e]=o;var n=addRow(this,o.domElement);return dom.addClass(n,"folder"),o},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],removeListeners(e);var t=this;Common.each(e.__folders,function(t){e.removeFolder(t)}),Common.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=dom.getOffset(e.__ul).top,o=0;Common.each(e.__ul.childNodes,function(t){e.autoPlace&&t===e.__save_row||(o+=dom.getHeight(t))}),window.innerHeight-t-CLOSE_BUTTON_HEIGHT<o?(dom.addClass(e.domElement,GUI.CLASS_TOO_TALL),e.__ul.style.height=window.innerHeight-t-CLOSE_BUTTON_HEIGHT+"px"):(dom.removeClass(e.domElement,GUI.CLASS_TOO_TALL),e.__ul.style.height="auto")}e.__resize_handle&&Common.defer(function(){e.__resize_handle.style.height=e.__ul.offsetHeight+"px"}),e.__closeButton&&(e.__closeButton.style.width=e.width+"px")},onResizeDebounced:Common.debounce(function(){this.onResize()},50),remember:function(){if(Common.isUndefined(SAVE_DIALOGUE)&&((SAVE_DIALOGUE=new CenteredDiv).domElement.innerHTML=saveDialogContents),this.parent)throw new Error("You can only call remember on a top level GUI.");var e=this;Common.each(Array.prototype.slice.call(arguments),function(t){0===e.__rememberedObjects.length&&addSaveMenu(e),-1===e.__rememberedObjects.indexOf(t)&&e.__rememberedObjects.push(t)}),this.autoPlace&&setWidth(this,this.width)},getRoot:function(){for(var e=this;e.parent;)e=e.parent;return e},getSaveObject:function(){var e=this.load;return e.closed=this.closed,this.__rememberedObjects.length>0&&(e.preset=this.preset,e.remembered||(e.remembered={}),e.remembered[this.preset]=getCurrentPreset(this)),e.folders={},Common.each(this.__folders,function(t,o){e.folders[o]=t.getSaveObject()}),e},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=getCurrentPreset(this),markPresetModified(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(e){this.load.remembered||(this.load.remembered={},this.load.remembered[DEFAULT_DEFAULT_PRESET_NAME]=getCurrentPreset(this,!0)),this.load.remembered[e]=getCurrentPreset(this),this.preset=e,addPresetOption(this,e,!0),this.saveToLocalStorageIfPossible()},revert:function(e){Common.each(this.__controllers,function(t){this.getRoot().load.remembered?recallSavedValue(e||this.getRoot(),t):t.setValue(t.initialValue),t.__onFinishChange&&t.__onFinishChange.call(t,t.getValue())},this),Common.each(this.__folders,function(e){e.revert(e)}),e||markPresetModified(this.getRoot(),!1)},listen:function(e){var t=0===this.__listening.length;this.__listening.push(e),t&&updateDisplays(this.__listening)},updateDisplay:function(){Common.each(this.__controllers,function(e){e.updateDisplay()}),Common.each(this.__folders,function(e){e.updateDisplay()})}});var color={Color:Color,math:ColorMath,interpret:interpret},controllers={Controller:Controller,BooleanController:BooleanController,OptionController:OptionController,StringController:StringController,NumberController:NumberController,NumberControllerBox:NumberControllerBox,NumberControllerSlider:NumberControllerSlider,FunctionController:FunctionController,ColorController:ColorController},dom$1={dom:dom},gui={GUI:GUI},GUI$1=GUI,index={color:color,controllers:controllers,dom:dom$1,gui:gui,GUI:GUI};export{color,controllers,dom$1 as dom,gui,GUI$1 as GUI};export default index;