From bf0d3b75e67b052e5e5f9335be3211933f9ddd84 Mon Sep 17 00:00:00 2001 From: Mark MacKay Date: Thu, 19 Jul 2012 10:25:04 -0500 Subject: [PATCH] including the sape library --- Makefile | 2 +- editor/extensions/ext-shapes.js | 2 +- editor/svgedit.compiled.js | 1184 +++++++++++++------------- method-draw/extensions/ext-shapes.js | 2 +- method-draw/svgedit.compiled.js | 1184 +++++++++++++------------- 5 files changed, 1195 insertions(+), 1179 deletions(-) diff --git a/Makefile b/Makefile index 187cd32..16b4519 100644 --- a/Makefile +++ b/Makefile @@ -35,7 +35,7 @@ JS_FILES=\ extensions/ext-eyedropper.js \ extensions/ext-markers.js \ extensions/ext-grid.js \ - extensions/ext-imagelib.js \ + extensions/ext-shapes.js \ CSS_FILES=\ fonts.css \ diff --git a/editor/extensions/ext-shapes.js b/editor/extensions/ext-shapes.js index 6471334..69e7958 100644 --- a/editor/extensions/ext-shapes.js +++ b/editor/extensions/ext-shapes.js @@ -31,7 +31,7 @@ svgEditor.addExtension("shapes", function() { music: 'Music', weather: 'Weather & Time', ui: 'User Interface', - social: 'Social Web', + social: 'Social Web' }; var library = { diff --git a/editor/svgedit.compiled.js b/editor/svgedit.compiled.js index a96bb88..21128c3 100644 --- a/editor/svgedit.compiled.js +++ b/editor/svgedit.compiled.js @@ -1,110 +1,110 @@ -(function(a){function o(f){if(typeof f.data==="string"){var c=f.handler,m=f.data.toLowerCase().split(" ");f.handler=function(p){if(!(this!==p.target&&(/textarea|select/i.test(p.target.nodeName)||p.target.type==="text"))){var b=p.type!=="keypress"&&a.hotkeys.specialKeys[p.which],d=String.fromCharCode(p.which).toLowerCase(),e="",l={};if(p.altKey&&b!=="alt")e+="alt+";if(p.ctrlKey&&b!=="ctrl")e+="ctrl+";if(p.metaKey&&!p.ctrlKey&&b!=="meta")e+="meta+";if(p.shiftKey&&b!=="shift")e+="shift+";if(b)l[e+b]= -true;else{l[e+d]=true;l[e+a.hotkeys.shiftNums[d]]=true;if(e==="shift+")l[a.hotkeys.shiftNums[d]]=true}b=0;for(d=m.length;b","/":"?","\\":"|"}};a.each(["keydown","keyup","keypress"],function(){a.event.special[this]={add:o}})})(jQuery);(function(a,o){function f(da){return typeof da==="string"}function c(da){var Y=e.call(arguments,1);return function(){return da.apply(this,Y.concat(e.call(arguments)))}}function m(da,Y,V,ma,ua){var ga;if(ma!==d){Y=V.match(da?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);V=Y[3]||"";if(ua===2&&f(ma))ma=ma.replace(da?ba:Z,"");else{ga=n(Y[2]);ma=f(ma)?n[da?R:Q](ma):ma;ma=ua===2?ma:ua===1?a.extend({},ma,ga):a.extend({},ga,ma);ma=q(ma);if(da)ma=ma.replace(ka,l)}da=Y[1]+(da?"#":ma||!Y[1]?"?":"")+ma+V}else da= -Y(V!==d?V:o[ha][W]);return da}function p(da,Y,V){if(Y===d||typeof Y==="boolean"){V=Y;Y=q[da?R:Q]()}else Y=f(Y)?Y.replace(da?ba:Z,""):Y;return n(Y,V)}function b(da,Y,V,ma){if(!f(V)&&typeof V!=="object"){ma=V;V=Y;Y=d}return this.each(function(){var ua=a(this),ga=Y||ea()[(this.nodeName||"").toLowerCase()]||"",qa=ga&&ua.attr(ga)||"";ua.attr(ga,q[da](qa,V,ma))})}var d,e=Array.prototype.slice,l=decodeURIComponent,q=a.param,u,n,I,S=a.bbq=a.bbq||{},O,H,ea,X=a.event.special,Q="querystring",R="fragment",ha= -"location",W="href",Z=/^.*\?|#.*$/g,ba=/^.*\#/,ka,la={};q[Q]=c(m,0,function(da){return da.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")});q[R]=u=c(m,1,function(da){return da.replace(/^[^#]*#?(.*)$/,"$1")});u.noEscape=function(da){da=da||"";da=a.map(da.split(""),encodeURIComponent);ka=RegExp(da.join("|"),"g")};u.noEscape(",/");a.deparam=n=function(da,Y){var V={},ma={"true":true,"false":false,"null":null};a.each(da.replace(/\+/g," ").split("&"),function(ua,ga){var qa=ga.split("="),Ga=l(qa[0]),Ma=V,Ra= -0,Qa=Ga.split("]["),Va=Qa.length-1;if(/\[/.test(Qa[0])&&/\]$/.test(Qa[Va])){Qa[Va]=Qa[Va].replace(/\]$/,"");Qa=Qa.shift().split("[").concat(Qa);Va=Qa.length-1}else Va=0;if(qa.length===2){qa=l(qa[1]);if(Y)qa=qa&&!isNaN(qa)?+qa:qa==="undefined"?d:ma[qa]!==d?ma[qa]:qa;if(Va)for(;Ra<=Va;Ra++){Ga=Qa[Ra]===""?Ma.length:Qa[Ra];Ma=Ma[Ga]=Ra').hide().insertAfter("body")[0].contentWindow; -H=function(){return c(S.document[b][d])};O=function(ea,X){if(ea!==X){var Q=S.document;Q.open().close();Q[b].hash="#"+ea}};O(c())}}var n={},I,S,O,H;n.start=function(){if(!I){var ea=c();O||u();(function X(){var Q=c(),R=H(ea);if(Q!==ea){O(ea=Q,R);a(o).trigger("hashchange")}else if(R!==ea)o[b][d]=o[b][d].replace(/#.*/,"")+"#"+R;I=setTimeout(X,a.hashchangeDelay)})()}};n.stop=function(){if(!S){I&&clearTimeout(I);I=0}};return n}()})(jQuery,this);(function(a){var o={},f;a.svgIcons=function(c,m){function p(da,Y){if(da!=="ajax"){if(ea)return;var V=(S=W[0].contentDocument)&&S.getElementById("svg_eof");if(!V&&!(Y&&V)){X++;if(X<50)setTimeout(p,20);else{d();ea=true}return}ea=true}I=a(S.firstChild).children();if(m.no_img)setTimeout(function(){H||b()},500);else{V=ha+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNzUiIGhlaWdodD0iMjc1Ij48L3N2Zz4%3D";O=a(new Image).attr({src:V,width:0,height:0}).appendTo("body").load(function(){b(true)}).error(function(){b()})}} -function b(da,Y){if(!H){if(m.no_img)da=false;if(da){var V=a(document.createElement("div"));V.hide().appendTo("body")}if(Y){var ma=m.fallback_path?m.fallback_path:"";a.each(Y,function(Va,Xa){a("#"+Va);var Na=a(new Image).attr({"class":"svg_icon",src:ma+Xa,width:u,height:n,alt:"icon"});la(Na,Va)})}else for(var ua=I.length,ga=0;ga0&&!da)Ha=f(Ha,Na,true);ka(a(this),Ha,Xa)})});if(!Y){da&&V.remove();W&&W.remove();O&&O.remove()}m.resize&&a.resizeSvgIcons(m.resize);H=true;m.callback&&m.callback(o)}}function d(){if(c.indexOf(".svgz")!=-1){var da=c.replace(".svgz",".svg");window.console&&console.log(".svgz failed, trying with .svg");a.svgIcons(da,m)}else m.fallback&&b(false,m.fallback)} -function e(da){if(window.btoa)return window.btoa(da);var Y=Array(Math.floor((da.length+2)/3)*4),V,ma,ua,ga,qa,Ga,Ma=0,Ra=0;do{V=da.charCodeAt(Ma++);ma=da.charCodeAt(Ma++);ua=da.charCodeAt(Ma++);ga=V>>2;V=(V&3)<<4|ma>>4;qa=(ma&15)<<2|ua>>6;Ga=ua&63;if(isNaN(ma))qa=Ga=64;else if(isNaN(ua))Ga=64;Y[Ra++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(ga);Y[Ra++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(V);Y[Ra++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(qa); -Y[Ra++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Ga)}while(Ma-1&&Q.indexOf("Chrome/");var ha="data:image/svg+xml;charset=utf-8;base64,";if(m.svgz){var W=a('').appendTo("body").hide();try{S=W[0].contentDocument;W.load(p); -p(0,true)}catch(Z){d()}}else{var ba=new DOMParser;a.ajax({url:c,dataType:"string",success:function(da){if(da){S=ba.parseFromString(da,"text/xml");a(function(){p("ajax")})}else a(d)},error:function(da){if(window.opera)a(function(){d()});else if(da.responseText){S=ba.parseFromString(da.responseText,"text/xml");S.childNodes.length||a(d);a(function(){p("ajax")})}else a(d)}})}var ka=function(da,Y,V,ma){R&&Y.css("visibility","hidden");if(m.replace){ma&&Y.attr("id",V);(V=da.attr("class"))&&Y.attr("class", -"svg_icon "+V);da.replaceWith(Y)}else da.append(Y);R&&setTimeout(function(){Y.removeAttr("style")},1)},la=function(da,Y){if(m.id_match===undefined||m.id_match!==false)ka(holder,da,Y,true);o[Y]=da};f=function(da,Y){var V=da.find("defs");if(!V.length)return da;V=R?V.find("*").filter(function(){return!!this.id}):V.find("[id]");var ma=da[0].getElementsByTagName("*"),ua=ma.length;V.each(function(ga){var qa=this.id;a(S).find("#"+qa);this.id=ga="x"+qa+Y+ga;qa="url(#"+qa+")";var Ga="url(#"+ga+")";for(ga= -0;ga","/":"?","\\":"|"}};a.each(["keydown","keyup","keypress"],function(){a.event.special[this]={add:o}})})(jQuery);(function(a,o){function f(da){return typeof da==="string"}function c(da){var Z=e.call(arguments,1);return function(){return da.apply(this,Z.concat(e.call(arguments)))}}function l(da,Z,Y,ma,ua){var ha;if(ma!==d){Z=Y.match(da?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);Y=Z[3]||"";if(ua===2&&f(ma))ma=ma.replace(da?ba:X,"");else{ha=p(Z[2]);ma=f(ma)?p[da?R:P](ma):ma;ma=ua===2?ma:ua===1?a.extend({},ma,ha):a.extend({},ha,ma);ma=q(ma);if(da)ma=ma.replace(la,m)}da=Z[1]+(da?"#":ma||!Z[1]?"?":"")+ma+Y}else da= +Z(Y!==d?Y:o[ea][S]);return da}function n(da,Z,Y){if(Z===d||typeof Z==="boolean"){Y=Z;Z=q[da?R:P]()}else Z=f(Z)?Z.replace(da?ba:X,""):Z;return p(Z,Y)}function b(da,Z,Y,ma){if(!f(Y)&&typeof Y!=="object"){ma=Y;Y=Z;Z=d}return this.each(function(){var ua=a(this),ha=Z||aa()[(this.nodeName||"").toLowerCase()]||"",qa=ha&&ua.attr(ha)||"";ua.attr(ha,q[da](qa,Y,ma))})}var d,e=Array.prototype.slice,m=decodeURIComponent,q=a.param,v,p,I,V=a.bbq=a.bbq||{},M,H,aa,T=a.event.special,P="querystring",R="fragment",ea= +"location",S="href",X=/^.*\?|#.*$/g,ba=/^.*\#/,la,ka={};q[P]=c(l,0,function(da){return da.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")});q[R]=v=c(l,1,function(da){return da.replace(/^[^#]*#?(.*)$/,"$1")});v.noEscape=function(da){da=da||"";da=a.map(da.split(""),encodeURIComponent);la=RegExp(da.join("|"),"g")};v.noEscape(",/");a.deparam=p=function(da,Z){var Y={},ma={"true":true,"false":false,"null":null};a.each(da.replace(/\+/g," ").split("&"),function(ua,ha){var qa=ha.split("="),Ga=m(qa[0]),Ma=Y,Ra= +0,Qa=Ga.split("]["),Va=Qa.length-1;if(/\[/.test(Qa[0])&&/\]$/.test(Qa[Va])){Qa[Va]=Qa[Va].replace(/\]$/,"");Qa=Qa.shift().split("[").concat(Qa);Va=Qa.length-1}else Va=0;if(qa.length===2){qa=m(qa[1]);if(Z)qa=qa&&!isNaN(qa)?+qa:qa==="undefined"?d:ma[qa]!==d?ma[qa]:qa;if(Va)for(;Ra<=Va;Ra++){Ga=Qa[Ra]===""?Ma.length:Qa[Ra];Ma=Ma[Ga]=Ra').hide().insertAfter("body")[0].contentWindow; +H=function(){return c(V.document[b][d])};M=function(aa,T){if(aa!==T){var P=V.document;P.open().close();P[b].hash="#"+aa}};M(c())}}var p={},I,V,M,H;p.start=function(){if(!I){var aa=c();M||v();(function T(){var P=c(),R=H(aa);if(P!==aa){M(aa=P,R);a(o).trigger("hashchange")}else if(R!==aa)o[b][d]=o[b][d].replace(/#.*/,"")+"#"+R;I=setTimeout(T,a.hashchangeDelay)})()}};p.stop=function(){if(!V){I&&clearTimeout(I);I=0}};return p}()})(jQuery,this);(function(a){var o={},f;a.svgIcons=function(c,l){function n(da,Z){if(da!=="ajax"){if(aa)return;var Y=(V=S[0].contentDocument)&&V.getElementById("svg_eof");if(!Y&&!(Z&&Y)){T++;if(T<50)setTimeout(n,20);else{d();aa=true}return}aa=true}I=a(V.firstChild).children();if(l.no_img)setTimeout(function(){H||b()},500);else{Y=ea+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNzUiIGhlaWdodD0iMjc1Ij48L3N2Zz4%3D";M=a(new Image).attr({src:Y,width:0,height:0}).appendTo("body").load(function(){b(true)}).error(function(){b()})}} +function b(da,Z){if(!H){if(l.no_img)da=false;if(da){var Y=a(document.createElement("div"));Y.hide().appendTo("body")}if(Z){var ma=l.fallback_path?l.fallback_path:"";a.each(Z,function(Va,Xa){a("#"+Va);var Na=a(new Image).attr({"class":"svg_icon",src:ma+Xa,width:v,height:p,alt:"icon"});ka(Na,Va)})}else for(var ua=I.length,ha=0;ha0&&!da)Ha=f(Ha,Na,true);la(a(this),Ha,Xa)})});if(!Z){da&&Y.remove();S&&S.remove();M&&M.remove()}l.resize&&a.resizeSvgIcons(l.resize);H=true;l.callback&&l.callback(o)}}function d(){if(c.indexOf(".svgz")!=-1){var da=c.replace(".svgz",".svg");window.console&&console.log(".svgz failed, trying with .svg");a.svgIcons(da,l)}else l.fallback&&b(false,l.fallback)} +function e(da){if(window.btoa)return window.btoa(da);var Z=Array(Math.floor((da.length+2)/3)*4),Y,ma,ua,ha,qa,Ga,Ma=0,Ra=0;do{Y=da.charCodeAt(Ma++);ma=da.charCodeAt(Ma++);ua=da.charCodeAt(Ma++);ha=Y>>2;Y=(Y&3)<<4|ma>>4;qa=(ma&15)<<2|ua>>6;Ga=ua&63;if(isNaN(ma))qa=Ga=64;else if(isNaN(ua))Ga=64;Z[Ra++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(ha);Z[Ra++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Y);Z[Ra++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(qa); +Z[Ra++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Ga)}while(Ma-1&&P.indexOf("Chrome/");var ea="data:image/svg+xml;charset=utf-8;base64,";if(l.svgz){var S=a('').appendTo("body").hide();try{V=S[0].contentDocument;S.load(n); +n(0,true)}catch(X){d()}}else{var ba=new DOMParser;a.ajax({url:c,dataType:"string",success:function(da){if(da){V=ba.parseFromString(da,"text/xml");a(function(){n("ajax")})}else a(d)},error:function(da){if(window.opera)a(function(){d()});else if(da.responseText){V=ba.parseFromString(da.responseText,"text/xml");V.childNodes.length||a(d);a(function(){n("ajax")})}else a(d)}})}var la=function(da,Z,Y,ma){R&&Z.css("visibility","hidden");if(l.replace){ma&&Z.attr("id",Y);(Y=da.attr("class"))&&Z.attr("class", +"svg_icon "+Y);da.replaceWith(Z)}else da.append(Z);R&&setTimeout(function(){Z.removeAttr("style")},1)},ka=function(da,Z){if(l.id_match===undefined||l.id_match!==false)la(holder,da,Z,true);o[Z]=da};f=function(da,Z){var Y=da.find("defs");if(!Y.length)return da;Y=R?Y.find("*").filter(function(){return!!this.id}):Y.find("[id]");var ma=da[0].getElementsByTagName("*"),ua=ma.length;Y.each(function(ha){var qa=this.id;a(V).find("#"+qa);this.id=ha="x"+qa+Z+ha;qa="url(#"+qa+")";var Ga="url(#"+ha+")";for(ha= +0;ha=0;jQuery.fn.jGraduate=function(c){var m= -arguments;return this.each(function(){function p(ra,ia,va,P,J){var fa=J||a("stop",{"stop-color":ia,"stop-opacity":va,offset:ra},ba);if(J){ia=J.getAttribute("stop-color");va=J.getAttribute("stop-opacity");ra=J.getAttribute("offset")}else ba.appendChild(fa);if(va===null)va=1;J=a("path",{d:"M-6.2,0.9c3.6-4,6.7-4.3,6.7-12.4c-0.2,7.9,3.1,8.8,6.5,12.4c3.5,3.8,2.9,9.6,0,12.3c-3.1,2.8-10.4,2.7-13.2,0C-9.6,9.9-9.4,4.4-6.2,0.9z",fill:"url(#jGraduate_trans)",transform:"translate("+(10+ra*R)+", 26)"},Ja);var Oa= -a("path",{d:"M-6.2,0.9c3.6-4,6.7-4.3,6.7-12.4c-0.2,7.9,3.1,8.8,6.5,12.4c3.5,3.8,2.9,9.6,0,12.3c-3.1,2.8-10.4,2.7-13.2,0C-9.6,9.9-9.4,4.4-6.2,0.9z",fill:ia,"fill-opacity":va,transform:"translate("+(10+ra*R)+", 26)",stroke:"#000","stroke-width":1.5},Ja);$(Oa).mousedown(function(Za){b(this);$a=tb;ea.mousemove(l).mouseup(d);Da=Jb.offset();Za.preventDefault();return false}).data("stop",fa).data("bg",J).dblclick(function(){$("div.jGraduate_LightBox").show();for(var Za=this,fb=+fa.getAttribute("stop-opacity")|| -1,wb=fa.getAttribute("stop-color")||1,xb=(parseFloat(fb)*255).toString(16);xb.length<2;)xb="0"+xb;ia=wb.substr(1)+xb;$("#"+n+"_jGraduate_stopPicker").css({left:100,bottom:15}).jPicker({window:{title:"Pick the start color and opacity for the gradient"},images:{clientPath:u.images.clientPath},color:{active:ia,alphaSupport:true}},function(Db){wb=Db.val("hex")?"#"+Db.val("hex"):"none";fb=Db.val("a")!==null?Db.val("a")/256:1;Za.setAttribute("fill",wb);Za.setAttribute("fill-opacity",fb);fa.setAttribute("stop-color", -wb);fa.setAttribute("stop-opacity",fb);$("div.jGraduate_LightBox").hide();$("#"+n+"_jGraduate_stopPicker").hide()},null,function(){$("div.jGraduate_LightBox").hide();$("#"+n+"_jGraduate_stopPicker").hide()})});$(ba).find("stop").each(function(){var Za=$(this);if(+this.getAttribute("offset")>ra){if(!ia){var fb=this.getAttribute("stop-color"),wb=this.getAttribute("stop-opacity");fa.setAttribute("stop-color",fb);Oa.setAttribute("fill",fb);fa.setAttribute("stop-opacity",wb===null?1:wb);Oa.setAttribute("fill-opacity", -wb===null?1:wb)}Za.before(fa);return false}});P&&b(Oa);return fa}function b(ra){tb&&tb.setAttribute("stroke","#000");ra.setAttribute("stroke","blue");tb=ra;tb.parentNode.appendChild(tb)}function d(){ea.unbind("mousemove",l);if(Ka.getAttribute("display")!=="none"){Ka.setAttribute("display","none");var ra=$(tb),ia=ra.data("stop");ra=ra.data("bg");$([tb,ia,ra]).remove()}$a=null}function e(){var ra=Sa?"rotate("+Sa+","+gb+","+Ia+") ":"";yb===1&&bb===1?ba.removeAttribute("gradientTransform"):ba.setAttribute("gradientTransform", -ra+"translate("+-gb*(yb-1)+","+-Ia*(bb-1)+") scale("+yb+","+bb+")")}function l(ra){var ia=ra.pageX-Da.left;ra=ra.pageY-Da.top;ia=ia<10?10:ia>R+10?R+10:ia;var va="translate("+ia+", 26)";if(ra<-60||ra>130){Ka.setAttribute("display","block");Ka.setAttribute("transform",va)}else Ka.setAttribute("display","none");$a.setAttribute("transform",va);$.data($a,"bg").setAttribute("transform",va);$.data($a,"stop").setAttribute("offset",(ia-10)/R);var P=0;$(ba).find("stop").each(function(){var J=this.getAttribute("offset"), -fa=$(this);if(J
  • Solid Color
  • Linear Gradient
  • Radial Gradient
  • ');var X=$(I+"> .jGraduate_colPick"),Q=$(I+"> .jGraduate_gradPick");Q.html('

    '+u.window.pickerTitle+'


    ');var R=256,ha=R-0,W=R-0,Z,ba,ka,la={};$(".jGraduate_SliderBar").width(145);var da=$("#"+n+"_jGraduate_GradContainer")[0],Y=a("svg",{id:n+"_jgraduate_svg",width:R,height:R,xmlns:o.svg},da);Z=Z||q.paint.type;var V=ba=q.paint[Z],ma=q.paint.alpha,ua=Z==="solidColor";switch(Z){case "solidColor":case "linearGradient":if(!ua){ba.id=n+"_lg_jgraduate_grad";V= -ba=Y.appendChild(ba)}a("radialGradient",{id:n+"_rg_jgraduate_grad"},Y);if(Z==="linearGradient")break;case "radialGradient":if(!ua){ba.id=n+"_rg_jgraduate_grad";V=ba=Y.appendChild(ba)}a("linearGradient",{id:n+"_lg_jgraduate_grad"},Y)}if(ua){V=ba=$("#"+n+"_lg_jgraduate_grad")[0];H=q.paint[Z];p(0,"#"+H,1);var ga=typeof u.newstop;if(ga==="string")switch(u.newstop){case "same":p(1,"#"+H,1);break;case "inverse":ga="";for(var qa=0;qa<6;qa+=2){H.substr(qa,2);var Ga=(255-parseInt(H.substr(qa,2),16)).toString(16); -if(Ga.length<2)Ga=0+Ga;ga+=Ga}p(1,"#"+ga,1);break;case "white":p(1,"#ffffff",1);break;case "black":p(1,"#000000",1)}else if(ga==="object")p(1,u.newstop.color||"#"+H,"opac"in u.newstop?u.newstop.opac:1)}H=parseFloat(V.getAttribute("x1")||0);ga=parseFloat(V.getAttribute("y1")||0);qa=parseFloat(V.getAttribute("x2")||1);Ga=parseFloat(V.getAttribute("y2")||0);var Ma=parseFloat(V.getAttribute("cx")||0.5),Ra=parseFloat(V.getAttribute("cy")||0.5),Qa=parseFloat(V.getAttribute("fx")||Ma),Va=parseFloat(V.getAttribute("fy")|| -Ra);ka=a("rect",{id:n+"_jgraduate_rect",x:0,y:0,width:ha,height:W,fill:"url(#"+n+"_jgraduate_grad)","fill-opacity":ma/100},Y);var Xa=$("
    ").attr({"class":"grad_coord jGraduate_lg_field",title:"Begin Stop"}).text(1).css({top:ga*R,left:H*R}).data("coord","start").appendTo(da),Na=Xa.clone().text(2).css({top:Ga*R,left:qa*R}).attr("title","End stop").data("coord","end").appendTo(da),Ha=$("
    ").attr({"class":"grad_coord jGraduate_rg_field",title:"Center stop"}).text("C").css({top:Ra*R,left:Ma* -R}).data("coord","center").appendTo(da),Pa=Ha.clone().text("F").css({top:Va*R,left:Qa*R,display:"none"}).attr("title","Focus point").data("coord","focus").appendTo(da);Pa[0].id=n+"_jGraduate_focusCoord";$(I+" .grad_coord");$.each(["x1","y1","x2","y2","cx","cy","fx","fy"],function(ra,ia){var va=ba.getAttribute(ia),P=isNaN(ia[1]);va||(va=P?"0.5":ia==="x2"?"1.0":"0.0");la[ia]=$("#"+n+"_jGraduate_"+ia).val(va).change(function(){if(isNaN(parseFloat(this.value))||this.value<0)this.value=0;else if(this.value> -1)this.value=1;if(!(ia[0]==="f"&&!jb))if(P&&Z==="radialGradient"||!P&&Z==="linearGradient")ba.setAttribute(ia,this.value);var J=P?ia[0]==="c"?Ha:Pa:ia[1]==="1"?Xa:Na,fa=ia.indexOf("x")>=0?"left":"top";J.css(fa,this.value*R)}).change()});var zb,Ja,Jb=$("#"+n+"_jGraduate_StopSlider"),tb,ab,$a,Ka=a("path",{d:"m9.75,-6l-19.5,19.5m0,-19.5l19.5,19.5",fill:"none",stroke:"#D00","stroke-width":5,display:"none"},ab),Da,yb=1,bb=1,Sa=0,gb=Ma,Ia=Ra;ab=a("svg",{width:"100%",height:45},Jb[0]);da=a("pattern",{width:16, -height:16,patternUnits:"userSpaceOnUse",id:"jGraduate_trans"},ab);a("image",{width:16,height:16},da).setAttributeNS(o.xlink,"xlink:href",u.images.clientPath+"map-opacity.png");$(ab).click(function(ra){Da=Jb.offset();if(ra.target.tagName!=="path"){var ia=ra.pageX-Da.left-8;ia=ia<10?10:ia>R+10?R+10:ia;p(ia/R,0,0,true);ra.stopPropagation()}});$(ab).mouseover(function(){ab.appendChild(Ka)});Ja=a("g",{},ab);a("line",{x1:10,y1:15,x2:R+10,y2:15,"stroke-width":2,stroke:"#000"},ab);var rb=Q.find(".jGraduate_spreadMethod").change(function(){ba.setAttribute("spreadMethod", -$(this).val())}),sb=null,mb=function(ra){var ia=ra.pageX-Wa.left,va=ra.pageY-Wa.top;ia=ia<0?0:ia>R?R:ia;va=va<0?0:va>R?R:va;sb.css("left",ia).css("top",va);ia/=ha;va/=W;var P=sb.data("coord"),J=ba;switch(P){case "start":la.x1.val(ia);la.y1.val(va);J.setAttribute("x1",ia);J.setAttribute("y1",va);break;case "end":la.x2.val(ia);la.y2.val(va);J.setAttribute("x2",ia);J.setAttribute("y2",va);break;case "center":la.cx.val(ia);la.cy.val(va);J.setAttribute("cx",ia);J.setAttribute("cy",va);gb=ia;Ia=va;e(); -break;case "focus":la.fx.val(ia);la.fy.val(va);J.setAttribute("fx",ia);J.setAttribute("fy",va);e()}ra.preventDefault()},hb=function(){sb=null;ea.unbind("mousemove",mb).unbind("mouseup",hb)};zb=ba.getElementsByTagNameNS(o.svg,"stop");if(La<2){for(;La<2;){ba.appendChild(document.createElementNS(o.svg,"stop"));++La}zb=ba.getElementsByTagNameNS(o.svg,"stop")}var La=zb.length;for(qa=0;qa99.5)P=99.5;if(P>0)bb=1-P/100;else yb=-(P/100)-1;J=145*((P+100)/2)/100;fa&&e();break;case "angle":Sa=P;J=Sa/180;J+=0.5;J*=145;fa&&e()}if(J>145)J= -145;else if(J<0)J=0;va.css({"margin-left":J-5})}).change()});var Gb=function(ra){var ia=ra.pageX-nb.offset.left-parseInt(nb.parent.css("border-left-width"));if(ia>145)ia=145;if(ia<=0)ia=0;var va=ia-5;ia/=145;switch(nb.type){case "radius":ia=Math.pow(ia*2,2.5);if(ia>0.98&&ia<1.02)ia=1;if(ia<=0.01)ia=0.01;ba.setAttribute("r",ia);break;case "opacity":q.paint.alpha=parseInt(ia*100);ka.setAttribute("fill-opacity",ia);break;case "ellip":bb=yb=1;if(ia<0.5){ia/=0.5;yb=ia<=0?0.01:ia}else if(ia>0.5){ia/=0.5; -ia=2-ia;bb=ia<=0?0.01:ia}e();ia-=1;if(bb===ia+1)ia=Math.abs(ia);break;case "angle":ia-=0.5;Sa=ia*=180;e();ia/=100}nb.elem.css({"margin-left":va});ia=Math.round(ia*100);nb.input.val(ia);ra.preventDefault()},Ob=function(){ea.unbind("mousemove",Gb).unbind("mouseup",Ob);nb=null};for(Q=(q.paint.alpha*255/100).toString(16);Q.length<2;)Q="0"+Q;Q=Q.split(".")[0];H=q.paint.solidColor=="none"?"":q.paint.solidColor+Q;ua||(H=zb[0].getAttribute("stop-color"));$.extend($.fn.jPicker.defaults.window,{alphaSupport:true, -effects:{type:"show",speed:0}});X.jPicker({window:{title:u.window.pickerTitle},images:{clientPath:u.images.clientPath},color:{active:H,alphaSupport:true}},function(ra){q.paint.type="solidColor";q.paint.alpha=ra.val("ahex")?Math.round(ra.val("a")/255*100):100;q.paint.solidColor=ra.val("hex")?ra.val("hex"):"none";q.paint.radialGradient=null;S()},null,function(){O()});var Kb=$(I+" .jGraduate_tabs li");Kb.click(function(){Kb.removeClass("jGraduate_tab_current");$(this).addClass("jGraduate_tab_current"); -$(I+" > div").hide();var ra=$(this).attr("data-type");$(I+" .jGraduate_gradPick").show();if(ra==="rg"||ra==="lg"){$(".jGraduate_"+ra+"_field").show();$(".jGraduate_"+(ra==="lg"?"rg":"lg")+"_field").hide();$("#"+n+"_jgraduate_rect")[0].setAttribute("fill","url(#"+n+"_"+ra+"_jgraduate_grad)");Z=ra==="lg"?"linearGradient":"radialGradient";$("#"+n+"_jGraduate_OpacInput").val(q.paint.alpha).change();var ia=$("#"+n+"_"+ra+"_jgraduate_grad")[0];if(ba!==ia){var va=$(ba).find("stop");$(ia).empty().append(va); -ba=ia;ia=rb.val();ba.setAttribute("spreadMethod",ia)}jb=ra==="rg"&&ba.getAttribute("fx")!=null&&!(Ma==Qa&&Ra==Va);$("#"+n+"_jGraduate_focusCoord").toggle(jb);if(jb)$("#"+n+"_jGraduate_match_ctr")[0].checked=false}else{$(I+" .jGraduate_gradPick").hide();$(I+" .jGraduate_colPick").show()}});$(I+" > div").hide();Kb.removeClass("jGraduate_tab_current");var Ub;switch(q.paint.type){case "linearGradient":Ub=$(I+" .jGraduate_tab_lingrad");break;case "radialGradient":Ub=$(I+" .jGraduate_tab_radgrad");break; -default:Ub=$(I+" .jGraduate_tab_color")}q.show();setTimeout(function(){Ub.addClass("jGraduate_tab_current").click()},10)}else alert("Container element must have an id attribute to maintain unique id strings for sub-elements.")})}})();$.fn.SpinButton=function(a){function o(f,c){for(var m=f[c],p=document.body;(f=f.offsetParent)&&f!=p;)if(!$.browser.msie||f.currentStyle.position!="relative")m+=f[c];return m}return this.each(function(){this.repeating=false;this.spinCfg={min:a&&!isNaN(parseFloat(a.min))?Number(a.min):null,max:a&&!isNaN(parseFloat(a.max))?Number(a.max):null,step:a&&a.step?Number(a.step):1,stepfunc:a&&a.stepfunc?a.stepfunc:false,page:a&&a.page?Number(a.page):10,upClass:a&&a.upClass?a.upClass:"up",downClass:a&&a.downClass? +"radialGradient";this.linearGradient=this.solidColor=null;this.radialGradient=c.radialGradient.cloneNode(true)}else if(c.solidColor){this.type="solidColor";this.solidColor=c.solidColor}else{this.type="none";this.radialGradient=this.linearGradient=this.solidColor=null}}};jQuery.fn.jGraduateDefaults={paint:new $.jGraduate.Paint,window:{pickerTitle:"Drag markers to pick a paint"},images:{clientPath:"images/"},newstop:"inverse"};var f=navigator.userAgent.indexOf("Gecko/")>=0;jQuery.fn.jGraduate=function(c){var l= +arguments;return this.each(function(){function n(ra,ia,va,Q,J){var ga=J||a("stop",{"stop-color":ia,"stop-opacity":va,offset:ra},ba);if(J){ia=J.getAttribute("stop-color");va=J.getAttribute("stop-opacity");ra=J.getAttribute("offset")}else ba.appendChild(ga);if(va===null)va=1;J=a("path",{d:"M-6.2,0.9c3.6-4,6.7-4.3,6.7-12.4c-0.2,7.9,3.1,8.8,6.5,12.4c3.5,3.8,2.9,9.6,0,12.3c-3.1,2.8-10.4,2.7-13.2,0C-9.6,9.9-9.4,4.4-6.2,0.9z",fill:"url(#jGraduate_trans)",transform:"translate("+(10+ra*R)+", 26)"},Ja);var Oa= +a("path",{d:"M-6.2,0.9c3.6-4,6.7-4.3,6.7-12.4c-0.2,7.9,3.1,8.8,6.5,12.4c3.5,3.8,2.9,9.6,0,12.3c-3.1,2.8-10.4,2.7-13.2,0C-9.6,9.9-9.4,4.4-6.2,0.9z",fill:ia,"fill-opacity":va,transform:"translate("+(10+ra*R)+", 26)",stroke:"#000","stroke-width":1.5},Ja);$(Oa).mousedown(function(Za){b(this);$a=tb;aa.mousemove(m).mouseup(d);Da=Jb.offset();Za.preventDefault();return false}).data("stop",ga).data("bg",J).dblclick(function(){$("div.jGraduate_LightBox").show();for(var Za=this,fb=+ga.getAttribute("stop-opacity")|| +1,wb=ga.getAttribute("stop-color")||1,xb=(parseFloat(fb)*255).toString(16);xb.length<2;)xb="0"+xb;ia=wb.substr(1)+xb;$("#"+p+"_jGraduate_stopPicker").css({left:100,bottom:15}).jPicker({window:{title:"Pick the start color and opacity for the gradient"},images:{clientPath:v.images.clientPath},color:{active:ia,alphaSupport:true}},function(Db){wb=Db.val("hex")?"#"+Db.val("hex"):"none";fb=Db.val("a")!==null?Db.val("a")/256:1;Za.setAttribute("fill",wb);Za.setAttribute("fill-opacity",fb);ga.setAttribute("stop-color", +wb);ga.setAttribute("stop-opacity",fb);$("div.jGraduate_LightBox").hide();$("#"+p+"_jGraduate_stopPicker").hide()},null,function(){$("div.jGraduate_LightBox").hide();$("#"+p+"_jGraduate_stopPicker").hide()})});$(ba).find("stop").each(function(){var Za=$(this);if(+this.getAttribute("offset")>ra){if(!ia){var fb=this.getAttribute("stop-color"),wb=this.getAttribute("stop-opacity");ga.setAttribute("stop-color",fb);Oa.setAttribute("fill",fb);ga.setAttribute("stop-opacity",wb===null?1:wb);Oa.setAttribute("fill-opacity", +wb===null?1:wb)}Za.before(ga);return false}});Q&&b(Oa);return ga}function b(ra){tb&&tb.setAttribute("stroke","#000");ra.setAttribute("stroke","blue");tb=ra;tb.parentNode.appendChild(tb)}function d(){aa.unbind("mousemove",m);if(Ka.getAttribute("display")!=="none"){Ka.setAttribute("display","none");var ra=$(tb),ia=ra.data("stop");ra=ra.data("bg");$([tb,ia,ra]).remove()}$a=null}function e(){var ra=Sa?"rotate("+Sa+","+gb+","+Ia+") ":"";yb===1&&bb===1?ba.removeAttribute("gradientTransform"):ba.setAttribute("gradientTransform", +ra+"translate("+-gb*(yb-1)+","+-Ia*(bb-1)+") scale("+yb+","+bb+")")}function m(ra){var ia=ra.pageX-Da.left;ra=ra.pageY-Da.top;ia=ia<10?10:ia>R+10?R+10:ia;var va="translate("+ia+", 26)";if(ra<-60||ra>130){Ka.setAttribute("display","block");Ka.setAttribute("transform",va)}else Ka.setAttribute("display","none");$a.setAttribute("transform",va);$.data($a,"bg").setAttribute("transform",va);$.data($a,"stop").setAttribute("offset",(ia-10)/R);var Q=0;$(ba).find("stop").each(function(){var J=this.getAttribute("offset"), +ga=$(this);if(J
  • Solid Color
  • Linear Gradient
  • Radial Gradient
  • ');var T=$(I+"> .jGraduate_colPick"),P=$(I+"> .jGraduate_gradPick");P.html('

    '+v.window.pickerTitle+'


    ');var R=256,ea=R-0,S=R-0,X,ba,la,ka={};$(".jGraduate_SliderBar").width(145);var da=$("#"+p+"_jGraduate_GradContainer")[0],Z=a("svg",{id:p+"_jgraduate_svg",width:R,height:R,xmlns:o.svg},da);X=X||q.paint.type;var Y=ba=q.paint[X],ma=q.paint.alpha,ua=X==="solidColor";switch(X){case "solidColor":case "linearGradient":if(!ua){ba.id=p+"_lg_jgraduate_grad";Y= +ba=Z.appendChild(ba)}a("radialGradient",{id:p+"_rg_jgraduate_grad"},Z);if(X==="linearGradient")break;case "radialGradient":if(!ua){ba.id=p+"_rg_jgraduate_grad";Y=ba=Z.appendChild(ba)}a("linearGradient",{id:p+"_lg_jgraduate_grad"},Z)}if(ua){Y=ba=$("#"+p+"_lg_jgraduate_grad")[0];H=q.paint[X];n(0,"#"+H,1);var ha=typeof v.newstop;if(ha==="string")switch(v.newstop){case "same":n(1,"#"+H,1);break;case "inverse":ha="";for(var qa=0;qa<6;qa+=2){H.substr(qa,2);var Ga=(255-parseInt(H.substr(qa,2),16)).toString(16); +if(Ga.length<2)Ga=0+Ga;ha+=Ga}n(1,"#"+ha,1);break;case "white":n(1,"#ffffff",1);break;case "black":n(1,"#000000",1)}else if(ha==="object")n(1,v.newstop.color||"#"+H,"opac"in v.newstop?v.newstop.opac:1)}H=parseFloat(Y.getAttribute("x1")||0);ha=parseFloat(Y.getAttribute("y1")||0);qa=parseFloat(Y.getAttribute("x2")||1);Ga=parseFloat(Y.getAttribute("y2")||0);var Ma=parseFloat(Y.getAttribute("cx")||0.5),Ra=parseFloat(Y.getAttribute("cy")||0.5),Qa=parseFloat(Y.getAttribute("fx")||Ma),Va=parseFloat(Y.getAttribute("fy")|| +Ra);la=a("rect",{id:p+"_jgraduate_rect",x:0,y:0,width:ea,height:S,fill:"url(#"+p+"_jgraduate_grad)","fill-opacity":ma/100},Z);var Xa=$("
    ").attr({"class":"grad_coord jGraduate_lg_field",title:"Begin Stop"}).text(1).css({top:ha*R,left:H*R}).data("coord","start").appendTo(da),Na=Xa.clone().text(2).css({top:Ga*R,left:qa*R}).attr("title","End stop").data("coord","end").appendTo(da),Ha=$("
    ").attr({"class":"grad_coord jGraduate_rg_field",title:"Center stop"}).text("C").css({top:Ra*R,left:Ma* +R}).data("coord","center").appendTo(da),Pa=Ha.clone().text("F").css({top:Va*R,left:Qa*R,display:"none"}).attr("title","Focus point").data("coord","focus").appendTo(da);Pa[0].id=p+"_jGraduate_focusCoord";$(I+" .grad_coord");$.each(["x1","y1","x2","y2","cx","cy","fx","fy"],function(ra,ia){var va=ba.getAttribute(ia),Q=isNaN(ia[1]);va||(va=Q?"0.5":ia==="x2"?"1.0":"0.0");ka[ia]=$("#"+p+"_jGraduate_"+ia).val(va).change(function(){if(isNaN(parseFloat(this.value))||this.value<0)this.value=0;else if(this.value> +1)this.value=1;if(!(ia[0]==="f"&&!jb))if(Q&&X==="radialGradient"||!Q&&X==="linearGradient")ba.setAttribute(ia,this.value);var J=Q?ia[0]==="c"?Ha:Pa:ia[1]==="1"?Xa:Na,ga=ia.indexOf("x")>=0?"left":"top";J.css(ga,this.value*R)}).change()});var zb,Ja,Jb=$("#"+p+"_jGraduate_StopSlider"),tb,ab,$a,Ka=a("path",{d:"m9.75,-6l-19.5,19.5m0,-19.5l19.5,19.5",fill:"none",stroke:"#D00","stroke-width":5,display:"none"},ab),Da,yb=1,bb=1,Sa=0,gb=Ma,Ia=Ra;ab=a("svg",{width:"100%",height:45},Jb[0]);da=a("pattern",{width:16, +height:16,patternUnits:"userSpaceOnUse",id:"jGraduate_trans"},ab);a("image",{width:16,height:16},da).setAttributeNS(o.xlink,"xlink:href",v.images.clientPath+"map-opacity.png");$(ab).click(function(ra){Da=Jb.offset();if(ra.target.tagName!=="path"){var ia=ra.pageX-Da.left-8;ia=ia<10?10:ia>R+10?R+10:ia;n(ia/R,0,0,true);ra.stopPropagation()}});$(ab).mouseover(function(){ab.appendChild(Ka)});Ja=a("g",{},ab);a("line",{x1:10,y1:15,x2:R+10,y2:15,"stroke-width":2,stroke:"#000"},ab);var rb=P.find(".jGraduate_spreadMethod").change(function(){ba.setAttribute("spreadMethod", +$(this).val())}),sb=null,mb=function(ra){var ia=ra.pageX-Wa.left,va=ra.pageY-Wa.top;ia=ia<0?0:ia>R?R:ia;va=va<0?0:va>R?R:va;sb.css("left",ia).css("top",va);ia/=ea;va/=S;var Q=sb.data("coord"),J=ba;switch(Q){case "start":ka.x1.val(ia);ka.y1.val(va);J.setAttribute("x1",ia);J.setAttribute("y1",va);break;case "end":ka.x2.val(ia);ka.y2.val(va);J.setAttribute("x2",ia);J.setAttribute("y2",va);break;case "center":ka.cx.val(ia);ka.cy.val(va);J.setAttribute("cx",ia);J.setAttribute("cy",va);gb=ia;Ia=va;e(); +break;case "focus":ka.fx.val(ia);ka.fy.val(va);J.setAttribute("fx",ia);J.setAttribute("fy",va);e()}ra.preventDefault()},hb=function(){sb=null;aa.unbind("mousemove",mb).unbind("mouseup",hb)};zb=ba.getElementsByTagNameNS(o.svg,"stop");if(La<2){for(;La<2;){ba.appendChild(document.createElementNS(o.svg,"stop"));++La}zb=ba.getElementsByTagNameNS(o.svg,"stop")}var La=zb.length;for(qa=0;qa99.5)Q=99.5;if(Q>0)bb=1-Q/100;else yb=-(Q/100)-1;J=145*((Q+100)/2)/100;ga&&e();break;case "angle":Sa=Q;J=Sa/180;J+=0.5;J*=145;ga&&e()}if(J>145)J= +145;else if(J<0)J=0;va.css({"margin-left":J-5})}).change()});var Gb=function(ra){var ia=ra.pageX-nb.offset.left-parseInt(nb.parent.css("border-left-width"));if(ia>145)ia=145;if(ia<=0)ia=0;var va=ia-5;ia/=145;switch(nb.type){case "radius":ia=Math.pow(ia*2,2.5);if(ia>0.98&&ia<1.02)ia=1;if(ia<=0.01)ia=0.01;ba.setAttribute("r",ia);break;case "opacity":q.paint.alpha=parseInt(ia*100);la.setAttribute("fill-opacity",ia);break;case "ellip":bb=yb=1;if(ia<0.5){ia/=0.5;yb=ia<=0?0.01:ia}else if(ia>0.5){ia/=0.5; +ia=2-ia;bb=ia<=0?0.01:ia}e();ia-=1;if(bb===ia+1)ia=Math.abs(ia);break;case "angle":ia-=0.5;Sa=ia*=180;e();ia/=100}nb.elem.css({"margin-left":va});ia=Math.round(ia*100);nb.input.val(ia);ra.preventDefault()},Ob=function(){aa.unbind("mousemove",Gb).unbind("mouseup",Ob);nb=null};for(P=(q.paint.alpha*255/100).toString(16);P.length<2;)P="0"+P;P=P.split(".")[0];H=q.paint.solidColor=="none"?"":q.paint.solidColor+P;ua||(H=zb[0].getAttribute("stop-color"));$.extend($.fn.jPicker.defaults.window,{alphaSupport:true, +effects:{type:"show",speed:0}});T.jPicker({window:{title:v.window.pickerTitle},images:{clientPath:v.images.clientPath},color:{active:H,alphaSupport:true}},function(ra){q.paint.type="solidColor";q.paint.alpha=ra.val("ahex")?Math.round(ra.val("a")/255*100):100;q.paint.solidColor=ra.val("hex")?ra.val("hex"):"none";q.paint.radialGradient=null;V()},null,function(){M()});var Kb=$(I+" .jGraduate_tabs li");Kb.click(function(){Kb.removeClass("jGraduate_tab_current");$(this).addClass("jGraduate_tab_current"); +$(I+" > div").hide();var ra=$(this).attr("data-type");$(I+" .jGraduate_gradPick").show();if(ra==="rg"||ra==="lg"){$(".jGraduate_"+ra+"_field").show();$(".jGraduate_"+(ra==="lg"?"rg":"lg")+"_field").hide();$("#"+p+"_jgraduate_rect")[0].setAttribute("fill","url(#"+p+"_"+ra+"_jgraduate_grad)");X=ra==="lg"?"linearGradient":"radialGradient";$("#"+p+"_jGraduate_OpacInput").val(q.paint.alpha).change();var ia=$("#"+p+"_"+ra+"_jgraduate_grad")[0];if(ba!==ia){var va=$(ba).find("stop");$(ia).empty().append(va); +ba=ia;ia=rb.val();ba.setAttribute("spreadMethod",ia)}jb=ra==="rg"&&ba.getAttribute("fx")!=null&&!(Ma==Qa&&Ra==Va);$("#"+p+"_jGraduate_focusCoord").toggle(jb);if(jb)$("#"+p+"_jGraduate_match_ctr")[0].checked=false}else{$(I+" .jGraduate_gradPick").hide();$(I+" .jGraduate_colPick").show()}});$(I+" > div").hide();Kb.removeClass("jGraduate_tab_current");var Ub;switch(q.paint.type){case "linearGradient":Ub=$(I+" .jGraduate_tab_lingrad");break;case "radialGradient":Ub=$(I+" .jGraduate_tab_radgrad");break; +default:Ub=$(I+" .jGraduate_tab_color")}q.show();setTimeout(function(){Ub.addClass("jGraduate_tab_current").click()},10)}else alert("Container element must have an id attribute to maintain unique id strings for sub-elements.")})}})();$.fn.SpinButton=function(a){function o(f,c){for(var l=f[c],n=document.body;(f=f.offsetParent)&&f!=n;)if(!$.browser.msie||f.currentStyle.position!="relative")l+=f[c];return l}return this.each(function(){this.repeating=false;this.spinCfg={min:a&&!isNaN(parseFloat(a.min))?Number(a.min):null,max:a&&!isNaN(parseFloat(a.max))?Number(a.max):null,step:a&&a.step?Number(a.step):1,stepfunc:a&&a.stepfunc?a.stepfunc:false,page:a&&a.page?Number(a.page):10,upClass:a&&a.upClass?a.upClass:"up",downClass:a&&a.downClass? a.downClass:"down",reset:a&&a.reset?a.reset:this.value,delay:a&&a.delay?Number(a.delay):500,interval:a&&a.interval?Number(a.interval):100,_btn_width:20,_direction:null,_delay:null,_repeat:null,callback:a&&a.callback?a.callback:null};this.spinCfg.smallStep=a&&a.smallStep?a.smallStep:this.spinCfg.step/2;this.adjustValue=function(f){f=isNaN(this.value)?this.spinCfg.reset:$.isFunction(this.spinCfg.stepfunc)?this.spinCfg.stepfunc(this,f):Number((Number(this.value)+Number(f)).toFixed(5));if(this.spinCfg.min!== -null)f=Math.max(f,this.spinCfg.min);if(this.spinCfg.max!==null)f=Math.min(f,this.spinCfg.max);this.value=f;$.isFunction(this.spinCfg.callback)&&this.spinCfg.callback(this)};$(this).addClass(a&&a.spinClass?a.spinClass:"spin-button").mousemove(function(f){var c=f.pageX||f.x,m=f.pageY||f.y;f=f.target||f.srcElement;var p=svgEditor.tool_scale||1,b=$(f).height()/2;c=c>o(f,"offsetLeft")+f.offsetWidth*p-this.spinCfg._btn_width?mo(f,"offsetLeft")+f.offsetWidth*n-this.spinCfg._btn_width?l=120)this.adjustValue(this.spinCfg.step);else f.wheelDelta<=-120&&this.adjustValue(-this.spinCfg.step);f.preventDefault()}).change(function(){this.adjustValue(0)});this.addEventListener&&this.addEventListener("DOMMouseScroll",function(f){if(f.detail>0)this.adjustValue(-this.spinCfg.step);else f.detail<0&&this.adjustValue(this.spinCfg.step);f.preventDefault()},false)})};function touchHandler(a){var o=a.changedTouches,f=o[0],c="";switch(a.type){case "touchstart":c="mousedown";break;case "touchmove":c="mousemove";break;case "touchend":c="mouseup";break;default:return}var m=document.createEvent("MouseEvent");m.initMouseEvent(c,true,true,window,1,f.screenX,f.screenY,f.clientX,f.clientY,false,false,false,false,0,null);if(o.length<2){f.target.dispatchEvent(m);a.preventDefault()}};jQuery&&function(){var a=$(window),o=$(document);$.extend($.fn,{contextMenu:function(f,c){if(f.menu==undefined)return false;if(f.inSpeed==undefined)f.inSpeed=150;if(f.outSpeed==undefined)f.outSpeed=75;if(f.inSpeed==0)f.inSpeed=-1;if(f.outSpeed==0)f.outSpeed=-1;$(this).each(function(){var m=$(this),p=$(m).offset(),b=$("#"+f.menu);b.addClass("contextMenu");$(this).bind("mousedown",function(d){$(this).mouseup(function(e){var l=$(this);l.unbind("mouseup");$(".contextMenu").hide();if(d.button===2||f.allowLeft|| -d.ctrlKey&&svgedit.browser.isMac()){e.stopPropagation();if(m.hasClass("disabled")||d.altKey)return false;var q=e.pageX,u=e.pageY;e=a.width()-b.width();var n=a.height()-b.height();if(q>e-15)q=e-15;if(u>n-30)u=n-30;o.unbind("click");b.css({top:u,left:q}).fadeIn(f.inSpeed);b.find("A").mouseover(function(){b.find("LI.hover").removeClass("hover");$(this).parent().addClass("hover")}).mouseout(function(){b.find("LI.hover").removeClass("hover")});o.keypress(function(I){switch(I.keyCode){case 38:if(b.find("LI.hover").length){b.find("LI.hover").removeClass("hover").prevAll("LI:not(.disabled)").eq(0).addClass("hover"); +function(f){if(f.wheelDelta>=120)this.adjustValue(this.spinCfg.step);else f.wheelDelta<=-120&&this.adjustValue(-this.spinCfg.step);f.preventDefault()}).change(function(){this.adjustValue(0)});this.addEventListener&&this.addEventListener("DOMMouseScroll",function(f){if(f.detail>0)this.adjustValue(-this.spinCfg.step);else f.detail<0&&this.adjustValue(this.spinCfg.step);f.preventDefault()},false)})};function touchHandler(a){var o=a.changedTouches,f=o[0],c="";switch(a.type){case "touchstart":c="mousedown";break;case "touchmove":c="mousemove";break;case "touchend":c="mouseup";break;default:return}var l=document.createEvent("MouseEvent");l.initMouseEvent(c,true,true,window,1,f.screenX,f.screenY,f.clientX,f.clientY,false,false,false,false,0,null);if(o.length<2){f.target.dispatchEvent(l);a.preventDefault()}};jQuery&&function(){var a=$(window),o=$(document);$.extend($.fn,{contextMenu:function(f,c){if(f.menu==undefined)return false;if(f.inSpeed==undefined)f.inSpeed=150;if(f.outSpeed==undefined)f.outSpeed=75;if(f.inSpeed==0)f.inSpeed=-1;if(f.outSpeed==0)f.outSpeed=-1;$(this).each(function(){var l=$(this),n=$(l).offset(),b=$("#"+f.menu);b.addClass("contextMenu");$(this).bind("mousedown",function(d){$(this).mouseup(function(e){var m=$(this);m.unbind("mouseup");$(".contextMenu").hide();if(d.button===2||f.allowLeft|| +d.ctrlKey&&svgedit.browser.isMac()){e.stopPropagation();if(l.hasClass("disabled")||d.altKey)return false;var q=e.pageX,v=e.pageY;e=a.width()-b.width();var p=a.height()-b.height();if(q>e-15)q=e-15;if(v>p-30)v=p-30;o.unbind("click");b.css({top:v,left:q}).fadeIn(f.inSpeed);b.find("A").mouseover(function(){b.find("LI.hover").removeClass("hover");$(this).parent().addClass("hover")}).mouseout(function(){b.find("LI.hover").removeClass("hover")});o.keypress(function(I){switch(I.keyCode){case 38:if(b.find("LI.hover").length){b.find("LI.hover").removeClass("hover").prevAll("LI:not(.disabled)").eq(0).addClass("hover"); b.find("LI.hover").length||b.find("LI:last").addClass("hover")}else b.find("LI:last").addClass("hover");break;case 40:if(b.find("LI.hover").length==0)b.find("LI:first").addClass("hover");else{b.find("LI.hover").removeClass("hover").nextAll("LI:not(.disabled)").eq(0).addClass("hover");b.find("LI.hover").length||b.find("LI:first").addClass("hover")}break;case 13:b.find("LI.hover A").trigger("click");break;case 27:o.trigger("click")}});b.find("A").unbind("mouseup");b.find("LI:not(.disabled) A").mouseup(function(){o.unbind("click").unbind("keypress"); -$(".contextMenu").hide();c&&c($(this).attr("href").substr(1),$(l),{x:q-p.left,y:u-p.top,docX:q,docY:u});return false});setTimeout(function(){o.click(function(){o.unbind("click").unbind("keypress");b.fadeOut(f.outSpeed);return false})},0)}})});if($.browser.mozilla)$("#"+f.menu).each(function(){$(this).css({MozUserSelect:"none"})});else $.browser.msie?$("#"+f.menu).each(function(){$(this).bind("selectstart.disableTextSelect",function(){return false})}):$("#"+f.menu).each(function(){$(this).bind("mousedown.disableTextSelect", -function(){return false})});$(m).add($("UL.contextMenu")).bind("contextmenu",function(){return false})});return $(this)},disableContextMenuItems:function(f){if(f==undefined){$(this).find("LI").addClass("disabled");return $(this)}$(this).each(function(){if(f!=undefined)for(var c=f.split(","),m=0;m=0,p=o.indexOf("Gecko/")>=0,b=o.indexOf("MSIE")>=0,d=o.indexOf("Chrome/")>=0,e=o.indexOf("Windows")>=0,l=o.indexOf("Macintosh")>= -0,q="ontouchstart"in window,u=!!f.querySelector,n=!!document.evaluate,I=function(){var ha=document.createElementNS("http://www.w3.org/2000/svg","path");ha.setAttribute("d","M0,0 10,10");var W=ha.pathSegList;ha=ha.createSVGPathSegLinetoAbs(5,5);try{W.replaceItem(ha,0);return true}catch(Z){}return false}(),S=function(){var ha=document.createElementNS("http://www.w3.org/2000/svg","path");ha.setAttribute("d","M0,0 10,10");var W=ha.pathSegList;ha=ha.createSVGPathSegLinetoAbs(5,5);try{W.insertItemBefore(ha, -0);return true}catch(Z){}return false}(),O=function(){var ha=document.createElementNS("http://www.w3.org/2000/svg","svg"),W=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(ha);W.setAttribute("x",5);ha.appendChild(W);var Z=document.createElementNS("http://www.w3.org/2000/svg","text");Z.textContent="a";W.appendChild(Z);W=Z.getStartPositionOfChar(0).x;document.documentElement.removeChild(ha);return W===0}(),H=function(){var ha=document.createElementNS("http://www.w3.org/2000/svg", -"svg");document.documentElement.appendChild(ha);var W=document.createElementNS("http://www.w3.org/2000/svg","path");W.setAttribute("d","M0,0 C0,0 10,10 10,0");ha.appendChild(W);W=W.getBBox();document.documentElement.removeChild(ha);return W.height>4&&W.height<5}(),ea=function(){var ha=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(ha);var W=document.createElementNS("http://www.w3.org/2000/svg","path");W.setAttribute("d","M0,0 10,0");var Z=document.createElementNS("http://www.w3.org/2000/svg", -"path");Z.setAttribute("d","M5,0 15,0");var ba=document.createElementNS("http://www.w3.org/2000/svg","g");ba.appendChild(W);ba.appendChild(Z);ha.appendChild(ba);W=ba.getBBox();document.documentElement.removeChild(ha);return W.width==15}(),X=function(){var ha=document.createElementNS("http://www.w3.org/2000/svg","rect");ha.setAttribute("x",0.1);(ha=ha.cloneNode(false).getAttribute("x").indexOf(",")==-1)||$.alert("NOTE: This version of Opera is known to contain bugs in SVG-edit.\n\t\tPlease upgrade to the latest version in which the problems have been fixed."); -return ha}(),Q=function(){var ha=document.createElementNS("http://www.w3.org/2000/svg","rect");ha.setAttribute("style","vector-effect:non-scaling-stroke");return ha.style.vectorEffect==="non-scaling-stroke"}(),R=function(){var ha=document.createElementNS("http://www.w3.org/2000/svg","rect").transform.baseVal,W=f.createSVGTransform();ha.appendItem(W);return ha.getItem(0)==W}();svgedit.browser.isOpera=function(){return c};svgedit.browser.isWebkit=function(){return m};svgedit.browser.isGecko=function(){return p}; -svgedit.browser.isIE=function(){return b};svgedit.browser.isChrome=function(){return d};svgedit.browser.isWindows=function(){return e};svgedit.browser.isMac=function(){return l};svgedit.browser.isTouch=function(){return q};svgedit.browser.supportsSelectors=function(){return u};svgedit.browser.supportsXpath=function(){return n};svgedit.browser.supportsPathReplaceItem=function(){return I};svgedit.browser.supportsPathInsertItemBefore=function(){return S};svgedit.browser.supportsPathBBox=function(){return H}; -svgedit.browser.supportsHVLineContainerBBox=function(){return ea};svgedit.browser.supportsGoodTextCharPos=function(){return O};svgedit.browser.supportsEditableText=function(){return c};svgedit.browser.supportsGoodDecimals=function(){return X};svgedit.browser.supportsNonScalingStroke=function(){return Q};svgedit.browser.supportsNativeTransformLists=function(){return R}}else window.location="browser-not-supported.html"})();svgedit=svgedit||{}; -(function(){if(!svgedit.transformlist)svgedit.transformlist={};var a=document.createElementNS("http://www.w3.org/2000/svg","svg"),o={};svgedit.transformlist.SVGTransformList=function(f){this._elem=f||null;this._xforms=[];this._update=function(){var c="";a.createSVGMatrix();for(var m=0;m=0)return this._xforms[c];throw{code:1};};this.insertItemBefore=function(c,m){var p=null;if(m>=0)if(m=0){this._removeFromOtherLists(c);p=this._xforms[m]=c;this._list._update()}return p};this.removeItem=function(c){if(c=0){for(var m=this._xforms[c],p=Array(this.numberOfItems- -1),b=0;b=0,n=o.indexOf("Gecko/")>=0,b=o.indexOf("MSIE")>=0,d=o.indexOf("Chrome/")>=0,e=o.indexOf("Windows")>=0,m=o.indexOf("Macintosh")>= +0,q="ontouchstart"in window,v=!!f.querySelector,p=!!document.evaluate,I=function(){var ea=document.createElementNS("http://www.w3.org/2000/svg","path");ea.setAttribute("d","M0,0 10,10");var S=ea.pathSegList;ea=ea.createSVGPathSegLinetoAbs(5,5);try{S.replaceItem(ea,0);return true}catch(X){}return false}(),V=function(){var ea=document.createElementNS("http://www.w3.org/2000/svg","path");ea.setAttribute("d","M0,0 10,10");var S=ea.pathSegList;ea=ea.createSVGPathSegLinetoAbs(5,5);try{S.insertItemBefore(ea, +0);return true}catch(X){}return false}(),M=function(){var ea=document.createElementNS("http://www.w3.org/2000/svg","svg"),S=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(ea);S.setAttribute("x",5);ea.appendChild(S);var X=document.createElementNS("http://www.w3.org/2000/svg","text");X.textContent="a";S.appendChild(X);S=X.getStartPositionOfChar(0).x;document.documentElement.removeChild(ea);return S===0}(),H=function(){var ea=document.createElementNS("http://www.w3.org/2000/svg", +"svg");document.documentElement.appendChild(ea);var S=document.createElementNS("http://www.w3.org/2000/svg","path");S.setAttribute("d","M0,0 C0,0 10,10 10,0");ea.appendChild(S);S=S.getBBox();document.documentElement.removeChild(ea);return S.height>4&&S.height<5}(),aa=function(){var ea=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(ea);var S=document.createElementNS("http://www.w3.org/2000/svg","path");S.setAttribute("d","M0,0 10,0");var X=document.createElementNS("http://www.w3.org/2000/svg", +"path");X.setAttribute("d","M5,0 15,0");var ba=document.createElementNS("http://www.w3.org/2000/svg","g");ba.appendChild(S);ba.appendChild(X);ea.appendChild(ba);S=ba.getBBox();document.documentElement.removeChild(ea);return S.width==15}(),T=function(){var ea=document.createElementNS("http://www.w3.org/2000/svg","rect");ea.setAttribute("x",0.1);(ea=ea.cloneNode(false).getAttribute("x").indexOf(",")==-1)||$.alert("NOTE: This version of Opera is known to contain bugs in SVG-edit.\n\t\tPlease upgrade to the latest version in which the problems have been fixed."); +return ea}(),P=function(){var ea=document.createElementNS("http://www.w3.org/2000/svg","rect");ea.setAttribute("style","vector-effect:non-scaling-stroke");return ea.style.vectorEffect==="non-scaling-stroke"}(),R=function(){var ea=document.createElementNS("http://www.w3.org/2000/svg","rect").transform.baseVal,S=f.createSVGTransform();ea.appendItem(S);return ea.getItem(0)==S}();svgedit.browser.isOpera=function(){return c};svgedit.browser.isWebkit=function(){return l};svgedit.browser.isGecko=function(){return n}; +svgedit.browser.isIE=function(){return b};svgedit.browser.isChrome=function(){return d};svgedit.browser.isWindows=function(){return e};svgedit.browser.isMac=function(){return m};svgedit.browser.isTouch=function(){return q};svgedit.browser.supportsSelectors=function(){return v};svgedit.browser.supportsXpath=function(){return p};svgedit.browser.supportsPathReplaceItem=function(){return I};svgedit.browser.supportsPathInsertItemBefore=function(){return V};svgedit.browser.supportsPathBBox=function(){return H}; +svgedit.browser.supportsHVLineContainerBBox=function(){return aa};svgedit.browser.supportsGoodTextCharPos=function(){return M};svgedit.browser.supportsEditableText=function(){return c};svgedit.browser.supportsGoodDecimals=function(){return T};svgedit.browser.supportsNonScalingStroke=function(){return P};svgedit.browser.supportsNativeTransformLists=function(){return R}}else window.location="browser-not-supported.html"})();svgedit=svgedit||{}; +(function(){if(!svgedit.transformlist)svgedit.transformlist={};var a=document.createElementNS("http://www.w3.org/2000/svg","svg"),o={};svgedit.transformlist.SVGTransformList=function(f){this._elem=f||null;this._xforms=[];this._update=function(){var c="";a.createSVGMatrix();for(var l=0;l=0)return this._xforms[c];throw{code:1};};this.insertItemBefore=function(c,l){var n=null;if(l>=0)if(l=0){this._removeFromOtherLists(c);n=this._xforms[l]=c;this._list._update()}return n};this.removeItem=function(c){if(c=0){for(var l=this._xforms[c],n=Array(this.numberOfItems- +1),b=0;b1;)c=o[f-1].multiply(c);if(Math.abs(c.a)<1.0E-14)c.a=0;if(Math.abs(c.b)<1.0E-14)c.b=0;if(Math.abs(c.c)<1.0E-14)c.c=0;if(Math.abs(c.d)< -1.0E-14)c.d=0;if(Math.abs(c.e)<1.0E-14)c.e=0;if(Math.abs(c.f)<1.0E-14)c.f=0;return c};svgedit.math.hasMatrixTransform=function(o){if(!o)return false;for(var f=o.numberOfItems;f--;){var c=o.getItem(f);if(c.type==1&&!svgedit.math.isIdentity(c.matrix))return true}return false};svgedit.math.transformBox=function(o,f,c,m,p){var b={x:o,y:f},d={x:o+c,y:f};c={x:o+c,y:f+m};o={x:o,y:f+m};f=svgedit.math.transformPoint;b=f(b.x,b.y,p);var e=m=b.x,l=b.y,q=b.y;d=f(d.x,d.y,p);m=Math.min(m,d.x);e=Math.max(e,d.x); -l=Math.min(l,d.y);q=Math.max(q,d.y);o=f(o.x,o.y,p);m=Math.min(m,o.x);e=Math.max(e,o.x);l=Math.min(l,o.y);q=Math.max(q,o.y);c=f(c.x,c.y,p);m=Math.min(m,c.x);e=Math.max(e,c.x);l=Math.min(l,c.y);q=Math.max(q,c.y);return{tl:b,tr:d,bl:o,br:c,aabox:{x:m,y:l,width:e-m,height:q-l}}};svgedit.math.transformListToTransform=function(o,f,c){if(o==null)return a.createSVGTransformFromMatrix(a.createSVGMatrix());f=f==undefined?0:f;c=c==undefined?o.numberOfItems-1:c;f=parseInt(f);c=parseInt(c);if(f>c){var m=c;c=f; -f=m}m=a.createSVGMatrix();for(f=f;f<=c;++f){var p=f>=0&&fc){var l=c;c=f; +f=l}l=a.createSVGMatrix();for(f=f;f<=c;++f){var n=f>=0&&fo.x&&f.yo.y}})();svgedit=svgedit||{}; -(function(){if(!svgedit.units)svgedit.units={};var a=["x","x1","cx","rx","width"],o=["y","y1","cy","ry","height"],f=$.merge(["r","radius"],a);$.merge(f,o);var c,m={px:1};svgedit.units.init=function(b){c=b;b=document.createElementNS("http://www.w3.org/2000/svg","svg");document.body.appendChild(b);var d=document.createElementNS("http://www.w3.org/2000/svg","rect");d.setAttribute("width","1em");d.setAttribute("height","1ex");d.setAttribute("x","1in");b.appendChild(d);d=d.getBBox();document.body.removeChild(b); -b=d.x;m.em=d.width;m.ex=d.height;m["in"]=b;m.cm=b/2.54;m.mm=b/25.4;m.pt=b/72;m.pc=b/6;m["%"]=0};svgedit.units.getTypeMap=function(){return m};svgedit.units.shortFloat=function(b){var d=c.getRoundDigits();if(isNaN(b)){if($.isArray(b))return svgedit.units.shortFloat(b[0])+","+svgedit.units.shortFloat(b[1])}else return+(+b).toFixed(d);return parseFloat(b).toFixed(d)-0};svgedit.units.convertUnit=function(b,d){d=d||c.getBaseUnit();return svgedit.unit.shortFloat(b/m[d])};svgedit.units.setUnitAttr=function(b, -d,e){isNaN(e)||b.getAttribute(d);b.setAttribute(d,e)};var p={line:["x1","x2","y1","y2"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],foreignObject:["x","y","width","height"],rect:["x","y","width","height"],image:["x","y","width","height"],use:["x","y","width","height"],text:["x","y"]};svgedit.units.convertAttrs=function(b){var d=b.tagName,e=c.getBaseUnit();if(d=p[d])for(var l=d.length,q=0;q=0?e*l:o.indexOf(b)>=0?e*q:e*Math.sqrt(l*l+q*q)/Math.sqrt(2)}else{l=d.substr(-2);e=d.substr(0,d.length-2);return e*m[l]}};svgedit.units.isValidUnit=function(b,d,e){var l=false;if(f.indexOf(b)>=0)if(isNaN(d)){d=d.toLowerCase();$.each(m,function(n){if(!l)if(RegExp("^-?[\\d\\.]+"+n+"$").test(d))l=true})}else l=true;else if(b=="id"){b=false;try{var q=c.getElement(d); -b=q==null||q===e}catch(u){}return b}else l=true;return l}})();svgedit=svgedit||{}; -(function(){function a(b){if(svgedit.browser.supportsHVLineContainerBBox())try{return b.getBBox()}catch(d){}var e=$.data(b,"ref"),l=null;if(e){var q=$(e).children().clone().attr("visibility","hidden");$(p).append(q);l=q.filter("line, path")}else l=$(b).find("line, path");var u=false;if(l.length){l.each(function(){var n=this.getBBox();if(!n.width||!n.height)u=true});if(u){b=e?q:$(b).children();ret=getStrokedBBox(b)}else ret=b.getBBox()}else ret=b.getBBox();e&&q.remove();return ret}if(!svgedit.utilities)svgedit.utilities= -{};var o="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use".split(","),f=null,c=null,m=null,p=null;svgedit.utilities.init=function(b){f=b;c=b.getDOMDocument();m=b.getDOMContainer();p=b.getSVGRoot()};svgedit.utilities.toXml=function(b){return $("

    ").text(b).html()};svgedit.utilities.fromXml=function(b){return $("

    ").html(b).text()};svgedit.utilities.encode64=function(b){b=svgedit.utilities.convertToXMLReferences(b);if(window.btoa)return window.btoa(b); -var d=Array(Math.floor((b.length+2)/3)*4),e,l,q,u,n,I,S=0,O=0;do{e=b.charCodeAt(S++);l=b.charCodeAt(S++);q=b.charCodeAt(S++);u=e>>2;e=(e&3)<<4|l>>4;n=(l&15)<<2|q>>6;I=q&63;if(isNaN(l))n=I=64;else if(isNaN(q))I=64;d[O++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(u);d[O++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(e);d[O++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(n);d[O++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(I)}while(S< -b.length);return d.join("")};svgedit.utilities.decode64=function(b){if(window.atob)return window.atob(b);var d="",e,l,q="",u,n="",I=0;b=b.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(I++));l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(I++));u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(I++));n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(I++)); -e=e<<2|l>>4;l=(l&15)<<4|u>>2;q=(u&3)<<6|n;d+=String.fromCharCode(e);if(u!=64)d+=String.fromCharCode(l);if(n!=64)d+=String.fromCharCode(q)}while(I127)d+="&#"+l+";"}return d};svgedit.utilities.text2xml=function(b){if(b.indexOf("=0)b=b.replace(/<(\/?)svg:/g,"<$1").replace("xmlns:svg","xmlns");var d;try{var e=window.DOMParser? -new DOMParser:new ActiveXObject("Microsoft.XMLDOM");e.async=false}catch(l){throw Error("XML Parser could not be instantiated");}try{d=e.loadXML?e.loadXML(b)?e:false:e.parseFromString(b,"text/xml")}catch(q){throw Error("Error parsing XML string");}return d};svgedit.utilities.bboxToObj=function(b){return{x:b.x,y:b.y,width:b.width,height:b.height}};svgedit.utilities.walkTree=function(b,d){if(b&&b.nodeType==1){d(b);for(var e=b.childNodes.length;e--;)svgedit.utilities.walkTree(b.childNodes.item(e),d)}}; +(function(){if(!svgedit.units)svgedit.units={};var a=["x","x1","cx","rx","width"],o=["y","y1","cy","ry","height"],f=$.merge(["r","radius"],a);$.merge(f,o);var c,l={px:1};svgedit.units.init=function(b){c=b;b=document.createElementNS("http://www.w3.org/2000/svg","svg");document.body.appendChild(b);var d=document.createElementNS("http://www.w3.org/2000/svg","rect");d.setAttribute("width","1em");d.setAttribute("height","1ex");d.setAttribute("x","1in");b.appendChild(d);d=d.getBBox();document.body.removeChild(b); +b=d.x;l.em=d.width;l.ex=d.height;l["in"]=b;l.cm=b/2.54;l.mm=b/25.4;l.pt=b/72;l.pc=b/6;l["%"]=0};svgedit.units.getTypeMap=function(){return l};svgedit.units.shortFloat=function(b){var d=c.getRoundDigits();if(isNaN(b)){if($.isArray(b))return svgedit.units.shortFloat(b[0])+","+svgedit.units.shortFloat(b[1])}else return+(+b).toFixed(d);return parseFloat(b).toFixed(d)-0};svgedit.units.convertUnit=function(b,d){d=d||c.getBaseUnit();return svgedit.unit.shortFloat(b/l[d])};svgedit.units.setUnitAttr=function(b, +d,e){isNaN(e)||b.getAttribute(d);b.setAttribute(d,e)};var n={line:["x1","x2","y1","y2"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],foreignObject:["x","y","width","height"],rect:["x","y","width","height"],image:["x","y","width","height"],use:["x","y","width","height"],text:["x","y"]};svgedit.units.convertAttrs=function(b){var d=b.tagName,e=c.getBaseUnit();if(d=n[d])for(var m=d.length,q=0;q=0?e*m:o.indexOf(b)>=0?e*q:e*Math.sqrt(m*m+q*q)/Math.sqrt(2)}else{m=d.substr(-2);e=d.substr(0,d.length-2);return e*l[m]}};svgedit.units.isValidUnit=function(b,d,e){var m=false;if(f.indexOf(b)>=0)if(isNaN(d)){d=d.toLowerCase();$.each(l,function(p){if(!m)if(RegExp("^-?[\\d\\.]+"+p+"$").test(d))m=true})}else m=true;else if(b=="id"){b=false;try{var q=c.getElement(d); +b=q==null||q===e}catch(v){}return b}else m=true;return m}})();svgedit=svgedit||{}; +(function(){function a(b){if(svgedit.browser.supportsHVLineContainerBBox())try{return b.getBBox()}catch(d){}var e=$.data(b,"ref"),m=null;if(e){var q=$(e).children().clone().attr("visibility","hidden");$(n).append(q);m=q.filter("line, path")}else m=$(b).find("line, path");var v=false;if(m.length){m.each(function(){var p=this.getBBox();if(!p.width||!p.height)v=true});if(v){b=e?q:$(b).children();ret=getStrokedBBox(b)}else ret=b.getBBox()}else ret=b.getBBox();e&&q.remove();return ret}if(!svgedit.utilities)svgedit.utilities= +{};var o="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use".split(","),f=null,c=null,l=null,n=null;svgedit.utilities.init=function(b){f=b;c=b.getDOMDocument();l=b.getDOMContainer();n=b.getSVGRoot()};svgedit.utilities.toXml=function(b){return $("

    ").text(b).html()};svgedit.utilities.fromXml=function(b){return $("

    ").html(b).text()};svgedit.utilities.encode64=function(b){b=svgedit.utilities.convertToXMLReferences(b);if(window.btoa)return window.btoa(b); +var d=Array(Math.floor((b.length+2)/3)*4),e,m,q,v,p,I,V=0,M=0;do{e=b.charCodeAt(V++);m=b.charCodeAt(V++);q=b.charCodeAt(V++);v=e>>2;e=(e&3)<<4|m>>4;p=(m&15)<<2|q>>6;I=q&63;if(isNaN(m))p=I=64;else if(isNaN(q))I=64;d[M++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(v);d[M++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(e);d[M++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(p);d[M++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(I)}while(V< +b.length);return d.join("")};svgedit.utilities.decode64=function(b){if(window.atob)return window.atob(b);var d="",e,m,q="",v,p="",I=0;b=b.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(I++));m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(I++));v="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(I++));p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(I++)); +e=e<<2|m>>4;m=(m&15)<<4|v>>2;q=(v&3)<<6|p;d+=String.fromCharCode(e);if(v!=64)d+=String.fromCharCode(m);if(p!=64)d+=String.fromCharCode(q)}while(I127)d+="&#"+m+";"}return d};svgedit.utilities.text2xml=function(b){if(b.indexOf("=0)b=b.replace(/<(\/?)svg:/g,"<$1").replace("xmlns:svg","xmlns");var d;try{var e=window.DOMParser? +new DOMParser:new ActiveXObject("Microsoft.XMLDOM");e.async=false}catch(m){throw Error("XML Parser could not be instantiated");}try{d=e.loadXML?e.loadXML(b)?e:false:e.parseFromString(b,"text/xml")}catch(q){throw Error("Error parsing XML string");}return d};svgedit.utilities.bboxToObj=function(b){return{x:b.x,y:b.y,width:b.width,height:b.height}};svgedit.utilities.walkTree=function(b,d){if(b&&b.nodeType==1){d(b);for(var e=b.childNodes.length;e--;)svgedit.utilities.walkTree(b.childNodes.item(e),d)}}; svgedit.utilities.walkTreePost=function(b,d){if(b&&b.nodeType==1){for(var e=b.childNodes.length;e--;)svgedit.utilities.walkTree(b.childNodes.item(e),d);d(b)}};svgedit.utilities.getUrlFromAttr=function(b){if(b)if(b.indexOf('url("')===0)return b.substring(5,b.indexOf('"',6));else if(b.indexOf("url('")===0)return b.substring(5,b.indexOf("'",6));else if(b.indexOf("url(")===0)return b.substring(4,b.indexOf(")"));return null};svgedit.utilities.getHref=function(b){return b.getAttributeNS("http://www.w3.org/1999/xlink", -"href")};svgedit.utilities.setHref=function(b,d){b.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",d)};svgedit.utilities.findDefs=function(b){b=f.getSVGContent().documentElement;var d=b.getElementsByTagNameNS("http://www.w3.org/2000/svg","defs");return d=d.length>0?d[0]:b.insertBefore(b.ownerDocument.createElementNS("http://www.w3.org/2000/svg","defs"),b.firstChild.nextSibling)};svgedit.utilities.getPathBBox=function(b){var d=b.pathSegList,e=d.numberOfItems;b=[[],[]];var l=d.getItem(0), -q=[l.x,l.y];for(l=0;l0?d[0]:b.insertBefore(b.ownerDocument.createElementNS("http://www.w3.org/2000/svg","defs"),b.firstChild.nextSibling)};svgedit.utilities.getPathBBox=function(b){var d=b.pathSegList,e=d.numberOfItems;b=[[],[]];var m=d.getItem(0), +q=[m.x,m.y];for(m=0;m= -0){var l=e.split(":");b[l[1]]=o[l[0]]}else b[e]=e=="xmlns"?"http://www.w3.org/2000/xmlns/":null});c[m]=b});svgedit.sanitize.getNSMap=function(){return a};svgedit.sanitize.sanitizeSvg=function(m){if(m.nodeType==3){m.nodeValue=m.nodeValue.replace(/^\s+|\s+$/g,"");m.nodeValue.length||m.parentNode.removeChild(m)}if(m.nodeType==1){var p=m.parentNode;if(m.ownerDocument&&p){var b=f[m.nodeName],d=c[m.nodeName];if(b!=undefined){for(var e=[],l=m.attributes.length;l--;){var q=m.attributes.item(l),u=q.nodeName, -n=q.localName,I=q.namespaceURI;if(!(d.hasOwnProperty(n)&&I==d[n]&&I!="http://www.w3.org/2000/xmlns/")&&!(I=="http://www.w3.org/2000/xmlns/"&&a[q.nodeValue])){u.indexOf("se:")==0&&e.push([u,q.nodeValue]);m.removeAttributeNS(I,n)}if(svgedit.browser.isGecko())switch(u){case "transform":case "gradientTransform":case "patternTransform":n=q.nodeValue.replace(/(\d)-/g,"$1 -");m.setAttribute(u,n)}if(u=="style"){q=q.nodeValue.split(";");for(u=q.length;u--;){n=q[u].split(":");b.indexOf(n[0])>=0&&m.setAttribute(n[0], -n[1])}m.removeAttribute("style")}}$.each(e,function(S,O){m.setAttributeNS("http://svg-edit.googlecode.com",O[0],O[1])});if((l=svgedit.utilities.getHref(m))&&["filter","linearGradient","pattern","radialGradient","textPath","use"].indexOf(m.nodeName)>=0)if(l[0]!="#"){svgedit.utilities.setHref(m,"");m.removeAttributeNS("http://www.w3.org/1999/xlink","href")}if(m.nodeName=="use"&&!svgedit.utilities.getHref(m))p.removeChild(m);else{$.each(["clip-path","fill","filter","marker-end","marker-mid","marker-start", -"mask","stroke"],function(S,O){var H=m.getAttribute(O);if(H)if((H=svgedit.utilities.getUrlFromAttr(H))&&H[0]!=="#"){m.setAttribute(O,"");m.removeAttribute(O)}});for(l=m.childNodes.length;l--;)svgedit.sanitize.sanitizeSvg(m.childNodes.item(l))}}else{for(b=[];m.hasChildNodes();)b.push(p.insertBefore(m.firstChild,m));p.removeChild(m);for(l=b.length;l--;)svgedit.sanitize.sanitizeSvg(b[l])}}}}})();svgedit=svgedit||{}; +"height","width"],msqrt:[],mstyle:["displaystyle","mathbackground","mathcolor","mathvariant","scriptlevel"],msub:[],msubsup:[],msup:[],mtable:["align","columnalign","columnlines","columnspacing","displaystyle","equalcolumns","equalrows","frame","rowalign","rowlines","rowspacing","width"],mtd:["columnalign","columnspan","rowalign","rowspan"],mtext:[],mtr:["columnalign","rowalign"],munder:[],munderover:[],none:[],semantics:[]},c={};$.each(f,function(l,n){var b={};$.each(n,function(d,e){if(e.indexOf(":")>= +0){var m=e.split(":");b[m[1]]=o[m[0]]}else b[e]=e=="xmlns"?"http://www.w3.org/2000/xmlns/":null});c[l]=b});svgedit.sanitize.getNSMap=function(){return a};svgedit.sanitize.sanitizeSvg=function(l){if(l.nodeType==3){l.nodeValue=l.nodeValue.replace(/^\s+|\s+$/g,"");l.nodeValue.length||l.parentNode.removeChild(l)}if(l.nodeType==1){var n=l.parentNode;if(l.ownerDocument&&n){var b=f[l.nodeName],d=c[l.nodeName];if(b!=undefined){for(var e=[],m=l.attributes.length;m--;){var q=l.attributes.item(m),v=q.nodeName, +p=q.localName,I=q.namespaceURI;if(!(d.hasOwnProperty(p)&&I==d[p]&&I!="http://www.w3.org/2000/xmlns/")&&!(I=="http://www.w3.org/2000/xmlns/"&&a[q.nodeValue])){v.indexOf("se:")==0&&e.push([v,q.nodeValue]);l.removeAttributeNS(I,p)}if(svgedit.browser.isGecko())switch(v){case "transform":case "gradientTransform":case "patternTransform":p=q.nodeValue.replace(/(\d)-/g,"$1 -");l.setAttribute(v,p)}if(v=="style"){q=q.nodeValue.split(";");for(v=q.length;v--;){p=q[v].split(":");b.indexOf(p[0])>=0&&l.setAttribute(p[0], +p[1])}l.removeAttribute("style")}}$.each(e,function(V,M){l.setAttributeNS("http://svg-edit.googlecode.com",M[0],M[1])});if((m=svgedit.utilities.getHref(l))&&["filter","linearGradient","pattern","radialGradient","textPath","use"].indexOf(l.nodeName)>=0)if(m[0]!="#"){svgedit.utilities.setHref(l,"");l.removeAttributeNS("http://www.w3.org/1999/xlink","href")}if(l.nodeName=="use"&&!svgedit.utilities.getHref(l))n.removeChild(l);else{$.each(["clip-path","fill","filter","marker-end","marker-mid","marker-start", +"mask","stroke"],function(V,M){var H=l.getAttribute(M);if(H)if((H=svgedit.utilities.getUrlFromAttr(H))&&H[0]!=="#"){l.setAttribute(M,"");l.removeAttribute(M)}});for(m=l.childNodes.length;m--;)svgedit.sanitize.sanitizeSvg(l.childNodes.item(m))}}else{for(b=[];l.hasChildNodes();)b.push(n.insertBefore(l.firstChild,l));n.removeChild(l);for(m=b.length;m--;)svgedit.sanitize.sanitizeSvg(b[m])}}}}})();svgedit=svgedit||{}; (function(){if(!svgedit.history)svgedit.history={};svgedit.history.HistoryEventTypes={BEFORE_APPLY:"before_apply",AFTER_APPLY:"after_apply",BEFORE_UNAPPLY:"before_unapply",AFTER_UNAPPLY:"after_unapply"};svgedit.history.MoveElementCommand=function(a,o,f,c){this.elem=a;this.text=c?"Move "+a.tagName+" to "+c:"Move "+a.tagName;this.oldNextSibling=o;this.oldParent=f;this.newNextSibling=a.nextSibling;this.newParent=a.parentNode};svgedit.history.MoveElementCommand.type=function(){return"svgedit.history.MoveElementCommand"};svgedit.history.MoveElementCommand.prototype.type= svgedit.history.MoveElementCommand.type;svgedit.history.MoveElementCommand.prototype.getText=function(){return this.text};svgedit.history.MoveElementCommand.prototype.apply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APPLY,this);this.elem=this.newParent.insertBefore(this.elem,this.newNextSibling);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_APPLY,this)};svgedit.history.MoveElementCommand.prototype.unapply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_UNAPPLY, this);this.elem=this.oldParent.insertBefore(this.elem,this.oldNextSibling);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_UNAPPLY,this)};svgedit.history.MoveElementCommand.prototype.elements=function(){return[this.elem]};svgedit.history.InsertElementCommand=function(a,o){this.elem=a;this.text=o||"Create "+a.tagName;this.parent=a.parentNode;this.nextSibling=this.elem.nextSibling};svgedit.history.InsertElementCommand.type=function(){return"svgedit.history.InsertElementCommand"};svgedit.history.InsertElementCommand.prototype.type= @@ -139,259 +139,259 @@ function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APP this)};svgedit.history.BatchCommand.prototype.elements=function(){for(var a=[],o=this.stack.length;o--;)for(var f=this.stack[o].elements(),c=f.length;c--;)a.indexOf(f[c])==-1&&a.push(f[c]);return a};svgedit.history.BatchCommand.prototype.addSubCommand=function(a){this.stack.push(a)};svgedit.history.BatchCommand.prototype.isEmpty=function(){return this.stack.length==0};svgedit.history.UndoManager=function(a){this.handler_=a||null;this.undoStackPointer=0;this.undoStack=[];this.undoChangeStackPointer= -1;this.undoableChangeStack=[]};svgedit.history.UndoManager.prototype.resetUndoStack=function(){this.undoStack=[];this.undoStackPointer=0};svgedit.history.UndoManager.prototype.getUndoStackSize=function(){return this.undoStackPointer};svgedit.history.UndoManager.prototype.getRedoStackSize=function(){return this.undoStack.length-this.undoStackPointer};svgedit.history.UndoManager.prototype.getNextUndoCommandText=function(){return this.undoStackPointer>0?this.undoStack[this.undoStackPointer-1].getText(): ""};svgedit.history.UndoManager.prototype.getNextRedoCommandText=function(){return this.undoStackPointer0&&this.undoStack[--this.undoStackPointer].unapply(this.handler_)};svgedit.history.UndoManager.prototype.redo=function(){this.undoStackPointer0&&this.undoStack[this.undoStackPointer++].apply(this.handler_)}; -svgedit.history.UndoManager.prototype.addCommandToHistory=function(a){if(this.undoStackPointer0)this.undoStack=this.undoStack.splice(0,this.undoStackPointer);this.undoStack.push(a);this.undoStackPointer=this.undoStack.length};svgedit.history.UndoManager.prototype.beginUndoableChange=function(a,o){for(var f=++this.undoChangeStackPointer,c=o.length,m=Array(c),p=Array(c);c--;){var b=o[c];if(b!=null){p[c]=b;m[c]=b.getAttribute(a)}}this.undoableChangeStack[f]= -{attrName:a,oldValues:m,elements:p}};svgedit.history.UndoManager.prototype.finishUndoableChange=function(){for(var a=this.undoChangeStackPointer--,o=this.undoableChangeStack[a],f=o.elements.length,c=o.attrName,m=new svgedit.history.BatchCommand("Change "+c);f--;){var p=o.elements[f];if(p!=null){var b={};b[c]=o.oldValues[f];b[c]!=p.getAttribute(c)&&m.addSubCommand(new svgedit.history.ChangeElementCommand(p,b,c))}}this.undoableChangeStack[a]=null;return m}})();svgedit=svgedit||{}; -(function(){if(!svgedit.select)svgedit.select={};var a,o,f;svgedit.select.Selector=function(c,m){this.id=c;this.selectedElement=m;this.locked=true;this.selectorGroup=a.createSVGElement({element:"g",attr:{id:"selectorGroup"+this.id}});this.selectorRect=this.selectorGroup.appendChild(a.createSVGElement({element:"path",attr:{id:"selectedBox"+this.id,fill:"none",stroke:"#4F80FF","stroke-width":"1","shape-rendering":"crispEdges",style:"pointer-events:none"}}));this.gripCoords={nw:null,n:null,ne:null,e:null, -se:null,s:null,sw:null,w:null};this.reset(this.selectedElement)};svgedit.select.Selector.prototype.reset=function(c){this.locked=true;this.selectedElement=c;this.resize();this.selectorGroup.setAttribute("display","inline")};svgedit.select.Selector.prototype.updateGripCursors=function(c){var m=[];c=Math.round(c/45);if(c<0)c+=8;for(var p in f.selectorGrips)m.push(p);for(;c>0;){m.push(m.shift());c--}c=0;for(p in f.selectorGrips){f.selectorGrips[p].setAttribute("style","cursor:"+m[c]+"-resize");c++}}; -svgedit.select.Selector.prototype.showGrips=function(c){f.selectorGripsGroup.setAttribute("display",c?"inline":"none");var m=this.selectedElement;this.hasGrips=c;if(m&&c){this.selectorGroup.appendChild(f.selectorGripsGroup);this.updateGripCursors(svgedit.utilities.getRotationAngle(m))}};svgedit.select.Selector.prototype.resize=function(){var c=this.selectorRect,m=f,p=m.selectorGrips,b=this.selectedElement,d=b.getAttribute("stroke-width"),e=a.currentZoom(),l=1/e;if(b.getAttribute("stroke")!=="none"&& -!isNaN(d))l+=d/2;var q=b.tagName;if(q==="text")l+=2/e;d=svgedit.transformlist.getTransformList(b);d=svgedit.math.transformListToTransform(d).matrix;d.e*=e;d.f*=e;var u=svgedit.utilities.getBBox(b);if(q==="g"&&!$.data(b,"gsvg"))if(q=a.getStrokedBBox(b.childNodes))u=q;q=u.x;var n=u.y,I=u.width;u=u.height;l*=e;e=svgedit.math.transformBox(q*e,n*e,I*e,u*e,d);d=e.aabox;q=d.x-l;n=d.y-l;I=d.width+l*2;var S=d.height+l*2;d=q+I/2;u=n+S/2;if(b=svgedit.utilities.getRotationAngle(b)){q=a.svgRoot().createSVGTransform(); -q.setRotate(-b,d,u);q=q.matrix;e.tl=svgedit.math.transformPoint(e.tl.x,e.tl.y,q);e.tr=svgedit.math.transformPoint(e.tr.x,e.tr.y,q);e.bl=svgedit.math.transformPoint(e.bl.x,e.bl.y,q);e.br=svgedit.math.transformPoint(e.br.x,e.br.y,q);q=e.tl;I=q.x;S=q.y;var O=q.x,H=q.y;q=Math.min;n=Math.max;I=q(I,q(e.tr.x,q(e.bl.x,e.br.x)))-l;S=q(S,q(e.tr.y,q(e.bl.y,e.br.y)))-l;O=n(O,n(e.tr.x,n(e.bl.x,e.br.x)))+l;H=n(H,n(e.tr.y,n(e.bl.y,e.br.y)))+l;q=I;n=S;I=O-I;S=H-S}l=a.svgRoot().suspendRedraw(100);c.setAttribute("d", -"M"+q+","+n+" L"+(q+I)+","+n+" "+(q+I)+","+(n+S)+" "+q+","+(n+S)+"z");this.selectorGroup.setAttribute("transform",b?"rotate("+[b,d,u].join(",")+")":"");q-=3.5;n-=3.5;this.gripCoords={nw:[q,n],ne:[q+I,n],sw:[q,n+S],se:[q+I,n+S],n:[q+I/2,n],w:[q,n+S/2],e:[q+I,n+S/2],s:[q+I/2,n+S]};for(var ea in this.gripCoords){c=this.gripCoords[ea];p[ea].setAttribute("x",c[0]);p[ea].setAttribute("y",c[1])}this.rotateCoords={nw:[q,n],ne:[q+I+8,n],sw:[q,n+S+8],se:[q+I+8,n+S+8]};for(ea in this.rotateCoords){c=this.rotateCoords[ea]; -m.rotateGrips[ea].setAttribute("cx",c[0]);m.rotateGrips[ea].setAttribute("cy",c[1])}a.svgRoot().unsuspendRedraw(l)};svgedit.select.SelectorManager=function(){this.rubberBandBox=this.selectorParentGroup=null;this.selectors=[];this.selectorMap={};this.selectorGrips={nw:null,n:null,ne:null,e:null,se:null,s:null,sw:null,w:null};this.selectorGripsGroup=null;this.rotateGrips={nw:null,ne:null,se:null,sw:null};this.initGroup()};svgedit.select.SelectorManager.prototype.initGroup=function(){this.selectorParentGroup&& -this.selectorParentGroup.parentNode&&this.selectorParentGroup.parentNode.removeChild(this.selectorParentGroup);this.selectorParentGroup=a.createSVGElement({element:"g",attr:{id:"selectorParentGroup"}});this.selectorGripsGroup=a.createSVGElement({element:"g",attr:{display:"none"}});this.selectorParentGroup.appendChild(this.selectorGripsGroup);a.svgRoot().appendChild(this.selectorParentGroup);this.selectorMap={};this.selectors=[];this.rubberBandBox=null;for(var c in this.rotateGrips){var m=a.createSVGElement({element:"circle", -attr:{id:"selectorGrip_rotate_"+c,fill:"#000",r:8,stroke:"#000","fill-opacity":0,"stroke-opacity":0,"stroke-width":0,style:"cursor:url("+o.imgPath+"rotate.png) 12 12, auto;"}});$.data(m,"dir",c);$.data(m,"type","rotate");this.rotateGrips[c]=this.selectorGripsGroup.appendChild(m)}for(c in this.selectorGrips){m=a.createSVGElement({element:"rect",attr:{id:"selectorGrip_resize_"+c,width:7,height:7,fill:"#4F80FF",stroke:"transparent","stroke-width":2,style:"cursor:"+c+"-resize","pointer-events":"all"}}); -$.data(m,"dir",c);$.data(m,"type","resize");this.selectorGrips[c]=this.selectorGripsGroup.appendChild(m)}if(!$("#canvasBackground").length){c=o.dimensions;c=a.createSVGElement({element:"svg",attr:{id:"canvasBackground",width:c[0],height:c[1],x:0,y:0,overflow:svgedit.browser.isWebkit()?"none":"visible",style:"pointer-events:none"}});m=a.createSVGElement({element:"rect",attr:{width:"100%",height:"100%",x:0,y:0,"stroke-width":1,stroke:"#000",fill:"#FFF",style:"pointer-events:none"}});c.appendChild(m); -a.svgRoot().insertBefore(c,a.svgContent())}};svgedit.select.SelectorManager.prototype.requestSelector=function(c){if(c==null)return null;var m=this.selectors.length;if(typeof this.selectorMap[c.id]=="object"){this.selectorMap[c.id].locked=true;return this.selectorMap[c.id]}for(var p=0;p0)this.undoStack=this.undoStack.splice(0,this.undoStackPointer);this.undoStack.push(a);this.undoStackPointer=this.undoStack.length};svgedit.history.UndoManager.prototype.beginUndoableChange=function(a,o){for(var f=++this.undoChangeStackPointer,c=o.length,l=Array(c),n=Array(c);c--;){var b=o[c];if(b!=null){n[c]=b;l[c]=b.getAttribute(a)}}this.undoableChangeStack[f]= +{attrName:a,oldValues:l,elements:n}};svgedit.history.UndoManager.prototype.finishUndoableChange=function(){for(var a=this.undoChangeStackPointer--,o=this.undoableChangeStack[a],f=o.elements.length,c=o.attrName,l=new svgedit.history.BatchCommand("Change "+c);f--;){var n=o.elements[f];if(n!=null){var b={};b[c]=o.oldValues[f];b[c]!=n.getAttribute(c)&&l.addSubCommand(new svgedit.history.ChangeElementCommand(n,b,c))}}this.undoableChangeStack[a]=null;return l}})();svgedit=svgedit||{}; +(function(){if(!svgedit.select)svgedit.select={};var a,o,f;svgedit.select.Selector=function(c,l){this.id=c;this.selectedElement=l;this.locked=true;this.selectorGroup=a.createSVGElement({element:"g",attr:{id:"selectorGroup"+this.id}});this.selectorRect=this.selectorGroup.appendChild(a.createSVGElement({element:"path",attr:{id:"selectedBox"+this.id,fill:"none",stroke:"#4F80FF","stroke-width":"1","shape-rendering":"crispEdges",style:"pointer-events:none"}}));this.gripCoords={nw:null,n:null,ne:null,e:null, +se:null,s:null,sw:null,w:null};this.reset(this.selectedElement)};svgedit.select.Selector.prototype.reset=function(c){this.locked=true;this.selectedElement=c;this.resize();this.selectorGroup.setAttribute("display","inline")};svgedit.select.Selector.prototype.updateGripCursors=function(c){var l=[];c=Math.round(c/45);if(c<0)c+=8;for(var n in f.selectorGrips)l.push(n);for(;c>0;){l.push(l.shift());c--}c=0;for(n in f.selectorGrips){f.selectorGrips[n].setAttribute("style","cursor:"+l[c]+"-resize");c++}}; +svgedit.select.Selector.prototype.showGrips=function(c){f.selectorGripsGroup.setAttribute("display",c?"inline":"none");var l=this.selectedElement;this.hasGrips=c;if(l&&c){this.selectorGroup.appendChild(f.selectorGripsGroup);this.updateGripCursors(svgedit.utilities.getRotationAngle(l))}};svgedit.select.Selector.prototype.resize=function(){var c=this.selectorRect,l=f,n=l.selectorGrips,b=this.selectedElement,d=b.getAttribute("stroke-width"),e=a.currentZoom(),m=1/e;if(b.getAttribute("stroke")!=="none"&& +!isNaN(d))m+=d/2;var q=b.tagName;if(q==="text")m+=2/e;d=svgedit.transformlist.getTransformList(b);d=svgedit.math.transformListToTransform(d).matrix;d.e*=e;d.f*=e;var v=svgedit.utilities.getBBox(b);if(q==="g"&&!$.data(b,"gsvg"))if(q=a.getStrokedBBox(b.childNodes))v=q;q=v.x;var p=v.y,I=v.width;v=v.height;m*=e;e=svgedit.math.transformBox(q*e,p*e,I*e,v*e,d);d=e.aabox;q=d.x-m;p=d.y-m;I=d.width+m*2;var V=d.height+m*2;d=q+I/2;v=p+V/2;if(b=svgedit.utilities.getRotationAngle(b)){q=a.svgRoot().createSVGTransform(); +q.setRotate(-b,d,v);q=q.matrix;e.tl=svgedit.math.transformPoint(e.tl.x,e.tl.y,q);e.tr=svgedit.math.transformPoint(e.tr.x,e.tr.y,q);e.bl=svgedit.math.transformPoint(e.bl.x,e.bl.y,q);e.br=svgedit.math.transformPoint(e.br.x,e.br.y,q);q=e.tl;I=q.x;V=q.y;var M=q.x,H=q.y;q=Math.min;p=Math.max;I=q(I,q(e.tr.x,q(e.bl.x,e.br.x)))-m;V=q(V,q(e.tr.y,q(e.bl.y,e.br.y)))-m;M=p(M,p(e.tr.x,p(e.bl.x,e.br.x)))+m;H=p(H,p(e.tr.y,p(e.bl.y,e.br.y)))+m;q=I;p=V;I=M-I;V=H-V}m=a.svgRoot().suspendRedraw(100);c.setAttribute("d", +"M"+q+","+p+" L"+(q+I)+","+p+" "+(q+I)+","+(p+V)+" "+q+","+(p+V)+"z");this.selectorGroup.setAttribute("transform",b?"rotate("+[b,d,v].join(",")+")":"");q-=3.5;p-=3.5;this.gripCoords={nw:[q,p],ne:[q+I,p],sw:[q,p+V],se:[q+I,p+V],n:[q+I/2,p],w:[q,p+V/2],e:[q+I,p+V/2],s:[q+I/2,p+V]};for(var aa in this.gripCoords){c=this.gripCoords[aa];n[aa].setAttribute("x",c[0]);n[aa].setAttribute("y",c[1])}this.rotateCoords={nw:[q,p],ne:[q+I+8,p],sw:[q,p+V+8],se:[q+I+8,p+V+8]};for(aa in this.rotateCoords){c=this.rotateCoords[aa]; +l.rotateGrips[aa].setAttribute("cx",c[0]);l.rotateGrips[aa].setAttribute("cy",c[1])}a.svgRoot().unsuspendRedraw(m)};svgedit.select.SelectorManager=function(){this.rubberBandBox=this.selectorParentGroup=null;this.selectors=[];this.selectorMap={};this.selectorGrips={nw:null,n:null,ne:null,e:null,se:null,s:null,sw:null,w:null};this.selectorGripsGroup=null;this.rotateGrips={nw:null,ne:null,se:null,sw:null};this.initGroup()};svgedit.select.SelectorManager.prototype.initGroup=function(){this.selectorParentGroup&& +this.selectorParentGroup.parentNode&&this.selectorParentGroup.parentNode.removeChild(this.selectorParentGroup);this.selectorParentGroup=a.createSVGElement({element:"g",attr:{id:"selectorParentGroup"}});this.selectorGripsGroup=a.createSVGElement({element:"g",attr:{display:"none"}});this.selectorParentGroup.appendChild(this.selectorGripsGroup);a.svgRoot().appendChild(this.selectorParentGroup);this.selectorMap={};this.selectors=[];this.rubberBandBox=null;for(var c in this.rotateGrips){var l=a.createSVGElement({element:"circle", +attr:{id:"selectorGrip_rotate_"+c,fill:"#000",r:8,stroke:"#000","fill-opacity":0,"stroke-opacity":0,"stroke-width":0,style:"cursor:url("+o.imgPath+"rotate.png) 12 12, auto;"}});$.data(l,"dir",c);$.data(l,"type","rotate");this.rotateGrips[c]=this.selectorGripsGroup.appendChild(l)}for(c in this.selectorGrips){l=a.createSVGElement({element:"rect",attr:{id:"selectorGrip_resize_"+c,width:7,height:7,fill:"#4F80FF",stroke:"transparent","stroke-width":2,style:"cursor:"+c+"-resize","pointer-events":"all"}}); +$.data(l,"dir",c);$.data(l,"type","resize");this.selectorGrips[c]=this.selectorGripsGroup.appendChild(l)}if(!$("#canvasBackground").length){c=o.dimensions;c=a.createSVGElement({element:"svg",attr:{id:"canvasBackground",width:c[0],height:c[1],x:0,y:0,overflow:svgedit.browser.isWebkit()?"none":"visible",style:"pointer-events:none"}});l=a.createSVGElement({element:"rect",attr:{width:"100%",height:"100%",x:0,y:0,"stroke-width":1,stroke:"#000",fill:"#FFF",style:"pointer-events:none"}});c.appendChild(l); +a.svgRoot().insertBefore(c,a.svgContent())}};svgedit.select.SelectorManager.prototype.requestSelector=function(c){if(c==null)return null;var l=this.selectors.length;if(typeof this.selectorMap[c.id]=="object"){this.selectorMap[c.id].locked=true;return this.selectorMap[c.id]}for(var n=0;n element";this.svgElem_=c;this.obj_num=0;this.idPrefix=m||"svg_";this.releasedNums=[];this.all_layers=[];this.current_layer=null;this.nonce_= -"";var p=this.svgElem_.getAttributeNS("http://svg-edit.googlecode.com","nonce");if(p&&f!=o.NEVER_RANDOMIZE)this.nonce_=p;else f==o.ALWAYS_RANDOMIZE&&this.setNonce(Math.floor(Math.random()*100001))};svgedit.draw.Drawing.prototype.getElem_=function(c){return this.svgElem_.querySelector?this.svgElem_.querySelector("#"+c):$(this.svgElem_).find("[id="+c+"]")[0]};svgedit.draw.Drawing.prototype.getSvgElem=function(){return this.svgElem_};svgedit.draw.Drawing.prototype.getNonce=function(){return this.nonce_}; +(function(){if(!svgedit.draw)svgedit.draw={};var a="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use".split(","),o={LET_DOCUMENT_DECIDE:0,ALWAYS_RANDOMIZE:1,NEVER_RANDOMIZE:2},f=o.LET_DOCUMENT_DECIDE;svgedit.draw.Layer=function(c,l){this.name_=c;this.group_=l};svgedit.draw.Layer.prototype.getName=function(){return this.name_};svgedit.draw.Layer.prototype.getGroup=function(){return this.group_};svgedit.draw.randomizeIds=function(c,l){f=c==false?o.NEVER_RANDOMIZE: +o.ALWAYS_RANDOMIZE;if(f==o.ALWAYS_RANDOMIZE&&!l.getNonce())l.setNonce(Math.floor(Math.random()*100001));else f==o.NEVER_RANDOMIZE&&l.getNonce()&&l.clearNonce()};svgedit.draw.Drawing=function(c,l){if(!c||!c.tagName||!c.namespaceURI||c.tagName!="svg"||c.namespaceURI!="http://www.w3.org/2000/svg")throw"Error: svgedit.draw.Drawing instance initialized without a element";this.svgElem_=c;this.obj_num=0;this.idPrefix=l||"svg_";this.releasedNums=[];this.all_layers=[];this.current_layer=null;this.nonce_= +"";var n=this.svgElem_.getAttributeNS("http://svg-edit.googlecode.com","nonce");if(n&&f!=o.NEVER_RANDOMIZE)this.nonce_=n;else f==o.ALWAYS_RANDOMIZE&&this.setNonce(Math.floor(Math.random()*100001))};svgedit.draw.Drawing.prototype.getElem_=function(c){return this.svgElem_.querySelector?this.svgElem_.querySelector("#"+c):$(this.svgElem_).find("[id="+c+"]")[0]};svgedit.draw.Drawing.prototype.getSvgElem=function(){return this.svgElem_};svgedit.draw.Drawing.prototype.getNonce=function(){return this.nonce_}; svgedit.draw.Drawing.prototype.setNonce=function(c){this.svgElem_.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:se","http://svg-edit.googlecode.com");this.svgElem_.setAttributeNS("http://svg-edit.googlecode.com","se:nonce",c);this.nonce_=c};svgedit.draw.Drawing.prototype.clearNonce=function(){this.nonce_=""};svgedit.draw.Drawing.prototype.getId=function(){return this.nonce_?this.idPrefix+this.nonce_+"_"+this.obj_num:this.idPrefix+this.obj_num};svgedit.draw.Drawing.prototype.getNextId=function(){var c= -this.obj_num,m=false;if(this.releasedNums.length>0){this.obj_num=this.releasedNums.pop();m=true}else this.obj_num++;for(var p=this.getId();this.getElem_(p);){if(m){this.obj_num=c;m=false}this.obj_num++;p=this.getId()}if(m)this.obj_num=c;return p};svgedit.draw.Drawing.prototype.releaseId=function(c){var m=this.idPrefix+(this.nonce_?this.nonce_+"_":"");if(typeof c!="string"||c.indexOf(m)!=0)return false;c=parseInt(c.substr(m.length));if(typeof c!="number"||c<=0||this.releasedNums.indexOf(c)!=-1)return false; -this.releasedNums.push(c);return true};svgedit.draw.Drawing.prototype.getNumLayers=function(){return this.all_layers.length};svgedit.draw.Drawing.prototype.hasLayer=function(c){for(var m=0;m=0&&c1){var c=this.current_layer.parentNode.removeChild(this.current_layer);this.identifyLayers();return c}return null};svgedit.draw.Drawing.prototype.identifyLayers=function(){this.all_layers=[];for(var c=this.svgElem_.childNodes.length,m=[],p=[],b=null,d=false,e=0;e0||!d){for(e=1;p.indexOf("Layer "+e)>=0;)e++;p="Layer "+e;b=c.createElementNS("http://www.w3.org/2000/svg","g");d=c.createElementNS("http://www.w3.org/2000/svg","title");d.textContent=p; -b.appendChild(d);for(d=0;d1))for(var p=0;p0){this.obj_num=this.releasedNums.pop();l=true}else this.obj_num++;for(var n=this.getId();this.getElem_(n);){if(l){this.obj_num=c;l=false}this.obj_num++;n=this.getId()}if(l)this.obj_num=c;return n};svgedit.draw.Drawing.prototype.releaseId=function(c){var l=this.idPrefix+(this.nonce_?this.nonce_+"_":"");if(typeof c!="string"||c.indexOf(l)!=0)return false;c=parseInt(c.substr(l.length));if(typeof c!="number"||c<=0||this.releasedNums.indexOf(c)!=-1)return false; +this.releasedNums.push(c);return true};svgedit.draw.Drawing.prototype.getNumLayers=function(){return this.all_layers.length};svgedit.draw.Drawing.prototype.hasLayer=function(c){for(var l=0;l=0&&c1){var c=this.current_layer.parentNode.removeChild(this.current_layer);this.identifyLayers();return c}return null};svgedit.draw.Drawing.prototype.identifyLayers=function(){this.all_layers=[];for(var c=this.svgElem_.childNodes.length,l=[],n=[],b=null,d=false,e=0;e0||!d){for(e=1;n.indexOf("Layer "+e)>=0;)e++;n="Layer "+e;b=c.createElementNS("http://www.w3.org/2000/svg","g");d=c.createElementNS("http://www.w3.org/2000/svg","title");d.textContent=n; +b.appendChild(d);for(d=0;d1))for(var n=0;n0){d=S0){d=V element";this.elem=d;this.segs=[];this.selected_pts=[];svgedit.path.path=this;this.init()};svgedit.path.Path.prototype.init=function(){$(svgedit.path.getGripContainer()).find("*").attr("display","none");var d= -this.elem.pathSegList,e=d.numberOfItems;this.segs=[];this.selected_pts=[];this.first_seg=null;for(var l=0;l=e?null:d[l+1],I=l-1<0?null:d[l-1];if(u.type===2){if(I&&I.type!==1){n=d[q];n.next=d[q+1];n.next.prev=n;n.addGrip()}q=l}else if(n&&n.type===1){u.next=d[q+1];u.next.prev=u;u.mate=d[q];u.addGrip();if(this.first_seg==null)this.first_seg=u}else if(n){if(u.type!== -1){u.addGrip();if(n&&n.type!==2){u.next=n;u.next.prev=u}}}else if(u.type!==1){n=d[q];n.next=d[q+1];n.next.prev=n;n.addGrip();u.addGrip();if(!this.first_seg)this.first_seg=d[q]}}return this};svgedit.path.Path.prototype.eachSeg=function(d){for(var e=this.segs.length,l=0;l=e?null:d[m+1],I=m-1<0?null:d[m-1];if(v.type===2){if(I&&I.type!==1){p=d[q];p.next=d[q+1];p.next.prev=p;p.addGrip()}q=m}else if(p&&p.type===1){v.next=d[q+1];v.next.prev=v;v.mate=d[q];v.addGrip();if(this.first_seg==null)this.first_seg=v}else if(p){if(v.type!== +1){v.addGrip();if(p&&p.type!==2){v.next=p;v.next.prev=v}}}else if(v.type!==1){p=d[q];p.next=d[q+1];p.next.prev=p;p.addGrip();v.addGrip();if(!this.first_seg)this.first_seg=d[q]}}return this};svgedit.path.Path.prototype.eachSeg=function(d){for(var e=this.segs.length,m=0;m').documentElement, -true);a.appendChild(e);var l=d.createElementNS(c,"svg");(b.clearSvgContentElement=function(){for(;l.firstChild;)l.removeChild(l.firstChild);$(l).attr({id:"svgcontent",width:p[0],height:p[1],x:p[0],y:p[1],overflow:m.show_outside_canvas?"visible":"hidden",xmlns:c,"xmlns:se":"http://svg-edit.googlecode.com","xmlns:xlink":"http://www.w3.org/1999/xlink"}).appendTo(e);var g=d.createComment(" Created with Method Draw - http://github.com/duopixel/Method-Draw/ ");l.appendChild(g)})();var q="svg_";b.setIdPrefix= -function(g){q=g};b.current_drawing_=new svgedit.draw.Drawing(l,q);var u=b.getCurrentDrawing=function(){return b.current_drawing_},n=1,I=null,S={shape:{fill:(m.initFill.color=="none"?"":"#")+m.initFill.color,fill_paint:null,fill_opacity:m.initFill.opacity,stroke:"#"+m.initStroke.color,stroke_paint:null,stroke_opacity:m.initStroke.opacity,stroke_width:m.initStroke.width,stroke_dasharray:"none",stroke_linejoin:"miter",stroke_linecap:"butt",opacity:m.initOpacity}};S.text=$.extend(true,{},S.shape);$.extend(S.text, -{fill:"#000000",stroke_width:0,font_size:24,font_family:"Junction"});var O=S.shape,H=Array(1),ea=this.addSvgElementFromJson=function(g){var h=svgedit.utilities.getElem(g.attr.id),k=u().getCurrentLayer();if(h&&g.element!=h.tagName){k.removeChild(h);h=null}if(!h){h=d.createElementNS(c,g.element);if(k)(I||k).appendChild(h)}g.curStyles&&svgedit.utilities.assignAttributes(h,{fill:O.fill,stroke:O.stroke,"stroke-width":O.stroke_width,"stroke-dasharray":O.stroke_dasharray,"stroke-linejoin":O.stroke_linejoin, -"stroke-linecap":O.stroke_linecap,"stroke-opacity":O.stroke_opacity,"fill-opacity":O.fill_opacity,opacity:O.opacity/2,style:"pointer-events:inherit"},100);svgedit.utilities.assignAttributes(h,g.attr,100);svgedit.utilities.cleanupElement(h);return h},X=b.getTransformList=svgedit.transformlist.getTransformList,Q=svgedit.math.transformPoint,R=b.matrixMultiply=svgedit.math.matrixMultiply,ha=b.hasMatrixTransform=svgedit.math.hasMatrixTransform,W=b.transformListToTransform=svgedit.math.transformListToTransform, -Z=svgedit.math.snapToAngle,ba=svgedit.math.getMatrix;svgedit.units.init({getBaseUnit:function(){return m.baseUnit},getElement:svgedit.utilities.getElem,getHeight:function(){return l.getAttribute("height")/n},getWidth:function(){return l.getAttribute("width")/n},getRoundDigits:function(){return bb.round_digits}});var ka=b.convertToNum=svgedit.units.convertToNum;svgedit.utilities.init({getDOMDocument:function(){return d},getDOMContainer:function(){return a},getSVGRoot:function(){return e},getSelectedElements:function(){return H}, -getSVGContent:function(){return l}});var la=b.getUrlFromAttr=svgedit.utilities.getUrlFromAttr,da=b.getHref=svgedit.utilities.getHref,Y=b.setHref=svgedit.utilities.setHref,V=svgedit.utilities.getPathBBox;b.getBBox=svgedit.utilities.getBBox;var ma=b.getRotationAngle=svgedit.utilities.getRotationAngle,ua=b.getElem=svgedit.utilities.getElem,ga=b.assignAttributes=svgedit.utilities.assignAttributes,qa=this.cleanupElement=svgedit.utilities.cleanupElement,Ga=svgedit.sanitize.getNSMap(),Ma=b.sanitizeSvg=svgedit.sanitize.sanitizeSvg, +$.SvgCanvas=function(a,o){function f(g,h){for(var k=svgedit.utilities.getBBox(g),w=0;w<2;w++){var u=w===0?"fill":"stroke",G=g.getAttribute(u);if(G&&G.indexOf("url(")===0){G=ga(G);if(G.tagName==="linearGradient"){var z=G.getAttribute("x1")||0,A=G.getAttribute("y1")||0,C=G.getAttribute("x2")||1,F=G.getAttribute("y2")||0;z=k.width*z+k.x;A=k.height*A+k.y;C=k.width*C+k.x;F=k.height*F+k.y;z=P(z,A,h);F=P(C,F,h);C={};C.x1=(z.x-k.x)/k.width;C.y1=(z.y-k.y)/k.height;C.x2=(F.x-k.x)/k.width;C.y2=(F.y-k.y)/k.height; +G=G.cloneNode(true);$(G).attr(C);G.id=Q();Bb().appendChild(G);g.setAttribute(u,"url(#"+G.id+")")}}}}var c="http://www.w3.org/2000/svg",l={show_outside_canvas:true,selectNew:true,dimensions:[640,480]};o&&$.extend(l,o);var n=l.dimensions,b=this,d=a.ownerDocument,e=d.importNode(svgedit.utilities.text2xml('').documentElement, +true);a.appendChild(e);var m=d.createElementNS(c,"svg");(b.clearSvgContentElement=function(){for(;m.firstChild;)m.removeChild(m.firstChild);$(m).attr({id:"svgcontent",width:n[0],height:n[1],x:n[0],y:n[1],overflow:l.show_outside_canvas?"visible":"hidden",xmlns:c,"xmlns:se":"http://svg-edit.googlecode.com","xmlns:xlink":"http://www.w3.org/1999/xlink"}).appendTo(e);var g=d.createComment(" Created with Method Draw - http://github.com/duopixel/Method-Draw/ ");m.appendChild(g)})();var q="svg_";b.setIdPrefix= +function(g){q=g};b.current_drawing_=new svgedit.draw.Drawing(m,q);var v=b.getCurrentDrawing=function(){return b.current_drawing_},p=1,I=null,V={shape:{fill:(l.initFill.color=="none"?"":"#")+l.initFill.color,fill_paint:null,fill_opacity:l.initFill.opacity,stroke:"#"+l.initStroke.color,stroke_paint:null,stroke_opacity:l.initStroke.opacity,stroke_width:l.initStroke.width,stroke_dasharray:"none",stroke_linejoin:"miter",stroke_linecap:"butt",opacity:l.initOpacity}};V.text=$.extend(true,{},V.shape);$.extend(V.text, +{fill:"#000000",stroke_width:0,font_size:24,font_family:"Junction"});var M=V.shape,H=Array(1),aa=this.addSvgElementFromJson=function(g){var h=svgedit.utilities.getElem(g.attr.id),k=v().getCurrentLayer();if(h&&g.element!=h.tagName){k.removeChild(h);h=null}if(!h){h=d.createElementNS(c,g.element);if(k)(I||k).appendChild(h)}g.curStyles&&svgedit.utilities.assignAttributes(h,{fill:M.fill,stroke:M.stroke,"stroke-width":M.stroke_width,"stroke-dasharray":M.stroke_dasharray,"stroke-linejoin":M.stroke_linejoin, +"stroke-linecap":M.stroke_linecap,"stroke-opacity":M.stroke_opacity,"fill-opacity":M.fill_opacity,opacity:M.opacity/2,style:"pointer-events:inherit"},100);svgedit.utilities.assignAttributes(h,g.attr,100);svgedit.utilities.cleanupElement(h);return h},T=b.getTransformList=svgedit.transformlist.getTransformList,P=svgedit.math.transformPoint,R=b.matrixMultiply=svgedit.math.matrixMultiply,ea=b.hasMatrixTransform=svgedit.math.hasMatrixTransform,S=b.transformListToTransform=svgedit.math.transformListToTransform, +X=svgedit.math.snapToAngle,ba=svgedit.math.getMatrix;svgedit.units.init({getBaseUnit:function(){return l.baseUnit},getElement:svgedit.utilities.getElem,getHeight:function(){return m.getAttribute("height")/p},getWidth:function(){return m.getAttribute("width")/p},getRoundDigits:function(){return bb.round_digits}});var la=b.convertToNum=svgedit.units.convertToNum;svgedit.utilities.init({getDOMDocument:function(){return d},getDOMContainer:function(){return a},getSVGRoot:function(){return e},getSelectedElements:function(){return H}, +getSVGContent:function(){return m}});var ka=b.getUrlFromAttr=svgedit.utilities.getUrlFromAttr,da=b.getHref=svgedit.utilities.getHref,Z=b.setHref=svgedit.utilities.setHref,Y=svgedit.utilities.getPathBBox;b.getBBox=svgedit.utilities.getBBox;var ma=b.getRotationAngle=svgedit.utilities.getRotationAngle,ua=b.getElem=svgedit.utilities.getElem,ha=b.assignAttributes=svgedit.utilities.assignAttributes,qa=this.cleanupElement=svgedit.utilities.cleanupElement,Ga=svgedit.sanitize.getNSMap(),Ma=b.sanitizeSvg=svgedit.sanitize.sanitizeSvg, Ra=svgedit.history.MoveElementCommand,Qa=svgedit.history.InsertElementCommand,Va=svgedit.history.RemoveElementCommand,Xa=svgedit.history.ChangeElementCommand,Na=svgedit.history.BatchCommand;b.undoMgr=new svgedit.history.UndoManager({handleHistoryEvent:function(g,h){var k=svgedit.history.HistoryEventTypes;if(g==k.BEFORE_UNAPPLY||g==k.BEFORE_APPLY)b.clearSelection();else if(g==k.AFTER_APPLY||g==k.AFTER_UNAPPLY){var w=h.elements();b.pathActions.clear();J("changed",w);w=h.type();k=g==k.AFTER_APPLY;if(w== -Ra.type()){k=k?h.newParent:h.oldParent;k==l&&b.identifyLayers()}else if(w==Qa.type()||w==Va.type()){h.parent==l&&b.identifyLayers();if(w==Qa.type())k&&$a(h.elem);else k||$a(h.elem);h.elem.tagName==="use"&&gc(h.elem)}else if(w==Xa.type()){h.elem.tagName=="title"&&h.elem.parentNode.parentNode==l&&b.identifyLayers();k=k?h.newValues:h.oldValues;k.stdDeviation&&b.setBlurOffsets(h.elem.parentNode,k.stdDeviation);if(h.elem.tagName==="use"&&svgedit.browser.isWebkit()){w=h.elem;if(!w.getAttribute("x")&&!w.getAttribute("y")){k= -w.parentNode;var v=w.nextSibling;k.removeChild(w);k.insertBefore(w,v)}}}}}});var Ha=function(g){b.undoMgr.addCommandToHistory(g)};svgedit.select.init(m,{createSVGElement:function(g){return b.addSvgElementFromJson(g)},svgRoot:function(){return e},svgContent:function(){return l},currentZoom:function(){return n},getStrokedBBox:function(g){return b.getStrokedBBox([g])}});var Pa=this.selectorManager=svgedit.select.getSelectorManager(),zb=this.hoverManager=svgedit.select.getSelectorManager();svgedit.path.init({getCurrentZoom:function(){return n}, -getSVGRoot:function(){return e}});svgedit.utilities.snapToGrid=function(g){var h=m.snappingStep,k=m.baseUnit;if(k!=="px")h*=svgedit.units.getTypeMap()[k];return g=Math.round(g/h)*h};var Ja=svgedit.utilities.snapToGrid,Jb={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"},tb=["clip-path","fill","filter","marker-end","marker-mid","marker-start", -"mask","stroke"],ab=$.data,$a=function(g){var h=$(g).attr(tb),k;for(k in h){var w=h[k];if(w&&w.indexOf("url(")===0){w=la(w).substr(1);if(!ua(w)){Bb().appendChild(Fb[w]);delete Fb[w]}}}g=g.getElementsByTagName("*");if(g.length){h=0;for(k=g.length;h=0)E=D=b.convertToPath(F,true);else if(F.tagName=="rect"){var M=F.getAttribute("rx"),K=F.getAttribute("ry");if(M||K)E=D=b.convertToPath(F,true)}if(!D){var N=F.cloneNode(true),aa=document.createElementNS(c,"g"),T=F.parentNode;T.appendChild(aa);aa.appendChild(N);E=svgedit.utilities.bboxToObj(aa.getBBox());T.removeChild(aa)}}return E}catch(ta){console.log(F, -ta);return null}},k;$.each(g,function(){if(!k)if(this.parentNode)k=h(this)});if(k==null)return null;var w=k.x+k.width,v=k.y+k.height,G=k.x,z=k.y,A=function(F){var E=F.getAttribute("stroke-width"),D=0;if(F.getAttribute("stroke")!="none"&&!isNaN(E))D+=E/2;return D},C=[];$.each(g,function(F,E){var D=h(E);if(D){var M=A(E);G=Math.min(G,D.x-M);z=Math.min(z,D.y-M);C.push(D)}});k.x=G;k.y=z;$.each(g,function(F,E){var D=C[F];if(D&&E.nodeType==1){var M=A(E);w=Math.max(w,D.x+D.width+M);v=Math.max(v,D.y+D.height+ -M)}});k.width=w-G;k.height=v-z;return k};var Kb=this.getVisibleElements=function(g){g||(g=$(l).children());var h=[];$(g).children().each(function(k,w){try{w.getBBox()&&h.push(w)}catch(v){}});return h.reverse()},Ub=this.getVisibleElementsAndBBoxes=function(g){g||(g=$(l).children());var h=[];$(g).children().each(function(k,w){try{w.getBBox()&&h.push({elem:w,bbox:getStrokedBBox([w])})}catch(v){}});return h.reverse()},ra=this.groupSvgElem=function(g){var h=document.createElementNS(c,"g");g.parentNode.replaceChild(h, -g);$(h).append(g).data("gsvg",g)[0].id=P()},ia=function(g){var h=document.createElementNS(g.namespaceURI,g.nodeName);h.removeAttribute("id");$.each(g.attributes,function(w,v){v.localName!="-moz-math-font-style"&&h.setAttributeNS(v.namespaceURI,v.nodeName,v.nodeValue)});if(svgedit.browser.isWebkit()&&g.nodeName=="path"){var k=Ua.convertPath(g);h.setAttribute("d",k)}$.each(g.childNodes,function(w,v){switch(v.nodeType){case 1:h.appendChild(ia(v));break;case 3:h.textContent=v.nodeValue}});if($(g).data("gsvg"))$(h).data("gsvg", -h.firstChild);else if($(g).data("symbol")){g=$(g).data("symbol");$(h).data("ref",g).data("symbol",g)}else h.tagName=="image"&&Lb(h);h.id=P();return h},va,P,J;(function(g){var h={};va=g.getId=function(){return u().getId()};P=g.getNextId=function(){return u().getNextId()};J=g.call=function(k,w){if(h[k])return h[k](this,w)};g.bind=function(k,w){var v=h[k];h[k]=w;return v}})(b);this.prepareSvg=function(g){this.sanitizeSvg(g.documentElement);g=g.getElementsByTagNameNS(c,"path");for(var h=0,k=g.length;h< -k;++h){var w=g[h];w.setAttribute("d",Ua.convertPath(w));Ua.fixEnd(w)}};var fa=this.getRefElem=function(g){return ua(la(g).substr(1))},Oa=function(g){if(!svgedit.browser.isGecko())return g;var h=g.cloneNode(true);g.parentNode.insertBefore(h,g);g.parentNode.removeChild(g);Pa.releaseSelector(g);H[0]=h;Pa.requestSelector(h).showGrips(true);return h};this.setRotationAngle=function(g,h){g=parseFloat(g);var k=H[0],w=k.getAttribute("transform"),v=svgedit.utilities.getBBox(k),G=v.x+v.width/2,z=v.y+v.height/ -2;v=X(k);v.numberOfItems>0&&v.getItem(0).type==4&&v.removeItem(0);if(g!=0){G=Q(G,z,W(v).matrix);z=e.createSVGTransform();z.setRotate(g,G.x,G.y);v.numberOfItems?v.insertItemBefore(z,0):v.appendItem(z)}else v.numberOfItems==0&&k.removeAttribute("transform");if(!h){v=k.getAttribute("transform");k.setAttribute("transform",w);ub("transform",v,H);J("changed",H)}ua("pathpointgrip_container");k=Pa.requestSelector(H[0]);k.resize();k.updateGripCursors(g)};var Za=this.recalculateAllSelectedDimensions=function(){for(var g= -new Na(rb=="none"?"position":"size"),h=H.length;h--;){var k=pb(H[h]);k&&g.addSubCommand(k)}if(!g.isEmpty()){Ha(g);J("changed",H)}},fb=[0,"z","M","m","L","l","C","c","Q","q","A","a","H","h","V","v","S","s","T","t"],wb=function(g){console.log([g.a,g.b,g.c,g.d,g.e,g.f])},xb=this.remapElement=function(g,h,k){var w=m.gridSnapping&&g.parentNode.parentNode.localName==="svg",v=function(){if(w)for(var D in h)h[D]=Ja(h[D]);ga(g,h,1E3,true)};box=svgedit.utilities.getBBox(g);for(var G=0;G<2;G++){var z=G===0? -"fill":"stroke",A=g.getAttribute(z);if(A&&A.indexOf("url(")===0)if(k.a<0||k.d<0){A=fa(A).cloneNode(true);if(k.a<0){var C=A.getAttribute("x1"),F=A.getAttribute("x2");A.setAttribute("x1",-(C-1));A.setAttribute("x2",-(F-1))}if(k.d<0){C=A.getAttribute("y1");F=A.getAttribute("y2");A.setAttribute("y1",-(C-1));A.setAttribute("y2",-(F-1))}A.id=P();Bb().appendChild(A);g.setAttribute(z,"url(#"+A.id+")")}}G=g.tagName;if(G==="g"||G==="text"||G==="use")if(k.a==1&&k.b==0&&k.c==0&&k.d==1&&(k.e!=0||k.f!=0)){z=W(g).matrix; -z=R(z.inverse(),k,z);h.x=parseFloat(h.x)+z.e;h.y=parseFloat(h.y)+z.f}else{z=X(g);A=e.createSVGTransform();A.setMatrix(R(W(z).matrix,k));z.clear();z.appendItem(A)}switch(G){case "foreignObject":case "rect":case "image":if(G==="image"&&(k.a<0||k.d<0)){z=X(g);A=e.createSVGTransform();A.setMatrix(R(W(z).matrix,k));z.clear();z.appendItem(A)}else{z=Q(h.x,h.y,k);h.width=k.a*h.width;h.height=k.d*h.height;h.x=z.x+Math.min(0,h.width);h.y=z.y+Math.min(0,h.height);h.width=Math.abs(h.width);h.height=Math.abs(h.height)}v(); -break;case "ellipse":G=Q(h.cx,h.cy,k);h.cx=G.x;h.cy=G.y;h.rx=k.a*h.rx;h.ry=k.d*h.ry;h.rx=Math.abs(h.rx);h.ry=Math.abs(h.ry);v();break;case "circle":G=Q(h.cx,h.cy,k);h.cx=G.x;h.cy=G.y;G=svgedit.math.transformBox(box.x,box.y,box.width,box.height,k);h.r=Math.min((G.tr.x-G.tl.x)/2,(G.bl.y-G.tl.y)/2);if(h.r)h.r=Math.abs(h.r);v();break;case "line":z=Q(h.x1,h.y1,k);C=Q(h.x2,h.y2,k);h.x1=z.x;h.y1=z.y;h.x2=C.x;h.y2=C.y;case "text":k=g.querySelectorAll("tspan");for(G=k.length;G--;){z=ka("x",g.getAttribute("x")); -A=ka("x",k[G].getAttribute("x"));C=ka("y",g.getAttribute("y"));F=ka("y",k[G].getAttribute("y"));var E={};if(!isNaN(z)&&!isNaN(A)&&z!=0&&A!=0&&h.x)E.x=h.x-(z-A);if(!isNaN(C)&&!isNaN(F)&&C!=0&&F!=0&&h.y)E.y=h.y-(C-F);if(E.x||E.y)ga(k[G],E,1E3,true)}v();break;case "use":v();break;case "g":(v=$(g).data("gsvg"))&&ga(v,h,1E3,true);break;case "polyline":case "polygon":v=h.points.length;for(G=0;G0){for(var k=h.numberOfItems;k--;){var w=h.getItem(k);if(w.type===0)h.removeItem(k);else if(w.type=== -1)svgedit.math.isIdentity(w.matrix)&&h.removeItem(k);else w.type===4&&w.angle===0&&h.removeItem(k)}if(h.numberOfItems===1&&ma(g))return null}if(!h||h.numberOfItems==0){g.removeAttribute("transform");return null}if(h){k=h.numberOfItems;for(var v=[];k--;){w=h.getItem(k);if(w.type===1)v.push([w.matrix,k]);else if(v.length)v=[]}if(v.length===2){k=e.createSVGTransformFromMatrix(R(v[1][0],v[0][0]));h.removeItem(v[0][1]);h.removeItem(v[1][1]);h.insertItemBefore(k,v[1][1])}k=h.numberOfItems;if(k>=2&&h.getItem(k- -2).type===1&&h.getItem(k-1).type===2){v=e.createSVGTransform();w=R(h.getItem(k-2).matrix,h.getItem(k-1).matrix);v.setMatrix(w);h.removeItem(k-2);h.removeItem(k-2);h.appendItem(v)}}switch(g.tagName){case "line":case "polyline":case "polygon":case "path":break;default:if(h.numberOfItems===1&&h.getItem(0).type===1||h.numberOfItems===2&&h.getItem(0).type===1&&h.getItem(0).type===4)return null}var G=$(g).data("gsvg");k=new Na("Transform");var z={},A=null;w=[];switch(g.tagName){case "line":w=["x1","y1", -"x2","y2"];break;case "circle":w=["cx","cy","r"];break;case "ellipse":w=["cx","cy","rx","ry"];break;case "foreignObject":case "rect":case "image":w=["width","height","x","y"];break;case "use":case "text":case "tspan":w=["x","y"];break;case "polygon":case "polyline":A={};A.points=g.getAttribute("points");v=g.points;var C=v.numberOfItems;z.points=Array(C);for(var F=0;F1.0E-10?Math.sin(F)/(1-Math.cos(F)):2/F;for(F=0;F=3&&h.getItem(K-2).type==3&&h.getItem(K-3).type==2&&h.getItem(K-1).type==2){F=3;var aa=h.getItem(K-3).matrix,T=h.getItem(K-2).matrix,ta=h.getItem(K-1).matrix;C=g.childNodes;for(E=C.length;E--;){var xa=C.item(E);w=G=0;if(xa.nodeType==1){var ja=X(xa);if(ja){w=W(ja).matrix;G=ma(xa);var oa=gb,sa=[];gb=xa.getAttribute("transform");if(G||ha(ja)){var za= -e.createSVGTransform();za.setMatrix(R(aa,T,ta,w));ja.clear();ja.appendItem(za);sa.push(za)}else{G=R(w.inverse(),ta,w);za=e.createSVGMatrix();za.e=-G.e;za.f=-G.f;w=R(za.inverse(),w.inverse(),aa,T,ta,w,G.inverse());var kb=e.createSVGTransform(),ob=e.createSVGTransform(),Vb=e.createSVGTransform();kb.setTranslate(G.e,G.f);ob.setScale(w.a,w.d);Vb.setTranslate(za.e,za.f);ja.appendItem(Vb);ja.appendItem(ob);ja.appendItem(kb);sa.push(Vb);sa.push(ob);sa.push(kb)}k.addSubCommand(pb(xa));gb=oa}}}h.removeItem(K- -1);h.removeItem(K-2);h.removeItem(K-3)}else if(K>=3&&h.getItem(K-1).type==1){F=3;w=W(h).matrix;za=e.createSVGTransform();za.setMatrix(w);h.clear();h.appendItem(za)}else if((K==1||K>1&&h.getItem(1).type!=3)&&h.getItem(0).type==2){F=2;G=W(h).matrix;h.removeItem(0);w=W(h).matrix.inverse();w=R(w,G);G=w.e;w=w.f;if(G!=0||w!=0){C=g.childNodes;E=C.length;for(K=[];E--;){xa=C.item(E);if(xa.nodeType==1){if(xa.getAttribute("clip-path")){oa=xa.getAttribute("clip-path");if(K.indexOf(oa)===-1){Db(oa,G,w);K.push(oa)}}oa= -gb;gb=xa.getAttribute("transform");if(ja=X(xa)){aa=e.createSVGTransform();aa.setTranslate(G,w);ja.numberOfItems?ja.insertItemBefore(aa,0):ja.appendItem(aa);k.addSubCommand(pb(xa));ja=g.getElementsByTagNameNS(c,"use");xa="#"+xa.id;for(aa=ja.length;aa--;){T=ja.item(aa);if(xa==da(T)){ta=e.createSVGTransform();ta.setTranslate(-G,-w);X(T).insertItemBefore(ta,0);k.addSubCommand(pb(T))}}gb=oa}}}K=[];gb=oa}}else if(K==1&&h.getItem(0).type==1&&!v){F=1;w=h.getItem(0).matrix;C=g.childNodes;for(E=C.length;E--;){xa= -C.item(E);if(xa.nodeType==1){oa=gb;gb=xa.getAttribute("transform");if(ja=X(xa)){G=R(w,W(ja).matrix);K=e.createSVGTransform();K.setMatrix(G);ja.clear();ja.appendItem(K,0);k.addSubCommand(pb(xa));gb=oa;oa=xa.getAttribute("stroke-width");xa.getAttribute("stroke")!=="none"&&!isNaN(oa)&&xa.setAttribute("stroke-width",oa*((Math.abs(G.a)+Math.abs(G.d))/2))}}}h.clear()}else{if(v){D=e.createSVGTransform();D.setRotate(v,M.x,M.y);h.numberOfItems?h.insertItemBefore(D,0):h.appendItem(D)}h.numberOfItems==0&&g.removeAttribute("transform"); -return null}if(F==2){if(v){M={x:D.x+N.e,y:D.y+N.f};D=e.createSVGTransform();D.setRotate(v,M.x,M.y);h.numberOfItems?h.insertItemBefore(D,0):h.appendItem(D)}}else if(F==3){w=W(h).matrix;N=e.createSVGTransform();N.setRotate(v,D.x,D.y);N=N.matrix;D=e.createSVGTransform();D.setRotate(v,M.x,M.y);M=D.matrix.inverse();oa=w.inverse();M=R(oa,M,N,w);G=M.e;w=M.f;if(G!=0||w!=0){C=g.childNodes;for(E=C.length;E--;){xa=C.item(E);if(xa.nodeType==1){oa=gb;gb=xa.getAttribute("transform");ja=X(xa);aa=e.createSVGTransform(); -aa.setTranslate(G,w);ja.numberOfItems?ja.insertItemBefore(aa,0):ja.appendItem(aa);k.addSubCommand(pb(xa));gb=oa}}}if(v)h.numberOfItems?h.insertItemBefore(D,0):h.appendItem(D)}}else{v=svgedit.utilities.getBBox(g);if(!v&&g.tagName!="path")return null;w=e.createSVGMatrix();if(G=ma(g)){D={x:v.x+v.width/2,y:v.y+v.height/2};M=Q(v.x+v.width/2,v.y+v.height/2,W(h).matrix);F=G*Math.PI/180;C=Math.abs(F)>1.0E-10?Math.sin(F)/(1-Math.cos(F)):2/F;for(F=0;F=3&&h.getItem(K-2).type==3&&h.getItem(K-3).type==2&&h.getItem(K-1).type==2){F=3;w=W(h,K-3,K-1).matrix; -h.removeItem(K-1);h.removeItem(K-2);h.removeItem(K-3)}else if(K==4&&h.getItem(K-1).type==1){F=3;w=W(h).matrix;za=e.createSVGTransform();za.setMatrix(w);h.clear();h.appendItem(za);w=e.createSVGMatrix()}else if((K==1||K>1&&h.getItem(1).type!=3)&&h.getItem(0).type==2){F=2;N=h.getItem(0).matrix;oa=W(h,1).matrix;v=oa.inverse();w=R(v,N,oa);h.removeItem(0)}else if(K==1&&h.getItem(0).type==1&&!G){w=W(h).matrix;switch(g.tagName){case "line":z=$(g).attr(["x1","y1","x2","y2"]);case "polyline":case "polygon":z.points= -g.getAttribute("points");if(z.points){v=g.points;C=v.numberOfItems;z.points=Array(C);for(F=0;F1&&v.showGrips(false)}}}J("selected",H);h||H.length==1?Pa.requestSelector(H[0]).showGrips(true):Pa.requestSelector(H[0]).showGrips(false); -for(H.sort(function(G,z){if(G&&z&&G.compareDocumentPosition)return 3-(z.compareDocumentPosition(G)&6);else if(G==null)return 1});H[0]==null;)H.shift(0)}},Sb=this.selectOnly=function(g,h){cb(true);Nb(g,h)};this.removeFromSelection=function(g){if(H[0]!=null)if(g.length!=0){var h=Array(H.length);j=0;len=H.length;for(var k=0;k=0&&g.id!="svgcanvas")for(;g.nodeName!="foreignObject";){g=g.parentNode;if(!g)return e}var h=u().getCurrentLayer();if([e,a,l,h].indexOf(g)>=0)return e;if($(g).closest("#selectorParentGroup").length)return Pa.selectorParentGroup;for(;g.parentNode!==(I|| -h);)g=g.parentNode;return g};(function(){var g=null,h=null,k=null,w=null,v=null,G={},z={minx:null,miny:null,maxx:null,maxy:null},A=mosueOver=function(C){if(!(b.spaceKey||C.button===1)){var F=C.button===2;C.altKey&&svgCanvas.cloneSelectedElements(0,0);Pb=l.getScreenCTM().inverse();var E=Q(C.pageX,C.pageY,Pb),D=E.x*n;E=E.y*n;C.preventDefault();if(F)Ia="select";D=D/n;E=E/n;var M=ac(C);if(M.tagName==="a"&&M.childNodes.length===1)M=M.firstChild;var K=w=h=D,N=v=k=E;if(m.gridSnapping){D=Ja(D);E=Ja(E);h= -Ja(h);k=Ja(k)}if(M==Pa.selectorParentGroup&&H[0]!=null){M=C.target;var aa=ab(M,"type");if(aa=="rotate"){Ia="rotate";current_rotate_mode=ab(M,"dir")}else if(aa=="resize"){Ia="resize";rb=ab(M,"dir")}M=H[0]}gb=M.getAttribute("transform");aa=X(M);switch(Ia){case "select":Sa=true;rb="none";if(F)Sa=false;if(M!=e){if(H.indexOf(M)==-1){C.shiftKey||cb(true);Nb([M]);La=M;Ua.clear()}if(!F)for(F=0;F0&&b.removeFromSelection(M);K.length>0&&Nb(K);break;case "resize":M=X(F);K=(T=ha(M))?G:svgedit.utilities.getBBox(F);N=K.x;ta=K.y;var xa=K.width,ja=K.height;K=x-h;aa=y-k;if(m.gridSnapping){K=Ja(K);aa=Ja(aa);ja=Ja(ja);xa=Ja(xa)}var oa=ma(F);if(oa){var sa= -Math.sqrt(K*K+aa*aa);aa=Math.atan2(aa,K)-oa*Math.PI/180;K=sa*Math.cos(aa);aa=sa*Math.sin(aa)}if(rb.indexOf("n")==-1&&rb.indexOf("s")==-1)aa=0;if(rb.indexOf("e")==-1&&rb.indexOf("w")==-1)K=0;var za=sa=0,kb=ja?(ja+aa)/ja:1,ob=xa?(xa+K)/xa:1;if(rb.indexOf("n")>=0){kb=ja?(ja-aa)/ja:1;za=ja}if(rb.indexOf("w")>=0){ob=xa?(xa-K)/xa:1;sa=xa}K=e.createSVGTransform();aa=e.createSVGTransform();xa=e.createSVGTransform();if(m.gridSnapping){N=Ja(N);sa=Ja(sa);ta=Ja(ta);za=Ja(za)}K.setTranslate(-(N+sa),-(ta+za)); -if(C.shiftKey)if(ob==1)ob=kb;else kb=ob;aa.setScale(ob,kb);xa.setTranslate(N+sa,ta+za);if(T){T=oa?1:0;M.replaceItem(K,2+T);M.replaceItem(aa,1+T);M.replaceItem(xa,0+T)}else{T=M.numberOfItems;M.replaceItem(xa,T-3);M.replaceItem(aa,T-2);M.replaceItem(K,T-1)}Pa.requestSelector(F).resize();J("transition",H);break;case "zoom":K*=n;N*=n;ga(Wa,{x:Math.min(w*n,K),y:Math.min(v*n,N),width:Math.abs(K-w*n),height:Math.abs(N-v*n)},100);break;case "text":ga(M,{x:x,y:y},1E3);break;case "line":K=null;window.opera|| -e.suspendRedraw(1E3);if(m.gridSnapping){x=Ja(x);y=Ja(y)}N=x;T=y;if(C.shiftKey){T=Z(h,k,N,T);N=T.x;T=T.y}M.setAttributeNS(null,"x2",N);M.setAttributeNS(null,"y2",T);window.opera||e.unsuspendRedraw(K);break;case "foreignObject":case "square":case "rect":case "image":K=Math.abs(x-h);T=Math.abs(y-k);if(Ia=="square"||C.shiftKey){K=T=Math.max(K,T);N=hk?k+ta:k-ta}if(C.altKey){T=h;N=k;ta=Math.abs(x-T);aa=C.shiftKey?ta:Math.abs(y- -N)}M.setAttributeNS(null,"rx",ta);M.setAttributeNS(null,"ry",aa);M.setAttributeNS(null,"cx",T);M.setAttributeNS(null,"cy",N);window.opera||e.unsuspendRedraw(K);break;case "fhellipse":case "fhrect":z.minx=Math.min(K,z.minx);z.maxx=Math.max(K,z.maxx);z.miny=Math.min(N,z.miny);z.maxy=Math.max(N,z.maxy);case "fhpath":g+=+K+","+N+" ";M.setAttributeNS(null,"points",g);break;case "path":case "pathedit":x*=n;y*=n;if(m.gridSnapping){x=Ja(x);y=Ja(y);h=Ja(h);k=Ja(k)}if(C.shiftKey){if(T=svgedit.path.path){M= -T.dragging?T.dragging[0]:h;T=T.dragging?T.dragging[1]:k}else{M=h;T=k}T=Z(M,T,x,y);x=T.x;y=T.y}if(Wa&&Wa.getAttribute("display")!=="none"){K*=n;N*=n;ga(Wa,{x:Math.min(w*n,K),y:Math.min(v*n,N),width:Math.abs(K-w*n),height:Math.abs(N-v*n)},100)}Ua.mouseMove(C,x,y);break;case "textedit":x*=n;y*=n;qb.mouseMove(D,E);break;case "rotate":K=svgedit.utilities.getBBox(F);T=K.x+K.width/2;N=K.y+K.height/2;M=ba(F);M=Q(T,N,M);T=M.x;N=M.y;M=K.x;ta=K.y;if(current_rotate_mode=="nw")M=K.x+K.width;if(current_rotate_mode== -"se")ta=K.y+K.height;if(current_rotate_mode=="sw"){M=K.x+K.width;ta=K.y+K.height}compensation_angle=(Math.atan2(N-ta,T-M)*(180/Math.PI)-90)%360;oa=(Math.atan2(N-y,T-x)*(180/Math.PI)-90)%360;oa+=compensation_angle;if(m.gridSnapping)oa=Ja(oa);if(C.shiftKey)oa=Math.round(oa/45)*45;b.setRotationAngle(oa<-180?360+oa:oa,true);J("transition",H)}nb("mouseMove",{event:C,mouse_x:D,mouse_y:E,selected:F})}}).click(function(C){C.preventDefault();return false}).dblclick(function(C){var F=C.target.parentNode;if(F!== -I){var E=ac(C),D=E.tagName;if(D==="text"&&Ia!=="textedit"){C=Q(C.pageX,C.pageY,Pb);qb.select(E,C.x,C.y)}if((D==="g"||D==="a")&&ma(E)){bc(E);E=H[0];cb(true)}I&&cc();F.tagName!=="g"&&F.tagName!=="a"||F===u().getCurrentLayer()||E===Pa.selectorParentGroup||oc(E)}}).mouseup(function(C){if(C.button!==2){var F=La;La=null;if(Sa){var E=Q(C.pageX,C.pageY,Pb),D=E.x*n;E=E.y*n;var M=D/n,K=E/n,N=ua(va()),aa=false;Sa=false;switch(Ia){case "resize":case "multiselect":if(Wa!=null){Wa.setAttribute("display","none"); +Ra.type()){k=k?h.newParent:h.oldParent;k==m&&b.identifyLayers()}else if(w==Qa.type()||w==Va.type()){h.parent==m&&b.identifyLayers();if(w==Qa.type())k&&$a(h.elem);else k||$a(h.elem);h.elem.tagName==="use"&&gc(h.elem)}else if(w==Xa.type()){h.elem.tagName=="title"&&h.elem.parentNode.parentNode==m&&b.identifyLayers();k=k?h.newValues:h.oldValues;k.stdDeviation&&b.setBlurOffsets(h.elem.parentNode,k.stdDeviation);if(h.elem.tagName==="use"&&svgedit.browser.isWebkit()){w=h.elem;if(!w.getAttribute("x")&&!w.getAttribute("y")){k= +w.parentNode;var u=w.nextSibling;k.removeChild(w);k.insertBefore(w,u)}}}}}});var Ha=function(g){b.undoMgr.addCommandToHistory(g)};svgedit.select.init(l,{createSVGElement:function(g){return b.addSvgElementFromJson(g)},svgRoot:function(){return e},svgContent:function(){return m},currentZoom:function(){return p},getStrokedBBox:function(g){return b.getStrokedBBox([g])}});var Pa=this.selectorManager=svgedit.select.getSelectorManager(),zb=this.hoverManager=svgedit.select.getSelectorManager();svgedit.path.init({getCurrentZoom:function(){return p}, +getSVGRoot:function(){return e}});svgedit.utilities.snapToGrid=function(g){var h=l.snappingStep,k=l.baseUnit;if(k!=="px")h*=svgedit.units.getTypeMap()[k];return g=Math.round(g/h)*h};var Ja=svgedit.utilities.snapToGrid,Jb={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"},tb=["clip-path","fill","filter","marker-end","marker-mid","marker-start", +"mask","stroke"],ab=$.data,$a=function(g){var h=$(g).attr(tb),k;for(k in h){var w=h[k];if(w&&w.indexOf("url(")===0){w=ka(w).substr(1);if(!ua(w)){Bb().appendChild(Fb[w]);delete Fb[w]}}}g=g.getElementsByTagName("*");if(g.length){h=0;for(k=g.length;h=0)E=D=b.convertToPath(F,true);else if(F.tagName=="rect"){var N=F.getAttribute("rx"),K=F.getAttribute("ry");if(N||K)E=D=b.convertToPath(F,true)}if(!D){var O=F.cloneNode(true),ca=document.createElementNS(c,"g"),U=F.parentNode;U.appendChild(ca);ca.appendChild(O);E=svgedit.utilities.bboxToObj(ca.getBBox());U.removeChild(ca)}}return E}catch(ta){console.log(F, +ta);return null}},k;$.each(g,function(){if(!k)if(this.parentNode)k=h(this)});if(k==null)return null;var w=k.x+k.width,u=k.y+k.height,G=k.x,z=k.y,A=function(F){var E=F.getAttribute("stroke-width"),D=0;if(F.getAttribute("stroke")!="none"&&!isNaN(E))D+=E/2;return D},C=[];$.each(g,function(F,E){var D=h(E);if(D){var N=A(E);G=Math.min(G,D.x-N);z=Math.min(z,D.y-N);C.push(D)}});k.x=G;k.y=z;$.each(g,function(F,E){var D=C[F];if(D&&E.nodeType==1){var N=A(E);w=Math.max(w,D.x+D.width+N);u=Math.max(u,D.y+D.height+ +N)}});k.width=w-G;k.height=u-z;return k};var Kb=this.getVisibleElements=function(g){g||(g=$(m).children());var h=[];$(g).children().each(function(k,w){try{w.getBBox()&&h.push(w)}catch(u){}});return h.reverse()},Ub=this.getVisibleElementsAndBBoxes=function(g){g||(g=$(m).children());var h=[];$(g).children().each(function(k,w){try{w.getBBox()&&h.push({elem:w,bbox:getStrokedBBox([w])})}catch(u){}});return h.reverse()},ra=this.groupSvgElem=function(g){var h=document.createElementNS(c,"g");g.parentNode.replaceChild(h, +g);$(h).append(g).data("gsvg",g)[0].id=Q()},ia=function(g){var h=document.createElementNS(g.namespaceURI,g.nodeName);h.removeAttribute("id");$.each(g.attributes,function(w,u){u.localName!="-moz-math-font-style"&&h.setAttributeNS(u.namespaceURI,u.nodeName,u.nodeValue)});if(svgedit.browser.isWebkit()&&g.nodeName=="path"){var k=Ua.convertPath(g);h.setAttribute("d",k)}$.each(g.childNodes,function(w,u){switch(u.nodeType){case 1:h.appendChild(ia(u));break;case 3:h.textContent=u.nodeValue}});if($(g).data("gsvg"))$(h).data("gsvg", +h.firstChild);else if($(g).data("symbol")){g=$(g).data("symbol");$(h).data("ref",g).data("symbol",g)}else h.tagName=="image"&&Lb(h);h.id=Q();return h},va,Q,J;(function(g){var h={};va=g.getId=function(){return v().getId()};Q=g.getNextId=function(){return v().getNextId()};J=g.call=function(k,w){if(h[k])return h[k](this,w)};g.bind=function(k,w){var u=h[k];h[k]=w;return u}})(b);this.prepareSvg=function(g){this.sanitizeSvg(g.documentElement);g=g.getElementsByTagNameNS(c,"path");for(var h=0,k=g.length;h< +k;++h){var w=g[h];w.setAttribute("d",Ua.convertPath(w));Ua.fixEnd(w)}};var ga=this.getRefElem=function(g){return ua(ka(g).substr(1))},Oa=function(g){if(!svgedit.browser.isGecko())return g;var h=g.cloneNode(true);g.parentNode.insertBefore(h,g);g.parentNode.removeChild(g);Pa.releaseSelector(g);H[0]=h;Pa.requestSelector(h).showGrips(true);return h};this.setRotationAngle=function(g,h){g=parseFloat(g);var k=H[0],w=k.getAttribute("transform"),u=svgedit.utilities.getBBox(k),G=u.x+u.width/2,z=u.y+u.height/ +2;u=T(k);u.numberOfItems>0&&u.getItem(0).type==4&&u.removeItem(0);if(g!=0){G=P(G,z,S(u).matrix);z=e.createSVGTransform();z.setRotate(g,G.x,G.y);u.numberOfItems?u.insertItemBefore(z,0):u.appendItem(z)}else u.numberOfItems==0&&k.removeAttribute("transform");if(!h){u=k.getAttribute("transform");k.setAttribute("transform",w);ub("transform",u,H);J("changed",H)}ua("pathpointgrip_container");k=Pa.requestSelector(H[0]);k.resize();k.updateGripCursors(g)};var Za=this.recalculateAllSelectedDimensions=function(){for(var g= +new Na(rb=="none"?"position":"size"),h=H.length;h--;){var k=pb(H[h]);k&&g.addSubCommand(k)}if(!g.isEmpty()){Ha(g);J("changed",H)}},fb=[0,"z","M","m","L","l","C","c","Q","q","A","a","H","h","V","v","S","s","T","t"],wb=function(g){console.log([g.a,g.b,g.c,g.d,g.e,g.f])},xb=this.remapElement=function(g,h,k){var w=l.gridSnapping&&g.parentNode.parentNode.localName==="svg",u=function(){if(w)for(var D in h)h[D]=Ja(h[D]);ha(g,h,1E3,true)};box=svgedit.utilities.getBBox(g);for(var G=0;G<2;G++){var z=G===0? +"fill":"stroke",A=g.getAttribute(z);if(A&&A.indexOf("url(")===0)if(k.a<0||k.d<0){A=ga(A).cloneNode(true);if(k.a<0){var C=A.getAttribute("x1"),F=A.getAttribute("x2");A.setAttribute("x1",-(C-1));A.setAttribute("x2",-(F-1))}if(k.d<0){C=A.getAttribute("y1");F=A.getAttribute("y2");A.setAttribute("y1",-(C-1));A.setAttribute("y2",-(F-1))}A.id=Q();Bb().appendChild(A);g.setAttribute(z,"url(#"+A.id+")")}}G=g.tagName;if(G==="g"||G==="text"||G==="use")if(k.a==1&&k.b==0&&k.c==0&&k.d==1&&(k.e!=0||k.f!=0)){z=S(g).matrix; +z=R(z.inverse(),k,z);h.x=parseFloat(h.x)+z.e;h.y=parseFloat(h.y)+z.f}else{z=T(g);A=e.createSVGTransform();A.setMatrix(R(S(z).matrix,k));z.clear();z.appendItem(A)}switch(G){case "foreignObject":case "rect":case "image":if(G==="image"&&(k.a<0||k.d<0)){z=T(g);A=e.createSVGTransform();A.setMatrix(R(S(z).matrix,k));z.clear();z.appendItem(A)}else{z=P(h.x,h.y,k);h.width=k.a*h.width;h.height=k.d*h.height;h.x=z.x+Math.min(0,h.width);h.y=z.y+Math.min(0,h.height);h.width=Math.abs(h.width);h.height=Math.abs(h.height)}u(); +break;case "ellipse":G=P(h.cx,h.cy,k);h.cx=G.x;h.cy=G.y;h.rx=k.a*h.rx;h.ry=k.d*h.ry;h.rx=Math.abs(h.rx);h.ry=Math.abs(h.ry);u();break;case "circle":G=P(h.cx,h.cy,k);h.cx=G.x;h.cy=G.y;G=svgedit.math.transformBox(box.x,box.y,box.width,box.height,k);h.r=Math.min((G.tr.x-G.tl.x)/2,(G.bl.y-G.tl.y)/2);if(h.r)h.r=Math.abs(h.r);u();break;case "line":z=P(h.x1,h.y1,k);C=P(h.x2,h.y2,k);h.x1=z.x;h.y1=z.y;h.x2=C.x;h.y2=C.y;case "text":k=g.querySelectorAll("tspan");for(G=k.length;G--;){z=la("x",g.getAttribute("x")); +A=la("x",k[G].getAttribute("x"));C=la("y",g.getAttribute("y"));F=la("y",k[G].getAttribute("y"));var E={};if(!isNaN(z)&&!isNaN(A)&&z!=0&&A!=0&&h.x)E.x=h.x-(z-A);if(!isNaN(C)&&!isNaN(F)&&C!=0&&F!=0&&h.y)E.y=h.y-(C-F);if(E.x||E.y)ha(k[G],E,1E3,true)}u();break;case "use":u();break;case "g":(u=$(g).data("gsvg"))&&ha(u,h,1E3,true);break;case "polyline":case "polygon":u=h.points.length;for(G=0;G0){for(var k=h.numberOfItems;k--;){var w=h.getItem(k);if(w.type===0)h.removeItem(k);else if(w.type=== +1)svgedit.math.isIdentity(w.matrix)&&h.removeItem(k);else w.type===4&&w.angle===0&&h.removeItem(k)}if(h.numberOfItems===1&&ma(g))return null}if(!h||h.numberOfItems==0){g.removeAttribute("transform");return null}if(h){k=h.numberOfItems;for(var u=[];k--;){w=h.getItem(k);if(w.type===1)u.push([w.matrix,k]);else if(u.length)u=[]}if(u.length===2){k=e.createSVGTransformFromMatrix(R(u[1][0],u[0][0]));h.removeItem(u[0][1]);h.removeItem(u[1][1]);h.insertItemBefore(k,u[1][1])}k=h.numberOfItems;if(k>=2&&h.getItem(k- +2).type===1&&h.getItem(k-1).type===2){u=e.createSVGTransform();w=R(h.getItem(k-2).matrix,h.getItem(k-1).matrix);u.setMatrix(w);h.removeItem(k-2);h.removeItem(k-2);h.appendItem(u)}}switch(g.tagName){case "line":case "polyline":case "polygon":case "path":break;default:if(h.numberOfItems===1&&h.getItem(0).type===1||h.numberOfItems===2&&h.getItem(0).type===1&&h.getItem(0).type===4)return null}var G=$(g).data("gsvg");k=new Na("Transform");var z={},A=null;w=[];switch(g.tagName){case "line":w=["x1","y1", +"x2","y2"];break;case "circle":w=["cx","cy","r"];break;case "ellipse":w=["cx","cy","rx","ry"];break;case "foreignObject":case "rect":case "image":w=["width","height","x","y"];break;case "use":case "text":case "tspan":w=["x","y"];break;case "polygon":case "polyline":A={};A.points=g.getAttribute("points");u=g.points;var C=u.numberOfItems;z.points=Array(C);for(var F=0;F1.0E-10?Math.sin(F)/(1-Math.cos(F)):2/F;for(F=0;F=3&&h.getItem(K-2).type==3&&h.getItem(K-3).type==2&&h.getItem(K-1).type==2){F=3;var ca=h.getItem(K-3).matrix,U=h.getItem(K-2).matrix,ta=h.getItem(K-1).matrix;C=g.childNodes;for(E=C.length;E--;){var xa=C.item(E);w=G=0;if(xa.nodeType==1){var ja=T(xa);if(ja){w=S(ja).matrix;G=ma(xa);var oa=gb,sa=[];gb=xa.getAttribute("transform");if(G||ea(ja)){var za= +e.createSVGTransform();za.setMatrix(R(ca,U,ta,w));ja.clear();ja.appendItem(za);sa.push(za)}else{G=R(w.inverse(),ta,w);za=e.createSVGMatrix();za.e=-G.e;za.f=-G.f;w=R(za.inverse(),w.inverse(),ca,U,ta,w,G.inverse());var kb=e.createSVGTransform(),ob=e.createSVGTransform(),Vb=e.createSVGTransform();kb.setTranslate(G.e,G.f);ob.setScale(w.a,w.d);Vb.setTranslate(za.e,za.f);ja.appendItem(Vb);ja.appendItem(ob);ja.appendItem(kb);sa.push(Vb);sa.push(ob);sa.push(kb)}k.addSubCommand(pb(xa));gb=oa}}}h.removeItem(K- +1);h.removeItem(K-2);h.removeItem(K-3)}else if(K>=3&&h.getItem(K-1).type==1){F=3;w=S(h).matrix;za=e.createSVGTransform();za.setMatrix(w);h.clear();h.appendItem(za)}else if((K==1||K>1&&h.getItem(1).type!=3)&&h.getItem(0).type==2){F=2;G=S(h).matrix;h.removeItem(0);w=S(h).matrix.inverse();w=R(w,G);G=w.e;w=w.f;if(G!=0||w!=0){C=g.childNodes;E=C.length;for(K=[];E--;){xa=C.item(E);if(xa.nodeType==1){if(xa.getAttribute("clip-path")){oa=xa.getAttribute("clip-path");if(K.indexOf(oa)===-1){Db(oa,G,w);K.push(oa)}}oa= +gb;gb=xa.getAttribute("transform");if(ja=T(xa)){ca=e.createSVGTransform();ca.setTranslate(G,w);ja.numberOfItems?ja.insertItemBefore(ca,0):ja.appendItem(ca);k.addSubCommand(pb(xa));ja=g.getElementsByTagNameNS(c,"use");xa="#"+xa.id;for(ca=ja.length;ca--;){U=ja.item(ca);if(xa==da(U)){ta=e.createSVGTransform();ta.setTranslate(-G,-w);T(U).insertItemBefore(ta,0);k.addSubCommand(pb(U))}}gb=oa}}}K=[];gb=oa}}else if(K==1&&h.getItem(0).type==1&&!u){F=1;w=h.getItem(0).matrix;C=g.childNodes;for(E=C.length;E--;){xa= +C.item(E);if(xa.nodeType==1){oa=gb;gb=xa.getAttribute("transform");if(ja=T(xa)){G=R(w,S(ja).matrix);K=e.createSVGTransform();K.setMatrix(G);ja.clear();ja.appendItem(K,0);k.addSubCommand(pb(xa));gb=oa;oa=xa.getAttribute("stroke-width");xa.getAttribute("stroke")!=="none"&&!isNaN(oa)&&xa.setAttribute("stroke-width",oa*((Math.abs(G.a)+Math.abs(G.d))/2))}}}h.clear()}else{if(u){D=e.createSVGTransform();D.setRotate(u,N.x,N.y);h.numberOfItems?h.insertItemBefore(D,0):h.appendItem(D)}h.numberOfItems==0&&g.removeAttribute("transform"); +return null}if(F==2){if(u){N={x:D.x+O.e,y:D.y+O.f};D=e.createSVGTransform();D.setRotate(u,N.x,N.y);h.numberOfItems?h.insertItemBefore(D,0):h.appendItem(D)}}else if(F==3){w=S(h).matrix;O=e.createSVGTransform();O.setRotate(u,D.x,D.y);O=O.matrix;D=e.createSVGTransform();D.setRotate(u,N.x,N.y);N=D.matrix.inverse();oa=w.inverse();N=R(oa,N,O,w);G=N.e;w=N.f;if(G!=0||w!=0){C=g.childNodes;for(E=C.length;E--;){xa=C.item(E);if(xa.nodeType==1){oa=gb;gb=xa.getAttribute("transform");ja=T(xa);ca=e.createSVGTransform(); +ca.setTranslate(G,w);ja.numberOfItems?ja.insertItemBefore(ca,0):ja.appendItem(ca);k.addSubCommand(pb(xa));gb=oa}}}if(u)h.numberOfItems?h.insertItemBefore(D,0):h.appendItem(D)}}else{u=svgedit.utilities.getBBox(g);if(!u&&g.tagName!="path")return null;w=e.createSVGMatrix();if(G=ma(g)){D={x:u.x+u.width/2,y:u.y+u.height/2};N=P(u.x+u.width/2,u.y+u.height/2,S(h).matrix);F=G*Math.PI/180;C=Math.abs(F)>1.0E-10?Math.sin(F)/(1-Math.cos(F)):2/F;for(F=0;F=3&&h.getItem(K-2).type==3&&h.getItem(K-3).type==2&&h.getItem(K-1).type==2){F=3;w=S(h,K-3,K-1).matrix; +h.removeItem(K-1);h.removeItem(K-2);h.removeItem(K-3)}else if(K==4&&h.getItem(K-1).type==1){F=3;w=S(h).matrix;za=e.createSVGTransform();za.setMatrix(w);h.clear();h.appendItem(za);w=e.createSVGMatrix()}else if((K==1||K>1&&h.getItem(1).type!=3)&&h.getItem(0).type==2){F=2;O=h.getItem(0).matrix;oa=S(h,1).matrix;u=oa.inverse();w=R(u,O,oa);h.removeItem(0)}else if(K==1&&h.getItem(0).type==1&&!G){w=S(h).matrix;switch(g.tagName){case "line":z=$(g).attr(["x1","y1","x2","y2"]);case "polyline":case "polygon":z.points= +g.getAttribute("points");if(z.points){u=g.points;C=u.numberOfItems;z.points=Array(C);for(F=0;F1&&u.showGrips(false)}}}J("selected",H);h||H.length==1?Pa.requestSelector(H[0]).showGrips(true):Pa.requestSelector(H[0]).showGrips(false); +for(H.sort(function(G,z){if(G&&z&&G.compareDocumentPosition)return 3-(z.compareDocumentPosition(G)&6);else if(G==null)return 1});H[0]==null;)H.shift(0)}},Sb=this.selectOnly=function(g,h){cb(true);Nb(g,h)};this.removeFromSelection=function(g){if(H[0]!=null)if(g.length!=0){var h=Array(H.length);j=0;len=H.length;for(var k=0;k=0&&g.id!="svgcanvas")for(;g.nodeName!="foreignObject";){g=g.parentNode;if(!g)return e}var h=v().getCurrentLayer();if([e,a,m,h].indexOf(g)>=0)return e;if($(g).closest("#selectorParentGroup").length)return Pa.selectorParentGroup;for(;g.parentNode!==(I|| +h);)g=g.parentNode;return g};(function(){var g=null,h=null,k=null,w=null,u=null,G={},z={minx:null,miny:null,maxx:null,maxy:null},A=mosueOver=function(C){if(!(b.spaceKey||C.button===1)){var F=C.button===2;C.altKey&&svgCanvas.cloneSelectedElements(0,0);Pb=m.getScreenCTM().inverse();var E=P(C.pageX,C.pageY,Pb),D=E.x*p;E=E.y*p;C.preventDefault();if(F)Ia="select";D=D/p;E=E/p;var N=ac(C);if(N.tagName==="a"&&N.childNodes.length===1)N=N.firstChild;var K=w=h=D,O=u=k=E;if(l.gridSnapping){D=Ja(D);E=Ja(E);h= +Ja(h);k=Ja(k)}if(N==Pa.selectorParentGroup&&H[0]!=null){N=C.target;var ca=ab(N,"type");if(ca=="rotate"){Ia="rotate";current_rotate_mode=ab(N,"dir")}else if(ca=="resize"){Ia="resize";rb=ab(N,"dir")}N=H[0]}gb=N.getAttribute("transform");ca=T(N);switch(Ia){case "select":Sa=true;rb="none";if(F)Sa=false;if(N!=e){if(H.indexOf(N)==-1){C.shiftKey||cb(true);Nb([N]);La=N;Ua.clear()}if(!F)for(F=0;F0&&b.removeFromSelection(N);K.length>0&&Nb(K);break;case "resize":N=T(F);K=(U=ea(N))?G:svgedit.utilities.getBBox(F);O=K.x;ta=K.y;var xa=K.width,ja=K.height;K=x-h;ca=y-k;if(l.gridSnapping){K=Ja(K);ca=Ja(ca);ja=Ja(ja);xa=Ja(xa)}var oa=ma(F);if(oa){var sa= +Math.sqrt(K*K+ca*ca);ca=Math.atan2(ca,K)-oa*Math.PI/180;K=sa*Math.cos(ca);ca=sa*Math.sin(ca)}if(rb.indexOf("n")==-1&&rb.indexOf("s")==-1)ca=0;if(rb.indexOf("e")==-1&&rb.indexOf("w")==-1)K=0;var za=sa=0,kb=ja?(ja+ca)/ja:1,ob=xa?(xa+K)/xa:1;if(rb.indexOf("n")>=0){kb=ja?(ja-ca)/ja:1;za=ja}if(rb.indexOf("w")>=0){ob=xa?(xa-K)/xa:1;sa=xa}K=e.createSVGTransform();ca=e.createSVGTransform();xa=e.createSVGTransform();if(l.gridSnapping){O=Ja(O);sa=Ja(sa);ta=Ja(ta);za=Ja(za)}K.setTranslate(-(O+sa),-(ta+za)); +if(C.shiftKey)if(ob==1)ob=kb;else kb=ob;ca.setScale(ob,kb);xa.setTranslate(O+sa,ta+za);if(U){U=oa?1:0;N.replaceItem(K,2+U);N.replaceItem(ca,1+U);N.replaceItem(xa,0+U)}else{U=N.numberOfItems;N.replaceItem(xa,U-3);N.replaceItem(ca,U-2);N.replaceItem(K,U-1)}Pa.requestSelector(F).resize();J("transition",H);break;case "zoom":K*=p;O*=p;ha(Wa,{x:Math.min(w*p,K),y:Math.min(u*p,O),width:Math.abs(K-w*p),height:Math.abs(O-u*p)},100);break;case "text":ha(N,{x:x,y:y},1E3);break;case "line":K=null;window.opera|| +e.suspendRedraw(1E3);if(l.gridSnapping){x=Ja(x);y=Ja(y)}O=x;U=y;if(C.shiftKey){U=X(h,k,O,U);O=U.x;U=U.y}N.setAttributeNS(null,"x2",O);N.setAttributeNS(null,"y2",U);window.opera||e.unsuspendRedraw(K);break;case "foreignObject":case "square":case "rect":case "image":K=Math.abs(x-h);U=Math.abs(y-k);if(Ia=="square"||C.shiftKey){K=U=Math.max(K,U);O=hk?k+ta:k-ta}if(C.altKey){U=h;O=k;ta=Math.abs(x-U);ca=C.shiftKey?ta:Math.abs(y- +O)}N.setAttributeNS(null,"rx",ta);N.setAttributeNS(null,"ry",ca);N.setAttributeNS(null,"cx",U);N.setAttributeNS(null,"cy",O);window.opera||e.unsuspendRedraw(K);break;case "fhellipse":case "fhrect":z.minx=Math.min(K,z.minx);z.maxx=Math.max(K,z.maxx);z.miny=Math.min(O,z.miny);z.maxy=Math.max(O,z.maxy);case "fhpath":g+=+K+","+O+" ";N.setAttributeNS(null,"points",g);break;case "path":case "pathedit":x*=p;y*=p;if(l.gridSnapping){x=Ja(x);y=Ja(y);h=Ja(h);k=Ja(k)}if(C.shiftKey){if(U=svgedit.path.path){N= +U.dragging?U.dragging[0]:h;U=U.dragging?U.dragging[1]:k}else{N=h;U=k}U=X(N,U,x,y);x=U.x;y=U.y}if(Wa&&Wa.getAttribute("display")!=="none"){K*=p;O*=p;ha(Wa,{x:Math.min(w*p,K),y:Math.min(u*p,O),width:Math.abs(K-w*p),height:Math.abs(O-u*p)},100)}Ua.mouseMove(C,x,y);break;case "textedit":x*=p;y*=p;qb.mouseMove(D,E);break;case "rotate":K=svgedit.utilities.getBBox(F);U=K.x+K.width/2;O=K.y+K.height/2;N=ba(F);N=P(U,O,N);U=N.x;O=N.y;N=K.x;ta=K.y;if(current_rotate_mode=="nw")N=K.x+K.width;if(current_rotate_mode== +"se")ta=K.y+K.height;if(current_rotate_mode=="sw"){N=K.x+K.width;ta=K.y+K.height}compensation_angle=(Math.atan2(O-ta,U-N)*(180/Math.PI)-90)%360;oa=(Math.atan2(O-y,U-x)*(180/Math.PI)-90)%360;oa+=compensation_angle;if(l.gridSnapping)oa=Ja(oa);if(C.shiftKey)oa=Math.round(oa/45)*45;b.setRotationAngle(oa<-180?360+oa:oa,true);J("transition",H)}nb("mouseMove",{event:C,mouse_x:D,mouse_y:E,selected:F})}}).click(function(C){C.preventDefault();return false}).dblclick(function(C){var F=C.target.parentNode;if(F!== +I){var E=ac(C),D=E.tagName;if(D==="text"&&Ia!=="textedit"){C=P(C.pageX,C.pageY,Pb);qb.select(E,C.x,C.y)}if((D==="g"||D==="a")&&ma(E)){bc(E);E=H[0];cb(true)}I&&cc();F.tagName!=="g"&&F.tagName!=="a"||F===v().getCurrentLayer()||E===Pa.selectorParentGroup||oc(E)}}).mouseup(function(C){if(C.button!==2){var F=La;La=null;if(Sa){var E=P(C.pageX,C.pageY,Pb),D=E.x*p;E=E.y*p;var N=D/p,K=E/p,O=ua(va()),ca=false;Sa=false;switch(Ia){case "resize":case "multiselect":if(Wa!=null){Wa.setAttribute("display","none"); jb=[]}Ia="select";case "select":if(H[0]!=null){if(H[1]==null){D=H[0];switch(D.tagName){case "g":case "use":case "image":case "foreignObject":break;default:hb.fill=D.getAttribute("fill");hb.fill_opacity=D.getAttribute("fill-opacity");hb.stroke=D.getAttribute("stroke");hb.stroke_opacity=D.getAttribute("stroke-opacity");hb.stroke_width=D.getAttribute("stroke-width");hb.stroke_dasharray=D.getAttribute("stroke-dasharray");hb.stroke_linejoin=D.getAttribute("stroke-linejoin");hb.stroke_linecap=D.getAttribute("stroke-linecap")}if(D.tagName== -"text"){mb.font_size=D.getAttribute("font-size");mb.font_family=D.getAttribute("font-family")}Pa.requestSelector(D).showGrips(true)}Za();if(M!=w||K!=v){C=H.length;for(D=0;D=0?F.indexOf(",",M+1)>=0:F.indexOf(" ",F.indexOf(" ")+1)>=0)N=Ua.smoothPolylineIntoPath(N);break;case "line":F=$(N).attr(["x1","x2","y1","y2"]);aa=F.x1!=F.x2||F.y1!=F.y2;break;case "foreignObject":case "square":case "rect":case "image":F=$(N).attr(["width","height"]); -aa=F.width!=0||F.height!=0||Ia==="image";break;case "circle":aa=N.getAttribute("r")!=0;break;case "ellipse":F=$(N).attr(["rx","ry"]);aa=F.rx!=null||F.ry!=null;break;case "fhellipse":if(z.maxx-z.minx>0&&z.maxy-z.miny>0){N=ea({element:"ellipse",curStyles:true,attr:{cx:(z.minx+z.maxx)/2,cy:(z.miny+z.maxy)/2,rx:(z.maxx-z.minx)/2,ry:(z.maxy-z.miny)/2,id:va()}});J("changed",[N]);aa=true}break;case "fhrect":if(z.maxx-z.minx>0&&z.maxy-z.miny>0){N=ea({element:"rect",curStyles:true,attr:{x:z.minx,y:z.miny, -width:z.maxx-z.minx,height:z.maxy-z.miny,id:va()}});J("changed",[N]);aa=true}break;case "text":aa=true;Sb([N]);qb.start(N);break;case "path":N=null;Sa=true;F=Ua.mouseUp(C,N,D,E);N=F.element;aa=F.keep;break;case "pathedit":aa=true;N=null;Ua.mouseUp(C);break;case "textedit":aa=false;N=null;qb.mouseUp(C,D,E);break;case "rotate":aa=true;N=null;Ia="select";F=b.undoMgr.finishUndoableChange();F.isEmpty()||Ha(F);Za();J("changed",H)}D=nb("mouseUp",{event:C,mouse_x:D,mouse_y:E},true);$.each(D,function(xa,ja){if(ja){aa= -ja.keep||aa;N=ja.element;Sa=ja.started||Sa}});if(!aa&&N!=null){u().releaseId(va());N.parentNode.removeChild(N);N=null;for(D=C.target;D.parentNode.parentNode.tagName=="g";)D=D.parentNode;if((Ia!="path"||!drawn_path)&&D.parentNode.id!="selectorParentGroup"&&D.id!="svgcanvas"&&D.id!="svgroot"){b.setMode("select");Sb([D],true)}}else if(N!=null){b.addedNew=true;C=0.2;var T;if(false.beginElement&&N.getAttribute("opacity")!=O.opacity){T=$(false).clone().attr({to:O.opacity,dur:C}).appendTo(N);try{T[0].beginElement()}catch(ta){}}else C= -0;setTimeout(function(){T&&T.remove();N.setAttribute("opacity",O.opacity);N.setAttribute("style","pointer-events:inherit");qa(N);if(Ia==="path")Ua.toEditMode(N);else m.selectNew&&Sb([N],true);Ha(new Qa(N));J("changed",[N])},C*1E3)}gb=null}}});$(a).bind("mousewheel DOMMouseScroll",function(C){if(C.shiftKey){C.preventDefault();Pb=l.getScreenCTM().inverse();var F=Q(C.pageX,C.pageY,Pb);F={x:F.x,y:F.y,width:0,height:0};if(C.wheelDelta)if(C.wheelDelta>=120)F.factor=2;else{if(C.wheelDelta<=-120)F.factor= -0.5}else if(C.detail)if(C.detail>0)F.factor=0.5;else if(C.detail<0)F.factor=2;F.factor&&J("zoomed",F)}})})();var Lb=function(g){$(g).click(function(h){h.preventDefault()})},qb=b.textActions=function(){function g(ja){var oa=F.value==="";$(F).focus();if(!arguments.length)if(oa)ja=0;else{if(F.selectionEnd!==F.selectionStart)return;ja=F.selectionEnd}var sa;sa=K[ja];oa||F.setSelectionRange(ja,ja);E=ua("text_cursor");if(!E){E=document.createElementNS(c,"line");ga(E,{id:"text_cursor",stroke:"#333","stroke-width":1}); -E=ua("selectorParentGroup").appendChild(E)}M||(M=setInterval(function(){var za=E.getAttribute("display")==="none";E.setAttribute("display",za?"inline":"none")},600));oa=G(sa.x,N.y);sa=G(sa.x,N.y+N.height);ga(E,{x1:oa.x,y1:oa.y,x2:sa.x,y2:sa.y,visibility:"visible",display:"inline"});D&&D.setAttribute("d","")}function h(ja,oa,sa){if(ja===oa)g(oa);else{sa||F.setSelectionRange(ja,oa);D=ua("text_selectblock");if(!D){D=document.createElementNS(c,"path");ga(D,{id:"text_selectblock",fill:"green",opacity:0.5, -style:"pointer-events:none"});ua("selectorParentGroup").appendChild(D)}ja=K[ja];var za=K[oa];E.setAttribute("visibility","hidden");oa=G(ja.x,N.y);sa=G(ja.x+(za.x-ja.x),N.y);var kb=G(ja.x,N.y+N.height);ja=G(ja.x+(za.x-ja.x),N.y+N.height);ga(D,{d:"M"+oa.x+","+oa.y+" L"+sa.x+","+sa.y+" "+ja.x+","+ja.y+" "+kb.x+","+kb.y+"z",display:"inline"})}}function k(ja,oa){var sa=e.createSVGPoint();sa.x=ja;sa.y=oa;if(K.length==1)return 0;sa=C.getCharNumAtPosition(sa);if(sa<0){sa=K.length-2;if(ja<=K[0].x)sa=0}else if(sa>= -K.length-2)sa=K.length-2;var za=K[sa];ja>za.x+za.width/2&&sa++;return sa}function w(ja,oa,sa){var za=F.selectionStart;ja=k(ja,oa);h(Math.min(za,ja),Math.max(za,ja),!sa)}function v(ja,oa){var sa={x:ja,y:oa};sa.x/=n;sa.y/=n;if(aa){var za=Q(sa.x,sa.y,aa.inverse());sa.x=za.x;sa.y=za.y}return sa}function G(ja,oa){var sa={x:ja,y:oa};if(aa){var za=Q(sa.x,sa.y,aa);sa.x=za.x;sa.y=za.y}sa.x*=n;sa.y*=n;return sa}function z(ja){h(0,C.textContent.length);$(this).unbind(ja)}function A(ja){if(xa&&C){var oa=Q(ja.pageX, -ja.pageY,Pb);oa=v(oa.x*n,oa.y*n);oa=k(oa.x,oa.y);var sa=C.textContent,za=sa.substr(0,oa).replace(/[a-z0-9]+$/i,"").length;sa=sa.substr(oa).match(/^[a-z0-9]+/i);h(za,(sa?sa[0].length:0)+oa);$(ja.target).click(z);setTimeout(function(){$(ja.target).unbind("click",z)},300)}}var C,F,E,D,M,K=[],N,aa,T,ta,xa;return{select:function(ja,oa,sa){C=ja;qb.toEditMode(oa,sa)},start:function(ja){C=ja;qb.toEditMode()},mouseDown:function(ja,oa,sa,za){ja=v(sa,za);F.focus();g(k(ja.x,ja.y));T=sa;ta=za},mouseMove:function(ja, -oa){var sa=v(ja,oa);w(sa.x,sa.y)},mouseUp:function(ja,oa,sa){var za=v(oa,sa);w(za.x,za.y,true);ja.target!==C&&oaT-2&&sata-2&&qb.toSelectMode(true)},setCursor:g,toEditMode:function(ja,oa){xa=false;Ia="textedit";Pa.requestSelector(C).showGrips(false);Pa.requestSelector(C);qb.init();$(C).css("cursor","text");if(arguments.length){var sa=v(ja,oa);g(k(sa.x,sa.y))}else g();setTimeout(function(){xa=true},300)},toSelectMode:function(ja){Ia="select";clearInterval(M);M=null;D&&$(D).attr("display", -"none");E&&$(E).attr("visibility","hidden");$(C).css("cursor","move");if(ja){cb();$(C).css("cursor","move");J("selected",[C]);Nb([C],true)}C&&!C.textContent.length&&b.deleteSelectedElements();$(F).blur();C=false},setInputElem:function(ja){F=ja},clear:function(){Ia=="textedit"&&qb.toSelectMode()},init:function(){if(C){if(!C.parentNode){C=H[0];Pa.requestSelector(C).showGrips(false)}var ja=C.textContent.length,oa=C.getAttribute("transform");N=svgedit.utilities.getBBox(C);aa=oa?ba(C):null;K=Array(ja); -F.focus();$(C).unbind("dblclick",A).dblclick(A);if(!ja)var sa={x:N.x+N.width/2,width:0};for(oa=0;oa=0?F.indexOf(",",N+1)>=0:F.indexOf(" ",F.indexOf(" ")+1)>=0)O=Ua.smoothPolylineIntoPath(O);break;case "line":F=$(O).attr(["x1","x2","y1","y2"]);ca=F.x1!=F.x2||F.y1!=F.y2;break;case "foreignObject":case "square":case "rect":case "image":F=$(O).attr(["width","height"]); +ca=F.width!=0||F.height!=0||Ia==="image";break;case "circle":ca=O.getAttribute("r")!=0;break;case "ellipse":F=$(O).attr(["rx","ry"]);ca=F.rx!=null||F.ry!=null;break;case "fhellipse":if(z.maxx-z.minx>0&&z.maxy-z.miny>0){O=aa({element:"ellipse",curStyles:true,attr:{cx:(z.minx+z.maxx)/2,cy:(z.miny+z.maxy)/2,rx:(z.maxx-z.minx)/2,ry:(z.maxy-z.miny)/2,id:va()}});J("changed",[O]);ca=true}break;case "fhrect":if(z.maxx-z.minx>0&&z.maxy-z.miny>0){O=aa({element:"rect",curStyles:true,attr:{x:z.minx,y:z.miny, +width:z.maxx-z.minx,height:z.maxy-z.miny,id:va()}});J("changed",[O]);ca=true}break;case "text":ca=true;Sb([O]);qb.start(O);break;case "path":O=null;Sa=true;F=Ua.mouseUp(C,O,D,E);O=F.element;ca=F.keep;break;case "pathedit":ca=true;O=null;Ua.mouseUp(C);break;case "textedit":ca=false;O=null;qb.mouseUp(C,D,E);break;case "rotate":ca=true;O=null;Ia="select";F=b.undoMgr.finishUndoableChange();F.isEmpty()||Ha(F);Za();J("changed",H)}D=nb("mouseUp",{event:C,mouse_x:D,mouse_y:E},true);$.each(D,function(xa,ja){if(ja){ca= +ja.keep||ca;O=ja.element;Sa=ja.started||Sa}});if(!ca&&O!=null){v().releaseId(va());O.parentNode.removeChild(O);O=null;for(D=C.target;D.parentNode.parentNode.tagName=="g";)D=D.parentNode;if((Ia!="path"||!drawn_path)&&D.parentNode.id!="selectorParentGroup"&&D.id!="svgcanvas"&&D.id!="svgroot"){b.setMode("select");Sb([D],true)}}else if(O!=null){b.addedNew=true;C=0.2;var U;if(false.beginElement&&O.getAttribute("opacity")!=M.opacity){U=$(false).clone().attr({to:M.opacity,dur:C}).appendTo(O);try{U[0].beginElement()}catch(ta){}}else C= +0;setTimeout(function(){U&&U.remove();O.setAttribute("opacity",M.opacity);O.setAttribute("style","pointer-events:inherit");qa(O);if(Ia==="path")Ua.toEditMode(O);else l.selectNew&&Sb([O],true);Ha(new Qa(O));J("changed",[O])},C*1E3)}gb=null}}});$(a).bind("mousewheel DOMMouseScroll",function(C){if(C.shiftKey){C.preventDefault();Pb=m.getScreenCTM().inverse();var F=P(C.pageX,C.pageY,Pb);F={x:F.x,y:F.y,width:0,height:0};if(C.wheelDelta)if(C.wheelDelta>=120)F.factor=2;else{if(C.wheelDelta<=-120)F.factor= +0.5}else if(C.detail)if(C.detail>0)F.factor=0.5;else if(C.detail<0)F.factor=2;F.factor&&J("zoomed",F)}})})();var Lb=function(g){$(g).click(function(h){h.preventDefault()})},qb=b.textActions=function(){function g(ja){var oa=F.value==="";$(F).focus();if(!arguments.length)if(oa)ja=0;else{if(F.selectionEnd!==F.selectionStart)return;ja=F.selectionEnd}var sa;sa=K[ja];oa||F.setSelectionRange(ja,ja);E=ua("text_cursor");if(!E){E=document.createElementNS(c,"line");ha(E,{id:"text_cursor",stroke:"#333","stroke-width":1}); +E=ua("selectorParentGroup").appendChild(E)}N||(N=setInterval(function(){var za=E.getAttribute("display")==="none";E.setAttribute("display",za?"inline":"none")},600));oa=G(sa.x,O.y);sa=G(sa.x,O.y+O.height);ha(E,{x1:oa.x,y1:oa.y,x2:sa.x,y2:sa.y,visibility:"visible",display:"inline"});D&&D.setAttribute("d","")}function h(ja,oa,sa){if(ja===oa)g(oa);else{sa||F.setSelectionRange(ja,oa);D=ua("text_selectblock");if(!D){D=document.createElementNS(c,"path");ha(D,{id:"text_selectblock",fill:"green",opacity:0.5, +style:"pointer-events:none"});ua("selectorParentGroup").appendChild(D)}ja=K[ja];var za=K[oa];E.setAttribute("visibility","hidden");oa=G(ja.x,O.y);sa=G(ja.x+(za.x-ja.x),O.y);var kb=G(ja.x,O.y+O.height);ja=G(ja.x+(za.x-ja.x),O.y+O.height);ha(D,{d:"M"+oa.x+","+oa.y+" L"+sa.x+","+sa.y+" "+ja.x+","+ja.y+" "+kb.x+","+kb.y+"z",display:"inline"})}}function k(ja,oa){var sa=e.createSVGPoint();sa.x=ja;sa.y=oa;if(K.length==1)return 0;sa=C.getCharNumAtPosition(sa);if(sa<0){sa=K.length-2;if(ja<=K[0].x)sa=0}else if(sa>= +K.length-2)sa=K.length-2;var za=K[sa];ja>za.x+za.width/2&&sa++;return sa}function w(ja,oa,sa){var za=F.selectionStart;ja=k(ja,oa);h(Math.min(za,ja),Math.max(za,ja),!sa)}function u(ja,oa){var sa={x:ja,y:oa};sa.x/=p;sa.y/=p;if(ca){var za=P(sa.x,sa.y,ca.inverse());sa.x=za.x;sa.y=za.y}return sa}function G(ja,oa){var sa={x:ja,y:oa};if(ca){var za=P(sa.x,sa.y,ca);sa.x=za.x;sa.y=za.y}sa.x*=p;sa.y*=p;return sa}function z(ja){h(0,C.textContent.length);$(this).unbind(ja)}function A(ja){if(xa&&C){var oa=P(ja.pageX, +ja.pageY,Pb);oa=u(oa.x*p,oa.y*p);oa=k(oa.x,oa.y);var sa=C.textContent,za=sa.substr(0,oa).replace(/[a-z0-9]+$/i,"").length;sa=sa.substr(oa).match(/^[a-z0-9]+/i);h(za,(sa?sa[0].length:0)+oa);$(ja.target).click(z);setTimeout(function(){$(ja.target).unbind("click",z)},300)}}var C,F,E,D,N,K=[],O,ca,U,ta,xa;return{select:function(ja,oa,sa){C=ja;qb.toEditMode(oa,sa)},start:function(ja){C=ja;qb.toEditMode()},mouseDown:function(ja,oa,sa,za){ja=u(sa,za);F.focus();g(k(ja.x,ja.y));U=sa;ta=za},mouseMove:function(ja, +oa){var sa=u(ja,oa);w(sa.x,sa.y)},mouseUp:function(ja,oa,sa){var za=u(oa,sa);w(za.x,za.y,true);ja.target!==C&&oaU-2&&sata-2&&qb.toSelectMode(true)},setCursor:g,toEditMode:function(ja,oa){xa=false;Ia="textedit";Pa.requestSelector(C).showGrips(false);Pa.requestSelector(C);qb.init();$(C).css("cursor","text");if(arguments.length){var sa=u(ja,oa);g(k(sa.x,sa.y))}else g();setTimeout(function(){xa=true},300)},toSelectMode:function(ja){Ia="select";clearInterval(N);N=null;D&&$(D).attr("display", +"none");E&&$(E).attr("visibility","hidden");$(C).css("cursor","move");if(ja){cb();$(C).css("cursor","move");J("selected",[C]);Nb([C],true)}C&&!C.textContent.length&&b.deleteSelectedElements();$(F).blur();C=false},setInputElem:function(ja){F=ja},clear:function(){Ia=="textedit"&&qb.toSelectMode()},init:function(){if(C){if(!C.parentNode){C=H[0];Pa.requestSelector(C).showGrips(false)}var ja=C.textContent.length,oa=C.getAttribute("transform");O=svgedit.utilities.getBBox(C);ca=oa?ba(C):null;K=Array(ja); +F.focus();$(C).unbind("dblclick",A).dblclick(A);if(!ja)var sa={x:O.x+O.width/2,width:0};for(oa=0;oa=0&&this.selected_pts.push(C)}this.selected_pts.sort();A=this.selected_pts.length;for(z=Array(A);A--;){F=this.segs[this.selected_pts[A]];F.select(true);z[A]=F.ptgrip}Ua.canDeleteNodes=true;Ua.closed_subpath= -this.subpathIsClosed(this.selected_pts[0]);J("selected",z)};var v=h=null,G=false;return{mouseDown:function(z,A,C,F){if(Ia==="path"){mouse_x=C;mouse_y=F;F=mouse_x/n;A=mouse_y/n;C=ua("path_stretch_line");k=[F,A];if(m.gridSnapping){F=Ja(F);A=Ja(A);mouse_x=Ja(mouse_x);mouse_y=Ja(mouse_y)}if(!C){C=document.createElementNS(c,"path");ga(C,{id:"path_stretch_line",stroke:"#22C","stroke-width":"0.5",fill:"none"});C=ua("selectorParentGroup").appendChild(C)}C.setAttribute("display","inline");var E=null;if(v){E= -v.pathSegList;for(var D=E.numberOfItems,M=6/n,K=false;D;){D--;var N=E.getItem(D),aa=N.x;N=N.y;if(F>=aa-M&&F<=aa+M&&A>=N-M&&A<=N+M){K=true;break}}M=va();svgedit.path.removePath_(M);M=ua(M);aa=E.numberOfItems;if(K){if(D<=1&&aa>=2){F=E.getItem(0).x;A=E.getItem(0).y;z=C.pathSegList.getItem(1);z=z.pathSegType===4?v.createSVGPathSegLinetoAbs(F,A):v.createSVGPathSegCurvetoCubicAbs(F,A,z.x1/n,z.y1/n,F,A);F=v.createSVGPathSegClosePath();E.appendItem(z);E.appendItem(F)}else if(aa<3)return E=false;$(C).remove(); -element=M;v=null;Sa=false;if(g){svgedit.path.path.matrix&&xb(M,{},svgedit.path.path.matrix.inverse());C=M.getAttribute("d");z=$(svgedit.path.path.elem).attr("d");$(svgedit.path.path.elem).attr("d",z+C);$(M).remove();svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath();svgedit.path.path.init();Ua.toEditMode(svgedit.path.path.elem);svgedit.path.path.selectPt();return false}}else{if(!$.contains(a,ac(z))){console.log("Clicked outside canvas");return false}E=v.pathSegList.numberOfItems;D=v.pathSegList.getItem(E- -1);M=D.x;D=D.y;if(z.shiftKey){z=Z(M,D,F,A);F=z.x;A=z.y}z=C.pathSegList.getItem(1);z=z.pathSegType===4?v.createSVGPathSegLinetoAbs(Gb(F),Gb(A)):v.createSVGPathSegCurvetoCubicAbs(Gb(F),Gb(A),z.x1/n,z.y1/n,z.x2/n,z.y2/n);v.pathSegList.appendItem(z);F*=n;A*=n;C.setAttribute("d",["M",F,A,F,A].join(" "));C=E;if(g)C+=svgedit.path.path.segs.length;svgedit.path.addPointGrip(C,F,A)}}else{d_attr="M"+F+","+A+" ";v=ea({element:"path",curStyles:true,attr:{d:d_attr,id:P(),opacity:O.opacity/2}});C.setAttribute("d", -["M",mouse_x,mouse_y,mouse_x,mouse_y].join(" "));C=g?svgedit.path.path.segs.length:0;svgedit.path.addPointGrip(C,mouse_x,mouse_y)}}else if(svgedit.path.path){svgedit.path.path.storeD();M=z.target.id;if(M.substr(0,14)=="pathpointgrip_"){A=svgedit.path.path.cur_pt=parseInt(M.substr(14));svgedit.path.path.dragging=[C,F];E=svgedit.path.path.segs[A];if(z.shiftKey)E.selected?svgedit.path.path.removePtFromSelection(A):svgedit.path.path.addPtsToSelection(A);else{if(svgedit.path.path.selected_pts.length<= -1||!E.selected)svgedit.path.path.clearSelection();svgedit.path.path.addPtsToSelection(A)}}else if(M.indexOf("ctrlpointgrip_")==0){svgedit.path.path.dragging=[C,F];z=M.split("_")[1].split("c");A=z[0]-0;svgedit.path.path.selectPt(A,z[1]-0)}if(!svgedit.path.path.dragging){if(Wa==null)Wa=Pa.getRubberBandBox();ga(Wa,{x:C*n,y:F*n,width:0,height:0,display:"inline"},100)}}},mouseMove:function(z,A,C){G=true;if(Ia==="path"){if(v){var F=v.pathSegList;z=F.numberOfItems-1;if(k){var E=svgedit.path.addCtrlGrip("1c1"), -D=svgedit.path.addCtrlGrip("0c2");D.getAttribute("cx");D.getAttribute("cy");E.setAttribute("cx",A);E.setAttribute("cy",C);E.setAttribute("display","inline");E=k[0];var M=k[1];F.getItem(z);var K=E+(E-A/n),N=M+(M-C/n);D.setAttribute("cx",K*n);D.setAttribute("cy",N*n);D.setAttribute("display","inline");D=svgedit.path.getCtrlLine(1);var aa=svgedit.path.getCtrlLine(2);ga(D,{x1:A,y1:C,x2:E*n,y2:M*n,display:"inline"});ga(aa,{x1:K*n,y1:N*n,x2:E*n,y2:M*n,display:"inline"});if(z===0)w=[A,C];else{F=F.getItem(z- -1);A=F.x;C=F.y;if(F.pathSegType===6){A+=A-F.x2;C+=C-F.y2}else if(w){A=w[0]/n;C=w[1]/n}svgedit.path.replacePathSeg(6,z,[E,M,A,C,K,N],v)}}else if(E=ua("path_stretch_line")){z=F.getItem(z);if(z.pathSegType===6)svgedit.path.replacePathSeg(6,1,[A,C,(z.x+(z.x-z.x2))*n,(z.y+(z.y-z.y2))*n,A,C],E);else w?svgedit.path.replacePathSeg(6,1,[A,C,w[0],w[1],A,C],E):svgedit.path.replacePathSeg(4,1,[A,C],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);M=svgedit.path.getPointFromGrip({x:A,y:C},svgedit.path.path);z=M.x-E.x;E=M.y-E.y;svgedit.path.path.dragging=[A,C];svgedit.path.path.dragctrl?svgedit.path.path.moveCtrl(z,E):svgedit.path.path.movePts(z,E)}else{svgedit.path.path.selected_pts=[];svgedit.path.path.eachSeg(function(){if(this.next||this.prev){var T=Wa.getBBox(),ta=svgedit.path.getGripPt(this);T=svgedit.math.rectsIntersect(T,{x:ta.x,y:ta.y,width:0,height:0});this.select(T);T&&svgedit.path.path.selected_pts.push(this.index)}})}}, -mouseUp:function(z,A){if(Ia==="path"){k=null;if(!v){A=ua(va());Sa=false;w=null}return{keep:true,element:A}}if(svgedit.path.path.dragging){var C=svgedit.path.path.cur_pt;svgedit.path.path.dragging=false;svgedit.path.path.dragctrl=false;svgedit.path.path.update();G&&svgedit.path.path.endChanges("Move path point(s)");!z.shiftKey&&!G&&svgedit.path.path.selectPt(C)}else if(Wa&&Wa.getAttribute("display")!="none"){Wa.setAttribute("display","none");Wa.getAttribute("width")<=2&&Wa.getAttribute("height")<= +this.subpathIsClosed(this.selected_pts[0]);J("selected",z)};var u=h=null,G=false;return{mouseDown:function(z,A,C,F){if(Ia==="path"){mouse_x=C;mouse_y=F;F=mouse_x/p;A=mouse_y/p;C=ua("path_stretch_line");k=[F,A];if(l.gridSnapping){F=Ja(F);A=Ja(A);mouse_x=Ja(mouse_x);mouse_y=Ja(mouse_y)}if(!C){C=document.createElementNS(c,"path");ha(C,{id:"path_stretch_line",stroke:"#22C","stroke-width":"0.5",fill:"none"});C=ua("selectorParentGroup").appendChild(C)}C.setAttribute("display","inline");var E=null;if(u){E= +u.pathSegList;for(var D=E.numberOfItems,N=6/p,K=false;D;){D--;var O=E.getItem(D),ca=O.x;O=O.y;if(F>=ca-N&&F<=ca+N&&A>=O-N&&A<=O+N){K=true;break}}N=va();svgedit.path.removePath_(N);N=ua(N);ca=E.numberOfItems;if(K){if(D<=1&&ca>=2){F=E.getItem(0).x;A=E.getItem(0).y;z=C.pathSegList.getItem(1);z=z.pathSegType===4?u.createSVGPathSegLinetoAbs(F,A):u.createSVGPathSegCurvetoCubicAbs(F,A,z.x1/p,z.y1/p,F,A);F=u.createSVGPathSegClosePath();E.appendItem(z);E.appendItem(F)}else if(ca<3)return E=false;$(C).remove(); +element=N;u=null;Sa=false;if(g){svgedit.path.path.matrix&&xb(N,{},svgedit.path.path.matrix.inverse());C=N.getAttribute("d");z=$(svgedit.path.path.elem).attr("d");$(svgedit.path.path.elem).attr("d",z+C);$(N).remove();svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath();svgedit.path.path.init();Ua.toEditMode(svgedit.path.path.elem);svgedit.path.path.selectPt();return false}}else{if(!$.contains(a,ac(z))){console.log("Clicked outside canvas");return false}E=u.pathSegList.numberOfItems;D=u.pathSegList.getItem(E- +1);N=D.x;D=D.y;if(z.shiftKey){z=X(N,D,F,A);F=z.x;A=z.y}z=C.pathSegList.getItem(1);z=z.pathSegType===4?u.createSVGPathSegLinetoAbs(Gb(F),Gb(A)):u.createSVGPathSegCurvetoCubicAbs(Gb(F),Gb(A),z.x1/p,z.y1/p,z.x2/p,z.y2/p);u.pathSegList.appendItem(z);F*=p;A*=p;C.setAttribute("d",["M",F,A,F,A].join(" "));C=E;if(g)C+=svgedit.path.path.segs.length;svgedit.path.addPointGrip(C,F,A)}}else{d_attr="M"+F+","+A+" ";u=aa({element:"path",curStyles:true,attr:{d:d_attr,id:Q(),opacity:M.opacity/2}});C.setAttribute("d", +["M",mouse_x,mouse_y,mouse_x,mouse_y].join(" "));C=g?svgedit.path.path.segs.length:0;svgedit.path.addPointGrip(C,mouse_x,mouse_y)}}else if(svgedit.path.path){svgedit.path.path.storeD();N=z.target.id;if(N.substr(0,14)=="pathpointgrip_"){A=svgedit.path.path.cur_pt=parseInt(N.substr(14));svgedit.path.path.dragging=[C,F];E=svgedit.path.path.segs[A];if(z.shiftKey)E.selected?svgedit.path.path.removePtFromSelection(A):svgedit.path.path.addPtsToSelection(A);else{if(svgedit.path.path.selected_pts.length<= +1||!E.selected)svgedit.path.path.clearSelection();svgedit.path.path.addPtsToSelection(A)}}else if(N.indexOf("ctrlpointgrip_")==0){svgedit.path.path.dragging=[C,F];z=N.split("_")[1].split("c");A=z[0]-0;svgedit.path.path.selectPt(A,z[1]-0)}if(!svgedit.path.path.dragging){if(Wa==null)Wa=Pa.getRubberBandBox();ha(Wa,{x:C*p,y:F*p,width:0,height:0,display:"inline"},100)}}},mouseMove:function(z,A,C){G=true;if(Ia==="path"){if(u){var F=u.pathSegList;z=F.numberOfItems-1;if(k){var E=svgedit.path.addCtrlGrip("1c1"), +D=svgedit.path.addCtrlGrip("0c2");D.getAttribute("cx");D.getAttribute("cy");E.setAttribute("cx",A);E.setAttribute("cy",C);E.setAttribute("display","inline");E=k[0];var N=k[1];F.getItem(z);var K=E+(E-A/p),O=N+(N-C/p);D.setAttribute("cx",K*p);D.setAttribute("cy",O*p);D.setAttribute("display","inline");D=svgedit.path.getCtrlLine(1);var ca=svgedit.path.getCtrlLine(2);ha(D,{x1:A,y1:C,x2:E*p,y2:N*p,display:"inline"});ha(ca,{x1:K*p,y1:O*p,x2:E*p,y2:N*p,display:"inline"});if(z===0)w=[A,C];else{F=F.getItem(z- +1);A=F.x;C=F.y;if(F.pathSegType===6){A+=A-F.x2;C+=C-F.y2}else if(w){A=w[0]/p;C=w[1]/p}svgedit.path.replacePathSeg(6,z,[E,N,A,C,K,O],u)}}else if(E=ua("path_stretch_line")){z=F.getItem(z);if(z.pathSegType===6)svgedit.path.replacePathSeg(6,1,[A,C,(z.x+(z.x-z.x2))*p,(z.y+(z.y-z.y2))*p,A,C],E);else w?svgedit.path.replacePathSeg(6,1,[A,C,w[0],w[1],A,C],E):svgedit.path.replacePathSeg(4,1,[A,C],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);N=svgedit.path.getPointFromGrip({x:A,y:C},svgedit.path.path);z=N.x-E.x;E=N.y-E.y;svgedit.path.path.dragging=[A,C];svgedit.path.path.dragctrl?svgedit.path.path.moveCtrl(z,E):svgedit.path.path.movePts(z,E)}else{svgedit.path.path.selected_pts=[];svgedit.path.path.eachSeg(function(){if(this.next||this.prev){var U=Wa.getBBox(),ta=svgedit.path.getGripPt(this);U=svgedit.math.rectsIntersect(U,{x:ta.x,y:ta.y,width:0,height:0});this.select(U);U&&svgedit.path.path.selected_pts.push(this.index)}})}}, +mouseUp:function(z,A){if(Ia==="path"){k=null;if(!u){A=ua(va());Sa=false;w=null}return{keep:true,element:A}}if(svgedit.path.path.dragging){var C=svgedit.path.path.cur_pt;svgedit.path.path.dragging=false;svgedit.path.path.dragctrl=false;svgedit.path.path.update();G&&svgedit.path.path.endChanges("Move path point(s)");!z.shiftKey&&!G&&svgedit.path.path.selectPt(C)}else if(Wa&&Wa.getAttribute("display")!="none"){Wa.setAttribute("display","none");Wa.getAttribute("width")<=2&&Wa.getAttribute("height")<= 2&&Ua.toSelectMode(z.target)}else Ua.toSelectMode(z.target);G=false},toEditMode:function(z){svgedit.path.path=svgedit.path.getPath_(z);Ia="pathedit";cb();svgedit.path.path.show(true).update();svgedit.path.path.oldbbox=svgedit.utilities.getBBox(svgedit.path.path.elem);g=false},toSelectMode:function(z){var A=z==svgedit.path.path.elem;Ia="select";svgedit.path.path.show(false);h=false;cb();svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath();if(A){J("selected",[z]);Nb([z],true)}},addSubPath:function(z){if(z){Ia= -"path";g=true}else{Ua.clear(true);Ua.toEditMode(svgedit.path.path.elem)}},select:function(z){if(h===z){Ua.toEditMode(z);Ia="pathedit"}else h=z},reorient:function(){var z=H[0];if(z)if(ma(z)!=0){var A=new Na("Reorient path"),C={d:z.getAttribute("d"),transform:z.getAttribute("transform")};A.addSubCommand(new Xa(z,C));cb();this.resetOrientation(z);Ha(A);svgedit.path.getPath_(z).show(false).matrix=null;this.clear();Nb([z],true);J("changed",H)}},clear:function(){h=null;if(v){var z=ua(va());$(ua("path_stretch_line")).remove(); -$(z).remove();$(ua("pathpointgrip_container")).find("*").attr("display","none");v=w=null;Sa=false}else Ia=="pathedit"&&this.toSelectMode();svgedit.path.path&&svgedit.path.path.init().show(false)},resetOrientation:function(z){if(z==null||z.nodeName!="path")return false;var A=X(z),C=W(A).matrix;A.clear();z.removeAttribute("transform");A=z.pathSegList;for(var F=A.numberOfItems,E=0;E0){M=F.getItem(E-1).pathSegType;if(M===2){D(E-1,1);C();break}else if(M===1&&F.numberOfItems-1===E){D(E,1);C();break}}}return false};C();if(svgedit.path.path.elem.pathSegList.numberOfItems<=1){Ua.toSelectMode(svgedit.path.path.elem); -b.deleteSelectedElements()}else{svgedit.path.path.init();svgedit.path.path.clearSelection();if(window.opera){z=$(svgedit.path.path.elem);z.attr("d",z.attr("d"))}svgedit.path.path.endChanges("Delete path node(s)")}}},smoothPolylineIntoPath:function(z){var A=z.points,C=A.numberOfItems;if(C>=4){var F=A.getItem(0),E=null;z=[];z.push(["M",F.x,",",F.y," C"].join(""));for(var D=1;D<=C-4;D+=3){var M=A.getItem(D),K=A.getItem(D+1),N=A.getItem(D+2);if(E)if((F=svgedit.path.smoothControlPoints(E,M,F))&&F.length== -2){M=z[z.length-1].split(",");M[2]=F[0].x;M[3]=F[0].y;z[z.length-1]=M.join(",");M=F[1]}z.push([M.x,M.y,K.x,K.y,N.x,N.y].join(","));F=N;E=K}for(z.push("L");D0){N=F.getItem(E-1).pathSegType;if(N===2){D(E-1,1);C();break}else if(N===1&&F.numberOfItems-1===E){D(E,1);C();break}}}return false};C();if(svgedit.path.path.elem.pathSegList.numberOfItems<=1){Ua.toSelectMode(svgedit.path.path.elem); +b.deleteSelectedElements()}else{svgedit.path.path.init();svgedit.path.path.clearSelection();if(window.opera){z=$(svgedit.path.path.elem);z.attr("d",z.attr("d"))}svgedit.path.path.endChanges("Delete path node(s)")}}},smoothPolylineIntoPath:function(z){var A=z.points,C=A.numberOfItems;if(C>=4){var F=A.getItem(0),E=null;z=[];z.push(["M",F.x,",",F.y," C"].join(""));for(var D=1;D<=C-4;D+=3){var N=A.getItem(D),K=A.getItem(D+1),O=A.getItem(D+2);if(E)if((F=svgedit.path.smoothControlPoints(E,N,F))&&F.length== +2){N=z[z.length-1].split(",");N[2]=F[0].x;N[3]=F[0].y;z[z.length-1]=N.join(",");N=F[1]}z.push([N.x,N.y,K.x,K.y,O.x,O.y].join(","));F=O;E=K}for(z.push("L");D0;);Ua.clear(true);$.each(l.childNodes,function(k,w){k&&w.nodeType===8&&w.data.indexOf("Created with")>= -0&&l.insertBefore(w,l.firstChild)});if(I){cc();Sb([I])}var g=[];$(l).find("g:data(gsvg)").each(function(){for(var k=this.attributes,w=k.length,v=0;v=0;C--){A=z.item(C);D=w(A.nodeValue);if(!(M.indexOf(A.localName)>=0))if(D!="")if(D.indexOf("pointer-events")!==0)if(!(A.localName==="class"&& -D.indexOf("se_")===0)){k.push(" ");if(A.localName==="d")D=Ua.convertPath(g,true);if(isNaN(D)){if(G.test(D))D=svgedit.units.shortFloat(D)+v}else D=svgedit.units.shortFloat(D);if(bb.apply&&g.nodeName==="image"&&A.localName==="href"&&bb.images&&bb.images==="embed"){var K=Ka[D];if(K)D=K}if(!A.namespaceURI||A.namespaceURI==c||Ga[A.namespaceURI]){k.push(A.nodeName);k.push('="');k.push(D);k.push('"')}}}}if(g.hasChildNodes()){k.push(">");h++;z=false;for(C=0;C");break;case 8:k.push("\n");k.push(Array(h+1).join(" "));k.push("