(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]= 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(ba){return typeof ba==="string"}function c(ba){var S=e.call(arguments,1);return function(){return ba.apply(this,S.concat(e.call(arguments)))}}function m(ba,S,U,ra,la){var ma;if(ra!==d){S=U.match(ba?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);U=S[3]||"";if(la===2&&f(ra))ra=ra.replace(ba?ea:ca,"");else{ma=p(S[2]);ra=f(ra)?p[ba?fa:O](ra):ra;ra=la===2?ra:la===1?a.extend({},ra,ma):a.extend({},ma,ra);ra=u(ra);if(ba)ra=ra.replace(qa,l)}ba=S[1]+(ba?"#":ra||!S[1]?"?":"")+ra+U}else ba= S(U!==d?U:n[sa][ha]);return ba}function o(ba,S,U){if(S===d||typeof S==="boolean"){U=S;S=u[ba?fa:O]()}else S=f(S)?S.replace(ba?ea:ca,""):S;return p(S,U)}function b(ba,S,U,ra){if(!f(U)&&typeof U!=="object"){ra=U;U=S;S=d}return this.each(function(){var la=a(this),ma=S||da()[(this.nodeName||"").toLowerCase()]||"",Z=ma&&la.attr(ma)||"";la.attr(ma,u[ba](Z,U,ra))})}var d,e=Array.prototype.slice,l=decodeURIComponent,u=a.param,w,p,L,T=a.bbq=a.bbq||{},N,K,da,V=a.event.special,O="querystring",fa="fragment", sa="location",ha="href",ca=/^.*\?|#.*$/g,ea=/^.*\#/,qa,pa={};u[O]=c(m,0,function(ba){return ba.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")});u[fa]=w=c(m,1,function(ba){return ba.replace(/^[^#]*#?(.*)$/,"$1")});w.noEscape=function(ba){ba=ba||"";ba=a.map(ba.split(""),encodeURIComponent);qa=RegExp(ba.join("|"),"g")};w.noEscape(",/");a.deparam=p=function(ba,S){var U={},ra={"true":true,"false":false,"null":null};a.each(ba.replace(/\+/g," ").split("&"),function(la,ma){var Z=ma.split("="),Aa=l(Z[0]),Ka=U, Ra=0,Na=Aa.split("]["),Sa=Na.length-1;if(/\[/.test(Na[0])&&/\]$/.test(Na[Sa])){Na[Sa]=Na[Sa].replace(/\]$/,"");Na=Na.shift().split("[").concat(Na);Sa=Na.length-1}else Sa=0;if(Z.length===2){Z=l(Z[1]);if(S)Z=Z&&!isNaN(Z)?+Z:Z==="undefined"?d:ra[Z]!==d?ra[Z]:Z;if(Sa)for(;Ra<=Sa;Ra++){Aa=Na[Ra]===""?Ka.length:Na[Ra];Ka=Ka[Aa]=Ra').hide().insertAfter("body")[0].contentWindow; K=function(){return c(T.document[b][d])};N=function(da,V){if(da!==V){var O=T.document;O.open().close();O[b].hash="#"+da}};N(c())}}var p={},L,T,N,K;p.start=function(){if(!L){var da=c();N||w();(function V(){var O=c(),fa=K(da);if(O!==da){N(da=O,fa);a(n).trigger("hashchange")}else if(fa!==da)n[b][d]=n[b][d].replace(/#.*/,"")+"#"+fa;L=setTimeout(V,a.hashchangeDelay)})()}};p.stop=function(){if(!T){L&&clearTimeout(L);L=0}};return p}()})(jQuery,this);(function(a){var n={},f;a.svgIcons=function(c,m){function o(ba,S){if(ba!=="ajax"){if(da)return;var U=(T=ha[0].contentDocument)&&T.getElementById("svg_eof");if(!U&&!(S&&U)){V++;if(V<50)setTimeout(o,20);else{d();da=true}return}da=true}L=a(T.firstChild).children();if(m.no_img)setTimeout(function(){K||b()},500);else{U=sa+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNzUiIGhlaWdodD0iMjc1Ij48L3N2Zz4%3D";N=a(new Image).attr({src:U,width:0,height:0}).appendTo("body").load(function(){b(true)}).error(function(){b()})}} function b(ba,S){if(!K){if(m.no_img)ba=false;if(ba){var U=a(document.createElement("div"));U.hide().appendTo("body")}if(S){var ra=m.fallback_path?m.fallback_path:"";a.each(S,function(Sa,Xa){a("#"+Sa);var Oa=a(new Image).attr({"class":"svg_icon",src:ra+Xa,width:w,height:p,alt:"icon"});pa(Oa,Sa)})}else for(var la=L.length,ma=0;ma0&&!ba)Ia=f(Ia,Oa,true);qa(a(this),Ia,Xa)})});if(!S){ba&&U.remove();ha&&ha.remove();N&&N.remove()}m.resize&&a.resizeSvgIcons(m.resize);K=true;m.callback&&m.callback(n)}}function d(){if(c.indexOf(".svgz")!=-1){var ba=c.replace(".svgz",".svg");window.console&&console.log(".svgz failed, trying with .svg");a.svgIcons(ba,m)}else m.fallback&&b(false,m.fallback)}function e(ba){if(window.btoa)return window.btoa(ba); var S=Array(Math.floor((ba.length+2)/3)*4),U,ra,la,ma,Z,Aa,Ka=0,Ra=0;do{U=ba.charCodeAt(Ka++);ra=ba.charCodeAt(Ka++);la=ba.charCodeAt(Ka++);ma=U>>2;U=(U&3)<<4|ra>>4;Z=(ra&15)<<2|la>>6;Aa=la&63;if(isNaN(ra))Z=Aa=64;else if(isNaN(la))Aa=64;S[Ra++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(ma);S[Ra++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(U);S[Ra++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Z);S[Ra++]= "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Aa)}while(Ka-1&&O.indexOf("Chrome/");var sa="data:image/svg+xml;charset=utf-8;base64,";if(m.svgz){var ha=a('').appendTo("body").hide();try{T=ha[0].contentDocument;ha.load(o); o(0,true)}catch(ca){d()}}else{var ea=new DOMParser;a.ajax({url:c,dataType:"string",success:function(ba){if(ba){T=ea.parseFromString(ba,"text/xml");a(function(){o("ajax")})}else a(d)},error:function(ba){if(window.opera)a(function(){d()});else if(ba.responseText){T=ea.parseFromString(ba.responseText,"text/xml");T.childNodes.length||a(d);a(function(){o("ajax")})}else a(d)}})}var qa=function(ba,S,U,ra){fa&&S.css("visibility","hidden");if(m.replace){ra&&S.attr("id",U);(U=ba.attr("class"))&&S.attr("class", "svg_icon "+U);ba.replaceWith(S)}else ba.append(S);fa&&setTimeout(function(){S.removeAttr("style")},1)},pa=function(ba,S){if(m.id_match===undefined||m.id_match!==false)qa(holder,ba,S,true);n[S]=ba};f=function(ba,S){var U=ba.find("defs");if(!U.length)return ba;U=fa?U.find("*").filter(function(){return!!this.id}):U.find("[id]");var ra=ba[0].getElementsByTagName("*"),la=ra.length;U.each(function(ma){var Z=this.id;a(T).find("#"+Z);this.id=ma="x"+Z+S+ma;Z="url(#"+Z+")";var Aa="url(#"+ma+")";for(ma=0;ma< la;ma++){var Ka=ra[ma];Ka.getAttribute("fill")===Z&&Ka.setAttribute("fill",Aa);Ka.getAttribute("stroke")===Z&&Ka.setAttribute("stroke",Aa);Ka.getAttribute("filter")===Z&&Ka.setAttribute("filter",Aa)}});return ba}};a.getSvgIcon=function(c,m){var o=n[c];if(m&&o)o=f(o,0,true).clone(true);return o};a.resizeSvgIcons=function(c){var m=!a(".svg_icon:first").length;a.each(c,function(o,b){var d=a.isArray(b),e=d?b[0]:b,l=d?b[1]:b;if(m)o=o.replace(/\.svg_icon/g,"svg");a(o).each(function(){this.setAttribute("width", e);this.setAttribute("height",l);if(window.opera&&window.widget){this.parentNode.style.width=e+"px";this.parentNode.style.height=l+"px"}})})}})(jQuery);(function(){function a(c,m,o){c=document.createElementNS(n.svg,c);if(f)for(var b in m)c.setAttribute(b,m[b]);else for(b in m){var d=m[b],e=c[b];if(e&&e.constructor==="SVGLength")e.baseVal.value=d;else c.setAttribute(b,d)}o&&o.appendChild(c);return c}var n={svg:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink"};if(!window.console)window.console=new function(){this.log=function(){};this.dir=function(){}};$.jGraduate={Paint:function(c){c=c||{};this.alpha=isNaN(c.alpha)?100:c.alpha;if(c.copy){this.type= c.copy.type;this.alpha=c.copy.alpha;this.radialGradient=this.linearGradient=this.solidColor=null;switch(this.type){case "solidColor":this.solidColor=c.copy.solidColor;break;case "linearGradient":this.linearGradient=c.copy.linearGradient.cloneNode(true);break;case "radialGradient":this.radialGradient=c.copy.radialGradient.cloneNode(true)}}else if(c.linearGradient){this.type="linearGradient";this.radialGradient=this.solidColor=null;this.linearGradient=c.linearGradient.cloneNode(true)}else if(c.radialGradient){this.type= "radialGradient";this.linearGradient=this.solidColor=null;this.radialGradient=c.radialGradient.cloneNode(true)}else if(c.solidColor){this.type="solidColor";this.solidColor=c.solidColor}else{this.type="none";this.radialGradient=this.linearGradient=this.solidColor=null}}};jQuery.fn.jGraduateDefaults={paint:new $.jGraduate.Paint,window:{pickerTitle:"Drag markers to pick a paint"},images:{clientPath:"images/"},newstop:"inverse"};var f=navigator.userAgent.indexOf("Gecko/")>=0;jQuery.fn.jGraduate=function(c){var m= arguments;return this.each(function(){function o(na,aa,ta,M,I){var Y=I||a("stop",{"stop-color":aa,"stop-opacity":ta,offset:na},ea);if(I){aa=I.getAttribute("stop-color");ta=I.getAttribute("stop-opacity");na=I.getAttribute("offset")}else ea.appendChild(Y);if(ta===null)ta=1;I=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*fa)+", 26)"},Fb);var Pa= 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:aa,"fill-opacity":ta,transform:"translate("+(10+na*fa)+", 26)",stroke:"#000","stroke-width":1.5},Fb);$(Pa).mousedown(function(Wa){b(this);Ya=lb;da.mousemove(l).mouseup(d);Ea=Ob.offset();Wa.preventDefault();return false}).data("stop",Y).data("bg",I).dblclick(function(){$("div.jGraduate_LightBox").show();for(var Wa=this,db=+Y.getAttribute("stop-opacity")|| 1,tb=Y.getAttribute("stop-color")||1,ub=(parseFloat(db)*255).toString(16);ub.length<2;)ub="0"+ub;aa=tb.substr(1)+ub;$("#"+p+"_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:aa,alphaSupport:true}},function(zb){tb=zb.val("hex")?"#"+zb.val("hex"):"none";db=zb.val("a")!==null?zb.val("a")/256:1;Wa.setAttribute("fill",tb);Wa.setAttribute("fill-opacity",db);Y.setAttribute("stop-color", tb);Y.setAttribute("stop-opacity",db);$("div.jGraduate_LightBox").hide();$("#"+p+"_jGraduate_stopPicker").hide()},null,function(){$("div.jGraduate_LightBox").hide();$("#"+p+"_jGraduate_stopPicker").hide()})});$(ea).find("stop").each(function(){var Wa=$(this);if(+this.getAttribute("offset")>na){if(!aa){var db=this.getAttribute("stop-color"),tb=this.getAttribute("stop-opacity");Y.setAttribute("stop-color",db);Pa.setAttribute("fill",db);Y.setAttribute("stop-opacity",tb===null?1:tb);Pa.setAttribute("fill-opacity", tb===null?1:tb)}Wa.before(Y);return false}});M&&b(Pa);return Y}function b(na){lb&&lb.setAttribute("stroke","#000");na.setAttribute("stroke","blue");lb=na;lb.parentNode.appendChild(lb)}function d(){da.unbind("mousemove",l);if(La.getAttribute("display")!=="none"){La.setAttribute("display","none");var na=$(lb),aa=na.data("stop");na=na.data("bg");$([lb,aa,na]).remove()}Ya=null}function e(){var na=Za?"rotate("+Za+","+Ma+","+mb+") ":"";nb===1&&Ja===1?ea.removeAttribute("gradientTransform"):ea.setAttribute("gradientTransform", na+"translate("+-Ma*(nb-1)+","+-mb*(Ja-1)+") scale("+nb+","+Ja+")")}function l(na){var aa=na.pageX-Ea.left;na=na.pageY-Ea.top;aa=aa<10?10:aa>fa+10?fa+10:aa;var ta="translate("+aa+", 26)";if(na<-60||na>130){La.setAttribute("display","block");La.setAttribute("transform",ta)}else La.setAttribute("display","none");Ya.setAttribute("transform",ta);$.data(Ya,"bg").setAttribute("transform",ta);$.data(Ya,"stop").setAttribute("offset",(aa-10)/fa);var M=0;$(ea).find("stop").each(function(){var I=this.getAttribute("offset"), Y=$(this);if(I
  • Solid Color
  • Linear Gradient
  • Radial Gradient
  • ');var V=$(L+"> .jGraduate_colPick"),O=$(L+"> .jGraduate_gradPick");O.html('

    '+w.window.pickerTitle+'


    ');var fa=256,sa=fa-0,ha=fa-0,ca,ea,qa,pa={};$(".jGraduate_SliderBar").width(145);var ba=$("#"+p+"_jGraduate_GradContainer")[0],S=a("svg",{id:p+"_jgraduate_svg",width:fa,height:fa,xmlns:n.svg},ba);ca=ca||u.paint.type;var U=ea=u.paint[ca],ra=u.paint.alpha,la=ca==="solidColor";switch(ca){case "solidColor":case "linearGradient":if(!la){ea.id=p+"_lg_jgraduate_grad"; U=ea=S.appendChild(ea)}a("radialGradient",{id:p+"_rg_jgraduate_grad"},S);if(ca==="linearGradient")break;case "radialGradient":if(!la){ea.id=p+"_rg_jgraduate_grad";U=ea=S.appendChild(ea)}a("linearGradient",{id:p+"_lg_jgraduate_grad"},S)}if(la){U=ea=$("#"+p+"_lg_jgraduate_grad")[0];K=u.paint[ca];o(0,"#"+K,1);var ma=typeof w.newstop;if(ma==="string")switch(w.newstop){case "same":o(1,"#"+K,1);break;case "inverse":ma="";for(var Z=0;Z<6;Z+=2){K.substr(Z,2);var Aa=(255-parseInt(K.substr(Z,2),16)).toString(16); if(Aa.length<2)Aa=0+Aa;ma+=Aa}o(1,"#"+ma,1);break;case "white":o(1,"#ffffff",1);break;case "black":o(1,"#000000",1)}else if(ma==="object")o(1,w.newstop.color||"#"+K,"opac"in w.newstop?w.newstop.opac:1)}K=parseFloat(U.getAttribute("x1")||0);ma=parseFloat(U.getAttribute("y1")||0);Z=parseFloat(U.getAttribute("x2")||1);Aa=parseFloat(U.getAttribute("y2")||0);var Ka=parseFloat(U.getAttribute("cx")||0.5),Ra=parseFloat(U.getAttribute("cy")||0.5),Na=parseFloat(U.getAttribute("fx")||Ka),Sa=parseFloat(U.getAttribute("fy")|| Ra);qa=a("rect",{id:p+"_jgraduate_rect",x:0,y:0,width:sa,height:ha,fill:"url(#"+p+"_jgraduate_grad)","fill-opacity":ra/100},S);var Xa=$("
    ").attr({"class":"grad_coord jGraduate_lg_field",title:"Begin Stop"}).text(1).css({top:ma*fa,left:K*fa}).data("coord","start").appendTo(ba),Oa=Xa.clone().text(2).css({top:Aa*fa,left:Z*fa}).attr("title","End stop").data("coord","end").appendTo(ba),Ia=$("
    ").attr({"class":"grad_coord jGraduate_rg_field",title:"Center stop"}).text("C").css({top:Ra*fa,left:Ka* fa}).data("coord","center").appendTo(ba),Qa=Ia.clone().text("F").css({top:Sa*fa,left:Na*fa,display:"none"}).attr("title","Focus point").data("coord","focus").appendTo(ba);Qa[0].id=p+"_jGraduate_focusCoord";$(L+" .grad_coord");$.each(["x1","y1","x2","y2","cx","cy","fx","fy"],function(na,aa){var ta=ea.getAttribute(aa),M=isNaN(aa[1]);ta||(ta=M?"0.5":aa==="x2"?"1.0":"0.0");pa[aa]=$("#"+p+"_jGraduate_"+aa).val(ta).change(function(){if(isNaN(parseFloat(this.value))||this.value<0)this.value=0;else if(this.value> 1)this.value=1;if(!(aa[0]==="f"&&!rb))if(M&&ca==="radialGradient"||!M&&ca==="linearGradient")ea.setAttribute(aa,this.value);var I=M?aa[0]==="c"?Ia:Qa:aa[1]==="1"?Xa:Oa,Y=aa.indexOf("x")>=0?"left":"top";I.css(Y,this.value*fa)}).change()});var Ga,Fb,Ob=$("#"+p+"_jGraduate_StopSlider"),lb,$a,Ya,La=a("path",{d:"m9.75,-6l-19.5,19.5m0,-19.5l19.5,19.5",fill:"none",stroke:"#D00","stroke-width":5,display:"none"},$a),Ea,nb=1,Ja=1,Za=0,Ma=Ka,mb=Ra;$a=a("svg",{width:"100%",height:45},Ob[0]);ba=a("pattern",{width:16, height:16,patternUnits:"userSpaceOnUse",id:"jGraduate_trans"},$a);a("image",{width:16,height:16},ba).setAttributeNS(n.xlink,"xlink:href",w.images.clientPath+"map-opacity.png");$($a).click(function(na){Ea=Ob.offset();if(na.target.tagName!=="path"){var aa=na.pageX-Ea.left-8;aa=aa<10?10:aa>fa+10?fa+10:aa;o(aa/fa,0,0,true);na.stopPropagation()}});$($a).mouseover(function(){$a.appendChild(La)});Fb=a("g",{},$a);a("line",{x1:10,y1:15,x2:fa+10,y2:15,"stroke-width":2,stroke:"#000"},$a);var Ab=O.find(".jGraduate_spreadMethod").change(function(){ea.setAttribute("spreadMethod", $(this).val())}),eb=null,fb=function(na){var aa=na.pageX-wb.left,ta=na.pageY-wb.top;aa=aa<0?0:aa>fa?fa:aa;ta=ta<0?0:ta>fa?fa:ta;eb.css("left",aa).css("top",ta);aa/=sa;ta/=ha;var M=eb.data("coord"),I=ea;switch(M){case "start":pa.x1.val(aa);pa.y1.val(ta);I.setAttribute("x1",aa);I.setAttribute("y1",ta);break;case "end":pa.x2.val(aa);pa.y2.val(ta);I.setAttribute("x2",aa);I.setAttribute("y2",ta);break;case "center":pa.cx.val(aa);pa.cy.val(ta);I.setAttribute("cx",aa);I.setAttribute("cy",ta);Ma=aa;mb=ta; e();break;case "focus":pa.fx.val(aa);pa.fy.val(ta);I.setAttribute("fx",aa);I.setAttribute("fy",ta);e()}na.preventDefault()},Pb=function(){eb=null;da.unbind("mousemove",fb).unbind("mouseup",Pb)};Ga=ea.getElementsByTagNameNS(n.svg,"stop");if(xa<2){for(;xa<2;){ea.appendChild(document.createElementNS(n.svg,"stop"));++xa}Ga=ea.getElementsByTagNameNS(n.svg,"stop")}var xa=Ga.length;for(Z=0;Z99.5)M=99.5;if(M>0)Ja=1-M/100;else nb=-(M/100)-1;I=145*((M+100)/2)/100;Y&&e();break;case "angle":Za=M;I=Za/180;I+=0.5;I*=145;Y&&e()}if(I>145)I= 145;else if(I<0)I=0;ta.css({"margin-left":I-5})}).change()});var Cb=function(na){var aa=na.pageX-kb.offset.left-parseInt(kb.parent.css("border-left-width"));if(aa>145)aa=145;if(aa<=0)aa=0;var ta=aa-5;aa/=145;switch(kb.type){case "radius":aa=Math.pow(aa*2,2.5);if(aa>0.98&&aa<1.02)aa=1;if(aa<=0.01)aa=0.01;ea.setAttribute("r",aa);break;case "opacity":u.paint.alpha=parseInt(aa*100);qa.setAttribute("fill-opacity",aa);break;case "ellip":Ja=nb=1;if(aa<0.5){aa/=0.5;nb=aa<=0?0.01:aa}else if(aa>0.5){aa/=0.5; aa=2-aa;Ja=aa<=0?0.01:aa}e();aa-=1;if(Ja===aa+1)aa=Math.abs(aa);break;case "angle":aa-=0.5;Za=aa*=180;e();aa/=100}kb.elem.css({"margin-left":ta});aa=Math.round(aa*100);kb.input.val(aa);na.preventDefault()},Lb=function(){da.unbind("mousemove",Cb).unbind("mouseup",Lb);kb=null};for(O=(u.paint.alpha*255/100).toString(16);O.length<2;)O="0"+O;O=O.split(".")[0];K=u.paint.solidColor=="none"?"":u.paint.solidColor+O;la||(K=Ga[0].getAttribute("stop-color"));$.extend($.fn.jPicker.defaults.window,{alphaSupport:true, effects:{type:"show",speed:0}});V.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;T()},null,function(){N()});var Gb=$(L+" .jGraduate_tabs li");Gb.click(function(){Gb.removeClass("jGraduate_tab_current");$(this).addClass("jGraduate_tab_current"); $(L+" > div").hide();var na=$(this).attr("data-type");$(L+" .jGraduate_gradPick").show();if(na==="rg"||na==="lg"){$(".jGraduate_"+na+"_field").show();$(".jGraduate_"+(na==="lg"?"rg":"lg")+"_field").hide();$("#"+p+"_jgraduate_rect")[0].setAttribute("fill","url(#"+p+"_"+na+"_jgraduate_grad)");ca=na==="lg"?"linearGradient":"radialGradient";$("#"+p+"_jGraduate_OpacInput").val(u.paint.alpha).change();var aa=$("#"+p+"_"+na+"_jgraduate_grad")[0];if(ea!==aa){var ta=$(ea).find("stop");$(aa).empty().append(ta); ea=aa;aa=Ab.val();ea.setAttribute("spreadMethod",aa)}rb=na==="rg"&&ea.getAttribute("fx")!=null&&!(Ka==Na&&Ra==Sa);$("#"+p+"_jGraduate_focusCoord").toggle(rb);if(rb)$("#"+p+"_jGraduate_match_ctr")[0].checked=false}else{$(L+" .jGraduate_gradPick").hide();$(L+" .jGraduate_colPick").show()}});$(L+" > div").hide();Gb.removeClass("jGraduate_tab_current");var Rb;switch(u.paint.type){case "linearGradient":Rb=$(L+" .jGraduate_tab_lingrad");break;case "radialGradient":Rb=$(L+" .jGraduate_tab_radgrad");break; default:Rb=$(L+" .jGraduate_tab_color")}u.show();setTimeout(function(){Rb.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? 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?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 p=a.height()-b.height();if(u>e-15)u=e-15;if(w>p-30)w=p-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(L){switch(L.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(){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,p=!!document.evaluate,L=function(){var sa=document.createElementNS("http://www.w3.org/2000/svg","path");sa.setAttribute("d","M0,0 10,10");var ha=sa.pathSegList;sa=sa.createSVGPathSegLinetoAbs(5,5);try{ha.replaceItem(sa,0);return true}catch(ca){}return false}(),T=function(){var sa=document.createElementNS("http://www.w3.org/2000/svg","path");sa.setAttribute("d","M0,0 10,10");var ha=sa.pathSegList;sa=sa.createSVGPathSegLinetoAbs(5,5);try{ha.insertItemBefore(sa, 0);return true}catch(ca){}return false}(),N=function(){var sa=document.createElementNS("http://www.w3.org/2000/svg","svg"),ha=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(sa);ha.setAttribute("x",5);sa.appendChild(ha);var ca=document.createElementNS("http://www.w3.org/2000/svg","text");ca.textContent="a";ha.appendChild(ca);ha=ca.getStartPositionOfChar(0).x;document.documentElement.removeChild(sa);return ha===0}(),K=function(){var sa=document.createElementNS("http://www.w3.org/2000/svg", "svg");document.documentElement.appendChild(sa);var ha=document.createElementNS("http://www.w3.org/2000/svg","path");ha.setAttribute("d","M0,0 C0,0 10,10 10,0");sa.appendChild(ha);ha=ha.getBBox();document.documentElement.removeChild(sa);return ha.height>4&&ha.height<5}(),da=function(){var sa=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(sa);var ha=document.createElementNS("http://www.w3.org/2000/svg","path");ha.setAttribute("d","M0,0 10,0");var ca= document.createElementNS("http://www.w3.org/2000/svg","path");ca.setAttribute("d","M5,0 15,0");var ea=document.createElementNS("http://www.w3.org/2000/svg","g");ea.appendChild(ha);ea.appendChild(ca);sa.appendChild(ea);ha=ea.getBBox();document.documentElement.removeChild(sa);return ha.width==15}(),V=function(){var sa=document.createElementNS("http://www.w3.org/2000/svg","rect");sa.setAttribute("x",0.1);(sa=sa.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 sa}(),O=function(){var sa=document.createElementNS("http://www.w3.org/2000/svg","rect");sa.setAttribute("style","vector-effect:non-scaling-stroke");return sa.style.vectorEffect==="non-scaling-stroke"}(),fa=function(){var sa=document.createElementNS("http://www.w3.org/2000/svg","rect").transform.baseVal,ha=f.createSVGTransform();sa.appendItem(ha);return sa.getItem(0)==ha}();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 p};svgedit.browser.supportsPathReplaceItem=function(){return L};svgedit.browser.supportsPathInsertItemBefore=function(){return T};svgedit.browser.supportsPathBBox=function(){return K}; svgedit.browser.supportsHVLineContainerBBox=function(){return da};svgedit.browser.supportsGoodTextCharPos=function(){return N};svgedit.browser.supportsEditableText=function(){return c};svgedit.browser.supportsGoodDecimals=function(){return V};svgedit.browser.supportsNonScalingStroke=function(){return O};svgedit.browser.supportsNativeTransformLists=function(){return fa}}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); 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(p){if(!l)if(RegExp("^-?[\\d\\.]+"+p+"$").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 p=this.getBBox();if(!p.width||!p.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,p,L,T=0,N=0;do{e=b.charCodeAt(T++);l=b.charCodeAt(T++);u=b.charCodeAt(T++);w=e>>2;e=(e&3)<<4|l>>4;p=(l&15)<<2|u>>6;L=u&63;if(isNaN(l))p=L=64;else if(isNaN(u))L=64;d[N++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(w);d[N++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(e);d[N++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(p);d[N++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(L)}while(T< b.length);return d.join("")};svgedit.utilities.decode64=function(b){if(window.atob)return window.atob(b);var d="",e,l,u="",w,p="",L=0;b=b.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(L++));l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(L++));w="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(L++));p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(L++)); e=e<<2|l>>4;l=(l&15)<<4|w>>2;u=(w&3)<<6|p;d+=String.fromCharCode(e);if(w!=64)d+=String.fromCharCode(l);if(p!=64)d+=String.fromCharCode(u)}while(L127)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)}}; 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, p=u.localName,L=u.namespaceURI;if(!(d.hasOwnProperty(p)&&L==d[p]&&L!="http://www.w3.org/2000/xmlns/")&&!(L=="http://www.w3.org/2000/xmlns/"&&a[u.nodeValue])){w.indexOf("se:")==0&&e.push([w,u.nodeValue]);m.removeAttributeNS(L,p)}if(svgedit.browser.isGecko())switch(w){case "transform":case "gradientTransform":case "patternTransform":p=u.nodeValue.replace(/(\d)-/g,"$1 -");m.setAttribute(w,p)}if(w=="style"){u=u.nodeValue.split(";");for(w=u.length;w--;){p=u[w].split(":");b.indexOf(p[0])>=0&&m.setAttribute(p[0], p[1])}m.removeAttribute("style")}}$.each(e,function(T,N){m.setAttributeNS("http://svg-edit.googlecode.com",N[0],N[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(T,N){var K=m.getAttribute(N);if(K)if((K=svgedit.utilities.getUrlFromAttr(K))&&K[0]!=="#"){m.setAttribute(N,"");m.removeAttribute(N)}});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= 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= 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"}; 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); 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= -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 p=w.y,L=w.width;w=w.height;l*=e;e=svgedit.math.transformBox(u*e,p*e,L*e,w*e,d);d=e.aabox;u=d.x-l;p=d.y-l;L=d.width+l*2;var T=d.height+l*2;d=u+L/2;w=p+T/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;L=u.x;T=u.y;var N=u.x,K=u.y;u=Math.min;p=Math.max;L=u(L,u(e.tr.x,u(e.bl.x,e.br.x)))-l;T=u(T,u(e.tr.y,u(e.bl.y,e.br.y)))-l;N=p(N,p(e.tr.x,p(e.bl.x,e.br.x)))+l;K=p(K,p(e.tr.y,p(e.bl.y,e.br.y)))+l;u=L;p=T;L=N-L;T=K-T}l=a.svgRoot().suspendRedraw(100);c.setAttribute("d", "M"+u+","+p+" L"+(u+L)+","+p+" "+(u+L)+","+(p+T)+" "+u+","+(p+T)+"z");this.selectorGroup.setAttribute("transform",b?"rotate("+[b,d,w].join(",")+")":"");u-=3.5;p-=3.5;this.gripCoords={nw:[u,p],ne:[u+L,p],sw:[u,p+T],se:[u+L,p+T],n:[u+L/2,p],w:[u,p+T/2],e:[u+L,p+T/2],s:[u+L/2,p+T]};for(var da in this.gripCoords){c=this.gripCoords[da];o[da].setAttribute("x",c[0]);o[da].setAttribute("y",c[1])}this.rotateCoords={nw:[u,p],ne:[u+L+8,p],sw:[u,p+T+8],se:[u+L+8,p+T+8]};for(da in this.rotateCoords){c=this.rotateCoords[da]; m.rotateGrips[da].setAttribute("cx",c[0]);m.rotateGrips[da].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:"transparent",r:8,stroke:"transparent","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_}; 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.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;o0){d=T 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],L=l-1<0?null:d[l-1];if(w.type===2){if(L&&L.type!==1){p=d[u];p.next=d[u+1];p.next.prev=p;p.addGrip()}u=l}else if(p&&p.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(p){if(w.type!== 1){w.addGrip();if(p&&p.type!==2){w.next=p;w.next.prev=w}}}else if(w.type!==1){p=d[u];p.next=d[u+1];p.next.prev=p;p.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').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 SVG-edit - http://svg-edit.googlecode.com/ ");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_},p=1,L=null,T={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}};T.text=$.extend(true,{},T.shape);$.extend(T.text,{fill:"#000000", stroke_width:0,font_size:24,font_family:"Junction"});var N=T.shape,K=Array(1),da=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)(L||k).appendChild(h)}g.curStyles&&svgedit.utilities.assignAttributes(h,{fill:N.fill,stroke:N.stroke,"stroke-width":N.stroke_width,"stroke-dasharray":N.stroke_dasharray,"stroke-linejoin":N.stroke_linejoin,"stroke-linecap":N.stroke_linecap, "stroke-opacity":N.stroke_opacity,"fill-opacity":N.fill_opacity,opacity:N.opacity/2,style:"pointer-events:inherit"},100);svgedit.utilities.assignAttributes(h,g.attr,100);svgedit.utilities.cleanupElement(h);return h},V=b.getTransformList=svgedit.transformlist.getTransformList,O=svgedit.math.transformPoint,fa=b.matrixMultiply=svgedit.math.matrixMultiply,sa=b.hasMatrixTransform=svgedit.math.hasMatrixTransform,ha=b.transformListToTransform=svgedit.math.transformListToTransform,ca=svgedit.math.snapToAngle, ea=svgedit.math.getMatrix;svgedit.units.init({getBaseUnit:function(){return m.baseUnit},getElement:svgedit.utilities.getElem,getHeight:function(){return l.getAttribute("height")/p},getWidth:function(){return l.getAttribute("width")/p},getRoundDigits:function(){return nb.round_digits}});var qa=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 pa=b.getUrlFromAttr=svgedit.utilities.getUrlFromAttr,ba=b.getHref=svgedit.utilities.getHref,S=b.setHref=svgedit.utilities.setHref,U=svgedit.utilities.getPathBBox;b.getBBox=svgedit.utilities.getBBox;var ra=b.getRotationAngle=svgedit.utilities.getRotationAngle,la=b.getElem=svgedit.utilities.getElem,ma=b.assignAttributes=svgedit.utilities.assignAttributes,Z=this.cleanupElement=svgedit.utilities.cleanupElement,Aa=svgedit.sanitize.getNSMap(),Ka=b.sanitizeSvg=svgedit.sanitize.sanitizeSvg, Ra=svgedit.history.MoveElementCommand,Na=svgedit.history.InsertElementCommand,Sa=svgedit.history.RemoveElementCommand,Xa=svgedit.history.ChangeElementCommand,Oa=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();I("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==Na.type()||v==Sa.type()){h.parent==l&&b.identifyLayers();if(v==Na.type())k&&$a(h.elem);else k||$a(h.elem);h.elem.tagName==="use"&&$b(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 t=v.nextSibling;k.removeChild(v);k.insertBefore(v,t)}}}}}});var Ia=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 p},getStrokedBBox:function(g){return b.getStrokedBBox([g])}});var Qa=this.selectorManager=svgedit.select.getSelectorManager();svgedit.path.init({getCurrentZoom:function(){return p},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 Ga=svgedit.utilities.snapToGrid,Fb={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"},Ob=["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"],lb=$.data, $a=function(g){var h=$(g).attr(Ob),k;for(k in h){var v=h[k];if(v&&v.indexOf("url(")===0){v=pa(v).substr(1);if(!la(v)){xb().appendChild(Bb[v]);delete Bb[v]}}}g=g.getElementsByTagName("*");if(g.length){h=0;for(k=g.length;h=0)C=D=b.convertToPath(F,true);else if(F.tagName=="rect"){var G=F.getAttribute("rx"),H=F.getAttribute("ry");if(G||H)C=D=b.convertToPath(F,true)}if(!D){var P=F.cloneNode(true),R=document.createElementNS(c,"g"),W=F.parentNode;W.appendChild(R);R.appendChild(P);C=svgedit.utilities.bboxToObj(R.getBBox());W.removeChild(R)}}return C}catch(ua){console.log(F,ua);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,t=k.y+k.height,E=k.x,z=k.y,s=function(F){var C=F.getAttribute("stroke-width"),D=0;if(F.getAttribute("stroke")!="none"&&!isNaN(C))D+=C/2;return D},A=[];$.each(g,function(F,C){var D=h(C);if(D){var G=s(C);E=Math.min(E,D.x-G);z=Math.min(z,D.y-G);A.push(D)}});k.x=E;k.y=z;$.each(g,function(F,C){var D=A[F];if(D&&C.nodeType==1){var G=s(C);v=Math.max(v,D.x+D.width+G);t=Math.max(t,D.y+D.height+G)}});k.width=v-E;k.height=t-z;return k};var Gb=this.getVisibleElements=function(g){g|| (g=$(l).children());var h=[];$(g).children().each(function(k,v){try{v.getBBox()&&h.push(v)}catch(t){}});return h.reverse()},Rb=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(t){}});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=M()},aa=function(g){var h=document.createElementNS(g.namespaceURI, g.nodeName);h.removeAttribute("id");$.each(g.attributes,function(v,t){t.localName!="-moz-math-font-style"&&h.setAttributeNS(t.namespaceURI,t.nodeName,t.nodeValue)});if(svgedit.browser.isWebkit()&&g.nodeName=="path"){var k=Ua.convertPath(g);h.setAttribute("d",k)}$.each(g.childNodes,function(v,t){switch(t.nodeType){case 1:h.appendChild(aa(t));break;case 3:h.textContent=t.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"&&ac(h);h.id=M();console.log(h);return h},ta,M,I;(function(g){var h={};ta=g.getId=function(){return w().getId()};M=g.getNextId=function(){return w().getNextId()};I=g.call=function(k,v){if(h[k])return h[k](this,v)};g.bind=function(k,v){var t=h[k];h[k]=v;return t}})(b);this.prepareSvg=function(g){this.sanitizeSvg(g.documentElement);g=g.getElementsByTagNameNS(c,"path");for(var h=0,k=g.length;h0&&t.getItem(0).type==4&&t.removeItem(0);if(g!= 0){E=O(E,z,ha(t).matrix);z=e.createSVGTransform();z.setRotate(g,E.x,E.y);t.numberOfItems?t.insertItemBefore(z,0):t.appendItem(z)}else t.numberOfItems==0&&k.removeAttribute("transform");if(!h){t=k.getAttribute("transform");k.setAttribute("transform",v);ob("transform",t,K);I("changed",K)}la("pathpointgrip_container");k=Qa.requestSelector(K[0]);k.resize();k.updateGripCursors(g)};var Wa=this.recalculateAllSelectedDimensions=function(){for(var g=new Oa(mb=="none"?"position":"size"),h=K.length;h--;){var k= pb(K[h]);k&&g.addSubCommand(k)}if(!g.isEmpty()){Ia(g);I("changed",K)}},db=[0,"z","M","m","L","l","C","c","Q","q","A","a","H","h","V","v","S","s","T","t"],tb=function(g){console.log([g.a,g.b,g.c,g.d,g.e,g.f])},ub=this.remapElement=function(g,h,k){var v=m.gridSnapping&&g.parentNode.parentNode.localName==="svg",t=function(){if(v)for(var D in h)h[D]=Ga(h[D]);ma(g,h,1E3,true)};box=svgedit.utilities.getBBox(g);for(var E=0;E<2;E++){var z=E===0?"fill":"stroke",s=g.getAttribute(z);if(s&&s.indexOf("url(")=== 0)if(k.a<0||k.d<0){s=Y(s).cloneNode(true);if(k.a<0){var A=s.getAttribute("x1"),F=s.getAttribute("x2");s.setAttribute("x1",-(A-1));s.setAttribute("x2",-(F-1))}if(k.d<0){A=s.getAttribute("y1");F=s.getAttribute("y2");s.setAttribute("y1",-(A-1));s.setAttribute("y2",-(F-1))}s.id=M();xb().appendChild(s);g.setAttribute(z,"url(#"+s.id+")")}}E=g.tagName;if(E==="g"||E==="text"||E==="use")if(k.a==1&&k.b==0&&k.c==0&&k.d==1&&(k.e!=0||k.f!=0)){z=ha(g).matrix;z=fa(z.inverse(),k,z);h.x=parseFloat(h.x)+z.e;h.y=parseFloat(h.y)+ z.f}else{z=V(g);s=e.createSVGTransform();s.setMatrix(fa(ha(z).matrix,k));z.clear();z.appendItem(s)}switch(E){case "foreignObject":case "rect":case "image":if(E==="image"&&(k.a<0||k.d<0)){z=V(g);s=e.createSVGTransform();s.setMatrix(fa(ha(z).matrix,k));z.clear();z.appendItem(s)}else{z=O(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)}t();break;case "ellipse":E=O(h.cx,h.cy,k);h.cx=E.x; h.cy=E.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);t();break;case "circle":E=O(h.cx,h.cy,k);h.cx=E.x;h.cy=E.y;E=svgedit.math.transformBox(box.x,box.y,box.width,box.height,k);h.r=Math.min((E.tr.x-E.tl.x)/2,(E.bl.y-E.tl.y)/2);if(h.r)h.r=Math.abs(h.r);t();break;case "line":z=O(h.x1,h.y1,k);A=O(h.x2,h.y2,k);h.x1=z.x;h.y1=z.y;h.x2=A.x;h.y2=A.y;case "text":k=g.querySelectorAll("tspan");for(E=k.length;E--;){z=qa("x",g.getAttribute("x"));s=qa("x",k[E].getAttribute("x"));A=qa("y", g.getAttribute("y"));F=qa("y",k[E].getAttribute("y"));var C={};if(!isNaN(z)&&!isNaN(s)&&z!=0&&s!=0&&h.x)C.x=h.x-(z-s);if(!isNaN(A)&&!isNaN(F)&&A!=0&&F!=0&&h.y)C.y=h.y-(A-F);if(C.x||C.y)ma(k[E],C,1E3,true)}t();break;case "use":t();break;case "g":(t=$(g).data("gsvg"))&&ma(t,h,1E3,true);break;case "polyline":case "polygon":t=h.points.length;for(E=0;E0){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&&ra(g))return null}if(!h||h.numberOfItems==0){g.removeAttribute("transform");return null}if(h){k=h.numberOfItems;for(var t=[];k--;){v=h.getItem(k);if(v.type===1)t.push([v.matrix,k]);else if(t.length)t=[]}if(t.length===2){k=e.createSVGTransformFromMatrix(fa(t[1][0],t[0][0]));h.removeItem(t[0][1]);h.removeItem(t[1][1]);h.insertItemBefore(k,t[1][1])}k=h.numberOfItems;if(k>=2&&h.getItem(k-2).type===1&&h.getItem(k-1).type===2){t=e.createSVGTransform(); v=fa(h.getItem(k-2).matrix,h.getItem(k-1).matrix);t.setMatrix(v);h.removeItem(k-2);h.removeItem(k-2);h.appendItem(t)}}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 E=$(g).data("gsvg");k=new Oa("Transform");var z={},s=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":s={};s.points=g.getAttribute("points");t=g.points;var A=t.numberOfItems;z.points=Array(A);for(var F=0;F1.0E-10?Math.sin(F)/(1-Math.cos(F)):2/F;for(F=0;F=3&&h.getItem(H-2).type==3&&h.getItem(H-3).type==2&&h.getItem(H-1).type==2){F=3;var R=h.getItem(H-3).matrix,W=h.getItem(H-2).matrix,ua=h.getItem(H-1).matrix;A=g.childNodes;for(C=A.length;C--;){var wa=A.item(C);v=E=0;if(wa.nodeType==1){var ga=V(wa);if(ga){v=ha(ga).matrix;E=ra(wa);var ka=Za,oa=[];Za=wa.getAttribute("transform");if(E||sa(ga)){var za=e.createSVGTransform();za.setMatrix(fa(R,W,ua,v));ga.clear(); ga.appendItem(za);oa.push(za)}else{E=fa(v.inverse(),ua,v);za=e.createSVGMatrix();za.e=-E.e;za.f=-E.f;v=fa(za.inverse(),v.inverse(),R,W,ua,v,E.inverse());var hb=e.createSVGTransform(),Hb=e.createSVGTransform(),Ib=e.createSVGTransform();hb.setTranslate(E.e,E.f);Hb.setScale(v.a,v.d);Ib.setTranslate(za.e,za.f);ga.appendItem(Ib);ga.appendItem(Hb);ga.appendItem(hb);oa.push(Ib);oa.push(Hb);oa.push(hb)}k.addSubCommand(pb(wa));Za=ka}}}h.removeItem(H-1);h.removeItem(H-2);h.removeItem(H-3)}else if(H>=3&&h.getItem(H- 1).type==1){F=3;v=ha(h).matrix;za=e.createSVGTransform();za.setMatrix(v);h.clear();h.appendItem(za)}else if((H==1||H>1&&h.getItem(1).type!=3)&&h.getItem(0).type==2){F=2;E=ha(h).matrix;h.removeItem(0);v=ha(h).matrix.inverse();v=fa(v,E);E=v.e;v=v.f;if(E!=0||v!=0){A=g.childNodes;C=A.length;for(H=[];C--;){wa=A.item(C);if(wa.nodeType==1){if(wa.getAttribute("clip-path")){ka=wa.getAttribute("clip-path");if(H.indexOf(ka)===-1){zb(ka,E,v);H.push(ka)}}ka=Za;Za=wa.getAttribute("transform");if(ga=V(wa)){R=e.createSVGTransform(); R.setTranslate(E,v);ga.numberOfItems?ga.insertItemBefore(R,0):ga.appendItem(R);k.addSubCommand(pb(wa));ga=g.getElementsByTagNameNS(c,"use");wa="#"+wa.id;for(R=ga.length;R--;){W=ga.item(R);if(wa==ba(W)){ua=e.createSVGTransform();ua.setTranslate(-E,-v);V(W).insertItemBefore(ua,0);k.addSubCommand(pb(W))}}Za=ka}}}H=[];Za=ka}}else if(H==1&&h.getItem(0).type==1&&!t){F=1;v=h.getItem(0).matrix;A=g.childNodes;for(C=A.length;C--;){wa=A.item(C);if(wa.nodeType==1){ka=Za;Za=wa.getAttribute("transform");if(ga= V(wa)){E=fa(v,ha(ga).matrix);H=e.createSVGTransform();H.setMatrix(E);ga.clear();ga.appendItem(H,0);k.addSubCommand(pb(wa));Za=ka;ka=wa.getAttribute("stroke-width");wa.getAttribute("stroke")!=="none"&&!isNaN(ka)&&wa.setAttribute("stroke-width",ka*((Math.abs(E.a)+Math.abs(E.d))/2))}}}h.clear()}else{if(t){D=e.createSVGTransform();D.setRotate(t,G.x,G.y);h.numberOfItems?h.insertItemBefore(D,0):h.appendItem(D)}h.numberOfItems==0&&g.removeAttribute("transform");return null}if(F==2){if(t){G={x:D.x+P.e,y:D.y+ P.f};D=e.createSVGTransform();D.setRotate(t,G.x,G.y);h.numberOfItems?h.insertItemBefore(D,0):h.appendItem(D)}}else if(F==3){v=ha(h).matrix;P=e.createSVGTransform();P.setRotate(t,D.x,D.y);P=P.matrix;D=e.createSVGTransform();D.setRotate(t,G.x,G.y);G=D.matrix.inverse();ka=v.inverse();G=fa(ka,G,P,v);E=G.e;v=G.f;if(E!=0||v!=0){A=g.childNodes;for(C=A.length;C--;){wa=A.item(C);if(wa.nodeType==1){ka=Za;Za=wa.getAttribute("transform");ga=V(wa);R=e.createSVGTransform();R.setTranslate(E,v);ga.numberOfItems? ga.insertItemBefore(R,0):ga.appendItem(R);k.addSubCommand(pb(wa));Za=ka}}}if(t)h.numberOfItems?h.insertItemBefore(D,0):h.appendItem(D)}}else{t=svgedit.utilities.getBBox(g);if(!t&&g.tagName!="path")return null;v=e.createSVGMatrix();if(E=ra(g)){D={x:t.x+t.width/2,y:t.y+t.height/2};G=O(t.x+t.width/2,t.y+t.height/2,ha(h).matrix);F=E*Math.PI/180;A=Math.abs(F)>1.0E-10?Math.sin(F)/(1-Math.cos(F)):2/F;for(F=0;F=3&&h.getItem(H-2).type==3&&h.getItem(H-3).type==2&&h.getItem(H-1).type==2){F=3;v=ha(h,H-3,H-1).matrix;h.removeItem(H-1);h.removeItem(H- 2);h.removeItem(H-3)}else if(H==4&&h.getItem(H-1).type==1){F=3;v=ha(h).matrix;za=e.createSVGTransform();za.setMatrix(v);h.clear();h.appendItem(za);v=e.createSVGMatrix()}else if((H==1||H>1&&h.getItem(1).type!=3)&&h.getItem(0).type==2){F=2;P=h.getItem(0).matrix;ka=ha(h,1).matrix;t=ka.inverse();v=fa(t,P,ka);h.removeItem(0)}else if(H==1&&h.getItem(0).type==1&&!E){v=ha(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){t=g.points;A=t.numberOfItems;z.points=Array(A);for(F=0;F1&&t.showGrips(false)}}}I("selected",K);h||K.length==1?Qa.requestSelector(K[0]).showGrips(true):Qa.requestSelector(K[0]).showGrips(false);for(K.sort(function(E,z){if(E&&z&&E.compareDocumentPosition)return 3- (z.compareDocumentPosition(E)&6);else if(E==null)return 1});K[0]==null;)K.shift(0)}},Qb=this.selectOnly=function(g,h){ab(true);Jb(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 Qa.selectorParentGroup;for(;g.parentNode!==(L||h);)g=g.parentNode;return g};(function(){var g=null,h=null,k=null,v= null,t=null,E={},z={minx:null,miny:null,maxx:null,maxy:null};$(a).mousedown(function(s){if(!(b.spaceKey||s.button===1)){var A=s.button===2;s.altKey&&svgCanvas.cloneSelectedElements(0,0);Mb=l.getScreenCTM().inverse();var F=O(s.pageX,s.pageY,Mb),C=F.x*p,D=F.y*p;s.preventDefault();if(A){Ma="select";sb=F}F=C/p;D=D/p;var G=Kb(s);if(G.tagName==="a"&&G.childNodes.length===1)G=G.firstChild;C=v=h=F;var H=t=k=D;if(m.gridSnapping){F=Ga(F);D=Ga(D);h=Ga(h);k=Ga(k)}if(G==Qa.selectorParentGroup&&K[0]!=null){G=s.target; var P=lb(G,"type");if(P=="rotate"){Ma="rotate";current_rotate_mode=lb(G,"dir")}else if(P=="resize"){Ma="resize";mb=lb(G,"dir")}G=K[0]}Za=G.getAttribute("transform");P=V(G);switch(Ma){case "select":Ja=true;mb="none";if(A)Ja=false;if(G!=e){if(K.indexOf(G)==-1){s.shiftKey||ab(true);Jb([G]);Pb=G;Ua.clear()}if(!A)for(A=0;A0&&b.removeFromSelection(D);G.length>0&&Jb(G);break;case "resize":D=V(A);G=(R=sa(D))?E:svgedit.utilities.getBBox(A);H=G.x;W=G.y;var ua=G.width,wa=G.height;G=x-h;P=y-k;if(m.gridSnapping){G=Ga(G);P=Ga(P);wa=Ga(wa);ua=Ga(ua)}var ga=ra(A);if(ga){var ka=Math.sqrt(G*G+P*P); P=Math.atan2(P,G)-ga*Math.PI/180;G=ka*Math.cos(P);P=ka*Math.sin(P)}if(mb.indexOf("n")==-1&&mb.indexOf("s")==-1)P=0;if(mb.indexOf("e")==-1&&mb.indexOf("w")==-1)G=0;var oa=ka=0,za=wa?(wa+P)/wa:1,hb=ua?(ua+G)/ua:1;if(mb.indexOf("n")>=0){za=wa?(wa-P)/wa:1;oa=wa}if(mb.indexOf("w")>=0){hb=ua?(ua-G)/ua:1;ka=ua}G=e.createSVGTransform();P=e.createSVGTransform();ua=e.createSVGTransform();if(m.gridSnapping){H=Ga(H);ka=Ga(ka);W=Ga(W);oa=Ga(oa)}G.setTranslate(-(H+ka),-(W+oa));if(s.shiftKey)if(hb==1)hb=za;else za= hb;P.setScale(hb,za);ua.setTranslate(H+ka,W+oa);if(R){R=ga?1:0;D.replaceItem(G,2+R);D.replaceItem(P,1+R);D.replaceItem(ua,0+R)}else{R=D.numberOfItems;D.replaceItem(ua,R-3);D.replaceItem(P,R-2);D.replaceItem(G,R-1)}Qa.requestSelector(A).resize();I("transition",K);break;case "zoom":G*=p;H*=p;ma(xa,{x:Math.min(v*p,G),y:Math.min(t*p,H),width:Math.abs(G-v*p),height:Math.abs(H-t*p)},100);break;case "text":ma(D,{x:x,y:y},1E3);break;case "line":G=null;window.opera||e.suspendRedraw(1E3);if(m.gridSnapping){x= Ga(x);y=Ga(y)}H=x;R=y;if(s.shiftKey){R=ca(h,k,H,R);H=R.x;R=R.y}D.setAttributeNS(null,"x2",H);D.setAttributeNS(null,"y2",R);window.opera||e.unsuspendRedraw(G);break;case "foreignObject":case "square":case "rect":case "image":G=Math.abs(x-h);R=Math.abs(y-k);if(Ma=="square"||s.shiftKey){G=R=Math.max(G,R);H=hk?k+W:k-W}if(s.altKey){R=h;H=k;W=Math.abs(x-R);P=s.shiftKey?W:Math.abs(y-H)}D.setAttributeNS(null,"rx",W);D.setAttributeNS(null,"ry",P); D.setAttributeNS(null,"cx",R);D.setAttributeNS(null,"cy",H);window.opera||e.unsuspendRedraw(G);break;case "fhellipse":case "fhrect":z.minx=Math.min(G,z.minx);z.maxx=Math.max(G,z.maxx);z.miny=Math.min(H,z.miny);z.maxy=Math.max(H,z.maxy);case "fhpath":g+=+G+","+H+" ";D.setAttributeNS(null,"points",g);break;case "path":case "pathedit":x*=p;y*=p;if(m.gridSnapping){x=Ga(x);y=Ga(y);h=Ga(h);k=Ga(k)}if(s.shiftKey){if(R=svgedit.path.path){D=R.dragging?R.dragging[0]:h;R=R.dragging?R.dragging[1]:k}else{D=h; R=k}R=ca(D,R,x,y);x=R.x;y=R.y}if(xa&&xa.getAttribute("display")!=="none"){G*=p;H*=p;ma(xa,{x:Math.min(v*p,G),y:Math.min(t*p,H),width:Math.abs(G-v*p),height:Math.abs(H-t*p)},100)}Ua.mouseMove(s,x,y);break;case "textedit":x*=p;y*=p;qb.mouseMove(C,F);break;case "rotate":G=svgedit.utilities.getBBox(A);R=G.x+G.width/2;H=G.y+G.height/2;D=ea(A);D=O(R,H,D);R=D.x;H=D.y;D=G.x;W=G.y;if(current_rotate_mode=="nw")D=G.x+G.width;if(current_rotate_mode=="se")W=G.y+G.height;if(current_rotate_mode=="sw"){D=G.x+G.width; W=G.y+G.height}compensation_angle=(Math.atan2(H-W,R-D)*(180/Math.PI)-90)%360;ga=(Math.atan2(H-y,R-x)*(180/Math.PI)-90)%360;ga+=compensation_angle;if(m.gridSnapping)ga=Ga(ga);if(s.shiftKey)ga=Math.round(ga/45)*45;b.setRotationAngle(ga<-180?360+ga:ga,true);I("transition",K)}kb("mouseMove",{event:s,mouse_x:C,mouse_y:F,selected:A})}}).click(function(s){s.preventDefault();return false}).dblclick(function(s){var A=s.target.parentNode;if(A!==L){var F=Kb(s),C=F.tagName;if(C==="text"&&Ma!=="textedit"){s=O(s.pageX, s.pageY,Mb);qb.select(F,s.x,s.y)}if((C==="g"||C==="a")&&ra(F)){Xb(F);F=K[0];ab(true)}L&&bc();A.tagName!=="g"&&A.tagName!=="a"||A===w().getCurrentLayer()||F===Qa.selectorParentGroup||mc(F)}}).mouseup(function(s){if(s.button!==2){var A=Pb;Pb=null;if(Ja){var F=O(s.pageX,s.pageY,Mb),C=F.x*p;F=F.y*p;var D=C/p,G=F/p,H=la(ta()),P=false;Ja=false;switch(Ma){case "resize":case "multiselect":if(xa!=null){xa.setAttribute("display","none");wb=[]}Ma="select";case "select":if(K[0]!=null){if(K[1]==null){C=K[0];switch(C.tagName){case "g":case "use":case "image":case "foreignObject":break; default:fb.fill=C.getAttribute("fill");fb.fill_opacity=C.getAttribute("fill-opacity");fb.stroke=C.getAttribute("stroke");fb.stroke_opacity=C.getAttribute("stroke-opacity");fb.stroke_width=C.getAttribute("stroke-width");fb.stroke_dasharray=C.getAttribute("stroke-dasharray");fb.stroke_linejoin=C.getAttribute("stroke-linejoin");fb.stroke_linecap=C.getAttribute("stroke-linecap")}if(C.tagName=="text"){eb.font_size=C.getAttribute("font-size");eb.font_family=C.getAttribute("font-family")}Qa.requestSelector(C).showGrips(true)}Wa(); if(D!=v||G!=t){s=K.length;for(C=0;C=0?A.indexOf(",",D+1)>=0:A.indexOf(" ",A.indexOf(" ")+1)>=0)H=Ua.smoothPolylineIntoPath(H);break;case "line":A=$(H).attr(["x1","x2","y1","y2"]);P=A.x1!=A.x2||A.y1!=A.y2;break;case "foreignObject":case "square":case "rect":case "image":A=$(H).attr(["width","height"]);P=A.width!=0||A.height!=0||Ma==="image";break;case "circle":P=H.getAttribute("r")!=0;break;case "ellipse":A=$(H).attr(["rx", "ry"]);P=A.rx!=null||A.ry!=null;break;case "fhellipse":if(z.maxx-z.minx>0&&z.maxy-z.miny>0){H=da({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:ta()}});I("changed",[H]);P=true}break;case "fhrect":if(z.maxx-z.minx>0&&z.maxy-z.miny>0){H=da({element:"rect",curStyles:true,attr:{x:z.minx,y:z.miny,width:z.maxx-z.minx,height:z.maxy-z.miny,id:ta()}});I("changed",[H]);P=true}break;case "text":P=true;Qb([H]);qb.start(H);break;case "path":H= null;Ja=true;A=Ua.mouseUp(s,H,C,F);H=A.element;P=A.keep;break;case "pathedit":P=true;H=null;Ua.mouseUp(s);break;case "textedit":P=false;H=null;qb.mouseUp(s,C,F);break;case "rotate":P=true;H=null;Ma="select";A=b.undoMgr.finishUndoableChange();A.isEmpty()||Ia(A);Wa();I("changed",K)}C=kb("mouseUp",{event:s,mouse_x:C,mouse_y:F},true);$.each(C,function(ua,wa){if(wa){P=wa.keep||P;H=wa.element;Ja=wa.started||Ja}});if(!P&&H!=null){w().releaseId(ta());H.parentNode.removeChild(H);H=null;for(C=s.target;C.parentNode.parentNode.tagName== "g";)C=C.parentNode;if((Ma!="path"||!drawn_path)&&C.parentNode.id!="selectorParentGroup"&&C.id!="svgcanvas"&&C.id!="svgroot"){b.setMode("select");Qb([C],true)}}else if(H!=null){b.addedNew=true;s=0.2;var R;if(false.beginElement&&H.getAttribute("opacity")!=N.opacity){R=$(false).clone().attr({to:N.opacity,dur:s}).appendTo(H);try{R[0].beginElement()}catch(W){}}else s=0;setTimeout(function(){R&&R.remove();H.setAttribute("opacity",N.opacity);H.setAttribute("style","pointer-events:inherit");Z(H);if(Ma=== "path")Ua.toEditMode(H);else m.selectNew&&Qb([H],true);Ia(new Na(H));I("changed",[H])},s*1E3)}Za=null}}});$(a).bind("mousewheel DOMMouseScroll",function(s){if(s.shiftKey){s.preventDefault();Mb=l.getScreenCTM().inverse();var A=O(s.pageX,s.pageY,Mb);A={x:A.x,y:A.y,width:0,height:0};if(s.wheelDelta)if(s.wheelDelta>=120)A.factor=2;else{if(s.wheelDelta<=-120)A.factor=0.5}else if(s.detail)if(s.detail>0)A.factor=0.5;else if(s.detail<0)A.factor=2;A.factor&&I("zoomed",A)}})})();var ac=function(g){$(g).click(function(h){h.preventDefault()})}, qb=b.textActions=function(){function g(ga){var ka=F.value==="";$(F).focus();if(!arguments.length)if(ka)ga=0;else{if(F.selectionEnd!==F.selectionStart)return;ga=F.selectionEnd}var oa;oa=H[ga];ka||F.setSelectionRange(ga,ga);C=la("text_cursor");if(!C){C=document.createElementNS(c,"line");ma(C,{id:"text_cursor",stroke:"#333","stroke-width":1});C=la("selectorParentGroup").appendChild(C)}G||(G=setInterval(function(){var za=C.getAttribute("display")==="none";C.setAttribute("display",za?"inline":"none")}, 600));ka=E(oa.x,P.y);oa=E(oa.x,P.y+P.height);ma(C,{x1:ka.x,y1:ka.y,x2:oa.x,y2:oa.y,visibility:"visible",display:"inline"});D&&D.setAttribute("d","")}function h(ga,ka,oa){if(ga===ka)g(ka);else{oa||F.setSelectionRange(ga,ka);D=la("text_selectblock");if(!D){D=document.createElementNS(c,"path");ma(D,{id:"text_selectblock",fill:"green",opacity:0.5,style:"pointer-events:none"});la("selectorParentGroup").appendChild(D)}ga=H[ga];var za=H[ka];C.setAttribute("visibility","hidden");ka=E(ga.x,P.y);oa=E(ga.x+ (za.x-ga.x),P.y);var hb=E(ga.x,P.y+P.height);ga=E(ga.x+(za.x-ga.x),P.y+P.height);ma(D,{d:"M"+ka.x+","+ka.y+" L"+oa.x+","+oa.y+" "+ga.x+","+ga.y+" "+hb.x+","+hb.y+"z",display:"inline"})}}function k(ga,ka){var oa=e.createSVGPoint();oa.x=ga;oa.y=ka;if(H.length==1)return 0;oa=A.getCharNumAtPosition(oa);if(oa<0){oa=H.length-2;if(ga<=H[0].x)oa=0}else if(oa>=H.length-2)oa=H.length-2;var za=H[oa];ga>za.x+za.width/2&&oa++;return oa}function v(ga,ka,oa){var za=F.selectionStart;ga=k(ga,ka);h(Math.min(za,ga), Math.max(za,ga),!oa)}function t(ga,ka){var oa={x:ga,y:ka};oa.x/=p;oa.y/=p;if(R){var za=O(oa.x,oa.y,R.inverse());oa.x=za.x;oa.y=za.y}return oa}function E(ga,ka){var oa={x:ga,y:ka};if(R){var za=O(oa.x,oa.y,R);oa.x=za.x;oa.y=za.y}oa.x*=p;oa.y*=p;return oa}function z(ga){h(0,A.textContent.length);$(this).unbind(ga)}function s(ga){if(wa&&A){var ka=O(ga.pageX,ga.pageY,Mb);ka=t(ka.x*p,ka.y*p);ka=k(ka.x,ka.y);var oa=A.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);$(ga.target).click(z);setTimeout(function(){$(ga.target).unbind("click",z)},300)}}var A,F,C,D,G,H=[],P,R,W,ua,wa;return{select:function(ga,ka,oa){A=ga;qb.toEditMode(ka,oa)},start:function(ga){A=ga;qb.toEditMode()},mouseDown:function(ga,ka,oa,za){ga=t(oa,za);F.focus();g(k(ga.x,ga.y));W=oa;ua=za},mouseMove:function(ga,ka){var oa=t(ga,ka);v(oa.x,oa.y)},mouseUp:function(ga,ka,oa){var za=t(ka,oa);v(za.x,za.y,true);ga.target!==A&&kaW-2&&oaua-2&&qb.toSelectMode(true)}, setCursor:g,toEditMode:function(ga,ka){wa=false;Ma="textedit";Qa.requestSelector(A).showGrips(false);Qa.requestSelector(A);qb.init();$(A).css("cursor","text");if(arguments.length){var oa=t(ga,ka);g(k(oa.x,oa.y))}else g();setTimeout(function(){wa=true},300)},toSelectMode:function(ga){Ma="select";clearInterval(G);G=null;D&&$(D).attr("display","none");C&&$(C).attr("visibility","hidden");$(A).css("cursor","move");if(ga){ab();$(A).css("cursor","move");I("selected",[A]);Jb([A],true)}A&&!A.textContent.length&& b.deleteSelectedElements();$(F).blur();A=false},setInputElem:function(ga){F=ga},clear:function(){Ma=="textedit"&&qb.toSelectMode()},init:function(){if(A){if(!A.parentNode){A=K[0];Qa.requestSelector(A).showGrips(false)}var ga=A.textContent.length,ka=A.getAttribute("transform");P=svgedit.utilities.getBBox(A);R=ka?ea(A):null;H=Array(ga);F.focus();$(A).unbind("dblclick",s).dblclick(s);if(!ga)var oa={x:P.x+P.width/2,width:0};for(ka=0;ka=0&&this.selected_pts.push(A)}this.selected_pts.sort();s=this.selected_pts.length;for(z=Array(s);s--;){F=this.segs[this.selected_pts[s]];F.select(true);z[s]=F.ptgrip}Ua.canDeleteNodes=true;Ua.closed_subpath=this.subpathIsClosed(this.selected_pts[0]);I("selected",z)};var t=h=null,E=false;return{mouseDown:function(z,s,A,F){if(Ma==="path"){mouse_x=A;mouse_y=F;F=mouse_x/ p;s=mouse_y/p;A=la("path_stretch_line");k=[F,s];if(m.gridSnapping){F=Ga(F);s=Ga(s);mouse_x=Ga(mouse_x);mouse_y=Ga(mouse_y)}if(!A){A=document.createElementNS(c,"path");ma(A,{id:"path_stretch_line",stroke:"#22C","stroke-width":"0.5",fill:"none"});A=la("selectorParentGroup").appendChild(A)}A.setAttribute("display","inline");var C=null;if(t){C=t.pathSegList;for(var D=C.numberOfItems,G=6/p,H=false;D;){D--;var P=C.getItem(D),R=P.x;P=P.y;if(F>=R-G&&F<=R+G&&s>=P-G&&s<=P+G){H=true;break}}G=ta();svgedit.path.removePath_(G); G=la(G);R=C.numberOfItems;if(H){if(D<=1&&R>=2){F=C.getItem(0).x;s=C.getItem(0).y;z=A.pathSegList.getItem(1);z=z.pathSegType===4?t.createSVGPathSegLinetoAbs(F,s):t.createSVGPathSegCurvetoCubicAbs(F,s,z.x1/p,z.y1/p,F,s);F=t.createSVGPathSegClosePath();C.appendItem(z);C.appendItem(F)}else if(R<3)return C=false;$(A).remove();element=G;t=null;Ja=false;if(g){svgedit.path.path.matrix&&ub(G,{},svgedit.path.path.matrix.inverse());A=G.getAttribute("d");z=$(svgedit.path.path.elem).attr("d");$(svgedit.path.path.elem).attr("d", z+A);$(G).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,Kb(z))){console.log("Clicked outside canvas");return false}C=t.pathSegList.numberOfItems;D=t.pathSegList.getItem(C-1);G=D.x;D=D.y;if(z.shiftKey){z=ca(G,D,F,s);F=z.x;s=z.y}z=A.pathSegList.getItem(1);z=z.pathSegType===4?t.createSVGPathSegLinetoAbs(Cb(F),Cb(s)):t.createSVGPathSegCurvetoCubicAbs(Cb(F), Cb(s),z.x1/p,z.y1/p,z.x2/p,z.y2/p);t.pathSegList.appendItem(z);F*=p;s*=p;A.setAttribute("d",["M",F,s,F,s].join(" "));A=C;if(g)A+=svgedit.path.path.segs.length;svgedit.path.addPointGrip(A,F,s)}}else{d_attr="M"+F+","+s+" ";t=da({element:"path",curStyles:true,attr:{d:d_attr,id:M(),opacity:N.opacity/2}});A.setAttribute("d",["M",mouse_x,mouse_y,mouse_x,mouse_y].join(" "));A=g?svgedit.path.path.segs.length:0;svgedit.path.addPointGrip(A,mouse_x,mouse_y)}}else if(svgedit.path.path){svgedit.path.path.storeD(); G=z.target.id;if(G.substr(0,14)=="pathpointgrip_"){s=svgedit.path.path.cur_pt=parseInt(G.substr(14));svgedit.path.path.dragging=[A,F];C=svgedit.path.path.segs[s];if(z.shiftKey)C.selected?svgedit.path.path.removePtFromSelection(s):svgedit.path.path.addPtsToSelection(s);else{if(svgedit.path.path.selected_pts.length<=1||!C.selected)svgedit.path.path.clearSelection();svgedit.path.path.addPtsToSelection(s)}}else if(G.indexOf("ctrlpointgrip_")==0){svgedit.path.path.dragging=[A,F];z=G.split("_")[1].split("c"); s=z[0]-0;svgedit.path.path.selectPt(s,z[1]-0)}if(!svgedit.path.path.dragging){if(xa==null)xa=Qa.getRubberBandBox();ma(xa,{x:A*p,y:F*p,width:0,height:0,display:"inline"},100)}}},mouseMove:function(z,s,A){E=true;if(Ma==="path"){if(t){var F=t.pathSegList;z=F.numberOfItems-1;if(k){var C=svgedit.path.addCtrlGrip("1c1"),D=svgedit.path.addCtrlGrip("0c2");D.getAttribute("cx");D.getAttribute("cy");C.setAttribute("cx",s);C.setAttribute("cy",A);C.setAttribute("display","inline");C=k[0];var G=k[1];F.getItem(z); var H=C+(C-s/p),P=G+(G-A/p);D.setAttribute("cx",H*p);D.setAttribute("cy",P*p);D.setAttribute("display","inline");D=svgedit.path.getCtrlLine(1);var R=svgedit.path.getCtrlLine(2);ma(D,{x1:s,y1:A,x2:C*p,y2:G*p,display:"inline"});ma(R,{x1:H*p,y1:P*p,x2:C*p,y2:G*p,display:"inline"});if(z===0)v=[s,A];else{F=F.getItem(z-1);s=F.x;A=F.y;if(F.pathSegType===6){s+=s-F.x2;A+=A-F.y2}else if(v){s=v[0]/p;A=v[1]/p}svgedit.path.replacePathSeg(6,z,[C,G,s,A,H,P],t)}}else if(C=la("path_stretch_line")){z=F.getItem(z); if(z.pathSegType===6)svgedit.path.replacePathSeg(6,1,[s,A,(z.x+(z.x-z.x2))*p,(z.y+(z.y-z.y2))*p,s,A],C);else v?svgedit.path.replacePathSeg(6,1,[s,A,v[0],v[1],s,A],C):svgedit.path.replacePathSeg(4,1,[s,A],C)}}}else if(svgedit.path.path.dragging){C=svgedit.path.getPointFromGrip({x:svgedit.path.path.dragging[0],y:svgedit.path.path.dragging[1]},svgedit.path.path);G=svgedit.path.getPointFromGrip({x:s,y:A},svgedit.path.path);z=G.x-C.x;C=G.y-C.y;svgedit.path.path.dragging=[s,A];svgedit.path.path.dragctrl? svgedit.path.path.moveCtrl(z,C):svgedit.path.path.movePts(z,C)}else{svgedit.path.path.selected_pts=[];svgedit.path.path.eachSeg(function(){if(this.next||this.prev){var W=xa.getBBox(),ua=svgedit.path.getGripPt(this);W=svgedit.math.rectsIntersect(W,{x:ua.x,y:ua.y,width:0,height:0});this.select(W);W&&svgedit.path.path.selected_pts.push(this.index)}})}},mouseUp:function(z,s){if(Ma==="path"){k=null;if(!t){s=la(ta());Ja=false;v=null}return{keep:true,element:s}}if(svgedit.path.path.dragging){var A=svgedit.path.path.cur_pt; svgedit.path.path.dragging=false;svgedit.path.path.dragctrl=false;svgedit.path.path.update();E&&svgedit.path.path.endChanges("Move path point(s)");!z.shiftKey&&!E&&svgedit.path.path.selectPt(A)}else if(xa&&xa.getAttribute("display")!="none"){xa.setAttribute("display","none");xa.getAttribute("width")<=2&&xa.getAttribute("height")<=2&&Ua.toSelectMode(z.target)}else Ua.toSelectMode(z.target);E=false},toEditMode:function(z){svgedit.path.path=svgedit.path.getPath_(z);Ma="pathedit";ab();svgedit.path.path.show(true).update(); svgedit.path.path.oldbbox=svgedit.utilities.getBBox(svgedit.path.path.elem);g=false},toSelectMode:function(z){var s=z==svgedit.path.path.elem;Ma="select";svgedit.path.path.show(false);h=false;ab();svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath();if(s){I("selected",[z]);Jb([z],true)}},addSubPath:function(z){if(z){Ma="path";g=true}else{Ua.clear(true);Ua.toEditMode(svgedit.path.path.elem)}},select:function(z){if(h===z){Ua.toEditMode(z);Ma="pathedit"}else h=z},reorient:function(){var z=K[0]; if(z)if(ra(z)!=0){var s=new Oa("Reorient path"),A={d:z.getAttribute("d"),transform:z.getAttribute("transform")};s.addSubCommand(new Xa(z,A));ab();this.resetOrientation(z);Ia(s);svgedit.path.getPath_(z).show(false).matrix=null;this.clear();Jb([z],true);I("changed",K)}},clear:function(){h=null;if(t){var z=la(ta());$(la("path_stretch_line")).remove();$(z).remove();$(la("pathpointgrip_container")).find("*").attr("display","none");t=v=null;Ja=false}else Ma=="pathedit"&&this.toSelectMode();svgedit.path.path&& svgedit.path.path.init().show(false)},resetOrientation:function(z){if(z==null||z.nodeName!="path")return false;var s=V(z),A=ha(s).matrix;s.clear();z.removeAttribute("transform");s=z.pathSegList;for(var F=s.numberOfItems,C=0;C0){G=F.getItem(C-1).pathSegType;if(G===2){D(C-1,1);A();break}else if(G===1&&F.numberOfItems-1===C){D(C,1);A();break}}}return false};A();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 s=z.points,A=s.numberOfItems;if(A>=4){var F=s.getItem(0),C=null;z=[];z.push(["M",F.x,",",F.y," C"].join(""));for(var D=1;D<=A-4;D+=3){var G=s.getItem(D),H=s.getItem(D+1),P=s.getItem(D+2);if(C)if((F=svgedit.path.smoothControlPoints(C,G,F))&&F.length==2){G=z[z.length-1].split(",");G[2]=F[0].x;G[3]=F[0].y;z[z.length-1]=G.join(",");G=F[1]}z.push([G.x,G.y,H.x,H.y,P.x,P.y].join(","));F=P;C=H}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(L){bc();Qb([L])}var g=[];$(l).find("g:data(gsvg)").each(function(){for(var k=this.attributes,v=k.length,t=0;t=0;A--){s=z.item(A);D=v(s.nodeValue);if(!(G.indexOf(s.localName)>=0))if(D!="")if(D.indexOf("pointer-events")!==0)if(!(s.localName==="class"&&D.indexOf("se_")===0)){k.push(" ");if(s.localName==="d")D=Ua.convertPath(g,true);if(isNaN(D)){if(E.test(D))D=svgedit.units.shortFloat(D)+t}else D=svgedit.units.shortFloat(D);if(nb.apply&&g.nodeName==="image"&&s.localName==="href"&&nb.images&&nb.images==="embed"){var H= Ya[D];if(H)D=H}if(!s.namespaceURI||s.namespaceURI==c||Aa[s.namespaceURI]){k.push(s.nodeName);k.push('="');k.push(D);k.push('"')}}}}if(g.hasChildNodes()){k.push(">");h++;z=false;for(A=0;A");break;case 8:k.push("\n"); k.push(Array(h+1).join(" "));k.push("