diff --git a/Makefile b/Makefile index 4101c69..187cd32 100644 --- a/Makefile +++ b/Makefile @@ -32,6 +32,10 @@ JS_FILES=\ jquery-ui/jquery-ui-1.8.17.custom.min.js \ jgraduate/jpicker.min.js \ mousewheel.js \ + extensions/ext-eyedropper.js \ + extensions/ext-markers.js \ + extensions/ext-grid.js \ + extensions/ext-imagelib.js \ CSS_FILES=\ fonts.css \ diff --git a/editor/extensions/ext-eyedropper.js b/editor/extensions/ext-eyedropper.js index 2108b7b..12a39b3 100644 --- a/editor/extensions/ext-eyedropper.js +++ b/editor/extensions/ext-eyedropper.js @@ -25,7 +25,7 @@ svgEditor.addExtension("eyedropper", function(S) { strokeWidth: 5, strokeDashArray: null, opacity: 1.0, strokeLinecap: 'butt', - strokeLinejoin: 'miter', + strokeLinejoin: 'miter' }; function getStyle(opts) { // if we are in eyedropper mode, we don't want to disable the eye-dropper tool @@ -86,7 +86,7 @@ svgEditor.addExtension("eyedropper", function(S) { type: "mode", title: "Eye Dropper Tool", key: "I", - class: "disabled", + "class": "disabled", events: { "click": function() { svgCanvas.setMode("eyedropper"); @@ -140,6 +140,6 @@ svgEditor.addExtension("eyedropper", function(S) { addToHistory(batchCmd); } } - }, + } }; }); diff --git a/editor/extensions/ext-markers.js b/editor/extensions/ext-markers.js index 48d0c41..d304ab0 100644 --- a/editor/extensions/ext-markers.js +++ b/editor/extensions/ext-markers.js @@ -69,7 +69,7 @@ svgEditor.addExtension("Markers", function(S) { triangle: {element:'path', attr:{d:'M10,80 L50,20 L80,80 Z'}}, mcircle: - {element:'circle', attr:{r:30, cx:50, cy:50}}, + {element:'circle', attr:{r:30, cx:50, cy:50}} } @@ -95,7 +95,7 @@ svgEditor.addExtension("Markers", function(S) { {id: "box_o", title: "Open Box" }, {id: "star_o", title: "Open Star" }, {id: "triangle_o", title: "Open Triangle" }, - {id: "mcircle_o", title: "Open Circle" }, + {id: "mcircle_o", title: "Open Circle" } ] }; diff --git a/editor/svgedit.compiled.js b/editor/svgedit.compiled.js index 2698f5d..a96bb88 100644 --- a/editor/svgedit.compiled.js +++ b/editor/svgedit.compiled.js @@ -1,110 +1,110 @@ -(function(a){function n(f){if(typeof f.data==="string"){var c=f.handler,m=f.data.toLowerCase().split(" ");f.handler=function(o){if(!(this!==o.target&&(/textarea|select/i.test(o.target.nodeName)||o.target.type==="text"))){var b=o.type!=="keypress"&&a.hotkeys.specialKeys[o.which],d=String.fromCharCode(o.which).toLowerCase(),e="",l={};if(o.altKey&&b!=="alt")e+="alt+";if(o.ctrlKey&&b!=="ctrl")e+="ctrl+";if(o.metaKey&&!o.ctrlKey&&b!=="meta")e+="meta+";if(o.shiftKey&&b!=="shift")e+="shift+";if(b)l[e+b]= +(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:n}})})(jQuery);(function(a,n){function f(ca){return typeof ca==="string"}function c(ca){var T=e.call(arguments,1);return function(){return ca.apply(this,T.concat(e.call(arguments)))}}function m(ca,T,V,sa,ta){var aa;if(sa!==d){T=V.match(ca?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);V=T[3]||"";if(ta===2&&f(sa))sa=sa.replace(ca?ga:ea,"");else{aa=q(T[2]);sa=f(sa)?q[ca?ha:Q](sa):sa;sa=ta===2?sa:ta===1?a.extend({},sa,aa):a.extend({},aa,sa);sa=u(sa);if(ca)sa=sa.replace(ra,l)}ca=T[1]+(ca?"#":sa||!T[1]?"?":"")+sa+V}else ca= -T(V!==d?V:n[ua][ia]);return ca}function o(ca,T,V){if(T===d||typeof T==="boolean"){V=T;T=u[ca?ha:Q]()}else T=f(T)?T.replace(ca?ga:ea,""):T;return q(T,V)}function b(ca,T,V,sa){if(!f(V)&&typeof V!=="object"){sa=V;V=T;T=d}return this.each(function(){var ta=a(this),aa=T||fa()[(this.nodeName||"").toLowerCase()]||"",ma=aa&&ta.attr(aa)||"";ta.attr(aa,u[ca](ma,V,sa))})}var d,e=Array.prototype.slice,l=decodeURIComponent,u=a.param,w,q,M,U=a.bbq=a.bbq||{},P,K,fa,W=a.event.special,Q="querystring",ha="fragment", -ua="location",ia="href",ea=/^.*\?|#.*$/g,ga=/^.*\#/,ra,qa={};u[Q]=c(m,0,function(ca){return ca.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")});u[ha]=w=c(m,1,function(ca){return ca.replace(/^[^#]*#?(.*)$/,"$1")});w.noEscape=function(ca){ca=ca||"";ca=a.map(ca.split(""),encodeURIComponent);ra=RegExp(ca.join("|"),"g")};w.noEscape(",/");a.deparam=q=function(ca,T){var V={},sa={"true":true,"false":false,"null":null};a.each(ca.replace(/\+/g," ").split("&"),function(ta,aa){var ma=aa.split("="),Ga=l(ma[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(ma.length===2){ma=l(ma[1]);if(T)ma=ma&&!isNaN(ma)?+ma:ma==="undefined"?d:sa[ma]!==d?sa[ma]:ma;if(Va)for(;Ra<=Va;Ra++){Ga=Qa[Ra]===""?Ma.length:Qa[Ra];Ma=Ma[Ga]=Ra').hide().insertAfter("body")[0].contentWindow; -K=function(){return c(U.document[b][d])};P=function(fa,W){if(fa!==W){var Q=U.document;Q.open().close();Q[b].hash="#"+fa}};P(c())}}var q={},M,U,P,K;q.start=function(){if(!M){var fa=c();P||w();(function W(){var Q=c(),ha=K(fa);if(Q!==fa){P(fa=Q,ha);a(n).trigger("hashchange")}else if(ha!==fa)n[b][d]=n[b][d].replace(/#.*/,"")+"#"+ha;M=setTimeout(W,a.hashchangeDelay)})()}};q.stop=function(){if(!U){M&&clearTimeout(M);M=0}};return q}()})(jQuery,this);(function(a){var n={},f;a.svgIcons=function(c,m){function o(ca,T){if(ca!=="ajax"){if(fa)return;var V=(U=ia[0].contentDocument)&&U.getElementById("svg_eof");if(!V&&!(T&&V)){W++;if(W<50)setTimeout(o,20);else{d();fa=true}return}fa=true}M=a(U.firstChild).children();if(m.no_img)setTimeout(function(){K||b()},500);else{V=ua+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNzUiIGhlaWdodD0iMjc1Ij48L3N2Zz4%3D";P=a(new Image).attr({src:V,width:0,height:0}).appendTo("body").load(function(){b(true)}).error(function(){b()})}} -function b(ca,T){if(!K){if(m.no_img)ca=false;if(ca){var V=a(document.createElement("div"));V.hide().appendTo("body")}if(T){var sa=m.fallback_path?m.fallback_path:"";a.each(T,function(Va,Xa){a("#"+Va);var Na=a(new Image).attr({"class":"svg_icon",src:sa+Xa,width:w,height:q,alt:"icon"});qa(Na,Va)})}else for(var ta=M.length,aa=0;aa0&&!ca)Ha=f(Ha,Na,true);ra(a(this),Ha,Xa)})});if(!T){ca&&V.remove();ia&&ia.remove();P&&P.remove()}m.resize&&a.resizeSvgIcons(m.resize);K=true;m.callback&&m.callback(n)}}function d(){if(c.indexOf(".svgz")!=-1){var ca=c.replace(".svgz",".svg");window.console&&console.log(".svgz failed, trying with .svg");a.svgIcons(ca,m)}else m.fallback&&b(false,m.fallback)} -function e(ca){if(window.btoa)return window.btoa(ca);var T=Array(Math.floor((ca.length+2)/3)*4),V,sa,ta,aa,ma,Ga,Ma=0,Ra=0;do{V=ca.charCodeAt(Ma++);sa=ca.charCodeAt(Ma++);ta=ca.charCodeAt(Ma++);aa=V>>2;V=(V&3)<<4|sa>>4;ma=(sa&15)<<2|ta>>6;Ga=ta&63;if(isNaN(sa))ma=Ga=64;else if(isNaN(ta))Ga=64;T[Ra++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(aa);T[Ra++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(V);T[Ra++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(ma); -T[Ra++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Ga)}while(Ma-1&&Q.indexOf("Chrome/");var ua="data:image/svg+xml;charset=utf-8;base64,";if(m.svgz){var ia=a('').appendTo("body").hide();try{U=ia[0].contentDocument;ia.load(o); -o(0,true)}catch(ea){d()}}else{var ga=new DOMParser;a.ajax({url:c,dataType:"string",success:function(ca){if(ca){U=ga.parseFromString(ca,"text/xml");a(function(){o("ajax")})}else a(d)},error:function(ca){if(window.opera)a(function(){d()});else if(ca.responseText){U=ga.parseFromString(ca.responseText,"text/xml");U.childNodes.length||a(d);a(function(){o("ajax")})}else a(d)}})}var ra=function(ca,T,V,sa){ha&&T.css("visibility","hidden");if(m.replace){sa&&T.attr("id",V);(V=ca.attr("class"))&&T.attr("class", -"svg_icon "+V);ca.replaceWith(T)}else ca.append(T);ha&&setTimeout(function(){T.removeAttr("style")},1)},qa=function(ca,T){if(m.id_match===undefined||m.id_match!==false)ra(holder,ca,T,true);n[T]=ca};f=function(ca,T){var V=ca.find("defs");if(!V.length)return ca;V=ha?V.find("*").filter(function(){return!!this.id}):V.find("[id]");var sa=ca[0].getElementsByTagName("*"),ta=sa.length;V.each(function(aa){var ma=this.id;a(U).find("#"+ma);this.id=aa="x"+ma+T+aa;ma="url(#"+ma+")";var Ga="url(#"+aa+")";for(aa= -0;aa","/":"?","\\":"|"}};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=0;jQuery.fn.jGraduate=function(c){var m= -arguments;return this.each(function(){function o(na,ba,va,O,H){var Z=H||a("stop",{"stop-color":ba,"stop-opacity":va,offset:na},ga);if(H){ba=H.getAttribute("stop-color");va=H.getAttribute("stop-opacity");na=H.getAttribute("offset")}else ga.appendChild(Z);if(va===null)va=1;H=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+na*ha)+", 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:ba,"fill-opacity":va,transform:"translate("+(10+na*ha)+", 26)",stroke:"#000","stroke-width":1.5},Ja);$(Oa).mousedown(function(Za){b(this);$a=tb;fa.mousemove(l).mouseup(d);Da=Jb.offset();Za.preventDefault();return false}).data("stop",Z).data("bg",H).dblclick(function(){$("div.jGraduate_LightBox").show();for(var Za=this,fb=+Z.getAttribute("stop-opacity")|| -1,wb=Z.getAttribute("stop-color")||1,xb=(parseFloat(fb)*255).toString(16);xb.length<2;)xb="0"+xb;ba=wb.substr(1)+xb;$("#"+q+"_jGraduate_stopPicker").css({left:100,bottom:15}).jPicker({window:{title:"Pick the start color and opacity for the gradient"},images:{clientPath:w.images.clientPath},color:{active:ba,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);Z.setAttribute("stop-color", -wb);Z.setAttribute("stop-opacity",fb);$("div.jGraduate_LightBox").hide();$("#"+q+"_jGraduate_stopPicker").hide()},null,function(){$("div.jGraduate_LightBox").hide();$("#"+q+"_jGraduate_stopPicker").hide()})});$(ga).find("stop").each(function(){var Za=$(this);if(+this.getAttribute("offset")>na){if(!ba){var fb=this.getAttribute("stop-color"),wb=this.getAttribute("stop-opacity");Z.setAttribute("stop-color",fb);Oa.setAttribute("fill",fb);Z.setAttribute("stop-opacity",wb===null?1:wb);Oa.setAttribute("fill-opacity", -wb===null?1:wb)}Za.before(Z);return false}});O&&b(Oa);return Z}function b(na){tb&&tb.setAttribute("stroke","#000");na.setAttribute("stroke","blue");tb=na;tb.parentNode.appendChild(tb)}function d(){fa.unbind("mousemove",l);if(Ka.getAttribute("display")!=="none"){Ka.setAttribute("display","none");var na=$(tb),ba=na.data("stop");na=na.data("bg");$([tb,ba,na]).remove()}$a=null}function e(){var na=Sa?"rotate("+Sa+","+gb+","+Ia+") ":"";yb===1&&bb===1?ga.removeAttribute("gradientTransform"):ga.setAttribute("gradientTransform", -na+"translate("+-gb*(yb-1)+","+-Ia*(bb-1)+") scale("+yb+","+bb+")")}function l(na){var ba=na.pageX-Da.left;na=na.pageY-Da.top;ba=ba<10?10:ba>ha+10?ha+10:ba;var va="translate("+ba+", 26)";if(na<-60||na>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",(ba-10)/ha);var O=0;$(ga).find("stop").each(function(){var H=this.getAttribute("offset"), -Z=$(this);if(H
  • Solid Color
  • Linear Gradient
  • Radial Gradient
  • ');var W=$(M+"> .jGraduate_colPick"),Q=$(M+"> .jGraduate_gradPick");Q.html('

    '+w.window.pickerTitle+'


    ');var ha=256,ua=ha-0,ia=ha-0,ea,ga,ra,qa={};$(".jGraduate_SliderBar").width(145);var ca=$("#"+q+"_jGraduate_GradContainer")[0],T=a("svg",{id:q+"_jgraduate_svg",width:ha,height:ha,xmlns:n.svg},ca);ea=ea||u.paint.type;var V=ga=u.paint[ea],sa=u.paint.alpha,ta=ea==="solidColor";switch(ea){case "solidColor":case "linearGradient":if(!ta){ga.id=q+"_lg_jgraduate_grad"; -V=ga=T.appendChild(ga)}a("radialGradient",{id:q+"_rg_jgraduate_grad"},T);if(ea==="linearGradient")break;case "radialGradient":if(!ta){ga.id=q+"_rg_jgraduate_grad";V=ga=T.appendChild(ga)}a("linearGradient",{id:q+"_lg_jgraduate_grad"},T)}if(ta){V=ga=$("#"+q+"_lg_jgraduate_grad")[0];K=u.paint[ea];o(0,"#"+K,1);var aa=typeof w.newstop;if(aa==="string")switch(w.newstop){case "same":o(1,"#"+K,1);break;case "inverse":aa="";for(var ma=0;ma<6;ma+=2){K.substr(ma,2);var Ga=(255-parseInt(K.substr(ma,2),16)).toString(16); -if(Ga.length<2)Ga=0+Ga;aa+=Ga}o(1,"#"+aa,1);break;case "white":o(1,"#ffffff",1);break;case "black":o(1,"#000000",1)}else if(aa==="object")o(1,w.newstop.color||"#"+K,"opac"in w.newstop?w.newstop.opac:1)}K=parseFloat(V.getAttribute("x1")||0);aa=parseFloat(V.getAttribute("y1")||0);ma=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);ra=a("rect",{id:q+"_jgraduate_rect",x:0,y:0,width:ua,height:ia,fill:"url(#"+q+"_jgraduate_grad)","fill-opacity":sa/100},T);var Xa=$("
    ").attr({"class":"grad_coord jGraduate_lg_field",title:"Begin Stop"}).text(1).css({top:aa*ha,left:K*ha}).data("coord","start").appendTo(ca),Na=Xa.clone().text(2).css({top:Ga*ha,left:ma*ha}).attr("title","End stop").data("coord","end").appendTo(ca),Ha=$("
    ").attr({"class":"grad_coord jGraduate_rg_field",title:"Center stop"}).text("C").css({top:Ra*ha,left:Ma* -ha}).data("coord","center").appendTo(ca),Pa=Ha.clone().text("F").css({top:Va*ha,left:Qa*ha,display:"none"}).attr("title","Focus point").data("coord","focus").appendTo(ca);Pa[0].id=q+"_jGraduate_focusCoord";$(M+" .grad_coord");$.each(["x1","y1","x2","y2","cx","cy","fx","fy"],function(na,ba){var va=ga.getAttribute(ba),O=isNaN(ba[1]);va||(va=O?"0.5":ba==="x2"?"1.0":"0.0");qa[ba]=$("#"+q+"_jGraduate_"+ba).val(va).change(function(){if(isNaN(parseFloat(this.value))||this.value<0)this.value=0;else if(this.value> -1)this.value=1;if(!(ba[0]==="f"&&!jb))if(O&&ea==="radialGradient"||!O&&ea==="linearGradient")ga.setAttribute(ba,this.value);var H=O?ba[0]==="c"?Ha:Pa:ba[1]==="1"?Xa:Na,Z=ba.indexOf("x")>=0?"left":"top";H.css(Z,this.value*ha)}).change()});var zb,Ja,Jb=$("#"+q+"_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]);ca=a("pattern",{width:16, -height:16,patternUnits:"userSpaceOnUse",id:"jGraduate_trans"},ab);a("image",{width:16,height:16},ca).setAttributeNS(n.xlink,"xlink:href",w.images.clientPath+"map-opacity.png");$(ab).click(function(na){Da=Jb.offset();if(na.target.tagName!=="path"){var ba=na.pageX-Da.left-8;ba=ba<10?10:ba>ha+10?ha+10:ba;o(ba/ha,0,0,true);na.stopPropagation()}});$(ab).mouseover(function(){ab.appendChild(Ka)});Ja=a("g",{},ab);a("line",{x1:10,y1:15,x2:ha+10,y2:15,"stroke-width":2,stroke:"#000"},ab);var rb=Q.find(".jGraduate_spreadMethod").change(function(){ga.setAttribute("spreadMethod", -$(this).val())}),sb=null,mb=function(na){var ba=na.pageX-Wa.left,va=na.pageY-Wa.top;ba=ba<0?0:ba>ha?ha:ba;va=va<0?0:va>ha?ha:va;sb.css("left",ba).css("top",va);ba/=ua;va/=ia;var O=sb.data("coord"),H=ga;switch(O){case "start":qa.x1.val(ba);qa.y1.val(va);H.setAttribute("x1",ba);H.setAttribute("y1",va);break;case "end":qa.x2.val(ba);qa.y2.val(va);H.setAttribute("x2",ba);H.setAttribute("y2",va);break;case "center":qa.cx.val(ba);qa.cy.val(va);H.setAttribute("cx",ba);H.setAttribute("cy",va);gb=ba;Ia=va; -e();break;case "focus":qa.fx.val(ba);qa.fy.val(va);H.setAttribute("fx",ba);H.setAttribute("fy",va);e()}na.preventDefault()},hb=function(){sb=null;fa.unbind("mousemove",mb).unbind("mouseup",hb)};zb=ga.getElementsByTagNameNS(n.svg,"stop");if(La<2){for(;La<2;){ga.appendChild(document.createElementNS(n.svg,"stop"));++La}zb=ga.getElementsByTagNameNS(n.svg,"stop")}var La=zb.length;for(ma=0;ma99.5)O=99.5;if(O>0)bb=1-O/100;else yb=-(O/100)-1;H=145*((O+100)/2)/100;Z&&e();break;case "angle":Sa=O;H=Sa/180;H+=0.5;H*=145;Z&&e()}if(H>145)H= -145;else if(H<0)H=0;va.css({"margin-left":H-5})}).change()});var Gb=function(na){var ba=na.pageX-nb.offset.left-parseInt(nb.parent.css("border-left-width"));if(ba>145)ba=145;if(ba<=0)ba=0;var va=ba-5;ba/=145;switch(nb.type){case "radius":ba=Math.pow(ba*2,2.5);if(ba>0.98&&ba<1.02)ba=1;if(ba<=0.01)ba=0.01;ga.setAttribute("r",ba);break;case "opacity":u.paint.alpha=parseInt(ba*100);ra.setAttribute("fill-opacity",ba);break;case "ellip":bb=yb=1;if(ba<0.5){ba/=0.5;yb=ba<=0?0.01:ba}else if(ba>0.5){ba/=0.5; -ba=2-ba;bb=ba<=0?0.01:ba}e();ba-=1;if(bb===ba+1)ba=Math.abs(ba);break;case "angle":ba-=0.5;Sa=ba*=180;e();ba/=100}nb.elem.css({"margin-left":va});ba=Math.round(ba*100);nb.input.val(ba);na.preventDefault()},Ob=function(){fa.unbind("mousemove",Gb).unbind("mouseup",Ob);nb=null};for(Q=(u.paint.alpha*255/100).toString(16);Q.length<2;)Q="0"+Q;Q=Q.split(".")[0];K=u.paint.solidColor=="none"?"":u.paint.solidColor+Q;ta||(K=zb[0].getAttribute("stop-color"));$.extend($.fn.jPicker.defaults.window,{alphaSupport:true, -effects:{type:"show",speed:0}});W.jPicker({window:{title:w.window.pickerTitle},images:{clientPath:w.images.clientPath},color:{active:K,alphaSupport:true}},function(na){u.paint.type="solidColor";u.paint.alpha=na.val("ahex")?Math.round(na.val("a")/255*100):100;u.paint.solidColor=na.val("hex")?na.val("hex"):"none";u.paint.radialGradient=null;U()},null,function(){P()});var Kb=$(M+" .jGraduate_tabs li");Kb.click(function(){Kb.removeClass("jGraduate_tab_current");$(this).addClass("jGraduate_tab_current"); -$(M+" > div").hide();var na=$(this).attr("data-type");$(M+" .jGraduate_gradPick").show();if(na==="rg"||na==="lg"){$(".jGraduate_"+na+"_field").show();$(".jGraduate_"+(na==="lg"?"rg":"lg")+"_field").hide();$("#"+q+"_jgraduate_rect")[0].setAttribute("fill","url(#"+q+"_"+na+"_jgraduate_grad)");ea=na==="lg"?"linearGradient":"radialGradient";$("#"+q+"_jGraduate_OpacInput").val(u.paint.alpha).change();var ba=$("#"+q+"_"+na+"_jgraduate_grad")[0];if(ga!==ba){var va=$(ga).find("stop");$(ba).empty().append(va); -ga=ba;ba=rb.val();ga.setAttribute("spreadMethod",ba)}jb=na==="rg"&&ga.getAttribute("fx")!=null&&!(Ma==Qa&&Ra==Va);$("#"+q+"_jGraduate_focusCoord").toggle(jb);if(jb)$("#"+q+"_jGraduate_match_ctr")[0].checked=false}else{$(M+" .jGraduate_gradPick").hide();$(M+" .jGraduate_colPick").show()}});$(M+" > div").hide();Kb.removeClass("jGraduate_tab_current");var Ub;switch(u.paint.type){case "linearGradient":Ub=$(M+" .jGraduate_tab_lingrad");break;case "radialGradient":Ub=$(M+" .jGraduate_tab_radgrad");break; -default:Ub=$(M+" .jGraduate_tab_color")}u.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 n(f,c){for(var m=f[c],o=document.body;(f=f.offsetParent)&&f!=o;)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? +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? 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 o=svgEditor.tool_scale||1,b=$(f).height()/2;c=c>n(f,"offsetLeft")+f.offsetWidth*o-this.spinCfg._btn_width?mo(f,"offsetLeft")+f.offsetWidth*p-this.spinCfg._btn_width?m=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 n=a.changedTouches,f=n[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(n.length<2){f.target.dispatchEvent(m);a.preventDefault()}};jQuery&&function(){var a=$(window),n=$(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),o=$(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 u=e.pageX,w=e.pageY;e=a.width()-b.width();var q=a.height()-b.height();if(u>e-15)u=e-15;if(w>q-30)w=q-30;n.unbind("click");b.css({top:w,left:u}).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")});n.keypress(function(M){switch(M.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:n.trigger("click")}});b.find("A").unbind("mouseup");b.find("LI:not(.disabled) A").mouseup(function(){n.unbind("click").unbind("keypress"); -$(".contextMenu").hide();c&&c($(this).attr("href").substr(1),$(l),{x:u-o.left,y:w-o.top,docX:u,docY:w});return false});setTimeout(function(){n.click(function(){n.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(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 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"); +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,o=n.indexOf("Gecko/")>=0,b=n.indexOf("MSIE")>=0,d=n.indexOf("Chrome/")>=0,e=n.indexOf("Windows")>=0,l=n.indexOf("Macintosh")>= -0,u="ontouchstart"in window,w=!!f.querySelector,q=!!document.evaluate,M=function(){var ua=document.createElementNS("http://www.w3.org/2000/svg","path");ua.setAttribute("d","M0,0 10,10");var ia=ua.pathSegList;ua=ua.createSVGPathSegLinetoAbs(5,5);try{ia.replaceItem(ua,0);return true}catch(ea){}return false}(),U=function(){var ua=document.createElementNS("http://www.w3.org/2000/svg","path");ua.setAttribute("d","M0,0 10,10");var ia=ua.pathSegList;ua=ua.createSVGPathSegLinetoAbs(5,5);try{ia.insertItemBefore(ua, -0);return true}catch(ea){}return false}(),P=function(){var ua=document.createElementNS("http://www.w3.org/2000/svg","svg"),ia=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(ua);ia.setAttribute("x",5);ua.appendChild(ia);var ea=document.createElementNS("http://www.w3.org/2000/svg","text");ea.textContent="a";ia.appendChild(ea);ia=ea.getStartPositionOfChar(0).x;document.documentElement.removeChild(ua);return ia===0}(),K=function(){var ua=document.createElementNS("http://www.w3.org/2000/svg", -"svg");document.documentElement.appendChild(ua);var ia=document.createElementNS("http://www.w3.org/2000/svg","path");ia.setAttribute("d","M0,0 C0,0 10,10 10,0");ua.appendChild(ia);ia=ia.getBBox();document.documentElement.removeChild(ua);return ia.height>4&&ia.height<5}(),fa=function(){var ua=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(ua);var ia=document.createElementNS("http://www.w3.org/2000/svg","path");ia.setAttribute("d","M0,0 10,0");var ea= -document.createElementNS("http://www.w3.org/2000/svg","path");ea.setAttribute("d","M5,0 15,0");var ga=document.createElementNS("http://www.w3.org/2000/svg","g");ga.appendChild(ia);ga.appendChild(ea);ua.appendChild(ga);ia=ga.getBBox();document.documentElement.removeChild(ua);return ia.width==15}(),W=function(){var ua=document.createElementNS("http://www.w3.org/2000/svg","rect");ua.setAttribute("x",0.1);(ua=ua.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 ua}(),Q=function(){var ua=document.createElementNS("http://www.w3.org/2000/svg","rect");ua.setAttribute("style","vector-effect:non-scaling-stroke");return ua.style.vectorEffect==="non-scaling-stroke"}(),ha=function(){var ua=document.createElementNS("http://www.w3.org/2000/svg","rect").transform.baseVal,ia=f.createSVGTransform();ua.appendItem(ia);return ua.getItem(0)==ia}();svgedit.browser.isOpera=function(){return c};svgedit.browser.isWebkit=function(){return m};svgedit.browser.isGecko=function(){return o}; -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 u};svgedit.browser.supportsSelectors=function(){return w};svgedit.browser.supportsXpath=function(){return q};svgedit.browser.supportsPathReplaceItem=function(){return M};svgedit.browser.supportsPathInsertItemBefore=function(){return U};svgedit.browser.supportsPathBBox=function(){return K}; -svgedit.browser.supportsHVLineContainerBBox=function(){return fa};svgedit.browser.supportsGoodTextCharPos=function(){return P};svgedit.browser.supportsEditableText=function(){return c};svgedit.browser.supportsGoodDecimals=function(){return W};svgedit.browser.supportsNonScalingStroke=function(){return Q};svgedit.browser.supportsNativeTransformLists=function(){return ha}}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"),n={};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 o=null;if(m>=0)if(m=0){this._removeFromOtherLists(c);o=this._xforms[m]=c;this._list._update()}return o};this.removeItem=function(c){if(c=0){for(var m=this._xforms[c],o=Array(this.numberOfItems- -1),b=0;b1;)c=n[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(n){if(!n)return false;for(var f=n.numberOfItems;f--;){var c=n.getItem(f);if(c.type==1&&!svgedit.math.isIdentity(c.matrix))return true}return false};svgedit.math.transformBox=function(n,f,c,m,o){var b={x:n,y:f},d={x:n+c,y:f};c={x:n+c,y:f+m};n={x:n,y:f+m};f=svgedit.math.transformPoint;b=f(b.x,b.y,o);var e=m=b.x,l=b.y,u=b.y;d=f(d.x,d.y,o);m=Math.min(m,d.x);e=Math.max(e,d.x); -l=Math.min(l,d.y);u=Math.max(u,d.y);n=f(n.x,n.y,o);m=Math.min(m,n.x);e=Math.max(e,n.x);l=Math.min(l,n.y);u=Math.max(u,n.y);c=f(c.x,c.y,o);m=Math.min(m,c.x);e=Math.max(e,c.x);l=Math.min(l,c.y);u=Math.max(u,c.y);return{tl:b,tr:d,bl:n,br:c,aabox:{x:m,y:l,width:e-m,height:u-l}}};svgedit.math.transformListToTransform=function(n,f,c){if(n==null)return a.createSVGTransformFromMatrix(a.createSVGMatrix());f=f==undefined?0:f;c=c==undefined?n.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 o=f>=0&&fn.x&&f.yn.y}})();svgedit=svgedit||{}; -(function(){if(!svgedit.units)svgedit.units={};var a=["x","x1","cx","rx","width"],n=["y","y1","cy","ry","height"],f=$.merge(["r","radius"],a);$.merge(f,n);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); +(function(){if(!svgedit.browser)svgedit.browser={};var a=!!document.createElementNS&&!!document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect;svgedit.browser.supportsSvg=function(){return a};if(svgedit.browser.supportsSvg()){var o=navigator.userAgent,f=document.createElementNS("http://www.w3.org/2000/svg","svg"),c=!!window.opera,m=o.indexOf("AppleWebKit")>=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;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&&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 o={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=o[d])for(var l=d.length,u=0;u=0?e*l:n.indexOf(b)>=0?e*u:e*Math.sqrt(l*l+u*u)/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(q){if(!l)if(RegExp("^-?[\\d\\.]+"+q+"$").test(d))l=true})}else l=true;else if(b=="id"){b=false;try{var u=c.getElement(d); -b=u==null||u===e}catch(w){}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 u=$(e).children().clone().attr("visibility","hidden");$(o).append(u);l=u.filter("line, path")}else l=$(b).find("line, path");var w=false;if(l.length){l.each(function(){var q=this.getBBox();if(!q.width||!q.height)w=true});if(w){b=e?u:$(b).children();ret=getStrokedBBox(b)}else ret=b.getBBox()}else ret=b.getBBox();e&&u.remove();return ret}if(!svgedit.utilities)svgedit.utilities= -{};var n="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use".split(","),f=null,c=null,m=null,o=null;svgedit.utilities.init=function(b){f=b;c=b.getDOMDocument();m=b.getDOMContainer();o=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,u,w,q,M,U=0,P=0;do{e=b.charCodeAt(U++);l=b.charCodeAt(U++);u=b.charCodeAt(U++);w=e>>2;e=(e&3)<<4|l>>4;q=(l&15)<<2|u>>6;M=u&63;if(isNaN(l))q=M=64;else if(isNaN(u))M=64;d[P++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(w);d[P++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(e);d[P++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(q);d[P++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(M)}while(U< -b.length);return d.join("")};svgedit.utilities.decode64=function(b){if(window.atob)return window.atob(b);var d="",e,l,u="",w,q="",M=0;b=b.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(M++));l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(M++));w="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(M++));q="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(M++)); -e=e<<2|l>>4;l=(l&15)<<4|w>>2;u=(w&3)<<6|q;d+=String.fromCharCode(e);if(w!=64)d+=String.fromCharCode(l);if(q!=64)d+=String.fromCharCode(u)}while(M127)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(u){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)}}; +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)}}; 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), -u=[l.x,l.y];for(l=0;l= -0){var l=e.split(":");b[l[1]]=n[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 o=m.parentNode;if(m.ownerDocument&&o){var b=f[m.nodeName],d=c[m.nodeName];if(b!=undefined){for(var e=[],l=m.attributes.length;l--;){var u=m.attributes.item(l),w=u.nodeName, -q=u.localName,M=u.namespaceURI;if(!(d.hasOwnProperty(q)&&M==d[q]&&M!="http://www.w3.org/2000/xmlns/")&&!(M=="http://www.w3.org/2000/xmlns/"&&a[u.nodeValue])){w.indexOf("se:")==0&&e.push([w,u.nodeValue]);m.removeAttributeNS(M,q)}if(svgedit.browser.isGecko())switch(w){case "transform":case "gradientTransform":case "patternTransform":q=u.nodeValue.replace(/(\d)-/g,"$1 -");m.setAttribute(w,q)}if(w=="style"){u=u.nodeValue.split(";");for(w=u.length;w--;){q=u[w].split(":");b.indexOf(q[0])>=0&&m.setAttribute(q[0], -q[1])}m.removeAttribute("style")}}$.each(e,function(U,P){m.setAttributeNS("http://svg-edit.googlecode.com",P[0],P[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))o.removeChild(m);else{$.each(["clip-path","fill","filter","marker-end","marker-mid","marker-start", -"mask","stroke"],function(U,P){var K=m.getAttribute(P);if(K)if((K=svgedit.utilities.getUrlFromAttr(K))&&K[0]!=="#"){m.setAttribute(P,"");m.removeAttribute(P)}});for(l=m.childNodes.length;l--;)svgedit.sanitize.sanitizeSvg(m.childNodes.item(l))}}else{for(b=[];m.hasChildNodes();)b.push(o.insertBefore(m.firstChild,m));o.removeChild(m);for(l=b.length;l--;)svgedit.sanitize.sanitizeSvg(b[l])}}}}})();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,n,f,c){this.elem=a;this.text=c?"Move "+a.tagName+" to "+c:"Move "+a.tagName;this.oldNextSibling=n;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= +"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(m,p){var b={};$.each(p,function(d,e){if(e.indexOf(":")>= +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||{}; +(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,n){this.elem=a;this.text=n||"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= +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= svgedit.history.InsertElementCommand.type;svgedit.history.InsertElementCommand.prototype.getText=function(){return this.text};svgedit.history.InsertElementCommand.prototype.apply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APPLY,this);this.elem=this.parent.insertBefore(this.elem,this.nextSibling);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_APPLY,this)};svgedit.history.InsertElementCommand.prototype.unapply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_UNAPPLY, -this);this.parent=this.elem.parentNode;this.elem=this.elem.parentNode.removeChild(this.elem);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_UNAPPLY,this)};svgedit.history.InsertElementCommand.prototype.elements=function(){return[this.elem]};svgedit.history.RemoveElementCommand=function(a,n,f,c){this.elem=a;this.text=c||"Delete "+a.tagName;this.nextSibling=n;this.parent=f;svgedit.transformlist.removeElementFromListMap(a)};svgedit.history.RemoveElementCommand.type=function(){return"svgedit.history.RemoveElementCommand"}; +this);this.parent=this.elem.parentNode;this.elem=this.elem.parentNode.removeChild(this.elem);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_UNAPPLY,this)};svgedit.history.InsertElementCommand.prototype.elements=function(){return[this.elem]};svgedit.history.RemoveElementCommand=function(a,o,f,c){this.elem=a;this.text=c||"Delete "+a.tagName;this.nextSibling=o;this.parent=f;svgedit.transformlist.removeElementFromListMap(a)};svgedit.history.RemoveElementCommand.type=function(){return"svgedit.history.RemoveElementCommand"}; svgedit.history.RemoveElementCommand.prototype.type=svgedit.history.RemoveElementCommand.type;svgedit.history.RemoveElementCommand.prototype.getText=function(){return this.text};svgedit.history.RemoveElementCommand.prototype.apply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APPLY,this);svgedit.transformlist.removeElementFromListMap(this.elem);this.parent=this.elem.parentNode;this.elem=this.parent.removeChild(this.elem);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_APPLY, this)};svgedit.history.RemoveElementCommand.prototype.unapply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_UNAPPLY,this);svgedit.transformlist.removeElementFromListMap(this.elem);this.nextSibling==null&&window.console&&console.log("Error: reference element was lost");this.parent.insertBefore(this.elem,this.nextSibling);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_UNAPPLY,this)};svgedit.history.RemoveElementCommand.prototype.elements=function(){return[this.elem]}; -svgedit.history.ChangeElementCommand=function(a,n,f){this.elem=a;this.text=f?"Change "+a.tagName+" "+f:"Change "+a.tagName;this.newValues={};this.oldValues=n;for(var c in n)this.newValues[c]=c=="#text"?a.textContent:c=="#href"?svgedit.utilities.getHref(a):a.getAttribute(c)};svgedit.history.ChangeElementCommand.type=function(){return"svgedit.history.ChangeElementCommand"};svgedit.history.ChangeElementCommand.prototype.type=svgedit.history.ChangeElementCommand.type;svgedit.history.ChangeElementCommand.prototype.getText= -function(){return this.text};svgedit.history.ChangeElementCommand.prototype.apply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APPLY,this);var n=false,f;for(f in this.newValues){if(this.newValues[f])if(f=="#text")this.elem.textContent=this.newValues[f];else f=="#href"?svgedit.utilities.setHref(this.elem,this.newValues[f]):this.elem.setAttribute(f,this.newValues[f]);else if(f=="#text")this.elem.textContent="";else{this.elem.setAttribute(f,"");this.elem.removeAttribute(f)}if(f== -"transform")n=true}if(!n)if(n=svgedit.utilities.getRotationAngle(this.elem)){f=elem.getBBox();n=["rotate(",n," ",f.x+f.width/2,",",f.y+f.height/2,")"].join("");n!=elem.getAttribute("transform")&&elem.setAttribute("transform",n)}a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_APPLY,this);return true};svgedit.history.ChangeElementCommand.prototype.unapply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_UNAPPLY,this);var n=false,f;for(f in this.oldValues){if(this.oldValues[f])if(f== -"#text")this.elem.textContent=this.oldValues[f];else f=="#href"?svgedit.utilities.setHref(this.elem,this.oldValues[f]):this.elem.setAttribute(f,this.oldValues[f]);else if(f=="#text")this.elem.textContent="";else this.elem.removeAttribute(f);if(f=="transform")n=true}if(!n)if(n=svgedit.utilities.getRotationAngle(this.elem)){f=elem.getBBox();n=["rotate(",n," ",f.x+f.width/2,",",f.y+f.height/2,")"].join("");n!=elem.getAttribute("transform")&&elem.setAttribute("transform",n)}svgedit.transformlist.removeElementFromListMap(this.elem); +svgedit.history.ChangeElementCommand=function(a,o,f){this.elem=a;this.text=f?"Change "+a.tagName+" "+f:"Change "+a.tagName;this.newValues={};this.oldValues=o;for(var c in o)this.newValues[c]=c=="#text"?a.textContent:c=="#href"?svgedit.utilities.getHref(a):a.getAttribute(c)};svgedit.history.ChangeElementCommand.type=function(){return"svgedit.history.ChangeElementCommand"};svgedit.history.ChangeElementCommand.prototype.type=svgedit.history.ChangeElementCommand.type;svgedit.history.ChangeElementCommand.prototype.getText= +function(){return this.text};svgedit.history.ChangeElementCommand.prototype.apply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APPLY,this);var o=false,f;for(f in this.newValues){if(this.newValues[f])if(f=="#text")this.elem.textContent=this.newValues[f];else f=="#href"?svgedit.utilities.setHref(this.elem,this.newValues[f]):this.elem.setAttribute(f,this.newValues[f]);else if(f=="#text")this.elem.textContent="";else{this.elem.setAttribute(f,"");this.elem.removeAttribute(f)}if(f== +"transform")o=true}if(!o)if(o=svgedit.utilities.getRotationAngle(this.elem)){f=elem.getBBox();o=["rotate(",o," ",f.x+f.width/2,",",f.y+f.height/2,")"].join("");o!=elem.getAttribute("transform")&&elem.setAttribute("transform",o)}a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_APPLY,this);return true};svgedit.history.ChangeElementCommand.prototype.unapply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_UNAPPLY,this);var o=false,f;for(f in this.oldValues){if(this.oldValues[f])if(f== +"#text")this.elem.textContent=this.oldValues[f];else f=="#href"?svgedit.utilities.setHref(this.elem,this.oldValues[f]):this.elem.setAttribute(f,this.oldValues[f]);else if(f=="#text")this.elem.textContent="";else this.elem.removeAttribute(f);if(f=="transform")o=true}if(!o)if(o=svgedit.utilities.getRotationAngle(this.elem)){f=elem.getBBox();o=["rotate(",o," ",f.x+f.width/2,",",f.y+f.height/2,")"].join("");o!=elem.getAttribute("transform")&&elem.setAttribute("transform",o)}svgedit.transformlist.removeElementFromListMap(this.elem); a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_UNAPPLY,this);return true};svgedit.history.ChangeElementCommand.prototype.elements=function(){return[this.elem]};svgedit.history.BatchCommand=function(a){this.text=a||"Batch Command";this.stack=[]};svgedit.history.BatchCommand.type=function(){return"svgedit.history.BatchCommand"};svgedit.history.BatchCommand.prototype.type=svgedit.history.BatchCommand.type;svgedit.history.BatchCommand.prototype.getText=function(){return this.text};svgedit.history.BatchCommand.prototype.apply= -function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APPLY,this);for(var n=this.stack.length,f=0;f=0;n--)this.stack[n].unapply(a);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_UNAPPLY, -this)};svgedit.history.BatchCommand.prototype.elements=function(){for(var a=[],n=this.stack.length;n--;)for(var f=this.stack[n].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= +function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APPLY,this);for(var o=this.stack.length,f=0;f=0;o--)this.stack[o].unapply(a);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_UNAPPLY, +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,n){for(var f=++this.undoChangeStackPointer,c=n.length,m=Array(c),o=Array(c);c--;){var b=n[c];if(b!=null){o[c]=b;m[c]=b.getAttribute(a)}}this.undoableChangeStack[f]= -{attrName:a,oldValues:m,elements:o}};svgedit.history.UndoManager.prototype.finishUndoableChange=function(){for(var a=this.undoChangeStackPointer--,n=this.undoableChangeStack[a],f=n.elements.length,c=n.attrName,m=new svgedit.history.BatchCommand("Change "+c);f--;){var o=n.elements[f];if(o!=null){var b={};b[c]=n.oldValues[f];b[c]!=o.getAttribute(c)&&m.addSubCommand(new svgedit.history.ChangeElementCommand(o,b,c))}}this.undoableChangeStack[a]=null;return m}})();svgedit=svgedit||{}; -(function(){if(!svgedit.select)svgedit.select={};var a,n,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 o in f.selectorGrips)m.push(o);for(;c>0;){m.push(m.shift());c--}c=0;for(o in f.selectorGrips){f.selectorGrips[o].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,o=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 u=b.tagName;if(u==="text")l+=2/e;d=svgedit.transformlist.getTransformList(b);d=svgedit.math.transformListToTransform(d).matrix;d.e*=e;d.f*=e;var w=svgedit.utilities.getBBox(b);if(u==="g"&&!$.data(b,"gsvg"))if(u=a.getStrokedBBox(b.childNodes))w=u;u=w.x;var q=w.y,M=w.width;w=w.height;l*=e;e=svgedit.math.transformBox(u*e,q*e,M*e,w*e,d);d=e.aabox;u=d.x-l;q=d.y-l;M=d.width+l*2;var U=d.height+l*2;d=u+M/2;w=q+U/2;if(b=svgedit.utilities.getRotationAngle(b)){u=a.svgRoot().createSVGTransform(); -u.setRotate(-b,d,w);u=u.matrix;e.tl=svgedit.math.transformPoint(e.tl.x,e.tl.y,u);e.tr=svgedit.math.transformPoint(e.tr.x,e.tr.y,u);e.bl=svgedit.math.transformPoint(e.bl.x,e.bl.y,u);e.br=svgedit.math.transformPoint(e.br.x,e.br.y,u);u=e.tl;M=u.x;U=u.y;var P=u.x,K=u.y;u=Math.min;q=Math.max;M=u(M,u(e.tr.x,u(e.bl.x,e.br.x)))-l;U=u(U,u(e.tr.y,u(e.bl.y,e.br.y)))-l;P=q(P,q(e.tr.x,q(e.bl.x,e.br.x)))+l;K=q(K,q(e.tr.y,q(e.bl.y,e.br.y)))+l;u=M;q=U;M=P-M;U=K-U}l=a.svgRoot().suspendRedraw(100);c.setAttribute("d", -"M"+u+","+q+" L"+(u+M)+","+q+" "+(u+M)+","+(q+U)+" "+u+","+(q+U)+"z");this.selectorGroup.setAttribute("transform",b?"rotate("+[b,d,w].join(",")+")":"");u-=3.5;q-=3.5;this.gripCoords={nw:[u,q],ne:[u+M,q],sw:[u,q+U],se:[u+M,q+U],n:[u+M/2,q],w:[u,q+U/2],e:[u+M,q+U/2],s:[u+M/2,q+U]};for(var fa in this.gripCoords){c=this.gripCoords[fa];o[fa].setAttribute("x",c[0]);o[fa].setAttribute("y",c[1])}this.rotateCoords={nw:[u,q],ne:[u+M+8,q],sw:[u,q+U+8],se:[u+M+8,q+U+8]};for(fa in this.rotateCoords){c=this.rotateCoords[fa]; -m.rotateGrips[fa].setAttribute("cx",c[0]);m.rotateGrips[fa].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&& +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("+n.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=n.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 o=0;o element";this.svgElem_=c;this.obj_num=0;this.idPrefix=m||"svg_";this.releasedNums=[];this.all_layers=[];this.current_layer=null;this.nonce_= -"";var o=this.svgElem_.getAttributeNS("http://svg-edit.googlecode.com","nonce");if(o&&f!=n.NEVER_RANDOMIZE)this.nonce_=o;else f==n.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,m){this.name_=c;this.group_=m};svgedit.draw.Layer.prototype.getName=function(){return this.name_};svgedit.draw.Layer.prototype.getGroup=function(){return this.group_};svgedit.draw.randomizeIds=function(c,m){f=c==false?o.NEVER_RANDOMIZE: +o.ALWAYS_RANDOMIZE;if(f==o.ALWAYS_RANDOMIZE&&!m.getNonce())m.setNonce(Math.floor(Math.random()*100001));else f==o.NEVER_RANDOMIZE&&m.getNonce()&&m.clearNonce()};svgedit.draw.Drawing=function(c,m){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=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_}; 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 o=this.getId();this.getElem_(o);){if(m){this.obj_num=c;m=false}this.obj_num++;o=this.getId()}if(m)this.obj_num=c;return o};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.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=[],o=[],b=null,d=false,e=0;e0||!d){for(e=1;o.indexOf("Layer "+e)>=0;)e++;o="Layer "+e;b=c.createElementNS("http://www.w3.org/2000/svg","g");d=c.createElementNS("http://www.w3.org/2000/svg","title");d.textContent=o; -b.appendChild(d);for(d=0;d1))for(var o=0;o1){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){d=U0){d=S 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],M=l-1<0?null:d[l-1];if(w.type===2){if(M&&M.type!==1){q=d[u];q.next=d[u+1];q.next.prev=q;q.addGrip()}u=l}else if(q&&q.type===1){w.next=d[u+1];w.next.prev=w;w.mate=d[u];w.addGrip();if(this.first_seg==null)this.first_seg=w}else if(q){if(w.type!== -1){w.addGrip();if(q&&q.type!==2){w.next=q;w.next.prev=w}}}else if(w.type!==1){q=d[u];q.next=d[u+1];q.next.prev=q;q.addGrip();w.addGrip();if(!this.first_seg)this.first_seg=d[u]}}return this};svgedit.path.Path.prototype.eachSeg=function(d){for(var e=this.segs.length,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').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:o[0],height:o[1],x:o[0],y:o[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 u="svg_";b.setIdPrefix= -function(g){u=g};b.current_drawing_=new svgedit.draw.Drawing(l,u);var w=b.getCurrentDrawing=function(){return b.current_drawing_},q=1,M=null,U={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}};U.text=$.extend(true,{},U.shape);$.extend(U.text, -{fill:"#000000",stroke_width:0,font_size:24,font_family:"Junction"});var P=U.shape,K=Array(1),fa=this.addSvgElementFromJson=function(g){var h=svgedit.utilities.getElem(g.attr.id),k=w().getCurrentLayer();if(h&&g.element!=h.tagName){k.removeChild(h);h=null}if(!h){h=d.createElementNS(c,g.element);if(k)(M||k).appendChild(h)}g.curStyles&&svgedit.utilities.assignAttributes(h,{fill:P.fill,stroke:P.stroke,"stroke-width":P.stroke_width,"stroke-dasharray":P.stroke_dasharray,"stroke-linejoin":P.stroke_linejoin, -"stroke-linecap":P.stroke_linecap,"stroke-opacity":P.stroke_opacity,"fill-opacity":P.fill_opacity,opacity:P.opacity/2,style:"pointer-events:inherit"},100);svgedit.utilities.assignAttributes(h,g.attr,100);svgedit.utilities.cleanupElement(h);return h},W=b.getTransformList=svgedit.transformlist.getTransformList,Q=svgedit.math.transformPoint,ha=b.matrixMultiply=svgedit.math.matrixMultiply,ua=b.hasMatrixTransform=svgedit.math.hasMatrixTransform,ia=b.transformListToTransform=svgedit.math.transformListToTransform, -ea=svgedit.math.snapToAngle,ga=svgedit.math.getMatrix;svgedit.units.init({getBaseUnit:function(){return m.baseUnit},getElement:svgedit.utilities.getElem,getHeight:function(){return l.getAttribute("height")/q},getWidth:function(){return l.getAttribute("width")/q},getRoundDigits:function(){return bb.round_digits}});var ra=b.convertToNum=svgedit.units.convertToNum;svgedit.utilities.init({getDOMDocument:function(){return d},getDOMContainer:function(){return a},getSVGRoot:function(){return e},getSelectedElements:function(){return K}, -getSVGContent:function(){return l}});var qa=b.getUrlFromAttr=svgedit.utilities.getUrlFromAttr,ca=b.getHref=svgedit.utilities.getHref,T=b.setHref=svgedit.utilities.setHref,V=svgedit.utilities.getPathBBox;b.getBBox=svgedit.utilities.getBBox;var sa=b.getRotationAngle=svgedit.utilities.getRotationAngle,ta=b.getElem=svgedit.utilities.getElem,aa=b.assignAttributes=svgedit.utilities.assignAttributes,ma=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 v=h.elements();b.pathActions.clear();H("changed",v);v=h.type();k=g==k.AFTER_APPLY;if(v== -Ra.type()){k=k?h.newParent:h.oldParent;k==l&&b.identifyLayers()}else if(v==Qa.type()||v==Va.type()){h.parent==l&&b.identifyLayers();if(v==Qa.type())k&&$a(h.elem);else k||$a(h.elem);h.elem.tagName==="use"&&gc(h.elem)}else if(v==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()){v=h.elem;if(!v.getAttribute("x")&&!v.getAttribute("y")){k= -v.parentNode;var s=v.nextSibling;k.removeChild(v);k.insertBefore(v,s)}}}}}});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 q},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 q}, +$.SvgCanvas=function(a,o){function f(g,h){for(var k=svgedit.utilities.getBBox(g),w=0;w<2;w++){var v=w===0?"fill":"stroke",G=g.getAttribute(v);if(G&&G.indexOf("url(")===0){G=fa(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=Q(z,A,h);F=Q(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=P();Bb().appendChild(G);g.setAttribute(v,"url(#"+G.id+")")}}}}var c="http://www.w3.org/2000/svg",m={show_outside_canvas:true,selectNew:true,dimensions:[640,480]};o&&$.extend(m,o);var p=m.dimensions,b=this,d=a.ownerDocument,e=d.importNode(svgedit.utilities.text2xml('').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, +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 v=h[k];if(v&&v.indexOf("url(")===0){v=qa(v).substr(1);if(!ta(v)){Bb().appendChild(Fb[v]);delete Fb[v]}}}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 L=F.getAttribute("rx"),I=F.getAttribute("ry");if(L||I)E=D=b.convertToPath(F,true)}if(!D){var N=F.cloneNode(true),X=document.createElementNS(c,"g"),R=F.parentNode;R.appendChild(X);X.appendChild(N);E=svgedit.utilities.bboxToObj(X.getBBox());R.removeChild(X)}}return E}catch(pa){console.log(F, -pa);return null}},k;$.each(g,function(){if(!k)if(this.parentNode)k=h(this)});if(k==null)return null;var v=k.x+k.width,s=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 L=A(E);G=Math.min(G,D.x-L);z=Math.min(z,D.y-L);C.push(D)}});k.x=G;k.y=z;$.each(g,function(F,E){var D=C[F];if(D&&E.nodeType==1){var L=A(E);v=Math.max(v,D.x+D.width+L);s=Math.max(s,D.y+D.height+ -L)}});k.width=v-G;k.height=s-z;return k};var Kb=this.getVisibleElements=function(g){g||(g=$(l).children());var h=[];$(g).children().each(function(k,v){try{v.getBBox()&&h.push(v)}catch(s){}});return h.reverse()},Ub=this.getVisibleElementsAndBBoxes=function(g){g||(g=$(l).children());var h=[];$(g).children().each(function(k,v){try{v.getBBox()&&h.push({elem:v,bbox:getStrokedBBox([v])})}catch(s){}});return h.reverse()},na=this.groupSvgElem=function(g){var h=document.createElementNS(c,"g");g.parentNode.replaceChild(h, -g);$(h).append(g).data("gsvg",g)[0].id=O()},ba=function(g){var h=document.createElementNS(g.namespaceURI,g.nodeName);h.removeAttribute("id");$.each(g.attributes,function(v,s){s.localName!="-moz-math-font-style"&&h.setAttributeNS(s.namespaceURI,s.nodeName,s.nodeValue)});if(svgedit.browser.isWebkit()&&g.nodeName=="path"){var k=Ua.convertPath(g);h.setAttribute("d",k)}$.each(g.childNodes,function(v,s){switch(s.nodeType){case 1:h.appendChild(ba(s));break;case 3:h.textContent=s.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=O();return h},va,O,H;(function(g){var h={};va=g.getId=function(){return w().getId()};O=g.getNextId=function(){return w().getNextId()};H=g.call=function(k,v){if(h[k])return h[k](this,v)};g.bind=function(k,v){var s=h[k];h[k]=v;return s}})(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 v=g[h];v.setAttribute("d",Ua.convertPath(v));Ua.fixEnd(v)}};var Z=this.getRefElem=function(g){return ta(qa(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);K[0]=h;Pa.requestSelector(h).showGrips(true);return h};this.setRotationAngle=function(g,h){g=parseFloat(g);var k=K[0],v=k.getAttribute("transform"),s=svgedit.utilities.getBBox(k),G=s.x+s.width/2,z=s.y+s.height/ -2;s=W(k);s.numberOfItems>0&&s.getItem(0).type==4&&s.removeItem(0);if(g!=0){G=Q(G,z,ia(s).matrix);z=e.createSVGTransform();z.setRotate(g,G.x,G.y);s.numberOfItems?s.insertItemBefore(z,0):s.appendItem(z)}else s.numberOfItems==0&&k.removeAttribute("transform");if(!h){s=k.getAttribute("transform");k.setAttribute("transform",v);ub("transform",s,K);H("changed",K)}ta("pathpointgrip_container");k=Pa.requestSelector(K[0]);k.resize();k.updateGripCursors(g)};var Za=this.recalculateAllSelectedDimensions=function(){for(var g= -new Na(rb=="none"?"position":"size"),h=K.length;h--;){var k=pb(K[h]);k&&g.addSubCommand(k)}if(!g.isEmpty()){Ha(g);H("changed",K)}},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 v=m.gridSnapping&&g.parentNode.parentNode.localName==="svg",s=function(){if(v)for(var D in h)h[D]=Ja(h[D]);aa(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=Z(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=O();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=ia(g).matrix; -z=ha(z.inverse(),k,z);h.x=parseFloat(h.x)+z.e;h.y=parseFloat(h.y)+z.f}else{z=W(g);A=e.createSVGTransform();A.setMatrix(ha(ia(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=W(g);A=e.createSVGTransform();A.setMatrix(ha(ia(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)}s(); -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);s();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);s();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=ra("x",g.getAttribute("x")); -A=ra("x",k[G].getAttribute("x"));C=ra("y",g.getAttribute("y"));F=ra("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)aa(k[G],E,1E3,true)}s();break;case "use":s();break;case "g":(s=$(g).data("gsvg"))&&aa(s,h,1E3,true);break;case "polyline":case "polygon":s=h.points.length;for(G=0;G0){for(var k=h.numberOfItems;k--;){var v=h.getItem(k);if(v.type===0)h.removeItem(k);else if(v.type=== -1)svgedit.math.isIdentity(v.matrix)&&h.removeItem(k);else v.type===4&&v.angle===0&&h.removeItem(k)}if(h.numberOfItems===1&&sa(g))return null}if(!h||h.numberOfItems==0){g.removeAttribute("transform");return null}if(h){k=h.numberOfItems;for(var s=[];k--;){v=h.getItem(k);if(v.type===1)s.push([v.matrix,k]);else if(s.length)s=[]}if(s.length===2){k=e.createSVGTransformFromMatrix(ha(s[1][0],s[0][0]));h.removeItem(s[0][1]);h.removeItem(s[1][1]);h.insertItemBefore(k,s[1][1])}k=h.numberOfItems;if(k>=2&&h.getItem(k- -2).type===1&&h.getItem(k-1).type===2){s=e.createSVGTransform();v=ha(h.getItem(k-2).matrix,h.getItem(k-1).matrix);s.setMatrix(v);h.removeItem(k-2);h.removeItem(k-2);h.appendItem(s)}}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;v=[];switch(g.tagName){case "line":v=["x1","y1", -"x2","y2"];break;case "circle":v=["cx","cy","r"];break;case "ellipse":v=["cx","cy","rx","ry"];break;case "foreignObject":case "rect":case "image":v=["width","height","x","y"];break;case "use":case "text":case "tspan":v=["x","y"];break;case "polygon":case "polyline":A={};A.points=g.getAttribute("points");s=g.points;var C=s.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(I-2).type==3&&h.getItem(I-3).type==2&&h.getItem(I-1).type==2){F=3;var X=h.getItem(I-3).matrix,R=h.getItem(I-2).matrix,pa=h.getItem(I-1).matrix;C=g.childNodes;for(E=C.length;E--;){var xa=C.item(E);v=G=0;if(xa.nodeType==1){var da=W(xa);if(da){v=ia(da).matrix;G=sa(xa);var ka=gb,oa=[];gb=xa.getAttribute("transform");if(G||ua(da)){var za= -e.createSVGTransform();za.setMatrix(ha(X,R,pa,v));da.clear();da.appendItem(za);oa.push(za)}else{G=ha(v.inverse(),pa,v);za=e.createSVGMatrix();za.e=-G.e;za.f=-G.f;v=ha(za.inverse(),v.inverse(),X,R,pa,v,G.inverse());var kb=e.createSVGTransform(),ob=e.createSVGTransform(),Vb=e.createSVGTransform();kb.setTranslate(G.e,G.f);ob.setScale(v.a,v.d);Vb.setTranslate(za.e,za.f);da.appendItem(Vb);da.appendItem(ob);da.appendItem(kb);oa.push(Vb);oa.push(ob);oa.push(kb)}k.addSubCommand(pb(xa));gb=ka}}}h.removeItem(I- -1);h.removeItem(I-2);h.removeItem(I-3)}else if(I>=3&&h.getItem(I-1).type==1){F=3;v=ia(h).matrix;za=e.createSVGTransform();za.setMatrix(v);h.clear();h.appendItem(za)}else if((I==1||I>1&&h.getItem(1).type!=3)&&h.getItem(0).type==2){F=2;G=ia(h).matrix;h.removeItem(0);v=ia(h).matrix.inverse();v=ha(v,G);G=v.e;v=v.f;if(G!=0||v!=0){C=g.childNodes;E=C.length;for(I=[];E--;){xa=C.item(E);if(xa.nodeType==1){if(xa.getAttribute("clip-path")){ka=xa.getAttribute("clip-path");if(I.indexOf(ka)===-1){Db(ka,G,v);I.push(ka)}}ka= -gb;gb=xa.getAttribute("transform");if(da=W(xa)){X=e.createSVGTransform();X.setTranslate(G,v);da.numberOfItems?da.insertItemBefore(X,0):da.appendItem(X);k.addSubCommand(pb(xa));da=g.getElementsByTagNameNS(c,"use");xa="#"+xa.id;for(X=da.length;X--;){R=da.item(X);if(xa==ca(R)){pa=e.createSVGTransform();pa.setTranslate(-G,-v);W(R).insertItemBefore(pa,0);k.addSubCommand(pb(R))}}gb=ka}}}I=[];gb=ka}}else if(I==1&&h.getItem(0).type==1&&!s){F=1;v=h.getItem(0).matrix;C=g.childNodes;for(E=C.length;E--;){xa= -C.item(E);if(xa.nodeType==1){ka=gb;gb=xa.getAttribute("transform");if(da=W(xa)){G=ha(v,ia(da).matrix);I=e.createSVGTransform();I.setMatrix(G);da.clear();da.appendItem(I,0);k.addSubCommand(pb(xa));gb=ka;ka=xa.getAttribute("stroke-width");xa.getAttribute("stroke")!=="none"&&!isNaN(ka)&&xa.setAttribute("stroke-width",ka*((Math.abs(G.a)+Math.abs(G.d))/2))}}}h.clear()}else{if(s){D=e.createSVGTransform();D.setRotate(s,L.x,L.y);h.numberOfItems?h.insertItemBefore(D,0):h.appendItem(D)}h.numberOfItems==0&& -g.removeAttribute("transform");return null}if(F==2){if(s){L={x:D.x+N.e,y:D.y+N.f};D=e.createSVGTransform();D.setRotate(s,L.x,L.y);h.numberOfItems?h.insertItemBefore(D,0):h.appendItem(D)}}else if(F==3){v=ia(h).matrix;N=e.createSVGTransform();N.setRotate(s,D.x,D.y);N=N.matrix;D=e.createSVGTransform();D.setRotate(s,L.x,L.y);L=D.matrix.inverse();ka=v.inverse();L=ha(ka,L,N,v);G=L.e;v=L.f;if(G!=0||v!=0){C=g.childNodes;for(E=C.length;E--;){xa=C.item(E);if(xa.nodeType==1){ka=gb;gb=xa.getAttribute("transform"); -da=W(xa);X=e.createSVGTransform();X.setTranslate(G,v);da.numberOfItems?da.insertItemBefore(X,0):da.appendItem(X);k.addSubCommand(pb(xa));gb=ka}}}if(s)h.numberOfItems?h.insertItemBefore(D,0):h.appendItem(D)}}else{s=svgedit.utilities.getBBox(g);if(!s&&g.tagName!="path")return null;v=e.createSVGMatrix();if(G=sa(g)){D={x:s.x+s.width/2,y:s.y+s.height/2};L=Q(s.x+s.width/2,s.y+s.height/2,ia(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(I-2).type==3&&h.getItem(I-3).type==2&&h.getItem(I- -1).type==2){F=3;v=ia(h,I-3,I-1).matrix;h.removeItem(I-1);h.removeItem(I-2);h.removeItem(I-3)}else if(I==4&&h.getItem(I-1).type==1){F=3;v=ia(h).matrix;za=e.createSVGTransform();za.setMatrix(v);h.clear();h.appendItem(za);v=e.createSVGMatrix()}else if((I==1||I>1&&h.getItem(1).type!=3)&&h.getItem(0).type==2){F=2;N=h.getItem(0).matrix;ka=ia(h,1).matrix;s=ka.inverse();v=ha(s,N,ka);h.removeItem(0)}else if(I==1&&h.getItem(0).type==1&&!G){v=ia(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){s=g.points;C=s.numberOfItems;z.points=Array(C);for(F=0;F1&&s.showGrips(false)}}}H("selected",K);h||K.length==1?Pa.requestSelector(K[0]).showGrips(true): -Pa.requestSelector(K[0]).showGrips(false);for(K.sort(function(G,z){if(G&&z&&G.compareDocumentPosition)return 3-(z.compareDocumentPosition(G)&6);else if(G==null)return 1});K[0]==null;)K.shift(0)}},Sb=this.selectOnly=function(g,h){cb(true);Nb(g,h)};this.removeFromSelection=function(g){if(K[0]!=null)if(g.length!=0){var h=Array(K.length);j=0;len=K.length;for(var k=0;k=0&&g.id!="svgcanvas")for(;g.nodeName!="foreignObject";){g=g.parentNode;if(!g)return e}var h=w().getCurrentLayer();if([e,a,l,h].indexOf(g)>=0)return e;if($(g).closest("#selectorParentGroup").length)return Pa.selectorParentGroup; -for(;g.parentNode!==(M||h);)g=g.parentNode;return g};(function(){var g=null,h=null,k=null,v=null,s=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*q;E=E.y*q;C.preventDefault();if(F)Ia="select";D=D/q;E=E/q;var L=ac(C);if(L.tagName==="a"&&L.childNodes.length===1)L=L.firstChild;var I=v=h=D,N=s=k=E;if(m.gridSnapping){D= -Ja(D);E=Ja(E);h=Ja(h);k=Ja(k)}if(L==Pa.selectorParentGroup&&K[0]!=null){L=C.target;var X=ab(L,"type");if(X=="rotate"){Ia="rotate";current_rotate_mode=ab(L,"dir")}else if(X=="resize"){Ia="resize";rb=ab(L,"dir")}L=K[0]}gb=L.getAttribute("transform");X=W(L);switch(Ia){case "select":Sa=true;rb="none";if(F)Sa=false;if(L!=e){if(K.indexOf(L)==-1){C.shiftKey||cb(true);Nb([L]);La=L;Ua.clear()}if(!F)for(F=0;F0&&b.removeFromSelection(L);I.length>0&&Nb(I);break;case "resize":L=W(F);I=(R=ua(L))?G:svgedit.utilities.getBBox(F);N=I.x;pa=I.y;var xa=I.width,da=I.height;I=x-h;X=y-k;if(m.gridSnapping){I=Ja(I);X=Ja(X);da=Ja(da);xa= -Ja(xa)}var ka=sa(F);if(ka){var oa=Math.sqrt(I*I+X*X);X=Math.atan2(X,I)-ka*Math.PI/180;I=oa*Math.cos(X);X=oa*Math.sin(X)}if(rb.indexOf("n")==-1&&rb.indexOf("s")==-1)X=0;if(rb.indexOf("e")==-1&&rb.indexOf("w")==-1)I=0;var za=oa=0,kb=da?(da+X)/da:1,ob=xa?(xa+I)/xa:1;if(rb.indexOf("n")>=0){kb=da?(da-X)/da:1;za=da}if(rb.indexOf("w")>=0){ob=xa?(xa-I)/xa:1;oa=xa}I=e.createSVGTransform();X=e.createSVGTransform();xa=e.createSVGTransform();if(m.gridSnapping){N=Ja(N);oa=Ja(oa);pa=Ja(pa);za=Ja(za)}I.setTranslate(-(N+ -oa),-(pa+za));if(C.shiftKey)if(ob==1)ob=kb;else kb=ob;X.setScale(ob,kb);xa.setTranslate(N+oa,pa+za);if(R){R=ka?1:0;L.replaceItem(I,2+R);L.replaceItem(X,1+R);L.replaceItem(xa,0+R)}else{R=L.numberOfItems;L.replaceItem(xa,R-3);L.replaceItem(X,R-2);L.replaceItem(I,R-1)}Pa.requestSelector(F).resize();H("transition",K);break;case "zoom":I*=q;N*=q;aa(Wa,{x:Math.min(v*q,I),y:Math.min(s*q,N),width:Math.abs(I-v*q),height:Math.abs(N-s*q)},100);break;case "text":aa(L,{x:x,y:y},1E3);break;case "line":I=null;window.opera|| -e.suspendRedraw(1E3);if(m.gridSnapping){x=Ja(x);y=Ja(y)}N=x;R=y;if(C.shiftKey){R=ea(h,k,N,R);N=R.x;R=R.y}L.setAttributeNS(null,"x2",N);L.setAttributeNS(null,"y2",R);window.opera||e.unsuspendRedraw(I);break;case "foreignObject":case "square":case "rect":case "image":I=Math.abs(x-h);R=Math.abs(y-k);if(Ia=="square"||C.shiftKey){I=R=Math.max(I,R);N=hk?k+pa:k-pa}if(C.altKey){R=h;N=k;pa=Math.abs(x-R);X=C.shiftKey?pa:Math.abs(y-N)}L.setAttributeNS(null, -"rx",pa);L.setAttributeNS(null,"ry",X);L.setAttributeNS(null,"cx",R);L.setAttributeNS(null,"cy",N);window.opera||e.unsuspendRedraw(I);break;case "fhellipse":case "fhrect":z.minx=Math.min(I,z.minx);z.maxx=Math.max(I,z.maxx);z.miny=Math.min(N,z.miny);z.maxy=Math.max(N,z.maxy);case "fhpath":g+=+I+","+N+" ";L.setAttributeNS(null,"points",g);break;case "path":case "pathedit":x*=q;y*=q;if(m.gridSnapping){x=Ja(x);y=Ja(y);h=Ja(h);k=Ja(k)}if(C.shiftKey){if(R=svgedit.path.path){L=R.dragging?R.dragging[0]:h; -R=R.dragging?R.dragging[1]:k}else{L=h;R=k}R=ea(L,R,x,y);x=R.x;y=R.y}if(Wa&&Wa.getAttribute("display")!=="none"){I*=q;N*=q;aa(Wa,{x:Math.min(v*q,I),y:Math.min(s*q,N),width:Math.abs(I-v*q),height:Math.abs(N-s*q)},100)}Ua.mouseMove(C,x,y);break;case "textedit":x*=q;y*=q;qb.mouseMove(D,E);break;case "rotate":I=svgedit.utilities.getBBox(F);R=I.x+I.width/2;N=I.y+I.height/2;L=ga(F);L=Q(R,N,L);R=L.x;N=L.y;L=I.x;pa=I.y;if(current_rotate_mode=="nw")L=I.x+I.width;if(current_rotate_mode=="se")pa=I.y+I.height; -if(current_rotate_mode=="sw"){L=I.x+I.width;pa=I.y+I.height}compensation_angle=(Math.atan2(N-pa,R-L)*(180/Math.PI)-90)%360;ka=(Math.atan2(N-y,R-x)*(180/Math.PI)-90)%360;ka+=compensation_angle;if(m.gridSnapping)ka=Ja(ka);if(C.shiftKey)ka=Math.round(ka/45)*45;b.setRotationAngle(ka<-180?360+ka:ka,true);H("transition",K)}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!==M){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")&&sa(E)){bc(E);E=K[0];cb(true)}M&&cc();F.tagName!=="g"&&F.tagName!=="a"||F===w().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*q;E=E.y*q;var L=D/q,I=E/q,N=ta(va()),X=false;Sa=false;switch(Ia){case "resize":case "multiselect":if(Wa!=null){Wa.setAttribute("display","none");jb=[]}Ia="select"; -case "select":if(K[0]!=null){if(K[1]==null){D=K[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(L!=v||I!=s){C=K.length;for(D=0;D=0?F.indexOf(",",L+1)>=0:F.indexOf(" ",F.indexOf(" ")+1)>=0)N=Ua.smoothPolylineIntoPath(N);break;case "line":F=$(N).attr(["x1","x2","y1","y2"]);X=F.x1!=F.x2||F.y1!=F.y2;break;case "foreignObject":case "square":case "rect":case "image":F=$(N).attr(["width","height"]); -X=F.width!=0||F.height!=0||Ia==="image";break;case "circle":X=N.getAttribute("r")!=0;break;case "ellipse":F=$(N).attr(["rx","ry"]);X=F.rx!=null||F.ry!=null;break;case "fhellipse":if(z.maxx-z.minx>0&&z.maxy-z.miny>0){N=fa({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()}});H("changed",[N]);X=true}break;case "fhrect":if(z.maxx-z.minx>0&&z.maxy-z.miny>0){N=fa({element:"rect",curStyles:true,attr:{x:z.minx,y:z.miny,width:z.maxx- -z.minx,height:z.maxy-z.miny,id:va()}});H("changed",[N]);X=true}break;case "text":X=true;Sb([N]);qb.start(N);break;case "path":N=null;Sa=true;F=Ua.mouseUp(C,N,D,E);N=F.element;X=F.keep;break;case "pathedit":X=true;N=null;Ua.mouseUp(C);break;case "textedit":X=false;N=null;qb.mouseUp(C,D,E);break;case "rotate":X=true;N=null;Ia="select";F=b.undoMgr.finishUndoableChange();F.isEmpty()||Ha(F);Za();H("changed",K)}D=nb("mouseUp",{event:C,mouse_x:D,mouse_y:E},true);$.each(D,function(xa,da){if(da){X=da.keep|| -X;N=da.element;Sa=da.started||Sa}});if(!X&&N!=null){w().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 R;if(false.beginElement&&N.getAttribute("opacity")!=P.opacity){R=$(false).clone().attr({to:P.opacity,dur:C}).appendTo(N);try{R[0].beginElement()}catch(pa){}}else C= -0;setTimeout(function(){R&&R.remove();N.setAttribute("opacity",P.opacity);N.setAttribute("style","pointer-events:inherit");ma(N);if(Ia==="path")Ua.toEditMode(N);else m.selectNew&&Sb([N],true);Ha(new Qa(N));H("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&&H("zoomed",F)}})})();var Lb=function(g){$(g).click(function(h){h.preventDefault()})},qb=b.textActions=function(){function g(da){var ka=F.value==="";$(F).focus();if(!arguments.length)if(ka)da=0;else{if(F.selectionEnd!==F.selectionStart)return;da=F.selectionEnd}var oa;oa=I[da];ka||F.setSelectionRange(da,da);E=ta("text_cursor");if(!E){E=document.createElementNS(c,"line");aa(E,{id:"text_cursor",stroke:"#333","stroke-width":1}); -E=ta("selectorParentGroup").appendChild(E)}L||(L=setInterval(function(){var za=E.getAttribute("display")==="none";E.setAttribute("display",za?"inline":"none")},600));ka=G(oa.x,N.y);oa=G(oa.x,N.y+N.height);aa(E,{x1:ka.x,y1:ka.y,x2:oa.x,y2:oa.y,visibility:"visible",display:"inline"});D&&D.setAttribute("d","")}function h(da,ka,oa){if(da===ka)g(ka);else{oa||F.setSelectionRange(da,ka);D=ta("text_selectblock");if(!D){D=document.createElementNS(c,"path");aa(D,{id:"text_selectblock",fill:"green",opacity:0.5, -style:"pointer-events:none"});ta("selectorParentGroup").appendChild(D)}da=I[da];var za=I[ka];E.setAttribute("visibility","hidden");ka=G(da.x,N.y);oa=G(da.x+(za.x-da.x),N.y);var kb=G(da.x,N.y+N.height);da=G(da.x+(za.x-da.x),N.y+N.height);aa(D,{d:"M"+ka.x+","+ka.y+" L"+oa.x+","+oa.y+" "+da.x+","+da.y+" "+kb.x+","+kb.y+"z",display:"inline"})}}function k(da,ka){var oa=e.createSVGPoint();oa.x=da;oa.y=ka;if(I.length==1)return 0;oa=C.getCharNumAtPosition(oa);if(oa<0){oa=I.length-2;if(da<=I[0].x)oa=0}else if(oa>= -I.length-2)oa=I.length-2;var za=I[oa];da>za.x+za.width/2&&oa++;return oa}function v(da,ka,oa){var za=F.selectionStart;da=k(da,ka);h(Math.min(za,da),Math.max(za,da),!oa)}function s(da,ka){var oa={x:da,y:ka};oa.x/=q;oa.y/=q;if(X){var za=Q(oa.x,oa.y,X.inverse());oa.x=za.x;oa.y=za.y}return oa}function G(da,ka){var oa={x:da,y:ka};if(X){var za=Q(oa.x,oa.y,X);oa.x=za.x;oa.y=za.y}oa.x*=q;oa.y*=q;return oa}function z(da){h(0,C.textContent.length);$(this).unbind(da)}function A(da){if(xa&&C){var ka=Q(da.pageX, -da.pageY,Pb);ka=s(ka.x*q,ka.y*q);ka=k(ka.x,ka.y);var oa=C.textContent,za=oa.substr(0,ka).replace(/[a-z0-9]+$/i,"").length;oa=oa.substr(ka).match(/^[a-z0-9]+/i);h(za,(oa?oa[0].length:0)+ka);$(da.target).click(z);setTimeout(function(){$(da.target).unbind("click",z)},300)}}var C,F,E,D,L,I=[],N,X,R,pa,xa;return{select:function(da,ka,oa){C=da;qb.toEditMode(ka,oa)},start:function(da){C=da;qb.toEditMode()},mouseDown:function(da,ka,oa,za){da=s(oa,za);F.focus();g(k(da.x,da.y));R=oa;pa=za},mouseMove:function(da, -ka){var oa=s(da,ka);v(oa.x,oa.y)},mouseUp:function(da,ka,oa){var za=s(ka,oa);v(za.x,za.y,true);da.target!==C&&kaR-2&&oapa-2&&qb.toSelectMode(true)},setCursor:g,toEditMode:function(da,ka){xa=false;Ia="textedit";Pa.requestSelector(C).showGrips(false);Pa.requestSelector(C);qb.init();$(C).css("cursor","text");if(arguments.length){var oa=s(da,ka);g(k(oa.x,oa.y))}else g();setTimeout(function(){xa=true},300)},toSelectMode:function(da){Ia="select";clearInterval(L);L=null;D&&$(D).attr("display", -"none");E&&$(E).attr("visibility","hidden");$(C).css("cursor","move");if(da){cb();$(C).css("cursor","move");H("selected",[C]);Nb([C],true)}C&&!C.textContent.length&&b.deleteSelectedElements();$(F).blur();C=false},setInputElem:function(da){F=da},clear:function(){Ia=="textedit"&&qb.toSelectMode()},init:function(){if(C){if(!C.parentNode){C=K[0];Pa.requestSelector(C).showGrips(false)}var da=C.textContent.length,ka=C.getAttribute("transform");N=svgedit.utilities.getBBox(C);X=ka?ga(C):null;I=Array(da); -F.focus();$(C).unbind("dblclick",A).dblclick(A);if(!da)var oa={x:N.x+N.width/2,width:0};for(ka=0;ka=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]);H("selected",z)};var s=h=null,G=false;return{mouseDown:function(z,A,C,F){if(Ia==="path"){mouse_x=C;mouse_y=F;F=mouse_x/q;A=mouse_y/q;C=ta("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");aa(C,{id:"path_stretch_line",stroke:"#22C","stroke-width":"0.5",fill:"none"});C=ta("selectorParentGroup").appendChild(C)}C.setAttribute("display","inline");var E=null;if(s){E= -s.pathSegList;for(var D=E.numberOfItems,L=6/q,I=false;D;){D--;var N=E.getItem(D),X=N.x;N=N.y;if(F>=X-L&&F<=X+L&&A>=N-L&&A<=N+L){I=true;break}}L=va();svgedit.path.removePath_(L);L=ta(L);X=E.numberOfItems;if(I){if(D<=1&&X>=2){F=E.getItem(0).x;A=E.getItem(0).y;z=C.pathSegList.getItem(1);z=z.pathSegType===4?s.createSVGPathSegLinetoAbs(F,A):s.createSVGPathSegCurvetoCubicAbs(F,A,z.x1/q,z.y1/q,F,A);F=s.createSVGPathSegClosePath();E.appendItem(z);E.appendItem(F)}else if(X<3)return E=false;$(C).remove();element= -L;s=null;Sa=false;if(g){svgedit.path.path.matrix&&xb(L,{},svgedit.path.path.matrix.inverse());C=L.getAttribute("d");z=$(svgedit.path.path.elem).attr("d");$(svgedit.path.path.elem).attr("d",z+C);$(L).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=s.pathSegList.numberOfItems;D=s.pathSegList.getItem(E- -1);L=D.x;D=D.y;if(z.shiftKey){z=ea(L,D,F,A);F=z.x;A=z.y}z=C.pathSegList.getItem(1);z=z.pathSegType===4?s.createSVGPathSegLinetoAbs(Gb(F),Gb(A)):s.createSVGPathSegCurvetoCubicAbs(Gb(F),Gb(A),z.x1/q,z.y1/q,z.x2/q,z.y2/q);s.pathSegList.appendItem(z);F*=q;A*=q;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+" ";s=fa({element:"path",curStyles:true,attr:{d:d_attr,id:O(),opacity:P.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();L=z.target.id;if(L.substr(0,14)=="pathpointgrip_"){A=svgedit.path.path.cur_pt=parseInt(L.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(L.indexOf("ctrlpointgrip_")==0){svgedit.path.path.dragging=[C,F];z=L.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();aa(Wa,{x:C*q,y:F*q,width:0,height:0,display:"inline"},100)}}},mouseMove:function(z,A,C){G=true;if(Ia==="path"){if(s){var F=s.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 L=k[1];F.getItem(z);var I=E+(E-A/q),N=L+(L-C/q);D.setAttribute("cx",I*q);D.setAttribute("cy",N*q);D.setAttribute("display","inline");D=svgedit.path.getCtrlLine(1);var X=svgedit.path.getCtrlLine(2);aa(D,{x1:A,y1:C,x2:E*q,y2:L*q,display:"inline"});aa(X,{x1:I*q,y1:N*q,x2:E*q,y2:L*q,display:"inline"});if(z===0)v=[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(v){A=v[0]/q;C=v[1]/q}svgedit.path.replacePathSeg(6,z,[E,L,A,C,I,N],s)}}else if(E=ta("path_stretch_line")){z=F.getItem(z);if(z.pathSegType===6)svgedit.path.replacePathSeg(6,1,[A,C,(z.x+(z.x-z.x2))*q,(z.y+(z.y-z.y2))*q,A,C],E);else v?svgedit.path.replacePathSeg(6,1,[A,C,v[0],v[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);L=svgedit.path.getPointFromGrip({x:A,y:C},svgedit.path.path);z=L.x-E.x;E=L.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 R=Wa.getBBox(),pa=svgedit.path.getGripPt(this);R=svgedit.math.rectsIntersect(R,{x:pa.x,y:pa.y,width:0,height:0});this.select(R);R&&svgedit.path.path.selected_pts.push(this.index)}})}}, -mouseUp:function(z,A){if(Ia==="path"){k=null;if(!s){A=ta(va());Sa=false;v=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){H("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=K[0];if(z)if(sa(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);H("changed",K)}},clear:function(){h=null;if(s){var z=ta(va());$(ta("path_stretch_line")).remove(); -$(z).remove();$(ta("pathpointgrip_container")).find("*").attr("display","none");s=v=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=W(z),C=ia(A).matrix;A.clear();z.removeAttribute("transform");A=z.pathSegList;for(var F=A.numberOfItems,E=0;E0){L=F.getItem(E-1).pathSegType;if(L===2){D(E-1,1);C();break}else if(L===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 L=A.getItem(D),I=A.getItem(D+1),N=A.getItem(D+2);if(E)if((F=svgedit.path.smoothControlPoints(E,L,F))&&F.length== -2){L=z[z.length-1].split(",");L[2]=F[0].x;L[3]=F[0].y;z[z.length-1]=L.join(",");L=F[1]}z.push([L.x,L.y,I.x,I.y,N.x,N.y].join(","));F=N;E=I}for(z.push("L");D=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"); +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&&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")<= +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;);Ua.clear(true);$.each(l.childNodes,function(k,v){k&&v.nodeType===8&&v.data.indexOf("Created with")>=0&& -l.insertBefore(v,l.firstChild)});if(M){cc();Sb([M])}var g=[];$(l).find("g:data(gsvg)").each(function(){for(var k=this.attributes,v=k.length,s=0;s=0;C--){A=z.item(C);D=v(A.nodeValue);if(!(L.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)+s}else D=svgedit.units.shortFloat(D);if(bb.apply&&g.nodeName==="image"&&A.localName==="href"&&bb.images&&bb.images==="embed"){var I=Ka[D];if(I)D=I}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(" @@ -87,7 +90,6 @@ $(function(){

    -
    @@ -182,6 +184,7 @@ $(function(){ @@ -787,18 +790,6 @@ $(function(){ @@ -809,6 +800,19 @@ $(function(){
    +
    + +
    +
    diff --git a/method-draw/svgedit.compiled.js b/method-draw/svgedit.compiled.js index 2698f5d..a96bb88 100644 --- a/method-draw/svgedit.compiled.js +++ b/method-draw/svgedit.compiled.js @@ -1,110 +1,110 @@ -(function(a){function n(f){if(typeof f.data==="string"){var c=f.handler,m=f.data.toLowerCase().split(" ");f.handler=function(o){if(!(this!==o.target&&(/textarea|select/i.test(o.target.nodeName)||o.target.type==="text"))){var b=o.type!=="keypress"&&a.hotkeys.specialKeys[o.which],d=String.fromCharCode(o.which).toLowerCase(),e="",l={};if(o.altKey&&b!=="alt")e+="alt+";if(o.ctrlKey&&b!=="ctrl")e+="ctrl+";if(o.metaKey&&!o.ctrlKey&&b!=="meta")e+="meta+";if(o.shiftKey&&b!=="shift")e+="shift+";if(b)l[e+b]= +(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:n}})})(jQuery);(function(a,n){function f(ca){return typeof ca==="string"}function c(ca){var T=e.call(arguments,1);return function(){return ca.apply(this,T.concat(e.call(arguments)))}}function m(ca,T,V,sa,ta){var aa;if(sa!==d){T=V.match(ca?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);V=T[3]||"";if(ta===2&&f(sa))sa=sa.replace(ca?ga:ea,"");else{aa=q(T[2]);sa=f(sa)?q[ca?ha:Q](sa):sa;sa=ta===2?sa:ta===1?a.extend({},sa,aa):a.extend({},aa,sa);sa=u(sa);if(ca)sa=sa.replace(ra,l)}ca=T[1]+(ca?"#":sa||!T[1]?"?":"")+sa+V}else ca= -T(V!==d?V:n[ua][ia]);return ca}function o(ca,T,V){if(T===d||typeof T==="boolean"){V=T;T=u[ca?ha:Q]()}else T=f(T)?T.replace(ca?ga:ea,""):T;return q(T,V)}function b(ca,T,V,sa){if(!f(V)&&typeof V!=="object"){sa=V;V=T;T=d}return this.each(function(){var ta=a(this),aa=T||fa()[(this.nodeName||"").toLowerCase()]||"",ma=aa&&ta.attr(aa)||"";ta.attr(aa,u[ca](ma,V,sa))})}var d,e=Array.prototype.slice,l=decodeURIComponent,u=a.param,w,q,M,U=a.bbq=a.bbq||{},P,K,fa,W=a.event.special,Q="querystring",ha="fragment", -ua="location",ia="href",ea=/^.*\?|#.*$/g,ga=/^.*\#/,ra,qa={};u[Q]=c(m,0,function(ca){return ca.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")});u[ha]=w=c(m,1,function(ca){return ca.replace(/^[^#]*#?(.*)$/,"$1")});w.noEscape=function(ca){ca=ca||"";ca=a.map(ca.split(""),encodeURIComponent);ra=RegExp(ca.join("|"),"g")};w.noEscape(",/");a.deparam=q=function(ca,T){var V={},sa={"true":true,"false":false,"null":null};a.each(ca.replace(/\+/g," ").split("&"),function(ta,aa){var ma=aa.split("="),Ga=l(ma[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(ma.length===2){ma=l(ma[1]);if(T)ma=ma&&!isNaN(ma)?+ma:ma==="undefined"?d:sa[ma]!==d?sa[ma]:ma;if(Va)for(;Ra<=Va;Ra++){Ga=Qa[Ra]===""?Ma.length:Qa[Ra];Ma=Ma[Ga]=Ra').hide().insertAfter("body")[0].contentWindow; -K=function(){return c(U.document[b][d])};P=function(fa,W){if(fa!==W){var Q=U.document;Q.open().close();Q[b].hash="#"+fa}};P(c())}}var q={},M,U,P,K;q.start=function(){if(!M){var fa=c();P||w();(function W(){var Q=c(),ha=K(fa);if(Q!==fa){P(fa=Q,ha);a(n).trigger("hashchange")}else if(ha!==fa)n[b][d]=n[b][d].replace(/#.*/,"")+"#"+ha;M=setTimeout(W,a.hashchangeDelay)})()}};q.stop=function(){if(!U){M&&clearTimeout(M);M=0}};return q}()})(jQuery,this);(function(a){var n={},f;a.svgIcons=function(c,m){function o(ca,T){if(ca!=="ajax"){if(fa)return;var V=(U=ia[0].contentDocument)&&U.getElementById("svg_eof");if(!V&&!(T&&V)){W++;if(W<50)setTimeout(o,20);else{d();fa=true}return}fa=true}M=a(U.firstChild).children();if(m.no_img)setTimeout(function(){K||b()},500);else{V=ua+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNzUiIGhlaWdodD0iMjc1Ij48L3N2Zz4%3D";P=a(new Image).attr({src:V,width:0,height:0}).appendTo("body").load(function(){b(true)}).error(function(){b()})}} -function b(ca,T){if(!K){if(m.no_img)ca=false;if(ca){var V=a(document.createElement("div"));V.hide().appendTo("body")}if(T){var sa=m.fallback_path?m.fallback_path:"";a.each(T,function(Va,Xa){a("#"+Va);var Na=a(new Image).attr({"class":"svg_icon",src:sa+Xa,width:w,height:q,alt:"icon"});qa(Na,Va)})}else for(var ta=M.length,aa=0;aa0&&!ca)Ha=f(Ha,Na,true);ra(a(this),Ha,Xa)})});if(!T){ca&&V.remove();ia&&ia.remove();P&&P.remove()}m.resize&&a.resizeSvgIcons(m.resize);K=true;m.callback&&m.callback(n)}}function d(){if(c.indexOf(".svgz")!=-1){var ca=c.replace(".svgz",".svg");window.console&&console.log(".svgz failed, trying with .svg");a.svgIcons(ca,m)}else m.fallback&&b(false,m.fallback)} -function e(ca){if(window.btoa)return window.btoa(ca);var T=Array(Math.floor((ca.length+2)/3)*4),V,sa,ta,aa,ma,Ga,Ma=0,Ra=0;do{V=ca.charCodeAt(Ma++);sa=ca.charCodeAt(Ma++);ta=ca.charCodeAt(Ma++);aa=V>>2;V=(V&3)<<4|sa>>4;ma=(sa&15)<<2|ta>>6;Ga=ta&63;if(isNaN(sa))ma=Ga=64;else if(isNaN(ta))Ga=64;T[Ra++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(aa);T[Ra++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(V);T[Ra++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(ma); -T[Ra++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Ga)}while(Ma-1&&Q.indexOf("Chrome/");var ua="data:image/svg+xml;charset=utf-8;base64,";if(m.svgz){var ia=a('').appendTo("body").hide();try{U=ia[0].contentDocument;ia.load(o); -o(0,true)}catch(ea){d()}}else{var ga=new DOMParser;a.ajax({url:c,dataType:"string",success:function(ca){if(ca){U=ga.parseFromString(ca,"text/xml");a(function(){o("ajax")})}else a(d)},error:function(ca){if(window.opera)a(function(){d()});else if(ca.responseText){U=ga.parseFromString(ca.responseText,"text/xml");U.childNodes.length||a(d);a(function(){o("ajax")})}else a(d)}})}var ra=function(ca,T,V,sa){ha&&T.css("visibility","hidden");if(m.replace){sa&&T.attr("id",V);(V=ca.attr("class"))&&T.attr("class", -"svg_icon "+V);ca.replaceWith(T)}else ca.append(T);ha&&setTimeout(function(){T.removeAttr("style")},1)},qa=function(ca,T){if(m.id_match===undefined||m.id_match!==false)ra(holder,ca,T,true);n[T]=ca};f=function(ca,T){var V=ca.find("defs");if(!V.length)return ca;V=ha?V.find("*").filter(function(){return!!this.id}):V.find("[id]");var sa=ca[0].getElementsByTagName("*"),ta=sa.length;V.each(function(aa){var ma=this.id;a(U).find("#"+ma);this.id=aa="x"+ma+T+aa;ma="url(#"+ma+")";var Ga="url(#"+aa+")";for(aa= -0;aa","/":"?","\\":"|"}};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=0;jQuery.fn.jGraduate=function(c){var m= -arguments;return this.each(function(){function o(na,ba,va,O,H){var Z=H||a("stop",{"stop-color":ba,"stop-opacity":va,offset:na},ga);if(H){ba=H.getAttribute("stop-color");va=H.getAttribute("stop-opacity");na=H.getAttribute("offset")}else ga.appendChild(Z);if(va===null)va=1;H=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+na*ha)+", 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:ba,"fill-opacity":va,transform:"translate("+(10+na*ha)+", 26)",stroke:"#000","stroke-width":1.5},Ja);$(Oa).mousedown(function(Za){b(this);$a=tb;fa.mousemove(l).mouseup(d);Da=Jb.offset();Za.preventDefault();return false}).data("stop",Z).data("bg",H).dblclick(function(){$("div.jGraduate_LightBox").show();for(var Za=this,fb=+Z.getAttribute("stop-opacity")|| -1,wb=Z.getAttribute("stop-color")||1,xb=(parseFloat(fb)*255).toString(16);xb.length<2;)xb="0"+xb;ba=wb.substr(1)+xb;$("#"+q+"_jGraduate_stopPicker").css({left:100,bottom:15}).jPicker({window:{title:"Pick the start color and opacity for the gradient"},images:{clientPath:w.images.clientPath},color:{active:ba,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);Z.setAttribute("stop-color", -wb);Z.setAttribute("stop-opacity",fb);$("div.jGraduate_LightBox").hide();$("#"+q+"_jGraduate_stopPicker").hide()},null,function(){$("div.jGraduate_LightBox").hide();$("#"+q+"_jGraduate_stopPicker").hide()})});$(ga).find("stop").each(function(){var Za=$(this);if(+this.getAttribute("offset")>na){if(!ba){var fb=this.getAttribute("stop-color"),wb=this.getAttribute("stop-opacity");Z.setAttribute("stop-color",fb);Oa.setAttribute("fill",fb);Z.setAttribute("stop-opacity",wb===null?1:wb);Oa.setAttribute("fill-opacity", -wb===null?1:wb)}Za.before(Z);return false}});O&&b(Oa);return Z}function b(na){tb&&tb.setAttribute("stroke","#000");na.setAttribute("stroke","blue");tb=na;tb.parentNode.appendChild(tb)}function d(){fa.unbind("mousemove",l);if(Ka.getAttribute("display")!=="none"){Ka.setAttribute("display","none");var na=$(tb),ba=na.data("stop");na=na.data("bg");$([tb,ba,na]).remove()}$a=null}function e(){var na=Sa?"rotate("+Sa+","+gb+","+Ia+") ":"";yb===1&&bb===1?ga.removeAttribute("gradientTransform"):ga.setAttribute("gradientTransform", -na+"translate("+-gb*(yb-1)+","+-Ia*(bb-1)+") scale("+yb+","+bb+")")}function l(na){var ba=na.pageX-Da.left;na=na.pageY-Da.top;ba=ba<10?10:ba>ha+10?ha+10:ba;var va="translate("+ba+", 26)";if(na<-60||na>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",(ba-10)/ha);var O=0;$(ga).find("stop").each(function(){var H=this.getAttribute("offset"), -Z=$(this);if(H
  • Solid Color
  • Linear Gradient
  • Radial Gradient
  • ');var W=$(M+"> .jGraduate_colPick"),Q=$(M+"> .jGraduate_gradPick");Q.html('

    '+w.window.pickerTitle+'


    ');var ha=256,ua=ha-0,ia=ha-0,ea,ga,ra,qa={};$(".jGraduate_SliderBar").width(145);var ca=$("#"+q+"_jGraduate_GradContainer")[0],T=a("svg",{id:q+"_jgraduate_svg",width:ha,height:ha,xmlns:n.svg},ca);ea=ea||u.paint.type;var V=ga=u.paint[ea],sa=u.paint.alpha,ta=ea==="solidColor";switch(ea){case "solidColor":case "linearGradient":if(!ta){ga.id=q+"_lg_jgraduate_grad"; -V=ga=T.appendChild(ga)}a("radialGradient",{id:q+"_rg_jgraduate_grad"},T);if(ea==="linearGradient")break;case "radialGradient":if(!ta){ga.id=q+"_rg_jgraduate_grad";V=ga=T.appendChild(ga)}a("linearGradient",{id:q+"_lg_jgraduate_grad"},T)}if(ta){V=ga=$("#"+q+"_lg_jgraduate_grad")[0];K=u.paint[ea];o(0,"#"+K,1);var aa=typeof w.newstop;if(aa==="string")switch(w.newstop){case "same":o(1,"#"+K,1);break;case "inverse":aa="";for(var ma=0;ma<6;ma+=2){K.substr(ma,2);var Ga=(255-parseInt(K.substr(ma,2),16)).toString(16); -if(Ga.length<2)Ga=0+Ga;aa+=Ga}o(1,"#"+aa,1);break;case "white":o(1,"#ffffff",1);break;case "black":o(1,"#000000",1)}else if(aa==="object")o(1,w.newstop.color||"#"+K,"opac"in w.newstop?w.newstop.opac:1)}K=parseFloat(V.getAttribute("x1")||0);aa=parseFloat(V.getAttribute("y1")||0);ma=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);ra=a("rect",{id:q+"_jgraduate_rect",x:0,y:0,width:ua,height:ia,fill:"url(#"+q+"_jgraduate_grad)","fill-opacity":sa/100},T);var Xa=$("
    ").attr({"class":"grad_coord jGraduate_lg_field",title:"Begin Stop"}).text(1).css({top:aa*ha,left:K*ha}).data("coord","start").appendTo(ca),Na=Xa.clone().text(2).css({top:Ga*ha,left:ma*ha}).attr("title","End stop").data("coord","end").appendTo(ca),Ha=$("
    ").attr({"class":"grad_coord jGraduate_rg_field",title:"Center stop"}).text("C").css({top:Ra*ha,left:Ma* -ha}).data("coord","center").appendTo(ca),Pa=Ha.clone().text("F").css({top:Va*ha,left:Qa*ha,display:"none"}).attr("title","Focus point").data("coord","focus").appendTo(ca);Pa[0].id=q+"_jGraduate_focusCoord";$(M+" .grad_coord");$.each(["x1","y1","x2","y2","cx","cy","fx","fy"],function(na,ba){var va=ga.getAttribute(ba),O=isNaN(ba[1]);va||(va=O?"0.5":ba==="x2"?"1.0":"0.0");qa[ba]=$("#"+q+"_jGraduate_"+ba).val(va).change(function(){if(isNaN(parseFloat(this.value))||this.value<0)this.value=0;else if(this.value> -1)this.value=1;if(!(ba[0]==="f"&&!jb))if(O&&ea==="radialGradient"||!O&&ea==="linearGradient")ga.setAttribute(ba,this.value);var H=O?ba[0]==="c"?Ha:Pa:ba[1]==="1"?Xa:Na,Z=ba.indexOf("x")>=0?"left":"top";H.css(Z,this.value*ha)}).change()});var zb,Ja,Jb=$("#"+q+"_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]);ca=a("pattern",{width:16, -height:16,patternUnits:"userSpaceOnUse",id:"jGraduate_trans"},ab);a("image",{width:16,height:16},ca).setAttributeNS(n.xlink,"xlink:href",w.images.clientPath+"map-opacity.png");$(ab).click(function(na){Da=Jb.offset();if(na.target.tagName!=="path"){var ba=na.pageX-Da.left-8;ba=ba<10?10:ba>ha+10?ha+10:ba;o(ba/ha,0,0,true);na.stopPropagation()}});$(ab).mouseover(function(){ab.appendChild(Ka)});Ja=a("g",{},ab);a("line",{x1:10,y1:15,x2:ha+10,y2:15,"stroke-width":2,stroke:"#000"},ab);var rb=Q.find(".jGraduate_spreadMethod").change(function(){ga.setAttribute("spreadMethod", -$(this).val())}),sb=null,mb=function(na){var ba=na.pageX-Wa.left,va=na.pageY-Wa.top;ba=ba<0?0:ba>ha?ha:ba;va=va<0?0:va>ha?ha:va;sb.css("left",ba).css("top",va);ba/=ua;va/=ia;var O=sb.data("coord"),H=ga;switch(O){case "start":qa.x1.val(ba);qa.y1.val(va);H.setAttribute("x1",ba);H.setAttribute("y1",va);break;case "end":qa.x2.val(ba);qa.y2.val(va);H.setAttribute("x2",ba);H.setAttribute("y2",va);break;case "center":qa.cx.val(ba);qa.cy.val(va);H.setAttribute("cx",ba);H.setAttribute("cy",va);gb=ba;Ia=va; -e();break;case "focus":qa.fx.val(ba);qa.fy.val(va);H.setAttribute("fx",ba);H.setAttribute("fy",va);e()}na.preventDefault()},hb=function(){sb=null;fa.unbind("mousemove",mb).unbind("mouseup",hb)};zb=ga.getElementsByTagNameNS(n.svg,"stop");if(La<2){for(;La<2;){ga.appendChild(document.createElementNS(n.svg,"stop"));++La}zb=ga.getElementsByTagNameNS(n.svg,"stop")}var La=zb.length;for(ma=0;ma99.5)O=99.5;if(O>0)bb=1-O/100;else yb=-(O/100)-1;H=145*((O+100)/2)/100;Z&&e();break;case "angle":Sa=O;H=Sa/180;H+=0.5;H*=145;Z&&e()}if(H>145)H= -145;else if(H<0)H=0;va.css({"margin-left":H-5})}).change()});var Gb=function(na){var ba=na.pageX-nb.offset.left-parseInt(nb.parent.css("border-left-width"));if(ba>145)ba=145;if(ba<=0)ba=0;var va=ba-5;ba/=145;switch(nb.type){case "radius":ba=Math.pow(ba*2,2.5);if(ba>0.98&&ba<1.02)ba=1;if(ba<=0.01)ba=0.01;ga.setAttribute("r",ba);break;case "opacity":u.paint.alpha=parseInt(ba*100);ra.setAttribute("fill-opacity",ba);break;case "ellip":bb=yb=1;if(ba<0.5){ba/=0.5;yb=ba<=0?0.01:ba}else if(ba>0.5){ba/=0.5; -ba=2-ba;bb=ba<=0?0.01:ba}e();ba-=1;if(bb===ba+1)ba=Math.abs(ba);break;case "angle":ba-=0.5;Sa=ba*=180;e();ba/=100}nb.elem.css({"margin-left":va});ba=Math.round(ba*100);nb.input.val(ba);na.preventDefault()},Ob=function(){fa.unbind("mousemove",Gb).unbind("mouseup",Ob);nb=null};for(Q=(u.paint.alpha*255/100).toString(16);Q.length<2;)Q="0"+Q;Q=Q.split(".")[0];K=u.paint.solidColor=="none"?"":u.paint.solidColor+Q;ta||(K=zb[0].getAttribute("stop-color"));$.extend($.fn.jPicker.defaults.window,{alphaSupport:true, -effects:{type:"show",speed:0}});W.jPicker({window:{title:w.window.pickerTitle},images:{clientPath:w.images.clientPath},color:{active:K,alphaSupport:true}},function(na){u.paint.type="solidColor";u.paint.alpha=na.val("ahex")?Math.round(na.val("a")/255*100):100;u.paint.solidColor=na.val("hex")?na.val("hex"):"none";u.paint.radialGradient=null;U()},null,function(){P()});var Kb=$(M+" .jGraduate_tabs li");Kb.click(function(){Kb.removeClass("jGraduate_tab_current");$(this).addClass("jGraduate_tab_current"); -$(M+" > div").hide();var na=$(this).attr("data-type");$(M+" .jGraduate_gradPick").show();if(na==="rg"||na==="lg"){$(".jGraduate_"+na+"_field").show();$(".jGraduate_"+(na==="lg"?"rg":"lg")+"_field").hide();$("#"+q+"_jgraduate_rect")[0].setAttribute("fill","url(#"+q+"_"+na+"_jgraduate_grad)");ea=na==="lg"?"linearGradient":"radialGradient";$("#"+q+"_jGraduate_OpacInput").val(u.paint.alpha).change();var ba=$("#"+q+"_"+na+"_jgraduate_grad")[0];if(ga!==ba){var va=$(ga).find("stop");$(ba).empty().append(va); -ga=ba;ba=rb.val();ga.setAttribute("spreadMethod",ba)}jb=na==="rg"&&ga.getAttribute("fx")!=null&&!(Ma==Qa&&Ra==Va);$("#"+q+"_jGraduate_focusCoord").toggle(jb);if(jb)$("#"+q+"_jGraduate_match_ctr")[0].checked=false}else{$(M+" .jGraduate_gradPick").hide();$(M+" .jGraduate_colPick").show()}});$(M+" > div").hide();Kb.removeClass("jGraduate_tab_current");var Ub;switch(u.paint.type){case "linearGradient":Ub=$(M+" .jGraduate_tab_lingrad");break;case "radialGradient":Ub=$(M+" .jGraduate_tab_radgrad");break; -default:Ub=$(M+" .jGraduate_tab_color")}u.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 n(f,c){for(var m=f[c],o=document.body;(f=f.offsetParent)&&f!=o;)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? +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? 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 o=svgEditor.tool_scale||1,b=$(f).height()/2;c=c>n(f,"offsetLeft")+f.offsetWidth*o-this.spinCfg._btn_width?mo(f,"offsetLeft")+f.offsetWidth*p-this.spinCfg._btn_width?m=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 n=a.changedTouches,f=n[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(n.length<2){f.target.dispatchEvent(m);a.preventDefault()}};jQuery&&function(){var a=$(window),n=$(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),o=$(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 u=e.pageX,w=e.pageY;e=a.width()-b.width();var q=a.height()-b.height();if(u>e-15)u=e-15;if(w>q-30)w=q-30;n.unbind("click");b.css({top:w,left:u}).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")});n.keypress(function(M){switch(M.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:n.trigger("click")}});b.find("A").unbind("mouseup");b.find("LI:not(.disabled) A").mouseup(function(){n.unbind("click").unbind("keypress"); -$(".contextMenu").hide();c&&c($(this).attr("href").substr(1),$(l),{x:u-o.left,y:w-o.top,docX:u,docY:w});return false});setTimeout(function(){n.click(function(){n.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(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 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"); +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,o=n.indexOf("Gecko/")>=0,b=n.indexOf("MSIE")>=0,d=n.indexOf("Chrome/")>=0,e=n.indexOf("Windows")>=0,l=n.indexOf("Macintosh")>= -0,u="ontouchstart"in window,w=!!f.querySelector,q=!!document.evaluate,M=function(){var ua=document.createElementNS("http://www.w3.org/2000/svg","path");ua.setAttribute("d","M0,0 10,10");var ia=ua.pathSegList;ua=ua.createSVGPathSegLinetoAbs(5,5);try{ia.replaceItem(ua,0);return true}catch(ea){}return false}(),U=function(){var ua=document.createElementNS("http://www.w3.org/2000/svg","path");ua.setAttribute("d","M0,0 10,10");var ia=ua.pathSegList;ua=ua.createSVGPathSegLinetoAbs(5,5);try{ia.insertItemBefore(ua, -0);return true}catch(ea){}return false}(),P=function(){var ua=document.createElementNS("http://www.w3.org/2000/svg","svg"),ia=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(ua);ia.setAttribute("x",5);ua.appendChild(ia);var ea=document.createElementNS("http://www.w3.org/2000/svg","text");ea.textContent="a";ia.appendChild(ea);ia=ea.getStartPositionOfChar(0).x;document.documentElement.removeChild(ua);return ia===0}(),K=function(){var ua=document.createElementNS("http://www.w3.org/2000/svg", -"svg");document.documentElement.appendChild(ua);var ia=document.createElementNS("http://www.w3.org/2000/svg","path");ia.setAttribute("d","M0,0 C0,0 10,10 10,0");ua.appendChild(ia);ia=ia.getBBox();document.documentElement.removeChild(ua);return ia.height>4&&ia.height<5}(),fa=function(){var ua=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(ua);var ia=document.createElementNS("http://www.w3.org/2000/svg","path");ia.setAttribute("d","M0,0 10,0");var ea= -document.createElementNS("http://www.w3.org/2000/svg","path");ea.setAttribute("d","M5,0 15,0");var ga=document.createElementNS("http://www.w3.org/2000/svg","g");ga.appendChild(ia);ga.appendChild(ea);ua.appendChild(ga);ia=ga.getBBox();document.documentElement.removeChild(ua);return ia.width==15}(),W=function(){var ua=document.createElementNS("http://www.w3.org/2000/svg","rect");ua.setAttribute("x",0.1);(ua=ua.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 ua}(),Q=function(){var ua=document.createElementNS("http://www.w3.org/2000/svg","rect");ua.setAttribute("style","vector-effect:non-scaling-stroke");return ua.style.vectorEffect==="non-scaling-stroke"}(),ha=function(){var ua=document.createElementNS("http://www.w3.org/2000/svg","rect").transform.baseVal,ia=f.createSVGTransform();ua.appendItem(ia);return ua.getItem(0)==ia}();svgedit.browser.isOpera=function(){return c};svgedit.browser.isWebkit=function(){return m};svgedit.browser.isGecko=function(){return o}; -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 u};svgedit.browser.supportsSelectors=function(){return w};svgedit.browser.supportsXpath=function(){return q};svgedit.browser.supportsPathReplaceItem=function(){return M};svgedit.browser.supportsPathInsertItemBefore=function(){return U};svgedit.browser.supportsPathBBox=function(){return K}; -svgedit.browser.supportsHVLineContainerBBox=function(){return fa};svgedit.browser.supportsGoodTextCharPos=function(){return P};svgedit.browser.supportsEditableText=function(){return c};svgedit.browser.supportsGoodDecimals=function(){return W};svgedit.browser.supportsNonScalingStroke=function(){return Q};svgedit.browser.supportsNativeTransformLists=function(){return ha}}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"),n={};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 o=null;if(m>=0)if(m=0){this._removeFromOtherLists(c);o=this._xforms[m]=c;this._list._update()}return o};this.removeItem=function(c){if(c=0){for(var m=this._xforms[c],o=Array(this.numberOfItems- -1),b=0;b1;)c=n[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(n){if(!n)return false;for(var f=n.numberOfItems;f--;){var c=n.getItem(f);if(c.type==1&&!svgedit.math.isIdentity(c.matrix))return true}return false};svgedit.math.transformBox=function(n,f,c,m,o){var b={x:n,y:f},d={x:n+c,y:f};c={x:n+c,y:f+m};n={x:n,y:f+m};f=svgedit.math.transformPoint;b=f(b.x,b.y,o);var e=m=b.x,l=b.y,u=b.y;d=f(d.x,d.y,o);m=Math.min(m,d.x);e=Math.max(e,d.x); -l=Math.min(l,d.y);u=Math.max(u,d.y);n=f(n.x,n.y,o);m=Math.min(m,n.x);e=Math.max(e,n.x);l=Math.min(l,n.y);u=Math.max(u,n.y);c=f(c.x,c.y,o);m=Math.min(m,c.x);e=Math.max(e,c.x);l=Math.min(l,c.y);u=Math.max(u,c.y);return{tl:b,tr:d,bl:n,br:c,aabox:{x:m,y:l,width:e-m,height:u-l}}};svgedit.math.transformListToTransform=function(n,f,c){if(n==null)return a.createSVGTransformFromMatrix(a.createSVGMatrix());f=f==undefined?0:f;c=c==undefined?n.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 o=f>=0&&fn.x&&f.yn.y}})();svgedit=svgedit||{}; -(function(){if(!svgedit.units)svgedit.units={};var a=["x","x1","cx","rx","width"],n=["y","y1","cy","ry","height"],f=$.merge(["r","radius"],a);$.merge(f,n);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); +(function(){if(!svgedit.browser)svgedit.browser={};var a=!!document.createElementNS&&!!document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect;svgedit.browser.supportsSvg=function(){return a};if(svgedit.browser.supportsSvg()){var o=navigator.userAgent,f=document.createElementNS("http://www.w3.org/2000/svg","svg"),c=!!window.opera,m=o.indexOf("AppleWebKit")>=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;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&&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 o={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=o[d])for(var l=d.length,u=0;u=0?e*l:n.indexOf(b)>=0?e*u:e*Math.sqrt(l*l+u*u)/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(q){if(!l)if(RegExp("^-?[\\d\\.]+"+q+"$").test(d))l=true})}else l=true;else if(b=="id"){b=false;try{var u=c.getElement(d); -b=u==null||u===e}catch(w){}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 u=$(e).children().clone().attr("visibility","hidden");$(o).append(u);l=u.filter("line, path")}else l=$(b).find("line, path");var w=false;if(l.length){l.each(function(){var q=this.getBBox();if(!q.width||!q.height)w=true});if(w){b=e?u:$(b).children();ret=getStrokedBBox(b)}else ret=b.getBBox()}else ret=b.getBBox();e&&u.remove();return ret}if(!svgedit.utilities)svgedit.utilities= -{};var n="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use".split(","),f=null,c=null,m=null,o=null;svgedit.utilities.init=function(b){f=b;c=b.getDOMDocument();m=b.getDOMContainer();o=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,u,w,q,M,U=0,P=0;do{e=b.charCodeAt(U++);l=b.charCodeAt(U++);u=b.charCodeAt(U++);w=e>>2;e=(e&3)<<4|l>>4;q=(l&15)<<2|u>>6;M=u&63;if(isNaN(l))q=M=64;else if(isNaN(u))M=64;d[P++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(w);d[P++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(e);d[P++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(q);d[P++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(M)}while(U< -b.length);return d.join("")};svgedit.utilities.decode64=function(b){if(window.atob)return window.atob(b);var d="",e,l,u="",w,q="",M=0;b=b.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(M++));l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(M++));w="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(M++));q="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(M++)); -e=e<<2|l>>4;l=(l&15)<<4|w>>2;u=(w&3)<<6|q;d+=String.fromCharCode(e);if(w!=64)d+=String.fromCharCode(l);if(q!=64)d+=String.fromCharCode(u)}while(M127)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(u){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)}}; +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)}}; 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), -u=[l.x,l.y];for(l=0;l= -0){var l=e.split(":");b[l[1]]=n[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 o=m.parentNode;if(m.ownerDocument&&o){var b=f[m.nodeName],d=c[m.nodeName];if(b!=undefined){for(var e=[],l=m.attributes.length;l--;){var u=m.attributes.item(l),w=u.nodeName, -q=u.localName,M=u.namespaceURI;if(!(d.hasOwnProperty(q)&&M==d[q]&&M!="http://www.w3.org/2000/xmlns/")&&!(M=="http://www.w3.org/2000/xmlns/"&&a[u.nodeValue])){w.indexOf("se:")==0&&e.push([w,u.nodeValue]);m.removeAttributeNS(M,q)}if(svgedit.browser.isGecko())switch(w){case "transform":case "gradientTransform":case "patternTransform":q=u.nodeValue.replace(/(\d)-/g,"$1 -");m.setAttribute(w,q)}if(w=="style"){u=u.nodeValue.split(";");for(w=u.length;w--;){q=u[w].split(":");b.indexOf(q[0])>=0&&m.setAttribute(q[0], -q[1])}m.removeAttribute("style")}}$.each(e,function(U,P){m.setAttributeNS("http://svg-edit.googlecode.com",P[0],P[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))o.removeChild(m);else{$.each(["clip-path","fill","filter","marker-end","marker-mid","marker-start", -"mask","stroke"],function(U,P){var K=m.getAttribute(P);if(K)if((K=svgedit.utilities.getUrlFromAttr(K))&&K[0]!=="#"){m.setAttribute(P,"");m.removeAttribute(P)}});for(l=m.childNodes.length;l--;)svgedit.sanitize.sanitizeSvg(m.childNodes.item(l))}}else{for(b=[];m.hasChildNodes();)b.push(o.insertBefore(m.firstChild,m));o.removeChild(m);for(l=b.length;l--;)svgedit.sanitize.sanitizeSvg(b[l])}}}}})();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,n,f,c){this.elem=a;this.text=c?"Move "+a.tagName+" to "+c:"Move "+a.tagName;this.oldNextSibling=n;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= +"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(m,p){var b={};$.each(p,function(d,e){if(e.indexOf(":")>= +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||{}; +(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,n){this.elem=a;this.text=n||"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= +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= svgedit.history.InsertElementCommand.type;svgedit.history.InsertElementCommand.prototype.getText=function(){return this.text};svgedit.history.InsertElementCommand.prototype.apply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APPLY,this);this.elem=this.parent.insertBefore(this.elem,this.nextSibling);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_APPLY,this)};svgedit.history.InsertElementCommand.prototype.unapply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_UNAPPLY, -this);this.parent=this.elem.parentNode;this.elem=this.elem.parentNode.removeChild(this.elem);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_UNAPPLY,this)};svgedit.history.InsertElementCommand.prototype.elements=function(){return[this.elem]};svgedit.history.RemoveElementCommand=function(a,n,f,c){this.elem=a;this.text=c||"Delete "+a.tagName;this.nextSibling=n;this.parent=f;svgedit.transformlist.removeElementFromListMap(a)};svgedit.history.RemoveElementCommand.type=function(){return"svgedit.history.RemoveElementCommand"}; +this);this.parent=this.elem.parentNode;this.elem=this.elem.parentNode.removeChild(this.elem);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_UNAPPLY,this)};svgedit.history.InsertElementCommand.prototype.elements=function(){return[this.elem]};svgedit.history.RemoveElementCommand=function(a,o,f,c){this.elem=a;this.text=c||"Delete "+a.tagName;this.nextSibling=o;this.parent=f;svgedit.transformlist.removeElementFromListMap(a)};svgedit.history.RemoveElementCommand.type=function(){return"svgedit.history.RemoveElementCommand"}; svgedit.history.RemoveElementCommand.prototype.type=svgedit.history.RemoveElementCommand.type;svgedit.history.RemoveElementCommand.prototype.getText=function(){return this.text};svgedit.history.RemoveElementCommand.prototype.apply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APPLY,this);svgedit.transformlist.removeElementFromListMap(this.elem);this.parent=this.elem.parentNode;this.elem=this.parent.removeChild(this.elem);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_APPLY, this)};svgedit.history.RemoveElementCommand.prototype.unapply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_UNAPPLY,this);svgedit.transformlist.removeElementFromListMap(this.elem);this.nextSibling==null&&window.console&&console.log("Error: reference element was lost");this.parent.insertBefore(this.elem,this.nextSibling);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_UNAPPLY,this)};svgedit.history.RemoveElementCommand.prototype.elements=function(){return[this.elem]}; -svgedit.history.ChangeElementCommand=function(a,n,f){this.elem=a;this.text=f?"Change "+a.tagName+" "+f:"Change "+a.tagName;this.newValues={};this.oldValues=n;for(var c in n)this.newValues[c]=c=="#text"?a.textContent:c=="#href"?svgedit.utilities.getHref(a):a.getAttribute(c)};svgedit.history.ChangeElementCommand.type=function(){return"svgedit.history.ChangeElementCommand"};svgedit.history.ChangeElementCommand.prototype.type=svgedit.history.ChangeElementCommand.type;svgedit.history.ChangeElementCommand.prototype.getText= -function(){return this.text};svgedit.history.ChangeElementCommand.prototype.apply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APPLY,this);var n=false,f;for(f in this.newValues){if(this.newValues[f])if(f=="#text")this.elem.textContent=this.newValues[f];else f=="#href"?svgedit.utilities.setHref(this.elem,this.newValues[f]):this.elem.setAttribute(f,this.newValues[f]);else if(f=="#text")this.elem.textContent="";else{this.elem.setAttribute(f,"");this.elem.removeAttribute(f)}if(f== -"transform")n=true}if(!n)if(n=svgedit.utilities.getRotationAngle(this.elem)){f=elem.getBBox();n=["rotate(",n," ",f.x+f.width/2,",",f.y+f.height/2,")"].join("");n!=elem.getAttribute("transform")&&elem.setAttribute("transform",n)}a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_APPLY,this);return true};svgedit.history.ChangeElementCommand.prototype.unapply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_UNAPPLY,this);var n=false,f;for(f in this.oldValues){if(this.oldValues[f])if(f== -"#text")this.elem.textContent=this.oldValues[f];else f=="#href"?svgedit.utilities.setHref(this.elem,this.oldValues[f]):this.elem.setAttribute(f,this.oldValues[f]);else if(f=="#text")this.elem.textContent="";else this.elem.removeAttribute(f);if(f=="transform")n=true}if(!n)if(n=svgedit.utilities.getRotationAngle(this.elem)){f=elem.getBBox();n=["rotate(",n," ",f.x+f.width/2,",",f.y+f.height/2,")"].join("");n!=elem.getAttribute("transform")&&elem.setAttribute("transform",n)}svgedit.transformlist.removeElementFromListMap(this.elem); +svgedit.history.ChangeElementCommand=function(a,o,f){this.elem=a;this.text=f?"Change "+a.tagName+" "+f:"Change "+a.tagName;this.newValues={};this.oldValues=o;for(var c in o)this.newValues[c]=c=="#text"?a.textContent:c=="#href"?svgedit.utilities.getHref(a):a.getAttribute(c)};svgedit.history.ChangeElementCommand.type=function(){return"svgedit.history.ChangeElementCommand"};svgedit.history.ChangeElementCommand.prototype.type=svgedit.history.ChangeElementCommand.type;svgedit.history.ChangeElementCommand.prototype.getText= +function(){return this.text};svgedit.history.ChangeElementCommand.prototype.apply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APPLY,this);var o=false,f;for(f in this.newValues){if(this.newValues[f])if(f=="#text")this.elem.textContent=this.newValues[f];else f=="#href"?svgedit.utilities.setHref(this.elem,this.newValues[f]):this.elem.setAttribute(f,this.newValues[f]);else if(f=="#text")this.elem.textContent="";else{this.elem.setAttribute(f,"");this.elem.removeAttribute(f)}if(f== +"transform")o=true}if(!o)if(o=svgedit.utilities.getRotationAngle(this.elem)){f=elem.getBBox();o=["rotate(",o," ",f.x+f.width/2,",",f.y+f.height/2,")"].join("");o!=elem.getAttribute("transform")&&elem.setAttribute("transform",o)}a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_APPLY,this);return true};svgedit.history.ChangeElementCommand.prototype.unapply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_UNAPPLY,this);var o=false,f;for(f in this.oldValues){if(this.oldValues[f])if(f== +"#text")this.elem.textContent=this.oldValues[f];else f=="#href"?svgedit.utilities.setHref(this.elem,this.oldValues[f]):this.elem.setAttribute(f,this.oldValues[f]);else if(f=="#text")this.elem.textContent="";else this.elem.removeAttribute(f);if(f=="transform")o=true}if(!o)if(o=svgedit.utilities.getRotationAngle(this.elem)){f=elem.getBBox();o=["rotate(",o," ",f.x+f.width/2,",",f.y+f.height/2,")"].join("");o!=elem.getAttribute("transform")&&elem.setAttribute("transform",o)}svgedit.transformlist.removeElementFromListMap(this.elem); a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_UNAPPLY,this);return true};svgedit.history.ChangeElementCommand.prototype.elements=function(){return[this.elem]};svgedit.history.BatchCommand=function(a){this.text=a||"Batch Command";this.stack=[]};svgedit.history.BatchCommand.type=function(){return"svgedit.history.BatchCommand"};svgedit.history.BatchCommand.prototype.type=svgedit.history.BatchCommand.type;svgedit.history.BatchCommand.prototype.getText=function(){return this.text};svgedit.history.BatchCommand.prototype.apply= -function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APPLY,this);for(var n=this.stack.length,f=0;f=0;n--)this.stack[n].unapply(a);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_UNAPPLY, -this)};svgedit.history.BatchCommand.prototype.elements=function(){for(var a=[],n=this.stack.length;n--;)for(var f=this.stack[n].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= +function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APPLY,this);for(var o=this.stack.length,f=0;f=0;o--)this.stack[o].unapply(a);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_UNAPPLY, +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,n){for(var f=++this.undoChangeStackPointer,c=n.length,m=Array(c),o=Array(c);c--;){var b=n[c];if(b!=null){o[c]=b;m[c]=b.getAttribute(a)}}this.undoableChangeStack[f]= -{attrName:a,oldValues:m,elements:o}};svgedit.history.UndoManager.prototype.finishUndoableChange=function(){for(var a=this.undoChangeStackPointer--,n=this.undoableChangeStack[a],f=n.elements.length,c=n.attrName,m=new svgedit.history.BatchCommand("Change "+c);f--;){var o=n.elements[f];if(o!=null){var b={};b[c]=n.oldValues[f];b[c]!=o.getAttribute(c)&&m.addSubCommand(new svgedit.history.ChangeElementCommand(o,b,c))}}this.undoableChangeStack[a]=null;return m}})();svgedit=svgedit||{}; -(function(){if(!svgedit.select)svgedit.select={};var a,n,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 o in f.selectorGrips)m.push(o);for(;c>0;){m.push(m.shift());c--}c=0;for(o in f.selectorGrips){f.selectorGrips[o].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,o=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 u=b.tagName;if(u==="text")l+=2/e;d=svgedit.transformlist.getTransformList(b);d=svgedit.math.transformListToTransform(d).matrix;d.e*=e;d.f*=e;var w=svgedit.utilities.getBBox(b);if(u==="g"&&!$.data(b,"gsvg"))if(u=a.getStrokedBBox(b.childNodes))w=u;u=w.x;var q=w.y,M=w.width;w=w.height;l*=e;e=svgedit.math.transformBox(u*e,q*e,M*e,w*e,d);d=e.aabox;u=d.x-l;q=d.y-l;M=d.width+l*2;var U=d.height+l*2;d=u+M/2;w=q+U/2;if(b=svgedit.utilities.getRotationAngle(b)){u=a.svgRoot().createSVGTransform(); -u.setRotate(-b,d,w);u=u.matrix;e.tl=svgedit.math.transformPoint(e.tl.x,e.tl.y,u);e.tr=svgedit.math.transformPoint(e.tr.x,e.tr.y,u);e.bl=svgedit.math.transformPoint(e.bl.x,e.bl.y,u);e.br=svgedit.math.transformPoint(e.br.x,e.br.y,u);u=e.tl;M=u.x;U=u.y;var P=u.x,K=u.y;u=Math.min;q=Math.max;M=u(M,u(e.tr.x,u(e.bl.x,e.br.x)))-l;U=u(U,u(e.tr.y,u(e.bl.y,e.br.y)))-l;P=q(P,q(e.tr.x,q(e.bl.x,e.br.x)))+l;K=q(K,q(e.tr.y,q(e.bl.y,e.br.y)))+l;u=M;q=U;M=P-M;U=K-U}l=a.svgRoot().suspendRedraw(100);c.setAttribute("d", -"M"+u+","+q+" L"+(u+M)+","+q+" "+(u+M)+","+(q+U)+" "+u+","+(q+U)+"z");this.selectorGroup.setAttribute("transform",b?"rotate("+[b,d,w].join(",")+")":"");u-=3.5;q-=3.5;this.gripCoords={nw:[u,q],ne:[u+M,q],sw:[u,q+U],se:[u+M,q+U],n:[u+M/2,q],w:[u,q+U/2],e:[u+M,q+U/2],s:[u+M/2,q+U]};for(var fa in this.gripCoords){c=this.gripCoords[fa];o[fa].setAttribute("x",c[0]);o[fa].setAttribute("y",c[1])}this.rotateCoords={nw:[u,q],ne:[u+M+8,q],sw:[u,q+U+8],se:[u+M+8,q+U+8]};for(fa in this.rotateCoords){c=this.rotateCoords[fa]; -m.rotateGrips[fa].setAttribute("cx",c[0]);m.rotateGrips[fa].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&& +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("+n.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=n.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 o=0;o element";this.svgElem_=c;this.obj_num=0;this.idPrefix=m||"svg_";this.releasedNums=[];this.all_layers=[];this.current_layer=null;this.nonce_= -"";var o=this.svgElem_.getAttributeNS("http://svg-edit.googlecode.com","nonce");if(o&&f!=n.NEVER_RANDOMIZE)this.nonce_=o;else f==n.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,m){this.name_=c;this.group_=m};svgedit.draw.Layer.prototype.getName=function(){return this.name_};svgedit.draw.Layer.prototype.getGroup=function(){return this.group_};svgedit.draw.randomizeIds=function(c,m){f=c==false?o.NEVER_RANDOMIZE: +o.ALWAYS_RANDOMIZE;if(f==o.ALWAYS_RANDOMIZE&&!m.getNonce())m.setNonce(Math.floor(Math.random()*100001));else f==o.NEVER_RANDOMIZE&&m.getNonce()&&m.clearNonce()};svgedit.draw.Drawing=function(c,m){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=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_}; 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 o=this.getId();this.getElem_(o);){if(m){this.obj_num=c;m=false}this.obj_num++;o=this.getId()}if(m)this.obj_num=c;return o};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.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=[],o=[],b=null,d=false,e=0;e0||!d){for(e=1;o.indexOf("Layer "+e)>=0;)e++;o="Layer "+e;b=c.createElementNS("http://www.w3.org/2000/svg","g");d=c.createElementNS("http://www.w3.org/2000/svg","title");d.textContent=o; -b.appendChild(d);for(d=0;d1))for(var o=0;o1){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){d=U0){d=S 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],M=l-1<0?null:d[l-1];if(w.type===2){if(M&&M.type!==1){q=d[u];q.next=d[u+1];q.next.prev=q;q.addGrip()}u=l}else if(q&&q.type===1){w.next=d[u+1];w.next.prev=w;w.mate=d[u];w.addGrip();if(this.first_seg==null)this.first_seg=w}else if(q){if(w.type!== -1){w.addGrip();if(q&&q.type!==2){w.next=q;w.next.prev=w}}}else if(w.type!==1){q=d[u];q.next=d[u+1];q.next.prev=q;q.addGrip();w.addGrip();if(!this.first_seg)this.first_seg=d[u]}}return this};svgedit.path.Path.prototype.eachSeg=function(d){for(var e=this.segs.length,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').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:o[0],height:o[1],x:o[0],y:o[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 u="svg_";b.setIdPrefix= -function(g){u=g};b.current_drawing_=new svgedit.draw.Drawing(l,u);var w=b.getCurrentDrawing=function(){return b.current_drawing_},q=1,M=null,U={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}};U.text=$.extend(true,{},U.shape);$.extend(U.text, -{fill:"#000000",stroke_width:0,font_size:24,font_family:"Junction"});var P=U.shape,K=Array(1),fa=this.addSvgElementFromJson=function(g){var h=svgedit.utilities.getElem(g.attr.id),k=w().getCurrentLayer();if(h&&g.element!=h.tagName){k.removeChild(h);h=null}if(!h){h=d.createElementNS(c,g.element);if(k)(M||k).appendChild(h)}g.curStyles&&svgedit.utilities.assignAttributes(h,{fill:P.fill,stroke:P.stroke,"stroke-width":P.stroke_width,"stroke-dasharray":P.stroke_dasharray,"stroke-linejoin":P.stroke_linejoin, -"stroke-linecap":P.stroke_linecap,"stroke-opacity":P.stroke_opacity,"fill-opacity":P.fill_opacity,opacity:P.opacity/2,style:"pointer-events:inherit"},100);svgedit.utilities.assignAttributes(h,g.attr,100);svgedit.utilities.cleanupElement(h);return h},W=b.getTransformList=svgedit.transformlist.getTransformList,Q=svgedit.math.transformPoint,ha=b.matrixMultiply=svgedit.math.matrixMultiply,ua=b.hasMatrixTransform=svgedit.math.hasMatrixTransform,ia=b.transformListToTransform=svgedit.math.transformListToTransform, -ea=svgedit.math.snapToAngle,ga=svgedit.math.getMatrix;svgedit.units.init({getBaseUnit:function(){return m.baseUnit},getElement:svgedit.utilities.getElem,getHeight:function(){return l.getAttribute("height")/q},getWidth:function(){return l.getAttribute("width")/q},getRoundDigits:function(){return bb.round_digits}});var ra=b.convertToNum=svgedit.units.convertToNum;svgedit.utilities.init({getDOMDocument:function(){return d},getDOMContainer:function(){return a},getSVGRoot:function(){return e},getSelectedElements:function(){return K}, -getSVGContent:function(){return l}});var qa=b.getUrlFromAttr=svgedit.utilities.getUrlFromAttr,ca=b.getHref=svgedit.utilities.getHref,T=b.setHref=svgedit.utilities.setHref,V=svgedit.utilities.getPathBBox;b.getBBox=svgedit.utilities.getBBox;var sa=b.getRotationAngle=svgedit.utilities.getRotationAngle,ta=b.getElem=svgedit.utilities.getElem,aa=b.assignAttributes=svgedit.utilities.assignAttributes,ma=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 v=h.elements();b.pathActions.clear();H("changed",v);v=h.type();k=g==k.AFTER_APPLY;if(v== -Ra.type()){k=k?h.newParent:h.oldParent;k==l&&b.identifyLayers()}else if(v==Qa.type()||v==Va.type()){h.parent==l&&b.identifyLayers();if(v==Qa.type())k&&$a(h.elem);else k||$a(h.elem);h.elem.tagName==="use"&&gc(h.elem)}else if(v==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()){v=h.elem;if(!v.getAttribute("x")&&!v.getAttribute("y")){k= -v.parentNode;var s=v.nextSibling;k.removeChild(v);k.insertBefore(v,s)}}}}}});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 q},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 q}, +$.SvgCanvas=function(a,o){function f(g,h){for(var k=svgedit.utilities.getBBox(g),w=0;w<2;w++){var v=w===0?"fill":"stroke",G=g.getAttribute(v);if(G&&G.indexOf("url(")===0){G=fa(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=Q(z,A,h);F=Q(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=P();Bb().appendChild(G);g.setAttribute(v,"url(#"+G.id+")")}}}}var c="http://www.w3.org/2000/svg",m={show_outside_canvas:true,selectNew:true,dimensions:[640,480]};o&&$.extend(m,o);var p=m.dimensions,b=this,d=a.ownerDocument,e=d.importNode(svgedit.utilities.text2xml('').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, +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 v=h[k];if(v&&v.indexOf("url(")===0){v=qa(v).substr(1);if(!ta(v)){Bb().appendChild(Fb[v]);delete Fb[v]}}}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 L=F.getAttribute("rx"),I=F.getAttribute("ry");if(L||I)E=D=b.convertToPath(F,true)}if(!D){var N=F.cloneNode(true),X=document.createElementNS(c,"g"),R=F.parentNode;R.appendChild(X);X.appendChild(N);E=svgedit.utilities.bboxToObj(X.getBBox());R.removeChild(X)}}return E}catch(pa){console.log(F, -pa);return null}},k;$.each(g,function(){if(!k)if(this.parentNode)k=h(this)});if(k==null)return null;var v=k.x+k.width,s=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 L=A(E);G=Math.min(G,D.x-L);z=Math.min(z,D.y-L);C.push(D)}});k.x=G;k.y=z;$.each(g,function(F,E){var D=C[F];if(D&&E.nodeType==1){var L=A(E);v=Math.max(v,D.x+D.width+L);s=Math.max(s,D.y+D.height+ -L)}});k.width=v-G;k.height=s-z;return k};var Kb=this.getVisibleElements=function(g){g||(g=$(l).children());var h=[];$(g).children().each(function(k,v){try{v.getBBox()&&h.push(v)}catch(s){}});return h.reverse()},Ub=this.getVisibleElementsAndBBoxes=function(g){g||(g=$(l).children());var h=[];$(g).children().each(function(k,v){try{v.getBBox()&&h.push({elem:v,bbox:getStrokedBBox([v])})}catch(s){}});return h.reverse()},na=this.groupSvgElem=function(g){var h=document.createElementNS(c,"g");g.parentNode.replaceChild(h, -g);$(h).append(g).data("gsvg",g)[0].id=O()},ba=function(g){var h=document.createElementNS(g.namespaceURI,g.nodeName);h.removeAttribute("id");$.each(g.attributes,function(v,s){s.localName!="-moz-math-font-style"&&h.setAttributeNS(s.namespaceURI,s.nodeName,s.nodeValue)});if(svgedit.browser.isWebkit()&&g.nodeName=="path"){var k=Ua.convertPath(g);h.setAttribute("d",k)}$.each(g.childNodes,function(v,s){switch(s.nodeType){case 1:h.appendChild(ba(s));break;case 3:h.textContent=s.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=O();return h},va,O,H;(function(g){var h={};va=g.getId=function(){return w().getId()};O=g.getNextId=function(){return w().getNextId()};H=g.call=function(k,v){if(h[k])return h[k](this,v)};g.bind=function(k,v){var s=h[k];h[k]=v;return s}})(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 v=g[h];v.setAttribute("d",Ua.convertPath(v));Ua.fixEnd(v)}};var Z=this.getRefElem=function(g){return ta(qa(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);K[0]=h;Pa.requestSelector(h).showGrips(true);return h};this.setRotationAngle=function(g,h){g=parseFloat(g);var k=K[0],v=k.getAttribute("transform"),s=svgedit.utilities.getBBox(k),G=s.x+s.width/2,z=s.y+s.height/ -2;s=W(k);s.numberOfItems>0&&s.getItem(0).type==4&&s.removeItem(0);if(g!=0){G=Q(G,z,ia(s).matrix);z=e.createSVGTransform();z.setRotate(g,G.x,G.y);s.numberOfItems?s.insertItemBefore(z,0):s.appendItem(z)}else s.numberOfItems==0&&k.removeAttribute("transform");if(!h){s=k.getAttribute("transform");k.setAttribute("transform",v);ub("transform",s,K);H("changed",K)}ta("pathpointgrip_container");k=Pa.requestSelector(K[0]);k.resize();k.updateGripCursors(g)};var Za=this.recalculateAllSelectedDimensions=function(){for(var g= -new Na(rb=="none"?"position":"size"),h=K.length;h--;){var k=pb(K[h]);k&&g.addSubCommand(k)}if(!g.isEmpty()){Ha(g);H("changed",K)}},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 v=m.gridSnapping&&g.parentNode.parentNode.localName==="svg",s=function(){if(v)for(var D in h)h[D]=Ja(h[D]);aa(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=Z(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=O();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=ia(g).matrix; -z=ha(z.inverse(),k,z);h.x=parseFloat(h.x)+z.e;h.y=parseFloat(h.y)+z.f}else{z=W(g);A=e.createSVGTransform();A.setMatrix(ha(ia(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=W(g);A=e.createSVGTransform();A.setMatrix(ha(ia(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)}s(); -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);s();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);s();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=ra("x",g.getAttribute("x")); -A=ra("x",k[G].getAttribute("x"));C=ra("y",g.getAttribute("y"));F=ra("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)aa(k[G],E,1E3,true)}s();break;case "use":s();break;case "g":(s=$(g).data("gsvg"))&&aa(s,h,1E3,true);break;case "polyline":case "polygon":s=h.points.length;for(G=0;G0){for(var k=h.numberOfItems;k--;){var v=h.getItem(k);if(v.type===0)h.removeItem(k);else if(v.type=== -1)svgedit.math.isIdentity(v.matrix)&&h.removeItem(k);else v.type===4&&v.angle===0&&h.removeItem(k)}if(h.numberOfItems===1&&sa(g))return null}if(!h||h.numberOfItems==0){g.removeAttribute("transform");return null}if(h){k=h.numberOfItems;for(var s=[];k--;){v=h.getItem(k);if(v.type===1)s.push([v.matrix,k]);else if(s.length)s=[]}if(s.length===2){k=e.createSVGTransformFromMatrix(ha(s[1][0],s[0][0]));h.removeItem(s[0][1]);h.removeItem(s[1][1]);h.insertItemBefore(k,s[1][1])}k=h.numberOfItems;if(k>=2&&h.getItem(k- -2).type===1&&h.getItem(k-1).type===2){s=e.createSVGTransform();v=ha(h.getItem(k-2).matrix,h.getItem(k-1).matrix);s.setMatrix(v);h.removeItem(k-2);h.removeItem(k-2);h.appendItem(s)}}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;v=[];switch(g.tagName){case "line":v=["x1","y1", -"x2","y2"];break;case "circle":v=["cx","cy","r"];break;case "ellipse":v=["cx","cy","rx","ry"];break;case "foreignObject":case "rect":case "image":v=["width","height","x","y"];break;case "use":case "text":case "tspan":v=["x","y"];break;case "polygon":case "polyline":A={};A.points=g.getAttribute("points");s=g.points;var C=s.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(I-2).type==3&&h.getItem(I-3).type==2&&h.getItem(I-1).type==2){F=3;var X=h.getItem(I-3).matrix,R=h.getItem(I-2).matrix,pa=h.getItem(I-1).matrix;C=g.childNodes;for(E=C.length;E--;){var xa=C.item(E);v=G=0;if(xa.nodeType==1){var da=W(xa);if(da){v=ia(da).matrix;G=sa(xa);var ka=gb,oa=[];gb=xa.getAttribute("transform");if(G||ua(da)){var za= -e.createSVGTransform();za.setMatrix(ha(X,R,pa,v));da.clear();da.appendItem(za);oa.push(za)}else{G=ha(v.inverse(),pa,v);za=e.createSVGMatrix();za.e=-G.e;za.f=-G.f;v=ha(za.inverse(),v.inverse(),X,R,pa,v,G.inverse());var kb=e.createSVGTransform(),ob=e.createSVGTransform(),Vb=e.createSVGTransform();kb.setTranslate(G.e,G.f);ob.setScale(v.a,v.d);Vb.setTranslate(za.e,za.f);da.appendItem(Vb);da.appendItem(ob);da.appendItem(kb);oa.push(Vb);oa.push(ob);oa.push(kb)}k.addSubCommand(pb(xa));gb=ka}}}h.removeItem(I- -1);h.removeItem(I-2);h.removeItem(I-3)}else if(I>=3&&h.getItem(I-1).type==1){F=3;v=ia(h).matrix;za=e.createSVGTransform();za.setMatrix(v);h.clear();h.appendItem(za)}else if((I==1||I>1&&h.getItem(1).type!=3)&&h.getItem(0).type==2){F=2;G=ia(h).matrix;h.removeItem(0);v=ia(h).matrix.inverse();v=ha(v,G);G=v.e;v=v.f;if(G!=0||v!=0){C=g.childNodes;E=C.length;for(I=[];E--;){xa=C.item(E);if(xa.nodeType==1){if(xa.getAttribute("clip-path")){ka=xa.getAttribute("clip-path");if(I.indexOf(ka)===-1){Db(ka,G,v);I.push(ka)}}ka= -gb;gb=xa.getAttribute("transform");if(da=W(xa)){X=e.createSVGTransform();X.setTranslate(G,v);da.numberOfItems?da.insertItemBefore(X,0):da.appendItem(X);k.addSubCommand(pb(xa));da=g.getElementsByTagNameNS(c,"use");xa="#"+xa.id;for(X=da.length;X--;){R=da.item(X);if(xa==ca(R)){pa=e.createSVGTransform();pa.setTranslate(-G,-v);W(R).insertItemBefore(pa,0);k.addSubCommand(pb(R))}}gb=ka}}}I=[];gb=ka}}else if(I==1&&h.getItem(0).type==1&&!s){F=1;v=h.getItem(0).matrix;C=g.childNodes;for(E=C.length;E--;){xa= -C.item(E);if(xa.nodeType==1){ka=gb;gb=xa.getAttribute("transform");if(da=W(xa)){G=ha(v,ia(da).matrix);I=e.createSVGTransform();I.setMatrix(G);da.clear();da.appendItem(I,0);k.addSubCommand(pb(xa));gb=ka;ka=xa.getAttribute("stroke-width");xa.getAttribute("stroke")!=="none"&&!isNaN(ka)&&xa.setAttribute("stroke-width",ka*((Math.abs(G.a)+Math.abs(G.d))/2))}}}h.clear()}else{if(s){D=e.createSVGTransform();D.setRotate(s,L.x,L.y);h.numberOfItems?h.insertItemBefore(D,0):h.appendItem(D)}h.numberOfItems==0&& -g.removeAttribute("transform");return null}if(F==2){if(s){L={x:D.x+N.e,y:D.y+N.f};D=e.createSVGTransform();D.setRotate(s,L.x,L.y);h.numberOfItems?h.insertItemBefore(D,0):h.appendItem(D)}}else if(F==3){v=ia(h).matrix;N=e.createSVGTransform();N.setRotate(s,D.x,D.y);N=N.matrix;D=e.createSVGTransform();D.setRotate(s,L.x,L.y);L=D.matrix.inverse();ka=v.inverse();L=ha(ka,L,N,v);G=L.e;v=L.f;if(G!=0||v!=0){C=g.childNodes;for(E=C.length;E--;){xa=C.item(E);if(xa.nodeType==1){ka=gb;gb=xa.getAttribute("transform"); -da=W(xa);X=e.createSVGTransform();X.setTranslate(G,v);da.numberOfItems?da.insertItemBefore(X,0):da.appendItem(X);k.addSubCommand(pb(xa));gb=ka}}}if(s)h.numberOfItems?h.insertItemBefore(D,0):h.appendItem(D)}}else{s=svgedit.utilities.getBBox(g);if(!s&&g.tagName!="path")return null;v=e.createSVGMatrix();if(G=sa(g)){D={x:s.x+s.width/2,y:s.y+s.height/2};L=Q(s.x+s.width/2,s.y+s.height/2,ia(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(I-2).type==3&&h.getItem(I-3).type==2&&h.getItem(I- -1).type==2){F=3;v=ia(h,I-3,I-1).matrix;h.removeItem(I-1);h.removeItem(I-2);h.removeItem(I-3)}else if(I==4&&h.getItem(I-1).type==1){F=3;v=ia(h).matrix;za=e.createSVGTransform();za.setMatrix(v);h.clear();h.appendItem(za);v=e.createSVGMatrix()}else if((I==1||I>1&&h.getItem(1).type!=3)&&h.getItem(0).type==2){F=2;N=h.getItem(0).matrix;ka=ia(h,1).matrix;s=ka.inverse();v=ha(s,N,ka);h.removeItem(0)}else if(I==1&&h.getItem(0).type==1&&!G){v=ia(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){s=g.points;C=s.numberOfItems;z.points=Array(C);for(F=0;F1&&s.showGrips(false)}}}H("selected",K);h||K.length==1?Pa.requestSelector(K[0]).showGrips(true): -Pa.requestSelector(K[0]).showGrips(false);for(K.sort(function(G,z){if(G&&z&&G.compareDocumentPosition)return 3-(z.compareDocumentPosition(G)&6);else if(G==null)return 1});K[0]==null;)K.shift(0)}},Sb=this.selectOnly=function(g,h){cb(true);Nb(g,h)};this.removeFromSelection=function(g){if(K[0]!=null)if(g.length!=0){var h=Array(K.length);j=0;len=K.length;for(var k=0;k=0&&g.id!="svgcanvas")for(;g.nodeName!="foreignObject";){g=g.parentNode;if(!g)return e}var h=w().getCurrentLayer();if([e,a,l,h].indexOf(g)>=0)return e;if($(g).closest("#selectorParentGroup").length)return Pa.selectorParentGroup; -for(;g.parentNode!==(M||h);)g=g.parentNode;return g};(function(){var g=null,h=null,k=null,v=null,s=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*q;E=E.y*q;C.preventDefault();if(F)Ia="select";D=D/q;E=E/q;var L=ac(C);if(L.tagName==="a"&&L.childNodes.length===1)L=L.firstChild;var I=v=h=D,N=s=k=E;if(m.gridSnapping){D= -Ja(D);E=Ja(E);h=Ja(h);k=Ja(k)}if(L==Pa.selectorParentGroup&&K[0]!=null){L=C.target;var X=ab(L,"type");if(X=="rotate"){Ia="rotate";current_rotate_mode=ab(L,"dir")}else if(X=="resize"){Ia="resize";rb=ab(L,"dir")}L=K[0]}gb=L.getAttribute("transform");X=W(L);switch(Ia){case "select":Sa=true;rb="none";if(F)Sa=false;if(L!=e){if(K.indexOf(L)==-1){C.shiftKey||cb(true);Nb([L]);La=L;Ua.clear()}if(!F)for(F=0;F0&&b.removeFromSelection(L);I.length>0&&Nb(I);break;case "resize":L=W(F);I=(R=ua(L))?G:svgedit.utilities.getBBox(F);N=I.x;pa=I.y;var xa=I.width,da=I.height;I=x-h;X=y-k;if(m.gridSnapping){I=Ja(I);X=Ja(X);da=Ja(da);xa= -Ja(xa)}var ka=sa(F);if(ka){var oa=Math.sqrt(I*I+X*X);X=Math.atan2(X,I)-ka*Math.PI/180;I=oa*Math.cos(X);X=oa*Math.sin(X)}if(rb.indexOf("n")==-1&&rb.indexOf("s")==-1)X=0;if(rb.indexOf("e")==-1&&rb.indexOf("w")==-1)I=0;var za=oa=0,kb=da?(da+X)/da:1,ob=xa?(xa+I)/xa:1;if(rb.indexOf("n")>=0){kb=da?(da-X)/da:1;za=da}if(rb.indexOf("w")>=0){ob=xa?(xa-I)/xa:1;oa=xa}I=e.createSVGTransform();X=e.createSVGTransform();xa=e.createSVGTransform();if(m.gridSnapping){N=Ja(N);oa=Ja(oa);pa=Ja(pa);za=Ja(za)}I.setTranslate(-(N+ -oa),-(pa+za));if(C.shiftKey)if(ob==1)ob=kb;else kb=ob;X.setScale(ob,kb);xa.setTranslate(N+oa,pa+za);if(R){R=ka?1:0;L.replaceItem(I,2+R);L.replaceItem(X,1+R);L.replaceItem(xa,0+R)}else{R=L.numberOfItems;L.replaceItem(xa,R-3);L.replaceItem(X,R-2);L.replaceItem(I,R-1)}Pa.requestSelector(F).resize();H("transition",K);break;case "zoom":I*=q;N*=q;aa(Wa,{x:Math.min(v*q,I),y:Math.min(s*q,N),width:Math.abs(I-v*q),height:Math.abs(N-s*q)},100);break;case "text":aa(L,{x:x,y:y},1E3);break;case "line":I=null;window.opera|| -e.suspendRedraw(1E3);if(m.gridSnapping){x=Ja(x);y=Ja(y)}N=x;R=y;if(C.shiftKey){R=ea(h,k,N,R);N=R.x;R=R.y}L.setAttributeNS(null,"x2",N);L.setAttributeNS(null,"y2",R);window.opera||e.unsuspendRedraw(I);break;case "foreignObject":case "square":case "rect":case "image":I=Math.abs(x-h);R=Math.abs(y-k);if(Ia=="square"||C.shiftKey){I=R=Math.max(I,R);N=hk?k+pa:k-pa}if(C.altKey){R=h;N=k;pa=Math.abs(x-R);X=C.shiftKey?pa:Math.abs(y-N)}L.setAttributeNS(null, -"rx",pa);L.setAttributeNS(null,"ry",X);L.setAttributeNS(null,"cx",R);L.setAttributeNS(null,"cy",N);window.opera||e.unsuspendRedraw(I);break;case "fhellipse":case "fhrect":z.minx=Math.min(I,z.minx);z.maxx=Math.max(I,z.maxx);z.miny=Math.min(N,z.miny);z.maxy=Math.max(N,z.maxy);case "fhpath":g+=+I+","+N+" ";L.setAttributeNS(null,"points",g);break;case "path":case "pathedit":x*=q;y*=q;if(m.gridSnapping){x=Ja(x);y=Ja(y);h=Ja(h);k=Ja(k)}if(C.shiftKey){if(R=svgedit.path.path){L=R.dragging?R.dragging[0]:h; -R=R.dragging?R.dragging[1]:k}else{L=h;R=k}R=ea(L,R,x,y);x=R.x;y=R.y}if(Wa&&Wa.getAttribute("display")!=="none"){I*=q;N*=q;aa(Wa,{x:Math.min(v*q,I),y:Math.min(s*q,N),width:Math.abs(I-v*q),height:Math.abs(N-s*q)},100)}Ua.mouseMove(C,x,y);break;case "textedit":x*=q;y*=q;qb.mouseMove(D,E);break;case "rotate":I=svgedit.utilities.getBBox(F);R=I.x+I.width/2;N=I.y+I.height/2;L=ga(F);L=Q(R,N,L);R=L.x;N=L.y;L=I.x;pa=I.y;if(current_rotate_mode=="nw")L=I.x+I.width;if(current_rotate_mode=="se")pa=I.y+I.height; -if(current_rotate_mode=="sw"){L=I.x+I.width;pa=I.y+I.height}compensation_angle=(Math.atan2(N-pa,R-L)*(180/Math.PI)-90)%360;ka=(Math.atan2(N-y,R-x)*(180/Math.PI)-90)%360;ka+=compensation_angle;if(m.gridSnapping)ka=Ja(ka);if(C.shiftKey)ka=Math.round(ka/45)*45;b.setRotationAngle(ka<-180?360+ka:ka,true);H("transition",K)}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!==M){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")&&sa(E)){bc(E);E=K[0];cb(true)}M&&cc();F.tagName!=="g"&&F.tagName!=="a"||F===w().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*q;E=E.y*q;var L=D/q,I=E/q,N=ta(va()),X=false;Sa=false;switch(Ia){case "resize":case "multiselect":if(Wa!=null){Wa.setAttribute("display","none");jb=[]}Ia="select"; -case "select":if(K[0]!=null){if(K[1]==null){D=K[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(L!=v||I!=s){C=K.length;for(D=0;D=0?F.indexOf(",",L+1)>=0:F.indexOf(" ",F.indexOf(" ")+1)>=0)N=Ua.smoothPolylineIntoPath(N);break;case "line":F=$(N).attr(["x1","x2","y1","y2"]);X=F.x1!=F.x2||F.y1!=F.y2;break;case "foreignObject":case "square":case "rect":case "image":F=$(N).attr(["width","height"]); -X=F.width!=0||F.height!=0||Ia==="image";break;case "circle":X=N.getAttribute("r")!=0;break;case "ellipse":F=$(N).attr(["rx","ry"]);X=F.rx!=null||F.ry!=null;break;case "fhellipse":if(z.maxx-z.minx>0&&z.maxy-z.miny>0){N=fa({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()}});H("changed",[N]);X=true}break;case "fhrect":if(z.maxx-z.minx>0&&z.maxy-z.miny>0){N=fa({element:"rect",curStyles:true,attr:{x:z.minx,y:z.miny,width:z.maxx- -z.minx,height:z.maxy-z.miny,id:va()}});H("changed",[N]);X=true}break;case "text":X=true;Sb([N]);qb.start(N);break;case "path":N=null;Sa=true;F=Ua.mouseUp(C,N,D,E);N=F.element;X=F.keep;break;case "pathedit":X=true;N=null;Ua.mouseUp(C);break;case "textedit":X=false;N=null;qb.mouseUp(C,D,E);break;case "rotate":X=true;N=null;Ia="select";F=b.undoMgr.finishUndoableChange();F.isEmpty()||Ha(F);Za();H("changed",K)}D=nb("mouseUp",{event:C,mouse_x:D,mouse_y:E},true);$.each(D,function(xa,da){if(da){X=da.keep|| -X;N=da.element;Sa=da.started||Sa}});if(!X&&N!=null){w().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 R;if(false.beginElement&&N.getAttribute("opacity")!=P.opacity){R=$(false).clone().attr({to:P.opacity,dur:C}).appendTo(N);try{R[0].beginElement()}catch(pa){}}else C= -0;setTimeout(function(){R&&R.remove();N.setAttribute("opacity",P.opacity);N.setAttribute("style","pointer-events:inherit");ma(N);if(Ia==="path")Ua.toEditMode(N);else m.selectNew&&Sb([N],true);Ha(new Qa(N));H("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&&H("zoomed",F)}})})();var Lb=function(g){$(g).click(function(h){h.preventDefault()})},qb=b.textActions=function(){function g(da){var ka=F.value==="";$(F).focus();if(!arguments.length)if(ka)da=0;else{if(F.selectionEnd!==F.selectionStart)return;da=F.selectionEnd}var oa;oa=I[da];ka||F.setSelectionRange(da,da);E=ta("text_cursor");if(!E){E=document.createElementNS(c,"line");aa(E,{id:"text_cursor",stroke:"#333","stroke-width":1}); -E=ta("selectorParentGroup").appendChild(E)}L||(L=setInterval(function(){var za=E.getAttribute("display")==="none";E.setAttribute("display",za?"inline":"none")},600));ka=G(oa.x,N.y);oa=G(oa.x,N.y+N.height);aa(E,{x1:ka.x,y1:ka.y,x2:oa.x,y2:oa.y,visibility:"visible",display:"inline"});D&&D.setAttribute("d","")}function h(da,ka,oa){if(da===ka)g(ka);else{oa||F.setSelectionRange(da,ka);D=ta("text_selectblock");if(!D){D=document.createElementNS(c,"path");aa(D,{id:"text_selectblock",fill:"green",opacity:0.5, -style:"pointer-events:none"});ta("selectorParentGroup").appendChild(D)}da=I[da];var za=I[ka];E.setAttribute("visibility","hidden");ka=G(da.x,N.y);oa=G(da.x+(za.x-da.x),N.y);var kb=G(da.x,N.y+N.height);da=G(da.x+(za.x-da.x),N.y+N.height);aa(D,{d:"M"+ka.x+","+ka.y+" L"+oa.x+","+oa.y+" "+da.x+","+da.y+" "+kb.x+","+kb.y+"z",display:"inline"})}}function k(da,ka){var oa=e.createSVGPoint();oa.x=da;oa.y=ka;if(I.length==1)return 0;oa=C.getCharNumAtPosition(oa);if(oa<0){oa=I.length-2;if(da<=I[0].x)oa=0}else if(oa>= -I.length-2)oa=I.length-2;var za=I[oa];da>za.x+za.width/2&&oa++;return oa}function v(da,ka,oa){var za=F.selectionStart;da=k(da,ka);h(Math.min(za,da),Math.max(za,da),!oa)}function s(da,ka){var oa={x:da,y:ka};oa.x/=q;oa.y/=q;if(X){var za=Q(oa.x,oa.y,X.inverse());oa.x=za.x;oa.y=za.y}return oa}function G(da,ka){var oa={x:da,y:ka};if(X){var za=Q(oa.x,oa.y,X);oa.x=za.x;oa.y=za.y}oa.x*=q;oa.y*=q;return oa}function z(da){h(0,C.textContent.length);$(this).unbind(da)}function A(da){if(xa&&C){var ka=Q(da.pageX, -da.pageY,Pb);ka=s(ka.x*q,ka.y*q);ka=k(ka.x,ka.y);var oa=C.textContent,za=oa.substr(0,ka).replace(/[a-z0-9]+$/i,"").length;oa=oa.substr(ka).match(/^[a-z0-9]+/i);h(za,(oa?oa[0].length:0)+ka);$(da.target).click(z);setTimeout(function(){$(da.target).unbind("click",z)},300)}}var C,F,E,D,L,I=[],N,X,R,pa,xa;return{select:function(da,ka,oa){C=da;qb.toEditMode(ka,oa)},start:function(da){C=da;qb.toEditMode()},mouseDown:function(da,ka,oa,za){da=s(oa,za);F.focus();g(k(da.x,da.y));R=oa;pa=za},mouseMove:function(da, -ka){var oa=s(da,ka);v(oa.x,oa.y)},mouseUp:function(da,ka,oa){var za=s(ka,oa);v(za.x,za.y,true);da.target!==C&&kaR-2&&oapa-2&&qb.toSelectMode(true)},setCursor:g,toEditMode:function(da,ka){xa=false;Ia="textedit";Pa.requestSelector(C).showGrips(false);Pa.requestSelector(C);qb.init();$(C).css("cursor","text");if(arguments.length){var oa=s(da,ka);g(k(oa.x,oa.y))}else g();setTimeout(function(){xa=true},300)},toSelectMode:function(da){Ia="select";clearInterval(L);L=null;D&&$(D).attr("display", -"none");E&&$(E).attr("visibility","hidden");$(C).css("cursor","move");if(da){cb();$(C).css("cursor","move");H("selected",[C]);Nb([C],true)}C&&!C.textContent.length&&b.deleteSelectedElements();$(F).blur();C=false},setInputElem:function(da){F=da},clear:function(){Ia=="textedit"&&qb.toSelectMode()},init:function(){if(C){if(!C.parentNode){C=K[0];Pa.requestSelector(C).showGrips(false)}var da=C.textContent.length,ka=C.getAttribute("transform");N=svgedit.utilities.getBBox(C);X=ka?ga(C):null;I=Array(da); -F.focus();$(C).unbind("dblclick",A).dblclick(A);if(!da)var oa={x:N.x+N.width/2,width:0};for(ka=0;ka=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]);H("selected",z)};var s=h=null,G=false;return{mouseDown:function(z,A,C,F){if(Ia==="path"){mouse_x=C;mouse_y=F;F=mouse_x/q;A=mouse_y/q;C=ta("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");aa(C,{id:"path_stretch_line",stroke:"#22C","stroke-width":"0.5",fill:"none"});C=ta("selectorParentGroup").appendChild(C)}C.setAttribute("display","inline");var E=null;if(s){E= -s.pathSegList;for(var D=E.numberOfItems,L=6/q,I=false;D;){D--;var N=E.getItem(D),X=N.x;N=N.y;if(F>=X-L&&F<=X+L&&A>=N-L&&A<=N+L){I=true;break}}L=va();svgedit.path.removePath_(L);L=ta(L);X=E.numberOfItems;if(I){if(D<=1&&X>=2){F=E.getItem(0).x;A=E.getItem(0).y;z=C.pathSegList.getItem(1);z=z.pathSegType===4?s.createSVGPathSegLinetoAbs(F,A):s.createSVGPathSegCurvetoCubicAbs(F,A,z.x1/q,z.y1/q,F,A);F=s.createSVGPathSegClosePath();E.appendItem(z);E.appendItem(F)}else if(X<3)return E=false;$(C).remove();element= -L;s=null;Sa=false;if(g){svgedit.path.path.matrix&&xb(L,{},svgedit.path.path.matrix.inverse());C=L.getAttribute("d");z=$(svgedit.path.path.elem).attr("d");$(svgedit.path.path.elem).attr("d",z+C);$(L).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=s.pathSegList.numberOfItems;D=s.pathSegList.getItem(E- -1);L=D.x;D=D.y;if(z.shiftKey){z=ea(L,D,F,A);F=z.x;A=z.y}z=C.pathSegList.getItem(1);z=z.pathSegType===4?s.createSVGPathSegLinetoAbs(Gb(F),Gb(A)):s.createSVGPathSegCurvetoCubicAbs(Gb(F),Gb(A),z.x1/q,z.y1/q,z.x2/q,z.y2/q);s.pathSegList.appendItem(z);F*=q;A*=q;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+" ";s=fa({element:"path",curStyles:true,attr:{d:d_attr,id:O(),opacity:P.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();L=z.target.id;if(L.substr(0,14)=="pathpointgrip_"){A=svgedit.path.path.cur_pt=parseInt(L.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(L.indexOf("ctrlpointgrip_")==0){svgedit.path.path.dragging=[C,F];z=L.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();aa(Wa,{x:C*q,y:F*q,width:0,height:0,display:"inline"},100)}}},mouseMove:function(z,A,C){G=true;if(Ia==="path"){if(s){var F=s.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 L=k[1];F.getItem(z);var I=E+(E-A/q),N=L+(L-C/q);D.setAttribute("cx",I*q);D.setAttribute("cy",N*q);D.setAttribute("display","inline");D=svgedit.path.getCtrlLine(1);var X=svgedit.path.getCtrlLine(2);aa(D,{x1:A,y1:C,x2:E*q,y2:L*q,display:"inline"});aa(X,{x1:I*q,y1:N*q,x2:E*q,y2:L*q,display:"inline"});if(z===0)v=[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(v){A=v[0]/q;C=v[1]/q}svgedit.path.replacePathSeg(6,z,[E,L,A,C,I,N],s)}}else if(E=ta("path_stretch_line")){z=F.getItem(z);if(z.pathSegType===6)svgedit.path.replacePathSeg(6,1,[A,C,(z.x+(z.x-z.x2))*q,(z.y+(z.y-z.y2))*q,A,C],E);else v?svgedit.path.replacePathSeg(6,1,[A,C,v[0],v[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);L=svgedit.path.getPointFromGrip({x:A,y:C},svgedit.path.path);z=L.x-E.x;E=L.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 R=Wa.getBBox(),pa=svgedit.path.getGripPt(this);R=svgedit.math.rectsIntersect(R,{x:pa.x,y:pa.y,width:0,height:0});this.select(R);R&&svgedit.path.path.selected_pts.push(this.index)}})}}, -mouseUp:function(z,A){if(Ia==="path"){k=null;if(!s){A=ta(va());Sa=false;v=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){H("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=K[0];if(z)if(sa(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);H("changed",K)}},clear:function(){h=null;if(s){var z=ta(va());$(ta("path_stretch_line")).remove(); -$(z).remove();$(ta("pathpointgrip_container")).find("*").attr("display","none");s=v=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=W(z),C=ia(A).matrix;A.clear();z.removeAttribute("transform");A=z.pathSegList;for(var F=A.numberOfItems,E=0;E0){L=F.getItem(E-1).pathSegType;if(L===2){D(E-1,1);C();break}else if(L===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 L=A.getItem(D),I=A.getItem(D+1),N=A.getItem(D+2);if(E)if((F=svgedit.path.smoothControlPoints(E,L,F))&&F.length== -2){L=z[z.length-1].split(",");L[2]=F[0].x;L[3]=F[0].y;z[z.length-1]=L.join(",");L=F[1]}z.push([L.x,L.y,I.x,I.y,N.x,N.y].join(","));F=N;E=I}for(z.push("L");D=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"); +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&&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")<= +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;);Ua.clear(true);$.each(l.childNodes,function(k,v){k&&v.nodeType===8&&v.data.indexOf("Created with")>=0&& -l.insertBefore(v,l.firstChild)});if(M){cc();Sb([M])}var g=[];$(l).find("g:data(gsvg)").each(function(){for(var k=this.attributes,v=k.length,s=0;s=0;C--){A=z.item(C);D=v(A.nodeValue);if(!(L.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)+s}else D=svgedit.units.shortFloat(D);if(bb.apply&&g.nodeName==="image"&&A.localName==="href"&&bb.images&&bb.images==="embed"){var I=Ka[D];if(I)D=I}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("