general bug fixes

master
Mark MacKay 2012-07-26 16:20:07 -05:00
parent 9ae60d7290
commit b4b12f8067
4 changed files with 222 additions and 222 deletions

View File

@ -1014,7 +1014,6 @@
} else {
fallback_obj[id] = btn.icon;
var svgicon = btn.svgicon ? btn.svgicon : btn.id;
console.log(svgicon);
if(btn.type == 'app_menu') {
placement_obj['#' + id + ' > div'] = svgicon;
} else {
@ -1563,15 +1562,17 @@
}
menu_items[(el_name === 'g' ? 'en':'dis') + 'ableContextMenuItems']('#ungroup');
menu_items[((el_name === 'g' || !multiselected) ? 'dis':'en') + 'ableContextMenuItems']('#group');
}
} // if (elem != null)
else if (multiselected) {
if (multiselected) {
$('#multiselected_panel').show();
$('.action_multi_selected').removeClass('disabled');
menu_items
.enableContextMenuItems('#group')
.disableContextMenuItems('#ungroup');
} else {
}
if (!elem) {
menu_items.disableContextMenuItems('#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back');
}
@ -3550,7 +3551,7 @@
$('#image_y') .dragInput({ min: null, max: null, step: 1, callback: changeAttribute, cursor: false });
$('#rect_rx') .dragInput({ min: 0, max: 100, step: 1, callback: changeRectRadius, cursor: true });
$('#stroke_width') .dragInput({ min: 0, max: 99, step: 1, callback: changeStrokeWidth, cursor: true, smallStep: 0.1, start: 1.5 });
$('#angle') .dragInput({ min: -180, max: 180, step: 1, callback: changeRotationAngle, cursor: false });
$('#angle') .dragInput({ min: -180, max: 180, step: 1, callback: changeRotationAngle, cursor: false, dragAdjust: 0.5 });
$('#font_size') .dragInput({ min: 1, max: 250, step: 1, callback: changeFontSize, cursor: true, stepfunc: stepFontSize });
$('#group_opacity').dragInput({ min: 0, max: 100, step: 5, callback: changeOpacity, cursor: true, start: 100 });
$('#blur') .dragInput({ min: 0, max: 10, step: .1, callback: changeBlur, cursor: true, start: 0 });

View File

@ -42,11 +42,11 @@ ia}).data("coord","center").appendTo(da),Ha=ya.clone().text("F").css({top:Ka*ia,
1)this.value=1;if(!(ca[0]==="f"&&!jb))if(M&&ba==="radialGradient"||!M&&ba==="linearGradient")X.setAttribute(ca,this.value);var Q=M?ca[0]==="c"?ya:Ha:ca[1]==="1"?Na:za,ea=ca.indexOf("x")>=0?"left":"top";Q.css(ea,this.value*ia)}).change()});var wa,qb,$a=$("#"+o+"_jGraduate_StopSlider"),ib,Wa,Sa,Da=a("path",{d:"m9.75,-6l-19.5,19.5m0,-19.5l19.5,19.5",fill:"none",stroke:"#D00","stroke-width":5,display:"none"},Wa),va,fb=1,La=1,Va=0,Ea=Fa,kb=Ia;Wa=a("svg",{width:"100%",height:45},$a[0]);da=a("pattern",{width:16,
height:16,patternUnits:"userSpaceOnUse",id:"jGraduate_trans"},Wa);a("image",{width:16,height:16},da).setAttributeNS(p.xlink,"xlink:href",B.images.clientPath+"map-opacity.png");$(Wa).on("click touchstart",function(la){va=$a.offset();if(la.target.tagName!=="path"){var ca=la.pageX-va.left-8;ca=ca<10?10:ca>ia+10?ia+10:ca;s(ca/ia,0,0,true);la.stopPropagation()}});$(Wa).mouseover(function(){Wa.appendChild(Da)});qb=a("g",{},Wa);a("line",{x1:10,y1:15,x2:ia+10,y2:15,"stroke-width":2,stroke:"#000"},Wa);var sb=
O.find(".jGraduate_spreadMethod").change(function(){X.setAttribute("spreadMethod",$(this).val())}),Za=null,bb=function(la){var ca=la.pageX-mb.left,ja=la.pageY-mb.top;ca=ca<0?0:ca>ia?ia:ca;ja=ja<0?0:ja>ia?ia:ja;Za.css("left",ca).css("top",ja);ca=ca/pa;ja=ja/fa;var M=Za.data("coord"),Q=X;switch(M){case "start":ka.x1.val(ca);ka.y1.val(ja);Q.setAttribute("x1",ca);Q.setAttribute("y1",ja);break;case "end":ka.x2.val(ca);ka.y2.val(ja);Q.setAttribute("x2",ca);Q.setAttribute("y2",ja);break;case "center":ka.cx.val(ca);
ka.cy.val(ja);Q.setAttribute("cx",ca);Q.setAttribute("cy",ja);Ea=ca;kb=ja;d();break;case "focus":ka.fx.val(ca);ka.fy.val(ja);Q.setAttribute("fx",ca);Q.setAttribute("fy",ja);d()}la.preventDefault()},Cb=function(){Za=null;R.unbind("mousemove",bb).unbind("mouseup",Cb)};wa=X.getElementsByTagNameNS(p.svg,"stop");if(ua<2){for(;ua<2;){X.appendChild(document.createElementNS(p.svg,"stop"));++ua}wa=X.getElementsByTagNameNS(p.svg,"stop")}var ua=wa.length;for(na=0;na<ua;na++)s(0,0,0,0,wa[na]);sb.val(X.getAttribute("spreadMethod")||
ka.cy.val(ja);Q.setAttribute("cx",ca);Q.setAttribute("cy",ja);Ea=ca;kb=ja;d();break;case "focus":ka.fx.val(ca);ka.fy.val(ja);Q.setAttribute("fx",ca);Q.setAttribute("fy",ja);d()}la.preventDefault()},Cb=function(){Za=null;R.unbind("mousemove",bb).unbind("mouseup",Cb)};wa=X.getElementsByTagNameNS(p.svg,"stop");if(ta<2){for(;ta<2;){X.appendChild(document.createElementNS(p.svg,"stop"));++ta}wa=X.getElementsByTagNameNS(p.svg,"stop")}var ta=wa.length;for(na=0;na<ta;na++)s(0,0,0,0,wa[na]);sb.val(X.getAttribute("spreadMethod")||
"pad");var mb,jb=false;sa.setAttribute("fill-opacity",oa/100);$("#"+o+" div.grad_coord").mousedown(function(la){la.preventDefault();Za=$(this);Za.offset();mb=Za.parent().offset();R.mousemove(bb).mouseup(Cb)});$("#"+o+"_jGraduate_Ok").bind("click touchstart",function(){q.paint.type=ba;q.paint[ba]=X.cloneNode(true);q.paint.solidColor=null;T()});$("#"+o+"_jGraduate_Cancel").bind("click touchstart",function(){N()});if(ba==="radialGradient")if(jb)Ha.show();else{Ha.hide();ka.fx.val("");ka.fy.val("")}$("#"+
o+"_jGraduate_match_ctr")[0].checked=!jb;var Ab,ob;$("#"+o+"_jGraduate_match_ctr").change(function(){jb=!this.checked;Ha.toggle(jb);ka.fx.val("");ka.fy.val("");var la=X;if(jb){var ca=Ab||0.5,ja=ob||0.5;la.setAttribute("fx",ca);la.setAttribute("fy",ja);ka.fx.val(ca);ka.fy.val(ja)}else{Ab=la.getAttribute("fx");ob=la.getAttribute("fy");la.removeAttribute("fx");la.removeAttribute("fy")}});wa=X.getElementsByTagNameNS(p.svg,"stop");ua=wa.length;if(ua<2){for(;ua<2;){X.appendChild(document.createElementNS(p.svg,
"stop"));++ua}wa=X.getElementsByTagNameNS(p.svg,"stop")}var eb;oa=O=0;if(ba==="radialGradient"){W=X.gradientTransform.baseVal;if(W.numberOfItems===2){ua=W.getItem(0);W=W.getItem(1);if(ua.type===2&&W.type===3){ua=W.matrix;if(ua.a!==1)O=Math.round(-(1-ua.a)*100);else if(ua.d!==1)O=Math.round((1-ua.d)*100)}}else if(W.numberOfItems===3){da=W.getItem(0);ua=W.getItem(1);W=W.getItem(2);if(da.type===4&&ua.type===2&&W.type===3){oa=Math.round(da.angle);ua=W.matrix;if(ua.a!==1)O=Math.round(-(1-ua.a)*100);else if(ua.d!==
1)O=Math.round((1-ua.d)*100)}}}O={radius:{handle:"#"+o+"_jGraduate_RadiusArrows",input:"#"+o+"_jGraduate_RadiusInput",val:(X.getAttribute("r")||0.5)*100},opacity:{handle:"#"+o+"_jGraduate_OpacArrows",input:"#"+o+"_jGraduate_OpacInput",val:q.paint.alpha||100},ellip:{handle:"#"+o+"_jGraduate_EllipArrows",input:"#"+o+"_jGraduate_EllipInput",val:O},angle:{handle:"#"+o+"_jGraduate_AngleArrows",input:"#"+o+"_jGraduate_AngleInput",val:oa}};$.each(O,function(la,ca){var ja=$(ca.handle);ja.mousedown(function(M){var Q=
o+"_jGraduate_match_ctr")[0].checked=!jb;var Ab,ob;$("#"+o+"_jGraduate_match_ctr").change(function(){jb=!this.checked;Ha.toggle(jb);ka.fx.val("");ka.fy.val("");var la=X;if(jb){var ca=Ab||0.5,ja=ob||0.5;la.setAttribute("fx",ca);la.setAttribute("fy",ja);ka.fx.val(ca);ka.fy.val(ja)}else{Ab=la.getAttribute("fx");ob=la.getAttribute("fy");la.removeAttribute("fx");la.removeAttribute("fy")}});wa=X.getElementsByTagNameNS(p.svg,"stop");ta=wa.length;if(ta<2){for(;ta<2;){X.appendChild(document.createElementNS(p.svg,
"stop"));++ta}wa=X.getElementsByTagNameNS(p.svg,"stop")}var eb;oa=O=0;if(ba==="radialGradient"){W=X.gradientTransform.baseVal;if(W.numberOfItems===2){ta=W.getItem(0);W=W.getItem(1);if(ta.type===2&&W.type===3){ta=W.matrix;if(ta.a!==1)O=Math.round(-(1-ta.a)*100);else if(ta.d!==1)O=Math.round((1-ta.d)*100)}}else if(W.numberOfItems===3){da=W.getItem(0);ta=W.getItem(1);W=W.getItem(2);if(da.type===4&&ta.type===2&&W.type===3){oa=Math.round(da.angle);ta=W.matrix;if(ta.a!==1)O=Math.round(-(1-ta.a)*100);else if(ta.d!==
1)O=Math.round((1-ta.d)*100)}}}O={radius:{handle:"#"+o+"_jGraduate_RadiusArrows",input:"#"+o+"_jGraduate_RadiusInput",val:(X.getAttribute("r")||0.5)*100},opacity:{handle:"#"+o+"_jGraduate_OpacArrows",input:"#"+o+"_jGraduate_OpacInput",val:q.paint.alpha||100},ellip:{handle:"#"+o+"_jGraduate_EllipArrows",input:"#"+o+"_jGraduate_EllipInput",val:O},angle:{handle:"#"+o+"_jGraduate_AngleArrows",input:"#"+o+"_jGraduate_AngleInput",val:oa}};$.each(O,function(la,ca){var ja=$(ca.handle);ja.mousedown(function(M){var Q=
ja.parent();eb={type:la,elem:ja,input:$(ca.input),parent:Q,offset:Q.offset()};R.mousemove(tb).mouseup(ub);M.preventDefault()});$(ca.input).val(ca.val).change(function(){var M=+this.value,Q=0,ea=ba==="radialGradient";switch(la){case "radius":ea&&X.setAttribute("r",M/100);Q=Math.pow(M/100,0.4)/2*145;break;case "opacity":q.paint.alpha=M;sa.setAttribute("fill-opacity",M/100);Q=M*1.45;break;case "ellip":fb=La=1;if(M===0){Q=72.5;break}if(M>99.5)M=99.5;if(M>0)La=1-M/100;else fb=-(M/100)-1;Q=145*((M+100)/
2)/100;ea&&d();break;case "angle":Va=M;Q=Va/180;Q+=0.5;Q*=145;ea&&d()}if(Q>145)Q=145;else if(Q<0)Q=0;ja.css({"margin-left":Q-5})}).change()});var tb=function(la){var ca=la.pageX-eb.offset.left-parseInt(eb.parent.css("border-left-width"));if(ca>145)ca=145;if(ca<=0)ca=0;var ja=ca-5;ca/=145;switch(eb.type){case "radius":ca=Math.pow(ca*2,2.5);if(ca>0.98&&ca<1.02)ca=1;if(ca<=0.01)ca=0.01;X.setAttribute("r",ca);break;case "opacity":q.paint.alpha=parseInt(ca*100);sa.setAttribute("fill-opacity",ca);break;
case "ellip":La=fb=1;if(ca<0.5){ca/=0.5;fb=ca<=0?0.01:ca}else if(ca>0.5){ca/=0.5;ca=2-ca;La=ca<=0?0.01:ca}d();ca-=1;if(La===ca+1)ca=Math.abs(ca);break;case "angle":ca-=0.5;Va=ca*=180;d();ca/=100}eb.elem.css({"margin-left":ja});ca=Math.round(ca*100);eb.input.val(ca);la.preventDefault()},ub=function(){R.unbind("mousemove",tb).unbind("mouseup",ub);eb=null};for(O=(q.paint.alpha*255/100).toString(16);O.length<2;)O="0"+O;O=O.split(".")[0];J=q.paint.solidColor=="none"?"":q.paint.solidColor+O;qa||(J=wa[0].getAttribute("stop-color"));
@ -206,9 +206,9 @@ Ia=svgedit.history.MoveElementCommand,Ca=svgedit.history.InsertElementCommand,Ka
Ia.type()){m=m?h.newParent:h.oldParent;m==l&&b.identifyLayers()}else if(z==Ca.type()||z==Ka.type()){h.parent==l&&b.identifyLayers();if(z==Ca.type())m&&Wa(h.elem);else m||Wa(h.elem);h.elem.tagName==="use"&&Lb(h.elem)}else if(z==Na.type()){h.elem.tagName=="title"&&h.elem.parentNode.parentNode==l&&b.identifyLayers();m=m?h.newValues:h.oldValues;m.stdDeviation&&b.setBlurOffsets(h.elem.parentNode,m.stdDeviation);if(h.elem.tagName==="use"&&svgedit.browser.isWebkit()){z=h.elem;if(!z.getAttribute("x")&&!z.getAttribute("y")){m=
z.parentNode;var w=z.nextSibling;m.removeChild(z);m.insertBefore(z,w)}}}}}});var ya=function(e){b.undoMgr.addCommandToHistory(e)};svgedit.select.init(n,{createSVGElement:function(e){return b.addSvgElementFromJson(e)},svgRoot:function(){return d},svgContent:function(){return l},currentZoom:function(){return o},getStrokedBBox:function(e){return b.getStrokedBBox([e])}});var Ha=this.selectorManager=svgedit.select.getSelectorManager();svgedit.path.init({getCurrentZoom:function(){return o},getSVGRoot:function(){return d}});
svgedit.utilities.snapToGrid=function(e){var h=n.snappingStep,m=n.baseUnit;if(m!=="px")h*=svgedit.units.getTypeMap()[m];return e=Math.round(e/h)*h};var wa=svgedit.utilities.snapToGrid,qb={exportNoBlur:"Blurred elements will appear as un-blurred",exportNoforeignObject:"foreignObject elements will not appear",exportNoDashArray:"Strokes will appear filled",exportNoText:"Text may not appear as expected"},$a=["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"],ib=$.data,
Wa=function(e){var h=$(e).attr($a),m;for(m in h){var z=h[m];if(z&&z.indexOf("url(")===0){z=ka(z).substr(1);if(!qa(z)){lb().appendChild(Ab[z]);delete Ab[z]}}}e=e.getElementsByTagName("*");if(e.length){h=0;for(m=e.length;h<m;h++)Wa(e[h])}},Sa={},Da=n.imgPath+"logo.png",va=[],fb={round_digits:5},La=false,Va=null,Ea="select",kb="none",sb={},Za=T.text,bb=N,Cb=null,ua=null,mb=[],jb={},Ab={};b.clipBoard=[];var ob=this.runExtensions=function(e,h,m){var z=false;if(m)z=[];$.each(jb,function(w,H){if(e in H)if(m)z.push(H[e](h));
else z=H[e](h)});return z};this.addExtension=function(e,h){if(e in jb)console.log('Cannot add extension "'+e+'", an extension by that name already exists"');else{var m=$.isFunction(h)?h($.extend(b.getPrivateMethods(),{svgroot:d,svgcontent:l,nonce:B().getNonce(),selectorManager:Ha})):h;jb[e]=m;M("extension_added",m)}};var eb=this.round=function(e){return parseInt(e*o)/o},tb=this.getIntersectionList=function(e){if(ua==null)return null;var h=K||B().getCurrentLayer();mb.length||(mb=wb(h));var m=null;
try{m=h.getIntersectionList(e,null)}catch(z){}if(m==null||typeof m.item!="function"){m=[];if(e)e=e;else{e=ua.getBBox();h={};for(var w in e)h[w]=e[w]/o;e=h}for(w=mb.length;w--;)e.width&&e.width&&svgedit.math.rectsIntersect(e,mb[w].bbox)&&m.push(mb[w].elem)}return m};getStrokedBBox=this.getStrokedBBox=function(e){e||(e=ub());if(!e.length)return false;var h=function(I){try{var E=svgedit.utilities.getBBox(I),G=svgedit.utilities.getRotationAngle(I);if(G&&G%90||svgedit.math.hasMatrixTransform(svgedit.transformlist.getTransformList(I))){G=
Wa=function(e){var h=$(e).attr($a),m;for(m in h){var z=h[m];if(z&&z.indexOf("url(")===0){z=ka(z).substr(1);if(!qa(z)){lb().appendChild(Ab[z]);delete Ab[z]}}}e=e.getElementsByTagName("*");if(e.length){h=0;for(m=e.length;h<m;h++)Wa(e[h])}},Sa={},Da=n.imgPath+"logo.png",va=[],fb={round_digits:5},La=false,Va=null,Ea="select",kb="none",sb={},Za=T.text,bb=N,Cb=null,ta=null,mb=[],jb={},Ab={};b.clipBoard=[];var ob=this.runExtensions=function(e,h,m){var z=false;if(m)z=[];$.each(jb,function(w,H){if(e in H)if(m)z.push(H[e](h));
else z=H[e](h)});return z};this.addExtension=function(e,h){if(e in jb)console.log('Cannot add extension "'+e+'", an extension by that name already exists"');else{var m=$.isFunction(h)?h($.extend(b.getPrivateMethods(),{svgroot:d,svgcontent:l,nonce:B().getNonce(),selectorManager:Ha})):h;jb[e]=m;M("extension_added",m)}};var eb=this.round=function(e){return parseInt(e*o)/o},tb=this.getIntersectionList=function(e){if(ta==null)return null;var h=K||B().getCurrentLayer();mb.length||(mb=wb(h));var m=null;
try{m=h.getIntersectionList(e,null)}catch(z){}if(m==null||typeof m.item!="function"){m=[];if(e)e=e;else{e=ta.getBBox();h={};for(var w in e)h[w]=e[w]/o;e=h}for(w=mb.length;w--;)e.width&&e.width&&svgedit.math.rectsIntersect(e,mb[w].bbox)&&m.push(mb[w].elem)}return m};getStrokedBBox=this.getStrokedBBox=function(e){e||(e=ub());if(!e.length)return false;var h=function(I){try{var E=svgedit.utilities.getBBox(I),G=svgedit.utilities.getRotationAngle(I);if(G&&G%90||svgedit.math.hasMatrixTransform(svgedit.transformlist.getTransformList(I))){G=
false;if(["ellipse","path","line","polyline","polygon"].indexOf(I.tagName)>=0)E=G=b.convertToPath(I,true);else if(I.tagName=="rect"){var L=I.getAttribute("rx"),k=I.getAttribute("ry");if(L||k)E=G=b.convertToPath(I,true)}if(!G){var u=I.cloneNode(true),C=document.createElementNS(c,"g"),D=I.parentNode;D.appendChild(C);C.appendChild(u);E=svgedit.utilities.bboxToObj(C.getBBox());D.removeChild(C)}}return E}catch(P){console.log(I,P);return null}},m;$.each(e,function(){if(!m)if(this.parentNode)m=h(this)});
if(m==null)return null;var z=m.x+m.width,w=m.y+m.height,H=m.x,A=m.y,v=function(I){var E=I.getAttribute("stroke-width"),G=0;if(I.getAttribute("stroke")!="none"&&!isNaN(E))G+=E/2;return G},F=[];$.each(e,function(I,E){var G=h(E);if(G){var L=v(E);H=Math.min(H,G.x-L);A=Math.min(A,G.y-L);F.push(G)}});m.x=H;m.y=A;$.each(e,function(I,E){var G=F[I];if(G&&E.nodeType==1){var L=v(E);z=Math.max(z,G.x+G.width+L);w=Math.max(w,G.y+G.height+L)}});m.width=z-H;m.height=w-A;return m};var ub=this.getVisibleElements=function(e){e||
(e=$(l).children());e.find("#canvas_background").length&&e.splice(0,1);var h=[];$(e).children().each(function(m,z){try{z.getBBox()&&h.push(z)}catch(w){}});return h.reverse()},wb=this.getVisibleElementsAndBBoxes=function(e){e||(e=$(l).children());var h=[];$(e).children().each(function(m,z){try{z.getBBox()&&h.push({elem:z,bbox:getStrokedBBox([z])})}catch(w){}});return h.reverse()},Bb=this.groupSvgElem=function(e){var h=document.createElementNS(c,"g");e.parentNode.replaceChild(h,e);$(h).append(e).data("gsvg",
@ -244,25 +244,25 @@ J)},vb=this.addToSelection=function(e,h){if(e.length!=0){for(var m=0;m<J.length;
null)return null;e=e.target;if(e.correspondingUseElement)e=e.correspondingUseElement;if(["http://www.w3.org/1998/Math/MathML","http://www.w3.org/1999/xhtml"].indexOf(e.namespaceURI)>=0&&e.id!="svgcanvas")for(;e.nodeName!="foreignObject";){e=e.parentNode;if(!e)return d}var h=B().getCurrentLayer();if([d,a,l,h].indexOf(e)>=0)return d;if($(e).closest("#selectorParentGroup").length)return Ha.selectorParentGroup;for(;e.parentNode!==(K||h);)e=e.parentNode;return e};(function(){var e=null,h=null,m=null,z=
null,w=null,H={},A={minx:null,miny:null,maxx:null,maxy:null};$(a).mousedown(function(v){if(!(v.originalEvent.touches&&v.originalEvent.touches>1)){var F=v.button===2;rb=l.getScreenCTM().inverse();isBotchedZoom=svgedit.browser.isGecko();var I=O(v.pageX,v.pageY,rb),E=I.x*(isBotchedZoom?1:o);I=I.y*(isBotchedZoom?1:o);v.preventDefault();if(F)Ea="select";E=E/o;I=I/o;var G=Ib(v);if(G.tagName==="a"&&G.childNodes.length===1)G=G.firstChild;var L=z=h=E,k=w=m=I;if(n.gridSnapping){E=wa(E);I=wa(I);h=wa(h);m=wa(m)}if(G==
Ha.selectorParentGroup&&J[0]!=null){G=v.target;var u=ib(G,"type");if(u=="rotate"){Ea="rotate";current_rotate_mode=ib(G,"dir")}else if(u=="resize"){Ea="resize";kb=ib(G,"dir")}G=J[0]}Va=G.getAttribute("transform");u=V(G);switch(Ea){case "select":La=true;kb="none";if(F)La=false;if(G!=d){if(J.indexOf(G)==-1){v.shiftKey||Qa(true);vb([G]);Cb=G;Ja.clear()}if(!F)for(F=0;F<J.length;++F)if(J[F]!=null){var C=V(J[F]);C.numberOfItems?C.insertItemBefore(d.createSVGTransform(),0):C.appendItem(d.createSVGTransform())}}else if(!F){Qa();
Ea="multiselect";if(ua==null)ua=Ha.getRubberBandBox();z*=o;w*=o;ma(ua,{x:z,y:w,width:0,height:0,display:"inline"},100)}break;case "zoom":La=true;if(ua==null)ua=Ha.getRubberBandBox();ma(ua,{x:L*o,y:L*o,width:0,height:0,display:"inline"},100);break;case "resize":La=true;h=E;m=I;H=svgedit.utilities.getBBox($("#selectedBox0")[0]);var D={};$.each(H,function(P,U){D[P]=U/o});H=D;F=oa(G)?1:0;if(pa(u)){u.insertItemBefore(d.createSVGTransform(),F);u.insertItemBefore(d.createSVGTransform(),F);u.insertItemBefore(d.createSVGTransform(),
Ea="multiselect";if(ta==null)ta=Ha.getRubberBandBox();z*=o;w*=o;ma(ta,{x:z,y:w,width:0,height:0,display:"inline"},100)}break;case "zoom":La=true;if(ta==null)ta=Ha.getRubberBandBox();ma(ta,{x:L*o,y:L*o,width:0,height:0,display:"inline"},100);break;case "resize":La=true;h=E;m=I;H=svgedit.utilities.getBBox($("#selectedBox0")[0]);var D={};$.each(H,function(P,U){D[P]=U/o});H=D;F=oa(G)?1:0;if(pa(u)){u.insertItemBefore(d.createSVGTransform(),F);u.insertItemBefore(d.createSVGTransform(),F);u.insertItemBefore(d.createSVGTransform(),
F)}else{u.appendItem(d.createSVGTransform());u.appendItem(d.createSVGTransform());u.appendItem(d.createSVGTransform());if(svgedit.browser.supportsNonScalingStroke()){if(E=svgedit.browser.isChrome())C=function(P){var U=P.getAttributeNS(null,"stroke");P.removeAttributeNS(null,"stroke");setTimeout(function(){P.setAttributeNS(null,"stroke",U)},1)};G.style.vectorEffect="non-scaling-stroke";E&&C(G);I=G.getElementsByTagName("*");L=I.length;for(F=0;F<L;F++){I[F].style.vectorEffect="non-scaling-stroke";E&&
C(I[F])}}}break;case "fhellipse":case "fhrect":case "fhpath":La=true;e=L+","+k+" ";C=N.stroke_width==0?1:N.stroke_width;R({element:"polyline",curStyles:true,attr:{points:e,id:ja(),fill:"none",opacity:N.opacity/2,"stroke-linecap":"round",style:"pointer-events:none"}});A.minx=L;A.maxx=L;A.miny=k;A.maxy=k;break;case "image":La=true;C=R({element:"image",attr:{x:E,y:I,width:0,height:0,id:ja(),opacity:N.opacity/2,style:"pointer-events:inherit"}});W(C,Da);pb(C);break;case "square":case "rect":La=true;h=
E;m=I;R({element:"rect",curStyles:true,attr:{x:E,y:I,width:0,height:0,id:ja(),opacity:N.opacity/2}});break;case "line":La=true;C=N.stroke_width==0?1:N.stroke_width;R({element:"line",curStyles:true,attr:{x1:E,y1:I,x2:E,y2:I,id:ja(),stroke:N.stroke,"stroke-width":C,"stroke-dasharray":N.stroke_dasharray,"stroke-linejoin":N.stroke_linejoin,"stroke-linecap":N.stroke_linecap,"stroke-opacity":N.stroke_opacity,fill:"none",opacity:N.opacity/2,style:"pointer-events:none"}});break;case "circle":La=true;R({element:"circle",
curStyles:true,attr:{cx:E,cy:I,r:0,id:ja(),opacity:N.opacity/2}});break;case "ellipse":La=true;R({element:"ellipse",curStyles:true,attr:{cx:E,cy:I,rx:0,ry:0,id:ja(),opacity:N.opacity/2}});break;case "text":La=true;R({element:"text",curStyles:true,attr:{x:E,y:I,id:ja(),fill:Za.fill,"stroke-width":Za.stroke_width,"font-size":Za.font_size,"font-family":Za.font_family,"text-anchor":"left","xml:space":"preserve",opacity:N.opacity}});break;case "path":case "pathedit":h*=o;m*=o;Ja.mouseDown(v,G,h,m);La=
true;break;case "textedit":h*=o;m*=o;hb.mouseDown(v,G,h,m);La=true;break;case "rotate":La=true;b.undoMgr.beginUndoableChange("transform",J);document.getElementById("workarea").className="rotate"}C=ob("mouseDown",{event:v,start_x:h,start_y:m,selectedElements:J},true);$.each(C,function(P,U){if(U&&U.started)La=true});if(Ea)document.getElementById("workarea").className=Ea=="resize"?v.target.style.cursor:Ea}}).mousemove(function(v){if(!(v.originalEvent.touches&&v.originalEvent.touches.length>1))if(La)if(!(v.button===
1||b.spaceKey)){var F=J[0],I=O(v.pageX,v.pageY,rb),E=I.x*(isBotchedZoom?1:o);I=I.y*(isBotchedZoom?1:o);var G=qa(ca()),L=x=E/o,k=y=I/o;if(n.gridSnapping){x=wa(x);y=wa(y)}v.preventDefault();switch(Ea){case "select":if(J[0]!==null){L=x-h;var u=y-m;if(n.gridSnapping){L=wa(L);u=wa(u)}if(v.shiftKey){var C=ba(h,m,x,y);x=C.x;y=C.y}if(L!=0||u!=0){C=J.length;for(k=0;k<C;++k){F=J[k];if(F==null)break;var D=d.createSVGTransform();G=V(F);D.setTranslate(L,u);G.numberOfItems?G.replaceItem(D,0):G.appendItem(D);Ha.requestSelector(F).resize()}if(v.altKey)if(!b.addClones){b.addClones=
b.cloneSelectedElements(0,0,D);b.removeClones=function(){b.addClones&&b.addClones.forEach(function(Oa){Oa.parentNode&&Oa.parentNode.removeChild(Oa);b.addClones=false})};window.addEventListener("keyup",b.removeClones)}M("transition",J)}}break;case "multiselect":L*=o;k*=o;ma(ua,{x:Math.min(z,L),y:Math.min(w,k),width:Math.abs(L-z),height:Math.abs(k-w)},100);G=[];L=[];D=tb();C=J.length;for(k=0;k<C;++k){u=D.indexOf(J[k]);if(u==-1)G.push(J[k]);else D[u]=null}C=D.length;for(k=0;k<C;++k)D[k]&&L.push(D[k]);
b.cloneSelectedElements(0,0,D);b.removeClones=function(){b.addClones&&b.addClones.forEach(function(Oa){Oa.parentNode&&Oa.parentNode.removeChild(Oa);b.addClones=false})};window.addEventListener("keyup",b.removeClones)}M("transition",J)}}break;case "multiselect":L*=o;k*=o;ma(ta,{x:Math.min(z,L),y:Math.min(w,k),width:Math.abs(L-z),height:Math.abs(k-w)},100);G=[];L=[];D=tb();C=J.length;for(k=0;k<C;++k){u=D.indexOf(J[k]);if(u==-1)G.push(J[k]);else D[u]=null}C=D.length;for(k=0;k<C;++k)D[k]&&L.push(D[k]);
G.length>0&&b.removeFromSelection(G);L.length>0&&vb(L);break;case "resize":G=V(F);L=(D=pa(G))?H:svgedit.utilities.getBBox(F);C=L.x;k=L.y;var P=L.width,U=L.height;L=x-h;u=y-m;if(n.gridSnapping){L=wa(L);u=wa(u);U=wa(U);P=wa(P)}var S=oa(F);if(S){var Y=Math.sqrt(L*L+u*u);u=Math.atan2(u,L)-S*Math.PI/180;L=Y*Math.cos(u);u=Y*Math.sin(u)}if(kb.indexOf("n")==-1&&kb.indexOf("s")==-1)u=0;if(kb.indexOf("e")==-1&&kb.indexOf("w")==-1)L=0;var aa=Y=0,ga=U?(U+u)/U:1,ra=P?(P+L)/P:1;if(kb.indexOf("n")>=0){ga=U?(U-u)/
U:1;aa=U}if(kb.indexOf("w")>=0){ra=P?(P-L)/P:1;Y=P}L=d.createSVGTransform();u=d.createSVGTransform();P=d.createSVGTransform();if(n.gridSnapping){C=wa(C);Y=wa(Y);k=wa(k);aa=wa(aa)}L.setTranslate(-(C+Y),-(k+aa));if(v.shiftKey)if(ra==1)ra=ga;else ga=ra;u.setScale(ra,ga);P.setTranslate(C+Y,k+aa);if(D){D=S?1:0;G.replaceItem(L,2+D);G.replaceItem(u,1+D);G.replaceItem(P,0+D)}else{D=G.numberOfItems;G.replaceItem(P,D-3);G.replaceItem(u,D-2);G.replaceItem(L,D-1)}Ha.requestSelector(F).resize();M("transition",
J);break;case "zoom":L*=o;k*=o;ma(ua,{x:Math.min(z*o,L),y:Math.min(w*o,k),width:Math.abs(L-z*o),height:Math.abs(k-w*o)},100);break;case "text":ma(G,{x:x,y:y},1E3);break;case "line":L=null;window.opera||d.suspendRedraw(1E3);if(n.gridSnapping){x=wa(x);y=wa(y)}D=x;C=y;if(v.shiftKey){C=ba(h,m,D,C);D=C.x;C=C.y}G.setAttributeNS(null,"x2",D);G.setAttributeNS(null,"y2",C);window.opera||d.unsuspendRedraw(L);break;case "foreignObject":case "square":case "rect":case "image":L=Math.abs(x-h);D=Math.abs(y-m);if(Ea==
J);break;case "zoom":L*=o;k*=o;ma(ta,{x:Math.min(z*o,L),y:Math.min(w*o,k),width:Math.abs(L-z*o),height:Math.abs(k-w*o)},100);break;case "text":ma(G,{x:x,y:y},1E3);break;case "line":L=null;window.opera||d.suspendRedraw(1E3);if(n.gridSnapping){x=wa(x);y=wa(y)}D=x;C=y;if(v.shiftKey){C=ba(h,m,D,C);D=C.x;C=C.y}G.setAttributeNS(null,"x2",D);G.setAttributeNS(null,"y2",C);window.opera||d.unsuspendRedraw(L);break;case "foreignObject":case "square":case "rect":case "image":L=Math.abs(x-h);D=Math.abs(y-m);if(Ea==
"square"||v.shiftKey){L=D=Math.max(L,D);C=h<x?h:h-L;k=m<y?m:m-D}else{C=Math.min(h,x);k=Math.min(m,y)}if(v.altKey){L*=2;D*=2;C=h-L/2;k=m-D/2}if(n.gridSnapping){L=wa(L);D=wa(D);C=wa(C);k=wa(k)}ma(G,{width:L,height:D,x:C,y:k},1E3);break;case "circle":L=$(G).attr(["cx","cy"]);D=L.cx;C=L.cy;L=Math.sqrt((x-D)*(x-D)+(y-C)*(y-C));if(n.gridSnapping)L=wa(L);G.setAttributeNS(null,"r",L);break;case "ellipse":L=$(G).attr(["cx","cy"]);D=Math.abs(h+(x-h)/2);C=Math.abs(m+(y-m)/2);L=null;window.opera||d.suspendRedraw(1E3);
if(n.gridSnapping){x=wa(x);D=wa(D);y=wa(y);C=wa(C)}k=Math.abs(h-D);u=Math.abs(m-C);if(v.shiftKey){u=k;C=y>m?m+k:m-k}if(v.altKey){D=h;C=m;k=Math.abs(x-D);u=v.shiftKey?k:Math.abs(y-C)}G.setAttributeNS(null,"rx",k);G.setAttributeNS(null,"ry",u);G.setAttributeNS(null,"cx",D);G.setAttributeNS(null,"cy",C);window.opera||d.unsuspendRedraw(L);break;case "fhellipse":case "fhrect":A.minx=Math.min(L,A.minx);A.maxx=Math.max(L,A.maxx);A.miny=Math.min(k,A.miny);A.maxy=Math.max(k,A.maxy);case "fhpath":e+=+L+","+
k+" ";G.setAttributeNS(null,"points",e);break;case "path":case "pathedit":x*=o;y*=o;if(n.gridSnapping){x=wa(x);y=wa(y);h=wa(h);m=wa(m)}if(v.shiftKey){if(D=svgedit.path.path){G=D.dragging?D.dragging[0]:h;D=D.dragging?D.dragging[1]:m}else{G=h;D=m}C=ba(G,D,x,y);x=C.x;y=C.y}if(ua&&ua.getAttribute("display")!=="none"){L*=o;k*=o;ma(ua,{x:Math.min(z*o,L),y:Math.min(w*o,k),width:Math.abs(L-z*o),height:Math.abs(k-w*o)},100)}Ja.mouseMove(v,x,y);break;case "textedit":x*=o;y*=o;hb.mouseMove(E,I);break;case "rotate":L=
k+" ";G.setAttributeNS(null,"points",e);break;case "path":case "pathedit":x*=o;y*=o;if(n.gridSnapping){x=wa(x);y=wa(y);h=wa(h);m=wa(m)}if(v.shiftKey){if(D=svgedit.path.path){G=D.dragging?D.dragging[0]:h;D=D.dragging?D.dragging[1]:m}else{G=h;D=m}C=ba(G,D,x,y);x=C.x;y=C.y}if(ta&&ta.getAttribute("display")!=="none"){L*=o;k*=o;ma(ta,{x:Math.min(z*o,L),y:Math.min(w*o,k),width:Math.abs(L-z*o),height:Math.abs(k-w*o)},100)}Ja.mouseMove(v,x,y);break;case "textedit":x*=o;y*=o;hb.mouseMove(E,I);break;case "rotate":L=
svgedit.utilities.getBBox(F);D=L.x+L.width/2;C=L.y+L.height/2;G=X(F);G=O(D,C,G);D=G.x;C=G.y;G=L.x;k=L.y;if(current_rotate_mode=="nw")G=L.x+L.width;if(current_rotate_mode=="se")k=L.y+L.height;if(current_rotate_mode=="sw"){G=L.x+L.width;k=L.y+L.height}compensation_angle=(Math.atan2(C-k,D-G)*(180/Math.PI)-90)%360;S=(Math.atan2(C-y,D-x)*(180/Math.PI)-90)%360;S+=compensation_angle;if(n.gridSnapping)S=wa(S);if(v.shiftKey)S=Math.round(S/45)*45;b.setRotationAngle(S<-180?360+S:S,true);M("transition",J)}ob("mouseMove",
{event:v,mouse_x:E,mouse_y:I,selected:F})}}).click(function(v){v.preventDefault();return false}).dblclick(function(v){var F=v.target.parentNode;if(F!==K){var I=Ib(v),E=I.tagName;if(E==="text"&&Ea!=="textedit"){v=O(v.pageX,v.pageY,rb);hb.select(I,v.x,v.y)}if((E==="g"||E==="a")&&oa(I)){Mb(I);I=J[0];Qa(true)}K&&Jb();F.tagName!=="g"&&F.tagName!=="a"||F===B().getCurrentLayer()||I===Ha.selectorParentGroup||Rb(I)}}).mouseup(function(v){b.addClones=false;window.removeEventListener("keyup",b.removeClones);
if(v.button!==2){var F=Cb;Cb=null;if(La){var I=O(v.pageX,v.pageY,rb),E=I.x*o;I=I.y*o;var G=E/o,L=I/o,k=qa(ca()),u=false;La=false;switch(Ea){case "resize":case "multiselect":if(ua!=null){ua.setAttribute("display","none");mb=[]}Ea="select";case "select":if(J[0]!=null){if(J[1]==null){E=J[0];switch(E.tagName){case "g":case "use":case "image":case "foreignObject":break;default:bb.fill=E.getAttribute("fill");bb.fill_opacity=E.getAttribute("fill-opacity");bb.stroke=E.getAttribute("stroke");bb.stroke_opacity=
if(v.button!==2){var F=Cb;Cb=null;if(La){var I=O(v.pageX,v.pageY,rb),E=I.x*o;I=I.y*o;var G=E/o,L=I/o,k=qa(ca()),u=false;La=false;switch(Ea){case "resize":case "multiselect":if(ta!=null){ta.setAttribute("display","none");mb=[]}Ea="select";case "select":if(J[0]!=null){if(J[1]==null){E=J[0];switch(E.tagName){case "g":case "use":case "image":case "foreignObject":break;default:bb.fill=E.getAttribute("fill");bb.fill_opacity=E.getAttribute("fill-opacity");bb.stroke=E.getAttribute("stroke");bb.stroke_opacity=
E.getAttribute("stroke-opacity");bb.stroke_width=E.getAttribute("stroke-width");bb.stroke_dasharray=E.getAttribute("stroke-dasharray");bb.stroke_linejoin=E.getAttribute("stroke-linejoin");bb.stroke_linecap=E.getAttribute("stroke-linecap")}if(E.tagName=="text"){Za.font_size=E.getAttribute("font-size");Za.font_family=E.getAttribute("font-family")}Ha.requestSelector(E).showGrips(true)}Ga();if(G!=z||L!=w){v=J.length;for(E=0;E<v;++E){if(J[E]==null)break;J[E].firstChild||Ha.requestSelector(J[E]).resize()}}else{E=
v.target;if(J[0].nodeName==="path"&&J[1]==null)Ja.select(J[0]);else v.shiftKey&&F!=E&&b.removeFromSelection([E])}if(svgedit.browser.supportsNonScalingStroke())if(v=J[0]){v.removeAttribute("style");svgedit.utilities.walkTree(v,function(P){P.removeAttribute("style")})}}return;case "zoom":ua!=null&&ua.setAttribute("display","none");M("zoomed",{x:Math.min(z,G),y:Math.min(w,L),width:Math.abs(G-z),height:Math.abs(L-w),factor:v.altKey?0.5:2});return;case "fhpath":F=k.getAttribute("points");G=F.indexOf(",");
v.target;if(J[0].nodeName==="path"&&J[1]==null)Ja.select(J[0]);else v.shiftKey&&F!=E&&b.removeFromSelection([E])}if(svgedit.browser.supportsNonScalingStroke())if(v=J[0]){v.removeAttribute("style");svgedit.utilities.walkTree(v,function(P){P.removeAttribute("style")})}}return;case "zoom":ta!=null&&ta.setAttribute("display","none");M("zoomed",{x:Math.min(z,G),y:Math.min(w,L),width:Math.abs(G-z),height:Math.abs(L-w),factor:v.altKey?0.5:2});return;case "fhpath":F=k.getAttribute("points");G=F.indexOf(",");
if(u=G>=0?F.indexOf(",",G+1)>=0:F.indexOf(" ",F.indexOf(" ")+1)>=0)k=Ja.smoothPolylineIntoPath(k);break;case "line":F=$(k).attr(["x1","x2","y1","y2"]);u=F.x1!=F.x2||F.y1!=F.y2;break;case "foreignObject":case "square":case "rect":case "image":F=$(k).attr(["width","height"]);u=F.width!=0||F.height!=0||Ea==="image";break;case "circle":u=k.getAttribute("r")!=0;break;case "ellipse":F=$(k).attr(["rx","ry"]);u=F.rx!=null||F.ry!=null;break;case "fhellipse":if(A.maxx-A.minx>0&&A.maxy-A.miny>0){k=R({element:"ellipse",
curStyles:true,attr:{cx:(A.minx+A.maxx)/2,cy:(A.miny+A.maxy)/2,rx:(A.maxx-A.minx)/2,ry:(A.maxy-A.miny)/2,id:ca()}});M("changed",[k]);u=true}break;case "fhrect":if(A.maxx-A.minx>0&&A.maxy-A.miny>0){k=R({element:"rect",curStyles:true,attr:{x:A.minx,y:A.miny,width:A.maxx-A.minx,height:A.maxy-A.miny,id:ca()}});M("changed",[k]);u=true}break;case "text":u=true;xb([k]);hb.start(k);break;case "path":k=null;La=true;F=Ja.mouseUp(v,k,E,I);k=F.element;u=F.keep;break;case "pathedit":u=true;k=null;Ja.mouseUp(v);
break;case "textedit":u=false;k=null;hb.mouseUp(v,E,I);break;case "rotate":u=true;k=null;Ea="select";F=b.undoMgr.finishUndoableChange();F.isEmpty()||ya(F);Ga();M("changed",J)}E=ob("mouseUp",{event:v,mouse_x:E,mouse_y:I},true);$.each(E,function(P,U){if(U){u=U.keep||u;k=U.element;La=U.started||La}});if(!u&&k!=null){B().releaseId(ca());k.parentNode.removeChild(k);k=null;for(E=v.target;E.parentNode.parentNode.tagName=="g";)E=E.parentNode;if((Ea!="path"||!drawn_path)&&E.parentNode.id!="selectorParentGroup"&&
@ -281,12 +281,12 @@ fill:"none"});F=qa("selectorParentGroup").appendChild(F)}F.setAttribute("display
I,v);I=w.createSVGPathSegClosePath();E.appendItem(A);E.appendItem(I)}else if(C<3)return E=false;$(F).remove();element=L;w=null;La=false;if(e){svgedit.path.path.matrix&&db(L,{},svgedit.path.path.matrix.inverse());F=L.getAttribute("d");A=$(svgedit.path.path.elem).attr("d");$(svgedit.path.path.elem).attr("d",A+F);$(L).remove();svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath();svgedit.path.path.init();Ja.toEditMode(svgedit.path.path.elem);svgedit.path.path.selectPt();return false}}else{if(!$.contains(a,
Ib(A))){console.log("Clicked outside canvas");return false}E=w.pathSegList.numberOfItems;G=w.pathSegList.getItem(E-1);L=G.x;G=G.y;if(A.shiftKey){A=ba(L,G,I,v);I=A.x;v=A.y}A=F.pathSegList.getItem(1);A=A.pathSegType===4?w.createSVGPathSegLinetoAbs(eb(I),eb(v)):w.createSVGPathSegCurvetoCubicAbs(eb(I),eb(v),A.x1/o,A.y1/o,A.x2/o,A.y2/o);w.pathSegList.appendItem(A);I*=o;v*=o;F.setAttribute("d",["M",I,v,I,v].join(" "));F=E;if(e)F+=svgedit.path.path.segs.length;svgedit.path.addPointGrip(F,I,v)}}else{d_attr=
"M"+I+","+v+" ";w=R({element:"path",curStyles:true,attr:{d:d_attr,id:ja(),opacity:N.opacity/2}});F.setAttribute("d",["M",mouse_x,mouse_y,mouse_x,mouse_y].join(" "));F=e?svgedit.path.path.segs.length:0;svgedit.path.addPointGrip(F,mouse_x,mouse_y)}}else if(svgedit.path.path){svgedit.path.path.storeD();L=A.target.id;if(L.substr(0,14)=="pathpointgrip_"){v=svgedit.path.path.cur_pt=parseInt(L.substr(14));svgedit.path.path.dragging=[F,I];E=svgedit.path.path.segs[v];if(A.shiftKey)E.selected?svgedit.path.path.removePtFromSelection(v):
svgedit.path.path.addPtsToSelection(v);else{if(svgedit.path.path.selected_pts.length<=1||!E.selected)svgedit.path.path.clearSelection();svgedit.path.path.addPtsToSelection(v)}}else if(L.indexOf("ctrlpointgrip_")==0){svgedit.path.path.dragging=[F,I];A=L.split("_")[1].split("c");v=A[0]-0;svgedit.path.path.selectPt(v,A[1]-0)}if(!svgedit.path.path.dragging){if(ua==null)ua=Ha.getRubberBandBox();ma(ua,{x:F*o,y:I*o,width:0,height:0,display:"inline"},100)}}},mouseMove:function(A,v,F){H=true;if(Ea==="path"){if(w){var I=
svgedit.path.path.addPtsToSelection(v);else{if(svgedit.path.path.selected_pts.length<=1||!E.selected)svgedit.path.path.clearSelection();svgedit.path.path.addPtsToSelection(v)}}else if(L.indexOf("ctrlpointgrip_")==0){svgedit.path.path.dragging=[F,I];A=L.split("_")[1].split("c");v=A[0]-0;svgedit.path.path.selectPt(v,A[1]-0)}if(!svgedit.path.path.dragging){if(ta==null)ta=Ha.getRubberBandBox();ma(ta,{x:F*o,y:I*o,width:0,height:0,display:"inline"},100)}}},mouseMove:function(A,v,F){H=true;if(Ea==="path"){if(w){var I=
w.pathSegList;A=I.numberOfItems-1;if(m){var E=svgedit.path.addCtrlGrip("1c1"),G=svgedit.path.addCtrlGrip("0c2");G.getAttribute("cx");G.getAttribute("cy");E.setAttribute("cx",v);E.setAttribute("cy",F);E.setAttribute("display","inline");E=m[0];var L=m[1];I.getItem(A);var k=E+(E-v/o),u=L+(L-F/o);G.setAttribute("cx",k*o);G.setAttribute("cy",u*o);G.setAttribute("display","inline");G=svgedit.path.getCtrlLine(1);var C=svgedit.path.getCtrlLine(2);ma(G,{x1:v,y1:F,x2:E*o,y2:L*o,display:"inline"});ma(C,{x1:k*
o,y1:u*o,x2:E*o,y2:L*o,display:"inline"});if(A===0)z=[v,F];else{I=I.getItem(A-1);v=I.x;F=I.y;if(I.pathSegType===6){v+=v-I.x2;F+=F-I.y2}else if(z){v=z[0]/o;F=z[1]/o}svgedit.path.replacePathSeg(6,A,[E,L,v,F,k,u],w)}}else if(E=qa("path_stretch_line")){A=I.getItem(A);if(A.pathSegType===6)svgedit.path.replacePathSeg(6,1,[v,F,(A.x+(A.x-A.x2))*o,(A.y+(A.y-A.y2))*o,v,F],E);else z?svgedit.path.replacePathSeg(6,1,[v,F,z[0],z[1],v,F],E):svgedit.path.replacePathSeg(4,1,[v,F],E)}}}else if(svgedit.path.path.dragging){E=
svgedit.path.getPointFromGrip({x:svgedit.path.path.dragging[0],y:svgedit.path.path.dragging[1]},svgedit.path.path);L=svgedit.path.getPointFromGrip({x:v,y:F},svgedit.path.path);A=L.x-E.x;E=L.y-E.y;svgedit.path.path.dragging=[v,F];svgedit.path.path.dragctrl?svgedit.path.path.moveCtrl(A,E):svgedit.path.path.movePts(A,E)}else{svgedit.path.path.selected_pts=[];svgedit.path.path.eachSeg(function(){if(this.next||this.prev){var D=ua.getBBox(),P=svgedit.path.getGripPt(this);D=svgedit.math.rectsIntersect(D,
{x:P.x,y:P.y,width:0,height:0});this.select(D);D&&svgedit.path.path.selected_pts.push(this.index)}})}},mouseUp:function(A,v){if(Ea==="path"){m=null;if(!w){v=qa(ca());La=false;z=null}return{keep:true,element:v}}if(svgedit.path.path.dragging){var F=svgedit.path.path.cur_pt;svgedit.path.path.dragging=false;svgedit.path.path.dragctrl=false;svgedit.path.path.update();H&&svgedit.path.path.endChanges("Move path point(s)");!A.shiftKey&&!H&&svgedit.path.path.selectPt(F)}else if(ua&&ua.getAttribute("display")!=
"none"){ua.setAttribute("display","none");ua.getAttribute("width")<=2&&ua.getAttribute("height")<=2&&Ja.toSelectMode(A.target)}else Ja.toSelectMode(A.target);H=false},toEditMode:function(A){svgedit.path.path=svgedit.path.getPath_(A);Ea="pathedit";Qa();svgedit.path.path.show(true).update();svgedit.path.path.oldbbox=svgedit.utilities.getBBox(svgedit.path.path.elem);e=false},toSelectMode:function(A){var v=A==svgedit.path.path.elem;Ea="select";svgedit.path.path.show(false);h=false;Qa();svgedit.path.path.matrix&&
svgedit.path.getPointFromGrip({x:svgedit.path.path.dragging[0],y:svgedit.path.path.dragging[1]},svgedit.path.path);L=svgedit.path.getPointFromGrip({x:v,y:F},svgedit.path.path);A=L.x-E.x;E=L.y-E.y;svgedit.path.path.dragging=[v,F];svgedit.path.path.dragctrl?svgedit.path.path.moveCtrl(A,E):svgedit.path.path.movePts(A,E)}else{svgedit.path.path.selected_pts=[];svgedit.path.path.eachSeg(function(){if(this.next||this.prev){var D=ta.getBBox(),P=svgedit.path.getGripPt(this);D=svgedit.math.rectsIntersect(D,
{x:P.x,y:P.y,width:0,height:0});this.select(D);D&&svgedit.path.path.selected_pts.push(this.index)}})}},mouseUp:function(A,v){if(Ea==="path"){m=null;if(!w){v=qa(ca());La=false;z=null}return{keep:true,element:v}}if(svgedit.path.path.dragging){var F=svgedit.path.path.cur_pt;svgedit.path.path.dragging=false;svgedit.path.path.dragctrl=false;svgedit.path.path.update();H&&svgedit.path.path.endChanges("Move path point(s)");!A.shiftKey&&!H&&svgedit.path.path.selectPt(F)}else if(ta&&ta.getAttribute("display")!=
"none"){ta.setAttribute("display","none");ta.getAttribute("width")<=2&&ta.getAttribute("height")<=2&&Ja.toSelectMode(A.target)}else Ja.toSelectMode(A.target);H=false},toEditMode:function(A){svgedit.path.path=svgedit.path.getPath_(A);Ea="pathedit";Qa();svgedit.path.path.show(true).update();svgedit.path.path.oldbbox=svgedit.utilities.getBBox(svgedit.path.path.elem);e=false},toSelectMode:function(A){var v=A==svgedit.path.path.elem;Ea="select";svgedit.path.path.show(false);h=false;Qa();svgedit.path.path.matrix&&
svgedit.path.recalcRotatedPath();if(v){M("selected",[A]);vb([A],true)}},addSubPath:function(A){if(A){Ea="path";e=true}else{Ja.clear(true);Ja.toEditMode(svgedit.path.path.elem)}},select:function(A){if(h===A){Ja.toEditMode(A);Ea="pathedit"}else h=A},reorient:function(){var A=J[0];if(A)if(oa(A)!=0){var v=new za("Reorient path"),F={d:A.getAttribute("d"),transform:A.getAttribute("transform")};v.addSubCommand(new Na(A,F));Qa();this.resetOrientation(A);ya(v);svgedit.path.getPath_(A).show(false).matrix=null;
this.clear();vb([A],true);M("changed",J)}},clear:function(){h=null;if(w){var A=qa(ca());$(qa("path_stretch_line")).remove();$(A).remove();$(qa("pathpointgrip_container")).find("*").attr("display","none");w=z=null;La=false}else Ea=="pathedit"&&this.toSelectMode();svgedit.path.path&&svgedit.path.path.init().show(false)},resetOrientation:function(A){if(A==null||A.nodeName!="path")return false;var v=V(A),F=fa(v).matrix;v.clear();A.removeAttribute("transform");v=A.pathSegList;for(var I=v.numberOfItems,
E=0;E<I;++E){var G=v.getItem(E),L=G.pathSegType;if(L!=1){var k=[];$.each(["",1,2],function(u,C){var D=G["x"+C],P=G["y"+C];if(D!==undefined&&P!==undefined){D=O(D,P,F);k.splice(k.length,0,D.x,D.y)}});svgedit.path.replacePathSeg(L,E,k,A)}}g(A,F)},zoomChange:function(){Ea=="pathedit"&&svgedit.path.path.update()},getNodePoint:function(){var A=svgedit.path.path.segs[svgedit.path.path.selected_pts.length?svgedit.path.path.selected_pts[0]:1];return{x:A.item.x,y:A.item.y,type:A.type}},linkControlPoints:function(A){svgedit.path.setLinkControlPoints(A)},
@ -297,7 +297,7 @@ var F=function(){var I=svgedit.path.path.elem.pathSegList,E=I.numberOfItems,G=fu
1){Ja.toSelectMode(svgedit.path.path.elem);b.deleteSelectedElements()}else{svgedit.path.path.init();svgedit.path.path.clearSelection();if(window.opera){A=$(svgedit.path.path.elem);A.attr("d",A.attr("d"))}svgedit.path.path.endChanges("Delete path node(s)")}}},smoothPolylineIntoPath:function(A){var v=A.points,F=v.numberOfItems;if(F>=4){var I=v.getItem(0),E=null;A=[];A.push(["M",I.x,",",I.y," C"].join(""));for(var G=1;G<=F-4;G+=3){var L=v.getItem(G),k=v.getItem(G+1),u=v.getItem(G+2);if(E)if((I=svgedit.path.smoothControlPoints(E,
L,I))&&I.length==2){L=A[A.length-1].split(",");L[2]=I[0].x;L[3]=I[0].y;A[A.length-1]=L.join(",");L=I[1]}A.push([L.x,L.y,k.x,k.y,u.x,u.y].join(","));I=u;E=k}for(A.push("L");G<F;++G){k=v.getItem(G);A.push([k.x,k.y].join(","))}A=A.join(" ");A=R({element:"path",curStyles:true,attr:{id:ca(),d:A,fill:"none"}})}return A},setSegType:function(A){svgedit.path.path.setSegType(A)},moveNode:function(A,v){var F=svgedit.path.path.selected_pts;if(F.length){svgedit.path.path.storeD();F=svgedit.path.path.segs[F[0]];
var I={x:0,y:0};I[A]=v-F.item[A];F.move(I.x,I.y);svgedit.path.path.endChanges("Move path point")}},fixEnd:function(A){for(var v=A.pathSegList,F=v.numberOfItems,I,E=0;E<F;++E){var G=v.getItem(E);if(G.pathSegType===2)I=G;if(G.pathSegType===1){G=v.getItem(E-1);if(G.x!=I.x||G.y!=I.y){v=A.createSVGPathSegLinetoAbs(I.x,I.y);svgedit.path.insertItemBefore(A,v,E);Ja.fixEnd(A);break}}}svgedit.browser.isWebkit()&&A.setAttribute("d",Ja.convertPath(A))},convertPath:function(A,v){for(var F=A.pathSegList,I=F.numberOfItems,
E=0,G=0,L="",k=null,u=0;u<I;++u){var C=F.getItem(u),D=C.x||0,P=C.y||0,U=C.x1||0,S=C.y1||0,Y=C.x2||0,aa=C.y2||0,ga=C.pathSegType,ra=Pa[ga]["to"+(v?"Lower":"Upper")+"Case"](),Oa=function(Ba,ha,Ta){ha=ha?" "+ha.join(" "):"";Ta=Ta?" "+svgedit.units.shortFloat(Ta):"";$.each(Ba,function(Ra,ta){Ba[Ra]=svgedit.units.shortFloat(ta)});L+=ra+Ba.join(" ")+ha+Ta};switch(ga){case 1:L+="z";break;case 12:D-=E;case 13:if(v){E+=D;ra="l"}else{D+=E;E=D;ra="L"}Oa([[D,G]]);break;case 14:P-=G;case 15:if(v){G+=P;ra="l"}else{P+=
E=0,G=0,L="",k=null,u=0;u<I;++u){var C=F.getItem(u),D=C.x||0,P=C.y||0,U=C.x1||0,S=C.y1||0,Y=C.x2||0,aa=C.y2||0,ga=C.pathSegType,ra=Pa[ga]["to"+(v?"Lower":"Upper")+"Case"](),Oa=function(Ba,ha,Ta){ha=ha?" "+ha.join(" "):"";Ta=Ta?" "+svgedit.units.shortFloat(Ta):"";$.each(Ba,function(Ra,ua){Ba[Ra]=svgedit.units.shortFloat(ua)});L+=ra+Ba.join(" ")+ha+Ta};switch(ga){case 1:L+="z";break;case 12:D-=E;case 13:if(v){E+=D;ra="l"}else{D+=E;E=D;ra="L"}Oa([[D,G]]);break;case 14:P-=G;case 15:if(v){G+=P;ra="l"}else{P+=
G;G=P;ra="L"}Oa([[E,P]]);break;case 2:case 4:case 18:D-=E;P-=G;case 5:case 3:if(k&&F.getItem(u-1).pathSegType===1&&!v){E=k[0];G=k[1]}case 19:if(v){E+=D;G+=P}else{D+=E;P+=G;E=D;G=P}if(ga===3)k=[E,G];Oa([[D,P]]);break;case 6:D-=E;U-=E;Y-=E;P-=G;S-=G;aa-=G;case 7:if(v){E+=D;G+=P}else{D+=E;U+=E;Y+=E;P+=G;S+=G;aa+=G;E=D;G=P}Oa([[U,S],[Y,aa],[D,P]]);break;case 8:D-=E;U-=E;P-=G;S-=G;case 9:if(v){E+=D;G+=P}else{D+=E;U+=E;P+=G;S+=G;E=D;G=P}Oa([[U,S],[D,P]]);break;case 10:D-=E;P-=G;case 11:if(v){E+=D;G+=P}else{D+=
E;P+=G;E=D;G=P}Oa([[C.r1,C.r2]],[C.angle,C.largeArcFlag?1:0,C.sweepFlag?1:0],[D,P]);break;case 16:D-=E;Y-=E;P-=G;aa-=G;case 17:if(v){E+=D;G+=P}else{D+=E;Y+=E;P+=G;aa+=G;E=D;G=P}Oa([[Y,aa],[D,P]])}}return L}}}(),Kb=this.removeUnusedDefElems=function(){var e=l.getElementsByTagNameNS(c,"defs");if(!e||!e.length)return 0;for(var h=[],m=0,z=["fill","stroke","filter","marker-start","marker-mid","marker-end"],w=z.length,H=l.getElementsByTagNameNS(c,"*"),A=H.length,v=0;v<A;v++){for(var F=H[v],I=0;I<w;I++){var E=
ka(F.getAttribute(z[I]));E&&h.push(E.substr(1))}(F=da(F))&&F.indexOf("#")===0&&h.push(F.substr(1))}e=$(e).find("linearGradient, radialGradient, filter, marker, svg, symbol");defelem_ids=[];for(v=e.length;v--;){z=e[v];w=z.id;if(h.indexOf(w)<0){Ab[w]=z;z.parentNode.removeChild(z);m++}}return m};this.svgCanvasToString=function(){for(;Kb()>0;);Ja.clear(true);$.each(l.childNodes,function(m,z){m&&z.nodeType===8&&z.data.indexOf("Created with")>=0&&l.insertBefore(z,l.firstChild)});if(K){Jb();xb([K])}var e=
@ -328,7 +328,7 @@ if(v&&v.tagName=="title"){for(;v.firstChild;)v.removeChild(v.firstChild);v.textC
e){h=m.all_layers[z][1];break}if(!h)return false;e=new za("Move Elements to Layer");m=J;for(z=m.length;z--;){var w=m[z];if(w){var H=w.nextSibling,A=w.parentNode;h.appendChild(w);e.addSubCommand(new Ia(w,H,A))}}ya(e);return true};this.mergeLayer=function(e){var h=new za("Merge Layer"),m=B(),z=$(m.current_layer).prev()[0];if(z){for(h.addSubCommand(new Ka(m.current_layer,m.current_layer.nextSibling,l));m.current_layer.firstChild;){var w=m.current_layer.firstChild;if(w.localName=="title"){h.addSubCommand(new Ka(w,
w.nextSibling,m.current_layer));m.current_layer.removeChild(w)}else{var H=w.nextSibling;z.appendChild(w);h.addSubCommand(new Ia(w,H,m.current_layer))}}l.removeChild(m.current_layer);if(!e){Qa();Fb();M("changed",[l]);ya(h)}m.current_layer=z;return h}};this.mergeAllLayers=function(){var e=new za("Merge all Layers"),h=B();for(h.current_layer=h.all_layers[h.getNumLayers()-1][1];$(l).children("g").length>1;)e.addSubCommand(b.mergeLayer(true));Qa();Fb();M("changed",[l]);ya(e)};var Jb=this.leaveContext=
function(){var e=va.length;if(e){for(var h=0;h<e;h++){var m=va[h],z=ib(m,"orig_opac");z!==1?m.setAttribute("opacity",z):m.removeAttribute("opacity");m.setAttribute("style","pointer-events: inherit")}va=[];Qa(true);M("contextset",null)}K=null},Rb=this.setContext=function(e){Jb();if(typeof e==="string")e=qa(e);K=e;$(e).parentsUntil("#svgcontent").andSelf().siblings().each(function(){var h=this.getAttribute("opacity")||1;ib(this,"orig_opac",h);this.setAttribute("opacity",h*0.33);this.setAttribute("style",
"pointer-events: none");va.push(this)});Qa();M("contextset",K)};this.clear=function(){Ja.clear();Qa();b.clearSvgContentElement();b.current_drawing_=new svgedit.draw.Drawing(l);b.createLayer("Layer 1");b.undoMgr.resetUndoStack();Ha.initGroup();ua=Ha.getRubberBandBox();M("cleared")};this.linkControlPoints=Ja.linkControlPoints;this.getContentElem=function(){return l};this.getRootElem=function(){return d};this.getSelectedElems=function(){return J};var Eb=this.getResolution=function(){var e=l.getAttribute("width")/
"pointer-events: none");va.push(this)});Qa();M("contextset",K)};this.clear=function(){Ja.clear();Qa();b.clearSvgContentElement();b.current_drawing_=new svgedit.draw.Drawing(l);b.createLayer("Layer 1");b.undoMgr.resetUndoStack();Ha.initGroup();ta=Ha.getRubberBandBox();M("cleared")};this.linkControlPoints=Ja.linkControlPoints;this.getContentElem=function(){return l};this.getRootElem=function(){return d};this.getSelectedElems=function(){return J};var Eb=this.getResolution=function(){var e=l.getAttribute("width")/
o,h=l.getAttribute("height")/o;return{w:e,h:h,zoom:o}};this.getZoom=function(){return o};this.getVersion=function(){return"svgcanvas.js ($Rev: 2082 $)"};this.setUiStrings=function(e){$.extend(qb,e.notification)};this.setConfig=function(e){$.extend(n,e)};this.getTitle=function(e){if(e=e||J[0]){e=$(e).data("gsvg")||$(e).data("symbol")||e;e=e.childNodes;for(var h=0;h<e.length;h++)if(e[h].nodeName=="title")return e[h].textContent;return""}};this.setGroupTitle=function(e){var h=J[0];h=$(h).data("gsvg")||
h;var m=$(h).children("title"),z=new za("Set Label");if(e.length)if(m.length){m=m[0];z.addSubCommand(new Na(m,{"#text":m.textContent}));m.textContent=e}else{m=f.createElementNS(c,"title");m.textContent=e;$(h).prepend(m);z.addSubCommand(new Ca(m))}else{z.addSubCommand(new Ka(m[0],m.nextSibling,h));m.remove()}ya(z)};this.getDocumentTitle=function(){return b.getTitle(l)};this.setDocumentTitle=function(e){for(var h=l.childNodes,m=false,z="",w=new za("Change Image Title"),H=0;H<h.length;H++)if(h[H].nodeName==
"title"){m=h[H];z=m.textContent;break}if(!m){m=f.createElementNS(c,"title");l.insertBefore(m,l.firstChild)}if(e.length)m.textContent=e;else m.parentNode.removeChild(m);w.addSubCommand(new Na(m,{"#text":z}));ya(w)};this.getEditorNS=function(e){e&&l.setAttribute("xmlns:se","http://svg-edit.googlecode.com");return"http://svg-edit.googlecode.com"};this.setResolution=function(e,h){var m=Eb(),z=m.w;m=m.h;var w;if(e=="fit"){var H=getStrokedBBox();if(H){w=new za("Fit Canvas to Content");var A=ub();vb(A);
@ -380,9 +380,9 @@ QwantToOpen:"Do you want to open a new file?\nThis will also erase your undo his
saveFromBrowser:'Select "Save As..." in your browser to save this image as a %s file.',noteTheseIssues:"Also note the following issues: ",unsavedChanges:"There are unsaved changes.",enterNewLinkURL:"Enter the new hyperlink URL",errorLoadingSVG:"Error: Unable to load SVG data",URLloadFail:"Unable to load from URL",retrieving:'Retrieving "%s" ...'}};var s={},b={};c.curConfig=curConfig;c.tool_scale=1;c.setConfig=function(d){a.extend(true,curConfig,d);if(d.extensions)curConfig.extensions=d.extensions};
c.setCustomHandlers=function(d){c.ready(function(){if(d.open){a('#tool_open > input[type="file"]').remove();a("#tool_open").show();g.open=d.open}if(d.save){c.show_save_warning=false;g.bind("saved",d.save)}d.pngsave&&g.bind("exported",d.pngsave);b=d})};c.randomizeIds=function(){g.randomizeIds(arguments)};c.init=function(){function d(k,u){var C=k.id,D=C.split("_"),P=D[0];D=D[1];u&&g.setStrokeAttr("stroke-"+P,D);qb();yb("#cur_"+P,C,20);a(k).addClass("current").siblings().removeClass("current")}function l(k,
u){var C=document.getElementById("ruler_x_cursor"),D=document.getElementById("ruler_y_cursor"),P=document.getElementById("workarea");document.getElementById("title_show");svgedit.browser.isTouch()&&a("#workarea").unbind("mousemove.rulers").bind("mousemove.rulers",function(Sb){Sb.stopPropagation();C.style.left=Sb.pageX-66+P.scrollLeft+"px";D.style.top=Sb.pageY-48+P.scrollTop+"px"});u||(u=g.getZoom());k||(k=a("#svgcanvas"));for(var U=g.getContentElem(),S=svgedit.units.getTypeMap()[curConfig.baseUnit],
Y=0;Y<2;Y++){var aa=Y===0,ga=aa?"x":"y",ra=aa?"width":"height",Oa=U.getAttribute(ga)-0;ga=a("#ruler_"+ga+" canvas:first");$hcanv=ga.clone();ga.replaceWith($hcanv);var Ba=$hcanv[0];var ha=ga=k[ra]()*2;Ba.parentNode.style[ra]=ha+"px";var Ta=0,Ra,ta=Ba.getContext("2d");ta.fillStyle="rgb(200,0,0)";ta.fillRect(0,0,Ba.width,Ba.height);$hcanv.siblings().remove();if(ga>=3E4){var Ma=parseInt(ga/3E4)+1;Ra=Array(Ma);Ra[0]=ta;for(var xa=1;xa<Ma;xa++){Ba[ra]=3E4;var ab=Ba.cloneNode(true);Ba.parentNode.appendChild(ab);
Ra[xa]=ab.getContext("2d")}ab[ra]=ga%3E4;ga=3E4}Ba[ra]=ga;ra=S*u;var Xa=50/ra;Ba=1;for(xa=0;xa<I.length;xa++){Ba=Ma=I[xa];if(Xa<=Ma)break}Xa=Ba*ra;ta.font="normal 9px 'Lucida Grande', sans-serif";ta.fillStyle="#777";for(var cb=Oa/ra%Ba*ra,Hb=cb-Xa;cb<ha;cb+=Xa){Hb+=Xa;xa=Math.round(cb)+0.5;if(aa){ta.moveTo(xa,15);ta.lineTo(xa,0)}else{ta.moveTo(15,xa);ta.lineTo(0,xa)}Ma=(Hb-Oa)/ra;if(Ba>=1)xa=Math.round(Ma);else{xa=(Ba+"").split(".")[1].length;xa=Ma.toFixed(xa)-0}if(xa!==0&&xa!==1E3&&xa%1E3===0)xa=
xa/1E3+"K";if(aa){ta.fillText(xa,cb+2,8);ta.fillStyle="#777"}else{Ma=(xa+"").split("");for(xa=0;xa<Ma.length;xa++){ta.fillText(Ma[xa],1,cb+9+xa*9);ta.fillStyle="#777"}}Ma=Xa/10;for(xa=1;xa<10;xa++){var zb=Math.round(cb+Ma*xa)+0.5;if(Ra&&zb>ga){Ta++;ta.stroke();if(Ta>=Ra.length){xa=10;cb=ha;continue}ta=Ra[Ta];cb-=3E4;zb=Math.round(cb+Ma*xa)+0.5}var Gb=xa%2?12:10;if(aa){ta.moveTo(zb,15);ta.lineTo(zb,Gb)}else{ta.moveTo(15,zb);ta.lineTo(Gb,zb)}}}ta.strokeStyle="#666";ta.stroke()}}(function(){var k=window.opener;
Y=0;Y<2;Y++){var aa=Y===0,ga=aa?"x":"y",ra=aa?"width":"height",Oa=U.getAttribute(ga)-0;ga=a("#ruler_"+ga+" canvas:first");$hcanv=ga.clone();ga.replaceWith($hcanv);var Ba=$hcanv[0];var ha=ga=k[ra]()*2;Ba.parentNode.style[ra]=ha+"px";var Ta=0,Ra,ua=Ba.getContext("2d");ua.fillStyle="rgb(200,0,0)";ua.fillRect(0,0,Ba.width,Ba.height);$hcanv.siblings().remove();if(ga>=3E4){var Ma=parseInt(ga/3E4)+1;Ra=Array(Ma);Ra[0]=ua;for(var xa=1;xa<Ma;xa++){Ba[ra]=3E4;var ab=Ba.cloneNode(true);Ba.parentNode.appendChild(ab);
Ra[xa]=ab.getContext("2d")}ab[ra]=ga%3E4;ga=3E4}Ba[ra]=ga;ra=S*u;var Xa=50/ra;Ba=1;for(xa=0;xa<I.length;xa++){Ba=Ma=I[xa];if(Xa<=Ma)break}Xa=Ba*ra;ua.font="normal 9px 'Lucida Grande', sans-serif";ua.fillStyle="#777";for(var cb=Oa/ra%Ba*ra,Hb=cb-Xa;cb<ha;cb+=Xa){Hb+=Xa;xa=Math.round(cb)+0.5;if(aa){ua.moveTo(xa,15);ua.lineTo(xa,0)}else{ua.moveTo(15,xa);ua.lineTo(0,xa)}Ma=(Hb-Oa)/ra;if(Ba>=1)xa=Math.round(Ma);else{xa=(Ba+"").split(".")[1].length;xa=Ma.toFixed(xa)-0}if(xa!==0&&xa!==1E3&&xa%1E3===0)xa=
xa/1E3+"K";if(aa){ua.fillText(xa,cb+2,8);ua.fillStyle="#777"}else{Ma=(xa+"").split("");for(xa=0;xa<Ma.length;xa++){ua.fillText(Ma[xa],1,cb+9+xa*9);ua.fillStyle="#777"}}Ma=Xa/10;for(xa=1;xa<10;xa++){var zb=Math.round(cb+Ma*xa)+0.5;if(Ra&&zb>ga){Ta++;ua.stroke();if(Ta>=Ra.length){xa=10;cb=ha;continue}ua=Ra[Ta];cb-=3E4;zb=Math.round(cb+Ma*xa)+0.5}var Gb=xa%2?12:10;if(aa){ua.moveTo(zb,15);ua.lineTo(zb,Gb)}else{ua.moveTo(15,zb);ua.lineTo(Gb,zb)}}}ua.strokeStyle="#666";ua.stroke()}}(function(){var k=window.opener;
if(k)try{var u=k.document.createEvent("Event");u.initEvent("svgEditorReady",true,true);k.document.documentElement.dispatchEvent(u)}catch(C){}})();(function(){a("#canvas_width").val(curConfig.dimensions[0]);a("#canvas_height").val(curConfig.dimensions[1]);a("body").toggleClass("touch",svgedit.browser.isTouch());var k=a.deparam.querystring(true);if(!a.isEmptyObject(k)){if(k.dimensions)k.dimensions=k.dimensions.split(",");if(k.extensions)k.extensions=k.extensions.split(",");if(k.bkgd_color)k.bkgd_color=
"#"+k.bkgd_color;svgEditor.setConfig(k);var u=k.source,C=a.param.querystring();if(!u)if(C.indexOf("source=data:")>=0)u=C.match(/source=(data:[^&]*)/)[1];if(u)if(u.indexOf("data:")===0){u=u.replace(/ /g,"+");c.loadFromDataURI(u)}else c.loadFromString(u);else if(C.indexOf("paramurl=")!==-1)svgEditor.loadFromURL(C.substr(9));else k.url&&svgEditor.loadFromURL(k.url)}})();var q=function(){a.each(curConfig.extensions,function(){var k=this;a.getScript(curConfig.extPath+k,function(u){if(!u){u=document.createElement("script");
u.src=curConfig.extPath+k;document.querySelector("head").appendChild(u)}})})};document.location.protocol==="file:"?setTimeout(q,100):q();a.svgIcons(curConfig.imgPath+"svg_edit_icons.svg",{w:27,h:27,id_match:false,no_img:!svgedit.browser.isWebkit(),fallback_path:curConfig.imgPath,fallback:{logo:"logo.png",select:"select.png",select_node:"select_node.png",pencil:"pencil.png",pen:"line.png",square:"square.png",rect:"square.png",fh_rect:"freehand-square.png",circle:"circle.png",ellipse:"ellipse.png",
@ -396,7 +396,7 @@ a(this).text(k.split("\u2318").join("Ctrl+"))});(function(){a("#dialog_container
function(){k.hide();U(false)});if(D=="prompt"){var aa=a('<input type="text">').prependTo(u);aa.val(S||"");aa.bind("keydown","return",function(){Y.trigger("click touchstart")})}D=="process"&&Y.hide();k.show();Y.on("click touchstart",function(){k.hide();var ga=D=="prompt"?aa.val():true;U&&U(ga)}).focus();D=="prompt"&&aa.focus()};a.alert=function(D,P){C("alert",D,P)};a.confirm=function(D,P){C("confirm",D,P)};a.process_cancel=function(D,P){C("process",D,P)};a.prompt=function(D,P,U){C("prompt",D,U,P)}})();
var ba=function(){var k=a(".tool_button_current");if(k.length&&k[0].id!=="tool_select"){k.removeClass("tool_button_current").addClass("tool_button");a("#tool_select").addClass("tool_button_current").removeClass("tool_button")}g.setMode("select")},X=null,sa=false,ka=false,da="",W=function(k,u){var C=g.getResolution();a("#svgcanvas").position();var D=g.setBBoxZoom(u,R.width()-15,R.height()-15);if(D){var P=D.zoom;D=D.bbox;if(P<0.0010)wa({value:0.1});else{var U=Date.now(),S=P-C.zoom;a("#zoom");var Y=
C.zoom,aa=function(ga){ga=(ga-U)/500;ga=Math.pow(ga-1,3)+1;g.setZoom(Y+S*ga);F();ga<1?requestAnimationFrame(aa):a("#zoom").val(P*100)};aa(Date.now());g.getMode()=="zoom"&&D.width&&ba();lb()}}};a("#cur_context_panel").delegate("a","click",function(){var k=a(this);k.attr("data-root")?g.leaveContext():g.setContext(k.text());return false});var Z=function(){c.paintBox.fill.prep();c.paintBox.stroke.prep()},oa={},qa=function(k){a.each(k,function(u,C){var D=a(u).children(),P=u+"_show",U=a(P),S=false;D.addClass("tool_button").unbind("click mousedown mouseup").each(function(ga){var ra=
C[ga];oa[ra.sel]=ra.fn;if(ra.isDefault)S=ga;ga=function(Oa){var Ba=ra;if(Oa.type==="keydown"){var ha=a(Ba.parent+"_show").hasClass("tool_button_current"),Ta=a(Ba.parent+"_show").attr("data-curopt");a.each(k[ra.parent],function(ta,Ma){if(Ma.sel==Ta)Ba=!Oa.shiftKey||!ha?Ma:k[ra.parent][ta+1]||k[ra.parent][0]})}if(a(this).hasClass("disabled"))return false;$a(P)&&Ba.fn();var Ra=Ba.icon?a.getSvgIcon(Ba.icon,true):a(Ba.sel).children().eq(0).clone();Ra[0].setAttribute("width",U.width());Ra[0].setAttribute("height",
C[ga];oa[ra.sel]=ra.fn;if(ra.isDefault)S=ga;ga=function(Oa){var Ba=ra;if(Oa.type==="keydown"){var ha=a(Ba.parent+"_show").hasClass("tool_button_current"),Ta=a(Ba.parent+"_show").attr("data-curopt");a.each(k[ra.parent],function(ua,Ma){if(Ma.sel==Ta)Ba=!Oa.shiftKey||!ha?Ma:k[ra.parent][ua+1]||k[ra.parent][0]})}if(a(this).hasClass("disabled"))return false;$a(P)&&Ba.fn();var Ra=Ba.icon?a.getSvgIcon(Ba.icon,true):a(Ba.sel).children().eq(0).clone();Ra[0].setAttribute("width",U.width());Ra[0].setAttribute("height",
U.height());U.children(":not(.flyout_arrow_horiz)").remove();U.append(Ra).attr("data-curopt",Ba.sel)};a(this).mouseup(ga);ra.key&&a(document).bind("keydown",ra.key[0]+" shift+"+ra.key[0],ga)});if(S)U.attr("data-curopt",C[S].sel);else U.attr("data-curopt")||U.attr("data-curopt",C[0].sel);var Y,aa=a(P).position();a(u).css({left:aa.left+34,top:aa.top+77});U.mousedown(function(ga){a("#tools_shapelib").is(":visible")&&$a(P,false);if(U.hasClass("disabled"))return false;var ra=a(u),Oa=aa.left+34,Ba=ra.width()*
-1,ha=ra.data("shown_popop")?200:0;Y=setTimeout(function(){U.data("isLibrary")?ra.css("left",Oa).show():ra.css("left",Ba).show().animate({left:Oa},150);ra.data("shown_popop",true)},ha);ga.preventDefault()}).mouseup(function(){clearTimeout(Y);var ga=a(this).attr("data-curopt");if(U.data("isLibrary")&&a(P.replace("_show","")).is(":visible"))$a(P,true);else $a(P)&&ga in oa&&oa[ga]()})});Aa()},ma=function(k,u){return a("<div>",{"class":"tools_flyout",id:k}).appendTo("#svg_editor").append(u)},na=function(){a(".tools_flyout").each(function(){var k=
a("#"+this.id+"_show"),u=k.offset();k=k.outerWidth();a(this).css({left:(u.left+k)*ia,top:u.top})})},Aa=function(){a(".tools_flyout").each(function(){var k=a("#"+this.id+"_show");if(!k.data("isLibrary")){var u=[];a(this).children().each(function(){u.push(this.title)});k[0].title=u.join(" / ")}})},Fa,Ia=function(k,u,C){var D=null;if(k.indexOf("url(#")===0){k=(k=g.getRefElem(k))?k.cloneNode(true):a("#"+C+"_color defs *")[0];D={alpha:u};D[k.tagName]=k}else D=k.indexOf("#")===0?{alpha:u,solidColor:k.substr(1)}:
@ -408,7 +408,7 @@ a("#tool_node_delete").toggleClass("disabled",!K.canDeleteNodes);yb("#tool_openc
D=g.getHref(k.parentNode)}a("#tool_make_link, #tool_make_link").toggle(!D);D&&a("#link_url").val(D);D={g:[],a:[],rect:["rx","width","height","x","y"],image:["width","height","x","y"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],line:["x1","y1","x2","y2"],text:["x","y"],use:[],path:[]};var ra=k.tagName;a(k).data("gsvg")&&a("#g_panel").show();ra=="path"&&a("#path_panel").show();if(D[ra]){D=D[ra];a("#"+ra+"_panel").show();ra=="rect"?a("#cornerRadiusLabel").show():a("#cornerRadiusLabel").hide();
a.each(D,function(Oa,Ba){var ha=k.getAttribute(Ba);if(curConfig.baseUnit!=="px"&&k[Ba])ha=svgedit.units.convertUnit(k[Ba].baseVal.value);var Ta=document.getElementById(ra+"_"+Ba);Ta.value=Math.round(ha)||0;Ta.getAttribute("data-cursor")==="true"&&a.fn.dragInput.updateCursor(Ta)});if(ra=="text"){D=k.getAttribute("font-family");document.getElementById("font_family_dropdown").selectedIndex=3;a("#text_panel").css("display","inline");a("#tool_italic").toggleClass("active",g.getItalic());a("#tool_bold").toggleClass("active",
g.getBold());a("#font_family").val(D);a("#font_size").val(k.getAttribute("font-size"));a("#text").val(k.textContent);a("#preview_font").text(D.split(",")[0].replace(/'/g,"")).css("font-family",D);g.addedNew&&setTimeout(function(){a("#text").focus().select()},100)}else if(ra=="image")Na(g.getHref(k));else if(ra==="g"||ra==="use"){a("#container_panel").show();a(".action_group_selected").removeClass("disabled");g.getTitle()}}U[(ra==="g"?"en":"dis")+"ableContextMenuItems"]("#ungroup");U[(ra==="g"||!sa?
"dis":"en")+"ableContextMenuItems"]("#group")}else if(sa){a("#multiselected_panel").show();a(".action_multi_selected").removeClass("disabled");U.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")}else U.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back");T.getUndoStackSize()>0?a("#tool_undo").removeClass("disabled"):a("#tool_undo").addClass("disabled");T.getRedoStackSize()>0?a("#tool_redo").removeClass("disabled"):a("#tool_redo").addClass("disabled");
"dis":"en")+"ableContextMenuItems"]("#group")}if(sa){a("#multiselected_panel").show();a(".action_multi_selected").removeClass("disabled");U.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")}k||U.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back");T.getUndoStackSize()>0?a("#tool_undo").removeClass("disabled"):a("#tool_undo").addClass("disabled");T.getRedoStackSize()>0?a("#tool_redo").removeClass("disabled"):a("#tool_redo").addClass("disabled");
g.addedNew=false;if(k&&!P||sa){a("#selLayerNames").removeAttr("disabled").val(u);V.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")}};a("#text").on("focus",function(){});a("#text").on("blur",function(){});g.bind("selected",function(k,u){var C=g.getMode();C==="select"&&ba();C=C=="pathedit";X=u.length==1||u[1]==null?u[0]:null;sa=u.length>=2&&u[1]!=null?u:false;if(X!=null)if(!C){if(X!=null)switch(X.tagName){case "use":case "image":case "foreignObject":break;case "g":case "a":for(var D=
null,P=X.getElementsByTagName("*"),U=0,S=P.length;U<S;U++){var Y=P[U].getAttribute("stroke-width");if(U===0)D=Y;else if(D!==Y)D=null}a("#stroke_width").val(D===null?"":D);c.paintBox.fill.update(true);c.paintBox.stroke.update(true);break;default:c.paintBox.fill.update(true);c.paintBox.stroke.update(true);a("#stroke_width").val(X.getAttribute("stroke-width")||1);a("#stroke_style").val(X.getAttribute("stroke-dasharray")||"none");D=X.getAttribute("stroke-linejoin")||"miter";a("#linejoin_"+D).length!=
0&&d(a("#linejoin_"+D)[0]);D=X.getAttribute("stroke-linecap")||"butt";a("#linecap_"+D).length!=0&&d(a("#linecap_"+D)[0])}if(X!=null){D=(X.getAttribute("opacity")||1)*100;a("#group_opacity").val(D);a("#opac_slider").slider("option","value",D);a("#elem_id").val(X.id)}}a("#path_node_panel").toggle(C);a("#tools_bottom_2,#tools_bottom_3").toggle(!C);if(C){a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");a("#tool_select").addClass("tool_button_current").removeClass("tool_button");
@ -417,84 +417,83 @@ C==0)}g.runExtensions("elementTransition",{elems:u})}});g.bind("changed",functio
a.browser.version>=533||~C.indexOf("MSIE"))Qb(0,true);else{var D=k.open("data:image/svg+xml;base64,"+N.encode64(u)),P=a.pref("save_notice_done");if(P!=="all"){var U=uiStrings.notification.saveFromBrowser.replace("%s","SVG");if(C.indexOf("Gecko/")!==-1)if(u.indexOf("<defs")!==-1){U+="\n\n"+uiStrings.notification.defsFailOnSave;a.pref("save_notice_done","all");P="all"}else a.pref("save_notice_done","part");else a.pref("save_notice_done","all");P!=="part"&&D.alert(U)}}});g.bind("exported",function(k,
u){var C=u.issues;a("#export_canvas").length||a("<canvas>",{id:"export_canvas"}).hide().appendTo("body");var D=a("#export_canvas")[0];D.width=g.contentW;D.height=g.contentH;canvg(D,u.svg,{renderCallback:function(){var P=D.toDataURL("image/png");O.location.href=P;if(a.pref("export_notice_done")!=="all"){P=uiStrings.notification.saveFromBrowser.replace("%s","PNG");if(C.length)P+="\n\n"+uiStrings.notification.noteTheseIssues+"\n \u2022 "+C.join("\n \u2022 ");a.pref("export_notice_done","all");O.alert(P)}}})});
g.bind("zoomed",W);g.bind("contextset",function(k,u){var C="";if(u){var D="";C='<a href="#" data-root="y">'+g.getCurrentDrawing().getCurrentLayerName()+"</a>";a(u).parentsUntil("#svgcontent > g").andSelf().each(function(){if(this.id){D+=" > "+this.id;C+=this!==u?' > <a href="#">'+this.id+"</a>":" > "+this.id}});da=D}else da=null;a("#cur_context_panel").toggle(!!u).html(C)});g.bind("extension_added",function(k,u){function C(){if(Fa){clearTimeout(Fa);Fa=null}P||(Fa=setTimeout(function(){P=true;e(s.iconsize)},
50))}var D=false,P=false,U=true,S=function(){if(u.callback&&!D&&U){D=true;u.callback()}},Y=[];u.context_tools&&a.each(u.context_tools,function(Ba,ha){var Ta=ha.container_id?' id="'+ha.container_id+'"':"",Ra=a("#"+ha.panel);Ra.length||(Ra=a("<div>",{id:ha.panel}).appendTo("#tools_top").hide());switch(ha.type){case "tool_button":var ta='<div class="tool_button">'+ha.id+"</div>",Ma=a(ta).appendTo(Ra);ha.events&&a.each(ha.events,function(Xa,cb){a(Ma).bind(Xa,cb)});break;case "select":ta="<label"+Ta+'><select id="'+
ha.id+'">';a.each(ha.options,function(Xa,cb){ta+='<option value="'+Xa+'"'+(Xa==ha.defval?" selected":"")+">"+cb+"</option>"});ta+="</select></label>";var xa=a(ta).appendTo(Ra).find("select");a.each(ha.events,function(Xa,cb){a(xa).bind(Xa,cb)});break;case "button-select":ta='<div id="'+ha.id+'" class="dropdown toolset" title="'+ha.title+'"><div id="cur_'+ha.id+'" class="icon_label"></div><button></button></div>';Ta=a('<ul id="'+ha.id+'_opts"></ul>').appendTo("#option_lists");ha.colnum&&Ta.addClass("optcols"+
ha.colnum);a(ta).appendTo(Ra).children();Y.push({elem:"#"+ha.id,list:"#"+ha.id+"_opts",title:ha.title,callback:ha.events.change,cur:"#cur_"+ha.id});break;case "input":ta="<label"+Ta+'><span id="'+ha.id+'_label">'+ha.label+':</span><input id="'+ha.id+'" title="'+ha.title+'" size="'+(ha.size||"4")+'" value="'+(ha.defval||"")+'" type="text"/></label>';var ab=a(ta).appendTo(Ra).find("input");ha.spindata&&ab.SpinButton(ha.spindata);ha.events&&a.each(ha.events,function(Xa,cb){ab.bind(Xa,cb)})}});if(u.buttons){var aa=
{},ga={},ra=u.svgicons,Oa={};a.each(u.buttons,function(Ba,ha){for(var Ta,Ra=ha.id,ta=Ba;a("#"+Ra).length;)Ra=ha.id+"_"+ ++ta;if(ra){aa[Ra]=ha.icon;ta=ha.svgicon?ha.svgicon:ha.id;console.log(ta);if(ha.type=="app_menu")ga["#"+Ra+" > div"]=ta;else ga["#"+Ra]=ta}else Ta=ha.type=="menu"?"":a('<img src="'+ha.icon+'">');var Ma,xa;switch(ha.type){case "mode_flyout":case "mode":Ma="tool_button";if(ha.cls)Ma+=" "+ha.cls;xa="#tools_left";break;case "context":Ma="tool_button";xa="#"+ha.panel;a(xa).length||a("<div>",
{id:ha.panel}).appendTo("#tools_top");break;case "menu":Ma="menu_item tool_button";xa="#"+(ha.after||ha.panel);break;case "app_menu":Ma="";xa=ha.parent||"#main_menu ul";a(xa).length||a("<div>",{id:ha.panel}).appendTo("#tools_top")}var ab=a(ha.list||ha.type=="app_menu"?"<li/>":"<div/>").attr("id",Ra).attr("title",ha.title).addClass(Ma);if(!ha.includeWith&&!ha.list){if("position"in ha)a(xa).children().eq(ha.position).before(ab);else ha.type!="menu"||!ha.after?ab.appendTo(xa):a(xa).after(ab);if(ha.type==
"mode_flyout"){ta=a(ab);Ma=ta.parent();if(!ta.parent().hasClass("tools_flyout")){var Xa=ta[0].id.replace("tool_","tools_"),cb=ta.clone().attr("id",Xa+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));ta.before(cb);Ma=ma(Xa,ta);Ma.data("isLibrary",true);cb.data("isLibrary",true)}ga["#"+Xa+"_show"]=ha.id;Ra=Oa["#"+Ma[0].id]=[{sel:"#"+Ra,fn:ha.events.click,icon:ha.id,isDefault:true},Hb]}else if(ha.type=="app_menu"||ha.type=="menu")ab.append(ha.title)}else if(ha.list){ab.addClass("push_button");
a("#"+ha.list+"_opts").append(ab);if(ha.isDefault){a("#cur_"+ha.list).append(ab.children().clone());ta=ha.svgicon?ha.svgicon:ha.id;ga["#cur_"+ha.list]=ta}}else if(ha.includeWith){xa=ha.includeWith;ta=a(xa.button);Ma=ta.parent();if(!ta.parent().hasClass("tools_flyout")){Xa=ta[0].id.replace("tool_","tools_");cb=ta.clone().attr("id",Xa+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));ta.before(cb);Ma=ma(Xa,ta)}var Hb=v.getButtonData(xa.button);if(xa.isDefault)ga["#"+Xa+"_show"]=ha.id;Ra=Oa["#"+
Ma[0].id]=[{sel:"#"+Ra,fn:ha.events.click,icon:ha.id,key:ha.key,isDefault:ha.includeWith?ha.includeWith.isDefault:0},Hb];Xa="position"in xa?xa.position:"last";Hb=Ma.children().length;if(!isNaN(Xa)&&Xa>=0&&Xa<Hb)Ma.children().eq(Xa).before(ab);else{Ma.append(ab);Ra.reverse()}}ra||ab.append(Ta);ha.list||a.each(ha.events,function(zb,Gb){if(zb=="click")if(ha.type=="mode"){ha.includeWith?ab.bind(zb,Gb):ab.bind(zb,function(){$a(ab)&&Gb()});if(ha.key){a(document).bind("keydown",ha.key,Gb);ha.title&&ab.attr("title",
ha.title+" ["+ha.key+"]")}}else ab.bind(zb,Gb);else ab.bind(zb,Gb)});qa(Oa)});a.each(Y,function(){Da(this.elem,this.list,this.callback,{seticon:true})});if(ra)U=false;a.svgIcons(ra,{w:27,h:27,id_match:false,no_img:!B,fallback:aa,placement:ga,callback:function(){s.iconsize&&s.iconsize!="m"&&C();U=true;S()}})}S()});g.textActions.setInputElem(a("#text")[0]);var ya='<div class="palette_item" data-rgb="none"></div>';a.each(["#000000","#3f3f3f","#7f7f7f","#bfbfbf","#ffffff","#ff0000","#ff7f00","#ffff00",
"#7fff00","#00ff00","#00ff7f","#00ffff","#007fff","#0000ff","#7f00ff","#ff00ff","#ff007f","#7f0000","#7f3f00","#7f7f00","#3f7f00","#007f00","#007f3f","#007f7f","#003f7f","#00007f","#3f007f","#7f007f","#7f003f","#ffaaaa","#ffd4aa","#ffffaa","#d4ffaa","#aaffaa","#aaffd4","#aaffff","#aad4ff"],function(k,u){ya+='<div class="palette_item" style="background-color: '+u+';" data-rgb="'+u+'"></div>'});a("#palette").append(ya);var Ha=a("#tool_angle_indicator");a("#tool_reorient");rotateCursor=function(k){k=
"rotate("+k+"deg)";Ha.css({"-webkit-transform":k,"-moz-transform":k,"-o-transform":k,"-ms-transform":k,transform:k})};var wa=function(k){var u=k.value/100;if(u<0.0010)k.value=0.1;else{k=g.getZoom();W(window,{width:0,height:0,x:(R[0].scrollLeft+R.width()/2)/k,y:(R[0].scrollTop+R.height()/2)/k,zoom:u},true)}},qb=function(){window.opera&&a("<p/>").hide().appendTo("body").remove()};a("#stroke_style").change(function(){g.setStrokeAttr("stroke-dasharray",a(this).val());a("#stroke_style_label").html(this.options[this.selectedIndex].text);
qb()});a("#seg_type").change(function(){g.setSegType(a(this).val());a("#seg_type_label").html(this.options[this.selectedIndex].text)});a("select").change(function(){a(this).blur()});a("#font_family").change(function(){g.setFontFamily(this.value)});a("#text").keyup(function(){g.setTextContent(this.value)});changeAttribute=function(k,u){var C=k.getAttribute("data-attr"),D=k.value;if(!svgedit.units.isValidUnit(C,D,X)){a.alert(uiStrings.notification.invalidAttrValGiven);k.value=X.getAttribute(C);return false}u?
g.changeSelectedAttributeNoUndo(C,D):g.changeSelectedAttribute(C,D)};a("#palette").mouseover(function(){var k=a('<input type="hidden">');a(this).append(k);k.focus().remove()});a(".palette_item").on("mousedown touchstart touchmove",function(){var k=a("#tool_stroke").hasClass("active"),u=k?"stroke":"fill",C=a(this).attr("data-rgb"),D=null;if(C==="transparent"||C==="initial"||C==="#none"){C="none";D=new a.jGraduate.Paint}else D=new a.jGraduate.Paint({alpha:100,solidColor:C.substr(1)});c.paintBox[u].setPaint(D);
if(k){g.setColor("stroke",C);C!="none"&&g.getStrokeOpacity()!=1&&g.setPaintOpacity("stroke",1)}else{g.setColor("fill",C);C!="none"&&g.getFillOpacity()!=1&&g.setPaintOpacity("fill",1)}}).bind("contextmenu",function(k){k.preventDefault()});a("#toggle_stroke_tools").toggle(function(){a(".stroke_tool").css("display","table-cell");a(this).addClass("expanded");z()},function(){a(".stroke_tool").css("display","none");a(this).removeClass("expanded");z()});var $a=function(k,u){if(a(k).hasClass("disabled"))return false;
if(a(k).parent().hasClass("tools_flyout"))return true;var C=C||"normal";u||a(".tools_flyout").fadeOut(C);a("#styleoverrides").text("");a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");a(k).addClass("tool_button_current").removeClass("tool_button");return true};(function(){var k=null,u=null,C=R[0],D=false,P=false;a("#svgcanvas").bind("mousemove mouseup touchend",function(U){if(D!==false){C.scrollLeft-=U.clientX-k;C.scrollTop-=U.clientY-u;k=U.clientX;u=U.clientY;
if(U.type==="mouseup"||U.type==="touchend")D=false;return false}}).on("mousedown touchmove",function(U){if(U.button===1||P===true||U.originalEvent.touches&&U.originalEvent.touches.length>=2){D=true;k=U.clientX;u=U.clientY;return false}});a(window).mouseup(function(){D=false;a("body").removeClass("dragging")});a(document).bind("keydown","space",function(U){U.preventDefault();g.spaceKey=P=true}).bind("keyup","space",function(U){U.preventDefault();g.spaceKey=P=false}).bind("keydown","alt",function(){g.getMode()===
"zoom"&&R.addClass("out")}).bind("keyup","alt",function(){g.getMode()==="zoom"&&R.removeClass("out")})})();var ib=a(".menu"),Wa=function(k){k.target.style.background="#fff";setTimeout(function(){k.target.style.background="#ddd"},50);setTimeout(function(){k.target.style.background="#fff"},150);setTimeout(function(){k.target.style.background="#ddd"},200);setTimeout(function(){k.target.style.background=""},200);setTimeout(function(){a("#menu_bar").removeClass("active")},220);return false};a(".menu_item").on("mousedown touchstart",
function(k){Wa(k)});a("svg, body").on("mousedown touchstart",function(k){top!=self&&!k.isTrigger&&typeof top.exports.focus_editor=="function"&&top.exports.focus_editor();if(k.target.nodeName.toLowerCase()!=="input")if(!a(k.target).hasClass("menu_title")&&!a(k.target).parent().hasClass("menu_title"))!a(k.target).hasClass("disabled")&&a(k.target).hasClass("menu_item")?Wa(k):a("#menu_bar").removeClass("active")});var Sa=[6,12,16,33,50,66,100,150,200,300,400,600,800,1200];a("#workarea").on("mousewheel",
function(k,u,C,D){if(k.altKey){k.preventDefault();k=g.getZoom()*100;u=Sa.length;for(E=0;E<u;E++){C=Math.min(u,E+1);if(D>0)zoom=Sa[E]<=k?Sa[C]:zoom;if(D<0)zoom=Sa[E]<k?Sa[E]:zoom}zoom&&wa({value:zoom})}});a(".menu_title").on("mousedown",function(){a("#tools_shapelib").hide();a("#menu_bar").toggleClass("active");ib.removeClass("open");a(this).parent().addClass("open")}).on("mouseover",function(){ib.removeClass("open");a(this).parent().addClass("open")});c.addDropDown=function(k,u,C){if(a(k).length!=
0){var D=a(k).find("button"),P=a(k).find("ul").attr("id",a(k)[0].id+"-list");C||a("#option_lists").append(P);var U=false;C&&a(k).addClass("dropup");P.find("li").bind("mouseup",u);a(window).mouseup(function(){if(!U){D.removeClass("down");P.hide()}U=false});D.bind("mousedown",function(){if(D.hasClass("down")){D.removeClass("down");P.hide()}else{D.addClass("down");if(!C){var S=a(k).offset();P.css({top:S.top,left:S.left-110})}P.show();U=true}}).hover(function(){U=true}).mouseout(function(){U=false})}};
var Da=function(k,u,C,D){var P=a(k);u=a(u);var U=false,S=D.dropUp;S&&a(k).addClass("dropup");u.find("li").bind("mouseup",function(){if(D.seticon){yb("#cur_"+P[0].id,a(this).children());a(this).addClass("current").siblings().removeClass("current")}C.apply(this,arguments)});a(window).mouseup(function(){if(!U){P.removeClass("down");u.hide();u.css({top:0,left:0})}U=false});u.height();a(k).bind("mousedown",function(){var Y=a(k).offset();if(S){Y.top-=u.height();Y.left+=8}else Y.top+=a(k).height();a(u).offset(Y);
if(P.hasClass("down")){P.removeClass("down");u.hide();u.css({top:0,left:0})}else{P.addClass("down");u.show();U=true;return false}}).hover(function(){U=true}).mouseout(function(){U=false});D.multiclick&&u.mousedown(function(){U=true})};a("#font_family_dropdown").change(function(){var k=this.options[this.selectedIndex].value,u=this.options[this.selectedIndex].text;a("#preview_font").html(u).css("font-family",k);a("#font_family").val(k).change()});a("div","#position_opts").each(function(){this.addEventListener("mouseup",
function(){var k=this.id.replace("tool_pos","").charAt(0);g.alignSelectedElements(k,"page")})});(function(){var k,u=function(){a(k).blur()};a("#svg_editor").find("button, select, input:not(#text)").focus(function(){k=this;pa="toolbars";R.mousedown(u)}).blur(function(){pa="canvas";R.unbind("mousedown",u);g.getMode()=="textedit"&&a("#text").focus()})})();var va=function(){$a("#tool_select")&&g.setMode("select")},fb=function(){$a("#tool_fhpath")&&g.setMode("fhpath")},La=function(){$a("#tool_line")&&
g.setMode("line")},Va=function(){$a("#tool_rect")&&g.setMode("rect")},Ea=function(){$a("#tool_ellipse")&&g.setMode("ellipse")},kb=function(){$a("#tool_image")&&g.setMode("image")},sb=function(){$a("#tool_zoom")&&g.setMode("zoom")},Za=function(){if($a("#tool_zoom")){Db();ba()}},bb=function(){$a("#tool_text")&&g.setMode("text")},Cb=function(){$a("#tool_path")&&g.setMode("path")},ua=function(){if(X!=null||sa)g.deleteSelectedElements()},mb=function(){if(X!=null||sa){window.event.type==="keydown"&&pb(a("#edit_menu"));
g.cutSelectedElements()}},jb=function(){if(X!=null||sa){window.event.type==="keydown"&&pb(a("#edit_menu"));g.copySelectedElements()}},Ab=function(){window.event.type==="keydown"&&pb(a("#edit_menu"));var k=g.getZoom(),u=(R[0].scrollLeft+R.width()/2)/k-g.contentW;k=(R[0].scrollTop+R.height()/2)/k-g.contentH;g.pasteElements("point",u,k)},ob=function(){if(X!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveToTopSelectedElement()}},eb=function(){if(X!=null){window.event.type==="keydown"&&
pb(a("#object_menu"));g.moveToBottomSelectedElement()}},tb=function(){if(X!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveUpDownSelected("Up")}},ub=function(){if(X!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveUpDownSelected("Down")}},wb=function(k){if(X!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveUpDownSelected(k)}},Bb=function(){if(X!=null){g.convertToPath();elems=g.getSelectedElems();g.selectorManager.requestSelector(elems[0]).selectorRect.setAttribute("display",
"none");g.setMode("pathedit");K.toEditMode(elems[0]);g.clearSelection()}},la=function(){X!=null&&K.reorient()},ca=function(){if(X!=null||sa)a.prompt(uiStrings.notification.enterNewLinkURL,"http://",function(k){k&&g.makeHyperlink(k)})},ja=function(k,u){if(X!=null||sa){if(curConfig.gridSnapping){var C=g.getZoom()*curConfig.snappingStep;k*=C;u*=C}a("input").blur();g.moveSelectedElements(k,u)}},M=function(){var k=!a("#tool_node_link").hasClass("checked");k?a("#tool_node_link").addClass("checked").find("input").attr("checked",
true):a("#tool_node_link").removeClass("checked").find("input").attr("checked",false);K.linkControlPoints(k)},Q=function(){K.getNodePoint()&&K.clonePathNode()},ea=function(){K.getNodePoint()&&K.deletePathNode()},Ga=function(){var k=a("#tool_add_subpath"),u=!k.hasClass("push_button_pressed");u?k.addClass("push_button_pressed").removeClass("tool_button"):k.removeClass("push_button_pressed").addClass("tool_button");K.addSubPath(u)},Pa=function(){K.opencloseSubPath()},Ya=function(){g.cycleElement(1)},
db=function(){g.cycleElement(0)},nb=function(k,u){if(!(X==null||sa)){k||(u*=-1);var C=a("#angle").val()*1+u;g.setRotationAngle(C);za()}},Ua=function(){var k=curConfig.dimensions;a.confirm(uiStrings.notification.QwantToClear,function(u){if(u){ba();g.clear();g.setResolution(k[0],k[1]);F(true);Db();za();Z();g.runExtensions("onNewDocument")}})},rb=function(){g.setBold(!g.getBold());za();return false},Qa=function(){g.setItalic(!g.getItalic());za();return false},vb=function(){if(!b.pngsave){var k=uiStrings.notification.loadingImage;
O=window.open("data:text/html;charset=utf-8,<title>"+k+"</title><h1>"+k+"</h1>")}window.canvg?g.rasterExport():a.getScript("canvg/rgbcolor.js",function(){a.getScript("canvg/canvg.js",function(){g.rasterExport()})})},xb=function(){g.open()},Ib=function(){},pb=function(k){var u=k.prev();u.css("background","#09f");setTimeout(function(){u.css("background","")},200)},hb=function(){if(T.getUndoStackSize()>0){window.event.type==="keydown"&&pb(a("#edit_menu"));T.undo()}},Ja=function(){if(T.getRedoStackSize()>
0){window.event.type==="keydown"&&pb(a("#edit_menu"));T.redo()}},Kb=function(){if(sa)g.groupSelectedElements();else X&&g.ungroupSelectedElement()},Nb=function(){window.event.type==="keydown"&&pb(a("#edit_menu"));g.cloneSelectedElements(20,20)},Lb=function(){var k=this.id.replace("tool_align","").charAt(0);g.alignSelectedElements(k,a("#align_relative_to").val())},Ob=function(){var k=document.querySelector("#tool_stroke rect"),u=document.querySelector("#tool_fill rect"),C=u.getAttribute("fill"),D=k.getAttribute("fill");
k=parseFloat(k.getAttribute("stroke-opacity"));if(isNaN(k))k=100;u=parseFloat(u.getAttribute("fill-opacity"));if(isNaN(u))u=100;D=Ia(D,k,"stroke");C=Ia(C,u,"fill");c.paintBox.fill.setPaint(D,true);c.paintBox.stroke.setPaint(C,true)},Db=function(k){var u=g.getResolution();k=k?u.zoom*k:1;a("#zoom").val(k*100);g.setZoom(k);lb();F(true)},Fb=function(){!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"):a("#tool_wireframe").removeClass("push_button_pressed");
R.toggleClass("wireframe");if(!H){var k=a("#wireframe_rules");k.length?k.empty():a('<style id="wireframe_rules"></style>').appendTo("head");lb()}},Jb=function(){var k=!a("#tool_snap").hasClass("push_button_pressed");k?a("#tool_snap").addClass("push_button_pressed"):a("#tool_snap").removeClass("push_button_pressed");curConfig.gridSnapping=k},Rb=function(){window.self!=window.top&&top.exports.setEditorFocus(false)},Eb=function(){if(a("#tool_rulers").hasClass("push_button_pressed")){a("#tool_rulers").removeClass("push_button_pressed");
a("#show_rulers").attr("checked",false);curConfig.showRulers=false}else{a("#tool_rulers").addClass("push_button_pressed");a("#show_rulers").attr("checked",true);curConfig.showRulers=true}a("#rulers").toggle(!!curConfig.showRulers)},lb=function(){if(!H){var k="#workarea.wireframe #svgcontent * { stroke-width: "+1/g.getZoom()+"px; }";a("#wireframe_rules").text(R.hasClass("wireframe")?k:"")}},Qb=function(k,u){if(!ka){ka=true;a("#save_output_btns").toggle(!!u);a("#tool_source_back").toggle(!u);var C=
fa=g.getSvgString();a("#svg_source_textarea").val(C);a("#svg_source_editor").fadeIn();C=a("#svg_source_container").height()-50;a("#svg_source_textarea").css("height",C);a("#svg_source_textarea").focus()}},Pb=function(){if(ka){if(g.setSvgString(a("#svg_source_textarea").val())){g.clearSelection();m();Db();Z()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(k){if(!k)return false;g.clearSelection();m();Db();Z()});ba()}},yb=c.setIcon=function(k,u){var C=typeof u==="string"?a.getSvgIcon(u,
true):u.clone();C?a(k).find("img").replaceWith(C):console.log("NOTE: Icon image missing: "+u)},gb;gb=function(){var k=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,u=document.getElementsByTagName("script")[0],C;for(C in u.style)if(k.test(C))return C.match(k)[0];if("WebkitOpacity"in u.style)return"Webkit";if("KhtmlOpacity"in u.style)return"Khtml";return""}();var Mb=function(k,u){gb.toLowerCase();var C=["top","left","bottom","right"];k.each(function(){for(var D=a(this),P=D.outerWidth()*(u-1),U=D.outerHeight()*
(u-1),S=0;S<4;S++){var Y=C[S],aa=D.data("orig_margin-"+Y);if(aa==null){aa=parseInt(D.css("margin-"+Y));D.data("orig_margin-"+Y,aa)}aa=aa*u;if(Y==="right")aa+=P;else if(Y==="bottom")aa+=U;D.css("margin-"+Y,aa)}})},e=c.setIconSize=function(k,u){if(!(k==s.size&&!u)){var C=a("#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout"),D=1;D=typeof k=="number"?
k:{s:0.75,m:1,l:1.25,xl:1.5}[k];c.tool_scale=ia=D;na();var P=C.parents(":hidden");P.css("visibility","hidden").show();Mb(C,D);P.css("visibility","visible").hide();C=a("#tool_size_rules");if(C.length)C.empty();else C=a('<style id="tool_size_rules"></style>').appendTo("head");if(k!="m"){var U="";a.each(cssResizeRules,function(S,Y){S="#svg_editor "+S.replace(/,/g,", #svg_editor");U+=S+"{";a.each(Y,function(aa,ga){if(typeof ga==="number")var ra=ga*D+"px";else if(ga[k]||ga.all)ra=ga[k]||ga.all;U+=aa+":"+
ra+";"});U+="}"});P="-"+gb.toLowerCase()+"-";U+="#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout{"+P+"transform: scale("+D+");} #svg_editor div.toolset .toolset {"+P+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+P+"transform: scale("+1/D+");}";C.text(U)}na()}},h=function(){a("#dialog_box").hide();if(ka){if(ka)fa!==a("#svg_source_textarea").val()?
a.confirm(uiStrings.notification.QignoreSourceChanges,function(k){k&&m()}):m();z()}else da&&g.leaveContext()},m=function(){a("#svg_source_editor").hide();ka=false;a("#svg_source_textarea").blur()};a(window).width();a(window).height();var z=a.noop;a(window).resize(function(){F()});(function(){R.scroll(function(){if(a("#ruler_x").length!=0)a("#ruler_x")[0].scrollLeft=R[0].scrollLeft;if(a("#ruler_y").length!=0)a("#ruler_y")[0].scrollTop=R[0].scrollTop})})();a("#url_notice").click(function(){a.alert(this.title)});
a("#change_image_url").click(function(){var k=g.getHref(X);k=k.indexOf("data:")===0?"":k;a.prompt(uiStrings.notification.enterNewImgURL,k,function(u){u&&Na(u)})});var w=function(k){var u=k[0].id=="stroke_color"?"stroke":"fill",C=k[0].id=="canvas_color";if(C)u="canvas";var D=c.paintBox[u].paint;k=u=="stroke"?"Pick a Stroke Paint and Opacity":"Pick a Fill Paint and Opacity";C=C?{right:200,top:50}:{left:45,bottom:50};a("#color_picker").draggable({cancel:".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker",
containment:"window"}).css(C).jGraduate({paint:D,window:{pickerTitle:k},images:{clientPath:curConfig.jGraduatePath},newstop:"inverse"},function(P){D=new a.jGraduate.Paint(P);c.paintBox[u].setPaint(D);g.setPaint(u,D);a("#color_picker").hide()},function(){a("#color_picker").hide()})};q=function(k,u){var C=document.getElementById("canvas_background"),D={color:"fff",opacity:1};if(u=="stroke")D=curConfig.initStroke;if(u=="fill")D=curConfig.initFill;if(u=="canvas"&&C)if(C=C.getAttribute("fill").match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))D=
{color:("0"+parseInt(C[1],10).toString(16)).slice(-2)+("0"+parseInt(C[2],10).toString(16)).slice(-2)+("0"+parseInt(C[3],10).toString(16)).slice(-2),opacity:1};C=(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg"><rect width="100%" height="100%"\t\t\t\t\tfill="#'+D.color+'" opacity="'+D.opacity+'"/>\t\t\t\t\t<defs><linearGradient id="gradbox_"/></defs></svg>',"text/xml").documentElement;C=a(k)[0].appendChild(document.importNode(C,true));u==="canvas"?C.setAttribute("width",60.5):
C.setAttribute("width","100%");this.rect=C.firstChild;this.defs=C.getElementsByTagName("defs")[0];this.grad=this.defs.firstChild;this.paint=new a.jGraduate.Paint({solidColor:D.color});this.type=u;this.setPaint=function(P,U){this.paint=P;var S="none",Y=P.type,aa=P.alpha/100;switch(Y){case "solidColor":S=P[Y]=="none"||P[Y]=="one"?"none":"#"+P[Y];break;case "linearGradient":case "radialGradient":this.defs.removeChild(this.grad);this.grad=this.defs.appendChild(P[Y]);S="url(#"+(this.grad.id="gradbox_"+
this.type)+")"}this.rect.setAttribute("fill",S);this.rect.setAttribute("opacity",aa);if(U){g.setColor(this.type,S,true);g.setPaintOpacity(this.type,aa,true)}if(this.type=="canvas")(Y=document.getElementById("canvas_background"))?Y.setAttribute("fill",S):Ka(S)};this.update=function(P){if(X){var U=this.type;switch(X.tagName){case "use":case "image":case "foreignObject":return;case "g":case "a":for(var S=null,Y=X.getElementsByTagName("*"),aa=0,ga=Y.length;aa<ga;aa++){var ra=Y[aa].getAttribute(U);if(aa===
0)S=ra;else if(S!==ra){S=null;break}}if(S===null){Y=null;return}Y=S;S=1;break;default:S=parseFloat(X.getAttribute(U+"-opacity"));if(isNaN(S))S=1;Y=U==="fill"?"black":"none";Y=X.getAttribute(U)||Y}if(P){g.setColor(U,Y,true);g.setPaintOpacity(U,S,true)}S*=100;this.setPaint(Ia(Y,S,U))}};this.prep=function(){switch(this.paint.type){case "linearGradient":case "radialGradient":var P=new a.jGraduate.Paint({copy:this.paint});g.setPaint(u,P)}}};c.paintBox.fill=new q("#fill_color","fill");c.paintBox.stroke=
new q("#stroke_color","stroke");c.paintBox.canvas=new q("#canvas_color","canvas");a("#stroke_width").val(curConfig.initStroke.width);a("#group_opacity").val(curConfig.initOpacity*100);q=c.paintBox.fill.rect.cloneNode(false);q.setAttribute("style","vector-effect:non-scaling-stroke");var H=q.style.vectorEffect==="non-scaling-stroke";q.removeAttribute("style");q=c.paintBox.fill.rect.ownerDocument.createElementNS("http://www.w3.org/2000/svg","feGaussianBlur");typeof q.stdDeviationX==="undefined"&&a("#tool_blur").hide();
a(q).remove();setTimeout(function(){g.embedImage("images/placeholder.svg",function(k){if(!k){a("#image_save_opts [value=embed]").attr("disabled","disabled");a("#image_save_opts input").val(["ref"]);s.img_save="ref";a("#image_opt_embed").css("color","#666").attr("title",uiStrings.notification.featNotSupported)}})},1E3);a("#tool_fill").click(function(){if(a("#tool_fill").hasClass("active"))w(a("#fill_color"));else{a("#tool_fill").addClass("active");a("#tool_stroke").removeClass("active")}});a("#tool_stroke").on("click",
function(){if(a("#tool_stroke").hasClass("active"))w(a("#stroke_color"));else{a("#tool_stroke").addClass("active");a("#tool_fill").removeClass("active")}});a("#tool_canvas").on("click touchstart",function(){w(a("#canvas_color"))});a("#tool_stroke").on("touchstart",function(){a("#tool_stroke").addClass("active");a("#tool_fill").removeClass("active");w(a("#stroke_color"))});a("#tool_fill").on("touchstart",function(){a("#tool_fill").addClass("active");a("#tool_stroke").removeClass("active");w(a("#fill_color"))});
a("#zoom_select").on("change",function(){var k=this.options[this.selectedIndex].text;k=k.split("%")[0];a("#zoom").val(k).trigger("change")});a(".push_button").mousedown(function(){a(this).hasClass("disabled")||a(this).addClass("push_button_pressed").removeClass("push_button")}).mouseout(function(){a(this).removeClass("push_button_pressed").addClass("push_button")}).mouseup(function(){a(this).removeClass("push_button_pressed").addClass("push_button")});a(window).bind("load resize",function(){R.css("line-height",
R.height()+"px")});var A=function(){var k=a("#canvas_width"),u=a("#canvas_height"),C=k.val(),D=u.val();if(C!="fit"&&!svgedit.units.isValidUnit("width",C)){a.alert(uiStrings.notification.invalidAttrValGiven);k.parent().addClass("error");return false}k.parent().removeClass("error");if(D!="fit"&&!svgedit.units.isValidUnit("height",D)){a.alert(uiStrings.notification.invalidAttrValGiven);u.parent().addClass("error");return false}u.parent().removeClass("error");if(!g.setResolution(C,D)){a.alert(uiStrings.notification.noContentToFitTo);
C=g.getResolution();k.val(C.w);u.val(C.h);return false}F()};a("#resolution").change(function(){var k=a("#canvas_width")[0],u=a("#canvas_height")[0];if(this.selectedIndex)if(this.value=="content"){k.value="fit";u.value="fit";A();var C=g.getResolution();k.value=C.w;u.value=C.h}else{var D=this.value.split("x");D[0]=parseInt(D[0]);D[1]=parseInt(D[1]);var P=D[0]-k.value,U=D[1]-u.value,S=Date.now(),Y=function(aa){aa=(aa-S)/1E3;aa=Math.pow(aa-1,3)+1;k.value=(D[0]-P+aa*P).toFixed(0);u.value=(D[1]-U+aa*U).toFixed(0);
A();if(aa>=1){aa=g.getResolution();a("#canvas_width").val(aa.w.toFixed());a("#canvas_height").val(aa.h.toFixed());a("#resolution_label").html("<div class='pull'>"+aa.w+"<span>\u00d7</span></br>"+aa.h+"</div>")}else requestAnimationFrame(Y)};Y(Date.now())}else{a("#resolution_label").html("Custom");k.removeAttribute("readonly");k.focus();k.select();if(k.value=="fit"){k.value=100;u.value=100}}});a("#zoom").change(function(){wa(this)});a("input,select").attr("autocomplete","off");var v=function(){var k=
[{sel:"#tool_select",fn:va,evt:"click",key:["V",true]},{sel:"#tool_fhpath",fn:fb,evt:"click",key:["Q",true]},{sel:"#tool_line",fn:La,evt:"click",key:["L",true]},{sel:"#tool_rect",fn:Va,evt:"click",key:["R",true],icon:"rect"},{sel:"#tool_ellipse",fn:Ea,evt:"mouseup",key:["C",true],icon:"ellipse"},{sel:"#tool_path",fn:Cb,evt:"click",key:["P",true]},{sel:"#tool_text",fn:bb,evt:"click",key:["T",true]},{sel:"#tool_image",fn:kb,evt:"mouseup"},{sel:"#tool_zoom",fn:sb,evt:"mouseup",key:["Z",true]},{sel:"#tool_clear",
fn:Ua,evt:"mouseup",key:[o+"N",true]},{sel:"#tool_save",fn:function(){ka?Pb():g.save({images:s.img_save,round_digits:6})},evt:"mouseup",key:[o+"S",true]},{sel:"#tool_export",fn:vb,evt:"mouseup"},{sel:"#tool_open",fn:xb,evt:"mouseup"},{sel:"#tool_import",fn:Ib,evt:"mouseup"},{sel:"#tool_source",fn:Qb,evt:"click",key:[o+"U",true]},{sel:"#tool_wireframe",fn:Fb,evt:"click"},{sel:"#tool_snap",fn:Jb,evt:"click"},{sel:"#tool_rulers",fn:Eb,evt:"click"},{sel:"#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel",
fn:h,evt:"click",key:["esc",false,false],hidekey:true},{sel:"#tool_source_save",fn:Pb,evt:"click"},{sel:"#tool_delete,#tool_delete_multi",fn:ua,evt:"click",key:["del/backspace",true]},{sel:"#tool_reorient",fn:la,evt:"click"},{sel:"#tool_node_link",fn:M,evt:"click"},{sel:"#tool_node_clone",fn:Q,evt:"click"},{sel:"#tool_node_delete",fn:ea,evt:"click"},{sel:"#tool_openclose_path",fn:Pa,evt:"click"},{sel:"#tool_add_subpath",fn:Ga,evt:"click"},{sel:"#tool_move_top",fn:ob,evt:"click",key:o+"shift+up"},
{sel:"#tool_move_bottom",fn:eb,evt:"click",key:o+"shift+down"},{sel:"#tool_move_up",fn:tb,evt:"click",key:[o+"up",true]},{sel:"#tool_move_down",fn:ub,evt:"click",key:[o+"down",true]},{sel:"#tool_topath",fn:Bb,evt:"click"},{sel:"#tool_make_link,#tool_make_link_multi",fn:ca,evt:"click"},{sel:"#tool_clone,#tool_clone_multi",fn:Nb,evt:"click",key:[o+"D",true]},{sel:"#tool_group",fn:Kb,evt:"click",key:[o+"G",true]},{sel:"#tool_ungroup",fn:Kb,evt:"click",key:o+"shift+G"},{sel:"#tool_unlink_use",fn:Kb,evt:"click"},
{sel:"[id^=tool_align]",fn:Lb,evt:"click"},{sel:"#tool_undo",fn:hb,evt:"click",key:o+"z"},{sel:"#tool_redo",fn:Ja,evt:"click",key:["y",true]},{sel:"#tool_cut",fn:mb,evt:"click",key:[o+"x",true]},{sel:"#tool_copy",fn:jb,evt:"click",key:o+"c"},{sel:"#tool_paste",fn:Ab,evt:"click",key:o+"v"},{sel:"#tool_switch",fn:Ob,evt:"click",key:["x",true]},{sel:"#tool_bold",fn:rb,evt:"mousedown",key:[o+"B",true]},{sel:"#tool_italic",fn:Qa,evt:"mousedown",key:[o+"I",true]},{sel:"#copy_save_done",fn:h,evt:"click"},
{key:"ctrl+left",fn:function(){nb(0,1)}},{key:"ctrl+right",fn:function(){nb(1,1)}},{key:"ctrl+shift+left",fn:function(){nb(0,5)}},{key:"ctrl+shift+right",fn:function(){nb(1,5)}},{key:"shift+O",fn:db},{key:"shift+P",fn:Ya},{key:[o+"+",true],fn:function(){Db(2)}},{key:[o+"-",true],fn:function(){Db(0.5)}},{key:["up",true],fn:function(){ja(0,-1)}},{key:["down",true],fn:function(){ja(0,1)}},{key:["left",true],fn:function(){ja(-1,0)}},{key:["right",true],fn:function(){ja(1,0)}},{key:"shift+up",fn:function(){ja(0,
-10)}},{key:"shift+down",fn:function(){ja(0,10)}},{key:"shift+left",fn:function(){ja(-10,0)}},{key:"shift+right",fn:function(){ja(10,0)}},{key:["alt+up",true],fn:function(){g.cloneSelectedElements(0,-1)}},{key:["alt+down",true],fn:function(){g.cloneSelectedElements(0,1)}},{key:["alt+left",true],fn:function(){g.cloneSelectedElements(-1,0)}},{key:["alt+right",true],fn:function(){g.cloneSelectedElements(1,0)}},{key:["alt+shift+up",true],fn:function(){g.cloneSelectedElements(0,-10)}},{key:["alt+shift+down",
true],fn:function(){g.cloneSelectedElements(0,10)}},{key:["alt+shift+left",true],fn:function(){g.cloneSelectedElements(-10,0)}},{key:["alt+shift+right",true],fn:function(){g.cloneSelectedElements(10,0)}},{key:o+"A",fn:function(){g.selectAllInCurrentLayer()}},{key:o+"shift+z",fn:Ja},{key:"esc",fn:Rb}],u={"4/Shift+4":"#tools_rect_show","5/Shift+5":"#tools_ellipse_show"};return{setAll:function(){var C={};a.each(k,function(D,P){if(P.sel){var U=a(P.sel);if(U.length==0)return true;if(P.evt){if(svgedit.browser.isTouch()&&
P.evt==="click")P.evt="mousedown";U[P.evt](P.fn)}if(P.parent&&a(P.parent+"_show").length!=0){var S=a(P.parent);S.length||(S=ma(P.parent.substr(1)));S.append(U);a.isArray(C[P.parent])||(C[P.parent]=[]);C[P.parent].push(P)}}if(P.key){var Y=P.fn,aa=false;if(a.isArray(P.key)){S=P.key[0];if(P.key.length>1)aa=P.key[1]}else S=P.key;S+="";svgedit.browser.isMac&&S.indexOf("+")!=-1&&S.split("+")[0]=="ctrl"&&S.replace("ctrl","cmd");a.each(S.split("/"),function(ra,Oa){a(document).bind("keydown",Oa,function(Ba){Y();
aa&&Ba.preventDefault();return false})});if(P.sel&&!P.hidekey&&U.attr("title")){var ga=U.attr("title").split("[")[0]+" ("+S+")";u[S]=P.sel;U.parents("#main_menu").length||U.attr("title",ga)}}});qa(C);a(window).bind("keydown","tab",function(D){if(pa==="canvas"){D.preventDefault();Ya()}}).bind("keydown","shift+tab",function(D){if(pa==="canvas"){D.preventDefault();db()}});a("#tool_zoom").dblclick(Za)},setTitles:function(){a.each(u,function(C,D){var P=a(D).parents("#main_menu").length;a(D).each(function(){var U=
P?a(this).text().split(" [")[0]:this.title.split(" [")[0],S="";a.each(C.split("/"),function(Y,aa){var ga=aa.split("+"),ra="";if(ga.length>1){ra=ga[0]+"+";aa=ga[1]}S+=(Y?"/":"")+ra+(uiStrings["key_"+aa]||aa)});if(P)this.lastChild.textContent=U+" ["+S+"]";else this.title=U+" ["+S+"]"})})},getButtonData:function(C){var D;a.each(k,function(P,U){if(U.sel===C)D=U});return D}}}();v.setAll();c.ready(function(){var k=curConfig.initTool,u=a("#tools_left, #svg_editor .tools_flyout"),C=u.find("#tool_"+k);k=u.find("#"+
k);(C.length?C:k.length?k:a("#tool_select")).click().mouseup();curConfig.wireframe&&a("#tool_wireframe").click();curConfig.showlayers&&toggleSidePanel();a("#rulers").toggle(!!curConfig.showRulers)});a("#canvas_height").dragInput({min:10,max:null,step:10,callback:A,cursor:false,dragAdjust:0.1});a("#canvas_width").dragInput({min:10,max:null,step:10,callback:A,cursor:false,dragAdjust:0.1});a("#rect_width").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_height").dragInput({min:0,
max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_cx").dragInput({min:0,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_cy").dragInput({min:0,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_rx").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_ry").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_height").dragInput({min:0,max:null,step:1,callback:changeAttribute,cursor:false});
a("#selected_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#selected_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_node_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_node_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_width").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_x1").dragInput({min:null,
max:null,step:1,callback:changeAttribute,cursor:false});a("#line_x2").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_y1").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_y2").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});
a("#rect_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#g_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#g_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#text_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,
cursor:false});a("#text_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_rx").dragInput({min:0,max:100,step:1,callback:function(k){g.setRectRadius(k.value)},cursor:true});a("#stroke_width").dragInput({min:0,max:99,step:1,callback:function(k){var u=k.value;if(u==0&&X&&["line","polyline"].indexOf(X.nodeName)>=0)u=k.value=1;g.setStrokeWidth(u)},cursor:true,smallStep:0.1,start:1.5});
a("#angle").dragInput({min:-180,max:180,step:1,callback:function(k){g.setRotationAngle(k.value);rotateCursor(k.value);a("#tool_reorient").toggleClass("disabled",k.value==0)},cursor:false});a("#font_size").dragInput({min:1,max:250,step:1,callback:function(k){g.setFontSize(k.value)},cursor:true,stepfunc:function(k,u){var C=k.value-0,D=C+u,P=D>=C;if(u===0)return C;return C>=24?P?Math.round(C*1.1):Math.round(C/1.1):C<=1?P?C*2:C/2:D}});a("#group_opacity").dragInput({min:0,max:100,step:5,callback:function(k,
u){if(u==null)u=k.value;a("#group_opacity").val(u);if(!k||!k.handle)a("#opac_slider").slider("option","value",u);g.setOpacity(u/100)},cursor:true,start:100});a("#blur").dragInput({min:0,max:10,step:0.1,callback:function(k){val=k.value;a("#blur").val(val);window.event.type=="mouseup"?g.setBlur(val,true):g.setBlurNoUndo(val)},cursor:true,start:0});a("#zoom").val(g.getZoom()*100);a("#workarea").contextMenu({menu:"cmenu_canvas",inSpeed:0},function(k){switch(k){case "delete":ua();break;case "cut":mb();
break;case "copy":jb();break;case "paste":g.pasteElements();break;case "paste_in_place":g.pasteElements("in_place");break;case "group":g.groupSelectedElements();break;case "ungroup":g.ungroupSelectedElement();break;case "move_front":ob();break;case "move_up":wb("Up");break;case "move_down":wb("Down");break;case "move_back":eb();break;default:svgedit.contextmenu&&svgedit.contextmenu.hasCustomHandler(k)&&svgedit.contextmenu.getCustomHandler(k).call()}});a(".contextMenu li").mousedown(function(k){k.preventDefault()});
a("#cmenu_canvas li").disableContextMenu();V.enableContextMenuItems("#delete,#cut,#copy");window.onbeforeunload=function(){if(T.getUndoStackSize()===0)c.show_save_warning=false;if(!curConfig.no_save_warning&&c.show_save_warning)return uiStrings.notification.unsavedChanges};c.openPrep=function(k){a("#main_menu").hide();T.getUndoStackSize()===0?k(true):a.confirm(uiStrings.notification.QwantToOpen,k)};if(window.FileReader){q=a('<input type="file">').change(function(){var k=this;c.openPrep(function(u){if(u){g.clear();
if(k.files.length==1){u=new FileReader;u.onloadend=function(C){p(C.target.result);F()};u.readAsText(k.files[0])}}})});a("#tool_open").show().prepend(q);q=a('<input type="file">').change(function(){a("#main_menu").hide();if(this.files.length==1){var k=new FileReader;k.onloadend=function(u){g.importSvgString(u.target.result,true);F()};k.readAsText(this.files[0])}});a("#tool_import").show().prepend(q)}for(var F=c.updateCanvas=function(k,u){var C=R.width(),D=R.height(),P=C,U=D,S=g.getZoom(),Y=a("#svgcanvas"),
aa={x:R[0].scrollLeft+P/2,y:R[0].scrollTop+U/2},ga=curConfig.canvas_expansion;C=Math.max(P,g.contentW*S*ga);D=Math.max(U,g.contentH*S*ga);C==P&&D==U?R.css("overflow","hidden"):R.css("overflow","scroll");ga=Y.height()/2;var ra=Y.width()/2;Y.width(C).height(D);var Oa=D/2,Ba=C/2,ha=g.updateCanvas(C,D),Ta=Ba/ra;C=C/2-P/2;D=D/2-U/2;if(u){u.x+=ha.x;u.y+=ha.y}else u={x:Ba+(aa.x-ra)*Ta,y:Oa+(aa.y-ga)*Ta};if(k)if(g.contentW>R.width()){R[0].scrollLeft=ha.x-10;R[0].scrollTop=ha.y-10}else{R[0].scrollLeft=C;R[0].scrollTop=
D}else{R[0].scrollLeft=u.x-P/2;R[0].scrollTop=u.y-U/2}if(curConfig.showRulers){l(Y,S);R.scroll()}},I=[],E=0.1;E<1E5;E*=10){I.push(1*E);I.push(2*E);I.push(5*E)}F(true);try{var G=function(k){if(window.JSON&&JSON.stringify)return JSON.stringify(k);var u=arguments.callee;if(typeof k=="boolean"||typeof k=="number")return k+"";else if(typeof k=="string")return'"'+k.replace(/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,function(P){return"\\u"+
("0000"+P.charCodeAt(0).toString(16)).slice(-4)})+'"';else if(k.length){for(var C=0;C<k.length;C++)k[C]=u(k[C]);return"["+k.join(",")+"]"}else{C=[];for(var D in k)C.push(u(D)+":"+u(k[D]));return"{"+C.join(",")+"}"}};window.addEventListener("message",function(k){var u=parseInt(k.data.substr(0,k.data.indexOf(";")));try{k.source.postMessage("SVGe"+u+";"+G(eval(k.data)),"*")}catch(C){k.source.postMessage("SVGe"+u+";error:"+C.message,"*")}},false)}catch(L){window.embed_error=L}a(function(){window.svgCanvas=
50))}var D=false,P=false,U=true,S=function(){if(u.callback&&!D&&U){D=true;u.callback()}},Y=[];u.context_tools&&a.each(u.context_tools,function(Ba,ha){var Ta=ha.container_id?' id="'+ha.container_id+'"':"",Ra=a("#"+ha.panel);Ra.length||(Ra=a("<div>",{id:ha.panel}).appendTo("#tools_top").hide());switch(ha.type){case "tool_button":var ua='<div class="tool_button">'+ha.id+"</div>",Ma=a(ua).appendTo(Ra);ha.events&&a.each(ha.events,function(Xa,cb){a(Ma).bind(Xa,cb)});break;case "select":ua="<label"+Ta+'><select id="'+
ha.id+'">';a.each(ha.options,function(Xa,cb){ua+='<option value="'+Xa+'"'+(Xa==ha.defval?" selected":"")+">"+cb+"</option>"});ua+="</select></label>";var xa=a(ua).appendTo(Ra).find("select");a.each(ha.events,function(Xa,cb){a(xa).bind(Xa,cb)});break;case "button-select":ua='<div id="'+ha.id+'" class="dropdown toolset" title="'+ha.title+'"><div id="cur_'+ha.id+'" class="icon_label"></div><button></button></div>';Ta=a('<ul id="'+ha.id+'_opts"></ul>').appendTo("#option_lists");ha.colnum&&Ta.addClass("optcols"+
ha.colnum);a(ua).appendTo(Ra).children();Y.push({elem:"#"+ha.id,list:"#"+ha.id+"_opts",title:ha.title,callback:ha.events.change,cur:"#cur_"+ha.id});break;case "input":ua="<label"+Ta+'><span id="'+ha.id+'_label">'+ha.label+':</span><input id="'+ha.id+'" title="'+ha.title+'" size="'+(ha.size||"4")+'" value="'+(ha.defval||"")+'" type="text"/></label>';var ab=a(ua).appendTo(Ra).find("input");ha.spindata&&ab.SpinButton(ha.spindata);ha.events&&a.each(ha.events,function(Xa,cb){ab.bind(Xa,cb)})}});if(u.buttons){var aa=
{},ga={},ra=u.svgicons,Oa={};a.each(u.buttons,function(Ba,ha){for(var Ta,Ra=ha.id,ua=Ba;a("#"+Ra).length;)Ra=ha.id+"_"+ ++ua;if(ra){aa[Ra]=ha.icon;ua=ha.svgicon?ha.svgicon:ha.id;if(ha.type=="app_menu")ga["#"+Ra+" > div"]=ua;else ga["#"+Ra]=ua}else Ta=ha.type=="menu"?"":a('<img src="'+ha.icon+'">');var Ma,xa;switch(ha.type){case "mode_flyout":case "mode":Ma="tool_button";if(ha.cls)Ma+=" "+ha.cls;xa="#tools_left";break;case "context":Ma="tool_button";xa="#"+ha.panel;a(xa).length||a("<div>",{id:ha.panel}).appendTo("#tools_top");
break;case "menu":Ma="menu_item tool_button";xa="#"+(ha.after||ha.panel);break;case "app_menu":Ma="";xa=ha.parent||"#main_menu ul";a(xa).length||a("<div>",{id:ha.panel}).appendTo("#tools_top")}var ab=a(ha.list||ha.type=="app_menu"?"<li/>":"<div/>").attr("id",Ra).attr("title",ha.title).addClass(Ma);if(!ha.includeWith&&!ha.list){if("position"in ha)a(xa).children().eq(ha.position).before(ab);else ha.type!="menu"||!ha.after?ab.appendTo(xa):a(xa).after(ab);if(ha.type=="mode_flyout"){ua=a(ab);Ma=ua.parent();
if(!ua.parent().hasClass("tools_flyout")){var Xa=ua[0].id.replace("tool_","tools_"),cb=ua.clone().attr("id",Xa+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));ua.before(cb);Ma=ma(Xa,ua);Ma.data("isLibrary",true);cb.data("isLibrary",true)}ga["#"+Xa+"_show"]=ha.id;Ra=Oa["#"+Ma[0].id]=[{sel:"#"+Ra,fn:ha.events.click,icon:ha.id,isDefault:true},Hb]}else if(ha.type=="app_menu"||ha.type=="menu")ab.append(ha.title)}else if(ha.list){ab.addClass("push_button");a("#"+ha.list+"_opts").append(ab);if(ha.isDefault){a("#cur_"+
ha.list).append(ab.children().clone());ua=ha.svgicon?ha.svgicon:ha.id;ga["#cur_"+ha.list]=ua}}else if(ha.includeWith){xa=ha.includeWith;ua=a(xa.button);Ma=ua.parent();if(!ua.parent().hasClass("tools_flyout")){Xa=ua[0].id.replace("tool_","tools_");cb=ua.clone().attr("id",Xa+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));ua.before(cb);Ma=ma(Xa,ua)}var Hb=v.getButtonData(xa.button);if(xa.isDefault)ga["#"+Xa+"_show"]=ha.id;Ra=Oa["#"+Ma[0].id]=[{sel:"#"+Ra,fn:ha.events.click,icon:ha.id,key:ha.key,
isDefault:ha.includeWith?ha.includeWith.isDefault:0},Hb];Xa="position"in xa?xa.position:"last";Hb=Ma.children().length;if(!isNaN(Xa)&&Xa>=0&&Xa<Hb)Ma.children().eq(Xa).before(ab);else{Ma.append(ab);Ra.reverse()}}ra||ab.append(Ta);ha.list||a.each(ha.events,function(zb,Gb){if(zb=="click")if(ha.type=="mode"){ha.includeWith?ab.bind(zb,Gb):ab.bind(zb,function(){$a(ab)&&Gb()});if(ha.key){a(document).bind("keydown",ha.key,Gb);ha.title&&ab.attr("title",ha.title+" ["+ha.key+"]")}}else ab.bind(zb,Gb);else ab.bind(zb,
Gb)});qa(Oa)});a.each(Y,function(){Da(this.elem,this.list,this.callback,{seticon:true})});if(ra)U=false;a.svgIcons(ra,{w:27,h:27,id_match:false,no_img:!B,fallback:aa,placement:ga,callback:function(){s.iconsize&&s.iconsize!="m"&&C();U=true;S()}})}S()});g.textActions.setInputElem(a("#text")[0]);var ya='<div class="palette_item" data-rgb="none"></div>';a.each(["#000000","#3f3f3f","#7f7f7f","#bfbfbf","#ffffff","#ff0000","#ff7f00","#ffff00","#7fff00","#00ff00","#00ff7f","#00ffff","#007fff","#0000ff","#7f00ff",
"#ff00ff","#ff007f","#7f0000","#7f3f00","#7f7f00","#3f7f00","#007f00","#007f3f","#007f7f","#003f7f","#00007f","#3f007f","#7f007f","#7f003f","#ffaaaa","#ffd4aa","#ffffaa","#d4ffaa","#aaffaa","#aaffd4","#aaffff","#aad4ff"],function(k,u){ya+='<div class="palette_item" style="background-color: '+u+';" data-rgb="'+u+'"></div>'});a("#palette").append(ya);var Ha=a("#tool_angle_indicator");a("#tool_reorient");rotateCursor=function(k){k="rotate("+k+"deg)";Ha.css({"-webkit-transform":k,"-moz-transform":k,"-o-transform":k,
"-ms-transform":k,transform:k})};var wa=function(k){var u=k.value/100;if(u<0.0010)k.value=0.1;else{k=g.getZoom();W(window,{width:0,height:0,x:(R[0].scrollLeft+R.width()/2)/k,y:(R[0].scrollTop+R.height()/2)/k,zoom:u},true)}},qb=function(){window.opera&&a("<p/>").hide().appendTo("body").remove()};a("#stroke_style").change(function(){g.setStrokeAttr("stroke-dasharray",a(this).val());a("#stroke_style_label").html(this.options[this.selectedIndex].text);qb()});a("#seg_type").change(function(){g.setSegType(a(this).val());
a("#seg_type_label").html(this.options[this.selectedIndex].text)});a("select").change(function(){a(this).blur()});a("#font_family").change(function(){g.setFontFamily(this.value)});a("#text").keyup(function(){g.setTextContent(this.value)});changeAttribute=function(k,u){var C=k.getAttribute("data-attr"),D=k.value;if(!svgedit.units.isValidUnit(C,D,X)){a.alert(uiStrings.notification.invalidAttrValGiven);k.value=X.getAttribute(C);return false}u?g.changeSelectedAttributeNoUndo(C,D):g.changeSelectedAttribute(C,
D)};a("#palette").mouseover(function(){var k=a('<input type="hidden">');a(this).append(k);k.focus().remove()});a(".palette_item").on("mousedown touchstart touchmove",function(){var k=a("#tool_stroke").hasClass("active"),u=k?"stroke":"fill",C=a(this).attr("data-rgb"),D=null;if(C==="transparent"||C==="initial"||C==="#none"){C="none";D=new a.jGraduate.Paint}else D=new a.jGraduate.Paint({alpha:100,solidColor:C.substr(1)});c.paintBox[u].setPaint(D);if(k){g.setColor("stroke",C);C!="none"&&g.getStrokeOpacity()!=
1&&g.setPaintOpacity("stroke",1)}else{g.setColor("fill",C);C!="none"&&g.getFillOpacity()!=1&&g.setPaintOpacity("fill",1)}}).bind("contextmenu",function(k){k.preventDefault()});a("#toggle_stroke_tools").toggle(function(){a(".stroke_tool").css("display","table-cell");a(this).addClass("expanded");z()},function(){a(".stroke_tool").css("display","none");a(this).removeClass("expanded");z()});var $a=function(k,u){if(a(k).hasClass("disabled"))return false;if(a(k).parent().hasClass("tools_flyout"))return true;
var C=C||"normal";u||a(".tools_flyout").fadeOut(C);a("#styleoverrides").text("");a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");a(k).addClass("tool_button_current").removeClass("tool_button");return true};(function(){var k=null,u=null,C=R[0],D=false,P=false;a("#svgcanvas").bind("mousemove mouseup touchend",function(U){if(D!==false){C.scrollLeft-=U.clientX-k;C.scrollTop-=U.clientY-u;k=U.clientX;u=U.clientY;if(U.type==="mouseup"||U.type==="touchend")D=false;return false}}).on("mousedown touchmove",
function(U){if(U.button===1||P===true||U.originalEvent.touches&&U.originalEvent.touches.length>=2){D=true;k=U.clientX;u=U.clientY;return false}});a(window).mouseup(function(){D=false;a("body").removeClass("dragging")});a(document).bind("keydown","space",function(U){U.preventDefault();g.spaceKey=P=true}).bind("keyup","space",function(U){U.preventDefault();g.spaceKey=P=false}).bind("keydown","alt",function(){g.getMode()==="zoom"&&R.addClass("out")}).bind("keyup","alt",function(){g.getMode()==="zoom"&&
R.removeClass("out")})})();var ib=a(".menu"),Wa=function(k){k.target.style.background="#fff";setTimeout(function(){k.target.style.background="#ddd"},50);setTimeout(function(){k.target.style.background="#fff"},150);setTimeout(function(){k.target.style.background="#ddd"},200);setTimeout(function(){k.target.style.background=""},200);setTimeout(function(){a("#menu_bar").removeClass("active")},220);return false};a(".menu_item").on("mousedown touchstart",function(k){Wa(k)});a("svg, body").on("mousedown touchstart",
function(k){top!=self&&!k.isTrigger&&typeof top.exports.focus_editor=="function"&&top.exports.focus_editor();if(k.target.nodeName.toLowerCase()!=="input")if(!a(k.target).hasClass("menu_title")&&!a(k.target).parent().hasClass("menu_title"))!a(k.target).hasClass("disabled")&&a(k.target).hasClass("menu_item")?Wa(k):a("#menu_bar").removeClass("active")});var Sa=[6,12,16,33,50,66,100,150,200,300,400,600,800,1200];a("#workarea").on("mousewheel",function(k,u,C,D){if(k.altKey){k.preventDefault();k=g.getZoom()*
100;u=Sa.length;for(E=0;E<u;E++){C=Math.min(u,E+1);if(D>0)zoom=Sa[E]<=k?Sa[C]:zoom;if(D<0)zoom=Sa[E]<k?Sa[E]:zoom}zoom&&wa({value:zoom})}});a(".menu_title").on("mousedown",function(){a("#tools_shapelib").hide();a("#menu_bar").toggleClass("active");ib.removeClass("open");a(this).parent().addClass("open")}).on("mouseover",function(){ib.removeClass("open");a(this).parent().addClass("open")});c.addDropDown=function(k,u,C){if(a(k).length!=0){var D=a(k).find("button"),P=a(k).find("ul").attr("id",a(k)[0].id+
"-list");C||a("#option_lists").append(P);var U=false;C&&a(k).addClass("dropup");P.find("li").bind("mouseup",u);a(window).mouseup(function(){if(!U){D.removeClass("down");P.hide()}U=false});D.bind("mousedown",function(){if(D.hasClass("down")){D.removeClass("down");P.hide()}else{D.addClass("down");if(!C){var S=a(k).offset();P.css({top:S.top,left:S.left-110})}P.show();U=true}}).hover(function(){U=true}).mouseout(function(){U=false})}};var Da=function(k,u,C,D){var P=a(k);u=a(u);var U=false,S=D.dropUp;
S&&a(k).addClass("dropup");u.find("li").bind("mouseup",function(){if(D.seticon){yb("#cur_"+P[0].id,a(this).children());a(this).addClass("current").siblings().removeClass("current")}C.apply(this,arguments)});a(window).mouseup(function(){if(!U){P.removeClass("down");u.hide();u.css({top:0,left:0})}U=false});u.height();a(k).bind("mousedown",function(){var Y=a(k).offset();if(S){Y.top-=u.height();Y.left+=8}else Y.top+=a(k).height();a(u).offset(Y);if(P.hasClass("down")){P.removeClass("down");u.hide();u.css({top:0,
left:0})}else{P.addClass("down");u.show();U=true;return false}}).hover(function(){U=true}).mouseout(function(){U=false});D.multiclick&&u.mousedown(function(){U=true})};a("#font_family_dropdown").change(function(){var k=this.options[this.selectedIndex].value,u=this.options[this.selectedIndex].text;a("#preview_font").html(u).css("font-family",k);a("#font_family").val(k).change()});a("div","#position_opts").each(function(){this.addEventListener("mouseup",function(){var k=this.id.replace("tool_pos","").charAt(0);
g.alignSelectedElements(k,"page")})});(function(){var k,u=function(){a(k).blur()};a("#svg_editor").find("button, select, input:not(#text)").focus(function(){k=this;pa="toolbars";R.mousedown(u)}).blur(function(){pa="canvas";R.unbind("mousedown",u);g.getMode()=="textedit"&&a("#text").focus()})})();var va=function(){$a("#tool_select")&&g.setMode("select")},fb=function(){$a("#tool_fhpath")&&g.setMode("fhpath")},La=function(){$a("#tool_line")&&g.setMode("line")},Va=function(){$a("#tool_rect")&&g.setMode("rect")},
Ea=function(){$a("#tool_ellipse")&&g.setMode("ellipse")},kb=function(){$a("#tool_image")&&g.setMode("image")},sb=function(){$a("#tool_zoom")&&g.setMode("zoom")},Za=function(){if($a("#tool_zoom")){Db();ba()}},bb=function(){$a("#tool_text")&&g.setMode("text")},Cb=function(){$a("#tool_path")&&g.setMode("path")},ta=function(){if(X!=null||sa)g.deleteSelectedElements()},mb=function(){if(X!=null||sa){window.event.type==="keydown"&&pb(a("#edit_menu"));g.cutSelectedElements()}},jb=function(){if(X!=null||sa){window.event.type===
"keydown"&&pb(a("#edit_menu"));g.copySelectedElements()}},Ab=function(){window.event.type==="keydown"&&pb(a("#edit_menu"));var k=g.getZoom(),u=(R[0].scrollLeft+R.width()/2)/k-g.contentW;k=(R[0].scrollTop+R.height()/2)/k-g.contentH;g.pasteElements("point",u,k)},ob=function(){if(X!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveToTopSelectedElement()}},eb=function(){if(X!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveToBottomSelectedElement()}},tb=function(){if(X!=
null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveUpDownSelected("Up")}},ub=function(){if(X!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveUpDownSelected("Down")}},wb=function(k){if(X!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveUpDownSelected(k)}},Bb=function(){if(X!=null){g.convertToPath();elems=g.getSelectedElems();g.selectorManager.requestSelector(elems[0]).selectorRect.setAttribute("display","none");g.setMode("pathedit");K.toEditMode(elems[0]);
g.clearSelection()}},la=function(){X!=null&&K.reorient()},ca=function(){if(X!=null||sa)a.prompt(uiStrings.notification.enterNewLinkURL,"http://",function(k){k&&g.makeHyperlink(k)})},ja=function(k,u){if(X!=null||sa){if(curConfig.gridSnapping){var C=g.getZoom()*curConfig.snappingStep;k*=C;u*=C}a("input").blur();g.moveSelectedElements(k,u)}},M=function(){var k=!a("#tool_node_link").hasClass("checked");k?a("#tool_node_link").addClass("checked").find("input").attr("checked",true):a("#tool_node_link").removeClass("checked").find("input").attr("checked",
false);K.linkControlPoints(k)},Q=function(){K.getNodePoint()&&K.clonePathNode()},ea=function(){K.getNodePoint()&&K.deletePathNode()},Ga=function(){var k=a("#tool_add_subpath"),u=!k.hasClass("push_button_pressed");u?k.addClass("push_button_pressed").removeClass("tool_button"):k.removeClass("push_button_pressed").addClass("tool_button");K.addSubPath(u)},Pa=function(){K.opencloseSubPath()},Ya=function(){g.cycleElement(1)},db=function(){g.cycleElement(0)},nb=function(k,u){if(!(X==null||sa)){k||(u*=-1);
var C=a("#angle").val()*1+u;g.setRotationAngle(C);za()}},Ua=function(){var k=curConfig.dimensions;a.confirm(uiStrings.notification.QwantToClear,function(u){if(u){ba();g.clear();g.setResolution(k[0],k[1]);F(true);Db();za();Z();g.runExtensions("onNewDocument")}})},rb=function(){g.setBold(!g.getBold());za();return false},Qa=function(){g.setItalic(!g.getItalic());za();return false},vb=function(){if(!b.pngsave){var k=uiStrings.notification.loadingImage;O=window.open("data:text/html;charset=utf-8,<title>"+
k+"</title><h1>"+k+"</h1>")}window.canvg?g.rasterExport():a.getScript("canvg/rgbcolor.js",function(){a.getScript("canvg/canvg.js",function(){g.rasterExport()})})},xb=function(){g.open()},Ib=function(){},pb=function(k){var u=k.prev();u.css("background","#09f");setTimeout(function(){u.css("background","")},200)},hb=function(){if(T.getUndoStackSize()>0){window.event.type==="keydown"&&pb(a("#edit_menu"));T.undo()}},Ja=function(){if(T.getRedoStackSize()>0){window.event.type==="keydown"&&pb(a("#edit_menu"));
T.redo()}},Kb=function(){if(sa)g.groupSelectedElements();else X&&g.ungroupSelectedElement()},Nb=function(){window.event.type==="keydown"&&pb(a("#edit_menu"));g.cloneSelectedElements(20,20)},Lb=function(){var k=this.id.replace("tool_align","").charAt(0);g.alignSelectedElements(k,a("#align_relative_to").val())},Ob=function(){var k=document.querySelector("#tool_stroke rect"),u=document.querySelector("#tool_fill rect"),C=u.getAttribute("fill"),D=k.getAttribute("fill");k=parseFloat(k.getAttribute("stroke-opacity"));
if(isNaN(k))k=100;u=parseFloat(u.getAttribute("fill-opacity"));if(isNaN(u))u=100;D=Ia(D,k,"stroke");C=Ia(C,u,"fill");c.paintBox.fill.setPaint(D,true);c.paintBox.stroke.setPaint(C,true)},Db=function(k){var u=g.getResolution();k=k?u.zoom*k:1;a("#zoom").val(k*100);g.setZoom(k);lb();F(true)},Fb=function(){!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"):a("#tool_wireframe").removeClass("push_button_pressed");R.toggleClass("wireframe");if(!H){var k=
a("#wireframe_rules");k.length?k.empty():a('<style id="wireframe_rules"></style>').appendTo("head");lb()}},Jb=function(){var k=!a("#tool_snap").hasClass("push_button_pressed");k?a("#tool_snap").addClass("push_button_pressed"):a("#tool_snap").removeClass("push_button_pressed");curConfig.gridSnapping=k},Rb=function(){window.self!=window.top&&top.exports.setEditorFocus(false)},Eb=function(){if(a("#tool_rulers").hasClass("push_button_pressed")){a("#tool_rulers").removeClass("push_button_pressed");a("#show_rulers").attr("checked",
false);curConfig.showRulers=false}else{a("#tool_rulers").addClass("push_button_pressed");a("#show_rulers").attr("checked",true);curConfig.showRulers=true}a("#rulers").toggle(!!curConfig.showRulers)},lb=function(){if(!H){var k="#workarea.wireframe #svgcontent * { stroke-width: "+1/g.getZoom()+"px; }";a("#wireframe_rules").text(R.hasClass("wireframe")?k:"")}},Qb=function(k,u){if(!ka){ka=true;a("#save_output_btns").toggle(!!u);a("#tool_source_back").toggle(!u);var C=fa=g.getSvgString();a("#svg_source_textarea").val(C);
a("#svg_source_editor").fadeIn();C=a("#svg_source_container").height()-50;a("#svg_source_textarea").css("height",C);a("#svg_source_textarea").focus()}},Pb=function(){if(ka){if(g.setSvgString(a("#svg_source_textarea").val())){g.clearSelection();m();Db();Z()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(k){if(!k)return false;g.clearSelection();m();Db();Z()});ba()}},yb=c.setIcon=function(k,u){var C=typeof u==="string"?a.getSvgIcon(u,true):u.clone();C?a(k).find("img").replaceWith(C):
console.log("NOTE: Icon image missing: "+u)},gb;gb=function(){var k=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,u=document.getElementsByTagName("script")[0],C;for(C in u.style)if(k.test(C))return C.match(k)[0];if("WebkitOpacity"in u.style)return"Webkit";if("KhtmlOpacity"in u.style)return"Khtml";return""}();var Mb=function(k,u){gb.toLowerCase();var C=["top","left","bottom","right"];k.each(function(){for(var D=a(this),P=D.outerWidth()*(u-1),U=D.outerHeight()*(u-1),S=0;S<4;S++){var Y=C[S],aa=D.data("orig_margin-"+
Y);if(aa==null){aa=parseInt(D.css("margin-"+Y));D.data("orig_margin-"+Y,aa)}aa=aa*u;if(Y==="right")aa+=P;else if(Y==="bottom")aa+=U;D.css("margin-"+Y,aa)}})},e=c.setIconSize=function(k,u){if(!(k==s.size&&!u)){var C=a("#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout"),D=1;D=typeof k=="number"?k:{s:0.75,m:1,l:1.25,xl:1.5}[k];c.tool_scale=ia=D;na();
var P=C.parents(":hidden");P.css("visibility","hidden").show();Mb(C,D);P.css("visibility","visible").hide();C=a("#tool_size_rules");if(C.length)C.empty();else C=a('<style id="tool_size_rules"></style>').appendTo("head");if(k!="m"){var U="";a.each(cssResizeRules,function(S,Y){S="#svg_editor "+S.replace(/,/g,", #svg_editor");U+=S+"{";a.each(Y,function(aa,ga){if(typeof ga==="number")var ra=ga*D+"px";else if(ga[k]||ga.all)ra=ga[k]||ga.all;U+=aa+":"+ra+";"});U+="}"});P="-"+gb.toLowerCase()+"-";U+="#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout{"+
P+"transform: scale("+D+");} #svg_editor div.toolset .toolset {"+P+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+P+"transform: scale("+1/D+");}";C.text(U)}na()}},h=function(){a("#dialog_box").hide();if(ka){if(ka)fa!==a("#svg_source_textarea").val()?a.confirm(uiStrings.notification.QignoreSourceChanges,function(k){k&&m()}):m();z()}else da&&g.leaveContext()},m=function(){a("#svg_source_editor").hide();ka=false;a("#svg_source_textarea").blur()};a(window).width();a(window).height();
var z=a.noop;a(window).resize(function(){F()});(function(){R.scroll(function(){if(a("#ruler_x").length!=0)a("#ruler_x")[0].scrollLeft=R[0].scrollLeft;if(a("#ruler_y").length!=0)a("#ruler_y")[0].scrollTop=R[0].scrollTop})})();a("#url_notice").click(function(){a.alert(this.title)});a("#change_image_url").click(function(){var k=g.getHref(X);k=k.indexOf("data:")===0?"":k;a.prompt(uiStrings.notification.enterNewImgURL,k,function(u){u&&Na(u)})});var w=function(k){var u=k[0].id=="stroke_color"?"stroke":
"fill",C=k[0].id=="canvas_color";if(C)u="canvas";var D=c.paintBox[u].paint;k=u=="stroke"?"Pick a Stroke Paint and Opacity":"Pick a Fill Paint and Opacity";C=C?{right:200,top:50}:{left:45,bottom:50};a("#color_picker").draggable({cancel:".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker",containment:"window"}).css(C).jGraduate({paint:D,window:{pickerTitle:k},images:{clientPath:curConfig.jGraduatePath},newstop:"inverse"},function(P){D=new a.jGraduate.Paint(P);c.paintBox[u].setPaint(D);
g.setPaint(u,D);a("#color_picker").hide()},function(){a("#color_picker").hide()})};q=function(k,u){var C=document.getElementById("canvas_background"),D={color:"fff",opacity:1};if(u=="stroke")D=curConfig.initStroke;if(u=="fill")D=curConfig.initFill;if(u=="canvas"&&C)if(C=C.getAttribute("fill").match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))D={color:("0"+parseInt(C[1],10).toString(16)).slice(-2)+("0"+parseInt(C[2],10).toString(16)).slice(-2)+("0"+parseInt(C[3],10).toString(16)).slice(-2),opacity:1};C=(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg"><rect width="100%" height="100%"\t\t\t\t\tfill="#'+
D.color+'" opacity="'+D.opacity+'"/>\t\t\t\t\t<defs><linearGradient id="gradbox_"/></defs></svg>',"text/xml").documentElement;C=a(k)[0].appendChild(document.importNode(C,true));u==="canvas"?C.setAttribute("width",60.5):C.setAttribute("width","100%");this.rect=C.firstChild;this.defs=C.getElementsByTagName("defs")[0];this.grad=this.defs.firstChild;this.paint=new a.jGraduate.Paint({solidColor:D.color});this.type=u;this.setPaint=function(P,U){this.paint=P;var S="none",Y=P.type,aa=P.alpha/100;switch(Y){case "solidColor":S=
P[Y]=="none"||P[Y]=="one"?"none":"#"+P[Y];break;case "linearGradient":case "radialGradient":this.defs.removeChild(this.grad);this.grad=this.defs.appendChild(P[Y]);S="url(#"+(this.grad.id="gradbox_"+this.type)+")"}this.rect.setAttribute("fill",S);this.rect.setAttribute("opacity",aa);if(U){g.setColor(this.type,S,true);g.setPaintOpacity(this.type,aa,true)}if(this.type=="canvas")(Y=document.getElementById("canvas_background"))?Y.setAttribute("fill",S):Ka(S)};this.update=function(P){if(X){var U=this.type;
switch(X.tagName){case "use":case "image":case "foreignObject":return;case "g":case "a":for(var S=null,Y=X.getElementsByTagName("*"),aa=0,ga=Y.length;aa<ga;aa++){var ra=Y[aa].getAttribute(U);if(aa===0)S=ra;else if(S!==ra){S=null;break}}if(S===null){Y=null;return}Y=S;S=1;break;default:S=parseFloat(X.getAttribute(U+"-opacity"));if(isNaN(S))S=1;Y=U==="fill"?"black":"none";Y=X.getAttribute(U)||Y}if(P){g.setColor(U,Y,true);g.setPaintOpacity(U,S,true)}S*=100;this.setPaint(Ia(Y,S,U))}};this.prep=function(){switch(this.paint.type){case "linearGradient":case "radialGradient":var P=
new a.jGraduate.Paint({copy:this.paint});g.setPaint(u,P)}}};c.paintBox.fill=new q("#fill_color","fill");c.paintBox.stroke=new q("#stroke_color","stroke");c.paintBox.canvas=new q("#canvas_color","canvas");a("#stroke_width").val(curConfig.initStroke.width);a("#group_opacity").val(curConfig.initOpacity*100);q=c.paintBox.fill.rect.cloneNode(false);q.setAttribute("style","vector-effect:non-scaling-stroke");var H=q.style.vectorEffect==="non-scaling-stroke";q.removeAttribute("style");q=c.paintBox.fill.rect.ownerDocument.createElementNS("http://www.w3.org/2000/svg",
"feGaussianBlur");typeof q.stdDeviationX==="undefined"&&a("#tool_blur").hide();a(q).remove();setTimeout(function(){g.embedImage("images/placeholder.svg",function(k){if(!k){a("#image_save_opts [value=embed]").attr("disabled","disabled");a("#image_save_opts input").val(["ref"]);s.img_save="ref";a("#image_opt_embed").css("color","#666").attr("title",uiStrings.notification.featNotSupported)}})},1E3);a("#tool_fill").click(function(){if(a("#tool_fill").hasClass("active"))w(a("#fill_color"));else{a("#tool_fill").addClass("active");
a("#tool_stroke").removeClass("active")}});a("#tool_stroke").on("click",function(){if(a("#tool_stroke").hasClass("active"))w(a("#stroke_color"));else{a("#tool_stroke").addClass("active");a("#tool_fill").removeClass("active")}});a("#tool_canvas").on("click touchstart",function(){w(a("#canvas_color"))});a("#tool_stroke").on("touchstart",function(){a("#tool_stroke").addClass("active");a("#tool_fill").removeClass("active");w(a("#stroke_color"))});a("#tool_fill").on("touchstart",function(){a("#tool_fill").addClass("active");
a("#tool_stroke").removeClass("active");w(a("#fill_color"))});a("#zoom_select").on("change",function(){var k=this.options[this.selectedIndex].text;k=k.split("%")[0];a("#zoom").val(k).trigger("change")});a(".push_button").mousedown(function(){a(this).hasClass("disabled")||a(this).addClass("push_button_pressed").removeClass("push_button")}).mouseout(function(){a(this).removeClass("push_button_pressed").addClass("push_button")}).mouseup(function(){a(this).removeClass("push_button_pressed").addClass("push_button")});
a(window).bind("load resize",function(){R.css("line-height",R.height()+"px")});var A=function(){var k=a("#canvas_width"),u=a("#canvas_height"),C=k.val(),D=u.val();if(C!="fit"&&!svgedit.units.isValidUnit("width",C)){a.alert(uiStrings.notification.invalidAttrValGiven);k.parent().addClass("error");return false}k.parent().removeClass("error");if(D!="fit"&&!svgedit.units.isValidUnit("height",D)){a.alert(uiStrings.notification.invalidAttrValGiven);u.parent().addClass("error");return false}u.parent().removeClass("error");
if(!g.setResolution(C,D)){a.alert(uiStrings.notification.noContentToFitTo);C=g.getResolution();k.val(C.w);u.val(C.h);return false}F()};a("#resolution").change(function(){var k=a("#canvas_width")[0],u=a("#canvas_height")[0];if(this.selectedIndex)if(this.value=="content"){k.value="fit";u.value="fit";A();var C=g.getResolution();k.value=C.w;u.value=C.h}else{var D=this.value.split("x");D[0]=parseInt(D[0]);D[1]=parseInt(D[1]);var P=D[0]-k.value,U=D[1]-u.value,S=Date.now(),Y=function(aa){aa=(aa-S)/1E3;aa=
Math.pow(aa-1,3)+1;k.value=(D[0]-P+aa*P).toFixed(0);u.value=(D[1]-U+aa*U).toFixed(0);A();if(aa>=1){aa=g.getResolution();a("#canvas_width").val(aa.w.toFixed());a("#canvas_height").val(aa.h.toFixed());a("#resolution_label").html("<div class='pull'>"+aa.w+"<span>\u00d7</span></br>"+aa.h+"</div>")}else requestAnimationFrame(Y)};Y(Date.now())}else{a("#resolution_label").html("Custom");k.removeAttribute("readonly");k.focus();k.select();if(k.value=="fit"){k.value=100;u.value=100}}});a("#zoom").change(function(){wa(this)});
a("input,select").attr("autocomplete","off");var v=function(){var k=[{sel:"#tool_select",fn:va,evt:"click",key:["V",true]},{sel:"#tool_fhpath",fn:fb,evt:"click",key:["Q",true]},{sel:"#tool_line",fn:La,evt:"click",key:["L",true]},{sel:"#tool_rect",fn:Va,evt:"click",key:["R",true],icon:"rect"},{sel:"#tool_ellipse",fn:Ea,evt:"mouseup",key:["C",true],icon:"ellipse"},{sel:"#tool_path",fn:Cb,evt:"click",key:["P",true]},{sel:"#tool_text",fn:bb,evt:"click",key:["T",true]},{sel:"#tool_image",fn:kb,evt:"mouseup"},
{sel:"#tool_zoom",fn:sb,evt:"mouseup",key:["Z",true]},{sel:"#tool_clear",fn:Ua,evt:"mouseup",key:[o+"N",true]},{sel:"#tool_save",fn:function(){ka?Pb():g.save({images:s.img_save,round_digits:6})},evt:"mouseup",key:[o+"S",true]},{sel:"#tool_export",fn:vb,evt:"mouseup"},{sel:"#tool_open",fn:xb,evt:"mouseup"},{sel:"#tool_import",fn:Ib,evt:"mouseup"},{sel:"#tool_source",fn:Qb,evt:"click",key:[o+"U",true]},{sel:"#tool_wireframe",fn:Fb,evt:"click"},{sel:"#tool_snap",fn:Jb,evt:"click"},{sel:"#tool_rulers",
fn:Eb,evt:"click"},{sel:"#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel",fn:h,evt:"click",key:["esc",false,false],hidekey:true},{sel:"#tool_source_save",fn:Pb,evt:"click"},{sel:"#tool_delete,#tool_delete_multi",fn:ta,evt:"click",key:["del/backspace",true]},{sel:"#tool_reorient",fn:la,evt:"click"},{sel:"#tool_node_link",fn:M,evt:"click"},{sel:"#tool_node_clone",fn:Q,evt:"click"},{sel:"#tool_node_delete",fn:ea,evt:"click"},{sel:"#tool_openclose_path",fn:Pa,evt:"click"},
{sel:"#tool_add_subpath",fn:Ga,evt:"click"},{sel:"#tool_move_top",fn:ob,evt:"click",key:o+"shift+up"},{sel:"#tool_move_bottom",fn:eb,evt:"click",key:o+"shift+down"},{sel:"#tool_move_up",fn:tb,evt:"click",key:[o+"up",true]},{sel:"#tool_move_down",fn:ub,evt:"click",key:[o+"down",true]},{sel:"#tool_topath",fn:Bb,evt:"click"},{sel:"#tool_make_link,#tool_make_link_multi",fn:ca,evt:"click"},{sel:"#tool_clone,#tool_clone_multi",fn:Nb,evt:"click",key:[o+"D",true]},{sel:"#tool_group",fn:Kb,evt:"click",key:[o+
"G",true]},{sel:"#tool_ungroup",fn:Kb,evt:"click",key:o+"shift+G"},{sel:"#tool_unlink_use",fn:Kb,evt:"click"},{sel:"[id^=tool_align]",fn:Lb,evt:"click"},{sel:"#tool_undo",fn:hb,evt:"click",key:o+"z"},{sel:"#tool_redo",fn:Ja,evt:"click",key:["y",true]},{sel:"#tool_cut",fn:mb,evt:"click",key:[o+"x",true]},{sel:"#tool_copy",fn:jb,evt:"click",key:o+"c"},{sel:"#tool_paste",fn:Ab,evt:"click",key:o+"v"},{sel:"#tool_switch",fn:Ob,evt:"click",key:["x",true]},{sel:"#tool_bold",fn:rb,evt:"mousedown",key:[o+
"B",true]},{sel:"#tool_italic",fn:Qa,evt:"mousedown",key:[o+"I",true]},{sel:"#copy_save_done",fn:h,evt:"click"},{key:"ctrl+left",fn:function(){nb(0,1)}},{key:"ctrl+right",fn:function(){nb(1,1)}},{key:"ctrl+shift+left",fn:function(){nb(0,5)}},{key:"ctrl+shift+right",fn:function(){nb(1,5)}},{key:"shift+O",fn:db},{key:"shift+P",fn:Ya},{key:[o+"+",true],fn:function(){Db(2)}},{key:[o+"-",true],fn:function(){Db(0.5)}},{key:["up",true],fn:function(){ja(0,-1)}},{key:["down",true],fn:function(){ja(0,1)}},
{key:["left",true],fn:function(){ja(-1,0)}},{key:["right",true],fn:function(){ja(1,0)}},{key:"shift+up",fn:function(){ja(0,-10)}},{key:"shift+down",fn:function(){ja(0,10)}},{key:"shift+left",fn:function(){ja(-10,0)}},{key:"shift+right",fn:function(){ja(10,0)}},{key:["alt+up",true],fn:function(){g.cloneSelectedElements(0,-1)}},{key:["alt+down",true],fn:function(){g.cloneSelectedElements(0,1)}},{key:["alt+left",true],fn:function(){g.cloneSelectedElements(-1,0)}},{key:["alt+right",true],fn:function(){g.cloneSelectedElements(1,
0)}},{key:["alt+shift+up",true],fn:function(){g.cloneSelectedElements(0,-10)}},{key:["alt+shift+down",true],fn:function(){g.cloneSelectedElements(0,10)}},{key:["alt+shift+left",true],fn:function(){g.cloneSelectedElements(-10,0)}},{key:["alt+shift+right",true],fn:function(){g.cloneSelectedElements(10,0)}},{key:o+"A",fn:function(){g.selectAllInCurrentLayer()}},{key:o+"shift+z",fn:Ja},{key:"esc",fn:Rb}],u={"4/Shift+4":"#tools_rect_show","5/Shift+5":"#tools_ellipse_show"};return{setAll:function(){var C=
{};a.each(k,function(D,P){if(P.sel){var U=a(P.sel);if(U.length==0)return true;if(P.evt){if(svgedit.browser.isTouch()&&P.evt==="click")P.evt="mousedown";U[P.evt](P.fn)}if(P.parent&&a(P.parent+"_show").length!=0){var S=a(P.parent);S.length||(S=ma(P.parent.substr(1)));S.append(U);a.isArray(C[P.parent])||(C[P.parent]=[]);C[P.parent].push(P)}}if(P.key){var Y=P.fn,aa=false;if(a.isArray(P.key)){S=P.key[0];if(P.key.length>1)aa=P.key[1]}else S=P.key;S+="";svgedit.browser.isMac&&S.indexOf("+")!=-1&&S.split("+")[0]==
"ctrl"&&S.replace("ctrl","cmd");a.each(S.split("/"),function(ra,Oa){a(document).bind("keydown",Oa,function(Ba){Y();aa&&Ba.preventDefault();return false})});if(P.sel&&!P.hidekey&&U.attr("title")){var ga=U.attr("title").split("[")[0]+" ("+S+")";u[S]=P.sel;U.parents("#main_menu").length||U.attr("title",ga)}}});qa(C);a(window).bind("keydown","tab",function(D){if(pa==="canvas"){D.preventDefault();Ya()}}).bind("keydown","shift+tab",function(D){if(pa==="canvas"){D.preventDefault();db()}});a("#tool_zoom").dblclick(Za)},
setTitles:function(){a.each(u,function(C,D){var P=a(D).parents("#main_menu").length;a(D).each(function(){var U=P?a(this).text().split(" [")[0]:this.title.split(" [")[0],S="";a.each(C.split("/"),function(Y,aa){var ga=aa.split("+"),ra="";if(ga.length>1){ra=ga[0]+"+";aa=ga[1]}S+=(Y?"/":"")+ra+(uiStrings["key_"+aa]||aa)});if(P)this.lastChild.textContent=U+" ["+S+"]";else this.title=U+" ["+S+"]"})})},getButtonData:function(C){var D;a.each(k,function(P,U){if(U.sel===C)D=U});return D}}}();v.setAll();c.ready(function(){var k=
curConfig.initTool,u=a("#tools_left, #svg_editor .tools_flyout"),C=u.find("#tool_"+k);k=u.find("#"+k);(C.length?C:k.length?k:a("#tool_select")).click().mouseup();curConfig.wireframe&&a("#tool_wireframe").click();curConfig.showlayers&&toggleSidePanel();a("#rulers").toggle(!!curConfig.showRulers)});a("#canvas_height").dragInput({min:10,max:null,step:10,callback:A,cursor:false,dragAdjust:0.1});a("#canvas_width").dragInput({min:10,max:null,step:10,callback:A,cursor:false,dragAdjust:0.1});a("#rect_width").dragInput({min:1,
max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_height").dragInput({min:0,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_cx").dragInput({min:0,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_cy").dragInput({min:0,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_rx").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_ry").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});
a("#image_height").dragInput({min:0,max:null,step:1,callback:changeAttribute,cursor:false});a("#selected_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#selected_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_node_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_node_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_width").dragInput({min:null,
max:null,step:1,callback:changeAttribute,cursor:false});a("#line_x1").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_x2").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_y1").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_y2").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});
a("#path_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#g_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#g_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,
cursor:false});a("#text_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#text_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_rx").dragInput({min:0,max:100,step:1,callback:function(k){g.setRectRadius(k.value)},cursor:true});a("#stroke_width").dragInput({min:0,max:99,step:1,callback:function(k){var u=k.value;if(u==0&&X&&["line","polyline"].indexOf(X.nodeName)>=
0)u=k.value=1;g.setStrokeWidth(u)},cursor:true,smallStep:0.1,start:1.5});a("#angle").dragInput({min:-180,max:180,step:1,callback:function(k){g.setRotationAngle(k.value);rotateCursor(k.value);a("#tool_reorient").toggleClass("disabled",k.value==0)},cursor:false,dragAdjust:0.5});a("#font_size").dragInput({min:1,max:250,step:1,callback:function(k){g.setFontSize(k.value)},cursor:true,stepfunc:function(k,u){var C=k.value-0,D=C+u,P=D>=C;if(u===0)return C;return C>=24?P?Math.round(C*1.1):Math.round(C/1.1):
C<=1?P?C*2:C/2:D}});a("#group_opacity").dragInput({min:0,max:100,step:5,callback:function(k,u){if(u==null)u=k.value;a("#group_opacity").val(u);if(!k||!k.handle)a("#opac_slider").slider("option","value",u);g.setOpacity(u/100)},cursor:true,start:100});a("#blur").dragInput({min:0,max:10,step:0.1,callback:function(k){val=k.value;a("#blur").val(val);window.event.type=="mouseup"?g.setBlur(val,true):g.setBlurNoUndo(val)},cursor:true,start:0});a("#zoom").val(g.getZoom()*100);a("#workarea").contextMenu({menu:"cmenu_canvas",
inSpeed:0},function(k){switch(k){case "delete":ta();break;case "cut":mb();break;case "copy":jb();break;case "paste":g.pasteElements();break;case "paste_in_place":g.pasteElements("in_place");break;case "group":g.groupSelectedElements();break;case "ungroup":g.ungroupSelectedElement();break;case "move_front":ob();break;case "move_up":wb("Up");break;case "move_down":wb("Down");break;case "move_back":eb();break;default:svgedit.contextmenu&&svgedit.contextmenu.hasCustomHandler(k)&&svgedit.contextmenu.getCustomHandler(k).call()}});
a(".contextMenu li").mousedown(function(k){k.preventDefault()});a("#cmenu_canvas li").disableContextMenu();V.enableContextMenuItems("#delete,#cut,#copy");window.onbeforeunload=function(){if(T.getUndoStackSize()===0)c.show_save_warning=false;if(!curConfig.no_save_warning&&c.show_save_warning)return uiStrings.notification.unsavedChanges};c.openPrep=function(k){a("#main_menu").hide();T.getUndoStackSize()===0?k(true):a.confirm(uiStrings.notification.QwantToOpen,k)};if(window.FileReader){q=a('<input type="file">').change(function(){var k=
this;c.openPrep(function(u){if(u){g.clear();if(k.files.length==1){u=new FileReader;u.onloadend=function(C){p(C.target.result);F()};u.readAsText(k.files[0])}}})});a("#tool_open").show().prepend(q);q=a('<input type="file">').change(function(){a("#main_menu").hide();if(this.files.length==1){var k=new FileReader;k.onloadend=function(u){g.importSvgString(u.target.result,true);F()};k.readAsText(this.files[0])}});a("#tool_import").show().prepend(q)}for(var F=c.updateCanvas=function(k,u){var C=R.width(),
D=R.height(),P=C,U=D,S=g.getZoom(),Y=a("#svgcanvas"),aa={x:R[0].scrollLeft+P/2,y:R[0].scrollTop+U/2},ga=curConfig.canvas_expansion;C=Math.max(P,g.contentW*S*ga);D=Math.max(U,g.contentH*S*ga);C==P&&D==U?R.css("overflow","hidden"):R.css("overflow","scroll");ga=Y.height()/2;var ra=Y.width()/2;Y.width(C).height(D);var Oa=D/2,Ba=C/2,ha=g.updateCanvas(C,D),Ta=Ba/ra;C=C/2-P/2;D=D/2-U/2;if(u){u.x+=ha.x;u.y+=ha.y}else u={x:Ba+(aa.x-ra)*Ta,y:Oa+(aa.y-ga)*Ta};if(k)if(g.contentW>R.width()){R[0].scrollLeft=ha.x-
10;R[0].scrollTop=ha.y-10}else{R[0].scrollLeft=C;R[0].scrollTop=D}else{R[0].scrollLeft=u.x-P/2;R[0].scrollTop=u.y-U/2}if(curConfig.showRulers){l(Y,S);R.scroll()}},I=[],E=0.1;E<1E5;E*=10){I.push(1*E);I.push(2*E);I.push(5*E)}F(true);try{var G=function(k){if(window.JSON&&JSON.stringify)return JSON.stringify(k);var u=arguments.callee;if(typeof k=="boolean"||typeof k=="number")return k+"";else if(typeof k=="string")return'"'+k.replace(/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
function(P){return"\\u"+("0000"+P.charCodeAt(0).toString(16)).slice(-4)})+'"';else if(k.length){for(var C=0;C<k.length;C++)k[C]=u(k[C]);return"["+k.join(",")+"]"}else{C=[];for(var D in k)C.push(u(D)+":"+u(k[D]));return"{"+C.join(",")+"}"}};window.addEventListener("message",function(k){var u=parseInt(k.data.substr(0,k.data.indexOf(";")));try{k.source.postMessage("SVGe"+u+";"+G(eval(k.data)),"*")}catch(C){k.source.postMessage("SVGe"+u+";error:"+C.message,"*")}},false)}catch(L){window.embed_error=L}a(function(){window.svgCanvas=
g;g.ready=svgEditor.ready});c.setLang=function(k,u){a.pref("lang",k);a("#lang_select").val(k);if(u){g.runExtensions("langChanged",k);Aa();a.each({"#stroke_color":"#tool_stroke .icon_label, #tool_stroke .color_block","#fill_color":"#tool_fill label, #tool_fill .color_block","#linejoin_miter":"#cur_linejoin","#linecap_butt":"#cur_linecap"},function(C,D){a(D).attr("title",a(C)[0].title)});a("#multiselected_panel div[id^=tool_align]").each(function(){a("#tool_pos"+this.id.substr(10))[0].title=this.title})}}};
var f=[];c.ready=function(d){n?d():f.push(d)};c.runCallbacks=function(){a.each(f,function(){this()});n=true};c.loadFromString=function(d){c.ready(function(){p(d)})};c.loadFromURL=function(d,l){l||(l={});var q=l.cache,B=l.callback;c.ready(function(){a.ajax({url:d,dataType:"text",cache:!!q,success:function(o){p(o,B)},error:function(o,K,T){o.status!=404&&o.responseText?p(o.responseText,B):a.alert(uiStrings.notification.URLloadFail+": \n"+T+"",B)}})})};c.loadFromDataURI=function(d){c.ready(function(){var l=
d.substring(26);p(svgedit.utilities.decode64(l))})};c.addExtension=function(){var d=arguments;a(function(){g&&g.addExtension.apply(this,d)})};return c}(jQuery);$(svgEditor.init)})();$.fn.dragInput=function(a){return this.each(function(){this.repeating=false;this.dragCfg={min:a&&!isNaN(parseFloat(a.min))?Number(a.min):null,max:a&&!isNaN(parseFloat(a.max))?Number(a.max):null,step:a&&Number(a.step)?a.step:1,stepfunc:a&&a.stepfunc?a.stepfunc:false,dragAdjust:a&&a.dragAdjust?a.dragAdjust:1,height:70,cursor:a&&a.cursor?Boolean(a.cursor):false,start:a&&a.start?Number(a.start):0,_btn_width:20,_direction:null,_delay:null,_repeat:null,callback:a&&a.callback?a.callback:null};this.dragCfg.smallStep=
@ -624,7 +623,7 @@ Q)/(255-Q)*100,4):0);va.call(d,ia,Math.precision(Ga/255*100,4));va.call(d,pa,Mat
Q+"', sizingMethod='scale')"})}else M.css({backgroundImage:"url('"+Q+"')"})},Da=function(M,Q){M.css({top:Q+"px"})},va=function(M,Q){M.css({visibility:Q>0?"visible":"hidden"});if(Q>0&&Q<100)if(q){var ea=M.attr("pngSrc");ea!=null&&(ea.indexOf("AlphaBar.png")!=-1||ea.indexOf("Bars.png")!=-1||ea.indexOf("Maps.png")!=-1)?M.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ea+"', sizingMethod='scale') progid:DXImageTransform.Microsoft.Alpha(opacity="+Q+")"}):M.css({opacity:Math.precision(Q/
100,4)})}else M.css({opacity:Math.precision(Q/100,4)});else if(Q==0||Q==100)if(q){ea=M.attr("pngSrc");ea!=null&&(ea.indexOf("AlphaBar.png")!=-1||ea.indexOf("Bars.png")!=-1||ea.indexOf("Maps.png")!=-1)?M.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ea+"', sizingMethod='scale')"}):M.css({opacity:""})}else M.css({opacity:""})},fb=function(){ja.active.val("ahex",ja.current.val("ahex"))},La=function(){ja.current.val("ahex",ja.active.val("ahex"))},Va=function(M){a(this).parents("tbody:first").find('input:radio[value!="'+
M.target.value+'"]').removeAttr("checked");Na.call(d,M.target.value)},Ea=function(){fb.call(d)},kb=function(){fb.call(d);l.window.expandable&&wb.call(d);a.isFunction(tb)&&tb.call(d,ja.active,na)},sb=function(){La.call(d);l.window.expandable&&wb.call(d);a.isFunction(ob)&&ob.call(d,ja.active,ma)},Za=function(){ub.call(d)},bb=function(M){var Q=M.val("hex");qa.css({backgroundColor:Q&&"#"+Q||"transparent"});va.call(d,qa,Math.precision((M.val("a")||0)*100/255,4))},Cb=function(M){var Q=M.val("hex");M=M.val("va");
Fa.css({backgroundColor:Q&&"#"+Q||"transparent"});va.call(d,Ia,Math.precision((255-(M&&M.a||0))*100/255,4));if(l.window.bindToInput&&l.window.updateInputColor)l.window.input.css({backgroundColor:Q&&"#"+Q||"transparent",color:M==null||M.v>75?"#000000":"#ffffff"})},ua=function(M){ka=parseInt(B.css("left"));da=parseInt(B.css("top"));W=M.pageX;Z=M.pageY;a(document).bind("mousemove",mb).bind("mouseup",jb);M.preventDefault()},mb=function(M){B.css({left:ka-(W-M.pageX)+"px",top:da-(Z-M.pageY)+"px"});l.window.expandable&&
Fa.css({backgroundColor:Q&&"#"+Q||"transparent"});va.call(d,Ia,Math.precision((255-(M&&M.a||0))*100/255,4));if(l.window.bindToInput&&l.window.updateInputColor)l.window.input.css({backgroundColor:Q&&"#"+Q||"transparent",color:M==null||M.v>75?"#000000":"#ffffff"})},ta=function(M){ka=parseInt(B.css("left"));da=parseInt(B.css("top"));W=M.pageX;Z=M.pageY;a(document).bind("mousemove",mb).bind("mouseup",jb);M.preventDefault()},mb=function(M){B.css({left:ka-(W-M.pageX)+"px",top:da-(Z-M.pageY)+"px"});l.window.expandable&&
!a.support.boxModel&&B.prev().css({left:B.css("left"),top:B.css("top")});M.stopPropagation();M.preventDefault();return false},jb=function(M){a(document).unbind("mousemove",mb).unbind("mouseup",jb);M.stopPropagation();M.preventDefault();return false},Ab=function(M){M.preventDefault();M.stopPropagation();ja.active.val("ahex",a(this).attr("title")||null,M.target);return false},ob=a.isFunction(f[1])&&f[1]||null,eb=a.isFunction(f[2])&&f[2]||null,tb=a.isFunction(f[3])&&f[3]||null,ub=function(){ja.current.val("ahex",
ja.active.val("ahex"));var M=function(){if(!(!l.window.expandable||a.support.boxModel)){var Q=B.find("table:first");B.before("<iframe/>");B.prev().css({width:Q.width(),height:B.height(),opacity:0,position:"absolute",left:B.css("left"),top:B.css("top")})}};if(l.window.expandable){a(document.body).children("div.jPicker.Container").css({zIndex:10});B.css({zIndex:20})}switch(l.window.effects.type){case "fade":B.fadeIn(l.window.effects.speed.show,M);break;case "slide":B.slideDown(l.window.effects.speed.show,
M);break;default:B.show(l.window.effects.speed.show,M)}},wb=function(){var M=function(){l.window.expandable&&B.css({zIndex:10});!l.window.expandable||a.support.boxModel||B.prev().remove()};switch(l.window.effects.type){case "fade":B.fadeOut(l.window.effects.speed.hide,M);break;case "slide":B.slideUp(l.window.effects.speed.hide,M);break;default:B.hide(l.window.effects.speed.hide,M)}},Bb=function(){var M=l.window,Q=M.expandable?a(d).next().find(".Container:first"):null;B=M.expandable?a("<div/>"):a(d);
@ -643,9 +642,9 @@ M.bindToInput?M.input:null,M.alphaPrecision);Pa=ea!=null?ea.hex:null;var db=Ga.f
T,la.clientPath+"Maps.png");Sa.call(d,N,la.clientPath+"Maps.png");Sa.call(d,J,la.clientPath+"map-opacity.png");Sa.call(d,R,la.clientPath+"Bars.png");Sa.call(d,V,la.clientPath+"Bars.png");Sa.call(d,O,la.clientPath+"Bars.png");Sa.call(d,ia,la.clientPath+"Bars.png");Sa.call(d,pa,la.clientPath+"bar-opacity.png");Sa.call(d,fa,la.clientPath+"AlphaBar.png");Sa.call(d,db.find("div:last"),la.clientPath+"preview-opacity.png")},0);Ga.find("td.Radio input").bind("click touchstart",Va);if(ja.quickList&&ja.quickList.length>
0){Ya="";for(i=0;i<ja.quickList.length;i++){if((typeof ja.quickList[i]).toString().toLowerCase()=="string")ja.quickList[i]=new c({hex:ja.quickList[i]});var nb=ja.quickList[i].val("a"),Ua=ja.quickList[i].val("ahex");if(!M.alphaSupport&&Ua)Ua=Ua.substring(0,6)+"ff";var rb=ja.quickList[i].val("hex");Ya+='<span class="QuickColor"'+(Ua&&' title="#'+Ua+'"'||"")+' style="background-color:'+(rb&&"#"+rb||"")+";"+(rb?"":"background-image:url("+la.clientPath+"NoColor.png)")+(M.alphaSupport&&nb&&nb<255?";opacity:"+
Math.precision(nb/255,4)+";filter:Alpha(opacity="+Math.precision(nb/2.55,4)+")":"")+'">&nbsp;</span>'}Sa.call(d,Aa,la.clientPath+"bar-opacity.png");Aa.html(Ya);Aa.find(".QuickColor").click(Ab)}Na.call(d,l.color.mode);ja.active.bind(za);a.isFunction(eb)&&ja.active.bind(eb);ja.current.bind(bb);if(M.expandable){d.icon=Q.parents(".Icon:first");Fa=d.icon.find(".Color:first").css({backgroundColor:Pa&&"#"+Pa||"transparent"});Ia=d.icon.find(".Alpha:first");Sa.call(d,Ia,la.clientPath+"bar-opacity.png");va.call(d,
Ia,Math.precision((255-(ea!=null?ea.a:0))*100/255,4));Ca=d.icon.find(".Image:first").css({backgroundImage:"url('"+la.clientPath+la.picker.file+"')"}).bind("click",Za);if(M.bindToInput&&M.updateInputColor)M.input.css({backgroundColor:Pa&&"#"+Pa||"transparent",color:ea==null||ea.v>75?"#000000":"#ffffff"});Ka=Ga.find(".Move:first").bind("mousedown",ua);ja.active.bind(Cb)}else ub.call(d)},la=l.images,ca=l.localization,ja={active:(typeof l.color.active).toString().toLowerCase()=="string"?new c({ahex:!l.window.alphaSupport&&
Ia,Math.precision((255-(ea!=null?ea.a:0))*100/255,4));Ca=d.icon.find(".Image:first").css({backgroundImage:"url('"+la.clientPath+la.picker.file+"')"}).bind("click",Za);if(M.bindToInput&&M.updateInputColor)M.input.css({backgroundColor:Pa&&"#"+Pa||"transparent",color:ea==null||ea.v>75?"#000000":"#ffffff"});Ka=Ga.find(".Move:first").bind("mousedown",ta);ja.active.bind(Cb)}else ub.call(d)},la=l.images,ca=l.localization,ja={active:(typeof l.color.active).toString().toLowerCase()=="string"?new c({ahex:!l.window.alphaSupport&&
l.color.active?l.color.active.substring(0,6)+"ff":l.color.active}):new c({ahex:!l.window.alphaSupport&&l.color.active.val("ahex")?l.color.active.val("ahex").substring(0,6)+"ff":l.color.active.val("ahex")}),current:(typeof l.color.active).toString().toLowerCase()=="string"?new c({ahex:!l.window.alphaSupport&&l.color.active?l.color.active.substring(0,6)+"ff":l.color.active}):new c({ahex:!l.window.alphaSupport&&l.color.active.val("ahex")?l.color.active.val("ahex").substring(0,6)+"ff":l.color.active.val("ahex")}),
quickList:l.color.quickList};a.extend(true,d,{commitCallback:ob,liveCallback:eb,cancelCallback:tb,color:ja,show:ub,hide:wb,destroy:function(){B.find("td.Radio input touchstart").unbind("click",Va);qa.unbind("click touchstart",Ea);na.unbind("click touchstart",kb);ma.unbind("click touchstart",sb);if(l.window.expandable){Ca.unbind("click",Za);Ka.unbind("mousedown",ua);d.icon=null}B.find(".QuickColor").unbind("click",Ab);fa=pa=ia=O=V=R=J=N=T=K=o=null;ba.destroy();ba=null;X.destroy();X=null;sa.destroy();
quickList:l.color.quickList};a.extend(true,d,{commitCallback:ob,liveCallback:eb,cancelCallback:tb,color:ja,show:ub,hide:wb,destroy:function(){B.find("td.Radio input touchstart").unbind("click",Va);qa.unbind("click touchstart",Ea);na.unbind("click touchstart",kb);ma.unbind("click touchstart",sb);if(l.window.expandable){Ca.unbind("click",Za);Ka.unbind("mousedown",ta);d.icon=null}B.find(".QuickColor").unbind("click",Ab);fa=pa=ia=O=V=R=J=N=T=K=o=null;ba.destroy();ba=null;X.destroy();X=null;sa.destroy();
eb=tb=ob=Aa=na=ma=qa=oa=sa=null;B.html("");for(i=0;i<n.length;i++)n[i]==d&&n.splice(i,1)}});n.push(d);setTimeout(function(){Bb.call(d)},0)})};a.fn.jPicker.defaults={window:{title:null,effects:{type:"slide",speed:{show:"slow",hide:"fast"}},position:{x:"screenCenter",y:"top"},expandable:false,liveUpdate:true,alphaSupport:false,alphaPrecision:0,updateInputColor:true},color:{mode:"h",active:new c({ahex:"#ffcc00ff"}),quickList:[new c({h:360,s:33,v:100}),new c({h:360,s:66,v:100}),new c({h:360,s:100,v:100}),
new c({h:360,s:100,v:75}),new c({h:360,s:100,v:50}),new c({h:180,s:0,v:100}),new c({h:30,s:33,v:100}),new c({h:30,s:66,v:100}),new c({h:30,s:100,v:100}),new c({h:30,s:100,v:75}),new c({h:30,s:100,v:50}),new c({h:180,s:0,v:90}),new c({h:60,s:33,v:100}),new c({h:60,s:66,v:100}),new c({h:60,s:100,v:100}),new c({h:60,s:100,v:75}),new c({h:60,s:100,v:50}),new c({h:180,s:0,v:80}),new c({h:90,s:33,v:100}),new c({h:90,s:66,v:100}),new c({h:90,s:100,v:100}),new c({h:90,s:100,v:75}),new c({h:90,s:100,v:50}),
new c({h:180,s:0,v:70}),new c({h:120,s:33,v:100}),new c({h:120,s:66,v:100}),new c({h:120,s:100,v:100}),new c({h:120,s:100,v:75}),new c({h:120,s:100,v:50}),new c({h:180,s:0,v:60}),new c({h:150,s:33,v:100}),new c({h:150,s:66,v:100}),new c({h:150,s:100,v:100}),new c({h:150,s:100,v:75}),new c({h:150,s:100,v:50}),new c({h:180,s:0,v:50}),new c({h:180,s:33,v:100}),new c({h:180,s:66,v:100}),new c({h:180,s:100,v:100}),new c({h:180,s:100,v:75}),new c({h:180,s:100,v:50}),new c({h:180,s:0,v:40}),new c({h:210,

View File

@ -1014,7 +1014,6 @@
} else {
fallback_obj[id] = btn.icon;
var svgicon = btn.svgicon ? btn.svgicon : btn.id;
console.log(svgicon);
if(btn.type == 'app_menu') {
placement_obj['#' + id + ' > div'] = svgicon;
} else {
@ -1563,15 +1562,17 @@
}
menu_items[(el_name === 'g' ? 'en':'dis') + 'ableContextMenuItems']('#ungroup');
menu_items[((el_name === 'g' || !multiselected) ? 'dis':'en') + 'ableContextMenuItems']('#group');
}
} // if (elem != null)
else if (multiselected) {
if (multiselected) {
$('#multiselected_panel').show();
$('.action_multi_selected').removeClass('disabled');
menu_items
.enableContextMenuItems('#group')
.disableContextMenuItems('#ungroup');
} else {
}
if (!elem) {
menu_items.disableContextMenuItems('#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back');
}
@ -3550,7 +3551,7 @@
$('#image_y') .dragInput({ min: null, max: null, step: 1, callback: changeAttribute, cursor: false });
$('#rect_rx') .dragInput({ min: 0, max: 100, step: 1, callback: changeRectRadius, cursor: true });
$('#stroke_width') .dragInput({ min: 0, max: 99, step: 1, callback: changeStrokeWidth, cursor: true, smallStep: 0.1, start: 1.5 });
$('#angle') .dragInput({ min: -180, max: 180, step: 1, callback: changeRotationAngle, cursor: false });
$('#angle') .dragInput({ min: -180, max: 180, step: 1, callback: changeRotationAngle, cursor: false, dragAdjust: 0.5 });
$('#font_size') .dragInput({ min: 1, max: 250, step: 1, callback: changeFontSize, cursor: true, stepfunc: stepFontSize });
$('#group_opacity').dragInput({ min: 0, max: 100, step: 5, callback: changeOpacity, cursor: true, start: 100 });
$('#blur') .dragInput({ min: 0, max: 10, step: .1, callback: changeBlur, cursor: true, start: 0 });

View File

@ -42,11 +42,11 @@ ia}).data("coord","center").appendTo(da),Ha=ya.clone().text("F").css({top:Ka*ia,
1)this.value=1;if(!(ca[0]==="f"&&!jb))if(M&&ba==="radialGradient"||!M&&ba==="linearGradient")X.setAttribute(ca,this.value);var Q=M?ca[0]==="c"?ya:Ha:ca[1]==="1"?Na:za,ea=ca.indexOf("x")>=0?"left":"top";Q.css(ea,this.value*ia)}).change()});var wa,qb,$a=$("#"+o+"_jGraduate_StopSlider"),ib,Wa,Sa,Da=a("path",{d:"m9.75,-6l-19.5,19.5m0,-19.5l19.5,19.5",fill:"none",stroke:"#D00","stroke-width":5,display:"none"},Wa),va,fb=1,La=1,Va=0,Ea=Fa,kb=Ia;Wa=a("svg",{width:"100%",height:45},$a[0]);da=a("pattern",{width:16,
height:16,patternUnits:"userSpaceOnUse",id:"jGraduate_trans"},Wa);a("image",{width:16,height:16},da).setAttributeNS(p.xlink,"xlink:href",B.images.clientPath+"map-opacity.png");$(Wa).on("click touchstart",function(la){va=$a.offset();if(la.target.tagName!=="path"){var ca=la.pageX-va.left-8;ca=ca<10?10:ca>ia+10?ia+10:ca;s(ca/ia,0,0,true);la.stopPropagation()}});$(Wa).mouseover(function(){Wa.appendChild(Da)});qb=a("g",{},Wa);a("line",{x1:10,y1:15,x2:ia+10,y2:15,"stroke-width":2,stroke:"#000"},Wa);var sb=
O.find(".jGraduate_spreadMethod").change(function(){X.setAttribute("spreadMethod",$(this).val())}),Za=null,bb=function(la){var ca=la.pageX-mb.left,ja=la.pageY-mb.top;ca=ca<0?0:ca>ia?ia:ca;ja=ja<0?0:ja>ia?ia:ja;Za.css("left",ca).css("top",ja);ca=ca/pa;ja=ja/fa;var M=Za.data("coord"),Q=X;switch(M){case "start":ka.x1.val(ca);ka.y1.val(ja);Q.setAttribute("x1",ca);Q.setAttribute("y1",ja);break;case "end":ka.x2.val(ca);ka.y2.val(ja);Q.setAttribute("x2",ca);Q.setAttribute("y2",ja);break;case "center":ka.cx.val(ca);
ka.cy.val(ja);Q.setAttribute("cx",ca);Q.setAttribute("cy",ja);Ea=ca;kb=ja;d();break;case "focus":ka.fx.val(ca);ka.fy.val(ja);Q.setAttribute("fx",ca);Q.setAttribute("fy",ja);d()}la.preventDefault()},Cb=function(){Za=null;R.unbind("mousemove",bb).unbind("mouseup",Cb)};wa=X.getElementsByTagNameNS(p.svg,"stop");if(ua<2){for(;ua<2;){X.appendChild(document.createElementNS(p.svg,"stop"));++ua}wa=X.getElementsByTagNameNS(p.svg,"stop")}var ua=wa.length;for(na=0;na<ua;na++)s(0,0,0,0,wa[na]);sb.val(X.getAttribute("spreadMethod")||
ka.cy.val(ja);Q.setAttribute("cx",ca);Q.setAttribute("cy",ja);Ea=ca;kb=ja;d();break;case "focus":ka.fx.val(ca);ka.fy.val(ja);Q.setAttribute("fx",ca);Q.setAttribute("fy",ja);d()}la.preventDefault()},Cb=function(){Za=null;R.unbind("mousemove",bb).unbind("mouseup",Cb)};wa=X.getElementsByTagNameNS(p.svg,"stop");if(ta<2){for(;ta<2;){X.appendChild(document.createElementNS(p.svg,"stop"));++ta}wa=X.getElementsByTagNameNS(p.svg,"stop")}var ta=wa.length;for(na=0;na<ta;na++)s(0,0,0,0,wa[na]);sb.val(X.getAttribute("spreadMethod")||
"pad");var mb,jb=false;sa.setAttribute("fill-opacity",oa/100);$("#"+o+" div.grad_coord").mousedown(function(la){la.preventDefault();Za=$(this);Za.offset();mb=Za.parent().offset();R.mousemove(bb).mouseup(Cb)});$("#"+o+"_jGraduate_Ok").bind("click touchstart",function(){q.paint.type=ba;q.paint[ba]=X.cloneNode(true);q.paint.solidColor=null;T()});$("#"+o+"_jGraduate_Cancel").bind("click touchstart",function(){N()});if(ba==="radialGradient")if(jb)Ha.show();else{Ha.hide();ka.fx.val("");ka.fy.val("")}$("#"+
o+"_jGraduate_match_ctr")[0].checked=!jb;var Ab,ob;$("#"+o+"_jGraduate_match_ctr").change(function(){jb=!this.checked;Ha.toggle(jb);ka.fx.val("");ka.fy.val("");var la=X;if(jb){var ca=Ab||0.5,ja=ob||0.5;la.setAttribute("fx",ca);la.setAttribute("fy",ja);ka.fx.val(ca);ka.fy.val(ja)}else{Ab=la.getAttribute("fx");ob=la.getAttribute("fy");la.removeAttribute("fx");la.removeAttribute("fy")}});wa=X.getElementsByTagNameNS(p.svg,"stop");ua=wa.length;if(ua<2){for(;ua<2;){X.appendChild(document.createElementNS(p.svg,
"stop"));++ua}wa=X.getElementsByTagNameNS(p.svg,"stop")}var eb;oa=O=0;if(ba==="radialGradient"){W=X.gradientTransform.baseVal;if(W.numberOfItems===2){ua=W.getItem(0);W=W.getItem(1);if(ua.type===2&&W.type===3){ua=W.matrix;if(ua.a!==1)O=Math.round(-(1-ua.a)*100);else if(ua.d!==1)O=Math.round((1-ua.d)*100)}}else if(W.numberOfItems===3){da=W.getItem(0);ua=W.getItem(1);W=W.getItem(2);if(da.type===4&&ua.type===2&&W.type===3){oa=Math.round(da.angle);ua=W.matrix;if(ua.a!==1)O=Math.round(-(1-ua.a)*100);else if(ua.d!==
1)O=Math.round((1-ua.d)*100)}}}O={radius:{handle:"#"+o+"_jGraduate_RadiusArrows",input:"#"+o+"_jGraduate_RadiusInput",val:(X.getAttribute("r")||0.5)*100},opacity:{handle:"#"+o+"_jGraduate_OpacArrows",input:"#"+o+"_jGraduate_OpacInput",val:q.paint.alpha||100},ellip:{handle:"#"+o+"_jGraduate_EllipArrows",input:"#"+o+"_jGraduate_EllipInput",val:O},angle:{handle:"#"+o+"_jGraduate_AngleArrows",input:"#"+o+"_jGraduate_AngleInput",val:oa}};$.each(O,function(la,ca){var ja=$(ca.handle);ja.mousedown(function(M){var Q=
o+"_jGraduate_match_ctr")[0].checked=!jb;var Ab,ob;$("#"+o+"_jGraduate_match_ctr").change(function(){jb=!this.checked;Ha.toggle(jb);ka.fx.val("");ka.fy.val("");var la=X;if(jb){var ca=Ab||0.5,ja=ob||0.5;la.setAttribute("fx",ca);la.setAttribute("fy",ja);ka.fx.val(ca);ka.fy.val(ja)}else{Ab=la.getAttribute("fx");ob=la.getAttribute("fy");la.removeAttribute("fx");la.removeAttribute("fy")}});wa=X.getElementsByTagNameNS(p.svg,"stop");ta=wa.length;if(ta<2){for(;ta<2;){X.appendChild(document.createElementNS(p.svg,
"stop"));++ta}wa=X.getElementsByTagNameNS(p.svg,"stop")}var eb;oa=O=0;if(ba==="radialGradient"){W=X.gradientTransform.baseVal;if(W.numberOfItems===2){ta=W.getItem(0);W=W.getItem(1);if(ta.type===2&&W.type===3){ta=W.matrix;if(ta.a!==1)O=Math.round(-(1-ta.a)*100);else if(ta.d!==1)O=Math.round((1-ta.d)*100)}}else if(W.numberOfItems===3){da=W.getItem(0);ta=W.getItem(1);W=W.getItem(2);if(da.type===4&&ta.type===2&&W.type===3){oa=Math.round(da.angle);ta=W.matrix;if(ta.a!==1)O=Math.round(-(1-ta.a)*100);else if(ta.d!==
1)O=Math.round((1-ta.d)*100)}}}O={radius:{handle:"#"+o+"_jGraduate_RadiusArrows",input:"#"+o+"_jGraduate_RadiusInput",val:(X.getAttribute("r")||0.5)*100},opacity:{handle:"#"+o+"_jGraduate_OpacArrows",input:"#"+o+"_jGraduate_OpacInput",val:q.paint.alpha||100},ellip:{handle:"#"+o+"_jGraduate_EllipArrows",input:"#"+o+"_jGraduate_EllipInput",val:O},angle:{handle:"#"+o+"_jGraduate_AngleArrows",input:"#"+o+"_jGraduate_AngleInput",val:oa}};$.each(O,function(la,ca){var ja=$(ca.handle);ja.mousedown(function(M){var Q=
ja.parent();eb={type:la,elem:ja,input:$(ca.input),parent:Q,offset:Q.offset()};R.mousemove(tb).mouseup(ub);M.preventDefault()});$(ca.input).val(ca.val).change(function(){var M=+this.value,Q=0,ea=ba==="radialGradient";switch(la){case "radius":ea&&X.setAttribute("r",M/100);Q=Math.pow(M/100,0.4)/2*145;break;case "opacity":q.paint.alpha=M;sa.setAttribute("fill-opacity",M/100);Q=M*1.45;break;case "ellip":fb=La=1;if(M===0){Q=72.5;break}if(M>99.5)M=99.5;if(M>0)La=1-M/100;else fb=-(M/100)-1;Q=145*((M+100)/
2)/100;ea&&d();break;case "angle":Va=M;Q=Va/180;Q+=0.5;Q*=145;ea&&d()}if(Q>145)Q=145;else if(Q<0)Q=0;ja.css({"margin-left":Q-5})}).change()});var tb=function(la){var ca=la.pageX-eb.offset.left-parseInt(eb.parent.css("border-left-width"));if(ca>145)ca=145;if(ca<=0)ca=0;var ja=ca-5;ca/=145;switch(eb.type){case "radius":ca=Math.pow(ca*2,2.5);if(ca>0.98&&ca<1.02)ca=1;if(ca<=0.01)ca=0.01;X.setAttribute("r",ca);break;case "opacity":q.paint.alpha=parseInt(ca*100);sa.setAttribute("fill-opacity",ca);break;
case "ellip":La=fb=1;if(ca<0.5){ca/=0.5;fb=ca<=0?0.01:ca}else if(ca>0.5){ca/=0.5;ca=2-ca;La=ca<=0?0.01:ca}d();ca-=1;if(La===ca+1)ca=Math.abs(ca);break;case "angle":ca-=0.5;Va=ca*=180;d();ca/=100}eb.elem.css({"margin-left":ja});ca=Math.round(ca*100);eb.input.val(ca);la.preventDefault()},ub=function(){R.unbind("mousemove",tb).unbind("mouseup",ub);eb=null};for(O=(q.paint.alpha*255/100).toString(16);O.length<2;)O="0"+O;O=O.split(".")[0];J=q.paint.solidColor=="none"?"":q.paint.solidColor+O;qa||(J=wa[0].getAttribute("stop-color"));
@ -206,9 +206,9 @@ Ia=svgedit.history.MoveElementCommand,Ca=svgedit.history.InsertElementCommand,Ka
Ia.type()){m=m?h.newParent:h.oldParent;m==l&&b.identifyLayers()}else if(z==Ca.type()||z==Ka.type()){h.parent==l&&b.identifyLayers();if(z==Ca.type())m&&Wa(h.elem);else m||Wa(h.elem);h.elem.tagName==="use"&&Lb(h.elem)}else if(z==Na.type()){h.elem.tagName=="title"&&h.elem.parentNode.parentNode==l&&b.identifyLayers();m=m?h.newValues:h.oldValues;m.stdDeviation&&b.setBlurOffsets(h.elem.parentNode,m.stdDeviation);if(h.elem.tagName==="use"&&svgedit.browser.isWebkit()){z=h.elem;if(!z.getAttribute("x")&&!z.getAttribute("y")){m=
z.parentNode;var w=z.nextSibling;m.removeChild(z);m.insertBefore(z,w)}}}}}});var ya=function(e){b.undoMgr.addCommandToHistory(e)};svgedit.select.init(n,{createSVGElement:function(e){return b.addSvgElementFromJson(e)},svgRoot:function(){return d},svgContent:function(){return l},currentZoom:function(){return o},getStrokedBBox:function(e){return b.getStrokedBBox([e])}});var Ha=this.selectorManager=svgedit.select.getSelectorManager();svgedit.path.init({getCurrentZoom:function(){return o},getSVGRoot:function(){return d}});
svgedit.utilities.snapToGrid=function(e){var h=n.snappingStep,m=n.baseUnit;if(m!=="px")h*=svgedit.units.getTypeMap()[m];return e=Math.round(e/h)*h};var wa=svgedit.utilities.snapToGrid,qb={exportNoBlur:"Blurred elements will appear as un-blurred",exportNoforeignObject:"foreignObject elements will not appear",exportNoDashArray:"Strokes will appear filled",exportNoText:"Text may not appear as expected"},$a=["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"],ib=$.data,
Wa=function(e){var h=$(e).attr($a),m;for(m in h){var z=h[m];if(z&&z.indexOf("url(")===0){z=ka(z).substr(1);if(!qa(z)){lb().appendChild(Ab[z]);delete Ab[z]}}}e=e.getElementsByTagName("*");if(e.length){h=0;for(m=e.length;h<m;h++)Wa(e[h])}},Sa={},Da=n.imgPath+"logo.png",va=[],fb={round_digits:5},La=false,Va=null,Ea="select",kb="none",sb={},Za=T.text,bb=N,Cb=null,ua=null,mb=[],jb={},Ab={};b.clipBoard=[];var ob=this.runExtensions=function(e,h,m){var z=false;if(m)z=[];$.each(jb,function(w,H){if(e in H)if(m)z.push(H[e](h));
else z=H[e](h)});return z};this.addExtension=function(e,h){if(e in jb)console.log('Cannot add extension "'+e+'", an extension by that name already exists"');else{var m=$.isFunction(h)?h($.extend(b.getPrivateMethods(),{svgroot:d,svgcontent:l,nonce:B().getNonce(),selectorManager:Ha})):h;jb[e]=m;M("extension_added",m)}};var eb=this.round=function(e){return parseInt(e*o)/o},tb=this.getIntersectionList=function(e){if(ua==null)return null;var h=K||B().getCurrentLayer();mb.length||(mb=wb(h));var m=null;
try{m=h.getIntersectionList(e,null)}catch(z){}if(m==null||typeof m.item!="function"){m=[];if(e)e=e;else{e=ua.getBBox();h={};for(var w in e)h[w]=e[w]/o;e=h}for(w=mb.length;w--;)e.width&&e.width&&svgedit.math.rectsIntersect(e,mb[w].bbox)&&m.push(mb[w].elem)}return m};getStrokedBBox=this.getStrokedBBox=function(e){e||(e=ub());if(!e.length)return false;var h=function(I){try{var E=svgedit.utilities.getBBox(I),G=svgedit.utilities.getRotationAngle(I);if(G&&G%90||svgedit.math.hasMatrixTransform(svgedit.transformlist.getTransformList(I))){G=
Wa=function(e){var h=$(e).attr($a),m;for(m in h){var z=h[m];if(z&&z.indexOf("url(")===0){z=ka(z).substr(1);if(!qa(z)){lb().appendChild(Ab[z]);delete Ab[z]}}}e=e.getElementsByTagName("*");if(e.length){h=0;for(m=e.length;h<m;h++)Wa(e[h])}},Sa={},Da=n.imgPath+"logo.png",va=[],fb={round_digits:5},La=false,Va=null,Ea="select",kb="none",sb={},Za=T.text,bb=N,Cb=null,ta=null,mb=[],jb={},Ab={};b.clipBoard=[];var ob=this.runExtensions=function(e,h,m){var z=false;if(m)z=[];$.each(jb,function(w,H){if(e in H)if(m)z.push(H[e](h));
else z=H[e](h)});return z};this.addExtension=function(e,h){if(e in jb)console.log('Cannot add extension "'+e+'", an extension by that name already exists"');else{var m=$.isFunction(h)?h($.extend(b.getPrivateMethods(),{svgroot:d,svgcontent:l,nonce:B().getNonce(),selectorManager:Ha})):h;jb[e]=m;M("extension_added",m)}};var eb=this.round=function(e){return parseInt(e*o)/o},tb=this.getIntersectionList=function(e){if(ta==null)return null;var h=K||B().getCurrentLayer();mb.length||(mb=wb(h));var m=null;
try{m=h.getIntersectionList(e,null)}catch(z){}if(m==null||typeof m.item!="function"){m=[];if(e)e=e;else{e=ta.getBBox();h={};for(var w in e)h[w]=e[w]/o;e=h}for(w=mb.length;w--;)e.width&&e.width&&svgedit.math.rectsIntersect(e,mb[w].bbox)&&m.push(mb[w].elem)}return m};getStrokedBBox=this.getStrokedBBox=function(e){e||(e=ub());if(!e.length)return false;var h=function(I){try{var E=svgedit.utilities.getBBox(I),G=svgedit.utilities.getRotationAngle(I);if(G&&G%90||svgedit.math.hasMatrixTransform(svgedit.transformlist.getTransformList(I))){G=
false;if(["ellipse","path","line","polyline","polygon"].indexOf(I.tagName)>=0)E=G=b.convertToPath(I,true);else if(I.tagName=="rect"){var L=I.getAttribute("rx"),k=I.getAttribute("ry");if(L||k)E=G=b.convertToPath(I,true)}if(!G){var u=I.cloneNode(true),C=document.createElementNS(c,"g"),D=I.parentNode;D.appendChild(C);C.appendChild(u);E=svgedit.utilities.bboxToObj(C.getBBox());D.removeChild(C)}}return E}catch(P){console.log(I,P);return null}},m;$.each(e,function(){if(!m)if(this.parentNode)m=h(this)});
if(m==null)return null;var z=m.x+m.width,w=m.y+m.height,H=m.x,A=m.y,v=function(I){var E=I.getAttribute("stroke-width"),G=0;if(I.getAttribute("stroke")!="none"&&!isNaN(E))G+=E/2;return G},F=[];$.each(e,function(I,E){var G=h(E);if(G){var L=v(E);H=Math.min(H,G.x-L);A=Math.min(A,G.y-L);F.push(G)}});m.x=H;m.y=A;$.each(e,function(I,E){var G=F[I];if(G&&E.nodeType==1){var L=v(E);z=Math.max(z,G.x+G.width+L);w=Math.max(w,G.y+G.height+L)}});m.width=z-H;m.height=w-A;return m};var ub=this.getVisibleElements=function(e){e||
(e=$(l).children());e.find("#canvas_background").length&&e.splice(0,1);var h=[];$(e).children().each(function(m,z){try{z.getBBox()&&h.push(z)}catch(w){}});return h.reverse()},wb=this.getVisibleElementsAndBBoxes=function(e){e||(e=$(l).children());var h=[];$(e).children().each(function(m,z){try{z.getBBox()&&h.push({elem:z,bbox:getStrokedBBox([z])})}catch(w){}});return h.reverse()},Bb=this.groupSvgElem=function(e){var h=document.createElementNS(c,"g");e.parentNode.replaceChild(h,e);$(h).append(e).data("gsvg",
@ -244,25 +244,25 @@ J)},vb=this.addToSelection=function(e,h){if(e.length!=0){for(var m=0;m<J.length;
null)return null;e=e.target;if(e.correspondingUseElement)e=e.correspondingUseElement;if(["http://www.w3.org/1998/Math/MathML","http://www.w3.org/1999/xhtml"].indexOf(e.namespaceURI)>=0&&e.id!="svgcanvas")for(;e.nodeName!="foreignObject";){e=e.parentNode;if(!e)return d}var h=B().getCurrentLayer();if([d,a,l,h].indexOf(e)>=0)return d;if($(e).closest("#selectorParentGroup").length)return Ha.selectorParentGroup;for(;e.parentNode!==(K||h);)e=e.parentNode;return e};(function(){var e=null,h=null,m=null,z=
null,w=null,H={},A={minx:null,miny:null,maxx:null,maxy:null};$(a).mousedown(function(v){if(!(v.originalEvent.touches&&v.originalEvent.touches>1)){var F=v.button===2;rb=l.getScreenCTM().inverse();isBotchedZoom=svgedit.browser.isGecko();var I=O(v.pageX,v.pageY,rb),E=I.x*(isBotchedZoom?1:o);I=I.y*(isBotchedZoom?1:o);v.preventDefault();if(F)Ea="select";E=E/o;I=I/o;var G=Ib(v);if(G.tagName==="a"&&G.childNodes.length===1)G=G.firstChild;var L=z=h=E,k=w=m=I;if(n.gridSnapping){E=wa(E);I=wa(I);h=wa(h);m=wa(m)}if(G==
Ha.selectorParentGroup&&J[0]!=null){G=v.target;var u=ib(G,"type");if(u=="rotate"){Ea="rotate";current_rotate_mode=ib(G,"dir")}else if(u=="resize"){Ea="resize";kb=ib(G,"dir")}G=J[0]}Va=G.getAttribute("transform");u=V(G);switch(Ea){case "select":La=true;kb="none";if(F)La=false;if(G!=d){if(J.indexOf(G)==-1){v.shiftKey||Qa(true);vb([G]);Cb=G;Ja.clear()}if(!F)for(F=0;F<J.length;++F)if(J[F]!=null){var C=V(J[F]);C.numberOfItems?C.insertItemBefore(d.createSVGTransform(),0):C.appendItem(d.createSVGTransform())}}else if(!F){Qa();
Ea="multiselect";if(ua==null)ua=Ha.getRubberBandBox();z*=o;w*=o;ma(ua,{x:z,y:w,width:0,height:0,display:"inline"},100)}break;case "zoom":La=true;if(ua==null)ua=Ha.getRubberBandBox();ma(ua,{x:L*o,y:L*o,width:0,height:0,display:"inline"},100);break;case "resize":La=true;h=E;m=I;H=svgedit.utilities.getBBox($("#selectedBox0")[0]);var D={};$.each(H,function(P,U){D[P]=U/o});H=D;F=oa(G)?1:0;if(pa(u)){u.insertItemBefore(d.createSVGTransform(),F);u.insertItemBefore(d.createSVGTransform(),F);u.insertItemBefore(d.createSVGTransform(),
Ea="multiselect";if(ta==null)ta=Ha.getRubberBandBox();z*=o;w*=o;ma(ta,{x:z,y:w,width:0,height:0,display:"inline"},100)}break;case "zoom":La=true;if(ta==null)ta=Ha.getRubberBandBox();ma(ta,{x:L*o,y:L*o,width:0,height:0,display:"inline"},100);break;case "resize":La=true;h=E;m=I;H=svgedit.utilities.getBBox($("#selectedBox0")[0]);var D={};$.each(H,function(P,U){D[P]=U/o});H=D;F=oa(G)?1:0;if(pa(u)){u.insertItemBefore(d.createSVGTransform(),F);u.insertItemBefore(d.createSVGTransform(),F);u.insertItemBefore(d.createSVGTransform(),
F)}else{u.appendItem(d.createSVGTransform());u.appendItem(d.createSVGTransform());u.appendItem(d.createSVGTransform());if(svgedit.browser.supportsNonScalingStroke()){if(E=svgedit.browser.isChrome())C=function(P){var U=P.getAttributeNS(null,"stroke");P.removeAttributeNS(null,"stroke");setTimeout(function(){P.setAttributeNS(null,"stroke",U)},1)};G.style.vectorEffect="non-scaling-stroke";E&&C(G);I=G.getElementsByTagName("*");L=I.length;for(F=0;F<L;F++){I[F].style.vectorEffect="non-scaling-stroke";E&&
C(I[F])}}}break;case "fhellipse":case "fhrect":case "fhpath":La=true;e=L+","+k+" ";C=N.stroke_width==0?1:N.stroke_width;R({element:"polyline",curStyles:true,attr:{points:e,id:ja(),fill:"none",opacity:N.opacity/2,"stroke-linecap":"round",style:"pointer-events:none"}});A.minx=L;A.maxx=L;A.miny=k;A.maxy=k;break;case "image":La=true;C=R({element:"image",attr:{x:E,y:I,width:0,height:0,id:ja(),opacity:N.opacity/2,style:"pointer-events:inherit"}});W(C,Da);pb(C);break;case "square":case "rect":La=true;h=
E;m=I;R({element:"rect",curStyles:true,attr:{x:E,y:I,width:0,height:0,id:ja(),opacity:N.opacity/2}});break;case "line":La=true;C=N.stroke_width==0?1:N.stroke_width;R({element:"line",curStyles:true,attr:{x1:E,y1:I,x2:E,y2:I,id:ja(),stroke:N.stroke,"stroke-width":C,"stroke-dasharray":N.stroke_dasharray,"stroke-linejoin":N.stroke_linejoin,"stroke-linecap":N.stroke_linecap,"stroke-opacity":N.stroke_opacity,fill:"none",opacity:N.opacity/2,style:"pointer-events:none"}});break;case "circle":La=true;R({element:"circle",
curStyles:true,attr:{cx:E,cy:I,r:0,id:ja(),opacity:N.opacity/2}});break;case "ellipse":La=true;R({element:"ellipse",curStyles:true,attr:{cx:E,cy:I,rx:0,ry:0,id:ja(),opacity:N.opacity/2}});break;case "text":La=true;R({element:"text",curStyles:true,attr:{x:E,y:I,id:ja(),fill:Za.fill,"stroke-width":Za.stroke_width,"font-size":Za.font_size,"font-family":Za.font_family,"text-anchor":"left","xml:space":"preserve",opacity:N.opacity}});break;case "path":case "pathedit":h*=o;m*=o;Ja.mouseDown(v,G,h,m);La=
true;break;case "textedit":h*=o;m*=o;hb.mouseDown(v,G,h,m);La=true;break;case "rotate":La=true;b.undoMgr.beginUndoableChange("transform",J);document.getElementById("workarea").className="rotate"}C=ob("mouseDown",{event:v,start_x:h,start_y:m,selectedElements:J},true);$.each(C,function(P,U){if(U&&U.started)La=true});if(Ea)document.getElementById("workarea").className=Ea=="resize"?v.target.style.cursor:Ea}}).mousemove(function(v){if(!(v.originalEvent.touches&&v.originalEvent.touches.length>1))if(La)if(!(v.button===
1||b.spaceKey)){var F=J[0],I=O(v.pageX,v.pageY,rb),E=I.x*(isBotchedZoom?1:o);I=I.y*(isBotchedZoom?1:o);var G=qa(ca()),L=x=E/o,k=y=I/o;if(n.gridSnapping){x=wa(x);y=wa(y)}v.preventDefault();switch(Ea){case "select":if(J[0]!==null){L=x-h;var u=y-m;if(n.gridSnapping){L=wa(L);u=wa(u)}if(v.shiftKey){var C=ba(h,m,x,y);x=C.x;y=C.y}if(L!=0||u!=0){C=J.length;for(k=0;k<C;++k){F=J[k];if(F==null)break;var D=d.createSVGTransform();G=V(F);D.setTranslate(L,u);G.numberOfItems?G.replaceItem(D,0):G.appendItem(D);Ha.requestSelector(F).resize()}if(v.altKey)if(!b.addClones){b.addClones=
b.cloneSelectedElements(0,0,D);b.removeClones=function(){b.addClones&&b.addClones.forEach(function(Oa){Oa.parentNode&&Oa.parentNode.removeChild(Oa);b.addClones=false})};window.addEventListener("keyup",b.removeClones)}M("transition",J)}}break;case "multiselect":L*=o;k*=o;ma(ua,{x:Math.min(z,L),y:Math.min(w,k),width:Math.abs(L-z),height:Math.abs(k-w)},100);G=[];L=[];D=tb();C=J.length;for(k=0;k<C;++k){u=D.indexOf(J[k]);if(u==-1)G.push(J[k]);else D[u]=null}C=D.length;for(k=0;k<C;++k)D[k]&&L.push(D[k]);
b.cloneSelectedElements(0,0,D);b.removeClones=function(){b.addClones&&b.addClones.forEach(function(Oa){Oa.parentNode&&Oa.parentNode.removeChild(Oa);b.addClones=false})};window.addEventListener("keyup",b.removeClones)}M("transition",J)}}break;case "multiselect":L*=o;k*=o;ma(ta,{x:Math.min(z,L),y:Math.min(w,k),width:Math.abs(L-z),height:Math.abs(k-w)},100);G=[];L=[];D=tb();C=J.length;for(k=0;k<C;++k){u=D.indexOf(J[k]);if(u==-1)G.push(J[k]);else D[u]=null}C=D.length;for(k=0;k<C;++k)D[k]&&L.push(D[k]);
G.length>0&&b.removeFromSelection(G);L.length>0&&vb(L);break;case "resize":G=V(F);L=(D=pa(G))?H:svgedit.utilities.getBBox(F);C=L.x;k=L.y;var P=L.width,U=L.height;L=x-h;u=y-m;if(n.gridSnapping){L=wa(L);u=wa(u);U=wa(U);P=wa(P)}var S=oa(F);if(S){var Y=Math.sqrt(L*L+u*u);u=Math.atan2(u,L)-S*Math.PI/180;L=Y*Math.cos(u);u=Y*Math.sin(u)}if(kb.indexOf("n")==-1&&kb.indexOf("s")==-1)u=0;if(kb.indexOf("e")==-1&&kb.indexOf("w")==-1)L=0;var aa=Y=0,ga=U?(U+u)/U:1,ra=P?(P+L)/P:1;if(kb.indexOf("n")>=0){ga=U?(U-u)/
U:1;aa=U}if(kb.indexOf("w")>=0){ra=P?(P-L)/P:1;Y=P}L=d.createSVGTransform();u=d.createSVGTransform();P=d.createSVGTransform();if(n.gridSnapping){C=wa(C);Y=wa(Y);k=wa(k);aa=wa(aa)}L.setTranslate(-(C+Y),-(k+aa));if(v.shiftKey)if(ra==1)ra=ga;else ga=ra;u.setScale(ra,ga);P.setTranslate(C+Y,k+aa);if(D){D=S?1:0;G.replaceItem(L,2+D);G.replaceItem(u,1+D);G.replaceItem(P,0+D)}else{D=G.numberOfItems;G.replaceItem(P,D-3);G.replaceItem(u,D-2);G.replaceItem(L,D-1)}Ha.requestSelector(F).resize();M("transition",
J);break;case "zoom":L*=o;k*=o;ma(ua,{x:Math.min(z*o,L),y:Math.min(w*o,k),width:Math.abs(L-z*o),height:Math.abs(k-w*o)},100);break;case "text":ma(G,{x:x,y:y},1E3);break;case "line":L=null;window.opera||d.suspendRedraw(1E3);if(n.gridSnapping){x=wa(x);y=wa(y)}D=x;C=y;if(v.shiftKey){C=ba(h,m,D,C);D=C.x;C=C.y}G.setAttributeNS(null,"x2",D);G.setAttributeNS(null,"y2",C);window.opera||d.unsuspendRedraw(L);break;case "foreignObject":case "square":case "rect":case "image":L=Math.abs(x-h);D=Math.abs(y-m);if(Ea==
J);break;case "zoom":L*=o;k*=o;ma(ta,{x:Math.min(z*o,L),y:Math.min(w*o,k),width:Math.abs(L-z*o),height:Math.abs(k-w*o)},100);break;case "text":ma(G,{x:x,y:y},1E3);break;case "line":L=null;window.opera||d.suspendRedraw(1E3);if(n.gridSnapping){x=wa(x);y=wa(y)}D=x;C=y;if(v.shiftKey){C=ba(h,m,D,C);D=C.x;C=C.y}G.setAttributeNS(null,"x2",D);G.setAttributeNS(null,"y2",C);window.opera||d.unsuspendRedraw(L);break;case "foreignObject":case "square":case "rect":case "image":L=Math.abs(x-h);D=Math.abs(y-m);if(Ea==
"square"||v.shiftKey){L=D=Math.max(L,D);C=h<x?h:h-L;k=m<y?m:m-D}else{C=Math.min(h,x);k=Math.min(m,y)}if(v.altKey){L*=2;D*=2;C=h-L/2;k=m-D/2}if(n.gridSnapping){L=wa(L);D=wa(D);C=wa(C);k=wa(k)}ma(G,{width:L,height:D,x:C,y:k},1E3);break;case "circle":L=$(G).attr(["cx","cy"]);D=L.cx;C=L.cy;L=Math.sqrt((x-D)*(x-D)+(y-C)*(y-C));if(n.gridSnapping)L=wa(L);G.setAttributeNS(null,"r",L);break;case "ellipse":L=$(G).attr(["cx","cy"]);D=Math.abs(h+(x-h)/2);C=Math.abs(m+(y-m)/2);L=null;window.opera||d.suspendRedraw(1E3);
if(n.gridSnapping){x=wa(x);D=wa(D);y=wa(y);C=wa(C)}k=Math.abs(h-D);u=Math.abs(m-C);if(v.shiftKey){u=k;C=y>m?m+k:m-k}if(v.altKey){D=h;C=m;k=Math.abs(x-D);u=v.shiftKey?k:Math.abs(y-C)}G.setAttributeNS(null,"rx",k);G.setAttributeNS(null,"ry",u);G.setAttributeNS(null,"cx",D);G.setAttributeNS(null,"cy",C);window.opera||d.unsuspendRedraw(L);break;case "fhellipse":case "fhrect":A.minx=Math.min(L,A.minx);A.maxx=Math.max(L,A.maxx);A.miny=Math.min(k,A.miny);A.maxy=Math.max(k,A.maxy);case "fhpath":e+=+L+","+
k+" ";G.setAttributeNS(null,"points",e);break;case "path":case "pathedit":x*=o;y*=o;if(n.gridSnapping){x=wa(x);y=wa(y);h=wa(h);m=wa(m)}if(v.shiftKey){if(D=svgedit.path.path){G=D.dragging?D.dragging[0]:h;D=D.dragging?D.dragging[1]:m}else{G=h;D=m}C=ba(G,D,x,y);x=C.x;y=C.y}if(ua&&ua.getAttribute("display")!=="none"){L*=o;k*=o;ma(ua,{x:Math.min(z*o,L),y:Math.min(w*o,k),width:Math.abs(L-z*o),height:Math.abs(k-w*o)},100)}Ja.mouseMove(v,x,y);break;case "textedit":x*=o;y*=o;hb.mouseMove(E,I);break;case "rotate":L=
k+" ";G.setAttributeNS(null,"points",e);break;case "path":case "pathedit":x*=o;y*=o;if(n.gridSnapping){x=wa(x);y=wa(y);h=wa(h);m=wa(m)}if(v.shiftKey){if(D=svgedit.path.path){G=D.dragging?D.dragging[0]:h;D=D.dragging?D.dragging[1]:m}else{G=h;D=m}C=ba(G,D,x,y);x=C.x;y=C.y}if(ta&&ta.getAttribute("display")!=="none"){L*=o;k*=o;ma(ta,{x:Math.min(z*o,L),y:Math.min(w*o,k),width:Math.abs(L-z*o),height:Math.abs(k-w*o)},100)}Ja.mouseMove(v,x,y);break;case "textedit":x*=o;y*=o;hb.mouseMove(E,I);break;case "rotate":L=
svgedit.utilities.getBBox(F);D=L.x+L.width/2;C=L.y+L.height/2;G=X(F);G=O(D,C,G);D=G.x;C=G.y;G=L.x;k=L.y;if(current_rotate_mode=="nw")G=L.x+L.width;if(current_rotate_mode=="se")k=L.y+L.height;if(current_rotate_mode=="sw"){G=L.x+L.width;k=L.y+L.height}compensation_angle=(Math.atan2(C-k,D-G)*(180/Math.PI)-90)%360;S=(Math.atan2(C-y,D-x)*(180/Math.PI)-90)%360;S+=compensation_angle;if(n.gridSnapping)S=wa(S);if(v.shiftKey)S=Math.round(S/45)*45;b.setRotationAngle(S<-180?360+S:S,true);M("transition",J)}ob("mouseMove",
{event:v,mouse_x:E,mouse_y:I,selected:F})}}).click(function(v){v.preventDefault();return false}).dblclick(function(v){var F=v.target.parentNode;if(F!==K){var I=Ib(v),E=I.tagName;if(E==="text"&&Ea!=="textedit"){v=O(v.pageX,v.pageY,rb);hb.select(I,v.x,v.y)}if((E==="g"||E==="a")&&oa(I)){Mb(I);I=J[0];Qa(true)}K&&Jb();F.tagName!=="g"&&F.tagName!=="a"||F===B().getCurrentLayer()||I===Ha.selectorParentGroup||Rb(I)}}).mouseup(function(v){b.addClones=false;window.removeEventListener("keyup",b.removeClones);
if(v.button!==2){var F=Cb;Cb=null;if(La){var I=O(v.pageX,v.pageY,rb),E=I.x*o;I=I.y*o;var G=E/o,L=I/o,k=qa(ca()),u=false;La=false;switch(Ea){case "resize":case "multiselect":if(ua!=null){ua.setAttribute("display","none");mb=[]}Ea="select";case "select":if(J[0]!=null){if(J[1]==null){E=J[0];switch(E.tagName){case "g":case "use":case "image":case "foreignObject":break;default:bb.fill=E.getAttribute("fill");bb.fill_opacity=E.getAttribute("fill-opacity");bb.stroke=E.getAttribute("stroke");bb.stroke_opacity=
if(v.button!==2){var F=Cb;Cb=null;if(La){var I=O(v.pageX,v.pageY,rb),E=I.x*o;I=I.y*o;var G=E/o,L=I/o,k=qa(ca()),u=false;La=false;switch(Ea){case "resize":case "multiselect":if(ta!=null){ta.setAttribute("display","none");mb=[]}Ea="select";case "select":if(J[0]!=null){if(J[1]==null){E=J[0];switch(E.tagName){case "g":case "use":case "image":case "foreignObject":break;default:bb.fill=E.getAttribute("fill");bb.fill_opacity=E.getAttribute("fill-opacity");bb.stroke=E.getAttribute("stroke");bb.stroke_opacity=
E.getAttribute("stroke-opacity");bb.stroke_width=E.getAttribute("stroke-width");bb.stroke_dasharray=E.getAttribute("stroke-dasharray");bb.stroke_linejoin=E.getAttribute("stroke-linejoin");bb.stroke_linecap=E.getAttribute("stroke-linecap")}if(E.tagName=="text"){Za.font_size=E.getAttribute("font-size");Za.font_family=E.getAttribute("font-family")}Ha.requestSelector(E).showGrips(true)}Ga();if(G!=z||L!=w){v=J.length;for(E=0;E<v;++E){if(J[E]==null)break;J[E].firstChild||Ha.requestSelector(J[E]).resize()}}else{E=
v.target;if(J[0].nodeName==="path"&&J[1]==null)Ja.select(J[0]);else v.shiftKey&&F!=E&&b.removeFromSelection([E])}if(svgedit.browser.supportsNonScalingStroke())if(v=J[0]){v.removeAttribute("style");svgedit.utilities.walkTree(v,function(P){P.removeAttribute("style")})}}return;case "zoom":ua!=null&&ua.setAttribute("display","none");M("zoomed",{x:Math.min(z,G),y:Math.min(w,L),width:Math.abs(G-z),height:Math.abs(L-w),factor:v.altKey?0.5:2});return;case "fhpath":F=k.getAttribute("points");G=F.indexOf(",");
v.target;if(J[0].nodeName==="path"&&J[1]==null)Ja.select(J[0]);else v.shiftKey&&F!=E&&b.removeFromSelection([E])}if(svgedit.browser.supportsNonScalingStroke())if(v=J[0]){v.removeAttribute("style");svgedit.utilities.walkTree(v,function(P){P.removeAttribute("style")})}}return;case "zoom":ta!=null&&ta.setAttribute("display","none");M("zoomed",{x:Math.min(z,G),y:Math.min(w,L),width:Math.abs(G-z),height:Math.abs(L-w),factor:v.altKey?0.5:2});return;case "fhpath":F=k.getAttribute("points");G=F.indexOf(",");
if(u=G>=0?F.indexOf(",",G+1)>=0:F.indexOf(" ",F.indexOf(" ")+1)>=0)k=Ja.smoothPolylineIntoPath(k);break;case "line":F=$(k).attr(["x1","x2","y1","y2"]);u=F.x1!=F.x2||F.y1!=F.y2;break;case "foreignObject":case "square":case "rect":case "image":F=$(k).attr(["width","height"]);u=F.width!=0||F.height!=0||Ea==="image";break;case "circle":u=k.getAttribute("r")!=0;break;case "ellipse":F=$(k).attr(["rx","ry"]);u=F.rx!=null||F.ry!=null;break;case "fhellipse":if(A.maxx-A.minx>0&&A.maxy-A.miny>0){k=R({element:"ellipse",
curStyles:true,attr:{cx:(A.minx+A.maxx)/2,cy:(A.miny+A.maxy)/2,rx:(A.maxx-A.minx)/2,ry:(A.maxy-A.miny)/2,id:ca()}});M("changed",[k]);u=true}break;case "fhrect":if(A.maxx-A.minx>0&&A.maxy-A.miny>0){k=R({element:"rect",curStyles:true,attr:{x:A.minx,y:A.miny,width:A.maxx-A.minx,height:A.maxy-A.miny,id:ca()}});M("changed",[k]);u=true}break;case "text":u=true;xb([k]);hb.start(k);break;case "path":k=null;La=true;F=Ja.mouseUp(v,k,E,I);k=F.element;u=F.keep;break;case "pathedit":u=true;k=null;Ja.mouseUp(v);
break;case "textedit":u=false;k=null;hb.mouseUp(v,E,I);break;case "rotate":u=true;k=null;Ea="select";F=b.undoMgr.finishUndoableChange();F.isEmpty()||ya(F);Ga();M("changed",J)}E=ob("mouseUp",{event:v,mouse_x:E,mouse_y:I},true);$.each(E,function(P,U){if(U){u=U.keep||u;k=U.element;La=U.started||La}});if(!u&&k!=null){B().releaseId(ca());k.parentNode.removeChild(k);k=null;for(E=v.target;E.parentNode.parentNode.tagName=="g";)E=E.parentNode;if((Ea!="path"||!drawn_path)&&E.parentNode.id!="selectorParentGroup"&&
@ -281,12 +281,12 @@ fill:"none"});F=qa("selectorParentGroup").appendChild(F)}F.setAttribute("display
I,v);I=w.createSVGPathSegClosePath();E.appendItem(A);E.appendItem(I)}else if(C<3)return E=false;$(F).remove();element=L;w=null;La=false;if(e){svgedit.path.path.matrix&&db(L,{},svgedit.path.path.matrix.inverse());F=L.getAttribute("d");A=$(svgedit.path.path.elem).attr("d");$(svgedit.path.path.elem).attr("d",A+F);$(L).remove();svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath();svgedit.path.path.init();Ja.toEditMode(svgedit.path.path.elem);svgedit.path.path.selectPt();return false}}else{if(!$.contains(a,
Ib(A))){console.log("Clicked outside canvas");return false}E=w.pathSegList.numberOfItems;G=w.pathSegList.getItem(E-1);L=G.x;G=G.y;if(A.shiftKey){A=ba(L,G,I,v);I=A.x;v=A.y}A=F.pathSegList.getItem(1);A=A.pathSegType===4?w.createSVGPathSegLinetoAbs(eb(I),eb(v)):w.createSVGPathSegCurvetoCubicAbs(eb(I),eb(v),A.x1/o,A.y1/o,A.x2/o,A.y2/o);w.pathSegList.appendItem(A);I*=o;v*=o;F.setAttribute("d",["M",I,v,I,v].join(" "));F=E;if(e)F+=svgedit.path.path.segs.length;svgedit.path.addPointGrip(F,I,v)}}else{d_attr=
"M"+I+","+v+" ";w=R({element:"path",curStyles:true,attr:{d:d_attr,id:ja(),opacity:N.opacity/2}});F.setAttribute("d",["M",mouse_x,mouse_y,mouse_x,mouse_y].join(" "));F=e?svgedit.path.path.segs.length:0;svgedit.path.addPointGrip(F,mouse_x,mouse_y)}}else if(svgedit.path.path){svgedit.path.path.storeD();L=A.target.id;if(L.substr(0,14)=="pathpointgrip_"){v=svgedit.path.path.cur_pt=parseInt(L.substr(14));svgedit.path.path.dragging=[F,I];E=svgedit.path.path.segs[v];if(A.shiftKey)E.selected?svgedit.path.path.removePtFromSelection(v):
svgedit.path.path.addPtsToSelection(v);else{if(svgedit.path.path.selected_pts.length<=1||!E.selected)svgedit.path.path.clearSelection();svgedit.path.path.addPtsToSelection(v)}}else if(L.indexOf("ctrlpointgrip_")==0){svgedit.path.path.dragging=[F,I];A=L.split("_")[1].split("c");v=A[0]-0;svgedit.path.path.selectPt(v,A[1]-0)}if(!svgedit.path.path.dragging){if(ua==null)ua=Ha.getRubberBandBox();ma(ua,{x:F*o,y:I*o,width:0,height:0,display:"inline"},100)}}},mouseMove:function(A,v,F){H=true;if(Ea==="path"){if(w){var I=
svgedit.path.path.addPtsToSelection(v);else{if(svgedit.path.path.selected_pts.length<=1||!E.selected)svgedit.path.path.clearSelection();svgedit.path.path.addPtsToSelection(v)}}else if(L.indexOf("ctrlpointgrip_")==0){svgedit.path.path.dragging=[F,I];A=L.split("_")[1].split("c");v=A[0]-0;svgedit.path.path.selectPt(v,A[1]-0)}if(!svgedit.path.path.dragging){if(ta==null)ta=Ha.getRubberBandBox();ma(ta,{x:F*o,y:I*o,width:0,height:0,display:"inline"},100)}}},mouseMove:function(A,v,F){H=true;if(Ea==="path"){if(w){var I=
w.pathSegList;A=I.numberOfItems-1;if(m){var E=svgedit.path.addCtrlGrip("1c1"),G=svgedit.path.addCtrlGrip("0c2");G.getAttribute("cx");G.getAttribute("cy");E.setAttribute("cx",v);E.setAttribute("cy",F);E.setAttribute("display","inline");E=m[0];var L=m[1];I.getItem(A);var k=E+(E-v/o),u=L+(L-F/o);G.setAttribute("cx",k*o);G.setAttribute("cy",u*o);G.setAttribute("display","inline");G=svgedit.path.getCtrlLine(1);var C=svgedit.path.getCtrlLine(2);ma(G,{x1:v,y1:F,x2:E*o,y2:L*o,display:"inline"});ma(C,{x1:k*
o,y1:u*o,x2:E*o,y2:L*o,display:"inline"});if(A===0)z=[v,F];else{I=I.getItem(A-1);v=I.x;F=I.y;if(I.pathSegType===6){v+=v-I.x2;F+=F-I.y2}else if(z){v=z[0]/o;F=z[1]/o}svgedit.path.replacePathSeg(6,A,[E,L,v,F,k,u],w)}}else if(E=qa("path_stretch_line")){A=I.getItem(A);if(A.pathSegType===6)svgedit.path.replacePathSeg(6,1,[v,F,(A.x+(A.x-A.x2))*o,(A.y+(A.y-A.y2))*o,v,F],E);else z?svgedit.path.replacePathSeg(6,1,[v,F,z[0],z[1],v,F],E):svgedit.path.replacePathSeg(4,1,[v,F],E)}}}else if(svgedit.path.path.dragging){E=
svgedit.path.getPointFromGrip({x:svgedit.path.path.dragging[0],y:svgedit.path.path.dragging[1]},svgedit.path.path);L=svgedit.path.getPointFromGrip({x:v,y:F},svgedit.path.path);A=L.x-E.x;E=L.y-E.y;svgedit.path.path.dragging=[v,F];svgedit.path.path.dragctrl?svgedit.path.path.moveCtrl(A,E):svgedit.path.path.movePts(A,E)}else{svgedit.path.path.selected_pts=[];svgedit.path.path.eachSeg(function(){if(this.next||this.prev){var D=ua.getBBox(),P=svgedit.path.getGripPt(this);D=svgedit.math.rectsIntersect(D,
{x:P.x,y:P.y,width:0,height:0});this.select(D);D&&svgedit.path.path.selected_pts.push(this.index)}})}},mouseUp:function(A,v){if(Ea==="path"){m=null;if(!w){v=qa(ca());La=false;z=null}return{keep:true,element:v}}if(svgedit.path.path.dragging){var F=svgedit.path.path.cur_pt;svgedit.path.path.dragging=false;svgedit.path.path.dragctrl=false;svgedit.path.path.update();H&&svgedit.path.path.endChanges("Move path point(s)");!A.shiftKey&&!H&&svgedit.path.path.selectPt(F)}else if(ua&&ua.getAttribute("display")!=
"none"){ua.setAttribute("display","none");ua.getAttribute("width")<=2&&ua.getAttribute("height")<=2&&Ja.toSelectMode(A.target)}else Ja.toSelectMode(A.target);H=false},toEditMode:function(A){svgedit.path.path=svgedit.path.getPath_(A);Ea="pathedit";Qa();svgedit.path.path.show(true).update();svgedit.path.path.oldbbox=svgedit.utilities.getBBox(svgedit.path.path.elem);e=false},toSelectMode:function(A){var v=A==svgedit.path.path.elem;Ea="select";svgedit.path.path.show(false);h=false;Qa();svgedit.path.path.matrix&&
svgedit.path.getPointFromGrip({x:svgedit.path.path.dragging[0],y:svgedit.path.path.dragging[1]},svgedit.path.path);L=svgedit.path.getPointFromGrip({x:v,y:F},svgedit.path.path);A=L.x-E.x;E=L.y-E.y;svgedit.path.path.dragging=[v,F];svgedit.path.path.dragctrl?svgedit.path.path.moveCtrl(A,E):svgedit.path.path.movePts(A,E)}else{svgedit.path.path.selected_pts=[];svgedit.path.path.eachSeg(function(){if(this.next||this.prev){var D=ta.getBBox(),P=svgedit.path.getGripPt(this);D=svgedit.math.rectsIntersect(D,
{x:P.x,y:P.y,width:0,height:0});this.select(D);D&&svgedit.path.path.selected_pts.push(this.index)}})}},mouseUp:function(A,v){if(Ea==="path"){m=null;if(!w){v=qa(ca());La=false;z=null}return{keep:true,element:v}}if(svgedit.path.path.dragging){var F=svgedit.path.path.cur_pt;svgedit.path.path.dragging=false;svgedit.path.path.dragctrl=false;svgedit.path.path.update();H&&svgedit.path.path.endChanges("Move path point(s)");!A.shiftKey&&!H&&svgedit.path.path.selectPt(F)}else if(ta&&ta.getAttribute("display")!=
"none"){ta.setAttribute("display","none");ta.getAttribute("width")<=2&&ta.getAttribute("height")<=2&&Ja.toSelectMode(A.target)}else Ja.toSelectMode(A.target);H=false},toEditMode:function(A){svgedit.path.path=svgedit.path.getPath_(A);Ea="pathedit";Qa();svgedit.path.path.show(true).update();svgedit.path.path.oldbbox=svgedit.utilities.getBBox(svgedit.path.path.elem);e=false},toSelectMode:function(A){var v=A==svgedit.path.path.elem;Ea="select";svgedit.path.path.show(false);h=false;Qa();svgedit.path.path.matrix&&
svgedit.path.recalcRotatedPath();if(v){M("selected",[A]);vb([A],true)}},addSubPath:function(A){if(A){Ea="path";e=true}else{Ja.clear(true);Ja.toEditMode(svgedit.path.path.elem)}},select:function(A){if(h===A){Ja.toEditMode(A);Ea="pathedit"}else h=A},reorient:function(){var A=J[0];if(A)if(oa(A)!=0){var v=new za("Reorient path"),F={d:A.getAttribute("d"),transform:A.getAttribute("transform")};v.addSubCommand(new Na(A,F));Qa();this.resetOrientation(A);ya(v);svgedit.path.getPath_(A).show(false).matrix=null;
this.clear();vb([A],true);M("changed",J)}},clear:function(){h=null;if(w){var A=qa(ca());$(qa("path_stretch_line")).remove();$(A).remove();$(qa("pathpointgrip_container")).find("*").attr("display","none");w=z=null;La=false}else Ea=="pathedit"&&this.toSelectMode();svgedit.path.path&&svgedit.path.path.init().show(false)},resetOrientation:function(A){if(A==null||A.nodeName!="path")return false;var v=V(A),F=fa(v).matrix;v.clear();A.removeAttribute("transform");v=A.pathSegList;for(var I=v.numberOfItems,
E=0;E<I;++E){var G=v.getItem(E),L=G.pathSegType;if(L!=1){var k=[];$.each(["",1,2],function(u,C){var D=G["x"+C],P=G["y"+C];if(D!==undefined&&P!==undefined){D=O(D,P,F);k.splice(k.length,0,D.x,D.y)}});svgedit.path.replacePathSeg(L,E,k,A)}}g(A,F)},zoomChange:function(){Ea=="pathedit"&&svgedit.path.path.update()},getNodePoint:function(){var A=svgedit.path.path.segs[svgedit.path.path.selected_pts.length?svgedit.path.path.selected_pts[0]:1];return{x:A.item.x,y:A.item.y,type:A.type}},linkControlPoints:function(A){svgedit.path.setLinkControlPoints(A)},
@ -297,7 +297,7 @@ var F=function(){var I=svgedit.path.path.elem.pathSegList,E=I.numberOfItems,G=fu
1){Ja.toSelectMode(svgedit.path.path.elem);b.deleteSelectedElements()}else{svgedit.path.path.init();svgedit.path.path.clearSelection();if(window.opera){A=$(svgedit.path.path.elem);A.attr("d",A.attr("d"))}svgedit.path.path.endChanges("Delete path node(s)")}}},smoothPolylineIntoPath:function(A){var v=A.points,F=v.numberOfItems;if(F>=4){var I=v.getItem(0),E=null;A=[];A.push(["M",I.x,",",I.y," C"].join(""));for(var G=1;G<=F-4;G+=3){var L=v.getItem(G),k=v.getItem(G+1),u=v.getItem(G+2);if(E)if((I=svgedit.path.smoothControlPoints(E,
L,I))&&I.length==2){L=A[A.length-1].split(",");L[2]=I[0].x;L[3]=I[0].y;A[A.length-1]=L.join(",");L=I[1]}A.push([L.x,L.y,k.x,k.y,u.x,u.y].join(","));I=u;E=k}for(A.push("L");G<F;++G){k=v.getItem(G);A.push([k.x,k.y].join(","))}A=A.join(" ");A=R({element:"path",curStyles:true,attr:{id:ca(),d:A,fill:"none"}})}return A},setSegType:function(A){svgedit.path.path.setSegType(A)},moveNode:function(A,v){var F=svgedit.path.path.selected_pts;if(F.length){svgedit.path.path.storeD();F=svgedit.path.path.segs[F[0]];
var I={x:0,y:0};I[A]=v-F.item[A];F.move(I.x,I.y);svgedit.path.path.endChanges("Move path point")}},fixEnd:function(A){for(var v=A.pathSegList,F=v.numberOfItems,I,E=0;E<F;++E){var G=v.getItem(E);if(G.pathSegType===2)I=G;if(G.pathSegType===1){G=v.getItem(E-1);if(G.x!=I.x||G.y!=I.y){v=A.createSVGPathSegLinetoAbs(I.x,I.y);svgedit.path.insertItemBefore(A,v,E);Ja.fixEnd(A);break}}}svgedit.browser.isWebkit()&&A.setAttribute("d",Ja.convertPath(A))},convertPath:function(A,v){for(var F=A.pathSegList,I=F.numberOfItems,
E=0,G=0,L="",k=null,u=0;u<I;++u){var C=F.getItem(u),D=C.x||0,P=C.y||0,U=C.x1||0,S=C.y1||0,Y=C.x2||0,aa=C.y2||0,ga=C.pathSegType,ra=Pa[ga]["to"+(v?"Lower":"Upper")+"Case"](),Oa=function(Ba,ha,Ta){ha=ha?" "+ha.join(" "):"";Ta=Ta?" "+svgedit.units.shortFloat(Ta):"";$.each(Ba,function(Ra,ta){Ba[Ra]=svgedit.units.shortFloat(ta)});L+=ra+Ba.join(" ")+ha+Ta};switch(ga){case 1:L+="z";break;case 12:D-=E;case 13:if(v){E+=D;ra="l"}else{D+=E;E=D;ra="L"}Oa([[D,G]]);break;case 14:P-=G;case 15:if(v){G+=P;ra="l"}else{P+=
E=0,G=0,L="",k=null,u=0;u<I;++u){var C=F.getItem(u),D=C.x||0,P=C.y||0,U=C.x1||0,S=C.y1||0,Y=C.x2||0,aa=C.y2||0,ga=C.pathSegType,ra=Pa[ga]["to"+(v?"Lower":"Upper")+"Case"](),Oa=function(Ba,ha,Ta){ha=ha?" "+ha.join(" "):"";Ta=Ta?" "+svgedit.units.shortFloat(Ta):"";$.each(Ba,function(Ra,ua){Ba[Ra]=svgedit.units.shortFloat(ua)});L+=ra+Ba.join(" ")+ha+Ta};switch(ga){case 1:L+="z";break;case 12:D-=E;case 13:if(v){E+=D;ra="l"}else{D+=E;E=D;ra="L"}Oa([[D,G]]);break;case 14:P-=G;case 15:if(v){G+=P;ra="l"}else{P+=
G;G=P;ra="L"}Oa([[E,P]]);break;case 2:case 4:case 18:D-=E;P-=G;case 5:case 3:if(k&&F.getItem(u-1).pathSegType===1&&!v){E=k[0];G=k[1]}case 19:if(v){E+=D;G+=P}else{D+=E;P+=G;E=D;G=P}if(ga===3)k=[E,G];Oa([[D,P]]);break;case 6:D-=E;U-=E;Y-=E;P-=G;S-=G;aa-=G;case 7:if(v){E+=D;G+=P}else{D+=E;U+=E;Y+=E;P+=G;S+=G;aa+=G;E=D;G=P}Oa([[U,S],[Y,aa],[D,P]]);break;case 8:D-=E;U-=E;P-=G;S-=G;case 9:if(v){E+=D;G+=P}else{D+=E;U+=E;P+=G;S+=G;E=D;G=P}Oa([[U,S],[D,P]]);break;case 10:D-=E;P-=G;case 11:if(v){E+=D;G+=P}else{D+=
E;P+=G;E=D;G=P}Oa([[C.r1,C.r2]],[C.angle,C.largeArcFlag?1:0,C.sweepFlag?1:0],[D,P]);break;case 16:D-=E;Y-=E;P-=G;aa-=G;case 17:if(v){E+=D;G+=P}else{D+=E;Y+=E;P+=G;aa+=G;E=D;G=P}Oa([[Y,aa],[D,P]])}}return L}}}(),Kb=this.removeUnusedDefElems=function(){var e=l.getElementsByTagNameNS(c,"defs");if(!e||!e.length)return 0;for(var h=[],m=0,z=["fill","stroke","filter","marker-start","marker-mid","marker-end"],w=z.length,H=l.getElementsByTagNameNS(c,"*"),A=H.length,v=0;v<A;v++){for(var F=H[v],I=0;I<w;I++){var E=
ka(F.getAttribute(z[I]));E&&h.push(E.substr(1))}(F=da(F))&&F.indexOf("#")===0&&h.push(F.substr(1))}e=$(e).find("linearGradient, radialGradient, filter, marker, svg, symbol");defelem_ids=[];for(v=e.length;v--;){z=e[v];w=z.id;if(h.indexOf(w)<0){Ab[w]=z;z.parentNode.removeChild(z);m++}}return m};this.svgCanvasToString=function(){for(;Kb()>0;);Ja.clear(true);$.each(l.childNodes,function(m,z){m&&z.nodeType===8&&z.data.indexOf("Created with")>=0&&l.insertBefore(z,l.firstChild)});if(K){Jb();xb([K])}var e=
@ -328,7 +328,7 @@ if(v&&v.tagName=="title"){for(;v.firstChild;)v.removeChild(v.firstChild);v.textC
e){h=m.all_layers[z][1];break}if(!h)return false;e=new za("Move Elements to Layer");m=J;for(z=m.length;z--;){var w=m[z];if(w){var H=w.nextSibling,A=w.parentNode;h.appendChild(w);e.addSubCommand(new Ia(w,H,A))}}ya(e);return true};this.mergeLayer=function(e){var h=new za("Merge Layer"),m=B(),z=$(m.current_layer).prev()[0];if(z){for(h.addSubCommand(new Ka(m.current_layer,m.current_layer.nextSibling,l));m.current_layer.firstChild;){var w=m.current_layer.firstChild;if(w.localName=="title"){h.addSubCommand(new Ka(w,
w.nextSibling,m.current_layer));m.current_layer.removeChild(w)}else{var H=w.nextSibling;z.appendChild(w);h.addSubCommand(new Ia(w,H,m.current_layer))}}l.removeChild(m.current_layer);if(!e){Qa();Fb();M("changed",[l]);ya(h)}m.current_layer=z;return h}};this.mergeAllLayers=function(){var e=new za("Merge all Layers"),h=B();for(h.current_layer=h.all_layers[h.getNumLayers()-1][1];$(l).children("g").length>1;)e.addSubCommand(b.mergeLayer(true));Qa();Fb();M("changed",[l]);ya(e)};var Jb=this.leaveContext=
function(){var e=va.length;if(e){for(var h=0;h<e;h++){var m=va[h],z=ib(m,"orig_opac");z!==1?m.setAttribute("opacity",z):m.removeAttribute("opacity");m.setAttribute("style","pointer-events: inherit")}va=[];Qa(true);M("contextset",null)}K=null},Rb=this.setContext=function(e){Jb();if(typeof e==="string")e=qa(e);K=e;$(e).parentsUntil("#svgcontent").andSelf().siblings().each(function(){var h=this.getAttribute("opacity")||1;ib(this,"orig_opac",h);this.setAttribute("opacity",h*0.33);this.setAttribute("style",
"pointer-events: none");va.push(this)});Qa();M("contextset",K)};this.clear=function(){Ja.clear();Qa();b.clearSvgContentElement();b.current_drawing_=new svgedit.draw.Drawing(l);b.createLayer("Layer 1");b.undoMgr.resetUndoStack();Ha.initGroup();ua=Ha.getRubberBandBox();M("cleared")};this.linkControlPoints=Ja.linkControlPoints;this.getContentElem=function(){return l};this.getRootElem=function(){return d};this.getSelectedElems=function(){return J};var Eb=this.getResolution=function(){var e=l.getAttribute("width")/
"pointer-events: none");va.push(this)});Qa();M("contextset",K)};this.clear=function(){Ja.clear();Qa();b.clearSvgContentElement();b.current_drawing_=new svgedit.draw.Drawing(l);b.createLayer("Layer 1");b.undoMgr.resetUndoStack();Ha.initGroup();ta=Ha.getRubberBandBox();M("cleared")};this.linkControlPoints=Ja.linkControlPoints;this.getContentElem=function(){return l};this.getRootElem=function(){return d};this.getSelectedElems=function(){return J};var Eb=this.getResolution=function(){var e=l.getAttribute("width")/
o,h=l.getAttribute("height")/o;return{w:e,h:h,zoom:o}};this.getZoom=function(){return o};this.getVersion=function(){return"svgcanvas.js ($Rev: 2082 $)"};this.setUiStrings=function(e){$.extend(qb,e.notification)};this.setConfig=function(e){$.extend(n,e)};this.getTitle=function(e){if(e=e||J[0]){e=$(e).data("gsvg")||$(e).data("symbol")||e;e=e.childNodes;for(var h=0;h<e.length;h++)if(e[h].nodeName=="title")return e[h].textContent;return""}};this.setGroupTitle=function(e){var h=J[0];h=$(h).data("gsvg")||
h;var m=$(h).children("title"),z=new za("Set Label");if(e.length)if(m.length){m=m[0];z.addSubCommand(new Na(m,{"#text":m.textContent}));m.textContent=e}else{m=f.createElementNS(c,"title");m.textContent=e;$(h).prepend(m);z.addSubCommand(new Ca(m))}else{z.addSubCommand(new Ka(m[0],m.nextSibling,h));m.remove()}ya(z)};this.getDocumentTitle=function(){return b.getTitle(l)};this.setDocumentTitle=function(e){for(var h=l.childNodes,m=false,z="",w=new za("Change Image Title"),H=0;H<h.length;H++)if(h[H].nodeName==
"title"){m=h[H];z=m.textContent;break}if(!m){m=f.createElementNS(c,"title");l.insertBefore(m,l.firstChild)}if(e.length)m.textContent=e;else m.parentNode.removeChild(m);w.addSubCommand(new Na(m,{"#text":z}));ya(w)};this.getEditorNS=function(e){e&&l.setAttribute("xmlns:se","http://svg-edit.googlecode.com");return"http://svg-edit.googlecode.com"};this.setResolution=function(e,h){var m=Eb(),z=m.w;m=m.h;var w;if(e=="fit"){var H=getStrokedBBox();if(H){w=new za("Fit Canvas to Content");var A=ub();vb(A);
@ -380,9 +380,9 @@ QwantToOpen:"Do you want to open a new file?\nThis will also erase your undo his
saveFromBrowser:'Select "Save As..." in your browser to save this image as a %s file.',noteTheseIssues:"Also note the following issues: ",unsavedChanges:"There are unsaved changes.",enterNewLinkURL:"Enter the new hyperlink URL",errorLoadingSVG:"Error: Unable to load SVG data",URLloadFail:"Unable to load from URL",retrieving:'Retrieving "%s" ...'}};var s={},b={};c.curConfig=curConfig;c.tool_scale=1;c.setConfig=function(d){a.extend(true,curConfig,d);if(d.extensions)curConfig.extensions=d.extensions};
c.setCustomHandlers=function(d){c.ready(function(){if(d.open){a('#tool_open > input[type="file"]').remove();a("#tool_open").show();g.open=d.open}if(d.save){c.show_save_warning=false;g.bind("saved",d.save)}d.pngsave&&g.bind("exported",d.pngsave);b=d})};c.randomizeIds=function(){g.randomizeIds(arguments)};c.init=function(){function d(k,u){var C=k.id,D=C.split("_"),P=D[0];D=D[1];u&&g.setStrokeAttr("stroke-"+P,D);qb();yb("#cur_"+P,C,20);a(k).addClass("current").siblings().removeClass("current")}function l(k,
u){var C=document.getElementById("ruler_x_cursor"),D=document.getElementById("ruler_y_cursor"),P=document.getElementById("workarea");document.getElementById("title_show");svgedit.browser.isTouch()&&a("#workarea").unbind("mousemove.rulers").bind("mousemove.rulers",function(Sb){Sb.stopPropagation();C.style.left=Sb.pageX-66+P.scrollLeft+"px";D.style.top=Sb.pageY-48+P.scrollTop+"px"});u||(u=g.getZoom());k||(k=a("#svgcanvas"));for(var U=g.getContentElem(),S=svgedit.units.getTypeMap()[curConfig.baseUnit],
Y=0;Y<2;Y++){var aa=Y===0,ga=aa?"x":"y",ra=aa?"width":"height",Oa=U.getAttribute(ga)-0;ga=a("#ruler_"+ga+" canvas:first");$hcanv=ga.clone();ga.replaceWith($hcanv);var Ba=$hcanv[0];var ha=ga=k[ra]()*2;Ba.parentNode.style[ra]=ha+"px";var Ta=0,Ra,ta=Ba.getContext("2d");ta.fillStyle="rgb(200,0,0)";ta.fillRect(0,0,Ba.width,Ba.height);$hcanv.siblings().remove();if(ga>=3E4){var Ma=parseInt(ga/3E4)+1;Ra=Array(Ma);Ra[0]=ta;for(var xa=1;xa<Ma;xa++){Ba[ra]=3E4;var ab=Ba.cloneNode(true);Ba.parentNode.appendChild(ab);
Ra[xa]=ab.getContext("2d")}ab[ra]=ga%3E4;ga=3E4}Ba[ra]=ga;ra=S*u;var Xa=50/ra;Ba=1;for(xa=0;xa<I.length;xa++){Ba=Ma=I[xa];if(Xa<=Ma)break}Xa=Ba*ra;ta.font="normal 9px 'Lucida Grande', sans-serif";ta.fillStyle="#777";for(var cb=Oa/ra%Ba*ra,Hb=cb-Xa;cb<ha;cb+=Xa){Hb+=Xa;xa=Math.round(cb)+0.5;if(aa){ta.moveTo(xa,15);ta.lineTo(xa,0)}else{ta.moveTo(15,xa);ta.lineTo(0,xa)}Ma=(Hb-Oa)/ra;if(Ba>=1)xa=Math.round(Ma);else{xa=(Ba+"").split(".")[1].length;xa=Ma.toFixed(xa)-0}if(xa!==0&&xa!==1E3&&xa%1E3===0)xa=
xa/1E3+"K";if(aa){ta.fillText(xa,cb+2,8);ta.fillStyle="#777"}else{Ma=(xa+"").split("");for(xa=0;xa<Ma.length;xa++){ta.fillText(Ma[xa],1,cb+9+xa*9);ta.fillStyle="#777"}}Ma=Xa/10;for(xa=1;xa<10;xa++){var zb=Math.round(cb+Ma*xa)+0.5;if(Ra&&zb>ga){Ta++;ta.stroke();if(Ta>=Ra.length){xa=10;cb=ha;continue}ta=Ra[Ta];cb-=3E4;zb=Math.round(cb+Ma*xa)+0.5}var Gb=xa%2?12:10;if(aa){ta.moveTo(zb,15);ta.lineTo(zb,Gb)}else{ta.moveTo(15,zb);ta.lineTo(Gb,zb)}}}ta.strokeStyle="#666";ta.stroke()}}(function(){var k=window.opener;
Y=0;Y<2;Y++){var aa=Y===0,ga=aa?"x":"y",ra=aa?"width":"height",Oa=U.getAttribute(ga)-0;ga=a("#ruler_"+ga+" canvas:first");$hcanv=ga.clone();ga.replaceWith($hcanv);var Ba=$hcanv[0];var ha=ga=k[ra]()*2;Ba.parentNode.style[ra]=ha+"px";var Ta=0,Ra,ua=Ba.getContext("2d");ua.fillStyle="rgb(200,0,0)";ua.fillRect(0,0,Ba.width,Ba.height);$hcanv.siblings().remove();if(ga>=3E4){var Ma=parseInt(ga/3E4)+1;Ra=Array(Ma);Ra[0]=ua;for(var xa=1;xa<Ma;xa++){Ba[ra]=3E4;var ab=Ba.cloneNode(true);Ba.parentNode.appendChild(ab);
Ra[xa]=ab.getContext("2d")}ab[ra]=ga%3E4;ga=3E4}Ba[ra]=ga;ra=S*u;var Xa=50/ra;Ba=1;for(xa=0;xa<I.length;xa++){Ba=Ma=I[xa];if(Xa<=Ma)break}Xa=Ba*ra;ua.font="normal 9px 'Lucida Grande', sans-serif";ua.fillStyle="#777";for(var cb=Oa/ra%Ba*ra,Hb=cb-Xa;cb<ha;cb+=Xa){Hb+=Xa;xa=Math.round(cb)+0.5;if(aa){ua.moveTo(xa,15);ua.lineTo(xa,0)}else{ua.moveTo(15,xa);ua.lineTo(0,xa)}Ma=(Hb-Oa)/ra;if(Ba>=1)xa=Math.round(Ma);else{xa=(Ba+"").split(".")[1].length;xa=Ma.toFixed(xa)-0}if(xa!==0&&xa!==1E3&&xa%1E3===0)xa=
xa/1E3+"K";if(aa){ua.fillText(xa,cb+2,8);ua.fillStyle="#777"}else{Ma=(xa+"").split("");for(xa=0;xa<Ma.length;xa++){ua.fillText(Ma[xa],1,cb+9+xa*9);ua.fillStyle="#777"}}Ma=Xa/10;for(xa=1;xa<10;xa++){var zb=Math.round(cb+Ma*xa)+0.5;if(Ra&&zb>ga){Ta++;ua.stroke();if(Ta>=Ra.length){xa=10;cb=ha;continue}ua=Ra[Ta];cb-=3E4;zb=Math.round(cb+Ma*xa)+0.5}var Gb=xa%2?12:10;if(aa){ua.moveTo(zb,15);ua.lineTo(zb,Gb)}else{ua.moveTo(15,zb);ua.lineTo(Gb,zb)}}}ua.strokeStyle="#666";ua.stroke()}}(function(){var k=window.opener;
if(k)try{var u=k.document.createEvent("Event");u.initEvent("svgEditorReady",true,true);k.document.documentElement.dispatchEvent(u)}catch(C){}})();(function(){a("#canvas_width").val(curConfig.dimensions[0]);a("#canvas_height").val(curConfig.dimensions[1]);a("body").toggleClass("touch",svgedit.browser.isTouch());var k=a.deparam.querystring(true);if(!a.isEmptyObject(k)){if(k.dimensions)k.dimensions=k.dimensions.split(",");if(k.extensions)k.extensions=k.extensions.split(",");if(k.bkgd_color)k.bkgd_color=
"#"+k.bkgd_color;svgEditor.setConfig(k);var u=k.source,C=a.param.querystring();if(!u)if(C.indexOf("source=data:")>=0)u=C.match(/source=(data:[^&]*)/)[1];if(u)if(u.indexOf("data:")===0){u=u.replace(/ /g,"+");c.loadFromDataURI(u)}else c.loadFromString(u);else if(C.indexOf("paramurl=")!==-1)svgEditor.loadFromURL(C.substr(9));else k.url&&svgEditor.loadFromURL(k.url)}})();var q=function(){a.each(curConfig.extensions,function(){var k=this;a.getScript(curConfig.extPath+k,function(u){if(!u){u=document.createElement("script");
u.src=curConfig.extPath+k;document.querySelector("head").appendChild(u)}})})};document.location.protocol==="file:"?setTimeout(q,100):q();a.svgIcons(curConfig.imgPath+"svg_edit_icons.svg",{w:27,h:27,id_match:false,no_img:!svgedit.browser.isWebkit(),fallback_path:curConfig.imgPath,fallback:{logo:"logo.png",select:"select.png",select_node:"select_node.png",pencil:"pencil.png",pen:"line.png",square:"square.png",rect:"square.png",fh_rect:"freehand-square.png",circle:"circle.png",ellipse:"ellipse.png",
@ -396,7 +396,7 @@ a(this).text(k.split("\u2318").join("Ctrl+"))});(function(){a("#dialog_container
function(){k.hide();U(false)});if(D=="prompt"){var aa=a('<input type="text">').prependTo(u);aa.val(S||"");aa.bind("keydown","return",function(){Y.trigger("click touchstart")})}D=="process"&&Y.hide();k.show();Y.on("click touchstart",function(){k.hide();var ga=D=="prompt"?aa.val():true;U&&U(ga)}).focus();D=="prompt"&&aa.focus()};a.alert=function(D,P){C("alert",D,P)};a.confirm=function(D,P){C("confirm",D,P)};a.process_cancel=function(D,P){C("process",D,P)};a.prompt=function(D,P,U){C("prompt",D,U,P)}})();
var ba=function(){var k=a(".tool_button_current");if(k.length&&k[0].id!=="tool_select"){k.removeClass("tool_button_current").addClass("tool_button");a("#tool_select").addClass("tool_button_current").removeClass("tool_button")}g.setMode("select")},X=null,sa=false,ka=false,da="",W=function(k,u){var C=g.getResolution();a("#svgcanvas").position();var D=g.setBBoxZoom(u,R.width()-15,R.height()-15);if(D){var P=D.zoom;D=D.bbox;if(P<0.0010)wa({value:0.1});else{var U=Date.now(),S=P-C.zoom;a("#zoom");var Y=
C.zoom,aa=function(ga){ga=(ga-U)/500;ga=Math.pow(ga-1,3)+1;g.setZoom(Y+S*ga);F();ga<1?requestAnimationFrame(aa):a("#zoom").val(P*100)};aa(Date.now());g.getMode()=="zoom"&&D.width&&ba();lb()}}};a("#cur_context_panel").delegate("a","click",function(){var k=a(this);k.attr("data-root")?g.leaveContext():g.setContext(k.text());return false});var Z=function(){c.paintBox.fill.prep();c.paintBox.stroke.prep()},oa={},qa=function(k){a.each(k,function(u,C){var D=a(u).children(),P=u+"_show",U=a(P),S=false;D.addClass("tool_button").unbind("click mousedown mouseup").each(function(ga){var ra=
C[ga];oa[ra.sel]=ra.fn;if(ra.isDefault)S=ga;ga=function(Oa){var Ba=ra;if(Oa.type==="keydown"){var ha=a(Ba.parent+"_show").hasClass("tool_button_current"),Ta=a(Ba.parent+"_show").attr("data-curopt");a.each(k[ra.parent],function(ta,Ma){if(Ma.sel==Ta)Ba=!Oa.shiftKey||!ha?Ma:k[ra.parent][ta+1]||k[ra.parent][0]})}if(a(this).hasClass("disabled"))return false;$a(P)&&Ba.fn();var Ra=Ba.icon?a.getSvgIcon(Ba.icon,true):a(Ba.sel).children().eq(0).clone();Ra[0].setAttribute("width",U.width());Ra[0].setAttribute("height",
C[ga];oa[ra.sel]=ra.fn;if(ra.isDefault)S=ga;ga=function(Oa){var Ba=ra;if(Oa.type==="keydown"){var ha=a(Ba.parent+"_show").hasClass("tool_button_current"),Ta=a(Ba.parent+"_show").attr("data-curopt");a.each(k[ra.parent],function(ua,Ma){if(Ma.sel==Ta)Ba=!Oa.shiftKey||!ha?Ma:k[ra.parent][ua+1]||k[ra.parent][0]})}if(a(this).hasClass("disabled"))return false;$a(P)&&Ba.fn();var Ra=Ba.icon?a.getSvgIcon(Ba.icon,true):a(Ba.sel).children().eq(0).clone();Ra[0].setAttribute("width",U.width());Ra[0].setAttribute("height",
U.height());U.children(":not(.flyout_arrow_horiz)").remove();U.append(Ra).attr("data-curopt",Ba.sel)};a(this).mouseup(ga);ra.key&&a(document).bind("keydown",ra.key[0]+" shift+"+ra.key[0],ga)});if(S)U.attr("data-curopt",C[S].sel);else U.attr("data-curopt")||U.attr("data-curopt",C[0].sel);var Y,aa=a(P).position();a(u).css({left:aa.left+34,top:aa.top+77});U.mousedown(function(ga){a("#tools_shapelib").is(":visible")&&$a(P,false);if(U.hasClass("disabled"))return false;var ra=a(u),Oa=aa.left+34,Ba=ra.width()*
-1,ha=ra.data("shown_popop")?200:0;Y=setTimeout(function(){U.data("isLibrary")?ra.css("left",Oa).show():ra.css("left",Ba).show().animate({left:Oa},150);ra.data("shown_popop",true)},ha);ga.preventDefault()}).mouseup(function(){clearTimeout(Y);var ga=a(this).attr("data-curopt");if(U.data("isLibrary")&&a(P.replace("_show","")).is(":visible"))$a(P,true);else $a(P)&&ga in oa&&oa[ga]()})});Aa()},ma=function(k,u){return a("<div>",{"class":"tools_flyout",id:k}).appendTo("#svg_editor").append(u)},na=function(){a(".tools_flyout").each(function(){var k=
a("#"+this.id+"_show"),u=k.offset();k=k.outerWidth();a(this).css({left:(u.left+k)*ia,top:u.top})})},Aa=function(){a(".tools_flyout").each(function(){var k=a("#"+this.id+"_show");if(!k.data("isLibrary")){var u=[];a(this).children().each(function(){u.push(this.title)});k[0].title=u.join(" / ")}})},Fa,Ia=function(k,u,C){var D=null;if(k.indexOf("url(#")===0){k=(k=g.getRefElem(k))?k.cloneNode(true):a("#"+C+"_color defs *")[0];D={alpha:u};D[k.tagName]=k}else D=k.indexOf("#")===0?{alpha:u,solidColor:k.substr(1)}:
@ -408,7 +408,7 @@ a("#tool_node_delete").toggleClass("disabled",!K.canDeleteNodes);yb("#tool_openc
D=g.getHref(k.parentNode)}a("#tool_make_link, #tool_make_link").toggle(!D);D&&a("#link_url").val(D);D={g:[],a:[],rect:["rx","width","height","x","y"],image:["width","height","x","y"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],line:["x1","y1","x2","y2"],text:["x","y"],use:[],path:[]};var ra=k.tagName;a(k).data("gsvg")&&a("#g_panel").show();ra=="path"&&a("#path_panel").show();if(D[ra]){D=D[ra];a("#"+ra+"_panel").show();ra=="rect"?a("#cornerRadiusLabel").show():a("#cornerRadiusLabel").hide();
a.each(D,function(Oa,Ba){var ha=k.getAttribute(Ba);if(curConfig.baseUnit!=="px"&&k[Ba])ha=svgedit.units.convertUnit(k[Ba].baseVal.value);var Ta=document.getElementById(ra+"_"+Ba);Ta.value=Math.round(ha)||0;Ta.getAttribute("data-cursor")==="true"&&a.fn.dragInput.updateCursor(Ta)});if(ra=="text"){D=k.getAttribute("font-family");document.getElementById("font_family_dropdown").selectedIndex=3;a("#text_panel").css("display","inline");a("#tool_italic").toggleClass("active",g.getItalic());a("#tool_bold").toggleClass("active",
g.getBold());a("#font_family").val(D);a("#font_size").val(k.getAttribute("font-size"));a("#text").val(k.textContent);a("#preview_font").text(D.split(",")[0].replace(/'/g,"")).css("font-family",D);g.addedNew&&setTimeout(function(){a("#text").focus().select()},100)}else if(ra=="image")Na(g.getHref(k));else if(ra==="g"||ra==="use"){a("#container_panel").show();a(".action_group_selected").removeClass("disabled");g.getTitle()}}U[(ra==="g"?"en":"dis")+"ableContextMenuItems"]("#ungroup");U[(ra==="g"||!sa?
"dis":"en")+"ableContextMenuItems"]("#group")}else if(sa){a("#multiselected_panel").show();a(".action_multi_selected").removeClass("disabled");U.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")}else U.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back");T.getUndoStackSize()>0?a("#tool_undo").removeClass("disabled"):a("#tool_undo").addClass("disabled");T.getRedoStackSize()>0?a("#tool_redo").removeClass("disabled"):a("#tool_redo").addClass("disabled");
"dis":"en")+"ableContextMenuItems"]("#group")}if(sa){a("#multiselected_panel").show();a(".action_multi_selected").removeClass("disabled");U.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")}k||U.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back");T.getUndoStackSize()>0?a("#tool_undo").removeClass("disabled"):a("#tool_undo").addClass("disabled");T.getRedoStackSize()>0?a("#tool_redo").removeClass("disabled"):a("#tool_redo").addClass("disabled");
g.addedNew=false;if(k&&!P||sa){a("#selLayerNames").removeAttr("disabled").val(u);V.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")}};a("#text").on("focus",function(){});a("#text").on("blur",function(){});g.bind("selected",function(k,u){var C=g.getMode();C==="select"&&ba();C=C=="pathedit";X=u.length==1||u[1]==null?u[0]:null;sa=u.length>=2&&u[1]!=null?u:false;if(X!=null)if(!C){if(X!=null)switch(X.tagName){case "use":case "image":case "foreignObject":break;case "g":case "a":for(var D=
null,P=X.getElementsByTagName("*"),U=0,S=P.length;U<S;U++){var Y=P[U].getAttribute("stroke-width");if(U===0)D=Y;else if(D!==Y)D=null}a("#stroke_width").val(D===null?"":D);c.paintBox.fill.update(true);c.paintBox.stroke.update(true);break;default:c.paintBox.fill.update(true);c.paintBox.stroke.update(true);a("#stroke_width").val(X.getAttribute("stroke-width")||1);a("#stroke_style").val(X.getAttribute("stroke-dasharray")||"none");D=X.getAttribute("stroke-linejoin")||"miter";a("#linejoin_"+D).length!=
0&&d(a("#linejoin_"+D)[0]);D=X.getAttribute("stroke-linecap")||"butt";a("#linecap_"+D).length!=0&&d(a("#linecap_"+D)[0])}if(X!=null){D=(X.getAttribute("opacity")||1)*100;a("#group_opacity").val(D);a("#opac_slider").slider("option","value",D);a("#elem_id").val(X.id)}}a("#path_node_panel").toggle(C);a("#tools_bottom_2,#tools_bottom_3").toggle(!C);if(C){a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");a("#tool_select").addClass("tool_button_current").removeClass("tool_button");
@ -417,84 +417,83 @@ C==0)}g.runExtensions("elementTransition",{elems:u})}});g.bind("changed",functio
a.browser.version>=533||~C.indexOf("MSIE"))Qb(0,true);else{var D=k.open("data:image/svg+xml;base64,"+N.encode64(u)),P=a.pref("save_notice_done");if(P!=="all"){var U=uiStrings.notification.saveFromBrowser.replace("%s","SVG");if(C.indexOf("Gecko/")!==-1)if(u.indexOf("<defs")!==-1){U+="\n\n"+uiStrings.notification.defsFailOnSave;a.pref("save_notice_done","all");P="all"}else a.pref("save_notice_done","part");else a.pref("save_notice_done","all");P!=="part"&&D.alert(U)}}});g.bind("exported",function(k,
u){var C=u.issues;a("#export_canvas").length||a("<canvas>",{id:"export_canvas"}).hide().appendTo("body");var D=a("#export_canvas")[0];D.width=g.contentW;D.height=g.contentH;canvg(D,u.svg,{renderCallback:function(){var P=D.toDataURL("image/png");O.location.href=P;if(a.pref("export_notice_done")!=="all"){P=uiStrings.notification.saveFromBrowser.replace("%s","PNG");if(C.length)P+="\n\n"+uiStrings.notification.noteTheseIssues+"\n \u2022 "+C.join("\n \u2022 ");a.pref("export_notice_done","all");O.alert(P)}}})});
g.bind("zoomed",W);g.bind("contextset",function(k,u){var C="";if(u){var D="";C='<a href="#" data-root="y">'+g.getCurrentDrawing().getCurrentLayerName()+"</a>";a(u).parentsUntil("#svgcontent > g").andSelf().each(function(){if(this.id){D+=" > "+this.id;C+=this!==u?' > <a href="#">'+this.id+"</a>":" > "+this.id}});da=D}else da=null;a("#cur_context_panel").toggle(!!u).html(C)});g.bind("extension_added",function(k,u){function C(){if(Fa){clearTimeout(Fa);Fa=null}P||(Fa=setTimeout(function(){P=true;e(s.iconsize)},
50))}var D=false,P=false,U=true,S=function(){if(u.callback&&!D&&U){D=true;u.callback()}},Y=[];u.context_tools&&a.each(u.context_tools,function(Ba,ha){var Ta=ha.container_id?' id="'+ha.container_id+'"':"",Ra=a("#"+ha.panel);Ra.length||(Ra=a("<div>",{id:ha.panel}).appendTo("#tools_top").hide());switch(ha.type){case "tool_button":var ta='<div class="tool_button">'+ha.id+"</div>",Ma=a(ta).appendTo(Ra);ha.events&&a.each(ha.events,function(Xa,cb){a(Ma).bind(Xa,cb)});break;case "select":ta="<label"+Ta+'><select id="'+
ha.id+'">';a.each(ha.options,function(Xa,cb){ta+='<option value="'+Xa+'"'+(Xa==ha.defval?" selected":"")+">"+cb+"</option>"});ta+="</select></label>";var xa=a(ta).appendTo(Ra).find("select");a.each(ha.events,function(Xa,cb){a(xa).bind(Xa,cb)});break;case "button-select":ta='<div id="'+ha.id+'" class="dropdown toolset" title="'+ha.title+'"><div id="cur_'+ha.id+'" class="icon_label"></div><button></button></div>';Ta=a('<ul id="'+ha.id+'_opts"></ul>').appendTo("#option_lists");ha.colnum&&Ta.addClass("optcols"+
ha.colnum);a(ta).appendTo(Ra).children();Y.push({elem:"#"+ha.id,list:"#"+ha.id+"_opts",title:ha.title,callback:ha.events.change,cur:"#cur_"+ha.id});break;case "input":ta="<label"+Ta+'><span id="'+ha.id+'_label">'+ha.label+':</span><input id="'+ha.id+'" title="'+ha.title+'" size="'+(ha.size||"4")+'" value="'+(ha.defval||"")+'" type="text"/></label>';var ab=a(ta).appendTo(Ra).find("input");ha.spindata&&ab.SpinButton(ha.spindata);ha.events&&a.each(ha.events,function(Xa,cb){ab.bind(Xa,cb)})}});if(u.buttons){var aa=
{},ga={},ra=u.svgicons,Oa={};a.each(u.buttons,function(Ba,ha){for(var Ta,Ra=ha.id,ta=Ba;a("#"+Ra).length;)Ra=ha.id+"_"+ ++ta;if(ra){aa[Ra]=ha.icon;ta=ha.svgicon?ha.svgicon:ha.id;console.log(ta);if(ha.type=="app_menu")ga["#"+Ra+" > div"]=ta;else ga["#"+Ra]=ta}else Ta=ha.type=="menu"?"":a('<img src="'+ha.icon+'">');var Ma,xa;switch(ha.type){case "mode_flyout":case "mode":Ma="tool_button";if(ha.cls)Ma+=" "+ha.cls;xa="#tools_left";break;case "context":Ma="tool_button";xa="#"+ha.panel;a(xa).length||a("<div>",
{id:ha.panel}).appendTo("#tools_top");break;case "menu":Ma="menu_item tool_button";xa="#"+(ha.after||ha.panel);break;case "app_menu":Ma="";xa=ha.parent||"#main_menu ul";a(xa).length||a("<div>",{id:ha.panel}).appendTo("#tools_top")}var ab=a(ha.list||ha.type=="app_menu"?"<li/>":"<div/>").attr("id",Ra).attr("title",ha.title).addClass(Ma);if(!ha.includeWith&&!ha.list){if("position"in ha)a(xa).children().eq(ha.position).before(ab);else ha.type!="menu"||!ha.after?ab.appendTo(xa):a(xa).after(ab);if(ha.type==
"mode_flyout"){ta=a(ab);Ma=ta.parent();if(!ta.parent().hasClass("tools_flyout")){var Xa=ta[0].id.replace("tool_","tools_"),cb=ta.clone().attr("id",Xa+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));ta.before(cb);Ma=ma(Xa,ta);Ma.data("isLibrary",true);cb.data("isLibrary",true)}ga["#"+Xa+"_show"]=ha.id;Ra=Oa["#"+Ma[0].id]=[{sel:"#"+Ra,fn:ha.events.click,icon:ha.id,isDefault:true},Hb]}else if(ha.type=="app_menu"||ha.type=="menu")ab.append(ha.title)}else if(ha.list){ab.addClass("push_button");
a("#"+ha.list+"_opts").append(ab);if(ha.isDefault){a("#cur_"+ha.list).append(ab.children().clone());ta=ha.svgicon?ha.svgicon:ha.id;ga["#cur_"+ha.list]=ta}}else if(ha.includeWith){xa=ha.includeWith;ta=a(xa.button);Ma=ta.parent();if(!ta.parent().hasClass("tools_flyout")){Xa=ta[0].id.replace("tool_","tools_");cb=ta.clone().attr("id",Xa+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));ta.before(cb);Ma=ma(Xa,ta)}var Hb=v.getButtonData(xa.button);if(xa.isDefault)ga["#"+Xa+"_show"]=ha.id;Ra=Oa["#"+
Ma[0].id]=[{sel:"#"+Ra,fn:ha.events.click,icon:ha.id,key:ha.key,isDefault:ha.includeWith?ha.includeWith.isDefault:0},Hb];Xa="position"in xa?xa.position:"last";Hb=Ma.children().length;if(!isNaN(Xa)&&Xa>=0&&Xa<Hb)Ma.children().eq(Xa).before(ab);else{Ma.append(ab);Ra.reverse()}}ra||ab.append(Ta);ha.list||a.each(ha.events,function(zb,Gb){if(zb=="click")if(ha.type=="mode"){ha.includeWith?ab.bind(zb,Gb):ab.bind(zb,function(){$a(ab)&&Gb()});if(ha.key){a(document).bind("keydown",ha.key,Gb);ha.title&&ab.attr("title",
ha.title+" ["+ha.key+"]")}}else ab.bind(zb,Gb);else ab.bind(zb,Gb)});qa(Oa)});a.each(Y,function(){Da(this.elem,this.list,this.callback,{seticon:true})});if(ra)U=false;a.svgIcons(ra,{w:27,h:27,id_match:false,no_img:!B,fallback:aa,placement:ga,callback:function(){s.iconsize&&s.iconsize!="m"&&C();U=true;S()}})}S()});g.textActions.setInputElem(a("#text")[0]);var ya='<div class="palette_item" data-rgb="none"></div>';a.each(["#000000","#3f3f3f","#7f7f7f","#bfbfbf","#ffffff","#ff0000","#ff7f00","#ffff00",
"#7fff00","#00ff00","#00ff7f","#00ffff","#007fff","#0000ff","#7f00ff","#ff00ff","#ff007f","#7f0000","#7f3f00","#7f7f00","#3f7f00","#007f00","#007f3f","#007f7f","#003f7f","#00007f","#3f007f","#7f007f","#7f003f","#ffaaaa","#ffd4aa","#ffffaa","#d4ffaa","#aaffaa","#aaffd4","#aaffff","#aad4ff"],function(k,u){ya+='<div class="palette_item" style="background-color: '+u+';" data-rgb="'+u+'"></div>'});a("#palette").append(ya);var Ha=a("#tool_angle_indicator");a("#tool_reorient");rotateCursor=function(k){k=
"rotate("+k+"deg)";Ha.css({"-webkit-transform":k,"-moz-transform":k,"-o-transform":k,"-ms-transform":k,transform:k})};var wa=function(k){var u=k.value/100;if(u<0.0010)k.value=0.1;else{k=g.getZoom();W(window,{width:0,height:0,x:(R[0].scrollLeft+R.width()/2)/k,y:(R[0].scrollTop+R.height()/2)/k,zoom:u},true)}},qb=function(){window.opera&&a("<p/>").hide().appendTo("body").remove()};a("#stroke_style").change(function(){g.setStrokeAttr("stroke-dasharray",a(this).val());a("#stroke_style_label").html(this.options[this.selectedIndex].text);
qb()});a("#seg_type").change(function(){g.setSegType(a(this).val());a("#seg_type_label").html(this.options[this.selectedIndex].text)});a("select").change(function(){a(this).blur()});a("#font_family").change(function(){g.setFontFamily(this.value)});a("#text").keyup(function(){g.setTextContent(this.value)});changeAttribute=function(k,u){var C=k.getAttribute("data-attr"),D=k.value;if(!svgedit.units.isValidUnit(C,D,X)){a.alert(uiStrings.notification.invalidAttrValGiven);k.value=X.getAttribute(C);return false}u?
g.changeSelectedAttributeNoUndo(C,D):g.changeSelectedAttribute(C,D)};a("#palette").mouseover(function(){var k=a('<input type="hidden">');a(this).append(k);k.focus().remove()});a(".palette_item").on("mousedown touchstart touchmove",function(){var k=a("#tool_stroke").hasClass("active"),u=k?"stroke":"fill",C=a(this).attr("data-rgb"),D=null;if(C==="transparent"||C==="initial"||C==="#none"){C="none";D=new a.jGraduate.Paint}else D=new a.jGraduate.Paint({alpha:100,solidColor:C.substr(1)});c.paintBox[u].setPaint(D);
if(k){g.setColor("stroke",C);C!="none"&&g.getStrokeOpacity()!=1&&g.setPaintOpacity("stroke",1)}else{g.setColor("fill",C);C!="none"&&g.getFillOpacity()!=1&&g.setPaintOpacity("fill",1)}}).bind("contextmenu",function(k){k.preventDefault()});a("#toggle_stroke_tools").toggle(function(){a(".stroke_tool").css("display","table-cell");a(this).addClass("expanded");z()},function(){a(".stroke_tool").css("display","none");a(this).removeClass("expanded");z()});var $a=function(k,u){if(a(k).hasClass("disabled"))return false;
if(a(k).parent().hasClass("tools_flyout"))return true;var C=C||"normal";u||a(".tools_flyout").fadeOut(C);a("#styleoverrides").text("");a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");a(k).addClass("tool_button_current").removeClass("tool_button");return true};(function(){var k=null,u=null,C=R[0],D=false,P=false;a("#svgcanvas").bind("mousemove mouseup touchend",function(U){if(D!==false){C.scrollLeft-=U.clientX-k;C.scrollTop-=U.clientY-u;k=U.clientX;u=U.clientY;
if(U.type==="mouseup"||U.type==="touchend")D=false;return false}}).on("mousedown touchmove",function(U){if(U.button===1||P===true||U.originalEvent.touches&&U.originalEvent.touches.length>=2){D=true;k=U.clientX;u=U.clientY;return false}});a(window).mouseup(function(){D=false;a("body").removeClass("dragging")});a(document).bind("keydown","space",function(U){U.preventDefault();g.spaceKey=P=true}).bind("keyup","space",function(U){U.preventDefault();g.spaceKey=P=false}).bind("keydown","alt",function(){g.getMode()===
"zoom"&&R.addClass("out")}).bind("keyup","alt",function(){g.getMode()==="zoom"&&R.removeClass("out")})})();var ib=a(".menu"),Wa=function(k){k.target.style.background="#fff";setTimeout(function(){k.target.style.background="#ddd"},50);setTimeout(function(){k.target.style.background="#fff"},150);setTimeout(function(){k.target.style.background="#ddd"},200);setTimeout(function(){k.target.style.background=""},200);setTimeout(function(){a("#menu_bar").removeClass("active")},220);return false};a(".menu_item").on("mousedown touchstart",
function(k){Wa(k)});a("svg, body").on("mousedown touchstart",function(k){top!=self&&!k.isTrigger&&typeof top.exports.focus_editor=="function"&&top.exports.focus_editor();if(k.target.nodeName.toLowerCase()!=="input")if(!a(k.target).hasClass("menu_title")&&!a(k.target).parent().hasClass("menu_title"))!a(k.target).hasClass("disabled")&&a(k.target).hasClass("menu_item")?Wa(k):a("#menu_bar").removeClass("active")});var Sa=[6,12,16,33,50,66,100,150,200,300,400,600,800,1200];a("#workarea").on("mousewheel",
function(k,u,C,D){if(k.altKey){k.preventDefault();k=g.getZoom()*100;u=Sa.length;for(E=0;E<u;E++){C=Math.min(u,E+1);if(D>0)zoom=Sa[E]<=k?Sa[C]:zoom;if(D<0)zoom=Sa[E]<k?Sa[E]:zoom}zoom&&wa({value:zoom})}});a(".menu_title").on("mousedown",function(){a("#tools_shapelib").hide();a("#menu_bar").toggleClass("active");ib.removeClass("open");a(this).parent().addClass("open")}).on("mouseover",function(){ib.removeClass("open");a(this).parent().addClass("open")});c.addDropDown=function(k,u,C){if(a(k).length!=
0){var D=a(k).find("button"),P=a(k).find("ul").attr("id",a(k)[0].id+"-list");C||a("#option_lists").append(P);var U=false;C&&a(k).addClass("dropup");P.find("li").bind("mouseup",u);a(window).mouseup(function(){if(!U){D.removeClass("down");P.hide()}U=false});D.bind("mousedown",function(){if(D.hasClass("down")){D.removeClass("down");P.hide()}else{D.addClass("down");if(!C){var S=a(k).offset();P.css({top:S.top,left:S.left-110})}P.show();U=true}}).hover(function(){U=true}).mouseout(function(){U=false})}};
var Da=function(k,u,C,D){var P=a(k);u=a(u);var U=false,S=D.dropUp;S&&a(k).addClass("dropup");u.find("li").bind("mouseup",function(){if(D.seticon){yb("#cur_"+P[0].id,a(this).children());a(this).addClass("current").siblings().removeClass("current")}C.apply(this,arguments)});a(window).mouseup(function(){if(!U){P.removeClass("down");u.hide();u.css({top:0,left:0})}U=false});u.height();a(k).bind("mousedown",function(){var Y=a(k).offset();if(S){Y.top-=u.height();Y.left+=8}else Y.top+=a(k).height();a(u).offset(Y);
if(P.hasClass("down")){P.removeClass("down");u.hide();u.css({top:0,left:0})}else{P.addClass("down");u.show();U=true;return false}}).hover(function(){U=true}).mouseout(function(){U=false});D.multiclick&&u.mousedown(function(){U=true})};a("#font_family_dropdown").change(function(){var k=this.options[this.selectedIndex].value,u=this.options[this.selectedIndex].text;a("#preview_font").html(u).css("font-family",k);a("#font_family").val(k).change()});a("div","#position_opts").each(function(){this.addEventListener("mouseup",
function(){var k=this.id.replace("tool_pos","").charAt(0);g.alignSelectedElements(k,"page")})});(function(){var k,u=function(){a(k).blur()};a("#svg_editor").find("button, select, input:not(#text)").focus(function(){k=this;pa="toolbars";R.mousedown(u)}).blur(function(){pa="canvas";R.unbind("mousedown",u);g.getMode()=="textedit"&&a("#text").focus()})})();var va=function(){$a("#tool_select")&&g.setMode("select")},fb=function(){$a("#tool_fhpath")&&g.setMode("fhpath")},La=function(){$a("#tool_line")&&
g.setMode("line")},Va=function(){$a("#tool_rect")&&g.setMode("rect")},Ea=function(){$a("#tool_ellipse")&&g.setMode("ellipse")},kb=function(){$a("#tool_image")&&g.setMode("image")},sb=function(){$a("#tool_zoom")&&g.setMode("zoom")},Za=function(){if($a("#tool_zoom")){Db();ba()}},bb=function(){$a("#tool_text")&&g.setMode("text")},Cb=function(){$a("#tool_path")&&g.setMode("path")},ua=function(){if(X!=null||sa)g.deleteSelectedElements()},mb=function(){if(X!=null||sa){window.event.type==="keydown"&&pb(a("#edit_menu"));
g.cutSelectedElements()}},jb=function(){if(X!=null||sa){window.event.type==="keydown"&&pb(a("#edit_menu"));g.copySelectedElements()}},Ab=function(){window.event.type==="keydown"&&pb(a("#edit_menu"));var k=g.getZoom(),u=(R[0].scrollLeft+R.width()/2)/k-g.contentW;k=(R[0].scrollTop+R.height()/2)/k-g.contentH;g.pasteElements("point",u,k)},ob=function(){if(X!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveToTopSelectedElement()}},eb=function(){if(X!=null){window.event.type==="keydown"&&
pb(a("#object_menu"));g.moveToBottomSelectedElement()}},tb=function(){if(X!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveUpDownSelected("Up")}},ub=function(){if(X!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveUpDownSelected("Down")}},wb=function(k){if(X!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveUpDownSelected(k)}},Bb=function(){if(X!=null){g.convertToPath();elems=g.getSelectedElems();g.selectorManager.requestSelector(elems[0]).selectorRect.setAttribute("display",
"none");g.setMode("pathedit");K.toEditMode(elems[0]);g.clearSelection()}},la=function(){X!=null&&K.reorient()},ca=function(){if(X!=null||sa)a.prompt(uiStrings.notification.enterNewLinkURL,"http://",function(k){k&&g.makeHyperlink(k)})},ja=function(k,u){if(X!=null||sa){if(curConfig.gridSnapping){var C=g.getZoom()*curConfig.snappingStep;k*=C;u*=C}a("input").blur();g.moveSelectedElements(k,u)}},M=function(){var k=!a("#tool_node_link").hasClass("checked");k?a("#tool_node_link").addClass("checked").find("input").attr("checked",
true):a("#tool_node_link").removeClass("checked").find("input").attr("checked",false);K.linkControlPoints(k)},Q=function(){K.getNodePoint()&&K.clonePathNode()},ea=function(){K.getNodePoint()&&K.deletePathNode()},Ga=function(){var k=a("#tool_add_subpath"),u=!k.hasClass("push_button_pressed");u?k.addClass("push_button_pressed").removeClass("tool_button"):k.removeClass("push_button_pressed").addClass("tool_button");K.addSubPath(u)},Pa=function(){K.opencloseSubPath()},Ya=function(){g.cycleElement(1)},
db=function(){g.cycleElement(0)},nb=function(k,u){if(!(X==null||sa)){k||(u*=-1);var C=a("#angle").val()*1+u;g.setRotationAngle(C);za()}},Ua=function(){var k=curConfig.dimensions;a.confirm(uiStrings.notification.QwantToClear,function(u){if(u){ba();g.clear();g.setResolution(k[0],k[1]);F(true);Db();za();Z();g.runExtensions("onNewDocument")}})},rb=function(){g.setBold(!g.getBold());za();return false},Qa=function(){g.setItalic(!g.getItalic());za();return false},vb=function(){if(!b.pngsave){var k=uiStrings.notification.loadingImage;
O=window.open("data:text/html;charset=utf-8,<title>"+k+"</title><h1>"+k+"</h1>")}window.canvg?g.rasterExport():a.getScript("canvg/rgbcolor.js",function(){a.getScript("canvg/canvg.js",function(){g.rasterExport()})})},xb=function(){g.open()},Ib=function(){},pb=function(k){var u=k.prev();u.css("background","#09f");setTimeout(function(){u.css("background","")},200)},hb=function(){if(T.getUndoStackSize()>0){window.event.type==="keydown"&&pb(a("#edit_menu"));T.undo()}},Ja=function(){if(T.getRedoStackSize()>
0){window.event.type==="keydown"&&pb(a("#edit_menu"));T.redo()}},Kb=function(){if(sa)g.groupSelectedElements();else X&&g.ungroupSelectedElement()},Nb=function(){window.event.type==="keydown"&&pb(a("#edit_menu"));g.cloneSelectedElements(20,20)},Lb=function(){var k=this.id.replace("tool_align","").charAt(0);g.alignSelectedElements(k,a("#align_relative_to").val())},Ob=function(){var k=document.querySelector("#tool_stroke rect"),u=document.querySelector("#tool_fill rect"),C=u.getAttribute("fill"),D=k.getAttribute("fill");
k=parseFloat(k.getAttribute("stroke-opacity"));if(isNaN(k))k=100;u=parseFloat(u.getAttribute("fill-opacity"));if(isNaN(u))u=100;D=Ia(D,k,"stroke");C=Ia(C,u,"fill");c.paintBox.fill.setPaint(D,true);c.paintBox.stroke.setPaint(C,true)},Db=function(k){var u=g.getResolution();k=k?u.zoom*k:1;a("#zoom").val(k*100);g.setZoom(k);lb();F(true)},Fb=function(){!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"):a("#tool_wireframe").removeClass("push_button_pressed");
R.toggleClass("wireframe");if(!H){var k=a("#wireframe_rules");k.length?k.empty():a('<style id="wireframe_rules"></style>').appendTo("head");lb()}},Jb=function(){var k=!a("#tool_snap").hasClass("push_button_pressed");k?a("#tool_snap").addClass("push_button_pressed"):a("#tool_snap").removeClass("push_button_pressed");curConfig.gridSnapping=k},Rb=function(){window.self!=window.top&&top.exports.setEditorFocus(false)},Eb=function(){if(a("#tool_rulers").hasClass("push_button_pressed")){a("#tool_rulers").removeClass("push_button_pressed");
a("#show_rulers").attr("checked",false);curConfig.showRulers=false}else{a("#tool_rulers").addClass("push_button_pressed");a("#show_rulers").attr("checked",true);curConfig.showRulers=true}a("#rulers").toggle(!!curConfig.showRulers)},lb=function(){if(!H){var k="#workarea.wireframe #svgcontent * { stroke-width: "+1/g.getZoom()+"px; }";a("#wireframe_rules").text(R.hasClass("wireframe")?k:"")}},Qb=function(k,u){if(!ka){ka=true;a("#save_output_btns").toggle(!!u);a("#tool_source_back").toggle(!u);var C=
fa=g.getSvgString();a("#svg_source_textarea").val(C);a("#svg_source_editor").fadeIn();C=a("#svg_source_container").height()-50;a("#svg_source_textarea").css("height",C);a("#svg_source_textarea").focus()}},Pb=function(){if(ka){if(g.setSvgString(a("#svg_source_textarea").val())){g.clearSelection();m();Db();Z()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(k){if(!k)return false;g.clearSelection();m();Db();Z()});ba()}},yb=c.setIcon=function(k,u){var C=typeof u==="string"?a.getSvgIcon(u,
true):u.clone();C?a(k).find("img").replaceWith(C):console.log("NOTE: Icon image missing: "+u)},gb;gb=function(){var k=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,u=document.getElementsByTagName("script")[0],C;for(C in u.style)if(k.test(C))return C.match(k)[0];if("WebkitOpacity"in u.style)return"Webkit";if("KhtmlOpacity"in u.style)return"Khtml";return""}();var Mb=function(k,u){gb.toLowerCase();var C=["top","left","bottom","right"];k.each(function(){for(var D=a(this),P=D.outerWidth()*(u-1),U=D.outerHeight()*
(u-1),S=0;S<4;S++){var Y=C[S],aa=D.data("orig_margin-"+Y);if(aa==null){aa=parseInt(D.css("margin-"+Y));D.data("orig_margin-"+Y,aa)}aa=aa*u;if(Y==="right")aa+=P;else if(Y==="bottom")aa+=U;D.css("margin-"+Y,aa)}})},e=c.setIconSize=function(k,u){if(!(k==s.size&&!u)){var C=a("#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout"),D=1;D=typeof k=="number"?
k:{s:0.75,m:1,l:1.25,xl:1.5}[k];c.tool_scale=ia=D;na();var P=C.parents(":hidden");P.css("visibility","hidden").show();Mb(C,D);P.css("visibility","visible").hide();C=a("#tool_size_rules");if(C.length)C.empty();else C=a('<style id="tool_size_rules"></style>').appendTo("head");if(k!="m"){var U="";a.each(cssResizeRules,function(S,Y){S="#svg_editor "+S.replace(/,/g,", #svg_editor");U+=S+"{";a.each(Y,function(aa,ga){if(typeof ga==="number")var ra=ga*D+"px";else if(ga[k]||ga.all)ra=ga[k]||ga.all;U+=aa+":"+
ra+";"});U+="}"});P="-"+gb.toLowerCase()+"-";U+="#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout{"+P+"transform: scale("+D+");} #svg_editor div.toolset .toolset {"+P+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+P+"transform: scale("+1/D+");}";C.text(U)}na()}},h=function(){a("#dialog_box").hide();if(ka){if(ka)fa!==a("#svg_source_textarea").val()?
a.confirm(uiStrings.notification.QignoreSourceChanges,function(k){k&&m()}):m();z()}else da&&g.leaveContext()},m=function(){a("#svg_source_editor").hide();ka=false;a("#svg_source_textarea").blur()};a(window).width();a(window).height();var z=a.noop;a(window).resize(function(){F()});(function(){R.scroll(function(){if(a("#ruler_x").length!=0)a("#ruler_x")[0].scrollLeft=R[0].scrollLeft;if(a("#ruler_y").length!=0)a("#ruler_y")[0].scrollTop=R[0].scrollTop})})();a("#url_notice").click(function(){a.alert(this.title)});
a("#change_image_url").click(function(){var k=g.getHref(X);k=k.indexOf("data:")===0?"":k;a.prompt(uiStrings.notification.enterNewImgURL,k,function(u){u&&Na(u)})});var w=function(k){var u=k[0].id=="stroke_color"?"stroke":"fill",C=k[0].id=="canvas_color";if(C)u="canvas";var D=c.paintBox[u].paint;k=u=="stroke"?"Pick a Stroke Paint and Opacity":"Pick a Fill Paint and Opacity";C=C?{right:200,top:50}:{left:45,bottom:50};a("#color_picker").draggable({cancel:".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker",
containment:"window"}).css(C).jGraduate({paint:D,window:{pickerTitle:k},images:{clientPath:curConfig.jGraduatePath},newstop:"inverse"},function(P){D=new a.jGraduate.Paint(P);c.paintBox[u].setPaint(D);g.setPaint(u,D);a("#color_picker").hide()},function(){a("#color_picker").hide()})};q=function(k,u){var C=document.getElementById("canvas_background"),D={color:"fff",opacity:1};if(u=="stroke")D=curConfig.initStroke;if(u=="fill")D=curConfig.initFill;if(u=="canvas"&&C)if(C=C.getAttribute("fill").match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))D=
{color:("0"+parseInt(C[1],10).toString(16)).slice(-2)+("0"+parseInt(C[2],10).toString(16)).slice(-2)+("0"+parseInt(C[3],10).toString(16)).slice(-2),opacity:1};C=(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg"><rect width="100%" height="100%"\t\t\t\t\tfill="#'+D.color+'" opacity="'+D.opacity+'"/>\t\t\t\t\t<defs><linearGradient id="gradbox_"/></defs></svg>',"text/xml").documentElement;C=a(k)[0].appendChild(document.importNode(C,true));u==="canvas"?C.setAttribute("width",60.5):
C.setAttribute("width","100%");this.rect=C.firstChild;this.defs=C.getElementsByTagName("defs")[0];this.grad=this.defs.firstChild;this.paint=new a.jGraduate.Paint({solidColor:D.color});this.type=u;this.setPaint=function(P,U){this.paint=P;var S="none",Y=P.type,aa=P.alpha/100;switch(Y){case "solidColor":S=P[Y]=="none"||P[Y]=="one"?"none":"#"+P[Y];break;case "linearGradient":case "radialGradient":this.defs.removeChild(this.grad);this.grad=this.defs.appendChild(P[Y]);S="url(#"+(this.grad.id="gradbox_"+
this.type)+")"}this.rect.setAttribute("fill",S);this.rect.setAttribute("opacity",aa);if(U){g.setColor(this.type,S,true);g.setPaintOpacity(this.type,aa,true)}if(this.type=="canvas")(Y=document.getElementById("canvas_background"))?Y.setAttribute("fill",S):Ka(S)};this.update=function(P){if(X){var U=this.type;switch(X.tagName){case "use":case "image":case "foreignObject":return;case "g":case "a":for(var S=null,Y=X.getElementsByTagName("*"),aa=0,ga=Y.length;aa<ga;aa++){var ra=Y[aa].getAttribute(U);if(aa===
0)S=ra;else if(S!==ra){S=null;break}}if(S===null){Y=null;return}Y=S;S=1;break;default:S=parseFloat(X.getAttribute(U+"-opacity"));if(isNaN(S))S=1;Y=U==="fill"?"black":"none";Y=X.getAttribute(U)||Y}if(P){g.setColor(U,Y,true);g.setPaintOpacity(U,S,true)}S*=100;this.setPaint(Ia(Y,S,U))}};this.prep=function(){switch(this.paint.type){case "linearGradient":case "radialGradient":var P=new a.jGraduate.Paint({copy:this.paint});g.setPaint(u,P)}}};c.paintBox.fill=new q("#fill_color","fill");c.paintBox.stroke=
new q("#stroke_color","stroke");c.paintBox.canvas=new q("#canvas_color","canvas");a("#stroke_width").val(curConfig.initStroke.width);a("#group_opacity").val(curConfig.initOpacity*100);q=c.paintBox.fill.rect.cloneNode(false);q.setAttribute("style","vector-effect:non-scaling-stroke");var H=q.style.vectorEffect==="non-scaling-stroke";q.removeAttribute("style");q=c.paintBox.fill.rect.ownerDocument.createElementNS("http://www.w3.org/2000/svg","feGaussianBlur");typeof q.stdDeviationX==="undefined"&&a("#tool_blur").hide();
a(q).remove();setTimeout(function(){g.embedImage("images/placeholder.svg",function(k){if(!k){a("#image_save_opts [value=embed]").attr("disabled","disabled");a("#image_save_opts input").val(["ref"]);s.img_save="ref";a("#image_opt_embed").css("color","#666").attr("title",uiStrings.notification.featNotSupported)}})},1E3);a("#tool_fill").click(function(){if(a("#tool_fill").hasClass("active"))w(a("#fill_color"));else{a("#tool_fill").addClass("active");a("#tool_stroke").removeClass("active")}});a("#tool_stroke").on("click",
function(){if(a("#tool_stroke").hasClass("active"))w(a("#stroke_color"));else{a("#tool_stroke").addClass("active");a("#tool_fill").removeClass("active")}});a("#tool_canvas").on("click touchstart",function(){w(a("#canvas_color"))});a("#tool_stroke").on("touchstart",function(){a("#tool_stroke").addClass("active");a("#tool_fill").removeClass("active");w(a("#stroke_color"))});a("#tool_fill").on("touchstart",function(){a("#tool_fill").addClass("active");a("#tool_stroke").removeClass("active");w(a("#fill_color"))});
a("#zoom_select").on("change",function(){var k=this.options[this.selectedIndex].text;k=k.split("%")[0];a("#zoom").val(k).trigger("change")});a(".push_button").mousedown(function(){a(this).hasClass("disabled")||a(this).addClass("push_button_pressed").removeClass("push_button")}).mouseout(function(){a(this).removeClass("push_button_pressed").addClass("push_button")}).mouseup(function(){a(this).removeClass("push_button_pressed").addClass("push_button")});a(window).bind("load resize",function(){R.css("line-height",
R.height()+"px")});var A=function(){var k=a("#canvas_width"),u=a("#canvas_height"),C=k.val(),D=u.val();if(C!="fit"&&!svgedit.units.isValidUnit("width",C)){a.alert(uiStrings.notification.invalidAttrValGiven);k.parent().addClass("error");return false}k.parent().removeClass("error");if(D!="fit"&&!svgedit.units.isValidUnit("height",D)){a.alert(uiStrings.notification.invalidAttrValGiven);u.parent().addClass("error");return false}u.parent().removeClass("error");if(!g.setResolution(C,D)){a.alert(uiStrings.notification.noContentToFitTo);
C=g.getResolution();k.val(C.w);u.val(C.h);return false}F()};a("#resolution").change(function(){var k=a("#canvas_width")[0],u=a("#canvas_height")[0];if(this.selectedIndex)if(this.value=="content"){k.value="fit";u.value="fit";A();var C=g.getResolution();k.value=C.w;u.value=C.h}else{var D=this.value.split("x");D[0]=parseInt(D[0]);D[1]=parseInt(D[1]);var P=D[0]-k.value,U=D[1]-u.value,S=Date.now(),Y=function(aa){aa=(aa-S)/1E3;aa=Math.pow(aa-1,3)+1;k.value=(D[0]-P+aa*P).toFixed(0);u.value=(D[1]-U+aa*U).toFixed(0);
A();if(aa>=1){aa=g.getResolution();a("#canvas_width").val(aa.w.toFixed());a("#canvas_height").val(aa.h.toFixed());a("#resolution_label").html("<div class='pull'>"+aa.w+"<span>\u00d7</span></br>"+aa.h+"</div>")}else requestAnimationFrame(Y)};Y(Date.now())}else{a("#resolution_label").html("Custom");k.removeAttribute("readonly");k.focus();k.select();if(k.value=="fit"){k.value=100;u.value=100}}});a("#zoom").change(function(){wa(this)});a("input,select").attr("autocomplete","off");var v=function(){var k=
[{sel:"#tool_select",fn:va,evt:"click",key:["V",true]},{sel:"#tool_fhpath",fn:fb,evt:"click",key:["Q",true]},{sel:"#tool_line",fn:La,evt:"click",key:["L",true]},{sel:"#tool_rect",fn:Va,evt:"click",key:["R",true],icon:"rect"},{sel:"#tool_ellipse",fn:Ea,evt:"mouseup",key:["C",true],icon:"ellipse"},{sel:"#tool_path",fn:Cb,evt:"click",key:["P",true]},{sel:"#tool_text",fn:bb,evt:"click",key:["T",true]},{sel:"#tool_image",fn:kb,evt:"mouseup"},{sel:"#tool_zoom",fn:sb,evt:"mouseup",key:["Z",true]},{sel:"#tool_clear",
fn:Ua,evt:"mouseup",key:[o+"N",true]},{sel:"#tool_save",fn:function(){ka?Pb():g.save({images:s.img_save,round_digits:6})},evt:"mouseup",key:[o+"S",true]},{sel:"#tool_export",fn:vb,evt:"mouseup"},{sel:"#tool_open",fn:xb,evt:"mouseup"},{sel:"#tool_import",fn:Ib,evt:"mouseup"},{sel:"#tool_source",fn:Qb,evt:"click",key:[o+"U",true]},{sel:"#tool_wireframe",fn:Fb,evt:"click"},{sel:"#tool_snap",fn:Jb,evt:"click"},{sel:"#tool_rulers",fn:Eb,evt:"click"},{sel:"#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel",
fn:h,evt:"click",key:["esc",false,false],hidekey:true},{sel:"#tool_source_save",fn:Pb,evt:"click"},{sel:"#tool_delete,#tool_delete_multi",fn:ua,evt:"click",key:["del/backspace",true]},{sel:"#tool_reorient",fn:la,evt:"click"},{sel:"#tool_node_link",fn:M,evt:"click"},{sel:"#tool_node_clone",fn:Q,evt:"click"},{sel:"#tool_node_delete",fn:ea,evt:"click"},{sel:"#tool_openclose_path",fn:Pa,evt:"click"},{sel:"#tool_add_subpath",fn:Ga,evt:"click"},{sel:"#tool_move_top",fn:ob,evt:"click",key:o+"shift+up"},
{sel:"#tool_move_bottom",fn:eb,evt:"click",key:o+"shift+down"},{sel:"#tool_move_up",fn:tb,evt:"click",key:[o+"up",true]},{sel:"#tool_move_down",fn:ub,evt:"click",key:[o+"down",true]},{sel:"#tool_topath",fn:Bb,evt:"click"},{sel:"#tool_make_link,#tool_make_link_multi",fn:ca,evt:"click"},{sel:"#tool_clone,#tool_clone_multi",fn:Nb,evt:"click",key:[o+"D",true]},{sel:"#tool_group",fn:Kb,evt:"click",key:[o+"G",true]},{sel:"#tool_ungroup",fn:Kb,evt:"click",key:o+"shift+G"},{sel:"#tool_unlink_use",fn:Kb,evt:"click"},
{sel:"[id^=tool_align]",fn:Lb,evt:"click"},{sel:"#tool_undo",fn:hb,evt:"click",key:o+"z"},{sel:"#tool_redo",fn:Ja,evt:"click",key:["y",true]},{sel:"#tool_cut",fn:mb,evt:"click",key:[o+"x",true]},{sel:"#tool_copy",fn:jb,evt:"click",key:o+"c"},{sel:"#tool_paste",fn:Ab,evt:"click",key:o+"v"},{sel:"#tool_switch",fn:Ob,evt:"click",key:["x",true]},{sel:"#tool_bold",fn:rb,evt:"mousedown",key:[o+"B",true]},{sel:"#tool_italic",fn:Qa,evt:"mousedown",key:[o+"I",true]},{sel:"#copy_save_done",fn:h,evt:"click"},
{key:"ctrl+left",fn:function(){nb(0,1)}},{key:"ctrl+right",fn:function(){nb(1,1)}},{key:"ctrl+shift+left",fn:function(){nb(0,5)}},{key:"ctrl+shift+right",fn:function(){nb(1,5)}},{key:"shift+O",fn:db},{key:"shift+P",fn:Ya},{key:[o+"+",true],fn:function(){Db(2)}},{key:[o+"-",true],fn:function(){Db(0.5)}},{key:["up",true],fn:function(){ja(0,-1)}},{key:["down",true],fn:function(){ja(0,1)}},{key:["left",true],fn:function(){ja(-1,0)}},{key:["right",true],fn:function(){ja(1,0)}},{key:"shift+up",fn:function(){ja(0,
-10)}},{key:"shift+down",fn:function(){ja(0,10)}},{key:"shift+left",fn:function(){ja(-10,0)}},{key:"shift+right",fn:function(){ja(10,0)}},{key:["alt+up",true],fn:function(){g.cloneSelectedElements(0,-1)}},{key:["alt+down",true],fn:function(){g.cloneSelectedElements(0,1)}},{key:["alt+left",true],fn:function(){g.cloneSelectedElements(-1,0)}},{key:["alt+right",true],fn:function(){g.cloneSelectedElements(1,0)}},{key:["alt+shift+up",true],fn:function(){g.cloneSelectedElements(0,-10)}},{key:["alt+shift+down",
true],fn:function(){g.cloneSelectedElements(0,10)}},{key:["alt+shift+left",true],fn:function(){g.cloneSelectedElements(-10,0)}},{key:["alt+shift+right",true],fn:function(){g.cloneSelectedElements(10,0)}},{key:o+"A",fn:function(){g.selectAllInCurrentLayer()}},{key:o+"shift+z",fn:Ja},{key:"esc",fn:Rb}],u={"4/Shift+4":"#tools_rect_show","5/Shift+5":"#tools_ellipse_show"};return{setAll:function(){var C={};a.each(k,function(D,P){if(P.sel){var U=a(P.sel);if(U.length==0)return true;if(P.evt){if(svgedit.browser.isTouch()&&
P.evt==="click")P.evt="mousedown";U[P.evt](P.fn)}if(P.parent&&a(P.parent+"_show").length!=0){var S=a(P.parent);S.length||(S=ma(P.parent.substr(1)));S.append(U);a.isArray(C[P.parent])||(C[P.parent]=[]);C[P.parent].push(P)}}if(P.key){var Y=P.fn,aa=false;if(a.isArray(P.key)){S=P.key[0];if(P.key.length>1)aa=P.key[1]}else S=P.key;S+="";svgedit.browser.isMac&&S.indexOf("+")!=-1&&S.split("+")[0]=="ctrl"&&S.replace("ctrl","cmd");a.each(S.split("/"),function(ra,Oa){a(document).bind("keydown",Oa,function(Ba){Y();
aa&&Ba.preventDefault();return false})});if(P.sel&&!P.hidekey&&U.attr("title")){var ga=U.attr("title").split("[")[0]+" ("+S+")";u[S]=P.sel;U.parents("#main_menu").length||U.attr("title",ga)}}});qa(C);a(window).bind("keydown","tab",function(D){if(pa==="canvas"){D.preventDefault();Ya()}}).bind("keydown","shift+tab",function(D){if(pa==="canvas"){D.preventDefault();db()}});a("#tool_zoom").dblclick(Za)},setTitles:function(){a.each(u,function(C,D){var P=a(D).parents("#main_menu").length;a(D).each(function(){var U=
P?a(this).text().split(" [")[0]:this.title.split(" [")[0],S="";a.each(C.split("/"),function(Y,aa){var ga=aa.split("+"),ra="";if(ga.length>1){ra=ga[0]+"+";aa=ga[1]}S+=(Y?"/":"")+ra+(uiStrings["key_"+aa]||aa)});if(P)this.lastChild.textContent=U+" ["+S+"]";else this.title=U+" ["+S+"]"})})},getButtonData:function(C){var D;a.each(k,function(P,U){if(U.sel===C)D=U});return D}}}();v.setAll();c.ready(function(){var k=curConfig.initTool,u=a("#tools_left, #svg_editor .tools_flyout"),C=u.find("#tool_"+k);k=u.find("#"+
k);(C.length?C:k.length?k:a("#tool_select")).click().mouseup();curConfig.wireframe&&a("#tool_wireframe").click();curConfig.showlayers&&toggleSidePanel();a("#rulers").toggle(!!curConfig.showRulers)});a("#canvas_height").dragInput({min:10,max:null,step:10,callback:A,cursor:false,dragAdjust:0.1});a("#canvas_width").dragInput({min:10,max:null,step:10,callback:A,cursor:false,dragAdjust:0.1});a("#rect_width").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_height").dragInput({min:0,
max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_cx").dragInput({min:0,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_cy").dragInput({min:0,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_rx").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_ry").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_height").dragInput({min:0,max:null,step:1,callback:changeAttribute,cursor:false});
a("#selected_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#selected_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_node_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_node_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_width").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_x1").dragInput({min:null,
max:null,step:1,callback:changeAttribute,cursor:false});a("#line_x2").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_y1").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_y2").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});
a("#rect_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#g_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#g_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#text_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,
cursor:false});a("#text_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_rx").dragInput({min:0,max:100,step:1,callback:function(k){g.setRectRadius(k.value)},cursor:true});a("#stroke_width").dragInput({min:0,max:99,step:1,callback:function(k){var u=k.value;if(u==0&&X&&["line","polyline"].indexOf(X.nodeName)>=0)u=k.value=1;g.setStrokeWidth(u)},cursor:true,smallStep:0.1,start:1.5});
a("#angle").dragInput({min:-180,max:180,step:1,callback:function(k){g.setRotationAngle(k.value);rotateCursor(k.value);a("#tool_reorient").toggleClass("disabled",k.value==0)},cursor:false});a("#font_size").dragInput({min:1,max:250,step:1,callback:function(k){g.setFontSize(k.value)},cursor:true,stepfunc:function(k,u){var C=k.value-0,D=C+u,P=D>=C;if(u===0)return C;return C>=24?P?Math.round(C*1.1):Math.round(C/1.1):C<=1?P?C*2:C/2:D}});a("#group_opacity").dragInput({min:0,max:100,step:5,callback:function(k,
u){if(u==null)u=k.value;a("#group_opacity").val(u);if(!k||!k.handle)a("#opac_slider").slider("option","value",u);g.setOpacity(u/100)},cursor:true,start:100});a("#blur").dragInput({min:0,max:10,step:0.1,callback:function(k){val=k.value;a("#blur").val(val);window.event.type=="mouseup"?g.setBlur(val,true):g.setBlurNoUndo(val)},cursor:true,start:0});a("#zoom").val(g.getZoom()*100);a("#workarea").contextMenu({menu:"cmenu_canvas",inSpeed:0},function(k){switch(k){case "delete":ua();break;case "cut":mb();
break;case "copy":jb();break;case "paste":g.pasteElements();break;case "paste_in_place":g.pasteElements("in_place");break;case "group":g.groupSelectedElements();break;case "ungroup":g.ungroupSelectedElement();break;case "move_front":ob();break;case "move_up":wb("Up");break;case "move_down":wb("Down");break;case "move_back":eb();break;default:svgedit.contextmenu&&svgedit.contextmenu.hasCustomHandler(k)&&svgedit.contextmenu.getCustomHandler(k).call()}});a(".contextMenu li").mousedown(function(k){k.preventDefault()});
a("#cmenu_canvas li").disableContextMenu();V.enableContextMenuItems("#delete,#cut,#copy");window.onbeforeunload=function(){if(T.getUndoStackSize()===0)c.show_save_warning=false;if(!curConfig.no_save_warning&&c.show_save_warning)return uiStrings.notification.unsavedChanges};c.openPrep=function(k){a("#main_menu").hide();T.getUndoStackSize()===0?k(true):a.confirm(uiStrings.notification.QwantToOpen,k)};if(window.FileReader){q=a('<input type="file">').change(function(){var k=this;c.openPrep(function(u){if(u){g.clear();
if(k.files.length==1){u=new FileReader;u.onloadend=function(C){p(C.target.result);F()};u.readAsText(k.files[0])}}})});a("#tool_open").show().prepend(q);q=a('<input type="file">').change(function(){a("#main_menu").hide();if(this.files.length==1){var k=new FileReader;k.onloadend=function(u){g.importSvgString(u.target.result,true);F()};k.readAsText(this.files[0])}});a("#tool_import").show().prepend(q)}for(var F=c.updateCanvas=function(k,u){var C=R.width(),D=R.height(),P=C,U=D,S=g.getZoom(),Y=a("#svgcanvas"),
aa={x:R[0].scrollLeft+P/2,y:R[0].scrollTop+U/2},ga=curConfig.canvas_expansion;C=Math.max(P,g.contentW*S*ga);D=Math.max(U,g.contentH*S*ga);C==P&&D==U?R.css("overflow","hidden"):R.css("overflow","scroll");ga=Y.height()/2;var ra=Y.width()/2;Y.width(C).height(D);var Oa=D/2,Ba=C/2,ha=g.updateCanvas(C,D),Ta=Ba/ra;C=C/2-P/2;D=D/2-U/2;if(u){u.x+=ha.x;u.y+=ha.y}else u={x:Ba+(aa.x-ra)*Ta,y:Oa+(aa.y-ga)*Ta};if(k)if(g.contentW>R.width()){R[0].scrollLeft=ha.x-10;R[0].scrollTop=ha.y-10}else{R[0].scrollLeft=C;R[0].scrollTop=
D}else{R[0].scrollLeft=u.x-P/2;R[0].scrollTop=u.y-U/2}if(curConfig.showRulers){l(Y,S);R.scroll()}},I=[],E=0.1;E<1E5;E*=10){I.push(1*E);I.push(2*E);I.push(5*E)}F(true);try{var G=function(k){if(window.JSON&&JSON.stringify)return JSON.stringify(k);var u=arguments.callee;if(typeof k=="boolean"||typeof k=="number")return k+"";else if(typeof k=="string")return'"'+k.replace(/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,function(P){return"\\u"+
("0000"+P.charCodeAt(0).toString(16)).slice(-4)})+'"';else if(k.length){for(var C=0;C<k.length;C++)k[C]=u(k[C]);return"["+k.join(",")+"]"}else{C=[];for(var D in k)C.push(u(D)+":"+u(k[D]));return"{"+C.join(",")+"}"}};window.addEventListener("message",function(k){var u=parseInt(k.data.substr(0,k.data.indexOf(";")));try{k.source.postMessage("SVGe"+u+";"+G(eval(k.data)),"*")}catch(C){k.source.postMessage("SVGe"+u+";error:"+C.message,"*")}},false)}catch(L){window.embed_error=L}a(function(){window.svgCanvas=
50))}var D=false,P=false,U=true,S=function(){if(u.callback&&!D&&U){D=true;u.callback()}},Y=[];u.context_tools&&a.each(u.context_tools,function(Ba,ha){var Ta=ha.container_id?' id="'+ha.container_id+'"':"",Ra=a("#"+ha.panel);Ra.length||(Ra=a("<div>",{id:ha.panel}).appendTo("#tools_top").hide());switch(ha.type){case "tool_button":var ua='<div class="tool_button">'+ha.id+"</div>",Ma=a(ua).appendTo(Ra);ha.events&&a.each(ha.events,function(Xa,cb){a(Ma).bind(Xa,cb)});break;case "select":ua="<label"+Ta+'><select id="'+
ha.id+'">';a.each(ha.options,function(Xa,cb){ua+='<option value="'+Xa+'"'+(Xa==ha.defval?" selected":"")+">"+cb+"</option>"});ua+="</select></label>";var xa=a(ua).appendTo(Ra).find("select");a.each(ha.events,function(Xa,cb){a(xa).bind(Xa,cb)});break;case "button-select":ua='<div id="'+ha.id+'" class="dropdown toolset" title="'+ha.title+'"><div id="cur_'+ha.id+'" class="icon_label"></div><button></button></div>';Ta=a('<ul id="'+ha.id+'_opts"></ul>').appendTo("#option_lists");ha.colnum&&Ta.addClass("optcols"+
ha.colnum);a(ua).appendTo(Ra).children();Y.push({elem:"#"+ha.id,list:"#"+ha.id+"_opts",title:ha.title,callback:ha.events.change,cur:"#cur_"+ha.id});break;case "input":ua="<label"+Ta+'><span id="'+ha.id+'_label">'+ha.label+':</span><input id="'+ha.id+'" title="'+ha.title+'" size="'+(ha.size||"4")+'" value="'+(ha.defval||"")+'" type="text"/></label>';var ab=a(ua).appendTo(Ra).find("input");ha.spindata&&ab.SpinButton(ha.spindata);ha.events&&a.each(ha.events,function(Xa,cb){ab.bind(Xa,cb)})}});if(u.buttons){var aa=
{},ga={},ra=u.svgicons,Oa={};a.each(u.buttons,function(Ba,ha){for(var Ta,Ra=ha.id,ua=Ba;a("#"+Ra).length;)Ra=ha.id+"_"+ ++ua;if(ra){aa[Ra]=ha.icon;ua=ha.svgicon?ha.svgicon:ha.id;if(ha.type=="app_menu")ga["#"+Ra+" > div"]=ua;else ga["#"+Ra]=ua}else Ta=ha.type=="menu"?"":a('<img src="'+ha.icon+'">');var Ma,xa;switch(ha.type){case "mode_flyout":case "mode":Ma="tool_button";if(ha.cls)Ma+=" "+ha.cls;xa="#tools_left";break;case "context":Ma="tool_button";xa="#"+ha.panel;a(xa).length||a("<div>",{id:ha.panel}).appendTo("#tools_top");
break;case "menu":Ma="menu_item tool_button";xa="#"+(ha.after||ha.panel);break;case "app_menu":Ma="";xa=ha.parent||"#main_menu ul";a(xa).length||a("<div>",{id:ha.panel}).appendTo("#tools_top")}var ab=a(ha.list||ha.type=="app_menu"?"<li/>":"<div/>").attr("id",Ra).attr("title",ha.title).addClass(Ma);if(!ha.includeWith&&!ha.list){if("position"in ha)a(xa).children().eq(ha.position).before(ab);else ha.type!="menu"||!ha.after?ab.appendTo(xa):a(xa).after(ab);if(ha.type=="mode_flyout"){ua=a(ab);Ma=ua.parent();
if(!ua.parent().hasClass("tools_flyout")){var Xa=ua[0].id.replace("tool_","tools_"),cb=ua.clone().attr("id",Xa+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));ua.before(cb);Ma=ma(Xa,ua);Ma.data("isLibrary",true);cb.data("isLibrary",true)}ga["#"+Xa+"_show"]=ha.id;Ra=Oa["#"+Ma[0].id]=[{sel:"#"+Ra,fn:ha.events.click,icon:ha.id,isDefault:true},Hb]}else if(ha.type=="app_menu"||ha.type=="menu")ab.append(ha.title)}else if(ha.list){ab.addClass("push_button");a("#"+ha.list+"_opts").append(ab);if(ha.isDefault){a("#cur_"+
ha.list).append(ab.children().clone());ua=ha.svgicon?ha.svgicon:ha.id;ga["#cur_"+ha.list]=ua}}else if(ha.includeWith){xa=ha.includeWith;ua=a(xa.button);Ma=ua.parent();if(!ua.parent().hasClass("tools_flyout")){Xa=ua[0].id.replace("tool_","tools_");cb=ua.clone().attr("id",Xa+"_show").append(a("<div>",{"class":"flyout_arrow_horiz"}));ua.before(cb);Ma=ma(Xa,ua)}var Hb=v.getButtonData(xa.button);if(xa.isDefault)ga["#"+Xa+"_show"]=ha.id;Ra=Oa["#"+Ma[0].id]=[{sel:"#"+Ra,fn:ha.events.click,icon:ha.id,key:ha.key,
isDefault:ha.includeWith?ha.includeWith.isDefault:0},Hb];Xa="position"in xa?xa.position:"last";Hb=Ma.children().length;if(!isNaN(Xa)&&Xa>=0&&Xa<Hb)Ma.children().eq(Xa).before(ab);else{Ma.append(ab);Ra.reverse()}}ra||ab.append(Ta);ha.list||a.each(ha.events,function(zb,Gb){if(zb=="click")if(ha.type=="mode"){ha.includeWith?ab.bind(zb,Gb):ab.bind(zb,function(){$a(ab)&&Gb()});if(ha.key){a(document).bind("keydown",ha.key,Gb);ha.title&&ab.attr("title",ha.title+" ["+ha.key+"]")}}else ab.bind(zb,Gb);else ab.bind(zb,
Gb)});qa(Oa)});a.each(Y,function(){Da(this.elem,this.list,this.callback,{seticon:true})});if(ra)U=false;a.svgIcons(ra,{w:27,h:27,id_match:false,no_img:!B,fallback:aa,placement:ga,callback:function(){s.iconsize&&s.iconsize!="m"&&C();U=true;S()}})}S()});g.textActions.setInputElem(a("#text")[0]);var ya='<div class="palette_item" data-rgb="none"></div>';a.each(["#000000","#3f3f3f","#7f7f7f","#bfbfbf","#ffffff","#ff0000","#ff7f00","#ffff00","#7fff00","#00ff00","#00ff7f","#00ffff","#007fff","#0000ff","#7f00ff",
"#ff00ff","#ff007f","#7f0000","#7f3f00","#7f7f00","#3f7f00","#007f00","#007f3f","#007f7f","#003f7f","#00007f","#3f007f","#7f007f","#7f003f","#ffaaaa","#ffd4aa","#ffffaa","#d4ffaa","#aaffaa","#aaffd4","#aaffff","#aad4ff"],function(k,u){ya+='<div class="palette_item" style="background-color: '+u+';" data-rgb="'+u+'"></div>'});a("#palette").append(ya);var Ha=a("#tool_angle_indicator");a("#tool_reorient");rotateCursor=function(k){k="rotate("+k+"deg)";Ha.css({"-webkit-transform":k,"-moz-transform":k,"-o-transform":k,
"-ms-transform":k,transform:k})};var wa=function(k){var u=k.value/100;if(u<0.0010)k.value=0.1;else{k=g.getZoom();W(window,{width:0,height:0,x:(R[0].scrollLeft+R.width()/2)/k,y:(R[0].scrollTop+R.height()/2)/k,zoom:u},true)}},qb=function(){window.opera&&a("<p/>").hide().appendTo("body").remove()};a("#stroke_style").change(function(){g.setStrokeAttr("stroke-dasharray",a(this).val());a("#stroke_style_label").html(this.options[this.selectedIndex].text);qb()});a("#seg_type").change(function(){g.setSegType(a(this).val());
a("#seg_type_label").html(this.options[this.selectedIndex].text)});a("select").change(function(){a(this).blur()});a("#font_family").change(function(){g.setFontFamily(this.value)});a("#text").keyup(function(){g.setTextContent(this.value)});changeAttribute=function(k,u){var C=k.getAttribute("data-attr"),D=k.value;if(!svgedit.units.isValidUnit(C,D,X)){a.alert(uiStrings.notification.invalidAttrValGiven);k.value=X.getAttribute(C);return false}u?g.changeSelectedAttributeNoUndo(C,D):g.changeSelectedAttribute(C,
D)};a("#palette").mouseover(function(){var k=a('<input type="hidden">');a(this).append(k);k.focus().remove()});a(".palette_item").on("mousedown touchstart touchmove",function(){var k=a("#tool_stroke").hasClass("active"),u=k?"stroke":"fill",C=a(this).attr("data-rgb"),D=null;if(C==="transparent"||C==="initial"||C==="#none"){C="none";D=new a.jGraduate.Paint}else D=new a.jGraduate.Paint({alpha:100,solidColor:C.substr(1)});c.paintBox[u].setPaint(D);if(k){g.setColor("stroke",C);C!="none"&&g.getStrokeOpacity()!=
1&&g.setPaintOpacity("stroke",1)}else{g.setColor("fill",C);C!="none"&&g.getFillOpacity()!=1&&g.setPaintOpacity("fill",1)}}).bind("contextmenu",function(k){k.preventDefault()});a("#toggle_stroke_tools").toggle(function(){a(".stroke_tool").css("display","table-cell");a(this).addClass("expanded");z()},function(){a(".stroke_tool").css("display","none");a(this).removeClass("expanded");z()});var $a=function(k,u){if(a(k).hasClass("disabled"))return false;if(a(k).parent().hasClass("tools_flyout"))return true;
var C=C||"normal";u||a(".tools_flyout").fadeOut(C);a("#styleoverrides").text("");a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");a(k).addClass("tool_button_current").removeClass("tool_button");return true};(function(){var k=null,u=null,C=R[0],D=false,P=false;a("#svgcanvas").bind("mousemove mouseup touchend",function(U){if(D!==false){C.scrollLeft-=U.clientX-k;C.scrollTop-=U.clientY-u;k=U.clientX;u=U.clientY;if(U.type==="mouseup"||U.type==="touchend")D=false;return false}}).on("mousedown touchmove",
function(U){if(U.button===1||P===true||U.originalEvent.touches&&U.originalEvent.touches.length>=2){D=true;k=U.clientX;u=U.clientY;return false}});a(window).mouseup(function(){D=false;a("body").removeClass("dragging")});a(document).bind("keydown","space",function(U){U.preventDefault();g.spaceKey=P=true}).bind("keyup","space",function(U){U.preventDefault();g.spaceKey=P=false}).bind("keydown","alt",function(){g.getMode()==="zoom"&&R.addClass("out")}).bind("keyup","alt",function(){g.getMode()==="zoom"&&
R.removeClass("out")})})();var ib=a(".menu"),Wa=function(k){k.target.style.background="#fff";setTimeout(function(){k.target.style.background="#ddd"},50);setTimeout(function(){k.target.style.background="#fff"},150);setTimeout(function(){k.target.style.background="#ddd"},200);setTimeout(function(){k.target.style.background=""},200);setTimeout(function(){a("#menu_bar").removeClass("active")},220);return false};a(".menu_item").on("mousedown touchstart",function(k){Wa(k)});a("svg, body").on("mousedown touchstart",
function(k){top!=self&&!k.isTrigger&&typeof top.exports.focus_editor=="function"&&top.exports.focus_editor();if(k.target.nodeName.toLowerCase()!=="input")if(!a(k.target).hasClass("menu_title")&&!a(k.target).parent().hasClass("menu_title"))!a(k.target).hasClass("disabled")&&a(k.target).hasClass("menu_item")?Wa(k):a("#menu_bar").removeClass("active")});var Sa=[6,12,16,33,50,66,100,150,200,300,400,600,800,1200];a("#workarea").on("mousewheel",function(k,u,C,D){if(k.altKey){k.preventDefault();k=g.getZoom()*
100;u=Sa.length;for(E=0;E<u;E++){C=Math.min(u,E+1);if(D>0)zoom=Sa[E]<=k?Sa[C]:zoom;if(D<0)zoom=Sa[E]<k?Sa[E]:zoom}zoom&&wa({value:zoom})}});a(".menu_title").on("mousedown",function(){a("#tools_shapelib").hide();a("#menu_bar").toggleClass("active");ib.removeClass("open");a(this).parent().addClass("open")}).on("mouseover",function(){ib.removeClass("open");a(this).parent().addClass("open")});c.addDropDown=function(k,u,C){if(a(k).length!=0){var D=a(k).find("button"),P=a(k).find("ul").attr("id",a(k)[0].id+
"-list");C||a("#option_lists").append(P);var U=false;C&&a(k).addClass("dropup");P.find("li").bind("mouseup",u);a(window).mouseup(function(){if(!U){D.removeClass("down");P.hide()}U=false});D.bind("mousedown",function(){if(D.hasClass("down")){D.removeClass("down");P.hide()}else{D.addClass("down");if(!C){var S=a(k).offset();P.css({top:S.top,left:S.left-110})}P.show();U=true}}).hover(function(){U=true}).mouseout(function(){U=false})}};var Da=function(k,u,C,D){var P=a(k);u=a(u);var U=false,S=D.dropUp;
S&&a(k).addClass("dropup");u.find("li").bind("mouseup",function(){if(D.seticon){yb("#cur_"+P[0].id,a(this).children());a(this).addClass("current").siblings().removeClass("current")}C.apply(this,arguments)});a(window).mouseup(function(){if(!U){P.removeClass("down");u.hide();u.css({top:0,left:0})}U=false});u.height();a(k).bind("mousedown",function(){var Y=a(k).offset();if(S){Y.top-=u.height();Y.left+=8}else Y.top+=a(k).height();a(u).offset(Y);if(P.hasClass("down")){P.removeClass("down");u.hide();u.css({top:0,
left:0})}else{P.addClass("down");u.show();U=true;return false}}).hover(function(){U=true}).mouseout(function(){U=false});D.multiclick&&u.mousedown(function(){U=true})};a("#font_family_dropdown").change(function(){var k=this.options[this.selectedIndex].value,u=this.options[this.selectedIndex].text;a("#preview_font").html(u).css("font-family",k);a("#font_family").val(k).change()});a("div","#position_opts").each(function(){this.addEventListener("mouseup",function(){var k=this.id.replace("tool_pos","").charAt(0);
g.alignSelectedElements(k,"page")})});(function(){var k,u=function(){a(k).blur()};a("#svg_editor").find("button, select, input:not(#text)").focus(function(){k=this;pa="toolbars";R.mousedown(u)}).blur(function(){pa="canvas";R.unbind("mousedown",u);g.getMode()=="textedit"&&a("#text").focus()})})();var va=function(){$a("#tool_select")&&g.setMode("select")},fb=function(){$a("#tool_fhpath")&&g.setMode("fhpath")},La=function(){$a("#tool_line")&&g.setMode("line")},Va=function(){$a("#tool_rect")&&g.setMode("rect")},
Ea=function(){$a("#tool_ellipse")&&g.setMode("ellipse")},kb=function(){$a("#tool_image")&&g.setMode("image")},sb=function(){$a("#tool_zoom")&&g.setMode("zoom")},Za=function(){if($a("#tool_zoom")){Db();ba()}},bb=function(){$a("#tool_text")&&g.setMode("text")},Cb=function(){$a("#tool_path")&&g.setMode("path")},ta=function(){if(X!=null||sa)g.deleteSelectedElements()},mb=function(){if(X!=null||sa){window.event.type==="keydown"&&pb(a("#edit_menu"));g.cutSelectedElements()}},jb=function(){if(X!=null||sa){window.event.type===
"keydown"&&pb(a("#edit_menu"));g.copySelectedElements()}},Ab=function(){window.event.type==="keydown"&&pb(a("#edit_menu"));var k=g.getZoom(),u=(R[0].scrollLeft+R.width()/2)/k-g.contentW;k=(R[0].scrollTop+R.height()/2)/k-g.contentH;g.pasteElements("point",u,k)},ob=function(){if(X!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveToTopSelectedElement()}},eb=function(){if(X!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveToBottomSelectedElement()}},tb=function(){if(X!=
null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveUpDownSelected("Up")}},ub=function(){if(X!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveUpDownSelected("Down")}},wb=function(k){if(X!=null){window.event.type==="keydown"&&pb(a("#object_menu"));g.moveUpDownSelected(k)}},Bb=function(){if(X!=null){g.convertToPath();elems=g.getSelectedElems();g.selectorManager.requestSelector(elems[0]).selectorRect.setAttribute("display","none");g.setMode("pathedit");K.toEditMode(elems[0]);
g.clearSelection()}},la=function(){X!=null&&K.reorient()},ca=function(){if(X!=null||sa)a.prompt(uiStrings.notification.enterNewLinkURL,"http://",function(k){k&&g.makeHyperlink(k)})},ja=function(k,u){if(X!=null||sa){if(curConfig.gridSnapping){var C=g.getZoom()*curConfig.snappingStep;k*=C;u*=C}a("input").blur();g.moveSelectedElements(k,u)}},M=function(){var k=!a("#tool_node_link").hasClass("checked");k?a("#tool_node_link").addClass("checked").find("input").attr("checked",true):a("#tool_node_link").removeClass("checked").find("input").attr("checked",
false);K.linkControlPoints(k)},Q=function(){K.getNodePoint()&&K.clonePathNode()},ea=function(){K.getNodePoint()&&K.deletePathNode()},Ga=function(){var k=a("#tool_add_subpath"),u=!k.hasClass("push_button_pressed");u?k.addClass("push_button_pressed").removeClass("tool_button"):k.removeClass("push_button_pressed").addClass("tool_button");K.addSubPath(u)},Pa=function(){K.opencloseSubPath()},Ya=function(){g.cycleElement(1)},db=function(){g.cycleElement(0)},nb=function(k,u){if(!(X==null||sa)){k||(u*=-1);
var C=a("#angle").val()*1+u;g.setRotationAngle(C);za()}},Ua=function(){var k=curConfig.dimensions;a.confirm(uiStrings.notification.QwantToClear,function(u){if(u){ba();g.clear();g.setResolution(k[0],k[1]);F(true);Db();za();Z();g.runExtensions("onNewDocument")}})},rb=function(){g.setBold(!g.getBold());za();return false},Qa=function(){g.setItalic(!g.getItalic());za();return false},vb=function(){if(!b.pngsave){var k=uiStrings.notification.loadingImage;O=window.open("data:text/html;charset=utf-8,<title>"+
k+"</title><h1>"+k+"</h1>")}window.canvg?g.rasterExport():a.getScript("canvg/rgbcolor.js",function(){a.getScript("canvg/canvg.js",function(){g.rasterExport()})})},xb=function(){g.open()},Ib=function(){},pb=function(k){var u=k.prev();u.css("background","#09f");setTimeout(function(){u.css("background","")},200)},hb=function(){if(T.getUndoStackSize()>0){window.event.type==="keydown"&&pb(a("#edit_menu"));T.undo()}},Ja=function(){if(T.getRedoStackSize()>0){window.event.type==="keydown"&&pb(a("#edit_menu"));
T.redo()}},Kb=function(){if(sa)g.groupSelectedElements();else X&&g.ungroupSelectedElement()},Nb=function(){window.event.type==="keydown"&&pb(a("#edit_menu"));g.cloneSelectedElements(20,20)},Lb=function(){var k=this.id.replace("tool_align","").charAt(0);g.alignSelectedElements(k,a("#align_relative_to").val())},Ob=function(){var k=document.querySelector("#tool_stroke rect"),u=document.querySelector("#tool_fill rect"),C=u.getAttribute("fill"),D=k.getAttribute("fill");k=parseFloat(k.getAttribute("stroke-opacity"));
if(isNaN(k))k=100;u=parseFloat(u.getAttribute("fill-opacity"));if(isNaN(u))u=100;D=Ia(D,k,"stroke");C=Ia(C,u,"fill");c.paintBox.fill.setPaint(D,true);c.paintBox.stroke.setPaint(C,true)},Db=function(k){var u=g.getResolution();k=k?u.zoom*k:1;a("#zoom").val(k*100);g.setZoom(k);lb();F(true)},Fb=function(){!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"):a("#tool_wireframe").removeClass("push_button_pressed");R.toggleClass("wireframe");if(!H){var k=
a("#wireframe_rules");k.length?k.empty():a('<style id="wireframe_rules"></style>').appendTo("head");lb()}},Jb=function(){var k=!a("#tool_snap").hasClass("push_button_pressed");k?a("#tool_snap").addClass("push_button_pressed"):a("#tool_snap").removeClass("push_button_pressed");curConfig.gridSnapping=k},Rb=function(){window.self!=window.top&&top.exports.setEditorFocus(false)},Eb=function(){if(a("#tool_rulers").hasClass("push_button_pressed")){a("#tool_rulers").removeClass("push_button_pressed");a("#show_rulers").attr("checked",
false);curConfig.showRulers=false}else{a("#tool_rulers").addClass("push_button_pressed");a("#show_rulers").attr("checked",true);curConfig.showRulers=true}a("#rulers").toggle(!!curConfig.showRulers)},lb=function(){if(!H){var k="#workarea.wireframe #svgcontent * { stroke-width: "+1/g.getZoom()+"px; }";a("#wireframe_rules").text(R.hasClass("wireframe")?k:"")}},Qb=function(k,u){if(!ka){ka=true;a("#save_output_btns").toggle(!!u);a("#tool_source_back").toggle(!u);var C=fa=g.getSvgString();a("#svg_source_textarea").val(C);
a("#svg_source_editor").fadeIn();C=a("#svg_source_container").height()-50;a("#svg_source_textarea").css("height",C);a("#svg_source_textarea").focus()}},Pb=function(){if(ka){if(g.setSvgString(a("#svg_source_textarea").val())){g.clearSelection();m();Db();Z()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(k){if(!k)return false;g.clearSelection();m();Db();Z()});ba()}},yb=c.setIcon=function(k,u){var C=typeof u==="string"?a.getSvgIcon(u,true):u.clone();C?a(k).find("img").replaceWith(C):
console.log("NOTE: Icon image missing: "+u)},gb;gb=function(){var k=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,u=document.getElementsByTagName("script")[0],C;for(C in u.style)if(k.test(C))return C.match(k)[0];if("WebkitOpacity"in u.style)return"Webkit";if("KhtmlOpacity"in u.style)return"Khtml";return""}();var Mb=function(k,u){gb.toLowerCase();var C=["top","left","bottom","right"];k.each(function(){for(var D=a(this),P=D.outerWidth()*(u-1),U=D.outerHeight()*(u-1),S=0;S<4;S++){var Y=C[S],aa=D.data("orig_margin-"+
Y);if(aa==null){aa=parseInt(D.css("margin-"+Y));D.data("orig_margin-"+Y,aa)}aa=aa*u;if(Y==="right")aa+=P;else if(Y==="bottom")aa+=U;D.css("margin-"+Y,aa)}})},e=c.setIconSize=function(k,u){if(!(k==s.size&&!u)){var C=a("#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout"),D=1;D=typeof k=="number"?k:{s:0.75,m:1,l:1.25,xl:1.5}[k];c.tool_scale=ia=D;na();
var P=C.parents(":hidden");P.css("visibility","hidden").show();Mb(C,D);P.css("visibility","visible").hide();C=a("#tool_size_rules");if(C.length)C.empty();else C=a('<style id="tool_size_rules"></style>').appendTo("head");if(k!="m"){var U="";a.each(cssResizeRules,function(S,Y){S="#svg_editor "+S.replace(/,/g,", #svg_editor");U+=S+"{";a.each(Y,function(aa,ga){if(typeof ga==="number")var ra=ga*D+"px";else if(ga[k]||ga.all)ra=ga[k]||ga.all;U+=aa+":"+ra+";"});U+="}"});P="-"+gb.toLowerCase()+"-";U+="#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout{"+
P+"transform: scale("+D+");} #svg_editor div.toolset .toolset {"+P+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+P+"transform: scale("+1/D+");}";C.text(U)}na()}},h=function(){a("#dialog_box").hide();if(ka){if(ka)fa!==a("#svg_source_textarea").val()?a.confirm(uiStrings.notification.QignoreSourceChanges,function(k){k&&m()}):m();z()}else da&&g.leaveContext()},m=function(){a("#svg_source_editor").hide();ka=false;a("#svg_source_textarea").blur()};a(window).width();a(window).height();
var z=a.noop;a(window).resize(function(){F()});(function(){R.scroll(function(){if(a("#ruler_x").length!=0)a("#ruler_x")[0].scrollLeft=R[0].scrollLeft;if(a("#ruler_y").length!=0)a("#ruler_y")[0].scrollTop=R[0].scrollTop})})();a("#url_notice").click(function(){a.alert(this.title)});a("#change_image_url").click(function(){var k=g.getHref(X);k=k.indexOf("data:")===0?"":k;a.prompt(uiStrings.notification.enterNewImgURL,k,function(u){u&&Na(u)})});var w=function(k){var u=k[0].id=="stroke_color"?"stroke":
"fill",C=k[0].id=="canvas_color";if(C)u="canvas";var D=c.paintBox[u].paint;k=u=="stroke"?"Pick a Stroke Paint and Opacity":"Pick a Fill Paint and Opacity";C=C?{right:200,top:50}:{left:45,bottom:50};a("#color_picker").draggable({cancel:".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker",containment:"window"}).css(C).jGraduate({paint:D,window:{pickerTitle:k},images:{clientPath:curConfig.jGraduatePath},newstop:"inverse"},function(P){D=new a.jGraduate.Paint(P);c.paintBox[u].setPaint(D);
g.setPaint(u,D);a("#color_picker").hide()},function(){a("#color_picker").hide()})};q=function(k,u){var C=document.getElementById("canvas_background"),D={color:"fff",opacity:1};if(u=="stroke")D=curConfig.initStroke;if(u=="fill")D=curConfig.initFill;if(u=="canvas"&&C)if(C=C.getAttribute("fill").match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))D={color:("0"+parseInt(C[1],10).toString(16)).slice(-2)+("0"+parseInt(C[2],10).toString(16)).slice(-2)+("0"+parseInt(C[3],10).toString(16)).slice(-2),opacity:1};C=(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg"><rect width="100%" height="100%"\t\t\t\t\tfill="#'+
D.color+'" opacity="'+D.opacity+'"/>\t\t\t\t\t<defs><linearGradient id="gradbox_"/></defs></svg>',"text/xml").documentElement;C=a(k)[0].appendChild(document.importNode(C,true));u==="canvas"?C.setAttribute("width",60.5):C.setAttribute("width","100%");this.rect=C.firstChild;this.defs=C.getElementsByTagName("defs")[0];this.grad=this.defs.firstChild;this.paint=new a.jGraduate.Paint({solidColor:D.color});this.type=u;this.setPaint=function(P,U){this.paint=P;var S="none",Y=P.type,aa=P.alpha/100;switch(Y){case "solidColor":S=
P[Y]=="none"||P[Y]=="one"?"none":"#"+P[Y];break;case "linearGradient":case "radialGradient":this.defs.removeChild(this.grad);this.grad=this.defs.appendChild(P[Y]);S="url(#"+(this.grad.id="gradbox_"+this.type)+")"}this.rect.setAttribute("fill",S);this.rect.setAttribute("opacity",aa);if(U){g.setColor(this.type,S,true);g.setPaintOpacity(this.type,aa,true)}if(this.type=="canvas")(Y=document.getElementById("canvas_background"))?Y.setAttribute("fill",S):Ka(S)};this.update=function(P){if(X){var U=this.type;
switch(X.tagName){case "use":case "image":case "foreignObject":return;case "g":case "a":for(var S=null,Y=X.getElementsByTagName("*"),aa=0,ga=Y.length;aa<ga;aa++){var ra=Y[aa].getAttribute(U);if(aa===0)S=ra;else if(S!==ra){S=null;break}}if(S===null){Y=null;return}Y=S;S=1;break;default:S=parseFloat(X.getAttribute(U+"-opacity"));if(isNaN(S))S=1;Y=U==="fill"?"black":"none";Y=X.getAttribute(U)||Y}if(P){g.setColor(U,Y,true);g.setPaintOpacity(U,S,true)}S*=100;this.setPaint(Ia(Y,S,U))}};this.prep=function(){switch(this.paint.type){case "linearGradient":case "radialGradient":var P=
new a.jGraduate.Paint({copy:this.paint});g.setPaint(u,P)}}};c.paintBox.fill=new q("#fill_color","fill");c.paintBox.stroke=new q("#stroke_color","stroke");c.paintBox.canvas=new q("#canvas_color","canvas");a("#stroke_width").val(curConfig.initStroke.width);a("#group_opacity").val(curConfig.initOpacity*100);q=c.paintBox.fill.rect.cloneNode(false);q.setAttribute("style","vector-effect:non-scaling-stroke");var H=q.style.vectorEffect==="non-scaling-stroke";q.removeAttribute("style");q=c.paintBox.fill.rect.ownerDocument.createElementNS("http://www.w3.org/2000/svg",
"feGaussianBlur");typeof q.stdDeviationX==="undefined"&&a("#tool_blur").hide();a(q).remove();setTimeout(function(){g.embedImage("images/placeholder.svg",function(k){if(!k){a("#image_save_opts [value=embed]").attr("disabled","disabled");a("#image_save_opts input").val(["ref"]);s.img_save="ref";a("#image_opt_embed").css("color","#666").attr("title",uiStrings.notification.featNotSupported)}})},1E3);a("#tool_fill").click(function(){if(a("#tool_fill").hasClass("active"))w(a("#fill_color"));else{a("#tool_fill").addClass("active");
a("#tool_stroke").removeClass("active")}});a("#tool_stroke").on("click",function(){if(a("#tool_stroke").hasClass("active"))w(a("#stroke_color"));else{a("#tool_stroke").addClass("active");a("#tool_fill").removeClass("active")}});a("#tool_canvas").on("click touchstart",function(){w(a("#canvas_color"))});a("#tool_stroke").on("touchstart",function(){a("#tool_stroke").addClass("active");a("#tool_fill").removeClass("active");w(a("#stroke_color"))});a("#tool_fill").on("touchstart",function(){a("#tool_fill").addClass("active");
a("#tool_stroke").removeClass("active");w(a("#fill_color"))});a("#zoom_select").on("change",function(){var k=this.options[this.selectedIndex].text;k=k.split("%")[0];a("#zoom").val(k).trigger("change")});a(".push_button").mousedown(function(){a(this).hasClass("disabled")||a(this).addClass("push_button_pressed").removeClass("push_button")}).mouseout(function(){a(this).removeClass("push_button_pressed").addClass("push_button")}).mouseup(function(){a(this).removeClass("push_button_pressed").addClass("push_button")});
a(window).bind("load resize",function(){R.css("line-height",R.height()+"px")});var A=function(){var k=a("#canvas_width"),u=a("#canvas_height"),C=k.val(),D=u.val();if(C!="fit"&&!svgedit.units.isValidUnit("width",C)){a.alert(uiStrings.notification.invalidAttrValGiven);k.parent().addClass("error");return false}k.parent().removeClass("error");if(D!="fit"&&!svgedit.units.isValidUnit("height",D)){a.alert(uiStrings.notification.invalidAttrValGiven);u.parent().addClass("error");return false}u.parent().removeClass("error");
if(!g.setResolution(C,D)){a.alert(uiStrings.notification.noContentToFitTo);C=g.getResolution();k.val(C.w);u.val(C.h);return false}F()};a("#resolution").change(function(){var k=a("#canvas_width")[0],u=a("#canvas_height")[0];if(this.selectedIndex)if(this.value=="content"){k.value="fit";u.value="fit";A();var C=g.getResolution();k.value=C.w;u.value=C.h}else{var D=this.value.split("x");D[0]=parseInt(D[0]);D[1]=parseInt(D[1]);var P=D[0]-k.value,U=D[1]-u.value,S=Date.now(),Y=function(aa){aa=(aa-S)/1E3;aa=
Math.pow(aa-1,3)+1;k.value=(D[0]-P+aa*P).toFixed(0);u.value=(D[1]-U+aa*U).toFixed(0);A();if(aa>=1){aa=g.getResolution();a("#canvas_width").val(aa.w.toFixed());a("#canvas_height").val(aa.h.toFixed());a("#resolution_label").html("<div class='pull'>"+aa.w+"<span>\u00d7</span></br>"+aa.h+"</div>")}else requestAnimationFrame(Y)};Y(Date.now())}else{a("#resolution_label").html("Custom");k.removeAttribute("readonly");k.focus();k.select();if(k.value=="fit"){k.value=100;u.value=100}}});a("#zoom").change(function(){wa(this)});
a("input,select").attr("autocomplete","off");var v=function(){var k=[{sel:"#tool_select",fn:va,evt:"click",key:["V",true]},{sel:"#tool_fhpath",fn:fb,evt:"click",key:["Q",true]},{sel:"#tool_line",fn:La,evt:"click",key:["L",true]},{sel:"#tool_rect",fn:Va,evt:"click",key:["R",true],icon:"rect"},{sel:"#tool_ellipse",fn:Ea,evt:"mouseup",key:["C",true],icon:"ellipse"},{sel:"#tool_path",fn:Cb,evt:"click",key:["P",true]},{sel:"#tool_text",fn:bb,evt:"click",key:["T",true]},{sel:"#tool_image",fn:kb,evt:"mouseup"},
{sel:"#tool_zoom",fn:sb,evt:"mouseup",key:["Z",true]},{sel:"#tool_clear",fn:Ua,evt:"mouseup",key:[o+"N",true]},{sel:"#tool_save",fn:function(){ka?Pb():g.save({images:s.img_save,round_digits:6})},evt:"mouseup",key:[o+"S",true]},{sel:"#tool_export",fn:vb,evt:"mouseup"},{sel:"#tool_open",fn:xb,evt:"mouseup"},{sel:"#tool_import",fn:Ib,evt:"mouseup"},{sel:"#tool_source",fn:Qb,evt:"click",key:[o+"U",true]},{sel:"#tool_wireframe",fn:Fb,evt:"click"},{sel:"#tool_snap",fn:Jb,evt:"click"},{sel:"#tool_rulers",
fn:Eb,evt:"click"},{sel:"#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel",fn:h,evt:"click",key:["esc",false,false],hidekey:true},{sel:"#tool_source_save",fn:Pb,evt:"click"},{sel:"#tool_delete,#tool_delete_multi",fn:ta,evt:"click",key:["del/backspace",true]},{sel:"#tool_reorient",fn:la,evt:"click"},{sel:"#tool_node_link",fn:M,evt:"click"},{sel:"#tool_node_clone",fn:Q,evt:"click"},{sel:"#tool_node_delete",fn:ea,evt:"click"},{sel:"#tool_openclose_path",fn:Pa,evt:"click"},
{sel:"#tool_add_subpath",fn:Ga,evt:"click"},{sel:"#tool_move_top",fn:ob,evt:"click",key:o+"shift+up"},{sel:"#tool_move_bottom",fn:eb,evt:"click",key:o+"shift+down"},{sel:"#tool_move_up",fn:tb,evt:"click",key:[o+"up",true]},{sel:"#tool_move_down",fn:ub,evt:"click",key:[o+"down",true]},{sel:"#tool_topath",fn:Bb,evt:"click"},{sel:"#tool_make_link,#tool_make_link_multi",fn:ca,evt:"click"},{sel:"#tool_clone,#tool_clone_multi",fn:Nb,evt:"click",key:[o+"D",true]},{sel:"#tool_group",fn:Kb,evt:"click",key:[o+
"G",true]},{sel:"#tool_ungroup",fn:Kb,evt:"click",key:o+"shift+G"},{sel:"#tool_unlink_use",fn:Kb,evt:"click"},{sel:"[id^=tool_align]",fn:Lb,evt:"click"},{sel:"#tool_undo",fn:hb,evt:"click",key:o+"z"},{sel:"#tool_redo",fn:Ja,evt:"click",key:["y",true]},{sel:"#tool_cut",fn:mb,evt:"click",key:[o+"x",true]},{sel:"#tool_copy",fn:jb,evt:"click",key:o+"c"},{sel:"#tool_paste",fn:Ab,evt:"click",key:o+"v"},{sel:"#tool_switch",fn:Ob,evt:"click",key:["x",true]},{sel:"#tool_bold",fn:rb,evt:"mousedown",key:[o+
"B",true]},{sel:"#tool_italic",fn:Qa,evt:"mousedown",key:[o+"I",true]},{sel:"#copy_save_done",fn:h,evt:"click"},{key:"ctrl+left",fn:function(){nb(0,1)}},{key:"ctrl+right",fn:function(){nb(1,1)}},{key:"ctrl+shift+left",fn:function(){nb(0,5)}},{key:"ctrl+shift+right",fn:function(){nb(1,5)}},{key:"shift+O",fn:db},{key:"shift+P",fn:Ya},{key:[o+"+",true],fn:function(){Db(2)}},{key:[o+"-",true],fn:function(){Db(0.5)}},{key:["up",true],fn:function(){ja(0,-1)}},{key:["down",true],fn:function(){ja(0,1)}},
{key:["left",true],fn:function(){ja(-1,0)}},{key:["right",true],fn:function(){ja(1,0)}},{key:"shift+up",fn:function(){ja(0,-10)}},{key:"shift+down",fn:function(){ja(0,10)}},{key:"shift+left",fn:function(){ja(-10,0)}},{key:"shift+right",fn:function(){ja(10,0)}},{key:["alt+up",true],fn:function(){g.cloneSelectedElements(0,-1)}},{key:["alt+down",true],fn:function(){g.cloneSelectedElements(0,1)}},{key:["alt+left",true],fn:function(){g.cloneSelectedElements(-1,0)}},{key:["alt+right",true],fn:function(){g.cloneSelectedElements(1,
0)}},{key:["alt+shift+up",true],fn:function(){g.cloneSelectedElements(0,-10)}},{key:["alt+shift+down",true],fn:function(){g.cloneSelectedElements(0,10)}},{key:["alt+shift+left",true],fn:function(){g.cloneSelectedElements(-10,0)}},{key:["alt+shift+right",true],fn:function(){g.cloneSelectedElements(10,0)}},{key:o+"A",fn:function(){g.selectAllInCurrentLayer()}},{key:o+"shift+z",fn:Ja},{key:"esc",fn:Rb}],u={"4/Shift+4":"#tools_rect_show","5/Shift+5":"#tools_ellipse_show"};return{setAll:function(){var C=
{};a.each(k,function(D,P){if(P.sel){var U=a(P.sel);if(U.length==0)return true;if(P.evt){if(svgedit.browser.isTouch()&&P.evt==="click")P.evt="mousedown";U[P.evt](P.fn)}if(P.parent&&a(P.parent+"_show").length!=0){var S=a(P.parent);S.length||(S=ma(P.parent.substr(1)));S.append(U);a.isArray(C[P.parent])||(C[P.parent]=[]);C[P.parent].push(P)}}if(P.key){var Y=P.fn,aa=false;if(a.isArray(P.key)){S=P.key[0];if(P.key.length>1)aa=P.key[1]}else S=P.key;S+="";svgedit.browser.isMac&&S.indexOf("+")!=-1&&S.split("+")[0]==
"ctrl"&&S.replace("ctrl","cmd");a.each(S.split("/"),function(ra,Oa){a(document).bind("keydown",Oa,function(Ba){Y();aa&&Ba.preventDefault();return false})});if(P.sel&&!P.hidekey&&U.attr("title")){var ga=U.attr("title").split("[")[0]+" ("+S+")";u[S]=P.sel;U.parents("#main_menu").length||U.attr("title",ga)}}});qa(C);a(window).bind("keydown","tab",function(D){if(pa==="canvas"){D.preventDefault();Ya()}}).bind("keydown","shift+tab",function(D){if(pa==="canvas"){D.preventDefault();db()}});a("#tool_zoom").dblclick(Za)},
setTitles:function(){a.each(u,function(C,D){var P=a(D).parents("#main_menu").length;a(D).each(function(){var U=P?a(this).text().split(" [")[0]:this.title.split(" [")[0],S="";a.each(C.split("/"),function(Y,aa){var ga=aa.split("+"),ra="";if(ga.length>1){ra=ga[0]+"+";aa=ga[1]}S+=(Y?"/":"")+ra+(uiStrings["key_"+aa]||aa)});if(P)this.lastChild.textContent=U+" ["+S+"]";else this.title=U+" ["+S+"]"})})},getButtonData:function(C){var D;a.each(k,function(P,U){if(U.sel===C)D=U});return D}}}();v.setAll();c.ready(function(){var k=
curConfig.initTool,u=a("#tools_left, #svg_editor .tools_flyout"),C=u.find("#tool_"+k);k=u.find("#"+k);(C.length?C:k.length?k:a("#tool_select")).click().mouseup();curConfig.wireframe&&a("#tool_wireframe").click();curConfig.showlayers&&toggleSidePanel();a("#rulers").toggle(!!curConfig.showRulers)});a("#canvas_height").dragInput({min:10,max:null,step:10,callback:A,cursor:false,dragAdjust:0.1});a("#canvas_width").dragInput({min:10,max:null,step:10,callback:A,cursor:false,dragAdjust:0.1});a("#rect_width").dragInput({min:1,
max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_height").dragInput({min:0,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_cx").dragInput({min:0,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_cy").dragInput({min:0,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_rx").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_ry").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});
a("#image_height").dragInput({min:0,max:null,step:1,callback:changeAttribute,cursor:false});a("#selected_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#selected_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_node_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_node_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_width").dragInput({min:null,
max:null,step:1,callback:changeAttribute,cursor:false});a("#line_x1").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_x2").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_y1").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_y2").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});
a("#path_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#g_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#g_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,
cursor:false});a("#text_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#text_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_rx").dragInput({min:0,max:100,step:1,callback:function(k){g.setRectRadius(k.value)},cursor:true});a("#stroke_width").dragInput({min:0,max:99,step:1,callback:function(k){var u=k.value;if(u==0&&X&&["line","polyline"].indexOf(X.nodeName)>=
0)u=k.value=1;g.setStrokeWidth(u)},cursor:true,smallStep:0.1,start:1.5});a("#angle").dragInput({min:-180,max:180,step:1,callback:function(k){g.setRotationAngle(k.value);rotateCursor(k.value);a("#tool_reorient").toggleClass("disabled",k.value==0)},cursor:false,dragAdjust:0.5});a("#font_size").dragInput({min:1,max:250,step:1,callback:function(k){g.setFontSize(k.value)},cursor:true,stepfunc:function(k,u){var C=k.value-0,D=C+u,P=D>=C;if(u===0)return C;return C>=24?P?Math.round(C*1.1):Math.round(C/1.1):
C<=1?P?C*2:C/2:D}});a("#group_opacity").dragInput({min:0,max:100,step:5,callback:function(k,u){if(u==null)u=k.value;a("#group_opacity").val(u);if(!k||!k.handle)a("#opac_slider").slider("option","value",u);g.setOpacity(u/100)},cursor:true,start:100});a("#blur").dragInput({min:0,max:10,step:0.1,callback:function(k){val=k.value;a("#blur").val(val);window.event.type=="mouseup"?g.setBlur(val,true):g.setBlurNoUndo(val)},cursor:true,start:0});a("#zoom").val(g.getZoom()*100);a("#workarea").contextMenu({menu:"cmenu_canvas",
inSpeed:0},function(k){switch(k){case "delete":ta();break;case "cut":mb();break;case "copy":jb();break;case "paste":g.pasteElements();break;case "paste_in_place":g.pasteElements("in_place");break;case "group":g.groupSelectedElements();break;case "ungroup":g.ungroupSelectedElement();break;case "move_front":ob();break;case "move_up":wb("Up");break;case "move_down":wb("Down");break;case "move_back":eb();break;default:svgedit.contextmenu&&svgedit.contextmenu.hasCustomHandler(k)&&svgedit.contextmenu.getCustomHandler(k).call()}});
a(".contextMenu li").mousedown(function(k){k.preventDefault()});a("#cmenu_canvas li").disableContextMenu();V.enableContextMenuItems("#delete,#cut,#copy");window.onbeforeunload=function(){if(T.getUndoStackSize()===0)c.show_save_warning=false;if(!curConfig.no_save_warning&&c.show_save_warning)return uiStrings.notification.unsavedChanges};c.openPrep=function(k){a("#main_menu").hide();T.getUndoStackSize()===0?k(true):a.confirm(uiStrings.notification.QwantToOpen,k)};if(window.FileReader){q=a('<input type="file">').change(function(){var k=
this;c.openPrep(function(u){if(u){g.clear();if(k.files.length==1){u=new FileReader;u.onloadend=function(C){p(C.target.result);F()};u.readAsText(k.files[0])}}})});a("#tool_open").show().prepend(q);q=a('<input type="file">').change(function(){a("#main_menu").hide();if(this.files.length==1){var k=new FileReader;k.onloadend=function(u){g.importSvgString(u.target.result,true);F()};k.readAsText(this.files[0])}});a("#tool_import").show().prepend(q)}for(var F=c.updateCanvas=function(k,u){var C=R.width(),
D=R.height(),P=C,U=D,S=g.getZoom(),Y=a("#svgcanvas"),aa={x:R[0].scrollLeft+P/2,y:R[0].scrollTop+U/2},ga=curConfig.canvas_expansion;C=Math.max(P,g.contentW*S*ga);D=Math.max(U,g.contentH*S*ga);C==P&&D==U?R.css("overflow","hidden"):R.css("overflow","scroll");ga=Y.height()/2;var ra=Y.width()/2;Y.width(C).height(D);var Oa=D/2,Ba=C/2,ha=g.updateCanvas(C,D),Ta=Ba/ra;C=C/2-P/2;D=D/2-U/2;if(u){u.x+=ha.x;u.y+=ha.y}else u={x:Ba+(aa.x-ra)*Ta,y:Oa+(aa.y-ga)*Ta};if(k)if(g.contentW>R.width()){R[0].scrollLeft=ha.x-
10;R[0].scrollTop=ha.y-10}else{R[0].scrollLeft=C;R[0].scrollTop=D}else{R[0].scrollLeft=u.x-P/2;R[0].scrollTop=u.y-U/2}if(curConfig.showRulers){l(Y,S);R.scroll()}},I=[],E=0.1;E<1E5;E*=10){I.push(1*E);I.push(2*E);I.push(5*E)}F(true);try{var G=function(k){if(window.JSON&&JSON.stringify)return JSON.stringify(k);var u=arguments.callee;if(typeof k=="boolean"||typeof k=="number")return k+"";else if(typeof k=="string")return'"'+k.replace(/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
function(P){return"\\u"+("0000"+P.charCodeAt(0).toString(16)).slice(-4)})+'"';else if(k.length){for(var C=0;C<k.length;C++)k[C]=u(k[C]);return"["+k.join(",")+"]"}else{C=[];for(var D in k)C.push(u(D)+":"+u(k[D]));return"{"+C.join(",")+"}"}};window.addEventListener("message",function(k){var u=parseInt(k.data.substr(0,k.data.indexOf(";")));try{k.source.postMessage("SVGe"+u+";"+G(eval(k.data)),"*")}catch(C){k.source.postMessage("SVGe"+u+";error:"+C.message,"*")}},false)}catch(L){window.embed_error=L}a(function(){window.svgCanvas=
g;g.ready=svgEditor.ready});c.setLang=function(k,u){a.pref("lang",k);a("#lang_select").val(k);if(u){g.runExtensions("langChanged",k);Aa();a.each({"#stroke_color":"#tool_stroke .icon_label, #tool_stroke .color_block","#fill_color":"#tool_fill label, #tool_fill .color_block","#linejoin_miter":"#cur_linejoin","#linecap_butt":"#cur_linecap"},function(C,D){a(D).attr("title",a(C)[0].title)});a("#multiselected_panel div[id^=tool_align]").each(function(){a("#tool_pos"+this.id.substr(10))[0].title=this.title})}}};
var f=[];c.ready=function(d){n?d():f.push(d)};c.runCallbacks=function(){a.each(f,function(){this()});n=true};c.loadFromString=function(d){c.ready(function(){p(d)})};c.loadFromURL=function(d,l){l||(l={});var q=l.cache,B=l.callback;c.ready(function(){a.ajax({url:d,dataType:"text",cache:!!q,success:function(o){p(o,B)},error:function(o,K,T){o.status!=404&&o.responseText?p(o.responseText,B):a.alert(uiStrings.notification.URLloadFail+": \n"+T+"",B)}})})};c.loadFromDataURI=function(d){c.ready(function(){var l=
d.substring(26);p(svgedit.utilities.decode64(l))})};c.addExtension=function(){var d=arguments;a(function(){g&&g.addExtension.apply(this,d)})};return c}(jQuery);$(svgEditor.init)})();$.fn.dragInput=function(a){return this.each(function(){this.repeating=false;this.dragCfg={min:a&&!isNaN(parseFloat(a.min))?Number(a.min):null,max:a&&!isNaN(parseFloat(a.max))?Number(a.max):null,step:a&&Number(a.step)?a.step:1,stepfunc:a&&a.stepfunc?a.stepfunc:false,dragAdjust:a&&a.dragAdjust?a.dragAdjust:1,height:70,cursor:a&&a.cursor?Boolean(a.cursor):false,start:a&&a.start?Number(a.start):0,_btn_width:20,_direction:null,_delay:null,_repeat:null,callback:a&&a.callback?a.callback:null};this.dragCfg.smallStep=
@ -624,7 +623,7 @@ Q)/(255-Q)*100,4):0);va.call(d,ia,Math.precision(Ga/255*100,4));va.call(d,pa,Mat
Q+"', sizingMethod='scale')"})}else M.css({backgroundImage:"url('"+Q+"')"})},Da=function(M,Q){M.css({top:Q+"px"})},va=function(M,Q){M.css({visibility:Q>0?"visible":"hidden"});if(Q>0&&Q<100)if(q){var ea=M.attr("pngSrc");ea!=null&&(ea.indexOf("AlphaBar.png")!=-1||ea.indexOf("Bars.png")!=-1||ea.indexOf("Maps.png")!=-1)?M.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ea+"', sizingMethod='scale') progid:DXImageTransform.Microsoft.Alpha(opacity="+Q+")"}):M.css({opacity:Math.precision(Q/
100,4)})}else M.css({opacity:Math.precision(Q/100,4)});else if(Q==0||Q==100)if(q){ea=M.attr("pngSrc");ea!=null&&(ea.indexOf("AlphaBar.png")!=-1||ea.indexOf("Bars.png")!=-1||ea.indexOf("Maps.png")!=-1)?M.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ea+"', sizingMethod='scale')"}):M.css({opacity:""})}else M.css({opacity:""})},fb=function(){ja.active.val("ahex",ja.current.val("ahex"))},La=function(){ja.current.val("ahex",ja.active.val("ahex"))},Va=function(M){a(this).parents("tbody:first").find('input:radio[value!="'+
M.target.value+'"]').removeAttr("checked");Na.call(d,M.target.value)},Ea=function(){fb.call(d)},kb=function(){fb.call(d);l.window.expandable&&wb.call(d);a.isFunction(tb)&&tb.call(d,ja.active,na)},sb=function(){La.call(d);l.window.expandable&&wb.call(d);a.isFunction(ob)&&ob.call(d,ja.active,ma)},Za=function(){ub.call(d)},bb=function(M){var Q=M.val("hex");qa.css({backgroundColor:Q&&"#"+Q||"transparent"});va.call(d,qa,Math.precision((M.val("a")||0)*100/255,4))},Cb=function(M){var Q=M.val("hex");M=M.val("va");
Fa.css({backgroundColor:Q&&"#"+Q||"transparent"});va.call(d,Ia,Math.precision((255-(M&&M.a||0))*100/255,4));if(l.window.bindToInput&&l.window.updateInputColor)l.window.input.css({backgroundColor:Q&&"#"+Q||"transparent",color:M==null||M.v>75?"#000000":"#ffffff"})},ua=function(M){ka=parseInt(B.css("left"));da=parseInt(B.css("top"));W=M.pageX;Z=M.pageY;a(document).bind("mousemove",mb).bind("mouseup",jb);M.preventDefault()},mb=function(M){B.css({left:ka-(W-M.pageX)+"px",top:da-(Z-M.pageY)+"px"});l.window.expandable&&
Fa.css({backgroundColor:Q&&"#"+Q||"transparent"});va.call(d,Ia,Math.precision((255-(M&&M.a||0))*100/255,4));if(l.window.bindToInput&&l.window.updateInputColor)l.window.input.css({backgroundColor:Q&&"#"+Q||"transparent",color:M==null||M.v>75?"#000000":"#ffffff"})},ta=function(M){ka=parseInt(B.css("left"));da=parseInt(B.css("top"));W=M.pageX;Z=M.pageY;a(document).bind("mousemove",mb).bind("mouseup",jb);M.preventDefault()},mb=function(M){B.css({left:ka-(W-M.pageX)+"px",top:da-(Z-M.pageY)+"px"});l.window.expandable&&
!a.support.boxModel&&B.prev().css({left:B.css("left"),top:B.css("top")});M.stopPropagation();M.preventDefault();return false},jb=function(M){a(document).unbind("mousemove",mb).unbind("mouseup",jb);M.stopPropagation();M.preventDefault();return false},Ab=function(M){M.preventDefault();M.stopPropagation();ja.active.val("ahex",a(this).attr("title")||null,M.target);return false},ob=a.isFunction(f[1])&&f[1]||null,eb=a.isFunction(f[2])&&f[2]||null,tb=a.isFunction(f[3])&&f[3]||null,ub=function(){ja.current.val("ahex",
ja.active.val("ahex"));var M=function(){if(!(!l.window.expandable||a.support.boxModel)){var Q=B.find("table:first");B.before("<iframe/>");B.prev().css({width:Q.width(),height:B.height(),opacity:0,position:"absolute",left:B.css("left"),top:B.css("top")})}};if(l.window.expandable){a(document.body).children("div.jPicker.Container").css({zIndex:10});B.css({zIndex:20})}switch(l.window.effects.type){case "fade":B.fadeIn(l.window.effects.speed.show,M);break;case "slide":B.slideDown(l.window.effects.speed.show,
M);break;default:B.show(l.window.effects.speed.show,M)}},wb=function(){var M=function(){l.window.expandable&&B.css({zIndex:10});!l.window.expandable||a.support.boxModel||B.prev().remove()};switch(l.window.effects.type){case "fade":B.fadeOut(l.window.effects.speed.hide,M);break;case "slide":B.slideUp(l.window.effects.speed.hide,M);break;default:B.hide(l.window.effects.speed.hide,M)}},Bb=function(){var M=l.window,Q=M.expandable?a(d).next().find(".Container:first"):null;B=M.expandable?a("<div/>"):a(d);
@ -643,9 +642,9 @@ M.bindToInput?M.input:null,M.alphaPrecision);Pa=ea!=null?ea.hex:null;var db=Ga.f
T,la.clientPath+"Maps.png");Sa.call(d,N,la.clientPath+"Maps.png");Sa.call(d,J,la.clientPath+"map-opacity.png");Sa.call(d,R,la.clientPath+"Bars.png");Sa.call(d,V,la.clientPath+"Bars.png");Sa.call(d,O,la.clientPath+"Bars.png");Sa.call(d,ia,la.clientPath+"Bars.png");Sa.call(d,pa,la.clientPath+"bar-opacity.png");Sa.call(d,fa,la.clientPath+"AlphaBar.png");Sa.call(d,db.find("div:last"),la.clientPath+"preview-opacity.png")},0);Ga.find("td.Radio input").bind("click touchstart",Va);if(ja.quickList&&ja.quickList.length>
0){Ya="";for(i=0;i<ja.quickList.length;i++){if((typeof ja.quickList[i]).toString().toLowerCase()=="string")ja.quickList[i]=new c({hex:ja.quickList[i]});var nb=ja.quickList[i].val("a"),Ua=ja.quickList[i].val("ahex");if(!M.alphaSupport&&Ua)Ua=Ua.substring(0,6)+"ff";var rb=ja.quickList[i].val("hex");Ya+='<span class="QuickColor"'+(Ua&&' title="#'+Ua+'"'||"")+' style="background-color:'+(rb&&"#"+rb||"")+";"+(rb?"":"background-image:url("+la.clientPath+"NoColor.png)")+(M.alphaSupport&&nb&&nb<255?";opacity:"+
Math.precision(nb/255,4)+";filter:Alpha(opacity="+Math.precision(nb/2.55,4)+")":"")+'">&nbsp;</span>'}Sa.call(d,Aa,la.clientPath+"bar-opacity.png");Aa.html(Ya);Aa.find(".QuickColor").click(Ab)}Na.call(d,l.color.mode);ja.active.bind(za);a.isFunction(eb)&&ja.active.bind(eb);ja.current.bind(bb);if(M.expandable){d.icon=Q.parents(".Icon:first");Fa=d.icon.find(".Color:first").css({backgroundColor:Pa&&"#"+Pa||"transparent"});Ia=d.icon.find(".Alpha:first");Sa.call(d,Ia,la.clientPath+"bar-opacity.png");va.call(d,
Ia,Math.precision((255-(ea!=null?ea.a:0))*100/255,4));Ca=d.icon.find(".Image:first").css({backgroundImage:"url('"+la.clientPath+la.picker.file+"')"}).bind("click",Za);if(M.bindToInput&&M.updateInputColor)M.input.css({backgroundColor:Pa&&"#"+Pa||"transparent",color:ea==null||ea.v>75?"#000000":"#ffffff"});Ka=Ga.find(".Move:first").bind("mousedown",ua);ja.active.bind(Cb)}else ub.call(d)},la=l.images,ca=l.localization,ja={active:(typeof l.color.active).toString().toLowerCase()=="string"?new c({ahex:!l.window.alphaSupport&&
Ia,Math.precision((255-(ea!=null?ea.a:0))*100/255,4));Ca=d.icon.find(".Image:first").css({backgroundImage:"url('"+la.clientPath+la.picker.file+"')"}).bind("click",Za);if(M.bindToInput&&M.updateInputColor)M.input.css({backgroundColor:Pa&&"#"+Pa||"transparent",color:ea==null||ea.v>75?"#000000":"#ffffff"});Ka=Ga.find(".Move:first").bind("mousedown",ta);ja.active.bind(Cb)}else ub.call(d)},la=l.images,ca=l.localization,ja={active:(typeof l.color.active).toString().toLowerCase()=="string"?new c({ahex:!l.window.alphaSupport&&
l.color.active?l.color.active.substring(0,6)+"ff":l.color.active}):new c({ahex:!l.window.alphaSupport&&l.color.active.val("ahex")?l.color.active.val("ahex").substring(0,6)+"ff":l.color.active.val("ahex")}),current:(typeof l.color.active).toString().toLowerCase()=="string"?new c({ahex:!l.window.alphaSupport&&l.color.active?l.color.active.substring(0,6)+"ff":l.color.active}):new c({ahex:!l.window.alphaSupport&&l.color.active.val("ahex")?l.color.active.val("ahex").substring(0,6)+"ff":l.color.active.val("ahex")}),
quickList:l.color.quickList};a.extend(true,d,{commitCallback:ob,liveCallback:eb,cancelCallback:tb,color:ja,show:ub,hide:wb,destroy:function(){B.find("td.Radio input touchstart").unbind("click",Va);qa.unbind("click touchstart",Ea);na.unbind("click touchstart",kb);ma.unbind("click touchstart",sb);if(l.window.expandable){Ca.unbind("click",Za);Ka.unbind("mousedown",ua);d.icon=null}B.find(".QuickColor").unbind("click",Ab);fa=pa=ia=O=V=R=J=N=T=K=o=null;ba.destroy();ba=null;X.destroy();X=null;sa.destroy();
quickList:l.color.quickList};a.extend(true,d,{commitCallback:ob,liveCallback:eb,cancelCallback:tb,color:ja,show:ub,hide:wb,destroy:function(){B.find("td.Radio input touchstart").unbind("click",Va);qa.unbind("click touchstart",Ea);na.unbind("click touchstart",kb);ma.unbind("click touchstart",sb);if(l.window.expandable){Ca.unbind("click",Za);Ka.unbind("mousedown",ta);d.icon=null}B.find(".QuickColor").unbind("click",Ab);fa=pa=ia=O=V=R=J=N=T=K=o=null;ba.destroy();ba=null;X.destroy();X=null;sa.destroy();
eb=tb=ob=Aa=na=ma=qa=oa=sa=null;B.html("");for(i=0;i<n.length;i++)n[i]==d&&n.splice(i,1)}});n.push(d);setTimeout(function(){Bb.call(d)},0)})};a.fn.jPicker.defaults={window:{title:null,effects:{type:"slide",speed:{show:"slow",hide:"fast"}},position:{x:"screenCenter",y:"top"},expandable:false,liveUpdate:true,alphaSupport:false,alphaPrecision:0,updateInputColor:true},color:{mode:"h",active:new c({ahex:"#ffcc00ff"}),quickList:[new c({h:360,s:33,v:100}),new c({h:360,s:66,v:100}),new c({h:360,s:100,v:100}),
new c({h:360,s:100,v:75}),new c({h:360,s:100,v:50}),new c({h:180,s:0,v:100}),new c({h:30,s:33,v:100}),new c({h:30,s:66,v:100}),new c({h:30,s:100,v:100}),new c({h:30,s:100,v:75}),new c({h:30,s:100,v:50}),new c({h:180,s:0,v:90}),new c({h:60,s:33,v:100}),new c({h:60,s:66,v:100}),new c({h:60,s:100,v:100}),new c({h:60,s:100,v:75}),new c({h:60,s:100,v:50}),new c({h:180,s:0,v:80}),new c({h:90,s:33,v:100}),new c({h:90,s:66,v:100}),new c({h:90,s:100,v:100}),new c({h:90,s:100,v:75}),new c({h:90,s:100,v:50}),
new c({h:180,s:0,v:70}),new c({h:120,s:33,v:100}),new c({h:120,s:66,v:100}),new c({h:120,s:100,v:100}),new c({h:120,s:100,v:75}),new c({h:120,s:100,v:50}),new c({h:180,s:0,v:60}),new c({h:150,s:33,v:100}),new c({h:150,s:66,v:100}),new c({h:150,s:100,v:100}),new c({h:150,s:100,v:75}),new c({h:150,s:100,v:50}),new c({h:180,s:0,v:50}),new c({h:180,s:33,v:100}),new c({h:180,s:66,v:100}),new c({h:180,s:100,v:100}),new c({h:180,s:100,v:75}),new c({h:180,s:100,v:50}),new c({h:180,s:0,v:40}),new c({h:210,