diff --git a/nav.bundle.js b/nav.bundle.js index ee26fba..3a08f9c 100644 --- a/nav.bundle.js +++ b/nav.bundle.js @@ -3,7 +3,7 @@ var h = require('h'); var css = require('insert-css'); var path = require('path'); -var demoList = JSON.parse("[{\"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\":\"Magnet\",\"order\":2200,\"description\":\"Just a magnetic 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 demoList = JSON.parse("[{\"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\":\"Magnet\",\"order\":2200,\"description\":\"Just a magnetic 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; @@ -95,7 +95,132 @@ nav.addEventListener('touchcancel', e => e.stopPropagation()); document.body.appendChild(nav); -},{"h":3,"insert-css":4,"path":2}],2:[function(require,module,exports){ +},{"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 (){ // .dirname, .basename, and .extname methods are extracted from Node.js v8.11.1, // backported and transplited with Babel, with backwards-compat fixes @@ -401,132 +526,7 @@ var substr = 'ab'.substr(-1) === 'b' ; }).call(this)}).call(this,require('_process')) -},{"_process":5}],3:[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 -})() - -},{}],4:[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; - -},{}],5:[function(require,module,exports){ +},{"_process":5}],5:[function(require,module,exports){ // shim for using process in browser var process = module.exports = {}; diff --git a/quasiinfinite-zoom/bundle.js b/quasiinfinite-zoom/bundle.js new file mode 100644 index 0000000..d7beae8 --- /dev/null +++ b/quasiinfinite-zoom/bundle.js @@ -0,0 +1 @@ +!function(){return function t(e,n,r){function i(a,u){if(!n[a]){if(!e[a]){var f="function"==typeof require&&require;if(!u&&f)return f(a,!0);if(o)return o(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var s=n[a]={exports:{}};e[a][0].call(s.exports,function(t){return i(e[a][1][t]||t)},s,s.exports,t,e,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a0?a-4:a;for(n=0;n>16&255,f[s++]=e>>8&255,f[s++]=255&e;2===u&&(e=i[t.charCodeAt(n)]<<2|i[t.charCodeAt(n+1)]>>4,f[s++]=255&e);1===u&&(e=i[t.charCodeAt(n)]<<10|i[t.charCodeAt(n+1)]<<4|i[t.charCodeAt(n+2)]>>2,f[s++]=e>>8&255,f[s++]=255&e);return f},n.fromByteArray=function(t){for(var e,n=t.length,i=n%3,o=[],a=0,u=n-i;au?u:a+16383));1===i?(e=t[n-1],o.push(r[e>>2]+r[e<<4&63]+"==")):2===i&&(e=(t[n-2]<<8)+t[n-1],o.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"="));return o.join("")};for(var r=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=0,f=a.length;u0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function s(t,e,n){for(var i,o,a=[],u=e;u>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return a.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},{}],2:[function(t,e,n){(function(e){(function(){"use strict";var e=t("base64-js"),r=t("ieee754");n.Buffer=a,n.SlowBuffer=function(t){+t!=t&&(t=0);return a.alloc(+t)},n.INSPECT_MAX_BYTES=50;var i=2147483647;function o(t){if(t>i)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return e.__proto__=a.prototype,e}function a(t,e,n){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return c(t)}return u(t,e,n)}function u(t,e,n){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!a.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var n=0|h(t,e),r=o(n),i=r.write(t,e);i!==n&&(r=r.slice(0,i));return r}(t,e);if(ArrayBuffer.isView(t))return s(t);if(null==t)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(L(t,ArrayBuffer)||t&&L(t.buffer,ArrayBuffer))return function(t,e,n){if(e<0||t.byteLength=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|t}function h(t,e){if(a.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||L(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var n=t.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return B(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return R(t).length;default:if(i)return r?-1:B(t).length;e=(""+e).toLowerCase(),i=!0}}function d(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function p(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),U(n=+n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=a.from(e,r)),a.isBuffer(e))return 0===e.length?-1:g(t,e,n,r,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):g(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function g(t,e,n,r,i){var o,a=1,u=t.length,f=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;a=2,u/=2,f/=2,n/=2}function c(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){var s=-1;for(o=n;ou&&(n=u-f),o=n;o>=0;o--){for(var l=!0,h=0;hi&&(r=i):r=i;var o=e.length;r>o/2&&(r=o/2);for(var a=0;a>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function w(t,n,r){return 0===n&&r===t.length?e.fromByteArray(t):e.fromByteArray(t.slice(n,r))}function M(t,e,n){n=Math.min(t.length,n);for(var r=[],i=e;i239?4:c>223?3:c>191?2:1;if(i+l<=n)switch(l){case 1:c<128&&(s=c);break;case 2:128==(192&(o=t[i+1]))&&(f=(31&c)<<6|63&o)>127&&(s=f);break;case 3:o=t[i+1],a=t[i+2],128==(192&o)&&128==(192&a)&&(f=(15&c)<<12|(63&o)<<6|63&a)>2047&&(f<55296||f>57343)&&(s=f);break;case 4:o=t[i+1],a=t[i+2],u=t[i+3],128==(192&o)&&128==(192&a)&&128==(192&u)&&(f=(15&c)<<18|(63&o)<<12|(63&a)<<6|63&u)>65535&&f<1114112&&(s=f)}null===s?(s=65533,l=1):s>65535&&(s-=65536,r.push(s>>>10&1023|55296),s=56320|1023&s),r.push(s),i+=l}return function(t){var e=t.length;if(e<=A)return String.fromCharCode.apply(String,t);var n="",r=0;for(;rthis.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return E(this,e,n);case"utf8":case"utf-8":return M(this,e,n);case"ascii":return k(this,e,n);case"latin1":case"binary":return C(this,e,n);case"base64":return w(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(t){if(!a.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===a.compare(this,t)},a.prototype.inspect=function(){var t="",e=n.INSPECT_MAX_BYTES;return t=this.toString("hex",0,e).replace(/(.{2})/g,"$1 ").trim(),this.length>e&&(t+=" ... "),""},a.prototype.compare=function(t,e,n,r,i){if(L(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(r>>>=0),u=(n>>>=0)-(e>>>=0),f=Math.min(o,u),c=this.slice(r,i),s=t.slice(e,n),l=0;l>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return v(this,t,e,n);case"utf8":case"utf-8":return y(this,t,e,n);case"ascii":return b(this,t,e,n);case"latin1":case"binary":return m(this,t,e,n);case"base64":return _(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var A=4096;function k(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;ir)&&(n=r);for(var i="",o=e;on)throw new RangeError("Trying to access beyond buffer length")}function O(t,e,n,r,i,o){if(!a.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function N(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function j(t,e,n,i,o){return e=+e,n>>>=0,o||N(t,0,n,4),r.write(t,e,n,i,23,4),n+4}function P(t,e,n,i,o){return e=+e,n>>>=0,o||N(t,0,n,8),r.write(t,e,n,i,52,8),n+8}a.prototype.slice=function(t,e){var n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e>>=0,e>>>=0,n||S(t,e,this.length);for(var r=this[t],i=1,o=0;++o>>=0,e>>>=0,n||S(t,e,this.length);for(var r=this[t+--e],i=1;e>0&&(i*=256);)r+=this[t+--e]*i;return r},a.prototype.readUInt8=function(t,e){return t>>>=0,e||S(t,1,this.length),this[t]},a.prototype.readUInt16LE=function(t,e){return t>>>=0,e||S(t,2,this.length),this[t]|this[t+1]<<8},a.prototype.readUInt16BE=function(t,e){return t>>>=0,e||S(t,2,this.length),this[t]<<8|this[t+1]},a.prototype.readUInt32LE=function(t,e){return t>>>=0,e||S(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},a.prototype.readUInt32BE=function(t,e){return t>>>=0,e||S(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},a.prototype.readIntLE=function(t,e,n){t>>>=0,e>>>=0,n||S(t,e,this.length);for(var r=this[t],i=1,o=0;++o=(i*=128)&&(r-=Math.pow(2,8*e)),r},a.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||S(t,e,this.length);for(var r=e,i=1,o=this[t+--r];r>0&&(i*=256);)o+=this[t+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},a.prototype.readInt8=function(t,e){return t>>>=0,e||S(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},a.prototype.readInt16LE=function(t,e){t>>>=0,e||S(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},a.prototype.readInt16BE=function(t,e){t>>>=0,e||S(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},a.prototype.readInt32LE=function(t,e){return t>>>=0,e||S(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},a.prototype.readInt32BE=function(t,e){return t>>>=0,e||S(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},a.prototype.readFloatLE=function(t,e){return t>>>=0,e||S(t,4,this.length),r.read(this,t,!0,23,4)},a.prototype.readFloatBE=function(t,e){return t>>>=0,e||S(t,4,this.length),r.read(this,t,!1,23,4)},a.prototype.readDoubleLE=function(t,e){return t>>>=0,e||S(t,8,this.length),r.read(this,t,!0,52,8)},a.prototype.readDoubleBE=function(t,e){return t>>>=0,e||S(t,8,this.length),r.read(this,t,!1,52,8)},a.prototype.writeUIntLE=function(t,e,n,r){(t=+t,e>>>=0,n>>>=0,r)||O(this,t,e,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[e]=255&t;++o>>=0,n>>>=0,r)||O(this,t,e,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},a.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||O(this,t,e,1,255,0),this[e]=255&t,e+1},a.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||O(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||O(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||O(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},a.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||O(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},a.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e>>>=0,!r){var i=Math.pow(2,8*n-1);O(this,t,e,n,i-1,-i)}var o=0,a=1,u=0;for(this[e]=255&t;++o>0)-u&255;return e+n},a.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e>>>=0,!r){var i=Math.pow(2,8*n-1);O(this,t,e,n,i-1,-i)}var o=n-1,a=1,u=0;for(this[e+o]=255&t;--o>=0&&(a*=256);)t<0&&0===u&&0!==this[e+o+1]&&(u=1),this[e+o]=(t/a>>0)-u&255;return e+n},a.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||O(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},a.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||O(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||O(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||O(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},a.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||O(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},a.prototype.writeFloatLE=function(t,e,n){return j(this,t,e,!0,n)},a.prototype.writeFloatBE=function(t,e,n){return j(this,t,e,!1,n)},a.prototype.writeDoubleLE=function(t,e,n){return P(this,t,e,!0,n)},a.prototype.writeDoubleBE=function(t,e,n){return P(this,t,e,!1,n)},a.prototype.copy=function(t,e,n,r){if(!a.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e=0;--o)t[o+e]=this[o+n];else Uint8Array.prototype.set.call(t,this.subarray(n,r),e);return i},a.prototype.fill=function(t,e,n,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!a.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===t.length){var i=t.charCodeAt(0);("utf8"===r&&i<128||"latin1"===r)&&(t=i)}}else"number"==typeof t&&(t&=255);if(e<0||this.length>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(o=e;o55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function R(t){return e.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(z,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function F(t,e,n,r){for(var i=0;i=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function L(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function U(t){return t!=t}}).call(this)}).call(this,t("buffer").Buffer)},{"base64-js":1,buffer:2,ieee754:45}],3:[function(t,e,n){(function(t){(function(){var r,i;r=this,i=function(){"use strict";var e=function(){},n={},r=[],i=[];function o(t,o){var a,u,f,c,s=i;for(c=arguments.length;2 ."+t+"__sectionFields {\n margin-left: 4px;\n }\n\n ."+t+"__sectionFields {\n box-sizing: border-box;\n }\n\n ."+t+"__sectionFields ."+t+"__field {\n border-bottom: 1px solid "+e.fieldBorderColor+";\n box-sizing: border-box;\n }\n\n ."+t+"__sectionFields ."+t+"__sectionFields {\n border-right: none;\n margin-right: 0;\n }\n\n ."+t+" > ."+t+"__section:first-child > ."+t+"__sectionHeading:first-child {\n border-right: 1px solid "+e.sectionHeadingBorderColor+";\n }\n\n ."+t+"__sectionHeading {\n padding: 0;\n font-family: inherit;\n user-select: none;\n -moz-user-select: -moz-none;\n text-indent: 5px;\n cursor: pointer;\n width: 100%;\n\n color: "+e.sectionHeadingColor+";\n background-color: "+e.sectionHeadingBgColor+";\n height: "+e.sectionHeadingHeight+";\n line-height: "+e.sectionHeadingHeight+";\n }\n\n ."+t+"__sectionHeading button:focus {\n background-color: "+e.sectionHeadingHoverColor+";\n }\n\n ."+t+"__sectionHeading > button {\n height: 100%;\n vertical-align: middle;\n font-size: 1.0em;\n cursor: pointer;\n text-align: left;\n outline: none;\n color: inherit;\n font-size: inherit;\n font-family: inherit;\n background: transparent;\n border: none;\n border-radius: 0;\n display: block;\n width: 100%;\n }\n\n ."+t+"__sectionHeading:hover {\n background-color: "+e.sectionHeadingHoverColor+";\n }\n\n ."+t+"__sectionHeading > button::before {\n transform: translate(0, -1px) rotate(90deg);\n }\n\n ."+t+"__sectionHeading > button::before {\n content: '▲';\n display: inline-block;\n transform-origin: 50% 50%;\n margin-right: 0.5em;\n font-size: 0.5em;\n vertical-align: middle;\n }\n\n ."+t+"__section--expanded > ."+t+"__sectionHeading > button::before {\n transform: none;\n content: '▼';\n }\n "}},rt=$.h,it={name:"tabs",component:G({init:function(){var t=this.props.field,e=Object.keys(t.value.$displayFields);this.state={activeTab:e[0]}},getRef:function(t){this.contentsEl=t},activateTab:function(t,e){this.setState({activeTab:t}),e.preventDefault()},preventDefault:function(t){},render:function(){var t=this,e=this.props.field,n=e.$config.label||e.name,r=this.props.className;e.parentField||""!==n||(n="Controls");for(var i=Object.keys(e.value.$displayFields),o={},a=0;a button:hover {\n background-color: "+e.fieldHoverColor+";\n }\n\n ."+t+"__field--button > button:active {\n background-color: "+e.fieldActiveColor+";\n }\n\n ."+t+"__field--button > button:focus {\n "+e.focusBorder+"\n }\n\n ."+t+"__field--button > button::before {\n content: '';\n width: 3px;\n display: inline-block;\n vertical-align: middle;\n position: absolute;\n top: 0;\n left: 0;\n bottom: 0;\n }\n "}},dt=$.h,pt={name:"color",component:G({render:function(){var t=this,e=this.props.field,n=e.$config,r=this.props.className;return dt("div",{className:r+"__field "+r+"__field--color"},dt("label",{className:r+"__label",htmlFor:r+"-"+e.path},dt("span",{className:r+"__labelText"},n.label||e.name)," ",dt("span",{className:r+"__container"},dt("input",{id:r+"-"+e.path,name:e.path,type:"color",value:e.value,onInput:function(e){t.props.field.value=e.target.value}}))))}}),css:function(t,e){return"\n ."+t+"__field--color input[type=color] {\n margin: 0;\n border: 1px solid #aaa;\n width: 50px;\n height: "+e.sliderHeight+";\n border-radius: "+e.controlBorderRadius+";\n padding: 0;\n }\n\n ."+t+"__field--color input[type=color]::-webkit-color-swatch-wrapper {\n padding: 0px;\n background-color: #888;\n }\n\n ."+t+"__field--color input[type=color]:focus {\n "+e.focusBorder+"\n }\n "}},gt=$.h,vt={name:"raw",component:G({getRef:function(t){this.el=t},getContent:function(t){return this.content=t.field.value,"function"==typeof this.content&&(this.content=this.content(gt,{field:t.field,state:t.state})),this.content},render:function(){var t=this.props.className;return gt("div",{className:t+"__field--raw "+t+"__field"},gt("div",{ref:this.getRef,className:t+"__rawContent"},this.getContent(this.props)))}}),css:function(t,e){return"\n ."+t+"__field--raw {\n height: auto;\n padding: 0 7px 0 10px;\n overflow: hidden;\n }\n\n ."+t+"__rawContent {\n max-width: 100%;\n margin: 0;\n padding: 0;\n }\n\n ."+t+"__rawContent a {\n color: inherit;\n }\n\n ."+t+"__rawContent::before {\n background-color: #aaa;\n }\n\n ."+t+"__rawContent::before {\n content: '';\n width: 3px;\n display: inline-block;\n vertical-align: middle;\n position: absolute;\n top: 0;\n left: 0;\n bottom: 0;\n }\n\n ."+t+"__rawContent > p:first-child {\n margin-top: 5px;\n }\n\n ."+t+"__rawContent > p:last-child{\n margin-bottom: 5px;\n }\n\n ."+t+"__rawContent p {\n line-height: 1.8;\n }\n\n ."+t+"__rawContent pre {\n line-height: 1.3;\n font-size: 0.8em;\n margin: 0;\n }\n "}},yt=function(){var t={};function e(e,n){(n=W(n||{},{containerCSS:"position:fixed;top:0;right:8px",style:!0,className:"controlPanel-"+Math.random().toString(36).substring(2,15)})).root=n.root||document.body;var r=n.className,i=G({render:function(){return $.h(function(e){var n=t[e];if(!n)throw new Error('Unrecognized component, "'+e+'"');return n}(this.props.field.type).component,{ControlComponent:i,className:r,field:this.props.field,state:e,h:$.h})}}),o=G({state:{dummy:0},componentDidMount:function(){var t=this;this.props.state.$field.onChanges(function(e){t.setState({dummy:t.state.dummy+1})})},getRef:function(t){for(var e=["mousedown","mouseup","mousemove","touchstart","touchmove","touchend","wheel"],r=0;r button::before { background-color: #8ff; }\n\n "+Object.keys(n).map(function(r){var i=n[r].css;return i?i(t,e):""}).join("\n")+"\n "}(r,n.theme,t)),$.render($.h(o,{state:e}),n.root),e}return e.registerComponent=function(n){return t[n.name]=n,e},e.registerComponents=function(t){for(var n=0;ne?1:t>=e?0:NaN}function n(t){var n;return 1===t.length&&(n=t,t=function(t,r){return e(n(t),r)}),{left:function(e,n,r,i){for(null==r&&(r=0),null==i&&(i=e.length);r>>1;t(e[o],n)<0?r=o+1:i=o}return r},right:function(e,n,r,i){for(null==r&&(r=0),null==i&&(i=e.length);r>>1;t(e[o],n)>0?i=o:r=o+1}return r}}}var r=n(e),i=r.right,o=r.left;function a(t,e){return[t,e]}function u(t){return null===t?NaN:+t}function f(t,e){var n,r,i=t.length,o=0,a=-1,f=0,c=0;if(null==e)for(;++a1)return c/(o-1)}function c(t,e){var n=f(t,e);return n?Math.sqrt(n):n}function s(t,e){var n,r,i,o=t.length,a=-1;if(null==e){for(;++a=n)for(r=i=n;++an&&(r=n),i=n)for(r=i=n;++an&&(r=n),i=0?(o>=y?10:o>=b?5:o>=m?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(o>=y?10:o>=b?5:o>=m?2:1)}function x(t,e,n){var r=Math.abs(e-t)/Math.max(0,n),i=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),o=r/i;return o>=y?i*=10:o>=b?i*=5:o>=m&&(i*=2),e=1)return+n(t[r-1],r-1,t);var r,i=(r-1)*e,o=Math.floor(i),a=+n(t[o],o,t);return a+(+n(t[o+1],o+1,t)-a)*(i-o)}}function A(t,e){var n,r,i=t.length,o=-1;if(null==e){for(;++o=n)for(r=n;++on&&(r=n)}else for(;++o=n)for(r=n;++on&&(r=n);return r}function k(t){if(!(i=t.length))return[];for(var e=-1,n=A(t,C),r=new Array(n);++et?1:e>=t?0:NaN},t.deviation=c,t.extent=s,t.histogram=function(){var t=g,e=s,n=w;function r(r){var o,a,u=r.length,f=new Array(u);for(o=0;ol;)h.pop(),--d;var p,g=new Array(d+1);for(o=0;o<=d;++o)(p=g[o]=[]).x0=o>0?h[o-1]:s,p.x1=o=n)for(r=n;++or&&(r=n)}else for(;++o=n)for(r=n;++or&&(r=n);return r},t.mean=function(t,e){var n,r=t.length,i=r,o=-1,a=0;if(null==e)for(;++o=0;)for(e=(r=t[i]).length;--e>=0;)n[--a]=r[e];return n},t.min=A,t.pairs=function(t,e){null==e&&(e=a);for(var n=0,r=t.length-1,i=t[0],o=new Array(r<0?0:r);n0)return[t];if((r=e0)for(t=Math.ceil(t/a),e=Math.floor(e/a),o=new Array(i=Math.ceil(e-t+1));++u0&&(e=r-$),L<0?A=k-G:L>0&&(a=u-G),R=l,et.attr("cursor",m.selection),it());break;default:return}c()},!0).on("keyup.brush",function(){switch(i.event.keyCode){case 16:X&&(E=O=X=!1,it());break;case 18:R===d&&(F<0?g=b:F>0&&(e=r),L<0?A=k:L>0&&(a=u),R=h,it());break;case 32:R===l&&(i.event.altKey?(F&&(g=b-$*F,e=r+$*F),L&&(A=k-G*L,a=u+G*L),R=d):(F<0?g=b:F>0&&(e=r),L<0?A=k:L>0&&(a=u),R=h),et.attr("cursor",m[z]),it());break;default:return}c()},!0),n.dragDisable(i.event.view)}f(),o.interrupt(P),D.call(P),K.start()}function rt(){var t=Q(P);!X||E||O||(Math.abs(t[0]-J[0])>Math.abs(t[1]-J[1])?O=!0:E=!0),J=t,C=!0,c(),it()}function it(){var t;switch($=J[0]-Z[0],G=J[1]-Z[1],R){case l:case s:F&&($=Math.max(q-e,Math.min(Y-g,$)),r=e+$,b=g+$),L&&(G=Math.max(V-a,Math.min(W-A,G)),u=a+G,k=A+G);break;case h:F<0?($=Math.max(q-e,Math.min(Y-e,$)),r=e+$,b=g):F>0&&($=Math.max(q-g,Math.min(Y-g,$)),r=e,b=g+$),L<0?(G=Math.max(V-a,Math.min(W-a,G)),u=a+G,k=A):L>0&&(G=Math.max(V-A,Math.min(W-A,G)),u=a,k=A+G);break;case d:F&&(r=Math.max(q,Math.min(Y,e-$*F)),b=Math.max(q,Math.min(Y,g+$*F))),L&&(u=Math.max(V,Math.min(W,a-G*L)),k=Math.max(V,Math.min(W,A+G*L)))}b=f.length)return null!=t&&r.sort(t),null!=e?e(r):r;for(var u,c,l,h=-1,d=r.length,p=f[i++],g=n(),v=o();++hf.length)return n;var i,o=c[r-1];return null!=e&&r>=f.length?i=n.entries():(i=[],n.each(function(e,n){i.push({key:n,values:t(e,r)})})),null!=o?i.sort(function(t,e){return o(t.key,e.key)}):i}(s(t,0,o,a),0)},key:function(t){return f.push(t),u},sortKeys:function(t){return c[f.length-1]=t,u},sortValues:function(e){return t=e,u},rollup:function(t){return e=t,u}}},t.set=c,t.map=n,t.keys=function(t){var e=[];for(var n in t)e.push(n);return e},t.values=function(t){var e=[];for(var n in t)e.push(t[n]);return e},t.entries=function(t){var e=[];for(var n in t)e.push({key:n,value:t[n]});return e},Object.defineProperty(t,"__esModule",{value:!0})},"object"==typeof n&&void 0!==e?i(n):"function"==typeof define&&define.amd?define(["exports"],i):i(r.d3=r.d3||{})},{}],10:[function(t,e,n){var r,i;r=this,i=function(t){"use strict";function e(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function n(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function r(){}var i="\\s*([+-]?\\d+)\\s*",o="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",a="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",u=/^#([0-9a-f]{3,8})$/,f=new RegExp("^rgb\\("+[i,i,i]+"\\)$"),c=new RegExp("^rgb\\("+[a,a,a]+"\\)$"),s=new RegExp("^rgba\\("+[i,i,i,o]+"\\)$"),l=new RegExp("^rgba\\("+[a,a,a,o]+"\\)$"),h=new RegExp("^hsl\\("+[o,a,a]+"\\)$"),d=new RegExp("^hsla\\("+[o,a,a,o]+"\\)$"),p={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function g(){return this.rgb().formatHex()}function v(){return this.rgb().formatRgb()}function y(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=u.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?b(e):3===n?new w(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?m(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?m(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=f.exec(t))?new w(e[1],e[2],e[3],1):(e=c.exec(t))?new w(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=s.exec(t))?m(e[1],e[2],e[3],e[4]):(e=l.exec(t))?m(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=h.exec(t))?C(e[1],e[2]/100,e[3]/100,1):(e=d.exec(t))?C(e[1],e[2]/100,e[3]/100,e[4]):p.hasOwnProperty(t)?b(p[t]):"transparent"===t?new w(NaN,NaN,NaN,0):null}function b(t){return new w(t>>16&255,t>>8&255,255&t,1)}function m(t,e,n,r){return r<=0&&(t=e=n=NaN),new w(t,e,n,r)}function _(t){return t instanceof r||(t=y(t)),t?new w((t=t.rgb()).r,t.g,t.b,t.opacity):new w}function x(t,e,n,r){return 1===arguments.length?_(t):new w(t,e,n,null==r?1:r)}function w(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function M(){return"#"+k(this.r)+k(this.g)+k(this.b)}function A(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}function k(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function C(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new S(t,e,n,r)}function E(t){if(t instanceof S)return new S(t.h,t.s,t.l,t.opacity);if(t instanceof r||(t=y(t)),!t)return new S;if(t instanceof S)return t;var e=(t=t.rgb()).r/255,n=t.g/255,i=t.b/255,o=Math.min(e,n,i),a=Math.max(e,n,i),u=NaN,f=a-o,c=(a+o)/2;return f?(u=e===a?(n-i)/f+6*(n0&&c<1?0:u,new S(u,f,c,t.opacity)}function T(t,e,n,r){return 1===arguments.length?E(t):new S(t,e,n,null==r?1:r)}function S(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function O(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}e(r,y,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:g,formatHex:g,formatHsl:function(){return E(this).formatHsl()},formatRgb:v,toString:v}),e(w,x,n(r,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new w(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new w(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:M,formatHex:M,formatRgb:A,toString:A})),e(S,T,n(r,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new S(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new S(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new w(O(t>=240?t-240:t+120,i,r),O(t,i,r),O(t<120?t+240:t-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===t?")":", "+t+")")}}));var N=Math.PI/180,j=180/Math.PI,P=.96422,z=1,D=.82521,B=4/29,R=6/29,F=3*R*R,L=R*R*R;function U(t){if(t instanceof H)return new H(t.l,t.a,t.b,t.opacity);if(t instanceof X)return Q(t);t instanceof w||(t=_(t));var e,n,r=W(t.r),i=W(t.g),o=W(t.b),a=q((.2225045*r+.7168786*i+.0606169*o)/z);return r===i&&i===o?e=n=a:(e=q((.4360747*r+.3850649*i+.1430804*o)/P),n=q((.0139322*r+.0971045*i+.7141733*o)/D)),new H(116*a-16,500*(e-a),200*(a-n),t.opacity)}function I(t,e,n,r){return 1===arguments.length?U(t):new H(t,e,n,null==r?1:r)}function H(t,e,n,r){this.l=+t,this.a=+e,this.b=+n,this.opacity=+r}function q(t){return t>L?Math.pow(t,1/3):t/F+B}function V(t){return t>R?t*t*t:F*(t-B)}function Y(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function W(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function $(t){if(t instanceof X)return new X(t.h,t.c,t.l,t.opacity);if(t instanceof H||(t=U(t)),0===t.a&&0===t.b)return new X(NaN,0r!=p>r&&n<(d-s)*(r-l)/(p-l)+s&&(i=-i)}return i}function u(t,e,n){var r,i,o,a;return function(t,e,n){return(e[0]-t[0])*(n[1]-t[1])==(n[0]-t[0])*(e[1]-t[1])}(t,e,n)&&(i=t[r=+(t[0]===e[0])],o=n[r],a=e[r],i<=o&&o<=a||a<=o&&o<=i)}function f(){}var c=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]];function s(){var t=1,a=1,u=e.thresholdSturges,s=p;function l(t){var n=u(t);if(Array.isArray(n))n=n.slice().sort(r);else{var i=e.extent(t),o=i[0],a=i[1];n=e.tickStep(o,a,n),n=e.range(Math.floor(o/n)*n,Math.floor(a/n)*n,n)}return n.map(function(e){return h(t,e)})}function h(e,n){var r=[],i=[];return function(e,n,r){var i,o,u,f,s,l,h=new Array,p=new Array;i=o=-1,f=e[0]>=n,c[f<<1].forEach(g);for(;++i=n,c[u|f<<1].forEach(g);c[f<<0].forEach(g);for(;++o=n,s=e[o*t]>=n,c[f<<1|s<<2].forEach(g);++i=n,l=s,s=e[o*t+i+1]>=n,c[u|f<<1|s<<2|l<<3].forEach(g);c[f|s<<3].forEach(g)}i=-1,s=e[o*t]>=n,c[s<<2].forEach(g);for(;++i=n,c[s<<2|l<<3].forEach(g);function g(t){var e,n,a=[t[0][0]+i,t[0][1]+o],u=[t[1][0]+i,t[1][1]+o],f=d(a),c=d(u);(e=p[f])?(n=h[c])?(delete p[e.end],delete h[n.start],e===n?(e.ring.push(u),r(e.ring)):h[e.start]=p[n.end]={start:e.start,end:n.end,ring:e.ring.concat(n.ring)}):(delete p[e.end],e.ring.push(u),p[e.end=c]=e):(e=h[c])?(n=p[f])?(delete h[e.start],delete p[n.end],e===n?(e.ring.push(u),r(e.ring)):h[n.start]=p[e.end]={start:n.start,end:e.end,ring:n.ring.concat(e.ring)}):(delete h[e.start],e.ring.unshift(a),h[e.start=f]=e):h[f]=p[c]={start:f,end:c,ring:[a,u]}}c[s<<3].forEach(g)}(e,n,function(t){s(t,e,n),function(t){for(var e=0,n=t.length,r=t[n-1][1]*t[0][0]-t[n-1][0]*t[0][1];++e0?r.push([t]):i.push(t)}),i.forEach(function(t){for(var e,n=0,i=r.length;n0&&o0&&u0&&r>0))throw new Error("invalid size");return t=n,a=r,l},l.thresholds=function(t){return arguments.length?(u="function"==typeof t?t:Array.isArray(t)?i(n.call(t)):i(t),l):u},l.smooth=function(t){return arguments.length?(s=t?p:f,l):s===p},l}function l(t,e,n){for(var r=t.width,i=t.height,o=1+(n<<1),a=0;a=n&&(u>=o&&(f-=t.data[u-o+a*r]),e.data[u-n+a*r]=f/Math.min(u+1,r-1+o-u,o))}function h(t,e,n){for(var r=t.width,i=t.height,o=1+(n<<1),a=0;a=n&&(u>=o&&(f-=t.data[a+(u-o)*r]),e.data[a+(u-n)*r]=f/Math.min(u+1,i-1+o-u,o))}function d(t){return t[0]}function p(t){return t[1]}function g(){return 1}t.contours=s,t.contourDensity=function(){var t=d,r=p,o=g,a=960,u=500,f=20,c=2,v=3*f,y=a+2*v>>c,b=u+2*v>>c,m=i(20);function _(n){var i=new Float32Array(y*b),a=new Float32Array(y*b);n.forEach(function(e,n,a){var u=+t(e,n,a)+v>>c,f=+r(e,n,a)+v>>c,s=+o(e,n,a);u>=0&&u=0&&f>c),h({width:y,height:b,data:a},{width:y,height:b,data:i},f>>c),l({width:y,height:b,data:i},{width:y,height:b,data:a},f>>c),h({width:y,height:b,data:a},{width:y,height:b,data:i},f>>c),l({width:y,height:b,data:i},{width:y,height:b,data:a},f>>c),h({width:y,height:b,data:a},{width:y,height:b,data:i},f>>c);var u=m(i);if(!Array.isArray(u)){var d=e.max(i);u=e.tickStep(0,d,u),(u=e.range(0,Math.floor(d/u)*u,u)).shift()}return s().thresholds(u).size([y,b])(i).map(x)}function x(t){return t.value*=Math.pow(2,-2*c),t.coordinates.forEach(w),t}function w(t){t.forEach(M)}function M(t){t.forEach(A)}function A(t){t[0]=t[0]*Math.pow(2,c)-v,t[1]=t[1]*Math.pow(2,c)-v}function k(){return y=a+2*(v=3*f)>>c,b=u+2*v>>c,_}return _.x=function(e){return arguments.length?(t="function"==typeof e?e:i(+e),_):t},_.y=function(t){return arguments.length?(r="function"==typeof t?t:i(+t),_):r},_.weight=function(t){return arguments.length?(o="function"==typeof t?t:i(+t),_):o},_.size=function(t){if(!arguments.length)return[a,u];var e=Math.ceil(t[0]),n=Math.ceil(t[1]);if(!(e>=0||e>=0))throw new Error("invalid size");return a=e,u=n,k()},_.cellSize=function(t){if(!arguments.length)return 1<=1))throw new Error("invalid cell size");return c=Math.floor(Math.log(t)/Math.LN2),k()},_.thresholds=function(t){return arguments.length?(m="function"==typeof t?t:Array.isArray(t)?i(n.call(t)):i(t),_):m},_.bandwidth=function(t){if(!arguments.length)return Math.sqrt(f*(f+1));if(!((t=+t)>=0))throw new Error("invalid bandwidth");return f=Math.round((Math.sqrt(4*t*t+1)-1)/2),k()},_},Object.defineProperty(t,"__esModule",{value:!0})},"object"==typeof n&&void 0!==e?i(n,t("d3-array")):"function"==typeof define&&define.amd?define(["exports","d3-array"],i):i(r.d3=r.d3||{},r.d3)},{"d3-array":5}],12:[function(t,e,n){var r,i;r=this,i=function(t){"use strict";var e={value:function(){}};function n(){for(var t,e=0,n=arguments.length,i={};e=0&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}})),f=-1,c=u.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++f0)for(var n,r,i=new Array(n),o=0;oM}_.mouse("drag")}function E(){n.select(n.event.view).on("mousemove.drag mouseup.drag",null),a(n.event.view,p),i(),_.mouse("end")}function T(){if(v.apply(this,arguments)){var t,e,i=n.event.changedTouches,o=y.apply(this,arguments),a=i.length;for(t=0;t9999?"+"+f(e,6):f(e,4))+"-"+f(t.getUTCMonth()+1,2)+"-"+f(t.getUTCDate(),2)+(o?"T"+f(n,2)+":"+f(r,2)+":"+f(i,2)+"."+f(o,3)+"Z":i?"T"+f(n,2)+":"+f(r,2)+":"+f(i,2)+"Z":r||n?"T"+f(n,2)+":"+f(r,2)+"Z":"")}function s(t){var f=new RegExp('["'+t+"\n\r]"),s=t.charCodeAt(0);function l(t,a){var u,f=[],c=t.length,l=0,h=0,d=c<=0,p=!1;function g(){if(d)return n;if(p)return p=!1,e;var a,u,f=l;if(t.charCodeAt(f)===r){for(;l++=c?d=!0:(u=t.charCodeAt(l++))===i?p=!0:u===o&&(p=!0,t.charCodeAt(l)===i&&++l),t.slice(f+1,a-1).replace(/""/g,'"')}for(;lh+c||rd+c||os.index){var l=h-u.x-u.vx,v=d-u.y-u.vy,y=l*l+v*v;yt.r&&(t.r=t[e].r)}function h(){if(n){var e,i,o=n.length;for(r=new Array(o),e=0;e=c)){(t.data!==n||t.next)&&(0===l&&(p+=(l=a())*l),0===h&&(p+=(h=a())*h),p1?(null==n?s.remove(t):s.set(t,b(n)),e):s.get(t)},find:function(e,n,r){var i,o,a,u,f,c=0,s=t.length;for(null==r?r=1/0:r*=r,c=0;c1?(h.on(t,n),e):h.on(t)}}},t.forceX=function(t){var e,n,r,i=o(.1);function a(t){for(var i,o=0,a=e.length;o1?r[0]+r.slice(2):r,+t.slice(n+1)]}function n(t){return(t=e(Math.abs(t)))?t[1]:NaN}var r,i=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function o(t){if(!(e=i.exec(t)))throw new Error("invalid format: "+t);var e;return new a({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function a(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function u(t,n){var r=e(t,n);if(!r)return t+"";var i=r[0],o=r[1];return o<0?"0."+new Array(-o).join("0")+i:i.length>o+1?i.slice(0,o+1)+"."+i.slice(o+1):i+new Array(o-i.length+2).join("0")}o.prototype=a.prototype,a.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var f={"%":function(t,e){return(100*t).toFixed(e)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},g:function(t,e){return t.toPrecision(e)},o:function(t){return Math.round(t).toString(8)},p:function(t,e){return u(100*t,e)},r:u,s:function(t,n){var i=e(t,n);if(!i)return t+"";var o=i[0],a=i[1],u=a-(r=3*Math.max(-8,Math.min(8,Math.floor(a/3))))+1,f=o.length;return u===f?o:u>f?o+new Array(u-f+1).join("0"):u>0?o.slice(0,u)+"."+o.slice(u):"0."+new Array(1-u).join("0")+e(t,Math.max(0,n+u-1))[0]},X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}};function c(t){return t}var s,l=Array.prototype.map,h=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function d(t){var e,i,a=void 0===t.grouping||void 0===t.thousands?c:(e=l.call(t.grouping,Number),i=t.thousands+"",function(t,n){for(var r=t.length,o=[],a=0,u=e[0],f=0;r>0&&u>0&&(f+u+1>n&&(u=Math.max(1,n-f)),o.push(t.substring(r-=u,r+u)),!((f+=u+1)>n));)u=e[a=(a+1)%e.length];return o.reverse().join(i)}),u=void 0===t.currency?"":t.currency[0]+"",s=void 0===t.currency?"":t.currency[1]+"",d=void 0===t.decimal?".":t.decimal+"",p=void 0===t.numerals?c:function(t){return function(e){return e.replace(/[0-9]/g,function(e){return t[+e]})}}(l.call(t.numerals,String)),g=void 0===t.percent?"%":t.percent+"",v=void 0===t.minus?"-":t.minus+"",y=void 0===t.nan?"NaN":t.nan+"";function b(t){var e=(t=o(t)).fill,n=t.align,i=t.sign,c=t.symbol,l=t.zero,b=t.width,m=t.comma,_=t.precision,x=t.trim,w=t.type;"n"===w?(m=!0,w="g"):f[w]||(void 0===_&&(_=12),x=!0,w="g"),(l||"0"===e&&"="===n)&&(l=!0,e="0",n="=");var M="$"===c?u:"#"===c&&/[boxX]/.test(w)?"0"+w.toLowerCase():"",A="$"===c?s:/[%p]/.test(w)?g:"",k=f[w],C=/[defgprs%]/.test(w);function E(t){var o,u,f,c=M,s=A;if("c"===w)s=k(t)+s,t="";else{var g=(t=+t)<0||1/t<0;if(t=isNaN(t)?y:k(Math.abs(t),_),x&&(t=function(t){t:for(var e,n=t.length,r=1,i=-1;r0&&(i=0)}return i>0?t.slice(0,i)+t.slice(e+1):t}(t)),g&&0==+t&&"+"!==i&&(g=!1),c=(g?"("===i?i:v:"-"===i||"("===i?"":i)+c,s=("s"===w?h[8+r/3]:"")+s+(g&&"("===i?")":""),C)for(o=-1,u=t.length;++o(f=t.charCodeAt(o))||f>57){s=(46===f?d+t.slice(o+1):t.slice(o))+s,t=t.slice(0,o);break}}m&&!l&&(t=a(t,1/0));var E=c.length+t.length+s.length,T=E>1)+c+t+s+T.slice(E);break;default:t=T+c+t+s}return p(t)}return _=void 0===_?6:/[gprs]/.test(w)?Math.max(1,Math.min(21,_)):Math.max(0,Math.min(20,_)),E.toString=function(){return t+""},E}return{format:b,formatPrefix:function(t,e){var r=b(((t=o(t)).type="f",t)),i=3*Math.max(-8,Math.min(8,Math.floor(n(e)/3))),a=Math.pow(10,-i),u=h[8+i/3];return function(t){return r(a*t)+u}}}}function p(e){return s=d(e),t.format=s.format,t.formatPrefix=s.formatPrefix,s}p({decimal:".",thousands:",",grouping:[3],currency:["$",""],minus:"-"}),t.FormatSpecifier=a,t.formatDefaultLocale=p,t.formatLocale=d,t.formatSpecifier=o,t.precisionFixed=function(t){return Math.max(0,-n(Math.abs(t)))},t.precisionPrefix=function(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(n(e)/3)))-n(Math.abs(t)))},t.precisionRound=function(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,n(e)-n(t))+1},Object.defineProperty(t,"__esModule",{value:!0})},"object"==typeof n&&void 0!==e?i(n):"function"==typeof define&&define.amd?define(["exports"],i):i((r="undefined"!=typeof globalThis?globalThis:r||self).d3=r.d3||{})},{}],19:[function(t,e,n){var r,i;r=this,i=function(t,e){"use strict";function n(){return new r}function r(){this.reset()}r.prototype={constructor:r,reset:function(){this.s=this.t=0},add:function(t){o(i,t,this.t),o(this,i.s,this.s),this.s?this.t+=i.t:this.s=i.t},valueOf:function(){return this.s}};var i=new r;function o(t,e,n){var r=t.s=e+n,i=r-e,o=r-i;t.t=e-o+(n-i)}var a=1e-6,u=1e-12,f=Math.PI,c=f/2,s=f/4,l=2*f,h=180/f,d=f/180,p=Math.abs,g=Math.atan,v=Math.atan2,y=Math.cos,b=Math.ceil,m=Math.exp,_=Math.log,x=Math.pow,w=Math.sin,M=Math.sign||function(t){return t>0?1:t<0?-1:0},A=Math.sqrt,k=Math.tan;function C(t){return t>1?0:t<-1?f:Math.acos(t)}function E(t){return t>1?c:t<-1?-c:Math.asin(t)}function T(t){return(t=w(t/2))*t}function S(){}function O(t,e){t&&j.hasOwnProperty(t.type)&&j[t.type](t,e)}var N={Feature:function(t,e){O(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++r=0?1:-1,i=r*n,o=y(e=(e*=d)/2+s),a=w(e),u=U*a,f=L*o+u*y(i),c=u*r*w(i);I.add(v(c,f)),F=t,L=o,U=a}function G(t){return[v(t[1],t[0]),E(t[2])]}function X(t){var e=t[0],n=t[1],r=y(n);return[r*y(e),r*w(e),w(n)]}function Q(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Z(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function J(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function K(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function tt(t){var e=A(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}var et,nt,rt,it,ot,at,ut,ft,ct,st,lt,ht,dt,pt,gt,vt,yt,bt,mt,_t,xt,wt,Mt,At,kt,Ct,Et=n(),Tt={point:St,lineStart:Nt,lineEnd:jt,polygonStart:function(){Tt.point=Pt,Tt.lineStart=zt,Tt.lineEnd=Dt,Et.reset(),q.polygonStart()},polygonEnd:function(){q.polygonEnd(),Tt.point=St,Tt.lineStart=Nt,Tt.lineEnd=jt,I<0?(et=-(rt=180),nt=-(it=90)):Et>a?it=90:Et<-a&&(nt=-90),st[0]=et,st[1]=rt},sphere:function(){et=-(rt=180),nt=-(it=90)}};function St(t,e){ct.push(st=[et=t,rt=t]),eit&&(it=e)}function Ot(t,e){var n=X([t*d,e*d]);if(ft){var r=Z(ft,n),i=Z([r[1],-r[0],0],r);tt(i),i=G(i);var o,a=t-ot,u=a>0?1:-1,f=i[0]*h*u,c=p(a)>180;c^(u*otit&&(it=o):c^(u*ot<(f=(f+360)%360-180)&&fit&&(it=e)),c?tBt(et,rt)&&(rt=t):Bt(t,rt)>Bt(et,rt)&&(et=t):rt>=et?(trt&&(rt=t)):t>ot?Bt(et,t)>Bt(et,rt)&&(rt=t):Bt(t,rt)>Bt(et,rt)&&(et=t)}else ct.push(st=[et=t,rt=t]);eit&&(it=e),ft=n,ot=t}function Nt(){Tt.point=Ot}function jt(){st[0]=et,st[1]=rt,Tt.point=St,ft=null}function Pt(t,e){if(ft){var n=t-ot;Et.add(p(n)>180?n+(n>0?360:-360):n)}else at=t,ut=e;q.point(t,e),Ot(t,e)}function zt(){q.lineStart()}function Dt(){Pt(at,ut),q.lineEnd(),p(Et)>a&&(et=-(rt=180)),st[0]=et,st[1]=rt,ft=null}function Bt(t,e){return(e-=t)<0?e+360:e}function Rt(t,e){return t[0]-e[0]}function Ft(t,e){return t[0]<=t[1]?t[0]<=e&&e<=t[1]:ef?t+Math.round(-t/l)*l:t,e]}function Kt(t,e,n){return(t%=l)?e||n?Zt(ee(t),ne(e,n)):ee(t):e||n?ne(e,n):Jt}function te(t){return function(e,n){return[(e+=t)>f?e-l:e<-f?e+l:e,n]}}function ee(t){var e=te(t);return e.invert=te(-t),e}function ne(t,e){var n=y(t),r=w(t),i=y(e),o=w(e);function a(t,e){var a=y(e),u=y(t)*a,f=w(t)*a,c=w(e),s=c*n+u*r;return[v(f*i-s*o,u*n-c*r),E(s*i+f*o)]}return a.invert=function(t,e){var a=y(e),u=y(t)*a,f=w(t)*a,c=w(e),s=c*i-f*o;return[v(f*i+c*o,u*n+s*r),E(s*n-u*r)]},a}function re(t){function e(e){return(e=t(e[0]*d,e[1]*d))[0]*=h,e[1]*=h,e}return t=Kt(t[0]*d,t[1]*d,t.length>2?t[2]*d:0),e.invert=function(e){return(e=t.invert(e[0]*d,e[1]*d))[0]*=h,e[1]*=h,e},e}function ie(t,e,n,r,i,o){if(n){var a=y(e),u=w(e),f=r*n;null==i?(i=e+r*l,o=e-f/2):(i=oe(a,i),o=oe(a,o),(r>0?io)&&(i+=r*l));for(var c,s=i;r>0?s>o:s1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function ue(t,e){return p(t[0]-e[0])=0;--o)i.point((l=s[o])[0],l[1]);else r(d.x,d.p.x,-1,i);d=d.p}s=(d=d.o).z,p=!p}while(!d.v);i.lineEnd()}}}function se(t){if(e=t.length){for(var e,n,r=0,i=t[0];++r=0?1:-1,z=P*j,D=z>f,B=M*O;if(le.add(v(B*P*w(z),A*N+B*y(z))),u+=D?j+P*l:j,D^_>=n^T>=n){var R=Z(X(m),X(C));tt(R);var F=Z(o,R);tt(F);var L=(D^j>=0?-1:1)*E(F[2]);(r>L||r===L&&(R[0]||R[1]))&&(h+=D^j>=0?1:-1)}}return(u<-a||u0){for(h||(o.polygonStart(),h=!0),o.lineStart(),t=0;t1&&2&i&&c.push(c.pop().concat(c.shift())),u.push(c.filter(ge))}return d}}function ge(t){return t.length>1}function ve(t,e){return((t=t.x)[0]<0?t[1]-c-a:c-t[1])-((e=e.x)[0]<0?e[1]-c-a:c-e[1])}var ye=pe(function(){return!0},function(t){var e,n=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,u){var s=o>0?f:-f,l=p(o-n);p(l-f)0?c:-c),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(s,r),t.point(o,r),e=0):i!==s&&l>=f&&(p(n-i)a?g((w(e)*(o=y(r))*w(n)-w(r)*(i=y(e))*w(t))/(i*o*u)):(e+r)/2}(n,r,o,u),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(s,r),e=0),t.point(n=o,r=u),i=s},lineEnd:function(){t.lineEnd(),n=r=NaN},clean:function(){return 2-e}}},function(t,e,n,r){var i;if(null==t)i=n*c,r.point(-f,i),r.point(0,i),r.point(f,i),r.point(f,0),r.point(f,-i),r.point(0,-i),r.point(-f,-i),r.point(-f,0),r.point(-f,i);else if(p(t[0]-e[0])>a){var o=t[0]0,i=p(e)>a;function o(t,n){return y(t)*y(n)>e}function u(t,n,r){var i=[1,0,0],o=Z(X(t),X(n)),u=Q(o,o),c=o[0],s=u-c*c;if(!s)return!r&&t;var l=e*u/s,h=-e*c/s,d=Z(i,o),g=K(i,l);J(g,K(o,h));var v=d,y=Q(g,v),b=Q(v,v),m=y*y-b*(Q(g,g)-1);if(!(m<0)){var _=A(m),x=K(v,(-y-_)/b);if(J(x,g),x=G(x),!r)return x;var w,M=t[0],k=n[0],C=t[1],E=n[1];k0^x[1]<(p(x[0]-M)f^(M<=x[0]&&x[0]<=k)){var O=K(v,(-y+_)/b);return J(O,g),[x,G(O)]}}}function c(e,n){var i=r?t:f-t,o=0;return e<-i?o|=1:e>i&&(o|=2),n<-i?o|=4:n>i&&(o|=8),o}return pe(o,function(t){var e,n,a,s,l;return{lineStart:function(){s=a=!1,l=1},point:function(h,d){var p,g=[h,d],v=o(h,d),y=r?v?0:c(h,d):v?c(h+(h<0?f:-f),d):0;if(!e&&(s=a=v)&&t.lineStart(),v!==a&&(!(p=u(e,g))||ue(e,p)||ue(g,p))&&(g[2]=1),v!==a)l=0,v?(t.lineStart(),p=u(g,e),t.point(p[0],p[1])):(p=u(e,g),t.point(p[0],p[1],2),t.lineEnd()),e=p;else if(i&&e&&r^v){var b;y&n||!(b=u(g,e,!0))||(l=0,r?(t.lineStart(),t.point(b[0][0],b[0][1]),t.point(b[1][0],b[1][1]),t.lineEnd()):(t.point(b[1][0],b[1][1]),t.lineEnd(),t.lineStart(),t.point(b[0][0],b[0][1],3)))}!v||e&&ue(e,g)||t.point(g[0],g[1]),e=g,a=v,n=y},lineEnd:function(){a&&t.lineEnd(),e=null},clean:function(){return l|(s&&a)<<1}}},function(e,r,i,o){ie(o,t,n,i,e,r)},r?[0,-t]:[-f,t-f])}var me=1e9,_e=-me;function xe(t,n,r,i){function o(e,o){return t<=e&&e<=r&&n<=o&&o<=i}function u(e,o,a,u){var c=0,l=0;if(null==e||(c=f(e,a))!==(l=f(o,a))||s(e,o)<0^a>0)do{u.point(0===c||3===c?t:r,c>1?i:n)}while((c=(c+a+4)%4)!==l);else u.point(o[0],o[1])}function f(e,i){return p(e[0]-t)0?0:3:p(e[0]-r)0?2:1:p(e[1]-n)0?1:0:i>0?3:2}function c(t,e){return s(t.x,e.x)}function s(t,e){var n=f(t,1),r=f(e,1);return n!==r?n-r:0===n?e[1]-t[1]:1===n?t[0]-e[0]:2===n?t[1]-e[1]:e[0]-t[0]}return function(a){var f,s,l,h,d,p,g,v,y,b,m,_=a,x=ae(),w={point:M,lineStart:function(){w.point=A,s&&s.push(l=[]);b=!0,y=!1,g=v=NaN},lineEnd:function(){f&&(A(h,d),p&&y&&x.rejoin(),f.push(x.result()));w.point=M,y&&_.lineEnd()},polygonStart:function(){_=x,f=[],s=[],m=!0},polygonEnd:function(){var n=function(){for(var e=0,n=0,r=s.length;ni&&(h-o)*(i-a)>(d-a)*(t-o)&&++e:d<=i&&(h-o)*(i-a)<(d-a)*(t-o)&&--e;return e}(),r=m&&n,o=(f=e.merge(f)).length;(r||o)&&(a.polygonStart(),r&&(a.lineStart(),u(null,null,1,a),a.lineEnd()),o&&ce(f,c,n,u,a),a.polygonEnd());_=a,f=s=l=null}};function M(t,e){o(t,e)&&_.point(t,e)}function A(e,a){var u=o(e,a);if(s&&l.push([e,a]),b)h=e,d=a,p=u,b=!1,u&&(_.lineStart(),_.point(e,a));else if(u&&y)_.point(e,a);else{var f=[g=Math.max(_e,Math.min(me,g)),v=Math.max(_e,Math.min(me,v))],c=[e=Math.max(_e,Math.min(me,e)),a=Math.max(_e,Math.min(me,a))];!function(t,e,n,r,i,o){var a,u=t[0],f=t[1],c=0,s=1,l=e[0]-u,h=e[1]-f;if(a=n-u,l||!(a>0)){if(a/=l,l<0){if(a0){if(a>s)return;a>c&&(c=a)}if(a=i-u,l||!(a<0)){if(a/=l,l<0){if(a>s)return;a>c&&(c=a)}else if(l>0){if(a0)){if(a/=h,h<0){if(a0){if(a>s)return;a>c&&(c=a)}if(a=o-f,h||!(a<0)){if(a/=h,h<0){if(a>s)return;a>c&&(c=a)}else if(h>0){if(a0&&(t[0]=u+c*l,t[1]=f+c*h),s<1&&(e[0]=u+s*l,e[1]=f+s*h),!0}}}}}(f,c,t,n,r,i)?u&&(_.lineStart(),_.point(e,a),m=!1):(y||(_.lineStart(),_.point(f[0],f[1])),_.point(c[0],c[1]),u||_.lineEnd(),m=!1)}g=e,v=a,y=u}return w}}var we,Me,Ae,ke=n(),Ce={sphere:S,point:S,lineStart:function(){Ce.point=Te,Ce.lineEnd=Ee},lineEnd:S,polygonStart:S,polygonEnd:S};function Ee(){Ce.point=Ce.lineEnd=S}function Te(t,e){we=t*=d,Me=w(e*=d),Ae=y(e),Ce.point=Se}function Se(t,e){t*=d;var n=w(e*=d),r=y(e),i=p(t-we),o=y(i),a=r*w(i),u=Ae*n-Me*r*o,f=Me*n+Ae*r*o;ke.add(v(A(a*a+u*u),f)),we=t,Me=n,Ae=r}function Oe(t){return ke.reset(),D(t,Ce),+ke}var Ne=[null,null],je={type:"LineString",coordinates:Ne};function Pe(t,e){return Ne[0]=t,Ne[1]=e,Oe(je)}var ze={Feature:function(t,e){return Be(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++r0&&(i=Pe(t[o],t[o-1]))>0&&n<=i&&r<=i&&(n+r-i)*(1-Math.pow((n-r)/i,2))a}).map(s)).concat(e.range(b(u/v)*v,o,v).filter(function(t){return p(t%m)>a}).map(l))}return x.lines=function(){return w().map(function(t){return{type:"LineString",coordinates:t}})},x.outline=function(){return{type:"Polygon",coordinates:[h(i).concat(d(f).slice(1),h(r).reverse().slice(1),d(c).reverse().slice(1))]}},x.extent=function(t){return arguments.length?x.extentMajor(t).extentMinor(t):x.extentMinor()},x.extentMajor=function(t){return arguments.length?(i=+t[0][0],r=+t[1][0],c=+t[0][1],f=+t[1][1],i>r&&(t=i,i=r,r=t),c>f&&(t=c,c=f,f=t),x.precision(_)):[[i,c],[r,f]]},x.extentMinor=function(e){return arguments.length?(n=+e[0][0],t=+e[1][0],u=+e[0][1],o=+e[1][1],n>t&&(e=n,n=t,t=e),u>o&&(e=u,u=o,o=e),x.precision(_)):[[n,u],[t,o]]},x.step=function(t){return arguments.length?x.stepMajor(t).stepMinor(t):x.stepMinor()},x.stepMajor=function(t){return arguments.length?(y=+t[0],m=+t[1],x):[y,m]},x.stepMinor=function(t){return arguments.length?(g=+t[0],v=+t[1],x):[g,v]},x.precision=function(e){return arguments.length?(_=+e,s=He(u,o,90),l=qe(n,t,_),h=He(c,f,90),d=qe(i,r,_),x):_},x.extentMajor([[-180,-90+a],[180,90-a]]).extentMinor([[-180,-80-a],[180,80+a]])}function Ye(t){return t}var We,$e,Ge,Xe,Qe=n(),Ze=n(),Je={point:S,lineStart:S,lineEnd:S,polygonStart:function(){Je.lineStart=Ke,Je.lineEnd=nn},polygonEnd:function(){Je.lineStart=Je.lineEnd=Je.point=S,Qe.add(p(Ze)),Ze.reset()},result:function(){var t=Qe/2;return Qe.reset(),t}};function Ke(){Je.point=tn}function tn(t,e){Je.point=en,We=Ge=t,$e=Xe=e}function en(t,e){Ze.add(Xe*t-Ge*e),Ge=t,Xe=e}function nn(){en(We,$e)}var rn,on,an,un,fn=1/0,cn=fn,sn=-fn,ln=sn,hn={point:function(t,e){tsn&&(sn=t);eln&&(ln=e)},lineStart:S,lineEnd:S,polygonStart:S,polygonEnd:S,result:function(){var t=[[fn,cn],[sn,ln]];return sn=ln=-(cn=fn=1/0),t}},dn=0,pn=0,gn=0,vn=0,yn=0,bn=0,mn=0,_n=0,xn=0,wn={point:Mn,lineStart:An,lineEnd:En,polygonStart:function(){wn.lineStart=Tn,wn.lineEnd=Sn},polygonEnd:function(){wn.point=Mn,wn.lineStart=An,wn.lineEnd=En},result:function(){var t=xn?[mn/xn,_n/xn]:bn?[vn/bn,yn/bn]:gn?[dn/gn,pn/gn]:[NaN,NaN];return dn=pn=gn=vn=yn=bn=mn=_n=xn=0,t}};function Mn(t,e){dn+=t,pn+=e,++gn}function An(){wn.point=kn}function kn(t,e){wn.point=Cn,Mn(an=t,un=e)}function Cn(t,e){var n=t-an,r=e-un,i=A(n*n+r*r);vn+=i*(an+t)/2,yn+=i*(un+e)/2,bn+=i,Mn(an=t,un=e)}function En(){wn.point=Mn}function Tn(){wn.point=On}function Sn(){Nn(rn,on)}function On(t,e){wn.point=Nn,Mn(rn=an=t,on=un=e)}function Nn(t,e){var n=t-an,r=e-un,i=A(n*n+r*r);vn+=i*(an+t)/2,yn+=i*(un+e)/2,bn+=i,mn+=(i=un*t-an*e)*(an+t),_n+=i*(un+e),xn+=3*i,Mn(an=t,un=e)}function jn(t){this._context=t}jn.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,l)}},result:S};var Pn,zn,Dn,Bn,Rn,Fn=n(),Ln={point:S,lineStart:function(){Ln.point=Un},lineEnd:function(){Pn&&In(zn,Dn),Ln.point=S},polygonStart:function(){Pn=!0},polygonEnd:function(){Pn=null},result:function(){var t=+Fn;return Fn.reset(),t}};function Un(t,e){Ln.point=In,zn=Bn=t,Dn=Rn=e}function In(t,e){Bn-=t,Rn-=e,Fn.add(A(Bn*Bn+Rn*Rn)),Bn=t,Rn=e}function Hn(){this._string=[]}function qn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Vn(t){return function(e){var n=new Yn;for(var r in t)n[r]=t[r];return n.stream=e,n}}function Yn(){}function Wn(t,e,n){var r=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=r&&t.clipExtent(null),D(n,t.stream(hn)),e(hn.result()),null!=r&&t.clipExtent(r),t}function $n(t,e,n){return Wn(t,function(n){var r=e[1][0]-e[0][0],i=e[1][1]-e[0][1],o=Math.min(r/(n[1][0]-n[0][0]),i/(n[1][1]-n[0][1])),a=+e[0][0]+(r-o*(n[1][0]+n[0][0]))/2,u=+e[0][1]+(i-o*(n[1][1]+n[0][1]))/2;t.scale(150*o).translate([a,u])},n)}function Gn(t,e,n){return $n(t,[[0,0],e],n)}function Xn(t,e,n){return Wn(t,function(n){var r=+e,i=r/(n[1][0]-n[0][0]),o=(r-i*(n[1][0]+n[0][0]))/2,a=-i*n[0][1];t.scale(150*i).translate([o,a])},n)}function Qn(t,e,n){return Wn(t,function(n){var r=+e,i=r/(n[1][1]-n[0][1]),o=-i*n[0][0],a=(r-i*(n[1][1]+n[0][1]))/2;t.scale(150*i).translate([o,a])},n)}Hn.prototype={_radius:4.5,_circle:qn(4.5),pointRadius:function(t){return(t=+t)!==this._radius&&(this._radius=t,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._string.push("M",t,",",e),this._point=1;break;case 1:this._string.push("L",t,",",e);break;default:null==this._circle&&(this._circle=qn(this._radius)),this._string.push("M",t,",",e,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}},Yn.prototype={constructor:Yn,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var Zn=16,Jn=y(30*d);function Kn(t,e){return+e?function(t,e){function n(r,i,o,u,f,c,s,l,h,d,g,y,b,m){var _=s-r,x=l-i,w=_*_+x*x;if(w>4*e&&b--){var M=u+d,k=f+g,C=c+y,T=A(M*M+k*k+C*C),S=E(C/=T),O=p(p(C)-1)e||p((_*z+x*D)/w-.5)>.3||u*d+f*g+c*y2?t[2]%360*d:0,j()):[b*h,m*h,_*h]},O.angle=function(t){return arguments.length?(x=t%360*d,j()):x*h},O.reflectX=function(t){return arguments.length?(w=t?-1:1,j()):w<0},O.reflectY=function(t){return arguments.length?(M=t?-1:1,j()):M<0},O.precision=function(t){return arguments.length?(a=Kn(u,S=t*t),P()):A(S)},O.fitExtent=function(t,e){return $n(O,t,e)},O.fitSize=function(t,e){return Gn(O,t,e)},O.fitWidth=function(t,e){return Xn(O,t,e)},O.fitHeight=function(t,e){return Qn(O,t,e)},function(){return e=t.apply(this,arguments),O.invert=e.invert&&N,j()}}function ir(t){var e=0,n=f/3,r=rr(t),i=r(e,n);return i.parallels=function(t){return arguments.length?r(e=t[0]*d,n=t[1]*d):[e*h,n*h]},i}function or(t,e){var n=w(t),r=(n+w(e))/2;if(p(r)0?e<-c+a&&(e=-c+a):e>c-a&&(e=c-a);var n=i/x(pr(e),r);return[n*w(r*t),i-n*y(r*t)]}return o.invert=function(t,e){var n=i-e,o=M(r)*A(t*t+n*n),a=v(t,p(n))*M(n);return n*r<0&&(a-=f*M(t)*M(n)),[a/r,2*g(x(i/o,1/r))-c]},o}function vr(t,e){return[t,e]}function yr(t,e){var n=y(t),r=t===e?w(t):(n-y(e))/(e-t),i=n/r+t;if(p(r)a&&--i>0);return[t/(.8707+(o=r*r)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979)),r]},Cr.invert=cr(E),Er.invert=cr(function(t){return 2*g(t)}),Tr.invert=function(t,e){return[-e,2*g(m(t))-c]},t.geoAlbers=ur,t.geoAlbersUsa=function(){var t,e,n,r,i,o,u=ur(),f=ar().rotate([154,0]).center([-2,58.5]).parallels([55,65]),c=ar().rotate([157,0]).center([-3,19.9]).parallels([8,18]),s={point:function(t,e){o=[t,e]}};function l(t){var e=t[0],a=t[1];return o=null,n.point(e,a),o||(r.point(e,a),o)||(i.point(e,a),o)}function h(){return t=e=null,l}return l.invert=function(t){var e=u.scale(),n=u.translate(),r=(t[0]-n[0])/e,i=(t[1]-n[1])/e;return(i>=.12&&i<.234&&r>=-.425&&r<-.214?f:i>=.166&&i<.234&&r>=-.214&&r<-.115?c:u).invert(t)},l.stream=function(n){return t&&e===n?t:(r=[u.stream(e=n),f.stream(n),c.stream(n)],i=r.length,t={point:function(t,e){for(var n=-1;++nBt(r[0],r[1])&&(r[1]=i[1]),Bt(i[0],r[1])>Bt(r[0],r[1])&&(r[0]=i[0])):o.push(r=i);for(a=-1/0,e=0,r=o[n=o.length-1];e<=n;r=i,++e)i=o[e],(u=Bt(r[1],i[0]))>a&&(a=u,et=i[0],rt=r[1])}return ct=st=null,et===1/0||nt===1/0?[[NaN,NaN],[NaN,NaN]]:[[et,nt],[rt,it]]},t.geoCentroid=function(t){lt=ht=dt=pt=gt=vt=yt=bt=mt=_t=xt=0,D(t,Lt);var e=mt,n=_t,r=xt,i=e*e+n*n+r*r;return i2?t[2]+90:90]):[(t=n())[0],t[1],t[2]-90]},n([0,0,90]).scale(159.155)},t.geoTransverseMercatorRaw=Tr,Object.defineProperty(t,"__esModule",{value:!0})},"object"==typeof n&&void 0!==e?i(n,t("d3-array")):"function"==typeof define&&define.amd?define(["exports","d3-array"],i):i((r=r||self).d3=r.d3||{},r.d3)},{"d3-array":5}],20:[function(t,e,n){var r,i;r=this,i=function(t){"use strict";function e(t,e){return t.parent===e.parent?1:2}function n(t,e){return t+e.x}function r(t,e){return Math.max(t,e.y)}function i(t){var e=0,n=t.children,r=n&&n.length;if(r)for(;--r>=0;)e+=n[r].value;else e=1;t.value=e}function o(t,e){var n,r,i,o,u,s=new c(t),l=+t.value&&(s.value=t.value),h=[s];for(null==e&&(e=a);n=h.pop();)if(l&&(n.value=+n.data.value),(i=e(n.data))&&(u=i.length))for(n.children=new Array(u),o=u-1;o>=0;--o)h.push(r=n.children[o]=new c(i[o])),r.parent=n,r.depth=n.depth+1;return s.eachBefore(f)}function a(t){return t.children}function u(t){t.data=t.data.data}function f(t){var e=0;do{t.height=e}while((t=t.parent)&&t.height<++e)}function c(t){this.data=t,this.depth=this.height=0,this.parent=null}c.prototype=o.prototype={constructor:c,count:function(){return this.eachAfter(i)},each:function(t){var e,n,r,i,o=this,a=[o];do{for(e=a.reverse(),a=[];o=e.pop();)if(t(o),n=o.children)for(r=0,i=n.length;r=0;--n)i.push(e[n]);return this},sum:function(t){return this.eachAfter(function(e){for(var n=+t(e.data)||0,r=e.children,i=r&&r.length;--i>=0;)n+=r[i].value;e.value=n})},sort:function(t){return this.eachBefore(function(e){e.children&&e.children.sort(t)})},path:function(t){for(var e=this,n=function(t,e){if(t===e)return t;var n=t.ancestors(),r=e.ancestors(),i=null;for(t=n.pop(),e=r.pop();t===e;)i=t,t=n.pop(),e=r.pop();return i}(e,t),r=[e];e!==n;)e=e.parent,r.push(e);for(var i=r.length;t!==n;)r.splice(i,0,t),t=t.parent;return r},ancestors:function(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e},descendants:function(){var t=[];return this.each(function(e){t.push(e)}),t},leaves:function(){var t=[];return this.eachBefore(function(e){e.children||t.push(e)}),t},links:function(){var t=this,e=[];return t.each(function(n){n!==t&&e.push({source:n.parent,target:n})}),e},copy:function(){return o(this).eachBefore(u)}};var s=Array.prototype.slice;function l(t){for(var e,n,r=0,i=(t=function(t){for(var e,n,r=t.length;r;)n=Math.random()*r--|0,e=t[r],t[r]=t[n],t[n]=e;return t}(s.call(t))).length,o=[];r0&&n*n>r*r+i*i}function g(t,e){for(var n=0;n(a*=a)?(r=(c+a-i)/(2*c),o=Math.sqrt(Math.max(0,a/c-r*r)),n.x=t.x-r*u-o*f,n.y=t.y-r*f+o*u):(r=(c+i-a)/(2*c),o=Math.sqrt(Math.max(0,i/c-r*r)),n.x=e.x+r*u-o*f,n.y=e.y+r*f+o*u)):(n.x=e.x+n.r,n.y=e.y)}function _(t,e){var n=t.r+e.r-1e-6,r=e.x-t.x,i=e.y-t.y;return n>0&&n*n>r*r+i*i}function x(t){var e=t._,n=t.next._,r=e.r+n.r,i=(e.x*n.r+n.x*e.r)/r,o=(e.y*n.r+n.y*e.r)/r;return i*i+o*o}function w(t){this._=t,this.next=null,this.previous=null}function M(t){if(!(i=t.length))return 0;var e,n,r,i,o,a,u,f,c,s,h;if((e=t[0]).x=0,e.y=0,!(i>1))return e.r;if(n=t[1],e.x=-n.r,n.x=e.r,n.y=0,!(i>2))return e.r+n.r;m(n,e,r=t[2]),e=new w(e),n=new w(n),r=new w(r),e.next=r.previous=n,n.next=e.previous=r,r.next=n.previous=e;t:for(u=3;uh&&(h=u),v=s*s*g,(d=Math.max(h/v,v/l))>p){s-=u;break}p=d}y.push(a={value:s,dice:f1?e:1)},n}(Y),G=function t(e){function n(t,n,r,i,o){if((a=t._squarify)&&a.ratio===e)for(var a,u,f,c,s,l=-1,h=a.length,d=t.value;++l1?e:1)},n}(Y);t.cluster=function(){var t=e,i=1,o=1,a=!1;function u(e){var u,f=0;e.eachAfter(function(e){var i=e.children;i?(e.x=function(t){return t.reduce(n,0)/t.length}(i),e.y=function(t){return 1+t.reduce(r,0)}(i)):(e.x=u?f+=t(e,u):0,e.y=0,u=e)});var c=function(t){for(var e;e=t.children;)t=e[0];return t}(e),s=function(t){for(var e;e=t.children;)t=e[e.length-1];return t}(e),l=c.x-t(c,s)/2,h=s.x+t(s,c)/2;return e.eachAfter(a?function(t){t.x=(t.x-e.x)*i,t.y=(e.y-t.y)*o}:function(t){t.x=(t.x-l)/(h-l)*i,t.y=(1-(e.y?t.y/e.y:1))*o})}return u.separation=function(e){return arguments.length?(t=e,u):t},u.size=function(t){return arguments.length?(a=!1,i=+t[0],o=+t[1],u):a?null:[i,o]},u.nodeSize=function(t){return arguments.length?(a=!0,i=+t[0],o=+t[1],u):a?[i,o]:null},u},t.hierarchy=o,t.pack=function(){var t=null,e=1,n=1,r=k;function i(i){return i.x=e/2,i.y=n/2,t?i.eachBefore(T(t)).eachAfter(S(r,.5)).eachBefore(O(1)):i.eachBefore(T(E)).eachAfter(S(k,1)).eachAfter(S(r,i.r/Math.min(e,n))).eachBefore(O(Math.min(e,n)/(2*i.r))),i}return i.radius=function(e){return arguments.length?(t=null==(n=e)?null:A(n),i):t;var n},i.size=function(t){return arguments.length?(e=+t[0],n=+t[1],i):[e,n]},i.padding=function(t){return arguments.length?(r="function"==typeof t?t:C(+t),i):r},i},t.packEnclose=l,t.packSiblings=function(t){return M(t),t},t.partition=function(){var t=1,e=1,n=0,r=!1;function i(i){var o=i.height+1;return i.x0=i.y0=n,i.x1=t,i.y1=e/o,i.eachBefore(function(t,e){return function(r){r.children&&j(r,r.x0,t*(r.depth+1)/e,r.x1,t*(r.depth+2)/e);var i=r.x0,o=r.y0,a=r.x1-n,u=r.y1-n;a0)throw new Error("cycle");return o}return n.id=function(e){return arguments.length?(t=A(e),n):t},n.parentId=function(t){return arguments.length?(e=A(t),n):e},n},t.tree=function(){var t=F,e=1,n=1,r=null;function i(i){var f=function(t){for(var e,n,r,i,o,a=new q(t,0),u=[a];e=u.pop();)if(r=e._.children)for(e.children=new Array(o=r.length),i=o-1;i>=0;--i)u.push(n=e.children[i]=new q(r[i],i)),n.parent=e;return(a.parent=new q(null,0)).children=[a],a}(i);if(f.eachAfter(o),f.parent.m=-f.z,f.eachBefore(a),r)i.eachBefore(u);else{var c=i,s=i,l=i;i.eachBefore(function(t){t.xs.x&&(s=t),t.depth>l.depth&&(l=t)});var h=c===s?1:t(c,s)/2,d=h-c.x,p=e/(s.x+h+d),g=n/(l.depth||1);i.eachBefore(function(t){t.x=(t.x+d)*p,t.y=t.depth*g})}return i}function o(e){var n=e.children,r=e.parent.children,i=e.i?r[e.i-1]:null;if(n){!function(t){for(var e,n=0,r=0,i=t.children,o=i.length;--o>=0;)(e=i[o]).z+=n,e.m+=n,n+=e.s+(r+=e.c)}(e);var o=(n[0].z+n[n.length-1].z)/2;i?(e.z=i.z+t(e._,i._),e.m=e.z-o):e.z=o}else i&&(e.z=i.z+t(e._,i._));e.parent.A=function(e,n,r){if(n){for(var i,o=e,a=e,u=n,f=o.parent.children[0],c=o.m,s=a.m,l=u.m,h=f.m;u=U(u),o=L(o),u&&o;)f=L(f),(a=U(a)).a=e,(i=u.z+l-o.z-c+t(u._,o._))>0&&(I(H(u,e,r),e,i),c+=i,s+=i),l+=u.m,c+=o.m,h+=f.m,s+=a.m;u&&!U(a)&&(a.t=u,a.m+=l-s),o&&!L(f)&&(f.t=o,f.m+=c-h,r=e)}return r}(e,i,e.parent.A||r[0])}function a(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function u(t){t.x*=e,t.y=t.depth*n}return i.separation=function(e){return arguments.length?(t=e,i):t},i.size=function(t){return arguments.length?(r=!1,e=+t[0],n=+t[1],i):r?null:[e,n]},i.nodeSize=function(t){return arguments.length?(r=!0,e=+t[0],n=+t[1],i):r?[e,n]:null},i},t.treemap=function(){var t=$,e=!1,n=1,r=1,i=[0],o=k,a=k,u=k,f=k,c=k;function s(t){return t.x0=t.y0=0,t.x1=n,t.y1=r,t.eachBefore(l),i=[0],e&&t.eachBefore(N),t}function l(e){var n=i[e.depth],r=e.x0+n,s=e.y0+n,l=e.x1-n,h=e.y1-n;l=n-1){var s=u[e];return s.x0=i,s.y0=o,s.x1=a,void(s.y1=f)}for(var l=c[e],h=r/2+l,d=e+1,p=n-1;d>>1;c[g]f-o){var b=(i*y+a*v)/r;t(e,d,v,i,o,b,f),t(d,n,y,b,o,a,f)}else{var m=(o*y+f*v)/r;t(e,d,v,i,o,a,m),t(d,n,y,i,m,a,f)}}(0,f,t.value,e,n,r,i)},t.treemapDice=j,t.treemapResquarify=G,t.treemapSlice=V,t.treemapSliceDice=function(t,e,n,r,i){(1&t.depth?V:j)(t,e,n,r,i)},t.treemapSquarify=$,Object.defineProperty(t,"__esModule",{value:!0})},"object"==typeof n&&void 0!==e?i(n):"function"==typeof define&&define.amd?define(["exports"],i):i((r=r||self).d3=r.d3||{})},{}],21:[function(t,e,n){var r,i;r=this,i=function(t,e){"use strict";function n(t,e,n,r,i){var o=t*t,a=o*t;return((1-3*t+3*o-a)*e+(4-6*o+3*a)*n+(1+3*t+3*o-3*a)*r+a*i)/6}function r(t){var e=t.length-1;return function(r){var i=r<=0?r=0:r>=1?(r=1,e-1):Math.floor(r*e),o=t[i],a=t[i+1],u=i>0?t[i-1]:2*o-a,f=i180||n<-180?n-360*Math.round(n/360):n):o(isNaN(t)?e:t)}function f(t){return 1==(t=+t)?c:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}(e,n,t):o(isNaN(e)?n:e)}}function c(t,e){var n=e-t;return n?a(t,n):o(isNaN(t)?e:t)}var s=function t(n){var r=f(n);function i(t,n){var i=r((t=e.rgb(t)).r,(n=e.rgb(n)).r),o=r(t.g,n.g),a=r(t.b,n.b),u=c(t.opacity,n.opacity);return function(e){return t.r=i(e),t.g=o(e),t.b=a(e),t.opacity=u(e),t+""}}return i.gamma=t,i}(1);function l(t){return function(n){var r,i,o=n.length,a=new Array(o),u=new Array(o),f=new Array(o);for(r=0;ro&&(i=e.slice(o,i),u[a]?u[a]+=i:u[++a]=i),(n=n[0])===(r=r[0])?u[a]?u[a]+=r:u[++a]=r:(u[++a]=null,f.push({i:a,x:b(n,r)})),o=x.lastIndex;return o180?e+=360:e-t>180&&(t+=360),o.push({i:n.push(i(n)+"rotate(",null,r)-2,x:b(t,e)})):e&&n.push(i(n)+"rotate("+e+r)}(o.rotate,a.rotate,u,f),function(t,e,n,o){t!==e?o.push({i:n.push(i(n)+"skewX(",null,r)-2,x:b(t,e)}):e&&n.push(i(n)+"skewX("+e+r)}(o.skewX,a.skewX,u,f),function(t,e,n,r,o,a){if(t!==n||e!==r){var u=o.push(i(o)+"scale(",null,",",null,")");a.push({i:u-4,x:b(t,n)},{i:u-2,x:b(e,r)})}else 1===n&&1===r||o.push(i(o)+"scale("+n+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,u,f),o=a=null,function(t){for(var e,n=-1,r=f.length;++n1e-6)if(Math.abs(l*f-c*s)>1e-6&&o){var d=r-a,p=i-u,g=f*f+c*c,v=d*d+p*p,y=Math.sqrt(g),b=Math.sqrt(h),m=o*Math.tan((e-Math.acos((g+h-v)/(2*y*b)))/2),_=m/b,x=m/y;Math.abs(_-1)>1e-6&&(this._+="L"+(t+_*s)+","+(n+_*l)),this._+="A"+o+","+o+",0,0,"+ +(l*d>s*p)+","+(this._x1=t+x*f)+","+(this._y1=n+x*c)}else this._+="L"+(this._x1=t)+","+(this._y1=n);else;},arc:function(t,i,o,a,u,f){t=+t,i=+i,f=!!f;var c=(o=+o)*Math.cos(a),s=o*Math.sin(a),l=t+c,h=i+s,d=1^f,p=f?a-u:u-a;if(o<0)throw new Error("negative radius: "+o);null===this._x1?this._+="M"+l+","+h:(Math.abs(this._x1-l)>1e-6||Math.abs(this._y1-h)>1e-6)&&(this._+="L"+l+","+h),o&&(p<0&&(p=p%n+n),p>r?this._+="A"+o+","+o+",0,1,"+d+","+(t-c)+","+(i-s)+"A"+o+","+o+",0,1,"+d+","+(this._x1=l)+","+(this._y1=h):p>1e-6&&(this._+="A"+o+","+o+",0,"+ +(p>=e)+","+d+","+(this._x1=t+o*Math.cos(u))+","+(this._y1=i+o*Math.sin(u))))},rect:function(t,e,n,r){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +n+"v"+ +r+"h"+-n+"Z"},toString:function(){return this._}},t.path=o,Object.defineProperty(t,"__esModule",{value:!0})},"object"==typeof n&&void 0!==e?i(n):"function"==typeof define&&define.amd?define(["exports"],i):i((r=r||self).d3=r.d3||{})},{}],23:[function(t,e,n){var r,i;r=this,i=function(t){"use strict";function e(t,e){return t[0]-e[0]||t[1]-e[1]}function n(t){for(var e,n,r,i=t.length,o=[0,1],a=2,u=2;u1&&(e=t[o[a-2]],n=t[o[a-1]],r=t[u],(n[0]-e[0])*(r[1]-e[1])-(n[1]-e[1])*(r[0]-e[0])<=0);)--a;o[a++]=u}return o.slice(0,a)}t.polygonArea=function(t){for(var e,n=-1,r=t.length,i=t[r-1],o=0;++nu!=c>u&&a<(f-n)*(u-r)/(c-r)+n&&(s=!s),f=n,c=r;return s},t.polygonHull=function(t){if((i=t.length)<3)return null;var r,i,o=new Array(i),a=new Array(i);for(r=0;r=0;--r)l.push(t[o[u[r]][2]]);for(r=+c;r=(o=(g+y)/2))?g=o:y=o,(s=n>=(a=(v+b)/2))?v=a:b=a,i=d,!(d=d[l=s<<1|c]))return i[l]=p,t;if(u=+t._x.call(null,d.data),f=+t._y.call(null,d.data),e===u&&n===f)return p.next=d,i?i[l]=p:t._root=p,t;do{i=i?i[l]=new Array(4):t._root=new Array(4),(c=e>=(o=(g+y)/2))?g=o:y=o,(s=n>=(a=(v+b)/2))?v=a:b=a}while((l=s<<1|c)==(h=(f>=a)<<1|u>=o));return i[h]=d,i[l]=p,t}function n(t,e,n,r,i){this.node=t,this.x0=e,this.y0=n,this.x1=r,this.y1=i}function r(t){return t[0]}function i(t){return t[1]}function o(t,e,n){var o=new a(null==e?r:e,null==n?i:n,NaN,NaN,NaN,NaN);return null==t?o:o.addAll(t)}function a(t,e,n,r,i,o){this._x=t,this._y=e,this._x0=n,this._y0=r,this._x1=i,this._y1=o,this._root=void 0}function u(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var f=o.prototype=a.prototype;f.copy=function(){var t,e,n=new a(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return n;if(!r.length)return n._root=u(r),n;for(t=[{source:r,target:n._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(e=r.source[i])&&(e.length?t.push({source:e,target:r.target[i]=new Array(4)}):r.target[i]=u(e));return n},f.add=function(t){var n=+this._x.call(null,t),r=+this._y.call(null,t);return e(this.cover(n,r),n,r,t)},f.addAll=function(t){var n,r,i,o,a=t.length,u=new Array(a),f=new Array(a),c=1/0,s=1/0,l=-1/0,h=-1/0;for(r=0;rl&&(l=i),oh&&(h=o));if(c>l||s>h)return this;for(this.cover(c,s).cover(l,h),r=0;rt||t>=i||r>e||e>=o;)switch(u=(ed||(a=c.y0)>p||(u=c.x1)=b)<<1|t>=y)&&(c=g[g.length-1],g[g.length-1]=g[g.length-1-s],g[g.length-1-s]=c)}else{var m=t-+this._x.call(null,v.data),_=e-+this._y.call(null,v.data),x=m*m+_*_;if(x=(u=(p+v)/2))?p=u:v=u,(s=a>=(f=(g+y)/2))?g=f:y=f,e=d,!(d=d[l=s<<1|c]))return this;if(!d.length)break;(e[l+1&3]||e[l+2&3]||e[l+3&3])&&(n=e,h=l)}for(;d.data!==t;)if(r=d,!(d=d.next))return this;return(i=d.next)&&delete d.next,r?(i?r.next=i:delete r.next,this):e?(i?e[l]=i:delete e[l],(d=e[0]||e[1]||e[2]||e[3])&&d===(e[3]||e[2]||e[1]||e[0])&&!d.length&&(n?n[h]=d:this._root=d),this):(this._root=i,this)},f.removeAll=function(t){for(var e=0,n=t.length;e1);return t+n*o*Math.sqrt(-2*Math.log(i)/i)}}return n.source=t,n}(e),i=function t(e){function n(){var t=r.source(e).apply(this,arguments);return function(){return Math.exp(t())}}return n.source=t,n}(e),o=function t(e){function n(t){return function(){for(var n=0,r=0;r1)&&(t-=Math.floor(t));var e=Math.abs(t-.5);return bt.h=360*t-100,bt.s=1.5-1.5*e,bt.l=.8-.9*e,bt+""},t.interpolateRdBu=A,t.interpolateRdGy=C,t.interpolateRdPu=G,t.interpolateRdYlBu=T,t.interpolateRdYlGn=O,t.interpolateReds=ht,t.interpolateSinebow=function(t){var e;return t=(.5-t)*Math.PI,mt.r=255*(e=Math.sin(t))*e,mt.g=255*(e=Math.sin(t+_t))*e,mt.b=255*(e=Math.sin(t+xt))*e,mt+""},t.interpolateSpectral=j,t.interpolateTurbo=function(t){return t=Math.max(0,Math.min(1,t)),"rgb("+Math.max(0,Math.min(255,Math.round(34.61+t*(1172.33-t*(10793.56-t*(33300.12-t*(38394.49-14825.05*t)))))))+", "+Math.max(0,Math.min(255,Math.round(23.31+t*(557.33+t*(1225.33-t*(3574.96-t*(1073.77+707.56*t)))))))+", "+Math.max(0,Math.min(255,Math.round(27.2+t*(3211.1-t*(15327.97-t*(27814-t*(22569.18-6838.66*t)))))))+")"},t.interpolateViridis=Mt,t.interpolateWarm=vt,t.interpolateYlGn=J,t.interpolateYlGnBu=Q,t.interpolateYlOrBr=tt,t.interpolateYlOrRd=nt,t.schemeAccent=o,t.schemeBlues=rt,t.schemeBrBG=g,t.schemeBuGn=P,t.schemeBuPu=D,t.schemeCategory10=i,t.schemeDark2=a,t.schemeGnBu=R,t.schemeGreens=ot,t.schemeGreys=ut,t.schemeOrRd=L,t.schemeOranges=dt,t.schemePRGn=y,t.schemePaired=u,t.schemePastel1=f,t.schemePastel2=c,t.schemePiYG=m,t.schemePuBu=q,t.schemePuBuGn=I,t.schemePuOr=x,t.schemePuRd=Y,t.schemePurples=ct,t.schemeRdBu=M,t.schemeRdGy=k,t.schemeRdPu=$,t.schemeRdYlBu=E,t.schemeRdYlGn=S,t.schemeReds=lt,t.schemeSet1=s,t.schemeSet2=l,t.schemeSet3=h,t.schemeSpectral=N,t.schemeTableau10=d,t.schemeYlGn=Z,t.schemeYlGnBu=X,t.schemeYlOrBr=K,t.schemeYlOrRd=et,Object.defineProperty(t,"__esModule",{value:!0})},"object"==typeof n&&void 0!==e?i(n,t("d3-interpolate"),t("d3-color")):"function"==typeof define&&define.amd?define(["exports","d3-interpolate","d3-color"],i):i((r=r||self).d3=r.d3||{},r.d3,r.d3)},{"d3-color":10,"d3-interpolate":21}],27:[function(t,e,n){var r,i;r=this,i=function(t){"use strict";var e="http://www.w3.org/1999/xhtml",n={svg:"http://www.w3.org/2000/svg",xhtml:e,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function r(t){var e=t+="",r=e.indexOf(":");return r>=0&&"xmlns"!==(e=t.slice(0,r))&&(t=t.slice(r+1)),n.hasOwnProperty(e)?{space:n[e],local:t}:t}function i(t){var n=r(t);return(n.local?function(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}:function(t){return function(){var n=this.ownerDocument,r=this.namespaceURI;return r===e&&n.documentElement.namespaceURI===e?n.createElement(t):n.createElementNS(r,t)}})(n)}function o(){}function a(t){return null==t?o:function(){return this.querySelector(t)}}function u(){return[]}function f(t){return null==t?u:function(){return this.querySelectorAll(t)}}function c(t){return function(){return this.matches(t)}}function s(t){return new Array(t.length)}function l(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}l.prototype={constructor:l,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var h="$";function d(t,e,n,r,i,o){for(var a,u=0,f=e.length,c=o.length;ue?1:t>=e?0:NaN}function v(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function y(t,e){return t.style.getPropertyValue(e)||v(t).getComputedStyle(t,null).getPropertyValue(e)}function b(t){return t.trim().split(/^|\s+/)}function m(t){return t.classList||new _(t)}function _(t){this._node=t,this._names=b(t.getAttribute("class")||"")}function x(t,e){for(var n=m(t),r=-1,i=e.length;++r=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var N={};function j(t,e,n){return t=P(t,e,n),function(e){var n=e.relatedTarget;n&&(n===this||8&n.compareDocumentPosition(this))||t.call(this,e)}}function P(e,n,r){return function(i){var o=t.event;t.event=i;try{e.call(this,this.__data__,n,r)}finally{t.event=o}}}function z(t){return function(){var e=this.__on;if(e){for(var n,r=0,i=-1,o=e.length;r=M&&(M=w+1);!(x=m[M])&&++M=0;)(r=i[o])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=g);for(var n=this._groups,r=n.length,i=new Array(r),o=0;o1?this.each((null==e?function(t){return function(){this.style.removeProperty(t)}}:"function"==typeof e?function(t,e,n){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}:function(t,e,n){return function(){this.style.setProperty(t,e,n)}})(t,e,null==n?"":n)):y(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?function(t){return function(){delete this[t]}}:"function"==typeof e?function(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}:function(t,e){return function(){this[t]=e}})(t,e)):this.node()[t]},classed:function(t,e){var n=b(t+"");if(arguments.length<2){for(var r=m(this.node()),i=-1,o=n.length;++i=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}})}(t+""),a=o.length;if(!(arguments.length<2)){for(u=e?D:z,null==n&&(n=!1),r=0;r=1?h:t<=-1?-h:Math.asin(t)}function g(t){return t.innerRadius}function v(t){return t.outerRadius}function y(t){return t.startAngle}function b(t){return t.endAngle}function m(t){return t&&t.padAngle}function _(t,e,n,r,i,o,u){var f=t-n,s=e-r,l=(u?o:-o)/c(f*f+s*s),h=l*s,d=-l*f,p=t+h,g=e+d,v=n+h,y=r+d,b=(p+v)/2,m=(g+y)/2,_=v-p,x=y-g,w=_*_+x*x,M=i-o,A=p*y-v*g,k=(x<0?-1:1)*c(a(0,M*M*w-A*A)),C=(A*x-_*k)/w,E=(-A*_-x*k)/w,T=(A*x+_*k)/w,S=(-A*_+x*k)/w,O=C-b,N=E-m,j=T-b,P=S-m;return O*O+N*N>j*j+P*P&&(C=T,E=S),{cx:C,cy:E,x01:-h,y01:-d,x11:C*(i/M-1),y11:E*(i/M-1)}}function x(t){this._context=t}function w(t){return new x(t)}function M(t){return t[0]}function A(t){return t[1]}function k(){var t=M,r=A,i=n(!0),o=null,a=w,u=null;function f(n){var f,c,s,l=n.length,h=!1;for(null==o&&(u=a(s=e.path())),f=0;f<=l;++f)!(f=l;--h)c.point(y[h],b[h]);c.lineEnd(),c.areaEnd()}v&&(y[s]=+t(d,s,n),b[s]=+i(d,s,n),c.point(r?+r(d,s,n):y[s],o?+o(d,s,n):b[s]))}if(p)return c=null,p+""||null}function l(){return k().defined(a).curve(f).context(u)}return s.x=function(e){return arguments.length?(t="function"==typeof e?e:n(+e),r=null,s):t},s.x0=function(e){return arguments.length?(t="function"==typeof e?e:n(+e),s):t},s.x1=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:n(+t),s):r},s.y=function(t){return arguments.length?(i="function"==typeof t?t:n(+t),o=null,s):i},s.y0=function(t){return arguments.length?(i="function"==typeof t?t:n(+t),s):i},s.y1=function(t){return arguments.length?(o=null==t?null:"function"==typeof t?t:n(+t),s):o},s.lineX0=s.lineY0=function(){return l().x(t).y(i)},s.lineY1=function(){return l().x(t).y(o)},s.lineX1=function(){return l().x(r).y(i)},s.defined=function(t){return arguments.length?(a="function"==typeof t?t:n(!!t),s):a},s.curve=function(t){return arguments.length?(f=t,null!=u&&(c=f(u)),s):f},s.context=function(t){return arguments.length?(null==t?u=c=null:c=f(u=t),s):u},s}function E(t,e){return et?1:e>=t?0:NaN}function T(t){return t}x.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e)}}};var S=N(w);function O(t){this._curve=t}function N(t){function e(e){return new O(t(e))}return e._curve=t,e}function j(t){var e=t.curve;return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t.curve=function(t){return arguments.length?e(N(t)):e()._curve},t}function P(){return j(k().curve(S))}function z(){var t=C().curve(S),e=t.curve,n=t.lineX0,r=t.lineX1,i=t.lineY0,o=t.lineY1;return t.angle=t.x,delete t.x,t.startAngle=t.x0,delete t.x0,t.endAngle=t.x1,delete t.x1,t.radius=t.y,delete t.y,t.innerRadius=t.y0,delete t.y0,t.outerRadius=t.y1,delete t.y1,t.lineStartAngle=function(){return j(n())},delete t.lineX0,t.lineEndAngle=function(){return j(r())},delete t.lineX1,t.lineInnerRadius=function(){return j(i())},delete t.lineY0,t.lineOuterRadius=function(){return j(o())},delete t.lineY1,t.curve=function(t){return arguments.length?e(N(t)):e()._curve},t}function D(t,e){return[(e=+e)*Math.cos(t-=Math.PI/2),e*Math.sin(t)]}O.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(t,e){this._curve.point(e*Math.sin(t),e*-Math.cos(t))}};var B=Array.prototype.slice;function R(t){return t.source}function F(t){return t.target}function L(t){var r=R,i=F,o=M,a=A,u=null;function f(){var n,f=B.call(arguments),c=r.apply(this,f),s=i.apply(this,f);if(u||(u=n=e.path()),t(u,+o.apply(this,(f[0]=c,f)),+a.apply(this,f),+o.apply(this,(f[0]=s,f)),+a.apply(this,f)),n)return u=null,n+""||null}return f.source=function(t){return arguments.length?(r=t,f):r},f.target=function(t){return arguments.length?(i=t,f):i},f.x=function(t){return arguments.length?(o="function"==typeof t?t:n(+t),f):o},f.y=function(t){return arguments.length?(a="function"==typeof t?t:n(+t),f):a},f.context=function(t){return arguments.length?(u=null==t?null:t,f):u},f}function U(t,e,n,r,i){t.moveTo(e,n),t.bezierCurveTo(e=(e+r)/2,n,e,i,r,i)}function I(t,e,n,r,i){t.moveTo(e,n),t.bezierCurveTo(e,n=(n+i)/2,r,n,r,i)}function H(t,e,n,r,i){var o=D(e,n),a=D(e,n=(n+i)/2),u=D(r,n),f=D(r,i);t.moveTo(o[0],o[1]),t.bezierCurveTo(a[0],a[1],u[0],u[1],f[0],f[1])}var q={draw:function(t,e){var n=Math.sqrt(e/l);t.moveTo(n,0),t.arc(0,0,n,0,d)}},V={draw:function(t,e){var n=Math.sqrt(e/5)/2;t.moveTo(-3*n,-n),t.lineTo(-n,-n),t.lineTo(-n,-3*n),t.lineTo(n,-3*n),t.lineTo(n,-n),t.lineTo(3*n,-n),t.lineTo(3*n,n),t.lineTo(n,n),t.lineTo(n,3*n),t.lineTo(-n,3*n),t.lineTo(-n,n),t.lineTo(-3*n,n),t.closePath()}},Y=Math.sqrt(1/3),W=2*Y,$={draw:function(t,e){var n=Math.sqrt(e/W),r=n*Y;t.moveTo(0,-n),t.lineTo(r,0),t.lineTo(0,n),t.lineTo(-r,0),t.closePath()}},G=Math.sin(l/10)/Math.sin(7*l/10),X=Math.sin(d/10)*G,Q=-Math.cos(d/10)*G,Z={draw:function(t,e){var n=Math.sqrt(.8908130915292852*e),r=X*n,i=Q*n;t.moveTo(0,-n),t.lineTo(r,i);for(var o=1;o<5;++o){var a=d*o/5,u=Math.cos(a),f=Math.sin(a);t.lineTo(f*n,-u*n),t.lineTo(u*r-f*i,f*r+u*i)}t.closePath()}},J={draw:function(t,e){var n=Math.sqrt(e),r=-n/2;t.rect(r,r,n,n)}},K=Math.sqrt(3),tt={draw:function(t,e){var n=-Math.sqrt(e/(3*K));t.moveTo(0,2*n),t.lineTo(-K*n,-n),t.lineTo(K*n,-n),t.closePath()}},et=-.5,nt=Math.sqrt(3)/2,rt=1/Math.sqrt(12),it=3*(rt/2+1),ot={draw:function(t,e){var n=Math.sqrt(e/it),r=n/2,i=n*rt,o=r,a=n*rt+n,u=-o,f=a;t.moveTo(r,i),t.lineTo(o,a),t.lineTo(u,f),t.lineTo(et*r-nt*i,nt*r+et*i),t.lineTo(et*o-nt*a,nt*o+et*a),t.lineTo(et*u-nt*f,nt*u+et*f),t.lineTo(et*r+nt*i,et*i-nt*r),t.lineTo(et*o+nt*a,et*a-nt*o),t.lineTo(et*u+nt*f,et*f-nt*u),t.closePath()}},at=[q,V,$,J,Z,tt,ot];function ut(){}function ft(t,e,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6)}function ct(t){this._context=t}function st(t){this._context=t}function lt(t){this._context=t}function ht(t,e){this._basis=new ct(t),this._beta=e}ct.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:ft(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:ft(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},st.prototype={areaStart:ut,areaEnd:ut,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:ft(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},lt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:ft(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},ht.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,e=this._y,n=t.length-1;if(n>0)for(var r,i=t[0],o=e[0],a=t[n]-i,u=e[n]-o,f=-1;++f<=n;)r=f/n,this._basis.point(this._beta*t[f]+(1-this._beta)*(i+r*a),this._beta*e[f]+(1-this._beta)*(o+r*u));this._x=this._y=null,this._basis.lineEnd()},point:function(t,e){this._x.push(+t),this._y.push(+e)}};var dt=function t(e){function n(t){return 1===e?new ct(t):new ht(t,e)}return n.beta=function(e){return t(+e)},n}(.85);function pt(t,e,n){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-e),t._y2+t._k*(t._y1-n),t._x2,t._y2)}function gt(t,e){this._context=t,this._k=(1-e)/6}gt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:pt(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2,this._x1=t,this._y1=e;break;case 2:this._point=3;default:pt(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var vt=function t(e){function n(t){return new gt(t,e)}return n.tension=function(e){return t(+e)},n}(0);function yt(t,e){this._context=t,this._k=(1-e)/6}yt.prototype={areaStart:ut,areaEnd:ut,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:pt(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var bt=function t(e){function n(t){return new yt(t,e)}return n.tension=function(e){return t(+e)},n}(0);function mt(t,e){this._context=t,this._k=(1-e)/6}mt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:pt(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var _t=function t(e){function n(t){return new mt(t,e)}return n.tension=function(e){return t(+e)},n}(0);function xt(t,e,n){var r=t._x1,i=t._y1,o=t._x2,a=t._y2;if(t._l01_a>s){var u=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,f=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*u-t._x0*t._l12_2a+t._x2*t._l01_2a)/f,i=(i*u-t._y0*t._l12_2a+t._y2*t._l01_2a)/f}if(t._l23_a>s){var c=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,l=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*c+t._x1*t._l23_2a-e*t._l12_2a)/l,a=(a*c+t._y1*t._l23_2a-n*t._l12_2a)/l}t._context.bezierCurveTo(r,i,o,a,t._x2,t._y2)}function wt(t,e){this._context=t,this._alpha=e}wt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3;default:xt(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Mt=function t(e){function n(t){return e?new wt(t,e):new gt(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function At(t,e){this._context=t,this._alpha=e}At.prototype={areaStart:ut,areaEnd:ut,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:xt(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var kt=function t(e){function n(t){return e?new At(t,e):new yt(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function Ct(t,e){this._context=t,this._alpha=e}Ct.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:xt(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Et=function t(e){function n(t){return e?new Ct(t,e):new mt(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function Tt(t){this._context=t}function St(t){return t<0?-1:1}function Ot(t,e,n){var r=t._x1-t._x0,i=e-t._x1,o=(t._y1-t._y0)/(r||i<0&&-0),a=(n-t._y1)/(i||r<0&&-0),u=(o*i+a*r)/(r+i);return(St(o)+St(a))*Math.min(Math.abs(o),Math.abs(a),.5*Math.abs(u))||0}function Nt(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function jt(t,e,n){var r=t._x0,i=t._y0,o=t._x1,a=t._y1,u=(o-r)/3;t._context.bezierCurveTo(r+u,i+u*e,o-u,a-u*n,o,a)}function Pt(t){this._context=t}function zt(t){this._context=new Dt(t)}function Dt(t){this._context=t}function Bt(t){this._context=t}function Rt(t){var e,n,r=t.length-1,i=new Array(r),o=new Array(r),a=new Array(r);for(i[0]=0,o[0]=2,a[0]=t[0]+2*t[1],e=1;e=0;--e)i[e]=(a[e]-i[e+1])/o[e];for(o[r-1]=(t[r]+i[r-1])/2,e=0;e1)for(var n,r,i,o=1,a=t[e[0]],u=a.length;o=0;)n[e]=e;return n}function It(t,e){return t[e]}function Ht(t){var e=t.map(qt);return Ut(t).sort(function(t,n){return e[t]-e[n]})}function qt(t){for(var e,n=-1,r=0,i=t.length,o=-1/0;++no&&(o=e,r=n);return r}function Vt(t){var e=t.map(Yt);return Ut(t).sort(function(t,n){return e[t]-e[n]})}function Yt(t){for(var e,n=0,r=-1,i=t.length;++r=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}}this._x=t,this._y=e}},t.arc=function(){var t=g,a=v,x=n(0),w=null,M=y,A=b,k=m,C=null;function E(){var n,g,v,y=+t.apply(this,arguments),b=+a.apply(this,arguments),m=M.apply(this,arguments)-h,E=A.apply(this,arguments)-h,T=r(E-m),S=E>m;if(C||(C=n=e.path()),bs)if(T>d-s)C.moveTo(b*o(m),b*f(m)),C.arc(0,0,b,m,E,!S),y>s&&(C.moveTo(y*o(E),y*f(E)),C.arc(0,0,y,E,m,S));else{var O,N,j=m,P=E,z=m,D=E,B=T,R=T,F=k.apply(this,arguments)/2,L=F>s&&(w?+w.apply(this,arguments):c(y*y+b*b)),U=u(r(b-y)/2,+x.apply(this,arguments)),I=U,H=U;if(L>s){var q=p(L/y*f(F)),V=p(L/b*f(F));(B-=2*q)>s?(z+=q*=S?1:-1,D-=q):(B=0,z=D=(m+E)/2),(R-=2*V)>s?(j+=V*=S?1:-1,P-=V):(R=0,j=P=(m+E)/2)}var Y=b*o(j),W=b*f(j),$=y*o(D),G=y*f(D);if(U>s){var X,Q=b*o(P),Z=b*f(P),J=y*o(z),K=y*f(z);if(T1?0:v<-1?l:Math.acos(v))/2),ot=c(X[0]*X[0]+X[1]*X[1]);I=u(U,(y-ot)/(it-1)),H=u(U,(b-ot)/(it+1))}}R>s?H>s?(O=_(J,K,Y,W,b,H,S),N=_(Q,Z,$,G,b,H,S),C.moveTo(O.cx+O.x01,O.cy+O.y01),Hs&&B>s?I>s?(O=_($,G,Q,Z,y,-I,S),N=_(Y,W,J,K,y,-I,S),C.lineTo(O.cx+O.x01,O.cy+O.y01),I0&&(p+=l);for(null!=e?g.sort(function(t,n){return e(v[t],v[n])}):null!=r&&g.sort(function(t,e){return r(n[t],n[e])}),u=0,c=p?(b-h*_)/p:0;u0?l*c:0)+_,v[f]={data:n[f],index:u,value:l,startAngle:y,endAngle:s,padAngle:m};return v}return u.value=function(e){return arguments.length?(t="function"==typeof e?e:n(+e),u):t},u.sortValues=function(t){return arguments.length?(e=t,r=null,u):e},u.sort=function(t){return arguments.length?(r=t,e=null,u):r},u.startAngle=function(t){return arguments.length?(i="function"==typeof t?t:n(+t),u):i},u.endAngle=function(t){return arguments.length?(o="function"==typeof t?t:n(+t),u):o},u.padAngle=function(t){return arguments.length?(a="function"==typeof t?t:n(+t),u):a},u},t.pointRadial=D,t.radialArea=z,t.radialLine=P,t.stack=function(){var t=n([]),e=Ut,r=Lt,i=It;function o(n){var o,a,u=t.apply(this,arguments),f=n.length,c=u.length,s=new Array(c);for(o=0;o0)for(var n,r,i,o,a,u,f=0,c=t[e[0]].length;f0?(r[0]=o,r[1]=o+=i):i<0?(r[1]=a,r[0]=a+=i):(r[0]=0,r[1]=i)},t.stackOffsetExpand=function(t,e){if((r=t.length)>0){for(var n,r,i,o=0,a=t[0].length;o0){for(var n,r=0,i=t[e[0]],o=i.length;r0&&(r=(n=t[e[0]]).length)>0){for(var n,r,i,o=0,a=1;a=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:wt,s:Mt,S:q,u:V,U:Y,V:$,w:G,W:X,x:null,X:null,y:Q,Y:J,Z:tt,"%":xt},zt={a:function(t){return l[t.getUTCDay()]},A:function(t){return s[t.getUTCDay()]},b:function(t){return W[t.getUTCMonth()]},B:function(t){return h[t.getUTCMonth()]},c:null,d:et,e:et,f:at,g:yt,G:mt,H:nt,I:rt,j:it,L:ot,m:ut,M:ft,p:function(t){return c[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:wt,s:Mt,S:ct,u:st,U:lt,V:dt,w:pt,W:gt,x:null,X:null,y:vt,Y:bt,Z:_t,"%":xt},Dt={a:function(t,e,n){var r=Et.exec(e.slice(n));return r?(t.w=Tt[r[0].toLowerCase()],n+r[0].length):-1},A:function(t,e,n){var r=kt.exec(e.slice(n));return r?(t.w=Ct[r[0].toLowerCase()],n+r[0].length):-1},b:function(t,e,n){var r=Nt.exec(e.slice(n));return r?(t.m=jt[r[0].toLowerCase()],n+r[0].length):-1},B:function(t,e,n){var r=St.exec(e.slice(n));return r?(t.m=Ot[r[0].toLowerCase()],n+r[0].length):-1},c:function(t,e,n){return Ft(t,o,e,n)},d:k,e:k,f:N,g:x,G:_,H:E,I:E,j:C,L:O,m:A,M:T,p:function(t,e,n){var r=ht.exec(e.slice(n));return r?(t.p=At[r[0].toLowerCase()],n+r[0].length):-1},q:M,Q:P,s:z,S:S,u:v,U:y,V:b,w:g,W:m,x:function(t,e,n){return Ft(t,a,e,n)},X:function(t,e,n){return Ft(t,f,e,n)},y:x,Y:_,Z:w,"%":j};function Bt(t,e){return function(n){var r,i,o,a=[],f=-1,c=0,s=t.length;for(n instanceof Date||(n=new Date(+n));++f53)return null;"w"in c||(c.w=1),"Z"in c?(f=(u=r(i(c.y,0,1))).getUTCDay(),u=f>4||0===f?e.utcMonday.ceil(u):e.utcMonday(u),u=e.utcDay.offset(u,7*(c.V-1)),c.y=u.getUTCFullYear(),c.m=u.getUTCMonth(),c.d=u.getUTCDate()+(c.w+6)%7):(f=(u=n(i(c.y,0,1))).getDay(),u=f>4||0===f?e.timeMonday.ceil(u):e.timeMonday(u),u=e.timeDay.offset(u,7*(c.V-1)),c.y=u.getFullYear(),c.m=u.getMonth(),c.d=u.getDate()+(c.w+6)%7)}else("W"in c||"U"in c)&&("w"in c||(c.w="u"in c?c.u%7:"W"in c?1:0),f="Z"in c?r(i(c.y,0,1)).getUTCDay():n(i(c.y,0,1)).getDay(),c.m=0,c.d="W"in c?(c.w+6)%7+7*c.W-(f+5)%7:c.w+7*c.U-(f+6)%7);return"Z"in c?(c.H+=c.Z/100|0,c.M+=c.Z%100,r(c)):n(c)}}function Ft(t,e,n,r){for(var i,o,a=0,f=e.length,c=n.length;a=c)return-1;if(37===(i=e.charCodeAt(a++))){if(i=e.charAt(a++),!(o=Dt[i in u?e.charAt(a++):i])||(r=o(t,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}return Pt.x=Bt(a,Pt),Pt.X=Bt(f,Pt),Pt.c=Bt(o,Pt),zt.x=Bt(a,zt),zt.X=Bt(f,zt),zt.c=Bt(o,zt),{format:function(t){var e=Bt(t+="",Pt);return e.toString=function(){return t},e},parse:function(t){var e=Rt(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=Bt(t+="",zt);return e.toString=function(){return t},e},utcParse:function(t){var e=Rt(t+="",!0);return e.toString=function(){return t},e}}}var a,u={"-":"",_:" ",0:"0"},f=/^\s*\d+/,c=/^%/,s=/[\\^$*+?|[\]().{}]/g;function l(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o68?1900:2e3),n+r[0].length):-1}function w(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function M(t,e,n){var r=f.exec(e.slice(n,n+1));return r?(t.q=3*r[0]-3,n+r[0].length):-1}function A(t,e,n){var r=f.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function k(t,e,n){var r=f.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function C(t,e,n){var r=f.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function E(t,e,n){var r=f.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function T(t,e,n){var r=f.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function S(t,e,n){var r=f.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function O(t,e,n){var r=f.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function N(t,e,n){var r=f.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function j(t,e,n){var r=c.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function P(t,e,n){var r=f.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function z(t,e,n){var r=f.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function D(t,e){return l(t.getDate(),e,2)}function B(t,e){return l(t.getHours(),e,2)}function R(t,e){return l(t.getHours()%12||12,e,2)}function F(t,n){return l(1+e.timeDay.count(e.timeYear(t),t),n,3)}function L(t,e){return l(t.getMilliseconds(),e,3)}function U(t,e){return L(t,e)+"000"}function I(t,e){return l(t.getMonth()+1,e,2)}function H(t,e){return l(t.getMinutes(),e,2)}function q(t,e){return l(t.getSeconds(),e,2)}function V(t){var e=t.getDay();return 0===e?7:e}function Y(t,n){return l(e.timeSunday.count(e.timeYear(t)-1,t),n,2)}function W(t){var n=t.getDay();return n>=4||0===n?e.timeThursday(t):e.timeThursday.ceil(t)}function $(t,n){return t=W(t),l(e.timeThursday.count(e.timeYear(t),t)+(4===e.timeYear(t).getDay()),n,2)}function G(t){return t.getDay()}function X(t,n){return l(e.timeMonday.count(e.timeYear(t)-1,t),n,2)}function Q(t,e){return l(t.getFullYear()%100,e,2)}function Z(t,e){return l((t=W(t)).getFullYear()%100,e,2)}function J(t,e){return l(t.getFullYear()%1e4,e,4)}function K(t,n){var r=t.getDay();return l((t=r>=4||0===r?e.timeThursday(t):e.timeThursday.ceil(t)).getFullYear()%1e4,n,4)}function tt(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+l(e/60|0,"0",2)+l(e%60,"0",2)}function et(t,e){return l(t.getUTCDate(),e,2)}function nt(t,e){return l(t.getUTCHours(),e,2)}function rt(t,e){return l(t.getUTCHours()%12||12,e,2)}function it(t,n){return l(1+e.utcDay.count(e.utcYear(t),t),n,3)}function ot(t,e){return l(t.getUTCMilliseconds(),e,3)}function at(t,e){return ot(t,e)+"000"}function ut(t,e){return l(t.getUTCMonth()+1,e,2)}function ft(t,e){return l(t.getUTCMinutes(),e,2)}function ct(t,e){return l(t.getUTCSeconds(),e,2)}function st(t){var e=t.getUTCDay();return 0===e?7:e}function lt(t,n){return l(e.utcSunday.count(e.utcYear(t)-1,t),n,2)}function ht(t){var n=t.getUTCDay();return n>=4||0===n?e.utcThursday(t):e.utcThursday.ceil(t)}function dt(t,n){return t=ht(t),l(e.utcThursday.count(e.utcYear(t),t)+(4===e.utcYear(t).getUTCDay()),n,2)}function pt(t){return t.getUTCDay()}function gt(t,n){return l(e.utcMonday.count(e.utcYear(t)-1,t),n,2)}function vt(t,e){return l(t.getUTCFullYear()%100,e,2)}function yt(t,e){return l((t=ht(t)).getUTCFullYear()%100,e,2)}function bt(t,e){return l(t.getUTCFullYear()%1e4,e,4)}function mt(t,n){var r=t.getUTCDay();return l((t=r>=4||0===r?e.utcThursday(t):e.utcThursday.ceil(t)).getUTCFullYear()%1e4,n,4)}function _t(){return"+0000"}function xt(){return"%"}function wt(t){return+t}function Mt(t){return Math.floor(+t/1e3)}function At(e){return a=o(e),t.timeFormat=a.format,t.timeParse=a.parse,t.utcFormat=a.utcFormat,t.utcParse=a.utcParse,a}At({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});var kt=Date.prototype.toISOString?function(t){return t.toISOString()}:t.utcFormat("%Y-%m-%dT%H:%M:%S.%LZ"),Ct=+new Date("2000-01-01T00:00:00.000Z")?function(t){var e=new Date(t);return isNaN(e)?null:e}:t.utcParse("%Y-%m-%dT%H:%M:%S.%LZ");t.isoFormat=kt,t.isoParse=Ct,t.timeFormatDefaultLocale=At,t.timeFormatLocale=o,Object.defineProperty(t,"__esModule",{value:!0})},"object"==typeof n&&void 0!==e?i(n,t("d3-time")):"function"==typeof define&&define.amd?define(["exports","d3-time"],i):i((r=r||self).d3=r.d3||{},r.d3)},{"d3-time":30}],30:[function(t,e,n){var r,i;r=this,i=function(t){"use strict";var e=new Date,n=new Date;function r(t,i,o,a){function u(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return u.floor=function(e){return t(e=new Date(+e)),e},u.ceil=function(e){return t(e=new Date(e-1)),i(e,1),t(e),e},u.round=function(t){var e=u(t),n=u.ceil(t);return t-e0))return a;do{a.push(o=new Date(+e)),i(e,r),t(e)}while(o=n)for(;t(n),!e(n);)n.setTime(n-1)},function(t,n){if(t>=t)if(n<0)for(;++n<=0;)for(;i(t,-1),!e(t););else for(;--n>=0;)for(;i(t,1),!e(t););})},o&&(u.count=function(r,i){return e.setTime(+r),n.setTime(+i),t(e),t(n),Math.floor(o(e,n))},u.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?u.filter(a?function(e){return a(e)%t==0}:function(e){return u.count(0,e)%t==0}):u:null}),u}var i=r(function(){},function(t,e){t.setTime(+t+e)},function(t,e){return e-t});i.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?r(function(e){e.setTime(Math.floor(e/t)*t)},function(e,n){e.setTime(+e+n*t)},function(e,n){return(n-e)/t}):i:null};var o=i.range,a=6e4,u=6048e5,f=r(function(t){t.setTime(t-t.getMilliseconds())},function(t,e){t.setTime(+t+1e3*e)},function(t,e){return(e-t)/1e3},function(t){return t.getUTCSeconds()}),c=f.range,s=r(function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds())},function(t,e){t.setTime(+t+e*a)},function(t,e){return(e-t)/a},function(t){return t.getMinutes()}),l=s.range,h=r(function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds()-t.getMinutes()*a)},function(t,e){t.setTime(+t+36e5*e)},function(t,e){return(e-t)/36e5},function(t){return t.getHours()}),d=h.range,p=r(function(t){t.setHours(0,0,0,0)},function(t,e){t.setDate(t.getDate()+e)},function(t,e){return(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*a)/864e5},function(t){return t.getDate()-1}),g=p.range;function v(t){return r(function(e){e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},function(t,e){t.setDate(t.getDate()+7*e)},function(t,e){return(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*a)/u})}var y=v(0),b=v(1),m=v(2),_=v(3),x=v(4),w=v(5),M=v(6),A=y.range,k=b.range,C=m.range,E=_.range,T=x.range,S=w.range,O=M.range,N=r(function(t){t.setDate(1),t.setHours(0,0,0,0)},function(t,e){t.setMonth(t.getMonth()+e)},function(t,e){return e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear())},function(t){return t.getMonth()}),j=N.range,P=r(function(t){t.setMonth(0,1),t.setHours(0,0,0,0)},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t,e){return e.getFullYear()-t.getFullYear()},function(t){return t.getFullYear()});P.every=function(t){return isFinite(t=Math.floor(t))&&t>0?r(function(e){e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},function(e,n){e.setFullYear(e.getFullYear()+n*t)}):null};var z=P.range,D=r(function(t){t.setUTCSeconds(0,0)},function(t,e){t.setTime(+t+e*a)},function(t,e){return(e-t)/a},function(t){return t.getUTCMinutes()}),B=D.range,R=r(function(t){t.setUTCMinutes(0,0,0)},function(t,e){t.setTime(+t+36e5*e)},function(t,e){return(e-t)/36e5},function(t){return t.getUTCHours()}),F=R.range,L=r(function(t){t.setUTCHours(0,0,0,0)},function(t,e){t.setUTCDate(t.getUTCDate()+e)},function(t,e){return(e-t)/864e5},function(t){return t.getUTCDate()-1}),U=L.range;function I(t){return r(function(e){e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},function(t,e){t.setUTCDate(t.getUTCDate()+7*e)},function(t,e){return(e-t)/u})}var H=I(0),q=I(1),V=I(2),Y=I(3),W=I(4),$=I(5),G=I(6),X=H.range,Q=q.range,Z=V.range,J=Y.range,K=W.range,tt=$.range,et=G.range,nt=r(function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)},function(t,e){t.setUTCMonth(t.getUTCMonth()+e)},function(t,e){return e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear())},function(t){return t.getUTCMonth()}),rt=nt.range,it=r(function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)},function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()},function(t){return t.getUTCFullYear()});it.every=function(t){return isFinite(t=Math.floor(t))&&t>0?r(function(e){e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},function(e,n){e.setUTCFullYear(e.getUTCFullYear()+n*t)}):null};var ot=it.range;t.timeDay=p,t.timeDays=g,t.timeFriday=w,t.timeFridays=S,t.timeHour=h,t.timeHours=d,t.timeInterval=r,t.timeMillisecond=i,t.timeMilliseconds=o,t.timeMinute=s,t.timeMinutes=l,t.timeMonday=b,t.timeMondays=k,t.timeMonth=N,t.timeMonths=j,t.timeSaturday=M,t.timeSaturdays=O,t.timeSecond=f,t.timeSeconds=c,t.timeSunday=y,t.timeSundays=A,t.timeThursday=x,t.timeThursdays=T,t.timeTuesday=m,t.timeTuesdays=C,t.timeWednesday=_,t.timeWednesdays=E,t.timeWeek=y,t.timeWeeks=A,t.timeYear=P,t.timeYears=z,t.utcDay=L,t.utcDays=U,t.utcFriday=$,t.utcFridays=tt,t.utcHour=R,t.utcHours=F,t.utcMillisecond=i,t.utcMilliseconds=o,t.utcMinute=D,t.utcMinutes=B,t.utcMonday=q,t.utcMondays=Q,t.utcMonth=nt,t.utcMonths=rt,t.utcSaturday=G,t.utcSaturdays=et,t.utcSecond=f,t.utcSeconds=c,t.utcSunday=H,t.utcSundays=X,t.utcThursday=W,t.utcThursdays=K,t.utcTuesday=V,t.utcTuesdays=Z,t.utcWednesday=Y,t.utcWednesdays=J,t.utcWeek=H,t.utcWeeks=X,t.utcYear=it,t.utcYears=ot,Object.defineProperty(t,"__esModule",{value:!0})},"object"==typeof n&&void 0!==e?i(n):"function"==typeof define&&define.amd?define(["exports"],i):i((r=r||self).d3=r.d3||{})},{}],31:[function(t,e,n){var r,i;r=this,i=function(t){"use strict";var e,n,r=0,i=0,o=0,a=1e3,u=0,f=0,c=0,s="object"==typeof performance&&performance.now?performance:Date,l="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function h(){return f||(l(d),f=s.now()+c)}function d(){f=0}function p(){this._call=this._time=this._next=null}function g(t,e,n){var r=new p;return r.restart(t,e,n),r}function v(){h(),++r;for(var t,n=e;n;)(t=f-n._time)>=0&&n._call.call(null,t),n=n._next;--r}function y(){f=(u=s.now())+c,r=i=0;try{v()}finally{r=0,function(){var t,r,i=e,o=1/0;for(;i;)i._call?(o>i._time&&(o=i._time),t=i,i=i._next):(r=i._next,i._next=null,i=t?t._next=r:e=r);n=t,m(o)}(),f=0}}function b(){var t=s.now(),e=t-u;e>a&&(c-=e,u=t)}function m(t){r||(i&&(i=clearTimeout(i)),t-f>24?(t<1/0&&(i=setTimeout(y,t-s.now()-c)),o&&(o=clearInterval(o))):(o||(u=s.now(),o=setInterval(b,a)),r=1,l(y)))}p.prototype=g.prototype={constructor:p,restart:function(t,r,i){if("function"!=typeof t)throw new TypeError("callback is not a function");i=(null==i?h():+i)+(null==r?0:+r),this._next||n===this||(n?n._next=this:e=this,n=this),this._call=t,this._time=i,m()},stop:function(){this._call&&(this._call=null,this._time=1/0,m())}},t.interval=function(t,e,n){var r=new p,i=e;return null==e?(r.restart(t,e,n),r):(e=+e,n=null==n?h():+n,r.restart(function o(a){a+=i,r.restart(o,i+=e,n),t(a)},e,n),r)},t.now=h,t.timeout=function(t,e,n){var r=new p;return e=null==e?0:+e,r.restart(function(n){r.stop(),t(n+e)},e,n),r},t.timer=g,t.timerFlush=v,Object.defineProperty(t,"__esModule",{value:!0})},"object"==typeof n&&void 0!==e?i(n):"function"==typeof define&&define.amd?define(["exports"],i):i((r=r||self).d3=r.d3||{})},{}],32:[function(t,e,n){var r,i;r=this,i=function(t,e,n,r,i,o,a){"use strict";var u=n.dispatch("start","end","cancel","interrupt"),f=[],c=0,s=1,l=2,h=3,d=4,p=5,g=6;function v(t,e,n,i,o,a){var v=t.__transition;if(v){if(n in v)return}else t.__transition={};!function(t,e,n){var i,o=t.__transition;function a(c){var p,v,y,b;if(n.state!==s)return f();for(p in o)if((b=o[p]).name===n.name){if(b.state===h)return r.timeout(a);b.state===d?(b.state=g,b.timer.stop(),b.on.call("interrupt",t,t.__data__,b.index,b.group),delete o[p]):+pc)throw new Error("too late; already scheduled");return n}function b(t,e){var n=m(t,e);if(n.state>h)throw new Error("too late; already running");return n}function m(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function _(t,e){var n,r,i,o=t.__transition,a=!0;if(o){for(i in e=null==e?null:e+"",o)(n=o[i]).name===e?(r=n.state>l&&n.state=0&&(t=t.slice(0,e)),!t||"start"===t})}(e)?y:b;return function(){var a=o(this,t),u=a.on;u!==r&&(i=(r=u).copy()).on(e,n),a.on=i}}(n,t,e))},attr:function(t,n){var r=e.namespace(t),o="transform"===r?i.interpolateTransformSvg:w;return this.attrTween(t,"function"==typeof n?(r.local?function(t,e,n){var r,i,o;return function(){var a,u,f=n(this);if(null!=f)return(a=this.getAttributeNS(t.space,t.local))===(u=f+"")?null:a===r&&u===i?o:(i=u,o=e(r=a,f));this.removeAttributeNS(t.space,t.local)}}:function(t,e,n){var r,i,o;return function(){var a,u,f=n(this);if(null!=f)return(a=this.getAttribute(t))===(u=f+"")?null:a===r&&u===i?o:(i=u,o=e(r=a,f));this.removeAttribute(t)}})(r,o,x(this,"attr."+t,n)):null==n?(r.local?function(t){return function(){this.removeAttributeNS(t.space,t.local)}}:function(t){return function(){this.removeAttribute(t)}})(r):(r.local?function(t,e,n){var r,i,o=n+"";return function(){var a=this.getAttributeNS(t.space,t.local);return a===o?null:a===r?i:i=e(r=a,n)}}:function(t,e,n){var r,i,o=n+"";return function(){var a=this.getAttribute(t);return a===o?null:a===r?i:i=e(r=a,n)}})(r,o,n))},attrTween:function(t,n){var r="attr."+t;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==n)return this.tween(r,null);if("function"!=typeof n)throw new Error;var i=e.namespace(t);return this.tween(r,(i.local?function(t,e){var n,r;function i(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&function(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}(t,i)),n}return i._value=e,i}:function(t,e){var n,r;function i(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&function(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}(t,i)),n}return i._value=e,i})(i,n))},style:function(t,n,r){var o="transform"==(t+="")?i.interpolateTransformCss:w;return null==n?this.styleTween(t,function(t,n){var r,i,o;return function(){var a=e.style(this,t),u=(this.style.removeProperty(t),e.style(this,t));return a===u?null:a===r&&u===i?o:o=n(r=a,i=u)}}(t,o)).on("end.style."+t,A(t)):"function"==typeof n?this.styleTween(t,function(t,n,r){var i,o,a;return function(){var u=e.style(this,t),f=r(this),c=f+"";return null==f&&(this.style.removeProperty(t),c=f=e.style(this,t)),u===c?null:u===i&&c===o?a:(o=c,a=n(i=u,f))}}(t,o,x(this,"style."+t,n))).each(function(t,e){var n,r,i,o,a="style."+e,u="end."+a;return function(){var f=b(this,t),c=f.on,s=null==f.value[a]?o||(o=A(e)):void 0;c===n&&i===s||(r=(n=c).copy()).on(u,i=s),f.on=r}}(this._id,t)):this.styleTween(t,function(t,n,r){var i,o,a=r+"";return function(){var u=e.style(this,t);return u===a?null:u===i?o:o=n(i=u,r)}}(t,o,n),r).on("end.style."+t,null)},styleTween:function(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==e)return this.tween(r,null);if("function"!=typeof e)throw new Error;return this.tween(r,function(t,e,n){var r,i;function o(){var o=e.apply(this,arguments);return o!==i&&(r=(i=o)&&function(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}(t,o,n)),r}return o._value=e,o}(t,e,null==n?"":n))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var e=t(this);this.textContent=null==e?"":e}}(x(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},textTween:function(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(null==t)return this.tween(e,null);if("function"!=typeof t)throw new Error;return this.tween(e,function(t){var e,n;function r(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&function(t){return function(e){this.textContent=t.call(this,e)}}(r)),e}return r._value=t,r}(t))},remove:function(){return this.on("end.remove",(t=this._id,function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}));var t},tween:function(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r,i=m(this.node(),n).tween,o=0,a=i.length;os&&n.name===e)return new C([[t]],j,e,+r);return null},t.interrupt=_,t.transition=E,Object.defineProperty(t,"__esModule",{value:!0})},"object"==typeof n&&void 0!==e?i(n,t("d3-selection"),t("d3-dispatch"),t("d3-timer"),t("d3-interpolate"),t("d3-color"),t("d3-ease")):"function"==typeof define&&define.amd?define(["exports","d3-selection","d3-dispatch","d3-timer","d3-interpolate","d3-color","d3-ease"],i):i((r=r||self).d3=r.d3||{},r.d3,r.d3,r.d3,r.d3,r.d3,r.d3)},{"d3-color":10,"d3-dispatch":12,"d3-ease":15,"d3-interpolate":21,"d3-selection":27,"d3-timer":31}],33:[function(t,e,n){var r,i;r=this,i=function(t){"use strict";function e(t){return function(){return t}}function n(t){return t[0]}function r(t){return t[1]}function i(){this._=null}function o(t){t.U=t.C=t.L=t.R=t.P=t.N=null}function a(t,e){var n=e,r=e.R,i=n.U;i?i.L===n?i.L=r:i.R=r:t._=r,r.U=i,n.U=r,n.R=r.L,n.R&&(n.R.U=n),r.L=n}function u(t,e){var n=e,r=e.L,i=n.U;i?i.L===n?i.L=r:i.R=r:t._=r,r.U=i,n.U=r,n.L=r.R,n.L&&(n.L.U=n),r.R=n}function f(t){for(;t.L;)t=t.L;return t}function c(t,e,n,r){var i=[null,null],o=P.push(i)-1;return i.left=t,i.right=e,n&&l(i,t,e,n),r&&l(i,e,t,r),N[t.index].halfedges.push(o),N[e.index].halfedges.push(o),i}function s(t,e,n){var r=[e,n];return r.left=t,r}function l(t,e,n,r){t[0]||t[1]?t.left===n?t[1]=r:t[0]=r:(t[0]=r,t.left=e,t.right=n)}function h(t,e,n,r,i){var o,a=t[0],u=t[1],f=a[0],c=a[1],s=0,l=1,h=u[0]-f,d=u[1]-c;if(o=e-f,h||!(o>0)){if(o/=h,h<0){if(o0){if(o>l)return;o>s&&(s=o)}if(o=r-f,h||!(o<0)){if(o/=h,h<0){if(o>l)return;o>s&&(s=o)}else if(h>0){if(o0)){if(o/=d,d<0){if(o0){if(o>l)return;o>s&&(s=o)}if(o=i-c,d||!(o<0)){if(o/=d,d<0){if(o>l)return;o>s&&(s=o)}else if(d>0){if(o0||l<1)||(s>0&&(t[0]=[f+s*h,c+s*d]),l<1&&(t[1]=[f+l*h,c+l*d]),!0)}}}}}function d(t,e,n,r,i){var o=t[1];if(o)return!0;var a,u,f=t[0],c=t.left,s=t.right,l=c[0],h=c[1],d=s[0],p=s[1],g=(l+d)/2,v=(h+p)/2;if(p===h){if(g=r)return;if(l>d){if(f){if(f[1]>=i)return}else f=[g,n];o=[g,i]}else{if(f){if(f[1]1)if(l>d){if(f){if(f[1]>=i)return}else f=[(n-u)/a,n];o=[(i-u)/a,i]}else{if(f){if(f[1]=r)return}else f=[e,a*e+u];o=[r,a*r+u]}else{if(f){if(f[0]=-D)){var d=f*f+c*c,p=s*s+l*l,g=(l*d-c*p)/h,v=(f*p-s*d)/h,_=b.pop()||new m;_.arc=t,_.site=i,_.x=g+a,_.y=(_.cy=v+u)+Math.sqrt(g*g+v*v),t.circle=_;for(var x=null,w=j._;w;)if(_.yz)u=u.L;else{if(!((i=o-S(u,a))>z)){r>-z?(e=u.P,n=u):i>-z?(e=u,n=u.N):e=n=u;break}if(!u.R){e=u;break}u=u.R}!function(t){N[t.index]={site:t,halfedges:[]}}(t);var f=A(t);if(O.insert(e,f),e||n){if(e===n)return x(e),n=A(e.site),O.insert(f,n),f.edge=n.edge=c(e.site,f.site),_(e),void _(n);if(n){x(e),x(n);var s=e.site,h=s[0],d=s[1],p=t[0]-h,g=t[1]-d,v=n.site,y=v[0]-h,b=v[1]-d,m=2*(p*b-g*y),w=p*p+g*g,M=y*y+b*b,k=[(b*w-g*M)/m+h,(p*M-y*w)/m+d];l(n.edge,s,v,k),f.edge=c(s,t,null,k),n.edge=c(t,v,null,k),_(e),_(n)}else f.edge=c(e.site,f.site)}}function T(t,e){var n=t.site,r=n[0],i=n[1],o=i-e;if(!o)return r;var a=t.P;if(!a)return-1/0;var u=(n=a.site)[0],f=n[1],c=f-e;if(!c)return u;var s=u-r,l=1/o-1/c,h=s/c;return l?(-h+Math.sqrt(h*h-2*l*(s*s/(-2*c)-f+c/2+i-o/2)))/l+r:(r+u)/2}function S(t,e){var n=t.N;if(n)return T(n,e);var r=t.site;return r[1]===e?r[0]:1/0}var O,N,j,P,z=1e-6,D=1e-12;function B(t,e){return e[1]-t[1]||e[0]-t[0]}function R(t,e){var n,r,o,a=t.sort(B).pop();for(P=[],N=new Array(t.length),O=new i,j=new i;;)if(o=y,a&&(!o||a[1]z||Math.abs(i[0][1]-i[1][1])>z)||delete P[o]}(u,f,c,l),function(t,e,n,r){var i,o,a,u,f,c,l,h,d,p,y,b,m=N.length,_=!0;for(i=0;iz||Math.abs(b-d)>z)&&(f.splice(u,0,P.push(s(a,p,Math.abs(y-t)z?[t,Math.abs(h-t)z?[Math.abs(d-r)z?[n,Math.abs(h-n)z?[Math.abs(d-e)=u)return null;var f=t-i.site[0],c=e-i.site[1],s=f*f+c*c;do{i=o.cells[r=a],a=null,i.halfedges.forEach(function(n){var r=o.edges[n],u=r.left;if(u!==i.site&&u||(u=r.right)){var f=t-u[0],c=e-u[1],l=f*f+c*c;lr?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>o?(o+a)/2:Math.min(0,o)||Math.max(0,a))}s.prototype=f.prototype,t.zoom=function(){var t,s,m=d,_=p,x=b,w=v,M=y,A=[0,1/0],k=[[-1/0,-1/0],[1/0,1/0]],C=250,E=r.interpolateZoom,T=e.dispatch("start","zoom","end"),S=500,O=150,N=0;function j(t){t.property("__zoom",g).on("wheel.zoom",L).on("mousedown.zoom",U).on("dblclick.zoom",I).filter(M).on("touchstart.zoom",H).on("touchmove.zoom",q).on("touchend.zoom touchcancel.zoom",V).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function P(t,e){return(e=Math.max(A[0],Math.min(A[1],e)))===t.k?t:new f(e,t.x,t.y)}function z(t,e,n){var r=e[0]-n[0]*t.k,i=e[1]-n[1]*t.k;return r===t.x&&i===t.y?t:new f(t.k,r,i)}function D(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function B(t,e,n){t.on("start.zoom",function(){R(this,arguments).start()}).on("interrupt.zoom end.zoom",function(){R(this,arguments).end()}).tween("zoom",function(){var t=arguments,r=R(this,t),i=_.apply(this,t),o=null==n?D(i):"function"==typeof n?n.apply(this,t):n,a=Math.max(i[1][0]-i[0][0],i[1][1]-i[0][1]),u=this.__zoom,c="function"==typeof e?e.apply(this,t):e,s=E(u.invert(o).concat(a/u.k),c.invert(o).concat(a/c.k));return function(t){if(1===t)t=c;else{var e=s(t),n=a/e[2];t=new f(n,o[0]-e[0]*n,o[1]-e[1]*n)}r.zoom(null,t)}})}function R(t,e,n){return!n&&t.__zooming||new F(t,e)}function F(t,e){this.that=t,this.args=e,this.active=0,this.extent=_.apply(t,e),this.taps=0}function L(){if(m.apply(this,arguments)){var t=R(this,arguments),e=this.__zoom,n=Math.max(A[0],Math.min(A[1],e.k*Math.pow(2,w.apply(this,arguments)))),r=i.mouse(this);if(t.wheel)t.mouse[0][0]===r[0]&&t.mouse[0][1]===r[1]||(t.mouse[1]=e.invert(t.mouse[0]=r)),clearTimeout(t.wheel);else{if(e.k===n)return;t.mouse=[r,e.invert(r)],o.interrupt(this),t.start()}h(),t.wheel=setTimeout(function(){t.wheel=null,t.end()},O),t.zoom("mouse",x(z(P(e,n),t.mouse[0],t.mouse[1]),t.extent,k))}}function U(){if(!s&&m.apply(this,arguments)){var t=R(this,arguments,!0),e=i.select(i.event.view).on("mousemove.zoom",function(){if(h(),!t.moved){var e=i.event.clientX-a,n=i.event.clientY-u;t.moved=e*e+n*n>N}t.zoom("mouse",x(z(t.that.__zoom,t.mouse[0]=i.mouse(t.that),t.mouse[1]),t.extent,k))},!0).on("mouseup.zoom",function(){e.on("mousemove.zoom mouseup.zoom",null),n.dragEnable(i.event.view,t.moved),h(),t.end()},!0),r=i.mouse(this),a=i.event.clientX,u=i.event.clientY;n.dragDisable(i.event.view),l(),t.mouse=[r,this.__zoom.invert(r)],o.interrupt(this),t.start()}}function I(){if(m.apply(this,arguments)){var t=this.__zoom,e=i.mouse(this),n=t.invert(e),r=t.k*(i.event.shiftKey?.5:2),o=x(z(P(t,r),e,n),_.apply(this,arguments),k);h(),C>0?i.select(this).transition().duration(C).call(B,o,e):i.select(this).call(j.transform,o)}}function H(){if(m.apply(this,arguments)){var e,n,r,a,u=i.event.touches,f=u.length,c=R(this,arguments,i.event.changedTouches.length===f);for(l(),n=0;nr&&(e=n,n=r,r=e),function(t){return Math.max(n,Math.min(r,t))}}function _(t,e,n){var r=t[0],i=t[1],o=e[0],a=e[1];return i2?x:_,o=a=null,p}function p(e){return isNaN(e=+e)?n:(o||(o=i(u.map(t),f,c)))(t(h(e)))}return p.invert=function(n){return h(e((a||(a=i(f,u.map(t),r.interpolateNumber)))(n)))},p.domain=function(t){return arguments.length?(u=s.call(t,g),h===y||(h=m(u)),d()):u.slice()},p.range=function(t){return arguments.length?(f=l.call(t),d()):f.slice()},p.rangeRound=function(t){return f=l.call(t),c=r.interpolateRound,d()},p.clamp=function(t){return arguments.length?(h=t?m(u):y,p):h!==y},p.interpolate=function(t){return arguments.length?(c=t,d()):c},p.unknown=function(t){return arguments.length?(n=t,p):n},function(n,r){return t=n,e=r,d()}}function A(t,e){return M()(t,e)}function k(t,e,r,o){var a,u=n.tickStep(t,e,r);switch((o=i.formatSpecifier(null==o?",f":o)).type){case"s":var f=Math.max(Math.abs(t),Math.abs(e));return null!=o.precision||isNaN(a=i.precisionPrefix(u,f))||(o.precision=a),i.formatPrefix(o,f);case"":case"e":case"g":case"p":case"r":null!=o.precision||isNaN(a=i.precisionRound(u,Math.max(Math.abs(t),Math.abs(e))))||(o.precision=a-("e"===o.type));break;case"f":case"%":null!=o.precision||isNaN(a=i.precisionFixed(u))||(o.precision=a-2*("%"===o.type))}return i.format(o)}function C(t){var e=t.domain;return t.ticks=function(t){var r=e();return n.ticks(r[0],r[r.length-1],null==t?10:t)},t.tickFormat=function(t,n){var r=e();return k(r[0],r[r.length-1],null==t?10:t,n)},t.nice=function(r){null==r&&(r=10);var i,o=e(),a=0,u=o.length-1,f=o[a],c=o[u];return c0?(f=Math.floor(f/i)*i,c=Math.ceil(c/i)*i,i=n.tickIncrement(f,c,r)):i<0&&(f=Math.ceil(f*i)/i,c=Math.floor(c*i)/i,i=n.tickIncrement(f,c,r)),i>0?(o[a]=Math.floor(f/i)*i,o[u]=Math.ceil(c/i)*i,e(o)):i<0&&(o[a]=Math.ceil(f*i)/i,o[u]=Math.floor(c*i)/i,e(o)),t},t}function E(t,e){var n,r=0,i=(t=t.slice()).length-1,o=t[r],a=t[i];return a0){for(;dc)break;v.push(h)}}else for(;d=1;--l)if(!((h=s*l)c)break;v.push(h)}}else v=n.ticks(d,p,Math.min(p-d,g)).map(r);return i?v.reverse():v},o.tickFormat=function(t,n){if(null==n&&(n=10===u?".0e":","),"function"!=typeof n&&(n=i.format(n)),t===1/0)return n;null==t&&(t=10);var a=Math.max(1,u*t/o.ticks().length);return function(t){var i=t/r(Math.round(e(t)));return i*u0?o[e-1]:r[0],e=o?[a[o-1],i]:[a[e-1],a[e]]},c.unknown=function(t){return arguments.length?(e=t,c):c},c.thresholds=function(){return a.slice()},c.copy=function(){return t().domain([r,i]).range(f).unknown(e)},u.apply(C(c),arguments)},t.scaleThreshold=function t(){var e,r=[.5],i=[0,1],o=1;function a(t){return t<=t?i[n.bisect(r,t,0,o)]:e}return a.domain=function(t){return arguments.length?(r=l.call(t),o=Math.min(r.length,i.length-1),a):r.slice()},a.range=function(t){return arguments.length?(i=l.call(t),o=Math.min(r.length,i.length-1),a):i.slice()},a.invertExtent=function(t){var e=i.indexOf(t);return[r[e-1],r[e]]},a.unknown=function(t){return arguments.length?(e=t,a):e},a.copy=function(){return t().domain(r).range(i).unknown(e)},u.apply(a,arguments)},t.scaleTime=function(){return u.apply(J(o.timeYear,o.timeMonth,o.timeWeek,o.timeDay,o.timeHour,o.timeMinute,o.timeSecond,o.timeMillisecond,a.timeFormat).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)},t.scaleUtc=function(){return u.apply(J(o.utcYear,o.utcMonth,o.utcWeek,o.utcDay,o.utcHour,o.utcMinute,o.utcSecond,o.utcMillisecond,a.utcFormat).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)},t.scaleSequential=function t(){var e=C(K()(y));return e.copy=function(){return tt(e,t())},f.apply(e,arguments)},t.scaleSequentialLog=function t(){var e=z(K()).domain([1,10]);return e.copy=function(){return tt(e,t()).base(e.base())},f.apply(e,arguments)},t.scaleSequentialPow=et,t.scaleSequentialSqrt=function(){return et.apply(null,arguments).exponent(.5)},t.scaleSequentialSymlog=function t(){var e=R(K());return e.copy=function(){return tt(e,t()).constant(e.constant())},f.apply(e,arguments)},t.scaleSequentialQuantile=function t(){var e=[],r=y;function i(t){if(!isNaN(t=+t))return r((n.bisect(e,t)-1)/(e.length-1))}return i.domain=function(t){if(!arguments.length)return e.slice();e=[];for(var r,o=0,a=t.length;o>1,s=-7,l=n?i-1:0,h=n?-1:1,d=t[e+l];for(l+=h,o=d&(1<<-s)-1,d>>=-s,s+=u;s>0;o=256*o+t[e+l],l+=h,s-=8);for(a=o&(1<<-s)-1,o>>=-s,s+=r;s>0;a=256*a+t[e+l],l+=h,s-=8);if(0===o)o=1-c;else{if(o===f)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,r),o-=c}return(d?-1:1)*a*Math.pow(2,o-r)},n.write=function(t,e,n,r,i,o){var a,u,f,c=8*o-i-1,s=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,p=r?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,a=s):(a=Math.floor(Math.log(e)/Math.LN2),e*(f=Math.pow(2,-a))<1&&(a--,f*=2),(e+=a+l>=1?h/f:h*Math.pow(2,1-l))*f>=2&&(a++,f/=2),a+l>=s?(u=0,a=s):a+l>=1?(u=(e*f-1)*Math.pow(2,i),a+=l):(u=e*Math.pow(2,l-1)*Math.pow(2,i),a=0));i>=8;t[n+d]=255&u,d+=p,u/=256,i-=8);for(a=a<0;t[n+d]=255&a,d+=p,a/=256,c-=8);t[n+d-p]|=128*g}},{}],46:[function(t,e,n){var r=[],i=[],o="insert-css: You need to provide a CSS string. Usage: insertCss(cssString[, options]).";function a(t,e){if(e=e||{},void 0===t)throw new Error(o);var n,a=!0===e.prepend?"prepend":"append",u=void 0!==e.container?e.container:document.querySelector("head"),f=r.indexOf(u);return-1===f&&(f=r.push(u)-1,i[f]={}),void 0!==i[f]&&void 0!==i[f][a]?n=i[f][a]:(n=i[f][a]=function(){var t=document.createElement("style");return t.setAttribute("type","text/css"),t}(),"prepend"===a?u.insertBefore(n,u.childNodes[0]):u.appendChild(n)),65279===t.charCodeAt(0)&&(t=t.substr(1,t.length)),n.styleSheet?n.styleSheet.cssText+=t:n.textContent+=t,n}e.exports=a,e.exports.insertCss=a},{}],47:[function(t,e,n){var r,i,o=e.exports={};function a(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}function f(t){if(r===setTimeout)return setTimeout(t,0);if((r===a||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:a}catch(t){r=a}try{i="function"==typeof clearTimeout?clearTimeout:u}catch(t){i=u}}();var c,s=[],l=!1,h=-1;function d(){l&&c&&(l=!1,c.length?s=c.concat(s):h=-1,s.length&&p())}function p(){if(!l){var t=f(d);l=!0;for(var e=s.length;e;){for(c=s,s=[];++h1)for(var n=1;n>>=e))<<3,(e|=n=(15<(t>>>=n))<<2)|(n=(3<(t>>>=n))<<1)|t>>>n>>1}function u(){function t(t){t:{for(var e=16;268435456>=e;e*=16)if(t<=e){t=e;break t}t=0}return 0<(e=n[a(t)>>2]).length?e.pop():new ArrayBuffer(t)}function e(t){n[a(t.byteLength)>>2].push(t)}var n=o(8,function(){return[]});return{alloc:t,free:e,allocType:function(e,n){var r=null;switch(e){case 5120:r=new Int8Array(t(n),0,n);break;case 5121:r=new Uint8Array(t(n),0,n);break;case 5122:r=new Int16Array(t(2*n),0,n);break;case 5123:r=new Uint16Array(t(2*n),0,n);break;case 5124:r=new Int32Array(t(4*n),0,n);break;case 5125:r=new Uint32Array(t(4*n),0,n);break;case 5126:r=new Float32Array(t(4*n),0,n);break;default:return null}return r.length!==n?r.subarray(0,n):r},freeType:function(t){e(t.buffer)}}}function f(t){return!!t&&"object"==typeof t&&Array.isArray(t.shape)&&Array.isArray(t.stride)&&"number"==typeof t.offset&&t.shape.length===t.stride.length&&(Array.isArray(t.data)||$(t.data))}function c(t,e,n,r,i,o){for(var a=0;a(i=u)&&(i=r.buffer.byteLength,5123===l?i>>=1:5125===l&&(i>>=2)),r.vertCount=i,i=a,0>a&&(i=4,1===(a=r.buffer.dimension)&&(i=0),2===a&&(i=1),3===a&&(i=4)),r.primType=i}function a(t){r.elementsCount--,delete u[t.id],t.buffer.destroy(),t.buffer=null}var u={},c=0,s={uint8:5121,uint16:5123};e.oes_element_index_uint&&(s.uint32=5125),i.prototype.bind=function(){this.buffer.bind()};var l=[];return{create:function(t,e){function u(t){if(t)if("number"==typeof t)c(t),l.primType=4,l.vertCount=0|t,l.type=5121;else{var e=null,n=35044,r=-1,i=-1,a=0,h=0;Array.isArray(t)||$(t)||f(t)?e=t:("data"in t&&(e=t.data),"usage"in t&&(n=J[t.usage]),"primitive"in t&&(r=nt[t.primitive]),"count"in t&&(i=0|t.count),"type"in t&&(h=s[t.type]),"length"in t?a=0|t.length:(a=i,5123===h||5122===h?a*=2:5125!==h&&5124!==h||(a*=4))),o(l,e,n,r,i,a,h)}else c(),l.primType=4,l.vertCount=0,l.type=5121;return u}var c=n.create(null,34963,!0),l=new i(c._buffer);return r.elementsCount++,u(t),u._reglType="elements",u._elements=l,u.subdata=function(t,e){return c.subdata(t,e),u},u.destroy=function(){a(l)},u},createStream:function(t){var e=l.pop();return e||(e=new i(n.create(null,34963,!0,!1)._buffer)),o(e,t,35040,-1,-1,0,0),e},destroyStream:function(t){l.push(t)},getElements:function(t){return"function"==typeof t&&t._elements instanceof i?t._elements:null},clear:function(){G(u).forEach(a)}}}function g(t){for(var e=Y.allocType(5123,t.length),n=0;n>>31<<15,i=(o<<1>>>24)-127,o=o>>13&1023;e[n]=-24>i?r:-14>i?r+(o+1024>>-14-i):15>=i,n.height>>=i,d(n,r[i]),t.mipmask|=1<e;++e)t.images[e]=null;return t}function O(t){for(var e=t.images,n=0;ne){for(var n=0;n=--this.refCount&&R(this)}}),a.profile&&(o.getTotalTextureSize=function(){var t=0;return Object.keys(bt).forEach(function(e){t+=bt[e].stats.size}),t}),{create2D:function(e,n){function r(t,e){var n=i.texInfo;N.call(n);var o=S();return"number"==typeof t?C(o,0|t,"number"==typeof e?0|e:0|t):t?(j(n,t),E(o,t)):C(o,1,1),n.genMipmaps&&(o.mipmask=(o.width<<1)-1),i.mipmask=o.mipmask,c(i,o),i.internalformat=o.internalformat,r.width=o.width,r.height=o.height,D(i),T(o,3553),P(n,3553),B(),O(o),a.profile&&(i.stats.size=M(i.internalformat,i.type,o.width,o.height,n.genMipmaps,!1)),r.format=tt[i.internalformat],r.type=et[i.type],r.mag=nt[n.magFilter],r.min=rt[n.minFilter],r.wrapS=it[n.wrapS],r.wrapT=it[n.wrapT],r}var i=new z(3553);return bt[i.id]=i,o.textureCount++,r(e,n),r.subimage=function(t,e,n,o){e|=0,n|=0,o|=0;var a=y();return c(a,i),a.width=0,a.height=0,d(a,t),a.width=a.width||(i.width>>o)-e,a.height=a.height||(i.height>>o)-n,D(i),p(a,3553,e,n,o),B(),A(a),r},r.resize=function(e,n){var o=0|e,u=0|n||o;if(o===i.width&&u===i.height)return r;r.width=i.width=o,r.height=i.height=u,D(i);for(var f=0;i.mipmask>>f;++f){var c=o>>f,s=u>>f;if(!c||!s)break;t.texImage2D(3553,f,i.format,c,s,0,i.format,i.type,null)}return B(),a.profile&&(i.stats.size=M(i.internalformat,i.type,o,u,!1,!1)),r},r._reglType="texture2d",r._texture=i,a.profile&&(r.stats=i.stats),r.destroy=function(){i.decRef()},r},createCube:function(e,n,r,i,u,f){function l(t,e,n,r,i,o){var u,f=h.texInfo;for(N.call(f),u=0;6>u;++u)g[u]=S();if("number"!=typeof t&&t){if("object"==typeof t)if(e)E(g[0],t),E(g[1],e),E(g[2],n),E(g[3],r),E(g[4],i),E(g[5],o);else if(j(f,t),s(h,t),"faces"in t)for(t=t.faces,u=0;6>u;++u)c(g[u],h),E(g[u],t[u]);else for(u=0;6>u;++u)E(g[u],t)}else for(t=0|t||1,u=0;6>u;++u)C(g[u],t,t);for(c(h,g[0]),h.mipmask=f.genMipmaps?(g[0].width<<1)-1:g[0].mipmask,h.internalformat=g[0].internalformat,l.width=g[0].width,l.height=g[0].height,D(h),u=0;6>u;++u)T(g[u],34069+u);for(P(f,34067),B(),a.profile&&(h.stats.size=M(h.internalformat,h.type,l.width,l.height,f.genMipmaps,!0)),l.format=tt[h.internalformat],l.type=et[h.type],l.mag=nt[f.magFilter],l.min=rt[f.minFilter],l.wrapS=it[f.wrapS],l.wrapT=it[f.wrapT],u=0;6>u;++u)O(g[u]);return l}var h=new z(34067);bt[h.id]=h,o.cubeCount++;var g=Array(6);return l(e,n,r,i,u,f),l.subimage=function(t,e,n,r,i){n|=0,r|=0,i|=0;var o=y();return c(o,h),o.width=0,o.height=0,d(o,e),o.width=o.width||(h.width>>i)-n,o.height=o.height||(h.height>>i)-r,D(h),p(o,34069+t,n,r,i),B(),A(o),l},l.resize=function(e){if((e|=0)!==h.width){l.width=h.width=e,l.height=h.height=e,D(h);for(var n=0;6>n;++n)for(var r=0;h.mipmask>>r;++r)t.texImage2D(34069+n,r,h.format,e>>r,e>>r,0,h.format,h.type,null);return B(),a.profile&&(h.stats.size=M(h.internalformat,h.type,l.width,l.height,!1,!0)),l}},l._reglType="textureCube",l._texture=h,a.profile&&(l.stats=h.stats),l.destroy=function(){h.decRef()},l},clear:function(){for(var e=0;en;++n)if(0!=(e.mipmask&1<>n,e.height>>n,0,e.internalformat,e.type,null);else for(var r=0;6>r;++r)t.texImage2D(34069+r,n,e.internalformat,e.width>>n,e.height>>n,0,e.internalformat,e.type,null);P(e.texInfo,e.target)})},refresh:function(){for(var e=0;ei;++i){for(c=0;ct;++t)n[t].resize(r);return e.width=e.height=r,e},_reglType:"framebufferCube",destroy:function(){n.forEach(function(t){t.destroy()})}})},clear:function(){G(A).forEach(v)},restore:function(){m.cur=null,m.next=null,m.dirty=!0,G(A).forEach(function(e){e.framebuffer=t.createFramebuffer(),y(e)})}})}function C(){this.w=this.z=this.y=this.x=this.state=0,this.buffer=null,this.size=0,this.normalized=!1,this.type=5126,this.divisor=this.stride=this.offset=0}function E(t,e,n,r,i){function o(){this.id=++c,this.attributes=[];var t=e.oes_vertex_array_object;this.vao=t?t.createVertexArrayOES():null,s[this.id]=this,this.buffers=[]}var a=n.maxAttributes,u=Array(a);for(n=0;n=l.byteLength?u.subdata(l):(u.destroy(),n.buffers[a]=null)),n.buffers[a]||(u=n.buffers[a]=i.create(c,34962,!1,!0)),s.buffer=i.getBuffer(u),s.size=0|s.buffer.dimension,s.normalized=!1,s.type=s.buffer.dtype,s.offset=0,s.stride=0,s.divisor=0,s.state=1,r[a]=1;else i.getBuffer(c)?(s.buffer=i.getBuffer(c),s.size=0|s.buffer.dimension,s.normalized=!1,s.type=s.buffer.dtype,s.offset=0,s.stride=0,s.divisor=0,s.state=1):i.getBuffer(c.buffer)?(s.buffer=i.getBuffer(c.buffer),s.size=0|(+c.size||s.buffer.dimension),s.normalized=!!c.normalized||!1,s.type="type"in c?Z[c.type]:s.buffer.dtype,s.offset=0|(c.offset||0),s.stride=0|(c.stride||0),s.divisor=0|(c.divisor||0),s.state=1):"x"in c&&(s.x=+c.x||0,s.y=+c.y||0,s.z=+c.z||0,s.w=+c.w||0,s.state=2)}for(t=0;tt&&(t=e.stats.uniformsCount)}),t},n.getMaxAttributesCount=function(){var t=0;return h.forEach(function(e){e.stats.attributesCount>t&&(t=e.stats.attributesCount)}),t}),{clear:function(){var e=t.deleteShader.bind(t);G(c).forEach(e),c={},G(s).forEach(e),s={},h.forEach(function(e){t.deleteProgram(e.program)}),h.length=0,l={},n.shaderCount=0},program:function(e,r,i,o){var a=l[r];a||(a=l[r]={});var d=a[e];if(d&&(d.refCount++,!o))return d;var p=new u(r,e);return n.shaderCount++,f(p,i,o),d||(a[e]=p),h.push(p),U(p,{destroy:function(){if(p.refCount--,0>=p.refCount){t.deleteProgram(p.program);var e=h.indexOf(p);h.splice(e,1),n.shaderCount--}0>=a[p.vertId].refCount&&(t.deleteShader(s[p.vertId]),delete s[p.vertId],delete l[p.fragId][p.vertId]),Object.keys(l[p.fragId]).length||(t.deleteShader(c[p.fragId]),delete c[p.fragId],delete l[p.fragId])}})},restore:function(){c={},s={};for(var t=0;t"+e+"?"+i+".constant["+e+"]:0;"}).join(""),"}}else{","if(",u,"(",i,".buffer)){",s,"=",o,".createStream(",34962,",",i,".buffer);","}else{",s,"=",o,".getBuffer(",i,".buffer);","}",l,'="type" in ',i,"?",a.glTypes,"[",i,".type]:",s,".dtype;",f.normalized,"=!!",i,".normalized;"),r("size"),r("offset"),r("stride"),r("divisor"),n("}}"),n.exit("if(",f.isStream,"){",o,".destroyStream(",s,");","}"),f})}),a}function k(t,e,r,i,a){function u(t){var e=c[t];e&&(h[t]=e)}var f=function(t,e){if("string"==typeof(n=t.static).frag&&"string"==typeof n.vert){if(0>1)",u],");")}function e(){n(f,".drawArraysInstancedANGLE(",[p,g,v,u],");")}d?b?t():(n("if(",d,"){"),t(),n("}else{"),e(),n("}")):e()}function a(){function t(){n(s+".drawElements("+[p,v,y,g+"<<(("+y+"-5121)>>1)"]+");")}function e(){n(s+".drawArrays("+[p,g,v]+");")}d?b?t():(n("if(",d,"){"),t(),n("}else{"),e(),n("}")):e()}var u,f,c=t.shared,s=c.gl,l=c.draw,h=r.draw,d=function(){var i=h.elements,o=e;return i?((i.contextDep&&r.contextDynamic||i.propDep)&&(o=n),i=i.append(t,o)):i=o.def(l,".","elements"),i&&o("if("+i+")"+s+".bindBuffer(34963,"+i+".buffer.buffer);"),i}(),p=i("primitive"),g=i("offset"),v=function(){var i=h.count,o=e;return i?((i.contextDep&&r.contextDynamic||i.propDep)&&(o=n),i=i.append(t,o)):i=o.def(l,".","count"),i}();if("number"==typeof v){if(0===v)return}else n("if(",v,"){"),n.exit("}");tt&&(u=i("instances"),f=t.instancing);var y=d+".type",b=h.elements&&D(h.elements);tt&&("number"!=typeof u||0<=u)?"string"==typeof u?(n("if(",u,">0){"),o(),n("}else if(",u,"<0){"),a(),n("}")):o():a()}function Y(t,e,n,r,i){return i=(e=_()).proc("body",i),tt&&(e.instancing=i.def(e.shared.extensions,".angle_instanced_arrays")),t(e,i,n,r),e.compile().body}function W(t,e,n,r){F(t,e),n.useVAO?n.drawVAO?e(t.shared.vao,".setVAO(",n.drawVAO.append(t,e),");"):e(t.shared.vao,".setVAO(",t.shared.vao,".targetVAO);"):(e(t.shared.vao,".setVAO(null);"),I(t,e,n,r.attributes,function(){return!0})),q(t,e,n,r.uniforms,function(){return!0}),V(t,e,e,n)}function $(t,e,n,r){function i(){return!0}t.batchId="a1",F(t,e),I(t,e,n,r.attributes,i),q(t,e,n,r.uniforms,i),V(t,e,e,n)}function G(t,e,n,r){function i(t){return t.contextDep&&a||t.propDep}function o(t){return!i(t)}F(t,e);var a=n.contextDep,u=e.def(),f=e.def();t.shared.props=f,t.batchId=u;var c=t.scope(),s=t.scope();e(c.entry,"for(",u,"=0;",u,"<","a1",";++",u,"){",f,"=","a0","[",u,"];",s,"}",c.exit),n.needsContext&&C(t,s,n.context),n.needsFramebuffer&&E(t,s,n.framebuffer),S(t,s,n.state,i),n.profile&&i(n.profile)&&L(t,s,n,!1,!0),r?(n.useVAO?n.drawVAO?i(n.drawVAO)?s(t.shared.vao,".setVAO(",n.drawVAO.append(t,s),");"):c(t.shared.vao,".setVAO(",n.drawVAO.append(t,c),");"):c(t.shared.vao,".setVAO(",t.shared.vao,".targetVAO);"):(c(t.shared.vao,".setVAO(null);"),I(t,c,n,r.attributes,o),I(t,s,n,r.attributes,i)),q(t,c,n,r.uniforms,o),q(t,s,n,r.uniforms,i),V(t,c,s,n)):(e=t.global.def("{}"),r=n.shader.progVar.append(t,s),f=s.def(r,".id"),c=s.def(e,"[",f,"]"),s(t.shared.gl,".useProgram(",r,".program);","if(!",c,"){",c,"=",e,"[",f,"]=",t.link(function(e){return Y($,t,n,e,2)}),"(",r,");}",c,".call(this,a0[",u,"],",u,");"))}function X(t,n){function r(e){var r=n.shader[e];r&&i.set(o.shader,"."+e,r.append(t,i))}var i=t.proc("scope",3);t.batchId="a2";var o=t.shared,a=o.current;C(t,i,n.context),n.framebuffer&&n.framebuffer.append(t,i),P(Object.keys(n.state)).forEach(function(e){var r=n.state[e].append(t,i);v(r)?r.forEach(function(n,r){i.set(t.next[e],"["+r+"]",n)}):i.set(o.next,"."+e,r)}),L(t,i,n,!0,!0),["elements","offset","count","instances","primitive"].forEach(function(e){var r=n.draw[e];r&&i.set(o.draw,"."+e,""+r.append(t,i))}),Object.keys(n.uniforms).forEach(function(r){var a=n.uniforms[r].append(t,i);Array.isArray(a)&&(a="["+a.join()+"]"),i.set(o.uniforms,"["+e.id(r)+"]",a)}),Object.keys(n.attributes).forEach(function(e){var r=n.attributes[e].append(t,i),o=t.scopeAttrib(e);Object.keys(new J).forEach(function(t){i.set(o,"."+t,r[t])})}),n.scopeVAO&&i.set(o.vao,".targetVAO",n.scopeVAO.append(t,i)),r("vert"),r("frag"),0=--this.refCount&&a(this)},i.profile&&(r.getTotalRenderbufferSize=function(){var t=0;return Object.keys(s).forEach(function(e){t+=s[e].stats.size}),t}),{create:function(e,n){function a(e,n){var r=0,o=0,s=32854;if("object"==typeof e&&e?("shape"in e?(r=0|(o=e.shape)[0],o=0|o[1]):("radius"in e&&(r=o=0|e.radius),"width"in e&&(r=0|e.width),"height"in e&&(o=0|e.height)),"format"in e&&(s=u[e.format])):"number"==typeof e?(r=0|e,o="number"==typeof n?0|n:r):e||(r=o=1),r!==c.width||o!==c.height||s!==c.format)return a.width=c.width=r,a.height=c.height=o,c.format=s,t.bindRenderbuffer(36161,c.renderbuffer),t.renderbufferStorage(36161,s,r,o),i.profile&&(c.stats.size=yt[c.format]*c.width*c.height),a.format=f[c.format],a}var c=new o(t.createRenderbuffer());return s[c.id]=c,r.renderbufferCount++,a(e,n),a.resize=function(e,n){var r=0|e,o=0|n||r;return r===c.width&&o===c.height?a:(a.width=c.width=r,a.height=c.height=o,t.bindRenderbuffer(36161,c.renderbuffer),t.renderbufferStorage(36161,c.format,r,o),i.profile&&(c.stats.size=yt[c.format]*c.width*c.height),a)},a._reglType="renderbuffer",a._renderbuffer=c,i.profile&&(a.stats=c.stats),a.destroy=function(){c.decRef()},a},clear:function(){G(s).forEach(a)},restore:function(){G(s).forEach(function(e){e.renderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(36161,e.renderbuffer),t.renderbufferStorage(36161,e.format,e.width,e.height)}),t.bindRenderbuffer(36161,null)}}},mt=[];mt[6408]=4,mt[6407]=3;var _t=[];_t[5121]=1,_t[5126]=4,_t[36193]=2;var xt=["x","y","z","w"],wt="blend.func blend.equation stencil.func stencil.opFront stencil.opBack sample.coverage viewport scissor.box polygonOffset.offset".split(" "),Mt={0:0,1:1,zero:0,one:1,"src color":768,"one minus src color":769,"src alpha":770,"one minus src alpha":771,"dst color":774,"one minus dst color":775,"dst alpha":772,"one minus dst alpha":773,"constant color":32769,"one minus constant color":32770,"constant alpha":32771,"one minus constant alpha":32772,"src alpha saturate":776},At={never:512,less:513,"<":513,equal:514,"=":514,"==":514,"===":514,lequal:515,"<=":515,greater:516,">":516,notequal:517,"!=":517,"!==":517,gequal:518,">=":518,always:519},kt={0:0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},Ct={cw:2304,ccw:2305},Et=new z(!1,!1,!1,function(){});return function(t){function e(){if(0===Q.length)w&&w.update(),tt=null;else{tt=q.next(e),l();for(var t=Q.length-1;0<=t;--t){var n=Q[t];n&&n(N,null,0)}v.flush(),w&&w.update()}}function n(){!tt&&0=Q.length&&r()}}}}function s(){var t=G.viewport,e=G.scissor_box;t[0]=t[1]=e[0]=e[1]=0,N.viewportWidth=N.framebufferWidth=N.drawingBufferWidth=t[2]=e[2]=v.drawingBufferWidth,N.viewportHeight=N.framebufferHeight=N.drawingBufferHeight=t[3]=e[3]=v.drawingBufferHeight}function l(){N.tick+=1,N.time=g(),s(),$.procs.poll()}function h(){R.refresh(),s(),$.procs.refresh(),w&&w.update()}function g(){return(V()-M)/1e3}if(!(t=i(t)))return null;var v=t.gl,y=v.getContextAttributes();v.isContextLost();var b=function(t,e){function n(e){var n;e=e.toLowerCase();try{n=r[e]=t.getExtension(e)}catch(t){}return!!n}for(var r={},i=0;ie;++e)et(U({framebuffer:t.framebuffer.faces[e]},t),f);else et(t,f);else f(0,t)},prop:H.define.bind(null,1),context:H.define.bind(null,2),this:H.define.bind(null,3),draw:u({}),buffer:function(t){return P.create(t,34962,!1,!1)},elements:function(t){return D.create(t,!1)},texture:R.create2D,cube:R.createCube,renderbuffer:I.create,framebuffer:Y.create,framebufferCube:Y.createCube,vao:z.createVAO,attributes:y,frame:c,on:function(t,e){var n;switch(t){case"frame":return c(e);case"lost":n=Z;break;case"restore":n=J;break;case"destroy":n=K}return n.push(e),{cancel:function(){for(var t=0;tt.length)&&(e=t.length);for(var n=0,r=new Array(e);n1&&void 0!==arguments[1]?arguments[1]:256;return new Uint8ClampedArray(c.quantize(t,e).map(function(t){return[(t=c.rgb(t)).r,t.g,t.b,255]}).flat())}},{"./configure-linear-scales.js":49,"./configure-uniforms.js":50,"./configure-viewport.js":51,"./create-zoom.js":52,"./draw-box.js":53,"./draw-points.js":54,"controls-gui":3,"controls-state":4,d3:35,"fail-nicely":37,"gl-mat4/create":40,"gl-mat4/fromScaling":41,"gl-mat4/invert":42,"gl-mat4/multiply":43,"insert-css":46,regl:48}],56:[function(t,e,n){"use strict";e.exports=function(t,e){var n=e.x.domain(),r=e.y.domain(),i=2/(n[1]-n[0]),o=2/(r[1]-r[0]);return t[0]=i,t[1]=0,t[2]=0,t[3]=0,t[4]=o,t[5]=0,t[6]=-1-i*n[0],t[7]=-1-o*r[0],t[8]=1,t}},{}],57:[function(t,e,n){"use strict";e.exports=function(t,e){t[0]=e[0],t[1]=e[1],t[2]=0,t[3]=e[2],t[4]=e[3],t[5]=e[4],t[6]=0,t[7]=e[5],t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e[6],t[13]=e[7],t[14]=0,t[15]=e[8]}},{}]},{},[55]); \ No newline at end of file diff --git a/quasiinfinite-zoom/index.html b/quasiinfinite-zoom/index.html new file mode 100644 index 0000000..9943a38 --- /dev/null +++ b/quasiinfinite-zoom/index.html @@ -0,0 +1,13 @@ +Quasiinfinite zoom + + + + + + + + + + + + \ No newline at end of file diff --git a/sketches/index.html b/sketches/index.html index ff0e578..07f83aa 100644 --- a/sketches/index.html +++ b/sketches/index.html @@ -20,7 +20,7 @@ -

Sketches

A set of experiments and explorations, mostly using the regl WebGL library, some computed on the GPU and some on the CPU. The source for all content and projects on this site can be found here.

Comments? Questions? Let me know @rreusser@mathstodon.xyz.

Cubic Roots ↔︎ Equilateral TriangleAn interactive reproduction of a diagram by Freya HolmérCalabi-Yau ManifoldsA simple plot of Calabi-Yau manifolds; nothing more, nothing lessLawson's Klein Bottle3D sterographic projection of a 4D Klein bottleBoy's SurfaceAn immersion of the real projective plane in 3D spaceClifford Torus3D sterographic projection of a 4D Clifford torusK-MeansLive k-means on a video feed with Lloyd's algorithmMoiréJust moiréIkeda MapA discrete chaotic attractorHertzsprung-Russell DiagramStar magnitudes and temperaturesMandelbrotDrawing the first iterations of the Mandelbrot set as a complex functionPulsarSignals and noise (no physical significance)Multiscale Turing PatternsMultiscale turing patterns, as described by Jonathan McCabeMagnetJust a magnetic fieldPotential FlowProcedural (almost) potential flow with curl noiseUeda AttractorUeda's chaotic nonlinear oscillatorSingle-slit diffractionDiffraction of a 1D wavefunction through a slit using Feynman's path integral approachFibonacci SphereFrom Martin Roberts' article about evenly distributed points on a sphereGray Scott Reaction DiffusionReacting species diffusing at different ratesRule 30Stephen Wolfram's 1D cellular automataLine Integral ConvolutionVisualizing vector fields with Line Integral Convolution (LIC)Rigid Point Cloud AlignmentAligning point clouds with the Iterative Closest Point methodSpherical HarmonicsJust a plot of the first few spherical harmonicsDomain Coloring with Contour ScalingUsing OES_standard_derivatives to scale contours to the local gradient of a functionFlamm's ParaboloidScroll to build Flamm's ParaboloidContinuum GravityOne million particles interacting gravitationally via a Poisson equation solved on a 2D gridKuramoto-SivashinskyIntegrating the 2D Kuramoto-Sivashinsky Equation, ∂u/∂t + ∇⁴u + ∇²u + ½ |∇u|² = 0Karman-Trefftz AirfoilFlow over an airfoil, computed with the Karman-Trefftz conformal map and visualized on the GPUPeriodic Three-Body OrbitsPeriodic solutions of three bodies interacting via Newtonian gravityHydrodynamic InstabilitiesThe Kelvin-Helmholtz and Rayleigh-Taylor hydrodynamic instabilitiesStrange AttractorsStrange attractors on the GPUSchwarzschild TrajectoriesIntegrating particle geodesics in Schwarzschild spacetime (a black hole).Polynomial RootsRoots of a polynomial with random coefficients, plotted in the complex planeUmbilic TorusUmbilic TorusLamb Wave Dispersion RelationPlotting the the complex dispersion relation for elastodynamic plate waves; zeros represent valid modesFluid SimluationClassic semi-Lagrangian fluid simulation from Visual Simulation of SmokeErosionAn ad-hoc particle-based terrain erosion algorithm, computed on the GPUCentripetal B-SplinesExperimenting with centripetal parameterization for B-splinesSmooth LifeConway's Game of Life, generalized to a continuum and solved on the GPULogistic MapThe chaotic logistic map, computed and displayed on the GPUNosé-Hoover AttractorPlotting a strange attractor with 2D rectanglesVortexA vortex, rendered as a single signed distance functionK-means clusteringWIP refactoring of the kmpp npm moduleDouble PendulumAccumulating long-term patterns in a chaotic double-pendulum
+

Sketches

A set of experiments and explorations, mostly using the regl WebGL library, some computed on the GPU and some on the CPU. The source for all content and projects on this site can be found here.

Comments? Questions? Let me know @rreusser@mathstodon.xyz.

Quasiinfinite zoomRepeated quasirandom points to create the illusion of infinite zoomCubic Roots ↔︎ Equilateral TriangleAn interactive reproduction of a diagram by Freya HolmérCalabi-Yau ManifoldsA simple plot of Calabi-Yau manifolds; nothing more, nothing lessLawson's Klein Bottle3D sterographic projection of a 4D Klein bottleBoy's SurfaceAn immersion of the real projective plane in 3D spaceClifford Torus3D sterographic projection of a 4D Clifford torusK-MeansLive k-means on a video feed with Lloyd's algorithmMoiréJust moiréIkeda MapA discrete chaotic attractorHertzsprung-Russell DiagramStar magnitudes and temperaturesMandelbrotDrawing the first iterations of the Mandelbrot set as a complex functionPulsarSignals and noise (no physical significance)Multiscale Turing PatternsMultiscale turing patterns, as described by Jonathan McCabeMagnetJust a magnetic fieldPotential FlowProcedural (almost) potential flow with curl noiseUeda AttractorUeda's chaotic nonlinear oscillatorSingle-slit diffractionDiffraction of a 1D wavefunction through a slit using Feynman's path integral approachFibonacci SphereFrom Martin Roberts' article about evenly distributed points on a sphereGray Scott Reaction DiffusionReacting species diffusing at different ratesRule 30Stephen Wolfram's 1D cellular automataLine Integral ConvolutionVisualizing vector fields with Line Integral Convolution (LIC)Rigid Point Cloud AlignmentAligning point clouds with the Iterative Closest Point methodSpherical HarmonicsJust a plot of the first few spherical harmonicsDomain Coloring with Contour ScalingUsing OES_standard_derivatives to scale contours to the local gradient of a functionFlamm's ParaboloidScroll to build Flamm's ParaboloidContinuum GravityOne million particles interacting gravitationally via a Poisson equation solved on a 2D gridKuramoto-SivashinskyIntegrating the 2D Kuramoto-Sivashinsky Equation, ∂u/∂t + ∇⁴u + ∇²u + ½ |∇u|² = 0Karman-Trefftz AirfoilFlow over an airfoil, computed with the Karman-Trefftz conformal map and visualized on the GPUPeriodic Three-Body OrbitsPeriodic solutions of three bodies interacting via Newtonian gravityHydrodynamic InstabilitiesThe Kelvin-Helmholtz and Rayleigh-Taylor hydrodynamic instabilitiesStrange AttractorsStrange attractors on the GPUSchwarzschild TrajectoriesIntegrating particle geodesics in Schwarzschild spacetime (a black hole).Polynomial RootsRoots of a polynomial with random coefficients, plotted in the complex planeUmbilic TorusUmbilic TorusLamb Wave Dispersion RelationPlotting the the complex dispersion relation for elastodynamic plate waves; zeros represent valid modesFluid SimluationClassic semi-Lagrangian fluid simulation from Visual Simulation of SmokeErosionAn ad-hoc particle-based terrain erosion algorithm, computed on the GPUCentripetal B-SplinesExperimenting with centripetal parameterization for B-splinesSmooth LifeConway's Game of Life, generalized to a continuum and solved on the GPULogistic MapThe chaotic logistic map, computed and displayed on the GPUNosé-Hoover AttractorPlotting a strange attractor with 2D rectanglesVortexA vortex, rendered as a single signed distance functionK-means clusteringWIP refactoring of the kmpp npm moduleDouble PendulumAccumulating long-term patterns in a chaotic double-pendulum
diff --git a/sketches/index.js b/sketches/index.js index 2b9c282..25df277 100644 --- a/sketches/index.js +++ b/sketches/index.js @@ -52,7 +52,7 @@ var j=i("buffer"),I=j.Buffer;function copyProps(i,x){for(var _ in i)x[_]=i[_]}fu * Released under the MIT License. */ "use strict";x.exports=function(i){return"string"==typeof i&&"\ufeff"===i.charAt(0)?i.slice(1):i}},{}],"/Users/rickyreusser/gh/rreusser/rreusser.github.io/src/node_modules/swap-case/swap-case.js":[function(i,x,_){"use strict";var j=i("upper-case"),I=i("lower-case");x.exports=function(i,x){if(null==i)return"";for(var _="",$=0;$=0&&(i._idleTimeoutId=setTimeout((function(){i._onTimeout&&i._onTimeout()}),x))},_.setImmediate="function"==typeof x?x:function(i){var x=ce++,j=!(arguments.length<2)&&Y.call(arguments,1);return ie[x]=!0,I((function(){ie[x]&&(j?i.apply(null,j):i.call(null),_.clearImmediate(x))})),x},_.clearImmediate="function"==typeof j?j:function(i){delete ie[i]}}).call(this)}).call(this,i("timers").setImmediate,i("timers").clearImmediate)},{"process/browser.js":"/Users/rickyreusser/gh/rreusser/rreusser.github.io/src/node_modules/process/browser.js",timers:"/Users/rickyreusser/gh/rreusser/rreusser.github.io/src/node_modules/timers-browserify/main.js"}],"/Users/rickyreusser/gh/rreusser/rreusser.github.io/src/node_modules/title-case/title-case.js":[function(i,x,_){"use strict";var j=i("no-case"),I=i("upper-case");x.exports=function(i,x){return j(i,x).replace(/^.| ./g,(function(i){return I(i,x)}))}},{"no-case":"/Users/rickyreusser/gh/rreusser/rreusser.github.io/src/node_modules/no-case/no-case.js","upper-case":"/Users/rickyreusser/gh/rreusser/rreusser.github.io/src/node_modules/upper-case/upper-case.js"}],"/Users/rickyreusser/gh/rreusser/rreusser.github.io/src/node_modules/upper-case-first/upper-case-first.js":[function(i,x,_){"use strict";var j=i("upper-case");x.exports=function(i,x){return null==i?"":(i=String(i),j(i.charAt(0),x)+i.substr(1))}},{"upper-case":"/Users/rickyreusser/gh/rreusser/rreusser.github.io/src/node_modules/upper-case/upper-case.js"}],"/Users/rickyreusser/gh/rreusser/rreusser.github.io/src/node_modules/upper-case/upper-case.js":[function(i,x,_){"use strict";var j={tr:{regexp:/[\u0069]/g,map:{i:"İ"}},az:{regexp:/[\u0069]/g,map:{i:"İ"}},lt:{regexp:/[\u0069\u006A\u012F]\u0307|\u0069\u0307[\u0300\u0301\u0303]/g,map:{"i̇":"I","j̇":"J","į̇":"Į","i̇̀":"Ì","i̇́":"Í","i̇̃":"Ĩ"}}};x.exports=function(i,x){var _=j[x];return i=null==i?"":String(i),_&&(i=i.replace(_.regexp,(function(i){return _.map[i]}))),i.toUpperCase()}},{}],"/Users/rickyreusser/gh/rreusser/rreusser.github.io/src/node_modules/uri-js/dist/es5/uri.all.js":[function(i,x,_){"use strict";var j="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(i){return typeof i}:function(i){return i&&"function"==typeof Symbol&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i}; -/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */!function(i,I){"object"===(void 0===_?"undefined":j(_))&&void 0!==x?I(_):"function"==typeof define&&define.amd?define(["exports"],I):I(i.URI=i.URI||{})}(void 0,(function(i){function merge(){for(var i=arguments.length,x=Array(i),_=0;_1){x[0]=x[0].slice(0,-1);for(var j=x.length-1,I=1;I= 0x80 (not a basic code point)","invalid-input":"Invalid input"},ce=Math.floor,de=String.fromCharCode;function error$1(i){throw new RangeError(ie[i])}function mapDomain(i,x){var _=i.split("@"),j="";_.length>1&&(j=_[0]+"@",i=_[1]);var I=function(i,x){for(var _=[],j=i.length;j--;)_[j]=x(i[j]);return _}((i=i.replace(Y,".")).split("."),x).join(".");return j+I}function ucs2decode(i){for(var x=[],_=0,j=i.length;_=55296&&I<=56319&&_>1,i+=ce(i/x);i>455;j+=36)i=ce(i/35);return ce(j+36*i/(i+38))},decode=function(i){var x,_=[],I=i.length,$=0,Y=128,ie=72,de=i.lastIndexOf("-");de<0&&(de=0);for(var he=0;he=128&&error$1("not-basic"),_.push(i.charCodeAt(he));for(var ge=de>0?de+1:0;ge=I&&error$1("invalid-input");var je=(x=i.charCodeAt(ge++))-48<10?x-22:x-65<26?x-65:x-97<26?x-97:36;(je>=36||je>ce((j-$)/ke))&&error$1("overflow"),$+=je*ke;var Fe=Se<=ie?1:Se>=ie+26?26:Se-ie;if(jece(j/Re)&&error$1("overflow"),ke*=Re}var Ne=_.length+1;ie=adapt($-_e,Ne,0==_e),ce($/Ne)>j-Y&&error$1("overflow"),Y+=ce($/Ne),$%=Ne,_.splice($++,0,Y)}return String.fromCodePoint.apply(String,_)},encode=function(i){var x=[],_=(i=ucs2decode(i)).length,I=128,$=0,Y=72,ie=!0,he=!1,ge=void 0;try{for(var _e,ke=i[Symbol.iterator]();!(ie=(_e=ke.next()).done);ie=!0){var Se=_e.value;Se<128&&x.push(de(Se))}}catch(i){he=!0,ge=i}finally{try{!ie&&ke.return&&ke.return()}finally{if(he)throw ge}}var je=x.length,Fe=je;for(je&&x.push("-");Fe<_;){var Re=j,Ne=!0,$e=!1,We=void 0;try{for(var Ye,Je=i[Symbol.iterator]();!(Ne=(Ye=Je.next()).done);Ne=!0){var Xe=Ye.value;Xe>=I&&Xece((j-$)/Ze)&&error$1("overflow"),$+=(Re-I)*Ze,I=Re;var et=!0,tt=!1,rt=void 0;try{for(var nt,it=i[Symbol.iterator]();!(et=(nt=it.next()).done);et=!0){var ot=nt.value;if(otj&&error$1("overflow"),ot==I){for(var st=$,at=36;;at+=36){var ut=at<=Y?1:at>=Y+26?26:at-Y;if(st>6|192).toString(16).toUpperCase()+"%"+(63&x|128).toString(16).toUpperCase():"%"+(x>>12|224).toString(16).toUpperCase()+"%"+(x>>6&63|128).toString(16).toUpperCase()+"%"+(63&x|128).toString(16).toUpperCase()}function pctDecChars(i){for(var x="",_=0,j=i.length;_=194&&I<224){if(j-_>=6){var $=parseInt(i.substr(_+4,2),16);x+=String.fromCharCode((31&I)<<6|63&$)}else x+=i.substr(_,6);_+=6}else if(I>=224){if(j-_>=9){var Y=parseInt(i.substr(_+4,2),16),ie=parseInt(i.substr(_+7,2),16);x+=String.fromCharCode((15&I)<<12|(63&Y)<<6|63&ie)}else x+=i.substr(_,9);_+=9}else x+=i.substr(_,3),_+=3}return x}function _normalizeComponentEncoding(i,x){function decodeUnreserved(i){var _=pctDecChars(i);return _.match(x.UNRESERVED)?_:i}return i.scheme&&(i.scheme=String(i.scheme).replace(x.PCT_ENCODED,decodeUnreserved).toLowerCase().replace(x.NOT_SCHEME,"")),void 0!==i.userinfo&&(i.userinfo=String(i.userinfo).replace(x.PCT_ENCODED,decodeUnreserved).replace(x.NOT_USERINFO,pctEncChar).replace(x.PCT_ENCODED,toUpperCase)),void 0!==i.host&&(i.host=String(i.host).replace(x.PCT_ENCODED,decodeUnreserved).toLowerCase().replace(x.NOT_HOST,pctEncChar).replace(x.PCT_ENCODED,toUpperCase)),void 0!==i.path&&(i.path=String(i.path).replace(x.PCT_ENCODED,decodeUnreserved).replace(i.scheme?x.NOT_PATH:x.NOT_PATH_NOSCHEME,pctEncChar).replace(x.PCT_ENCODED,toUpperCase)),void 0!==i.query&&(i.query=String(i.query).replace(x.PCT_ENCODED,decodeUnreserved).replace(x.NOT_QUERY,pctEncChar).replace(x.PCT_ENCODED,toUpperCase)),void 0!==i.fragment&&(i.fragment=String(i.fragment).replace(x.PCT_ENCODED,decodeUnreserved).replace(x.NOT_FRAGMENT,pctEncChar).replace(x.PCT_ENCODED,toUpperCase)),i}function _stripLeadingZeros(i){return i.replace(/^0*(.*)/,"$1")||"0"}function _normalizeIPv4(i,x){var _=i.match(x.IPV4ADDRESS)||[],j=slicedToArray(_,2)[1];return j?j.split(".").map(_stripLeadingZeros).join("."):i}function _normalizeIPv6(i,x){var _=i.match(x.IPV6ADDRESS)||[],j=slicedToArray(_,3),I=j[1],$=j[2];if(I){for(var Y=I.toLowerCase().split("::").reverse(),ie=slicedToArray(Y,2),ce=ie[0],de=ie[1],he=de?de.split(":").map(_stripLeadingZeros):[],ge=ce.split(":").map(_stripLeadingZeros),_e=x.IPV4ADDRESS.test(ge[ge.length-1]),ke=_e?7:8,Se=ge.length-ke,je=Array(ke),Fe=0;Fe1){var $e=je.slice(0,Re.index),We=je.slice(Re.index+Re.length);Ne=$e.join(":")+"::"+We.join(":")}else Ne=je.join(":");return $&&(Ne+="%"+$),Ne}return i}var ge=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,_e=void 0==="".match(/(){0}/)[1];function parse(i){var j=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},I={},$=!1!==j.iri?_:x;"suffix"===j.reference&&(i=(j.scheme?j.scheme+":":"")+"//"+i);var Y=i.match(ge);if(Y){_e?(I.scheme=Y[1],I.userinfo=Y[3],I.host=Y[4],I.port=parseInt(Y[5],10),I.path=Y[6]||"",I.query=Y[7],I.fragment=Y[8],isNaN(I.port)&&(I.port=Y[5])):(I.scheme=Y[1]||void 0,I.userinfo=-1!==i.indexOf("@")?Y[3]:void 0,I.host=-1!==i.indexOf("//")?Y[4]:void 0,I.port=parseInt(Y[5],10),I.path=Y[6]||"",I.query=-1!==i.indexOf("?")?Y[7]:void 0,I.fragment=-1!==i.indexOf("#")?Y[8]:void 0,isNaN(I.port)&&(I.port=i.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?Y[4]:void 0)),I.host&&(I.host=_normalizeIPv6(_normalizeIPv4(I.host,$),$)),void 0!==I.scheme||void 0!==I.userinfo||void 0!==I.host||void 0!==I.port||I.path||void 0!==I.query?void 0===I.scheme?I.reference="relative":void 0===I.fragment?I.reference="absolute":I.reference="uri":I.reference="same-document",j.reference&&"suffix"!==j.reference&&j.reference!==I.reference&&(I.error=I.error||"URI is not a "+j.reference+" reference.");var ie=he[(j.scheme||I.scheme||"").toLowerCase()];if(j.unicodeSupport||ie&&ie.unicodeSupport)_normalizeComponentEncoding(I,$);else{if(I.host&&(j.domainHost||ie&&ie.domainHost))try{I.host=punycode_toASCII(I.host.replace($.PCT_ENCODED,pctDecChars).toLowerCase())}catch(i){I.error=I.error||"Host's domain name can not be converted to ASCII via punycode: "+i}_normalizeComponentEncoding(I,x)}ie&&ie.parse&&ie.parse(I,j)}else I.error=I.error||"URI can not be parsed.";return I}function _recomposeAuthority(i,j){var I=!1!==j.iri?_:x,$=[];return void 0!==i.userinfo&&($.push(i.userinfo),$.push("@")),void 0!==i.host&&$.push(_normalizeIPv6(_normalizeIPv4(String(i.host),I),I).replace(I.IPV6ADDRESS,(function(i,x,_){return"["+x+(_?"%25"+_:"")+"]"}))),"number"!=typeof i.port&&"string"!=typeof i.port||($.push(":"),$.push(String(i.port))),$.length?$.join(""):void 0}var ke=/^\.\.?\//,Se=/^\/\.(\/|$)/,je=/^\/\.\.(\/|$)/,Fe=/^\/?(?:.|\n)*?(?=\/|$)/;function removeDotSegments(i){for(var x=[];i.length;)if(i.match(ke))i=i.replace(ke,"");else if(i.match(Se))i=i.replace(Se,"/");else if(i.match(je))i=i.replace(je,"/"),x.pop();else if("."===i||".."===i)i="";else{var _=i.match(Fe);if(!_)throw new Error("Unexpected dot segment condition");var j=_[0];i=i.slice(j.length),x.push(j)}return x.join("")}function serialize(i){var j=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},I=j.iri?_:x,$=[],Y=he[(j.scheme||i.scheme||"").toLowerCase()];if(Y&&Y.serialize&&Y.serialize(i,j),i.host)if(I.IPV6ADDRESS.test(i.host));else if(j.domainHost||Y&&Y.domainHost)try{i.host=j.iri?punycode_toUnicode(i.host):punycode_toASCII(i.host.replace(I.PCT_ENCODED,pctDecChars).toLowerCase())}catch(x){i.error=i.error||"Host's domain name can not be converted to "+(j.iri?"Unicode":"ASCII")+" via punycode: "+x}_normalizeComponentEncoding(i,I),"suffix"!==j.reference&&i.scheme&&($.push(i.scheme),$.push(":"));var ie=_recomposeAuthority(i,j);if(void 0!==ie&&("suffix"!==j.reference&&$.push("//"),$.push(ie),i.path&&"/"!==i.path.charAt(0)&&$.push("/")),void 0!==i.path){var ce=i.path;j.absolutePath||Y&&Y.absolutePath||(ce=removeDotSegments(ce)),void 0===ie&&(ce=ce.replace(/^\/\//,"/%2F")),$.push(ce)}return void 0!==i.query&&($.push("?"),$.push(i.query)),void 0!==i.fragment&&($.push("#"),$.push(i.fragment)),$.join("")}function resolveComponents(i,x){var _=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},j=arguments[3],I={};return j||(i=parse(serialize(i,_),_),x=parse(serialize(x,_),_)),!(_=_||{}).tolerant&&x.scheme?(I.scheme=x.scheme,I.userinfo=x.userinfo,I.host=x.host,I.port=x.port,I.path=removeDotSegments(x.path||""),I.query=x.query):(void 0!==x.userinfo||void 0!==x.host||void 0!==x.port?(I.userinfo=x.userinfo,I.host=x.host,I.port=x.port,I.path=removeDotSegments(x.path||""),I.query=x.query):(x.path?("/"===x.path.charAt(0)?I.path=removeDotSegments(x.path):(void 0===i.userinfo&&void 0===i.host&&void 0===i.port||i.path?i.path?I.path=i.path.slice(0,i.path.lastIndexOf("/")+1)+x.path:I.path=x.path:I.path="/"+x.path,I.path=removeDotSegments(I.path)),I.query=x.query):(I.path=i.path,void 0!==x.query?I.query=x.query:I.query=i.query),I.userinfo=i.userinfo,I.host=i.host,I.port=i.port),I.scheme=i.scheme),I.fragment=x.fragment,I}function unescapeComponent(i,j){return i&&i.toString().replace(j&&j.iri?_.PCT_ENCODED:x.PCT_ENCODED,pctDecChars)}var Re={scheme:"http",domainHost:!0,parse:function(i,x){return i.host||(i.error=i.error||"HTTP URIs must have a host."),i},serialize:function(i,x){var _="https"===String(i.scheme).toLowerCase();return i.port!==(_?443:80)&&""!==i.port||(i.port=void 0),i.path||(i.path="/"),i}},Ne={scheme:"https",domainHost:Re.domainHost,parse:Re.parse,serialize:Re.serialize};function isSecure(i){return"boolean"==typeof i.secure?i.secure:"wss"===String(i.scheme).toLowerCase()}var $e={scheme:"ws",domainHost:!0,parse:function(i,x){var _=i;return _.secure=isSecure(_),_.resourceName=(_.path||"/")+(_.query?"?"+_.query:""),_.path=void 0,_.query=void 0,_},serialize:function(i,x){if(i.port!==(isSecure(i)?443:80)&&""!==i.port||(i.port=void 0),"boolean"==typeof i.secure&&(i.scheme=i.secure?"wss":"ws",i.secure=void 0),i.resourceName){var _=i.resourceName.split("?"),j=slicedToArray(_,2),I=j[0],$=j[1];i.path=I&&"/"!==I?I:void 0,i.query=$,i.resourceName=void 0}return i.fragment=void 0,i}},We={scheme:"wss",domainHost:$e.domainHost,parse:$e.parse,serialize:$e.serialize},Ye={},Je="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",Xe="[0-9A-Fa-f]",Ze=subexp(subexp("%[EFef]"+Xe+"%"+Xe+Xe+"%"+Xe+Xe)+"|"+subexp("%[89A-Fa-f]"+Xe+"%"+Xe+Xe)+"|"+subexp("%"+Xe+Xe)),et=merge("[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",'[\\"\\\\]'),tt=new RegExp(Je,"g"),rt=new RegExp(Ze,"g"),nt=new RegExp(merge("[^]","[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]","[\\.]",'[\\"]',et),"g"),it=new RegExp(merge("[^]",Je,"[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]"),"g"),ot=it;function decodeUnreserved(i){var x=pctDecChars(i);return x.match(tt)?x:i}var st={scheme:"mailto",parse:function(i,x){var _=i,j=_.to=_.path?_.path.split(","):[];if(_.path=void 0,_.query){for(var I=!1,$={},Y=_.query.split("&"),ie=0,ce=Y.length;ie1){x[0]=x[0].slice(0,-1);for(var j=x.length-1,I=1;I= 0x80 (not a basic code point)","invalid-input":"Invalid input"},ce=Math.floor,de=String.fromCharCode;function error$1(i){throw new RangeError(ie[i])}function mapDomain(i,x){var _=i.split("@"),j="";_.length>1&&(j=_[0]+"@",i=_[1]);var I=function(i,x){for(var _=[],j=i.length;j--;)_[j]=x(i[j]);return _}((i=i.replace(Y,".")).split("."),x).join(".");return j+I}function ucs2decode(i){for(var x=[],_=0,j=i.length;_=55296&&I<=56319&&_>1,i+=ce(i/x);i>455;j+=36)i=ce(i/35);return ce(j+36*i/(i+38))},decode=function(i){var x,_=[],I=i.length,$=0,Y=128,ie=72,de=i.lastIndexOf("-");de<0&&(de=0);for(var he=0;he=128&&error$1("not-basic"),_.push(i.charCodeAt(he));for(var ge=de>0?de+1:0;ge=I&&error$1("invalid-input");var je=(x=i.charCodeAt(ge++))-48<10?x-22:x-65<26?x-65:x-97<26?x-97:36;(je>=36||je>ce((j-$)/ke))&&error$1("overflow"),$+=je*ke;var Fe=Se<=ie?1:Se>=ie+26?26:Se-ie;if(jece(j/Re)&&error$1("overflow"),ke*=Re}var Ne=_.length+1;ie=adapt($-_e,Ne,0==_e),ce($/Ne)>j-Y&&error$1("overflow"),Y+=ce($/Ne),$%=Ne,_.splice($++,0,Y)}return String.fromCodePoint.apply(String,_)},encode=function(i){var x=[],_=(i=ucs2decode(i)).length,I=128,$=0,Y=72,ie=!0,he=!1,ge=void 0;try{for(var _e,ke=i[Symbol.iterator]();!(ie=(_e=ke.next()).done);ie=!0){var Se=_e.value;Se<128&&x.push(de(Se))}}catch(i){he=!0,ge=i}finally{try{!ie&&ke.return&&ke.return()}finally{if(he)throw ge}}var je=x.length,Fe=je;for(je&&x.push("-");Fe<_;){var Re=j,Ne=!0,$e=!1,We=void 0;try{for(var Ye,Je=i[Symbol.iterator]();!(Ne=(Ye=Je.next()).done);Ne=!0){var Xe=Ye.value;Xe>=I&&Xece((j-$)/Ze)&&error$1("overflow"),$+=(Re-I)*Ze,I=Re;var et=!0,tt=!1,rt=void 0;try{for(var nt,it=i[Symbol.iterator]();!(et=(nt=it.next()).done);et=!0){var ot=nt.value;if(otj&&error$1("overflow"),ot==I){for(var st=$,at=36;;at+=36){var ut=at<=Y?1:at>=Y+26?26:at-Y;if(st>6|192).toString(16).toUpperCase()+"%"+(63&x|128).toString(16).toUpperCase():"%"+(x>>12|224).toString(16).toUpperCase()+"%"+(x>>6&63|128).toString(16).toUpperCase()+"%"+(63&x|128).toString(16).toUpperCase()}function pctDecChars(i){for(var x="",_=0,j=i.length;_=194&&I<224){if(j-_>=6){var $=parseInt(i.substr(_+4,2),16);x+=String.fromCharCode((31&I)<<6|63&$)}else x+=i.substr(_,6);_+=6}else if(I>=224){if(j-_>=9){var Y=parseInt(i.substr(_+4,2),16),ie=parseInt(i.substr(_+7,2),16);x+=String.fromCharCode((15&I)<<12|(63&Y)<<6|63&ie)}else x+=i.substr(_,9);_+=9}else x+=i.substr(_,3),_+=3}return x}function _normalizeComponentEncoding(i,x){function decodeUnreserved(i){var _=pctDecChars(i);return _.match(x.UNRESERVED)?_:i}return i.scheme&&(i.scheme=String(i.scheme).replace(x.PCT_ENCODED,decodeUnreserved).toLowerCase().replace(x.NOT_SCHEME,"")),void 0!==i.userinfo&&(i.userinfo=String(i.userinfo).replace(x.PCT_ENCODED,decodeUnreserved).replace(x.NOT_USERINFO,pctEncChar).replace(x.PCT_ENCODED,toUpperCase)),void 0!==i.host&&(i.host=String(i.host).replace(x.PCT_ENCODED,decodeUnreserved).toLowerCase().replace(x.NOT_HOST,pctEncChar).replace(x.PCT_ENCODED,toUpperCase)),void 0!==i.path&&(i.path=String(i.path).replace(x.PCT_ENCODED,decodeUnreserved).replace(i.scheme?x.NOT_PATH:x.NOT_PATH_NOSCHEME,pctEncChar).replace(x.PCT_ENCODED,toUpperCase)),void 0!==i.query&&(i.query=String(i.query).replace(x.PCT_ENCODED,decodeUnreserved).replace(x.NOT_QUERY,pctEncChar).replace(x.PCT_ENCODED,toUpperCase)),void 0!==i.fragment&&(i.fragment=String(i.fragment).replace(x.PCT_ENCODED,decodeUnreserved).replace(x.NOT_FRAGMENT,pctEncChar).replace(x.PCT_ENCODED,toUpperCase)),i}function _stripLeadingZeros(i){return i.replace(/^0*(.*)/,"$1")||"0"}function _normalizeIPv4(i,x){var _=i.match(x.IPV4ADDRESS)||[],j=slicedToArray(_,2)[1];return j?j.split(".").map(_stripLeadingZeros).join("."):i}function _normalizeIPv6(i,x){var _=i.match(x.IPV6ADDRESS)||[],j=slicedToArray(_,3),I=j[1],$=j[2];if(I){for(var Y=I.toLowerCase().split("::").reverse(),ie=slicedToArray(Y,2),ce=ie[0],de=ie[1],he=de?de.split(":").map(_stripLeadingZeros):[],ge=ce.split(":").map(_stripLeadingZeros),_e=x.IPV4ADDRESS.test(ge[ge.length-1]),ke=_e?7:8,Se=ge.length-ke,je=Array(ke),Fe=0;Fe1){var $e=je.slice(0,Re.index),We=je.slice(Re.index+Re.length);Ne=$e.join(":")+"::"+We.join(":")}else Ne=je.join(":");return $&&(Ne+="%"+$),Ne}return i}var ge=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,_e=void 0==="".match(/(){0}/)[1];function parse(i){var j=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},I={},$=!1!==j.iri?_:x;"suffix"===j.reference&&(i=(j.scheme?j.scheme+":":"")+"//"+i);var Y=i.match(ge);if(Y){_e?(I.scheme=Y[1],I.userinfo=Y[3],I.host=Y[4],I.port=parseInt(Y[5],10),I.path=Y[6]||"",I.query=Y[7],I.fragment=Y[8],isNaN(I.port)&&(I.port=Y[5])):(I.scheme=Y[1]||void 0,I.userinfo=-1!==i.indexOf("@")?Y[3]:void 0,I.host=-1!==i.indexOf("//")?Y[4]:void 0,I.port=parseInt(Y[5],10),I.path=Y[6]||"",I.query=-1!==i.indexOf("?")?Y[7]:void 0,I.fragment=-1!==i.indexOf("#")?Y[8]:void 0,isNaN(I.port)&&(I.port=i.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?Y[4]:void 0)),I.host&&(I.host=_normalizeIPv6(_normalizeIPv4(I.host,$),$)),void 0!==I.scheme||void 0!==I.userinfo||void 0!==I.host||void 0!==I.port||I.path||void 0!==I.query?void 0===I.scheme?I.reference="relative":void 0===I.fragment?I.reference="absolute":I.reference="uri":I.reference="same-document",j.reference&&"suffix"!==j.reference&&j.reference!==I.reference&&(I.error=I.error||"URI is not a "+j.reference+" reference.");var ie=he[(j.scheme||I.scheme||"").toLowerCase()];if(j.unicodeSupport||ie&&ie.unicodeSupport)_normalizeComponentEncoding(I,$);else{if(I.host&&(j.domainHost||ie&&ie.domainHost))try{I.host=punycode_toASCII(I.host.replace($.PCT_ENCODED,pctDecChars).toLowerCase())}catch(i){I.error=I.error||"Host's domain name can not be converted to ASCII via punycode: "+i}_normalizeComponentEncoding(I,x)}ie&&ie.parse&&ie.parse(I,j)}else I.error=I.error||"URI can not be parsed.";return I}function _recomposeAuthority(i,j){var I=!1!==j.iri?_:x,$=[];return void 0!==i.userinfo&&($.push(i.userinfo),$.push("@")),void 0!==i.host&&$.push(_normalizeIPv6(_normalizeIPv4(String(i.host),I),I).replace(I.IPV6ADDRESS,(function(i,x,_){return"["+x+(_?"%25"+_:"")+"]"}))),"number"!=typeof i.port&&"string"!=typeof i.port||($.push(":"),$.push(String(i.port))),$.length?$.join(""):void 0}var ke=/^\.\.?\//,Se=/^\/\.(\/|$)/,je=/^\/\.\.(\/|$)/,Fe=/^\/?(?:.|\n)*?(?=\/|$)/;function removeDotSegments(i){for(var x=[];i.length;)if(i.match(ke))i=i.replace(ke,"");else if(i.match(Se))i=i.replace(Se,"/");else if(i.match(je))i=i.replace(je,"/"),x.pop();else if("."===i||".."===i)i="";else{var _=i.match(Fe);if(!_)throw new Error("Unexpected dot segment condition");var j=_[0];i=i.slice(j.length),x.push(j)}return x.join("")}function serialize(i){var j=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},I=j.iri?_:x,$=[],Y=he[(j.scheme||i.scheme||"").toLowerCase()];if(Y&&Y.serialize&&Y.serialize(i,j),i.host)if(I.IPV6ADDRESS.test(i.host));else if(j.domainHost||Y&&Y.domainHost)try{i.host=j.iri?punycode_toUnicode(i.host):punycode_toASCII(i.host.replace(I.PCT_ENCODED,pctDecChars).toLowerCase())}catch(x){i.error=i.error||"Host's domain name can not be converted to "+(j.iri?"Unicode":"ASCII")+" via punycode: "+x}_normalizeComponentEncoding(i,I),"suffix"!==j.reference&&i.scheme&&($.push(i.scheme),$.push(":"));var ie=_recomposeAuthority(i,j);if(void 0!==ie&&("suffix"!==j.reference&&$.push("//"),$.push(ie),i.path&&"/"!==i.path.charAt(0)&&$.push("/")),void 0!==i.path){var ce=i.path;j.absolutePath||Y&&Y.absolutePath||(ce=removeDotSegments(ce)),void 0===ie&&(ce=ce.replace(/^\/\//,"/%2F")),$.push(ce)}return void 0!==i.query&&($.push("?"),$.push(i.query)),void 0!==i.fragment&&($.push("#"),$.push(i.fragment)),$.join("")}function resolveComponents(i,x){var _=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},j=arguments[3],I={};return j||(i=parse(serialize(i,_),_),x=parse(serialize(x,_),_)),!(_=_||{}).tolerant&&x.scheme?(I.scheme=x.scheme,I.userinfo=x.userinfo,I.host=x.host,I.port=x.port,I.path=removeDotSegments(x.path||""),I.query=x.query):(void 0!==x.userinfo||void 0!==x.host||void 0!==x.port?(I.userinfo=x.userinfo,I.host=x.host,I.port=x.port,I.path=removeDotSegments(x.path||""),I.query=x.query):(x.path?("/"===x.path.charAt(0)?I.path=removeDotSegments(x.path):(void 0===i.userinfo&&void 0===i.host&&void 0===i.port||i.path?i.path?I.path=i.path.slice(0,i.path.lastIndexOf("/")+1)+x.path:I.path=x.path:I.path="/"+x.path,I.path=removeDotSegments(I.path)),I.query=x.query):(I.path=i.path,void 0!==x.query?I.query=x.query:I.query=i.query),I.userinfo=i.userinfo,I.host=i.host,I.port=i.port),I.scheme=i.scheme),I.fragment=x.fragment,I}function unescapeComponent(i,j){return i&&i.toString().replace(j&&j.iri?_.PCT_ENCODED:x.PCT_ENCODED,pctDecChars)}var Re={scheme:"http",domainHost:!0,parse:function(i,x){return i.host||(i.error=i.error||"HTTP URIs must have a host."),i},serialize:function(i,x){var _="https"===String(i.scheme).toLowerCase();return i.port!==(_?443:80)&&""!==i.port||(i.port=void 0),i.path||(i.path="/"),i}},Ne={scheme:"https",domainHost:Re.domainHost,parse:Re.parse,serialize:Re.serialize};function isSecure(i){return"boolean"==typeof i.secure?i.secure:"wss"===String(i.scheme).toLowerCase()}var $e={scheme:"ws",domainHost:!0,parse:function(i,x){var _=i;return _.secure=isSecure(_),_.resourceName=(_.path||"/")+(_.query?"?"+_.query:""),_.path=void 0,_.query=void 0,_},serialize:function(i,x){if(i.port!==(isSecure(i)?443:80)&&""!==i.port||(i.port=void 0),"boolean"==typeof i.secure&&(i.scheme=i.secure?"wss":"ws",i.secure=void 0),i.resourceName){var _=i.resourceName.split("?"),j=slicedToArray(_,2),I=j[0],$=j[1];i.path=I&&"/"!==I?I:void 0,i.query=$,i.resourceName=void 0}return i.fragment=void 0,i}},We={scheme:"wss",domainHost:$e.domainHost,parse:$e.parse,serialize:$e.serialize},Ye={},Je="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",Xe="[0-9A-Fa-f]",Ze=subexp(subexp("%[EFef]"+Xe+"%"+Xe+Xe+"%"+Xe+Xe)+"|"+subexp("%[89A-Fa-f]"+Xe+"%"+Xe+Xe)+"|"+subexp("%"+Xe+Xe)),et=merge("[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",'[\\"\\\\]'),tt=new RegExp(Je,"g"),rt=new RegExp(Ze,"g"),nt=new RegExp(merge("[^]","[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]","[\\.]",'[\\"]',et),"g"),it=new RegExp(merge("[^]",Je,"[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]"),"g"),ot=it;function decodeUnreserved(i){var x=pctDecChars(i);return x.match(tt)?x:i}var st={scheme:"mailto",parse:function(i,x){var _=i,j=_.to=_.path?_.path.split(","):[];if(_.path=void 0,_.query){for(var I=!1,$={},Y=_.query.split("&"),ie=0,ce=Y.length;ie Math.pow(2, -debug) + } + }); +} diff --git a/src/src/quasiinfinite-zoom/configure-viewport.js b/src/src/quasiinfinite-zoom/configure-viewport.js new file mode 100644 index 0000000..d7f799d --- /dev/null +++ b/src/src/quasiinfinite-zoom/configure-viewport.js @@ -0,0 +1,41 @@ +const mat3create = require('gl-mat3/create'); + +const DEFAULT_MARGIN = { t: 0, r: 0, b: 0, l: 0 }; + +module.exports = function createReglViewportConfiguration(regl) { + const viewport3 = mat3create(); + + let command = regl({ + viewport: { + x: (ctx, props) => ctx.pixelRatio * props.margin.l, + y: (ctx, props) => ctx.pixelRatio * props.margin.b, + width: (ctx, props) => ctx.viewportWidth - ctx.pixelRatio * (props.margin.r + props.margin.l), + height: (ctx, props) => ctx.viewportHeight - ctx.pixelRatio * (props.margin.t + props.margin.b) + }, + uniforms: { + viewportResolution: (ctx, props) => [ + ctx.viewportWidth, + ctx.viewportHeight + ], + framebufferResolution: (ctx) => [ + ctx.framebufferWidth, + ctx.framebufferHeight + ], + inverseViewportResolution: (ctx, props) => [ + 1 / ctx.viewportWidth, + 1 / ctx.viewportHeight + ], + inverseFramebufferResolution: (ctx) => [ + 1 / ctx.framebufferWidth, + 1 / ctx.framebufferHeight + ], + pixelRatio: regl.context("pixelRatio") + } + }); + + return function (viewport, callback) { + const margin = Object.assign({}, DEFAULT_MARGIN); + if (viewport && viewport.margin) Object.assign(margin, viewport.margin); + command({ margin }, callback); + }; +}; diff --git a/src/src/quasiinfinite-zoom/create-zoom.js b/src/src/quasiinfinite-zoom/create-zoom.js new file mode 100644 index 0000000..6d5a6f7 --- /dev/null +++ b/src/src/quasiinfinite-zoom/create-zoom.js @@ -0,0 +1,45 @@ +const d3 = require('d3'); + +function createZoom(scales, onZoom) { + const xOriginal = scales.x.copy(); + const yOriginal = scales.y.copy(); + + return d3.zoom() + .scaleExtent([1e-5, 1e5]) + .on("zoom", function () { + const t = d3.event.transform; + let range = scales.x.range().map(t.invertX, t); + scales.x.domain(xOriginal.domain()); + scales.x.domain(range.map(scales.x.invert, scales.x)); + + range = scales.y.range().map(t.invertY, t); + scales.y.domain(yOriginal.domain()); + scales.y.domain(range.map(scales.y.invert, scales.y)); + scales.dirty = true; + + onZoom && onZoom(); + }); +} + +module.exports = function attachPanZoom(el, scales, onZoom) { + const xRange = scales.x.range(); + const yRange = scales.y.range(); + const aspect = (xRange[1] - xRange[0]) / (yRange[0] - yRange[1]); + + const xDom = scales.x.domain(); + const yDom = scales.y.domain(); + const yRng = 0.5 * (yDom[1] - yDom[0]); + const xCen = 0.5 * (xDom[1] + xDom[0]); + const xMin = xCen - yRng * aspect; + const xMax = xCen + yRng * aspect; + const yMin = yDom[0]; + const yMax = yDom[1]; + + scales.x.domain([xMin, xMax]).range(xRange); + scales.y.domain([yMin, yMax]).range(yRange); + + el.__zoom = null; + d3.select(el).call(createZoom(scales, onZoom)); + + onZoom && onZoom(); +} diff --git a/src/src/quasiinfinite-zoom/draw-box.js b/src/src/quasiinfinite-zoom/draw-box.js new file mode 100644 index 0000000..7901ccd --- /dev/null +++ b/src/src/quasiinfinite-zoom/draw-box.js @@ -0,0 +1,23 @@ +'use strict'; + +module.exports = function (regl) { + return regl({ + vert: ` + precision highp float; + attribute vec2 xy; + uniform float globalScale; + void main () { + gl_Position = vec4(xy * globalScale, 0, 1); + }`, + frag: ` + precision lowp float; + void main () { + gl_FragColor = vec4(1, 0, 0, 1); + }`, + attributes: { + xy: [-1, -1, 1, -1, 1, 1, -1, 1, -1, -1] + }, + primitive: 'line strip', + count: 5 + }); +} diff --git a/src/src/quasiinfinite-zoom/draw-points.js b/src/src/quasiinfinite-zoom/draw-points.js new file mode 100644 index 0000000..67bba68 --- /dev/null +++ b/src/src/quasiinfinite-zoom/draw-points.js @@ -0,0 +1,106 @@ +const mat4create = require('gl-mat4/create'); + +function mod(n, m) { + return ((n % m) + m) % m; +} + +module.exports = function (regl) { + return regl({ + vert: ` + precision highp float; + attribute vec3 uv; + uniform sampler2D colorscale; + uniform float pixelRatio, pointSize, z, aspect, zblend, zrange, globalScale, scalePoints, fadeOutStart, fadeInEnd; + uniform vec2 xDomain, yDomain; + uniform vec4 domain; + uniform mat4 inverseView, view; + varying float opacity, vPointSize; + varying vec4 color; + + float linearstep (float a, float b, float x) { + return clamp((x - a) / (b - a), 0.0, 1.0); + } + + void main () { + float scale = pow(2.0, z + uv.z * zblend); + + vec2 cen = (domain.zw + domain.xy) * 0.5; + vec2 rng = (domain.zw - domain.xy) * vec2(1, aspect) * (0.5 * scale); + + vec2 base = pow(vec2(2.0), ceil(log2(2.0 * rng))); + vec2 offset = base * floor(0.5 * domain.xy / base) * 2.0; + vec2 offset2 = base * floor(domain.xy / base); + vec2 shift = mod(offset2 / base, 2.0); + + vec2 xy = uv.xy; + xy += shift * vec2(lessThan(xy, vec2(0.5))); + xy = xy * (2.0 * base) + offset; + gl_Position = view * vec4(xy, 0, 1); + + float zfrac = 1.0 - fract(log2(2.0 * rng.x)) + z; + float sc = zrange / 3.0; + opacity = smoothstep(0.0, 0.01 + 3.0 * fadeInEnd * sc, zfrac) * smoothstep(3.0 * sc, 2.999 * fadeOutStart * sc, zfrac); + + gl_PointSize = pixelRatio * pointSize * pow(2.0, (zfrac - zrange * 0.5) * scalePoints); + vPointSize = gl_PointSize; + + color = texture2D(colorscale, vec2(uv.z, 0.5)); + + gl_Position.xy *= globalScale; + }`, + frag: ` + precision highp float; + varying float opacity, vPointSize; + uniform float pixelRatio, pointSize; + varying vec4 color; + float linearstep (float a, float b, float x) { + return clamp((x - a) / (b - a), 0.0, 1.0); + } + void main () { + float r = length(gl_PointCoord.xy - 0.5) * 2.0 * vPointSize; + float alpha = linearstep(vPointSize, vPointSize - 1.0, r); + if (alpha == 0.0) discard; + gl_FragColor = color; + gl_FragColor.a *= opacity * alpha; + }`, + attributes: { + uv: regl.prop('xy') + }, + uniforms: { + pixelRatio: regl.context('pixelRatio'), + pointSize: regl.prop('pointSize'), + offset: regl.prop('offset'), + base: regl.prop('base'), + shift: regl.prop('shift'), + aspect: ({viewportWidth, viewportHeight}) => viewportWidth / viewportHeight, + z: regl.prop('z'), + xDomain: regl.prop('xDomain'), + yDomain: regl.prop('yDomain'), + domain: (_, {xDomain, yDomain}) => [xDomain[0], yDomain[0], xDomain[1], yDomain[1]], + zrange: regl.prop('zrange'), + zblend: regl.prop('zblend'), + colorscale: regl.prop('colorscale'), + fadeOutStart: regl.prop('fadeOutStart'), + fadeInEnd: regl.prop('fadeInEnd'), + scalePoints: (_, {scalePoints}) => scalePoints ? 1 : 0 + }, + blend: { + enable: true, + func: { + srcRGB: 'src alpha', + srcAlpha: 1, + dstRGB: 1, + dstAlpha: 1 + }, + equation: { + rgb: 'add', + alpha: 'add' + }, + }, + depth: { + enable: false + }, + primitive: 'points', + count: regl.prop('count') + }); +}; diff --git a/src/src/quasiinfinite-zoom/index.js b/src/src/quasiinfinite-zoom/index.js new file mode 100644 index 0000000..201a061 --- /dev/null +++ b/src/src/quasiinfinite-zoom/index.js @@ -0,0 +1,164 @@ +const d3 = require('d3'); +const createZoom = require('./create-zoom.js'); +const mat4create = require('gl-mat4/create'); +const mat4multiply = require('gl-mat4/multiply'); +const mat4invert = require('gl-mat4/invert'); +const mat4fromScaling = require('gl-mat4/fromScaling'); +const css = require('insert-css'); +const failIfNot = require('fail-nicely'); + +css(` +canvas { cursor: move; } +.sketch-nav { + left: 0 !important; + right: auto !important; + text-align: left !important; +} +.tick line { + stroke: white; +} +.tick text { + fill: white; +} +.domain { + stroke: white !important; +} +svg { + z-index: 1; + position: relative; + pointer-events: none; +}; +`); + +function mod(n, m) { + return ((n % m) + m) % m; +} + +const State = require('controls-state'); +const GUI = require('controls-gui'); + +const regl = require('regl')({ + attributes: {antialias: true}, + optionalExtensions: [ ], + onDone: failIfNot(run), +}); + +function qrand2d(i) { + const g = 1.32471795724474602596; + const a1 = 1.0 / g; + const a2 = 1.0 / (g * g); + return [ + (0.5 + a1 * i) % 1 + (Math.random() * 2 - 1) * 0.001, + (0.5 + a2 * i) % 1 + (Math.random() * 2 - 1) * 0.001, + Math.random() + ]; +} + +function lut(interpolator, n = 256) { + return new Uint8ClampedArray(d3.quantize(interpolator, n).map(c => { + return (c = d3.rgb(c)), [c.r, c.g, c.b, 255]; + }).flat()); +} + +function run (regl) { + const MAX_POINTS = 1000000; + + const state = GUI(State({ + count: State.Slider(100000, {min: 1000, max: MAX_POINTS, step: 1}), + zrange: State.Slider(3.5, {min: 2, max: 6, step: 0.1}), + zblend: State.Slider(0.5, {min: 0, max: 1, step: 0.1}), + pointSize: State.Slider(5, {min: 1, max: 10, step: 0.1}), + fadeInEnd: State.Slider(0.2, {min: 0, max: 1, step: 0.01}), + fadeOutStart: State.Slider(0.5, {min: 0, max: 1, step: 0.01}), + debug: State.Slider(0, {min: 0, max: 3, step: 0.01}), + scalePoints: true, + })); + + const colorscale = regl.texture({ + width: 256, + height: 1, + mag: 'nearest', + min: 'nearest', + data: lut(d3.interpolateViridis) + }); + + const xy = regl.buffer([...Array(MAX_POINTS).keys()].map(qrand2d)); + + const configureUniforms = require('./configure-uniforms.js')(regl); + const drawPoints = require('./draw-points.js')(regl); + + const canvas = regl._gl.canvas; + + const scales = window.scales = { + x: d3.scaleLinear().domain([-canvas.width / canvas.height, canvas.width / canvas.height]), + y: d3.scaleLinear().domain([-0.99, 0.99]), + dirty: true + }; + + const margin = { + l: 50, r: 20, t: 20, b: 30 + }; + + const svg = d3.create('svg'); + const xaxis = svg.append('g'); + const yaxis = svg.append('g'); + document.body.append(svg.node()); + function updateAxis() { + const {innerWidth: w, innerHeight: h} = window; + svg.attr('width', w) + svg.attr('height', h) + xaxis + .attr('transform', `translate(0,${h - margin.b})`) + .call(d3.axisBottom(scales.x)); + yaxis + .attr('transform', `translate(${margin.l},0)`) + .call(d3.axisLeft(scales.y)); + } + + const pixelRatio = regl._gl.canvas.width / regl._gl.canvas.offsetWidth; + + function onResize () { + const {innerWidth: w, innerHeight: h} = window; + scales.x.range([margin.l, w - margin.r]); + scales.y.range([h - margin.b, margin.t]); + scales.dirty = true; + createZoom(canvas, scales); + updateAxis(); + } + + onResize(); + window.addEventListener('resize', onResize); + state.$onChange(() => scales.dirty = true); + + const configureViewport = require('./configure-viewport.js')(regl); + const configureLinearScales = require('./configure-linear-scales.js')(regl); + const drawBox = require('./draw-box.js')(regl); + + let loop = regl.frame(({tick}) => { + try { + configureViewport({margin}, () => { + configureLinearScales(scales, ({dirty, xDomain, yDomain, viewportWidth, viewportHeight}) => { + if (!dirty) return; + regl.clear({color: [0.1, 0.1, 0.1, 1]}); + configureUniforms(state, () => { + for (let z = 0; z < Math.floor(state.zrange + state.zblend); z++) { + drawPoints({ + ...state, + xy, + xDomain, + yDomain, + z, + colorscale, + }); + } + if (state.debug) drawBox(); + }); + updateAxis(); + }); + }); + } catch (e) { + console.error(e); + loop.cancel(); + } + }); +} diff --git a/src/src/quasiinfinite-zoom/mat3-from-linear-scales.js b/src/src/quasiinfinite-zoom/mat3-from-linear-scales.js new file mode 100644 index 0000000..4c75844 --- /dev/null +++ b/src/src/quasiinfinite-zoom/mat3-from-linear-scales.js @@ -0,0 +1,20 @@ +module.exports = function mat3fromLinearScales(out, scales) { + let xDomain = scales.x.domain(); + let yDomain = scales.y.domain(); + let xs = 2 / (xDomain[1] - xDomain[0]); + let ys = 2 / (yDomain[1] - yDomain[0]); + + out[0] = xs; + out[1] = 0; + out[2] = 0; + + out[3] = 0; + out[4] = ys; + out[5] = 0; + + out[6] = -1 - xs * xDomain[0]; + out[7] = -1 - ys * yDomain[0]; + out[8] = 1; + + return out; +} diff --git a/src/src/quasiinfinite-zoom/mat4-from-mat3.js b/src/src/quasiinfinite-zoom/mat4-from-mat3.js new file mode 100644 index 0000000..87f340f --- /dev/null +++ b/src/src/quasiinfinite-zoom/mat4-from-mat3.js @@ -0,0 +1,21 @@ +module.exports = function mat4fromMat3(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = 0; + out[3] = a[2]; + + out[4] = a[3]; + out[5] = a[4]; + out[6] = 0; + out[7] = a[5]; + + out[8] = 0; + out[9] = 0; + out[10] = 1; + out[11] = 0; + + out[12] = a[6]; + out[13] = a[7]; + out[14] = 0; + out[15] = a[8]; +} diff --git a/src/src/quasiinfinite-zoom/metadata.json b/src/src/quasiinfinite-zoom/metadata.json new file mode 100644 index 0000000..ef612e5 --- /dev/null +++ b/src/src/quasiinfinite-zoom/metadata.json @@ -0,0 +1,5 @@ +{ + "title": "Quasiinfinite zoom", + "description": "Repeated quasirandom points to create the illusion of infinite zoom", + "order": 3400 +} diff --git a/src/src/quasiinfinite-zoom/thumbnail.jpg b/src/src/quasiinfinite-zoom/thumbnail.jpg new file mode 100644 index 0000000..7375d61 Binary files /dev/null and b/src/src/quasiinfinite-zoom/thumbnail.jpg differ diff --git a/src/src/sketches/index.json b/src/src/sketches/index.json index e01d1a0..1a02ebe 100644 --- a/src/src/sketches/index.json +++ b/src/src/sketches/index.json @@ -1 +1 @@ -[{"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":"Magnet","order":2200,"description":"Just a magnetic 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"}] \ No newline at end of file +[{"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":"Magnet","order":2200,"description":"Just a magnetic 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"}] \ No newline at end of file diff --git a/src/src/sketches/static/cubic-roots-thumbnail.jpg b/src/src/sketches/static/cubic-roots-thumbnail.jpg index b1c9414..af03321 100644 Binary files a/src/src/sketches/static/cubic-roots-thumbnail.jpg and b/src/src/sketches/static/cubic-roots-thumbnail.jpg differ diff --git a/src/src/sketches/static/mandelbrot-thumbnail.jpg b/src/src/sketches/static/mandelbrot-thumbnail.jpg index 7e43a0b..4facc5e 100644 Binary files a/src/src/sketches/static/mandelbrot-thumbnail.jpg and b/src/src/sketches/static/mandelbrot-thumbnail.jpg differ diff --git a/src/src/sketches/static/quasiinfinite-zoom-thumbnail.jpg b/src/src/sketches/static/quasiinfinite-zoom-thumbnail.jpg new file mode 100644 index 0000000..7375d61 Binary files /dev/null and b/src/src/sketches/static/quasiinfinite-zoom-thumbnail.jpg differ