svgedit/dist/index-es.min.js

3 lines
348 KiB
JavaScript

function e(t){return(e="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})(t)}function t(e,t,n,r,a,i,o){try{var s=e[i](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,a)}function n(e){return function(){var n=this,r=arguments;return new Promise(function(a,i){var o=e.apply(n,r);function s(e){t(o,a,i,s,l,"next",e)}function l(e){t(o,a,i,s,l,"throw",e)}s(void 0)})}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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 i(e,t,n){return t&&a(e.prototype,t),n&&a(e,n),e}function o(){return(o=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 s(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&&c(e,t)}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function c(e,t){return(c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function u(e,t,n){return(u=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var a=new(Function.bind.apply(e,r));return n&&c(a,n.prototype),a}).apply(null,arguments)}function d(e){var t="function"==typeof Map?new Map:void 0;return(d=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return u(e,arguments,l(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),c(r,e)})(e)}function h(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function p(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],r=!0,a=!1,i=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){a=!0,i=e}finally{try{r||null==s.return||s.return()}finally{if(a)throw i}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function f(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function g(e,t){g=function(e,t){return new i(e,t)};var n=d(RegExp),r=RegExp.prototype,a=new WeakMap;function i(e,t){var r=n.call(this,e);return a.set(r,t),r}function o(e,t){var n=a.get(t);return Object.keys(n).reduce(function(t,r){return t[r]=e[n[r]],t},Object.create(null))}return s(i,n),i.prototype.exec=function(e){var t=r.exec.call(this,e);return t&&(t.groups=o(t,this)),t},i.prototype[Symbol.replace]=function(e,t){if("string"==typeof t){var n=a.get(this);return r[Symbol.replace].call(this,e,t.replace(/\$<([^>]+)>/g,function(e,t){return"$"+n[t]}))}if("function"==typeof t){var i=this;return r[Symbol.replace].call(this,e,function(){var e=[];return e.push.apply(e,arguments),"object"!=typeof e[e.length-1]&&e.push(o(e,i)),t.apply(this,e)})}return r[Symbol.replace].call(this,e,t)},g.apply(this,arguments)}function m(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,o=n.clientX,s=n.clientY,l=new MouseEvent(r,{bubbles:!0,cancelable:!0,view:window,detail:1,screenX:a,screenY:i,clientX:o,clientY:s,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,button:0,relatedTarget:null});t.length<2&&(n.target.dispatchEvent(l),e.preventDefault())}document.addEventListener("touchstart",m,!0),document.addEventListener("touchmove",m,!0),document.addEventListener("touchend",m,!0),document.addEventListener("touchcancel",m,!0);var v={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/"},y=function(){var e={};return Object.entries(v).forEach(function(t){var n=p(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,a){r(this,e),this.pathSegType=t,this.pathSegTypeAsLetter=n,this._owningPathSegList=a}return i(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 r(this,n),h(this,l(n).call(this,e.PATHSEG_CLOSEPATH,"z",t))}return s(n,e),i(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,a,i){var o;return r(this,n),(o=h(this,l(n).call(this,e.PATHSEG_MOVETO_ABS,"M",t)))._x=a,o._y=i,o}return s(n,e),i(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 a=function(t){function n(t,a,i){var o;return r(this,n),(o=h(this,l(n).call(this,e.PATHSEG_MOVETO_REL,"m",t)))._x=a,o._y=i,o}return s(n,e),i(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(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 o=function(t){function n(t,a,i){var o;return r(this,n),(o=h(this,l(n).call(this,e.PATHSEG_LINETO_ABS,"L",t)))._x=a,o._y=i,o}return s(n,e),i(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(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}});var c=function(t){function n(t,a,i){var o;return r(this,n),(o=h(this,l(n).call(this,e.PATHSEG_LINETO_REL,"l",t)))._x=a,o._y=i,o}return s(n,e),i(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(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}});var u=function(t){function n(t,a,i,o,s,c,u){var d;return r(this,n),(d=h(this,l(n).call(this,e.PATHSEG_CURVETO_CUBIC_ABS,"C",t)))._x=a,d._y=i,d._x1=o,d._y1=s,d._x2=c,d._y2=u,d}return s(n,e),i(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(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},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 d=function(t){function n(t,a,i,o,s,c,u){var d;return r(this,n),(d=h(this,l(n).call(this,e.PATHSEG_CURVETO_CUBIC_REL,"c",t)))._x=a,d._y=i,d._x1=o,d._y1=s,d._x2=c,d._y2=u,d}return s(n,e),i(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(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},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 p=function(t){function n(t,a,i,o,s){var c;return r(this,n),(c=h(this,l(n).call(this,e.PATHSEG_CURVETO_QUADRATIC_ABS,"Q",t)))._x=a,c._y=i,c._x1=o,c._y1=s,c}return s(n,e),i(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(p.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 f=function(t){function n(t,a,i,o,s){var c;return r(this,n),(c=h(this,l(n).call(this,e.PATHSEG_CURVETO_QUADRATIC_REL,"q",t)))._x=a,c._y=i,c._x1=o,c._y1=s,c}return s(n,e),i(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(f.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 g=function(t){function n(t,a,i,o,s,c,u,d){var p;return r(this,n),(p=h(this,l(n).call(this,e.PATHSEG_ARC_ABS,"A",t)))._x=a,p._y=i,p._r1=o,p._r2=s,p._angle=c,p._largeArcFlag=u,p._sweepFlag=d,p}return s(n,e),i(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(g.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 m=function(t){function n(t,a,i,o,s,c,u,d){var p;return r(this,n),(p=h(this,l(n).call(this,e.PATHSEG_ARC_REL,"a",t)))._x=a,p._y=i,p._r1=o,p._r2=s,p._angle=c,p._largeArcFlag=u,p._sweepFlag=d,p}return s(n,e),i(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(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},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 v=function(t){function n(t,a){var i;return r(this,n),(i=h(this,l(n).call(this,e.PATHSEG_LINETO_HORIZONTAL_ABS,"H",t)))._x=a,i}return s(n,e),i(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(v.prototype,"x",{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0});var y=function(t){function n(t,a){var i;return r(this,n),(i=h(this,l(n).call(this,e.PATHSEG_LINETO_HORIZONTAL_REL,"h",t)))._x=a,i}return s(n,e),i(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(y.prototype,"x",{get:function(){return this._x},set:function(e){this._x=e,this._segmentChanged()},enumerable:!0});var _=function(t){function n(t,a){var i;return r(this,n),(i=h(this,l(n).call(this,e.PATHSEG_LINETO_VERTICAL_ABS,"V",t)))._y=a,i}return s(n,e),i(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(_.prototype,"y",{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0});var b=function(t){function n(t,a){var i;return r(this,n),(i=h(this,l(n).call(this,e.PATHSEG_LINETO_VERTICAL_REL,"v",t)))._y=a,i}return s(n,e),i(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(b.prototype,"y",{get:function(){return this._y},set:function(e){this._y=e,this._segmentChanged()},enumerable:!0});var x=function(t){function n(t,a,i,o,s){var c;return r(this,n),(c=h(this,l(n).call(this,e.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS,"S",t)))._x=a,c._y=i,c._x2=o,c._y2=s,c}return s(n,e),i(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(x.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 w=function(t){function n(t,a,i,o,s){var c;return r(this,n),(c=h(this,l(n).call(this,e.PATHSEG_CURVETO_CUBIC_SMOOTH_REL,"s",t)))._x=a,c._y=i,c._x2=o,c._y2=s,c}return s(n,e),i(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(w.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 S=function(t){function n(t,a,i){var o;return r(this,n),(o=h(this,l(n).call(this,e.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS,"T",t)))._x=a,o._y=i,o}return s(n,e),i(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(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}});var k=function(t){function n(t,a,i){var o;return r(this,n),(o=h(this,l(n).call(this,e.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL,"t",t)))._x=a,o._y=i,o}return s(n,e),i(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(k.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 a(void 0,e,t)},SVGPathElement.prototype.createSVGPathSegLinetoAbs=function(e,t){return new o(void 0,e,t)},SVGPathElement.prototype.createSVGPathSegLinetoRel=function(e,t){return new c(void 0,e,t)},SVGPathElement.prototype.createSVGPathSegCurvetoCubicAbs=function(e,t,n,r,a,i){return new u(void 0,e,t,n,r,a,i)},SVGPathElement.prototype.createSVGPathSegCurvetoCubicRel=function(e,t,n,r,a,i){return new d(void 0,e,t,n,r,a,i)},SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticAbs=function(e,t,n,r){return new p(void 0,e,t,n,r)},SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticRel=function(e,t,n,r){return new f(void 0,e,t,n,r)},SVGPathElement.prototype.createSVGPathSegArcAbs=function(e,t,n,r,a,i,o){return new g(void 0,e,t,n,r,a,i,o)},SVGPathElement.prototype.createSVGPathSegArcRel=function(e,t,n,r,a,i,o){return new m(void 0,e,t,n,r,a,i,o)},SVGPathElement.prototype.createSVGPathSegLinetoHorizontalAbs=function(e){return new v(void 0,e)},SVGPathElement.prototype.createSVGPathSegLinetoHorizontalRel=function(e){return new y(void 0,e)},SVGPathElement.prototype.createSVGPathSegLinetoVerticalAbs=function(e){return new _(void 0,e)},SVGPathElement.prototype.createSVGPathSegLinetoVerticalRel=function(e){return new b(void 0,e)},SVGPathElement.prototype.createSVGPathSegCurvetoCubicSmoothAbs=function(e,t,n,r){return new x(void 0,e,t,n,r)},SVGPathElement.prototype.createSVGPathSegCurvetoCubicSmoothRel=function(e,t,n,r){return new w(void 0,e,t,n,r)},SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticSmoothAbs=function(e,t){return new S(void 0,e,t)},SVGPathElement.prototype.createSVGPathSegCurvetoQuadraticSmoothRel=function(e,t){return new k(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=a,window.SVGPathSegLinetoAbs=o,window.SVGPathSegLinetoRel=c,window.SVGPathSegCurvetoCubicAbs=u,window.SVGPathSegCurvetoCubicRel=d,window.SVGPathSegCurvetoQuadraticAbs=p,window.SVGPathSegCurvetoQuadraticRel=f,window.SVGPathSegArcAbs=g,window.SVGPathSegArcRel=m,window.SVGPathSegLinetoHorizontalAbs=v,window.SVGPathSegLinetoHorizontalRel=y,window.SVGPathSegLinetoVerticalAbs=_,window.SVGPathSegLinetoVerticalRel=b,window.SVGPathSegCurvetoCubicSmoothAbs=x,window.SVGPathSegCurvetoCubicSmoothRel=w,window.SVGPathSegCurvetoQuadraticSmoothAbs=S,window.SVGPathSegCurvetoQuadraticSmoothRel=k}if(!("SVGPathSegList"in window&&"appendItem"in window.SVGPathSegList.prototype)){var C=function(){function e(t){r(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 i(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(){r(this,e),this.pathSegList=[]}return i(e,[{key:"appendSegment",value:function(e){this.pathSegList.push(e)}}]),e}(),a=function(){function e(t){r(this,e),this._string=t,this._currentIndex=0,this._endIndex=this._string.length,this._previousCommand=SVGPathSeg.PATHSEG_UNKNOWN,this._skipOptionalSpaces()}return i(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,o=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 s=this._currentIndex;this._currentIndex<this._endIndex&&this._string.charAt(this._currentIndex)>="0"&&this._string.charAt(this._currentIndex)<="9";)this._currentIndex++;if(this._currentIndex!==s)for(var l=this._currentIndex-1,c=1;l>=s;)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!==o&&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)),o!==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 o={x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoCubicSmoothAbs(t,o.x,o.y,o.x2,o.y2);case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL:var s={x1:this._parseNumber(),y1:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()};return new SVGPathSegCurvetoQuadraticRel(t,s.x,s.y,s.x1,s.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}(),o=new n,s=new a(e);if(!s.initialCommandIsMoveTo())return[];for(;s.hasMoreData();){var l=s.parseSegment();if(!l)return[];o.appendSegment(l)}return o.pathSegList}}],[{key:"_pathSegArrayAsString",value:function(e){var t="",n=!0;return e.forEach(function(e){n?(n=!1,t+=e._asPathString()):t+=" "+e._asPathString()}),t}}]),e}();C.prototype.classname="SVGPathSegList",Object.defineProperty(C.prototype,"numberOfItems",{get:function(){return this._checkPathSynchronizedToList(),this._list.length},enumerable:!0}),Object.defineProperties(SVGPathElement.prototype,{pathSegList:{get:function(){return this._pathSegList||(this._pathSegList=new C(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=C}}();var _,b=jQuery,x=(Boolean(document.createElementNS&&document.createElementNS(v.SVG,"svg").createSVGRect),navigator.userAgent),w=document.createElementNS(v.SVG,"svg"),S=Boolean(window.opera),k=x.includes("AppleWebKit"),C=x.includes("Gecko/"),A=x.includes("MSIE"),E=x.includes("Chrome/"),G=(x.includes("Windows"),x.includes("Macintosh")),P="ontouchstart"in window,I=Boolean(w.querySelector),N=Boolean(document.evaluate),T=function(){var e=document.createElementNS(v.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}(),L=function(){var e=document.createElementNS(v.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}(),M=function(){var e=document.createElementNS(v.SVG,"svg"),t=document.createElementNS(v.SVG,"svg");document.documentElement.append(e),t.setAttribute("x",5),e.append(t);var n=document.createElementNS(v.SVG,"text");n.textContent="a",t.append(n);try{return 0===n.getStartPositionOfChar(0).x}catch(e){return!1}finally{e.remove()}}(),O=function(){var e=document.createElementNS(v.SVG,"svg");document.documentElement.append(e);var t=document.createElementNS(v.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}(),j=function(){var e=document.createElementNS(v.SVG,"svg");document.documentElement.append(e);var t=document.createElementNS(v.SVG,"path");t.setAttribute("d","M0,0 10,0");var n=document.createElementNS(v.SVG,"path");n.setAttribute("d","M5,0 15,0");var r=document.createElementNS(v.SVG,"g");r.append(t,n),e.append(r);var a=r.getBBox();return e.remove(),15===a.width}(),V=(function(){var e=document.createElementNS(v.SVG,"rect");e.setAttribute("x",.1);var t=!e.cloneNode(!1).getAttribute("x").includes(",");t||b.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.')}(),(_=document.createElementNS(v.SVG,"rect")).setAttribute("style","vector-effect:non-scaling-stroke"),"non-scaling-stroke"===_.style.vectorEffect),R=function(){var t=document.createElementNS(v.SVG,"rect").transform.baseVal,n=w.createSVGTransform();t.appendItem(n);var r=t.getItem(0),a=function(t){return t&&"object"===e(t)&&"function"==typeof t.setMatrix&&"angle"in t};return a(r)&&a(n)&&r.type===n.type&&r.angle===n.angle&&r.matrix.a===n.matrix.a&&r.matrix.b===n.matrix.b&&r.matrix.c===n.matrix.c&&r.matrix.d===n.matrix.d&&r.matrix.e===n.matrix.e&&r.matrix.f===n.matrix.f}(),B=function(){return S},D=function(){return k},U=function(){return C},F=function(){return A},H=function(){return E},z=function(){return G},q=function(){return P},Y=function(){return j},W=function(){return V};function X(t){var n=t.fn.attr;return t.fn.attr=function(t,r){var a=this.length;if(!a)return n.call(this,t,r);for(var i=0;i<a;++i){var o=this[i];if("http://www.w3.org/2000/svg"!==o.namespaceURI)return n.call(this,t,r);if(void 0!==r)o.setAttribute(t,r);else if(Array.isArray(t)){for(var s={},l=t.length;l--;){var c=t[l],u=o.getAttribute(c);(u||"0"===u)&&(u=isNaN(u)?u:u-0),s[c]=u}return s}if("object"!==e(t)){var d=o.getAttribute(t);return(d||"0"===d)&&(d=isNaN(d)?d:d-0),d}for(var h=0,f=Object.entries(t);h<f.length;h++){var g=p(f[h],2),m=g[0],v=g[1];o.setAttribute(m,v)}}return this},t}var Q=document.createElementNS(v.SVG,"svg");function K(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 Z,$={},J=function(){function e(t){r(this,e),this._elem=t||null,this._xforms=[],this._update=function(){for(var e="",t=0;t<this.numberOfItems;++t){e+=K(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=g(/\s*((?:scale|matrix|rotate|translate)\s*\(.*?\))\s*,?\s*/,{xform:1}),r=!0;r;)r=t.match(n),t=t.replace(n,""),r&&r.groups.xform&&function(){var t=p(r.groups.xform.split(/\s*\(/),2),n=t[0],a=t[1].match(g(/\s*(.*?)\s*\)/,{nonWhitespace:1}));a.groups.nonWhitespace=a.groups.nonWhitespace.replace(g(/(\d)-/g,{digit:1}),"$<digit> -");var i=a.groups.nonWhitespace.split(/[, ]+/),o=f("abcdef"),s=Q.createSVGMatrix();Object.values(i).forEach(function(e,t){i[t]=parseFloat(e),"matrix"===n&&(s[o[t]]=i[t])});var l=Q.createSVGTransform(),c="set"+n.charAt(0).toUpperCase()+n.slice(1),u="matrix"===n?[s]: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,f(u)),e._list.appendItem(l)}()},this._removeFromOtherLists=function(e){e&&Object.values($).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 i(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}(),ee=function(e){e.id&&$[e.id]&&delete $[e.id]},te=function(e){if(!R){var t=e.id||"temp",n=$[t];return n&&"temp"!==t||($[t]=new J(e),$[t]._init(),n=$[t]),n}return e.transform?e.transform.baseVal:e.gradientTransform?e.gradientTransform.baseVal:e.patternTransform?e.patternTransform.baseVal:null},ne=["x","x1","cx","rx","width"],re=["y","y1","cy","ry","height"],ae=["r","radius"].concat(ne,re),ie={},oe=function(){return ie},se=function e(t){var n=Z.getRoundDigits();return isNaN(t)?Array.isArray(t)?e(t[0])+","+e(t[1]):parseFloat(t).toFixed(n)-0:Number(Number(t).toFixed(n))},le=function(e,t){return t=t||Z.getBaseUnit(),se(e/ie[t])},ce=function(e,t,n){e.setAttribute(t,n)},ue=function(e,t){if(!isNaN(t))return t-0;if("%"===t.substr(-1)){var n=t.substr(0,t.length-1)/100,r=Z.getWidth(),a=Z.getHeight();return ne.includes(e)?n*r:re.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)*ie[i]},de=function(e,t,n){if(ae.includes(e))return!isNaN(t)||(t=t.toLowerCase(),Object.keys(ie).some(function(e){return new RegExp("^-?[\\d\\.]+"+e+"$").test(t)}));if("id"===e){var r=!1;try{var a=Z.getElement(t);r=ln(a)||a===n}catch(e){}return r}return!0},he={BEFORE_APPLY:"before_apply",AFTER_APPLY:"after_apply",BEFORE_UNAPPLY:"before_unapply",AFTER_UNAPPLY:"after_unapply"},pe=function(){function e(){r(this,e)}return i(e,[{key:"getText",value:function(){return this.text}}]),e}(),fe=function(e){function t(e,n,a,i){var o;return r(this,t),(o=h(this,l(t).call(this))).elem=e,o.text=i?"Move "+e.tagName+" to "+i:"Move "+e.tagName,o.oldNextSibling=n,o.oldParent=a,o.newNextSibling=e.nextSibling,o.newParent=e.parentNode,o}return s(t,pe),i(t,[{key:"type",value:function(){return"svgedit.history.MoveElementCommand"}},{key:"apply",value:function(e){e&&e.handleHistoryEvent(he.BEFORE_APPLY,this),this.elem=this.newParent.insertBefore(this.elem,this.newNextSibling),e&&e.handleHistoryEvent(he.AFTER_APPLY,this)}},{key:"unapply",value:function(e){e&&e.handleHistoryEvent(he.BEFORE_UNAPPLY,this),this.elem=this.oldParent.insertBefore(this.elem,this.oldNextSibling),e&&e.handleHistoryEvent(he.AFTER_UNAPPLY,this)}},{key:"elements",value:function(){return[this.elem]}}]),t}();fe.type=fe.prototype.type;var ge=function(e){function t(e,n){var a;return r(this,t),(a=h(this,l(t).call(this))).elem=e,a.text=n||"Create "+e.tagName,a.parent=e.parentNode,a.nextSibling=a.elem.nextSibling,a}return s(t,pe),i(t,[{key:"type",value:function(){return"svgedit.history.InsertElementCommand"}},{key:"apply",value:function(e){e&&e.handleHistoryEvent(he.BEFORE_APPLY,this),this.elem=this.parent.insertBefore(this.elem,this.nextSibling),e&&e.handleHistoryEvent(he.AFTER_APPLY,this)}},{key:"unapply",value:function(e){e&&e.handleHistoryEvent(he.BEFORE_UNAPPLY,this),this.parent=this.elem.parentNode,this.elem=this.elem.parentNode.removeChild(this.elem),e&&e.handleHistoryEvent(he.AFTER_UNAPPLY,this)}},{key:"elements",value:function(){return[this.elem]}}]),t}();ge.type=ge.prototype.type;var me=function(e){function t(e,n,a,i){var o;return r(this,t),(o=h(this,l(t).call(this))).elem=e,o.text=i||"Delete "+e.tagName,o.nextSibling=n,o.parent=a,ee(e),o}return s(t,pe),i(t,[{key:"type",value:function(){return"svgedit.history.RemoveElementCommand"}},{key:"apply",value:function(e){e&&e.handleHistoryEvent(he.BEFORE_APPLY,this),ee(this.elem),this.parent=this.elem.parentNode,this.elem=this.parent.removeChild(this.elem),e&&e.handleHistoryEvent(he.AFTER_APPLY,this)}},{key:"unapply",value:function(e){e&&e.handleHistoryEvent(he.BEFORE_UNAPPLY,this),ee(this.elem),ln(this.nextSibling)&&window.console&&console.log("Error: reference element was lost"),this.parent.insertBefore(this.elem,this.nextSibling),e&&e.handleHistoryEvent(he.AFTER_UNAPPLY,this)}},{key:"elements",value:function(){return[this.elem]}}]),t}();me.type=me.prototype.type;var ve=function(e){function t(e,n,a){var i;for(var o in r(this,t),(i=h(this,l(t).call(this))).elem=e,i.text=a?"Change "+e.tagName+" "+a:"Change "+e.tagName,i.newValues={},i.oldValues=n,n)i.newValues[o]="#text"===o?e.textContent:"#href"===o?Rt(e):e.getAttribute(o);return i}return s(t,pe),i(t,[{key:"type",value:function(){return"svgedit.history.ChangeElementCommand"}},{key:"apply",value:function(e){var t=this;e&&e.handleHistoryEvent(he.BEFORE_APPLY,this);var n=!1;if(Object.entries(this.newValues).forEach(function(e){var r=p(e,2),a=r[0],i=r[1];i?"#text"===a?t.elem.textContent=i:"#href"===a?Bt(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=en(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(he.AFTER_APPLY,this),!0}},{key:"unapply",value:function(e){var t=this;e&&e.handleHistoryEvent(he.BEFORE_UNAPPLY,this);var n=!1;if(Object.entries(this.oldValues).forEach(function(e){var r=p(e,2),a=r[0],i=r[1];i?"#text"===a?t.elem.textContent=i:"#href"===a?Bt(t.elem,i):t.elem.setAttribute(a,i):"#text"===a?t.elem.textContent="":t.elem.removeAttribute(a),"transform"===a&&(n=!0)}),!n){var r=en(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 ee(this.elem),e&&e.handleHistoryEvent(he.AFTER_UNAPPLY,this),!0}},{key:"elements",value:function(){return[this.elem]}}]),t}();ve.type=ve.prototype.type;var ye=function(e){function t(e){var n;return r(this,t),(n=h(this,l(t).call(this))).text=e||"Batch Command",n.stack=[],n}return s(t,pe),i(t,[{key:"type",value:function(){return"svgedit.history.BatchCommand"}},{key:"apply",value:function(e){e&&e.handleHistoryEvent(he.BEFORE_APPLY,this);for(var t=this.stack.length,n=0;n<t;++n)this.stack[n].apply(e);e&&e.handleHistoryEvent(he.AFTER_APPLY,this)}},{key:"unapply",value:function(e){e&&e.handleHistoryEvent(he.BEFORE_UNAPPLY,this);for(var t=this.stack.length-1;t>=0;t--)this.stack[t].unapply(e);e&&e.handleHistoryEvent(he.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}();ye.type=ye.prototype.type;var _e,be,xe,we,Se,ke=function(){function e(t){r(this,e),this.handler_=t||null,this.undoStackPointer=0,this.undoStack=[],this.undoChangeStackPointer=-1,this.undoableChangeStack=[]}return i(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 o=t[r];ln(o)||(i[r]=o,a[r]=o.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 ye("Change "+n),a=t.elements.length;a--;){var i=t.elements[a];if(!ln(i)){var o={};o[n]=t.oldValues[a],o[n]!==i.getAttribute(n)&&r.addSubCommand(new ve(i,o,n))}}return this.undoableChangeStack[e]=null,r}}]),e}(),Ce=Object.freeze({HistoryEventTypes:he,MoveElementCommand:fe,InsertElementCommand:ge,RemoveElementCommand:me,ChangeElementCommand:ve,BatchCommand:ye,UndoManager:ke}),Ae=document.createElementNS(v.SVG,"svg"),Ee=function(e,t,n){return{x:n.a*e+n.c*t+n.e,y:n.b*e+n.d*t+n.f}},Ge=function(e){return 1===e.a&&0===e.b&&0===e.c&&1===e.d&&0===e.e&&0===e.f},Pe=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)<1e-14&&(r.a=0),Math.abs(r.b)<1e-14&&(r.b=0),Math.abs(r.c)<1e-14&&(r.c=0),Math.abs(r.d)<1e-14&&(r.d=0),Math.abs(r.e)<1e-14&&(r.e=0),Math.abs(r.f)<1e-14&&(r.f=0),r},Ie=function(e){if(!e)return!1;for(var t=e.numberOfItems;t--;){var n=e.getItem(t);if(1===n.type&&!Ge(n.matrix))return!0}return!1},Ne=function(e,t,n,r,a){var i=Ee(e,t,a),o=Ee(e+n,t,a),s=Ee(e,t+r,a),l=Ee(e+n,t+r,a),c=Math.min(i.x,o.x,s.x,l.x),u=Math.max(i.x,o.x,s.x,l.x),d=Math.min(i.y,o.y,s.y,l.y);return{tl:i,tr:o,bl:s,br:l,aabox:{x:c,y:d,width:u-c,height:Math.max(i.y,o.y,s.y,l.y)-d}}},Te=function(e,t,n){if(ln(e))return Ae.createSVGTransformFromMatrix(Ae.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=Ae.createSVGMatrix(),i=t;i<=n;++i){var o=i>=0&&i<e.numberOfItems?e.getItem(i).matrix:Ae.createSVGMatrix();a=Pe(a,o)}return Ae.createSVGTransformFromMatrix(a)},Le=function(e){var t=te(e);return Te(t).matrix},Me=function(e,t,n,r){var a=Math.PI/4,i=n-e,o=r-t,s=Math.atan2(o,i),l=Math.sqrt(i*i+o*o),c=Math.round(s/a)*a;return{x:e+l*Math.cos(c),y:t+l*Math.sin(c),a:c}},Oe=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},je=jQuery,Ve={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"]},Re={},Be=function(e){Object.assign(Re,e.ui)},De=[],Ue=!0,Fe={},He=null,ze=null,qe=function(e){ze=e,De=[0,"ClosePath"];je.each(["Moveto","Lineto","CurvetoCubic","CurvetoQuadratic","Arc","LinetoHorizontal","LinetoVertical","CurvetoCubicSmooth","CurvetoQuadraticSmooth"],function(e,t){De.push(t+"Abs"),De.push(t+"Rel")})},Ye=function(e,t,n){var r=e.pathSegList;if(L)r.insertItemBefore(t,n);else{for(var a=r.numberOfItems,i=[],o=0;o<a;o++){var s=r.getItem(o);i.push(s)}r.clear();for(var l=0;l<a;l++)l===n&&r.appendItem(t),r.appendItem(i[l])}},We=function(e,t){return Ve[e].map(function(e){return t[e]})},Xe=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=Ee(r.x,r.y,n.matrix));var a=ze.getCurrentZoom();return r.x*=a,r.y*=a,r},Qe=function(e,t){var n={x:e.x,y:e.y};t.matrix&&(e=Ee(n.x,n.y,t.imatrix),n.x=e.x,n.y=e.y);var r=ze.getCurrentZoom();return n.x/=r,n.y/=r,n},Ke=function(e,t,n){var r=Ze(),a=nn("pathpointgrip_"+e);if(!a){a=document.createElementNS(v.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 Re&&(i["xlink:title"]=Re.pathNodeTooltip),rn(a,i),a=r.appendChild(a),je("#pathpointgrip_"+e).dblclick(function(){He&&He.setSegType()})}return t&&n&&rn(a,{cx:t,cy:n,display:"inline"}),a},Ze=function(){var e=nn("pathpointgrip_container");e||((e=nn("selectorParentGroup").appendChild(document.createElementNS(v.SVG,"g"))).id="pathpointgrip_container");return e},$e=function(e){var t=nn("ctrlpointgrip_"+e);if(t)return t;t=document.createElementNS(v.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 Re&&(n["xlink:title"]=Re.pathCtrlPtTooltip),rn(t,n),Ze().append(t),t},Je=function(e){var t=nn("ctrlLine_"+e);return t||(t=document.createElementNS(v.SVG,"line"),rn(t,{id:"ctrlLine_"+e,stroke:"#555","stroke-width":1,style:"pointer-events:none"}),Ze().append(t),t)},et=function(e){var t=e.item,n=e.index;if(!("x1"in t&&"x2"in t))return null;var r={};Ze();for(var a=[He.segs[n-1].item,t],i=1;i<3;i++){var o=n+"c"+i,s=r["c"+i+"_line"]=Je(o),l=Xe(e,{x:t["x"+i],y:t["y"+i]}),c=Xe(e,{x:a[i-1].x,y:a[i-1].y});rn(s,{x1:l.x,y1:l.y,x2:c.x,y2:c.y,display:"inline"}),r["c"+i+"_line"]=s;var u=r["c"+i]=$e(o);rn(u,{cx:l.x,cy:l.y,display:"inline"}),r["c"+i]=u}return r},tt=function(e,t,n,r){var a=r||He.elem,i=a["createSVGPathSeg"+De[e]].apply(a,f(n));if(T)a.pathSegList.replaceItem(i,t);else{for(var o=a.pathSegList,s=o.numberOfItems,l=[],c=0;c<s;c++){var u=o.getItem(c);l.push(u)}o.clear();for(var d=0;d<s;d++)d===t?o.appendItem(i):o.appendItem(l[d])}},nt=function(e,t){var n=e.index,r=nn("segline_"+n);if(!r){var a=Ze();r=document.createElementNS(v.SVG,"path"),rn(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 o=Xe(i);tt(2,0,[o.x,o.y],r);for(var s=We(e.type,e.item),l=0;l<s.length;l+=2){var c=Xe(e,{x:s[l],y:s[l+1]});s[l]=c.x,s[l+1]=c.y}tt(e.type,1,s,r)}return r},rt=function(e,t,n){var r=e.x-n.x,a=e.y-n.y,i=t.x-n.x,o=t.y-n.y;if(!(0===r&&0===a||0===i&&0===o)){var s=Math.sqrt(r*r+a*a),l=Math.sqrt(i*i+o*o),c=ze.getSVGRoot().createSVGPoint(),u=ze.getSVGRoot().createSVGPoint(),d=Math.atan2(a,r),h=Math.atan2(o,i);d<0&&(d+=2*Math.PI),h<0&&(h+=2*Math.PI);var p,f,g=Math.abs(d-h),m=Math.abs(Math.PI-g)/2;return d-h>0?(p=g<Math.PI?d+m:d-m,f=g<Math.PI?h-m:h+m):(p=g<Math.PI?d-m:d+m,f=g<Math.PI?h+m:h-m),c.x=s*Math.cos(p)+n.x,c.y=s*Math.sin(p)+n.y,u.x=l*Math.cos(f)+n.x,u.y=l*Math.sin(f)+n.y,[c,u]}},at=function(){function e(t,n){r(this,e),this.selected=!1,this.index=t,this.item=n,this.type=n.pathSegType,this.ctrlpts=[],this.ptgrip=null,this.segsel=null}return i(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){je("#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=function(e,t){var n=e.index,r=Ke(n);if(t){var a=Xe(e);rn(r,{cx:a.x,cy:a.y,display:"inline"})}return r}(this,!0),this.ctrlpts=et(this),this.segsel=nt(this,!0)}},{key:"update",value:function(e){if(this.ptgrip){var t=Xe(this);rn(this.ptgrip,{cx:t.x,cy:t.y}),nt(this,!0),this.ctrlpts&&(e&&(this.item=He.elem.pathSegList.getItem(this.index),this.type=this.item.pathSegType),et(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(tt(this.type,this.index,10===this.type?We(this.type,n):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];tt(this.next.type,this.next.index,i)}if(this.mate){var o=this.mate.item,s=[o.x+=e,o.y+=t];tt(this.mate.type,this.mate.index,s)}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];tt(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];tt(this.type,this.index,a),this.update(!0)}},{key:"setType",value:function(e,t){tt(e,this.index,t),this.type=e,this.item=He.elem.pathSegList.getItem(this.index),this.showCtrlPts(6===e),this.ctrlpts=et(this),this.update(!0)}}]),e}(),it=function(){function e(t){if(r(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=[],He=this,this.init()}return i(e,[{key:"init",value:function(){je(Ze()).find("*").each(function(){je(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 at(n,r);a.path=this,this.segs.push(a)}for(var i=this.segs,o=null,s=0;s<t;s++){var l=i[s],c=s+1>=t?null:i[s+1],u=s-1<0?null:i[s-1];if(2===l.type){if(u&&1!==u.type){var d=i[o];d.next=i[o+1],d.next.prev=d,d.addGrip()}o=s}else if(c&&1===c.type)l.next=i[o+1],l.next.prev=l,l.mate=i[o],l.addGrip(),ln(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[o];h.next=i[o+1],h.next.prev=h,h.addGrip(),l.addGrip(),this.first_seg||(this.first_seg=i[o])}}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 o=(i.item.x+t.item.x1)/2,s=(t.item.x1+t.item.x2)/2,l=(t.item.x2+t.item.x)/2,c=(o+s)/2,u=(s+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,f=(d+h)/2,g=(h+p)/2;a=(f+g)/2,n=this.elem.createSVGPathSegCurvetoCubicAbs(r,a,o,d,c,f);var m=[t.item.x,t.item.y,u,g,l,p];tt(t.type,e,m)}Ye(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];tt(2,r.index,a),tt(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];tt(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),Ue&&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 o=a.item.x,s=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=[o,s,d.x1,d.y1,d.x2,d.y2]}else{var h=o-l,p=s-c;u=[o,s,l+h/3,c+p/3,o-h/3,s-p/3]}break;case 4:u=[o,s],a.olditem=a.item}a.setType(e,u)}}He.endChanges(t)}},{key:"selectPt",value:function(e,t){this.clearSelection(),ln(e)&&this.eachSeg(function(t){this.prev&&(e=t)}),this.addPtsToSelection(e),t&&(this.dragctrl=t,Ue&&this.segs[e].setLinked(t))}},{key:"update",value:function(){var e=this.elem;return en(e)?(this.matrix=Le(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){D()&&ze.resetD(this.elem);var t=new ve(this.elem,{d:this.last_d},e);ze.endChanges({cmd:t,elem:this.elem})}},{key:"addPtsToSelection",value:function(t){var n=this;Array.isArray(t)||(t=[t]),t.forEach(function(e){n.segs[e].ptgrip&&!n.selected_pts.includes(e)&&e>=0&&n.selected_pts.push(e)}),this.selected_pts.sort();var r=this.selected_pts.length,a=[];for(a.length=r;r--;){var i=this.selected_pts[r],o=this.segs[i];o.select(!0),a[r]=o.ptgrip}var s=e.subpathIsClosed(this.selected_pts[0]);ze.addPtsToSelection({grips:a,closedSubpath:s})}}],[{key:"subpathIsClosed",value:function(e){var t=!1;return He.eachSeg(function(n){return n<=e||2!==this.type&&(1!==this.type||(t=!0,!1))}),t}}]),e}(),ot=function(e){var t=Fe[e.id];return t||(t=Fe[e.id]=new it(e)),t},st=function(e){e in Fe&&delete Fe[e]},lt=function(e,t){var n=e-xe,r=t-we,a=Math.sqrt(n*n+r*r),i=Math.atan2(r,n)+Se;return n=a*Math.cos(i)+xe,r=a*Math.sin(i)+we,n-=_e,r-=be,a=Math.sqrt(n*n+r*r),i=Math.atan2(r,n)-Se,{x:a*Math.cos(i)+_e,y:a*Math.sin(i)+be}},ct=function(){var e=He.elem;if(Se=en(e,!0)){var t=He.oldbbox;xe=t.x+t.width/2,we=t.y+t.height/2;var n=Ht(e);_e=n.x+n.width/2,be=n.y+n.height/2;var r=_e-xe,a=be-we,i=Math.sqrt(r*r+a*a),o=Math.atan2(a,r)+Se;_e=i*Math.cos(o)+xe,be=i*Math.sin(o)+we;for(var s=e.pathSegList,l=s.numberOfItems;l;){l-=1;var c=s.getItem(l),u=c.pathSegType;if(1!==u){var d=lt(c.x,c.y),h=[d.x,d.y];if(!ln(c.x1)&&!ln(c.x2)){var p=lt(c.x1,c.y1),f=lt(c.x2,c.y2);h.splice(h.length,0,p.x,p.y,f.x,f.y)}tt(u,l,h)}}Ht(e);var g=ze.getSVGRoot().createSVGTransform(),m=te(e);g.setRotate(180*Se/Math.PI,_e,be),m.replaceItem(g,0)}},ut=[0,"z","M","m","L","l","C","c","Q","q","A","a","H","h","V","v","S","s","T","t"],dt=function(e,t){for(var n=e.pathSegList,r=n.numberOfItems,a=0,i=0,o="",s=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,f=c.x2||0,g=c.y2||0,m=c.pathSegType,v=ut[m]["to"+(t?"Lower":"Upper")+"Case"]();switch(m){case 1:o+="z",s&&!t&&(a=s[0],i=s[1]);break;case 12:u-=a;case 13:t?(a+=u,v="l"):(a=u+=a,v="L"),o+=ht(v,[[u,i]]);break;case 14:d-=i;case 15:t?(i+=d,v="l"):(i=d+=i,v="L"),o+=ht(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||(s=[a,i]),o+=ht(v,[[u,d]]);break;case 6:u-=a,h-=a,f-=a,d-=i,p-=i,g-=i;case 7:t?(a+=u,i+=d):(h+=a,f+=a,p+=i,g+=i,a=u+=a,i=d+=i),o+=ht(v,[[h,p],[f,g],[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),o+=ht(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),o+=ht(v,[[c.r1,c.r2]],[c.angle,c.largeArcFlag?1:0,c.sweepFlag?1:0],[u,d]);break;case 16:u-=a,f-=a,d-=i,g-=i;case 17:t?(a+=u,i+=d):(f+=a,g+=i,a=u+=a,i=d+=i),o+=ht(v,[[f,g],[u,d]])}}return o};function ht(e,t,n,r){je.each(t,function(e,n){t[e]=se(n)});var a=e+t.join(" ");return n&&(a+=" "+n.join(" ")),r&&(a+=" "+se(r)),a}var pt,ft,gt,mt,vt,yt=(gt=!1,mt=null,vt=!1,{mouseDown:function(e,t,n,r){var a;if("path"!==ze.getCurrentMode()){if(He){var i;if(He.storeD(),"pathpointgrip_"===(a=e.target.id).substr(0,14)){i=He.cur_pt=parseInt(a.substr(14)),He.dragging=[n,r];var o=He.segs[i];e.shiftKey?o.selected?He.removePtFromSelection(i):He.addPtsToSelection(i):((He.selected_pts.length<=1||!o.selected)&&He.clearSelection(),He.addPtsToSelection(i))}else if(a.startsWith("ctrlpointgrip_")){He.dragging=[n,r];var s=a.split("_")[1].split("c");i=Number(s[0]);var l=Number(s[1]);He.selectPt(i,l)}if(!He.dragging){var c=ze.getRubberBox();ln(c)&&(c=ze.setRubberBox(ze.selectorManager.getRubberBandBox()));var u=ze.getCurrentZoom();rn(c,{x:n*u,y:r*u,width:0,height:0,display:"inline"})}}}else{var d=n,h=r,p=ze.getCurrentZoom(),f=d/p,g=h/p,m=nn("path_stretch_line");pt=[f,g],ze.getGridSnapping()&&(f=on(f),g=on(g),d=on(d),h=on(h)),m||(m=document.createElementNS(v.SVG,"path"),rn(m,{id:"path_stretch_line",stroke:"#22C","stroke-width":"0.5",fill:"none"}),m=nn("selectorParentGroup").appendChild(m)),m.setAttribute("display","inline");var y,_=ze.getDrawnPath();if(_){for(var b=_.pathSegList,x=b.numberOfItems,w=6/p,S=!1;x;){x--;var k=b.getItem(x),C=k.x,A=k.y;if(f>=C-w&&f<=C+w&&g>=A-w&&g<=A+w){S=!0;break}}a=ze.getId(),st(a);var E,G,P=nn(a),I=b.numberOfItems;if(S){if(x<=1&&I>=2){var N=b.getItem(0).x,T=b.getItem(0).y;E=4===(G=m.pathSegList.getItem(1)).pathSegType?_.createSVGPathSegLinetoAbs(N,T):_.createSVGPathSegCurvetoCubicAbs(N,T,G.x1/p,G.y1/p,N,T);var L=_.createSVGPathSegClosePath();b.appendItem(E),b.appendItem(L)}else if(I<3)return!1;if(je(m).remove(),ze.setDrawnPath(null),ze.setStarted(!1),gt){He.matrix&&ze.remapElement(P,{},He.matrix.inverse());var M=P.getAttribute("d"),O=je(He.elem).attr("d");return je(He.elem).attr("d",O+M),je(P).remove(),He.matrix&&ct(),qe(),yt.toEditMode(He.elem),He.selectPt(),!1}}else{if(!je.contains(ze.getContainer(),ze.getMouseTarget(e)))return!1;var j=_.pathSegList.numberOfItems,V=_.pathSegList.getItem(j-1),R=V.x,B=V.y;if(e.shiftKey){var D=Me(R,B,f,g);f=D.x,g=D.y}E=4===(G=m.pathSegList.getItem(1)).pathSegType?_.createSVGPathSegLinetoAbs(ze.round(f),ze.round(g)):_.createSVGPathSegCurvetoCubicAbs(ze.round(f),ze.round(g),G.x1/p,G.y1/p,G.x2/p,G.y2/p),_.pathSegList.appendItem(E),f*=p,g*=p,m.setAttribute("d",["M",f,g,f,g].join(" ")),y=j,gt&&(y+=He.segs.length),Ke(y,f,g)}}else{var U="M"+f+","+g+" ";ze.setDrawnPath(ze.addSVGElementFromJson({element:"path",curStyles:!0,attr:{d:U,id:ze.getNextId(),opacity:ze.getOpacity()/2}})),m.setAttribute("d",["M",d,h,d,h].join(" ")),y=gt?He.segs.length:0,Ke(y,d,h)}}},mouseMove:function(e,t){var n=ze.getCurrentZoom();vt=!0;var r=ze.getDrawnPath();if("path"!==ze.getCurrentMode())if(He.dragging){var a=Qe({x:He.dragging[0],y:He.dragging[1]},He),i=Qe({x:e,y:t},He),o=i.x-a.x,s=i.y-a.y;He.dragging=[e,t],He.dragctrl?He.moveCtrl(o,s):He.movePts(o,s)}else He.selected_pts=[],He.eachSeg(function(e){if(this.next||this.prev){var t=ze.getRubberBox().getBBox(),n=Xe(this),r={x:n.x,y:n.y,width:0,height:0},a=Oe(t,r);this.select(a),a&&He.selected_pts.push(this.index)}});else{if(!r)return;var l=r.pathSegList,c=l.numberOfItems-1;if(pt){var u=$e("1c1"),d=$e("0c2");u.setAttribute("cx",e),u.setAttribute("cy",t),u.setAttribute("display","inline");var h=pt[0],p=pt[1],f=h+(h-e/n),g=p+(p-t/n);d.setAttribute("cx",f*n),d.setAttribute("cy",g*n),d.setAttribute("display","inline");var m=Je(1);if(rn(m,{x1:e,y1:t,x2:f*n,y2:g*n,display:"inline"}),0===c)ft=[e,t];else{var v=l.getItem(c-1),y=v.x,_=v.y;6===v.pathSegType?(y+=y-v.x2,_+=_-v.y2):ft&&(y=ft[0]/n,_=ft[1]/n),tt(6,c,[h,p,y,_,f,g],r)}}else{var b=nn("path_stretch_line");if(b){var x=l.getItem(c);if(6===x.pathSegType){var w=x.x+(x.x-x.x2),S=x.y+(x.y-x.y2);tt(6,1,[e,t,w*n,S*n,e,t],b)}else ft?tt(6,1,[e,t,ft[0],ft[1],e,t],b):tt(4,1,[e,t],b)}}}},mouseUp:function(e,t,n,r){var a=ze.getDrawnPath();if("path"===ze.getCurrentMode())return pt=null,a||(t=nn(ze.getId()),ze.setStarted(!1),ft=null),{keep:!0,element:t};var i=ze.getRubberBox();if(He.dragging){var o=He.cur_pt;He.dragging=!1,He.dragctrl=!1,He.update(),vt&&He.endChanges("Move path point(s)"),e.shiftKey||vt||He.selectPt(o)}else i&&"none"!==i.getAttribute("display")?(i.setAttribute("display","none"),i.getAttribute("width")<=2&&i.getAttribute("height")<=2&&yt.toSelectMode(e.target)):yt.toSelectMode(e.target);vt=!1},toEditMode:function(e){He=ot(e),ze.setCurrentMode("pathedit"),ze.clearSelection(),He.show(!0).update(),He.oldbbox=Ht(He.elem),gt=!1},toSelectMode:function(e){var t=e===He.elem;ze.setCurrentMode("select"),He.show(!1),mt=!1,ze.clearSelection(),He.matrix&&ct(),t&&(ze.call("selected",[e]),ze.addToSelection([e],!0))},addSubPath:function(e){e?(ze.setCurrentMode("path"),gt=!0):(yt.clear(!0),yt.toEditMode(He.elem))},select:function(e){mt===e?(yt.toEditMode(e),ze.setCurrentMode("pathedit")):mt=e},reorient:function(){var e=ze.getSelectedElements()[0];if(e&&0!==en(e)){var t=new ye("Reorient path"),n={d:e.getAttribute("d"),transform:e.getAttribute("transform")};t.addSubCommand(new ve(e,n)),ze.clearSelection(),this.resetOrientation(e),ze.addCommandToHistory(t),ot(e).show(!1).matrix=null,this.clear(),ze.addToSelection([e],!0),ze.call("changed",ze.getSelectedElements())}},clear:function(e){var t=ze.getDrawnPath();if(mt=null,t){var n=nn(ze.getId());je(nn("path_stretch_line")).remove(),je(n).remove(),je(nn("pathpointgrip_container")).find("*").attr("display","none"),ft=null,ze.setDrawnPath(null),ze.setStarted(!1)}else"pathedit"===ze.getCurrentMode()&&this.toSelectMode();He&&He.init().show(!1)},resetOrientation:function(e){if(ln(e)||"path"!==e.nodeName)return!1;var t=te(e),n=Te(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 o=[];je.each(["",1,2],function(e,t){var r=a["x"+t],i=a["y"+t];if(void 0!==r&&void 0!==i){var s=Ee(r,i,n);o.splice(o.length,0,s.x,s.y)}}),tt(i,t,o,e)},o=0;o<a;++o)i(o);!function(e,t){for(var n=Ht(e),r=0;r<2;r++){var a=0===r?"fill":"stroke",i=e.getAttribute(a);if(i&&i.startsWith("url(")){var o=tn(i);if("linearGradient"===o.tagName){var s=o.getAttribute("x1")||0,l=o.getAttribute("y1")||0,c=o.getAttribute("x2")||1,u=o.getAttribute("y2")||0;s=n.width*s+n.x,l=n.height*l+n.y,c=n.width*c+n.x,u=n.height*u+n.y;var d=Ee(s,l,t),h=Ee(c,u,t),p={x1:(d.x-n.x)/n.width,y1:(d.y-n.y)/n.height,x2:(h.x-n.x)/n.width,y2:(h.y-n.y)/n.height},f=o.cloneNode(!0);je(f).attr(p),f.id=ze.getNextId(),Dt().append(f),e.setAttribute(a,"url(#"+f.id+")")}}}}(e,n)},zoomChange:function(){"pathedit"===ze.getCurrentMode()&&He.update()},getNodePoint:function(){var e=He.selected_pts.length?He.selected_pts[0]:1,t=He.segs[e];return{x:t.item.x,y:t.item.y,type:t.type}},linkControlPoints:function(e){Ue=e},clonePathNode:function(){He.storeD();for(var e=He.selected_pts,t=e.length,n=[];t--;){var r=e[t];He.addSeg(r),n.push(r+t),n.push(r+t+1)}He.init().addPtsToSelection(n),He.endChanges("Clone path node(s)")},opencloseSubPath:function(){var e=He.selected_pts;if(1===e.length){var t,n,r=He.elem,a=r.pathSegList,i=e[0],o=null,s=null;if(He.eachSeg(function(e){return 2===this.type&&e<=i&&(s=this.item),e<=i||(2===this.type?(o=e,!1):1!==this.type||(o=!1,!1))}),ln(o)&&(o=He.segs.length-1),!1!==o){var l=r.createSVGPathSegLinetoAbs(s.x,s.y),c=r.createSVGPathSegClosePath();return o===He.segs.length-1?(a.appendItem(l),a.appendItem(c)):(Ye(r,c,o),Ye(r,l,o)),void He.init().selectPt(o+1)}if(He.segs[i].mate)return a.removeItem(i),a.removeItem(i),void He.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--;)Ye(r,a.getItem(t),n);var p=a.getItem(t);tt(2,t,[p.x,p.y]),He.init().selectPt(0)}},deletePathNode:function(){if(yt.canDeleteNodes){He.storeD();for(var e=He.selected_pts,t=e.length;t--;){var n=e[t];He.deleteSeg(n)}if(function e(){var t=He.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),o=t.getItem(n-2);if(2===i.pathSegType){r(n-1,2),e();break}if(2===o.pathSegType){r(n-2,3),e();break}}else if(2===a.pathSegType&&n>0){var s=t.getItem(n-1).pathSegType;if(2===s){r(n-1,1),e();break}if(1===s&&t.numberOfItems-1===n){r(n,1),e();break}}}return!1}(),He.elem.pathSegList.numberOfItems<=1)return yt.toSelectMode(He.elem),void ze.canvas.deleteSelectedElements();if(He.init(),He.clearSelection(),window.opera){var r=je(He.elem);r.attr("d",r.attr("d"))}He.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,o=[];for(o.push(["M",a.x,",",a.y," C"].join("")),t=1;t<=r-4;t+=3){var s=n.getItem(t),l=n.getItem(t+1),c=n.getItem(t+2);if(i){var u=rt(i,s,a);if(u&&2===u.length){var d=o[o.length-1].split(",");d[2]=u[0].x,d[3]=u[0].y,o[o.length-1]=d.join(","),s=u[1]}}o.push([s.x,s.y,l.x,l.y,c.x,c.y].join(",")),a=c,i=l}for(o.push("L");t<r;){var h=n.getItem(t);o.push([h.x,h.y].join(",")),t++}o=o.join(" "),e=ze.addSVGElementFromJson({element:"path",curStyles:!0,attr:{id:ze.getId(),d:o,fill:"none"}})}return e},setSegType:function(e){He.setSegType(e)},moveNode:function(e,t){var n=He.selected_pts;if(n.length){He.storeD();var r=He.segs[n[0]],a={x:0,y:0};a[e]=t-r.item[e],r.move(a.x,a.y),He.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 o=n.getItem(a-1);if(o.x!==t.x||o.y!==t.y){var s=e.createSVGPathSegLinetoAbs(t.x,t.y);Ye(e,s,a),yt.fixEnd(e);break}}}D()&&ze.resetD(e)},convertPath:dt}),_t=X(jQuery),bt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",xt="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use".split(","),wt=null,St=null,kt=null,Ct=null,At=function(e){return e.replace(g(/(<!DOCTYPE\s+\w*\s*\[).*(\?\]>)/,{doctypeOpen:1,doctypeClose:2}),"$<doctypeOpen>$<doctypeClose>")},Et=function(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")};function Gt(e){if(e=Nt(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++),o=e.charCodeAt(n++),s=a>>2,l=(3&a)<<4|i>>4,c=(15&i)<<2|o>>6,u=63&o;isNaN(i)?(c=64,u=64):isNaN(o)&&(u=64),t[r++]=bt.charAt(s),t[r++]=bt.charAt(l),t[r++]=bt.charAt(c),t[r++]=bt.charAt(u)}while(n<e.length);return t.join("")}function Pt(e){if(window.atob)return It(window.atob(e));e=e.replace(/[^A-Za-z0-9+\/=]/g,"");var t="",n=0;do{var r=bt.indexOf(e.charAt(n++)),a=bt.indexOf(e.charAt(n++)),i=bt.indexOf(e.charAt(n++)),o=bt.indexOf(e.charAt(n++)),s=r<<2|a>>4,l=(15&a)<<4|i>>2,c=(3&i)<<6|o;t+=String.fromCharCode(s),64!==i&&(t+=String.fromCharCode(l)),64!==o&&(t+=String.fromCharCode(c))}while(n<e.length);return It(t)}function It(e){return decodeURIComponent(escape(e))}var Nt=function(e){return unescape(encodeURIComponent(e))},Tt=function(e){if("undefined"==typeof Uint8Array||"undefined"==typeof Blob||"undefined"==typeof URL||!URL.createObjectURL)return"";for(var t=p(e.split(","),2),n=t[0],r=t[1],a=n.match(g(/:(.*?);/,{mime:1})).groups.mime,i=atob(r),o=i.length,s=new Uint8Array(o);o--;)s[o]=i.charCodeAt(o);var l=new Blob([s],{type:a});return URL.createObjectURL(l)},Lt=function(e){return e&&"undefined"!=typeof URL&&URL.createObjectURL?URL.createObjectURL(e):""},Mt=function(){if("undefined"==typeof Blob)return"";var e=new Blob(["<html><head><title>SVG-edit</title></head><body>&nbsp;</body></html>"],{type:"text/html"});return Lt(e)}(),Ot=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},jt=function e(t,n){if(t&&1===t.nodeType){n(t);for(var r=t.childNodes.length;r--;)e(t.childNodes.item(r),n)}},Vt=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},Rt=function(e){return e.getAttributeNS(v.XLINK,"href")},Bt=function(e,t){e.setAttributeNS(v.XLINK,"xlink:href",t)},Dt=function(){var e=wt.getSVGContent(),t=e.getElementsByTagNameNS(v.SVG,"defs");return t.length>0?t=t[0]:(t=e.ownerDocument.createElementNS(v.SVG,"defs"),e.firstChild?e.insertBefore(t,e.firstChild.nextSibling):e.append(t)),t},Ut=function(e){for(var t=e.pathSegList,n=t.numberOfItems,r=[[],[]],a=t.getItem(0),i=[a.x,a.y],o=function(e,t,n,r){return function(a){return 1-Math.pow(a,3)*i[e]+3-Math.pow(a,2)*a*t[e]+3*(1-a)*Math.pow(a,2)*n[e]+Math.pow(a,3)*r[e]}},s=0;s<n;s++){var l=t.getItem(s);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=o(h,c,u,d),f=6*i[h]-12*c[h]+6*u[h],g=-3*i[h]+9*c[h]-9*u[h]+3*d[h],m=3*c[h]-3*i[h];if(0!==g){var v=Math.pow(f,2)-4*m*g;if(!(v<0)){var y=(-f+Math.sqrt(v))/(2*g);y>0&&y<1&&r[h].push(p(y));var _=(-f-Math.sqrt(v))/(2*g);_>0&&_<1&&r[h].push(p(_))}}else{if(0===f)continue;var b=-m/f;b>0&&b<1&&r[h].push(p(b))}}i=d}else r[0].push(l.x),r[1].push(l.y)}var x=Math.min.apply(null,r[0]),w=Math.max.apply(null,r[0])-x,S=Math.min.apply(null,r[1]);return{x:x,y:S,width:w,height:Math.max.apply(null,r[1])-S}};function Ft(e){if(Y())try{return e.getBBox()}catch(e){}var t,n,r=_t.data(e,"ref"),a=null;r?(n=_t(r).children().clone().attr("visibility","hidden"),_t(Ct).append(n),a=n.filter("line, path")):a=_t(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 o=r?n:_t(e).children();t=Kt(o)}else t=e.getBBox();else t=e.getBBox();return r&&n.remove(),t}var Ht=function(e){var t=e||wt.geSelectedElements()[0];if(1!==e.nodeType)return null;var n,r=t.nodeName,a=null;switch(r){case"text":""===t.textContent?(t.textContent="a",a=t.getBBox(),t.textContent=""):t.getBBox&&(a=t.getBBox());break;case"path":O?t.getBBox&&(a=t.getBBox()):a=Ut(t);break;case"g":case"a":a=Ft(t);break;default:if("use"===r&&(a=Ft(t)),"use"===r||"foreignObject"===r&&D()){if(a||(a=t.getBBox()),!D()){var i=a,o=i.x,s=i.y;a={width:i.width,height:i.height,x:o+parseFloat(t.getAttribute("x")||0),y:s+parseFloat(t.getAttribute("y")||0)}}}else if(xt.includes(r))if(t)try{a=t.getBBox()}catch(e){var l=t.getExtentOfChar(0),c=t.getComputedTextLength();a={x:l.x,y:l.y,width:c,height:l.height}}else{var u=_t(t).closest("foreignObject");u.length&&u[0].getBBox&&(a=u[0].getBBox())}}return a&&(a={x:(n=a).x,y:n.y,width:n.width,height:n.height}),a},zt=function(e){var t="";return _t.each(e,function(e,n){var r=p(n,2),a=r[0],i=r[1];t+=a;for(var o=0;o<i.length;o+=2)t+=i[o]+","+i[o+1]+" "}),t},qt=function(e){var t,n,r,a,i=1.81;switch(e.tagName){case"ellipse":case"circle":var o=n=_t(e).attr(["rx","ry","cx","cy"]),s=o.cx,l=o.cy,c=n;r=c.rx,a=c.ry,"circle"===e.tagName&&(r=a=_t(e).attr("r")),t=zt([["M",[s-r,l]],["C",[s-r,l-a/i,s-r/i,l-a,s,l-a]],["C",[s+r/i,l-a,s+r,l-a/i,s+r,l]],["C",[s+r,l+a/i,s+r/i,l+a,s,l+a]],["C",[s-r/i,l+a,s-r,l+a/i,s-r,l]],["Z",[]]]);break;case"path":t=e.getAttribute("d");break;case"line":t="M"+(n=_t(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=_t(e).attr(["rx","ry"]);r=u.rx,a=u.ry;var d=e.getBBox(),h=d.x,p=d.y,f=d.width,g=d.height;i=4-i,t=zt(r||a?[["M",[h,p+a]],["C",[h,p+a/i,h+r/i,p,h+r,p]],["L",[h+f-r,p]],["C",[h+f-r/i,p,h+f,p+a/i,h+f,p+a]],["L",[h+f,p+g-a]],["C",[h+f,p+g-a/i,h+f-r/i,p+g,h+f-r,p+g]],["L",[h+r,p+g]],["C",[h+r/i,p+g,h,p+g-a/i,h,p+g-a]],["L",[h,p+a]],["Z",[]]]:[["M",[h,p]],["L",[h+f,p]],["L",[h+f,p+g]],["L",[h,p+g]],["L",[h,p]],["Z",[]]])}return t},Yt=function(e){var t={};return _t.each(["marker-start","marker-end","marker-mid","filter","clip-path"],function(){var n=e.getAttribute(this);n&&(t[this]=n)}),t},Wt=function(e,t,n){var r=t({element:"path",attr:Yt(e)}),a=e.getAttribute("transform");a&&r.setAttribute("transform",a);var i=e.parentNode;e.nextSibling?e.before(r):i.append(r);var o=qt(e);o?r.setAttribute("d",o):r.remove(),n.resetOrientation(r);var s=!1;try{s=r.getBBox()}catch(e){}return r.remove(),s};var Xt=function(e,t,n){var r=Ht(e);if(!r)return null;var a=te(e),i=Jt(a),o=Ie(a);if(i||o){var s=!1;if(function(e,t){var n=e%90;return t||!(n>-.001&&n<.001||n<-89.99||n>89.99)}(i,o)){if(["ellipse","path","line","polyline","polygon"].includes(e.tagName))r=s=Wt(e,t,n);else if("rect"===e.tagName){var l=e.getAttribute("rx"),c=e.getAttribute("ry");(l||c)&&(r=s=Wt(e,t,n))}}if(!s){var u=Te(a).matrix;r=Ne(r.x,r.y,r.width,r.height,u).aabox}}return r};function Qt(e){var t=e.getAttribute("stroke-width");return isNaN(t)||"none"===e.getAttribute("stroke")?0:t/2}var Kt=function(e,t,n){if(!e||!e.length)return!1;var r;if(_t.each(e,function(){r||this.parentNode&&(r=Xt(this,t,n))}),void 0===r)return null;var a=r.x+r.width,i=r.y+r.height,o=r.x,s=r.y;if(1===e.length){var l=Qt(e[0]);o-=l,s-=l,a+=l,i+=l}else _t.each(e,function(e,r){var l=Xt(r,t,n);if(l){var c=Qt(r);o=Math.min(o,l.x-c),s=Math.min(s,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=o,r.y=s,r.width=a-o,r.height=i-s,r},Zt=function(e){e||(e=_t(wt.getSVGContent()).children());var t=[];return _t(e).children().each(function(e,n){n.getBBox&&t.push(n)}),t.reverse()},$t=function(e){return e||(e=Zt()),Kt(e,wt.addSVGElementFromJson,wt.pathActions)},Jt=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},en=function(e,t){var n=e||wt.getSelectedElements()[0],r=te(n);return Jt(r,t)},tn=function(e){return nn(Vt(e).substr(1))},nn=I?function(e){return Ct.querySelector("#"+e)}:N?function(e){return St.evaluate('svg:svg[@id="svgroot"]//svg:*[@id="'+e+'"]',kt,function(){return v.SVG},9,null).singleNodeValue}:function(e){return _t(Ct).find("[id="+e+"]")[0]},rn=function(e,t,n,r){for(var a=0,i=Object.entries(t);a<i.length;a++){var o=p(i[a],2),s=o[0],l=o[1],c="xml:"===s.substr(0,4)?v.XML:"xlink:"===s.substr(0,6)?v.XLINK:null;c?e.setAttributeNS(c,s,l):r?ce(e,s,l):e.setAttribute(s,l)}},an=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=p(t,2),r=n[0],a=n[1];e.getAttribute(r)===String(a)&&e.removeAttribute(r)})},on=function(e){var t=wt.getBaseUnit(),n=wt.getSnappingStep();return"px"!==t&&(n*=oe()[t]),e=Math.round(e/n)*n},sn=function(e){_t(e).click(function(e){e.preventDefault()})},ln=function(e){return null==e},cn=jQuery,un={},dn=function(){Object.values(un).forEach(function(e){!function(e){Object.keys(un).length||cn("#cmenu_canvas").append("<li class='separator'>");var t=e.shortcut||"";cn("#cmenu_canvas").append("<li class='disabled'><a href='#"+e.id+"'>"+e.label+"<span class='shortcut'>"+t+"</span></a></li>")}(e)})};function hn(e,t){["id","class","type"].forEach(function(n){n in t&&(e[n]=t[n])})}function pn(e,t){return fn(e,o({},t,{returnDefault:!0}))}function fn(e,t){return gn.apply(this,arguments)}function gn(){return(gn=n(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",vn(t,void 0,{returnDefault:a}));case 4:return e.next=6,mn(t);case 6:return e.abrupt("return",window[r]);case 7:case"end":return e.stop()}},e)}))).apply(this,arguments)}function mn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Array.isArray(e)?Promise.all(e.map(function(e){return mn(e,t)})):new Promise(function(n,r){var a=document.createElement("script");function i(){r(new Error("Failed to import: ".concat(e))),s()}function o(){n(),s()}var s=function(){a.removeEventListener("error",i),a.removeEventListener("load",o),a.remove(),a.src=""};a.defer="defer",hn(a,t),a.addEventListener("error",i),a.addEventListener("load",o),a.src=e,document.head.append(a)})}function vn(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 vn(e,t)})):new Promise(function(n,a){var i="$importModule$"+Math.random().toString(32).slice(2),o=document.createElement("script");function s(){a(new Error("Failed to import: ".concat(e))),c()}function l(){n(window[i]),c()}var c=function(){delete window[i],o.removeEventListener("error",s),o.removeEventListener("load",l),o.remove(),URL.revokeObjectURL(o.src),o.src=""};hn(o,t),o.defer="defer",o.type="module",o.addEventListener("error",s),o.addEventListener("load",l);var u=function(e){var t=document.createElement("a");return t.setAttribute("href",e),t.cloneNode(!1).href}(e),d="import * as m from '".concat(u.replace(/'/g,"\\'"),"'; window.").concat(i," = ").concat(r?"m.default || ":"","m;"),h=new Blob([d],{type:"text/javascript"});o.src=URL.createObjectURL(h),document.head.append(o)})}function yn(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ok:"Ok",cancel:"Cancel"};t("#dialog_container").draggable({cancel:"#dialog_content, #dialog_buttons *",containment:"window"}).css("position","absolute");var r=t("#dialog_box"),a=t("#dialog_buttons"),i=t("#dialog_content");function o(o,s,l,c,u,d){i.html("<p>"+s.replace(/\n/g,"</p><p>")+"</p>").toggleClass("prompt","prompt"===o),a.empty();var h=t('<input type="button" data-ok="" value="'+n.ok+'">').appendTo(a);return new Promise(function(p,f){var g,m;if("alert"!==o&&t('<input type="button" value="'+n.cancel+'">').appendTo(a).click(function(){r.hide(),p(!1)}),"prompt"===o)(g=t('<input type="text">').prependTo(a)).val(l||""),g.bind("keydown","return",function(){h.click()});else if("select"===o){var v=t('<div style="text-align:center;">');if(g=t('<select aria-label="'.concat(s,'">')).appendTo(v),d){var y=t("<label>").text(d.label);(m=t('<input type="checkbox">').appendTo(y)).val(d.value),d.tooltip&&y.attr("title",d.tooltip),m.prop("checked",Boolean(d.checked)),v.append(t("<div>").append(y))}t.each(c||[],function(n,r){"object"===e(r)?g.append(t("<option>").val(r.value).html(r.text)):g.append(t("<option>").html(r))}),i.append(v),l&&g.val(l),u&&g.bind("change","return",u),g.bind("keydown","return",function(){h.click()})}else"process"===o&&h.hide();r.show(),h.click(function(){r.hide();var e="prompt"!==o&&"select"!==o||g.val();p(m?{response:e,checked:m.prop("checked")}:e)}).focus(),"prompt"!==o&&"select"!==o||g.focus()})}return t.alert=function(e){return o("alert",e)},t.confirm=function(e){return o("confirm",e)},t.process_cancel=function(e){return o("process",e)},t.prompt=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return o("prompt",e,t)},t.select=function(e,t,n,r,a){return o("select",e,r,t,n,a)},t}var _n=jQuery,bn=function(){function e(t,n,a){if(r(this,e),this.name_=t,this.group_=a?null:n,a){var i=a.ownerDocument;this.group_=i.createElementNS(v.SVG,"g");var o=i.createElementNS(v.SVG,"title");o.textContent=t,this.group_.append(o),n?_n(n).after(this.group_):a.append(this.group_)}xn(this.group_),jt(this.group_,function(e){e.setAttribute("style","pointer-events:inherit")}),this.group_.setAttribute("style",a?"pointer-events:all":"pointer-events:none")}return i(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 ln(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){var t=!0,n=!1,r=void 0;try{for(var a,i=e[Symbol.iterator]();!(t=(a=i.next()).done);t=!0){var o=a.value;this.group_.append(o)}}catch(e){n=!0,r=e}finally{try{t||null==i.return||i.return()}finally{if(n)throw r}}}},{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=Et(e);var r=this.getTitleElement();return r?(_n(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 xn(e){var t=e.getAttribute("class");ln(t)||!t.length?e.setAttribute("class",bn.CLASS_NAME):bn.CLASS_REGEX.test(t)||e.setAttribute("class",t+" "+bn.CLASS_NAME)}bn.CLASS_NAME="layer",bn.CLASS_REGEX=new RegExp("(\\s|^)"+bn.CLASS_NAME+"(\\s|$)");var wn=function(){function e(t){r(this,e),this.undoManager_=t,this.currentBatchCommand_=null,this.batchCommandStack_=[]}return i(e,[{key:"startBatchCommand",value:function(e){return this.undoManager_?(this.currentBatchCommand_=new ye(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 fe(e,t,n,r)),this):this}},{key:"insertElement",value:function(e,t){return this.undoManager_?(this.addCommand_(new ge(e,t)),this):this}},{key:"removeElement",value:function(e,t,n,r){return this.undoManager_?(this.addCommand_(new me(e,t,n,r)),this):this}},{key:"changeElement",value:function(e,t,n){return this.undoManager_?(this.addCommand_(new ve(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}();wn.NO_HISTORY=new wn;var Sn=jQuery,kn="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use".split(","),Cn={LET_DOCUMENT_DECIDE:0,ALWAYS_RANDOMIZE:1,NEVER_RANDOMIZE:2},An=Cn.LET_DOCUMENT_DECIDE,En=[];function Gn(e){return e||new wn(In.undoMgr)}function Pn(e){for(var t=1;e.includes("Layer "+t);)t++;return"Layer "+t}var In,Nn=function(){function e(t,n){if(r(this,e),!t||!t.tagName||!t.namespaceURI||"svg"!==t.tagName||t.namespaceURI!==v.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 a=this.svgElem_.getAttributeNS(v.SE,"nonce");a&&An!==Cn.NEVER_RANDOMIZE?this.nonce_=a:An===Cn.ALWAYS_RANDOMIZE&&this.setNonce(Math.floor(100001*Math.random()))}return i(e,[{key:"getElem_",value:function(e){return this.svgElem_.querySelector?this.svgElem_.querySelector("#"+e):Sn(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(v.XMLNS,"xmlns:se",v.SE),this.svgElem_.setAttributeNS(v.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=Sn(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 o=this.all_layers.indexOf(this.current_layer);if(o>0){var s=this.current_layer.getName();this.current_layer=this.all_layers[o-1],this.all_layers.splice(o,1),delete this.layer_map[s]}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,t=this.svgElem_.childNodes.length,n=[],r=[],a=null,i=!1,o=0;o<t;++o){var s=this.svgElem_.childNodes.item(o);if(s&&1===s.nodeType)if("g"===s.tagName){i=!0;var l=Sn("title",e=s).text()||(B()&&e.querySelectorAll?Sn(e.querySelectorAll("title")).text():"");l?(r.push(l),a=new bn(l,s),this.all_layers.push(a),this.layer_map[l]=a):n.push(s)}else kn.includes(s.nodeName)&&n.push(s)}n.length>0||!i?((a=new bn(Pn(r),null,this.svgElem_)).appendChildren(n),this.all_layers.push(a),this.layer_map[name]=a):a.activate(),this.current_layer=a}},{key:"createLayer",value:function(e,t){this.current_layer&&this.current_layer.deactivate(),(null==e||""===e||this.layer_map[e])&&(e=Pn(Object.keys(this.layer_map)));var n=new bn(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){var n=this;if(!this.current_layer)return null;this.current_layer.deactivate(),(null==e||""===e||this.layer_map[e])&&(e=Pn(Object.keys(this.layer_map)));var r=this.current_layer.getGroup(),a=new bn(e,r,this.svgElem_),i=a.getGroup();f(r.childNodes).forEach(function(e){"title"!==e.localName&&i.append(n.copyElem(e))}),t&&(t.startBatchCommand("Duplicate Layer"),t.insertElement(i),t.endBatchCommand());var o=this.all_layers.indexOf(this.current_layer);return o>=0?this.all_layers.splice(o+1,0,a):this.all_layers.push(a),this.layer_map[e]=a,this.current_layer=a,i}},{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 function e(t,n){var r=document.createElementNS(t.namespaceURI,t.nodeName);if(_t.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(),D()&&"path"===t.nodeName){var a=dt(t);r.setAttribute("d",a)}if(_t.each(t.childNodes,function(t,a){switch(a.nodeType){case 1:r.append(e(a,n));break;case 3:r.textContent=a.nodeValue}}),_t(t).data("gsvg"))_t(r).data("gsvg",r.firstChild);else if(_t(t).data("symbol")){var i=_t(t).data("symbol");_t(r).data("ref",i).data("symbol",i)}else"image"===r.tagName&&sn(r);return r}(e,function(){return t.getNextId()})}}]),e}(),Tn=function(e,t){(An=!1===e?Cn.NEVER_RANDOMIZE:Cn.ALWAYS_RANDOMIZE)!==Cn.ALWAYS_RANDOMIZE||t.getNonce()?An===Cn.NEVER_RANDOMIZE&&t.getNonce()&&t.clearNonce():t.setNonce(Math.floor(100001*Math.random()))},Ln=function(){zn(),In.getCurrentDrawing().identifyLayers()},Mn=function(e,t){var n=In.getCurrentDrawing().createLayer(e,Gn(t));In.clearSelection(),In.call("changed",[n])},On=function(e,t){var n=In.getCurrentDrawing().cloneLayer(e,Gn(t));In.clearSelection(),zn(),In.call("changed",[n])},jn=function(){var e=In.getCurrentDrawing().getCurrentLayer(),t=e.nextSibling,n=e.parentNode;if(e=In.getCurrentDrawing().deleteCurrentLayer()){var r=new ye("Delete Layer");return r.addSubCommand(new me(e,t,n)),In.addCommandToHistory(r),In.clearSelection(),In.call("changed",[n]),!0}return!1},Vn=function(e){var t=In.getCurrentDrawing().setCurrentLayer(Et(e));return t&&In.clearSelection(),t},Rn=function(e){var t=In.getCurrentDrawing(),n=t.getCurrentLayer();if(n&&t.setCurrentLayerName(e,Gn()))return In.call("changed",[n]),!0;return!1},Bn=function(e){var t=In.getCurrentDrawing().setCurrentLayerPosition(e);return!!t&&(In.addCommandToHistory(new fe(t.currentGroup,t.oldNextSibling,In.getSVGContent())),!0)},Dn=function(e,t){var n=In.getCurrentDrawing(),r=n.getLayerVisibility(e),a=n.setLayerVisibility(e,t);if(!a)return!1;var i=r?"inline":"none";return In.addCommandToHistory(new ve(a,{display:i},"Layer Visibility")),a===n.getCurrentLayer()&&(In.clearSelection(),In.pathActions.clear()),!0},Un=function(e){var t=In.getCurrentDrawing().getLayerByName(e);if(!t)return!1;for(var n=new ye("Move Elements to Layer"),r=In.getSelectedElements(),a=r.length;a--;){var i=r[a];if(i){var o=i.nextSibling,s=i.parentNode;t.append(i),n.addSubCommand(new fe(i,o,s))}}return In.addCommandToHistory(n),!0},Fn=function(e){In.getCurrentDrawing().mergeLayer(Gn(e)),In.clearSelection(),zn(),In.changeSVGContent()},Hn=function(e){In.getCurrentDrawing().mergeAllLayers(Gn(e)),In.clearSelection(),zn(),In.changeSVGContent()},zn=function(){var e=En.length;if(e){for(var t=0;t<e;t++){var n=En[t],r=In.elData(n,"orig_opac");1!==r?n.setAttribute("opacity",r):n.removeAttribute("opacity"),n.setAttribute("style","pointer-events: inherit")}En=[],In.clearSelection(!0),In.call("contextset",null)}In.setCurrentGroup(null)},qn=function(e){zn(),"string"==typeof e&&(e=nn(e)),In.setCurrentGroup(e),Sn(e).parentsUntil("#svgcontent").andSelf().siblings().each(function(){var e=this.getAttribute("opacity")||1;In.elData(this,"orig_opac",e),this.setAttribute("opacity",.33*e),this.setAttribute("style","pointer-events: none"),En.push(this)}),In.clearSelection(),In.call("contextset",In.getCurrentGroup())},Yn=y(),Wn={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"],feMorphology:["class","in","operator","radius"],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:[]},Xn={};Object.entries(Wn).forEach(function(e){var t=p(e,2),n=t[0],r=t[1],a={};Object.entries(r).forEach(function(e){var t=p(e,2),n=(t[0],t[1]);if(n.includes(":")){var r=n.split(":");a[r[1]]=v[r[0].toUpperCase()]}else a[n]="xmlns"===n?v.XMLNS:null}),Xn[n]=a});var Qn,Kn,Zn,$n,Jn=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=Wn[t.nodeName],i=Xn[t.nodeName];if(void 0!==a){for(var o=[],s=t.attributes.length;s--;){var l=t.attributes.item(s),c=l.nodeName,u=l.localName,d=l.namespaceURI;if({}.hasOwnProperty.call(i,u)&&d===i[u]&&d!==v.XMLNS||d===v.XMLNS&&Yn[l.value]||((c.startsWith("se:")||c.startsWith("data-"))&&o.push([c,l.value]),t.removeAttributeNS(d,u)),U())switch(c){case"transform":case"gradientTransform":case"patternTransform":var h=l.value.replace(g(/(\d)-/g,{digit:1}),"$<digit> -");t.setAttribute(c,h)}if("style"===c){for(var f=l.value.split(";"),m=f.length;m--;){var y=p(f[m].split(":"),2),_=y[0],b=y[1],x=(_||"").trim(),w=(b||"").trim();a.includes(x)&&t.setAttribute(x,w)}t.removeAttribute("style")}}Object.values(o).forEach(function(e){var n=p(e,2),r=n[0],a=n[1];t.setAttributeNS(v.SE,r,a)});var S=Rt(t);if(S&&["filter","linearGradient","pattern","radialGradient","textPath","use"].includes(t.nodeName)&&"#"!==S[0]&&(Bt(t,""),t.removeAttributeNS(v.XLINK,"href")),"use"===t.nodeName&&!Rt(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=Vt(n))&&"#"!==n[0]&&(t.setAttribute(e,""),t.removeAttribute(e))}),s=t.childNodes.length;s--;)e(t.childNodes.item(s))}else{for(var k=[];t.hasChildNodes();)k.push(r.insertBefore(t.firstChild,t));t.remove();for(var C=k.length;C--;)e(k[C])}}}},er=jQuery,tr=[0,"z","M","m","L","l","C","c","Q","q","A","a","H","h","V","v","S","s","T","t"],nr=null,rr=function(e,t,n){for(var r=function(e,t){return Ee(e,t,n)},a=function(e){return n.a*e},i=function(e){return n.d*e},o=nr.getGridSnapping()&&"svg"===e.parentNode.parentNode.localName,s=function(){o&&Object.entries(t).forEach(function(e){var n=p(e,2),r=n[0],a=n[1];t[r]=on(a)}),rn(e,t,1e3,!0)},l=Ht(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=tn(d).cloneNode(!0);if(n.a<0){var f=h.getAttribute("x1"),g=h.getAttribute("x2");h.setAttribute("x1",-(f-1)),h.setAttribute("x2",-(g-1))}if(n.d<0){var m=h.getAttribute("y1"),v=h.getAttribute("y2");h.setAttribute("y1",-(m-1)),h.setAttribute("y2",-(v-1))}h.id=nr.getDrawing().getNextId(),Dt().append(h),e.setAttribute(u,"url(#"+h.id+")")}}var y=e.tagName;if("g"===y||"text"===y||"tspan"===y||"use"===y)if(1!==n.a||0!==n.b||0!==n.c||1!==n.d||0===n.e&&0===n.f){var _=te(e),b=nr.getSVGRoot().createSVGTransform();b.setMatrix(Pe(Te(_).matrix,n)),_.clear(),_.appendItem(b)}else{var x=Te(e).matrix,w=Pe(x.inverse(),n,x);t.x=parseFloat(t.x)+w.e,t.y=parseFloat(t.y)+w.f}switch(y){case"foreignObject":case"rect":case"image":if("image"===y&&(n.a<0||n.d<0)){var S=te(e),k=nr.getSVGRoot().createSVGTransform();k.setMatrix(Pe(Te(S).matrix,n)),S.clear(),S.appendItem(k)}else{var C=r(t.x,t.y);t.width=a(t.width),t.height=i(t.height),t.x=C.x+Math.min(0,t.width),t.y=C.y+Math.min(0,t.height),t.width=Math.abs(t.width),t.height=Math.abs(t.height)}s();break;case"ellipse":var A=r(t.cx,t.cy);t.cx=A.x,t.cy=A.y,t.rx=a(t.rx),t.ry=i(t.ry),t.rx=Math.abs(t.rx),t.ry=Math.abs(t.ry),s();break;case"circle":var E=r(t.cx,t.cy);t.cx=E.x,t.cy=E.y;var G=Ne(l.x,l.y,l.width,l.height,n),P=G.tr.x-G.tl.x,I=G.bl.y-G.tl.y;t.r=Math.min(P/2,I/2),t.r&&(t.r=Math.abs(t.r)),s();break;case"line":var N=r(t.x1,t.y1),T=r(t.x2,t.y2);t.x1=N.x,t.y1=N.y,t.x2=T.x,t.y2=T.y;case"text":case"tspan":case"use":s();break;case"g":var L=er(e).data("gsvg");L&&rn(L,t,1e3,!0);break;case"polyline":case"polygon":for(var M=t.points.length,O=0;O<M;++O){var j=t.points[O],V=r(j.x,j.y),R=V.x,B=V.y;t.points[O].x=R,t.points[O].y=B}for(var D="",U=0;U<M;++U){var F=t.points[U];D+=F.x+","+F.y+" "}e.setAttribute("points",D);break;case"path":var H=e.pathSegList,z=H.numberOfItems;t.d=[];for(var q=0;q<z;++q){var Y=H.getItem(q);t.d[q]={type:Y.pathSegType,x:Y.x,y:Y.y,x1:Y.x1,y1:Y.y1,x2:Y.x2,y2:Y.y2,r1:Y.r1,r2:Y.r2,angle:Y.angle,largeArcFlag:Y.largeArcFlag,sweepFlag:Y.sweepFlag}}z=t.d.length;var W=t.d[0],X=r(W.x,W.y);t.d[0].x=X.x,t.d[0].y=X.y;for(var Q=1;Q<z;++Q){var K=t.d[Q];if(K.type%2==0){var Z=r(void 0!==K.x?K.x:X.x,void 0!==K.y?K.y:X.y),$=r(K.x1,K.y1),J=r(K.x2,K.y2);K.x=Z.x,K.y=Z.y,K.x1=$.x,K.y1=$.y,K.x2=J.x,K.y2=J.y,K.r1=a(K.r1),K.r2=i(K.r2)}else K.x=a(K.x),K.y=i(K.y),K.x1=a(K.x1),K.y1=i(K.y1),K.x2=a(K.x2),K.y2=i(K.y2),K.r1=a(K.r1),K.r2=i(K.r2)}var ee="";z=t.d.length;for(var ne=0;ne<z;++ne){var re=t.d[ne],ae=re.type;switch(ee+=tr[ae],ae){case 13:case 12:ee+=re.x+" ";break;case 15:case 14:ee+=re.y+" ";break;case 3:case 5:case 19:case 2:case 4:case 18:ee+=re.x+","+re.y+" ";break;case 7:case 6:ee+=re.x1+","+re.y1+" "+re.x2+","+re.y2+" "+re.x+","+re.y+" ";break;case 9:case 8:ee+=re.x1+","+re.y1+" "+re.x+","+re.y+" ";break;case 11:case 10:ee+=re.r1+","+re.r2+" "+re.angle+" "+Number(re.largeArcFlag)+" "+Number(re.sweepFlag)+" "+re.x+","+re.y+" ";break;case 17:case 16:ee+=re.x2+","+re.y2+" "+re.x+","+re.y+" "}}e.setAttribute("d",ee)}},ar=X(jQuery),ir=function(e,t,n){var r=tn(e).firstChild,a=te(r),i=Qn.getSVGRoot().createSVGTransform();i.setTranslate(t,n),a.appendItem(i),or(r)},or=function e(t){if(ln(t))return null;if("svg"===t.nodeName&&navigator.userAgent.includes("Firefox/20"))return null;var n=Qn.getSVGRoot(),r=te(t);if(r&&r.numberOfItems>0){for(var a=r.numberOfItems,i=a;a--;){var o=r.getItem(a);if(0===o.type)r.removeItem(a);else if(1===o.type){if(Ge(o.matrix)){if(1===i)return t.removeAttribute("transform"),null;r.removeItem(a)}}else 4===o.type&&0===o.angle&&r.removeItem(a)}if(1===r.numberOfItems&&en(t))return null}if(!r||0===r.numberOfItems)return t.setAttribute("transform",""),t.removeAttribute("transform"),null;if(r){for(var s=[],l=r.numberOfItems;l--;){var c=r.getItem(l);1===c.type?s.push([c.matrix,l]):s.length&&(s=[])}if(2===s.length){var u=n.createSVGTransformFromMatrix(Pe(s[1][0],s[0][0]));r.removeItem(s[0][1]),r.removeItem(s[1][1]),r.insertItemBefore(u,s[1][1])}if((l=r.numberOfItems)>=2&&1===r.getItem(l-2).type&&2===r.getItem(l-1).type){var d=n.createSVGTransform(),h=Pe(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,f,g=ar(t).data("gsvg"),m=new ye("Transform"),y={},_=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 x=t.points,w=x.numberOfItems;y.points=new Array(w);for(var S=0;S<w;++S){var k=x.getItem(S);y.points[S]={x:k.x,y:k.y}}break;case"path":(_={}).d=t.getAttribute("d"),y.d=t.getAttribute("d")}if(b.length?(y=ar(t).attr(b),ar.each(y,function(e,t){y[e]=ue(e,t)})):g&&(y={x:ar(g).attr("x")||0,y:ar(g).attr("y")||0}),ln(_)&&(_=ar.extend(!0,{},y),ar.each(_,function(e,t){_[e]=ue(e,t)})),_.transform=Qn.getStartTransform()||"","g"===t.tagName&&!g||"a"===t.tagName){var C=Ht(t);p={x:C.x+C.width/2,y:C.y+C.height/2},f=Ee(C.x+C.width/2,C.y+C.height/2,Te(r).matrix);var A=en(t);if(A){var E,G=A*Math.PI/180;E=Math.abs(G)>1e-10?Math.sin(G)/(1-Math.cos(G)):2/G;for(var P=0;P<r.numberOfItems;++P){var I=r.getItem(P);if(4===I.type){var N=I.matrix;p.y=(E*N.e+N.f)/2,p.x=(N.e-E*N.f)/2,r.removeItem(P);break}}}var T,L,M=r.numberOfItems,O=0,j=0,V=0;if(M&&(T=r.getItem(0).matrix),M>=3&&3===r.getItem(M-2).type&&2===r.getItem(M-3).type&&2===r.getItem(M-1).type){V=3;for(var R=r.getItem(M-3).matrix,B=r.getItem(M-2).matrix,U=r.getItem(M-1).matrix,F=t.childNodes,H=F.length;H--;){var z=F.item(H);if(O=0,j=0,1===z.nodeType){var q=te(z);if(!q)continue;var Y=Te(q).matrix,W=en(z);L=Qn.getStartTransform();var X=[];if(Qn.setStartTransform(z.getAttribute("transform")),W||Ie(q)){var Q=n.createSVGTransform();Q.setMatrix(Pe(R,B,U,Y)),q.clear(),q.appendItem(Q),X.push(Q)}else{var K=Pe(Y.inverse(),U,Y),Z=n.createSVGMatrix();Z.e=-K.e,Z.f=-K.f;var $=Pe(Z.inverse(),Y.inverse(),R,B,U,Y,K.inverse()),J=n.createSVGTransform(),ee=n.createSVGTransform(),ne=n.createSVGTransform();J.setTranslate(K.e,K.f),ee.setScale($.a,$.d),ne.setTranslate(Z.e,Z.f),q.appendItem(ne),q.appendItem(ee),q.appendItem(J),X.push(ne),X.push(ee),X.push(J)}m.addSubCommand(e(z)),Qn.setStartTransform(L)}}r.removeItem(M-1),r.removeItem(M-2),r.removeItem(M-3)}else if(M>=3&&1===r.getItem(M-1).type){V=3;var re=Te(r).matrix,ae=n.createSVGTransform();ae.setMatrix(re),r.clear(),r.appendItem(ae)}else if((1===M||M>1&&3!==r.getItem(1).type)&&2===r.getItem(0).type){V=2;var ie=Te(r).matrix;r.removeItem(0);var oe=Te(r).matrix.inverse(),se=Pe(oe,ie);if(O=se.e,j=se.f,0!==O||0!==j){for(var le=t.childNodes,ce=le.length,de=[];ce--;){var he=le.item(ce);if(1===he.nodeType){if(he.getAttribute("clip-path")){var pe=he.getAttribute("clip-path");de.includes(pe)||(ir(pe,O,j),de.push(pe))}L=Qn.getStartTransform(),Qn.setStartTransform(he.getAttribute("transform"));var fe=te(he);if(fe){var ge=n.createSVGTransform();ge.setTranslate(O,j),fe.numberOfItems?fe.insertItemBefore(ge,0):fe.appendItem(ge),m.addSubCommand(e(he));for(var me=t.getElementsByTagNameNS(v.SVG,"use"),_e="#"+he.id,be=me.length;be--;){var xe=me.item(be);if(_e===Rt(xe)){var we=n.createSVGTransform();we.setTranslate(-O,-j),te(xe).insertItemBefore(we,0),m.addSubCommand(e(xe))}}Qn.setStartTransform(L)}}}Qn.setStartTransform(L)}}else{if(1!==M||1!==r.getItem(0).type||A){if(A){var Se=n.createSVGTransform();Se.setRotate(A,f.x,f.y),r.numberOfItems?r.insertItemBefore(Se,0):r.appendItem(Se)}return 0===r.numberOfItems&&t.removeAttribute("transform"),null}V=1;for(var ke=r.getItem(0).matrix,Ce=t.childNodes,Ae=Ce.length;Ae--;){var Ne=Ce.item(Ae);if(1===Ne.nodeType){L=Qn.getStartTransform(),Qn.setStartTransform(Ne.getAttribute("transform"));var Le=te(Ne);if(!Le)continue;var Me=Pe(ke,Te(Le).matrix),Oe=n.createSVGTransform();Oe.setMatrix(Me),Le.clear(),Le.appendItem(Oe,0),m.addSubCommand(e(Ne)),Qn.setStartTransform(L);var je=Ne.getAttribute("stroke-width");if("none"!==Ne.getAttribute("stroke")&&!isNaN(je)){var Ve=(Math.abs(Me.a)+Math.abs(Me.d))/2;Ne.setAttribute("stroke-width",je*Ve)}}}r.clear()}if(2===V){if(A){f={x:p.x+T.e,y:p.y+T.f};var Re=n.createSVGTransform();Re.setRotate(A,f.x,f.y),r.numberOfItems?r.insertItemBefore(Re,0):r.appendItem(Re)}}else if(3===V){var Be=Te(r).matrix,De=n.createSVGTransform();De.setRotate(A,p.x,p.y);var Ue=De.matrix,Fe=n.createSVGTransform();Fe.setRotate(A,f.x,f.y);var He=Fe.matrix.inverse(),ze=Be.inverse(),qe=Pe(ze,He,Ue,Be);if(O=qe.e,j=qe.f,0!==O||0!==j)for(var Ye=t.childNodes,We=Ye.length;We--;){var Xe=Ye.item(We);if(1===Xe.nodeType){L=Qn.getStartTransform(),Qn.setStartTransform(Xe.getAttribute("transform"));var Qe=te(Xe),Ke=n.createSVGTransform();Ke.setTranslate(O,j),Qe.numberOfItems?Qe.insertItemBefore(Ke,0):Qe.appendItem(Ke),m.addSubCommand(e(Xe)),Qn.setStartTransform(L)}}A&&(r.numberOfItems?r.insertItemBefore(Fe,0):r.appendItem(Fe))}}else{var Ze,$e=Ht(t);if(!$e&&"path"!==t.tagName)return null;var Je=en(t);if(Je){p={x:$e.x+$e.width/2,y:$e.y+$e.height/2},f=Ee($e.x+$e.width/2,$e.y+$e.height/2,Te(r).matrix);for(var et=Je*Math.PI/180,tt=Math.abs(et)>1e-10?Math.sin(et)/(1-Math.cos(et)):2/et,nt=0;nt<r.numberOfItems;++nt){var rt=r.getItem(nt);if(4===rt.type){var at=rt.matrix;p.y=(tt*at.e+at.f)/2,p.x=(at.e-tt*at.f)/2,r.removeItem(nt);break}}}var it=0,ot=r.numberOfItems;if(!D()){var st=t.getAttribute("fill");if(st&&st.startsWith("url(")){var lt=tn(st),ct="pattern";if(lt.tagName!==ct&&(ct="gradient"),"userSpaceOnUse"===lt.getAttribute(ct+"Units")){Ze=Te(r).matrix;var ut=te(lt),dt=Te(ut).matrix,ht="matrix("+[(Ze=Pe(Ze,dt)).a,Ze.b,Ze.c,Ze.d,Ze.e,Ze.f].join(",")+")";lt.setAttribute(ct+"Transform",ht)}}}if(ot>=3&&3===r.getItem(ot-2).type&&2===r.getItem(ot-3).type&&2===r.getItem(ot-1).type)it=3,Ze=Te(r,ot-3,ot-1).matrix,r.removeItem(ot-1),r.removeItem(ot-2),r.removeItem(ot-3);else if(4===ot&&1===r.getItem(ot-1).type){it=3,Ze=Te(r).matrix;var pt=n.createSVGTransform();pt.setMatrix(Ze),r.clear(),r.appendItem(pt),Ze=n.createSVGMatrix()}else if((1===ot||ot>1&&3!==r.getItem(1).type)&&2===r.getItem(0).type){it=2;var ft=r.getItem(0).matrix,gt=Te(r,1).matrix,mt=gt.inverse();Ze=Pe(mt,ft,gt),r.removeItem(0)}else{if(1!==ot||1!==r.getItem(0).type||Je){if(Je){var vt=n.createSVGTransform();vt.setRotate(Je,f.x,f.y),r.numberOfItems?r.insertItemBefore(vt,0):r.appendItem(vt)}return 0===r.numberOfItems&&t.removeAttribute("transform"),null}switch(Ze=Te(r).matrix,t.tagName){case"line":y=ar(t).attr(["x1","y1","x2","y2"]);case"polyline":case"polygon":if(y.points=t.getAttribute("points"),y.points){var yt=t.points,_t=yt.numberOfItems;y.points=new Array(_t);for(var bt=0;bt<_t;++bt){var xt=yt.getItem(bt);y.points[bt]={x:xt.x,y:xt.y}}}case"path":y.d=t.getAttribute("d"),it=1,r.clear()}}if(1!==it&&2!==it&&3!==it||rr(t,y,Ze),2===it){if(Je){Ie(r)||(f={x:p.x+Ze.e,y:p.y+Ze.f});var wt=n.createSVGTransform();wt.setRotate(Je,f.x,f.y),r.numberOfItems?r.insertItemBefore(wt,0):r.appendItem(wt)}if("text"===t.tagName)for(var St=t.childNodes,kt=St.length;kt--;){var Ct=St.item(kt);if("tspan"===Ct.tagName){var At={x:ar(Ct).attr("x")||0,y:ar(Ct).attr("y")||0};rr(Ct,At,Ze)}}}else if(3===it&&Je){var Et=Te(r).matrix,Gt=n.createSVGTransform();Gt.setRotate(Je,p.x,p.y);var Pt=Gt.matrix,It=n.createSVGTransform();It.setRotate(Je,f.x,f.y);var Nt=It.matrix.inverse(),Tt=Et.inverse(),Lt=Pe(Tt,Nt,Pt,Et);rr(t,y,Lt),Je&&(r.numberOfItems?r.insertItemBefore(It,0):r.appendItem(It))}}return 0===r.numberOfItems&&t.removeAttribute("transform"),m.addSubCommand(new ve(t,_)),m},sr=jQuery,lr=q()?10:4,cr=function(){function e(t,n,a){r(this,e),this.id=t,this.selectedElement=n,this.locked=!0,this.selectorGroup=Kn.createSVGElement({element:"g",attr:{id:"selectorGroup"+this.id}}),this.selectorRect=this.selectorGroup.appendChild(Kn.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,a)}return i(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";$n.selectorGripsGroup.setAttribute("display",n);var r=this.selectedElement;this.hasGrips=t,r&&t&&(this.selectorGroup.append($n.selectorGripsGroup),e.updateGripCursors(en(r)))}},{key:"resize",value:function(e){var t=this.selectorRect,n=$n,r=n.selectorGrips,a=this.selectedElement,i=a.getAttribute("stroke-width"),o=Kn.getCurrentZoom(),s=1/o;"none"===a.getAttribute("stroke")||isNaN(i)||(s+=i/2);var l=a.tagName;"text"===l&&(s+=2/o);var c=te(a),u=Te(c).matrix;if(u.e*=o,u.f*=o,e||(e=Ht(a)),"g"===l&&!sr.data(a,"gsvg")){var d=Kt([a.childNodes]);d&&(e=d)}var h=e.x,f=e.y,g=e.width,m=e.height;s*=o;var v=Ne(h*o,f*o,g*o,m*o,u),y=v.aabox,_=y.x-s,b=y.y-s,x=y.width+2*s,w=y.height+2*s,S=_+x/2,k=b+w/2,C=en(a);if(C){var A=Kn.svgRoot().createSVGTransform();A.setRotate(-C,S,k);var E=A.matrix;v.tl=Ee(v.tl.x,v.tl.y,E),v.tr=Ee(v.tr.x,v.tr.y,E),v.bl=Ee(v.bl.x,v.bl.y,E),v.br=Ee(v.br.x,v.br.y,E);var G=v.tl,P=G.x,I=G.y,N=G.x,T=G.y,L=Math.min,M=Math.max;_=P=L(P,L(v.tr.x,L(v.bl.x,v.br.x)))-s,b=I=L(I,L(v.tr.y,L(v.bl.y,v.br.y)))-s,x=(N=M(N,M(v.tr.x,M(v.bl.x,v.br.x)))+s)-P,w=(T=M(T,M(v.tr.y,M(v.bl.y,v.br.y)))+s)-I}var O="M"+_+","+b+" L"+(_+x)+","+b+" "+(_+x)+","+(b+w)+" "+_+","+(b+w)+"z";t.setAttribute("d",O);var j=C?"rotate("+[C,S,k].join(",")+")":"";this.selectorGroup.setAttribute("transform",j),this.gripCoords={nw:[_,b],ne:[_+x,b],sw:[_,b+w],se:[_+x,b+w],n:[_+x/2,b],w:[_,b+w/2],e:[_+x,b+w/2],s:[_+x/2,b+w]},Object.entries(this.gripCoords).forEach(function(e){var t=p(e,2),n=t[0],a=t[1];r[n].setAttribute("cx",a[0]),r[n].setAttribute("cy",a[1])}),n.rotateGripConnector.setAttribute("x1",_+x/2),n.rotateGripConnector.setAttribute("y1",b),n.rotateGripConnector.setAttribute("x2",_+x/2),n.rotateGripConnector.setAttribute("y2",b-5*lr),n.rotateGrip.setAttribute("cx",_+x/2),n.rotateGrip.setAttribute("cy",b-5*lr)}}],[{key:"updateGripCursors",value:function(e){var t=Object.keys($n.selectorGrips),n=Math.round(e/45);for(n<0&&(n+=8);n>0;)t.push(t.shift()),n--;Object.values($n.selectorGrips).forEach(function(e,n){e.setAttribute("style","cursor:"+t[n]+"-resize")})}}]),e}(),ur=function(){function t(){r(this,t),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 i(t,[{key:"initGroup",value:function(){var e=this;if(this.selectorParentGroup&&this.selectorParentGroup.parentNode&&this.selectorParentGroup.remove(),this.selectorParentGroup=Kn.createSVGElement({element:"g",attr:{id:"selectorParentGroup"}}),this.selectorGripsGroup=Kn.createSVGElement({element:"g",attr:{display:"none"}}),this.selectorParentGroup.append(this.selectorGripsGroup),Kn.svgRoot().append(this.selectorParentGroup),this.selectorMap={},this.selectors=[],this.rubberBandBox=null,Object.keys(this.selectorGrips).forEach(function(t){var n=Kn.createSVGElement({element:"circle",attr:{id:"selectorGrip_resize_"+t,fill:"#22C",r:lr,style:"cursor:"+t+"-resize","stroke-width":2,"pointer-events":"all"}});sr.data(n,"dir",t),sr.data(n,"type","resize"),e.selectorGrips[t]=e.selectorGripsGroup.appendChild(n)}),this.rotateGripConnector=this.selectorGripsGroup.appendChild(Kn.createSVGElement({element:"line",attr:{id:"selectorGrip_rotateconnector",stroke:"#22C","stroke-width":"1"}})),this.rotateGrip=this.selectorGripsGroup.appendChild(Kn.createSVGElement({element:"circle",attr:{id:"selectorGrip_rotate",fill:"lime",r:lr,stroke:"#22C","stroke-width":2,style:"cursor:url("+Zn.imgPath+"rotate.png) 12 12, auto;"}})),sr.data(this.rotateGrip,"type","rotate"),!sr("#canvasBackground").length){var t=p(Zn.dimensions,2),n=t[0],r=t[1],a=Kn.createSVGElement({element:"svg",attr:{id:"canvasBackground",width:n,height:r,x:0,y:0,overflow:D()?"none":"visible",style:"pointer-events:none"}}),i=Kn.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),Kn.svgRoot().insertBefore(a,Kn.svgContent())}}},{key:"requestSelector",value:function(t,n){if(ln(t))return null;var r=this.selectors.length;if("object"===e(this.selectorMap[t.id]))return this.selectorMap[t.id].locked=!0,this.selectorMap[t.id];for(var a=0;a<r;++a)if(this.selectors[a]&&!this.selectors[a].locked)return this.selectors[a].locked=!0,this.selectors[a].reset(t,n),this.selectorMap[t.id]=this.selectors[a],this.selectors[a];return this.selectors[r]=new cr(r,t,n),this.selectorParentGroup.append(this.selectors[r].selectorGroup),this.selectorMap[t.id]=this.selectors[r],this.selectors[r]}},{key:"releaseSelector",value:function(e){if(!ln(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(Kn.createSVGElement({element:"rect",attr:{id:"selectorRubberBand",fill:"#22C","fill-opacity":.15,stroke:"#22C","stroke-width":.5,display:"none",style:"pointer-events:none"}}))),this.rubberBandBox}}]),t}(),dr=X(jQuery),hr=fe,pr=ge,fr=me,gr=ve,mr=ye,vr=ke,yr=he;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 _r=function t(a,i){r(this,t);var o={show_outside_canvas:!0,selectNew:!0,dimensions:[640,480]};i&&dr.extend(o,i);var s=o.dimensions,l=this,c=a.ownerDocument,u=c.importNode(Ot('<svg id="svgroot" xmlns="'+v.SVG+'" xlinkns="'+v.XLINK+'" width="'+s[0]+'" height="'+s[1]+'" x="'+s[0]+'" y="'+s[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);a.append(u);var d=c.createElementNS(v.SVG,"svg");(l.clearSvgContentElement=function(){dr(d).empty(),dr(d).attr({id:"svgcontent",width:s[0],height:s[1],x:s[0],y:s[1],overflow:o.show_outside_canvas?"visible":"hidden",xmlns:v.SVG,"xmlns:se":v.SE,"xmlns:xlink":v.XLINK}).appendTo(u);var e=c.createComment(" Created with SVG-edit - https://github.com/SVG-Edit/svgedit");d.append(e)})();var h="svg_";l.setIdPrefix=function(e){h=e},l.current_drawing_=new Nn(d,h);var m=l.getCurrentDrawing=function(){return l.current_drawing_},_=1,b=null,x={shape:{fill:("none"===o.initFill.color?"":"#")+o.initFill.color,fill_paint:null,fill_opacity:o.initFill.opacity,stroke:"#"+o.initStroke.color,stroke_paint:null,stroke_opacity:o.initStroke.opacity,stroke_width:o.initStroke.width,stroke_dasharray:"none",stroke_linejoin:"miter",stroke_linecap:"butt",opacity:o.initOpacity}};x.text=dr.extend(!0,{},x.shape),dr.extend(x.text,{fill:"#000000",stroke_width:o.text&&o.text.stroke_width,font_size:o.text&&o.text.font_size,font_family:o.text&&o.text.font_family});var w=x.shape,S=[],k=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]=k(a);return n},C=this.addSVGElementFromJson=function(e){if("string"==typeof e)return c.createTextNode(e);var t=nn(e.attr.id),n=m().getCurrentLayer();if(t&&e.element!==t.tagName&&(t.remove(),t=null),!t){var r=e.namespace||v.SVG;t=c.createElementNS(r,e.element),n&&(b||n).append(t)}return e.curStyles&&rn(t,{fill:w.fill,stroke:w.stroke,"stroke-width":w.stroke_width,"stroke-dasharray":w.stroke_dasharray,"stroke-linejoin":w.stroke_linejoin,"stroke-linecap":w.stroke_linecap,"stroke-opacity":w.stroke_opacity,"fill-opacity":w.fill_opacity,opacity:w.opacity/2,style:"pointer-events:inherit"}),rn(t,e.attr),an(t),e.children&&e.children.forEach(function(e){t.append(C(e))}),t};l.getTransformList=te,l.matrixMultiply=Pe,l.hasMatrixTransform=Ie,l.transformListToTransform=Te;var A=function(){return o.baseUnit};!function(e){Z=e;var t=document.createElementNS(v.SVG,"svg");document.body.append(t);var n=document.createElementNS(v.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;ie={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}}({getBaseUnit:A,getElement:nn,getHeight:function(){return d.getAttribute("height")/_},getWidth:function(){return d.getAttribute("width")/_},getRoundDigits:function(){return fe.round_digits}}),l.convertToNum=ue;var E,G=function(){return d},P=this.getSelectedElems=function(){return S},I=yt,N=function(){return u};wt=E={pathActions:I,getSVGContent:G,addSVGElementFromJson:C,getSelectedElements:P,getDOMDocument:function(){return c},getDOMContainer:function(){return a},getSVGRoot:N,getBaseUnit:A,getSnappingStep:function(){return o.snappingStep}},St=E.getDOMDocument(),kt=E.getDOMContainer(),Ct=E.getSVGRoot(),l.findDefs=Dt,l.getUrlFromAttr=Vt,l.getHref=Rt,l.setHref=Bt,l.getBBox=Ht,l.getRotationAngle=en,l.getElem=nn,l.getRefElem=tn,l.assignAttributes=rn,this.cleanupElement=an;var T=function(){return o.gridSnapping};!function(e){nr=e}({getDrawing:function(){return m()},getSVGRoot:N,getGridSnapping:T}),this.remapElement=rr,function(e){Qn=e}({getSVGRoot:N,getStartTransform:function(){return xe},setStartTransform:function(e){xe=e}}),this.recalculateDimensions=or;var L=y();l.sanitizeSvg=Jn;var O=l.undoMgr=new vr({handleHistoryEvent:function(e,t){var n=yr;if(e===n.BEFORE_UNAPPLY||e===n.BEFORE_APPLY)l.clearSelection();else if(e===n.AFTER_APPLY||e===n.AFTER_UNAPPLY){var r=t.elements();l.pathActions.clear(),Y("changed",r);var a=t.type(),i=e===n.AFTER_APPLY;if(a===hr.type())(i?t.newParent:t.oldParent)===d&&Ln();else if(a===pr.type()||a===fr.type())t.parent===d&&Ln(),a===pr.type()?i&&he(t.elem):i||he(t.elem),"use"===t.elem.tagName&&Nt(t.elem);else if(a===gr.type()){"title"===t.elem.tagName&&t.elem.parentNode.parentNode===d&&Ln();var o=i?t.newValues:t.oldValues;o.stdDeviation&&l.setBlurOffsets(t.elem.parentNode,o.stdDeviation)}}}}),j=function(e){l.undoMgr.addCommandToHistory(e)},V=this.getZoom=function(){return _},R=this.round=function(e){return parseInt(e*_)/_};!function(e,t){Zn=e,Kn=t,$n=new ur}(o,{createSVGElement:function(e){return l.addSVGElementFromJson(e)},svgRoot:function(){return u},svgContent:function(){return d},getCurrentZoom:V});var B=this.selectorManager=$n,z=l.getNextId=function(){return m().getNextId()},q=l.getId=function(){return m().getId()},Y=function(e,t){if(We[e])return We[e](window,t)},X=this.clearSelection=function(e){S.forEach(function(e){ln(e)||B.releaseSelector(e)}),S=[],e||Y("selected",S)},Q=this.addToSelection=function(e,t){if(e.length){for(var n=0;n<S.length&&!ln(S[n]);)++n;for(var r=e.length;r--;){var a=e[r];if(a){var i=Ht(a);if(i&&("a"===a.tagName&&1===a.childNodes.length&&(a=a.firstChild),!S.includes(a))){S[n]=a,n++;var o=B.requestSelector(a,i);S.length>1&&o.showGrips(!1)}}}for(Y("selected",S),t||1===S.length?B.requestSelector(S[0]).showGrips(!0):B.requestSelector(S[0]).showGrips(!1),S.sort(function(e,t){return e&&t&&e.compareDocumentPosition?3-(6&t.compareDocumentPosition(e)):ln(e)?1:0});ln(S[0]);)S.shift(0)}},K=function(){return w.opacity},ee=this.getMouseTarget=function(e){if(ln(e))return null;var t=e.target;if(t.correspondingUseElement&&(t=t.correspondingUseElement),[v.MATH,v.HTML].includes(t.namespaceURI)&&"svgcanvas"!==t.id)for(;"foreignObject"!==t.nodeName;)if(!(t=t.parentNode))return u;var n=m().getCurrentLayer();if([u,a,d,n].includes(t))return u;if(dr(t).closest("#selectorParentGroup").length)return B.selectorParentGroup;for(;t.parentNode!==(b||n);)t=t.parentNode;return t};l.pathActions=I,qe({selectorManager:B,canvas:l,call:Y,resetD:function(e){e.setAttribute("d",I.convertPath(e))},round:R,clearSelection:X,addToSelection:Q,addCommandToHistory:j,remapElement:rr,addSVGElementFromJson:C,getGridSnapping:T,getOpacity:K,getSelectedElements:P,getContainer:function(){return a},setStarted:function(e){be=e},getRubberBox:function(){return je},setRubberBox:function(e){return je=e},addPtsToSelection:function(e){var t=e.closedSubpath,n=e.grips;I.canDeleteNodes=!0,I.closed_subpath=t,Y("pointsAdded",{closedSubpath:t,grips:n}),Y("selected",n)},endChanges:function(e){var t=e.cmd,n=e.elem;j(t),Y("changed",[n])},getCurrentZoom:V,getId:q,getNextId:z,getMouseTarget:ee,getCurrentMode:function(){return we},setCurrentMode:function(e){return we=e},getDrawnPath:function(){return gt},setDrawnPath:function(e){return gt=e},getSVGRoot:N});var ne={},re="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use",ae=["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"],ce=dr.data,de=document.createElementNS(v.SVG,"animate");dr(de).attr({attributeName:"opacity",begin:"indefinite",dur:1,fill:"freeze"}).appendTo(u);var he=function e(t){var n=dr(t).attr(ae);Object.values(n).forEach(function(e){if(e&&e.startsWith("url(")){var t=Vt(e).substr(1);nn(t)||(Dt().append(ye[t]),delete ye[t])}});var r=t.getElementsByTagName("*");if(r.length)for(var a=0,i=r.length;a<i;a++)e(r[a])},pe={},fe={round_digits:5},ge={},me=x.text,ve={},ye={},_e=o.imgPath+"logo.png",be=!1,xe=null,we="select",Se="none",ke=w,Ae=null,je=null,Ve=[],Re=null;this.runExtension=function(e,t,n){return this.runExtensions(t,n,!1,function(t){return t===e})};var De=this.runExtensions=function(e,t,n,r){var a=!!n&&[];return dr.each(ve,function(i,o){r&&!r(i)||o&&e in o&&("function"==typeof t&&(t=t(i)),n?a.push(o[e](t)):a=o[e](t))}),a};this.addExtension=function(){var e=n(regeneratorRuntime.mark(function e(t,n,r){var a,i,o,s;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(a=r.$,i=r.importLocale,"function"==typeof n){e.next=3;break}throw new TypeError("Function argument expected for `svgcanvas.addExtension`");case 3:if(!(t in ve)){e.next=5;break}throw new Error('Cannot add extension "'+t+'", an extension by that name already exists.');case 5:return o=dr.extend(l.getPrivateMethods(),{$:a,importLocale:i,svgroot:u,svgcontent:d,nonce:m().getNonce(),selectorManager:B}),e.next=8,n(o);case 8:return(s=e.sent)&&(s.name=t),ve[t]=s,e.abrupt("return",Y("extension_added",s));case 12:case"end":return e.stop()}},e)}));return function(t,n,r){return e.apply(this,arguments)}}();var Ue=this.getIntersectionList=function(e){if(ln(je))return null;var t,n=b||m().getCurrentLayer();if(e)(t=d.createSVGRect()).x=e.x,t.y=e.y,t.width=e.width,t.height=e.height;else{t=je.getBBox();var r=d.createSVGRect();["x","y","width","height","top","right","bottom","left"].forEach(function(e){r[e]=t[e]/_}),t=r}var a=null;if(F()||"function"==typeof u.getIntersectionList&&(t.x+=parseInt(d.getAttribute("x")),t.y+=parseInt(d.getAttribute("y")),a=u.getIntersectionList(t,n)),ln(a)||"function"!=typeof a.item){a=[],Ve.length||(Ve=ze(n));for(var i=Ve.length;i--;)t.width&&Oe(t,Ve[i].bbox)&&a.push(Ve[i].elem)}return a};this.getStrokedBBox=$t,this.getVisibleElements=Zt;var ze=this.getVisibleElementsAndBBoxes=function(e){e||(e=dr(d).children());var t=[];return dr(e).children().each(function(e,n){n.getBBox&&t.push({elem:n,bbox:$t([n])})}),t.reverse()},Ye=this.groupSvgElem=function(e){var t=document.createElementNS(v.SVG,"g");e.replaceWith(t),dr(t).append(e).data("gsvg",e)[0].id=z()},We={};l.call=Y,l.bind=function(e,t){var n=We[e];return We[e]=t,n},this.prepareSvg=function(e){this.sanitizeSvg(e.documentElement),f(e.getElementsByTagNameNS(v.SVG,"path")).forEach(function(e){e.setAttribute("d",I.convertPath(e)),I.fixEnd(e)})};var Xe=function(e){if(!U())return e;var t=e.cloneNode(!0);return e.before(t),e.remove(),B.releaseSelector(e),S[0]=t,B.requestSelector(t).showGrips(!0),t};this.setRotationAngle=function(e,t){e=parseFloat(e);var n=S[0],r=n.getAttribute("transform"),a=Ht(n),i=a.x+a.width/2,o=a.y+a.height/2,s=te(n);s.numberOfItems>0&&(4===s.getItem(0).type&&s.removeItem(0));if(0!==e){var l=Ee(i,o,Te(s).matrix),c=u.createSVGTransform();c.setRotate(e,l.x,l.y),s.numberOfItems?s.insertItemBefore(c,0):s.appendItem(c)}else 0===s.numberOfItems&&n.removeAttribute("transform");if(!t){var d=n.getAttribute("transform");n.setAttribute("transform",r),un("transform",d,S),Y("changed",S)}B.requestSelector(S[0]).resize(),cr.updateGripCursors(e)};var Qe=this.recalculateAllSelectedDimensions=function(){for(var e=new mr("none"===Se?"position":"size"),t=S.length;t--;){var n=S[t],r=or(n);r&&e.addSubCommand(r)}e.isEmpty()||(j(e),Y("changed",S))},Ke=function(e){console.log([e.a,e.b,e.c,e.d,e.e,e.f])},Ze=null,$e=this.selectOnly=function(e,t){X(!0),Q(e,t)};this.removeFromSelection=function(e){if(!ln(S[0])&&e.length){for(var t=[],n=S.length,r=0;r<n;++r){var a=S[r];a&&(e.includes(a)?B.releaseSelector(a):t.push(a))}S=t}},this.selectAllInCurrentLayer=function(){var e=m().getCurrentLayer();e&&(we="select",$e(dr(b||e).children()))};var Je,et,tt,nt,rt,at,it,ot,lt,ct,ut,dt,ht,pt,ft,gt=null;et={minx:null,miny:null,maxx:null,maxy:null},tt=null,nt=null,rt=null,at=null,it={},ot=0,lt={x:0,y:0},ct={x:0,y:0},ut={x:0,y:0},dt={x:0,y:0},ht={x:0,y:0},pt={x:0,y:0},ft=function(e){var t={x:0,y:0},n=lt,r=ct,a=ut,i=dt,o=e*e,s=o*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])*s+(n.x*l[1][0]+r.x*l[1][1]+a.x*l[1][2]+i.x*l[1][3])*o+(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])*s+(n.y*l[1][0]+r.y*l[1][1]+a.y*l[1][2]+i.y*l[1][3])*o+(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}},dr(a).mousedown(function(e){if(!l.spaceKey&&1!==e.button){var t=2===e.button;e.altKey&&l.cloneSelectedElements(0,0),Ze=dr("#svgcontent g")[0].getScreenCTM().inverse();var n=Ee(e.pageX,e.pageY,Ze),r=n.x*_,a=n.y*_;e.preventDefault(),t&&(we="select",Re=n);var i=r/_,s=a/_,c=ee(e);"a"===c.tagName&&1===c.childNodes.length&&(c=c.firstChild);var d=i;rt=tt=i;var h=s;if(at=nt=s,o.gridSnapping&&(i=on(i),s=on(s),tt=on(tt),nt=on(nt)),c===B.selectorParentGroup&&!ln(S[0])){var p=e.target,f=ce(p,"type");"rotate"===f?we="rotate":"resize"===f&&(we="resize",Se=ce(p,"dir")),c=S[0]}xe=c.getAttribute("transform");var g=te(c);switch(we){case"select":if(be=!0,Se="none",t&&(be=!1),c!==u){if(S.includes(c)||(e.shiftKey||X(!0),Q([c]),Ae=c,I.clear()),!t)for(var m=0,v=S;m<v.length;m++){var y=v[m];if(!ln(y)){var b=te(y);b.numberOfItems?b.insertItemBefore(u.createSVGTransform(),0):b.appendItem(u.createSVGTransform())}}}else t||(X(),we="multiselect",ln(je)&&(je=B.getRubberBandBox()),rn(je,{x:rt*=_,y:at*=_,width:0,height:0,display:"inline"}));break;case"zoom":be=!0,ln(je)&&(je=B.getRubberBandBox()),rn(je,{x:d*_,y:d*_,width:0,height:0,display:"inline"});break;case"resize":be=!0,tt=i,nt=s,it=Ht(dr("#selectedBox0")[0]);var x={};dr.each(it,function(e,t){x[e]=t/_}),it=x;var k=en(c)?1:0;if(Ie(g))g.insertItemBefore(u.createSVGTransform(),k),g.insertItemBefore(u.createSVGTransform(),k),g.insertItemBefore(u.createSVGTransform(),k);else if(g.appendItem(u.createSVGTransform()),g.appendItem(u.createSVGTransform()),g.appendItem(u.createSVGTransform()),W()){var A,E=D();E&&(A=function(e){var t=e.getAttribute("stroke");e.removeAttribute("stroke"),null!==t&&setTimeout(function(){e.setAttribute("stroke",t)},0)}),c.style.vectorEffect="non-scaling-stroke",E&&A(c);for(var G=c.getElementsByTagName("*"),P=G.length,N=0;N<P;N++)G[N].style&&(G[N].style.vectorEffect="non-scaling-stroke",E&&A(G[N]))}break;case"fhellipse":case"fhrect":case"fhpath":ut.x=d,ut.y=h,be=!0,C({element:"polyline",curStyles:!0,attr:{points:d+","+h+" ",id:z(),fill:"none",opacity:w.opacity/2,"stroke-linecap":"round",style:"pointer-events:none"}}),et.minx=d,et.maxx=d,et.miny=h,et.maxy=h;break;case"image":be=!0;var T=C({element:"image",attr:{x:i,y:s,width:0,height:0,id:z(),opacity:w.opacity/2,style:"pointer-events:inherit"}});Bt(T,_e),sn(T);break;case"square":case"rect":be=!0,tt=i,nt=s,C({element:"rect",curStyles:!0,attr:{x:i,y:s,width:0,height:0,id:z(),opacity:w.opacity/2}});break;case"line":be=!0;var L=0===Number(w.stroke_width)?1:w.stroke_width;C({element:"line",curStyles:!0,attr:{x1:i,y1:s,x2:i,y2:s,id:z(),stroke:w.stroke,"stroke-width":L,"stroke-dasharray":w.stroke_dasharray,"stroke-linejoin":w.stroke_linejoin,"stroke-linecap":w.stroke_linecap,"stroke-opacity":w.stroke_opacity,fill:"none",opacity:w.opacity/2,style:"pointer-events:none"}});break;case"circle":be=!0,C({element:"circle",curStyles:!0,attr:{cx:i,cy:s,r:0,id:z(),opacity:w.opacity/2}});break;case"ellipse":be=!0,C({element:"ellipse",curStyles:!0,attr:{cx:i,cy:s,rx:0,ry:0,id:z(),opacity:w.opacity/2}});break;case"text":be=!0,C({element:"text",curStyles:!0,attr:{x:i,y:s,id:z(),fill:me.fill,"stroke-width":me.stroke_width,"font-size":me.font_size,"font-family":me.font_family,"text-anchor":"middle","xml:space":"preserve",opacity:w.opacity}});break;case"path":case"pathedit":tt*=_,nt*=_,I.mouseDown(e,c,tt,nt),be=!0;break;case"textedit":tt*=_,nt*=_,vt.mouseDown(e,c,tt,nt),be=!0;break;case"rotate":be=!0,l.undoMgr.beginUndoableChange("transform",S)}var M=De("mouseDown",{event:e,start_x:tt,start_y:nt,selectedElements:S},!0);dr.each(M,function(e,t){t&&t.started&&(be=!0)})}}).mousemove(function(e){if(be&&1!==e.button&&!l.spaceKey){var t,n,r,a,i,s,c,h,p,f,g=S[0],m=Ee(e.pageX,e.pageY,Ze),v=m.x*_,y=m.y*_,b=nn(q()),x=v/_,w=x,k=y/_,C=k;switch(o.gridSnapping&&(w=on(w),C=on(C)),e.preventDefault(),we){case"select":if(null!==S[0]&&(i=w-tt,s=C-nt,o.gridSnapping&&(i=on(i),s=on(s)),0!==i||0!==s)){for(c=S.length,t=0;t<c&&(g=S[t],!ln(g));++t){var A=u.createSVGTransform();f=te(g),A.setTranslate(i,s),f.numberOfItems?f.replaceItem(A,0):f.appendItem(A),B.requestSelector(g).resize()}Y("transition",S)}break;case"multiselect":x*=_,k*=_,rn(je,{x:Math.min(rt,x),y:Math.min(at,k),width:Math.abs(x-rt),height:Math.abs(k-at)});var E=S.slice(),G=[],P=Ue();for(c=P.length,t=0;t<c;++t){var N=P[t];S.includes(N)||G.push(N);var T=E.indexOf(N);-1!==T&&E.splice(T,1)}E.length>0&&l.removeFromSelection(E),G.length>0&&l.addToSelection(G);break;case"resize":f=te(g);var L=Ie(f),M=(p=L?it:Ht(g)).x,O=p.y,j=p,V=j.width,R=j.height;if(i=w-tt,s=C-nt,o.gridSnapping&&(i=on(i),s=on(s),R=on(R),V=on(V)),h=en(g)){var D=Math.sqrt(i*i+s*s),U=Math.atan2(s,i)-h*Math.PI/180;i=D*Math.cos(U),s=D*Math.sin(U)}Se.includes("n")||Se.includes("s")||(s=0),Se.includes("e")||Se.includes("w")||(i=0);var F=0,H=0,z=R?(R+s)/R:1,W=V?(V+i)/V:1;Se.includes("n")&&(z=R?(R-s)/R:1,H=R),Se.includes("w")&&(W=V?(V-i)/V:1,F=V);var X=u.createSVGTransform(),Q=u.createSVGTransform(),K=u.createSVGTransform();if(o.gridSnapping&&(M=on(M),F=on(F),O=on(O),H=on(H)),X.setTranslate(-(M+F),-(O+H)),e.shiftKey&&(1===W?W=z:z=W),Q.setScale(W,z),K.setTranslate(M+F,O+H),L){var Z=h?1:0;f.replaceItem(X,2+Z),f.replaceItem(Q,1+Z),f.replaceItem(K,Number(Z))}else{var $=f.numberOfItems;f.replaceItem(K,$-3),f.replaceItem(Q,$-2),f.replaceItem(X,$-1)}B.requestSelector(g).resize(),Y("transition",S);break;case"zoom":x*=_,k*=_,rn(je,{x:Math.min(rt*_,x),y:Math.min(at*_,k),width:Math.abs(x-rt*_),height:Math.abs(k-at*_)});break;case"text":rn(b,{x:w,y:C});break;case"line":o.gridSnapping&&(w=on(w),C=on(C));var J=w,ee=C;e.shiftKey&&(J=(n=Me(tt,nt,J,ee)).x,ee=n.y),b.setAttribute("x2",J),b.setAttribute("y2",ee);break;case"foreignObject":case"square":case"rect":case"image":var ne,re,ae="square"===we||e.shiftKey,ie=Math.abs(w-tt),oe=Math.abs(C-nt);ae?(ie=oe=Math.max(ie,oe),ne=tt<w?tt:tt-ie,re=nt<C?nt:nt-oe):(ne=Math.min(tt,w),re=Math.min(nt,C)),o.gridSnapping&&(ie=on(ie),oe=on(oe),ne=on(ne),re=on(re)),rn(b,{width:ie,height:oe,x:ne,y:re});break;case"circle":var se=dr(b).attr(["cx","cy"]);r=se.cx,a=se.cy;var le=Math.sqrt((w-r)*(w-r)+(C-a)*(C-a));o.gridSnapping&&(le=on(le)),b.setAttribute("r",le);break;case"ellipse":var ce=dr(b).attr(["cx","cy"]);r=ce.cx,a=ce.cy,o.gridSnapping&&(w=on(w),r=on(r),C=on(C),a=on(a)),b.setAttribute("rx",Math.abs(w-r));var ue=Math.abs(e.shiftKey?w-r:C-a);b.setAttribute("ry",ue);break;case"fhellipse":case"fhrect":et.minx=Math.min(x,et.minx),et.maxx=Math.max(x,et.maxx),et.miny=Math.min(k,et.miny),et.maxy=Math.max(k,et.maxy);case"fhpath":if(dt.x=x,dt.y=k,lt.x&&lt.y)for(t=0;t<9;t++)if(Je=t/10,ht=ft((t+1)/10),pt=ht,ht=ft(Je),(ot+=Math.sqrt((pt.x-ht.x)*(pt.x-ht.x)+(pt.y-ht.y)*(pt.y-ht.y)))>.8){ot-=.8;var de=d.createSVGPoint();de.x=ht.x,de.y=ht.y,b.points.appendItem(de)}lt={x:ct.x,y:ct.y},ct={x:ut.x,y:ut.y},ut={x:dt.x,y:dt.y};break;case"path":case"pathedit":if(w*=_,C*=_,o.gridSnapping&&(w=on(w),C=on(C),tt=on(tt),nt=on(nt)),e.shiftKey){var he,pe,fe=He;fe?(he=fe.dragging?fe.dragging[0]:tt,pe=fe.dragging?fe.dragging[1]:nt):(he=tt,pe=nt);var ge=n=Me(he,pe,w,C);w=ge.x,C=ge.y}je&&"none"!==je.getAttribute("display")&&(x*=_,k*=_,rn(je,{x:Math.min(rt*_,x),y:Math.min(at*_,k),width:Math.abs(x-rt*_),height:Math.abs(k-at*_)})),I.mouseMove(w,C);break;case"textedit":w*=_,C*=_,vt.mouseMove(v,y);break;case"rotate":r=(p=Ht(g)).x+p.width/2,a=p.y+p.height/2;var me=Le(g),ve=Ee(r,a,me);r=ve.x,a=ve.y,h=(Math.atan2(a-C,r-w)*(180/Math.PI)-90)%360,o.gridSnapping&&(h=on(h)),e.shiftKey&&(h=45*Math.round(h/45)),l.setRotationAngle(h<-180?360+h:h,!0),Y("transition",S)}De("mouseMove",{event:e,mouse_x:v,mouse_y:y,selected:g})}}).click(function(e){return e.preventDefault(),!1}).dblclick(function(e){var t=e.target.parentNode;if(t!==b){var n=ee(e),r=n.tagName;if("text"===r&&"textedit"!==we){var a=Ee(e.pageX,e.pageY,Ze);vt.select(n,a.x,a.y)}"g"!==r&&"a"!==r||!en(n)||(dn(n),n=S[0],X(!0)),b&&zn(),"g"!==t.tagName&&"a"!==t.tagName||t===m().getCurrentLayer()||n===B.selectorParentGroup||qn(n)}}).mouseup(function(e){if(2!==e.button){var t=Ae;if(Ae=null,be){var n,r,a=Ee(e.pageX,e.pageY,Ze),i=a.x*_,s=a.y*_,c=i/_,u=s/_,d=nn(q()),h=!1,p=c,f=u;switch(be=!1,we){case"resize":case"multiselect":ln(je)||(je.setAttribute("display","none"),Ve=[]),we="select";case"select":if(!ln(S[0])){if(ln(S[1])){var g=S[0];switch(g.tagName){case"g":case"use":case"image":case"foreignObject":break;default:ke.fill=g.getAttribute("fill"),ke.fill_opacity=g.getAttribute("fill-opacity"),ke.stroke=g.getAttribute("stroke"),ke.stroke_opacity=g.getAttribute("stroke-opacity"),ke.stroke_width=g.getAttribute("stroke-width"),ke.stroke_dasharray=g.getAttribute("stroke-dasharray"),ke.stroke_linejoin=g.getAttribute("stroke-linejoin"),ke.stroke_linecap=g.getAttribute("stroke-linecap")}"text"===g.tagName&&(me.font_size=g.getAttribute("font-size"),me.font_family=g.getAttribute("font-family")),B.requestSelector(g).showGrips(!0)}if(Qe(),p!==rt||f!==at)for(var v=S.length,y=0;y<v&&!ln(S[y]);++y)S[y].firstChild||B.requestSelector(S[y]).resize();else r=e.target,"path"===S[0].nodeName&&ln(S[1])?I.select(S[0]):e.shiftKey&&t!==r&&l.removeFromSelection([r]);if(W()){var b=S[0];b&&(b.removeAttribute("style"),jt(b,function(e){e.removeAttribute("style")}))}}return;case"zoom":ln(je)||je.setAttribute("display","none");var x=e.shiftKey?.5:2;return void Y("zoomed",{x:Math.min(rt,p),y:Math.min(at,f),width:Math.abs(p-rt),height:Math.abs(f-at),factor:x});case"fhpath":ot=0,lt={x:0,y:0},ct={x:0,y:0},ut={x:0,y:0},dt={x:0,y:0};var k=d.getAttribute("points"),A=k.indexOf(",");(h=A>=0?k.includes(",",A+1):k.includes(" ",k.indexOf(" ")+1))&&(d=I.smoothPolylineIntoPath(d));break;case"line":n=dr(d).attr(["x1","x2","y1","y2"]),h=n.x1!==n.x2||n.y1!==n.y2;break;case"foreignObject":case"square":case"rect":case"image":n=dr(d).attr(["width","height"]),h=n.width||n.height||"image"===we;break;case"circle":h="0"!==d.getAttribute("r");break;case"ellipse":n=dr(d).attr(["rx","ry"]),h=n.rx||n.ry;break;case"fhellipse":et.maxx-et.minx>0&&et.maxy-et.miny>0&&(d=C({element:"ellipse",curStyles:!0,attr:{cx:(et.minx+et.maxx)/2,cy:(et.miny+et.maxy)/2,rx:(et.maxx-et.minx)/2,ry:(et.maxy-et.miny)/2,id:q()}}),Y("changed",[d]),h=!0);break;case"fhrect":et.maxx-et.minx>0&&et.maxy-et.miny>0&&(d=C({element:"rect",curStyles:!0,attr:{x:et.minx,y:et.miny,width:et.maxx-et.minx,height:et.maxy-et.miny,id:q()}}),Y("changed",[d]),h=!0);break;case"text":h=!0,$e([d]),vt.start(d);break;case"path":d=null,be=!0;var E=I.mouseUp(e,d,i,s);d=E.element,h=E.keep;break;case"pathedit":h=!0,d=null,I.mouseUp(e);break;case"textedit":h=!1,d=null,vt.mouseUp(e,i,s);break;case"rotate":h=!0,d=null,we="select";var G=l.undoMgr.finishUndoableChange();G.isEmpty()||j(G),Qe(),Y("changed",S)}var P=De("mouseUp",{event:e,mouse_x:i,mouse_y:s},!0);if(dr.each(P,function(e,t){t&&(h=t.keep||h,d=t.element,be=t.started||be)}),h||ln(d)){if(!ln(d)){l.addedNew=!0;var N,T=.2;if(de.beginElement&&parseFloat(d.getAttribute("opacity"))!==w.opacity){N=dr(de).clone().attr({to:w.opacity,dur:T}).appendTo(d);try{N[0].beginElement()}catch(e){}}else T=0;setTimeout(function(){N&&N.remove(),d.setAttribute("opacity",w.opacity),d.setAttribute("style","pointer-events:inherit"),an(d),"path"===we?I.toEditMode(d):o.selectNew&&$e([d],!0),j(new pr(d)),Y("changed",[d])},1e3*T)}}else{for(m().releaseId(q()),d.remove(),d=null,r=e.target;r&&r.parentNode&&r.parentNode.parentNode&&"g"===r.parentNode.parentNode.tagName;)r=r.parentNode;"path"===we&&gt||!r||!r.parentNode||"selectorParentGroup"===r.parentNode.id||"svgcanvas"===r.id||"svgroot"===r.id||(l.setMode("select"),$e([r],!0))}xe=null}}}),dr(a).bind("mousewheel DOMMouseScroll",function(e){if(e.shiftKey){e.preventDefault();var t=e.originalEvent;Ze=dr("#svgcontent g")[0].getScreenCTM().inverse();var n=dr("#workarea"),r=o.showRulers?16:0,a=Ee(t.pageX,t.pageY,Ze),i=n.width(),s=n.height(),c=i-15-r,u=s-15-r,d=c*Ze.a,h=u*Ze.d,p=n.offset(),f=p.left+r,g=p.top+r,m=t.wheelDelta?t.wheelDelta:t.detail?-t.detail:0;if(m){var v,y,b=Math.max(.75,Math.min(4/3,m));b>1?(v=Math.ceil(c/d*b*100)/100,y=Math.ceil(u/h*b*100)/100):(v=Math.floor(c/d*b*100)/100,y=Math.floor(u/h*b*100)/100);var x=Math.min(v,y);if((x=Math.min(10,Math.max(.01,x)))!==_){b=x/_;var w=Ee(f,g,Ze),S={x:(a.x-(a.x-w.x)/b)*x-r+i/2,y:(a.y-(a.y-w.y)/b)*x-r+s/2};l.setZoom(x),dr("#zoom").val((100*x).toFixed(1)),Y("updateCanvas",{center:!1,newCtr:S}),Y("zoomDone")}}}});var mt,vt=l.textActions=function(){var e,t,n,r,a,i,o,s,c,d,h=[];function p(e){var o=""===t.value;if(dr(t).focus(),!arguments.length)if(o)e=0;else{if(t.selectionEnd!==t.selectionStart)return;e=t.selectionEnd}var s=h[e];o||t.setSelectionRange(e,e),(n=nn("text_cursor"))||(n=document.createElementNS(v.SVG,"line"),rn(n,{id:"text_cursor",stroke:"#333","stroke-width":1}),n=nn("selectorParentGroup").appendChild(n)),a||(a=setInterval(function(){var e="none"===n.getAttribute("display");n.setAttribute("display",e?"inline":"none")},600));var l=x(s.x,i.y),c=x(s.x,i.y+i.height);rn(n,{x1:l.x,y1:l.y,x2:c.x,y2:c.y,visibility:"visible",display:"inline"}),r&&r.setAttribute("d","")}function f(e,a,o){if(e!==a){o||t.setSelectionRange(e,a),(r=nn("text_selectblock"))||(r=document.createElementNS(v.SVG,"path"),rn(r,{id:"text_selectblock",fill:"green",opacity:.5,style:"pointer-events:none"}),nn("selectorParentGroup").append(r));var s=h[e],l=h[a];n.setAttribute("visibility","hidden");var c=x(s.x,i.y),u=x(s.x+(l.x-s.x),i.y),d=x(s.x,i.y+i.height),f=x(s.x+(l.x-s.x),i.y+i.height),g="M"+c.x+","+c.y+" L"+u.x+","+u.y+" "+f.x+","+f.y+" "+d.x+","+d.y+"z";rn(r,{d:g,display:"inline"})}else p(a)}function g(t,n){var r=u.createSVGPoint();if(r.x=t,r.y=n,1===h.length)return 0;var a=e.getCharNumAtPosition(r);a<0?(a=h.length-2,t<=h[0].x&&(a=0)):a>=h.length-2&&(a=h.length-2);var i=h[a];return t>i.x+i.width/2&&a++,a}function m(e,t){p(g(e,t))}function y(e,n,r){var a=t.selectionStart,i=g(e,n);f(Math.min(a,i),Math.max(a,i),!r)}function b(e,t){var n={x:e,y:t};if(n.x/=_,n.y/=_,o){var r=Ee(n.x,n.y,o.inverse());n.x=r.x,n.y=r.y}return n}function x(e,t){var n={x:e,y:t};if(o){var r=Ee(n.x,n.y,o);n.x=r.x,n.y=r.y}return n.x*=_,n.y*=_,n}function w(t){f(0,e.textContent.length),dr(this).unbind(t)}function k(t){if(d&&e){var n=Ee(t.pageX,t.pageY,Ze),r=b(n.x*_,n.y*_),a=g(r.x,r.y),i=e.textContent,o=i.substr(0,a).replace(/[a-z0-9]+$/i,"").length,s=i.substr(a).match(/^[a-z0-9]+/i);f(o,(s?s[0].length:0)+a),dr(t.target).click(w),setTimeout(function(){dr(t.target).unbind("click",w)},300)}}return{select:function(t,n,r){e=t,vt.toEditMode(n,r)},start:function(t){e=t,vt.toEditMode()},mouseDown:function(e,n,r,a){var i=b(r,a);t.focus(),m(i.x,i.y),s=r,c=a},mouseMove:function(e,t){var n=b(e,t);y(n.x,n.y)},mouseUp:function(t,n,r){var a=b(n,r);y(a.x,a.y,!0),t.target!==e&&n<s+2&&n>s-2&&r<c+2&&r>c-2&&vt.toSelectMode(!0)},setCursor:p,toEditMode:function(t,n){if(d=!1,we="textedit",B.requestSelector(e).showGrips(!1),B.requestSelector(e),vt.init(),dr(e).css("cursor","text"),arguments.length){var r=b(t,n);m(r.x,r.y)}else p();setTimeout(function(){d=!0},300)},toSelectMode:function(i){we="select",clearInterval(a),a=null,r&&dr(r).attr("display","none"),n&&dr(n).attr("visibility","hidden"),dr(e).css("cursor","move"),i&&(X(),dr(e).css("cursor","move"),Y("selected",[e]),Q([e],!0)),e&&!e.textContent.length&&l.deleteSelectedElements(),dr(t).blur(),e=!1},setInputElem:function(e){t=e},clear:function(){"textedit"===we&&vt.toSelectMode()},init:function(n){if(e){var r,a;e.parentNode||(e=S[0],B.requestSelector(e).showGrips(!1));var s=e.textContent.length,c=e.getAttribute("transform");for(i=Ht(e),o=c?Le(e):null,(h=[]).length=s,t.focus(),dr(e).unbind("dblclick",k).dblclick(k),s||(a={x:i.x+i.width/2,width:0}),r=0;r<s;r++){var u=e.getStartPositionOfChar(r);if(a=e.getEndPositionOfChar(r),!M){var d=l.contentW*_;u.x-=d,a.x-=d,u.x/=_,a.x/=_}h[r]={x:u.x,y:i.y,width:a.x-u.x,height:i.height}}h.push({x:a.x,width:0}),f(t.selectionStart,t.selectionEnd,!0)}}}}(),bt=this.removeUnusedDefElems=function(){var e=d.getElementsByTagNameNS(v.SVG,"defs");if(!e||!e.length)return 0;var t,n,r=[],a=0,i=["fill","stroke","filter","marker-start","marker-mid","marker-end"],o=i.length,s=d.getElementsByTagNameNS(v.SVG,"*"),l=s.length;for(t=0;t<l;t++){var c=s[t];for(n=0;n<o;n++){var u=Vt(c.getAttribute(i[n]));u&&r.push(u.substr(1))}var h=Rt(c);h&&h.startsWith("#")&&r.push(h.substr(1))}var p=dr(e).find("linearGradient, radialGradient, filter, marker, svg, symbol");for(t=p.length;t--;){var f=p[t],g=f.id;r.includes(g)||(ye[g]=f,f.remove(),a++)}return a};function xt(){X();var e=[],t=[],n={feGaussianBlur:ne.exportNoBlur,foreignObject:ne.exportNoforeignObject,"[stroke-dasharray]":ne.exportNoDashArray},r=dr(d);return"font"in dr("<canvas>")[0].getContext("2d")||(n.text=ne.exportNoText),dr.each(n,function(n,a){r.find(n).length&&(t.push(n),e.push(a))}),{issues:e,issueCodes:t}}this.svgCanvasToString=function(){for(;bt()>0;);I.clear(!0),dr.each(d.childNodes,function(e,t){e&&8===t.nodeType&&t.data.includes("Created with")&&d.firstChild.before(t)}),b&&(zn(),$e([b]));var e=[];dr(d).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),dr(this).replaceWith(a)}});var t=this.svgToString(d,0);return e.length&&dr(e).each(function(){Ye(this)}),t},this.svgToString=function(e,t){var n=[],r=o.baseUnit,a=new RegExp("^-?[\\d\\.]+"+r+"$");if(e){an(e);var i=f(e.attributes),s=e.childNodes;i.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=Xt();"px"!==r&&(c.w=le(c.w,r)+r,c.h=le(c.h,r)+r),n.push(' width="'+c.w+'" height="'+c.h+'" xmlns="'+v.SVG+'"');var u={};dr(e).find("*").andSelf().each(function(){var e=this.namespaceURI;e&&!u[e]&&L[e]&&"xmlns"!==L[e]&&"xml"!==L[e]&&(u[e]=!0,n.push(" xmlns:"+L[e]+'="'+e+'"')),dr.each(this.attributes,function(e,t){var r=t.namespaceURI;r&&!u[r]&&"xmlns"!==L[r]&&"xml"!==L[r]&&(u[r]=!0,n.push(" xmlns:"+L[r]+'="'+r+'"'))})});for(var d=i.length,h=["width","height","xmlns","x","y","viewBox","id","overflow"];d--;){var p=i[d],g=Et(p.value);p.nodeName.startsWith("xmlns:")||(""===g||h.includes(p.localName)||p.namespaceURI&&!L[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 m=["-moz-math-font-style","_moz-math-font-style"],y=i.length-1;y>=0;y--){var _=i[y],b=Et(_.value);if(!m.includes(_.localName)&&""!==b){if(b.startsWith("pointer-events"))continue;if("class"===_.localName&&b.startsWith("se_"))continue;if(n.push(" "),"d"===_.localName&&(b=I.convertPath(e,!0)),isNaN(b)?a.test(b)&&(b=se(b)+r):b=se(b),fe.apply&&"image"===e.nodeName&&"href"===_.localName&&fe.images&&"embed"===fe.images){var x=pe[b];x&&(b=x)}_.namespaceURI&&_.namespaceURI!==v.SVG&&!L[_.namespaceURI]||(n.push(_.nodeName),n.push('="'),n.push(b),n.push('"'))}}}if(e.hasChildNodes()){n.push(">"),t++;for(var w=!1,S=0;S<s.length;S++){var k=s.item(S);switch(k.nodeType){case 1:n.push("\n"),n.push(this.svgToString(s.item(S),t));break;case 3:var C=k.nodeValue.replace(/^\s+|\s+$/g,"");""!==C&&(w=!0,n.push(String(Et(C))));break;case 4:n.push("\n"),n.push(new Array(t+1).join(" ")),n.push("<![CDATA["),n.push(k.nodeValue),n.push("]]>");break;case 8:n.push("\n"),n.push(new Array(t+1).join(" ")),n.push("\x3c!--"),n.push(k.data),n.push("--\x3e")}}if(t--,!w){n.push("\n");for(var A=0;A<t;A++)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){dr(new Image).load(function(r,a,i){if("error"!==a){var o=document.createElement("canvas");o.width=this.width,o.height=this.height,o.getContext("2d").drawImage(this,0,0);try{var s=";svgedit_url="+encodeURIComponent(e);s=o.toDataURL().replace(";base64",s+";base64"),pe[e]=s}catch(t){pe[e]=!1}_e=e,t(pe[e])}else n(new Error("Error loading image: "+i.status+" "+i.statusText))}).attr("src",e)})},this.setGoodImage=function(e){_e=e},this.open=function(){},this.save=function(e){X(),e&&dr.extend(fe,e),fe.apply=!0;var t=this.svgCanvasToString();Y("saved",t)},this.rasterExport=function(){var e=n(regeneratorRuntime.mark(function e(t,n,r){var a,i,s,c,u,d,h,p,f,g=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(a=g.length>3&&void 0!==g[3]?g[3]:{},s="image/"+(i="ICO"===t?"BMP":t||"PNG").toLowerCase(),c=xt(),u=c.issues,d=c.issueCodes,h=this.svgCanvasToString(),mt){e.next=10;break}return e.next=8,fn(o.canvgPath+"canvg.js",{global:"canvg"});case 8:p=e.sent,mt=p.canvg;case 10:return dr("#export_canvas").length||dr("<canvas>",{id:"export_canvas"}).hide().appendTo("body"),(f=dr("#export_canvas")[0]).width=l.contentW,f.height=l.contentH,e.next=16,mt(f,h);case 16:return e.abrupt("return",new Promise(function(e,o){var l,c=i.toLowerCase(),p=n?f.toDataURL("image/"+c,n):f.toDataURL("image/"+c);function g(){var i={datauri:p,bloburl:l,svg:h,issues:u,issueCodes:d,type:t,mimeType:s,quality:n,exportWindowName:r};a.avoidEvent||Y("exported",i),e(i)}f.toBlob?f.toBlob(function(e){l=Lt(e),g()},s,n):(l=Tt(p),g())}));case 17:case"end":return e.stop()}},e,this)}));return function(t,n,r){return e.apply(this,arguments)}}(),this.exportPDF=function(){var e=n(regeneratorRuntime.mark(function e(t){var n,r,a,i,s,l,c,u,d,h,p,f,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]:H()?"save":void 0,window.jsPDF){e.next=7;break}return e.next=4,mn(["jspdf/underscore-min.js","jspdf/jspdf.min.js"]);case 4:return r=!("svgEditor"in window&&window.svgEditor&&!1===window.svgEditor.modules),e.next=7,mn(o.jspdfPath+"jspdf.plugin.svgToPdf.js",{type:r?"module":"text/javascript"});case 7:return a=Xt(),i=a.w>a.h?"landscape":"portrait",s="pt",l=jsPDF({orientation:i,unit:s,format:[a.w,a.h]}),c=Qt(),l.setProperties({title:c}),u=xt(),d=u.issues,h=u.issueCodes,p=this.svgCanvasToString(),l.addSVG(p,0,0),(f={svg:p,issues:d,issueCodes:h,exportWindowName:t,outputType:n=n||"dataurlstring"}).output=l.output(n,"save"===n?t||"svg.pdf":void 0),Y("exportedPDF",f),e.abrupt("return",f);case 21:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}(),this.getSvgString=function(){return fe.apply=!1,this.svgCanvasToString()},this.randomizeIds=function(e){arguments.length>0&&!1===e?Tn(!1,m()):Tn(!0,m())};var It=this.uniquifyElems=function(e){var t={},n=["filter","linearGradient","pattern","radialGradient","symbol","textPath","use"];for(var r in jt(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),dr.each(ae,function(n,r){var a=e.getAttributeNode(r);if(a){var i=Vt(a.value),o=i?i.substr(1):null;o&&(o in t||(t[o]={elem:null,attrs:[],hrefs:[]}),t[o].attrs.push(a))}});var r=Rt(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=z();a.id=i;for(var o=t[r].attrs,s=o.length;s--;){var l=o[s];l.ownerElement.setAttribute(l.name,"url(#"+i+")")}for(var c=t[r].hrefs,u=c.length;u--;){var d=c[u];Bt(d,"#"+i)}}}},Nt=this.setUseData=function(e){var t=dr(e);"use"!==e.tagName&&(t=t.find("use")),t.each(function(){var e=Rt(this).substr(1),t=nn(e);t&&(dr(this).data("ref",t),"symbol"!==t.tagName&&"svg"!==t.tagName||dr(this).data("symbol",t).data("ref",t))})},Mt=this.convertGradients=function(e){var t=dr(e).find("linearGradient, radialGradient");!t.length&&D()&&(t=dr(e).find("*").filter(function(){return this.tagName.includes("Gradient")})),t.each(function(){if("userSpaceOnUse"===dr(this).attr("gradientUnits")){var e=dr(d).find('[fill="url(#'+this.id+')"],[stroke="url(#'+this.id+')"]');if(!e.length)return;var t=Ht(e[0]);if(!t)return;if("linearGradient"===this.tagName){var n=dr(this).attr(["x1","y1","x2","y2"]),r=this.gradientTransform.baseVal;if(r&&r.numberOfItems>0){var a=Te(r).matrix,i=Ee(n.x1,n.y1,a),o=Ee(n.x2,n.y2,a);n.x1=i.x,n.y1=i.y,n.x2=o.x,n.y2=o.y,this.removeAttribute("gradientTransform")}dr(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")}}})},Ft=this.convertToGroup=function(e){e||(e=S[0]);var t,n=dr(e),r=new mr;if(n.data("gsvg")){var a=e.firstChild,i=dr(a).attr(["x","y"]);dr(e.firstChild.firstChild).unwrap(),dr(e).removeData("gsvg");var o=te(e),s=u.createSVGTransform();s.setTranslate(i.x,i.y),o.appendItem(s),or(e),Y("selected",[e])}else if(n.data("symbol")){e=n.data("symbol"),t=n.attr("transform");var l=n.attr(["x","y"]),h=e.getAttribute("viewBox");if(h){var p=h.split(" ");l.x-=Number(p[0]),l.y-=Number(p[1])}t+=" translate("+(l.x||0)+","+(l.y||0)+")";var f=n.prev();r.addSubCommand(new fr(n[0],n[0].nextSibling,n[0].parentNode)),n.remove();var g,m=dr(d).find("use:data(symbol)").length,y=c.createElementNS(v.SVG,"g"),_=e.childNodes;for(g=0;g<_.length;g++)y.append(_[g].cloneNode(!0));if(U()){var b=dr(Dt()).children("linearGradient,radialGradient,pattern").clone();dr(y).append(b)}t&&y.setAttribute("transform",t);var x=e.parentNode;if(It(y),U()&&dr(Dt()).append(dr(y).find("linearGradient,radialGradient,pattern")),y.id=z(),f.after(y),x){if(!m){var w=e.nextSibling;e.remove(),r.addSubCommand(new fr(e,w,x))}r.addSubCommand(new pr(y))}Nt(y),U()?Mt(Dt()):Mt(y),function(e,t){if(e&&1===e.nodeType){for(var n=e.childNodes.length;n--;)jt(e.childNodes.item(n),t);t(e)}}(y,function(e){try{or(e)}catch(e){console.log(e)}}),dr(y).find(re).each(function(){this.id||(this.id=z())}),$e([y]);var k=dn(y,!0);k&&r.addSubCommand(k),j(r)}else console.log("Unexpected element to ungroup:",e)};this.setSvgString=function(e,t){try{var n=Ot(e);if(n.firstElementChild&&n.firstElementChild.namespaceURI!==v.SVG)return!1;this.prepareSvg(n);var r=new mr("Change Source"),a=d.nextSibling,i=u.removeChild(d);r.addSubCommand(new fr(i,a,u)),d=c.adoptNode?c.adoptNode(n.documentElement):c.importNode(n.documentElement,!0),u.append(d);var s=dr(d);l.current_drawing_=new Nn(d,h);var p=m().getNonce();p?Y("setnonce",p):Y("unsetnonce"),s.find("image").each(function(){var e=this;sn(e);var t=Rt(this);if(t){if(t.startsWith("data:")){var n=t.match(g(/svgedit_url=(.*?);/,{url:1}));if(n){var r=decodeURIComponent(n.groups.url);dr(new Image).load(function(){e.setAttributeNS(v.XLINK,"xlink:href",r)}).attr("src",r)}}l.embedImage(t)}}),s.find("svg").each(function(){if(!dr(this).closest("defs").length){It(this);var e=this.parentNode;1===e.childNodes.length&&"g"===e.nodeName?(dr(e).data("gsvg",this),e.id=e.id||z()):Ye(this)}}),U()&&s.find("linearGradient, radialGradient, pattern").appendTo(Dt()),Nt(s),Mt(s[0]);var f={id:"svgcontent",overflow:o.show_outside_canvas?"visible":"hidden"},y=!1;if(s.attr("viewBox")){var b=s.attr("viewBox").split(" ");f.width=b[2],f.height=b[3]}else dr.each(["width","height"],function(e,t){var n=s.attr(t)||"100%";"%"===String(n).substr(-1)?y=!0:f[t]=ue(t,n)});if(Ln(),s.children().find(re).each(function(){this.id||(this.id=z())}),y){var x=$t();f.width=x.width+x.x,f.height=x.height+x.y}f.width<=0&&(f.width=100),f.height<=0&&(f.height=100),s.attr(f),this.contentW=f.width,this.contentH=f.height,r.addSubCommand(new pr(d));var w=s.attr(["width","height"]);r.addSubCommand(new gr(u,w)),_=1,$={},X(),Fe={},u.append(B.selectorParentGroup),t||j(r),Y("changed",[d])}catch(e){return console.log(e),!1}return!0},this.importSvgString=function(e){var t,n,r;try{var a=Gt(e.length+e).substr(0,32),i=!1;ge[a]&&dr(ge[a].symbol).parents("#svgroot").length&&(i=!0);var o,s=new mr("Import Image");if(i)o=ge[a].symbol,n=ge[a].xform;else{var l,u=Ot(e);this.prepareSvg(u),l=c.adoptNode?c.adoptNode(u.documentElement):c.importNode(u.documentElement,!0),It(l);var h=ue("width",l.getAttribute("width")),p=ue("height",l.getAttribute("height")),f=l.getAttribute("viewBox"),g=f?f.split(" "):[0,0,h,p];for(t=0;t<4;++t)g[t]=Number(g[t]);var y=Number(d.getAttribute("height"));n="translate(0) "+(n=p>h?"scale("+y/3/g[3]+")":"scale("+y/3/g[2]+")")+" translate(0)",o=c.createElementNS(v.SVG,"symbol");var _=Dt();for(U()&&dr(l).find("linearGradient, radialGradient, pattern").appendTo(_);l.firstChild;){var x=l.firstChild;o.append(x)}var w=l.attributes,S=!0,k=!1,C=void 0;try{for(var A,E=w[Symbol.iterator]();!(S=(A=E.next()).done);S=!0){var G=A.value;o.setAttribute(G.nodeName,G.value)}}catch(e){k=!0,C=e}finally{try{S||null==E.return||E.return()}finally{if(k)throw C}}o.id=z(),ge[a]={symbol:o,xform:n},Dt().append(o),s.addSubCommand(new pr(o))}(r=c.createElementNS(v.SVG,"use")).id=z(),Bt(r,"#"+o.id),(b||m().getCurrentLayer()).append(r),s.addSubCommand(new pr(r)),X(),r.setAttribute("transform",n),or(r),dr(r).data("symbol",o).data("ref",o),Q([r]),j(s),Y("changed",[d])}catch(e){return console.log(e),null}return r};var zt={identifyLayers:Ln,createLayer:Mn,cloneLayer:On,deleteCurrentLayer:jn,setCurrentLayer:Vn,renameCurrentLayer:Rn,setCurrentLayerPosition:Bn,setLayerVisibility:Dn,moveSelectedToLayer:Un,mergeLayer:Fn,mergeAllLayers:Hn,leaveContext:zn,setContext:qn};Object.entries(zt).forEach(function(e){var t=p(e,2),n=t[0],r=t[1];l[n]=r}),function(e){In=e}({pathActions:I,getCurrentGroup:function(){return b},setCurrentGroup:function(e){b=e},getSelectedElements:P,getSVGContent:G,undoMgr:O,elData:ce,getCurrentDrawing:m,clearSelection:X,call:Y,addCommandToHistory:j,changeSVGContent:function(){Y("changed",[d])}}),this.clear=function(){I.clear(),X(),l.clearSvgContentElement(),l.current_drawing_=new Nn(d),l.createLayer("Layer 1"),l.undoMgr.resetUndoStack(),B.initGroup(),je=B.getRubberBandBox(),Y("cleared")},this.linkControlPoints=I.linkControlPoints,this.getContentElem=function(){return d},this.getRootElem=function(){return u};var Xt=this.getResolution=function(){return{w:d.getAttribute("width")/_,h:d.getAttribute("height")/_,zoom:_}};this.getSnapToGrid=function(){return o.gridSnapping},this.getVersion=function(){return"svgcanvas.js ($Rev$)"},this.setUiStrings=function(e){Object.assign(ne,e.notification),dr=yn(dr,e.common),Be(e)},this.setConfig=function(e){Object.assign(o,e)},this.getTitle=function(e){if(e=e||S[0]){var t=(e=dr(e).data("gsvg")||dr(e).data("symbol")||e).childNodes,n=!0,r=!1,a=void 0;try{for(var i,o=t[Symbol.iterator]();!(n=(i=o.next()).done);n=!0){var s=i.value;if("title"===s.nodeName)return s.textContent}}catch(e){r=!0,a=e}finally{try{n||null==o.return||o.return()}finally{if(r)throw a}}return""}},this.setGroupTitle=function(e){var t=S[0];t=dr(t).data("gsvg")||t;var n,r=dr(t).children("title"),a=new mr("Set Label");if(e.length)r.length?(n=r[0],a.addSubCommand(new gr(n,{"#text":n.textContent})),n.textContent=e):((n=c.createElementNS(v.SVG,"title")).textContent=e,dr(t).prepend(n),a.addSubCommand(new pr(n)));else{var i=r.nextSibling;a.addSubCommand(new fr(r[0],i,t)),r.remove()}j(a)};var Qt=this.getDocumentTitle=function(){return l.getTitle(d)};this.setDocumentTitle=function(e){var t=d.childNodes,n=!1,r="",a=new mr("Change Image Title"),i=!0,o=!1,s=void 0;try{for(var l,u=t[Symbol.iterator]();!(i=(l=u.next()).done);i=!0){var h=l.value;if("title"===h.nodeName){r=(n=h).textContent;break}}}catch(e){o=!0,s=e}finally{try{i||null==u.return||u.return()}finally{if(o)throw s}}n||(n=c.createElementNS(v.SVG,"title"),d.insertBefore(n,d.firstChild)),e.length?n.textContent=e:n.remove(),a.addSubCommand(new gr(n,{"#text":r})),j(a)},this.getEditorNS=function(e){return e&&d.setAttribute("xmlns:se",v.SE),v.SE},this.setResolution=function(e,t){var n,r=Xt(),a=r.w,i=r.h;if("fit"===e){var o=$t();if(!o)return!1;n=new mr("Fit Canvas to Content");var s=Zt();Q(s);var c=[],u=[];dr.each(s,function(e,t){c.push(-1*o.x),u.push(-1*o.y)});var h=l.moveSelectedElements(c,u,!0);n.addSubCommand(h),X(),e=Math.round(o.width),t=Math.round(o.height)}return e===a&&t===i||(n||(n=new mr("Change Image Dimensions")),e=ue("width",e),t=ue("height",t),d.setAttribute("width",e),d.setAttribute("height",t),this.contentW=e,this.contentH=t,n.addSubCommand(new gr(d,{width:a,height:i})),d.setAttribute("viewBox",[0,0,e/_,t/_].join(" ")),n.addSubCommand(new gr(d,{viewBox:["0 0",a,i].join(" ")})),j(n),Y("changed",[d])),!0},this.getOffset=function(){return dr(d).attr(["x","y"])},this.setBBoxZoom=function(t,n,r){var a,i=.85,o=function(e){if(!e)return!1;var t=Math.round(n/e.width*100*i)/100,a=Math.round(r/e.height*100*i)/100,o=Math.min(t,a);return l.setZoom(o),{zoom:o,bbox:e}};if("object"===e(t)){if(0===(a=t).width||0===a.height){var s=a.zoom?a.zoom:_*a.factor;return l.setZoom(s),{zoom:_,bbox:a}}return o(a)}switch(t){case"selection":if(!S[0])return;var c=dr.map(S,function(e){if(e)return e});a=$t(c);break;case"canvas":var u=Xt();i=.95,a={width:u.w,height:u.h,x:0,y:0};break;case"content":a=$t();break;case"layer":a=$t(Zt(m().getCurrentLayer()));break;default:return}return o(a)},this.setZoom=function(e){var t=Xt();d.setAttribute("viewBox","0 0 "+t.w/e+" "+t.h/e),_=e,dr.each(S,function(e,t){t&&B.requestSelector(t).resize()}),I.zoomChange(),De("zoomChanged",e)},this.getMode=function(){return we},this.setMode=function(e){I.clear(!0),vt.clear(),ke=S[0]&&"text"===S[0].nodeName?me:w,we=e},this.getColor=function(e){return ke[e]},this.setColor=function(e,t,n){w[e]=t,ke[e+"_paint"]={type:"solidColor"};var r=[];function a(e){"g"!==e.nodeName&&r.push(e)}for(var i=S.length;i--;){var o=S[i];o&&("g"===o.tagName?jt(o,a):"fill"===e?"polyline"!==o.tagName&&"line"!==o.tagName&&r.push(o):r.push(o))}r.length>0&&(n?cn(e,t,r):(un(e,t,r),Y("changed",r)))};var Kt=this.setGradient=function(e){if(ke[e+"_paint"]&&"solidColor"!==ke[e+"_paint"].type){var t=l[e+"Grad"],n=Jt(t),r=Dt();n?t=n:(t=r.appendChild(c.importNode(t,!0))).id=z(),l.setColor(e,"url(#"+t.id+")")}},Jt=function(e){for(var t=Dt(),n=dr(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=dr(e).attr(a),n=dr(i).attr(a),r=!1;if(dr.each(a,function(e,a){t[a]!==n[a]&&(r=!0)}),r)return"continue"}())continue;var o=e.getElementsByTagNameNS(v.SVG,"stop"),s=i.getElementsByTagNameNS(v.SVG,"stop");if(o.length===s.length){for(var l=o.length;l--;){var c=o[l],u=s[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 dr.jGraduate.Paint(t);switch(this.setPaintOpacity(e,n.alpha/100,!0),ke[e+"_paint"]=n,n.type){case"solidColor":this.setColor(e,"none"!==n.solidColor?"#"+n.solidColor:"none");break;case"linearGradient":case"radialGradient":l[e+"Grad"]=n[n.type],Kt(e)}},this.setStrokePaint=function(e){this.setPaint("stroke",e)},this.setFillPaint=function(e){this.setPaint("fill",e)},this.getStrokeWidth=function(){return ke.stroke_width},this.setStrokeWidth=function(e){if(0===e&&["line","path"].includes(we))l.setStrokeWidth(1);else{ke.stroke_width=e;for(var t=[],n=S.length;n--;){var r=S[n];r&&("g"===r.tagName?jt(r,a):t.push(r))}t.length>0&&(un("stroke-width",e,t),Y("changed",S))}function a(e){"g"!==e.nodeName&&t.push(e)}},this.setStrokeAttr=function(e,t){w[e.replace("-","_")]=t;for(var n=[],r=S.length;r--;){var a=S[r];a&&("g"===a.tagName?jt(a,function(e){"g"!==e.nodeName&&n.push(e)}):n.push(a))}n.length>0&&(un(e,t,n),Y("changed",S))},this.getStyle=function(){return w},this.getOpacity=K,this.setOpacity=function(e){w.opacity=e,un("opacity",e)},this.getFillOpacity=function(){return w.fill_opacity},this.getStrokeOpacity=function(){return w.stroke_opacity},this.setPaintOpacity=function(e,t,n){w[e+"_opacity"]=t,n?cn(e+"-opacity",t):un(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=nn(e.id+"_blur");n&&(t=n.firstChild.getAttribute("stdDeviation"))}return t},function(){var e=null,t=null,n=!1;function r(){var n=l.undoMgr.finishUndoableChange();e.addSubCommand(n),j(e),e=null,t=null}l.setBlurNoUndo=function(e){if(t)if(0===e)cn("filter",""),n=!0;else{var r=S[0];n&&cn("filter","url(#"+r.id+"_blur)"),D()&&(r.removeAttribute("filter"),r.setAttribute("filter","url(#"+r.id+"_blur)")),cn("stdDeviation",e,[t.firstChild]),l.setBlurOffsets(t,e)}else l.setBlur(e)},l.setBlurOffsets=function(e,t){t>3?rn(e,{x:"-50%",y:"-50%",width:"200%",height:"200%"}):D()||(e.removeAttribute("x"),e.removeAttribute("y"),e.removeAttribute("width"),e.removeAttribute("height"))},l.setBlur=function(n,a){if(e)r();else{var i=S[0],o=i.id;t=nn(o+"_blur"),n-=0;var s=new mr;if(t)0===n&&(t=null);else{var c=C({element:"feGaussianBlur",attr:{in:"SourceGraphic",stdDeviation:n}});(t=C({element:"filter",attr:{id:o+"_blur"}})).append(c),Dt().append(t),s.addSubCommand(new pr(t))}var u={filter:i.getAttribute("filter")};if(0===n)return i.removeAttribute("filter"),void s.addSubCommand(new gr(i,u));un("filter","url(#"+o+"_blur)"),s.addSubCommand(new gr(i,u)),l.setBlurOffsets(t,n),e=s,l.undoMgr.beginUndoableChange("stdDeviation",[t?t.firstChild:null]),a&&(l.setBlurNoUndo(n),r())}}}(),this.getBold=function(){var e=S[0];return!(ln(e)||"text"!==e.tagName||!ln(S[1]))&&"bold"===e.getAttribute("font-weight")},this.setBold=function(e){var t=S[0];!ln(t)&&"text"===t.tagName&&ln(S[1])&&un("font-weight",e?"bold":"normal"),S[0].textContent||vt.setCursor()},this.getItalic=function(){var e=S[0];return!(ln(e)||"text"!==e.tagName||!ln(S[1]))&&"italic"===e.getAttribute("font-style")},this.setItalic=function(e){var t=S[0];!ln(t)&&"text"===t.tagName&&ln(S[1])&&un("font-style",e?"italic":"normal"),S[0].textContent||vt.setCursor()},this.getFontFamily=function(){return me.font_family},this.setFontFamily=function(e){me.font_family=e,un("font-family",e),S[0]&&!S[0].textContent&&vt.setCursor()},this.setFontColor=function(e){me.fill=e,un("fill",e)},this.getFontColor=function(){return me.fill},this.getFontSize=function(){return me.font_size},this.setFontSize=function(e){me.font_size=e,un("font-size",e),S[0].textContent||vt.setCursor()},this.getText=function(){var e=S[0];return ln(e)?"":e.textContent},this.setTextContent=function(e){un("#text",e),vt.init(e),vt.setCursor()},this.setImageURL=function(e){var t=S[0];if(t){var n=dr(t).attr(["width","height"]),r=!n.width||!n.height,a=Rt(t);if(a!==e||r){var i=new mr("Change Image URL");Bt(t,e),i.addSubCommand(new gr(t,{"#href":a})),dr(new Image).load(function(){var e=dr(t).attr(["width","height"]);dr(t).attr({width:this.width,height:this.height}),B.requestSelector(t).resize(),i.addSubCommand(new gr(t,e)),j(i),Y("changed",[t])}).attr("src",e)}}},this.setLinkURL=function(e){var t=S[0];if(t){if("a"!==t.tagName){var n=dr(t).parents("a");if(!n.length)return;t=n[0]}var r=Rt(t);if(r!==e){var a=new mr("Change Link URL");Bt(t,e),a.addSubCommand(new gr(t,{"#href":r})),j(a)}}},this.setRectRadius=function(e){var t=S[0];if(!ln(t)&&"rect"===t.tagName){var n=t.getAttribute("rx");n!==String(e)&&(t.setAttribute("rx",e),t.setAttribute("ry",e),j(new gr(t,{rx:n,ry:n},"Radius")),Y("changed",[t]))}},this.makeHyperlink=function(e){l.groupSelectedElements("a",e)},this.removeHyperlink=function(){l.ungroupSelectedElement()},this.setSegType=function(e){I.setSegType(e)},this.convertToPath=function(e,t){if(!ln(e))return t?Wt(e,C,I):function(e,t,n,r,a,i,o,s){var l=new o.BatchCommand("Convert element to Path"),c=n({element:"path",attr:t=_t.extend({},t,Yt(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=qt(e);if(p){if(c.setAttribute("d",p),u){var f=te(c);Ie(f)&&r.resetOrientation(c)}var g=e.nextSibling;return l.addSubCommand(new o.RemoveElementCommand(e,g,parent)),l.addSubCommand(new o.InsertElementCommand(c)),a(),e.remove(),c.setAttribute("id",d),c.removeAttribute("visibility"),i([c],!0),s(l),c}return c.remove(),null}(e,{fill:w.fill,"fill-opacity":w.fill_opacity,stroke:w.stroke,"stroke-width":w.stroke_width,"stroke-dasharray":w.stroke_dasharray,"stroke-linejoin":w.stroke_linejoin,"stroke-linecap":w.stroke_linecap,"stroke-opacity":w.stroke_opacity,opacity:w.opacity,visibility:"hidden"},C,I,X,Q,Ce,j);var n=S;dr.each(n,function(e,t){t&&l.convertToPath(t)})};var cn=function(e,t,n){"pathedit"===we&&I.moveNode(e,t);for(var r=(n=n||S).length,a=["g","polyline","path"],i=function(){var i=n[r];if(ln(i))return"continue";if(("x"===e||"y"===e)&&a.includes(i.tagName)){var o=$t([i]),s="x"===e?t-o.x:0,c="y"===e?t-o.y:0;return l.moveSelectedElements(s*_,c*_,!0),"continue"}var d="#text"===e?i.textContent:i.getAttribute(e);if(ln(d)&&(d=""),d!==String(t)){"#text"===e?(i.textContent=t,/rotate/.test(i.getAttribute("transform"))&&(i=Xe(i))):"#href"===e?Bt(i,t):i.setAttribute(e,t),"textedit"===we&&"#text"!==e&&i.textContent.length&&vt.toSelectMode(i),U()&&"text"===i.nodeName&&/rotate/.test(i.getAttribute("transform"))&&(String(t).startsWith("url")||["font-size","font-family","x","y"].includes(e)&&i.textContent)&&(i=Xe(i)),S.includes(i)&&setTimeout(function(){i.parentNode&&B.requestSelector(i).resize()},0);var h=en(i);if(0!==h&&"transform"!==e)for(var p=te(i),f=p.numberOfItems;f--;){if(4===p.getItem(f).type){p.removeItem(f);var g=Ht(i),m=Ee(g.x+g.width/2,g.y+g.height/2,Te(p).matrix),v=m.x,y=m.y,b=u.createSVGTransform();b.setRotate(h,v,y),p.insertItemBefore(b,f);break}}}};r--;)i()},un=this.changeSelectedAttribute=function(e,t,n){n=n||S,l.undoMgr.beginUndoableChange(e,n),cn(e,t,n);var r=l.undoMgr.finishUndoableChange();r.isEmpty()||j(r)};this.deleteSelectedElements=function(){for(var e=new mr("Delete Elements"),t=S.length,n=[],r=0;r<t;++r){var a=S[r];if(ln(a))break;var i=a.parentNode,o=a;B.releaseSelector(o),st(o.id),"a"===i.tagName&&1===i.childNodes.length&&(o=i,i=i.parentNode);var s=o.nextSibling,l=i.removeChild(o);n.push(a),e.addSubCommand(new fr(l,s,i))}S=[],e.isEmpty()||j(e),Y("changed",n),X()},this.cutSelectedElements=function(){l.copySelectedElements(),l.deleteSelectedElements()},this.copySelectedElements=function(){localStorage.setItem("svgedit_clipboard",JSON.stringify(S.map(function(e){return k(e)}))),dr("#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 i=[],o=new mr("Paste elements"),s={};for(r.forEach(function e(t){t.attr&&t.attr.id&&(s[t.attr.id]=z(),t.attr.id=s[t.attr.id]),t.children&&t.children.forEach(e)}),De("IDsUpdated",{elems:r,changes:s},!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=C(c);i.push(u),o.addSubCommand(new pr(u)),he(u)}}if($e(i),"in_place"!==e){var d,h;e?"point"===e&&(d=t,h=n):(d=Re.x,h=Re.y);var p=$t(i),f=d-(p.x+p.width/2),g=h-(p.y+p.height/2),m=[],v=[];dr.each(i,function(e,t){m.push(f),v.push(g)});var y=l.moveSelectedElements(m,v,!1);y&&o.addSubCommand(y)}j(o),Y("changed",i)}},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 mr(r),i=C({element:e,attr:{id:z()}});"a"===e&&Bt(i,n),a.addSubCommand(new pr(i));for(var o=S.length;o--;){var s=S[o];if(!ln(s)){"a"===s.parentNode.tagName&&1===s.parentNode.childNodes.length&&(s=s.parentNode);var l=s.nextSibling,c=s.parentNode;i.append(s),a.addSubCommand(new hr(s,l,c))}}a.isEmpty()||j(a),$e([i],!0)};var dn=this.pushGroupProperties=function(e,t){for(var n,r,a,i=e.childNodes,o=i.length,s=e.getAttribute("transform"),c=te(e),d=Te(c).matrix,h=new mr("Push group properties"),p=en(e),f=dr(e).attr(["filter","opacity"]),g=m(),v=0;v<o;v++){var y=i[v];if(1===y.nodeType){if(null!==f.opacity&&1!==f.opacity){var _=Math.round((y.getAttribute("opacity")||1)*f.opacity*100)/100;un("opacity",_,[y])}if(f.filter){var b=this.getBlur(y),x=b;r||(r=this.getBlur(e)),b?b=Number(r)+Number(b):0===b&&(b=r),x?n=tn(y.getAttribute("filter")):n?(n=g.copyElem(n),Dt().append(n)):n=tn(f.filter);var w="feGaussianBlur"===n.firstChild.tagName?"blur":"filter";n.id=y.id+"_"+w,un("filter","url(#"+n.id+")",[y]),b&&(un("stdDeviation",b,[n.firstChild]),l.setBlurOffsets(n,b))}var S=te(y);if(y.tagName.includes("Gradient")&&(S=null),S&&"defs"!==y.tagName&&c.numberOfItems){if(p&&1===c.numberOfItems){var k=c.getItem(0).matrix,C=u.createSVGMatrix(),A=en(y);A&&(C=S.getItem(0).matrix);var E=Ht(y),G=Te(S).matrix,P=Ee(E.x+E.width/2,E.y+E.height/2,G),I=p+A,N=u.createSVGTransform();N.setRotate(I,P.x,P.y);var T=Pe(k,C,N.matrix.inverse());if(A&&S.removeItem(0),I&&(S.numberOfItems?S.insertItemBefore(N,0):S.appendItem(N)),T.e||T.f){var L=u.createSVGTransform();L.setTranslate(T.e,T.f),S.numberOfItems?S.insertItemBefore(L,0):S.appendItem(L)}}else{var M=y.getAttribute("transform");(a={}).transform=M||"";var O=u.createSVGTransform(),j=Te(S).matrix,V=j.inverse(),R=Pe(V,d,j);O.setMatrix(R),S.appendItem(O)}var B=or(y);B&&h.addSubCommand(B)}}}if(s&&((a={}).transform=s,e.setAttribute("transform",""),e.removeAttribute("transform"),h.addSubCommand(new gr(e,a))),t&&!h.isEmpty())return h};this.ungroupSelectedElement=function(){var e=S[0];if(e)if(dr(e).data("gsvg")||dr(e).data("symbol"))Ft(e);else{if("use"===e.tagName){var t=nn(Rt(e).substr(1));return dr(e).data("symbol",t).data("ref",t),void Ft(e)}var n=dr(e).parents("a");if(n.length&&(e=n[0]),"g"===e.tagName||"a"===e.tagName){var r=new mr("Ungroup Elements"),a=dn(e,!0);a&&r.addSubCommand(a);for(var i=e.parentNode,o=e.nextSibling,s=new Array(e.childNodes.length),l=0;e.firstChild;){var c=e.firstChild,u=c.nextSibling,d=c.parentNode;if("title"!==c.tagName)s[l++]=c=i.insertBefore(c,o),r.addSubCommand(new hr(c,u,d));else{var h=c.nextSibling;r.addSubCommand(new fr(c,h,d)),c.remove()}}X();var p=e.nextSibling;e=i.removeChild(e),r.addSubCommand(new fr(e,p,i)),r.isEmpty()||j(r),Q(s)}}},this.moveToTopSelectedElement=function(){var e=p(S,1)[0];if(!ln(e)){var t=e,n=t.parentNode,r=t.nextSibling;r!==(t=t.parentNode.appendChild(t)).nextSibling&&(j(new hr(t,r,n,"top")),Y("changed",[t]))}},this.moveToBottomSelectedElement=function(){var e=p(S,1)[0];if(!ln(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&&(j(new hr(t,r,n,"bottom")),Y("changed",[t]))}},this.moveUpDownSelected=function(e){var t=S[0];if(t){var n,r;Ve=[];var a=dr(Ue($t([t]))).toArray();if("Down"===e&&a.reverse(),dr.each(a,function(){return r?(n=this,!1):(this===t&&(r=!0),!0)}),n){var i=t,o=i.parentNode,s=i.nextSibling;dr(n)["Down"===e?"before":"after"](i),s!==i.nextSibling&&(j(new hr(i,s,o,"Move "+e)),Y("changed",[i]))}}},this.moveSelectedElements=function(e,t,n){e.constructor!==Array&&(e/=_,t/=_),n=n||!0;for(var r=new mr("position"),a=S.length;a--;){var i=S[a];if(!ln(i)){var o=u.createSVGTransform(),s=te(i);e.constructor===Array?o.setTranslate(e[a],t[a]):o.setTranslate(e,t),s.numberOfItems?s.insertItemBefore(o,0):s.appendItem(o);var l=or(i);l&&r.addSubCommand(l),B.requestSelector(i).resize()}}if(!r.isEmpty())return n&&j(r),Y("changed",S),r},this.cloneSelectedElements=function(e,t){var n,r,a=new mr("Clone Elements"),i=S.length;for(S.sort(function(e,t){return dr(t).index()-dr(e).index()}),n=0;n<i&&(r=S[n],!ln(r));++n);var o=S.slice(0,n);this.clearSelection(!0);var s=m();for(n=o.length;n--;)r=o[n]=s.copyElem(o[n]),(b||s.getCurrentLayer()).append(r),a.addSubCommand(new pr(r));a.isEmpty()||(Q(o.reverse()),this.moveSelectedElements(e,t,!1),j(a))},this.alignSelectedElements=function(e,t){var n=[],r=S.length;if(r){for(var a=Number.MAX_VALUE,i=Number.MIN_VALUE,o=Number.MAX_VALUE,s=Number.MIN_VALUE,c=Number.MIN_VALUE,u=Number.MIN_VALUE,d=0;d<r&&!ln(S[d]);++d){var h=S[d];switch(n[d]=$t([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,i=n[d].x+n[d].width,s=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,i=n[d].x+n[d].width,s=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>i&&(i=n[d].x+n[d].width),n[d].y+n[d].height>s&&(s=n[d].y+n[d].height)}}"page"===t&&(a=0,o=0,i=l.contentW,s=l.contentH);for(var p=new Array(r),f=new Array(r),g=0;g<r&&!ln(S[g]);++g){var m=n[g];switch(p[g]=0,f[g]=0,e){case"l":p[g]=a-m.x;break;case"c":p[g]=(a+i)/2-(m.x+m.width/2);break;case"r":p[g]=i-(m.x+m.width);break;case"t":f[g]=o-m.y;break;case"m":f[g]=(o+s)/2-(m.y+m.height/2);break;case"b":f[g]=s-(m.y+m.height)}}this.moveSelectedElements(p,f)}},this.contentW=Xt().w,this.contentH=Xt().h,this.updateCanvas=function(e,t){u.setAttribute("width",e),u.setAttribute("height",t);var n=dr("#canvasBackground")[0],r=d.getAttribute("x"),a=d.getAttribute("y"),i=(e-this.contentW*_)/2,o=(t-this.contentH*_)/2;rn(d,{width:this.contentW*_,height:this.contentH*_,x:i,y:o,viewBox:"0 0 "+this.contentW+" "+this.contentH}),rn(n,{width:d.getAttribute("width"),height:d.getAttribute("height"),x:i,y:o});var s=nn("background_image");return s&&rn(s,{width:"100%",height:"100%"}),B.selectorParentGroup.setAttribute("transform","translate("+i+","+o+")"),De("canvasUpdated",{new_x:i,new_y:o,old_x:r,old_y:a,d_x:i-r,d_y:o-a}),{x:i,y:o,old_x:r,old_y:a,d_x:i-r,d_y:o-a}},this.setBackground=function(e,t){var n=nn("canvasBackground"),r=dr(n).find("rect")[0],a=nn("background_image");r.setAttribute("fill",e),t?(a||(a=c.createElementNS(v.SVG,"image"),rn(a,{id:"background_image",width:"100%",height:"100%",preserveAspectRatio:"xMinYMin",style:"pointer-events:none"})),Bt(a,t),n.append(a)):a&&a.remove()},this.cycleElement=function(e){var t,n=S[0],r=!1,a=Zt(b||m().getCurrentLayer());if(a.length){if(ln(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}$e([r],!0),Y("selected",S)}},this.clear(),this.getPrivateMethods=function(){return{addCommandToHistory:j,BatchCommand:mr,ChangeElementCommand:gr,decode64:Pt,dropXMLInteralSubset:At,encode64:Gt,ffClone:Xe,findDefs:Dt,findDuplicateGradient:Jt,getElem:nn,getPathBBox:Ut,getTypeMap:oe,getUrlFromAttr:Vt,identifyLayers:Ln,InsertElementCommand:pr,isChrome:H,isIdentity:Ge,isIE:F,logMatrix:Ke,MoveElementCommand:hr,NS:v,preventClickDefault:sn,RemoveElementCommand:fr,SVGEditTransformList:J,text2xml:Ot,transformBox:Ne,transformPoint:Ee,walkTree:jt}}};var br=Boolean(window.opera),xr=function(e,t,n){var r,a=e.find("defs");if(!a.length)return e;r=br?a.find("*").filter(function(){return Boolean(this.id)}):a.find("[id]");var i=e[0].getElementsByTagName("*"),o=i.length;return r.each(function(e){var n=this.id,r="x"+n+t+e;this.id=r;var a="url(#"+n+")",s="url(#"+r+")";for(e=0;e<o;e++){var l=i[e];l.getAttribute("fill")===a&&l.setAttribute("fill",s),l.getAttribute("stroke")===a&&l.setAttribute("stroke",s),l.getAttribute("filter")===a&&l.setAttribute("filter",s)}}),e};var wr={svg:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink"};function Sr(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 kr,Cr,Ar=function(e){return null==e},Er=jQuery,Gr=function(e,t,n){var r=Er("#svg_editor").parent();Object.entries(t).forEach(function(t){var a=p(t,2),i=a[0],o=a[1];o||console.log(i),n&&(i="#"+i);var s=r.find(i);if(s.length){var l=s[0];switch(e){case"aria-label":l.setAttribute("aria-label",o);break;case"content":f(l.childNodes).some(function(e){return!(3!==e.nodeType||!e.textContent.trim())&&(e.textContent=o,!0)});break;case"title":l.title=o}}else console.log("Missing element for localization: "+i)})},Pr=function(){var e=n(regeneratorRuntime.mark(function e(t){var n,r,a,i,o,s,l,c,u,d;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Cr.addLangData(kr);case 2:if(n=e.sent,Er.each(n,function(e,n){n.data&&(t=Er.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,o=r.config,s=r.layers,l=r.common,c=r.ui,Gr("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:o.icon_large,icon_medium:o.icon_medium,icon_small:o.icon_small,icon_xlarge:o.icon_xlarge,image_opt_embed:o.image_opt_embed,image_opt_ref:o.image_opt_ref,includedImages:o.included_images,largest_object:a.largest_object,layersLabel:s.layers,page:a.page,relativeToLabel:a.relativeTo,selLayerLabel:s.move_elems_to,selectedPredefined:o.select_predefined,selected_objects:a.selected_objects,smallest_object:a.smallest_object,straight_segments:i.straight_segments,svginfo_bg_url:o.editor_img_url+":",svginfo_bg_note:o.editor_bg_note,svginfo_change_background:o.background,svginfo_dim:o.doc_dims,svginfo_editor_prefs:o.editor_prefs,svginfo_height:l.height,svginfo_icons:o.icon_size,svginfo_image_props:o.image_props,svginfo_lang:o.language,svginfo_title:o.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:s.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:o.units_and_rulers,svginfo_rulers_onoff:o.show_rulers,svginfo_unit:o.base_unit,svginfo_grid_settings:o.grid,svginfo_snap_onoff:o.snapping_onoff,svginfo_snap_step:o.snapping_stepsize,svginfo_grid_color:o.grid_color},!0),u={},["cut","copy","paste","paste_in_place","delete","group","ungroup","move_front","move_up","move_down","move_back"].forEach(function(e){u['#cmenu_canvas a[href="#'+e+'"]']=a[e]}),["dupe","merge_down","merge_all"].forEach(function(e){u['#cmenu_layers a[href="#'+e+'"]']=s[e]}),u['#cmenu_layers a[href="#delete"]']=s.del,Gr("content",u),d={},Object.entries({tool_blur:i.blur,tool_position:a.align_to_page,tool_font_family:i.font_family,zoom_panel:c.zoom_level,stroke_linejoin:i.linejoin_miter,stroke_linecap:i.linecap_butt,tool_opacity:i.opacity}).forEach(function(e){var t=p(e,2),n=t[0],r=t[1];d["#"+n+" button"]=r}),Object.entries({group_opacity:i.opacity,zoom:c.zoom_level}).forEach(function(e){var t=p(e,2),n=t[0],r=t[1];d["#"+n]=r}),Gr("aria-label",d),Gr("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:s.del,layer_down:s.move_down,layer_new:s.new,layer_rename:s.rename,layer_moreopts:l.more_opts,layer_up:s.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:s.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:o.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:kr,langData:t});case 19:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),Ir=function(){var e=n(regeneratorRuntime.mark(function e(t,n,r){var a;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t?kr=t:((kr=Er.pref("lang"))||(navigator.userLanguage?kr=navigator.userLanguage:navigator.language&&(kr=navigator.language)),console.log("Lang: "+kr),n.includes(kr)||"test"===kr||(kr="en")),a=r.langPath+"lang."+kr+".js",e.t0=Pr,e.next=5,pn(a,{global:"svgEditorLang_"+kr.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)}));return function(t,n,r){return e.apply(this,arguments)}}();function Nr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],r=!0,a=!1,i=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){a=!0,i=e}finally{try{r||null==s.return||s.return()}finally{if(a)throw i}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Tr(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.before,r=t.after,a=t.favicon,i=t.canvas,o=t.image,s=void 0===o||o,l=t.acceptErrors;return e=Array.isArray(e)?e:[e],Promise.all(e.map(function(e){var t={};if(Array.isArray(e)){var o=Nr(e,2);e=o[0];var c=o[1];t=void 0===c?{}:c}var u=t.favicon,d=void 0===u?a:u,h=t,p=h.before,f=void 0===p?n:p,g=h.after,m=void 0===g?r:g,v=h.canvas,y=void 0===v?i:v,_=h.image,b=void 0===_?s:_;function x(){f?f.before(w):m?m.after(w):document.head.appendChild(w)}var w=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(w.rel="shortcut icon",w.type="image/x-icon",!1===b)return w.href=e,x(),void n(w);var i=document.createElement("canvas");i.width=16,i.height=16;var o=i.getContext("2d"),s=document.createElement("img");return s.addEventListener("error",function(e){r(e)}),s.addEventListener("load",function(){o.drawImage(s,0,0),w.href=y?i.toDataURL("image/x-icon"):e,x(),n(w)}),void(s.src=e)}w.rel="stylesheet",w.type="text/css",w.href=e,x(),w.addEventListener("error",function(e){a(e)}),w.addEventListener("load",function(){n(w)})})}))}var Lr={},Mr=[function(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(),o="",s={};t.altKey&&"alt"!==a&&(o+="alt+"),t.ctrlKey&&"ctrl"!==a&&(o+="ctrl+"),t.metaKey&&!t.ctrlKey&&"meta"!==a&&(o+="meta+"),t.shiftKey&&"shift"!==a&&(o+="shift+"),a?s[o+a]=!0:(s[o+i]=!0,s[o+e.hotkeys.shiftNums[i]]=!0,"shift+"===o&&(s[e.hotkeys.shiftNums[i]]=!0));for(var l=0,c=r.length;l<c;l++)if(s[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(t){return function(t,n){var r,a,i,o,s,l,c,u,d=Array.prototype.slice,h=decodeURIComponent,p=t.param,f=t.bbq=t.bbq||{},g=t.event.special,m="hashchange",v="querystring",y="fragment",_="elemUrlAttr",b="location",x="href",w="src",S=/^.*\?|#.*$/g,k=/^.*\#/,C={};function A(e){return"string"==typeof e}function E(e){var t=d.call(arguments,1);return function(){return e.apply(this,t.concat(d.call(arguments)))}}function G(e,a,o,s,l){var c,d,f,g,m;return s!==r?(m=(f=o.match(e?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/))[3]||"",2===l&&A(s)?d=s.replace(e?k:S,""):(g=i(f[2]),s=A(s)?i[e?y:v](s):s,d=2===l?s:1===l?t.extend({},s,g):t.extend({},g,s),d=p(d),e&&(d=d.replace(u,h))),c=f[1]+(e?"#":d||!f[1]?"?":"")+d+m):c=a(o!==r?o:n[b][x]),c}function P(e,t,n){return t===r||"boolean"==typeof t?(n=t,t=p[e?y:v]()):t=A(t)?t.replace(e?k:S,""):t,i(t,n)}function I(n,a,i,o){return A(i)||"object"===e(i)||(o=i,i=a,a=r),this.each(function(){var e=t(this),r=a||c()[(this.nodeName||"").toLowerCase()]||"",s=r&&e.attr(r)||"";e.attr(r,p[n](s,i,o))})}p[v]=E(G,0,function(e){return e.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")}),p[y]=a=E(G,1,function(e){return e.replace(/^[^#]*#?(.*)$/,"$1")}),a.noEscape=function(e){e=e||"";var n=t.map(e.split(""),encodeURIComponent);u=new RegExp(n.join("|"),"g")},a.noEscape(",/"),t.deparam=i=function(e,n){var a={},i={true:!0,false:!1,null:null};return t.each(e.replace(/\+/g," ").split("&"),function(e,o){var s,l=o.split("="),c=h(l[0]),u=a,d=0,p=c.split("]["),f=p.length-1;if(/\[/.test(p[0])&&/\]$/.test(p[f])?(p[f]=p[f].replace(/\]$/,""),f=(p=p.shift().split("[").concat(p)).length-1):f=0,2===l.length)if(s=h(l[1]),n&&(s=s&&!isNaN(s)?+s:"undefined"===s?r:i[s]!==r?i[s]:s),f)for(;d<=f;d++)u=u[c=""===p[d]?u.length:p[d]]=d<f?u[c]||(p[d+1]&&isNaN(p[d+1])?{}:[]):s;else t.isArray(a[c])?a[c].push(s):a[c]!==r?a[c]=[a[c],s]:a[c]=s;else c&&(a[c]=n?r:"")}),a},i[v]=E(P,0),i[y]=o=E(P,1),t[_]||(t[_]=function(e){return t.extend(C,e)})({a:x,base:x,iframe:w,img:w,input:w,form:"action",link:x,script:w}),c=t[_],t.fn[v]=E(I,v),t.fn[y]=E(I,y),f.pushState=s=function(e,t){A(e)&&/^#/.test(e)&&t===r&&(t=2);var i=e!==r,o=a(n[b][x],i?e:{},i?t:2);n[b][x]=o+(/#/.test(o)?"":"#")},f.getState=l=function(e,t){return e===r||"boolean"==typeof e?o(e):o(t)[e]},f.removeState=function(e){var n={};e!==r&&(n=l(),t.each(t.isArray(e)?e:arguments,function(e,t){delete n[t]})),s(n,2)},g[m]=t.extend(g[m],{add:function(e){var n;function o(e){var t=e[y]=a();e.getState=function(e,n){return e===r||"boolean"==typeof e?i(t,e):i(t,n)[e]},n.apply(this,arguments)}if(t.isFunction(e))return n=e,o;n=e.handler,e.handler=o}})}(t,window),function(e,t,n){var r,a,i,o,s,l,c=e.event.special,u="location",d="hashchange",h="href",p=e.browser,f=document.documentMode,g=p.msie&&(void 0===f||f<8),m="on"+d in t&&!g;function v(e){return(e=e||t[u][h]).replace(/^[^#]*#?(.*)$/,"$1")}e[d+"Delay"]=100,c[d]=e.extend(c[d],{setup:function(){if(m)return!1;e(r.start)},teardown:function(){if(m)return!1;e(r.stop)}}),(l={}).start=function(){if(!a){var n=v();o||(o=s=function(e){return e},g&&(i=e('<iframe src="javascript:0"/>').hide().insertAfter("body")[0].contentWindow,s=function(){return v(i.document[u][h])},(o=function(e,t){if(e!==t){var n=i.document;n.open().close(),n[u].hash="#"+e}})(v()))),function r(){var i=v(),l=s(n);i!==n?(o(n=i,l),e(t).trigger(d)):l!==n&&(t[u][h]=t[u][h].replace(/#.*/,"")+"#"+l),a=setTimeout(r,e[d+"Delay"])}()}},l.stop=function(){i||(a&&clearTimeout(a),a=0)},r=l}(t,window),t},function(e){var t={};return e.svgIcons=function(n){var r,a,i,o,s,l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},c="http://www.w3.org/2000/svg",u="http://www.w3.org/1999/xlink",d=l.w||24,h=l.h||24,p=!1,f=!1,g=0,m="data:image/svg+xml;charset=utf-8;base64,";if(l.svgz){o=e('<object data="'+n+'" type=image/svg+xml>').appendTo("body").hide();try{a=o[0].contentDocument,o.load(y),y(0,!0)}catch(e){w()}}else{var v=new DOMParser;e.ajax({url:n,dataType:"string",success:function(t){t?(a=v.parseFromString(t,"text/xml"),e(function(){y("ajax")})):e(w)},error:function(t){window.opera?e(function(){w()}):t.responseText?((a=v.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 s=(a=o[0].contentDocument)&&a.getElementById("svg_eof");if(!(s||n&&s))return void(++g<50?setTimeout(y,20):(w(),f=!0));f=!0}if(r=e(a.firstChild).children(),l.no_img)setTimeout(function(){p||x()},500);else{var c=m+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNzUiIGhlaWdodD0iMjc1Ij48L3N2Zz4%3D";i=e(new Image).attr({src:c,width:0,height:0,alt:l.testIconAlt||"icon"}).appendTo("body").load(function(){x(!0)}).error(function(){x()})}}function _(e,t,n,r){if(br&&t.css("visibility","hidden"),l.replace){r&&t.attr("id",n);var a=e.attr("class");if(a&&t.attr("class","svg_icon "+a),!e.alt){var i="icon";l.alts&&(i=l.alts[n]||i),t.attr("alt",i)}e.replaceWith(t)}else e.append(t);br&&setTimeout(function(){t.removeAttr("style")},1)}function b(e,n){void 0!==l.id_match&&!1===l.id_match||_(s,e,n,!0),t[n]=e}function x(){var n=arguments.length>0&&void 0!==arguments[0]&&arguments[0],a=arguments.length>1?arguments[1]:void 0;if(!p){var f;if(l.no_img&&(n=!1),n&&(f=e(document.createElement("div"))).hide().appendTo("body"),a){var g=l.fallback_path||"";e.each(a,function(t,n){s=e("#"+t);var r="icon";l.alts&&(r=l.alts[t]||r),b(e(new Image).attr({class:"svg_icon",src:g+n,width:d,height:h,alt:r}),t)})}else for(var v=r.length,y=0;y<v;y++){var x=r[y],w=x.id;if("svg_eof"===w)break;s=e("#"+w);var S=document.createElementNS(c,"svg");S.setAttribute("viewBox",[0,0,d,h].join(" "));var k=x.getElementsByTagNameNS(c,"svg")[0],C=k.getAttribute("width"),A=k.getAttribute("height");k.removeAttribute("width"),k.removeAttribute("height"),k.getAttribute("viewBox")||k.setAttribute("viewBox",[0,0,C,A].join(" ")),S.setAttribute("xmlns",c),S.setAttribute("width",d),S.setAttribute("height",h),S.setAttribute("xmlns:xlink",u),S.setAttribute("class","svg_icon"),br||(k=k.cloneNode(!0)),S.append(k);var E=void 0;if(n){f.empty().append(S);var G=m+Gt(unescape(encodeURIComponent((new XMLSerializer).serializeToString(S)))),P="icon";l.alts&&(P=l.alts[w]||P),E=e(new Image).attr({class:"svg_icon",src:G,alt:P})}else E=xr(e(S),y);b(E,w)}l.placement&&e.each(l.placement,function(r,a){t[a]&&e(r).each(function(r){var i=t[a].clone();r>0&&!n&&(i=xr(i,r)),_(e(this),i,a)})}),a||(n&&f.remove(),o&&o.remove(),i&&i.remove()),l.resize&&e.resizeSvgIcons(l.resize),p=!0,l.callback&&l.callback(t)}}function w(){if(n.includes(".svgz")){var t=n.replace(".svgz",".svg");window.console&&console.log(".svgz failed, trying with .svg"),e.svgIcons(t,l)}else l.fallback&&x(!1,l.fallback)}},e.getSvgIcon=function(e,n){var r=t[e];return n&&r&&(r=xr(r,0).clone(!0)),r},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,o=a?r[1]:r;n&&(t=t.replace(/\.svg_icon/g,"svg")),e(t).each(function(){this.setAttribute("width",i),this.setAttribute("height",o),window.opera&&window.widget&&(this.parentNode.style.width=i+"px",this.parentNode.style.height=o+"px")})})},e},function(t){t.loadingStylesheets||(t.loadingStylesheets=[]),t.loadingStylesheets.includes("jgraduate/css/jGraduate.css")||t.loadingStylesheets.push("jgraduate/css/jGraduate.css"),t.jGraduate={Paint:function e(t){r(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)}},t.fn.jGraduateDefaults={paint:new t.jGraduate.Paint,window:{pickerTitle:"Drag markers to pick a paint"},images:{clientPath:"images/"},newstop:"inverse"};var n=navigator.userAgent.includes("Gecko/");function a(e,t,r){var a=document.createElementNS(wr.svg,e);return function(e,t){n?Object.entries(t).forEach(function(t){var n=p(t,2),r=n[0],a=n[1];e.setAttribute(r,a)}):Object.entries(t).forEach(function(t){var n=p(t,2),r=n[0],a=n[1],i=e[r];i&&"SVGLength"===i.constructor?i.baseVal.value=a:e.setAttribute(r,a)})}(a,t),r&&r.append(a),a}return t.fn.jGraduate=function(n,r,i){return this.each(function(){var o=t(this),s=t.extend(!0,{},t.fn.jGraduateDefaults,n||{}),l=o.attr("id"),c="#"+o.attr("id")+" ";if(c){var u=function(){switch(o.paint.type){case"radialGradient":o.paint.linearGradient=null;break;case"linearGradient":o.paint.radialGradient=null;break;case"solidColor":o.paint.radialGradient=o.paint.linearGradient=null}"function"==typeof o.okCallback&&o.okCallback(o.paint),o.hide()},d=function(){"function"==typeof o.cancelCallback&&o.cancelCallback(),o.hide()};t.extend(!0,o,{paint:new t.jGraduate.Paint({copy:s.paint}),okCallback:"function"==typeof r?r:null,cancelCallback:"function"==typeof i?i:null});var h=null,p=t(window);"none"===o.paint.type&&(o.paint=new t.jGraduate.Paint({solidColor:"ffffff"})),o.addClass("jGraduate_Picker"),o.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="'+l+'_jGraduate_stopPicker" class="jGraduate_stopPicker"></div>');var f=t(c+"> .jGraduate_colPick"),g=t(c+"> .jGraduate_gradPick");g.html('<div id="'+l+'_jGraduate_Swatch" class="jGraduate_Swatch"><h2 class="jGraduate_Title">'+s.window.pickerTitle+'</h2><div id="'+l+'_jGraduate_GradContainer" class="jGraduate_GradContainer"></div><div id="'+l+'_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="'+l+'_jGraduate_x1" size="3" title="Enter starting x value between 0.0 and 1.0"/><label>y:</label><input type="text" id="'+l+'_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="'+l+'_jGraduate_x2" size="3" title="Enter ending x value between 0.0 and 1.0"/><label>y:</label><input type="text" id="'+l+'_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="'+l+'_jGraduate_cx" size="3" title="Enter x value between 0.0 and 1.0"/><label>y:</label><input type="text" id="'+l+'_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="'+l+'_jGraduate_match_ctr"/></label><br/><label>x:</label><input type="text" id="'+l+'_jGraduate_fx" size="3" title="Enter x value between 0.0 and 1.0"/><label>y:</label><input type="text" id="'+l+'_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="'+l+'_jGraduate_Radius" class="jGraduate_SliderBar jGraduate_Radius" title="Click to set radius"><img id="'+l+'_jGraduate_RadiusArrows" class="jGraduate_RadiusArrows" src="'+s.images.clientPath+'rangearrows2.gif"></div><label><input type="text" id="'+l+'_jGraduate_RadiusInput" size="3" value="100"/>%</label></div><div class="jGraduate_Slider jGraduate_EllipField jGraduate_rg_field"><label class="prelabel">Ellip:</label><div id="'+l+'_jGraduate_Ellip" class="jGraduate_SliderBar jGraduate_Ellip" title="Click to set Ellip"><img id="'+l+'_jGraduate_EllipArrows" class="jGraduate_EllipArrows" src="'+s.images.clientPath+'rangearrows2.gif"></div><label><input type="text" id="'+l+'_jGraduate_EllipInput" size="3" value="0"/>%</label></div><div class="jGraduate_Slider jGraduate_AngleField jGraduate_rg_field"><label class="prelabel">Angle:</label><div id="'+l+'_jGraduate_Angle" class="jGraduate_SliderBar jGraduate_Angle" title="Click to set Angle"><img id="'+l+'_jGraduate_AngleArrows" class="jGraduate_AngleArrows" src="'+s.images.clientPath+'rangearrows2.gif"></div><label><input type="text" id="'+l+'_jGraduate_AngleInput" size="3" value="0"/>deg</label></div><div class="jGraduate_Slider jGraduate_OpacField"><label class="prelabel">Opac:</label><div id="'+l+'_jGraduate_Opac" class="jGraduate_SliderBar jGraduate_Opac" title="Click to set Opac"><img id="'+l+'_jGraduate_OpacArrows" class="jGraduate_OpacArrows" src="'+s.images.clientPath+'rangearrows2.gif"></div><label><input type="text" id="'+l+'_jGraduate_OpacInput" size="3" value="100"/>%</label></div></div><div class="jGraduate_OkCancel"><input type="button" id="'+l+'_jGraduate_Ok" class="jGraduate_Ok" value="OK"/><input type="button" id="'+l+'_jGraduate_Cancel" class="jGraduate_Cancel" value="Cancel"/></div>');var m=256,v=m-0,y=m-0,_={};t(".jGraduate_SliderBar").width(145);var b,x=t("#"+l+"_jGraduate_GradContainer")[0],w=a("svg",{id:l+"_jgraduate_svg",width:m,height:m,xmlns:wr.svg},x),S=o.paint.type,k=o.paint[S],C=k,A=o.paint.alpha,E="solidColor"===S;switch(S){case"solidColor":case"linearGradient":if(E||(C.id=l+"_lg_jgraduate_grad",k=C=w.appendChild(C)),a("radialGradient",{id:l+"_rg_jgraduate_grad"},w),"linearGradient"===S)break;case"radialGradient":E||(C.id=l+"_rg_jgraduate_grad",k=C=w.appendChild(C)),a("linearGradient",{id:l+"_lg_jgraduate_grad"},w)}if(E){k=C=t("#"+l+"_lg_jgraduate_grad")[0],Me(0,"#"+(h=o.paint[S]),1);var G=e(s.newstop);if("string"===G)switch(s.newstop){case"same":Me(1,"#"+h,1);break;case"inverse":for(var P="",I=0;I<6;I+=2){var N=(255-parseInt(h.substr(I,2),16)).toString(16);N.length<2&&(N=0+N),P+=N}Me(1,"#"+P,1);break;case"white":Me(1,"#ffffff",1);break;case"black":Me(1,"#000000",1)}else if("object"===G){var T="opac"in s.newstop?s.newstop.opac:1;Me(1,s.newstop.color||"#"+h,T)}}var L,M=parseFloat(k.getAttribute("x1")||0),O=parseFloat(k.getAttribute("y1")||0),j=parseFloat(k.getAttribute("x2")||1),V=parseFloat(k.getAttribute("y2")||0),R=parseFloat(k.getAttribute("cx")||.5),B=parseFloat(k.getAttribute("cy")||.5),D=parseFloat(k.getAttribute("fx")||R),U=parseFloat(k.getAttribute("fy")||B),F=a("rect",{id:l+"_jgraduate_rect",x:0,y:0,width:v,height:y,fill:"url(#"+l+"_jgraduate_grad)","fill-opacity":A/100},w),H=t("<div/>").attr({class:"grad_coord jGraduate_lg_field",title:"Begin Stop"}).text(1).css({top:O*m,left:M*m}).data("coord","start").appendTo(x),z=H.clone().text(2).css({top:V*m,left:j*m}).attr("title","End stop").data("coord","end").appendTo(x),q=t("<div/>").attr({class:"grad_coord jGraduate_rg_field",title:"Center stop"}).text("C").css({top:B*m,left:R*m}).data("coord","center").appendTo(x),Y=q.clone().text("F").css({top:U*m,left:D*m,display:"none"}).attr("title","Focus point").data("coord","focus").appendTo(x);Y[0].id=l+"_jGraduate_focusCoord",t.each(["x1","y1","x2","y2","cx","cy","fx","fy"],function(e,n){var r=isNaN(n[1]),a=C.getAttribute(n);a||(a=r?"0.5":"x2"===n?"1.0":"0.0"),_[n]=t("#"+l+"_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]||L)&&(r&&"radialGradient"===S||!r&&"linearGradient"===S)&&C.setAttribute(n,this.value);var e=r?"c"===n[0]?q:Y:"1"===n[1]?H:z,t=n.includes("x")?"left":"top";e.css(t,this.value*m)}).change()});var W,X,Q,K,Z=t("#"+l+"_jGraduate_StopSlider"),$=a("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),J=1,ee=1,te=0,ne=R,re=B,ae=a("svg",{width:"100%",height:45},Z[0]),ie=a("pattern",{width:16,height:16,patternUnits:"userSpaceOnUse",id:"jGraduate_trans"},ae),oe=a("image",{width:16,height:16},ie),se=s.images.clientPath+"map-opacity.png";oe.setAttributeNS(wr.xlink,"xlink:href",se),t(ae).click(function(e){if(K=Z.offset(),"path"!==e.target.tagName){var t=e.pageX-K.left-8;Me((t=t<10?10:t>m+10?m+10:t)/m,0,0,!0),e.stopPropagation()}}),t(ae).mouseover(function(){ae.append($)}),b=a("g",{},ae),a("line",{x1:10,y1:15,x2:m+10,y2:15,"stroke-width":2,stroke:"#000"},ae);var le,ce,ue,de,he=g.find(".jGraduate_spreadMethod").change(function(){C.setAttribute("spreadMethod",t(this).val())}),pe=null,fe=function(e){var t=e.pageX-le.left,n=e.pageY-le.top;t=t<0?0:t>m?m:t,n=n<0?0:n>m?m:n,pe.css("left",t).css("top",n);var r=t/v,a=n/y,i=pe.data("coord"),o=C;switch(i){case"start":_.x1.val(r),_.y1.val(a),o.setAttribute("x1",r),o.setAttribute("y1",a);break;case"end":_.x2.val(r),_.y2.val(a),o.setAttribute("x2",r),o.setAttribute("y2",a);break;case"center":_.cx.val(r),_.cy.val(a),o.setAttribute("cx",r),o.setAttribute("cy",a),ne=r,re=a,Ve();break;case"focus":_.fx.val(r),_.fy.val(a),o.setAttribute("fx",r),o.setAttribute("fy",a),Ve()}e.preventDefault()},ge=function e(){pe=null,p.unbind("mousemove",fe).unbind("mouseup",e)},me=(W=C.getElementsByTagNameNS(wr.svg,"stop")).length;if(me<2){for(;me<2;)C.append(document.createElementNS(wr.svg,"stop")),++me;W=C.getElementsByTagNameNS(wr.svg,"stop")}for(var ve=0;ve<me;ve++)Me(0,0,0,0,W[ve]);if(he.val(C.getAttribute("spreadMethod")||"pad"),L=!1,F.setAttribute("fill-opacity",A/100),t("#"+l+" div.grad_coord").mousedown(function(e){e.preventDefault(),pe=t(this),le=pe.parent().offset(),p.mousemove(fe).mouseup(ge)}),t("#"+l+"_jGraduate_Ok").bind("click",function(){o.paint.type=S,o.paint[S]=C.cloneNode(!0),o.paint.solidColor=null,u()}),t("#"+l+"_jGraduate_Cancel").bind("click",function(e){d()}),"radialGradient"===S&&(L?Y.show():(Y.hide(),_.fx.val(""),_.fy.val(""))),t("#"+l+"_jGraduate_match_ctr")[0].checked=!L,t("#"+l+"_jGraduate_match_ctr").change(function(){L=!this.checked,Y.toggle(L),_.fx.val(""),_.fy.val("");var e=C;if(L){var t=ce||.5,n=ue||.5;e.setAttribute("fx",t),e.setAttribute("fy",n),_.fx.val(t),_.fy.val(n)}else ce=e.getAttribute("fx"),ue=e.getAttribute("fy"),e.removeAttribute("fx"),e.removeAttribute("fy")}),(me=(W=C.getElementsByTagNameNS(wr.svg,"stop")).length)<2){for(;me<2;)C.append(document.createElementNS(wr.svg,"stop")),++me;W=C.getElementsByTagNameNS(wr.svg,"stop")}var ye=0,_e=0;if("radialGradient"===S){var be=C.gradientTransform.baseVal;if(2===be.numberOfItems){var xe=be.getItem(0),we=be.getItem(1);if(2===xe.type&&3===we.type){var Se=we.matrix;1!==Se.a?ye=Math.round(100*-(1-Se.a)):1!==Se.d&&(ye=Math.round(100*(1-Se.d)))}}else if(3===be.numberOfItems){var ke=be.getItem(0),Ce=be.getItem(1),Ae=be.getItem(2);if(4===ke.type&&2===Ce.type&&3===Ae.type){_e=Math.round(ke.angle);var Ee=Ae.matrix;1!==Ee.a?ye=Math.round(100*-(1-Ee.a)):1!==Ee.d&&(ye=Math.round(100*(1-Ee.d)))}}}var Ge={radius:{handle:"#"+l+"_jGraduate_RadiusArrows",input:"#"+l+"_jGraduate_RadiusInput",val:100*(C.getAttribute("r")||.5)},opacity:{handle:"#"+l+"_jGraduate_OpacArrows",input:"#"+l+"_jGraduate_OpacInput",val:o.paint.alpha||100},ellip:{handle:"#"+l+"_jGraduate_EllipArrows",input:"#"+l+"_jGraduate_EllipInput",val:ye},angle:{handle:"#"+l+"_jGraduate_AngleArrows",input:"#"+l+"_jGraduate_AngleInput",val:_e}};t.each(Ge,function(e,n){var r=t(n.handle);r.mousedown(function(a){var i=r.parent();de={type:e,elem:r,input:t(n.input),parent:i,offset:i.offset()},p.mousemove(Pe).mouseup(Ie),a.preventDefault()}),t(n.input).val(n.val).change(function(){var t="radialGradient"===S,n=Number(this.value),a=0;switch(e){case"radius":t&&C.setAttribute("r",n/100),a=Math.pow(n/100,.4)/2*145;break;case"opacity":o.paint.alpha=n,F.setAttribute("fill-opacity",n/100),a=1.45*n;break;case"ellip":if(J=ee=1,0===n){a=72.5;break}n>99.5&&(n=99.5),n>0?ee=1-n/100:J=-n/100-1,a=(n+100)/2*145/100,t&&Ve();break;case"angle":a=(te=n)/180,a+=.5,a*=145,t&&Ve()}a>145?a=145:a<0&&(a=0),r.css({"margin-left":a-5})}).change()});for(var Pe=function(e){!function(e){var t=de.offset.left,n=de.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,de.type){case"radius":(r=Math.pow(2*r,2.5))>.98&&r<1.02&&(r=1),r<=.01&&(r=.01),C.setAttribute("r",r);break;case"opacity":o.paint.alpha=parseInt(100*r),F.setAttribute("fill-opacity",r);break;case"ellip":J=1,ee=1,r<.5?J=(r/=.5)<=0?.01:r:r>.5&&(ee=(r=2-(r/=.5))<=0?.01:r),Ve(),ee===1+(r-=1)&&(r=Math.abs(r));break;case"angle":r-=.5,te=r*=180,Ve(),r/=100}de.elem.css({"margin-left":a}),r=Math.round(100*r),de.input.val(r)}(e),e.preventDefault()},Ie=function e(t){p.unbind("mousemove",Pe).unbind("mouseup",e),de=null},Ne=(255*o.paint.alpha/100).toString(16);Ne.length<2;)Ne="0"+Ne;Ne=Ne.split(".")[0],h="none"===o.paint.solidColor?"":o.paint.solidColor+Ne,E||(h=W[0].getAttribute("stop-color")),t.extend(t.fn.jPicker.defaults.window,{alphaSupport:!0,effects:{type:"show",speed:0}}),f.jPicker({window:{title:s.window.pickerTitle},images:{clientPath:s.images.clientPath},color:{active:h,alphaSupport:!0}},function(e){o.paint.type="solidColor",o.paint.alpha=e.val("ahex")?Math.round(e.val("a")/255*100):100,o.paint.solidColor=e.val("hex")?e.val("hex"):"none",o.paint.radialGradient=null,u()},null,function(){d()});var Te,Le=t(c+" .jGraduate_tabs li");switch(Le.click(function(){Le.removeClass("jGraduate_tab_current"),t(this).addClass("jGraduate_tab_current"),t(c+" > div").hide();var e=t(this).attr("data-type");if(t(c+" .jGraduate_gradPick").show(),"rg"===e||"lg"===e){t(".jGraduate_"+e+"_field").show(),t(".jGraduate_"+("lg"===e?"rg":"lg")+"_field").hide(),t("#"+l+"_jgraduate_rect")[0].setAttribute("fill","url(#"+l+"_"+e+"_jgraduate_grad)"),S="lg"===e?"linearGradient":"radialGradient",t("#"+l+"_jGraduate_OpacInput").val(o.paint.alpha).change();var n=t("#"+l+"_"+e+"_jgraduate_grad")[0];if(C!==n){var r=t(C).find("stop");t(n).empty().append(r),C=n;var a=he.val();C.setAttribute("spreadMethod",a)}L="rg"===e&&null!==C.getAttribute("fx")&&!(R===D&&B===U),t("#"+l+"_jGraduate_focusCoord").toggle(L),L&&(t("#"+l+"_jGraduate_match_ctr")[0].checked=!1)}else t(c+" .jGraduate_gradPick").hide(),t(c+" .jGraduate_colPick").show()}),t(c+" > div").hide(),Le.removeClass("jGraduate_tab_current"),o.paint.type){case"linearGradient":Te=t(c+" .jGraduate_tab_lingrad");break;case"radialGradient":Te=t(c+" .jGraduate_tab_radgrad");break;default:Te=t(c+" .jGraduate_tab_color")}o.show(),setTimeout(function(){Te.addClass("jGraduate_tab_current").click()},10)}else t.alert("Container element must have an id attribute to maintain unique id strings for sub-elements.");function Me(e,n,r,i,o){var c=o||a("stop",{"stop-color":n,"stop-opacity":r,offset:e},C);o?(n=o.getAttribute("stop-color"),r=o.getAttribute("stop-opacity"),e=o.getAttribute("offset")):C.append(c),null===r&&(r=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=a("path",{d:u,fill:"url(#jGraduate_trans)",transform:"translate("+(10+e*m)+", 26)"},b),h=a("path",{d:u,fill:n,"fill-opacity":r,transform:"translate("+(10+e*m)+", 26)",stroke:"#000","stroke-width":1.5},b);return t(h).mousedown(function(e){return Oe(this),Q=X,p.mousemove(Re).mouseup(je),K=Z.offset(),e.preventDefault(),!1}).data("stop",c).data("bg",d).dblclick(function(){t("div.jGraduate_LightBox").show();for(var e=this,r=Number(c.getAttribute("stop-opacity"))||1,a=c.getAttribute("stop-color")||1,i=(255*parseFloat(r)).toString(16);i.length<2;)i="0"+i;n=a.substr(1)+i,t("#"+l+"_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:n,alphaSupport:!0}},function(n,i){a=n.val("hex")?"#"+n.val("hex"):"none",r=null!==n.val("a")?n.val("a")/256:1,e.setAttribute("fill",a),e.setAttribute("fill-opacity",r),c.setAttribute("stop-color",a),c.setAttribute("stop-opacity",r),t("div.jGraduate_LightBox").hide(),t("#"+l+"_jGraduate_stopPicker").hide()},null,function(){t("div.jGraduate_LightBox").hide(),t("#"+l+"_jGraduate_stopPicker").hide()})}),t(C).find("stop").each(function(){var r=t(this);if(Number(this.getAttribute("offset"))>e){if(!n){var a=this.getAttribute("stop-color"),i=this.getAttribute("stop-opacity");c.setAttribute("stop-color",a),h.setAttribute("fill",a),c.setAttribute("stop-opacity",null===i?1:i),h.setAttribute("fill-opacity",null===i?1:i)}return r.before(c),!1}return!0}),i&&Oe(h),c}function Oe(e){X&&X.setAttribute("stroke","#000"),e.setAttribute("stroke","blue"),X=e}function je(){p.unbind("mousemove",Re),"none"!==$.getAttribute("display")&&function(){$.setAttribute("display","none");var e=t(X),n=e.data("stop"),r=e.data("bg");t([X,n,r]).remove()}(),Q=null}function Ve(){var e=te?"rotate("+te+","+ne+","+re+") ":"";if(1===J&&1===ee)C.removeAttribute("gradientTransform");else{var t=-ne*(J-1),n=-re*(ee-1);C.setAttribute("gradientTransform",e+"translate("+t+","+n+") scale("+J+","+ee+")")}}function Re(e){var n=e.pageX-K.left,r=e.pageY-K.top,a="translate("+(n=n<10?10:n>m+10?m+10:n)+", 26)";r<-60||r>130?($.setAttribute("display","block"),$.setAttribute("transform",a)):$.setAttribute("display","none"),Q.setAttribute("transform",a),t.data(Q,"bg").setAttribute("transform",a);var i=t.data(Q,"stop"),o=(n-10)/m;i.setAttribute("offset",o);var s=0;t(C).find("stop").each(function(e){var n=this.getAttribute("offset"),r=t(this);n<s&&(r.prev().before(r),W=t(C).find("stop")),s=n})}})},t},function(e){return e.loadingStylesheets||(e.loadingStylesheets=[]),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,o=r.target,s=t.stateObj.tool_scale||1,l=e(o).height()/2,c=a>n(o,"offsetLeft")+o.offsetWidth*s-this.spinCfg._btn_width?i<n(o,"offsetTop")+l*s?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},X,function(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),o=e(i).offset(),s=e("#"+r.menu);s.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&&z()){if(c.stopPropagation(),e(".contextMenu").hide(),i.hasClass("disabled"))return!1;var d=c.pageX,h=c.pageY,p=t.width()-s.width(),f=t.height()-s.height();d>p-15&&(d=p-15),h>f-30&&(h=f-30),n.unbind("click"),s.css({top:h,left:d}).fadeIn(r.inSpeed),s.find("A").mouseover(function(){s.find("LI.hover").removeClass("hover"),e(this).parent().addClass("hover")}).mouseout(function(){s.find("LI.hover").removeClass("hover")}),n.keypress(function(e){switch(e.keyCode){case 38:s.find("LI.hover").length?(s.find("LI.hover").removeClass("hover").prevAll("LI:not(.disabled)").eq(0).addClass("hover"),s.find("LI.hover").length||s.find("LI:last").addClass("hover")):s.find("LI:last").addClass("hover");break;case 40:s.find("LI.hover").length?(s.find("LI.hover").removeClass("hover").nextAll("LI:not(.disabled)").eq(0).addClass("hover"),s.find("LI.hover").length||s.find("LI:first").addClass("hover")):s.find("LI:first").addClass("hover");break;case 13:s.find("LI.hover A").trigger("click");break;case 27:n.trigger("click")}}),s.find("A").unbind("mouseup"),s.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-o.left,y:h-o.top,docX:d,docY:h}),!1}),setTimeout(function(){n.click(function(){return n.unbind("click").unbind("keypress"),s.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){var n=t.split(","),r=!0,a=!1,i=void 0;try{for(var o,s=n[Symbol.iterator]();!(r=(o=s.next()).done);r=!0){var l=o.value;e(this).find('A[href="'+l+'"]').parent().addClass("disabled")}}catch(e){a=!0,i=e}finally{try{r||null==s.return||s.return()}finally{if(a)throw i}}}}),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){var n=t.split(","),r=!0,a=!1,i=void 0;try{for(var o,s=n[Symbol.iterator]();!(r=(o=s.next()).done);r=!0){var l=o.value;e(this).find('A[href="'+l+'"]').parent().removeClass("disabled")}}catch(e){a=!0,i=e}finally{try{r||null==s.return||s.return()}finally{if(a)throw i}}}}),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(t){t.loadingStylesheets||(t.loadingStylesheets=[]);t.loadingStylesheets.includes("jgraduate/css/jPicker.css")||t.loadingStylesheets.push("jgraduate/css/jPicker.css");var n=function e(n,a){r(this,e);var i=this;function o(e){var r=n.offset();h={l:0|r.left,t:0|r.top},clearTimeout(p),p=setTimeout(function(){c.call(i,e)},0),t(document).bind("mousemove",s).bind("mouseup",l),e.preventDefault()}function s(e){return clearTimeout(p),p=setTimeout(function(){c.call(i,e)},0),e.stopPropagation(),e.preventDefault(),!1}function l(e){return t(document).unbind("mouseup",l).unbind("mousemove",s),e.stopPropagation(),e.preventDefault(),!1}function c(e){var t=n.w,r=n.h,a=e.pageX-h.l,o=e.pageY-h.t;a<0?a=0:a>t&&(a=t),o<0?o=0:o>r&&(o=r),u.call(i,"xy",{x:a/t*y+m,y:o/r*x+_})}function u(e,t,n){if(void 0===t)switch(Ar(e)&&(e="xy"),e.toLowerCase()){case"x":return f;case"y":return g;case"xy":default:return{x:f,y:g}}if(Ar(n)||n!==i){var r,a,o=!1;switch(Ar(e)&&(e="xy"),e.toLowerCase()){case"x":r=t&&(t.x&&0|t.x||0|t)||0;break;case"y":a=t&&(t.y&&0|t.y||0|t)||0;break;case"xy":default:r=t&&t.x&&0|t.x||0,a=t&&t.y&&0|t.y||0}Ar(r)||(r<m?r=m:r>v&&(r=v),f!==r&&(f=r,o=!0)),Ar(a)||(a<_?a=_:a>b&&(a=b),g!==a&&(g=a,o=!0)),o&&function(e){S.forEach(function(t){t.call(i,i,e)})}.call(i,n||i)}}function d(e){"function"==typeof e&&S.push(e)}var h,p,f=0,g=0,m=0,v=100,y=100,_=0,b=100,x=100,w=n.find("img:first"),S=[];t.extend(!0,i,{val:u,range:function(e,t){var n,r,a,i;if(void 0===t)switch(Ar(e)&&(e="all"),e.toLowerCase()){case"minx":return m;case"maxx":return v;case"rangex":return{minX:m,maxX:v,rangeX:y};case"miny":return _;case"maxy":return b;case"rangey":return{minY:_,maxY:b,rangeY:x};case"all":default:return{minX:m,maxX:v,rangeX:y,minY:_,maxY:b,rangeY:x}}switch(Ar(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}Ar(n)||m===n||(y=v-(m=n)),Ar(r)||v===r||(y=(v=r)-m),Ar(a)||_===a||(x=b-(_=a)),Ar(i)||b===i||(x=(b=i)-_)},bind:d,unbind:function(e){if("function"==typeof e)for(var t;t=S.includes(e);)S.splice(t,1)},destroy:function(){t(document).unbind("mouseup",l).unbind("mousemove",s),n.unbind("mousedown",o),n=null,w=null,S=null}}),w.src=a.arrow&&a.arrow.image,w.w=a.arrow&&a.arrow.width||w.width(),w.h=a.arrow&&a.arrow.height||w.height(),n.w=a.map&&a.map.width||n.width(),n.h=a.map&&a.map.height||n.height(),n.bind("mousedown",o),d.call(i,function(){var e=n.w,t=n.h,r=w.w,a=w.h,i=0,o=0;setTimeout(function(){y>0&&(i=f===v?e:f/y*e|0),x>0&&(o=g===b?t:g/x*t|0),r>=e?i=(e>>1)-(r>>1):i-=r>>1,a>=t?o=(t>>1)-(a>>1):o-=a>>1,w.css({left:i+"px",top:o+"px"})})})},a=function e(n,a,i,o){r(this,e);var s=this,l=n.find("td.Text input");function c(e){if(""!==e.target.value||e.target===w.get(0)||(Ar(i)||e.target===i.get(0))&&!Ar(i)){if(!h(e))return e;switch(e.target){case g.get(0):switch(e.keyCode){case 38:return g.val(p.call(s,1+(g.val()<<0),0,255)),a.val("r",g.val(),e.target),!1;case 40:return g.val(p.call(s,(g.val()<<0)-1,0,255)),a.val("r",g.val(),e.target),!1}break;case m.get(0):switch(e.keyCode){case 38:return m.val(p.call(s,1+(m.val()<<0),0,255)),a.val("g",m.val(),e.target),!1;case 40:return m.val(p.call(s,(m.val()<<0)-1,0,255)),a.val("g",m.val(),e.target),!1}break;case v.get(0):switch(e.keyCode){case 38:return v.val(p.call(s,1+(v.val()<<0),0,255)),a.val("b",v.val(),e.target),!1;case 40:return v.val(p.call(s,(v.val()<<0)-1,0,255)),a.val("b",v.val(),e.target),!1}break;case y&&y.get(0):switch(e.keyCode){case 38:return y.val(p.call(s,parseFloat(y.val())+1,0,100)),a.val("a",Sr(255*y.val()/100,o),e.target),!1;case 40:return y.val(p.call(s,parseFloat(y.val())-1,0,100)),a.val("a",Sr(255*y.val()/100,o),e.target),!1}break;case _.get(0):switch(e.keyCode){case 38:return _.val(p.call(s,1+(_.val()<<0),0,360)),a.val("h",_.val(),e.target),!1;case 40:return _.val(p.call(s,(_.val()<<0)-1,0,360)),a.val("h",_.val(),e.target),!1}break;case b.get(0):switch(e.keyCode){case 38:return b.val(p.call(s,1+(b.val()<<0),0,100)),a.val("s",b.val(),e.target),!1;case 40:return b.val(p.call(s,(b.val()<<0)-1,0,100)),a.val("s",b.val(),e.target),!1}break;case x.get(0):switch(e.keyCode){case 38:return x.val(p.call(s,1+(x.val()<<0),0,100)),a.val("v",x.val(),e.target),!1;case 40:return x.val(p.call(s,(x.val()<<0)-1,0,100)),a.val("v",x.val(),e.target),!1}}}}function u(e){if(""!==e.target.value||e.target===w.get(0)||(Ar(i)||e.target===i.get(0))&&!Ar(i)){if(!h(e))return e;switch(e.target){case g.get(0):g.val(p.call(s,g.val(),0,255)),a.val("r",g.val(),e.target);break;case m.get(0):m.val(p.call(s,m.val(),0,255)),a.val("g",m.val(),e.target);break;case v.get(0):v.val(p.call(s,v.val(),0,255)),a.val("b",v.val(),e.target);break;case y&&y.get(0):y.val(p.call(s,y.val(),0,100)),a.val("a",Sr(255*y.val()/100,o),e.target);break;case _.get(0):_.val(p.call(s,_.val(),0,360)),a.val("h",_.val(),e.target);break;case b.get(0):b.val(p.call(s,b.val(),0,100)),a.val("s",b.val(),e.target);break;case x.get(0):x.val(p.call(s,x.val(),0,100)),a.val("v",x.val(),e.target);break;case w.get(0):w.val(w.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6)),i&&i.val(w.val()),a.val("hex",""!==w.val()?w.val():null,e.target);break;case i&&i.get(0):i.val(i.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6)),w.val(i.val()),a.val("hex",""!==i.val()?i.val():null,e.target);break;case S&&S.get(0):S.val(S.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,2)),a.val("a",Ar(S.val())?null:parseInt(S.val(),16),e.target)}}}function d(e){if(!Ar(a.val()))switch(e.target){case g.get(0):g.val(a.val("r"));break;case m.get(0):m.val(a.val("g"));break;case v.get(0):v.val(a.val("b"));break;case y&&y.get(0):y.val(Sr(100*a.val("a")/255,o));break;case _.get(0):_.val(a.val("h"));break;case b.get(0):b.val(a.val("s"));break;case x.get(0):x.val(a.val("v"));break;case w.get(0):case i&&i.get(0):w.val(a.val("hex")),i&&i.val(a.val("hex"));break;case S&&S.get(0):S.val(a.val("ahex").substring(6))}}function h(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 p(e,t,n){return""===e||isNaN(e)?t:e>n?n:e<t?t:e}function f(e,t){var n=e.val("all");t!==g.get(0)&&g.val(Ar(n)?"":n.r),t!==m.get(0)&&m.val(Ar(n)?"":n.g),t!==v.get(0)&&v.val(Ar(n)?"":n.b),y&&t!==y.get(0)&&y.val(Ar(n)?"":Sr(100*n.a/255,o)),t!==_.get(0)&&_.val(Ar(n)?"":n.h),t!==b.get(0)&&b.val(Ar(n)?"":n.s),t!==x.get(0)&&x.val(Ar(n)?"":n.v),t!==w.get(0)&&(i&&t!==i.get(0)||!i)&&w.val(Ar(n)?"":n.hex),i&&t!==i.get(0)&&t!==w.get(0)&&i.val(Ar(n)?"":n.hex),S&&t!==S.get(0)&&S.val(Ar(n)?"":n.ahex.substring(6))}var g=l.eq(3),m=l.eq(4),v=l.eq(5),y=l.length>7?l.eq(6):null,_=l.eq(0),b=l.eq(1),x=l.eq(2),w=l.eq(l.length>7?7:6),S=l.length>7?l.eq(8):null;t.extend(!0,s,{destroy:function(){g.add(m).add(v).add(y).add(_).add(b).add(x).add(w).add(i).add(S).unbind("keyup",u).unbind("blur",d),g.add(m).add(v).add(y).add(_).add(b).add(x).unbind("keydown",c),a.unbind(f),g=null,m=null,v=null,y=null,_=null,b=null,x=null,w=null,S=null}}),g.add(m).add(v).add(y).add(_).add(b).add(x).add(w).add(i).add(S).bind("keyup",u).bind("blur",d),g.add(m).add(v).add(y).add(_).add(b).add(x).bind("keydown",c),a.bind(f)};t.jPicker={List:[],Color:function(n){var r=this;function a(e){for(var t=0;t<g.length;t++)g[t].call(r,r,e)}function i(t,n,g){var m=Boolean(n);if(m&&""===n.ahex&&(n.ahex="00000000"),!m){var v;if((Ar(t)||""===t)&&(t="all"),Ar(o))return null;switch(t.toLowerCase()){case"ahex":return l.rgbaToHex({r:o,g:s,b:c,a:u});case"hex":return i("ahex").substring(0,6);case"all":return{r:o,g:s,b:c,a:u,h:d,s:h,v:p,hex:i.call(r,"hex"),ahex:i.call(r,"ahex")};default:v={};var y=t.length;f(t).forEach(function(e){switch(e){case"r":1===y?v=o:v.r=o;break;case"g":1===y?v=s:v.g=s;break;case"b":1===y?v=c:v.b=c;break;case"a":1===y?v=u:v.a=u;break;case"h":1===y?v=d:v.h=d;break;case"s":1===y?v=h:v.s=h;break;case"v":1===y?v=p:v.v=p}})}return"object"!==e(v)||Object.keys(v).length?v:i.call(r,"all")}if(Ar(g)||g!==r){Ar(t)&&(t="");var _=!1;if(Ar(n))return Ar(o)||(o=null,_=!0),Ar(s)||(s=null,_=!0),Ar(c)||(c=null,_=!0),Ar(u)||(u=null,_=!0),Ar(d)||(d=null,_=!0),Ar(h)||(h=null,_=!0),Ar(p)||(p=null,_=!0),void(_&&a.call(r,g||r));switch(t.toLowerCase()){case"ahex":case"hex":var b=l.hexToRgba(n&&(n.ahex||n.hex)||n||"none");i.call(r,"rgba",{r:b.r,g:b.g,b:b.b,a:"ahex"===t?b.a:Ar(u)?255:u},g);break;default:if(n&&(!Ar(n.ahex)||!Ar(n.hex)))return void i.call(r,"ahex",n.ahex||n.hex||"00000000",g);var x={},w=!1,S=!1;if(void 0===n.r||t.includes("r")||(t+="r"),void 0===n.g||t.includes("g")||(t+="g"),void 0===n.b||t.includes("b")||(t+="b"),void 0===n.a||t.includes("a")||(t+="a"),void 0===n.h||t.includes("h")||(t+="h"),void 0===n.s||t.includes("s")||(t+="s"),void 0===n.v||t.includes("v")||(t+="v"),f(t).forEach(function(e){switch(e){case"r":if(S)return;w=!0,x.r=n.r&&0|n.r||0|n||0,x.r<0?x.r=0:x.r>255&&(x.r=255),o!==x.r&&(o=x.r,_=!0);break;case"g":if(S)return;w=!0,x.g=n&&n.g&&0|n.g||n&&0|n||0,x.g<0?x.g=0:x.g>255&&(x.g=255),s!==x.g&&(s=x.g,_=!0);break;case"b":if(S)return;w=!0,x.b=n&&n.b&&0|n.b||n&&0|n||0,x.b<0?x.b=0:x.b>255&&(x.b=255),c!==x.b&&(c=x.b,_=!0);break;case"a":x.a=n&&!Ar(n.a)?0|n.a:0|n,x.a<0?x.a=0:x.a>255&&(x.a=255),u!==x.a&&(u=x.a,_=!0);break;case"h":if(w)return;S=!0,x.h=n&&n.h&&0|n.h||n&&0|n||0,x.h<0?x.h=0:x.h>360&&(x.h=360),d!==x.h&&(d=x.h,_=!0);break;case"s":if(w)return;S=!0,x.s=Ar(n.s)?0|n:0|n.s,x.s<0?x.s=0:x.s>100&&(x.s=100),h!==x.s&&(h=x.s,_=!0);break;case"v":if(w)return;S=!0,x.v=Ar(n.v)?0|n:0|n.v,x.v<0?x.v=0:x.v>100&&(x.v=100),p!==x.v&&(p=x.v,_=!0)}}),_){if(w){o=o||0,s=s||0,c=c||0;var k=l.rgbToHsv({r:o,g:s,b:c});d=k.h,h=k.s,p=k.v}else if(S){d=d||0,h=Ar(h)?100:h,p=Ar(p)?100:p;var C=l.hsvToRgb({h:d,s:h,v:p});o=C.r,s=C.g,c=C.b}u=Ar(u)?255:u,a.call(r,g||r)}}}}var o,s,c,u,d,h,p,g=[];t.extend(!0,r,{val:i,bind:function(e){"function"==typeof e&&g.push(e)},unbind:function(e){if("function"==typeof e)for(var t;t=g.includes(e);)g.splice(t,1)},destroy:function(){g=null}}),n&&(Ar(n.ahex)?Ar(n.hex)?Ar(n.r)||Ar(n.g)||Ar(n.b)?Ar(n.h)||Ar(n.s)||Ar(n.v)||i("hsv"+(Ar(n.a)?"":"a"),n):i("rgb"+(Ar(n.a)?"":"a"),n):i((Ar(n.a)?"":"a")+"hex",Ar(n.a)?n:{ahex:n.hex+l.intToHex(n.a)}):i("ahex",n))},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},o=0,s=0;return n>=r&&n>=a?(s=n,o=r>a?a:r):r>=a&&r>=n?(s=r,o=n>a?a:n):(s=a,o=r>n?n:r),i.v=s,i.s=s?(s-o)/s:0,i.s?(t=s-o,i.h=n===s?(r-a)/t:r===s?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),o=n-i,s=(a/=100)*(1-(r/=100)),l=a*(1-r*o),c=a*(1-r*(1-o));switch(i){case 0:t.r=a,t.g=c,t.b=s;break;case 1:t.r=l,t.g=a,t.b=s;break;case 2:t.r=s,t.g=a,t.b=c;break;case 3:t.r=s,t.g=l,t.b=a;break;case 4:t.r=c,t.g=s,t.b=a;break;case 5:t.r=a,t.g=s,t.b=l}t.r=255*t.r|0,t.g=255*t.g|0,t.b=255*t.b|0}return t}}};var i=t.jPicker,o=i.Color,s=i.List,l=i.ColorMethods;return t.fn.jPicker=function(r,i,c,u){return this.each(function(){var d=this,h=t.extend(!0,{},t.fn.jPicker.defaults,r);"input"===t(d).get(0).nodeName.toLowerCase()&&(t.extend(!0,h,{window:{bindToInput:!0,expandable:!0,input:t(d)}}),""===t(d).val()?(h.color.active=new o({hex:null}),h.color.current=new o({hex:null})):l.validateHex(t(d).val())&&(h.color.active=new o({hex:t(d).val(),a:h.color.active.val("a")}),h.color.current=new o({hex:t(d).val(),a:h.color.active.val("a")}))),h.window.expandable?t(d).after('<span class="jPicker"><span class="Icon"><span class="Color">&nbsp;</span><span class="Alpha">&nbsp;</span><span class="Image" title="Click To Open Color Picker">&nbsp;</span><span class="Container">&nbsp;</span></span></span>'):h.window.liveUpdate=!1;var p=parseFloat(navigator.appVersion.split("MSIE")[1])<7&&document.body.filters;function f(e){var t,n,r=R.active,a=r.val("hex");switch(h.color.mode=e,e){case"h":if(setTimeout(function(){y.call(d,z,"transparent"),b.call(d,Y,0),x.call(d,Y,100),b.call(d,W,260),x.call(d,W,100),y.call(d,q,"transparent"),b.call(d,Q,0),x.call(d,Q,100),b.call(d,K,260),x.call(d,K,100),b.call(d,Z,260),x.call(d,Z,100),b.call(d,$,260),x.call(d,$,100),b.call(d,ee,260),x.call(d,ee,100)},0),te.range("all",{minX:0,maxX:100,minY:0,maxY:100}),ne.range("rangeY",{minY:0,maxY:360}),Ar(r.val("ahex")))break;te.val("xy",{x:r.val("s"),y:100-r.val("v")},te),ne.val("y",360-r.val("h"),ne);break;case"s":if(setTimeout(function(){y.call(d,z,"transparent"),b.call(d,Y,-260),b.call(d,W,-520),b.call(d,Q,-260),b.call(d,K,-520),b.call(d,ee,260),x.call(d,ee,100)},0),te.range("all",{minX:0,maxX:360,minY:0,maxY:100}),ne.range("rangeY",{minY:0,maxY:100}),Ar(r.val("ahex")))break;te.val("xy",{x:r.val("h"),y:100-r.val("v")},te),ne.val("y",100-r.val("s"),ne);break;case"v":if(setTimeout(function(){y.call(d,z,"000000"),b.call(d,Y,-780),b.call(d,W,260),y.call(d,q,a),b.call(d,Q,-520),b.call(d,K,260),x.call(d,K,100),b.call(d,ee,260),x.call(d,ee,100)},0),te.range("all",{minX:0,maxX:360,minY:0,maxY:100}),ne.range("rangeY",{minY:0,maxY:100}),Ar(r.val("ahex")))break;te.val("xy",{x:r.val("h"),y:100-r.val("s")},te),ne.val("y",100-r.val("v"),ne);break;case"r":if(t=-1040,n=-780,te.range("all",{minX:0,maxX:255,minY:0,maxY:255}),ne.range("rangeY",{minY:0,maxY:255}),Ar(r.val("ahex")))break;te.val("xy",{x:r.val("b"),y:255-r.val("g")},te),ne.val("y",255-r.val("r"),ne);break;case"g":if(t=-1560,n=-1820,te.range("all",{minX:0,maxX:255,minY:0,maxY:255}),ne.range("rangeY",{minY:0,maxY:255}),Ar(r.val("ahex")))break;te.val("xy",{x:r.val("b"),y:255-r.val("r")},te),ne.val("y",255-r.val("g"),ne);break;case"b":if(t=-2080,n=-2860,te.range("all",{minX:0,maxX:255,minY:0,maxY:255}),ne.range("rangeY",{minY:0,maxY:255}),Ar(r.val("ahex")))break;te.val("xy",{x:r.val("r"),y:255-r.val("g")},te),ne.val("y",255-r.val("b"),ne);break;case"a":if(setTimeout(function(){y.call(d,z,"transparent"),b.call(d,Y,-260),b.call(d,W,-520),b.call(d,Q,260),b.call(d,K,260),x.call(d,K,100),b.call(d,ee,0),x.call(d,ee,100)},0),te.range("all",{minX:0,maxX:360,minY:0,maxY:100}),ne.range("rangeY",{minY:0,maxY:255}),Ar(r.val("ahex")))break;te.val("xy",{x:r.val("h"),y:100-r.val("v")},te),ne.val("y",255-r.val("a"),ne);break;default:throw new Error("Invalid Mode")}switch(e){case"h":break;case"s":case"v":case"a":setTimeout(function(){x.call(d,Y,100),x.call(d,Q,100),b.call(d,Z,260),x.call(d,Z,100),b.call(d,$,260),x.call(d,$,100)},0);break;case"r":case"g":case"b":setTimeout(function(){y.call(d,z,"transparent"),y.call(d,q,"transparent"),x.call(d,Q,100),x.call(d,Y,100),b.call(d,Y,t),b.call(d,W,t-260),b.call(d,Q,n-780),b.call(d,K,n-520),b.call(d,Z,n),b.call(d,$,n-260),b.call(d,ee,260),x.call(d,ee,100)},0)}Ar(r.val("ahex"))||g.call(d,r)}function g(e,t){(Ar(t)||t!==ne&&t!==te)&&function(e,t){if(t!==te)switch(h.color.mode){case"h":var n=e.val("sv");te.val("xy",{x:Ar(n)?100:n.s,y:100-(Ar(n)?100:n.v)},t);break;case"s":case"a":var r=e.val("hv");te.val("xy",{x:r&&r.h||0,y:100-(Ar(r)?100:r.v)},t);break;case"v":var a=e.val("hs");te.val("xy",{x:a&&a.h||0,y:100-(Ar(a)?100:a.s)},t);break;case"r":var i=e.val("bg");te.val("xy",{x:i&&i.b||0,y:255-(i&&i.g||0)},t);break;case"g":var o=e.val("br");te.val("xy",{x:o&&o.b||0,y:255-(o&&o.r||0)},t);break;case"b":var s=e.val("rg");te.val("xy",{x:s&&s.r||0,y:255-(s&&s.g||0)},t)}if(t!==ne)switch(h.color.mode){case"h":ne.val("y",360-(e.val("h")||0),t);break;case"s":var l=e.val("s");ne.val("y",100-(Ar(l)?100:l),t);break;case"v":var c=e.val("v");ne.val("y",100-(Ar(c)?100:c),t);break;case"r":ne.val("y",255-(e.val("r")||0),t);break;case"g":ne.val("y",255-(e.val("g")||0),t);break;case"b":ne.val("y",255-(e.val("b")||0),t);break;case"a":var u=e.val("a");ne.val("y",255-(Ar(u)?255:u),t)}}.call(d,e,t),setTimeout(function(){(function(e){try{var t=e.val("all");ae.css({backgroundColor:t&&"#"+t.hex||"transparent"}),x.call(d,ae,t&&Sr(100*t.a/255,4)||0)}catch(e){}}).call(d,e),function(e){switch(h.color.mode){case"h":y.call(d,z,new o({h:e.val("h")||0,s:100,v:100}).val("hex"));break;case"s":case"a":var t=e.val("s");x.call(d,W,100-(Ar(t)?100:t));break;case"v":var n=e.val("v");x.call(d,Y,Ar(n)?100:n);break;case"r":x.call(d,W,Sr((e.val("r")||0)/255*100,4));break;case"g":x.call(d,W,Sr((e.val("g")||0)/255*100,4));break;case"b":x.call(d,W,Sr((e.val("b")||0)/255*100))}var r=e.val("a");x.call(d,X,Sr(100*(255-(r||0))/255,4))}.call(d,e),function(e){switch(h.color.mode){case"h":var t=e.val("a");x.call(d,J,Sr(100*(255-(t||0))/255,4));break;case"s":var n=e.val("hva"),r=new o({h:n&&n.h||0,s:100,v:Ar(n)?100:n.v});y.call(d,q,r.val("hex")),x.call(d,K,100-(Ar(n)?100:n.v)),x.call(d,J,Sr(100*(255-(n&&n.a||0))/255,4));break;case"v":var a=e.val("hsa"),i=new o({h:a&&a.h||0,s:Ar(a)?100:a.s,v:100});y.call(d,q,i.val("hex")),x.call(d,J,Sr(100*(255-(a&&a.a||0))/255,4));break;case"r":case"g":case"b":var s=e.val("rgba"),l=0,c=0;"r"===h.color.mode?(l=s&&s.b||0,c=s&&s.g||0):"g"===h.color.mode?(l=s&&s.b||0,c=s&&s.r||0):"b"===h.color.mode&&(l=s&&s.r||0,c=s&&s.g||0);var u=c>l?l:c;x.call(d,K,l>c?Sr((l-c)/(255-c)*100,4):0),x.call(d,Z,c>l?Sr((c-l)/(255-l)*100,4):0),x.call(d,$,Sr(u/255*100,4)),x.call(d,J,Sr(100*(255-(s&&s.a||0))/255,4));break;case"a":var p=e.val("a");y.call(d,q,e.val("hex")||"000000"),x.call(d,J,Ar(p)?100:0),x.call(d,ee,Ar(p)?0:100)}}.call(d,e)},0)}function m(e,t){var n=R.active;if(t===te||!Ar(n.val())){var r=e.val("all");switch(h.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 v(e,t){var n=R.active;if(t===ne||!Ar(n.val()))switch(h.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 y(e,t){e.css({backgroundColor:t&&6===t.length&&"#"+t||"transparent"})}function _(e,t){p&&(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 x(e,t){if(e.css({visibility:t>0?"visible":"hidden"}),t>0&&t<100)if(p){var n=e.attr("pngSrc");!Ar(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:Sr(t/100,4)})}else e.css({opacity:Sr(t/100,4)});else if(0===t||100===t)if(p){var r=e.attr("pngSrc");!Ar(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 w(){R.active.val("ahex",R.current.val("ahex"))}function S(e){t(this).parents("tbody:first").find('input:radio[value!="'+e.target.value+'"]').removeAttr("checked"),f.call(d,e.target.value)}function k(){w.call(d)}function C(){w.call(d),h.window.expandable&&O.call(d),"function"==typeof u&&u.call(d,R.active,se)}function A(){(function(){R.current.val("ahex",R.active.val("ahex"))}).call(d),h.window.expandable&&O.call(d),"function"==typeof i&&i.call(d,R.active,oe)}function E(){M.call(d)}function G(e){var t=e.val("hex");ie.css({backgroundColor:t&&"#"+t||"transparent"}),x.call(d,ie,Sr(100*(e.val("a")||0)/255,4))}function P(e){var t=e.val("hex"),n=e.val("va");ce.css({backgroundColor:t&&"#"+t||"transparent"}),x.call(d,ue,Sr(100*(255-(n&&n.a||0))/255,4)),h.window.bindToInput&&h.window.updateInputColor&&h.window.input.css({backgroundColor:t&&"#"+t||"transparent",color:Ar(n)||n.v>75?"#000000":"#ffffff"})}function I(e){B=parseInt(H.css("left")),D=parseInt(H.css("top")),U=e.pageX,F=e.pageY,t(document).bind("mousemove",N).bind("mouseup",T),e.preventDefault()}function N(e){return H.css({left:B-(U-e.pageX)+"px",top:D-(F-e.pageY)+"px"}),h.window.expandable&&!t.support.boxModel&&H.prev().css({left:H.css("left"),top:H.css("top")}),e.stopPropagation(),e.preventDefault(),!1}function T(e){return t(document).unbind("mousemove",N).unbind("mouseup",T),e.stopPropagation(),e.preventDefault(),!1}function L(e){return e.preventDefault(),e.stopPropagation(),R.active.val("ahex",t(this).attr("title")||null,e.target),!1}function M(){function e(){if(h.window.expandable&&!t.support.boxModel){var e=H.find("table:first");H.before("<iframe/>"),H.prev().css({width:e.width(),height:H.height(),opacity:0,position:"absolute",left:H.css("left"),top:H.css("top")})}}switch(R.current.val("ahex",R.active.val("ahex")),h.window.expandable&&(t(document.body).children("div.jPicker.Container").css({zIndex:10}),H.css({zIndex:20})),h.window.effects.type){case"fade":H.fadeIn(h.window.effects.speed.show,e);break;case"slide":H.slideDown(h.window.effects.speed.show,e);break;case"show":default:H.show(h.window.effects.speed.show,e)}}function O(){function e(){h.window.expandable&&H.css({zIndex:10}),h.window.expandable&&!t.support.boxModel&&H.prev().remove()}switch(h.window.effects.type){case"fade":H.fadeOut(h.window.effects.speed.hide,e);break;case"slide":H.slideUp(h.window.effects.speed.hide,e);break;case"show":default:H.hide(h.window.effects.speed.hide,e)}}var j=h.images,V=h.localization,R={active:"string"===e(h.color.active).toString().toLowerCase()?new o({ahex:!h.window.alphaSupport&&h.color.active?h.color.active.substring(0,6)+"ff":h.color.active}):new o({ahex:!h.window.alphaSupport&&h.color.active.val("ahex")?h.color.active.val("ahex").substring(0,6)+"ff":h.color.active.val("ahex")}),current:"string"===e(h.color.active).toString().toLowerCase()?new o({ahex:!h.window.alphaSupport&&h.color.active?h.color.active.substring(0,6)+"ff":h.color.active}):new o({ahex:!h.window.alphaSupport&&h.color.active.val("ahex")?h.color.active.val("ahex").substring(0,6)+"ff":h.color.active.val("ahex")}),quickList:h.color.quickList};"function"!=typeof i&&(i=null),"function"!=typeof c&&(c=null),"function"!=typeof u&&(u=null);var B=null,D=null,U=null,F=null,H=null,z=null,q=null,Y=null,W=null,X=null,Q=null,K=null,Z=null,$=null,J=null,ee=null,te=null,ne=null,re=null,ae=null,ie=null,oe=null,se=null,le=null,ce=null,ue=null,de=null,he=null;t.extend(!0,d,{commitCallback:i,liveCallback:c,cancelCallback:u,color:R,show:M,hide:O,destroy:function(){H.find("td.Radio input").unbind("click",S),ie.unbind("click",k),se.unbind("click",C),oe.unbind("click",A),h.window.expandable&&(de.unbind("click",E),he.unbind("mousedown",I),d.icon=null),H.find(".QuickColor").unbind("click",L),z=null,q=null,Y=null,W=null,X=null,Q=null,K=null,Z=null,$=null,J=null,ee=null,te.destroy(),te=null,ne.destroy(),ne=null,re.destroy(),re=null,ae=null,ie=null,oe=null,se=null,le=null,i=null,u=null,c=null,H.html("");for(var e=0;e<s.length;e++)s[e]===d&&(s.splice(e,1),e--)}}),s.push(d),setTimeout(function(){(function(){var r=h.window,i=r.expandable?t(d).next().find(".Container:first"):null;(H=r.expandable?t("<div/>"):t(d)).addClass("jPicker Container"),r.expandable&&H.hide(),H.get(0).onselectstart=function(e){return"input"===e.target.nodeName.toLowerCase()};var s=R.active.val("all");r.alphaPrecision<0?r.alphaPrecision=0:r.alphaPrecision>2&&(r.alphaPrecision=2);var l='<table class="jPicker" cellpadding="0" cellspacing="0">\n <tbody>\n '.concat(r.expandable?'<tr><td class="Move" colspan="5">&nbsp;</td></tr>':"",'\n <tr>\n <td rowspan="9"><h2 class="Title">').concat(r.title||V.text.title,'</h2><div class="Map"><span class="Map1">&nbsp;</span><span class="Map2">&nbsp;</span><span class="Map3">&nbsp;</span><img src="').concat(j.clientPath+j.colorMap.arrow.file,'" class="Arrow"/></div></td>\n <td rowspan="9"><div class="Bar"><span class="Map1">&nbsp;</span><span class="Map2">&nbsp;</span><span class="Map3">&nbsp;</span><span class="Map4">&nbsp;</span><span class="Map5">&nbsp;</span><span class="Map6">&nbsp;</span><img src="').concat(j.clientPath+j.colorBar.arrow.file,'" class="Arrow"/></div></td>\n <td colspan="2" class="Preview">').concat(V.text.newColor,'<div><span class="Active" title="').concat(V.tooltips.colors.newColor,'">&nbsp;</span><span class="Current" title="').concat(V.tooltips.colors.currentColor,'">&nbsp;</span></div>').concat(V.text.currentColor,'</td>\n <td rowspan="9" class="Button"><input type="button" class="Ok" value="').concat(V.text.ok,'" title="').concat(V.tooltips.buttons.ok,'"/><input type="button" class="Cancel" value="').concat(V.text.cancel,'" title="').concat(V.tooltips.buttons.cancel,'"/><hr/><div class="Grid">&nbsp;</div></td>\n </tr>\n <tr class="Hue">\n <td class="Radio"><label title="').concat(V.tooltips.hue.radio,'"><input type="radio" value="h"').concat("h"===h.color.mode?' checked="checked"':"",'/>H:</label></td>\n <td class="Text"><input type="text" maxlength="3" value="').concat(Ar(s)?"":s.h,'" title="').concat(V.tooltips.hue.textbox,'"/>&nbsp;&deg;</td>\n </tr>\n <tr class="Saturation">\n <td class="Radio"><label title="').concat(V.tooltips.saturation.radio,'"><input type="radio" value="s"').concat("s"===h.color.mode?' checked="checked"':"",'/>S:</label></td>\n <td class="Text"><input type="text" maxlength="3" value="').concat(Ar(s)?"":s.s,'" title="').concat(V.tooltips.saturation.textbox,'"/>&nbsp;%</td>\n </tr>\n <tr class="Value">\n <td class="Radio"><label title="').concat(V.tooltips.value.radio,'"><input type="radio" value="v"').concat("v"===h.color.mode?' checked="checked"':"",'/>V:</label><br/><br/></td>\n <td class="Text"><input type="text" maxlength="3" value="').concat(Ar(s)?"":s.v,'" title="').concat(V.tooltips.value.textbox,'"/>&nbsp;%<br/><br/></td>\n </tr>\n <tr class="Red">\n <td class="Radio"><label title="').concat(V.tooltips.red.radio,'"><input type="radio" value="r"').concat("r"===h.color.mode?' checked="checked"':"",'/>R:</label></td>\n <td class="Text"><input type="text" maxlength="3" value="').concat(Ar(s)?"":s.r,'" title="').concat(V.tooltips.red.textbox,'"/></td>\n </tr>\n <tr class="Green">\n <td class="Radio"><label title="').concat(V.tooltips.green.radio,'"><input type="radio" value="g"').concat("g"===h.color.mode?' checked="checked"':"",'/>G:</label></td>\n <td class="Text"><input type="text" maxlength="3" value="').concat(Ar(s)?"":s.g,'" title="').concat(V.tooltips.green.textbox,'"/></td>\n </tr>\n <tr class="Blue">\n <td class="Radio"><label title="').concat(V.tooltips.blue.radio,'"><input type="radio" value="b"').concat("b"===h.color.mode?' checked="checked"':"",'/>B:</label></td>\n <td class="Text"><input type="text" maxlength="3" value="').concat(Ar(s)?"":s.b,'" title="').concat(V.tooltips.blue.textbox,'"/></td>\n </tr>\n <tr class="Alpha">\n <td class="Radio">').concat(r.alphaSupport?'<label title="'.concat(V.tooltips.alpha.radio,'"><input type="radio" value="a"').concat("a"===h.color.mode?' checked="checked"':"","/>A:</label>"):"&nbsp;",'</td>\n <td class="Text">').concat(r.alphaSupport?'<input type="text" maxlength="'.concat(3+r.alphaPrecision,'" value="').concat(Ar(s)?"":Sr(100*s.a/255,r.alphaPrecision),'" title="').concat(V.tooltips.alpha.textbox,'"/>&nbsp;%'):"&nbsp;",'</td>\n </tr>\n <tr class="Hex">\n <td colspan="2" class="Text"><label title="').concat(V.tooltips.hex.textbox,'">#:<input type="text" maxlength="6" class="Hex" value="').concat(Ar(s)?"":s.hex,'"/></label>').concat(r.alphaSupport?'<input type="text" maxlength="2" class="AHex" value="'.concat(Ar(s)?"":s.ahex.substring(6),'" title="').concat(V.tooltips.hex.alpha,'"/></td>'):"&nbsp;","\n </tr>\n </tbody></table>");r.expandable?(H.html(l),t(document.body).children("div.jPicker.Container").length?t(document.body).children("div.jPicker.Container:last").after(H):t(document.body).prepend(H),H.mousedown(function(){t(document.body).children("div.jPicker.Container").css({zIndex:10}),H.css({zIndex:20})}),H.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?(t(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"})):(H=t(d)).html(l);var u=H.find("tbody:first");z=u.find("div.Map:first"),q=u.find("div.Bar:first");var p=z.find("span"),y=q.find("span");Y=p.filter(".Map1:first"),W=p.filter(".Map2:first"),X=p.filter(".Map3:first"),Q=y.filter(".Map1:first"),K=y.filter(".Map2:first"),Z=y.filter(".Map3:first"),$=y.filter(".Map4:first"),J=y.filter(".Map5:first"),ee=y.filter(".Map6:first"),(te=new n(z,{map:{width:j.colorMap.width,height:j.colorMap.height},arrow:{image:j.clientPath+j.colorMap.arrow.file,width:j.colorMap.arrow.width,height:j.colorMap.arrow.height}})).bind(m),(ne=new n(q,{map:{width:j.colorBar.width,height:j.colorBar.height},arrow:{image:j.clientPath+j.colorBar.arrow.file,width:j.colorBar.arrow.width,height:j.colorBar.arrow.height}})).bind(v),re=new a(u,R.active,r.expandable&&r.bindToInput?r.input:null,r.alphaPrecision);var b=Ar(s)?null:s.hex,w=u.find(".Preview"),N=u.find(".Button");if(ae=w.find(".Active:first").css({backgroundColor:b&&"#"+b||"transparent"}),ie=w.find(".Current:first").css({backgroundColor:b&&"#"+b||"transparent"}).bind("click",k),x.call(d,ie,Sr(100*R.current.val("a")/255,4)),oe=N.find(".Ok:first").bind("click",A),se=N.find(".Cancel:first").bind("click",C),le=N.find(".Grid:first"),setTimeout(function(){_.call(d,Y,j.clientPath+"Maps.png"),_.call(d,W,j.clientPath+"Maps.png"),_.call(d,X,j.clientPath+"map-opacity.png"),_.call(d,Q,j.clientPath+"Bars.png"),_.call(d,K,j.clientPath+"Bars.png"),_.call(d,Z,j.clientPath+"Bars.png"),_.call(d,$,j.clientPath+"Bars.png"),_.call(d,J,j.clientPath+"bar-opacity.png"),_.call(d,ee,j.clientPath+"AlphaBar.png"),_.call(d,w.find("div:first"),j.clientPath+"preview-opacity.png")},0),u.find("td.Radio input").bind("click",S),R.quickList&&R.quickList.length>0){for(var T="",O=0;O<R.quickList.length;O++){"string"===e(R.quickList[O]).toString().toLowerCase()&&(R.quickList[O]=new o({hex:R.quickList[O]}));var B=R.quickList[O].val("a"),D=R.quickList[O].val("ahex");!r.alphaSupport&&D&&(D=D.substring(0,6)+"ff");var U=R.quickList[O].val("hex");D||(D="00000000"),T+='<span class="QuickColor" title="#'+D+'" style="background-color:'+(U&&"#"+U||"")+";"+(U?"":"background-image:url("+j.clientPath+"NoColor.png)")+(r.alphaSupport&&B&&B<255?";opacity:"+Sr(B/255,4)+";filter:Alpha(opacity="+Sr(B/2.55,4)+")":"")+'">&nbsp;</span>'}_.call(d,le,j.clientPath+"bar-opacity.png"),le.html(T),le.find(".QuickColor").click(L)}f.call(d,h.color.mode),R.active.bind(g),"function"==typeof c&&R.active.bind(c),R.current.bind(G),r.expandable?(d.icon=i.parents(".Icon:first"),ce=d.icon.find(".Color:first").css({backgroundColor:b&&"#"+b||"transparent"}),ue=d.icon.find(".Alpha:first"),_.call(d,ue,j.clientPath+"bar-opacity.png"),x.call(d,ue,Sr(100*(255-(Ar(s)?0:s.a))/255,4)),de=d.icon.find(".Image:first").css({backgroundImage:"url('"+j.clientPath+j.picker.file+"')"}).bind("click",E),r.bindToInput&&r.updateInputColor&&r.input.css({backgroundColor:b&&"#"+b||"transparent",color:Ar(s)||s.v>75?"#000000":"#ffffff"}),he=u.find(".Move:first").bind("mousedown",I),R.active.bind(P)):M.call(d)}).call(d)},0)})},t.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 o({ahex:"#ffcc00ff"}),quickList:[new o({h:360,s:33,v:100}),new o({h:360,s:66,v:100}),new o({h:360,s:100,v:100}),new o({h:360,s:100,v:75}),new o({h:360,s:100,v:50}),new o({h:180,s:0,v:100}),new o({h:30,s:33,v:100}),new o({h:30,s:66,v:100}),new o({h:30,s:100,v:100}),new o({h:30,s:100,v:75}),new o({h:30,s:100,v:50}),new o({h:180,s:0,v:90}),new o({h:60,s:33,v:100}),new o({h:60,s:66,v:100}),new o({h:60,s:100,v:100}),new o({h:60,s:100,v:75}),new o({h:60,s:100,v:50}),new o({h:180,s:0,v:80}),new o({h:90,s:33,v:100}),new o({h:90,s:66,v:100}),new o({h:90,s:100,v:100}),new o({h:90,s:100,v:75}),new o({h:90,s:100,v:50}),new o({h:180,s:0,v:70}),new o({h:120,s:33,v:100}),new o({h:120,s:66,v:100}),new o({h:120,s:100,v:100}),new o({h:120,s:100,v:75}),new o({h:120,s:100,v:50}),new o({h:180,s:0,v:60}),new o({h:150,s:33,v:100}),new o({h:150,s:66,v:100}),new o({h:150,s:100,v:100}),new o({h:150,s:100,v:75}),new o({h:150,s:100,v:50}),new o({h:180,s:0,v:50}),new o({h:180,s:33,v:100}),new o({h:180,s:66,v:100}),new o({h:180,s:100,v:100}),new o({h:180,s:100,v:75}),new o({h:180,s:100,v:50}),new o({h:180,s:0,v:40}),new o({h:210,s:33,v:100}),new o({h:210,s:66,v:100}),new o({h:210,s:100,v:100}),new o({h:210,s:100,v:75}),new o({h:210,s:100,v:50}),new o({h:180,s:0,v:30}),new o({h:240,s:33,v:100}),new o({h:240,s:66,v:100}),new o({h:240,s:100,v:100}),new o({h:240,s:100,v:75}),new o({h:240,s:100,v:50}),new o({h:180,s:0,v:20}),new o({h:270,s:33,v:100}),new o({h:270,s:66,v:100}),new o({h:270,s:100,v:100}),new o({h:270,s:100,v:75}),new o({h:270,s:100,v:50}),new o({h:180,s:0,v:10}),new o({h:300,s:33,v:100}),new o({h:300,s:66,v:100}),new o({h:300,s:100,v:100}),new o({h:300,s:100,v:75}),new o({h:300,s:100,v:50}),new o({h:180,s:0,v:0}),new o({h:330,s:33,v:100}),new o({h:330,s:66,v:100}),new o({h:330,s:100,v:100}),new o({h:330,s:100,v:75}),new o({h:330,s:100,v:50}),new o]},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 &ldquo;OK&rdquo; 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 &ldquo;Hue&rdquo; Color Mode",textbox:"Enter A &ldquo;Hue&rdquo; Value (0-360&deg;)"},saturation:{radio:"Set To &ldquo;Saturation&rdquo; Color Mode",textbox:"Enter A &ldquo;Saturation&rdquo; Value (0-100%)"},value:{radio:"Set To &ldquo;Value&rdquo; Color Mode",textbox:"Enter A &ldquo;Value&rdquo; Value (0-100%)"},red:{radio:"Set To &ldquo;Red&rdquo; Color Mode",textbox:"Enter A &ldquo;Red&rdquo; Value (0-255)"},green:{radio:"Set To &ldquo;Green&rdquo; Color Mode",textbox:"Enter A &ldquo;Green&rdquo; Value (0-255)"},blue:{radio:"Set To &ldquo;Blue&rdquo; Color Mode",textbox:"Enter A &ldquo;Blue&rdquo; Value (0-255)"},alpha:{radio:"Set To &ldquo;Alpha&rdquo; Color Mode",textbox:"Enter A &ldquo;Alpha&rdquo; Value (0-100)"},hex:{textbox:"Enter A &ldquo;Hex&rdquo; Color Value (#000000-#ffffff)",alpha:"Enter A &ldquo;Alpha&rdquo; Value (#00-#ff)"}}}},t}].reduce(function(e,t){return t(e)},jQuery);Mr.loadingStylesheets.includes("svg-editor.css")||Mr.loadingStylesheets.push("svg-editor.css");Mr.loadingStylesheets.some(function(e){return!Array.isArray(e)||"images/logo.png"!==e[0]})&&Mr.loadingStylesheets.push(["images/logo.png",{favicon:!0}]),Lr.tool_scale=1,Lr.exportWindowCt=0,Lr.langChanged=!1,Lr.showSaveWarning=!1,Lr.storagePromptState="ignore";var Or,jr,Vr=[],Rr={lang:"",iconsize:"",bkgd_color:"#FFF",bkgd_url:"",img_save:"embed",save_notice_done:!1,export_notice_done:!1},Br=["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"],Dr={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,avoidClientSide:!1,avoidClientSideDownload:!1,avoidClientSideOpen:!1},Ur=Lr.uiStrings={},Fr=!1,Hr=!1,zr=!1,qr={},Yr={extensions:[],stylesheets:[],allowedOrigins:[]};function Wr(e){return Xr.apply(this,arguments)}function Xr(){return(Xr=n(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!==Or.setSvgString(t))){e.next=4;break}return e.abrupt("return");case 4:if(r){e.next=8;break}return e.next=7,Mr.alert(Ur.notification.errorLoadingSVG);case 7:return e.abrupt("return");case 8:throw new Error("Error loading SVG");case 9:case"end":return e.stop()}},e)}))).apply(this,arguments)}function Qr(e){var t=e.defaultLang,r=e.defaultName;return function(){var e=n(regeneratorRuntime.mark(function e(){var n,a,i,o,s,l,c=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return l=function(e){return pn("".concat(Yr.extPath,"ext-locale/").concat(i,"/").concat(e,".js"),{global:"svgEditorExtensionLocale_".concat(i,"_").concat(e.replace(/-/g,"_"))})},n=c.length>0&&void 0!==c[0]?c[0]:{},a=n.name,i=void 0===a?r:a,o=n.lang,s=void 0===o?t:o,e.prev=2,e.next=5,l(s);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,null,[[2,8]])}));return function(){return e.apply(this,arguments)}}()}Mr.pref=function(e,t){return t?(qr[e]=t,void(Lr.curPrefs=qr)):e in qr?qr[e]:Rr[e]},Lr.putLocale=Ir,Lr.readLang=Pr,Lr.setStrings=Gr,Lr.loadContentAndPrefs=function(){if(Yr.forceStorage||!Yr.noStorageOnLoad&&document.cookie.match(/(?:^|;\s*)svgeditstore=(?:prefsAndContent|prefsOnly)/)){if(Lr.storage&&(Yr.forceStorage||!Yr.noStorageOnLoad&&document.cookie.match(/(?:^|;\s*)svgeditstore=prefsAndContent/))){var e="svgedit-"+Yr.canvasName,t=Lr.storage.getItem(e);t&&Lr.loadFromString(t)}Object.keys(Rr).forEach(function(e){var t,n="svg-edit-"+e;if(Lr.storage){var r=Lr.storage.getItem(n);r&&(Rr[e]=String(r))}else if(window.widget)Rr[e]=window.widget.preferenceForKey(n);else{var a=document.cookie.match(new RegExp("(?:^|;\\s*)"+(t=encodeURIComponent(n),String(t).replace(new RegExp("[.\\\\+*?\\[\\^\\]$(){}=!<>|:\\-]","g"),"\\$&"))+"=([^;]+)"));Rr[e]=a?decodeURIComponent(a[1]):""}})}},Lr.setConfig=function(t,n){function r(t,n,r){t[n]&&"object"===e(t[n])?Mr.extend(!0,t[n],r):t[n]=r}n=n||{},Mr.each(t,function(a,i){if({}.hasOwnProperty.call(t,a))if({}.hasOwnProperty.call(Rr,a)){if(!1===n.overwrite&&(Yr.preventAllURLConfig||{}.hasOwnProperty.call(qr,a)))return;!0===n.allowInitialUserOverride?Rr[a]=i:Mr.pref(a,i)}else if(["extensions","stylesheets","allowedOrigins"].includes(a)){if(!1===n.overwrite&&(Yr.preventAllURLConfig||["allowedOrigins","stylesheets"].includes(a)||"extensions"===a&&Yr.lockExtensions))return;Yr[a]=Yr[a].concat(i)}else if({}.hasOwnProperty.call(Dr,a)){if(!1===n.overwrite&&(Yr.preventAllURLConfig||{}.hasOwnProperty.call(Yr,a)))return;if({}.hasOwnProperty.call(Yr,a)){if(!1===n.overwrite)return;r(Yr,a,i)}else!0===n.allowInitialUserOverride?r(Dr,a,i):Dr[a]&&"object"===e(Dr[a])?(Yr[a]=Array.isArray(Dr[a])?[]:{},Mr.extend(!0,Yr[a],i)):Yr[a]=i}}),Lr.curConfig=Yr},Lr.setCustomHandlers=function(e){return Lr.ready(function(){e.open&&(Mr('#tool_open > input[type="file"]').remove(),Mr("#tool_open").show(),Or.open=e.open),e.save&&(Lr.showSaveWarning=!1,Or.bind("saved",e.save)),e.exportImage&&(Hr=e.exportImage,Or.bind("exported",Hr)),e.exportPDF&&(zr=e.exportPDF,Or.bind("exportedPDF",zr))})},Lr.randomizeIds=function(e){Or.randomizeIds(e)},Lr.init=function(){!("svgEditor"in window&&window.svgEditor&&!1===window.svgEditor.modules)||Object.assign(Dr,{langPath:"../dist/locale/",extPath:"../dist/extensions/",canvgPath:"../dist/",jspdfPath:"../dist/"});try{"localStorage"in window&&(Lr.storage=localStorage)}catch(e){}var e=[];function t(){(Yr=Mr.extend(!0,{},Dr,Yr)).noDefaultExtensions||(Yr.extensions=Yr.extensions.concat(Br)),["extensions","stylesheets","allowedOrigins"].forEach(function(e){Yr[e]=Mr.grep(Yr[e],function(t,n){return n===Yr[e].indexOf(t)})}),Lr.curConfig=Yr}Mr("#lang_select option").each(function(){e.push(this.value)}),function(){var e,n;if(jr=Mr.deparam.querystring(!0),Mr.isEmptyObject(jr))t(),Lr.loadContentAndPrefs();else{if(jr.dimensions&&(jr.dimensions=jr.dimensions.split(",")),jr.bkgd_color&&(jr.bkgd_color="#"+jr.bkgd_color),jr.extensions&&(jr.extensions=jr.extensions.match(/[:\/\\]/)?"":jr.extensions.split(",")),["langPath","extPath","canvgPath","jspdfPath","imgPath","jGraduatePath","extIconsPath"].forEach(function(e){jr[e]&&delete jr[e]}),Lr.setConfig(jr,{overwrite:!1}),t(),!Yr.preventURLContentLoading){if(e=jr.source,n=Mr.param.querystring(),e||n.includes("source=data:")&&(e=n.match(g(/source=(data:[^&]*)/,{src:1})).groups.src),e)return void(e.startsWith("data:")?Lr.loadFromDataURI(e):Lr.loadFromString(e));if(jr.url)return void Lr.loadFromURL(jr.url)}jr.noStorageOnLoad&&!Yr.forceStorage||Lr.loadContentAndPrefs()}qr=Mr.extend(!0,{},Rr,qr),Lr.curPrefs=qr}();var a=Lr.setIcon=function(e,t,n){var r="string"==typeof t?Mr.getSvgIcon(t,!0):t.clone();r?Mr(e).empty().append(r):console.log("NOTE: Icon image missing: "+t)},o=function(){var t=n(regeneratorRuntime.mark(function t(){var r,a,i,o,s,l;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Lr.putLocale(null,e,Yr);case 2:return r=t.sent,a=r.langParam,i=r.langData,t.next=7,An(a,i);case 7:return o=Ur.common,s=o.ok,l=o.cancel,yn(Mr,{ok:s,cancel:l}),Mr.svgIcons(Yr.imgPath+"svg_edit_icons.svg",{w:24,h:24,id_match:!1,no_img:!D(),fallback_path:Yr.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:function(){var e=n(regeneratorRuntime.mark(function e(t){var n,r,a,i,o,s,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}},Mr(".toolbar_button button > svg, .toolbar_button button > img").each(function(){Mr(this).parent().prepend(this)}),(n=Mr("#tools_left")).length&&(r=n.offset().top+n.outerHeight()),a=Mr.pref("iconsize"),Lr.setIconSize(a||(Mr(window).height()<r?"s":"m")),Mr(".tools_flyout").each(function(){var e=Mr("#"+this.id+"_show"),t=e.attr("data-curopt");if(!e.children("svg, img").length){var n=Mr(t).children().clone();n.length&&(n[0].removeAttribute("style"),e.append(n))}}),o=Mr.loadingStylesheets.sort(function(e,t){var n=i(e),r=i(t);return n===r?0:n>r}),Yr.stylesheets.length&&(o=f(new Set(Yr.stylesheets)),(s=o.indexOf("@default"))>-1&&(l=o).splice.apply(l,[s,1].concat(f(Mr.loadingStylesheets)))),e.next=11,Tr(o,{acceptErrors:function(e){var t=e.stylesheetURL,n=e.reject,r=e.resolve;Mr.loadingStylesheets.includes(t)?n(new Error("Missing expected stylesheet: ".concat(t))):r()}});case 11:return Mr("#svg_container")[0].style.visibility="visible",e.next=14,Lr.runCallbacks();case 14:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()}),t.prev=10,t.next=13,Promise.all(Yr.extensions.map(function(){var e=n(regeneratorRuntime.mark(function e(t){var n,r,i,o,s,l,c;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.match(g(/^ext-(.+)\.js/,{extName:1})).groups.extName){e.next=3;break}return e.abrupt("return",void 0);case 3:return r=Yr.extPath+t,e.prev=4,e.next=7,pn(r,{global:"svgEditorExtension_"+n.replace(/-/g,"_")});case 7:return i=e.sent,o=i.name,s=void 0===o?n:o,l=i.init,c=Qr({defaultLang:a,defaultName:s}),e.abrupt("return",Lr.addExtension(s,l&&l.bind(Lr),{$:Mr,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,null,[[4,13]])}));return function(t){return e.apply(this,arguments)}}()));case 13:Or.bind("extensions_added",function(e,t){Kr=!0,vn.setAll(),Mr(".flyout_arrow_horiz:empty").each(function(){Mr(this).append(Mr.getSvgIcon("arrow_right",!0).width(5).height(5))}),"ignore"===Lr.storagePromptState&&ee(!0),Zr.forEach(function(e){Or.call("message",e)})}),Or.call("extensions_added"),t.next=20;break;case 17:t.prev=17,t.t0=t.catch(10),console.log(t.t0);case 20:case"end":return t.stop()}},t,null,[[10,17]])}));return function(){return t.apply(this,arguments)}}(),s={tool_scale:Lr.tool_scale},l=function(){Mr(".tools_flyout").each(function(){var e=Mr("#"+this.id+"_show"),t=e.offset(),n=t.left,r=t.top,a=e.outerWidth();Mr(this).css({left:(n+a)*Lr.tool_scale,top:r})})},c=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":""}(),u=Lr.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=Mr(t),r=1;if("number"==typeof e)r=e;else{r={s:.75,m:1,l:1.25,xl:1.5}[e]}s.tool_scale=Lr.tool_scale=r,l();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=Mr(this),r=e.outerWidth()*(t-1),a=e.outerHeight()*(t-1),i=0;i<4;i++){var o=n[i],s=e.data("orig_margin-"+o);ln(s)&&(s=parseInt(e.css("margin-"+o)),e.data("orig_margin-"+o,s));var l=s*t;"right"===o?l+=r:"bottom"===o&&(l+=a),e.css("margin-"+o,l)}})}(n,r),a.css("visibility","visible").hide(),Mr.pref("iconsize",e),Mr("#iconsize").val(e);var i={"#tools_top":{left:50+Mr("#main_button").width(),height:72},"#tools_left":{width:31,top:74},"div#workarea":{left:38,top:74}},o=Mr("#tool_size_rules");if(o.length?o.empty():o=Mr('<style id="tool_size_rules"></style>').appendTo("head"),"m"!==e){var u="";Mr.each(i,function(t,n){t="#svg_editor "+t.replace(/,/g,", #svg_editor"),u+=t+"{",Mr.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="-"+c.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+");}",o.text(u)}l()};Lr.canvas=Or=new _r(document.getElementById("svgcanvas"),Yr);var d,h,m=z()?"meta+":"ctrl+",y=Or.pathActions,_=Or.undoMgr,b=Mr("#workarea"),x=Mr("#cmenu_canvas"),w={fill:null,stroke:null},S=null,k=Yr.imgPath+"logo.png",C="crosshair",A="crosshair",E="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 G=function(){var e=Mr(".tool_button_current");e.length&&"tool_select"!==e[0].id&&(e.removeClass("tool_button_current").addClass("tool_button"),Mr("#tool_select").addClass("tool_button_current").removeClass("tool_button"),Mr("#styleoverrides").text("\n #svgcanvas svg * {\n cursor: move;\n pointer-events: all;\n }\n #svgcanvas svg {\n cursor: default;\n }\n ")),Or.setMode("select"),b.css("cursor","auto")},P=Mr("title:first").text(),I=[],N=.1;N<1e5;N*=10)I.push(N),I.push(2*N),I.push(5*N);var T=function(e){var t,n=[],r=Or.getCurrentDrawing().getNumLayers();for(t=0;t<r;t++)n[t]=Or.getCurrentDrawing().getLayerName(t);e?n.forEach(function(t){t!==e&&Or.getCurrentDrawing().setLayerOpacity(t,.5)}):n.forEach(function(e){Or.getCurrentDrawing().setLayerOpacity(e,1)})},L=function(){Or.clearSelection();for(var e=Mr("#layerlist tbody").empty(),t=Mr("#selLayerNames").empty(),n=Or.getCurrentDrawing(),r=n.getCurrentLayerName(),a=Mr.getSvgIcon("eye"),i=Or.getCurrentDrawing().getNumLayers();i--;){var o=n.getLayerName(i),s=Mr('<tr class="layer">').toggleClass("layersel",o===r),l=Mr('<td class="layervis">').toggleClass("layerinvis",!n.getLayerVisibility(o)),c=Mr('<td class="layername">'+o+"</td>");e.append(s.append(l,c)),t.append('<option value="'+o+'">'+o+"</option>")}if(void 0!==a){var u=a.clone();Mr("td.layervis",e).append(u),Mr.resizeSvgIcons({"td.layervis .svg_icon":14})}Mr("#layerlist td.layername").mouseup(function(e){Mr("#layerlist tr.layer").removeClass("layersel"),Mr(this.parentNode).addClass("layersel"),Or.setCurrentLayer(this.textContent),e.preventDefault()}).mouseover(function(){T(this.textContent)}).mouseout(function(){T()}),Mr("#layerlist td.layervis").click(function(){var e=Mr(this.parentNode).prevAll().length,t=Mr("#layerlist tr.layer:eq("+e+") td.layername").text(),n=Mr(this).hasClass("layerinvis");Or.setLayerVisibility(t,n),Mr(this).toggleClass("layerinvis")});for(var d=5-Mr("#layerlist tr.layer").size();d-- >0;)e.append('<tr><td style="color:white">_</td><td/></tr>')},M=!1,O="",j=function(e,t){M||(M=!0,O=Or.getSvgString(),Mr("#save_output_btns").toggle(Boolean(t)),Mr("#tool_source_back").toggle(!t),Mr("#svg_source_textarea").val(O),Mr("#svg_source_editor").fadeIn(),Mr("#svg_source_textarea").focus())},V=null,R=!1,B=function(){window.opera&&Mr("<p/>").hide().appendTo("body").remove()};function Y(e,t){var n=e.id,r=p(n.split("_"),2),i=r[0],o=r[1];t&&Or.setStrokeAttr("stroke-"+i,o),B(),a("#cur_"+i,n,20),Mr(e).addClass("current").siblings().removeClass("current")}var W=Lr.toolButtonClick=function(e,t){if(Mr(e).hasClass("disabled"))return!1;if(Mr(e).parent().hasClass("tools_flyout"))return!0;return t||Mr(".tools_flyout").fadeOut("normal"),Mr("#styleoverrides").text(""),b.css("cursor","auto"),Mr(".tool_button_current").removeClass("tool_button_current").addClass("tool_button"),Mr(e).addClass("tool_button_current").removeClass("tool_button"),!0},X=Lr.clickSelect=function(){W("#tool_select")&&(Or.setMode("select"),Mr("#styleoverrides").text("\n #svgcanvas svg * {\n cursor: move;\n pointer-events: all;\n }\n #svgcanvas svg {\n cursor: default;\n }\n "))},Q=Lr.setImageURL=function(e){e||(e=k),Or.setImageURL(e),Mr("#image_url").val(e),e.startsWith("data:")?(Mr("#image_url").hide(),Mr("#change_image_url").show()):(Or.embedImage(e,function(t){Mr("#url_notice").toggle(!t),k=e}),Mr("#image_url").show(),Mr("#change_image_url").hide())};function K(e,t){Mr.pref("bkgd_color",e),Mr.pref("bkgd_url",t),Or.setBackground(e,t)}function Z(){return $.apply(this,arguments)}function $(){return($=n(regeneratorRuntime.mark(function e(){var t,n,r,a,i,o=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=o.length>0&&void 0!==o[0]?o[0]:{},n=t.cancelDeletes,r=void 0!==n&&n,a=(a=Or.getHref(V)).startsWith("data:")?"":a,e.next=5,Mr.prompt(Ur.notification.enterNewImgURL,a);case 5:(i=e.sent)?Q(i):r&&Or.deleteSelectedElements();case 7:case"end":return e.stop()}},e)}))).apply(this,arguments)}function J(e,t){var n,r;t||(t=Or.getZoom()),e||(e=Mr("#svgcanvas"));var a=Or.getContentElem(),i=oe()[Yr.baseUnit];for(n=0;n<2;n++){var o=0===n,s=o?"x":"y",l=o?"width":"height",c=Number(a.getAttribute(s)),u=Mr("#ruler_"+s+" canvas:first"),d=u.clone();u.replaceWith(d);var h=d[0],p=e[l](),f=p;h.parentNode.style[l]=f+"px";var g=h.getContext("2d"),m=void 0,v=void 0,y=void 0;if(g.fillStyle="rgb(200,0,0)",g.fillRect(0,0,h.width,h.height),d.siblings().remove(),p>=3e4){y=parseInt(p/3e4)+1,(m=[])[0]=g;var _=void 0;for(r=1;r<y;r++)h[l]=3e4,_=h.cloneNode(!0),h.parentNode.append(_),m[r]=_.getContext("2d");_[l]=p%3e4,p=3e4}h[l]=p;var b=i*t,x=50/b,w=1;for(r=0;r<I.length&&(w=v=I[r],!(x<=v));r++);var S=w*b;g.font="9px sans-serif";for(var k=c/b%w*b,C=k-S,A=0;k<f;){C+=S;var E=Math.round(k)+.5;o?(g.moveTo(E,15),g.lineTo(E,0)):(g.moveTo(15,E),g.lineTo(0,E)),v=(C-c)/b;var G=void 0;if(w>=1)G=Math.round(v);else{var P=String(w).split(".")[1].length;G=v.toFixed(P)}if(0!==G&&1e3!==G&&G%1e3==0&&(G=G/1e3+"K"),o)g.fillText(G,k+2,8);else{var N=String(G).split("");for(r=0;r<N.length;r++)g.fillText(N[r],1,k+9+9*r)}var T=S/10;for(r=1;r<10;r++){var L=Math.round(k+T*r)+.5;if(m&&L>p){if(A++,g.stroke(),A>=y){r=10,k=f;continue}g=m[A],k-=3e4,L=Math.round(k+T*r)+.5}var M=r%2?12:10;o?(g.moveTo(L,15),g.lineTo(L,M)):(g.moveTo(15,L),g.lineTo(M,L))}k+=S}g.strokeStyle="#000",g.stroke()}}var ee=Lr.updateCanvas=function(e,t){var n=Or.getZoom(),r=b,a=Mr("#svgcanvas"),i=b.width(),o=b.height(),s=i,l=o,c=r[0].scrollLeft+s/2,u=r[0].scrollTop+l/2,d=Yr.canvas_expansion;i=Math.max(s,Or.contentW*n*d),o=Math.max(l,Or.contentH*n*d),i===s&&o===l?b.css("overflow","hidden"):b.css("overflow","scroll");var h=a.height()/2,p=a.width()/2;a.width(i).height(o);var f=o/2,g=i/2,m=Or.updateCanvas(i,o),v=g/p,y=i/2-s/2,_=o/2-l/2;t?(t.x+=m.x,t.y+=m.y):t={x:g+(c-p)*v,y:f+(u-h)*v};e?Or.contentW>r.width()?(b[0].scrollLeft=m.x-10,b[0].scrollTop=m.y-10):(r[0].scrollLeft=y,r[0].scrollTop=_):(r[0].scrollLeft=t.x-s/2,r[0].scrollTop=t.y-l/2),Yr.showRulers&&(J(a,n),b.scroll()),!0!==jr.storagePrompt&&"ignore"===Lr.storagePromptState&&Mr("#dialog_box").hide()},te=function(){var e="none"===Or.getColor("fill"),t="none"===Or.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){Mr(e).hasClass("tool_button_current")&&X(),Mr(e).addClass("disabled")}):n.forEach(function(e){Mr(e).removeClass("disabled")}),t&&e?r.forEach(function(e){Mr(e).hasClass("tool_button_current")&&X(),Mr(e).addClass("disabled")}):r.forEach(function(e){Mr(e).removeClass("disabled")}),Or.runExtensions("toolButtonStateUpdate",{nofill:e,nostroke:t}),Mr(".tools_flyout").each(function(){var e=Mr("#"+this.id+"_show"),t=!1;Mr(this).children().each(function(){Mr(this).hasClass("disabled")||(t=!0)}),e.toggleClass("disabled",!t)}),B()},ne=function(){var e=V;ln(e)||e.parentNode||(e=null);var t=Or.getCurrentDrawing().getCurrentLayerName(),n=Or.getMode(),r="px"!==Yr.baseUnit?Yr.baseUnit:null,i="pathedit"===n,o=Mr("#cmenu_canvas li");if(Mr("#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(),ln(e))R?(Mr("#multiselected_panel").show(),o.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")):o.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back");else{var s=e.nodeName,l=Or.getRotationAngle(e);Mr("#angle").val(l);var c=Or.getBlur(e);if(Mr("#blur").val(c),Mr("#blur_slider").slider("option","value",c),Or.addedNew&&"image"===s&&"image"===Or.getMode()&&(Or.getHref(e).startsWith("data:")||Z({cancelDeletes:!0})),i||"pathedit"===n){var u=y.getNodePoint();if(Mr("#tool_add_subpath").removeClass("push_button_pressed").addClass("tool_button"),Mr("#tool_node_delete").toggleClass("disabled",!y.canDeleteNodes),a("#tool_openclose_path",y.closed_subpath?"open_path":"close_path"),u){var d=Mr("#seg_type");r&&(u.x=le(u.x),u.y=le(u.y)),Mr("#path_node_x").val(u.x),Mr("#path_node_y").val(u.y),u.type?d.val(u.type).removeAttr("disabled"):d.val(4).attr("disabled","disabled")}return}if(Mr("#selected_panel").show(),["line","circle","ellipse"].includes(s))Mr("#xy_panel").hide();else{var h,p;if(["g","polyline","path"].includes(s)){var f=Or.getStrokedBBox([e]);f&&(h=f.x,p=f.y)}else h=e.getAttribute("x"),p=e.getAttribute("y");r&&(h=le(h),p=le(p)),Mr("#selected_x").val(h||0),Mr("#selected_y").val(p||0),Mr("#xy_panel").show()}var g=!["image","text","path","g","use"].includes(s);Mr("#tool_topath").toggle(g),Mr("#tool_reorient").toggle("path"===s),Mr("#tool_reorient").toggleClass("disabled",0===l);var m={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:[]},v=e.tagName,b=null;if("a"===v&&(b=Or.getHref(e),Mr("#g_panel").show()),"a"===e.parentNode.tagName&&(Mr(e).siblings().length||(Mr("#a_panel").show(),b=Or.getHref(e.parentNode))),Mr("#tool_make_link, #tool_make_link").toggle(!b),b&&Mr("#link_url").val(b),m[v]){var w=m[v];if(Mr("#"+v+"_panel").show(),Mr.each(w,function(t,n){var r=e.getAttribute(n);if("px"!==Yr.baseUnit&&e[n]){var a=e[n].baseVal.value;r=le(a)}Mr("#"+v+"_"+n).val(r||0)}),"text"===v)Mr("#text_panel").css("display","inline"),Mr("#tool_font_size").css("display","inline"),Or.getItalic()?Mr("#tool_italic").addClass("push_button_pressed").removeClass("tool_button"):Mr("#tool_italic").removeClass("push_button_pressed").addClass("tool_button"),Or.getBold()?Mr("#tool_bold").addClass("push_button_pressed").removeClass("tool_button"):Mr("#tool_bold").removeClass("push_button_pressed").addClass("tool_button"),Mr("#font_family").val(e.getAttribute("font-family")),Mr("#font_size").val(e.getAttribute("font-size")),Mr("#text").val(e.textContent),Or.addedNew&&setTimeout(function(){Mr("#text").focus().select()},100);else if("image"===v&&"image"===Or.getMode())Q(Or.getHref(e));else if("g"===v||"use"===v){Mr("#container_panel").show();var S=Or.getTitle(),k=Mr("#g_title")[0];k.value=S,function(e){var t=Math.min(Math.max(12+6*e.value.length,50),300);Mr(e).width(t)}(k),Mr("#g_title").prop("disabled","use"===v)}}o[("g"===v?"en":"dis")+"ableContextMenuItems"]("#ungroup"),o[("g"!==v&&R?"en":"dis")+"ableContextMenuItems"]("#group")}Mr("#tool_undo").toggleClass("disabled",0===_.getUndoStackSize()),Mr("#tool_redo").toggleClass("disabled",0===_.getRedoStackSize()),Or.addedNew=!1,e&&!i||R?(Mr("#selLayerNames").removeAttr("disabled").val(t),x.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")):Mr("#selLayerNames").attr("disabled","disabled")},re=function(){if(!Zt){var e="\n #workarea.wireframe #svgcontent * {\n stroke-width: ".concat(1/Or.getZoom(),"px;\n }\n ");Mr("#wireframe_rules").text(b.hasClass("wireframe")?e:"")}},ae="",ie=function(e){e=e||Or.getDocumentTitle();var t=P+(e?": "+e:"");Mr("title:first").text(t)};var se=function(){re()},ce=Or.zoomChanged=function(e,t,n){var r=b,a=Or.setBBoxZoom(t,r.width()-15,r.height()-15);if(a){var i=a.zoom,o=a.bbox;i<.001?ue({value:.1}):(Mr("#zoom").val((100*i).toFixed(1)),n?ee():ee(!1,{x:o.x*i+o.width*i/2,y:o.y*i+o.height*i/2}),"zoom"===Or.getMode()&&o.width&&G(),se())}},ue=function(e){var t=e.value/100;if(t<.001)e.value=.1;else{var n=Or.getZoom(),r=b;ce(window,{width:0,height:0,x:(r[0].scrollLeft+r.width()/2)/n,y:(r[0].scrollTop+r.height()/2)/n,zoom:t},!0)}};Mr("#cur_context_panel").delegate("a","click",function(){var e=Mr(this);return e.attr("data-root")?Or.leaveContext():Or.setContext(e.text()),Or.clearSelection(),!1});var he=function(){w.fill.prep(),w.stroke.prep()},pe={},fe=function(){Mr(".tools_flyout").each(function(){var e=Mr("#"+this.id+"_show");if(!e.data("isLibrary")){var t=Mr(this).children().map(function(){return this.title}).get();e[0].title=t.join(" / ")}})},ge={},me=function(e){Mr.each(e,function(t,n){var r;ge[t]||(ge[t]=[]),(r=ge[t]).push.apply(r,f(n));var a,i=Mr(t).children().not(".tool_button_evt_handled"),o=t+"_show",s=Mr(o),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=p(e,2);n[0];return n[1].sel===t}),a=p(r,2),i=a[0],c=a[1];pe[c.sel]=c.fn,c.isDefault&&(l=i);var u=function(t){var n,r=c;if("keydown"===t.type){var a=Mr(r.parent+"_show").hasClass("tool_button_current"),i=Mr(r.parent+"_show").attr("data-curopt");Object.entries(e[c.parent]).some(function(n){var o=p(n,2),s=o[0],l=o[1];return l.sel===i&&(t.shiftKey&&a?(s=parseInt(s),r=ge[c.parent][s+1]||e[c.parent][0]):r=l,!0)})}return!Mr(this).hasClass("disabled")&&(W(o)&&r.fn(),(n=r.icon?Mr.getSvgIcon(r.icon,!0):Mr(r.sel).children().eq(0).clone())[0].setAttribute("width",s.width()),n[0].setAttribute("height",s.height()),s.children(":not(.flyout_arrow_horiz)").remove(),s.append(n).attr("data-curopt",r.sel),!0)};return Mr(this).mouseup(u),c.key&&Mr(document).bind("keydown",c.key[0]+" shift+"+c.key[0],u),!0}),l?s.attr("data-curopt",n[l].sel):s.attr("data-curopt")||s.attr("data-curopt",n[0].sel);var c=Mr(o).position();s.mousedown(function(e){if(s.hasClass("disabled"))return!1;var n=Mr(t),r=c.left+34,i=-1*n.width(),o=n.data("shown_popop")?200:0;return a=setTimeout(function(){s.data("isLibrary")?n.css("left",r).show():n.css("left",i).show().animate({left:r},150),n.data("shown_popop",!0)},o),e.preventDefault(),!0}).mouseup(function(e){clearTimeout(a);var t=Mr(this).attr("data-curopt");s.data("isLibrary")&&Mr(o.replace("_show","")).is(":visible")?W(o,!0):W(o)&&pe[t]&&pe[t]()})}),fe(),l()},ve=function(e,t){return Mr("<div>",{class:"tools_flyout",id:e}).appendTo("#svg_editor").append(t)},ye=function(e,t,n,r){var i=Mr(e),o=r.dropUp,s=Mr(t);o&&Mr(e).addClass("dropup"),s.find("li").bind("mouseup",function(){r.seticon&&(a("#cur_"+i[0].id,Mr(this).children()),Mr(this).addClass("current").siblings().removeClass("current"));for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];n.apply.apply(n,[this].concat(t))});var l=!1;Mr(window).mouseup(function(e){l||(i.removeClass("down"),s.hide(),s.css({top:0,left:0})),l=!1}),i.bind("mousedown",function(){var e=i.offset();o?(e.top-=s.height(),e.left+=8):e.top+=i.height(),s.offset(e),i.hasClass("down")?(s.hide(),s.css({top:0,left:0})):(s.show(),l=!0),i.toggleClass("down")}).hover(function(){l=!0}).mouseout(function(){l=!1}),r.multiclick&&s.mousedown(function(){l=!0})},_e=[],be=function(){var e=n(regeneratorRuntime.mark(function e(t,n){var r,a,i,o,s,l,c,h,p,f,g;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(o=function(){d&&(clearTimeout(d),d=null),a||(d=setTimeout(function(){a=!0,u(Mr.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(!Lr.langChanged){e.next=13;break}return i=Mr.pref("lang"),e.next=10,n.langReady({lang:i,uiStrings:Ur,importLocale:Qr({defaultLang:i,defaultName:n.name})});case 10:Cn.push(n.name),e.next=14;break;case 13:_e.push(n);case 14:if(s=function(){n.callback&&!r&&(r=!0,n.callback.call(Lr))},l=[],n.context_tools&&Mr.each(n.context_tools,function(e,t){var n,r=t.container_id?' id="'+t.container_id+'"':"",a=Mr("#"+t.panel);switch(a.length||(a=Mr("<div>",{id:t.panel}).appendTo("#tools_top")),t.type){case"tool_button":n='<div class="tool_button">'+t.id+"</div>";var i=Mr(n).appendTo(a);t.events&&Mr.each(t.events,function(e,t){Mr(i).bind(e,t)});break;case"select":n="<label"+r+'><select id="'+t.id+'">',Mr.each(t.options,function(e,r){var a=e===t.defval?" selected":"";n+='<option value="'+e+'"'+a+">"+r+"</option>"});var o=Mr(n+="</select></label>").appendTo(a).find("select");Mr.each(t.events,function(e,t){Mr(o).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 s=Mr('<ul id="'+t.id+'_opts"></ul>').appendTo("#option_lists");t.colnum&&s.addClass("optcols"+t.colnum),Mr(n).appendTo(a).children(),l.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 c=Mr(n).appendTo(a).find("input");t.spindata&&c.SpinButton(t.spindata),t.events&&Mr.each(t.events,function(e,t){c.bind(e,t)})}}),c=n.svgicons,!n.buttons){e.next=24;break}if(h={},p={},f={},g={},Mr.each(n.buttons,function(e,t){for(var n,r,a,i,o,s,l,u=t.id,d=e;Mr("#"+u).length;)u=t.id+"_"+ ++d;if(c){h[u]=t.icon,p[u]=t.title;var m=t.svgicon||t.id;"app_menu"===t.type?f["#"+u+" > div"]=m:f["#"+u]=m}else n=Mr('<img src="'+t.icon+(t.title?'" alt="'+t.title:"")+'">');switch(t.type){case"mode_flyout":case"mode":r="tool_button",a="#tools_left";break;case"context":r="tool_button",a="#"+t.panel,Mr(a).length||Mr("<div>",{id:t.panel}).appendTo("#tools_top");break;case"app_menu":r="",a="#main_menu ul"}var v,y=Mr(t.list||"app_menu"===t.type?"<li/>":"<div/>").attr("id",u).attr("title",t.title).addClass(r);if(t.includeWith||t.list){if(t.list){if(y.addClass("push_button"),Mr("#"+t.list+"_opts").append(y),t.isDefault){Mr("#cur_"+t.list).append(y.children().clone());var _=t.svgicon||t.id;f["#cur_"+t.list]=_}}else if(t.includeWith){var b,x=t.includeWith;i=(l=Mr(x.button)).parent(),l.parent().hasClass("tools_flyout")||(b=l[0].id.replace("tool_","tools_"),o=l.clone().attr("id",b+"_show").append(Mr("<div>",{class:"flyout_arrow_horiz"})),l.before(o),i=ve(b,l)),s=vn.getButtonData(x.button),x.isDefault&&(f["#"+b+"_show"]=t.id);var w=g["#"+i[0].id]=[{sel:"#"+u,fn:t.events.click,icon:t.id,key:t.key,isDefault:Boolean(t.includeWith&&t.includeWith.isDefault)},s],S="position"in x?x.position:"last",k=i.children().length;!isNaN(S)&&S>=0&&S<k?i.children().eq(S).before(y):(i.append(y),w.reverse())}}else"position"in t?Mr(a).children().eq(t.position).length?Mr(a).children().eq(t.position).before(y):Mr(a).children().last().after(y):y.appendTo(a),"mode_flyout"===t.type?(i=(l=Mr(y)).parent(),l.parent().hasClass("tools_flyout")||(v=l[0].id.replace("tool_","tools_"),o=l.clone().attr("id",v+"_show").append(Mr("<div>",{class:"flyout_arrow_horiz"})),l.before(o),(i=ve(v,l)).data("isLibrary",!0),o.data("isLibrary",!0)),f["#"+v+"_show"]=t.id,g["#"+i[0].id]=[{sel:"#"+u,fn:t.events.click,icon:t.id,isDefault:!0}]):"app_menu"===t.type&&y.append("<div>").append(t.title);c||y.append(n),t.list||Mr.each(t.events,function(e,n){"click"===e&&"mode"===t.type?(q()&&"click"===e&&(e="mousedown"),t.includeWith?y.bind(e,n):y.bind(e,function(){W(y)&&n()}),t.key&&(Mr(document).bind("keydown",t.key,n),t.title&&y.attr("title",t.title+" ["+t.key+"]"))):y.bind(e,n)}),me(g)}),Mr.each(l,function(){ye(this.elem,this.list,this.callback,{seticon:!0})}),!c){e.next=24;break}return e.abrupt("return",new Promise(function(e,t){Mr.svgIcons(c,{w:24,h:24,id_match:!1,no_img:!D(),fallback:h,placement:f,callback:function(t){"m"!==Mr.pref("iconsize")&&o(),s(),e()}})}));case 24:return e.abrupt("return",s());case 25:case"end":return e.stop()}},e)}));return function(t,n){return e.apply(this,arguments)}}();Or.bind("selected",function(e,t){var n=Or.getMode();"select"===n&&G();var r="pathedit"===n;V=1===t.length||ln(t[1])?t[0]:null,R=t.length>=2&&!ln(t[1]),ln(V)||r||function(){var e,t;if(!ln(V))switch(V.tagName){case"use":case"image":case"foreignObject":break;case"g":case"a":var n=V.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)}Mr("#stroke_width").val(null===r?"":r),w.fill.update(!0),w.stroke.update(!0);break;default:w.fill.update(!0),w.stroke.update(!0),Mr("#stroke_width").val(V.getAttribute("stroke-width")||1),Mr("#stroke_style").val(V.getAttribute("stroke-dasharray")||"none");var i=V.getAttribute("stroke-linejoin")||"miter";Mr("#linejoin_"+i).length&&Y(Mr("#linejoin_"+i)[0]),i=V.getAttribute("stroke-linecap")||"butt",Mr("#linecap_"+i).length&&Y(Mr("#linecap_"+i)[0])}if(!ln(V)){var o=100*(V.getAttribute("opacity")||1);Mr("#group_opacity").val(o),Mr("#opac_slider").slider("option","value",o),Mr("#elem_id").val(V.id),Mr("#elem_class").val(V.getAttribute("class"))}te()}(),function(e,t){Mr("#path_node_panel").toggle(e),Mr("#tools_bottom_2,#tools_bottom_3").toggle(!e),e?(Mr(".tool_button_current").removeClass("tool_button_current").addClass("tool_button"),Mr("#tool_select").addClass("tool_button_current").removeClass("tool_button"),a("#tool_select","select_node"),R=!1,t.length&&(V=t[0])):setTimeout(function(){a("#tool_select","select")},1e3)}(r,t),ne(),Or.runExtensions("selectedChanged",{elems:t,selectedElement:V,multiselected:R})}),Or.bind("transition",function(e,t){var n=Or.getMode(),r=t[0];if(r){if(!(R=t.length>=2&&!ln(t[1])))switch(n){case"rotate":var a=Or.getRotationAngle(r);Mr("#angle").val(a),Mr("#tool_reorient").toggleClass("disabled",0===a)}Or.runExtensions("elementTransition",{elems:t})}}),Or.bind("changed",function(e,t){var n=Or.getMode();"select"===n&&G(),t.forEach(function(e){var t=e&&"svg"===e.tagName;t||function(e){return e&&"g"===e.tagName&&bn.CLASS_REGEX.test(e.getAttribute("class"))}(e)?(L(),t&&ee()):e&&V&&ln(V.parentNode)&&(V=e)}),Lr.showSaveWarning=!0,ne(),V&&"select"===n&&(w.fill.update(),w.stroke.update()),Or.runExtensions("elementChanged",{elems:t})}),Or.bind("saved",function(e,t){if(Lr.showSaveWarning=!1,t='<?xml version="1.0"?>\n'+t,F())j(0,!0);else{var n=document.createElement("a");n.href="data:image/svg+xml;base64,"+Gt(t),n.download="icon.svg",n.style="display: none;",document.body.append(n),n.click();var r=Mr.pref("save_notice_done");if("all"!==r){var a=Ur.notification.saveFromBrowser.replace("%s","SVG");U()?t.includes("<defs")?(a+="\n\n"+Ur.notification.defsFailOnSave,Mr.pref("save_notice_done","all"),r="all"):Mr.pref("save_notice_done","part"):Mr.pref("save_notice_done","all"),"part"!==r&&Mr.alert(a)}}}),Or.bind("exported",function(e,t){var n=t.issues,r=t.exportWindowName;if((S=window.open(Mt||"",r))&&!S.closed){if(S.location.href=t.bloburl||t.datauri,"all"!==Mr.pref("export_notice_done")){var a=Ur.notification.saveFromBrowser.replace("%s",t.type);n.length&&(a+="\n\n"+Ur.notification.noteTheseIssues+"\n • "+n.join("\n • ")),Mr.pref("export_notice_done","all"),S.alert(a)}}else Mr.alert(Ur.notification.popupWindowBlocked)}),Or.bind("exportedPDF",function(e,t){if(t.output){var n=t.exportWindowName;n&&(S=window.open("",n)),S&&!S.closed?S.location.href=t.output:Mr.alert(Ur.notification.popupWindowBlocked)}}),Or.bind("zoomed",ce),Or.bind("zoomDone",se),Or.bind("updateCanvas",function(e,t){var n=t.center,r=t.newCtr;ee(n,r)}),Or.bind("contextset",function(e,t){var n="";if(t){var r="";n='<a href="#" data-root="y">'+Or.getCurrentDrawing().getCurrentLayerName()+"</a>",Mr(t).parentsUntil("#svgcontent > g").andSelf().each(function(){this.id&&(r+=" > "+this.id,n+=this!==t?' > <a href="#">'+this.id+"</a>":" > "+this.id)}),ae=r}else ae=null;Mr("#cur_context_panel").toggle(Boolean(t)).html(n),ie()}),Or.bind("extension_added",be),Or.textActions.setInputElem(Mr("#text")[0]);var xe='<div class="palette_item" data-rgb="none"></div>';Mr.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){xe+='<div class="palette_item" style="background-color: '+t+';" data-rgb="'+t+'"></div>'}),Mr("#palette").append(xe);xe="",Mr.each(["#FFF","#888","#000"],function(){xe+='<div class="color_block" style="background-color:'+this+';"></div>'}),Mr("#bg_blocks").append(xe);var we=Mr("#bg_blocks div"),Se="cur_background";we.each(function(){Mr(this).click(function(){we.removeClass(Se),Mr(this).addClass(Se)})}),K(Mr.pref("bkgd_color"),Mr.pref("bkgd_url")),Mr("#image_save_opts input").val([Mr.pref("img_save")]);var ke=function(e,t){ln(t)&&(t=e.value),Mr("#group_opacity").val(t),e&&e.handle||Mr("#opac_slider").slider("option","value",t),Or.setOpacity(t/100)},Ce=function(e,t,n){ln(t)&&(t=e.value),Mr("#blur").val(t);var r=!1;e&&e.handle||(Mr("#blur_slider").slider("option","value",t),r=!0),n?Or.setBlurNoUndo(t):Or.setBlur(t,r)};Mr("#stroke_style").change(function(){Or.setStrokeAttr("stroke-dasharray",Mr(this).val()),B()}),Mr("#stroke_linejoin").change(function(){Or.setStrokeAttr("stroke-linejoin",Mr(this).val()),B()}),Mr("select").change(function(){Mr(this).blur()});var Ae,Ee,Ge,Pe,Ie,Ne=!1;Mr("#selLayerNames").change(n(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=Ur.notification.QmoveElemsToLayer.replace("%s",t),r=function(e){e&&(Ne=!0,Or.moveSelectedToLayer(t),Or.clearSelection(),L())},!t){e.next=14;break}if(!Ne){e.next=8;break}r(!0),e.next=14;break;case 8:return e.next=10,Mr.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)}))),Mr("#font_family").change(function(){Or.setFontFamily(this.value)}),Mr("#seg_type").change(function(){Or.setSegType(Mr(this).val())}),Mr("#text").bind("keyup input",function(){Or.setTextContent(this.value)}),Mr("#image_url").change(function(){Q(this.value)}),Mr("#link_url").change(function(){this.value.length?Or.setLinkURL(this.value):Or.removeHyperlink()}),Mr("#g_title").change(function(){Or.setGroupTitle(this.value)}),Mr(".attr_changer").change(function(){var e=this.getAttribute("data-attr"),t=this.value;if(!de(e,t,V))return this.value=V.getAttribute(e),Mr.alert(Ur.notification.invalidAttrValGiven),!1;if("id"!==e&&"class"!==e)if(isNaN(t))t=Or.convertToNum(e,t);else if("px"!==Yr.baseUnit){var n=oe();(V[e]||"pathedit"===Or.getMode()||"x"===e||"y"===e)&&(t*=n[Yr.baseUnit])}if("id"===e){var r=V;Or.clearSelection(),r.id=t,Or.addToSelection([r],!0)}else Or.changeSelectedAttribute(e,t);return this.blur(),!0}),Mr("#palette").mouseover(function(){var e=Mr('<input type="hidden">');Mr(this).append(e),e.focus().remove()}),Mr(".palette_item").mousedown(function(e){var t,n=e.shiftKey||2===e.button?"stroke":"fill",r=Mr(this).data("rgb");"none"===r||"transparent"===r||"initial"===r?(r="none",t=new Mr.jGraduate.Paint):t=new Mr.jGraduate.Paint({alpha:100,solidColor:r.substr(1)}),w[n].setPaint(t),Or.setColor(n,r),"none"!==r&&1!==Or.getPaintOpacity(n)&&Or.setPaintOpacity(n,1),te()}).bind("contextmenu",function(e){e.preventDefault()}),Mr("#toggle_stroke_tools").on("click",function(){Mr("#tools_bottom").toggleClass("expanded")}),Ae=b[0],Ee=null,Ge=null,Pe=!1,Ie=!1,Mr("#svgcanvas").bind("mousemove mouseup",function(e){return!1===Pe||(Ae.scrollLeft-=e.clientX-Ee,Ae.scrollTop-=e.clientY-Ge,Ee=e.clientX,Ge=e.clientY,"mouseup"===e.type&&(Pe=!1),!1)}).mousedown(function(e){return 1!==e.button&&!0!==Ie||(Pe=!0,Ee=e.clientX,Ge=e.clientY,!1)}),Mr(window).mouseup(function(){Pe=!1}),Mr(document).bind("keydown","space",function(e){Or.spaceKey=Ie=!0,e.preventDefault()}).bind("keyup","space",function(e){e.preventDefault(),Or.spaceKey=Ie=!1}).bind("keydown","shift",function(e){"zoom"===Or.getMode()&&b.css("cursor",A)}).bind("keyup","shift",function(e){"zoom"===Or.getMode()&&b.css("cursor",C)}),Lr.setPanning=function(e){Or.spaceKey=Ie=e},function(){var e=Mr("#main_icon"),t=Mr("#main_icon span"),n=Mr("#main_menu"),r=!1,a=0,i=!0,o=!1;Mr(window).mouseup(function(t){r||(e.removeClass("buttondown"),"INPUT"!==t.target.tagName?n.fadeOut(200):o||(o=!0,Mr(t.target).click(function(){n.css("margin-left","-9999px").show()}))),r=!1}).mousedown(function(e){Mr(e.target).closest("div.tools_flyout, .contextMenu").length||Mr(".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 s=Mr("#main_menu li");s.mouseover(function(){i="rgba(0, 0, 0, 0)"===Mr(this).css("background-color"),s.unbind("mouseover"),i&&s.mouseover(function(){this.style.backgroundColor="#FFC"}).mouseout(function(){return this.style.backgroundColor="transparent",!0})})}(),Lr.addDropDown=function(e,t,n){if(Mr(e).length){var r=Mr(e).find("button"),a=Mr(e).find("ul").attr("id",Mr(e)[0].id+"-list");n?Mr(e).addClass("dropup"):Mr("#option_lists").append(a),a.find("li").bind("mouseup",t);var i=!1;Mr(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=Mr(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})}},Lr.addDropDown("#font_family_dropdown",function(){Mr("#font_family").val(Mr(this).text()).change()}),Lr.addDropDown("#opacity_dropdown",function(){if(!Mr(this).find("div").length){var e=parseInt(Mr(this).text().split("%")[0]);ke(!1,e)}},!0),Mr("#opac_slider").slider({start:function(){Mr("#opacity_dropdown li:not(.special)").hide()},stop:function(){Mr("#opacity_dropdown li").show(),Mr(window).mouseup()},slide:function(e,t){ke(t)}}),Lr.addDropDown("#blur_dropdown",Mr.noop);var Te,Le,Me=!1;Mr("#blur_slider").slider({max:10,step:.1,stop:function(e,t){Me=!1,Ce(t),Mr("#blur_dropdown li").show(),Mr(window).mouseup()},start:function(){Me=!0},slide:function(e,t){Ce(t,null,Me)}}),Lr.addDropDown("#zoom_dropdown",function(){var e=Mr(this),t=e.data("val");t?ce(window,t):ue({value:parseFloat(e.text())})},!0),ye("#stroke_linecap","#linecap_opts",function(){Y(this,!0)},{dropUp:!0}),ye("#stroke_linejoin","#linejoin_opts",function(){Y(this,!0)},{dropUp:!0}),ye("#tool_position","#position_opts",function(){var e=this.id.replace("tool_pos","").charAt(0);Or.alignSelectedElements(e,"page")},{multiclick:!0}),Le=function(){Mr(Te).blur()},Mr("#svg_editor").find("button, select, input:not(#text)").focus(function(){Te=this,E="toolbars",b.mousedown(Le)}).blur(function(){E="canvas",b.unbind("mousedown",Le),"textedit"===Or.getMode()&&Mr("#text").focus()});var Oe,je=function(){W("#tool_fhpath")&&Or.setMode("fhpath")},Ve=function(){W("#tool_line")&&Or.setMode("line")},Re=function(){W("#tool_square")&&Or.setMode("square")},Be=function(){W("#tool_rect")&&Or.setMode("rect")},De=function(){W("#tool_fhrect")&&Or.setMode("fhrect")},Ue=function(){W("#tool_circle")&&Or.setMode("circle")},Fe=function(){W("#tool_ellipse")&&Or.setMode("ellipse")},He=function(){W("#tool_fhellipse")&&Or.setMode("fhellipse")},ze=function(){W("#tool_image")&&Or.setMode("image")},qe=function(){W("#tool_zoom")&&(Or.setMode("zoom"),b.css("cursor",C))},Ye=function(e){var t=Or.getResolution();e=e?t.zoom*e:1,Mr("#zoom").val(100*e),Or.setZoom(e),se(),ee(!0)},We=function(){W("#tool_zoom")&&(Ye(),G())},Xe=function(){W("#tool_text")&&Or.setMode("text")},Qe=function(){W("#tool_path")&&Or.setMode("path")},Ke=function(){ln(V)&&!R||Or.deleteSelectedElements()},Ze=function(){ln(V)&&!R||Or.cutSelectedElements()},$e=function(){ln(V)&&!R||Or.copySelectedElements()},Je=function(){var e=Or.getZoom(),t=(b[0].scrollLeft+b.width()/2)/e-Or.contentW,n=(b[0].scrollTop+b.height()/2)/e-Or.contentH;Or.pasteElements("point",t,n)},et=function(){ln(V)||Or.moveToTopSelectedElement()},tt=function(){ln(V)||Or.moveToBottomSelectedElement()},nt=function(e){ln(V)||Or.moveUpDownSelected(e)},rt=function(){ln(V)||Or.convertToPath()},at=function(){ln(V)||y.reorient()},it=function(){var e=n(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(ln(V)&&!R){e.next=5;break}return e.next=3,Mr.prompt(Ur.notification.enterNewLinkURL,"http://");case 3:(t=e.sent)&&Or.makeHyperlink(t);case 5:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),ot=function(e,t){if(!ln(V)||R){if(Yr.gridSnapping){var n=Or.getZoom()*Yr.snappingStep;e*=n,t*=n}Or.moveSelectedElements(e,t)}},st=function(){Mr("#tool_node_link").toggleClass("push_button_pressed tool_button");var e=Mr("#tool_node_link").hasClass("push_button_pressed");y.linkControlPoints(e)},lt=function(){y.getNodePoint()&&y.clonePathNode()},ct=function(){y.getNodePoint()&&y.deletePathNode()},ut=function(){var e=Mr("#tool_add_subpath"),t=!e.hasClass("push_button_pressed");e.toggleClass("push_button_pressed tool_button"),y.addSubPath(t)},dt=function(){y.opencloseSubPath()},ht=function(){Or.cycleElement(1)},pt=function(){Or.cycleElement(0)},ft=function(e,t){if(!ln(V)&&!R){e||(t*=-1);var n=parseFloat(Mr("#angle").val())+t;Or.setRotationAngle(n),ne()}},gt=function(){var e=n(regeneratorRuntime.mark(function e(){var t,n,r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=p(Yr.dimensions,2),n=t[0],r=t[1],e.next=3,Mr.confirm(Ur.notification.QwantToClear);case 3:if(e.sent){e.next=6;break}return e.abrupt("return");case 6:G(),Or.clear(),Or.setResolution(n,r),ee(!0),Ye(),L(),ne(),he(),Or.runExtensions("onNewDocument");case 15:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),mt=function(){return Or.setBold(!Or.getBold()),ne(),!1},vt=function(){return Or.setItalic(!Or.getItalic()),ne(),!1},yt=function(){var e=n(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=Ur.notification.loadingImage;if("new"===Yr.exportWindowType&&Lr.exportWindowCt++,n=Yr.canvasName+Lr.exportWindowCt,Oe)t=Oe;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,"+Gt(e);Oe=t}S=window.open(t,n)},e.next=3,Mr.select("Select an image type for export: ",["PNG","JPEG","BMP","WEBP","PDF"],function(){var e=Mr(this);"JPEG"===e.val()||"WEBP"===e.val()?Mr("#image-slider").length||Mr("<div><label>".concat(Ur.ui.quality,'\n <input id="image-slider"\n type="range" min="1" max="100" value="92" />\n </label></div>')).appendTo(e.parent()):Mr("#image-slider").parent().remove()});case 3:if(t=e.sent){e.next=6;break}return e.abrupt("return");case 6:if(a=H(),"PDF"!==t){e.next=12;break}zr||a||r(),Or.exportPDF(n),e.next=16;break;case 12:return Hr||r(),i=parseInt(Mr("#image-slider").val())/100,e.next=16,Or.rasterExport(t,i,n);case 16:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),_t=function(){Or.open()},bt=function(){},xt=function(){_.getUndoStackSize()>0&&(_.undo(),L())},wt=function(){_.getRedoStackSize()>0&&(_.redo(),L())},St=function(){R?Or.groupSelectedElements():V&&Or.ungroupSelectedElement()},kt=function(){Or.cloneSelectedElements(20,20)},Ct=function(){var e=this.id.replace("tool_align","").charAt(0);Or.alignSelectedElements(e,Mr("#align_relative_to").val())},At=function(){if(Mr("#tool_wireframe").toggleClass("push_button_pressed tool_button"),b.toggleClass("wireframe"),!Zt){var e=Mr("#wireframe_rules");e.length?e.empty():Mr('<style id="wireframe_rules"></style>').appendTo("head"),re()}};Mr("#svg_docprops_container, #svg_prefs_container").draggable({cancel:"button,fieldset",containment:"window"}).css("position","absolute");var Et,Pt,It=!1,Nt=!1,Tt=function(){if(!It){It=!0,Mr("#image_save_opts input").val([Mr.pref("img_save")]);var e=Or.getResolution();"px"!==Yr.baseUnit&&(e.w=le(e.w)+Yr.baseUnit,e.h=le(e.h)+Yr.baseUnit),Mr("#canvas_width").val(e.w),Mr("#canvas_height").val(e.h),Mr("#canvas_title").val(Or.getDocumentTitle()),Mr("#svg_docprops").show()}},Lt=function(){Mr("#svg_source_editor").hide(),M=!1,Mr("#svg_source_textarea").blur()},Ot=function(){var e=n(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(M){e.next=2;break}return e.abrupt("return");case 2:if(t=function(){Or.clearSelection(),Lt(),Ye(),L(),ie(),he()},Or.setSvgString(Mr("#svg_source_textarea").val())){e.next=11;break}return e.next=6,Mr.confirm(Ur.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(),G();case 13:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),jt=function(){Mr("#svg_docprops").hide(),Mr("#canvas_width,#canvas_height").removeAttr("disabled"),Mr("#resolution")[0].selectedIndex=0,Mr("#image_save_opts input").val([Mr.pref("img_save")]),It=!1},Vt=function(){Mr("#svg_prefs").hide(),Nt=!1},Rt=function(){var e=Mr("#canvas_title").val();ie(e),Or.setDocumentTitle(e);var t=Mr("#canvas_width"),n=t.val(),r=Mr("#canvas_height"),a=r.val();return"fit"===n||de("width",n)?(t.parent().removeClass("error"),"fit"===a||de("height",a)?(r.parent().removeClass("error"),Or.setResolution(n,a)?(Mr.pref("img_save",Mr("#image_save_opts :checked").val()),ee(),jt(),!0):(Mr.alert(Ur.notification.noContentToFitTo),!1)):(r.parent().addClass("error"),Mr.alert(Ur.notification.invalidAttrValGiven),!1)):(t.parent().addClass("error"),Mr.alert(Ur.notification.invalidAttrValGiven),!1)},Bt=Lr.savePreferences=n(regeneratorRuntime.mark(function t(){var n,r,a,i;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(K(Mr("#bg_blocks div.cur_background").css("background-color")||"#FFF",Mr("#canvas_bg_url").val()),(n=Mr("#lang_select").val())===Mr.pref("lang")){t.next=11;break}return t.next=6,Lr.putLocale(n,e,Yr);case 6:return r=t.sent,a=r.langParam,i=r.langData,t.next=11,An(a,i);case 11:u(Mr("#iconsize").val()),Yr.gridSnapping=Mr("#grid_snapping_on")[0].checked,Yr.snappingStep=Mr("#grid_snapping_step").val(),Yr.gridColor=Mr("#grid_color").val(),Yr.showRulers=Mr("#show_rulers")[0].checked,Mr("#rulers").toggle(Yr.showRulers),Yr.showRulers&&J(),Yr.baseUnit=Mr("#base_unit").val(),Or.setConfig(Yr),ee(),Vt();case 22:case"end":return t.stop()}},t)})),Dt=Mr.noop,Ut=function(){var e=n(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(Mr("#dialog_box").hide(),M||It||Nt){e.next=4;break}return ae&&Or.leaveContext(),e.abrupt("return");case 4:if(!M){e.next=15;break}if(O===Mr("#svg_source_textarea").val()){e.next=12;break}return e.next=8,Mr.confirm(Ur.notification.QignoreSourceChanges);case 8:e.sent&&Lt(),e.next=13;break;case 12:Lt();case 13:e.next=16;break;case 15:It?jt():Nt&&Vt();case 16:Dt();case 17:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}(),Ft={width:Mr(window).width(),height:Mr(window).height()};if(F()&&(Dt=function(){0===b[0].scrollLeft&&0===b[0].scrollTop&&(b[0].scrollLeft=h.left,b[0].scrollTop=h.top)},h={left:b[0].scrollLeft,top:b[0].scrollTop},Mr(window).resize(Dt),Lr.ready(function(){return new Promise(function(e,t){setTimeout(function(){Dt(),e()},500)})}),b.scroll(function(){h={left:b[0].scrollLeft,top:b[0].scrollTop}})),Mr(window).resize(function(e){Mr.each(Ft,function(e,t){var n=Mr(window)[e]();b[0]["scroll"+("width"===e?"Left":"Top")]-=(n-t)/2,Ft[e]=n}),l()}),b.scroll(function(){Mr("#ruler_x").length&&(Mr("#ruler_x")[0].scrollLeft=b[0].scrollLeft),Mr("#ruler_y").length&&(Mr("#ruler_y")[0].scrollTop=b[0].scrollTop)}),Mr("#url_notice").click(function(){Mr.alert(this.title)}),Mr("#change_image_url").click(Z),Et="tool_button_current",Pt="",Mr.each(["clear","open","save","source","delete","delete_multi","paste","clone","clone_multi","move_top","move_bottom"],function(e,t){Pt+=(e?",":"")+"#tool_"+t}),Mr(Pt).mousedown(function(){Mr(this).addClass(Et)}).bind("mousedown mouseout",function(){Mr(this).removeClass(Et)}),Mr("#tool_undo, #tool_redo").mousedown(function(){Mr(this).hasClass("disabled")||Mr(this).addClass(Et)}).bind("mousedown mouseout",function(){Mr(this).removeClass(Et)}),z()&&!window.opera)for(var Ht=["tool_clear","tool_save","tool_source","tool_undo","tool_redo","tool_clone"],zt=Ht.length;zt--;){var qt=document.getElementById(Ht[zt]);if(qt){var Yt=qt.title,Wt=Yt.indexOf("Ctrl+");qt.title=[Yt.substr(0,Wt),"Cmd+",Yt.substr(Wt+5)].join("")}}var Xt=function(e){var t="stroke_color"===e.attr("id")?"stroke":"fill",n="stroke"===t?Ur.ui.pick_stroke_paint_opacity:Ur.ui.pick_fill_paint_opacity,r=e.offset(),a=w[t].paint;Mr("#color_picker").draggable({cancel:".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker",containment:"window"}).css(Yr.colorPickerCSS||{left:r.left-140,bottom:40}).jGraduate({paint:a,window:{pickerTitle:n},images:{clientPath:Yr.jGraduatePath},newstop:"inverse"},function(e){a=new Mr.jGraduate.Paint(e),w[t].setPaint(a),Or.setPaint(t,a),Mr("#color_picker").hide()},function(){Mr("#color_picker").hide()})},Qt=function(){function e(t,n){r(this,e);var a=Yr["fill"===n?"initFill":"initStroke"],i=(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg">\n <rect width="16.5" height="16.5"\n fill="#'.concat(a.color,'" opacity="').concat(a.opacity,'"/>\n <defs><linearGradient id="gradbox_"/></defs>\n </svg>'),"text/xml").documentElement;(i=Mr(t)[0].appendChild(document.importNode(i,!0))).setAttribute("width",16.5),this.rect=i.firstElementChild,this.defs=i.getElementsByTagName("defs")[0],this.grad=this.defs.firstElementChild,this.paint=new Mr.jGraduate.Paint({solidColor:a.color}),this.type=n}return i(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&&(Or.setColor(this.type,this._paintColor,!0),Or.setPaintOpacity(this.type,this._paintOpacity,!0))}},{key:"update",value:function(e){if(V){var t=this.type;switch(V.tagName){case"use":case"image":case"foreignObject":return;case"g":case"a":for(var n=V.getElementsByTagName("*"),r=null,a=0,i=n.length;a<i;a++){var o=n[a].getAttribute(t);if(0===a)r=o;else if(r!==o){r=null;break}}if(null===r)return void(this._paintColor=null);this._paintColor=r,this._paintOpacity=1;break;default:this._paintOpacity=parseFloat(V.getAttribute(t+"-opacity")),isNaN(this._paintOpacity)&&(this._paintOpacity=1);var s="fill"===t?"black":"none";this._paintColor=V.getAttribute(t)||s}e&&(Or.setColor(t,this._paintColor,!0),Or.setPaintOpacity(t,this._paintOpacity,!0)),this._paintOpacity*=100;var l=function(e,t,n){var r={alpha:t};if(e.startsWith("url(#")){var a=Or.getRefElem(e);r[(a=a?a.cloneNode(!0):Mr("#"+n+"_color defs *")[0]).tagName]=a}else e.startsWith("#")?r.solidColor=e.substr(1):r.solidColor="none";return new Mr.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 Mr.jGraduate.Paint({copy:this.paint});Or.setPaint(this.type,e)}}}]),e}();w.fill=new Qt("#fill_color","fill"),w.stroke=new Qt("#stroke_color","stroke"),Mr("#stroke_width").val(Yr.initStroke.width),Mr("#group_opacity").val(100*Yr.initOpacity);var Kt=w.fill.rect.cloneNode(!1);Kt.setAttribute("style","vector-effect:non-scaling-stroke");var Zt="non-scaling-stroke"===Kt.style.vectorEffect;Kt.removeAttribute("style");var $t,Jt,en=w.fill.rect.ownerDocument.createElementNS(v.SVG,"feGaussianBlur");function tn(){Or.deleteCurrentLayer()&&(ne(),L(),Mr("#layerlist tr.layer").removeClass("layersel"),Mr("#layerlist tr.layer:first").addClass("layersel"))}function nn(){return(nn=n(regeneratorRuntime.mark(function e(){var t,n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=Or.getCurrentDrawing().getCurrentLayerName()+" copy",e.next=3,Mr.prompt(Ur.notification.enterUniqueLayerName,t);case 3:if(n=e.sent){e.next=6;break}return e.abrupt("return");case 6:if(!Or.getCurrentDrawing().hasLayer(n)){e.next=9;break}return Mr.alert(Ur.notification.dupeLayerName),e.abrupt("return");case 9:Or.cloneLayer(n),ne(),L();case 12:case"end":return e.stop()}},e)}))).apply(this,arguments)}function rn(e){var t=Or.getCurrentDrawing().getNumLayers(),n=Mr("#layerlist tr.layersel").index();(n>0||n<t-1)&&(n+=e,Or.setCurrentLayerPosition(t-n-1),L())}void 0===en.stdDeviationX&&Mr("#tool_blur").hide(),Mr(en).remove(),$t="-"+c.toLowerCase()+"-zoom-",Jt=$t+"in",b.css("cursor",Jt),b.css("cursor")===Jt&&(C=Jt,A=$t+"out"),b.css("cursor","auto"),setTimeout(function(){Or.embedImage("images/logo.png",function(e){e||(Mr("#image_save_opts [value=embed]").attr("disabled","disabled"),Mr("#image_save_opts input").val(["ref"]),Mr.pref("img_save","ref"),Mr("#image_opt_embed").css("color","#666").attr("title",Ur.notification.featNotSupported))})},1e3),Mr("#fill_color, #tool_fill .icon_label").click(function(){Xt(Mr("#fill_color")),te()}),Mr("#stroke_color, #tool_stroke .icon_label").click(function(){Xt(Mr("#stroke_color")),te()}),Mr("#group_opacityLabel").click(function(){Mr("#opacity_dropdown button").mousedown(),Mr(window).mouseup()}),Mr("#zoomLabel").click(function(){Mr("#zoom_dropdown button").mousedown(),Mr(window).mouseup()}),Mr("#tool_move_top").mousedown(function(e){Mr("#tools_stacking").show(),e.preventDefault()}),Mr(".layer_button").mousedown(function(){Mr(this).addClass("layer_buttonpressed")}).mouseout(function(){Mr(this).removeClass("layer_buttonpressed")}).mouseup(function(){Mr(this).removeClass("layer_buttonpressed")}),Mr(".push_button").mousedown(function(){Mr(this).hasClass("disabled")||Mr(this).addClass("push_button_pressed").removeClass("push_button")}).mouseout(function(){Mr(this).removeClass("push_button_pressed").addClass("push_button")}).mouseup(function(){Mr(this).removeClass("push_button_pressed").addClass("push_button")}),Mr("#layer_new").click(n(regeneratorRuntime.mark(function e(){var t,n,r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n=Or.getCurrentDrawing().getNumLayers();do{t=Ur.layers.layer+" "+ ++n}while(Or.getCurrentDrawing().hasLayer(t));return e.next=4,Mr.prompt(Ur.notification.enterUniqueLayerName,t);case 4:if(r=e.sent){e.next=7;break}return e.abrupt("return");case 7:if(!Or.getCurrentDrawing().hasLayer(r)){e.next=10;break}return Mr.alert(Ur.notification.dupeLayerName),e.abrupt("return");case 10:Or.createLayer(r),ne(),L();case 13:case"end":return e.stop()}},e)}))),Mr("#layer_delete").click(tn),Mr("#layer_up").click(function(){rn(-1)}),Mr("#layer_down").click(function(){rn(1)}),Mr("#layer_rename").click(n(regeneratorRuntime.mark(function e(){var t,n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=Mr("#layerlist tr.layersel td.layername").text(),e.next=3,Mr.prompt(Ur.notification.enterNewLayerName,"");case 3:if(n=e.sent){e.next=6;break}return e.abrupt("return");case 6:if(t!==n&&!Or.getCurrentDrawing().hasLayer(n)){e.next=9;break}return Mr.alert(Ur.notification.layerHasThatName),e.abrupt("return");case 9:Or.renameCurrentLayer(n),L();case 11:case"end":return e.stop()}},e)})));var an=-1,on=!1,sn=!1,cn=function(e){var t=Mr("#ruler_x");Mr("#sidepanels").width("+="+e),Mr("#layerpanel").width("+="+e),t.css("right",parseInt(t.css("right"))+e),b.css("right",parseInt(b.css("right"))+e),Or.runExtensions("workareaResized")},dn=function(e){if(sn&&-1!==an){on=!0;var t=an-e.pageX,n=Mr("#sidepanels").width();n+t>300?t=300-n:n+t<2&&(t=2-n),0!==t&&(an-=t,cn(t))}},hn=function(e){var t=window.devicePixelRatio||1,n=Mr("#sidepanels").width();cn(((t<1?n:n/t)>2||e?0:150*(t<1?1:t))-n)};Mr("#sidepanel_handle").mousedown(function(e){an=e.pageX,Mr(window).mousemove(dn),sn=!1,setTimeout(function(){sn=!0},20)}).mouseup(function(e){on||hn(),an=-1,on=!1}),Mr(window).mouseup(function(){an=-1,on=!1,Mr("#svg_editor").unbind("mousemove",dn)}),L();Mr(window).bind("load resize",function(){b.css("line-height",b.height()+"px")}),Mr("#resolution").change(function(){var e=Mr("#canvas_width,#canvas_height");if(this.selectedIndex)if("content"===this.value)e.val("fit").attr("disabled","disabled");else{var t=this.value.split("x");Mr("#canvas_width").val(t[0]),Mr("#canvas_height").val(t[1]),e.removeAttr("disabled")}else"fit"===Mr("#canvas_width").val()&&e.removeAttr("disabled").val(100)}),Mr("input,select").attr("autocomplete","off");var fn,gn,mn=["#tool_source_cancel","#tool_docprops_cancel","#tool_prefs_cancel",".overlay"],vn=(fn=[{sel:"#tool_select",fn:X,evt:"click",key:["V",!0]},{sel:"#tool_fhpath",fn:je,evt:"click",key:["Q",!0]},{sel:"#tool_line",fn:Ve,evt:"click",key:["L",!0],parent:"#tools_line",prepend:!0},{sel:"#tool_rect",fn:Be,evt:"mouseup",key:["R",!0],parent:"#tools_rect",icon:"rect"},{sel:"#tool_square",fn:Re,evt:"mouseup",parent:"#tools_rect",icon:"square"},{sel:"#tool_fhrect",fn:De,evt:"mouseup",parent:"#tools_rect",icon:"fh_rect"},{sel:"#tool_ellipse",fn:Fe,evt:"mouseup",key:["E",!0],parent:"#tools_ellipse",icon:"ellipse"},{sel:"#tool_circle",fn:Ue,evt:"mouseup",parent:"#tools_ellipse",icon:"circle"},{sel:"#tool_fhellipse",fn:He,evt:"mouseup",parent:"#tools_ellipse",icon:"fh_ellipse"},{sel:"#tool_path",fn:Qe,evt:"click",key:["P",!0]},{sel:"#tool_text",fn:Xe,evt:"click",key:["T",!0]},{sel:"#tool_image",fn:ze,evt:"mouseup"},{sel:"#tool_zoom",fn:qe,evt:"mouseup",key:["Z",!0]},{sel:"#tool_clear",fn:gt,evt:"mouseup",key:["N",!0]},{sel:"#tool_save",fn:function(){var e;M?Ot():(e={images:Mr.pref("img_save"),round_digits:6},Or.save(e))},evt:"mouseup",key:["S",!0]},{sel:"#tool_export",fn:yt,evt:"mouseup"},{sel:"#tool_open",fn:_t,evt:"mouseup",key:["O",!0]},{sel:"#tool_import",fn:bt,evt:"mouseup"},{sel:"#tool_source",fn:j,evt:"click",key:["U",!0]},{sel:"#tool_wireframe",fn:At,evt:"click",key:["F",!0]},{key:["esc",!1,!1],fn:function(){mn.every(function(e){return Mr(e+":hidden").length})&&Or.clearSelection()},hidekey:!0},{sel:mn.join(","),fn:Ut,evt:"click",key:["esc",!1,!1],hidekey:!0},{sel:"#tool_source_save",fn:Ot,evt:"click"},{sel:"#tool_docprops_save",fn:Rt,evt:"click"},{sel:"#tool_docprops",fn:Tt,evt:"mouseup"},{sel:"#tool_prefs_save",fn:Bt,evt:"click"},{sel:"#tool_prefs_option",fn:function(){return function(){if(!Nt){Nt=!0,Mr("#main_menu").hide();var e=qr.bkgd_color,t=Mr.pref("bkgd_url");we.each(function(){var t=Mr(this),n=t.css("background-color")===e;t.toggleClass(Se,n),n&&Mr("#canvas_bg_url").removeClass(Se)}),e||we.eq(0).addClass(Se),t&&Mr("#canvas_bg_url").val(t),Mr("#grid_snapping_on").prop("checked",Yr.gridSnapping),Mr("#grid_snapping_step").attr("value",Yr.snappingStep),Mr("#grid_color").attr("value",Yr.gridColor),Mr("#svg_prefs").show()}}(),!1},evt:"mouseup"},{sel:"#tool_delete,#tool_delete_multi",fn:Ke,evt:"click",key:["del/backspace",!0]},{sel:"#tool_reorient",fn:at,evt:"click"},{sel:"#tool_node_link",fn:st,evt:"click"},{sel:"#tool_node_clone",fn:lt,evt:"click"},{sel:"#tool_node_delete",fn:ct,evt:"click"},{sel:"#tool_openclose_path",fn:dt,evt:"click"},{sel:"#tool_add_subpath",fn:ut,evt:"click"},{sel:"#tool_move_top",fn:et,evt:"click",key:"ctrl+shift+]"},{sel:"#tool_move_bottom",fn:tt,evt:"click",key:"ctrl+shift+["},{sel:"#tool_topath",fn:rt,evt:"click"},{sel:"#tool_make_link,#tool_make_link_multi",fn:it,evt:"click"},{sel:"#tool_undo",fn:xt,evt:"click"},{sel:"#tool_redo",fn:wt,evt:"click"},{sel:"#tool_clone,#tool_clone_multi",fn:kt,evt:"click",key:["D",!0]},{sel:"#tool_group_elements",fn:St,evt:"click",key:["G",!0]},{sel:"#tool_ungroup",fn:St,evt:"click"},{sel:"#tool_unlink_use",fn:St,evt:"click"},{sel:"[id^=tool_align]",fn:Ct,evt:"click"},{sel:"#tool_bold",fn:mt,evt:"mousedown"},{sel:"#tool_italic",fn:vt,evt:"mousedown"},{sel:"#sidepanel_handle",fn:hn,key:["X"]},{sel:"#copy_save_done",fn:Ut,evt:"click"},{key:"ctrl+left",fn:function(){ft(0,1)}},{key:"ctrl+right",fn:function(){ft(1,1)}},{key:"ctrl+shift+left",fn:function(){ft(0,5)}},{key:"ctrl+shift+right",fn:function(){ft(1,5)}},{key:"shift+O",fn:pt},{key:"shift+P",fn:ht},{key:[m+"up",!0],fn:function(){Ye(2)}},{key:[m+"down",!0],fn:function(){Ye(.5)}},{key:[m+"]",!0],fn:function(){nt("Up")}},{key:[m+"[",!0],fn:function(){nt("Down")}},{key:["up",!0],fn:function(){ot(0,-1)}},{key:["down",!0],fn:function(){ot(0,1)}},{key:["left",!0],fn:function(){ot(-1,0)}},{key:["right",!0],fn:function(){ot(1,0)}},{key:"shift+up",fn:function(){ot(0,-10)}},{key:"shift+down",fn:function(){ot(0,10)}},{key:"shift+left",fn:function(){ot(-10,0)}},{key:"shift+right",fn:function(){ot(10,0)}},{key:["alt+up",!0],fn:function(){Or.cloneSelectedElements(0,-1)}},{key:["alt+down",!0],fn:function(){Or.cloneSelectedElements(0,1)}},{key:["alt+left",!0],fn:function(){Or.cloneSelectedElements(-1,0)}},{key:["alt+right",!0],fn:function(){Or.cloneSelectedElements(1,0)}},{key:["alt+shift+up",!0],fn:function(){Or.cloneSelectedElements(0,-10)}},{key:["alt+shift+down",!0],fn:function(){Or.cloneSelectedElements(0,10)}},{key:["alt+shift+left",!0],fn:function(){Or.cloneSelectedElements(-10,0)}},{key:["alt+shift+right",!0],fn:function(){Or.cloneSelectedElements(10,0)}},{key:"a",fn:function(){Or.selectAllInCurrentLayer()}},{key:m+"a",fn:function(){Or.selectAllInCurrentLayer()}},{key:m+"z",fn:xt},{key:m+"shift+z",fn:wt},{key:m+"y",fn:wt},{key:m+"x",fn:Ze},{key:m+"c",fn:$e},{key:m+"v",fn:Je}],gn={"4/Shift+4":"#tools_rect_show","5/Shift+5":"#tools_ellipse_show"},{setAll:function(){var e={};Mr.each(fn,function(t,n){var r;if(n.sel){if(!(r=Mr(n.sel)).length)return!0;if(n.evt&&(q()&&"click"===n.evt&&(n.evt="mousedown"),r[n.evt](n.fn)),n.parent&&Mr(n.parent+"_show").length){var a=Mr(n.parent);a.length||(a=ve(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,o=!1;Array.isArray(n.key)?(i=n.key[0],n.key.length>1&&(o=n.key[1])):i=n.key,i=String(i);var s=n.fn;if(Mr.each(i.split("/"),function(e,t){Mr(document).bind("keydown",t,function(e){return s(),o&&e.preventDefault(),!1})}),n.sel&&!n.hidekey&&r.attr("title")){var l=r.attr("title").split("[")[0]+" ("+i+")";gn[i]=n.sel,r.parents("#main_menu").length||r.attr("title",l)}}return!0}),me(e),Mr(".attr_changer, #image_url").bind("keydown","return",function(e){Mr(this).change(),e.preventDefault()}),Mr(window).bind("keydown","tab",function(e){"canvas"===E&&(e.preventDefault(),ht())}).bind("keydown","shift+tab",function(e){"canvas"===E&&(e.preventDefault(),pt())}),Mr("#tool_zoom").dblclick(We)},setTitles:function(){Mr.each(gn,function(e,t){var n=Mr(t).parents("#main_menu").length;Mr(t).each(function(){var t;t=n?Mr(this).text().split(" [")[0]:this.title.split(" [")[0];var r="";Mr.each(e.split("/"),function(e,t){var n=t.split("+"),a="";n.length>1&&(a=n[0]+"+",t=n[1]),r+=(e?"/":"")+a+(Ur["key_"+t]||t)}),n?this.lastChild.textContent=t+" ["+r+"]":this.title=t+" ["+r+"]"})})},getButtonData:function(e){return Object.values(fn).find(function(t){return t.sel===e})}});Lr.ready(function(){var e=Yr.initTool,t=Mr("#tools_left, #svg_editor .tools_flyout"),n=t.find("#tool_"+e),r=t.find("#"+e);(n.length?n:r.length?r:Mr("#tool_select")).click().mouseup(),Yr.wireframe&&Mr("#tool_wireframe").click(),Yr.showlayers&&hn(),Mr("#rulers").toggle(Boolean(Yr.showRulers)),Yr.showRulers&&(Mr("#show_rulers")[0].checked=!0),Yr.baseUnit&&Mr("#base_unit").val(Yr.baseUnit),Yr.gridSnapping&&(Mr("#grid_snapping_on")[0].checked=!0),Yr.snappingStep&&Mr("#grid_snapping_step").val(Yr.snappingStep),Yr.gridColor&&Mr("#grid_color").val(Yr.gridColor)}),Mr("#rect_rx").SpinButton({min:0,max:1e3,stateObj:s,callback:function(e){Or.setRectRadius(e.value)}}),Mr("#stroke_width").SpinButton({min:0,max:99,smallStep:.1,stateObj:s,callback:function(e){var t=e.value;0===t&&V&&["line","polyline"].includes(V.nodeName)&&(t=e.value=1),Or.setStrokeWidth(t)}}),Mr("#angle").SpinButton({min:-180,max:180,step:5,stateObj:s,callback:function(e){Or.setRotationAngle(e.value),Mr("#tool_reorient").toggleClass("disabled",0===parseInt(e.value))}}),Mr("#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:s,callback:function(e){Or.setFontSize(e.value)}}),Mr("#group_opacity").SpinButton({min:0,max:100,step:5,stateObj:s,callback:ke}),Mr("#blur").SpinButton({min:0,max:10,step:.1,stateObj:s,callback:Ce}),Mr("#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:s,callback:ue}).val(100*Or.getZoom()),Mr("#workarea").contextMenu({menu:"cmenu_canvas",inSpeed:0},function(e,t,n){switch(e){case"delete":Ke();break;case"cut":Ze();break;case"copy":$e();break;case"paste":Or.pasteElements();break;case"paste_in_place":Or.pasteElements("in_place");break;case"group":case"group_elements":Or.groupSelectedElements();break;case"ungroup":Or.ungroupSelectedElement();break;case"move_front":et();break;case"move_up":nt("Up");break;case"move_down":nt("Down");break;case"move_back":tt();break;default:Boolean(un[e])&&function(e){return un[e].action}(e).call()}});var _n=function(e,t,n){switch(e){case"dupe":!function(){nn.apply(this,arguments)}();break;case"delete":tn();break;case"merge_down":Mr("#layerlist tr.layersel").index()!==Or.getCurrentDrawing().getNumLayers()-1&&(Or.mergeLayer(),ne(),L());break;case"merge_all":Or.mergeAllLayers(),ne(),L()}};function xn(){var e;try{e=localStorage.getItem("svgedit_clipboard")}catch(e){}x[(e?"en":"dis")+"ableContextMenuItems"]("#paste,#paste_in_place")}if(Mr("#layerlist").contextMenu({menu:"cmenu_layers",inSpeed:0},_n),Mr("#layer_moreopts").contextMenu({menu:"cmenu_layers",inSpeed:0,allowLeft:!0},_n),Mr(".contextMenu li").mousedown(function(e){e.preventDefault()}),Mr("#cmenu_canvas li").disableContextMenu(),x.enableContextMenuItems("#delete,#cut,#copy"),xn(),window.addEventListener("storage",function(e){"svgedit_clipboard"===e.key&&xn()}),window.addEventListener("beforeunload",function(e){return 0===_.getUndoStackSize()&&(Lr.showSaveWarning=!1),!(!Yr.no_save_warning&&Lr.showSaveWarning)||(e.returnValue=Ur.notification.unsavedChanges,Ur.notification.unsavedChanges)}),Lr.canvas.getUIStrings=function(){return Ur},Lr.openPrep=function(){return Mr("#main_menu").hide(),0===_.getUndoStackSize()||Mr.confirm(Ur.notification.QwantToOpen)},window.FileReader){var wn=function(e){Mr.process_cancel(Ur.notification.loadingImage),e.stopPropagation(),e.preventDefault(),Mr("#workarea").removeAttr("style"),Mr("#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=Or.importSvgString(e.target.result,!0);Or.ungroupSelectedElement(),Or.ungroupSelectedElement(),Or.groupSelectedElements(),Or.alignSelectedElements("m","page"),Or.alignSelectedElements("c","page"),Or.selectOnly([t]),Mr("#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.addEventListener("load",function(){var e,i,o;n=a.offsetWidth||a.naturalWidth||a.width,r=a.offsetHeight||a.naturalHeight||a.height,e=n,i=r,o=Or.addSVGElementFromJson({element:"image",attr:{x:0,y:0,width:e,height:i,id:Or.getNextId(),style:"pointer-events:inherit"}}),Or.setHref(o,t),Or.selectOnly([o]),Or.alignSelectedElements("m","page"),Or.alignSelectedElements("c","page"),ne(),Mr("#dialog_box").hide()}),a.src=t},t.readAsDataURL(n))):Mr("#dialog_box").hide()};b[0].addEventListener("dragenter",function(e){e.stopPropagation(),e.preventDefault()}),b[0].addEventListener("dragover",function(e){e.stopPropagation(),e.preventDefault()}),b[0].addEventListener("dragleave",function(e){e.stopPropagation(),e.preventDefault()}),b[0].addEventListener("drop",wn);var Sn=Mr('<input type="file">').click(n(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Lr.openPrep();case 2:if(e.sent){e.next=5;break}return e.abrupt("return");case 5:Or.clear(),1===this.files.length&&(Mr.process_cancel(Ur.notification.loadingImage),(t=new FileReader).onloadend=function(){var e=n(regeneratorRuntime.mark(function e(t){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Wr(t.target.result);case 2:ee();case 3:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),t.readAsText(this.files[0]));case 7:case"end":return e.stop()}},e,this)})));Mr("#tool_open").show().prepend(Sn);var kn=Mr('<input type="file">').change(wn);Mr("#tool_import").show().prepend(kn)}ee(!0);var Cn=[],An=Lr.setLang=function(){var e=n(regeneratorRuntime.mark(function e(t,n){var r,a,i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(Lr.langChanged=!0,Mr.pref("lang",t),Mr("#lang_select").val(t),n){e.next=5;break}return e.abrupt("return");case 5:if(document.documentElement.lang=n.lang,Mr.extend(Ur,n),r=Mr("#layerlist tr.layersel td.layername").text(),a=r===Ur.common.layer+" 1",Or.setUiStrings(n),vn.setTitles(),a&&(Or.renameCurrentLayer(Ur.common.layer+" 1"),L()),!_e.length){e.next=18;break}return e.next=15,Promise.all(_e.map(function(e){return Cn.push(e.name),e.langReady({lang:t,uiStrings:Ur,importLocale:Qr({defaultLang:t,defaultName:e.name})})}));case 15:_e.length=0,e.next=19;break;case 18:Cn.forEach(function(e){Or.runExtension(e,"langReady",{lang:t,uiStrings:Ur,importLocale:Qr({defaultLang:t,defaultName:e})})});case 19:Or.runExtensions("langChanged",t),fe(),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"},Mr.each(i,function(e,t){Mr(t).attr("title",Mr(e)[0].title)}),Mr("#multiselected_panel div[id^=tool_align]").each(function(){Mr("#tool_pos"+this.id.substr(10))[0].title=this.title});case 24:case"end":return e.stop()}},e)}));return function(t,n){return e.apply(this,arguments)}}();!function(e){Cr=e}({addLangData:function(e){return Or.runExtensions("addLangData",function(t){return{lang:e,importLocale:Qr({defaultLang:e,defaultName:t})}},!0)},curConfig:Yr}),"file:"===document.location.protocol?setTimeout(o,100):o()},Lr.ready=function(e){return new Promise(function(t,n){Fr?t(e()):Vr.push([e,t,n])})},Lr.runCallbacks=n(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(Vr.map(function(e){return(0,p(e,1)[0])()}));case 3:e.next=9;break;case 5:throw e.prev=5,e.t0=e.catch(0),Vr.forEach(function(e){(0,p(e,3)[2])()}),e.t0;case 9:Vr.forEach(function(e){(0,p(e,2)[1])()}),Fr=!0;case 11:case"end":return e.stop()}},e,null,[[0,5]])})),Lr.loadFromString=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.noAlert;return Lr.ready(n(regeneratorRuntime.mark(function t(){return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,Wr(e,{noAlert:r});case 3:t.next=9;break;case 5:if(t.prev=5,t.t0=t.catch(0),!r){t.next=9;break}throw t.t0;case 9:case"end":return t.stop()}},t,null,[[0,5]])})))},Lr.disableUI=function(e){},Lr.loadFromURL=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.cache,r=t.noAlert;return Lr.ready(function(){return new Promise(function(t,a){Mr.ajax({url:e,dataType:"text",cache:Boolean(n),beforeSend:function(){Mr.process_cancel(Ur.notification.loadingImage)},success:function(e){t(Wr(e,{noAlert:r}))},error:function(e,n,i){404!==e.status&&e.responseText?t(Wr(e.responseText,{noAlert:r})):r?a(new Error("URLLoadFail")):(Mr.alert(Ur.notification.URLLoadFail+": \n"+i),t())},complete:function(){Mr("#dialog_box").hide()}})})})},Lr.loadFromDataURI=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.noAlert;return Lr.ready(function(){var t=!1,r=e.match(/^data:image\/svg\+xml;base64,/);r?t=!0:r=e.match(/^data:image\/svg\+xml(?:;|;utf8)?,/),r&&(r=r[0]);var a=e.slice(r.length);return Wr(t?Pt(a):decodeURIComponent(a),{noAlert:n})})},Lr.addExtension=function(e,t,n){if(!Or)throw new Error("Extension added too early");return Or.addExtension.call(this,e,t,n)},Lr.ready(function(){dn()});var Kr=!1,Zr=[];window.addEventListener("message",function(e){var t={data:e.data,origin:e.origin};Kr?Or.call("message",t):Zr.push(t)}),n(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:Lr.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,null,[[0,6]])}))();export default Lr;
//# sourceMappingURL=index-es.min.js.map