3 lines
370 KiB
JavaScript
3 lines
370 KiB
JavaScript
function _typeof(e){return(_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})(e)}function asyncGeneratorStep(e,t,n,r,a,i,s){try{var o=e[i](s),l=o.value}catch(e){return void n(e)}o.done?t(l):Promise.resolve(l).then(r,a)}function _asyncToGenerator(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var i=e.apply(t,n);function s(e){asyncGeneratorStep(i,r,a,s,o,"next",e)}function o(e){asyncGeneratorStep(i,r,a,s,o,"throw",e)}s(void 0)})}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function _createClass(e,t,n){return t&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),e}function _extends(){return(_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_setPrototypeOf(e,t)}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _possibleConstructorReturn(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?_assertThisInitialized(e):t}function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_nonIterableRest()}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_nonIterableSpread()}function _arrayWithoutHoles(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _iterableToArray(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}function _iterableToArrayLimit(e,t){var n=[],r=!0,a=!1,i=void 0;try{for(var s,o=e[Symbol.iterator]();!(r=(s=o.next()).done)&&(n.push(s.value),!t||n.length!==t);r=!0);}catch(e){a=!0,i=e}finally{try{r||null==o.return||o.return()}finally{if(a)throw i}}return n}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance")}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function touchHandler(e){var t=e.changedTouches,n=t[0],r="";switch(e.type){case"touchstart":r="mousedown";break;case"touchmove":r="mousemove";break;case"touchend":r="mouseup";break;default:return}var a=n.screenX,i=n.screenY,s=n.clientX,o=n.clientY,l=new MouseEvent(r,{bubbles:!0,cancelable:!0,view:window,detail:1,screenX:a,screenY:i,clientX:s,clientY:o,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,button:0,relatedTarget:null});t.length<2&&(n.target.dispatchEvent(l),e.preventDefault())}document.addEventListener("touchstart",touchHandler,!0),document.addEventListener("touchmove",touchHandler,!0),document.addEventListener("touchend",touchHandler,!0),document.addEventListener("touchcancel",touchHandler,!0);var NS={HTML:"http://www.w3.org/1999/xhtml",MATH:"http://www.w3.org/1998/Math/MathML",SE:"http://svg-edit.googlecode.com",SVG:"http://www.w3.org/2000/svg",XLINK:"http://www.w3.org/1999/xlink",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"},getReverseNS=function(){var e={};return Object.entries(NS).forEach(function(t){var n=_slicedToArray(t,2),r=n[0],a=n[1];e[a]=r.toLowerCase()}),e};!function(){if(!("SVGPathSeg"in window)){var e=function(){function e(t,n,r){_classCallCheck(this,e),this.pathSegType=t,this.pathSegTypeAsLetter=n,this._owningPathSegList=r}return _createClass(e,[{key:"_segmentChanged",value:function(){this._owningPathSegList&&this._owningPathSegList.segmentChanged(this)}}]),e}();e.prototype.classname="SVGPathSeg",e.PATHSEG_UNKNOWN=0,e.PATHSEG_CLOSEPATH=1,e.PATHSEG_MOVETO_ABS=2,e.PATHSEG_MOVETO_REL=3,e.PATHSEG_LINETO_ABS=4,e.PATHSEG_LINETO_REL=5,e.PATHSEG_CURVETO_CUBIC_ABS=6,e.PATHSEG_CURVETO_CUBIC_REL=7,e.PATHSEG_CURVETO_QUADRATIC_ABS=8,e.PATHSEG_CURVETO_QUADRATIC_REL=9,e.PATHSEG_ARC_ABS=10,e.PATHSEG_ARC_REL=11,e.PATHSEG_LINETO_HORIZONTAL_ABS=12,e.PATHSEG_LINETO_HORIZONTAL_REL=13,e.PATHSEG_LINETO_VERTICAL_ABS=14,e.PATHSEG_LINETO_VERTICAL_REL=15,e.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS=16,e.PATHSEG_CURVETO_CUBIC_SMOOTH_REL=17,e.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS=18,e.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL=19;var t=function(t){function n(t){return _classCallCheck(this,n),_possibleConstructorReturn(this,_getPrototypeOf(n).call(this,e.PATHSEG_CLOSEPATH,"z",t))}return _inherits(n,e),_createClass(n,[{key:"toString",value:function(){return"[object SVGPathSegClosePath]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter}},{key:"clone",value:function(){return new n(void 0)}}]),n}(),n=function(t){function n(t,r,a){var i;return _classCallCheck(this,n),(i=_possibleConstructorReturn(this,_getPrototypeOf(n).call(this,e.PATHSEG_MOVETO_ABS,"M",t)))._x=r,i._y=a,i}return _inherits(n,e),_createClass(n,[{key:"toString",value:function(){return"[object SVGPathSegMovetoAbs]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y}},{key:"clone",value:function(){return new n(void 0,this._x,this._y)}}]),n}();Object.defineProperties(n.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0}});var r=function(t){function n(t,r,a){var i;return _classCallCheck(this,n),(i=_possibleConstructorReturn(this,_getPrototypeOf(n).call(this,e.PATHSEG_MOVETO_REL,"m",t)))._x=r,i._y=a,i}return _inherits(n,e),_createClass(n,[{key:"toString",value:function(){return"[object SVGPathSegMovetoRel]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y}},{key:"clone",value:function(){return new n(void 0,this._x,this._y)}}]),n}();Object.defineProperties(r.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0}});var a=function(t){function n(t,r,a){var i;return _classCallCheck(this,n),(i=_possibleConstructorReturn(this,_getPrototypeOf(n).call(this,e.PATHSEG_LINETO_ABS,"L",t)))._x=r,i._y=a,i}return _inherits(n,e),_createClass(n,[{key:"toString",value:function(){return"[object SVGPathSegLinetoAbs]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y}},{key:"clone",value:function(){return new n(void 0,this._x,this._y)}}]),n}();Object.defineProperties(a.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0}});var i=function(t){function n(t,r,a){var i;return _classCallCheck(this,n),(i=_possibleConstructorReturn(this,_getPrototypeOf(n).call(this,e.PATHSEG_LINETO_REL,"l",t)))._x=r,i._y=a,i}return _inherits(n,e),_createClass(n,[{key:"toString",value:function(){return"[object SVGPathSegLinetoRel]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y}},{key:"clone",value:function(){return new n(void 0,this._x,this._y)}}]),n}();Object.defineProperties(i.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0}});var s=function(t){function n(t,r,a,i,s,o,l){var c;return _classCallCheck(this,n),(c=_possibleConstructorReturn(this,_getPrototypeOf(n).call(this,e.PATHSEG_CURVETO_CUBIC_ABS,"C",t)))._x=r,c._y=a,c._x1=i,c._y1=s,c._x2=o,c._y2=l,c}return _inherits(n,e),_createClass(n,[{key:"toString",value:function(){return"[object SVGPathSegCurvetoCubicAbs]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x1+" "+this._y1+" "+this._x2+" "+this._y2+" "+this._x+" "+this._y}},{key:"clone",value:function(){return new n(void 0,this._x,this._y,this._x1,this._y1,this._x2,this._y2)}}]),n}();Object.defineProperties(s.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0},x1:{get:function(){return this._x1},set:function(e){this._x1=e,this._segmentChanged()},enumerable:!0},y1:{get:function(){return this._y1},set:function(e){this._y1=e,this._segmentChanged()},enumerable:!0},x2:{get:function(){return this._x2},set:function(e){this._x2=e,this._segmentChanged()},enumerable:!0},y2:{get:function(){return this._y2},set:function(e){this._y2=e,this._segmentChanged()},enumerable:!0}});var o=function(t){function n(t,r,a,i,s,o,l){var c;return _classCallCheck(this,n),(c=_possibleConstructorReturn(this,_getPrototypeOf(n).call(this,e.PATHSEG_CURVETO_CUBIC_REL,"c",t)))._x=r,c._y=a,c._x1=i,c._y1=s,c._x2=o,c._y2=l,c}return _inherits(n,e),_createClass(n,[{key:"toString",value:function(){return"[object SVGPathSegCurvetoCubicRel]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x1+" "+this._y1+" "+this._x2+" "+this._y2+" "+this._x+" "+this._y}},{key:"clone",value:function(){return new n(void 0,this._x,this._y,this._x1,this._y1,this._x2,this._y2)}}]),n}();Object.defineProperties(o.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0},x1:{get:function(){return this._x1},set:function(e){this._x1=e,this._segmentChanged()},enumerable:!0},y1:{get:function(){return this._y1},set:function(e){this._y1=e,this._segmentChanged()},enumerable:!0},x2:{get:function(){return this._x2},set:function(e){this._x2=e,this._segmentChanged()},enumerable:!0},y2:{get:function(){return this._y2},set:function(e){this._y2=e,this._segmentChanged()},enumerable:!0}});var l=function(t){function n(t,r,a,i,s){var o;return _classCallCheck(this,n),(o=_possibleConstructorReturn(this,_getPrototypeOf(n).call(this,e.PATHSEG_CURVETO_QUADRATIC_ABS,"Q",t)))._x=r,o._y=a,o._x1=i,o._y1=s,o}return _inherits(n,e),_createClass(n,[{key:"toString",value:function(){return"[object SVGPathSegCurvetoQuadraticAbs]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x1+" "+this._y1+" "+this._x+" "+this._y}},{key:"clone",value:function(){return new n(void 0,this._x,this._y,this._x1,this._y1)}}]),n}();Object.defineProperties(l.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0},x1:{get:function(){return this._x1},set:function(e){this._x1=e,this._segmentChanged()},enumerable:!0},y1:{get:function(){return this._y1},set:function(e){this._y1=e,this._segmentChanged()},enumerable:!0}});var c=function(t){function n(t,r,a,i,s){var o;return _classCallCheck(this,n),(o=_possibleConstructorReturn(this,_getPrototypeOf(n).call(this,e.PATHSEG_CURVETO_QUADRATIC_REL,"q",t)))._x=r,o._y=a,o._x1=i,o._y1=s,o}return _inherits(n,e),_createClass(n,[{key:"toString",value:function(){return"[object SVGPathSegCurvetoQuadraticRel]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x1+" "+this._y1+" "+this._x+" "+this._y}},{key:"clone",value:function(){return new n(void 0,this._x,this._y,this._x1,this._y1)}}]),n}();Object.defineProperties(c.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0},x1:{get:function(){return this._x1},set:function(e){this._x1=e,this._segmentChanged()},enumerable:!0},y1:{get:function(){return this._y1},set:function(e){this._y1=e,this._segmentChanged()},enumerable:!0}});var u=function(t){function n(t,r,a,i,s,o,l,c){var u;return _classCallCheck(this,n),(u=_possibleConstructorReturn(this,_getPrototypeOf(n).call(this,e.PATHSEG_ARC_ABS,"A",t)))._x=r,u._y=a,u._r1=i,u._r2=s,u._angle=o,u._largeArcFlag=l,u._sweepFlag=c,u}return _inherits(n,e),_createClass(n,[{key:"toString",value:function(){return"[object SVGPathSegArcAbs]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._r1+" "+this._r2+" "+this._angle+" "+(this._largeArcFlag?"1":"0")+" "+(this._sweepFlag?"1":"0")+" "+this._x+" "+this._y}},{key:"clone",value:function(){return new n(void 0,this._x,this._y,this._r1,this._r2,this._angle,this._largeArcFlag,this._sweepFlag)}}]),n}();Object.defineProperties(u.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0},r1:{get:function(){return this._r1},set:function(e){this._r1=e,this._segmentChanged()},enumerable:!0},r2:{get:function(){return this._r2},set:function(e){this._r2=e,this._segmentChanged()},enumerable:!0},angle:{get:function(){return this._angle},set:function(e){this._angle=e,this._segmentChanged()},enumerable:!0},largeArcFlag:{get:function(){return this._largeArcFlag},set:function(e){this._largeArcFlag=e,this._segmentChanged()},enumerable:!0},sweepFlag:{get:function(){return this._sweepFlag},set:function(e){this._sweepFlag=e,this._segmentChanged()},enumerable:!0}});var d=function(t){function n(t,r,a,i,s,o,l,c){var u;return _classCallCheck(this,n),(u=_possibleConstructorReturn(this,_getPrototypeOf(n).call(this,e.PATHSEG_ARC_REL,"a",t)))._x=r,u._y=a,u._r1=i,u._r2=s,u._angle=o,u._largeArcFlag=l,u._sweepFlag=c,u}return _inherits(n,e),_createClass(n,[{key:"toString",value:function(){return"[object SVGPathSegArcRel]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._r1+" "+this._r2+" "+this._angle+" "+(this._largeArcFlag?"1":"0")+" "+(this._sweepFlag?"1":"0")+" "+this._x+" "+this._y}},{key:"clone",value:function(){return new n(void 0,this._x,this._y,this._r1,this._r2,this._angle,this._largeArcFlag,this._sweepFlag)}}]),n}();Object.defineProperties(d.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0},r1:{get:function(){return this._r1},set:function(e){this._r1=e,this._segmentChanged()},enumerable:!0},r2:{get:function(){return this._r2},set:function(e){this._r2=e,this._segmentChanged()},enumerable:!0},angle:{get:function(){return this._angle},set:function(e){this._angle=e,this._segmentChanged()},enumerable:!0},largeArcFlag:{get:function(){return this._largeArcFlag},set:function(e){this._largeArcFlag=e,this._segmentChanged()},enumerable:!0},sweepFlag:{get:function(){return this._sweepFlag},set:function(e){this._sweepFlag=e,this._segmentChanged()},enumerable:!0}});var h=function(t){function n(t,r){var a;return _classCallCheck(this,n),(a=_possibleConstructorReturn(this,_getPrototypeOf(n).call(this,e.PATHSEG_LINETO_HORIZONTAL_ABS,"H",t)))._x=r,a}return _inherits(n,e),_createClass(n,[{key:"toString",value:function(){return"[object SVGPathSegLinetoHorizontalAbs]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x}},{key:"clone",value:function(){return new n(void 0,this._x)}}]),n}();Object.defineProperty(h.prototype,"x",{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0});var p=function(t){function n(t,r){var a;return _classCallCheck(this,n),(a=_possibleConstructorReturn(this,_getPrototypeOf(n).call(this,e.PATHSEG_LINETO_HORIZONTAL_REL,"h",t)))._x=r,a}return _inherits(n,e),_createClass(n,[{key:"toString",value:function(){return"[object SVGPathSegLinetoHorizontalRel]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x}},{key:"clone",value:function(){return new n(void 0,this._x)}}]),n}();Object.defineProperty(p.prototype,"x",{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0});var g=function(t){function n(t,r){var a;return _classCallCheck(this,n),(a=_possibleConstructorReturn(this,_getPrototypeOf(n).call(this,e.PATHSEG_LINETO_VERTICAL_ABS,"V",t)))._y=r,a}return _inherits(n,e),_createClass(n,[{key:"toString",value:function(){return"[object SVGPathSegLinetoVerticalAbs]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._y}},{key:"clone",value:function(){return new n(void 0,this._y)}}]),n}();Object.defineProperty(g.prototype,"y",{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0});var f=function(t){function n(t,r){var a;return _classCallCheck(this,n),(a=_possibleConstructorReturn(this,_getPrototypeOf(n).call(this,e.PATHSEG_LINETO_VERTICAL_REL,"v",t)))._y=r,a}return _inherits(n,e),_createClass(n,[{key:"toString",value:function(){return"[object SVGPathSegLinetoVerticalRel]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._y}},{key:"clone",value:function(){return new n(void 0,this._y)}}]),n}();Object.defineProperty(f.prototype,"y",{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0});var m=function(t){function n(t,r,a,i,s){var o;return _classCallCheck(this,n),(o=_possibleConstructorReturn(this,_getPrototypeOf(n).call(this,e.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS,"S",t)))._x=r,o._y=a,o._x2=i,o._y2=s,o}return _inherits(n,e),_createClass(n,[{key:"toString",value:function(){return"[object SVGPathSegCurvetoCubicSmoothAbs]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x2+" "+this._y2+" "+this._x+" "+this._y}},{key:"clone",value:function(){return new n(void 0,this._x,this._y,this._x2,this._y2)}}]),n}();Object.defineProperties(m.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0},x2:{get:function(){return this._x2},set:function(e){this._x2=e,this._segmentChanged()},enumerable:!0},y2:{get:function(){return this._y2},set:function(e){this._y2=e,this._segmentChanged()},enumerable:!0}});var v=function(t){function n(t,r,a,i,s){var o;return _classCallCheck(this,n),(o=_possibleConstructorReturn(this,_getPrototypeOf(n).call(this,e.PATHSEG_CURVETO_CUBIC_SMOOTH_REL,"s",t)))._x=r,o._y=a,o._x2=i,o._y2=s,o}return _inherits(n,e),_createClass(n,[{key:"toString",value:function(){return"[object SVGPathSegCurvetoCubicSmoothRel]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x2+" "+this._y2+" "+this._x+" "+this._y}},{key:"clone",value:function(){return new n(void 0,this._x,this._y,this._x2,this._y2)}}]),n}();Object.defineProperties(v.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0},x2:{get:function(){return this._x2},set:function(e){this._x2=e,this._segmentChanged()},enumerable:!0},y2:{get:function(){return this._y2},set:function(e){this._y2=e,this._segmentChanged()},enumerable:!0}});var _=function(t){function n(t,r,a){var i;return _classCallCheck(this,n),(i=_possibleConstructorReturn(this,_getPrototypeOf(n).call(this,e.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS,"T",t)))._x=r,i._y=a,i}return _inherits(n,e),_createClass(n,[{key:"toString",value:function(){return"[object SVGPathSegCurvetoQuadraticSmoothAbs]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y}},{key:"clone",value:function(){return new n(void 0,this._x,this._y)}}]),n}();Object.defineProperties(_.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0}});var b=function(t){function n(t,r,a){var i;return _classCallCheck(this,n),(i=_possibleConstructorReturn(this,_getPrototypeOf(n).call(this,e.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL,"t",t)))._x=r,i._y=a,i}return _inherits(n,e),_createClass(n,[{key:"toString",value:function(){return"[object SVGPathSegCurvetoQuadraticSmoothRel]"}},{key:"_asPathString",value:function(){return this.pathSegTypeAsLetter+" "+this._x+" "+this._y}},{key:"clone",value:function(){return new n(void 0,this._x,this._y)}}]),n}();Object.defineProperties(b.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0},y:{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0}}),SVGPathElement.prototype.createSVGPathSegClosePath=function(){return new t(void 0)},SVGPathElement.prototype.createSVGPathSegMovetoAbs=function(e,t){return new n(void 0,e,t)},SVGPathElement.prototype.createSVGPathSegMovetoRel=function(e,t){return new r(void 0,e,t)},SVGPathElement.prototype.createSVGPathSegLinetoAbs=function(e,t){return new a(void 0,e,t)},SVGPathElement.prototype.createSVGPathSegLinetoRel=function(e,t){return new i(void 0,e,t)},SVGPathElement.prototype.createSVGPathSegCurvetoCubicAbs=function(e,t,n,r,a,i){return new s(void 0,e,t,n,r,a,i)},SVGPathElement.prototype.createSVGPathSegCurvetoCubicRel=function(e,t,n,r,a,i){return new o(void 0,e,t,n,r,a,i)},SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticAbs=function(e,t,n,r){return new l(void 0,e,t,n,r)},SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticRel=function(e,t,n,r){return new c(void 0,e,t,n,r)},SVGPathElement.prototype.createSVGPathSegArcAbs=function(e,t,n,r,a,i,s){return new u(void 0,e,t,n,r,a,i,s)},SVGPathElement.prototype.createSVGPathSegArcRel=function(e,t,n,r,a,i,s){return new d(void 0,e,t,n,r,a,i,s)},SVGPathElement.prototype.createSVGPathSegLinetoHorizontalAbs=function(e){return new h(void 0,e)},SVGPathElement.prototype.createSVGPathSegLinetoHorizontalRel=function(e){return new p(void 0,e)},SVGPathElement.prototype.createSVGPathSegLinetoVerticalAbs=function(e){return new g(void 0,e)},SVGPathElement.prototype.createSVGPathSegLinetoVerticalRel=function(e){return new f(void 0,e)},SVGPathElement.prototype.createSVGPathSegCurvetoCubicSmoothAbs=function(e,t,n,r){return new m(void 0,e,t,n,r)},SVGPathElement.prototype.createSVGPathSegCurvetoCubicSmoothRel=function(e,t,n,r){return new v(void 0,e,t,n,r)},SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticSmoothAbs=function(e,t){return new _(void 0,e,t)},SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticSmoothRel=function(e,t){return new b(void 0,e,t)},"getPathSegAtLength"in SVGPathElement.prototype||(SVGPathElement.prototype.getPathSegAtLength=function(e){if(void 0===e||!isFinite(e))throw new Error("Invalid arguments.");var t=document.createElementNS("http://www.w3.org/2000/svg","path");t.setAttribute("d",this.getAttribute("d"));var n=t.pathSegList.numberOfItems-1;if(n<=0)return 0;do{if(t.pathSegList.removeItem(n),e>t.getTotalLength())break;n--}while(n>0);return n}),window.SVGPathSeg=e,window.SVGPathSegClosePath=t,window.SVGPathSegMovetoAbs=n,window.SVGPathSegMovetoRel=r,window.SVGPathSegLinetoAbs=a,window.SVGPathSegLinetoRel=i,window.SVGPathSegCurvetoCubicAbs=s,window.SVGPathSegCurvetoCubicRel=o,window.SVGPathSegCurvetoQuadraticAbs=l,window.SVGPathSegCurvetoQuadraticRel=c,window.SVGPathSegArcAbs=u,window.SVGPathSegArcRel=d,window.SVGPathSegLinetoHorizontalAbs=h,window.SVGPathSegLinetoHorizontalRel=p,window.SVGPathSegLinetoVerticalAbs=g,window.SVGPathSegLinetoVerticalRel=f,window.SVGPathSegCurvetoCubicSmoothAbs=m,window.SVGPathSegCurvetoCubicSmoothRel=v,window.SVGPathSegCurvetoQuadraticSmoothAbs=_,window.SVGPathSegCurvetoQuadraticSmoothRel=b}if(!("SVGPathSegList"in window&&"appendItem"in window.SVGPathSegList.prototype)){var y=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}(),r=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<this._endIndex&&this._isCurrentSpace();)this._currentIndex++;return this._currentIndex<this._endIndex}},{key:"_skipOptionalSpacesOrDelimiter",value:function(){return!(this._currentIndex<this._endIndex&&!this._isCurrentSpace()&&","!==this._string.charAt(this._currentIndex))&&(this._skipOptionalSpaces()&&this._currentIndex<this._endIndex&&","===this._string.charAt(this._currentIndex)&&(this._currentIndex++,this._skipOptionalSpaces()),this._currentIndex<this._endIndex)}},{key:"hasMoreData",value:function(){return this._currentIndex<this._endIndex}},{key:"peekSegmentType",value:function(){var e=this._string[this._currentIndex];return this._pathSegTypeFromChar(e)}},{key:"_pathSegTypeFromChar",value:function(e){switch(e){case"Z":case"z":return SVGPathSeg.PATHSEG_CLOSEPATH;case"M":return SVGPathSeg.PATHSEG_MOVETO_ABS;case"m":return SVGPathSeg.PATHSEG_MOVETO_REL;case"L":return SVGPathSeg.PATHSEG_LINETO_ABS;case"l":return SVGPathSeg.PATHSEG_LINETO_REL;case"C":return SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS;case"c":return SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL;case"Q":return SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS;case"q":return SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL;case"A":return SVGPathSeg.PATHSEG_ARC_ABS;case"a":return SVGPathSeg.PATHSEG_ARC_REL;case"H":return SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS;case"h":return SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL;case"V":return SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS;case"v":return SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL;case"S":return SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS;case"s":return SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL;case"T":return SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS;case"t":return SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL;default:return SVGPathSeg.PATHSEG_UNKNOWN}}},{key:"_nextCommandHelper",value:function(e,t){return("+"===e||"-"===e||"."===e||e>="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,r=0,a=1,i=1,s=this._currentIndex;if(this._skipOptionalSpaces(),this._currentIndex<this._endIndex&&"+"===this._string.charAt(this._currentIndex)?this._currentIndex++:this._currentIndex<this._endIndex&&"-"===this._string.charAt(this._currentIndex)&&(this._currentIndex++,a=-1),!(this._currentIndex===this._endIndex||(this._string.charAt(this._currentIndex)<"0"||this._string.charAt(this._currentIndex)>"9")&&"."!==this._string.charAt(this._currentIndex))){for(var o=this._currentIndex;this._currentIndex<this._endIndex&&this._string.charAt(this._currentIndex)>="0"&&this._string.charAt(this._currentIndex)<="9";)this._currentIndex++;if(this._currentIndex!==o)for(var l=this._currentIndex-1,c=1;l>=o;)t+=c*(this._string.charAt(l--)-"0"),c*=10;if(this._currentIndex<this._endIndex&&"."===this._string.charAt(this._currentIndex)){if(this._currentIndex++,this._currentIndex>=this._endIndex||this._string.charAt(this._currentIndex)<"0"||this._string.charAt(this._currentIndex)>"9")return;for(;this._currentIndex<this._endIndex&&this._string.charAt(this._currentIndex)>="0"&&this._string.charAt(this._currentIndex)<="9";)n*=10,r+=(this._string.charAt(this._currentIndex)-"0")/n,this._currentIndex+=1}if(this._currentIndex!==s&&this._currentIndex+1<this._endIndex&&("e"===this._string.charAt(this._currentIndex)||"E"===this._string.charAt(this._currentIndex))&&"x"!==this._string.charAt(this._currentIndex+1)&&"m"!==this._string.charAt(this._currentIndex+1)){if(this._currentIndex++,"+"===this._string.charAt(this._currentIndex)?this._currentIndex++:"-"===this._string.charAt(this._currentIndex)&&(this._currentIndex++,i=-1),this._currentIndex>=this._endIndex||this._string.charAt(this._currentIndex)<"0"||this._string.charAt(this._currentIndex)>"9")return;for(;this._currentIndex<this._endIndex&&this._string.charAt(this._currentIndex)>="0"&&this._string.charAt(this._currentIndex)<="9";)e*=10,e+=this._string.charAt(this._currentIndex)-"0",this._currentIndex++}var u=t+r;if(u*=a,e&&(u*=Math.pow(10,i*e)),s!==this._currentIndex)return this._skipOptionalSpacesOrDelimiter(),u}}},{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 r={x1:this._parseNumber(),y1:this._parseNumber(),x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicRel(t,r.x,r.y,r.x1,r.y1,r.x2,r.y2);case SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS:var a={x1:this._parseNumber(),y1:this._parseNumber(),x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicAbs(t,a.x,a.y,a.x1,a.y1,a.x2,a.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 c={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,c.x,c.y,c.x1,c.y1,c.arcAngle,c.arcLarge,c.arcSweep);case SVGPathSeg.PATHSEG_ARC_ABS: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 SVGPathSegArcAbs(t,u.x,u.y,u.x1,u.y1,u.arcAngle,u.arcLarge,u.arcSweep);default:throw new Error("Unknown path seg type.")}}}]),e}(),a=new n,i=new r(e);if(!i.initialCommandIsMoveTo())return[];for(;i.hasMoreData();){var s=i.parseSegment();if(!s)return[];a.appendSegment(s)}return a.pathSegList}}]),e}();y.prototype.classname="SVGPathSegList",Object.defineProperty(y.prototype,"numberOfItems",{get:function(){return this._checkPathSynchronizedToList(),this._list.length},enumerable:!0}),y._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 y(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=y}}();var $=jQuery,supportsSVG_=Boolean(document.createElementNS&&document.createElementNS(NS.SVG,"svg").createSVGRect),_navigator=navigator,userAgent=_navigator.userAgent,svg=document.createElementNS(NS.SVG,"svg"),isOpera_=Boolean(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_=Boolean(svg.querySelector),supportsXpath_=Boolean(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.append(e),t.setAttribute("x",5),e.append(t);var n=document.createElementNS(NS.SVG,"text");n.textContent="a",t.append(n);try{return 0===n.getStartPositionOfChar(0).x}catch(e){return!1}finally{e.remove()}}(),supportsPathBBox_=function(){var e=document.createElementNS(NS.SVG,"svg");document.documentElement.append(e);var t=document.createElementNS(NS.SVG,"path");t.setAttribute("d","M0,0 C0,0 10,10 10,0"),e.append(t);var n=t.getBBox();return e.remove(),n.height>4&&n.height<5}(),supportsHVLineContainerBBox_=function(){var e=document.createElementNS(NS.SVG,"svg");document.documentElement.append(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 r=document.createElementNS(NS.SVG,"g");r.append(t,n),e.append(r);var a=r.getBBox();return e.remove(),15===a.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 <a href="http://opera.com">latest version</a> 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 jQueryPluginSVG(e){var t=e.fn.attr;return e.fn.attr=function(e,n){var r=this.length;if(!r)return t.call(this,e,n);for(var a=0;a<r;++a){var i=this[a];if("http://www.w3.org/2000/svg"!==i.namespaceURI)return t.call(this,e,n);if(void 0!==n)i.setAttribute(e,n);else if(Array.isArray(e)){for(var s={},o=e.length;o--;){var l=e[o],c=i.getAttribute(l);(c||"0"===c)&&(c=isNaN(c)?c:c-0),s[l]=c}return s}if("object"!==_typeof(e)){var u=i.getAttribute(e);return(u||"0"===u)&&(u=isNaN(u)?u:u-0),u}for(var d=Object.entries(e),h=0;h<d.length;h++){var p=_slicedToArray(d[h],2),g=p[0],f=p[1];i.setAttribute(g,f)}}return this},e}var svgroot=document.createElementNS(NS.SVG,"svg");function transformToString(e){var t=e.matrix,n="";switch(e.type){case 1:n="matrix("+[t.a,t.b,t.c,t.d,t.e,t.f].join(",")+")";break;case 2:n="translate("+t.e+","+t.f+")";break;case 3:n=t.a===t.d?"scale("+t.a+")":"scale("+t.a+","+t.d+")";break;case 4:var r=0,a=0;if(0!==e.angle){var i=1-t.a;a=(i*t.f+t.b*t.e)/(i*i+t.b*t.b),r=(t.e-t.b*a)/i}n="rotate("+e.angle+" "+r+","+a+")"}return n}var elementContainer_,listMap_={},SVGTransformList=function(){function e(t){_classCallCheck(this,e),this._elem=t||null,this._xforms=[],this._update=function(){for(var e="",t=0;t<this.numberOfItems;++t){e+=transformToString(this._list.getItem(t))+" "}this._elem.setAttribute("transform",e)},this._list=this,this._init=function(){var e=this,t=this._elem.getAttribute("transform");if(t)for(var n=/\s*((scale|matrix|rotate|translate)\s*\(.*?\))\s*,?\s*/,r=!0;r;)r=t.match(n),t=t.replace(n,""),r&&r[1]&&function(){var t=r[1].split(/\s*\(/),n=t[0],a=t[1].match(/\s*(.*?)\s*\)/);a[1]=a[1].replace(/(\d)-/g,"$1 -");var i=a[1].split(/[, ]+/),s="abcdef".split(""),o=svgroot.createSVGMatrix();Object.values(i).forEach(function(e,t){i[t]=parseFloat(e),"matrix"===n&&(o[s[t]]=i[t])});var l=svgroot.createSVGTransform(),c="set"+n.charAt(0).toUpperCase()+n.slice(1),u="matrix"===n?[o]:i;"scale"===n&&1===u.length?u.push(u[0]):"translate"===n&&1===u.length?u.push(0):"rotate"===n&&1===u.length&&u.push(0,0),l[c].apply(l,_toConsumableArray(u)),e._list.appendItem(l)}()},this._removeFromOtherLists=function(e){e&&Object.values(listMap_).some(function(t){for(var n=0,r=t._xforms.length;n<r;++n)if(t._xforms[n]===e)return t.removeItem(n),!0;return!1})},this.numberOfItems=0}return _createClass(e,[{key:"clear",value:function(){this.numberOfItems=0,this._xforms=[]}},{key:"initialize",value:function(e){this.numberOfItems=1,this._removeFromOtherLists(e),this._xforms=[e]}},{key:"getItem",value:function(e){if(e<this.numberOfItems&&e>=0)return this._xforms[e];var t=new Error("DOMException with code=INDEX_SIZE_ERR");throw t.code=1,t}},{key:"insertItemBefore",value:function(e,t){var n=null;if(t>=0)if(t<this.numberOfItems){this._removeFromOtherLists(e);var r,a=new Array(this.numberOfItems+1);for(r=0;r<t;++r)a[r]=this._xforms[r];a[r]=e;for(var i=r+1;r<this.numberOfItems;++i,++r)a[i]=this._xforms[r];this.numberOfItems++,this._xforms=a,n=e,this._list._update()}else n=this._list.appendItem(e);return n}},{key:"replaceItem",value:function(e,t){var n=null;return t<this.numberOfItems&&t>=0&&(this._removeFromOtherLists(e),this._xforms[t]=e,n=e,this._list._update()),n}},{key:"removeItem",value:function(e){if(e<this.numberOfItems&&e>=0){var t,n=this._xforms[e],r=new Array(this.numberOfItems-1);for(t=0;t<e;++t)r[t]=this._xforms[t];for(var a=t;a<this.numberOfItems-1;++a,++t)r[a]=this._xforms[t+1];return this.numberOfItems--,this._xforms=r,this._list._update(),n}var i=new Error("DOMException with code=INDEX_SIZE_ERR");throw i.code=1,i}},{key:"appendItem",value:function(e){return this._removeFromOtherLists(e),this._xforms.push(e),this.numberOfItems++,this._list._update(),e}}]),e}(),resetListMap=function(){listMap_={}},removeElementFromListMap=function(e){e.id&&listMap_[e.id]&&delete listMap_[e.id]},getTransformList=function(e){if(!supportsNativeTransformLists()){var t=e.id||"temp",n=listMap_[t];return n&&"temp"!==t||(listMap_[t]=new SVGTransformList(e),listMap_[t]._init(),n=listMap_[t]),n}return e.transform?e.transform.baseVal:e.gradientTransform?e.gradientTransform.baseVal:e.patternTransform?e.patternTransform.baseVal:null},wAttrs=["x","x1","cx","rx","width"],hAttrs=["y","y1","cy","ry","height"],unitAttrs=["r","radius"].concat(wAttrs,hAttrs),typeMap_={},init=function(e){elementContainer_=e;var t=document.createElementNS(NS.SVG,"svg");document.body.append(t);var n=document.createElementNS(NS.SVG,"rect");n.setAttribute("width","1em"),n.setAttribute("height","1ex"),n.setAttribute("x","1in"),t.append(n);var r=n.getBBox();t.remove();var a=r.x;typeMap_={em:r.width,ex:r.height,in:a,cm:a/2.54,mm:a/25.4,pt:a/72,pc:a/6,px:1,"%":0}},getTypeMap=function(){return typeMap_},shortFloat=function e(t){var n=elementContainer_.getRoundDigits();return isNaN(t)?Array.isArray(t)?e(t[0])+","+e(t[1]):parseFloat(t).toFixed(n)-0:Number(Number(t).toFixed(n))},convertUnit=function(e,t){return t=t||elementContainer_.getBaseUnit(),shortFloat(e/typeMap_[t])},setUnitAttr=function(e,t,n){e.setAttribute(t,n)},convertToNum=function(e,t){if(!isNaN(t))return t-0;if("%"===t.substr(-1)){var n=t.substr(0,t.length-1)/100,r=elementContainer_.getWidth(),a=elementContainer_.getHeight();return wAttrs.includes(e)?n*r:hAttrs.includes(e)?n*a:n*Math.sqrt(r*r+a*a)/Math.sqrt(2)}var i=t.substr(-2);return t.substr(0,t.length-2)*typeMap_[i]},isValidUnit=function(e,t,n){if(unitAttrs.includes(e))return!isNaN(t)||(t=t.toLowerCase(),Object.keys(typeMap_).some(function(e){return new RegExp("^-?[\\d\\.]+"+e+"$").test(t)}));if("id"===e){var r=!1;try{var a=elementContainer_.getElement(t);r=isNullish(a)||a===n}catch(e){}return r}return!0},HistoryEventTypes={BEFORE_APPLY:"before_apply",AFTER_APPLY:"after_apply",BEFORE_UNAPPLY:"before_unapply",AFTER_UNAPPLY:"after_unapply"},Command=function(){function e(){_classCallCheck(this,e)}return _createClass(e,[{key:"getText",value:function(){return this.text}}]),e}(),MoveElementCommand=function(e){function t(e,n,r,a){var i;return _classCallCheck(this,t),(i=_possibleConstructorReturn(this,_getPrototypeOf(t).call(this))).elem=e,i.text=a?"Move "+e.tagName+" to "+a:"Move "+e.tagName,i.oldNextSibling=n,i.oldParent=r,i.newNextSibling=e.nextSibling,i.newParent=e.parentNode,i}return _inherits(t,Command),_createClass(t,[{key:"type",value:function(){return"svgedit.history.MoveElementCommand"}},{key:"apply",value:function(e){e&&e.handleHistoryEvent(HistoryEventTypes.BEFORE_APPLY,this),this.elem=this.newParent.insertBefore(this.elem,this.newNextSibling),e&&e.handleHistoryEvent(HistoryEventTypes.AFTER_APPLY,this)}},{key:"unapply",value:function(e){e&&e.handleHistoryEvent(HistoryEventTypes.BEFORE_UNAPPLY,this),this.elem=this.oldParent.insertBefore(this.elem,this.oldNextSibling),e&&e.handleHistoryEvent(HistoryEventTypes.AFTER_UNAPPLY,this)}},{key:"elements",value:function(){return[this.elem]}}]),t}();MoveElementCommand.type=MoveElementCommand.prototype.type;var InsertElementCommand=function(e){function t(e,n){var r;return _classCallCheck(this,t),(r=_possibleConstructorReturn(this,_getPrototypeOf(t).call(this))).elem=e,r.text=n||"Create "+e.tagName,r.parent=e.parentNode,r.nextSibling=r.elem.nextSibling,r}return _inherits(t,Command),_createClass(t,[{key:"type",value:function(){return"svgedit.history.InsertElementCommand"}},{key:"apply",value:function(e){e&&e.handleHistoryEvent(HistoryEventTypes.BEFORE_APPLY,this),this.elem=this.parent.insertBefore(this.elem,this.nextSibling),e&&e.handleHistoryEvent(HistoryEventTypes.AFTER_APPLY,this)}},{key:"unapply",value:function(e){e&&e.handleHistoryEvent(HistoryEventTypes.BEFORE_UNAPPLY,this),this.parent=this.elem.parentNode,this.elem=this.elem.parentNode.removeChild(this.elem),e&&e.handleHistoryEvent(HistoryEventTypes.AFTER_UNAPPLY,this)}},{key:"elements",value:function(){return[this.elem]}}]),t}();InsertElementCommand.type=InsertElementCommand.prototype.type;var RemoveElementCommand=function(e){function t(e,n,r,a){var i;return _classCallCheck(this,t),(i=_possibleConstructorReturn(this,_getPrototypeOf(t).call(this))).elem=e,i.text=a||"Delete "+e.tagName,i.nextSibling=n,i.parent=r,removeElementFromListMap(e),i}return _inherits(t,Command),_createClass(t,[{key:"type",value:function(){return"svgedit.history.RemoveElementCommand"}},{key:"apply",value:function(e){e&&e.handleHistoryEvent(HistoryEventTypes.BEFORE_APPLY,this),removeElementFromListMap(this.elem),this.parent=this.elem.parentNode,this.elem=this.parent.removeChild(this.elem),e&&e.handleHistoryEvent(HistoryEventTypes.AFTER_APPLY,this)}},{key:"unapply",value:function(e){e&&e.handleHistoryEvent(HistoryEventTypes.BEFORE_UNAPPLY,this),removeElementFromListMap(this.elem),isNullish(this.nextSibling)&&window.console&&console.log("Error: reference element was lost"),this.parent.insertBefore(this.elem,this.nextSibling),e&&e.handleHistoryEvent(HistoryEventTypes.AFTER_UNAPPLY,this)}},{key:"elements",value:function(){return[this.elem]}}]),t}();RemoveElementCommand.type=RemoveElementCommand.prototype.type;var ChangeElementCommand=function(e){function t(e,n,r){var a;for(var i in _classCallCheck(this,t),(a=_possibleConstructorReturn(this,_getPrototypeOf(t).call(this))).elem=e,a.text=r?"Change "+e.tagName+" "+r:"Change "+e.tagName,a.newValues={},a.oldValues=n,n)a.newValues[i]="#text"===i?e.textContent:"#href"===i?getHref(e):e.getAttribute(i);return a}return _inherits(t,Command),_createClass(t,[{key:"type",value:function(){return"svgedit.history.ChangeElementCommand"}},{key:"apply",value:function(e){var t=this;e&&e.handleHistoryEvent(HistoryEventTypes.BEFORE_APPLY,this);var n=!1;if(Object.entries(this.newValues).forEach(function(e){var r=_slicedToArray(e,2),a=r[0],i=r[1];i?"#text"===a?t.elem.textContent=i:"#href"===a?setHref(t.elem,i):t.elem.setAttribute(a,i):"#text"===a?t.elem.textContent="":(t.elem.setAttribute(a,""),t.elem.removeAttribute(a)),"transform"===a&&(n=!0)}),!n){var r=getRotationAngle(this.elem);if(r){var a=this.elem.getBBox(),i=["rotate(",r," ",a.x+a.width/2,",",a.y+a.height/2,")"].join("");i!==this.elem.getAttribute("transform")&&this.elem.setAttribute("transform",i)}}return e&&e.handleHistoryEvent(HistoryEventTypes.AFTER_APPLY,this),!0}},{key:"unapply",value:function(e){var t=this;e&&e.handleHistoryEvent(HistoryEventTypes.BEFORE_UNAPPLY,this);var n=!1;if(Object.entries(this.oldValues).forEach(function(e){var r=_slicedToArray(e,2),a=r[0],i=r[1];i?"#text"===a?t.elem.textContent=i:"#href"===a?setHref(t.elem,i):t.elem.setAttribute(a,i):"#text"===a?t.elem.textContent="":t.elem.removeAttribute(a),"transform"===a&&(n=!0)}),!n){var r=getRotationAngle(this.elem);if(r){var a=this.elem.getBBox(),i=["rotate(",r," ",a.x+a.width/2,",",a.y+a.height/2,")"].join("");i!==this.elem.getAttribute("transform")&&this.elem.setAttribute("transform",i)}}return removeElementFromListMap(this.elem),e&&e.handleHistoryEvent(HistoryEventTypes.AFTER_UNAPPLY,this),!0}},{key:"elements",value:function(){return[this.elem]}}]),t}();ChangeElementCommand.type=ChangeElementCommand.prototype.type;var BatchCommand=function(e){function t(e){var n;return _classCallCheck(this,t),(n=_possibleConstructorReturn(this,_getPrototypeOf(t).call(this))).text=e||"Batch Command",n.stack=[],n}return _inherits(t,Command),_createClass(t,[{key:"type",value:function(){return"svgedit.history.BatchCommand"}},{key:"apply",value:function(e){e&&e.handleHistoryEvent(HistoryEventTypes.BEFORE_APPLY,this);for(var t=this.stack.length,n=0;n<t;++n)this.stack[n].apply(e);e&&e.handleHistoryEvent(HistoryEventTypes.AFTER_APPLY,this)}},{key:"unapply",value:function(e){e&&e.handleHistoryEvent(HistoryEventTypes.BEFORE_UNAPPLY,this);for(var t=this.stack.length-1;t>=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(),r=n.length;r--;)e.includes(n[r])||e.push(n[r]);return e}},{key:"addSubCommand",value:function(e){this.stack.push(e)}},{key:"isEmpty",value:function(){return!this.stack.length}}]),t}();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.undoStackPointer<this.undoStack.length?this.undoStack[this.undoStackPointer].getText():""}},{key:"undo",value:function(){this.undoStackPointer>0&&this.undoStack[--this.undoStackPointer].unapply(this.handler_)}},{key:"redo",value:function(){this.undoStackPointer<this.undoStack.length&&this.undoStack.length>0&&this.undoStack[this.undoStackPointer++].apply(this.handler_)}},{key:"addCommandToHistory",value:function(e){this.undoStackPointer<this.undoStack.length&&this.undoStack.length>0&&(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,r=t.length,a=new Array(r),i=new Array(r);r--;){var s=t[r];isNullish(s)||(i[r]=s,a[r]=s.getAttribute(e))}this.undoableChangeStack[n]={attrName:e,oldValues:a,elements:i}}},{key:"finishUndoableChange",value:function(){for(var e=this.undoChangeStackPointer--,t=this.undoableChangeStack[e],n=t.attrName,r=new BatchCommand("Change "+n),a=t.elements.length;a--;){var i=t.elements[a];if(!isNullish(i)){var s={};s[n]=t.oldValues[a],s[n]!==i.getAttribute(n)&&r.addSubCommand(new ChangeElementCommand(i,s,n))}}return this.undoableChangeStack[e]=null,r}}]),e}(),hstry=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=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=t.reduceRight(function(e,t){return t.multiply(e)});return Math.abs(r.a)<NEAR_ZERO&&(r.a=0),Math.abs(r.b)<NEAR_ZERO&&(r.b=0),Math.abs(r.c)<NEAR_ZERO&&(r.c=0),Math.abs(r.d)<NEAR_ZERO&&(r.d=0),Math.abs(r.e)<NEAR_ZERO&&(r.e=0),Math.abs(r.f)<NEAR_ZERO&&(r.f=0),r},hasMatrixTransform=function(e){if(!e)return!1;for(var t=e.numberOfItems;t--;){var n=e.getItem(t);if(1===n.type&&!isIdentity(n.matrix))return!0}return!1},transformBox=function(e,t,n,r,a){var i=transformPoint(e,t,a),s=transformPoint(e+n,t,a),o=transformPoint(e,t+r,a),l=transformPoint(e+n,t+r,a),c=Math.min(i.x,s.x,o.x,l.x),u=Math.max(i.x,s.x,o.x,l.x),d=Math.min(i.y,s.y,o.y,l.y);return{tl:i,tr:s,bl:o,br:l,aabox:{x:c,y:d,width:u-c,height:Math.max(i.y,s.y,o.y,l.y)-d}}},transformListToTransform=function(e,t,n){if(isNullish(e))return svg$1.createSVGTransformFromMatrix(svg$1.createSVGMatrix());if(t=t||0,n=n||e.numberOfItems-1,(t=parseInt(t))>(n=parseInt(n))){var r=n;n=t,t=r}for(var a=svg$1.createSVGMatrix(),i=t;i<=n;++i){var s=i>=0&&i<e.numberOfItems?e.getItem(i).matrix:svg$1.createSVGMatrix();a=matrixMultiply(a,s)}return svg$1.createSVGTransformFromMatrix(a)},getMatrix=function(e){var t=getTransformList(e);return transformListToTransform(t).matrix},snapToAngle=function(e,t,n,r){var a=Math.PI/4,i=n-e,s=r-t,o=Math.atan2(s,i),l=Math.sqrt(i*i+s*s),c=Math.round(o/a)*a;return{x:e+l*Math.cos(c),y:t+l*Math.sin(c),a:c}},rectsIntersect=function(e,t){return t.x<e.x+e.width&&t.x+t.width>e.x&&t.y<e.y+e.height&&t.y+t.height>e.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 r=e.pathSegList;if(supportsPathInsertItemBefore())r.insertItemBefore(t,n);else{for(var a=r.numberOfItems,i=[],s=0;s<a;s++){var o=r.getItem(s);i.push(o)}r.clear();for(var l=0;l<a;l++)l===n&&r.appendItem(t),r.appendItem(i[l])}},ptObjToArr=function(e,t){return segData[e].map(function(e){return t[e]})},getGripPt=function(e,t){var n=e.path,r={x:t?t.x:e.item.x,y:t?t.y:e.item.y};n.matrix&&(r=transformPoint(r.x,r.y,n.matrix));var a=editorContext_.getCurrentZoom();return r.x*=a,r.y*=a,r},getPointFromGrip=function(e,t){var n={x:e.x,y:e.y};t.matrix&&(e=transformPoint(n.x,n.y,t.imatrix),n.x=e.x,n.y=e.y);var r=editorContext_.getCurrentZoom();return n.x/=r,n.y/=r,n},addPointGrip=function(e,t,n){var r=getGripContainer(),a=getElem("pathpointgrip_"+e);if(!a){a=document.createElementNS(NS.SVG,"circle");var i={id:"pathpointgrip_"+e,display:"none",r:4,fill:"#0FF",stroke:"#00F","stroke-width":2,cursor:"move",style:"pointer-events:all"};"pathNodeTooltip"in uiStrings&&(i["xlink:title"]=uiStrings.pathNodeTooltip),assignAttributes(a,i),a=r.appendChild(a),$$1("#pathpointgrip_"+e).dblclick(function(){path&&path.setSegType()})}return t&&n&&assignAttributes(a,{cx:t,cy:n,display:"inline"}),a},getGripContainer=function(){var e=getElem("pathpointgrip_container");e||((e=getElem("selectorParentGroup").appendChild(document.createElementNS(NS.SVG,"g"))).id="pathpointgrip_container");return e},addCtrlGrip=function(e){var t=getElem("ctrlpointgrip_"+e);if(t)return t;t=document.createElementNS(NS.SVG,"circle");var n={id:"ctrlpointgrip_"+e,display:"none",r:4,fill:"#0FF",stroke:"#55F","stroke-width":1,cursor:"move",style:"pointer-events:all"};return"pathCtrlPtTooltip"in uiStrings&&(n["xlink:title"]=uiStrings.pathCtrlPtTooltip),assignAttributes(t,n),getGripContainer().append(t),t},getCtrlLine=function(e){var t=getElem("ctrlLine_"+e);return t||(t=document.createElementNS(NS.SVG,"line"),assignAttributes(t,{id:"ctrlLine_"+e,stroke:"#555","stroke-width":1,style:"pointer-events:none"}),getGripContainer().append(t),t)},getPointGrip=function(e,t){var n=e.index,r=addPointGrip(n);if(t){var a=getGripPt(e);assignAttributes(r,{cx:a.x,cy:a.y,display:"inline"})}return r},getControlPoints=function(e){var t=e.item,n=e.index;if(!("x1"in t&&"x2"in t))return null;var r={};getGripContainer();for(var a=[path.segs[n-1].item,t],i=1;i<3;i++){var s=n+"c"+i,o=r["c"+i+"_line"]=getCtrlLine(s),l=getGripPt(e,{x:t["x"+i],y:t["y"+i]}),c=getGripPt(e,{x:a[i-1].x,y:a[i-1].y});assignAttributes(o,{x1:l.x,y1:l.y,x2:c.x,y2:c.y,display:"inline"}),r["c"+i+"_line"]=o;var u=r["c"+i]=addCtrlGrip(s);assignAttributes(u,{cx:l.x,cy:l.y,display:"inline"}),r["c"+i]=u}return r},replacePathSeg=function(e,t,n,r){var a=r||path.elem,i=a["createSVGPathSeg"+pathFuncs[e]].apply(a,_toConsumableArray(n));if(supportsPathReplaceItem())a.pathSegList.replaceItem(i,t);else{for(var s=a.pathSegList,o=s.numberOfItems,l=[],c=0;c<o;c++){var u=s.getItem(c);l.push(u)}s.clear();for(var d=0;d<o;d++)d===t?s.appendItem(i):s.appendItem(l[d])}},getSegSelector=function(e,t){var n=e.index,r=getElem("segline_"+n);if(!r){var a=getGripContainer();r=document.createElementNS(NS.SVG,"path"),assignAttributes(r,{id:"segline_"+n,display:"none",fill:"none",stroke:"#0FF","stroke-width":2,style:"pointer-events:none",d:"M0,0 0,0"}),a.append(r)}if(t){var i=e.prev;if(!i)return r.setAttribute("display","none"),r;var s=getGripPt(i);replacePathSeg(2,0,[s.x,s.y],r);for(var o=ptObjToArr(e.type,e.item),l=0;l<o.length;l+=2){var c=getGripPt(e,{x:o[l],y:o[l+1]});o[l]=c.x,o[l+1]=c.y}replacePathSeg(e.type,1,o,r)}return r},smoothControlPoints=function(e,t,n){var r=e.x-n.x,a=e.y-n.y,i=t.x-n.x,s=t.y-n.y;if(!(0===r&&0===a||0===i&&0===s)){var o=Math.sqrt(r*r+a*a),l=Math.sqrt(i*i+s*s),c=editorContext_.getSVGRoot().createSVGPoint(),u=editorContext_.getSVGRoot().createSVGPoint(),d=Math.atan2(a,r),h=Math.atan2(s,i);d<0&&(d+=2*Math.PI),h<0&&(h+=2*Math.PI);var p,g,f=Math.abs(d-h),m=Math.abs(Math.PI-f)/2;return d-h>0?(p=f<Math.PI?d+m:d-m,g=f<Math.PI?h-m:h+m):(p=f<Math.PI?d-m:d+m,g=f<Math.PI?h+m:h-m),c.x=o*Math.cos(p)+n.x,c.y=o*Math.sin(p)+n.y,u.x=l*Math.cos(g)+n.x,u.y=l*Math.sin(g)+n.y,[c,u]}},Segment=function(){function e(t,n){_classCallCheck(this,e),this.selected=!1,this.index=t,this.item=n,this.type=n.pathSegType,this.ctrlpts=[],this.ptgrip=null,this.segsel=null}return _createClass(e,[{key:"showCtrlPts",value:function(e){for(var t in this.ctrlpts)({}).hasOwnProperty.call(this.ctrlpts,t)&&this.ctrlpts[t].setAttribute("display",e?"inline":"none")}},{key:"selectCtrls",value:function(e){$$1("#ctrlpointgrip_"+this.index+"c1, #ctrlpointgrip_"+this.index+"c2").attr("fill",e?"#0FF":"#EEE")}},{key:"show",value:function(e){this.ptgrip&&(this.ptgrip.setAttribute("display",e?"inline":"none"),this.segsel.setAttribute("display",e?"inline":"none"),this.showCtrlPts(e))}},{key:"select",value:function(e){this.ptgrip&&(this.ptgrip.setAttribute("stroke",e?"#0FF":"#00F"),this.segsel.setAttribute("display",e?"inline":"none"),this.ctrlpts&&this.selectCtrls(e),this.selected=e)}},{key:"addGrip",value:function(){this.ptgrip=getPointGrip(this,!0),this.ctrlpts=getControlPoints(this),this.segsel=getSegSelector(this,!0)}},{key:"update",value:function(e){if(this.ptgrip){var t=getGripPt(this);assignAttributes(this.ptgrip,{cx:t.x,cy:t.y}),getSegSelector(this,!0),this.ctrlpts&&(e&&(this.item=path.elem.pathSegList.getItem(this.index),this.type=this.item.pathSegType),getControlPoints(this))}}},{key:"move",value:function(e,t){var n=this.item,r=this.ctrlpts?[n.x+=e,n.y+=t,n.x1,n.y1,n.x2+=e,n.y2+=t]:[n.x+=e,n.y+=t];if(replacePathSeg(this.type,this.index,r),this.next&&this.next.ctrlpts){var a=this.next.item,i=[a.x,a.y,a.x1+=e,a.y1+=t,a.x2,a.y2];replacePathSeg(this.next.type,this.next.index,i)}if(this.mate){var s=this.mate.item,o=[s.x+=e,s.y+=t];replacePathSeg(this.mate.type,this.mate.index,o)}this.update(!0),this.next&&this.next.update(!0)}},{key:"setLinked",value:function(e){var t,n,r;if(2===e){if(n=1,!(t=this.next))return;r=this.item}else{if(n=2,!(t=this.prev))return;r=t.item}var a=t.item;a["x"+n]=r.x+(r.x-this.item["x"+e]),a["y"+n]=r.y+(r.y-this.item["y"+e]);var i=[a.x,a.y,a.x1,a.y1,a.x2,a.y2];replacePathSeg(t.type,t.index,i),t.update(!0)}},{key:"moveCtrl",value:function(e,t,n){var r=this.item;r["x"+e]+=t,r["y"+e]+=n;var a=[r.x,r.y,r.x1,r.y1,r.x2,r.y2];replacePathSeg(this.type,this.index,a),this.update(!0)}},{key:"setType",value:function(e,t){replacePathSeg(e,this.index,t),this.type=e,this.item=path.elem.pathSegList.getItem(this.index),this.showCtrlPts(6===e),this.ctrlpts=getControlPoints(this),this.update(!0)}}]),e}(),Path=function(){function e(t){if(_classCallCheck(this,e),!t||"path"!==t.tagName)throw new Error("svgedit.path.Path constructed without a <path> 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;n++){var r=e.getItem(n),a=new Segment(n,r);a.path=this,this.segs.push(a)}for(var i=this.segs,s=null,o=0;o<t;o++){var l=i[o],c=o+1>=t?null:i[o+1],u=o-1<0?null:i[o-1];if(2===l.type){if(u&&1!==u.type){var d=i[s];d.next=i[s+1],d.next.prev=d,d.addGrip()}s=o}else if(c&&1===c.type)l.next=i[s+1],l.next.prev=l,l.mate=i[s],l.addGrip(),isNullish(this.first_seg)&&(this.first_seg=l);else if(c)1!==l.type&&(l.addGrip(),c&&2!==c.type&&(l.next=c,l.next.prev=l));else if(1!==l.type){var h=i[s];h.next=i[s+1],h.next.prev=h,h.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<t;n++){if(!1===e.call(this.segs[n],n))break}}},{key:"addSeg",value:function(e){var t=this.segs[e];if(t.prev){var n,r,a,i=t.prev;switch(t.item.pathSegType){case 4:r=(t.item.x+i.item.x)/2,a=(t.item.y+i.item.y)/2,n=this.elem.createSVGPathSegLinetoAbs(r,a);break;case 6:var s=(i.item.x+t.item.x1)/2,o=(t.item.x1+t.item.x2)/2,l=(t.item.x2+t.item.x)/2,c=(s+o)/2,u=(o+l)/2;r=(c+u)/2;var d=(i.item.y+t.item.y1)/2,h=(t.item.y1+t.item.y2)/2,p=(t.item.y2+t.item.y)/2,g=(d+h)/2,f=(h+p)/2;a=(g+f)/2,n=this.elem.createSVGPathSegCurvetoCubicAbs(r,a,s,d,c,g);var m=[t.item.x,t.item.y,u,f,l,p];replacePathSeg(t.type,e,m)}insertItemBefore(this.elem,n,e)}}},{key:"deleteSeg",value:function(e){var t=this.segs[e],n=this.elem.pathSegList;t.show(!1);var r=t.next;if(t.mate){var a=[r.item.x,r.item.y];replacePathSeg(2,r.index,a),replacePathSeg(4,t.index,a),n.removeItem(t.mate.index)}else if(t.prev)n.removeItem(e);else{var i=[r.item.x,r.item.y];replacePathSeg(2,t.next.index,i),n.removeItem(e)}}},{key:"removePtFromSelection",value:function(e){var t=this.selected_pts.indexOf(e);-1!==t&&(this.segs[e].select(!1),this.selected_pts.splice(t,1))}},{key:"clearSelection",value:function(){this.eachSeg(function(){this.select(!1)}),this.selected_pts=[]}},{key:"storeD",value:function(){this.last_d=this.elem.getAttribute("d")}},{key:"show",value:function(e){return this.eachSeg(function(){this.show(e)}),e&&this.selectPt(this.first_seg.index),this}},{key:"movePts",value:function(e,t){for(var n=this.selected_pts.length;n--;){this.segs[this.selected_pts[n]].move(e,t)}}},{key:"moveCtrl",value:function(e,t){var n=this.segs[this.selected_pts[0]];n.moveCtrl(this.dragctrl,e,t),linkControlPts&&n.setLinked(this.dragctrl)}},{key:"setSegType",value:function(e){this.storeD();for(var t,n=this.selected_pts.length;n--;){var r=this.selected_pts[n],a=this.segs[r],i=a.prev;if(i){if(!e)t="Toggle Path Segment Type",e=6===a.type?4:6;e=Number(e);var s=a.item.x,o=a.item.y,l=i.item.x,c=i.item.y,u=void 0;switch(e){case 6:if(a.olditem){var d=a.olditem;u=[s,o,d.x1,d.y1,d.x2,d.y2]}else{var h=s-l,p=o-c;u=[s,o,l+h/3,c+p/3,s-h/3,o-p/3]}break;case 4:u=[s,o],a.olditem=a.item}a.setType(e,u)}}path.endChanges(t)}},{key:"selectPt",value:function(e,t){this.clearSelection(),isNullish(e)&&this.eachSeg(function(t){this.prev&&(e=t)}),this.addPtsToSelection(e),t&&(this.dragctrl=t,linkControlPts&&this.segs[e].setLinked(t))}},{key:"update",value:function(){var e=this.elem;return getRotationAngle(e)?(this.matrix=getMatrix(e),this.imatrix=this.matrix.inverse()):(this.matrix=null,this.imatrix=null),this.eachSeg(function(t){this.item=e.pathSegList.getItem(t),this.update()}),this}},{key:"endChanges",value:function(e){isWebkit()&&editorContext_.resetD(this.elem);var t=new ChangeElementCommand(this.elem,{d:this.last_d},e);editorContext_.endChanges({cmd:t,elem:this.elem})}},{key:"addPtsToSelection",value:function(t){Array.isArray(t)||(t=[t]);for(var n=0;n<t.length;n++){var r=t[n];this.segs[r].ptgrip&&!this.selected_pts.includes(r)&&r>=0&&this.selected_pts.push(r)}this.selected_pts.sort();var a=this.selected_pts.length,i=[];for(i.length=a;a--;){var s=this.selected_pts[a],o=this.segs[s];o.select(!0),i[a]=o.ptgrip}var l=e.subpathIsClosed(this.selected_pts[0]);editorContext_.addPtsToSelection({grips:i,closedSubpath:l})}}]),e}();Path.subpathIsClosed=function(e){var t=!1;return path.eachSeg(function(n){return n<=e||2!==this.type&&(1!==this.type||(t=!0,!1))}),t};var newcx,newcy,oldcx,oldcy,angle,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]},getRotVals=function(e,t){var n=e-oldcx,r=t-oldcy,a=Math.sqrt(n*n+r*r),i=Math.atan2(r,n)+angle;return n=a*Math.cos(i)+oldcx,r=a*Math.sin(i)+oldcy,n-=newcx,r-=newcy,a=Math.sqrt(n*n+r*r),i=Math.atan2(r,n)-angle,{x:a*Math.cos(i)+newcx,y:a*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 r=newcx-oldcx,a=newcy-oldcy,i=Math.sqrt(r*r+a*a),s=Math.atan2(a,r)+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 c=o.getItem(l),u=c.pathSegType;if(1!==u){var d=getRotVals(c.x,c.y),h=[d.x,d.y];if(!isNullish(c.x1)&&!isNullish(c.x2)){var p=getRotVals(c.x1,c.y1),g=getRotVals(c.x2,c.y2);h.splice(h.length,0,p.x,p.y,g.x,g.y)}replacePathSeg(u,l,h)}}getBBox(e);var f=editorContext_.getSVGRoot().createSVGTransform(),m=getTransformList(e);f.setRotate(180*angle/Math.PI,newcx,newcy),m.replaceItem(f,0)}},clearData=function(){pathData={}},reorientGrads=function(e,t){for(var n=getBBox(e),r=0;r<2;r++){var a=0===r?"fill":"stroke",i=e.getAttribute(a);if(i&&i.startsWith("url(")){var s=getRefElem(i);if("linearGradient"===s.tagName){var o=s.getAttribute("x1")||0,l=s.getAttribute("y1")||0,c=s.getAttribute("x2")||1,u=s.getAttribute("y2")||0;o=n.width*o+n.x,l=n.height*l+n.y,c=n.width*c+n.x,u=n.height*u+n.y;var d=transformPoint(o,l,t),h=transformPoint(c,u,t),p={};p.x1=(d.x-n.x)/n.width,p.y1=(d.y-n.y)/n.height,p.x2=(h.x-n.x)/n.width,p.y2=(h.y-n.y)/n.height;var g=s.cloneNode(!0);$$1(g).attr(p),g.id=editorContext_.getNextId(),findDefs().append(g),e.setAttribute(a,"url(#"+g.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,r=n.numberOfItems,a=0,i=0,s="",o=null,l=0;l<r;++l){var c=n.getItem(l),u=c.x||0,d=c.y||0,h=c.x1||0,p=c.y1||0,g=c.x2||0,f=c.y2||0,m=c.pathSegType,v=pathMap[m]["to"+(t?"Lower":"Upper")+"Case"]();switch(m){case 1:s+="z",o&&!t&&(a=o[0],i=o[1]);break;case 12:u-=a;case 13:t?(a+=u,v="l"):(a=u+=a,v="L"),s+=pathDSegment(v,[[u,i]]);break;case 14:d-=i;case 15:t?(i+=d,v="l"):(i=d+=i,v="L"),s+=pathDSegment(v,[[a,d]]);break;case 2:case 4:case 18:u-=a,d-=i;case 5:case 3:case 19:t?(a+=u,i+=d):(a=u+=a,i=d+=i),2!==m&&3!==m||(o=[a,i]),s+=pathDSegment(v,[[u,d]]);break;case 6:u-=a,h-=a,g-=a,d-=i,p-=i,f-=i;case 7:t?(a+=u,i+=d):(h+=a,g+=a,p+=i,f+=i,a=u+=a,i=d+=i),s+=pathDSegment(v,[[h,p],[g,f],[u,d]]);break;case 8:u-=a,h-=a,d-=i,p-=i;case 9:t?(a+=u,i+=d):(h+=a,p+=i,a=u+=a,i=d+=i),s+=pathDSegment(v,[[h,p],[u,d]]);break;case 10:u-=a,d-=i;case 11:t?(a+=u,i+=d):(a=u+=a,i=d+=i),s+=pathDSegment(v,[[c.r1,c.r2]],[c.angle,c.largeArcFlag?1:0,c.sweepFlag?1:0],[u,d]);break;case 16:u-=a,g-=a,d-=i,f-=i;case 17:t?(a+=u,i+=d):(g+=a,f+=i,a=u+=a,i=d+=i),s+=pathDSegment(v,[[g,f],[u,d]])}}return s};function pathDSegment(e,t,n,r){$$1.each(t,function(e,n){t[e]=shortFloat(n)});var a=e+t.join(" ");return n&&(a+=" "+n.join(" ")),r&&(a+=" "+shortFloat(r)),a}var pathActions=function(){var e,t,n=!1,r=null,a=!1;return{mouseDown:function(t,r,a,i){var s;if("path"!==editorContext_.getCurrentMode()){if(path){var o;if(path.storeD(),"pathpointgrip_"===(s=t.target.id).substr(0,14)){o=path.cur_pt=parseInt(s.substr(14)),path.dragging=[a,i];var l=path.segs[o];t.shiftKey?l.selected?path.removePtFromSelection(o):path.addPtsToSelection(o):((path.selected_pts.length<=1||!l.selected)&&path.clearSelection(),path.addPtsToSelection(o))}else if(s.startsWith("ctrlpointgrip_")){path.dragging=[a,i];var c=s.split("_")[1].split("c");o=Number(c[0]);var u=Number(c[1]);path.selectPt(o,u)}if(!path.dragging){var d=editorContext_.getRubberBox();isNullish(d)&&(d=editorContext_.setRubberBox(editorContext_.selectorManager.getRubberBandBox()));var h=editorContext_.getCurrentZoom();assignAttributes(d,{x:a*h,y:i*h,width:0,height:0,display:"inline"},100)}}}else{var p=a,g=i,f=editorContext_.getCurrentZoom(),m=p/f,v=g/f,_=getElem("path_stretch_line");e=[m,v],editorContext_.getGridSnapping()&&(m=snapToGrid(m),v=snapToGrid(v),p=snapToGrid(p),g=snapToGrid(g)),_||(_=document.createElementNS(NS.SVG,"path"),assignAttributes(_,{id:"path_stretch_line",stroke:"#22C","stroke-width":"0.5",fill:"none"}),_=getElem("selectorParentGroup").appendChild(_)),_.setAttribute("display","inline");var b,y=editorContext_.getDrawnPath();if(y){for(var x=y.pathSegList,C=x.numberOfItems,S=6/f,w=!1;C;){C--;var $=x.getItem(C),k=$.x,A=$.y;if(m>=k-S&&m<=k+S&&v>=A-S&&v<=A+S){w=!0;break}}s=editorContext_.getId(),removePath_(s);var E,N,T=getElem(s),P=x.numberOfItems;if(w){if(C<=1&&P>=2){var G=x.getItem(0).x,L=x.getItem(0).y;E=4===(N=_.pathSegList.getItem(1)).pathSegType?y.createSVGPathSegLinetoAbs(G,L):y.createSVGPathSegCurvetoCubicAbs(G,L,N.x1/f,N.y1/f,G,L);var I=y.createSVGPathSegClosePath();x.appendItem(E),x.appendItem(I)}else if(P<3)return!1;if($$1(_).remove(),editorContext_.setDrawnPath(null),editorContext_.setStarted(!1),n){path.matrix&&editorContext_.remapElement(T,{},path.matrix.inverse());var M=T.getAttribute("d"),R=$$1(path.elem).attr("d");return $$1(path.elem).attr("d",R+M),$$1(T).remove(),path.matrix&&recalcRotatedPath(),init$1(),pathActions.toEditMode(path.elem),path.selectPt(),!1}}else{if(!$$1.contains(editorContext_.getContainer(),editorContext_.getMouseTarget(t)))return!1;var O=y.pathSegList.numberOfItems,B=y.pathSegList.getItem(O-1),V=B.x,j=B.y;if(t.shiftKey){var F=snapToAngle(V,j,m,v);m=F.x,v=F.y}E=4===(N=_.pathSegList.getItem(1)).pathSegType?y.createSVGPathSegLinetoAbs(editorContext_.round(m),editorContext_.round(v)):y.createSVGPathSegCurvetoCubicAbs(editorContext_.round(m),editorContext_.round(v),N.x1/f,N.y1/f,N.x2/f,N.y2/f),y.pathSegList.appendItem(E),m*=f,v*=f,_.setAttribute("d",["M",m,v,m,v].join(" ")),b=O,n&&(b+=path.segs.length),addPointGrip(b,m,v)}}else{var D="M"+m+","+v+" ";editorContext_.setDrawnPath(editorContext_.addSVGElementFromJson({element:"path",curStyles:!0,attr:{d:D,id:editorContext_.getNextId(),opacity:editorContext_.getOpacity()/2}})),_.setAttribute("d",["M",p,g,p,g].join(" ")),b=n?path.segs.length:0,addPointGrip(b,p,g)}}},mouseMove:function(n,r){var i=editorContext_.getCurrentZoom();a=!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:n,y:r},path),c=l.x-o.x,u=l.y-o.y;path.dragging=[n,r],path.dragctrl?path.moveCtrl(c,u):path.movePts(c,u)}else path.selected_pts=[],path.eachSeg(function(e){if(this.next||this.prev){var t=editorContext_.getRubberBox().getBBox(),n=getGripPt(this),r={x:n.x,y:n.y,width:0,height:0},a=rectsIntersect(t,r);this.select(a),a&&path.selected_pts.push(this.index)}});else{if(!s)return;var d=s.pathSegList,h=d.numberOfItems-1;if(e){var p=addCtrlGrip("1c1"),g=addCtrlGrip("0c2");p.setAttribute("cx",n),p.setAttribute("cy",r),p.setAttribute("display","inline");var f=e[0],m=e[1],v=f+(f-n/i),_=m+(m-r/i);g.setAttribute("cx",v*i),g.setAttribute("cy",_*i),g.setAttribute("display","inline");var b=getCtrlLine(1);if(assignAttributes(b,{x1:n,y1:r,x2:v*i,y2:_*i,display:"inline"}),0===h)t=[n,r];else{var y=d.getItem(h-1),x=y.x,C=y.y;6===y.pathSegType?(x+=x-y.x2,C+=C-y.y2):t&&(x=t[0]/i,C=t[1]/i),replacePathSeg(6,h,[f,m,x,C,v,_],s)}}else{var S=getElem("path_stretch_line");if(S){var w=d.getItem(h);if(6===w.pathSegType){var $=w.x+(w.x-w.x2),k=w.y+(w.y-w.y2);replacePathSeg(6,1,[n,r,$*i,k*i,n,r],S)}else t?replacePathSeg(6,1,[n,r,t[0],t[1],n,r],S):replacePathSeg(4,1,[n,r],S)}}}},mouseUp:function(n,r,i,s){var o=editorContext_.getDrawnPath();if("path"===editorContext_.getCurrentMode())return e=null,o||(r=getElem(editorContext_.getId()),editorContext_.setStarted(!1),t=null),{keep:!0,element:r};var l=editorContext_.getRubberBox();if(path.dragging){var c=path.cur_pt;path.dragging=!1,path.dragctrl=!1,path.update(),a&&path.endChanges("Move path point(s)"),n.shiftKey||a||path.selectPt(c)}else l&&"none"!==l.getAttribute("display")?(l.setAttribute("display","none"),l.getAttribute("width")<=2&&l.getAttribute("height")<=2&&pathActions.toSelectMode(n.target)):pathActions.toSelectMode(n.target);a=!1},toEditMode:function(e){path=getPath_(e),editorContext_.setCurrentMode("pathedit"),editorContext_.clearSelection(),path.show(!0).update(),path.oldbbox=getBBox(path.elem),n=!1},toSelectMode:function(e){var t=e===path.elem;editorContext_.setCurrentMode("select"),path.show(!1),r=!1,editorContext_.clearSelection(),path.matrix&&recalcRotatedPath(),t&&(editorContext_.call("selected",[e]),editorContext_.addToSelection([e],!0))},addSubPath:function(e){e?(editorContext_.setCurrentMode("path"),n=!0):(pathActions.clear(!0),pathActions.toEditMode(path.elem))},select:function(e){r===e?(pathActions.toEditMode(e),editorContext_.setCurrentMode("pathedit")):r=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 n=editorContext_.getDrawnPath();if(r=null,n){var a=getElem(editorContext_.getId());$$1(getElem("path_stretch_line")).remove(),$$1(a).remove(),$$1(getElem("pathpointgrip_container")).find("*").attr("display","none"),t=null,editorContext_.setDrawnPath(null),editorContext_.setStarted(!1)}else"pathedit"===editorContext_.getCurrentMode()&&this.toSelectMode();path&&path.init().show(!1)},resetOrientation:function(e){if(isNullish(e)||"path"!==e.nodeName)return!1;var t=getTransformList(e),n=transformListToTransform(t).matrix;t.clear(),e.removeAttribute("transform");for(var r=e.pathSegList,a=r.numberOfItems,i=function(t){var a=r.getItem(t),i=a.pathSegType;if(1===i)return"continue";var s=[];$$1.each(["",1,2],function(e,t){var r=a["x"+t],i=a["y"+t];if(void 0!==r&&void 0!==i){var o=transformPoint(r,i,n);s.splice(s.length,0,o.x,o.y)}}),replacePathSeg(i,t,s,e)},s=0;s<a;++s)i(s);reorientGrads(e,n)},zoomChange:function(){"pathedit"===editorContext_.getCurrentMode()&&path.update()},getNodePoint:function(){var e=path.selected_pts.length?path.selected_pts[0]:1,t=path.segs[e];return{x:t.item.x,y:t.item.y,type:t.type}},linkControlPoints:function(e){setLinkControlPoints(e)},clonePathNode:function(){path.storeD();for(var e=path.selected_pts,t=e.length,n=[];t--;){var r=e[t];path.addSeg(r),n.push(r+t),n.push(r+t+1)}path.init().addPtsToSelection(n),path.endChanges("Clone path node(s)")},opencloseSubPath:function(){var e=path.selected_pts;if(1===e.length){var t,n,r=path.elem,a=r.pathSegList,i=e[0],s=null,o=null;if(path.eachSeg(function(e){return 2===this.type&&e<=i&&(o=this.item),e<=i||(2===this.type?(s=e,!1):1!==this.type||(s=!1,!1))}),isNullish(s)&&(s=path.segs.length-1),!1!==s){var l=r.createSVGPathSegLinetoAbs(o.x,o.y),c=r.createSVGPathSegClosePath();return s===path.segs.length-1?(a.appendItem(l),a.appendItem(c)):(insertItemBefore(r,c,s),insertItemBefore(r,l,s)),void path.init().selectPt(s+1)}if(path.segs[i].mate)return a.removeItem(i),a.removeItem(i),void path.init().selectPt(i-1);for(var u=0;u<a.numberOfItems;u++){var d=a.getItem(u);if(2===d.pathSegType)t=u;else if(u===i)a.removeItem(t);else if(1===d.pathSegType&&i<u){n=u-1,a.removeItem(u);break}}for(var h=i-t-1;h--;)insertItemBefore(r,a.getItem(t),n);var p=a.getItem(t);replacePathSeg(2,t,[p.x,p.y]),path.init().selectPt(0)}},deletePathNode:function(){if(pathActions.canDeleteNodes){path.storeD();for(var e=path.selected_pts,t=e.length;t--;){var n=e[t];path.deleteSeg(n)}if(function e(){var t=path.elem.pathSegList,n=t.numberOfItems,r=function(e,n){for(;n--;)t.removeItem(e)};if(n<=1)return!0;for(;n--;){var a=t.getItem(n);if(1===a.pathSegType){var i=t.getItem(n-1),s=t.getItem(n-2);if(2===i.pathSegType){r(n-1,2),e();break}if(2===s.pathSegType){r(n-2,3),e();break}}else if(2===a.pathSegType&&n>0){var o=t.getItem(n-1).pathSegType;if(2===o){r(n-1,1),e();break}if(1===o&&t.numberOfItems-1===n){r(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 r=$$1(path.elem);r.attr("d",r.attr("d"))}path.endChanges("Delete path node(s)")}},smoothPolylineIntoPath:function(e){var t,n=e.points,r=n.numberOfItems;if(r>=4){var a=n.getItem(0),i=null,s=[];for(s.push(["M",a.x,",",a.y," C"].join("")),t=1;t<=r-4;t+=3){var o=n.getItem(t),l=n.getItem(t+1),c=n.getItem(t+2);if(i){var u=smoothControlPoints(i,o,a);if(u&&2===u.length){var d=s[s.length-1].split(",");d[2]=u[0].x,d[3]=u[0].y,s[s.length-1]=d.join(","),o=u[1]}}s.push([o.x,o.y,l.x,l.y,c.x,c.y].join(",")),a=c,i=l}for(s.push("L");t<r;){var h=n.getItem(t);s.push([h.x,h.y].join(",")),t++}s=s.join(" "),e=editorContext_.addSVGElementFromJson({element:"path",curStyles:!0,attr:{id:editorContext_.getId(),d:s,fill:"none"}})}return e},setSegType:function(e){path.setSegType(e)},moveNode:function(e,t){var n=path.selected_pts;if(n.length){path.storeD();var r=path.segs[n[0]],a={x:0,y:0};a[e]=t-r.item[e],r.move(a.x,a.y),path.endChanges("Move path point")}},fixEnd:function(e){for(var t,n=e.pathSegList,r=n.numberOfItems,a=0;a<r;++a){var i=n.getItem(a);if(2===i.pathSegType&&(t=i),1===i.pathSegType){var s=n.getItem(a-1);if(s.x!==t.x||s.y!==t.y){var o=e.createSVGPathSegLinetoAbs(t.x,t.y);insertItemBefore(e,o,a),pathActions.fixEnd(e);break}}}isWebkit()&&editorContext_.resetD(e)},convertPath:convertPath}}(),$$2=jQueryPluginSVG(jQuery),KEYSTR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",visElems="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use",visElemsArr=visElems.split(","),editorContext_$1=null,domdoc_=null,domcontainer_=null,svgroot_=null,init$2=function(e){editorContext_$1=e,domdoc_=e.getDOMDocument(),domcontainer_=e.getDOMContainer(),svgroot_=e.getSVGRoot()},dropXMLInteralSubset=function(e){return e.replace(/(<!DOCTYPE\s+\w*\s*\[).*(\?\]>)/,"$1$2")},toXml=function(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")};function encode64(e){if(e=encodeUTF8(e),window.btoa)return window.btoa(e);var t=new Array(4*Math.floor((e.length+2)/3)),n=0,r=0;do{var a=e.charCodeAt(n++),i=e.charCodeAt(n++),s=e.charCodeAt(n++),o=a>>2,l=(3&a)<<4|i>>4,c=(15&i)<<2|s>>6,u=63&s;isNaN(i)?(c=64,u=64):isNaN(s)&&(u=64),t[r++]=KEYSTR.charAt(o),t[r++]=KEYSTR.charAt(l),t[r++]=KEYSTR.charAt(c),t[r++]=KEYSTR.charAt(u)}while(n<e.length);return t.join("")}function decode64(e){if(window.atob)return decodeUTF8(window.atob(e));e=e.replace(/[^A-Za-z0-9+\/=]/g,"");var t="",n=0;do{var r=KEYSTR.indexOf(e.charAt(n++)),a=KEYSTR.indexOf(e.charAt(n++)),i=KEYSTR.indexOf(e.charAt(n++)),s=KEYSTR.indexOf(e.charAt(n++)),o=r<<2|a>>4,l=(15&a)<<4|i>>2,c=(3&i)<<6|s;t+=String.fromCharCode(o),64!==i&&(t+=String.fromCharCode(l)),64!==s&&(t+=String.fromCharCode(c))}while(n<e.length);return decodeUTF8(t)}function decodeUTF8(e){return decodeURIComponent(escape(e))}var encodeUTF8=function(e){return unescape(encodeURIComponent(e))},dataURLToObjectURL=function(e){if("undefined"==typeof Uint8Array||"undefined"==typeof Blob||"undefined"==typeof URL||!URL.createObjectURL)return"";for(var t=e.split(","),n=t[0].match(/:(.*?);/)[1],r=atob(t[1]),a=r.length,i=new Uint8Array(a);a--;)i[a]=r.charCodeAt(a);var s=new Blob([i],{type:n});return URL.createObjectURL(s)},createObjectURL=function(e){return e&&"undefined"!=typeof URL&&URL.createObjectURL?URL.createObjectURL(e):""},blankPageObjectURL=function(){if("undefined"==typeof Blob)return"";var e=new Blob(["<html><head><title>SVG-edit</title></head><body> </body></html>"],{type:"text/html"});return createObjectURL(e)}(),text2xml=function(e){var t,n;e.includes("<svg:svg")&&(e=e.replace(/<(\/?)svg:/g,"<$1").replace("xmlns:svg","xmlns"));try{(n=window.DOMParser?new DOMParser:new window.ActiveXObject("Microsoft.XMLDOM")).async=!1}catch(e){throw new Error("XML Parser could not be instantiated")}try{t=n.loadXML?!!n.loadXML(e)&&n:n.parseFromString(e,"text/xml")}catch(e){throw new Error("Error parsing XML string")}return t},bboxToObj=function(e){return{x:e.x,y:e.y,width:e.width,height:e.height}},walkTree=function e(t,n){if(t&&1===t.nodeType){n(t);for(var r=t.childNodes.length;r--;)e(t.childNodes.item(r),n)}},walkTreePost=function(e,t){if(e&&1===e.nodeType){for(var n=e.childNodes.length;n--;)walkTree(e.childNodes.item(n),t);t(e)}},getUrlFromAttr=function(e){if(e){if(e.startsWith('url("'))return e.substring(5,e.indexOf('"',6));if(e.startsWith("url('"))return e.substring(5,e.indexOf("'",6));if(e.startsWith("url("))return e.substring(4,e.indexOf(")"))}return null},getHref=function(e){return e.getAttributeNS(NS.XLINK,"href")},setHref=function(e,t){e.setAttributeNS(NS.XLINK,"xlink:href",t)},findDefs=function(){var e=editorContext_$1.getSVGContent(),t=e.getElementsByTagNameNS(NS.SVG,"defs");return t.length>0?t=t[0]:(t=e.ownerDocument.createElementNS(NS.SVG,"defs"),e.firstChild?e.insertBefore(t,e.firstChild.nextSibling):e.append(t)),t},getPathBBox=function(e){for(var t=e.pathSegList,n=t.numberOfItems,r=[[],[]],a=t.getItem(0),i=[a.x,a.y],s=function(e,t,n,r){return function(a){return Math.pow(1-a,3)*i[e]+3*Math.pow(1-a,2)*a*t[e]+3*(1-a)*Math.pow(a,2)*n[e]+Math.pow(a,3)*r[e]}},o=0;o<n;o++){var l=t.getItem(o);if(void 0!==l.x)if(r[0].push(i[0]),r[1].push(i[1]),l.x1){for(var c=[l.x1,l.y1],u=[l.x2,l.y2],d=[l.x,l.y],h=0;h<2;h++){var p=s(h,c,u,d),g=6*i[h]-12*c[h]+6*u[h],f=-3*i[h]+9*c[h]-9*u[h]+3*d[h],m=3*c[h]-3*i[h];if(0!==f){var v=Math.pow(g,2)-4*m*f;if(!(v<0)){var _=(-g+Math.sqrt(v))/(2*f);_>0&&_<1&&r[h].push(p(_));var b=(-g-Math.sqrt(v))/(2*f);b>0&&b<1&&r[h].push(p(b))}}else{if(0===g)continue;var y=-m/g;y>0&&y<1&&r[h].push(p(y))}}i=d}else r[0].push(l.x),r[1].push(l.y)}var x=Math.min.apply(null,r[0]),C=Math.max.apply(null,r[0])-x,S=Math.min.apply(null,r[1]);return{x:x,y:S,width:C,height:Math.max.apply(null,r[1])-S}};function groupBBFix(e){if(supportsHVLineContainerBBox())try{return e.getBBox()}catch(e){}var t,n,r=$$2.data(e,"ref"),a=null;r?(n=$$2(r).children().clone().attr("visibility","hidden"),$$2(svgroot_).append(n),a=n.filter("line, path")):a=$$2(e).find("line, path");var i=!1;if(a.length)if(a.each(function(){var e=this.getBBox();e.width&&e.height||(i=!0)}),i){var s=r?n:$$2(e).children();t=getStrokedBBox(s)}else t=e.getBBox();else t=e.getBBox();return r&&n.remove(),t}var getBBox=function(e){var t=e||editorContext_$1.geSelectedElements()[0];if(1!==e.nodeType)return null;var n=t.nodeName,r=null;switch(n){case"text":""===t.textContent?(t.textContent="a",r=t.getBBox(),t.textContent=""):t.getBBox&&(r=t.getBBox());break;case"path":supportsPathBBox()?t.getBBox&&(r=t.getBBox()):r=getPathBBox(t);break;case"g":case"a":r=groupBBFix(t);break;default:if("use"===n&&(r=groupBBFix(t)),"use"===n||"foreignObject"===n&&isWebkit()){if(r||(r=t.getBBox()),!isWebkit()){var a={};a.width=r.width,a.height=r.height,a.x=r.x+parseFloat(t.getAttribute("x")||0),a.y=r.y+parseFloat(t.getAttribute("y")||0),r=a}}else if(visElemsArr.includes(n))if(t)try{r=t.getBBox()}catch(e){var i=t.getExtentOfChar(0),s=t.getComputedTextLength();r={x:i.x,y:i.y,width:s,height:i.height}}else{var o=$$2(t).closest("foreignObject");o.length&&o[0].getBBox&&(r=o[0].getBBox())}}return r&&(r=bboxToObj(r)),r},getPathDFromSegments=function(e){var t="";return $$2.each(e,function(e,n){var r=_slicedToArray(n,2),a=r[0],i=r[1];t+=a;for(var s=0;s<i.length;s+=2)t+=i[s]+","+i[s+1]+" "}),t},getPathDFromElement=function(e){var t,n,r,a,i=1.81;switch(e.tagName){case"ellipse":case"circle":var s=n=$$2(e).attr(["rx","ry","cx","cy"]),o=s.cx,l=s.cy,c=n;r=c.rx,a=c.ry,"circle"===e.tagName&&(r=a=$$2(e).attr("r")),t=getPathDFromSegments([["M",[o-r,l]],["C",[o-r,l-a/i,o-r/i,l-a,o,l-a]],["C",[o+r/i,l-a,o+r,l-a/i,o+r,l]],["C",[o+r,l+a/i,o+r/i,l+a,o,l+a]],["C",[o-r/i,l+a,o-r,l+a/i,o-r,l]],["Z",[]]]);break;case"path":t=e.getAttribute("d");break;case"line":t="M"+(n=$$2(e).attr(["x1","y1","x2","y2"])).x1+","+n.y1+"L"+n.x2+","+n.y2;break;case"polyline":t="M"+e.getAttribute("points");break;case"polygon":t="M"+e.getAttribute("points")+" Z";break;case"rect":var u=$$2(e).attr(["rx","ry"]);r=u.rx,a=u.ry;var d=e.getBBox(),h=d.x,p=d.y,g=d.width,f=d.height;i=4-i,t=getPathDFromSegments(r||a?[["M",[h,p+a]],["C",[h,p+a/i,h+r/i,p,h+r,p]],["L",[h+g-r,p]],["C",[h+g-r/i,p,h+g,p+a/i,h+g,p+a]],["L",[h+g,p+f-a]],["C",[h+g,p+f-a/i,h+g-r/i,p+f,h+g-r,p+f]],["L",[h+r,p+f]],["C",[h+r/i,p+f,h,p+f-a/i,h,p+f-a]],["L",[h,p+a]],["Z",[]]]:[["M",[h,p]],["L",[h+g,p]],["L",[h+g,p+f]],["L",[h,p+f]],["L",[h,p]],["Z",[]]])}return t},getExtraAttributesForConvertToPath=function(e){var t={};return $$2.each(["marker-start","marker-end","marker-mid","filter","clip-path"],function(){var n=e.getAttribute(this);n&&(t[this]=n)}),t},getBBoxOfElementAsPath=function(e,t,n){var r=t({element:"path",attr:getExtraAttributesForConvertToPath(e)}),a=e.getAttribute("transform");a&&r.setAttribute("transform",a);var i=e.parentNode;e.nextSibling?e.before(r):i.append(r);var s=getPathDFromElement(e);s?r.setAttribute("d",s):r.remove(),n.resetOrientation(r);var o=!1;try{o=r.getBBox()}catch(e){}return r.remove(),o},convertToPath=function(e,t,n,r,a,i,s,o){var l=new s.BatchCommand("Convert element to Path"),c=n({element:"path",attr:t=$$2.extend({},t,getExtraAttributesForConvertToPath(e))}),u=e.getAttribute("transform");u&&c.setAttribute("transform",u);var d=e.id,h=e.parentNode;e.nextSibling?e.before(c):h.append(c);var p=getPathDFromElement(e);if(p){if(c.setAttribute("d",p),u){var g=getTransformList(c);hasMatrixTransform(g)&&r.resetOrientation(c)}var f=e.nextSibling;return l.addSubCommand(new s.RemoveElementCommand(e,f,parent)),l.addSubCommand(new s.InsertElementCommand(c)),a(),e.remove(),c.setAttribute("id",d),c.removeAttribute("visibility"),i([c],!0),o(l),c}return c.remove(),null};function bBoxCanBeOptimizedOverNativeGetBBox(e,t){var n=e%90;return t||!(n>-.001&&n<.001||(n<-89.99||n>89.99))}var getBBoxWithTransform=function(e,t,n){var r=getBBox(e);if(!r)return null;var a=getTransformList(e),i=getRotationAngleFromTransformList(a),s=hasMatrixTransform(a);if(i||s){var o=!1;if(bBoxCanBeOptimizedOverNativeGetBBox(i,s)){if(["ellipse","path","line","polyline","polygon"].includes(e.tagName))r=o=getBBoxOfElementAsPath(e,t,n);else if("rect"===e.tagName){var l=e.getAttribute("rx"),c=e.getAttribute("ry");(l||c)&&(r=o=getBBoxOfElementAsPath(e,t,n))}}if(!o){var u=transformListToTransform(a).matrix;r=transformBox(r.x,r.y,r.width,r.height,u).aabox}}return r};function getStrokeOffsetForBBox(e){var t=e.getAttribute("stroke-width");return isNaN(t)||"none"===e.getAttribute("stroke")?0:t/2}var getStrokedBBox=function(e,t,n){if(!e||!e.length)return!1;var r;if($$2.each(e,function(){r||this.parentNode&&(r=getBBoxWithTransform(this,t,n))}),void 0===r)return null;var a=r.x+r.width,i=r.y+r.height,s=r.x,o=r.y;if(1===e.length){var l=getStrokeOffsetForBBox(e[0]);s-=l,o-=l,a+=l,i+=l}else $$2.each(e,function(e,r){var l=getBBoxWithTransform(r,t,n);if(l){var c=getStrokeOffsetForBBox(r);s=Math.min(s,l.x-c),o=Math.min(o,l.y-c),1===r.nodeType&&(a=Math.max(a,l.x+l.width+c),i=Math.max(i,l.y+l.height+c))}});return r.x=s,r.y=o,r.width=a-s,r.height=i-o,r},getVisibleElements=function(e){e||(e=$$2(editorContext_$1.getSVGContent()).children());var t=[];return $$2(e).children().each(function(e,n){n.getBBox&&t.push(n)}),t.reverse()},getStrokedBBoxDefaultVisible=function(e){return e||(e=getVisibleElements()),getStrokedBBox(e,editorContext_$1.addSVGElementFromJson,editorContext_$1.pathActions)},getRotationAngleFromTransformList=function(e,t){if(!e)return 0;for(var n=e.numberOfItems,r=0;r<n;++r){var a=e.getItem(r);if(4===a.type)return t?a.angle*Math.PI/180:a.angle}return 0},getRotationAngle=function(e,t){var n=e||editorContext_$1.getSelectedElements()[0],r=getTransformList(n);return getRotationAngleFromTransformList(r,t)},getRefElem=function(e){return getElem(getUrlFromAttr(e).substr(1))},getElem=supportsSelectors()?function(e){return svgroot_.querySelector("#"+e)}:supportsXpath()?function(e){return domdoc_.evaluate('svg:svg[@id="svgroot"]//svg:*[@id="'+e+'"]',domcontainer_,function(){return NS.SVG},9,null).singleNodeValue}:function(e){return $$2(svgroot_).find("[id="+e+"]")[0]},assignAttributes=function(e,t,n,r){for(var a=Object.entries(t),i=0;i<a.length;i++){var s=_slicedToArray(a[i],2),o=s[0],l=s[1],c="xml:"===o.substr(0,4)?NS.XML:"xlink:"===o.substr(0,6)?NS.XLINK:null;c?e.setAttributeNS(c,o,l):r?setUnitAttr(e,o,l):e.setAttribute(o,l)}},cleanupElement=function(e){var t={"fill-opacity":1,"stop-opacity":1,opacity:1,stroke:"none","stroke-dasharray":"none","stroke-linejoin":"miter","stroke-linecap":"butt","stroke-opacity":1,"stroke-width":1,rx:0,ry:0};"ellipse"===e.nodeName&&(delete t.rx,delete t.ry),Object.entries(t).forEach(function(t){var n=_slicedToArray(t,2),r=n[0],a=n[1];e.getAttribute(r)===String(a)&&e.removeAttribute(r)})},snapToGrid=function(e){var t=editorContext_$1.getBaseUnit(),n=editorContext_$1.getSnappingStep();return"px"!==t&&(n*=getTypeMap()[t]),e=Math.round(e/n)*n},regexEscape=function(e){return String(e).replace(new RegExp("[.\\\\+*?\\[\\^\\]$(){}=!<>|:\\-]","g"),"\\$&")},preventClickDefault=function(e){$$2(e).click(function(e){e.preventDefault()})},copyElem=function e(t,n){var r=document.createElementNS(t.namespaceURI,t.nodeName);if($$2.each(t.attributes,function(e,t){"-moz-math-font-style"!==t.localName&&r.setAttributeNS(t.namespaceURI,t.nodeName,t.value)}),r.removeAttribute("id"),r.id=n(),isWebkit()&&"path"===t.nodeName){var a=convertPath(t);r.setAttribute("d",a)}if($$2.each(t.childNodes,function(t,a){switch(a.nodeType){case 1:r.append(e(a,n));break;case 3:r.textContent=a.nodeValue}}),$$2(t).data("gsvg"))$$2(r).data("gsvg",r.firstChild);else if($$2(t).data("symbol")){var i=$$2(t).data("symbol");$$2(r).data("ref",i).data("symbol",i)}else"image"===r.tagName&&preventClickDefault(r);return r},isNullish=function(e){return null==e},$$3=jQuery,contextMenuExtensions={},hasCustomHandler=function(e){return Boolean(contextMenuExtensions[e])},getCustomHandler=function(e){return contextMenuExtensions[e].action},injectExtendedContextMenuItemIntoDom=function(e){Object.keys(contextMenuExtensions).length||$$3("#cmenu_canvas").append("<li class='separator'>");var t=e.shortcut||"";$$3("#cmenu_canvas").append("<li class='disabled'><a href='#"+e.id+"'>"+e.label+"<span class='shortcut'>"+t+"</span></a></li>")},injectExtendedContextMenuItemsIntoDom=function(){Object.values(contextMenuExtensions).forEach(function(e){injectExtendedContextMenuItemIntoDom(e)})};function toAbsoluteURL(e){var t=document.createElement("a");return t.setAttribute("href",e),t.cloneNode(!1).href}function addScriptAtts(e,t){["id","class","type"].forEach(function(n){n in t&&(e[n]=t[n])})}function importSetGlobalDefault(e,t){return importSetGlobal(e,_extends({},t,{returnDefault:!0}))}function importSetGlobal(e,t){return _importSetGlobal.apply(this,arguments)}function _importSetGlobal(){return(_importSetGlobal=_asyncToGenerator(regeneratorRuntime.mark(function e(t,n){var r,a;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=n.global,a=n.returnDefault,!!("svgEditor"in window&&window.svgEditor&&!1===window.svgEditor.modules)){e.next=4;break}return e.abrupt("return",importModule(t,void 0,{returnDefault:a}));case 4:return e.next=6,importScript(t);case 6:return e.abrupt("return",window[r]);case 7:case"end":return e.stop()}},e,this)}))).apply(this,arguments)}function importScript(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Array.isArray(e)?Promise.all(e.map(function(e){return importScript(e,t)})):new Promise(function(n,r){var a=document.createElement("script"),i=function(){a.onerror=null,a.onload=null,a.remove(),a.src=""};a.defer="defer",addScriptAtts(a,t),a.onerror=function(){r(new Error("Failed to import: ".concat(e))),i()},a.onload=function(){n(),i()},a.src=e,document.head.append(a)})}function importModule(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).returnDefault,r=void 0!==n&&n;return Array.isArray(e)?Promise.all(e.map(function(e){return importModule(e,t)})):new Promise(function(n,a){var i="$importModule$"+Math.random().toString(32).slice(2),s=document.createElement("script"),o=function(){delete window[i],s.onerror=null,s.onload=null,s.remove(),URL.revokeObjectURL(s.src),s.src=""};addScriptAtts(s,t),s.defer="defer",s.type="module",s.onerror=function(){a(new Error("Failed to import: ".concat(e))),o()},s.onload=function(){n(window[i]),o()};var l=toAbsoluteURL(e),c="import * as m from '".concat(l.replace(/'/g,"\\'"),"'; window.").concat(i," = ").concat(r?"m.default || ":"","m;"),u=new Blob([c],{type:"text/javascript"});s.src=URL.createObjectURL(u),document.head.append(s)})}function jQueryPluginDBox(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ok:"Ok",cancel:"Cancel"};e("#dialog_container").draggable({cancel:"#dialog_content, #dialog_buttons *",containment:"window"}).css("position","absolute");var n=e("#dialog_box"),r=e("#dialog_buttons"),a=e("#dialog_content");function i(i,s,o,l,c,u){a.html("<p>"+s.replace(/\n/g,"</p><p>")+"</p>").toggleClass("prompt","prompt"===i),r.empty();var d=e('<input type="button" value="'+t.ok+'">').appendTo(r);return new Promise(function(s,h){var p,g;if("alert"!==i&&e('<input type="button" value="'+t.cancel+'">').appendTo(r).click(function(){n.hide(),s(!1)}),"prompt"===i)(p=e('<input type="text">').prependTo(r)).val(o||""),p.bind("keydown","return",function(){d.click()});else if("select"===i){var f=e('<div style="text-align:center;">');if(p=e("<select>").appendTo(f),u){var m=e("<label>").text(u.label);(g=e('<input type="checkbox">').appendTo(m)).val(u.value),u.tooltip&&m.attr("title",u.tooltip),g.prop("checked",Boolean(u.checked)),f.append(e("<div>").append(m))}e.each(l||[],function(t,n){"object"===_typeof(n)?p.append(e("<option>").val(n.value).html(n.text)):p.append(e("<option>").html(n))}),a.append(f),o&&p.val(o),c&&p.bind("change","return",c),p.bind("keydown","return",function(){d.click()})}else"process"===i&&d.hide();n.show(),d.click(function(){n.hide();var e="prompt"!==i&&"select"!==i||p.val();s(g?{response:e,checked:g.prop("checked")}:e)}).focus(),"prompt"!==i&&"select"!==i||p.focus()})}return e.alert=function(e){return i("alert",e)},e.confirm=function(e){return i("confirm",e)},e.process_cancel=function(e){return i("process",e)},e.prompt=function(e){return i("prompt",e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"")},e.select=function(e,t,n,r,a){return i("select",e,r,t,n,a)},e}var $$4=jQuery,Layer=function(){function e(t,n,r){if(_classCallCheck(this,e),this.name_=t,this.group_=r?null:n,r){var a=r.ownerDocument;this.group_=a.createElementNS(NS.SVG,"g");var i=a.createElementNS(NS.SVG,"title");i.textContent=t,this.group_.append(i),n?$$4(n).after(this.group_):r.append(this.group_)}addLayerClass(this.group_),walkTree(this.group_,function(e){e.setAttribute("style","pointer-events:inherit")}),this.group_.setAttribute("style",r?"pointer-events:all":"pointer-events:none")}return _createClass(e,[{key:"getName",value:function(){return this.name_}},{key:"getGroup",value:function(){return this.group_}},{key:"activate",value:function(){this.group_.setAttribute("style","pointer-events:all")}},{key:"deactivate",value:function(){this.group_.setAttribute("style","pointer-events:none")}},{key:"setVisible",value:function(e){var t=void 0===e||e?"inline":"none";this.group_.getAttribute("display")!==t&&this.group_.setAttribute("display",t)}},{key:"isVisible",value:function(){return"none"!==this.group_.getAttribute("display")}},{key:"getOpacity",value:function(){var e=this.group_.getAttribute("opacity");return isNullish(e)?1:parseFloat(e)}},{key:"setOpacity",value:function(e){"number"==typeof e&&e>=0&&e<=1&&this.group_.setAttribute("opacity",e)}},{key:"appendChildren",value:function(e){for(var t=0;t<e.length;++t)this.group_.append(e[t])}},{key:"getTitleElement",value:function(){for(var e=this.group_.childNodes.length,t=0;t<e;++t){var n=this.group_.childNodes.item(t);if(n&&"title"===n.tagName)return n}return null}},{key:"setName",value:function(e,t){var n=this.name_;e=toXml(e);var r=this.getTitleElement();return r?($$4(r).empty(),r.textContent=e,this.name_=e,t&&t.changeElement(r,{"#text":n}),this.name_):null}},{key:"removeGroup",value:function(){var e=this.group_.parentNode.removeChild(this.group_);return this.group_=void 0,e}}]),e}();function addLayerClass(e){var t=e.getAttribute("class");isNullish(t)||!t.length?e.setAttribute("class",Layer.CLASS_NAME):Layer.CLASS_REGEX.test(t)||e.setAttribute("class",t+" "+Layer.CLASS_NAME)}Layer.CLASS_NAME="layer",Layer.CLASS_REGEX=new RegExp("(\\s|^)"+Layer.CLASS_NAME+"(\\s|$)");var HistoryRecordingService=function(){function e(t){_classCallCheck(this,e),this.undoManager_=t,this.currentBatchCommand_=null,this.batchCommandStack_=[]}return _createClass(e,[{key:"startBatchCommand",value:function(e){return this.undoManager_?(this.currentBatchCommand_=new BatchCommand(e),this.batchCommandStack_.push(this.currentBatchCommand_),this):this}},{key:"endBatchCommand",value:function(){if(!this.undoManager_)return this;if(this.currentBatchCommand_){var e=this.currentBatchCommand_;this.batchCommandStack_.pop();var t=this.batchCommandStack_.length;this.currentBatchCommand_=t?this.batchCommandStack_[t-1]:null,this.addCommand_(e)}return this}},{key:"moveElement",value:function(e,t,n,r){return this.undoManager_?(this.addCommand_(new MoveElementCommand(e,t,n,r)),this):this}},{key:"insertElement",value:function(e,t){return this.undoManager_?(this.addCommand_(new InsertElementCommand(e,t)),this):this}},{key:"removeElement",value:function(e,t,n,r){return this.undoManager_?(this.addCommand_(new RemoveElementCommand(e,t,n,r)),this):this}},{key:"changeElement",value:function(e,t,n){return this.undoManager_?(this.addCommand_(new ChangeElementCommand(e,t,n)),this):this}},{key:"addCommand_",value:function(e){if(!this.undoManager_)return this;this.currentBatchCommand_?this.currentBatchCommand_.addSubCommand(e):this.undoManager_.addCommandToHistory(e)}}]),e}();HistoryRecordingService.NO_HISTORY=new HistoryRecordingService;var $$5=jQuery,visElems$1="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use".split(","),RandomizeModes={LET_DOCUMENT_DECIDE:0,ALWAYS_RANDOMIZE:1,NEVER_RANDOMIZE:2},randIds=RandomizeModes.LET_DOCUMENT_DECIDE,disabledElems=[];function historyRecordingService(e){return e||new HistoryRecordingService(canvas_.undoMgr)}function findLayerNameInGroup(e){return $$5("title",e).text()||(isOpera()&&e.querySelectorAll?$$5(e.querySelectorAll("title")).text():"")}function getNewLayerName(e){for(var t=1;e.includes("Layer "+t);)t++;return"Layer "+t}var canvas_,Drawing=function(){function e(t,n){if(_classCallCheck(this,e),!t||!t.tagName||!t.namespaceURI||"svg"!==t.tagName||t.namespaceURI!==NS.SVG)throw new Error("Error: svgedit.draw.Drawing instance initialized without a <svg> element");this.svgElem_=t,this.obj_num=0,this.idPrefix=n||"svg_",this.releasedNums=[],this.all_layers=[],this.layer_map={},this.current_layer=null,this.nonce_="";var r=this.svgElem_.getAttributeNS(NS.SE,"nonce");r&&randIds!==RandomizeModes.NEVER_RANDOMIZE?this.nonce_=r:randIds===RandomizeModes.ALWAYS_RANDOMIZE&&this.setNonce(Math.floor(100001*Math.random()))}return _createClass(e,[{key:"getElem_",value:function(e){return this.svgElem_.querySelector?this.svgElem_.querySelector("#"+e):$$5(this.svgElem_).find("[id="+e+"]")[0]}},{key:"getSvgElem",value:function(){return this.svgElem_}},{key:"getNonce",value:function(){return this.nonce_}},{key:"setNonce",value:function(e){this.svgElem_.setAttributeNS(NS.XMLNS,"xmlns:se",NS.SE),this.svgElem_.setAttributeNS(NS.SE,"se:nonce",e),this.nonce_=e}},{key:"clearNonce",value:function(){this.nonce_=""}},{key:"getId",value:function(){return this.nonce_?this.idPrefix+this.nonce_+"_"+this.obj_num:this.idPrefix+this.obj_num}},{key:"getNextId",value:function(){var e=this.obj_num,t=!1;this.releasedNums.length>0?(this.obj_num=this.releasedNums.pop(),t=!0):this.obj_num++;for(var n=this.getId();this.getElem_(n);)t&&(this.obj_num=e,t=!1),this.obj_num++,n=this.getId();return t&&(this.obj_num=e),n}},{key:"releaseId",value:function(e){var t=this.idPrefix+(this.nonce_?this.nonce_+"_":"");if("string"!=typeof e||!e.startsWith(t))return!1;var n=parseInt(e.substr(t.length));return!("number"!=typeof n||n<=0||this.releasedNums.includes(n))&&(this.releasedNums.push(n),!0)}},{key:"getNumLayers",value:function(){return this.all_layers.length}},{key:"hasLayer",value:function(e){return void 0!==this.layer_map[e]}},{key:"getLayerName",value:function(e){return e>=0&&e<this.getNumLayers()?this.all_layers[e].getName():""}},{key:"getCurrentLayer",value:function(){return this.current_layer?this.current_layer.getGroup():null}},{key:"getLayerByName",value:function(e){var t=this.layer_map[e];return t?t.getGroup():null}},{key:"getCurrentLayerName",value:function(){return this.current_layer?this.current_layer.getName():""}},{key:"setCurrentLayerName",value:function(e,t){var n=null;if(this.current_layer){var r=this.current_layer.getName();(n=this.current_layer.setName(e,t))&&(delete this.layer_map[r],this.layer_map[n]=this.current_layer)}return n}},{key:"setCurrentLayerPosition",value:function(e){var t,n=this.getNumLayers();if(!this.current_layer||e<0||e>=n)return null;for(t=0;t<n&&this.all_layers[t]!==this.current_layer;++t);if(t===n)return null;if(t!==e){var r=this.current_layer.getGroup(),a=r.nextSibling,i=null;return e>t?e<n-1&&(i=this.all_layers[e+1].getGroup()):i=this.all_layers[e].getGroup(),this.svgElem_.insertBefore(r,i),this.identifyLayers(),this.setCurrentLayer(this.getLayerName(e)),{currentGroup:r,oldNextSibling:a}}return null}},{key:"mergeLayer",value:function(e){var t=this.current_layer.getGroup(),n=$$5(t).prev()[0];if(n){e.startBatchCommand("Merge Layer");var r=t.nextSibling;for(e.removeElement(t,r,this.svgElem_);t.firstChild;){var a=t.firstChild;if("title"!==a.localName){var i=a.nextSibling;n.append(a),e.moveElement(a,i,t)}else e.removeElement(a,a.nextSibling,t),a.remove()}this.current_layer.removeGroup();var s=this.all_layers.indexOf(this.current_layer);if(s>0){var o=this.current_layer.getName();this.current_layer=this.all_layers[s-1],this.all_layers.splice(s,1),delete this.layer_map[o]}e.endBatchCommand()}}},{key:"mergeAllLayers",value:function(e){for(this.current_layer=this.all_layers[this.all_layers.length-1],e.startBatchCommand("Merge all Layers");this.all_layers.length>1;)this.mergeLayer(e);e.endBatchCommand()}},{key:"setCurrentLayer",value:function(e){var t=this.layer_map[e];return!!t&&(this.current_layer&&this.current_layer.deactivate(),this.current_layer=t,this.current_layer.activate(),!0)}},{key:"deleteCurrentLayer",value:function(){if(this.current_layer&&this.getNumLayers()>1){var e=this.current_layer.removeGroup();return this.identifyLayers(),e}return null}},{key:"identifyLayers",value:function(){this.all_layers=[],this.layer_map={};for(var e=this.svgElem_.childNodes.length,t=[],n=[],r=null,a=!1,i=0;i<e;++i){var s=this.svgElem_.childNodes.item(i);if(s&&1===s.nodeType)if("g"===s.tagName){a=!0;var o=findLayerNameInGroup(s);o?(n.push(o),r=new Layer(o,s),this.all_layers.push(r),this.layer_map[o]=r):t.push(s)}else visElems$1.includes(s.nodeName)&&t.push(s)}t.length>0||!a?((r=new Layer(getNewLayerName(n),null,this.svgElem_)).appendChildren(t),this.all_layers.push(r),this.layer_map[name]=r):r.activate(),this.current_layer=r}},{key:"createLayer",value:function(e,t){this.current_layer&&this.current_layer.deactivate(),(null==e||""===e||this.layer_map[e])&&(e=getNewLayerName(Object.keys(this.layer_map)));var n=new Layer(e,null,this.svgElem_);return t&&(t.startBatchCommand("Create Layer"),t.insertElement(n.getGroup()),t.endBatchCommand()),this.all_layers.push(n),this.layer_map[e]=n,this.current_layer=n,n.getGroup()}},{key:"cloneLayer",value:function(e,t){if(!this.current_layer)return null;this.current_layer.deactivate(),(null==e||""===e||this.layer_map[e])&&(e=getNewLayerName(Object.keys(this.layer_map)));for(var n=this.current_layer.getGroup(),r=new Layer(e,n,this.svgElem_),a=r.getGroup(),i=n.childNodes,s=0;s<i.length;s++){var o=i[s];"title"!==o.localName&&a.append(this.copyElem(o))}t&&(t.startBatchCommand("Duplicate Layer"),t.insertElement(a),t.endBatchCommand());var l=this.all_layers.indexOf(this.current_layer);return l>=0?this.all_layers.splice(l+1,0,r):this.all_layers.push(r),this.layer_map[e]=r,this.current_layer=r,a}},{key:"getLayerVisibility",value:function(e){var t=this.layer_map[e];return!!t&&t.isVisible()}},{key:"setLayerVisibility",value:function(e,t){if("boolean"!=typeof t)return null;var n=this.layer_map[e];return n?(n.setVisible(t),n.getGroup()):null}},{key:"getLayerOpacity",value:function(e){var t=this.layer_map[e];return t?t.getOpacity():null}},{key:"setLayerOpacity",value:function(e,t){if(!("number"!=typeof t||t<0||t>1)){var n=this.layer_map[e];n&&n.setOpacity(t)}}},{key:"copyElem",value:function(e){var t=this;return copyElem(e,function(){return t.getNextId()})}}]),e}(),randomizeIds=function(e,t){(randIds=!1===e?RandomizeModes.NEVER_RANDOMIZE:RandomizeModes.ALWAYS_RANDOMIZE)!==RandomizeModes.ALWAYS_RANDOMIZE||t.getNonce()?randIds===RandomizeModes.NEVER_RANDOMIZE&&t.getNonce()&&t.clearNonce():t.setNonce(Math.floor(100001*Math.random()))},init$3=function(e){canvas_=e},identifyLayers=function(){leaveContext(),canvas_.getCurrentDrawing().identifyLayers()},createLayer=function(e,t){var n=canvas_.getCurrentDrawing().createLayer(e,historyRecordingService(t));canvas_.clearSelection(),canvas_.call("changed",[n])},cloneLayer=function(e,t){var n=canvas_.getCurrentDrawing().cloneLayer(e,historyRecordingService(t));canvas_.clearSelection(),leaveContext(),canvas_.call("changed",[n])},deleteCurrentLayer=function(){var e=canvas_.getCurrentDrawing().getCurrentLayer(),t=e.nextSibling,n=e.parentNode;if(e=canvas_.getCurrentDrawing().deleteCurrentLayer()){var r=new BatchCommand("Delete Layer");return r.addSubCommand(new RemoveElementCommand(e,t,n)),canvas_.addCommandToHistory(r),canvas_.clearSelection(),canvas_.call("changed",[n]),!0}return!1},setCurrentLayer=function(e){var t=canvas_.getCurrentDrawing().setCurrentLayer(toXml(e));return t&&canvas_.clearSelection(),t},renameCurrentLayer=function(e){var t=canvas_.getCurrentDrawing(),n=t.getCurrentLayer();if(n&&t.setCurrentLayerName(e,historyRecordingService()))return canvas_.call("changed",[n]),!0;return!1},setCurrentLayerPosition=function(e){var t=canvas_.getCurrentDrawing().setCurrentLayerPosition(e);return!!t&&(canvas_.addCommandToHistory(new MoveElementCommand(t.currentGroup,t.oldNextSibling,canvas_.getSVGContent())),!0)},setLayerVisibility=function(e,t){var n=canvas_.getCurrentDrawing(),r=n.getLayerVisibility(e),a=n.setLayerVisibility(e,t);if(!a)return!1;var i=r?"inline":"none";return canvas_.addCommandToHistory(new ChangeElementCommand(a,{display:i},"Layer Visibility")),a===n.getCurrentLayer()&&(canvas_.clearSelection(),canvas_.pathActions.clear()),!0},moveSelectedToLayer=function(e){var t=canvas_.getCurrentDrawing().getLayerByName(e);if(!t)return!1;for(var n=new BatchCommand("Move Elements to Layer"),r=canvas_.getSelectedElements(),a=r.length;a--;){var i=r[a];if(i){var s=i.nextSibling,o=i.parentNode;t.append(i),n.addSubCommand(new MoveElementCommand(i,s,o))}}return canvas_.addCommandToHistory(n),!0},mergeLayer=function(e){canvas_.getCurrentDrawing().mergeLayer(historyRecordingService(e)),canvas_.clearSelection(),leaveContext(),canvas_.changeSVGContent()},mergeAllLayers=function(e){canvas_.getCurrentDrawing().mergeAllLayers(historyRecordingService(e)),canvas_.clearSelection(),leaveContext(),canvas_.changeSVGContent()},leaveContext=function(){var e=disabledElems.length;if(e){for(var t=0;t<e;t++){var n=disabledElems[t],r=canvas_.elData(n,"orig_opac");1!==r?n.setAttribute("opacity",r):n.removeAttribute("opacity"),n.setAttribute("style","pointer-events: inherit")}disabledElems=[],canvas_.clearSelection(!0),canvas_.call("contextset",null)}canvas_.setCurrentGroup(null)},setContext=function(e){leaveContext(),"string"==typeof e&&(e=getElem(e)),canvas_.setCurrentGroup(e),$$5(e).parentsUntil("#svgcontent").andSelf().siblings().each(function(){var e=this.getAttribute("opacity")||1;canvas_.elData(this,"orig_opac",e),this.setAttribute("opacity",.33*e),this.setAttribute("style","pointer-events: none"),disabledElems.push(this)}),canvas_.clearSelection(),canvas_.call("contextset",canvas_.getCurrentGroup())},REVERSE_NS=getReverseNS(),svgWhiteList_={a:["class","clip-path","clip-rule","fill","fill-opacity","fill-rule","filter","id","mask","opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","systemLanguage","transform","xlink:href","xlink:title"],circle:["class","clip-path","clip-rule","cx","cy","fill","fill-opacity","fill-rule","filter","id","mask","opacity","r","requiredFeatures","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","systemLanguage","transform"],clipPath:["class","clipPathUnits","id"],defs:[],style:["type"],desc:[],ellipse:["class","clip-path","clip-rule","cx","cy","fill","fill-opacity","fill-rule","filter","id","mask","opacity","requiredFeatures","rx","ry","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","systemLanguage","transform"],feGaussianBlur:["class","color-interpolation-filters","id","requiredFeatures","stdDeviation"],filter:["class","color-interpolation-filters","filterRes","filterUnits","height","id","primitiveUnits","requiredFeatures","width","x","xlink:href","y"],foreignObject:["class","font-size","height","id","opacity","requiredFeatures","style","transform","width","x","y"],g:["class","clip-path","clip-rule","id","display","fill","fill-opacity","fill-rule","filter","mask","opacity","requiredFeatures","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","systemLanguage","transform","font-family","font-size","font-style","font-weight","text-anchor"],image:["class","clip-path","clip-rule","filter","height","id","mask","opacity","requiredFeatures","style","systemLanguage","transform","width","x","xlink:href","xlink:title","y"],line:["class","clip-path","clip-rule","fill","fill-opacity","fill-rule","filter","id","marker-end","marker-mid","marker-start","mask","opacity","requiredFeatures","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","systemLanguage","transform","x1","x2","y1","y2"],linearGradient:["class","id","gradientTransform","gradientUnits","requiredFeatures","spreadMethod","systemLanguage","x1","x2","xlink:href","y1","y2"],marker:["id","class","markerHeight","markerUnits","markerWidth","orient","preserveAspectRatio","refX","refY","systemLanguage","viewBox"],mask:["class","height","id","maskContentUnits","maskUnits","width","x","y"],metadata:["class","id"],path:["class","clip-path","clip-rule","d","fill","fill-opacity","fill-rule","filter","id","marker-end","marker-mid","marker-start","mask","opacity","requiredFeatures","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","systemLanguage","transform"],pattern:["class","height","id","patternContentUnits","patternTransform","patternUnits","requiredFeatures","style","systemLanguage","viewBox","width","x","xlink:href","y"],polygon:["class","clip-path","clip-rule","id","fill","fill-opacity","fill-rule","filter","id","class","marker-end","marker-mid","marker-start","mask","opacity","points","requiredFeatures","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","systemLanguage","transform"],polyline:["class","clip-path","clip-rule","id","fill","fill-opacity","fill-rule","filter","marker-end","marker-mid","marker-start","mask","opacity","points","requiredFeatures","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","systemLanguage","transform"],radialGradient:["class","cx","cy","fx","fy","gradientTransform","gradientUnits","id","r","requiredFeatures","spreadMethod","systemLanguage","xlink:href"],rect:["class","clip-path","clip-rule","fill","fill-opacity","fill-rule","filter","height","id","mask","opacity","requiredFeatures","rx","ry","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","systemLanguage","transform","width","x","y"],stop:["class","id","offset","requiredFeatures","stop-color","stop-opacity","style","systemLanguage"],svg:["class","clip-path","clip-rule","filter","id","height","mask","preserveAspectRatio","requiredFeatures","style","systemLanguage","viewBox","width","x","xmlns","xmlns:se","xmlns:xlink","y"],switch:["class","id","requiredFeatures","systemLanguage"],symbol:["class","fill","fill-opacity","fill-rule","filter","font-family","font-size","font-style","font-weight","id","opacity","preserveAspectRatio","requiredFeatures","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","systemLanguage","transform","viewBox"],text:["class","clip-path","clip-rule","fill","fill-opacity","fill-rule","filter","font-family","font-size","font-style","font-weight","id","mask","opacity","requiredFeatures","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","systemLanguage","text-anchor","transform","x","xml:space","y"],textPath:["class","id","method","requiredFeatures","spacing","startOffset","style","systemLanguage","transform","xlink:href"],title:[],tspan:["class","clip-path","clip-rule","dx","dy","fill","fill-opacity","fill-rule","filter","font-family","font-size","font-style","font-weight","id","mask","opacity","requiredFeatures","rotate","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","systemLanguage","text-anchor","textLength","transform","x","xml:space","y"],use:["class","clip-path","clip-rule","fill","fill-opacity","fill-rule","filter","height","id","mask","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","transform","width","x","xlink:href","y"],annotation:["encoding"],"annotation-xml":["encoding"],maction:["actiontype","other","selection"],math:["class","id","display","xmlns"],menclose:["notation"],merror:[],mfrac:["linethickness"],mi:["mathvariant"],mmultiscripts:[],mn:[],mo:["fence","lspace","maxsize","minsize","rspace","stretchy"],mover:[],mpadded:["lspace","width","height","depth","voffset"],mphantom:[],mprescripts:[],mroot:[],mrow:["xlink:href","xlink:type","xmlns:xlink"],mspace:["depth","height","width"],msqrt:[],mstyle:["displaystyle","mathbackground","mathcolor","mathvariant","scriptlevel"],msub:[],msubsup:[],msup:[],mtable:["align","columnalign","columnlines","columnspacing","displaystyle","equalcolumns","equalrows","frame","rowalign","rowlines","rowspacing","width"],mtd:["columnalign","columnspan","rowalign","rowspan"],mtext:[],mtr:["columnalign","rowalign"],munder:[],munderover:[],none:[],semantics:[]},svgWhiteListNS_={};Object.entries(svgWhiteList_).forEach(function(e){var t=_slicedToArray(e,2),n=t[0],r=t[1],a={};Object.entries(r).forEach(function(e){var t=_slicedToArray(e,2),n=(t[0],t[1]);if(n.includes(":")){var r=n.split(":");a[r[1]]=NS[r[0].toUpperCase()]}else a[n]="xmlns"===n?NS.XMLNS:null}),svgWhiteListNS_[n]=a});var context_,svgFactory_,config_,selectorManager_,sanitizeSvg=function e(t){if(3===t.nodeType&&(t.nodeValue=t.nodeValue.replace(/^\s+|\s+$/g,""),t.nodeValue.length||t.remove()),1===t.nodeType){var n=t.ownerDocument,r=t.parentNode;if(n&&r){var a=svgWhiteList_[t.nodeName],i=svgWhiteListNS_[t.nodeName];if(void 0!==a){for(var s=[],o=t.attributes.length;o--;){var l=t.attributes.item(o),c=l.nodeName,u=l.localName,d=l.namespaceURI;if({}.hasOwnProperty.call(i,u)&&d===i[u]&&d!==NS.XMLNS||d===NS.XMLNS&&REVERSE_NS[l.value]||((c.startsWith("se:")||c.startsWith("data-"))&&s.push([c,l.value]),t.removeAttributeNS(d,u)),isGecko())switch(c){case"transform":case"gradientTransform":case"patternTransform":var h=l.value.replace(/(\d)-/g,"$1 -");t.setAttribute(c,h)}if("style"===c){for(var p=l.value.split(";"),g=p.length;g--;){var f=_slicedToArray(p[g].split(":"),2),m=f[0],v=f[1],_=(m||"").trim(),b=(v||"").trim();a.includes(_)&&t.setAttribute(_,b)}t.removeAttribute("style")}}Object.values(s).forEach(function(e){var n=_slicedToArray(e,2),r=n[0],a=n[1];t.setAttributeNS(NS.SE,r,a)});var y=getHref(t);if(y&&["filter","linearGradient","pattern","radialGradient","textPath","use"].includes(t.nodeName)&&"#"!==y[0]&&(setHref(t,""),t.removeAttributeNS(NS.XLINK,"href")),"use"===t.nodeName&&!getHref(t))return void t.remove();for(Object.values(["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"],function(e){var n=t.getAttribute(e);n&&(n=getUrlFromAttr(n))&&"#"!==n[0]&&(t.setAttribute(e,""),t.removeAttribute(e))}),o=t.childNodes.length;o--;)e(t.childNodes.item(o))}else{for(var x=[];t.hasChildNodes();)x.push(r.insertBefore(t.firstChild,t));t.remove();for(var C=x.length;C--;)e(x[C])}}}},$$6=jQuery,pathMap$1=[0,"z","M","m","L","l","C","c","Q","q","A","a","H","h","V","v","S","s","T","t"],editorContext_$2=null,init$4=function(e){editorContext_$2=e},remapElement=function(e,t,n){for(var r=function(e,t){return transformPoint(e,t,n)},a=function(e){return n.a*e},i=function(e){return n.d*e},s=editorContext_$2.getGridSnapping()&&"svg"===e.parentNode.parentNode.localName,o=function(){s&&Object.entries(t).forEach(function(e){var n=_slicedToArray(e,2),r=n[0],a=n[1];t[r]=snapToGrid(a)}),assignAttributes(e,t,1e3,!0)},l=getBBox(e),c=0;c<2;c++){var u=0===c?"fill":"stroke",d=e.getAttribute(u);if(d&&d.startsWith("url(")&&(n.a<0||n.d<0)){var h=getRefElem(d).cloneNode(!0);if(n.a<0){var p=h.getAttribute("x1"),g=h.getAttribute("x2");h.setAttribute("x1",-(p-1)),h.setAttribute("x2",-(g-1))}if(n.d<0){var f=h.getAttribute("y1"),m=h.getAttribute("y2");h.setAttribute("y1",-(f-1)),h.setAttribute("y2",-(m-1))}h.id=editorContext_$2.getDrawing().getNextId(),findDefs().append(h),e.setAttribute(u,"url(#"+h.id+")")}}var v=e.tagName;if("g"===v||"text"===v||"tspan"===v||"use"===v)if(1!==n.a||0!==n.b||0!==n.c||1!==n.d||0===n.e&&0===n.f){var _=getTransformList(e),b=editorContext_$2.getSVGRoot().createSVGTransform();b.setMatrix(matrixMultiply(transformListToTransform(_).matrix,n)),_.clear(),_.appendItem(b)}else{var y=transformListToTransform(e).matrix,x=matrixMultiply(y.inverse(),n,y);t.x=parseFloat(t.x)+x.e,t.y=parseFloat(t.y)+x.f}switch(v){case"foreignObject":case"rect":case"image":if("image"===v&&(n.a<0||n.d<0)){var C=getTransformList(e),S=editorContext_$2.getSVGRoot().createSVGTransform();S.setMatrix(matrixMultiply(transformListToTransform(C).matrix,n)),C.clear(),C.appendItem(S)}else{var w=r(t.x,t.y);t.width=a(t.width),t.height=i(t.height),t.x=w.x+Math.min(0,t.width),t.y=w.y+Math.min(0,t.height),t.width=Math.abs(t.width),t.height=Math.abs(t.height)}o();break;case"ellipse":var $=r(t.cx,t.cy);t.cx=$.x,t.cy=$.y,t.rx=a(t.rx),t.ry=i(t.ry),t.rx=Math.abs(t.rx),t.ry=Math.abs(t.ry),o();break;case"circle":var k=r(t.cx,t.cy);t.cx=k.x,t.cy=k.y;var A=transformBox(l.x,l.y,l.width,l.height,n),E=A.tr.x-A.tl.x,N=A.bl.y-A.tl.y;t.r=Math.min(E/2,N/2),t.r&&(t.r=Math.abs(t.r)),o();break;case"line":var T=r(t.x1,t.y1),P=r(t.x2,t.y2);t.x1=T.x,t.y1=T.y,t.x2=P.x,t.y2=P.y;case"text":case"tspan":case"use":o();break;case"g":var G=$$6(e).data("gsvg");G&&assignAttributes(G,t,1e3,!0);break;case"polyline":case"polygon":for(var L=t.points.length,I=0;I<L;++I){var M=t.points[I],R=r(M.x,M.y),O=R.x,B=R.y;t.points[I].x=O,t.points[I].y=B}for(var V="",j=0;j<L;++j){var F=t.points[j];V+=F.x+","+F.y+" "}e.setAttribute("points",V);break;case"path":var D=e.pathSegList,U=D.numberOfItems;t.d=[];for(var H=0;H<U;++H){var z=D.getItem(H);t.d[H]={type:z.pathSegType,x:z.x,y:z.y,x1:z.x1,y1:z.y1,x2:z.x2,y2:z.y2,r1:z.r1,r2:z.r2,angle:z.angle,largeArcFlag:z.largeArcFlag,sweepFlag:z.sweepFlag}}U=t.d.length;var q=t.d[0],W=r(q.x,q.y);t.d[0].x=W.x,t.d[0].y=W.y;for(var Y=1;Y<U;++Y){var X=t.d[Y];if(X.type%2==0){var Q=r(void 0!==X.x?X.x:W.x,void 0!==X.y?X.y:W.y),K=r(X.x1,X.y1),Z=r(X.x2,X.y2);X.x=Q.x,X.y=Q.y,X.x1=K.x,X.y1=K.y,X.x2=Z.x,X.y2=Z.y,X.r1=a(X.r1),X.r2=i(X.r2)}else X.x=a(X.x),X.y=i(X.y),X.x1=a(X.x1),X.y1=i(X.y1),X.x2=a(X.x2),X.y2=i(X.y2),X.r1=a(X.r1),X.r2=i(X.r2)}var J="";U=t.d.length;for(var ee=0;ee<U;++ee){var te=t.d[ee],ne=te.type;switch(J+=pathMap$1[ne],ne){case 13:case 12:J+=te.x+" ";break;case 15:case 14:J+=te.y+" ";break;case 3:case 5:case 19:case 2:case 4:case 18:J+=te.x+","+te.y+" ";break;case 7:case 6:J+=te.x1+","+te.y1+" "+te.x2+","+te.y2+" "+te.x+","+te.y+" ";break;case 9:case 8:J+=te.x1+","+te.y1+" "+te.x+","+te.y+" ";break;case 11:case 10:J+=te.r1+","+te.r2+" "+te.angle+" "+Number(te.largeArcFlag)+" "+Number(te.sweepFlag)+" "+te.x+","+te.y+" ";break;case 17:case 16:J+=te.x2+","+te.y2+" "+te.x+","+te.y+" "}}e.setAttribute("d",J)}},$$7=jQueryPluginSVG(jQuery),init$5=function(e){context_=e},updateClipPath=function(e,t,n){var r=getRefElem(e).firstChild,a=getTransformList(r),i=context_.getSVGRoot().createSVGTransform();i.setTranslate(t,n),a.appendItem(i),recalculateDimensions(r)},recalculateDimensions=function e(t){if(isNullish(t))return null;if("svg"===t.nodeName&&navigator.userAgent.includes("Firefox/20"))return null;var n=context_.getSVGRoot(),r=getTransformList(t);if(r&&r.numberOfItems>0){for(var a=r.numberOfItems,i=a;a--;){var s=r.getItem(a);if(0===s.type)r.removeItem(a);else if(1===s.type){if(isIdentity(s.matrix)){if(1===i)return t.removeAttribute("transform"),null;r.removeItem(a)}}else 4===s.type&&0===s.angle&&r.removeItem(a)}if(1===r.numberOfItems&&getRotationAngle(t))return null}if(!r||0===r.numberOfItems)return t.setAttribute("transform",""),t.removeAttribute("transform"),null;if(r){for(var o=[],l=r.numberOfItems;l--;){var c=r.getItem(l);1===c.type?o.push([c.matrix,l]):o.length&&(o=[])}if(2===o.length){var u=n.createSVGTransformFromMatrix(matrixMultiply(o[1][0],o[0][0]));r.removeItem(o[0][1]),r.removeItem(o[1][1]),r.insertItemBefore(u,o[1][1])}if((l=r.numberOfItems)>=2&&1===r.getItem(l-2).type&&2===r.getItem(l-1).type){var d=n.createSVGTransform(),h=matrixMultiply(r.getItem(l-2).matrix,r.getItem(l-1).matrix);d.setMatrix(h),r.removeItem(l-2),r.removeItem(l-2),r.appendItem(d)}}switch(t.tagName){case"line":case"polyline":case"polygon":case"path":break;default:if(1===r.numberOfItems&&1===r.getItem(0).type||2===r.numberOfItems&&1===r.getItem(0).type&&4===r.getItem(0).type)return null}var p,g,f=$$7(t).data("gsvg"),m=new BatchCommand("Transform"),v={},_=null,b=[];switch(t.tagName){case"line":b=["x1","y1","x2","y2"];break;case"circle":b=["cx","cy","r"];break;case"ellipse":b=["cx","cy","rx","ry"];break;case"foreignObject":case"rect":case"image":b=["width","height","x","y"];break;case"use":case"text":case"tspan":b=["x","y"];break;case"polygon":case"polyline":(_={}).points=t.getAttribute("points");var y=t.points,x=y.numberOfItems;v.points=new Array(x);for(var C=0;C<x;++C){var S=y.getItem(C);v.points[C]={x:S.x,y:S.y}}break;case"path":(_={}).d=t.getAttribute("d"),v.d=t.getAttribute("d")}if(b.length?(v=$$7(t).attr(b),$$7.each(v,function(e,t){v[e]=convertToNum(e,t)})):f&&(v={x:$$7(f).attr("x")||0,y:$$7(f).attr("y")||0}),isNullish(_)&&(_=$$7.extend(!0,{},v),$$7.each(_,function(e,t){_[e]=convertToNum(e,t)})),_.transform=context_.getStartTransform()||"","g"===t.tagName&&!f||"a"===t.tagName){var w=getBBox(t);p={x:w.x+w.width/2,y:w.y+w.height/2},g=transformPoint(w.x+w.width/2,w.y+w.height/2,transformListToTransform(r).matrix);var $=getRotationAngle(t);if($){var k,A=$*Math.PI/180;k=Math.abs(A)>1e-10?Math.sin(A)/(1-Math.cos(A)):2/A;for(var E=0;E<r.numberOfItems;++E){var N=r.getItem(E);if(4===N.type){var T=N.matrix;p.y=(k*T.e+T.f)/2,p.x=(T.e-k*T.f)/2,r.removeItem(E);break}}}var P,G,L=r.numberOfItems,I=0,M=0,R=0;if(L&&(P=r.getItem(0).matrix),L>=3&&3===r.getItem(L-2).type&&2===r.getItem(L-3).type&&2===r.getItem(L-1).type){R=3;for(var O=r.getItem(L-3).matrix,B=r.getItem(L-2).matrix,V=r.getItem(L-1).matrix,j=t.childNodes,F=j.length;F--;){var D=j.item(F);if(I=0,M=0,1===D.nodeType){var U=getTransformList(D);if(!U)continue;var H=transformListToTransform(U).matrix,z=getRotationAngle(D);if(G=context_.getStartTransform(),context_.setStartTransform(D.getAttribute("transform")),z||hasMatrixTransform(U)){var q=n.createSVGTransform();q.setMatrix(matrixMultiply(O,B,V,H)),U.clear(),U.appendItem(q)}else{var W=matrixMultiply(H.inverse(),V,H),Y=n.createSVGMatrix();Y.e=-W.e,Y.f=-W.f;var X=matrixMultiply(Y.inverse(),H.inverse(),O,B,V,H,W.inverse()),Q=n.createSVGTransform(),K=n.createSVGTransform(),Z=n.createSVGTransform();Q.setTranslate(W.e,W.f),K.setScale(X.a,X.d),Z.setTranslate(Y.e,Y.f),U.appendItem(Z),U.appendItem(K),U.appendItem(Q)}m.addSubCommand(e(D)),context_.setStartTransform(G)}}r.removeItem(L-1),r.removeItem(L-2),r.removeItem(L-3)}else if(L>=3&&1===r.getItem(L-1).type){R=3;var J=transformListToTransform(r).matrix,ee=n.createSVGTransform();ee.setMatrix(J),r.clear(),r.appendItem(ee)}else if((1===L||L>1&&3!==r.getItem(1).type)&&2===r.getItem(0).type){R=2;var te=transformListToTransform(r).matrix;r.removeItem(0);var ne=transformListToTransform(r).matrix.inverse(),re=matrixMultiply(ne,te);if(I=re.e,M=re.f,0!==I||0!==M){for(var ae=t.childNodes,ie=ae.length,se=[];ie--;){var oe=ae.item(ie);if(1===oe.nodeType){if(oe.getAttribute("clip-path")){var le=oe.getAttribute("clip-path");se.includes(le)||(updateClipPath(le,I,M),se.push(le))}G=context_.getStartTransform(),context_.setStartTransform(oe.getAttribute("transform"));var ce=getTransformList(oe);if(ce){var ue=n.createSVGTransform();ue.setTranslate(I,M),ce.numberOfItems?ce.insertItemBefore(ue,0):ce.appendItem(ue),m.addSubCommand(e(oe));for(var de=t.getElementsByTagNameNS(NS.SVG,"use"),he="#"+oe.id,pe=de.length;pe--;){var ge=de.item(pe);if(he===getHref(ge)){var fe=n.createSVGTransform();fe.setTranslate(-I,-M),getTransformList(ge).insertItemBefore(fe,0),m.addSubCommand(e(ge))}}context_.setStartTransform(G)}}}context_.setStartTransform(G)}}else{if(1!==L||1!==r.getItem(0).type||$){if($){var me=n.createSVGTransform();me.setRotate($,g.x,g.y),r.numberOfItems?r.insertItemBefore(me,0):r.appendItem(me)}return 0===r.numberOfItems&&t.removeAttribute("transform"),null}R=1;for(var ve=r.getItem(0).matrix,_e=t.childNodes,be=_e.length;be--;){var ye=_e.item(be);if(1===ye.nodeType){G=context_.getStartTransform(),context_.setStartTransform(ye.getAttribute("transform"));var xe=getTransformList(ye);if(!xe)continue;var Ce=matrixMultiply(ve,transformListToTransform(xe).matrix),Se=n.createSVGTransform();Se.setMatrix(Ce),xe.clear(),xe.appendItem(Se,0),m.addSubCommand(e(ye)),context_.setStartTransform(G);var we=ye.getAttribute("stroke-width");if("none"!==ye.getAttribute("stroke")&&!isNaN(we)){var $e=(Math.abs(Ce.a)+Math.abs(Ce.d))/2;ye.setAttribute("stroke-width",we*$e)}}}r.clear()}if(2===R){if($){g={x:p.x+P.e,y:p.y+P.f};var ke=n.createSVGTransform();ke.setRotate($,g.x,g.y),r.numberOfItems?r.insertItemBefore(ke,0):r.appendItem(ke)}}else if(3===R){var Ae=transformListToTransform(r).matrix,Ee=n.createSVGTransform();Ee.setRotate($,p.x,p.y);var Ne=Ee.matrix,Te=n.createSVGTransform();Te.setRotate($,g.x,g.y);var Pe=Te.matrix.inverse(),Ge=Ae.inverse(),Le=matrixMultiply(Ge,Pe,Ne,Ae);if(I=Le.e,M=Le.f,0!==I||0!==M)for(var Ie=t.childNodes,Me=Ie.length;Me--;){var Re=Ie.item(Me);if(1===Re.nodeType){G=context_.getStartTransform(),context_.setStartTransform(Re.getAttribute("transform"));var Oe=getTransformList(Re),Be=n.createSVGTransform();Be.setTranslate(I,M),Oe.numberOfItems?Oe.insertItemBefore(Be,0):Oe.appendItem(Be),m.addSubCommand(e(Re)),context_.setStartTransform(G)}}$&&(r.numberOfItems?r.insertItemBefore(Te,0):r.appendItem(Te))}}else{var Ve,je=getBBox(t);if(!je&&"path"!==t.tagName)return null;var Fe=getRotationAngle(t);if(Fe){p={x:je.x+je.width/2,y:je.y+je.height/2},g=transformPoint(je.x+je.width/2,je.y+je.height/2,transformListToTransform(r).matrix);for(var De=Fe*Math.PI/180,Ue=Math.abs(De)>1e-10?Math.sin(De)/(1-Math.cos(De)):2/De,He=0;He<r.numberOfItems;++He){var ze=r.getItem(He);if(4===ze.type){var qe=ze.matrix;p.y=(Ue*qe.e+qe.f)/2,p.x=(qe.e-Ue*qe.f)/2,r.removeItem(He);break}}}var We=0,Ye=r.numberOfItems;if(!isWebkit()){var Xe=t.getAttribute("fill");if(Xe&&Xe.startsWith("url(")){var Qe=getRefElem(Xe),Ke="pattern";if(Qe.tagName!==Ke&&(Ke="gradient"),"userSpaceOnUse"===Qe.getAttribute(Ke+"Units")){Ve=transformListToTransform(r).matrix;var Ze=getTransformList(Qe),Je=transformListToTransform(Ze).matrix,et="matrix("+[(Ve=matrixMultiply(Ve,Je)).a,Ve.b,Ve.c,Ve.d,Ve.e,Ve.f].join(",")+")";Qe.setAttribute(Ke+"Transform",et)}}}if(Ye>=3&&3===r.getItem(Ye-2).type&&2===r.getItem(Ye-3).type&&2===r.getItem(Ye-1).type)We=3,Ve=transformListToTransform(r,Ye-3,Ye-1).matrix,r.removeItem(Ye-1),r.removeItem(Ye-2),r.removeItem(Ye-3);else if(4===Ye&&1===r.getItem(Ye-1).type){We=3,Ve=transformListToTransform(r).matrix;var tt=n.createSVGTransform();tt.setMatrix(Ve),r.clear(),r.appendItem(tt),Ve=n.createSVGMatrix()}else if((1===Ye||Ye>1&&3!==r.getItem(1).type)&&2===r.getItem(0).type){We=2;var nt=r.getItem(0).matrix,rt=transformListToTransform(r,1).matrix,at=rt.inverse();Ve=matrixMultiply(at,nt,rt),r.removeItem(0)}else{if(1!==Ye||1!==r.getItem(0).type||Fe){if(Fe){var it=n.createSVGTransform();it.setRotate(Fe,g.x,g.y),r.numberOfItems?r.insertItemBefore(it,0):r.appendItem(it)}return 0===r.numberOfItems&&t.removeAttribute("transform"),null}switch(Ve=transformListToTransform(r).matrix,t.tagName){case"line":v=$$7(t).attr(["x1","y1","x2","y2"]);case"polyline":case"polygon":if(v.points=t.getAttribute("points"),v.points){var st=t.points,ot=st.numberOfItems;v.points=new Array(ot);for(var lt=0;lt<ot;++lt){var ct=st.getItem(lt);v.points[lt]={x:ct.x,y:ct.y}}}case"path":v.d=t.getAttribute("d"),We=1,r.clear()}}if(1!==We&&2!==We&&3!==We||remapElement(t,v,Ve),2===We){if(Fe){hasMatrixTransform(r)||(g={x:p.x+Ve.e,y:p.y+Ve.f});var ut=n.createSVGTransform();ut.setRotate(Fe,g.x,g.y),r.numberOfItems?r.insertItemBefore(ut,0):r.appendItem(ut)}if("text"===t.tagName)for(var dt=t.childNodes,ht=dt.length;ht--;){var pt=dt.item(ht);if("tspan"===pt.tagName){var gt={x:$$7(pt).attr("x")||0,y:$$7(pt).attr("y")||0};remapElement(pt,gt,Ve)}}}else if(3===We&&Fe){var ft=transformListToTransform(r).matrix,mt=n.createSVGTransform();mt.setRotate(Fe,p.x,p.y);var vt=mt.matrix,_t=n.createSVGTransform();_t.setRotate(Fe,g.x,g.y);var bt=_t.matrix.inverse(),yt=ft.inverse(),xt=matrixMultiply(yt,bt,vt,ft);remapElement(t,v,xt),Fe&&(r.numberOfItems?r.insertItemBefore(_t,0):r.appendItem(_t))}}return 0===r.numberOfItems&&t.removeAttribute("transform"),m.addSubCommand(new ChangeElementCommand(t,_)),m},$$8=jQuery,gripRadius=isTouch()?10:4,Selector=function(){function e(t,n,r){_classCallCheck(this,e),this.id=t,this.selectedElement=n,this.locked=!0,this.selectorGroup=svgFactory_.createSVGElement({element:"g",attr:{id:"selectorGroup"+this.id}}),this.selectorRect=this.selectorGroup.appendChild(svgFactory_.createSVGElement({element:"path",attr:{id:"selectedBox"+this.id,fill:"none",stroke:"#22C","stroke-width":"1","stroke-dasharray":"5,5",style:"pointer-events:none"}})),this.gripCoords={nw:null,n:null,ne:null,e:null,se:null,s:null,sw:null,w:null},this.reset(this.selectedElement,r)}return _createClass(e,[{key:"reset",value:function(e,t){this.locked=!0,this.selectedElement=e,this.resize(t),this.selectorGroup.setAttribute("display","inline")}},{key:"showGrips",value:function(t){var n=t?"inline":"none";selectorManager_.selectorGripsGroup.setAttribute("display",n);var r=this.selectedElement;this.hasGrips=t,r&&t&&(this.selectorGroup.append(selectorManager_.selectorGripsGroup),e.updateGripCursors(getRotationAngle(r)))}},{key:"resize",value:function(e){var t=this.selectorRect,n=selectorManager_,r=n.selectorGrips,a=this.selectedElement,i=a.getAttribute("stroke-width"),s=svgFactory_.getCurrentZoom(),o=1/s;"none"===a.getAttribute("stroke")||isNaN(i)||(o+=i/2);var l=a.tagName;"text"===l&&(o+=2/s);var c=getTransformList(a),u=transformListToTransform(c).matrix;if(u.e*=s,u.f*=s,e||(e=getBBox(a)),"g"===l&&!$$8.data(a,"gsvg")){var d=getStrokedBBox([a.childNodes]);d&&(e=d)}var h=e.x,p=e.y,g=e.width,f=e.height;o*=s;var m=transformBox(h*s,p*s,g*s,f*s,u),v=m.aabox,_=v.x-o,b=v.y-o,y=v.width+2*o,x=v.height+2*o,C=_+y/2,S=b+x/2,w=getRotationAngle(a);if(w){var $=svgFactory_.svgRoot().createSVGTransform();$.setRotate(-w,C,S);var k=$.matrix;m.tl=transformPoint(m.tl.x,m.tl.y,k),m.tr=transformPoint(m.tr.x,m.tr.y,k),m.bl=transformPoint(m.bl.x,m.bl.y,k),m.br=transformPoint(m.br.x,m.br.y,k);var A=m.tl,E=A.x,N=A.y,T=A.x,P=A.y,G=Math.min,L=Math.max;_=E=G(E,G(m.tr.x,G(m.bl.x,m.br.x)))-o,b=N=G(N,G(m.tr.y,G(m.bl.y,m.br.y)))-o,y=(T=L(T,L(m.tr.x,L(m.bl.x,m.br.x)))+o)-E,x=(P=L(P,L(m.tr.y,L(m.bl.y,m.br.y)))+o)-N}var I="M"+_+","+b+" L"+(_+y)+","+b+" "+(_+y)+","+(b+x)+" "+_+","+(b+x)+"z";t.setAttribute("d",I);var M=w?"rotate("+[w,C,S].join(",")+")":"";this.selectorGroup.setAttribute("transform",M),this.gripCoords={nw:[_,b],ne:[_+y,b],sw:[_,b+x],se:[_+y,b+x],n:[_+y/2,b],w:[_,b+x/2],e:[_+y,b+x/2],s:[_+y/2,b+x]},Object.entries(this.gripCoords).forEach(function(e){var t=_slicedToArray(e,2),n=t[0],a=t[1];r[n].setAttribute("cx",a[0]),r[n].setAttribute("cy",a[1])}),n.rotateGripConnector.setAttribute("x1",_+y/2),n.rotateGripConnector.setAttribute("y1",b),n.rotateGripConnector.setAttribute("x2",_+y/2),n.rotateGripConnector.setAttribute("y2",b-5*gripRadius),n.rotateGrip.setAttribute("cx",_+y/2),n.rotateGrip.setAttribute("cy",b-5*gripRadius)}}]),e}();Selector.updateGripCursors=function(e){var t=Object.keys(selectorManager_.selectorGrips),n=Math.round(e/45);for(n<0&&(n+=8);n>0;)t.push(t.shift()),n--;Object.values(selectorManager_.selectorGrips).forEach(function(e,n){e.setAttribute("style","cursor:"+t[n]+"-resize")})};var SelectorManager=function(){function e(){_classCallCheck(this,e),this.selectorParentGroup=null,this.rubberBandBox=null,this.selectors=[],this.selectorMap={},this.selectorGrips={nw:null,n:null,ne:null,e:null,se:null,s:null,sw:null,w:null},this.selectorGripsGroup=null,this.rotateGripConnector=null,this.rotateGrip=null,this.initGroup()}return _createClass(e,[{key:"initGroup",value:function(){var e=this;if(this.selectorParentGroup&&this.selectorParentGroup.parentNode&&this.selectorParentGroup.remove(),this.selectorParentGroup=svgFactory_.createSVGElement({element:"g",attr:{id:"selectorParentGroup"}}),this.selectorGripsGroup=svgFactory_.createSVGElement({element:"g",attr:{display:"none"}}),this.selectorParentGroup.append(this.selectorGripsGroup),svgFactory_.svgRoot().append(this.selectorParentGroup),this.selectorMap={},this.selectors=[],this.rubberBandBox=null,Object.keys(this.selectorGrips).forEach(function(t){var n=svgFactory_.createSVGElement({element:"circle",attr:{id:"selectorGrip_resize_"+t,fill:"#22C",r:gripRadius,style:"cursor:"+t+"-resize","stroke-width":2,"pointer-events":"all"}});$$8.data(n,"dir",t),$$8.data(n,"type","resize"),e.selectorGrips[t]=e.selectorGripsGroup.appendChild(n)}),this.rotateGripConnector=this.selectorGripsGroup.appendChild(svgFactory_.createSVGElement({element:"line",attr:{id:"selectorGrip_rotateconnector",stroke:"#22C","stroke-width":"1"}})),this.rotateGrip=this.selectorGripsGroup.appendChild(svgFactory_.createSVGElement({element:"circle",attr:{id:"selectorGrip_rotate",fill:"lime",r:gripRadius,stroke:"#22C","stroke-width":2,style:"cursor:url("+config_.imgPath+"rotate.png) 12 12, auto;"}})),$$8.data(this.rotateGrip,"type","rotate"),!$$8("#canvasBackground").length){var t=_slicedToArray(config_.dimensions,2),n=t[0],r=t[1],a=svgFactory_.createSVGElement({element:"svg",attr:{id:"canvasBackground",width:n,height:r,x:0,y:0,overflow:isWebkit()?"none":"visible",style:"pointer-events:none"}}),i=svgFactory_.createSVGElement({element:"rect",attr:{width:"100%",height:"100%",x:0,y:0,"stroke-width":1,stroke:"#000",fill:"#FFF",style:"pointer-events:none"}});a.append(i),svgFactory_.svgRoot().insertBefore(a,svgFactory_.svgContent())}}},{key:"requestSelector",value:function(e,t){if(isNullish(e))return null;var n=this.selectors.length;if("object"===_typeof(this.selectorMap[e.id]))return this.selectorMap[e.id].locked=!0,this.selectorMap[e.id];for(var r=0;r<n;++r)if(this.selectors[r]&&!this.selectors[r].locked)return this.selectors[r].locked=!0,this.selectors[r].reset(e,t),this.selectorMap[e.id]=this.selectors[r],this.selectors[r];return this.selectors[n]=new Selector(n,e,t),this.selectorParentGroup.append(this.selectors[n].selectorGroup),this.selectorMap[e.id]=this.selectors[n],this.selectors[n]}},{key:"releaseSelector",value:function(e){if(!isNullish(e)){var t=this.selectors.length,n=this.selectorMap[e.id];n.locked||console.log("WARNING! selector was released but was already unlocked");for(var r=0;r<t;++r)if(this.selectors[r]&&this.selectors[r]===n){delete this.selectorMap[e.id],n.locked=!1,n.selectedElement=null,n.showGrips(!1);try{n.selectorGroup.setAttribute("display","none")}catch(e){}break}}}},{key:"getRubberBandBox",value:function(){return this.rubberBandBox||(this.rubberBandBox=this.selectorParentGroup.appendChild(svgFactory_.createSVGElement({element:"rect",attr:{id:"selectorRubberBand",fill:"#22C","fill-opacity":.15,stroke:"#22C","stroke-width":.5,display:"none",style:"pointer-events:none"}}))),this.rubberBandBox}}]),e}(),init$6=function(e,t){config_=e,svgFactory_=t,selectorManager_=new SelectorManager},getSelectorManager=function(){return selectorManager_},$$9=jQueryPluginSVG(jQuery),MoveElementCommand$1=MoveElementCommand,InsertElementCommand$1=InsertElementCommand,RemoveElementCommand$1=RemoveElementCommand,ChangeElementCommand$1=ChangeElementCommand,BatchCommand$1=BatchCommand,UndoManager$1=UndoManager,HistoryEventTypes$1=HistoryEventTypes;window.console||(window.console={},window.console.log=function(e){},window.console.dir=function(e){}),window.opera&&(window.console.log=function(e){window.opera.postError(e)},window.console.dir=function(e){});var SvgCanvas=function e(t,n){_classCallCheck(this,e);var r={show_outside_canvas:!0,selectNew:!0,dimensions:[640,480]};n&&$$9.extend(r,n);var a=r.dimensions,i=this,s=t.ownerDocument,o=s.importNode(text2xml('<svg id="svgroot" xmlns="'+NS.SVG+'" xlinkns="'+NS.XLINK+'" width="'+a[0]+'" height="'+a[1]+'" x="'+a[0]+'" y="'+a[1]+'" overflow="visible"><defs><filter id="canvashadow" filterUnits="objectBoundingBox"><feGaussianBlur in="SourceAlpha" stdDeviation="4" result="blur"/><feOffset in="blur" dx="5" dy="5" result="offsetBlur"/><feMerge><feMergeNode in="offsetBlur"/><feMergeNode in="SourceGraphic"/></feMerge></filter></defs></svg>').documentElement,!0);t.append(o);var l=s.createElementNS(NS.SVG,"svg");(i.clearSvgContentElement=function(){$$9(l).empty(),$$9(l).attr({id:"svgcontent",width:a[0],height:a[1],x:a[0],y:a[1],overflow:r.show_outside_canvas?"visible":"hidden",xmlns:NS.SVG,"xmlns:se":NS.SE,"xmlns:xlink":NS.XLINK}).appendTo(o);var e=s.createComment(" Created with SVG-edit - https://github.com/SVG-Edit/svgedit");l.append(e)})();var c="svg_";i.setIdPrefix=function(e){c=e},i.current_drawing_=new Drawing(l,c);var u=i.getCurrentDrawing=function(){return i.current_drawing_},d=1,h=null,p={shape:{fill:("none"===r.initFill.color?"":"#")+r.initFill.color,fill_paint:null,fill_opacity:r.initFill.opacity,stroke:"#"+r.initStroke.color,stroke_paint:null,stroke_opacity:r.initStroke.opacity,stroke_width:r.initStroke.width,stroke_dasharray:"none",stroke_linejoin:"miter",stroke_linecap:"butt",opacity:r.initOpacity}};p.text=$$9.extend(!0,{},p.shape),$$9.extend(p.text,{fill:"#000000",stroke_width:r.text&&r.text.stroke_width,font_size:r.text&&r.text.font_size,font_family:r.text&&r.text.font_family});var g=p.shape,f=[],m=this.getJsonFromSvgElement=function(e){if(3===e.nodeType)return e.nodeValue;for(var t,n={element:e.tagName,attr:{},children:[]},r=0;t=e.attributes[r];r++)n.attr[t.name]=t.value;for(var a,i=0;a=e.childNodes[i];i++)n.children[i]=m(a);return n},v=this.addSVGElementFromJson=function(e){if("string"==typeof e)return s.createTextNode(e);var t=getElem(e.attr.id),n=u().getCurrentLayer();if(t&&e.element!==t.tagName&&(t.remove(),t=null),!t){var r=e.namespace||NS.SVG;t=s.createElementNS(r,e.element),n&&(h||n).append(t)}return e.curStyles&&assignAttributes(t,{fill:g.fill,stroke:g.stroke,"stroke-width":g.stroke_width,"stroke-dasharray":g.stroke_dasharray,"stroke-linejoin":g.stroke_linejoin,"stroke-linecap":g.stroke_linecap,"stroke-opacity":g.stroke_opacity,"fill-opacity":g.fill_opacity,opacity:g.opacity/2,style:"pointer-events:inherit"},100),assignAttributes(t,e.attr,100),cleanupElement(t),e.children&&e.children.forEach(function(e){t.append(v(e))}),t};i.getTransformList=getTransformList,i.matrixMultiply=matrixMultiply,i.hasMatrixTransform=hasMatrixTransform,i.transformListToTransform=transformListToTransform;var _=function(){return r.baseUnit};init({getBaseUnit:_,getElement:getElem,getHeight:function(){return l.getAttribute("height")/d},getWidth:function(){return l.getAttribute("width")/d},getRoundDigits:function(){return H.round_digits}}),i.convertToNum=convertToNum;var b=function(){return l},y=this.getSelectedElems=function(){return f},x=pathActions,C=function(){return o};init$2({pathActions:x,getSVGContent:b,addSVGElementFromJson:v,getSelectedElements:y,getDOMDocument:function(){return s},getDOMContainer:function(){return t},getSVGRoot:C,getBaseUnit:_,getSnappingStep:function(){return r.snappingStep}}),i.findDefs=findDefs,i.getUrlFromAttr=getUrlFromAttr,i.getHref=getHref,i.setHref=setHref,i.getBBox=getBBox,i.getRotationAngle=getRotationAngle,i.getElem=getElem,i.getRefElem=getRefElem,i.assignAttributes=assignAttributes,this.cleanupElement=cleanupElement;var S=function(){return r.gridSnapping};init$4({getDrawing:function(){return u()},getSVGRoot:C,getGridSnapping:S}),this.remapElement=remapElement,init$5({getSVGRoot:C,getStartTransform:function(){return K},setStartTransform:function(e){K=e}}),this.recalculateDimensions=recalculateDimensions;var w=getReverseNS();i.sanitizeSvg=sanitizeSvg;var $=i.undoMgr=new UndoManager$1({handleHistoryEvent:function(e,t){var n=HistoryEventTypes$1;if(e===n.BEFORE_UNAPPLY||e===n.BEFORE_APPLY)i.clearSelection();else if(e===n.AFTER_APPLY||e===n.AFTER_UNAPPLY){var r=t.elements();i.pathActions.clear(),G("changed",r);var a=t.type(),s=e===n.AFTER_APPLY;if(a===MoveElementCommand$1.type())(s?t.newParent:t.oldParent)===l&&identifyLayers();else if(a===InsertElementCommand$1.type()||a===RemoveElementCommand$1.type())t.parent===l&&identifyLayers(),a===InsertElementCommand$1.type()?s&&D(t.elem):s||D(t.elem),"use"===t.elem.tagName&&Re(t.elem);else if(a===ChangeElementCommand$1.type()){"title"===t.elem.tagName&&t.elem.parentNode.parentNode===l&&identifyLayers();var o=s?t.newValues:t.oldValues;o.stdDeviation&&i.setBlurOffsets(t.elem.parentNode,o.stdDeviation)}}}}),k=function(e){i.undoMgr.addCommandToHistory(e)},A=this.getZoom=function(){return d},E=this.round=function(e){return parseInt(e*d)/d};init$6(r,{createSVGElement:function(e){return i.addSVGElementFromJson(e)},svgRoot:function(){return o},svgContent:function(){return l},getCurrentZoom:A});var N=this.selectorManager=getSelectorManager(),T=i.getNextId=function(){return u().getNextId()},P=i.getId=function(){return u().getId()},G=function(e,t){if(ce[e])return ce[e](window,t)},L=this.clearSelection=function(e){f.forEach(function(e){isNullish(e)||N.releaseSelector(e)}),f=[],e||G("selected",f)},I=this.addToSelection=function(e,t){if(e.length){for(var n=0;n<f.length&&!isNullish(f[n]);)++n;for(var r=e.length;r--;){var a=e[r];if(a){var i=getBBox(a);if(i&&("a"===a.tagName&&1===a.childNodes.length&&(a=a.firstChild),!f.includes(a))){f[n]=a,n++;var s=N.requestSelector(a,i);f.length>1&&s.showGrips(!1)}}}for(G("selected",f),t||1===f.length?N.requestSelector(f[0]).showGrips(!0):N.requestSelector(f[0]).showGrips(!1),f.sort(function(e,t){return e&&t&&e.compareDocumentPosition?3-(6&t.compareDocumentPosition(e)):isNullish(e)?1:0});isNullish(f[0]);)f.shift(0)}},M=function(){return g.opacity},R=this.getMouseTarget=function(e){if(isNullish(e))return null;var n=e.target;if(n.correspondingUseElement&&(n=n.correspondingUseElement),[NS.MATH,NS.HTML].includes(n.namespaceURI)&&"svgcanvas"!==n.id)for(;"foreignObject"!==n.nodeName;)if(!(n=n.parentNode))return o;var r=u().getCurrentLayer();if([o,t,l,r].includes(n))return o;if($$9(n).closest("#selectorParentGroup").length)return N.selectorParentGroup;for(;n.parentNode!==(h||r);)n=n.parentNode;return n};i.pathActions=x,init$1({selectorManager:N,canvas:i,call:G,resetD:function(e){e.setAttribute("d",x.convertPath(e))},round:E,clearSelection:L,addToSelection:I,addCommandToHistory:k,remapElement:remapElement,addSVGElementFromJson:v,getGridSnapping:S,getOpacity:M,getSelectedElements:y,getContainer:function(){return t},setStarted:function(e){Q=e},getRubberBox:function(){return ne},setRubberBox:function(e){return ne=e},addPtsToSelection:function(e){var t=e.closedSubpath,n=e.grips;x.canDeleteNodes=!0,x.closed_subpath=t,G("pointsAdded",{closedSubpath:t,grips:n}),G("selected",n)},endChanges:function(e){var t=e.cmd,n=e.elem;k(t),G("changed",[n])},getCurrentZoom:A,getId:P,getNextId:T,getMouseTarget:R,getCurrentMode:function(){return Z},setCurrentMode:function(e){return Z=e},getDrawnPath:function(){return Te},setDrawnPath:function(e){return Te=e},getSVGRoot:C});var O={},B="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use",V=["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"],j=$$9.data,F=document.createElementNS(NS.SVG,"animate");$$9(F).attr({attributeName:"opacity",begin:"indefinite",dur:1,fill:"freeze"}).appendTo(o);var D=function e(t){var n=$$9(t).attr(V);Object.values(n).forEach(function(e){if(e&&e.startsWith("url(")){var t=getUrlFromAttr(e).substr(1);getElem(t)||(findDefs().append(Y[t]),delete Y[t])}});var r=t.getElementsByTagName("*");if(r.length)for(var a=0,i=r.length;a<i;a++)e(r[a])},U={},H={round_digits:5},z={},q=p.text,W={},Y={},X=r.imgPath+"logo.png",Q=!1,K=null,Z="select",J="none",ee=g,te=null,ne=null,re=[],ae=null;this.runExtension=function(e,t,n){return this.runExtensions(t,n,!1,function(t){return t===e})};var ie=this.runExtensions=function(e,t,n,r){var a=!!n&&[];return $$9.each(W,function(i,s){r&&!r(i)||s&&e in s&&("function"==typeof t&&(t=t(i)),n?a.push(s[e](t)):a=s[e](t))}),a};this.addExtension=function(){var e=_asyncToGenerator(regeneratorRuntime.mark(function e(t,n,r){var a,s,c,d;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(a=r.$,s=r.importLocale,"function"==typeof n){e.next=3;break}throw new TypeError("Function argument expected for `svgcanvas.addExtension`");case 3:if(!(t in W)){e.next=5;break}throw new Error('Cannot add extension "'+t+'", an extension by that name already exists.');case 5:return c=$$9.extend(i.getPrivateMethods(),{$:a,importLocale:s,svgroot:o,svgcontent:l,nonce:u().getNonce(),selectorManager:N}),e.next=8,n(c);case 8:return(d=e.sent)&&(d.name=t),W[t]=d,e.abrupt("return",G("extension_added",d));case 12:case"end":return e.stop()}},e,this)}));return function(t,n,r){return e.apply(this,arguments)}}();var se=this.getIntersectionList=function(e){if(isNullish(ne))return null;var t,n=h||u().getCurrentLayer();if(e)(t=l.createSVGRect()).x=e.x,t.y=e.y,t.width=e.width,t.height=e.height;else{t=ne.getBBox();var r=l.createSVGRect();["x","y","width","height","top","right","bottom","left"].forEach(function(e){r[e]=t[e]/d}),t=r}var a=null;if(isIE||"function"==typeof o.getIntersectionList&&(t.x+=parseInt(l.getAttribute("x")),t.y+=parseInt(l.getAttribute("y")),a=o.getIntersectionList(t,n)),isNullish(a)||"function"!=typeof a.item){a=[],re.length||(re=oe(n));for(var i=re.length;i--;)t.width&&rectsIntersect(t,re[i].bbox)&&a.push(re[i].elem)}return a};this.getStrokedBBox=getStrokedBBoxDefaultVisible,this.getVisibleElements=getVisibleElements;var oe=this.getVisibleElementsAndBBoxes=function(e){e||(e=$$9(l).children());var t=[];return $$9(e).children().each(function(e,n){n.getBBox&&t.push({elem:n,bbox:getStrokedBBoxDefaultVisible([n])})}),t.reverse()},le=this.groupSvgElem=function(e){var t=document.createElementNS(NS.SVG,"g");e.replaceWith(t),$$9(t).append(e).data("gsvg",e)[0].id=T()},ce={};i.call=G,i.bind=function(e,t){var n=ce[e];return ce[e]=t,n},this.prepareSvg=function(e){this.sanitizeSvg(e.documentElement),_toConsumableArray(e.getElementsByTagNameNS(NS.SVG,"path")).forEach(function(e){e.setAttribute("d",x.convertPath(e)),x.fixEnd(e)})};var ue=function(e){if(!isGecko())return e;var t=e.cloneNode(!0);return e.before(t),e.remove(),N.releaseSelector(e),f[0]=t,N.requestSelector(t).showGrips(!0),t};this.setRotationAngle=function(e,t){e=parseFloat(e);var n=f[0],r=n.getAttribute("transform"),a=getBBox(n),i=a.x+a.width/2,s=a.y+a.height/2,l=getTransformList(n);l.numberOfItems>0&&(4===l.getItem(0).type&&l.removeItem(0));if(0!==e){var c=transformPoint(i,s,transformListToTransform(l).matrix),u=o.createSVGTransform();u.setRotate(e,c.x,c.y),l.numberOfItems?l.insertItemBefore(u,0):l.appendItem(u)}else 0===l.numberOfItems&&n.removeAttribute("transform");if(!t){var d=n.getAttribute("transform");n.setAttribute("transform",r),ze("transform",d,f),G("changed",f)}N.requestSelector(f[0]).resize(),Selector.updateGripCursors(e)};var de=this.recalculateAllSelectedDimensions=function(){for(var e=new BatchCommand$1("none"===J?"position":"size"),t=f.length;t--;){var n=f[t],r=recalculateDimensions(n);r&&e.addSubCommand(r)}e.isEmpty()||(k(e),G("changed",f))},he=function(e){console.log([e.a,e.b,e.c,e.d,e.e,e.f])},pe=null,ge=this.selectOnly=function(e,t){L(!0),I(e,t)};this.removeFromSelection=function(e){if(!isNullish(f[0])&&e.length){for(var t=[],n=f.length,r=0;r<n;++r){var a=f[r];a&&(e.includes(a)?N.releaseSelector(a):t.push(a))}f=t}},this.selectAllInCurrentLayer=function(){var e=u().getCurrentLayer();e&&(Z="select",ge($$9(h||e).children()))};var fe,me,ve,_e,be,ye,xe,Ce,Se,we,$e,ke,Ae,Ee,Ne,Te=null;me={minx:null,miny:null,maxx:null,maxy:null},ve=null,_e=null,be=null,ye=null,xe={},Ce=0,Se={x:0,y:0},we={x:0,y:0},$e={x:0,y:0},ke={x:0,y:0},Ae={x:0,y:0},Ee={x:0,y:0},Ne=function(e){var t={x:0,y:0},n=Se,r=we,a=$e,i=ke,s=e*e,o=s*e,l=[[-1,3,-3,1],[3,-6,3,0],[-3,0,3,0],[1,4,1,0]];return t.x=1/6*((n.x*l[0][0]+r.x*l[0][1]+a.x*l[0][2]+i.x*l[0][3])*o+(n.x*l[1][0]+r.x*l[1][1]+a.x*l[1][2]+i.x*l[1][3])*s+(n.x*l[2][0]+r.x*l[2][1]+a.x*l[2][2]+i.x*l[2][3])*e+(n.x*l[3][0]+r.x*l[3][1]+a.x*l[3][2]+i.x*l[3][3])),t.y=1/6*((n.y*l[0][0]+r.y*l[0][1]+a.y*l[0][2]+i.y*l[0][3])*o+(n.y*l[1][0]+r.y*l[1][1]+a.y*l[1][2]+i.y*l[1][3])*s+(n.y*l[2][0]+r.y*l[2][1]+a.y*l[2][2]+i.y*l[2][3])*e+(n.y*l[3][0]+r.y*l[3][1]+a.y*l[3][2]+i.y*l[3][3])),{x:t.x,y:t.y}},$$9(t).mousedown(function(e){if(!i.spaceKey&&1!==e.button){var t=2===e.button;e.altKey&&i.cloneSelectedElements(0,0),pe=$$9("#svgcontent g")[0].getScreenCTM().inverse();var n=transformPoint(e.pageX,e.pageY,pe),a=n.x*d,s=n.y*d;e.preventDefault(),t&&(Z="select",ae=n);var l=a/d,c=s/d,u=R(e);"a"===u.tagName&&1===u.childNodes.length&&(u=u.firstChild);var h=l;be=ve=l;var p=c;if(ye=_e=c,r.gridSnapping&&(l=snapToGrid(l),c=snapToGrid(c),ve=snapToGrid(ve),_e=snapToGrid(_e)),u===N.selectorParentGroup&&!isNullish(f[0])){var m=e.target,_=j(m,"type");"rotate"===_?Z="rotate":"resize"===_&&(Z="resize",J=j(m,"dir")),u=f[0]}K=u.getAttribute("transform");var b=getTransformList(u);switch(Z){case"select":if(Q=!0,J="none",t&&(Q=!1),u!==o){if(f.includes(u)||(e.shiftKey||L(!0),I([u]),te=u,x.clear()),!t)for(var y=0;y<f.length;++y)if(!isNullish(f[y])){var C=getTransformList(f[y]);C.numberOfItems?C.insertItemBefore(o.createSVGTransform(),0):C.appendItem(o.createSVGTransform())}}else t||(L(),Z="multiselect",isNullish(ne)&&(ne=N.getRubberBandBox()),assignAttributes(ne,{x:be*=d,y:ye*=d,width:0,height:0,display:"inline"},100));break;case"zoom":Q=!0,isNullish(ne)&&(ne=N.getRubberBandBox()),assignAttributes(ne,{x:h*d,y:h*d,width:0,height:0,display:"inline"},100);break;case"resize":Q=!0,ve=l,_e=c,xe=getBBox($$9("#selectedBox0")[0]);var S={};$$9.each(xe,function(e,t){S[e]=t/d}),xe=S;var w=getRotationAngle(u)?1:0;if(hasMatrixTransform(b))b.insertItemBefore(o.createSVGTransform(),w),b.insertItemBefore(o.createSVGTransform(),w),b.insertItemBefore(o.createSVGTransform(),w);else if(b.appendItem(o.createSVGTransform()),b.appendItem(o.createSVGTransform()),b.appendItem(o.createSVGTransform()),supportsNonScalingStroke()){var $,k=isWebkit();k&&($=function(e){var t=e.getAttribute("stroke");e.removeAttribute("stroke"),null!==t&&setTimeout(function(){e.setAttribute("stroke",t)},0)}),u.style.vectorEffect="non-scaling-stroke",k&&$(u);for(var A=u.getElementsByTagName("*"),E=A.length,P=0;P<E;P++)A[P].style&&(A[P].style.vectorEffect="non-scaling-stroke",k&&$(A[P]))}break;case"fhellipse":case"fhrect":case"fhpath":$e.x=h,$e.y=p,Q=!0,v({element:"polyline",curStyles:!0,attr:{points:h+","+p+" ",id:T(),fill:"none",opacity:g.opacity/2,"stroke-linecap":"round",style:"pointer-events:none"}}),me.minx=h,me.maxx=h,me.miny=p,me.maxy=p;break;case"image":Q=!0;var G=v({element:"image",attr:{x:l,y:c,width:0,height:0,id:T(),opacity:g.opacity/2,style:"pointer-events:inherit"}});setHref(G,X),preventClickDefault(G);break;case"square":case"rect":Q=!0,ve=l,_e=c,v({element:"rect",curStyles:!0,attr:{x:l,y:c,width:0,height:0,id:T(),opacity:g.opacity/2}});break;case"line":Q=!0;var M=0===Number(g.stroke_width)?1:g.stroke_width;v({element:"line",curStyles:!0,attr:{x1:l,y1:c,x2:l,y2:c,id:T(),stroke:g.stroke,"stroke-width":M,"stroke-dasharray":g.stroke_dasharray,"stroke-linejoin":g.stroke_linejoin,"stroke-linecap":g.stroke_linecap,"stroke-opacity":g.stroke_opacity,fill:"none",opacity:g.opacity/2,style:"pointer-events:none"}});break;case"circle":Q=!0,v({element:"circle",curStyles:!0,attr:{cx:l,cy:c,r:0,id:T(),opacity:g.opacity/2}});break;case"ellipse":Q=!0,v({element:"ellipse",curStyles:!0,attr:{cx:l,cy:c,rx:0,ry:0,id:T(),opacity:g.opacity/2}});break;case"text":Q=!0,v({element:"text",curStyles:!0,attr:{x:l,y:c,id:T(),fill:q.fill,"stroke-width":q.stroke_width,"font-size":q.font_size,"font-family":q.font_family,"text-anchor":"middle","xml:space":"preserve",opacity:g.opacity}});break;case"path":case"pathedit":ve*=d,_e*=d,x.mouseDown(e,u,ve,_e),Q=!0;break;case"textedit":ve*=d,_e*=d,Ge.mouseDown(e,u,ve,_e),Q=!0;break;case"rotate":Q=!0,i.undoMgr.beginUndoableChange("transform",f)}var O=ie("mouseDown",{event:e,start_x:ve,start_y:_e,selectedElements:f},!0);$$9.each(O,function(e,t){t&&t.started&&(Q=!0)})}}).mousemove(function(e){if(Q&&1!==e.button&&!i.spaceKey){var t,n,a,s,c,u,h,p,g,m,v=f[0],_=transformPoint(e.pageX,e.pageY,pe),b=_.x*d,y=_.y*d,C=getElem(P()),S=b/d,w=S,$=y/d,k=$;switch(r.gridSnapping&&(w=snapToGrid(w),k=snapToGrid(k)),e.preventDefault(),Z){case"select":if(null!==f[0]&&(c=w-ve,u=k-_e,r.gridSnapping&&(c=snapToGrid(c),u=snapToGrid(u)),0!==c||0!==u)){for(h=f.length,t=0;t<h&&(v=f[t],!isNullish(v));++t){var A=o.createSVGTransform();m=getTransformList(v),A.setTranslate(c,u),m.numberOfItems?m.replaceItem(A,0):m.appendItem(A),N.requestSelector(v).resize()}G("transition",f)}break;case"multiselect":S*=d,$*=d,assignAttributes(ne,{x:Math.min(be,S),y:Math.min(ye,$),width:Math.abs(S-be),height:Math.abs($-ye)},100);var E=f.slice(),T=[],L=se();for(h=L.length,t=0;t<h;++t){var I=L[t];f.includes(I)||T.push(I);var M=E.indexOf(I);-1!==M&&E.splice(M,1)}E.length>0&&i.removeFromSelection(E),T.length>0&&i.addToSelection(T);break;case"resize":m=getTransformList(v);var R=hasMatrixTransform(m),O=(g=R?xe:getBBox(v)).x,B=g.y,V=g,j=V.width,F=V.height;if(c=w-ve,u=k-_e,r.gridSnapping&&(c=snapToGrid(c),u=snapToGrid(u),F=snapToGrid(F),j=snapToGrid(j)),p=getRotationAngle(v)){var D=Math.sqrt(c*c+u*u),U=Math.atan2(u,c)-p*Math.PI/180;c=D*Math.cos(U),u=D*Math.sin(U)}J.includes("n")||J.includes("s")||(u=0),J.includes("e")||J.includes("w")||(c=0);var H=0,z=0,q=F?(F+u)/F:1,W=j?(j+c)/j:1;J.includes("n")&&(q=F?(F-u)/F:1,z=F),J.includes("w")&&(W=j?(j-c)/j:1,H=j);var Y=o.createSVGTransform(),X=o.createSVGTransform(),K=o.createSVGTransform();if(r.gridSnapping&&(O=snapToGrid(O),H=snapToGrid(H),B=snapToGrid(B),z=snapToGrid(z)),Y.setTranslate(-(O+H),-(B+z)),e.shiftKey&&(1===W?W=q:q=W),X.setScale(W,q),K.setTranslate(O+H,B+z),R){var ee=p?1:0;m.replaceItem(Y,2+ee),m.replaceItem(X,1+ee),m.replaceItem(K,Number(ee))}else{var te=m.numberOfItems;m.replaceItem(K,te-3),m.replaceItem(X,te-2),m.replaceItem(Y,te-1)}N.requestSelector(v).resize(),G("transition",f);break;case"zoom":S*=d,$*=d,assignAttributes(ne,{x:Math.min(be*d,S),y:Math.min(ye*d,$),width:Math.abs(S-be*d),height:Math.abs($-ye*d)},100);break;case"text":assignAttributes(C,{x:w,y:k},1e3);break;case"line":r.gridSnapping&&(w=snapToGrid(w),k=snapToGrid(k));var re=w,ae=k;e.shiftKey&&(re=(n=snapToAngle(ve,_e,re,ae)).x,ae=n.y),C.setAttribute("x2",re),C.setAttribute("y2",ae);break;case"foreignObject":case"square":case"rect":case"image":var oe,le,ce="square"===Z||e.shiftKey,ue=Math.abs(w-ve),de=Math.abs(k-_e);ce?(ue=de=Math.max(ue,de),oe=ve<w?ve:ve-ue,le=_e<k?_e:_e-de):(oe=Math.min(ve,w),le=Math.min(_e,k)),r.gridSnapping&&(ue=snapToGrid(ue),de=snapToGrid(de),oe=snapToGrid(oe),le=snapToGrid(le)),assignAttributes(C,{width:ue,height:de,x:oe,y:le},1e3);break;case"circle":var he=$$9(C).attr(["cx","cy"]);a=he.cx,s=he.cy;var ge=Math.sqrt((w-a)*(w-a)+(k-s)*(k-s));r.gridSnapping&&(ge=snapToGrid(ge)),C.setAttribute("r",ge);break;case"ellipse":var Te=$$9(C).attr(["cx","cy"]);a=Te.cx,s=Te.cy,r.gridSnapping&&(w=snapToGrid(w),a=snapToGrid(a),k=snapToGrid(k),s=snapToGrid(s)),C.setAttribute("rx",Math.abs(w-a));var Pe=Math.abs(e.shiftKey?w-a:k-s);C.setAttribute("ry",Pe);break;case"fhellipse":case"fhrect":me.minx=Math.min(S,me.minx),me.maxx=Math.max(S,me.maxx),me.miny=Math.min($,me.miny),me.maxy=Math.max($,me.maxy);case"fhpath":if(ke.x=S,ke.y=$,Se.x&&Se.y)for(t=0;t<9;t++)if(fe=t/10,Ae=Ne((t+1)/10),Ee=Ae,Ae=Ne(fe),(Ce+=Math.sqrt((Ee.x-Ae.x)*(Ee.x-Ae.x)+(Ee.y-Ae.y)*(Ee.y-Ae.y)))>.8){Ce-=.8;var Le=l.createSVGPoint();Le.x=Ae.x,Le.y=Ae.y,C.points.appendItem(Le)}Se={x:we.x,y:we.y},we={x:$e.x,y:$e.y},$e={x:ke.x,y:ke.y};break;case"path":case"pathedit":if(w*=d,k*=d,r.gridSnapping&&(w=snapToGrid(w),k=snapToGrid(k),ve=snapToGrid(ve),_e=snapToGrid(_e)),e.shiftKey){var Ie,Me,Re=path;Re?(Ie=Re.dragging?Re.dragging[0]:ve,Me=Re.dragging?Re.dragging[1]:_e):(Ie=ve,Me=_e);var Oe=n=snapToAngle(Ie,Me,w,k);w=Oe.x,k=Oe.y}ne&&"none"!==ne.getAttribute("display")&&(S*=d,$*=d,assignAttributes(ne,{x:Math.min(be*d,S),y:Math.min(ye*d,$),width:Math.abs(S-be*d),height:Math.abs($-ye*d)},100)),x.mouseMove(w,k);break;case"textedit":w*=d,k*=d,Ge.mouseMove(b,y);break;case"rotate":a=(g=getBBox(v)).x+g.width/2,s=g.y+g.height/2;var Be=getMatrix(v),Ve=transformPoint(a,s,Be);a=Ve.x,s=Ve.y,p=(Math.atan2(s-k,a-w)*(180/Math.PI)-90)%360,r.gridSnapping&&(p=snapToGrid(p)),e.shiftKey&&(p=45*Math.round(p/45)),i.setRotationAngle(p<-180?360+p:p,!0),G("transition",f)}ie("mouseMove",{event:e,mouse_x:b,mouse_y:y,selected:v})}}).click(function(e){return e.preventDefault(),!1}).dblclick(function(e){var t=e.target.parentNode;if(t!==h){var n=R(e),r=n.tagName;if("text"===r&&"textedit"!==Z){var a=transformPoint(e.pageX,e.pageY,pe);Ge.select(n,a.x,a.y)}"g"!==r&&"a"!==r||!getRotationAngle(n)||(qe(n),n=f[0],L(!0)),h&&leaveContext(),"g"!==t.tagName&&"a"!==t.tagName||t===u().getCurrentLayer()||n===N.selectorParentGroup||setContext(n)}}).mouseup(function(e){if(2!==e.button){var t=te;if(te=null,Q){var n,a,s=transformPoint(e.pageX,e.pageY,pe),o=s.x*d,l=s.y*d,c=o/d,h=l/d,p=getElem(P()),m=!1,_=c,b=h;switch(Q=!1,Z){case"resize":case"multiselect":isNullish(ne)||(ne.setAttribute("display","none"),re=[]),Z="select";case"select":if(!isNullish(f[0])){if(isNullish(f[1])){var y=f[0];switch(y.tagName){case"g":case"use":case"image":case"foreignObject":break;default:ee.fill=y.getAttribute("fill"),ee.fill_opacity=y.getAttribute("fill-opacity"),ee.stroke=y.getAttribute("stroke"),ee.stroke_opacity=y.getAttribute("stroke-opacity"),ee.stroke_width=y.getAttribute("stroke-width"),ee.stroke_dasharray=y.getAttribute("stroke-dasharray"),ee.stroke_linejoin=y.getAttribute("stroke-linejoin"),ee.stroke_linecap=y.getAttribute("stroke-linecap")}"text"===y.tagName&&(q.font_size=y.getAttribute("font-size"),q.font_family=y.getAttribute("font-family")),N.requestSelector(y).showGrips(!0)}if(de(),_!==be||b!==ye)for(var C=f.length,S=0;S<C&&!isNullish(f[S]);++S)f[S].firstChild||N.requestSelector(f[S]).resize();else a=e.target,"path"===f[0].nodeName&&isNullish(f[1])?x.select(f[0]):e.shiftKey&&t!==a&&i.removeFromSelection([a]);if(supportsNonScalingStroke()){var w=f[0];w&&(w.removeAttribute("style"),walkTree(w,function(e){e.removeAttribute("style")}))}}return;case"zoom":isNullish(ne)||ne.setAttribute("display","none");var $=e.shiftKey?.5:2;return void G("zoomed",{x:Math.min(be,_),y:Math.min(ye,b),width:Math.abs(_-be),height:Math.abs(b-ye),factor:$});case"fhpath":Ce=0,Se={x:0,y:0},we={x:0,y:0},$e={x:0,y:0},ke={x:0,y:0};var A=p.getAttribute("points"),E=A.indexOf(",");(m=E>=0?A.indexOf(",",E+1)>=0:A.indexOf(" ",A.indexOf(" ")+1)>=0)&&(p=x.smoothPolylineIntoPath(p));break;case"line":n=$$9(p).attr(["x1","x2","y1","y2"]),m=n.x1!==n.x2||n.y1!==n.y2;break;case"foreignObject":case"square":case"rect":case"image":n=$$9(p).attr(["width","height"]),m=n.width||n.height||"image"===Z;break;case"circle":m="0"!==p.getAttribute("r");break;case"ellipse":n=$$9(p).attr(["rx","ry"]),m=n.rx||n.ry;break;case"fhellipse":me.maxx-me.minx>0&&me.maxy-me.miny>0&&(p=v({element:"ellipse",curStyles:!0,attr:{cx:(me.minx+me.maxx)/2,cy:(me.miny+me.maxy)/2,rx:(me.maxx-me.minx)/2,ry:(me.maxy-me.miny)/2,id:P()}}),G("changed",[p]),m=!0);break;case"fhrect":me.maxx-me.minx>0&&me.maxy-me.miny>0&&(p=v({element:"rect",curStyles:!0,attr:{x:me.minx,y:me.miny,width:me.maxx-me.minx,height:me.maxy-me.miny,id:P()}}),G("changed",[p]),m=!0);break;case"text":m=!0,ge([p]),Ge.start(p);break;case"path":p=null,Q=!0;var T=x.mouseUp(e,p,o,l);p=T.element,m=T.keep;break;case"pathedit":m=!0,p=null,x.mouseUp(e);break;case"textedit":m=!1,p=null,Ge.mouseUp(e,o,l);break;case"rotate":m=!0,p=null,Z="select";var L=i.undoMgr.finishUndoableChange();L.isEmpty()||k(L),de(),G("changed",f)}var I=ie("mouseUp",{event:e,mouse_x:o,mouse_y:l},!0);if($$9.each(I,function(e,t){t&&(m=t.keep||m,p=t.element,Q=t.started||Q)}),m||isNullish(p)){if(!isNullish(p)){i.addedNew=!0;var M,R=.2;if(F.beginElement&&parseFloat(p.getAttribute("opacity"))!==g.opacity){M=$$9(F).clone().attr({to:g.opacity,dur:R}).appendTo(p);try{M[0].beginElement()}catch(e){}}else R=0;setTimeout(function(){M&&M.remove(),p.setAttribute("opacity",g.opacity),p.setAttribute("style","pointer-events:inherit"),cleanupElement(p),"path"===Z?x.toEditMode(p):r.selectNew&&ge([p],!0),k(new InsertElementCommand$1(p)),G("changed",[p])},1e3*R)}}else{for(u().releaseId(P()),p.remove(),p=null,a=e.target;a&&a.parentNode&&a.parentNode.parentNode&&"g"===a.parentNode.parentNode.tagName;)a=a.parentNode;"path"===Z&&Te||!a||!a.parentNode||"selectorParentGroup"===a.parentNode.id||"svgcanvas"===a.id||"svgroot"===a.id||(i.setMode("select"),ge([a],!0))}K=null}}}),$$9(t).bind("mousewheel DOMMouseScroll",function(e){if(e.shiftKey){e.preventDefault();var t=e.originalEvent;pe=$$9("#svgcontent g")[0].getScreenCTM().inverse();var n=$$9("#workarea"),a=r.showRulers?16:0,s=transformPoint(t.pageX,t.pageY,pe),o=n.width(),l=n.height(),c=o-15-a,u=l-15-a,h=c*pe.a,p=u*pe.d,g=n.offset(),f=g.left+a,m=g.top+a,v=t.wheelDelta?t.wheelDelta:t.detail?-t.detail:0;if(v){var _,b,y=Math.max(.75,Math.min(4/3,v));y>1?(_=Math.ceil(c/h*y*100)/100,b=Math.ceil(u/p*y*100)/100):(_=Math.floor(c/h*y*100)/100,b=Math.floor(u/p*y*100)/100);var x=Math.min(_,b);if((x=Math.min(10,Math.max(.01,x)))!==d){y=x/d;var C=transformPoint(f,m,pe),S={x:(s.x-(s.x-C.x)/y)*x-a+o/2,y:(s.y-(s.y-C.y)/y)*x-a+l/2};i.setZoom(x),$$9("#zoom").val((100*x).toFixed(1)),G("updateCanvas",{center:!1,newCtr:S}),G("zoomDone")}}}});var Pe,Ge=i.textActions=function(){var e,t,n,r,a,s,l,c,u,h,p=[];function g(e){var i=""===t.value;if($$9(t).focus(),!arguments.length)if(i)e=0;else{if(t.selectionEnd!==t.selectionStart)return;e=t.selectionEnd}var o=p[e];i||t.setSelectionRange(e,e),(n=getElem("text_cursor"))||(n=document.createElementNS(NS.SVG,"line"),assignAttributes(n,{id:"text_cursor",stroke:"#333","stroke-width":1}),n=getElem("selectorParentGroup").appendChild(n)),a||(a=setInterval(function(){var e="none"===n.getAttribute("display");n.setAttribute("display",e?"inline":"none")},600));var l=x(o.x,s.y),c=x(o.x,s.y+s.height);assignAttributes(n,{x1:l.x,y1:l.y,x2:c.x,y2:c.y,visibility:"visible",display:"inline"}),r&&r.setAttribute("d","")}function m(e,a,i){if(e!==a){i||t.setSelectionRange(e,a),(r=getElem("text_selectblock"))||(r=document.createElementNS(NS.SVG,"path"),assignAttributes(r,{id:"text_selectblock",fill:"green",opacity:.5,style:"pointer-events:none"}),getElem("selectorParentGroup").append(r));var o=p[e],l=p[a];n.setAttribute("visibility","hidden");var c=x(o.x,s.y),u=x(o.x+(l.x-o.x),s.y),d=x(o.x,s.y+s.height),h=x(o.x+(l.x-o.x),s.y+s.height),f="M"+c.x+","+c.y+" L"+u.x+","+u.y+" "+h.x+","+h.y+" "+d.x+","+d.y+"z";assignAttributes(r,{d:f,display:"inline"})}else g(a)}function v(t,n){var r=o.createSVGPoint();if(r.x=t,r.y=n,1===p.length)return 0;var a=e.getCharNumAtPosition(r);a<0?(a=p.length-2,t<=p[0].x&&(a=0)):a>=p.length-2&&(a=p.length-2);var i=p[a];return t>i.x+i.width/2&&a++,a}function _(e,t){g(v(e,t))}function b(e,n,r){var a=t.selectionStart,i=v(e,n);m(Math.min(a,i),Math.max(a,i),!r)}function y(e,t){var n={x:e,y:t};if(n.x/=d,n.y/=d,l){var r=transformPoint(n.x,n.y,l.inverse());n.x=r.x,n.y=r.y}return n}function x(e,t){var n={x:e,y:t};if(l){var r=transformPoint(n.x,n.y,l);n.x=r.x,n.y=r.y}return n.x*=d,n.y*=d,n}function C(t){m(0,e.textContent.length),$$9(this).unbind(t)}function S(t){if(h&&e){var n=transformPoint(t.pageX,t.pageY,pe),r=y(n.x*d,n.y*d),a=v(r.x,r.y),i=e.textContent,s=i.substr(0,a).replace(/[a-z0-9]+$/i,"").length,o=i.substr(a).match(/^[a-z0-9]+/i);m(s,(o?o[0].length:0)+a),$$9(t.target).click(C),setTimeout(function(){$$9(t.target).unbind("click",C)},300)}}return{select:function(t,n,r){e=t,Ge.toEditMode(n,r)},start:function(t){e=t,Ge.toEditMode()},mouseDown:function(e,n,r,a){var i=y(r,a);t.focus(),_(i.x,i.y),c=r,u=a},mouseMove:function(e,t){var n=y(e,t);b(n.x,n.y)},mouseUp:function(t,n,r){var a=y(n,r);b(a.x,a.y,!0),t.target!==e&&n<c+2&&n>c-2&&r<u+2&&r>u-2&&Ge.toSelectMode(!0)},setCursor:g,toEditMode:function(t,n){if(h=!1,Z="textedit",N.requestSelector(e).showGrips(!1),N.requestSelector(e),Ge.init(),$$9(e).css("cursor","text"),arguments.length){var r=y(t,n);_(r.x,r.y)}else g();setTimeout(function(){h=!0},300)},toSelectMode:function(s){Z="select",clearInterval(a),a=null,r&&$$9(r).attr("display","none"),n&&$$9(n).attr("visibility","hidden"),$$9(e).css("cursor","move"),s&&(L(),$$9(e).css("cursor","move"),G("selected",[e]),I([e],!0)),e&&!e.textContent.length&&i.deleteSelectedElements(),$$9(t).blur(),e=!1},setInputElem:function(e){t=e},clear:function(){"textedit"===Z&&Ge.toSelectMode()},init:function(n){if(e){var r,a;e.parentNode||(e=f[0],N.requestSelector(e).showGrips(!1));var o=e.textContent.length,c=e.getAttribute("transform");for(s=getBBox(e),l=c?getMatrix(e):null,(p=[]).length=o,t.focus(),$$9(e).unbind("dblclick",S).dblclick(S),o||(a={x:s.x+s.width/2,width:0}),r=0;r<o;r++){var u=e.getStartPositionOfChar(r);if(a=e.getEndPositionOfChar(r),!supportsGoodTextCharPos()){var h=i.contentW*d;u.x-=h,a.x-=h,u.x/=d,a.x/=d}p[r]={x:u.x,y:s.y,width:a.x-u.x,height:s.height}}p.push({x:a.x,width:0}),m(t.selectionStart,t.selectionEnd,!0)}}}}(),Le=this.removeUnusedDefElems=function(){var e=l.getElementsByTagNameNS(NS.SVG,"defs");if(!e||!e.length)return 0;var t,n,r=[],a=0,i=["fill","stroke","filter","marker-start","marker-mid","marker-end"],s=i.length,o=l.getElementsByTagNameNS(NS.SVG,"*"),c=o.length;for(t=0;t<c;t++){var u=o[t];for(n=0;n<s;n++){var d=getUrlFromAttr(u.getAttribute(i[n]));d&&r.push(d.substr(1))}var h=getHref(u);h&&h.startsWith("#")&&r.push(h.substr(1))}var p=$$9(e).find("linearGradient, radialGradient, filter, marker, svg, symbol");for(t=p.length;t--;){var g=p[t],f=g.id;r.includes(f)||(Y[f]=g,g.remove(),a++)}return a};function Ie(){L();var e=[],t=[],n={feGaussianBlur:O.exportNoBlur,foreignObject:O.exportNoforeignObject,"[stroke-dasharray]":O.exportNoDashArray},r=$$9(l);return"font"in $$9("<canvas>")[0].getContext("2d")||(n.text=O.exportNoText),$$9.each(n,function(n,a){r.find(n).length&&(t.push(n),e.push(a))}),{issues:e,issueCodes:t}}this.svgCanvasToString=function(){for(;Le()>0;);x.clear(!0),$$9.each(l.childNodes,function(e,t){e&&8===t.nodeType&&t.data.includes("Created with")&&l.firstChild.before(t)}),h&&(leaveContext(),ge([h]));var e=[];$$9(l).find("g:data(gsvg)").each(function(){for(var t=this.attributes,n=t.length,r=0;r<n;r++)"id"!==t[r].nodeName&&"style"!==t[r].nodeName||n--;if(n<=0){var a=this.firstChild;e.push(a),$$9(this).replaceWith(a)}});var t=this.svgToString(l,0);return e.length&&$$9(e).each(function(){le(this)}),t},this.svgToString=function(e,t){var n=[],a=r.baseUnit,i=new RegExp("^-?[\\d\\.]+"+a+"$");if(e){cleanupElement(e);var s=Array.from(e.attributes),o=e.childNodes;s.sort(function(e,t){return e.name>t.name?-1:1});for(var l=0;l<t;l++)n.push(" ");if(n.push("<"),n.push(e.nodeName),"svgcontent"===e.id){var c=je();"px"!==a&&(c.w=convertUnit(c.w,a)+a,c.h=convertUnit(c.h,a)+a),n.push(' width="'+c.w+'" height="'+c.h+'" xmlns="'+NS.SVG+'"');var u={};$$9(e).find("*").andSelf().each(function(){var e=this.namespaceURI;e&&!u[e]&&w[e]&&"xmlns"!==w[e]&&"xml"!==w[e]&&(u[e]=!0,n.push(" xmlns:"+w[e]+'="'+e+'"')),$$9.each(this.attributes,function(e,t){var r=t.namespaceURI;r&&!u[r]&&"xmlns"!==w[r]&&"xml"!==w[r]&&(u[r]=!0,n.push(" xmlns:"+w[r]+'="'+r+'"'))})});for(var d=s.length,h=["width","height","xmlns","x","y","viewBox","id","overflow"];d--;){var p=s[d],g=toXml(p.value);p.nodeName.startsWith("xmlns:")||(""===g||h.includes(p.localName)||p.namespaceURI&&!w[p.namespaceURI]||(n.push(" "),n.push(p.nodeName),n.push('="'),n.push(g),n.push('"')))}}else{if("defs"===e.nodeName&&!e.firstChild)return"";for(var f=["-moz-math-font-style","_moz-math-font-style"],m=s.length-1;m>=0;m--){var v=s[m],_=toXml(v.value);if(!f.includes(v.localName)&&""!==_){if(_.startsWith("pointer-events"))continue;if("class"===v.localName&&_.startsWith("se_"))continue;if(n.push(" "),"d"===v.localName&&(_=x.convertPath(e,!0)),isNaN(_)?i.test(_)&&(_=shortFloat(_)+a):_=shortFloat(_),H.apply&&"image"===e.nodeName&&"href"===v.localName&&H.images&&"embed"===H.images){var b=U[_];b&&(_=b)}v.namespaceURI&&v.namespaceURI!==NS.SVG&&!w[v.namespaceURI]||(n.push(v.nodeName),n.push('="'),n.push(_),n.push('"'))}}}if(e.hasChildNodes()){n.push(">"),t++;for(var y=!1,C=0;C<o.length;C++){var S=o.item(C);switch(S.nodeType){case 1:n.push("\n"),n.push(this.svgToString(o.item(C),t));break;case 3:var $=S.nodeValue.replace(/^\s+|\s+$/g,"");""!==$&&(y=!0,n.push(String(toXml($))));break;case 4:n.push("\n"),n.push(new Array(t+1).join(" ")),n.push("<![CDATA["),n.push(S.nodeValue),n.push("]]>");break;case 8:n.push("\n"),n.push(new Array(t+1).join(" ")),n.push("\x3c!--"),n.push(S.data),n.push("--\x3e")}}if(t--,!y){n.push("\n");for(var k=0;k<t;k++)n.push(" ")}n.push("</"),n.push(e.nodeName),n.push(">")}else n.push("/>")}return n.join("")},this.embedImage=function(e){return new Promise(function(t,n){$$9(new Image).load(function(r,a,i){if("error"!==a){var s=document.createElement("canvas");s.width=this.width,s.height=this.height,s.getContext("2d").drawImage(this,0,0);try{var o=";svgedit_url="+encodeURIComponent(e);o=s.toDataURL().replace(";base64",o+";base64"),U[e]=o}catch(t){U[e]=!1}X=e,t(U[e])}else n(new Error("Error loading image: "+i.status+" "+i.statusText))}).attr("src",e)})},this.setGoodImage=function(e){X=e},this.open=function(){},this.save=function(e){L(),e&&$$9.extend(H,e),H.apply=!0;var t=this.svgCanvasToString();G("saved",t)},this.rasterExport=function(){var e=_asyncToGenerator(regeneratorRuntime.mark(function e(t,n,a){var s,o,l,c,u,d,h,p,g,f=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(s=f.length>3&&void 0!==f[3]?f[3]:{},l="image/"+(o="ICO"===t?"BMP":t||"PNG").toLowerCase(),c=Ie(),u=c.issues,d=c.issueCodes,h=this.svgCanvasToString(),Pe){e.next=10;break}return e.next=8,importSetGlobal(r.canvgPath+"canvg.js",{global:"canvg"});case 8:p=e.sent,Pe=p.canvg;case 10:return $$9("#export_canvas").length||$$9("<canvas>",{id:"export_canvas"}).hide().appendTo("body"),(g=$$9("#export_canvas")[0]).width=i.contentW,g.height=i.contentH,e.next=16,Pe(g,h);case 16:return e.abrupt("return",new Promise(function(e,r){var i,c=o.toLowerCase(),p=n?g.toDataURL("image/"+c,n):g.toDataURL("image/"+c);function f(){var r={datauri:p,bloburl:i,svg:h,issues:u,issueCodes:d,type:t,mimeType:l,quality:n,exportWindowName:a};s.avoidEvent||G("exported",r),e(r)}g.toBlob?g.toBlob(function(e){i=createObjectURL(e),f()},l,n):(i=dataURLToObjectURL(p),f())}));case 17:case"end":return e.stop()}},e,this)}));return function(t,n,r){return e.apply(this,arguments)}}(),this.exportPDF=function(){var e=_asyncToGenerator(regeneratorRuntime.mark(function e(t){var n,a,i,s,o,l,c,u,d,h,p,g=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=g.length>1&&void 0!==g[1]?g[1]:isChrome()?"save":void 0,window.jsPDF){e.next=7;break}return e.next=4,importScript(["jspdf/underscore-min.js","jspdf/jspdf.min.js"]);case 4:return a=!("svgEditor"in window&&window.svgEditor&&!1===window.svgEditor.modules),e.next=7,importScript(r.jspdfPath+"jspdf.plugin.svgToPdf.js",{type:a?"module":"text/javascript"});case 7:return i=je(),s=i.w>i.h?"landscape":"portrait","pt",o=jsPDF({orientation:s,unit:"pt",format:[i.w,i.h]}),l=Fe(),o.setProperties({title:l}),c=Ie(),u=c.issues,d=c.issueCodes,h=this.svgCanvasToString(),o.addSVG(h,0,0),(p={svg:h,issues:u,issueCodes:d,exportWindowName:t,outputType:n=n||"dataurlstring"}).output=o.output(n,"save"===n?t||"svg.pdf":void 0),G("exportedPDF",p),e.abrupt("return",p);case 21:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}(),this.getSvgString=function(){return H.apply=!1,this.svgCanvasToString()},this.randomizeIds=function(e){arguments.length>0&&!1===e?randomizeIds(!1,u()):randomizeIds(!0,u())};var Me=this.uniquifyElems=function(e){var t={},n=["filter","linearGradient","pattern","radialGradient","symbol","textPath","use"];for(var r in walkTree(e,function(e){if(1===e.nodeType){e.id&&(e.id in t||(t[e.id]={elem:null,attrs:[],hrefs:[]}),t[e.id].elem=e),$$9.each(V,function(n,r){var a=e.getAttributeNode(r);if(a){var i=getUrlFromAttr(a.value),s=i?i.substr(1):null;s&&(s in t||(t[s]={elem:null,attrs:[],hrefs:[]}),t[s].attrs.push(a))}});var r=getHref(e);if(r&&n.includes(e.nodeName)){var a=r.substr(1);a&&(a in t||(t[a]={elem:null,attrs:[],hrefs:[]}),t[a].hrefs.push(e))}}}),t)if(r){var a=t[r].elem;if(a){var i=T();a.id=i;for(var s=t[r].attrs,o=s.length;o--;){var l=s[o];l.ownerElement.setAttribute(l.name,"url(#"+i+")")}for(var c=t[r].hrefs,u=c.length;u--;){var d=c[u];setHref(d,"#"+i)}}}},Re=this.setUseData=function(e){var t=$$9(e);"use"!==e.tagName&&(t=t.find("use")),t.each(function(){var e=getHref(this).substr(1),t=getElem(e);t&&($$9(this).data("ref",t),"symbol"!==t.tagName&&"svg"!==t.tagName||$$9(this).data("symbol",t).data("ref",t))})},Oe=this.convertGradients=function(e){var t=$$9(e).find("linearGradient, radialGradient");!t.length&&isWebkit()&&(t=$$9(e).find("*").filter(function(){return this.tagName.includes("Gradient")})),t.each(function(){if("userSpaceOnUse"===$$9(this).attr("gradientUnits")){var e=$$9(l).find('[fill="url(#'+this.id+')"],[stroke="url(#'+this.id+')"]');if(!e.length)return;var t=getBBox(e[0]);if(!t)return;if("linearGradient"===this.tagName){var n=$$9(this).attr(["x1","y1","x2","y2"]),r=this.gradientTransform.baseVal;if(r&&r.numberOfItems>0){var a=transformListToTransform(r).matrix,i=transformPoint(n.x1,n.y1,a),s=transformPoint(n.x2,n.y2,a);n.x1=i.x,n.y1=i.y,n.x2=s.x,n.y2=s.y,this.removeAttribute("gradientTransform")}$$9(this).attr({x1:(n.x1-t.x)/t.width,y1:(n.y1-t.y)/t.height,x2:(n.x2-t.x)/t.width,y2:(n.y2-t.y)/t.height}),this.removeAttribute("gradientUnits")}}})},Be=this.convertToGroup=function(e){e||(e=f[0]);var t,n=$$9(e),r=new BatchCommand$1;if(n.data("gsvg")){var a=e.firstChild,i=$$9(a).attr(["x","y"]);$$9(e.firstChild.firstChild).unwrap(),$$9(e).removeData("gsvg");var c=getTransformList(e),u=o.createSVGTransform();u.setTranslate(i.x,i.y),c.appendItem(u),recalculateDimensions(e),G("selected",[e])}else if(n.data("symbol")){e=n.data("symbol"),t=n.attr("transform");var d=n.attr(["x","y"]),h=e.getAttribute("viewBox");if(h){var p=h.split(" ");d.x-=Number(p[0]),d.y-=Number(p[1])}t+=" translate("+(d.x||0)+","+(d.y||0)+")";var g=n.prev();r.addSubCommand(new RemoveElementCommand$1(n[0],n[0].nextSibling,n[0].parentNode)),n.remove();var m,v=$$9(l).find("use:data(symbol)").length,_=s.createElementNS(NS.SVG,"g"),b=e.childNodes;for(m=0;m<b.length;m++)_.append(b[m].cloneNode(!0));if(isGecko()){var y=$$9(findDefs()).children("linearGradient,radialGradient,pattern").clone();$$9(_).append(y)}t&&_.setAttribute("transform",t);var x=e.parentNode;if(Me(_),isGecko()&&$$9(findDefs()).append($$9(_).find("linearGradient,radialGradient,pattern")),_.id=T(),g.after(_),x){if(!v){var C=e.nextSibling;e.remove(),r.addSubCommand(new RemoveElementCommand$1(e,C,x))}r.addSubCommand(new InsertElementCommand$1(_))}Re(_),isGecko()?Oe(findDefs()):Oe(_),walkTreePost(_,function(e){try{recalculateDimensions(e)}catch(e){console.log(e)}}),$$9(_).find(B).each(function(){this.id||(this.id=T())}),ge([_]);var S=qe(_,!0);S&&r.addSubCommand(S),k(r)}else console.log("Unexpected element to ungroup:",e)};this.setSvgString=function(e,t){try{var n=text2xml(e);if(n.firstElementChild&&n.firstElementChild.namespaceURI!==NS.SVG)return!1;this.prepareSvg(n);var a=new BatchCommand$1("Change Source"),h=l.nextSibling,p=o.removeChild(l);a.addSubCommand(new RemoveElementCommand$1(p,h,o)),l=s.adoptNode?s.adoptNode(n.documentElement):s.importNode(n.documentElement,!0),o.append(l);var g=$$9(l);i.current_drawing_=new Drawing(l,c);var f=u().getNonce();f?G("setnonce",f):G("unsetnonce"),g.find("image").each(function(){var e=this;preventClickDefault(e);var t=getHref(this);if(t){if(t.startsWith("data:")){var n=t.match(/svgedit_url=(.*?);/);if(n){var r=decodeURIComponent(n[1]);$$9(new Image).load(function(){e.setAttributeNS(NS.XLINK,"xlink:href",r)}).attr("src",r)}}i.embedImage(t)}}),g.find("svg").each(function(){if(!$$9(this).closest("defs").length){Me(this);var e=this.parentNode;1===e.childNodes.length&&"g"===e.nodeName?($$9(e).data("gsvg",this),e.id=e.id||T()):le(this)}}),isGecko()&&g.find("linearGradient, radialGradient, pattern").appendTo(findDefs()),Re(g),Oe(g[0]);var m={id:"svgcontent",overflow:r.show_outside_canvas?"visible":"hidden"},v=!1;if(g.attr("viewBox")){var _=g.attr("viewBox").split(" ");m.width=_[2],m.height=_[3]}else $$9.each(["width","height"],function(e,t){var n=g.attr(t)||"100%";"%"===String(n).substr(-1)?v=!0:m[t]=convertToNum(t,n)});if(identifyLayers(),g.children().find(B).each(function(){this.id||(this.id=T())}),v){var b=getStrokedBBoxDefaultVisible();m.width=b.width+b.x,m.height=b.height+b.y}m.width<=0&&(m.width=100),m.height<=0&&(m.height=100),g.attr(m),this.contentW=m.width,this.contentH=m.height,a.addSubCommand(new InsertElementCommand$1(l));var y=g.attr(["width","height"]);a.addSubCommand(new ChangeElementCommand$1(o,y)),d=1,resetListMap(),L(),clearData(),o.append(N.selectorParentGroup),t||k(a),G("changed",[l])}catch(e){return console.log(e),!1}return!0},this.importSvgString=function(e){var t,n,r;try{var a=encode64(e.length+e).substr(0,32),i=!1;z[a]&&$$9(z[a].symbol).parents("#svgroot").length&&(i=!0);var o,c=new BatchCommand$1("Import Image");if(i)o=z[a].symbol,n=z[a].xform;else{var d,p=text2xml(e);this.prepareSvg(p),d=s.adoptNode?s.adoptNode(p.documentElement):s.importNode(p.documentElement,!0),Me(d);var g=convertToNum("width",d.getAttribute("width")),f=convertToNum("height",d.getAttribute("height")),m=d.getAttribute("viewBox"),v=m?m.split(" "):[0,0,g,f];for(t=0;t<4;++t)v[t]=Number(v[t]);var _=Number(l.getAttribute("height"));n="translate(0) "+(n=f>g?"scale("+_/3/v[3]+")":"scale("+_/3/v[2]+")")+" translate(0)",o=s.createElementNS(NS.SVG,"symbol");var b=findDefs();for(isGecko()&&$$9(d).find("linearGradient, radialGradient, pattern").appendTo(b);d.firstChild;){var y=d.firstChild;o.append(y)}for(var x=d.attributes,C=0;C<x.length;C++){var S=x[C];o.setAttribute(S.nodeName,S.value)}o.id=T(),z[a]={symbol:o,xform:n},findDefs().append(o),c.addSubCommand(new InsertElementCommand$1(o))}(r=s.createElementNS(NS.SVG,"use")).id=T(),setHref(r,"#"+o.id),(h||u().getCurrentLayer()).append(r),c.addSubCommand(new InsertElementCommand$1(r)),L(),r.setAttribute("transform",n),recalculateDimensions(r),$$9(r).data("symbol",o).data("ref",o),I([r]),k(c),G("changed",[l])}catch(e){return console.log(e),null}return r};var Ve={identifyLayers:identifyLayers,createLayer:createLayer,cloneLayer:cloneLayer,deleteCurrentLayer:deleteCurrentLayer,setCurrentLayer:setCurrentLayer,renameCurrentLayer:renameCurrentLayer,setCurrentLayerPosition:setCurrentLayerPosition,setLayerVisibility:setLayerVisibility,moveSelectedToLayer:moveSelectedToLayer,mergeLayer:mergeLayer,mergeAllLayers:mergeAllLayers,leaveContext:leaveContext,setContext:setContext};Object.entries(Ve).forEach(function(e){var t=_slicedToArray(e,2),n=t[0],r=t[1];i[n]=r}),init$3({pathActions:x,getCurrentGroup:function(){return h},setCurrentGroup:function(e){h=e},getSelectedElements:y,getSVGContent:b,undoMgr:$,elData:j,getCurrentDrawing:u,clearSelection:L,call:G,addCommandToHistory:k,changeSVGContent:function(){G("changed",[l])}}),this.clear=function(){x.clear(),L(),i.clearSvgContentElement(),i.current_drawing_=new Drawing(l),i.createLayer("Layer 1"),i.undoMgr.resetUndoStack(),N.initGroup(),ne=N.getRubberBandBox(),G("cleared")},this.linkControlPoints=x.linkControlPoints,this.getContentElem=function(){return l},this.getRootElem=function(){return o};var je=this.getResolution=function(){return{w:l.getAttribute("width")/d,h:l.getAttribute("height")/d,zoom:d}};this.getSnapToGrid=function(){return r.gridSnapping},this.getVersion=function(){return"svgcanvas.js ($Rev$)"},this.setUiStrings=function(e){Object.assign(O,e.notification),$$9=jQueryPluginDBox($$9,e.common),setUiStrings(e)},this.setConfig=function(e){Object.assign(r,e)},this.getTitle=function(e){if(e=e||f[0]){for(var t=(e=$$9(e).data("gsvg")||$$9(e).data("symbol")||e).childNodes,n=0;n<t.length;n++)if("title"===t[n].nodeName)return t[n].textContent;return""}},this.setGroupTitle=function(e){var t=f[0];t=$$9(t).data("gsvg")||t;var n,r=$$9(t).children("title"),a=new BatchCommand$1("Set Label");if(e.length)r.length?(n=r[0],a.addSubCommand(new ChangeElementCommand$1(n,{"#text":n.textContent})),n.textContent=e):((n=s.createElementNS(NS.SVG,"title")).textContent=e,$$9(t).prepend(n),a.addSubCommand(new InsertElementCommand$1(n)));else{var i=r.nextSibling;a.addSubCommand(new RemoveElementCommand$1(r[0],i,t)),r.remove()}k(a)};var Fe=this.getDocumentTitle=function(){return i.getTitle(l)};this.setDocumentTitle=function(e){for(var t=l.childNodes,n=!1,r="",a=new BatchCommand$1("Change Image Title"),i=0;i<t.length;i++)if("title"===t[i].nodeName){r=(n=t[i]).textContent;break}n||(n=s.createElementNS(NS.SVG,"title"),l.insertBefore(n,l.firstChild)),e.length?n.textContent=e:n.remove(),a.addSubCommand(new ChangeElementCommand$1(n,{"#text":r})),k(a)},this.getEditorNS=function(e){return e&&l.setAttribute("xmlns:se",NS.SE),NS.SE},this.setResolution=function(e,t){var n,r=je(),a=r.w,s=r.h;if("fit"===e){var o=getStrokedBBoxDefaultVisible();if(!o)return!1;n=new BatchCommand$1("Fit Canvas to Content");var c=getVisibleElements();I(c);var u=[],h=[];$$9.each(c,function(e,t){u.push(-1*o.x),h.push(-1*o.y)});var p=i.moveSelectedElements(u,h,!0);n.addSubCommand(p),L(),e=Math.round(o.width),t=Math.round(o.height)}return e===a&&t===s||(n||(n=new BatchCommand$1("Change Image Dimensions")),e=convertToNum("width",e),t=convertToNum("height",t),l.setAttribute("width",e),l.setAttribute("height",t),this.contentW=e,this.contentH=t,n.addSubCommand(new ChangeElementCommand$1(l,{width:a,height:s})),l.setAttribute("viewBox",[0,0,e/d,t/d].join(" ")),n.addSubCommand(new ChangeElementCommand$1(l,{viewBox:["0 0",a,s].join(" ")})),k(n),G("changed",[l])),!0},this.getOffset=function(){return $$9(l).attr(["x","y"])},this.setBBoxZoom=function(e,t,n){var r,a=.85,s=function(e){if(!e)return!1;var r=Math.round(t/e.width*100*a)/100,s=Math.round(n/e.height*100*a)/100,o=Math.min(r,s);return i.setZoom(o),{zoom:o,bbox:e}};if("object"===_typeof(e)){if(0===(r=e).width||0===r.height){var o=r.zoom?r.zoom:d*r.factor;return i.setZoom(o),{zoom:d,bbox:r}}return s(r)}switch(e){case"selection":if(!f[0])return;var l=$$9.map(f,function(e){if(e)return e});r=getStrokedBBoxDefaultVisible(l);break;case"canvas":var c=je();a=.95,r={width:c.w,height:c.h,x:0,y:0};break;case"content":r=getStrokedBBoxDefaultVisible();break;case"layer":r=getStrokedBBoxDefaultVisible(getVisibleElements(u().getCurrentLayer()));break;default:return}return s(r)},this.setZoom=function(e){var t=je();l.setAttribute("viewBox","0 0 "+t.w/e+" "+t.h/e),d=e,$$9.each(f,function(e,t){t&&N.requestSelector(t).resize()}),x.zoomChange(),ie("zoomChanged",e)},this.getMode=function(){return Z},this.setMode=function(e){x.clear(!0),Ge.clear(),ee=f[0]&&"text"===f[0].nodeName?q:g,Z=e},this.getColor=function(e){return ee[e]},this.setColor=function(e,t,n){g[e]=t,ee[e+"_paint"]={type:"solidColor"};var r=[];function a(e){"g"!==e.nodeName&&r.push(e)}for(var i=f.length;i--;){var s=f[i];s&&("g"===s.tagName?walkTree(s,a):"fill"===e?"polyline"!==s.tagName&&"line"!==s.tagName&&r.push(s):r.push(s))}r.length>0&&(n?He(e,t,r):(ze(e,t,r),G("changed",r)))};var De=this.setGradient=function(e){if(ee[e+"_paint"]&&"solidColor"!==ee[e+"_paint"].type){var t=i[e+"Grad"],n=Ue(t),r=findDefs();n?t=n:(t=r.appendChild(s.importNode(t,!0))).id=T(),i.setColor(e,"url(#"+t.id+")")}},Ue=function(e){for(var t=findDefs(),n=$$9(t).find("linearGradient, radialGradient"),r=n.length,a=["r","cx","cy","fx","fy"];r--;){var i=n[r];if("linearGradient"===e.tagName){if(e.getAttribute("x1")!==i.getAttribute("x1")||e.getAttribute("y1")!==i.getAttribute("y1")||e.getAttribute("x2")!==i.getAttribute("x2")||e.getAttribute("y2")!==i.getAttribute("y2"))continue}else if("continue"===function(){var t=$$9(e).attr(a),n=$$9(i).attr(a),r=!1;if($$9.each(a,function(e,a){t[a]!==n[a]&&(r=!0)}),r)return"continue"}())continue;var s=e.getElementsByTagNameNS(NS.SVG,"stop"),o=i.getElementsByTagNameNS(NS.SVG,"stop");if(s.length===o.length){for(var l=s.length;l--;){var c=s[l],u=o[l];if(c.getAttribute("offset")!==u.getAttribute("offset")||c.getAttribute("stop-opacity")!==u.getAttribute("stop-opacity")||c.getAttribute("stop-color")!==u.getAttribute("stop-color"))break}if(-1===l)return i}}return null};this.setPaint=function(e,t){var n=new $$9.jGraduate.Paint(t);switch(this.setPaintOpacity(e,n.alpha/100,!0),ee[e+"_paint"]=n,n.type){case"solidColor":this.setColor(e,"none"!==n.solidColor?"#"+n.solidColor:"none");break;case"linearGradient":case"radialGradient":i[e+"Grad"]=n[n.type],De(e)}},this.setStrokePaint=function(e){this.setPaint("stroke",e)},this.setFillPaint=function(e){this.setPaint("fill",e)},this.getStrokeWidth=function(){return ee.stroke_width},this.setStrokeWidth=function(e){if(0===e&&["line","path"].includes(Z))i.setStrokeWidth(1);else{ee.stroke_width=e;for(var t=[],n=f.length;n--;){var r=f[n];r&&("g"===r.tagName?walkTree(r,a):t.push(r))}t.length>0&&(ze("stroke-width",e,t),G("changed",f))}function a(e){"g"!==e.nodeName&&t.push(e)}},this.setStrokeAttr=function(e,t){g[e.replace("-","_")]=t;for(var n=[],r=f.length;r--;){var a=f[r];a&&("g"===a.tagName?walkTree(a,function(e){"g"!==e.nodeName&&n.push(e)}):n.push(a))}n.length>0&&(ze(e,t,n),G("changed",f))},this.getStyle=function(){return g},this.getOpacity=M,this.setOpacity=function(e){g.opacity=e,ze("opacity",e)},this.getFillOpacity=function(){return g.fill_opacity},this.getStrokeOpacity=function(){return g.stroke_opacity},this.setPaintOpacity=function(e,t,n){g[e+"_opacity"]=t,n?He(e+"-opacity",t):ze(e+"-opacity",t)},this.getPaintOpacity=function(e){return"fill"===e?this.getFillOpacity():this.getStrokeOpacity()},this.getBlur=function(e){var t=0;if(e&&e.getAttribute("filter")){var n=getElem(e.id+"_blur");n&&(t=n.firstChild.getAttribute("stdDeviation"))}return t},function(){var e=null,t=null,n=!1;function r(){var n=i.undoMgr.finishUndoableChange();e.addSubCommand(n),k(e),e=null,t=null}i.setBlurNoUndo=function(e){if(t)if(0===e)He("filter",""),n=!0;else{var r=f[0];n&&He("filter","url(#"+r.id+"_blur)"),isWebkit()&&(r.removeAttribute("filter"),r.setAttribute("filter","url(#"+r.id+"_blur)")),He("stdDeviation",e,[t.firstChild]),i.setBlurOffsets(t,e)}else i.setBlur(e)},i.setBlurOffsets=function(e,t){t>3?assignAttributes(e,{x:"-50%",y:"-50%",width:"200%",height:"200%"},100):isWebkit()||(e.removeAttribute("x"),e.removeAttribute("y"),e.removeAttribute("width"),e.removeAttribute("height"))},i.setBlur=function(n,a){if(e)r();else{var s=f[0],o=s.id;t=getElem(o+"_blur"),n-=0;var l=new BatchCommand$1;if(t)0===n&&(t=null);else{var c=v({element:"feGaussianBlur",attr:{in:"SourceGraphic",stdDeviation:n}});(t=v({element:"filter",attr:{id:o+"_blur"}})).append(c),findDefs().append(t),l.addSubCommand(new InsertElementCommand$1(t))}var u={filter:s.getAttribute("filter")};if(0===n)return s.removeAttribute("filter"),void l.addSubCommand(new ChangeElementCommand$1(s,u));ze("filter","url(#"+o+"_blur)"),l.addSubCommand(new ChangeElementCommand$1(s,u)),i.setBlurOffsets(t,n),e=l,i.undoMgr.beginUndoableChange("stdDeviation",[t?t.firstChild:null]),a&&(i.setBlurNoUndo(n),r())}}}(),this.getBold=function(){var e=f[0];return!(isNullish(e)||"text"!==e.tagName||!isNullish(f[1]))&&"bold"===e.getAttribute("font-weight")},this.setBold=function(e){var t=f[0];!isNullish(t)&&"text"===t.tagName&&isNullish(f[1])&&ze("font-weight",e?"bold":"normal"),f[0].textContent||Ge.setCursor()},this.getItalic=function(){var e=f[0];return!(isNullish(e)||"text"!==e.tagName||!isNullish(f[1]))&&"italic"===e.getAttribute("font-style")},this.setItalic=function(e){var t=f[0];!isNullish(t)&&"text"===t.tagName&&isNullish(f[1])&&ze("font-style",e?"italic":"normal"),f[0].textContent||Ge.setCursor()},this.getFontFamily=function(){return q.font_family},this.setFontFamily=function(e){q.font_family=e,ze("font-family",e),f[0]&&!f[0].textContent&&Ge.setCursor()},this.setFontColor=function(e){q.fill=e,ze("fill",e)},this.getFontColor=function(){return q.fill},this.getFontSize=function(){return q.font_size},this.setFontSize=function(e){q.font_size=e,ze("font-size",e),f[0].textContent||Ge.setCursor()},this.getText=function(){var e=f[0];return isNullish(e)?"":e.textContent},this.setTextContent=function(e){ze("#text",e),Ge.init(e),Ge.setCursor()},this.setImageURL=function(e){var t=f[0];if(t){var n=$$9(t).attr(["width","height"]),r=!n.width||!n.height,a=getHref(t);if(a!==e||r){var i=new BatchCommand$1("Change Image URL");setHref(t,e),i.addSubCommand(new ChangeElementCommand$1(t,{"#href":a})),$$9(new Image).load(function(){var e=$$9(t).attr(["width","height"]);$$9(t).attr({width:this.width,height:this.height}),N.requestSelector(t).resize(),i.addSubCommand(new ChangeElementCommand$1(t,e)),k(i),G("changed",[t])}).attr("src",e)}}},this.setLinkURL=function(e){var t=f[0];if(t){if("a"!==t.tagName){var n=$$9(t).parents("a");if(!n.length)return;t=n[0]}var r=getHref(t);if(r!==e){var a=new BatchCommand$1("Change Link URL");setHref(t,e),a.addSubCommand(new ChangeElementCommand$1(t,{"#href":r})),k(a)}}},this.setRectRadius=function(e){var t=f[0];if(!isNullish(t)&&"rect"===t.tagName){var n=t.getAttribute("rx");n!==String(e)&&(t.setAttribute("rx",e),t.setAttribute("ry",e),k(new ChangeElementCommand$1(t,{rx:n,ry:n},"Radius")),G("changed",[t]))}},this.makeHyperlink=function(e){i.groupSelectedElements("a",e)},this.removeHyperlink=function(){i.ungroupSelectedElement()},this.setSegType=function(e){x.setSegType(e)},this.convertToPath=function(e,t){if(!isNullish(e)){if(t)return getBBoxOfElementAsPath(e,v,x);var n={fill:g.fill,"fill-opacity":g.fill_opacity,stroke:g.stroke,"stroke-width":g.stroke_width,"stroke-dasharray":g.stroke_dasharray,"stroke-linejoin":g.stroke_linejoin,"stroke-linecap":g.stroke_linecap,"stroke-opacity":g.stroke_opacity,opacity:g.opacity,visibility:"hidden"};return convertToPath(e,n,v,x,L,I,hstry,k)}var r=f;$$9.each(r,function(e,t){t&&i.convertToPath(t)})};var He=function(e,t,n){"pathedit"===Z&&x.moveNode(e,t);for(var r=(n=n||f).length,a=["g","polyline","path"],s=function(){var s=n[r];if(isNullish(s))return"continue";if(("x"===e||"y"===e)&&a.includes(s.tagName)){var l=getStrokedBBoxDefaultVisible([s]),c="x"===e?t-l.x:0,u="y"===e?t-l.y:0;return i.moveSelectedElements(c*d,u*d,!0),"continue"}var h="#text"===e?s.textContent:s.getAttribute(e);if(isNullish(h)&&(h=""),h!==String(t)){"#text"===e?(s.textContent=t,/rotate/.test(s.getAttribute("transform"))&&(s=ue(s))):"#href"===e?setHref(s,t):s.setAttribute(e,t),"textedit"===Z&&"#text"!==e&&s.textContent.length&&Ge.toSelectMode(s),isGecko()&&"text"===s.nodeName&&/rotate/.test(s.getAttribute("transform"))&&(String(t).startsWith("url")||["font-size","font-family","x","y"].includes(e)&&s.textContent)&&(s=ue(s)),f.includes(s)&&setTimeout(function(){s.parentNode&&N.requestSelector(s).resize()},0);var p=getRotationAngle(s);if(0!==p&&"transform"!==e)for(var g=getTransformList(s),m=g.numberOfItems;m--;){if(4===g.getItem(m).type){g.removeItem(m);var v=getBBox(s),_=transformPoint(v.x+v.width/2,v.y+v.height/2,transformListToTransform(g).matrix),b=_.x,y=_.y,x=o.createSVGTransform();x.setRotate(p,b,y),g.insertItemBefore(x,m);break}}}};r--;)s()},ze=this.changeSelectedAttribute=function(e,t,n){n=n||f,i.undoMgr.beginUndoableChange(e,n),He(e,t,n);var r=i.undoMgr.finishUndoableChange();r.isEmpty()||k(r)};this.deleteSelectedElements=function(){for(var e=new BatchCommand$1("Delete Elements"),t=f.length,n=[],r=0;r<t;++r){var a=f[r];if(isNullish(a))break;var i=a.parentNode,s=a;N.releaseSelector(s),removePath_(s.id),"a"===i.tagName&&1===i.childNodes.length&&(s=i,i=i.parentNode);var o=s.nextSibling,l=i.removeChild(s);n.push(a),e.addSubCommand(new RemoveElementCommand$1(l,o,i))}f=[],e.isEmpty()||k(e),G("changed",n),L()},this.cutSelectedElements=function(){i.copySelectedElements(),i.deleteSelectedElements()},this.copySelectedElements=function(){localStorage.setItem("svgedit_clipboard",JSON.stringify(f.map(function(e){return m(e)}))),$$9("#cmenu_canvas").enableContextMenuItems("#paste,#paste_in_place")},this.pasteElements=function(e,t,n){var r=JSON.parse(localStorage.getItem("svgedit_clipboard")),a=r.length;if(a){var s=[],o=new BatchCommand$1("Paste elements"),l={};for(r.forEach(function e(t){t.attr&&t.attr.id&&(l[t.attr.id]=T(),t.attr.id=l[t.attr.id]),t.children&&t.children.forEach(e)}),ie("IDsUpdated",{elems:r,changes:l},!0).forEach(function(e){e&&"remove"in e&&e.remove.forEach(function(e){r=r.filter(function(t){return t.attr.id!==e})})});a--;){var c=r[a];if(c){var u=v(c);s.push(u),o.addSubCommand(new InsertElementCommand$1(u)),D(u)}}if(ge(s),"in_place"!==e){var d,h;e?"point"===e&&(d=t,h=n):(d=ae.x,h=ae.y);var p=getStrokedBBoxDefaultVisible(s),g=d-(p.x+p.width/2),f=h-(p.y+p.height/2),m=[],_=[];$$9.each(s,function(e,t){m.push(g),_.push(f)});var b=i.moveSelectedElements(m,_,!1);b&&o.addSubCommand(b)}k(o),G("changed",s)}},this.groupSelectedElements=function(e,t){e||(e="g");var n,r="";switch(e){case"a":r="Make hyperlink",n=t||"";break;default:e="g",r="Group Elements"}var a=new BatchCommand$1(r),i=v({element:e,attr:{id:T()}});"a"===e&&setHref(i,n),a.addSubCommand(new InsertElementCommand$1(i));for(var s=f.length;s--;){var o=f[s];if(!isNullish(o)){"a"===o.parentNode.tagName&&1===o.parentNode.childNodes.length&&(o=o.parentNode);var l=o.nextSibling,c=o.parentNode;i.append(o),a.addSubCommand(new MoveElementCommand$1(o,l,c))}}a.isEmpty()||k(a),ge([i],!0)};var qe=this.pushGroupProperties=function(e,t){for(var n,r,a,s=e.childNodes,l=s.length,c=e.getAttribute("transform"),d=getTransformList(e),h=transformListToTransform(d).matrix,p=new BatchCommand$1("Push group properties"),g=getRotationAngle(e),f=$$9(e).attr(["filter","opacity"]),m=u(),v=0;v<l;v++){var _=s[v];if(1===_.nodeType){if(null!==f.opacity&&1!==f.opacity){var b=Math.round((_.getAttribute("opacity")||1)*f.opacity*100)/100;ze("opacity",b,[_])}if(f.filter){var y=this.getBlur(_),x=y;r||(r=this.getBlur(e)),y?y=Number(r)+Number(y):0===y&&(y=r),x?n=getRefElem(_.getAttribute("filter")):n?(n=m.copyElem(n),findDefs().append(n)):n=getRefElem(f.filter);var C="feGaussianBlur"===n.firstChild.tagName?"blur":"filter";n.id=_.id+"_"+C,ze("filter","url(#"+n.id+")",[_]),y&&(ze("stdDeviation",y,[n.firstChild]),i.setBlurOffsets(n,y))}var S=getTransformList(_);if(_.tagName.includes("Gradient")&&(S=null),S&&"defs"!==_.tagName&&d.numberOfItems){if(g&&1===d.numberOfItems){var w=d.getItem(0).matrix,$=o.createSVGMatrix(),k=getRotationAngle(_);k&&($=S.getItem(0).matrix);var A=getBBox(_),E=transformListToTransform(S).matrix,N=transformPoint(A.x+A.width/2,A.y+A.height/2,E),T=g+k,P=o.createSVGTransform();P.setRotate(T,N.x,N.y);var G=matrixMultiply(w,$,P.matrix.inverse());if(k&&S.removeItem(0),T&&(S.numberOfItems?S.insertItemBefore(P,0):S.appendItem(P)),G.e||G.f){var L=o.createSVGTransform();L.setTranslate(G.e,G.f),S.numberOfItems?S.insertItemBefore(L,0):S.appendItem(L)}}else{var I=_.getAttribute("transform");(a={}).transform=I||"";var M=o.createSVGTransform(),R=transformListToTransform(S).matrix,O=R.inverse(),B=matrixMultiply(O,h,R);M.setMatrix(B),S.appendItem(M)}var V=recalculateDimensions(_);V&&p.addSubCommand(V)}}}if(c&&((a={}).transform=c,e.setAttribute("transform",""),e.removeAttribute("transform"),p.addSubCommand(new ChangeElementCommand$1(e,a))),t&&!p.isEmpty())return p};this.ungroupSelectedElement=function(){var e=f[0];if(e)if($$9(e).data("gsvg")||$$9(e).data("symbol"))Be(e);else{if("use"===e.tagName){var t=getElem(getHref(e).substr(1));return $$9(e).data("symbol",t).data("ref",t),void Be(e)}var n=$$9(e).parents("a");if(n.length&&(e=n[0]),"g"===e.tagName||"a"===e.tagName){var r=new BatchCommand$1("Ungroup Elements"),a=qe(e,!0);a&&r.addSubCommand(a);for(var i=e.parentNode,s=e.nextSibling,o=new Array(e.childNodes.length),l=0;e.firstChild;){var c=e.firstChild,u=c.nextSibling,d=c.parentNode;if("title"!==c.tagName)o[l++]=c=i.insertBefore(c,s),r.addSubCommand(new MoveElementCommand$1(c,u,d));else{var h=c.nextSibling;r.addSubCommand(new RemoveElementCommand$1(c,h,d)),c.remove()}}L();var p=e.nextSibling;e=i.removeChild(e),r.addSubCommand(new RemoveElementCommand$1(e,p,i)),r.isEmpty()||k(r),I(o)}}},this.moveToTopSelectedElement=function(){var e=_slicedToArray(f,1)[0];if(!isNullish(e)){var t=e,n=t.parentNode,r=t.nextSibling;r!==(t=t.parentNode.appendChild(t)).nextSibling&&(k(new MoveElementCommand$1(t,r,n,"top")),G("changed",[t]))}},this.moveToBottomSelectedElement=function(){var e=_slicedToArray(f,1)[0];if(!isNullish(e)){var t=e,n=t.parentNode,r=t.nextSibling,a=t.parentNode.firstChild;"title"===a.tagName&&(a=a.nextSibling),"defs"===a.tagName&&(a=a.nextSibling),r!==(t=t.parentNode.insertBefore(t,a)).nextSibling&&(k(new MoveElementCommand$1(t,r,n,"bottom")),G("changed",[t]))}},this.moveUpDownSelected=function(e){var t=f[0];if(t){var n,r;re=[];var a=$$9(se(getStrokedBBoxDefaultVisible([t]))).toArray();if("Down"===e&&a.reverse(),$$9.each(a,function(){return r?(n=this,!1):(this===t&&(r=!0),!0)}),n){var i=t,s=i.parentNode,o=i.nextSibling;$$9(n)["Down"===e?"before":"after"](i),o!==i.nextSibling&&(k(new MoveElementCommand$1(i,o,s,"Move "+e)),G("changed",[i]))}}},this.moveSelectedElements=function(e,t,n){e.constructor!==Array&&(e/=d,t/=d),n=n||!0;for(var r=new BatchCommand$1("position"),a=f.length;a--;){var i=f[a];if(!isNullish(i)){var s=o.createSVGTransform(),l=getTransformList(i);e.constructor===Array?s.setTranslate(e[a],t[a]):s.setTranslate(e,t),l.numberOfItems?l.insertItemBefore(s,0):l.appendItem(s);var c=recalculateDimensions(i);c&&r.addSubCommand(c),N.requestSelector(i).resize()}}if(!r.isEmpty())return n&&k(r),G("changed",f),r},this.cloneSelectedElements=function(e,t){var n,r,a=new BatchCommand$1("Clone Elements"),i=f.length;for(f.sort(function(e,t){return $$9(t).index()-$$9(e).index()}),n=0;n<i&&(r=f[n],!isNullish(r));++n);var s=f.slice(0,n);this.clearSelection(!0);var o=u();for(n=s.length;n--;)r=s[n]=o.copyElem(s[n]),(h||o.getCurrentLayer()).append(r),a.addSubCommand(new InsertElementCommand$1(r));a.isEmpty()||(I(s.reverse()),this.moveSelectedElements(e,t,!1),k(a))},this.alignSelectedElements=function(e,t){var n=[],r=f.length;if(r){for(var a=Number.MAX_VALUE,s=Number.MIN_VALUE,o=Number.MAX_VALUE,l=Number.MIN_VALUE,c=Number.MIN_VALUE,u=Number.MIN_VALUE,d=0;d<r&&!isNullish(f[d]);++d){var h=f[d];switch(n[d]=getStrokedBBoxDefaultVisible([h]),t){case"smallest":(("l"===e||"c"===e||"r"===e)&&(c===Number.MIN_VALUE||c>n[d].width)||("t"===e||"m"===e||"b"===e)&&(u===Number.MIN_VALUE||u>n[d].height))&&(a=n[d].x,o=n[d].y,s=n[d].x+n[d].width,l=n[d].y+n[d].height,c=n[d].width,u=n[d].height);break;case"largest":(("l"===e||"c"===e||"r"===e)&&(c===Number.MIN_VALUE||c<n[d].width)||("t"===e||"m"===e||"b"===e)&&(u===Number.MIN_VALUE||u<n[d].height))&&(a=n[d].x,o=n[d].y,s=n[d].x+n[d].width,l=n[d].y+n[d].height,c=n[d].width,u=n[d].height);break;default:n[d].x<a&&(a=n[d].x),n[d].y<o&&(o=n[d].y),n[d].x+n[d].width>s&&(s=n[d].x+n[d].width),n[d].y+n[d].height>l&&(l=n[d].y+n[d].height)}}"page"===t&&(a=0,o=0,s=i.contentW,l=i.contentH);for(var p=new Array(r),g=new Array(r),m=0;m<r&&!isNullish(f[m]);++m){var v=n[m];switch(p[m]=0,g[m]=0,e){case"l":p[m]=a-v.x;break;case"c":p[m]=(a+s)/2-(v.x+v.width/2);break;case"r":p[m]=s-(v.x+v.width);break;case"t":g[m]=o-v.y;break;case"m":g[m]=(o+l)/2-(v.y+v.height/2);break;case"b":g[m]=l-(v.y+v.height)}}this.moveSelectedElements(p,g)}},this.contentW=je().w,this.contentH=je().h,this.updateCanvas=function(e,t){o.setAttribute("width",e),o.setAttribute("height",t);var n=$$9("#canvasBackground")[0],r=l.getAttribute("x"),a=l.getAttribute("y"),i=(e-this.contentW*d)/2,s=(t-this.contentH*d)/2;assignAttributes(l,{width:this.contentW*d,height:this.contentH*d,x:i,y:s,viewBox:"0 0 "+this.contentW+" "+this.contentH}),assignAttributes(n,{width:l.getAttribute("width"),height:l.getAttribute("height"),x:i,y:s});var c=getElem("background_image");return c&&assignAttributes(c,{width:"100%",height:"100%"}),N.selectorParentGroup.setAttribute("transform","translate("+i+","+s+")"),ie("canvasUpdated",{new_x:i,new_y:s,old_x:r,old_y:a,d_x:i-r,d_y:s-a}),{x:i,y:s,old_x:r,old_y:a,d_x:i-r,d_y:s-a}},this.setBackground=function(e,t){var n=getElem("canvasBackground"),r=$$9(n).find("rect")[0],a=getElem("background_image");r.setAttribute("fill",e),t?(a||(a=s.createElementNS(NS.SVG,"image"),assignAttributes(a,{id:"background_image",width:"100%",height:"100%",preserveAspectRatio:"xMinYMin",style:"pointer-events:none"})),setHref(a,t),n.append(a)):a&&a.remove()},this.cycleElement=function(e){var t,n=f[0],r=!1,a=getVisibleElements(h||u().getCurrentLayer());if(a.length){if(isNullish(n))r=a[t=e?a.length-1:0];else for(var i=a.length;i--;)if(a[i]===n){(t=e?i-1:i+1)>=a.length?t=0:t<0&&(t=a.length-1),r=a[t];break}ge([r],!0),G("selected",f)}},this.clear(),this.getPrivateMethods=function(){return{addCommandToHistory:k,BatchCommand:BatchCommand$1,ChangeElementCommand:ChangeElementCommand$1,decode64:decode64,dropXMLInteralSubset:dropXMLInteralSubset,encode64:encode64,ffClone:ue,findDefs:findDefs,findDuplicateGradient:Ue,getElem:getElem,getPathBBox:getPathBBox,getTypeMap:getTypeMap,getUrlFromAttr:getUrlFromAttr,identifyLayers:identifyLayers,InsertElementCommand:InsertElementCommand$1,isChrome:isChrome,isIdentity:isIdentity,isIE:isIE,logMatrix:he,MoveElementCommand:MoveElementCommand$1,NS:NS,preventClickDefault:preventClickDefault,RemoveElementCommand:RemoveElementCommand$1,SVGEditTransformList:SVGTransformList,text2xml:text2xml,transformBox:transformBox,transformPoint:transformPoint,walkTree:walkTree}}};function jQueryPluginJSHotkeys(e){function t(t){if("string"==typeof t.data){var n=t.handler,r=t.data.toLowerCase().split(" ");t.handler=function(t){if(this===t.target||27===t.which||!/textarea|select/i.test(t.target.nodeName)&&"text"!==t.target.type){var a="keypress"!==t.type&&e.hotkeys.specialKeys[t.which],i=String.fromCharCode(t.which).toLowerCase(),s="",o={};t.altKey&&"alt"!==a&&(s+="alt+"),t.ctrlKey&&"ctrl"!==a&&(s+="ctrl+"),t.metaKey&&!t.ctrlKey&&"meta"!==a&&(s+="meta+"),t.shiftKey&&"shift"!==a&&(s+="shift+"),a?o[s+a]=!0:(o[s+i]=!0,o[s+e.hotkeys.shiftNums[i]]=!0,"shift+"===s&&(o[e.hotkeys.shiftNums[i]]=!0));for(var l=0,c=r.length;l<c;l++)if(o[r[l]])return n.apply(this,arguments)}}}}return e.hotkeys={version:"0.8",specialKeys:{8:"backspace",9:"tab",13:"return",16:"shift",17:"ctrl",18:"alt",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",191:"/",224:"meta",219:"[",221:"]"},shiftNums:{"`":"~",1:"!",2:"@",3:"#",4:"$",5:"%",6:"^",7:"&",8:"*",9:"(",0:")","-":"_","=":"+",";":": ","'":'"',",":"<",".":">","/":"?","\\":"|"}},e.each(["keydown","keyup","keypress"],function(){e.event.special[this]={add:t}}),e}function jQueryPluginBBQ(e){return function(e,t){var n,r,a,i,s,o,l,c,u=Array.prototype.slice,d=decodeURIComponent,h=e.param,p=e.bbq=e.bbq||{},g=e.event.special,f="hashchange",m="querystring",v="fragment",_="elemUrlAttr",b="location",y="href",x="src",C=/^.*\?|#.*$/g,S=/^.*\#/,w={};function $(e){return"string"==typeof e}function k(e){var t=u.call(arguments,1);return function(){return e.apply(this,t.concat(u.call(arguments)))}}function A(r,i,s,o,l){var u,p,g,f,_;return o!==n?(_=(g=s.match(r?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/))[3]||"",2===l&&$(o)?p=o.replace(r?S:C,""):(f=a(g[2]),o=$(o)?a[r?v:m](o):o,p=2===l?o:1===l?e.extend({},o,f):e.extend({},f,o),p=h(p),r&&(p=p.replace(c,d))),u=g[1]+(r?"#":p||!g[1]?"?":"")+p+_):u=i(s!==n?s:t[b][y]),u}function E(e,t,r){return t===n||"boolean"==typeof t?(r=t,t=h[e?v:m]()):t=$(t)?t.replace(e?S:C,""):t,a(t,r)}function N(t,r,a,i){return $(a)||"object"===_typeof(a)||(i=a,a=r,r=n),this.each(function(){var n=e(this),s=r||l()[(this.nodeName||"").toLowerCase()]||"",o=s&&n.attr(s)||"";n.attr(s,h[t](o,a,i))})}h[m]=k(A,0,function(e){return e.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")}),h[v]=r=k(A,1,function(e){return e.replace(/^[^#]*#?(.*)$/,"$1")}),r.noEscape=function(t){t=t||"";var n=e.map(t.split(""),encodeURIComponent);c=new RegExp(n.join("|"),"g")},r.noEscape(",/"),e.deparam=a=function(t,r){var a={},i={true:!0,false:!1,null:null};return e.each(t.replace(/\+/g," ").split("&"),function(t,s){var o,l=s.split("="),c=d(l[0]),u=a,h=0,p=c.split("]["),g=p.length-1;if(/\[/.test(p[0])&&/\]$/.test(p[g])?(p[g]=p[g].replace(/\]$/,""),g=(p=p.shift().split("[").concat(p)).length-1):g=0,2===l.length)if(o=d(l[1]),r&&(o=o&&!isNaN(o)?+o:"undefined"===o?n:i[o]!==n?i[o]:o),g)for(;h<=g;h++)u=u[c=""===p[h]?u.length:p[h]]=h<g?u[c]||(p[h+1]&&isNaN(p[h+1])?{}:[]):o;else e.isArray(a[c])?a[c].push(o):a[c]!==n?a[c]=[a[c],o]:a[c]=o;else c&&(a[c]=r?n:"")}),a},a[m]=k(E,0),a[v]=i=k(E,1),e[_]||(e[_]=function(t){return e.extend(w,t)})({a:y,base:y,iframe:x,img:x,input:x,form:"action",link:y,script:x}),l=e[_],e.fn[m]=k(N,m),e.fn[v]=k(N,v),p.pushState=s=function(e,a){$(e)&&/^#/.test(e)&&a===n&&(a=2);var i=e!==n,s=r(t[b][y],i?e:{},i?a:2);t[b][y]=s+(/#/.test(s)?"":"#")},p.getState=o=function(e,t){return e===n||"boolean"==typeof e?i(e):i(t)[e]},p.removeState=function(t){var r={};t!==n&&(r=o(),e.each(e.isArray(t)?t:arguments,function(e,t){delete r[t]})),s(r,2)},g[f]=e.extend(g[f],{add:function(t){var i;function s(e){var t=e[v]=r();e.getState=function(e,r){return e===n||"boolean"==typeof e?a(t,e):a(t,r)[e]},i.apply(this,arguments)}if(e.isFunction(t))return i=t,s;i=t.handler,t.handler=s}})}(e,window),function(e,t,n){var r,a=e.event.special,i="location",s="hashchange",o="href",l=e.browser,c=document.documentMode,u=l.msie&&(void 0===c||c<8),d="on"+s in t&&!u;function h(e){return(e=e||t[i][o]).replace(/^[^#]*#?(.*)$/,"$1")}e[s+"Delay"]=100,a[s]=e.extend(a[s],{setup:function(){if(d)return!1;e(r.start)},teardown:function(){if(d)return!1;e(r.stop)}}),r=function(){var n,r,a,l,c={};return c.start=function(){if(!n){var c=h();a||(a=l=function(e){return e},u&&(r=e('<iframe src="javascript:0"/>').hide().insertAfter("body")[0].contentWindow,l=function(){return h(r.document[i][o])},(a=function(e,t){if(e!==t){var n=r.document;n.open().close(),n[i].hash="#"+e}})(h()))),function r(){var u=h(),d=l(c);u!==c?(a(c=u,d),e(t).trigger(s)):d!==c&&(t[i][o]=t[i][o].replace(/#.*/,"")+"#"+d),n=setTimeout(r,e[s+"Delay"])}()}},c.stop=function(){r||(n&&clearTimeout(n),n=0)},c}()}(e,window),e}function jQueryPluginSVGIcons(e){var t,n={};return e.svgIcons=function(r){var a,i,s,o,l,c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},u="http://www.w3.org/2000/svg",d="http://www.w3.org/1999/xlink",h=c.w||24,p=c.h||24,g=!1,f=!1,m=0,v=Boolean(window.opera),_="data:image/svg+xml;charset=utf-8;base64,";if(c.svgz){o=e('<object data="'+r+'" type=image/svg+xml>').appendTo("body").hide();try{i=o[0].contentDocument,o.load(y),y(0,!0)}catch(e){w()}}else{var b=new DOMParser;e.ajax({url:r,dataType:"string",success:function(t){t?(i=b.parseFromString(t,"text/xml"),e(function(){y("ajax")})):e(w)},error:function(t){window.opera?e(function(){w()}):t.responseText?((i=b.parseFromString(t.responseText,"text/xml")).childNodes.length||e(w),e(function(){y("ajax")})):e(w)}})}function y(t,n){if("ajax"!==t){if(f)return;var r=(i=o[0].contentDocument)&&i.getElementById("svg_eof");if(!(r||n&&r))return void(++m<50?setTimeout(y,20):(w(),f=!0));f=!0}if(a=e(i.firstChild).children(),c.no_img)setTimeout(function(){g||S()},500);else{var l=_+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNzUiIGhlaWdodD0iMjc1Ij48L3N2Zz4%3D";s=e(new Image).attr({src:l,width:0,height:0}).appendTo("body").load(function(){S(!0)}).error(function(){S()})}}function x(e,t,n,r){if(v&&t.css("visibility","hidden"),c.replace){r&&t.attr("id",n);var a=e.attr("class");a&&t.attr("class","svg_icon "+a),e.replaceWith(t)}else e.append(t);v&&setTimeout(function(){t.removeAttr("style")},1)}function C(e,t){void 0!==c.id_match&&!1===c.id_match||x(l,e,t,!0),n[t]=e}function S(){var r=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=arguments.length>1?arguments[1]:void 0;if(!g){var f;if(c.no_img&&(r=!1),r&&(f=e(document.createElement("div"))).hide().appendTo("body"),i){var m=c.fallback_path||"";e.each(i,function(t,n){l=e("#"+t),C(e(new Image).attr({class:"svg_icon",src:m+n,width:h,height:p,alt:"icon"}),t)})}else for(var b=a.length,y=0;y<b;y++){var S=a[y],w=S.id;if("svg_eof"===w)break;l=e("#"+w);var $=document.createElementNS(u,"svg");$.setAttribute("viewBox",[0,0,h,p].join(" "));var k=S.getElementsByTagNameNS(u,"svg")[0],A=k.getAttribute("width"),E=k.getAttribute("height");k.removeAttribute("width"),k.removeAttribute("height"),k.getAttribute("viewBox")||k.setAttribute("viewBox",[0,0,A,E].join(" ")),$.setAttribute("xmlns",u),$.setAttribute("width",h),$.setAttribute("height",p),$.setAttribute("xmlns:xlink",d),$.setAttribute("class","svg_icon"),v||(k=k.cloneNode(!0)),$.append(k);var N=void 0;if(r){f.empty().append($);var T=_+encode64(unescape(encodeURIComponent((new XMLSerializer).serializeToString($))));N=e(new Image).attr({class:"svg_icon",src:T})}else N=t(e($),y);C(N,w)}c.placement&&e.each(c.placement,function(a,i){n[i]&&e(a).each(function(a){var s=n[i].clone();a>0&&!r&&(s=t(s,a,!0)),x(e(this),s,i)})}),i||(r&&f.remove(),o&&o.remove(),s&&s.remove()),c.resize&&e.resizeSvgIcons(c.resize),g=!0,c.callback&&c.callback(n)}}function w(){if(r.includes(".svgz")){var t=r.replace(".svgz",".svg");window.console&&console.log(".svgz failed, trying with .svg"),e.svgIcons(t,c)}else c.fallback&&S(!1,c.fallback)}t=function(e,t,n){var r,a=e.find("defs");if(!a.length)return e;r=v?a.find("*").filter(function(){return Boolean(this.id)}):a.find("[id]");var i=e[0].getElementsByTagName("*"),s=i.length;return r.each(function(e){var n=this.id,r="x"+n+t+e;this.id=r;var a="url(#"+n+")",o="url(#"+r+")";for(e=0;e<s;e++){var l=i[e];l.getAttribute("fill")===a&&l.setAttribute("fill",o),l.getAttribute("stroke")===a&&l.setAttribute("stroke",o),l.getAttribute("filter")===a&&l.setAttribute("filter",o)}}),e}},e.getSvgIcon=function(e,r){var a=n[e];return r&&a&&(a=t(a,0,!0).clone(!0)),a},e.resizeSvgIcons=function(t){var n=!e(".svg_icon:first").length;e.each(t,function(t,r){var a=Array.isArray(r),i=a?r[0]:r,s=a?r[1]:r;n&&(t=t.replace(/\.svg_icon/g,"svg")),e(t).each(function(){this.setAttribute("width",i),this.setAttribute("height",s),window.opera&&window.widget&&(this.parentNode.style.width=i+"px",this.parentNode.style.height=s+"px")})})},e}var ns={svg:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink"};function jQueryPluginJGraduate(e){e.loadingStylesheets||(e.loadingStylesheets=[]);e.loadingStylesheets.includes("jgraduate/css/jGraduate.css")||e.loadingStylesheets.push("jgraduate/css/jGraduate.css");e.jGraduate={Paint:function e(t){_classCallCheck(this,e);var n=t||{};if(this.alpha=isNaN(n.alpha)?100:n.alpha,n.copy)switch(this.type=n.copy.type,this.alpha=n.copy.alpha,this.solidColor=null,this.linearGradient=null,this.radialGradient=null,this.type){case"none":break;case"solidColor":this.solidColor=n.copy.solidColor;break;case"linearGradient":this.linearGradient=n.copy.linearGradient.cloneNode(!0);break;case"radialGradient":this.radialGradient=n.copy.radialGradient.cloneNode(!0)}else n.linearGradient?(this.type="linearGradient",this.solidColor=null,this.radialGradient=null,this.linearGradient=n.linearGradient.cloneNode(!0)):n.radialGradient?(this.type="radialGradient",this.solidColor=null,this.linearGradient=null,this.radialGradient=n.radialGradient.cloneNode(!0)):n.solidColor?(this.type="solidColor",this.solidColor=n.solidColor):(this.type="none",this.solidColor=null,this.linearGradient=null,this.radialGradient=null)}},e.fn.jGraduateDefaults={paint:new e.jGraduate.Paint,window:{pickerTitle:"Drag markers to pick a paint"},images:{clientPath:"images/"},newstop:"inverse"};var t=navigator.userAgent.includes("Gecko/");function n(e,n,r){var a=document.createElementNS(ns.svg,e);return function(e,n){t?Object.entries(n).forEach(function(t){var n=_slicedToArray(t,2),r=n[0],a=n[1];e.setAttribute(r,a)}):Object.entries(n).forEach(function(t){var n=_slicedToArray(t,2),r=n[0],a=n[1],i=e[r];i&&"SVGLength"===i.constructor?i.baseVal.value=a:e.setAttribute(r,a)})}(a,n),r&&r.append(a),a}return e.fn.jGraduate=function(t,r,a){return this.each(function(){var i=e(this),s=e.extend(!0,{},e.fn.jGraduateDefaults,t||{}),o=i.attr("id"),l="#"+i.attr("id")+" ";if(l){var c=function(){switch(i.paint.type){case"radialGradient":i.paint.linearGradient=null;break;case"linearGradient":i.paint.radialGradient=null;break;case"solidColor":i.paint.radialGradient=i.paint.linearGradient=null}"function"==typeof i.okCallback&&i.okCallback(i.paint),i.hide()},u=function(){"function"==typeof i.cancelCallback&&i.cancelCallback(),i.hide()};e.extend(!0,i,{paint:new e.jGraduate.Paint({copy:s.paint}),okCallback:"function"==typeof r?r:null,cancelCallback:"function"==typeof a?a:null});var d=null,h=e(window);"none"===i.paint.type&&(i.paint=new e.jGraduate.Paint({solidColor:"ffffff"})),i.addClass("jGraduate_Picker"),i.html('<ul class="jGraduate_tabs"><li class="jGraduate_tab_color jGraduate_tab_current" data-type="col">Solid Color</li><li class="jGraduate_tab_lingrad" data-type="lg">Linear Gradient</li><li class="jGraduate_tab_radgrad" data-type="rg">Radial Gradient</li></ul><div class="jGraduate_colPick"></div><div class="jGraduate_gradPick"></div><div class="jGraduate_LightBox"></div><div id="'+o+'_jGraduate_stopPicker" class="jGraduate_stopPicker"></div>');var p=e(l+"> .jGraduate_colPick"),g=e(l+"> .jGraduate_gradPick");g.html('<div id="'+o+'_jGraduate_Swatch" class="jGraduate_Swatch"><h2 class="jGraduate_Title">'+s.window.pickerTitle+'</h2><div id="'+o+'_jGraduate_GradContainer" class="jGraduate_GradContainer"></div><div id="'+o+'_jGraduate_StopSlider" class="jGraduate_StopSlider"></div></div><div class="jGraduate_Form jGraduate_Points jGraduate_lg_field"><div class="jGraduate_StopSection"><label class="jGraduate_Form_Heading">Begin Point</label><div class="jGraduate_Form_Section"><label>x:</label><input type="text" id="'+o+'_jGraduate_x1" size="3" title="Enter starting x value between 0.0 and 1.0"/><label>y:</label><input type="text" id="'+o+'_jGraduate_y1" size="3" title="Enter starting y value between 0.0 and 1.0"/></div></div><div class="jGraduate_StopSection"><label class="jGraduate_Form_Heading">End Point</label><div class="jGraduate_Form_Section"><label>x:</label><input type="text" id="'+o+'_jGraduate_x2" size="3" title="Enter ending x value between 0.0 and 1.0"/><label>y:</label><input type="text" id="'+o+'_jGraduate_y2" size="3" title="Enter ending y value between 0.0 and 1.0"/></div></div></div><div class="jGraduate_Form jGraduate_Points jGraduate_rg_field"><div class="jGraduate_StopSection"><label class="jGraduate_Form_Heading">Center Point</label><div class="jGraduate_Form_Section"><label>x:</label><input type="text" id="'+o+'_jGraduate_cx" size="3" title="Enter x value between 0.0 and 1.0"/><label>y:</label><input type="text" id="'+o+'_jGraduate_cy" size="3" title="Enter y value between 0.0 and 1.0"/></div></div><div class="jGraduate_StopSection"><label class="jGraduate_Form_Heading">Focal Point</label><div class="jGraduate_Form_Section"><label>Match center: <input type="checkbox" checked="checked" id="'+o+'_jGraduate_match_ctr"/></label><br/><label>x:</label><input type="text" id="'+o+'_jGraduate_fx" size="3" title="Enter x value between 0.0 and 1.0"/><label>y:</label><input type="text" id="'+o+'_jGraduate_fy" size="3" title="Enter y value between 0.0 and 1.0"/></div></div></div><div class="jGraduate_StopSection jGraduate_SpreadMethod"><label class="jGraduate_Form_Heading">Spread method</label><div class="jGraduate_Form_Section"><select class="jGraduate_spreadMethod"><option value=pad selected>Pad</option><option value=reflect>Reflect</option><option value=repeat>Repeat</option></select></div></div><div class="jGraduate_Form"><div class="jGraduate_Slider jGraduate_RadiusField jGraduate_rg_field"><label class="prelabel">Radius:</label><div id="'+o+'_jGraduate_Radius" class="jGraduate_SliderBar jGraduate_Radius" title="Click to set radius"><img id="'+o+'_jGraduate_RadiusArrows" class="jGraduate_RadiusArrows" src="'+s.images.clientPath+'rangearrows2.gif"></div><label><input type="text" id="'+o+'_jGraduate_RadiusInput" size="3" value="100"/>%</label></div><div class="jGraduate_Slider jGraduate_EllipField jGraduate_rg_field"><label class="prelabel">Ellip:</label><div id="'+o+'_jGraduate_Ellip" class="jGraduate_SliderBar jGraduate_Ellip" title="Click to set Ellip"><img id="'+o+'_jGraduate_EllipArrows" class="jGraduate_EllipArrows" src="'+s.images.clientPath+'rangearrows2.gif"></div><label><input type="text" id="'+o+'_jGraduate_EllipInput" size="3" value="0"/>%</label></div><div class="jGraduate_Slider jGraduate_AngleField jGraduate_rg_field"><label class="prelabel">Angle:</label><div id="'+o+'_jGraduate_Angle" class="jGraduate_SliderBar jGraduate_Angle" title="Click to set Angle"><img id="'+o+'_jGraduate_AngleArrows" class="jGraduate_AngleArrows" src="'+s.images.clientPath+'rangearrows2.gif"></div><label><input type="text" id="'+o+'_jGraduate_AngleInput" size="3" value="0"/>deg</label></div><div class="jGraduate_Slider jGraduate_OpacField"><label class="prelabel">Opac:</label><div id="'+o+'_jGraduate_Opac" class="jGraduate_SliderBar jGraduate_Opac" title="Click to set Opac"><img id="'+o+'_jGraduate_OpacArrows" class="jGraduate_OpacArrows" src="'+s.images.clientPath+'rangearrows2.gif"></div><label><input type="text" id="'+o+'_jGraduate_OpacInput" size="3" value="100"/>%</label></div></div><div class="jGraduate_OkCancel"><input type="button" id="'+o+'_jGraduate_Ok" class="jGraduate_Ok" value="OK"/><input type="button" id="'+o+'_jGraduate_Cancel" class="jGraduate_Cancel" value="Cancel"/></div>');var f=256,m=f-0,v=f-0,_={};e(".jGraduate_SliderBar").width(145);var b,y=e("#"+o+"_jGraduate_GradContainer")[0],x=n("svg",{id:o+"_jgraduate_svg",width:f,height:f,xmlns:ns.svg},y),C=i.paint.type,S=i.paint[C],w=S,$=i.paint.alpha,k="solidColor"===C;switch(C){case"solidColor":case"linearGradient":if(k||(w.id=o+"_lg_jgraduate_grad",S=w=x.appendChild(w)),n("radialGradient",{id:o+"_rg_jgraduate_grad"},x),"linearGradient"===C)break;case"radialGradient":k||(w.id=o+"_rg_jgraduate_grad",S=w=x.appendChild(w)),n("linearGradient",{id:o+"_lg_jgraduate_grad"},x)}if(k){S=w=e("#"+o+"_lg_jgraduate_grad")[0],Le(0,"#"+(d=i.paint[C]),1);var A=_typeof(s.newstop);if("string"===A)switch(s.newstop){case"same":Le(1,"#"+d,1);break;case"inverse":for(var E="",N=0;N<6;N+=2){var T=(255-parseInt(d.substr(N,2),16)).toString(16);T.length<2&&(T=0+T),E+=T}Le(1,"#"+E,1);break;case"white":Le(1,"#ffffff",1);break;case"black":Le(1,"#000000",1)}else if("object"===A){var P="opac"in s.newstop?s.newstop.opac:1;Le(1,s.newstop.color||"#"+d,P)}}var G,L=parseFloat(S.getAttribute("x1")||0),I=parseFloat(S.getAttribute("y1")||0),M=parseFloat(S.getAttribute("x2")||1),R=parseFloat(S.getAttribute("y2")||0),O=parseFloat(S.getAttribute("cx")||.5),B=parseFloat(S.getAttribute("cy")||.5),V=parseFloat(S.getAttribute("fx")||O),j=parseFloat(S.getAttribute("fy")||B),F=n("rect",{id:o+"_jgraduate_rect",x:0,y:0,width:m,height:v,fill:"url(#"+o+"_jgraduate_grad)","fill-opacity":$/100},x),D=e("<div/>").attr({class:"grad_coord jGraduate_lg_field",title:"Begin Stop"}).text(1).css({top:I*f,left:L*f}).data("coord","start").appendTo(y),U=D.clone().text(2).css({top:R*f,left:M*f}).attr("title","End stop").data("coord","end").appendTo(y),H=e("<div/>").attr({class:"grad_coord jGraduate_rg_field",title:"Center stop"}).text("C").css({top:B*f,left:O*f}).data("coord","center").appendTo(y),z=H.clone().text("F").css({top:j*f,left:V*f,display:"none"}).attr("title","Focus point").data("coord","focus").appendTo(y);z[0].id=o+"_jGraduate_focusCoord",e.each(["x1","y1","x2","y2","cx","cy","fx","fy"],function(t,n){var r=isNaN(n[1]),a=w.getAttribute(n);a||(a=r?"0.5":"x2"===n?"1.0":"0.0"),_[n]=e("#"+o+"_jGraduate_"+n).val(a).change(function(){isNaN(parseFloat(this.value))||this.value<0?this.value=0:this.value>1&&(this.value=1),("f"!==n[0]||G)&&(r&&"radialGradient"===C||!r&&"linearGradient"===C)&&w.setAttribute(n,this.value);var e=r?"c"===n[0]?H:z:"1"===n[1]?D:U,t=n.includes("x")?"left":"top";e.css(t,this.value*f)}).change()});var q,W,Y,X,Q=e("#"+o+"_jGraduate_StopSlider"),K=n("path",{d:"m9.75,-6l-19.5,19.5m0,-19.5l19.5,19.5",fill:"none",stroke:"#D00","stroke-width":5,display:"none"},void 0),Z=1,J=1,ee=0,te=O,ne=B,re=n("svg",{width:"100%",height:45},Q[0]),ae=n("pattern",{width:16,height:16,patternUnits:"userSpaceOnUse",id:"jGraduate_trans"},re),ie=n("image",{width:16,height:16},ae),se=s.images.clientPath+"map-opacity.png";ie.setAttributeNS(ns.xlink,"xlink:href",se),e(re).click(function(e){if(X=Q.offset(),"path"!==e.target.tagName){var t=e.pageX-X.left-8;Le((t=t<10?10:t>f+10?f+10:t)/f,0,0,!0),e.stopPropagation()}}),e(re).mouseover(function(){re.append(K)}),b=n("g",{},re),n("line",{x1:10,y1:15,x2:f+10,y2:15,"stroke-width":2,stroke:"#000"},re);var oe,le,ce,ue,de=g.find(".jGraduate_spreadMethod").change(function(){w.setAttribute("spreadMethod",e(this).val())}),he=null,pe=function(e){var t=e.pageX-oe.left,n=e.pageY-oe.top;t=t<0?0:t>f?f:t,n=n<0?0:n>f?f:n,he.css("left",t).css("top",n);var r=t/m,a=n/v,i=he.data("coord"),s=w;switch(i){case"start":_.x1.val(r),_.y1.val(a),s.setAttribute("x1",r),s.setAttribute("y1",a);break;case"end":_.x2.val(r),_.y2.val(a),s.setAttribute("x2",r),s.setAttribute("y2",a);break;case"center":_.cx.val(r),_.cy.val(a),s.setAttribute("cx",r),s.setAttribute("cy",a),te=r,ne=a,Re();break;case"focus":_.fx.val(r),_.fy.val(a),s.setAttribute("fx",r),s.setAttribute("fy",a),Re()}e.preventDefault()},ge=function e(){he=null,h.unbind("mousemove",pe).unbind("mouseup",e)},fe=(q=w.getElementsByTagNameNS(ns.svg,"stop")).length;if(fe<2){for(;fe<2;)w.append(document.createElementNS(ns.svg,"stop")),++fe;q=w.getElementsByTagNameNS(ns.svg,"stop")}for(var me=0;me<fe;me++)Le(0,0,0,0,q[me]);if(de.val(w.getAttribute("spreadMethod")||"pad"),G=!1,F.setAttribute("fill-opacity",$/100),e("#"+o+" div.grad_coord").mousedown(function(t){t.preventDefault(),he=e(this),oe=he.parent().offset(),h.mousemove(pe).mouseup(ge)}),e("#"+o+"_jGraduate_Ok").bind("click",function(){i.paint.type=C,i.paint[C]=w.cloneNode(!0),i.paint.solidColor=null,c()}),e("#"+o+"_jGraduate_Cancel").bind("click",function(e){u()}),"radialGradient"===C&&(G?z.show():(z.hide(),_.fx.val(""),_.fy.val(""))),e("#"+o+"_jGraduate_match_ctr")[0].checked=!G,e("#"+o+"_jGraduate_match_ctr").change(function(){G=!this.checked,z.toggle(G),_.fx.val(""),_.fy.val("");var e=w;if(G){var t=le||.5,n=ce||.5;e.setAttribute("fx",t),e.setAttribute("fy",n),_.fx.val(t),_.fy.val(n)}else le=e.getAttribute("fx"),ce=e.getAttribute("fy"),e.removeAttribute("fx"),e.removeAttribute("fy")}),(fe=(q=w.getElementsByTagNameNS(ns.svg,"stop")).length)<2){for(;fe<2;)w.append(document.createElementNS(ns.svg,"stop")),++fe;q=w.getElementsByTagNameNS(ns.svg,"stop")}var ve=0,_e=0;if("radialGradient"===C){var be=w.gradientTransform.baseVal;if(2===be.numberOfItems){var ye=be.getItem(0),xe=be.getItem(1);if(2===ye.type&&3===xe.type){var Ce=xe.matrix;1!==Ce.a?ve=Math.round(100*-(1-Ce.a)):1!==Ce.d&&(ve=Math.round(100*(1-Ce.d)))}}else if(3===be.numberOfItems){var Se=be.getItem(0),we=be.getItem(1),$e=be.getItem(2);if(4===Se.type&&2===we.type&&3===$e.type){_e=Math.round(Se.angle);var ke=$e.matrix;1!==ke.a?ve=Math.round(100*-(1-ke.a)):1!==ke.d&&(ve=Math.round(100*(1-ke.d)))}}}var Ae={radius:{handle:"#"+o+"_jGraduate_RadiusArrows",input:"#"+o+"_jGraduate_RadiusInput",val:100*(w.getAttribute("r")||.5)},opacity:{handle:"#"+o+"_jGraduate_OpacArrows",input:"#"+o+"_jGraduate_OpacInput",val:i.paint.alpha||100},ellip:{handle:"#"+o+"_jGraduate_EllipArrows",input:"#"+o+"_jGraduate_EllipInput",val:ve},angle:{handle:"#"+o+"_jGraduate_AngleArrows",input:"#"+o+"_jGraduate_AngleInput",val:_e}};e.each(Ae,function(t,n){var r=e(n.handle);r.mousedown(function(a){var i=r.parent();ue={type:t,elem:r,input:e(n.input),parent:i,offset:i.offset()},h.mousemove(Ee).mouseup(Ne),a.preventDefault()}),e(n.input).val(n.val).change(function(){var e="radialGradient"===C,n=Number(this.value),a=0;switch(t){case"radius":e&&w.setAttribute("r",n/100),a=Math.pow(n/100,.4)/2*145;break;case"opacity":i.paint.alpha=n,F.setAttribute("fill-opacity",n/100),a=1.45*n;break;case"ellip":if(Z=J=1,0===n){a=72.5;break}n>99.5&&(n=99.5),n>0?J=1-n/100:Z=-n/100-1,a=(n+100)/2*145/100,e&&Re();break;case"angle":a=(ee=n)/180,a+=.5,a*=145,e&&Re()}a>145?a=145:a<0&&(a=0),r.css({"margin-left":a-5})}).change()});for(var Ee=function(e){!function(e){var t=ue.offset.left,n=ue.parent,r=e.pageX-t-parseInt(n.css("border-left-width"));r>145&&(r=145),r<=0&&(r=0);var a=r-5;switch(r/=145,ue.type){case"radius":(r=Math.pow(2*r,2.5))>.98&&r<1.02&&(r=1),r<=.01&&(r=.01),w.setAttribute("r",r);break;case"opacity":i.paint.alpha=parseInt(100*r),F.setAttribute("fill-opacity",r);break;case"ellip":Z=1,J=1,r<.5?Z=(r/=.5)<=0?.01:r:r>.5&&(J=(r=2-(r/=.5))<=0?.01:r),Re(),J===1+(r-=1)&&(r=Math.abs(r));break;case"angle":r-=.5,ee=r*=180,Re(),r/=100}ue.elem.css({"margin-left":a}),r=Math.round(100*r),ue.input.val(r)}(e),e.preventDefault()},Ne=function e(t){h.unbind("mousemove",Ee).unbind("mouseup",e),ue=null},Te=(255*i.paint.alpha/100).toString(16);Te.length<2;)Te="0"+Te;Te=Te.split(".")[0],d="none"===i.paint.solidColor?"":i.paint.solidColor+Te,k||(d=q[0].getAttribute("stop-color")),e.extend(e.fn.jPicker.defaults.window,{alphaSupport:!0,effects:{type:"show",speed:0}}),p.jPicker({window:{title:s.window.pickerTitle},images:{clientPath:s.images.clientPath},color:{active:d,alphaSupport:!0}},function(e){i.paint.type="solidColor",i.paint.alpha=e.val("ahex")?Math.round(e.val("a")/255*100):100,i.paint.solidColor=e.val("hex")?e.val("hex"):"none",i.paint.radialGradient=null,c()},null,function(){u()});var Pe,Ge=e(l+" .jGraduate_tabs li");switch(Ge.click(function(){Ge.removeClass("jGraduate_tab_current"),e(this).addClass("jGraduate_tab_current"),e(l+" > div").hide();var t=e(this).attr("data-type");if(e(l+" .jGraduate_gradPick").show(),"rg"===t||"lg"===t){e(".jGraduate_"+t+"_field").show(),e(".jGraduate_"+("lg"===t?"rg":"lg")+"_field").hide(),e("#"+o+"_jgraduate_rect")[0].setAttribute("fill","url(#"+o+"_"+t+"_jgraduate_grad)"),C="lg"===t?"linearGradient":"radialGradient",e("#"+o+"_jGraduate_OpacInput").val(i.paint.alpha).change();var n=e("#"+o+"_"+t+"_jgraduate_grad")[0];if(w!==n){var r=e(w).find("stop");e(n).empty().append(r),w=n;var a=de.val();w.setAttribute("spreadMethod",a)}G="rg"===t&&null!==w.getAttribute("fx")&&!(O===V&&B===j),e("#"+o+"_jGraduate_focusCoord").toggle(G),G&&(e("#"+o+"_jGraduate_match_ctr")[0].checked=!1)}else e(l+" .jGraduate_gradPick").hide(),e(l+" .jGraduate_colPick").show()}),e(l+" > div").hide(),Ge.removeClass("jGraduate_tab_current"),i.paint.type){case"linearGradient":Pe=e(l+" .jGraduate_tab_lingrad");break;case"radialGradient":Pe=e(l+" .jGraduate_tab_radgrad");break;default:Pe=e(l+" .jGraduate_tab_color")}i.show(),setTimeout(function(){Pe.addClass("jGraduate_tab_current").click()},10)}else e.alert("Container element must have an id attribute to maintain unique id strings for sub-elements.");function Le(t,r,a,i,l){var c=l||n("stop",{"stop-color":r,"stop-opacity":a,offset:t},w);l?(r=l.getAttribute("stop-color"),a=l.getAttribute("stop-opacity"),t=l.getAttribute("offset")):w.append(c),null===a&&(a=1);var u="M-6.2,0.9c3.6-4,6.7-4.3,6.7-12.4c-0.2,7.9,3.1,8.8,6.5,12.4c3.5,3.8,2.9,9.6,0,12.3c-3.1,2.8-10.4,2.7-13.2,0C-9.6,9.9-9.4,4.4-6.2,0.9z",d=n("path",{d:u,fill:"url(#jGraduate_trans)",transform:"translate("+(10+t*f)+", 26)"},b),p=n("path",{d:u,fill:r,"fill-opacity":a,transform:"translate("+(10+t*f)+", 26)",stroke:"#000","stroke-width":1.5},b);return e(p).mousedown(function(e){return Ie(this),Y=W,h.mousemove(Oe).mouseup(Me),X=Q.offset(),e.preventDefault(),!1}).data("stop",c).data("bg",d).dblclick(function(){e("div.jGraduate_LightBox").show();for(var t=this,n=Number(c.getAttribute("stop-opacity"))||1,a=c.getAttribute("stop-color")||1,i=(255*parseFloat(n)).toString(16);i.length<2;)i="0"+i;r=a.substr(1)+i,e("#"+o+"_jGraduate_stopPicker").css({left:100,bottom:15}).jPicker({window:{title:"Pick the start color and opacity for the gradient"},images:{clientPath:s.images.clientPath},color:{active:r,alphaSupport:!0}},function(r,i){a=r.val("hex")?"#"+r.val("hex"):"none",n=null!==r.val("a")?r.val("a")/256:1,t.setAttribute("fill",a),t.setAttribute("fill-opacity",n),c.setAttribute("stop-color",a),c.setAttribute("stop-opacity",n),e("div.jGraduate_LightBox").hide(),e("#"+o+"_jGraduate_stopPicker").hide()},null,function(){e("div.jGraduate_LightBox").hide(),e("#"+o+"_jGraduate_stopPicker").hide()})}),e(w).find("stop").each(function(){var n=e(this);if(Number(this.getAttribute("offset"))>t){if(!r){var a=this.getAttribute("stop-color"),i=this.getAttribute("stop-opacity");c.setAttribute("stop-color",a),p.setAttribute("fill",a),c.setAttribute("stop-opacity",null===i?1:i),p.setAttribute("fill-opacity",null===i?1:i)}return n.before(c),!1}return!0}),i&&Ie(p),c}function Ie(e){W&&W.setAttribute("stroke","#000"),e.setAttribute("stroke","blue"),(W=e).parentNode.append(W)}function Me(){h.unbind("mousemove",Oe),"none"!==K.getAttribute("display")&&function(){K.setAttribute("display","none");var t=e(W),n=t.data("stop"),r=t.data("bg");e([W,n,r]).remove()}(),Y=null}function Re(){var e=ee?"rotate("+ee+","+te+","+ne+") ":"";if(1===Z&&1===J)w.removeAttribute("gradientTransform");else{var t=-te*(Z-1),n=-ne*(J-1);w.setAttribute("gradientTransform",e+"translate("+t+","+n+") scale("+Z+","+J+")")}}function Oe(t){var n=t.pageX-X.left,r=t.pageY-X.top,a="translate("+(n=n<10?10:n>f+10?f+10:n)+", 26)";r<-60||r>130?(K.setAttribute("display","block"),K.setAttribute("transform",a)):K.setAttribute("display","none"),Y.setAttribute("transform",a),e.data(Y,"bg").setAttribute("transform",a);var i=e.data(Y,"stop"),s=(n-10)/f;i.setAttribute("offset",s);var o=0;e(w).find("stop").each(function(t){var n=this.getAttribute("offset"),r=e(this);n<o&&(r.prev().before(r),q=e(w).find("stop")),o=n})}})},e}function jQueryPluginSpinButton(e){e.loadingStylesheets||(e.loadingStylesheets=[]);return e.loadingStylesheets.includes("spinbtn/jQuery.SpinButton.css")||e.loadingStylesheets.push("spinbtn/jQuery.SpinButton.css"),e.fn.SpinButton=function(t){function n(t,n){for(var r=document.body,a=t[n];(t=t.offsetParent)&&t!==r;)e.browser.msie&&"relative"===t.currentStyle.position||(a+=t[n]);return a}return t=t||{},this.each(function(){this.repeating=!1,this.spinCfg={min:isNaN(parseFloat(t.min))?null:Number(t.min),max:isNaN(parseFloat(t.max))?null:Number(t.max),step:t.step?Number(t.step):1,stepfunc:t.stepfunc||!1,page:t.page?Number(t.page):10,upClass:t.upClass||"up",downClass:t.downClass||"down",reset:t.reset||this.value,delay:t.delay?Number(t.delay):500,interval:t.interval?Number(t.interval):100,_btn_width:20,_direction:null,_delay:null,_repeat:null,callback:t.callback||null},this.spinCfg.smallStep=t.smallStep||this.spinCfg.step/2,this.adjustValue=function(e){var t;t=isNaN(this.value)?this.spinCfg.reset:"function"==typeof this.spinCfg.stepfunc?this.spinCfg.stepfunc(this,e):Number((Number(this.value)+Number(e)).toFixed(5)),null!==this.spinCfg.min&&(t=Math.max(t,this.spinCfg.min)),null!==this.spinCfg.max&&(t=Math.min(t,this.spinCfg.max)),this.value=t,"function"==typeof this.spinCfg.callback&&this.spinCfg.callback(this)},e(this).addClass(t.spinClass||"spin-button").mousemove(function(r){var a=r.pageX||r.x,i=r.pageY||r.y,s=r.target,o=t.stateObj.tool_scale||1,l=e(s).height()/2,c=a>n(s,"offsetLeft")+s.offsetWidth*o-this.spinCfg._btn_width?i<n(s,"offsetTop")+l*o?1:-1:0;if(c!==this.spinCfg._direction){switch(c){case 1:e(this).removeClass(this.spinCfg.downClass).addClass(this.spinCfg.upClass);break;case-1:e(this).removeClass(this.spinCfg.upClass).addClass(this.spinCfg.downClass);break;default:e(this).removeClass(this.spinCfg.upClass).removeClass(this.spinCfg.downClass)}this.spinCfg._direction=c}}).mouseout(function(){e(this).removeClass(this.spinCfg.upClass).removeClass(this.spinCfg.downClass),this.spinCfg._direction=null,window.clearInterval(this.spinCfg._repeat),window.clearTimeout(this.spinCfg._delay)}).mousedown(function(e){var t=this;if(0===e.button&&0!==this.spinCfg._direction){var n=e.shiftKey?this.spinCfg.smallStep:this.spinCfg.step,r=function(){t.adjustValue(t.spinCfg._direction*n)};r(),this.spinCfg._delay=window.setTimeout(function(){r(),t.spinCfg._repeat=window.setInterval(r,t.spinCfg.interval)},this.spinCfg.delay)}}).mouseup(function(e){window.clearInterval(this.spinCfg._repeat),window.clearTimeout(this.spinCfg._delay)}).dblclick(function(t){e.browser.msie&&this.adjustValue(this.spinCfg._direction*this.spinCfg.step)}).keydown(function(e){switch(e.keyCode){case 38:this.adjustValue(this.spinCfg.step);break;case 40:this.adjustValue(-this.spinCfg.step);break;case 33:this.adjustValue(this.spinCfg.page);break;case 34:this.adjustValue(-this.spinCfg.page)}}).keypress(function(e){if(this.repeating)switch(e.keyCode){case 38:this.adjustValue(this.spinCfg.step);break;case 40:this.adjustValue(-this.spinCfg.step);break;case 33:this.adjustValue(this.spinCfg.page);break;case 34:this.adjustValue(-this.spinCfg.page)}else this.repeating=!0}).keyup(function(e){switch(this.repeating=!1,e.keyCode){case 38:case 40:case 33:case 34:case 13:this.adjustValue(0)}}).bind("mousewheel",function(e){e.wheelDelta>=120?this.adjustValue(this.spinCfg.step):e.wheelDelta<=-120&&this.adjustValue(-this.spinCfg.step),e.preventDefault()}).change(function(e){this.adjustValue(0)}),this.addEventListener&&this.addEventListener("DOMMouseScroll",function(e){e.detail>0?this.adjustValue(-this.spinCfg.step):e.detail<0&&this.adjustValue(this.spinCfg.step),e.preventDefault()})})},e}function jQueryContextMenu(e){var t=e(window),n=e(document);return e.extend(e.fn,{contextMenu:function(r,a){return void 0!==r.menu&&(void 0===r.inSpeed&&(r.inSpeed=150),void 0===r.outSpeed&&(r.outSpeed=75),0===r.inSpeed&&(r.inSpeed=-1),0===r.outSpeed&&(r.outSpeed=-1),e(this).each(function(){var i=e(this),s=e(i).offset(),o=e("#"+r.menu);o.addClass("contextMenu"),e(this).bind("mousedown",function(l){e(this).mouseup(function(c){var u=e(this);if(u.unbind("mouseup"),2===l.button||r.allowLeft||l.ctrlKey&&isMac()){if(c.stopPropagation(),e(".contextMenu").hide(),i.hasClass("disabled"))return!1;var d=c.pageX,h=c.pageY,p=t.width()-o.width(),g=t.height()-o.height();d>p-15&&(d=p-15),h>g-30&&(h=g-30),n.unbind("click"),o.css({top:h,left:d}).fadeIn(r.inSpeed),o.find("A").mouseover(function(){o.find("LI.hover").removeClass("hover"),e(this).parent().addClass("hover")}).mouseout(function(){o.find("LI.hover").removeClass("hover")}),n.keypress(function(e){switch(e.keyCode){case 38:o.find("LI.hover").length?(o.find("LI.hover").removeClass("hover").prevAll("LI:not(.disabled)").eq(0).addClass("hover"),o.find("LI.hover").length||o.find("LI:last").addClass("hover")):o.find("LI:last").addClass("hover");break;case 40:o.find("LI.hover").length?(o.find("LI.hover").removeClass("hover").nextAll("LI:not(.disabled)").eq(0).addClass("hover"),o.find("LI.hover").length||o.find("LI:first").addClass("hover")):o.find("LI:first").addClass("hover");break;case 13:o.find("LI.hover A").trigger("click");break;case 27:n.trigger("click")}}),o.find("A").unbind("mouseup"),o.find("LI:not(.disabled) A").mouseup(function(){return n.unbind("click").unbind("keypress"),e(".contextMenu").hide(),a&&a(e(this).attr("href").substr(1),e(u),{x:d-s.left,y:h-s.top,docX:d,docY:h}),!1}),setTimeout(function(){n.click(function(){return n.unbind("click").unbind("keypress"),o.fadeOut(r.outSpeed),!1})},0)}})}),e.browser.mozilla?e("#"+r.menu).each(function(){e(this).css({MozUserSelect:"none"})}):e.browser.msie?e("#"+r.menu).each(function(){e(this).bind("selectstart.disableTextSelect",function(){return!1})}):e("#"+r.menu).each(function(){e(this).bind("mousedown.disableTextSelect",function(){return!1})}),e(i).add(e("UL.contextMenu")).bind("contextmenu",function(){return!1})}),e(this))},disableContextMenuItems:function(t){return void 0===t?(e(this).find("LI").addClass("disabled"),e(this)):(e(this).each(function(){if(void 0!==t)for(var n=t.split(","),r=0;r<n.length;r++)e(this).find('A[href="'+n[r]+'"]').parent().addClass("disabled")}),e(this))},enableContextMenuItems:function(t){return void 0===t?(e(this).find("LI.disabled").removeClass("disabled"),e(this)):(e(this).each(function(){if(void 0!==t)for(var n=t.split(","),r=0;r<n.length;r++)e(this).find('A[href="'+n[r]+'"]').parent().removeClass("disabled")}),e(this))},disableContextMenu:function(){return e(this).each(function(){e(this).addClass("disabled")}),e(this)},enableContextMenu:function(){return e(this).each(function(){e(this).removeClass("disabled")}),e(this)},destroyContextMenu:function(){return e(this).each(function(){e(this).unbind("mousedown").unbind("mouseup")}),e(this)}}),e}function toFixedNumeric(e,t){return void 0===t&&(t=0),Math.round(e*Math.pow(10,t))/Math.pow(10,t)}window.console||(window.console={log:function(e){},dir:function(e){}});var langParam,editor_,isNullish$1=function(e){return null==e},jPicker=function(e){e.loadingStylesheets||(e.loadingStylesheets=[]);e.loadingStylesheets.includes("jgraduate/css/jPicker.css")||e.loadingStylesheets.push("jgraduate/css/jPicker.css");var t=function t(n,r){_classCallCheck(this,t);var a=this;function i(t){var r=n.offset();d={l:0|r.left,t:0|r.top},clearTimeout(h),h=setTimeout(function(){l.call(a,t)},0),e(document).bind("mousemove",s).bind("mouseup",o),t.preventDefault()}function s(e){return clearTimeout(h),h=setTimeout(function(){l.call(a,e)},0),e.stopPropagation(),e.preventDefault(),!1}function o(t){return e(document).unbind("mouseup",o).unbind("mousemove",s),t.stopPropagation(),t.preventDefault(),!1}function l(e){var t=n.w,r=n.h,i=e.pageX-d.l,s=e.pageY-d.t;i<0?i=0:i>t&&(i=t),s<0?s=0:s>r&&(s=r),c.call(a,"xy",{x:i/t*v+f,y:s/r*y+_})}function c(e,t,n){if(!(void 0!==t))switch(isNullish$1(e)&&(e="xy"),e.toLowerCase()){case"x":return p;case"y":return g;case"xy":default:return{x:p,y:g}}if(isNullish$1(n)||n!==a){var r,i,s=!1;switch(isNullish$1(e)&&(e="xy"),e.toLowerCase()){case"x":r=t&&(t.x&&0|t.x||0|t)||0;break;case"y":i=t&&(t.y&&0|t.y||0|t)||0;break;case"xy":default:r=t&&t.x&&0|t.x||0,i=t&&t.y&&0|t.y||0}isNullish$1(r)||(r<f?r=f:r>m&&(r=m),p!==r&&(p=r,s=!0)),isNullish$1(i)||(i<_?i=_:i>b&&(i=b),g!==i&&(g=i,s=!0)),s&&function(e){C.forEach(function(t){t.call(a,a,e)})}.call(a,n||a)}}function u(e){"function"==typeof e&&C.push(e)}var d,h,p=0,g=0,f=0,m=100,v=100,_=0,b=100,y=100,x=n.find("img:first"),C=[];e.extend(!0,a,{val:c,range:function(e,t){var n,r,a,i;if(void 0===t)switch(isNullish$1(e)&&(e="all"),e.toLowerCase()){case"minx":return f;case"maxx":return m;case"rangex":return{minX:f,maxX:m,rangeX:v};case"miny":return _;case"maxy":return b;case"rangey":return{minY:_,maxY:b,rangeY:y};case"all":default:return{minX:f,maxX:m,rangeX:v,minY:_,maxY:b,rangeY:y}}switch(isNullish$1(e)&&(e="all"),e.toLowerCase()){case"minx":n=t&&(t.minX&&0|t.minX||0|t)||0;break;case"maxx":r=t&&(t.maxX&&0|t.maxX||0|t)||0;break;case"rangex":n=t&&t.minX&&0|t.minX||0,r=t&&t.maxX&&0|t.maxX||0;break;case"miny":a=t&&(t.minY&&0|t.minY||0|t)||0;break;case"maxy":i=t&&(t.maxY&&0|t.maxY||0|t)||0;break;case"rangey":a=t&&t.minY&&0|t.minY||0,i=t&&t.maxY&&0|t.maxY||0;break;case"all":default:n=t&&t.minX&&0|t.minX||0,r=t&&t.maxX&&0|t.maxX||0,a=t&&t.minY&&0|t.minY||0,i=t&&t.maxY&&0|t.maxY||0}isNullish$1(n)||f===n||(v=m-(f=n)),isNullish$1(r)||m===r||(v=(m=r)-f),isNullish$1(a)||_===a||(y=b-(_=a)),isNullish$1(i)||b===i||(y=(b=i)-_)},bind:u,unbind:function(e){if("function"==typeof e)for(var t;t=C.includes(e);)C.splice(t,1)},destroy:function(){e(document).unbind("mouseup",o).unbind("mousemove",s),n.unbind("mousedown",i),n=null,x=null,C=null}}),x.src=r.arrow&&r.arrow.image,x.w=r.arrow&&r.arrow.width||x.width(),x.h=r.arrow&&r.arrow.height||x.height(),n.w=r.map&&r.map.width||n.width(),n.h=r.map&&r.map.height||n.height(),n.bind("mousedown",i),u.call(a,function(){var e=n.w,t=n.h,r=x.w,a=x.h,i=0,s=0;setTimeout(function(){v>0&&(i=p===m?e:p/v*e|0),y>0&&(s=g===b?t:g/y*t|0),r>=e?i=(e>>1)-(r>>1):i-=r>>1,a>=t?s=(t>>1)-(a>>1):s-=a>>1,x.css({left:i+"px",top:s+"px"})})})},n=function t(n,r,a,i){_classCallCheck(this,t);var s=this,o=n.find("td.Text input");function l(e){if(""!==e.target.value||e.target===x.get(0)||(isNullish$1(a)||e.target===a.get(0))&&!isNullish$1(a)){if(!d(e))return e;switch(e.target){case g.get(0):switch(e.keyCode){case 38:return g.val(h.call(s,1+(g.val()<<0),0,255)),r.val("r",g.val(),e.target),!1;case 40:return g.val(h.call(s,(g.val()<<0)-1,0,255)),r.val("r",g.val(),e.target),!1}break;case f.get(0):switch(e.keyCode){case 38:return f.val(h.call(s,1+(f.val()<<0),0,255)),r.val("g",f.val(),e.target),!1;case 40:return f.val(h.call(s,(f.val()<<0)-1,0,255)),r.val("g",f.val(),e.target),!1}break;case m.get(0):switch(e.keyCode){case 38:return m.val(h.call(s,1+(m.val()<<0),0,255)),r.val("b",m.val(),e.target),!1;case 40:return m.val(h.call(s,(m.val()<<0)-1,0,255)),r.val("b",m.val(),e.target),!1}break;case v&&v.get(0):switch(e.keyCode){case 38:return v.val(h.call(s,parseFloat(v.val())+1,0,100)),r.val("a",toFixedNumeric(255*v.val()/100,i),e.target),!1;case 40:return v.val(h.call(s,parseFloat(v.val())-1,0,100)),r.val("a",toFixedNumeric(255*v.val()/100,i),e.target),!1}break;case _.get(0):switch(e.keyCode){case 38:return _.val(h.call(s,1+(_.val()<<0),0,360)),r.val("h",_.val(),e.target),!1;case 40:return _.val(h.call(s,(_.val()<<0)-1,0,360)),r.val("h",_.val(),e.target),!1}break;case b.get(0):switch(e.keyCode){case 38:return b.val(h.call(s,1+(b.val()<<0),0,100)),r.val("s",b.val(),e.target),!1;case 40:return b.val(h.call(s,(b.val()<<0)-1,0,100)),r.val("s",b.val(),e.target),!1}break;case y.get(0):switch(e.keyCode){case 38:return y.val(h.call(s,1+(y.val()<<0),0,100)),r.val("v",y.val(),e.target),!1;case 40:return y.val(h.call(s,(y.val()<<0)-1,0,100)),r.val("v",y.val(),e.target),!1}}}}function c(e){if(""!==e.target.value||e.target===x.get(0)||(isNullish$1(a)||e.target===a.get(0))&&!isNullish$1(a)){if(!d(e))return e;switch(e.target){case g.get(0):g.val(h.call(s,g.val(),0,255)),r.val("r",g.val(),e.target);break;case f.get(0):f.val(h.call(s,f.val(),0,255)),r.val("g",f.val(),e.target);break;case m.get(0):m.val(h.call(s,m.val(),0,255)),r.val("b",m.val(),e.target);break;case v&&v.get(0):v.val(h.call(s,v.val(),0,100)),r.val("a",toFixedNumeric(255*v.val()/100,i),e.target);break;case _.get(0):_.val(h.call(s,_.val(),0,360)),r.val("h",_.val(),e.target);break;case b.get(0):b.val(h.call(s,b.val(),0,100)),r.val("s",b.val(),e.target);break;case y.get(0):y.val(h.call(s,y.val(),0,100)),r.val("v",y.val(),e.target);break;case x.get(0):x.val(x.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6)),a&&a.val(x.val()),r.val("hex",""!==x.val()?x.val():null,e.target);break;case a&&a.get(0):a.val(a.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6)),x.val(a.val()),r.val("hex",""!==a.val()?a.val():null,e.target);break;case C&&C.get(0):C.val(C.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,2)),r.val("a",isNullish$1(C.val())?null:parseInt(C.val(),16),e.target)}}}function u(e){if(!isNullish$1(r.val()))switch(e.target){case g.get(0):g.val(r.val("r"));break;case f.get(0):f.val(r.val("g"));break;case m.get(0):m.val(r.val("b"));break;case v&&v.get(0):v.val(toFixedNumeric(100*r.val("a")/255,i));break;case _.get(0):_.val(r.val("h"));break;case b.get(0):b.val(r.val("s"));break;case y.get(0):y.val(r.val("v"));break;case x.get(0):case a&&a.get(0):x.val(r.val("hex")),a&&a.val(r.val("hex"));break;case C&&C.get(0):C.val(r.val("ahex").substring(6))}}function d(e){switch(e.keyCode){case 9:case 16:case 29:case 37:case 39:return!1;case"c".charCodeAt():case"v".charCodeAt():if(e.ctrlKey)return!1}return!0}function h(e,t,n){return""===e||isNaN(e)?t:e>n?n:e<t?t:e}function p(e,t){var n=e.val("all");t!==g.get(0)&&g.val(isNullish$1(n)?"":n.r),t!==f.get(0)&&f.val(isNullish$1(n)?"":n.g),t!==m.get(0)&&m.val(isNullish$1(n)?"":n.b),v&&t!==v.get(0)&&v.val(isNullish$1(n)?"":toFixedNumeric(100*n.a/255,i)),t!==_.get(0)&&_.val(isNullish$1(n)?"":n.h),t!==b.get(0)&&b.val(isNullish$1(n)?"":n.s),t!==y.get(0)&&y.val(isNullish$1(n)?"":n.v),t!==x.get(0)&&(a&&t!==a.get(0)||!a)&&x.val(isNullish$1(n)?"":n.hex),a&&t!==a.get(0)&&t!==x.get(0)&&a.val(isNullish$1(n)?"":n.hex),C&&t!==C.get(0)&&C.val(isNullish$1(n)?"":n.ahex.substring(6))}var g=o.eq(3),f=o.eq(4),m=o.eq(5),v=o.length>7?o.eq(6):null,_=o.eq(0),b=o.eq(1),y=o.eq(2),x=o.eq(o.length>7?7:6),C=o.length>7?o.eq(8):null;e.extend(!0,s,{destroy:function(){g.add(f).add(m).add(v).add(_).add(b).add(y).add(x).add(a).add(C).unbind("keyup",c).unbind("blur",u),g.add(f).add(m).add(v).add(_).add(b).add(y).unbind("keydown",l),r.unbind(p),g=null,f=null,m=null,v=null,_=null,b=null,y=null,x=null,C=null}}),g.add(f).add(m).add(v).add(_).add(b).add(y).add(x).add(a).add(C).bind("keyup",c).bind("blur",u),g.add(f).add(m).add(v).add(_).add(b).add(y).bind("keydown",l),r.bind(p)};e.jPicker={List:[],Color:function(t){var n=this;function r(e){for(var t=0;t<p.length;t++)p[t].call(n,n,e)}function a(e,t,p){var g=Boolean(t);if(g&&""===t.ahex&&(t.ahex="00000000"),!g){var f;if((isNullish$1(e)||""===e)&&(e="all"),isNullish$1(i))return null;switch(e.toLowerCase()){case"ahex":return s.rgbaToHex({r:i,g:o,b:l,a:c});case"hex":return a("ahex").substring(0,6);case"all":return{r:i,g:o,b:l,a:c,h:u,s:d,v:h,hex:a.call(n,"hex"),ahex:a.call(n,"ahex")};default:f={};var m=e.length;_toConsumableArray(e).forEach(function(e){switch(e){case"r":1===m?f=i:f.r=i;break;case"g":1===m?f=o:f.g=o;break;case"b":1===m?f=l:f.b=l;break;case"a":1===m?f=c:f.a=c;break;case"h":1===m?f=u:f.h=u;break;case"s":1===m?f=d:f.s=d;break;case"v":1===m?f=h:f.v=h}})}return"object"!==_typeof(f)||Object.keys(f).length?f:a.call(n,"all")}if(isNullish$1(p)||p!==n){isNullish$1(e)&&(e="");var v=!1;if(isNullish$1(t))return isNullish$1(i)||(i=null,v=!0),isNullish$1(o)||(o=null,v=!0),isNullish$1(l)||(l=null,v=!0),isNullish$1(c)||(c=null,v=!0),isNullish$1(u)||(u=null,v=!0),isNullish$1(d)||(d=null,v=!0),isNullish$1(h)||(h=null,v=!0),void(v&&r.call(n,p||n));switch(e.toLowerCase()){case"ahex":case"hex":var _=s.hexToRgba(t&&(t.ahex||t.hex)||t||"none");a.call(n,"rgba",{r:_.r,g:_.g,b:_.b,a:"ahex"===e?_.a:isNullish$1(c)?255:c},p);break;default:if(t&&(!isNullish$1(t.ahex)||!isNullish$1(t.hex)))return void a.call(n,"ahex",t.ahex||t.hex||"00000000",p);var b={},y=!1,x=!1;if(void 0===t.r||e.includes("r")||(e+="r"),void 0===t.g||e.includes("g")||(e+="g"),void 0===t.b||e.includes("b")||(e+="b"),void 0===t.a||e.includes("a")||(e+="a"),void 0===t.h||e.includes("h")||(e+="h"),void 0===t.s||e.includes("s")||(e+="s"),void 0===t.v||e.includes("v")||(e+="v"),_toConsumableArray(e).forEach(function(e){switch(e){case"r":if(x)return;y=!0,b.r=t.r&&0|t.r||0|t||0,b.r<0?b.r=0:b.r>255&&(b.r=255),i!==b.r&&(i=b.r,v=!0);break;case"g":if(x)return;y=!0,b.g=t&&t.g&&0|t.g||t&&0|t||0,b.g<0?b.g=0:b.g>255&&(b.g=255),o!==b.g&&(o=b.g,v=!0);break;case"b":if(x)return;y=!0,b.b=t&&t.b&&0|t.b||t&&0|t||0,b.b<0?b.b=0:b.b>255&&(b.b=255),l!==b.b&&(l=b.b,v=!0);break;case"a":b.a=t&&!isNullish$1(t.a)?0|t.a:0|t,b.a<0?b.a=0:b.a>255&&(b.a=255),c!==b.a&&(c=b.a,v=!0);break;case"h":if(y)return;x=!0,b.h=t&&t.h&&0|t.h||t&&0|t||0,b.h<0?b.h=0:b.h>360&&(b.h=360),u!==b.h&&(u=b.h,v=!0);break;case"s":if(y)return;x=!0,b.s=isNullish$1(t.s)?0|t:0|t.s,b.s<0?b.s=0:b.s>100&&(b.s=100),d!==b.s&&(d=b.s,v=!0);break;case"v":if(y)return;x=!0,b.v=isNullish$1(t.v)?0|t:0|t.v,b.v<0?b.v=0:b.v>100&&(b.v=100),h!==b.v&&(h=b.v,v=!0)}}),v){if(y){i=i||0,o=o||0,l=l||0;var C=s.rgbToHsv({r:i,g:o,b:l});u=C.h,d=C.s,h=C.v}else if(x){u=u||0,d=isNullish$1(d)?100:d,h=isNullish$1(h)?100:h;var S=s.hsvToRgb({h:u,s:d,v:h});i=S.r,o=S.g,l=S.b}c=isNullish$1(c)?255:c,r.call(n,p||n)}}}}var i,o,l,c,u,d,h,p=[];e.extend(!0,n,{val:a,bind:function(e){"function"==typeof e&&p.push(e)},unbind:function(e){if("function"==typeof e)for(var t;t=p.includes(e);)p.splice(t,1)},destroy:function(){p=null}}),t&&(isNullish$1(t.ahex)?isNullish$1(t.hex)?isNullish$1(t.r)||isNullish$1(t.g)||isNullish$1(t.b)?isNullish$1(t.h)||isNullish$1(t.s)||isNullish$1(t.v)||a("hsv"+(isNullish$1(t.a)?"":"a"),t):a("rgb"+(isNullish$1(t.a)?"":"a"),t):a((isNullish$1(t.a)?"":"a")+"hex",isNullish$1(t.a)?t:{ahex:t.hex+s.intToHex(t.a)}):a("ahex",t))},ColorMethods:{hexToRgba:function(e){if(""===e||"none"===e)return{r:null,g:null,b:null,a:null};var t="00",n="00",r="00",a="255";return 6===(e=this.validateHex(e)).length&&(e+="ff"),e.length>6?(t=e.substring(0,2),n=e.substring(2,4),r=e.substring(4,6),a=e.substring(6,e.length)):(e.length>4&&(t=e.substring(4,e.length),e=e.substring(0,4)),e.length>2&&(n=e.substring(2,e.length),e=e.substring(0,2)),e.length>0&&(r=e.substring(0,e.length))),{r:this.hexToInt(t),g:this.hexToInt(n),b:this.hexToInt(r),a:this.hexToInt(a)}},validateHex:function(e){return(e=e.toLowerCase().replace(/[^a-f0-9]/g,"")).length>8&&(e=e.substring(0,8)),e},rgbaToHex:function(e){return this.intToHex(e.r)+this.intToHex(e.g)+this.intToHex(e.b)+this.intToHex(e.a)},intToHex:function(e){var t=(0|e).toString(16);return 1===t.length&&(t="0"+t),t.toLowerCase()},hexToInt:function(e){return parseInt(e,16)},rgbToHsv:function(e){var t,n=e.r/255,r=e.g/255,a=e.b/255,i={h:0,s:0,v:0},s=0,o=0;return n>=r&&n>=a?(o=n,s=r>a?a:r):r>=a&&r>=n?(o=r,s=n>a?a:n):(o=a,s=r>n?n:r),i.v=o,i.s=o?(o-s)/o:0,i.s?(t=o-s,i.h=n===o?(r-a)/t:r===o?2+(a-n)/t:4+(n-r)/t,i.h=parseInt(60*i.h),i.h<0&&(i.h+=360)):i.h=0,i.s=100*i.s|0,i.v=100*i.v|0,i},hsvToRgb:function(e){var t={r:0,g:0,b:0,a:100},n=e.h,r=e.s,a=e.v;if(0===r)t.r=t.g=t.b=0===a?0:255*a/100|0;else{360===n&&(n=0);var i=0|(n/=60),s=n-i,o=(a/=100)*(1-(r/=100)),l=a*(1-r*s),c=a*(1-r*(1-s));switch(i){case 0:t.r=a,t.g=c,t.b=o;break;case 1:t.r=l,t.g=a,t.b=o;break;case 2:t.r=o,t.g=a,t.b=c;break;case 3:t.r=o,t.g=l,t.b=a;break;case 4:t.r=c,t.g=o,t.b=a;break;case 5:t.r=a,t.g=o,t.b=l}t.r=255*t.r|0,t.g=255*t.g|0,t.b=255*t.b|0}return t}}};var r=e.jPicker,a=r.Color,i=r.List,s=r.ColorMethods;return e.fn.jPicker=function(r,o,l,c){return this.each(function(){var u=this,d=e.extend(!0,{},e.fn.jPicker.defaults,r);"input"===e(u).get(0).nodeName.toLowerCase()&&(e.extend(!0,d,{window:{bindToInput:!0,expandable:!0,input:e(u)}}),""===e(u).val()?(d.color.active=new a({hex:null}),d.color.current=new a({hex:null})):s.validateHex(e(u).val())&&(d.color.active=new a({hex:e(u).val(),a:d.color.active.val("a")}),d.color.current=new a({hex:e(u).val(),a:d.color.active.val("a")}))),d.window.expandable?e(u).after('<span class="jPicker"><span class="Icon"><span class="Color"> </span><span class="Alpha"> </span><span class="Image" title="Click To Open Color Picker"> </span><span class="Container"> </span></span></span>'):d.window.liveUpdate=!1;var h=parseFloat(navigator.appVersion.split("MSIE")[1])<7&&document.body.filters;function p(e){var t,n,r=O.active,a=r.val("hex");switch(d.color.mode=e,e){case"h":if(setTimeout(function(){v.call(u,U,"transparent"),b.call(u,z,0),y.call(u,z,100),b.call(u,q,260),y.call(u,q,100),v.call(u,H,"transparent"),b.call(u,Y,0),y.call(u,Y,100),b.call(u,X,260),y.call(u,X,100),b.call(u,Q,260),y.call(u,Q,100),b.call(u,K,260),y.call(u,K,100),b.call(u,J,260),y.call(u,J,100)},0),ee.range("all",{minX:0,maxX:100,minY:0,maxY:100}),te.range("rangeY",{minY:0,maxY:360}),isNullish$1(r.val("ahex")))break;ee.val("xy",{x:r.val("s"),y:100-r.val("v")},ee),te.val("y",360-r.val("h"),te);break;case"s":if(setTimeout(function(){v.call(u,U,"transparent"),b.call(u,z,-260),b.call(u,q,-520),b.call(u,Y,-260),b.call(u,X,-520),b.call(u,J,260),y.call(u,J,100)},0),ee.range("all",{minX:0,maxX:360,minY:0,maxY:100}),te.range("rangeY",{minY:0,maxY:100}),isNullish$1(r.val("ahex")))break;ee.val("xy",{x:r.val("h"),y:100-r.val("v")},ee),te.val("y",100-r.val("s"),te);break;case"v":if(setTimeout(function(){v.call(u,U,"000000"),b.call(u,z,-780),b.call(u,q,260),v.call(u,H,a),b.call(u,Y,-520),b.call(u,X,260),y.call(u,X,100),b.call(u,J,260),y.call(u,J,100)},0),ee.range("all",{minX:0,maxX:360,minY:0,maxY:100}),te.range("rangeY",{minY:0,maxY:100}),isNullish$1(r.val("ahex")))break;ee.val("xy",{x:r.val("h"),y:100-r.val("s")},ee),te.val("y",100-r.val("v"),te);break;case"r":if(t=-1040,n=-780,ee.range("all",{minX:0,maxX:255,minY:0,maxY:255}),te.range("rangeY",{minY:0,maxY:255}),isNullish$1(r.val("ahex")))break;ee.val("xy",{x:r.val("b"),y:255-r.val("g")},ee),te.val("y",255-r.val("r"),te);break;case"g":if(t=-1560,n=-1820,ee.range("all",{minX:0,maxX:255,minY:0,maxY:255}),te.range("rangeY",{minY:0,maxY:255}),isNullish$1(r.val("ahex")))break;ee.val("xy",{x:r.val("b"),y:255-r.val("r")},ee),te.val("y",255-r.val("g"),te);break;case"b":if(t=-2080,n=-2860,ee.range("all",{minX:0,maxX:255,minY:0,maxY:255}),te.range("rangeY",{minY:0,maxY:255}),isNullish$1(r.val("ahex")))break;ee.val("xy",{x:r.val("r"),y:255-r.val("g")},ee),te.val("y",255-r.val("b"),te);break;case"a":if(setTimeout(function(){v.call(u,U,"transparent"),b.call(u,z,-260),b.call(u,q,-520),b.call(u,Y,260),b.call(u,X,260),y.call(u,X,100),b.call(u,J,0),y.call(u,J,100)},0),ee.range("all",{minX:0,maxX:360,minY:0,maxY:100}),te.range("rangeY",{minY:0,maxY:255}),isNullish$1(r.val("ahex")))break;ee.val("xy",{x:r.val("h"),y:100-r.val("v")},ee),te.val("y",255-r.val("a"),te);break;default:throw new Error("Invalid Mode")}switch(e){case"h":break;case"s":case"v":case"a":setTimeout(function(){y.call(u,z,100),y.call(u,Y,100),b.call(u,Q,260),y.call(u,Q,100),b.call(u,K,260),y.call(u,K,100)},0);break;case"r":case"g":case"b":setTimeout(function(){v.call(u,U,"transparent"),v.call(u,H,"transparent"),y.call(u,Y,100),y.call(u,z,100),b.call(u,z,t),b.call(u,q,t-260),b.call(u,Y,n-780),b.call(u,X,n-520),b.call(u,Q,n),b.call(u,K,n-260),b.call(u,J,260),y.call(u,J,100)},0)}isNullish$1(r.val("ahex"))||g.call(u,r)}function g(e,t){(isNullish$1(t)||t!==te&&t!==ee)&&function(e,t){if(t!==ee)switch(d.color.mode){case"h":var n=e.val("sv");ee.val("xy",{x:isNullish$1(n)?100:n.s,y:100-(isNullish$1(n)?100:n.v)},t);break;case"s":case"a":var r=e.val("hv");ee.val("xy",{x:r&&r.h||0,y:100-(isNullish$1(r)?100:r.v)},t);break;case"v":var a=e.val("hs");ee.val("xy",{x:a&&a.h||0,y:100-(isNullish$1(a)?100:a.s)},t);break;case"r":var i=e.val("bg");ee.val("xy",{x:i&&i.b||0,y:255-(i&&i.g||0)},t);break;case"g":var s=e.val("br");ee.val("xy",{x:s&&s.b||0,y:255-(s&&s.r||0)},t);break;case"b":var o=e.val("rg");ee.val("xy",{x:o&&o.r||0,y:255-(o&&o.g||0)},t)}if(t!==te)switch(d.color.mode){case"h":te.val("y",360-(e.val("h")||0),t);break;case"s":var l=e.val("s");te.val("y",100-(isNullish$1(l)?100:l),t);break;case"v":var c=e.val("v");te.val("y",100-(isNullish$1(c)?100:c),t);break;case"r":te.val("y",255-(e.val("r")||0),t);break;case"g":te.val("y",255-(e.val("g")||0),t);break;case"b":te.val("y",255-(e.val("b")||0),t);break;case"a":var u=e.val("a");te.val("y",255-(isNullish$1(u)?255:u),t)}}.call(u,e,t),setTimeout(function(){(function(e){try{var t=e.val("all");re.css({backgroundColor:t&&"#"+t.hex||"transparent"}),y.call(u,re,t&&toFixedNumeric(100*t.a/255,4)||0)}catch(e){}}).call(u,e),function(e){switch(d.color.mode){case"h":v.call(u,U,new a({h:e.val("h")||0,s:100,v:100}).val("hex"));break;case"s":case"a":var t=e.val("s");y.call(u,q,100-(isNullish$1(t)?100:t));break;case"v":var n=e.val("v");y.call(u,z,isNullish$1(n)?100:n);break;case"r":y.call(u,q,toFixedNumeric((e.val("r")||0)/255*100,4));break;case"g":y.call(u,q,toFixedNumeric((e.val("g")||0)/255*100,4));break;case"b":y.call(u,q,toFixedNumeric((e.val("b")||0)/255*100))}var r=e.val("a");y.call(u,W,toFixedNumeric(100*(255-(r||0))/255,4))}.call(u,e),function(e){switch(d.color.mode){case"h":var t=e.val("a");y.call(u,Z,toFixedNumeric(100*(255-(t||0))/255,4));break;case"s":var n=e.val("hva"),r=new a({h:n&&n.h||0,s:100,v:isNullish$1(n)?100:n.v});v.call(u,H,r.val("hex")),y.call(u,X,100-(isNullish$1(n)?100:n.v)),y.call(u,Z,toFixedNumeric(100*(255-(n&&n.a||0))/255,4));break;case"v":var i=e.val("hsa"),s=new a({h:i&&i.h||0,s:isNullish$1(i)?100:i.s,v:100});v.call(u,H,s.val("hex")),y.call(u,Z,toFixedNumeric(100*(255-(i&&i.a||0))/255,4));break;case"r":case"g":case"b":var o=e.val("rgba"),l=0,c=0;"r"===d.color.mode?(l=o&&o.b||0,c=o&&o.g||0):"g"===d.color.mode?(l=o&&o.b||0,c=o&&o.r||0):"b"===d.color.mode&&(l=o&&o.r||0,c=o&&o.g||0);var h=c>l?l:c;y.call(u,X,l>c?toFixedNumeric((l-c)/(255-c)*100,4):0),y.call(u,Q,c>l?toFixedNumeric((c-l)/(255-l)*100,4):0),y.call(u,K,toFixedNumeric(h/255*100,4)),y.call(u,Z,toFixedNumeric(100*(255-(o&&o.a||0))/255,4));break;case"a":var p=e.val("a");v.call(u,H,e.val("hex")||"000000"),y.call(u,Z,isNullish$1(p)?100:0),y.call(u,J,isNullish$1(p)?0:100)}}.call(u,e)},0)}function f(e,t){var n=O.active;if(t===ee||!isNullish$1(n.val())){var r=e.val("all");switch(d.color.mode){case"h":n.val("sv",{s:r.x,v:100-r.y},t);break;case"s":case"a":n.val("hv",{h:r.x,v:100-r.y},t);break;case"v":n.val("hs",{h:r.x,s:100-r.y},t);break;case"r":n.val("gb",{g:255-r.y,b:r.x},t);break;case"g":n.val("rb",{r:255-r.y,b:r.x},t);break;case"b":n.val("rg",{r:r.x,g:255-r.y},t)}}}function m(e,t){var n=O.active;if(t===te||!isNullish$1(n.val()))switch(d.color.mode){case"h":n.val("h",{h:360-e.val("y")},t);break;case"s":n.val("s",{s:100-e.val("y")},t);break;case"v":n.val("v",{v:100-e.val("y")},t);break;case"r":n.val("r",{r:255-e.val("y")},t);break;case"g":n.val("g",{g:255-e.val("y")},t);break;case"b":n.val("b",{b:255-e.val("y")},t);break;case"a":n.val("a",255-e.val("y"),t)}}function v(e,t){e.css({backgroundColor:t&&6===t.length&&"#"+t||"transparent"})}function _(e,t){h&&(t.includes("AlphaBar.png")||t.includes("Bars.png")||t.includes("Maps.png"))?(e.attr("pngSrc",t),e.css({backgroundImage:"none",filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+t+"', sizingMethod='scale')"})):e.css({backgroundImage:"url('"+t+"')"})}function b(e,t){e.css({top:t+"px"})}function y(e,t){if(e.css({visibility:t>0?"visible":"hidden"}),t>0&&t<100)if(h){var n=e.attr("pngSrc");!isNullish$1(n)&&(n.includes("AlphaBar.png")||n.includes("Bars.png")||n.includes("Maps.png"))?e.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+n+"', sizingMethod='scale') progid:DXImageTransform.Microsoft.Alpha(opacity="+t+")"}):e.css({opacity:toFixedNumeric(t/100,4)})}else e.css({opacity:toFixedNumeric(t/100,4)});else if(0===t||100===t)if(h){var r=e.attr("pngSrc");!isNullish$1(r)&&(r.includes("AlphaBar.png")||r.includes("Bars.png")||r.includes("Maps.png"))?e.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+r+"', sizingMethod='scale')"}):e.css({opacity:""})}else e.css({opacity:""})}function x(){O.active.val("ahex",O.current.val("ahex"))}function C(t){e(this).parents("tbody:first").find('input:radio[value!="'+t.target.value+'"]').removeAttr("checked"),p.call(u,t.target.value)}function S(){x.call(u)}function w(){x.call(u),d.window.expandable&&I.call(u),"function"==typeof c&&c.call(u,O.active,se)}function $(){(function(){O.current.val("ahex",O.active.val("ahex"))}).call(u),d.window.expandable&&I.call(u),"function"==typeof o&&o.call(u,O.active,ie)}function k(){L.call(u)}function A(e){var t=e.val("hex");ae.css({backgroundColor:t&&"#"+t||"transparent"}),y.call(u,ae,toFixedNumeric(100*(e.val("a")||0)/255,4))}function E(e){var t=e.val("hex"),n=e.val("va");le.css({backgroundColor:t&&"#"+t||"transparent"}),y.call(u,ce,toFixedNumeric(100*(255-(n&&n.a||0))/255,4)),d.window.bindToInput&&d.window.updateInputColor&&d.window.input.css({backgroundColor:t&&"#"+t||"transparent",color:isNullish$1(n)||n.v>75?"#000000":"#ffffff"})}function N(t){B=parseInt(D.css("left")),V=parseInt(D.css("top")),j=t.pageX,F=t.pageY,e(document).bind("mousemove",T).bind("mouseup",P),t.preventDefault()}function T(t){return D.css({left:B-(j-t.pageX)+"px",top:V-(F-t.pageY)+"px"}),d.window.expandable&&!e.support.boxModel&&D.prev().css({left:D.css("left"),top:D.css("top")}),t.stopPropagation(),t.preventDefault(),!1}function P(t){return e(document).unbind("mousemove",T).unbind("mouseup",P),t.stopPropagation(),t.preventDefault(),!1}function G(t){return t.preventDefault(),t.stopPropagation(),O.active.val("ahex",e(this).attr("title")||null,t.target),!1}function L(){function t(){if(d.window.expandable&&!e.support.boxModel){var t=D.find("table:first");D.before("<iframe/>"),D.prev().css({width:t.width(),height:D.height(),opacity:0,position:"absolute",left:D.css("left"),top:D.css("top")})}}switch(O.current.val("ahex",O.active.val("ahex")),d.window.expandable&&(e(document.body).children("div.jPicker.Container").css({zIndex:10}),D.css({zIndex:20})),d.window.effects.type){case"fade":D.fadeIn(d.window.effects.speed.show,t);break;case"slide":D.slideDown(d.window.effects.speed.show,t);break;case"show":default:D.show(d.window.effects.speed.show,t)}}function I(){function t(){d.window.expandable&&D.css({zIndex:10}),d.window.expandable&&!e.support.boxModel&&D.prev().remove()}switch(d.window.effects.type){case"fade":D.fadeOut(d.window.effects.speed.hide,t);break;case"slide":D.slideUp(d.window.effects.speed.hide,t);break;case"show":default:D.hide(d.window.effects.speed.hide,t)}}var M=d.images,R=d.localization,O={active:"string"===_typeof(d.color.active).toString().toLowerCase()?new a({ahex:!d.window.alphaSupport&&d.color.active?d.color.active.substring(0,6)+"ff":d.color.active}):new a({ahex:!d.window.alphaSupport&&d.color.active.val("ahex")?d.color.active.val("ahex").substring(0,6)+"ff":d.color.active.val("ahex")}),current:"string"===_typeof(d.color.active).toString().toLowerCase()?new a({ahex:!d.window.alphaSupport&&d.color.active?d.color.active.substring(0,6)+"ff":d.color.active}):new a({ahex:!d.window.alphaSupport&&d.color.active.val("ahex")?d.color.active.val("ahex").substring(0,6)+"ff":d.color.active.val("ahex")}),quickList:d.color.quickList};"function"!=typeof o&&(o=null),"function"!=typeof l&&(l=null),"function"!=typeof c&&(c=null);var B=null,V=null,j=null,F=null,D=null,U=null,H=null,z=null,q=null,W=null,Y=null,X=null,Q=null,K=null,Z=null,J=null,ee=null,te=null,ne=null,re=null,ae=null,ie=null,se=null,oe=null,le=null,ce=null,ue=null,de=null;e.extend(!0,u,{commitCallback:o,liveCallback:l,cancelCallback:c,color:O,show:L,hide:I,destroy:function(){D.find("td.Radio input").unbind("click",C),ae.unbind("click",S),se.unbind("click",w),ie.unbind("click",$),d.window.expandable&&(ue.unbind("click",k),de.unbind("mousedown",N),u.icon=null),D.find(".QuickColor").unbind("click",G),U=null,H=null,z=null,q=null,W=null,Y=null,X=null,Q=null,K=null,Z=null,J=null,ee.destroy(),ee=null,te.destroy(),te=null,ne.destroy(),ne=null,re=null,ae=null,ie=null,se=null,oe=null,o=null,c=null,l=null,D.html("");for(var e=0;e<i.length;e++)i[e]===u&&i.splice(e,1)}}),i.push(u),setTimeout(function(){(function(){var r=d.window,i=r.expandable?e(u).next().find(".Container:first"):null;(D=r.expandable?e("<div/>"):e(u)).addClass("jPicker Container"),r.expandable&&D.hide(),D.get(0).onselectstart=function(e){return"input"===e.target.nodeName.toLowerCase()};var s=O.active.val("all");r.alphaPrecision<0?r.alphaPrecision=0:r.alphaPrecision>2&&(r.alphaPrecision=2);var o='<table class="jPicker" cellpadding="0" cellspacing="0">\n <tbody>\n '.concat(r.expandable?'<tr><td class="Move" colspan="5"> </td></tr>':"",'\n <tr>\n <td rowspan="9"><h2 class="Title">').concat(r.title||R.text.title,'</h2><div class="Map"><span class="Map1"> </span><span class="Map2"> </span><span class="Map3"> </span><img src="').concat(M.clientPath+M.colorMap.arrow.file,'" class="Arrow"/></div></td>\n <td rowspan="9"><div class="Bar"><span class="Map1"> </span><span class="Map2"> </span><span class="Map3"> </span><span class="Map4"> </span><span class="Map5"> </span><span class="Map6"> </span><img src="').concat(M.clientPath+M.colorBar.arrow.file,'" class="Arrow"/></div></td>\n <td colspan="2" class="Preview">').concat(R.text.newColor,'<div><span class="Active" title="').concat(R.tooltips.colors.newColor,'"> </span><span class="Current" title="').concat(R.tooltips.colors.currentColor,'"> </span></div>').concat(R.text.currentColor,'</td>\n <td rowspan="9" class="Button"><input type="button" class="Ok" value="').concat(R.text.ok,'" title="').concat(R.tooltips.buttons.ok,'"/><input type="button" class="Cancel" value="').concat(R.text.cancel,'" title="').concat(R.tooltips.buttons.cancel,'"/><hr/><div class="Grid"> </div></td>\n </tr>\n <tr class="Hue">\n <td class="Radio"><label title="').concat(R.tooltips.hue.radio,'"><input type="radio" value="h"').concat("h"===d.color.mode?' checked="checked"':"",'/>H:</label></td>\n <td class="Text"><input type="text" maxlength="3" value="').concat(isNullish$1(s)?"":s.h,'" title="').concat(R.tooltips.hue.textbox,'"/> °</td>\n </tr>\n <tr class="Saturation">\n <td class="Radio"><label title="').concat(R.tooltips.saturation.radio,'"><input type="radio" value="s"').concat("s"===d.color.mode?' checked="checked"':"",'/>S:</label></td>\n <td class="Text"><input type="text" maxlength="3" value="').concat(isNullish$1(s)?"":s.s,'" title="').concat(R.tooltips.saturation.textbox,'"/> %</td>\n </tr>\n <tr class="Value">\n <td class="Radio"><label title="').concat(R.tooltips.value.radio,'"><input type="radio" value="v"').concat("v"===d.color.mode?' checked="checked"':"",'/>V:</label><br/><br/></td>\n <td class="Text"><input type="text" maxlength="3" value="').concat(isNullish$1(s)?"":s.v,'" title="').concat(R.tooltips.value.textbox,'"/> %<br/><br/></td>\n </tr>\n <tr class="Red">\n <td class="Radio"><label title="').concat(R.tooltips.red.radio,'"><input type="radio" value="r"').concat("r"===d.color.mode?' checked="checked"':"",'/>R:</label></td>\n <td class="Text"><input type="text" maxlength="3" value="').concat(isNullish$1(s)?"":s.r,'" title="').concat(R.tooltips.red.textbox,'"/></td>\n </tr>\n <tr class="Green">\n <td class="Radio"><label title="').concat(R.tooltips.green.radio,'"><input type="radio" value="g"').concat("g"===d.color.mode?' checked="checked"':"",'/>G:</label></td>\n <td class="Text"><input type="text" maxlength="3" value="').concat(isNullish$1(s)?"":s.g,'" title="').concat(R.tooltips.green.textbox,'"/></td>\n </tr>\n <tr class="Blue">\n <td class="Radio"><label title="').concat(R.tooltips.blue.radio,'"><input type="radio" value="b"').concat("b"===d.color.mode?' checked="checked"':"",'/>B:</label></td>\n <td class="Text"><input type="text" maxlength="3" value="').concat(isNullish$1(s)?"":s.b,'" title="').concat(R.tooltips.blue.textbox,'"/></td>\n </tr>\n <tr class="Alpha">\n <td class="Radio">').concat(r.alphaSupport?'<label title="'.concat(R.tooltips.alpha.radio,'"><input type="radio" value="a"').concat("a"===d.color.mode?' checked="checked"':"","/>A:</label>"):" ",'</td>\n <td class="Text">').concat(r.alphaSupport?'<input type="text" maxlength="'.concat(3+r.alphaPrecision,'" value="').concat(isNullish$1(s)?"":toFixedNumeric(100*s.a/255,r.alphaPrecision),'" title="').concat(R.tooltips.alpha.textbox,'"/> %'):" ",'</td>\n </tr>\n <tr class="Hex">\n <td colspan="2" class="Text"><label title="').concat(R.tooltips.hex.textbox,'">#:<input type="text" maxlength="6" class="Hex" value="').concat(isNullish$1(s)?"":s.hex,'"/></label>').concat(r.alphaSupport?'<input type="text" maxlength="2" class="AHex" value="'.concat(isNullish$1(s)?"":s.ahex.substring(6),'" title="').concat(R.tooltips.hex.alpha,'"/></td>'):" ","\n </tr>\n </tbody></table>");r.expandable?(D.html(o),e(document.body).children("div.jPicker.Container").length?e(document.body).children("div.jPicker.Container:last").after(D):e(document.body).prepend(D),D.mousedown(function(){e(document.body).children("div.jPicker.Container").css({zIndex:10}),D.css({zIndex:20})}),D.css({left:"left"===r.position.x?i.offset().left-530-("center"===r.position.y?25:0)+"px":"center"===r.position.x?i.offset().left-260+"px":"right"===r.position.x?i.offset().left-10+("center"===r.position.y?25:0)+"px":"screenCenter"===r.position.x?(e(document).width()>>1)-260+"px":i.offset().left+parseInt(r.position.x)+"px",position:"absolute",top:"top"===r.position.y?i.offset().top-312+"px":"center"===r.position.y?i.offset().top-156+"px":"bottom"===r.position.y?i.offset().top+25+"px":i.offset().top+parseInt(r.position.y)+"px"})):(D=e(u)).html(o);var c=D.find("tbody:first");U=c.find("div.Map:first"),H=c.find("div.Bar:first");var h=U.find("span"),v=H.find("span");z=h.filter(".Map1:first"),q=h.filter(".Map2:first"),W=h.filter(".Map3:first"),Y=v.filter(".Map1:first"),X=v.filter(".Map2:first"),Q=v.filter(".Map3:first"),K=v.filter(".Map4:first"),Z=v.filter(".Map5:first"),J=v.filter(".Map6:first"),(ee=new t(U,{map:{width:M.colorMap.width,height:M.colorMap.height},arrow:{image:M.clientPath+M.colorMap.arrow.file,width:M.colorMap.arrow.width,height:M.colorMap.arrow.height}})).bind(f),(te=new t(H,{map:{width:M.colorBar.width,height:M.colorBar.height},arrow:{image:M.clientPath+M.colorBar.arrow.file,width:M.colorBar.arrow.width,height:M.colorBar.arrow.height}})).bind(m),ne=new n(c,O.active,r.expandable&&r.bindToInput?r.input:null,r.alphaPrecision);var b=isNullish$1(s)?null:s.hex,x=c.find(".Preview"),T=c.find(".Button");if(re=x.find(".Active:first").css({backgroundColor:b&&"#"+b||"transparent"}),ae=x.find(".Current:first").css({backgroundColor:b&&"#"+b||"transparent"}).bind("click",S),y.call(u,ae,toFixedNumeric(100*O.current.val("a")/255,4)),ie=T.find(".Ok:first").bind("click",$),se=T.find(".Cancel:first").bind("click",w),oe=T.find(".Grid:first"),setTimeout(function(){_.call(u,z,M.clientPath+"Maps.png"),_.call(u,q,M.clientPath+"Maps.png"),_.call(u,W,M.clientPath+"map-opacity.png"),_.call(u,Y,M.clientPath+"Bars.png"),_.call(u,X,M.clientPath+"Bars.png"),_.call(u,Q,M.clientPath+"Bars.png"),_.call(u,K,M.clientPath+"Bars.png"),_.call(u,Z,M.clientPath+"bar-opacity.png"),_.call(u,J,M.clientPath+"AlphaBar.png"),_.call(u,x.find("div:first"),M.clientPath+"preview-opacity.png")},0),c.find("td.Radio input").bind("click",C),O.quickList&&O.quickList.length>0){for(var P="",I=0;I<O.quickList.length;I++){"string"===_typeof(O.quickList[I]).toString().toLowerCase()&&(O.quickList[I]=new a({hex:O.quickList[I]}));var B=O.quickList[I].val("a"),V=O.quickList[I].val("ahex");!r.alphaSupport&&V&&(V=V.substring(0,6)+"ff");var j=O.quickList[I].val("hex");V||(V="00000000"),P+='<span class="QuickColor" title="#'+V+'" style="background-color:'+(j&&"#"+j||"")+";"+(j?"":"background-image:url("+M.clientPath+"NoColor.png)")+(r.alphaSupport&&B&&B<255?";opacity:"+toFixedNumeric(B/255,4)+";filter:Alpha(opacity="+toFixedNumeric(B/2.55,4)+")":"")+'"> </span>'}_.call(u,oe,M.clientPath+"bar-opacity.png"),oe.html(P),oe.find(".QuickColor").click(G)}p.call(u,d.color.mode),O.active.bind(g),"function"==typeof l&&O.active.bind(l),O.current.bind(A),r.expandable?(u.icon=i.parents(".Icon:first"),le=u.icon.find(".Color:first").css({backgroundColor:b&&"#"+b||"transparent"}),ce=u.icon.find(".Alpha:first"),_.call(u,ce,M.clientPath+"bar-opacity.png"),y.call(u,ce,toFixedNumeric(100*(255-(isNullish$1(s)?0:s.a))/255,4)),ue=u.icon.find(".Image:first").css({backgroundImage:"url('"+M.clientPath+M.picker.file+"')"}).bind("click",k),r.bindToInput&&r.updateInputColor&&r.input.css({backgroundColor:b&&"#"+b||"transparent",color:isNullish$1(s)||s.v>75?"#000000":"#ffffff"}),de=c.find(".Move:first").bind("mousedown",N),O.active.bind(E)):L.call(u)}).call(u)},0)})},e.fn.jPicker.defaults={window:{title:null,effects:{type:"slide",speed:{show:"slow",hide:"fast"}},position:{x:"screenCenter",y:"top"},expandable:!1,liveUpdate:!0,alphaSupport:!1,alphaPrecision:0,updateInputColor:!0},color:{mode:"h",active:new a({ahex:"#ffcc00ff"}),quickList:[new a({h:360,s:33,v:100}),new a({h:360,s:66,v:100}),new a({h:360,s:100,v:100}),new a({h:360,s:100,v:75}),new a({h:360,s:100,v:50}),new a({h:180,s:0,v:100}),new a({h:30,s:33,v:100}),new a({h:30,s:66,v:100}),new a({h:30,s:100,v:100}),new a({h:30,s:100,v:75}),new a({h:30,s:100,v:50}),new a({h:180,s:0,v:90}),new a({h:60,s:33,v:100}),new a({h:60,s:66,v:100}),new a({h:60,s:100,v:100}),new a({h:60,s:100,v:75}),new a({h:60,s:100,v:50}),new a({h:180,s:0,v:80}),new a({h:90,s:33,v:100}),new a({h:90,s:66,v:100}),new a({h:90,s:100,v:100}),new a({h:90,s:100,v:75}),new a({h:90,s:100,v:50}),new a({h:180,s:0,v:70}),new a({h:120,s:33,v:100}),new a({h:120,s:66,v:100}),new a({h:120,s:100,v:100}),new a({h:120,s:100,v:75}),new a({h:120,s:100,v:50}),new a({h:180,s:0,v:60}),new a({h:150,s:33,v:100}),new a({h:150,s:66,v:100}),new a({h:150,s:100,v:100}),new a({h:150,s:100,v:75}),new a({h:150,s:100,v:50}),new a({h:180,s:0,v:50}),new a({h:180,s:33,v:100}),new a({h:180,s:66,v:100}),new a({h:180,s:100,v:100}),new a({h:180,s:100,v:75}),new a({h:180,s:100,v:50}),new a({h:180,s:0,v:40}),new a({h:210,s:33,v:100}),new a({h:210,s:66,v:100}),new a({h:210,s:100,v:100}),new a({h:210,s:100,v:75}),new a({h:210,s:100,v:50}),new a({h:180,s:0,v:30}),new a({h:240,s:33,v:100}),new a({h:240,s:66,v:100}),new a({h:240,s:100,v:100}),new a({h:240,s:100,v:75}),new a({h:240,s:100,v:50}),new a({h:180,s:0,v:20}),new a({h:270,s:33,v:100}),new a({h:270,s:66,v:100}),new a({h:270,s:100,v:100}),new a({h:270,s:100,v:75}),new a({h:270,s:100,v:50}),new a({h:180,s:0,v:10}),new a({h:300,s:33,v:100}),new a({h:300,s:66,v:100}),new a({h:300,s:100,v:100}),new a({h:300,s:100,v:75}),new a({h:300,s:100,v:50}),new a({h:180,s:0,v:0}),new a({h:330,s:33,v:100}),new a({h:330,s:66,v:100}),new a({h:330,s:100,v:100}),new a({h:330,s:100,v:75}),new a({h:330,s:100,v:50}),new a]},images:{clientPath:"/jPicker/images/",colorMap:{width:256,height:256,arrow:{file:"mappoint.gif",width:15,height:15}},colorBar:{width:20,height:256,arrow:{file:"rangearrows.gif",width:20,height:7}},picker:{file:"picker.gif",width:25,height:24}},localization:{text:{title:"Drag Markers To Pick A Color",newColor:"new",currentColor:"current",ok:"OK",cancel:"Cancel"},tooltips:{colors:{newColor:"New Color - Press “OK” To Commit",currentColor:"Click To Revert To Original Color"},buttons:{ok:"Commit To This Color Selection",cancel:"Cancel And Revert To Original Color"},hue:{radio:"Set To “Hue” Color Mode",textbox:"Enter A “Hue” Value (0-360°)"},saturation:{radio:"Set To “Saturation” Color Mode",textbox:"Enter A “Saturation” Value (0-100%)"},value:{radio:"Set To “Value” Color Mode",textbox:"Enter A “Value” Value (0-100%)"},red:{radio:"Set To “Red” Color Mode",textbox:"Enter A “Red” Value (0-255)"},green:{radio:"Set To “Green” Color Mode",textbox:"Enter A “Green” Value (0-255)"},blue:{radio:"Set To “Blue” Color Mode",textbox:"Enter A “Blue” Value (0-255)"},alpha:{radio:"Set To “Alpha” Color Mode",textbox:"Enter A “Alpha” Value (0-100)"},hex:{textbox:"Enter A “Hex” Color Value (#000000-#ffffff)",alpha:"Enter A “Alpha” Value (#00-#ff)"}}}},e},$$a=jQuery,setStrings=function(e,t,n){var r=$$a("#svg_editor").parent();Object.entries(t).forEach(function(t){var a=_slicedToArray(t,2),i=a[0],s=a[1];if(s||console.log(i),n&&(i="#"+i),r.find(i).length){var o=r.find(i)[0];switch(e){case"content":_toConsumableArray(o.childNodes).some(function(e){return!(3!==e.nodeType||!e.textContent.trim())&&(e.textContent=s,!0)});break;case"title":o.title=s}}else console.log("Missing element for localization: "+i)})},init$7=function(e){editor_=e},readLang=function(){var e=_asyncToGenerator(regeneratorRuntime.mark(function e(t){var n,r,a,i,s,o,l,c,u;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,editor_.addLangData(langParam);case 2:if(n=e.sent,$$a.each(n,function(e,n){n.data&&(t=$$a.merge(t,n.data))}),t.tools){e.next=6;break}return e.abrupt("return",void 0);case 6:return a=(r=t).tools,i=r.properties,s=r.config,o=r.layers,l=r.common,c=r.ui,setStrings("content",{curve_segments:i.curve_segments,fitToContent:a.fitToContent,fit_to_all:a.fit_to_all,fit_to_canvas:a.fit_to_canvas,fit_to_layer_content:a.fit_to_layer_content,fit_to_sel:a.fit_to_sel,icon_large:s.icon_large,icon_medium:s.icon_medium,icon_small:s.icon_small,icon_xlarge:s.icon_xlarge,image_opt_embed:s.image_opt_embed,image_opt_ref:s.image_opt_ref,includedImages:s.included_images,largest_object:a.largest_object,layersLabel:o.layers,page:a.page,relativeToLabel:a.relativeTo,selLayerLabel:o.move_elems_to,selectedPredefined:s.select_predefined,selected_objects:a.selected_objects,smallest_object:a.smallest_object,straight_segments:i.straight_segments,svginfo_bg_url:s.editor_img_url+":",svginfo_bg_note:s.editor_bg_note,svginfo_change_background:s.background,svginfo_dim:s.doc_dims,svginfo_editor_prefs:s.editor_prefs,svginfo_height:l.height,svginfo_icons:s.icon_size,svginfo_image_props:s.image_props,svginfo_lang:s.language,svginfo_title:s.doc_title,svginfo_width:l.width,tool_docprops_cancel:l.cancel,tool_docprops_save:l.ok,tool_source_cancel:l.cancel,tool_source_save:l.ok,tool_prefs_cancel:l.cancel,tool_prefs_save:l.ok,sidepanel_handle:o.layers.split("").join(" "),tool_clear:a.new_doc,tool_docprops:a.docprops,tool_export:a.export_img,tool_import:a.import_doc,tool_open:a.open_doc,tool_save:a.save_doc,svginfo_units_rulers:s.units_and_rulers,svginfo_rulers_onoff:s.show_rulers,svginfo_unit:s.base_unit,svginfo_grid_settings:s.grid,svginfo_snap_onoff:s.snapping_onoff,svginfo_snap_step:s.snapping_stepsize,svginfo_grid_color:s.grid_color},!0),u={},$$a.each(["cut","copy","paste","paste_in_place","delete","group","ungroup","move_front","move_up","move_down","move_back"],function(){u['#cmenu_canvas a[href="#'+this+'"]']=a[this]}),$$a.each(["dupe","merge_down","merge_all"],function(){u['#cmenu_layers a[href="#'+this+'"]']=o[this]}),u['#cmenu_layers a[href="#delete"]']=o.del,setStrings("content",u),setStrings("title",{align_relative_to:a.align_relative_to,circle_cx:i.circle_cx,circle_cy:i.circle_cy,circle_r:i.circle_r,cornerRadiusLabel:i.corner_radius,ellipse_cx:i.ellipse_cx,ellipse_cy:i.ellipse_cy,ellipse_rx:i.ellipse_rx,ellipse_ry:i.ellipse_ry,fill_color:i.fill_color,font_family:i.font_family,idLabel:i.id,image_height:i.image_height,image_url:i.image_url,image_width:i.image_width,layer_delete:o.del,layer_down:o.move_down,layer_new:o.new,layer_rename:o.rename,layer_moreopts:l.more_opts,layer_up:o.move_up,line_x1:i.line_x1,line_x2:i.line_x2,line_y1:i.line_y1,line_y2:i.line_y2,linecap_butt:i.linecap_butt,linecap_round:i.linecap_round,linecap_square:i.linecap_square,linejoin_bevel:i.linejoin_bevel,linejoin_miter:i.linejoin_miter,linejoin_round:i.linejoin_round,main_icon:a.main_menu,palette:c.palette_info,zoom_panel:c.zoom_level,path_node_x:i.node_x,path_node_y:i.node_y,rect_height_tool:i.rect_height,rect_width_tool:i.rect_width,seg_type:i.seg_type,selLayerNames:o.move_selected,selected_x:i.pos_x,selected_y:i.pos_y,stroke_color:i.stroke_color,stroke_style:i.stroke_style,stroke_width:i.stroke_width,svginfo_title:s.doc_title,text:i.text_contents,toggle_stroke_tools:c.toggle_stroke_tools,tool_add_subpath:a.add_subpath,tool_alignbottom:a.align_bottom,tool_aligncenter:a.align_center,tool_alignleft:a.align_left,tool_alignmiddle:a.align_middle,tool_alignright:a.align_right,tool_aligntop:a.align_top,tool_angle:i.angle,tool_blur:i.blur,tool_bold:i.bold,tool_circle:a.mode_circle,tool_clone:a.clone,tool_clone_multi:a.clone,tool_delete:a.del,tool_delete_multi:a.del,tool_ellipse:a.mode_ellipse,tool_fhellipse:a.mode_fhellipse,tool_fhpath:a.mode_fhpath,tool_fhrect:a.mode_fhrect,tool_font_size:i.font_size,tool_group_elements:a.group_elements,tool_make_link:a.make_link,tool_link_url:a.set_link_url,tool_image:a.mode_image,tool_italic:i.italic,tool_line:a.mode_line,tool_move_bottom:a.move_bottom,tool_move_top:a.move_top,tool_node_clone:a.node_clone,tool_node_delete:a.node_delete,tool_node_link:a.node_link,tool_opacity:i.opacity,tool_openclose_path:a.openclose_path,tool_path:a.mode_path,tool_position:a.align_to_page,tool_rect:a.mode_rect,tool_redo:a.redo,tool_reorient:a.reorient_path,tool_select:a.mode_select,tool_source:a.source_save,tool_square:a.mode_square,tool_text:a.mode_text,tool_topath:a.to_path,tool_undo:a.undo,tool_ungroup:a.ungroup,tool_wireframe:a.wireframe_mode,tool_zoom:a.mode_zoom,url_notice:a.no_embed},!0),e.abrupt("return",{langParam:langParam,langData:t});case 15:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}(),putLocale=function(){var e=_asyncToGenerator(regeneratorRuntime.mark(function e(t,n,r){var a;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t?langParam=t:((langParam=$$a.pref("lang"))||(navigator.userLanguage?langParam=navigator.userLanguage:navigator.language&&(langParam=navigator.language)),console.log("Lang: "+langParam),n.includes(langParam)||"test"===langParam||(langParam="en")),a=r.langPath+"lang."+langParam+".js",e.t0=readLang,e.next=5,importSetGlobalDefault(a,{global:"svgEditorLang_"+langParam.replace(/-/g,"_")});case 5:return e.t1=e.sent,e.abrupt("return",(0,e.t0)(e.t1));case 7:case"end":return e.stop()}},e,this)}));return function(t,n,r){return e.apply(this,arguments)}}();function loadStylesheets(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.before,r=t.after,a=t.favicon,i=t.canvas,s=t.image,o=void 0===s||s,l=t.acceptErrors;return e=Array.isArray(e)?e:[e],Promise.all(e.map(function(e){var t={};if(Array.isArray(e)){var s=_slicedToArray(e,2);e=s[0];var c=s[1];t=void 0===c?{}:c}var u=t.favicon,d=void 0===u?a:u,h=t,p=h.before,g=void 0===p?n:p,f=h.after,m=void 0===f?r:f,v=h.canvas,_=void 0===v?i:v,b=h.image,y=void 0===b?o:b;function x(){g?g.before(C):m?m.after(C):document.head.appendChild(C)}var C=document.createElement("link");return new Promise(function(n,r){var a=r;if(l&&(a="function"==typeof l?function(a){l({error:a,stylesheetURL:e,options:t,resolve:n,reject:r})}:n),e.endsWith(".css")?d=!1:e.endsWith(".ico")&&(d=!0),d){if(C.rel="shortcut icon",C.type="image/x-icon",!1===y)return C.href=e,x(),void n(C);var i=document.createElement("canvas");i.width=16,i.height=16;var s=i.getContext("2d"),o=document.createElement("img");return o.addEventListener("error",function(e){r(e)}),o.addEventListener("load",function(){s.drawImage(o,0,0),C.href=_?i.toDataURL("image/x-icon"):e,x(),n(C)}),void(o.src=e)}C.rel="stylesheet",C.type="text/css",C.href=e,x(),C.addEventListener("error",function(e){a(e)}),C.addEventListener("load",function(){n(C)})})}))}var editor={},$$b=[jQueryPluginJSHotkeys,jQueryPluginBBQ,jQueryPluginSVGIcons,jQueryPluginJGraduate,jQueryPluginSpinButton,jQueryPluginSVG,jQueryContextMenu,jPicker].reduce(function(e,t){return t(e)},jQuery),stylesheet="svg-editor.css";$$b.loadingStylesheets.includes(stylesheet)||$$b.loadingStylesheets.push(stylesheet);var favicon="images/logo.png";$$b.loadingStylesheets.some(function(e){return!Array.isArray(e)||e[0]!==favicon})&&$$b.loadingStylesheets.push([favicon,{favicon:!0}]),editor.tool_scale=1,editor.exportWindowCt=0,editor.langChanged=!1,editor.showSaveWarning=!1,editor.storagePromptState="ignore";var svgCanvas,urldata,callbacks=[],defaultPrefs={lang:"",iconsize:"",bkgd_color:"#FFF",bkgd_url:"",img_save:"embed",save_notice_done:!1,export_notice_done:!1},defaultExtensions=["ext-connector.js","ext-eyedropper.js","ext-grid.js","ext-imagelib.js","ext-markers.js","ext-overview_window.js","ext-panning.js","ext-polygon.js","ext-shapes.js","ext-star.js","ext-storage.js"],defaultConfig={canvasName:"default",canvas_expansion:3,initFill:{color:"FF0000",opacity:1},initStroke:{width:5,color:"000000",opacity:1},text:{stroke_width:0,font_size:24,font_family:"serif"},initOpacity:1,colorPickerCSS:null,initTool:"select",exportWindowType:"new",wireframe:!1,showlayers:!1,no_save_warning:!1,langPath:"locale/",extPath:"extensions/",canvgPath:"canvg/",jspdfPath:"jspdf/",imgPath:"images/",jGraduatePath:"jgraduate/images/",extIconsPath:"extensions/",dimensions:[640,480],gridSnapping:!1,gridColor:"#000",baseUnit:"px",snappingStep:10,showRulers:!0,preventAllURLConfig:!1,preventURLContentLoading:!1,lockExtensions:!1,noDefaultExtensions:!1,showGrid:!1,noStorageOnLoad:!1,forceStorage:!1,emptyStorageOnDecline:!1},uiStrings$1=editor.uiStrings={},isReady=!1,customExportImage=!1,customExportPDF=!1,curPrefs={},curConfig={extensions:[],stylesheets:[],allowedOrigins:[]};function loadSvgString(e){return _loadSvgString.apply(this,arguments)}function _loadSvgString(){return(_loadSvgString=_asyncToGenerator(regeneratorRuntime.mark(function e(t){var n,r,a=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=a.length>1&&void 0!==a[1]?a[1]:{},r=n.noAlert,!(!1!==svgCanvas.setSvgString(t))){e.next=4;break}return e.abrupt("return");case 4:if(r){e.next=8;break}return e.next=7,$$b.alert(uiStrings$1.notification.errorLoadingSVG);case 7:return e.abrupt("return");case 8:throw new Error("Error loading SVG");case 9:case"end":return e.stop()}},e,this)}))).apply(this,arguments)}function getImportLocale(e){var t=e.defaultLang,n=e.defaultName;return function(){var e=_asyncToGenerator(regeneratorRuntime.mark(function e(){var r,a,i,s,o,l,c=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return l=function(e){return importSetGlobalDefault("".concat(curConfig.extPath,"ext-locale/").concat(i,"/").concat(e,".js"),{global:"svgEditorExtensionLocale_".concat(i,"_").concat(e)})},r=c.length>0&&void 0!==c[0]?c[0]:{},a=r.name,i=void 0===a?n:a,s=r.lang,o=void 0===s?t:s,e.prev=2,e.next=5,l(o);case 5:return e.abrupt("return",e.sent);case 8:return e.prev=8,e.t0=e.catch(2),e.abrupt("return",l("en"));case 11:case"end":return e.stop()}},e,this,[[2,8]])}));return function(){return e.apply(this,arguments)}}()}$$b.pref=function(e,t){return t?(curPrefs[e]=t,void(editor.curPrefs=curPrefs)):e in curPrefs?curPrefs[e]:defaultPrefs[e]},editor.putLocale=putLocale,editor.readLang=readLang,editor.setStrings=setStrings,editor.loadContentAndPrefs=function(){if(curConfig.forceStorage||!curConfig.noStorageOnLoad&&document.cookie.match(/(?:^|;\s*)svgeditstore=(?:prefsAndContent|prefsOnly)/)){if(editor.storage&&(curConfig.forceStorage||!curConfig.noStorageOnLoad&&document.cookie.match(/(?:^|;\s*)svgeditstore=prefsAndContent/))){var e="svgedit-"+curConfig.canvasName,t=editor.storage.getItem(e);t&&editor.loadFromString(t)}Object.keys(defaultPrefs).forEach(function(e){var t="svg-edit-"+e;if(editor.storage){var n=editor.storage.getItem(t);n&&(defaultPrefs[e]=String(n))}else if(window.widget)defaultPrefs[e]=window.widget.preferenceForKey(t);else{var r=document.cookie.match(new RegExp("(?:^|;\\s*)"+regexEscape(encodeURIComponent(t))+"=([^;]+)"));defaultPrefs[e]=r?decodeURIComponent(r[1]):""}})}},editor.setConfig=function(e,t){function n(e,t,n){e[t]&&"object"===_typeof(e[t])?$$b.extend(!0,e[t],n):e[t]=n}t=t||{},$$b.each(e,function(r,a){if({}.hasOwnProperty.call(e,r))if({}.hasOwnProperty.call(defaultPrefs,r)){if(!1===t.overwrite&&(curConfig.preventAllURLConfig||{}.hasOwnProperty.call(curPrefs,r)))return;!0===t.allowInitialUserOverride?defaultPrefs[r]=a:$$b.pref(r,a)}else if(["extensions","stylesheets","allowedOrigins"].includes(r)){if(!1===t.overwrite&&(curConfig.preventAllURLConfig||["allowedOrigins","stylesheets"].includes(r)||"extensions"===r&&curConfig.lockExtensions))return;curConfig[r]=curConfig[r].concat(a)}else if({}.hasOwnProperty.call(defaultConfig,r)){if(!1===t.overwrite&&(curConfig.preventAllURLConfig||{}.hasOwnProperty.call(curConfig,r)))return;if({}.hasOwnProperty.call(curConfig,r)){if(!1===t.overwrite)return;n(curConfig,r,a)}else!0===t.allowInitialUserOverride?n(defaultConfig,r,a):defaultConfig[r]&&"object"===_typeof(defaultConfig[r])?(curConfig[r]={},$$b.extend(!0,curConfig[r],a)):curConfig[r]=a}}),editor.curConfig=curConfig},editor.setCustomHandlers=function(e){editor.ready(function(){e.open&&($$b('#tool_open > input[type="file"]').remove(),$$b("#tool_open").show(),svgCanvas.open=e.open),e.save&&(editor.showSaveWarning=!1,svgCanvas.bind("saved",e.save)),e.exportImage&&(customExportImage=e.exportImage,svgCanvas.bind("exported",customExportImage)),e.exportPDF&&(customExportPDF=e.exportPDF,svgCanvas.bind("exportedPDF",customExportPDF))})},editor.randomizeIds=function(e){return svgCanvas.randomizeIds(e)},editor.init=function(){!("svgEditor"in window&&window.svgEditor&&!1===window.svgEditor.modules)||Object.assign(defaultConfig,{langPath:"../dist/locale/",extPath:"../dist/extensions/",canvgPath:"../dist/",jspdfPath:"../dist/"});try{"localStorage"in window&&(editor.storage=localStorage)}catch(e){}var e=[];function t(){(curConfig=$$b.extend(!0,{},defaultConfig,curConfig)).noDefaultExtensions||(curConfig.extensions=curConfig.extensions.concat(defaultExtensions)),["extensions","stylesheets","allowedOrigins"].forEach(function(e){curConfig[e]=$$b.grep(curConfig[e],function(t,n){return n===curConfig[e].indexOf(t)})}),editor.curConfig=curConfig}$$b("#lang_select option").each(function(){e.push(this.value)}),function(){var e,n;if(urldata=$$b.deparam.querystring(!0),$$b.isEmptyObject(urldata))t(),editor.loadContentAndPrefs();else{if(urldata.dimensions&&(urldata.dimensions=urldata.dimensions.split(",")),urldata.bkgd_color&&(urldata.bkgd_color="#"+urldata.bkgd_color),urldata.extensions&&(urldata.extensions=urldata.extensions.match(/[:\/\\]/)?"":urldata.extensions.split(",")),["langPath","extPath","canvgPath","jspdfPath","imgPath","jGraduatePath","extIconsPath"].forEach(function(e){urldata[e]&&delete urldata[e]}),editor.setConfig(urldata,{overwrite:!1}),t(),!curConfig.preventURLContentLoading){if(e=urldata.source,n=$$b.param.querystring(),e||n.includes("source=data:")&&(e=n.match(/source=(data:[^&]*)/)[1]),e)return void(e.startsWith("data:")?editor.loadFromDataURI(e):editor.loadFromString(e));if(urldata.url)return void editor.loadFromURL(urldata.url)}urldata.noStorageOnLoad&&!curConfig.forceStorage||editor.loadContentAndPrefs()}curPrefs=$$b.extend(!0,{},defaultPrefs,curPrefs),editor.curPrefs=curPrefs}();var n,r=editor.setIcon=function(e,t,n){var r="string"==typeof t?$$b.getSvgIcon(t,!0):t.clone();r?$$b(e).empty().append(r):console.log("NOTE: Icon image missing: "+t)},a=function(){var t=_asyncToGenerator(regeneratorRuntime.mark(function t(){var n,r,a,i,s,o;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,editor.putLocale(null,e,curConfig);case 2:return n=t.sent,r=n.langParam,a=n.langData,t.next=7,an(r,a);case 7:return i=uiStrings$1.common,s=i.ok,o=i.cancel,jQueryPluginDBox($$b,{ok:s,cancel:o}),t.prev=9,t.next=12,Promise.all(curConfig.extensions.map(function(){var e=_asyncToGenerator(regeneratorRuntime.mark(function e(t){var n,a,i,s,o,l,c;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.match(/^ext-(.+)\.js/)){e.next=3;break}return e.abrupt("return",void 0);case 3:return a=curConfig.extPath+t,e.prev=4,e.next=7,importSetGlobalDefault(a,{global:"svgEditorExtension_"+n[1].replace(/-/g,"_")});case 7:return i=e.sent,s=i.name,o=void 0===s?n[1]:s,l=i.init,c=getImportLocale({defaultLang:r,defaultName:o}),e.abrupt("return",editor.addExtension(o,l&&l.bind(editor),{$:$$b,importLocale:c}));case 13:return e.prev=13,e.t0=e.catch(4),console.log(e.t0),console.error("Extension failed to load: "+t+"; "+e.t0),e.abrupt("return",void 0);case 18:case"end":return e.stop()}},e,this,[[4,13]])}));return function(t){return e.apply(this,arguments)}}()));case 12:svgCanvas.bind("extensions_added",function(e,t){extensionsAdded=!0,Kt.setAll(),$$b(".flyout_arrow_horiz:empty").each(function(){$$b(this).append($$b.getSvgIcon("arrow_right",!0).width(5).height(5))}),"ignore"===editor.storagePromptState&&D(!0),messageQueue.forEach(function(e){svgCanvas.call("message",e)})}),svgCanvas.call("extensions_added"),t.next=19;break;case 16:t.prev=16,t.t0=t.catch(9),console.log(t.t0);case 19:case"end":return t.stop()}},t,this,[[9,16]])}));return function(){return t.apply(this,arguments)}}(),i={tool_scale:editor.tool_scale},s=function(){$$b(".tools_flyout").each(function(){var e=$$b("#"+this.id+"_show"),t=e.offset(),n=t.left,r=t.top,a=e.outerWidth();$$b(this).css({left:(n+a)*editor.tool_scale,top:r})})},o=function(){var e=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,t=document.getElementsByTagName("script")[0];for(var n in t.style)if(e.test(n))return n.match(e)[0];return"WebkitOpacity"in t.style?"Webkit":"KhtmlOpacity"in t.style?"Khtml":""}(),l=editor.setIconSize=function(e){var t="#tools_top .toolset, #editor_panel > *, #history_panel > *, #main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *, #g_panel > *, #tool_font_size > *, .tools_flyout",n=$$b(t),r=1;if("number"==typeof e)r=e;else{r={s:.75,m:1,l:1.25,xl:1.5}[e]}i.tool_scale=editor.tool_scale=r,s();var a=n.parents(":hidden");a.css("visibility","hidden").show(),function(e,t){var n=["top","left","bottom","right"];e.each(function(){for(var e=$$b(this),r=e.outerWidth()*(t-1),a=e.outerHeight()*(t-1),i=0;i<4;i++){var s=n[i],o=e.data("orig_margin-"+s);isNullish(o)&&(o=parseInt(e.css("margin-"+s)),e.data("orig_margin-"+s,o));var l=o*t;"right"===s?l+=r:"bottom"===s&&(l+=a),e.css("margin-"+s,l)}})}(n,r),a.css("visibility","visible").hide(),$$b.pref("iconsize",e),$$b("#iconsize").val(e);var l={"#tools_top":{left:50+$$b("#main_button").width(),height:72},"#tools_left":{width:31,top:74},"div#workarea":{left:38,top:74}},c=$$b("#tool_size_rules");if(c.length?c.empty():c=$$b('<style id="tool_size_rules"></style>').appendTo("head"),"m"!==e){var u="";$$b.each(l,function(t,n){t="#svg_editor "+t.replace(/,/g,", #svg_editor"),u+=t+"{",$$b.each(n,function(t,n){var a;"number"==typeof n?a=n*r+"px":(n[e]||n.all)&&(a=n[e]||n.all),u+=t+":"+a+";"}),u+="}"});var d="-"+o.toLowerCase()+"-";u+=t+"{"+d+"transform: scale("+r+");} #svg_editor div.toolset .toolset {"+d+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+d+"transform: scale("+1/r+");}",c.text(u)}s()};$$b.svgIcons(curConfig.imgPath+"svg_edit_icons.svg",{w:24,h:24,id_match:!1,no_img:!isWebkit(),fallback_path:curConfig.imgPath,fallback:{logo:"logo.png",select:"select.png",select_node:"select_node.png",square:"square.png",rect:"rect.png",fh_rect:"freehand-square.png",circle:"circle.png",ellipse:"ellipse.png",fh_ellipse:"freehand-circle.png",pencil:"fhpath.png",pen:"line.png",text:"text.png",path:"path.png",add_subpath:"add_subpath.png",close_path:"closepath.png",open_path:"openpath.png",image:"image.png",zoom:"zoom.png",arrow_right:"flyouth.png",arrow_right_big:"arrow_right_big.png",arrow_down:"dropdown.gif",fill:"fill.png",stroke:"stroke.png",opacity:"opacity.png",new_image:"clear.png",save:"save.png",export:"export.png",open:"open.png",import:"import.png",docprops:"document-properties.png",source:"source.png",wireframe:"wireframe.png",undo:"undo.png",redo:"redo.png",clone:"clone.png",delete:"delete.png",go_up:"go-up.png",go_down:"go-down.png",context_menu:"context_menu.png",move_bottom:"move_bottom.png",move_top:"move_top.png",to_path:"to_path.png",link_controls:"link_controls.png",reorient:"reorient.png",group_elements:"shape_group_elements.png",ungroup:"shape_ungroup.png",unlink_use:"unlink_use.png",width:"width.png",height:"height.png",c_radius:"c_radius.png",angle:"angle.png",blur:"blur.png",fontsize:"fontsize.png",align:"align.png",align_left:"align-left.png",align_center:"align-center.png",align_right:"align-right.png",align_top:"align-top.png",align_middle:"align-middle.png",align_bottom:"align-bottom.png",linecap_butt:"linecap_butt.png",linecap_square:"linecap_square.png",linecap_round:"linecap_round.png",linejoin_miter:"linejoin_miter.png",linejoin_bevel:"linejoin_bevel.png",linejoin_round:"linejoin_round.png",eye:"eye.png",no_color:"no_color.png",ok:"save.png",cancel:"cancel.png",warning:"warning.png",node_delete:"node_delete.png",node_clone:"node_clone.png",globe_link:"globe_link.png"},placement:{"#logo":"logo","#tool_clear div,#layer_new":"new_image","#tool_save div":"save","#tool_export div":"export","#tool_open div div":"open","#tool_import div div":"import","#tool_source":"source","#tool_docprops > div":"docprops","#tool_wireframe":"wireframe","#tool_undo":"undo","#tool_redo":"redo","#tool_select":"select","#tool_fhpath":"pencil","#tool_line":"pen","#tool_rect,#tools_rect_show":"rect","#tool_square":"square","#tool_fhrect":"fh_rect","#tool_ellipse,#tools_ellipse_show":"ellipse","#tool_circle":"circle","#tool_fhellipse":"fh_ellipse","#tool_path":"path","#tool_text,#layer_rename":"text","#tool_image":"image","#tool_zoom":"zoom","#tool_clone,#tool_clone_multi":"clone","#tool_node_clone":"node_clone","#layer_delete,#tool_delete,#tool_delete_multi":"delete","#tool_node_delete":"node_delete","#tool_add_subpath":"add_subpath","#tool_openclose_path":"open_path","#tool_move_top":"move_top","#tool_move_bottom":"move_bottom","#tool_topath":"to_path","#tool_node_link":"link_controls","#tool_reorient":"reorient","#tool_group_elements":"group_elements","#tool_ungroup":"ungroup","#tool_unlink_use":"unlink_use","#tool_alignleft, #tool_posleft":"align_left","#tool_aligncenter, #tool_poscenter":"align_center","#tool_alignright, #tool_posright":"align_right","#tool_aligntop, #tool_postop":"align_top","#tool_alignmiddle, #tool_posmiddle":"align_middle","#tool_alignbottom, #tool_posbottom":"align_bottom","#cur_position":"align","#linecap_butt,#cur_linecap":"linecap_butt","#linecap_round":"linecap_round","#linecap_square":"linecap_square","#linejoin_miter,#cur_linejoin":"linejoin_miter","#linejoin_round":"linejoin_round","#linejoin_bevel":"linejoin_bevel","#url_notice":"warning","#layer_up":"go_up","#layer_down":"go_down","#layer_moreopts":"context_menu","#layerlist td.layervis":"eye","#tool_source_save,#tool_docprops_save,#tool_prefs_save":"ok","#tool_source_cancel,#tool_docprops_cancel,#tool_prefs_cancel":"cancel","#rwidthLabel, #iwidthLabel":"width","#rheightLabel, #iheightLabel":"height","#cornerRadiusLabel span":"c_radius","#angleLabel":"angle","#linkLabel,#tool_make_link,#tool_make_link_multi":"globe_link","#zoomLabel":"zoom","#tool_fill label":"fill","#tool_stroke .icon_label":"stroke","#group_opacityLabel":"opacity","#blurLabel":"blur","#font_sizeLabel":"fontsize",".flyout_arrow_horiz":"arrow_right",".dropdown button, #main_button .dropdown":"arrow_down","#palette .palette_item:first, #fill_bg, #stroke_bg":"no_color"},resize:{"#logo .svg_icon":28,".flyout_arrow_horiz .svg_icon":5,".layer_button .svg_icon, #layerlist td.layervis .svg_icon":14,".dropdown button .svg_icon":7,"#main_button .dropdown .svg_icon":9,".palette_item:first .svg_icon":15,"#fill_bg .svg_icon, #stroke_bg .svg_icon":16,".toolbar_button button .svg_icon":16,".stroke_tool div div .svg_icon":20,"#tools_bottom label .svg_icon":18},callback:(n=_asyncToGenerator(regeneratorRuntime.mark(function e(t){var n,r,a,i,s,o,l;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i=function(e){switch(e){case"jgraduate/css/jPicker.css":return 1;case"jgraduate/css/jGraduate.css":return 2;case"svg-editor.css":return 3;case"spinbtn/jQuery.SpinButton.css":return 4;default:return 1/0}},$$b(".toolbar_button button > svg, .toolbar_button button > img").each(function(){$$b(this).parent().prepend(this)}),(n=$$b("#tools_left")).length&&(r=n.offset().top+n.outerHeight()),a=$$b.pref("iconsize"),editor.setIconSize(a||($$b(window).height()<r?"s":"m")),$$b(".tools_flyout").each(function(){var e=$$b("#"+this.id+"_show"),t=e.attr("data-curopt");if(!e.children("svg, img").length){var n=$$b(t).children().clone();n.length&&(n[0].removeAttribute("style"),e.append(n))}}),s=$$b.loadingStylesheets.sort(function(e,t){var n=i(e),r=i(t);return n===r?0:n>r}),curConfig.stylesheets.length&&(s=_toConsumableArray(new Set(curConfig.stylesheets)),(o=s.indexOf("@default"))>-1&&(l=s).splice.apply(l,[o,1].concat(_toConsumableArray($$b.loadingStylesheets)))),e.next=11,loadStylesheets(s,{acceptErrors:function(e){var t=e.stylesheetURL,n=e.reject,r=e.resolve;$$b.loadingStylesheets.includes(t)?n(new Error("Missing expected stylesheet: ".concat(t))):r()}});case 11:return $$b("#svg_container")[0].style.visibility="visible",e.next=14,editor.runCallbacks();case 14:case"end":return e.stop()}},e,this)})),function(e){return n.apply(this,arguments)})}),editor.canvas=svgCanvas=new SvgCanvas(document.getElementById("svgcanvas"),curConfig);var c,u,d=isMac()?"meta+":"ctrl+",h=svgCanvas.pathActions,p=svgCanvas.undoMgr,g=$$b("#workarea"),f=$$b("#cmenu_canvas"),m={fill:null,stroke:null},v=null,_=curConfig.imgPath+"logo.png",b="crosshair",y="crosshair",x="toolbars";!function(){var e=window.opener||window.parent;if(e)try{var t=new e.CustomEvent("svgEditorReady",{bubbles:!0,cancelable:!0});e.document.documentElement.dispatchEvent(t)}catch(e){}}();for(var C=function(){var e=$$b(".tool_button_current");e.length&&"tool_select"!==e[0].id&&(e.removeClass("tool_button_current").addClass("tool_button"),$$b("#tool_select").addClass("tool_button_current").removeClass("tool_button"),$$b("#styleoverrides").text("\n #svgcanvas svg * {\n cursor: move;\n pointer-events: all;\n }\n #svgcanvas svg {\n cursor: default;\n }\n ")),svgCanvas.setMode("select"),g.css("cursor","auto")},S=$$b("title:first").text(),w=[],$=.1;$<1e5;$*=10)w.push($),w.push(2*$),w.push(5*$);var k=function(e){var t,n=[],r=svgCanvas.getCurrentDrawing().getNumLayers();for(t=0;t<r;t++)n[t]=svgCanvas.getCurrentDrawing().getLayerName(t);e?n.forEach(function(t){t!==e&&svgCanvas.getCurrentDrawing().setLayerOpacity(t,.5)}):n.forEach(function(e){svgCanvas.getCurrentDrawing().setLayerOpacity(e,1)})},A=function(){svgCanvas.clearSelection();for(var e=$$b("#layerlist tbody").empty(),t=$$b("#selLayerNames").empty(),n=svgCanvas.getCurrentDrawing(),r=n.getCurrentLayerName(),a=$$b.getSvgIcon("eye"),i=svgCanvas.getCurrentDrawing().getNumLayers();i--;){var s=n.getLayerName(i),o=$$b('<tr class="layer">').toggleClass("layersel",s===r),l=$$b('<td class="layervis">').toggleClass("layerinvis",!n.getLayerVisibility(s)),c=$$b('<td class="layername">'+s+"</td>");e.append(o.append(l,c)),t.append('<option value="'+s+'">'+s+"</option>")}if(void 0!==a){var u=a.clone();$$b("td.layervis",e).append(u),$$b.resizeSvgIcons({"td.layervis .svg_icon":14})}$$b("#layerlist td.layername").mouseup(function(e){$$b("#layerlist tr.layer").removeClass("layersel"),$$b(this.parentNode).addClass("layersel"),svgCanvas.setCurrentLayer(this.textContent),e.preventDefault()}).mouseover(function(){k(this.textContent)}).mouseout(function(){k()}),$$b("#layerlist td.layervis").click(function(){var e=$$b(this.parentNode).prevAll().length,t=$$b("#layerlist tr.layer:eq("+e+") td.layername").text(),n=$$b(this).hasClass("layerinvis");svgCanvas.setLayerVisibility(t,n),$$b(this).toggleClass("layerinvis")});for(var d=5-$$b("#layerlist tr.layer").size();d-- >0;)e.append('<tr><td style="color:white">_</td><td/></tr>')},E=!1,N="",T=function(e,t){E||(E=!0,N=svgCanvas.getSvgString(),$$b("#save_output_btns").toggle(Boolean(t)),$$b("#tool_source_back").toggle(!t),$$b("#svg_source_textarea").val(N),$$b("#svg_source_editor").fadeIn(),$$b("#svg_source_textarea").focus())},P=null,G=!1,L=function(){window.opera&&$$b("<p/>").hide().appendTo("body").remove()};function I(e,t){var n=e.id,a=_slicedToArray(n.split("_"),2),i=a[0],s=a[1];t&&svgCanvas.setStrokeAttr("stroke-"+i,s),L(),r("#cur_"+i,n,20),$$b(e).addClass("current").siblings().removeClass("current")}var M=editor.toolButtonClick=function(e,t){if($$b(e).hasClass("disabled"))return!1;if($$b(e).parent().hasClass("tools_flyout"))return!0;return t||$$b(".tools_flyout").fadeOut("normal"),$$b("#styleoverrides").text(""),g.css("cursor","auto"),$$b(".tool_button_current").removeClass("tool_button_current").addClass("tool_button"),$$b(e).addClass("tool_button_current").removeClass("tool_button"),!0},R=editor.clickSelect=function(){M("#tool_select")&&(svgCanvas.setMode("select"),$$b("#styleoverrides").text("\n #svgcanvas svg * {\n cursor: move;\n pointer-events: all;\n }\n #svgcanvas svg {\n cursor: default;\n }\n "))},O=editor.setImageURL=function(e){e||(e=_),svgCanvas.setImageURL(e),$$b("#image_url").val(e),e.startsWith("data:")?($$b("#image_url").hide(),$$b("#change_image_url").show()):(svgCanvas.embedImage(e,function(t){$$b("#url_notice").toggle(!t),_=e}),$$b("#image_url").show(),$$b("#change_image_url").hide())};function B(e,t){$$b.pref("bkgd_color",e),$$b.pref("bkgd_url",t),svgCanvas.setBackground(e,t)}function V(){return j.apply(this,arguments)}function j(){return(j=_asyncToGenerator(regeneratorRuntime.mark(function e(){var t,n,r,a,i,s=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=s.length>0&&void 0!==s[0]?s[0]:{},n=t.cancelDeletes,r=void 0!==n&&n,a=(a=svgCanvas.getHref(P)).startsWith("data:")?"":a,e.next=5,$$b.prompt(uiStrings$1.notification.enterNewImgURL,a);case 5:(i=e.sent)?O(i):r&&svgCanvas.deleteSelectedElements();case 7:case"end":return e.stop()}},e,this)}))).apply(this,arguments)}function F(e,t){var n,r;t||(t=svgCanvas.getZoom()),e||(e=$$b("#svgcanvas"));var a=svgCanvas.getContentElem(),i=getTypeMap()[curConfig.baseUnit];for(n=0;n<2;n++){var s=0===n,o=s?"x":"y",l=s?"width":"height",c=Number(a.getAttribute(o)),u=$$b("#ruler_"+o+" canvas:first"),d=u.clone();u.replaceWith(d);var h=d[0],p=e[l](),g=p;h.parentNode.style[l]=g+"px";var f=h.getContext("2d"),m=void 0,v=void 0,_=void 0;if(f.fillStyle="rgb(200,0,0)",f.fillRect(0,0,h.width,h.height),d.siblings().remove(),p>=3e4){_=parseInt(p/3e4)+1,(m=[])[0]=f;var b=void 0;for(r=1;r<_;r++)h[l]=3e4,b=h.cloneNode(!0),h.parentNode.append(b),m[r]=b.getContext("2d");b[l]=p%3e4,p=3e4}h[l]=p;var y=i*t,x=50/y,C=1;for(r=0;r<w.length&&(C=v=w[r],!(x<=v));r++);var S=C*y;f.font="9px sans-serif";for(var $=c/y%C*y,k=$-S,A=0;$<g;){k+=S;var E=Math.round($)+.5;s?(f.moveTo(E,15),f.lineTo(E,0)):(f.moveTo(15,E),f.lineTo(0,E)),v=(k-c)/y;var N=void 0;if(C>=1)N=Math.round(v);else{var T=String(C).split(".")[1].length;N=v.toFixed(T)}if(0!==N&&1e3!==N&&N%1e3==0&&(N=N/1e3+"K"),s)f.fillText(N,$+2,8);else{var P=String(N).split("");for(r=0;r<P.length;r++)f.fillText(P[r],1,$+9+9*r)}var G=S/10;for(r=1;r<10;r++){var L=Math.round($+G*r)+.5;if(m&&L>p){if(A++,f.stroke(),A>=_){r=10,$=g;continue}f=m[A],$-=3e4,L=Math.round($+G*r)+.5}var I=r%2?12:10;s?(f.moveTo(L,15),f.lineTo(L,I)):(f.moveTo(15,L),f.lineTo(I,L))}$+=S}f.strokeStyle="#000",f.stroke()}}var D=editor.updateCanvas=function(e,t){var n=svgCanvas.getZoom(),r=g,a=$$b("#svgcanvas"),i=g.width(),s=g.height(),o=i,l=s,c=r[0].scrollLeft+o/2,u=r[0].scrollTop+l/2,d=curConfig.canvas_expansion;i=Math.max(o,svgCanvas.contentW*n*d),s=Math.max(l,svgCanvas.contentH*n*d),i===o&&s===l?g.css("overflow","hidden"):g.css("overflow","scroll");var h=a.height()/2,p=a.width()/2;a.width(i).height(s);var f=s/2,m=i/2,v=svgCanvas.updateCanvas(i,s),_=m/p,b=i/2-o/2,y=s/2-l/2;t?(t.x+=v.x,t.y+=v.y):t={x:m+(c-p)*_,y:f+(u-h)*_};e?svgCanvas.contentW>r.width()?(g[0].scrollLeft=v.x-10,g[0].scrollTop=v.y-10):(r[0].scrollLeft=b,r[0].scrollTop=y):(r[0].scrollLeft=t.x-o/2,r[0].scrollTop=t.y-l/2),curConfig.showRulers&&(F(a,n),g.scroll()),!0!==urldata.storagePrompt&&"ignore"===editor.storagePromptState&&$$b("#dialog_box").hide()},U=function(){var e="none"===svgCanvas.getColor("fill"),t="none"===svgCanvas.getColor("stroke"),n=["#tool_fhpath","#tool_line"],r=["#tools_rect .tool_button","#tools_ellipse .tool_button","#tool_text","#tool_path"];t?n.forEach(function(e){$$b(e).hasClass("tool_button_current")&&R(),$$b(e).addClass("disabled")}):n.forEach(function(e){$$b(e).removeClass("disabled")}),t&&e?r.forEach(function(e){$$b(e).hasClass("tool_button_current")&&R(),$$b(e).addClass("disabled")}):r.forEach(function(e){$$b(e).removeClass("disabled")}),svgCanvas.runExtensions("toolButtonStateUpdate",{nofill:e,nostroke:t}),$$b(".tools_flyout").each(function(){var e=$$b("#"+this.id+"_show"),t=!1;$$b(this).children().each(function(){$$b(this).hasClass("disabled")||(t=!0)}),e.toggleClass("disabled",!t)}),L()},H=function(){var e=P;isNullish(e)||e.parentNode||(e=null);var t=svgCanvas.getCurrentDrawing().getCurrentLayerName(),n=svgCanvas.getMode(),a="px"!==curConfig.baseUnit?curConfig.baseUnit:null,i="pathedit"===n,s=$$b("#cmenu_canvas li");if($$b("#selected_panel, #multiselected_panel, #g_panel, #rect_panel, #circle_panel,#ellipse_panel, #line_panel, #text_panel, #image_panel, #container_panel, #use_panel, #a_panel").hide(),isNullish(e))G?($$b("#multiselected_panel").show(),s.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")):s.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back");else{var o=e.nodeName,l=svgCanvas.getRotationAngle(e);$$b("#angle").val(l);var c=svgCanvas.getBlur(e);if($$b("#blur").val(c),$$b("#blur_slider").slider("option","value",c),svgCanvas.addedNew&&"image"===o&&"image"===svgCanvas.getMode()&&(svgCanvas.getHref(e).startsWith("data:")||V({cancelDeletes:!0})),i||"pathedit"===n){var u=h.getNodePoint();if($$b("#tool_add_subpath").removeClass("push_button_pressed").addClass("tool_button"),$$b("#tool_node_delete").toggleClass("disabled",!h.canDeleteNodes),r("#tool_openclose_path",h.closed_subpath?"open_path":"close_path"),u){var d=$$b("#seg_type");a&&(u.x=convertUnit(u.x),u.y=convertUnit(u.y)),$$b("#path_node_x").val(u.x),$$b("#path_node_y").val(u.y),u.type?d.val(u.type).removeAttr("disabled"):d.val(4).attr("disabled","disabled")}return}if($$b("#selected_panel").show(),["line","circle","ellipse"].includes(o))$$b("#xy_panel").hide();else{var g,m;if(["g","polyline","path"].includes(o)){var v=svgCanvas.getStrokedBBox([e]);v&&(g=v.x,m=v.y)}else g=e.getAttribute("x"),m=e.getAttribute("y");a&&(g=convertUnit(g),m=convertUnit(m)),$$b("#selected_x").val(g||0),$$b("#selected_y").val(m||0),$$b("#xy_panel").show()}var _=!["image","text","path","g","use"].includes(o);$$b("#tool_topath").toggle(_),$$b("#tool_reorient").toggle("path"===o),$$b("#tool_reorient").toggleClass("disabled",0===l);var b={g:[],a:[],rect:["rx","width","height"],image:["width","height"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],line:["x1","y1","x2","y2"],text:[],use:[]},y=e.tagName,x=null;if("a"===y&&(x=svgCanvas.getHref(e),$$b("#g_panel").show()),"a"===e.parentNode.tagName&&($$b(e).siblings().length||($$b("#a_panel").show(),x=svgCanvas.getHref(e.parentNode))),$$b("#tool_make_link, #tool_make_link").toggle(!x),x&&$$b("#link_url").val(x),b[y]){var C=b[y];if($$b("#"+y+"_panel").show(),$$b.each(C,function(t,n){var r=e.getAttribute(n);if("px"!==curConfig.baseUnit&&e[n]){var a=e[n].baseVal.value;r=convertUnit(a)}$$b("#"+y+"_"+n).val(r||0)}),"text"===y)$$b("#text_panel").css("display","inline"),$$b("#tool_font_size").css("display","inline"),svgCanvas.getItalic()?$$b("#tool_italic").addClass("push_button_pressed").removeClass("tool_button"):$$b("#tool_italic").removeClass("push_button_pressed").addClass("tool_button"),svgCanvas.getBold()?$$b("#tool_bold").addClass("push_button_pressed").removeClass("tool_button"):$$b("#tool_bold").removeClass("push_button_pressed").addClass("tool_button"),$$b("#font_family").val(e.getAttribute("font-family")),$$b("#font_size").val(e.getAttribute("font-size")),$$b("#text").val(e.textContent),svgCanvas.addedNew&&setTimeout(function(){$$b("#text").focus().select()},100);else if("image"===y&&"image"===svgCanvas.getMode())O(svgCanvas.getHref(e));else if("g"===y||"use"===y){$$b("#container_panel").show();var S=svgCanvas.getTitle(),w=$$b("#g_title")[0];w.value=S,function(e){var t=Math.min(Math.max(12+6*e.value.length,50),300);$$b(e).width(t)}(w),$$b("#g_title").prop("disabled","use"===y)}}s[("g"===y?"en":"dis")+"ableContextMenuItems"]("#ungroup"),s[("g"!==y&&G?"en":"dis")+"ableContextMenuItems"]("#group")}$$b("#tool_undo").toggleClass("disabled",0===p.getUndoStackSize()),$$b("#tool_redo").toggleClass("disabled",0===p.getRedoStackSize()),svgCanvas.addedNew=!1,e&&!i||G?($$b("#selLayerNames").removeAttr("disabled").val(t),f.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")):$$b("#selLayerNames").attr("disabled","disabled")},z=function(){if(!Mt){var e="\n #workarea.wireframe #svgcontent * {\n stroke-width: ".concat(1/svgCanvas.getZoom(),"px;\n }\n ");$$b("#wireframe_rules").text(g.hasClass("wireframe")?e:"")}},q="",W=function(e){e=e||svgCanvas.getDocumentTitle();var t=S+(e?": "+e:"");$$b("title:first").text(t)};function Y(e){return e&&"g"===e.tagName&&Layer.CLASS_REGEX.test(e.getAttribute("class"))}var X=function(){z()},Q=svgCanvas.zoomChanged=function(e,t,n){var r=g,a=svgCanvas.setBBoxZoom(t,r.width()-15,r.height()-15);if(a){var i=a.zoom,s=a.bbox;i<.001?K({value:.1}):($$b("#zoom").val((100*i).toFixed(1)),n?D():D(!1,{x:s.x*i+s.width*i/2,y:s.y*i+s.height*i/2}),"zoom"===svgCanvas.getMode()&&s.width&&C(),X())}},K=function(e){var t=e.value/100;if(t<.001)e.value=.1;else{var n=svgCanvas.getZoom(),r=g;Q(window,{width:0,height:0,x:(r[0].scrollLeft+r.width()/2)/n,y:(r[0].scrollTop+r.height()/2)/n,zoom:t},!0)}};$$b("#cur_context_panel").delegate("a","click",function(){var e=$$b(this);return e.attr("data-root")?svgCanvas.leaveContext():svgCanvas.setContext(e.text()),svgCanvas.clearSelection(),!1});var Z=function(){m.fill.prep(),m.stroke.prep()},J={},ee=function(){$$b(".tools_flyout").each(function(){var e=$$b("#"+this.id+"_show");if(!e.data("isLibrary")){var t=$$b(this).children().map(function(){return this.title}).get();e[0].title=t.join(" / ")}})},te={},ne=function(e){$$b.each(e,function(t,n){var r;te[t]||(te[t]=[]),(r=te[t]).push.apply(r,_toConsumableArray(n));var a,i=$$b(t).children().not(".tool_button_evt_handled"),s=t+"_show",o=$$b(s),l=!1;i.addClass("tool_button tool_button_evt_handled").unbind("click mousedown mouseup").each(function(){var t="#"+this.getAttribute("id"),r=Object.entries(n).find(function(e){var n=_slicedToArray(e,2);n[0];return n[1].sel===t}),a=_slicedToArray(r,2),i=a[0],c=a[1];J[c.sel]=c.fn,c.isDefault&&(l=i);var u=function(t){var n,r=c;if("keydown"===t.type){var a=$$b(r.parent+"_show").hasClass("tool_button_current"),i=$$b(r.parent+"_show").attr("data-curopt");Object.entries(e[c.parent]).some(function(n){var s=_slicedToArray(n,2),o=s[0],l=s[1];return l.sel===i&&(t.shiftKey&&a?(o=parseInt(o),r=te[c.parent][o+1]||e[c.parent][0]):r=l,!0)})}return!$$b(this).hasClass("disabled")&&(M(s)&&r.fn(),(n=r.icon?$$b.getSvgIcon(r.icon,!0):$$b(r.sel).children().eq(0).clone())[0].setAttribute("width",o.width()),n[0].setAttribute("height",o.height()),o.children(":not(.flyout_arrow_horiz)").remove(),o.append(n).attr("data-curopt",r.sel),!0)};return $$b(this).mouseup(u),c.key&&$$b(document).bind("keydown",c.key[0]+" shift+"+c.key[0],u),!0}),l?o.attr("data-curopt",n[l].sel):o.attr("data-curopt")||o.attr("data-curopt",n[0].sel);var c=$$b(s).position();o.mousedown(function(e){if(o.hasClass("disabled"))return!1;var n=$$b(t),r=c.left+34,i=-1*n.width(),s=n.data("shown_popop")?200:0;return a=setTimeout(function(){o.data("isLibrary")?n.css("left",r).show():n.css("left",i).show().animate({left:r},150),n.data("shown_popop",!0)},s),e.preventDefault(),!0}).mouseup(function(e){clearTimeout(a);var t=$$b(this).attr("data-curopt");o.data("isLibrary")&&$$b(s.replace("_show","")).is(":visible")?M(s,!0):M(s)&&J[t]&&J[t]()})}),ee(),s()},re=function(e,t){return $$b("<div>",{class:"tools_flyout",id:e}).appendTo("#svg_editor").append(t)},ae=function(e,t,n,a){var i=$$b(e),s=a.dropUp,o=$$b(t);s&&$$b(e).addClass("dropup"),o.find("li").bind("mouseup",function(){a.seticon&&(r("#cur_"+i[0].id,$$b(this).children()),$$b(this).addClass("current").siblings().removeClass("current"));for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];n.apply.apply(n,[this].concat(t))});var l=!1;$$b(window).mouseup(function(e){l||(i.removeClass("down"),o.hide(),o.css({top:0,left:0})),l=!1}),i.bind("mousedown",function(){var e=i.offset();s?(e.top-=o.height(),e.left+=8):e.top+=i.height(),o.offset(e),i.hasClass("down")?(o.hide(),o.css({top:0,left:0})):(o.show(),l=!0),i.toggleClass("down")}).hover(function(){l=!0}).mouseout(function(){l=!1}),a.multiclick&&o.mousedown(function(){l=!0})},ie=[],se=function(){var e=_asyncToGenerator(regeneratorRuntime.mark(function e(t,n){var r,a,i,s,o,u,d,h,p,g;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(s=function(){c&&(clearTimeout(c),c=null),a||(c=setTimeout(function(){a=!0,l($$b.pref("iconsize"))},50))},n){e.next=3;break}return e.abrupt("return",void 0);case 3:if(r=!1,a=!1,!n.langReady){e.next=14;break}if(!editor.langChanged){e.next=13;break}return i=$$b.pref("lang"),e.next=10,n.langReady({lang:i,uiStrings:uiStrings$1,importLocale:getImportLocale({defaultLang:i,defaultName:n.name})});case 10:rn.push(n.name),e.next=14;break;case 13:ie.push(n);case 14:if(o=function(){n.callback&&!r&&(r=!0,n.callback.call(editor))},u=[],n.context_tools&&$$b.each(n.context_tools,function(e,t){var n,r=t.container_id?' id="'+t.container_id+'"':"",a=$$b("#"+t.panel);switch(a.length||(a=$$b("<div>",{id:t.panel}).appendTo("#tools_top")),t.type){case"tool_button":n='<div class="tool_button">'+t.id+"</div>";var i=$$b(n).appendTo(a);t.events&&$$b.each(t.events,function(e,t){$$b(i).bind(e,t)});break;case"select":n="<label"+r+'><select id="'+t.id+'">',$$b.each(t.options,function(e,r){var a=e===t.defval?" selected":"";n+='<option value="'+e+'"'+a+">"+r+"</option>"});var s=$$b(n+="</select></label>").appendTo(a).find("select");$$b.each(t.events,function(e,t){$$b(s).bind(e,t)});break;case"button-select":n='<div id="'+t.id+'" class="dropdown toolset" title="'+t.title+'"><div id="cur_'+t.id+'" class="icon_label"></div><button></button></div>';var o=$$b('<ul id="'+t.id+'_opts"></ul>').appendTo("#option_lists");t.colnum&&o.addClass("optcols"+t.colnum),$$b(n).appendTo(a).children(),u.push({elem:"#"+t.id,list:"#"+t.id+"_opts",title:t.title,callback:t.events.change,cur:"#cur_"+t.id});break;case"input":n="<label"+r+'><span id="'+t.id+'_label">'+t.label+':</span><input id="'+t.id+'" title="'+t.title+'" size="'+(t.size||"4")+'" value="'+(t.defval||"")+'" type="text"/></label>';var l=$$b(n).appendTo(a).find("input");t.spindata&&l.SpinButton(t.spindata),t.events&&$$b.each(t.events,function(e,t){l.bind(e,t)})}}),d=n.svgicons,!n.buttons){e.next=24;break}if(h={},p={},g={},$$b.each(n.buttons,function(e,t){for(var n,r,a,i,s,o,l,c=t.id,u=e;$$b("#"+c).length;)c=t.id+"_"+ ++u;if(d){h[c]=t.icon;var f=t.svgicon||t.id;"app_menu"===t.type?p["#"+c+" > div"]=f:p["#"+c]=f}else n=$$b('<img src="'+t.icon+'">');switch(t.type){case"mode_flyout":case"mode":r="tool_button",a="#tools_left";break;case"context":r="tool_button",a="#"+t.panel,$$b(a).length||$$b("<div>",{id:t.panel}).appendTo("#tools_top");break;case"app_menu":r="",a="#main_menu ul"}var m,v=$$b(t.list||"app_menu"===t.type?"<li/>":"<div/>").attr("id",c).attr("title",t.title).addClass(r);if(t.includeWith||t.list){if(t.list){if(v.addClass("push_button"),$$b("#"+t.list+"_opts").append(v),t.isDefault){$$b("#cur_"+t.list).append(v.children().clone());var _=t.svgicon||t.id;p["#cur_"+t.list]=_}}else if(t.includeWith){var b,y=t.includeWith;i=(l=$$b(y.button)).parent(),l.parent().hasClass("tools_flyout")||(b=l[0].id.replace("tool_","tools_"),s=l.clone().attr("id",b+"_show").append($$b("<div>",{class:"flyout_arrow_horiz"})),l.before(s),i=re(b,l)),o=Kt.getButtonData(y.button),y.isDefault&&(p["#"+b+"_show"]=t.id);var x=g["#"+i[0].id]=[{sel:"#"+c,fn:t.events.click,icon:t.id,key:t.key,isDefault:Boolean(t.includeWith&&t.includeWith.isDefault)},o],C="position"in y?y.position:"last",S=i.children().length;!isNaN(C)&&C>=0&&C<S?i.children().eq(C).before(v):(i.append(v),x.reverse())}}else"position"in t?$$b(a).children().eq(t.position).length?$$b(a).children().eq(t.position).before(v):$$b(a).children().last().before(v):v.appendTo(a),"mode_flyout"===t.type?(i=(l=$$b(v)).parent(),l.parent().hasClass("tools_flyout")||(m=l[0].id.replace("tool_","tools_"),s=l.clone().attr("id",m+"_show").append($$b("<div>",{class:"flyout_arrow_horiz"})),l.before(s),(i=re(m,l)).data("isLibrary",!0),s.data("isLibrary",!0)),p["#"+m+"_show"]=t.id,g["#"+i[0].id]=[{sel:"#"+c,fn:t.events.click,icon:t.id,isDefault:!0}]):"app_menu"===t.type&&v.append("<div>").append(t.title);d||v.append(n),t.list||$$b.each(t.events,function(e,n){"click"===e&&"mode"===t.type?(isTouch()&&"click"===e&&(e="mousedown"),t.includeWith?v.bind(e,n):v.bind(e,function(){M(v)&&n()}),t.key&&($$b(document).bind("keydown",t.key,n),t.title&&v.attr("title",t.title+" ["+t.key+"]"))):v.bind(e,n)}),ne(g)}),$$b.each(u,function(){ae(this.elem,this.list,this.callback,{seticon:!0})}),!d){e.next=24;break}return e.abrupt("return",new Promise(function(e,t){$$b.svgIcons(d,{w:24,h:24,id_match:!1,no_img:!isWebkit(),fallback:h,placement:p,callback:function(t){"m"!==$$b.pref("iconsize")&&s(),o(),e()}})}));case 24:return e.abrupt("return",o());case 25:case"end":return e.stop()}},e,this)}));return function(t,n){return e.apply(this,arguments)}}();svgCanvas.bind("selected",function(e,t){var n=svgCanvas.getMode();"select"===n&&C();var a="pathedit"===n;P=1===t.length||isNullish(t[1])?t[0]:null,G=t.length>=2&&!isNullish(t[1]),isNullish(P)||a||function(){var e,t;if(!isNullish(P))switch(P.tagName){case"use":case"image":case"foreignObject":break;case"g":case"a":var n=P.getElementsByTagName("*"),r=null;for(e=0,t=n.length;e<t;e++){var a=n[e].getAttribute("stroke-width");0===e?r=a:r!==a&&(r=null)}$$b("#stroke_width").val(null===r?"":r),m.fill.update(!0),m.stroke.update(!0);break;default:m.fill.update(!0),m.stroke.update(!0),$$b("#stroke_width").val(P.getAttribute("stroke-width")||1),$$b("#stroke_style").val(P.getAttribute("stroke-dasharray")||"none");var i=P.getAttribute("stroke-linejoin")||"miter";$$b("#linejoin_"+i).length&&I($$b("#linejoin_"+i)[0]),i=P.getAttribute("stroke-linecap")||"butt",$$b("#linecap_"+i).length&&I($$b("#linecap_"+i)[0])}if(!isNullish(P)){var s=100*(P.getAttribute("opacity")||1);$$b("#group_opacity").val(s),$$b("#opac_slider").slider("option","value",s),$$b("#elem_id").val(P.id),$$b("#elem_class").val(P.getAttribute("class"))}U()}(),function(e,t){$$b("#path_node_panel").toggle(e),$$b("#tools_bottom_2,#tools_bottom_3").toggle(!e),e?($$b(".tool_button_current").removeClass("tool_button_current").addClass("tool_button"),$$b("#tool_select").addClass("tool_button_current").removeClass("tool_button"),r("#tool_select","select_node"),G=!1,t.length&&(P=t[0])):setTimeout(function(){r("#tool_select","select")},1e3)}(a,t),H(),svgCanvas.runExtensions("selectedChanged",{elems:t,selectedElement:P,multiselected:G})}),svgCanvas.bind("transition",function(e,t){var n=svgCanvas.getMode(),r=t[0];if(r){if(!(G=t.length>=2&&!isNullish(t[1])))switch(n){case"rotate":var a=svgCanvas.getRotationAngle(r);$$b("#angle").val(a),$$b("#tool_reorient").toggleClass("disabled",0===a)}svgCanvas.runExtensions("elementTransition",{elems:t})}}),svgCanvas.bind("changed",function(e,t){var n=svgCanvas.getMode();"select"===n&&C();for(var r=0;r<t.length;++r){var a=t[r],i=a&&"svg"===a.tagName;i||Y(a)?(A(),i&&D()):a&&P&&isNullish(P.parentNode)&&(P=a)}editor.showSaveWarning=!0,H(),P&&"select"===n&&(m.fill.update(),m.stroke.update()),svgCanvas.runExtensions("elementChanged",{elems:t})}),svgCanvas.bind("saved",function(e,t){if(editor.showSaveWarning=!1,t='<?xml version="1.0"?>\n'+t,isIE())T(0,!0);else{var n=document.createElement("a");n.href="data:image/svg+xml;base64,"+encode64(t),n.download="icon.svg",n.style="display: none;",document.body.append(n),n.click();var r=$$b.pref("save_notice_done");if("all"!==r){var a=uiStrings$1.notification.saveFromBrowser.replace("%s","SVG");isGecko()?t.includes("<defs")?(a+="\n\n"+uiStrings$1.notification.defsFailOnSave,$$b.pref("save_notice_done","all"),r="all"):$$b.pref("save_notice_done","part"):$$b.pref("save_notice_done","all"),"part"!==r&&$$b.alert(a)}}}),svgCanvas.bind("exported",function(e,t){var n=t.issues,r=t.exportWindowName;if((v=window.open(blankPageObjectURL||"",r))&&!v.closed){if(v.location.href=t.bloburl||t.datauri,"all"!==$$b.pref("export_notice_done")){var a=uiStrings$1.notification.saveFromBrowser.replace("%s",t.type);n.length&&(a+="\n\n"+uiStrings$1.notification.noteTheseIssues+"\n • "+n.join("\n • ")),$$b.pref("export_notice_done","all"),v.alert(a)}}else $$b.alert(uiStrings$1.notification.popupWindowBlocked)}),svgCanvas.bind("exportedPDF",function(e,t){if(t.output){var n=t.exportWindowName;n&&(v=window.open("",n)),v&&!v.closed?v.location.href=t.output:$$b.alert(uiStrings$1.notification.popupWindowBlocked)}}),svgCanvas.bind("zoomed",Q),svgCanvas.bind("zoomDone",X),svgCanvas.bind("updateCanvas",function(e,t){var n=t.center,r=t.newCtr;D(n,r)}),svgCanvas.bind("contextset",function(e,t){var n="";if(t){var r="";n='<a href="#" data-root="y">'+svgCanvas.getCurrentDrawing().getCurrentLayerName()+"</a>",$$b(t).parentsUntil("#svgcontent > g").andSelf().each(function(){this.id&&(r+=" > "+this.id,n+=this!==t?' > <a href="#">'+this.id+"</a>":" > "+this.id)}),q=r}else q=null;$$b("#cur_context_panel").toggle(Boolean(t)).html(n),W()}),svgCanvas.bind("extension_added",se),svgCanvas.textActions.setInputElem($$b("#text")[0]);var oe='<div class="palette_item" data-rgb="none"></div>';$$b.each(["#000000","#3f3f3f","#7f7f7f","#bfbfbf","#ffffff","#ff0000","#ff7f00","#ffff00","#7fff00","#00ff00","#00ff7f","#00ffff","#007fff","#0000ff","#7f00ff","#ff00ff","#ff007f","#7f0000","#7f3f00","#7f7f00","#3f7f00","#007f00","#007f3f","#007f7f","#003f7f","#00007f","#3f007f","#7f007f","#7f003f","#ffaaaa","#ffd4aa","#ffffaa","#d4ffaa","#aaffaa","#aaffd4","#aaffff","#aad4ff","#aaaaff","#d4aaff","#ffaaff","#ffaad4"],function(e,t){oe+='<div class="palette_item" style="background-color: '+t+';" data-rgb="'+t+'"></div>'}),$$b("#palette").append(oe);oe="",$$b.each(["#FFF","#888","#000"],function(){oe+='<div class="color_block" style="background-color:'+this+';"></div>'}),$$b("#bg_blocks").append(oe);var le=$$b("#bg_blocks div"),ce="cur_background";le.each(function(){$$b(this).click(function(){le.removeClass(ce),$$b(this).addClass(ce)})}),B($$b.pref("bkgd_color"),$$b.pref("bkgd_url")),$$b("#image_save_opts input").val([$$b.pref("img_save")]);var ue=function(e,t){isNullish(t)&&(t=e.value),$$b("#group_opacity").val(t),e&&e.handle||$$b("#opac_slider").slider("option","value",t),svgCanvas.setOpacity(t/100)},de=function(e,t,n){isNullish(t)&&(t=e.value),$$b("#blur").val(t);var r=!1;e&&e.handle||($$b("#blur_slider").slider("option","value",t),r=!0),n?svgCanvas.setBlurNoUndo(t):svgCanvas.setBlur(t,r)};$$b("#stroke_style").change(function(){svgCanvas.setStrokeAttr("stroke-dasharray",$$b(this).val()),L()}),$$b("#stroke_linejoin").change(function(){svgCanvas.setStrokeAttr("stroke-linejoin",$$b(this).val()),L()}),$$b("select").change(function(){$$b(this).blur()});var he,pe,ge,fe,me,ve=!1;$$b("#selLayerNames").change(_asyncToGenerator(regeneratorRuntime.mark(function e(){var t,n,r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this.options[this.selectedIndex].value,n=uiStrings$1.notification.QmoveElemsToLayer.replace("%s",t),r=function(e){e&&(ve=!0,svgCanvas.moveSelectedToLayer(t),svgCanvas.clearSelection(),A())},!t){e.next=14;break}if(!ve){e.next=8;break}r(!0),e.next=14;break;case 8:return e.next=10,$$b.confirm(n);case 10:if(e.sent){e.next=13;break}return e.abrupt("return");case 13:r(!0);case 14:case"end":return e.stop()}},e,this)}))),$$b("#font_family").change(function(){svgCanvas.setFontFamily(this.value)}),$$b("#seg_type").change(function(){svgCanvas.setSegType($$b(this).val())}),$$b("#text").bind("keyup input",function(){svgCanvas.setTextContent(this.value)}),$$b("#image_url").change(function(){O(this.value)}),$$b("#link_url").change(function(){this.value.length?svgCanvas.setLinkURL(this.value):svgCanvas.removeHyperlink()}),$$b("#g_title").change(function(){svgCanvas.setGroupTitle(this.value)}),$$b(".attr_changer").change(function(){var e=this.getAttribute("data-attr"),t=this.value;if(!isValidUnit(e,t,P))return this.value=P.getAttribute(e),$$b.alert(uiStrings$1.notification.invalidAttrValGiven),!1;if("id"!==e&&"class"!==e)if(isNaN(t))t=svgCanvas.convertToNum(e,t);else if("px"!==curConfig.baseUnit){var n=getTypeMap();(P[e]||"pathedit"===svgCanvas.getMode()||"x"===e||"y"===e)&&(t*=n[curConfig.baseUnit])}if("id"===e){var r=P;svgCanvas.clearSelection(),r.id=t,svgCanvas.addToSelection([r],!0)}else svgCanvas.changeSelectedAttribute(e,t);return this.blur(),!0}),$$b("#palette").mouseover(function(){var e=$$b('<input type="hidden">');$$b(this).append(e),e.focus().remove()}),$$b(".palette_item").mousedown(function(e){var t,n=e.shiftKey||2===e.button?"stroke":"fill",r=$$b(this).data("rgb");"none"===r||"transparent"===r||"initial"===r?(r="none",t=new $$b.jGraduate.Paint):t=new $$b.jGraduate.Paint({alpha:100,solidColor:r.substr(1)}),m[n].setPaint(t),svgCanvas.setColor(n,r),"none"!==r&&1!==svgCanvas.getPaintOpacity(n)&&svgCanvas.setPaintOpacity(n,1),U()}).bind("contextmenu",function(e){e.preventDefault()}),$$b("#toggle_stroke_tools").on("click",function(){$$b("#tools_bottom").toggleClass("expanded")}),he=g[0],pe=null,ge=null,fe=!1,me=!1,$$b("#svgcanvas").bind("mousemove mouseup",function(e){return!1===fe||(he.scrollLeft-=e.clientX-pe,he.scrollTop-=e.clientY-ge,pe=e.clientX,ge=e.clientY,"mouseup"===e.type&&(fe=!1),!1)}).mousedown(function(e){return 1!==e.button&&!0!==me||(fe=!0,pe=e.clientX,ge=e.clientY,!1)}),$$b(window).mouseup(function(){fe=!1}),$$b(document).bind("keydown","space",function(e){svgCanvas.spaceKey=me=!0,e.preventDefault()}).bind("keyup","space",function(e){e.preventDefault(),svgCanvas.spaceKey=me=!1}).bind("keydown","shift",function(e){"zoom"===svgCanvas.getMode()&&g.css("cursor",y)}).bind("keyup","shift",function(e){"zoom"===svgCanvas.getMode()&&g.css("cursor",b)}),editor.setPanning=function(e){svgCanvas.spaceKey=me=e},function(){var e=$$b("#main_icon"),t=$$b("#main_icon span"),n=$$b("#main_menu"),r=!1,a=0,i=!0,s=!1;$$b(window).mouseup(function(t){r||(e.removeClass("buttondown"),"INPUT"!==t.target.tagName?n.fadeOut(200):s||(s=!0,$$b(t.target).click(function(){n.css("margin-left","-9999px").show()}))),r=!1}).mousedown(function(e){$$b(e.target).closest("div.tools_flyout, .contextMenu").length||$$b(".tools_flyout:visible,.contextMenu").fadeOut(250)}),t.bind("mousedown",function(){e.hasClass("buttondown")?n.fadeOut(200):(n.css("margin-left",0).show(),a||(a=n.height()),n.css("height",0).animate({height:a},200),r=!0),e.toggleClass("buttondown buttonup")}).hover(function(){r=!0}).mouseout(function(){r=!1});var o=$$b("#main_menu li");o.mouseover(function(){i="rgba(0, 0, 0, 0)"===$$b(this).css("background-color"),o.unbind("mouseover"),i&&o.mouseover(function(){this.style.backgroundColor="#FFC"}).mouseout(function(){return this.style.backgroundColor="transparent",!0})})}(),editor.addDropDown=function(e,t,n){if($$b(e).length){var r=$$b(e).find("button"),a=$$b(e).find("ul").attr("id",$$b(e)[0].id+"-list");n?$$b(e).addClass("dropup"):$$b("#option_lists").append(a),a.find("li").bind("mouseup",t);var i=!1;$$b(window).mouseup(function(e){i||(r.removeClass("down"),a.hide()),i=!1}),r.bind("mousedown",function(){if(r.hasClass("down"))a.hide();else{if(!n){var t=$$b(e).position();a.css({top:t.top+24,left:t.left-10})}a.show(),i=!0}r.toggleClass("down")}).hover(function(){i=!0}).mouseout(function(){i=!1})}},editor.addDropDown("#font_family_dropdown",function(){$$b("#font_family").val($$b(this).text()).change()}),editor.addDropDown("#opacity_dropdown",function(){if(!$$b(this).find("div").length){var e=parseInt($$b(this).text().split("%")[0]);ue(!1,e)}},!0),$$b("#opac_slider").slider({start:function(){$$b("#opacity_dropdown li:not(.special)").hide()},stop:function(){$$b("#opacity_dropdown li").show(),$$b(window).mouseup()},slide:function(e,t){ue(t)}}),editor.addDropDown("#blur_dropdown",$$b.noop);var _e,be,ye=!1;$$b("#blur_slider").slider({max:10,step:.1,stop:function(e,t){ye=!1,de(t),$$b("#blur_dropdown li").show(),$$b(window).mouseup()},start:function(){ye=!0},slide:function(e,t){de(t,null,ye)}}),editor.addDropDown("#zoom_dropdown",function(){var e=$$b(this),t=e.data("val");t?Q(window,t):K({value:parseFloat(e.text())})},!0),ae("#stroke_linecap","#linecap_opts",function(){I(this,!0)},{dropUp:!0}),ae("#stroke_linejoin","#linejoin_opts",function(){I(this,!0)},{dropUp:!0}),ae("#tool_position","#position_opts",function(){var e=this.id.replace("tool_pos","").charAt(0);svgCanvas.alignSelectedElements(e,"page")},{multiclick:!0}),be=function(){$$b(_e).blur()},$$b("#svg_editor").find("button, select, input:not(#text)").focus(function(){_e=this,x="toolbars",g.mousedown(be)}).blur(function(){x="canvas",g.unbind("mousedown",be),"textedit"===svgCanvas.getMode()&&$$b("#text").focus()});var xe,Ce=function(){M("#tool_fhpath")&&svgCanvas.setMode("fhpath")},Se=function(){M("#tool_line")&&svgCanvas.setMode("line")},we=function(){M("#tool_square")&&svgCanvas.setMode("square")},$e=function(){M("#tool_rect")&&svgCanvas.setMode("rect")},ke=function(){M("#tool_fhrect")&&svgCanvas.setMode("fhrect")},Ae=function(){M("#tool_circle")&&svgCanvas.setMode("circle")},Ee=function(){M("#tool_ellipse")&&svgCanvas.setMode("ellipse")},Ne=function(){M("#tool_fhellipse")&&svgCanvas.setMode("fhellipse")},Te=function(){M("#tool_image")&&svgCanvas.setMode("image")},Pe=function(){M("#tool_zoom")&&(svgCanvas.setMode("zoom"),g.css("cursor",b))},Ge=function(e){var t=svgCanvas.getResolution();e=e?t.zoom*e:1,$$b("#zoom").val(100*e),svgCanvas.setZoom(e),X(),D(!0)},Le=function(){M("#tool_zoom")&&(Ge(),C())},Ie=function(){M("#tool_text")&&svgCanvas.setMode("text")},Me=function(){M("#tool_path")&&svgCanvas.setMode("path")},Re=function(){isNullish(P)&&!G||svgCanvas.deleteSelectedElements()},Oe=function(){isNullish(P)&&!G||svgCanvas.cutSelectedElements()},Be=function(){isNullish(P)&&!G||svgCanvas.copySelectedElements()},Ve=function(){var e=svgCanvas.getZoom(),t=(g[0].scrollLeft+g.width()/2)/e-svgCanvas.contentW,n=(g[0].scrollTop+g.height()/2)/e-svgCanvas.contentH;svgCanvas.pasteElements("point",t,n)},je=function(){isNullish(P)||svgCanvas.moveToTopSelectedElement()},Fe=function(){isNullish(P)||svgCanvas.moveToBottomSelectedElement()},De=function(e){isNullish(P)||svgCanvas.moveUpDownSelected(e)},Ue=function(){isNullish(P)||svgCanvas.convertToPath()},He=function(){isNullish(P)||h.reorient()},ze=function(){var e=_asyncToGenerator(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(isNullish(P)&&!G){e.next=5;break}return e.next=3,$$b.prompt(uiStrings$1.notification.enterNewLinkURL,"http://");case 3:(t=e.sent)&&svgCanvas.makeHyperlink(t);case 5:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}(),qe=function(e,t){if(!isNullish(P)||G){if(curConfig.gridSnapping){var n=svgCanvas.getZoom()*curConfig.snappingStep;e*=n,t*=n}svgCanvas.moveSelectedElements(e,t)}},We=function(){$$b("#tool_node_link").toggleClass("push_button_pressed tool_button");var e=$$b("#tool_node_link").hasClass("push_button_pressed");h.linkControlPoints(e)},Ye=function(){h.getNodePoint()&&h.clonePathNode()},Xe=function(){h.getNodePoint()&&h.deletePathNode()},Qe=function(){var e=$$b("#tool_add_subpath"),t=!e.hasClass("push_button_pressed");e.toggleClass("push_button_pressed tool_button"),h.addSubPath(t)},Ke=function(){h.opencloseSubPath()},Ze=function(){svgCanvas.cycleElement(1)},Je=function(){svgCanvas.cycleElement(0)},et=function(e,t){if(!isNullish(P)&&!G){e||(t*=-1);var n=parseFloat($$b("#angle").val())+t;svgCanvas.setRotationAngle(n),H()}},tt=function(){var e=_asyncToGenerator(regeneratorRuntime.mark(function e(){var t,n,r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=_slicedToArray(curConfig.dimensions,2),n=t[0],r=t[1],e.next=3,$$b.confirm(uiStrings$1.notification.QwantToClear);case 3:if(e.sent){e.next=6;break}return e.abrupt("return");case 6:C(),svgCanvas.clear(),svgCanvas.setResolution(n,r),D(!0),Ge(),A(),H(),Z(),svgCanvas.runExtensions("onNewDocument");case 15:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}(),nt=function(){return svgCanvas.setBold(!svgCanvas.getBold()),H(),!1},rt=function(){return svgCanvas.setItalic(!svgCanvas.getItalic()),H(),!1},at=function(){var e=_asyncToGenerator(regeneratorRuntime.mark(function e(){var t,n,r,a,i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=function(){var e,t,r=uiStrings$1.notification.loadingImage;if("new"===curConfig.exportWindowType&&editor.exportWindowCt++,n=curConfig.canvasName+editor.exportWindowCt,xe)t=xe;else{if(e='<!DOCTYPE html><html>\n <head>\n <meta charset="utf-8">\n <title>'.concat(r,"</title>\n </head>\n <body><h1>").concat(r,"</h1></body>\n <html>"),"undefined"!=typeof URL&&URL.createObjectURL){var a=new Blob([e],{type:"text/html"});t=URL.createObjectURL(a)}else t="data:text/html;base64;charset=utf-8,"+encode64(e);xe=t}v=window.open(t,n)},e.next=3,$$b.select("Select an image type for export: ",["PNG","JPEG","BMP","WEBP","PDF"],function(){var e=$$b(this);"JPEG"===e.val()||"WEBP"===e.val()?$$b("#image-slider").length||$$b("<div><label>".concat(uiStrings$1.ui.quality,'\n <input id="image-slider"\n type="range" min="1" max="100" value="92" />\n </label></div>')).appendTo(e.parent()):$$b("#image-slider").parent().remove()});case 3:if(t=e.sent){e.next=6;break}return e.abrupt("return");case 6:if(a=isChrome(),"PDF"!==t){e.next=12;break}customExportPDF||a||r(),svgCanvas.exportPDF(n),e.next=16;break;case 12:return customExportImage||r(),i=parseInt($$b("#image-slider").val())/100,e.next=16,svgCanvas.rasterExport(t,i,n);case 16:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}(),it=function(){svgCanvas.open()},st=function(){},ot=function(){p.getUndoStackSize()>0&&(p.undo(),A())},lt=function(){p.getRedoStackSize()>0&&(p.redo(),A())},ct=function(){G?svgCanvas.groupSelectedElements():P&&svgCanvas.ungroupSelectedElement()},ut=function(){svgCanvas.cloneSelectedElements(20,20)},dt=function(){var e=this.id.replace("tool_align","").charAt(0);svgCanvas.alignSelectedElements(e,$$b("#align_relative_to").val())},ht=function(){if($$b("#tool_wireframe").toggleClass("push_button_pressed tool_button"),g.toggleClass("wireframe"),!Mt){var e=$$b("#wireframe_rules");e.length?e.empty():$$b('<style id="wireframe_rules"></style>').appendTo("head"),z()}};$$b("#svg_docprops_container, #svg_prefs_container").draggable({cancel:"button,fieldset",containment:"window"}).css("position","absolute");var pt,gt,ft=!1,mt=!1,vt=function(){if(!ft){ft=!0,$$b("#image_save_opts input").val([$$b.pref("img_save")]);var e=svgCanvas.getResolution();"px"!==curConfig.baseUnit&&(e.w=convertUnit(e.w)+curConfig.baseUnit,e.h=convertUnit(e.h)+curConfig.baseUnit),$$b("#canvas_width").val(e.w),$$b("#canvas_height").val(e.h),$$b("#canvas_title").val(svgCanvas.getDocumentTitle()),$$b("#svg_docprops").show()}},_t=function(){$$b("#svg_source_editor").hide(),E=!1,$$b("#svg_source_textarea").blur()},bt=function(){var e=_asyncToGenerator(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(E){e.next=2;break}return e.abrupt("return");case 2:if(t=function(){svgCanvas.clearSelection(),_t(),Ge(),A(),W(),Z()},svgCanvas.setSvgString($$b("#svg_source_textarea").val())){e.next=11;break}return e.next=6,$$b.confirm(uiStrings$1.notification.QerrorsRevertToSource);case 6:if(e.sent){e.next=9;break}return e.abrupt("return");case 9:return t(),e.abrupt("return");case 11:t(),C();case 13:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}(),yt=function(){$$b("#svg_docprops").hide(),$$b("#canvas_width,#canvas_height").removeAttr("disabled"),$$b("#resolution")[0].selectedIndex=0,$$b("#image_save_opts input").val([$$b.pref("img_save")]),ft=!1},xt=function(){$$b("#svg_prefs").hide(),mt=!1},Ct=function(){var e=$$b("#canvas_title").val();W(e),svgCanvas.setDocumentTitle(e);var t=$$b("#canvas_width"),n=t.val(),r=$$b("#canvas_height"),a=r.val();return"fit"===n||isValidUnit("width",n)?(t.parent().removeClass("error"),"fit"===a||isValidUnit("height",a)?(r.parent().removeClass("error"),svgCanvas.setResolution(n,a)?($$b.pref("img_save",$$b("#image_save_opts :checked").val()),D(),yt(),!0):($$b.alert(uiStrings$1.notification.noContentToFitTo),!1)):(r.parent().addClass("error"),$$b.alert(uiStrings$1.notification.invalidAttrValGiven),!1)):(t.parent().addClass("error"),$$b.alert(uiStrings$1.notification.invalidAttrValGiven),!1)},St=editor.savePreferences=_asyncToGenerator(regeneratorRuntime.mark(function t(){var n,r,a,i;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(B($$b("#bg_blocks div.cur_background").css("background-color")||"#FFF",$$b("#canvas_bg_url").val()),(n=$$b("#lang_select").val())===$$b.pref("lang")){t.next=11;break}return t.next=6,editor.putLocale(n,e,curConfig);case 6:return r=t.sent,a=r.langParam,i=r.langData,t.next=11,an(a,i);case 11:l($$b("#iconsize").val()),curConfig.gridSnapping=$$b("#grid_snapping_on")[0].checked,curConfig.snappingStep=$$b("#grid_snapping_step").val(),curConfig.gridColor=$$b("#grid_color").val(),curConfig.showRulers=$$b("#show_rulers")[0].checked,$$b("#rulers").toggle(curConfig.showRulers),curConfig.showRulers&&F(),curConfig.baseUnit=$$b("#base_unit").val(),svgCanvas.setConfig(curConfig),D(),xt();case 22:case"end":return t.stop()}},t,this)})),wt=$$b.noop,$t=function(){var e=_asyncToGenerator(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if($$b("#dialog_box").hide(),E||ft||mt){e.next=4;break}return q&&svgCanvas.leaveContext(),e.abrupt("return");case 4:if(!E){e.next=15;break}if(N===$$b("#svg_source_textarea").val()){e.next=12;break}return e.next=8,$$b.confirm(uiStrings$1.notification.QignoreSourceChanges);case 8:e.sent&&_t(),e.next=13;break;case 12:_t();case 13:e.next=16;break;case 15:ft?yt():mt&&xt();case 16:wt();case 17:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}(),kt={width:$$b(window).width(),height:$$b(window).height()};if(isIE()&&(wt=function(){0===g[0].scrollLeft&&0===g[0].scrollTop&&(g[0].scrollLeft=u.left,g[0].scrollTop=u.top)},u={left:g[0].scrollLeft,top:g[0].scrollTop},$$b(window).resize(wt),editor.ready(function(){return new Promise(function(e,t){setTimeout(function(){wt(),e()},500)})}),g.scroll(function(){u={left:g[0].scrollLeft,top:g[0].scrollTop}})),$$b(window).resize(function(e){$$b.each(kt,function(e,t){var n=$$b(window)[e]();g[0]["scroll"+("width"===e?"Left":"Top")]-=(n-t)/2,kt[e]=n}),s()}),g.scroll(function(){$$b("#ruler_x").length&&($$b("#ruler_x")[0].scrollLeft=g[0].scrollLeft),$$b("#ruler_y").length&&($$b("#ruler_y")[0].scrollTop=g[0].scrollTop)}),$$b("#url_notice").click(function(){$$b.alert(this.title)}),$$b("#change_image_url").click(V),pt="tool_button_current",gt="",$$b.each(["clear","open","save","source","delete","delete_multi","paste","clone","clone_multi","move_top","move_bottom"],function(e,t){gt+=(e?",":"")+"#tool_"+t}),$$b(gt).mousedown(function(){$$b(this).addClass(pt)}).bind("mousedown mouseout",function(){$$b(this).removeClass(pt)}),$$b("#tool_undo, #tool_redo").mousedown(function(){$$b(this).hasClass("disabled")||$$b(this).addClass(pt)}).bind("mousedown mouseout",function(){$$b(this).removeClass(pt)}),isMac()&&!window.opera)for(var At=["tool_clear","tool_save","tool_source","tool_undo","tool_redo","tool_clone"],Et=At.length;Et--;){var Nt=document.getElementById(At[Et]);if(Nt){var Tt=Nt.title,Pt=Tt.indexOf("Ctrl+");Nt.title=[Tt.substr(0,Pt),"Cmd+",Tt.substr(Pt+5)].join("")}}var Gt=function(e){var t="stroke_color"===e.attr("id")?"stroke":"fill",n="stroke"===t?uiStrings$1.ui.pick_stroke_paint_opacity:uiStrings$1.ui.pick_fill_paint_opacity,r=e.offset(),a=m[t].paint;$$b("#color_picker").draggable({cancel:".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker",containment:"window"}).css(curConfig.colorPickerCSS||{left:r.left-140,bottom:40}).jGraduate({paint:a,window:{pickerTitle:n},images:{clientPath:curConfig.jGraduatePath},newstop:"inverse"},function(e){a=new $$b.jGraduate.Paint(e),m[t].setPaint(a),svgCanvas.setPaint(t,a),$$b("#color_picker").hide()},function(){$$b("#color_picker").hide()})},Lt=function(){function e(t,n){_classCallCheck(this,e);var r=curConfig["fill"===n?"initFill":"initStroke"],a=(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg">\n <rect width="16.5" height="16.5"\n fill="#'.concat(r.color,'" opacity="').concat(r.opacity,'"/>\n <defs><linearGradient id="gradbox_"/></defs>\n </svg>'),"text/xml").documentElement;(a=$$b(t)[0].appendChild(document.importNode(a,!0))).setAttribute("width",16.5),this.rect=a.firstElementChild,this.defs=a.getElementsByTagName("defs")[0],this.grad=this.defs.firstElementChild,this.paint=new $$b.jGraduate.Paint({solidColor:r.color}),this.type=n}return _createClass(e,[{key:"setPaint",value:function(e,t){this.paint=e;var n=e.type,r=e.alpha/100,a="none";switch(n){case"solidColor":a="none"!==e[n]?"#"+e[n]:e[n];break;case"linearGradient":case"radialGradient":this.grad.remove(),this.grad=this.defs.appendChild(e[n]),a="url(#"+(this.grad.id="gradbox_"+this.type)+")"}this.rect.setAttribute("fill",a),this.rect.setAttribute("opacity",r),t&&(svgCanvas.setColor(this.type,this._paintColor,!0),svgCanvas.setPaintOpacity(this.type,this._paintOpacity,!0))}},{key:"update",value:function(e){if(P){var t=this.type;switch(P.tagName){case"use":case"image":case"foreignObject":return;case"g":case"a":for(var n=P.getElementsByTagName("*"),r=null,a=0,i=n.length;a<i;a++){var s=n[a].getAttribute(t);if(0===a)r=s;else if(r!==s){r=null;break}}if(null===r)return void(this._paintColor=null);this._paintColor=r,this._paintOpacity=1;break;default:this._paintOpacity=parseFloat(P.getAttribute(t+"-opacity")),isNaN(this._paintOpacity)&&(this._paintOpacity=1);var o="fill"===t?"black":"none";this._paintColor=P.getAttribute(t)||o}e&&(svgCanvas.setColor(t,this._paintColor,!0),svgCanvas.setPaintOpacity(t,this._paintOpacity,!0)),this._paintOpacity*=100;var l=function(e,t,n){var r={alpha:t};if(e.startsWith("url(#")){var a=svgCanvas.getRefElem(e);r[(a=a?a.cloneNode(!0):$$b("#"+n+"_color defs *")[0]).tagName]=a}else e.startsWith("#")?r.solidColor=e.substr(1):r.solidColor="none";return new $$b.jGraduate.Paint(r)}(this._paintColor,this._paintOpacity,t);this.setPaint(l)}}},{key:"prep",value:function(){switch(this.paint.type){case"linearGradient":case"radialGradient":var e=new $$b.jGraduate.Paint({copy:this.paint});svgCanvas.setPaint(this.type,e)}}}]),e}();m.fill=new Lt("#fill_color","fill"),m.stroke=new Lt("#stroke_color","stroke"),$$b("#stroke_width").val(curConfig.initStroke.width),$$b("#group_opacity").val(100*curConfig.initOpacity);var It=m.fill.rect.cloneNode(!1);It.setAttribute("style","vector-effect:non-scaling-stroke");var Mt="non-scaling-stroke"===It.style.vectorEffect;It.removeAttribute("style");var Rt,Ot,Bt=m.fill.rect.ownerDocument.createElementNS(NS.SVG,"feGaussianBlur");function Vt(){svgCanvas.deleteCurrentLayer()&&(H(),A(),$$b("#layerlist tr.layer").removeClass("layersel"),$$b("#layerlist tr.layer:first").addClass("layersel"))}function jt(){return(jt=_asyncToGenerator(regeneratorRuntime.mark(function e(){var t,n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=svgCanvas.getCurrentDrawing().getCurrentLayerName()+" copy",e.next=3,$$b.prompt(uiStrings$1.notification.enterUniqueLayerName,t);case 3:if(n=e.sent){e.next=6;break}return e.abrupt("return");case 6:if(!svgCanvas.getCurrentDrawing().hasLayer(n)){e.next=9;break}return $$b.alert(uiStrings$1.notification.dupeLayerName),e.abrupt("return");case 9:svgCanvas.cloneLayer(n),H(),A();case 12:case"end":return e.stop()}},e,this)}))).apply(this,arguments)}function Ft(e){var t=svgCanvas.getCurrentDrawing().getNumLayers(),n=$$b("#layerlist tr.layersel").index();(n>0||n<t-1)&&(n+=e,svgCanvas.setCurrentLayerPosition(t-n-1),A())}void 0===Bt.stdDeviationX&&$$b("#tool_blur").hide(),$$b(Bt).remove(),Rt="-"+o.toLowerCase()+"-zoom-",Ot=Rt+"in",g.css("cursor",Ot),g.css("cursor")===Ot&&(b=Ot,y=Rt+"out"),g.css("cursor","auto"),setTimeout(function(){svgCanvas.embedImage("images/logo.png",function(e){e||($$b("#image_save_opts [value=embed]").attr("disabled","disabled"),$$b("#image_save_opts input").val(["ref"]),$$b.pref("img_save","ref"),$$b("#image_opt_embed").css("color","#666").attr("title",uiStrings$1.notification.featNotSupported))})},1e3),$$b("#fill_color, #tool_fill .icon_label").click(function(){Gt($$b("#fill_color")),U()}),$$b("#stroke_color, #tool_stroke .icon_label").click(function(){Gt($$b("#stroke_color")),U()}),$$b("#group_opacityLabel").click(function(){$$b("#opacity_dropdown button").mousedown(),$$b(window).mouseup()}),$$b("#zoomLabel").click(function(){$$b("#zoom_dropdown button").mousedown(),$$b(window).mouseup()}),$$b("#tool_move_top").mousedown(function(e){$$b("#tools_stacking").show(),e.preventDefault()}),$$b(".layer_button").mousedown(function(){$$b(this).addClass("layer_buttonpressed")}).mouseout(function(){$$b(this).removeClass("layer_buttonpressed")}).mouseup(function(){$$b(this).removeClass("layer_buttonpressed")}),$$b(".push_button").mousedown(function(){$$b(this).hasClass("disabled")||$$b(this).addClass("push_button_pressed").removeClass("push_button")}).mouseout(function(){$$b(this).removeClass("push_button_pressed").addClass("push_button")}).mouseup(function(){$$b(this).removeClass("push_button_pressed").addClass("push_button")}),$$b("#layer_new").click(_asyncToGenerator(regeneratorRuntime.mark(function e(){var t,n,r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n=svgCanvas.getCurrentDrawing().getNumLayers();do{t=uiStrings$1.layers.layer+" "+ ++n}while(svgCanvas.getCurrentDrawing().hasLayer(t));return e.next=4,$$b.prompt(uiStrings$1.notification.enterUniqueLayerName,t);case 4:if(r=e.sent){e.next=7;break}return e.abrupt("return");case 7:if(!svgCanvas.getCurrentDrawing().hasLayer(r)){e.next=10;break}return $$b.alert(uiStrings$1.notification.dupeLayerName),e.abrupt("return");case 10:svgCanvas.createLayer(r),H(),A();case 13:case"end":return e.stop()}},e,this)}))),$$b("#layer_delete").click(Vt),$$b("#layer_up").click(function(){Ft(-1)}),$$b("#layer_down").click(function(){Ft(1)}),$$b("#layer_rename").click(_asyncToGenerator(regeneratorRuntime.mark(function e(){var t,n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=$$b("#layerlist tr.layersel td.layername").text(),e.next=3,$$b.prompt(uiStrings$1.notification.enterNewLayerName,"");case 3:if(n=e.sent){e.next=6;break}return e.abrupt("return");case 6:if(t!==n&&!svgCanvas.getCurrentDrawing().hasLayer(n)){e.next=9;break}return $$b.alert(uiStrings$1.notification.layerHasThatName),e.abrupt("return");case 9:svgCanvas.renameCurrentLayer(n),A();case 11:case"end":return e.stop()}},e,this)})));var Dt=-1,Ut=!1,Ht=!1,zt=function(e){var t=$$b("#ruler_x");$$b("#sidepanels").width("+="+e),$$b("#layerpanel").width("+="+e),t.css("right",parseInt(t.css("right"))+e),g.css("right",parseInt(g.css("right"))+e),svgCanvas.runExtensions("workareaResized")},qt=function(e){if(Ht&&-1!==Dt){Ut=!0;var t=Dt-e.pageX,n=$$b("#sidepanels").width();n+t>300?t=300-n:n+t<2&&(t=2-n),0!==t&&(Dt-=t,zt(t))}},Wt=function(e){var t=$$b("#sidepanels").width();zt((t>2||e?2:150)-t)};$$b("#sidepanel_handle").mousedown(function(e){Dt=e.pageX,$$b(window).mousemove(qt),Ht=!1,setTimeout(function(){Ht=!0},20)}).mouseup(function(e){Ut||Wt(),Dt=-1,Ut=!1}),$$b(window).mouseup(function(){Dt=-1,Ut=!1,$$b("#svg_editor").unbind("mousemove",qt)}),A();$$b(window).bind("load resize",function(){g.css("line-height",g.height()+"px")}),$$b("#resolution").change(function(){var e=$$b("#canvas_width,#canvas_height");if(this.selectedIndex)if("content"===this.value)e.val("fit").attr("disabled","disabled");else{var t=this.value.split("x");$$b("#canvas_width").val(t[0]),$$b("#canvas_height").val(t[1]),e.removeAttr("disabled")}else"fit"===$$b("#canvas_width").val()&&e.removeAttr("disabled").val(100)}),$$b("input,select").attr("autocomplete","off");var Yt,Xt,Qt=["#tool_source_cancel","#tool_docprops_cancel","#tool_prefs_cancel",".overlay"],Kt=(Yt=[{sel:"#tool_select",fn:R,evt:"click",key:["V",!0]},{sel:"#tool_fhpath",fn:Ce,evt:"click",key:["Q",!0]},{sel:"#tool_line",fn:Se,evt:"click",key:["L",!0],parent:"#tools_line",prepend:!0},{sel:"#tool_rect",fn:$e,evt:"mouseup",key:["R",!0],parent:"#tools_rect",icon:"rect"},{sel:"#tool_square",fn:we,evt:"mouseup",parent:"#tools_rect",icon:"square"},{sel:"#tool_fhrect",fn:ke,evt:"mouseup",parent:"#tools_rect",icon:"fh_rect"},{sel:"#tool_ellipse",fn:Ee,evt:"mouseup",key:["E",!0],parent:"#tools_ellipse",icon:"ellipse"},{sel:"#tool_circle",fn:Ae,evt:"mouseup",parent:"#tools_ellipse",icon:"circle"},{sel:"#tool_fhellipse",fn:Ne,evt:"mouseup",parent:"#tools_ellipse",icon:"fh_ellipse"},{sel:"#tool_path",fn:Me,evt:"click",key:["P",!0]},{sel:"#tool_text",fn:Ie,evt:"click",key:["T",!0]},{sel:"#tool_image",fn:Te,evt:"mouseup"},{sel:"#tool_zoom",fn:Pe,evt:"mouseup",key:["Z",!0]},{sel:"#tool_clear",fn:tt,evt:"mouseup",key:["N",!0]},{sel:"#tool_save",fn:function(){var e;E?bt():(e={images:$$b.pref("img_save"),round_digits:6},svgCanvas.save(e))},evt:"mouseup",key:["S",!0]},{sel:"#tool_export",fn:at,evt:"mouseup"},{sel:"#tool_open",fn:it,evt:"mouseup",key:["O",!0]},{sel:"#tool_import",fn:st,evt:"mouseup"},{sel:"#tool_source",fn:T,evt:"click",key:["U",!0]},{sel:"#tool_wireframe",fn:ht,evt:"click",key:["F",!0]},{key:["esc",!1,!1],fn:function(){Qt.every(function(e){return $$b(e+":hidden").length})&&svgCanvas.clearSelection()},hidekey:!0},{sel:Qt.join(","),fn:$t,evt:"click",key:["esc",!1,!1],hidekey:!0},{sel:"#tool_source_save",fn:bt,evt:"click"},{sel:"#tool_docprops_save",fn:Ct,evt:"click"},{sel:"#tool_docprops",fn:vt,evt:"mouseup"},{sel:"#tool_prefs_save",fn:St,evt:"click"},{sel:"#tool_prefs_option",fn:function(){return function(){if(!mt){mt=!0,$$b("#main_menu").hide();var e=curPrefs.bkgd_color,t=$$b.pref("bkgd_url");le.each(function(){var t=$$b(this),n=t.css("background-color")===e;t.toggleClass(ce,n),n&&$$b("#canvas_bg_url").removeClass(ce)}),e||le.eq(0).addClass(ce),t&&$$b("#canvas_bg_url").val(t),$$b("#grid_snapping_on").prop("checked",curConfig.gridSnapping),$$b("#grid_snapping_step").attr("value",curConfig.snappingStep),$$b("#grid_color").attr("value",curConfig.gridColor),$$b("#svg_prefs").show()}}(),!1},evt:"mouseup"},{sel:"#tool_delete,#tool_delete_multi",fn:Re,evt:"click",key:["del/backspace",!0]},{sel:"#tool_reorient",fn:He,evt:"click"},{sel:"#tool_node_link",fn:We,evt:"click"},{sel:"#tool_node_clone",fn:Ye,evt:"click"},{sel:"#tool_node_delete",fn:Xe,evt:"click"},{sel:"#tool_openclose_path",fn:Ke,evt:"click"},{sel:"#tool_add_subpath",fn:Qe,evt:"click"},{sel:"#tool_move_top",fn:je,evt:"click",key:"ctrl+shift+]"},{sel:"#tool_move_bottom",fn:Fe,evt:"click",key:"ctrl+shift+["},{sel:"#tool_topath",fn:Ue,evt:"click"},{sel:"#tool_make_link,#tool_make_link_multi",fn:ze,evt:"click"},{sel:"#tool_undo",fn:ot,evt:"click"},{sel:"#tool_redo",fn:lt,evt:"click"},{sel:"#tool_clone,#tool_clone_multi",fn:ut,evt:"click",key:["D",!0]},{sel:"#tool_group_elements",fn:ct,evt:"click",key:["G",!0]},{sel:"#tool_ungroup",fn:ct,evt:"click"},{sel:"#tool_unlink_use",fn:ct,evt:"click"},{sel:"[id^=tool_align]",fn:dt,evt:"click"},{sel:"#tool_bold",fn:nt,evt:"mousedown"},{sel:"#tool_italic",fn:rt,evt:"mousedown"},{sel:"#sidepanel_handle",fn:Wt,key:["X"]},{sel:"#copy_save_done",fn:$t,evt:"click"},{key:"ctrl+left",fn:function(){et(0,1)}},{key:"ctrl+right",fn:function(){et(1,1)}},{key:"ctrl+shift+left",fn:function(){et(0,5)}},{key:"ctrl+shift+right",fn:function(){et(1,5)}},{key:"shift+O",fn:Je},{key:"shift+P",fn:Ze},{key:[d+"up",!0],fn:function(){Ge(2)}},{key:[d+"down",!0],fn:function(){Ge(.5)}},{key:[d+"]",!0],fn:function(){De("Up")}},{key:[d+"[",!0],fn:function(){De("Down")}},{key:["up",!0],fn:function(){qe(0,-1)}},{key:["down",!0],fn:function(){qe(0,1)}},{key:["left",!0],fn:function(){qe(-1,0)}},{key:["right",!0],fn:function(){qe(1,0)}},{key:"shift+up",fn:function(){qe(0,-10)}},{key:"shift+down",fn:function(){qe(0,10)}},{key:"shift+left",fn:function(){qe(-10,0)}},{key:"shift+right",fn:function(){qe(10,0)}},{key:["alt+up",!0],fn:function(){svgCanvas.cloneSelectedElements(0,-1)}},{key:["alt+down",!0],fn:function(){svgCanvas.cloneSelectedElements(0,1)}},{key:["alt+left",!0],fn:function(){svgCanvas.cloneSelectedElements(-1,0)}},{key:["alt+right",!0],fn:function(){svgCanvas.cloneSelectedElements(1,0)}},{key:["alt+shift+up",!0],fn:function(){svgCanvas.cloneSelectedElements(0,-10)}},{key:["alt+shift+down",!0],fn:function(){svgCanvas.cloneSelectedElements(0,10)}},{key:["alt+shift+left",!0],fn:function(){svgCanvas.cloneSelectedElements(-10,0)}},{key:["alt+shift+right",!0],fn:function(){svgCanvas.cloneSelectedElements(10,0)}},{key:"a",fn:function(){svgCanvas.selectAllInCurrentLayer()}},{key:d+"a",fn:function(){svgCanvas.selectAllInCurrentLayer()}},{key:d+"z",fn:ot},{key:d+"shift+z",fn:lt},{key:d+"y",fn:lt},{key:d+"x",fn:Oe},{key:d+"c",fn:Be},{key:d+"v",fn:Ve}],Xt={"4/Shift+4":"#tools_rect_show","5/Shift+5":"#tools_ellipse_show"},{setAll:function(){var e={};$$b.each(Yt,function(t,n){var r;if(n.sel){if(!(r=$$b(n.sel)).length)return!0;if(n.evt&&(isTouch()&&"click"===n.evt&&(n.evt="mousedown"),r[n.evt](n.fn)),n.parent&&$$b(n.parent+"_show").length){var a=$$b(n.parent);a.length||(a=re(n.parent.substr(1))),n.prepend&&(r[0].style.margin="initial"),a[n.prepend?"prepend":"append"](r),Array.isArray(e[n.parent])||(e[n.parent]=[]),e[n.parent].push(n)}}if(n.key){var i,s=!1;Array.isArray(n.key)?(i=n.key[0],n.key.length>1&&(s=n.key[1])):i=n.key,i=String(i);var o=n.fn;if($$b.each(i.split("/"),function(e,t){$$b(document).bind("keydown",t,function(e){return o(),s&&e.preventDefault(),!1})}),n.sel&&!n.hidekey&&r.attr("title")){var l=r.attr("title").split("[")[0]+" ("+i+")";Xt[i]=n.sel,r.parents("#main_menu").length||r.attr("title",l)}}return!0}),ne(e),$$b(".attr_changer, #image_url").bind("keydown","return",function(e){$$b(this).change(),e.preventDefault()}),$$b(window).bind("keydown","tab",function(e){"canvas"===x&&(e.preventDefault(),Ze())}).bind("keydown","shift+tab",function(e){"canvas"===x&&(e.preventDefault(),Je())}),$$b("#tool_zoom").dblclick(Le)},setTitles:function(){$$b.each(Xt,function(e,t){var n=$$b(t).parents("#main_menu").length;$$b(t).each(function(){var t;t=n?$$b(this).text().split(" [")[0]:this.title.split(" [")[0];var r="";$$b.each(e.split("/"),function(e,t){var n=t.split("+"),a="";n.length>1&&(a=n[0]+"+",t=n[1]),r+=(e?"/":"")+a+(uiStrings$1["key_"+t]||t)}),n?this.lastChild.textContent=t+" ["+r+"]":this.title=t+" ["+r+"]"})})},getButtonData:function(e){return Object.values(Yt).find(function(t){return t.sel===e})}});editor.ready(function(){var e=curConfig.initTool,t=$$b("#tools_left, #svg_editor .tools_flyout"),n=t.find("#tool_"+e),r=t.find("#"+e);(n.length?n:r.length?r:$$b("#tool_select")).click().mouseup(),curConfig.wireframe&&$$b("#tool_wireframe").click(),curConfig.showlayers&&Wt(),$$b("#rulers").toggle(Boolean(curConfig.showRulers)),curConfig.showRulers&&($$b("#show_rulers")[0].checked=!0),curConfig.baseUnit&&$$b("#base_unit").val(curConfig.baseUnit),curConfig.gridSnapping&&($$b("#grid_snapping_on")[0].checked=!0),curConfig.snappingStep&&$$b("#grid_snapping_step").val(curConfig.snappingStep),curConfig.gridColor&&$$b("#grid_color").val(curConfig.gridColor)}),$$b("#rect_rx").SpinButton({min:0,max:1e3,stateObj:i,callback:function(e){svgCanvas.setRectRadius(e.value)}}),$$b("#stroke_width").SpinButton({min:0,max:99,smallStep:.1,stateObj:i,callback:function(e){var t=e.value;0===t&&P&&["line","polyline"].includes(P.nodeName)&&(t=e.value=1),svgCanvas.setStrokeWidth(t)}}),$$b("#angle").SpinButton({min:-180,max:180,step:5,stateObj:i,callback:function(e){svgCanvas.setRotationAngle(e.value),$$b("#tool_reorient").toggleClass("disabled",0===parseInt(e.value))}}),$$b("#font_size").SpinButton({min:.001,stepfunc:function(e,t){var n=Number(e.value),r=n+t,a=r>=n;return 0===t?n:n>=24?a?Math.round(1.1*n):Math.round(n/1.1):n<=1?a?2*n:n/2:r},stateObj:i,callback:function(e){svgCanvas.setFontSize(e.value)}}),$$b("#group_opacity").SpinButton({min:0,max:100,step:5,stateObj:i,callback:ue}),$$b("#blur").SpinButton({min:0,max:10,step:.1,stateObj:i,callback:de}),$$b("#zoom").SpinButton({min:.001,max:1e4,step:50,stepfunc:function(e,t){var n=Number(e.value);if(0===n)return 100;var r=n+t;return 0===t?n:n>=100?r:r>=n?2*n:n/2},stateObj:i,callback:K}).val(100*svgCanvas.getZoom()),$$b("#workarea").contextMenu({menu:"cmenu_canvas",inSpeed:0},function(e,t,n){switch(e){case"delete":Re();break;case"cut":Oe();break;case"copy":Be();break;case"paste":svgCanvas.pasteElements();break;case"paste_in_place":svgCanvas.pasteElements("in_place");break;case"group":case"group_elements":svgCanvas.groupSelectedElements();break;case"ungroup":svgCanvas.ungroupSelectedElement();break;case"move_front":je();break;case"move_up":De("Up");break;case"move_down":De("Down");break;case"move_back":Fe();break;default:hasCustomHandler(e)&&getCustomHandler(e).call()}});var Zt=function(e,t,n){switch(e){case"dupe":!function(){jt.apply(this,arguments)}();break;case"delete":Vt();break;case"merge_down":$$b("#layerlist tr.layersel").index()!==svgCanvas.getCurrentDrawing().getNumLayers()-1&&(svgCanvas.mergeLayer(),H(),A());break;case"merge_all":svgCanvas.mergeAllLayers(),H(),A()}};function Jt(){var e;try{e=localStorage.getItem("svgedit_clipboard")}catch(e){}f[(e?"en":"dis")+"ableContextMenuItems"]("#paste,#paste_in_place")}if($$b("#layerlist").contextMenu({menu:"cmenu_layers",inSpeed:0},Zt),$$b("#layer_moreopts").contextMenu({menu:"cmenu_layers",inSpeed:0,allowLeft:!0},Zt),$$b(".contextMenu li").mousedown(function(e){e.preventDefault()}),$$b("#cmenu_canvas li").disableContextMenu(),f.enableContextMenuItems("#delete,#cut,#copy"),Jt(),window.addEventListener("storage",function(e){"svgedit_clipboard"===e.key&&Jt()}),window.addEventListener("beforeunload",function(e){return 0===p.getUndoStackSize()&&(editor.showSaveWarning=!1),!(!curConfig.no_save_warning&&editor.showSaveWarning)||(e.returnValue=uiStrings$1.notification.unsavedChanges,uiStrings$1.notification.unsavedChanges)}),editor.canvas.getUIStrings=function(){return uiStrings$1},editor.openPrep=function(){return $$b("#main_menu").hide(),0===p.getUndoStackSize()||$$b.confirm(uiStrings$1.notification.QwantToOpen)},window.FileReader){var en=function(e){$$b.process_cancel(uiStrings$1.notification.loadingImage),e.stopPropagation(),e.preventDefault(),$$b("#workarea").removeAttr("style"),$$b("#main_menu").hide();var t,n="drop"===e.type?e.dataTransfer.files[0]:this.files[0];n?n.type.includes("image")&&(n.type.includes("svg")?((t=new FileReader).onloadend=function(e){var t=svgCanvas.importSvgString(e.target.result,!0);svgCanvas.ungroupSelectedElement(),svgCanvas.ungroupSelectedElement(),svgCanvas.groupSelectedElements(),svgCanvas.alignSelectedElements("m","page"),svgCanvas.alignSelectedElements("c","page"),svgCanvas.selectOnly([t]),$$b("#dialog_box").hide()},t.readAsText(n)):((t=new FileReader).onloadend=function(e){var t=e.target.result,n=100,r=100,a=new Image;a.style.opacity=0,a.onload=function(){var e,i,s;n=a.offsetWidth||a.naturalWidth||a.width,r=a.offsetHeight||a.naturalHeight||a.height,e=n,i=r,s=svgCanvas.addSVGElementFromJson({element:"image",attr:{x:0,y:0,width:e,height:i,id:svgCanvas.getNextId(),style:"pointer-events:inherit"}}),svgCanvas.setHref(s,t),svgCanvas.selectOnly([s]),svgCanvas.alignSelectedElements("m","page"),svgCanvas.alignSelectedElements("c","page"),H(),$$b("#dialog_box").hide()},a.src=t},t.readAsDataURL(n))):$$b("#dialog_box").hide()};g[0].addEventListener("dragenter",function(e){e.stopPropagation(),e.preventDefault()}),g[0].addEventListener("dragover",function(e){e.stopPropagation(),e.preventDefault()}),g[0].addEventListener("dragleave",function(e){e.stopPropagation(),e.preventDefault()}),g[0].addEventListener("drop",en);var tn=$$b('<input type="file">').click(_asyncToGenerator(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,editor.openPrep();case 2:if(e.sent){e.next=5;break}return e.abrupt("return");case 5:svgCanvas.clear(),1===this.files.length&&($$b.process_cancel(uiStrings$1.notification.loadingImage),(t=new FileReader).onloadend=function(){var e=_asyncToGenerator(regeneratorRuntime.mark(function e(t){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,loadSvgString(t.target.result);case 2:D();case 3:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}(),t.readAsText(this.files[0]));case 7:case"end":return e.stop()}},e,this)})));$$b("#tool_open").show().prepend(tn);var nn=$$b('<input type="file">').change(en);$$b("#tool_import").show().prepend(nn)}D(!0);var rn=[],an=editor.setLang=function(){var e=_asyncToGenerator(regeneratorRuntime.mark(function e(t,n){var r,a,i,s=this;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(editor.langChanged=!0,$$b.pref("lang",t),$$b("#lang_select").val(t),n){e.next=5;break}return e.abrupt("return");case 5:if($$b.extend(uiStrings$1,n),r=$$b("#layerlist tr.layersel td.layername").text(),a=r===uiStrings$1.common.layer+" 1",svgCanvas.setUiStrings(n),Kt.setTitles(),a&&(svgCanvas.renameCurrentLayer(uiStrings$1.common.layer+" 1"),A()),!ie.length){e.next=17;break}return e.next=14,Promise.all(ie.map(function(e){return rn.push(e.name),e.langReady({lang:t,uiStrings:uiStrings$1,importLocale:getImportLocale({defaultLang:t,defaultName:e.name})})}));case 14:ie.length=0,e.next=18;break;case 17:rn.forEach(function(e){s.runExtension(e,"langReady",{lang:t,uiStrings:uiStrings$1,importLocale:getImportLocale({defaultLang:t,defaultName:e})})});case 18:svgCanvas.runExtensions("langChanged",t),ee(),i={"#stroke_color":"#tool_stroke .icon_label, #tool_stroke .color_block","#fill_color":"#tool_fill label, #tool_fill .color_block","#linejoin_miter":"#cur_linejoin","#linecap_butt":"#cur_linecap"},$$b.each(i,function(e,t){$$b(t).attr("title",$$b(e)[0].title)}),$$b("#multiselected_panel div[id^=tool_align]").each(function(){$$b("#tool_pos"+this.id.substr(10))[0].title=this.title});case 23:case"end":return e.stop()}},e,this)}));return function(t,n){return e.apply(this,arguments)}}();init$7({addLangData:function(e){return svgCanvas.runExtensions("addLangData",function(t){return{lang:e,importLocale:getImportLocale({defaultLang:e,defaultName:t})}},!0)},curConfig:curConfig}),"file:"===document.location.protocol?setTimeout(a,100):a()},editor.ready=function(e){return new Promise(function(t,n){isReady?t(e()):callbacks.push([e,t,n])})},editor.runCallbacks=_asyncToGenerator(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,Promise.all(callbacks.map(function(e){return(0,_slicedToArray(e,1)[0])()}));case 3:e.next=9;break;case 5:throw e.prev=5,e.t0=e.catch(0),callbacks.forEach(function(e){(0,_slicedToArray(e,3)[2])()}),e.t0;case 9:callbacks.forEach(function(e){(0,_slicedToArray(e,2)[1])()}),isReady=!0;case 11:case"end":return e.stop()}},e,this,[[0,5]])})),editor.loadFromString=function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).noAlert;editor.ready(_asyncToGenerator(regeneratorRuntime.mark(function n(){return regeneratorRuntime.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,n.next=3,loadSvgString(e,{noAlert:t});case 3:n.next=9;break;case 5:if(n.prev=5,n.t0=n.catch(0),!t){n.next=9;break}throw n.t0;case 9:case"end":return n.stop()}},n,this,[[0,5]])})))},editor.disableUI=function(e){},editor.loadFromURL=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.cache,r=t.noAlert;return editor.ready(function(){return new Promise(function(t,a){$$b.ajax({url:e,dataType:"text",cache:Boolean(n),beforeSend:function(){$$b.process_cancel(uiStrings$1.notification.loadingImage)},success:function(e){t(loadSvgString(e,{noAlert:r}))},error:function(e,n,i){404!==e.status&&e.responseText?t(loadSvgString(e.responseText,{noAlert:r})):r?a(new Error("URLLoadFail")):($$b.alert(uiStrings$1.notification.URLLoadFail+": \n"+i),t())},complete:function(){$$b("#dialog_box").hide()}})})})},editor.loadFromDataURI=function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).noAlert;editor.ready(function(){var n=!1,r=e.match(/^data:image\/svg\+xml;base64,/);r?n=!0:r=e.match(/^data:image\/svg\+xml(?:;(?:utf8)?)?,/),r&&(r=r[0]);var a=e.slice(r.length);return loadSvgString(n?decode64(a):decodeURIComponent(a),{noAlert:t})})},editor.addExtension=function(e,t,n){if(!svgCanvas)throw new Error("Extension added too early");return svgCanvas.addExtension.call(this,e,t,n)},editor.ready(function(){injectExtendedContextMenuItemsIntoDom()});var extensionsAdded=!1,messageQueue=[],messageListener=function(e){var t={data:e.data,origin:e.origin};extensionsAdded?svgCanvas.call("message",t):messageQueue.push(t)};window.addEventListener("message",messageListener),_asyncToGenerator(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,Promise.resolve();case 3:editor.init(),e.next=9;break;case 6:e.prev=6,e.t0=e.catch(0),console.error(e.t0);case 9:case"end":return e.stop()}},e,this,[[0,6]])}))();export default editor;
|
|
//# sourceMappingURL=index-es.min.js.map
|