!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.svgEditor=t()}(this,function(){"use strict";function e(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=document.createEvent("MouseEvent");a.initMouseEvent(r,!0,!0,window,1,n.screenX,n.screenY,n.clientX,n.clientY,!1,!1,!1,!1,0,null),t.length<2&&(n.target.dispatchEvent(a),e.preventDefault())}document.addEventListener("touchstart",e,!0),document.addEventListener("touchmove",e,!0),document.addEventListener("touchend",e,!0),document.addEventListener("touchcancel",e,!0);var t="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},n=function(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,n){return function r(a,i){try{var o=t[a](i),s=o.value}catch(e){return void n(e)}if(!o.done)return Promise.resolve(s).then(function(e){r("next",e)},function(e){r("throw",e)});e(s)}("next")})}},r=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},a=function(){function e(e,t){for(var n=0;nt.getTotalLength())break;n--}while(n>0);return n}),window.SVGPathSeg=e,window.SVGPathSegClosePath=t,window.SVGPathSegMovetoAbs=n,window.SVGPathSegMovetoRel=i,window.SVGPathSegLinetoAbs=l,window.SVGPathSegLinetoRel=c,window.SVGPathSegCurvetoCubicAbs=u,window.SVGPathSegCurvetoCubicRel=d,window.SVGPathSegCurvetoQuadraticAbs=h,window.SVGPathSegCurvetoQuadraticRel=f,window.SVGPathSegArcAbs=p,window.SVGPathSegArcRel=g,window.SVGPathSegLinetoHorizontalAbs=v,window.SVGPathSegLinetoHorizontalRel=m,window.SVGPathSegLinetoVerticalAbs=_,window.SVGPathSegLinetoVerticalRel=y,window.SVGPathSegCurvetoCubicSmoothAbs=b,window.SVGPathSegCurvetoCubicSmoothRel=x,window.SVGPathSegCurvetoQuadraticSmoothAbs=w,window.SVGPathSegCurvetoQuadraticSmoothRel=S}if(!("SVGPathSegList"in window&&"appendItem"in SVGPathSegList.prototype)){var k=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 a(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 a(e,[{key:"appendSegment",value:function(e){this.pathSegList.push(e)}}]),e}(),i=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 a(e,[{key:"_isCurrentSpace",value:function(){var e=this._string[this._currentIndex];return e<=" "&&(" "===e||"\n"===e||"\t"===e||"\r"===e||"\f"===e)}},{key:"_skipOptionalSpaces",value:function(){for(;this._currentIndex="0"&&e<="9")&&t!==SVGPathSeg.PATHSEG_CLOSEPATH?t===SVGPathSeg.PATHSEG_MOVETO_ABS?SVGPathSeg.PATHSEG_LINETO_ABS:t===SVGPathSeg.PATHSEG_MOVETO_REL?SVGPathSeg.PATHSEG_LINETO_REL:t:SVGPathSeg.PATHSEG_UNKNOWN}},{key:"initialCommandIsMoveTo",value:function(){if(!this.hasMoreData())return!0;var e=this.peekSegmentType();return e===SVGPathSeg.PATHSEG_MOVETO_ABS||e===SVGPathSeg.PATHSEG_MOVETO_REL}},{key:"_parseNumber",value:function(){var e=0,t=0,n=1,r=0,a=1,i=1,o=this._currentIndex;if(this._skipOptionalSpaces(),this._currentIndex"9")&&"."!==this._string.charAt(this._currentIndex))){for(var s=this._currentIndex;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)<"0"||this._string.charAt(this._currentIndex)>"9")return;for(;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||this._string.charAt(this._currentIndex)<"0"||this._string.charAt(this._currentIndex)>"9")return;for(;this._currentIndex="0"&&this._string.charAt(this._currentIndex)<="9";)e*=10,e+=this._string.charAt(this._currentIndex)-"0",this._currentIndex++}var 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 i(e);if(!s.initialCommandIsMoveTo())return[];for(;s.hasMoreData();){var l=s.parseSegment();if(!l)return[];o.appendSegment(l)}return o.pathSegList}}]),e}();k.prototype.classname="SVGPathSegList",Object.defineProperty(k.prototype,"numberOfItems",{get:function(){return this._checkPathSynchronizedToList(),this._list.length},enumerable:!0}),k._pathSegArrayAsString=function(e){var t="",n=!0;return e.forEach(function(e){n?(n=!1,t+=e._asPathString()):t+=" "+e._asPathString()}),t},Object.defineProperties(SVGPathElement.prototype,{pathSegList:{get:function(){return this._pathSegList||(this._pathSegList=new k(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=k}}();var h,f=jQuery,p=(!!document.createElementNS&&document.createElementNS(u.SVG,"svg").createSVGRect,navigator.userAgent),g=document.createElementNS(u.SVG,"svg"),v=!!window.opera,m=p.includes("AppleWebKit"),_=p.includes("Gecko/"),y=p.includes("MSIE"),b=p.includes("Chrome/"),x=(p.includes("Windows"),p.includes("Macintosh")),w="ontouchstart"in window,S=!!g.querySelector,k=!!document.evaluate,C=function(){var e=document.createElementNS(u.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}(),A=function(){var e=document.createElementNS(u.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}(),E=function(){var e=document.createElementNS(u.SVG,"svg"),t=document.createElementNS(u.SVG,"svg");document.documentElement.append(e),t.setAttribute("x",5),e.append(t);var n=document.createElementNS(u.SVG,"text");n.textContent="a",t.append(n);var r=n.getStartPositionOfChar(0).x;return e.remove(),0===r}(),P=function(){var e=document.createElementNS(u.SVG,"svg");document.documentElement.append(e);var t=document.createElementNS(u.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}(),G=function(){var e=document.createElementNS(u.SVG,"svg");document.documentElement.append(e);var t=document.createElementNS(u.SVG,"path");t.setAttribute("d","M0,0 10,0");var n=document.createElementNS(u.SVG,"path");n.setAttribute("d","M5,0 15,0");var r=document.createElementNS(u.SVG,"g");r.append(t,n),e.append(r);var a=r.getBBox();return e.remove(),15===a.width}(),I=(function(){var e=document.createElementNS(u.SVG,"rect");e.setAttribute("x",.1);var t=!e.cloneNode(!1).getAttribute("x").includes(",");t||f.alert('NOTE: This version of Opera is known to contain bugs in SVG-edit.\nPlease upgrade to the latest version in which the problems have been fixed.')}(),(h=document.createElementNS(u.SVG,"rect")).setAttribute("style","vector-effect:non-scaling-stroke"),"non-scaling-stroke"===h.style.vectorEffect),T=function(){var e=document.createElementNS(u.SVG,"rect").transform.baseVal,t=g.createSVGTransform();e.appendItem(t);var n=e.getItem(0);return n instanceof SVGTransform&&t instanceof SVGTransform&&n.type===t.type&&n.angle===t.angle&&n.matrix.a===t.matrix.a&&n.matrix.b===t.matrix.b&&n.matrix.c===t.matrix.c&&n.matrix.d===t.matrix.d&&n.matrix.e===t.matrix.e&&n.matrix.f===t.matrix.f}(),N=function(){return v},L=function(){return m},M=function(){return _},O=function(){return y},V=function(){return b},j=function(){return x},R=function(){return w},B=function(){return G},D=function(){return I};function U(e){var n=e.fn.attr;return e.fn.attr=function(e,r){var a=this.length;if(!a)return n.apply(this,arguments);for(var i=0;i=0)return this._xforms[e];var t=new Error("DOMException with code=INDEX_SIZE_ERR");throw t.code=1,t},this.insertItemBefore=function(e,t){var n=null;if(t>=0)if(t=0&&(this._removeFromOtherLists(e),this._xforms[t]=e,n=e,this._list._update()),n},this.removeItem=function(e){if(e=0){var t=this._xforms[e],n=new Array(this.numberOfItems-1),r=void 0;for(r=0;r=0;t--)this.stack[t].unapply(e);e&&e.handleHistoryEvent(ae.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}}]),e}();ce.type=ce.prototype.type;var ue=function(){function e(t){r(this,e),this.handler_=t||null,this.undoStackPointer=0,this.undoStack=[],this.undoChangeStackPointer=-1,this.undoableChangeStack=[]}return a(e,[{key:"resetUndoStack",value:function(){this.undoStack=[],this.undoStackPointer=0}},{key:"getUndoStackSize",value:function(){return this.undoStackPointer}},{key:"getRedoStackSize",value:function(){return this.undoStack.length-this.undoStackPointer}},{key:"getNextUndoCommandText",value:function(){return this.undoStackPointer>0?this.undoStack[this.undoStackPointer-1].getText():""}},{key:"getNextRedoCommandText",value:function(){return this.undoStackPointer0&&this.undoStack[--this.undoStackPointer].unapply(this.handler_)}},{key:"redo",value:function(){this.undoStackPointer0&&this.undoStack[this.undoStackPointer++].apply(this.handler_)}},{key:"addCommandToHistory",value:function(e){this.undoStackPointer0&&(this.undoStack=this.undoStack.splice(0,this.undoStackPointer)),this.undoStack.push(e),this.undoStackPointer=this.undoStack.length}},{key:"beginUndoableChange",value:function(e,t){for(var n=++this.undoChangeStackPointer,r=t.length,a=new Array(r),i=new Array(r);r--;){var o=t[r];null!=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 ce("Change "+n),a=t.elements.length;a--;){var i=t.elements[a];if(null!=i){var o={};o[n]=t.oldValues[a],o[n]!==i.getAttribute(n)&&r.addSubCommand(new le(i,o,n))}}return this.undoableChangeStack[e]=null,r}}]),e}(),de=Object.freeze({HistoryEventTypes:ae,MoveElementCommand:ie,InsertElementCommand:oe,RemoveElementCommand:se,ChangeElementCommand:le,BatchCommand:ce,UndoManager:ue}),he=document.createElementNS(u.SVG,"svg"),fe=function(e,t,n){return{x:n.a*e+n.c*t+n.e,y:n.b*e+n.d*t+n.f}},pe=function(e){return 1===e.a&&0===e.b&&0===e.c&&1===e.d&&0===e.e&&0===e.f},ge=function(){for(var e=arguments.length,t=Array(e),n=0;n(n=parseInt(n,10))){var r=n;n=t,t=r}for(var a=he.createSVGMatrix(),i=t;i<=n;++i){var o=i>=0&&ie.x&&t.ye.y},we=jQuery,Se={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"]},ke={},Ce=function(e){Object.assign(ke,e.ui)},Ae=[],Ee=!0,Pe={},Ge=null,Ie=null,Te=function(e){Ie=e,Ae=[0,"ClosePath"];we.each(["Moveto","Lineto","CurvetoCubic","CurvetoQuadratic","Arc","LinetoHorizontal","LinetoVertical","CurvetoCubicSmooth","CurvetoQuadraticSmooth"],function(e,t){Ae.push(t+"Abs"),Ae.push(t+"Rel")})},Ne=function(e,t,n){var r=e.pathSegList;if(A)r.insertItemBefore(t,n);else{for(var a=r.numberOfItems,i=[],o=0;o0?(g=f element");this.elem=t,this.segs=[],this.selected_pts=[],Ge=this,this.init()}return a(e,[{key:"init",value:function(){we(Ve()).find("*").each(function(){we(this).attr("display","none")});var e=this.elem.pathSegList,t=e.numberOfItems;this.segs=[],this.selected_pts=[],this.first_seg=null;for(var n=0;n=t?null:i[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(),null==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=0&&this.selected_pts.push(n)}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=this.subpathIsClosed(this.selected_pts[0]);Ie.addPtsToSelection({grips:a,closedSubpath:s})}}]),e}(),qe=function(e){var t=Pe[e.id];return t||(t=Pe[e.id]=new ze(e)),t},Ye=function(e){e in Pe&&delete Pe[e]},We=void 0,Xe=void 0,Qe=void 0,Ke=void 0,Ze=void 0,$e=function(e,t){var n=e-Qe,r=t-Ke,a=Math.sqrt(n*n+r*r),i=Math.atan2(r,n)+Ze;return n=a*Math.cos(i)+Qe,r=a*Math.sin(i)+Ke,n-=We,r-=Xe,a=Math.sqrt(n*n+r*r),i=Math.atan2(r,n)-Ze,{x:a*Math.cos(i)+We,y:a*Math.sin(i)+Xe}},Je=function(){var e=Ge.elem;if(Ze=Ht(e,!0)){var t=Ge.oldbbox;Qe=t.x+t.width/2,Ke=t.y+t.height/2;var n=Nt(e);We=n.x+n.width/2,Xe=n.y+n.height/2;var r=We-Qe,a=Xe-Ke,i=Math.sqrt(r*r+a*a),o=Math.atan2(a,r)+Ze;We=i*Math.cos(o)+Qe,Xe=i*Math.sin(o)+Ke;for(var s=e.pathSegList,l=s.numberOfItems;l;){l-=1;var c=s.getItem(l),u=c.pathSegType;if(1!==u){var d=$e(c.x,c.y),h=[d.x,d.y];if(null!=c.x1&&null!=c.x2){var f=$e(c.x1,c.y1),p=$e(c.x2,c.y2);h.splice(h.length,0,f.x,f.y,p.x,p.y)}De(u,l,h)}}n=Nt(e);var g=Ie.getSVGRoot().createSVGTransform(),v=W(e);g.setRotate(180*Ze/Math.PI,We,Xe),v.replaceItem(g,0)}},et=[0,"z","M","m","L","l","C","c","Q","q","A","a","H","h","V","v","S","s","T","t"],tt=function(e,t){for(var n=e.pathSegList,r=n.numberOfItems,a=0,i=0,o="",s=null,l=0;l=C-w&&g<=C+w&&v>=A-w&&v<=A+w){S=!0;break}}a=Ie.getId(),Ye(a);var E=qt(a),P=void 0,G=void 0,I=b.numberOfItems;if(S){if(x<=1&&I>=2){var T=b.getItem(0).x,N=b.getItem(0).y;P=4===(G=m.pathSegList.getItem(1)).pathSegType?y.createSVGPathSegLinetoAbs(T,N):y.createSVGPathSegCurvetoCubicAbs(T,N,G.x1/p,G.y1/p,T,N);var L=y.createSVGPathSegClosePath();b.appendItem(P),b.appendItem(L)}else if(I<3)return!1;if(we(m).remove(),y=Ie.setDrawnPath(null),Ie.setStarted(!1),rt){Ge.matrix&&Ie.remapElement(E,{},Ge.matrix.inverse());var M=E.getAttribute("d"),O=we(Ge.elem).attr("d");return we(Ge.elem).attr("d",O+M),we(E).remove(),Ge.matrix&&Je(),Te(),lt.toEditMode(Ge.elem),Ge.selectPt(),!1}}else{if(!we.contains(Ie.getContainer(),Ie.getMouseTarget(e)))return console.log("Clicked outside canvas"),!1;var V=y.pathSegList.numberOfItems,j=y.pathSegList.getItem(V-1),R=j.x,B=j.y;if(e.shiftKey){var D=be(R,B,g,v);g=D.x,v=D.y}P=4===(G=m.pathSegList.getItem(1)).pathSegType?y.createSVGPathSegLinetoAbs(Ie.round(g),Ie.round(v)):y.createSVGPathSegCurvetoCubicAbs(Ie.round(g),Ie.round(v),G.x1/p,G.y1/p,G.x2/p,G.y2/p),y.pathSegList.appendItem(P),g*=p,v*=p,m.setAttribute("d",["M",g,v,g,v].join(" ")),_=V,rt&&(_+=Ge.segs.length),Oe(_,g,v)}}else{var U="M"+g+","+v+" ";y=Ie.setDrawnPath(Ie.addSvgElementFromJson({element:"path",curStyles:!0,attr:{d:U,id:Ie.getNextId(),opacity:Ie.getOpacity()/2}})),m.setAttribute("d",["M",h,f,h,f].join(" ")),_=rt?Ge.segs.length:0,Oe(_,h,f)}}},mouseMove:function(e,t){var n=Ie.getCurrentZoom();st=!0;var r=Ie.getDrawnPath();if("path"!==Ie.getCurrentMode())if(Ge.dragging){var a=Me({x:Ge.dragging[0],y:Ge.dragging[1]},Ge),i=Me({x:e,y:t},Ge),o=i.x-a.x,s=i.y-a.y;Ge.dragging=[e,t],Ge.dragctrl?Ge.moveCtrl(o,s):Ge.movePts(o,s)}else Ge.selected_pts=[],Ge.eachSeg(function(e){if(this.next||this.prev){var t=Ie.getRubberBox().getBBox(),n=Le(this),r={x:n.x,y:n.y,width:0,height:0},a=xe(t,r);this.select(a),a&&Ge.selected_pts.push(this.index)}});else{if(!r)return;var l=r.pathSegList,c=l.numberOfItems-1;if(at){var u=je("1c1"),d=je("0c2");u.setAttribute("cx",e),u.setAttribute("cy",t),u.setAttribute("display","inline");var h=at[0],f=at[1],p=h+(h-e/n),g=f+(f-t/n);d.setAttribute("cx",p*n),d.setAttribute("cy",g*n),d.setAttribute("display","inline");var v=Re(1);if(Yt(v,{x1:e,y1:t,x2:p*n,y2:g*n,display:"inline"}),0===c)it=[e,t];else{var m=l.getItem(c-1),_=m.x,y=m.y;6===m.pathSegType?(_+=_-m.x2,y+=y-m.y2):it&&(_=it[0]/n,y=it[1]/n),De(6,c,[h,f,_,y,p,g],r)}}else{var b=qt("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);De(6,1,[e,t,w*n,S*n,e,t],b)}else it?De(6,1,[e,t,it[0],it[1],e,t],b):De(4,1,[e,t],b)}}}},mouseUp:function(e,t,n,r){var a=Ie.getDrawnPath();if("path"===Ie.getCurrentMode())return at=null,a||(t=qt(Ie.getId()),Ie.setStarted(!1),it=null),{keep:!0,element:t};var i=Ie.getRubberBox();if(Ge.dragging){var o=Ge.cur_pt;Ge.dragging=!1,Ge.dragctrl=!1,Ge.update(),st&&Ge.endChanges("Move path point(s)"),e.shiftKey||st||Ge.selectPt(o)}else i&&"none"!==i.getAttribute("display")?(i.setAttribute("display","none"),i.getAttribute("width")<=2&&i.getAttribute("height")<=2&<.toSelectMode(e.target)):lt.toSelectMode(e.target);st=!1},toEditMode:function(e){Ge=qe(e),Ie.setCurrentMode("pathedit"),Ie.clearSelection(),Ge.show(!0).update(),Ge.oldbbox=Nt(Ge.elem),rt=!1},toSelectMode:function(e){var t=e===Ge.elem;Ie.setCurrentMode("select"),Ge.show(!1),ot=!1,Ie.clearSelection(),Ge.matrix&&Je(),t&&(Ie.call("selected",[e]),Ie.addToSelection([e],!0))},addSubPath:function(e){e?(Ie.setCurrentMode("path"),rt=!0):(lt.clear(!0),lt.toEditMode(Ge.elem))},select:function(e){ot===e?(lt.toEditMode(e),Ie.setCurrentMode("pathedit")):ot=e},reorient:function(){var e=Ie.getSelectedElements()[0];if(e&&0!==Ht(e)){var t=new ce("Reorient path"),n={d:e.getAttribute("d"),transform:e.getAttribute("transform")};t.addSubCommand(new le(e,n)),Ie.clearSelection(),this.resetOrientation(e),Ie.addCommandToHistory(t),qe(e).show(!1).matrix=null,this.clear(),Ie.addToSelection([e],!0),Ie.call("changed",Ie.getSelectedElements())}},clear:function(e){var t=Ie.getDrawnPath();if(ot=null,t){var n=qt(Ie.getId());we(qt("path_stretch_line")).remove(),we(n).remove(),we(qt("pathpointgrip_container")).find("*").attr("display","none"),it=null,Ie.setDrawnPath(null),Ie.setStarted(!1)}else"pathedit"===Ie.getCurrentMode()&&this.toSelectMode();Ge&&Ge.init().show(!1)},resetOrientation:function(e){if(null==e||"path"!==e.nodeName)return!1;var t=W(e),n=_e(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=[];we.each(["",1,2],function(e,t){var r=a["x"+t],i=a["y"+t];if(void 0!==r&&void 0!==i){var s=fe(r,i,n);o.splice(o.length,0,s.x,s.y)}}),De(i,t,o,e)},o=0;o0){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}(),Ge.elem.pathSegList.numberOfItems<=1)return lt.toSelectMode(Ge.elem),void Ie.canvas.deleteSelectedElements();if(Ge.init(),Ge.clearSelection(),window.opera){var r=we(Ge.elem);r.attr("d",r.attr("d"))}Ge.endChanges("Delete path node(s)")}},smoothPolylineIntoPath:function(e){var t=void 0,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=Fe(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/g,">").replace(/"/g,""").replace(/'/,"'")},mt=function(e){if(e=bt(e),window.btoa)return window.btoa(e);var t=[];t.length=4*Math.floor((e.length+2)/3);var 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=u=64:isNaN(o)&&(u=64),t[r++]=ut.charAt(s),t[r++]=ut.charAt(l),t[r++]=ut.charAt(c),t[r++]=ut.charAt(u)}while(n>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(nSVG-edit "],{type:"text/html"});return wt(e)}(),kt=function(e){e.includes("0?t=t[0]:(t=e.ownerDocument.createElementNS(u.SVG,"defs"),e.firstChild?e.insertBefore(t,e.firstChild.nextSibling):e.append(t)),t},It=function(e){for(var t=e.pathSegList,n=t.numberOfItems,r=[[],[]],a=t.getItem(0),i=[a.x,a.y],o=0;o0&&u<1&&r[a].push(o(u)),"continue"}var d=Math.pow(s,2)-4*c*l;if(d<0)return"continue";var h=(-s+Math.sqrt(d))/(2*l);h>0&&h<1&&r[a].push(o(h));var f=(-s-Math.sqrt(d))/(2*l);f>0&&f<1&&r[a].push(o(f))},o=0;o<2;o++)a(o);i=n}():(r[0].push(s.x),r[1].push(s.y)))}var l=Math.min.apply(null,r[0]),c=Math.max.apply(null,r[0])-l,u=Math.min.apply(null,r[1]);return{x:l,y:u,width:c,height:Math.max.apply(null,r[1])-u}};function Tt(e){if(B())try{return e.getBBox()}catch(e){}var t=ct.data(e,"ref"),n=null,r=void 0,a=void 0;t?(a=ct(t).children().clone().attr("visibility","hidden"),ct(gt).append(a),n=a.filter("line, path")):n=ct(e).find("line, path");var i=!1;if(n.length)if(n.each(function(){var e=this.getBBox();e.width&&e.height||(i=!0)}),i){var o=t?a:ct(e).children();r=Bt(o)}else r=e.getBBox();else r=e.getBBox();return t&&a.remove(),r}var Nt=function(e){var t=e||ht.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":P?t.getBBox&&(a=t.getBBox()):a=It(t);break;case"g":case"a":a=Tt(t);break;default:if("use"===r&&(a=Tt(t)),"use"===r||"foreignObject"===r&&L()){if(a||(a=t.getBBox()),!L()){var i={};i.width=a.width,i.height=a.height,i.x=a.x+parseFloat(t.getAttribute("x")||0),i.y=a.y+parseFloat(t.getAttribute("y")||0),a=i}}else if(dt.includes(r))if(t)try{a=t.getBBox()}catch(e){var o=t.getExtentOfChar(0),s=t.getComputedTextLength();a={x:o.x,y:o.y,width:s,height:o.height}}else{var l=ct(t).closest("foreignObject");l.length&&l[0].getBBox&&(a=l[0].getBBox())}}return a&&(a={x:(n=a).x,y:n.y,width:n.width,height:n.height}),a},Lt=function(e){var t="";return ct.each(e,function(e,n){var r=n[1];t+=n[0];for(var a=0;a-.001&&n<.001||n<-89.99||n>89.99)}(i,o)){if(["ellipse","path","line","polyline","polygon"].includes(e.tagName))r=s=Vt(e,t,n);else if("rect"===e.tagName){var l=e.getAttribute("rx"),c=e.getAttribute("ry");(l||c)&&(r=s=Vt(e,t,n))}}if(!s){var u=_e(a).matrix;r=me(r.x,r.y,r.width,r.height,u).aabox}}return r};function Rt(e){var t=e.getAttribute("stroke-width");return isNaN(t)||"none"===e.getAttribute("stroke")?0:t/2}var Bt=function(e,t,n){if(!e||!e.length)return!1;var r=void 0;if(ct.each(e,function(){r||this.parentNode&&(r=jt(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=Rt(e[0]);o-=l,s-=l,a+=l,i+=l}else ct.each(e,function(e,r){var l=jt(r,t,n);if(l){var c=Rt(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},Dt=function(e){e||(e=ct(ht.getSVGContent()).children());var t=[];return ct(e).children().each(function(e,n){n.getBBox&&t.push(n)}),t.reverse()},Ut=function(e){return e||(e=Dt()),Bt(e,ht.addSvgElementFromJson,ht.pathActions)},Ft=function(e,t){if(!e)return 0;for(var n=e.numberOfItems,r=0;r");var t=e.shortcut||"";Kt("#cmenu_canvas").append("
  • "+e.label+""+t+"
  • ")};function Jt(e,t){["id","class","type"].forEach(function(n){n in t&&(e[n]=t[n])})}var en,tn,nn=(en=n(regeneratorRuntime.mark(function e(t,n){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",rn(t,i({},n,{returnDefault:!0})));case 1:case"end":return e.stop()}},e,this)})),function(e,t){return en.apply(this,arguments)}),rn=(tn=n(regeneratorRuntime.mark(function e(t,n){var r=n.global,a=n.returnDefault;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!!("svgEditor"in window&&window.svgEditor&&!1===window.svgEditor.modules)){e.next=3;break}return e.abrupt("return",on(t,void 0,{returnDefault:a}));case 3:return e.next=5,an(t);case 5:return e.abrupt("return",window[r]);case 6:case"end":return e.stop()}},e,this)})),function(e,t){return tn.apply(this,arguments)});function an(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Array.isArray(e)?Promise.all(e.map(function(e){return an(e,t)})):new Promise(function(n,r){var a=document.createElement("script"),i=function(){a.onerror=null,a.onload=null,a.remove(),a.src=""};a.defer="defer",Jt(a,t),a.onerror=function(){r(new Error("Failed to import: "+e)),i()},a.onload=function(){n(),i()},a.src=e,document.head.append(a)})}function on(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 on(e,t)})):new Promise(function(n,a){var i="$importModule$"+Math.random().toString(32).slice(2),o=document.createElement("script"),s=function(){delete window[i],o.onerror=null,o.onload=null,o.remove(),URL.revokeObjectURL(o.src),o.src=""};Jt(o,t),o.defer="defer",o.type="module",o.onerror=function(){a(new Error("Failed to import: "+e)),s()},o.onload=function(){n(window[i]),s()};var l="import * as m from '"+function(e){var t=document.createElement("a");return t.setAttribute("href",e),t.cloneNode(!1).href}(e).replace(/'/g,"\\'")+"'; window."+i+" = "+(r?"m.default || ":"")+"m;",c=new Blob([l],{type:"text/javascript"});o.src=URL.createObjectURL(c),document.head.append(o)})}var sn=jQuery,ln=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(u.SVG,"g");var o=i.createElementNS(u.SVG,"title");o.textContent=t,this.group_.append(o),n?sn(n).after(this.group_):a.append(this.group_)}cn(this.group_),Ct(this.group_,function(e){e.setAttribute("style","pointer-events:inherit")}),this.group_.setAttribute("style",a?"pointer-events:all":"pointer-events:none")}return a(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 null===e||void 0===e?1:parseFloat(e)}},{key:"setOpacity",value:function(e){"number"==typeof e&&e>=0&&e<=1&&this.group_.setAttribute("opacity",e)}},{key:"appendChildren",value:function(e){for(var t=0;t 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(u.SE,"nonce");a&&pn!==fn.NEVER_RANDOMIZE?this.nonce_=a:pn===fn.ALWAYS_RANDOMIZE&&this.setNonce(Math.floor(100001*Math.random()))}return a(e,[{key:"getElem_",value:function(e){return this.svgElem_.querySelector?this.svgElem_.querySelector("#"+e):dn(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(u.XMLNS,"xmlns:se",u.SE),this.svgElem_.setAttributeNS(u.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),10);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=t)return null;var n=void 0;for(n=0;nn?e0){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;o0||!i?((a=new ln(mn(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(),(void 0===e||null===e||""===e||this.layer_map[e])&&(e=mn(Object.keys(this.layer_map)));var n=new ln(e,null,this.svgElem_);return t&&(t.startBatchCommand("Create Layer"),t.insertElement(n.getGroup()),t.endBatchCommand()),this.all_layers.push(n),this.layer_map[e]=n,this.current_layer=n,n.getGroup()}},{key:"cloneLayer",value:function(e,t){if(!this.current_layer)return null;this.current_layer.deactivate(),(void 0===e||null===e||""===e||this.layer_map[e])&&(e=mn(Object.keys(this.layer_map)));for(var n=this.current_layer.getGroup(),r=new ln(e,n,this.svgElem_),a=r.getGroup(),i=n.childNodes,o=0;o=0?this.all_layers.splice(l+1,0,r):this.all_layers.push(r),this.layer_map[e]=r,this.current_layer=r,a}},{key:"getLayerVisibility",value:function(e){var t=this.layer_map[e];return!!t&&t.isVisible()}},{key:"setLayerVisibility",value:function(e,t){if("boolean"!=typeof t)return null;var n=this.layer_map[e];return n?(n.setVisible(t),n.getGroup()):null}},{key:"getLayerOpacity",value:function(e){var t=this.layer_map[e];return t?t.getOpacity():null}},{key:"setLayerOpacity",value:function(e,t){if(!("number"!=typeof t||t<0||t>1)){var n=this.layer_map[e];n&&n.setOpacity(t)}}},{key:"copyElem",value:function(e){var t=this;return function e(t,n){var r=document.createElementNS(t.namespaceURI,t.nodeName);if(ct.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(),L()&&"path"===t.nodeName){var a=tt(t);r.setAttribute("d",a)}if(ct.each(t.childNodes,function(t,a){switch(a.nodeType){case 1:r.append(e(a,n));break;case 3:r.textContent=a.nodeValue}}),ct(t).data("gsvg"))ct(r).data("gsvg",r.firstChild);else if(ct(t).data("symbol")){var i=ct(t).data("symbol");ct(r).data("ref",i).data("symbol",i)}else"image"===r.tagName&&Qt(r);return r}(e,function(){return t.getNextId()})}}]),e}(),yn=function(e,t){(pn=!1===e?fn.NEVER_RANDOMIZE:fn.ALWAYS_RANDOMIZE)!==fn.ALWAYS_RANDOMIZE||t.getNonce()?pn===fn.NEVER_RANDOMIZE&&t.getNonce()&&t.clearNonce():t.setNonce(Math.floor(100001*Math.random()))},bn=void 0,xn=function(e){bn=e},wn=function(){Sn(),bn.getCurrentDrawing().identifyLayers()},Sn=function(){var e=gn.length;if(e){for(var t=0;t0){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(pe(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&&Ht(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 d=n.createSVGTransformFromMatrix(ge(s[1][0],s[0][0]));r.removeItem(s[0][1]),r.removeItem(s[1][1]),r.insertItemBefore(d,s[1][1])}if((l=r.numberOfItems)>=2&&1===r.getItem(l-2).type&&2===r.getItem(l-1).type){var h=n.createSVGTransform(),f=ge(r.getItem(l-2).matrix,r.getItem(l-1).matrix);h.setMatrix(f),r.removeItem(l-2),r.removeItem(l-2),r.appendItem(h)}}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=Mn(t).data("gsvg"),g=new ce("Transform"),v={},m=null,_=[];switch(t.tagName){case"line":_=["x1","y1","x2","y2"];break;case"circle":_=["cx","cy","r"];break;case"ellipse":_=["cx","cy","rx","ry"];break;case"foreignObject":case"rect":case"image":_=["width","height","x","y"];break;case"use":case"text":case"tspan":_=["x","y"];break;case"polygon":case"polyline":(m={}).points=t.getAttribute("points");var y=t.points,b=y.numberOfItems;v.points=new Array(b);for(var x=0;x1e-10?Math.sin(P)/(1-Math.cos(P)):2/P;for(var I=0;I=3&&3===r.getItem(M-2).type&&2===r.getItem(M-3).type&&2===r.getItem(M-1).type){j=3;for(var D=r.getItem(M-3).matrix,U=r.getItem(M-2).matrix,F=r.getItem(M-1).matrix,H=t.childNodes,z=H.length;z--;){var q=H.item(z);if(O=0,V=0,1===q.nodeType){var Y=W(q);if(!Y)continue;var X=_e(Y).matrix,Q=Ht(q);if(B=On.getStartTransform(),On.setStartTransform(q.getAttribute("transform")),Q||ve(Y)){var K=n.createSVGTransform();K.setMatrix(ge(D,U,F,X)),Y.clear(),Y.appendItem(K)}else{var Z=ge(X.inverse(),F,X),$=n.createSVGMatrix();$.e=-Z.e,$.f=-Z.f;var J=ge($.inverse(),X.inverse(),D,U,F,X,Z.inverse()),ee=n.createSVGTransform(),te=n.createSVGTransform(),re=n.createSVGTransform();ee.setTranslate(Z.e,Z.f),te.setScale(J.a,J.d),re.setTranslate($.e,$.f),Y.appendItem(re),Y.appendItem(te),Y.appendItem(ee)}g.addSubCommand(e(q)),On.setStartTransform(B)}}r.removeItem(M-1),r.removeItem(M-2),r.removeItem(M-3)}else if(M>=3&&1===r.getItem(M-1).type){j=3,A=_e(r).matrix;var ae=n.createSVGTransform();ae.setMatrix(A),r.clear(),r.appendItem(ae)}else if((1===M||M>1&&3!==r.getItem(1).type)&&2===r.getItem(0).type){j=2;var ie=_e(r).matrix;r.removeItem(0);var oe=_e(r).matrix.inverse(),se=ge(oe,ie);if(O=se.e,V=se.f,0!==O||0!==V){for(var ue=t.childNodes,de=ue.length,he=[];de--;){var me=ue.item(de);if(1===me.nodeType){if(me.getAttribute("clip-path")){var ye=me.getAttribute("clip-path");he.includes(ye)||(Vn(ye,O,V),he.push(ye))}B=On.getStartTransform(),On.setStartTransform(me.getAttribute("transform"));var be=W(me);if(be){var xe=n.createSVGTransform();xe.setTranslate(O,V),be.numberOfItems?be.insertItemBefore(xe,0):be.appendItem(xe),g.addSubCommand(e(me));for(var we=t.getElementsByTagNameNS(u.SVG,"use"),Se="#"+me.id,ke=we.length;ke--;){var Ce=we.item(ke);if(Se===Et(Ce)){var Ae=n.createSVGTransform();Ae.setTranslate(-O,-V),W(Ce).insertItemBefore(Ae,0),g.addSubCommand(e(Ce))}}On.setStartTransform(B)}}}he=[],On.setStartTransform(B)}}else{if(1!==M||1!==r.getItem(0).type||E){if(E){var Ee=n.createSVGTransform();Ee.setRotate(E,k.x,k.y),r.numberOfItems?r.insertItemBefore(Ee,0):r.appendItem(Ee)}return 0===r.numberOfItems&&t.removeAttribute("transform"),null}j=1;for(var Pe=r.getItem(0).matrix,Ge=t.childNodes,Ie=Ge.length;Ie--;){var Te=Ge.item(Ie);if(1===Te.nodeType){B=On.getStartTransform(),On.setStartTransform(Te.getAttribute("transform"));var Ne=W(Te);if(!Ne)continue;var Le=ge(Pe,_e(Ne).matrix),Me=n.createSVGTransform();Me.setMatrix(Le),Ne.clear(),Ne.appendItem(Me,0),g.addSubCommand(e(Te)),On.setStartTransform(B);var Oe=Te.getAttribute("stroke-width");if("none"!==Te.getAttribute("stroke")&&!isNaN(Oe)){var Ve=(Math.abs(Le.a)+Math.abs(Le.d))/2;Te.setAttribute("stroke-width",Oe*Ve)}}}r.clear()}if(2===j){if(E){k={x:S.x+R.e,y:S.y+R.f};var je=n.createSVGTransform();je.setRotate(E,k.x,k.y),r.numberOfItems?r.insertItemBefore(je,0):r.appendItem(je)}}else if(3===j){var Re=_e(r).matrix,Be=n.createSVGTransform();Be.setRotate(E,S.x,S.y);var De=Be.matrix,Ue=n.createSVGTransform();Ue.setRotate(E,k.x,k.y);var Fe=Ue.matrix.inverse(),He=Re.inverse(),ze=ge(He,Fe,De,Re);if(O=ze.e,V=ze.f,0!==O||0!==V)for(var qe=t.childNodes,Ye=qe.length;Ye--;){var We=qe.item(Ye);if(1===We.nodeType){B=On.getStartTransform(),On.setStartTransform(We.getAttribute("transform"));var Xe=W(We),Qe=n.createSVGTransform();Qe.setTranslate(O,V),Xe.numberOfItems?Xe.insertItemBefore(Qe,0):Xe.appendItem(Qe),g.addSubCommand(e(We)),On.setStartTransform(B)}}E&&(r.numberOfItems?r.insertItemBefore(Ue,0):r.appendItem(Ue))}}else{var Ke=Nt(t);if(!Ke&&"path"!==t.tagName)return null;var Ze=n.createSVGMatrix(),$e=Ht(t);if($e){S={x:Ke.x+Ke.width/2,y:Ke.y+Ke.height/2},k=fe(Ke.x+Ke.width/2,Ke.y+Ke.height/2,_e(r).matrix);for(var Je=$e*Math.PI/180,et=Math.abs(Je)>1e-10?Math.sin(Je)/(1-Math.cos(Je)):2/Je,tt=0;tt=3&&3===r.getItem(it-2).type&&2===r.getItem(it-3).type&&2===r.getItem(it-1).type)at=3,Ze=_e(r,it-3,it-1).matrix,r.removeItem(it-1),r.removeItem(it-2),r.removeItem(it-3);else if(4===it&&1===r.getItem(it-1).type){at=3,Ze=_e(r).matrix;var ht=n.createSVGTransform();ht.setMatrix(Ze),r.clear(),r.appendItem(ht),Ze=n.createSVGMatrix()}else if((1===it||it>1&&3!==r.getItem(1).type)&&2===r.getItem(0).type){at=2;var ft=r.getItem(0).matrix,pt=_e(r,1).matrix,gt=pt.inverse();Ze=ge(gt,ft,pt),r.removeItem(0)}else{if(1!==it||1!==r.getItem(0).type||$e){if(at=4,$e){var vt=n.createSVGTransform();vt.setRotate($e,k.x,k.y),r.numberOfItems?r.insertItemBefore(vt,0):r.appendItem(vt)}return 0===r.numberOfItems&&t.removeAttribute("transform"),null}switch(Ze=_e(r).matrix,t.tagName){case"line":v=Mn(t).attr(["x1","y1","x2","y2"]);case"polyline":case"polygon":if(v.points=t.getAttribute("points"),v.points){var mt=t.points,_t=mt.numberOfItems;v.points=new Array(_t);for(var yt=0;yt<_t;++yt){var bt=mt.getItem(yt);v.points[yt]={x:bt.x,y:bt.y}}}case"path":v.d=t.getAttribute("d"),at=1,r.clear()}}if(1!==at&&2!==at&&3!==at||Ln(t,v,Ze),2===at){if($e){ve(r)||(k={x:S.x+Ze.e,y:S.y+Ze.f});var xt=n.createSVGTransform();xt.setRotate($e,k.x,k.y),r.numberOfItems?r.insertItemBefore(xt,0):r.appendItem(xt)}if("text"===t.tagName)for(var wt=t.childNodes,St=wt.length;St--;){var kt=wt.item(St);if("tspan"===kt.tagName){var Ct={x:Mn(kt).attr("x")||0,y:Mn(kt).attr("y")||0};Ln(kt,Ct,Ze)}}}else if(3===at&&$e){var At=_e(r).matrix,Pt=n.createSVGTransform();Pt.setRotate($e,S.x,S.y);var Gt=Pt.matrix,It=n.createSVGTransform();It.setRotate($e,k.x,k.y);var Tt=It.matrix.inverse(),Lt=At.inverse(),Mt=ge(Lt,Tt,Gt,At);Ln(t,v,Mt),$e&&(r.numberOfItems?r.insertItemBefore(It,0):r.appendItem(It))}}return 0===r.numberOfItems&&t.removeAttribute("transform"),g.addSubCommand(new le(t,m)),g},Rn=jQuery,Bn=void 0,Dn=void 0,Un=void 0,Fn=R()?10:4,Hn=function(){function e(t,n,a){r(this,e),this.id=t,this.selectedElement=n,this.locked=!0,this.selectorGroup=Bn.createSVGElement({element:"g",attr:{id:"selectorGroup"+this.id}}),this.selectorRect=this.selectorGroup.appendChild(Bn.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 a(e,[{key:"reset",value:function(e,t){this.locked=!0,this.selectedElement=e,this.resize(t),this.selectorGroup.setAttribute("display","inline")}},{key:"updateGripCursors",value:function(e){var t=void 0,n=[],r=Math.round(e/45);for(t in r<0&&(r+=8),Un.selectorGrips)n.push(t);for(;r>0;)n.push(n.shift()),r--;var a=0;for(t in Un.selectorGrips)Un.selectorGrips[t].setAttribute("style","cursor:"+n[a]+"-resize"),a++}},{key:"showGrips",value:function(e){var t=e?"inline":"none";Un.selectorGripsGroup.setAttribute("display",t);var n=this.selectedElement;this.hasGrips=e,n&&e&&(this.selectorGroup.append(Un.selectorGripsGroup),this.updateGripCursors(Ht(n)))}},{key:"resize",value:function(e){var t=this.selectorRect,n=Un,r=n.selectorGrips,a=this.selectedElement,i=a.getAttribute("stroke-width"),o=Bn.getCurrentZoom(),s=1/o;"none"===a.getAttribute("stroke")||isNaN(i)||(s+=i/2);var l=a.tagName;"text"===l&&(s+=2/o);var c=W(a),u=_e(c).matrix;if(u.e*=o,u.f*=o,e||(e=Nt(a)),"g"===l&&!Rn.data(a,"gsvg")){var d=Bt([a.childNodes]);d&&(e=d)}var h=e.x,f=e.y,p=e.width,g=e.height;e={x:h,y:f,width:p,height:g},s*=o;var v=me(h*o,f*o,p*o,g*o,u),m=v.aabox,_=m.x-s,y=m.y-s,b=m.width+2*s,x=m.height+2*s,w=_+b/2,S=y+x/2,k=Ht(a);if(k){var C=Bn.svgRoot().createSVGTransform();C.setRotate(-k,w,S);var A=C.matrix;v.tl=fe(v.tl.x,v.tl.y,A),v.tr=fe(v.tr.x,v.tr.y,A),v.bl=fe(v.bl.x,v.bl.y,A),v.br=fe(v.br.x,v.br.y,A);var E=v.tl,P=E.x,G=E.y,I=E.x,T=E.y,N=Math.min,L=Math.max;_=P=N(P,N(v.tr.x,N(v.bl.x,v.br.x)))-s,y=G=N(G,N(v.tr.y,N(v.bl.y,v.br.y)))-s,b=(I=L(I,L(v.tr.x,L(v.bl.x,v.br.x)))+s)-P,x=(T=L(T,L(v.tr.y,L(v.bl.y,v.br.y)))+s)-G}var M="M"+_+","+y+" L"+(_+b)+","+y+" "+(_+b)+","+(y+x)+" "+_+","+(y+x)+"z";t.setAttribute("d",M);var O=k?"rotate("+[k,w,S].join(",")+")":"";for(var V in this.selectorGroup.setAttribute("transform",O),this.gripCoords={nw:[_,y],ne:[_+b,y],sw:[_,y+x],se:[_+b,y+x],n:[_+b/2,y],w:[_,y+x/2],e:[_+b,y+x/2],s:[_+b/2,y+x]},this.gripCoords){var j=this.gripCoords[V];r[V].setAttribute("cx",j[0]),r[V].setAttribute("cy",j[1])}n.rotateGripConnector.setAttribute("x1",_+b/2),n.rotateGripConnector.setAttribute("y1",y),n.rotateGripConnector.setAttribute("x2",_+b/2),n.rotateGripConnector.setAttribute("y2",y-5*Fn),n.rotateGrip.setAttribute("cx",_+b/2),n.rotateGrip.setAttribute("cy",y-5*Fn)}}]),e}(),zn=function(){function e(){r(this,e),this.selectorParentGroup=null,this.rubberBandBox=null,this.selectors=[],this.selectorMap={},this.selectorGrips={nw:null,n:null,ne:null,e:null,se:null,s:null,sw:null,w:null},this.selectorGripsGroup=null,this.rotateGripConnector=null,this.rotateGrip=null,this.initGroup()}return a(e,[{key:"initGroup",value:function(){for(var e in this.selectorParentGroup&&this.selectorParentGroup.parentNode&&this.selectorParentGroup.remove(),this.selectorParentGroup=Bn.createSVGElement({element:"g",attr:{id:"selectorParentGroup"}}),this.selectorGripsGroup=Bn.createSVGElement({element:"g",attr:{display:"none"}}),this.selectorParentGroup.append(this.selectorGripsGroup),Bn.svgRoot().append(this.selectorParentGroup),this.selectorMap={},this.selectors=[],this.rubberBandBox=null,this.selectorGrips){var t=Bn.createSVGElement({element:"circle",attr:{id:"selectorGrip_resize_"+e,fill:"#22C",r:Fn,style:"cursor:"+e+"-resize","stroke-width":2,"pointer-events":"all"}});Rn.data(t,"dir",e),Rn.data(t,"type","resize"),this.selectorGrips[e]=this.selectorGripsGroup.appendChild(t)}if(this.rotateGripConnector=this.selectorGripsGroup.appendChild(Bn.createSVGElement({element:"line",attr:{id:"selectorGrip_rotateconnector",stroke:"#22C","stroke-width":"1"}})),this.rotateGrip=this.selectorGripsGroup.appendChild(Bn.createSVGElement({element:"circle",attr:{id:"selectorGrip_rotate",fill:"lime",r:Fn,stroke:"#22C","stroke-width":2,style:"cursor:url("+Dn.imgPath+"rotate.png) 12 12, auto;"}})),Rn.data(this.rotateGrip,"type","rotate"),!Rn("#canvasBackground").length){var n=Dn.dimensions,r=Bn.createSVGElement({element:"svg",attr:{id:"canvasBackground",width:n[0],height:n[1],x:0,y:0,overflow:L()?"none":"visible",style:"pointer-events:none"}}),a=Bn.createSVGElement({element:"rect",attr:{width:"100%",height:"100%",x:0,y:0,"stroke-width":1,stroke:"#000",fill:"#FFF",style:"pointer-events:none"}});r.append(a),Bn.svgRoot().insertBefore(r,Bn.svgContent())}}},{key:"requestSelector",value:function(e,n){if(null==e)return null;var r=this.selectors.length;if("object"===t(this.selectorMap[e.id]))return this.selectorMap[e.id].locked=!0,this.selectorMap[e.id];for(var a=0;a').documentElement,!0);a.append(h);var f=c.createElementNS(u.SVG,"svg");(l.clearSvgContentElement=function(){qn(f).empty(),qn(f).attr({id:"svgcontent",width:s[0],height:s[1],x:s[0],y:s[1],overflow:o.show_outside_canvas?"visible":"hidden",xmlns:u.SVG,"xmlns:se":u.SE,"xmlns:xlink":u.XLINK}).appendTo(h);var e=c.createComment(" Created with SVG-edit - https://github.com/SVG-Edit/svgedit");f.append(e)})();var p="svg_";l.setIdPrefix=function(e){p=e},l.current_drawing_=new _n(f,p);var g=l.getCurrentDrawing=function(){return l.current_drawing_},v=1,m=null,_={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}};_.text=qn.extend(!0,{},_.shape),qn.extend(_.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 y=_.shape,b=[],x=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]=x(a);return n},w=this.addSvgElementFromJson=function(e){if("string"==typeof e)return c.createTextNode(e);var t=qt(e.attr.id),n=g().getCurrentLayer();if(t&&e.element!==t.tagName&&(t.remove(),t=null),!t){var r=e.namespace||u.SVG;t=c.createElementNS(r,e.element),n&&(m||n).append(t)}return e.curStyles&&Yt(t,{fill:y.fill,stroke:y.stroke,"stroke-width":y.stroke_width,"stroke-dasharray":y.stroke_dasharray,"stroke-linejoin":y.stroke_linejoin,"stroke-linecap":y.stroke_linecap,"stroke-opacity":y.stroke_opacity,"fill-opacity":y.fill_opacity,opacity:y.opacity/2,style:"pointer-events:inherit"},100),Yt(t,e.attr,100),Wt(t),e.children&&e.children.forEach(function(e){t.append(w(e))}),t};l.getTransformList=W,l.matrixMultiply=ge,l.hasMatrixTransform=ve,l.transformListToTransform=_e,function(e){Z=e;var t=document.createElementNS(u.SVG,"svg");document.body.append(t);var n=document.createElementNS(u.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;$={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:function(){return o.baseUnit},getElement:qt,getHeight:function(){return f.getAttribute("height")/v},getWidth:function(){return f.getAttribute("width")/v},getRoundDigits:function(){return ce.round_digits}}),l.convertToNum=ne;var S,k=function(){return f},C=this.getSelectedElems=function(){return b},A=lt;ht=S={pathActions:A,getSVGContent:k,addSvgElementFromJson:w,getSelectedElements:C,getDOMDocument:function(){return c},getDOMContainer:function(){return a},getSVGRoot:function(){return h},getBaseUnit:function(){return o.baseUnit},getSnappingStep:function(){return o.snappingStep}},ft=S.getDOMDocument(),pt=S.getDOMContainer(),gt=S.getSVGRoot(),l.findDefs=Gt,l.getUrlFromAttr=At,l.getHref=Et,l.setHref=Pt,l.getBBox=Nt,l.getRotationAngle=Ht,l.getElem=qt,l.getRefElem=zt,l.assignAttributes=Yt,this.cleanupElement=Wt;var P=function(){return o.gridSnapping};!function(e){Nn=e}({getDrawing:function(){return g()},getSVGRoot:function(){return h},getGridSnapping:P}),this.remapElement=Ln,function(e){On=e}({getSVGRoot:function(){return h},getStartTransform:function(){return Ee},setStartTransform:function(e){Ee=e}}),this.recalculateDimensions=jn;var G=d();l.sanitizeSvg=Gn;var I=l.undoMgr=new Zn({handleHistoryEvent:function(e,t){var n=$n;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(),F("changed",r);var a=t.type(),i=e===n.AFTER_APPLY;if(a===Yn.type())(i?t.newParent:t.oldParent)===f&&wn();else if(a===Wn.type()||a===Xn.type())t.parent===f&&wn(),a===Wn.type()?i&&se(t.elem):i||se(t.elem),"use"===t.elem.tagName&&Bt(t.elem);else if(a===Qn.type()){"title"===t.elem.tagName&&t.elem.parentNode.parentNode===f&&wn();var o=i?t.newValues:t.oldValues;o.stdDeviation&&l.setBlurOffsets(t.elem.parentNode,o.stdDeviation)}}}}),T=function(e){l.undoMgr.addCommandToHistory(e)},N=this.getZoom=function(){return v},j=this.round=function(e){return parseInt(e*v,10)/v};!function(e,t){Dn=e,Bn=t,Un=new zn}(o,{createSVGElement:function(e){return l.addSvgElementFromJson(e)},svgRoot:function(){return h},svgContent:function(){return f},getCurrentZoom:N});var R=this.selectorManager=Un,B=l.getNextId=function(){return g().getNextId()},U=l.getId=function(){return g().getId()},F=function(e,t){if(Fe[e])return Fe[e](window,t)},H=function(e){b.map(function(e){null!=e&&R.releaseSelector(e)}),b=[],e||F("selected",b)},Y=function(e,t){if(e.length){for(var n=0;n1&&o.showGrips(!1)}}}for(F("selected",b),t||1===b.length?R.requestSelector(b[0]).showGrips(!0):R.requestSelector(b[0]).showGrips(!1),b.sort(function(e,t){return e&&t&&e.compareDocumentPosition?3-(6&t.compareDocumentPosition(e)):null==e?1:void 0});null==b[0];)b.shift(0)}},X=function(){return y.opacity},Q=this.getMouseTarget=function(e){if(null==e)return null;var t=e.target;if(t.correspondingUseElement&&(t=t.correspondingUseElement),[u.MATH,u.HTML].includes(t.namespaceURI)&&"svgcanvas"!==t.id)for(;"foreignObject"!==t.nodeName;)if(!(t=t.parentNode))return h;var n=g().getCurrentLayer();if([h,a,f,n].includes(t))return h;if(qn(t).closest("#selectorParentGroup").length)return R.selectorParentGroup;for(;t.parentNode!==(m||n);)t=t.parentNode;return t};l.pathActions=A,Te({selectorManager:R,canvas:l,call:F,resetD:function(e){e.setAttribute("d",A.convertPath(e))},round:j,clearSelection:H,addToSelection:Y,addCommandToHistory:T,remapElement:Ln,addSvgElementFromJson:w,getGridSnapping:P,getOpacity:X,getSelectedElements:C,getContainer:function(){return a},setStarted:function(e){Ae=e},getRubberBox:function(){return Oe},setRubberBox:function(e){return Oe=e},addPtsToSelection:function(e){var t=e.closedSubpath,n=e.grips;A.canDeleteNodes=!0,A.closed_subpath=t,F("pointsAdded",{closedSubpath:t,grips:n}),F("selected",n)},endChanges:function(e){var t=e.cmd,n=e.elem;T(t),F("changed",[n])},getCurrentZoom:N,getId:U,getNextId:B,getMouseTarget:Q,getCurrentMode:function(){return Ie},setCurrentMode:function(e){return Ie=e},getDrawnPath:function(){return bt},setDrawnPath:function(e){return bt=e},getSVGRoot:function(){return h}});var K={},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"],ie=qn.data,oe=document.createElementNS(u.SVG,"animate");qn(oe).attr({attributeName:"opacity",begin:"indefinite",dur:1,fill:"freeze"}).appendTo(h);var se=function e(t){var n=qn(t).attr(ae);for(var r in n){var a=n[r];if(a&&a.startsWith("url(")){var i=At(a).substr(1);qt(i)||(Gt().append(Se[i]),delete Se[i])}}var o=t.getElementsByTagName("*");if(o.length)for(var s=0,l=o.length;s0&&(4===s.getItem(0).type&&s.removeItem(0));if(0!==e){var l=fe(i,o,_e(s).matrix),c=h.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 u=n.getAttribute("transform");n.setAttribute("transform",r),nn("transform",u,b),F("changed",b)}var d=R.requestSelector(b[0]);d.resize(),d.updateGripCursors(e)};var ze=this.recalculateAllSelectedDimensions=function(){for(var e=new Kn("none"===Ne?"position":"size"),t=b.length;t--;){var n=b[t],r=jn(n);r&&e.addSubCommand(r)}e.isEmpty()||(T(e),F("changed",b))},qe=function(e){console.log([e.a,e.b,e.c,e.d,e.e,e.f])},We=null;this.clearSelection=H,this.addToSelection=Y;var Xe=this.selectOnly=function(e,t){H(!0),Y(e,t)};this.removeFromSelection=function(e){if(null!=b[0]&&e.length){var t=0,n=[],r=b.length;n.length=r;for(var a=0;a0&&l.removeFromSelection(P),G.length>0&&l.addToSelection(G);break;case"resize":k=W(f);var L=ve(k),M=(d=L?tt:Nt(f)).x,O=d.y,V=d,j=V.width,B=V.height;if(i=x-Ze,s=S-$e,o.gridSnapping&&(i=Xt(i),s=Xt(s),B=Xt(B),j=Xt(j)),u=Ht(f)){var D=Math.sqrt(i*i+s*s),H=Math.atan2(s,i)-u*Math.PI/180;i=D*Math.cos(H),s=D*Math.sin(H)}Ne.includes("n")||Ne.includes("s")||(s=0),Ne.includes("e")||Ne.includes("w")||(i=0);var z=0,q=0,Y=B?(B+s)/B:1,X=j?(j+i)/j:1;Ne.includes("n")&&(Y=B?(B-s)/B:1,q=B),Ne.includes("w")&&(X=j?(j-i)/j:1,z=j);var Q=h.createSVGTransform(),K=h.createSVGTransform(),Z=h.createSVGTransform();if(o.gridSnapping&&(M=Xt(M),z=Xt(z),O=Xt(O),q=Xt(q)),Q.setTranslate(-(M+z),-(O+q)),e.shiftKey&&(1===X?X=Y:Y=X),K.setScale(X,Y),Z.setTranslate(M+z,O+q),L){var $=u?1:0;k.replaceItem(Q,2+$),k.replaceItem(K,1+$),k.replaceItem(Z,Number($))}else{var J=k.numberOfItems;k.replaceItem(Z,J-3),k.replaceItem(K,J-2),k.replaceItem(Q,J-1)}R.requestSelector(f).resize(),F("transition",b);break;case"zoom":y*=v,w*=v,Yt(Oe,{x:Math.min(Je*v,y),y:Math.min(et*v,w),width:Math.abs(y-Je*v),height:Math.abs(w-et*v)},100);break;case"text":Yt(_,{x:x,y:S},1e3);break;case"line":o.gridSnapping&&(x=Xt(x),S=Xt(S));var ee=x,te=S;e.shiftKey&&(ee=(n=be(Ze,$e,ee,te)).x,te=n.y),_.setAttributeNS(null,"x2",ee),_.setAttributeNS(null,"y2",te);break;case"foreignObject":case"square":case"rect":case"image":var ne="square"===Ie||e.shiftKey,re=Math.abs(x-Ze),ae=Math.abs(S-$e),ie=void 0,oe=void 0;ne?(re=ae=Math.max(re,ae),ie=Ze.8&&(Ke+=+st.x+","+st.y+" ",_.setAttributeNS(null,"points",Ke),nt-=.8);rt={x:at.x,y:at.y},at={x:it.x,y:it.y},it={x:ot.x,y:ot.y};break;case"path":case"pathedit":if(x*=v,S*=v,o.gridSnapping&&(x=Xt(x),S=Xt(S),Ze=Xt(Ze),$e=Xt($e)),e.shiftKey){var de=Ge,he=void 0,pe=void 0;de?(he=de.dragging?de.dragging[0]:Ze,pe=de.dragging?de.dragging[1]:$e):(he=Ze,pe=$e);var ge=n=be(he,pe,x,S);x=ge.x,S=ge.y}Oe&&"none"!==Oe.getAttribute("display")&&(y*=v,w*=v,Yt(Oe,{x:Math.min(Je*v,y),y:Math.min(et*v,w),width:Math.abs(y-Je*v),height:Math.abs(w-et*v)},100)),A.mouseMove(x,S);break;case"textedit":x*=v,S*=v,St.mouseMove(g,m);break;case"rotate":r=(d=Nt(f)).x+d.width/2,a=d.y+d.height/2;var me=ye(f),_e=fe(r,a,me);r=_e.x,a=_e.y,u=(Math.atan2(a-S,r-x)*(180/Math.PI)-90)%360,o.gridSnapping&&(u=Xt(u)),e.shiftKey&&(u=45*Math.round(u/45)),l.setRotationAngle(u<-180?360+u:u,!0),F("transition",b)}Re("mouseMove",{event:e,mouse_x:g,mouse_y:m,selected:f})}}).click(function(e){return e.preventDefault(),!1}).dblclick(function(e){var t=e.target.parentNode;if(t!==m){var n=Q(e),r=n.tagName;if("text"===r&&"textedit"!==Ie){var a=fe(e.pageX,e.pageY,We);St.select(n,a.x,a.y)}"g"!==r&&"a"!==r||!Ht(n)||(on(n),n=b[0],H(!0)),m&&Sn(),"g"!==t.tagName&&"a"!==t.tagName||t===g().getCurrentLayer()||n===R.selectorParentGroup||kn(n)}}).mouseup(function(e){if(2!==e.button){var t=Me;if(Me=null,Ae){var n=fe(e.pageX,e.pageY,We),r=n.x*v,a=n.y*v,i=r/v,s=a/v,c=qt(U()),u=!1,d=i,h=s;Ae=!1;var f=void 0,p=void 0;switch(Ie){case"resize":case"multiselect":null!=Oe&&(Oe.setAttribute("display","none"),Ve=[]),Ie="select";case"select":if(null!=b[0]){if(null==b[1]){var m=b[0];switch(m.tagName){case"g":case"use":case"image":case"foreignObject":break;default:Le.fill=m.getAttribute("fill"),Le.fill_opacity=m.getAttribute("fill-opacity"),Le.stroke=m.getAttribute("stroke"),Le.stroke_opacity=m.getAttribute("stroke-opacity"),Le.stroke_width=m.getAttribute("stroke-width"),Le.stroke_dasharray=m.getAttribute("stroke-dasharray"),Le.stroke_linejoin=m.getAttribute("stroke-linejoin"),Le.stroke_linecap=m.getAttribute("stroke-linecap")}"text"===m.tagName&&(he.font_size=m.getAttribute("font-size"),he.font_family=m.getAttribute("font-family")),R.requestSelector(m).showGrips(!0)}if(ze(),d!==Je||h!==et)for(var _=b.length,x=0;x<_&&null!=b[x];++x)b[x].firstChild||R.requestSelector(b[x]).resize();else p=e.target,"path"===b[0].nodeName&&null==b[1]?A.select(b[0]):e.shiftKey&&t!==p&&l.removeFromSelection([p]);if(D()){var S=b[0];S&&(S.removeAttribute("style"),Ct(S,function(e){e.removeAttribute("style")}))}}return;case"zoom":null!=Oe&&Oe.setAttribute("display","none");var k=e.shiftKey?.5:2;return void F("zoomed",{x:Math.min(Je,d),y:Math.min(et,h),width:Math.abs(d-Je),height:Math.abs(h-et),factor:k});case"fhpath":nt=0,rt={x:0,y:0},at={x:0,y:0},it={x:0,y:0},ot={x:0,y:0};var C=c.getAttribute("points"),E=C.indexOf(",");(u=E>=0?C.indexOf(",",E+1)>=0:C.indexOf(" ",C.indexOf(" ")+1)>=0)&&(c=A.smoothPolylineIntoPath(c));break;case"line":f=qn(c).attr(["x1","x2","y1","y2"]),u=f.x1!==f.x2||f.y1!==f.y2;break;case"foreignObject":case"square":case"rect":case"image":f=qn(c).attr(["width","height"]),u="0"!==f.width||"0"!==f.height||"image"===Ie;break;case"circle":u="0"!==c.getAttribute("r");break;case"ellipse":f=qn(c).attr(["rx","ry"]),u=null!=f.rx||null!=f.ry;break;case"fhellipse":Qe.maxx-Qe.minx>0&&Qe.maxy-Qe.miny>0&&(c=w({element:"ellipse",curStyles:!0,attr:{cx:(Qe.minx+Qe.maxx)/2,cy:(Qe.miny+Qe.maxy)/2,rx:(Qe.maxx-Qe.minx)/2,ry:(Qe.maxy-Qe.miny)/2,id:U()}}),F("changed",[c]),u=!0);break;case"fhrect":Qe.maxx-Qe.minx>0&&Qe.maxy-Qe.miny>0&&(c=w({element:"rect",curStyles:!0,attr:{x:Qe.minx,y:Qe.miny,width:Qe.maxx-Qe.minx,height:Qe.maxy-Qe.miny,id:U()}}),F("changed",[c]),u=!0);break;case"text":u=!0,Xe([c]),St.start(c);break;case"path":c=null,Ae=!0;var P=A.mouseUp(e,c,r,a);c=P.element,u=P.keep;break;case"pathedit":u=!0,c=null,A.mouseUp(e);break;case"textedit":u=!1,c=null,St.mouseUp(e,r,a);break;case"rotate":u=!0,c=null,Ie="select";var G=l.undoMgr.finishUndoableChange();G.isEmpty()||T(G),ze(),F("changed",b)}var I=Re("mouseUp",{event:e,mouse_x:r,mouse_y:a},!0);if(qn.each(I,function(e,t){t&&(u=t.keep||u,c=t.element,Ae=t.started||Ae)}),u||null==c){if(null!=c){l.addedNew=!0;var N=.2,L=void 0;if(oe.beginElement&&parseFloat(c.getAttribute("opacity"))!==y.opacity){L=qn(oe).clone().attr({to:y.opacity,dur:N}).appendTo(c);try{L[0].beginElement()}catch(e){}}else N=0;setTimeout(function(){L&&L.remove(),c.setAttribute("opacity",y.opacity),c.setAttribute("style","pointer-events:inherit"),Wt(c),"path"===Ie?A.toEditMode(c):o.selectNew&&Xe([c],!0),T(new Wn(c)),F("changed",[c])},1e3*N)}}else{for(g().releaseId(U()),c.remove(),c=null,p=e.target;p&&p.parentNode&&p.parentNode.parentNode&&"g"===p.parentNode.parentNode.tagName;)p=p.parentNode;"path"===Ie&&bt||!p||!p.parentNode||"selectorParentGroup"===p.parentNode.id||"svgcanvas"===p.id||"svgroot"===p.id||(l.setMode("select"),Xe([p],!0))}Ee=null}}}),qn(a).bind("mousewheel DOMMouseScroll",function(e){if(e.shiftKey){e.preventDefault();var t=e.originalEvent;We=qn("#svgcontent g")[0].getScreenCTM().inverse();var n=qn("#workarea"),r=o.showRulers?16:0,a=fe(t.pageX,t.pageY,We),i=n.width(),s=n.height(),c=i-15-r,u=s-15-r,d=c*We.a,h=u*We.d,f=n.offset(),p=f.left+r,g=f.top+r,m=t.wheelDelta?t.wheelDelta:t.detail?-t.detail:0;if(m){var _=Math.max(.75,Math.min(4/3,m)),y=void 0,b=void 0;_>1?(y=Math.ceil(c/d*_*100)/100,b=Math.ceil(u/h*_*100)/100):(y=Math.floor(c/d*_*100)/100,b=Math.floor(u/h*_*100)/100);var x=Math.min(y,b);if((x=Math.min(10,Math.max(.01,x)))!==v){_=x/v;var w=fe(p,g,We),S={x:(a.x-(a.x-w.x)/_)*x-r+i/2,y:(a.y-(a.y-w.y)/_)*x-r+s/2};l.setZoom(x),qn("#zoom").val((100*x).toFixed(1)),F("updateCanvas",{center:!1,newCtr:S}),F("zoomDone")}}}});var St=l.textActions=function(){var e=void 0,t=void 0,n=void 0,r=void 0,a=void 0,i=[],o=void 0,s=void 0,c=void 0,d=void 0,f=void 0;function p(e){var s=""===t.value;if(qn(t).focus(),!arguments.length)if(s)e=0;else{if(t.selectionEnd!==t.selectionStart)return;e=t.selectionEnd}var l=i[e];s||t.setSelectionRange(e,e),(n=qt("text_cursor"))||(n=document.createElementNS(u.SVG,"line"),Yt(n,{id:"text_cursor",stroke:"#333","stroke-width":1}),n=qt("selectorParentGroup").appendChild(n)),a||(a=setInterval(function(){var e="none"===n.getAttribute("display");n.setAttribute("display",e?"inline":"none")},600));var c=w(l.x,o.y),d=w(l.x,o.y+o.height);Yt(n,{x1:c.x,y1:c.y,x2:d.x,y2:d.y,visibility:"visible",display:"inline"}),r&&r.setAttribute("d","")}function g(e,a,s){if(e!==a){s||t.setSelectionRange(e,a),(r=qt("text_selectblock"))||(r=document.createElementNS(u.SVG,"path"),Yt(r,{id:"text_selectblock",fill:"green",opacity:.5,style:"pointer-events:none"}),qt("selectorParentGroup").append(r));var l=i[e],c=i[a];n.setAttribute("visibility","hidden");var d=w(l.x,o.y),h=w(l.x+(c.x-l.x),o.y),f=w(l.x,o.y+o.height),g=w(l.x+(c.x-l.x),o.y+o.height),v="M"+d.x+","+d.y+" L"+h.x+","+h.y+" "+g.x+","+g.y+" "+f.x+","+f.y+"z";Yt(r,{d:v,display:"inline"})}else p(a)}function m(t,n){var r=h.createSVGPoint();if(r.x=t,r.y=n,1===i.length)return 0;var a=e.getCharNumAtPosition(r);a<0?(a=i.length-2,t<=i[0].x&&(a=0)):a>=i.length-2&&(a=i.length-2);var o=i[a];return t>o.x+o.width/2&&a++,a}function _(e,t){p(m(e,t))}function y(e,n,r){var a=t.selectionStart,i=m(e,n);g(Math.min(a,i),Math.max(a,i),!r)}function x(e,t){var n={x:e,y:t};if(n.x/=v,n.y/=v,s){var r=fe(n.x,n.y,s.inverse());n.x=r.x,n.y=r.y}return n}function w(e,t){var n={x:e,y:t};if(s){var r=fe(n.x,n.y,s);n.x=r.x,n.y=r.y}return n.x*=v,n.y*=v,n}function S(t){g(0,e.textContent.length),qn(this).unbind(t)}function k(t){if(f&&e){var n=fe(t.pageX,t.pageY,We),r=x(n.x*v,n.y*v),a=m(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);g(o,(s?s[0].length:0)+a),qn(t.target).click(S),setTimeout(function(){qn(t.target).unbind("click",S)},300)}}return{select:function(t,n,r){e=t,St.toEditMode(n,r)},start:function(t){e=t,St.toEditMode()},mouseDown:function(e,n,r,a){var i=x(r,a);t.focus(),_(i.x,i.y),c=r,d=a},mouseMove:function(e,t){var n=x(e,t);y(n.x,n.y)},mouseUp:function(t,n,r){var a=x(n,r);y(a.x,a.y,!0),t.target!==e&&nc-2&&rd-2&&St.toSelectMode(!0)},setCursor:p,toEditMode:function(t,n){if(f=!1,Ie="textedit",R.requestSelector(e).showGrips(!1),R.requestSelector(e),St.init(),qn(e).css("cursor","text"),arguments.length){var r=x(t,n);_(r.x,r.y)}else p();setTimeout(function(){f=!0},300)},toSelectMode:function(i){Ie="select",clearInterval(a),a=null,r&&qn(r).attr("display","none"),n&&qn(n).attr("visibility","hidden"),qn(e).css("cursor","move"),i&&(H(),qn(e).css("cursor","move"),F("selected",[e]),Y([e],!0)),e&&!e.textContent.length&&l.deleteSelectedElements(),qn(t).blur(),e=!1},setInputElem:function(e){t=e},clear:function(){"textedit"===Ie&&St.toSelectMode()},init:function(n){if(e){var r=void 0,a=void 0;e.parentNode||(e=b[0],R.requestSelector(e).showGrips(!1));var c=e.textContent.length,u=e.getAttribute("transform");for(o=Nt(e),s=u?ye(e):null,(i=[]).length=c,t.focus(),qn(e).unbind("dblclick",k).dblclick(k),c||(a={x:o.x+o.width/2,width:0}),r=0;r")[0].getContext("2d")||(n.text=K.exportNoText),qn.each(n,function(n,a){r.find(n).length&&(t.push(n),e.push(a))}),{issues:e,issueCodes:t}}this.svgCanvasToString=function(){for(;Tt()>0;);A.clear(!0),qn.each(f.childNodes,function(e,t){e&&8===t.nodeType&&t.data.includes("Created with")&&f.firstChild.before(t)}),m&&(Sn(),Xe([m]));var e=[];qn(f).find("g:data(gsvg)").each(function(){for(var t=this.attributes,n=t.length,r=0;rt.name?-1:1}),s=0;s=0;s--){var v=i[s],m=vt(v.value);if(!g.includes(v.localName)&&""!==m){if(m.startsWith("pointer-events"))continue;if("class"===v.localName&&m.startsWith("se_"))continue;if(n.push(" "),"d"===v.localName&&(m=A.convertPath(e,!0)),isNaN(m)?a.test(m)&&(m=ee(m)+r):m=ee(m),ce.apply&&"image"===e.nodeName&&"href"===v.localName&&ce.images&&"embed"===ce.images){var _=le[m];_&&(m=_)}v.namespaceURI&&v.namespaceURI!==u.SVG&&!G[v.namespaceURI]||(n.push(v.nodeName),n.push('="'),n.push(m),n.push('"'))}}}if(e.hasChildNodes()){n.push(">"),t++;var y=!1;for(s=0;s");break;case 8:n.push("\n"),n.push(new Array(t+1).join(" ")),n.push("\x3c!--"),n.push(b.data),n.push("--\x3e")}}if(t--,!y)for(n.push("\n"),s=0;s")}else n.push("/>")}return n.join("")},this.embedImage=function(e,t){qn(new Image).load(function(){var n=document.createElement("canvas");n.width=this.width,n.height=this.height,n.getContext("2d").drawImage(this,0,0);try{var r=";svgedit_url="+encodeURIComponent(e);r=n.toDataURL().replace(";base64",r+";base64"),le[e]=r}catch(t){le[e]=!1}ke=e,t&&t(le[e])}).attr("src",e)},this.setGoodImage=function(e){ke=e},this.open=function(){},this.save=function(e){H(),e&&qn.extend(ce,e),ce.apply=!0;var t=this.svgCanvasToString();F("saved",t)};var jt=void 0;this.rasterExport=function(e,t,r,a){var i,s=this,c="image/"+e.toLowerCase(),u=Lt(),d=u.issues,h=u.issueCodes,f=this.svgCanvasToString();return new Promise((i=n(regeneratorRuntime.mark(function n(i,u){var p,g,v,m,_,y,b;return regeneratorRuntime.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:if(b=function(){var n={datauri:_,bloburl:y,svg:f,issues:d,issueCodes:h,type:e,mimeType:c,quality:t,exportWindowName:r};F("exported",n),a&&a(n),i(n)},jt){n.next=6;break}return n.next=4,rn(o.canvgPath+"canvg.js",{global:"canvg"});case 4:p=n.sent,jt=p.canvg;case 6:return g=e||"PNG",qn("#export_canvas").length||qn("",{id:"export_canvas"}).hide().appendTo("body"),(v=qn("#export_canvas")[0]).width=l.contentW,v.height=l.contentH,n.next=13,jt(v,f);case 13:if(m=("ICO"===g?"BMP":g).toLowerCase(),_=t?v.toDataURL("image/"+m,t):v.toDataURL("image/"+m),y=void 0,!v.toBlob){n.next=19;break}return v.toBlob(function(e){y=wt(e),b()},c,t),n.abrupt("return");case 19:y=xt(_),b();case 21:case"end":return n.stop()}},n,s)})),function(e,t){return i.apply(this,arguments)}))},this.exportPDF=function(e,t,r){var a,i=this,s=this;return new Promise((a=n(regeneratorRuntime.mark(function n(a,l){var c,u,d,h,f,p,g,v,m,_,y;return regeneratorRuntime.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:if(window.jsPDF){n.next=6;break}return n.next=3,an(["jspdf/underscore-min.js","jspdf/jspdf.min.js"]);case 3:return c=!("svgEditor"in window&&window.svgEditor&&!1===window.svgEditor.modules),n.next=6,an(o.jspdfPath+"jspdf.plugin.svgToPdf.js",{type:c?"module":"text/javascript"});case 6:u=Zt(),d=u.w>u.h?"landscape":"portrait",h=jsPDF({orientation:d,unit:"pt",format:[u.w,u.h]}),f=$t(),h.setProperties({title:f}),p=Lt(),g=p.issues,v=p.issueCodes,m=s.svgCanvasToString(),h.addSVG(m,0,0),(_={svg:m,issues:g,issueCodes:v,exportWindowName:e})[y=t||"dataurlstring"]=h.output(y),r&&r(_),a(_),F("exportedPDF",_);case 21:case"end":return n.stop()}},n,i)})),function(e,t){return a.apply(this,arguments)}))},this.getSvgString=function(){return ce.apply=!1,this.svgCanvasToString()},this.randomizeIds=function(e){arguments.length>0&&!1===e?yn(!1,g()):yn(!0,g())};var Rt=this.uniquifyElems=function(e){var t={},n=["filter","linearGradient","pattern","radialGradient","symbol","textPath","use"];for(var r in Ct(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),qn.each(ae,function(n,r){var a=e.getAttributeNode(r);if(a){var i=At(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=Et(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=B();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];Pt(d,"#"+i)}}}},Bt=this.setUseData=function(e){var t=qn(e);"use"!==e.tagName&&(t=t.find("use")),t.each(function(){var e=Et(this).substr(1),t=qt(e);t&&(qn(this).data("ref",t),"symbol"!==t.tagName&&"svg"!==t.tagName||qn(this).data("symbol",t).data("ref",t))})},Ft=this.convertGradients=function(e){var t=qn(e).find("linearGradient, radialGradient");!t.length&&L()&&(t=qn(e).find("*").filter(function(){return this.tagName.includes("Gradient")})),t.each(function(){if("userSpaceOnUse"===qn(this).attr("gradientUnits")){var e=qn(f).find('[fill="url(#'+this.id+')"],[stroke="url(#'+this.id+')"]');if(!e.length)return;var t=Nt(e[0]);if(!t)return;if("linearGradient"===this.tagName){var n=qn(this).attr(["x1","y1","x2","y2"]),r=this.gradientTransform.baseVal;if(r&&r.numberOfItems>0){var a=_e(r).matrix,i=fe(n.x1,n.y1,a),o=fe(n.x2,n.y2,a);n.x1=i.x,n.y1=i.y,n.x2=o.x,n.y2=o.y,this.removeAttribute("gradientTransform")}qn(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")}}})},Kt=this.convertToGroup=function(e){e||(e=b[0]);var t=qn(e),n=new Kn,r=void 0;if(t.data("gsvg")){var a=e.firstChild,i=qn(a).attr(["x","y"]);qn(e.firstChild.firstChild).unwrap(),qn(e).removeData("gsvg");var o=W(e),s=h.createSVGTransform();s.setTranslate(i.x,i.y),o.appendItem(s),jn(e),F("selected",[e])}else if(t.data("symbol")){e=t.data("symbol"),r=t.attr("transform");var l=t.attr(["x","y"]),d=e.getAttribute("viewBox");if(d){var p=d.split(" ");l.x-=+p[0],l.y-=+p[1]}r+=" translate("+(l.x||0)+","+(l.y||0)+")";var g=t.prev();n.addSubCommand(new Xn(t[0],t[0].nextSibling,t[0].parentNode)),t.remove();var v=qn(f).find("use:data(symbol)").length,m=c.createElementNS(u.SVG,"g"),_=e.childNodes,y=void 0;for(y=0;y<_.length;y++)m.append(_[y].cloneNode(!0));if(M()){var x=qn(Gt()).children("linearGradient,radialGradient,pattern").clone();qn(m).append(x)}r&&m.setAttribute("transform",r);var w=e.parentNode;if(Rt(m),M()&&qn(Gt()).append(qn(m).find("linearGradient,radialGradient,pattern")),m.id=B(),g.after(m),w){if(!v){var S=e.nextSibling;e.remove(),n.addSubCommand(new Xn(e,S,w))}n.addSubCommand(new Wn(m))}Bt(m),M()?Ft(Gt()):Ft(m),function(e,t){if(e&&1===e.nodeType){for(var n=e.childNodes.length;n--;)Ct(e.childNodes.item(n),t);t(e)}}(m,function(e){try{jn(e)}catch(e){console.log(e)}}),qn(m).find(re).each(function(){this.id||(this.id=B())}),Xe([m]);var k=on(m,!0);k&&n.addSubCommand(k),T(n)}else console.log("Unexpected element to ungroup:",e)};this.setSvgString=function(e,t){try{var n=kt(e);if(n.firstElementChild&&n.firstElementChild.namespaceURI!==u.SVG)return!1;this.prepareSvg(n);var r=new Kn("Change Source"),a=f.nextSibling,i=h.removeChild(f);r.addSubCommand(new Xn(i,a,h)),f=c.adoptNode?c.adoptNode(n.documentElement):c.importNode(n.documentElement,!0),h.append(f);var s=qn(f);l.current_drawing_=new _n(f,p);var d=g().getNonce();d?F("setnonce",d):F("unsetnonce"),s.find("image").each(function(){var e=this;Qt(e);var t=Et(this);if(t){if(t.startsWith("data:")){var n=t.match(/svgedit_url=(.*?);/);if(n){var r=decodeURIComponent(n[1]);qn(new Image).load(function(){e.setAttributeNS(u.XLINK,"xlink:href",r)}).attr("src",r)}}l.embedImage(t)}}),s.find("svg").each(function(){if(!qn(this).closest("defs").length){Rt(this);var e=this.parentNode;1===e.childNodes.length&&"g"===e.nodeName?(qn(e).data("gsvg",this),e.id=e.id||B()):Ue(this)}}),M()&&s.find("linearGradient, radialGradient, pattern").appendTo(Gt()),Bt(s),Ft(s[0]);var m={id:"svgcontent",overflow:o.show_outside_canvas?"visible":"hidden"},_=!1;if(s.attr("viewBox")){var y=s.attr("viewBox").split(" ");m.width=y[2],m.height=y[3]}else qn.each(["width","height"],function(e,t){var n=s.attr(t)||"100%";"%"===String(n).substr(-1)?_=!0:m[t]=ne(t,n)});if(wn(),s.children().find(re).each(function(){this.id||(this.id=B())}),_){var b=Ut();m.width=b.width+b.x,m.height=b.height+b.y}m.width<=0&&(m.width=100),m.height<=0&&(m.height=100),s.attr(m),this.contentW=m.width,this.contentH=m.height,r.addSubCommand(new Wn(f));var x=s.attr(["width","height"]);r.addSubCommand(new Qn(h,x)),v=1,z={},H(),Pe={},h.append(R.selectorParentGroup),t||T(r),F("changed",[f])}catch(e){return console.log(e),!1}return!0},this.importSvgString=function(e){var t=void 0,n=void 0,r=void 0;try{var a=mt(e.length+e).substr(0,32),i=!1;ue[a]&&qn(ue[a].symbol).parents("#svgroot").length&&(i=!0);var o=new Kn("Import Image"),s=void 0;if(i)s=ue[a].symbol,n=ue[a].xform;else{var l=kt(e);this.prepareSvg(l);var d=void 0;d=c.adoptNode?c.adoptNode(l.documentElement):c.importNode(l.documentElement,!0),Rt(d);var h=ne("width",d.getAttribute("width")),p=ne("height",d.getAttribute("height")),v=d.getAttribute("viewBox"),_=v?v.split(" "):[0,0,h,p];for(t=0;t<4;++t)_[t]=+_[t];var y=+f.getAttribute("height");n="translate(0) "+(n=p>h?"scale("+y/3/_[3]+")":"scale("+y/3/_[2]+")")+" translate(0)",s=c.createElementNS(u.SVG,"symbol");var b=Gt();for(M()&&qn(d).find("linearGradient, radialGradient, pattern").appendTo(b);d.firstChild;){var x=d.firstChild;s.append(x)}for(var w=d.attributes,S=0;S0&&(n?tn(e,t,r):(nn(e,t,r),F("changed",r)))};var Jt=this.setGradient=function(e){if(Le[e+"_paint"]&&"solidColor"!==Le[e+"_paint"].type){var t=l[e+"Grad"],n=en(t),r=Gt();n?t=n:(t=r.appendChild(c.importNode(t,!0))).id=B(),l.setColor(e,"url(#"+t.id+")")}},en=function(e){for(var t=Gt(),n=qn(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=qn(e).attr(a),n=qn(i).attr(a),r=!1;if(qn.each(a,function(e,a){t[a]!==n[a]&&(r=!0)}),r)return"continue"}())continue;var o=e.getElementsByTagNameNS(u.SVG,"stop"),s=i.getElementsByTagNameNS(u.SVG,"stop");if(o.length===s.length){for(var l=o.length;l--;){var c=o[l],d=s[l];if(c.getAttribute("offset")!==d.getAttribute("offset")||c.getAttribute("stop-opacity")!==d.getAttribute("stop-opacity")||c.getAttribute("stop-color")!==d.getAttribute("stop-color"))break}if(-1===l)return i}}return null};this.setPaint=function(e,t){var n=new qn.jGraduate.Paint(t);switch(this.setPaintOpacity(e,n.alpha/100,!0),Le[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],Jt(e)}},this.setStrokePaint=function(e){this.setPaint("stroke",e)},this.setFillPaint=function(e){this.setPaint("fill",e)},this.getStrokeWidth=function(){return Le.stroke_width},this.setStrokeWidth=function(e){if(0===e&&["line","path"].includes(Ie))l.setStrokeWidth(1);else{Le.stroke_width=e;for(var t=[],n=b.length;n--;){var r=b[n];r&&("g"===r.tagName?Ct(r,a):t.push(r))}t.length>0&&(nn("stroke-width",e,t),F("changed",b))}function a(e){"g"!==e.nodeName&&t.push(e)}},this.setStrokeAttr=function(e,t){y[e.replace("-","_")]=t;for(var n=[],r=b.length;r--;){var a=b[r];a&&("g"===a.tagName?Ct(a,function(e){"g"!==e.nodeName&&n.push(e)}):n.push(a))}n.length>0&&(nn(e,t,n),F("changed",b))},this.getStyle=function(){return y},this.getOpacity=X,this.setOpacity=function(e){y.opacity=e,nn("opacity",e)},this.getFillOpacity=function(){return y.fill_opacity},this.getStrokeOpacity=function(){return y.stroke_opacity},this.setPaintOpacity=function(e,t,n){y[e+"_opacity"]=t,n?tn(e+"-opacity",t):nn(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=qt(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),T(e),e=null,t=null}l.setBlurNoUndo=function(e){if(t)if(0===e)tn("filter",""),n=!0;else{var r=b[0];n&&tn("filter","url(#"+r.id+"_blur)"),L()&&(console.log("e",r),r.removeAttribute("filter"),r.setAttribute("filter","url(#"+r.id+"_blur)")),tn("stdDeviation",e,[t.firstChild]),l.setBlurOffsets(t,e)}else l.setBlur(e)},l.setBlurOffsets=function(e,t){t>3?Yt(e,{x:"-50%",y:"-50%",width:"200%",height:"200%"},100):L()||(e.removeAttribute("x"),e.removeAttribute("y"),e.removeAttribute("width"),e.removeAttribute("height"))},l.setBlur=function(n,a){if(e)r();else{var i=b[0],o=i.id;t=qt(o+"_blur"),n-=0;var s=new Kn;if(t)0===n&&(t=null);else{var c=w({element:"feGaussianBlur",attr:{in:"SourceGraphic",stdDeviation:n}});(t=w({element:"filter",attr:{id:o+"_blur"}})).append(c),Gt().append(t),s.addSubCommand(new Wn(t))}var u={filter:i.getAttribute("filter")};if(0===n)return i.removeAttribute("filter"),void s.addSubCommand(new Qn(i,u));nn("filter","url(#"+o+"_blur)"),s.addSubCommand(new Qn(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=b[0];return null!=e&&"text"===e.tagName&&null==b[1]&&"bold"===e.getAttribute("font-weight")},this.setBold=function(e){var t=b[0];null!=t&&"text"===t.tagName&&null==b[1]&&nn("font-weight",e?"bold":"normal"),b[0].textContent||St.setCursor()},this.getItalic=function(){var e=b[0];return null!=e&&"text"===e.tagName&&null==b[1]&&"italic"===e.getAttribute("font-style")},this.setItalic=function(e){var t=b[0];null!=t&&"text"===t.tagName&&null==b[1]&&nn("font-style",e?"italic":"normal"),b[0].textContent||St.setCursor()},this.getFontFamily=function(){return he.font_family},this.setFontFamily=function(e){he.font_family=e,nn("font-family",e),b[0]&&!b[0].textContent&&St.setCursor()},this.setFontColor=function(e){he.fill=e,nn("fill",e)},this.getFontColor=function(){return he.fill},this.getFontSize=function(){return he.font_size},this.setFontSize=function(e){he.font_size=e,nn("font-size",e),b[0].textContent||St.setCursor()},this.getText=function(){var e=b[0];return null==e?"":e.textContent},this.setTextContent=function(e){nn("#text",e),St.init(e),St.setCursor()},this.setImageURL=function(e){var t=b[0];if(t){var n=qn(t).attr(["width","height"]),r=!n.width||!n.height,a=Et(t);if(a!==e)r=!0;else if(!r)return;var i=new Kn("Change Image URL");Pt(t,e),i.addSubCommand(new Qn(t,{"#href":a})),r?qn(new Image).load(function(){var e=qn(t).attr(["width","height"]);qn(t).attr({width:this.width,height:this.height}),R.requestSelector(t).resize(),i.addSubCommand(new Qn(t,e)),T(i),F("changed",[t])}).attr("src",e):T(i)}},this.setLinkURL=function(e){var t=b[0];if(t){if("a"!==t.tagName){var n=qn(t).parents("a");if(!n.length)return;t=n[0]}var r=Et(t);if(r!==e){var a=new Kn("Change Link URL");Pt(t,e),a.addSubCommand(new Qn(t,{"#href":r})),T(a)}}},this.setRectRadius=function(e){var t=b[0];if(null!=t&&"rect"===t.tagName){var n=t.getAttribute("rx");n!==String(e)&&(t.setAttribute("rx",e),t.setAttribute("ry",e),T(new Qn(t,{rx:n,ry:n},"Radius")),F("changed",[t]))}},this.makeHyperlink=function(e){l.groupSelectedElements("a",e)},this.removeHyperlink=function(){l.ungroupSelectedElement()},this.setSegType=function(e){A.setSegType(e)},this.convertToPath=function(e,t){if(null!=e){return t?Vt(e,w,A):function(e,t,n,r,a,i,o,s){var l=new o.BatchCommand("Convert element to Path"),c=n({element:"path",attr:t=ct.extend({},t,Ot(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 f=Mt(e);if(f){if(c.setAttribute("d",f),u){var p=W(c);ve(p)&&r.resetOrientation(c)}var g=e.nextSibling;return l.addSubCommand(new o.RemoveElementCommand(e,g,h)),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:y.fill,"fill-opacity":y.fill_opacity,stroke:y.stroke,"stroke-width":y.stroke_width,"stroke-dasharray":y.stroke_dasharray,"stroke-linejoin":y.stroke_linejoin,"stroke-linecap":y.stroke_linecap,"stroke-opacity":y.stroke_opacity,opacity:y.opacity,visibility:"hidden"},w,A,H,Y,de,T)}else{var n=b;qn.each(n,function(e,t){t&&l.convertToPath(t)})}};var tn=function(e,t,n){"pathedit"===Ie&&A.moveNode(e,t);for(var r=(n=n||b).length,a=["g","polyline","path"],i=["transform","opacity","filter"],o=function(){var o=n[r];if(null==o)return"continue";if(("x"===e||"y"===e)&&a.includes(o.tagName)){var s=Ut([o]),c="x"===e?t-s.x:0,u="y"===e?t-s.y:0;return l.moveSelectedElements(c*v,u*v,!0),"continue"}"g"===o.tagName&&i.includes(e);var d="#text"===e?o.textContent:o.getAttribute(e);if(null==d&&(d=""),d!==String(t)){"#text"===e?(o.textContent=t,/rotate/.test(o.getAttribute("transform"))&&(o=He(o))):"#href"===e?Pt(o,t):o.setAttribute(e,t),"textedit"===Ie&&"#text"!==e&&o.textContent.length&&St.toSelectMode(o),M()&&"text"===o.nodeName&&/rotate/.test(o.getAttribute("transform"))&&(String(t).startsWith("url")||["font-size","font-family","x","y"].includes(e)&&o.textContent)&&(o=He(o)),b.includes(o)&&setTimeout(function(){o.parentNode&&R.requestSelector(o).resize()},0);var f=Ht(o);if(0!==f&&"transform"!==e)for(var p=W(o),g=p.numberOfItems;g--;){if(4===p.getItem(g).type){p.removeItem(g);var m=Nt(o),_=fe(m.x+m.width/2,m.y+m.height/2,_e(p).matrix),y=_.x,x=_.y,w=h.createSVGTransform();w.setRotate(f,y,x),p.insertItemBefore(w,g);break}}}};r--;)o()},nn=this.changeSelectedAttribute=function(e,t,n){n=n||b,l.undoMgr.beginUndoableChange(e,n),tn(e,t,n);var r=l.undoMgr.finishUndoableChange();r.isEmpty()||T(r)};this.deleteSelectedElements=function(){for(var e=new Kn("Delete Elements"),t=b.length,n=[],r=0;r1&&(r=t);break;default:e="g",n="Group Elements"}var a=new Kn(n),i=w({element:e,attr:{id:B()}});"a"===e&&Pt(i,r),a.addSubCommand(new Wn(i));for(var o=b.length;o--;){var s=b[o];if(null!=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 Yn(s,l,c))}}a.isEmpty()||T(a),Xe([i],!0)};var on=this.pushGroupProperties=function(e,t){for(var n=e.childNodes,r=n.length,a=e.getAttribute("transform"),i=W(e),o=_e(i).matrix,s=new Kn("Push group properties"),c=Ht(e),u=qn(e).attr(["filter","opacity"]),d=void 0,f=void 0,p=void 0,v=g(),m=0;mn[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||ci&&(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 f=new Array(r),p=new Array(r),g=0;g=a.length?t=0:t<0&&(t=a.length-1),r=a[t];break}Xe([r],!0),F("selected",b)}},this.clear(),this.getPrivateMethods=function(){return{addCommandToHistory:T,setGradient:Jt,addSvgElementFromJson:w,assignAttributes:Yt,BatchCommand:Kn,call:F,ChangeElementCommand:Qn,copyElem:function(e){return g().copyElem(e)},decode64:_t,encode64:mt,ffClone:He,findDefs:Gt,findDuplicateGradient:en,getElem:qt,getId:U,getIntersectionList:Be,getMouseTarget:Q,getNextId:B,getPathBBox:It,getTypeMap:J,getUrlFromAttr:At,hasMatrixTransform:ve,identifyLayers:wn,InsertElementCommand:Wn,isChrome:V,isIdentity:pe,isIE:O,logMatrix:qe,matrixMultiply:ge,MoveElementCommand:Yn,NS:u,preventClickDefault:Qt,recalculateAllSelectedDimensions:ze,recalculateDimensions:jn,remapElement:Ln,RemoveElementCommand:Xn,removeUnusedDefElems:Tt,round:j,runExtensions:Re,sanitizeSvg:Gn,SVGEditTransformList:q,text2xml:kt,toString:toString,transformBox:me,transformListToTransform:_e,transformPoint:fe,walkTree:Ct}}};var er={svg:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink"};window.console||(window.console={log:function(e){},dir:function(e){}}),Math.precision=function(e,t){return void 0===t&&(t=0),Math.round(e*Math.pow(10,t))/Math.pow(10,t)};var tr=jQuery,nr=void 0;function rr(e,t,n){var r=tr("#svg_editor").parent();Object.entries(t).forEach(function(t){var a=l(t,2),i=a[0],o=a[1];if(o||console.log(i),n&&(i="#"+i),r.find(i).length){var s=r.find(i)[0];switch(e){case"content":for(var c,u=0;c=s.childNodes[u];u++)if(3===c.nodeType&&c.textContent.trim()){c.textContent=o;break}break;case"title":s.title=o}}else console.log("Missing: "+i)})}var ar=void 0,ir=function(e){var t=ar.addLangData(nr);if(tr.each(t,function(t,n){n.data&&(e=tr.merge(e,n.data))}),e.tools){var n=e,r=n.tools,a=n.properties,i=n.config,o=n.layers,s=n.common,l=n.ui;rr("content",{curve_segments:a.curve_segments,fitToContent:r.fitToContent,fit_to_all:r.fit_to_all,fit_to_canvas:r.fit_to_canvas,fit_to_layer_content:r.fit_to_layer_content,fit_to_sel:r.fit_to_sel,icon_large:i.icon_large,icon_medium:i.icon_medium,icon_small:i.icon_small,icon_xlarge:i.icon_xlarge,image_opt_embed:i.image_opt_embed,image_opt_ref:i.image_opt_ref,includedImages:i.included_images,largest_object:r.largest_object,layersLabel:o.layers,page:r.page,relativeToLabel:r.relativeTo,selLayerLabel:o.move_elems_to,selectedPredefined:i.select_predefined,selected_objects:r.selected_objects,smallest_object:r.smallest_object,straight_segments:a.straight_segments,svginfo_bg_url:i.editor_img_url+":",svginfo_bg_note:i.editor_bg_note,svginfo_change_background:i.background,svginfo_dim:i.doc_dims,svginfo_editor_prefs:i.editor_prefs,svginfo_height:s.height,svginfo_icons:i.icon_size,svginfo_image_props:i.image_props,svginfo_lang:i.language,svginfo_title:i.doc_title,svginfo_width:s.width,tool_docprops_cancel:s.cancel,tool_docprops_save:s.ok,tool_source_cancel:s.cancel,tool_source_save:s.ok,tool_prefs_cancel:s.cancel,tool_prefs_save:s.ok,sidepanel_handle:o.layers.split("").join(" "),tool_clear:r.new_doc,tool_docprops:r.docprops,tool_export:r.export_img,tool_import:r.import_doc,tool_open:r.open_doc,tool_save:r.save_doc,svginfo_units_rulers:i.units_and_rulers,svginfo_rulers_onoff:i.show_rulers,svginfo_unit:i.base_unit,svginfo_grid_settings:i.grid,svginfo_snap_onoff:i.snapping_onoff,svginfo_snap_step:i.snapping_stepsize,svginfo_grid_color:i.grid_color},!0);var c={};for(var u in e.shape_cats)c['#shape_cats [data-cat="'+u+'"]']=e.shape_cats[u];setTimeout(function(){rr("content",c)},2e3);var d={};tr.each(["cut","copy","paste","paste_in_place","delete","group","ungroup","move_front","move_up","move_down","move_back"],function(){d['#cmenu_canvas a[href="#'+this+'"]']=r[this]}),tr.each(["dupe","merge_down","merge_all"],function(){d['#cmenu_layers a[href="#'+this+'"]']=o[this]}),d['#cmenu_layers a[href="#delete"]']=o.del,rr("content",d),rr("title",{align_relative_to:r.align_relative_to,circle_cx:a.circle_cx,circle_cy:a.circle_cy,circle_r:a.circle_r,cornerRadiusLabel:a.corner_radius,ellipse_cx:a.ellipse_cx,ellipse_cy:a.ellipse_cy,ellipse_rx:a.ellipse_rx,ellipse_ry:a.ellipse_ry,fill_color:a.fill_color,font_family:a.font_family,idLabel:a.id,image_height:a.image_height,image_url:a.image_url,image_width:a.image_width,layer_delete:o.del,layer_down:o.move_down,layer_new:o.new,layer_rename:o.rename,layer_moreopts:s.more_opts,layer_up:o.move_up,line_x1:a.line_x1,line_x2:a.line_x2,line_y1:a.line_y1,line_y2:a.line_y2,linecap_butt:a.linecap_butt,linecap_round:a.linecap_round,linecap_square:a.linecap_square,linejoin_bevel:a.linejoin_bevel,linejoin_miter:a.linejoin_miter,linejoin_round:a.linejoin_round,main_icon:r.main_menu,mode_connect:r.mode_connect,tools_shapelib_show:r.mode_shapelib,palette:l.palette_info,zoom_panel:l.zoom_level,path_node_x:a.node_x,path_node_y:a.node_y,rect_height_tool:a.rect_height,rect_width_tool:a.rect_width,seg_type:a.seg_type,selLayerNames:o.move_selected,selected_x:a.pos_x,selected_y:a.pos_y,stroke_color:a.stroke_color,stroke_style:a.stroke_style,stroke_width:a.stroke_width,svginfo_title:i.doc_title,text:a.text_contents,toggle_stroke_tools:l.toggle_stroke_tools,tool_add_subpath:r.add_subpath,tool_alignbottom:r.align_bottom,tool_aligncenter:r.align_center,tool_alignleft:r.align_left,tool_alignmiddle:r.align_middle,tool_alignright:r.align_right,tool_aligntop:r.align_top,tool_angle:a.angle,tool_blur:a.blur,tool_bold:a.bold,tool_circle:r.mode_circle,tool_clone:r.clone,tool_clone_multi:r.clone,tool_delete:r.del,tool_delete_multi:r.del,tool_ellipse:r.mode_ellipse,tool_eyedropper:r.mode_eyedropper,tool_fhellipse:r.mode_fhellipse,tool_fhpath:r.mode_fhpath,tool_fhrect:r.mode_fhrect,tool_font_size:a.font_size,tool_group_elements:r.group_elements,tool_make_link:r.make_link,tool_link_url:r.set_link_url,tool_image:r.mode_image,tool_italic:a.italic,tool_line:r.mode_line,tool_move_bottom:r.move_bottom,tool_move_top:r.move_top,tool_node_clone:r.node_clone,tool_node_delete:r.node_delete,tool_node_link:r.node_link,tool_opacity:a.opacity,tool_openclose_path:r.openclose_path,tool_path:r.mode_path,tool_position:r.align_to_page,tool_rect:r.mode_rect,tool_redo:r.redo,tool_reorient:r.reorient_path,tool_select:r.mode_select,tool_source:r.source_save,tool_square:r.mode_square,tool_text:r.mode_text,tool_topath:r.to_path,tool_undo:r.undo,tool_ungroup:r.ungroup,tool_wireframe:r.wireframe_mode,view_grid:r.toggle_grid,tool_zoom:r.mode_zoom,url_notice:r.no_embed},!0),ar.setLang(nr,e)}},or=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?nr=t:((nr=tr.pref("lang"))||(navigator.userLanguage?nr=navigator.userLanguage:navigator.language&&(nr=navigator.language)),console.log("Lang: "+nr),n.includes(nr)||"test"===nr||(nr="en")),a=r.langPath+"lang."+nr+".js",e.t0=ir,e.next=5,nn(a,{global:"svgEditorLang_"+nr.replace(/-/g,"_")});case 5:return e.t1=e.sent,e.abrupt("return",(0,e.t0)(e.t1));case 7:case"end":return e.stop()}},e,this)}));return function(t,n,r){return e.apply(this,arguments)}}();var sr=[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||!/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","/":"?","\\":"|"}},e.each(["keydown","keyup","keypress"],function(){e.event.special[this]={add:t}}),e},function(e){return function(e,n){var r,a,i,o,s,l,c,u,d=Array.prototype.slice,h=decodeURIComponent,f=e.param,p=e.bbq=e.bbq||{},g=e.event.special,v="hashchange",m="querystring",_="fragment",y="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 P(t,a,o,s,l){var c,d,p,g,v;return s!==r?(v=(p=o.match(t?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/))[3]||"",2===l&&A(s)?d=s.replace(t?k:S,""):(g=i(p[2]),s=A(s)?i[t?_:m](s):s,d=2===l?s:1===l?e.extend({},s,g):e.extend({},g,s),d=f(d),t&&(d=d.replace(u,h))),c=p[1]+(t?"#":d||!p[1]?"?":"")+d+v):c=a(o!==r?o:n[b][x]),c}function G(e,t,n){return t===r||"boolean"==typeof t?(n=t,t=f[e?_:m]()):t=A(t)?t.replace(e?k:S,""):t,i(t,n)}function I(n,a,i,o){return A(i)||"object"===(void 0===i?"undefined":t(i))||(o=i,i=a,a=r),this.each(function(){var t=e(this),r=a||c()[(this.nodeName||"").toLowerCase()]||"",s=r&&t.attr(r)||"";t.attr(r,f[n](s,i,o))})}f[m]=E(P,0,function(e){return e.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")}),f[_]=a=E(P,1,function(e){return e.replace(/^[^#]*#?(.*)$/,"$1")}),a.noEscape=function(t){t=t||"";var n=e.map(t.split(""),encodeURIComponent);u=new RegExp(n.join("|"),"g")},a.noEscape(",/"),e.deparam=i=function(t,n){var a={},i={true:!0,false:!1,null:null};return e.each(t.replace(/\+/g," ").split("&"),function(t,o){var s,l=o.split("="),c=h(l[0]),u=a,d=0,f=c.split("]["),p=f.length-1;if(/\[/.test(f[0])&&/\]$/.test(f[p])?(f[p]=f[p].replace(/\]$/,""),p=(f=f.shift().split("[").concat(f)).length-1):p=0,2===l.length)if(s=h(l[1]),n&&(s=s&&!isNaN(s)?+s:"undefined"===s?r:i[s]!==r?i[s]:s),p)for(;d<=p;d++)u=u[c=""===f[d]?u.length:f[d]]=d').hide().insertAfter("body")[0].contentWindow,s=function(){return m(i.document[u][h])},(o=function(e,t){if(e!==t){var n=i.document;n.open().close(),n[u].hash="#"+e}})(m()))),function r(){var i=m(),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}(e,window),e},function(e){var t={},n=void 0;return e.svgIcons=function(r,a){var i="http://www.w3.org/2000/svg",o="http://www.w3.org/1999/xlink",s=a.w||24,l=a.h||24,c=void 0,u=void 0,d=void 0,h=!1,f=!1,p=0,g=!!window.opera,v="data:image/svg+xml;charset=utf-8;base64,",m=void 0;if(a.svgz){m=e('').appendTo("body").hide();try{u=m[0].contentDocument,m.load(y),y(0,!0)}catch(e){k()}}else{var _=new DOMParser;e.ajax({url:r,dataType:"string",success:function(t){t?(u=_.parseFromString(t,"text/xml"),e(function(){y("ajax")})):e(k)},error:function(t){window.opera?e(function(){k()}):t.responseText?((u=_.parseFromString(t.responseText,"text/xml")).childNodes.length||e(k),e(function(){y("ajax")})):e(k)}})}function y(t,n){if("ajax"!==t){if(f)return;var r=(u=m[0].contentDocument)&&u.getElementById("svg_eof");if(!(r||n&&r))return void(++p<50?setTimeout(y,20):(k(),f=!0));f=!0}if(c=e(u.firstChild).children(),a.no_img)setTimeout(function(){h||S()},500);else{var i=v+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNzUiIGhlaWdodD0iMjc1Ij48L3N2Zz4%3D";d=e(new Image).attr({src:i,width:0,height:0}).appendTo("body").load(function(){S(!0)}).error(function(){S()})}}var b=function(e,t,n,r){if(g&&t.css("visibility","hidden"),a.replace){r&&t.attr("id",n);var i=e.attr("class");i&&t.attr("class","svg_icon "+i),e.replaceWith(t)}else e.append(t);g&&setTimeout(function(){t.removeAttr("style")},1)},x=void 0,w=function(e,n){void 0!==a.id_match&&!1===a.id_match||b(x,e,n,!0),t[n]=e};function S(r,u){if(!h){a.no_img&&(r=!1);var f=void 0;if(r&&(f=e(document.createElement("div"))).hide().appendTo("body"),u){var p=a.fallback_path||"";e.each(u,function(t,n){x=e("#"+t);var r=e(new Image).attr({class:"svg_icon",src:p+n,width:s,height:l,alt:"icon"});w(r,t)})}else for(var _=c.length,y=0;y<_;y++){var S=c[y],k=S.id;if("svg_eof"===k)break;x=e("#"+k);var A=document.createElementNS(i,"svg");A.setAttributeNS(null,"viewBox",[0,0,s,l].join(" "));var E=S.getElementsByTagNameNS(i,"svg")[0],P=E.getAttribute("width"),G=E.getAttribute("height");E.removeAttribute("width"),E.removeAttribute("height"),E.getAttribute("viewBox")||E.setAttribute("viewBox",[0,0,P,G].join(" ")),A.setAttribute("xmlns",i),A.setAttribute("width",s),A.setAttribute("height",l),A.setAttribute("xmlns:xlink",o),A.setAttribute("class","svg_icon"),g||(E=E.cloneNode(!0)),A.append(E);var I=void 0;if(r){f.empty().append(A);var T=v+C(unescape(encodeURIComponent((new XMLSerializer).serializeToString(A))));I=e(new Image).attr({class:"svg_icon",src:T})}else I=n(e(A),y);w(I,k)}a.placement&&e.each(a.placement,function(a,i){t[i]&&e(a).each(function(a){var o=t[i].clone();a>0&&!r&&(o=n(o,a,!0)),b(e(this),o,i)})}),u||(r&&f.remove(),m&&m.remove(),d&&d.remove()),a.resize&&e.resizeSvgIcons(a.resize),h=!0,a.callback&&a.callback(t)}}function k(){if(r.includes(".svgz")){var t=r.replace(".svgz",".svg");window.console&&console.log(".svgz failed, trying with .svg"),e.svgIcons(t,a)}else a.fallback&&S(!1,a.fallback)}function C(e){if(window.btoa)return window.btoa(e);var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n=new Array(4*Math.floor((e.length+2)/3)),r=0,a=0;do{var i=e.charCodeAt(r++),o=e.charCodeAt(r++),s=e.charCodeAt(r++),l=i>>2,c=(3&i)<<4|o>>4,u=(15&o)<<2|s>>6,d=63&s;isNaN(o)?u=d=64:isNaN(s)&&(d=64),n[a++]=t.charAt(l),n[a++]=t.charAt(c),n[a++]=t.charAt(u),n[a++]=t.charAt(d)}while(r
  • Solid Color
  • Linear Gradient
  • Radial Gradient
  • ');var f=e(l+"> .jGraduate_colPick"),p=e(l+"> .jGraduate_gradPick");p.html('

    '+o.window.pickerTitle+'


    ');var g=256,v=g-0,m=g-0,_={};e(".jGraduate_SliderBar").width(145);var y=e("#"+s+"_jGraduate_GradContainer")[0],b=r("svg",{id:s+"_jgraduate_svg",width:g,height:g,xmlns:er.svg},y),x=i.paint.type,w=i.paint[x],S=w,k=i.paint.alpha,C="solidColor"===x;switch(x){case"solidColor":case"linearGradient":if(C||(S.id=s+"_lg_jgraduate_grad",w=S=b.appendChild(S)),r("radialGradient",{id:s+"_rg_jgraduate_grad"},b),"linearGradient"===x)break;case"radialGradient":C||(S.id=s+"_rg_jgraduate_grad",w=S=b.appendChild(S)),r("linearGradient",{id:s+"_lg_jgraduate_grad"},b)}var A=void 0;if(C){w=S=e("#"+s+"_lg_jgraduate_grad")[0],Ne(0,"#"+(d=i.paint[x]),1);var E=t(o.newstop);if("string"===E)switch(o.newstop){case"same":Ne(1,"#"+d,1);break;case"inverse":for(var P="",G=0;G<6;G+=2){var I=(255-parseInt(d.substr(G,2),16)).toString(16);I.length<2&&(I=0+I),P+=I}Ne(1,"#"+P,1);break;case"white":Ne(1,"#ffffff",1);break;case"black":Ne(1,"#000000",1)}else if("object"===E){var T="opac"in o.newstop?o.newstop.opac:1;Ne(1,o.newstop.color||"#"+d,T)}}var N=parseFloat(w.getAttribute("x1")||0),L=parseFloat(w.getAttribute("y1")||0),M=parseFloat(w.getAttribute("x2")||1),O=parseFloat(w.getAttribute("y2")||0),V=parseFloat(w.getAttribute("cx")||.5),j=parseFloat(w.getAttribute("cy")||.5),R=parseFloat(w.getAttribute("fx")||V),B=parseFloat(w.getAttribute("fy")||j),D=r("rect",{id:s+"_jgraduate_rect",x:0,y:0,width:v,height:m,fill:"url(#"+s+"_jgraduate_grad)","fill-opacity":k/100},b),U=e("
    ").attr({class:"grad_coord jGraduate_lg_field",title:"Begin Stop"}).text(1).css({top:L*g,left:N*g}).data("coord","start").appendTo(y),F=U.clone().text(2).css({top:O*g,left:M*g}).attr("title","End stop").data("coord","end").appendTo(y),H=e("
    ").attr({class:"grad_coord jGraduate_rg_field",title:"Center stop"}).text("C").css({top:j*g,left:V*g}).data("coord","center").appendTo(y),z=H.clone().text("F").css({top:B*g,left:R*g,display:"none"}).attr("title","Focus point").data("coord","focus").appendTo(y);z[0].id=s+"_jGraduate_focusCoord";var q=void 0;e.each(["x1","y1","x2","y2","cx","cy","fx","fy"],function(t,n){var r=isNaN(n[1]),a=S.getAttribute(n);a||(a=r?"0.5":"x2"===n?"1.0":"0.0"),_[n]=e("#"+s+"_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]||q)&&(r&&"radialGradient"===x||!r&&"linearGradient"===x)&&S.setAttribute(n,this.value);var e=r?"c"===n[0]?H:z:"1"===n[1]?U:F,t=n.includes("x")?"left":"top";e.css(t,this.value*g)}).change()});var Y=e("#"+s+"_jGraduate_StopSlider"),W=void 0,X=void 0,Q=void 0,K=r("path",{d:"m9.75,-6l-19.5,19.5m0,-19.5l19.5,19.5",fill:"none",stroke:"#D00","stroke-width":5,display:"none"},void 0),Z=void 0,$=1,J=1,ee=0,te=V,ne=j,re=r("svg",{width:"100%",height:45},Y[0]),ae=r("image",{width:16,height:16},r("pattern",{width:16,height:16,patternUnits:"userSpaceOnUse",id:"jGraduate_trans"},re)),ie=o.images.clientPath+"map-opacity.png";ae.setAttributeNS(er.xlink,"xlink:href",ie),e(re).click(function(e){if(Z=Y.offset(),"path"!==e.target.tagName){var t=e.pageX-Z.left-8;Ne((t=t<10?10:t>g+10?g+10:t)/g,0,0,!0),e.stopPropagation()}}),e(re).mouseover(function(){re.append(K)}),A=r("g",{},re),r("line",{x1:10,y1:15,x2:g+10,y2:15,"stroke-width":2,stroke:"#000"},re);var oe=p.find(".jGraduate_spreadMethod").change(function(){S.setAttribute("spreadMethod",e(this).val())}),se=null,le=function(e){var t=e.pageX-he.left,n=e.pageY-he.top;t=t<0?0:t>g?g:t,n=n<0?0:n>g?g:n,se.css("left",t).css("top",n);var r=t/v,a=n/m,i=se.data("coord"),o=S;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),te=r,ne=a,Oe();break;case"focus":_.fx.val(r),_.fy.val(a),o.setAttribute("fx",r),o.setAttribute("fy",a),Oe()}e.preventDefault()},ce=function e(){se=null,h.unbind("mousemove",le).unbind("mouseup",e)},ue=(W=S.getElementsByTagNameNS(er.svg,"stop")).length;if(ue<2){for(;ue<2;)S.append(document.createElementNS(er.svg,"stop")),++ue;W=S.getElementsByTagNameNS(er.svg,"stop")}for(var de=0;de99.5&&(n=99.5),n>0?J=1-n/100:$=-n/100-1,a=(n+100)/2*145/100,e&&Oe();break;case"angle":a=(ee=n)/180,a+=.5,a*=145,e&&Oe()}a>145?a=145:a<0&&(a=0),r.css({"margin-left":a-5})}).change()});for(var Ee=function(e){!function(e){var t=ge.offset,n=ge.parent,r=e.pageX-t.left-parseInt(n.css("border-left-width"));r>145&&(r=145),r<=0&&(r=0);var a=r-5;switch(r/=145,ge.type){case"radius":(r=Math.pow(2*r,2.5))>.98&&r<1.02&&(r=1),r<=.01&&(r=.01),S.setAttribute("r",r);break;case"opacity":i.paint.alpha=parseInt(100*r),D.setAttribute("fill-opacity",r);break;case"ellip":$=1,J=1,r<.5?$=(r/=.5)<=0?.01:r:r>.5&&(J=(r=2-(r/=.5))<=0?.01:r),Oe(),J===1+(r-=1)&&(r=Math.abs(r));break;case"angle":r-=.5,ee=r*=180,Oe(),r/=100}ge.elem.css({"margin-left":a}),r=Math.round(100*r),ge.input.val(r)}(e),e.preventDefault()},Pe=function e(t){h.unbind("mousemove",Ee).unbind("mouseup",e),ge=null},Ge=(255*i.paint.alpha/100).toString(16);Ge.length<2;)Ge="0"+Ge;Ge=Ge.split(".")[0],d="none"===i.paint.solidColor?"":i.paint.solidColor+Ge,C||(d=W[0].getAttribute("stop-color")),e.extend(e.fn.jPicker.defaults.window,{alphaSupport:!0,effects:{type:"show",speed:0}}),f.jPicker({window:{title:o.window.pickerTitle},images:{clientPath:o.images.clientPath},color:{active:d,alphaSupport:!0}},function(e){i.paint.type="solidColor",i.paint.alpha=e.val("ahex")?Math.round(e.val("a")/255*100):100,i.paint.solidColor=e.val("hex")?e.val("hex"):"none",i.paint.radialGradient=null,c()},null,function(){u()});var Ie=e(l+" .jGraduate_tabs li");Ie.click(function(){Ie.removeClass("jGraduate_tab_current"),e(this).addClass("jGraduate_tab_current"),e(l+" > div").hide();var t=e(this).attr("data-type");if(e(l+" .jGraduate_gradPick").show(),"rg"===t||"lg"===t){e(".jGraduate_"+t+"_field").show(),e(".jGraduate_"+("lg"===t?"rg":"lg")+"_field").hide(),e("#"+s+"_jgraduate_rect")[0].setAttribute("fill","url(#"+s+"_"+t+"_jgraduate_grad)"),x="lg"===t?"linearGradient":"radialGradient",e("#"+s+"_jGraduate_OpacInput").val(i.paint.alpha).change();var n=e("#"+s+"_"+t+"_jgraduate_grad")[0];if(S!==n){var r=e(S).find("stop");e(n).empty().append(r),S=n;var a=oe.val();S.setAttribute("spreadMethod",a)}q="rg"===t&&null!=S.getAttribute("fx")&&!(V===R&&j===B),e("#"+s+"_jGraduate_focusCoord").toggle(q),q&&(e("#"+s+"_jGraduate_match_ctr")[0].checked=!1)}else e(l+" .jGraduate_gradPick").hide(),e(l+" .jGraduate_colPick").show()}),e(l+" > div").hide(),Ie.removeClass("jGraduate_tab_current");var Te=void 0;switch(i.paint.type){case"linearGradient":Te=e(l+" .jGraduate_tab_lingrad");break;case"radialGradient":Te=e(l+" .jGraduate_tab_radgrad");break;default:Te=e(l+" .jGraduate_tab_color")}i.show(),setTimeout(function(){Te.addClass("jGraduate_tab_current").click()},10)}else alert("Container element must have an id attribute to maintain unique id strings for sub-elements.");function Ne(t,n,a,i,l){var c=l||r("stop",{"stop-color":n,"stop-opacity":a,offset:t},S);l?(n=l.getAttribute("stop-color"),a=l.getAttribute("stop-opacity"),t=l.getAttribute("offset")):S.append(c),null===a&&(a=1);var u="M-6.2,0.9c3.6-4,6.7-4.3,6.7-12.4c-0.2,7.9,3.1,8.8,6.5,12.4c3.5,3.8,2.9,9.6,0,12.3c-3.1,2.8-10.4,2.7-13.2,0C-9.6,9.9-9.4,4.4-6.2,0.9z",d=r("path",{d:u,fill:"url(#jGraduate_trans)",transform:"translate("+(10+t*g)+", 26)"},A),f=r("path",{d:u,fill:n,"fill-opacity":a,transform:"translate("+(10+t*g)+", 26)",stroke:"#000","stroke-width":1.5},A);return e(f).mousedown(function(e){return Le(this),Q=X,h.mousemove(Ve).mouseup(Me),Z=Y.offset(),e.preventDefault(),!1}).data("stop",c).data("bg",d).dblclick(function(){e("div.jGraduate_LightBox").show();for(var t=this,r=+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,e("#"+s+"_jGraduate_stopPicker").css({left:100,bottom:15}).jPicker({window:{title:"Pick the start color and opacity for the gradient"},images:{clientPath:o.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,t.setAttribute("fill",a),t.setAttribute("fill-opacity",r),c.setAttribute("stop-color",a),c.setAttribute("stop-opacity",r),e("div.jGraduate_LightBox").hide(),e("#"+s+"_jGraduate_stopPicker").hide()},null,function(){e("div.jGraduate_LightBox").hide(),e("#"+s+"_jGraduate_stopPicker").hide()})}),e(S).find("stop").each(function(){var r=e(this);if(+this.getAttribute("offset")>t){if(!n){var a=this.getAttribute("stop-color"),i=this.getAttribute("stop-opacity");c.setAttribute("stop-color",a),f.setAttribute("fill",a),c.setAttribute("stop-opacity",null===i?1:i),f.setAttribute("fill-opacity",null===i?1:i)}return r.before(c),!1}}),i&&Le(f),c}function Le(e){X&&X.setAttribute("stroke","#000"),e.setAttribute("stroke","blue"),(X=e).parentNode.append(X)}function Me(){h.unbind("mousemove",Ve),"none"!==K.getAttribute("display")&&function(){K.setAttribute("display","none");var t=e(X),n=t.data("stop"),r=t.data("bg");e([X,n,r]).remove()}(),Q=null}function Oe(){var e=ee?"rotate("+ee+","+te+","+ne+") ":"";if(1===$&&1===J)S.removeAttribute("gradientTransform");else{var t=-te*($-1),n=-ne*(J-1);S.setAttribute("gradientTransform",e+"translate("+t+","+n+") scale("+$+","+J+")")}}function Ve(t){var n=t.pageX-Z.left,r=t.pageY-Z.top,a="translate("+(n=n<10?10:n>g+10?g+10:n)+", 26)";r<-60||r>130?(K.setAttribute("display","block"),K.setAttribute("transform",a)):K.setAttribute("display","none"),Q.setAttribute("transform",a),e.data(Q,"bg").setAttribute("transform",a);var i=e.data(Q,"stop"),o=(n-10)/g;i.setAttribute("offset",o);var s=0;e(S).find("stop").each(function(t){var n=this.getAttribute("offset"),r=e(this);nn(o,"offsetLeft")+o.offsetWidth*s-this.spinCfg._btn_width?i=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()},!1)})},e},U,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){var c=l;e(this).mouseup(function(l){var u=e(this);if(u.unbind("mouseup"),2===c.button||r.allowLeft||c.ctrlKey&&j()){if(l.stopPropagation(),e(".contextMenu").hide(),i.hasClass("disabled"))return!1;var d=l.pageX,h=l.pageY,f=t.width()-s.width(),p=t.height()-s.height();d>f-15&&(d=f-15),h>p-30&&(h=p-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)for(var n=t.split(","),r=0;rn&&(i=n),o<0?o=0:o>a&&(o=a),l.call(r,"xy",{x:i/n*v+p,y:o/a*y+m})}function l(e,t,n){if(void 0===t)switch(void 0!==e&&null!=e||(e="xy"),e.toLowerCase()){case"x":return h;case"y":return f;case"xy":default:return{x:h,y:f}}if(null==n||n!==r){var a=!1,i=void 0,o=void 0;switch(null==e&&(e="xy"),e.toLowerCase()){case"x":i=t&&(t.x&&0|t.x||0|t)||0;break;case"y":o=t&&(t.y&&0|t.y||0|t)||0;break;case"xy":default:i=t&&t.x&&0|t.x||0,o=t&&t.y&&0|t.y||0}null!=i&&(ig&&(i=g),h!==i&&(h=i,a=!0)),null!=o&&(o_&&(o=_),f!==o&&(f=o,a=!0)),a&&function(e){for(var t=0;t0&&(i=h===g?e:h/v*e|0),y>0&&(o=f===_?n:f/y*n|0),r>=e?i=(e>>1)-(r>>1):i-=r>>1,a>=n?o=(n>>1)-(a>>1):o-=a>>1,b.css({left:i+"px",top:o+"px"})},0)})}e.loadingStylesheets.includes("jgraduate/css/jPicker.css")||e.loadingStylesheets.push("jgraduate/css/jPicker.css"),e.jPicker={List:[],Color:function t(n){r(this,t);var a=this;function i(e){for(var t=0;t255&&(y.r=255),l!==y.r&&(l=y.r,m=!0);break;case"g":if(x)continue;b=!0,y.g=t&&t.g&&0|t.g||t&&0|t||0,y.g<0?y.g=0:y.g>255&&(y.g=255),c!==y.g&&(c=y.g,m=!0);break;case"b":if(x)continue;b=!0,y.b=t&&t.b&&0|t.b||t&&0|t||0,y.b<0?y.b=0:y.b>255&&(y.b=255),u!==y.b&&(u=y.b,m=!0);break;case"a":y.a=t&&null!=t.a?0|t.a:null!=t?0|t:255,y.a<0?y.a=0:y.a>255&&(y.a=255),d!==y.a&&(d=y.a,m=!0);break;case"h":if(b)continue;x=!0,y.h=t&&t.h&&0|t.h||t&&0|t||0,y.h<0?y.h=0:y.h>360&&(y.h=360),h!==y.h&&(h=y.h,m=!0);break;case"s":if(b)continue;x=!0,y.s=t&&null!=t.s?0|t.s:null!=t?0|t:100,y.s<0?y.s=0:y.s>100&&(y.s=100),f!==y.s&&(f=y.s,m=!0);break;case"v":if(b)continue;x=!0,y.v=t&&null!=t.v?0|t.v:null!=t?0|t:100,y.v<0?y.v=0:y.v>100&&(y.v=100),p!==y.v&&(p=y.v,m=!0)}if(m){if(b){l=l||0,c=c||0,u=u||0;var S=s.rgbToHsv({r:l,g:c,b:u});h=S.h,f=S.s,p=S.v}else if(x){h=h||0,f=null!=f?f:100,p=null!=p?p:100;var k=s.hsvToRgb({h:h,s:f,v:p});l=k.r,c=k.g,u=k.b}d=null!=d?d:255,i.call(a,n||a)}}}}var l=void 0,c=void 0,u=void 0,d=void 0,h=void 0,f=void 0,p=void 0,g=[];e.extend(!0,a,{val:o,bind:function(e){"function"==typeof e&&g.push(e)},unbind:function(e){if("function"==typeof e)for(var t=void 0;t=g.includes(e);)g.splice(t,1)},destroy:function(){g=null}}),n&&(null!=n.ahex?o("ahex",n):null!=n.hex?o((null!=n.a?"a":"")+"hex",null!=n.a?{ahex:n.hex+s.intToHex(n.a)}:n):null!=n.r&&null!=n.g&&null!=n.b?o("rgb"+(null!=n.a?"a":""),n):null!=n.h&&null!=n.s&&null!=n.v&&o("hsv"+(null!=n.a?"a":""),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=e.r/255,n=e.g/255,r=e.b/255,a={h:0,s:0,v:0},i=0,o=0;t>=n&&t>=r?(o=t,i=n>r?r:n):n>=r&&n>=t?(o=n,i=t>r?r:t):(o=r,i=n>t?t:n),a.v=o,a.s=o?(o-i)/o:0;var s=void 0;return a.s?(s=o-i,a.h=t===o?(n-r)/s:n===o?2+(r-t)/s:4+(t-n)/s,a.h=parseInt(60*a.h),a.h<0&&(a.h+=360)):a.h=0,a.s=100*a.s|0,a.v=100*a.v|0,a},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 a=e.jPicker,i=a.Color,o=a.List,s=a.ColorMethods;return e.fn.jPicker=function(r){var a=arguments;return this.each(function(){var l=this,c=e.extend(!0,{},e.fn.jPicker.defaults,r);"input"===e(l).get(0).nodeName.toLowerCase()&&(e.extend(!0,c,{window:{bindToInput:!0,expandable:!0,input:e(l)}}),""===e(l).val()?(c.color.active=new i({hex:null}),c.color.current=new i({hex:null})):s.validateHex(e(l).val())&&(c.color.active=new i({hex:e(l).val(),a:c.color.active.val("a")}),c.color.current=new i({hex:e(l).val(),a:c.color.active.val("a")}))),c.window.expandable?e(l).after('    '):c.window.liveUpdate=!1;var u=parseFloat(navigator.appVersion.split("MSIE")[1])<7&&document.body.filters;function d(e){var t=V.active,n=t.val("hex"),r=void 0,a=void 0;switch(c.color.mode=e,e){case"h":if(setTimeout(function(){g.call(l,F,"transparent"),m.call(l,z,0),_.call(l,z,100),m.call(l,q,260),_.call(l,q,100),g.call(l,H,"transparent"),m.call(l,W,0),_.call(l,W,100),m.call(l,X,260),_.call(l,X,100),m.call(l,Q,260),_.call(l,Q,100),m.call(l,K,260),_.call(l,K,100),m.call(l,$,260),_.call(l,$,100)},0),J.range("all",{minX:0,maxX:100,minY:0,maxY:100}),ee.range("rangeY",{minY:0,maxY:360}),null==t.val("ahex"))break;J.val("xy",{x:t.val("s"),y:100-t.val("v")},J),ee.val("y",360-t.val("h"),ee);break;case"s":if(setTimeout(function(){g.call(l,F,"transparent"),m.call(l,z,-260),m.call(l,q,-520),m.call(l,W,-260),m.call(l,X,-520),m.call(l,$,260),_.call(l,$,100)},0),J.range("all",{minX:0,maxX:360,minY:0,maxY:100}),ee.range("rangeY",{minY:0,maxY:100}),null==t.val("ahex"))break;J.val("xy",{x:t.val("h"),y:100-t.val("v")},J),ee.val("y",100-t.val("s"),ee);break;case"v":if(setTimeout(function(){g.call(l,F,"000000"),m.call(l,z,-780),m.call(l,q,260),g.call(l,H,n),m.call(l,W,-520),m.call(l,X,260),_.call(l,X,100),m.call(l,$,260),_.call(l,$,100)},0),J.range("all",{minX:0,maxX:360,minY:0,maxY:100}),ee.range("rangeY",{minY:0,maxY:100}),null==t.val("ahex"))break;J.val("xy",{x:t.val("h"),y:100-t.val("s")},J),ee.val("y",100-t.val("v"),ee);break;case"r":if(r=-1040,a=-780,J.range("all",{minX:0,maxX:255,minY:0,maxY:255}),ee.range("rangeY",{minY:0,maxY:255}),null==t.val("ahex"))break;J.val("xy",{x:t.val("b"),y:255-t.val("g")},J),ee.val("y",255-t.val("r"),ee);break;case"g":if(r=-1560,a=-1820,J.range("all",{minX:0,maxX:255,minY:0,maxY:255}),ee.range("rangeY",{minY:0,maxY:255}),null==t.val("ahex"))break;J.val("xy",{x:t.val("b"),y:255-t.val("r")},J),ee.val("y",255-t.val("g"),ee);break;case"b":if(r=-2080,a=-2860,J.range("all",{minX:0,maxX:255,minY:0,maxY:255}),ee.range("rangeY",{minY:0,maxY:255}),null==t.val("ahex"))break;J.val("xy",{x:t.val("r"),y:255-t.val("g")},J),ee.val("y",255-t.val("b"),ee);break;case"a":if(setTimeout(function(){g.call(l,F,"transparent"),m.call(l,z,-260),m.call(l,q,-520),m.call(l,W,260),m.call(l,X,260),_.call(l,X,100),m.call(l,$,0),_.call(l,$,100)},0),J.range("all",{minX:0,maxX:360,minY:0,maxY:100}),ee.range("rangeY",{minY:0,maxY:255}),null==t.val("ahex"))break;J.val("xy",{x:t.val("h"),y:100-t.val("v")},J),ee.val("y",255-t.val("a"),ee);break;default:throw new Error("Invalid Mode")}switch(e){case"h":break;case"s":case"v":case"a":setTimeout(function(){_.call(l,z,100),_.call(l,W,100),m.call(l,Q,260),_.call(l,Q,100),m.call(l,K,260),_.call(l,K,100)},0);break;case"r":case"g":case"b":setTimeout(function(){g.call(l,F,"transparent"),g.call(l,H,"transparent"),_.call(l,W,100),_.call(l,z,100),m.call(l,z,r),m.call(l,q,r-260),m.call(l,W,a-780),m.call(l,X,a-520),m.call(l,Q,a),m.call(l,K,a-260),m.call(l,$,260),_.call(l,$,100)},0)}null!=t.val("ahex")&&h.call(l,t)}function h(e,t){(null==t||t!==ee&&t!==J)&&function(e,t){if(t!==J)switch(c.color.mode){case"h":var n=e.val("sv");J.val("xy",{x:null!=n?n.s:100,y:100-(null!=n?n.v:100)},t);break;case"s":case"a":var r=e.val("hv");J.val("xy",{x:r&&r.h||0,y:100-(null!=r?r.v:100)},t);break;case"v":var a=e.val("hs");J.val("xy",{x:a&&a.h||0,y:100-(null!=a?a.s:100)},t);break;case"r":var i=e.val("bg");J.val("xy",{x:i&&i.b||0,y:255-(i&&i.g||0)},t);break;case"g":var o=e.val("br");J.val("xy",{x:o&&o.b||0,y:255-(o&&o.r||0)},t);break;case"b":var s=e.val("rg");J.val("xy",{x:s&&s.r||0,y:255-(s&&s.g||0)},t)}if(t!==ee)switch(c.color.mode){case"h":ee.val("y",360-(e.val("h")||0),t);break;case"s":var l=e.val("s");ee.val("y",100-(null!=l?l:100),t);break;case"v":var u=e.val("v");ee.val("y",100-(null!=u?u:100),t);break;case"r":ee.val("y",255-(e.val("r")||0),t);break;case"g":ee.val("y",255-(e.val("g")||0),t);break;case"b":ee.val("y",255-(e.val("b")||0),t);break;case"a":var d=e.val("a");ee.val("y",255-(null!=d?d:255),t)}}.call(l,e,t),setTimeout(function(){(function(e){try{var t=e.val("all");ne.css({backgroundColor:t&&"#"+t.hex||"transparent"}),_.call(l,ne,t&&Math.precision(100*t.a/255,4)||0)}catch(e){}}).call(l,e),function(e){switch(c.color.mode){case"h":g.call(l,F,new i({h:e.val("h")||0,s:100,v:100}).val("hex"));break;case"s":case"a":var t=e.val("s");_.call(l,q,100-(null!=t?t:100));break;case"v":var n=e.val("v");_.call(l,z,null!=n?n:100);break;case"r":_.call(l,q,Math.precision((e.val("r")||0)/255*100,4));break;case"g":_.call(l,q,Math.precision((e.val("g")||0)/255*100,4));break;case"b":_.call(l,q,Math.precision((e.val("b")||0)/255*100))}var r=e.val("a");_.call(l,Y,Math.precision(100*(255-(r||0))/255,4))}.call(l,e),function(e){switch(c.color.mode){case"h":var t=e.val("a");_.call(l,Z,Math.precision(100*(255-(t||0))/255,4));break;case"s":var n=e.val("hva"),r=new i({h:n&&n.h||0,s:100,v:null!=n?n.v:100});g.call(l,H,r.val("hex")),_.call(l,X,100-(null!=n?n.v:100)),_.call(l,Z,Math.precision(100*(255-(n&&n.a||0))/255,4));break;case"v":var a=e.val("hsa"),o=new i({h:a&&a.h||0,s:null!=a?a.s:100,v:100});g.call(l,H,o.val("hex")),_.call(l,Z,Math.precision(100*(255-(a&&a.a||0))/255,4));break;case"r":case"g":case"b":var s=e.val("rgba"),u=0,d=0;"r"===c.color.mode?(u=s&&s.b||0,d=s&&s.g||0):"g"===c.color.mode?(u=s&&s.b||0,d=s&&s.r||0):"b"===c.color.mode&&(u=s&&s.r||0,d=s&&s.g||0);var h=d>u?u:d;_.call(l,X,u>d?Math.precision((u-d)/(255-d)*100,4):0),_.call(l,Q,d>u?Math.precision((d-u)/(255-u)*100,4):0),_.call(l,K,Math.precision(h/255*100,4)),_.call(l,Z,Math.precision(100*(255-(s&&s.a||0))/255,4));break;case"a":var f=e.val("a");g.call(l,H,e.val("hex")||"000000"),_.call(l,Z,null!=f?0:100),_.call(l,$,null!=f?100:0)}}.call(l,e)},0)}function f(e,t){var n=V.active;if(t===J||null!=n.val()){var r=e.val("all");switch(c.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 p(e,t){var n=V.active;if(t===ee||null!=n.val())switch(c.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 g(e,t){e.css({backgroundColor:t&&6===t.length&&"#"+t||"transparent"})}function v(e,t){u&&(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 m(e,t){e.css({top:t+"px"})}function _(e,t){if(e.css({visibility:t>0?"visible":"hidden"}),t>0&&t<100)if(u){var n=e.attr("pngSrc");null!=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:Math.precision(t/100,4)})}else e.css({opacity:Math.precision(t/100,4)});else if(0===t||100===t)if(u){var r=e.attr("pngSrc");null!=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 y(){V.active.val("ahex",V.current.val("ahex"))}function b(t){e(this).parents("tbody:first").find('input:radio[value!="'+t.target.value+'"]').removeAttr("checked"),d.call(l,t.target.value)}function x(){y.call(l)}function w(){y.call(l),c.window.expandable&&N.call(l),"function"==typeof fe&&fe.call(l,V.active,ie)}function S(){(function(){V.current.val("ahex",V.active.val("ahex"))}).call(l),c.window.expandable&&N.call(l),"function"==typeof de&&de.call(l,V.active,ae)}function k(){T.call(l)}function C(e,t){var n=e.val("hex");re.css({backgroundColor:n&&"#"+n||"transparent"}),_.call(l,re,Math.precision(100*(e.val("a")||0)/255,4))}function A(e,t){var n=e.val("hex"),r=e.val("va");se.css({backgroundColor:n&&"#"+n||"transparent"}),_.call(l,le,Math.precision(100*(255-(r&&r.a||0))/255,4)),c.window.bindToInput&&c.window.updateInputColor&&c.window.input.css({backgroundColor:n&&"#"+n||"transparent",color:null==r||r.v>75?"#000000":"#ffffff"})}function E(t){j=parseInt(U.css("left")),R=parseInt(U.css("top")),B=t.pageX,D=t.pageY,e(document).bind("mousemove",P).bind("mouseup",G),t.preventDefault()}function P(t){return U.css({left:j-(B-t.pageX)+"px",top:R-(D-t.pageY)+"px"}),c.window.expandable&&!e.support.boxModel&&U.prev().css({left:U.css("left"),top:U.css("top")}),t.stopPropagation(),t.preventDefault(),!1}function G(t){return e(document).unbind("mousemove",P).unbind("mouseup",G),t.stopPropagation(),t.preventDefault(),!1}function I(t){return t.preventDefault(),t.stopPropagation(),V.active.val("ahex",e(this).attr("title")||null,t.target),!1}function T(){function t(){if(c.window.expandable&&!e.support.boxModel){var t=U.find("table:first");U.before("