]> source.dussan.org Git - svg.js.git/commitdiff
fix a few mistakes. Make sugar work. Roll back to childNodes because children is...
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>
Thu, 1 Nov 2018 15:59:51 +0000 (16:59 +0100)
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>
Thu, 1 Nov 2018 15:59:51 +0000 (16:59 +0100)
bench/runner.html
bench/tests/10000-rects.js
dist/svg.js
dist/svg.min.js
src/Element.js
src/Parent.js
src/elemnts-svg.js
src/methods.js
src/sugar.js
src/svg.js

index b39c1df8bba9a4df75baccd35aa92b1a5bb2a260..5b6040c204ca896080dafddeda052e7d4e7dcfd2 100644 (file)
   <div id="draw"></div>
   <svg id="native" width="100" height="100" xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svgjs="http://svgjs.com/svgjs"></svg>
   <script src="../dist/svg.js"></script>
-  <script type="text/javascript" src="../src/helpers.js"></script>
-  <script type="text/javascript" src="../src/transform.js"></script>
-  <script type="text/javascript" src="../src/matrix.js"></script>
-  <script type="text/javascript" src="../src/morph.js"></script>
-  <script type="text/javascript" src="../src/runner.js"></script>
-  <script type="text/javascript" src="../src/timeline.js"></script>
-  <script type="text/javascript" src="../src/controller.js"></script>
   <script src="https://cdnjs.cloudflare.com/ajax/libs/snap.svg/0.5.1/snap.svg-min.js"></script>
   <script src="svg.bench.js"></script>
   <!--<script src="tests/10000-each.js"></script> -->
-  <!-- <script src="tests/10000-rects.js"></script>
-  <script src="tests/10000-circles.js"></script>
+  <script src="tests/10000-rects.js"></script>
+  <!-- <script src="tests/10000-circles.js"></script>
   <script src="tests/10000-paths.js"></script>
   <script src="tests/10000-boxes.js"></script>
   <script src="tests/10000-pointArray-bbox.js"></script>
-  <script src="tests/10000-accesses.js"></script> -->
-  <script src="tests/10000-transform.js"></script>
+  <script src="tests/10000-accesses.js"></script>
+  <script src="tests/10000-transform.js"></script> -->
   <script>
     SVG.bench.run()
   </script>
index 98b7ac935537feb03c9e120a26d429223027e47d..d6ef518a7401b5a48508c5a746b7ac380f4c3f0c 100644 (file)
@@ -17,102 +17,95 @@ SVG.bench.describe('Generate 10000 rects', function(bench) {
   })
 })
 
-
-SVG.bench.describe('Generate 10000 rects with fill', function(bench) {
-  bench.test('using SVG.js v2.5.3', function() {
-    for (var i = 0; i < 10000; i++)
-      bench.draw.rect(100,100).fill('#f06')
-  })
-  bench.test('using vanilla js', function() {
-    for (var i = 0; i < 10000; i++) {
-      var rect = document.createElementNS(SVG.ns, 'rect')
-      rect.setAttributeNS(null, 'height', 100)
-      rect.setAttributeNS(null, 'width', 100)
-      rect.setAttributeNS(null, 'fill', '#f06')
-      bench.raw.appendChild(rect)
-    }
-  })
-  bench.test('using Snap.svg v0.5.1', function() {
-    for (var i = 0; i < 10000; i++)
-      bench.snap.rect(50, 50, 100, 100).attr('fill', '#f06')
-  })
-})
-
-
-SVG.bench.describe('Generate 10000 rects with position and fill', function(bench) {
-  bench.test('using SVG.js v2.5.3', function() {
-    for (var i = 0; i < 10000; i++)
-      bench.draw.rect(100,100).move(50,50).fill('#f06')
-  })
-  bench.test('using vanilla js', function() {
-    for (var i = 0; i < 10000; i++) {
-      var rect = document.createElementNS(SVG.ns, 'rect')
-      rect.setAttributeNS(null, 'height', 100)
-      rect.setAttributeNS(null, 'width', 100)
-      rect.setAttributeNS(null, 'fill', '#f06')
-      rect.setAttributeNS(null, 'x', 50)
-      rect.setAttributeNS(null, 'y', 50)
-      bench.raw.appendChild(rect)
-    }
-  })
-  bench.test('using Snap.svg v0.5.1', function() {
-    for (var i = 0; i < 10000; i++)
-      bench.snap.rect(50, 50, 100, 100).attr('fill', '#f06')
-  })
-})
-
-
-SVG.bench.describe('Generate 10000 rects with gradient fill', function(bench) {
-  bench.test('using SVG.js v2.5.3', function() {
-    for (var i = 0; i < 10000; i++) {
-      var g = bench.draw.gradient('linear', function(add) {
-        add.stop(0, '#000')
-        add.stop(0.25, '#f00')
-        add.stop(1, '#fff')
-      })
-
-      bench.draw.rect(100,100).fill(g)
-    }
-  })
-  bench.test('using vanilla js', function() {
-    for (var i = 0; i < 10000; i++) {
-      var g = document.createElementNS(SVG.ns, 'linearGradient')
-      var stop = document.createElementNS(SVG.ns, 'stop')
-      stop.setAttributeNS(null, 'offset', '0%')
-      stop.setAttributeNS(null, 'color', '#000')
-      g.appendChild(stop)
-      stop = document.createElementNS(SVG.ns, 'stop')
-      stop.setAttributeNS(null, 'offset', '25%')
-      stop.setAttributeNS(null, 'color', '#f00')
-      g.appendChild(stop)
-      stop = document.createElementNS(SVG.ns, 'stop')
-      stop.setAttributeNS(null, 'offset', '100%')
-      stop.setAttributeNS(null, 'color', '#fff')
-      g.appendChild(stop)
-      bench.raw.appendChild(g)
-
-      var rect = document.createElementNS(SVG.ns, 'rect')
-      rect.setAttributeNS(null, 'height', 100)
-      rect.setAttributeNS(null, 'width', 100)
-      rect.setAttributeNS(null, 'fill', '#f06')
-      bench.raw.appendChild(rect)
-    }
-  })
-  bench.test('using Snap.svg v0.5.1', function() {
-    for (var i = 0; i < 10000; i++) {
-      var g = bench.snap.gradient("L(0, 0, 100, 100)#000-#f00:25%-#fff")
-
-      bench.snap.rect(50, 50, 100, 100).attr({
-        fill: g
-      })
-    }
-  })
-})
-
-
-
-
-
-
-
-
+//
+// SVG.bench.describe('Generate 10000 rects with fill', function(bench) {
+//   bench.test('using SVG.js v2.5.3', function() {
+//     for (var i = 0; i < 10000; i++)
+//       bench.draw.rect(100,100).fill('#f06')
+//   })
+//   bench.test('using vanilla js', function() {
+//     for (var i = 0; i < 10000; i++) {
+//       var rect = document.createElementNS(SVG.ns, 'rect')
+//       rect.setAttributeNS(null, 'height', 100)
+//       rect.setAttributeNS(null, 'width', 100)
+//       rect.setAttributeNS(null, 'fill', '#f06')
+//       bench.raw.appendChild(rect)
+//     }
+//   })
+//   bench.test('using Snap.svg v0.5.1', function() {
+//     for (var i = 0; i < 10000; i++)
+//       bench.snap.rect(50, 50, 100, 100).attr('fill', '#f06')
+//   })
+// })
+//
+//
+// SVG.bench.describe('Generate 10000 rects with position and fill', function(bench) {
+//   bench.test('using SVG.js v2.5.3', function() {
+//     for (var i = 0; i < 10000; i++)
+//       bench.draw.rect(100,100).move(50,50).fill('#f06')
+//   })
+//   bench.test('using vanilla js', function() {
+//     for (var i = 0; i < 10000; i++) {
+//       var rect = document.createElementNS(SVG.ns, 'rect')
+//       rect.setAttributeNS(null, 'height', 100)
+//       rect.setAttributeNS(null, 'width', 100)
+//       rect.setAttributeNS(null, 'fill', '#f06')
+//       rect.setAttributeNS(null, 'x', 50)
+//       rect.setAttributeNS(null, 'y', 50)
+//       bench.raw.appendChild(rect)
+//     }
+//   })
+//   bench.test('using Snap.svg v0.5.1', function() {
+//     for (var i = 0; i < 10000; i++)
+//       bench.snap.rect(50, 50, 100, 100).attr('fill', '#f06')
+//   })
+// })
+//
+//
+// SVG.bench.describe('Generate 10000 rects with gradient fill', function(bench) {
+//   bench.test('using SVG.js v2.5.3', function() {
+//     for (var i = 0; i < 10000; i++) {
+//       var g = bench.draw.gradient('linear', function(add) {
+//         add.stop(0, '#000')
+//         add.stop(0.25, '#f00')
+//         add.stop(1, '#fff')
+//       })
+//
+//       bench.draw.rect(100,100).fill(g)
+//     }
+//   })
+//   bench.test('using vanilla js', function() {
+//     for (var i = 0; i < 10000; i++) {
+//       var g = document.createElementNS(SVG.ns, 'linearGradient')
+//       var stop = document.createElementNS(SVG.ns, 'stop')
+//       stop.setAttributeNS(null, 'offset', '0%')
+//       stop.setAttributeNS(null, 'color', '#000')
+//       g.appendChild(stop)
+//       stop = document.createElementNS(SVG.ns, 'stop')
+//       stop.setAttributeNS(null, 'offset', '25%')
+//       stop.setAttributeNS(null, 'color', '#f00')
+//       g.appendChild(stop)
+//       stop = document.createElementNS(SVG.ns, 'stop')
+//       stop.setAttributeNS(null, 'offset', '100%')
+//       stop.setAttributeNS(null, 'color', '#fff')
+//       g.appendChild(stop)
+//       bench.raw.appendChild(g)
+//
+//       var rect = document.createElementNS(SVG.ns, 'rect')
+//       rect.setAttributeNS(null, 'height', 100)
+//       rect.setAttributeNS(null, 'width', 100)
+//       rect.setAttributeNS(null, 'fill', '#f06')
+//       bench.raw.appendChild(rect)
+//     }
+//   })
+//   bench.test('using Snap.svg v0.5.1', function() {
+//     for (var i = 0; i < 10000; i++) {
+//       var g = bench.snap.gradient("L(0, 0, 100, 100)#000-#f00:25%-#fff")
+//
+//       bench.snap.rect(50, 50, 100, 100).attr({
+//         fill: g
+//       })
+//     }
+//   })
+// })
+//
index 7c9bc18eb8b70501dbc5ae0a041e66d12bbb45b4..44978bd8a1736b81169df0543828e08daa943031 100644 (file)
@@ -715,31 +715,61 @@ var SVG = (function () {
   var methods = {};
   var constructors = {};
   function registerMethods(name, m) {
+    if (Array.isArray(name)) {
+      var _iteratorNormalCompletion = true;
+      var _didIteratorError = false;
+      var _iteratorError = undefined;
+
+      try {
+        for (var _iterator = name[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
+          var _name = _step.value;
+          registerMethods(_name, m);
+        }
+      } catch (err) {
+        _didIteratorError = true;
+        _iteratorError = err;
+      } finally {
+        try {
+          if (!_iteratorNormalCompletion && _iterator.return != null) {
+            _iterator.return();
+          }
+        } finally {
+          if (_didIteratorError) {
+            throw _iteratorError;
+          }
+        }
+      }
+
+      return;
+    }
+
     if (_typeof(name) == 'object') {
       var _arr = Object.entries(name);
 
       for (var _i = 0; _i < _arr.length; _i++) {
         var _arr$_i = _slicedToArray(_arr[_i], 2),
-            _name = _arr$_i[0],
+            _name2 = _arr$_i[0],
             _m = _arr$_i[1];
 
-        registerMethods(_name, _m);
+        registerMethods(_name2, _m);
       }
+
+      return;
     }
 
     methods[name] = Object.assign(methods[name] || {}, m);
   }
   function getMethodsFor(name) {
-    return methods[name];
+    return methods[name] || {};
   } // FIXME: save memory?
   function registerConstructor(name, setup) {
     constructors[name] = setup;
   }
   function getConstructor(name) {
-    return {
+    return constructors[name] ? {
       setup: constructors[name],
       name: name
-    };
+    } : {};
   }
 
   var Doc$1 =
@@ -1053,7 +1083,7 @@ var SVG = (function () {
     }
   });
 
-  var SVGNumber =
+  var SVGNumber$1 =
   /*#__PURE__*/
   function () {
     // Initialize
@@ -1178,16 +1208,16 @@ var SVG = (function () {
   } // Set width of element
 
   function width(width) {
-    return width == null ? this.rx() * 2 : this.rx(new SVGNumber(width).divide(2));
+    return width == null ? this.rx() * 2 : this.rx(new SVGNumber$1(width).divide(2));
   } // Set height of element
 
   function height(height) {
-    return height == null ? this.ry() * 2 : this.ry(new SVGNumber(height).divide(2));
+    return height == null ? this.ry() * 2 : this.ry(new SVGNumber$1(height).divide(2));
   } // Custom size function
 
   function size(width, height) {
     var p = proportionalSize$1(this, width, height);
-    return this.rx(new SVGNumber(p.width).divide(2)).ry(new SVGNumber(p.height).divide(2));
+    return this.rx(new SVGNumber$1(p.width).divide(2)).ry(new SVGNumber$1(p.height).divide(2));
   }
 
   var circled = /*#__PURE__*/Object.freeze({
@@ -1247,7 +1277,7 @@ var SVG = (function () {
     Element: {
       // Create circle element
       circle: function circle(size$$1) {
-        return this.put(new Circle()).radius(new SVGNumber(size$$1).divide(2)).move(0, 0);
+        return this.put(new Circle()).radius(new SVGNumber$1(size$$1).divide(2)).move(0, 0);
       }
     }
   });
@@ -1354,7 +1384,7 @@ var SVG = (function () {
 
   function size$1(width, height) {
     var p = proportionalSize$1(this, width, height);
-    return this.width(new SVGNumber(p.width)).height(new SVGNumber(p.height));
+    return this.width(new SVGNumber$1(p.width)).height(new SVGNumber$1(p.height));
   } // Clone element
 
   function clone(parent) {
@@ -1380,6 +1410,10 @@ var SVG = (function () {
     return element;
   } // Add element to given container and return self
 
+  function addTo(parent) {
+    return makeInstance(parent).put(this);
+  } // Add element to given container and return container
+
   function putIn(parent) {
     return makeInstance(parent).add(this);
   } // Get / set id
@@ -1508,6 +1542,7 @@ var SVG = (function () {
     clone: clone,
     remove: remove,
     replace: replace,
+    addTo: addTo,
     putIn: putIn,
     id: id$1,
     inside: inside,
@@ -1675,7 +1710,7 @@ var SVG = (function () {
     _createClass(Stop, [{
       key: "update",
       value: function update(o) {
-        if (typeof o === 'number' || o instanceof SVGNumber) {
+        if (typeof o === 'number' || o instanceof SVGNumber$1) {
           o = {
             offset: arguments[0],
             color: arguments[1],
@@ -1686,7 +1721,7 @@ var SVG = (function () {
 
         if (o.opacity != null) this.attr('stop-opacity', o.opacity);
         if (o.color != null) this.attr('stop-color', o.color);
-        if (o.offset != null) this.attr('offset', new SVGNumber(o.offset));
+        if (o.offset != null) this.attr('offset', new SVGNumber$1(o.offset));
         return this;
       }
     }]);
@@ -1698,20 +1733,20 @@ var SVG = (function () {
   // FIXME: add to runner
   function from(x, y) {
     return (this._element || this).type === 'radialGradient' ? this.attr({
-      fx: new SVGNumber(x),
-      fy: new SVGNumber(y)
+      fx: new SVGNumber$1(x),
+      fy: new SVGNumber$1(y)
     }) : this.attr({
-      x1: new SVGNumber(x),
-      y1: new SVGNumber(y)
+      x1: new SVGNumber$1(x),
+      y1: new SVGNumber$1(y)
     });
   }
   function to(x, y) {
     return (this._element || this).type === 'radialGradient' ? this.attr({
-      cx: new SVGNumber(x),
-      cy: new SVGNumber(y)
+      cx: new SVGNumber$1(x),
+      cy: new SVGNumber$1(y)
     }) : this.attr({
-      x2: new SVGNumber(x),
-      y2: new SVGNumber(y)
+      x2: new SVGNumber$1(x),
+      y2: new SVGNumber$1(y)
     });
   }
 
@@ -2010,7 +2045,7 @@ var SVG = (function () {
 
 
       if (typeof val === 'number') {
-        val = new SVGNumber(val);
+        val = new SVGNumber$1(val);
       } else if (Color.isColor(val)) {
         // ensure full hex color
         val = new Color(val);
@@ -2774,7 +2809,7 @@ var SVG = (function () {
     return parser.nodes;
   }
 
-  var Point =
+  var Point$1 =
   /*#__PURE__*/
   function () {
     // Initialize
@@ -2837,7 +2872,7 @@ var SVG = (function () {
     Element: {
       // Get point
       point: function point(x, y) {
-        return new Point(x, y).transform(this.screenCTM().inverse());
+        return new Point$1(x, y).transform(this.screenCTM().inverse());
       }
     }
   });
@@ -3115,8 +3150,8 @@ var SVG = (function () {
 
 
         var result = [];
-        var p = new Point();
-        var p0 = new Point();
+        var p = new Point$1();
+        var p0 = new Point$1();
         var index = 0;
         var len = array.length;
 
@@ -3433,7 +3468,7 @@ var SVG = (function () {
       _classCallCheck(this, Text);
 
       _this = _possibleConstructorReturn(this, _getPrototypeOf(Text).call(this, nodeOrNew$1('text', node), Text));
-      _this.dom.leading = new SVGNumber(1.3); // store leading value for rebuilding
+      _this.dom.leading = new SVGNumber$1(1.3); // store leading value for rebuilding
 
       _this._rebuild = true; // enable automatic updating of dy values
 
@@ -3538,7 +3573,7 @@ var SVG = (function () {
         } // act as setter
 
 
-        this.dom.leading = new SVGNumber(value);
+        this.dom.leading = new SVGNumber$1(value);
         return this.rebuild();
       } // Rebuild appearance type
 
@@ -3554,7 +3589,7 @@ var SVG = (function () {
         if (this._rebuild) {
           var self = this;
           var blankLineOffset = 0;
-          var dy = this.dom.leading * new SVGNumber(this.attr('font-size'));
+          var dy = this.dom.leading * new SVGNumber$1(this.attr('font-size'));
           this.each(function () {
             if (this.dom.newLined) {
               this.attr('x', self.attr('x'));
@@ -3584,7 +3619,7 @@ var SVG = (function () {
       key: "setData",
       value: function setData(o) {
         this.dom = o;
-        this.dom.leading = new SVGNumber(o.leading || 1.3);
+        this.dom.leading = new SVGNumber$1(o.leading || 1.3);
         return this;
       }
     }]);
@@ -3789,7 +3824,7 @@ var SVG = (function () {
   });
   register(Use);
 
-  var Matrix =
+  var Matrix$1 =
   /*#__PURE__*/
   function () {
     function Matrix() {
@@ -3833,7 +3868,7 @@ var SVG = (function () {
         var t = Matrix.formatTransforms(o);
         var current = this;
 
-        var _transform = new Point(t.ox, t.oy).transform(current),
+        var _transform = new Point$1(t.ox, t.oy).transform(current),
             ox = _transform.x,
             oy = _transform.y; // Construct the resulting matrix
 
@@ -3841,7 +3876,7 @@ var SVG = (function () {
         var transformer = new Matrix().translateO(t.rx, t.ry).lmultiplyO(current).translateO(-ox, -oy).scaleO(t.scaleX, t.scaleY).skewO(t.skewX, t.skewY).shearO(t.shear).rotateO(t.theta).translateO(ox, oy); // If we want the origin at a particular place, we force it there
 
         if (isFinite(t.px) || isFinite(t.py)) {
-          var origin = new Point(ox, oy).transform(transformer); // TODO: Replace t.px with isFinite(t.px)
+          var origin = new Point$1(ox, oy).transform(transformer); // TODO: Replace t.px with isFinite(t.px)
 
           var dx = t.px ? t.px - origin.x : 0;
           var dy = t.py ? t.py - origin.y : 0;
@@ -4229,16 +4264,16 @@ var SVG = (function () {
         var scaleY = o.scale && o.scale.length ? o.scale[1] * flipY : isFinite(o.scale) ? o.scale * flipY : isFinite(o.scaleY) ? o.scaleY * flipY : flipY;
         var shear = o.shear || 0;
         var theta = o.rotate || o.theta || 0;
-        var origin = new Point(o.origin || o.around || o.ox || o.originX, o.oy || o.originY);
+        var origin = new Point$1(o.origin || o.around || o.ox || o.originX, o.oy || o.originY);
         var ox = origin.x;
         var oy = origin.y;
-        var position = new Point(o.position || o.px || o.positionX, o.py || o.positionY);
+        var position = new Point$1(o.position || o.px || o.positionX, o.py || o.positionY);
         var px = position.x;
         var py = position.y;
-        var translate = new Point(o.translate || o.tx || o.translateX, o.ty || o.translateY);
+        var translate = new Point$1(o.translate || o.tx || o.translateX, o.ty || o.translateY);
         var tx = translate.x;
         var ty = translate.y;
-        var relative = new Point(o.relative || o.rx || o.relativeX, o.ry || o.relativeY);
+        var relative = new Point$1(o.relative || o.rx || o.relativeX, o.ry || o.relativeY);
         var rx = relative.x;
         var ry = relative.y; // Populate all of the values
 
@@ -4287,7 +4322,7 @@ var SVG = (function () {
     Element: {
       // Get current matrix
       ctm: function ctm() {
-        return new Matrix(this.node.getCTM());
+        return new Matrix$1(this.node.getCTM());
       },
       // Get current screen matrix
       screenCTM: function screenCTM() {
@@ -4299,10 +4334,10 @@ var SVG = (function () {
           var rect = this.rect(1, 1);
           var m = rect.node.getScreenCTM();
           rect.remove();
-          return new Matrix(m);
+          return new Matrix$1(m);
         }
 
-        return new Matrix(this.node.getScreenCTM());
+        return new Matrix$1(this.node.getScreenCTM());
       }
     }
   });
@@ -4345,7 +4380,7 @@ var SVG = (function () {
         var xMax = -Infinity;
         var yMin = Infinity;
         var yMax = -Infinity;
-        var pts = [new Point(this.x, this.y), new Point(this.x2, this.y), new Point(this.x, this.y2), new Point(this.x2, this.y2)];
+        var pts = [new Point$1(this.x, this.y), new Point$1(this.x2, this.y), new Point$1(this.x, this.y2), new Point$1(this.x2, this.y2)];
         pts.forEach(function (p) {
           p = p.transform(m);
           xMin = Math.min(xMin, p.x);
@@ -4709,14 +4744,14 @@ var SVG = (function () {
           var type = _typeof(value);
 
           if (type === 'number') {
-            this.type(SVGNumber);
+            this.type(SVGNumber$1);
           } else if (type === 'string') {
             if (Color.isColor(value)) {
               this.type(Color);
             } else if (regex.delimiter.test(value)) {
               this.type(regex.pathLetters.test(value) ? PathArray : SVGArray);
             } else if (regex.numberAndUnit.test(value)) {
-              this.type(SVGNumber);
+              this.type(SVGNumber$1);
             } else {
               this.type(Morphable.NonMorphable);
             }
@@ -4893,7 +4928,7 @@ var SVG = (function () {
     return _class3;
   }();
 
-  var morphableTypes = [SVGNumber, Color, Box$1, Matrix, SVGArray, PointArray$1, PathArray, Morphable.NonMorphable, Morphable.TransformBag, Morphable.ObjectBag];
+  var morphableTypes = [SVGNumber$1, Color, Box$1, Matrix$1, SVGArray, PointArray$1, PathArray, Morphable.NonMorphable, Morphable.TransformBag, Morphable.ObjectBag];
   extend$1(morphableTypes, {
     to: function to(val, args) {
       return new Morphable().type(this.constructor).from(this.valueOf()).to(val, args);
@@ -5205,7 +5240,7 @@ var SVG = (function () {
   //   '<': function (pos) { return -Math.cos(pos * Math.PI / 2) + 1 }
   // }
 
-  var Runner =
+  var Runner$1 =
   /*#__PURE__*/
   function () {
     function Runner(options) {
@@ -5233,7 +5268,7 @@ var SVG = (function () {
       this._time = 0;
       this._last = 0; // Save transforms applied to this runner
 
-      this.transforms = new Matrix();
+      this.transforms = new Matrix$1();
       this.transformId = 1; // Looping variables
 
       this._haveReversed = false;
@@ -5474,7 +5509,7 @@ var SVG = (function () {
           this._initialise(running); // clear the transforms on this runner so they dont get added again and again
 
 
-          this.transforms = new Matrix();
+          this.transforms = new Matrix$1();
 
           var converged = this._run(declarative ? dt : position); // this.fire('step', this)
 
@@ -5608,7 +5643,7 @@ var SVG = (function () {
     }, {
       key: "clearTransform",
       value: function clearTransform() {
-        this.transforms = new Matrix();
+        this.transforms = new Matrix$1();
         return this;
       }
     }], [{
@@ -5644,10 +5679,10 @@ var SVG = (function () {
 
     return Runner;
   }();
-  Runner.id = 0;
+  Runner$1.id = 0;
 
   var FakeRunner = function FakeRunner() {
-    var transforms = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Matrix();
+    var transforms = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Matrix$1();
     var id = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -1;
     var done = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
 
@@ -5658,7 +5693,7 @@ var SVG = (function () {
     this.done = done;
   };
 
-  extend$1([Runner, FakeRunner], {
+  extend$1([Runner$1, FakeRunner], {
     mergeWith: function mergeWith(runner) {
       return new FakeRunner(runner.transforms.lmultiply(this.transforms), runner.id);
     }
@@ -5675,7 +5710,7 @@ var SVG = (function () {
   function mergeTransforms() {
     // Find the matrix to apply to the element and apply it
     var runners = this._transformationRunners.runners;
-    var netTransform = runners.map(getRunnerTransform).reduce(lmultiply, new Matrix());
+    var netTransform = runners.map(getRunnerTransform).reduce(lmultiply, new Matrix$1());
     this.transform(netTransform);
 
     this._transformationRunners.merge();
@@ -5769,9 +5804,9 @@ var SVG = (function () {
   registerMethods({
     Element: {
       animate: function animate(duration, delay, when) {
-        var o = Runner.sanitise(duration, delay, when);
+        var o = Runner$1.sanitise(duration, delay, when);
         var timeline$$1 = this.timeline();
-        return new Runner(o.duration).loop(o).element(this).timeline(timeline$$1).schedule(delay, when);
+        return new Runner$1(o.duration).loop(o).element(this).timeline(timeline$$1).schedule(delay, when);
       },
       delay: function delay(by, when) {
         return this.animate(0, by, when);
@@ -5789,7 +5824,7 @@ var SVG = (function () {
         // taken into account
         .filter(function (runner) {
           return runner.id <= current.id;
-        }).map(getRunnerTransform).reduce(lmultiply, new Matrix());
+        }).map(getRunnerTransform).reduce(lmultiply, new Matrix$1());
       },
       addRunner: function addRunner(runner) {
         this._transformationRunners.add(runner);
@@ -5798,13 +5833,13 @@ var SVG = (function () {
       },
       _prepareRunner: function _prepareRunner() {
         if (this._frameId == null) {
-          this._transformationRunners = new RunnerArray().add(new FakeRunner(new Matrix(this)));
+          this._transformationRunners = new RunnerArray().add(new FakeRunner(new Matrix$1(this)));
           this._frameId = frameId++;
         }
       }
     }
   });
-  extend$1(Runner, {
+  extend$1(Runner$1, {
     attr: function attr(a, v) {
       return this.styleAttr('attr', a, v);
     },
@@ -5830,7 +5865,7 @@ var SVG = (function () {
       return this;
     },
     zoom: function zoom(level, point) {
-      var morpher = new Morphable(this._stepper).to(new SVGNumber(level));
+      var morpher = new Morphable(this._stepper).to(new SVGNumber$1(level));
       this.queue(function () {
         morpher = morpher.from(this.zoom());
       }, function (pos) {
@@ -5867,7 +5902,7 @@ var SVG = (function () {
       var isMatrix = isMatrixLike(transforms);
       affine = transforms.affine != null ? transforms.affine : affine != null ? affine : !isMatrix; // Create a morepher and set its type
 
-      var morpher = new Morphable().type(affine ? Morphable.TransformBag : Matrix).stepper(this._stepper);
+      var morpher = new Morphable().type(affine ? Morphable.TransformBag : Matrix$1).stepper(this._stepper);
       var origin;
       var element;
       var current;
@@ -5878,7 +5913,7 @@ var SVG = (function () {
         // make sure element and origin is defined
         element = element || this.element();
         origin = origin || getOrigin(transforms, element);
-        startTransform = new Matrix(relative ? undefined : element); // add the runner to the element so it can merge transformations
+        startTransform = new Matrix$1(relative ? undefined : element); // add the runner to the element so it can merge transformations
 
         element.addRunner(this); // Deactivate all transforms that have run so far if we are absolute
 
@@ -5892,11 +5927,11 @@ var SVG = (function () {
         // on this runner. We are absolute. We dont need these!
         if (!relative) this.clearTransform();
 
-        var _transform = new Point(origin).transform(element._currentTransform(this)),
+        var _transform = new Point$1(origin).transform(element._currentTransform(this)),
             x = _transform.x,
             y = _transform.y;
 
-        var target = new Matrix(_objectSpread({}, transforms, {
+        var target = new Matrix$1(_objectSpread({}, transforms, {
           origin: [x, y]
         }));
         var start = this._isDeclarative && current ? current : startTransform;
@@ -5933,7 +5968,7 @@ var SVG = (function () {
         morpher.to(target);
         var affineParameters = morpher.at(pos);
         currentAngle = affineParameters.rotate;
-        current = new Matrix(affineParameters);
+        current = new Matrix$1(affineParameters);
         this.addTransform(current);
         return morpher.done();
       }
@@ -5969,7 +6004,7 @@ var SVG = (function () {
       return this._queueNumberDelta('dy', y);
     },
     _queueNumberDelta: function _queueNumberDelta(method, to) {
-      to = new SVGNumber(to); // Try to change the target if we have this method already registerd
+      to = new SVGNumber$1(to); // Try to change the target if we have this method already registerd
 
       if (this._tryRetargetDelta(method, to)) return this; // Make a morpher and queue the animation
 
@@ -6004,7 +6039,7 @@ var SVG = (function () {
       return this;
     },
     _queueNumber: function _queueNumber(method, value) {
-      return this._queueObject(method, new SVGNumber(value));
+      return this._queueObject(method, new SVGNumber$1(value));
     },
     // Animatable center x-axis
     cx: function cx(x) {
@@ -6163,17 +6198,17 @@ var SVG = (function () {
     TextPath: TextPath,
     Tspan: Tspan,
     Use: Use,
-    SVGNumber: SVGNumber,
+    SVGNumber: SVGNumber$1,
     SVGArray: SVGArray,
     PathArray: PathArray,
     PointArray: PointArray$1,
-    Matrix: Matrix,
-    Point: Point,
+    Matrix: Matrix$1,
+    Point: Point$1,
     Box: Box$1,
     Color: Color,
     Morphable: Morphable,
     Queue: Queue,
-    Runner: Runner,
+    Runner: Runner$1,
     Timeline: Timeline,
     Controller: Controller,
     Ease: Ease,
@@ -6334,7 +6369,7 @@ var SVG = (function () {
       }
 
       return matrix[transform[0]].apply(matrix, transform[1]);
-    }, new Matrix());
+    }, new Matrix$1());
     return matrix;
   } // add an element to another parent without changing the visual representation on the screen
 
@@ -6353,7 +6388,7 @@ var SVG = (function () {
   function transform(o, relative) {
     // Act as a getter if no object was passed
     if (o == null || typeof o === 'string') {
-      var decomposed = new Matrix(this).decompose();
+      var decomposed = new Matrix$1(this).decompose();
       return decomposed[o] || decomposed;
     }
 
@@ -6366,7 +6401,7 @@ var SVG = (function () {
 
 
     var cleanRelative = relative === true ? this : relative || false;
-    var result = new Matrix(cleanRelative).transform(o);
+    var result = new Matrix$1(cleanRelative).transform(o);
     return this.attr('transform', result);
   }
   registerMethods('Element', {
@@ -6420,6 +6455,157 @@ var SVG = (function () {
   });
   registerConstructor('Memory', setup$1);
 
+  var sugar = {
+    stroke: ['color', 'width', 'opacity', 'linecap', 'linejoin', 'miterlimit', 'dasharray', 'dashoffset'],
+    fill: ['color', 'opacity', 'rule'],
+    prefix: function prefix(t, a) {
+      return a === 'color' ? t : t + '-' + a;
+    } // Add sugar for fill and stroke
+
+  };
+  ['fill', 'stroke'].forEach(function (m) {
+    var extension = {};
+    var i;
+
+    extension[m] = function (o) {
+      if (typeof o === 'undefined') {
+        return this;
+      }
+
+      if (typeof o === 'string' || Color.isRgb(o) || o && typeof o.fill === 'function') {
+        this.attr(m, o);
+      } else {
+        // set all attributes from sugar.fill and sugar.stroke list
+        for (i = sugar[m].length - 1; i >= 0; i--) {
+          if (o[sugar[m][i]] != null) {
+            this.attr(sugar.prefix(m, sugar[m][i]), o[sugar[m][i]]);
+          }
+        }
+      }
+
+      return this;
+    };
+
+    registerMethods(['Element', 'Runner'], extension);
+  });
+  registerMethods(['Element', 'Runner'], {
+    // Let the user set the matrix directly
+    matrix: function matrix(mat, b, c, d, e, f) {
+      // Act as a getter
+      if (mat == null) {
+        return new Matrix(this);
+      } // Act as a setter, the user can pass a matrix or a set of numbers
+
+
+      return this.attr('transform', new Matrix(mat, b, c, d, e, f));
+    },
+    // Map rotation to transform
+    rotate: function rotate(angle, cx, cy) {
+      return this.transform({
+        rotate: angle,
+        ox: cx,
+        oy: cy
+      }, true);
+    },
+    // Map skew to transform
+    skew: function skew(x, y, cx, cy) {
+      return arguments.length === 1 || arguments.length === 3 ? this.transform({
+        skew: x,
+        ox: y,
+        oy: cx
+      }, true) : this.transform({
+        skew: [x, y],
+        ox: cx,
+        oy: cy
+      }, true);
+    },
+    shear: function shear(lam, cx, cy) {
+      return this.transform({
+        shear: lam,
+        ox: cx,
+        oy: cy
+      }, true);
+    },
+    // Map scale to transform
+    scale: function scale(x, y, cx, cy) {
+      return arguments.length === 1 || arguments.length === 3 ? this.transform({
+        scale: x,
+        ox: y,
+        oy: cx
+      }, true) : this.transform({
+        scale: [x, y],
+        ox: cx,
+        oy: cy
+      }, true);
+    },
+    // Map translate to transform
+    translate: function translate(x, y) {
+      return this.transform({
+        translate: [x, y]
+      }, true);
+    },
+    // Map relative translations to transform
+    relative: function relative(x, y) {
+      return this.transform({
+        relative: [x, y]
+      }, true);
+    },
+    // Map flip to transform
+    flip: function flip(direction, around) {
+      var directionString = typeof direction === 'string' ? direction : isFinite(direction) ? 'both' : 'both';
+      var origin = direction === 'both' && isFinite(around) ? [around, around] : direction === 'x' ? [around, 0] : direction === 'y' ? [0, around] : isFinite(direction) ? [direction, direction] : [0, 0];
+      this.transform({
+        flip: directionString,
+        origin: origin
+      }, true);
+    },
+    // Opacity
+    opacity: function opacity(value) {
+      return this.attr('opacity', value);
+    },
+    // Relative move over x axis
+    dx: function dx(x) {
+      return this.x(new SVGNumber(x).plus(this instanceof Runner ? 0 : this.x()), true);
+    },
+    // Relative move over y axis
+    dy: function dy(y) {
+      return this.y(new SVGNumber(y).plus(this instanceof Runner ? 0 : this.y()), true);
+    },
+    // Relative move over x and y axes
+    dmove: function dmove(x, y) {
+      return this.dx(x).dy(y);
+    }
+  });
+  registerMethods('radius', {
+    // Add x and y radius
+    radius: function radius(x, y) {
+      var type = (this._target || this).type;
+      return type === 'radialGradient' || type === 'radialGradient' ? this.attr('r', new SVGNumber(x)) : this.rx(x).ry(y == null ? x : y);
+    }
+  });
+  registerMethods('Path', {
+    // Get path length
+    length: function length() {
+      return this.node.getTotalLength();
+    },
+    // Get point at length
+    pointAt: function pointAt(length) {
+      return new Point(this.node.getPointAtLength(length));
+    }
+  });
+  registerMethods(['Container', 'Runner'], {
+    // Set font
+    font: function font(a, v) {
+      if (_typeof(a) === 'object') {
+        for (v in a) {
+          this.font(v, a[v]);
+        }
+      }
+
+      return a === 'leading' ? this.leading(v) : a === 'anchor' ? this.attr('text-anchor', v) : a === 'size' || a === 'family' || a === 'weight' || a === 'stretch' || a === 'variant' || a === 'style' ? this.attr('font-' + a, v) : this.attr(a, v);
+    }
+  });
+
   function setup$2() {
     var node = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
     this.events = node.events || {};
@@ -6462,8 +6648,10 @@ var SVG = (function () {
   function add(element, i) {
     element = makeInstance(element);
 
-    if (element.node !== this.node.children[i]) {
-      this.node.insertBefore(element.node, this.node.children[i] || null);
+    if (i == null) {
+      this.node.appendChild(element.node);
+    } else if (element.node !== this.node.childNodes[i]) {
+      this.node.insertBefore(element.node, this.node.childNodes[i]);
     }
 
     return this;
@@ -6606,6 +6794,7 @@ var SVG = (function () {
   extend$2(Path, getMethodsFor('Path'));
   extend$2(Defs, getMethodsFor('Defs'));
   extend$2([Text$1, Tspan], getMethodsFor('Tspan'));
+  extend$2([Rect, Ellipse, Circle, Gradient], getMethodsFor('radius'));
   var containerMethods = getMethodsFor('Container'); // FIXME: We need a container array
 
   for (var i$1 in containers) {
index 9d05a1fcb94d086aa749ca9db40e87c50194af91..4571bd5792113cf77f10272cbef7e4e32f68f8c3 100644 (file)
@@ -1 +1 @@
-var SVG=function(){"use strict";function l(t){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function c(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function a(t,e,n){return e&&i(t.prototype,e),n&&i(t,n),t}function _(r){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{},e=Object.keys(s);"function"==typeof Object.getOwnPropertySymbols&&(e=e.concat(Object.getOwnPropertySymbols(s).filter(function(t){return Object.getOwnPropertyDescriptor(s,t).enumerable}))),e.forEach(function(t){var e,n,i;e=r,i=s[n=t],n in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i})}return r}function u(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&n(t,e)}function o(t){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function n(t,e){return(n=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function r(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function f(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?r(t):e}function s(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=[],i=!0,r=!1,s=void 0;try{for(var u,a=t[Symbol.iterator]();!(i=(u=a.next()).done)&&(n.push(u.value),!e||n.length!==e);i=!0);}catch(t){r=!0,s=t}finally{try{i||null==a.return||a.return()}finally{if(r)throw s}}return n}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function O(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var d=function(){function l(t,e){var n=e.extensions,i=void 0===n?[]:n;c(this,l);var r=!0,s=!(this.tags=[]),u=void 0;try{for(var a,o=i[Symbol.iterator]();!(r=(a=o.next()).done);r=!0){var h=a.value;h.setup.call(this,t),this.tags.push(h.name)}}catch(t){s=!0,u=t}finally{try{r||null==o.return||o.return()}finally{if(s)throw u}}}return a(l,[{key:"is",value:function(t){return this.tags.includes(t)}}]),l}(),h=/^([+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?)([a-z%]*)$/i,v=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,y=/rgb\((\d+),(\d+),(\d+)\)/,t=/\)\s*,?\s*/,p=/\s/g,m=/^#[a-f0-9]{3,6}$/i,g=/^rgb\(/,w=/^(\s+)?$/,k=/^[+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,x=/\.(jpg|jpeg|png|gif|svg)(\?[^=]+.*)?/i,b=/[\s,]+/,A=/([^e])-/gi,M=/[MLHVCSQTAZ]/gi,T=/[MLHVCSQTAZ]/i,C=/((\d?\.\d+(?:e[+-]?\d+)?)((?:\.\d+(?:e[+-]?\d+)?)+))+/gi,j=/\./g;function S(t,e,n,i){return n+i.replace(j," .")}function E(t){return t.toLowerCase().replace(/-(.)/g,function(t,e){return e.toUpperCase()})}function e(t){return t.charAt(0).toUpperCase()+t.slice(1)}function N(t){var e=t.toString(16);return 1===e.length?"0"+e:e}function P(t,e,n){if(null==e||null==n){var i=t.bbox();null==e?e=i.width/i.height*n:null==n&&(n=i.height/i.width*e)}return{width:e,height:n}}function D(t){return{a:t[0],b:t[1],c:t[2],d:t[3],e:t[4],f:t[5]}}var z="abcdef".split("");function q(t,e,n){return Math.abs(e-t)<(n||1e-6)}function I(t){return null!=t.a||null!=t.b||null!=t.c||null!=t.d||null!=t.e||null!=t.f}function L(t,e){var n,i,r=t.origin;if("string"==typeof r||null==r){var s=(r||"center").toLowerCase().trim(),u=e.bbox(),a=u.height,o=u.width,h=u.x,l=u.y,c=s.includes("left")?h:s.includes("right")?h+o:h+o/2,f=s.includes("top")?l:s.includes("bottom")?l+a:l+a/2;n=null!=t.ox?t.ox:c,i=null!=t.oy?t.oy:f}else n=r[0],i=r[1];return[n,i]}var R="http://www.w3.org/2000/svg",B="http://www.w3.org/2000/xmlns/",X="http://www.w3.org/1999/xlink";function Y(t,e){return e||F(t)}function F(t){return document.createElementNS(R,t)}function H(e,t){var n,i;if(Array.isArray(t))t.forEach(function(t){H(e,t)});else for(i=(e=Array.isArray(e)?e:[e]).length-1;0<=i;i--)for(n in t.name&&(e[i].extensions=(e[i].extensions||[]).concat(t)),t)e[i].prototype[n]||"name"==n||"setup"==n||(e[i].prototype[n]=t[n])}var G=Object.freeze({nodeOrNew:Y,makeNode:F,extend:H,addFactory:function(t,e){H(t,e)},invent:function(e){var t="function"==typeof e.create?e.create:function(t){e.inherit.call(this,t||F(e.create))};return e.inherit&&(t.prototype=new e.inherit,t.prototype.constructor=t),e.extend&&H(t,e.extend),e.construct&&H(e.parent||Container,e.construct),t}}),V={},U=Symbol("root");function Q(t){if(t instanceof d)return t;if("object"===l(t))return $(t);if(null==t)return new V[U];if("string"==typeof t&&"<"!==t.charAt(0))return $(document.querySelector(t));var e=F("svg");return e.innerHTML=t,t=$(e.firstElementChild)}function $(t){return t?t.instance instanceof d?t.instance:t instanceof window.SVGElement?"svg"===t.nodeName?new V[U](t):"linearGradient"===t.nodeName||"radialGradient"===t.nodeName?new V.Gradient(t):V[e(t.nodeName)]?new(V[e(t.nodeName)])(t):new V.Bare(t):new V.HtmlNode(t):null}function W(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:t.name,n=2<arguments.length&&void 0!==arguments[2]&&arguments[2];return V[e]=t,n&&(V[U]=t),t}function Z(t){return V[t]}var J=1e3;function K(t){return"Svgjs"+e(t)+J++}function tt(t){for(var e=t.children.length-1;0<=e;e--)tt(t.children[e]);return t.id?$(t).id(K(t.nodeName)):$(t)}var et=Object.freeze({root:U,makeInstance:Q,adopt:$,register:W,getClass:Z,eid:K,assignNewId:tt}),nt=function(t){function n(t){var e;return c(this,n),(e=f(this,o(n).call(this,t,n))).node=t,e}return u(n,d),a(n,[{key:"add",value:function(t,e){return(t=Q(t)).node!==this.node.children[e]&&this.node.insertBefore(t.node,this.node.children[e]||null),this}},{key:"put",value:function(t,e){return this.add(t,e),t}},{key:"getEventTarget",value:function(){return this.node}}]),n}();W(nt);var it=function(t){function e(t){return c(this,e),f(this,o(e).call(this,Y("defs",t),e))}return u(e,d),a(e,[{key:"flatten",value:function(){return this}},{key:"ungroup",value:function(){return this}}]),e}();W(it);var rt={},st={};function ut(t,e){if("object"==l(t))for(var n=Object.entries(t),i=0;i<n.length;i++){var r=s(n[i],2);ut(r[0],r[1])}rt[t]=Object.assign(rt[t]||{},e)}function at(t){return rt[t]}function ot(t,e){st[t]=e}function ht(t){return{setup:st[t],name:t}}var lt=function(t){function n(t){var e;return c(this,n),(e=f(this,o(n).call(this,Y("svg",t),n))).namespace(),e}return u(n,d),a(n,[{key:"isRoot",value:function(){return!(this.node.parentNode&&this.node.parentNode instanceof window.SVGElement&&"#document"!==this.node.parentNode.nodeName)}},{key:"doc",value:function(){return this.isRoot()?this:Element.doc.call(this)}},{key:"namespace",value:function(){return this.isRoot()?this.attr({xmlns:R,version:"1.1"}).attr("xmlns:xlink",X,B).attr("xmlns:svgjs","http://svgjs.com/svgjs",B):this.doc().namespace()}},{key:"defs",value:function(){return this.isRoot()?$(this.node.getElementsByTagName("defs")[0])||this.put(new it):this.doc().defs()}},{key:"parent",value:function(t){return this.isRoot()?"#document"===this.node.parentNode.nodeName?null:this.node.parentNode:Element.parent.call(this,t)}},{key:"remove",value:function(){return this.isRoot()?(this.parent()&&this.parent().removeChild(this.node),this):Element.remove.call(this)}},{key:"clear",value:function(){for(;this.node.hasChildNodes();)this.node.removeChild(this.node.lastChild);return this}}]),n}();ut({Container:{nested:function(){return this.put(new lt)}}}),W(lt,"Doc",!0);var ct=function(t){function e(t){return c(this,e),f(this,o(e).call(this,nodeorNew("g",t),e))}return u(e,d),e}();ut({Element:{group:function(){return this.put(new ct)}}}),W(ct);var ft=function(){function t(){c(this,t),this._first=null,this._last=null}return a(t,[{key:"push",value:function(t){var e=t.next?t:{value:t,next:null,prev:null};return this._last?(e.prev=this._last,this._last.next=e,this._last=e):(this._last=e,this._first=e),e}},{key:"shift",value:function(){var t=this._first;return t?(this._first=t.next,this._first&&(this._first.prev=null),this._last=this._first?this._last:null,t.value):null}},{key:"first",value:function(){return this._first&&this._first.value}},{key:"last",value:function(){return this._last&&this._last.value}},{key:"remove",value:function(t){t.prev&&(t.prev.next=t.next),t.next&&(t.next.prev=t.prev),t===this._last&&(this._last=t.prev),t===this._first&&(this._first=t.next),t.prev=null,t.next=null}}]),t}(),dt={nextDraw:null,frames:new ft,timeouts:new ft,timer:window.performance||window.Date,transforms:[],frame:function(t){var e=dt.frames.push({run:t});return null===dt.nextDraw&&(dt.nextDraw=window.requestAnimationFrame(dt._draw)),e},transform_frame:function(t,e){dt.transforms[e]=t},timeout:function(t,e){e=e||0;var n=dt.timer.now()+e,i=dt.timeouts.push({run:t,time:n});return null===dt.nextDraw&&(dt.nextDraw=window.requestAnimationFrame(dt._draw)),i},cancelFrame:function(t){dt.frames.remove(t)},clearTimeout:function(t){dt.timeouts.remove(t)},_draw:function(t){for(var e=null,n=dt.timeouts.last();(e=dt.timeouts.shift())&&(t>=e.time?e.run():dt.timeouts.push(e),e!==n););for(var i=null,r=dt.frames.last();i!==r&&(i=dt.frames.shift());)i.run();dt.transforms.forEach(function(t){t()}),dt.nextDraw=dt.timeouts.first()||dt.frames.first()?window.requestAnimationFrame(dt._draw):null}},vt=function(t){function i(t,e){var n;return c(this,i),n=f(this,o(i).call(this,Y(null,t),i)),extend(r(r(n)),e),n}return u(i,d),a(i,[{key:"words",value:function(t){for(;this.node.hasChildNodes();)this.node.removeChild(this.node.lastChild);return this.node.appendChild(document.createTextNode(t)),this}}]),i}();W(vt),ut("Bare",{element:function(t,e){var n=createCustom(t,e);return this.put(new n)}});var yt=function(){function n(){c(this,n),this.init.apply(this,arguments)}return a(n,[{key:"init",value:function(t,e){e=Array.isArray(t)?t[1]:e,t=Array.isArray(t)?t[0]:t,this.value=0,this.unit=e||"","number"==typeof t?this.value=isNaN(t)?0:isFinite(t)?t:t<0?-34e37:34e37:"string"==typeof t?(e=t.match(h))&&(this.value=parseFloat(e[1]),"%"===e[5]?this.value/=100:"s"===e[5]&&(this.value*=1e3),this.unit=e[5]):t instanceof n&&(this.value=t.valueOf(),this.unit=t.unit)}},{key:"toString",value:function(){return("%"===this.unit?~~(1e8*this.value)/1e6:"s"===this.unit?this.value/1e3:this.value)+this.unit}},{key:"toJSON",value:function(){return this.toString()}},{key:"toArray",value:function(){return[this.value,this.unit]}},{key:"valueOf",value:function(){return this.value}},{key:"plus",value:function(t){return new n(this+(t=new n(t)),this.unit||t.unit)}},{key:"minus",value:function(t){return new n(this-(t=new n(t)),this.unit||t.unit)}},{key:"times",value:function(t){return new n(this*(t=new n(t)),this.unit||t.unit)}},{key:"divide",value:function(t){return new n(this/(t=new n(t)),this.unit||t.unit)}}]),n}();function pt(t){return null==t?this.cx()-this.rx():this.cx(t+this.rx())}function mt(t){return null==t?this.cy()-this.ry():this.cy(t+this.ry())}function gt(t){return null==t?this.attr("cx"):this.attr("cx",t)}function wt(t){return null==t?this.attr("cy"):this.attr("cy",t)}function kt(t){return null==t?2*this.rx():this.rx(new yt(t).divide(2))}function xt(t){return null==t?2*this.ry():this.ry(new yt(t).divide(2))}function bt(t,e){var n=P(this,t,e);return this.rx(new yt(n.width).divide(2)).ry(new yt(n.height).divide(2))}var _t=Object.freeze({rx:function(t){return this.attr("rx",t)},ry:function(t){return this.attr("ry",t)},x:pt,y:mt,cx:gt,cy:wt,width:kt,height:xt,size:bt}),Ot=function(t){function e(t){return c(this,e),f(this,o(e).call(this,Y("circle",t),e))}return u(e,d),a(e,[{key:"radius",value:function(t){return this.attr("r",t)}},{key:"rx",value:function(t){return this.attr("r",t)}},{key:"ry",value:function(t){return this.rx(t)}}]),e}();function At(t){return t%360*Math.PI/180}function Mt(t,e){return utils.map((e||document).querySelectorAll(t),function(t){return $(t)})}H(Ot,{x:pt,y:mt,cx:gt,cy:wt,width:kt,height:xt,size:bt}),ut({Element:{circle:function(t){return this.put(new Ot).radius(new yt(t).divide(2)).move(0,0)}}}),W(Ot),ut("Container",{find:function(t){return Mt(t,this.node)}});var Tt=Z(U);function Ct(){return this.parent()&&this.parent().removeElement(this),this}ut("Element",{x:function(t){return this.attr("x",t)},y:function(t){return this.attr("y",t)},cx:function(t){return null==t?this.x()+this.width()/2:this.x(t-this.width()/2)},cy:function(t){return null==t?this.y()+this.height()/2:this.y(t-this.height()/2)},move:function(t,e){return this.x(t).y(e)},center:function(t,e){return this.cx(t).cy(e)},width:function(t){return this.attr("width",t)},height:function(t){return this.attr("height",t)},size:function(t,e){var n=P(this,t,e);return this.width(new yt(n.width)).height(new yt(n.height))},clone:function(t){this.writeDataToDom();var e=tt(this.node.cloneNode(!0));return t?t.add(e):this.after(e),e},remove:Ct,replace:function(t){return this.after(t).remove(),t},putIn:function(t){return Q(t).add(this)},id:function(t){return void 0!==t||this.node.id||(this.node.id=K(this.type)),this.attr("id",t)},inside:function(t,e){var n=this.bbox();return t>n.x&&e>n.y&&t<n.x+n.width&&e<n.y+n.height},toString:function(){return this.id()},classes:function(){var t=this.attr("class");return null==t?[]:t.trim().split(b)},hasClass:function(t){return-1!==this.classes().indexOf(t)},addClass:function(t){if(!this.hasClass(t)){var e=this.classes();e.push(t),this.attr("class",e.join(" "))}return this},removeClass:function(e){return this.hasClass(e)&&this.attr("class",this.classes().filter(function(t){return t!==e}).join(" ")),this},toggleClass:function(t){return this.hasClass(t)?this.removeClass(t):this.addClass(t)},reference:function(t){return get(this.attr(t))},doc:function(){var t=this.parent(Tt);return t&&t.doc()},defs:function(){return this.doc().defs()},parents:function(t){var e=[],n=this;do{if(!(n=n.parent(t))||!n.node)break;e.push(n)}while(n.parent);return e},matches:function t(e){return t(this.node)},native:function(){return this.node},svg:function(){return this.writeDataToDom(),this.node.outerHTML},writeDataToDom:function(){return this.node.removeAttribute("svgjs:data"),Object.keys(this.dom).length&&this.node.setAttribute("svgjs:data",JSON.stringify(this.dom)),this},setData:function(t){return this.dom=t,this},getEventTarget:function(){return this.node}}),ot("Element",function(t){this.dom={},this.node=t,this.type=t.nodeName,this.node.instance=this,t.hasAttribute("svgjs:data")&&this.setData(JSON.parse(t.getAttribute("svgjs:data"))||{})});var jt=function(t){function e(t){return c(this,e),f(this,o(e).call(this,Y("clipPath",t),e))}return u(e,d),a(e,[{key:"remove",value:function(){return this.targets().forEach(function(t){t.unclip()}),Ct.call(this)}},{key:"targets",value:function(){return Mt('svg [clip-path*="'+this.id()+'"]')}}]),e}();ut({Container:{clip:function(){return this.defs().put(new jt)}},Element:{clipWith:function(t){var e=t instanceof jt?t:this.parent().clip().add(t);return this.attr("clip-path",'url("#'+e.id()+'")')},unclip:function(){return this.attr("clip-path",null)},clipper:function(){return this.reference("clip-path")}}}),W(jt);var St=function(t){function e(t){return c(this,e),f(this,o(e).call(this,Y("a",t),e))}return u(e,d),a(e,[{key:"to",value:function(t){return this.attr("href",t,X)}},{key:"target",value:function(t){return this.attr("target",t)}}]),e}();ut({Container:{link:function(t){return this.put(new St).to(t)}},Element:{linkTo:function(t){var e=new St;return"function"==typeof t?t.call(e,e):e.to(t),this.parent().put(e).put(this)}}}),W(St);var Et=function(t){function e(t){return c(this,e),f(this,o(e).call(this,nodeOrNew("ellipse",t),e))}return u(e,d),e}();H(Et,_t),ut("Container",{ellipse:function(t,e){return this.put(new Et).size(t,e).move(0,0)}}),W(Et);var Nt=function(t){function e(t){return c(this,e),f(this,o(e).call(this,Y("stop",t),e))}return u(e,d),a(e,[{key:"update",value:function(t){return("number"==typeof t||t instanceof yt)&&(t={offset:arguments[0],color:arguments[1],opacity:arguments[2]}),null!=t.opacity&&this.attr("stop-opacity",t.opacity),null!=t.color&&this.attr("stop-color",t.color),null!=t.offset&&this.attr("offset",new yt(t.offset)),this}}]),e}();W(Nt);var Pt=Object.freeze({from:function(t,e){return"radialGradient"===(this._element||this).type?this.attr({fx:new yt(t),fy:new yt(e)}):this.attr({x1:new yt(t),y1:new yt(e)})},to:function(t,e){return"radialGradient"===(this._element||this).type?this.attr({cx:new yt(t),cy:new yt(e)}):this.attr({x2:new yt(t),y2:new yt(e)})}});function Dt(){}var zt=400,qt=">",It=0,Lt={"fill-opacity":1,"stroke-opacity":1,"stroke-width":0,"stroke-linejoin":"miter","stroke-linecap":"butt",fill:"#000000",stroke:"#000000",opacity:1,x:0,y:0,cx:0,cy:0,width:0,height:0,r:0,rx:0,ry:0,offset:0,"stop-opacity":1,"stop-color":"#000000","font-size":16,"font-family":"Helvetica, Arial, sans-serif","text-anchor":"start"},Rt=function(){function t(){c(this,t),this.init.apply(this,arguments)}return a(t,[{key:"init",value:function(t,e,n){var i,r;(this.r=0,this.g=0,this.b=0,t)&&("string"==typeof t?g.test(t)?(i=y.exec(t.replace(p,"")),this.r=parseInt(i[1]),this.g=parseInt(i[2]),this.b=parseInt(i[3])):m.test(t)&&(i=v.exec(4===(r=t).length?["#",r.substring(1,2),r.substring(1,2),r.substring(2,3),r.substring(2,3),r.substring(3,4),r.substring(3,4)].join(""):r),this.r=parseInt(i[1],16),this.g=parseInt(i[2],16),this.b=parseInt(i[3],16)):Array.isArray(t)?(this.r=t[0],this.g=t[1],this.b=t[2]):"object"===l(t)?(this.r=t.r,this.g=t.g,this.b=t.b):3===arguments.length&&(this.r=t,this.g=e,this.b=n))}},{key:"toString",value:function(){return this.toHex()}},{key:"toArray",value:function(){return[this.r,this.g,this.b]}},{key:"toHex",value:function(){return"#"+N(Math.round(this.r))+N(Math.round(this.g))+N(Math.round(this.b))}},{key:"toRgb",value:function(){return"rgb("+[this.r,this.g,this.b].join()+")"}},{key:"brightness",value:function(){return this.r/255*.3+this.g/255*.59+this.b/255*.11}}],[{key:"test",value:function(t){return t+="",m.test(t)||g.test(t)}},{key:"isRgb",value:function(t){return t&&"number"==typeof t.r&&"number"==typeof t.g&&"number"==typeof t.b}},{key:"isColor",value:function(t){return this.isRgb(t)||this.test(t)}}]),t}(),Bt=function(){try{return Array}catch(t){return Array}}(),Xt=function(t){function n(){var t,e;return c(this,n),(t=e=f(this,o(n).call(this))).init.apply(t,arguments),e}return u(n,Bt),a(n,[{key:"init",value:function(t,e){this.length=0,this.push.apply(this,O(this.parse(t||e)))}},{key:"toArray",value:function(){return Array.prototype.slice(this)}},{key:"toString",value:function(){this.join(" ")}},{key:"valueOf",value:function(){return this.toArray()}},{key:"parse",value:function(t){return t=t.valueOf(),Array.isArray(t)?t:t.trim().split(b).map(parseFloat)}},{key:"clone",value:function(){return new this.constructor(this)}},{key:"toSet",value:function(){return new Set(this)}}]),n}();function Yt(t,e,n){if(null==t){t={},e=this.node.attributes;var i=!0,r=!1,s=void 0;try{for(var u,a=e[Symbol.iterator]();!(i=(u=a.next()).done);i=!0){var o=u.value;t[o.nodeName]=isNumer.test(o.nodeValue)?parseFloat(o.nodeValue):o.nodeValue}}catch(t){r=!0,s=t}finally{try{i||null==a.return||a.return()}finally{if(r)throw s}}return t}if(Array.isArray(t));else if("object"===l(t))for(e in t)this.attr(e,t[e]);else if(null===e)this.node.removeAttribute(t);else{if(null==e)return null==(e=this.node.getAttribute(t))?Lt[t]:k.test(e)?parseFloat(e):e;for("fill"!==t&&"stroke"!==t||x.test(e)&&(e=this.doc().defs().image(e));"function"==typeof e.attrHook;)e=e.attrHook(this,t);"number"==typeof e?e=new yt(e):Rt.isColor(e)?e=new Rt(e):Array.isArray(e)&&(e=new Xt(e)),"leading"===t?this.leading&&this.leading(e):"string"==typeof n?this.node.setAttributeNS(n,t,e.toString()):this.node.setAttribute(t,e.toString()),!this.rebuild||"font-size"!==t&&"x"!==t||this.rebuild()}return this}ut("Element",{attr:Yt});var Ft=function(t){function e(t){return c(this,e),f(this,o(e).call(this,Y(t+"Gradient","string"==typeof t?null:t),e))}return u(e,d),a(e,[{key:"stop",value:function(t,e,n){return this.put(new Nt).update(t,e,n)}},{key:"update",value:function(t){return this.clear(),"function"==typeof t&&t.call(this,this),this}},{key:"url",value:function(){return"url(#"+this.id()+")"}},{key:"toString",value:function(){return this.url()}},{key:"attr",value:function(t,e,n){return"transform"===t&&(t="gradientTransform"),Yt.call(this,t,e,n)}},{key:"targets",value:function(){return find('svg [fill*="'+this.id()+'"]')}}]),e}();H(Ft,Pt),ut({Container:{gradient:function(t,e){return this.defs().gradient(t,e)}},Defs:{gradient:function(t,e){return this.put(new Ft(t)).update(e)}}}),W(Ft);var Ht=function(t){function e(t){return c(this,e),f(this,o(e).call(this,Y("pattern",t)))}return u(e,d),a(e,[{key:"url",value:function(){return"url(#"+this.id()+")"}},{key:"update",value:function(t){return this.clear(),"function"==typeof t&&t.call(this,this),this}},{key:"toString",value:function(){return this.url()}},{key:"attr",value:function(t,e,n){return"transform"===t&&(t="patternTransform"),Yt.call(this,t,e,n)}},{key:"targets",value:function(){return find('svg [fill*="'+this.id()+'"]')}}]),e}();ut({Container:{pattern:function(t,e,n){return this.defs().pattern(t,e,n)}},Defs:{pattern:function(t,e,n){return this.put(new Ht).update(n).attr({x:0,y:0,width:t,height:e,patternUnits:"userSpaceOnUse"})}}}),W(Ht);var Gt=0;function Vt(t){return t instanceof Base&&t.is("EventTarget")?t.getEventTarget():t}function Ut(t,e,i,n,r){var s=i.bind(n||t),u=Vt(t);e=Array.isArray(e)?e:e.split(b),u.instance=u.instance||{events:{}};var a=u.instance.events;i._svgjsListenerId||(i._svgjsListenerId=++Gt),e.forEach(function(t){var e=t.split(".")[0],n=t.split(".")[1]||"*";a[e]=a[e]||{},a[e][n]=a[e][n]||{},a[e][n][i._svgjsListenerId]=s,u.addEventListener(e,s,r||!1)})}function Qt(t,e,s,u){var a=Vt(t);if(a.instance&&("function"!=typeof s||(s=s._svgjsListenerId))){var o=a.instance.events;(e=Array.isArray(e)?e:(e||"").split(b)).forEach(function(t){var e,n,i=t&&t.split(".")[0],r=t&&t.split(".")[1];if(s)o[i]&&o[i][r||"*"]&&(a.removeEventListener(i,o[i][r||"*"][s],u||!1),delete o[i][r||"*"][s]);else if(i&&r){if(o[i]&&o[i][r]){for(n in o[i][r])Qt(a,[i,r].join("."),n);delete o[i][r]}}else if(r)for(t in o)for(e in o[t])r===e&&Qt(a,[t,r].join("."));else if(i){if(o[i]){for(e in o[i])Qt(a,[i,e].join("."));delete o[i]}}else{for(t in o)Qt(a,t);a.instance.events={}}})}}var $t=function(t){function e(t){return c(this,e),f(this,o(e).call(this,Y("image",t),e))}return u(e,d),a(e,[{key:"load",value:function(n,i){if(!n)return this;var r=new window.Image;return Ut(r,"load",function(t){var e=this.parent(Ht);0===this.width()&&0===this.height()&&this.size(r.width,r.height),e instanceof Ht&&0===e.width()&&0===e.height()&&e.size(this.width(),this.height()),"function"==typeof i&&i.call(this,{width:r.width,height:r.height,ratio:r.width/r.height,url:n})},this),Ut(r,"load error",function(){Qt(r)}),this.attr("href",r.src=n,X)}},{key:"attrHook",value:function(t){var e=this;return t.doc().defs().pattern(0,0,function(t){t.add(e)})}}]),e}();ut({Container:{image:function(t,e){return this.put(new $t).size(0,0).load(t,e)}}}),W($t);var Wt=function(t){function r(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[[0,0]];return c(this,r),f(this,o(r).call(this,t,e))}return u(r,Xt),a(r,[{key:"toString",value:function(){for(var t=0,e=this.value.length,n=[];t<e;t++)n.push(this.value[t].join(","));return n.join(" ")}},{key:"toArray",value:function(){return this.value.reduce(function(t,e){return[].concat.call(t,e)},[])}},{key:"toLine",value:function(){return{x1:this.value[0][0],y1:this.value[0][1],x2:this.value[1][0],y2:this.value[1][1]}}},{key:"at",value:function(t){if(!this.destination)return this;for(var e=0,n=this.value.length,i=[];e<n;e++)i.push([this.value[e][0]+(this.destination[e][0]-this.value[e][0])*t,this.value[e][1]+(this.destination[e][1]-this.value[e][1])*t]);return new r(i)}},{key:"parse",value:function(t){var e=[];if(t=t.valueOf(),Array.isArray(t)){if(Array.isArray(t[0]))return t}else t=t.trim().split(b).map(parseFloat);t.length%2!=0&&t.pop();for(var n=0,i=t.length;n<i;n+=2)e.push([t[n],t[n+1]]);return e}},{key:"move",value:function(t,e){var n=this.bbox();if(t-=n.x,e-=n.y,!isNaN(t)&&!isNaN(e))for(var i=this.value.length-1;0<=i;i--)this.value[i]=[this.value[i][0]+t,this.value[i][1]+e];return this}},{key:"size",value:function(t,e){var n,i=this.bbox();for(n=this.value.length-1;0<=n;n--)i.width&&(this.value[n][0]=(this.value[n][0]-i.x)*t/i.width+i.x),i.height&&(this.value[n][1]=(this.value[n][1]-i.y)*e/i.height+i.y);return this}},{key:"bbox",value:function(){var e=-1/0,n=-1/0,i=1/0,r=1/0;return this.value.forEach(function(t){e=Math.max(t[0],e),n=Math.max(t[1],n),i=Math.min(t[0],i),r=Math.min(t[1],r)}),{x:i,y:r,width:e-i,height:n-r}}}]),r}(),Zt=function(t){function e(t){return c(this,e),f(this,o(e).call(this,Y("line",t),e))}return u(e,d),a(e,[{key:"array",value:function(){return new Wt([[this.attr("x1"),this.attr("y1")],[this.attr("x2"),this.attr("y2")]])}},{key:"plot",value:function(t,e,n,i){return null==t?this.array():(t=void 0!==e?{x1:t,y1:e,x2:n,y2:i}:new Wt(t).toLine(),this.attr(t))}},{key:"move",value:function(t,e){return this.attr(this.array().move(t,e).toLine())}},{key:"size",value:function(t,e){var n=P(this,t,e);return this.attr(this.array().size(n.width,n.height).toLine())}}]),e}();ut({Container:{line:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return Zt.prototype.plot.apply(this.put(new Zt),null!=e[0]?e:[0,0,0,0])}}}),W(Zt);var Jt=function(t){function e(t){return c(this,e),f(this,o(e).call(this,nodeOrNew("marker",t),e))}return u(e,d),a(e,[{key:"width",value:function(t){return this.attr("markerWidth",t)}},{key:"height",value:function(t){return this.attr("markerHeight",t)}},{key:"ref",value:function(t,e){return this.attr("refX",t).attr("refY",e)}},{key:"update",value:function(t){return this.clear(),"function"==typeof t&&t.call(this,this),this}},{key:"toString",value:function(){return"url(#"+this.id()+")"}}]),e}();ut({Container:{marker:function(t,e,n){return this.defs().marker(t,e,n)}},Defs:{marker:function(t,e,n){return this.put(new Jt).size(t,e).ref(t/2,e/2).viewbox(0,0,t,e).attr("orient","auto").update(n)}},marker:{marker:function(t,e,n,i){var r=["marker"];return"all"!==t&&r.push(t),r=r.join("-"),t=e instanceof Jt?e:this.defs().marker(e,n,i),this.attr(r,t)}}}),W(Jt);var Kt=function(t){function e(t){return c(this,e),f(this,o(e).call(this,Y("mask",t)))}return u(e,d),a(e,[{key:"remove",value:function(){return this.targets().forEach(function(t){t.unmask()}),Ct.call(this)}},{key:"targets",value:function(){return Mt('svg [mask*="'+this.id()+'"]')}}]),e}();function te(){if(!te.nodes){var t=(new lt).size(2,0).css({opacity:0,position:"absolute",left:"-100%",top:"-100%",overflow:"hidden"}),e=t.path().node;te.nodes={svg:t,path:e}}if(!te.nodes.svg.node.parentNode){var n=document.body||document.documentElement;te.nodes.svg.addTo(n)}return te.nodes}ut({Container:{mask:function(){return this.defs().put(new Kt)}},Element:{maskWith:function(t){var e=t instanceof Kt?t:this.parent().mask().add(t);return this.attr("mask",'url("#'+e.id()+'")')},unmask:function(){return this.attr("mask",null)},masker:function(){return this.reference("mask")}}}),W(Kt);var ee=function(){function r(t,e,n){var i;c(this,r),n=n||{x:0,y:0},i=Array.isArray(t)?{x:t[0],y:t[1]}:"object"===l(t)?{x:t.x,y:t.y}:{x:t,y:e},this.x=null==i.x?n.x:i.x,this.y=null==i.y?n.y:i.y}return a(r,[{key:"clone",value:function(){return new r(this)}},{key:"native",value:function(){var t=te().svg.createSVGPoint();return t.x=this.x,t.y=this.y,t}},{key:"transform",value:function(t){return new r(t.a*this.x+t.c*this.y+t.e,t.b*this.x+t.d*this.y+t.f)}}]),r}();ut({Element:{point:function(t,e){return new ee(t,e).transform(this.screenCTM().inverse())}}});for(var ne={M:function(t,e,n){return e.x=n.x=t[0],e.y=n.y=t[1],["M",e.x,e.y]},L:function(t,e){return e.x=t[0],e.y=t[1],["L",t[0],t[1]]},H:function(t,e){return e.x=t[0],["H",t[0]]},V:function(t,e){return e.y=t[0],["V",t[0]]},C:function(t,e){return e.x=t[4],e.y=t[5],["C",t[0],t[1],t[2],t[3],t[4],t[5]]},S:function(t,e){return e.x=t[2],e.y=t[3],["S",t[0],t[1],t[2],t[3]]},Q:function(t,e){return e.x=t[2],e.y=t[3],["Q",t[0],t[1],t[2],t[3]]},T:function(t,e){return e.x=t[0],e.y=t[1],["T",t[0],t[1]]},Z:function(t,e,n){return e.x=n.x,e.y=n.y,["Z"]},A:function(t,e){return e.x=t[5],e.y=t[6],["A",t[0],t[1],t[2],t[3],t[4],t[5],t[6]]}},ie="mlhvqtcsaz".split(""),re=0,se=ie.length;re<se;++re)ne[ie[re]]=function(s){return function(t,e,n){if("H"===s)t[0]=t[0]+e.x;else if("V"===s)t[0]=t[0]+e.y;else if("A"===s)t[5]=t[5]+e.x,t[6]=t[6]+e.y;else for(var i=0,r=t.length;i<r;++i)t[i]=t[i]+(i%2?e.y:e.x);return ne[s](t,e,n)}}(ie[re].toUpperCase());var ue=function(t){function h(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[["M",0,0]];return c(this,h),f(this,o(h).call(this,t,e))}return u(h,Xt),a(h,[{key:"toString",value:function(){return function(t){for(var e=0,n=t.length,i="";e<n;e++)i+=t[e][0],null!=t[e][1]&&(i+=t[e][1],null!=t[e][2]&&(i+=" ",i+=t[e][2],null!=t[e][3]&&(i+=" ",i+=t[e][3],i+=" ",i+=t[e][4],null!=t[e][5]&&(i+=" ",i+=t[e][5],i+=" ",i+=t[e][6],null!=t[e][7]&&(i+=" ",i+=t[e][7])))));return i+" "}(this)}},{key:"toArray",value:function(){return this.reduce(function(t,e){return[].concat.call(t,e)},[])}},{key:"move",value:function(t,e){var n=this.bbox();if(t-=n.x,e-=n.y,!isNaN(t)&&!isNaN(e))for(var i,r=this.length-1;0<=r;r--)"M"===(i=this[r][0])||"L"===i||"T"===i?(this[r][1]+=t,this[r][2]+=e):"H"===i?this[r][1]+=t:"V"===i?this[r][1]+=e:"C"===i||"S"===i||"Q"===i?(this[r][1]+=t,this[r][2]+=e,this[r][3]+=t,this[r][4]+=e,"C"===i&&(this[r][5]+=t,this[r][6]+=e)):"A"===i&&(this[r][6]+=t,this[r][7]+=e);return this}},{key:"size",value:function(t,e){var n,i,r=this.bbox();for(n=this.length-1;0<=n;n--)"M"===(i=this[n][0])||"L"===i||"T"===i?(this[n][1]=(this[n][1]-r.x)*t/r.width+r.x,this[n][2]=(this[n][2]-r.y)*e/r.height+r.y):"H"===i?this[n][1]=(this[n][1]-r.x)*t/r.width+r.x:"V"===i?this[n][1]=(this[n][1]-r.y)*e/r.height+r.y:"C"===i||"S"===i||"Q"===i?(this[n][1]=(this[n][1]-r.x)*t/r.width+r.x,this[n][2]=(this[n][2]-r.y)*e/r.height+r.y,this[n][3]=(this[n][3]-r.x)*t/r.width+r.x,this[n][4]=(this[n][4]-r.y)*e/r.height+r.y,"C"===i&&(this[n][5]=(this[n][5]-r.x)*t/r.width+r.x,this[n][6]=(this[n][6]-r.y)*e/r.height+r.y)):"A"===i&&(this[n][1]=this[n][1]*t/r.width,this[n][2]=this[n][2]*e/r.height,this[n][6]=(this[n][6]-r.x)*t/r.width+r.x,this[n][7]=(this[n][7]-r.y)*e/r.height+r.y);return this}},{key:"equalCommands",value:function(t){var e,n,i;for(t=new h(t),i=this.length===t.value.length,e=0,n=this.length;i&&e<n;e++)i=this[e][0]===t.value[e][0];return i}},{key:"morph",value:function(t){return t=new h(t),this.equalCommands(t)?this.destination=t:this.destination=null,this}},{key:"at",value:function(t){if(!this.destination)return this;var e,n,i,r,s=this,u=this.destination.value,a=[],o=new h;for(e=0,n=s.length;e<n;e++){for(a[e]=[s[e][0]],i=1,r=s[e].length;i<r;i++)a[e][i]=s[e][i]+(u[e][i]-s[e][i])*t;"A"===a[e][0]&&(a[e][4]=+(0!==a[e][4]),a[e][5]=+(0!==a[e][5]))}return o.value=a,o}},{key:"parse",value:function(t){if(t instanceof h)return t.valueOf();var e,n={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7,Z:0};t="string"==typeof t?t.replace(C,S).replace(M," $& ").replace(A,"$1 -").trim().split(b):t.reduce(function(t,e){return[].concat.call(t,e)},[]);for(var i=[],r=new ee,s=new ee,u=0,a=t.length;T.test(t[u])?(e=t[u],++u):"M"===e?e="L":"m"===e&&(e="l"),i.push(ne[e].call(null,t.slice(u,u+=n[e.toUpperCase()]).map(parseFloat),r,s)),u<a;);return i}},{key:"bbox",value:function(){return te().path.setAttribute("d",this.toString()),te.nodes.path.getBBox()}}]),h}(),ae=function(t){function e(t){return c(this,e),f(this,o(e).call(this,Y("path",t),e))}return u(e,d),a(e,[{key:"array",value:function(){return this._array||(this._array=new ue(this.attr("d")))}},{key:"plot",value:function(t){return null==t?this.array():this.clear().attr("d","string"==typeof t?t:this._array=new ue(t))}},{key:"clear",value:function(){return delete this._array,this}},{key:"move",value:function(t,e){return this.attr("d",this.array().move(t,e))}},{key:"x",value:function(t){return null==t?this.bbox().x:this.move(t,this.bbox().y)}},{key:"y",value:function(t){return null==t?this.bbox().y:this.move(this.bbox().x,t)}},{key:"size",value:function(t,e){var n=P(this,t,e);return this.attr("d",this.array().size(n.width,n.height))}},{key:"width",value:function(t){return null==t?this.bbox().width:this.size(t,this.bbox().height)}},{key:"height",value:function(t){return null==t?this.bbox().height:this.size(this.bbox().width,t)}},{key:"targets",value:function(){return Mt('svg textpath [href*="'+this.id()+'"]')}}]),e}();ae.prototype.MorphArray=ue,ut({Container:{path:function(t){return this.put(new ae).plot(t||new ue)}}}),W(ae);var oe=Wt;var he=Object.freeze({MorphArray:oe,x:function(t){return null==t?this.bbox().x:this.move(t,this.bbox().y)},y:function(t){return null==t?this.bbox().y:this.move(this.bbox().x,t)},width:function(t){var e=this.bbox();return null==t?e.width:this.size(t,e.height)},height:function(t){var e=this.bbox();return null==t?e.height:this.size(e.width,t)}});var le=Object.freeze({array:function(){return this._array||(this._array=new PointArray(this.attr("points")))},plot:function(t){return null==t?this.array():this.clear().attr("points","string"==typeof t?t:this._array=new PointArray(t))},clear:function(){return delete this._array,this},move:function(t,e){return this.attr("points",this.array().move(t,e))},size:function(t,e){var n=proportionalSize(this,t,e);return this.attr("points",this.array().size(n.width,n.height))}}),ce=function(t){function e(t){return c(this,e),f(this,o(e).call(this,Y("polygon",t),e))}return u(e,d),e}();ut({Parent:{polygon:function(t){return this.put(new ce).plot(t||new Wt)}}}),H(ce,he),H(ce,le),W(ce);var fe=function(t){function e(t){return c(this,e),f(this,o(e).call(this,Y("polyline",t),e))}return u(e,d),e}();ut({Parent:{polyline:function(t){return this.put(new fe).plot(t||new Wt)}}}),H(fe,he),H(fe,le),W(fe);var de=function(t){function e(t){return c(this,e),f(this,o(e).call(this,Y("rect",t),e))}return u(e,d),e}();ut({Container:{rect:function(t,e){return this.put(new de).size(t,e)}}}),W(de);var ve=function(t){function e(t){return c(this,e),f(this,o(e).call(this,Y("symbol",t),e))}return u(e,d),e}();ut({Container:{symbol:function(){return this.put(new ve)}}}),W(ve);var ye=Object.freeze({plain:function(t){return!1===this._build&&this.clear(),this.node.appendChild(document.createTextNode(t)),this},length:function(){return this.node.getComputedTextLength()}}),pe=function(t){function n(t){var e;return c(this,n),(e=f(this,o(n).call(this,Y("text",t),n))).dom.leading=new yt(1.3),e._rebuild=!0,e._build=!1,e.attr("font-family",Lt["font-family"]),e}return u(n,d),a(n,[{key:"x",value:function(t){return null==t?this.attr("x"):this.attr("x",t)}},{key:"y",value:function(t){var e=this.attr("y"),n="number"==typeof e?e-this.bbox().y:0;return null==t?"number"==typeof e?e-n:e:this.attr("y","number"==typeof t?t+n:t)}},{key:"cx",value:function(t){return null==t?this.bbox().cx:this.x(t-this.bbox().width/2)}},{key:"cy",value:function(t){return null==t?this.bbox().cy:this.y(t-this.bbox().height/2)}},{key:"text",value:function(t){if(void 0===t){var e=this.node.childNodes,n=0;t="";for(var i=0,r=e.length;i<r;++i)"textPath"!==e[i].nodeName?(i!==n&&3!==e[i].nodeType&&!0===adopt(e[i]).dom.newLined&&(t+="\n"),t+=e[i].textContent):0===i&&(n=1);return t}if(this.clear().build(!0),"function"==typeof t)t.call(this,this);else for(var s=0,u=(t=t.split("\n")).length;s<u;s++)this.tspan(t[s]).newLine();return this.build(!1).rebuild()}},{key:"leading",value:function(t){return null==t?this.dom.leading:(this.dom.leading=new yt(t),this.rebuild())}},{key:"rebuild",value:function(t){if("boolean"==typeof t&&(this._rebuild=t),this._rebuild){var e=this,n=0,i=this.dom.leading*new yt(this.attr("font-size"));this.each(function(){this.dom.newLined&&(this.attr("x",e.attr("x")),"\n"===this.text()?n+=i:(this.attr("dy",i+n),n=0))}),this.fire("rebuild")}return this}},{key:"build",value:function(t){return this._build=!!t,this}},{key:"setData",value:function(t){return this.dom=t,this.dom.leading=new yt(t.leading||1.3),this}}]),n}();H(pe,ye),ut({Container:{text:function(t){return this.put(new pe).text(t)},plain:function(t){return this.put(new pe).plain(t)}}}),W(pe);var me=function(t){function e(t){return c(this,e),f(this,o(e).call(this,Y("textPath",t)))}return u(e,pe),a(e,[{key:"array",value:function(){var t=this.track();return t?t.array():null}},{key:"plot",value:function(t){var e=this.track(),n=null;return e&&(n=e.plot(t)),null==t?n:this}},{key:"track",value:function(){return this.reference("href")}}]),e}();ut({Container:{textPath:function(t,e){return this.defs().path(e).text(t).addTo(this)}},Text:{path:function(t){var e=new me;return t instanceof ae||(t=this.doc().defs().path(t)),e.attr("href","#"+t,X),this.put(e)},textPath:function(){return this.select("textPath")}},Path:{text:function(t){if(t instanceof pe){var e=t.text();return t.clear().path(this).text(e)}return this.parent().put(new pe).path(this).text(t)}}}),me.prototype.MorphArray=ue,W(me);var ge=function(t){function e(t){return c(this,e),f(this,o(e).call(this,Y("tspan",t),e))}return u(e,d),a(e,[{key:"text",value:function(t){return null==t?this.node.textContent+(this.dom.newLined?"\n":""):("function"==typeof t?t.call(this,this):this.plain(t),this)}},{key:"dx",value:function(t){return this.attr("dx",t)}},{key:"dy",value:function(t){return this.attr("dy",t)}},{key:"newLine",value:function(){var t=this.parent(Text);return this.dom.newLined=!0,this.dy(t.dom.leading*t.attr("font-size")).attr("x",t.x())}}]),e}();H(ge,ye),ut({Tspan:{tspan:function(t){var e=new ge;return this._build||this.clear(),this.node.appendChild(e.node),e.text(t)}}}),W(ge);var we=function(t){function e(t){return c(this,e),f(this,o(e).call(this,nodeOrNew("use",t),e))}return u(e,d),a(e,[{key:"element",value:function(t,e){return this.attr("href",(e||"")+"#"+t,X)}}]),e}();ut({Container:{use:function(t,e){return this.put(new we).element(t,e)}}}),W(we);var ke=function(){function h(){c(this,h),this.init.apply(this,arguments)}return a(h,[{key:"init",value:function(t){var e=D([1,0,0,1,0,0]);t=t instanceof d&&t.is("Element")?t.matrixify():"string"==typeof t?D(t.split(b).map(parseFloat)):Array.isArray(t)?D(t):"object"===l(t)&&I(t)?t:"object"===l(t)?(new h).transform(t):6===arguments.length?D([].slice.call(arguments)):e,this.a=null!=t.a?t.a:e.a,this.b=null!=t.b?t.b:e.b,this.c=null!=t.c?t.c:e.c,this.d=null!=t.d?t.d:e.d,this.e=null!=t.e?t.e:e.e,this.f=null!=t.f?t.f:e.f}},{key:"clone",value:function(){return new h(this)}},{key:"transform",value:function(t){if(I(t))return new h(t).multiplyO(this);var e=h.formatTransforms(t),n=new ee(e.ox,e.oy).transform(this),i=n.x,r=n.y,s=(new h).translateO(e.rx,e.ry).lmultiplyO(this).translateO(-i,-r).scaleO(e.scaleX,e.scaleY).skewO(e.skewX,e.skewY).shearO(e.shear).rotateO(e.theta).translateO(i,r);if(isFinite(e.px)||isFinite(e.py)){var u=new ee(i,r).transform(s),a=e.px?e.px-u.x:0,o=e.py?e.py-u.y:0;s.translateO(a,o)}return s.translateO(e.tx,e.ty),s}},{key:"compose",value:function(t){t.origin&&(t.originX=t.origin[0],t.originY=t.origin[1]);var e=t.originX||0,n=t.originY||0,i=t.scaleX||1,r=t.scaleY||1,s=t.shear||0,u=t.rotate||0,a=t.translateX||0,o=t.translateY||0;return(new h).translateO(-e,-n).scaleO(i,r).shearO(s).rotateO(u).translateO(a,o).lmultiplyO(this).translateO(e,n)}},{key:"decompose",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,n=this.a,i=this.b,r=this.c,s=this.d,u=this.e,a=this.f,o=n*s-i*r,h=0<o?1:-1,l=h*Math.sqrt(n*n+i*i),c=Math.atan2(h*i,h*n),f=180/Math.PI*c,d=Math.cos(c),v=Math.sin(c),y=(n*r+i*s)/o,p=r*l/(y*n-i)||s*l/(y*i+n);return{scaleX:l,scaleY:p,shear:y,rotate:f,translateX:u-t+t*d*l+e*(y*d*l-v*p),translateY:a-e+t*v*l+e*(y*v*l+d*p),originX:t,originY:e,a:this.a,b:this.b,c:this.c,d:this.d,e:this.e,f:this.f}}},{key:"multiply",value:function(t){return this.clone().multiplyO(t)}},{key:"multiplyO",value:function(t){var e=t instanceof h?t:new h(t);return h.matrixMultiply(this,e,this)}},{key:"lmultiply",value:function(t){return this.clone().lmultiplyO(t)}},{key:"lmultiplyO",value:function(t){var e=t instanceof h?t:new h(t);return h.matrixMultiply(e,this,this)}},{key:"inverseO",value:function(){var t=this.a,e=this.b,n=this.c,i=this.d,r=this.e,s=this.f,u=t*i-e*n;if(!u)throw new Error("Cannot invert "+this);var a=i/u,o=-e/u,h=-n/u,l=t/u,c=-(a*r+h*s),f=-(o*r+l*s);return this.a=a,this.b=o,this.c=h,this.d=l,this.e=c,this.f=f,this}},{key:"inverse",value:function(){return this.clone().inverseO()}},{key:"translate",value:function(t,e){return this.clone().translateO(t,e)}},{key:"translateO",value:function(t,e){return this.e+=t||0,this.f+=e||0,this}},{key:"scale",value:function(t,e,n,i){var r;return(r=this.clone()).scaleO.apply(r,arguments)}},{key:"scaleO",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:t,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:0;3===arguments.length&&(i=n,n=e,e=t);var r=this.a,s=this.b,u=this.c,a=this.d,o=this.e,h=this.f;return this.a=r*t,this.b=s*e,this.c=u*t,this.d=a*e,this.e=o*t-n*t+n,this.f=h*e-i*e+i,this}},{key:"rotate",value:function(t,e,n){return this.clone().rotateO(t,e,n)}},{key:"rotateO",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0;t=At(t);var i=Math.cos(t),r=Math.sin(t),s=this.a,u=this.b,a=this.c,o=this.d,h=this.e,l=this.f;return this.a=s*i-u*r,this.b=u*i+s*r,this.c=a*i-o*r,this.d=o*i+a*r,this.e=h*i-l*r+n*r-e*i+e,this.f=l*i+h*r-e*r-n*i+n,this}},{key:"flip",value:function(t,e){return this.clone().flipO(t,e)}},{key:"flipO",value:function(t,e){return"x"===t?this.scaleO(-1,1,e,0):"y"===t?this.scaleO(1,-1,0,e):this.scaleO(-1,-1,t,e||t)}},{key:"shear",value:function(t,e,n){return this.clone().shearO(t,e,n)}},{key:"shearO",value:function(t){var e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,n=this.a,i=this.b,r=this.c,s=this.d,u=this.e,a=this.f;return this.a=n+i*t,this.c=r+s*t,this.e=u+a*t-e*t,this}},{key:"skew",value:function(t,e,n,i){var r;return(r=this.clone()).skewO.apply(r,arguments)}},{key:"skewO",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:t,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:0;3===arguments.length&&(i=n,n=e,e=t),t=At(t),e=At(e);var r=Math.tan(t),s=Math.tan(e),u=this.a,a=this.b,o=this.c,h=this.d,l=this.e,c=this.f;return this.a=u+a*r,this.b=a+u*s,this.c=o+h*r,this.d=h+o*s,this.e=l+c*r-i*r,this.f=c+l*s-n*s,this}},{key:"skewX",value:function(t,e,n){return this.skew(t,0,e,n)}},{key:"skewXO",value:function(t,e,n){return this.skewO(t,0,e,n)}},{key:"skewY",value:function(t,e,n){return this.skew(0,t,e,n)}},{key:"skewYO",value:function(t,e,n){return this.skewO(0,t,e,n)}},{key:"aroundO",value:function(t,e,n){var i=t||0,r=e||0;return this.translateO(-i,-r).lmultiplyO(n).translateO(i,r)}},{key:"around",value:function(t,e,n){return this.clone().aroundO(t,e,n)}},{key:"native",value:function(){for(var t=te().node.createSVGMatrix(),e=z.length-1;0<=e;e--)t[z[e]]=this[z[e]];return t}},{key:"equals",value:function(t){var e=new h(t);return q(this.a,e.a)&&q(this.b,e.b)&&q(this.c,e.c)&&q(this.d,e.d)&&q(this.e,e.e)&&q(this.f,e.f)}},{key:"toString",value:function(){return"matrix("+this.a+","+this.b+","+this.c+","+this.d+","+this.e+","+this.f+")"}},{key:"toArray",value:function(){return[this.a,this.b,this.c,this.d,this.e,this.f]}},{key:"valueOf",value:function(){return{a:this.a,b:this.b,c:this.c,d:this.d,e:this.e,f:this.f}}}],[{key:"formatTransforms",value:function(t){var e="both"===t.flip||!0===t.flip,n=t.flip&&(e||"x"===t.flip)?-1:1,i=t.flip&&(e||"y"===t.flip)?-1:1,r=t.skew&&t.skew.length?t.skew[0]:isFinite(t.skew)?t.skew:isFinite(t.skewX)?t.skewX:0,s=t.skew&&t.skew.length?t.skew[1]:isFinite(t.skew)?t.skew:isFinite(t.skewY)?t.skewY:0,u=t.scale&&t.scale.length?t.scale[0]*n:isFinite(t.scale)?t.scale*n:isFinite(t.scaleX)?t.scaleX*n:n,a=t.scale&&t.scale.length?t.scale[1]*i:isFinite(t.scale)?t.scale*i:isFinite(t.scaleY)?t.scaleY*i:i,o=t.shear||0,h=t.rotate||t.theta||0,l=new ee(t.origin||t.around||t.ox||t.originX,t.oy||t.originY),c=l.x,f=l.y,d=new ee(t.position||t.px||t.positionX,t.py||t.positionY),v=d.x,y=d.y,p=new ee(t.translate||t.tx||t.translateX,t.ty||t.translateY),m=p.x,g=p.y,w=new ee(t.relative||t.rx||t.relativeX,t.ry||t.relativeY);return{scaleX:u,scaleY:a,skewX:r,skewY:s,shear:o,theta:h,rx:w.x,ry:w.y,tx:m,ty:g,ox:c,oy:f,px:v,py:y}}},{key:"matrixMultiply",value:function(t,e,n){var i=t.a*e.a+t.c*e.b,r=t.b*e.a+t.d*e.b,s=t.a*e.c+t.c*e.d,u=t.b*e.c+t.d*e.d,a=t.e+t.a*e.e+t.c*e.f,o=t.f+t.b*e.e+t.d*e.f;return n.a=i,n.b=r,n.c=s,n.d=u,n.e=a,n.f=o,n}}]),h}();ut({Element:{ctm:function(){return new ke(this.node.getCTM())},screenCTM:function(){if(this instanceof Doc&&!this.isRoot()){var t=this.rect(1,1),e=t.node.getScreenCTM();return t.remove(),new ke(e)}return new ke(this.node.getScreenCTM())}}});var xe=function(){function u(){c(this,u),this.init.apply(this,arguments)}return a(u,[{key:"init",value:function(t){var e;t="string"==typeof t?t.split(b).map(parseFloat):Array.isArray(t)?t:"object"===l(t)?[null!=t.left?t.left:t.x,null!=t.top?t.top:t.y,t.width,t.height]:4===arguments.length?[].slice.call(arguments):[0,0,0,0],this.x=t[0],this.y=t[1],this.width=t[2],this.height=t[3],null==(e=this).x&&(e.x=0,e.y=0,e.width=0,e.height=0),e.w=e.width,e.h=e.height,e.x2=e.x+e.width,e.y2=e.y+e.height,e.cx=e.x+e.width/2,e.cy=e.y+e.height/2}},{key:"merge",value:function(t){var e=Math.min(this.x,t.x),n=Math.min(this.y,t.y);return new u(e,n,Math.max(this.x+this.width,t.x+t.width)-e,Math.max(this.y+this.height,t.y+t.height)-n)}},{key:"transform",value:function(e){var n=1/0,i=-1/0,r=1/0,s=-1/0;return[new ee(this.x,this.y),new ee(this.x2,this.y),new ee(this.x,this.y2),new ee(this.x2,this.y2)].forEach(function(t){t=t.transform(e),n=Math.min(n,t.x),i=Math.max(i,t.x),r=Math.min(r,t.y),s=Math.max(s,t.y)}),new u(n,r,i-n,s-r)}},{key:"addOffset",value:function(){return this.x+=window.pageXOffset,this.y+=window.pageYOffset,this}},{key:"toString",value:function(){return this.x+" "+this.y+" "+this.width+" "+this.height}},{key:"toArray",value:function(){return[this.x,this.y,this.width,this.height]}}]),u}();function be(e){var n,t,i;try{if(n=e(this.node),!((i=n).w||i.h||i.x||i.y||(t=this.node,(document.documentElement.contains||function(t){for(;t.parentNode;)t=t.parentNode;return t===document}).call(document.documentElement,t))))throw new Error("Element not in the dom")}catch(t){try{var r=this.clone(te().svg).show();n=e(r.node),r.remove()}catch(t){throw t}}return n}function _e(e,n){return function(t){return null==t?this[t]:(this[e]=t,n&&n.call(this),this)}}ut({Element:{bbox:function(){return new xe(be.call(this,function(t){return t.getBBox()}))},rbox:function(t){var e=new xe(be.call(this,function(t){return t.getBoundingClientRect()}));return t?e.transform(t.screenCTM().inverse()):e.addOffset()}},viewbox:function(t,e,n,i){return null==t?new xe(this.attr("viewBox")):this.attr("viewBox",new xe(t,e,n,i))}});var Oe={"-":function(t){return t},"<>":function(t){return-Math.cos(t*Math.PI)/2+.5},">":function(t){return Math.sin(t*Math.PI/2)},"<":function(t){return 1-Math.cos(t*Math.PI/2)},bezier:function(t,e,n,i){return function(t){}}},Ae=function(){function t(){c(this,t)}return a(t,[{key:"done",value:function(){return!1}}]),t}(),Me=function(t){function n(t){var e;return c(this,n),(e=f(this,o(n).call(this))).ease=Oe[t||qt]||t,e}return u(n,Ae),a(n,[{key:"step",value:function(t,e,n){return"number"!=typeof t?n<1?t:e:t+(e-t)*this.ease(n)}}]),n}(),Te=function(t){function n(t){var e;return c(this,n),(e=f(this,o(n).call(this))).stepper=t,e}return u(n,Ae),a(n,[{key:"step",value:function(t,e,n,i){return this.stepper(t,e,n,i)}},{key:"done",value:function(t){return t.done}}]),n}();function Ce(){var t=(this._duration||500)/1e3,e=this._overshoot||0,n=Math.PI,i=Math.log(e/100+1e-10),r=-i/Math.sqrt(n*n+i*i),s=3.9/(r*t);this.d=2*r*s,this.k=s*s}var je=function(t){function i(t,e){var n;return c(this,i),(n=f(this,o(i).call(this))).duration(t||500).overshoot(e||0),n}return u(i,Te),a(i,[{key:"step",value:function(t,e,n,i){if("string"==typeof t)return t;if(i.done=n===1/0,n===1/0)return e;if(0===n)return t;100<n&&(n=16),n/=1e3;var r=i.velocity||0,s=-this.d*r-this.k*(t-e),u=t+r*n+s*n*n/2;return i.velocity=r+s*n,i.done=Math.abs(e-u)+Math.abs(r)<.002,i.done?e:u}}]),i}();H(je,{duration:_e("_duration",Ce),overshoot:_e("_overshoot",Ce)});var Se=function(t){function s(t,e,n,i){var r;return c(this,s),t=null==t?.1:t,e=null==e?.01:e,n=null==n?0:n,i=null==i?1e3:i,(r=f(this,o(s).call(this))).p(t).i(e).d(n).windup(i),r}return u(s,Te),a(s,[{key:"step",value:function(t,e,n,i){if("string"==typeof t)return t;if(i.done=n===1/0,n===1/0)return e;if(0===n)return t;var r=e-t,s=(i.integral||0)+r*n,u=(r-(i.error||0))/n,a=this.windup;return!1!==a&&(s=Math.max(-a,Math.min(s,a))),i.error=r,i.integral=s,i.done=Math.abs(r)<.001,i.done?e:t+(this.P*r+this.I*s+this.D*u)}}]),s}();H(Se,{windup:_e("windup"),p:_e("P"),i:_e("I"),d:_e("D")});var Ee=function(){function i(t){c(this,i),this._stepper=t||new Me("-"),this._from=null,this._to=null,this._type=null,this._context=null,this._morphObj=null}return a(i,[{key:"from",value:function(t){return null==t?this._from:(this._from=this._set(t),this)}},{key:"to",value:function(t){return null==t?this._to:(this._to=this._set(t),this)}},{key:"type",value:function(t){return null==t?this._type:(this._type=t,this)}},{key:"_set",value:function(t){if(!this._type){var e=l(t);"number"===e?this.type(yt):"string"===e?Rt.isColor(t)?this.type(Rt):regex.delimiter.test(t)?this.type(regex.pathLetters.test(t)?ue:Xt):regex.numberAndUnit.test(t)?this.type(yt):this.type(i.NonMorphable):-1<MorphableTypes.indexOf(t.constructor)?this.type(t.constructor):Array.isArray(t)?this.type(Xt):"object"===e?this.type(i.ObjectBag):this.type(i.NonMorphable)}var n=new this._type(t).toArray();return this._morphObj=this._morphObj||new this._type,this._context=this._context||Array.apply(null,Array(n.length)).map(Object),n}},{key:"stepper",value:function(t){return null==t?this._stepper:(this._stepper=t,this)}},{key:"done",value:function(){return this._context.map(this._stepper.done).reduce(function(t,e){return t&&e},!0)}},{key:"at",value:function(n){var i=this;return this._morphObj.fromArray(this._from.map(function(t,e){return i._stepper.step(t,i._to[e],n,i._context[e],i._context)}))}}]),i}();Ee.NonMorphable=function(){function t(){c(this,t),this.init.apply(this,arguments)}return a(t,[{key:"init",value:function(t){t=Array.isArray(t)?t[0]:t,this.value=t}},{key:"valueOf",value:function(){return this.value}},{key:"toArray",value:function(){return[this.value]}}]),t}(),Ee.TransformBag=function(){function t(){c(this,t),this.init.apply(this,arguments)}return a(t,[{key:"init",value:function(t){Array.isArray(t)&&(t={scaleX:t[0],scaleY:t[1],shear:t[2],rotate:t[3],translateX:t[4],translateY:t[5],originX:t[6],originY:t[7]}),Object.assign(this,Ee.TransformBag.defaults,t)}},{key:"toArray",value:function(){var t=this;return[t.scaleX,t.scaleY,t.shear,t.rotate,t.translateX,t.translateY,t.originX,t.originY]}}]),t}(),Ee.TransformBag.defaults={scaleX:1,scaleY:1,shear:0,rotate:0,translateX:0,translateY:0,originX:0,originY:0},Ee.ObjectBag=function(){function t(){c(this,t),this.init.apply(this,arguments)}return a(t,[{key:"init",value:function(t){if(this.values=[],Array.isArray(t))this.values=t;else{var e=Object.entries(t||{}).sort(function(t,e){return t[0]-e[0]});this.values=e.reduce(function(t,e){return t.concat(e)},[])}}},{key:"valueOf",value:function(){for(var t={},e=this.values,n=0,i=e.length;n<i;n+=2)t[e[n]]=e[n+1];return t}},{key:"toArray",value:function(){return this.values}}]),t}(),H([yt,Rt,xe,ke,Xt,Wt,ue,Ee.NonMorphable,Ee.TransformBag,Ee.ObjectBag],{to:function(t,e){return(new Ee).type(this.constructor).from(this.valueOf()).to(t,e)},fromArray:function(t){return this.init(t),this}});var Ne=window.performance||Date,Pe=function(t){var e=t.start,n=t.runner.duration();return{start:e,duration:n,end:e+n,runner:t.runner}},De=function(){function t(){c(this,t),this._timeSource=function(){return Ne.now()},this._dispatcher=document.createElement("div"),this._startTime=0,this._speed=1,this._reverse=!1,this._persist=0,this._nextFrame=null,this._paused=!1,this._runners=[],this._order=[],this._time=0,this._lastSourceTime=0,this._lastStepTime=0}return a(t,[{key:"getEventTarget",value:function(){return this._dispatcher}},{key:"schedule",value:function(t,e,n){if(null==t)return this._runners.map(Pe).sort(function(t,e){return t.start-e.start||t.duration-e.duration});this.active()||(this._step(),null==n&&(n="now"));var i=0;if(e=e||0,null==n||"last"===n||"after"===n)i=this._startTime;else if("absolute"===n||"start"===n)i=e,e=0;else if("now"===n)i=this._time;else{if("relative"!==n)throw new Error('Invalid value for the "when" parameter');var r=this._runners[t.id];r&&(i=r.start+e,e=0)}return t.unschedule(),t.timeline(this),t.time(-e),this._startTime=i+t.duration()+e,this._runners[t.id]={persist:this.persist(),runner:t,start:i},this._order.push(t.id),this._continue(),this}},{key:"unschedule",value:function(t){var e=this._order.indexOf(t.id);return e<0||(delete this._runners[t.id],this._order.splice(e,1),t.timeline(null)),this}},{key:"play",value:function(){return this._paused=!1,this._continue()}},{key:"pause",value:function(){return this._nextFrame=null,this._paused=!0,this}},{key:"stop",value:function(){return this.seek(-this._time),this.pause()}},{key:"finish",value:function(){return this.seek(1/0),this.pause()}},{key:"speed",value:function(t){return null==t?this._speed:(this._speed=t,this)}},{key:"reverse",value:function(t){var e=this.speed();if(null==t)return this.speed(-e);var n=Math.abs(e);return this.speed(t?n:-n)}},{key:"seek",value:function(t){return this._time+=t,this._continue()}},{key:"time",value:function(t){return null==t?this._time:(this._time=t,this)}},{key:"persist",value:function(t){return null==t?this._persist:(this._persist=t,this)}},{key:"source",value:function(t){return null==t?this._timeSource:(this._timeSource=t,this)}},{key:"_step",value:function(){if(!this._paused){var t=this._timeSource(),e=t-this._lastSourceTime,n=this._speed*e+(this._time-this._lastStepTime);this._lastSourceTime=t,this._time+=n,this._lastStepTime=this._time;for(var i=!1,r=0,s=this._order.length;r<s;r++){var u=this._runners[this._order[r]],a=u.runner,o=n,h=this._time-u.start;if(h<0)i=!0;else if(h<o&&(o=h),a.active())if(a.step(o).done){if(!0!==u.persist){a.duration()-a.time()+this._time+this._persist<this._time&&(delete this._runners[this._order[r]],this._order.splice(r--,1)&&--s,a.timeline(null))}}else i=!0}return this._nextFrame=i?dt.frame(this._step.bind(this)):null,this}}},{key:"_continue",value:function(){return this._paused||this._nextFrame||(this._nextFrame=dt.frame(this._step.bind(this))),this}},{key:"active",value:function(){return!!this._nextFrame}}]),t}();ut({Element:{timeline:function(){return this._timeline=this._timeline||new De,this._timeline}}});var ze=function(){function s(t){c(this,s),this.id=s.id++,t="function"==typeof(t=null==t?zt:t)?new Te(t):t,this._element=null,this._timeline=null,this.done=!1,this._queue=[],this._duration="number"==typeof t&&t,this._isDeclarative=t instanceof Te,this._stepper=this._isDeclarative?t:new Me,this._history={},this.enabled=!0,this._time=0,this._last=0,this.transforms=new ke,this.transformId=1,this._haveReversed=!1,this._reverse=!1,this._loopsDone=0,this._swing=!1,this._wait=0,this._times=1}return a(s,[{key:"element",value:function(t){return null==t?this._element:((this._element=t)._prepareRunner(),this)}},{key:"timeline",value:function(t){return void 0===t?this._timeline:(this._timeline=t,this)}},{key:"animate",value:function(t,e,n){var i=s.sanitise(t,e,n),r=new s(i.duration);return this._timeline&&r.timeline(this._timeline),this._element&&r.element(this._element),r.loop(i).schedule(e,n)}},{key:"schedule",value:function(t,e,n){if(t instanceof De||(n=e,e=t,t=this.timeline()),!t)throw Error("Runner cannot be scheduled without timeline");return t.schedule(this,e,n),this}},{key:"unschedule",value:function(){var t=this.timeline();return t&&t.unschedule(this),this}},{key:"loop",value:function(t,e,n){return"object"===l(t)&&(e=t.swing,n=t.wait,t=t.times),this._times=t||1/0,this._swing=e||!1,this._wait=n||0,this}},{key:"delay",value:function(t){return this.animate(0,t)}},{key:"queue",value:function(t,e,n){return this._queue.push({initialiser:t||Dt,runner:e||Dt,isTransform:n,initialised:!1,finished:!1}),this.timeline()&&this.timeline()._continue(),this}},{key:"during",value:function(t){return this.queue(null,t)}},{key:"after",value:function(t){return this.on("finish",t)}},{key:"time",value:function(t){if(null==t)return this._time;var e=t-this._time;return this.step(e),this}},{key:"duration",value:function(){return this._times*(this._wait+this._duration)-this._wait}},{key:"loops",value:function(t){var e=this._duration+this._wait;if(null==t){var n=Math.floor(this._time/e),i=(this._time-n*e)/this._duration;return Math.min(n+i,this._times)}var r=t%1,s=e*Math.floor(t)+this._duration*r;return this.time(s)}},{key:"position",value:function(t){var e,n=this._time,r=this._duration,s=this._wait,i=this._times,u=this._swing,a=this._reverse;if(null==t){var o=function(t){var e=u*Math.floor(t%(2*(s+r))/(s+r)),n=e&&!a||!e&&a,i=Math.pow(-1,n)*(t%(s+r))/r+n;return Math.max(Math.min(i,1),0)},h=i*(s+r)-s;return e=n<=0?Math.round(o(1e-5)):n<h?o(n):Math.round(o(h-1e-5)),e}var l=Math.floor(this.loops()),c=u&&l%2==0;return e=l+(c&&!a||a&&c?t:1-t),this.loops(e)}},{key:"progress",value:function(t){return null==t?Math.min(1,this._time/this.duration()):this.time(t*this.duration())}},{key:"step",value:function(t){if(!this.enabled)return this;t=null==t?16:t,this._time+=t;var e=this.position(),n=this._lastPosition!==e&&0<=this._time;this._lastPosition=e;var i=this.duration(),r=(this._lastTime<0&&this._time,this._lastTime<this._time&&this.time>i);this._lastTime=this._time;var s=this._isDeclarative;if(this.done=!s&&!r&&this._time>=i,n||s){this._initialise(n),this.transforms=new ke;var u=this._run(s?t:e)}return this.done=this.done||u&&s,this}},{key:"finish",value:function(){return this.step(1/0)}},{key:"reverse",value:function(t){return this._reverse=null==t?!this._reverse:t,this}},{key:"ease",value:function(t){return this._stepper=new Me(t),this}},{key:"active",value:function(t){return null==t?this.enabled:(this.enabled=t,this)}},{key:"_rememberMorpher",value:function(t,e){this._history[t]={morpher:e,caller:this._queue[this._queue.length-1]}}},{key:"_tryRetarget",value:function(t,e){if(this._history[t]){if(!this._history[t].caller.initialised){var n=this._queue.indexOf(this._history[t].caller);return this._queue.splice(n,1),!1}this._history[t].caller.isTransform?this._history[t].caller.isTransform(e):this._history[t].morpher.to(e),this._history[t].caller.finished=!1;var i=this.timeline();return i&&i._continue(),!0}return!1}},{key:"_initialise",value:function(t){if(t||this._isDeclarative)for(var e=0,n=this._queue.length;e<n;++e){var i=this._queue[e],r=this._isDeclarative||!i.initialised&&t;t=!i.finished,r&&t&&(i.initialiser.call(this),i.initialised=!0)}}},{key:"_run",value:function(t){for(var e=!0,n=0,i=this._queue.length;n<i;++n){var r=this._queue[n],s=r.runner.call(this,t);r.finished=r.finished||!0===s,e=e&&r.finished}return e}},{key:"addTransform",value:function(t,e){return this.transforms.lmultiplyO(t),this}},{key:"clearTransform",value:function(){return this.transforms=new ke,this}}],[{key:"sanitise",value:function(t,e,n){var i=1,r=!1,s=0;return e=e||It,n=n||"last","object"!==l(t=t||zt)||t instanceof Ae||(e=t.delay||e,n=t.when||n,r=t.swing||r,i=t.times||i,s=t.wait||s,t=t.duration||zt),{duration:t,delay:e,swing:r,times:i,wait:s,when:n}}}]),s}();ze.id=0;var qe=function t(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new ke,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:-1,i=!(2<arguments.length&&void 0!==arguments[2])||arguments[2];c(this,t),this.transforms=e,this.id=n,this.done=i};H([ze,qe],{mergeWith:function(t){return new qe(t.transforms.lmultiply(this.transforms),t.id)}});var Ie=function(t,e){return t.lmultiplyO(e)},Le=function(t){return t.transforms};var Re=function(){function t(){c(this,t),this.runners=[],this.ids=[]}return a(t,[{key:"add",value:function(t){if(!this.runners.includes(t)){var n=t.id+1,e=this.ids.reduce(function(t,e){return t<e&&e<n?e:t},0),i=this.ids.indexOf(e)+1;return this.ids.splice(i,0,n),this.runners.splice(i,0,t),this}}},{key:"getByID",value:function(t){return this.runners[this.ids.indexOf(t+1)]}},{key:"remove",value:function(t){var e=this.ids.indexOf(t+1);return this.ids.splice(e,1),this.runners.splice(e,1),this}},{key:"merge",value:function(){var n=this,i=null;return this.runners.forEach(function(t,e){i&&t.done&&i.done&&(n.remove(t.id),n.edit(i.id,t.mergeWith(i))),i=t}),this}},{key:"edit",value:function(t,e){var n=this.ids.indexOf(t+1);return this.ids.splice(n,1,t),this.runners.splice(n,1,e),this}},{key:"length",value:function(){return this.ids.length}},{key:"clearBefore",value:function(t){var e=this.ids.indexOf(t+1)||1;return this.ids.splice(0,e,0),this.runners.splice(0,e,new qe),this}}]),t}(),Be=0;ut({Element:{animate:function(t,e,n){var i=ze.sanitise(t,e,n),r=this.timeline();return new ze(i.duration).loop(i).element(this).timeline(r).schedule(e,n)},delay:function(t,e){return this.animate(0,t,e)},_clearTransformRunnersBefore:function(t){this._transformationRunners.clearBefore(t.id)},_currentTransform:function(e){return this._transformationRunners.runners.filter(function(t){return t.id<=e.id}).map(Le).reduce(Ie,new ke)},addRunner:function(t){this._transformationRunners.add(t),dt.transform_frame(function(){var t=this._transformationRunners.runners.map(Le).reduce(Ie,new ke);this.transform(t),this._transformationRunners.merge(),1===this._transformationRunners.length()&&(this._frameId=null)}.bind(this),this._frameId)},_prepareRunner:function(){null==this._frameId&&(this._transformationRunners=(new Re).add(new qe(new ke(this))),this._frameId=Be++)}}}),H(ze,{attr:function(t,e){return this.styleAttr("attr",t,e)},css:function(t,e){return this.styleAttr("css",t,e)},styleAttr:function(e,n,t){if("object"===l(n))for(var i in t)this.styleAttr(e,i,t[i]);var r=new Ee(this._stepper).to(t);return this.queue(function(){r=r.from(this.element()[e](n))},function(t){return this.element()[e](n,r.at(t)),r.done()}),this},zoom:function(t,e){var n=new Ee(this._stepper).to(new yt(t));return this.queue(function(){n=n.from(this.zoom())},function(t){return this.element().zoom(n.at(t),e),n.done()}),this},transform:function(d,v,y){if(v=d.relative||v,this._isDeclarative&&!v&&this._tryRetarget("transform",d))return this;var p=I(d);y=null!=d.affine?d.affine:null!=y?y:!p;var m,g,w,k,x,b=(new Ee).type(y?Ee.TransformBag:ke).stepper(this._stepper);return this.queue(function(){g=g||this.element(),m=m||L(d,g),x=new ke(v?void 0:g),g.addRunner(this),v||g._clearTransformRunnersBefore(this)},function(t){v||this.clearTransform();var e=new ee(m).transform(g._currentTransform(this)),n=e.x,i=e.y,r=new ke(_({},d,{origin:[n,i]})),s=this._isDeclarative&&w?w:x;if(y){r=r.decompose(n,i),s=s.decompose(n,i);var u=r.rotate,a=s.rotate,o=[u-360,u,u+360],h=o.map(function(t){return Math.abs(t-a)}),l=Math.min.apply(Math,O(h)),c=h.indexOf(l);r.rotate=o[c]}v&&(p||(r.rotate=d.rotate||0),this._isDeclarative&&k&&(s.rotate=k)),b.from(s),b.to(r);var f=b.at(t);return k=f.rotate,w=new ke(f),this.addTransform(w),b.done()},function(t){(t.origin||"center").toString()!==(d.origin||"center").toString()&&(m=L(d,g)),d=_({},t,{origin:m})}),this._isDeclarative&&this._rememberMorpher("transform",b),this},x:function(t,e){return this._queueNumber("x",t)},y:function(t){return this._queueNumber("y",t)},dx:function(t){return this._queueNumberDelta("dx",t)},dy:function(t){return this._queueNumberDelta("dy",t)},_queueNumberDelta:function(e,n){if(n=new yt(n),this._tryRetargetDelta(e,n))return this;var i=new Ee(this._stepper).to(n);return this.queue(function(){var t=this.element()[e]();i.from(t),i.to(t+n)},function(t){return this.element()[e](i.at(t)),i.done()}),this._rememberMorpher(e,i),this},_queueObject:function(e,t){if(this._tryRetarget(e,t))return this;var n=new Ee(this._stepper).to(t);return this.queue(function(){n.from(this.element()[e]())},function(t){return this.element()[e](n.at(t)),n.done()}),this._rememberMorpher(e,n),this},_queueNumber:function(t,e){return this._queueObject(t,new yt(e))},cx:function(t){return this._queueNumber("cx",t)},cy:function(t){return this._queueNumber("cy",t)},move:function(t,e){return this.x(t).y(e)},center:function(t,e){return this.cx(t).cy(e)},size:function(t,e){var n;return t&&e||(n=this._element.bbox()),t||(t=n.width/n.height*e),e||(e=n.height/n.width*t),this.width(t).height(e)},width:function(t){return this._queueNumber("width",t)},height:function(t){return this._queueNumber("height",t)},plot:function(t,e,n,i){return 4===arguments.length?this.plot([t,e,n,i]):this._queueObject("plot",new this._element.MorphArray(t))},leading:function(t){return this._queueNumber("leading",t)},viewbox:function(t,e,n,i){return this._queueObject("viewbox",new Box(t,e,n,i))},update:function(t){return"object"!==l(t)?this.update({offset:t,color:arguments[1],opacity:arguments[2]}):(null!=t.opacity&&this.attr("stop-opacity",t.opacity),null!=t.color&&this.attr("stop-color",t.color),null!=t.offset&&this.attr("offset",t.offset),this)}});var Xe=Object.freeze({HtmlNode:nt,Doc:lt,Defs:it,G:ct,Animator:dt,Bare:vt,Circle:Ot,ClipPath:jt,A:St,Ellipse:Et,Stop:Nt,Gradient:Ft,Image:$t,Line:Zt,Marker:Jt,Mask:Kt,Path:ae,Pattern:Ht,Polygon:ce,Polyline:fe,Rect:de,Symbol:ve,Text:pe,TextPath:me,Tspan:ge,Use:we,SVGNumber:yt,SVGArray:Xt,PathArray:ue,PointArray:Wt,Matrix:ke,Point:ee,Box:xe,Color:Rt,Morphable:Ee,Queue:ft,Runner:ze,Timeline:De,Controller:Te,Ease:Me,PID:Se,Spring:je}),Ye=Object.freeze({Bare:vt,ClipPath:jt,Defs:it,Doc:lt,Gradient:Ft,G:ct,A:St,Marker:Jt,Mask:Kt,Pattern:Ht,Symbol:ve}),Fe=Object.freeze({Bare:vt,Circle:Ot,ClipPath:jt,Defs:it,Doc:lt,Ellipse:Et,Gradient:Ft,G:ct,HtmlNode:nt,A:St,Image:$t,Line:Zt,Marker:Jt,Mask:Kt,Path:ae,Pattern:Ht,Polygon:ce,Polyline:fe,Rect:de,Stop:Nt,Symbol:ve,Text:pe,TextPath:me,Use:we});function He(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};this.events=t.events||{}}ut("Element",{css:function(t,e){var n={};if(0===arguments.length)return this.node.style.cssText.split(/\s*;\s*/).filter(function(t){return!!t.length}).forEach(function(t){var e=t.split(/\s*:\s*/);n[e[0]]=e[1]}),n;if(arguments.length<2){if(Array.isArray(t)){var i=!0,r=!1,s=void 0;try{for(var u,a=t[Symbol.iterator]();!(i=(u=a.next()).done);i=!0){var o=E(u.value);n[o]=this.node.style(o)}}catch(t){r=!0,s=t}finally{try{i||null==a.return||a.return()}finally{if(r)throw s}}return n}if("string"==typeof t)return this.node.style[E(t)];if("object"===l(t))for(name in t)this.node.style[E(name)]=null==t[name]||w.test(t[name])?"":t[name]}return 2===arguments.length&&(this.node.style[E(t)]=null==e||w.test(e)?"":e),this},show:function(){return this.css("display","")},hide:function(){return this.css("display","none")},visible:function(){return"none"!==this.css("display")}}),ut("Element",{untransform:function(){return this.attr("transform",null)},matrixify:function(){return(this.attr("transform")||"").split(t).slice(0,-1).map(function(t){var e=t.trim().split("(");return[e[0],e[1].split(b).map(function(t){return parseFloat(t)})]}).reverse().reduce(function(t,e){return"matrix"===e[0]?t.lmultiply(D(e[1])):t[e[0]].apply(t,e[1])},new ke)},toParent:function(t){if(this===t)return this;var e=this.screenCTM(),n=t.screenCTM().inverse();return this.addTo(t).untransform().transform(n.multiply(e)),this},toDoc:function(){return this.toParent(this.doc())},transform:function(t,e){if(null==t||"string"==typeof t){var n=new ke(this).decompose();return n[t]||n}I(t)||(t=_({},t,{origin:L(t,this)}));var i=new ke(!0===e?this:e||!1).transform(t);return this.attr("transform",i)}}),ut("Element",{remember:function(t,e){if("object"===l(t))for(var n in t)this.remember(n,t[n]);else{if(1===arguments.length)return this.memory()[t];this.memory()[t]=e}return this},forget:function(){if(0===arguments.length)this._memory={};else for(var t=arguments.length-1;0<=t;t--)delete this.memory()[arguments[t]];return this},memory:function(){return this._memory}}),ot("Memory",function(t){this._memory={}}),ut("EventTarget",{setup:He,on:function(t,e,n,i){return Ut(this,t,e,n,i),this},off:function(t,e){return Qt(this,t,e),this},dispatch:function(t,e){return n=t,i=e,r=Vt(this),n instanceof window.Event||(n=new window.CustomEvent(n,{detail:i,cancelable:!0})),r.dispatchEvent(n),n;var n,i,r},fire:function(t,e){return this.dispatch(t,e),this}}),ot("EventTarget",He),ut("Container",{children:function(){return function(t,e){var n,i=t.length,r=[];for(n=0;n<i;n++)r.push(e(t[n]));return r}(this.node.children,function(t){return $(t)})},add:function(t,e){return(t=Q(t)).node!==this.node.children[e]&&this.node.insertBefore(t.node,this.node.children[e]||null),this},put:function(t,e){return this.add(t,e),t.instance||t},has:function(t){return 0<=this.index(t)},index:function(t){return[].slice.call(this.node.children).indexOf(t.node)},get:function(t){return $(this.node.children[t])},first:function(){return this.get(0)},last:function(){return this.get(this.node.children.length-1)},each:function(t,e){var n,i,r=this.children();for(n=0,i=r.length;n<i;n++)r[n]instanceof Base&&t.apply(r[n],[n,r]),e&&r[n]instanceof Base&&r[n].is("Parent")&&r[n].each(t,e);return this},removeElement:function(t){return this.node.removeChild(t.node),this},clear:function(){for(;this.node.hasChildNodes();)this.node.removeChild(this.node.lastChild);return delete this._defs,this},svg:function(t){var e,n;if(!t)return this.writeDataToDom(),this.node.outerHTML;for((e=document.createElementNS(ns,"svg")).innerHTML=t,n=e.children.length;n--;)this.node.appendChild(e.firstElementChild);return this},writeDataToDom:function(){return this.each(function(){this.writeDataToDom()}),this.node.removeAttribute("svgjs:data"),Object.keys(this.dom).length&&this.node.setAttribute("svgjs:data",JSON.stringify(this.dom)),this},flatten:function(t){return this.each(function(){return this.is("Parent")?this.flatten(t).ungroup(t):this.toParent(t)}),this.node.firstElementChild||this.remove(),this},ungroup:function(t){return t=t||this.parent(),this.each(function(){return this.toParent(t)}),this.remove(),this}});var Ge=H;Ge([lt,ve,$t,Ht,Jt],at("viewbox")),Ge([Zt,fe,ce,ae],at("marker")),Ge(pe,at("Text")),Ge(ae,at("Path")),Ge(it,at("Defs")),Ge([pe,ge],at("Tspan"));var Ve=at("Container");for(var Ue in Ye)Ge(Ye[Ue],Ve);var Qe=at("Element");for(var $e in Fe)Ge(Fe[$e],Qe),Ge(Fe[$e],ht("EventTarget")),Ge(Fe[$e],ht("Element")),Ge(Fe[$e],ht("Memory"));function We(t){return Q(t)}return Object.assign(We,Xe),Object.assign(We,G),Object.assign(We,et),We}();
+var SVG=function(){"use strict";function l(t){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function c(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function a(t,e,n){return e&&i(t.prototype,e),n&&i(t,n),t}function _(r){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{},e=Object.keys(s);"function"==typeof Object.getOwnPropertySymbols&&(e=e.concat(Object.getOwnPropertySymbols(s).filter(function(t){return Object.getOwnPropertyDescriptor(s,t).enumerable}))),e.forEach(function(t){var e,n,i;e=r,i=s[n=t],n in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i})}return r}function u(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&n(t,e)}function o(t){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function n(t,e){return(n=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function r(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function f(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?r(t):e}function d(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=[],i=!0,r=!1,s=void 0;try{for(var u,a=t[Symbol.iterator]();!(i=(u=a.next()).done)&&(n.push(u.value),!e||n.length!==e);i=!0);}catch(t){r=!0,s=t}finally{try{i||null==a.return||a.return()}finally{if(r)throw s}}return n}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function O(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var s=function(){function l(t,e){var n=e.extensions,i=void 0===n?[]:n;c(this,l);var r=!0,s=!(this.tags=[]),u=void 0;try{for(var a,o=i[Symbol.iterator]();!(r=(a=o.next()).done);r=!0){var h=a.value;h.setup.call(this,t),this.tags.push(h.name)}}catch(t){s=!0,u=t}finally{try{r||null==o.return||o.return()}finally{if(s)throw u}}}return a(l,[{key:"is",value:function(t){return this.tags.includes(t)}}]),l}(),h=/^([+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?)([a-z%]*)$/i,v=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,y=/rgb\((\d+),(\d+),(\d+)\)/,t=/\)\s*,?\s*/,p=/\s/g,m=/^#[a-f0-9]{3,6}$/i,g=/^rgb\(/,w=/^(\s+)?$/,x=/^[+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,k=/\.(jpg|jpeg|png|gif|svg)(\?[^=]+.*)?/i,b=/[\s,]+/,A=/([^e])-/gi,M=/[MLHVCSQTAZ]/gi,T=/[MLHVCSQTAZ]/i,C=/((\d?\.\d+(?:e[+-]?\d+)?)((?:\.\d+(?:e[+-]?\d+)?)+))+/gi,j=/\./g;function S(t,e,n,i){return n+i.replace(j," .")}function E(t){return t.toLowerCase().replace(/-(.)/g,function(t,e){return e.toUpperCase()})}function e(t){return t.charAt(0).toUpperCase()+t.slice(1)}function N(t){var e=t.toString(16);return 1===e.length?"0"+e:e}function P(t,e,n){if(null==e||null==n){var i=t.bbox();null==e?e=i.width/i.height*n:null==n&&(n=i.height/i.width*e)}return{width:e,height:n}}function D(t){return{a:t[0],b:t[1],c:t[2],d:t[3],e:t[4],f:t[5]}}var z="abcdef".split("");function q(t,e,n){return Math.abs(e-t)<(n||1e-6)}function R(t){return null!=t.a||null!=t.b||null!=t.c||null!=t.d||null!=t.e||null!=t.f}function L(t,e){var n,i,r=t.origin;if("string"==typeof r||null==r){var s=(r||"center").toLowerCase().trim(),u=e.bbox(),a=u.height,o=u.width,h=u.x,l=u.y,c=s.includes("left")?h:s.includes("right")?h+o:h+o/2,f=s.includes("top")?l:s.includes("bottom")?l+a:l+a/2;n=null!=t.ox?t.ox:c,i=null!=t.oy?t.oy:f}else n=r[0],i=r[1];return[n,i]}var F="http://www.w3.org/2000/svg",I="http://www.w3.org/2000/xmlns/",B="http://www.w3.org/1999/xlink";function X(t,e){return e||Y(t)}function Y(t){return document.createElementNS(F,t)}function G(e,t){var n,i;if(Array.isArray(t))t.forEach(function(t){G(e,t)});else for(i=(e=Array.isArray(e)?e:[e]).length-1;0<=i;i--)for(n in t.name&&(e[i].extensions=(e[i].extensions||[]).concat(t)),t)e[i].prototype[n]||"name"==n||"setup"==n||(e[i].prototype[n]=t[n])}var H=Object.freeze({nodeOrNew:X,makeNode:Y,extend:G,addFactory:function(t,e){G(t,e)},invent:function(e){var t="function"==typeof e.create?e.create:function(t){e.inherit.call(this,t||Y(e.create))};return e.inherit&&(t.prototype=new e.inherit,t.prototype.constructor=t),e.extend&&G(t,e.extend),e.construct&&G(e.parent||Container,e.construct),t}}),V={},U=Symbol("root");function Q(t){if(t instanceof s)return t;if("object"===l(t))return $(t);if(null==t)return new V[U];if("string"==typeof t&&"<"!==t.charAt(0))return $(document.querySelector(t));var e=Y("svg");return e.innerHTML=t,t=$(e.firstElementChild)}function $(t){return t?t.instance instanceof s?t.instance:t instanceof window.SVGElement?"svg"===t.nodeName?new V[U](t):"linearGradient"===t.nodeName||"radialGradient"===t.nodeName?new V.Gradient(t):V[e(t.nodeName)]?new(V[e(t.nodeName)])(t):new V.Bare(t):new V.HtmlNode(t):null}function W(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:t.name,n=2<arguments.length&&void 0!==arguments[2]&&arguments[2];return V[e]=t,n&&(V[U]=t),t}function Z(t){return V[t]}var J=1e3;function K(t){return"Svgjs"+e(t)+J++}function tt(t){for(var e=t.children.length-1;0<=e;e--)tt(t.children[e]);return t.id?$(t).id(K(t.nodeName)):$(t)}var et=Object.freeze({root:U,makeInstance:Q,adopt:$,register:W,getClass:Z,eid:K,assignNewId:tt}),nt=function(t){function n(t){var e;return c(this,n),(e=f(this,o(n).call(this,t,n))).node=t,e}return u(n,s),a(n,[{key:"add",value:function(t,e){return(t=Q(t)).node!==this.node.children[e]&&this.node.insertBefore(t.node,this.node.children[e]||null),this}},{key:"put",value:function(t,e){return this.add(t,e),t}},{key:"getEventTarget",value:function(){return this.node}}]),n}();W(nt);var it=function(t){function e(t){return c(this,e),f(this,o(e).call(this,X("defs",t),e))}return u(e,s),a(e,[{key:"flatten",value:function(){return this}},{key:"ungroup",value:function(){return this}}]),e}();W(it);var rt={},st={};function ut(t,e){if(Array.isArray(t)){var n=!0,i=!1,r=void 0;try{for(var s,u=t[Symbol.iterator]();!(n=(s=u.next()).done);n=!0){ut(s.value,e)}}catch(t){i=!0,r=t}finally{try{n||null==u.return||u.return()}finally{if(i)throw r}}}else if("object"!=l(t))rt[t]=Object.assign(rt[t]||{},e);else for(var a=Object.entries(t),o=0;o<a.length;o++){var h=d(a[o],2);ut(h[0],h[1])}}function at(t){return rt[t]||{}}function ot(t,e){st[t]=e}function ht(t){return st[t]?{setup:st[t],name:t}:{}}var lt=function(t){function n(t){var e;return c(this,n),(e=f(this,o(n).call(this,X("svg",t),n))).namespace(),e}return u(n,s),a(n,[{key:"isRoot",value:function(){return!(this.node.parentNode&&this.node.parentNode instanceof window.SVGElement&&"#document"!==this.node.parentNode.nodeName)}},{key:"doc",value:function(){return this.isRoot()?this:Element.doc.call(this)}},{key:"namespace",value:function(){return this.isRoot()?this.attr({xmlns:F,version:"1.1"}).attr("xmlns:xlink",B,I).attr("xmlns:svgjs","http://svgjs.com/svgjs",I):this.doc().namespace()}},{key:"defs",value:function(){return this.isRoot()?$(this.node.getElementsByTagName("defs")[0])||this.put(new it):this.doc().defs()}},{key:"parent",value:function(t){return this.isRoot()?"#document"===this.node.parentNode.nodeName?null:this.node.parentNode:Element.parent.call(this,t)}},{key:"remove",value:function(){return this.isRoot()?(this.parent()&&this.parent().removeChild(this.node),this):Element.remove.call(this)}},{key:"clear",value:function(){for(;this.node.hasChildNodes();)this.node.removeChild(this.node.lastChild);return this}}]),n}();ut({Container:{nested:function(){return this.put(new lt)}}}),W(lt,"Doc",!0);var ct=function(t){function e(t){return c(this,e),f(this,o(e).call(this,nodeorNew("g",t),e))}return u(e,s),e}();ut({Element:{group:function(){return this.put(new ct)}}}),W(ct);var ft=function(){function t(){c(this,t),this._first=null,this._last=null}return a(t,[{key:"push",value:function(t){var e=t.next?t:{value:t,next:null,prev:null};return this._last?(e.prev=this._last,this._last.next=e,this._last=e):(this._last=e,this._first=e),e}},{key:"shift",value:function(){var t=this._first;return t?(this._first=t.next,this._first&&(this._first.prev=null),this._last=this._first?this._last:null,t.value):null}},{key:"first",value:function(){return this._first&&this._first.value}},{key:"last",value:function(){return this._last&&this._last.value}},{key:"remove",value:function(t){t.prev&&(t.prev.next=t.next),t.next&&(t.next.prev=t.prev),t===this._last&&(this._last=t.prev),t===this._first&&(this._first=t.next),t.prev=null,t.next=null}}]),t}(),dt={nextDraw:null,frames:new ft,timeouts:new ft,timer:window.performance||window.Date,transforms:[],frame:function(t){var e=dt.frames.push({run:t});return null===dt.nextDraw&&(dt.nextDraw=window.requestAnimationFrame(dt._draw)),e},transform_frame:function(t,e){dt.transforms[e]=t},timeout:function(t,e){e=e||0;var n=dt.timer.now()+e,i=dt.timeouts.push({run:t,time:n});return null===dt.nextDraw&&(dt.nextDraw=window.requestAnimationFrame(dt._draw)),i},cancelFrame:function(t){dt.frames.remove(t)},clearTimeout:function(t){dt.timeouts.remove(t)},_draw:function(t){for(var e=null,n=dt.timeouts.last();(e=dt.timeouts.shift())&&(t>=e.time?e.run():dt.timeouts.push(e),e!==n););for(var i=null,r=dt.frames.last();i!==r&&(i=dt.frames.shift());)i.run();dt.transforms.forEach(function(t){t()}),dt.nextDraw=dt.timeouts.first()||dt.frames.first()?window.requestAnimationFrame(dt._draw):null}},vt=function(t){function i(t,e){var n;return c(this,i),n=f(this,o(i).call(this,X(null,t),i)),extend(r(r(n)),e),n}return u(i,s),a(i,[{key:"words",value:function(t){for(;this.node.hasChildNodes();)this.node.removeChild(this.node.lastChild);return this.node.appendChild(document.createTextNode(t)),this}}]),i}();W(vt),ut("Bare",{element:function(t,e){var n=createCustom(t,e);return this.put(new n)}});var yt=function(){function n(){c(this,n),this.init.apply(this,arguments)}return a(n,[{key:"init",value:function(t,e){e=Array.isArray(t)?t[1]:e,t=Array.isArray(t)?t[0]:t,this.value=0,this.unit=e||"","number"==typeof t?this.value=isNaN(t)?0:isFinite(t)?t:t<0?-34e37:34e37:"string"==typeof t?(e=t.match(h))&&(this.value=parseFloat(e[1]),"%"===e[5]?this.value/=100:"s"===e[5]&&(this.value*=1e3),this.unit=e[5]):t instanceof n&&(this.value=t.valueOf(),this.unit=t.unit)}},{key:"toString",value:function(){return("%"===this.unit?~~(1e8*this.value)/1e6:"s"===this.unit?this.value/1e3:this.value)+this.unit}},{key:"toJSON",value:function(){return this.toString()}},{key:"toArray",value:function(){return[this.value,this.unit]}},{key:"valueOf",value:function(){return this.value}},{key:"plus",value:function(t){return new n(this+(t=new n(t)),this.unit||t.unit)}},{key:"minus",value:function(t){return new n(this-(t=new n(t)),this.unit||t.unit)}},{key:"times",value:function(t){return new n(this*(t=new n(t)),this.unit||t.unit)}},{key:"divide",value:function(t){return new n(this/(t=new n(t)),this.unit||t.unit)}}]),n}();function pt(t){return null==t?this.cx()-this.rx():this.cx(t+this.rx())}function mt(t){return null==t?this.cy()-this.ry():this.cy(t+this.ry())}function gt(t){return null==t?this.attr("cx"):this.attr("cx",t)}function wt(t){return null==t?this.attr("cy"):this.attr("cy",t)}function xt(t){return null==t?2*this.rx():this.rx(new yt(t).divide(2))}function kt(t){return null==t?2*this.ry():this.ry(new yt(t).divide(2))}function bt(t,e){var n=P(this,t,e);return this.rx(new yt(n.width).divide(2)).ry(new yt(n.height).divide(2))}var _t=Object.freeze({rx:function(t){return this.attr("rx",t)},ry:function(t){return this.attr("ry",t)},x:pt,y:mt,cx:gt,cy:wt,width:xt,height:kt,size:bt}),Ot=function(t){function e(t){return c(this,e),f(this,o(e).call(this,X("circle",t),e))}return u(e,s),a(e,[{key:"radius",value:function(t){return this.attr("r",t)}},{key:"rx",value:function(t){return this.attr("r",t)}},{key:"ry",value:function(t){return this.rx(t)}}]),e}();function At(t){return t%360*Math.PI/180}function Mt(t,e){return utils.map((e||document).querySelectorAll(t),function(t){return $(t)})}G(Ot,{x:pt,y:mt,cx:gt,cy:wt,width:xt,height:kt,size:bt}),ut({Element:{circle:function(t){return this.put(new Ot).radius(new yt(t).divide(2)).move(0,0)}}}),W(Ot),ut("Container",{find:function(t){return Mt(t,this.node)}});var Tt=Z(U);function Ct(){return this.parent()&&this.parent().removeElement(this),this}ut("Element",{x:function(t){return this.attr("x",t)},y:function(t){return this.attr("y",t)},cx:function(t){return null==t?this.x()+this.width()/2:this.x(t-this.width()/2)},cy:function(t){return null==t?this.y()+this.height()/2:this.y(t-this.height()/2)},move:function(t,e){return this.x(t).y(e)},center:function(t,e){return this.cx(t).cy(e)},width:function(t){return this.attr("width",t)},height:function(t){return this.attr("height",t)},size:function(t,e){var n=P(this,t,e);return this.width(new yt(n.width)).height(new yt(n.height))},clone:function(t){this.writeDataToDom();var e=tt(this.node.cloneNode(!0));return t?t.add(e):this.after(e),e},remove:Ct,replace:function(t){return this.after(t).remove(),t},addTo:function(t){return Q(t).put(this)},putIn:function(t){return Q(t).add(this)},id:function(t){return void 0!==t||this.node.id||(this.node.id=K(this.type)),this.attr("id",t)},inside:function(t,e){var n=this.bbox();return t>n.x&&e>n.y&&t<n.x+n.width&&e<n.y+n.height},toString:function(){return this.id()},classes:function(){var t=this.attr("class");return null==t?[]:t.trim().split(b)},hasClass:function(t){return-1!==this.classes().indexOf(t)},addClass:function(t){if(!this.hasClass(t)){var e=this.classes();e.push(t),this.attr("class",e.join(" "))}return this},removeClass:function(e){return this.hasClass(e)&&this.attr("class",this.classes().filter(function(t){return t!==e}).join(" ")),this},toggleClass:function(t){return this.hasClass(t)?this.removeClass(t):this.addClass(t)},reference:function(t){return get(this.attr(t))},doc:function(){var t=this.parent(Tt);return t&&t.doc()},defs:function(){return this.doc().defs()},parents:function(t){var e=[],n=this;do{if(!(n=n.parent(t))||!n.node)break;e.push(n)}while(n.parent);return e},matches:function t(e){return t(this.node)},native:function(){return this.node},svg:function(){return this.writeDataToDom(),this.node.outerHTML},writeDataToDom:function(){return this.node.removeAttribute("svgjs:data"),Object.keys(this.dom).length&&this.node.setAttribute("svgjs:data",JSON.stringify(this.dom)),this},setData:function(t){return this.dom=t,this},getEventTarget:function(){return this.node}}),ot("Element",function(t){this.dom={},this.node=t,this.type=t.nodeName,this.node.instance=this,t.hasAttribute("svgjs:data")&&this.setData(JSON.parse(t.getAttribute("svgjs:data"))||{})});var jt=function(t){function e(t){return c(this,e),f(this,o(e).call(this,X("clipPath",t),e))}return u(e,s),a(e,[{key:"remove",value:function(){return this.targets().forEach(function(t){t.unclip()}),Ct.call(this)}},{key:"targets",value:function(){return Mt('svg [clip-path*="'+this.id()+'"]')}}]),e}();ut({Container:{clip:function(){return this.defs().put(new jt)}},Element:{clipWith:function(t){var e=t instanceof jt?t:this.parent().clip().add(t);return this.attr("clip-path",'url("#'+e.id()+'")')},unclip:function(){return this.attr("clip-path",null)},clipper:function(){return this.reference("clip-path")}}}),W(jt);var St=function(t){function e(t){return c(this,e),f(this,o(e).call(this,X("a",t),e))}return u(e,s),a(e,[{key:"to",value:function(t){return this.attr("href",t,B)}},{key:"target",value:function(t){return this.attr("target",t)}}]),e}();ut({Container:{link:function(t){return this.put(new St).to(t)}},Element:{linkTo:function(t){var e=new St;return"function"==typeof t?t.call(e,e):e.to(t),this.parent().put(e).put(this)}}}),W(St);var Et=function(t){function e(t){return c(this,e),f(this,o(e).call(this,nodeOrNew("ellipse",t),e))}return u(e,s),e}();G(Et,_t),ut("Container",{ellipse:function(t,e){return this.put(new Et).size(t,e).move(0,0)}}),W(Et);var Nt=function(t){function e(t){return c(this,e),f(this,o(e).call(this,X("stop",t),e))}return u(e,s),a(e,[{key:"update",value:function(t){return("number"==typeof t||t instanceof yt)&&(t={offset:arguments[0],color:arguments[1],opacity:arguments[2]}),null!=t.opacity&&this.attr("stop-opacity",t.opacity),null!=t.color&&this.attr("stop-color",t.color),null!=t.offset&&this.attr("offset",new yt(t.offset)),this}}]),e}();W(Nt);var Pt=Object.freeze({from:function(t,e){return"radialGradient"===(this._element||this).type?this.attr({fx:new yt(t),fy:new yt(e)}):this.attr({x1:new yt(t),y1:new yt(e)})},to:function(t,e){return"radialGradient"===(this._element||this).type?this.attr({cx:new yt(t),cy:new yt(e)}):this.attr({x2:new yt(t),y2:new yt(e)})}});function Dt(){}var zt=400,qt=">",Rt=0,Lt={"fill-opacity":1,"stroke-opacity":1,"stroke-width":0,"stroke-linejoin":"miter","stroke-linecap":"butt",fill:"#000000",stroke:"#000000",opacity:1,x:0,y:0,cx:0,cy:0,width:0,height:0,r:0,rx:0,ry:0,offset:0,"stop-opacity":1,"stop-color":"#000000","font-size":16,"font-family":"Helvetica, Arial, sans-serif","text-anchor":"start"},Ft=function(){function t(){c(this,t),this.init.apply(this,arguments)}return a(t,[{key:"init",value:function(t,e,n){var i,r;(this.r=0,this.g=0,this.b=0,t)&&("string"==typeof t?g.test(t)?(i=y.exec(t.replace(p,"")),this.r=parseInt(i[1]),this.g=parseInt(i[2]),this.b=parseInt(i[3])):m.test(t)&&(i=v.exec(4===(r=t).length?["#",r.substring(1,2),r.substring(1,2),r.substring(2,3),r.substring(2,3),r.substring(3,4),r.substring(3,4)].join(""):r),this.r=parseInt(i[1],16),this.g=parseInt(i[2],16),this.b=parseInt(i[3],16)):Array.isArray(t)?(this.r=t[0],this.g=t[1],this.b=t[2]):"object"===l(t)?(this.r=t.r,this.g=t.g,this.b=t.b):3===arguments.length&&(this.r=t,this.g=e,this.b=n))}},{key:"toString",value:function(){return this.toHex()}},{key:"toArray",value:function(){return[this.r,this.g,this.b]}},{key:"toHex",value:function(){return"#"+N(Math.round(this.r))+N(Math.round(this.g))+N(Math.round(this.b))}},{key:"toRgb",value:function(){return"rgb("+[this.r,this.g,this.b].join()+")"}},{key:"brightness",value:function(){return this.r/255*.3+this.g/255*.59+this.b/255*.11}}],[{key:"test",value:function(t){return t+="",m.test(t)||g.test(t)}},{key:"isRgb",value:function(t){return t&&"number"==typeof t.r&&"number"==typeof t.g&&"number"==typeof t.b}},{key:"isColor",value:function(t){return this.isRgb(t)||this.test(t)}}]),t}(),It=function(){try{return Array}catch(t){return Array}}(),Bt=function(t){function n(){var t,e;return c(this,n),(t=e=f(this,o(n).call(this))).init.apply(t,arguments),e}return u(n,It),a(n,[{key:"init",value:function(t,e){this.length=0,this.push.apply(this,O(this.parse(t||e)))}},{key:"toArray",value:function(){return Array.prototype.slice(this)}},{key:"toString",value:function(){this.join(" ")}},{key:"valueOf",value:function(){return this.toArray()}},{key:"parse",value:function(t){return t=t.valueOf(),Array.isArray(t)?t:t.trim().split(b).map(parseFloat)}},{key:"clone",value:function(){return new this.constructor(this)}},{key:"toSet",value:function(){return new Set(this)}}]),n}();function Xt(t,e,n){if(null==t){t={},e=this.node.attributes;var i=!0,r=!1,s=void 0;try{for(var u,a=e[Symbol.iterator]();!(i=(u=a.next()).done);i=!0){var o=u.value;t[o.nodeName]=isNumer.test(o.nodeValue)?parseFloat(o.nodeValue):o.nodeValue}}catch(t){r=!0,s=t}finally{try{i||null==a.return||a.return()}finally{if(r)throw s}}return t}if(Array.isArray(t));else if("object"===l(t))for(e in t)this.attr(e,t[e]);else if(null===e)this.node.removeAttribute(t);else{if(null==e)return null==(e=this.node.getAttribute(t))?Lt[t]:x.test(e)?parseFloat(e):e;for("fill"!==t&&"stroke"!==t||k.test(e)&&(e=this.doc().defs().image(e));"function"==typeof e.attrHook;)e=e.attrHook(this,t);"number"==typeof e?e=new yt(e):Ft.isColor(e)?e=new Ft(e):Array.isArray(e)&&(e=new Bt(e)),"leading"===t?this.leading&&this.leading(e):"string"==typeof n?this.node.setAttributeNS(n,t,e.toString()):this.node.setAttribute(t,e.toString()),!this.rebuild||"font-size"!==t&&"x"!==t||this.rebuild()}return this}ut("Element",{attr:Xt});var Yt=function(t){function e(t){return c(this,e),f(this,o(e).call(this,X(t+"Gradient","string"==typeof t?null:t),e))}return u(e,s),a(e,[{key:"stop",value:function(t,e,n){return this.put(new Nt).update(t,e,n)}},{key:"update",value:function(t){return this.clear(),"function"==typeof t&&t.call(this,this),this}},{key:"url",value:function(){return"url(#"+this.id()+")"}},{key:"toString",value:function(){return this.url()}},{key:"attr",value:function(t,e,n){return"transform"===t&&(t="gradientTransform"),Xt.call(this,t,e,n)}},{key:"targets",value:function(){return find('svg [fill*="'+this.id()+'"]')}}]),e}();G(Yt,Pt),ut({Container:{gradient:function(t,e){return this.defs().gradient(t,e)}},Defs:{gradient:function(t,e){return this.put(new Yt(t)).update(e)}}}),W(Yt);var Gt=function(t){function e(t){return c(this,e),f(this,o(e).call(this,X("pattern",t)))}return u(e,s),a(e,[{key:"url",value:function(){return"url(#"+this.id()+")"}},{key:"update",value:function(t){return this.clear(),"function"==typeof t&&t.call(this,this),this}},{key:"toString",value:function(){return this.url()}},{key:"attr",value:function(t,e,n){return"transform"===t&&(t="patternTransform"),Xt.call(this,t,e,n)}},{key:"targets",value:function(){return find('svg [fill*="'+this.id()+'"]')}}]),e}();ut({Container:{pattern:function(t,e,n){return this.defs().pattern(t,e,n)}},Defs:{pattern:function(t,e,n){return this.put(new Gt).update(n).attr({x:0,y:0,width:t,height:e,patternUnits:"userSpaceOnUse"})}}}),W(Gt);var Ht=0;function Vt(t){return t instanceof Base&&t.is("EventTarget")?t.getEventTarget():t}function Ut(t,e,i,n,r){var s=i.bind(n||t),u=Vt(t);e=Array.isArray(e)?e:e.split(b),u.instance=u.instance||{events:{}};var a=u.instance.events;i._svgjsListenerId||(i._svgjsListenerId=++Ht),e.forEach(function(t){var e=t.split(".")[0],n=t.split(".")[1]||"*";a[e]=a[e]||{},a[e][n]=a[e][n]||{},a[e][n][i._svgjsListenerId]=s,u.addEventListener(e,s,r||!1)})}function Qt(t,e,s,u){var a=Vt(t);if(a.instance&&("function"!=typeof s||(s=s._svgjsListenerId))){var o=a.instance.events;(e=Array.isArray(e)?e:(e||"").split(b)).forEach(function(t){var e,n,i=t&&t.split(".")[0],r=t&&t.split(".")[1];if(s)o[i]&&o[i][r||"*"]&&(a.removeEventListener(i,o[i][r||"*"][s],u||!1),delete o[i][r||"*"][s]);else if(i&&r){if(o[i]&&o[i][r]){for(n in o[i][r])Qt(a,[i,r].join("."),n);delete o[i][r]}}else if(r)for(t in o)for(e in o[t])r===e&&Qt(a,[t,r].join("."));else if(i){if(o[i]){for(e in o[i])Qt(a,[i,e].join("."));delete o[i]}}else{for(t in o)Qt(a,t);a.instance.events={}}})}}var $t=function(t){function e(t){return c(this,e),f(this,o(e).call(this,X("image",t),e))}return u(e,s),a(e,[{key:"load",value:function(n,i){if(!n)return this;var r=new window.Image;return Ut(r,"load",function(t){var e=this.parent(Gt);0===this.width()&&0===this.height()&&this.size(r.width,r.height),e instanceof Gt&&0===e.width()&&0===e.height()&&e.size(this.width(),this.height()),"function"==typeof i&&i.call(this,{width:r.width,height:r.height,ratio:r.width/r.height,url:n})},this),Ut(r,"load error",function(){Qt(r)}),this.attr("href",r.src=n,B)}},{key:"attrHook",value:function(t){var e=this;return t.doc().defs().pattern(0,0,function(t){t.add(e)})}}]),e}();ut({Container:{image:function(t,e){return this.put(new $t).size(0,0).load(t,e)}}}),W($t);var Wt=function(t){function r(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[[0,0]];return c(this,r),f(this,o(r).call(this,t,e))}return u(r,Bt),a(r,[{key:"toString",value:function(){for(var t=0,e=this.value.length,n=[];t<e;t++)n.push(this.value[t].join(","));return n.join(" ")}},{key:"toArray",value:function(){return this.value.reduce(function(t,e){return[].concat.call(t,e)},[])}},{key:"toLine",value:function(){return{x1:this.value[0][0],y1:this.value[0][1],x2:this.value[1][0],y2:this.value[1][1]}}},{key:"at",value:function(t){if(!this.destination)return this;for(var e=0,n=this.value.length,i=[];e<n;e++)i.push([this.value[e][0]+(this.destination[e][0]-this.value[e][0])*t,this.value[e][1]+(this.destination[e][1]-this.value[e][1])*t]);return new r(i)}},{key:"parse",value:function(t){var e=[];if(t=t.valueOf(),Array.isArray(t)){if(Array.isArray(t[0]))return t}else t=t.trim().split(b).map(parseFloat);t.length%2!=0&&t.pop();for(var n=0,i=t.length;n<i;n+=2)e.push([t[n],t[n+1]]);return e}},{key:"move",value:function(t,e){var n=this.bbox();if(t-=n.x,e-=n.y,!isNaN(t)&&!isNaN(e))for(var i=this.value.length-1;0<=i;i--)this.value[i]=[this.value[i][0]+t,this.value[i][1]+e];return this}},{key:"size",value:function(t,e){var n,i=this.bbox();for(n=this.value.length-1;0<=n;n--)i.width&&(this.value[n][0]=(this.value[n][0]-i.x)*t/i.width+i.x),i.height&&(this.value[n][1]=(this.value[n][1]-i.y)*e/i.height+i.y);return this}},{key:"bbox",value:function(){var e=-1/0,n=-1/0,i=1/0,r=1/0;return this.value.forEach(function(t){e=Math.max(t[0],e),n=Math.max(t[1],n),i=Math.min(t[0],i),r=Math.min(t[1],r)}),{x:i,y:r,width:e-i,height:n-r}}}]),r}(),Zt=function(t){function e(t){return c(this,e),f(this,o(e).call(this,X("line",t),e))}return u(e,s),a(e,[{key:"array",value:function(){return new Wt([[this.attr("x1"),this.attr("y1")],[this.attr("x2"),this.attr("y2")]])}},{key:"plot",value:function(t,e,n,i){return null==t?this.array():(t=void 0!==e?{x1:t,y1:e,x2:n,y2:i}:new Wt(t).toLine(),this.attr(t))}},{key:"move",value:function(t,e){return this.attr(this.array().move(t,e).toLine())}},{key:"size",value:function(t,e){var n=P(this,t,e);return this.attr(this.array().size(n.width,n.height).toLine())}}]),e}();ut({Container:{line:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return Zt.prototype.plot.apply(this.put(new Zt),null!=e[0]?e:[0,0,0,0])}}}),W(Zt);var Jt=function(t){function e(t){return c(this,e),f(this,o(e).call(this,nodeOrNew("marker",t),e))}return u(e,s),a(e,[{key:"width",value:function(t){return this.attr("markerWidth",t)}},{key:"height",value:function(t){return this.attr("markerHeight",t)}},{key:"ref",value:function(t,e){return this.attr("refX",t).attr("refY",e)}},{key:"update",value:function(t){return this.clear(),"function"==typeof t&&t.call(this,this),this}},{key:"toString",value:function(){return"url(#"+this.id()+")"}}]),e}();ut({Container:{marker:function(t,e,n){return this.defs().marker(t,e,n)}},Defs:{marker:function(t,e,n){return this.put(new Jt).size(t,e).ref(t/2,e/2).viewbox(0,0,t,e).attr("orient","auto").update(n)}},marker:{marker:function(t,e,n,i){var r=["marker"];return"all"!==t&&r.push(t),r=r.join("-"),t=e instanceof Jt?e:this.defs().marker(e,n,i),this.attr(r,t)}}}),W(Jt);var Kt=function(t){function e(t){return c(this,e),f(this,o(e).call(this,X("mask",t)))}return u(e,s),a(e,[{key:"remove",value:function(){return this.targets().forEach(function(t){t.unmask()}),Ct.call(this)}},{key:"targets",value:function(){return Mt('svg [mask*="'+this.id()+'"]')}}]),e}();function te(){if(!te.nodes){var t=(new lt).size(2,0).css({opacity:0,position:"absolute",left:"-100%",top:"-100%",overflow:"hidden"}),e=t.path().node;te.nodes={svg:t,path:e}}if(!te.nodes.svg.node.parentNode){var n=document.body||document.documentElement;te.nodes.svg.addTo(n)}return te.nodes}ut({Container:{mask:function(){return this.defs().put(new Kt)}},Element:{maskWith:function(t){var e=t instanceof Kt?t:this.parent().mask().add(t);return this.attr("mask",'url("#'+e.id()+'")')},unmask:function(){return this.attr("mask",null)},masker:function(){return this.reference("mask")}}}),W(Kt);var ee=function(){function r(t,e,n){var i;c(this,r),n=n||{x:0,y:0},i=Array.isArray(t)?{x:t[0],y:t[1]}:"object"===l(t)?{x:t.x,y:t.y}:{x:t,y:e},this.x=null==i.x?n.x:i.x,this.y=null==i.y?n.y:i.y}return a(r,[{key:"clone",value:function(){return new r(this)}},{key:"native",value:function(){var t=te().svg.createSVGPoint();return t.x=this.x,t.y=this.y,t}},{key:"transform",value:function(t){return new r(t.a*this.x+t.c*this.y+t.e,t.b*this.x+t.d*this.y+t.f)}}]),r}();ut({Element:{point:function(t,e){return new ee(t,e).transform(this.screenCTM().inverse())}}});for(var ne={M:function(t,e,n){return e.x=n.x=t[0],e.y=n.y=t[1],["M",e.x,e.y]},L:function(t,e){return e.x=t[0],e.y=t[1],["L",t[0],t[1]]},H:function(t,e){return e.x=t[0],["H",t[0]]},V:function(t,e){return e.y=t[0],["V",t[0]]},C:function(t,e){return e.x=t[4],e.y=t[5],["C",t[0],t[1],t[2],t[3],t[4],t[5]]},S:function(t,e){return e.x=t[2],e.y=t[3],["S",t[0],t[1],t[2],t[3]]},Q:function(t,e){return e.x=t[2],e.y=t[3],["Q",t[0],t[1],t[2],t[3]]},T:function(t,e){return e.x=t[0],e.y=t[1],["T",t[0],t[1]]},Z:function(t,e,n){return e.x=n.x,e.y=n.y,["Z"]},A:function(t,e){return e.x=t[5],e.y=t[6],["A",t[0],t[1],t[2],t[3],t[4],t[5],t[6]]}},ie="mlhvqtcsaz".split(""),re=0,se=ie.length;re<se;++re)ne[ie[re]]=function(s){return function(t,e,n){if("H"===s)t[0]=t[0]+e.x;else if("V"===s)t[0]=t[0]+e.y;else if("A"===s)t[5]=t[5]+e.x,t[6]=t[6]+e.y;else for(var i=0,r=t.length;i<r;++i)t[i]=t[i]+(i%2?e.y:e.x);return ne[s](t,e,n)}}(ie[re].toUpperCase());var ue=function(t){function h(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[["M",0,0]];return c(this,h),f(this,o(h).call(this,t,e))}return u(h,Bt),a(h,[{key:"toString",value:function(){return function(t){for(var e=0,n=t.length,i="";e<n;e++)i+=t[e][0],null!=t[e][1]&&(i+=t[e][1],null!=t[e][2]&&(i+=" ",i+=t[e][2],null!=t[e][3]&&(i+=" ",i+=t[e][3],i+=" ",i+=t[e][4],null!=t[e][5]&&(i+=" ",i+=t[e][5],i+=" ",i+=t[e][6],null!=t[e][7]&&(i+=" ",i+=t[e][7])))));return i+" "}(this)}},{key:"toArray",value:function(){return this.reduce(function(t,e){return[].concat.call(t,e)},[])}},{key:"move",value:function(t,e){var n=this.bbox();if(t-=n.x,e-=n.y,!isNaN(t)&&!isNaN(e))for(var i,r=this.length-1;0<=r;r--)"M"===(i=this[r][0])||"L"===i||"T"===i?(this[r][1]+=t,this[r][2]+=e):"H"===i?this[r][1]+=t:"V"===i?this[r][1]+=e:"C"===i||"S"===i||"Q"===i?(this[r][1]+=t,this[r][2]+=e,this[r][3]+=t,this[r][4]+=e,"C"===i&&(this[r][5]+=t,this[r][6]+=e)):"A"===i&&(this[r][6]+=t,this[r][7]+=e);return this}},{key:"size",value:function(t,e){var n,i,r=this.bbox();for(n=this.length-1;0<=n;n--)"M"===(i=this[n][0])||"L"===i||"T"===i?(this[n][1]=(this[n][1]-r.x)*t/r.width+r.x,this[n][2]=(this[n][2]-r.y)*e/r.height+r.y):"H"===i?this[n][1]=(this[n][1]-r.x)*t/r.width+r.x:"V"===i?this[n][1]=(this[n][1]-r.y)*e/r.height+r.y:"C"===i||"S"===i||"Q"===i?(this[n][1]=(this[n][1]-r.x)*t/r.width+r.x,this[n][2]=(this[n][2]-r.y)*e/r.height+r.y,this[n][3]=(this[n][3]-r.x)*t/r.width+r.x,this[n][4]=(this[n][4]-r.y)*e/r.height+r.y,"C"===i&&(this[n][5]=(this[n][5]-r.x)*t/r.width+r.x,this[n][6]=(this[n][6]-r.y)*e/r.height+r.y)):"A"===i&&(this[n][1]=this[n][1]*t/r.width,this[n][2]=this[n][2]*e/r.height,this[n][6]=(this[n][6]-r.x)*t/r.width+r.x,this[n][7]=(this[n][7]-r.y)*e/r.height+r.y);return this}},{key:"equalCommands",value:function(t){var e,n,i;for(t=new h(t),i=this.length===t.value.length,e=0,n=this.length;i&&e<n;e++)i=this[e][0]===t.value[e][0];return i}},{key:"morph",value:function(t){return t=new h(t),this.equalCommands(t)?this.destination=t:this.destination=null,this}},{key:"at",value:function(t){if(!this.destination)return this;var e,n,i,r,s=this,u=this.destination.value,a=[],o=new h;for(e=0,n=s.length;e<n;e++){for(a[e]=[s[e][0]],i=1,r=s[e].length;i<r;i++)a[e][i]=s[e][i]+(u[e][i]-s[e][i])*t;"A"===a[e][0]&&(a[e][4]=+(0!==a[e][4]),a[e][5]=+(0!==a[e][5]))}return o.value=a,o}},{key:"parse",value:function(t){if(t instanceof h)return t.valueOf();var e,n={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7,Z:0};t="string"==typeof t?t.replace(C,S).replace(M," $& ").replace(A,"$1 -").trim().split(b):t.reduce(function(t,e){return[].concat.call(t,e)},[]);for(var i=[],r=new ee,s=new ee,u=0,a=t.length;T.test(t[u])?(e=t[u],++u):"M"===e?e="L":"m"===e&&(e="l"),i.push(ne[e].call(null,t.slice(u,u+=n[e.toUpperCase()]).map(parseFloat),r,s)),u<a;);return i}},{key:"bbox",value:function(){return te().path.setAttribute("d",this.toString()),te.nodes.path.getBBox()}}]),h}(),ae=function(t){function e(t){return c(this,e),f(this,o(e).call(this,X("path",t),e))}return u(e,s),a(e,[{key:"array",value:function(){return this._array||(this._array=new ue(this.attr("d")))}},{key:"plot",value:function(t){return null==t?this.array():this.clear().attr("d","string"==typeof t?t:this._array=new ue(t))}},{key:"clear",value:function(){return delete this._array,this}},{key:"move",value:function(t,e){return this.attr("d",this.array().move(t,e))}},{key:"x",value:function(t){return null==t?this.bbox().x:this.move(t,this.bbox().y)}},{key:"y",value:function(t){return null==t?this.bbox().y:this.move(this.bbox().x,t)}},{key:"size",value:function(t,e){var n=P(this,t,e);return this.attr("d",this.array().size(n.width,n.height))}},{key:"width",value:function(t){return null==t?this.bbox().width:this.size(t,this.bbox().height)}},{key:"height",value:function(t){return null==t?this.bbox().height:this.size(this.bbox().width,t)}},{key:"targets",value:function(){return Mt('svg textpath [href*="'+this.id()+'"]')}}]),e}();ae.prototype.MorphArray=ue,ut({Container:{path:function(t){return this.put(new ae).plot(t||new ue)}}}),W(ae);var oe=Wt;var he=Object.freeze({MorphArray:oe,x:function(t){return null==t?this.bbox().x:this.move(t,this.bbox().y)},y:function(t){return null==t?this.bbox().y:this.move(this.bbox().x,t)},width:function(t){var e=this.bbox();return null==t?e.width:this.size(t,e.height)},height:function(t){var e=this.bbox();return null==t?e.height:this.size(e.width,t)}});var le=Object.freeze({array:function(){return this._array||(this._array=new PointArray(this.attr("points")))},plot:function(t){return null==t?this.array():this.clear().attr("points","string"==typeof t?t:this._array=new PointArray(t))},clear:function(){return delete this._array,this},move:function(t,e){return this.attr("points",this.array().move(t,e))},size:function(t,e){var n=proportionalSize(this,t,e);return this.attr("points",this.array().size(n.width,n.height))}}),ce=function(t){function e(t){return c(this,e),f(this,o(e).call(this,X("polygon",t),e))}return u(e,s),e}();ut({Parent:{polygon:function(t){return this.put(new ce).plot(t||new Wt)}}}),G(ce,he),G(ce,le),W(ce);var fe=function(t){function e(t){return c(this,e),f(this,o(e).call(this,X("polyline",t),e))}return u(e,s),e}();ut({Parent:{polyline:function(t){return this.put(new fe).plot(t||new Wt)}}}),G(fe,he),G(fe,le),W(fe);var de=function(t){function e(t){return c(this,e),f(this,o(e).call(this,X("rect",t),e))}return u(e,s),e}();ut({Container:{rect:function(t,e){return this.put(new de).size(t,e)}}}),W(de);var ve=function(t){function e(t){return c(this,e),f(this,o(e).call(this,X("symbol",t),e))}return u(e,s),e}();ut({Container:{symbol:function(){return this.put(new ve)}}}),W(ve);var ye=Object.freeze({plain:function(t){return!1===this._build&&this.clear(),this.node.appendChild(document.createTextNode(t)),this},length:function(){return this.node.getComputedTextLength()}}),pe=function(t){function n(t){var e;return c(this,n),(e=f(this,o(n).call(this,X("text",t),n))).dom.leading=new yt(1.3),e._rebuild=!0,e._build=!1,e.attr("font-family",Lt["font-family"]),e}return u(n,s),a(n,[{key:"x",value:function(t){return null==t?this.attr("x"):this.attr("x",t)}},{key:"y",value:function(t){var e=this.attr("y"),n="number"==typeof e?e-this.bbox().y:0;return null==t?"number"==typeof e?e-n:e:this.attr("y","number"==typeof t?t+n:t)}},{key:"cx",value:function(t){return null==t?this.bbox().cx:this.x(t-this.bbox().width/2)}},{key:"cy",value:function(t){return null==t?this.bbox().cy:this.y(t-this.bbox().height/2)}},{key:"text",value:function(t){if(void 0===t){var e=this.node.childNodes,n=0;t="";for(var i=0,r=e.length;i<r;++i)"textPath"!==e[i].nodeName?(i!==n&&3!==e[i].nodeType&&!0===adopt(e[i]).dom.newLined&&(t+="\n"),t+=e[i].textContent):0===i&&(n=1);return t}if(this.clear().build(!0),"function"==typeof t)t.call(this,this);else for(var s=0,u=(t=t.split("\n")).length;s<u;s++)this.tspan(t[s]).newLine();return this.build(!1).rebuild()}},{key:"leading",value:function(t){return null==t?this.dom.leading:(this.dom.leading=new yt(t),this.rebuild())}},{key:"rebuild",value:function(t){if("boolean"==typeof t&&(this._rebuild=t),this._rebuild){var e=this,n=0,i=this.dom.leading*new yt(this.attr("font-size"));this.each(function(){this.dom.newLined&&(this.attr("x",e.attr("x")),"\n"===this.text()?n+=i:(this.attr("dy",i+n),n=0))}),this.fire("rebuild")}return this}},{key:"build",value:function(t){return this._build=!!t,this}},{key:"setData",value:function(t){return this.dom=t,this.dom.leading=new yt(t.leading||1.3),this}}]),n}();G(pe,ye),ut({Container:{text:function(t){return this.put(new pe).text(t)},plain:function(t){return this.put(new pe).plain(t)}}}),W(pe);var me=function(t){function e(t){return c(this,e),f(this,o(e).call(this,X("textPath",t)))}return u(e,pe),a(e,[{key:"array",value:function(){var t=this.track();return t?t.array():null}},{key:"plot",value:function(t){var e=this.track(),n=null;return e&&(n=e.plot(t)),null==t?n:this}},{key:"track",value:function(){return this.reference("href")}}]),e}();ut({Container:{textPath:function(t,e){return this.defs().path(e).text(t).addTo(this)}},Text:{path:function(t){var e=new me;return t instanceof ae||(t=this.doc().defs().path(t)),e.attr("href","#"+t,B),this.put(e)},textPath:function(){return this.select("textPath")}},Path:{text:function(t){if(t instanceof pe){var e=t.text();return t.clear().path(this).text(e)}return this.parent().put(new pe).path(this).text(t)}}}),me.prototype.MorphArray=ue,W(me);var ge=function(t){function e(t){return c(this,e),f(this,o(e).call(this,X("tspan",t),e))}return u(e,s),a(e,[{key:"text",value:function(t){return null==t?this.node.textContent+(this.dom.newLined?"\n":""):("function"==typeof t?t.call(this,this):this.plain(t),this)}},{key:"dx",value:function(t){return this.attr("dx",t)}},{key:"dy",value:function(t){return this.attr("dy",t)}},{key:"newLine",value:function(){var t=this.parent(Text);return this.dom.newLined=!0,this.dy(t.dom.leading*t.attr("font-size")).attr("x",t.x())}}]),e}();G(ge,ye),ut({Tspan:{tspan:function(t){var e=new ge;return this._build||this.clear(),this.node.appendChild(e.node),e.text(t)}}}),W(ge);var we=function(t){function e(t){return c(this,e),f(this,o(e).call(this,nodeOrNew("use",t),e))}return u(e,s),a(e,[{key:"element",value:function(t,e){return this.attr("href",(e||"")+"#"+t,B)}}]),e}();ut({Container:{use:function(t,e){return this.put(new we).element(t,e)}}}),W(we);var xe=function(){function h(){c(this,h),this.init.apply(this,arguments)}return a(h,[{key:"init",value:function(t){var e=D([1,0,0,1,0,0]);t=t instanceof s&&t.is("Element")?t.matrixify():"string"==typeof t?D(t.split(b).map(parseFloat)):Array.isArray(t)?D(t):"object"===l(t)&&R(t)?t:"object"===l(t)?(new h).transform(t):6===arguments.length?D([].slice.call(arguments)):e,this.a=null!=t.a?t.a:e.a,this.b=null!=t.b?t.b:e.b,this.c=null!=t.c?t.c:e.c,this.d=null!=t.d?t.d:e.d,this.e=null!=t.e?t.e:e.e,this.f=null!=t.f?t.f:e.f}},{key:"clone",value:function(){return new h(this)}},{key:"transform",value:function(t){if(R(t))return new h(t).multiplyO(this);var e=h.formatTransforms(t),n=new ee(e.ox,e.oy).transform(this),i=n.x,r=n.y,s=(new h).translateO(e.rx,e.ry).lmultiplyO(this).translateO(-i,-r).scaleO(e.scaleX,e.scaleY).skewO(e.skewX,e.skewY).shearO(e.shear).rotateO(e.theta).translateO(i,r);if(isFinite(e.px)||isFinite(e.py)){var u=new ee(i,r).transform(s),a=e.px?e.px-u.x:0,o=e.py?e.py-u.y:0;s.translateO(a,o)}return s.translateO(e.tx,e.ty),s}},{key:"compose",value:function(t){t.origin&&(t.originX=t.origin[0],t.originY=t.origin[1]);var e=t.originX||0,n=t.originY||0,i=t.scaleX||1,r=t.scaleY||1,s=t.shear||0,u=t.rotate||0,a=t.translateX||0,o=t.translateY||0;return(new h).translateO(-e,-n).scaleO(i,r).shearO(s).rotateO(u).translateO(a,o).lmultiplyO(this).translateO(e,n)}},{key:"decompose",value:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,n=this.a,i=this.b,r=this.c,s=this.d,u=this.e,a=this.f,o=n*s-i*r,h=0<o?1:-1,l=h*Math.sqrt(n*n+i*i),c=Math.atan2(h*i,h*n),f=180/Math.PI*c,d=Math.cos(c),v=Math.sin(c),y=(n*r+i*s)/o,p=r*l/(y*n-i)||s*l/(y*i+n);return{scaleX:l,scaleY:p,shear:y,rotate:f,translateX:u-t+t*d*l+e*(y*d*l-v*p),translateY:a-e+t*v*l+e*(y*v*l+d*p),originX:t,originY:e,a:this.a,b:this.b,c:this.c,d:this.d,e:this.e,f:this.f}}},{key:"multiply",value:function(t){return this.clone().multiplyO(t)}},{key:"multiplyO",value:function(t){var e=t instanceof h?t:new h(t);return h.matrixMultiply(this,e,this)}},{key:"lmultiply",value:function(t){return this.clone().lmultiplyO(t)}},{key:"lmultiplyO",value:function(t){var e=t instanceof h?t:new h(t);return h.matrixMultiply(e,this,this)}},{key:"inverseO",value:function(){var t=this.a,e=this.b,n=this.c,i=this.d,r=this.e,s=this.f,u=t*i-e*n;if(!u)throw new Error("Cannot invert "+this);var a=i/u,o=-e/u,h=-n/u,l=t/u,c=-(a*r+h*s),f=-(o*r+l*s);return this.a=a,this.b=o,this.c=h,this.d=l,this.e=c,this.f=f,this}},{key:"inverse",value:function(){return this.clone().inverseO()}},{key:"translate",value:function(t,e){return this.clone().translateO(t,e)}},{key:"translateO",value:function(t,e){return this.e+=t||0,this.f+=e||0,this}},{key:"scale",value:function(t,e,n,i){var r;return(r=this.clone()).scaleO.apply(r,arguments)}},{key:"scaleO",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:t,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:0;3===arguments.length&&(i=n,n=e,e=t);var r=this.a,s=this.b,u=this.c,a=this.d,o=this.e,h=this.f;return this.a=r*t,this.b=s*e,this.c=u*t,this.d=a*e,this.e=o*t-n*t+n,this.f=h*e-i*e+i,this}},{key:"rotate",value:function(t,e,n){return this.clone().rotateO(t,e,n)}},{key:"rotateO",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0;t=At(t);var i=Math.cos(t),r=Math.sin(t),s=this.a,u=this.b,a=this.c,o=this.d,h=this.e,l=this.f;return this.a=s*i-u*r,this.b=u*i+s*r,this.c=a*i-o*r,this.d=o*i+a*r,this.e=h*i-l*r+n*r-e*i+e,this.f=l*i+h*r-e*r-n*i+n,this}},{key:"flip",value:function(t,e){return this.clone().flipO(t,e)}},{key:"flipO",value:function(t,e){return"x"===t?this.scaleO(-1,1,e,0):"y"===t?this.scaleO(1,-1,0,e):this.scaleO(-1,-1,t,e||t)}},{key:"shear",value:function(t,e,n){return this.clone().shearO(t,e,n)}},{key:"shearO",value:function(t){var e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,n=this.a,i=this.b,r=this.c,s=this.d,u=this.e,a=this.f;return this.a=n+i*t,this.c=r+s*t,this.e=u+a*t-e*t,this}},{key:"skew",value:function(t,e,n,i){var r;return(r=this.clone()).skewO.apply(r,arguments)}},{key:"skewO",value:function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:t,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:0;3===arguments.length&&(i=n,n=e,e=t),t=At(t),e=At(e);var r=Math.tan(t),s=Math.tan(e),u=this.a,a=this.b,o=this.c,h=this.d,l=this.e,c=this.f;return this.a=u+a*r,this.b=a+u*s,this.c=o+h*r,this.d=h+o*s,this.e=l+c*r-i*r,this.f=c+l*s-n*s,this}},{key:"skewX",value:function(t,e,n){return this.skew(t,0,e,n)}},{key:"skewXO",value:function(t,e,n){return this.skewO(t,0,e,n)}},{key:"skewY",value:function(t,e,n){return this.skew(0,t,e,n)}},{key:"skewYO",value:function(t,e,n){return this.skewO(0,t,e,n)}},{key:"aroundO",value:function(t,e,n){var i=t||0,r=e||0;return this.translateO(-i,-r).lmultiplyO(n).translateO(i,r)}},{key:"around",value:function(t,e,n){return this.clone().aroundO(t,e,n)}},{key:"native",value:function(){for(var t=te().node.createSVGMatrix(),e=z.length-1;0<=e;e--)t[z[e]]=this[z[e]];return t}},{key:"equals",value:function(t){var e=new h(t);return q(this.a,e.a)&&q(this.b,e.b)&&q(this.c,e.c)&&q(this.d,e.d)&&q(this.e,e.e)&&q(this.f,e.f)}},{key:"toString",value:function(){return"matrix("+this.a+","+this.b+","+this.c+","+this.d+","+this.e+","+this.f+")"}},{key:"toArray",value:function(){return[this.a,this.b,this.c,this.d,this.e,this.f]}},{key:"valueOf",value:function(){return{a:this.a,b:this.b,c:this.c,d:this.d,e:this.e,f:this.f}}}],[{key:"formatTransforms",value:function(t){var e="both"===t.flip||!0===t.flip,n=t.flip&&(e||"x"===t.flip)?-1:1,i=t.flip&&(e||"y"===t.flip)?-1:1,r=t.skew&&t.skew.length?t.skew[0]:isFinite(t.skew)?t.skew:isFinite(t.skewX)?t.skewX:0,s=t.skew&&t.skew.length?t.skew[1]:isFinite(t.skew)?t.skew:isFinite(t.skewY)?t.skewY:0,u=t.scale&&t.scale.length?t.scale[0]*n:isFinite(t.scale)?t.scale*n:isFinite(t.scaleX)?t.scaleX*n:n,a=t.scale&&t.scale.length?t.scale[1]*i:isFinite(t.scale)?t.scale*i:isFinite(t.scaleY)?t.scaleY*i:i,o=t.shear||0,h=t.rotate||t.theta||0,l=new ee(t.origin||t.around||t.ox||t.originX,t.oy||t.originY),c=l.x,f=l.y,d=new ee(t.position||t.px||t.positionX,t.py||t.positionY),v=d.x,y=d.y,p=new ee(t.translate||t.tx||t.translateX,t.ty||t.translateY),m=p.x,g=p.y,w=new ee(t.relative||t.rx||t.relativeX,t.ry||t.relativeY);return{scaleX:u,scaleY:a,skewX:r,skewY:s,shear:o,theta:h,rx:w.x,ry:w.y,tx:m,ty:g,ox:c,oy:f,px:v,py:y}}},{key:"matrixMultiply",value:function(t,e,n){var i=t.a*e.a+t.c*e.b,r=t.b*e.a+t.d*e.b,s=t.a*e.c+t.c*e.d,u=t.b*e.c+t.d*e.d,a=t.e+t.a*e.e+t.c*e.f,o=t.f+t.b*e.e+t.d*e.f;return n.a=i,n.b=r,n.c=s,n.d=u,n.e=a,n.f=o,n}}]),h}();ut({Element:{ctm:function(){return new xe(this.node.getCTM())},screenCTM:function(){if(this instanceof Doc&&!this.isRoot()){var t=this.rect(1,1),e=t.node.getScreenCTM();return t.remove(),new xe(e)}return new xe(this.node.getScreenCTM())}}});var ke=function(){function u(){c(this,u),this.init.apply(this,arguments)}return a(u,[{key:"init",value:function(t){var e;t="string"==typeof t?t.split(b).map(parseFloat):Array.isArray(t)?t:"object"===l(t)?[null!=t.left?t.left:t.x,null!=t.top?t.top:t.y,t.width,t.height]:4===arguments.length?[].slice.call(arguments):[0,0,0,0],this.x=t[0],this.y=t[1],this.width=t[2],this.height=t[3],null==(e=this).x&&(e.x=0,e.y=0,e.width=0,e.height=0),e.w=e.width,e.h=e.height,e.x2=e.x+e.width,e.y2=e.y+e.height,e.cx=e.x+e.width/2,e.cy=e.y+e.height/2}},{key:"merge",value:function(t){var e=Math.min(this.x,t.x),n=Math.min(this.y,t.y);return new u(e,n,Math.max(this.x+this.width,t.x+t.width)-e,Math.max(this.y+this.height,t.y+t.height)-n)}},{key:"transform",value:function(e){var n=1/0,i=-1/0,r=1/0,s=-1/0;return[new ee(this.x,this.y),new ee(this.x2,this.y),new ee(this.x,this.y2),new ee(this.x2,this.y2)].forEach(function(t){t=t.transform(e),n=Math.min(n,t.x),i=Math.max(i,t.x),r=Math.min(r,t.y),s=Math.max(s,t.y)}),new u(n,r,i-n,s-r)}},{key:"addOffset",value:function(){return this.x+=window.pageXOffset,this.y+=window.pageYOffset,this}},{key:"toString",value:function(){return this.x+" "+this.y+" "+this.width+" "+this.height}},{key:"toArray",value:function(){return[this.x,this.y,this.width,this.height]}}]),u}();function be(e){var n,t,i;try{if(n=e(this.node),!((i=n).w||i.h||i.x||i.y||(t=this.node,(document.documentElement.contains||function(t){for(;t.parentNode;)t=t.parentNode;return t===document}).call(document.documentElement,t))))throw new Error("Element not in the dom")}catch(t){try{var r=this.clone(te().svg).show();n=e(r.node),r.remove()}catch(t){throw t}}return n}function _e(e,n){return function(t){return null==t?this[t]:(this[e]=t,n&&n.call(this),this)}}ut({Element:{bbox:function(){return new ke(be.call(this,function(t){return t.getBBox()}))},rbox:function(t){var e=new ke(be.call(this,function(t){return t.getBoundingClientRect()}));return t?e.transform(t.screenCTM().inverse()):e.addOffset()}},viewbox:function(t,e,n,i){return null==t?new ke(this.attr("viewBox")):this.attr("viewBox",new ke(t,e,n,i))}});var Oe={"-":function(t){return t},"<>":function(t){return-Math.cos(t*Math.PI)/2+.5},">":function(t){return Math.sin(t*Math.PI/2)},"<":function(t){return 1-Math.cos(t*Math.PI/2)},bezier:function(t,e,n,i){return function(t){}}},Ae=function(){function t(){c(this,t)}return a(t,[{key:"done",value:function(){return!1}}]),t}(),Me=function(t){function n(t){var e;return c(this,n),(e=f(this,o(n).call(this))).ease=Oe[t||qt]||t,e}return u(n,Ae),a(n,[{key:"step",value:function(t,e,n){return"number"!=typeof t?n<1?t:e:t+(e-t)*this.ease(n)}}]),n}(),Te=function(t){function n(t){var e;return c(this,n),(e=f(this,o(n).call(this))).stepper=t,e}return u(n,Ae),a(n,[{key:"step",value:function(t,e,n,i){return this.stepper(t,e,n,i)}},{key:"done",value:function(t){return t.done}}]),n}();function Ce(){var t=(this._duration||500)/1e3,e=this._overshoot||0,n=Math.PI,i=Math.log(e/100+1e-10),r=-i/Math.sqrt(n*n+i*i),s=3.9/(r*t);this.d=2*r*s,this.k=s*s}var je=function(t){function i(t,e){var n;return c(this,i),(n=f(this,o(i).call(this))).duration(t||500).overshoot(e||0),n}return u(i,Te),a(i,[{key:"step",value:function(t,e,n,i){if("string"==typeof t)return t;if(i.done=n===1/0,n===1/0)return e;if(0===n)return t;100<n&&(n=16),n/=1e3;var r=i.velocity||0,s=-this.d*r-this.k*(t-e),u=t+r*n+s*n*n/2;return i.velocity=r+s*n,i.done=Math.abs(e-u)+Math.abs(r)<.002,i.done?e:u}}]),i}();G(je,{duration:_e("_duration",Ce),overshoot:_e("_overshoot",Ce)});var Se=function(t){function s(t,e,n,i){var r;return c(this,s),t=null==t?.1:t,e=null==e?.01:e,n=null==n?0:n,i=null==i?1e3:i,(r=f(this,o(s).call(this))).p(t).i(e).d(n).windup(i),r}return u(s,Te),a(s,[{key:"step",value:function(t,e,n,i){if("string"==typeof t)return t;if(i.done=n===1/0,n===1/0)return e;if(0===n)return t;var r=e-t,s=(i.integral||0)+r*n,u=(r-(i.error||0))/n,a=this.windup;return!1!==a&&(s=Math.max(-a,Math.min(s,a))),i.error=r,i.integral=s,i.done=Math.abs(r)<.001,i.done?e:t+(this.P*r+this.I*s+this.D*u)}}]),s}();G(Se,{windup:_e("windup"),p:_e("P"),i:_e("I"),d:_e("D")});var Ee=function(){function i(t){c(this,i),this._stepper=t||new Me("-"),this._from=null,this._to=null,this._type=null,this._context=null,this._morphObj=null}return a(i,[{key:"from",value:function(t){return null==t?this._from:(this._from=this._set(t),this)}},{key:"to",value:function(t){return null==t?this._to:(this._to=this._set(t),this)}},{key:"type",value:function(t){return null==t?this._type:(this._type=t,this)}},{key:"_set",value:function(t){if(!this._type){var e=l(t);"number"===e?this.type(yt):"string"===e?Ft.isColor(t)?this.type(Ft):regex.delimiter.test(t)?this.type(regex.pathLetters.test(t)?ue:Bt):regex.numberAndUnit.test(t)?this.type(yt):this.type(i.NonMorphable):-1<MorphableTypes.indexOf(t.constructor)?this.type(t.constructor):Array.isArray(t)?this.type(Bt):"object"===e?this.type(i.ObjectBag):this.type(i.NonMorphable)}var n=new this._type(t).toArray();return this._morphObj=this._morphObj||new this._type,this._context=this._context||Array.apply(null,Array(n.length)).map(Object),n}},{key:"stepper",value:function(t){return null==t?this._stepper:(this._stepper=t,this)}},{key:"done",value:function(){return this._context.map(this._stepper.done).reduce(function(t,e){return t&&e},!0)}},{key:"at",value:function(n){var i=this;return this._morphObj.fromArray(this._from.map(function(t,e){return i._stepper.step(t,i._to[e],n,i._context[e],i._context)}))}}]),i}();Ee.NonMorphable=function(){function t(){c(this,t),this.init.apply(this,arguments)}return a(t,[{key:"init",value:function(t){t=Array.isArray(t)?t[0]:t,this.value=t}},{key:"valueOf",value:function(){return this.value}},{key:"toArray",value:function(){return[this.value]}}]),t}(),Ee.TransformBag=function(){function t(){c(this,t),this.init.apply(this,arguments)}return a(t,[{key:"init",value:function(t){Array.isArray(t)&&(t={scaleX:t[0],scaleY:t[1],shear:t[2],rotate:t[3],translateX:t[4],translateY:t[5],originX:t[6],originY:t[7]}),Object.assign(this,Ee.TransformBag.defaults,t)}},{key:"toArray",value:function(){var t=this;return[t.scaleX,t.scaleY,t.shear,t.rotate,t.translateX,t.translateY,t.originX,t.originY]}}]),t}(),Ee.TransformBag.defaults={scaleX:1,scaleY:1,shear:0,rotate:0,translateX:0,translateY:0,originX:0,originY:0},Ee.ObjectBag=function(){function t(){c(this,t),this.init.apply(this,arguments)}return a(t,[{key:"init",value:function(t){if(this.values=[],Array.isArray(t))this.values=t;else{var e=Object.entries(t||{}).sort(function(t,e){return t[0]-e[0]});this.values=e.reduce(function(t,e){return t.concat(e)},[])}}},{key:"valueOf",value:function(){for(var t={},e=this.values,n=0,i=e.length;n<i;n+=2)t[e[n]]=e[n+1];return t}},{key:"toArray",value:function(){return this.values}}]),t}(),G([yt,Ft,ke,xe,Bt,Wt,ue,Ee.NonMorphable,Ee.TransformBag,Ee.ObjectBag],{to:function(t,e){return(new Ee).type(this.constructor).from(this.valueOf()).to(t,e)},fromArray:function(t){return this.init(t),this}});var Ne=window.performance||Date,Pe=function(t){var e=t.start,n=t.runner.duration();return{start:e,duration:n,end:e+n,runner:t.runner}},De=function(){function t(){c(this,t),this._timeSource=function(){return Ne.now()},this._dispatcher=document.createElement("div"),this._startTime=0,this._speed=1,this._reverse=!1,this._persist=0,this._nextFrame=null,this._paused=!1,this._runners=[],this._order=[],this._time=0,this._lastSourceTime=0,this._lastStepTime=0}return a(t,[{key:"getEventTarget",value:function(){return this._dispatcher}},{key:"schedule",value:function(t,e,n){if(null==t)return this._runners.map(Pe).sort(function(t,e){return t.start-e.start||t.duration-e.duration});this.active()||(this._step(),null==n&&(n="now"));var i=0;if(e=e||0,null==n||"last"===n||"after"===n)i=this._startTime;else if("absolute"===n||"start"===n)i=e,e=0;else if("now"===n)i=this._time;else{if("relative"!==n)throw new Error('Invalid value for the "when" parameter');var r=this._runners[t.id];r&&(i=r.start+e,e=0)}return t.unschedule(),t.timeline(this),t.time(-e),this._startTime=i+t.duration()+e,this._runners[t.id]={persist:this.persist(),runner:t,start:i},this._order.push(t.id),this._continue(),this}},{key:"unschedule",value:function(t){var e=this._order.indexOf(t.id);return e<0||(delete this._runners[t.id],this._order.splice(e,1),t.timeline(null)),this}},{key:"play",value:function(){return this._paused=!1,this._continue()}},{key:"pause",value:function(){return this._nextFrame=null,this._paused=!0,this}},{key:"stop",value:function(){return this.seek(-this._time),this.pause()}},{key:"finish",value:function(){return this.seek(1/0),this.pause()}},{key:"speed",value:function(t){return null==t?this._speed:(this._speed=t,this)}},{key:"reverse",value:function(t){var e=this.speed();if(null==t)return this.speed(-e);var n=Math.abs(e);return this.speed(t?n:-n)}},{key:"seek",value:function(t){return this._time+=t,this._continue()}},{key:"time",value:function(t){return null==t?this._time:(this._time=t,this)}},{key:"persist",value:function(t){return null==t?this._persist:(this._persist=t,this)}},{key:"source",value:function(t){return null==t?this._timeSource:(this._timeSource=t,this)}},{key:"_step",value:function(){if(!this._paused){var t=this._timeSource(),e=t-this._lastSourceTime,n=this._speed*e+(this._time-this._lastStepTime);this._lastSourceTime=t,this._time+=n,this._lastStepTime=this._time;for(var i=!1,r=0,s=this._order.length;r<s;r++){var u=this._runners[this._order[r]],a=u.runner,o=n,h=this._time-u.start;if(h<0)i=!0;else if(h<o&&(o=h),a.active())if(a.step(o).done){if(!0!==u.persist){a.duration()-a.time()+this._time+this._persist<this._time&&(delete this._runners[this._order[r]],this._order.splice(r--,1)&&--s,a.timeline(null))}}else i=!0}return this._nextFrame=i?dt.frame(this._step.bind(this)):null,this}}},{key:"_continue",value:function(){return this._paused||this._nextFrame||(this._nextFrame=dt.frame(this._step.bind(this))),this}},{key:"active",value:function(){return!!this._nextFrame}}]),t}();ut({Element:{timeline:function(){return this._timeline=this._timeline||new De,this._timeline}}});var ze=function(){function s(t){c(this,s),this.id=s.id++,t="function"==typeof(t=null==t?zt:t)?new Te(t):t,this._element=null,this._timeline=null,this.done=!1,this._queue=[],this._duration="number"==typeof t&&t,this._isDeclarative=t instanceof Te,this._stepper=this._isDeclarative?t:new Me,this._history={},this.enabled=!0,this._time=0,this._last=0,this.transforms=new xe,this.transformId=1,this._haveReversed=!1,this._reverse=!1,this._loopsDone=0,this._swing=!1,this._wait=0,this._times=1}return a(s,[{key:"element",value:function(t){return null==t?this._element:((this._element=t)._prepareRunner(),this)}},{key:"timeline",value:function(t){return void 0===t?this._timeline:(this._timeline=t,this)}},{key:"animate",value:function(t,e,n){var i=s.sanitise(t,e,n),r=new s(i.duration);return this._timeline&&r.timeline(this._timeline),this._element&&r.element(this._element),r.loop(i).schedule(e,n)}},{key:"schedule",value:function(t,e,n){if(t instanceof De||(n=e,e=t,t=this.timeline()),!t)throw Error("Runner cannot be scheduled without timeline");return t.schedule(this,e,n),this}},{key:"unschedule",value:function(){var t=this.timeline();return t&&t.unschedule(this),this}},{key:"loop",value:function(t,e,n){return"object"===l(t)&&(e=t.swing,n=t.wait,t=t.times),this._times=t||1/0,this._swing=e||!1,this._wait=n||0,this}},{key:"delay",value:function(t){return this.animate(0,t)}},{key:"queue",value:function(t,e,n){return this._queue.push({initialiser:t||Dt,runner:e||Dt,isTransform:n,initialised:!1,finished:!1}),this.timeline()&&this.timeline()._continue(),this}},{key:"during",value:function(t){return this.queue(null,t)}},{key:"after",value:function(t){return this.on("finish",t)}},{key:"time",value:function(t){if(null==t)return this._time;var e=t-this._time;return this.step(e),this}},{key:"duration",value:function(){return this._times*(this._wait+this._duration)-this._wait}},{key:"loops",value:function(t){var e=this._duration+this._wait;if(null==t){var n=Math.floor(this._time/e),i=(this._time-n*e)/this._duration;return Math.min(n+i,this._times)}var r=t%1,s=e*Math.floor(t)+this._duration*r;return this.time(s)}},{key:"position",value:function(t){var e,n=this._time,r=this._duration,s=this._wait,i=this._times,u=this._swing,a=this._reverse;if(null==t){var o=function(t){var e=u*Math.floor(t%(2*(s+r))/(s+r)),n=e&&!a||!e&&a,i=Math.pow(-1,n)*(t%(s+r))/r+n;return Math.max(Math.min(i,1),0)},h=i*(s+r)-s;return e=n<=0?Math.round(o(1e-5)):n<h?o(n):Math.round(o(h-1e-5)),e}var l=Math.floor(this.loops()),c=u&&l%2==0;return e=l+(c&&!a||a&&c?t:1-t),this.loops(e)}},{key:"progress",value:function(t){return null==t?Math.min(1,this._time/this.duration()):this.time(t*this.duration())}},{key:"step",value:function(t){if(!this.enabled)return this;t=null==t?16:t,this._time+=t;var e=this.position(),n=this._lastPosition!==e&&0<=this._time;this._lastPosition=e;var i=this.duration(),r=(this._lastTime<0&&this._time,this._lastTime<this._time&&this.time>i);this._lastTime=this._time;var s=this._isDeclarative;if(this.done=!s&&!r&&this._time>=i,n||s){this._initialise(n),this.transforms=new xe;var u=this._run(s?t:e)}return this.done=this.done||u&&s,this}},{key:"finish",value:function(){return this.step(1/0)}},{key:"reverse",value:function(t){return this._reverse=null==t?!this._reverse:t,this}},{key:"ease",value:function(t){return this._stepper=new Me(t),this}},{key:"active",value:function(t){return null==t?this.enabled:(this.enabled=t,this)}},{key:"_rememberMorpher",value:function(t,e){this._history[t]={morpher:e,caller:this._queue[this._queue.length-1]}}},{key:"_tryRetarget",value:function(t,e){if(this._history[t]){if(!this._history[t].caller.initialised){var n=this._queue.indexOf(this._history[t].caller);return this._queue.splice(n,1),!1}this._history[t].caller.isTransform?this._history[t].caller.isTransform(e):this._history[t].morpher.to(e),this._history[t].caller.finished=!1;var i=this.timeline();return i&&i._continue(),!0}return!1}},{key:"_initialise",value:function(t){if(t||this._isDeclarative)for(var e=0,n=this._queue.length;e<n;++e){var i=this._queue[e],r=this._isDeclarative||!i.initialised&&t;t=!i.finished,r&&t&&(i.initialiser.call(this),i.initialised=!0)}}},{key:"_run",value:function(t){for(var e=!0,n=0,i=this._queue.length;n<i;++n){var r=this._queue[n],s=r.runner.call(this,t);r.finished=r.finished||!0===s,e=e&&r.finished}return e}},{key:"addTransform",value:function(t,e){return this.transforms.lmultiplyO(t),this}},{key:"clearTransform",value:function(){return this.transforms=new xe,this}}],[{key:"sanitise",value:function(t,e,n){var i=1,r=!1,s=0;return e=e||Rt,n=n||"last","object"!==l(t=t||zt)||t instanceof Ae||(e=t.delay||e,n=t.when||n,r=t.swing||r,i=t.times||i,s=t.wait||s,t=t.duration||zt),{duration:t,delay:e,swing:r,times:i,wait:s,when:n}}}]),s}();ze.id=0;var qe=function t(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new xe,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:-1,i=!(2<arguments.length&&void 0!==arguments[2])||arguments[2];c(this,t),this.transforms=e,this.id=n,this.done=i};G([ze,qe],{mergeWith:function(t){return new qe(t.transforms.lmultiply(this.transforms),t.id)}});var Re=function(t,e){return t.lmultiplyO(e)},Le=function(t){return t.transforms};var Fe=function(){function t(){c(this,t),this.runners=[],this.ids=[]}return a(t,[{key:"add",value:function(t){if(!this.runners.includes(t)){var n=t.id+1,e=this.ids.reduce(function(t,e){return t<e&&e<n?e:t},0),i=this.ids.indexOf(e)+1;return this.ids.splice(i,0,n),this.runners.splice(i,0,t),this}}},{key:"getByID",value:function(t){return this.runners[this.ids.indexOf(t+1)]}},{key:"remove",value:function(t){var e=this.ids.indexOf(t+1);return this.ids.splice(e,1),this.runners.splice(e,1),this}},{key:"merge",value:function(){var n=this,i=null;return this.runners.forEach(function(t,e){i&&t.done&&i.done&&(n.remove(t.id),n.edit(i.id,t.mergeWith(i))),i=t}),this}},{key:"edit",value:function(t,e){var n=this.ids.indexOf(t+1);return this.ids.splice(n,1,t),this.runners.splice(n,1,e),this}},{key:"length",value:function(){return this.ids.length}},{key:"clearBefore",value:function(t){var e=this.ids.indexOf(t+1)||1;return this.ids.splice(0,e,0),this.runners.splice(0,e,new qe),this}}]),t}(),Ie=0;ut({Element:{animate:function(t,e,n){var i=ze.sanitise(t,e,n),r=this.timeline();return new ze(i.duration).loop(i).element(this).timeline(r).schedule(e,n)},delay:function(t,e){return this.animate(0,t,e)},_clearTransformRunnersBefore:function(t){this._transformationRunners.clearBefore(t.id)},_currentTransform:function(e){return this._transformationRunners.runners.filter(function(t){return t.id<=e.id}).map(Le).reduce(Re,new xe)},addRunner:function(t){this._transformationRunners.add(t),dt.transform_frame(function(){var t=this._transformationRunners.runners.map(Le).reduce(Re,new xe);this.transform(t),this._transformationRunners.merge(),1===this._transformationRunners.length()&&(this._frameId=null)}.bind(this),this._frameId)},_prepareRunner:function(){null==this._frameId&&(this._transformationRunners=(new Fe).add(new qe(new xe(this))),this._frameId=Ie++)}}}),G(ze,{attr:function(t,e){return this.styleAttr("attr",t,e)},css:function(t,e){return this.styleAttr("css",t,e)},styleAttr:function(e,n,t){if("object"===l(n))for(var i in t)this.styleAttr(e,i,t[i]);var r=new Ee(this._stepper).to(t);return this.queue(function(){r=r.from(this.element()[e](n))},function(t){return this.element()[e](n,r.at(t)),r.done()}),this},zoom:function(t,e){var n=new Ee(this._stepper).to(new yt(t));return this.queue(function(){n=n.from(this.zoom())},function(t){return this.element().zoom(n.at(t),e),n.done()}),this},transform:function(d,v,y){if(v=d.relative||v,this._isDeclarative&&!v&&this._tryRetarget("transform",d))return this;var p=R(d);y=null!=d.affine?d.affine:null!=y?y:!p;var m,g,w,x,k,b=(new Ee).type(y?Ee.TransformBag:xe).stepper(this._stepper);return this.queue(function(){g=g||this.element(),m=m||L(d,g),k=new xe(v?void 0:g),g.addRunner(this),v||g._clearTransformRunnersBefore(this)},function(t){v||this.clearTransform();var e=new ee(m).transform(g._currentTransform(this)),n=e.x,i=e.y,r=new xe(_({},d,{origin:[n,i]})),s=this._isDeclarative&&w?w:k;if(y){r=r.decompose(n,i),s=s.decompose(n,i);var u=r.rotate,a=s.rotate,o=[u-360,u,u+360],h=o.map(function(t){return Math.abs(t-a)}),l=Math.min.apply(Math,O(h)),c=h.indexOf(l);r.rotate=o[c]}v&&(p||(r.rotate=d.rotate||0),this._isDeclarative&&x&&(s.rotate=x)),b.from(s),b.to(r);var f=b.at(t);return x=f.rotate,w=new xe(f),this.addTransform(w),b.done()},function(t){(t.origin||"center").toString()!==(d.origin||"center").toString()&&(m=L(d,g)),d=_({},t,{origin:m})}),this._isDeclarative&&this._rememberMorpher("transform",b),this},x:function(t,e){return this._queueNumber("x",t)},y:function(t){return this._queueNumber("y",t)},dx:function(t){return this._queueNumberDelta("dx",t)},dy:function(t){return this._queueNumberDelta("dy",t)},_queueNumberDelta:function(e,n){if(n=new yt(n),this._tryRetargetDelta(e,n))return this;var i=new Ee(this._stepper).to(n);return this.queue(function(){var t=this.element()[e]();i.from(t),i.to(t+n)},function(t){return this.element()[e](i.at(t)),i.done()}),this._rememberMorpher(e,i),this},_queueObject:function(e,t){if(this._tryRetarget(e,t))return this;var n=new Ee(this._stepper).to(t);return this.queue(function(){n.from(this.element()[e]())},function(t){return this.element()[e](n.at(t)),n.done()}),this._rememberMorpher(e,n),this},_queueNumber:function(t,e){return this._queueObject(t,new yt(e))},cx:function(t){return this._queueNumber("cx",t)},cy:function(t){return this._queueNumber("cy",t)},move:function(t,e){return this.x(t).y(e)},center:function(t,e){return this.cx(t).cy(e)},size:function(t,e){var n;return t&&e||(n=this._element.bbox()),t||(t=n.width/n.height*e),e||(e=n.height/n.width*t),this.width(t).height(e)},width:function(t){return this._queueNumber("width",t)},height:function(t){return this._queueNumber("height",t)},plot:function(t,e,n,i){return 4===arguments.length?this.plot([t,e,n,i]):this._queueObject("plot",new this._element.MorphArray(t))},leading:function(t){return this._queueNumber("leading",t)},viewbox:function(t,e,n,i){return this._queueObject("viewbox",new Box(t,e,n,i))},update:function(t){return"object"!==l(t)?this.update({offset:t,color:arguments[1],opacity:arguments[2]}):(null!=t.opacity&&this.attr("stop-opacity",t.opacity),null!=t.color&&this.attr("stop-color",t.color),null!=t.offset&&this.attr("offset",t.offset),this)}});var Be=Object.freeze({HtmlNode:nt,Doc:lt,Defs:it,G:ct,Animator:dt,Bare:vt,Circle:Ot,ClipPath:jt,A:St,Ellipse:Et,Stop:Nt,Gradient:Yt,Image:$t,Line:Zt,Marker:Jt,Mask:Kt,Path:ae,Pattern:Gt,Polygon:ce,Polyline:fe,Rect:de,Symbol:ve,Text:pe,TextPath:me,Tspan:ge,Use:we,SVGNumber:yt,SVGArray:Bt,PathArray:ue,PointArray:Wt,Matrix:xe,Point:ee,Box:ke,Color:Ft,Morphable:Ee,Queue:ft,Runner:ze,Timeline:De,Controller:Te,Ease:Me,PID:Se,Spring:je}),Xe=Object.freeze({Bare:vt,ClipPath:jt,Defs:it,Doc:lt,Gradient:Yt,G:ct,A:St,Marker:Jt,Mask:Kt,Pattern:Gt,Symbol:ve}),Ye=Object.freeze({Bare:vt,Circle:Ot,ClipPath:jt,Defs:it,Doc:lt,Ellipse:Et,Gradient:Yt,G:ct,HtmlNode:nt,A:St,Image:$t,Line:Zt,Marker:Jt,Mask:Kt,Path:ae,Pattern:Gt,Polygon:ce,Polyline:fe,Rect:de,Stop:Nt,Symbol:ve,Text:pe,TextPath:me,Use:we});ut("Element",{css:function(t,e){var n={};if(0===arguments.length)return this.node.style.cssText.split(/\s*;\s*/).filter(function(t){return!!t.length}).forEach(function(t){var e=t.split(/\s*:\s*/);n[e[0]]=e[1]}),n;if(arguments.length<2){if(Array.isArray(t)){var i=!0,r=!1,s=void 0;try{for(var u,a=t[Symbol.iterator]();!(i=(u=a.next()).done);i=!0){var o=E(u.value);n[o]=this.node.style(o)}}catch(t){r=!0,s=t}finally{try{i||null==a.return||a.return()}finally{if(r)throw s}}return n}if("string"==typeof t)return this.node.style[E(t)];if("object"===l(t))for(name in t)this.node.style[E(name)]=null==t[name]||w.test(t[name])?"":t[name]}return 2===arguments.length&&(this.node.style[E(t)]=null==e||w.test(e)?"":e),this},show:function(){return this.css("display","")},hide:function(){return this.css("display","none")},visible:function(){return"none"!==this.css("display")}}),ut("Element",{untransform:function(){return this.attr("transform",null)},matrixify:function(){return(this.attr("transform")||"").split(t).slice(0,-1).map(function(t){var e=t.trim().split("(");return[e[0],e[1].split(b).map(function(t){return parseFloat(t)})]}).reverse().reduce(function(t,e){return"matrix"===e[0]?t.lmultiply(D(e[1])):t[e[0]].apply(t,e[1])},new xe)},toParent:function(t){if(this===t)return this;var e=this.screenCTM(),n=t.screenCTM().inverse();return this.addTo(t).untransform().transform(n.multiply(e)),this},toDoc:function(){return this.toParent(this.doc())},transform:function(t,e){if(null==t||"string"==typeof t){var n=new xe(this).decompose();return n[t]||n}R(t)||(t=_({},t,{origin:L(t,this)}));var i=new xe(!0===e?this:e||!1).transform(t);return this.attr("transform",i)}}),ut("Element",{remember:function(t,e){if("object"===l(t))for(var n in t)this.remember(n,t[n]);else{if(1===arguments.length)return this.memory()[t];this.memory()[t]=e}return this},forget:function(){if(0===arguments.length)this._memory={};else for(var t=arguments.length-1;0<=t;t--)delete this.memory()[arguments[t]];return this},memory:function(){return this._memory}}),ot("Memory",function(t){this._memory={}});var Ge={stroke:["color","width","opacity","linecap","linejoin","miterlimit","dasharray","dashoffset"],fill:["color","opacity","rule"],prefix:function(t,e){return"color"===e?t:t+"-"+e}};function He(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};this.events=t.events||{}}["fill","stroke"].forEach(function(e){var n,t={};t[e]=function(t){if(void 0===t)return this;if("string"==typeof t||Ft.isRgb(t)||t&&"function"==typeof t.fill)this.attr(e,t);else for(n=Ge[e].length-1;0<=n;n--)null!=t[Ge[e][n]]&&this.attr(Ge.prefix(e,Ge[e][n]),t[Ge[e][n]]);return this},ut(["Element","Runner"],t)}),ut(["Element","Runner"],{matrix:function(t,e,n,i,r,s){return null==t?new Matrix(this):this.attr("transform",new Matrix(t,e,n,i,r,s))},rotate:function(t,e,n){return this.transform({rotate:t,ox:e,oy:n},!0)},skew:function(t,e,n,i){return 1===arguments.length||3===arguments.length?this.transform({skew:t,ox:e,oy:n},!0):this.transform({skew:[t,e],ox:n,oy:i},!0)},shear:function(t,e,n){return this.transform({shear:t,ox:e,oy:n},!0)},scale:function(t,e,n,i){return 1===arguments.length||3===arguments.length?this.transform({scale:t,ox:e,oy:n},!0):this.transform({scale:[t,e],ox:n,oy:i},!0)},translate:function(t,e){return this.transform({translate:[t,e]},!0)},relative:function(t,e){return this.transform({relative:[t,e]},!0)},flip:function(t,e){var n="string"==typeof t?t:(isFinite(t),"both"),i="both"===t&&isFinite(e)?[e,e]:"x"===t?[e,0]:"y"===t?[0,e]:isFinite(t)?[t,t]:[0,0];this.transform({flip:n,origin:i},!0)},opacity:function(t){return this.attr("opacity",t)},dx:function(t){return this.x(new SVGNumber(t).plus(this instanceof Runner?0:this.x()),!0)},dy:function(t){return this.y(new SVGNumber(t).plus(this instanceof Runner?0:this.y()),!0)},dmove:function(t,e){return this.dx(t).dy(e)}}),ut("radius",{radius:function(t,e){var n=(this._target||this).type;return"radialGradient"===n||"radialGradient"===n?this.attr("r",new SVGNumber(t)):this.rx(t).ry(null==e?t:e)}}),ut("Path",{length:function(){return this.node.getTotalLength()},pointAt:function(t){return new Point(this.node.getPointAtLength(t))}}),ut(["Container","Runner"],{font:function(t,e){if("object"===l(t))for(e in t)this.font(e,t[e]);return"leading"===t?this.leading(e):"anchor"===t?this.attr("text-anchor",e):"size"===t||"family"===t||"weight"===t||"stretch"===t||"variant"===t||"style"===t?this.attr("font-"+t,e):this.attr(t,e)}}),ut("EventTarget",{setup:He,on:function(t,e,n,i){return Ut(this,t,e,n,i),this},off:function(t,e){return Qt(this,t,e),this},dispatch:function(t,e){return n=t,i=e,r=Vt(this),n instanceof window.Event||(n=new window.CustomEvent(n,{detail:i,cancelable:!0})),r.dispatchEvent(n),n;var n,i,r},fire:function(t,e){return this.dispatch(t,e),this}}),ot("EventTarget",He),ut("Container",{children:function(){return function(t,e){var n,i=t.length,r=[];for(n=0;n<i;n++)r.push(e(t[n]));return r}(this.node.children,function(t){return $(t)})},add:function(t,e){return t=Q(t),null==e?this.node.appendChild(t.node):t.node!==this.node.childNodes[e]&&this.node.insertBefore(t.node,this.node.childNodes[e]),this},put:function(t,e){return this.add(t,e),t.instance||t},has:function(t){return 0<=this.index(t)},index:function(t){return[].slice.call(this.node.children).indexOf(t.node)},get:function(t){return $(this.node.children[t])},first:function(){return this.get(0)},last:function(){return this.get(this.node.children.length-1)},each:function(t,e){var n,i,r=this.children();for(n=0,i=r.length;n<i;n++)r[n]instanceof Base&&t.apply(r[n],[n,r]),e&&r[n]instanceof Base&&r[n].is("Parent")&&r[n].each(t,e);return this},removeElement:function(t){return this.node.removeChild(t.node),this},clear:function(){for(;this.node.hasChildNodes();)this.node.removeChild(this.node.lastChild);return delete this._defs,this},svg:function(t){var e,n;if(!t)return this.writeDataToDom(),this.node.outerHTML;for((e=document.createElementNS(ns,"svg")).innerHTML=t,n=e.children.length;n--;)this.node.appendChild(e.firstElementChild);return this},writeDataToDom:function(){return this.each(function(){this.writeDataToDom()}),this.node.removeAttribute("svgjs:data"),Object.keys(this.dom).length&&this.node.setAttribute("svgjs:data",JSON.stringify(this.dom)),this},flatten:function(t){return this.each(function(){return this.is("Parent")?this.flatten(t).ungroup(t):this.toParent(t)}),this.node.firstElementChild||this.remove(),this},ungroup:function(t){return t=t||this.parent(),this.each(function(){return this.toParent(t)}),this.remove(),this}});var Ve=G;Ve([lt,ve,$t,Gt,Jt],at("viewbox")),Ve([Zt,fe,ce,ae],at("marker")),Ve(pe,at("Text")),Ve(ae,at("Path")),Ve(it,at("Defs")),Ve([pe,ge],at("Tspan")),Ve([de,Et,Ot,Yt],at("radius"));var Ue=at("Container");for(var Qe in Xe)Ve(Xe[Qe],Ue);var $e=at("Element");for(var We in Ye)Ve(Ye[We],$e),Ve(Ye[We],ht("EventTarget")),Ve(Ye[We],ht("Element")),Ve(Ye[We],ht("Memory"));function Ze(t){return Q(t)}return Object.assign(Ze,Be),Object.assign(Ze,H),Object.assign(Ze,et),Ze}();
index 71b158b104ad827e24039c57e9fac628f1fdc5ce..d852ced39d79ca0652645be583793cc3a3aaf112 100644 (file)
@@ -272,7 +272,7 @@ export function getEventTarget () {
 
 registerMethods('Element', {
   x, y, cx, cy, move, center, width, height, size, clone, remove, replace,
-  putIn, id, inside, toString, classes, hasClass, addClass, removeClass,
+  addTo, putIn, id, inside, toString, classes, hasClass, addClass, removeClass,
   toggleClass, reference, doc, defs, parents, matches, native, svg,
   writeDataToDom, setData, getEventTarget
 })
index 1a1136f7f119d0e91bee9d72144e0f88499d5930..ee8e3b0f78d99a44dd5cd13848effe2430949981 100644 (file)
@@ -13,8 +13,10 @@ export function children () {
 export function add (element, i) {
   element = makeInstance(element)
 
-  if (element.node !== this.node.children[i]) {
-    this.node.insertBefore(element.node, this.node.children[i] || null)
+  if (i == null) {
+    this.node.appendChild(element.node)
+  } else if (element.node !== this.node.childNodes[i]) {
+    this.node.insertBefore(element.node, this.node.childNodes[i])
   }
 
   return this
@@ -33,22 +35,22 @@ export function has (element) {
 
 // Gets index of given element
 export function index (element) {
-  return [].slice.call(this.node.children).indexOf(element.node)
+  return [].slice.call(this.node.childNodes).indexOf(element.node)
 }
 
 // Get a element at the given index
 export function get (i) {
-  return adopt(this.node.children[i])
+  return adopt(this.node.childNodes[i])
 }
 
 // Get first child
 export function first () {
-  return this.get(0)
+  return adopt(this.node.firstChild)
 }
 
 // Get the last child
 export function last () {
-  return this.get(this.node.children.length - 1)
+  return adopt(this.node.lastChild)
 }
 
 // Iterates over all children and invokes a given block
index 082ccd5c1cb30a149b850ba18149657ba03371d1..39fb22b213c4450e7f8a56aec400e8e27989f018 100644 (file)
@@ -1,34 +1,67 @@
     // Import raw svg
-    svg: function (svg) {
+    svg: function (svg, fn = false) {
       var well, len
 
       // act as getter if no svg string is given
-      if(svg == null || svg === true) {
+      if(svg == null || svg === true || typeof svg == 'function') {
         // write svgjs data to the dom
         this.writeDataToDom()
+        let current = this
 
-        // return outer or inner content
+        // An export modifier was passed
+        if (typeof svg == 'function') {
+          // Juggle arguments
+          [fn, svg] = [svg, fn]
+
+          // If the user wants outerHTML we need to process this node, too
+          if (!svg) {
+            current = fn(current)
+
+            // The user does not want this node? Well, then he gets nothing
+            if (current === false) return ''
+          }
+
+          // Deep loop through all children and apply modifier
+          current.each(function () {
+            let result = fn(this)
+
+            // If modifier returns false, discard node
+            if (result === false) {
+              this.remove()
+
+            // If modifier returns new node, use it
+            } else if (result !== this) {
+              this.replace(result)
+            }
+          }, true)
+        }
+
+        // Return outer or inner content
         return svg
-          ? this.node.innerHTML
-          : this.node.outerHTML
+          ? current.node.innerHTML
+          : current.node.outerHTML
       }
 
-      // act as setter if we got a string
+      // Act as setter if we got a string
 
-      // make sure we are on a parent when trying to import
-      if(!(this instanceof SVG.Parent))
-        throw Error('Cannot import svg into non-parent element')
+      // Make sure we are on a current when trying to import
+      if(!(this instanceof SVG.current))
+        throw Error('Cannot import svg into non-current element')
 
-      // create temporary holder
+      // Create temporary holder
       well = document.createElementNS(SVG.ns, 'svg')
+      fragment = document.createDocumentFragment()
 
-      // dump raw svg
+      // Dump raw svg
       well.innerHTML = svg
 
-      // transplant nodes
+      // Transplant nodes into the fragment
       for (len = well.children.length; len--;) {
-        this.node.appendChild(well.firstElementChild)
+        fragment.appendChild(well.firstElementChild)
       }
 
+      // Add the whole fragment at once
+      this.node.appendChild(fragment)
+
       return this
-    },
\ No newline at end of file
+    },
index 4a51faa0e2f41c02fcbb0b8235ac89fdd9fe46a0..4eb92b9503b735318cfc319c3d77b7ff125aeac6 100644 (file)
@@ -2,17 +2,25 @@ const methods = {}
 const constructors = {}
 
 export function registerMethods (name, m) {
+  if (Array.isArray(name)) {
+    for (let _name of name) {
+      registerMethods(_name, m)
+    }
+    return
+  }
+
   if (typeof name == 'object') {
     for (let [_name, _m] of Object.entries(name)) {
       registerMethods(_name, _m)
     }
+    return
   }
 
   methods[name] = Object.assign(methods[name] || {}, m)
 }
 
 export function getMethodsFor (name) {
-  return methods[name]
+  return methods[name] || {}
 }
 
 // FIXME: save memory?
@@ -26,5 +34,5 @@ export function registerConstructor (name, setup) {
 }
 
 export function getConstructor (name) {
-  return {setup: constructors[name], name}
+  return constructors[name] ? {setup: constructors[name], name} : {}
 }
index e33fb10d1b4435371e571c7c92d7adc39d282cec..75f0e005e8aa02879b0a45f41793cd1655ddb733 100644 (file)
@@ -1,4 +1,5 @@
-import {Color, Element, Runner} from './classes.js'
+import Color from './Color.js'
+import {registerMethods} from './methods.js'
 
 // Define list of available attributes for stroke and fill
 var sugar = {
@@ -32,10 +33,10 @@ var sugar = {
     return this
   }
 
-  extend([Element, Runner], extension)
+  registerMethods(['Element', 'Runner'], extension)
 })
 
-extend([Element, Runner], {
+registerMethods(['Element', 'Runner'], {
   // Let the user set the matrix directly
   matrix: function (mat, b, c, d, e, f) {
     // Act as a getter
@@ -114,7 +115,7 @@ extend([Element, Runner], {
   }
 })
 
-extend([Rect, Ellipse, Circle, Gradient, Runner], {
+registerMethods('radius', {
   // Add x and y radius
   radius: function (x, y) {
     var type = (this._target || this).type
@@ -124,7 +125,7 @@ extend([Rect, Ellipse, Circle, Gradient, Runner], {
   }
 })
 
-extend(Path, {
+registerMethods('Path', {
   // Get path length
   length: function () {
     return this.node.getTotalLength()
@@ -135,7 +136,7 @@ extend(Path, {
   }
 })
 
-extend([Parent, Text, Tspan, Runner], {
+registerMethods(['Container', 'Runner'], {
   // Set font
   font: function (a, v) {
     if (typeof a === 'object') {
index a58c127175e301ec6a02b467e932670bdf063a69..bc5dd3bc731a5af3a5f899b2e9e1e192cf150b6b 100644 (file)
@@ -16,6 +16,7 @@ import './selector.js'
 import './css.js'
 import './transform.js'
 import './memory.js'
+import './sugar.js'
 import {getMethodsFor, getConstructor} from './methods.js'
 const extend = tools.extend
 
@@ -48,6 +49,13 @@ extend([
   Classes.Tspan
 ], getMethodsFor('Tspan'))
 
+extend([
+  Classes.Rect,
+  Classes.Ellipse,
+  Classes.Circle,
+  Classes.Gradient
+], getMethodsFor('radius'))
+
 const containerMethods = getMethodsFor('Container')
 // FIXME: We need a container array
 for (let i in containers) {