-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathnav.bundle.js
637 lines (545 loc) · 29.2 KB
/
nav.bundle.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
(function(){function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}return e})()({1:[function(require,module,exports){
var h = require('h');
var css = require('insert-css');
var path = require('path');
var demoList = JSON.parse("[{\"id\":\"kuramoto\",\"path\":\"../kuramoto/\",\"title\":\"Kuramoto\",\"order\":3700,\"description\":\"The Kuramoto model for a system of spatially coupled oscillators\",\"thumbnailPath\":\"static/kuramoto-thumbnail.jpg\"},{\"id\":\"caustics\",\"path\":\"../caustics/\",\"title\":\"Caustics\",\"order\":3600,\"description\":\"Channelling the feeling of sitting next to a pool\",\"thumbnailPath\":\"static/caustics-thumbnail.jpg\"},{\"id\":\"joukowsky-airfoil\",\"path\":\"../joukowsky-airfoil/\",\"title\":\"Joukowsky Airfoil\",\"order\":3500,\"description\":\"A Joukowsky airfoil, visualized with Line Integral Convolution\",\"thumbnailPath\":\"static/joukowsky-airfoil-thumbnail.jpg\"},{\"id\":\"quasiinfinite-zoom\",\"path\":\"../quasiinfinite-zoom/\",\"title\":\"Quasiinfinite zoom\",\"order\":3400,\"description\":\"Repeated quasirandom points to create the illusion of infinite zoom\",\"thumbnailPath\":\"static/quasiinfinite-zoom-thumbnail.jpg\"},{\"id\":\"cubic-roots\",\"path\":\"../cubic-roots/\",\"title\":\"Cubic Roots ↔︎ Equilateral Triangle\",\"order\":3300,\"description\":\"An interactive reproduction of a diagram by Freya Holmér\",\"thumbnailPath\":\"static/cubic-roots-thumbnail.jpg\"},{\"id\":\"calabi-yau\",\"path\":\"../calabi-yau/\",\"title\":\"Calabi-Yau Manifolds\",\"order\":3200,\"description\":\"A simple plot of Calabi-Yau manifolds; nothing more, nothing less\",\"thumbnailPath\":\"static/calabi-yau-thumbnail.jpg\"},{\"id\":\"lawsons-klein-bottle\",\"path\":\"../lawsons-klein-bottle/\",\"title\":\"Lawson's Klein Bottle\",\"order\":3200,\"description\":\"3D sterographic projection of a 4D Klein bottle\",\"thumbnailPath\":\"static/lawsons-klein-bottle-thumbnail.jpg\"},{\"id\":\"boys-surface\",\"path\":\"../boys-surface/\",\"title\":\"Boy's Surface\",\"order\":3100,\"description\":\"An immersion of the real projective plane in 3D space\",\"thumbnailPath\":\"static/boys-surface-thumbnail.jpg\"},{\"id\":\"clifford-torus\",\"path\":\"../clifford-torus/\",\"title\":\"Clifford Torus\",\"order\":3000,\"description\":\"3D sterographic projection of a 4D Clifford torus\",\"thumbnailPath\":\"static/clifford-torus-thumbnail.jpg\"},{\"id\":\"webcam-kmeans\",\"path\":\"../webcam-kmeans/\",\"title\":\"K-Means\",\"order\":2900,\"description\":\"Live k-means on a video feed with Lloyd's algorithm\",\"thumbnailPath\":\"static/webcam-kmeans-thumbnail.jpg\"},{\"id\":\"moire\",\"path\":\"../moire/\",\"title\":\"Moiré\",\"order\":2800,\"description\":\"Just moiré\",\"thumbnailPath\":\"static/moire-thumbnail.jpg\"},{\"id\":\"ikeda\",\"path\":\"../ikeda/\",\"title\":\"Ikeda Map\",\"order\":2700,\"description\":\"A discrete chaotic attractor\",\"thumbnailPath\":\"static/ikeda-thumbnail.jpg\"},{\"id\":\"hertzsprung-russell\",\"path\":\"../hertzsprung-russell/\",\"title\":\"Hertzsprung-Russell Diagram\",\"order\":2600,\"description\":\"Star magnitudes and temperatures\",\"thumbnailPath\":\"static/hertzsprung-russell-thumbnail.jpg\"},{\"id\":\"mandelbrot\",\"path\":\"../mandelbrot/\",\"title\":\"Mandelbrot\",\"order\":2500,\"description\":\"Drawing the first iterations of the Mandelbrot set as a complex function\",\"thumbnailPath\":\"static/mandelbrot-thumbnail.jpg\"},{\"id\":\"pulsar\",\"path\":\"../pulsar/\",\"title\":\"Pulsar\",\"order\":2400,\"description\":\"Signals and noise (no physical significance)\",\"thumbnailPath\":\"static/pulsar-thumbnail.png\"},{\"id\":\"multiscale-turing-patterns\",\"path\":\"../multiscale-turing-patterns/\",\"title\":\"Multiscale Turing Patterns\",\"order\":2300,\"description\":\"Multiscale turing patterns, as described by Jonathan McCabe\",\"thumbnailPath\":\"static/multiscale-turing-patterns-thumbnail.jpg\"},{\"id\":\"magnet\",\"path\":\"../magnet/\",\"title\":\"Solenoid\",\"order\":2200,\"description\":\"Just a solenoidal field\",\"thumbnailPath\":\"static/magnet-thumbnail.jpg\"},{\"id\":\"potential-flow\",\"path\":\"../potential-flow/\",\"title\":\"Potential Flow\",\"order\":2100,\"description\":\"Procedural (almost) potential flow with curl noise\",\"thumbnailPath\":\"static/potential-flow-thumbnail.jpg\"},{\"id\":\"ueda-attractor\",\"path\":\"../ueda-attractor/\",\"title\":\"Ueda Attractor\",\"order\":2000,\"description\":\"Ueda's chaotic nonlinear oscillator\",\"thumbnailPath\":\"static/ueda-attractor-thumbnail.jpg\"},{\"id\":\"path-integral-diffraction\",\"path\":\"../path-integral-diffraction/\",\"title\":\"Single-slit diffraction\",\"order\":1900,\"description\":\"Diffraction of a 1D wavefunction through a slit using Feynman's path integral approach\",\"thumbnailPath\":\"static/path-integral-diffraction-thumbnail.jpg\"},{\"id\":\"fibonacci-sphere\",\"path\":\"../fibonacci-sphere/\",\"title\":\"Fibonacci Sphere\",\"order\":1800,\"description\":\"From Martin Roberts' article about evenly distributed points on a sphere\",\"thumbnailPath\":\"static/fibonacci-sphere-thumbnail.jpg\"},{\"id\":\"gray-scott-reaction-diffusion\",\"path\":\"../gray-scott-reaction-diffusion/\",\"title\":\"Gray Scott Reaction Diffusion\",\"order\":1700,\"description\":\"Reacting species diffusing at different rates\",\"thumbnailPath\":\"static/gray-scott-reaction-diffusion-thumbnail.jpg\"},{\"id\":\"rule-30\",\"path\":\"../rule-30/\",\"title\":\"Rule 30\",\"order\":1600,\"description\":\"Stephen Wolfram's 1D cellular automata\",\"thumbnailPath\":\"static/rule-30-thumbnail.png\"},{\"id\":\"line-integral-convolution\",\"path\":\"../line-integral-convolution/\",\"title\":\"Line Integral Convolution\",\"order\":1500,\"description\":\"Visualizing vector fields with Line Integral Convolution (LIC)\",\"thumbnailPath\":\"static/line-integral-convolution-thumbnail.jpg\"},{\"id\":\"iterative-closest-point\",\"path\":\"../iterative-closest-point/\",\"title\":\"Rigid Point Cloud Alignment\",\"order\":1400,\"description\":\"Aligning point clouds with the Iterative Closest Point method\",\"thumbnailPath\":\"static/iterative-closest-point-thumbnail.png\"},{\"id\":\"spherical-harmonics\",\"path\":\"../spherical-harmonics/\",\"title\":\"Spherical Harmonics\",\"order\":1300,\"description\":\"Just a plot of the first few spherical harmonics\",\"thumbnailPath\":\"static/spherical-harmonics-thumbnail.jpg\"},{\"id\":\"domain-coloring-with-scaling\",\"path\":\"../domain-coloring-with-scaling/\",\"title\":\"Domain Coloring with Contour Scaling\",\"order\":1200,\"description\":\"Using OES_standard_derivatives to scale contours to the local gradient of a function\",\"thumbnailPath\":\"static/domain-coloring-with-scaling-thumbnail.jpg\"},{\"id\":\"flamms-paraboloid\",\"path\":\"../flamms-paraboloid/\",\"title\":\"Flamm's Paraboloid\",\"order\":1100,\"description\":\"Scroll to build Flamm's Paraboloid\",\"thumbnailPath\":\"static/flamms-paraboloid-thumbnail.jpg\"},{\"id\":\"continuum-gravity\",\"path\":\"../continuum-gravity/\",\"title\":\"Continuum Gravity\",\"order\":1000,\"description\":\"One million particles interacting gravitationally via a Poisson equation solved on a 2D grid\",\"thumbnailPath\":\"static/continuum-gravity-thumbnail.jpg\"},{\"id\":\"kuramoto-sivashinsky\",\"path\":\"../kuramoto-sivashinsky/\",\"title\":\"Kuramoto-Sivashinsky\",\"order\":900,\"description\":\"Integrating the 2D Kuramoto-Sivashinsky Equation, ∂u/∂t + ∇⁴u + ∇²u + ½ |∇u|² = 0\",\"thumbnailPath\":\"static/kuramoto-sivashinsky-thumbnail.jpg\"},{\"id\":\"karman-trefftz-airfoil\",\"path\":\"../karman-trefftz-airfoil/\",\"title\":\"Karman-Trefftz Airfoil\",\"order\":700,\"description\":\"Flow over an airfoil, computed with the Karman-Trefftz conformal map and visualized on the GPU\",\"thumbnailPath\":\"static/karman-trefftz-airfoil-thumbnail.jpg\"},{\"id\":\"periodic-three-body-orbits\",\"path\":\"../periodic-three-body-orbits/\",\"title\":\"Periodic Three-Body Orbits\",\"order\":600,\"description\":\"Periodic solutions of three bodies interacting via Newtonian gravity\",\"thumbnailPath\":\"static/periodic-three-body-orbits-thumbnail.jpg\"},{\"id\":\"hydrodynamic-instabilities\",\"path\":\"../hydrodynamic-instabilities/\",\"title\":\"Hydrodynamic Instabilities\",\"order\":500,\"description\":\"The Kelvin-Helmholtz and Rayleigh-Taylor hydrodynamic instabilities\",\"thumbnailPath\":\"static/hydrodynamic-instabilities-thumbnail.jpg\"},{\"id\":\"strange-attractors\",\"path\":\"../strange-attractors/\",\"title\":\"Strange Attractors\",\"order\":450,\"description\":\"Strange attractors on the GPU\",\"thumbnailPath\":\"static/strange-attractors-thumbnail.jpg\"},{\"id\":\"schwarzschild-spacetime\",\"path\":\"../schwarzschild-spacetime/\",\"title\":\"Schwarzschild Trajectories\",\"order\":350,\"description\":\"Integrating particle geodesics in Schwarzschild spacetime (a black hole).\",\"thumbnailPath\":\"static/schwarzschild-spacetime-thumbnail.jpg\"},{\"id\":\"random-polynomial-roots\",\"path\":\"../random-polynomial-roots/\",\"title\":\"Polynomial Roots\",\"order\":300,\"description\":\"Roots of a polynomial with random coefficients, plotted in the complex plane\",\"thumbnailPath\":\"static/random-polynomial-roots-thumbnail.jpg\"},{\"id\":\"umbilic-torus\",\"path\":\"../umbilic-torus/\",\"title\":\"Umbilic Torus\",\"order\":300,\"description\":\"Umbilic Torus\",\"thumbnailPath\":\"static/umbilic-torus-thumbnail.jpg\"},{\"id\":\"lamb-wave-dispersion\",\"path\":\"../lamb-wave-dispersion/\",\"title\":\"Lamb Wave Dispersion Relation\",\"order\":220,\"description\":\"Plotting the the complex dispersion relation for elastodynamic plate waves; zeros represent valid modes\",\"thumbnailPath\":\"static/lamb-wave-dispersion-thumbnail.jpg\"},{\"id\":\"fluid-simulation\",\"path\":\"../fluid-simulation/\",\"title\":\"Fluid Simluation\",\"order\":210,\"description\":\"Classic semi-Lagrangian fluid simulation from Visual Simulation of Smoke\",\"thumbnailPath\":\"static/fluid-simulation-thumbnail.jpg\"},{\"id\":\"erosion\",\"path\":\"../erosion/\",\"title\":\"Erosion\",\"order\":100,\"description\":\"An ad-hoc particle-based terrain erosion algorithm, computed on the GPU\",\"thumbnailPath\":\"static/erosion-thumbnail.jpg\"},{\"id\":\"centripetal-b-splines\",\"path\":\"../centripetal-b-splines/\",\"title\":\"Centripetal B-Splines\",\"order\":80,\"description\":\"Experimenting with centripetal parameterization for B-splines\",\"thumbnailPath\":\"static/centripetal-b-splines-thumbnail.png\"},{\"id\":\"smooth-life\",\"path\":\"../smooth-life/\",\"title\":\"Smooth Life\",\"order\":80,\"description\":\"Conway's Game of Life, generalized to a continuum and solved on the GPU\",\"thumbnailPath\":\"static/smooth-life-thumbnail.jpg\"},{\"id\":\"logistic-map\",\"path\":\"../logistic-map/\",\"title\":\"Logistic Map\",\"order\":20,\"description\":\"The chaotic logistic map, computed and displayed on the GPU\",\"thumbnailPath\":\"static/logistic-map-thumbnail.jpg\"},{\"id\":\"nose-hoover-attractor\",\"path\":\"../nose-hoover-attractor/\",\"title\":\"Nosé-Hoover Attractor\",\"order\":8,\"description\":\"Plotting a strange attractor with 2D rectangles\",\"thumbnailPath\":\"static/nose-hoover-attractor-thumbnail.jpg\"},{\"id\":\"vortex-sdf\",\"path\":\"../vortex-sdf/\",\"title\":\"Vortex\",\"order\":7,\"description\":\"A vortex, rendered as a single signed distance function\",\"thumbnailPath\":\"static/vortex-sdf-thumbnail.jpg\"},{\"id\":\"k-means\",\"path\":\"../k-means/\",\"title\":\"K-means clustering\",\"order\":5,\"description\":\"WIP refactoring of the kmpp npm module\",\"thumbnailPath\":\"static/k-means-thumbnail.jpg\"},{\"id\":\"double-pendulum\",\"path\":\"../double-pendulum/\",\"title\":\"Double Pendulum\",\"order\":3,\"description\":\"Accumulating long-term patterns in a chaotic double-pendulum\",\"thumbnailPath\":\"static/double-pendulum-thumbnail.jpg\"}]");
var demoIndex = {};
demoList.forEach(function (demo) {
demoIndex[demo.id] = demo;
});
function urlFor (id) {
return 'https://rreusser.github.io/' + id;
}
var hrefParts = window.location.href.replace(/(\/)?(index.html)?(#.*)?$/i, '').split('/');
var id = hrefParts[hrefParts.length - 1];
var indexUrl = 'https://rreusser.github.io/sketches/';
var sourceUrl = 'https://github.com/rreusser/rreusser.github.io/tree/master/src/src/' + id;
var meta = demoIndex[id];
var curIndex = demoList.indexOf(meta);
var prevUrl = curIndex === 0 ? indexUrl : urlFor(demoList[curIndex - 1].id);
var nextUrl = curIndex === demoList.length - 1 ? indexUrl : urlFor(demoList[curIndex + 1].id);
css(`
.sketch-nav {
position: fixed;
top: 0px;
right: 0px;
z-index: 10000;
text-align: right;
transition: transform 0.2s;
}
.sketch-nav--hidden {
transform: translate(0, -110%);
}
.sketch-nav a {
background-color: rgba(0, 0, 0, 0.65);
color: rgb(220, 220, 220);
font-family: sans-serif;
padding: 5px 8px;
margin: 0;
text-decoration: none;
border-radius; 2px;
display: inline-block;
font-size: 0.8em;
font-weight: 200;
}
.sketch-nav a:hover {
background-color: rgba(255, 255, 255, 0.65);
color: #333;
}
.sketch-nav h1 {
font-style: italic;
margin: 0;
background-color: rgba(0, 0, 0, 0.65);
color: white;
font-family: sans-serif;
font-weight: 200;
font-size: 20px;
padding: 4px 8px;
}
`);
var exitBtn = h('a', {href: 'javascript:void(0);'}, 'x');
exitBtn.innerHTML = '×';
exitBtn.addEventListener('click', function (e) {
nav.classList.add('sketch-nav--hidden');
});
exitBtn.addEventListener('touchstart', function (e) {
nav.classList.add('sketch-nav--hidden');
});
var nav = h('nav.sketch-nav', [
h('h1', meta.title),
h('div', [
h('a', {href: indexUrl}, 'all'),
h('a', {href: prevUrl}, 'prev'),
h('a', {href: nextUrl}, 'next'),
h('a', {href: sourceUrl}, 'src'),
exitBtn
]),
]);
nav.addEventListener('click', e => e.stopPropagation());
nav.addEventListener('touchstart', e => e.stopPropagation());
nav.addEventListener('touchmove', e => e.stopPropagation());
nav.addEventListener('touchend', e => e.stopPropagation());
nav.addEventListener('touchcancel', e => e.stopPropagation());
document.body.appendChild(nav);
},{"h":2,"insert-css":3,"path":4}],2:[function(require,module,exports){
;(function () {
function h() {
var args = [].slice.call(arguments), e = null
function item (l) {
function parseClass (string) {
var m = string.split(/([\.#]?[a-zA-Z0-9_-]+)/)
m.forEach(function (v) {
var s = v.substring(1,v.length)
if(!v) return
if(!e)
e = document.createElement(v)
else if (v[0] === '.')
e.classList.add(s)
else if (v[0] === '#')
e.setAttribute('id', s)
})
}
if(l == null)
;
else if('string' === typeof l) {
if(!e)
parseClass(l)
else
e.appendChild(document.createTextNode(l))
}
else if('number' === typeof l
|| 'boolean' === typeof l
|| l instanceof Date
|| l instanceof RegExp ) {
e.appendChild(document.createTextNode(l.toString()))
}
else if (Array.isArray(l))
l.forEach(item)
else if(l instanceof HTMLElement)
e.appendChild(l)
else if ('object' === typeof l) {
for (var k in l) {
if('function' === typeof l[k])
e.addEventListener(k, l[k])
else if(k === 'style') {
for (var s in l[k])
e.style.setProperty(s, l[k][s])
}
else
e.setAttribute(k, l[k])
}
}
}
while(args.length) {
item(args.shift())
}
return e
}
if(typeof module === 'object')
module.exports = h
else
this.h = h
})()
},{}],3:[function(require,module,exports){
var containers = []; // will store container HTMLElement references
var styleElements = []; // will store {prepend: HTMLElement, append: HTMLElement}
var usage = 'insert-css: You need to provide a CSS string. Usage: insertCss(cssString[, options]).';
function insertCss(css, options) {
options = options || {};
if (css === undefined) {
throw new Error(usage);
}
var position = options.prepend === true ? 'prepend' : 'append';
var container = options.container !== undefined ? options.container : document.querySelector('head');
var containerId = containers.indexOf(container);
// first time we see this container, create the necessary entries
if (containerId === -1) {
containerId = containers.push(container) - 1;
styleElements[containerId] = {};
}
// try to get the correponding container + position styleElement, create it otherwise
var styleElement;
if (styleElements[containerId] !== undefined && styleElements[containerId][position] !== undefined) {
styleElement = styleElements[containerId][position];
} else {
styleElement = styleElements[containerId][position] = createStyleElement();
if (position === 'prepend') {
container.insertBefore(styleElement, container.childNodes[0]);
} else {
container.appendChild(styleElement);
}
}
// strip potential UTF-8 BOM if css was read from a file
if (css.charCodeAt(0) === 0xFEFF) { css = css.substr(1, css.length); }
// actually add the stylesheet
if (styleElement.styleSheet) {
styleElement.styleSheet.cssText += css
} else {
styleElement.textContent += css;
}
return styleElement;
};
function createStyleElement() {
var styleElement = document.createElement('style');
styleElement.setAttribute('type', 'text/css');
return styleElement;
}
module.exports = insertCss;
module.exports.insertCss = insertCss;
},{}],4:[function(require,module,exports){
(function (process){(function (){
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
// resolves . and .. elements in a path array with directory names there
// must be no slashes, empty elements, or device names (c:\) in the array
// (so also no leading and trailing slashes - it does not distinguish
// relative and absolute paths)
function normalizeArray(parts, allowAboveRoot) {
// if the path tries to go above the root, `up` ends up > 0
var up = 0;
for (var i = parts.length - 1; i >= 0; i--) {
var last = parts[i];
if (last === '.') {
parts.splice(i, 1);
} else if (last === '..') {
parts.splice(i, 1);
up++;
} else if (up) {
parts.splice(i, 1);
up--;
}
}
// if the path is allowed to go above the root, restore leading ..s
if (allowAboveRoot) {
for (; up--; up) {
parts.unshift('..');
}
}
return parts;
}
// Split a filename into [root, dir, basename, ext], unix version
// 'root' is just a slash, or nothing.
var splitPathRe =
/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
var splitPath = function(filename) {
return splitPathRe.exec(filename).slice(1);
};
// path.resolve([from ...], to)
// posix version
exports.resolve = function() {
var resolvedPath = '',
resolvedAbsolute = false;
for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
var path = (i >= 0) ? arguments[i] : process.cwd();
// Skip empty and invalid entries
if (typeof path !== 'string') {
throw new TypeError('Arguments to path.resolve must be strings');
} else if (!path) {
continue;
}
resolvedPath = path + '/' + resolvedPath;
resolvedAbsolute = path.charAt(0) === '/';
}
// At this point the path should be resolved to a full absolute path, but
// handle relative paths to be safe (might happen when process.cwd() fails)
// Normalize the path
resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {
return !!p;
}), !resolvedAbsolute).join('/');
return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
};
// path.normalize(path)
// posix version
exports.normalize = function(path) {
var isAbsolute = exports.isAbsolute(path),
trailingSlash = substr(path, -1) === '/';
// Normalize the path
path = normalizeArray(filter(path.split('/'), function(p) {
return !!p;
}), !isAbsolute).join('/');
if (!path && !isAbsolute) {
path = '.';
}
if (path && trailingSlash) {
path += '/';
}
return (isAbsolute ? '/' : '') + path;
};
// posix version
exports.isAbsolute = function(path) {
return path.charAt(0) === '/';
};
// posix version
exports.join = function() {
var paths = Array.prototype.slice.call(arguments, 0);
return exports.normalize(filter(paths, function(p, index) {
if (typeof p !== 'string') {
throw new TypeError('Arguments to path.join must be strings');
}
return p;
}).join('/'));
};
// path.relative(from, to)
// posix version
exports.relative = function(from, to) {
from = exports.resolve(from).substr(1);
to = exports.resolve(to).substr(1);
function trim(arr) {
var start = 0;
for (; start < arr.length; start++) {
if (arr[start] !== '') break;
}
var end = arr.length - 1;
for (; end >= 0; end--) {
if (arr[end] !== '') break;
}
if (start > end) return [];
return arr.slice(start, end - start + 1);
}
var fromParts = trim(from.split('/'));
var toParts = trim(to.split('/'));
var length = Math.min(fromParts.length, toParts.length);
var samePartsLength = length;
for (var i = 0; i < length; i++) {
if (fromParts[i] !== toParts[i]) {
samePartsLength = i;
break;
}
}
var outputParts = [];
for (var i = samePartsLength; i < fromParts.length; i++) {
outputParts.push('..');
}
outputParts = outputParts.concat(toParts.slice(samePartsLength));
return outputParts.join('/');
};
exports.sep = '/';
exports.delimiter = ':';
exports.dirname = function(path) {
var result = splitPath(path),
root = result[0],
dir = result[1];
if (!root && !dir) {
// No dirname whatsoever
return '.';
}
if (dir) {
// It has a dirname, strip trailing slash
dir = dir.substr(0, dir.length - 1);
}
return root + dir;
};
exports.basename = function(path, ext) {
var f = splitPath(path)[2];
// TODO: make this comparison case-insensitive on windows?
if (ext && f.substr(-1 * ext.length) === ext) {
f = f.substr(0, f.length - ext.length);
}
return f;
};
exports.extname = function(path) {
return splitPath(path)[3];
};
function filter (xs, f) {
if (xs.filter) return xs.filter(f);
var res = [];
for (var i = 0; i < xs.length; i++) {
if (f(xs[i], i, xs)) res.push(xs[i]);
}
return res;
}
// String.prototype.substr - negative index don't work in IE8
var substr = 'ab'.substr(-1) === 'b'
? function (str, start, len) { return str.substr(start, len) }
: function (str, start, len) {
if (start < 0) start = str.length + start;
return str.substr(start, len);
}
;
}).call(this)}).call(this,require('_process'))
},{"_process":5}],5:[function(require,module,exports){
// shim for using process in browser
var process = module.exports = {};
// cached from whatever global is present so that test runners that stub it
// don't break things. But we need to wrap it in a try catch in case it is
// wrapped in strict mode code which doesn't define any globals. It's inside a
// function because try/catches deoptimize in certain engines.
var cachedSetTimeout;
var cachedClearTimeout;
function defaultSetTimout() {
throw new Error('setTimeout has not been defined');
}
function defaultClearTimeout () {
throw new Error('clearTimeout has not been defined');
}
(function () {
try {
if (typeof setTimeout === 'function') {
cachedSetTimeout = setTimeout;
} else {
cachedSetTimeout = defaultSetTimout;
}
} catch (e) {
cachedSetTimeout = defaultSetTimout;
}
try {
if (typeof clearTimeout === 'function') {
cachedClearTimeout = clearTimeout;
} else {
cachedClearTimeout = defaultClearTimeout;
}
} catch (e) {
cachedClearTimeout = defaultClearTimeout;
}
} ())
function runTimeout(fun) {
if (cachedSetTimeout === setTimeout) {
//normal enviroments in sane situations
return setTimeout(fun, 0);
}
// if setTimeout wasn't available but was latter defined
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
cachedSetTimeout = setTimeout;
return setTimeout(fun, 0);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedSetTimeout(fun, 0);
} catch(e){
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedSetTimeout.call(null, fun, 0);
} catch(e){
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
return cachedSetTimeout.call(this, fun, 0);
}
}
}
function runClearTimeout(marker) {
if (cachedClearTimeout === clearTimeout) {
//normal enviroments in sane situations
return clearTimeout(marker);
}
// if clearTimeout wasn't available but was latter defined
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
cachedClearTimeout = clearTimeout;
return clearTimeout(marker);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedClearTimeout(marker);
} catch (e){
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedClearTimeout.call(null, marker);
} catch (e){
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
return cachedClearTimeout.call(this, marker);
}
}
}
var queue = [];
var draining = false;
var currentQueue;
var queueIndex = -1;
function cleanUpNextTick() {
if (!draining || !currentQueue) {
return;
}
draining = false;
if (currentQueue.length) {
queue = currentQueue.concat(queue);
} else {
queueIndex = -1;
}
if (queue.length) {
drainQueue();
}
}
function drainQueue() {
if (draining) {
return;
}
var timeout = runTimeout(cleanUpNextTick);
draining = true;
var len = queue.length;
while(len) {
currentQueue = queue;
queue = [];
while (++queueIndex < len) {
if (currentQueue) {
currentQueue[queueIndex].run();
}
}
queueIndex = -1;
len = queue.length;
}
currentQueue = null;
draining = false;
runClearTimeout(timeout);
}
process.nextTick = function (fun) {
var args = new Array(arguments.length - 1);
if (arguments.length > 1) {
for (var i = 1; i < arguments.length; i++) {
args[i - 1] = arguments[i];
}
}
queue.push(new Item(fun, args));
if (queue.length === 1 && !draining) {
runTimeout(drainQueue);
}
};
// v8 likes predictible objects
function Item(fun, array) {
this.fun = fun;
this.array = array;
}
Item.prototype.run = function () {
this.fun.apply(null, this.array);
};
process.title = 'browser';
process.browser = true;
process.env = {};
process.argv = [];
process.version = ''; // empty string to avoid regexp issues
process.versions = {};
function noop() {}
process.on = noop;
process.addListener = noop;
process.once = noop;
process.off = noop;
process.removeListener = noop;
process.removeAllListeners = noop;
process.emit = noop;
process.prependListener = noop;
process.prependOnceListener = noop;
process.listeners = function (name) { return [] }
process.binding = function (name) {
throw new Error('process.binding is not supported');
};
process.cwd = function () { return '/' };
process.chdir = function (dir) {
throw new Error('process.chdir is not supported');
};
process.umask = function() { return 0; };
},{}]},{},[1]);