diff --git a/dist/index-es.js b/dist/index-es.js
index 6e5407c7..14ec7a82 100644
--- a/dist/index-es.js
+++ b/dist/index-es.js
@@ -2609,7 +2609,7 @@ function importScript(url) {
destructor();
};
script.onload = function () {
- resolve(window[vector]);
+ resolve();
destructor();
};
script.src = url;
@@ -7540,11 +7540,11 @@ var executeAfterLoads = function executeAfterLoads(name, scripts, cb) {
return importer(script);
});
}, Promise.resolve()).then(function () {
- loadedScripts[name] = true;
endCallback();
loadedScripts[name].forEach(function (cb) {
cb();
});
+ loadedScripts[name] = true;
})();
}
};
@@ -8237,7 +8237,6 @@ function build(opts) {
// transforms
svg.Transform = function (v) {
- var that = this;
this.Type = {};
// translate
@@ -8307,10 +8306,8 @@ function build(opts) {
function _class2(s) {
classCallCheck(this, _class2);
- var _this2 = possibleConstructorReturn(this, (_class2.__proto__ || Object.getPrototypeOf(_class2)).call(this));
+ var _this2 = possibleConstructorReturn(this, (_class2.__proto__ || Object.getPrototypeOf(_class2)).call(this, s));
- _this2.base = that.Type.matrix;
- _this2.base(s);
_this2.angle = new svg.Property('angle', s);
return _this2;
}
@@ -8324,10 +8321,8 @@ function build(opts) {
function _class3(s) {
classCallCheck(this, _class3);
- var _this3 = possibleConstructorReturn(this, (_class3.__proto__ || Object.getPrototypeOf(_class3)).call(this));
+ var _this3 = possibleConstructorReturn(this, (_class3.__proto__ || Object.getPrototypeOf(_class3)).call(this, s));
- _this3.base = that.Type.SkewBase;
- _this3.base(s);
_this3.m = [1, 0, Math.tan(_this3.angle.toRadians()), 1, 0, 0];
return _this3;
}
@@ -8341,10 +8336,8 @@ function build(opts) {
function _class4(s) {
classCallCheck(this, _class4);
- var _this4 = possibleConstructorReturn(this, (_class4.__proto__ || Object.getPrototypeOf(_class4)).call(this));
+ var _this4 = possibleConstructorReturn(this, (_class4.__proto__ || Object.getPrototypeOf(_class4)).call(this, s));
- _this4.base = that.Type.SkewBase;
- _this4.base(s);
_this4.m = [1, Math.tan(_this4.angle.toRadians()), 0, 1, 0, 0];
return _this4;
}
@@ -8612,10 +8605,7 @@ function build(opts) {
function _class5(node) {
classCallCheck(this, _class5);
- var _this5 = possibleConstructorReturn(this, (_class5.__proto__ || Object.getPrototypeOf(_class5)).call(this));
-
- _this5.base = svg.Element.ElementBase;
- _this5.base(node);
+ var _this5 = possibleConstructorReturn(this, (_class5.__proto__ || Object.getPrototypeOf(_class5)).call(this, node));
_this5.setContext = function (ctx) {
// fill
@@ -8708,10 +8698,7 @@ function build(opts) {
function _class6(node) {
classCallCheck(this, _class6);
- var _this6 = possibleConstructorReturn(this, (_class6.__proto__ || Object.getPrototypeOf(_class6)).call(this));
-
- _this6.base = svg.Element.RenderedElementBase;
- _this6.base(node);
+ var _this6 = possibleConstructorReturn(this, (_class6.__proto__ || Object.getPrototypeOf(_class6)).call(this, node));
_this6.path = function (ctx) {
if (ctx != null) ctx.beginPath();
@@ -8769,10 +8756,7 @@ function build(opts) {
function _class7(node) {
classCallCheck(this, _class7);
- var _this7 = possibleConstructorReturn(this, (_class7.__proto__ || Object.getPrototypeOf(_class7)).call(this));
-
- _this7.base = svg.Element.RenderedElementBase;
- _this7.base(node);
+ var _this7 = possibleConstructorReturn(this, (_class7.__proto__ || Object.getPrototypeOf(_class7)).call(this, node));
_this7.baseClearContext = _this7.clearContext;
_this7.clearContext = function (ctx) {
@@ -8853,10 +8837,7 @@ function build(opts) {
function _class8(node) {
classCallCheck(this, _class8);
- var _this8 = possibleConstructorReturn(this, (_class8.__proto__ || Object.getPrototypeOf(_class8)).call(this));
-
- _this8.base = svg.Element.PathElementBase;
- _this8.base(node);
+ var _this8 = possibleConstructorReturn(this, (_class8.__proto__ || Object.getPrototypeOf(_class8)).call(this, node));
_this8.path = function (ctx) {
var x = this.attribute('x').toPixels('x');
@@ -8898,10 +8879,7 @@ function build(opts) {
function _class9(node) {
classCallCheck(this, _class9);
- var _this9 = possibleConstructorReturn(this, (_class9.__proto__ || Object.getPrototypeOf(_class9)).call(this));
-
- _this9.base = svg.Element.PathElementBase;
- _this9.base(node);
+ var _this9 = possibleConstructorReturn(this, (_class9.__proto__ || Object.getPrototypeOf(_class9)).call(this, node));
_this9.path = function (ctx) {
var cx = this.attribute('cx').toPixels('x');
@@ -8929,10 +8907,7 @@ function build(opts) {
function _class10(node) {
classCallCheck(this, _class10);
- var _this10 = possibleConstructorReturn(this, (_class10.__proto__ || Object.getPrototypeOf(_class10)).call(this));
-
- _this10.base = svg.Element.PathElementBase;
- _this10.base(node);
+ var _this10 = possibleConstructorReturn(this, (_class10.__proto__ || Object.getPrototypeOf(_class10)).call(this, node));
_this10.path = function (ctx) {
var KAPPA = 4 * ((Math.sqrt(2) - 1) / 3);
@@ -8966,10 +8941,7 @@ function build(opts) {
function _class11(node) {
classCallCheck(this, _class11);
- var _this11 = possibleConstructorReturn(this, (_class11.__proto__ || Object.getPrototypeOf(_class11)).call(this));
-
- _this11.base = svg.Element.PathElementBase;
- _this11.base(node);
+ var _this11 = possibleConstructorReturn(this, (_class11.__proto__ || Object.getPrototypeOf(_class11)).call(this, node));
_this11.getPoints = function () {
return [new svg.Point(this.attribute('x1').toPixels('x'), this.attribute('y1').toPixels('y')), new svg.Point(this.attribute('x2').toPixels('x'), this.attribute('y2').toPixels('y'))];
@@ -9005,10 +8977,7 @@ function build(opts) {
function _class12(node) {
classCallCheck(this, _class12);
- var _this12 = possibleConstructorReturn(this, (_class12.__proto__ || Object.getPrototypeOf(_class12)).call(this));
-
- _this12.base = svg.Element.PathElementBase;
- _this12.base(node);
+ var _this12 = possibleConstructorReturn(this, (_class12.__proto__ || Object.getPrototypeOf(_class12)).call(this, node));
_this12.points = svg.CreatePath(_this12.attribute('points').value);
_this12.path = function (ctx) {
@@ -9045,10 +9014,7 @@ function build(opts) {
function _class13(node) {
classCallCheck(this, _class13);
- var _this13 = possibleConstructorReturn(this, (_class13.__proto__ || Object.getPrototypeOf(_class13)).call(this));
-
- _this13.base = svg.Element.polyline;
- _this13.base(node);
+ var _this13 = possibleConstructorReturn(this, (_class13.__proto__ || Object.getPrototypeOf(_class13)).call(this, node));
_this13.basePath = _this13.path;
_this13.path = function (ctx) {
@@ -9072,10 +9038,7 @@ function build(opts) {
function _class14(node) {
classCallCheck(this, _class14);
- var _this14 = possibleConstructorReturn(this, (_class14.__proto__ || Object.getPrototypeOf(_class14)).call(this));
-
- _this14.base = svg.Element.PathElementBase;
- _this14.base(node);
+ var _this14 = possibleConstructorReturn(this, (_class14.__proto__ || Object.getPrototypeOf(_class14)).call(this, node));
var d = _this14.attribute('d').value;
// TODO: convert to real lexer based on https://www.w3.org/TR/SVG11/paths.html#PathDataBNF
@@ -9418,10 +9381,7 @@ function build(opts) {
function _class15(node) {
classCallCheck(this, _class15);
- var _this15 = possibleConstructorReturn(this, (_class15.__proto__ || Object.getPrototypeOf(_class15)).call(this));
-
- _this15.base = svg.Element.ElementBase;
- _this15.base(node);
+ var _this15 = possibleConstructorReturn(this, (_class15.__proto__ || Object.getPrototypeOf(_class15)).call(this, node));
_this15.createPattern = function (ctx, element) {
var width = this.attribute('width').toPixels('x', true);
@@ -9467,10 +9427,7 @@ function build(opts) {
function _class16(node) {
classCallCheck(this, _class16);
- var _this16 = possibleConstructorReturn(this, (_class16.__proto__ || Object.getPrototypeOf(_class16)).call(this));
-
- _this16.base = svg.Element.ElementBase;
- _this16.base(node);
+ var _this16 = possibleConstructorReturn(this, (_class16.__proto__ || Object.getPrototypeOf(_class16)).call(this, node));
_this16.baseRender = _this16.render;
_this16.render = function (ctx, point, angle) {
@@ -9509,10 +9466,7 @@ function build(opts) {
function _class17(node) {
classCallCheck(this, _class17);
- var _this17 = possibleConstructorReturn(this, (_class17.__proto__ || Object.getPrototypeOf(_class17)).call(this));
-
- _this17.base = svg.Element.ElementBase;
- _this17.base(node);
+ var _this17 = possibleConstructorReturn(this, (_class17.__proto__ || Object.getPrototypeOf(_class17)).call(this, node));
_this17.render = function (ctx) {
// NOOP
@@ -9530,10 +9484,7 @@ function build(opts) {
function _class18(node) {
classCallCheck(this, _class18);
- var _this18 = possibleConstructorReturn(this, (_class18.__proto__ || Object.getPrototypeOf(_class18)).call(this));
-
- _this18.base = svg.Element.ElementBase;
- _this18.base(node);
+ var _this18 = possibleConstructorReturn(this, (_class18.__proto__ || Object.getPrototypeOf(_class18)).call(this, node));
_this18.gradientUnits = _this18.attribute('gradientUnits').valueOrDefault('objectBoundingBox');
@@ -9609,10 +9560,7 @@ function build(opts) {
function _class19(node) {
classCallCheck(this, _class19);
- var _this19 = possibleConstructorReturn(this, (_class19.__proto__ || Object.getPrototypeOf(_class19)).call(this));
-
- _this19.base = svg.Element.GradientBase;
- _this19.base(node);
+ var _this19 = possibleConstructorReturn(this, (_class19.__proto__ || Object.getPrototypeOf(_class19)).call(this, node));
_this19.getGradient = function (ctx, element) {
var bb = this.gradientUnits === 'objectBoundingBox' ? element.getBoundingBox() : null;
@@ -9645,10 +9593,7 @@ function build(opts) {
function _class20(node) {
classCallCheck(this, _class20);
- var _this20 = possibleConstructorReturn(this, (_class20.__proto__ || Object.getPrototypeOf(_class20)).call(this));
-
- _this20.base = svg.Element.GradientBase;
- _this20.base(node);
+ var _this20 = possibleConstructorReturn(this, (_class20.__proto__ || Object.getPrototypeOf(_class20)).call(this, node));
_this20.getGradient = function (ctx, element) {
var bb = element.getBoundingBox();
@@ -9686,10 +9631,7 @@ function build(opts) {
function _class21(node) {
classCallCheck(this, _class21);
- var _this21 = possibleConstructorReturn(this, (_class21.__proto__ || Object.getPrototypeOf(_class21)).call(this));
-
- _this21.base = svg.Element.ElementBase;
- _this21.base(node);
+ var _this21 = possibleConstructorReturn(this, (_class21.__proto__ || Object.getPrototypeOf(_class21)).call(this, node));
_this21.offset = _this21.attribute('offset').numValue();
if (_this21.offset < 0) _this21.offset = 0;
@@ -9713,10 +9655,7 @@ function build(opts) {
function _class22(node) {
classCallCheck(this, _class22);
- var _this22 = possibleConstructorReturn(this, (_class22.__proto__ || Object.getPrototypeOf(_class22)).call(this));
-
- _this22.base = svg.Element.ElementBase;
- _this22.base(node);
+ var _this22 = possibleConstructorReturn(this, (_class22.__proto__ || Object.getPrototypeOf(_class22)).call(this, node));
svg.Animations.push(_this22);
@@ -9820,10 +9759,7 @@ function build(opts) {
function _class23(node) {
classCallCheck(this, _class23);
- var _this23 = possibleConstructorReturn(this, (_class23.__proto__ || Object.getPrototypeOf(_class23)).call(this));
-
- _this23.base = svg.Element.AnimateBase;
- _this23.base(node);
+ var _this23 = possibleConstructorReturn(this, (_class23.__proto__ || Object.getPrototypeOf(_class23)).call(this, node));
_this23.calcValue = function () {
var p = this.progress();
@@ -9845,10 +9781,7 @@ function build(opts) {
function _class24(node) {
classCallCheck(this, _class24);
- var _this24 = possibleConstructorReturn(this, (_class24.__proto__ || Object.getPrototypeOf(_class24)).call(this));
-
- _this24.base = svg.Element.AnimateBase;
- _this24.base(node);
+ var _this24 = possibleConstructorReturn(this, (_class24.__proto__ || Object.getPrototypeOf(_class24)).call(this, node));
_this24.calcValue = function () {
var p = this.progress();
@@ -9877,10 +9810,7 @@ function build(opts) {
function _class25(node) {
classCallCheck(this, _class25);
- var _this25 = possibleConstructorReturn(this, (_class25.__proto__ || Object.getPrototypeOf(_class25)).call(this));
-
- _this25.base = svg.Element.AnimateBase;
- _this25.base(node);
+ var _this25 = possibleConstructorReturn(this, (_class25.__proto__ || Object.getPrototypeOf(_class25)).call(this, node));
_this25.calcValue = function () {
var p = this.progress();
@@ -9907,10 +9837,7 @@ function build(opts) {
function _class26(node) {
classCallCheck(this, _class26);
- var _this26 = possibleConstructorReturn(this, (_class26.__proto__ || Object.getPrototypeOf(_class26)).call(this));
-
- _this26.base = svg.Element.ElementBase;
- _this26.base(node);
+ var _this26 = possibleConstructorReturn(this, (_class26.__proto__ || Object.getPrototypeOf(_class26)).call(this, node));
_this26.horizAdvX = _this26.attribute('horiz-adv-x').numValue();
@@ -9954,10 +9881,7 @@ function build(opts) {
function _class27(node) {
classCallCheck(this, _class27);
- var _this27 = possibleConstructorReturn(this, (_class27.__proto__ || Object.getPrototypeOf(_class27)).call(this));
-
- _this27.base = svg.Element.ElementBase;
- _this27.base(node);
+ var _this27 = possibleConstructorReturn(this, (_class27.__proto__ || Object.getPrototypeOf(_class27)).call(this, node));
_this27.ascent = _this27.attribute('ascent').value;
_this27.descent = _this27.attribute('descent').value;
@@ -9975,10 +9899,7 @@ function build(opts) {
function _class28(node) {
classCallCheck(this, _class28);
- var _this28 = possibleConstructorReturn(this, (_class28.__proto__ || Object.getPrototypeOf(_class28)).call(this));
-
- _this28.base = svg.Element.path;
- _this28.base(node);
+ var _this28 = possibleConstructorReturn(this, (_class28.__proto__ || Object.getPrototypeOf(_class28)).call(this, node));
_this28.horizAdvX = 0;
return _this28;
@@ -9994,10 +9915,7 @@ function build(opts) {
function _class29(node) {
classCallCheck(this, _class29);
- var _this29 = possibleConstructorReturn(this, (_class29.__proto__ || Object.getPrototypeOf(_class29)).call(this));
-
- _this29.base = svg.Element.path;
- _this29.base(node);
+ var _this29 = possibleConstructorReturn(this, (_class29.__proto__ || Object.getPrototypeOf(_class29)).call(this, node));
_this29.horizAdvX = _this29.attribute('horiz-adv-x').numValue();
_this29.unicode = _this29.attribute('unicode').value;
@@ -10015,11 +9933,9 @@ function build(opts) {
function _class30(node) {
classCallCheck(this, _class30);
- var _this30 = possibleConstructorReturn(this, (_class30.__proto__ || Object.getPrototypeOf(_class30)).call(this));
+ var _this30 = possibleConstructorReturn(this, (_class30.__proto__ || Object.getPrototypeOf(_class30)).call(this, node));
_this30.captureTextNodes = true;
- _this30.base = svg.Element.RenderedElementBase;
- _this30.base(node);
_this30.baseSetContext = _this30.setContext;
_this30.setContext = function (ctx) {
@@ -10101,10 +10017,7 @@ function build(opts) {
function _class31(node) {
classCallCheck(this, _class31);
- var _this31 = possibleConstructorReturn(this, (_class31.__proto__ || Object.getPrototypeOf(_class31)).call(this));
-
- _this31.base = svg.Element.RenderedElementBase;
- _this31.base(node);
+ var _this31 = possibleConstructorReturn(this, (_class31.__proto__ || Object.getPrototypeOf(_class31)).call(this, node));
_this31.getGlyph = function (font, text, i) {
var c = text[i];
@@ -10215,11 +10128,9 @@ function build(opts) {
function _class32(node) {
classCallCheck(this, _class32);
- var _this32 = possibleConstructorReturn(this, (_class32.__proto__ || Object.getPrototypeOf(_class32)).call(this));
+ var _this32 = possibleConstructorReturn(this, (_class32.__proto__ || Object.getPrototypeOf(_class32)).call(this, node));
_this32.captureTextNodes = true;
- _this32.base = svg.Element.TextElementBase;
- _this32.base(node);
_this32.text = node.nodeValue || node.text || '';
_this32.getText = function () {
@@ -10238,10 +10149,7 @@ function build(opts) {
function _class33(node) {
classCallCheck(this, _class33);
- var _this33 = possibleConstructorReturn(this, (_class33.__proto__ || Object.getPrototypeOf(_class33)).call(this));
-
- _this33.base = svg.Element.TextElementBase;
- _this33.base(node);
+ var _this33 = possibleConstructorReturn(this, (_class33.__proto__ || Object.getPrototypeOf(_class33)).call(this, node));
_this33.getText = function () {
var element = this.getHrefAttribute().getDefinition();
@@ -10260,10 +10168,7 @@ function build(opts) {
function _class34(node) {
classCallCheck(this, _class34);
- var _this34 = possibleConstructorReturn(this, (_class34.__proto__ || Object.getPrototypeOf(_class34)).call(this));
-
- _this34.base = svg.Element.TextElementBase;
- _this34.base(node);
+ var _this34 = possibleConstructorReturn(this, (_class34.__proto__ || Object.getPrototypeOf(_class34)).call(this, node));
_this34.hasText = true;
for (var i = 0, childNode; childNode = node.childNodes[i]; i++) {
@@ -10312,10 +10217,7 @@ function build(opts) {
function _class35(node) {
classCallCheck(this, _class35);
- var _this35 = possibleConstructorReturn(this, (_class35.__proto__ || Object.getPrototypeOf(_class35)).call(this));
-
- _this35.base = svg.Element.RenderedElementBase;
- _this35.base(node);
+ var _this35 = possibleConstructorReturn(this, (_class35.__proto__ || Object.getPrototypeOf(_class35)).call(this, node));
var href = _this35.getHrefAttribute().value;
if (href === '') {
@@ -10382,10 +10284,7 @@ function build(opts) {
function _class36(node) {
classCallCheck(this, _class36);
- var _this36 = possibleConstructorReturn(this, (_class36.__proto__ || Object.getPrototypeOf(_class36)).call(this));
-
- _this36.base = svg.Element.RenderedElementBase;
- _this36.base(node);
+ var _this36 = possibleConstructorReturn(this, (_class36.__proto__ || Object.getPrototypeOf(_class36)).call(this, node));
_this36.getBoundingBox = function () {
var bb = new svg.BoundingBox();
@@ -10407,10 +10306,7 @@ function build(opts) {
function _class37(node) {
classCallCheck(this, _class37);
- var _this37 = possibleConstructorReturn(this, (_class37.__proto__ || Object.getPrototypeOf(_class37)).call(this));
-
- _this37.base = svg.Element.RenderedElementBase;
- _this37.base(node);
+ var _this37 = possibleConstructorReturn(this, (_class37.__proto__ || Object.getPrototypeOf(_class37)).call(this, node));
_this37.render = function (ctx) {
// NO RENDER
@@ -10428,12 +10324,9 @@ function build(opts) {
function _class38(node) {
classCallCheck(this, _class38);
- var _this38 = possibleConstructorReturn(this, (_class38.__proto__ || Object.getPrototypeOf(_class38)).call(this));
-
- _this38.base = svg.Element.ElementBase;
- _this38.base(node);
-
// text, or spaces then CDATA
+ var _this38 = possibleConstructorReturn(this, (_class38.__proto__ || Object.getPrototypeOf(_class38)).call(this, node));
+
var css = '';
for (var i = 0, childNode; childNode = node.childNodes[i]; i++) {
css += childNode.nodeValue;
@@ -10493,10 +10386,7 @@ function build(opts) {
function _class39(node) {
classCallCheck(this, _class39);
- var _this39 = possibleConstructorReturn(this, (_class39.__proto__ || Object.getPrototypeOf(_class39)).call(this));
-
- _this39.base = svg.Element.RenderedElementBase;
- _this39.base(node);
+ var _this39 = possibleConstructorReturn(this, (_class39.__proto__ || Object.getPrototypeOf(_class39)).call(this, node));
_this39.baseSetContext = _this39.setContext;
_this39.setContext = function (ctx) {
@@ -10551,10 +10441,7 @@ function build(opts) {
function _class40(node) {
classCallCheck(this, _class40);
- var _this40 = possibleConstructorReturn(this, (_class40.__proto__ || Object.getPrototypeOf(_class40)).call(this));
-
- _this40.base = svg.Element.ElementBase;
- _this40.base(node);
+ var _this40 = possibleConstructorReturn(this, (_class40.__proto__ || Object.getPrototypeOf(_class40)).call(this, node));
_this40.apply = function (ctx, element) {
// render as temp svg
@@ -10616,10 +10503,7 @@ function build(opts) {
function _class41(node) {
classCallCheck(this, _class41);
- var _this41 = possibleConstructorReturn(this, (_class41.__proto__ || Object.getPrototypeOf(_class41)).call(this));
-
- _this41.base = svg.Element.ElementBase;
- _this41.base(node);
+ var _this41 = possibleConstructorReturn(this, (_class41.__proto__ || Object.getPrototypeOf(_class41)).call(this, node));
_this41.apply = function (ctx) {
for (var i = 0; i < this.children.length; i++) {
@@ -10655,10 +10539,7 @@ function build(opts) {
function _class42(node) {
classCallCheck(this, _class42);
- var _this42 = possibleConstructorReturn(this, (_class42.__proto__ || Object.getPrototypeOf(_class42)).call(this));
-
- _this42.base = svg.Element.ElementBase;
- _this42.base(node);
+ var _this42 = possibleConstructorReturn(this, (_class42.__proto__ || Object.getPrototypeOf(_class42)).call(this, node));
_this42.apply = function (ctx, element) {
// render as temp svg
@@ -10714,10 +10595,7 @@ function build(opts) {
function _class43(node) {
classCallCheck(this, _class43);
- var _this43 = possibleConstructorReturn(this, (_class43.__proto__ || Object.getPrototypeOf(_class43)).call(this));
-
- _this43.base = svg.Element.ElementBase;
- _this43.base(node);
+ var _this43 = possibleConstructorReturn(this, (_class43.__proto__ || Object.getPrototypeOf(_class43)).call(this, node));
_this43.apply = function (ctx, x, y, width, height) {
// TODO: implement
@@ -10734,10 +10612,7 @@ function build(opts) {
function _class44(node) {
classCallCheck(this, _class44);
- var _this44 = possibleConstructorReturn(this, (_class44.__proto__ || Object.getPrototypeOf(_class44)).call(this));
-
- _this44.base = svg.Element.ElementBase;
- _this44.base(node);
+ var _this44 = possibleConstructorReturn(this, (_class44.__proto__ || Object.getPrototypeOf(_class44)).call(this, node));
_this44.apply = function (ctx, x, y, width, height) {
// TODO: implement
@@ -10754,10 +10629,7 @@ function build(opts) {
function _class45(node) {
classCallCheck(this, _class45);
- var _this45 = possibleConstructorReturn(this, (_class45.__proto__ || Object.getPrototypeOf(_class45)).call(this));
-
- _this45.base = svg.Element.ElementBase;
- _this45.base(node);
+ var _this45 = possibleConstructorReturn(this, (_class45.__proto__ || Object.getPrototypeOf(_class45)).call(this, node));
var matrix = svg.ToNumberArray(_this45.attribute('values').value);
switch (_this45.attribute('type').valueOrDefault('matrix')) {// https://www.w3.org/TR/SVG/filters.html#feColorMatrixElement
@@ -10820,10 +10692,7 @@ function build(opts) {
function _class46(node) {
classCallCheck(this, _class46);
- var _this46 = possibleConstructorReturn(this, (_class46.__proto__ || Object.getPrototypeOf(_class46)).call(this));
-
- _this46.base = svg.Element.ElementBase;
- _this46.base(node);
+ var _this46 = possibleConstructorReturn(this, (_class46.__proto__ || Object.getPrototypeOf(_class46)).call(this, node));
_this46.blurRadius = Math.floor(_this46.attribute('stdDeviation').numValue());
_this46.extraFilterDistance = _this46.blurRadius;
@@ -25950,13 +25819,250 @@ editor.init = function () {
editor.putLocale(null, goodLangs, curConfig);
};
- // Load extensions
- // Bit of a hack to run extensions in local Opera/IE9
- if (document.location.protocol === 'file:') {
- setTimeout(extFunc, 100);
- } else {
- extFunc();
- }
+ var stateObj = { tool_scale: editor.tool_scale };
+
+ var setFlyoutPositions = function setFlyoutPositions() {
+ $$b('.tools_flyout').each(function () {
+ var shower = $$b('#' + this.id + '_show');
+ var pos = shower.offset();
+ var w = shower.outerWidth();
+ $$b(this).css({ left: (pos.left + w) * editor.tool_scale, top: pos.top });
+ });
+ };
+
+ var scaleElements = function scaleElements(elems, scale) {
+ // const prefix = '-' + uaPrefix.toLowerCase() + '-'; // Currently unused
+ var sides = ['top', 'left', 'bottom', 'right'];
+
+ elems.each(function () {
+ // Handled in CSS
+ // this.style[uaPrefix + 'Transform'] = 'scale(' + scale + ')';
+ var el = $$b(this);
+ var w = el.outerWidth() * (scale - 1);
+ var h = el.outerHeight() * (scale - 1);
+ // const margins = {}; // Currently unused
+
+ for (var i = 0; i < 4; i++) {
+ var s = sides[i];
+ var cur = el.data('orig_margin-' + s);
+ if (cur == null) {
+ cur = parseInt(el.css('margin-' + s), 10);
+ // Cache the original margin
+ el.data('orig_margin-' + s, cur);
+ }
+ var val = cur * scale;
+ if (s === 'right') {
+ val += w;
+ } else if (s === 'bottom') {
+ val += h;
+ }
+
+ el.css('margin-' + s, val);
+ // el.css('outline', '1px solid red');
+ }
+ });
+ };
+
+ var setIconSize = editor.setIconSize = function (size) {
+ // const elems = $('.tool_button, .push_button, .tool_button_current, .disabled, .icon_label, #url_notice, #tool_open');
+ var selToscale = '#tools_top .toolset, #editor_panel > *, #history_panel > *,' + ' #main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,' + ' #g_panel > *, #tool_font_size > *, .tools_flyout';
+
+ var elems = $$b(selToscale);
+
+ var scale = 1;
+ if (typeof size === 'number') {
+ scale = size;
+ } else {
+ var iconSizes = { s: 0.75, m: 1, l: 1.25, xl: 1.5 };
+ scale = iconSizes[size];
+ }
+
+ stateObj.tool_scale = editor.tool_scale = scale;
+
+ setFlyoutPositions();
+ // $('.tools_flyout').each(function () {
+ // const pos = $(this).position();
+ // console.log($(this), pos.left+(34 * scale));
+ // $(this).css({left: pos.left+(34 * scale), top: pos.top+(77 * scale)});
+ // console.log('l', $(this).css('left'));
+ // });
+ //
+ // const scale = .75;
+
+ var hiddenPs = elems.parents(':hidden');
+ hiddenPs.css('visibility', 'hidden').show();
+ scaleElements(elems, scale);
+ hiddenPs.css('visibility', 'visible').hide();
+ // return;
+
+ $$b.pref('iconsize', size);
+ $$b('#iconsize').val(size);
+
+ // Change icon size
+ // $('.tool_button, .push_button, .tool_button_current, .disabled, .icon_label, #url_notice, #tool_open')
+ // .find('> svg, > img').each(function () {
+ // this.setAttribute('width',size_num);
+ // this.setAttribute('height',size_num);
+ // });
+ //
+ // $.resizeSvgIcons({
+ // '.flyout_arrow_horiz > svg, .flyout_arrow_horiz > img': size_num / 5,
+ // '#logo > svg, #logo > img': size_num * 1.3,
+ // '#tools_bottom .icon_label > *': (size_num === 16 ? 18 : size_num * .75)
+ // });
+ // if (size != 's') {
+ // $.resizeSvgIcons({'#layerbuttons svg, #layerbuttons img': size_num * .6});
+ // }
+
+ // Note that all rules will be prefixed with '#svg_editor' when parsed
+ var cssResizeRules = {
+ // '.tool_button,\
+ // .push_button,\
+ // .tool_button_current,\
+ // .push_button_pressed,\
+ // .disabled,\
+ // .icon_label,\
+ // .tools_flyout .tool_button': {
+ // width: {s: '16px', l: '32px', xl: '48px'},
+ // height: {s: '16px', l: '32px', xl: '48px'},
+ // padding: {s: '1px', l: '2px', xl: '3px'}
+ // },
+ // '.tool_sep': {
+ // height: {s: '16px', l: '32px', xl: '48px'},
+ // margin: {s: '2px 2px', l: '2px 5px', xl: '2px 8px'}
+ // },
+ // '#main_icon': {
+ // width: {s: '31px', l: '53px', xl: '75px'},
+ // height: {s: '22px', l: '42px', xl: '64px'}
+ // },
+ '#tools_top': {
+ left: 50 + $$b('#main_button').width(),
+ height: 72
+ },
+ '#tools_left': {
+ width: 31,
+ top: 74
+ },
+ 'div#workarea': {
+ left: 38,
+ top: 74
+ // '#tools_bottom': {
+ // left: {s: '27px', l: '46px', xl: '65px'},
+ // height: {s: '58px', l: '98px', xl: '145px'}
+ // },
+ // '#color_tools': {
+ // 'border-spacing': {s: '0 1px'},
+ // 'margin-top': {s: '-1px'}
+ // },
+ // '#color_tools .icon_label': {
+ // width: {l:'43px', xl: '60px'}
+ // },
+ // '.color_tool': {
+ // height: {s: '20px'}
+ // },
+ // '#tool_opacity': {
+ // top: {s: '1px'},
+ // height: {s: 'auto', l:'auto', xl:'auto'}
+ // },
+ // '#tools_top input, #tools_bottom input': {
+ // 'margin-top': {s: '2px', l: '4px', xl: '5px'},
+ // height: {s: 'auto', l: 'auto', xl: 'auto'},
+ // border: {s: '1px solid #555', l: 'auto', xl: 'auto'},
+ // 'font-size': {s: '.9em', l: '1.2em', xl: '1.4em'}
+ // },
+ // '#zoom_panel': {
+ // 'margin-top': {s: '3px', l: '4px', xl: '5px'}
+ // },
+ // '#copyright, #tools_bottom .label': {
+ // 'font-size': {l: '1.5em', xl: '2em'},
+ // 'line-height': {s: '15px'}
+ // },
+ // '#tools_bottom_2': {
+ // width: {l: '295px', xl: '355px'},
+ // top: {s: '4px'}
+ // },
+ // '#tools_top > div, #tools_top': {
+ // 'line-height': {s: '17px', l: '34px', xl: '50px'}
+ // },
+ // '.dropdown button': {
+ // height: {s: '18px', l: '34px', xl: '40px'},
+ // 'line-height': {s: '18px', l: '34px', xl: '40px'},
+ // 'margin-top': {s: '3px'}
+ // },
+ // '#tools_top label, #tools_bottom label': {
+ // 'font-size': {s: '1em', l: '1.5em', xl: '2em'},
+ // height: {s: '25px', l: '42px', xl: '64px'}
+ // },
+ // 'div.toolset': {
+ // height: {s: '25px', l: '42px', xl: '64px'}
+ // },
+ // '#tool_bold, #tool_italic': {
+ // 'font-size': {s: '1.5em', l: '3em', xl: '4.5em'}
+ // },
+ // '#sidepanels': {
+ // top: {s: '50px', l: '88px', xl: '125px'},
+ // bottom: {s: '51px', l: '68px', xl: '65px'}
+ // },
+ // '#layerbuttons': {
+ // width: {l: '130px', xl: '175px'},
+ // height: {l: '24px', xl: '30px'}
+ // },
+ // '#layerlist': {
+ // width: {l: '128px', xl: '150px'}
+ // },
+ // '.layer_button': {
+ // width: {l: '19px', xl: '28px'},
+ // height: {l: '19px', xl: '28px'}
+ // },
+ // 'input.spin-button': {
+ // 'background-image': {l: 'url('images/spinbtn_updn_big.png')', xl: 'url('images/spinbtn_updn_big.png')'},
+ // 'background-position': {l: '100% -5px', xl: '100% -2px'},
+ // 'padding-right': {l: '24px', xl: '24px' }
+ // },
+ // 'input.spin-button.up': {
+ // 'background-position': {l: '100% -45px', xl: '100% -42px'}
+ // },
+ // 'input.spin-button.down': {
+ // 'background-position': {l: '100% -85px', xl: '100% -82px'}
+ // },
+ // '#position_opts': {
+ // width: {all: (size_num*4) +'px'}
+ // }
+ } };
+
+ var ruleElem = $$b('#tool_size_rules');
+ if (!ruleElem.length) {
+ ruleElem = $$b('').appendTo('head');
+ } else {
+ ruleElem.empty();
+ }
+
+ if (size !== 'm') {
+ var styleStr = '';
+ $$b.each(cssResizeRules, function (selector, rules) {
+ selector = '#svg_editor ' + selector.replace(/,/g, ', #svg_editor');
+ styleStr += selector + '{';
+ $$b.each(rules, function (prop, values) {
+ var val = void 0;
+ if (typeof values === 'number') {
+ val = values * scale + 'px';
+ } else if (values[size] || values.all) {
+ val = values[size] || values.all;
+ }
+ styleStr += prop + ':' + val + ';';
+ });
+ styleStr += '}';
+ });
+ // this.style[uaPrefix + 'Transform'] = 'scale(' + scale + ')';
+ var prefix = '-' + uaPrefix.toLowerCase() + '-';
+ styleStr += selToscale + '{' + prefix + 'transform: scale(' + scale + ');}' + ' #svg_editor div.toolset .toolset {' + prefix + 'transform: scale(1); margin: 1px !important;}' + // Hack for markers
+ ' #svg_editor .ui-slider {' + prefix + 'transform: scale(' + 1 / scale + ');}' // Hack for sliders
+ ;
+ ruleElem.text(styleStr);
+ }
+
+ setFlyoutPositions();
+ };
$$b.svgIcons(curConfig.imgPath + 'svg_edit_icons.svg', {
w: 24, h: 24,
id_match: false,
@@ -27453,15 +27559,6 @@ editor.init = function () {
});
};
- var setFlyoutPositions = function setFlyoutPositions() {
- $$b('.tools_flyout').each(function () {
- var shower = $$b('#' + this.id + '_show');
- var pos = shower.offset();
- var w = shower.outerWidth();
- $$b(this).css({ left: (pos.left + w) * editor.tool_scale, top: pos.top });
- });
- };
-
var setupFlyouts = function setupFlyouts(holders) {
$$b.each(holders, function (holdSel, btnOpts) {
var buttons = $$b(holdSel).children();
@@ -27603,240 +27700,6 @@ editor.init = function () {
return '';
}();
- var scaleElements = function scaleElements(elems, scale) {
- // const prefix = '-' + uaPrefix.toLowerCase() + '-'; // Currently unused
- var sides = ['top', 'left', 'bottom', 'right'];
-
- elems.each(function () {
- // Handled in CSS
- // this.style[uaPrefix + 'Transform'] = 'scale(' + scale + ')';
- var el = $$b(this);
- var w = el.outerWidth() * (scale - 1);
- var h = el.outerHeight() * (scale - 1);
- // const margins = {}; // Currently unused
-
- for (var _i2 = 0; _i2 < 4; _i2++) {
- var s = sides[_i2];
- var cur = el.data('orig_margin-' + s);
- if (cur == null) {
- cur = parseInt(el.css('margin-' + s), 10);
- // Cache the original margin
- el.data('orig_margin-' + s, cur);
- }
- var val = cur * scale;
- if (s === 'right') {
- val += w;
- } else if (s === 'bottom') {
- val += h;
- }
-
- el.css('margin-' + s, val);
- // el.css('outline', '1px solid red');
- }
- });
- };
-
- var setIconSize = editor.setIconSize = function (size) {
- // const elems = $('.tool_button, .push_button, .tool_button_current, .disabled, .icon_label, #url_notice, #tool_open');
- var selToscale = '#tools_top .toolset, #editor_panel > *, #history_panel > *,' + ' #main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,' + ' #g_panel > *, #tool_font_size > *, .tools_flyout';
-
- var elems = $$b(selToscale);
-
- var scale = 1;
- if (typeof size === 'number') {
- scale = size;
- } else {
- var iconSizes = { s: 0.75, m: 1, l: 1.25, xl: 1.5 };
- scale = iconSizes[size];
- }
-
- stateObj.tool_scale = editor.tool_scale = scale;
-
- setFlyoutPositions();
- // $('.tools_flyout').each(function () {
- // const pos = $(this).position();
- // console.log($(this), pos.left+(34 * scale));
- // $(this).css({left: pos.left+(34 * scale), top: pos.top+(77 * scale)});
- // console.log('l', $(this).css('left'));
- // });
- //
- // const scale = .75;
-
- var hiddenPs = elems.parents(':hidden');
- hiddenPs.css('visibility', 'hidden').show();
- scaleElements(elems, scale);
- hiddenPs.css('visibility', 'visible').hide();
- // return;
-
- $$b.pref('iconsize', size);
- $$b('#iconsize').val(size);
-
- // Change icon size
- // $('.tool_button, .push_button, .tool_button_current, .disabled, .icon_label, #url_notice, #tool_open')
- // .find('> svg, > img').each(function () {
- // this.setAttribute('width',size_num);
- // this.setAttribute('height',size_num);
- // });
- //
- // $.resizeSvgIcons({
- // '.flyout_arrow_horiz > svg, .flyout_arrow_horiz > img': size_num / 5,
- // '#logo > svg, #logo > img': size_num * 1.3,
- // '#tools_bottom .icon_label > *': (size_num === 16 ? 18 : size_num * .75)
- // });
- // if (size != 's') {
- // $.resizeSvgIcons({'#layerbuttons svg, #layerbuttons img': size_num * .6});
- // }
-
- // Note that all rules will be prefixed with '#svg_editor' when parsed
- var cssResizeRules = {
- // '.tool_button,\
- // .push_button,\
- // .tool_button_current,\
- // .push_button_pressed,\
- // .disabled,\
- // .icon_label,\
- // .tools_flyout .tool_button': {
- // width: {s: '16px', l: '32px', xl: '48px'},
- // height: {s: '16px', l: '32px', xl: '48px'},
- // padding: {s: '1px', l: '2px', xl: '3px'}
- // },
- // '.tool_sep': {
- // height: {s: '16px', l: '32px', xl: '48px'},
- // margin: {s: '2px 2px', l: '2px 5px', xl: '2px 8px'}
- // },
- // '#main_icon': {
- // width: {s: '31px', l: '53px', xl: '75px'},
- // height: {s: '22px', l: '42px', xl: '64px'}
- // },
- '#tools_top': {
- left: 50 + $$b('#main_button').width(),
- height: 72
- },
- '#tools_left': {
- width: 31,
- top: 74
- },
- 'div#workarea': {
- left: 38,
- top: 74
- // '#tools_bottom': {
- // left: {s: '27px', l: '46px', xl: '65px'},
- // height: {s: '58px', l: '98px', xl: '145px'}
- // },
- // '#color_tools': {
- // 'border-spacing': {s: '0 1px'},
- // 'margin-top': {s: '-1px'}
- // },
- // '#color_tools .icon_label': {
- // width: {l:'43px', xl: '60px'}
- // },
- // '.color_tool': {
- // height: {s: '20px'}
- // },
- // '#tool_opacity': {
- // top: {s: '1px'},
- // height: {s: 'auto', l:'auto', xl:'auto'}
- // },
- // '#tools_top input, #tools_bottom input': {
- // 'margin-top': {s: '2px', l: '4px', xl: '5px'},
- // height: {s: 'auto', l: 'auto', xl: 'auto'},
- // border: {s: '1px solid #555', l: 'auto', xl: 'auto'},
- // 'font-size': {s: '.9em', l: '1.2em', xl: '1.4em'}
- // },
- // '#zoom_panel': {
- // 'margin-top': {s: '3px', l: '4px', xl: '5px'}
- // },
- // '#copyright, #tools_bottom .label': {
- // 'font-size': {l: '1.5em', xl: '2em'},
- // 'line-height': {s: '15px'}
- // },
- // '#tools_bottom_2': {
- // width: {l: '295px', xl: '355px'},
- // top: {s: '4px'}
- // },
- // '#tools_top > div, #tools_top': {
- // 'line-height': {s: '17px', l: '34px', xl: '50px'}
- // },
- // '.dropdown button': {
- // height: {s: '18px', l: '34px', xl: '40px'},
- // 'line-height': {s: '18px', l: '34px', xl: '40px'},
- // 'margin-top': {s: '3px'}
- // },
- // '#tools_top label, #tools_bottom label': {
- // 'font-size': {s: '1em', l: '1.5em', xl: '2em'},
- // height: {s: '25px', l: '42px', xl: '64px'}
- // },
- // 'div.toolset': {
- // height: {s: '25px', l: '42px', xl: '64px'}
- // },
- // '#tool_bold, #tool_italic': {
- // 'font-size': {s: '1.5em', l: '3em', xl: '4.5em'}
- // },
- // '#sidepanels': {
- // top: {s: '50px', l: '88px', xl: '125px'},
- // bottom: {s: '51px', l: '68px', xl: '65px'}
- // },
- // '#layerbuttons': {
- // width: {l: '130px', xl: '175px'},
- // height: {l: '24px', xl: '30px'}
- // },
- // '#layerlist': {
- // width: {l: '128px', xl: '150px'}
- // },
- // '.layer_button': {
- // width: {l: '19px', xl: '28px'},
- // height: {l: '19px', xl: '28px'}
- // },
- // 'input.spin-button': {
- // 'background-image': {l: 'url('images/spinbtn_updn_big.png')', xl: 'url('images/spinbtn_updn_big.png')'},
- // 'background-position': {l: '100% -5px', xl: '100% -2px'},
- // 'padding-right': {l: '24px', xl: '24px' }
- // },
- // 'input.spin-button.up': {
- // 'background-position': {l: '100% -45px', xl: '100% -42px'}
- // },
- // 'input.spin-button.down': {
- // 'background-position': {l: '100% -85px', xl: '100% -82px'}
- // },
- // '#position_opts': {
- // width: {all: (size_num*4) +'px'}
- // }
- } };
-
- var ruleElem = $$b('#tool_size_rules');
- if (!ruleElem.length) {
- ruleElem = $$b('').appendTo('head');
- } else {
- ruleElem.empty();
- }
-
- if (size !== 'm') {
- var styleStr = '';
- $$b.each(cssResizeRules, function (selector, rules) {
- selector = '#svg_editor ' + selector.replace(/,/g, ', #svg_editor');
- styleStr += selector + '{';
- $$b.each(rules, function (prop, values) {
- var val = void 0;
- if (typeof values === 'number') {
- val = values * scale + 'px';
- } else if (values[size] || values.all) {
- val = values[size] || values.all;
- }
- styleStr += prop + ':' + val + ';';
- });
- styleStr += '}';
- });
- // this.style[uaPrefix + 'Transform'] = 'scale(' + scale + ')';
- var prefix = '-' + uaPrefix.toLowerCase() + '-';
- styleStr += selToscale + '{' + prefix + 'transform: scale(' + scale + ');}' + ' #svg_editor div.toolset .toolset {' + prefix + 'transform: scale(1); margin: 1px !important;}' + // Hack for markers
- ' #svg_editor .ui-slider {' + prefix + 'transform: scale(' + 1 / scale + ');}' // Hack for sliders
- ;
- ruleElem.text(styleStr);
- }
-
- setFlyoutPositions();
- };
-
// TODO: Combine this with addDropDown or find other way to optimize
var addAltDropDown = function addAltDropDown(elem, list, callback, opts) {
var button = $$b(elem);
@@ -29487,9 +29350,9 @@ editor.init = function () {
// in Opera and Chrome
if (isMac() && !window.opera) {
var shortcutButtons = ['tool_clear', 'tool_save', 'tool_source', 'tool_undo', 'tool_redo', 'tool_clone'];
- var _i3 = shortcutButtons.length;
- while (_i3--) {
- var button = document.getElementById(shortcutButtons[_i3]);
+ var _i2 = shortcutButtons.length;
+ while (_i2--) {
+ var button = document.getElementById(shortcutButtons[_i2]);
if (button) {
var title = button.title;
@@ -29590,10 +29453,10 @@ editor.init = function () {
var childs = selectedElement.getElementsByTagName('*');
var gPaint = null;
- for (var _i4 = 0, len = childs.length; _i4 < len; _i4++) {
- var elem = childs[_i4];
+ for (var _i3 = 0, len = childs.length; _i3 < len; _i3++) {
+ var elem = childs[_i3];
var p = elem.getAttribute(type);
- if (_i4 === 0) {
+ if (_i3 === 0) {
gPaint = p;
} else if (gPaint !== p) {
gPaint = null;
@@ -30291,7 +30154,6 @@ editor.init = function () {
});
// init SpinButtons
- var stateObj = { tool_scale: editor.tool_scale };
$$b('#rect_rx').SpinButton({ min: 0, max: 1000, stateObj: stateObj, callback: changeRectRadius });
$$b('#stroke_width').SpinButton({ min: 0, max: 99, smallStep: 0.1, stateObj: stateObj, callback: changeStrokeWidth });
$$b('#angle').SpinButton({ min: -180, max: 180, step: 5, stateObj: stateObj, callback: changeRotationAngle });
@@ -30407,6 +30269,10 @@ editor.init = function () {
}
}, false);
+ editor.canvas.getUIStrings = function () {
+ return uiStrings$1;
+ };
+
editor.openPrep = function (func) {
$$b('#main_menu').hide();
if (undoMgr.getUndoStackSize() === 0) {
@@ -30614,6 +30480,13 @@ editor.init = function () {
curConfig: curConfig,
setLang: setLang
});
+ // Load extensions
+ // Bit of a hack to run extensions in local Opera/IE9
+ if (document.location.protocol === 'file:') {
+ setTimeout(extFunc, 100);
+ } else {
+ extFunc();
+ }
};
editor.ready = function (cb) {
diff --git a/dist/index-es.min.js b/dist/index-es.min.js
index 40046382..83d61f55 100644
--- a/dist/index-es.min.js
+++ b/dist/index-es.min.js
@@ -1,2 +1,2 @@
-function touchHandler(e){var t=e.changedTouches,n=t[0],a="";switch(e.type){case"touchstart":a="mousedown";break;case"touchmove":a="mousemove";break;case"touchend":a="mouseup";break;default:return}var r=document.createEvent("MouseEvent");r.initMouseEvent(a,!0,!0,window,1,n.screenX,n.screenY,n.clientX,n.clientY,!1,!1,!1,!1,0,null),t.length<2&&(n.target.dispatchEvent(r),e.preventDefault())}document.addEventListener("touchstart",touchHandler,!0),document.addEventListener("touchmove",touchHandler,!0),document.addEventListener("touchend",touchHandler,!0),document.addEventListener("touchcancel",touchHandler,!0);var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},classCallCheck=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},createClass=function(){function e(e,t){for(var n=0;nt.getTotalLength())break;n--}while(n>0);return n}),window.SVGPathSeg=e,window.SVGPathSegClosePath=t,window.SVGPathSegMovetoAbs=n,window.SVGPathSegMovetoRel=a,window.SVGPathSegLinetoAbs=r,window.SVGPathSegLinetoRel=i,window.SVGPathSegCurvetoCubicAbs=s,window.SVGPathSegCurvetoCubicRel=o,window.SVGPathSegCurvetoQuadraticAbs=l,window.SVGPathSegCurvetoQuadraticRel=u,window.SVGPathSegArcAbs=c,window.SVGPathSegArcRel=h,window.SVGPathSegLinetoHorizontalAbs=d,window.SVGPathSegLinetoHorizontalRel=f,window.SVGPathSegLinetoVerticalAbs=p,window.SVGPathSegLinetoVerticalRel=g,window.SVGPathSegCurvetoCubicSmoothAbs=v,window.SVGPathSegCurvetoCubicSmoothRel=m,window.SVGPathSegCurvetoQuadraticSmoothAbs=b,window.SVGPathSegCurvetoQuadraticSmoothRel=y}if(!("SVGPathSegList"in window&&"appendItem"in SVGPathSegList.prototype)){var _=function(){function e(t){classCallCheck(this,e),this._pathElement=t,this._list=this._parsePath(this._pathElement.getAttribute("d")),this._mutationObserverConfig={attributes:!0,attributeFilter:["d"]},this._pathElementMutationObserver=new MutationObserver(this._updateListFromPathMutations.bind(this)),this._pathElementMutationObserver.observe(this._pathElement,this._mutationObserverConfig)}return createClass(e,[{key:"_checkPathSynchronizedToList",value:function(){this._updateListFromPathMutations(this._pathElementMutationObserver.takeRecords())}},{key:"_updateListFromPathMutations",value:function(e){if(this._pathElement){var t=!1;e.forEach(function(e){"d"===e.attributeName&&(t=!0)}),t&&(this._list=this._parsePath(this._pathElement.getAttribute("d")))}}},{key:"_writeListToPath",value:function(){this._pathElementMutationObserver.disconnect(),this._pathElement.setAttribute("d",e._pathSegArrayAsString(this._list)),this._pathElementMutationObserver.observe(this._pathElement,this._mutationObserverConfig)}},{key:"segmentChanged",value:function(e){this._writeListToPath()}},{key:"clear",value:function(){this._checkPathSynchronizedToList(),this._list.forEach(function(e){e._owningPathSegList=null}),this._list=[],this._writeListToPath()}},{key:"initialize",value:function(e){return this._checkPathSynchronizedToList(),this._list=[e],e._owningPathSegList=this,this._writeListToPath(),e}},{key:"_checkValidIndex",value:function(e){if(isNaN(e)||e<0||e>=this.numberOfItems)throw new Error("INDEX_SIZE_ERR")}},{key:"getItem",value:function(e){return this._checkPathSynchronizedToList(),this._checkValidIndex(e),this._list[e]}},{key:"insertItemBefore",value:function(e,t){return this._checkPathSynchronizedToList(),t>this.numberOfItems&&(t=this.numberOfItems),e._owningPathSegList&&(e=e.clone()),this._list.splice(t,0,e),e._owningPathSegList=this,this._writeListToPath(),e}},{key:"replaceItem",value:function(e,t){return this._checkPathSynchronizedToList(),e._owningPathSegList&&(e=e.clone()),this._checkValidIndex(t),this._list[t]=e,e._owningPathSegList=this,this._writeListToPath(),e}},{key:"removeItem",value:function(e){this._checkPathSynchronizedToList(),this._checkValidIndex(e);var t=this._list[e];return this._list.splice(e,1),this._writeListToPath(),t}},{key:"appendItem",value:function(e){return this._checkPathSynchronizedToList(),e._owningPathSegList&&(e=e.clone()),this._list.push(e),e._owningPathSegList=this,this._writeListToPath(),e}},{key:"_parsePath",value:function(e){if(!e||!e.length)return[];var t=this,n=function(){function e(){classCallCheck(this,e),this.pathSegList=[]}return createClass(e,[{key:"appendSegment",value:function(e){this.pathSegList.push(e)}}]),e}(),a=function(){function e(t){classCallCheck(this,e),this._string=t,this._currentIndex=0,this._endIndex=this._string.length,this._previousCommand=SVGPathSeg.PATHSEG_UNKNOWN,this._skipOptionalSpaces()}return createClass(e,[{key:"_isCurrentSpace",value:function(){var e=this._string[this._currentIndex];return e<=" "&&(" "===e||"\n"===e||"\t"===e||"\r"===e||"\f"===e)}},{key:"_skipOptionalSpaces",value:function(){for(;this._currentIndex="0"&&e<="9")&&t!==SVGPathSeg.PATHSEG_CLOSEPATH?t===SVGPathSeg.PATHSEG_MOVETO_ABS?SVGPathSeg.PATHSEG_LINETO_ABS:t===SVGPathSeg.PATHSEG_MOVETO_REL?SVGPathSeg.PATHSEG_LINETO_REL:t:SVGPathSeg.PATHSEG_UNKNOWN}},{key:"initialCommandIsMoveTo",value:function(){if(!this.hasMoreData())return!0;var e=this.peekSegmentType();return e===SVGPathSeg.PATHSEG_MOVETO_ABS||e===SVGPathSeg.PATHSEG_MOVETO_REL}},{key:"_parseNumber",value:function(){var e=0,t=0,n=1,a=0,r=1,i=1,s=this._currentIndex;if(this._skipOptionalSpaces(),this._currentIndex"9")&&"."!==this._string.charAt(this._currentIndex))){for(var o=this._currentIndex;this._currentIndex="0"&&this._string.charAt(this._currentIndex)<="9";)this._currentIndex++;if(this._currentIndex!==o)for(var l=this._currentIndex-1,u=1;l>=o;)t+=u*(this._string.charAt(l--)-"0"),u*=10;if(this._currentIndex=this._endIndex||this._string.charAt(this._currentIndex)<"0"||this._string.charAt(this._currentIndex)>"9")return;for(;this._currentIndex="0"&&this._string.charAt(this._currentIndex)<="9";)n*=10,a+=(this._string.charAt(this._currentIndex)-"0")/n,this._currentIndex+=1}if(this._currentIndex!==s&&this._currentIndex+1=this._endIndex||this._string.charAt(this._currentIndex)<"0"||this._string.charAt(this._currentIndex)>"9")return;for(;this._currentIndex="0"&&this._string.charAt(this._currentIndex)<="9";)e*=10,e+=this._string.charAt(this._currentIndex)-"0",this._currentIndex++}var c=t+a;if(c*=r,e&&(c*=Math.pow(10,i*e)),s!==this._currentIndex)return this._skipOptionalSpacesOrDelimiter(),c}}},{key:"_parseArcFlag",value:function(){if(!(this._currentIndex>=this._endIndex)){var e=!1,t=this._string.charAt(this._currentIndex++);if("0"===t)e=!1;else{if("1"!==t)return;e=!0}return this._skipOptionalSpacesOrDelimiter(),e}}},{key:"parseSegment",value:function(){var e=this._string[this._currentIndex],n=this._pathSegTypeFromChar(e);if(n===SVGPathSeg.PATHSEG_UNKNOWN){if(this._previousCommand===SVGPathSeg.PATHSEG_UNKNOWN)return null;if((n=this._nextCommandHelper(e,this._previousCommand))===SVGPathSeg.PATHSEG_UNKNOWN)return null}else this._currentIndex++;switch(this._previousCommand=n,n){case SVGPathSeg.PATHSEG_MOVETO_REL:return new SVGPathSegMovetoRel(t,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_MOVETO_ABS:return new SVGPathSegMovetoAbs(t,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_REL:return new SVGPathSegLinetoRel(t,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_ABS:return new SVGPathSegLinetoAbs(t,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL:return new SVGPathSegLinetoHorizontalRel(t,this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS:return new SVGPathSegLinetoHorizontalAbs(t,this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL:return new SVGPathSegLinetoVerticalRel(t,this._parseNumber());case SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS:return new SVGPathSegLinetoVerticalAbs(t,this._parseNumber());case SVGPathSeg.PATHSEG_CLOSEPATH:return this._skipOptionalSpaces(),new SVGPathSegClosePath(t);case SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL:var a={x1:this._parseNumber(),y1:this._parseNumber(),x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicRel(t,a.x,a.y,a.x1,a.y1,a.x2,a.y2);case SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS:var r={x1:this._parseNumber(),y1:this._parseNumber(),x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicAbs(t,r.x,r.y,r.x1,r.y1,r.x2,r.y2);case SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL:var i={x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicSmoothRel(t,i.x,i.y,i.x2,i.y2);case SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS:var s={x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicSmoothAbs(t,s.x,s.y,s.x2,s.y2);case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL:var o={x1:this._parseNumber(),y1:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoQuadraticRel(t,o.x,o.y,o.x1,o.y1);case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS:var l={x1:this._parseNumber(),y1:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoQuadraticAbs(t,l.x,l.y,l.x1,l.y1);case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL:return new SVGPathSegCurvetoQuadraticSmoothRel(t,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS:return new SVGPathSegCurvetoQuadraticSmoothAbs(t,this._parseNumber(),this._parseNumber());case SVGPathSeg.PATHSEG_ARC_REL:var u={x1:this._parseNumber(),y1:this._parseNumber(),arcAngle:this._parseNumber(),arcLarge:this._parseArcFlag(),arcSweep:this._parseArcFlag(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegArcRel(t,u.x,u.y,u.x1,u.y1,u.arcAngle,u.arcLarge,u.arcSweep);case SVGPathSeg.PATHSEG_ARC_ABS:var c={x1:this._parseNumber(),y1:this._parseNumber(),arcAngle:this._parseNumber(),arcLarge:this._parseArcFlag(),arcSweep:this._parseArcFlag(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegArcAbs(t,c.x,c.y,c.x1,c.y1,c.arcAngle,c.arcLarge,c.arcSweep);default:throw new Error("Unknown path seg type.")}}}]),e}(),r=new n,i=new a(e);if(!i.initialCommandIsMoveTo())return[];for(;i.hasMoreData();){var s=i.parseSegment();if(!s)return[];r.appendSegment(s)}return r.pathSegList}}]),e}();_.prototype.classname="SVGPathSegList",Object.defineProperty(_.prototype,"numberOfItems",{get:function(){return this._checkPathSynchronizedToList(),this._list.length},enumerable:!0}),_._pathSegArrayAsString=function(e){var t="",n=!0;return e.forEach(function(e){n?(n=!1,t+=e._asPathString()):t+=" "+e._asPathString()}),t},Object.defineProperties(SVGPathElement.prototype,{pathSegList:{get:function(){return this._pathSegList||(this._pathSegList=new _(this)),this._pathSegList},enumerable:!0},normalizedPathSegList:{get:function(){return this.pathSegList},enumerable:!0},animatedPathSegList:{get:function(){return this.pathSegList},enumerable:!0},animatedNormalizedPathSegList:{get:function(){return this.pathSegList},enumerable:!0}}),window.SVGPathSegList=_}}();var $=jQuery,supportsSvg_=!!document.createElementNS&&!!document.createElementNS(NS.SVG,"svg").createSVGRect,_navigator=navigator,userAgent=_navigator.userAgent,svg=document.createElementNS(NS.SVG,"svg"),isOpera_=!!window.opera,isWebkit_=userAgent.includes("AppleWebKit"),isGecko_=userAgent.includes("Gecko/"),isIE_=userAgent.includes("MSIE"),isChrome_=userAgent.includes("Chrome/"),isWindows_=userAgent.includes("Windows"),isMac_=userAgent.includes("Macintosh"),isTouch_="ontouchstart"in window,supportsSelectors_=!!svg.querySelector,supportsXpath_=!!document.evaluate,supportsPathReplaceItem_=function(){var e=document.createElementNS(NS.SVG,"path");e.setAttribute("d","M0,0 10,10");var t=e.pathSegList,n=e.createSVGPathSegLinetoAbs(5,5);try{return t.replaceItem(n,1),!0}catch(e){}return!1}(),supportsPathInsertItemBefore_=function(){var e=document.createElementNS(NS.SVG,"path");e.setAttribute("d","M0,0 10,10");var t=e.pathSegList,n=e.createSVGPathSegLinetoAbs(5,5);try{return t.insertItemBefore(n,1),!0}catch(e){}return!1}(),supportsGoodTextCharPos_=function(){var e=document.createElementNS(NS.SVG,"svg"),t=document.createElementNS(NS.SVG,"svg");document.documentElement.appendChild(e),t.setAttribute("x",5),e.appendChild(t);var n=document.createElementNS(NS.SVG,"text");n.textContent="a",t.appendChild(n);var a=n.getStartPositionOfChar(0).x;return document.documentElement.removeChild(e),0===a}(),supportsPathBBox_=function(){var e=document.createElementNS(NS.SVG,"svg");document.documentElement.appendChild(e);var t=document.createElementNS(NS.SVG,"path");t.setAttribute("d","M0,0 C0,0 10,10 10,0"),e.appendChild(t);var n=t.getBBox();return document.documentElement.removeChild(e),n.height>4&&n.height<5}(),supportsHVLineContainerBBox_=function(){var e=document.createElementNS(NS.SVG,"svg");document.documentElement.appendChild(e);var t=document.createElementNS(NS.SVG,"path");t.setAttribute("d","M0,0 10,0");var n=document.createElementNS(NS.SVG,"path");n.setAttribute("d","M5,0 15,0");var a=document.createElementNS(NS.SVG,"g");a.appendChild(t),a.appendChild(n),e.appendChild(a);var r=a.getBBox();return document.documentElement.removeChild(e),15===r.width}(),supportsGoodDecimals_=function(){var e=document.createElementNS(NS.SVG,"rect");e.setAttribute("x",.1);var t=!e.cloneNode(!1).getAttribute("x").includes(",");return t||$.alert('NOTE: This version of Opera is known to contain bugs in SVG-edit.\nPlease upgrade to the latest version in which the problems have been fixed.'),t}(),supportsNonScalingStroke_=function(){var e=document.createElementNS(NS.SVG,"rect");return e.setAttribute("style","vector-effect:non-scaling-stroke"),"non-scaling-stroke"===e.style.vectorEffect}(),supportsNativeSVGTransformLists_=function(){var e=document.createElementNS(NS.SVG,"rect").transform.baseVal,t=svg.createSVGTransform();e.appendItem(t);var n=e.getItem(0);return n instanceof SVGTransform&&t instanceof SVGTransform&&n.type===t.type&&n.angle===t.angle&&n.matrix.a===t.matrix.a&&n.matrix.b===t.matrix.b&&n.matrix.c===t.matrix.c&&n.matrix.d===t.matrix.d&&n.matrix.e===t.matrix.e&&n.matrix.f===t.matrix.f}(),isOpera=function(){return isOpera_},isWebkit=function(){return isWebkit_},isGecko=function(){return isGecko_},isIE=function(){return isIE_},isChrome=function(){return isChrome_},isMac=function(){return isMac_},isTouch=function(){return isTouch_},supportsSelectors=function(){return supportsSelectors_},supportsXpath=function(){return supportsXpath_},supportsPathReplaceItem=function(){return supportsPathReplaceItem_},supportsPathInsertItemBefore=function(){return supportsPathInsertItemBefore_},supportsPathBBox=function(){return supportsPathBBox_},supportsHVLineContainerBBox=function(){return supportsHVLineContainerBBox_},supportsGoodTextCharPos=function(){return supportsGoodTextCharPos_},supportsNonScalingStroke=function(){return supportsNonScalingStroke_},supportsNativeTransformLists=function(){return supportsNativeSVGTransformLists_};function RGBColor(e){this.ok=!1,"#"===e.charAt(0)&&(e=e.substr(1,6)),e=(e=e.replace(/ /g,"")).toLowerCase();var t={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"};for(var n in t)t.hasOwnProperty(n)&&e===n&&(e=t[n]);for(var a=[{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(e){return[parseInt(e[1],10),parseInt(e[2],10),parseInt(e[3],10)]}},{re:/^(\w{2})(\w{2})(\w{2})$/,example:["#00ff00","336699"],process:function(e){return[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]}},{re:/^(\w{1})(\w{1})(\w{1})$/,example:["#fb0","f0f"],process:function(e){return[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16)]}}],r=0;r255?255:this.r,this.g=this.g<0||isNaN(this.g)?0:this.g>255?255:this.g,this.b=this.b<0||isNaN(this.b)?0:this.b>255?255:this.b,this.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"},this.toHex=function(){var e=this.r.toString(16),t=this.g.toString(16),n=this.b.toString(16);return 1===e.length&&(e="0"+e),1===t.length&&(t="0"+t),1===n.length&&(n="0"+n),"#"+e+t+n},this.getHelpXML=function(){for(var e=[],n=0;n "+c.toRGB()+" -> "+c.toHex());u.appendChild(h),u.appendChild(d),o.appendChild(u)}catch(e){}return o}}function jqPluginSVG(e){var t=e.fn.attr;return e.fn.attr=function(e,n){var a=this.length;if(!a)return t.apply(this,arguments);for(var r=0;r=0)return this._xforms[e];var t=new Error("DOMException with code=INDEX_SIZE_ERR");throw t.code=1,t},this.insertItemBefore=function(e,t){var n=null;if(t>=0)if(t=0&&(this._removeFromOtherLists(e),this._xforms[t]=e,n=e,this._list._update()),n},this.removeItem=function(e){if(e=0){var t=this._xforms[e],n=new Array(this.numberOfItems-1),a=void 0;for(a=0;a=0;t--)this.stack[t].unapply(e);e&&e.handleHistoryEvent(HistoryEventTypes.AFTER_UNAPPLY,this)}},{key:"elements",value:function(){for(var e=[],t=this.stack.length;t--;)for(var n=this.stack[t].elements(),a=n.length;a--;)e.includes(n[a])||e.push(n[a]);return e}},{key:"addSubCommand",value:function(e){this.stack.push(e)}},{key:"isEmpty",value:function(){return!this.stack.length}}]),e}();BatchCommand.type=BatchCommand.prototype.type;var UndoManager=function(){function e(t){classCallCheck(this,e),this.handler_=t||null,this.undoStackPointer=0,this.undoStack=[],this.undoChangeStackPointer=-1,this.undoableChangeStack=[]}return createClass(e,[{key:"resetUndoStack",value:function(){this.undoStack=[],this.undoStackPointer=0}},{key:"getUndoStackSize",value:function(){return this.undoStackPointer}},{key:"getRedoStackSize",value:function(){return this.undoStack.length-this.undoStackPointer}},{key:"getNextUndoCommandText",value:function(){return this.undoStackPointer>0?this.undoStack[this.undoStackPointer-1].getText():""}},{key:"getNextRedoCommandText",value:function(){return this.undoStackPointer0&&this.undoStack[--this.undoStackPointer].unapply(this.handler_)}},{key:"redo",value:function(){this.undoStackPointer0&&this.undoStack[this.undoStackPointer++].apply(this.handler_)}},{key:"addCommandToHistory",value:function(e){this.undoStackPointer0&&(this.undoStack=this.undoStack.splice(0,this.undoStackPointer)),this.undoStack.push(e),this.undoStackPointer=this.undoStack.length}},{key:"beginUndoableChange",value:function(e,t){for(var n=++this.undoChangeStackPointer,a=t.length,r=new Array(a),i=new Array(a);a--;){var s=t[a];null!=s&&(i[a]=s,r[a]=s.getAttribute(e))}this.undoableChangeStack[n]={attrName:e,oldValues:r,elements:i}}},{key:"finishUndoableChange",value:function(){for(var e=this.undoChangeStackPointer--,t=this.undoableChangeStack[e],n=t.attrName,a=new BatchCommand("Change "+n),r=t.elements.length;r--;){var i=t.elements[r];if(null!=i){var s={};s[n]=t.oldValues[r],s[n]!==i.getAttribute(n)&&a.addSubCommand(new ChangeElementCommand(i,s,n))}}return this.undoableChangeStack[e]=null,a}}]),e}(),history=Object.freeze({HistoryEventTypes:HistoryEventTypes,MoveElementCommand:MoveElementCommand,InsertElementCommand:InsertElementCommand,RemoveElementCommand:RemoveElementCommand,ChangeElementCommand:ChangeElementCommand,BatchCommand:BatchCommand,UndoManager:UndoManager}),NEAR_ZERO=1e-14,svg$1=document.createElementNS(NS.SVG,"svg"),transformPoint=function(e,t,n){return{x:n.a*e+n.c*t+n.e,y:n.b*e+n.d*t+n.f}},isIdentity=function(e){return 1===e.a&&0===e.b&&0===e.c&&1===e.d&&0===e.e&&0===e.f},matrixMultiply=function(){for(var e=arguments.length,t=Array(e),n=0;n(n=parseInt(n,10))){var a=n;n=t,t=a}for(var r=svg$1.createSVGMatrix(),i=t;i<=n;++i){var s=i>=0&&ie.x&&t.ye.y},$$1=jQuery,segData={2:["x","y"],4:["x","y"],6:["x","y","x1","y1","x2","y2"],8:["x","y","x1","y1"],10:["x","y","r1","r2","angle","largeArcFlag","sweepFlag"],12:["x"],14:["y"],16:["x","y","x2","y2"],18:["x","y"]},uiStrings={},setUiStrings=function(e){Object.assign(uiStrings,e.ui)},pathFuncs=[],linkControlPts=!0,pathData={},setLinkControlPoints=function(e){linkControlPts=e},path=null,editorContext_=null,init$1=function(e){editorContext_=e,pathFuncs=[0,"ClosePath"];$$1.each(["Moveto","Lineto","CurvetoCubic","CurvetoQuadratic","Arc","LinetoHorizontal","LinetoVertical","CurvetoCubicSmooth","CurvetoQuadraticSmooth"],function(e,t){pathFuncs.push(t+"Abs"),pathFuncs.push(t+"Rel")})},insertItemBefore=function(e,t,n){var a=e.pathSegList;if(supportsPathInsertItemBefore())a.insertItemBefore(t,n);else{for(var r=a.numberOfItems,i=[],s=0;s0?(g=f element");this.elem=t,this.segs=[],this.selected_pts=[],path=this,this.init()}return createClass(e,[{key:"init",value:function(){$$1(getGripContainer()).find("*").each(function(){$$1(this).attr("display","none")});var e=this.elem.pathSegList,t=e.numberOfItems;this.segs=[],this.selected_pts=[],this.first_seg=null;for(var n=0;n=t?null:i[o+1],c=o-1<0?null:i[o-1];if(2===l.type){if(c&&1!==c.type){var h=i[s];h.next=i[s+1],h.next.prev=h,h.addGrip()}s=o}else if(u&&1===u.type)l.next=i[s+1],l.next.prev=l,l.mate=i[s],l.addGrip(),null==this.first_seg&&(this.first_seg=l);else if(u)1!==l.type&&(l.addGrip(),u&&2!==u.type&&(l.next=u,l.next.prev=l));else if(1!==l.type){var d=i[s];d.next=i[s+1],d.next.prev=d,d.addGrip(),l.addGrip(),this.first_seg||(this.first_seg=i[s])}}return this}},{key:"eachSeg",value:function(e){for(var t=this.segs.length,n=0;n=0&&this.selected_pts.push(n)}this.selected_pts.sort();var a=this.selected_pts.length,r=[];for(r.length=a;a--;){var i=this.selected_pts[a],s=this.segs[i];s.select(!0),r[a]=s.ptgrip}var o=this.subpathIsClosed(this.selected_pts[0]);editorContext_.addPtsToSelection({grips:r,closedSubpath:o})}}]),e}(),getPath_=function(e){var t=pathData[e.id];return t||(t=pathData[e.id]=new Path(e)),t},removePath_=function(e){e in pathData&&delete pathData[e]},newcx=void 0,newcy=void 0,oldcx=void 0,oldcy=void 0,angle=void 0,getRotVals=function(e,t){var n=e-oldcx,a=t-oldcy,r=Math.sqrt(n*n+a*a),i=Math.atan2(a,n)+angle;return n=r*Math.cos(i)+oldcx,a=r*Math.sin(i)+oldcy,n-=newcx,a-=newcy,r=Math.sqrt(n*n+a*a),i=Math.atan2(a,n)-angle,{x:r*Math.cos(i)+newcx,y:r*Math.sin(i)+newcy}},recalcRotatedPath=function(){var e=path.elem;if(angle=getRotationAngle(e,!0)){var t=path.oldbbox;oldcx=t.x+t.width/2,oldcy=t.y+t.height/2;var n=getBBox(e);newcx=n.x+n.width/2,newcy=n.y+n.height/2;var a=newcx-oldcx,r=newcy-oldcy,i=Math.sqrt(a*a+r*r),s=Math.atan2(r,a)+angle;newcx=i*Math.cos(s)+oldcx,newcy=i*Math.sin(s)+oldcy;for(var o=e.pathSegList,l=o.numberOfItems;l;){l-=1;var u=o.getItem(l),c=u.pathSegType;if(1!==c){var h=getRotVals(u.x,u.y),d=[h.x,h.y];if(null!=u.x1&&null!=u.x2){var f=getRotVals(u.x1,u.y1),p=getRotVals(u.x2,u.y2);d.splice(d.length,0,f.x,f.y,p.x,p.y)}replacePathSeg(c,l,d)}}n=getBBox(e);var g=editorContext_.getSVGRoot().createSVGTransform(),v=getTransformList(e);g.setRotate(180*angle/Math.PI,newcx,newcy),v.replaceItem(g,0)}},clearData=function(){pathData={}},reorientGrads=function(e,t){for(var n=getBBox(e),a=0;a<2;a++){var r=0===a?"fill":"stroke",i=e.getAttribute(r);if(i&&i.startsWith("url(")){var s=getRefElem(i);if("linearGradient"===s.tagName){var o=s.getAttribute("x1")||0,l=s.getAttribute("y1")||0,u=s.getAttribute("x2")||1,c=s.getAttribute("y2")||0;o=n.width*o+n.x,l=n.height*l+n.y,u=n.width*u+n.x,c=n.height*c+n.y;var h=transformPoint(o,l,t),d=transformPoint(u,c,t),f={};f.x1=(h.x-n.x)/n.width,f.y1=(h.y-n.y)/n.height,f.x2=(d.x-n.x)/n.width,f.y2=(d.y-n.y)/n.height;var p=s.cloneNode(!0);$$1(p).attr(f),p.id=editorContext_.getNextId(),findDefs().appendChild(p),e.setAttribute(r,"url(#"+p.id+")")}}}},pathMap=[0,"z","M","m","L","l","C","c","Q","q","A","a","H","h","V","v","S","s","T","t"],convertPath=function(e,t){for(var n=e.pathSegList,a=n.numberOfItems,r=0,i=0,s="",o=null,l=0;l=$-S&&v<=$+S&&m>=E-S&&m<=E+S){w=!0;break}}s=editorContext_.getId(),removePath_(s);var P=getElem(s),A=void 0,T=void 0,N=x.numberOfItems;if(w){if(C<=1&&N>=2){var G=x.getItem(0).x,L=x.getItem(0).y;A=4===(T=b.pathSegList.getItem(1)).pathSegType?_.createSVGPathSegLinetoAbs(G,L):_.createSVGPathSegCurvetoCubicAbs(G,L,T.x1/g,T.y1/g,G,L);var I=_.createSVGPathSegClosePath();x.appendItem(A),x.appendItem(I)}else if(N<3)return!1;if($$1(b).remove(),_=editorContext_.setDrawnPath(null),editorContext_.setStarted(!1),e){path.matrix&&editorContext_.remapElement(P,{},path.matrix.inverse());var M=P.getAttribute("d"),B=$$1(path.elem).attr("d");return $$1(path.elem).attr("d",B+M),$$1(P).remove(),path.matrix&&recalcRotatedPath(),init$1(),pathActions.toEditMode(path.elem),path.selectPt(),!1}}else{if(!$$1.contains(editorContext_.getContainer(),editorContext_.getMouseTarget(n)))return console.log("Clicked outside canvas"),!1;var O=_.pathSegList.numberOfItems,V=_.pathSegList.getItem(O-1),R=V.x,j=V.y;if(n.shiftKey){var D=snapToAngle(R,j,v,m);v=D.x,m=D.y}A=4===(T=b.pathSegList.getItem(1)).pathSegType?_.createSVGPathSegLinetoAbs(editorContext_.round(v),editorContext_.round(m)):_.createSVGPathSegCurvetoCubicAbs(editorContext_.round(v),editorContext_.round(m),T.x1/g,T.y1/g,T.x2/g,T.y2/g),_.pathSegList.appendItem(A),v*=g,m*=g,b.setAttribute("d",["M",v,m,v,m].join(" ")),y=O,e&&(y+=path.segs.length),addPointGrip(y,v,m)}}else{var F="M"+v+","+m+" ";_=editorContext_.setDrawnPath(editorContext_.addSvgElementFromJson({element:"path",curStyles:!0,attr:{d:F,id:editorContext_.getNextId(),opacity:editorContext_.getOpacity()/2}})),b.setAttribute("d",["M",f,p,f,p].join(" ")),y=e?path.segs.length:0,addPointGrip(y,f,p)}}},mouseMove:function(e,a){var i=editorContext_.getCurrentZoom();r=!0;var s=editorContext_.getDrawnPath();if("path"!==editorContext_.getCurrentMode())if(path.dragging){var o=getPointFromGrip({x:path.dragging[0],y:path.dragging[1]},path),l=getPointFromGrip({x:e,y:a},path),u=l.x-o.x,c=l.y-o.y;path.dragging=[e,a],path.dragctrl?path.moveCtrl(u,c):path.movePts(u,c)}else path.selected_pts=[],path.eachSeg(function(e){if(this.next||this.prev){var t=editorContext_.getRubberBox().getBBox(),n=getGripPt(this),a={x:n.x,y:n.y,width:0,height:0},r=rectsIntersect(t,a);this.select(r),r&&path.selected_pts.push(this.index)}});else{if(!s)return;var h=s.pathSegList,d=h.numberOfItems-1;if(t){var f=addCtrlGrip("1c1"),p=addCtrlGrip("0c2");f.setAttribute("cx",e),f.setAttribute("cy",a),f.setAttribute("display","inline");var g=t[0],v=t[1],m=g+(g-e/i),b=v+(v-a/i);p.setAttribute("cx",m*i),p.setAttribute("cy",b*i),p.setAttribute("display","inline");var y=getCtrlLine(1);if(assignAttributes(y,{x1:e,y1:a,x2:m*i,y2:b*i,display:"inline"}),0===d)n=[e,a];else{var _=h.getItem(d-1),x=_.x,C=_.y;6===_.pathSegType?(x+=x-_.x2,C+=C-_.y2):n&&(x=n[0]/i,C=n[1]/i),replacePathSeg(6,d,[g,v,x,C,m,b],s)}}else{var S=getElem("path_stretch_line");if(S){var w=h.getItem(d);if(6===w.pathSegType){var k=w.x+(w.x-w.x2),$=w.y+(w.y-w.y2);replacePathSeg(6,1,[e,a,k*i,$*i,e,a],S)}else n?replacePathSeg(6,1,[e,a,n[0],n[1],e,a],S):replacePathSeg(4,1,[e,a],S)}}}},mouseUp:function(e,a,i,s){var o=editorContext_.getDrawnPath();if("path"===editorContext_.getCurrentMode())return t=null,o||(a=getElem(editorContext_.getId()),editorContext_.setStarted(!1),n=null),{keep:!0,element:a};var l=editorContext_.getRubberBox();if(path.dragging){var u=path.cur_pt;path.dragging=!1,path.dragctrl=!1,path.update(),r&&path.endChanges("Move path point(s)"),e.shiftKey||r||path.selectPt(u)}else l&&"none"!==l.getAttribute("display")?(l.setAttribute("display","none"),l.getAttribute("width")<=2&&l.getAttribute("height")<=2&&pathActions.toSelectMode(e.target)):pathActions.toSelectMode(e.target);r=!1},toEditMode:function(t){path=getPath_(t),editorContext_.setCurrentMode("pathedit"),editorContext_.clearSelection(),path.show(!0).update(),path.oldbbox=getBBox(path.elem),e=!1},toSelectMode:function(e){var t=e===path.elem;editorContext_.setCurrentMode("select"),path.show(!1),a=!1,editorContext_.clearSelection(),path.matrix&&recalcRotatedPath(),t&&(editorContext_.call("selected",[e]),editorContext_.addToSelection([e],!0))},addSubPath:function(t){t?(editorContext_.setCurrentMode("path"),e=!0):(pathActions.clear(!0),pathActions.toEditMode(path.elem))},select:function(e){a===e?(pathActions.toEditMode(e),editorContext_.setCurrentMode("pathedit")):a=e},reorient:function(){var e=editorContext_.getSelectedElements()[0];if(e&&0!==getRotationAngle(e)){var t=new BatchCommand("Reorient path"),n={d:e.getAttribute("d"),transform:e.getAttribute("transform")};t.addSubCommand(new ChangeElementCommand(e,n)),editorContext_.clearSelection(),this.resetOrientation(e),editorContext_.addCommandToHistory(t),getPath_(e).show(!1).matrix=null,this.clear(),editorContext_.addToSelection([e],!0),editorContext_.call("changed",editorContext_.getSelectedElements())}},clear:function(e){var t=editorContext_.getDrawnPath();if(a=null,t){var r=getElem(editorContext_.getId());$$1(getElem("path_stretch_line")).remove(),$$1(r).remove(),$$1(getElem("pathpointgrip_container")).find("*").attr("display","none"),n=null,editorContext_.setDrawnPath(null),editorContext_.setStarted(!1)}else"pathedit"===editorContext_.getCurrentMode()&&this.toSelectMode();path&&path.init().show(!1)},resetOrientation:function(e){if(null==e||"path"!==e.nodeName)return!1;var t=getTransformList(e),n=transformListToTransform(t).matrix;t.clear(),e.removeAttribute("transform");for(var a=e.pathSegList,r=a.numberOfItems,i=function(t){var r=a.getItem(t),i=r.pathSegType;if(1===i)return"continue";var s=[];$$1.each(["",1,2],function(e,t){var a=r["x"+t],i=r["y"+t];if(void 0!==a&&void 0!==i){var o=transformPoint(a,i,n);s.splice(s.length,0,o.x,o.y)}}),replacePathSeg(i,t,s,e)},s=0;s0){var o=t.getItem(n-1).pathSegType;if(2===o){a(n-1,1),e();break}if(1===o&&t.numberOfItems-1===n){a(n,1),e();break}}}return!1}(),path.elem.pathSegList.numberOfItems<=1)return pathActions.toSelectMode(path.elem),void editorContext_.canvas.deleteSelectedElements();if(path.init(),path.clearSelection(),window.opera){var a=$$1(path.elem);a.attr("d",a.attr("d"))}path.endChanges("Delete path node(s)")}},smoothPolylineIntoPath:function(e){var t=void 0,n=e.points,a=n.numberOfItems;if(a>=4){var r=n.getItem(0),i=null,s=[];for(s.push(["M",r.x,",",r.y," C"].join("")),t=1;t<=a-4;t+=3){var o=n.getItem(t),l=n.getItem(t+1),u=n.getItem(t+2);if(i){var c=smoothControlPoints(i,o,r);if(c&&2===c.length){var h=s[s.length-1].split(",");h[2]=c[0].x,h[3]=c[0].y,s[s.length-1]=h.join(","),o=c[1]}}s.push([o.x,o.y,l.x,l.y,u.x,u.y].join(",")),r=u,i=l}for(s.push("L");t/g,">").replace(/"/g,""").replace(/'/,"'")},encode64=function(e){if(e=encodeUTF8(e),window.btoa)return window.btoa(e);var t=[];t.length=4*Math.floor((e.length+2)/3);var n=0,a=0;do{var r=e.charCodeAt(n++),i=e.charCodeAt(n++),s=e.charCodeAt(n++),o=r>>2,l=(3&r)<<4|i>>4,u=(15&i)<<2|s>>6,c=63&s;isNaN(i)?u=c=64:isNaN(s)&&(c=64),t[a++]=KEYSTR.charAt(o),t[a++]=KEYSTR.charAt(l),t[a++]=KEYSTR.charAt(u),t[a++]=KEYSTR.charAt(c)}while(n>4,l=(15&r)<<4|i>>2,u=(3&i)<<6|s;t+=String.fromCharCode(o),64!==i&&(t+=String.fromCharCode(l)),64!==s&&(t+=String.fromCharCode(u))}while(nSVG-edit